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_lease_length_try_from_fidl() {
let both = fidl_fuchsia_net_dhcp::LeaseLength {
default: Some(42),
max: Some(42),
..fidl_fuchsia_net_dhcp::LeaseLength::EMPTY
};
let with_default = fidl_fuchsia_net_dhcp::LeaseLength {
default: Some(42),
max: None,
..fidl_fuchsia_net_dhcp::LeaseLength::EMPTY
};
let with_max = fidl_fuchsia_net_dhcp::LeaseLength {
default: None,
max: Some(42),
..fidl_fuchsia_net_dhcp::LeaseLength::EMPTY
};
let neither = fidl_fuchsia_net_dhcp::LeaseLength {
default: None,
max: None,
..fidl_fuchsia_net_dhcp::LeaseLength::EMPTY
};
assert_eq!(
LeaseLength::try_from_fidl(both).unwrap(),
LeaseLength { default_seconds: 42, max_seconds: 42 }
);
assert_eq!(
LeaseLength::try_from_fidl(with_default).unwrap(),
LeaseLength { default_seconds: 42, max_seconds: 42 }
);
assert!(LeaseLength::try_from_fidl(with_max).is_err());
assert!(LeaseLength::try_from_fidl(neither).is_err());
} | rust_cleaned_test_functions.jsonl/68085 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 665
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
1623,
5118,
53283,
5673,
761,
55464,
368,
341,
286,
1077,
2176,
284,
32104,
75,
761,
73391,
19722,
814,
62169,
486,
2304,
519,
4373,
341,
310,
1638,
25,
4329,
7,
19,
17,
1326,
310,
1932,
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_aff_proj_sidhex() {
fn aux(a_sk: MyASc) {
let a_sk = a_sk.0;
let e = (a(), b());
let ab = (paxy(), qaxy());
let pab = (xpa(), xqa(), xra());
let a_steps = 4; // EA/2;
let ap_steps = 2; // EA;
let aff_jinv = a_sidh_isoex(a_sk, e, ab, a_steps);
let jinv = a_sharedkey(pab, a_sk, ap_steps);
assert_eq!(jinv,aff_jinv);
}
QuickCheck::new()
.tests(1)
.quickcheck(aux as fn(MyASc));
} | rust_cleaned_test_functions.jsonl/11579 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 218
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48914,
49453,
53044,
17308,
368,
341,
262,
5168,
10047,
2877,
33811,
25,
3017,
1911,
66,
8,
341,
10217,
264,
33811,
284,
264,
33811,
13,
15,
280,
10217,
384,
284,
320,
64,
1507,
293,
1423,
10217... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_verify_hash_unfrozen() {
let (genesis_config, _mint_keypair) = create_genesis_config(2_000);
let bank = Bank::new_for_tests(&genesis_config);
assert!(bank.verify_hash());
} | rust_cleaned_test_functions.jsonl/28884 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35638,
8950,
4907,
69,
42240,
368,
341,
286,
1077,
320,
77894,
5332,
11,
716,
67791,
3097,
12670,
8,
284,
1855,
16322,
13774,
5332,
7,
17,
62,
15,
15,
15,
317,
286,
1077,
6073,
284,
8547,
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 |
#[test]
fn test_perm_to_cycles() {
assert_eq!(perm_to_cycles(&[1, 2, 0]), tvec!(tvec!(0, 1, 2)));
assert_eq!(perm_to_cycles(&[2, 0, 1]), tvec!(tvec!(0, 2, 1)));
assert_eq!(perm_to_cycles(&[1, 2, 3, 0]), tvec!(tvec!(0, 1, 2, 3)));
assert_eq!(perm_to_cycles(&[3, 0, 1, 2]), tvec!(tvec!(0, 3, 2, 1)));
assert_eq!(perm_to_cycles(&[3, 1, 2, 0, 4]), tvec!(tvec!(0, 3)));
} | rust_cleaned_test_functions.jsonl/126322 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 241
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31961,
2346,
68970,
368,
341,
286,
2060,
10714,
10297,
19913,
2346,
68970,
2099,
58,
16,
11,
220,
17,
11,
220,
15,
9719,
259,
4083,
10297,
83,
4083,
10297,
15,
11,
220,
16,
11,
220,
17,
4945,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_stateful() {
let mut rng = Rng::new(0x2b4610ec42f20b13);
assert_eq!(rng.next(), 12531479686729921902);
assert_eq!(rng.next(), 0xf22b5d124ea05a84);
} | rust_cleaned_test_functions.jsonl/92307 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11257,
4387,
1262,
368,
341,
286,
1077,
5206,
28422,
284,
431,
968,
486,
931,
7,
15,
87,
17,
65,
19,
21,
16,
15,
757,
19,
17,
69,
17,
15,
65,
16,
18,
317,
286,
2060,
10714,
10297,
69890,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_muxer_killq() {
let mut ctx = MuxerTestContext::new("muxer_killq");
let local_port = 1026;
let peer_port_first = 1025;
let peer_port_last = peer_port_first + defs::MUXER_KILLQ_SIZE;
let mut listener = ctx.create_local_listener(local_port);
// Save metrics relevant for this test.
let conns_added = METRICS.vsock.conns_added.count();
let conns_killed = METRICS.vsock.conns_killed.count();
let conns_removed = METRICS.vsock.conns_removed.count();
let killq_resync = METRICS.vsock.killq_resync.count();
for peer_port in peer_port_first..=peer_port_last {
ctx.init_pkt(local_port, peer_port as u32, uapi::VSOCK_OP_REQUEST);
ctx.send();
ctx.notify_muxer();
ctx.recv();
assert_eq!(ctx.pkt.op(), uapi::VSOCK_OP_RESPONSE);
assert_eq!(ctx.pkt.src_port(), local_port);
assert_eq!(ctx.pkt.dst_port(), peer_port as u32);
{
let _stream = listener.accept();
}
ctx.notify_muxer();
ctx.recv();
assert_eq!(ctx.pkt.op(), uapi::VSOCK_OP_SHUTDOWN);
assert_eq!(ctx.pkt.src_port(), local_port);
assert_eq!(ctx.pkt.dst_port(), peer_port as u32);
// connection we schedule for termination.
assert_eq!(
ctx.muxer.killq.is_synced(),
peer_port < peer_port_first + defs::MUXER_KILLQ_SIZE
);
}
assert!(!ctx.muxer.killq.is_synced());
assert!(!ctx.muxer.has_pending_rx());
// Wait for the kill timers to expire.
std::thread::sleep(std::time::Duration::from_millis(
csm_defs::CONN_SHUTDOWN_TIMEOUT_MS,
));
ctx.init_pkt(
local_port,
peer_port_last as u32 + 1,
uapi::VSOCK_OP_REQUEST,
);
ctx.send();
// Check that MUXER_KILLQ_SIZE + 2 connections were added
// done outside of the loop.
assert_eq!(
METRICS.vsock.conns_added.count(),
conns_added + defs::MUXER_KILLQ_SIZE + 2
);
// Check that MUXER_KILLQ_SIZE connections were killed
assert_eq!(
METRICS.vsock.conns_killed.count(),
conns_killed + defs::MUXER_KILLQ_SIZE
);
// No connections should be removed at this point.
assert_eq!(METRICS.vsock.conns_removed.count(), conns_removed);
assert_eq!(METRICS.vsock.killq_resync.count(), killq_resync + 1);
assert!(ctx.muxer.killq.is_synced());
assert!(ctx.muxer.has_pending_rx());
// dying connections in the recent killq sweep.
for _p in peer_port_first..peer_port_last {
ctx.recv();
assert_eq!(ctx.pkt.op(), uapi::VSOCK_OP_RST);
assert_eq!(ctx.pkt.src_port(), local_port);
}
// The connections should have been removed here.
assert_eq!(
METRICS.vsock.conns_removed.count(),
conns_removed + defs::MUXER_KILLQ_SIZE
);
// There should be one more packet in the RX queue: the connection response our request
// that triggered the kill queue sweep.
ctx.recv();
assert_eq!(ctx.pkt.op(), uapi::VSOCK_OP_RESPONSE);
assert_eq!(ctx.pkt.dst_port(), peer_port_last as u32 + 1);
assert!(!ctx.muxer.has_pending_rx());
} | rust_cleaned_test_functions.jsonl/37605 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1847
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
80363,
261,
73327,
80,
368,
341,
286,
1077,
5206,
5635,
284,
386,
2200,
261,
2271,
1972,
486,
931,
445,
75066,
261,
73327,
80,
797,
286,
1077,
2205,
8716,
284,
220,
16,
15,
17,
21,
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... | 3 |
#[test]
fn test_hover_generic_return_impl_trait_has_goto_type_action() {
check_actions(
r#"
trait Foo<T> {}
struct S;
fn foo() -> impl Foo<S> {}
fn main() { let s$0t = foo(); }
"#,
expect![[r#"
[
GoToType(
[
HoverGotoTypeData {
mod_path: "test::Foo",
nav: NavigationTarget {
file_id: FileId(
0,
),
full_range: 0..15,
focus_range: 6..9,
name: "Foo",
kind: Trait,
description: "trait Foo<T>",
},
},
HoverGotoTypeData {
mod_path: "test::S",
nav: NavigationTarget {
file_id: FileId(
0,
),
full_range: 16..25,
focus_range: 23..24,
name: "S",
kind: Struct,
description: "struct S",
},
},
],
),
]
"#]],
);
} | rust_cleaned_test_functions.jsonl/66675 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1301
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53445,
41232,
12511,
21007,
78491,
21778,
97732,
1819,
7931,
368,
341,
286,
1779,
25368,
1006,
310,
435,
2,
698,
29432,
33428,
3125,
29,
5613,
1235,
328,
280,
8822,
15229,
368,
1464,
11605,
33428,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_euclidean_matrix_slice_metric_bad_dim() {
let m = matrix![3.0, 4.0];
let m2 = matrix![1.0, 2.0, 3.0];
let m_slice = MatrixSlice::from_matrix(
&m, [0; 2], 1, 1
);
let m2_slice = MatrixSlice::from_matrix(
&m2, [0; 2], 1, 2
);
MatrixMetric::metric(&Euclidean, &m_slice, &m2_slice);
} | rust_cleaned_test_functions.jsonl/6900 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 227
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2204,
84,
50078,
10193,
26488,
41294,
34199,
10791,
368,
341,
286,
1077,
296,
284,
6172,
20703,
18,
13,
15,
11,
220,
19,
13,
15,
935,
286,
1077,
296,
17,
284,
6172,
20703,
16,
13,
15,
11,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_resign_transaction() {
let rpc_client = RpcClient::new_mock("succeeds".to_string());
let key = Keypair::new();
let to = Pubkey::new_rand();
let blockhash: Hash = "HUu3LwEzGRsUkuJS121jzkPJW39Kq62pXCTmTa1F9jDL"
.parse()
.unwrap();
let prev_tx = system_transaction::create_user_account(&key, &to, 50, blockhash);
let mut tx = system_transaction::create_user_account(&key, &to, 50, blockhash);
rpc_client.resign_transaction(&mut tx, &[&key]).unwrap();
assert_ne!(prev_tx, tx);
assert_ne!(prev_tx.signatures, tx.signatures);
assert_ne!(
prev_tx.message().recent_blockhash,
tx.message().recent_blockhash
);
} | rust_cleaned_test_functions.jsonl/72848 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 379
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4918,
622,
28884,
368,
341,
286,
1077,
35596,
8179,
284,
79961,
2959,
486,
931,
34134,
445,
82,
29264,
82,
3263,
983,
3904,
5231,
286,
1077,
1376,
284,
6569,
1082,
1310,
486,
931,
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_mutex_guard_debug_not_recurse() {
let mutex = Mutex::new(42);
let guard = mutex.try_lock().unwrap();
let _ = format!("{:?}", guard);
} | rust_cleaned_test_functions.jsonl/133828 | {
"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,
14204,
36796,
15446,
7913,
1288,
2352,
325,
368,
341,
262,
1077,
30863,
284,
66215,
486,
931,
7,
19,
17,
317,
262,
1077,
7616,
284,
30863,
48779,
9818,
1005,
15454,
543,
262,
1077,
716,
284,
356... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_string() {
assert_eq!(
String::from_record(&Record::String("foo".to_string())),
Ok("foo".to_string())
);
assert_eq!(
String::from_record(&Record::Bool(true)),
Err("not a string Bool(true)".to_string())
);
} | rust_cleaned_test_functions.jsonl/8013 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 132
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
368,
341,
262,
2060,
10714,
33673,
286,
923,
486,
1499,
14192,
2099,
6471,
486,
703,
445,
7975,
3263,
983,
3904,
73727,
286,
7622,
445,
7975,
3263,
983,
3904,
2398,
262,
1439,
262,
2060,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_connect_to_best_network() {
let mut exec = fasync::Executor::new().expect("failed to create an executor");
let mut test_values = test_setup("test_client_event_with_saved_network", &mut exec, true);
// Setup the IfaceManager so that it has a disconnected iface.
{
let iface_manager = test_values.iface_manager.clone();
let iface_manager_fut = iface_manager.lock();
pin_mut!(iface_manager_fut);
let mut iface_manager = match exec.run_until_stalled(&mut iface_manager_fut) {
Poll::Ready(iface_manager) => iface_manager,
Poll::Pending => panic!("expected to acquire iface_manager lock"),
};
iface_manager.record_idle_client(0);
}
// Record some results to show that we have previously connected to this network and that
// we have seen it in a scan result.
let network_id = NetworkIdentifier::new(b"foobar".to_vec(), SecurityType::None);
let credential = Credential::None;
exec.run_singlethreaded(test_values.saved_networks.record_connect_result(
network_id,
&credential,
fidl_sme::ConnectResultCode::Success,
));
let selector =
Arc::new(network_selection::NetworkSelector::new(test_values.saved_networks));
selector.update_scan_results(vec![types::ScanResult {
id: types::NetworkIdentifier {
ssid: b"foobar".to_vec(),
type_: types::SecurityType::None,
},
entries: vec![types::Bss {
bssid: [0, 1, 2, 3, 4, 5],
rssi: -20,
frequency: 2400,
timestamp_nanos: 0,
}],
compatibility: types::Compatibility::Supported,
}]);
let fut = connect_to_best_network(test_values.iface_manager, selector);
pin_mut!(fut);
assert_variant!(exec.run_until_stalled(&mut fut), Poll::Ready(()));
assert_variant!(
exec.run_until_stalled(&mut test_values.sme_stream.next()),
Poll::Ready(Some(Ok(fidl_sme::ClientSmeRequest::Connect {..})))
)
} | rust_cleaned_test_functions.jsonl/42362 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1047
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15720,
2346,
33101,
20966,
368,
341,
286,
1077,
5206,
3883,
284,
282,
7692,
486,
25255,
486,
931,
1005,
17119,
445,
16091,
311,
1855,
458,
31558,
797,
286,
1077,
5206,
1273,
9146,
284,
1273,
21363... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_push_updates_no_such_remote() {
let settings = testutils::user_settings();
let temp_dir = tempfile::tempdir().unwrap();
let setup = set_up_push_repos(&settings, &temp_dir);
let result = git::push_updates(
&setup.jj_repo.store().git_repo().unwrap(),
"invalid-remote",
&[GitRefUpdate {
qualified_name: "refs/heads/main".to_string(),
force: false,
new_target: Some(setup.new_commit.id().clone()),
}],
);
assert!(matches!(result, Err(GitPushError::NoSuchRemote(_))));
} | rust_cleaned_test_functions.jsonl/96075 | {
"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,
14218,
57829,
6536,
643,
1387,
36425,
368,
341,
262,
1077,
5003,
284,
1273,
6031,
486,
872,
10853,
543,
262,
1077,
2730,
4334,
284,
54819,
486,
3888,
3741,
1005,
15454,
543,
262,
1077,
6505,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_command() {
let test_commands = app("test", "desc", "version");
let default_keypair = Keypair::new();
let (default_keypair_file, mut tmp_file) = make_tmp_file();
write_keypair(&default_keypair, tmp_file.as_file_mut()).unwrap();
let test_cluster_version = test_commands
.clone()
.get_matches_from(vec!["test", "cluster-version"]);
assert_eq!(
parse_command(&test_cluster_version, &default_keypair_file, None).unwrap(),
CliCommandInfo {
command: CliCommand::ClusterVersion,
signers: vec![],
}
);
let test_fees = test_commands.clone().get_matches_from(vec!["test", "fees"]);
assert_eq!(
parse_command(&test_fees, &default_keypair_file, None).unwrap(),
CliCommandInfo {
command: CliCommand::Fees,
signers: vec![],
}
);
let slot = 100;
let test_get_block_time =
test_commands
.clone()
.get_matches_from(vec!["test", "block-time", &slot.to_string()]);
assert_eq!(
parse_command(&test_get_block_time, &default_keypair_file, None).unwrap(),
CliCommandInfo {
command: CliCommand::GetBlockTime { slot },
signers: vec![],
}
);
let test_get_epoch_info = test_commands
.clone()
.get_matches_from(vec!["test", "epoch-info"]);
assert_eq!(
parse_command(&test_get_epoch_info, &default_keypair_file, None).unwrap(),
CliCommandInfo {
command: CliCommand::GetEpochInfo {
commitment_config: CommitmentConfig::recent(),
},
signers: vec![],
}
);
let test_get_genesis_hash = test_commands
.clone()
.get_matches_from(vec!["test", "genesis-hash"]);
assert_eq!(
parse_command(&test_get_genesis_hash, &default_keypair_file, None).unwrap(),
CliCommandInfo {
command: CliCommand::GetGenesisHash,
signers: vec![],
}
);
let test_get_slot = test_commands.clone().get_matches_from(vec!["test", "slot"]);
assert_eq!(
parse_command(&test_get_slot, &default_keypair_file, None).unwrap(),
CliCommandInfo {
command: CliCommand::GetSlot {
commitment_config: CommitmentConfig::recent(),
},
signers: vec![],
}
);
let test_total_supply = test_commands
.clone()
.get_matches_from(vec!["test", "total-supply"]);
assert_eq!(
parse_command(&test_total_supply, &default_keypair_file, None).unwrap(),
CliCommandInfo {
command: CliCommand::TotalSupply {
commitment_config: CommitmentConfig::recent(),
},
signers: vec![],
}
);
let test_transaction_count = test_commands
.clone()
.get_matches_from(vec!["test", "transaction-count"]);
assert_eq!(
parse_command(&test_transaction_count, &default_keypair_file, None).unwrap(),
CliCommandInfo {
command: CliCommand::GetTransactionCount {
commitment_config: CommitmentConfig::recent(),
},
signers: vec![],
}
);
let test_ping = test_commands.clone().get_matches_from(vec![
"test",
"ping",
"-i",
"1",
"-c",
"2",
"-t",
"3",
"--confirmed",
]);
assert_eq!(
parse_command(&test_ping, &default_keypair_file, None).unwrap(),
CliCommandInfo {
command: CliCommand::Ping {
lamports: 1,
interval: Duration::from_secs(1),
count: Some(2),
timeout: Duration::from_secs(3),
commitment_config: CommitmentConfig::default(),
},
signers: vec![default_keypair.into()],
}
);
} | rust_cleaned_test_functions.jsonl/88389 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2413
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
10811,
368,
341,
286,
1077,
1273,
44151,
284,
906,
445,
1944,
497,
330,
8614,
497,
330,
4366,
797,
286,
1077,
1638,
3097,
12670,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
320,
2258... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_incircle() {
let from = vec![-1f64, -1.0];
let to = vec![1f64, 1.0];
let p_left = vec![-::std::f64::MIN_POSITIVE, ::std::f64::MIN_POSITIVE];
let p_right = vec![::std::f64::MIN_POSITIVE, -::std::f64::MIN_POSITIVE];
let p_query = vec![2.0, 2.0];
assert!(incircle(&from, &p_left, &to, &p_query) > 0.0);
assert!(incircle(&from, &to, &p_right, &p_query) > 0.0);
} | rust_cleaned_test_functions.jsonl/122548 | {
"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,
1243,
25857,
368,
341,
286,
1077,
504,
284,
7486,
0,
7609,
16,
69,
21,
19,
11,
481,
16,
13,
15,
935,
286,
1077,
311,
284,
7486,
20703,
16,
69,
21,
19,
11,
220,
16,
13,
15,
935,
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_default() {
let header = Builder::default().build();
assert_eq!(header.file_format(), FileFormat::default());
assert!(header.infos().is_empty());
assert!(header.filters().is_empty());
assert!(header.formats().is_empty());
assert!(header.alternative_alleles().is_empty());
assert!(header.assembly().is_none());
assert!(header.contigs().is_empty());
assert!(header.meta().is_empty());
assert!(header.samples().is_empty());
assert!(header.pedigrees().is_empty());
assert!(header.pedigree_db().is_none());
assert!(header.sample_names().is_empty());
} | rust_cleaned_test_functions.jsonl/89163 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 288
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9993,
368,
341,
286,
1077,
4247,
284,
20626,
486,
2258,
1005,
5834,
1428,
286,
2060,
10714,
10297,
2708,
9715,
8955,
1507,
2887,
4061,
486,
2258,
1423,
286,
2060,
10297,
2708,
30957,
436,
1005,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_combine_same_key() {
let mut combined = super::combine(
TestInterceptor {
metadata_to_append: ("key", "value_0"),
},
TestInterceptor {
metadata_to_append: ("key", "value_1"),
},
);
let initial = tonic::Request::new(());
let processed = combined.call(initial).unwrap();
let metadata = processed.metadata();
assert_eq!(2, metadata.len());
assert_eq!(
vec!["value_0", "value_1"],
metadata.get_all("key").iter().collect::<Vec<_>>()
);
} | rust_cleaned_test_functions.jsonl/65697 | {
"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,
72374,
33574,
3097,
368,
341,
262,
1077,
5206,
10856,
284,
2256,
486,
63136,
1006,
286,
3393,
32786,
341,
310,
11160,
2346,
26041,
25,
3489,
792,
497,
330,
957,
62,
15,
4461,
286,
1153,
286,
339... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rule_with_from_invalid_range_1() {
assert_eq!(
parse_str_to_rules("pass in proto tcp from range 0:5;"),
Err(Error::Invalid(InvalidReason::InvalidPortRange))
);
} | rust_cleaned_test_functions.jsonl/29480 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 111
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21124,
6615,
5673,
31433,
9698,
62,
16,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
2895,
2346,
21407,
445,
6385,
304,
18433,
28051,
504,
2088,
220,
15,
25,
20,
26,
4461,
310,
15495,
37396,
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 |
#[test]
fn test_parse_failure() -> Result<(), Box<dyn std::error::Error>> {
let mut cmd = Command::cargo_bin("jj")?;
let assert = cmd.arg("_").write_stdin("}").assert();
assert.failure().code(4).stdout("");
Ok(())
} | rust_cleaned_test_functions.jsonl/43236 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
43618,
368,
1464,
5714,
68843,
8261,
92846,
1460,
486,
841,
486,
1454,
2452,
341,
262,
1077,
5206,
5439,
284,
7348,
486,
66715,
21816,
445,
38811,
899,
37445,
262,
1077,
2060,
284,
5439,
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... | 2 |
#[test]
fn test_parsing_ends_when_input_callback_returns_empty() {
let mut parser = Parser::new();
parser.set_language(get_language("javascript")).unwrap();
let mut i = 0;
let source = b"abcdefghijklmnoqrs";
let tree = parser
.parse_with(
&mut |offset, _| {
i += 1;
if offset >= 6 {
b""
} else {
&source[offset..usize::min(source.len(), offset + 3)]
}
},
None,
)
.unwrap();
assert_eq!(tree.root_node().end_byte(), 6);
} | rust_cleaned_test_functions.jsonl/15865 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 343
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
28598,
90729,
47636,
5898,
12519,
58900,
15124,
368,
341,
262,
1077,
5206,
6729,
284,
21102,
486,
931,
543,
262,
6729,
980,
29021,
5433,
29021,
445,
14073,
15197,
15454,
543,
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... | 2 |
#[test]
fn test_everything_becomes_lowercase() {
test("caSe", "cs ae");
test("cAsE", "cs ae");
test("CASE", "cs ae");
} | rust_cleaned_test_functions.jsonl/27430 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 68
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64048,
1596,
880,
757,
20347,
93129,
368,
341,
262,
1273,
445,
924,
1514,
497,
330,
4837,
41856,
797,
262,
1273,
445,
66,
2121,
36,
497,
330,
4837,
41856,
797,
262,
1273,
445,
40371,
497,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_berlekamp_massey_fp() {
for p in SMALL_PRIMES.iter().map(|&p| p as i64) {
for a in 1..p {
let [x, y] = berlekamp_massey_fp(a, p);
assert!(0 <= x && x <= (p as f64).sqrt() as i64 && x * x != p);
assert!(y.abs() <= (p as f64).sqrt() as i64);
assert_eq!(x.rem_euclid(p), (a * y).rem_euclid(p));
}
}
} | rust_cleaned_test_functions.jsonl/57318 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 263
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88165,
75776,
1121,
81641,
8506,
34160,
368,
341,
286,
369,
281,
304,
49197,
10571,
1791,
1570,
19471,
1005,
2186,
22428,
5,
79,
91,
281,
438,
600,
21,
19,
8,
341,
310,
369,
264,
304,
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... | 5 |
#[test]
fn test_default() {
{
let sensitive_data: SensitiveData = Default::default();
let expected: TPM2B_SENSITIVE_DATA = Default::default();
let actual = TPM2B_SENSITIVE_DATA::try_from(sensitive_data).unwrap();
assert_eq!(expected.size, actual.size);
assert_eq!(
expected.buffer.len(),
actual.buffer.len(),
"Buffers don't have the same length"
);
assert!(
expected
.buffer
.iter()
.zip(actual.buffer.iter())
.all(|(a, b)| a == b),
"Buffers are not equal"
);
}
{
let tss_sensitive_data: TPM2B_SENSITIVE_DATA = Default::default();
let expected: SensitiveData = Default::default();
let actual = SensitiveData::try_from(tss_sensitive_data).unwrap();
assert_eq!(expected, actual);
}
} | rust_cleaned_test_functions.jsonl/24888 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 565
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9993,
368,
341,
286,
341,
310,
1077,
16216,
1769,
25,
328,
18723,
1043,
284,
7899,
486,
2258,
543,
310,
1077,
3601,
25,
63644,
17,
33,
38924,
44350,
7896,
284,
7899,
486,
2258,
543,
310,
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_truncated() {
let cmd = RelayCmd::TRUNCATED;
assert_eq!(Into::<u8>::into(cmd), 9_u8);
msg(cmd, "08", &msg::Truncated::new(8.into()).into());
} | rust_cleaned_test_functions.jsonl/66347 | {
"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,
3547,
38007,
368,
341,
262,
1077,
5439,
284,
46172,
15613,
486,
2378,
12633,
9005,
280,
262,
2060,
10714,
10297,
26591,
27638,
84,
23,
6831,
18122,
14160,
701,
220,
24,
7300,
23,
626,
262,
3750,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_truncated_psk_offer() {
let ext = ClientExtension::PresharedKey(PresharedKeyOffer {
identities: vec![PresharedKeyIdentity::new(vec![3, 4, 5], 123456)],
binders: vec![PresharedKeyBinder::new(vec![1, 2, 3])],
});
let mut enc = ext.get_encoding();
println!("testing {:?} enc {:?}", ext, enc);
for l in 0..enc.len() {
if l == 9 {
continue;
}
put_u16(l as u16, &mut enc[4..]);
let rc = ClientExtension::read_bytes(&enc);
assert!(rc.is_none());
}
} | rust_cleaned_test_functions.jsonl/100970 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 275
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3547,
38007,
620,
4886,
67814,
368,
341,
262,
1077,
1303,
284,
8423,
12049,
486,
47,
2488,
1605,
1592,
5304,
2488,
1605,
1592,
39462,
341,
286,
39421,
25,
7486,
20703,
47,
2488,
1605,
1592,
18558,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_escape_comma() {
let csv = r#"column_1,column_2,column_3
-86.64408227,"Autauga, Alabama, US",11
-86.64408227,"Autauga, Alabama, US",12
"#;
let file = Cursor::new(csv);
let df = CsvReader::new(file).finish().unwrap();
assert_eq!(df.shape(), (2, 3));
assert!(df
.column("column_3")
.unwrap()
.series_equal(&Series::new("column_3", &[11, 12])));
} | rust_cleaned_test_functions.jsonl/57564 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 232
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21832,
2965,
1728,
368,
341,
286,
1077,
13147,
284,
435,
55543,
6229,
62,
16,
51169,
62,
17,
51169,
62,
18,
198,
12,
23,
21,
13,
21,
19,
19,
15,
23,
17,
17,
22,
1335,
32,
15999,
36960,
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_bank_forks_descendants() {
let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(10_000);
let bank = Bank::new(&genesis_config);
let mut bank_forks = BankForks::new(bank);
let bank0 = bank_forks[0].clone();
let bank = Bank::new_from_parent(&bank0, &Pubkey::default(), 1);
bank_forks.insert(bank);
let bank = Bank::new_from_parent(&bank0, &Pubkey::default(), 2);
bank_forks.insert(bank);
let descendants = bank_forks.descendants();
let children: HashSet<u64> = [1u64, 2u64].to_vec().into_iter().collect();
assert_eq!(children, *descendants.get(&0).unwrap());
assert!(descendants[&1].is_empty());
assert!(descendants[&2].is_empty());
} | rust_cleaned_test_functions.jsonl/30577 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 341
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35733,
761,
73302,
10986,
28310,
368,
341,
286,
1077,
40788,
2648,
1731,
314,
59366,
5332,
11,
5241,
335,
284,
1855,
16322,
13774,
5332,
7,
16,
15,
62,
15,
15,
15,
317,
286,
1077,
6073,
284,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_object() {
assert_eq!(from_str("{"), Err(SyntaxError(EOFWhileParsingObject, 1, 2)));
assert_eq!(from_str("{ "), Err(SyntaxError(EOFWhileParsingObject, 1, 3)));
assert_eq!(from_str("{1"), Err(SyntaxError(KeyMustBeAString, 1, 2)));
assert_eq!(from_str("{ \"a\""), Err(SyntaxError(EOFWhileParsingObject, 1, 6)));
assert_eq!(from_str("{\"a\""), Err(SyntaxError(EOFWhileParsingObject, 1, 5)));
assert_eq!(from_str("{\"a\" "), Err(SyntaxError(EOFWhileParsingObject, 1, 6)));
assert_eq!(from_str("{\"a\" 1"), Err(SyntaxError(ExpectedColon, 1, 6)));
assert_eq!(from_str("{\"a\":"), Err(SyntaxError(EOFWhileParsingValue, 1, 6)));
assert_eq!(from_str("{\"a\":1"), Err(SyntaxError(EOFWhileParsingObject, 1, 7)));
assert_eq!(from_str("{\"a\":1 1"), Err(SyntaxError(InvalidSyntax, 1, 8)));
assert_eq!(from_str("{\"a\":1,"), Err(SyntaxError(EOFWhileParsingObject, 1, 8)));
assert_eq!(from_str("{}").unwrap(), mk_object(&[]));
assert_eq!(from_str("{\"a\": 3}").unwrap(),
mk_object(&[("a".to_string(), U64(3))]));
assert_eq!(from_str(
"{ \"a\": null, \"b\" : true }").unwrap(),
mk_object(&[
("a".to_string(), Null),
("b".to_string(), Boolean(true))]));
assert_eq!(from_str("\n{ \"a\": null, \"b\" : true }\n").unwrap(),
mk_object(&[
("a".to_string(), Null),
("b".to_string(), Boolean(true))]));
assert_eq!(from_str(
"{\"a\" : 1.0 ,\"b\": [ true ]}").unwrap(),
mk_object(&[
("a".to_string(), F64(1.0)),
("b".to_string(), Array(vec![Boolean(true)]))
]));
assert_eq!(from_str(
"{\
\"a\": 1.0, \
\"b\": [\
true,\
\"foo\\nbar\", \
{ \"c\": {\"d\": null} } \
]\
}").unwrap(),
mk_object(&[
("a".to_string(), F64(1.0)),
("b".to_string(), Array(vec![
Boolean(true),
String("foo\nbar".to_string()),
mk_object(&[
("c".to_string(), mk_object(&[("d".to_string(), Null)]))
])
]))
]));
} | rust_cleaned_test_functions.jsonl/41705 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1644
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
5314,
368,
341,
286,
2060,
10714,
10297,
1499,
2895,
13976,
3975,
981,
15495,
93549,
1454,
7,
23483,
7983,
68839,
1190,
11,
220,
16,
11,
220,
17,
4945,
286,
2060,
10714,
10297,
1499,
2895,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_versions_from_str() {
test_protoset_contains_versions!(&[], "");
test_protoset_contains_versions!(&[1], "1");
test_protoset_contains_versions!(&[1, 2], "1,2");
test_protoset_contains_versions!(&[1, 2, 3], "1-3");
test_protoset_contains_versions!(&[0, 1], "0-1");
test_protoset_contains_versions!(&[1, 2, 5], "1-2,5");
test_protoset_contains_versions!(&[1, 3, 4, 5], "1,3-5");
test_protoset_contains_versions!(&[42, 55, 56, 57, 58], "42,55-58");
} | rust_cleaned_test_functions.jsonl/105765 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 276
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
65148,
5673,
2895,
368,
341,
286,
1273,
22357,
436,
295,
63598,
65148,
0,
2099,
12995,
14498,
286,
1273,
22357,
436,
295,
63598,
65148,
0,
2099,
58,
16,
1125,
330,
16,
797,
286,
1273,
22357,
436... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_zero_eq_negative_zero() {
let zero: Decimal = 0.into();
assert!(zero == zero);
assert!(-zero == zero);
assert!(zero == -zero);
} | rust_cleaned_test_functions.jsonl/84863 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 73
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19359,
10714,
53865,
19359,
368,
341,
262,
1077,
7168,
25,
26728,
284,
220,
15,
39860,
1428,
262,
2060,
10297,
14154,
621,
7168,
317,
262,
2060,
0,
4080,
14154,
621,
7168,
317,
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
] | 1 |
#[test]
fn test_len_char_add() {
let input = vec![
vec!["(1".to_string()],
vec!["(2a".to_string()],
vec!["(3bC".to_string()],
vec!["(4d f".to_string()],
];
let result = vec![
Some("(1)".to_string()),
Some("(2a)".to_string()),
None,
None,
];
let result = run(input, result);
dbg!(&result);
assert_eq!(result[0], "(1)".to_string());
assert_eq!(result[1], "(2a)".to_string());
assert_eq!(result[2], "(3bC)".to_string());
assert_eq!(result[3], "(4d f)".to_string());
} | rust_cleaned_test_functions.jsonl/92578 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 253
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6043,
9232,
2891,
368,
341,
220,
1077,
1946,
284,
7486,
90515,
262,
7486,
0,
1183,
7,
16,
3263,
983,
3904,
73845,
262,
7486,
0,
1183,
7,
17,
64,
3263,
983,
3904,
73845,
262,
7486,
0,
1183,
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_coalesce_aio() {
let mut events = Events::with_capacity(1);
events.sys_events.0.push(kevent!(0x1234, libc::EVFILT_AIO, 0, 42));
events.coalesce(Token(0));
assert!(events.events[0].readiness() == UnixReady::aio().into());
assert!(events.events[0].token() == Token(42));
} | rust_cleaned_test_functions.jsonl/83357 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11393,
73250,
4306,
815,
368,
341,
262,
1077,
5206,
4357,
284,
17627,
486,
4197,
35603,
7,
16,
317,
262,
4357,
34051,
19691,
13,
15,
2552,
7,
440,
684,
10297,
15,
87,
16,
17,
18,
19,
11,
421... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_without_name() {
let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "syntax"
version = "0.0.1"
authors = []
[lib]
test = false
doctest = false
[[test]]
path = "src/test.rs"
"#,
)
.file(
"src/lib.rs",
r#"
pub fn foo() {}
pub fn get_hello() -> &'static str { "Hello" }
"#,
)
.file(
"src/main.rs",
"
extern crate syntax;
fn main() {}
#[test]
fn test() { syntax::foo() }
",
)
.file(
"src/test.rs",
r#"
extern crate syntax;
#[test]
fn external_test() { assert_eq!(syntax::get_hello(), "Hello") }
"#,
)
.build();
p.cargo("test")
.with_status(101)
.with_stderr(
"\
[ERROR] failed to parse manifest at `[..]`
Caused by:
test target test.name is required",
)
.run();
} | rust_cleaned_test_functions.jsonl/95352 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 731
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39904,
1269,
368,
341,
262,
1077,
281,
284,
2390,
741,
286,
659,
1192,
1006,
310,
330,
98228,
73494,
75,
756,
310,
435,
2,
698,
310,
508,
1722,
921,
310,
829,
284,
330,
56193,
698,
310,
2319,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_caps_lock() {
let mut modifier_state: ModifierState = Default::default();
assert!(!modifier_state.is_caps_lock_active());
modifier_state.update(
fidl_fuchsia_ui_input3::KeyEventType::Pressed,
fidl_fuchsia_input::Key::CapsLock,
);
assert!(modifier_state.is_caps_lock_active());
modifier_state.update(
fidl_fuchsia_ui_input3::KeyEventType::Released,
fidl_fuchsia_input::Key::CapsLock,
);
assert!(modifier_state.is_caps_lock_active());
modifier_state.update(
fidl_fuchsia_ui_input3::KeyEventType::Pressed,
fidl_fuchsia_input::Key::CapsLock,
);
assert!(!modifier_state.is_caps_lock_active());
modifier_state.update(
fidl_fuchsia_ui_input3::KeyEventType::Released,
fidl_fuchsia_input::Key::CapsLock,
);
assert!(!modifier_state.is_caps_lock_active());
} | rust_cleaned_test_functions.jsonl/14513 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 491
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
52955,
9818,
368,
341,
286,
1077,
5206,
22739,
4387,
25,
45208,
1397,
284,
7899,
486,
2258,
543,
286,
2060,
0,
3471,
49742,
4387,
2079,
52955,
9818,
12930,
5231,
286,
22739,
4387,
5317,
1006,
310,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_redelegate_consider_balance_changes() {
let mut clock = Clock::default();
let rent = Rent::default();
let rent_exempt_reserve = rent.minimum_balance(StakeState::size_of());
let initial_lamports = 4242424242;
let stake_lamports = rent_exempt_reserve + initial_lamports;
let recipient_address = solana_sdk::pubkey::new_rand();
let authority_address = solana_sdk::pubkey::new_rand();
let vote_address = solana_sdk::pubkey::new_rand();
let vote_account =
vote_state::create_account(&vote_address, &solana_sdk::pubkey::new_rand(), 0, 100);
let stake_address = solana_sdk::pubkey::new_rand();
let stake_account = AccountSharedData::new_data_with_space(
stake_lamports,
&StakeState::Initialized(Meta {
rent_exempt_reserve,
..Meta::auto(&authority_address)
}),
StakeState::size_of(),
&id(),
)
.unwrap();
let mut transaction_accounts = vec![
(stake_address, stake_account),
(vote_address, vote_account),
(
recipient_address,
AccountSharedData::new(1, 0, &system_program::id()),
),
(authority_address, AccountSharedData::default()),
(
sysvar::clock::id(),
account::create_account_shared_data_for_test(&clock),
),
(
sysvar::stake_history::id(),
account::create_account_shared_data_for_test(&StakeHistory::default()),
),
(
stake_config::id(),
config::create_account(0, &stake_config::Config::default()),
),
];
let delegate_instruction_accounts = vec![
AccountMeta {
pubkey: stake_address,
is_signer: false,
is_writable: false,
},
AccountMeta {
pubkey: vote_address,
is_signer: false,
is_writable: false,
},
AccountMeta {
pubkey: sysvar::clock::id(),
is_signer: false,
is_writable: false,
},
AccountMeta {
pubkey: sysvar::stake_history::id(),
is_signer: false,
is_writable: false,
},
AccountMeta {
pubkey: stake_config::id(),
is_signer: false,
is_writable: false,
},
AccountMeta {
pubkey: authority_address,
is_signer: true,
is_writable: false,
},
];
let deactivate_instruction_accounts = vec![
AccountMeta {
pubkey: stake_address,
is_signer: false,
is_writable: false,
},
AccountMeta {
pubkey: sysvar::clock::id(),
is_signer: false,
is_writable: false,
},
AccountMeta {
pubkey: authority_address,
is_signer: true,
is_writable: false,
},
];
let accounts = process_instruction(
&serialize(&StakeInstruction::DelegateStake).unwrap(),
transaction_accounts.clone(),
delegate_instruction_accounts.clone(),
Ok(()),
);
transaction_accounts[0] = (stake_address, accounts[0].clone());
clock.epoch += 1;
transaction_accounts[2] = (
sysvar::clock::id(),
account::create_account_shared_data_for_test(&clock),
);
let accounts = process_instruction(
&serialize(&StakeInstruction::Deactivate).unwrap(),
transaction_accounts.clone(),
deactivate_instruction_accounts.clone(),
Ok(()),
);
transaction_accounts[0] = (stake_address, accounts[0].clone());
clock.epoch += 1;
transaction_accounts[2] = (
sysvar::clock::id(),
account::create_account_shared_data_for_test(&clock),
);
let withdraw_lamports = initial_lamports / 2;
let accounts = process_instruction(
&serialize(&StakeInstruction::Withdraw(withdraw_lamports)).unwrap(),
transaction_accounts.clone(),
vec![
AccountMeta {
pubkey: stake_address,
is_signer: false,
is_writable: false,
},
AccountMeta {
pubkey: recipient_address,
is_signer: false,
is_writable: false,
},
AccountMeta {
pubkey: sysvar::clock::id(),
is_signer: false,
is_writable: false,
},
AccountMeta {
pubkey: sysvar::stake_history::id(),
is_signer: false,
is_writable: false,
},
AccountMeta {
pubkey: authority_address,
is_signer: true,
is_writable: false,
},
],
Ok(()),
);
let expected_balance = rent_exempt_reserve + initial_lamports - withdraw_lamports;
assert_eq!(accounts[0].lamports(), expected_balance);
transaction_accounts[0] = (stake_address, accounts[0].clone());
clock.epoch += 1;
transaction_accounts[2] = (
sysvar::clock::id(),
account::create_account_shared_data_for_test(&clock),
);
let accounts = process_instruction(
&serialize(&StakeInstruction::DelegateStake).unwrap(),
transaction_accounts.clone(),
delegate_instruction_accounts.clone(),
Ok(()),
);
assert_eq!(
stake_from(&accounts[0]).unwrap().delegation.stake,
accounts[0].lamports() - rent_exempt_reserve,
);
transaction_accounts[0] = (stake_address, accounts[0].clone());
clock.epoch += 1;
transaction_accounts[2] = (
sysvar::clock::id(),
account::create_account_shared_data_for_test(&clock),
);
let accounts = process_instruction(
&serialize(&StakeInstruction::Deactivate).unwrap(),
transaction_accounts.clone(),
deactivate_instruction_accounts,
Ok(()),
);
transaction_accounts[0] = (stake_address, accounts[0].clone());
// Out of band deposit
transaction_accounts[0]
.1
.checked_add_lamports(withdraw_lamports)
.unwrap();
clock.epoch += 1;
transaction_accounts[2] = (
sysvar::clock::id(),
account::create_account_shared_data_for_test(&clock),
);
let accounts = process_instruction(
&serialize(&StakeInstruction::DelegateStake).unwrap(),
transaction_accounts,
delegate_instruction_accounts,
Ok(()),
);
assert_eq!(
stake_from(&accounts[0]).unwrap().delegation.stake,
accounts[0].lamports() - rent_exempt_reserve,
);
} | rust_cleaned_test_functions.jsonl/31640 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 4025
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
28227,
31971,
1776,
29396,
47526,
368,
341,
286,
1077,
5206,
8866,
284,
26142,
486,
2258,
543,
286,
1077,
8016,
284,
29737,
486,
2258,
543,
286,
1077,
8016,
95736,
89591,
284,
8016,
57790,
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_point_equal() {
assert_eq!(Point { x: 99, y: 98 }, Point { x: 99, y: 98 });
assert_ne!(Point { x: 99, y: 98 }, Point { x: 99, y: 99 });
} | rust_cleaned_test_functions.jsonl/44986 | {
"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,
6085,
11478,
368,
341,
286,
2060,
10714,
10297,
2609,
314,
856,
25,
220,
24,
24,
11,
379,
25,
220,
24,
23,
2470,
5126,
314,
856,
25,
220,
24,
24,
11,
379,
25,
220,
24,
23,
1625,
286,
2060,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fixed_size_list_array_unequal_children() {
// Construct a value array
let value_data = ArrayData::builder(DataType::Int32)
.len(8)
.add_buffer(Buffer::from(&[0, 1, 2, 3, 4, 5, 6, 7].to_byte_slice()))
.build();
// Construct a list array from the above two
let list_data_type = DataType::FixedSizeList(Box::new(DataType::Int32), 3);
let list_data = ArrayData::builder(list_data_type.clone())
.len(3)
.add_child_data(value_data.clone())
.build();
FixedSizeListArray::from(list_data);
} | rust_cleaned_test_functions.jsonl/11609 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 300
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37839,
2368,
2019,
3858,
62,
2886,
1751,
31206,
368,
341,
286,
442,
18678,
264,
897,
1334,
198,
286,
1077,
897,
1769,
284,
2910,
1043,
486,
17850,
63941,
486,
1072,
18,
17,
340,
310,
659,
2892,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_neuron_remove_all_permissions_of_self() {
local_test_on_sns_subnet(|runtime| async move {
let user = Sender::from_keypair(&TEST_USER1_KEYPAIR);
let account_identifier = AccountIdentifier::from(user.get_principal_id());
let alloc = Tokens::from_tokens(1000).unwrap();
let system_params = NervousSystemParameters {
neuron_claimer_permissions: Some(NeuronPermissionList {
permissions: NeuronPermissionType::all(),
}),
..NervousSystemParameters::with_default_values()
};
let sns_init_payload = SnsInitPayloadsBuilder::new()
.with_ledger_account(account_identifier, alloc)
.with_nervous_system_parameters(system_params)
.build();
let sns_canisters = SnsCanisters::set_up(&runtime, sns_init_payload).await;
let neuron_id = sns_canisters.stake_and_claim_neuron(&user, None).await;
let neuron = sns_canisters.get_neuron(&neuron_id).await;
let subaccount = neuron.subaccount().expect("Error creating the subaccount");
// Assert that the Claimer has been granted all permissions
assert_eq!(neuron.permissions.len(), 1);
let mut neuron_permission =
get_neuron_permission_from_neuron(&neuron, &user.get_principal_id());
neuron_permission.permission_type.sort_unstable();
assert_eq!(
neuron_permission.permission_type,
NeuronPermissionType::all(),
);
sns_canisters
.remove_neuron_permissions(
&user,
&subaccount,
&user.get_principal_id(),
NeuronPermissionType::all(),
)
.await;
let neuron = sns_canisters.get_neuron(&neuron_id).await;
assert_eq!(neuron.permissions.len(), 0);
Ok(())
});
} | rust_cleaned_test_functions.jsonl/107260 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 896
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13925,
36090,
18193,
5705,
44767,
3575,
25637,
368,
341,
262,
2205,
4452,
4470,
643,
4412,
95681,
22428,
22255,
91,
3312,
3271,
341,
286,
1077,
1196,
284,
54610,
486,
1499,
3097,
12670,
2099,
10033,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_different_graph() {
let hw = RefCell::new(CpuHardware::new());
let g1 = RefCell::new(Graph::new());
let g2 = RefCell::new(Graph::new());
let x = 1f32.into_node(&g1, &hw);
let y = 2f32.into_node(&g2, &hw);
let _gx = grad(y, &[x])[0];
} | rust_cleaned_test_functions.jsonl/83564 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82741,
14738,
368,
341,
262,
1077,
31256,
284,
8550,
3599,
486,
931,
3025,
5584,
66862,
486,
931,
1423,
262,
1077,
342,
16,
284,
8550,
3599,
486,
931,
63779,
486,
931,
1423,
262,
1077,
342,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_ascii_whitespace() {
assert_all!(is_ascii_whitespace,
"",
" \t\n\x0c\r",
);
assert_none!(is_ascii_whitespace,
"abcdefghijklmnopqrstuvwxyz",
"ABCDEFGHIJKLMNOQPRSTUVWXYZ",
"0123456789",
"!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
"\x00\x01\x02\x03\x04\x05\x06\x07",
"\x08\x0b\x0e\x0f",
"\x10\x11\x12\x13\x14\x15\x16\x17",
"\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
"\x7f",
);
} | rust_cleaned_test_functions.jsonl/35082 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 410
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
50238,
86175,
368,
341,
286,
2060,
5705,
10297,
285,
50238,
86175,
345,
310,
8324,
310,
330,
1124,
83,
1699,
3462,
15,
66,
12016,
756,
286,
1439,
286,
2060,
31488,
10297,
285,
50238,
86175,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_detailed_user_dict() {
let config = TokenizerConfig {
user_dict_path: Some(&Path::new("resources/detailed_userdic.csv")),
mode: Mode::Normal,
..TokenizerConfig::default()
};
let mut tokenizer = Tokenizer::with_config(config).unwrap();
assert!(tokenizer.user_dict.is_some());
assert!(tokenizer.user_dict_words_idx_data.is_some());
assert!(tokenizer.user_dict_words_data.is_some());
let tokens: Vec<Token> = tokenizer
.tokenize("東京スカイツリーの最寄り駅はとうきょうスカイツリー駅です")
.unwrap();
assert_eq!("東京スカイツリー", tokens[0].text);
assert_eq!(
vec![
"名詞",
"固有名詞",
"一般",
"カスタム名詞",
"*",
"*",
"東京スカイツリー",
"トウキョウスカイツリー",
"トウキョウスカイツリー"
],
tokens[0].detail
);
let token_texts: Vec<&str> = tokens.iter().map(|token| token.text).collect();
assert_eq!(
vec![
"東京スカイツリー",
"の",
"最寄り駅",
"は",
"とうきょうスカイツリー駅",
"です"
],
token_texts
);
} | rust_cleaned_test_functions.jsonl/61450 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 879
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
10111,
3317,
5243,
368,
341,
286,
1077,
2193,
284,
9660,
3135,
2648,
341,
310,
1196,
5243,
2638,
25,
4329,
2099,
1820,
486,
931,
445,
12745,
3446,
10111,
3317,
29680,
11219,
30154,
310,
3856,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hash_idempotent() {
let val64 = 0xdeadbeef_deadbeef_u64;
assert_eq!(hash(&val64), hash(&val64));
let val32 = 0xdeadbeef_u32;
assert_eq!(hash(&val32), hash(&val32));
} | rust_cleaned_test_functions.jsonl/7557 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 118
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
842,
3262,
63532,
368,
341,
286,
1077,
1044,
21,
19,
284,
220,
15,
87,
33754,
1371,
823,
53427,
1371,
823,
7300,
21,
19,
280,
286,
2060,
10714,
10297,
8296,
2099,
831,
21,
19,
701,
5175,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cowrc_clone_make_unique() {
let mut cow0 = Rc::new(75);
let mut cow1 = cow0.clone();
let mut cow2 = cow1.clone();
assert!(75 == *Rc::make_mut(&mut cow0));
assert!(75 == *Rc::make_mut(&mut cow1));
assert!(75 == *Rc::make_mut(&mut cow2));
*Rc::make_mut(&mut cow0) += 1;
*Rc::make_mut(&mut cow1) += 2;
*Rc::make_mut(&mut cow2) += 3;
assert!(76 == *cow0);
assert!(77 == *cow1);
assert!(78 == *cow2);
// none should point to the same backing memory
assert!(*cow0 != *cow1);
assert!(*cow0 != *cow2);
assert!(*cow1 != *cow2);
} | rust_cleaned_test_functions.jsonl/4663 | {
"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,
666,
363,
1287,
54742,
28230,
21218,
368,
341,
286,
1077,
5206,
19362,
15,
284,
81463,
486,
931,
7,
22,
20,
317,
286,
1077,
5206,
19362,
16,
284,
19362,
15,
15997,
543,
286,
1077,
5206,
19362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_num_blocks() {
assert_eq!(num_blocks(0), 0);
assert_eq!(num_blocks(1), 1);
assert_eq!(num_blocks(10), 1);
assert_eq!(num_blocks(BLOCK_SIZE - 1), 1);
assert_eq!(num_blocks(BLOCK_SIZE), 1);
assert_eq!(num_blocks(BLOCK_SIZE + 1), 2);
} | rust_cleaned_test_functions.jsonl/29294 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 163
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4273,
25201,
368,
341,
286,
2060,
10714,
10297,
2413,
25201,
7,
15,
701,
220,
15,
317,
286,
2060,
10714,
10297,
2413,
25201,
7,
16,
701,
220,
16,
317,
286,
2060,
10714,
10297,
2413,
25201,
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_to_from_string() {
let uid = Uid{position: big(0b1_010_1010), site_id: 4, counter: 83};
let serialized = uid.to_string();
let deserialized = Uid::from_str(&serialized).unwrap();
assert!(serialized == "gSoEUw");
assert!(deserialized == uid);
} | rust_cleaned_test_functions.jsonl/58321 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 147
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
5673,
3904,
368,
341,
286,
1077,
14617,
284,
547,
307,
90,
3487,
25,
2409,
7,
15,
65,
16,
62,
15,
16,
15,
62,
16,
15,
16,
15,
701,
2747,
842,
25,
220,
19,
11,
5546,
25,
220,
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_encode_and_get_buffer_back() {
let instance = create_vea_instance();
let config = create_config();
let mut session = instance
.open_session(config)
.expect("failed to open a session");
let fake_input_buffer_id = 12345;
let fake_planes = vec![];
session
.encode(
fake_input_buffer_id,
1, // fd
&fake_planes, // planes
0, // timestamp
false, // force_keyframe
)
.expect("failed to send an encode request");
// the input buffer right away.
match session.read_event() {
Ok(Event::ProcessedInputBuffer(returned_input_buffer_id)) => {
assert_eq!(fake_input_buffer_id, returned_input_buffer_id);
}
Ok(event) => panic!("Obtained event is not ProcessedInputBuffer but {:?}", event),
Err(msg) => panic!(msg),
}
} | rust_cleaned_test_functions.jsonl/29969 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 447
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
8378,
3062,
7776,
3895,
368,
341,
262,
1077,
2867,
284,
1855,
73285,
64,
11904,
543,
262,
1077,
2193,
284,
1855,
5332,
543,
262,
1077,
5206,
3797,
284,
2867,
198,
286,
659,
2508,
12316,
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_already_logging_error() {
let mut runner = Runner::new();
// Start logging.
let mut query = runner.proxy.start_logging(100, 200);
assert_matches!(runner.executor.run_until_stalled(&mut query), Poll::Ready(Ok(Ok(()))));
// Attempting to start logging a second time should fail.
let mut query = runner.proxy.start_logging(100, 500);
assert_matches!(
runner.executor.run_until_stalled(&mut query),
Poll::Ready(Ok(Err(fthermal::TemperatureLoggerError::AlreadyLogging)))
);
// Stop logging.
assert!(runner.proxy.stop_logging().is_ok());
// Now starting logging will succeed.
let mut query = runner.proxy.start_logging(100, 200);
assert_matches!(runner.executor.run_until_stalled(&mut query), Poll::Ready(Ok(Ok(()))));
// Logging stops on the second wakeup.
runner.iterate_logging_task();
runner.iterate_logging_task();
// Starting logging again succeeds.
let mut query = runner.proxy.start_logging(100, 200);
assert_matches!(runner.executor.run_until_stalled(&mut query), Poll::Ready(Ok(Ok(()))));
} | rust_cleaned_test_functions.jsonl/91284 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 499
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
80772,
59982,
4096,
368,
341,
286,
1077,
5206,
22259,
284,
44946,
486,
931,
1428,
286,
442,
5145,
8392,
624,
286,
1077,
5206,
3239,
284,
22259,
41103,
4962,
59982,
7,
16,
15,
15,
11,
220,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tvu_exit() {
solana_logger::setup();
let leader = Node::new_localhost();
let target1_keypair = Keypair::new();
let target1 = Node::new_localhost_with_pubkey(&target1_keypair.pubkey());
let starting_balance = 10_000;
let GenesisBlockInfo { genesis_block, .. } = create_genesis_block(starting_balance);
let bank_forks = BankForks::new(0, Bank::new(&genesis_block));
//start cluster_info1
let mut cluster_info1 = ClusterInfo::new_with_invalid_keypair(target1.info.clone());
cluster_info1.insert_info(leader.info.clone());
let cref1 = Arc::new(RwLock::new(cluster_info1));
let blocktree_path = get_tmp_ledger_path!();
let (blocktree, l_receiver, completed_slots_receiver) =
Blocktree::open_with_signal(&blocktree_path)
.expect("Expected to successfully open ledger");
let blocktree = Arc::new(blocktree);
let bank = bank_forks.working_bank();
let (exit, poh_recorder, poh_service, _entry_receiver) =
create_test_recorder(&bank, &blocktree);
let voting_keypair = Keypair::new();
let storage_keypair = Arc::new(Keypair::new());
let leader_schedule_cache = Arc::new(LeaderScheduleCache::new_from_bank(&bank));
let tvu = Tvu::new(
&voting_keypair.pubkey(),
Some(&Arc::new(voting_keypair)),
&storage_keypair,
&Arc::new(RwLock::new(bank_forks)),
&cref1,
{
Sockets {
repair: target1.sockets.repair,
retransmit: target1.sockets.retransmit,
fetch: target1.sockets.tvu,
}
},
blocktree,
STORAGE_ROTATE_TEST_COUNT,
&StorageState::default(),
None,
l_receiver,
&Arc::new(RpcSubscriptions::default()),
&poh_recorder,
&leader_schedule_cache,
&exit,
completed_slots_receiver,
);
exit.store(true, Ordering::Relaxed);
tvu.join().unwrap();
poh_service.join().unwrap();
} | rust_cleaned_test_functions.jsonl/84193 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
45690,
16880,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
7653,
284,
6018,
486,
931,
62,
8301,
543,
286,
1077,
2169,
16,
3097,
12670,
284,
6569,
1082,
1310,
486,
931,
543,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_escaped_string() {
#[allow(unused)]
use nom::Needed; // https://github.com/Geal/nom/issues/780
named!(string<StrSpan, String>, delimited!(
char!('"'),
escaped_transform!(call!(nom::character::complete::alpha1), '\\', nom::character::complete::anychar),
char!('"')
));
let res = string(LocatedSpan::new("\"foo\\\"bar\""));
assert!(res.is_ok());
let (span, remaining) = res.unwrap();
assert_eq!(span.location_offset(), 10);
assert_eq!(span.location_line(), 1);
assert_eq!(span.fragment(), &"");
assert_eq!(remaining, "foo\"bar".to_string());
} | rust_cleaned_test_functions.jsonl/39133 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 270
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
65826,
3904,
368,
341,
262,
11506,
7183,
18364,
2591,
5563,
262,
990,
9662,
486,
56706,
26,
442,
3703,
1110,
5204,
905,
14,
9499,
278,
9612,
316,
38745,
14,
22,
23,
15,
198,
262,
6941,
102... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_process_store_fail_instruction_data_too_large() {
solana_logger::setup();
let keys = vec![];
let (config_keypair, config_account) = create_config_account(keys.clone());
let config_pubkey = config_keypair.pubkey();
let my_config = MyConfig::new(42);
let mut instruction =
config_instruction::store(&config_pubkey, true, keys.clone(), &my_config);
instruction.data = vec![0; 123]; // <-- Replace data with a vector that's too large
let accounts = vec![(&config_pubkey, true, &config_account)];
let keyed_accounts = create_keyed_is_signer_accounts(&accounts);
assert_eq!(
process_instruction(&id(), &keyed_accounts, &instruction.data),
Err(InstructionError::InvalidInstructionData)
);
} | rust_cleaned_test_functions.jsonl/70769 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 352
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
14809,
22121,
54923,
1769,
2346,
78,
45228,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
6894,
284,
7486,
0,
15078,
286,
1077,
320,
1676,
3097,
12670,
11,
2193,
13500,
8,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_04() {
let Triple(u, v, w) = Triple::from((2, "foo", 1.0e-2));
assert_eq!(u, 2);
assert_eq!(v, "foo");
assert_eq!(w, 1.0e-2);
} | rust_cleaned_test_functions.jsonl/133575 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 113
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
15,
19,
368,
341,
286,
1077,
36649,
8154,
11,
348,
11,
289,
8,
284,
36649,
486,
1499,
1188,
17,
11,
330,
7975,
497,
220,
16,
13,
15,
68,
12,
17,
1106,
286,
2060,
10714,
10297,
84,
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_process_blame_no_parent_found() {
let two_trees = MockProcInfo::with(&[
(2, 100, "-shell", None),
(3, 100, "git blame src/main.rs", Some(2)),
(4, 100, "call_delta.sh", None),
(5, 100, "delta", Some(4)),
]);
assert_eq!(
calling_process_cmdline(two_trees, guess_git_blame_filename_extension),
None
);
} | rust_cleaned_test_functions.jsonl/107873 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 238
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
13141,
373,
6536,
15960,
21480,
368,
341,
286,
1077,
1378,
75791,
284,
14563,
24508,
1731,
486,
4197,
2099,
9640,
310,
320,
17,
11,
220,
16,
15,
15,
11,
6523,
21384,
497,
2240,
1326,
310,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_into_raw_fd() {
let tfd = TimerFd::new().expect("failed to create timerfd");
let fd = tfd.into_raw_fd();
assert!(fd > 0);
} | rust_cleaned_test_functions.jsonl/66516 | {
"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,
45514,
16067,
17676,
368,
341,
286,
1077,
6409,
67,
284,
17759,
74476,
486,
931,
1005,
17119,
445,
16091,
311,
1855,
9021,
6902,
797,
286,
1077,
12414,
284,
6409,
67,
39860,
16067,
17676,
543,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_traverse() {
let mut elements = Vec::new();
Traverse::traverse(0, &mut |traverse, node| {
elements.push(node);
if node < 7 {
traverse.push(node);
traverse.push(node + 1);
}
});
assert_eq!(&elements, &[0, 1, 2, 3, 4, 5, 6, 7]);
} | rust_cleaned_test_functions.jsonl/122447 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3547,
22439,
368,
341,
197,
10217,
5206,
5424,
284,
11312,
486,
931,
543,
197,
197,
1282,
22439,
486,
376,
22439,
7,
15,
11,
609,
6984,
760,
376,
22439,
11,
2436,
91,
341,
298,
197,
21423,
255... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_verifier_fail() {
let prog = assemble(
"mov32 r0, 0xBEE
exit",
).unwrap();
let mut vm = EbpfVm::new(None).unwrap();
vm.set_verifier(verifier_fail).unwrap();
vm.set_program(&prog).unwrap();
} | rust_cleaned_test_functions.jsonl/15523 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26042,
3049,
22121,
368,
341,
262,
1077,
29271,
284,
41740,
1006,
286,
330,
29961,
18,
17,
435,
15,
11,
220,
15,
14377,
7099,
198,
260,
4869,
756,
262,
7457,
15454,
543,
262,
1077,
5206,
10995,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_try_build_path() {
let _ = env_logger::try_init();
let mut types_map = TypeMap::default();
let mut src_reg = SourceRegistry::default();
let src_id = src_reg.register(SourceCode {
id_of_code: "test_try_build_path".into(),
code: include_str!("java_jni/jni-include.rs").into(),
});
types_map.merge(src_id, src_reg.src(src_id), 64).unwrap();
let foo_rt: RustType = types_map.find_or_alloc_rust_type_that_implements(
&parse_type! { Foo },
&["SwigForeignClass"],
SourceId::none(),
);
types_map.register_foreigner_class(&ForeignClassInfo {
src_id: SourceId::none(),
name: Ident::new("Foo", Span::call_site()),
methods: vec![],
self_desc: Some(SelfTypeDesc {
self_type: foo_rt.ty.clone(),
constructor_ret_type: foo_rt.ty.clone(),
}),
foreign_code: String::new(),
doc_comments: vec![],
derive_list: vec![],
});
let rc_refcell_foo_ty = types_map
.find_or_alloc_rust_type(&parse_type! { &mut Rc<RefCell<Foo>> }, SourceId::none());
let foo_ref_ty =
types_map.find_or_alloc_rust_type(&parse_type! { &mut Foo }, SourceId::none());
assert_eq!(
r#" let mut a1: & Rc < RefCell < Foo > > = a0;
let mut a1: & RefCell < Foo > = a1.swig_deref();
let mut a1: RefMut < Foo > = <RefMut < Foo >>::swig_from(a1, env);
let mut a1: & mut Foo = a1.swig_deref_mut();
"#,
types_map
.convert_rust_types(
rc_refcell_foo_ty.to_idx(),
foo_ref_ty.to_idx(),
"a0",
"a1",
"jlong",
invalid_src_id_span(),
)
.expect("path from &mut Rc<RefCell<Foo>> to &mut Foo NOT exists")
.1,
);
let rc_refcell_foo_ty =
types_map.find_or_alloc_rust_type(&parse_type! { &RefCell<Foo> }, SourceId::none());
let foo_ref_ty = types_map.find_or_alloc_rust_type(&parse_type! { &Foo }, SourceId::none());
assert_eq!(
r#" let mut a1: Ref < Foo > = <Ref < Foo >>::swig_from(a0, env);
let mut a1: & Foo = a1.swig_deref();
"#,
types_map
.convert_rust_types(
rc_refcell_foo_ty.to_idx(),
foo_ref_ty.to_idx(),
"a0",
"a1",
"jlong",
invalid_src_id_span(),
)
.expect("path from &RefCell<Foo> to &Foo NOT exists")
.1
);
} | rust_cleaned_test_functions.jsonl/92739 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1585
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
20801,
2638,
368,
341,
286,
1077,
716,
284,
6105,
27413,
486,
1539,
6137,
543,
286,
1077,
5206,
4494,
5376,
284,
3990,
2227,
486,
2258,
543,
286,
1077,
5206,
2286,
4920,
284,
8748,
15603,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_link_alias() {
assert_eq!(
GiDocgen::from_str("[alias@Allocation]"),
Ok(GiDocgen::Alias("Allocation".to_string()))
);
} | rust_cleaned_test_functions.jsonl/78464 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7233,
35947,
368,
341,
286,
2060,
10714,
33673,
310,
15392,
9550,
4370,
486,
1499,
2895,
10937,
14956,
31,
78316,
60,
4461,
310,
7622,
6699,
72,
9550,
4370,
486,
22720,
445,
78316,
3263,
983,
3904... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_method_completion_only_fitting_impls() {
check(
r#"
struct A<T> {}
impl A<u32> {
fn the_method(&self) {}
}
impl A<i32> {
fn the_other_method(&self) {}
}
fn foo(a: A<u32>) { a.$0 }
"#,
expect![[r#"
me the_method() -> ()
"#]],
)
} | rust_cleaned_test_functions.jsonl/26251 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 195
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9032,
60164,
18410,
761,
14810,
21007,
82,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
1235,
362,
3125,
29,
5613,
6383,
362,
34837,
18,
17,
29,
341,
262,
5168,
279,
9032,
2099,
721,
8,
5613,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_into_alogithm_id() {
assert_eq!(
Into::<TPM2_ALG_ID>::into(SignatureScheme::RsaSsa),
TPM2_ALG_RSASSA
);
assert_eq!(
Into::<TPM2_ALG_ID>::into(SignatureScheme::RsaPss),
TPM2_ALG_RSAPSS
);
assert_eq!(
Into::<TPM2_ALG_ID>::into(SignatureScheme::EcDsa),
TPM2_ALG_ECDSA
);
assert_eq!(
Into::<TPM2_ALG_ID>::into(SignatureScheme::EcDaa),
TPM2_ALG_ECDAA
);
assert_eq!(
Into::<TPM2_ALG_ID>::into(SignatureScheme::EcSchnorr),
TPM2_ALG_ECSCHNORR
);
assert_eq!(
Into::<TPM2_ALG_ID>::into(SignatureScheme::Sm2),
TPM2_ALG_SM2
);
} | rust_cleaned_test_functions.jsonl/41503 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 509
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45514,
8418,
538,
410,
76,
842,
368,
341,
286,
2060,
10714,
33673,
310,
31645,
27638,
4239,
44,
17,
8912,
38,
3450,
6831,
18122,
3759,
622,
1568,
28906,
486,
49,
9081,
50,
9081,
1326,
310,
63644... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_insert_field_with_name_ref_into_dynamic_table() {
let mut buf = vec![];
InsertWithNameRef::new_static(1, "serial value")
.encode(&mut buf)
.unwrap();
let mut table = build_table_with_size(0);
let mut enc = Cursor::new(&buf);
let mut dec = vec![];
assert!(on_encoder_recv(&mut table.inserter(), &mut enc, &mut dec).is_ok());
assert_eq!(
table.decoder(1).get_relative(0),
Ok(&StaticTable::get(1).unwrap().with_value("serial value"))
);
let mut dec_cursor = Cursor::new(&dec);
assert_eq!(
InsertCountIncrement::decode(&mut dec_cursor),
Ok(Some(InsertCountIncrement(1)))
);
} | rust_cleaned_test_functions.jsonl/37413 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 377
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
5013,
6615,
1269,
7793,
45514,
45992,
5237,
368,
341,
286,
1077,
5206,
6607,
284,
7486,
0,
15078,
286,
17101,
54523,
3945,
486,
931,
25360,
7,
16,
11,
330,
10182,
897,
1138,
310,
659,
618... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lex_sort_unaligned_rows() {
let input = vec![
SortColumn {
values: Arc::new(PrimitiveArray::<Int64Type>::from(vec![None, Some(-1)]))
as ArrayRef,
options: None,
},
SortColumn {
values: Arc::new(StringArray::from(vec![Some("foo")])) as ArrayRef,
options: None,
},
];
assert!(
lexsort(&input).is_err(),
"lexsort should reject columns with different row counts"
);
} | rust_cleaned_test_functions.jsonl/23902 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 320
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74547,
18435,
4907,
47142,
10949,
368,
341,
286,
1077,
1946,
284,
7486,
90515,
310,
15967,
2933,
341,
394,
2750,
25,
19689,
486,
931,
7,
33313,
1857,
27638,
1072,
21,
19,
929,
6831,
1499,
25592,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_seraizlie() {
let serializer = BytesSerializer::default();
let mut buf = Vec::new();
let data = Vec::from("data");
serializer.serialize_to("topic", data.as_slice(), &mut buf).unwrap();
assert_eq!(&buf, &data);
assert_eq!(
serializer.serialize("topic", data.as_slice()).unwrap(),
Bytes::from(data)
);
} | rust_cleaned_test_functions.jsonl/132228 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 197
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
2416,
449,
11567,
368,
341,
286,
1077,
21759,
284,
30024,
13909,
486,
2258,
543,
286,
1077,
5206,
6607,
284,
11312,
486,
931,
543,
286,
1077,
821,
284,
11312,
486,
1499,
445,
691,
3071,
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_parameter_ordering() {
let p9999 = Parameter(9999);
assert_eq!(p9999, 9999);
assert!(*p9999 < 10_000);
assert!(*p9999 > 9998);
} | rust_cleaned_test_functions.jsonl/84100 | {
"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,
24899,
7869,
287,
368,
341,
286,
1077,
281,
24,
24,
24,
24,
284,
15168,
7,
24,
24,
24,
24,
317,
286,
2060,
10714,
10297,
79,
24,
24,
24,
24,
11,
220,
24,
24,
24,
24,
317,
286,
2060,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_formatted_negative_rounding() {
let cf = CoordinateFormat::new(6, 4);
let d = CoordinateNumber {
nano: -123456789099,
}
.gerber(&cf)
.unwrap();
assert_eq!(d, "-1234567891".to_string());
} | rust_cleaned_test_functions.jsonl/16459 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 146
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
86610,
53865,
29896,
287,
368,
341,
286,
1077,
24111,
284,
41035,
4061,
486,
931,
7,
21,
11,
220,
19,
317,
286,
1077,
294,
284,
41035,
2833,
341,
310,
50493,
25,
481,
16,
17,
18,
19,
20,
21,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_image_parse_localhost() {
assert_eq!(
ImageRef::parse("localhost/foo"),
ImageRef {
registry: Some("localhost".into()),
image: "foo".into(),
tag: None,
hash: None
}
);
assert_eq!(
ImageRef::parse("localhost/foo:bar"),
ImageRef {
registry: Some("localhost".into()),
image: "foo".into(),
tag: Some("bar".into()),
hash: None
}
);
assert_eq!(
ImageRef::parse("localhost/foo/bar"),
ImageRef {
registry: Some("localhost".into()),
image: "foo/bar".into(),
tag: None,
hash: None
}
);
assert_eq!(
ImageRef::parse("localhost/foo/bar:baz"),
ImageRef {
registry: Some("localhost".into()),
image: "foo/bar".into(),
tag: Some("baz".into()),
hash: None
}
);
} | rust_cleaned_test_functions.jsonl/17931 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 448
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4954,
21039,
62,
8301,
368,
341,
262,
2060,
10714,
33673,
414,
4654,
3945,
486,
6400,
445,
8301,
60555,
4461,
414,
4654,
3945,
341,
286,
19424,
25,
4329,
445,
8301,
3263,
18122,
14702,
286,
2168,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cmp_memindex_reg_index_rip() {
let mut buf = MacroAssembler::new();
emit_cmp_memindex_reg(&mut buf, MachineMode::Ptr, RAX, RIP, 1, 0, RAX);
} | rust_cleaned_test_functions.jsonl/85471 | {
"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,
35193,
12976,
1252,
4920,
3560,
62,
4561,
368,
341,
286,
1077,
5206,
6607,
284,
53317,
77858,
486,
931,
543,
286,
16691,
35193,
12976,
1252,
4920,
2099,
6984,
6607,
11,
12960,
3636,
486,
5348,
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 |
#[test]
fn test_printf_size() {
let file_info = get_dir_entry_for("test_data/size", "512bytes");
let deps = FakeDependencies::new();
let matcher = Printf::new("%s").unwrap();
assert!(matcher.matches(&file_info, &mut deps.new_matcher_io()));
assert_eq!("512", deps.get_output_as_string());
} | rust_cleaned_test_functions.jsonl/69252 | {
"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,
21823,
2368,
368,
341,
286,
1077,
1034,
3109,
284,
633,
4334,
9078,
5478,
445,
1944,
1769,
14,
2141,
497,
330,
20,
16,
17,
9651,
797,
286,
1077,
48178,
284,
36965,
48303,
486,
931,
1428,
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_to_decimal() {
let cases = vec![
("31 11:30:45", 0, "7553045"),
("31 11:30:45", 6, "7553045.000000"),
("31 11:30:45", 0, "7553045"),
("31 11:30:45.123", 6, "7553045.123000"),
("11:30:45", 0, "113045"),
("11:30:45", 6, "113045.000000"),
("11:30:45.123", 6, "113045.123000"),
("11:30:45.123345", 0, "113045"),
("11:30:45.123345", 3, "113045.123"),
("11:30:45.123345", 5, "113045.12335"),
("11:30:45.123345", 6, "113045.123345"),
("11:30:45.1233456", 6, "113045.123346"),
("11:30:45.9233456", 0, "113046"),
("-11:30:45.9233456", 0, "-113046"),
];
for (input, fsp, exp) in cases {
let t = Duration::parse(input.as_bytes(), fsp).unwrap();
let res = format!("{}", t.to_decimal().unwrap());
assert_eq!(exp, res);
}
} | rust_cleaned_test_functions.jsonl/17461 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 584
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
74429,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
3489,
18,
16,
220,
16,
16,
25,
18,
15,
25,
19,
20,
497,
220,
15,
11,
330,
22,
20,
20,
18,
15,
19,
20,
4461,
310,
3489,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_fetch_source_2() {
use crate::tokio_util;
// http_util::fetch_sync_string requires tokio
tokio_util::init(|| {
let (_temp_dir, deno_dir) = test_setup();
let module_name = "http://localhost:4545/tests/subdir/no_ext";
let filename = deno_fs::normalize_path(
deno_dir
.deps_http
.join("localhost_PORT4545/tests/subdir/no_ext")
.as_ref(),
);
let result = fetch_remote_source(&deno_dir, module_name, &filename);
assert!(result.is_ok());
let r = result.unwrap().unwrap();
assert_eq!(r.source_code, "export const loaded = true;\n".as_bytes());
assert_eq!(&(r.media_type), &msg::MediaType::TypeScript);
assert_eq!(
get_source_code_headers(&filename).mime_type.unwrap(),
"text/typescript"
);
let module_name_2 = "http://localhost:4545/tests/subdir/mismatch_ext.ts";
let filename_2 = deno_fs::normalize_path(
deno_dir
.deps_http
.join("localhost_PORT4545/tests/subdir/mismatch_ext.ts")
.as_ref(),
);
let result_2 = fetch_remote_source(&deno_dir, module_name_2, &filename_2);
assert!(result_2.is_ok());
let r2 = result_2.unwrap().unwrap();
assert_eq!(r2.source_code, "export const loaded = true;\n".as_bytes());
assert_eq!(&(r2.media_type), &msg::MediaType::JavaScript);
assert_eq!(
get_source_code_headers(&filename_2).mime_type.unwrap(),
"text/javascript"
);
// test unknown extension
let module_name_3 = "http://localhost:4545/tests/subdir/unknown_ext.deno";
let filename_3 = deno_fs::normalize_path(
deno_dir
.deps_http
.join("localhost_PORT4545/tests/subdir/unknown_ext.deno")
.as_ref(),
);
let result_3 = fetch_remote_source(&deno_dir, module_name_3, &filename_3);
assert!(result_3.is_ok());
let r3 = result_3.unwrap().unwrap();
assert_eq!(r3.source_code, "export const loaded = true;\n".as_bytes());
assert_eq!(&(r3.media_type), &msg::MediaType::TypeScript);
assert_eq!(
get_source_code_headers(&filename_3).mime_type.unwrap(),
"text/typescript"
);
});
} | rust_cleaned_test_functions.jsonl/83873 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1079
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11803,
10347,
62,
17,
368,
341,
262,
990,
17717,
486,
29594,
815,
18974,
280,
262,
442,
1758,
18974,
486,
9641,
23008,
3904,
7460,
9628,
815,
198,
262,
9628,
815,
18974,
486,
2327,
79453,
341,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_compute_presig_k1() {
// need a mutex around the paillier pool to allow our assertions to hold
let _shared = PAILLIER_POOL_LOCK.lock();
let paillier_pk = EncryptionKey::from(MinimalEncryptionKey{n: BigInt::from_hex("9e2f24f407914eff43b7c7df083c5cc9765c05386485e9e9aa55e7b039290300ba39e86f399e2b338fad4bb34a4d7a7a0cd14fd28503eeebb73ff38e8164616942113afadaeaba525bd4cfdafc4ddd3b012d3fbcd9f276acbad4379b8b93bc4f4d6ddc0a2b9af36b34771595f0e6cb62987b961d83f49ba6ec4b088a1350b3dbbea3e21033801f6c4b212ecd830b5b81075effd06b47feecf18f3c9093662c918073dd95a525b4f99478512ea3bf085993c9bf65922d42b65b338431711dddb5491c2004548df31ab6092ec58db564c8a88a309b0f734171de1f8f4361d5f883e38d5bf519dc347036910aec3c80f2058fa8945c38787094f3450774e2b23129").unwrap()});
assert_eq!(get_rpool_size(Curve::Secp256k1).unwrap(), 0);
assert_eq!(POOL_PAILLIER.len(), 0);
let dh_secret: Secp256k1Scalar = ECScalar::from(
&BigInt::from_hex("8ea92bf3aa6f4ec4939b0888cd71dc6dc113f9cafe571c0bb501c8c9004bb47c")
.unwrap(),
)
.unwrap();
let dh_public = Secp256k1Point::from_bigint(
&BigInt::from_hex("34bfa8dd79ff0777e32b89f22a19623ff4fe6fe63aaeb3e2d165fc12cbb2471db")
.unwrap(),
)
.unwrap();
let dh_public_vec = vec![dh_public];
fill_rpool_secp256k1(vec![dh_secret.clone()], &dh_public_vec, &paillier_pk).unwrap();
assert_eq!(get_rpool_size(Curve::Secp256k1).unwrap(), 1);
assert_eq!(POOL_PAILLIER.len(), 1);
let msg_hash =
BigInt::from_hex("000000000000000fffffffffffffffffff00000000000000ffffffffff000000")
.unwrap();
let secret_key =
BigInt::from_hex("4794853ce9e44b4c7a69c6a3b87db077f8f910f244bb6b966ba5fed83c9756f1")
.unwrap();
let api_childkey_creator =
APIchildkeyCreator::init_with_verified_paillier(&secret_key, &paillier_pk);
let api_childkey = api_childkey_creator
.create_api_childkey(Curve::Secp256k1)
.unwrap();
let (presig1, r) = compute_presig(&api_childkey, &msg_hash, Curve::Secp256k1).unwrap();
assert_eq!(
r,
BigInt::from_hex("3703d86c98836a6ef32371e1b91ed2ca64bd6d7a0774631f47ffebc49406c94ac")
.unwrap()
);
assert_eq!(POOL_PAILLIER.len(), 0);
fill_rpool_secp256k1(vec![dh_secret], &dh_public_vec, &paillier_pk).unwrap();
assert_eq!(POOL_PAILLIER.len(), 1);
let (presig2, _) = compute_presig(&api_childkey, &msg_hash, Curve::Secp256k1).unwrap();
assert_ne!(presig1, presig2);
assert_eq!(POOL_PAILLIER.len(), 0);
} | rust_cleaned_test_functions.jsonl/70913 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1487
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57028,
32116,
343,
4698,
16,
368,
341,
286,
442,
1184,
264,
30863,
2163,
279,
7106,
483,
1268,
7314,
311,
2138,
1039,
54836,
311,
3331,
198,
286,
1077,
716,
6100,
284,
393,
5965,
43,
16289,
5192... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_doc_create() {
let shared_cat = create_test_catalog("test_index".into());
let body: AddDocument = serde_json::from_str(
r#" {"options": {"commit": true}, "document": {"test_text": "Babbaboo!", "test_u64": 10, "test_i64": -10} }"#,
)
.unwrap();
let handler = IndexHandler::new(Arc::clone(&shared_cat));
let req = handler.add(body, "test_index".into());
assert_eq!(req.is_ok(), true);
} | rust_cleaned_test_functions.jsonl/96419 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 221
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18869,
8657,
368,
341,
286,
1077,
6094,
20825,
284,
1855,
4452,
47310,
445,
1944,
3560,
3263,
18122,
1423,
286,
1077,
2487,
25,
2691,
7524,
284,
61570,
9455,
486,
1499,
2895,
1006,
310,
435,
55543... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mutable_reserve() {
let mut buf = MutableBuffer::new(1);
assert_eq!(64, buf.capacity());
// Reserving a smaller capacity should have no effect.
let mut new_cap = buf.reserve(10).expect("reserve should be OK");
assert_eq!(64, new_cap);
assert_eq!(64, buf.capacity());
new_cap = buf.reserve(100).expect("reserve should be OK");
assert_eq!(128, new_cap);
assert_eq!(128, buf.capacity());
} | rust_cleaned_test_functions.jsonl/20575 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 218
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
5922,
89591,
368,
341,
286,
1077,
5206,
6607,
284,
31143,
4095,
486,
931,
7,
16,
317,
286,
2060,
10714,
10297,
21,
19,
11,
6607,
59168,
5231,
286,
442,
1800,
19505,
264,
9155,
8654,
1265,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dispatch_with_init_boot_request_client_on_wrong_subnet_returns_nak() {
let mut req = new_test_request();
req.options.remove(0);
req.options.remove(1);
req.options.push(ConfigOption {
code: OptionCode::RequestedIpAddr,
value: vec![10, 0, 0, 1],
});
let mut server = new_test_server(|| 42);
let got = server.dispatch(req).unwrap();
let want = new_test_nak();
assert_eq!(got, want);
} | rust_cleaned_test_functions.jsonl/61727 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 248
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42991,
6615,
6137,
52062,
7893,
8179,
4470,
75198,
95681,
58900,
1089,
585,
368,
341,
286,
1077,
5206,
4232,
284,
501,
4452,
7893,
543,
286,
4232,
10912,
4850,
7,
15,
317,
286,
4232,
10912,
4850,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_daa() {
let mut state = State8080::empty_state();
state.memory = vec![0x27];
state.a = 0x9b;
state.cc.cy = 0;
state.cc.ac = 0;
emulate_8080_op(&mut state);
assert_eq!(state.a, 0x01);
assert_eq!(state.cc.cy, 1);
assert_eq!(state.cc.ac, 1);
} | rust_cleaned_test_functions.jsonl/7798 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 192
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
5305,
368,
341,
286,
1077,
5206,
1584,
284,
3234,
23,
15,
23,
15,
486,
3194,
4387,
543,
286,
1584,
36611,
284,
7486,
20703,
15,
87,
17,
22,
935,
286,
1584,
5849,
284,
220,
15,
87,
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... | 1 |
#[test]
fn test_fill_none() {
let ca =
Int32Chunked::new_from_opt_slice("", &[None, Some(2), Some(3), None, Some(4), None]);
let filled = ca.fill_none(FillNoneStrategy::Forward).unwrap();
assert_eq!(
Vec::from(&filled),
&[None, Some(2), Some(3), Some(3), Some(4), Some(4)]
);
let filled = ca.fill_none(FillNoneStrategy::Backward).unwrap();
assert_eq!(
Vec::from(&filled),
&[Some(2), Some(2), Some(3), Some(4), Some(4), None]
);
let filled = ca.fill_none(FillNoneStrategy::Min).unwrap();
assert_eq!(
Vec::from(&filled),
&[Some(2), Some(2), Some(3), Some(2), Some(4), Some(2)]
);
let filled = ca.fill_none_with_value(10).unwrap();
assert_eq!(
Vec::from(&filled),
&[Some(10), Some(2), Some(3), Some(10), Some(4), Some(10)]
);
let filled = ca.fill_none(FillNoneStrategy::Mean).unwrap();
assert_eq!(
Vec::from(&filled),
&[Some(3), Some(2), Some(3), Some(3), Some(4), Some(3)]
);
println!("{:?}", filled);
} | rust_cleaned_test_functions.jsonl/57988 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 622
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30728,
31488,
368,
341,
286,
1077,
2162,
4035,
310,
1333,
18,
17,
28304,
291,
486,
931,
5673,
15032,
26488,
19814,
44590,
4064,
11,
4329,
7,
17,
701,
4329,
7,
18,
701,
2240,
11,
4329,
7,
19,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_run_with_non_default_dfinance_dialect() {
let _pool = ConstPool::new();
let module_text = r"
address wallet1me0cdn52672y7feddy7tgcj6j4dkzq2su745vh {
module M {
resource struct T { value: u8 }
public fun get_t(s: &signer, v: u8) {
move_to<T>(s, T { value: v })
}
}
}
";
let script_text = r"
script {
fun main(s: &signer) {
wallet1me0cdn52672y7feddy7tgcj6j4dkzq2su745vh::M::get_t(s, 10);
}
}
";
let effects = execute_script(
MoveFile::with_content(script_path(), script_text),
vec![MoveFile::with_content(module_path("m.move"), module_text)],
"dfinance",
"wallet1me0cdn52672y7feddy7tgcj6j4dkzq2su745vh",
vec![],
)
.unwrap()
.last()
.unwrap()
.effects();
assert_eq!(
effects.resources()[0],
AddressResourceChanges::new(
"0xDE5F86CE8AD7944F272D693CB4625A955B610150",
vec![(
"Added".to_string(),
ResourceChange(
"0xDE5F86CE8AD7944F272D693CB4625A955B610150::M::T".to_string(),
Some("[U8(10)]".to_string())
)
)],
)
);
} | rust_cleaned_test_functions.jsonl/43916 | {
"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,
14007,
6615,
21637,
9993,
814,
62675,
814,
55056,
368,
341,
262,
1077,
716,
10285,
284,
24522,
10551,
486,
931,
1428,
262,
1077,
4688,
4326,
284,
435,
698,
262,
2621,
15085,
16,
2660,
15,
12254,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_columns() -> Result<()> {
use super::Column;
let db = Connection::open_in_memory()?;
let query = db.prepare("SELECT * FROM sqlite_master")?;
let columns = query.columns();
let column_names: Vec<&str> = columns.iter().map(Column::name).collect();
assert_eq!(
column_names.as_slice(),
&["type", "name", "tbl_name", "rootpage", "sql"]
);
let column_types: Vec<Option<&str>> = columns.iter().map(Column::decl_type).collect();
assert_eq!(
&column_types[..3],
&[Some("text"), Some("text"), Some("text"),]
);
Ok(())
} | rust_cleaned_test_functions.jsonl/96471 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 324
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22590,
368,
1464,
5714,
71698,
341,
286,
990,
2256,
486,
2933,
401,
286,
1077,
2927,
284,
11032,
486,
2508,
1243,
19195,
94136,
286,
1077,
3239,
284,
2927,
21934,
445,
4858,
353,
4295,
22003,
2458... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_builder() {
let obj = Object::builder::<SimpleObject>()
.property("construct-name", "meh")
.property("name", "initial")
.build()
.expect("Object::new failed");
assert_eq!(
obj.property::<String>("construct-name"),
String::from("meh")
);
assert_eq!(obj.property::<String>("name"), String::from("initial"));
} | rust_cleaned_test_functions.jsonl/9011 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 216
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28532,
368,
341,
286,
1077,
2839,
284,
3002,
486,
17850,
27638,
16374,
1190,
18949,
310,
659,
3699,
445,
7596,
11494,
497,
330,
76,
2636,
1138,
310,
659,
3699,
445,
606,
497,
330,
9426,
1138,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_config_load_toml() {
let bad_path = Path::new("fake");
let result = ConductorConfig::load_toml(bad_path);
assert_eq!(
"Err(ConfigMissing(\"fake\"))".to_string(),
format!("{:?}", result)
);
// successful load test in conductor/interactive
} | rust_cleaned_test_functions.jsonl/121438 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 159
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5332,
12411,
528,
316,
75,
368,
341,
286,
1077,
3873,
2638,
284,
7933,
486,
931,
445,
30570,
797,
286,
1077,
1102,
284,
1200,
35769,
2648,
486,
1078,
528,
316,
75,
1883,
329,
2638,
317,
286,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cycle() {
let mut vector_in = vec![11, 20, 21, 40, 11, 60, 5];
cycle_sort(&mut vector_in);
debug_assert_eq!(vector_in, vec![5, 11, 11, 20, 21, 40, 60]);
} | rust_cleaned_test_functions.jsonl/84298 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 106
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39079,
368,
341,
286,
1077,
5206,
4621,
1243,
284,
7486,
20703,
16,
16,
11,
220,
17,
15,
11,
220,
17,
16,
11,
220,
19,
15,
11,
220,
16,
16,
11,
220,
21,
15,
11,
220,
20,
935,
286,
10775,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_all_liquidity_pools_request_uri() {
let account =
PublicKey::from_account_id("GAYOLLLUIZE4DZMBB2ZBKGBUBZLIOYU6XFLW37GBP2VZD3ABNXCW4BVA")
.unwrap();
let issuer =
PublicKey::from_account_id("GDPFNXAJ6R37LBQ6QYVKGBVW5ZA4QXPFJYKQUHPJSALXCUBQ7I5K6YFN")
.unwrap();
let reserves = vec![
Asset::new_native(),
Asset::new_credit("BUSD", issuer).unwrap(),
];
let req = all().with_account(&account).with_reserves(reserves);
let uri = req.uri(&host()).unwrap();
assert!(uri
.to_string()
.starts_with("https://horizon.stellar.org/liquidity_pools?"));
let query: HashMap<_, _> = uri.query_pairs().into_owned().collect();
let expected_reserves =
"native,BUSD:GDPFNXAJ6R37LBQ6QYVKGBVW5ZA4QXPFJYKQUHPJSALXCUBQ7I5K6YFN".to_string();
assert_eq!(Some(&expected_reserves), query.get("reserves"));
assert_eq!(Some(&account.account_id()), query.get("account"));
} | rust_cleaned_test_functions.jsonl/134525 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 568
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5705,
62,
39993,
18518,
620,
6178,
7893,
15572,
368,
341,
286,
1077,
2692,
4035,
310,
70280,
486,
1499,
13500,
842,
445,
38,
3022,
1930,
4086,
2275,
52867,
19,
35,
57,
8412,
33,
17,
57,
88307,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_full_exit_nft_with_incorrect_content_hash() {
const ERR_MSG: &str = "chunk number 6/execute_op/op_valid is true/enforce equal to one";
let mut circuit = apply_nft_mint_and_full_exit_nft_operations();
for operation_id in MintNFTOp::CHUNKS..MintNFTOp::CHUNKS + FullExitOp::CHUNKS {
circuit.operations[operation_id].args.special_content_hash =
vec![Some(Fr::zero()); CONTENT_HASH_WIDTH];
}
let result = check_circuit_non_panicking(circuit);
match result {
Ok(_) => panic!(
"Operation did not err, but was expected to err with message '{}'",
ERR_MSG,
),
Err(error_msg) => {
assert!(
error_msg.contains(ERR_MSG),
"Code erred with unexpected message. \
Provided message: '{}', but expected '{}'.",
error_msg,
ERR_MSG,
);
}
}
} | rust_cleaned_test_functions.jsonl/45533 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 477
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16372,
16880,
1089,
723,
6615,
1243,
19928,
7495,
8950,
368,
341,
262,
733,
10165,
14372,
25,
609,
495,
284,
330,
25979,
1372,
220,
21,
14,
10257,
10287,
52000,
8337,
374,
830,
13606,
8833,
6144,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_deserialize_complex() {
let (s1, s2) = zx::Socket::create(zx::SocketOpts::STREAM).unwrap();
let request = test_protocol::TestInterfaceRequest::from_args(
8, /* opcode */
vec![
Arg::Uint(UINT_VALUE),
Arg::Int(INT_VALUE),
Arg::Handle(s1.into_handle()),
Arg::Object(OBJECT_VALUE),
Arg::Handle(s2.into_handle()),
Arg::String(STRING_VALUE.to_string()),
Arg::Array(ARRAY_VALUE.to_vec().into()),
],
)
.unwrap();
match request {
test_protocol::TestInterfaceRequest::Complex {
uint_arg,
int_arg,
handle_arg1,
object_arg,
handle_arg2,
string_arg,
array_arg,
} => {
assert_eq!(UINT_VALUE, uint_arg);
assert_eq!(INT_VALUE, int_arg);
assert!(!handle_arg1.is_invalid());
assert_eq!(OBJECT_VALUE, object_arg);
assert!(!handle_arg2.is_invalid());
assert_eq!(STRING_VALUE, &string_arg);
assert_eq!(ARRAY_VALUE, array_arg.as_slice());
}
_ => panic!("Message deserialized to incorrect variant {:?}", request),
}
} | rust_cleaned_test_functions.jsonl/55809 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 804
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15768,
9050,
41522,
368,
341,
286,
1077,
320,
82,
16,
11,
274,
17,
8,
284,
71322,
486,
10286,
486,
3182,
13174,
87,
486,
10286,
43451,
486,
54326,
568,
15454,
543,
286,
1077,
1681,
284,
1273,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_parse_query_success() {
let tests = [
(
&b"First.second"[..],
vec!["First".to_string(), "second".to_string()],
),
(b"", Vec::new()),
(
b"urxvt.scrollBar_right",
vec!["urxvt".to_string(), "scrollBar_right".to_string()],
),
(
b"urxvt.Control-Shift-Up",
vec!["urxvt".to_string(), "Control-Shift-Up".to_string()],
),
];
for (data, expected) in tests.iter() {
let result = parse_query(*data);
assert_eq!(result.as_ref(), Some(expected), "while parsing {:?}", data);
}
} | rust_cleaned_test_functions.jsonl/113427 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 422
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
5738,
18632,
368,
341,
286,
1077,
7032,
284,
2278,
310,
2399,
394,
609,
65,
1,
5338,
13560,
36864,
496,
1259,
394,
7486,
0,
1183,
5338,
3263,
983,
3904,
1507,
330,
5569,
3263,
983,
3904,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_push_pop() {
let mut heap = BinaryHeap::from(vec![5, 5, 2, 1, 3]);
assert_eq!(heap.len(), 5);
assert_eq!(heap.push_pop(6), 6);
assert_eq!(heap.len(), 5);
assert_eq!(heap.push_pop(0), 5);
assert_eq!(heap.len(), 5);
assert_eq!(heap.push_pop(4), 5);
assert_eq!(heap.len(), 5);
assert_eq!(heap.push_pop(1), 4);
assert_eq!(heap.len(), 5);
} | rust_cleaned_test_functions.jsonl/87474 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14218,
17061,
368,
341,
262,
1077,
5206,
17364,
284,
17718,
27909,
486,
1499,
25592,
20703,
20,
11,
220,
20,
11,
220,
17,
11,
220,
16,
11,
220,
18,
2558,
262,
2060,
10714,
10297,
15961,
19406,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_list() {
let store = gen_store();
assert_eq!(
vec!["first".to_owned().into_bytes(), "second".to_owned().into_bytes(), "third".to_owned().into_bytes()],
store.lrange("list1", 0, 100).unwrap()
);
} | rust_cleaned_test_functions.jsonl/58224 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2019,
368,
341,
286,
1077,
3553,
284,
4081,
14809,
543,
286,
2060,
10714,
33673,
310,
7486,
0,
1183,
3896,
3263,
983,
51973,
1005,
18122,
12524,
1507,
330,
5569,
3263,
983,
51973,
1005,
18122,
125... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_submit_rate_flood_all() {
let vec = vec![1, 2, 3, 4, 5, 6, 7];
let flood = ConstantRate::new(std::u64::MAX, vec.into_iter());
let now = time::Instant::now();
// consume all elements
flood.for_each(drop);
let elapsed = now.elapsed().as_micros();
// Loop should finish instantly
assert!(elapsed < 1000);
} | rust_cleaned_test_functions.jsonl/59872 | {
"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,
31674,
9246,
761,
4556,
5705,
368,
341,
286,
1077,
7486,
284,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,
11,
220,
22,
935,
286,
1077,
17726,
284,
193... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_encoding() {
let f = Foo {
a: 1,
b: "test".to_string(),
c: "bar".to_string(),
d: false,
e: true,
f: 0xDEADBEEF,
};
assert_eq!(f.encode().unwrap().into_inner(),
vec![
1,
4,
116, 101, 115, 116, // "test"
0, 0, 0, 3,
98, 97, 114, // "bar"
2,
0xDE, 0xAD, 0xBE, 0xEF, // 0xDEADBEEF
]);
} | rust_cleaned_test_functions.jsonl/1824 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 362
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37613,
368,
341,
286,
1077,
282,
284,
33428,
341,
310,
264,
25,
220,
16,
345,
310,
293,
25,
330,
1944,
3263,
983,
3904,
3148,
310,
272,
25,
330,
2257,
3263,
983,
3904,
3148,
310,
294,
25,
89... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_size() {
let mut queue: Queue<u8> = Queue::new();
queue.enqueue(8);
queue.enqueue(16);
assert_eq!(2, queue.size());
} | rust_cleaned_test_functions.jsonl/25021 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2368,
368,
341,
286,
1077,
5206,
7177,
25,
18745,
34837,
23,
29,
284,
18745,
486,
931,
543,
286,
7177,
47468,
7,
23,
317,
286,
7177,
47468,
7,
16,
21,
317,
286,
2060,
10714,
10297,
17,
11,
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 |
#[test]
fn test_finitedomain_5() {
// drop_before sparse
let fd = FiniteDomain::from(vec![1, 2, 3, 4, 5, 6, 7, 8]);
let before = fd.drop_before(|x| *x > 6).unwrap();
assert_eq!(before.min(), 7);
assert_eq!(before.max(), 8);
assert!(fd.drop_before(|x| *x > 10).is_none());
let after = fd.drop_before(|x| *x > 0).unwrap();
assert_eq!(after, fd);
} | rust_cleaned_test_functions.jsonl/31711 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 238
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39737,
1608,
3121,
62,
20,
368,
341,
286,
442,
5943,
23708,
33444,
198,
286,
1077,
12414,
284,
93619,
13636,
486,
1499,
25592,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_check_tx_durable_nonce_nonce_acc_does_not_exist_fail() {
let (bank, _mint_keypair, custodian_keypair, nonce_keypair) =
setup_nonce_with_bank(10_000_000, |_| {}, 5_000_000, 250_000, None).unwrap();
let custodian_pubkey = custodian_keypair.pubkey();
let nonce_pubkey = nonce_keypair.pubkey();
let missing_keypair = Keypair::new();
let missing_pubkey = missing_keypair.pubkey();
let nonce_hash = get_nonce_account(&bank, &nonce_pubkey).unwrap();
let tx = Transaction::new_signed_with_payer(
&[
system_instruction::advance_nonce_account(&missing_pubkey, &nonce_pubkey),
system_instruction::transfer(&custodian_pubkey, &nonce_pubkey, 100_000),
],
Some(&custodian_pubkey),
&[&custodian_keypair, &nonce_keypair],
nonce_hash,
);
assert!(bank.check_tx_durable_nonce(&tx).is_none());
} | rust_cleaned_test_functions.jsonl/2620 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 481
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
17805,
814,
18329,
48508,
48508,
17737,
96374,
7913,
35906,
22121,
368,
341,
286,
1077,
320,
17033,
11,
716,
67791,
3097,
12670,
11,
16564,
63849,
3097,
12670,
11,
39676,
3097,
12670,
8,
4035,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_committed_entries_pagination_after_restart() {
let l = default_logger();
let s = IgnoreSizeHintMemStorage::default();
s.inner
.wl()
.apply_snapshot(new_snapshot(1, 1, vec![1, 2, 3]))
.unwrap();
let (mut entries, mut size) = (vec![], 0);
for i in 2..=10 {
let e = new_entry(1, i, Some("test data"));
size += e.compute_size() as u64;
entries.push(e);
}
s.inner.wl().append(&entries).unwrap();
s.inner.wl().mut_hard_state().commit = 10;
s.inner
.wl()
.append(&[new_entry(1, 11, Some("boom"))])
.unwrap();
let config = new_test_config(1, 10, 1);
let mut raw_node = RawNode::new(&config, s, &l).unwrap();
// `IgnoreSizeHintMemStorage` will ignore `max_committed_size_per_ready` but
// `RaftLog::slice won't.`
raw_node.raft.set_max_committed_size_per_ready(size - 1);
let mut highest_applied = 1;
while highest_applied != 11 {
let mut rd = raw_node.ready();
let committed_entries = rd.take_committed_entries();
let next = committed_entries.first().map(|x| x.index).unwrap();
assert_eq!(highest_applied + 1, next);
highest_applied = committed_entries.last().map(|x| x.index).unwrap();
raw_node.raft.raft_log.commit_to(11);
}
} | rust_cleaned_test_functions.jsonl/120178 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 611
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2965,
5483,
26092,
82231,
19844,
69392,
368,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
1077,
274,
284,
38971,
1695,
26987,
18816,
5793,
486,
2258,
543,
262,
274,
9398,
198,
286,
659,
26417,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_column_writer_nullable_repeated_values_roundtrip() {
let props = WriterProperties::builder().build();
column_roundtrip_random::<Int32Type>(
"test_col_writer_rnd_3",
props,
1024,
::std::i32::MIN,
::std::i32::MAX,
10,
10,
);
} | rust_cleaned_test_functions.jsonl/30535 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 203
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8744,
28908,
69743,
1288,
41954,
9146,
29896,
32981,
368,
341,
286,
1077,
6914,
284,
29404,
7903,
486,
17850,
1005,
5834,
543,
286,
3250,
29896,
32981,
22644,
27638,
1072,
18,
17,
929,
17055,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_account_shared_data() {
let key = Pubkey::new_unique();
let (account1, account2) = make_two_accounts(&key);
assert!(accounts_equal(&account1, &account2));
let account = account1;
assert_eq!(account.tocks, 1);
assert_eq!(account.tocks(), 1);
assert_eq!(account.data.len(), 2);
assert_eq!(account.data().len(), 2);
assert_eq!(account.owner, key);
assert_eq!(account.owner(), &key);
assert!(account.executable);
assert!(account.executable());
assert_eq!(account.rent_epoch, 4);
assert_eq!(account.rent_epoch(), 4);
let account = account2;
assert_eq!(account.tocks, 1);
assert_eq!(account.tocks(), 1);
assert_eq!(account.data.len(), 2);
assert_eq!(account.data().len(), 2);
assert_eq!(account.owner, key);
assert_eq!(account.owner(), &key);
assert!(account.executable);
assert!(account.executable());
assert_eq!(account.rent_epoch, 4);
assert_eq!(account.rent_epoch(), 4);
} | rust_cleaned_test_functions.jsonl/56002 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 515
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13500,
20405,
1769,
368,
341,
286,
1077,
1376,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
320,
4608,
16,
11,
2692,
17,
8,
284,
1281,
23241,
55665,
2099,
792,
317,
286,
2060,
10297,
26206,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_overlapping_regions_size() {
let mut map = MemoryMap::new();
map.push_range(0x1000.into(), 0x2000.into(), 0.into());
// should panic
map.push_range(0x00ff.into(), 0x10ff.into(), 0.into());
} | rust_cleaned_test_functions.jsonl/70011 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 119
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15431,
90619,
58035,
2368,
368,
341,
286,
1077,
5206,
2415,
284,
13850,
2227,
486,
931,
543,
286,
2415,
2552,
9698,
7,
15,
87,
16,
15,
15,
15,
39860,
1507,
220,
15,
87,
17,
15,
15,
15,
39860... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_skew_simple() {
let root = tree!('T' => [2, ('L' => [2, Nil, Nil]), 'R']);
println!("Input: {:?}", root);
let skewed = root.skew();
let expected = tree!('L' => [2, Nil, ('T' => [2, Nil, 'R'])]);
assert_eq!(skewed, expected);
} | rust_cleaned_test_functions.jsonl/9205 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33811,
365,
30015,
368,
341,
197,
10217,
3704,
284,
4916,
0,
492,
51,
6,
589,
508,
17,
11,
4319,
43,
6,
589,
508,
17,
11,
32274,
11,
32274,
9719,
364,
49,
5860,
197,
81168,
17223,
2505,
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_partitioned_gb_mean() -> Result<()> {
// don't move these to integration tests
let out = df![
"key" => (0..100).map(|_| Some(0)).collect::<Int32Chunked>().into_series(),
]?
.lazy()
.with_columns([lit("a").alias("str"), lit(1).alias("int")])
.groupby([col("key")])
.agg([
col("str").mean().alias("mean_str"),
col("int").mean().alias("mean_int"),
])
.collect()?;
assert_eq!(out.shape(), (1, 3));
let str_col = out.column("mean_str")?;
assert_eq!(str_col.get(0), AnyValue::Null);
let int_col = out.column("mean_int")?;
assert_eq!(int_col.get(0), AnyValue::Float64(1.0));
Ok(())
} | rust_cleaned_test_functions.jsonl/13858 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 319
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43840,
291,
87935,
16933,
368,
1464,
5714,
71698,
341,
262,
442,
1513,
944,
3271,
1493,
311,
17590,
7032,
198,
262,
1077,
700,
284,
6764,
90515,
286,
330,
792,
1,
589,
320,
15,
496,
16,
15,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_reconstruct_latin() {
let stop_words = Set::default();
let analyzer = Analyzer::new(AnalyzerConfig::default_with_stopwords(&stop_words));
let orig = "The quick (\"brown\") fox can't jump 32.3 feet, right? Brr, it's 29.3°F!";
let tokens = analyzer.analyze(orig);
assert_eq!(orig, tokens.reconstruct().map(|(t, _)| t).collect::<String>());
} | rust_cleaned_test_functions.jsonl/98417 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 172
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
7596,
907,
14768,
368,
341,
286,
1077,
2936,
18981,
284,
2573,
486,
2258,
543,
286,
1077,
54660,
284,
78705,
486,
931,
7,
54911,
2648,
486,
2258,
6615,
19039,
5761,
2099,
9495,
18981,
1106,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_last_accessed() {
let fs = FileSystem::default();
let file = fs
.new_open_options()
.write(true)
.create_new(true)
.open(path!("/foo.txt"))
.expect("failed to create a new file");
let last_accessed_time = file.last_accessed();
assert!(last_accessed_time > 0, "last accessed time is not zero");
sleep(Duration::from_secs(3));
let file = fs
.new_open_options()
.read(true)
.open(path!("/foo.txt"))
.expect("failed to open a file");
let next_last_accessed_time = file.last_accessed();
assert!(
next_last_accessed_time > last_accessed_time,
"the last accessed time is updated"
);
} | rust_cleaned_test_functions.jsonl/52774 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 410
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12195,
12759,
291,
368,
341,
286,
1077,
8619,
284,
53461,
486,
2258,
1428,
286,
1077,
1034,
284,
8619,
198,
310,
659,
931,
11311,
8743,
741,
310,
659,
4934,
3715,
340,
310,
659,
3182,
5921,
3715... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simplesliceserializer_simpledataserializer_write_fail() {
let mut data: [u8; 2] = [0; 2];
let mut v = SimpleSliceSerializer::new(&mut data);
assert!(matches!(v.write(SAMPLE00), Err(ErrorKind::UnableToWrite)));
let mut data: [u8; 0] = [];
let mut v = SimpleSliceSerializer::new(&mut data);
assert!(matches!(
v.write_u8(SAMPLE01),
Err(ErrorKind::UnableToWrite)
));
assert!(matches!(
v.write_i8(SAMPLE05),
Err(ErrorKind::UnableToWrite)
));
let mut data: [u8; 1] = [0];
let mut v = SimpleSliceSerializer::new(&mut data);
assert!(matches!(
v.write_u16(SAMPLE02),
Err(ErrorKind::UnableToWrite)
));
assert!(matches!(
v.write_i16(SAMPLE06),
Err(ErrorKind::UnableToWrite)
));
let mut data: [u8; 3] = [0; 3];
let mut v = SimpleSliceSerializer::new(&mut data);
assert!(matches!(
v.write_u32(SAMPLE03),
Err(ErrorKind::UnableToWrite)
));
assert!(matches!(
v.write_i32(SAMPLE07),
Err(ErrorKind::UnableToWrite)
));
assert!(matches!(
v.write_f32(SAMPLE09),
Err(ErrorKind::UnableToWrite)
));
let mut data: [u8; 7] = [0; 7];
let mut v = SimpleSliceSerializer::new(&mut data);
assert!(matches!(
v.write_u64(SAMPLE04),
Err(ErrorKind::UnableToWrite)
));
assert!(matches!(
v.write_i64(SAMPLE08),
Err(ErrorKind::UnableToWrite)
));
assert!(matches!(
v.write_f64(SAMPLE10),
Err(ErrorKind::UnableToWrite)
));
let mut data: [u8; 4] = [0; 4];
let mut v = SimpleSliceSerializer::new(&mut data);
assert!(matches!(
v.write_byte_array(SAMPLE11),
Err(ErrorKind::UnableToWrite)
));
} | rust_cleaned_test_functions.jsonl/90003 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 877
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
6664,
642,
37414,
41939,
30015,
27240,
41939,
9165,
22121,
368,
341,
262,
1077,
5206,
821,
25,
508,
84,
23,
26,
220,
17,
60,
284,
508,
15,
26,
220,
17,
935,
262,
1077,
5206,
348,
284,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.