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_clean_zero_lamport_and_old_roots() {
solana_logger::setup();
let accounts = AccountsDb::new(Vec::new(), &ClusterType::Development);
let pubkey = solana_sdk::pubkey::new_rand();
let account = AccountSharedData::new(1, 0, AccountSharedData::default().owner());
let zero_lamport_account =
AccountSharedData::new(0, 0, AccountSharedData::default().owner());
// Store a zero-lamport account
accounts.store_uncached(0, &[(&pubkey, &account)]);
accounts.store_uncached(1, &[(&pubkey, &zero_lamport_account)]);
// candidate for cleaning
accounts.add_root(0);
accounts.add_root(1);
// zero-lamport account should be cleaned
accounts.clean_accounts(None, false);
assert!(accounts.storage.get_slot_stores(0).is_none());
assert!(accounts.storage.get_slot_stores(1).is_none());
// Slot 0 should be cleaned because all it's accounts have been
// updated in the rooted slot 1
assert_eq!(accounts.alive_account_count_in_slot(0), 0);
// Slot 1 should be cleaned because all it's accounts are
// storage entries
assert_eq!(accounts.alive_account_count_in_slot(1), 0);
// because it has been removed
assert!(accounts.accounts_index.get(&pubkey, None, None).is_none());
} | rust_cleaned_test_functions.jsonl/1352 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 603
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19573,
19359,
907,
309,
403,
8378,
21108,
26608,
2412,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
1428,
286,
1077,
9618,
284,
40655,
7994,
486,
931,
49923,
486,
931,
1507,
609,
28678,
929,
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_explicit_rollover() {
let mut t = SpooledTempFile::new(100);
assert_eq!(t.write(b"abcdefghijklmnopqrstuvwxyz").unwrap(), 26);
assert_eq!(t.seek(SeekFrom::Current(0)).unwrap(), 26);
assert!(!t.is_rolled());
// roll over explicitly
assert!(t.roll().is_ok());
assert!(t.is_rolled());
assert_eq!(t.seek(SeekFrom::Current(0)).unwrap(), 26);
let mut buf = Vec::new();
assert_eq!(t.read_to_end(&mut buf).unwrap(), 0);
assert_eq!(buf.as_slice(), b"");
buf.clear();
assert_eq!(t.seek(SeekFrom::Start(0)).unwrap(), 0);
assert_eq!(t.read_to_end(&mut buf).unwrap(), 26);
assert_eq!(buf.as_slice(), b"abcdefghijklmnopqrstuvwxyz");
assert_eq!(t.seek(SeekFrom::Current(0)).unwrap(), 26);
} | rust_cleaned_test_functions.jsonl/115752 | {
"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,
14214,
6026,
62,
43684,
423,
368,
341,
262,
1077,
5206,
259,
284,
3089,
45073,
12151,
1703,
486,
931,
7,
16,
15,
15,
317,
262,
2060,
10714,
10297,
83,
3836,
1883,
1,
67512,
1827,
15454,
1507,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lazy_partition_agg() {
let df = df! {
"foo" => &[1, 1, 2, 2, 3],
"bar" => &[1.0, 1.0, 2.0, 2.0, 3.0]
}
.unwrap();
let out = df
.lazy()
.groupby([col("foo")])
.agg([col("bar").mean()])
.sort("foo", Default::default())
.collect()
.unwrap();
assert_eq!(
Vec::from(out.column("bar").unwrap().f64().unwrap()),
&[Some(1.0), Some(2.0), Some(3.0)]
);
let out = scan_foods_csv()
.groupby([col("category")])
.agg([col("calories").list()])
.sort("category", Default::default())
.collect()
.unwrap();
let cat_agg_list = out.select_at_idx(1).unwrap();
let fruit_series = cat_agg_list.list().unwrap().get(0).unwrap();
let fruit_list = fruit_series.i64().unwrap();
assert_eq!(
Vec::from(fruit_list),
&[
Some(60),
Some(30),
Some(50),
Some(30),
Some(60),
Some(130),
Some(50),
]
)
} | rust_cleaned_test_functions.jsonl/13807 | {
"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,
49646,
43840,
83534,
368,
341,
262,
1077,
6764,
284,
6764,
0,
341,
286,
330,
7975,
1,
589,
44590,
16,
11,
220,
16,
11,
220,
17,
11,
220,
17,
11,
220,
18,
1259,
286,
330,
2257,
1,
589,
4459... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_replica_read_on_stale_peer() {
let mut cluster = new_node_cluster(0, 3);
configure_for_lease_read(&mut cluster, Some(50), Some(30));
let pd_client = Arc::clone(&cluster.pd_client);
pd_client.disable_default_operator();
cluster.run();
let region = pd_client.get_region(b"k1").unwrap();
let peer_on_store1 = find_peer(®ion, 1).unwrap().to_owned();
cluster.must_transfer_leader(region.get_id(), peer_on_store1);
let peer_on_store3 = find_peer(®ion, 3).unwrap().to_owned();
cluster.must_put(b"k1", b"v1");
must_get_equal(&cluster.get_engine(3), b"k1", b"v1");
let filter = Box::new(
RegionPacketFilter::new(region.get_id(), 3)
.direction(Direction::Recv)
.msg_type(MessageType::MsgAppend),
);
cluster.sim.wl().add_recv_filter(3, filter);
cluster.must_put(b"k2", b"v2");
let resp1_ch = async_read_on_peer(&mut cluster, peer_on_store3, region, b"k2", true, true);
// must be timeout
assert!(resp1_ch.recv_timeout(Duration::from_micros(100)).is_err());
} | rust_cleaned_test_functions.jsonl/100488 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 469
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25533,
15317,
6443,
4470,
1261,
1574,
45159,
368,
341,
262,
1077,
5206,
10652,
284,
501,
5084,
28441,
7,
15,
11,
220,
18,
626,
262,
14411,
5478,
62,
1623,
6443,
2099,
6984,
10652,
11,
4329,
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_ascii_vec() {
let test = &[40u8, 32u8, 59u8];
assert_eq!(test.to_ascii(), v2ascii!([40, 32, 59]));
assert_eq!("( ;".to_ascii(), v2ascii!([40, 32, 59]));
let v = vec![40u8, 32u8, 59u8];
assert_eq!(v.as_slice().to_ascii(), v2ascii!([40, 32, 59]));
assert_eq!("( ;".to_string().as_slice().to_ascii(), v2ascii!([40, 32, 59]));
assert_eq!("abCDef&?#".to_ascii().to_lower().into_string(), "abcdef&?#".to_string());
assert_eq!("abCDef&?#".to_ascii().to_upper().into_string(), "ABCDEF&?#".to_string());
assert_eq!("".to_ascii().to_lower().into_string(), "".to_string());
assert_eq!("YMCA".to_ascii().to_lower().into_string(), "ymca".to_string());
assert_eq!("abcDEFxyz:.;".to_ascii().to_upper().into_string(), "ABCDEFXYZ:.;".to_string());
assert!("aBcDeF&?#".to_ascii().eq_ignore_case("AbCdEf&?#".to_ascii()));
assert!("".is_ascii());
assert!("a".is_ascii());
assert!(!"\u2009".is_ascii());
} | rust_cleaned_test_functions.jsonl/8252 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 548
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
50238,
13251,
368,
341,
286,
1077,
1273,
284,
44590,
19,
15,
84,
23,
11,
220,
18,
17,
84,
23,
11,
220,
20,
24,
84,
23,
935,
286,
2060,
10714,
10297,
1944,
2389,
50238,
1507,
348,
17,
23324,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_validate_subinterfaces() {
let fake_factory_path = "/fake_factory_path";
let test_config = create_test_config("/doesntmatter", fake_factory_path, "/doesntmatter");
// Should not fail because `dhcp_client` is set to true.
let test_subif = vec![Subinterface {
admin_state: Some(AdminState::Up),
ipv4: Some(IpAddressConfig {
addresses: vec![IpAddress { dhcp_client: Some(true), cidr_address: None }],
dhcp_server: None,
}),
ipv6: None,
}];
match test_config.validate_subinterfaces(&test_subif) {
Ok(_) => (),
Err(e) => panic!("Got unexpected error result: {}", e),
}
// Should fail because `dhcp_client` is set to true and has dhcp server configured.
let test_subif = vec![Subinterface {
admin_state: Some(AdminState::Up),
ipv4: Some(IpAddressConfig {
addresses: vec![IpAddress { dhcp_client: Some(true), cidr_address: None }],
dhcp_server: Some(DhcpServer {
dhcp_pool: DhcpPool {
start: "192.168.2.100".parse().unwrap(),
end: "192.168.2.254".parse().unwrap(),
lease_time: "1d".to_string(),
},
enabled: true,
static_ip_allocations: None,
}),
}),
ipv6: None,
}];
match test_config.validate_subinterfaces(&test_subif) {
Ok(_) => panic!("should be invalid"),
Err(_) => (),
}
let test_subif = vec![Subinterface {
admin_state: Some(AdminState::Up),
ipv4: Some(IpAddressConfig {
addresses: vec![IpAddress {
dhcp_client: Some(false),
cidr_address: Some(CidrAddress {
ip: NetIpAddr("127.0.0.1".parse().unwrap()),
prefix_length: 32,
}),
}],
dhcp_server: None,
}),
ipv6: None,
}];
match test_config.validate_subinterfaces(&test_subif) {
Ok(_) => (),
Err(e) => panic!("Got unexpected error result: {}", e),
}
let test_subif = vec![Subinterface {
admin_state: Some(AdminState::Up),
ipv4: Some(IpAddressConfig {
addresses: vec![IpAddress { dhcp_client: Some(false), cidr_address: None }],
dhcp_server: None,
}),
ipv6: None,
}];
match test_config.validate_subinterfaces(&test_subif) {
Err(error::NetworkManager::Config(error::Config::Malformed { msg: _ })) => (),
Err(e) => panic!("Got unexpected error result: {}", e),
Ok(_) => panic!("Got unexpected 'Ok' result!"),
}
let test_subif = vec![Subinterface {
admin_state: Some(AdminState::Up),
ipv4: Some(IpAddressConfig {
addresses: vec![IpAddress {
dhcp_client: None,
cidr_address: Some(CidrAddress {
ip: NetIpAddr("127.0.0.1".parse().unwrap()),
prefix_length: 32,
}),
}],
dhcp_server: None,
}),
ipv6: None,
}];
match test_config.validate_subinterfaces(&test_subif) {
Ok(_) => (),
Err(e) => panic!("Got unexpected error result: {}", e),
}
// and dhcp server.
let test_subif = vec![Subinterface {
admin_state: Some(AdminState::Up),
ipv4: Some(IpAddressConfig {
addresses: vec![IpAddress {
dhcp_client: None,
cidr_address: Some("192.168.2.1/24".parse().unwrap()),
}],
dhcp_server: Some(DhcpServer {
dhcp_pool: DhcpPool {
start: "192.168.2.100".parse().unwrap(),
end: "192.168.2.254".parse().unwrap(),
lease_time: "1d".to_string(),
},
enabled: true,
static_ip_allocations: None,
}),
}),
ipv6: None,
}];
match test_config.validate_subinterfaces(&test_subif) {
Ok(_) => (),
Err(e) => panic!("Got unexpected error result: {}", e),
}
// but dhcp server pool misconfiguredr.
let test_subif = vec![Subinterface {
admin_state: Some(AdminState::Up),
ipv4: Some(IpAddressConfig {
addresses: vec![IpAddress {
dhcp_client: None,
cidr_address: Some(CidrAddress {
ip: NetIpAddr("192.168.2.1".parse().unwrap()),
prefix_length: 30,
}),
}],
dhcp_server: Some(DhcpServer {
dhcp_pool: DhcpPool {
start: "192.168.2.100".parse().unwrap(),
end: "192.168.2.254".parse().unwrap(),
lease_time: "1d".to_string(),
},
enabled: true,
static_ip_allocations: None,
}),
}),
ipv6: None,
}];
match test_config.validate_subinterfaces(&test_subif) {
Err(error::NetworkManager::Config(error::Config::FailedToValidateConfig {
path: _,
error: _,
})) => (),
Err(e) => panic!("Got unexpected error result: {}", e),
Ok(_) => panic!("Got unexpected 'Ok' result!"),
}
// Should fail because both dhcp_client and ip/prefix_len are None.
let test_subif = vec![Subinterface {
admin_state: Some(AdminState::Up),
ipv4: Some(IpAddressConfig {
addresses: vec![IpAddress { dhcp_client: None, cidr_address: None }],
dhcp_server: None,
}),
ipv6: None,
}];
match test_config.validate_subinterfaces(&test_subif) {
Err(error::NetworkManager::Config(error::Config::Malformed { msg: _ })) => (),
Err(e) => panic!("Got unexpected error result: {}", e),
Ok(_) => panic!("Got unexpected 'Ok' result!"),
}
} | rust_cleaned_test_functions.jsonl/83806 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3737
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
5228,
28965,
368,
341,
286,
1077,
12418,
24269,
2638,
284,
3521,
30570,
24269,
2638,
876,
286,
1077,
1273,
5332,
284,
1855,
4452,
5332,
4283,
27057,
406,
58965,
497,
12418,
24269,
2638,
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... | 9 |
#[test]
fn test_non_native_linear_gate() -> Result<(), PlonkError> {
// use bls12-377 base field to prove rescue over jubjub377 base field
test_non_native_linear_gate_helper::<FqEd377, Fq377>()
} | rust_cleaned_test_functions.jsonl/4910 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 97
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21637,
44494,
40674,
54798,
368,
1464,
5714,
68843,
1818,
263,
74,
1454,
29,
341,
286,
442,
990,
1501,
82,
16,
17,
12,
18,
22,
22,
2331,
2070,
311,
12118,
17186,
916,
96343,
73,
392,
18,
22,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cast_range_int_min() {
assert_eq!(int::min_value.to_int(), Some(int::min_value as int));
assert_eq!(int::min_value.to_i8(), None);
assert_eq!(int::min_value.to_i16(), None);
assert_eq!(int::min_value.to_i64(), Some(int::min_value as i64));
assert_eq!(int::min_value.to_uint(), None);
assert_eq!(int::min_value.to_u8(), None);
assert_eq!(int::min_value.to_u16(), None);
assert_eq!(int::min_value.to_u32(), None);
assert_eq!(int::min_value.to_u64(), None);
#[cfg(target_word_size = "32")]
fn check_word_size() {
assert_eq!(int::min_value.to_i32(), Some(int::min_value as i32));
}
#[cfg(target_word_size = "64")]
fn check_word_size() {
assert_eq!(int::min_value.to_i32(), None);
}
check_word_size();
} | rust_cleaned_test_functions.jsonl/12445 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 473
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5303,
9698,
4042,
7260,
368,
341,
286,
2060,
10714,
10297,
396,
486,
1065,
3142,
2389,
4042,
1507,
220,
4329,
1548,
486,
1065,
3142,
438,
526,
1106,
286,
2060,
10714,
10297,
396,
486,
1065,
3142,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_configuration_from_config() {
let argv = vec!["lsd"];
let matches = app::build().get_matches_from_safe(argv).unwrap();
let mut c = Config::with_none();
c.ignore_globs = Some(vec![".git".into()].into());
assert!(match IgnoreGlobs::configure_from(&matches, &c) {
Ok(_) => true,
_ => false,
});
} | rust_cleaned_test_functions.jsonl/62336 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 193
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35726,
5673,
5332,
368,
341,
286,
1077,
10213,
284,
7486,
0,
1183,
4730,
67,
6332,
286,
1077,
9071,
284,
906,
486,
5834,
1005,
455,
38344,
5673,
34067,
15329,
568,
15454,
543,
286,
1077,
5206,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_date_email() {
let (_, mut ucmd) = at_and_ucmd!();
let result = ucmd.arg("--rfc-email").run();
assert!(result.success);
} | rust_cleaned_test_functions.jsonl/25486 | {
"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,
4164,
9172,
368,
341,
262,
1077,
39464,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
1077,
1102,
284,
575,
8710,
21186,
21549,
8052,
66,
42117,
1827,
6108,
543,
262,
2060,
10297... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_next_account_infos() {
let k1 = Pubkey::new_unique();
let k2 = Pubkey::new_unique();
let k3 = Pubkey::new_unique();
let k4 = Pubkey::new_unique();
let k5 = Pubkey::new_unique();
let l1 = &mut 0;
let l2 = &mut 0;
let l3 = &mut 0;
let l4 = &mut 0;
let l5 = &mut 0;
let d1 = &mut [0u8];
let d2 = &mut [0u8];
let d3 = &mut [0u8];
let d4 = &mut [0u8];
let d5 = &mut [0u8];
let infos = &[
AccountInfo::new(&k1, false, false, l1, d1, &k1, false, 0),
AccountInfo::new(&k2, false, false, l2, d2, &k2, false, 0),
AccountInfo::new(&k3, false, false, l3, d3, &k3, false, 0),
AccountInfo::new(&k4, false, false, l4, d4, &k4, false, 0),
AccountInfo::new(&k5, false, false, l5, d5, &k5, false, 0),
];
let infos_iter = &mut infos.iter();
let info1 = next_account_info(infos_iter).unwrap();
let info2_3_4 = next_account_infos(infos_iter, 3).unwrap();
let info5 = next_account_info(infos_iter).unwrap();
assert_eq!(k1, *info1.key);
assert_eq!(k2, *info2_3_4[0].key);
assert_eq!(k3, *info2_3_4[1].key);
assert_eq!(k4, *info2_3_4[2].key);
assert_eq!(k5, *info5.key);
} | rust_cleaned_test_functions.jsonl/26261 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 744
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11257,
13500,
47779,
368,
341,
286,
1077,
595,
16,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
595,
17,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
595,
18,
284,
22611,
792,
486,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_conf_state_from_region() {
let mut region = metapb::Region::new();
let mut peer = metapb::Peer::new();
peer.set_id(1);
region.mut_peers().push(peer);
let mut peer = metapb::Peer::new();
peer.set_id(2);
peer.set_is_learner(true);
region.mut_peers().push(peer);
let cs = conf_state_from_region(®ion);
assert!(cs.get_nodes().contains(&1));
assert!(cs.get_learners().contains(&2));
} | rust_cleaned_test_functions.jsonl/10720 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 246
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16059,
4387,
5673,
20627,
368,
341,
286,
1077,
5206,
5537,
284,
2270,
391,
65,
486,
14091,
486,
931,
1428,
286,
1077,
5206,
14397,
284,
2270,
391,
65,
486,
30888,
486,
931,
543,
286,
14397,
980,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_orphan_rate_estimation_overflow() {
let cellbase = TransactionBuilder::default()
.witness(Script::default().into_witness())
.input(CellInput::new(OutPoint::null(), 0))
.build();
let dao = genesis_dao_data(vec![&cellbase]).unwrap();
let genesis_block = BlockBuilder::default()
.compact_target(difficulty_to_compact(U256::from(1000u64)).pack())
.transaction(cellbase)
.dao(dao)
.build();
let mut consensus = ConsensusBuilder::default()
.genesis_block(genesis_block)
.build();
consensus.genesis_epoch_ext.set_length(400);
// last_difficulty 1000
// last_epoch_length 400
// epoch_duration_target 14400
// orphan_rate_target 1/40
// last_duration 798000
// last_uncles_count 150
let (_chain_controller, shared, _genesis, _last_epoch) =
prepare_context_chain(consensus.clone(), 151, 2_000_000);
{
let snapshot = shared.snapshot();
let tip = snapshot.tip_header().clone();
let total_uncles_count = snapshot
.get_block_ext(&tip.hash())
.unwrap()
.total_uncles_count;
assert_eq!(total_uncles_count, 150);
let epoch = snapshot
.next_epoch_ext(shared.consensus(), snapshot.epoch_ext(), &tip)
.unwrap();
assert_eq!(epoch.length(), 480, "epoch length {}", epoch.length());
assert_eq!(
epoch.compact_target(),
difficulty_to_compact(U256::from(29u64)),
"epoch compact_target {}",
epoch.compact_target()
);
}
} | rust_cleaned_test_functions.jsonl/105200 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 764
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8734,
9943,
9246,
18583,
5465,
79073,
368,
341,
262,
1077,
2779,
3152,
284,
17869,
3297,
486,
2258,
741,
286,
659,
86,
8091,
3759,
1228,
486,
2258,
1005,
18122,
1670,
8091,
2398,
286,
659,
1355,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_range_inclusive_nth_back() {
assert_eq!((10..=15).nth_back(0), Some(15));
assert_eq!((10..=15).nth_back(1), Some(14));
assert_eq!((10..=15).nth_back(5), Some(10));
assert_eq!((10..=15).nth_back(6), None);
assert_eq!((-120..=80_i8).nth_back(200), Some(-120));
let mut exhausted_via_next_back = 10_u8..=20;
while exhausted_via_next_back.next_back().is_some() {}
let mut r = 10_u8..=20;
assert_eq!(r.nth_back(2), Some(18));
assert_eq!(r, 10..=17);
assert_eq!(r.nth_back(2), Some(15));
assert_eq!(r, 10..=14);
assert_eq!(r.is_empty(), false);
assert_eq!(ExactSizeIterator::is_empty(&r), false);
assert_eq!(r.nth_back(10), None);
assert_eq!(r.is_empty(), true);
assert_eq!(r, exhausted_via_next_back);
assert_eq!(ExactSizeIterator::is_empty(&r), true);
} | rust_cleaned_test_functions.jsonl/70239 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 407
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9698,
1243,
8336,
78342,
3895,
368,
341,
262,
2060,
10714,
0,
1188,
16,
15,
496,
28,
16,
20,
568,
51738,
3895,
7,
15,
701,
4329,
7,
16,
20,
1106,
262,
2060,
10714,
0,
1188,
16,
15,
496,
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... | 2 |
#[test]
fn test_cast_optional_1() {
let elem: Element = XML.parse().unwrap();
let sub1 = super::traverse(&elem, &["Containers", "Container"], false).unwrap();
{
let num = super::cast_optional::<u64>(sub1[0], &["Properties", "SomeNumber"]).unwrap();
assert_eq!(Some(256u64), num);
}
{
let num2 = super::cast_optional::<u64>(sub1[1], &["Properties", "SomeNumber"]).unwrap();
assert_eq!(None, num2);
}
} | rust_cleaned_test_functions.jsonl/124947 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 250
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5303,
74644,
62,
16,
368,
341,
286,
1077,
11750,
25,
8543,
284,
11874,
4632,
1005,
15454,
1428,
286,
1077,
1186,
16,
284,
2256,
486,
376,
22439,
2099,
18871,
11,
609,
1183,
74632,
497,
330,
4502... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_timer_with_looping_wheel() {
let poll = Poll::new().unwrap();
let mut events = Events::with_capacity(1024);
let mut timer = timer::Builder::default().num_slots(2).build();
poll.register(&timer, Token(0), Ready::readable(), PollOpt::edge())
.unwrap();
const TOKENS: &[&str] = &["hello", "world", "some", "thing"];
for (i, msg) in TOKENS.iter().enumerate() {
timer.set_timeout(Duration::from_millis(500 * (i as u64 + 1)), msg);
}
for msg in TOKENS {
let elapsed = elapsed(|| {
let num = poll.poll(&mut events, None).unwrap();
assert_eq!(num, 1);
let event = events.iter().next().unwrap();
assert_eq!(Token(0), event.token());
assert_eq!(Ready::readable(), event.readiness());
});
assert!(
is_about(500, elapsed),
"actual={:?}; msg={:?}",
elapsed,
msg
);
assert_eq!(Some(msg), timer.poll());
assert_eq!(None, timer.poll());
}
} | rust_cleaned_test_functions.jsonl/95273 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 497
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16255,
6615,
17198,
287,
82012,
368,
341,
262,
1077,
7085,
284,
24385,
486,
931,
1005,
15454,
543,
262,
1077,
5206,
4357,
284,
17627,
486,
4197,
35603,
7,
16,
15,
17,
19,
317,
262,
1077,
5206,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_from_get_assertion_options() {
let cbor_get_assertion = cbor_map! {
"up" => true,
"uv" => false,
};
let get_assertion = GetAssertionOptions::try_from(cbor_get_assertion);
let expected_get_assertion = GetAssertionOptions {
up: true,
uv: false,
};
assert_eq!(get_assertion, Ok(expected_get_assertion));
} | rust_cleaned_test_functions.jsonl/49011 | {
"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,
5673,
3062,
16553,
290,
8743,
368,
341,
286,
1077,
272,
9368,
3062,
16553,
290,
284,
272,
9368,
5376,
0,
341,
310,
330,
454,
1,
589,
830,
345,
310,
330,
12058,
1,
589,
895,
345,
286,
2605,
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_atoibm_and_lcase_conv_spec_test() {
new_ucmd!()
.args(&["conv=ibm,lcase"])
.pipe_in_fixture("seq-byte-values-b632a992d3aed5d8d1a59cc5a5a455ba.test")
.succeeds()
.stdout_is_fixture_bytes("ucase-ibm.test");
} | rust_cleaned_test_functions.jsonl/99855 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 151
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3752,
78,
579,
76,
8378,
907,
5638,
22716,
13594,
4452,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
12027,
28,
579,
76,
22206,
5638,
14108,
286,
659,
13768,
1243,
74409,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_csv() {
let csv = r#"
pl,version,speed,vm,size,compiler
rust,1,fast,false,small,rustc
haskel,1,fast,false,small,ghc
c,99,fast,false,small,clang
java,8,medium,true,large,jdk
"#;
let columns = vec![
DataColumn {
name: "pl".into(),
data_type: Type::Text,
description: None,
tags: vec![],
is_primary: false,
},
DataColumn {
name: "compiler".into(),
data_type: Type::Text,
description: None,
tags: vec![],
is_primary: false,
},
DataColumn {
name: "speed".into(),
data_type: Type::Text,
description: None,
tags: vec![],
is_primary: false,
},
DataColumn {
name: "vm".into(),
data_type: Type::Text,
description: None,
tags: vec![],
is_primary: false,
},
DataColumn {
name: "size".into(),
data_type: Type::Text,
description: None,
tags: vec![],
is_primary: false,
},
DataColumn {
name: "version".into(),
data_type: Type::Int,
description: None,
tags: vec![],
is_primary: false,
},
];
let dataview = DataTable::from_csv(columns, csv);
assert_eq!(dataview.columns.len(), 6);
assert_eq!(dataview.columns[0].name, "pl");
assert_eq!(dataview.rows[0][0], Value::Text("rust".to_string()));
assert_eq!(dataview.rows[1][0], Value::Text("haskel".to_string()));
assert_eq!(dataview.columns[2].name, "speed");
assert_eq!(dataview.rows[0][2], Value::Text("fast".to_string()));
assert_eq!(dataview.rows[1][2], Value::Text("fast".to_string()));
} | rust_cleaned_test_functions.jsonl/2287 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1214
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
14020,
368,
341,
286,
1077,
13147,
284,
435,
2,
698,
500,
11,
4366,
10671,
4508,
11,
7338,
35591,
11,
33620,
198,
35788,
11,
16,
11,
9349,
23367,
11,
9004,
15883,
590,
66,
198,
71,
1073,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cancel_issue_not_expired_fails() {
run_test(|| {
ext::vault_registry::get_active_vault_from_id::<Test>
.mock_safe(|_| MockResult::Return(Ok(init_zero_vault(VAULT))));
let issue_id = request_issue_ok(USER, 3, VAULT, 20);
<security::Pallet<Test>>::set_active_block_number(5);
assert_noop!(cancel_issue(USER, &issue_id), TestError::TimeNotExpired,);
})
} | rust_cleaned_test_functions.jsonl/104089 | {
"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,
28895,
53340,
7913,
80221,
761,
6209,
368,
341,
262,
1598,
4452,
79453,
341,
286,
1303,
486,
82983,
50650,
486,
455,
12930,
2273,
945,
5673,
842,
27638,
2271,
397,
310,
659,
16712,
34067,
22428,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_fix_crawler_all_old() {
let fetcher = MockFetcher(|_, _| {
vec![Submission {
id: 30,
..Default::default()
}]
});
let crawler = FixCrawler::new(MockDB, fetcher, CURRENT_TIME);
assert!(block_on(crawler.crawl()).is_ok());
} | rust_cleaned_test_functions.jsonl/74646 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 190
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36060,
666,
33369,
5705,
21108,
368,
341,
286,
1077,
7807,
261,
284,
14563,
97492,
22428,
6878,
85137,
341,
310,
7486,
20703,
86621,
341,
394,
877,
25,
220,
18,
15,
345,
394,
5241,
3675,
486,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_debug() {
let lua_string = String::new_unchecked("");
assert_eq!(
&format!("{:?}", lua_string),
r#"NvimString { data: "", size: 0 }"#
);
let lua_string = String::new_unchecked("nvim");
assert_eq!(
&format!("{:?}", lua_string),
r#"NvimString { data: "nvim", size: 4 }"#
);
} | rust_cleaned_test_functions.jsonl/101290 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15446,
368,
341,
286,
1077,
20357,
3904,
284,
923,
486,
931,
4907,
7549,
56141,
286,
2060,
10714,
33673,
310,
609,
2243,
88928,
25,
52652,
20357,
3904,
1326,
310,
435,
55543,
45,
41194,
703,
314,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_win_by_seven_pairs() {
let test_str = "1122m3344p5566s1z 1z";
let test = Hand::from(test_str);
let test_analyzer = HandAnalyzer::new(&test).unwrap();
let status = Status::new();
let settings = Settings::new();
assert_eq!(
check_seven_pairs(&test_analyzer, &status, &settings).unwrap(),
("七対子", true, 2)
);
} | rust_cleaned_test_functions.jsonl/5170 | {
"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,
25672,
3710,
3453,
1037,
36430,
368,
341,
286,
1077,
1273,
2895,
284,
330,
16,
16,
17,
17,
76,
18,
18,
19,
19,
79,
20,
20,
21,
21,
82,
16,
89,
220,
16,
89,
876,
286,
1077,
1273,
284,
853... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_encode_chain_id() -> Result<(), failure::Error> {
let decoded = HashType::ChainId.bytes_to_string(&hex::decode("8eceda2f")?);
let expected = "NetXgtSLGNJvNye";
assert_eq!(expected, decoded);
Ok(())
} | rust_cleaned_test_functions.jsonl/65918 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 123
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
30583,
842,
368,
1464,
5714,
68843,
7901,
486,
1454,
29,
341,
286,
1077,
29213,
284,
6531,
929,
486,
18837,
764,
42697,
2346,
3904,
2099,
17308,
486,
18196,
445,
23,
757,
13830,
17,
69,
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... | 2 |
#[test]
fn test_to_string() {
assert_eq!(Decimal::zero().to_string(), "0");
assert_eq!(Decimal::ulp().to_string(), "0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001");
assert_eq!(Decimal::one().to_string(), "1");
assert_eq!(Decimal::max().to_string(), "17976931348623159077293051907890247336179769789423065727343008115773267580550096313270847732240753602112011387987139335765878976881441662249284743063947412437776789342486548527630221960124609411945308295208500.5768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137215");
assert_eq!(Decimal::min().to_string(), "-17976931348623159077293051907890247336179769789423065727343008115773267580550096313270847732240753602112011387987139335765878976881441662249284743063947412437776789342486548527630221960124609411945308295208500.5768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137215");
assert_eq!(
Decimal::from(u64::max_value()).to_string(),
"18446744073709551615"
);
} | rust_cleaned_test_functions.jsonl/87130 | {
"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,
2346,
3904,
368,
341,
262,
2060,
10714,
10297,
11269,
486,
14154,
1005,
983,
3904,
1507,
330,
15,
797,
262,
2060,
10714,
10297,
11269,
486,
12840,
1005,
983,
3904,
1507,
330,
15,
13,
15,
15,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_store_flush_load_cached() {
let mut db = AccountsDB::new(Vec::new(), &ClusterType::Development);
db.caching_enabled = true;
let key = Pubkey::default();
let account0 = Account::new(1, 0, &key);
let slot = 0;
db.store_cached(slot, &[(&key, &account0)]);
db.mark_slot_frozen(slot);
// the account
db.flush_accounts_cache(true, None);
let ancestors = vec![(slot, 1)].into_iter().collect();
assert_eq!(
db.load_slow(&ancestors, &key),
Some((account0.clone(), slot))
);
// Add root then flush
db.add_root(slot);
db.flush_accounts_cache(true, None);
assert_eq!(db.load_slow(&HashMap::new(), &key), Some((account0, slot)));
} | rust_cleaned_test_functions.jsonl/60925 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 392
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14809,
39213,
12411,
64369,
368,
341,
286,
1077,
5206,
2927,
284,
40655,
3506,
486,
931,
49923,
486,
931,
1507,
609,
28678,
929,
486,
39419,
317,
286,
2927,
520,
11829,
18220,
284,
830,
280,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_css_color_11() {
assert_eq!(parse_css_color("rgba(123, 36, 92, 0.375"), Err(CssColorParseError::UnclosedColor("rgba(123, 36, 92, 0.375")));
} | rust_cleaned_test_functions.jsonl/37106 | {
"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,
21039,
25924,
6714,
62,
16,
16,
368,
341,
286,
2060,
10714,
10297,
6400,
25924,
6714,
445,
20400,
7,
16,
17,
18,
11,
220,
18,
21,
11,
220,
24,
17,
11,
220,
15,
13,
18,
22,
20,
3975,
15495,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_locator_new_from_uri() {
let manufacturer = Manufacturer::Ledger;
let pubkey = Pubkey::new_unique();
let pubkey_str = pubkey.to_string();
// usb://ledger/{PUBKEY}?key=0/0
let mut builder = URIReferenceBuilder::new();
builder
.try_scheme(Some("usb"))
.unwrap()
.try_authority(Some(Manufacturer::Ledger.as_ref()))
.unwrap()
.try_path(pubkey_str.as_str())
.unwrap()
.try_query(Some("key=0/0"))
.unwrap();
let uri = builder.build().unwrap();
let expect = Locator {
manufacturer,
pubkey: Some(pubkey),
};
assert_eq!(Locator::new_from_uri(&uri), Ok(expect));
// usb://ledger/{PUBKEY}
let mut builder = URIReferenceBuilder::new();
builder
.try_scheme(Some("usb"))
.unwrap()
.try_authority(Some(Manufacturer::Ledger.as_ref()))
.unwrap()
.try_path(pubkey_str.as_str())
.unwrap();
let uri = builder.build().unwrap();
let expect = Locator {
manufacturer,
pubkey: Some(pubkey),
};
assert_eq!(Locator::new_from_uri(&uri), Ok(expect));
// usb://ledger
let mut builder = URIReferenceBuilder::new();
builder
.try_scheme(Some("usb"))
.unwrap()
.try_authority(Some(Manufacturer::Ledger.as_ref()))
.unwrap()
.try_path("")
.unwrap();
let uri = builder.build().unwrap();
let expect = Locator {
manufacturer,
pubkey: None,
};
assert_eq!(Locator::new_from_uri(&uri), Ok(expect));
// usb://ledger/
let mut builder = URIReferenceBuilder::new();
builder
.try_scheme(Some("usb"))
.unwrap()
.try_authority(Some(Manufacturer::Ledger.as_ref()))
.unwrap()
.try_path("/")
.unwrap();
let uri = builder.build().unwrap();
let expect = Locator {
manufacturer,
pubkey: None,
};
assert_eq!(Locator::new_from_uri(&uri), Ok(expect));
// bad-scheme://ledger
let mut builder = URIReferenceBuilder::new();
builder
.try_scheme(Some("bad-scheme"))
.unwrap()
.try_authority(Some(Manufacturer::Ledger.as_ref()))
.unwrap()
.try_path("")
.unwrap();
let uri = builder.build().unwrap();
assert_eq!(
Locator::new_from_uri(&uri),
Err(LocatorError::UnimplementedScheme)
);
// usb://bad-manufacturer
let mut builder = URIReferenceBuilder::new();
builder
.try_scheme(Some("usb"))
.unwrap()
.try_authority(Some("bad-manufacturer"))
.unwrap()
.try_path("")
.unwrap();
let uri = builder.build().unwrap();
assert_eq!(
Locator::new_from_uri(&uri),
Err(LocatorError::ManufacturerError(ManufacturerError))
);
// usb://ledger/bad-pubkey
let mut builder = URIReferenceBuilder::new();
builder
.try_scheme(Some("usb"))
.unwrap()
.try_authority(Some(Manufacturer::Ledger.as_ref()))
.unwrap()
.try_path("bad-pubkey")
.unwrap();
let uri = builder.build().unwrap();
assert_eq!(
Locator::new_from_uri(&uri),
Err(LocatorError::PubkeyError(ParsePubkeyError::Invalid))
);
} | rust_cleaned_test_functions.jsonl/35017 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1987
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75344,
5921,
5673,
15572,
368,
341,
286,
1077,
13963,
284,
34451,
486,
60850,
1389,
280,
286,
1077,
95116,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
95116,
2895,
284,
95116,
2389,
3904,
14... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_custom_fact() {
let person = Person::builder()
.fact(
Fact::builder(FactType::Custom("data:,Eagle%20Scout".into()))
.place(PlaceReference::builder().original("...").build())
.date(Date::new(Some("..."), None))
.build(),
)
.build();
let gx = Gedcomx::builder().person(person).build();
common::assert_matching_json(&gx, "custom_facts");
common::assert_matching_xml(&gx, "custom_facts");
} | rust_cleaned_test_functions.jsonl/106994 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 237
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15875,
47805,
368,
341,
262,
1077,
1697,
284,
7357,
486,
17850,
741,
286,
659,
33110,
1006,
310,
36712,
486,
17850,
7832,
531,
929,
486,
10268,
445,
691,
41239,
36,
32674,
4,
17,
15,
3326,
411,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_generics() {
use capnp::text;
use test_capnp::{test_generics, test_all_types};
let mut message = message::Builder::new_default();
let mut root: test_generics::Builder<test_all_types::Owned, text::Owned> = message.init_root();
::test_util::init_test_message(root.reborrow().get_foo().unwrap());
root.reborrow().get_dub().unwrap().set_foo("Hello").unwrap();
{
let mut bar: ::capnp::primitive_list::Builder<u8> = root.reborrow().get_dub().unwrap().initn_bar(1);
bar.set(0, 11);
}
{
let mut rev_bar = root.reborrow().get_rev().unwrap().get_bar().unwrap();
rev_bar.set_int8_field(111);
let mut bool_list = rev_bar.init_bool_list(2);
bool_list.set(0, false);
bool_list.set(1, true);
}
::test_util::CheckTestMessage::check_test_message(root.reborrow().get_foo().unwrap());
let root_reader = root.into_reader();
::test_util::CheckTestMessage::check_test_message(root_reader.reborrow().get_foo().unwrap());
let dub_reader = root_reader.get_dub().unwrap();
assert_eq!("Hello", dub_reader.get_foo().unwrap());
let bar_reader = dub_reader.get_bar().unwrap();
assert_eq!(bar_reader.len(), 1);
assert_eq!(bar_reader.get(0), 11);
} | rust_cleaned_test_functions.jsonl/55855 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 643
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71963,
1211,
368,
341,
286,
990,
2062,
6199,
486,
1318,
280,
286,
990,
1273,
16388,
6199,
22964,
1944,
71963,
1211,
11,
1273,
5705,
9763,
2440,
286,
1077,
5206,
1943,
284,
1943,
486,
3297,
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_members_unsupported_map() {
assert_eq!(UNSUPPORTED_MAP.get("__callstatic"), Some(&"__callStatic"));
assert!(!UNSUPPORTED_MAP.contains_key("__callStatic"));
} | rust_cleaned_test_functions.jsonl/5045 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 90
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30397,
4907,
18216,
5376,
368,
341,
286,
2060,
10714,
10297,
88673,
61140,
16306,
670,
58406,
6659,
1978,
3975,
4329,
2099,
1,
563,
6659,
11690,
4010,
286,
2060,
0,
3471,
88673,
61140,
16306,
8786,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_foreign_fn() {
let interp = Interpreter::new();
let scope = interp.scope();
ketos_fn!{ scope => "new-my-type" => fn new_my_type(a: i32) -> MyType }
ketos_fn!{ scope => "get-value" => fn get_value(a: &MyType) -> i32 }
ketos_fn!{ scope => "add-pairs" => fn add_pairs(a: (i32, i32), b: (i32, i32)) -> (i32, i32) }
ketos_fn!{ scope => "hello" => fn hello(s: &str) -> String }
assert_eq!(eval(&interp, "(new-my-type 1)").unwrap(), "MyType { a: 1 }");
assert_eq!(eval(&interp, "(get-value (new-my-type 2))").unwrap(), "2");
assert_eq!(eval(&interp, "(add-pairs '(1 2) '(3 4))").unwrap(), "(4 6)");
assert_eq!(eval(&interp, r#"(hello "world")"#).unwrap(), r#""Hello, world!""#);
assert_matches!(eval(&interp, "(add-pairs '(1 2 0) '(3 4))").unwrap_err(),
Error::ExecError(ExecError::TypeError{..}));
} | rust_cleaned_test_functions.jsonl/112662 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 393
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
78983,
15246,
368,
341,
262,
1077,
47271,
284,
82493,
486,
931,
543,
262,
1077,
6891,
284,
47271,
48371,
1428,
262,
31281,
436,
15246,
0,
90,
6891,
589,
330,
931,
61496,
10604,
1,
589,
5168,
501... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_local_cluster_start_and_exit() {
morgan_logger::setup();
let num_nodes = 1;
let cluster = LocalCluster::new_with_equal_stakes(num_nodes, 100, 3);
assert_eq!(cluster.fullnodes.len(), num_nodes);
assert_eq!(cluster.replicators.len(), 0);
} | rust_cleaned_test_functions.jsonl/106469 | {
"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,
13564,
28441,
4906,
8378,
16880,
368,
341,
286,
296,
8462,
27413,
486,
15188,
543,
286,
1077,
1629,
14896,
284,
220,
16,
280,
286,
1077,
10652,
284,
8774,
28678,
486,
931,
6615,
11478,
1261,
2050,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unified_disabled() {
// Allow invalid yatp config when yatp is not used.
let unified = UnifiedReadPoolConfig {
min_thread_count: 0,
max_thread_count: 0,
stack_size: ReadableSize::mb(0),
max_tasks_per_worker: 0,
};
assert!(unified.validate().is_err());
let storage = StorageReadPoolConfig {
use_unified_pool: Some(false),
..Default::default()
};
assert!(storage.validate().is_ok());
let coprocessor = CoprReadPoolConfig {
use_unified_pool: Some(false),
..Default::default()
};
assert!(coprocessor.validate().is_ok());
let cfg = ReadPoolConfig {
unified,
storage,
coprocessor,
};
assert!(!cfg.is_unified_pool_enabled());
assert!(cfg.validate().is_ok());
// Storage and coprocessor config must be valid when yatp is not used.
let unified = UnifiedReadPoolConfig::default();
assert!(unified.validate().is_ok());
let storage = StorageReadPoolConfig {
use_unified_pool: Some(false),
high_concurrency: 0,
..Default::default()
};
assert!(storage.validate().is_err());
let coprocessor = CoprReadPoolConfig {
use_unified_pool: Some(false),
..Default::default()
};
let invalid_cfg = ReadPoolConfig {
unified,
storage,
coprocessor,
};
assert!(!invalid_cfg.is_unified_pool_enabled());
assert!(invalid_cfg.validate().is_err());
} | rust_cleaned_test_functions.jsonl/2140 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 830
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
1870,
51401,
368,
341,
286,
442,
26530,
8318,
131454,
79,
2193,
979,
131454,
79,
374,
537,
1483,
624,
286,
1077,
42690,
284,
72434,
4418,
10551,
2648,
341,
310,
1308,
10814,
3180,
25,
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_page() {
let data_page = Page::DataPage {
buf: ByteBufferPtr::new(vec![0, 1, 2]),
num_values: 10,
encoding: Encoding::PLAIN,
def_level_encoding: Encoding::RLE,
rep_level_encoding: Encoding::RLE,
statistics: Some(Statistics::int32(Some(1), Some(2), None, 1, true)),
};
assert_eq!(data_page.page_type(), PageType::DATA_PAGE);
assert_eq!(data_page.buffer().data(), vec![0, 1, 2].as_slice());
assert_eq!(data_page.num_values(), 10);
assert_eq!(data_page.encoding(), Encoding::PLAIN);
assert_eq!(
data_page.statistics(),
Some(&Statistics::int32(Some(1), Some(2), None, 1, true))
);
let data_page_v2 = Page::DataPageV2 {
buf: ByteBufferPtr::new(vec![0, 1, 2]),
num_values: 10,
encoding: Encoding::PLAIN,
num_nulls: 5,
num_rows: 20,
def_levels_byte_len: 30,
rep_levels_byte_len: 40,
is_compressed: false,
statistics: Some(Statistics::int32(Some(1), Some(2), None, 1, true)),
};
assert_eq!(data_page_v2.page_type(), PageType::DATA_PAGE_V2);
assert_eq!(data_page_v2.buffer().data(), vec![0, 1, 2].as_slice());
assert_eq!(data_page_v2.num_values(), 10);
assert_eq!(data_page_v2.encoding(), Encoding::PLAIN);
assert_eq!(
data_page_v2.statistics(),
Some(&Statistics::int32(Some(1), Some(2), None, 1, true))
);
let dict_page = Page::DictionaryPage {
buf: ByteBufferPtr::new(vec![0, 1, 2]),
num_values: 10,
encoding: Encoding::PLAIN,
is_sorted: false,
};
assert_eq!(dict_page.page_type(), PageType::DICTIONARY_PAGE);
assert_eq!(dict_page.buffer().data(), vec![0, 1, 2].as_slice());
assert_eq!(dict_page.num_values(), 10);
assert_eq!(dict_page.encoding(), Encoding::PLAIN);
assert_eq!(dict_page.statistics(), None);
} | rust_cleaned_test_functions.jsonl/98514 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1076
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6129,
368,
341,
286,
1077,
821,
6129,
284,
5755,
486,
1043,
2665,
341,
310,
6607,
25,
50299,
5348,
486,
931,
25592,
20703,
15,
11,
220,
16,
11,
220,
17,
17036,
310,
1629,
9146,
25,
220,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_pop_w() {
match decode_32(0xe8bd47f0) {
Instruction::POP { registers, thumb32 } => {
let elems: Vec<_> = registers.iter().collect();
assert_eq!(
vec![
Reg::R4,
Reg::R5,
Reg::R6,
Reg::R7,
Reg::R8,
Reg::R9,
Reg::R10,
Reg::LR
],
elems
);
assert_eq!(thumb32, true);
}
_ => {
assert!(false);
}
}
} | rust_cleaned_test_functions.jsonl/64816 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 449
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
17061,
1670,
368,
341,
1066,
262,
2432,
16895,
62,
18,
17,
7,
15,
8371,
23,
8940,
19,
22,
69,
15,
8,
341,
286,
29051,
486,
47262,
314,
24740,
11,
24050,
18,
17,
335,
589,
341,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_sandbox_request_uri() {
let builder = PlainNotificationBuilder::new("test");
let payload = builder.build("a_test_id", Default::default());
let client = Client::new(AlpnConnector::new(), None, Endpoint::Sandbox);
let request = client.build_request(payload);
let uri = format!("{}", request.uri());
assert_eq!("https://api.development.push.apple.com/3/device/a_test_id", &uri);
} | rust_cleaned_test_functions.jsonl/109643 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
31536,
7893,
15572,
368,
341,
286,
1077,
7363,
284,
43199,
11196,
3297,
486,
931,
445,
1944,
797,
286,
1077,
7729,
284,
7363,
13239,
445,
64,
4452,
842,
497,
7899,
486,
2258,
1423,
286,
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_systemtime_overflow_seq() {
assert_de_tokens_error::<SystemTime>(
&[
Token::Seq { len: Some(2) },
Token::U64(u64::max_value()),
Token::U32(1_000_000_000),
Token::SeqEnd,
],
"overflow deserializing SystemTime epoch offset",
);
} | rust_cleaned_test_functions.jsonl/129551 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 178
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17687,
1678,
79073,
14486,
368,
341,
262,
2060,
2259,
28838,
4096,
27638,
2320,
1462,
17055,
286,
609,
9640,
310,
9660,
486,
20183,
314,
2422,
25,
4329,
7,
17,
8,
1153,
310,
9660,
486,
52,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_migrate_staking() {
let mut deps = mock_dependencies(&[]);
let msg = InstantiateMsg {
anchor_token: "reward0000".to_string(),
staking_token: "staking0000".to_string(),
distribution_schedule: vec![
(
mock_env().block.time.seconds(),
mock_env().block.time.seconds() + 100,
Uint128::from(1000000u128),
),
(
mock_env().block.time.seconds() + 100,
mock_env().block.time.seconds() + 200,
Uint128::from(10000000u128),
),
],
};
let info = mock_info("addr0000", &[]);
let _res = instantiate(deps.as_mut(), mock_env(), info, msg).unwrap();
// bond 100 tokens
let msg = ExecuteMsg::Receive(Cw20ReceiveMsg {
sender: "addr0000".to_string(),
amount: Uint128::from(100u128),
msg: to_binary(&Cw20HookMsg::Bond {}).unwrap(),
});
let info = mock_info("staking0000", &[]);
let mut env = mock_env();
let _res = execute(deps.as_mut(), env.clone(), info, msg).unwrap();
// 100 seconds is passed
env.block.time = env.block.time.plus_seconds(100);
let info = mock_info("addr0000", &[]);
let msg = ExecuteMsg::Withdraw {};
let res = execute(deps.as_mut(), env.clone(), info, msg).unwrap();
assert_eq!(
res.messages,
vec![SubMsg::new(CosmosMsg::Wasm(WasmMsg::Execute {
contract_addr: "reward0000".to_string(),
msg: to_binary(&Cw20ExecuteMsg::Transfer {
recipient: "addr0000".to_string(),
amount: Uint128::from(1000000u128),
})
.unwrap(),
funds: vec![],
}))]
);
// execute migration after 50 seconds
env.block.time = env.block.time.plus_seconds(50);
deps.querier.with_anc_minter("gov0000".to_string());
let msg = ExecuteMsg::MigrateStaking {
new_staking_contract: "newstaking0000".to_string(),
};
// unauthorized attempt
let info = mock_info("notgov0000", &[]);
let res = execute(deps.as_mut(), env.clone(), info, msg.clone());
match res {
Err(StdError::GenericErr { msg, .. }) => assert_eq!(msg, "unauthorized"),
_ => panic!("Must return unauthorized error"),
}
// successful attempt
let info = mock_info("gov0000", &[]);
let res = execute(deps.as_mut(), env, info, msg).unwrap();
assert_eq!(
res.attributes,
vec![
attr("action", "migrate_staking"),
attr("distributed_amount", "6000000"),
attr("remaining_amount", "5000000")
]
);
assert_eq!(
res.messages,
vec![SubMsg::new(CosmosMsg::Wasm(WasmMsg::Execute {
contract_addr: "reward0000".to_string(),
msg: to_binary(&Cw20ExecuteMsg::Transfer {
recipient: "newstaking0000".to_string(),
amount: Uint128::from(5000000u128),
})
.unwrap(),
funds: vec![],
}))]
);
// query config
let res = query(deps.as_ref(), mock_env(), QueryMsg::Config {}).unwrap();
let config: ConfigResponse = from_binary(&res).unwrap();
assert_eq!(
config,
ConfigResponse {
anchor_token: "reward0000".to_string(),
staking_token: "staking0000".to_string(),
distribution_schedule: vec![
(
mock_env().block.time.seconds(),
mock_env().block.time.seconds() + 100,
Uint128::from(1000000u128)
),
(
mock_env().block.time.seconds() + 100,
mock_env().block.time.seconds() + 150,
Uint128::from(5000000u128)
), // slot was modified
]
}
);
} | rust_cleaned_test_functions.jsonl/2052 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1916
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
34479,
1261,
1765,
368,
341,
262,
1077,
5206,
48178,
284,
7860,
71841,
2099,
1294,
626,
262,
1077,
3750,
284,
32288,
6611,
341,
286,
17105,
6458,
25,
330,
49007,
15,
15,
15,
15,
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... | 2 |
#[test]
fn test_num() -> Result<()> {
test_opt(DhcpOption::Renewal(30), vec![58, 4, 0, 0, 0, 30])?;
Ok(())
} | rust_cleaned_test_functions.jsonl/41167 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 78
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4273,
368,
1464,
5714,
71698,
341,
286,
1273,
15032,
5432,
62169,
5341,
486,
34625,
365,
278,
7,
18,
15,
701,
7486,
20703,
20,
23,
11,
220,
19,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
#[test]
fn test_add_neg_overflow() {
let x = Decimal::new_raw(i128::MIN + 99, 2);
let _y = x + Decimal::NEG_ONE;
} | rust_cleaned_test_functions.jsonl/29257 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 76
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
28209,
79073,
368,
341,
286,
1077,
856,
284,
26728,
486,
931,
16067,
1956,
16,
17,
23,
486,
16413,
488,
220,
24,
24,
11,
220,
17,
317,
286,
1077,
716,
88,
284,
856,
488,
26728,
486,
97... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_password_output_is_not_hex() {
let output_1 = r#"password: "0xE5A4A7E6A0B9""#;
let output_2 = r#"password: 0xE5A4A7E6A0B9"#;
assert_eq!(is_not_hex_output(output_1), true);
assert_eq!(is_not_hex_output(output_2), false);
} | rust_cleaned_test_functions.jsonl/104664 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 155
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10122,
7645,
6892,
7913,
32655,
368,
341,
286,
1077,
2550,
62,
16,
284,
435,
55543,
3833,
25,
330,
15,
12606,
20,
32,
19,
32,
22,
36,
21,
32,
15,
33,
24,
3014,
2,
280,
286,
1077,
2550,
62,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rti(){
let mut r = Register::new();
let mut b = MockBus::new();
r.set_S(0x30);
r.set_Status(0xFF);
r.set_PC(0x0204);
jsr(0x10, &mut r, &mut b);
php(&mut r, &mut b);
rti(&mut r, &mut b);
assert_eq!(r.get_PC(), 0x0204);
assert_eq!(r.get_Status(),0xFF);
} | rust_cleaned_test_functions.jsonl/14232 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 173
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
10251,
3032,
262,
1077,
5206,
435,
284,
8451,
486,
931,
543,
262,
1077,
5206,
293,
284,
14563,
15073,
486,
931,
543,
262,
435,
980,
1098,
7,
15,
87,
18,
15,
317,
262,
435,
980,
36449,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_skiplist4() {
let mut output: Vec<u8> = Vec::new();
let mut skip_list_builder: SkipListBuilder<()> = SkipListBuilder::new(2);
skip_list_builder.insert(2, &()).unwrap();
skip_list_builder.insert(3, &()).unwrap();
skip_list_builder.insert(5, &()).unwrap();
skip_list_builder.insert(7, &()).unwrap();
skip_list_builder.insert(9, &()).unwrap();
skip_list_builder.write::<Vec<u8>>(&mut output).unwrap();
let mut skip_list: SkipList<'_, ()> = SkipList::from(output.as_slice());
assert_eq!(skip_list.next().unwrap(), (2, ()));
skip_list.seek(5);
assert_eq!(skip_list.next().unwrap(), (5, ()));
assert_eq!(skip_list.next().unwrap(), (7, ()));
assert_eq!(skip_list.next().unwrap(), (9, ()));
assert_eq!(skip_list.next(), None);
} | rust_cleaned_test_functions.jsonl/65077 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 407
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
6642,
39934,
19,
368,
341,
286,
1077,
5206,
2550,
25,
11312,
34837,
23,
29,
284,
11312,
486,
931,
543,
286,
1077,
5206,
10706,
2019,
28532,
25,
25784,
852,
3297,
71698,
284,
25784,
852,
329... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invalid_reg_covariance() {
assert!(
GaussianMixtureModel::params(1)
.with_reg_covariance(-1e-6)
.fit(&DatasetBase::from(array![[0.]]))
.is_err(),
"reg_covariance must be positive"
);
} | rust_cleaned_test_functions.jsonl/10375 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 180
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
4920,
50028,
36905,
368,
341,
286,
2060,
33673,
310,
48568,
44,
12735,
1712,
486,
3519,
7,
16,
340,
394,
659,
4197,
4920,
50028,
36905,
4080,
16,
68,
12,
21,
340,
394,
659,
6276,
2099,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_code_unreachable_mutator() {
crate::mutators::match_mutation(
r#"
(module
(func (result i64)
i64.const 42
)
(func (result i64)
i64.const 42
)
(func (export "exported_func") (result i32)
i32.const 42
)
)
"#,
FunctionBodyUnreachable,
r#"(module
(type (;0;) (func (result i64)))
(type (;1;) (func (result i32)))
(func (;0;) (type 0) (result i64)
i64.const 42) (func (;1;) (type 0) (result i64)
i64.const 42) (func (;2;) (type 1) (result i32) unreachable)
(export "exported_func" (func 2)))"#,
);
} | rust_cleaned_test_functions.jsonl/122288 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 550
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4136,
4907,
46550,
29523,
850,
368,
341,
286,
17717,
486,
6984,
2973,
486,
6347,
717,
22705,
1006,
310,
435,
2,
698,
310,
320,
4352,
198,
394,
320,
2830,
320,
1382,
600,
21,
19,
340,
503,
600,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bad_expr() {
let b = ast::BaseNode::default();
let pkg = ast::Package {
base: b.clone(),
path: "path".to_string(),
package: "main".to_string(),
files: vec![ast::File {
base: b.clone(),
name: "foo.flux".to_string(),
metadata: String::new(),
package: None,
imports: Vec::new(),
body: vec![ast::Statement::Expr(Box::new(ast::ExprStmt {
base: b.clone(),
expression: ast::Expression::Bad(Box::new(ast::BadExpr {
base: b.clone(),
text: "bad expression".to_string(),
expression: None,
})),
}))],
eof: vec![],
}],
};
test_convert(pkg).unwrap();
} | rust_cleaned_test_functions.jsonl/131387 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 557
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
34199,
21915,
368,
341,
286,
1077,
293,
284,
11763,
486,
3978,
1955,
486,
2258,
543,
286,
1077,
24793,
284,
11763,
486,
13100,
341,
310,
2331,
25,
293,
15997,
3148,
310,
1815,
25,
330,
23... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_yield_with() {
let mut g = Gn::new(|| {
yield_with(10);
20
});
// the para type could be deduced here
let i = g.send(());
assert!(i == 10);
let j = g.next();
assert!(j.unwrap() == 20);
} | rust_cleaned_test_functions.jsonl/91411 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
83709,
6615,
368,
341,
262,
1077,
5206,
342,
284,
95151,
486,
931,
79453,
341,
286,
7540,
6615,
7,
16,
15,
317,
286,
220,
17,
15,
198,
262,
3011,
262,
442,
279,
3348,
943,
1410,
387,
7681,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_get_block_time_no_timestamps() {
let vote_keypairs: Vec<Keypair> = (0..6).map(|_| Keypair::new()).collect();
let mut vote_entries: Vec<Entry> = Vec::new();
for (i, keypair) in vote_keypairs.iter().enumerate() {
let vote = Vote {
slots: vec![1],
hash: Hash::default(),
timestamp: None,
};
let vote_ix = vote_instruction::vote(&keypair.pubkey(), &keypair.pubkey(), vote);
let vote_msg = Message::new(&[vote_ix], Some(&keypair.pubkey()));
let vote_tx = Transaction::new(&[keypair], vote_msg, Hash::default());
vote_entries.push(next_entry_mut(&mut Hash::default(), 0, vec![vote_tx]));
let mut tick = create_ticks(1, 0, hash(&serialize(&i).unwrap()));
vote_entries.append(&mut tick);
}
let shreds = entries_to_test_shreds(vote_entries, 1, 0, true, 0);
let ledger_path = get_tmp_ledger_path!();
let blockstore = Blockstore::open(&ledger_path).unwrap();
blockstore.insert_shreds(shreds, None, false).unwrap();
// Populate slot 2 with ticks only
fill_blockstore_slot_with_ticks(&blockstore, 6, 2, 1, Hash::default());
blockstore.set_roots(&[0, 1, 2]).unwrap();
// Build epoch vote_accounts HashMap to test stake-weighted block time
let mut stakes = HashMap::new();
for (i, keypair) in vote_keypairs.iter().enumerate() {
stakes.insert(keypair.pubkey(), (1 + i as u64, Account::default()));
}
let slot_duration = Duration::from_millis(400);
for slot in &[1, 2, 3, 8] {
assert!(blockstore
.cache_block_time(*slot, slot_duration, &stakes)
.is_err());
assert_eq!(blockstore.get_block_time(*slot).unwrap(), None);
}
} | rust_cleaned_test_functions.jsonl/72818 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 898
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
7113,
3009,
6536,
23073,
82,
368,
341,
286,
1077,
6910,
3097,
77256,
25,
11312,
27,
6608,
1082,
1310,
29,
284,
320,
15,
496,
21,
568,
2186,
22428,
35395,
6569,
1082,
1310,
486,
931,
6011,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_uncommitted_state_advance_ready_from_last_term() {
let l = default_logger();
let config = &Config {
id: 1,
max_uncommitted_size: 12,
..Config::default()
};
let mut nt = Network::new_with_config(vec![None, None, None, None, None], config, &l);
let data = b"hello world!".to_vec();
let mut ent = Entry::default();
ent.data = data.clone();
nt.send(vec![new_message(1, 1, MessageType::MsgHup, 0)]);
nt.send(vec![new_message_with_entries(
1,
1,
MessageType::MsgPropose,
vec![ent.clone()],
)]);
nt.send(vec![new_message_with_entries(
1,
1,
MessageType::MsgPropose,
vec![ent.clone()],
)]);
// now node2 has 2 committed entries
// make node2 leader
nt.send(vec![new_message(2, 2, MessageType::MsgHup, 0)]);
assert_eq!(nt.peers.get_mut(&2).unwrap().state, raft::StateRole::Leader);
nt.isolate(2);
// create one uncommitted entry
nt.send(vec![new_message_with_entries(
2,
2,
MessageType::MsgPropose,
vec![ent.clone()],
)]);
let mut ent1 = ent.clone();
ent1.index = 1;
let mut ent2 = ent;
ent2.index = 2;
// simulate advance 2 entries when node2 is follower
nt.peers
.get_mut(&2)
.unwrap()
.reduce_uncommitted_size(&[ent1, ent2]);
assert_eq!(nt.peers.get_mut(&2).unwrap().uncommitted_size(), data.len());
} | rust_cleaned_test_functions.jsonl/19206 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 707
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
97446,
4387,
98093,
35456,
5673,
12195,
17464,
368,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
1077,
2193,
284,
609,
2648,
341,
286,
877,
25,
220,
16,
345,
286,
1932,
4907,
97446,
23... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_wire_from_iterator() {
let wire: Result<Wire, _> = "R8,U5,L5,D3".parse();
assert!(wire.is_ok());
assert_eq!(
wire.unwrap().segments,
vec![
Segment::new((0, 0), (8, 0)),
Segment::new((8, 0), (8, 5)),
Segment::new((8, 5), (3, 5)),
Segment::new((3, 5), (3, 2)),
]
);
} | rust_cleaned_test_functions.jsonl/106447 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 266
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75206,
5673,
13491,
368,
341,
286,
1077,
9067,
25,
5714,
27,
37845,
11,
716,
29,
284,
330,
49,
23,
50481,
20,
30114,
20,
27266,
18,
3263,
6400,
1428,
286,
2060,
10297,
35531,
2079,
19817,
1423,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_jaro_winkler() {
f64_eq(jaro_winkler_distance("one", "one"), 1f32);
f64_eq(jaro_winkler_distance("one", ""), 0f32);
f64_eq(jaro_winkler_distance("", ""), 0f32);
f64_eq(jaro_winkler_distance("", "one"), 0f32);
f64_eq(jaro_winkler_distance("DWAYNE", "DUANE"), 0.822);
f64_eq(jaro_winkler_distance("Martha", "Marhta"), 0.944);
f64_eq(jaro_winkler_distance("dicksonx", "dixon"), 0.767);
} | rust_cleaned_test_functions.jsonl/22818 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 207
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5374,
17165,
1670,
766,
1536,
368,
341,
220,
282,
21,
19,
10714,
3325,
17165,
1670,
766,
1536,
19464,
445,
603,
497,
330,
603,
3975,
220,
16,
69,
18,
17,
317,
220,
282,
21,
19,
10714,
3325,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_nacl_vector() {
let key = [
0xee, 0xa6, 0xa7, 0x25, 0x1c, 0x1e, 0x72, 0x91, 0x6d, 0x11, 0xc2, 0xcb, 0x21, 0x4d,
0x3c, 0x25, 0x25, 0x39, 0x12, 0x1d, 0x8e, 0x23, 0x4e, 0x65, 0x2d, 0x65, 0x1f, 0xa4,
0xc8, 0xcf, 0xf8, 0x80,
];
let msg = [
0x8e, 0x99, 0x3b, 0x9f, 0x48, 0x68, 0x12, 0x73, 0xc2, 0x96, 0x50, 0xba, 0x32, 0xfc,
0x76, 0xce, 0x48, 0x33, 0x2e, 0xa7, 0x16, 0x4d, 0x96, 0xa4, 0x47, 0x6f, 0xb8, 0xc5,
0x31, 0xa1, 0x18, 0x6a, 0xc0, 0xdf, 0xc1, 0x7c, 0x98, 0xdc, 0xe8, 0x7b, 0x4d, 0xa7,
0xf0, 0x11, 0xec, 0x48, 0xc9, 0x72, 0x71, 0xd2, 0xc2, 0x0f, 0x9b, 0x92, 0x8f, 0xe2,
0x27, 0x0d, 0x6f, 0xb8, 0x63, 0xd5, 0x17, 0x38, 0xb4, 0x8e, 0xee, 0xe3, 0x14, 0xa7,
0xcc, 0x8a, 0xb9, 0x32, 0x16, 0x45, 0x48, 0xe5, 0x26, 0xae, 0x90, 0x22, 0x43, 0x68,
0x51, 0x7a, 0xcf, 0xea, 0xbd, 0x6b, 0xb3, 0x73, 0x2b, 0xc0, 0xe9, 0xda, 0x99, 0x83,
0x2b, 0x61, 0xca, 0x01, 0xb6, 0xde, 0x56, 0x24, 0x4a, 0x9e, 0x88, 0xd5, 0xf9, 0xb3,
0x79, 0x73, 0xf6, 0x22, 0xa4, 0x3d, 0x14, 0xa6, 0x59, 0x9b, 0x1f, 0x65, 0x4c, 0xb4,
0x5a, 0x74, 0xe3, 0x55, 0xa5,
];
let expected = [
0xf3, 0xff, 0xc7, 0x70, 0x3f, 0x94, 0x00, 0xe5, 0x2a, 0x7d, 0xfb, 0x4b, 0x3d, 0x33,
0x05, 0xd9,
];
let mut mac = [0u8; 16];
poly1305(&key, &msg, &mut mac);
assert_eq!(&mac[..], &expected[..]);
let mut poly = Poly1305::new(&key);
poly.input(&msg[0..32]);
poly.input(&msg[32..96]);
poly.input(&msg[96..112]);
poly.input(&msg[112..120]);
poly.input(&msg[120..124]);
poly.input(&msg[124..126]);
poly.input(&msg[126..127]);
poly.input(&msg[127..128]);
poly.input(&msg[128..129]);
poly.input(&msg[129..130]);
poly.input(&msg[130..131]);
poly.raw_result(&mut mac);
assert_eq!(&mac[..], &expected[..]);
} | rust_cleaned_test_functions.jsonl/21382 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1345
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1089,
47736,
12247,
368,
341,
286,
1077,
1376,
284,
2278,
310,
220,
15,
50138,
11,
220,
15,
9591,
21,
11,
220,
15,
9591,
22,
11,
220,
15,
87,
17,
20,
11,
220,
15,
87,
16,
66,
11,
220,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_neutral_is_neutral() {
let n = 42;
let s = Scalar::from_bytes(&[
n, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
]);
let ne = EdwardsPoint::neutral_element();
assert_eq!(ne, &s * &ne);
} | rust_cleaned_test_functions.jsonl/36536 | {
"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,
13925,
14253,
6892,
13925,
14253,
368,
341,
286,
1077,
308,
284,
220,
19,
17,
280,
286,
1077,
274,
284,
35176,
486,
1499,
12524,
2099,
9640,
310,
308,
11,
220,
15,
11,
220,
15,
11,
220,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_key_derive() {
let network = Testnet;
let key_generate_cmd = KeySubCommand::Derive {
xprv: "tprv8ZgxMBicQKsPfQjJy8ge2cvBfDjLxJSkvNLVQiw7BQ5gTjKadG2rrcQB5zjcdaaUTz5EDNJaS77q4DzjqjogQBfMsaXFFNP3UqoBnwt2kyT"
.to_string(),
path: "m/84'/1'/0'/0".to_string(),
};
let result = handle_key_subcommand(network, key_generate_cmd).unwrap();
let result_obj = result.as_object().unwrap();
let xpub = result_obj.get("xpub").unwrap().as_str().unwrap();
let xprv = result_obj.get("xprv").unwrap().as_str().unwrap();
assert_eq!(&xpub, &"[566844c5/84'/1'/0'/0]tpubDFeqiDkfwR1tAhPxsXSZMfEmfpDhwhLyhLKZgmeBvuBkZQusoWeL62oGg2oTNGcENeKdwuGepAB85eMvyLemabYe9PSqv6cr5mFXktHc3Ka/*");
assert_eq!(&xprv, &"[566844c5/84'/1'/0'/0]tprv8ixoZoiRo3LDHENAysmxxFaf6nhmnNA582inQFbtWdPMivf7B7pjuYBQVuLC5bkM7tJZEDbfoivENsGZPBnQg1n52Kuc1P8X2Ei3XJuJX7c/*");
} | rust_cleaned_test_functions.jsonl/53346 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 573
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3097,
35345,
533,
368,
341,
286,
1077,
3922,
284,
3393,
4711,
280,
286,
1077,
1376,
48851,
11684,
284,
5309,
3136,
4062,
486,
22171,
533,
341,
310,
856,
649,
85,
25,
330,
83,
649,
85,
23,
57,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_idx_pileup() {
let mut bam = IndexedReader::from_path(&"test/test.bam")
.ok()
.expect("Error opening file.");
// read without fetch
for pileup in bam.pileup() {
pileup.unwrap();
}
// go back again
let tid = bam.header().tid(b"CHROMOSOME_I").unwrap();
bam.fetch(tid, 0, 5).unwrap();
for p in bam.pileup() {
println!("{}", p.unwrap().pos())
}
} | rust_cleaned_test_functions.jsonl/34034 | {
"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,
7258,
620,
457,
454,
368,
341,
286,
1077,
5206,
41304,
284,
8008,
17120,
486,
1499,
2638,
2099,
1,
1944,
12697,
71804,
1138,
310,
659,
562,
741,
310,
659,
17119,
445,
1454,
8568,
1034,
7320,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_iter_clone() {
let xs = [1, 2, 5];
let mut it = xs.iter();
it.next();
let mut jt = it.clone();
assert_eq!(it.next(), jt.next());
assert_eq!(it.next(), jt.next());
assert_eq!(it.next(), jt.next());
} | rust_cleaned_test_functions.jsonl/12887 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
54742,
368,
341,
262,
1077,
11943,
284,
508,
16,
11,
220,
17,
11,
220,
20,
935,
262,
1077,
5206,
432,
284,
11943,
19471,
543,
262,
432,
4529,
543,
262,
1077,
5206,
91076,
284,
432,
1599... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_push_epoch_slots() {
let keys = Keypair::new();
let contact_info = ContactInfo::new_localhost(&keys.pubkey(), 0);
let cluster_info = ClusterInfo::new(
contact_info,
Arc::new(Keypair::new()),
SocketAddrSpace::Unspecified,
);
let slots = cluster_info.get_epoch_slots(&mut Cursor::default());
assert!(slots.is_empty());
cluster_info.push_epoch_slots(&[0]);
let mut cursor = Cursor::default();
let slots = cluster_info.get_epoch_slots(&mut cursor);
assert_eq!(slots.len(), 1);
let slots = cluster_info.get_epoch_slots(&mut cursor);
assert!(slots.is_empty());
// Test with different shred versions.
let mut rng = rand::thread_rng();
let node_pubkey = Pubkey::new_unique();
let mut node = ContactInfo::new_rand(&mut rng, Some(node_pubkey));
node.shred_version = 42;
let epoch_slots = EpochSlots::new_rand(&mut rng, Some(node_pubkey));
let entries = vec![
CrdsValue::new_unsigned(CrdsData::ContactInfo(node)),
CrdsValue::new_unsigned(CrdsData::EpochSlots(0, epoch_slots)),
];
{
let mut gossip_crds = cluster_info.gossip.crds.write().unwrap();
for entry in entries {
assert!(gossip_crds
.insert(entry, /*now=*/ 0, GossipRoute::LocalMessage)
.is_ok());
}
}
// Should exclude other node's epoch-slot because of different
// shred-version.
let slots = cluster_info.get_epoch_slots(&mut Cursor::default());
assert_eq!(slots.len(), 1);
assert_eq!(slots[0].from, cluster_info.id());
// Match shred versions.
{
let mut node = cluster_info.my_contact_info.write().unwrap();
node.shred_version = 42;
}
cluster_info.push_self(
&HashMap::default(), // stakes
None, // gossip validators
);
cluster_info.flush_push_queue();
// Should now include both epoch slots.
let slots = cluster_info.get_epoch_slots(&mut Cursor::default());
assert_eq!(slots.len(), 2);
assert_eq!(slots[0].from, cluster_info.id());
assert_eq!(slots[1].from, node_pubkey);
} | rust_cleaned_test_functions.jsonl/26029 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1135
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14218,
20682,
54161,
368,
341,
286,
1077,
6894,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
3645,
3109,
284,
9180,
1731,
486,
931,
62,
8301,
2099,
10563,
47773,
792,
1507,
220,
15,
317,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_statsd_client_queuing_delegating_many_threaded() {
let (client, sink) = new_delegating_queuing_buffered_udp_client("cadence");
run_arc_threaded_test(client, NUM_THREADS, NUM_ITERATIONS);
let mut queued = sink.queued();
while queued > 0 {
queued = sink.queued();
thread::yield_now();
}
} | rust_cleaned_test_functions.jsonl/21897 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15381,
67,
8179,
47342,
7471,
2259,
1937,
1095,
22101,
10814,
291,
368,
341,
262,
1077,
320,
2972,
11,
19309,
8,
284,
501,
2259,
1937,
1095,
47342,
7471,
7776,
291,
69432,
8179,
445,
34455,
763,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_combo() {
let both = RxFilter::create(Some("12".to_string()), Some("65".to_string()));
// Stopped by whitelist
assert!(both.filter(&[0x34, 0x56]).is_none());
// Stopped by blacklist
assert!(both.filter(&[0x12, 0x34, 0x65]).is_none());
// Stopped by both
assert!(both.filter(&[0x34, 0x56]).is_none());
// Allowed by both
assert!(both.filter(&[0x34, 0x56, 0x12]).is_some());
} | rust_cleaned_test_functions.jsonl/110864 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 230
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54781,
368,
341,
286,
1077,
2176,
284,
35376,
5632,
486,
3182,
65405,
445,
16,
17,
3263,
983,
3904,
11858,
4329,
445,
21,
20,
3263,
983,
3904,
7392,
286,
442,
794,
17573,
553,
67727,
198,
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_banner() {
let banner = include_str!("../strings/banner.txt");
let mut c = Cursor::new(Vec::new());
print_banner(&mut c);
c.seek(SeekFrom::Start(0)).unwrap();
let mut banner_out = Vec::new();
c.read_to_end(&mut banner_out).unwrap();
assert_eq!(banner, str::from_utf8(&banner_out).unwrap());
} | rust_cleaned_test_functions.jsonl/107838 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 150
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46571,
368,
341,
262,
1077,
23323,
284,
2924,
2895,
17223,
1244,
18594,
84676,
3909,
797,
262,
1077,
5206,
272,
284,
28067,
486,
931,
49923,
486,
931,
5231,
262,
1173,
46571,
2099,
6984,
272,
317,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_owned_bytes_read_right_at_the_end() -> io::Result<()> {
let mut bytes = OwnedBytes::new(b"abcde".as_ref());
let mut buf = [0u8; 5];
assert_eq!(bytes.read(&mut buf[..]).unwrap(), 5);
assert_eq!(&buf, b"abcde");
assert_eq!(bytes.as_slice(), b"");
assert_eq!(bytes.read(&mut buf[..]).unwrap(), 0);
assert_eq!(&buf, b"abcde");
Ok(())
} | rust_cleaned_test_functions.jsonl/48682 | {
"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,
51973,
12524,
6443,
10539,
3752,
16068,
6213,
368,
1464,
6399,
486,
2077,
71698,
341,
286,
1077,
5206,
5820,
284,
85093,
7078,
486,
931,
1883,
1,
13683,
450,
3263,
300,
7793,
1423,
286,
1077,
5206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_incomplete_after_valid_data() {
let mut dec = MultiResponseDecoder::<TO>::new();
{
let mut stream = dec.process_next_chunk(
br#"{
"type": "ADDED",
"object": {
"kind": "Pod",
"apiVersion": "v1",
"metadata": {
"uid": "uid0"
}
}
}{"#,
);
assert_test_object(stream.next(), "uid0");
assert!(stream.next().is_none());
}
assert_eq!(dec.finish().unwrap_err(), b"{");
} | rust_cleaned_test_functions.jsonl/14565 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 446
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
14737,
19844,
8337,
1769,
368,
341,
286,
1077,
5206,
1622,
284,
17439,
2582,
20732,
27638,
5207,
6831,
931,
1428,
286,
341,
310,
1077,
5206,
4269,
284,
1622,
16988,
11257,
30539,
1006,
394,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reader_be() {
use bitstream_io::{BigEndian, BitRead, BitReader};
let actual_data: [u8; 4] = [0xB1, 0xED, 0x3B, 0xC1];
/*reading individual bits*/
let mut r = BitReader::endian(Cursor::new(&actual_data), BigEndian);
assert_eq!(r.read_bit().unwrap(), true);
assert_eq!(r.read_bit().unwrap(), false);
assert_eq!(r.read_bit().unwrap(), true);
assert_eq!(r.read_bit().unwrap(), true);
assert_eq!(r.read_bit().unwrap(), false);
assert_eq!(r.read_bit().unwrap(), false);
assert_eq!(r.read_bit().unwrap(), false);
assert_eq!(r.read_bit().unwrap(), true);
assert_eq!(r.read_bit().unwrap(), true);
assert_eq!(r.read_bit().unwrap(), true);
assert_eq!(r.read_bit().unwrap(), true);
assert_eq!(r.read_bit().unwrap(), false);
assert_eq!(r.read_bit().unwrap(), true);
assert_eq!(r.read_bit().unwrap(), true);
assert_eq!(r.read_bit().unwrap(), false);
assert_eq!(r.read_bit().unwrap(), true);
/*reading unsigned values*/
let mut r = BitReader::endian(Cursor::new(&actual_data), BigEndian);
assert!(r.byte_aligned());
assert_eq!(r.read::<u32>(2).unwrap(), 2);
assert!(!r.byte_aligned());
assert_eq!(r.read::<u32>(3).unwrap(), 6);
assert!(!r.byte_aligned());
assert_eq!(r.read::<u32>(5).unwrap(), 7);
assert!(!r.byte_aligned());
assert_eq!(r.read::<u32>(3).unwrap(), 5);
assert!(!r.byte_aligned());
assert_eq!(r.read::<u32>(19).unwrap(), 0x53BC1);
assert!(r.byte_aligned());
assert!(r.read::<u32>(1).is_err());
/*skipping bits*/
let mut r = BitReader::endian(Cursor::new(&actual_data), BigEndian);
assert_eq!(r.read::<u32>(2).unwrap(), 2);
assert!(r.skip(3).is_ok());
assert_eq!(r.read::<u32>(5).unwrap(), 7);
assert!(r.skip(3).is_ok());
assert_eq!(r.read::<u32>(19).unwrap(), 0x53BC1);
/*reading signed values*/
let mut r = BitReader::endian(Cursor::new(&actual_data), BigEndian);
assert_eq!(r.read_signed::<i32>(2).unwrap(), -2);
assert_eq!(r.read_signed::<i32>(3).unwrap(), -2);
assert_eq!(r.read_signed::<i32>(5).unwrap(), 7);
assert_eq!(r.read_signed::<i32>(3).unwrap(), -3);
assert_eq!(r.read_signed::<i32>(19).unwrap(), -181311);
/*reading unary 0 values*/
let mut r = BitReader::endian(Cursor::new(&actual_data), BigEndian);
assert_eq!(r.read_unary0().unwrap(), 1);
assert_eq!(r.read_unary0().unwrap(), 2);
assert_eq!(r.read_unary0().unwrap(), 0);
assert_eq!(r.read_unary0().unwrap(), 0);
assert_eq!(r.read_unary0().unwrap(), 4);
/*reading unary 1 values*/
let mut r = BitReader::endian(Cursor::new(&actual_data), BigEndian);
assert_eq!(r.read_unary1().unwrap(), 0);
assert_eq!(r.read_unary1().unwrap(), 1);
assert_eq!(r.read_unary1().unwrap(), 0);
assert_eq!(r.read_unary1().unwrap(), 3);
assert_eq!(r.read_unary1().unwrap(), 0);
/*byte aligning*/
let mut r = BitReader::endian(Cursor::new(&actual_data), BigEndian);
assert_eq!(r.read::<u32>(3).unwrap(), 5);
r.byte_align();
assert_eq!(r.read::<u32>(3).unwrap(), 7);
r.byte_align();
r.byte_align();
assert_eq!(r.read::<u32>(8).unwrap(), 59);
r.byte_align();
assert_eq!(r.read::<u32>(4).unwrap(), 12);
let mut r = BitReader::endian(Cursor::new(&actual_data), BigEndian);
let mut sub_data = [0; 2];
assert!(r.read_bytes(&mut sub_data).is_ok());
assert_eq!(&sub_data, b"\xB1\xED");
let mut r = BitReader::endian(Cursor::new(&actual_data), BigEndian);
let mut sub_data = [0; 2];
assert_eq!(r.read::<u32>(4).unwrap(), 11);
assert!(r.read_bytes(&mut sub_data).is_ok());
assert_eq!(&sub_data, b"\x1E\xD3");
} | rust_cleaned_test_functions.jsonl/65116 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1692
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22306,
21263,
368,
341,
262,
990,
2699,
4027,
16939,
22964,
15636,
43231,
11,
6495,
4418,
11,
6495,
5062,
2315,
262,
1077,
5042,
1769,
25,
508,
84,
23,
26,
220,
19,
60,
284,
508,
15,
14377,
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_is_number_list() {
#[derive(Debug)]
struct TestCase {
it: String,
input: String,
expected: bool,
}
let test_cases = [
TestCase {
it: String::from("should return true when format is list `1.` (nest 0)"),
input: String::from("1. aaa"),
expected: true,
},
TestCase {
it: String::from("should return true when format is list ` 2.` (nest 1)"),
input: String::from(" 2. aaa"),
expected: true,
},
TestCase {
it: String::from("should return true when format is list `10.` (nest 0)"),
input: String::from("10. aaa"),
expected: true,
},
TestCase {
it: String::from("should return false when format is not list"),
input: String::from("aaa"),
expected: false,
},
];
for test_case in test_cases.iter() {
let output = is_number_list(&test_case.input);
assert_eq!(output, test_case.expected, "Failed: {}\n", test_case.it);
}
} | rust_cleaned_test_functions.jsonl/18761 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 807
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
5500,
2019,
368,
341,
310,
11506,
27098,
42618,
5563,
310,
2036,
30573,
341,
394,
432,
25,
923,
345,
394,
1946,
25,
923,
345,
394,
3601,
25,
1807,
345,
310,
456,
310,
1077,
1273,
41427,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_without_block_comments_lines_without_block_comments() {
let result = without_block_comments(vec!["/*", "", "*/"]);
println!("result: {:?}", result);
assert!(result.is_empty());
let result = without_block_comments(vec!["", "/*", "", "*/", "#[crate_type = \"lib\"]", "/*", "", "*/", ""]);
assert_eq!(result, vec!["", "#[crate_type = \"lib\"]", ""]);
let result = without_block_comments(vec!["/* rust", "", "*/"]);
assert!(result.is_empty());
let result = without_block_comments(vec!["/* one-line comment */"]);
assert!(result.is_empty());
let result = without_block_comments(vec!["/* nested", "/* multi-line", "comment", "*/", "test", "*/"]);
assert!(result.is_empty());
let result = without_block_comments(vec!["/* nested /* inline /* comment */ test */ */"]);
assert!(result.is_empty());
let result = without_block_comments(vec!["foo", "bar", "baz"]);
assert_eq!(result, vec!["foo", "bar", "baz"]);
} | rust_cleaned_test_functions.jsonl/4237 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 441
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39904,
7113,
30359,
18323,
39904,
7113,
30359,
368,
341,
286,
1077,
1102,
284,
2041,
7113,
30359,
25592,
0,
1183,
1057,
497,
7342,
330,
1812,
15049,
286,
13751,
17223,
1382,
25,
71964,
1102,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_groupby_apply() {
let df = df! {
"a" => [1, 1, 2, 2, 2],
"b" => [1, 2, 3, 4, 5]
}
.unwrap();
let out = df.groupby("a").unwrap().apply(|df| Ok(df)).unwrap();
assert!(out.sort("b", false).unwrap().frame_equal(&df));
} | rust_cleaned_test_functions.jsonl/80314 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 175
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6288,
1694,
36551,
368,
341,
286,
1077,
6764,
284,
6764,
0,
341,
310,
330,
64,
1,
589,
508,
16,
11,
220,
16,
11,
220,
17,
11,
220,
17,
11,
220,
17,
1259,
310,
330,
65,
1,
589,
508,
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_part_1_example() {
let input = Container {
input: vec![
Entry {
min: 1,
max: 3,
target: 'a',
password: String::from("abcde"),
},
Entry {
min: 1,
max: 3,
target: 'b',
password: String::from("cdefg"),
},
Entry {
min: 2,
max: 9,
target: 'c',
password: String::from("ccccccccc"),
},
],
};
let expected = 2.to_string();
assert_eq!(Ok(expected), input.part_1());
} | rust_cleaned_test_functions.jsonl/112413 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 562
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10495,
62,
16,
39304,
368,
972,
286,
1077,
1946,
284,
9678,
972,
310,
1946,
25,
7486,
20703,
319,
394,
15788,
972,
503,
1308,
25,
220,
16,
1871,
503,
1932,
25,
220,
18,
1871,
503,
2169,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_move_left_doesnt_go_over() {
let mut player_bar = Bar::new(
Position::new(0, 0),
Dimensions::new(5, 1),
Dimensions::new(10, 10),
);
player_bar.move_left();
assert_eq!(player_bar.position.x(), 0);
} | rust_cleaned_test_functions.jsonl/40730 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 157
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17134,
9579,
96374,
406,
25515,
15431,
368,
341,
286,
1077,
5206,
2781,
14388,
284,
4716,
486,
931,
1006,
310,
12380,
486,
931,
7,
15,
11,
220,
15,
1326,
310,
32023,
486,
931,
7,
20,
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_offset_calculation() {
assert_eq!(calculate_allocation(128, 8, 15, 1, 4, 4), (8, 0, 148));
assert_eq!(calculate_allocation(3, 1, 2, 1, 1, 1), (1, 0, 6));
assert_eq!(calculate_allocation(6, 2, 12, 4, 24, 8), (8, 0, 48));
assert_eq!(calculate_offsets(128, 15, 1, 4), (128, 144));
assert_eq!(calculate_offsets(3, 2, 1, 1), (3, 5));
assert_eq!(calculate_offsets(6, 12, 4, 8), (8, 24));
} | rust_cleaned_test_functions.jsonl/2729 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 230
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6917,
38241,
2914,
368,
341,
262,
2060,
10714,
10297,
35597,
81267,
7,
16,
17,
23,
11,
220,
23,
11,
220,
16,
20,
11,
220,
16,
11,
220,
19,
11,
220,
220,
19,
701,
320,
23,
11,
220,
15,
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_frame_invalid_start_byte() {
let frame = Frame::new([0x00; 9]);
assert!(!frame.has_valid_start_byte());
assert_eq!(
frame.validate(),
Err(ValidateFrameError::InvalidStartByte(0x00))
);
} | rust_cleaned_test_functions.jsonl/86324 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8929,
31433,
4906,
19737,
368,
341,
286,
1077,
4034,
284,
16321,
486,
931,
2561,
15,
87,
15,
15,
26,
220,
24,
2558,
286,
2060,
0,
3471,
6763,
6858,
8337,
4906,
19737,
1423,
286,
2060,
10714,
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_completion_entry_filter_text() {
let fixture = CompletionEntry {
kind: ScriptElementKind::MemberVariableElement,
name: "['foo']".to_string(),
insert_text: Some("['foo']".to_string()),
..Default::default()
};
let actual = fixture.get_filter_text();
assert_eq!(actual, Some(".foo".to_string()));
let fixture = CompletionEntry {
kind: ScriptElementKind::MemberVariableElement,
name: "#abc".to_string(),
..Default::default()
};
let actual = fixture.get_filter_text();
assert_eq!(actual, Some("abc".to_string()));
let fixture = CompletionEntry {
kind: ScriptElementKind::MemberVariableElement,
name: "#abc".to_string(),
insert_text: Some("this.#abc".to_string()),
..Default::default()
};
let actual = fixture.get_filter_text();
assert_eq!(actual, Some("abc".to_string()));
} | rust_cleaned_test_functions.jsonl/23629 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 351
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60164,
9078,
8727,
4326,
368,
341,
262,
1077,
12507,
284,
56250,
5874,
341,
414,
3093,
25,
13710,
1691,
10629,
486,
9366,
7827,
1691,
345,
414,
829,
25,
330,
677,
7975,
660,
3263,
983,
3904,
314... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_recognize_http_example() {
let mut buffer = AsyncBuffer::new(format!(
"{}{}{}{}{}{}{}{}{}{}{}{}",
"GET ", "/hel", "lo-w", "orld", " HTT", "P/1.", "1\r\nC", "onte", "nt-L", "engt", "h: 3", "\r\n\r\n"
));
let result = block_on(async { recognize(&mut buffer).await });
assert_eq!(result.unwrap().method(), Some(RequestMethod::GET));
} | rust_cleaned_test_functions.jsonl/48195 | {
"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,
7080,
3934,
551,
25888,
39304,
368,
341,
220,
1077,
5206,
4147,
284,
21433,
4095,
486,
931,
20698,
33673,
262,
35503,
6257,
6257,
6257,
6257,
6257,
6257,
6257,
6257,
6257,
6257,
6257,
756,
262,
33... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_1st_level_def_lookup_on_1st_level_block_scope() {
let module_scope = ModuleScope::new();
let contract_scope = ContractScope::new(module_scope);
let block_scope_1 =
BlockScope::from_contract_scope(Span::new(0, 0), Rc::clone(&contract_scope));
block_scope_1
.borrow_mut()
.add_var("some_thing".to_string(), Type::Base(Base::Bool));
assert_eq!(
Some(BlockDef::Variable(Type::Base(Base::Bool))),
block_scope_1.borrow().def("some_thing".to_string())
);
} | rust_cleaned_test_functions.jsonl/14886 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 282
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
16,
267,
8274,
7844,
27464,
4470,
62,
16,
267,
8274,
7113,
23199,
368,
341,
286,
1077,
4688,
23199,
284,
13711,
10803,
486,
931,
543,
286,
1077,
5116,
23199,
284,
19185,
10803,
486,
931,
191... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fill_nan() -> Result<()> {
let s0 = Series::new("date", &[1, 2, 3]).cast(&DataType::Date)?;
let s1 = Series::new("float", &[Some(1.0), Some(f32::NAN), Some(3.0)]);
let df = DataFrame::new(vec![s0, s1])?;
let out = df.lazy().fill_nan(Null {}.lit()).collect()?;
let out = out.column("float")?;
assert_eq!(Vec::from(out.f32()?), &[Some(1.0), None, Some(3.0)]);
Ok(())
} | rust_cleaned_test_functions.jsonl/173 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 201
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30728,
73936,
368,
1464,
5714,
71698,
341,
262,
1077,
274,
15,
284,
11131,
486,
931,
445,
1028,
497,
44590,
16,
11,
220,
17,
11,
220,
18,
10697,
3829,
2099,
22653,
486,
1916,
40007,
262,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_reader_rng_insufficient_bytes() {
let mut rng = ReaderRng::new(MemReader::new(vec!()));
let mut v = [0u8, .. 3];
rng.fill_bytes(&mut v);
} | rust_cleaned_test_functions.jsonl/8616 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22306,
66849,
34386,
26683,
12524,
368,
341,
286,
1077,
5206,
28422,
284,
25166,
49,
968,
486,
931,
3189,
336,
5062,
486,
931,
25592,
0,
7392,
286,
1077,
5206,
348,
284,
508,
15,
84,
23,
11,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_iterator_chain_nth() {
let xs = [0, 1, 2, 3, 4, 5];
let ys = [30, 40, 50, 60];
let zs = [];
let expected = [0, 1, 2, 3, 4, 5, 30, 40, 50, 60];
for (i, x) in expected.iter().enumerate() {
assert_eq!(Some(x), xs.iter().chain(&ys).nth(i));
}
assert_eq!(zs.iter().chain(&xs).nth(0), Some(&0));
let mut it = xs.iter().chain(&zs);
assert_eq!(it.nth(5), Some(&5));
assert_eq!(it.next(), None);
} | rust_cleaned_test_functions.jsonl/25889 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 235
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13491,
30583,
78342,
368,
341,
262,
1077,
11943,
284,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
262,
1077,
31810,
284,
508,
18,
15,
11,
220,
19,
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... | 2 |
#[test]
fn test_nickname() {
assert!(nickname("a"));
assert!(nickname("a".repeat(32)));
assert!(!nickname(""));
assert!(!nickname("a".repeat(33)));
} | rust_cleaned_test_functions.jsonl/29959 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1089,
41052,
368,
341,
286,
2060,
10297,
39413,
445,
64,
4010,
286,
2060,
10297,
39413,
445,
64,
3263,
30624,
7,
18,
17,
22525,
286,
2060,
0,
3471,
39413,
89744,
286,
2060,
0,
3471,
39413,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_100_per_second() {
let time_ticks = (0..2000).collect();
let rate_limiter = UltraLightRateLimiter::new(100., get_ticker(time_ticks));
// trying to get 1000 permits a second. only 100 should be granted
for _ in 0..100 {
assert!(rate_limiter.try_acquire(), "Must grant a permit");
}
for _ in 100..1000 {
assert!(!rate_limiter.try_acquire(), "Must not grant a permit");
}
// the second second
assert!(rate_limiter.try_acquire(), "Must grant a permit");
} | rust_cleaned_test_functions.jsonl/107268 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 254
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
16,
15,
15,
5678,
29644,
368,
341,
286,
1077,
882,
49961,
284,
320,
15,
496,
17,
15,
15,
15,
568,
17384,
543,
286,
1077,
4379,
907,
17700,
284,
28213,
13911,
11564,
43,
17700,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_stxb_all2() {
test_interpreter_and_jit_asm!(
"
mov r0, r1
mov r1, 0xf1
mov r9, 0xf9
stxb [r0], r1
stxb [r0+1], r9
ldxh r0, [r0]
be16 r0
exit",
[0xff, 0xff],
(),
{ |_vm, res: Result| { res.unwrap() == 0xf1f9 } },
8
);
} | rust_cleaned_test_functions.jsonl/59002 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 236
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
7929,
5705,
17,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
6228,
286,
1974,
435,
15,
11,
435,
16,
198,
286,
1974,
435,
16,
11,
220,
15,
5848,
16,
198,
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_parse_flush() {
let mem = &create_anon_guest_memory(&[(GuestAddress(0), 0x10000)], false).unwrap();
let mut queue = RequestVirtQueue::new(GuestAddress(0), &mem);
// Flush request with a data descriptor.
let request_header = RequestHeader::new(VIRTIO_BLK_T_FLUSH, 50);
queue.set_hdr_desc(0x1000, 0x1000, VIRTQ_DESC_F_NEXT, request_header);
queue.set_data_desc(0x2000, 0x1000, VIRTQ_DESC_F_NEXT);
queue.set_status_desc(0x3000, 0x1000, VIRTQ_DESC_F_WRITE);
queue.check_parse(true);
// Flush request without a data descriptor.
queue
.mut_hdr_desc()
.next
.set(RequestVirtQueue::STATUS_DESC as u16);
queue.check_parse(false);
} | rust_cleaned_test_functions.jsonl/84869 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 372
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
39213,
368,
341,
286,
1077,
1833,
284,
609,
3182,
12008,
263,
62739,
19195,
2099,
9697,
37804,
4286,
7,
15,
701,
220,
15,
87,
16,
15,
15,
15,
15,
25035,
895,
568,
15454,
543,
286,
1077,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pcapng_simple_packets() {
let (rem, section) = parse_section(TEST010_LE).expect("could not parse section");
assert!(rem.is_empty());
assert_eq!(section.iter_interfaces().count(), 1);
let expected_origlen = &[0, 0, 314, 342, 314, 342];
for (block, expected_len) in section.iter().zip(expected_origlen.iter()) {
if let PcapBlock::NG(Block::SimplePacket(spb)) = block {
assert_eq!(spb.origlen, *expected_len);
}
}
} | rust_cleaned_test_functions.jsonl/132438 | {
"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,
620,
11346,
968,
30015,
63569,
368,
341,
262,
1077,
320,
1826,
11,
3772,
8,
284,
4715,
16221,
50320,
15,
16,
15,
5280,
568,
17119,
445,
28077,
537,
4715,
3772,
797,
262,
2060,
10297,
1826,
2079,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_cast_from_int8() {
let i8_values: Vec<i8> = vec![std::i8::MIN, 0, std::i8::MAX];
let i8_array: ArrayRef = Arc::new(Int8Array::from(i8_values));
let f64_expected = vec!["-128.0", "0.0", "127.0"];
assert_eq!(
f64_expected,
get_cast_values::<Float64Type>(&i8_array, &DataType::Float64)
);
let f32_expected = vec!["-128.0", "0.0", "127.0"];
assert_eq!(
f32_expected,
get_cast_values::<Float32Type>(&i8_array, &DataType::Float32)
);
let i64_expected = vec!["-128", "0", "127"];
assert_eq!(
i64_expected,
get_cast_values::<Int64Type>(&i8_array, &DataType::Int64)
);
let i32_expected = vec!["-128", "0", "127"];
assert_eq!(
i32_expected,
get_cast_values::<Int32Type>(&i8_array, &DataType::Int32)
);
let i16_expected = vec!["-128", "0", "127"];
assert_eq!(
i16_expected,
get_cast_values::<Int16Type>(&i8_array, &DataType::Int16)
);
let i8_expected = vec!["-128", "0", "127"];
assert_eq!(
i8_expected,
get_cast_values::<Int8Type>(&i8_array, &DataType::Int8)
);
let u64_expected = vec!["null", "0", "127"];
assert_eq!(
u64_expected,
get_cast_values::<UInt64Type>(&i8_array, &DataType::UInt64)
);
let u32_expected = vec!["null", "0", "127"];
assert_eq!(
u32_expected,
get_cast_values::<UInt32Type>(&i8_array, &DataType::UInt32)
);
let u16_expected = vec!["null", "0", "127"];
assert_eq!(
u16_expected,
get_cast_values::<UInt16Type>(&i8_array, &DataType::UInt16)
);
let u8_expected = vec!["null", "0", "127"];
assert_eq!(
u8_expected,
get_cast_values::<UInt8Type>(&i8_array, &DataType::UInt8)
);
} | rust_cleaned_test_functions.jsonl/29629 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5303,
5673,
4042,
23,
368,
341,
286,
1077,
600,
23,
9146,
25,
11312,
21897,
23,
29,
284,
7486,
20703,
1834,
486,
72,
23,
486,
16413,
11,
220,
15,
11,
1460,
486,
72,
23,
486,
10586,
935,
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_owned_bytes_debug() {
let short_bytes = OwnedBytes::new(b"abcd".as_ref());
assert_eq!(
format!("{:?}", short_bytes),
"OwnedBytes([97, 98, 99, 100], len=4)"
);
let long_bytes = OwnedBytes::new(b"abcdefghijklmnopq".as_ref());
assert_eq!(
format!("{:?}", long_bytes),
"OwnedBytes([97, 98, 99, 100, 101, 102, 103, 104, 105, 106], len=17)"
);
} | rust_cleaned_test_functions.jsonl/48680 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 250
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51973,
12524,
15446,
368,
341,
286,
1077,
2805,
12524,
284,
85093,
7078,
486,
931,
1883,
1,
68644,
3263,
300,
7793,
1423,
286,
2060,
10714,
33673,
310,
3561,
88928,
25,
52652,
2805,
12524,
1326,
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_capture() {
let mut ps = ParseStream {
content: "Hello World".to_string(),
cursor: 3,
};
let val = ps.capture("([a-z])([a-z])", 2).unwrap();
assert_eq!(ps.cursor, 5);
assert_eq!(val, "o".to_string());
} | rust_cleaned_test_functions.jsonl/41148 | {
"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,
55148,
368,
341,
286,
1077,
5206,
4726,
284,
14775,
3027,
341,
310,
2213,
25,
330,
9707,
4337,
3263,
983,
3904,
3148,
310,
8128,
25,
220,
18,
345,
286,
3634,
286,
1077,
1044,
284,
4726,
60523,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_utf8_to_array() -> SimpleResult<()> {
let data = b"\x41\x42\xE2\x9D\x84\xE2\x98\xA2\xF0\x9D\x84\x9E\xF0\x9F\x98\x88\xc3\xb7".to_vec();
let offset = Offset::Dynamic(Context::new(&data));
let a: H2Type = H2String::new(7, CharacterReader::UTF8, CharacterFormatter::pretty_str_character())?;
let resolved = a.resolve(offset, None)?;
assert_eq!("\"AB❄☢𝄞😈÷\"", resolved.display);
Ok(())
} | rust_cleaned_test_functions.jsonl/102195 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 250
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39453,
23,
2346,
3858,
368,
1464,
8993,
2077,
71698,
341,
1789,
286,
1077,
821,
284,
293,
11934,
87,
19,
16,
3462,
19,
17,
3462,
36,
17,
3462,
24,
35,
3462,
23,
19,
3462,
36,
17,
3462,
24,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_bad_form_additional_fields() {
check_bad_form("username=Sergio&password=pass&age=30&addition=1",
Status::UnprocessableEntity);
} | rust_cleaned_test_functions.jsonl/46560 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 81
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34199,
7915,
81742,
12132,
368,
341,
262,
1779,
34199,
7915,
445,
5113,
72196,
2375,
815,
5,
3833,
28,
6385,
5,
424,
28,
18,
15,
5,
718,
680,
28,
16,
756,
4293,
8104,
486,
1806,
57240,
3030,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_simple_inversion3() {
let a: Secp256k1Scalar = ECScalar::from(&BigInt::from(1234567890)).unwrap();
let a_inv = a.invert().unwrap().to_bigint();
assert_eq!(
a_inv,
BigInt::from_hex("6bd555ecd0e4e06df23bfbb091158daaa0c6ba7347f32b95f4484e8dceb39d91")
.unwrap()
);
} | rust_cleaned_test_functions.jsonl/60386 | {
"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,
30015,
1243,
4366,
18,
368,
341,
286,
1077,
264,
25,
4520,
79,
17,
20,
21,
74,
16,
20639,
284,
20633,
20639,
486,
1499,
2099,
87474,
486,
1499,
7,
16,
17,
18,
19,
20,
21,
22,
23,
24,
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_field() {
assert_eq!(
parse_field(b"003@ \x1f0123456789X\x1e").unwrap().1,
Field::new(
"003@",
None,
vec![Subfield::new('0', "123456789X").unwrap()]
)
.unwrap()
);
} | rust_cleaned_test_functions.jsonl/101495 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 206
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
5013,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
5013,
1883,
1,
15,
15,
18,
31,
1124,
87,
16,
69,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
55,
3462,
16,
68,
1827,
15454,
1005,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_noop_storage() {
let noop = NoopStorage::default();
// Test save_file
let magic_contents: &[u8] = b"5678";
noop.write(
"a.log",
Box::new(magic_contents),
magic_contents.len() as u64,
)
.unwrap();
let mut reader = noop.read("a.log");
let mut buf = vec![];
block_on(reader.read_to_end(&mut buf)).unwrap();
assert!(buf.is_empty());
} | rust_cleaned_test_functions.jsonl/48139 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 256
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
453,
23310,
368,
341,
286,
1077,
60829,
284,
2308,
453,
5793,
486,
2258,
1428,
286,
442,
3393,
3581,
2458,
198,
286,
1077,
10963,
16682,
25,
44590,
84,
23,
60,
284,
293,
1,
20,
21,
22,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_preboot_insert_block_dev() {
let req = VmmAction::InsertBlockDevice(BlockDeviceConfig {
path_on_host: String::new(),
is_root_device: false,
partuuid: None,
is_read_only: false,
drive_id: String::new(),
rate_limiter: None,
});
check_preboot_request(req, |result, vm_res| {
assert_eq!(result, Ok(VmmData::Empty));
assert!(vm_res.block_set)
});
let req = VmmAction::InsertBlockDevice(BlockDeviceConfig {
path_on_host: String::new(),
is_root_device: false,
partuuid: None,
is_read_only: false,
drive_id: String::new(),
rate_limiter: None,
});
check_preboot_request_err(
req,
VmmActionError::DriveConfig(DriveError::RootBlockDeviceAlreadyAdded),
);
} | rust_cleaned_test_functions.jsonl/44531 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 484
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10442,
4619,
17678,
7113,
10433,
368,
341,
286,
1077,
4232,
284,
647,
3821,
2512,
486,
13780,
4713,
6985,
55243,
6985,
2648,
341,
310,
1815,
4470,
12848,
25,
923,
486,
931,
3148,
310,
374,
12993,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stacked_input_circuit_poseidon_top_8_4_2() {
test_stacked_porep_circuit::<DiskTree<PoseidonHasher, U8, U4, U2>>(22, 1_346_982);
} | rust_cleaned_test_functions.jsonl/103092 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 81
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
11191,
5898,
666,
37268,
33201,
90456,
10426,
62,
23,
62,
19,
62,
17,
368,
341,
262,
1273,
1261,
11191,
620,
460,
79,
666,
37268,
27638,
47583,
6533,
21604,
960,
90456,
6370,
261,
11,
547,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tx_extra_outputs() {
// Check that we correctly handle existing outputs
let mut tx = Transaction { version: 2, lock_time: 0, input: vec![TxIn {
previous_output: OutPoint::new(Txid::from_hash(Sha256dHash::default()), 0), script_sig: Script::new(), witness: Vec::new(), sequence: 0,
}], output: vec![TxOut {
script_pubkey: Builder::new().push_int(1).into_script(), value: 1000
}] };
let orig_wtxid = tx.wtxid();
let orig_weight = tx.get_weight();
assert_eq!(orig_weight / 4, 61);
// Input value of the output value + fee - 1 should fail:
assert!(maybe_add_change_output(&mut tx, 1000 + 61 + 100 - 1, 400, 250, Builder::new().push_int(2).into_script()).is_err());
assert_eq!(tx.wtxid(), orig_wtxid); // Failure doesn't change the transaction
assert!(maybe_add_change_output(&mut tx, 1000 + 61 + 100, 400, 250, Builder::new().push_int(2).into_script()).is_ok());
assert_eq!(tx.wtxid(), orig_wtxid);
assert!(maybe_add_change_output(&mut tx, 1000 + 61 + 100 + 546 + 9, 400, 250, Builder::new().push_int(2).into_script()).is_ok());
assert_eq!(tx.wtxid(), orig_wtxid);
assert!(maybe_add_change_output(&mut tx, 1000 + 61 + 100 + 546 + 10, 400, 250, Builder::new().push_int(2).into_script()).is_ok());
assert_eq!(tx.output.len(), 2);
assert_eq!(tx.output[1].value, 546);
assert_eq!(tx.output[1].script_pubkey, Builder::new().push_int(2).into_script());
assert_eq!(tx.get_weight() - orig_weight, 40); // Weight difference matches what we had to add above
tx.output.pop();
assert_eq!(tx.wtxid(), orig_wtxid); // The only change is the addition of one output.
} | rust_cleaned_test_functions.jsonl/74237 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 632
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17805,
31858,
35189,
368,
341,
197,
197,
322,
4248,
429,
582,
12440,
3705,
6350,
16275,
198,
197,
10217,
5206,
9854,
284,
17869,
314,
2319,
25,
220,
17,
11,
5296,
3009,
25,
220,
15,
11,
1946,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_writer_schema() {
let valid_reader = string_array_schema();
let invalid_reader = string_map_schema();
assert!(SchemaCompatibility::can_read(
&string_array_schema(),
&valid_reader
));
assert_eq!(
SchemaCompatibility::can_read(&string_array_schema(), &invalid_reader),
false
);
} | rust_cleaned_test_functions.jsonl/21774 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 201
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
28908,
25371,
368,
341,
286,
1077,
2697,
22306,
284,
914,
3858,
25371,
543,
286,
1077,
8318,
22306,
284,
914,
5376,
25371,
1428,
286,
2060,
10297,
8632,
85880,
486,
4814,
6443,
1006,
310,
60... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_inprocessfork_exec() {
let provider = StdShMemProvider::new().unwrap();
let mut harness = |_buf: &NopInput| ExitKind::Ok;
let mut in_process_fork_executor = InProcessForkExecutor::<_, NopInput, (), (), _> {
harness_fn: &mut harness,
shmem_provider: provider,
observers: tuple_list!(),
phantom: PhantomData,
};
let input = NopInput {};
assert!(in_process_fork_executor
.run_target(&mut (), &mut (), &mut (), &input)
.is_ok());
} | rust_cleaned_test_functions.jsonl/94888 | {
"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,
1243,
4630,
44738,
18430,
368,
341,
286,
1077,
9109,
284,
42517,
2016,
18816,
5179,
486,
931,
1005,
15454,
1428,
286,
1077,
5206,
32408,
284,
70886,
5909,
25,
609,
45,
453,
2505,
91,
18995,
10629,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sorted_vector() {
let mut v = vec![1, 1, 2, 2, 2, 3];
assert_eq!(Solution::remove_duplicates(&mut v), 3);
assert_eq!(v, vec![1, 2, 3]);
} | rust_cleaned_test_functions.jsonl/74288 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41277,
12247,
368,
341,
286,
1077,
5206,
348,
284,
7486,
20703,
16,
11,
220,
16,
11,
220,
17,
11,
220,
17,
11,
220,
17,
11,
220,
18,
935,
286,
2060,
10714,
10297,
36842,
486,
5399,
75051,
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_pretty_format_timestamp_nanosecond() {
let expected = vec![
"+-------------------------------+",
"| f |",
"+-------------------------------+",
"| 1970-01-01 00:00:00.011111111 |",
"| |",
"+-------------------------------+",
];
check_datetime!(TimestampNanosecondArray, 11111111, expected);
} | rust_cleaned_test_functions.jsonl/5244 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 254
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
21322,
8955,
23073,
73936,
960,
1297,
368,
341,
286,
1077,
3601,
284,
7486,
90515,
310,
6630,
27814,
4421,
10,
756,
310,
25203,
282,
6526,
760,
756,
310,
6630,
27814,
4421,
10,
756,
310,
25... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fetch_module_meta_data_1() {
/*recompile ts file*/
let (_temp_dir, deno_dir) = test_setup();
let cwd = std::env::current_dir().unwrap();
let cwd_string = String::from(cwd.to_str().unwrap()) + "/";
tokio_util::init(|| {
// Test failure case.
let specifier = "hello.ts";
let referrer = add_root!("/baddir/badfile.ts");
let r = deno_dir.fetch_module_meta_data(specifier, referrer, false);
assert!(r.is_err());
// Assuming cwd is the deno repo root.
let specifier = "./js/main.ts";
let referrer = cwd_string.as_str();
let r = deno_dir.fetch_module_meta_data(specifier, referrer, false);
assert!(r.is_ok());
})
} | rust_cleaned_test_functions.jsonl/83876 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 322
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11803,
10750,
13381,
1769,
62,
16,
368,
341,
262,
1391,
265,
20433,
10591,
1034,
3276,
262,
1077,
5453,
3888,
4334,
11,
3371,
78,
4334,
8,
284,
1273,
21363,
1428,
262,
1077,
46938,
284,
1460,
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... | 2 |
#[test]
fn test_is_solved() {
let mut sudoku = create_sudoku(TEST_VALUES);
assert!(!sudoku.is_solved());
sudoku.solve();
assert!(sudoku.is_solved());
} | rust_cleaned_test_functions.jsonl/58580 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
643,
8731,
368,
341,
286,
1077,
5206,
90809,
284,
1855,
643,
68302,
50320,
58662,
317,
286,
2060,
0,
3471,
82,
68302,
2079,
643,
8731,
1423,
286,
90809,
69102,
543,
286,
2060,
10297,
82,
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 |
#[test]
fn test_encode_4() {
let mut ge = GammaEncoder::new();
ge.encode(4);
let enc = ge.encoded();
assert_eq!(enc.len(), 5);
assert_eq!(enc[0..5].as_u8(), (0b110_00, 5));
assert_eq!(ge.elements(), 1);
let mut dec = GammaDecoder::new(&ge.encoded());
let val = dec.decode();
assert_eq!(val, Some(4));
} | rust_cleaned_test_functions.jsonl/49059 | {
"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,
11224,
62,
19,
368,
341,
286,
1077,
5206,
3893,
284,
57682,
19921,
486,
931,
543,
286,
3893,
17313,
7,
19,
1215,
715,
286,
1077,
3209,
284,
3893,
13,
19329,
543,
286,
2060,
10714,
10297,
954,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.