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_bind() {
let mut s = socket();
recv!(s, [(IP_BROADCAST, UDP_SEND, DHCP_DISCOVER)]);
assert_eq!(s.poll(), None);
send!(s, (IP_RECV, UDP_RECV, DHCP_OFFER));
assert_eq!(s.poll(), None);
recv!(s, [(IP_BROADCAST, UDP_SEND, DHCP_REQUEST)]);
assert_eq!(s.poll(), None);
send!(s, (IP_RECV, UDP_RECV, DHCP_ACK));
assert_eq!(
s.poll(),
Some(Event::Configured(Config {
address: Ipv4Cidr::new(MY_IP, 24),
dns_servers: DNS_IPS,
router: Some(SERVER_IP),
}))
);
match &s.state {
ClientState::Renewing(r) => {
assert_eq!(r.renew_at, Instant::from_secs(500));
assert_eq!(r.expires_at, Instant::from_secs(1000));
}
_ => panic!("Invalid state"),
}
} | rust_cleaned_test_functions.jsonl/90232 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 526
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27461,
368,
341,
286,
1077,
5206,
274,
284,
7575,
1428,
286,
27006,
10297,
82,
11,
17826,
3298,
1668,
69519,
11,
42394,
31872,
11,
57587,
12198,
68857,
41958,
286,
2060,
10714,
10297,
82,
41477,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_sub_call_end_no_args_allowed() {
assert_parser_err!(
"END 42",
QError::syntax_error(
"Expected: DEF or FUNCTION or IF or SELECT or SUB or TYPE or end-of-statement"
)
);
} | rust_cleaned_test_functions.jsonl/27895 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 173
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5228,
13429,
6213,
6536,
8384,
42155,
368,
341,
310,
2060,
18517,
9266,
33673,
394,
330,
4689,
220,
19,
17,
756,
394,
1207,
1454,
486,
56193,
4096,
1006,
503,
330,
18896,
25,
23865,
476,
24819,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_receive_general_query() {
let mut ctx = setup_simple_test_environment();
ctx.igmp_join_group(DummyLinkDeviceId, GROUP_ADDR);
ctx.igmp_join_group(DummyLinkDeviceId, GROUP_ADDR_2);
assert_eq!(ctx.timers().len(), 2);
// The initial unsolicited report
assert_eq!(ctx.frames().len(), 2);
assert!(ctx.trigger_next_timer());
assert!(ctx.trigger_next_timer());
assert_eq!(ctx.frames().len(), 4);
receive_igmp_general_query(&mut ctx, Duration::from_secs(10));
// Two new timers should be there.
assert_eq!(ctx.timers().len(), 2);
assert!(ctx.trigger_next_timer());
assert!(ctx.trigger_next_timer());
// Two new reports should be sent
assert_eq!(ctx.frames().len(), 6);
ensure_ttl_ihl_rtr(&ctx);
} | rust_cleaned_test_functions.jsonl/128914 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 387
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38557,
39177,
5738,
368,
341,
286,
1077,
5206,
5635,
284,
6505,
30015,
4452,
51774,
543,
286,
5635,
13,
343,
1307,
31017,
6288,
5432,
8574,
3939,
6985,
764,
11,
26870,
16058,
317,
286,
5635,
13,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mmap_region_set_hugetlbfs() {
assert!(MmapRegion::new(0).is_err());
let size = 4096;
let r = MmapRegion::new(size).unwrap();
assert_eq!(r.size(), size);
assert!(r.file_offset().is_none());
assert_eq!(r.prot(), libc::PROT_READ | libc::PROT_WRITE);
assert_eq!(
r.flags(),
libc::MAP_ANONYMOUS | libc::MAP_NORESERVE | libc::MAP_PRIVATE
);
assert_eq!(r.is_hugetlbfs(), None);
let mut r = MmapRegion::new(size).unwrap();
r.set_hugetlbfs(false);
assert_eq!(r.size(), size);
assert!(r.file_offset().is_none());
assert_eq!(r.prot(), libc::PROT_READ | libc::PROT_WRITE);
assert_eq!(
r.flags(),
libc::MAP_ANONYMOUS | libc::MAP_NORESERVE | libc::MAP_PRIVATE
);
assert_eq!(r.is_hugetlbfs(), Some(false));
let mut r = MmapRegion::new(size).unwrap();
r.set_hugetlbfs(true);
assert_eq!(r.size(), size);
assert!(r.file_offset().is_none());
assert_eq!(r.prot(), libc::PROT_READ | libc::PROT_WRITE);
assert_eq!(
r.flags(),
libc::MAP_ANONYMOUS | libc::MAP_NORESERVE | libc::MAP_PRIVATE
);
assert_eq!(r.is_hugetlbfs(), Some(true));
} | rust_cleaned_test_functions.jsonl/103804 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 712
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
2186,
20627,
2602,
1523,
84,
455,
21123,
3848,
368,
341,
286,
2060,
10297,
44,
2186,
14091,
486,
931,
7,
15,
568,
285,
9266,
5231,
286,
1077,
1379,
284,
220,
19,
15,
24,
21,
401,
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... | 1 |
#[test]
fn test_example() -> Result<()> {
let steps = EXAMPLE
.iter()
.map(|l| parse_reboot_step(l))
.collect::<Result<Vec<_>, _>>()?;
assert_eq!(part_a(&steps), 474140);
assert_eq!(part_b(&steps), 2758514936282235);
Ok(())
} | rust_cleaned_test_functions.jsonl/81679 | {
"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,
39304,
368,
1464,
5714,
71698,
341,
286,
1077,
7354,
284,
66246,
198,
310,
659,
2015,
741,
310,
659,
2186,
22428,
75,
91,
4715,
1288,
4619,
11946,
2333,
1171,
310,
659,
17384,
27638,
2077,
50439,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_new_from_opt_slice() {
let v = [Some(1), Some(2), None];
let data_array: DFInt64Array = NewDataArray::new_from_opt_slice(&v);
let mut iter = data_array.into_iter();
// verify NewDataArray::new_from_opt_slice
assert_eq!(Some(Some(&1)), iter.next());
assert_eq!(Some(Some(&2)), iter.next());
assert_eq!(Some(None), iter.next());
assert_eq!(None, iter.next());
} | rust_cleaned_test_functions.jsonl/102163 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 174
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
5673,
15032,
26488,
368,
341,
262,
1077,
348,
284,
508,
8373,
7,
16,
701,
4329,
7,
17,
701,
2240,
935,
262,
1077,
821,
3858,
25,
43376,
1072,
21,
19,
1857,
284,
1532,
1043,
1857,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_no_fold_do_with_conditional_stopper() {
test_same("do { if (Date.now() > 0) break; } while (0);");
test_same("do { if (Date.now() > 0) continue; } while (0);");
} | rust_cleaned_test_functions.jsonl/382 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 86
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
61187,
26309,
6615,
24433,
3005,
1261,
18487,
368,
341,
262,
1273,
33574,
445,
2982,
314,
421,
320,
1916,
10700,
368,
861,
220,
15,
8,
1438,
26,
335,
1393,
320,
15,
1215,
797,
262,
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... | 1 |
#[test]
fn test_add_torrent() {
test_harness(|| unsafe {
library_init();
let session = get_session();
let torrent_path = "./tests/test.torrent";
let mut gid = A2Gid::default();
assert_eq!(add_torrent(session, &mut gid, torrent_path, &vec![], -1), 0);
assert!(!is_gid_null(gid));
assert_eq!(
add_torrent(
session,
&mut gid,
torrent_path,
&vec![KeyVal {
key: "file-allocation".into(),
val: "foo".into(),
}],
-1,
),
-1
);
session_final(session);
library_deinit();
});
} | rust_cleaned_test_functions.jsonl/25963 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 438
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
528,
48709,
368,
341,
262,
1273,
1523,
23518,
79453,
19860,
341,
286,
6733,
6137,
543,
286,
1077,
3797,
284,
633,
12316,
1428,
286,
1077,
30575,
2638,
284,
5924,
23841,
12697,
734,
48709,
87... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_tree_insert_duplicate_negative() {
let range = RangeInclusive::new(0x100, 0x200).unwrap();
let tree = Box::new(InnerNode::new(range, NodeState::Allocated));
let res = tree.insert(range, NodeState::Free);
assert_eq!(res.unwrap_err(), Error::Overlap(range, range));
} | rust_cleaned_test_functions.jsonl/90293 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11663,
17678,
70434,
53865,
368,
341,
286,
1077,
2088,
284,
16437,
641,
8336,
486,
931,
7,
15,
87,
16,
15,
15,
11,
220,
15,
87,
17,
15,
15,
568,
15454,
543,
286,
1077,
4916,
284,
8261,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_id_parse() {
assert!(TrackId::from_id(ID).is_ok());
assert_eq!(TrackId::from_id(URI), Err(IdError::InvalidId));
assert_eq!(TrackId::from_id(URI_SLASHES), Err(IdError::InvalidId));
assert_eq!(TrackId::from_id(URI_EMPTY), Err(IdError::InvalidId));
assert_eq!(TrackId::from_id(URI_WRONGTYPE1), Err(IdError::InvalidId));
assert_eq!(TrackId::from_id(URI_SHORT), Err(IdError::InvalidId));
assert_eq!(TrackId::from_id(URI_MIXED1), Err(IdError::InvalidId));
assert_eq!(TrackId::from_id(URI_MIXED2), Err(IdError::InvalidId));
} | rust_cleaned_test_functions.jsonl/69259 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 283
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
842,
21039,
368,
341,
286,
2060,
10297,
15667,
764,
486,
1499,
842,
18742,
568,
285,
19817,
1423,
286,
2060,
10714,
10297,
15667,
764,
486,
1499,
842,
7,
10301,
701,
15495,
55924,
1454,
486,
7928,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_chinese_reminder() {
assert_eq!(
vec![(2, 3), (3, 5), (2, 7)]
.into_iter()
.fold(Some((0, 1)), |acc, (y, m)| acc
.and_then(|(x, n)| chinese_reminder(x, n, y, m))),
Some((23, 105))
);
} | rust_cleaned_test_functions.jsonl/74033 | {
"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,
4138,
7346,
19194,
5744,
368,
341,
286,
2060,
10714,
33673,
310,
7486,
0,
9697,
17,
11,
220,
18,
701,
320,
18,
11,
220,
20,
701,
320,
17,
11,
220,
22,
5563,
394,
659,
18122,
11723,
741,
394,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_checksum_min_max_returns_sum_of_max_minus_min() {
let x = checksum_min_max("5 1 9 5\n7 5 3\n2 4 6 8");
assert_eq!(18, x);
} | rust_cleaned_test_functions.jsonl/103469 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64038,
7260,
6345,
58900,
10160,
3575,
6345,
38457,
7260,
368,
341,
286,
1077,
856,
284,
32529,
7260,
6345,
445,
20,
220,
16,
220,
24,
220,
20,
1699,
22,
220,
20,
220,
18,
1699,
17,
220,
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 |
#[test]
fn test_fail_htlc_on_broadcast_after_claim() {
// In an earlier version of 7e78fa660cec8a73286c94c1073ee588140e7a01 we'd also fail the inbound
// channel backwards if we received an HTLC failure after a HTLC fulfillment. Here we test a
// specific case of that by having the HTLC failure come from the ChannelMonitor after a dust
// HTLC was not included in a confirmed commitment transaction.
// channel immediately before commitment occurs. After the commitment transaction reaches
let chanmon_cfgs = create_chanmon_cfgs(3);
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, None, None]);
let mut nodes = create_network(3, &node_cfgs, &node_chanmgrs);
create_announced_chan_between_nodes(&nodes, 0, 1, InitFeatures::known(), InitFeatures::known());
let chan_id_2 = create_announced_chan_between_nodes(&nodes, 1, 2, InitFeatures::known(), InitFeatures::known()).2;
let payment_preimage = route_payment(&nodes[0], &[&nodes[1], &nodes[2]], 2000).0;
let bs_txn = get_local_commitment_txn!(nodes[2], chan_id_2);
assert_eq!(bs_txn.len(), 1);
nodes[2].node.claim_funds(payment_preimage);
check_added_monitors!(nodes[2], 1);
let cs_updates = get_htlc_update_msgs!(nodes[2], nodes[1].node.get_our_node_id());
nodes[1].node.handle_update_fulfill_htlc(&nodes[2].node.get_our_node_id(), &cs_updates.update_fulfill_htlcs[0]);
let bs_updates = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
check_added_monitors!(nodes[1], 1);
expect_payment_forwarded!(nodes[1], nodes[0], nodes[2], Some(1000), false, false);
mine_transaction(&nodes[1], &bs_txn[0]);
check_closed_event!(nodes[1], 1, ClosureReason::CommitmentTxConfirmed);
check_closed_broadcast!(nodes[1], true);
connect_blocks(&nodes[1], ANTI_REORG_DELAY - 1);
check_added_monitors!(nodes[1], 1);
expect_pending_htlcs_forwardable!(nodes[1]);
nodes[0].node.handle_update_fulfill_htlc(&nodes[1].node.get_our_node_id(), &bs_updates.update_fulfill_htlcs[0]);
expect_payment_sent_without_paths!(nodes[0], payment_preimage);
commitment_signed_dance!(nodes[0], nodes[1], bs_updates.commitment_signed, true, true);
expect_payment_path_successful!(nodes[0]);
} | rust_cleaned_test_functions.jsonl/58348 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 873
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22121,
49086,
17257,
4470,
74923,
19844,
84969,
368,
341,
197,
322,
758,
458,
6788,
2319,
315,
220,
22,
68,
22,
23,
3632,
21,
21,
15,
68955,
23,
64,
22,
18,
17,
23,
21,
66,
24,
19,
66,
16,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ogm() {
let format = FileFormat::from_file("fixtures/video/sample.ogm").unwrap();
assert_eq!(format, FileFormat::OggMedia);
} | rust_cleaned_test_functions.jsonl/115190 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 65
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
538,
76,
368,
341,
262,
1077,
3561,
284,
2887,
4061,
486,
1499,
2458,
445,
45247,
41303,
69851,
13,
538,
76,
1827,
15454,
543,
262,
2060,
10714,
10297,
2243,
11,
2887,
4061,
486,
46,
14398,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_skip_multi_comment() {
let mut reader = Lexer::from_str("/*test*/1");
assert_tok(
&mut reader,
TokenKind::LitInt("1".into(), IntBase::Dec, IntSuffix::Int),
1,
9,
);
assert_end(&mut reader, 1, 10);
} | rust_cleaned_test_functions.jsonl/101121 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 170
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44830,
25133,
17638,
368,
341,
286,
1077,
5206,
6604,
284,
85082,
486,
1499,
2895,
445,
1057,
1944,
1812,
16,
797,
286,
2060,
76162,
1006,
310,
609,
6984,
6604,
345,
310,
9660,
10629,
486,
68954,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rollback_hook() -> Result<()> {
let db = Connection::open_in_memory()?;
static CALLED: AtomicBool = AtomicBool::new(false);
db.rollback_hook(Some(|| {
CALLED.store(true, Ordering::Relaxed);
}));
db.execute_batch("BEGIN; CREATE TABLE foo (t TEXT); ROLLBACK;")?;
assert!(CALLED.load(Ordering::Relaxed));
Ok(())
} | rust_cleaned_test_functions.jsonl/132860 | {
"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,
62,
33559,
32005,
368,
1464,
5714,
71698,
341,
286,
1077,
2927,
284,
11032,
486,
2508,
1243,
19195,
368,
69493,
286,
1099,
32907,
13639,
25,
30316,
11233,
284,
30316,
11233,
486,
931,
3576,
317,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_install_component_directories_failing() {
let (at, mut ucmd) = at_and_ucmd!();
let component = "test_install_target_dir_component_d1";
let directories_arg = "-d";
at.mkdir(component);
assert!(ucmd
.arg(directories_arg)
.arg(component)
.fails()
.stderr
.contains("File exists"));
} | rust_cleaned_test_functions.jsonl/124408 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 170
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34245,
23406,
32871,
2433,
761,
14277,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
1077,
3692,
284,
330,
1944,
34245,
11123,
4334,
23406,
814... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_maybe_owned() {
assert_eq!("abcde".into_maybe_owned(), Slice("abcde"));
assert_eq!((String::from_str("abcde")).into_maybe_owned(), Slice("abcde"));
assert_eq!("abcde".into_maybe_owned(), Owned(String::from_str("abcde")));
assert_eq!((String::from_str("abcde")).into_maybe_owned(),
Owned(String::from_str("abcde")));
} | rust_cleaned_test_functions.jsonl/56869 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 187
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45514,
717,
49791,
51973,
368,
341,
286,
2060,
10714,
17223,
13683,
450,
3263,
18122,
717,
49791,
51973,
1507,
56476,
445,
13683,
450,
4010,
286,
2060,
10714,
0,
1188,
703,
486,
1499,
2895,
445,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_negation() {
let a = BigNum::from_u32(909_829_283).unwrap();
assert!(!a.is_negative());
assert!((-a).is_negative());
} | rust_cleaned_test_functions.jsonl/52796 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 88
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28209,
367,
368,
341,
286,
1077,
264,
284,
6164,
4651,
486,
1499,
7300,
18,
17,
7,
24,
15,
24,
62,
23,
17,
24,
62,
17,
23,
18,
568,
15454,
1428,
286,
2060,
0,
3471,
64,
2079,
53865,
1423,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_move_iterator() {
let xs = vec![1u,2,3,4,5];
assert_eq!(xs.into_iter().fold(0, |a: uint, b: uint| 10*a + b), 12345);
} | rust_cleaned_test_functions.jsonl/31850 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17134,
13491,
368,
341,
286,
1077,
11943,
284,
7486,
20703,
16,
84,
11,
17,
11,
18,
11,
19,
11,
20,
935,
286,
2060,
10714,
10297,
18561,
39860,
11723,
1005,
19961,
7,
15,
11,
760,
64,
25,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_generic_generate_evaluator() {
let gen = generic_fn();
let expected: TokenStream = quote! {
pub struct Foo_Evaluator<A: M, B>(std::marker::PhantomData<(A, B)>)
where
B: N<A>;
impl<'arg_, A: M, B, > crate::function::Evaluator<'arg_> for Foo_Evaluator<A, B>
where
B: N<A>
{
#[inline]
fn eval(
self,
def: impl crate::function::ArgDef,
ctx: &mut tidb_query_datatype::expr::EvalContext,
output_rows: usize,
args: &[crate::RpnStackNode<'_>],
extra: &mut crate::RpnFnCallExtra<'_>,
metadata: &(dyn std::any::Any + Send),
) -> tidb_query_common::Result<tidb_query_datatype::codec::data_type::VectorValue> {
Foo_Fn::<A, B>::eval(def, ctx, output_rows, args, extra, metadata)
}
}
};
assert_eq!(expected.to_string(), gen.generate_evaluator().to_string());
} | rust_cleaned_test_functions.jsonl/17085 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 666
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41232,
48851,
21296,
45162,
368,
341,
286,
1077,
4081,
284,
13954,
15246,
543,
286,
1077,
3601,
25,
9660,
3027,
284,
12641,
0,
341,
310,
6675,
2036,
33428,
2089,
52389,
30192,
25,
386,
11,
425,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_f32x4_accessors_and_mutators() {
let a = F32x4::new(5.0, 6.0, 7.0, 8.0);
assert_eq!((a.x(), a.y(), a.z(), a.w()), (5.0, 6.0, 7.0, 8.0));
let mut b = F32x4::new(10.0, 11.0, 12.0, 13.0);
b.set_x(20.0);
b.set_y(30.0);
b.set_z(40.0);
b.set_w(50.0);
assert_eq!(b, F32x4::new(20.0, 30.0, 40.0, 50.0));
} | rust_cleaned_test_functions.jsonl/66182 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
18,
17,
87,
19,
12759,
1087,
8378,
29523,
2973,
368,
341,
262,
1077,
264,
284,
434,
18,
17,
87,
19,
486,
931,
7,
20,
13,
15,
11,
220,
21,
13,
15,
11,
220,
22,
13,
15,
11,
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_one() {
let mut dec = MultiResponseDecoder::<TO>::new();
{
let mut stream = dec.process_next_chunk(
br#"{
"type": "ADDED",
"object": {
"kind": "Pod",
"apiVersion": "v1",
"metadata": {
"uid": "uid0"
}
}
}"#,
);
assert_test_object(stream.next(), "uid0");
assert!(stream.next().is_none());
}
assert!(dec.finish().is_ok());
} | rust_cleaned_test_functions.jsonl/14559 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 432
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11667,
368,
341,
286,
1077,
5206,
1622,
284,
17439,
2582,
20732,
27638,
5207,
6831,
931,
1428,
286,
341,
310,
1077,
5206,
4269,
284,
1622,
16988,
11257,
30539,
1006,
394,
1411,
55543,
515,
503,
33... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_splitator() {
fn t(s: &str, sep: &str, u: &[&str]) {
let v: Vec<&str> = s.split(sep).collect();
assert_eq!(v, u);
}
t("--1233345--", "12345", &["--1233345--"]);
t("abc::hello::there", "::", &["abc", "hello", "there"]);
t("::hello::there", "::", &["", "hello", "there"]);
t("hello::there::", "::", &["hello", "there", ""]);
t("::hello::there::", "::", &["", "hello", "there", ""]);
t("ประเทศไทย中华Việt Nam", "中华", &["ประเทศไทย", "Việt Nam"]);
t("zzXXXzzYYYzz", "zz", &["", "XXX", "YYY", ""]);
t("zzXXXzYYYz", "XXX", &["zz", "zYYYz"]);
t(".XXX.YYY.", ".", &["", "XXX", "YYY", ""]);
t("", ".", &[""]);
t("zz", "zz", &["",""]);
t("ok", "z", &["ok"]);
t("zzz", "zz", &["","z"]);
t("zzzzz", "zz", &["","","z"]);
} | rust_cleaned_test_functions.jsonl/17648 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 456
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
850,
368,
341,
262,
5168,
259,
1141,
25,
609,
495,
11,
21017,
25,
609,
495,
11,
575,
25,
44590,
5,
495,
2467,
341,
286,
1077,
348,
25,
11312,
52244,
495,
29,
284,
274,
5289,
10478,
79... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_flate_round_trip() {
let mut r = rand::thread_rng();
let mut words = vec!();
for _ in 0..20 {
let range = r.gen_range(1, 10);
let v = r.gen_iter::<u8>().take(range).collect::<Vec<u8>>();
words.push(v);
}
for _ in 0..20 {
let mut input = vec![];
for _ in 0..2000 {
input.push_all(r.choose(&words).unwrap());
}
debug!("de/inflate of {} bytes of random word-sequences",
input.len());
let cmp = deflate_bytes(&input).expect("deflation failed");
let out = inflate_bytes(&cmp).expect("inflation failed");
debug!("{} bytes deflated to {} ({:.1}% size)",
input.len(), cmp.len(),
100.0 * ((cmp.len() as f64) / (input.len() as f64)));
assert_eq!(&*input, &*out);
}
} | rust_cleaned_test_functions.jsonl/21310 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 513
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
5075,
29896,
63883,
368,
341,
286,
1077,
5206,
435,
284,
10382,
486,
4528,
66849,
543,
286,
1077,
5206,
4244,
284,
7486,
0,
543,
286,
369,
716,
304,
220,
15,
496,
17,
15,
341,
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... | 4 |
#[test]
fn test_legal_moves_banmen_with_kaku_top_wall_self_gote() {
let blank_banmen = Banmen([[Blank; 9]; 9]);
let mut wall_banmen = blank_banmen.clone();
for x in 1..8 {
wall_banmen.0[0][x] = GFu;
}
for x in 2..7 {
let mut banmen = wall_banmen.clone();
banmen.0[1][x] = GKaku;
assert_eq!(legal_moves_from_banmen(&Teban::Gote,&banmen),
Rule::legal_moves_from_banmen(Teban::Gote,&State::new(banmen.clone())).into_iter().map(|m| {
LegalMove::from(m)
}).collect::<Vec<LegalMove>>()
);
}
} | rust_cleaned_test_functions.jsonl/81105 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 278
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82324,
45390,
880,
276,
5676,
6615,
4698,
23557,
10426,
50731,
25637,
1889,
1272,
368,
972,
10217,
10113,
880,
276,
5676,
284,
22730,
5676,
27119,
22770,
26,
220,
24,
5265,
220,
24,
55531,
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... | 3 |
#[test]
fn test_open_ex_ro_vector() {
Dataset::open_ex(
fixture!("roads.geojson"),
DatasetOptions {
open_flags: GDALAccess::GA_ReadOnly.into(),
..DatasetOptions::default()
},
)
.unwrap();
} | rust_cleaned_test_functions.jsonl/67888 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11311,
2702,
26608,
12247,
368,
341,
286,
39183,
486,
2508,
2702,
1006,
310,
12507,
17223,
42691,
61188,
2236,
4461,
310,
39183,
3798,
341,
394,
1787,
14130,
25,
39627,
969,
6054,
486,
16128,
62,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_remove_after_nested_getter_only_access() {
test(
concat!(
"var a = {",
" b: { get property() {} }",
"};",
"a.b.property.d.e;",
),
concat!(
"var a = {",
" b: { get property() {} }",
"};",
"a.b.property;",
),
);
} | rust_cleaned_test_functions.jsonl/493 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 242
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
19844,
66279,
3062,
465,
18410,
12759,
368,
341,
262,
1273,
1006,
286,
33720,
33673,
310,
330,
947,
264,
284,
314,
497,
715,
310,
330,
220,
293,
25,
314,
633,
3343,
368,
4687,
335,
756,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pwrite_error_write_to_read_only_file() {
let file_name =
"/tmp/odu-common_operations-test_pwrite_error_write_to_read_only_file-file01"
.to_string();
// Create a file in rw mode if it doesn't exists.
File::create(&file_name).unwrap();
// Open the file in read-only mode and try to write to it.
let f = OpenOptions::new().read(true).write(false).open(file_name).unwrap();
let mut buffer = vec![0; 100];
let ret = pwrite(f.as_raw_fd(), &mut buffer, 0);
assert!(ret.is_err());
assert_eq!(ret.err(), Some(Error::DoIoError(ErrorKind::Other)));
} | rust_cleaned_test_functions.jsonl/26661 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 306
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
4934,
4096,
9165,
2346,
6443,
18410,
2458,
368,
341,
286,
1077,
1034,
1269,
4035,
310,
3521,
5173,
14,
75955,
45045,
57345,
16839,
620,
4934,
4096,
9165,
2346,
6443,
18410,
2458,
14203,
15,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_projective_to_affine() {
let a = G1Projective::generator();
let b = G1Projective::identity();
assert!(bool::from(G1Affine::from(a).is_on_curve()));
assert!(!bool::from(G1Affine::from(a).is_identity()));
assert!(bool::from(G1Affine::from(b).is_on_curve()));
assert!(bool::from(G1Affine::from(b).is_identity()));
let z = Fp::from_raw_unchecked([
0xba7a_fa1f_9a6f_e250,
0xfa0f_5b59_5eaf_e731,
0x3bdc_4776_94c3_06e7,
0x2149_be4b_3949_fa24,
0x64aa_6e06_49b2_078c,
0x12b1_08ac_3364_3c3e,
]);
let c = G1Projective {
x: a.x * z,
y: a.y * z,
z,
};
assert_eq!(G1Affine::from(c), G1Affine::generator());
} | rust_cleaned_test_functions.jsonl/110210 | {
"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,
16352,
533,
2346,
48914,
482,
368,
341,
262,
1077,
264,
284,
479,
16,
7849,
533,
486,
35851,
543,
262,
1077,
293,
284,
479,
16,
7849,
533,
486,
16912,
1428,
262,
2060,
10297,
2641,
486,
1499,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_assignment() {
assert_eq!(ParseProgress::none(""), assignment(""));
assert_eq!(ParseProgress::none("x"), assignment("x"));
assert_eq!(ParseProgress::some("", "x"), assignment("x ="));
assert_eq!(ParseProgress::none("x =>"), assignment("x =>"));
} | rust_cleaned_test_functions.jsonl/26570 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 130
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51891,
368,
341,
286,
2060,
10714,
10297,
14463,
9496,
486,
6697,
86076,
16319,
89744,
286,
2060,
10714,
10297,
14463,
9496,
486,
6697,
445,
87,
3975,
16319,
445,
87,
4010,
286,
2060,
10714,
10297,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_var_dim_ids()
{
const DIM_NAME_1: &str = "dim_1";
const DIM_SIZE_1: usize = 10;
const DIM_NAME_2: &str = "dim_2";
const DIM_SIZE_2: usize = 20;
const DIM_NAME_3: &str = "dim_3";
const DIM_SIZE_3: usize = 30;
const VAR_NAME_1: &str = "var_1";
const VAR_DIMS_LIST_1 : &[&str] = &[DIM_NAME_1, DIM_NAME_2, DIM_NAME_3];
const VAR_NAME_2: &str = "var_2";
const VAR_DIMS_LIST_2 : &[&str] = &[DIM_NAME_3, DIM_NAME_2];
const UNDEF_VAR_NAME: &str = "undef_var";
let mut data_set = DataSet::new();
// Add 2 dimensions
data_set.set_unlimited_dim(DIM_NAME_1, DIM_SIZE_1).unwrap();
data_set.add_fixed_dim(DIM_NAME_2, DIM_SIZE_2).unwrap();
data_set.add_fixed_dim(DIM_NAME_3, DIM_SIZE_3).unwrap();
data_set.add_var_i32(VAR_NAME_1, VAR_DIMS_LIST_1).unwrap();
data_set.add_var_i32(VAR_NAME_2, VAR_DIMS_LIST_2).unwrap();
assert_eq!(2, data_set.num_vars());
assert_eq!(true, data_set.has_var(VAR_NAME_1));
assert_eq!(Some(vec![0, 1, 2]), data_set.get_var_dim_ids(VAR_NAME_1));
assert_eq!(true, data_set.has_var(VAR_NAME_2));
assert_eq!(Some(vec![2, 1]), data_set.get_var_dim_ids(VAR_NAME_2));
assert_eq!(false, data_set.has_var(UNDEF_VAR_NAME));
assert_eq!(None, data_set.get_var_dim_ids(UNDEF_VAR_NAME));
} | rust_cleaned_test_functions.jsonl/40520 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 869
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
4612,
10791,
8077,
741,
515,
262,
733,
50859,
4708,
62,
16,
25,
609,
495,
284,
330,
12927,
62,
16,
876,
262,
733,
50859,
4098,
62,
16,
25,
22301,
284,
220,
16,
15,
280,
262,
733,
50859... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ripemd160() {
let tests = [
HashTest("616263", "8eb208f7e05d987a9b044a8e98c6b087f15a0bfc")
];
for test in tests.iter() {
hash_test(super::RIPEMD160, test);
}
} | rust_cleaned_test_functions.jsonl/17563 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
4561,
94110,
16,
21,
15,
368,
341,
286,
1077,
7032,
284,
2278,
310,
6531,
2271,
445,
21,
16,
21,
17,
21,
18,
497,
330,
23,
3065,
17,
15,
23,
69,
22,
68,
15,
20,
67,
24,
23,
22,
64,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_one_or_many_prefer_one() {
#[serde_as]
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct S1Vec(#[serde_as(as = "OneOrMany<_>")] Vec<u32>);
// Normal
is_equal(S1Vec(vec![]), expect![[r#"[]"#]]);
is_equal(S1Vec(vec![1]), expect![[r#"1"#]]);
is_equal(
S1Vec(vec![1, 2, 3]),
expect![[r#"
[
1,
2,
3
]"#]],
);
check_deserialization(S1Vec(vec![1]), r#"1"#);
check_deserialization(S1Vec(vec![1]), r#"[1]"#);
check_error_deserialization::<S1Vec>(r#"{}"#, expect![[r#"a list or single element"#]]);
check_error_deserialization::<S1Vec>(r#""xx""#, expect![[r#"a list or single element"#]]);
#[serde_as]
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct S2Vec(#[serde_as(as = "OneOrMany<DisplayFromStr>")] Vec<u32>);
// Normal
is_equal(S2Vec(vec![]), expect![[r#"[]"#]]);
is_equal(S2Vec(vec![1]), expect![[r#""1""#]]);
is_equal(
S2Vec(vec![1, 2, 3]),
expect![[r#"
[
"1",
"2",
"3"
]"#]],
);
check_deserialization(S2Vec(vec![1]), r#""1""#);
check_deserialization(S2Vec(vec![1]), r#"["1"]"#);
check_error_deserialization::<S2Vec>(r#"{}"#, expect![[r#"a list or single element"#]]);
check_error_deserialization::<S2Vec>(r#""xx""#, expect![[r#"a list or single element"#]]);
} | rust_cleaned_test_functions.jsonl/45736 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 813
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11667,
8734,
22101,
10442,
802,
11667,
368,
341,
262,
11506,
47024,
11898,
921,
262,
11506,
27098,
42618,
11,
39900,
11,
48440,
11,
55039,
5563,
262,
2036,
328,
16,
10050,
7,
13353,
47024,
11898,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_value() {
let val = NSValue::new(13u32);
assert_eq!(val.get(), 13);
assert!(u32::ENCODING.equivalent_to_str(val.encoding().unwrap()));
} | rust_cleaned_test_functions.jsonl/40283 | {
"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,
3142,
368,
341,
286,
1077,
1044,
284,
3043,
1130,
486,
931,
7,
16,
18,
84,
18,
17,
317,
286,
2060,
10714,
10297,
831,
670,
1507,
220,
16,
18,
317,
286,
2060,
10297,
84,
18,
17,
486,
16226,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_emit_testq_reg_reg() {
assert_emit!(0x48, 0x85, 0xc0; emit_testq_reg_reg(RAX, RAX));
assert_emit!(0x48, 0x85, 0xc6; emit_testq_reg_reg(RAX, RSI));
assert_emit!(0x49, 0x85, 0xc7; emit_testq_reg_reg(RAX, R15));
} | rust_cleaned_test_functions.jsonl/85424 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
69082,
4452,
80,
4920,
4920,
368,
341,
286,
2060,
69082,
10297,
15,
87,
19,
23,
11,
220,
15,
87,
23,
20,
11,
220,
15,
8148,
15,
26,
16691,
4452,
80,
4920,
4920,
2785,
2954,
11,
431,
2954,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_negate_conjunctions() -> TestResult {
let p = Polar::new();
p.load_str(
r#"f(x) if not (y = 1 and x.foo = y);
g(x) if not (x.foo = y and 1 = y);
h(x) if not (y = 1 and x.foo.bar = y);
i(x) if not (y = x.foo.bar and 1 = y);"#,
)?;
let mut q = p.new_query_from_term(term!(call!("f", [sym!("x")])), false);
assert_partial_expression!(next_binding(&mut q)?, "x", "1 != _this.foo"); // FIXME order reversed??
assert_query_done!(q);
let mut q = p.new_query_from_term(term!(call!("g", [sym!("x")])), false);
assert_partial_expression!(next_binding(&mut q)?, "x", "1 != _this.foo"); // here too
assert_query_done!(q);
let mut q = p.new_query_from_term(term!(call!("h", [sym!("x")])), false);
assert_partial_expression!(next_binding(&mut q)?, "x", "1 != _this.foo.bar"); // and here
assert_query_done!(q);
let mut q = p.new_query_from_term(term!(call!("i", [sym!("x")])), false);
assert_partial_expression!(next_binding(&mut q)?, "x", "1 != _this.foo.bar"); // not here!
assert_query_done!(q);
Ok(())
} | rust_cleaned_test_functions.jsonl/63025 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 600
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28209,
349,
3382,
72428,
82,
368,
1464,
3393,
2077,
341,
286,
1077,
281,
284,
55896,
486,
931,
543,
286,
281,
5104,
2895,
1006,
310,
435,
55543,
69,
2075,
8,
421,
537,
320,
88,
284,
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... | 6 |
#[test]
fn test_display_avoidance() {
assert_eq!("tolls", Avoidance::Tolls.to_string());
assert_eq!("highways", Avoidance::Highways.to_string());
assert_eq!("ferries", Avoidance::Ferries.to_string());
assert_eq!("indoors", Avoidance::Indoors.to_string());
} | rust_cleaned_test_functions.jsonl/75490 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 131
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14825,
26173,
588,
681,
368,
341,
286,
2060,
10714,
17223,
83,
67878,
497,
34006,
681,
486,
51,
67878,
2389,
3904,
1423,
286,
2060,
10714,
17223,
11892,
2284,
497,
34006,
681,
486,
11976,
2284,
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_build_url_mapping() {
let url_builder = ElasticsearchUrlBuilder::new("http://server".to_string(), "INDEX_NAME".to_string());
assert_that(&url_builder.mapping()).is_equal_to("http://server/INDEX_NAME/_mapping".to_string());
} | rust_cleaned_test_functions.jsonl/35095 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 92
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20801,
2903,
26930,
368,
341,
220,
1077,
2515,
28532,
284,
58887,
2864,
3297,
486,
931,
445,
1254,
1110,
4030,
3263,
983,
3904,
1507,
330,
44331,
4708,
3263,
983,
3904,
5231,
220,
2060,
70197,
209... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_functions() {
test_roundtrip("function foo() {}");
test_roundtrip("function foo(x, y) {}");
test_roundtrip("function foo(x, y=3) {}");
test_roundtrip("function foo([x, y], {z}) {}");
test_roundtrip("function foo([x, y] = [1,2], {z:q}) {}");
test_roundtrip("function foo() { return this; }");
test_roundtrip("function *foo() {}");
test_roundtrip("function *foo() { yield 1; }");
test_roundtrip("function *foo() { yield* f(); }");
test_roundtrip("async function foo() {}");
test_roundtrip("async function foo() { await f(); }");
test_roundtrip("async function *foo() {}");
test_roundtrip("async function *foo() { await f(); yield 1; }");
test_roundtrip("x => 3");
test_roundtrip("(x) => 3");
test_roundtrip("(x,y) => 3");
test_roundtrip("x => {3}");
test_roundtrip("async x => {3}");
test_roundtrip("async (x,y) => {3}");
test_roundtrip("(x => 1) + (y => 1)");
test_roundtrip("x = y => 1");
test_roundtrip("x = (y => 1)");
test_roundtrip(
"function foo() {
return (y => 1);
}",
);
test_roundtrip(
"function* foo() {
yield y => 1;
}",
);
} | rust_cleaned_test_functions.jsonl/102592 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 516
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31708,
368,
341,
262,
1273,
29896,
32981,
445,
1688,
15229,
368,
4687,
797,
262,
1273,
29896,
32981,
445,
1688,
15229,
2075,
11,
379,
8,
4687,
797,
262,
1273,
29896,
32981,
445,
1688,
15229,
2075,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_keygen_sign_verify() {
let msg = [0; 100];
let (pk, mut sk) = keypair();
let orig_sk = sk.clone();
let sig = sign(&mut sk, &msg);
assert!(orig_sk != sk, "sk not updated");
assert!(verify(&msg, &sig, &pk));
} | rust_cleaned_test_functions.jsonl/123297 | {
"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,
3097,
4370,
11172,
35638,
368,
341,
286,
1077,
3750,
284,
508,
15,
26,
220,
16,
15,
15,
935,
286,
1077,
320,
20819,
11,
5206,
1901,
8,
284,
1376,
12670,
543,
286,
1077,
2713,
33811,
284,
1901,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_multiple_roles() {
let s = "3d6 2d8 1d20";
let rolls = parse_rolls(s).expect("Bad parse");
assert_eq!(rolls.len(), 3);
} | rust_cleaned_test_functions.jsonl/52848 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 93
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
45233,
43061,
368,
341,
286,
1077,
274,
284,
330,
18,
67,
21,
220,
17,
67,
23,
220,
16,
67,
17,
15,
876,
286,
1077,
27373,
284,
4715,
62,
38274,
1141,
568,
17119,
445,
17082,
4715,
79... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_part_1() {
assert_eq!(run(INPUT_1, false), 159);
assert_eq!(run(INPUT_2, false), 135);
assert_eq!(run(include_str!("../../input/03.txt"), false), 1519);
} | rust_cleaned_test_functions.jsonl/8086 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10495,
62,
16,
368,
341,
286,
2060,
10714,
10297,
6108,
57911,
62,
16,
11,
895,
701,
220,
16,
20,
24,
317,
286,
2060,
10714,
10297,
6108,
57911,
62,
17,
11,
895,
701,
220,
16,
18,
20,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fizz_and_buzz() {
let three_four = FizzBuzz::new(3, 4);
let two_five = FizzBuzz::new(2, 5);
assert_eq!("fizzbuzz", three_four.get_value(12));
assert_eq!("fizzbuzz", three_four.get_value(12));
assert_eq!("fizzbuzz", three_four.get_value(12));
assert_eq!("fizzbuzz", two_five.get_value(100));
assert_eq!("fizzbuzz", two_five.get_value(521));
assert_eq!("fizzbuzz", three_four.get_value(12));
} | rust_cleaned_test_functions.jsonl/74963 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 243
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
8759,
8378,
880,
8889,
368,
341,
286,
1077,
2326,
56142,
284,
434,
8759,
59473,
486,
931,
7,
18,
11,
220,
19,
317,
286,
1077,
1378,
95258,
284,
434,
8759,
59473,
486,
931,
7,
17,
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_from_affine_shear_z() {
let shear_z_with_x = 3;
let shear_z_with_y = 11;
let matrix = Matrix4x4::from_affine_shear_z(shear_z_with_x, shear_z_with_y);
let expected = Vector4::new(1, 1, 1 + shear_z_with_x + shear_z_with_y, 1);
let result = matrix * Vector4::new(1, 1, 1, 1);
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/129114 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 199
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
48914,
482,
643,
86060,
6415,
368,
341,
286,
1077,
64244,
6415,
6615,
3212,
284,
220,
18,
280,
286,
1077,
64244,
6415,
6615,
4178,
284,
220,
16,
16,
280,
286,
1077,
6172,
284,
11631,
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_update() {
let readlist = readlist_from(vec![
("feed1", vec!["post1", "post2"]),
("feed2", vec!["post3", "post4"]),
]);
let feeds = readlist_from(vec![
("feed1", vec!["post1", "post3"]),
("feed3", vec!["post5", "post6"]),
]);
let output = _update(feeds.clone(), readlist.clone());
assert_eq!(3, output.len());
assert_eq!(
vec![
"post1".to_string(),
"post2".to_string(),
"post3".to_string()
],
output["feed1"]
);
assert_eq!(readlist["feed2"], output["feed2"]);
assert_eq!(feeds["feed3"], output["feed3"]);
} | rust_cleaned_test_functions.jsonl/56102 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 421
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
368,
341,
286,
1077,
1349,
1607,
284,
1349,
1607,
5673,
25592,
90515,
310,
3489,
11184,
16,
497,
7486,
0,
1183,
2203,
16,
497,
330,
2203,
17,
46442,
310,
3489,
11184,
17,
497,
7486,
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... | 1 |
#[test]
fn test_offer() {
test_decode!(
Offer,
r#"
<MyOffer>false</MyOffer>
<SubCondition>new</SubCondition>
<SellerFeedbackRating>
<SellerPositiveFeedbackRating>95.0</SellerPositiveFeedbackRating>
<FeedbackCount>618</FeedbackCount>
</SellerFeedbackRating>
<ShippingTime minimumHours="24" maximumHours="24" availabilityType="NOW"/>
<ListingPrice>
<CurrencyCode>GBP</CurrencyCode>
<Amount>239.95</Amount>
</ListingPrice>
<Shipping>
<CurrencyCode>GBP</CurrencyCode>
<Amount>0.00</Amount>
</Shipping>
<ShipsFrom>
<Country>GB</Country>
</ShipsFrom>
<IsFulfilledByAmazon>false</IsFulfilledByAmazon>
<IsBuyBoxWinner>false</IsBuyBoxWinner>
<IsFeaturedMerchant>true</IsFeaturedMerchant>
"#,
Offer {
MyOffer: false,
SubCondition: "new".to_string(),
SellerFeedbackRating: SellerFeedbackRating {
SellerPositiveFeedbackRating: Some("95.0".to_string()),
FeedbackCount: 618,
},
ShippingTime: ShippingTime {
MinimumHours: Some(24),
MaximumHours: Some(24),
AvailableDate: None,
AvailabilityType: Some(AvailabilityType::NOW),
},
ListingPrice: MoneyType {
CurrencyCode: "GBP".to_string(),
Amount: "239.95".to_string(),
},
Shipping: MoneyType {
CurrencyCode: "GBP".to_string(),
Amount: "0.00".to_string(),
},
ShipsFrom: Some(ShipsFrom {
Country: "GB".to_string(),
..Default::default()
}),
IsFulfilledByAmazon: false,
IsBuyBoxWinner: false,
IsFeaturedMerchant: true,
}
);
} | rust_cleaned_test_functions.jsonl/124961 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 906
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67814,
368,
341,
262,
1273,
15227,
33673,
414,
24498,
345,
414,
435,
2,
698,
286,
366,
5050,
39462,
30392,
522,
5050,
39462,
397,
286,
366,
3136,
10547,
29,
931,
522,
3136,
10547,
397,
286,
366,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_vfio_container() {
let kvm_device = create_kvm_device();
assert!(VfioContainer::new(Arc::new(kvm_device)).is_ok());
} | rust_cleaned_test_functions.jsonl/88087 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 80
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
2273,
69,
815,
15847,
368,
341,
286,
1077,
94748,
9204,
284,
1855,
4698,
7338,
9204,
1428,
286,
2060,
10297,
53,
69,
815,
4502,
486,
931,
4346,
1287,
486,
931,
5969,
7338,
9204,
4579,
285,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_get_config_long_value() {
let config = Config::get_config(
"report.test.filter",
"report.test.description test\nreport.test.filter filter and\n test\nreport.test.columns=id",
);
assert_eq!(config.unwrap(), "filter and test");
} | rust_cleaned_test_functions.jsonl/77075 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
5332,
17799,
3142,
368,
341,
286,
1077,
2193,
284,
5532,
486,
455,
5332,
1006,
310,
330,
11736,
5958,
6936,
756,
310,
330,
11736,
5958,
13178,
1273,
1699,
11736,
5958,
6936,
4051,
323,
1699,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_case_9() {
let key = [
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
];
let message = [
0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff,
];
let expected = [
0xfa, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff,
];
poly1305_test_runner(&key, &message, &expected).unwrap();
} | rust_cleaned_test_functions.jsonl/27924 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 331
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19096,
62,
24,
368,
341,
197,
10217,
1376,
284,
2278,
298,
197,
15,
87,
15,
17,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_background_reverse() {
let mut style = Style::new(COLORS);
style.reverse = true;
assert_eq!(style.background(), COLORS.foreground);
style.colors.foreground = None;
assert_eq!(style.background(), None);
} | rust_cleaned_test_functions.jsonl/128017 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24103,
43277,
368,
341,
286,
1077,
5206,
1707,
284,
11913,
486,
931,
87411,
50,
317,
286,
1707,
32081,
284,
830,
401,
286,
2060,
10714,
10297,
3528,
11717,
1507,
86822,
54569,
1951,
317,
286,
1707... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_array_apply() -> Result<()> {
let array = new_test_uint16_array(5, 0, 5);
let arrays = vec![
array.apply(|arr| arr + 10),
array.apply_with_idx(|(_, arr)| arr + 10),
array.apply_with_idx_on_opt(|(_, arr)| match arr {
Some(v) => Some(v + 20),
None => Some(0),
}),
array.apply_cast_numeric(|arr| arr + 30),
array.branch_apply_cast_numeric_no_null(|arr| match arr {
Some(v) => (v + 40) as u16,
None => 0_u16,
}),
];
let values = vec![
arrays[0].inner(),
arrays[1].inner(),
arrays[2].inner(),
arrays[3].inner(),
arrays[4].inner(),
];
assert_eq!(2, values[0].null_count());
assert!(values[0].is_null(0));
assert_eq!(11, values[0].value(1));
assert_eq!(12, values[0].value(2));
assert!(values[0].is_null(3));
assert_eq!(14, values[0].value(4));
assert_eq!(2, values[1].null_count());
assert!(values[1].is_null(0));
assert_eq!(11, values[1].value(1));
assert_eq!(12, values[1].value(2));
assert!(values[1].is_null(3));
assert_eq!(14, values[1].value(4));
assert_eq!(0, values[2].null_count());
assert_eq!(0, values[2].value(0));
assert_eq!(21, values[2].value(1));
assert_eq!(22, values[2].value(2));
assert_eq!(0, values[2].value(3));
assert_eq!(24, values[2].value(4));
assert_eq!(2, values[3].null_count());
assert!(values[3].is_null(0));
assert_eq!(31, values[3].value(1));
assert_eq!(32, values[3].value(2));
assert!(values[3].is_null(3));
assert_eq!(34, values[3].value(4));
assert_eq!(2, values[4].null_count());
assert!(values[4].is_null(0));
assert_eq!(41, values[4].value(1));
assert_eq!(42, values[4].value(2));
assert!(values[4].is_null(3));
assert_eq!(44, values[4].value(4));
Ok(())
} | rust_cleaned_test_functions.jsonl/72607 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 948
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
36551,
368,
1464,
5714,
71698,
341,
1066,
262,
1077,
1334,
284,
501,
4452,
15807,
16,
21,
3858,
7,
20,
11,
220,
15,
11,
220,
20,
317,
262,
1077,
18386,
284,
7486,
90515,
286,
1334,
13045... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_six_generations_v1() {
let mut p = PocketDimension::new3(&Pos3(0,0,0), test_grid());
for _ in 0..6 {
p = p.next_generation();
}
assert_eq!(p.active_cubes(), 112);
} | rust_cleaned_test_functions.jsonl/76750 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
941,
71963,
804,
2273,
16,
368,
341,
286,
1077,
5206,
281,
284,
45724,
26121,
486,
931,
18,
2099,
4859,
18,
7,
15,
11,
15,
11,
15,
701,
1273,
15604,
1423,
286,
369,
716,
304,
220,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_parse_event() {
let endpoint = "https://ropsten.infura.io/v3/71c02c451b6248708e493c4ea007c3b2";
let hash = "0x480fc6cca516277b01b1e6b8a7c771d1b747096da3724d6aa7c8d9f4e2302278";
let addr = "0x430a0670b8197e6a67cfe921b0d5601a0fa3dab7";
let (lock, unlock) = parse_event(endpoint, addr, hash).unwrap();
println!("{:?}", lock);
println!("hahahah");
} | rust_cleaned_test_functions.jsonl/76360 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 207
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
6748,
368,
341,
262,
1077,
14887,
284,
330,
2428,
1110,
887,
15795,
30957,
5690,
4245,
5457,
18,
14,
22,
16,
66,
15,
17,
66,
19,
20,
16,
65,
21,
17,
19,
23,
22,
15,
23,
68,
19,
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_div() {
assert_eq!(Vec3::new(1.0, -2.0, 0.0) / 2.0, Vec3::new(0.5, -1.0, 0.0));
} | rust_cleaned_test_functions.jsonl/35227 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 77
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16237,
368,
341,
286,
2060,
10714,
10297,
10050,
18,
486,
931,
7,
16,
13,
15,
11,
481,
17,
13,
15,
11,
220,
15,
13,
15,
8,
608,
220,
17,
13,
15,
11,
11312,
18,
486,
931,
7,
15,
13,
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 |
#[test]
fn test_make_ascii_upper_case() {
macro_rules! test {
($from: expr, $to: expr) => {
{
let mut x = $from;
x.make_ascii_uppercase();
assert_eq!(x, $to);
}
}
}
test!(b'a', b'A');
test!(b'A', b'A');
test!(b'!', b'!');
test!('a', 'A');
test!('à', 'à');
test!('A', 'A');
test!('!', '!');
test!(b"h\xc3\xa9".to_vec(), b"H\xc3\xa9");
test!("hıKß".to_string(), "HıKß");
let mut x = "Hello".to_string();
x[..3].make_ascii_uppercase(); // Test IndexMut on String.
assert_eq!(x, "HELlo")
} | rust_cleaned_test_functions.jsonl/13535 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 469
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28230,
50238,
34445,
19096,
368,
341,
286,
18072,
21407,
0,
1273,
341,
310,
1711,
1499,
25,
15169,
11,
400,
983,
25,
15169,
8,
589,
341,
394,
341,
503,
1077,
5206,
856,
284,
400,
1499,
280,
50... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ref() {
let first = Node {
value: 0,
parent: RefCell::new(Weak::new()),
children: RefCell::new(vec![]),
};
let leaf = Rc::new(first.clone());
assert_eq!(Rc::strong_count(&leaf), 1);
// 弱引用
assert_eq!(Rc::weak_count(&leaf), 0);
println!("first {:?}", first);
println!("leaf {:?}", leaf);
} | rust_cleaned_test_functions.jsonl/83320 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 230
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7793,
368,
341,
286,
1077,
1156,
284,
6018,
341,
310,
897,
25,
220,
15,
345,
310,
2681,
25,
8550,
3599,
486,
931,
7,
49649,
486,
931,
14702,
310,
2841,
25,
8550,
3599,
486,
931,
25592,
0,
12... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_backup_and_import() {
let mut suite = TestSuite::new(3);
// 3 version for each key.
for _ in 0..3 {
// 60 keys.
for i in 0..60 {
let (k, v) = (format!("key_{}", i), format!("value_{}", i));
// Prewrite
let start_ts = suite.alloc_ts();
let mut mutation = Mutation::default();
mutation.op = Op::Put;
mutation.key = k.clone().into_bytes();
mutation.value = v.clone().into_bytes();
suite.must_kv_prewrite(vec![mutation], k.clone().into_bytes(), start_ts);
// Commit
let commit_ts = suite.alloc_ts();
suite.must_kv_commit(vec![k.clone().into_bytes()], start_ts, commit_ts);
}
}
// Push down backup request.
let tmp = Builder::new().tempdir().unwrap();
let backup_ts = suite.alloc_ts();
let storage_path = format!(
"local://{}",
tmp.path().join(format!("{}", backup_ts)).display()
);
let rx = suite.backup(
vec![], // start
vec![], // end
backup_ts,
storage_path.clone(),
);
let resps1 = rx.collect().wait().unwrap();
// Only leader can handle backup.
assert_eq!(resps1.len(), 1);
let files1 = resps1[0].files.clone();
assert!(!resps1[0].get_files().is_empty());
suite.cluster.must_delete_range_cf(CF_DEFAULT, b"", b"");
suite.cluster.must_delete_range_cf(CF_WRITE, b"", b"");
// Backup file should have same contents.
// backup ts + 1 avoid file already exist.
let rx = suite.backup(
vec![], // start
vec![], // end
backup_ts,
format!(
"local://{}",
tmp.path().join(format!("{}", backup_ts + 1)).display()
),
);
let resps2 = rx.collect().wait().unwrap();
assert!(resps2[0].get_files().is_empty(), "{:?}", resps2);
// Use importer to restore backup files.
let storage = create_storage(&storage_path).unwrap();
let region = suite.cluster.get_region(b"");
let mut sst_meta = SstMeta::new();
sst_meta.region_id = region.get_id();
sst_meta.set_region_epoch(region.get_region_epoch().clone());
sst_meta.set_uuid(uuid::Uuid::new_v4().as_bytes().to_vec());
let mut metas = vec![];
for f in files1.clone().into_iter() {
let mut reader = storage.read(&f.name).unwrap();
let mut content = vec![];
reader.read_to_end(&mut content).unwrap();
let mut m = sst_meta.clone();
m.crc32 = calc_crc32_bytes(&content);
m.length = content.len() as _;
m.cf_name = name_to_cf(&f.name).to_owned();
metas.push((m, content));
}
for (m, c) in &metas {
for importer in suite.cluster.sim.rl().importers.values() {
let mut f = importer.create(m).unwrap();
f.append(c).unwrap();
f.finish().unwrap();
}
// Make ingest command.
let mut ingest = Request::default();
ingest.set_cmd_type(CmdType::IngestSst);
ingest.mut_ingest_sst().set_sst(m.clone());
let mut header = RaftRequestHeader::default();
let leader = suite.context.get_peer().clone();
header.set_peer(leader);
header.set_region_id(suite.context.get_region_id());
header.set_region_epoch(suite.context.get_region_epoch().clone());
let mut cmd = RaftCmdRequest::default();
cmd.set_header(header);
cmd.mut_requests().push(ingest);
let resp = suite
.cluster
.call_command_on_leader(cmd, Duration::from_secs(5))
.unwrap();
assert!(!resp.get_header().has_error(), resp);
}
// Backup file should have same contents.
// backup ts + 2 avoid file already exist.
let rx = suite.backup(
vec![], // start
vec![], // end
backup_ts,
format!(
"local://{}",
tmp.path().join(format!("{}", backup_ts + 2)).display()
),
);
let resps3 = rx.collect().wait().unwrap();
assert_eq!(files1, resps3[0].files);
suite.stop();
} | rust_cleaned_test_functions.jsonl/21558 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1937
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44710,
8378,
18434,
368,
341,
262,
1077,
5206,
16182,
284,
3393,
28000,
486,
931,
7,
18,
626,
262,
442,
220,
18,
2319,
369,
1817,
1376,
624,
262,
369,
716,
304,
220,
15,
496,
18,
341,
286,
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... | 6 |
#[test]
fn test_github_12951() {
mz_ore::test::init_logging();
let config = util::Config::default();
let server = util::start_server(config).unwrap();
{
let mut client1 = server.connect(postgres::NoTls).unwrap();
let mut client2 = server.connect(postgres::NoTls).unwrap();
let client2_cancel = client2.cancel_token();
client1
.batch_execute("CREATE CLUSTER foo REPLICAS (r1 (size '1'))")
.unwrap();
client1.batch_execute("CREATE TABLE t1(f1 int)").unwrap();
client2.batch_execute("SET CLUSTER = foo").unwrap();
client2
.batch_execute("BEGIN; DECLARE c CURSOR FOR TAIL (SELECT count(*) FROM t1); FETCH 1 c")
.unwrap();
client1.batch_execute("DROP CLUSTER foo").unwrap();
client2_cancel.cancel_query(postgres::NoTls).unwrap();
client2
.batch_execute("ROLLBACK; SET CLUSTER = default")
.unwrap();
assert_eq!(
client2
.query_one("SELECT count(*) FROM t1", &[])
.unwrap()
.get::<_, i64>(0),
0
);
}
{
let mut client1 = server.connect(postgres::NoTls).unwrap();
let mut client2 = server.connect(postgres::NoTls).unwrap();
client1
.batch_execute("CREATE CLUSTER foo REPLICAS (r1 (size '1'))")
.unwrap();
client2.batch_execute("SET CLUSTER = foo").unwrap();
client2.batch_execute("BEGIN; SELECT * FROM t1").unwrap();
client1.batch_execute("DROP CLUSTER foo").unwrap();
client2
.batch_execute("COMMIT; SET CLUSTER = default")
.unwrap();
assert_eq!(
client2
.query_one("SELECT count(*) FROM t1", &[])
.unwrap()
.get::<_, i64>(0),
0
);
}
} | rust_cleaned_test_functions.jsonl/72573 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 974
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1889,
3827,
62,
16,
17,
24,
20,
16,
368,
341,
262,
95392,
62,
460,
486,
1944,
486,
2327,
59982,
543,
262,
1077,
2193,
284,
4094,
486,
2648,
486,
2258,
543,
262,
1077,
3538,
284,
4094,
486,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_to_and_from_bytes() -> Result<(), Error> {
let kp = SampiKeyPair::new();
let data = SampiData::String("Hello, World".to_string());
let s = kp.new_sampi().build(vec![data.clone()])?;
assert_eq!(s.data(), &vec![data]);
let bytes = s.to_bytes();
let derialized_s = Sampi::from_bytes(&bytes)?;
assert_eq!(derialized_s.to_bytes(), bytes);
Ok(())
} | rust_cleaned_test_functions.jsonl/67855 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 177
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
8378,
5673,
12524,
368,
1464,
5714,
68843,
4600,
29,
341,
262,
1077,
60319,
284,
90174,
72,
1592,
12443,
486,
931,
543,
262,
1077,
821,
284,
90174,
72,
1043,
486,
703,
445,
9707,
11,
4337,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_duplicate_rule() {
let src = "%%
[0-9] 'int'
[0-9] 'int'"
.to_string();
match parse_lex::<u8>(&src) {
Ok(_) => panic!("Duplicate rule parsed"),
Err(LexBuildError {
kind: LexErrorKind::DuplicateName,
line: 3,
col: 7
}) => (),
Err(e) => panic!("Incorrect error returned {}", e)
}
} | rust_cleaned_test_functions.jsonl/54004 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 256
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70434,
21124,
368,
341,
286,
1077,
2286,
284,
330,
51377,
58,
15,
12,
24,
60,
364,
396,
1248,
58,
15,
12,
24,
60,
364,
396,
41165,
310,
659,
983,
3904,
543,
286,
2432,
4715,
74547,
27638,
84... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_roundtrip_view_call() {
let x = ViewCallArgs {
sender: [1; 20],
address: [2; 20],
amount: [3; 32],
input: vec![1, 2, 3],
};
let bytes = x.try_to_vec().unwrap();
let res = ViewCallArgs::try_from_slice(&bytes).unwrap();
assert_eq!(x, res);
} | rust_cleaned_test_functions.jsonl/868 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 196
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29896,
32981,
7122,
13429,
368,
341,
286,
1077,
856,
284,
2738,
7220,
4117,
341,
310,
4646,
25,
508,
16,
26,
220,
17,
15,
1259,
310,
2621,
25,
508,
17,
26,
220,
17,
15,
1259,
310,
3311,
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_around_z_90_cw() {
let expected = Quaternion::new(0.5_f32.sqrt(), 0.0, 0.0, 0.5_f32.sqrt());
let a = vec3(8.0, 0.0, 0.0);
let b = vec3(0.0, 9.0, 0.0);
assert_ulps_eq!(Quaternion::between_vectors(a, b), expected);
} | rust_cleaned_test_functions.jsonl/38271 | {
"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,
62,
19454,
6415,
62,
24,
15,
666,
86,
368,
341,
286,
1077,
3601,
284,
24801,
486,
931,
7,
15,
13,
20,
761,
18,
17,
18049,
1507,
220,
15,
13,
15,
11,
220,
15,
13,
15,
11,
220,
15,
13,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_insert_into() {
let c = r"INSERT INTO db.table (c1, c2, c3) VALUES";
let pairs = BqlParser::parse(Rule::insert_into, c)
.unwrap_or_else(|e| panic!("{}", e));
println!("pairs: {}", pretty_parse_tree(pairs));
assert_parse!("INSERT INTO db.table VALUES", insert_into);
assert_parse!("INSERT INTO table VALUES", insert_into);
assert_parse!("INSERT INTO table FORMAT VALUES", insert_into);
assert_parse!("INSERT INTO table FORMAT CSV", insert_into);
assert_parse!("INSERT INTO table (c1) VALUES", insert_into);
// let c = r"INSERT INTO table VALUES";
let c = r"INSERT INTO table FORMAT CSV";
let pairs = BqlParser::parse(Rule::insert_into, c)
.unwrap_or_else(|e| panic!("{}", e));
println!("pairs: {}", pretty_parse_tree(pairs));
let c = r"INSERT INTO db.table VALUES (1,2), (3,4)";
let pairs = BqlParser::parse(Rule::insert_into, c)
.unwrap_or_else(|e| panic!("{}", e));
println!("pairs: {}", pretty_parse_tree(pairs));
} | rust_cleaned_test_functions.jsonl/76152 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 619
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
17678,
45514,
368,
341,
34642,
3374,
310,
1077,
272,
284,
435,
1,
12698,
12496,
2927,
10336,
320,
66,
16,
11,
272,
17,
11,
272,
18,
8,
14710,
876,
310,
1077,
13530,
284,
425,
1470,
6570... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mint_to_dups() {
let program_id = crate::id();
let account1_key = Pubkey::new_unique();
let mut account1_account = SolanaAccount::new(
account_minimum_balance(),
Account::get_packed_len(),
&program_id,
);
let account1_info: AccountInfo = (&account1_key, true, &mut account1_account).into();
let owner_key = Pubkey::new_unique();
let mut owner_account = SolanaAccount::default();
let owner_info: AccountInfo = (&owner_key, true, &mut owner_account).into();
let mint_key = Pubkey::new_unique();
let mut mint_account =
SolanaAccount::new(mint_minimum_balance(), Mint::get_packed_len(), &program_id);
let mint_info: AccountInfo = (&mint_key, true, &mut mint_account).into();
let rent_key = rent::id();
let mut rent_sysvar = rent_sysvar();
let rent_info: AccountInfo = (&rent_key, false, &mut rent_sysvar).into();
// create mint
do_process_instruction_dups(
initialize_mint(&program_id, &mint_key, &mint_key, None, 2).unwrap(),
vec![mint_info.clone(), rent_info.clone()],
)
.unwrap();
// create account
do_process_instruction_dups(
initialize_account(&program_id, &account1_key, &mint_key, &owner_key).unwrap(),
vec![
account1_info.clone(),
mint_info.clone(),
owner_info.clone(),
rent_info.clone(),
],
)
.unwrap();
// mint_to when mint_authority is self
do_process_instruction_dups(
mint_to(&program_id, &mint_key, &account1_key, &mint_key, &[], 42).unwrap(),
vec![mint_info.clone(), account1_info.clone(), mint_info.clone()],
)
.unwrap();
// mint_to_checked when mint_authority is self
do_process_instruction_dups(
mint_to_checked(&program_id, &mint_key, &account1_key, &mint_key, &[], 42, 2).unwrap(),
vec![mint_info.clone(), account1_info.clone(), mint_info.clone()],
)
.unwrap();
// mint_to when mint_authority is account owner
let mut mint = Mint::unpack_unchecked(&mint_info.data.borrow()).unwrap();
mint.mint_authority = COption::Some(account1_key);
Mint::pack(mint, &mut mint_info.data.borrow_mut()).unwrap();
do_process_instruction_dups(
mint_to(
&program_id,
&mint_key,
&account1_key,
&account1_key,
&[],
42,
)
.unwrap(),
vec![
mint_info.clone(),
account1_info.clone(),
account1_info.clone(),
],
)
.unwrap();
// mint_to_checked when mint_authority is account owner
do_process_instruction_dups(
mint_to(
&program_id,
&mint_key,
&account1_key,
&account1_key,
&[],
42,
)
.unwrap(),
vec![
mint_info.clone(),
account1_info.clone(),
account1_info.clone(),
],
)
.unwrap();
} | rust_cleaned_test_functions.jsonl/44636 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1764
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
396,
2346,
814,
8602,
368,
341,
286,
1077,
2025,
842,
284,
17717,
486,
307,
543,
286,
1077,
2692,
16,
3097,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
5206,
2692,
16,
13500,
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... | 1 |
#[test]
fn test_list_primitive_invalid_accessors() {
// primitives
let list = make_list(vec![Field::Bool(false)]);
assert!(list.get_byte(0).is_err());
let list = make_list(vec![Field::Byte(3), Field::Byte(4)]);
assert!(list.get_short(1).is_err());
let list = make_list(vec![Field::Short(4), Field::Short(5), Field::Short(6)]);
assert!(list.get_int(2).is_err());
let list = make_list(vec![Field::Int(5)]);
assert!(list.get_long(0).is_err());
let list = make_list(vec![Field::Long(6), Field::Long(7)]);
assert!(list.get_float(1).is_err());
let list = make_list(vec![Field::UByte(3), Field::UByte(4)]);
assert!(list.get_short(1).is_err());
let list = make_list(vec![Field::UShort(4), Field::UShort(5), Field::UShort(6)]);
assert!(list.get_int(2).is_err());
let list = make_list(vec![Field::UInt(5)]);
assert!(list.get_long(0).is_err());
let list = make_list(vec![Field::ULong(6), Field::ULong(7)]);
assert!(list.get_float(1).is_err());
let list = make_list(vec![
Field::Float(8.1),
Field::Float(9.2),
Field::Float(10.3),
]);
assert!(list.get_double(2).is_err());
let list = make_list(vec![Field::Double(3.1415)]);
assert!(list.get_string(0).is_err());
let list = make_list(vec![Field::Str("abc".to_string())]);
assert!(list.get_bytes(0).is_err());
let list = make_list(vec![Field::Bytes(ByteArray::from(vec![1, 2, 3, 4, 5]))]);
assert!(list.get_bool(0).is_err());
let list = make_list(vec![Field::Decimal(Decimal::from_i32(4, 5, 2))]);
assert!(list.get_bool(0).is_err());
} | rust_cleaned_test_functions.jsonl/43814 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 732
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2019,
84087,
31433,
12759,
1087,
368,
341,
262,
442,
71194,
198,
262,
1077,
1140,
284,
1281,
2019,
25592,
20703,
1877,
486,
11233,
3576,
41958,
262,
2060,
10297,
1607,
670,
19737,
7,
15,
568,
285,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lt_dyn_scalar_float() {
let array: Float32Array = vec![6.0, 7.0, 8.0, 8.0, 10.0]
.into_iter()
.map(Some)
.collect();
let expected = BooleanArray::from(
vec![Some(true), Some(true), Some(false), Some(false), Some(false)],
);
assert_eq!(lt_dyn_scalar(&array, 8).unwrap(), expected);
let array: ArrayRef = Arc::new(array);
let array = crate::compute::cast(&array, &DataType::Float64).unwrap();
assert_eq!(lt_dyn_scalar(&array, 8).unwrap(), expected);
} | rust_cleaned_test_functions.jsonl/98213 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 291
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39164,
69213,
41652,
17586,
368,
341,
286,
1077,
1334,
25,
13001,
18,
17,
1857,
284,
7486,
20703,
21,
13,
15,
11,
220,
22,
13,
15,
11,
220,
23,
13,
15,
11,
220,
23,
13,
15,
11,
220,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_control() {
assert!('\u{0}'.is_control());
assert!('\u{3}'.is_control());
assert!('\u{6}'.is_control());
assert!('\u{9}'.is_control());
assert!('\u{7f}'.is_control());
assert!('\u{92}'.is_control());
assert!(!'\u{20}'.is_control());
assert!(!'\u{55}'.is_control());
assert!(!'\u{68}'.is_control());
} | rust_cleaned_test_functions.jsonl/109584 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 178
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
13436,
368,
341,
262,
2060,
0,
11024,
84,
90,
15,
23495,
285,
13436,
1423,
262,
2060,
0,
11024,
84,
90,
18,
23495,
285,
13436,
1423,
262,
2060,
0,
11024,
84,
90,
21,
23495,
285,
13436,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_badpath2() {
let mut api = ApiDescription::new();
let ret = api.register(ApiEndpoint::new(
"test_badpath_handler".to_string(),
test_badpath_handler,
Method::GET,
"/{a}/{aa}/{b}/{bb}",
));
assert_eq!(
ret,
Err("path parameters are not consumed (aa,bb)".to_string())
);
} | rust_cleaned_test_functions.jsonl/17567 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 226
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34199,
2343,
17,
368,
341,
286,
1077,
5206,
6330,
284,
13443,
5009,
486,
931,
543,
286,
1077,
2112,
284,
6330,
9929,
65830,
27380,
486,
931,
1006,
310,
330,
1944,
34199,
2343,
10183,
3263,
983,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_network_type_parsing_success() -> Result<()> {
let ipv4: IpAddr = "192.168.0.1".parse().unwrap();
let ipv6: IpAddr = "fe80::a3:6ff:fec4:5454".parse().unwrap();
let tests = vec![
("lowercase UDP4", "udp", ipv4, NetworkType::Udp4),
("uppercase UDP4", "UDP", ipv4, NetworkType::Udp4),
("lowercase UDP6", "udp", ipv6, NetworkType::Udp6),
("uppercase UDP6", "UDP", ipv6, NetworkType::Udp6),
];
for (name, in_network, in_ip, expected) in tests {
let actual = determine_network_type(in_network, &in_ip)?;
assert_eq!(
actual, expected,
"NetworkTypeParsing: '{}' -- input:{} expected:{} actual:{}",
name, in_network, expected, actual
);
}
Ok(())
} | rust_cleaned_test_functions.jsonl/89874 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 382
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20966,
1819,
620,
28598,
18632,
368,
1464,
5714,
71698,
341,
262,
1077,
45475,
19,
25,
35033,
13986,
284,
330,
16,
24,
17,
13,
16,
21,
23,
13,
15,
13,
16,
3263,
6400,
1005,
15454,
543,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_insert() {
let mut tester = VecDeque::with_capacity(15);
// this test isn't covering what it wants to
let cap = tester.capacity();
// len is the length *after* insertion
for len in 1..cap {
let expected = (0..).take(len).collect();
for tail_pos in 0..cap {
for to_insert in 0..len {
tester.tail = tail_pos;
tester.head = tail_pos;
for i in 0..len {
if i != to_insert {
tester.push_back(i);
}
}
tester.insert(to_insert, to_insert);
assert!(tester.tail < tester.cap);
assert!(tester.head < tester.cap);
assert_eq!(tester, expected);
}
}
}
} | rust_cleaned_test_functions.jsonl/185 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 599
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
368,
341,
1789,
23459,
286,
1077,
5206,
37111,
284,
11312,
73891,
486,
4197,
35603,
7,
16,
20,
317,
16885,
286,
442,
419,
1273,
4436,
944,
18202,
1128,
432,
6801,
311,
198,
286,
1077,
206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_safe_checkout_locally_modified_tree() -> BitResult<()> {
BitRepo::with_sample_repo(|repo| {
touch!(repo: "dir/bar.l" < "modified");
bit_checkout!(repo: "master")?;
assert_eq!(cat!(repo: "dir/bar.l"), "modified");
Ok(())
})
} | rust_cleaned_test_functions.jsonl/62993 | {
"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,
34067,
68186,
13400,
745,
37749,
11663,
368,
1464,
6495,
2077,
71698,
341,
262,
6495,
25243,
486,
4197,
17491,
37784,
22428,
23476,
91,
341,
286,
5796,
10297,
23476,
25,
330,
3741,
49513,
918,
1,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_account_meta_non_default() {
let def1 = AccountMeta {
lamports: 1,
owner: Pubkey::new_unique(),
executable: true,
rent_epoch: 3,
};
let def2_account = Account {
lamports: def1.lamports,
owner: def1.owner,
executable: def1.executable,
rent_epoch: def1.rent_epoch,
data: Vec::new(),
};
let def2 = AccountMeta::from(&def2_account);
assert_eq!(&def1, &def2);
let def2 = AccountMeta::from(&AccountSharedData::from(def2_account.clone()));
assert_eq!(&def1, &def2);
let def2 = AccountMeta::from(Some(&AccountSharedData::from(def2_account)));
assert_eq!(&def1, &def2);
} | rust_cleaned_test_functions.jsonl/5409 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 399
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13500,
13381,
21637,
9993,
368,
341,
286,
1077,
707,
16,
284,
8615,
12175,
341,
310,
31603,
3394,
25,
220,
16,
345,
310,
6372,
25,
22611,
792,
486,
931,
21218,
3148,
310,
32156,
25,
830,
345,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rust_boolean() {
assert_eq!(true, rustBoolean(true, true));
assert_eq!(false, rustBoolean(true, false));
assert_eq!(false, rustBoolean(false, true));
assert_eq!(false, rustBoolean(false, false));
} | rust_cleaned_test_functions.jsonl/35913 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
590,
46642,
368,
341,
262,
2060,
10714,
10297,
1866,
11,
23071,
6890,
3715,
11,
830,
1106,
262,
2060,
10714,
10297,
3849,
11,
23071,
6890,
3715,
11,
895,
1106,
262,
2060,
10714,
10297,
3849,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_active_address() {
let started = Arc::new(AtomicBool::new(false));
let stopping = Arc::new(AtomicBool::new(false));
let stopped = Arc::new(AtomicBool::new(false));
let started1 = Arc::clone(&started);
let stopping1 = Arc::clone(&stopping);
let stopped1 = Arc::clone(&stopped);
let addr = Arc::new(Mutex::new(None));
let addr2 = Arc::clone(&addr);
let _ = std::thread::spawn(move || {
let _ = System::run(move || {
*addr2.lock().unwrap() = Some(
MyActor {
started: started1,
stopping: stopping1,
stopped: stopped1,
temp: None,
restore_after_stop: false,
}
.start(),
);
});
});
std::thread::sleep(Duration::from_millis(100));
assert!(started.load(Ordering::Relaxed), "Not started");
assert!(!stopping.load(Ordering::Relaxed), "Stopping");
assert!(!stopped.load(Ordering::Relaxed), "Stopped");
} | rust_cleaned_test_functions.jsonl/38337 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 513
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12930,
6744,
368,
341,
262,
1077,
3855,
284,
19689,
486,
931,
7,
65857,
11233,
486,
931,
3576,
1106,
262,
1077,
22535,
284,
19689,
486,
931,
7,
65857,
11233,
486,
931,
3576,
1106,
262,
1077,
104... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_syscall_sol_pubkey() {
let pubkey = Pubkey::from_str("MoqiU1vryuCGQSxFKA1SZ316JdLEFFhoAu6cKUNk7dN").unwrap();
let addr = &pubkey.as_ref()[0] as *const _ as u64;
let compute_meter: Rc<RefCell<dyn ComputeMeter>> =
Rc::new(RefCell::new(MockComputeMeter { remaining: 2 }));
let log = Rc::new(RefCell::new(vec![]));
let logger: Rc<RefCell<dyn Logger>> =
Rc::new(RefCell::new(MockLogger { log: log.clone() }));
let mut syscall_sol_pubkey = SyscallLogPubkey {
cost: 1,
compute_meter,
logger,
loader_id: &bpf_loader::id(),
enforce_aligned_host_addrs: true,
};
let memory_mapping = MemoryMapping::new::<UserError>(
vec![MemoryRegion {
host_addr: addr,
vm_addr: 100,
len: 32,
vm_gap_shift: 63,
is_writable: false,
}],
&DEFAULT_CONFIG,
)
.unwrap();
let mut result: Result<u64, EbpfError<BpfError>> = Ok(0);
syscall_sol_pubkey.call(100, 0, 0, 0, 0, &memory_mapping, &mut result);
result.unwrap();
assert_eq!(log.borrow().len(), 1);
assert_eq!(
log.borrow()[0],
"Program log: MoqiU1vryuCGQSxFKA1SZ316JdLEFFhoAu6cKUNk7dN"
);
let mut result: Result<u64, EbpfError<BpfError>> = Ok(0);
syscall_sol_pubkey.call(
101, // AccessViolation
32,
0,
0,
0,
&memory_mapping,
&mut result,
);
assert_access_violation!(result, 101, 32);
let mut result: Result<u64, EbpfError<BpfError>> = Ok(0);
syscall_sol_pubkey.call(100, 32, 0, 0, 0, &memory_mapping, &mut result);
assert_eq!(
Err(EbpfError::UserError(BpfError::SyscallError(
SyscallError::InstructionError(InstructionError::ComputationalBudgetExceeded)
))),
result
);
} | rust_cleaned_test_functions.jsonl/16354 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20344,
6659,
53668,
34014,
792,
368,
341,
286,
1077,
95116,
284,
22611,
792,
486,
1499,
2895,
445,
25612,
40187,
52,
16,
85,
884,
84,
8798,
70810,
9770,
26444,
16,
61228,
18,
16,
21,
41,
67,
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_matrix_components2() {
let matrix = Matrix2x2::new(1_i32, 2_i32, 3_i32, 4_i32);
assert_eq!(matrix.c0r0, matrix[0][0]);
assert_eq!(matrix.c0r1, matrix[0][1]);
assert_eq!(matrix.c1r0, matrix[1][0]);
assert_eq!(matrix.c1r1, matrix[1][1]);
} | rust_cleaned_test_functions.jsonl/128953 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 173
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10193,
23258,
17,
368,
341,
286,
1077,
6172,
284,
11631,
17,
87,
17,
486,
931,
7,
16,
5318,
18,
17,
11,
220,
17,
5318,
18,
17,
11,
220,
18,
5318,
18,
17,
11,
220,
19,
5318,
18,
17,
626,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_chan_reserve_violation_inbound_htlc_outbound_channel() {
let mut chanmon_cfgs = create_chanmon_cfgs(2);
// receiving 1 update_add_htlc would result in them closing the channel due
// to channel reserve violation. This close could also happen if the fee went
// the update_add_htlc.
chanmon_cfgs[0].fee_estimator = test_utils::TestFeeEstimator { sat_per_kw: Mutex::new(6000) };
chanmon_cfgs[1].fee_estimator = test_utils::TestFeeEstimator { sat_per_kw: Mutex::new(6000) };
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let chan = create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 100000, 95000000, InitFeatures::known(), InitFeatures::known());
let (route, payment_hash, _, payment_secret) = get_route_and_payment_hash!(nodes[1], nodes[0], 1000);
let secp_ctx = Secp256k1::new();
let session_priv = SecretKey::from_slice(&[42; 32]).unwrap();
let cur_height = nodes[1].node.best_block.read().unwrap().height() + 1;
let onion_keys = onion_utils::construct_onion_keys(&secp_ctx, &route.paths[0], &session_priv).unwrap();
let (onion_payloads, htlc_msat, htlc_cltv) = onion_utils::build_onion_payloads(&route.paths[0], 1000, &Some(payment_secret), cur_height, &None).unwrap();
let onion_packet = onion_utils::construct_onion_packet(onion_payloads, onion_keys, [0; 32], &payment_hash);
let msg = msgs::UpdateAddHTLC {
channel_id: chan.2,
htlc_id: 1,
amount_msat: htlc_msat + 1,
payment_hash: payment_hash,
cltv_expiry: htlc_cltv,
onion_routing_packet: onion_packet,
};
nodes[0].node.handle_update_add_htlc(&nodes[1].node.get_our_node_id(), &msg);
// Check that the payment failed and the channel is closed in response to the malicious UpdateAdd.
nodes[0].logger.assert_log("lightning::ln::channelmanager".to_string(), "Cannot accept HTLC that would put our balance under counterparty-announced channel reserve value".to_string(), 1);
assert_eq!(nodes[0].node.list_channels().len(), 0);
let err_msg = check_closed_broadcast!(nodes[0], true).unwrap();
assert_eq!(err_msg.data, "Cannot accept HTLC that would put our balance under counterparty-announced channel reserve value");
check_added_monitors!(nodes[0], 1);
check_closed_event!(nodes[0], 1, ClosureReason::ProcessingError { err: "Cannot accept HTLC that would put our balance under counterparty-announced channel reserve value".to_string() });
} | rust_cleaned_test_functions.jsonl/16872 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 923
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45552,
89591,
2273,
24903,
367,
1243,
10891,
49086,
17257,
6068,
10891,
14571,
368,
341,
10217,
5206,
26023,
1645,
18343,
82,
284,
1855,
45552,
1645,
18343,
82,
7,
17,
317,
1572,
197,
322,
12308,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_call() {
test_same("foo(0)");
// be preserved.
test("Math.sin(0);", "");
test("1 + Math.sin(0);", "");
} | rust_cleaned_test_functions.jsonl/460 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 77
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13429,
368,
341,
262,
1273,
33574,
445,
7975,
7,
15,
20996,
1066,
262,
442,
387,
33583,
624,
262,
1273,
445,
8815,
16318,
7,
15,
1215,
497,
14498,
262,
1273,
445,
16,
488,
4149,
16318,
7,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_adjust_lockouts_after_replay_reversed_votes() {
let mut tower = Tower::new_for_tests(10, 0.9);
tower.vote_state.votes.push_back(Lockout::new(2));
tower.vote_state.votes.push_back(Lockout::new(1));
let vote = Vote::new(vec![1], Hash::default());
tower.last_vote = vote;
let mut slot_history = SlotHistory::default();
slot_history.add(0);
slot_history.add(2);
tower
.adjust_lockouts_after_replay(2, &slot_history)
.unwrap();
} | rust_cleaned_test_functions.jsonl/61176 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 262
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44153,
9818,
11672,
19844,
1288,
1363,
1288,
43776,
65116,
368,
341,
286,
1077,
5206,
21271,
284,
21938,
486,
931,
5478,
32509,
7,
16,
15,
11,
220,
15,
13,
24,
317,
286,
21271,
79422,
4387,
3133... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_derivation() {
assert_eq!(is_derivation("2"), Ok(()));
assert_eq!(is_derivation("0"), Ok(()));
assert_eq!(is_derivation("65537"), Ok(()));
assert_eq!(is_derivation("0/2"), Ok(()));
assert_eq!(is_derivation("0'/2'"), Ok(()));
assert!(is_derivation("a").is_err());
assert!(is_derivation("4294967296").is_err());
assert!(is_derivation("a/b").is_err());
assert!(is_derivation("0/4294967296").is_err());
} | rust_cleaned_test_functions.jsonl/49483 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 249
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
35345,
39127,
368,
341,
286,
2060,
10714,
10297,
285,
35345,
39127,
445,
17,
3975,
7622,
5065,
1106,
286,
2060,
10714,
10297,
285,
35345,
39127,
445,
15,
3975,
7622,
5065,
1106,
286,
2060,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_negative_lamports() {
let mut transaction_context = TransactionContext::new(Vec::new(), 1);
let invoke_context = InvokeContext::new_mock(&mut transaction_context, &[]);
// Attempt to create account with more lamports than remaining in from_account
let new_owner = Pubkey::new(&[9; 32]);
let from = Pubkey::new_unique();
let from_account = RefCell::new(AccountSharedData::new(100, 0, &system_program::id()));
let to = Pubkey::new_unique();
let to_account = RefCell::new(AccountSharedData::new(0, 0, &Pubkey::default()));
let result = create_account(
&KeyedAccount::new(&from, true, &from_account),
&KeyedAccount::new(&from, false, &to_account),
&to.into(),
150,
2,
&new_owner,
&[from, to].iter().cloned().collect::<HashSet<_>>(),
&invoke_context,
);
assert_eq!(result, Err(SystemError::ResultWithNegativeLamports.into()));
} | rust_cleaned_test_functions.jsonl/106191 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 460
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
53865,
907,
309,
3394,
368,
341,
286,
1077,
5206,
7745,
8467,
284,
17869,
1972,
486,
931,
49923,
486,
931,
1507,
220,
16,
317,
286,
1077,
19873,
8467,
284,
39667,
1972,
486,
931,
34134,
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_shared() {
let sk1 = PrivateKey::new().unwrap();
let pk1 = PublicKey::new(sk1);
let sk2 = PrivateKey::new().unwrap();
let pk2 = PublicKey::new(sk2);
let s1 = shared(pk2, sk1).unwrap();
let s2 = shared(pk1, sk2).unwrap();
assert_eq!(s1, s2)
} | rust_cleaned_test_functions.jsonl/42588 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 140
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20405,
368,
341,
262,
1077,
1901,
16,
284,
9679,
1592,
486,
931,
1005,
15454,
543,
262,
1077,
22458,
16,
284,
70280,
486,
931,
68907,
16,
317,
262,
1077,
1901,
17,
284,
9679,
1592,
486,
931,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_json_output() -> Result<(), Box<dyn std::error::Error>> {
let mut cmd = Command::cargo_bin("maxtract")?;
cmd.arg(common::get_uri()).arg("--regex").arg("child_\\d+").arg("--json");
let expected = "{\"file:///home/josh/CLionProjects/maxtract/tests/pages/child_00.html\":{\"url\":\"file:///home/josh/CLionProjects/maxtract/tests/pages/child_00.html\",\"data\":[\"child_00\",\"child_10\"],\"children\":[\"file:///home/josh/CLionProjects/maxtract/tests/pages/child_10.html\"]},\"file:///home/josh/CLionProjects/maxtract/tests/pages/child_01.html\":{\"url\":\"file:///home/josh/CLionProjects/maxtract/tests/pages/child_01.html\",\"data\":[\"child_01\"],\"children\":[]},\"file:///home/josh/CLionProjects/maxtract/tests/pages/child_10.html\":{\"url\":\"file:///home/josh/CLionProjects/maxtract/tests/pages/child_10.html\",\"data\":[\"child_10\"],\"children\":[\"file:///home/josh/CLionProjects/maxtract/tests/pages/index.html\"]},\"file:///home/josh/CLionProjects/maxtract/tests/pages/index.html\":{\"url\":\"file:///home/josh/CLionProjects/maxtract/tests/pages/index.html\",\"data\":[\"child_00\",\"child_01\"],\"children\":[\"file:///home/josh/CLionProjects/maxtract/tests/pages/child_00.html\",\"file:///home/josh/CLionProjects/maxtract/tests/pages/child_01.html\"]}}\n";
cmd.assert()
.success()
.stdout(predicate::str::similar(expected));
Ok(())
} | rust_cleaned_test_functions.jsonl/67454 | {
"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,
9455,
7645,
368,
1464,
5714,
68843,
8261,
92846,
1460,
486,
841,
486,
1454,
2452,
341,
262,
1077,
5206,
5439,
284,
7348,
486,
66715,
21816,
445,
2810,
2144,
899,
69493,
262,
5439,
21186,
57802,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_retry() {
let setting_type = SettingType::Unknown;
async fn run_retries(setting_type: SettingType) -> (TestEnvironment, message::Receptor) {
let environment = TestEnvironmentBuilder::new(setting_type).build().await;
let mut event_receptor = service::build_event_listener(&environment.delegate).await;
// Queue up external failure responses in the handler.
for _ in 0..SETTING_PROXY_MAX_ATTEMPTS {
environment.setting_handler.lock().await.queue_action(
Request::Get,
HandlerAction::Respond(Err(ControllerError::ExternalFailure(
setting_type,
"test_component".into(),
"connect".into(),
))),
);
}
let request = Request::Get;
// Send request.
let handler_result = get_response(
environment
.service_client
.message(
HandlerPayload::Request(request.clone()).into(),
Audience::Address(service::Address::Handler(setting_type)),
)
.send(),
)
.await
.expect("result should be present");
// Make sure the result is an `ControllerError::IrrecoverableError`
if let Err(error) = handler_result {
assert_eq!(error, HandlerError::IrrecoverableError);
} else {
panic!("error should have been encountered");
}
for _ in 0..SETTING_PROXY_MAX_ATTEMPTS {
verify_handler_event(
setting_type,
event_receptor
.next_of::<event::Payload>()
.await
.expect("should be notified of external failure")
.0,
event::handler::Event::Request(event::handler::Action::Execute, request.clone()),
);
verify_handler_event(
setting_type,
event_receptor
.next_of::<event::Payload>()
.await
.expect("should be notified of external failure")
.0,
event::handler::Event::Request(event::handler::Action::Retry, request.clone()),
);
}
// Ensure that the final event reports that attempts were exceeded
verify_handler_event(
setting_type,
event_receptor
.next_of::<event::Payload>()
.await
.expect("should be notified of external failure")
.0,
event::handler::Event::Request(
event::handler::Action::AttemptsExceeded,
request.clone(),
),
);
(environment, event_receptor)
}
async fn run_to_response(
mut environment: TestEnvironment,
mut _event_receptor: message::Receptor,
setting_type: SettingType,
) -> (TestEnvironment, message::Receptor) {
// Regenerate setting handler
environment.regenerate_handler(None).await;
// Queue successful response
environment
.setting_handler
.lock()
.await
.queue_action(Request::Get, HandlerAction::Respond(Ok(None)));
let request = Request::Get;
// Ensure subsequent request succeeds
matches::assert_matches!(
get_response(
environment
.service_client
.message(
HandlerPayload::Request(request.clone()).into(),
Audience::Address(service::Address::Handler(setting_type)),
)
.send(),
)
.await,
Some(Ok(_))
);
(environment, _event_receptor)
}
let mut executor =
fasync::TestExecutor::new_with_fake_time().expect("Failed to create executor");
let environment_fut = run_retries(setting_type);
futures::pin_mut!(environment_fut);
let (environment, event_receptor) =
if let Poll::Ready(output) = executor.run_until_stalled(&mut environment_fut) {
output
} else {
panic!("environment creation and retries stalled");
};
executor.wake_next_timer();
let environment_fut = run_to_response(environment, event_receptor, setting_type);
futures::pin_mut!(environment_fut);
let (_environment, mut event_receptor) =
if let Poll::Ready(output) = executor.run_until_stalled(&mut environment_fut) {
output
} else {
panic!("running final step stalled");
};
executor.wake_next_timer();
let event_fut = event_receptor.next_of::<event::Payload>();
futures::pin_mut!(event_fut);
let state = if let Poll::Ready(Ok((payload, _))) = executor.run_until_stalled(&mut event_fut) {
payload
} else {
panic!("state retrieval stalled or had no result");
};
// Make sure SettingHandler tears down
verify_handler_event(setting_type, state, event::handler::Event::Teardown);
} | rust_cleaned_test_functions.jsonl/89527 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2497
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62745,
368,
341,
262,
1077,
6243,
1819,
284,
20037,
929,
486,
13790,
280,
262,
3312,
5168,
1598,
1288,
4543,
75640,
1819,
25,
20037,
929,
8,
1464,
320,
2271,
12723,
11,
1943,
486,
693,
15349,
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... | 4 |
#[test]
fn test_insert() {
let mut heap = create_heap_for_tests();
letroot!(m = heap.shadow_stack(), HashMap::new(&mut heap));
assert_eq!(m.len(), 0);
assert!(m.insert(&mut heap, 1, 2));
assert_eq!(m.len(), 1);
assert!(m.insert(&mut heap, 2, 4));
assert_eq!(m.len(), 2);
assert_eq!(*m.get(&1).unwrap(), 2);
assert_eq!(*m.get(&2).unwrap(), 4);
} | rust_cleaned_test_functions.jsonl/37831 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 220
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
368,
341,
286,
1077,
5206,
17364,
284,
1855,
33059,
5478,
32509,
543,
286,
1077,
2888,
10297,
76,
284,
17364,
38506,
15528,
1507,
10528,
486,
931,
2099,
6984,
17364,
3237,
286,
2060,
10714,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_consumer_finalize_error() {
let mut c = FinalizeErrorConsumer {};
let p = Parser::new(ZERO_BOUND_HEADER, &mut c);
let ret = p.parse();
assert_matches!(ret, Err(State::ConsumerError(_)));
if let Err(State::ConsumerError(err)) = ret {
assert_eq!("consumer error", err.description());
assert_eq!("fin error", format!("{}", err));
} else {
assert!(false);
}
} | rust_cleaned_test_functions.jsonl/85745 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 225
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73969,
70616,
4096,
368,
341,
286,
1077,
5206,
272,
284,
13023,
551,
1454,
29968,
9321,
286,
1077,
281,
284,
21102,
486,
931,
27855,
17297,
73644,
20330,
11,
609,
6984,
272,
317,
286,
1077,
2112,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_delete_all_in_range_by_key() {
let data = vec![
b"k0".to_vec(),
b"k1".to_vec(),
b"k2".to_vec(),
b"k3".to_vec(),
b"k4".to_vec(),
];
// Single range.
test_delete_all_in_range(
DeleteStrategy::DeleteByKey,
&data,
&[Range::new(b"k1", b"k4")],
);
// Two ranges without overlap.
test_delete_all_in_range(
DeleteStrategy::DeleteByKey,
&data,
&[Range::new(b"k0", b"k1"), Range::new(b"k3", b"k4")],
);
// Two ranges with overlap.
test_delete_all_in_range(
DeleteStrategy::DeleteByKey,
&data,
&[Range::new(b"k1", b"k3"), Range::new(b"k2", b"k4")],
);
// One range contains the other range.
test_delete_all_in_range(
DeleteStrategy::DeleteByKey,
&data,
&[Range::new(b"k1", b"k4"), Range::new(b"k2", b"k3")],
);
} | rust_cleaned_test_functions.jsonl/710 | {
"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,
11353,
5705,
1243,
9698,
3710,
3097,
368,
341,
286,
1077,
821,
284,
7486,
90515,
310,
293,
62911,
15,
3263,
983,
13251,
3148,
310,
293,
62911,
16,
3263,
983,
13251,
3148,
310,
293,
62911,
17,
32... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tls() {
init_default_config();
let c = parse_args_from(&[
"audioserve",
"--no-authentication",
"--ssl-key",
"test_data/desc.txt",
"--ssl-key-password",
"neco",
"test_data",
])
.unwrap();
assert!(c.ssl.is_some());
let ssl = c.ssl.unwrap();
assert_eq!(PathBuf::from("test_data/desc.txt"), ssl.key_file);
assert_eq!("neco", ssl.key_password);
} | rust_cleaned_test_functions.jsonl/51092 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 299
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71262,
368,
341,
286,
2930,
9993,
5332,
543,
286,
1077,
272,
284,
4715,
8384,
5673,
2099,
9640,
310,
330,
7880,
3530,
5852,
756,
310,
14482,
2152,
33503,
7164,
756,
310,
14482,
24635,
16173,
756,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_update_split_check_config() {
let (mut cfg, _dir) = TiKvConfig::with_tmp().unwrap();
cfg.validate().unwrap();
let engine = tmp_engine(&cfg.storage.data_dir);
let (cfg_controller, mut worker) = setup(cfg.clone(), engine);
let scheduler = worker.scheduler();
let cop_config = cfg.coprocessor.clone();
// update of other module's config should not effect split check config
cfg_controller
.update_config("raftstore.raft-log-gc-threshold", "2000")
.unwrap();
validate(&scheduler, move |cfg: &Config| {
assert_eq!(cfg, &cop_config);
});
let change = {
let mut m = std::collections::HashMap::new();
m.insert(
"coprocessor.split_region_on_table".to_owned(),
"true".to_owned(),
);
m.insert("coprocessor.batch_split_limit".to_owned(), "123".to_owned());
m.insert(
"coprocessor.region_split_keys".to_owned(),
"12345".to_owned(),
);
m
};
cfg_controller.update(change).unwrap();
// config should be updated
let cop_config = {
let mut cop_config = cfg.coprocessor;
cop_config.split_region_on_table = true;
cop_config.batch_split_limit = 123;
cop_config.region_split_keys = 12345;
cop_config
};
validate(&scheduler, move |cfg: &Config| {
assert_eq!(cfg, &cop_config);
});
worker.stop().unwrap().join().unwrap();
} | rust_cleaned_test_functions.jsonl/8758 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 658
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
17052,
7200,
5332,
368,
341,
262,
1077,
320,
6984,
13286,
11,
716,
3741,
8,
284,
22325,
42,
85,
2648,
486,
4197,
16125,
1005,
15454,
543,
262,
13286,
19520,
1005,
15454,
543,
262,
1077,
47... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ty() {
assert_eq!(Value::Char('n').ty(), Type::Char);
assert_eq!(Value::Int32(0).ty(), Type::Int32);
assert_eq!(Value::Float(0.0).ty(), Type::Float);
assert_eq!(Value::String(String::from("noodles")).ty(), Type::String);
assert_eq!(Value::Hex(String::from("CAFE")).ty(), Type::Hex);
assert_eq!(Value::Int8Array(vec![0]).ty(), Type::Array);
assert_eq!(Value::UInt8Array(vec![0]).ty(), Type::Array);
assert_eq!(Value::Int16Array(vec![0]).ty(), Type::Array);
assert_eq!(Value::UInt16Array(vec![0]).ty(), Type::Array);
assert_eq!(Value::Int32Array(vec![0]).ty(), Type::Array);
assert_eq!(Value::UInt32Array(vec![0]).ty(), Type::Array);
assert_eq!(Value::FloatArray(vec![0.0]).ty(), Type::Array);
} | rust_cleaned_test_functions.jsonl/93900 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 380
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53171,
368,
341,
286,
2060,
10714,
10297,
1130,
486,
4768,
492,
77,
1823,
1881,
1507,
3990,
486,
4768,
317,
286,
2060,
10714,
10297,
1130,
486,
1072,
18,
17,
7,
15,
568,
1881,
1507,
3990,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_char_data() {
let mut lexer = Lexer::new();
match lexer.lex("if 3 > 2\n # do some stuff\n stuff()\nend".to_string()){
Err(_) => assert!(false),
Ok(v) => {
assert_eq!(" stuff()", v[5].line_string);
assert_eq!(9, v[5].col);
assert_eq!(2, v[5].line);
assert_eq!(38, v[5].char_index);
}
}
} | rust_cleaned_test_functions.jsonl/47916 | {
"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,
9232,
1769,
368,
341,
286,
1077,
5206,
53259,
284,
85082,
486,
931,
543,
286,
2432,
53259,
82248,
445,
333,
220,
18,
861,
220,
17,
1699,
262,
671,
653,
1045,
6259,
1699,
262,
6259,
62720,
77,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_set_permissions() {
setup();
let p = Path::new("/tmp/nexus-fixer/qux");
let mask = random_mask();
assert!(touch(p).is_ok());
assert!(set_permissions(p, mask).is_ok());
check_permissions(p, mask);
assert!(fs::remove_file(p).is_ok());
} | rust_cleaned_test_functions.jsonl/26861 | {
"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,
2602,
44767,
368,
341,
286,
6505,
543,
286,
1077,
281,
284,
7933,
486,
931,
4283,
5173,
9612,
23666,
2220,
39014,
78845,
87,
797,
286,
1077,
6911,
284,
4194,
9999,
543,
286,
2060,
10297,
22020,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_shared_secret_is_symmetric() {
run_with_several_seeds(|mut rng| {
let a = RistrettoPrivate::from_random(&mut rng);
let A = RistrettoPublic::from(&a);
let b = RistrettoPrivate::from_random(&mut rng);
let B = RistrettoPublic::from(&b);
let aB = create_shared_secret(&B, &a);
let bA = create_shared_secret(&A, &b);
assert_eq!(aB, bA);
})
} | rust_cleaned_test_functions.jsonl/56133 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 250
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
20405,
21962,
6892,
26825,
15903,
368,
341,
286,
1598,
6615,
3453,
17539,
3453,
6767,
22428,
6984,
28422,
91,
341,
310,
1077,
264,
284,
431,
380,
2122,
983,
16787,
486,
1499,
22644,
2099,
69... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decr() {
assert_eq!(decr("key", 1), "decr key 1\r\n");
assert_eq!(decr("key", 1000), "decr key 1000\r\n");
} | rust_cleaned_test_functions.jsonl/26814 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 83
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2259,
5082,
368,
341,
286,
2060,
10714,
10297,
450,
5082,
445,
792,
497,
220,
16,
701,
330,
450,
5082,
1376,
220,
16,
12016,
1699,
797,
286,
2060,
10714,
10297,
450,
5082,
445,
792,
497,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_serde() -> Result<()> {
let ca = UInt32Chunked::new("foo", &[Some(1), None, Some(2)]);
let json = serde_json::to_string(&ca).unwrap();
dbg!(&json);
let out = serde_json::from_str::<Series>(&json).unwrap();
assert!(ca.into_series().series_equal_missing(&out));
let ca = Utf8Chunked::new("foo", &[Some("foo"), None, Some("bar")]);
let json = serde_json::to_string(&ca).unwrap();
dbg!(&json);
let out = serde_json::from_str::<Series>(&json).unwrap(); // uses `Deserialize<'de>`
assert!(ca.into_series().series_equal_missing(&out));
Ok(())
} | rust_cleaned_test_functions.jsonl/82050 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 306
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75861,
450,
368,
1464,
5714,
71698,
341,
286,
1077,
2162,
284,
22275,
18,
17,
28304,
291,
486,
931,
445,
7975,
497,
44590,
8373,
7,
16,
701,
2240,
11,
4329,
7,
17,
7252,
626,
286,
1077,
2951,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_if_else_expressions() {
let tests = vec![
("if (true) { 10 }", Object::Int(10)),
("if (false) { 10 }", Object::Undefined),
("if (1) { 10 }", Object::Int(10)),
("if (1 < 2) { 10 }", Object::Int(10)),
("if (1 > 2) { 10 }", Object::Undefined),
("if (1 > 2) { 10 } else { 20 }", Object::Int(20)),
("if (1 < 2) { 10 } else { 20 }", Object::Int(10)),
];
for (input, result) in tests {
assert_eq!(eval(input), result);
}
} | rust_cleaned_test_functions.jsonl/84229 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 251
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11119,
62628,
2702,
39873,
368,
341,
262,
1077,
7032,
284,
7486,
90515,
286,
3489,
333,
320,
1866,
8,
314,
220,
16,
15,
335,
497,
3002,
486,
1072,
7,
16,
15,
6965,
286,
3489,
333,
320,
3849,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_event_json_with_multiple_nodes_same_name_separate() {
ensure_env_logger_initialized();
let evtx_file = include_bytes!(
"../samples/E_Windows_system32_winevt_logs_Microsoft-Windows-CAPI2%4Operational.evtx"
);
let mut parser = EvtxParser::from_buffer(evtx_file.to_vec())
.unwrap()
.with_configuration(
ParserSettings::new()
.num_threads(1)
.separate_json_attributes(true),
);
let record = parser
.records_json()
.filter_map(|record| record.ok())
.find(|record| record.event_record_id == 28)
.expect("record to parse correctly");
println!("{}", record.data);
assert_eq!(
record.data.lines().map(str::trim).collect::<String>(),
include_str!("../samples/event_with_multiple_nodes_same_name_separate_attr.json")
.lines()
.map(str::trim)
.collect::<String>()
);
} | rust_cleaned_test_functions.jsonl/67528 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 467
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6748,
9455,
6615,
45233,
14896,
33574,
1269,
3453,
67598,
368,
341,
262,
5978,
15879,
27413,
62421,
543,
262,
1077,
3637,
3998,
2458,
284,
2924,
12524,
33673,
286,
7005,
41118,
25646,
2763,
1491,
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_array_expr() {
check_assist(
inline_local_variable,
"
fn foo() {
let a<|> = [1, 2, 3];
let b = a.len();
}",
"
fn foo() {
<|>let b = [1, 2, 3].len();
}",
);
} | rust_cleaned_test_functions.jsonl/60325 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
21915,
368,
341,
286,
1779,
12083,
380,
1006,
310,
7381,
13564,
14635,
345,
310,
6228,
8822,
15229,
368,
341,
262,
1077,
264,
27,
91,
29,
284,
508,
16,
11,
220,
17,
11,
220,
18,
935,
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_get_view_function_when_scope_is_good() {
let parsed_file = syn::parse_file(_FILE_WITH_ROUTES_AND_MODEL,).unwrap();
let model = find_model(&parsed_file,);
let result = get_view_function("logged_user", "forbidden", &model.unwrap(),);
let should_have = FORBIDDEN_VIEW;
assert_eq!(result, should_have)
} | rust_cleaned_test_functions.jsonl/15082 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 165
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
7122,
9174,
47636,
23199,
6892,
44781,
368,
341,
286,
1077,
15676,
2458,
284,
6782,
486,
6400,
2458,
2490,
6041,
23929,
8302,
53785,
21767,
27551,
11,
568,
15454,
543,
286,
1077,
1614,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.