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_stringify_expand() {
check_expansion(
r#"
#[rustc_builtin_macro]
macro_rules! stringify {() => {}}
stringify!(a b c)
"#,
expect![["\"a b c\""]],
);
} | rust_cleaned_test_functions.jsonl/112670 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 166
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
1437,
67875,
368,
341,
286,
1779,
14214,
10501,
1006,
310,
435,
2,
698,
310,
11506,
35788,
66,
73829,
58810,
921,
310,
18072,
21407,
0,
83166,
314,
368,
589,
4687,
532,
310,
83166,
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 |
#[test]
fn test_cmd_output() {
// create a command to run cat.
let cmd = Command::new("cat").args(&["test/api/test.txt"]);
let (mut rx, _) = cmd.spawn().unwrap();
crate::async_runtime::block_on(async move {
while let Some(event) = rx.recv().await {
match event {
CommandEvent::Terminated(payload) => {
assert_eq!(payload.code, Some(0));
}
CommandEvent::Stdout(line) => {
assert_eq!(line, "This is a test doc!".to_string());
}
_ => {}
}
}
});
} | rust_cleaned_test_functions.jsonl/43776 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 285
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11684,
7645,
368,
341,
262,
442,
1855,
264,
3210,
311,
1598,
8251,
624,
262,
1077,
5439,
284,
7348,
486,
931,
445,
4616,
1827,
2116,
2099,
1183,
1944,
10508,
12697,
3909,
15049,
262,
1077,
320,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_get_item() {
let gil = Python::acquire_gil();
let py = gil.python();
let v = vec![2, 3, 5, 7];
let ob = v.to_object(py);
let list = <PyList as PyTryFrom>::try_from(ob.as_ref(py)).unwrap();
assert_eq!(2, list.get_item(0).extract::<i32>().unwrap());
assert_eq!(3, list.get_item(1).extract::<i32>().unwrap());
assert_eq!(5, list.get_item(2).extract::<i32>().unwrap());
assert_eq!(7, list.get_item(3).extract::<i32>().unwrap());
} | rust_cleaned_test_functions.jsonl/16311 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 271
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
5634,
368,
341,
286,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
286,
1077,
4510,
284,
342,
321,
43193,
543,
286,
1077,
348,
284,
7486,
20703,
17,
11,
220,
18,
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_bytes_read_static() {
#[derive(PartialEq, Debug, DekuRead, DekuWrite)]
struct TestStruct<'a> {
#[deku(bytes_read = "2")]
data: &'a [u8],
}
let test_data: Vec<u8> = [0xAA, 0xBB].to_vec();
let ret_read = TestStruct::try_from(test_data.as_ref()).unwrap();
assert_eq!(
TestStruct {
data: test_data.as_ref()
},
ret_read
);
let ret_write: Vec<u8> = ret_read.try_into().unwrap();
assert_eq!(test_data, ret_write);
} | rust_cleaned_test_functions.jsonl/16485 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 332
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12524,
6443,
25360,
368,
341,
286,
11506,
27098,
5304,
20894,
27312,
11,
11091,
11,
74463,
84,
4418,
11,
74463,
84,
7985,
5563,
286,
2036,
3393,
9422,
18291,
64,
29,
341,
310,
11506,
450,
12133,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_errors() {
let mut event_manager = EventManager::new().unwrap();
let dummy_subscriber = Arc::new(Mutex::new(DummySubscriber::new()));
event_manager
.add_subscriber(dummy_subscriber.clone())
.unwrap();
assert!(event_manager.add_subscriber(dummy_subscriber).is_err())
} | rust_cleaned_test_functions.jsonl/92055 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 166
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14000,
20196,
368,
341,
286,
1077,
5206,
1538,
12144,
284,
3665,
2043,
486,
931,
1005,
15454,
543,
286,
1077,
17292,
5228,
20351,
284,
19689,
486,
931,
3189,
9371,
486,
931,
5432,
8574,
40236,
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_remove_ns() {
let name = Name::from_str("example.com.").unwrap();
let record_type = RecordType::NS;
let mut rr_set = RecordSet::new(&name, record_type, 0);
let ns1 = Record::new()
.set_name(name.clone())
.set_ttl(86400)
.set_rr_type(RecordType::NS)
.set_dns_class(DNSClass::IN)
.set_rdata(RData::NS(Name::from_str("a.iana-servers.net.").unwrap()))
.clone();
let ns2 = Record::new()
.set_name(name.clone())
.set_ttl(86400)
.set_rr_type(RecordType::NS)
.set_dns_class(DNSClass::IN)
.set_rdata(RData::NS(Name::from_str("b.iana-servers.net.").unwrap()))
.clone();
assert!(rr_set.insert(ns1.clone(), 0));
assert!(rr_set.insert(ns2.clone(), 0));
assert!(rr_set.remove(&ns1, 0));
assert!(!rr_set.remove(&ns2, 0));
// check that we can swap which ones are removed
assert!(rr_set.insert(ns1.clone(), 0));
assert!(rr_set.remove(&ns2, 0));
assert!(!rr_set.remove(&ns1, 0));
} | rust_cleaned_test_functions.jsonl/119982 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 616
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
34728,
368,
341,
286,
1077,
829,
284,
3988,
486,
1499,
2895,
445,
8687,
905,
98401,
15454,
543,
286,
1077,
3255,
1819,
284,
13583,
929,
486,
2448,
280,
286,
1077,
5206,
34393,
2602,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_set_property_page() {
let mut transaction_context = MockTransactionContext::default();
let state = TrackAndTraceState::new(&mut transaction_context);
assert!(state
.set_property_page(RECORD_ID, PROPERTY_NAME, 1, make_property_page())
.is_ok());
let result = state
.get_property_page(RECORD_ID, PROPERTY_NAME, 1)
.unwrap();
assert_eq!(result, Some(make_property_page()));
} | rust_cleaned_test_functions.jsonl/116997 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 221
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
16638,
6129,
368,
341,
286,
1077,
5206,
7745,
8467,
284,
14563,
8070,
1972,
486,
2258,
543,
286,
1077,
1584,
284,
19785,
3036,
6550,
1397,
486,
931,
2099,
6984,
7745,
8467,
317,
286,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iter() {
let hdr: MapxOrdRawKeyVs<usize> = MapxOrdRawKeyVs::new();
let mvn = VersionName(b"manster0");
pnk!(hdr.version_create(mvn));
let max = 500;
(0..max).map(|i: usize| (i, i)).for_each(|(key, value)| {
let key = <usize as ValueEnDe>::encode(&key);
assert!(pnk!(hdr.insert(key, value)).is_none());
});
for (key, _) in hdr.iter() {
assert!(pnk!(hdr.remove(&key)).is_some());
}
assert_eq!(0, hdr.len());
} | rust_cleaned_test_functions.jsonl/53993 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 249
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
368,
341,
262,
1077,
36615,
25,
5027,
87,
24621,
20015,
1592,
51737,
90244,
29,
284,
5027,
87,
24621,
20015,
1592,
51737,
486,
931,
543,
262,
1077,
23164,
77,
284,
6079,
675,
1883,
1,
151... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_insert() {
let mut a = vec![1, 2, 4];
a.insert(2, 3);
assert_eq!(a, [1, 2, 3, 4]);
let mut a = vec![1, 2, 3];
a.insert(0, 0);
assert_eq!(a, [0, 1, 2, 3]);
let mut a = vec![1, 2, 3];
a.insert(3, 4);
assert_eq!(a, [1, 2, 3, 4]);
let mut a = vec![];
a.insert(0, 1);
assert_eq!(a, [1]);
} | rust_cleaned_test_functions.jsonl/12875 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 204
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
368,
341,
262,
1077,
5206,
264,
284,
7486,
20703,
16,
11,
220,
17,
11,
220,
19,
935,
262,
264,
7030,
7,
17,
11,
220,
18,
317,
262,
2060,
10714,
10297,
64,
11,
508,
16,
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_generate_snapshot() {
let mut cluster = new_server_cluster(1, 5);
cluster.cfg.raft_store.raft_log_gc_tick_interval = ReadableDuration::millis(20);
cluster.cfg.raft_store.raft_log_gc_count_limit = 8;
cluster.cfg.raft_store.merge_max_log_gap = 3;
let pd_client = Arc::clone(&cluster.pd_client);
pd_client.disable_default_operator();
cluster.run();
cluster.must_transfer_leader(1, new_peer(1, 1));
cluster.stop_node(4);
cluster.stop_node(5);
(0..10).for_each(|_| cluster.must_put(b"k2", b"v2"));
// Sleep for a while to ensure all logs are compacted.
thread::sleep(Duration::from_millis(100));
fail::cfg("snapshot_delete_after_send", "pause").unwrap();
// Let store 4 inform leader to generate a snapshot.
cluster.run_node(4).unwrap();
must_get_equal(&cluster.get_engine(4), b"k2", b"v2");
fail::cfg("snapshot_enter_do_build", "pause").unwrap();
cluster.run_node(5).unwrap();
thread::sleep(Duration::from_millis(100));
fail::cfg("snapshot_delete_after_send", "off").unwrap();
must_empty_dir(cluster.get_snap_dir(1));
// The task is droped so that we can't get the snapshot on store 5.
fail::cfg("snapshot_enter_do_build", "pause").unwrap();
must_get_none(&cluster.get_engine(5), b"k2");
fail::cfg("snapshot_enter_do_build", "off").unwrap();
must_get_equal(&cluster.get_engine(5), b"k2", b"v2");
fail::remove("snapshot_enter_do_build");
fail::remove("snapshot_delete_after_send");
} | rust_cleaned_test_functions.jsonl/68039 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 614
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48851,
53265,
368,
341,
262,
1077,
5206,
10652,
284,
501,
12015,
28441,
7,
16,
11,
220,
20,
317,
262,
10652,
30481,
13,
2944,
14809,
13,
2944,
5224,
49423,
43612,
20541,
284,
4457,
480,
12945,
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_skip_cond_deku() {
let test_data: Vec<u8> = [0x01].to_vec();
let ret_read = samples::SkipCondDeku::try_from(test_data.as_ref()).unwrap();
assert_eq!(
samples::SkipCondDeku {
field_a: 0x01,
field_b: 0x05, // default
},
ret_read
);
let ret_write: Vec<u8> = ret_read.try_into().unwrap();
assert_eq!(vec![0x01], ret_write);
} | rust_cleaned_test_functions.jsonl/123232 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 220
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44830,
24433,
2259,
12133,
368,
341,
262,
1077,
1273,
1769,
25,
11312,
34837,
23,
29,
284,
508,
15,
87,
15,
16,
936,
983,
13251,
1428,
262,
1077,
2112,
6443,
284,
10469,
486,
35134,
49696,
35,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extract_struct_keeps_trait_bounds() {
check_assist(
extract_struct_from_enum_variant,
r#"
enum En<T: TraitT, V: TraitV> {
$0A { a: T },
B { b: V },
}
"#,
r#"
struct A<T: TraitT>{ a: T }
enum En<T: TraitT, V: TraitV> {
A(A<T>),
B { b: V },
}
"#,
);
} | rust_cleaned_test_functions.jsonl/36321 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 214
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
15126,
45476,
7124,
78491,
36878,
368,
341,
286,
1779,
12083,
380,
1006,
310,
8649,
15126,
5673,
31054,
46112,
345,
310,
435,
2,
698,
9018,
2925,
3125,
25,
68301,
51,
11,
647,
25,
68301,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_prevote_partition_leader_in_majority_detect_in_minority() {
let mut cluster = new_node_cluster(0, 5);
// The follower is in the minority and is part of a prevote process. On rejoin it adopts the
// old leader.
test_prevote(
&mut cluster,
FailureType::Partition(&[1, 2, 3], &[4, 5]),
None,
(4, true),
None,
);
} | rust_cleaned_test_functions.jsonl/86913 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 177
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25566,
1272,
43840,
79991,
1243,
47916,
487,
56457,
1243,
70861,
487,
368,
341,
262,
1077,
5206,
10652,
284,
501,
5084,
28441,
7,
15,
11,
220,
20,
317,
262,
442,
576,
48207,
374,
304,
279,
22591... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_indexed_reader_crlf_by_rid_all() {
_test_indexed_reader_by_rid_all(&FASTA_FILE_CRLF, &FAI_FILE_CRLF, _read_buffer_by_rid_all);
} | rust_cleaned_test_functions.jsonl/62838 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 87
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3560,
291,
22306,
666,
2381,
69,
3710,
1710,
307,
5705,
368,
341,
286,
716,
1944,
3560,
291,
22306,
3710,
1710,
307,
5705,
2099,
59206,
32,
8087,
920,
80658,
11,
609,
3627,
40,
8087,
920,
80658,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_couldnt_parse_statsd() -> Result<(), String> {
let input = [
"MONITORING",
"cool_service",
"2017-04-26T10:41:09.023Z",
"some_str:12345.6|fake_metric_type",
];
let input_joined = input.join(MONITORING_DELIM);
let parsed = parse_log(input_joined.as_str());
match parsed {
Err(MetricForwarderError::ParseStringToStatsdError(e, _)) => {
assert_eq!(e, statsd_parser::ParseError::UnknownMetricType.to_string());
Ok(())
}
_ => Err(String::from("we expected an err here")),
}
} | rust_cleaned_test_functions.jsonl/132012 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 350
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
616,
406,
21039,
15381,
67,
368,
1464,
5714,
68843,
923,
29,
341,
286,
1077,
1946,
284,
2278,
310,
330,
21344,
44556,
1718,
756,
310,
330,
42196,
12267,
756,
310,
330,
17,
15,
16,
22,
12,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_find_end_quote() {
assert_eq!(find_end_quote(b"\""), None);
assert_eq!(find_end_quote(b"\"\""), Some(b"".len()));
assert_eq!(find_end_quote(b"\"utf-8\""), Some(b"utf-8".len()));
assert_eq!(find_end_quote(b"\"'utf-8'\""), Some(b"'utf-8'".len()));
assert_eq!(find_end_quote(b"\"utf-8\"; key=value"), Some(b"utf-8".len()));
assert_eq!(find_end_quote(b"\"hello \\\"world\\\" 1337\""),
Some(b"hello \\\"world\\\" 1337".len()));
assert_eq!(find_end_quote(b"\"abcd fghi\\\" jklm \"; nopq"),
Some(b"abcd fghi\\\" jklm ".len()));
assert_eq!(find_end_quote(b"\"utf-8; key=value"), None);
assert_eq!(find_end_quote(b"\"utf-8\\\"; key=value"), None);
} | rust_cleaned_test_functions.jsonl/58202 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 400
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
6213,
45236,
368,
341,
286,
2060,
10714,
10297,
3903,
6213,
45236,
1883,
1,
2105,
3975,
2240,
317,
286,
2060,
10714,
10297,
3903,
6213,
45236,
1883,
1,
2105,
2105,
3975,
4329,
1883,
69355,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_current_niceness() {
// NOTE: this assumes the test suite is being run with a default niceness
new_ucmd!().run().stdout_is("0\n");
} | rust_cleaned_test_functions.jsonl/15163 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 70
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
11080,
1089,
292,
23709,
368,
341,
262,
442,
16743,
25,
419,
21484,
279,
1273,
16182,
374,
1660,
1598,
448,
264,
1638,
17327,
23709,
7213,
262,
501,
68887,
2277,
0,
1005,
6108,
1005,
36358,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_local_timestamp_with_date() {
let c_time = chrono::offset::Utc::now().format("%Y-%m-%d %H:%M:%S").to_string();
assert_eq!(
convert_to_local_timestamp(&c_time, true).unwrap(),
Local::now().format("%Y-%m-%d %H:%M:%S").to_string(),
);
} | rust_cleaned_test_functions.jsonl/10673 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 168
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14825,
13564,
23073,
6615,
4164,
368,
341,
286,
1077,
272,
3009,
284,
80372,
486,
3176,
486,
97768,
486,
3328,
1005,
2243,
4430,
56,
11069,
76,
11069,
67,
1018,
39,
7533,
44,
7533,
50,
1827,
983... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_alloc_conditionally() {
{
let mut cs = TestConstraintSystem::<Scalar>::new();
let b = AllocatedBit::alloc(&mut cs, Some(false)).unwrap();
let value = None;
let is_err = AllocatedBit::alloc_conditionally(
cs.namespace(|| "alloc_conditionally"),
value,
&b,
)
.is_err();
assert!(is_err);
}
{
let mut cs = TestConstraintSystem::<Scalar>::new();
let value = Some(true);
let b = AllocatedBit::alloc(&mut cs, Some(false)).unwrap();
let allocated_value = AllocatedBit::alloc_conditionally(
cs.namespace(|| "alloc_conditionally"),
value,
&b,
)
.unwrap();
assert_eq!(allocated_value.get_value().unwrap(), true);
assert!(cs.is_satisfied());
}
{
let mut cs = TestConstraintSystem::<Scalar>::new();
let value = Some(true);
let b = AllocatedBit::alloc(&mut cs, Some(true)).unwrap();
AllocatedBit::alloc_conditionally(cs.namespace(|| "alloc_conditionally"), value, &b)
.unwrap();
assert!(!cs.is_satisfied());
}
{
let value = Some(false);
//check with false bit
let mut cs = TestConstraintSystem::<Scalar>::new();
let b1 = AllocatedBit::alloc(&mut cs, Some(false)).unwrap();
AllocatedBit::alloc_conditionally(cs.namespace(|| "alloc_conditionally"), value, &b1)
.unwrap();
assert!(cs.is_satisfied());
//check with true bit
let mut cs = TestConstraintSystem::<Scalar>::new();
let b2 = AllocatedBit::alloc(&mut cs, Some(true)).unwrap();
AllocatedBit::alloc_conditionally(cs.namespace(|| "alloc_conditionally"), value, &b2)
.unwrap();
assert!(cs.is_satisfied());
}
} | rust_cleaned_test_functions.jsonl/13774 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14802,
27656,
745,
368,
341,
286,
341,
310,
1077,
5206,
10532,
284,
3393,
17890,
2320,
27638,
20639,
6831,
931,
543,
310,
1077,
293,
284,
1674,
39463,
8344,
486,
4742,
2099,
6984,
10532,
11,
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... | 6 |
#[test]
fn test_update_256_siblings_in_proof() {
// root
// o placeholder
// o placeholder
// . placeholder
// o
// key1 key2
let key1 = HashValue::new([0; HashValue::LENGTH]);
let key2 = {
let mut buf = key1.to_vec();
*buf.last_mut().unwrap() |= 1;
HashValue::from_slice(&buf).unwrap()
};
let value1 = StateValue::from(String::from("test_val1").into_bytes());
let value2 = StateValue::from(String::from("test_val2").into_bytes());
let value1_hash = value1.hash();
let value2_hash = value2.hash();
let leaf1_hash = hash_leaf(key1, value1_hash);
let leaf2_hash = hash_leaf(key2, value2_hash);
let mut siblings: Vec<_> = std::iter::repeat(*SPARSE_MERKLE_PLACEHOLDER_HASH)
.take(255)
.collect();
siblings.push(leaf2_hash);
siblings.reverse();
let proof_of_key1 = SparseMerkleProof::new(
Some(SparseMerkleLeafNode::new(key1, value1_hash)),
siblings.clone(),
);
let old_root_hash = siblings.iter().fold(leaf1_hash, |previous_hash, hash| {
hash_internal(previous_hash, *hash)
});
assert!(proof_of_key1
.verify(old_root_hash, key1, Some(&value1))
.is_ok());
let new_value1 = StateValue::from(String::from("test_val1111").into_bytes());
let proof_reader = ProofReader::new(vec![(key1, proof_of_key1)]);
let smt = SparseMerkleTree::new(old_root_hash);
let new_smt = smt
.batch_update(vec![(key1, &new_value1)], &proof_reader)
.unwrap();
let new_value1_hash = new_value1.hash();
let new_leaf1_hash = hash_leaf(key1, new_value1_hash);
let new_root_hash = siblings.iter().fold(new_leaf1_hash, |previous_hash, hash| {
hash_internal(previous_hash, *hash)
});
assert_eq!(new_smt.root_hash(), new_root_hash);
assert_eq!(
new_smt.get(key1),
StateStoreStatus::ExistsInScratchPad(new_value1)
);
assert_eq!(new_smt.get(key2), StateStoreStatus::Unknown);
} | rust_cleaned_test_functions.jsonl/63257 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1011
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
62,
17,
20,
21,
643,
24229,
1243,
86757,
368,
341,
262,
442,
4293,
3704,
7213,
262,
442,
338,
297,
414,
5878,
7213,
262,
442,
2290,
297,
256,
5878,
7213,
262,
442,
1797,
659,
256,
5878,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multiple_params() {
let url = Gravatar::new("email@example.com")
.set_size(Some(200))
.set_default(Some(Default::Identicon))
.set_force_default(true)
.set_rating(Some(Rating::R))
.image_url();
assert_eq!(
url.as_str(),
"https://secure.gravatar.com/avatar/5658ffccee7f0ebfda2b226238b1eb6e?s=200&d=identicon&f=y&r=r"
);
} | rust_cleaned_test_functions.jsonl/61383 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 214
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45233,
6745,
368,
341,
262,
1077,
2515,
284,
2825,
11962,
486,
931,
445,
2332,
35487,
905,
1138,
286,
659,
746,
2368,
65405,
7,
17,
15,
15,
1171,
286,
659,
746,
9993,
65405,
87874,
486,
28301,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_render_to_string() {
use std::io::Write;
let string = render_to_string(|| panic!(), |w| write!(w, "test")).unwrap();
assert_eq!(string, "test".to_owned());
} | rust_cleaned_test_functions.jsonl/98069 | {
"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,
22781,
2346,
3904,
368,
341,
286,
990,
1460,
486,
815,
486,
7985,
280,
286,
1077,
914,
284,
3141,
2346,
3904,
79453,
21975,
0,
1507,
760,
86,
91,
3270,
10297,
86,
11,
330,
1944,
15197,
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
] | 2 |
#[test]
fn test_diff_index() {
let message_id = MessageId::from_str("c38d6c541f98f780ddca6ad648ff0e073cd86c4dee248149c2de789d84d42132").unwrap();
let diff_index = IotaDocument::diff_index(&message_id).expect("failed to generate diff_index");
assert_eq!(diff_index, "2g45GsCAmkvQfcrHGUgqwQJLbYY3Gic8f23wf71sGGGP");
} | rust_cleaned_test_functions.jsonl/84340 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 159
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15850,
3560,
368,
341,
262,
1077,
1943,
842,
284,
4856,
764,
486,
1499,
2895,
445,
66,
18,
23,
67,
21,
66,
20,
19,
16,
69,
24,
23,
69,
22,
23,
15,
631,
924,
21,
329,
21,
19,
23,
542,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_line_one_plural_bag() {
assert_eq!(
parse_line("bright white bags contain 2 shiny gold bags."),
(
"bright white".to_string(),
vec![(2, "shiny gold".to_string())]
)
)
} | rust_cleaned_test_functions.jsonl/42314 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
6528,
11667,
57427,
74368,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
6528,
445,
72116,
4158,
17899,
6644,
220,
17,
41199,
6623,
17899,
62497,
310,
2399,
394,
330,
72116,
4158,
3263,
983,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_for() {
let s = ForTemplate {
strings: vec!["A", "alfa", "1"],
tuple_strings: vec![("B", "beta")],
};
assert_eq!(
s.render().unwrap(),
"0. A (first)\n1. alfa\n2. 1\n\n0. B,beta (first)\n"
);
} | rust_cleaned_test_functions.jsonl/24289 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 146
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5478,
368,
341,
262,
1077,
274,
284,
1752,
7275,
341,
286,
9069,
25,
7486,
0,
1183,
32,
497,
330,
84426,
497,
330,
16,
8097,
286,
14405,
33500,
25,
7486,
20703,
445,
33,
497,
330,
19127,
899,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_zip321_spec_invalid_examples() {
// invalid; missing `address=`
let invalid_1 = "zcash:?amount=3491405.05201255&address.1=ztestsapling10yy2ex5dcqkclhc7z7yrnjq2z6feyjad56ptwlfgmy77dmaqqrl9gyhprdx59qgmsnyfska2kez&amount.1=5740296.87793245";
let i1r = TransactionRequest::from_uri(&TEST_NETWORK, &invalid_1);
assert!(i1r.is_err());
// invalid; missing `address.1=`
let invalid_2 = "zcash:?address=smJWoGdqixeFEbhhLrU1TrXGA6wYAUoeG1J&amount=1&amount.1=2&address.2=ztestsapling10yy2ex5dcqkclhc7z7yrnjq2z6feyjad56ptwlfgmy77dmaqqrl9gyhprdx59qgmsnyfska2kez";
let i2r = TransactionRequest::from_uri(&TEST_NETWORK, &invalid_2);
assert!(i2r.is_err());
let invalid_3 = "zcash:?address.0=ztestsapling10yy2ex5dcqkclhc7z7yrnjq2z6feyjad56ptwlfgmy77dmaqqrl9gyhprdx59qgmsnyfska2kez&amount.0=2";
let i3r = TransactionRequest::from_uri(&TEST_NETWORK, &invalid_3);
assert!(i3r.is_err());
// invalid; duplicate `amount=` field
let invalid_4 =
"zcash:?amount=1.234&amount=2.345&address=smJWoGdqixeFEbhhLrU1TrXGA6wYAUoeG1J";
let i4r = TransactionRequest::from_uri(&TEST_NETWORK, &invalid_4);
assert!(i4r.is_err());
// invalid; duplicate `amount.1=` field
let invalid_5 =
"zcash:?amount.1=1.234&amount.1=2.345&address.1=smJWoGdqixeFEbhhLrU1TrXGA6wYAUoeG1J";
let i5r = TransactionRequest::from_uri(&TEST_NETWORK, &invalid_5);
assert!(i5r.is_err());
//invalid; memo associated with t-addr
let invalid_6 = "zcash:?address=smJWoGdqixeFEbhhLrU1TrXGA6wYAUoeG1J&amount=123.456&memo=eyAia2V5IjogIlRoaXMgaXMgYSBKU09OLXN0cnVjdHVyZWQgbWVtby4iIH0&address.1=ztestsapling10yy2ex5dcqkclhc7z7yrnjq2z6feyjad56ptwlfgmy77dmaqqrl9gyhprdx59qgmsnyfska2kez&amount.1=0.789&memo.1=VGhpcyBpcyBhIHVuaWNvZGUgbWVtbyDinKjwn6aE8J-PhvCfjok";
let i6r = TransactionRequest::from_uri(&TEST_NETWORK, &invalid_6);
assert!(i6r.is_err());
// invalid; amount component exceeds an i64
// 9223372036854775808 = i64::MAX + 1
let invalid_7 = "zcash:ztestsapling10yy2ex5dcqkclhc7z7yrnjq2z6feyjad56ptwlfgmy77dmaqqrl9gyhprdx59qgmsnyfska2kez?amount=9223372036854775808";
let i7r = TransactionRequest::from_uri(&TEST_NETWORK, &invalid_7);
assert!(i7r.is_err());
// invalid; amount component wraps into a valid small positive i64
let invalid_7a = "zcash:ztestsapling10yy2ex5dcqkclhc7z7yrnjq2z6feyjad56ptwlfgmy77dmaqqrl9gyhprdx59qgmsnyfska2kez?amount=18446744073709551624";
let i7ar = TransactionRequest::from_uri(&TEST_NETWORK, &invalid_7a);
assert!(i7ar.is_err());
// invalid; amount component is MAX_MONEY
let invalid_8 = "zcash:ztestsapling10yy2ex5dcqkclhc7z7yrnjq2z6feyjad56ptwlfgmy77dmaqqrl9gyhprdx59qgmsnyfska2kez?amount=21000000.00000001";
let i8r = TransactionRequest::from_uri(&TEST_NETWORK, &invalid_8);
assert!(i8r.is_err());
// invalid; negative amount
let invalid_9 = "zcash:ztestsapling10yy2ex5dcqkclhc7z7yrnjq2z6feyjad56ptwlfgmy77dmaqqrl9gyhprdx59qgmsnyfska2kez?amount=-1";
let i9r = TransactionRequest::from_uri(&TEST_NETWORK, &invalid_9);
assert!(i9r.is_err());
// invalid; parameter index too large
let invalid_10 =
"zcash:?amount.10000=1.23&address.10000=smJWoGdqixeFEbhhLrU1TrXGA6wYAUoeG1J";
let i10r = TransactionRequest::from_uri(&TEST_NETWORK, &invalid_10);
assert!(i10r.is_err());
} | rust_cleaned_test_functions.jsonl/81786 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1865
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42131,
18,
17,
16,
13594,
31433,
45279,
368,
341,
286,
442,
8318,
26,
7402,
1565,
4995,
28,
3989,
286,
1077,
8318,
62,
16,
284,
330,
34968,
988,
76475,
6045,
28,
18,
19,
24,
16,
19,
15,
20,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_two_pairs_last_card_cascade() {
test(&["JD QH JS 8D QC", "JS QS JC 2D QD"], &["JD QH JS 8D QC"])
} | rust_cleaned_test_functions.jsonl/49903 | {
"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,
23241,
36430,
12195,
16888,
666,
19977,
368,
341,
9401,
262,
1273,
2099,
1183,
49915,
1207,
39,
12162,
220,
23,
35,
42607,
497,
330,
12545,
77746,
60583,
220,
17,
35,
1207,
35,
7914,
609,
1183,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_codegen_options_tracking_hash() {
let reference = Options::default();
let mut opts = Options::default();
macro_rules! untracked {
($name: ident, $non_default_value: expr) => {
opts.cg.$name = $non_default_value;
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
};
}
// Make sure that changing an [UNTRACKED] option leaves the hash unchanged.
// This list is in alphabetical order.
untracked!(ar, String::from("abc"));
untracked!(codegen_units, Some(42));
untracked!(default_linker_libraries, true);
untracked!(extra_filename, String::from("extra-filename"));
untracked!(incremental, Some(String::from("abc")));
// `link_arg` is omitted because it just forwards to `link_args`.
untracked!(link_args, vec![String::from("abc"), String::from("def")]);
untracked!(link_dead_code, true);
untracked!(linker, Some(PathBuf::from("linker")));
untracked!(linker_flavor, Some(LinkerFlavor::Gcc));
untracked!(no_stack_check, true);
untracked!(remark, Passes::Some(vec![String::from("pass1"), String::from("pass2")]));
untracked!(rpath, true);
untracked!(save_temps, true);
macro_rules! tracked {
($name: ident, $non_default_value: expr) => {
opts = reference.clone();
opts.cg.$name = $non_default_value;
assert_ne!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
};
}
// Make sure that changing a [TRACKED] option changes the hash.
// This list is in alphabetical order.
tracked!(code_model, Some(CodeModel::Large));
tracked!(debug_assertions, Some(true));
tracked!(debuginfo, 0xdeadbeef);
tracked!(embed_bitcode, false);
tracked!(force_frame_pointers, Some(false));
tracked!(force_unwind_tables, Some(true));
tracked!(inline_threshold, Some(0xf007ba11));
tracked!(linker_plugin_lto, LinkerPluginLto::LinkerPluginAuto);
tracked!(llvm_args, vec![String::from("1"), String::from("2")]);
tracked!(lto, LtoCli::Fat);
tracked!(metadata, vec![String::from("A"), String::from("B")]);
tracked!(no_prepopulate_passes, true);
tracked!(no_redzone, Some(true));
tracked!(no_vectorize_loops, true);
tracked!(no_vectorize_slp, true);
tracked!(opt_level, "3".to_string());
tracked!(overflow_checks, Some(true));
tracked!(panic, Some(PanicStrategy::Abort));
tracked!(passes, vec![String::from("1"), String::from("2")]);
tracked!(prefer_dynamic, true);
tracked!(profile_generate, SwitchWithOptPath::Enabled(None));
tracked!(profile_use, Some(PathBuf::from("abc")));
tracked!(relocation_model, Some(RelocModel::Pic));
tracked!(soft_float, true);
tracked!(target_cpu, Some(String::from("abc")));
tracked!(target_feature, String::from("all the features, all of them"));
} | rust_cleaned_test_functions.jsonl/16055 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32018,
8743,
66105,
8950,
368,
341,
262,
1077,
5785,
284,
14566,
486,
2258,
543,
262,
1077,
5206,
12185,
284,
14566,
486,
2258,
1428,
262,
18072,
21407,
0,
650,
58381,
341,
286,
1711,
606,
25,
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_from_string() {
let map_str = "
##########
# #
##########
";
let map = Map::from_string(map_str);
assert_eq!(map.width, 10);
assert_eq!(map.height, 3);
for i in 0..10 {
assert!(map.at(i, 0).is_blocked);
assert!(map.at(i, 2).is_blocked);
if i == 0 || i == 9 {
assert!(map.at(i, 1).is_blocked);
} else {
assert!(map.at(i, 1).is_blocked == false);
}
}
} | rust_cleaned_test_functions.jsonl/60090 | {
"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,
5673,
3904,
368,
341,
286,
1077,
2415,
2895,
284,
6228,
286,
26352,
22614,
286,
671,
286,
9541,
286,
26352,
22614,
286,
7620,
286,
1077,
2415,
284,
5027,
486,
1499,
3904,
9147,
2895,
626,
286,
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... | 4 |
#[test]
fn test_read_chunk_size() {
use std::io::ErrorKind::{UnexpectedEof, InvalidInput};
fn read(s: &str) -> u64 {
let mut state = ChunkedState::Size;
let rdr = &mut s.as_bytes();
let mut size = 0;
loop {
let result = state.step(rdr, &mut size, &mut None);
let desc = format!("read_size failed for {:?}", s);
state = result.expect(desc.as_str()).unwrap();
if state == ChunkedState::Body || state == ChunkedState::EndCr {
break;
}
}
size
}
fn read_err(s: &str, expected_err: io::ErrorKind) {
let mut state = ChunkedState::Size;
let rdr = &mut s.as_bytes();
let mut size = 0;
loop {
let result = state.step(rdr, &mut size, &mut None);
state = match result {
Ok(s) => s.unwrap(),
Err(e) => {
assert!(expected_err == e.kind(), "Reading {:?}, expected {:?}, but got {:?}",
s, expected_err, e.kind());
return;
}
};
if state == ChunkedState::Body || state == ChunkedState::End {
panic!(format!("Was Ok. Expected Err for {:?}", s));
}
}
}
assert_eq!(1, read("1\r\n"));
assert_eq!(1, read("01\r\n"));
assert_eq!(0, read("0\r\n"));
assert_eq!(0, read("00\r\n"));
assert_eq!(10, read("A\r\n"));
assert_eq!(10, read("a\r\n"));
assert_eq!(255, read("Ff\r\n"));
assert_eq!(255, read("Ff \r\n"));
// Missing LF or CRLF
read_err("F\rF", InvalidInput);
read_err("F", UnexpectedEof);
// Invalid hex digit
read_err("X\r\n", InvalidInput);
read_err("1X\r\n", InvalidInput);
read_err("-\r\n", InvalidInput);
read_err("-1\r\n", InvalidInput);
assert_eq!(1, read("1;extension\r\n"));
assert_eq!(10, read("a;ext name=value\r\n"));
assert_eq!(1, read("1;extension;extension2\r\n"));
assert_eq!(1, read("1;;; ;\r\n"));
assert_eq!(2, read("2; extension...\r\n"));
assert_eq!(3, read("3 ; extension=123\r\n"));
assert_eq!(3, read("3 ;\r\n"));
assert_eq!(3, read("3 ; \r\n"));
// Invalid extensions cause an error
read_err("1 invalid extension\r\n", InvalidInput);
read_err("1 A\r\n", InvalidInput);
read_err("1;no CRLF", UnexpectedEof);
} | rust_cleaned_test_functions.jsonl/13922 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1542
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
30539,
2368,
368,
341,
286,
990,
1460,
486,
815,
486,
1454,
10629,
22964,
29430,
36,
1055,
11,
13882,
2505,
2315,
286,
5168,
1349,
1141,
25,
609,
495,
8,
1464,
575,
21,
19,
341,
310,
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... | 3 |
#[test]
fn test_extract()
{
let tmpdir = assert_memfs_setup!();
let file1 = tmpdir.mash("file1");
assert!(vfs::write_all(&file1, "Not my favorite movie: 'Citizen Kane' (1941).").is_ok());
assert_eq!(file::extract(&file1, r"'([^']+)'\s+\((\d{4})\)").unwrap(), "Citizen Kane");
assert_remove_all!(&tmpdir);
} | rust_cleaned_test_functions.jsonl/110965 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 176
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
741,
262,
341,
286,
1077,
4174,
3741,
284,
2060,
12976,
3848,
21363,
0,
543,
286,
1077,
1034,
16,
284,
4174,
3741,
744,
988,
445,
1192,
16,
797,
286,
2060,
10297,
82586,
486,
4934,
5705,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_tlv_oob()
{
let mut parser;
// TLV header too short
parser = Parser::new_zero(&[0, 0]);
assert_eq!(parser.next(), Some(Err(Error::Invalid)));
assert_eq!(parser.next(), None);
// TLV length field larger than the data
parser = Parser::new_zero(&[12, 0, 0, 0]);
assert_eq!(parser.next(), Some(Err(Error::Invalid)));
assert_eq!(parser.next(), None);
// TLV key not nul terminated
parser = Parser::new_zero(&[16, 0, 1, 20, 20, 20, 20, 20]);
assert_eq!(parser.next(), Some(Err(Error::Invalid)));
assert_eq!(parser.next(), None);
// TLV value field larger than the data
parser = Parser::new_zero(&[8, 10, 0, 0, 0, 0]);
assert_eq!(parser.next(), Some(Err(Error::Invalid)));
assert_eq!(parser.next(), None);
} | rust_cleaned_test_functions.jsonl/88391 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 296
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
528,
21827,
14179,
674,
741,
515,
10217,
5206,
6729,
401,
197,
322,
29615,
53,
4247,
2238,
2805,
198,
55804,
284,
21102,
486,
931,
19359,
2099,
58,
15,
11,
220,
15,
2558,
6948,
10714,
102... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_mla() {
assert_eq!(
decode_32(0xfb071102),
Instruction::MLA {
params: Reg4NoSetFlagsParams {
rd: Reg::R1,
rn: Reg::R7,
rm: Reg::R2,
ra: Reg::R1,
}
}
);
} | rust_cleaned_test_functions.jsonl/64807 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 212
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
717,
4260,
368,
341,
1066,
262,
2060,
10714,
33673,
286,
16895,
62,
18,
17,
7,
15,
46071,
15,
22,
16,
16,
15,
17,
1326,
286,
29051,
486,
2668,
32,
341,
310,
3628,
25,
3184,
19,
2753,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_check_signature() {
let (pk, msg) = gen_pk_and_msg();
let signature = TxSignature::sign_musig(&pk, &msg[1])
.signature
.serialize_packed()
.unwrap();
assert_eq!(hex::encode(signature), "4e3298ac8cc13868dbbc94ad6fb41085ffe05b3c2eee22f88b05e69b7a5126aea723d7a3e7282ef5a32d9479c9c8dde52b3e3c462dd445dcd8158ebb6edb6000");
} | rust_cleaned_test_functions.jsonl/118963 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 203
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
39859,
368,
341,
262,
1077,
320,
20819,
11,
3750,
8,
284,
4081,
33321,
8378,
6483,
543,
262,
1077,
11957,
284,
39850,
25088,
486,
7752,
717,
355,
343,
2099,
20819,
11,
609,
3236,
58,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_array_unsigned_short() {
check([] as [u16; 0], Some(0));
check([0u16, 1, 2], Some(6));
} | rust_cleaned_test_functions.jsonl/79670 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 59
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
67830,
16673,
368,
341,
262,
1779,
10556,
438,
508,
84,
16,
21,
26,
220,
15,
1125,
4329,
7,
15,
1106,
262,
1779,
2561,
15,
84,
16,
21,
11,
220,
16,
11,
220,
17,
1125,
4329,
7,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_buffered_reader() {
let inner = MemReader::new(vec!(0, 1, 2, 3, 4));
let mut reader = BufferedReader::with_capacity(2, inner);
let mut buf = [0, 0, 0];
let nread = reader.read(buf);
assert_eq!(Ok(2), nread);
let b: &[_] = &[0, 1, 0];
assert_eq!(buf.as_slice(), b);
let mut buf = [0];
let nread = reader.read(buf);
assert_eq!(Ok(1), nread);
let b: &[_] = &[2];
assert_eq!(buf.as_slice(), b);
let mut buf = [0, 0, 0];
let nread = reader.read(buf);
assert_eq!(Ok(1), nread);
let b: &[_] = &[3, 0, 0];
assert_eq!(buf.as_slice(), b);
let nread = reader.read(buf);
assert_eq!(Ok(1), nread);
let b: &[_] = &[4, 0, 0];
assert_eq!(buf.as_slice(), b);
assert!(reader.read(buf).is_err());
} | rust_cleaned_test_functions.jsonl/83703 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 476
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7776,
291,
22306,
368,
341,
286,
1077,
9179,
284,
13550,
5062,
486,
931,
25592,
10297,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
1106,
286,
1077,
5206,
6604,
284,
25568,
486,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_basic() {
let mut column = VectorValue::with_capacity(0, EvalType::Bytes);
assert_eq!(column.eval_type(), EvalType::Bytes);
assert_eq!(column.len(), 0);
assert_eq!(column.capacity(), 0);
assert!(column.is_empty());
assert_eq!(column.to_bytes_vec(), &[]);
column.push_bytes(None);
assert_eq!(column.len(), 1);
assert!(column.capacity() > 0);
assert!(!column.is_empty());
assert_eq!(column.to_bytes_vec(), &[None]);
column.push_bytes(Some(vec![1, 2, 3]));
assert_eq!(column.len(), 2);
assert!(column.capacity() > 0);
assert!(!column.is_empty());
assert_eq!(column.to_bytes_vec(), &[None, Some(vec![1, 2, 3])]);
let mut column = VectorValue::with_capacity(3, EvalType::Real);
assert_eq!(column.eval_type(), EvalType::Real);
assert_eq!(column.len(), 0);
assert_eq!(column.capacity(), 3);
assert!(column.is_empty());
assert_eq!(column.to_real_vec(), &[]);
let column_cloned = column.clone();
assert_eq!(column_cloned.capacity(), 0);
assert_eq!(column_cloned.to_real_vec(), column.to_real_vec());
column.push_real(Real::new(1.0).ok());
assert_eq!(column.len(), 1);
assert_eq!(column.capacity(), 3);
assert!(!column.is_empty());
assert_eq!(column.to_real_vec(), &[Real::new(1.0).ok()]);
let column_cloned = column.clone();
assert_eq!(column_cloned.capacity(), 1);
assert_eq!(column_cloned.to_real_vec(), column.to_real_vec());
column.push_real(None);
assert_eq!(column.len(), 2);
assert_eq!(column.capacity(), 3);
assert!(!column.is_empty());
assert_eq!(column.to_real_vec(), &[Real::new(1.0).ok(), None]);
let column_cloned = column.clone();
assert_eq!(column_cloned.capacity(), 2);
assert_eq!(column_cloned.to_real_vec(), column.to_real_vec());
column.push_real(Real::new(4.5).ok());
assert_eq!(column.len(), 3);
assert_eq!(column.capacity(), 3);
assert!(!column.is_empty());
assert_eq!(
column.to_real_vec(),
&[Real::new(1.0).ok(), None, Real::new(4.5).ok()]
);
let column_cloned = column.clone();
assert_eq!(column_cloned.capacity(), 3);
assert_eq!(column_cloned.to_real_vec(), column.to_real_vec());
column.push_real(None);
assert_eq!(column.len(), 4);
assert!(column.capacity() > 3);
assert!(!column.is_empty());
assert_eq!(
column.to_real_vec(),
&[Real::new(1.0).ok(), None, Real::new(4.5).ok(), None]
);
assert_eq!(column.to_real_vec(), column.to_real_vec());
column.truncate(2);
assert_eq!(column.len(), 2);
assert!(column.capacity() > 3);
assert!(!column.is_empty());
assert_eq!(column.to_real_vec(), &[Real::new(1.0).ok(), None]);
assert_eq!(column.to_real_vec(), column.to_real_vec());
let column = VectorValue::with_capacity(10, EvalType::DateTime);
assert_eq!(column.eval_type(), EvalType::DateTime);
assert_eq!(column.len(), 0);
assert_eq!(column.capacity(), 10);
assert!(column.is_empty());
assert_eq!(column.to_date_time_vec(), &[]);
assert_eq!(column.to_date_time_vec(), column.to_date_time_vec());
let column = VectorValue::with_capacity(10, EvalType::Enum);
assert_eq!(column.eval_type(), EvalType::Enum);
assert_eq!(column.len(), 0);
assert_eq!(column.capacity(), 10);
assert!(column.is_empty());
assert_eq!(column.to_enum_vec(), &[]);
assert_eq!(column.to_enum_vec(), column.to_enum_vec());
let column = VectorValue::with_capacity(10, EvalType::Set);
assert_eq!(column.eval_type(), EvalType::Set);
assert_eq!(column.len(), 0);
assert_eq!(column.capacity(), 10);
assert!(column.is_empty());
assert_eq!(column.to_set_vec(), &[]);
assert_eq!(column.to_set_vec(), column.to_set_vec());
} | rust_cleaned_test_functions.jsonl/79385 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1958
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
368,
341,
286,
1077,
5206,
3250,
284,
4196,
1130,
486,
4197,
35603,
7,
15,
11,
58239,
929,
486,
7078,
317,
286,
2060,
10714,
10297,
6229,
31710,
1819,
1507,
58239,
929,
486,
7078,
317,
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_established_timeout() {
let mut s = socket_established();
s.set_timeout(Some(Duration::from_millis(200)));
recv!(s, time 250, Err(Error::Exhausted));
assert_eq!(s.poll_at(), Some(Instant::from_millis(450)));
s.send_slice(b"abcdef").unwrap();
assert_eq!(s.poll_at(), Some(Instant::from_millis(0)));
recv!(s, time 255, Ok(TcpRepr {
seq_number: LOCAL_SEQ + 1,
ack_number: Some(REMOTE_SEQ + 1),
payload: &b"abcdef"[..],
..RECV_TEMPL
}));
assert_eq!(s.poll_at(), Some(Instant::from_millis(355)));
recv!(s, time 355, Ok(TcpRepr {
seq_number: LOCAL_SEQ + 1,
ack_number: Some(REMOTE_SEQ + 1),
payload: &b"abcdef"[..],
..RECV_TEMPL
}));
assert_eq!(s.poll_at(), Some(Instant::from_millis(455)));
recv!(s, time 500, Ok(TcpRepr {
control: TcpControl::Rst,
seq_number: LOCAL_SEQ + 1 + 6,
ack_number: Some(REMOTE_SEQ + 1),
..RECV_TEMPL
}));
assert_eq!(s.state, State::Closed);
} | rust_cleaned_test_functions.jsonl/1779 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 647
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18583,
5102,
291,
20537,
368,
341,
286,
1077,
5206,
274,
284,
7575,
18583,
5102,
291,
543,
286,
274,
980,
20537,
65405,
64114,
486,
1499,
717,
56212,
7,
17,
15,
15,
4945,
286,
27006,
10297,
82,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_join() {
let git_url = GitUrl::parse("git@github.com:user/foo/bar/quux.git").expect("parse failed");
assert_eq!(
git_url.join("aaa").expect("join failed").to_string(),
"git@github.com:user/foo/bar/quux.git/aaa"
);
assert_eq!(
git_url.join("aaa/bbb").expect("join failed").to_string(),
"git@github.com:user/foo/bar/quux.git/aaa/bbb"
);
assert_eq!(
git_url.join(".").expect("join failed").to_string(),
"git@github.com:user/foo/bar/quux.git"
);
assert_eq!(
git_url.join("..").expect("join failed").to_string(),
"git@github.com:user/foo/bar"
);
assert_eq!(
git_url.join("../aaa").expect("join failed").to_string(),
"git@github.com:user/foo/bar/aaa"
);
assert_eq!(
git_url.join("../aaa/bbb").expect("join failed").to_string(),
"git@github.com:user/foo/bar/aaa/bbb"
);
assert_eq!(
git_url
.join("../../../aaa/bbb")
.expect("join failed")
.to_string(),
"git@github.com:user/aaa/bbb"
);
assert_eq!(
git_url
.join("../../../../aaa/bbb")
.expect("join failed")
.to_string(),
"git@github.com:aaa/bbb"
);
assert!(git_url.join("/aaa").is_none());
} | rust_cleaned_test_functions.jsonl/12184 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 853
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31017,
368,
341,
286,
1077,
16345,
2903,
284,
21120,
2864,
486,
6400,
445,
12882,
31,
5204,
905,
64280,
60555,
49513,
78845,
2200,
32799,
1827,
17119,
445,
6400,
4641,
3071,
286,
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_output_stream_io_write() {
let expected = [0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77];
// write to Write
{
let mut v = Vec::new();
{
let mut os = CodedOutputStream::new(&mut v as &mut Write);
Write::write(&mut os, &expected).expect("io::Write::write");
Write::flush(&mut os).expect("io::Write::flush");
}
assert_eq!(expected, *v);
}
{
let mut v = Vec::with_capacity(expected.len());
v.resize(expected.len(), 0);
{
let mut os = CodedOutputStream::bytes(&mut v);
Write::write(&mut os, &expected).expect("io::Write::write");
Write::flush(&mut os).expect("io::Write::flush");
os.check_eof();
}
assert_eq!(expected, *v);
}
// write to Vec<u8>
{
let mut v = Vec::new();
{
let mut os = CodedOutputStream::vec(&mut v);
Write::write(&mut os, &expected).expect("io::Write::write");
Write::flush(&mut os).expect("io::Write::flush");
}
assert_eq!(expected, *v);
}
} | rust_cleaned_test_functions.jsonl/104522 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 710
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7645,
12673,
16939,
9165,
368,
341,
286,
1077,
3601,
284,
508,
15,
87,
16,
16,
11,
220,
15,
87,
17,
17,
11,
220,
15,
87,
18,
18,
11,
220,
15,
87,
19,
19,
11,
220,
15,
87,
20,
20,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_as() {
use glam::{DVec3, IVec3, UVec3, Vec3A};
assert_eq!(
DVec3::new(-1.0, -2.0, -3.0),
Vec3::new(-1.0, -2.0, -3.0).as_f64()
);
assert_eq!(IVec3::new(-1, -2, -3), Vec3::new(-1.0, -2.0, -3.0).as_i32());
assert_eq!(UVec3::new(1, 2, 3), Vec3::new(1.0, 2.0, 3.0).as_u32());
assert_eq!(
DVec3::new(-1.0, -2.0, -3.0),
Vec3A::new(-1.0, -2.0, -3.0).as_f64()
);
assert_eq!(
IVec3::new(-1, -2, -3),
Vec3A::new(-1.0, -2.0, -3.0).as_i32()
);
assert_eq!(UVec3::new(1, 2, 3), Vec3A::new(1.0, 2.0, 3.0).as_u32());
assert_eq!(
IVec3::new(-1, -2, -3),
DVec3::new(-1.0, -2.0, -3.0).as_i32()
);
assert_eq!(UVec3::new(1, 2, 3), DVec3::new(1.0, 2.0, 3.0).as_u32());
assert_eq!(
Vec3::new(-1.0, -2.0, -3.0),
DVec3::new(-1.0, -2.0, -3.0).as_f32()
);
assert_eq!(
DVec3::new(-1.0, -2.0, -3.0),
IVec3::new(-1, -2, -3).as_f64()
);
assert_eq!(UVec3::new(1, 2, 3), IVec3::new(1, 2, 3).as_u32());
assert_eq!(Vec3::new(-1.0, -2.0, -3.0), IVec3::new(-1, -2, -3).as_f32());
assert_eq!(DVec3::new(1.0, 2.0, 3.0), UVec3::new(1, 2, 3).as_f64());
assert_eq!(IVec3::new(1, 2, 3), UVec3::new(1, 2, 3).as_i32());
assert_eq!(Vec3::new(1.0, 2.0, 3.0), UVec3::new(1, 2, 3).as_f32());
} | rust_cleaned_test_functions.jsonl/23404 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1004
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
368,
341,
286,
990,
41012,
22964,
35,
10050,
18,
11,
358,
10050,
18,
11,
547,
10050,
18,
11,
11312,
18,
32,
2440,
286,
2060,
10714,
33673,
310,
422,
10050,
18,
486,
931,
4080,
16,
13,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_enum() {
let input = quote! { EnumRef };
let x = parse2::<RpnFnRefEvaluableType>(input).unwrap();
let type_path = x.get_type_path();
assert!(is_enum(&type_path));
let input = quote! { &Int };
let x = parse2::<RpnFnRefEvaluableType>(input).unwrap();
let type_path = x.get_type_path();
assert!(!is_enum(&type_path));
} | rust_cleaned_test_functions.jsonl/17093 | {
"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,
6892,
31054,
368,
341,
286,
1077,
1946,
284,
12641,
0,
314,
14086,
3945,
2605,
286,
1077,
856,
284,
4715,
17,
27638,
49,
19958,
24911,
3945,
54469,
13128,
929,
2235,
1355,
568,
15454,
543,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_partial_cmp_eq() {
let mut root1: Root<i32, ()> = Root::new_leaf();
let mut leaf1 = unsafe { root1.leaf_node_as_mut() };
leaf1.push(1, ());
root1.push_internal_level();
let root2: Root<i32, ()> = Root::new_leaf();
let leaf_edge_1a = root1.node_as_ref().first_leaf_edge().forget_node_type();
let leaf_edge_1b = root1.node_as_ref().last_leaf_edge().forget_node_type();
let top_edge_1 = root1.node_as_ref().first_edge();
let top_edge_2 = root2.node_as_ref().first_edge();
assert!(leaf_edge_1a == leaf_edge_1a);
assert!(leaf_edge_1a != leaf_edge_1b);
assert!(leaf_edge_1a != top_edge_1);
assert!(leaf_edge_1a != top_edge_2);
assert!(top_edge_1 == top_edge_1);
assert!(top_edge_1 != top_edge_2);
assert_eq!(leaf_edge_1a.partial_cmp(&leaf_edge_1a), Some(Equal));
assert_eq!(leaf_edge_1a.partial_cmp(&leaf_edge_1b), Some(Less));
assert_eq!(leaf_edge_1a.partial_cmp(&top_edge_1), None);
assert_eq!(leaf_edge_1a.partial_cmp(&top_edge_2), None);
assert_eq!(top_edge_1.partial_cmp(&top_edge_1), Some(Equal));
assert_eq!(top_edge_1.partial_cmp(&top_edge_2), None);
root1.pop_internal_level();
unsafe { root1.into_ref().deallocate_and_ascend() };
unsafe { root2.into_ref().deallocate_and_ascend() };
} | rust_cleaned_test_functions.jsonl/92235 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 587
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
52068,
35193,
10714,
368,
341,
262,
1077,
5206,
3704,
16,
25,
18854,
21897,
18,
17,
11,
1719,
29,
284,
18854,
486,
931,
38909,
543,
262,
1077,
5206,
15933,
16,
284,
19860,
314,
3704,
16,
13,
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_scout_no_workspace_one_diff_not_relevant_member() -> Result<(), crate::error::Error> {
let diff = vec![Section {
file_name: get_absolute_file_path("baz/bar.rs")?,
line_start: 0,
line_end: 10,
}];
let linter = TestLinter::new();
let vcs = TestVCS::new(diff);
// The member does not match the file name
let config = TestConfig::new(vec!["foo".to_string()]);
let expected_times_called = 0;
let actual_times_called = Rc::clone(&linter.lints_times_called);
let scout = Scout::new(vcs, config, linter);
// We don't check for the lints result here.
// It is already tested in the linter tests
// and in intersection tests
let _ = scout.run()?;
assert_eq!(expected_times_called, *actual_times_called.borrow());
Ok(())
} | rust_cleaned_test_functions.jsonl/28046 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 401
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
6104,
6536,
75560,
11667,
15850,
7913,
1288,
8367,
19388,
368,
1464,
5714,
68843,
17717,
486,
841,
486,
1454,
29,
341,
286,
1077,
3638,
284,
7486,
20703,
9620,
341,
310,
1034,
1269,
25,
633,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_get_valid_interface_fail() {
let iface_name = "wlan0".to_string();
let mut interfaces: Vec<NetworkInterface> = vec![];
for i in 0..5 {
let temp_intf = NetworkInterface {
name: format!("eth{}", i),
index: 0,
mac: None,
ips: vec![],
flags: 0,
};
interfaces.push(temp_intf);
}
let valid_intf = get_valid_interface(iface_name, interfaces);
assert_eq!(None, valid_intf);
} | rust_cleaned_test_functions.jsonl/41630 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 309
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
8337,
20546,
22121,
368,
341,
286,
1077,
49313,
1269,
284,
330,
86,
10715,
15,
3263,
983,
3904,
543,
286,
1077,
5206,
24099,
25,
11312,
27,
12320,
5051,
29,
284,
7486,
0,
40901,
286,
369,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_try_from_unchecked() {
Python::with_gil(|py| {
let list = PyList::new(py, &[1, 2, 3]);
let val = unsafe { <PyList as PyTryFrom>::try_from_unchecked(list.as_ref()) };
assert_eq!(list, val);
});
} | rust_cleaned_test_functions.jsonl/20447 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 145
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
5673,
4907,
7549,
368,
341,
286,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
341,
310,
1077,
1140,
284,
5355,
852,
486,
931,
46827,
11,
44590,
16,
11,
220,
17,
11,
220,
18,
2558,
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_strict_mode_with() {
// Checks as per https://tc39.es/ecma262/#sec-with-statement-static-semantics-early-errors
// that a with statement is an error in strict mode code.
let scenario = r#"
'use strict';
function f(x, o) {
with (o) {
console.log(x);
}
}
"#;
let mut context = Context::new();
let string = dbg!(forward(&mut context, scenario));
assert!(string.starts_with("Uncaught \"SyntaxError\": "));
} | rust_cleaned_test_functions.jsonl/39563 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 209
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2895,
849,
7302,
6615,
368,
341,
262,
442,
24843,
438,
817,
3703,
1110,
10413,
18,
24,
18550,
73058,
1728,
17,
21,
17,
26559,
5024,
26189,
5477,
5605,
49730,
69689,
36233,
12,
22140,
72604,
198,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vertex_format() {
use secret_lib::gfx::attrib::{Type, IntSubType, FloatSubType,
IntSize, FloatSize, SignFlag,
Format, Stride};
use secret_lib::gfx;
use secret_lib::device;
let buf_vert = device::make_fake_buffer();
let buf_inst = device::make_fake_buffer();
let mesh = gfx::Mesh::from_format_instanced::<MyVertex, MyInstance>(buf_vert, 0, buf_inst);
let stride_vert = 34 as Stride;
let stride_inst = 8 as Stride;
assert_eq!(mesh.attributes, vec![
gfx::Attribute {
name: "a0".to_string(),
buffer: buf_vert.raw(),
format: Format {
elem_count: 2,
elem_type: Type::Float(FloatSubType::Default, FloatSize::F32),
offset: 0,
stride: stride_vert,
instance_rate: 0,
},
},
gfx::Attribute {
name: "a1".to_string(),
buffer: buf_vert.raw(),
format: Format {
elem_count: 1,
elem_type: Type::Int(IntSubType::Normalized, IntSize::U16, SignFlag::Signed),
offset: 8,
stride: stride_vert,
instance_rate: 0,
},
},
gfx::Attribute {
name: "a2".to_string(),
buffer: buf_vert.raw(),
format: Format {
elem_count: 4,
elem_type: Type::Int(IntSubType::AsFloat, IntSize::U8, SignFlag::Signed),
offset: 10,
stride: stride_vert,
instance_rate: 0,
},
},
gfx::Attribute {
name: "a3".to_string(),
buffer: buf_vert.raw(),
format: Format {
elem_count: 1,
elem_type: Type::Float(FloatSubType::Precision, FloatSize::F64),
offset: 14,
stride: stride_vert,
instance_rate: 0,
},
},
gfx::Attribute {
name: "a_a4".to_string(),
buffer: buf_vert.raw(),
format: Format {
elem_count: 3,
elem_type: Type::Float(FloatSubType::Default, FloatSize::F32),
offset: 22,
stride: stride_vert,
instance_rate: 0,
},
},
gfx::Attribute {
name: "a0".to_string(),
buffer: buf_vert.raw(),
format: Format {
elem_count: 2,
elem_type: Type::Float(FloatSubType::Default, FloatSize::F32),
offset: 0,
stride: stride_inst,
instance_rate: 1,
},
},
]);
} | rust_cleaned_test_functions.jsonl/133811 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1595
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26611,
8955,
368,
341,
262,
990,
6234,
16142,
486,
55111,
486,
44113,
22964,
929,
11,
1333,
3136,
929,
11,
13001,
3136,
929,
345,
6656,
1333,
1695,
11,
13001,
1695,
11,
7075,
12135,
345,
6656,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ilrawtag_iltag_value_size() {
const SAMPLE: [u8; 5] = [0, 1, 2, 3, 4];
let mut t = ILRawTag::new(16);
assert_eq!(t.value_size(), 0);
t.mut_value().extend_from_slice(&SAMPLE);
assert_eq!(t.value_size(), SAMPLE.len() as u64);
assert_eq!(t.value().as_slice(), &SAMPLE);
} | rust_cleaned_test_functions.jsonl/25716 | {
"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,
26743,
1041,
4578,
62,
2963,
351,
3142,
2368,
368,
341,
262,
733,
62420,
25,
508,
84,
23,
26,
220,
20,
60,
284,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
935,
262,
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... | 1 |
#[test]
fn test_get_bit() {
assert!(get_bit(&[0b00001101], 0));
assert!(!get_bit(&[0b00001101], 1));
assert!(get_bit(&[0b00001101], 2));
assert!(get_bit(&[0b00001101], 3));
assert!(get_bit(&[0b01001001, 0b01010010], 0));
assert!(!get_bit(&[0b01001001, 0b01010010], 1));
assert!(!get_bit(&[0b01001001, 0b01010010], 2));
assert!(get_bit(&[0b01001001, 0b01010010], 3));
assert!(!get_bit(&[0b01001001, 0b01010010], 4));
assert!(!get_bit(&[0b01001001, 0b01010010], 5));
assert!(get_bit(&[0b01001001, 0b01010010], 6));
assert!(!get_bit(&[0b01001001, 0b01010010], 7));
assert!(!get_bit(&[0b01001001, 0b01010010], 8));
assert!(get_bit(&[0b01001001, 0b01010010], 9));
assert!(!get_bit(&[0b01001001, 0b01010010], 10));
assert!(!get_bit(&[0b01001001, 0b01010010], 11));
assert!(get_bit(&[0b01001001, 0b01010010], 12));
assert!(!get_bit(&[0b01001001, 0b01010010], 13));
assert!(get_bit(&[0b01001001, 0b01010010], 14));
assert!(!get_bit(&[0b01001001, 0b01010010], 15));
} | rust_cleaned_test_functions.jsonl/115735 | {
"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,
3062,
13996,
368,
341,
1789,
286,
2060,
10297,
455,
13996,
2099,
58,
15,
65,
15,
15,
15,
15,
16,
16,
15,
16,
1125,
220,
15,
1106,
286,
2060,
0,
3471,
455,
13996,
2099,
58,
15,
65,
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_decimal_eq() {
assert_eq!(Decimal::new(80, 2), Decimal::new(8, 3));
assert_eq!(Decimal::new(124, -2), Decimal::new(1240, -3));
assert_eq!(Decimal::new(0, 0), Decimal::new(0, 0));
assert_ne!(Decimal::new(0, -2), Decimal::new(0, 3));
assert_eq!(Decimal::negative_zero(), Decimal::negative_zero());
assert_ne!(
Decimal::negative_zero_with_exponent(2),
Decimal::negative_zero_with_exponent(7)
);
assert_ne!(Decimal::new(0, 2), Decimal::new(0, 5));
assert_ne!(
Decimal::new(0, 0),
Decimal::new(Coefficient::new(Sign::Negative, 0), 0)
);
} | rust_cleaned_test_functions.jsonl/41978 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 360
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74429,
10714,
368,
341,
286,
2060,
10714,
10297,
11269,
486,
931,
7,
23,
15,
11,
220,
17,
701,
26728,
486,
931,
7,
23,
11,
220,
18,
1106,
286,
2060,
10714,
10297,
11269,
486,
931,
7,
16,
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_pin_box() {
unsafe {
let pointer_ops = DefaultPointerOps::<Pin<Box<_>>>::new();
let p = Pin::new(Box::new(1));
let a: *const i32 = &*p;
let r = pointer_ops.into_raw(p);
assert_eq!(a, r);
let p2: Pin<Box<i32>> = pointer_ops.from_raw(r);
let a2: *const i32 = &*p2;
assert_eq!(a, a2);
}
} | rust_cleaned_test_functions.jsonl/82639 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26296,
10194,
368,
341,
286,
19860,
341,
310,
1077,
7445,
21959,
284,
7899,
9084,
38904,
27638,
19861,
79852,
32399,
2452,
6831,
931,
543,
310,
1077,
281,
284,
17471,
486,
931,
67758,
486,
931,
7,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vote_account() {
let mut rng = rand::thread_rng();
let (account, vote_state) = new_rand_vote_account(&mut rng, None);
let lamports = account.lamports;
let vote_account = VoteAccount::from(account);
assert_eq!(lamports, vote_account.lamports());
assert_eq!(vote_state, *vote_account.vote_state().as_ref().unwrap());
assert_eq!(vote_state, *vote_account.vote_state().as_ref().unwrap());
} | rust_cleaned_test_functions.jsonl/57879 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 210
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54360,
13500,
368,
341,
286,
1077,
5206,
28422,
284,
10382,
486,
4528,
66849,
543,
286,
1077,
320,
4608,
11,
6910,
4387,
8,
284,
501,
33864,
54360,
13500,
2099,
6984,
28422,
11,
2240,
317,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_errorkind_debug() {
assert_eq!(format!("{:?}", ErrorKind::CorruptedData), "CorruptedData");
assert_eq!(format!("{:?}", ErrorKind::UnknownTag), "UnknownTag");
} | rust_cleaned_test_functions.jsonl/25676 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 79
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9266,
669,
484,
15446,
368,
341,
262,
2060,
10714,
10297,
2243,
88928,
25,
52652,
4600,
10629,
486,
10580,
85954,
1043,
701,
330,
10580,
85954,
1043,
797,
262,
2060,
10714,
10297,
2243,
88928,
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 |
#[test]
fn test_predict_bhepred() {
#[rustfmt::skip]
let expected: Vec<u8> = vec![5, 0, 0, 0, 0,
4, 4, 4, 4, 4,
3, 3, 3, 3, 3,
2, 2, 2, 2, 2,
1, 1, 1, 1, 1];
#[rustfmt::skip]
let mut im = vec![5, 0, 0, 0, 0,
4, 0, 0, 0, 0,
3, 0, 0, 0, 0,
2, 0, 0, 0, 0,
1, 0, 0, 0, 0];
predict_bhepred(&mut im, 1, 1, 5);
for (&e, i) in expected.iter().zip(im) {
assert_eq!(e, i);
}
} | rust_cleaned_test_functions.jsonl/44869 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 415
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26815,
880,
383,
23464,
368,
341,
286,
11506,
35788,
12501,
486,
20599,
921,
286,
1077,
3601,
25,
11312,
34837,
23,
29,
284,
7486,
20703,
20,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_decode() {
use super::Instruction::*;
macro_rules! check (
($inst: expr, $val: expr) => {
assert_eq!($inst, Instruction::decode($val));
}
);
check!(Shifted, 0x0fb4);
check!(AddSub, 0x1c0a);
check!(ImmOp, 0x200a);
check!(AluOp, 0x4042);
check!(HiRegBx, 0x466c);
check!(PcLoad, 0x4d00);
check!(SingleXferR, 0x5045);
check!(HwSgnXfer, 0x5fb9);
check!(SingleXferI, 0x7078);
check!(HwXferI, 0x80b9);
check!(SpXfer, 0x9102);
check!(LoadAddr, 0xa001);
check!(SpAdd, 0xb082);
check!(PushPop, 0xb407);
check!(BlockXfer, 0xc103);
check!(CondBranch, 0xd1fb);
check!(Branch, 0xe002);
check!(LongBranch, 0xf801);
check!(Undefined, 0xe800);
} | rust_cleaned_test_functions.jsonl/102906 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 575
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
368,
341,
286,
990,
2256,
486,
16664,
79304,
286,
18072,
21407,
0,
1779,
2399,
310,
1711,
6308,
25,
15169,
11,
400,
831,
25,
15169,
8,
589,
341,
394,
2060,
10714,
0,
699,
6308,
11,
2905... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_truncate() {
let mut x = setup();
x.push(None);
x.push(Some(Enum::new("我强爆啊".as_bytes().to_vec(), 2)));
x.push(None);
x.push(Some(Enum::new("我好强啊".as_bytes().to_vec(), 1)));
x.push(Some(Enum::new("我成功了".as_bytes().to_vec(), 3)));
x.truncate(100);
assert_eq!(x.len(), 5);
x.truncate(3);
assert_eq!(x.len(), 3);
assert_eq!(x.get(0), None);
assert_eq!(x.get(1), Some(EnumRef::new("我强爆啊".as_bytes(), &2)));
assert_eq!(x.get(2), None);
x.truncate(1);
assert_eq!(x.len(), 1);
assert_eq!(x.get(0), None);
x.truncate(0);
assert_eq!(x.len(), 0);
} | rust_cleaned_test_functions.jsonl/124765 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 435
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3547,
26900,
368,
341,
286,
1077,
5206,
856,
284,
6505,
543,
286,
856,
2552,
26717,
317,
286,
856,
2552,
65405,
62382,
486,
931,
445,
35946,
99193,
99849,
103924,
3263,
300,
12524,
1005,
983,
1325... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 config_str = r#"
{
"dns_config": {
"servers": ["8.8.8.8"]
},
"rules": [
[ ["all", "all"], ["ip_address", "dhcp"] ]
],
"filter_config": {
"rules": [],
"nat_rules": [],
"rdr_rules": []
},
"filter_enabled_interface_types": ["wlan"]
}
"#;
let Config {
dns_config: DnsConfig { servers },
rules: default_config_rules,
filter_config,
filter_enabled_interface_types,
} = Config::load_str(config_str).unwrap();
assert_eq!(vec!["8.8.8.8".parse::<std::net::IpAddr>().unwrap()], servers);
assert_eq!(
vec![InterfaceSpec {
matcher: InterfaceMatcher::All,
config: ConfigOption::IpConfig(fidl_fuchsia_netstack_ext::IpAddressConfig::Dhcp),
}],
default_config_rules
);
let FilterConfig { rules, nat_rules, rdr_rules } = filter_config;
assert_eq!(Vec::<String>::new(), rules);
assert_eq!(Vec::<String>::new(), nat_rules);
assert_eq!(Vec::<String>::new(), rdr_rules);
assert_eq!(vec!["wlan"], filter_enabled_interface_types);
} | rust_cleaned_test_functions.jsonl/90306 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 593
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5332,
368,
341,
286,
1077,
2193,
2895,
284,
435,
2,
698,
515,
220,
330,
45226,
5332,
788,
341,
262,
330,
67696,
788,
4383,
23,
13,
23,
13,
23,
13,
23,
7026,
220,
1153,
220,
330,
21977,
788,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_jwks_verify() -> Result<()> {
let k = EcdsaPrivateKey::generate(EcdsaAlgorithm::ES512)?;
let k = WithKid::new("my key".into(), k);
let k_jwk = k.public_key_to_jwk()?;
let jwks = JwkSet { keys: vec![k_jwk] };
let verifier = jwks.verifier();
let token = sign(
HeaderAndClaims::with_claims(MyClaim { foo: "bar".into() }).set_kid("my key"),
&k,
)?;
verifier.verify_only::<MyClaim>(&token)?;
let verified = verifier.verify::<MyClaim>(&token)?;
assert_eq!(verified.claims.extra.foo, "bar");
Ok(())
} | rust_cleaned_test_functions.jsonl/33409 | {
"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,
5374,
86,
2787,
35638,
368,
1464,
5714,
71698,
341,
286,
1077,
595,
284,
468,
4385,
9081,
75981,
486,
19366,
10722,
4385,
9081,
27847,
486,
1570,
20,
16,
17,
40007,
286,
1077,
595,
284,
3085,
98... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_create_boxed_array() {
let a: ArrayImpl = I32Array::from_slice(&[Some(1), Some(2), Some(3), None]).into();
let a = a.into_boxed_array();
assert_eq!(a.get(0), Some(ScalarRefImpl::Int32(1)));
let a = a.into_array_impl();
assert_eq!(a.get(0), Some(ScalarRefImpl::Int32(1)));
} | rust_cleaned_test_functions.jsonl/59605 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
10194,
291,
3858,
368,
341,
286,
1077,
264,
25,
2910,
9673,
284,
358,
18,
17,
1857,
486,
1499,
26488,
2099,
58,
8373,
7,
16,
701,
4329,
7,
17,
701,
4329,
7,
18,
701,
2240,
10697,
18122... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_max_columns_check() {
let node = ExprDefBuilder::column_ref(0, FieldTypeTp::LongLong).build();
assert!(RpnExpressionBuilder::build_from_expr_tree_with_fn_mapper(
node.clone(),
fn_mapper,
0
)
.is_err());
for i in 1..10 {
assert!(RpnExpressionBuilder::build_from_expr_tree_with_fn_mapper(
node.clone(),
fn_mapper,
i
)
.is_ok());
}
let node = ExprDefBuilder::column_ref(3, FieldTypeTp::LongLong).build();
for i in 0..=3 {
assert!(RpnExpressionBuilder::build_from_expr_tree_with_fn_mapper(
node.clone(),
fn_mapper,
i
)
.is_err());
}
for i in 4..10 {
assert!(RpnExpressionBuilder::build_from_expr_tree_with_fn_mapper(
node.clone(),
fn_mapper,
i
)
.is_ok());
}
let node =
ExprDefBuilder::scalar_func(ScalarFuncSig::CastIntAsString, FieldTypeTp::LongLong)
.push_child(ExprDefBuilder::column_ref(1, FieldTypeTp::LongLong))
.push_child(ExprDefBuilder::column_ref(2, FieldTypeTp::LongLong))
.push_child(ExprDefBuilder::column_ref(5, FieldTypeTp::LongLong))
.build();
for i in 0..=5 {
assert!(RpnExpressionBuilder::build_from_expr_tree_with_fn_mapper(
node.clone(),
fn_mapper,
i
)
.is_err());
}
for i in 6..10 {
assert!(RpnExpressionBuilder::build_from_expr_tree_with_fn_mapper(
node.clone(),
fn_mapper,
i
)
.is_ok());
}
} | rust_cleaned_test_functions.jsonl/132647 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6345,
22590,
7200,
368,
341,
1789,
286,
1077,
2436,
284,
28819,
2620,
3297,
486,
6229,
7793,
7,
15,
11,
84614,
62241,
486,
6583,
6583,
568,
5834,
543,
286,
2060,
10297,
49,
19958,
9595,
3297,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_link_pattern() {
let output = inline_parse(&String::from("[hoge1](hoge2)"));
assert_eq!(
output,
String::from(r#"<a class="flav-md-a" href="hoge2" alt="hoge1">hoge1</a>"#)
);
} | rust_cleaned_test_functions.jsonl/22201 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 164
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7233,
21260,
368,
341,
310,
1077,
2550,
284,
7381,
21039,
2099,
703,
486,
1499,
10937,
71,
40532,
16,
9533,
71,
40532,
17,
8,
4010,
310,
2060,
10714,
33673,
394,
2550,
345,
394,
923,
486,
1499,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_file_user_dirs_exists() {
let base_dirs = ::BaseDirs::new();
let user_dirs_file = base_dirs.unwrap().config_dir().join("user-dirs.dirs");
println!("{:?} exists: {:?}", user_dirs_file, user_dirs_file.exists());
} | rust_cleaned_test_functions.jsonl/62315 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2458,
3317,
44869,
9766,
368,
341,
286,
1077,
2331,
44869,
284,
3504,
3978,
97384,
486,
931,
543,
286,
1077,
1196,
44869,
2458,
284,
2331,
44869,
55395,
1005,
1676,
4334,
1005,
5987,
445,
872,
173... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_improper_config_format() {
let mut file = NamedTempFile::new().unwrap();
let feed1 = "https://satylogin.medium.com/feed".to_string();
let feed2 = "https://motw.rs/rss.xml".to_string();
let now = chrono::Utc::now();
let content = format!(
r#"[
{{
"feed": "{feed1}",
"updated": "{now}"
}},
{{
"feed": "{feed2}"
}},
]"#,
feed1 = feed1,
now = now,
feed2 = feed2
);
writeln!(file, "{}", content).unwrap();
_get(file.path().to_str().unwrap()).unwrap();
} | rust_cleaned_test_functions.jsonl/16200 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 399
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
17895,
80668,
5332,
8955,
368,
341,
286,
1077,
5206,
1034,
284,
40459,
12151,
1703,
486,
931,
1005,
15454,
543,
286,
1077,
5395,
16,
284,
330,
2428,
1110,
36468,
88,
3673,
84366,
905,
93730,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_subtract_mores_than_two_days() {
let clock = Clock::new(2, 20).add_minutes(-3000);
assert_eq!(clock.to_string(), "00:20");
} | rust_cleaned_test_functions.jsonl/5376 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 72
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5228,
2144,
717,
4589,
51613,
23241,
28353,
368,
341,
262,
1077,
8866,
284,
26142,
486,
931,
7,
17,
11,
220,
17,
15,
568,
718,
67655,
4080,
18,
15,
15,
15,
317,
262,
2060,
10714,
10297,
20666,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_mock() {
let mut mock: Mock<u16, u16> = Mock::new(Box::new(|x| x * 2));
assert_eq!(mock.call(2), 4);
assert!(mock.called());
assert_eq!(mock.call_count(), 1);
mock.set_callback(Box::new(|x| x * 4));
assert_eq!(mock.call(2), 8);
assert_eq!(mock.call_count(), 2);
} | rust_cleaned_test_functions.jsonl/106282 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34134,
368,
341,
286,
1077,
5206,
7860,
25,
14563,
34837,
16,
21,
11,
575,
16,
21,
29,
284,
14563,
486,
931,
67758,
486,
931,
22428,
87,
91,
856,
353,
220,
17,
1106,
286,
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... | 1 |
#[test]
fn test_camelcase() {
assert_eq!("testABCD", to_camelcase("test a b c D"));
assert_eq!("fileSize", to_camelcase("File size"));
assert_eq!("low", to_camelcase("low"));
} | rust_cleaned_test_functions.jsonl/96753 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 89
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
35562,
5638,
368,
341,
262,
2060,
10714,
17223,
1944,
1867,
6484,
497,
311,
666,
35562,
5638,
445,
1944,
264,
293,
272,
422,
4010,
262,
2060,
10714,
17223,
1192,
1695,
497,
311,
666,
35562,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_supplies_display() {
let mut supplies = Supplies::new();
supplies.buy_oxen(200).unwrap();
supplies.buy_food(10).unwrap();
supplies.buy_ammo(20).unwrap();
supplies.buy_clothes(30).unwrap();
supplies.buy_misc(40).unwrap();
let supplies_display = format!("{}", &mut supplies);
assert_eq!("\t\x1B[36mFood\x1B[0m\t\x1B[35mAmmo\x1B[0m\t\x1B[34mClothes\x1B[0m\t\x1B[33mMisc\x1B[0m\t\x1B[32mMoney\x1B[0m\n\t10\t20\t30\t40\t400\n", supplies_display);
} | rust_cleaned_test_functions.jsonl/28675 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 288
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23723,
7202,
14825,
368,
341,
286,
1077,
5206,
16720,
284,
50252,
486,
931,
543,
286,
16720,
63871,
62,
5131,
268,
7,
17,
15,
15,
568,
15454,
543,
286,
16720,
63871,
58580,
7,
16,
15,
568,
154... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_metadata_from_cargo_toml_name_override() {
let cargo_toml = indoc!(
r#"
[package]
authors = ["konstin <konstin@mailbox.org>"]
name = "info-project"
version = "0.1.0"
description = "A test project"
homepage = "https://example.org"
[lib]
crate-type = ["cdylib"]
name = "pyo3_pure"
[package.metadata.maturin.scripts]
ph = "maturin:print_hello"
[package.metadata.maturin]
name = "info"
classifiers = ["Programming Language :: Python"]
description-content-type = "text/x-rst"
"#
);
let expected = indoc!(
r#"
Metadata-Version: 2.1
Name: info
Version: 0.1.0
Classifier: Programming Language :: Python
Summary: A test project
Home-Page: https://example.org
Author: konstin <konstin@mailbox.org>
Author-email: konstin <konstin@mailbox.org>
"#
);
let cargo_toml_struct: CargoToml = toml::from_str(&cargo_toml).unwrap();
let metadata =
Metadata21::from_cargo_toml(&cargo_toml_struct, "/not/exist/manifest/path").unwrap();
let actual = metadata.to_file_contents();
assert_eq!(
actual.trim(),
expected.trim(),
"Actual metadata differed from expected\nEXPECTED:\n{}\n\nGOT:\n{}",
expected,
actual
);
assert_eq!(
metadata.get_dist_info_dir(),
PathBuf::from("info-0.1.0.dist-info"),
"Dist info dir differed from expected"
);
} | rust_cleaned_test_functions.jsonl/77314 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 947
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22220,
5673,
666,
12088,
528,
316,
75,
1269,
48576,
368,
341,
286,
1077,
25652,
528,
316,
75,
284,
1257,
509,
33673,
310,
435,
2,
698,
310,
508,
1722,
921,
310,
12014,
284,
4383,
39537,
47461,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_subtraction() {
let a = Fp([
0x5360bb5978678032,
0x7dd275ae799e128e,
0x5c5b5071ce4f4dcf,
0xcdb21f93078dbb3e,
0xc32365c5e73f474a,
0x115a2a5489babe5b,
]);
let b = Fp([
0x9fd287733d23dda0,
0xb16bf2af738b3554,
0x3e57a75bd3cc6d1d,
0x900bc0bd627fd6d6,
0xd319a080efb245fe,
0x15fdcaa4e4bb2091,
]);
let c = Fp([
0x6d8d33e63b434d3d,
0xeb1282fdb766dd39,
0x85347bb6f133d6d5,
0xa21daa5a9892f727,
0x3b256cfb3ad8ae23,
0x155d7199de7f8464,
]);
assert_eq!(a - b, c);
} | rust_cleaned_test_functions.jsonl/70423 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 454
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5228,
26425,
368,
341,
262,
1077,
264,
284,
434,
79,
8956,
286,
220,
15,
87,
20,
18,
21,
15,
6066,
20,
24,
22,
23,
21,
22,
23,
15,
18,
17,
345,
286,
220,
15,
87,
22,
631,
17,
22,
20,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_open_read_only() {
let tmpdir = starcoin_config::temp_dir();
let db = DBStorage::new(tmpdir.path(), RocksdbConfig::default(), None).unwrap();
let key = HashValue::random();
let value = HashValue::zero();
let result = db.put(DEFAULT_PREFIX_NAME, key.to_vec(), value.to_vec());
assert!(result.is_ok());
let path = tmpdir.as_ref().join("starcoindb");
let db = DBStorage::open_with_cfs(
path,
StorageVersion::current_version()
.get_column_family_names()
.to_vec(),
true,
RocksdbConfig::default(),
None,
)
.unwrap();
let result = db.put(DEFAULT_PREFIX_NAME, key.to_vec(), value.to_vec());
assert!(result.is_err());
let result = db.get(DEFAULT_PREFIX_NAME, key.to_vec()).unwrap();
assert_eq!(result, Some(value.to_vec()));
} | rust_cleaned_test_functions.jsonl/73683 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 380
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11311,
6443,
18410,
368,
341,
262,
1077,
4174,
3741,
284,
6774,
7160,
5332,
486,
3888,
4334,
543,
262,
1077,
2927,
284,
5952,
5793,
486,
931,
10368,
3741,
3875,
1507,
68031,
1999,
2648,
486,
2258,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serialize_deserialize_move_module_id() {
test_serialize_deserialize(
MoveModuleId {
address: "0x1".parse().unwrap(),
name: "Diem".parse().unwrap(),
},
json!("0x1::Diem"),
);
} | rust_cleaned_test_functions.jsonl/66278 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 165
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
15768,
9050,
17134,
10750,
842,
368,
341,
286,
1273,
88686,
15768,
9050,
1006,
310,
14561,
3332,
764,
341,
394,
2621,
25,
330,
15,
87,
16,
3263,
6400,
1005,
15454,
3148,
394,
829,
25,
330... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dead() {
let x = Rc::new(5);
let y = Rc::downgrade(&x);
drop(x);
assert!(y.upgrade().is_none());
} | rust_cleaned_test_functions.jsonl/4659 | {
"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,
53427,
368,
341,
286,
1077,
856,
284,
81463,
486,
931,
7,
20,
317,
286,
1077,
379,
284,
81463,
486,
2923,
6937,
2099,
87,
317,
286,
5943,
2075,
317,
286,
2060,
10297,
88,
17652,
6937,
1005,
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 |
#[test]
fn test_transaction_invalid_signer() {
let tx = hex::decode("015fa11ceb0b0100000005010002030205050705070c10081c200000000100010002060c03000553746f72650973746f72655f7536340000000000000000000000000000000000000000000000000000000000000001000001040b000a01110002010164000000000000000107200000000000000000000000000000000000000000000000000000000000000001084466696e616e6365015400").unwrap();
let tx = Transaction::try_from(tx.as_ref()).unwrap();
assert_eq!(tx.signers_count(), 1);
tx.into_script(vec![CORE_CODE_ADDRESS, CORE_CODE_ADDRESS])
.unwrap();
} | rust_cleaned_test_functions.jsonl/13991 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 219
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28884,
31433,
11172,
261,
368,
341,
262,
1077,
9854,
284,
12371,
486,
18196,
445,
15,
16,
20,
3632,
16,
16,
84797,
15,
65,
15,
16,
15,
15,
15,
15,
15,
15,
15,
20,
15,
16,
15,
15,
15,
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_closure_counter() {
let gil = Python::acquire_gil();
let py = gil.python();
let counter = std::cell::RefCell::new(0);
let counter_fn =
move |_args: &types::PyTuple, _kwargs: Option<&types::PyDict>| -> PyResult<i32> {
let mut counter = counter.borrow_mut();
*counter += 1;
Ok(*counter)
};
let counter_py = PyCFunction::new_closure(counter_fn, py).unwrap();
py_assert!(py, counter_py, "counter_py() == 1");
py_assert!(py, counter_py, "counter_py() == 2");
py_assert!(py, counter_py, "counter_py() == 3");
} | rust_cleaned_test_functions.jsonl/109267 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 277
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
72823,
15730,
368,
341,
262,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
262,
1077,
4510,
284,
342,
321,
43193,
1428,
262,
1077,
5546,
284,
1460,
486,
5873,
486,
3945,
3599,
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_convert_to_duration() {
let cases = vec![
("2012-12-31 11:30:45.123456", 4, "11:30:45.1235"),
("2012-12-31 11:30:45.123456", 6, "11:30:45.123456"),
("2012-12-31 11:30:45.123456", 0, "11:30:45"),
("2012-12-31 11:30:45.999999", 0, "11:30:46"),
("2017-01-05 08:40:59.575601", 0, "08:41:00"),
("2017-01-05 23:59:59.575601", 0, "00:00:00"),
("0000-00-00 00:00:00", 6, "00:00:00"),
];
let mut ctx = EvalContext::default();
for (s, fsp, expect) in cases {
let t = Time::parse_utc_datetime(s, fsp).unwrap();
let du: MyDuration = t.convert(&mut ctx).unwrap();
let get = du.to_string();
assert_eq!(get, expect);
}
} | rust_cleaned_test_functions.jsonl/93962 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 457
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
2346,
25454,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
3489,
17,
15,
16,
17,
12,
16,
17,
12,
18,
16,
220,
16,
16,
25,
18,
15,
25,
19,
20,
13,
16,
17,
18,
19,
20,
21,
497... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_comment_parse() {
let c = r"-- abci
CREATE TABLE test (col Int32)";
let pairs = BqlParser::parse(Rule::cmd_list, c)
.unwrap_or_else(|e| panic!("{}", e));
println!("pairs: {}", pretty_parse_tree(pairs));
} | rust_cleaned_test_functions.jsonl/76153 | {
"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,
17638,
21039,
368,
341,
310,
1077,
272,
284,
435,
74757,
668,
5855,
198,
22599,
14363,
1273,
320,
2074,
1333,
18,
17,
24023,
310,
1077,
13530,
284,
425,
1470,
6570,
486,
6400,
2785,
1111,
486,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_noto_sans() {
run_test(
&TEST_DATA,
"harfbuzz/good-noto-sans.pa",
"noto/NotoSansGurmukhi-Regular.ttf",
&[JOINER_GLYPH_INDEX],
6,
);
} | rust_cleaned_test_functions.jsonl/91155 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 226
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1089,
2072,
643,
596,
368,
341,
394,
1598,
4452,
1006,
503,
609,
10033,
7896,
345,
503,
330,
12982,
10798,
8889,
4846,
1386,
29169,
78,
1331,
596,
56875,
756,
503,
330,
1921,
78,
20290,
2072,
46... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_resc(){
let rc = Arc::new(RC4::new());
for i in 1..10 {
let rc2 = Arc::clone(&rc);
thread::spawn(move ||{
println!("child {} started.", i);
thread::sleep(time::Duration::from_millis(i*1000));
rc2.Release();
});
}
println!("main thread ...");
thread::sleep(time::Duration::from_millis(1000));
for i in 1..10{
rc.Aquire();
println!("go a resource. {:?}", time::Instant::now());
}
} | rust_cleaned_test_functions.jsonl/52301 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 343
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4918,
66,
11895,
1406,
286,
1077,
10192,
284,
19689,
486,
931,
2785,
34,
19,
486,
931,
1423,
1789,
286,
369,
600,
304,
220,
16,
496,
16,
15,
341,
310,
1077,
10192,
17,
284,
19689,
486,
19982,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_locate_latest_common_block2() {
let consensus = Consensus::default();
let (chain_controller1, shared1) = start_chain(Some(consensus.clone()));
let (chain_controller2, shared2) = start_chain(Some(consensus.clone()));
let block_number = 200;
let mut blocks: Vec<BlockView> = Vec::new();
let mut parent = consensus.genesis_block().header();
for i in 1..block_number {
let store = shared1.store();
let parent_epoch = store.get_block_epoch(&parent.hash()).unwrap();
let epoch = store
.next_epoch_ext(shared1.consensus(), &parent_epoch, &parent)
.unwrap_or(parent_epoch);
let new_block = gen_block(&shared1, &parent, &epoch, i);
blocks.push(new_block.clone());
chain_controller1
.internal_process_block(Arc::new(new_block.clone()), Switch::DISABLE_ALL)
.expect("process block ok");
chain_controller2
.internal_process_block(Arc::new(new_block.clone()), Switch::DISABLE_ALL)
.expect("process block ok");
parent = new_block.header().to_owned();
}
parent = blocks[150].header();
let fork = parent.number();
for i in 1..=block_number {
let store = shared2.store();
let parent_epoch = store.get_block_epoch(&parent.hash()).unwrap();
let epoch = store
.next_epoch_ext(shared2.consensus(), &parent_epoch, &parent)
.unwrap_or(parent_epoch);
let new_block = gen_block(&shared2, &parent, &epoch, i + 100);
chain_controller2
.internal_process_block(Arc::new(new_block.clone()), Switch::DISABLE_ALL)
.expect("process block ok");
parent = new_block.header().to_owned();
}
let synchronizer1 = gen_synchronizer(chain_controller1, shared1.clone());
let synchronizer2 = gen_synchronizer(chain_controller2, shared2.clone());
let locator1 = synchronizer1
.shared
.active_chain()
.get_locator(shared1.snapshot().tip_header());
let latest_common = synchronizer2
.shared
.active_chain()
.locate_latest_common_block(&Byte32::zero(), &locator1[..])
.unwrap();
assert_eq!(
shared1.snapshot().get_block_hash(fork).unwrap(),
shared2.snapshot().get_block_hash(fork).unwrap()
);
assert!(
shared1.snapshot().get_block_hash(fork + 1).unwrap()
!= shared2.snapshot().get_block_hash(fork + 1).unwrap()
);
assert_eq!(
shared1.snapshot().get_block_hash(latest_common).unwrap(),
shared1.snapshot().get_block_hash(fork).unwrap()
);
} | rust_cleaned_test_functions.jsonl/95014 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1384
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13400,
349,
64880,
21107,
7113,
17,
368,
341,
286,
1077,
23869,
284,
7292,
13626,
486,
2258,
543,
286,
1077,
320,
8819,
21600,
16,
11,
6094,
16,
8,
284,
1191,
30583,
65405,
7,
6254,
13626,
15997... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bracket_generator_hits() {
let fin = |x: f64| x.sin();
let f = RealFn::new(&fin);
let pi = f64::consts::PI;
let b = Bounds::new(-0.1, 4.0 * pi + 0.1);
let results: Vec<Bounds> = BracketGenerator::new(&f, b, 1.0).collect();
assert_eq!(results.len(), 5);
assert_eq!(Bounds::new(-0.1, 0.9), results[0]);
assert_eq!(Bounds::new(2.9, 3.9), results[1]); // pi
assert_eq!(Bounds::new(5.9, 6.9), results[2]); // 2pi
assert_eq!(Bounds::new(8.9, 9.9), results[3]); // 3pi
assert_eq!(Bounds::new(11.9, 4.0 * pi + 0.1), results[4]); // 4pi
} | rust_cleaned_test_functions.jsonl/7158 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 348
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17682,
5709,
25813,
63832,
368,
341,
286,
1077,
1875,
284,
760,
87,
25,
282,
21,
19,
91,
856,
16318,
543,
286,
1077,
282,
284,
8800,
24911,
486,
931,
2099,
5472,
317,
286,
1077,
8938,
284,
282... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serde_de_integer_types() -> Result<(), Box<EvalAltResult>> {
assert_eq!(42, from_dynamic::<i8>(&Dynamic::from(42 as INT))?);
assert_eq!(42, from_dynamic::<i16>(&Dynamic::from(42 as INT))?);
assert_eq!(42, from_dynamic::<i32>(&Dynamic::from(42 as INT))?);
assert_eq!(42, from_dynamic::<i64>(&Dynamic::from(42 as INT))?);
assert_eq!(42, from_dynamic::<u8>(&Dynamic::from(42 as INT))?);
assert_eq!(42, from_dynamic::<u16>(&Dynamic::from(42 as INT))?);
assert_eq!(42, from_dynamic::<u32>(&Dynamic::from(42 as INT))?);
assert_eq!(42, from_dynamic::<u64>(&Dynamic::from(42 as INT))?);
Ok(())
} | rust_cleaned_test_functions.jsonl/97333 | {
"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,
75861,
450,
2259,
31725,
9763,
368,
1464,
5714,
68843,
8261,
23835,
831,
26017,
2077,
2452,
341,
262,
2060,
10714,
10297,
19,
17,
11,
504,
45992,
27638,
72,
23,
44784,
21752,
486,
1499,
7,
19,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 9 |
#[test]
fn test_transport_worker_connected_event() {
let (_, stop_rx) = mpsc::channel();
let (_, worker_rx) = mpsc::channel();
let (worker_tx, rx) = mpsc::channel();
let worker = TransportWorker {
stop: stop_rx,
timeout: Duration::from_micros(0),
rx: worker_rx,
txs: HashMap::from_iter(vec![(1, worker_tx)].into_iter()),
};
let data = Event::Connected;
worker.handle_data(data);
match rx.recv() {
Ok(Event::Connected) => {}
e => panic!(format!("Unexpected output: {:?}", e)),
}
} | rust_cleaned_test_functions.jsonl/126109 | {
"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,
46398,
40385,
43276,
6748,
368,
341,
286,
1077,
39464,
2936,
24330,
8,
284,
296,
81984,
486,
10119,
543,
286,
1077,
39464,
11864,
24330,
8,
284,
296,
81984,
486,
10119,
543,
286,
1077,
320,
21462,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_hex_codec() {
let mut data = [0u8; 128];
getrandom(&mut data).unwrap();
let data = data.to_vec();
assert_eq!(hex_encode(&data), hex::encode(data.clone()));
assert_eq!(
hex_decode(&hex_encode(&data)).unwrap(),
hex::decode(hex::encode(data)).unwrap()
);
assert!(hex_decode(String::new().as_str()).unwrap().is_empty());
} | rust_cleaned_test_functions.jsonl/60105 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 216
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32655,
51084,
368,
341,
286,
1077,
5206,
821,
284,
508,
15,
84,
23,
26,
220,
16,
17,
23,
935,
286,
633,
11463,
2099,
6984,
821,
568,
15454,
543,
286,
1077,
821,
284,
821,
2389,
13251,
1428,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_detect_consts2() {
let filter = PathFilter::new("/hello/world2");
let mut state = PathState::new("hello/world");
assert!(!filter.detect(&mut state));
assert_eq!(
format!("{:?}", state),
r#"PathState { url_path: "hello/world", cursor: 0, params: {} }"#
);
} | rust_cleaned_test_functions.jsonl/63610 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56457,
48530,
17,
368,
341,
286,
1077,
4051,
284,
7933,
5632,
486,
931,
4283,
14990,
78892,
17,
797,
286,
1077,
5206,
1584,
284,
7933,
1397,
486,
931,
445,
14990,
78892,
797,
286,
2060,
0,
3471,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_proc_maps() {
let myself = Process::myself().unwrap();
let maps = myself.maps().unwrap();
for map in maps {
println!("{:?}", map);
}
} | rust_cleaned_test_functions.jsonl/17543 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 82
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24436,
46512,
368,
341,
262,
1077,
7037,
284,
8603,
486,
2408,
721,
1005,
15454,
543,
262,
1077,
14043,
284,
7037,
18895,
1005,
15454,
543,
262,
369,
2415,
304,
14043,
341,
286,
13751,
88928,
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
] | 2 |
#[test]
fn test_fill_control_setup() {
let mut buf = [0u8; ffi::constants::LIBUSB_CONTROL_SETUP_SIZE + 1];
unsafe {
ffi::libusb_fill_control_setup(
buf.as_mut_ptr(),
ffi::constants::LIBUSB_REQUEST_TYPE_VENDOR | ffi::constants::LIBUSB_ENDPOINT_OUT,
0x04,
0x4e,
0,
(buf.len() - ffi::constants::LIBUSB_CONTROL_SETUP_SIZE) as u16,
);
}
buf[ffi::constants::LIBUSB_CONTROL_SETUP_SIZE] = 0x01;
let setup: *mut ffi::libusb_control_setup = buf.as_mut_ptr() as *mut _;
assert_eq!(
unsafe { (*setup).bmRequestType },
ffi::constants::LIBUSB_REQUEST_TYPE_VENDOR | ffi::constants::LIBUSB_ENDPOINT_OUT
);
assert_eq!(unsafe { (*setup).bRequest }, 0x04);
assert_eq!(unsafe { u16::from_le((*setup).wValue) }, 0x4e);
assert_eq!(unsafe { u16::from_le((*setup).wIndex) }, 0);
assert_eq!(unsafe { u16::from_le((*setup).wLength) }, 1);
} | rust_cleaned_test_functions.jsonl/103120 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 491
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30728,
13436,
21363,
368,
341,
262,
1077,
5206,
6607,
284,
508,
15,
84,
23,
26,
76956,
486,
15763,
486,
23838,
26032,
23680,
61178,
4098,
488,
220,
16,
935,
262,
19860,
341,
286,
76956,
486,
274... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_transaction() {
let hex_tx = hex_bytes("0100000001a15d57094aa7a21a28cb20b59aab8fc7d1149a3bdbcddba9c622e4f5f6a99ece010000006c493046022100f93bb0e7d8db7bd46e40132d1f8242026e045f03a0efe71bbb8e3f475e970d790221009337cd7f1f929f00cc6ff01f03729b069a7c21b59b1736ddfee5db5946c5da8c0121033b9b137ee87d5a812d6f506efdd37f0affa7ffc310711c06c7f3e097c9447c52ffffffff0100e1f505000000001976a9140389035a9225b3839e2bbf32d826a1e222031fd888ac00000000").unwrap();
let tx: Result<Transaction, _> = deserialize(&hex_tx);
assert!(tx.is_ok());
let realtx = tx.unwrap();
assert_eq!(realtx.version, 1);
assert_eq!(realtx.input.len(), 1);
// In particular this one is easy to get backward -- in bitcoin hashes are encoded
// as little-endian 256-bit numbers rather than as data strings.
assert_eq!(realtx.input[0].prev_hash.be_hex_string(),
"ce9ea9f6f5e422c6a9dbcddb3b9a14d1c78fab9ab520cb281aa2a74a09575da1".to_string());
assert_eq!(realtx.input[0].prev_index, 1);
assert_eq!(realtx.output.len(), 1);
assert_eq!(realtx.lock_time, 0);
assert_eq!(realtx.bitcoin_hash().be_hex_string(),
"a6eab3c14ab5272a58a5ba91505ba1a4b6d7a3a9fcbd187b6cd99a7b6d548cb7".to_string());
assert_eq!(realtx.get_weight(), 193*4);
} | rust_cleaned_test_functions.jsonl/107404 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 731
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28884,
368,
341,
286,
1077,
12371,
17805,
284,
12371,
12524,
445,
15,
16,
15,
15,
15,
15,
15,
15,
15,
16,
64,
16,
20,
67,
20,
22,
15,
24,
19,
5305,
22,
64,
17,
16,
64,
17,
23,
7221,
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_transpile_decorators() {
let specifier = resolve_url_or_path("https://deno.land/x/mod.ts")
.expect("could not resolve specifier");
let source = r#"
function enumerable(value: boolean) {
return function (
_target: any,
_propertyKey: string,
descriptor: PropertyDescriptor,
) {
descriptor.enumerable = value;
};
}
export class A {
@enumerable(false)
a() {
Test.value;
}
}
"#;
let module = parse(specifier.as_str(), source, &MediaType::TypeScript)
.expect("could not parse module");
let (code, _) = module
.transpile(&EmitOptions::default())
.expect("could not strip types");
assert!(code.contains("_applyDecoratedDescriptor("));
} | rust_cleaned_test_functions.jsonl/2740 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 346
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7965,
12192,
70369,
2973,
368,
341,
262,
1077,
97616,
284,
8830,
2903,
8734,
2638,
445,
2428,
1110,
5183,
78,
87627,
10776,
38479,
21288,
1138,
414,
659,
17119,
445,
28077,
537,
8830,
97616,
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_sql_of_ast_2() -> Result<()> {
let query: Query = parse(
r###"
from employees
aggregate sum_salary = s"count({salary})"
filter sum_salary > 100
"###,
)?;
let sql = resolve_and_translate(query)?;
assert_snapshot!(sql, @r###"
SELECT
count(salary) AS sum_salary
FROM
employees
HAVING
count(salary) > 100
"###);
assert!(sql.to_lowercase().contains(&"having".to_lowercase()));
Ok(())
} | rust_cleaned_test_functions.jsonl/62555 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 302
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18063,
3575,
48019,
62,
17,
368,
1464,
5714,
71698,
341,
286,
1077,
3239,
25,
11361,
284,
4715,
1006,
310,
435,
14374,
698,
286,
504,
8256,
198,
286,
23192,
2629,
71222,
284,
274,
1,
1830,
2306,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_fmt() -> Result<(), score::TryFromUByteError> {
let quality_scores = [45, 35, 43, 50, 0]
.iter()
.cloned()
.map(Score::try_from)
.collect::<Result<Vec<_>, _>>()
.map(QualityScores::from)?;
assert_eq!(quality_scores.to_string(), "NDLS!");
Ok(())
} | rust_cleaned_test_functions.jsonl/30034 | {
"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,
38128,
368,
1464,
5714,
68843,
5456,
486,
21453,
3830,
52,
7153,
1454,
29,
341,
286,
1077,
4271,
27198,
284,
508,
19,
20,
11,
220,
18,
20,
11,
220,
19,
18,
11,
220,
20,
15,
11,
220,
15,
92... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_snapshot_comparison() {
let (mut testkit, api) = init_testkit();
let tx = {
let (pubkey, key) = crypto::gen_keypair();
TxIncrement::new(&pubkey, 5, &key)
};
testkit
.probe(tx.clone())
.compare(testkit.snapshot())
.map(CounterSchema::new)
.map(CounterSchema::count)
.assert_before("Counter does not exist", Option::is_none)
.assert_after("Counter has been set", |&c| c == Some(5));
api.send(tx);
testkit.create_block();
let other_tx = {
let (pubkey, key) = crypto::gen_keypair();
TxIncrement::new(&pubkey, 3, &key)
};
testkit
.probe(other_tx.clone())
.compare(testkit.snapshot())
.map(CounterSchema::new)
.map(CounterSchema::count)
.map(|&c| c.unwrap())
.assert("Counter has increased", |&old, &new| new == old + 3);
} | rust_cleaned_test_functions.jsonl/86873 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 433
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53265,
90797,
368,
341,
262,
1077,
320,
6984,
1273,
8226,
11,
6330,
8,
284,
2930,
4452,
8226,
1428,
262,
1077,
9854,
284,
341,
286,
1077,
320,
9585,
792,
11,
1376,
8,
284,
19028,
486,
4370,
30... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_insert() -> Result<(), IndexError> {
let mut x: MyVec<usize> = MyVec::new();
assert_eq!(List::len(&x), 0);
assert!(List::is_empty(&x));
List::insert(&mut x, 0, 11)?;
assert_eq!(*List::get(&x, 0)?, 11);
assert_eq!(List::len(&x), 1);
List::insert(&mut x, 0, 12)?;
assert_eq!(List::len(&x), 2);
assert_eq!(*List::get(&x, 1)?, 11);
assert_eq!(*List::get(&x, 0)?, 12);
Ok(())
} | rust_cleaned_test_functions.jsonl/24004 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 213
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
368,
1464,
5714,
68843,
60203,
29,
341,
262,
1077,
5206,
856,
25,
3017,
10050,
90244,
29,
284,
3017,
10050,
486,
931,
543,
262,
2060,
10714,
10297,
852,
486,
2892,
2099,
87,
701,
220,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_sign_verify() {
let t = generate_random_transaction();
let t_2 = generate_random_transaction();
let key = key_pair::random();
let key_2 = key_pair::random();
let signature = sign(&t, &key);
let signature_2 = sign(&t_2, &key);
assert!(verify_with_origin_type(&t.clone(), &(key.public_key().clone()), &signature.clone()));
assert!(!verify_with_origin_type(&t.clone(), &(key.public_key().clone()), &signature_2.clone()));
let sig_bytes: Box<[u8]> = signature.as_ref().into();
let key_bytes: Box<[u8]> = key.public_key().as_ref().into();
let sig_bytes_2: Box<[u8]> = signature_2.as_ref().into();
let key_bytes_2: Box<[u8]> = key_2.public_key().as_ref().into();
let st = SignedTransaction::new(t.clone(), sig_bytes.clone(), key_bytes.clone());
// SignedTransaction with fake signature
let st_2 = SignedTransaction::new(t.clone(), sig_bytes_2.clone(), key_bytes.clone());
assert_eq!(t.clone().inputs, st.clone().transaction.inputs);
assert_eq!(t.clone().outputs, st.clone().transaction.outputs);
assert!(verify(&st.transaction.clone(), st.public_key.clone().as_ref(), st.signature.clone().as_ref()));
assert!(!verify(&st.transaction.clone(), st.public_key.clone().as_ref(), st_2.signature.clone().as_ref()));
assert!(!verify(&st.transaction.clone(), key_bytes_2.clone().as_ref(), st.signature.clone().as_ref()));
assert!(!verify(&t_2.clone(), st.public_key.clone().as_ref(), st.signature.clone().as_ref()));
} | rust_cleaned_test_functions.jsonl/44586 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 693
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11172,
35638,
368,
341,
286,
1077,
259,
284,
6923,
22644,
28884,
543,
286,
1077,
259,
62,
17,
284,
6923,
22644,
28884,
543,
286,
1077,
1376,
284,
1376,
14445,
486,
11463,
543,
286,
1077,
1376,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_maybe_parsed_min_len() {
let buff = [1_u8, 2, 3, 4];
let mp = MaybeParsed::new_with_min_len(&buff[..], 3);
assert_eq!(mp.unwrap(), &buff[..]);
let mp = MaybeParsed::new_with_min_len(&buff[..], 5);
assert_eq!(mp.unwrap_incomplete(), &buff[..]);
} | rust_cleaned_test_functions.jsonl/59728 | {
"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,
717,
49791,
75788,
7260,
6043,
368,
341,
286,
1077,
11522,
284,
508,
16,
7300,
23,
11,
220,
17,
11,
220,
18,
11,
220,
19,
935,
286,
1077,
10490,
284,
10696,
82959,
486,
931,
6615,
7260,
6043,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cfg_if_main() {
parse_macro(
r#"
macro_rules! cfg_if {
($(
if #[cfg($($meta:meta),*)] { $($it:item)* }
) else * else {
$($it2:item)*
}) => {
__cfg_if_items! {
() ;
$( ( ($($meta),*) ($($it)*) ), )*
( () ($($it2)*) ),
}
};
// Internal macro to Apply a cfg attribute to a list of items
(@__apply $m:meta, $($it:item)*) => {
$(#[$m] $it)*
};
}
"#,
).assert_expand_items(r#"
cfg_if ! {
if # [ cfg ( target_env = "msvc" ) ] {
// no extra unwinder support needed
} else if # [ cfg ( all ( target_arch = "wasm32" , not ( target_os = "emscripten" ) ) ) ] {
// no unwinder on the system!
} else {
mod libunwind ;
pub use libunwind :: * ;
}
}
"#,
"__cfg_if_items ! {() ; ((target_env = \"msvc\") ()) , ((all (target_arch = \"wasm32\" , not (target_os = \"emscripten\"))) ()) , (() (mod libunwind ; pub use libunwind :: * ;)) ,}"
).assert_expand_items(
r#"
cfg_if ! { @ __apply cfg ( all ( not ( any ( not ( any ( target_os = "solaris" , target_os = "illumos" ) ) ) ) ) ) , }
"#,
"",
);
} | rust_cleaned_test_functions.jsonl/28768 | {
"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,
18343,
11119,
11027,
368,
341,
1066,
262,
4715,
58810,
1006,
286,
435,
2,
698,
286,
18072,
21407,
0,
13286,
11119,
341,
310,
1711,
1006,
394,
421,
11506,
14072,
699,
699,
5490,
25,
5490,
701,
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_sphl() {
let mut state = State8080::empty_state();
state.memory = vec![0xf9];
state.sp = 0x00;
state.h = 0x50;
state.l = 0x6c;
emulate_8080_op(&mut state);
assert_eq!(state.sp, 0x506c);
} | rust_cleaned_test_functions.jsonl/7777 | {
"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,
643,
759,
75,
368,
341,
286,
1077,
5206,
1584,
284,
3234,
23,
15,
23,
15,
486,
3194,
4387,
543,
286,
1584,
36611,
284,
7486,
20703,
15,
5848,
24,
935,
286,
1584,
8572,
284,
220,
15,
87,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse() -> Result<(), Error> {
let public_key1: PublicKey = KEY_PUBLIC_ASN1_HEX.parse()?;
let public_key2: PublicKey = KEY_PUBLIC_HEX.parse()?;
let secret_key1: SecretKey = KEY_SECRET_ASN1_HEX.parse()?;
let secret_key2: SecretKey = KEY_SECRET_HEX.parse()?;
assert_eq!(public_key1, public_key2);
assert_eq!(secret_key1.0.as_bytes(), secret_key2.0.as_bytes());
assert_eq!(public_key1, secret_key1.public());
assert_eq!(public_key2, secret_key2.public());
assert_eq!(secret_key2.public(), secret_key1.public());
Ok(())
} | rust_cleaned_test_functions.jsonl/73 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 298
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
368,
1464,
5714,
68843,
4600,
29,
341,
286,
1077,
584,
3097,
16,
25,
70280,
284,
12013,
36209,
1566,
18966,
16,
86502,
4632,
94136,
286,
1077,
584,
3097,
17,
25,
70280,
284,
12013,
36209,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_binary_fn() {
use self::binary_fn::*;
assert_eq!( basic( 0 ), 0 );
assert_eq!( method( 1 ), 2 );
assert_eq!( func( 2 ), 4 );
assert_eq!( misc( 3 ), 33 );
} | rust_cleaned_test_functions.jsonl/932 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31761,
15246,
368,
341,
286,
990,
656,
486,
25891,
15246,
56162,
286,
2060,
10714,
10297,
6770,
7,
220,
220,
15,
6882,
220,
220,
15,
1439,
286,
2060,
10714,
10297,
1714,
7,
220,
16,
6882,
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_float_numeric_values() {
parse_equals("0.0e0 ", 0.0);
parse_equals("0E0 ", 0.0);
parse_equals("0e0 ", 0e0);
parse_equals("305e1 ", 3050.0);
parse_equals("305.0e1 ", 3050.0);
parse_equals("-0.279e3 ", -279.0);
parse_equals("-279e0 ", -279.0);
parse_equals("-279.5e0 ", -279.5);
parse_fails("305 ");
// Has exponent delimiter but missing exponent
parse_fails("305e ");
// No digits before the decimal point
parse_fails(".305e ");
// Fractional exponent
parse_fails("305e0.5");
// Negative fractional exponent
parse_fails("305e-0.5");
// Doesn't consume leading whitespace
parse_fails(" 305e1 ");
// Doesn't accept leading zeros
parse_fails("0305e1 ");
// Doesn't accept leading plus sign
parse_fails("+305e1 ");
// Doesn't accept multiple negative signs
parse_fails("--305e1 ");
parse_fails("305e1");
} | rust_cleaned_test_functions.jsonl/85901 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 530
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
17586,
29418,
9146,
368,
341,
286,
4715,
61664,
445,
15,
13,
15,
68,
15,
3670,
220,
15,
13,
15,
317,
286,
4715,
61664,
445,
15,
36,
15,
3670,
220,
15,
13,
15,
317,
286,
4715,
61664,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.