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_intonativefunc_noalloc() {
let check_zst = |f: PyNativeFunc| assert_eq!(std::mem::size_of_val(f.as_ref()), 0);
fn py_func(_b: bool, _vm: &crate::VirtualMachine) -> i32 {
1
}
check_zst(py_func.into_func());
let empty_closure = || "foo".to_owned();
check_zst(empty_closure.into_func());
} | rust_cleaned_test_functions.jsonl/34832 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4042,
263,
1388,
2830,
6536,
4742,
368,
341,
286,
1077,
1779,
6415,
267,
284,
760,
69,
25,
5355,
20800,
9626,
91,
2060,
10714,
10297,
1834,
486,
10536,
486,
2141,
3575,
6189,
955,
5357,
7793,
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_snail_creation() {
let sn = parse_line("[9,[8,7]]");
assert_eq!(9, sn.borrow().left_unwrap().borrow().value.unwrap());
let sn = parse_line("[[[[1,3],[5,3]],[[1,3],[8,7]]],[[[4,9],[6,9]],[[8,2],[7,3]]]]");
assert_eq!("[[[[1,3],[5,3]],[[1,3],[8,7]]],[[[4,9],[6,9]],[[8,2],[7,3]]]]", format!("{:?}", sn.borrow()));
} | rust_cleaned_test_functions.jsonl/51416 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 209
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28022,
604,
46163,
368,
341,
286,
1077,
4131,
284,
4715,
6528,
10937,
24,
17259,
23,
11,
22,
5053,
797,
286,
2060,
10714,
10297,
24,
11,
4131,
83640,
1005,
2359,
4907,
10097,
1005,
71141,
1005,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_full_parses() {
for buff in ALL_BUFFERS.iter_mut() {
let orig_req = &buff[..];
let packet = buff.parse_with::<_, IgmpPacket<_>>(()).unwrap();
let msg_type = match packet {
IgmpPacket::MembershipQueryV2(p) => p.prefix.msg_type,
IgmpPacket::MembershipQueryV3(p) => p.prefix.msg_type,
IgmpPacket::MembershipReportV1(p) => p.prefix.msg_type,
IgmpPacket::MembershipReportV2(p) => p.prefix.msg_type,
IgmpPacket::MembershipReportV3(p) => p.prefix.msg_type,
IgmpPacket::LeaveGroup(p) => p.prefix.msg_type,
};
assert_eq!(msg_type, orig_req[0]);
}
} | rust_cleaned_test_functions.jsonl/65070 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 401
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16372,
77113,
288,
368,
341,
286,
369,
11522,
304,
13097,
62128,
4321,
19471,
29523,
368,
341,
310,
1077,
2713,
17644,
284,
609,
25976,
95874,
935,
310,
1077,
10151,
284,
11522,
4632,
6615,
27638,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_binary() {
let classes = vec!["Cat".to_owned(), "Dog".to_owned()];
let mut metrics = MulticlassClassificationProductionPredictionMetrics::new(classes);
metrics.update((
NumberOrString::String("Cat".to_owned()),
NumberOrString::String("Cat".to_owned()),
));
let labels = vec![
"Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Cat", "Dog", "Dog", "Dog", "Dog", "Dog",
];
let predictions = vec![
"Cat", "Cat", "Cat", "Cat", "Dog", "Dog", "Dog", "Dog", "Dog", "Dog", "Cat", "Cat",
];
for (label, prediction) in zip!(labels, predictions) {
metrics.update((
NumberOrString::String(prediction.to_owned()),
NumberOrString::String(label.to_owned()),
));
}
let metrics = metrics.finalize();
insta::assert_debug_snapshot!(metrics, @r###"
Some(
MulticlassClassificationProductionPredictionMetricsOutput {
class_metrics: [
MulticlassClassificationProductionPredictionClassMetricsOutput {
class_name: "Cat",
true_positives: 5,
false_positives: 2,
true_negatives: 3,
false_negatives: 3,
accuracy: 0.61538464,
precision: 0.71428573,
recall: 0.625,
f1_score: 0.6666667,
},
MulticlassClassificationProductionPredictionClassMetricsOutput {
class_name: "Dog",
true_positives: 3,
false_positives: 3,
true_negatives: 5,
false_negatives: 2,
accuracy: 0.61538464,
precision: 0.5,
recall: 0.6,
f1_score: 0.54545456,
},
],
accuracy: 0.61538464,
baseline_accuracy: 0.61538464,
precision_unweighted: 0.60714287,
precision_weighted: 0.6318681,
recall_unweighted: 0.6125,
recall_weighted: 0.61538464,
},
)
"###);
} | rust_cleaned_test_functions.jsonl/38416 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 996
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31761,
368,
341,
10217,
6846,
284,
7486,
0,
1183,
26801,
3263,
983,
51973,
1507,
330,
48940,
3263,
983,
51973,
33800,
10217,
5206,
16734,
284,
22162,
69503,
85040,
44967,
88279,
27328,
486,
931,
562... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_lowest_slot() {
let ledger_path = get_tmp_ledger_path_auto_delete!();
let blockstore = Blockstore::open(ledger_path.path()).unwrap();
for i in 0..10 {
let slot = i;
let (shreds, _) = make_slot_entries(slot, 0, 1);
blockstore.insert_shreds(shreds, None, false).unwrap();
}
assert_eq!(blockstore.lowest_slot(), 1);
blockstore.run_purge(0, 5, PurgeType::PrimaryIndex).unwrap();
assert_eq!(blockstore.lowest_slot(), 6);
} | rust_cleaned_test_functions.jsonl/9573 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 263
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23767,
477,
27563,
368,
341,
286,
1077,
46933,
2638,
284,
633,
16125,
38367,
1389,
2638,
27740,
11353,
0,
543,
286,
1077,
2504,
4314,
284,
8362,
4314,
486,
2508,
7,
50704,
2638,
3875,
6011,
15454,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_parse_double_pawn_push() {
let movegen = MoveGenerator::new();
let mut pos = Position::startpos();
assert_eq!(
Ok(Move {
kind: MoveKind::DoublePawnPush,
from: Square::E2,
to: Square::E4,
}),
movegen.parse_move(&pos, "e2e4"),
);
pos.make_move(&movegen.parse_move(&pos, "e2e4").unwrap());
assert_eq!(
Ok(Move {
kind: MoveKind::DoublePawnPush,
from: Square::D7,
to: Square::D5,
}),
movegen.parse_move(&pos, "d7d5"),
);
} | rust_cleaned_test_functions.jsonl/134619 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 284
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
24598,
620,
6379,
14218,
368,
341,
262,
1077,
3271,
4370,
284,
14561,
12561,
486,
931,
543,
262,
1077,
5206,
1133,
284,
12380,
486,
2468,
966,
543,
262,
2060,
10714,
33673,
414,
7622,
3189,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_keysend_dup_hash_partial_mpp() {
// Test that a keysend payment with a duplicate hash to an existing partial MPP payment fails as
// expected.
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
create_announced_chan_between_nodes(&nodes, 0, 1, InitFeatures::known(), InitFeatures::known());
let logger = test_utils::TestLogger::new();
let net_graph_msg_handler = &nodes[0].net_graph_msg_handler;
let route = get_route(&nodes[0].node.get_our_node_id(), &net_graph_msg_handler.network_graph.read().unwrap(), &nodes[1].node.get_our_node_id(), Some(InvoiceFeatures::known()), None, &Vec::new(), 100_000, TEST_FINAL_CLTV, &logger).unwrap();
let (payment_preimage, our_payment_hash, payment_secret) = get_payment_preimage_hash!(&nodes[1]);
// Use the utility function send_payment_along_path to send the payment with MPP data which
// indicates there are more HTLCs coming.
let cur_height = CHAN_CONFIRM_DEPTH + 1;
nodes[0].node.send_payment_along_path(&route.paths[0], &our_payment_hash, &Some(payment_secret), 200_000, cur_height, &None).unwrap();
check_added_monitors!(nodes[0], 1);
let mut events = nodes[0].node.get_and_clear_pending_msg_events();
assert_eq!(events.len(), 1);
pass_along_path(&nodes[0], &[&nodes[1]], 200_000, our_payment_hash, Some(payment_secret), events.drain(..).next().unwrap(), false, None);
nodes[0].node.send_spontaneous_payment(&route, Some(payment_preimage)).unwrap();
check_added_monitors!(nodes[0], 1);
let mut events = nodes[0].node.get_and_clear_pending_msg_events();
assert_eq!(events.len(), 1);
let ev = events.drain(..).next().unwrap();
let payment_event = SendEvent::from_event(ev);
nodes[1].node.handle_update_add_htlc(&nodes[0].node.get_our_node_id(), &payment_event.msgs[0]);
check_added_monitors!(nodes[1], 0);
commitment_signed_dance!(nodes[1], nodes[0], payment_event.commitment_msg, false);
expect_pending_htlcs_forwardable!(nodes[1]);
expect_pending_htlcs_forwardable!(nodes[1]);
check_added_monitors!(nodes[1], 1);
let updates = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
assert!(updates.update_add_htlcs.is_empty());
assert!(updates.update_fulfill_htlcs.is_empty());
assert_eq!(updates.update_fail_htlcs.len(), 1);
assert!(updates.update_fail_malformed_htlcs.is_empty());
assert!(updates.update_fee.is_none());
nodes[0].node.handle_update_fail_htlc(&nodes[1].node.get_our_node_id(), &updates.update_fail_htlcs[0]);
commitment_signed_dance!(nodes[0], nodes[1], updates.commitment_signed, true, true);
expect_payment_failed!(nodes[0], our_payment_hash, true);
// Send the second half of the original MPP payment.
nodes[0].node.send_payment_along_path(&route.paths[0], &our_payment_hash, &Some(payment_secret), 200_000, cur_height, &None).unwrap();
check_added_monitors!(nodes[0], 1);
let mut events = nodes[0].node.get_and_clear_pending_msg_events();
assert_eq!(events.len(), 1);
pass_along_path(&nodes[0], &[&nodes[1]], 200_000, our_payment_hash, Some(payment_secret), events.drain(..).next().unwrap(), true, None);
// Claim the full MPP payment. Note that we can't use a test utility like
// claim_funds_along_route because the ordering of the messages causes the second half of the
// lightning messages manually.
assert!(nodes[1].node.claim_funds(payment_preimage));
check_added_monitors!(nodes[1], 2);
let bs_first_updates = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
nodes[0].node.handle_update_fulfill_htlc(&nodes[1].node.get_our_node_id(), &bs_first_updates.update_fulfill_htlcs[0]);
nodes[0].node.handle_commitment_signed(&nodes[1].node.get_our_node_id(), &bs_first_updates.commitment_signed);
check_added_monitors!(nodes[0], 1);
let (as_first_raa, as_first_cs) = get_revoke_commit_msgs!(nodes[0], nodes[1].node.get_our_node_id());
nodes[1].node.handle_revoke_and_ack(&nodes[0].node.get_our_node_id(), &as_first_raa);
check_added_monitors!(nodes[1], 1);
let bs_second_updates = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
nodes[1].node.handle_commitment_signed(&nodes[0].node.get_our_node_id(), &as_first_cs);
check_added_monitors!(nodes[1], 1);
let bs_first_raa = get_event_msg!(nodes[1], MessageSendEvent::SendRevokeAndACK, nodes[0].node.get_our_node_id());
nodes[0].node.handle_update_fulfill_htlc(&nodes[1].node.get_our_node_id(), &bs_second_updates.update_fulfill_htlcs[0]);
nodes[0].node.handle_commitment_signed(&nodes[1].node.get_our_node_id(), &bs_second_updates.commitment_signed);
check_added_monitors!(nodes[0], 1);
let as_second_raa = get_event_msg!(nodes[0], MessageSendEvent::SendRevokeAndACK, nodes[1].node.get_our_node_id());
nodes[0].node.handle_revoke_and_ack(&nodes[1].node.get_our_node_id(), &bs_first_raa);
let as_second_updates = get_htlc_update_msgs!(nodes[0], nodes[1].node.get_our_node_id());
check_added_monitors!(nodes[0], 1);
nodes[1].node.handle_revoke_and_ack(&nodes[0].node.get_our_node_id(), &as_second_raa);
check_added_monitors!(nodes[1], 1);
nodes[1].node.handle_commitment_signed(&nodes[0].node.get_our_node_id(), &as_second_updates.commitment_signed);
check_added_monitors!(nodes[1], 1);
let bs_third_raa = get_event_msg!(nodes[1], MessageSendEvent::SendRevokeAndACK, nodes[0].node.get_our_node_id());
nodes[0].node.handle_revoke_and_ack(&nodes[1].node.get_our_node_id(), &bs_third_raa);
check_added_monitors!(nodes[0], 1);
let events = nodes[0].node.get_and_clear_pending_events();
match events[0] {
Event::PaymentSent { payment_preimage: ref preimage } => {
assert_eq!(payment_preimage, *preimage);
},
_ => panic!("Unexpected event"),
}
match events[1] {
Event::PaymentSent { payment_preimage: ref preimage } => {
assert_eq!(payment_preimage, *preimage);
},
_ => panic!("Unexpected event"),
}
} | rust_cleaned_test_functions.jsonl/94566 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2483
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3097,
6681,
51932,
8950,
52068,
717,
602,
368,
341,
197,
197,
322,
3393,
429,
264,
1376,
6681,
8160,
448,
264,
22513,
5175,
311,
458,
6350,
7130,
386,
4406,
8160,
14525,
438,
198,
197,
197,
322,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_set_no_data_value() {
let driver = Driver::get("MEM").unwrap();
let dataset = driver.create("", 20, 10, 1).unwrap();
let rasterband = dataset.rasterband(1).unwrap();
assert_eq!(rasterband.no_data_value(), None);
assert!(rasterband.set_no_data_value(3.14).is_ok());
assert_eq!(rasterband.no_data_value(), Some(3.14));
} | rust_cleaned_test_functions.jsonl/83453 | {
"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,
2602,
6536,
1769,
3142,
368,
341,
262,
1077,
5579,
284,
14577,
486,
455,
445,
31970,
1827,
15454,
543,
262,
1077,
10337,
284,
5579,
2520,
19814,
220,
17,
15,
11,
220,
16,
15,
11,
220,
16,
568,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invoke_func_via_table() -> Result<()> {
let store = Store::default();
let binary = wat::parse_str(
r#"
(module
(func $f (result i64) (i64.const 42))
(table (export "table") 1 1 anyfunc)
(elem (i32.const 0) $f)
)
"#,
)?;
let module = Module::new(&store, &binary).context("> Error compiling module!")?;
let instance = Instance::new(&module, &[]).context("> Error instantiating module!")?;
let f = instance
.get_export("table")
.unwrap()
.table()
.unwrap()
.get(0)
.unwrap()
.funcref()
.unwrap()
.clone();
let result = f.call(&[]).unwrap();
assert_eq!(result[0].unwrap_i64(), 42);
Ok(())
} | rust_cleaned_test_functions.jsonl/32040 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 396
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
79779,
9596,
80710,
5237,
368,
1464,
5714,
71698,
341,
262,
1077,
3553,
284,
9129,
486,
2258,
1428,
262,
1077,
7868,
284,
29025,
486,
6400,
2895,
1006,
286,
435,
2,
698,
688,
320,
4352,
198,
310... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_cli_timestamp_tx() {
let TestValidator {
server,
leader_data,
alice,
ledger_path,
..
} = TestValidator::run();
let bob_pubkey = Pubkey::new_rand();
let (sender, receiver) = channel();
run_local_faucet(alice, sender, None);
let faucet_addr = receiver.recv().unwrap();
let rpc_client = RpcClient::new_socket(leader_data.rpc);
let default_signer0 = Keypair::new();
let default_signer1 = Keypair::new();
let mut config_payer = CliConfig::default();
config_payer.json_rpc_url =
format!("http://{}:{}", leader_data.rpc.ip(), leader_data.rpc.port());
config_payer.signers = vec![&default_signer0];
let mut config_witness = CliConfig::default();
config_witness.json_rpc_url = config_payer.json_rpc_url.clone();
config_witness.signers = vec![&default_signer1];
assert_ne!(
config_payer.signers[0].pubkey(),
config_witness.signers[0].pubkey()
);
request_and_confirm_airdrop(
&rpc_client,
&faucet_addr,
&config_payer.signers[0].pubkey(),
50,
)
.unwrap();
check_balance(50, &rpc_client, &config_payer.signers[0].pubkey());
request_and_confirm_airdrop(
&rpc_client,
&faucet_addr,
&config_witness.signers[0].pubkey(),
1,
)
.unwrap();
let date_string = "\"2018-09-19T17:30:59Z\"";
let dt: DateTime<Utc> = serde_json::from_str(&date_string).unwrap();
config_payer.command = CliCommand::Pay(PayCommand {
lamports: 10,
to: bob_pubkey,
timestamp: Some(dt),
timestamp_pubkey: Some(config_witness.signers[0].pubkey()),
..PayCommand::default()
});
let sig_response = process_command(&config_payer);
let object: Value = serde_json::from_str(&sig_response.unwrap()).unwrap();
let process_id_str = object.get("processId").unwrap().as_str().unwrap();
let process_id_vec = bs58::decode(process_id_str)
.into_vec()
.expect("base58-encoded public key");
let process_id = Pubkey::new(&process_id_vec);
check_balance(40, &rpc_client, &config_payer.signers[0].pubkey()); // config_payer balance
check_balance(10, &rpc_client, &process_id); // contract balance
check_balance(0, &rpc_client, &bob_pubkey); // recipient balance
// Sign transaction by config_witness
config_witness.command = CliCommand::TimeElapsed(bob_pubkey, process_id, dt);
process_command(&config_witness).unwrap();
check_balance(40, &rpc_client, &config_payer.signers[0].pubkey()); // config_payer balance
check_balance(0, &rpc_client, &process_id); // contract balance
check_balance(10, &rpc_client, &bob_pubkey); // recipient balance
server.close().unwrap();
remove_dir_all(ledger_path).unwrap();
} | rust_cleaned_test_functions.jsonl/88221 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1219
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47147,
23073,
17805,
368,
341,
262,
1077,
3393,
14256,
341,
286,
3538,
345,
286,
7653,
1769,
345,
286,
70433,
345,
286,
46933,
2638,
345,
286,
54538,
262,
335,
284,
3393,
14256,
486,
6108,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_script_codes() {
let codes = all_alpha_codes();
assert!(codes.len() > 0);
let numerics = all_numeric_codes();
assert!(numerics.len() > 0);
} | rust_cleaned_test_functions.jsonl/29980 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14660,
38482,
368,
341,
286,
1077,
13912,
284,
678,
26633,
38482,
543,
286,
2060,
10297,
25814,
19406,
368,
861,
220,
15,
317,
286,
1077,
7857,
1211,
284,
678,
29418,
38482,
543,
286,
2060,
10297,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_deserialize_perms() {
let json_perms = r#"
{
"read": {
"global_state": "Granted",
"granted_list": [],
"denied_list": []
},
"write": {
"global_state": "Granted",
"granted_list": [],
"denied_list": []
},
"net": {
"global_state": "Granted",
"granted_list": [],
"denied_list": []
},
"env": "Granted",
"run": "Granted",
"plugin": "Granted",
"hrtime": "Granted"
}
"#;
let perms0 = Permissions {
read: UnaryPermission {
global_state: PermissionState::Granted,
..Default::default()
},
write: UnaryPermission {
global_state: PermissionState::Granted,
..Default::default()
},
net: UnaryPermission {
global_state: PermissionState::Granted,
..Default::default()
},
env: PermissionState::Granted,
run: PermissionState::Granted,
hrtime: PermissionState::Granted,
plugin: PermissionState::Granted,
};
let deserialized_perms: Permissions =
serde_json::from_str(json_perms).unwrap();
assert_eq!(perms0, deserialized_perms);
} | rust_cleaned_test_functions.jsonl/121179 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 594
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15768,
9050,
98043,
368,
341,
262,
1077,
2951,
98043,
284,
435,
2,
698,
262,
341,
414,
330,
878,
788,
341,
286,
330,
9752,
4387,
788,
330,
55481,
756,
286,
330,
901,
7566,
2019,
788,
10239,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_conv_1() {
let conv = make_conv(1, 1, PaddingSpec::SameUpper);
// NHWC
let data = rctensor4(&[[[[1f32]]]]);
// HWIO
let filter = rctensor4(&[[[[0.0f32]]], [[[1.0]]], [[[0.0]]]]);
let exp = rctensor4(&[[[[1f32]]]]);
let result = conv.eval(tvec![data, filter]).unwrap().remove(0);
assert_eq!(exp, result);
} | rust_cleaned_test_functions.jsonl/6395 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22716,
62,
16,
368,
341,
286,
1077,
5686,
284,
1281,
22716,
7,
16,
11,
220,
16,
11,
23024,
8327,
486,
19198,
14251,
317,
286,
442,
34831,
25459,
198,
286,
1077,
821,
284,
435,
302,
3805,
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_greatest_int() {
let cases = vec![
(vec![None, None], None),
(vec![Some(1), Some(1)], Some(1)),
(vec![Some(1), Some(-1), None], None),
(vec![Some(-2), Some(-1), Some(1), Some(2)], Some(2)),
(
vec![Some(i64::MIN), Some(0), Some(-1), Some(i64::MAX)],
Some(i64::MAX),
),
(vec![Some(0), Some(4), Some(8), Some(8)], Some(8)),
];
for (row, expected) in cases {
let output = RpnFnScalarEvaluator::new()
.push_params(row)
.evaluate(ScalarFuncSig::GreatestInt)
.unwrap();
assert_eq!(output, expected);
}
} | rust_cleaned_test_functions.jsonl/75988 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 442
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1889,
11175,
4042,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
320,
4083,
20703,
4064,
11,
2240,
1125,
2240,
1326,
310,
320,
4083,
20703,
8373,
7,
16,
701,
4329,
7,
16,
25035,
4329,
7,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_parse_datetime_bogus() {
assert_de_tokens_error::<UnixTimestamp>(
&[Token::Str("adf3rt546")],
"input contains invalid characters",
);
} | rust_cleaned_test_functions.jsonl/13696 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
28943,
880,
538,
355,
368,
341,
286,
2060,
2259,
28838,
4096,
27638,
55832,
20812,
17055,
310,
44590,
3323,
486,
2580,
445,
96289,
18,
3342,
20,
19,
21,
899,
1259,
310,
330,
1355,
5610,
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 |
#[test]
fn test_error_is_retriable() {
let http_status_code_err = JsonRpcAsyncClientError::HTTPError(StatusCode::BAD_GATEWAY);
let server_err = JsonRpcAsyncClientError::InvalidServerResponse(
"test invalid server response".to_string(),
);
// fake request that should fail to get an error
let test_client = ClientBuilder::new()
.timeout(Duration::from_millis(1))
.build()
.unwrap();
let req_err = test_client
.get(Url::parse("http://192.108.0.1").unwrap())
.send()
.unwrap_err();
let client_err = JsonRpcAsyncClientError::ClientError(req_err);
let arg_err = JsonRpcAsyncClientError::InvalidArgument("test invalid argument".to_string());
// Make sure display is implemented correctly for error enum
println!("{}", client_err);
assert_eq!(server_err.is_retriable(), false);
assert_eq!(http_status_code_err.is_retriable(), true);
assert_eq!(arg_err.is_retriable(), false);
assert_eq!(client_err.is_retriable(), true);
} | rust_cleaned_test_functions.jsonl/25666 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 504
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4096,
6892,
1288,
376,
2156,
368,
341,
286,
1077,
1758,
4773,
4136,
9266,
284,
8308,
60248,
6525,
2959,
1454,
486,
9230,
1454,
7,
15872,
486,
53572,
81116,
41803,
317,
286,
1077,
3538,
9266,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vec3a_round() {
assert_eq!(Vec3A::new(1.35, 0.0, 0.0).round().x, 1.0);
assert_eq!(Vec3A::new(0.0, 1.5, 0.0).round().y, 2.0);
assert_eq!(Vec3A::new(0.0, 0.0, -15.5).round().z, -16.0);
assert_eq!(Vec3A::new(0.0, 0.0, 0.0).round().z, 0.0);
assert_eq!(Vec3A::new(0.0, 21.1, 0.0).round().y, 21.0);
assert_eq!(Vec3A::new(0.0, 11.123, 0.0).round().y, 11.0);
assert_eq!(Vec3A::new(0.0, 11.499, 0.0).round().y, 11.0);
assert_eq!(
Vec3A::new(f32::NEG_INFINITY, f32::INFINITY, 0.0).round(),
Vec3A::new(f32::NEG_INFINITY, f32::INFINITY, 0.0)
);
assert!(Vec3A::new(f32::NAN, 0.0, 0.0).round().x.is_nan());
} | rust_cleaned_test_functions.jsonl/23506 | {
"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,
13251,
18,
64,
29896,
368,
341,
262,
2060,
10714,
10297,
10050,
18,
32,
486,
931,
7,
16,
13,
18,
20,
11,
220,
15,
13,
15,
11,
220,
15,
13,
15,
568,
1049,
1005,
87,
11,
220,
16,
13,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_query_conversion_all_set() {
let sr = meta_search::SearchRequest {
key: Some("key".to_string()),
resource_type: Some(meta_search::ResourceType::Dataset as i32),
conditions: vec![meta_search::FieldQuery {
key: "fancy_key".to_owned(),
query: "\"fancy_value\"".to_owned(),
}],
pagination: Some(meta_search::search_request::Pagination {
page: 2_u32,
page_size: 50_u32,
}),
};
let spec: SearchSpec = sr.try_into().unwrap();
let query = spec.filter;
let expected = mongodb::bson::doc! {
"resource_type" : meta_search::ResourceType::Dataset as i32,
"key": "key",
"metadata.fancy_key" : "fancy_value"
};
assert_eq!(2_u32, spec.page);
assert_eq!(50_usize, spec.page_size);
assert_eq!(expected, query);
} | rust_cleaned_test_functions.jsonl/113858 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 507
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5738,
64132,
5705,
2602,
368,
341,
286,
1077,
18962,
284,
8823,
10716,
486,
5890,
1900,
341,
310,
1376,
25,
4329,
445,
792,
3263,
983,
3904,
14702,
310,
5101,
1819,
25,
4329,
45119,
10716,
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_rsplitnator() {
let xs = &[1,2,3,4,5];
assert_eq!(xs.rsplitn(0, |x| *x % 2 == 0).collect::<Vec<&[int]>>().as_slice(),
&[&[1,2,3,4,5]]);
assert_eq!(xs.rsplitn(1, |x| *x % 2 == 0).collect::<Vec<&[int]>>().as_slice(),
&[&[5], &[1,2,3]]);
assert_eq!(xs.rsplitn(3, |_| true).collect::<Vec<&[int]>>().as_slice(),
&[&[], &[], &[], &[1,2]]);
let xs: &[int] = &[];
assert_eq!(xs.rsplitn(1, |x| *x == 5).collect::<Vec<&[int]>>().as_slice(), &[&[]]);
} | rust_cleaned_test_functions.jsonl/33155 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 366
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
6960,
77,
850,
368,
341,
286,
1077,
11943,
284,
44590,
16,
11,
17,
11,
18,
11,
19,
11,
20,
4821,
286,
2060,
10714,
10297,
18561,
1746,
6960,
77,
7,
15,
11,
760,
87,
91,
353,
87,
1018... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ccsds_parser_sync_not_enough_bytes() {
let mut parser = CcsdsParser::new();
parser.config.sync_bytes.push(0xEB);
parser.config.sync_bytes.push(0x90);
parser.recv_slice(&[0xEB, 0x90, 0x00, 0x3, 0xFF, 0xFF, 0x00, 0x01]);
assert_eq!(parser.current_status(), CcsdsParserStatus::NotEnoughBytesForHeader);
} | rust_cleaned_test_functions.jsonl/105743 | {
"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,
28955,
82,
5356,
18517,
23008,
7913,
6205,
1384,
12524,
368,
972,
262,
1077,
5206,
6729,
284,
356,
4837,
5356,
6570,
486,
931,
1647,
262,
6729,
5423,
30712,
12524,
2552,
7,
15,
85211,
736,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ne() -> Result<(), TestingError> {
VMTestRunner::new()
.add(PushConst::new_field(1.into()))
.add(PushConst::new_field(2.into()))
.add(Ne)
.add(PushConst::new_field(2.into()))
.add(PushConst::new_field(2.into()))
.add(Ne)
.add(PushConst::new_field(2.into()))
.add(PushConst::new_field(1.into()))
.add(Ne)
.test(&[1, 0, 1])
} | rust_cleaned_test_functions.jsonl/23183 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 279
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13925,
368,
1464,
5714,
68843,
26768,
1454,
29,
341,
286,
17792,
2271,
19486,
486,
931,
741,
310,
659,
718,
5304,
1116,
19167,
486,
931,
5013,
7,
16,
39860,
12145,
310,
659,
718,
5304,
1116,
191... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dir_with_files() {
let tempdir = tempfile::tempdir().unwrap();
File::create(tempdir.path().join("abc")).unwrap();
File::create(tempdir.path().join("def")).unwrap();
File::create(tempdir.path().join("ghi")).unwrap();
let request = Request {
path: tempdir.path().to_path_buf(),
};
let mut session = session::test::Fake::new();
assert!(handle(&mut session, request).is_ok());
let mut replies = session.replies().collect::<Vec<&Response>>();
replies.sort_by_key(|reply| reply.path.clone());
assert_eq!(replies.len(), 3);
assert_eq!(replies[0].path, tempdir.path().join("abc"));
assert!(replies[0].metadata.is_file());
assert_eq!(replies[1].path, tempdir.path().join("def"));
assert!(replies[1].metadata.is_file());
assert_eq!(replies[2].path, tempdir.path().join("ghi"));
assert!(replies[2].metadata.is_file());
} | rust_cleaned_test_functions.jsonl/69103 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 441
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4334,
6615,
10931,
368,
341,
286,
1077,
2730,
3741,
284,
54819,
486,
3888,
3741,
1005,
15454,
543,
286,
2887,
486,
3182,
9758,
3741,
3875,
1005,
5987,
445,
13683,
15197,
15454,
543,
286,
2887,
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_authorize_url_insecure() {
let client = new_client();
let url = oauth2::insecure::authorize_url(&client);
assert_eq!(
Url::parse("http://example.com/auth?response_type=code&client_id=aaa").unwrap(),
url
);
} | rust_cleaned_test_functions.jsonl/12759 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22938,
551,
2903,
1243,
25132,
368,
341,
262,
1077,
2943,
284,
501,
8179,
1428,
262,
1077,
2515,
284,
46415,
17,
486,
258,
25132,
486,
52022,
2903,
2099,
2972,
626,
262,
2060,
10714,
33673,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_transaction() {
let oracle = 1;
let alice = 2;
new_test_ext().execute_with(|| {
Timestamp::set_timestamp(1600438152000);
assert_ok!(RWS::set_oracle(Origin::root(), oracle));
let call = Call::from(datalog::Call::record("true".into()));
assert_eq!(RWS::quota(alice), None);
assert_err!(
RWS::call(Origin::signed(alice), alice, call.clone().into()),
Error::<Runtime>::NoSubscription,
);
assert_ok!(RWS::set_subscription(Origin::signed(alice), vec![alice]));
assert_err!(
RWS::call(Origin::signed(alice), alice, call.clone().into()),
Error::<Runtime>::NoQuota,
);
assert_ok!(RWS::set_bandwidth(
Origin::signed(oracle),
alice,
Perbill::from_percent(1),
),);
assert_eq!(RWS::quota(alice), None);
assert_ok!(RWS::call(Origin::signed(alice), alice, call.clone().into()));
assert_eq!(RWS::quota(alice), Some((1600438152000, 0)));
Timestamp::set_timestamp(1600438156000);
assert_ok!(RWS::call(Origin::signed(alice), alice, call.clone().into()));
assert_eq!(RWS::quota(alice), Some((1600438156000, 3 * CALL_COST)));
assert_ok!(RWS::call(Origin::signed(alice), alice, call.clone().into()));
assert_eq!(RWS::quota(alice), Some((1600438156000, 2 * CALL_COST)));
assert_ok!(RWS::call(Origin::signed(alice), alice, call.clone().into()));
assert_eq!(RWS::quota(alice), Some((1600438156000, 1 * CALL_COST)));
assert_ok!(RWS::call(Origin::signed(alice), alice, call.clone().into()));
assert_eq!(RWS::quota(alice), Some((1600438156000, 0)));
assert_err!(
RWS::call(Origin::signed(alice), alice, call.into()),
Error::<Runtime>::NoQuota,
);
})
} | rust_cleaned_test_functions.jsonl/101699 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1072
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28884,
368,
341,
286,
1077,
52741,
284,
220,
16,
280,
286,
1077,
70433,
284,
220,
17,
401,
286,
501,
4452,
9927,
1005,
10257,
6615,
79453,
341,
310,
32758,
486,
746,
23073,
7,
16,
21,
15,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_put_from_iter() {
let db_name = "target/tmp/test_dbu64/test_from_iter.abyssiniandb";
let _ = std::fs::remove_dir_all(db_name);
let db = abyssiniandb::open_file(db_name).unwrap();
let mut db_map = db
.db_map_u64_with_params(
"some_u64_1",
FileDbParams {
buckets_size: HashBucketsParam::Capacity(4),
..Default::default()
},
)
.unwrap();
let xs = [(1, 1), (2, 2), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6)];
db_map
.put_from_iter(xs.iter().map(|&(k, v)| (k.into(), vec![v as u8])))
.unwrap();
assert_eq!(db_map.len().unwrap(), 6);
for &(k, v) in &xs {
assert_eq!(db_map.get(&k).unwrap(), Some(vec![v as u8]));
}
assert_eq!(db_map.len().unwrap() as usize, xs.len() - 1);
} | rust_cleaned_test_functions.jsonl/3874 | {
"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,
15557,
5673,
11723,
368,
341,
286,
1077,
2927,
1269,
284,
330,
5657,
57008,
12697,
8685,
84,
21,
19,
12697,
5673,
11723,
13,
6115,
778,
6591,
437,
65,
876,
286,
1077,
716,
284,
1460,
486,
3848,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_neg_parse_struct_decl() {
let code = String::from("
cont: Integer {
inner: int;
inner: int;
}
");
let mut lexer = Token::lexer(code.as_str());
let parser = Parser::new(code.clone());
let decl_res = parser.parse_container_decl(&mut lexer);
assert!(decl_res.is_err());
} | rust_cleaned_test_functions.jsonl/43196 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28209,
21039,
15126,
35814,
368,
341,
262,
1077,
2038,
284,
923,
486,
1499,
70576,
286,
683,
25,
4440,
341,
310,
9179,
25,
526,
280,
310,
9179,
25,
526,
280,
286,
456,
262,
39887,
262,
1077,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mv_update_option() {
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
let file_a = "test_mv_update_option_file_a";
let file_b = "test_mv_update_option_file_b";
at.touch(file_a);
at.touch(file_b);
let ts = time::now().to_timespec();
let now = FileTime::from_unix_time(ts.sec as i64, ts.nsec as u32);
let later = FileTime::from_unix_time(ts.sec as i64 + 3600, ts.nsec as u32);
filetime::set_file_times(at.plus_as_string(file_a), now, now).unwrap();
filetime::set_file_times(at.plus_as_string(file_b), now, later).unwrap();
scene.ucmd().arg("--update").arg(file_a).arg(file_b).run();
assert!(at.file_exists(file_a));
assert!(at.file_exists(file_b));
scene
.ucmd()
.arg("--update")
.arg(file_b)
.arg(file_a)
.succeeds()
.no_stderr();
assert!(at.file_exists(file_a));
assert!(!at.file_exists(file_b));
} | rust_cleaned_test_functions.jsonl/41622 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 463
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73187,
8882,
9672,
368,
341,
262,
1077,
6109,
284,
3393,
54031,
486,
931,
67811,
1269,
0,
1423,
262,
1077,
518,
284,
609,
22483,
67785,
18513,
280,
262,
1077,
1034,
4306,
284,
330,
1944,
73187,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_characteristic_square_mod_6_is_one() {
use super::*;
assert!(!characteristic_square_mod_6_is_one(&[36]));
assert!(characteristic_square_mod_6_is_one(&[37]));
assert!(!characteristic_square_mod_6_is_one(&[38]));
assert!(!characteristic_square_mod_6_is_one(&[39]));
assert!(!characteristic_square_mod_6_is_one(&[40]));
assert!(characteristic_square_mod_6_is_one(&[41]));
assert!(!characteristic_square_mod_6_is_one(&[36, 36]));
assert!(!characteristic_square_mod_6_is_one(&[36, 37]));
assert!(!characteristic_square_mod_6_is_one(&[36, 38]));
assert!(!characteristic_square_mod_6_is_one(&[36, 39]));
assert!(!characteristic_square_mod_6_is_one(&[36, 40]));
assert!(!characteristic_square_mod_6_is_one(&[36, 41]));
assert!(!characteristic_square_mod_6_is_one(&[36, 41]));
assert!(!characteristic_square_mod_6_is_one(&[37, 41]));
assert!(!characteristic_square_mod_6_is_one(&[38, 41]));
assert!(characteristic_square_mod_6_is_one(&[39, 41]));
assert!(!characteristic_square_mod_6_is_one(&[40, 41]));
assert!(characteristic_square_mod_6_is_one(&[41, 41]));
assert!(characteristic_square_mod_6_is_one(&[1, u64::MAX]));
} | rust_cleaned_test_functions.jsonl/5855 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 621
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40988,
4532,
39794,
7480,
62,
21,
6892,
11667,
368,
341,
286,
990,
2256,
56162,
286,
2060,
0,
3471,
19190,
4532,
39794,
7480,
62,
21,
6892,
11667,
2099,
58,
18,
21,
14382,
286,
2060,
10297,
1919... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_shr() {
let mut n = U256::from_limbs([
0xbe1897b996367829,
0x24c4cd2cacd2e3be,
0xa0a61c4de933a54e,
0x059e0db9d96add73,
]);
let e = U256::from_limbs([
0xa5c77d7c312f732c,
0x674a9c49899a5959,
0xd5bae7414c389bd2,
0x0000000b3c1b73b2,
]);
n >>= 23;
assert_eq!(n, e);
} | rust_cleaned_test_functions.jsonl/103949 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 309
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3712,
81,
368,
341,
286,
1077,
5206,
308,
284,
547,
17,
20,
21,
486,
1499,
58191,
1279,
8956,
310,
220,
15,
42459,
16,
23,
24,
22,
65,
24,
24,
21,
18,
21,
22,
23,
17,
24,
345,
310,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_expand_rule() {
assert_err(
"($($i:ident);*) => ($i)",
"foo!{a}",
ExpandError::BindingError(String::from(
"expected simple binding, found nested binding `i`",
)),
);
// FIXME:
} | rust_cleaned_test_functions.jsonl/74601 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 175
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67875,
21124,
368,
341,
286,
2060,
9266,
1006,
310,
330,
699,
699,
72,
25,
1713,
1215,
3764,
589,
1711,
72,
15752,
310,
330,
7975,
0,
90,
64,
24375,
310,
50141,
1454,
486,
15059,
1454,
2242,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bound_variable_limit_affects_distinct() {
let schemaReplicant = prepopulated_schemaReplicant();
let causetq = r#"[:find ?x :in ?limit :where [?x :foo/bar "yyy"] :limit ?limit]"#;
let inputs = CausetQInputs::with_value_sequence(vec![(ToUpper::from_valid_name("?limit"), MinkowskiType::Long(1))]);
let SQLCausetQ { allegrosql, args } = translate_with_inputs(&schemaReplicant, causetq, inputs);
assert_eq!(allegrosql, "SELECT `Causets00`.e AS `?x` FROM `causets` AS `Causets00` WHERE `Causets00`.a = 99 AND `Causets00`.v = $v0 LIMIT 1");
assert_eq!(args, vec![make_arg("$v0", "yyy")]);
} | rust_cleaned_test_functions.jsonl/90694 | {
"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,
19447,
14635,
14763,
4306,
39927,
16031,
7800,
368,
341,
262,
1077,
10802,
18327,
35237,
284,
855,
8374,
7757,
25371,
18327,
35237,
1428,
9401,
262,
1077,
2162,
18187,
80,
284,
435,
55543,
3447,
390... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_query_and_then_custom_error() -> CustomResult<()> {
let db = checked_memory_handle();
let sql = "BEGIN;
CREATE TABLE foo(x INTEGER, y TEXT);
INSERT INTO foo VALUES(4, 'hello');
INSERT INTO foo VALUES(3, ', ');
INSERT INTO foo VALUES(2, 'world');
INSERT INTO foo VALUES(1, '!');
END;";
db.execute_batch(sql)?;
let mut query = db.prepare("SELECT x, y FROM foo ORDER BY x DESC")?;
let results: CustomResult<Vec<String>> = query
.query_and_then([], |row| row.get(1).map_err(CustomError::Sqlite))?
.collect();
assert_eq!(results?.concat(), "hello, world!");
Ok(())
} | rust_cleaned_test_functions.jsonl/113070 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 471
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5738,
8378,
68367,
15875,
4096,
368,
1464,
8406,
2077,
71698,
341,
310,
1077,
2927,
284,
10067,
19195,
10630,
543,
310,
1077,
5704,
284,
330,
37588,
280,
5180,
30776,
14363,
15229,
2075,
30381,
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... | 5 |
#[test]
fn test_flat_take_str() {
let input = "abcdef";
// read first 2 bytes and use correct combinator: OK
let res: IResult<&str, &str> = flat_take(2u8, take(2u8))(input);
assert_eq!(res, Ok(("cdef", "ab")));
let res: IResult<&str, &str> = flat_take(3u8, take(2u8))(input);
assert_eq!(res, Ok(("def", "ab")));
// read 2 bytes and a use combinator requiring more bytes
let res: IResult<&str, &str> = flat_take(2u8, take(4u8))(input);
assert_eq!(res, Err(Err::Incomplete(Needed::Unknown)));
} | rust_cleaned_test_functions.jsonl/51157 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 282
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49556,
73261,
2895,
368,
341,
286,
1077,
1946,
284,
330,
41202,
876,
286,
442,
1349,
1156,
220,
17,
5820,
323,
990,
4396,
3614,
17272,
25,
10402,
198,
286,
1077,
592,
25,
358,
2077,
52244,
495,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_split_good_tree() {
let root = tree!('T' => [2, 'A', ('R' => [2, 'B', 'X'])]);
println!("Input: {:?}", root);
let splitted = root.split();
let expected = tree!('T' => [2, 'A', ('R' => [2, 'B', 'X'])]);
assert_eq!(splitted, expected);
} | rust_cleaned_test_functions.jsonl/9209 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 128
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
44781,
11663,
368,
341,
197,
10217,
3704,
284,
4916,
0,
492,
51,
6,
589,
508,
17,
11,
364,
32,
516,
4319,
49,
6,
589,
508,
17,
11,
364,
33,
516,
364,
55,
5078,
2558,
197,
81168,
172... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_server_rejects_clients_without_any_kx_group_overlap() {
fn different_kx_group(msg: &mut Message) {
if let MessagePayload::Handshake(hs) = &mut msg.payload {
if let HandshakePayload::ClientHello(ch) = &mut hs.payload {
for mut ext in ch.extensions.iter_mut() {
if let ClientExtension::NamedGroups(ngs) = &mut ext {
ngs.clear();
}
if let ClientExtension::KeyShare(ks) = &mut ext {
ks.clear();
}
}
}
}
}
let (mut client, mut server) = make_pair(KeyType::RSA);
transfer_altered(&mut client, different_kx_group, &mut server);
assert_eq!(server.process_new_packets(),
Err(TLSError::PeerIncompatibleError("no kx group overlap with client".into())));
} | rust_cleaned_test_functions.jsonl/10034 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 470
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12015,
1288,
583,
82,
56899,
39904,
37248,
4698,
87,
6288,
65794,
368,
341,
262,
5168,
2155,
4698,
87,
6288,
8119,
25,
609,
6984,
4856,
8,
341,
286,
421,
1077,
4856,
29683,
486,
2314,
29661,
320... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_field_into_allocated_bits_le() {
use crate::bellman::pairing::bls12_381;
let mut cs = TrivialAssembly::<bls12_381::Bls12, PlonkCsWidth4WithNextStepParams, Width4MainGateWithDNext>::new();
let r = bls12_381::Fr::from_str("9147677615426976802526883532204139322118074541891858454835346926874644257775").unwrap();
let bits = field_into_allocated_bits_le(&mut cs, Some(r)).unwrap();
let char_bits: Vec<_> = BitIterator::new(bls12_381::Fr::char()).collect();
assert!(char_bits[0] == false);
assert!(char_bits[1] == true);
assert!(cs.is_satisfied());
assert_eq!(bits.len(), 255);
assert_eq!(bits[254 - 0].value.unwrap(), false);
assert_eq!(bits[254 - 1].value.unwrap(), false);
assert_eq!(bits[254 - 2].value.unwrap(), true);
assert_eq!(bits[254 - 3].value.unwrap(), false);
assert_eq!(bits[254 - 4].value.unwrap(), true);
assert_eq!(bits[254 - 5].value.unwrap(), false);
assert_eq!(bits[254 - 20].value.unwrap(), true);
assert_eq!(bits[254 - 23].value.unwrap(), true);
} | rust_cleaned_test_functions.jsonl/10420 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 519
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5013,
45514,
82342,
20034,
11751,
368,
341,
286,
990,
17717,
486,
17250,
1515,
486,
12670,
287,
486,
2024,
82,
16,
17,
62,
18,
23,
16,
280,
286,
1077,
5206,
10532,
284,
1163,
26658,
25791,
27638... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_slices() {
// takes up 2 u64s
let bools = std::iter::repeat(true)
.take(10)
.chain(std::iter::repeat(false).take(30))
.chain(std::iter::repeat(true).take(20))
.chain(std::iter::repeat(false).take(17))
.chain(std::iter::repeat(true).take(4));
let bool_array: BooleanArray = bools.map(Some).collect();
let slices: Vec<_> = SlicesIterator::new(&bool_array).collect();
let expected = vec![(0, 10), (40, 60), (77, 81)];
assert_eq!(slices, expected);
// slice with offset and truncated len
let len = bool_array.len();
let sliced_array = bool_array.slice(7, len - 10);
let sliced_array = sliced_array
.as_any()
.downcast_ref::<BooleanArray>()
.unwrap();
let slices: Vec<_> = SlicesIterator::new(sliced_array).collect();
let expected = vec![(0, 3), (33, 53), (70, 71)];
assert_eq!(slices, expected);
} | rust_cleaned_test_functions.jsonl/75311 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 496
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
87288,
368,
341,
286,
442,
4990,
705,
220,
17,
575,
21,
19,
82,
198,
286,
1077,
1807,
82,
284,
1460,
486,
2015,
486,
30624,
3715,
340,
310,
659,
22769,
7,
16,
15,
340,
310,
659,
8819,
5194,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_chunks_mut_nth() {
let v: &mut [i32] = &mut [0, 1, 2, 3, 4, 5];
let mut c = v.array_chunks_mut::<2>();
assert_eq!(c.nth(1).unwrap(), &[2, 3]);
assert_eq!(c.next().unwrap(), &[4, 5]);
let v2: &mut [i32] = &mut [0, 1, 2, 3, 4, 5, 6];
let mut c2 = v2.array_chunks_mut::<3>();
assert_eq!(c2.nth(1).unwrap(), &[3, 4, 5]);
assert_eq!(c2.next(), None);
} | rust_cleaned_test_functions.jsonl/9651 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 223
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
65470,
29523,
78342,
368,
341,
262,
1077,
348,
25,
609,
6984,
508,
72,
18,
17,
60,
284,
609,
6984,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
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__write_raw_token() {
fn write_raw_token_toString(string : &str) -> GResult<String> {
let outRc : Rc<RefCell<String>> = Rc::new(RefCell::new(String::new()));
let result = TokenWriter { out: outRc.clone() }.write_raw_token(string);
match result {
Ok(_) => Ok(unwrap_Rc_RefCell(outRc)),
Err(error) => Err(error),
}
}
assert_eq!(write_raw_token_toString("blah").ok().unwrap(), r#"blah "#);
write_raw_token_toString("bl ah").unwrap_err();
write_raw_token_toString("bl{ah").unwrap_err();
} | rust_cleaned_test_functions.jsonl/128029 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 305
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
563,
4934,
16067,
6458,
368,
972,
6421,
262,
5168,
3270,
16067,
6458,
2346,
703,
3609,
549,
609,
495,
8,
1464,
479,
2077,
3464,
29,
972,
286,
1077,
700,
49,
66,
549,
81463,
27,
3945,
3599,
346... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_report_filter_next() {
let subcommand = Subcommand::Report {
filter: Filter {
conditions: vec![Condition::IdList(vec![
TaskId::WorkingSetId(12),
TaskId::WorkingSetId(13),
])],
},
report_name: "next".to_owned(),
};
assert_eq!(
Subcommand::parse(argv!["12,13"]).unwrap(),
(&EMPTY[..], subcommand)
);
} | rust_cleaned_test_functions.jsonl/84286 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 281
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14813,
8727,
11257,
368,
341,
286,
1077,
1186,
5631,
284,
3719,
5631,
486,
10361,
341,
310,
4051,
25,
12339,
341,
394,
4682,
25,
7486,
20703,
10547,
486,
764,
852,
25592,
90515,
503,
5430,
764,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_analyze_column() {
let data = vec![
(1, Some("name:0"), 2),
(2, Some("name:4"), 3),
(4, Some("name:3"), 1),
(5, None, 4),
];
let product = ProductTable::new();
let (_, mut end_point) = init_data_with_commit(&product, &data, true);
let req = new_analyze_column_req(&product.table, 3, 3, 3, 4, 32);
let resp = handle_request(&end_point, req);
assert!(!resp.get_data().is_empty());
let mut analyze_resp = AnalyzeColumnsResp::new();
analyze_resp.merge_from_bytes(resp.get_data()).unwrap();
let hist = analyze_resp.get_pk_hist();
assert_eq!(hist.get_buckets().len(), 2);
assert_eq!(hist.get_ndv(), 4);
let collectors = analyze_resp.get_collectors().to_vec();
assert_eq!(
collectors.len(),
product.table.get_table_columns().len() - 1
);
assert_eq!(collectors[0].get_null_count(), 1);
assert_eq!(collectors[0].get_count(), 3);
let rows = collectors[0].get_cm_sketch().get_rows();
assert_eq!(rows.len(), 4);
let sum: u32 = rows.first().unwrap().get_counters().iter().sum();
assert_eq!(sum, 3);
end_point.stop().unwrap().join().unwrap();
} | rust_cleaned_test_functions.jsonl/56301 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 519
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12008,
55856,
8744,
368,
341,
262,
1077,
821,
284,
7486,
90515,
286,
320,
16,
11,
4329,
445,
606,
25,
15,
3975,
220,
17,
1326,
286,
320,
17,
11,
4329,
445,
606,
25,
19,
3975,
220,
18,
1326,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_u64() {
let cases = vec![
("12345", Res::Ok(12345u64)),
("0", Res::Ok(0)),
// ULLONG_MAX = 18446744073709551615ULL
("18446744073709551615", Res::Ok(18446744073709551615)),
("18446744073709551616", Res::Overflow(18446744073709551615)),
("-1", Res::Overflow(0)),
("1.23", Res::Truncated(1)),
(
"9999999999999999999999999.000",
Res::Overflow(18446744073709551615),
),
];
for (dec_str, exp) in cases {
let dec: Decimal = dec_str.parse().unwrap();
let i = dec.as_u64();
assert_eq!(i, exp);
}
} | rust_cleaned_test_functions.jsonl/13655 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 428
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
7300,
21,
19,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
3489,
16,
17,
18,
19,
20,
497,
1800,
486,
11578,
7,
16,
17,
18,
19,
20,
84,
21,
19,
6965,
310,
3489,
15,
497,
1800,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_validate_instruction_inserts_new_keys_if_they_do_not_exist() {
let mut test_hash: HashMap<String, i32> = HashMap::new();
validate_instruction(&mut test_hash, "foo", "<", 10);
assert_eq!(&(0 as i32), test_hash.get("foo").unwrap());
} | rust_cleaned_test_functions.jsonl/42001 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
54923,
17678,
82,
5921,
12631,
11119,
5854,
1195,
26309,
7913,
35906,
368,
341,
286,
1077,
5206,
1273,
8950,
25,
10528,
3464,
11,
600,
18,
17,
29,
284,
10528,
486,
931,
1428,
286,
9593,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_empty_initialize() {
let mut server = new_temp_server();
let tmp_dir = TempDir::new("mcshader").unwrap();
let tmp_path = tmp_dir.path();
let initialize_params = InitializeParams {
process_id: None,
root_path: None,
root_uri: Some(Url::from_directory_path(tmp_path).unwrap()),
client_info: None,
initialization_options: None,
capabilities: ClientCapabilities {
workspace: None,
text_document: None,
experimental: None,
window: None,
general: Option::None,
},
trace: None,
workspace_folders: None,
locale: Option::None,
};
let on_response = |resp: Option<Response>| {
assert!(resp.is_some());
let respu = resp.unwrap();
match respu.result_or_error {
ResponseResult::Result(_) => {}
ResponseResult::Error(e) => {
panic!("expected ResponseResult::Result(..), got {:?}", e)
}
}
};
let completable = MethodCompletable::new(ResponseCompletable::new(
Some(Id::Number(1)),
Box::new(on_response),
));
server.initialize(initialize_params, completable);
assert_eq!(server.root, tmp_path);
assert_eq!(server.graph.borrow().graph.edge_count(), 0);
assert_eq!(server.graph.borrow().graph.node_count(), 0);
assert_eq!(format!("{:?}", server.wait), "WaitGroup { count: 1 }");
server.endpoint.request_shutdown();
} | rust_cleaned_test_functions.jsonl/56150 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 682
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
40889,
368,
341,
262,
1077,
5206,
3538,
284,
501,
11771,
12015,
1428,
262,
1077,
4174,
4334,
284,
19944,
6184,
486,
931,
445,
12887,
45534,
1827,
15454,
543,
262,
1077,
4174,
2638,
284,
417... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_runtime_update_net_rate_limiters() {
let req = VmmAction::UpdateNetworkInterface(NetworkInterfaceUpdateConfig {
iface_id: String::new(),
rx_rate_limiter: None,
tx_rate_limiter: None,
});
check_runtime_request(req, |result, vmm| {
assert_eq!(result, Ok(VmmData::Empty));
assert!(vmm.update_net_rate_limiters_called)
});
let req = VmmAction::UpdateNetworkInterface(NetworkInterfaceUpdateConfig {
iface_id: String::new(),
rx_rate_limiter: None,
tx_rate_limiter: None,
});
check_runtime_request_err(
req,
VmmActionError::NetworkConfig(NetworkInterfaceError::DeviceUpdate(
VmmError::DeviceManager(crate::device_manager::mmio::Error::IncorrectDeviceType),
)),
);
} | rust_cleaned_test_functions.jsonl/44547 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 433
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33232,
8882,
19722,
9246,
14763,
388,
368,
341,
286,
1077,
4232,
284,
647,
3821,
2512,
486,
4289,
12320,
5051,
77623,
5051,
4289,
2648,
341,
310,
49313,
842,
25,
923,
486,
931,
3148,
310,
19111,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_frontiers_action() {
let expect = Rc::new(RefCell::new(Antichain::from_elem(0)));
let inner = Rc::clone(&expect);
let (f, initial) = Frontiers::new(Some(0), None, move |since| {
assert_eq!(*inner.borrow(), since);
});
// Adding 5 should not change the since.
let h1 = f.since_handle(vec![5u64]);
assert_eq!(f.since.borrow().frontier().to_owned(), *expect.borrow());
expect.replace(Antichain::from_elem(5));
drop(initial);
assert_eq!(f.since.borrow().frontier().to_owned(), *expect.borrow());
expect.replace(Antichain::new());
drop(h1);
assert_eq!(f.since.borrow().frontier().to_owned(), *expect.borrow());
} | rust_cleaned_test_functions.jsonl/63471 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 369
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22926,
4813,
7931,
368,
341,
286,
1077,
1720,
284,
81463,
486,
931,
7,
3945,
3599,
486,
931,
4346,
406,
713,
466,
486,
1499,
28179,
7,
15,
4945,
286,
1077,
9179,
284,
81463,
486,
19982,
2099,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_nullable_array_is_not_null() {
let a = Int32Array::from(vec![Some(1), None, Some(3), None]);
let res = is_not_null(&a).unwrap();
let expected = BooleanArray::from(vec![true, false, true, false]);
assert_eq!(expected, res);
assert_eq!(&None, res.data_ref().null_bitmap());
} | rust_cleaned_test_functions.jsonl/45028 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 155
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
69743,
3858,
6892,
7913,
15162,
368,
341,
286,
1077,
264,
284,
1333,
18,
17,
1857,
486,
1499,
25592,
20703,
8373,
7,
16,
701,
2240,
11,
4329,
7,
18,
701,
2240,
10149,
286,
1077,
592,
284,
374,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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!(part_1(&SHORT), 7 * 5);
assert_eq!(part_1(&LONG), 22 * 10);
} | rust_cleaned_test_functions.jsonl/72667 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 72
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10495,
62,
16,
368,
341,
286,
2060,
10714,
10297,
4480,
62,
16,
2099,
87918,
701,
220,
22,
353,
220,
20,
317,
286,
2060,
10714,
10297,
4480,
62,
16,
2099,
51306,
701,
220,
17,
17,
353,
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 |
#[test]
fn test_headers() {
let mut component = TableComponent::new(KeyConfig::default());
component.headers = vec!["a", "b", "c"].iter().map(|h| h.to_string()).collect();
assert_eq!(component.headers(1, 2), vec!["", "b"])
} | rust_cleaned_test_functions.jsonl/120814 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 113
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26719,
368,
341,
286,
1077,
5206,
3692,
284,
6633,
2189,
486,
931,
21358,
2648,
486,
2258,
1423,
286,
3692,
18022,
284,
7486,
0,
1183,
64,
497,
330,
65,
497,
330,
66,
5521,
2015,
1005,
2186,
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_2_elements() {
let mut b = BitVec::from_elem(2, false);
b.set(0, true);
b.set(1, false);
assert_eq!(format!("{:?}", b), "10");
assert!(!b.none() && !b.all());
} | rust_cleaned_test_functions.jsonl/62077 | {
"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,
62,
17,
22801,
368,
341,
286,
1077,
5206,
293,
284,
6495,
10050,
486,
1499,
28179,
7,
17,
11,
895,
317,
286,
293,
980,
7,
15,
11,
830,
317,
286,
293,
980,
7,
16,
11,
895,
317,
286,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_from_signature() {
let multiplier = Big::new_int(5);
let mut point = GroupG2::generator();
point = point.mul(&multiplier);
let signature = Signature { point };
let aggregate_signature = AggregateSignature::from_signature(&signature);
assert_eq!(signature.point, aggregate_signature.point);
} | rust_cleaned_test_functions.jsonl/112224 | {
"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,
5673,
39859,
368,
341,
286,
1077,
30559,
284,
6164,
486,
931,
4042,
7,
20,
317,
286,
1077,
5206,
1459,
284,
5737,
38,
17,
486,
35851,
543,
286,
1459,
284,
1459,
53141,
2099,
26268,
7875,
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_missing_option_field() {
#[derive(Debug, PartialEq, Deserialize)]
struct Foo {
x: Option<u32>,
}
let value: Foo = from_str("{}").unwrap();
assert_eq!(value, Foo { x: None });
let value: Foo = from_str("{\"x\": 5}").unwrap();
assert_eq!(value, Foo { x: Some(5) });
let value: Foo = from_value(json!({})).unwrap();
assert_eq!(value, Foo { x: None });
let value: Foo = from_value(json!({"x": 5})).unwrap();
assert_eq!(value, Foo { x: Some(5) });
} | rust_cleaned_test_functions.jsonl/29847 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 231
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40447,
9672,
5013,
368,
341,
262,
11506,
27098,
42618,
11,
55039,
11,
48440,
5563,
262,
2036,
33428,
341,
286,
856,
25,
6959,
34837,
18,
17,
12520,
262,
555,
262,
1077,
897,
25,
33428,
284,
504,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_info_event_complete_connect() {
let exec = fuchsia_async::TestExecutor::new().unwrap();
let (mut sme, _mlme_stream, mut info_stream, _time_stream) = create_sme(&exec);
assert_eq!(ClientSmeStatus::Idle, sme.status());
let credential = fidl_sme::Credential::None(fidl_sme::Empty);
let bss_description =
fake_fidl_bss_description!(Open, ssid: Ssid::try_from("bssname").unwrap());
let bssid = Bssid(bss_description.bssid);
let mut req = connect_req(Ssid::try_from("bssname").unwrap(), bss_description, credential);
req.multiple_bss_candidates = false;
let _connect_fut = sme.on_connect_command(req);
sme.on_mlme_event(create_join_conf(fidl_ieee80211::StatusCode::Success));
sme.on_mlme_event(create_auth_conf(bssid, fidl_ieee80211::StatusCode::Success));
sme.on_mlme_event(create_assoc_conf(fidl_ieee80211::StatusCode::Success));
assert_variant!(info_stream.try_next(), Ok(Some(InfoEvent::ConnectionPing(..))));
assert_variant!(info_stream.try_next(), Ok(Some(InfoEvent::ConnectStats(stats))) => {
assert!(stats.auth_time().is_some());
assert!(stats.assoc_time().is_some());
assert!(stats.rsna_time().is_none());
assert!(stats.connect_time().into_nanos() > 0);
assert_variant!(stats.result, ConnectResult::Success);
assert_variant!(stats.candidate_network, Some(candidate_network) => {
assert!(!candidate_network.multiple_bss_candidates);
});
assert!(stats.previous_disconnect_info.is_none());
});
} | rust_cleaned_test_functions.jsonl/101629 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 757
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3109,
6748,
27675,
15720,
368,
341,
286,
1077,
3883,
284,
282,
73391,
28346,
486,
2271,
25255,
486,
931,
1005,
15454,
543,
286,
1077,
320,
6984,
90467,
11,
716,
1014,
2660,
12673,
11,
5206,
3546,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cp_strip_trailing_slashes() {
let (at, mut ucmd) = at_and_ucmd!();
//using --strip-trailing-slashes option
ucmd.arg("--strip-trailing-slashes")
.arg(format!("{}/", TEST_HELLO_WORLD_SOURCE))
.arg(TEST_HELLO_WORLD_DEST)
.succeeds();
// Check the content of the destination file that was copied.
assert_eq!(at.read(TEST_HELLO_WORLD_DEST), "Hello, World!\n");
} | rust_cleaned_test_functions.jsonl/21266 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 198
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39811,
66130,
3547,
14277,
11886,
14051,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
1428,
262,
442,
970,
1177,
13105,
10188,
14277,
1331,
46545,
2999,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unset_env_var() {
std::env::remove_var("MYVAR2343u2");
block_on(assert_commands_error(
"echo $MYVAR2343u2 > /dev/null; echo okay; exec 1>&-; cat > /dev/null",
));
// variable set
std::env::set_var("MYVAR2343u2", "hehe");
block_on(assert_commands_okay(
"echo $MYVAR2343u2 > /dev/null; echo okay; exec 1>&-; cat > /dev/null",
));
} | rust_cleaned_test_functions.jsonl/86515 | {
"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,
98109,
15879,
4612,
368,
341,
262,
1460,
486,
3160,
486,
5399,
4612,
445,
19159,
33040,
17,
18,
19,
18,
84,
17,
797,
262,
2504,
4470,
75846,
44151,
4096,
1006,
286,
330,
3047,
400,
19159,
33040,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_node() {
let node_a = Node::new(1, "a_val".to_owned());
let node_b = Node::new(2, "b_val".to_owned());
let node_c = Node::new(1, "c_val".to_owned());
assert_eq!(node_a.cmp(&node_b.key), Ordering::Less);
assert_eq!(node_b.cmp(&node_a.key), Ordering::Greater);
assert_eq!(node_c.cmp(&node_a.key), Ordering::Equal);
} | rust_cleaned_test_functions.jsonl/65952 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 198
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5084,
368,
341,
286,
1077,
2436,
4306,
284,
6018,
486,
931,
7,
16,
11,
330,
64,
6189,
3263,
983,
51973,
1423,
286,
1077,
2436,
880,
284,
6018,
486,
931,
7,
17,
11,
330,
65,
6189,
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_wrap_with() {
let s = "some string";
let wrap = "|";
assert_eq!(wrap_with(s, wrap), String::from("|some string|"));
} | rust_cleaned_test_functions.jsonl/78036 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 84
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38550,
6615,
368,
341,
286,
1077,
274,
284,
330,
14689,
914,
876,
286,
1077,
15061,
284,
25203,
876,
286,
2060,
10714,
10297,
10097,
6615,
1141,
11,
15061,
701,
923,
486,
1499,
38547,
14689,
914,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_lines() {
let data = "\nMäry häd ä little lämb\n\r\nLittle lämb\n";
let lines: Vec<&str> = data.lines().collect();
assert_eq!(lines, ["", "Märy häd ä little lämb", "", "Little lämb"]);
let data = "\r\nMäry häd ä little lämb\n\nLittle lämb"; // no trailing \n
let lines: Vec<&str> = data.lines().collect();
assert_eq!(lines, ["", "Märy häd ä little lämb", "", "Little lämb"]);
} | rust_cleaned_test_functions.jsonl/17647 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18323,
368,
341,
262,
1077,
821,
284,
2917,
77,
44,
2305,
884,
305,
30875,
12709,
2632,
30005,
3096,
1699,
12016,
1699,
38103,
30005,
3096,
1699,
876,
262,
1077,
5128,
25,
11312,
52244,
495,
29,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_generate_c() {
let dwarf: &[u8] = include_bytes!("./test_resources/module_binding_test");
let expected: &[u8] = include_bytes!("./test_resources/module_binding_test_expected.c");
let module = Module::parse("user".to_owned(), "User module description".to_owned(), dwarf);
assert!(module.is_ok());
let module = module.unwrap();
let mut binding: Cursor<Vec<u8>> = Cursor::new(Vec::new());
let _ = generate_module(module, &mut binding);
assert_eq!(&*binding.into_inner(), expected);
} | rust_cleaned_test_functions.jsonl/89879 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 239
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
48851,
666,
368,
341,
286,
1077,
49461,
25,
44590,
84,
23,
60,
284,
2924,
12524,
0,
13988,
1944,
35569,
48185,
60815,
4452,
797,
286,
1077,
3601,
25,
44590,
84,
23,
60,
284,
2924,
12524,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ping_req() {
let mut data: &[u8] = &[0b11000000, 0b00000000];
assert_eq!(Ok(Some(Packet::Pingreq)), decode_slice(&mut data));
} | rust_cleaned_test_functions.jsonl/77900 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 72
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71661,
17644,
368,
341,
262,
1077,
5206,
821,
25,
44590,
84,
23,
60,
284,
44590,
15,
65,
16,
16,
15,
15,
15,
15,
15,
15,
11,
220,
15,
65,
15,
15,
15,
15,
15,
15,
15,
15,
935,
262,
2060... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_cowarc_clone_weak() {
let mut cow0 = Arc::new(75);
let cow1_weak = cow0.downgrade();
assert!(75 == *cow0);
assert!(75 == *cow1_weak.upgrade().unwrap());
*cow0.make_unique() += 1;
assert!(76 == *cow0);
assert!(cow1_weak.upgrade().is_none());
} | rust_cleaned_test_functions.jsonl/19210 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
363,
8198,
54742,
86356,
368,
341,
286,
1077,
5206,
19362,
15,
284,
19689,
486,
931,
7,
22,
20,
317,
286,
1077,
19362,
16,
86356,
284,
19362,
15,
18148,
6937,
1428,
286,
2060,
10297,
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_random_access_chain() {
let xs = [1, 2, 3, 4, 5];
let ys = [7, 9, 11];
let mut it = xs.iter().chain(ys.iter());
assert_eq!(it.idx(0).unwrap(), &1);
assert_eq!(it.idx(5).unwrap(), &7);
assert_eq!(it.idx(7).unwrap(), &11);
assert!(it.idx(8).is_none());
it.next();
it.next();
it.next_back();
assert_eq!(it.idx(0).unwrap(), &3);
assert_eq!(it.idx(4).unwrap(), &9);
assert!(it.idx(6).is_none());
check_randacc_iter(it, xs.len() + ys.len() - 3);
} | rust_cleaned_test_functions.jsonl/37038 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 275
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22644,
12759,
30583,
368,
341,
262,
1077,
11943,
284,
508,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
262,
1077,
31810,
284,
508,
22,
11,
220,
24,
11,
220,
16,
16,
935,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_dec_lit_pos_exp() {
let d = Decimal::<1>::from_str("700004.002E13").unwrap();
assert_eq!(d.coeff, 70000400200000000000);
} | rust_cleaned_test_functions.jsonl/12022 | {
"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,
5673,
13783,
98399,
6479,
14214,
368,
341,
286,
1077,
294,
284,
26728,
27638,
16,
6831,
1499,
2895,
445,
22,
15,
15,
15,
15,
19,
13,
15,
15,
17,
36,
16,
18,
1827,
15454,
543,
286,
2060,
1071... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_merge_desc_from_release_branch() {
let desc = make_merge_desc(
(String::from("Yay, I made a change (#99)"), String::from("")),
"abcdef",
99,
"release-other_branch",
"release-source_branch",
"release-",
);
assert_eq!(desc.0, "source_branch->other_branch: Yay, I made a change");
assert_eq!(desc.1, "(cherry-picked from abcdef, PR #99)");
} | rust_cleaned_test_functions.jsonl/93154 | {
"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,
28230,
20888,
10986,
5673,
24577,
28031,
368,
341,
286,
1077,
6560,
284,
1281,
20888,
10986,
1006,
310,
320,
703,
486,
1499,
445,
56,
352,
11,
358,
1865,
264,
2297,
29083,
24,
24,
8,
3975,
923,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_called_numbers() {
let expected = vec![7, 4, 9, 5, 11, 17, 23, 2, 0, 14, 21, 24, 10, 16, 13, 6, 15, 25, 12,
22, 18, 20, 8, 19, 3, 26, 1
];
let mut input = TEST_INPUT.lines();
assert_eq!(parse_called_numbers(&mut input.next().unwrap()), expected);
} | rust_cleaned_test_functions.jsonl/92171 | {
"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,
21039,
27859,
32964,
368,
341,
286,
1077,
3601,
284,
7486,
20703,
22,
11,
220,
19,
11,
220,
24,
11,
220,
20,
11,
220,
16,
16,
11,
220,
16,
22,
11,
220,
17,
18,
11,
220,
17,
11,
220,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_date_math_start_with_periods() {
let result = DateMath::StartWithPeriods(
CalculatedDate::Raw(NaiveDate::from_ymd_opt(2021, 3, 31).unwrap()),
PeriodOp::Add(Period::Week(15)),
vec![
PeriodOp::Add(Period::Day(2)),
PeriodOp::Subtract(Period::Day(1)),
],
)
.compute();
assert_eq!(result, NaiveDate::from_ymd(2021, 7, 15));
} | rust_cleaned_test_functions.jsonl/43993 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 253
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4164,
65561,
4906,
6615,
95193,
368,
341,
286,
1077,
1102,
284,
2631,
8815,
486,
3479,
2354,
23750,
82,
1006,
310,
31359,
657,
1916,
486,
20015,
8204,
64,
533,
1916,
486,
1499,
62,
1600,
67,
150... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_highlighting_cancellation() {
// An HTML document with a large injected JavaScript document:
let mut source = "<script>\n".to_string();
for _ in 0..500 {
source += "function a() { console.log('hi'); }\n";
}
source += "</script>\n";
// Cancel the highlighting before parsing the injected document.
let cancellation_flag = AtomicUsize::new(0);
let injection_callback = |name: &str| {
cancellation_flag.store(1, Ordering::SeqCst);
test_language_for_injection_string(name)
};
// should not fail.
let highlighter = highlight(
source.as_bytes(),
get_language("html"),
&HTML_SHEET,
Some(&cancellation_flag),
injection_callback,
)
.unwrap();
// Iterating the scopes should not panic. It should return an error
// once the cancellation is detected.
for event in highlighter {
if let Err(e) = event {
assert_eq!(e, Error::Cancelled);
return;
}
}
panic!("Expected an error while iterating highlighter");
} | rust_cleaned_test_functions.jsonl/12262 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 448
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74546,
287,
666,
49222,
368,
341,
262,
442,
1527,
9308,
2197,
448,
264,
3460,
40672,
12914,
2197,
510,
262,
1077,
5206,
2530,
284,
4055,
2282,
8449,
77,
3263,
983,
3904,
543,
262,
369,
716,
304,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_pipeline_transaction() {
let ctx = TestContext::new();
block_on_all(async move {
let mut con = ctx.async_connection().await?;
let mut pipe = redis::pipe();
pipe.atomic()
.cmd("SET")
.arg("key_1")
.arg(42)
.ignore()
.cmd("SET")
.arg("key_2")
.arg(43)
.ignore()
.cmd("MGET")
.arg(&["key_1", "key_2"]);
pipe.query_async(&mut con)
.map_ok(|((k1, k2),): ((i32, i32),)| {
assert_eq!(k1, 42);
assert_eq!(k2, 43);
})
.await
})
.unwrap();
} | rust_cleaned_test_functions.jsonl/75329 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 430
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45187,
28884,
368,
341,
262,
1077,
5635,
284,
3393,
1972,
486,
931,
543,
262,
2504,
4470,
5705,
18285,
3271,
341,
286,
1077,
5206,
390,
284,
5635,
24747,
15866,
1005,
11421,
37445,
286,
1077,
5206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_write_var_uint_three_byte_values() -> IonResult<()> {
var_uint_encoding_test(81_991, &[0b0000_0101, 0b0000_0000, 0b1100_0111])?;
var_uint_encoding_test(400_600, &[0b0001_1000, 0b0011_1001, 0b1101_1000])?;
Ok(())
} | rust_cleaned_test_functions.jsonl/116135 | {
"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,
9165,
4612,
15807,
50016,
19737,
9146,
368,
1464,
44805,
2077,
71698,
341,
286,
762,
15807,
37613,
4452,
7,
23,
16,
62,
24,
24,
16,
11,
44590,
15,
65,
15,
15,
15,
15,
62,
15,
16,
15,
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... | 3 |
#[test]
fn test_merkle_path() {
let mut tree = TestSMT::new(3);
tree.insert(2, 1);
let path = tree.merkle_path(2);
assert_eq!(path, [(32768, false), (917505, true), (25690142, false)]);
} | rust_cleaned_test_functions.jsonl/88491 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 129
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
16754,
273,
2638,
368,
341,
286,
1077,
5206,
4916,
284,
3393,
50,
8505,
486,
931,
7,
18,
317,
286,
4916,
7030,
7,
17,
11,
220,
16,
317,
286,
1077,
1815,
284,
4916,
744,
16754,
273,
2638... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_kill2() {
let mut child = Command::new("perl").arg("-e").arg(SCRIPT).spawn().unwrap();
let mut reader = ProcReader::from_stdout(child.id());
thread::sleep(Duration::from_secs(2));
let _ = child.kill();
thread::sleep(Duration::from_secs(2));
let mut buf = [0; 10];
let ret = reader.read_exact(&mut buf);
assert_eq!(
&format!("{:?}", ret)[0..60],
"Err(Custom { kind: UnexpectedEof, error: \"failed to fill who"
);
} | rust_cleaned_test_functions.jsonl/127262 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 258
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73327,
17,
368,
341,
286,
1077,
5206,
1682,
284,
7348,
486,
931,
445,
64936,
1827,
858,
13645,
68,
1827,
858,
7,
24787,
568,
46087,
1005,
15454,
543,
286,
1077,
5206,
6604,
284,
41087,
5062,
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_closures_2() {
check_output_default(
"fun mkfun(n) {\n\
fun f(m) {\n\
return m + n;\n\
}\n\
return f;\n\
}\n\
print mkfun(2)(3);",
"5",
)
} | rust_cleaned_test_functions.jsonl/111846 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 216
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
41206,
62,
17,
368,
341,
286,
1779,
7645,
9993,
1006,
310,
330,
11894,
23789,
11894,
1445,
8,
28152,
77,
5661,
2290,
2464,
282,
1255,
8,
28152,
77,
5661,
338,
470,
296,
488,
308,
17882,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lang_string_parse() {
fn t(s: &str,
should_panic: bool, no_run: bool, ignore: bool, rust: bool, test_harness: bool,
compile_fail: bool, allow_fail: bool, error_codes: Vec<String>) {
assert_eq!(LangString::parse(s), LangString {
should_panic,
no_run,
ignore,
rust,
test_harness,
compile_fail,
error_codes,
original: s.to_owned(),
allow_fail,
})
}
fn v() -> Vec<String> {
Vec::new()
}
// marker | should_panic| no_run| ignore| rust | test_harness| compile_fail
// | allow_fail | error_codes
t("", false, false, false, true, false, false, false, v());
t("rust", false, false, false, true, false, false, false, v());
t("sh", false, false, false, false, false, false, false, v());
t("ignore", false, false, true, true, false, false, false, v());
t("should_panic", true, false, false, true, false, false, false, v());
t("no_run", false, true, false, true, false, false, false, v());
t("test_harness", false, false, false, true, true, false, false, v());
t("compile_fail", false, true, false, true, false, true, false, v());
t("allow_fail", false, false, false, true, false, false, true, v());
t("{.no_run .example}", false, true, false, true, false, false, false, v());
t("{.sh .should_panic}", true, false, false, false, false, false, false, v());
t("{.example .rust}", false, false, false, true, false, false, false, v());
t("{.test_harness .rust}", false, false, false, true, true, false, false, v());
t("text, no_run", false, true, false, false, false, false, false, v());
t("text,no_run", false, true, false, false, false, false, false, v());
} | rust_cleaned_test_functions.jsonl/4180 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1250
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17876,
3904,
21039,
368,
341,
286,
5168,
259,
1141,
25,
609,
495,
345,
310,
1265,
620,
31270,
25,
1807,
11,
902,
14007,
25,
1807,
11,
10034,
25,
1807,
11,
23071,
25,
1807,
11,
1273,
1523,
2351... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_for_loop_with_negative_step_minus_one() {
let input = "
FOR i% = 3 TO -3 STEP -1
PRINT i%
NEXT
";
let interpreter = interpret(input);
assert_has_variable!(interpreter, "i%", -4);
let stdlib = interpreter.stdlib;
assert_eq!(stdlib.output, vec!["3", "2", "1", "0", "-1", "-2", "-3"]);
} | rust_cleaned_test_functions.jsonl/109182 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5478,
17198,
6615,
53865,
11946,
38457,
11667,
368,
341,
286,
1077,
1946,
284,
6228,
286,
4613,
600,
4,
284,
220,
18,
5146,
481,
18,
48356,
481,
16,
198,
310,
35893,
600,
13744,
286,
45011,
198,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_malformed_resource() {
// Compile the modules and scripts.
// TODO: find a better way to include the Signer module.
let code = r#"
address 0x1 {
module Signer {
native public fun borrow_address(s: &signer): &address;
public fun address_of(s: &signer): address {
*borrow_address(s)
}
}
}
module {{ADDR}}::M {
use 0x1::Signer;
struct Foo has key { x: u64, y: bool }
public fun publish(s: &signer) {
move_to(s, Foo { x: 123, y : false });
}
public fun check(s: &signer) acquires Foo {
let foo = borrow_global<Foo>(Signer::address_of(s));
assert(foo.x == 123 && foo.y == false, 42);
}
}
script {
use {{ADDR}}::M;
fun main(s: signer) {
M::publish(&s);
}
}
script {
use {{ADDR}}::M;
fun main(s: signer) {
M::check(&s);
}
}
"#;
let code = code.replace("{{ADDR}}", &format!("0x{}", TEST_ADDR.to_string()));
let mut units = compile_units(&code).unwrap();
let s2 = as_script(units.pop().unwrap());
let s1 = as_script(units.pop().unwrap());
let m = as_module(units.pop().unwrap());
let ms = as_module(units.pop().unwrap());
let mut storage = InMemoryStorage::new();
// Publish module Signer and module M.
let mut blob = vec![];
ms.serialize(&mut blob).unwrap();
storage.publish_or_overwrite_module(ms.self_id(), blob);
let mut blob = vec![];
m.serialize(&mut blob).unwrap();
storage.publish_or_overwrite_module(m.self_id(), blob);
let vm = MoveVM::new(move_stdlib::natives::all_natives(
AccountAddress::from_hex_literal("0x1").unwrap(),
))
.unwrap();
let mut gas_status = GasStatus::new_unmetered();
// Execute the first script to publish a resource Foo.
let mut script_blob = vec![];
s1.serialize(&mut script_blob).unwrap();
let mut sess = vm.new_session(&storage);
sess.execute_script(
script_blob,
vec![],
vec![],
vec![TEST_ADDR],
&mut gas_status,
)
.unwrap();
let (changeset, _) = sess.finish().unwrap();
storage.apply(changeset).unwrap();
// Execut the second script and make sure it succeeds. This script simply checks
// that the published resource is what we expect it to be. This inital run is to ensure
// the testing environment is indeed free of errors without external interference.
let mut script_blob = vec![];
s2.serialize(&mut script_blob).unwrap();
{
let mut sess = vm.new_session(&storage);
sess.execute_script(
script_blob.clone(),
vec![],
vec![],
vec![TEST_ADDR],
&mut gas_status,
)
.unwrap();
}
// Corrupt the resource in the storage.
storage.publish_or_overwrite_resource(
TEST_ADDR,
StructTag {
address: TEST_ADDR,
module: Identifier::new("M").unwrap(),
name: Identifier::new("Foo").unwrap(),
type_params: vec![],
},
vec![0x3, 0x4, 0x5],
);
// Run the second script again.
// The test will be successful if it fails with an invariant violation.
{
let mut sess = vm.new_session(&storage);
let err = sess
.execute_script(
script_blob,
vec![],
vec![],
vec![TEST_ADDR],
&mut gas_status,
)
.unwrap_err();
assert_eq!(err.status_type(), StatusType::InvariantViolation);
}
} | rust_cleaned_test_functions.jsonl/48431 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1883
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
278,
10155,
17962,
368,
341,
262,
442,
54467,
279,
13454,
323,
19502,
624,
262,
442,
5343,
25,
1477,
264,
2664,
1616,
311,
2924,
279,
7075,
261,
4688,
624,
262,
1077,
2038,
284,
435,
2,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_new_dirty_with_name_continue() {
for answer in YES_ANSWERS {
Tester::default()
.add_input_chars("modified named file\n")
.add_input_chars(answer)
.set_program(Some("MEMORY:/named.bas"), "previous contents\n")
.run("EDIT: NEW")
.expect_prints(["Current program MEMORY:/named.bas has unsaved changes!"])
.expect_clear()
.check();
}
} | rust_cleaned_test_functions.jsonl/112754 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 268
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
63642,
6615,
1269,
75297,
368,
341,
286,
369,
4226,
304,
14080,
67752,
54,
4321,
341,
310,
76816,
486,
2258,
741,
394,
659,
718,
5898,
37418,
445,
27162,
6941,
1034,
1699,
1138,
394,
659,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_read_linux_numa() {
let cpus = read_linux_numa().unwrap();
assert_eq!(cpus.iter().map(|x| x.len()).sum::<usize>(), num_cpus::get());
} | rust_cleaned_test_functions.jsonl/101114 | {
"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,
6443,
77463,
4273,
64,
368,
341,
286,
1077,
12490,
355,
284,
1349,
77463,
4273,
64,
1005,
15454,
543,
286,
2060,
10714,
10297,
4672,
355,
19471,
1005,
2186,
22428,
87,
91,
856,
19406,
6011,
1242,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_scaffold_intersections() {
let space: Space = indoc!(
"
..#..........
..#..........
#######...###
#.#...#...#.#
#############
..#...#...#..
..#####...^.."
)
.parse()
.unwrap();
assert_eq!(space.scaffold_alignment_parameters().sum::<usize>(), 76);
} | rust_cleaned_test_functions.jsonl/109682 | {
"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,
643,
27864,
15318,
24661,
368,
341,
286,
1077,
3550,
25,
11487,
284,
1257,
509,
33673,
310,
6228,
310,
5241,
2,
4007,
33947,
310,
5241,
2,
4007,
33947,
310,
26274,
14374,
1112,
26840,
310,
671,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_loc_query_dialogues() {
let querier = new_valid_db("comp_query_dialogues.db");
let dialogues =
querier.query_dialogues(None, None, Some("kitchen"), None);
assert_eq!(2, dialogues.len());
} | rust_cleaned_test_functions.jsonl/107705 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 120
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13400,
5738,
24331,
1137,
368,
341,
286,
1077,
29134,
1268,
284,
501,
8337,
8685,
445,
5689,
5738,
24331,
1137,
7076,
3071,
286,
1077,
7254,
1137,
4035,
310,
29134,
1268,
4786,
24331,
1137,
26717,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_simple_monitor_permanent_update_fail() {
// Test that we handle a simple permanent monitor update failure
let chanmon_cfgs = create_chanmon_cfgs(2);
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);
create_announced_chan_between_nodes(&nodes, 0, 1, InitFeatures::known(), InitFeatures::known());
let (route, payment_hash_1, _, payment_secret_1) = get_route_and_payment_hash!(&nodes[0], nodes[1], 1000000);
chanmon_cfgs[0].persister.set_update_ret(Err(ChannelMonitorUpdateErr::PermanentFailure));
unwrap_send_err!(nodes[0].node.send_payment(&route, payment_hash_1, &Some(payment_secret_1)), true, APIError::ChannelUnavailable {..}, {});
check_added_monitors!(nodes[0], 2);
let events_1 = nodes[0].node.get_and_clear_pending_msg_events();
assert_eq!(events_1.len(), 2);
match events_1[0] {
MessageSendEvent::BroadcastChannelUpdate { .. } => {},
_ => panic!("Unexpected event"),
};
match events_1[1] {
MessageSendEvent::HandleError { node_id, .. } => assert_eq!(node_id, nodes[1].node.get_our_node_id()),
_ => panic!("Unexpected event"),
};
// TODO: Once we hit the chain with the failure transaction we should check that we get a
// PaymentPathFailed event
assert_eq!(nodes[0].node.list_channels().len(), 0);
check_closed_event!(nodes[0], 1, ClosureReason::ProcessingError { err: "ChannelMonitor storage failure".to_string() });
} | rust_cleaned_test_functions.jsonl/58333 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 557
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
40112,
620,
4753,
306,
8882,
22121,
368,
341,
197,
322,
3393,
429,
582,
3705,
264,
4285,
15330,
8718,
2647,
7901,
198,
10217,
26023,
1645,
18343,
82,
284,
1855,
45552,
1645,
18343,
82,
7,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_mod_examples() {
assert_eq!(eval("1 % 4"), Ok(Value::Int(1)));
assert_eq!(eval("6 % 4"), Ok(Value::Int(2)));
assert_eq!(eval("1 % 4 + 2"), Ok(Value::Int(3)));
} | rust_cleaned_test_functions.jsonl/105341 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7480,
45279,
368,
341,
262,
2060,
10714,
10297,
14170,
445,
16,
1018,
220,
19,
3975,
7622,
25346,
486,
1072,
7,
16,
4945,
262,
2060,
10714,
10297,
14170,
445,
21,
1018,
220,
19,
3975,
7622,
2534... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eval() {
assert_float_eq_f64(eval_str("2*3^2").unwrap(), 18.0);
assert_float_eq_f64(eval_str("-3^2").unwrap(), 9.0);
assert_float_eq_f64(eval_str("11.3").unwrap(), 11.3);
assert_float_eq_f64(eval_str("+11.3").unwrap(), 11.3);
assert_float_eq_f64(eval_str("-11.3").unwrap(), -11.3);
assert_float_eq_f64(eval_str("(-11.3)").unwrap(), -11.3);
assert_float_eq_f64(eval_str("11.3+0.7").unwrap(), 12.0);
assert_float_eq_f64(eval_str("31.3+0.7*2").unwrap(), 32.7);
assert_float_eq_f64(eval_str("1.3+0.7*2-1").unwrap(), 1.7);
assert_float_eq_f64(eval_str("1.3+0.7*2-1/10").unwrap(), 2.6);
assert_float_eq_f64(eval_str("(1.3+0.7)*2-1/10").unwrap(), 3.9);
assert_float_eq_f64(eval_str("1.3+(0.7*2)-1/10").unwrap(), 2.6);
assert_float_eq_f64(eval_str("1.3+0.7*(2-1)/10").unwrap(), 1.37);
assert_float_eq_f64(eval_str("1.3+0.7*(2-1/10)").unwrap(), 2.63);
assert_float_eq_f64(eval_str("-1*(1.3+0.7*(2-1/10))").unwrap(), -2.63);
assert_float_eq_f64(eval_str("-1*(1.3+(-0.7)*(2-1/10))").unwrap(), 0.03);
assert_float_eq_f64(eval_str("-1*((1.3+0.7)*(2-1/10))").unwrap(), -3.8);
assert_float_eq_f64(eval_str("sin(3.14159265358979)").unwrap(), 0.0);
assert_float_eq_f64(eval_str("0-sin(3.14159265358979 / 2)").unwrap(), -1.0);
assert_float_eq_f64(eval_str("-sin(3.14159265358979 / 2)").unwrap(), -1.0);
assert_float_eq_f64(eval_str("3-(-1+sin(1.5707963267948966)*2)").unwrap(), 2.0);
assert_float_eq_f64(
eval_str("3-(-1+sin(cos(-3.14159265358979))*2)").unwrap(),
5.6829419696157935,
);
assert_float_eq_f64(
eval_str("-(-1+((-3.14159265358979)/5)*2)").unwrap(),
2.256637061435916,
);
assert_float_eq_f64(eval_str("((2-4)/5)*2").unwrap(), -0.8);
assert_float_eq_f64(
eval_str("-(-1+(sin(-3.14159265358979)/5)*2)").unwrap(),
1.0,
);
assert_float_eq_f64(
eval_str("-(-1+sin(cos(-3.14159265358979)/5)*2)").unwrap(),
1.3973386615901224,
);
assert_float_eq_f64(eval_str("-cos(3.14159265358979)").unwrap(), 1.0);
assert_float_eq_f64(
eval_str("1+sin(-cos(-3.14159265358979))").unwrap(),
1.8414709848078965,
);
assert_float_eq_f64(
eval_str("-1+sin(-cos(-3.14159265358979))").unwrap(),
-0.1585290151921035,
);
assert_float_eq_f64(
eval_str("-(-1+sin(-cos(-3.14159265358979)/5)*2)").unwrap(),
0.6026613384098776,
);
assert_float_eq_f64(eval_str("sin(-(2))*2").unwrap(), -1.8185948536513634);
assert_float_eq_f64(eval_str("sin(sin(2))*2").unwrap(), 1.5781446871457767);
assert_float_eq_f64(eval_str("sin(-(sin(2)))*2").unwrap(), -1.5781446871457767);
assert_float_eq_f64(eval_str("-sin(2)*2").unwrap(), -1.8185948536513634);
assert_float_eq_f64(eval_str("sin(-sin(2))*2").unwrap(), -1.5781446871457767);
assert_float_eq_f64(eval_str("sin(-sin(2)^2)*2").unwrap(), 1.4715655294841483);
assert_float_eq_f64(
eval_str("sin(-sin(2)*-sin(2))*2").unwrap(),
1.4715655294841483,
);
assert_float_eq_f64(eval_str("--(1)").unwrap(), 1.0);
assert_float_eq_f64(eval_str("--1").unwrap(), 1.0);
assert_float_eq_f64(eval_str("----1").unwrap(), 1.0);
assert_float_eq_f64(eval_str("---1").unwrap(), -1.0);
assert_float_eq_f64(eval_str("3-(4-2/3+(1-2*2))").unwrap(), 2.666666666666666);
assert_float_eq_f64(
eval_str("log(log(2))*tan(2)+exp(1.5)").unwrap(),
5.2825344122094045,
);
assert_float_eq_f64(
eval_str("log(log2(2))*tan(2)+exp(1.5)").unwrap(),
4.4816890703380645,
);
assert_float_eq_f64(eval_str("log2(2)").unwrap(), 1.0);
assert_float_eq_f64(eval_str("2^log2(2)").unwrap(), 2.0);
assert_float_eq_f64(eval_str("2^(cos(0)+2)").unwrap(), 8.0);
assert_float_eq_f64(eval_str("2^cos(0)+2").unwrap(), 4.0);
} | rust_cleaned_test_functions.jsonl/66725 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2382
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21296,
368,
341,
286,
2060,
17586,
10714,
761,
21,
19,
54463,
2895,
445,
17,
9,
18,
61,
17,
1827,
15454,
1507,
220,
16,
23,
13,
15,
317,
286,
2060,
17586,
10714,
761,
21,
19,
54463,
2895,
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_emit_and_read_records() {
let mut message = Message::new();
message
.set_id(10)
.set_message_type(MessageType::Response)
.set_op_code(OpCode::Update)
.set_authoritative(true)
.set_truncated(true)
.set_recursion_desired(true)
.set_recursion_available(true)
.set_authentic_data(true)
.set_checking_disabled(true)
.set_response_code(ResponseCode::ServFail);
message.add_answer(Record::new());
message.add_name_server(Record::new());
message.add_additional(Record::new());
message.update_counts();
test_emit_and_read(message);
} | rust_cleaned_test_functions.jsonl/23870 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 297
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
69082,
8378,
6443,
31279,
368,
341,
262,
1077,
5206,
1943,
284,
4856,
486,
931,
543,
262,
1943,
198,
286,
659,
746,
842,
7,
16,
15,
340,
286,
659,
746,
6462,
1819,
29359,
929,
486,
2582,
340,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_datetime() {
let datetime = Datetime(blpapi_Datetime_t {
parts: BLPAPI_DATETIME_DATE_PART as u8 | BLPAPI_DATETIME_TIME_PART as u8,
hours: 8,
minutes: 5,
seconds: 10,
milliSeconds: 0,
month: 1,
day: 1,
year: 2020,
offset: 0,
});
assert_eq!(
datetime.clone().try_into(),
Ok(NaiveDate::from_ymd(2020, 1, 1))
);
assert_eq!(
datetime.clone().try_into(),
Ok(NaiveTime::from_hms(8, 5, 10))
);
assert_eq!(
datetime.clone().try_into(),
Ok(NaiveDateTime::new(NaiveDate::from_ymd(2020, 1, 1), NaiveTime::from_hms(8, 5, 10)))
);
assert_eq!(
TryInto::<Date<FixedOffset>>::try_into(datetime.clone()),
Err(ChronoConversionError::MissingParts)
);
assert_eq!(
TryInto::<DateTime<FixedOffset>>::try_into(datetime.clone()),
Err(ChronoConversionError::MissingParts)
);
} | rust_cleaned_test_functions.jsonl/117270 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 759
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28943,
368,
341,
310,
1077,
8874,
284,
21631,
4107,
1883,
13545,
2068,
1557,
27662,
528,
341,
394,
5479,
25,
425,
12567,
7082,
36347,
44618,
18500,
28278,
438,
575,
23,
760,
425,
12567,
7082,
3634... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_package_manifest_not_exist() -> Result<()> {
let tempdir = tempfile::tempdir().unwrap();
let root = tempdir.path();
let build_manifest_path = root.join("build.manifest");
let package_manifest_path = Some(root.join("./out"));
File::create(&build_manifest_path).unwrap();
let cmd = BuildCommand {
build_manifest_path,
package_manifest_path,
out: PathBuf::from("./out"),
published_name: String::from("package"),
};
assert!(cmd_package_build(cmd).is_err());
Ok(())
} | rust_cleaned_test_functions.jsonl/104041 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 286
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26328,
74269,
7913,
35906,
368,
1464,
5714,
71698,
341,
286,
1077,
2730,
3741,
284,
54819,
486,
3888,
3741,
1005,
15454,
543,
286,
1077,
3704,
284,
2730,
3741,
3875,
543,
286,
1077,
1936,
74269,
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_openat2() {
let tmp = tempfile::tempdir().unwrap();
let dir = openat(&cwd(), tmp.path(), OFlags::RDONLY, Mode::empty()).unwrap();
// Detect whether `openat2` is available.
match openat2(
&dir,
".",
OFlags::RDONLY,
Mode::empty(),
ResolveFlags::empty(),
) {
Ok(_file) => (),
Err(io::Error::NOSYS) => return,
Err(_err) => return,
}
// Create a file.
let _ = openat2_more(
&dir,
"test.txt",
OFlags::WRONLY | OFlags::CREATE | OFlags::TRUNC,
Mode::IRUSR,
ResolveFlags::empty(),
)
.unwrap();
// Test `NO_SYMLINKS`.
symlinkat("test.txt", &dir, "symlink.txt").unwrap();
let _ = openat2_more(
&dir,
"symlink.txt",
OFlags::RDONLY,
Mode::empty(),
ResolveFlags::empty(),
)
.unwrap();
let _ = openat2_more(
&dir,
"symlink.txt",
OFlags::RDONLY,
Mode::empty(),
ResolveFlags::NO_MAGICLINKS,
)
.unwrap();
let _ = openat2_more(
&dir,
"symlink.txt",
OFlags::RDONLY,
Mode::empty(),
ResolveFlags::NO_SYMLINKS,
)
.unwrap_err();
// Test `NO_MAGICLINKS`.
let test = openat2_more(
&dir,
"test.txt",
OFlags::RDONLY,
Mode::empty(),
ResolveFlags::empty(),
)
.unwrap();
let _ = openat2_more(
&dir,
&format!("/proc/self/fd/{}", test.as_fd().as_raw_fd()),
OFlags::RDONLY,
Mode::empty(),
ResolveFlags::empty(),
)
.unwrap();
let _ = openat2_more(
&dir,
&format!("/proc/self/fd/{}", test.as_fd().as_raw_fd()),
OFlags::RDONLY,
Mode::empty(),
ResolveFlags::NO_SYMLINKS,
)
.unwrap_err();
let _ = openat2_more(
&dir,
&format!("/proc/self/fd/{}", test.as_fd().as_raw_fd()),
OFlags::RDONLY,
Mode::empty(),
ResolveFlags::NO_MAGICLINKS,
)
.unwrap_err();
// Test `NO_XDEV`.
let root = openat2_more(
&dir,
"/",
OFlags::RDONLY,
Mode::empty(),
ResolveFlags::empty(),
)
.unwrap();
let _ = openat2_more(
&root,
"proc",
OFlags::RDONLY,
Mode::empty(),
ResolveFlags::empty(),
)
.unwrap();
let _ = openat2_more(
&root,
"proc",
OFlags::RDONLY,
Mode::empty(),
ResolveFlags::NO_XDEV,
)
.unwrap_err();
// Test `BENEATH`.
let _ = openat2_more(
&dir,
"..",
OFlags::RDONLY,
Mode::empty(),
ResolveFlags::empty(),
)
.unwrap();
let _ = openat2_more(
&dir,
"..",
OFlags::RDONLY,
Mode::empty(),
ResolveFlags::BENEATH,
)
.unwrap_err();
// Test `IN_ROOT`.
let _ = openat2_more(
&dir,
"/proc",
OFlags::RDONLY,
Mode::empty(),
ResolveFlags::empty(),
)
.unwrap();
let _ = openat2_more(
&dir,
"/proc",
OFlags::RDONLY,
Mode::empty(),
ResolveFlags::IN_ROOT,
)
.unwrap_err();
mkdirat(&dir, "proc", Mode::IRUSR | Mode::IXUSR).unwrap();
let _ = openat2_more(
&dir,
"/proc",
OFlags::RDONLY,
Mode::empty(),
ResolveFlags::IN_ROOT,
)
.unwrap();
} | rust_cleaned_test_functions.jsonl/96394 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1934
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11311,
266,
17,
368,
341,
262,
1077,
4174,
284,
54819,
486,
3888,
3741,
1005,
15454,
543,
262,
1077,
5419,
284,
1787,
266,
2099,
32165,
1507,
4174,
3875,
1507,
3008,
22851,
486,
36690,
31092,
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... | 2 |
#[test]
fn test_uuid() -> crate::Result<()> {
use crate::{params, Connection};
use uuid::Uuid;
let db = Connection::open_in_memory()?;
db.execute_batch("CREATE TABLE foo (id BLOB CONSTRAINT uuidchk CHECK (octet_length(id) <= 16), label TEXT);")?;
let id = Uuid::new_v4();
db.execute("INSERT INTO foo (id, label) VALUES (?, ?)", params![id, "target"])?;
let mut stmt = db.prepare("SELECT id, label FROM foo WHERE id = ?")?;
let mut rows = stmt.query(params![id])?;
let row = rows.next()?.unwrap();
let found_id: Uuid = row.get_unwrap(0);
let found_label: String = row.get_unwrap(1);
assert_eq!(found_id, id);
assert_eq!(found_label, "target");
Ok(())
} | rust_cleaned_test_functions.jsonl/124019 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 360
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25540,
368,
1464,
17717,
486,
2077,
71698,
341,
286,
990,
17717,
22964,
3519,
11,
11032,
2440,
286,
990,
16040,
486,
38431,
401,
286,
1077,
2927,
284,
11032,
486,
2508,
1243,
19195,
94136,
286,
29... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
#[test]
fn test_range_from_take() {
let mut it = (0..).take(3);
assert_eq!(it.next(), Some(0));
assert_eq!(it.next(), Some(1));
assert_eq!(it.next(), Some(2));
assert_eq!(it.next(), None);
is_trusted_len((0..).take(3));
assert_eq!((0..).take(3).size_hint(), (3, Some(3)));
assert_eq!((0..).take(0).size_hint(), (0, Some(0)));
assert_eq!((0..).take(usize::MAX).size_hint(), (usize::MAX, Some(usize::MAX)));
} | rust_cleaned_test_functions.jsonl/54153 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 219
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9698,
5673,
73261,
368,
341,
262,
1077,
5206,
432,
284,
320,
15,
496,
568,
22769,
7,
18,
317,
262,
2060,
10714,
10297,
275,
4529,
1507,
4329,
7,
15,
1106,
262,
2060,
10714,
10297,
275,
4529,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_analyze_column() {
let data = vec![
(1, Some("name:0"), 2),
(2, Some("name:4"), 3),
(4, Some("name:3"), 1),
(5, None, 4),
];
let product = ProductTable::new();
let (_, endpoint) = init_data_with_commit(&product, &data, true);
let req = new_analyze_column_req(&product, 3, 3, 3, 4, 32);
let resp = handle_request(&endpoint, req);
assert!(!resp.get_data().is_empty());
let mut analyze_resp = AnalyzeColumnsResp::default();
analyze_resp.merge_from_bytes(resp.get_data()).unwrap();
let hist = analyze_resp.get_pk_hist();
assert_eq!(hist.get_buckets().len(), 2);
assert_eq!(hist.get_ndv(), 4);
let collectors = analyze_resp.get_collectors().to_vec();
assert_eq!(collectors.len(), product.columns_info().len() - 1);
assert_eq!(collectors[0].get_null_count(), 1);
assert_eq!(collectors[0].get_count(), 3);
let rows = collectors[0].get_cm_sketch().get_rows();
assert_eq!(rows.len(), 4);
let sum: u32 = rows.first().unwrap().get_counters().iter().sum();
assert_eq!(sum, 3);
} | rust_cleaned_test_functions.jsonl/47335 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 472
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12008,
55856,
8744,
368,
341,
262,
1077,
821,
284,
7486,
90515,
286,
320,
16,
11,
4329,
445,
606,
25,
15,
3975,
220,
17,
1326,
286,
320,
17,
11,
4329,
445,
606,
25,
19,
3975,
220,
18,
1326,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_chrono_datetime_from_timestamp_micros() {
let datetime_from_timestamp: DateTime<Utc> = Timestamp::Microseconds(1).into();
assert_eq!(
Utc.timestamp_nanos((1 / MICROS_PER_NANO).try_into().unwrap()),
datetime_from_timestamp
)
} | rust_cleaned_test_functions.jsonl/105318 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 150
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4138,
2248,
78,
28943,
5673,
23073,
73003,
82,
368,
341,
286,
1077,
8874,
5673,
23073,
25,
6520,
36397,
10413,
29,
284,
32758,
486,
34609,
17403,
7,
16,
568,
18122,
543,
286,
2060,
10714,
33673,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fog_hint_serde() {
let a = EncryptedFogHint::new(&[17u8; ENCRYPTED_FOG_HINT_LEN]);
let a_ser = mc_util_serial::serialize(&a).unwrap();
let b: EncryptedFogHint = mc_util_serial::deserialize(&a_ser).unwrap();
assert_eq!(a.as_ref(), b.as_ref());
} | rust_cleaned_test_functions.jsonl/17513 | {
"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,
761,
538,
45825,
75861,
450,
368,
341,
286,
1077,
264,
284,
10751,
14026,
37,
538,
26987,
486,
931,
2099,
58,
16,
22,
84,
23,
26,
5190,
42917,
1479,
1400,
12223,
74457,
15536,
2558,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_slow_request() {
let srv = TestServer::new(|| {
HttpService::build()
.client_timeout(100)
.finish(|_| future::ok::<_, ()>(Response::Ok().finish()))
});
let mut stream = net::TcpStream::connect(srv.addr()).unwrap();
let _ = stream.write_all(b"GET /test/tests/test HTTP/1.1\r\n");
let mut data = String::new();
let _ = stream.read_to_string(&mut data);
assert!(data.starts_with("HTTP/1.1 408 Request Timeout"));
} | rust_cleaned_test_functions.jsonl/102536 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 222
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82447,
7893,
368,
341,
262,
1077,
43578,
284,
3393,
5475,
486,
931,
79453,
341,
286,
4823,
1860,
486,
5834,
741,
310,
659,
2972,
20537,
7,
16,
15,
15,
340,
310,
659,
30150,
22428,
35395,
3853,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_failure_no_such_client() {
let res = run_test(12003, 12004, Some(InjectedFailure::NoSuchClient));
assert_eq!(res.status, StatusCode::BadRequest);
} | rust_cleaned_test_functions.jsonl/36401 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 72
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43618,
6536,
643,
1387,
8179,
368,
341,
262,
1077,
592,
284,
1598,
4452,
7,
16,
17,
15,
15,
18,
11,
220,
16,
17,
15,
15,
19,
11,
4329,
7,
88818,
17507,
486,
65531,
2959,
1106,
262,
2060,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_compile_fails() {
expect_error!(
"var_already_defined_a.de",
LangErrorKind::VariableAlreadyDefined { .. }
);
expect_error!(
"var_already_defined_b.de",
LangErrorKind::VariableAlreadyDefined { .. }
);
expect_error!(
"unexpected_path_assignment.de",
LangErrorKind::UnexpectedPathAssignment { .. }
);
// Type attributes are temporarily ignored
// expect_error!(
// expect_error!(
expect_error!(
"unexpected_type_function_b.de",
LangErrorKind::UnexpectedType { .. }
);
expect_error!(
"unexpected_type_return_type.de",
LangErrorKind::UnexpectedType { .. }
);
expect_error!(
"unexpected_type_condition.de",
LangErrorKind::ExpectedBoolean { .. }
);
expect_error!(
"unexpected_type_else_a.de",
LangErrorKind::UnexpectedType { .. }
);
expect_error!(
"unexpected_type_else_b.de",
LangErrorKind::UnexpectedType { .. }
);
expect_error!(
"unexpected_type_no_else.de",
LangErrorKind::UnexpectedType { .. }
);
expect_error!(
"unexpected_type_parameter_type.de",
LangErrorKind::UnexpectedType { .. }
);
expect_error!(
"unexpected_type_struct_initialization.de",
LangErrorKind::UnexpectedType { .. }
);
expect_error!(
"struct_instantiation_a.de",
LangErrorKind::UnexpectedType { .. }
);
expect_error!(
"struct_instantiation_b.de",
LangErrorKind::UnexpectedType { .. }
);
expect_error!(
"struct_instantiation_incomplete_a.de",
LangErrorKind::UnexpectedStructInitializer { .. }
);
expect_error!(
"struct_instantiation_incomplete_b.de",
LangErrorKind::MissingStructInitializer { .. }
);
expect_error!(
"unexpected_pattern.de",
LangErrorKind::MissingVariable { .. }
);
expect_error!(
"unexpected_overload_builtin.de",
LangErrorKind::UnexpectedOverload { .. }
);
expect_error!(
"unexpected_overload_struct.de",
LangErrorKind::UnexpectedOverload { .. }
);
expect_error!(
"unexpected_overload_native.de",
LangErrorKind::UnexpectedOverload { .. }
);
expect_error!("missing_variable.de", LangErrorKind::MissingVariable { .. });
expect_error!(
"missing_variable_update.de",
LangErrorKind::MissingVariable { .. }
);
expect_error!("missing_property.de", LangErrorKind::MissingProperty { .. });
expect_error!(
"unexpected_operator.de",
LangErrorKind::UnexpectedOperator { .. }
);
expect_error!(
"unpromotable_type.de",
LangErrorKind::UnpromotableType { .. }
);
expect_error!("missing_module.de", LangErrorKind::MissingModule { .. });
expect_error!("circular_import_a.de", LangErrorKind::CircularImport { .. });
expect_error!("const_variable.de", LangErrorKind::ConstVariable { .. });
expect_error!(
"comptime_variable.de",
LangErrorKind::ComptimeVariable { .. }
);
expect_error!(
"non_comptime_declaration.de",
LangErrorKind::NonComptimeVariable { .. }
);
expect_error!(
"not_yet_implemented_recursive_call.de",
LangErrorKind::NotYetImplemented { .. }
);
expect_error!("pattern_mismatch_a.de", LangErrorKind::TupleMismatch { .. });
expect_error!("pattern_mismatch_b.de", LangErrorKind::TupleMismatch { .. });
expect_error!(
"register_ticking_function_a.de",
LangErrorKind::UnexpectedOverload { .. }
);
expect_error!(
"register_ticking_function_b.de",
LangErrorKind::UnexpectedType { .. }
);
expect_error!(
"invalid_return.de",
LangErrorKind::InvalidControlFlow { .. }
);
expect_error!(
"loop_continue_value.de",
LangErrorKind::UnexpectedType { .. }
);
expect_error!("unreachable_code_a.de", LangErrorKind::UnreachableCode);
} | rust_cleaned_test_functions.jsonl/79476 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1803
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74170,
761,
6209,
368,
341,
262,
1720,
4096,
33673,
286,
330,
947,
80772,
52870,
4306,
2285,
756,
286,
22463,
1454,
10629,
486,
7827,
38370,
29361,
314,
5241,
456,
262,
1439,
262,
1720,
4096,
3367... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invalid_unary_operand() {
check_error("-\"cat\";", &|err: &str| {
assert!(
err.starts_with("invalid application of unary op Minus to object of type String")
)
})
} | rust_cleaned_test_functions.jsonl/111837 | {
"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,
31433,
4907,
658,
69259,
368,
341,
286,
1779,
4096,
13645,
2105,
4616,
2105,
32503,
609,
91,
615,
25,
609,
495,
91,
341,
310,
2060,
33673,
394,
1848,
4962,
82,
6615,
445,
11808,
3766,
315,
75678... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_accept_reasonable_proposal_title() {
let result = validate_proposal_title(&Some("When In The Course of Human Events".to_string()));
assert!(result.is_ok());
} | rust_cleaned_test_functions.jsonl/42980 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 68
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35728,
38229,
480,
21663,
32556,
6112,
368,
341,
262,
1077,
1102,
284,
9593,
21663,
32556,
6112,
2099,
8373,
445,
4498,
758,
576,
16615,
315,
11097,
17627,
3263,
983,
3904,
7392,
262,
2060,
10297,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_from_u512_max() {
let max_u64 = 0xffffffffffffffff;
assert_eq!(
R3 - R,
Scalar::from_u512([max_u64, max_u64, max_u64, max_u64, max_u64, max_u64, max_u64, max_u64])
);
} | rust_cleaned_test_functions.jsonl/42746 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 121
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
7300,
20,
16,
17,
6345,
368,
341,
262,
1077,
1932,
7300,
21,
19,
284,
220,
15,
41798,
53697,
280,
262,
2060,
10714,
33673,
414,
431,
18,
481,
431,
345,
414,
35176,
486,
1499,
7300,
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_invalid_char() {
let mut lexer = Lexer::new();
match lexer.lex("this is & invalid".to_string()){
Err(s) => assert_eq!("LEXING FAILURE at 1:9 invalid character &\nthis is & invalid\n ^".to_string(), s),
_ => assert!(false)
}
} | rust_cleaned_test_functions.jsonl/47915 | {
"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,
31433,
9232,
368,
341,
286,
1077,
5206,
53259,
284,
85082,
486,
931,
543,
286,
2432,
53259,
82248,
445,
574,
374,
609,
8318,
3263,
983,
3904,
12130,
310,
15495,
1141,
8,
589,
2060,
10714,
17223,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_execute_trailing_comma() {
let mut result = FakeWrite::default();
execute!(&mut result, FakeCommand, FakeCommand,).unwrap();
assert_eq!(&result.buffer, "cmdcmd");
assert!(result.flushed);
} | rust_cleaned_test_functions.jsonl/5851 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44329,
3547,
14277,
2965,
1728,
368,
341,
310,
1077,
5206,
1102,
284,
36965,
7985,
486,
2258,
543,
310,
9026,
0,
2099,
6984,
1102,
11,
36965,
4062,
11,
36965,
4062,
11,
568,
15454,
543,
310,
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 |
#[test]
fn test_create_account_ephemeral_with_auth_mechanism() {
request_stream_test(
AccountLifetime::Ephemeral,
create_clean_pre_auth_manager(),
None,
Arc::new(Inspector::new()),
|proxy| async move {
assert_eq!(
proxy.create_account(Some(TEST_AUTH_MECHANISM_ID)).await?,
Err(ApiError::InvalidRequest)
);
Ok(())
},
);
} | rust_cleaned_test_functions.jsonl/105853 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 300
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
13500,
12476,
29032,
3253,
6615,
14014,
717,
4737,
67813,
368,
341,
286,
1681,
12673,
4452,
1006,
310,
8615,
74579,
486,
36,
59941,
3253,
345,
310,
1855,
19573,
10442,
14014,
12144,
3148,
310,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.