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_idna() {
use super::testing::idna_test;
let io_loop = Runtime::new().expect("failed to create tokio runtime io_loop");
let handle = io_loop.handle().clone();
idna_test::<Runtime, TokioRuntime>(io_loop, handle);
} | rust_cleaned_test_functions.jsonl/121538 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
842,
3376,
368,
341,
286,
990,
2256,
486,
8840,
486,
307,
3376,
4452,
280,
286,
1077,
6399,
17198,
284,
10954,
486,
931,
1005,
17119,
445,
16091,
311,
1855,
9628,
815,
15592,
6399,
17198,
797,
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_transact_withdraw_unbonded_work() {
TestNet::reset();
ParaA::execute_with(|| {
assert_ok!(LiquidStaking::stake(Origin::signed(ALICE), ksm(6000f64),));
assert_ok!(LiquidStaking::bond(
Origin::signed(ALICE),
ksm(5f64),
RewardDestination::Staked
));
assert_ok!(LiquidStaking::unbond(Origin::signed(ALICE), ksm(2f64)));
});
Relay::execute_with(|| {
let ledger = RelayStaking::ledger(LiquidStaking::derivative_para_account_id()).unwrap();
assert_eq!(ledger.total, ksm(5f64));
assert_eq!(ledger.active, ksm(3f64));
assert_eq!(ledger.unlocking.len(), 1);
RelaySystem::assert_has_event(RelayEvent::Staking(RelayStakingEvent::Bonded(
LiquidStaking::derivative_para_account_id(),
ksm(5f64),
)));
RelaySystem::assert_has_event(RelayEvent::Staking(RelayStakingEvent::Unbonded(
LiquidStaking::derivative_para_account_id(),
ksm(2f64),
)));
pallet_staking::CurrentEra::<KusamaRuntime>::put(
<KusamaRuntime as pallet_staking::Config>::BondingDuration::get(),
);
});
ParaA::execute_with(|| {
assert_ok!(LiquidStaking::withdraw_unbonded(
Origin::signed(ALICE),
0,
0
));
});
Relay::execute_with(|| {
let ledger = RelayStaking::ledger(LiquidStaking::derivative_para_account_id()).unwrap();
assert_eq!(ledger.total, ksm(3f64));
assert_eq!(ledger.active, ksm(3f64));
assert_eq!(ledger.unlocking.len(), 0);
});
} | rust_cleaned_test_functions.jsonl/53663 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 821
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7965,
531,
6615,
7633,
4907,
64239,
291,
11498,
368,
341,
262,
3393,
6954,
486,
9716,
1428,
262,
22989,
32,
486,
10257,
6615,
79453,
341,
286,
2060,
19817,
10297,
96640,
623,
1765,
486,
267,
726,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_set_buffer_frame_size_in_parallel() {
test_set_buffer_frame_size_in_parallel_in_scope(Scope::Input);
test_set_buffer_frame_size_in_parallel_in_scope(Scope::Output);
} | rust_cleaned_test_functions.jsonl/121429 | {
"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,
2602,
7776,
8929,
2368,
1243,
60625,
368,
341,
262,
1273,
2602,
7776,
8929,
2368,
1243,
60625,
1243,
23199,
3759,
2417,
486,
2505,
317,
262,
1273,
2602,
7776,
8929,
2368,
1243,
60625,
1243,
23199,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_should_panic_non_string_message_type() {
use crate::tests::TrFailedMsg;
use std::any::TypeId;
fn f() {
std::panic::panic_any(1i32);
}
let expected = "foobar";
let failed_msg = format!(
r#"expected panic with string value,
found non-string value: `{:?}`
expected substring: `"foobar"`"#,
TypeId::of::<i32>()
);
let desc = TestDescAndFn {
desc: TestDesc {
name: StaticTestName("whatever"),
ignore: false,
should_panic: ShouldPanic::YesWithMessage(expected),
compile_fail: false,
no_run: false,
test_type: TestType::Unknown,
#[cfg(bootstrap)]
allow_fail: false,
},
testfn: DynTestFn(Box::new(f)),
};
let (tx, rx) = channel();
run_test(&TestOpts::new(), false, TestId(0), desc, RunStrategy::InProcess, tx, Concurrent::No);
let result = rx.recv().unwrap().result;
assert_eq!(result, TrFailedMsg(failed_msg));
} | rust_cleaned_test_functions.jsonl/51893 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 489
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43378,
620,
31270,
21637,
3904,
6462,
1819,
368,
341,
262,
990,
17717,
486,
23841,
486,
1282,
9408,
6611,
280,
262,
990,
1460,
486,
3767,
486,
31934,
280,
262,
5168,
282,
368,
341,
286,
1460,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_missing_version() {
let (cid, pk, payload) = make_certified_delta(
vec![
make_change(vec![upsert("key1", "value1")]),
make_change(vec![upsert("key2", "value2")]),
],
1..=2,
GarbleResponse::DropVersion(1),
);
match decode_certified_deltas(0, &cid, &pk, &payload[..]) {
Err(CertificationError::InvalidDeltas(_)) => (),
other => panic!("Expected InvalidDeltas error, got {:?}", other),
}
} | rust_cleaned_test_functions.jsonl/122444 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 248
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
40447,
9438,
368,
341,
262,
1077,
320,
20558,
11,
22458,
11,
7729,
8,
284,
1281,
37097,
1870,
26710,
1006,
286,
7486,
90515,
310,
1281,
15947,
25592,
20703,
454,
6047,
445,
792,
16,
497,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_parse() {
let string = "foo://example.com:8042/over/there?name=ferret#nose";
let mut cursor = 0;
let scheme = Scheme::parse(string.as_bytes(), &mut cursor, &string.len()).unwrap();
assert_eq!(scheme.origin, Bytes::from_static(b"foo:"));
assert_eq!(cursor, 4);
} | rust_cleaned_test_functions.jsonl/132942 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 152
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
368,
341,
286,
1077,
914,
284,
330,
7975,
1110,
8687,
905,
25,
23,
15,
19,
17,
14,
1975,
14,
18532,
30,
606,
28,
802,
2122,
2,
77,
960,
876,
286,
1077,
5206,
8128,
284,
220,
15,
280... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_statsd_client_buffered_udp_sink_many_threaded() {
let client = new_buffered_udp_client("cadence");
run_arc_threaded_test(client, NUM_THREADS, NUM_ITERATIONS);
} | rust_cleaned_test_functions.jsonl/21895 | {
"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,
15381,
67,
8179,
7776,
291,
69432,
51567,
22101,
10814,
291,
368,
341,
262,
1077,
2943,
284,
501,
7776,
291,
69432,
8179,
445,
34455,
763,
797,
262,
1598,
62914,
10814,
291,
4452,
12805,
11,
15943... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_nfa_builder() {
let _nfa = NFABuilder::new()
.add_start(0)
.add_final(3)
.add_transition('a', 0, 1)
.add_transition('c', 0, 3)
.add_transition('b', 1, 2)
.add_transition('a', 2, 1)
.add_transition('c', 2, 3)
.finalize()
.unwrap();
} | rust_cleaned_test_functions.jsonl/77586 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 235
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1089,
3632,
28532,
368,
341,
286,
1077,
716,
77,
3632,
284,
44727,
1867,
2511,
486,
931,
741,
310,
659,
718,
4906,
7,
15,
340,
310,
659,
718,
20676,
7,
18,
340,
310,
659,
718,
53593,
492,
64... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_entry_follow()
{
let vfs = Memfs::new();
let tmpdir = vfs.root().mash("tmpdir");
let file1 = tmpdir.mash("file1");
let file2 = tmpdir.mash("file2");
let file3 = vfs.root().mash("file3");
let link1 = tmpdir.mash("link");
assert_vfs_mkdir_p!(vfs, &tmpdir);
assert_vfs_mkfile!(vfs, &file1);
assert_vfs_mkfile!(vfs, &file2);
assert_vfs_mkfile!(vfs, &file3);
assert_vfs_symlink!(vfs, &link1, &file3);
let guard = vfs.read_guard();
// custom sort for files
let iter = vfs._entry_iter(&guard, &tmpdir).unwrap()(&tmpdir, false).unwrap();
assert_eq!(iter.following(), false);
let mut iter = iter.follow(true);
assert_eq!(iter.following(), true);
iter.sort(|x, y| x.file_name().cmp(&y.file_name()));
assert_eq!(iter.cached(), true);
// because we sort on the path and we have follow set which switches the path and alt
// sort order will be based on the file name not the link name
let item1 = iter.next().unwrap().unwrap();
assert_eq!(item1.following(), false);
assert_eq!(item1.path(), &file1);
let item2 = iter.next().unwrap().unwrap();
assert_eq!(item2.following(), false);
assert_eq!(item2.path(), &file2);
let item3 = iter.next().unwrap().unwrap();
assert_eq!(item3.following(), true);
assert_eq!(item3.path(), &file3);
assert_eq!(item3.alt(), &link1);
assert!(iter.next().is_none());
} | rust_cleaned_test_functions.jsonl/73587 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 741
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9078,
43490,
741,
262,
341,
286,
1077,
92941,
284,
13550,
3848,
486,
931,
543,
286,
1077,
4174,
3741,
284,
92941,
12576,
1005,
76,
988,
445,
5173,
3741,
797,
286,
1077,
1034,
16,
284,
4174,
3741... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fmt() {
let program = Program::builder().set_id("pg0").set_name("noodles").build();
assert_eq!(program.to_string(), "@PG\tID:pg0\tPN:noodles");
} | rust_cleaned_test_functions.jsonl/33297 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 90
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38128,
368,
341,
286,
1077,
2025,
284,
6687,
486,
17850,
1005,
746,
842,
445,
3517,
15,
1827,
746,
1269,
445,
77,
97121,
1827,
5834,
543,
286,
2060,
10714,
10297,
14906,
2389,
3904,
1507,
8428,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_get_and_update_authorized_voter() {
let original_voter = solana_sdk::pubkey::new_rand();
let mut vote_state = VoteState::new(
&VoteInit {
node_pubkey: original_voter,
authorized_voter: original_voter,
authorized_withdrawer: original_voter,
commission: 0,
},
&Clock::default(),
);
// is locked into the next epoch
assert_eq!(
vote_state.get_and_update_authorized_voter(1).unwrap(),
original_voter
);
// the authorized voter for epochs 1-4 were unchanged
assert_eq!(
vote_state.get_and_update_authorized_voter(5).unwrap(),
original_voter
);
// purged and no longer queryable
assert_eq!(vote_state.authorized_voters.len(), 1);
for i in 0..5 {
assert!(vote_state
.authorized_voters
.get_authorized_voter(i)
.is_none());
}
// Set an authorized voter change at slot 7
let new_authorized_voter = solana_sdk::pubkey::new_rand();
vote_state
.set_new_authorized_voter(&new_authorized_voter, 5, 7, |_| Ok(()))
.unwrap();
assert_eq!(
vote_state.get_and_update_authorized_voter(6).unwrap(),
original_voter
);
// be the new authorized voter
for i in 7..10 {
assert_eq!(
vote_state.get_and_update_authorized_voter(i).unwrap(),
new_authorized_voter
);
}
assert_eq!(vote_state.authorized_voters.len(), 1);
} | rust_cleaned_test_functions.jsonl/6108 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 938
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
8378,
8882,
62,
19084,
2273,
25392,
368,
341,
286,
1077,
4024,
2273,
25392,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
5206,
6910,
4387,
284,
34034,
1397,
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... | 3 |
#[test]
fn test_iterate_samples_two_trees() {
let treeseq = treeseq_from_small_table_collection_two_trees();
assert_eq!(treeseq.inner.num_trees, 2);
let mut tree_iter = treeseq.tree_iterator(TreeFlags::SAMPLE_LISTS).unwrap();
while let Some(tree) = tree_iter.next() {
for n in tree.traverse_nodes(NodeTraversalOrder::Preorder) {
let mut nsamples = 0;
for _ in tree.samples(n).unwrap() {
nsamples += 1;
}
assert!(nsamples > 0);
assert_eq!(nsamples, tree.num_tracked_samples(n).unwrap());
}
}
} | rust_cleaned_test_functions.jsonl/23030 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 357
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
349,
18297,
23241,
75791,
368,
341,
286,
1077,
4258,
2367,
80,
284,
4258,
2367,
80,
5673,
31966,
5237,
25019,
23241,
75791,
543,
286,
2060,
10714,
10297,
10157,
2367,
80,
9398,
10522,
75791,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_from_value() {
assert_eq!(Vector2::from_value(102i), Vector2::new(102i, 102i));
assert_eq!(Vector3::from_value(22i), Vector3::new(22i, 22i, 22i));
assert_eq!(Vector4::from_value(76.5f64), Vector4::new(76.5f64, 76.5f64, 76.5f64, 76.5f64));
} | rust_cleaned_test_functions.jsonl/5663 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 135
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
3142,
368,
341,
262,
2060,
10714,
10297,
3781,
17,
486,
1499,
3142,
7,
16,
15,
17,
72,
701,
4196,
17,
486,
931,
7,
16,
15,
17,
72,
11,
220,
16,
15,
17,
72,
1106,
262,
2060,
10714,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_break() {
test("hello");
test("1234567890123456");
test("this is a simple one-line message");
test("hi,\nthis is a multi-line message\nok\n");
test("a");
} | rust_cleaned_test_functions.jsonl/16041 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 87
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39494,
368,
341,
262,
1273,
445,
14990,
797,
262,
1273,
445,
16,
17,
18,
19,
20,
21,
22,
23,
24,
15,
16,
17,
18,
19,
20,
21,
797,
262,
1273,
445,
574,
374,
264,
4285,
825,
8447,
1943,
79... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_singlenote_discussion() {
let discussions: Vec<Discussion> = read_test_file("discussion");
let discussion = discussions
.iter()
.find(|x| x.id.value() == "18ea341cb10e952889e277836ba638c6b17ff26c")
.unwrap();
assert!(discussion.individual_note);
assert_eq!(discussion.notes.len(), 1);
let note = discussion.notes.get(0).unwrap();
assert!(!note.resolvable);
assert!(note.position.is_none());
assert_eq!(note.note_type, None)
} | rust_cleaned_test_functions.jsonl/12947 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 220
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
643,
287,
2892,
1272,
37745,
17405,
368,
341,
262,
1077,
20333,
25,
11312,
27,
71021,
29,
284,
1349,
4452,
2458,
445,
69869,
797,
262,
1077,
10219,
284,
20333,
198,
286,
659,
2015,
741,
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_cname_additionals() {
let example = create_example();
let origin = example.origin().clone();
let mut catalog: Catalog = Catalog::new();
catalog.upsert(origin, Box::new(example));
let mut question: Message = Message::new();
let mut query: Query = Query::new();
query.set_name(Name::from_str("alias.example.com.").unwrap());
query.set_query_type(RecordType::A);
question.add_query(query);
// temp request
let question_bytes = question.to_bytes().unwrap();
let question_req = MessageRequest::from_bytes(&question_bytes).unwrap();
let response_handler = TestResponseHandler::new();
block_on(catalog.lookup(question_req, None, response_handler.clone()));
let result = block_on(response_handler.into_message());
assert_eq!(result.message_type(), MessageType::Response);
assert_eq!(result.response_code(), ResponseCode::NoError);
let answers: &[Record] = result.answers();
assert_eq!(answers.len(), 1);
assert_eq!(answers.first().unwrap().rr_type(), RecordType::CNAME);
assert_eq!(
answers.first().unwrap().rdata(),
&RData::CNAME(Name::from_str("www.example.com.").unwrap())
);
let additionals: &[Record] = result.additionals();
assert!(!additionals.is_empty());
assert_eq!(additionals.first().unwrap().rr_type(), RecordType::A);
assert_eq!(
additionals.first().unwrap().rdata(),
&RData::A(Ipv4Addr::new(93, 184, 216, 34))
);
} | rust_cleaned_test_functions.jsonl/68189 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 564
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
606,
2891,
680,
1127,
368,
341,
262,
1077,
3110,
284,
1855,
39304,
543,
262,
1077,
6238,
284,
3110,
20248,
1005,
19982,
1428,
262,
1077,
5206,
16403,
25,
31221,
284,
31221,
486,
931,
543,
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_block_expr() {
check_assist(
inline_local_variable,
"
fn foo() {
let a<|> = { 10 };
let b = a * 10;
let c = a as usize;
}",
"
fn foo() {
<|>let b = { 10 } * 10;
let c = { 10 } as usize;
}",
);
} | rust_cleaned_test_functions.jsonl/60328 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 172
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7113,
21915,
368,
341,
286,
1779,
12083,
380,
1006,
310,
7381,
13564,
14635,
345,
310,
6228,
8822,
15229,
368,
341,
262,
1077,
264,
27,
91,
29,
284,
314,
220,
16,
15,
2605,
262,
1077,
293,
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_single_bit_in_byte() {
let mut hasher1 = AHasher::new_with_keys(0, 0);
8_u32.hash(&mut hasher1);
let mut hasher2 = AHasher::new_with_keys(0, 0);
0_u32.hash(&mut hasher2);
assert_sufficiently_different(hasher1.finish(), hasher2.finish(), 1);
} | rust_cleaned_test_functions.jsonl/67413 | {
"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,
19487,
13996,
1243,
19737,
368,
341,
286,
1077,
5206,
90819,
16,
284,
362,
6370,
261,
486,
931,
6615,
12631,
7,
15,
11,
220,
15,
317,
286,
220,
23,
7300,
18,
17,
15101,
2099,
6984,
90819,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_components() {
macro_rules! t(
(s: $path:expr, $op:ident, $exp:expr) => (
{
let path = $path;
let path = Path::new(path);
assert!(path.$op() == Some($exp));
}
);
(s: $path:expr, $op:ident, $exp:expr, opt) => (
{
let path = $path;
let path = Path::new(path);
let left = path.$op();
assert!(left == $exp);
}
);
(v: $path:expr, $op:ident, $exp:expr) => (
{
let path = $path;
let path = Path::new(path);
assert!(path.$op() == $exp);
}
)
)
t!(v: b"a\\b\\c", filename, Some(b"c"));
t!(s: "a\\b\\c", filename_str, "c");
t!(s: "\\a\\b\\c", filename_str, "c");
t!(s: "a", filename_str, "a");
t!(s: "\\a", filename_str, "a");
t!(s: ".", filename_str, None, opt);
t!(s: "\\", filename_str, None, opt);
t!(s: "..", filename_str, None, opt);
t!(s: "..\\..", filename_str, None, opt);
t!(s: "c:\\foo.txt", filename_str, "foo.txt");
t!(s: "C:\\", filename_str, None, opt);
t!(s: "C:", filename_str, None, opt);
t!(s: "\\\\server\\share\\foo.txt", filename_str, "foo.txt");
t!(s: "\\\\server\\share", filename_str, None, opt);
t!(s: "\\\\server", filename_str, "server");
t!(s: "\\\\?\\bar\\foo.txt", filename_str, "foo.txt");
t!(s: "\\\\?\\bar", filename_str, None, opt);
t!(s: "\\\\?\\", filename_str, None, opt);
t!(s: "\\\\?\\UNC\\server\\share\\foo.txt", filename_str, "foo.txt");
t!(s: "\\\\?\\UNC\\server", filename_str, None, opt);
t!(s: "\\\\?\\UNC\\", filename_str, None, opt);
t!(s: "\\\\?\\C:\\foo.txt", filename_str, "foo.txt");
t!(s: "\\\\?\\C:\\", filename_str, None, opt);
t!(s: "\\\\?\\C:", filename_str, None, opt);
t!(s: "\\\\?\\foo/bar", filename_str, None, opt);
t!(s: "\\\\?\\C:/foo", filename_str, None, opt);
t!(s: "\\\\.\\foo\\bar", filename_str, "bar");
t!(s: "\\\\.\\foo", filename_str, None, opt);
t!(s: "\\\\.\\foo/bar", filename_str, None, opt);
t!(s: "\\\\.\\foo\\bar/baz", filename_str, "bar/baz");
t!(s: "\\\\.\\", filename_str, None, opt);
t!(s: "\\\\?\\a\\b\\", filename_str, "b");
t!(v: b"a\\b\\c", dirname, b"a\\b");
t!(s: "a\\b\\c", dirname_str, "a\\b");
t!(s: "\\a\\b\\c", dirname_str, "\\a\\b");
t!(s: "a", dirname_str, ".");
t!(s: "\\a", dirname_str, "\\");
t!(s: ".", dirname_str, ".");
t!(s: "\\", dirname_str, "\\");
t!(s: "..", dirname_str, "..");
t!(s: "..\\..", dirname_str, "..\\..");
t!(s: "c:\\foo.txt", dirname_str, "C:\\");
t!(s: "C:\\", dirname_str, "C:\\");
t!(s: "C:", dirname_str, "C:");
t!(s: "C:foo.txt", dirname_str, "C:");
t!(s: "\\\\server\\share\\foo.txt", dirname_str, "\\\\server\\share");
t!(s: "\\\\server\\share", dirname_str, "\\\\server\\share");
t!(s: "\\\\server", dirname_str, "\\");
t!(s: "\\\\?\\bar\\foo.txt", dirname_str, "\\\\?\\bar");
t!(s: "\\\\?\\bar", dirname_str, "\\\\?\\bar");
t!(s: "\\\\?\\", dirname_str, "\\\\?\\");
t!(s: "\\\\?\\UNC\\server\\share\\foo.txt", dirname_str, "\\\\?\\UNC\\server\\share");
t!(s: "\\\\?\\UNC\\server", dirname_str, "\\\\?\\UNC\\server\\");
t!(s: "\\\\?\\UNC\\", dirname_str, "\\\\?\\UNC\\\\");
t!(s: "\\\\?\\C:\\foo.txt", dirname_str, "\\\\?\\C:\\");
t!(s: "\\\\?\\C:\\", dirname_str, "\\\\?\\C:\\");
t!(s: "\\\\?\\C:", dirname_str, "\\\\?\\C:");
t!(s: "\\\\?\\C:/foo/bar", dirname_str, "\\\\?\\C:/foo/bar");
t!(s: "\\\\?\\foo/bar", dirname_str, "\\\\?\\foo/bar");
t!(s: "\\\\.\\foo\\bar", dirname_str, "\\\\.\\foo");
t!(s: "\\\\.\\foo", dirname_str, "\\\\.\\foo");
t!(s: "\\\\?\\a\\b\\", dirname_str, "\\\\?\\a");
t!(v: b"hi\\there.txt", filestem, Some(b"there"));
t!(s: "hi\\there.txt", filestem_str, "there");
t!(s: "hi\\there", filestem_str, "there");
t!(s: "there.txt", filestem_str, "there");
t!(s: "there", filestem_str, "there");
t!(s: ".", filestem_str, None, opt);
t!(s: "\\", filestem_str, None, opt);
t!(s: "foo\\.bar", filestem_str, ".bar");
t!(s: ".bar", filestem_str, ".bar");
t!(s: "..bar", filestem_str, ".");
t!(s: "hi\\there..txt", filestem_str, "there.");
t!(s: "..", filestem_str, None, opt);
t!(s: "..\\..", filestem_str, None, opt);
t!(v: b"hi\\there.txt", extension, Some(b"txt"));
t!(v: b"hi\\there", extension, None);
t!(s: "hi\\there.txt", extension_str, Some("txt"), opt);
t!(s: "hi\\there", extension_str, None, opt);
t!(s: "there.txt", extension_str, Some("txt"), opt);
t!(s: "there", extension_str, None, opt);
t!(s: ".", extension_str, None, opt);
t!(s: "\\", extension_str, None, opt);
t!(s: "foo\\.bar", extension_str, None, opt);
t!(s: ".bar", extension_str, None, opt);
t!(s: "..bar", extension_str, Some("bar"), opt);
t!(s: "hi\\there..txt", extension_str, Some("txt"), opt);
t!(s: "..", extension_str, None, opt);
t!(s: "..\\..", extension_str, None, opt);
} | rust_cleaned_test_functions.jsonl/102767 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3121
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23258,
368,
341,
286,
18072,
21407,
0,
259,
1006,
310,
320,
82,
25,
400,
2343,
96011,
11,
400,
453,
25,
1713,
11,
400,
4580,
96011,
8,
589,
2399,
394,
341,
503,
1077,
1815,
284,
400,
2343,
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_logging_power() {
let mut runner = Runner::new();
runner.power_1.set(2.0);
runner.power_2.set(5.0);
let _query = runner.proxy.start_logging(
"test",
&mut vec![&mut Metric::Power(Power {
sampling_interval_ms: 100,
statistics_args: Some(Box::new(StatisticsArgs { statistics_interval_ms: 100 })),
})]
.into_iter(),
200,
false,
false,
);
runner.run_server_task_until_stalled();
// Check default values before first power sensor poll.
assert_data_tree!(
runner.inspector,
root: {
MetricsLogger: {
test: {
PowerLogger: {
"elapsed time (ms)": std::i64::MIN,
"power_1": {
"data (W)": f64::MIN,
"statistics": {
"(start ms, end ms]": vec![std::i64::MIN, std::i64::MIN],
"max (W)": f64::MIN,
"min (W)": f64::MIN,
"average (W)": f64::MIN,
}
},
"/dev/fake/power_2": {
"data (W)": f64::MIN,
"statistics": {
"(start ms, end ms]": vec![std::i64::MIN, std::i64::MIN],
"max (W)": f64::MIN,
"min (W)": f64::MIN,
"average (W)": f64::MIN,
}
}
}
}
}
}
);
// Run 1 logging task.
runner.iterate_logging_task();
assert_data_tree!(
runner.inspector,
root: {
MetricsLogger: {
test: {
PowerLogger: {
"elapsed time (ms)": 100i64,
"power_1": {
"data (W)":2.0,
"statistics": {
"(start ms, end ms]": vec![0i64, 100i64],
"max (W)": 2.0,
"min (W)": 2.0,
"average (W)": 2.0,
}
},
"/dev/fake/power_2": {
"data (W)": 5.0,
"statistics": {
"(start ms, end ms]": vec![0i64, 100i64],
"max (W)": 5.0,
"min (W)": 5.0,
"average (W)": 5.0,
}
}
}
}
}
}
);
// Finish the remaining task.
runner.iterate_logging_task();
assert_data_tree!(
runner.inspector,
root: {
MetricsLogger: {}
}
);
} | rust_cleaned_test_functions.jsonl/66710 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2481
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
59982,
20421,
368,
341,
286,
1077,
5206,
22259,
284,
44946,
486,
931,
1428,
286,
22259,
39545,
62,
16,
980,
7,
17,
13,
15,
317,
286,
22259,
39545,
62,
17,
980,
7,
20,
13,
15,
626,
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_with_deep_lib_dep() {
let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.0.1"
authors = []
[dependencies.bar]
path = "../bar"
"#,
)
.file(
"src/lib.rs",
"
#[cfg(test)]
extern crate bar;
/// ```
/// foo::foo();
/// ```
pub fn foo() {}
#[test]
fn bar_test() {
bar::bar();
}
",
)
.build();
let _p2 = project()
.at("bar")
.file("Cargo.toml", &basic_manifest("bar", "0.0.1"))
.file("src/lib.rs", "pub fn bar() {} #[test] fn foo_test() {}")
.build();
p.cargo("test")
.with_stderr(
"\
[COMPILING] bar v0.0.1 ([..])
[COMPILING] foo v0.0.1 ([CWD])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target[..]
[DOCTEST] foo",
)
.with_stdout_contains("test bar_test ... ok")
.with_stdout_contains_n("test [..] ... ok", 2)
.run();
} | rust_cleaned_test_functions.jsonl/95351 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 728
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
87044,
16142,
49258,
368,
341,
262,
1077,
281,
284,
2390,
741,
286,
659,
1192,
1006,
310,
330,
98228,
73494,
75,
756,
310,
435,
2,
698,
310,
508,
1722,
921,
310,
829,
284,
330,
7975,
698... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_erode_from_back() {
let input = "\
{
let x = 5;
let y = format!(\"{}\", 42);
}";
let expected = "\
{
let x = 5;
let y = format!(\"{}\", 42);";
let got = erode_from_back(input);
assert_eq!(expected, got);
} | rust_cleaned_test_functions.jsonl/60999 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 146
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
80604,
534,
5673,
3895,
368,
341,
286,
1077,
1946,
284,
93317,
515,
262,
1077,
856,
284,
220,
20,
280,
262,
1077,
379,
284,
3561,
10297,
2105,
6257,
16215,
220,
19,
17,
317,
71612,
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_create() {
let cmd = ChanCmd::CREATE;
assert_eq!(Into::<u8>::into(cmd), 1_u8);
let body = "07780DBE97D62D392E0DF2286C78386C49464154A8EDE46EECA1753AA49391200F33F22DF0128CCEC3339434D436551930C95338693EEFAD3964D53184C58AF6C0D838EE3893FAE650DAC89BB12EBB6A882E572C9EA079ACD3E51063296E52ABC875D7A31F8965A6BA9CE54F16AD5C746FEE7D9EF2D41CF4399D818567599D2A0FA8E27F31838F80D80E2D03C040FB954B2AD8872530FFB2AA50531B2BB40C7CB4BF1E8946A50C7622A2916C679AD11577EB4EC414BF8F287085";
let handshake = hex::decode(body).unwrap();
fbody(cmd, body, &msg::Create::new(handshake).into());
} | rust_cleaned_test_functions.jsonl/6029 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 322
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
368,
341,
262,
1077,
5439,
284,
41302,
15613,
486,
22599,
280,
262,
2060,
10714,
10297,
26591,
27638,
84,
23,
6831,
18122,
14160,
701,
220,
16,
7300,
23,
317,
262,
1077,
2487,
284,
330,
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_vote_rountrip_with_sig() {
let dt = "2017-12-25T03:00:01.234Z".parse::<DateTime<Utc>>().unwrap();
let t = TimeMsg {
seconds: dt.timestamp(),
nanos: dt.timestamp_subsec_nanos() as i32,
};
let vote = Vote {
validator_address: vec![
0xa3, 0xb2, 0xcc, 0xdd, 0x71, 0x86, 0xf1, 0x68, 0x5f, 0x21, 0xf2, 0x48, 0x2a, 0xf4,
0xfb, 0x34, 0x46, 0xa8, 0x4b, 0x35,
],
validator_index: 56789,
height: 12345,
round: 2,
timestamp: Some(t),
vote_type: 0x01,
block_id: Some(BlockId {
hash: b"hash".to_vec(),
parts_header: Some(PartsSetHeader {
total: 1_000_000,
hash: b"parts_hash".to_vec(),
}),
}),
signature: vec![
130u8, 246, 183, 50, 153, 248, 28, 57, 51, 142, 55, 217, 194, 24, 134, 212, 233,
100, 211, 10, 24, 174, 179, 117, 41, 65, 141, 134, 149, 239, 65, 174, 217, 42, 6,
184, 112, 17, 7, 97, 255, 221, 252, 16, 60, 144, 30, 212, 167, 39, 67, 35, 118,
192, 133, 130, 193, 115, 32, 206, 152, 91, 173, 10,
],
};
let mut got = vec![];
let _have = vote.encode(&mut got);
let v = Vote::decode(got.as_ref()).unwrap();
assert_eq!(v, vote);
// SignVoteRequest
{
let svr = SignVoteRequest { vote: Some(vote) };
let mut got = vec![];
let _have = svr.encode(&mut got);
let svr2 = SignVoteRequest::decode(got.as_ref()).unwrap();
assert_eq!(svr, svr2);
}
} | rust_cleaned_test_functions.jsonl/71174 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1049
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54360,
62,
581,
77,
32981,
6615,
29252,
368,
341,
286,
1077,
7594,
284,
330,
17,
15,
16,
22,
12,
16,
17,
12,
17,
20,
51,
15,
18,
25,
15,
15,
25,
15,
16,
13,
17,
18,
19,
57,
3263,
6400,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_does_not_share_state() {
use chain_impl_mockchain::key::Hash;
let key = MockKey(0);
let store1 = UtxoStore::<MockKey>::new();
let store2 = store1.add(
UtxoPointer {
transaction_id: Hash::from_bytes([0u8; 32]),
output_index: 0u8,
value: Value(100),
},
key,
);
let store3 = store2.add(
UtxoPointer {
transaction_id: Hash::from_bytes([1u8; 32]),
output_index: 1u8,
value: Value(100),
},
key,
);
let store4 = store2.add(
UtxoPointer {
transaction_id: Hash::from_bytes([2u8; 32]),
output_index: 2u8,
value: Value(1000),
},
key,
);
assert_eq!(store1.utxos().map(|_| 1).sum::<u8>(), 0);
assert!(store1.group(&key.group_key()).is_none());
assert_eq!(store2.utxos().map(|_| 1).sum::<u8>(), 1);
assert_eq!(by_key(&key, &store2).len(), 1);
assert_eq!(store3.utxos().map(|_| 1).sum::<u8>(), 2);
assert_eq!(by_key(&key, &store3).len(), 2);
assert_eq!(store4.utxos().map(|_| 1).sum::<u8>(), 2);
assert_eq!(by_key(&key, &store4).len(), 2);
} | rust_cleaned_test_functions.jsonl/67674 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 791
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
96374,
7913,
38272,
4387,
368,
341,
286,
990,
8781,
21007,
34134,
8819,
486,
792,
486,
6370,
280,
286,
1077,
1376,
284,
14563,
1592,
7,
15,
317,
286,
1077,
3553,
16,
284,
547,
3998,
78,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compute_state() {
let properties = fnet_interfaces_ext::Properties {
id: ID1,
name: ETHERNET_INTERFACE_NAME.to_string(),
device_class: fnet_interfaces::DeviceClass::Device(
fidl_fuchsia_hardware_network::DeviceClass::Ethernet,
),
has_default_ipv4_route: true,
has_default_ipv6_route: true,
online: true,
addresses: vec![
fnet_interfaces_ext::Address {
value: fidl_if_addr!("1.2.3.4/24"),
valid_until: fuchsia_zircon::Time::INFINITE.into_nanos(),
},
fnet_interfaces_ext::Address {
value: fidl_if_addr!("123::4"),
valid_until: fuchsia_zircon::Time::INFINITE.into_nanos(),
},
],
};
let local_routes = [fnet_stack::ForwardingEntry {
subnet: fidl_subnet!("1.2.3.4/24"),
device_id: ID1,
next_hop: None,
metric: 0,
}];
let route_table = [
fnet_stack::ForwardingEntry {
subnet: fidl_subnet!("0.0.0.0/0"),
device_id: ID1,
next_hop: Some(Box::new(fidl_ip!("1.2.3.1"))),
metric: 0,
},
fnet_stack::ForwardingEntry {
subnet: fidl_subnet!("::/0"),
device_id: ID1,
next_hop: Some(Box::new(fidl_ip!("123::1"))),
metric: 0,
},
];
let route_table2 = [
fnet_stack::ForwardingEntry {
subnet: fidl_subnet!("0.0.0.0/0"),
device_id: ID1,
next_hop: Some(Box::new(fidl_ip!("2.2.3.1"))),
metric: 0,
},
fnet_stack::ForwardingEntry {
subnet: fidl_subnet!("::/0"),
device_id: ID1,
next_hop: Some(Box::new(fidl_ip!("223::1"))),
metric: 0,
},
];
const NON_ETHERNET_INTERFACE_NAME: &str = "test01";
let mut exec = fasync::TestExecutor::new_with_fake_time()
.expect("failed to create fake-time executor");
let time = fasync::Time::from_nanos(1_000_000_000);
let () = exec.set_fake_time(time.into());
fn run_compute_state(
exec: &mut fasync::TestExecutor,
properties: &fnet_interfaces_ext::Properties,
routes: &[fnet_stack::ForwardingEntry],
pinger: &dyn Ping,
) -> Result<Option<IpVersions<StateEvent>>, anyhow::Error> {
let fut = compute_state(&properties, routes, pinger);
futures::pin_mut!(fut);
match exec.run_until_stalled(&mut fut) {
Poll::Ready(got) => Ok(got),
Poll::Pending => Err(anyhow::anyhow!("compute_state blocked unexpectedly")),
}
}
let got = run_compute_state(
&mut exec,
&fnet_interfaces_ext::Properties {
id: ID1,
name: NON_ETHERNET_INTERFACE_NAME.to_string(),
device_class: fnet_interfaces::DeviceClass::Device(
fidl_fuchsia_hardware_network::DeviceClass::Virtual,
),
online: false,
has_default_ipv4_route: false,
has_default_ipv6_route: false,
addresses: vec![],
},
&[],
&FakePing::default(),
)
.expect(
"error calling compute_state with non-ethernet interface, no addresses, interface down",
);
assert_eq!(got, Some(IpVersions::construct(StateEvent { state: State::Down, time })));
let got = run_compute_state(
&mut exec,
&fnet_interfaces_ext::Properties { online: false, ..properties.clone() },
&[],
&FakePing::default(),
)
.expect("error calling compute_state, want Down state");
let want =
Some(IpVersions::<StateEvent>::construct(StateEvent { state: State::Down, time }));
assert_eq!(got, want);
let got = run_compute_state(
&mut exec,
&fnet_interfaces_ext::Properties {
has_default_ipv4_route: false,
has_default_ipv6_route: false,
..properties.clone()
},
&local_routes,
&FakePing::default(),
)
.expect("error calling compute_state, want Local state due to no default routes");
let want =
Some(IpVersions::<StateEvent>::construct(StateEvent { state: State::Local, time }));
assert_eq!(got, want);
let got = run_compute_state(&mut exec, &properties, &route_table2, &FakePing::default())
.expect(
"error calling compute_state, want Local state due to no matching default route",
);
let want =
Some(IpVersions::<StateEvent>::construct(StateEvent { state: State::Local, time }));
assert_eq!(got, want);
let got = run_compute_state(
&mut exec,
&properties,
&route_table,
&mut FakePing {
gateway_addrs: [std_ip!("1.2.3.1"), std_ip!("123::1")].iter().cloned().collect(),
gateway_response: true,
internet_response: false,
},
)
.expect("error calling compute_state, want Gateway state");
let want =
Some(IpVersions::<StateEvent>::construct(StateEvent { state: State::Gateway, time }));
assert_eq!(got, want);
let got = run_compute_state(
&mut exec,
&properties,
&route_table,
&mut FakePing {
gateway_addrs: [std_ip!("1.2.3.1"), std_ip!("123::1")].iter().cloned().collect(),
gateway_response: true,
internet_response: true,
},
)
.expect("error calling compute_state, want Internet state");
let want =
Some(IpVersions::<StateEvent>::construct(StateEvent { state: State::Internet, time }));
assert_eq!(got, want);
} | rust_cleaned_test_functions.jsonl/64393 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3377
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57028,
4387,
368,
341,
286,
1077,
5888,
284,
282,
4711,
72960,
9927,
486,
7903,
341,
310,
877,
25,
3034,
16,
345,
310,
829,
25,
17768,
3012,
15373,
31561,
4708,
2389,
3904,
3148,
310,
3671,
4790... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_update_config_deep() {
let mut doc = create_doc();
handle_update_configuration(&mut doc, "a.b.c.d.e.f.g.h", "true").unwrap();
assert!(doc["a"]["b"]["c"]["d"]["e"]["f"]["g"]["h"]
.as_bool()
.unwrap())
} | rust_cleaned_test_functions.jsonl/134245 | {
"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,
8882,
5332,
87044,
368,
341,
286,
1077,
5206,
4629,
284,
1855,
18869,
1428,
286,
3705,
8882,
35726,
2099,
6984,
4629,
11,
330,
64,
948,
520,
950,
1734,
833,
1302,
860,
497,
330,
1866,
1827,
1545... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_initable_with_initable_new() {
let test = InitableTestType::new();
assert_eq!(0x123456789abcdef, test.value());
} | rust_cleaned_test_functions.jsonl/600 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 74
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6137,
480,
6615,
6137,
480,
5921,
368,
341,
286,
1077,
1273,
284,
758,
15368,
2271,
929,
486,
931,
543,
286,
2060,
10714,
10297,
15,
87,
16,
17,
18,
19,
20,
21,
22,
23,
24,
41202,
11,
1273,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_serde_deserialize_int() {
use traits::FromPrimitive;
let vals = vec![
0,
1,
81516161,
-370,
-8,
-99999999999,
];
for n in vals {
let expected = BigDecimal::from_i64(n).unwrap();
let value: BigDecimal = serde_json::from_str(&serde_json::to_string(&n).unwrap()).unwrap();
assert_eq!(expected, value);
}
} | rust_cleaned_test_functions.jsonl/75804 | {
"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,
75861,
450,
15768,
9050,
4042,
368,
341,
286,
990,
24055,
486,
3830,
33313,
401,
286,
1077,
28356,
284,
7486,
90515,
310,
220,
15,
345,
310,
220,
16,
345,
310,
220,
23,
16,
20,
16,
21,
16,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_segment() {
let gdt_entry = GdtEntry(0xaf9b000000ffff);
let seg: kvm_segment = gdt_entry.into();
assert_eq!(1, seg.g);
assert_eq!(0, seg.db);
assert_eq!(1, seg.l);
assert_eq!(0, seg.avl);
assert_eq!(1, seg.present);
assert_eq!(0, seg.dpl);
assert_eq!(1, seg.s);
assert_eq!(11, seg.type_);
assert_eq!(0, seg.base);
assert_eq!(1048575, seg.limit);
assert_eq!(0, seg.unusable);
} | rust_cleaned_test_functions.jsonl/12650 | {
"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,
28061,
368,
341,
286,
1077,
342,
8047,
9078,
284,
479,
8047,
5874,
7,
15,
54795,
24,
65,
15,
15,
15,
15,
15,
15,
7238,
317,
286,
1077,
4810,
25,
94748,
28061,
284,
342,
8047,
9078,
39860,
14... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ReferenceFrame_rotate() {
let mut some_frame = ReferenceFrame::default();
some_frame.rotate(std::f32::consts::FRAC_PI_4, 0.0, std::f32::consts::FRAC_PI_6);
let correct = Matrix3::from_row_slice(
&[1.0, 0.0, 0.0,
0.0, 0.707, -0.707,
0.0, 0.707, 0.707]);
println!("{:?}", some_frame);
let _ = relative_eq!(some_frame.coordinates, correct);
} | rust_cleaned_test_functions.jsonl/59360 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 234
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
98790,
4369,
60834,
368,
1476,
286,
1077,
5206,
1045,
8929,
284,
17207,
4369,
486,
2258,
543,
286,
1045,
8929,
35944,
5194,
486,
69,
18,
17,
486,
95773,
486,
10504,
1706,
20212,
62,
19,
11,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_guild_prune_all() {
let include_roles = [Id::new(1), Id::new(2)];
let route = Route::CreateGuildPrune {
compute_prune_count: Some(true),
days: Some(4),
guild_id: GUILD_ID,
include_roles: &include_roles,
};
assert_eq!(
route.to_string(),
format!(
"guilds/{guild_id}/prune?compute_prune_count=true&days=4&include_roles=1,2",
guild_id = GUILD_ID
)
);
} | rust_cleaned_test_functions.jsonl/119969 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 317
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
1889,
1498,
5294,
2886,
5705,
368,
341,
286,
1077,
2924,
43061,
284,
508,
764,
486,
931,
7,
16,
701,
5223,
486,
931,
7,
17,
73663,
286,
1077,
6021,
284,
9572,
486,
4021,
72574,
3533,
288... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_operator_names() {
let ir = ir_from_cc(
r#"
// TOOD(b/208377928): Use #include <stddef.h> instead of declaring `size_t` ourselves...
using size_t = unsigned long;
#pragma clang lifetime_elision
struct SomeStruct {
// There is an implicit/default `oparator=` hidden here as well.
void* operator new(size_t size);
void* operator new[](size_t size);
bool operator==(const SomeStruct& other) const;
};"#,
)
.unwrap();
let operator_names: HashSet<&str> = ir
.functions()
.filter(|f| {
f.member_func_metadata
.as_ref()
.map(|m| m.find_record(&ir).unwrap().rs_name == "SomeStruct")
.unwrap_or_default()
})
.flat_map(|f| match &f.name {
UnqualifiedIdentifier::Operator(op) => Some(op.name.as_ref()),
_ => None,
})
.collect();
assert!(operator_names.contains("="));
assert!(operator_names.contains("new"));
assert!(operator_names.contains("new[]"));
assert!(operator_names.contains("=="));
} | rust_cleaned_test_functions.jsonl/37224 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 577
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40594,
9187,
368,
341,
262,
1077,
6216,
284,
6216,
5673,
28955,
1006,
286,
435,
2,
698,
286,
442,
5146,
2069,
1883,
14,
17,
15,
23,
18,
22,
22,
24,
17,
23,
1648,
5443,
671,
997,
366,
66397,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_szabo() {
let s = to_chars("szabo");
let cur = &mut 0;
expect_next_token(&s, cur, Token::Szabo);
} | rust_cleaned_test_functions.jsonl/21090 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 83
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33945,
47421,
368,
341,
286,
1077,
274,
284,
311,
37418,
445,
14357,
47421,
797,
286,
1077,
2847,
284,
609,
6984,
220,
15,
280,
286,
1720,
11257,
6458,
2099,
82,
11,
2847,
11,
9660,
486,
89837,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_data_populated() {
// Attempt to create system account in account with populated data
let new_owner = Pubkey::new(&[9; 32]);
let from = Pubkey::new_unique();
let from_account = AccountSharedData::new(100, 0, &system_program::id());
let populated_key = Pubkey::new_unique();
let populated_account = AccountSharedData::from(Account {
data: vec![0, 1, 2, 3],
..Account::default()
});
process_instruction(
&bincode::serialize(&SystemInstruction::CreateAccount {
lamports: 50,
space: 2,
owner: new_owner,
})
.unwrap(),
vec![(from, from_account), (populated_key, populated_account)],
vec![
AccountMeta {
pubkey: from,
is_signer: true,
is_writable: false,
},
AccountMeta {
pubkey: populated_key,
is_signer: true,
is_writable: false,
},
],
Err(SystemError::AccountAlreadyInUse.into()),
super::process_instruction,
);
} | rust_cleaned_test_functions.jsonl/95879 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 689
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
1769,
17061,
7757,
368,
341,
286,
442,
43517,
311,
1855,
1849,
2692,
304,
2692,
448,
34359,
821,
198,
286,
1077,
501,
29027,
284,
22611,
792,
486,
931,
2099,
58,
24,
26,
220,
18,
17,
255... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sort_to_indices_strings() {
test_sort_to_indices_string_arrays(
vec![
None,
Some("bad"),
Some("sad"),
None,
Some("glad"),
Some("-ad"),
],
None,
None,
vec![0, 3, 5, 1, 4, 2],
);
test_sort_to_indices_string_arrays(
vec![
None,
Some("bad"),
Some("sad"),
None,
Some("glad"),
Some("-ad"),
],
Some(SortOptions {
descending: true,
nulls_first: false,
}),
None,
vec![2, 4, 1, 5, 3, 0],
);
test_sort_to_indices_string_arrays(
vec![
None,
Some("bad"),
Some("sad"),
None,
Some("glad"),
Some("-ad"),
],
Some(SortOptions {
descending: false,
nulls_first: true,
}),
None,
vec![0, 3, 5, 1, 4, 2],
);
test_sort_to_indices_string_arrays(
vec![
None,
Some("bad"),
Some("sad"),
None,
Some("glad"),
Some("-ad"),
],
Some(SortOptions {
descending: true,
nulls_first: true,
}),
None,
vec![3, 0, 2, 4, 1, 5],
);
test_sort_to_indices_string_arrays(
vec![
None,
Some("bad"),
Some("sad"),
None,
Some("glad"),
Some("-ad"),
],
Some(SortOptions {
descending: true,
nulls_first: true,
}),
Some(3),
vec![3, 0, 2],
);
// valid values less than limit with extra nulls
test_sort_to_indices_string_arrays(
vec![Some("def"), None, None, Some("abc")],
Some(SortOptions {
descending: false,
nulls_first: false,
}),
Some(3),
vec![3, 0, 1],
);
test_sort_to_indices_string_arrays(
vec![Some("def"), None, None, Some("abc")],
Some(SortOptions {
descending: false,
nulls_first: true,
}),
Some(3),
vec![1, 2, 3],
);
// more nulls than limit
test_sort_to_indices_string_arrays(
vec![Some("def"), None, None, None],
Some(SortOptions {
descending: false,
nulls_first: true,
}),
Some(2),
vec![1, 2],
);
test_sort_to_indices_string_arrays(
vec![Some("def"), None, None, None],
Some(SortOptions {
descending: false,
nulls_first: false,
}),
Some(2),
vec![0, 1],
);
} | rust_cleaned_test_functions.jsonl/6168 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2132
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18435,
2346,
18333,
33500,
368,
341,
286,
1273,
18435,
2346,
18333,
3904,
68983,
1006,
310,
7486,
90515,
394,
2240,
345,
394,
4329,
445,
13855,
4461,
394,
4329,
445,
82114,
4461,
394,
2240,
345,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_module_is_not_empty_with_space_only() {
let name = "unit_test";
let desc = "This is a unit test";
let module = Module {
config: None,
name: name.to_string(),
description: desc.to_string(),
segments: vec![Segment::new(None, " ")],
duration: Duration::default(),
};
assert!(!module.is_empty());
} | rust_cleaned_test_functions.jsonl/134135 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 210
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10750,
6892,
7913,
15124,
6615,
14663,
18410,
368,
341,
286,
1077,
829,
284,
330,
3843,
4452,
876,
286,
1077,
6560,
284,
330,
1986,
374,
264,
4982,
1273,
876,
286,
1077,
4688,
284,
13711,
341,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_soa() {
let zone = example_zone_v2();
let soa = zone.0.borrow().find_soa().unwrap();
let soa_record = DnsTypeSOA::new(
"a.root-servers.net.",
"nstld.verisign-grs.com.",
2021033102,
1800,
900,
604800,
86400,
)
.unwrap();
let soa = soa.borrow();
assert_eq!(soa.content().len(), 1);
assert_eq!(soa.content()[0].get_type(), DNSType::SOA);
assert_eq!(soa.content()[0].get_dname().to_string(), ".");
assert_eq!(
soa.content()[0].get_data().as_ref().unwrap().to_string(),
"a.root-servers.net. nstld.verisign-grs.com. ( 2021033102 1800 900 604800 86400 )"
);
assert_eq!(
soa.content()[0]
.get_data()
.as_ref()
.unwrap()
.as_any()
.downcast_ref::<DnsTypeSOA>(),
Some(&soa_record)
);
} | rust_cleaned_test_functions.jsonl/29057 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 624
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
643,
19533,
368,
341,
286,
1077,
10143,
284,
3110,
28692,
2273,
17,
543,
286,
1077,
773,
64,
284,
10143,
13,
15,
83640,
1005,
3903,
643,
19533,
1005,
15454,
543,
286,
1077,
773,
64,
14192... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_json_payload() {
let key = JwtKey::new("1", N, E);
let mut key_set = KeyStore::new();
key_set.add_key(&key);
let result = key_set.decode(TOKEN);
assert!(result.is_ok());
let jwt = result.unwrap();
assert_eq!("https://chronogears.com/test", jwt.payload().iss().unwrap());
assert_eq!("Ada Lovelace", jwt.payload().get_str("name").unwrap());
assert_eq!("alovelace@chronogears.com", jwt.payload().get_str("email").unwrap());
} | rust_cleaned_test_functions.jsonl/124808 | {
"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,
15227,
9455,
32813,
368,
341,
286,
1077,
1376,
284,
54369,
1592,
486,
931,
445,
16,
497,
451,
11,
468,
626,
286,
1077,
5206,
1376,
2602,
284,
5309,
6093,
486,
931,
1428,
286,
1376,
2602,
1364,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_check_ro_durable_nonce_fails() {
let mut feature_set = FeatureSet::all_enabled();
feature_set.deactivate(&tx_wide_compute_cap::id());
let (mut bank, _mint_keypair, custodian_keypair, nonce_keypair) =
setup_nonce_with_bank(10_000_000, |_| {}, 5_000_000, 250_000, None, feature_set)
.unwrap();
Arc::get_mut(&mut bank)
.unwrap()
.activate_feature(&feature_set::nonce_must_be_writable::id());
let custodian_pubkey = custodian_keypair.pubkey();
let nonce_pubkey = nonce_keypair.pubkey();
let nonce_hash = get_nonce_blockhash(&bank, &nonce_pubkey).unwrap();
let account_metas = vec![
AccountMeta::new_readonly(nonce_pubkey, false),
#[allow(deprecated)]
AccountMeta::new_readonly(sysvar::recent_blockhashes::id(), false),
AccountMeta::new_readonly(nonce_pubkey, true),
];
let nonce_instruction = Instruction::new_with_bincode(
system_program::id(),
&system_instruction::SystemInstruction::AdvanceNonceAccount,
account_metas,
);
let tx = Transaction::new_signed_with_payer(
&[nonce_instruction],
Some(&custodian_pubkey),
&[&custodian_keypair, &nonce_keypair],
nonce_hash,
);
// SanitizedMessage::get_durable_nonce returns None because nonce
// account is not writable. Durable nonce and blockhash domains are
// transaction is not found in the hash queue.
assert_eq!(
bank.process_transaction(&tx),
Err(TransactionError::BlockhashNotFound),
);
// Kick nonce hash off the blockhash_queue
for _ in 0..MAX_RECENT_BLOCKHASHES + 1 {
goto_end_of_slot(Arc::get_mut(&mut bank).unwrap());
bank = Arc::new(new_from_parent(&bank));
}
// Caught by the runtime because it is a nonce transaction
assert_eq!(
bank.process_transaction(&tx),
Err(TransactionError::BlockhashNotFound)
);
assert_eq!(
bank.check_transaction_for_nonce(
&SanitizedTransaction::from_transaction_for_tests(tx),
true, // enable_durable_nonce
&bank.next_durable_nonce(),
),
None
);
} | rust_cleaned_test_functions.jsonl/28933 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1174
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
26608,
814,
18329,
48508,
761,
6209,
368,
341,
286,
1077,
5206,
4565,
2602,
284,
19998,
1649,
486,
541,
18220,
543,
286,
4565,
2602,
2285,
16856,
2099,
3998,
1670,
577,
57028,
16388,
486,
30... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_tile_write() {
let (fi, mut fs, mut fb, frame_rate) = setup(160, 144);
{
let ti = TilingInfo::from_target_tiles(
fi.sb_size_log2(),
fi.width,
fi.height,
frame_rate,
2,
2,
false,
);
let iter = ti.tile_iter_mut(&mut fs, &mut fb);
let mut tile_states = iter.map(|ctx| ctx.ts).collect::<Vec<_>>();
{
// row 12 of Y-plane of the top-left tile
let tile_plane = &mut tile_states[0].rec.planes[0];
let row = &mut tile_plane[12];
assert_eq!(64, row.len());
row[35..41].copy_from_slice(&[4, 42, 12, 18, 15, 31]);
}
{
// row 8 of U-plane of the middle-right tile
let tile_plane = &mut tile_states[5].rec.planes[1];
let row = &mut tile_plane[8];
assert_eq!(32, row.len());
row[..4].copy_from_slice(&[14, 121, 1, 3]);
}
{
// row 1 of V-plane of the bottom-middle tile
let tile_plane = &mut tile_states[7].rec.planes[2];
let row = &mut tile_plane[1];
assert_eq!(32, row.len());
row[11..16].copy_from_slice(&[6, 5, 2, 11, 8]);
}
}
// check that writes on tiles correctly affected the underlying frame
let plane = &fs.rec.planes[0];
let y = plane.cfg.yorigin + 12;
let x = plane.cfg.xorigin + 35;
let idx = y * plane.cfg.stride + x;
assert_eq!(&[4, 42, 12, 18, 15, 31], &plane.data[idx..idx + 6]);
let plane = &fs.rec.planes[1];
let offset = (64, 32);
let y = plane.cfg.yorigin + offset.1 + 8;
let x = plane.cfg.xorigin + offset.0;
let idx = y * plane.cfg.stride + x;
assert_eq!(&[14, 121, 1, 3], &plane.data[idx..idx + 4]);
let plane = &fs.rec.planes[2];
let offset = (32, 64);
let y = plane.cfg.yorigin + offset.1 + 1;
let x = plane.cfg.xorigin + offset.0 + 11;
let idx = y * plane.cfg.stride + x;
assert_eq!(&[6, 5, 2, 11, 8], &plane.data[idx..idx + 5]);
} | rust_cleaned_test_functions.jsonl/30657 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 980
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29844,
9165,
368,
341,
262,
1077,
320,
9983,
11,
5206,
8619,
11,
5206,
25469,
11,
4034,
9246,
8,
284,
6505,
7,
16,
21,
15,
11,
220,
16,
19,
19,
626,
262,
341,
6926,
414,
1077,
8988,
284,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serialize_option_none() {
let data = ArcSwapOption::<Foo>::from_pointee(None);
let data_str = serde_json::to_string(&data).unwrap();
let data_deser = serde_json::from_str::<Option<Foo>>(&data_str).unwrap();
assert_eq!(data_deser, None);
} | rust_cleaned_test_functions.jsonl/122522 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
9672,
31488,
368,
341,
286,
1077,
821,
284,
19689,
46179,
5341,
27638,
40923,
6831,
1499,
6085,
2127,
26717,
626,
286,
1077,
821,
2895,
284,
61570,
9455,
486,
983,
3904,
2099,
691,
568,
154... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_valid() -> Result<()> {
let manager = DuckdbConnectionManager::file(":memory:")?;
let pool = r2d2::Pool::builder()
.max_size(1)
.test_on_check_out(true)
.build(manager)
.unwrap();
pool.get().unwrap();
Ok(())
} | rust_cleaned_test_functions.jsonl/55270 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 174
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
8337,
368,
1464,
5714,
71698,
341,
286,
1077,
6645,
284,
45770,
1999,
4526,
2043,
486,
1192,
18893,
17269,
90220,
37445,
286,
1077,
7314,
284,
435,
17,
67,
17,
486,
10551,
486,
17850,
741,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_mock_preserves_header_order() {
let mut expected_headers = Vec::new();
let mut mock = mock("GET", "/");
// Add a large number of headers so getting the same order accidentally is unlikely.
for i in 0..100 {
let field = format!("x-custom-header-{}", i);
let value = "test";
mock = mock.with_header(&field, value);
expected_headers.push(format!("{}: {}", field, value));
}
let _m = mock.create();
let (_, headers, _) = request("GET /", "");
let custom_headers: Vec<_> = headers
.into_iter()
.filter(|header| header.starts_with("x-custom-header"))
.collect();
assert_eq!(custom_headers, expected_headers);
} | rust_cleaned_test_functions.jsonl/82402 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 288
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34134,
32116,
13280,
8757,
7869,
368,
341,
262,
1077,
5206,
3601,
26719,
284,
11312,
486,
931,
543,
262,
1077,
5206,
7860,
284,
7860,
445,
3806,
497,
3521,
3071,
262,
442,
2691,
264,
3460,
1372,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_to_bytes() {
let u = Uuid::new_v4();
let ub = u.to_bytes();
assert!(ub.len() == 16);
assert!(! ub.iter().all(|&b| b == 0));
} | rust_cleaned_test_functions.jsonl/58276 | {
"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,
2346,
12524,
368,
341,
286,
1077,
575,
284,
547,
2423,
486,
931,
2273,
19,
543,
286,
1077,
17910,
284,
575,
2389,
12524,
1428,
286,
2060,
10297,
392,
19406,
368,
621,
220,
16,
21,
317,
286,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_xchg() {
let mut state = State8080::empty_state();
state.memory = vec![0xeb];
state.d = 0x12;
state.e = 0x34;
state.h = 0x56;
state.l = 0x78;
emulate_8080_op(&mut state);
assert_eq!(state.d, 0x56);
assert_eq!(state.e, 0x78);
assert_eq!(state.h, 0x12);
assert_eq!(state.l, 0x34);
} | rust_cleaned_test_functions.jsonl/7793 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 229
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3212,
65940,
368,
341,
286,
1077,
5206,
1584,
284,
3234,
23,
15,
23,
15,
486,
3194,
4387,
543,
286,
1584,
36611,
284,
7486,
20703,
15,
54468,
935,
286,
1584,
950,
284,
220,
15,
87,
16,
17,
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_replica_read_lock_checker_for_single_uuid() {
let cm = ConcurrencyManager::new(1.into());
let checker = ReplicaReadLockChecker::new(cm);
let mut m = eraftpb::Message::default();
m.set_msg_type(MessageType::MsgReadIndex);
let uuid = Uuid::new_v4();
let mut e = eraftpb::Entry::default();
e.set_data(uuid.as_bytes().to_vec());
m.mut_entries().push(e);
checker.on_step(&mut m);
assert_eq!(m.get_entries()[0].get_data(), uuid.as_bytes());
} | rust_cleaned_test_functions.jsonl/22490 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 260
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25533,
15317,
6443,
9818,
62715,
5478,
19487,
25540,
368,
341,
286,
1077,
9961,
284,
1200,
15973,
2043,
486,
931,
7,
16,
39860,
1423,
286,
1077,
40915,
284,
94036,
4418,
11989,
35188,
486,
931,
51... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
let deserializer = JsonDeserializer::default();
let data = r#"{"secs":123,"nanos":456}"#;
let d = Duration::new(123, 456);
let mut cur = Cursor::new(data.clone());
let mut s = Duration::default();
deserializer.deserialize_to("topic", &mut cur, &mut s).unwrap();
assert_eq!(cur.position() as usize, data.len());
assert_eq!(s, d);
cur.set_position(0);
assert_eq!(deserializer.deserialize("topic", &mut cur).unwrap(), d);
} | rust_cleaned_test_functions.jsonl/128067 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 250
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15768,
9050,
368,
341,
286,
1077,
939,
41939,
284,
8308,
80097,
486,
2258,
543,
286,
1077,
821,
284,
435,
55543,
4913,
53281,
788,
16,
17,
18,
1335,
18759,
436,
788,
19,
20,
21,
9863,
2,
280,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_scan_buses_for_target_time() {
let (target, schedule_line) = extract_schedules(SAMPLE);
let scheduler = Scheduler::from_input(schedule_line);
let result = scheduler.scan_buses_for_target_time(target);
assert_eq!(result, (5, 59));
} | rust_cleaned_test_functions.jsonl/54390 | {
"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,
28857,
880,
4776,
5478,
11123,
3009,
368,
341,
286,
1077,
320,
5657,
11,
9700,
6528,
8,
284,
8649,
643,
49613,
3759,
18918,
317,
286,
1077,
28809,
284,
44759,
486,
1499,
5898,
87712,
6528,
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_oid_iter_length_check() {
use der_parser::oid;
use std::borrow::Cow;
// empty
assert!(Oid::new(Cow::Borrowed(&[])).iter().is_some());
assert!(Oid::new_relative(Cow::Borrowed(&[])).iter().is_some());
// ok
assert!(oid!(0).iter().is_some());
assert!(oid!(1.2).iter().is_some());
assert!(oid!(1.2.3456.23.54).iter().is_some());
// too long
assert!(oid!(1.2.18445618199572250625).iter().is_none());
assert!(oid!(rel 18445618199572250625).iter().is_none());
} | rust_cleaned_test_functions.jsonl/67463 | {
"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,
59633,
11723,
5118,
7200,
368,
341,
262,
990,
2694,
18517,
486,
588,
280,
262,
990,
1460,
486,
71141,
486,
89915,
280,
262,
442,
4287,
198,
262,
2060,
10297,
46,
307,
486,
931,
3025,
363,
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_0009() {
let scope = &te_scope(r#"{}"#);
te_null(false, scope, "0.0 / 0.0", "[division] division by zero");
} | rust_cleaned_test_functions.jsonl/6478 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 63
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
15,
15,
15,
24,
368,
341,
220,
1077,
6891,
284,
609,
665,
23199,
2601,
55543,
6257,
57676,
317,
220,
1013,
15162,
3576,
11,
6891,
11,
330,
15,
13,
15,
608,
220,
15,
13,
15,
497,
10545,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_doc_macro() {
let mut schema_builder = Schema::builder();
let text_field = schema_builder.add_text_field("text", TEXT);
let other_text_field = schema_builder.add_text_field("text2", TEXT);
let document = doc!(text_field => "tantivy",
text_field => "some other value",
other_text_field => "short");
assert_eq!(document.len(), 3);
let values = document.get_all(text_field);
assert_eq!(values.len(), 2);
assert_eq!(values[0].text(), Some("tantivy"));
assert_eq!(values[1].text(), Some("some other value"));
let values = document.get_all(other_text_field);
assert_eq!(values.len(), 1);
assert_eq!(values[0].text(), Some("short"));
} | rust_cleaned_test_functions.jsonl/41954 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 377
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18869,
58810,
368,
341,
286,
1077,
5206,
10802,
28532,
284,
12539,
486,
17850,
543,
286,
1077,
1467,
5013,
284,
10802,
28532,
1364,
4326,
5013,
445,
1318,
497,
15762,
317,
286,
1077,
1008,
4326,
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_chained_merge_split() {
// This test creates a succession of merge events that need to be resolved during
// a split event.
// |\/\ /\ /| <-- merge
// | \/ \ / | <-- merge
// | \/ | <-- merge
// | /\ | <-- split
let mut path = Path::builder();
path.begin(point(1.0, 0.0));
path.line_to(point(2.0, 1.0)); // <-- merge
path.line_to(point(3.0, 0.0));
path.line_to(point(4.0, 2.0)); // <-- merge
path.line_to(point(5.0, 0.0));
path.line_to(point(6.0, 3.0)); // <-- merge
path.line_to(point(7.0, 0.0));
path.line_to(point(7.0, 5.0));
path.line_to(point(4.0, 4.0)); // <-- split
path.line_to(point(1.0, 5.0));
path.end(true);
test_path_and_count_triangles(path.build().as_slice(), 8);
// "M 1 0 L 2 1 L 3 0 L 4 2 L 5 0 L 6 3 L 7 0 L 7 5 L 4 4 L 1 5 Z"
} | rust_cleaned_test_functions.jsonl/102414 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 438
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4138,
2627,
20888,
17052,
368,
341,
262,
442,
1096,
1273,
11450,
264,
49687,
315,
10880,
4357,
429,
1184,
311,
387,
19673,
2337,
198,
262,
442,
264,
6718,
1538,
624,
262,
442,
760,
4739,
59,
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_get_approximate_split_keys() {
let tmp = Builder::new()
.prefix("test_raftstore_util")
.tempdir()
.unwrap();
let path = tmp.path().to_str().unwrap();
let db_opts = DBOptions::new();
let mut cf_opts = ColumnFamilyOptions::new();
cf_opts.set_level_zero_file_num_compaction_trigger(10);
let f = Box::new(RangePropertiesCollectorFactory::default());
cf_opts.add_table_properties_collector_factory("tikv.size-collector", f);
let cfs_opts = LARGE_CFS
.iter()
.map(|cf| CFOptions::new(cf, cf_opts.clone()))
.collect();
let engine = rocks::util::new_engine_opt(path, db_opts, cfs_opts).unwrap();
let cf_handle = engine.cf_handle(CF_DEFAULT).unwrap();
let mut big_value = Vec::with_capacity(256);
big_value.extend(iter::repeat(b'v').take(256));
// total size for one key and value
const ENTRY_SIZE: u64 = 256 + 9;
for i in 0..4 {
let k = format!("key_{:03}", i).into_bytes();
let k = keys::data_key(Key::from_raw(&k).as_encoded());
engine.put_cf(cf_handle, &k, &big_value).unwrap();
// Flush for every key so that we can know the exact middle key.
engine.flush_cf(cf_handle, true).unwrap();
}
let region = make_region(1, vec![], vec![]);
let split_keys =
get_approximate_split_keys(&engine, ®ion, 3 * ENTRY_SIZE, 5 * ENTRY_SIZE, 1)
.unwrap()
.into_iter()
.map(|k| {
Key::from_encoded_slice(keys::origin_key(&k))
.into_raw()
.unwrap()
})
.collect::<Vec<Vec<u8>>>();
assert_eq!(split_keys.is_empty(), true);
for i in 4..5 {
let k = format!("key_{:03}", i).into_bytes();
let k = keys::data_key(Key::from_raw(&k).as_encoded());
engine.put_cf(cf_handle, &k, &big_value).unwrap();
// Flush for every key so that we can know the exact middle key.
engine.flush_cf(cf_handle, true).unwrap();
}
let split_keys =
get_approximate_split_keys(&engine, ®ion, 3 * ENTRY_SIZE, 5 * ENTRY_SIZE, 5)
.unwrap()
.into_iter()
.map(|k| {
Key::from_encoded_slice(keys::origin_key(&k))
.into_raw()
.unwrap()
})
.collect::<Vec<Vec<u8>>>();
assert_eq!(split_keys, vec![b"key_002".to_vec()]);
for i in 5..10 {
let k = format!("key_{:03}", i).into_bytes();
let k = keys::data_key(Key::from_raw(&k).as_encoded());
engine.put_cf(cf_handle, &k, &big_value).unwrap();
// Flush for every key so that we can know the exact middle key.
engine.flush_cf(cf_handle, true).unwrap();
}
let split_keys =
get_approximate_split_keys(&engine, ®ion, 3 * ENTRY_SIZE, 5 * ENTRY_SIZE, 5)
.unwrap()
.into_iter()
.map(|k| {
Key::from_encoded_slice(keys::origin_key(&k))
.into_raw()
.unwrap()
})
.collect::<Vec<Vec<u8>>>();
assert_eq!(split_keys, vec![b"key_002".to_vec(), b"key_005".to_vec()]);
for i in 10..20 {
let k = format!("key_{:03}", i).into_bytes();
let k = keys::data_key(Key::from_raw(&k).as_encoded());
engine.put_cf(cf_handle, &k, &big_value).unwrap();
// Flush for every key so that we can know the exact middle key.
engine.flush_cf(cf_handle, true).unwrap();
}
let split_keys =
get_approximate_split_keys(&engine, ®ion, 3 * ENTRY_SIZE, 5 * ENTRY_SIZE, 5)
.unwrap()
.into_iter()
.map(|k| {
Key::from_encoded_slice(keys::origin_key(&k))
.into_raw()
.unwrap()
})
.collect::<Vec<Vec<u8>>>();
assert_eq!(
split_keys,
vec![
b"key_002".to_vec(),
b"key_005".to_vec(),
b"key_008".to_vec(),
b"key_011".to_vec(),
b"key_014".to_vec(),
]
);
} | rust_cleaned_test_functions.jsonl/4844 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2550
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
90425,
3426,
17052,
12631,
368,
341,
286,
1077,
4174,
284,
20626,
486,
931,
741,
310,
659,
11849,
445,
1944,
62,
2944,
4314,
18974,
1138,
310,
659,
3888,
3741,
741,
310,
659,
15454,
543,
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... | 5 |
#[test]
fn test_partial_eq() {
let mut bytes: [u8; 32] = [0; 32];
bytes[0] = 5;
bytes[1] = 10;
let h256 = H256::from_slice(&bytes);
let h256_le = H256Le::from_bytes_be(&bytes);
assert_eq!(h256, h256_le);
assert_eq!(h256_le, h256);
} | rust_cleaned_test_functions.jsonl/90670 | {
"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,
52068,
10714,
368,
341,
286,
1077,
5206,
5820,
25,
508,
84,
23,
26,
220,
18,
17,
60,
284,
508,
15,
26,
220,
18,
17,
935,
286,
5820,
58,
15,
60,
284,
220,
20,
280,
286,
5820,
58,
16,
60,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vote_twice() {
let mut context = VMContextBuilder::new();
testing_env!(context.predecessor_account_id(accounts(1)).build());
let mut contract = Contract::new(
Config::test_config(),
VersionedPolicy::Default(vec![accounts(1).into(), accounts(2).into()]),
);
let id = create_proposal(&mut context, &mut contract);
contract.act_proposal(id, Action::VoteApprove, None);
contract.act_proposal(id, Action::VoteApprove, None);
} | rust_cleaned_test_functions.jsonl/16638 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 226
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54360,
54178,
558,
368,
341,
286,
1077,
5206,
2266,
284,
17792,
1972,
3297,
486,
931,
543,
286,
7497,
15879,
10297,
2147,
6225,
26911,
269,
13500,
842,
91868,
7,
16,
4579,
5834,
1423,
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_recovery() {
let ledger_path = get_tmp_ledger_path_auto_delete!();
let blockstore = Blockstore::open(ledger_path.path()).unwrap();
let slot = 1;
let (data_shreds, coding_shreds, leader_schedule_cache) =
setup_erasure_shreds(slot, 0, 100);
blockstore
.insert_shreds(coding_shreds, Some(&leader_schedule_cache), false)
.unwrap();
let shred_bufs: Vec<_> = data_shreds
.iter()
.map(|shred| shred.payload.clone())
.collect();
// Check all the data shreds were recovered
for (s, buf) in data_shreds.iter().zip(shred_bufs) {
assert_eq!(
blockstore
.get_data_shred(s.slot(), s.index() as u64)
.unwrap()
.unwrap(),
buf
);
}
verify_index_integrity(&blockstore, slot);
} | rust_cleaned_test_functions.jsonl/9574 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 522
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
91475,
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,
1428,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_large_needle() {
let haystack = "111 a 111b";
let needle = "111 a 111bZ".to_string();
search_test!(haystack, &needle, None);
} | rust_cleaned_test_functions.jsonl/19395 | {
"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,
45228,
71506,
273,
368,
341,
286,
1077,
88447,
284,
330,
16,
16,
16,
264,
220,
16,
16,
16,
65,
876,
286,
1077,
30309,
284,
330,
16,
16,
16,
264,
220,
16,
16,
16,
65,
57,
3263,
983,
3904,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_read() {
let (_tmp, path) = tmpdir("test-glob");
dump(path.clone() + "/foo", vec![1, 2, 3]);
assert!(read(path.clone() + "/foo") == vec![1, 2, 3]);
} | rust_cleaned_test_functions.jsonl/74391 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 82
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
368,
341,
220,
1077,
5453,
5173,
11,
1815,
8,
284,
4174,
3741,
445,
1944,
2371,
1684,
797,
220,
10276,
5581,
15997,
368,
488,
3521,
7975,
497,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_inspect_log_counters() {
let _executor = fasync::TestExecutor::new();
let (inspect_tree, _persistence_stream) = fake_inspect_tree();
let last = fake_iface_stats(10);
let current = fake_iface_stats(20);
log_counters_to_inspect(1, &last, ¤t, inspect_tree.clone());
assert_data_tree!(inspect_tree.inspector, root: contains {
client_stats: contains {
counters: {
"0": {
"@time": AnyProperty,
iface: 1u64,
tx_total: 10u64,
tx_drop: 30u64,
rx_total: 10u64,
rx_drop: 30u64,
}
}
}
})
} | rust_cleaned_test_functions.jsonl/50939 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 492
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34386,
987,
5224,
85632,
368,
341,
286,
1077,
716,
80787,
284,
282,
7692,
486,
2271,
25255,
486,
931,
543,
286,
1077,
320,
82054,
11663,
11,
716,
79,
8026,
12673,
8,
284,
12418,
34386,
987,
1166... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_handle_invalid_time_error() {
let cases = vec![
(0, false, true, false), //warning
(0, true, true, false), //warning
(FLAG_IN_INSERT_STMT, false, true, false), //warning
(FLAG_IN_UPDATE_OR_DELETE_STMT, false, true, false), //warning
(FLAG_IN_UPDATE_OR_DELETE_STMT, true, false, true), //error
(FLAG_IN_INSERT_STMT, true, false, true), //error
];
for (flags, strict_sql_mode, is_ok, is_empty) in cases {
let err = Error::invalid_time_format("");
let mut cfg = EvalConfig::new();
cfg.set_by_flags(flags).set_strict_sql_mode(strict_sql_mode);
let mut ctx = EvalContext::new(Arc::new(cfg));
assert_eq!(ctx.handle_invalid_time_error(err).is_ok(), is_ok);
assert_eq!(ctx.take_warnings().warnings.is_empty(), is_empty);
}
} | rust_cleaned_test_functions.jsonl/75323 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 549
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10630,
31433,
3009,
4096,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
3374,
310,
320,
15,
11,
895,
11,
830,
11,
895,
701,
6526,
442,
18928,
198,
310,
320,
15,
11,
830,
11,
830,
11,
895,
701... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_param_type_display() {
assert_eq!(format!("{}", ParamType::Address), "address".to_owned());
assert_eq!(format!("{}", ParamType::Bytes), "bytes".to_owned());
assert_eq!(format!("{}", ParamType::FixedBytes(32)), "bytes32".to_owned());
assert_eq!(format!("{}", ParamType::Uint(256)), "uint256".to_owned());
assert_eq!(format!("{}", ParamType::Int(64)), "int64".to_owned());
assert_eq!(format!("{}", ParamType::Bool), "bool".to_owned());
assert_eq!(format!("{}", ParamType::String), "string".to_owned());
assert_eq!(format!("{}", ParamType::Array(Box::new(ParamType::Bool))), "bool[]".to_owned());
assert_eq!(format!("{}", ParamType::FixedArray(Box::new(ParamType::Uint(256)), 2)), "uint256[2]".to_owned());
assert_eq!(format!("{}", ParamType::FixedArray(Box::new(ParamType::String), 2)), "string[2]".to_owned());
assert_eq!(
format!("{}", ParamType::FixedArray(Box::new(ParamType::Array(Box::new(ParamType::Bool))), 2)),
"bool[][2]".to_owned()
);
} | rust_cleaned_test_functions.jsonl/676 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 407
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4090,
1819,
14825,
368,
341,
197,
6948,
10714,
10297,
2243,
79878,
6991,
929,
486,
4286,
701,
330,
4995,
3263,
983,
51973,
1423,
197,
6948,
10714,
10297,
2243,
79878,
6991,
929,
486,
7078,
701,
33... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_zeroize() {
let mut poly = Poly::monomial(3) + Poly::monomial(2) - 1;
poly.zeroize();
assert!(poly.is_zero());
let mut bi_poly = BivarPoly::random(3, &mut rand::thread_rng());
let random_commitment = bi_poly.commitment();
bi_poly.zeroize();
let zero_commitment = bi_poly.commitment();
assert_ne!(random_commitment, zero_commitment);
let mut rng = rand::thread_rng();
let (x, y): (Fr, Fr) = (Fr::random(&mut rng), Fr::random(&mut rng));
assert_eq!(zero_commitment.evaluate(x, y), G1::identity());
} | rust_cleaned_test_functions.jsonl/49474 | {
"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,
19359,
551,
368,
341,
286,
1077,
5206,
9861,
284,
18767,
486,
1645,
20855,
7,
18,
8,
488,
18767,
486,
1645,
20855,
7,
17,
8,
481,
220,
16,
280,
286,
9861,
25847,
551,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_insert_and_process_published_block() {
let network = Network::LocalNet;
let (mut store, mut blocks, mut outputs, consensus_manager) = create_new_blockchain(network);
let mempool_validator = MempoolValidators::new(
TxInputAndMaturityValidator::new(store.clone()),
TxInputAndMaturityValidator::new(store.clone()),
);
let mempool = Mempool::new(MempoolConfig::default(), mempool_validator);
// Create a block with 4 outputs
let txs = vec![txn_schema!(
from: vec![outputs[0][0].clone()],
to: vec![2 * T, 2 * T, 2 * T, 2 * T]
)];
generate_new_block(&mut store, &mut blocks, &mut outputs, txs, &consensus_manager).unwrap();
// Create 6 new transactions to add to the mempool
let (orphan, _, _) = tx!(1*T, fee: 100*uT);
let orphan = Arc::new(orphan);
let tx2 = txn_schema!(from: vec![outputs[1][0].clone()], to: vec![1*T], fee: 20*uT);
let tx2 = Arc::new(spend_utxos(tx2).0);
let tx3 = txn_schema!(
from: vec![outputs[1][1].clone()],
to: vec![1*T],
fee: 20*uT,
lock: 4,
OutputFeatures::with_maturity(1)
);
let tx3 = Arc::new(spend_utxos(tx3).0);
let tx5 = txn_schema!(
from: vec![outputs[1][2].clone()],
to: vec![1*T],
fee: 20*uT,
lock: 3,
OutputFeatures::with_maturity(2)
);
let tx5 = Arc::new(spend_utxos(tx5).0);
let tx6 = txn_schema!(from: vec![outputs[1][3].clone()], to: vec![1 * T]);
let tx6 = spend_utxos(tx6).0;
mempool.insert(orphan.clone()).unwrap();
mempool.insert(tx2.clone()).unwrap();
mempool.insert(tx3.clone()).unwrap();
mempool.insert(tx5.clone()).unwrap();
mempool.process_published_block(blocks[1].clone().into()).unwrap();
assert_eq!(
mempool
.has_tx_with_excess_sig(orphan.body.kernels()[0].excess_sig.clone())
.unwrap(),
TxStorageResponse::OrphanPool
);
assert_eq!(
mempool
.has_tx_with_excess_sig(tx2.body.kernels()[0].excess_sig.clone())
.unwrap(),
TxStorageResponse::UnconfirmedPool
);
assert_eq!(
mempool
.has_tx_with_excess_sig(tx3.body.kernels()[0].excess_sig.clone())
.unwrap(),
TxStorageResponse::PendingPool
);
assert_eq!(
mempool
.has_tx_with_excess_sig(tx5.body.kernels()[0].excess_sig.clone())
.unwrap(),
TxStorageResponse::PendingPool
);
assert_eq!(
mempool
.has_tx_with_excess_sig(tx6.body.kernels()[0].excess_sig.clone())
.unwrap(),
TxStorageResponse::NotStored
);
let snapshot_txs = mempool.snapshot().unwrap();
assert_eq!(snapshot_txs.len(), 4);
assert!(snapshot_txs.contains(&orphan));
assert!(snapshot_txs.contains(&tx2));
assert!(snapshot_txs.contains(&tx3));
assert!(snapshot_txs.contains(&tx5));
let stats = mempool.stats().unwrap();
assert_eq!(stats.total_txs, 4);
assert_eq!(stats.unconfirmed_txs, 1);
assert_eq!(stats.orphan_txs, 1);
assert_eq!(stats.timelocked_txs, 2);
assert_eq!(stats.published_txs, 0);
assert_eq!(stats.total_weight, 120);
generate_block(&mut store, &mut blocks, vec![tx2.deref().clone()], &consensus_manager).unwrap();
mempool.process_published_block(blocks[2].clone().into()).unwrap();
assert_eq!(
mempool
.has_tx_with_excess_sig(orphan.body.kernels()[0].excess_sig.clone())
.unwrap(),
TxStorageResponse::OrphanPool
);
assert_eq!(
mempool
.has_tx_with_excess_sig(tx2.body.kernels()[0].excess_sig.clone())
.unwrap(),
TxStorageResponse::ReorgPool
);
assert_eq!(
mempool
.has_tx_with_excess_sig(tx3.body.kernels()[0].excess_sig.clone())
.unwrap(),
TxStorageResponse::PendingPool
);
assert_eq!(
mempool
.has_tx_with_excess_sig(tx5.body.kernels()[0].excess_sig.clone())
.unwrap(),
TxStorageResponse::UnconfirmedPool
);
assert_eq!(
mempool
.has_tx_with_excess_sig(tx6.body.kernels()[0].excess_sig.clone())
.unwrap(),
TxStorageResponse::NotStored
);
let snapshot_txs = mempool.snapshot().unwrap();
assert_eq!(snapshot_txs.len(), 3);
assert!(snapshot_txs.contains(&orphan));
assert!(snapshot_txs.contains(&tx3));
assert!(snapshot_txs.contains(&tx5));
let stats = mempool.stats().unwrap();
assert_eq!(stats.total_txs, 4);
assert_eq!(stats.unconfirmed_txs, 1);
assert_eq!(stats.orphan_txs, 1);
assert_eq!(stats.timelocked_txs, 1);
assert_eq!(stats.published_txs, 1);
assert_eq!(stats.total_weight, 120);
} | rust_cleaned_test_functions.jsonl/61209 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2352
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
8378,
11305,
69524,
7113,
368,
341,
262,
1077,
3922,
284,
8141,
486,
7319,
6954,
280,
262,
1077,
320,
6984,
3553,
11,
5206,
10010,
11,
5206,
16275,
11,
23869,
12144,
8,
284,
1855,
5921,
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_cmp_i64_with_unsigned_flag() {
let cases = vec![
(5, false, 3, false, Ordering::Greater),
(u64::MAX as i64, false, 5 as i64, false, Ordering::Less),
(
u64::MAX as i64,
true,
(u64::MAX - 1) as i64,
true,
Ordering::Greater,
),
(u64::MAX as i64, true, 5 as i64, true, Ordering::Greater),
(5, true, i64::MIN, false, Ordering::Greater),
(u64::MAX as i64, true, i64::MIN, false, Ordering::Greater),
(5, true, 3, false, Ordering::Greater),
(i64::MIN, false, 3, true, Ordering::Less),
(5, false, u64::MAX as i64, true, Ordering::Less),
(5, false, 3, true, Ordering::Greater),
];
for (a, b, c, d, e) in cases {
let o = cmp_i64_with_unsigned_flag(a, b, c, d);
assert_eq!(o, e);
}
} | rust_cleaned_test_functions.jsonl/75553 | {
"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,
35193,
5318,
21,
19,
6615,
67830,
10933,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
320,
20,
11,
895,
11,
220,
18,
11,
895,
11,
68621,
486,
41366,
1326,
310,
320,
84,
21,
19,
486,
105... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_mutable_args_once() {
assert_eq!((2, 2), mutable_args_once(1, 1));
assert_eq!((2, 2), mutable_args_once(1, 1));
assert_eq!((2, 2), mutable_args_once(5, 6));
} | rust_cleaned_test_functions.jsonl/13153 | {
"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,
717,
5922,
8384,
7630,
368,
341,
262,
2060,
10714,
0,
1188,
17,
11,
220,
17,
701,
25804,
8384,
7630,
7,
16,
11,
220,
16,
1106,
262,
2060,
10714,
0,
1188,
17,
11,
220,
17,
701,
25804,
8384,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_message_parse() {
let ie_bytes = [InformationElementType::RATType as u8,
0, 1, // Length
0, // Spare
0x5 // EPS Bearer ID
];
if let Some((ie, _pos)) = InformationElement::parse(&ie_bytes) {
// Parsing was successful
assert_eq!(ie.eps_bearer_id, 0x5);
}
else {
assert!(false);
}
} | rust_cleaned_test_functions.jsonl/86350 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 233
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6462,
21039,
368,
341,
286,
1077,
29858,
12524,
284,
508,
14873,
50945,
486,
49,
828,
929,
438,
575,
23,
345,
310,
220,
15,
11,
220,
16,
11,
442,
17287,
198,
310,
220,
15,
11,
442,
95205,
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... | 2 |
#[test]
fn test_coersion_scalar_and_list() {
use crate::datatypes::DataType::*;
assert_eq!(
List(Box::new(Field::new("item", Float64, true))),
coerce_data_type(vec![
&Float64,
&List(Box::new(Field::new("item", Float64, true)))
])
.unwrap()
);
assert_eq!(
List(Box::new(Field::new("item", Float64, true))),
coerce_data_type(vec![
&Float64,
&List(Box::new(Field::new("item", Int64, true)))
])
.unwrap()
);
assert_eq!(
List(Box::new(Field::new("item", Int64, true))),
coerce_data_type(vec![
&Int64,
&List(Box::new(Field::new("item", Int64, true)))
])
.unwrap()
);
assert_eq!(
List(Box::new(Field::new("item", Utf8, true))),
coerce_data_type(vec![
&Boolean,
&List(Box::new(Field::new("item", Float64, true)))
])
.unwrap()
);
} | rust_cleaned_test_functions.jsonl/87883 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 689
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11393,
1325,
41652,
8378,
2019,
368,
341,
286,
990,
17717,
486,
5911,
60913,
486,
22653,
79304,
286,
2060,
10714,
33673,
310,
1759,
67758,
486,
931,
57788,
486,
931,
445,
1203,
497,
13001,
21,
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_from_range_node() {
let node = RangeNode {
l: Box::new(Some(ExpressionNode::from(666))),
r: Box::new(Some(ExpressionNode::from(432))),
span: None,
};
let clone = node.clone();
assert_eq!(ExpressionNode::from(node), ExpressionNode::Range(clone));
} | rust_cleaned_test_functions.jsonl/89515 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 166
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
9698,
5084,
368,
341,
286,
1077,
2436,
284,
16437,
1955,
341,
310,
326,
25,
8261,
486,
931,
65405,
55188,
1955,
486,
1499,
7,
21,
21,
21,
41749,
310,
435,
25,
8261,
486,
931,
65405,
5518... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_list_of_results() {
assert_eq!(
format!("{:?}", list_of_results()),
"[Ok(1), Ok(11), Ok(1426), Ok(3)]"
);
} | rust_cleaned_test_functions.jsonl/3828 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 106
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2019,
3575,
13576,
368,
341,
286,
2060,
10714,
33673,
310,
3561,
88928,
25,
52652,
1140,
3575,
13576,
14702,
310,
10545,
11578,
7,
16,
701,
7622,
7,
16,
16,
701,
7622,
7,
16,
19,
17,
21,
701,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_bool_array_not() {
let a = BooleanArray::from_slice(vec![false, true]);
let c = not(&a);
let expected = BooleanArray::from_slice(vec![true, false]);
assert_eq!(c, expected);
} | rust_cleaned_test_functions.jsonl/36446 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 108
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22159,
3858,
7913,
368,
341,
286,
1077,
264,
284,
6992,
1857,
486,
1499,
26488,
25592,
20703,
3849,
11,
830,
2558,
286,
1077,
272,
284,
537,
2099,
64,
626,
286,
1077,
3601,
284,
6992,
1857,
486,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_youtube_live() {
env_logger::init();
Builder::new_current_thread().enable_all().build().unwrap().block_on(async move {
let u = TestUrl::new();
let b = qliveplayer_lib::streamfinder::youtube::Youtube::new();
println!(
"{:?}",
b.get_live(u.youtube_live_url.as_ref()).await.unwrap()
);
});
} | rust_cleaned_test_functions.jsonl/25595 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 183
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4178,
10221,
55203,
368,
341,
262,
6105,
27413,
486,
2327,
543,
262,
20626,
486,
931,
11080,
10814,
1005,
12552,
5705,
1005,
5834,
1005,
15454,
1005,
4574,
4470,
18285,
3271,
341,
286,
1077,
575,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_versions_from_version_string() {
use std::collections::HashSet;
use super::Versions;
assert_eq!(Err("invalid protocol entry"), Versions::from_version_string("a,b"));
assert_eq!(Err("invalid protocol entry"), Versions::from_version_string("1,!"));
{
let mut versions: HashSet<Version> = HashSet::new();
versions.insert(1);
assert_eq!(versions, Versions::from_version_string("1").unwrap().0);
}
{
let mut versions: HashSet<Version> = HashSet::new();
versions.insert(1);
versions.insert(2);
assert_eq!(versions, Versions::from_version_string("1,2").unwrap().0);
}
{
let mut versions: HashSet<Version> = HashSet::new();
versions.insert(1);
versions.insert(2);
versions.insert(3);
assert_eq!(versions, Versions::from_version_string("1-3").unwrap().0);
}
{
let mut versions: HashSet<Version> = HashSet::new();
versions.insert(1);
versions.insert(2);
versions.insert(5);
assert_eq!(versions, Versions::from_version_string("1-2,5").unwrap().0);
}
{
let mut versions: HashSet<Version> = HashSet::new();
versions.insert(1);
versions.insert(3);
versions.insert(4);
versions.insert(5);
assert_eq!(versions, Versions::from_version_string("1,3-5").unwrap().0);
}
} | rust_cleaned_test_functions.jsonl/15612 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 773
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
65148,
5673,
9438,
3904,
368,
341,
286,
990,
1460,
486,
51137,
486,
44601,
401,
286,
990,
2256,
486,
69015,
401,
286,
2060,
10714,
10297,
7747,
445,
11808,
11507,
4343,
3975,
85174,
486,
1499,
943... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_transfer_native() {
new_test_ext().execute_with(|| {
Pallet::<Test>::transfer_native(
Origin::signed(FROM_ACCOUNT),
TO_ACCOUNT,
TRANSFER_AMOUNT,
true,
)
.expect("transfer_native should work");
assert_eq!(
Pallet::<Test>::total_balance(ASSET_ID, &FROM_ACCOUNT),
INIT_AMOUNT - TRANSFER_AMOUNT
);
assert_eq!(
Pallet::<Test>::total_balance(ASSET_ID, &TO_ACCOUNT),
INIT_AMOUNT + TRANSFER_AMOUNT
);
});
} | rust_cleaned_test_functions.jsonl/9167 | {
"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,
35403,
44494,
368,
341,
8638,
4452,
9927,
1005,
10257,
6615,
79453,
341,
197,
10025,
7464,
27638,
2271,
6831,
24188,
44494,
1006,
298,
197,
13298,
486,
2215,
7832,
3361,
38831,
1326,
298,
197,
5207,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_filter_authenticated() {
let uuid = Uuid::parse_str(UUID).unwrap_or_default();
let profile = some_profile();
let authenticated = UsersAuthenticated::from(&profile);
assert_eq!(authenticated.user_uuid, uuid);
assert_eq!(authenticated.first_name, None);
assert_eq!(authenticated.last_name, None);
assert_eq!(authenticated.username, USERNAME);
assert_eq!(authenticated.email, Some(EMAIL.to_owned()));
} | rust_cleaned_test_functions.jsonl/62145 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 206
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8727,
64913,
368,
341,
286,
1077,
16040,
284,
547,
2423,
486,
6400,
2895,
65664,
568,
15454,
8734,
9993,
543,
286,
1077,
5526,
284,
1045,
13789,
543,
286,
1077,
37260,
284,
14627,
26712,
486,
1499... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tiledinputpart_file_name_success() {
let input = MultiPartInputFile::new(&*SRC_IMAGE_PATH, 0, true).unwrap();
let tiled_input_part = TiledInputPart::new(&input, 0);
let result = tiled_input_part.file_name();
assert_eq!(&*SRC_IMAGE_PATH, &result);
} | rust_cleaned_test_functions.jsonl/59286 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
2181,
1355,
4480,
2458,
1269,
18632,
368,
341,
286,
1077,
1946,
284,
17439,
5800,
2505,
1703,
486,
931,
2099,
9,
56017,
19121,
7944,
11,
220,
15,
11,
830,
568,
15454,
543,
286,
1077,
81870,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bank_new() {
let dummy_leader_pubkey = Pubkey::new_rand();
let dummy_leader_lamports = BOOTSTRAP_VALIDATOR_LAMPORTS;
let mint_lamports = 10_000;
let GenesisConfigInfo {
mut genesis_config,
mint_keypair,
voting_keypair,
..
} = create_genesis_config_with_leader(
mint_lamports,
&dummy_leader_pubkey,
dummy_leader_lamports,
);
genesis_config.rent = Rent {
lamports_per_byte_year: 5,
exemption_threshold: 1.2,
burn_percent: 5,
};
let bank = Bank::new(&genesis_config);
assert_eq!(bank.get_balance(&mint_keypair.pubkey()), mint_lamports);
assert_eq!(
bank.get_balance(&voting_keypair.pubkey()),
dummy_leader_lamports /* 1 token goes to the vote account associated with dummy_leader_lamports */
);
let rent_account = bank.get_account(&sysvar::rent::id()).unwrap();
let rent = sysvar::rent::Rent::from_account(&rent_account).unwrap();
assert_eq!(rent.burn_percent, 5);
assert_eq!(rent.exemption_threshold, 1.2);
assert_eq!(rent.lamports_per_byte_year, 5);
} | rust_cleaned_test_functions.jsonl/42365 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 615
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35733,
5921,
368,
341,
286,
1077,
17292,
79991,
34014,
792,
284,
22611,
792,
486,
931,
33864,
543,
286,
1077,
17292,
79991,
907,
309,
3394,
284,
83676,
6666,
2537,
27335,
11857,
2351,
1402,
5095,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_min_elo() {
build_test_dir(1_000).unwrap();
let mut path = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap());
path.push("target/debug/psbattletools");
for min_elo_arg in ["--elo", "--minimum-elo"] {
// Should provide lots of output with ELO < 1130 and none above
let normal_output = Command::new(&path)
.arg("statistics")
.arg(min_elo_arg)
.arg("1129")
.arg(&*TEST_ROOT_DIR)
.output()
.expect("Failed to execute command");
assert!(normal_output.status.success(), "command failed");
let normal_output_str = std::str::from_utf8(&normal_output.stdout).unwrap();
assert_eq!(
normal_output_str.to_string().strip_suffix('\n').unwrap(),
*DESIRED_TABLE_OUTPUT
);
let no_output = Command::new(&path)
.arg("statistics")
.arg(min_elo_arg)
.arg("1131")
.arg(&*TEST_ROOT_DIR)
.output()
.expect("Failed to execute command");
assert!(no_output.status.success(), "command failed");
let no_output_str = std::str::from_utf8(&no_output.stdout).unwrap();
assert!(!no_output_str.contains('%'));
assert!(!no_output_str.contains("Rotom"));
}
} | rust_cleaned_test_functions.jsonl/71688 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 651
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7260,
62,
20172,
368,
341,
262,
1936,
4452,
4334,
7,
16,
62,
15,
15,
15,
568,
15454,
543,
262,
1077,
5206,
1815,
284,
7933,
15064,
486,
1499,
5194,
486,
3160,
486,
947,
445,
34,
7581,
46,
25... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_column_i64() {
let fields: Vec<FieldType> = vec![
FieldTypeTp::Tiny.into(),
FieldTypeTp::Short.into(),
FieldTypeTp::Int24.into(),
FieldTypeTp::Long.into(),
FieldTypeTp::LongLong.into(),
FieldTypeTp::Year.into(),
];
let data = vec![
Datum::Null,
Datum::I64(-1),
Datum::I64(12),
Datum::I64(1024),
];
for field in &fields {
let mut column = Column::new(field.as_accessor().tp(), data.len());
for v in &data {
column.append_datum(v).unwrap();
}
for (id, expect) in data.iter().enumerate() {
let get = column.get_datum(id, field).unwrap();
assert_eq!(&get, expect);
}
}
} | rust_cleaned_test_functions.jsonl/80490 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 497
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8744,
5318,
21,
19,
368,
341,
286,
1077,
5043,
25,
11312,
27,
63733,
29,
284,
7486,
90515,
310,
84614,
62241,
486,
85693,
39860,
3148,
310,
84614,
62241,
486,
12472,
39860,
3148,
310,
84614,
62241... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_get_source_code_2() {
let http_server_guard = crate::test_util::http_server();
let (temp_dir, fetcher) = test_setup();
let fetcher_1 = fetcher.clone();
let module_url =
Url::parse("http://localhost:4545/tests/subdir/mismatch_ext.ts").unwrap();
let module_url_1 = module_url.clone();
let module_url_2 = module_url.clone();
let headers_file_name = fetcher.deps_cache.location.join(
fetcher
.deps_cache
.get_cache_filename_with_extension(&module_url, "headers.json"),
);
let fut = fetcher
.get_source_file_async(&module_url, true, false, false)
.then(move |result| {
assert!(result.is_ok());
let r = result.unwrap();
let expected = "export const loaded = true;\n".as_bytes();
assert_eq!(r.source_code, expected);
assert_eq!(&(r.media_type), &msg::MediaType::JavaScript);
assert_eq!(
fetcher
.get_source_code_headers(&module_url)
.mime_type
.unwrap(),
"text/javascript"
);
let _ = fetcher.save_source_code_headers(
&module_url,
Some("text/typescript".to_owned()),
None,
None,
);
fetcher.get_source_file_async(&module_url, true, false, false)
})
.then(move |result2| {
assert!(result2.is_ok());
let r2 = result2.unwrap();
let expected2 = "export const loaded = true;\n".as_bytes();
assert_eq!(r2.source_code, expected2);
assert_eq!(&(r2.media_type), &msg::MediaType::TypeScript);
assert!(fs::read_to_string(&headers_file_name).is_err());
// and don't use cache
let fetcher = setup_file_fetcher(temp_dir.path());
fetcher.get_source_file_async(&module_url_1, false, false, false)
})
.map(move |result3| {
assert!(result3.is_ok());
let r3 = result3.unwrap();
let expected3 = "export const loaded = true;\n".as_bytes();
assert_eq!(r3.source_code, expected3);
assert_eq!(&(r3.media_type), &msg::MediaType::JavaScript);
assert_eq!(
fetcher_1
.get_source_code_headers(&module_url_2)
.mime_type
.unwrap(),
"text/javascript"
);
});
tokio_util::run(fut);
drop(http_server_guard);
} | rust_cleaned_test_functions.jsonl/16752 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1204
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
10347,
4136,
62,
17,
368,
341,
262,
1077,
1758,
12015,
36796,
284,
17717,
486,
1944,
18974,
486,
1254,
12015,
543,
262,
1077,
320,
3888,
4334,
11,
7807,
261,
8,
284,
1273,
21363,
543,
262,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_varlist_combine_deletion() {
let mut lst1: Vec<Var> = vec![];
lst1.push(generate_var2(
0,
0,
5,
vec!["A".to_string(), "G".to_string()],
));
lst1.push(generate_var2(
1,
0,
100,
vec!["TTT".to_string(), "T".to_string()],
));
lst1.push(generate_var2(
2,
0,
200,
vec!["T".to_string(), "G".to_string()],
));
let mut vlst1 = VarList::new(
lst1,
vec!["chr1".to_string(), "chr2".to_string(), "chr3".to_string()],
)
.unwrap();
let mut lst2: Vec<Var> = vec![];
lst2.push(generate_var2(
0,
0,
5,
vec!["A".to_string(), "G".to_string()],
));
lst2.push(generate_var2(
1,
0,
101,
vec!["T".to_string(), "C".to_string()],
));
lst2.push(generate_var2(
2,
0,
200,
vec!["T".to_string(), "G".to_string()],
));
let mut vlst2 = VarList::new(
lst2,
vec!["chr1".to_string(), "chr2".to_string(), "chr3".to_string()],
)
.unwrap();
let mut lst3: Vec<Var> = vec![];
lst3.push(generate_var2(
0,
0,
5,
vec!["A".to_string(), "G".to_string()],
));
lst3.push(generate_var2(
1,
0,
100,
vec!["TTT".to_string(), "T".to_string(), "TCT".to_string()],
));
lst3.push(generate_var2(
2,
0,
200,
vec!["T".to_string(), "G".to_string()],
));
let exp = VarList::new(
lst3,
vec!["chr1".to_string(), "chr2".to_string(), "chr3".to_string()],
)
.unwrap();
vlst1.combine(&mut vlst2).unwrap();
assert_eq!(vlst1.lst[1].alleles, exp.lst[1].alleles);
assert!(varlist_pos_alleles_eq(vlst1, exp));
} | rust_cleaned_test_functions.jsonl/25114 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1389
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4612,
1607,
72374,
2259,
52625,
368,
341,
286,
1077,
5206,
18845,
16,
25,
11312,
27,
3962,
29,
284,
7486,
0,
15078,
286,
18845,
16,
2552,
3268,
13220,
4612,
17,
1006,
310,
220,
15,
345,
310,
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_invalid_try_from_core_no_updated_field() {
let mut properties: BTreeMap<String, Value> = BTreeMap::default();
properties.insert("created".to_string(), "2020-01-02T00:00:00Z".into());
// INVALID - missing "updated" field.
let doc = IotaDocument::try_from_core(
CoreDocument::builder(properties)
.id(valid_did())
.authentication(core_verification_method(&valid_did(), "#auth-key"))
.build()
.unwrap(),
);
assert!(doc.is_err());
} | rust_cleaned_test_functions.jsonl/84322 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 215
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
53283,
5673,
15467,
6536,
33492,
5013,
368,
341,
262,
1077,
5206,
5888,
25,
425,
6533,
2227,
3464,
11,
5162,
29,
284,
425,
6533,
2227,
486,
2258,
543,
262,
5888,
7030,
445,
7120,
3263,
98... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_on_tick() {
let mut worker = Builder::new("test-worker-tick").batch_size(4).create();
for _ in 0..10 {
worker.schedule("normal msg").unwrap();
}
let (tx, rx) = mpsc::channel();
worker.start(TickRunner { ch: tx }).unwrap();
for i in 0..13 {
let msg = rx.recv_timeout(Duration::from_secs(3)).unwrap();
if i != 4 && i != 9 && i != 12 {
assert_eq!(msg, "normal msg");
} else {
assert_eq!(msg, "tick msg");
}
}
worker.stop().unwrap().join().unwrap();
} | rust_cleaned_test_functions.jsonl/84782 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 332
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4470,
43612,
368,
341,
286,
1077,
5206,
11864,
284,
20626,
486,
931,
445,
1944,
65516,
2385,
865,
1827,
14049,
2368,
7,
19,
568,
3182,
543,
286,
369,
716,
304,
220,
15,
496,
16,
15,
341,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_timestamp_diff_millis() {
let millis_a = 1000;
let timestamp_diff = TimestampDiff::from_millis(millis_a);
let millis_b = timestamp_diff.as_millis();
assert_eq!(millis_a, millis_b);
} | rust_cleaned_test_functions.jsonl/32114 | {
"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,
23073,
15850,
717,
56212,
368,
341,
262,
1077,
57092,
4306,
284,
220,
16,
15,
15,
15,
280,
262,
1077,
11441,
15850,
284,
32758,
21751,
486,
1499,
717,
56212,
1255,
56212,
4306,
626,
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 |
#[test]
fn test_key_name() {
assert_eq!("path".to_owned().key_name(), "path");
assert_eq!("some/path".to_owned().key_name(), "path");
assert_eq!("".to_owned().key_name(), "");
assert_eq!("some/path/".to_owned().key_name(), "");
} | rust_cleaned_test_functions.jsonl/124528 | {
"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,
3097,
1269,
368,
341,
286,
2060,
10714,
17223,
2343,
3263,
983,
51973,
1005,
792,
1269,
1507,
330,
2343,
797,
286,
2060,
10714,
17223,
14689,
50976,
3263,
983,
51973,
1005,
792,
1269,
1507,
330,
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_min_width() {
let min_width = 64.0;
let builder = ColumnBuilder::new();
let column = builder.min_width(min_width).build();
assert_eq!(column.min_width, min_width);
} | rust_cleaned_test_functions.jsonl/73872 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 103
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7260,
7927,
368,
341,
286,
1077,
1308,
7927,
284,
220,
21,
19,
13,
15,
401,
286,
1077,
7363,
284,
9332,
3297,
486,
931,
543,
286,
1077,
3250,
284,
7363,
4358,
7927,
14146,
7927,
568,
5834,
142... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_get_column_values_from_insert_into_query() {
let q = r"
INSERT INTO public.customers (customer_id, company_name, contact_name, contact_title)
VALUES (1, 'Alfreds Futterkiste', 'Maria Anders', NULL);
";
let mut tokenizer = Tokenizer::new(q);
let tokens_result = tokenizer.tokenize();
assert_eq!(tokens_result.is_ok(), true);
let tokens = trim_pre_whitespaces(tokens_result.unwrap());
let column_values = get_column_values_from_insert_into_query(&tokens);
assert_eq!(
column_values,
vec![
&Token::Number("1".to_string(), false),
&Token::SingleQuotedString("Alfreds Futterkiste".to_string()),
&Token::SingleQuotedString("Maria Anders".to_string()),
&Token::make_keyword("NULL"),
]
);
} | rust_cleaned_test_functions.jsonl/55337 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 411
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
8744,
9146,
5673,
17678,
45514,
5738,
368,
341,
286,
1077,
2804,
284,
435,
698,
12698,
12496,
584,
24268,
388,
320,
11049,
842,
11,
2813,
1269,
11,
3645,
1269,
11,
3645,
6112,
340,
46089,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_try_from_record_for_contig_with_an_invalid_record_key() {
let record = Record::new(
record::Key::FileFormat,
record::Value::Struct(vec![(String::from("ID"), String::from("sq0"))]),
);
assert_eq!(
Contig::try_from(record),
Err(TryFromRecordError::InvalidRecord)
);
} | rust_cleaned_test_functions.jsonl/81750 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 186
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
5673,
14192,
5478,
10260,
343,
6615,
12008,
31433,
14192,
3097,
368,
341,
286,
1077,
3255,
284,
13583,
486,
931,
1006,
310,
3255,
486,
1592,
486,
1703,
4061,
345,
310,
3255,
486,
1130,
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_parse_valid_frame_with_two_octet_information_length() {
let role = Role::Responder;
let frame_type = FrameTypeMarker::UnnumberedInfoHeaderCheck;
let length = 129;
let length_data = vec![0; length];
let buf = vec![
0b00001111,
0b11101111, // Control Field - UIH command with P/F = 0.
0b00000010,
0b00000001,
];
let fcs = calculate_fcs(&buf[..frame_type.fcs_octets()]);
let buf = [buf, length_data.clone(), vec![fcs]].concat();
let res = Frame::parse(role, false, &buf[..]).unwrap();
let expected_frame = Frame {
role,
dlci: DLCI::try_from(3).unwrap(),
data: FrameData::UnnumberedInfoHeaderCheck(UIHData::User(UserData {
information: length_data,
})),
poll_final: false,
command_response: CommandResponse::Response,
credits: None,
};
assert_eq!(res, expected_frame);
} | rust_cleaned_test_functions.jsonl/87868 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 533
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8337,
8929,
6615,
23241,
70135,
295,
35212,
5118,
368,
341,
286,
1077,
3476,
284,
15404,
486,
30884,
280,
286,
1077,
4034,
1819,
284,
16321,
929,
20613,
486,
1806,
4082,
291,
1731,
4047,
39... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_histogram_opts_trailing_comma() {
use crate::linear_buckets;
let name = "test_histogram_opts";
let help = "test opts help";
let opts = histogram_opts!(name, help,);
assert_eq!(opts.common_opts.name, name);
assert_eq!(opts.common_opts.help, help);
let opts = histogram_opts!(name, help, linear_buckets(1.0, 0.5, 4).unwrap(),);
assert_eq!(opts.common_opts.name, name);
assert_eq!(opts.common_opts.help, help);
assert_eq!(opts.buckets.len(), 4);
let opts = histogram_opts!(
name,
help,
vec![1.0, 2.0],
labels! {"key".to_string() => "value".to_string(),},
);
assert_eq!(opts.common_opts.name, name);
assert_eq!(opts.common_opts.help, help);
assert_eq!(opts.buckets.len(), 2);
assert!(opts.common_opts.const_labels.get("key").is_some());
assert_eq!(opts.common_opts.const_labels.get("key").unwrap(), "value");
} | rust_cleaned_test_functions.jsonl/86362 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 437
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68564,
32354,
3547,
14277,
2965,
1728,
368,
341,
262,
990,
17717,
486,
22763,
84156,
401,
262,
1077,
829,
284,
330,
1944,
68564,
32354,
876,
262,
1077,
1492,
284,
330,
1944,
12185,
1492,
3302,
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_encode() {
let decoded = hex::decode("8eceda2f").unwrap().to_base58check();
let expected = "QtRAcc9FSRg";
assert_eq!(expected, &decoded);
} | rust_cleaned_test_functions.jsonl/98349 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
368,
341,
286,
1077,
29213,
284,
12371,
486,
18196,
445,
23,
757,
13830,
17,
69,
1827,
15454,
1005,
983,
7651,
20,
23,
2028,
543,
286,
1077,
3601,
284,
330,
18846,
5609,
638,
24,
8485,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_render_past_last_line() {
let line_height = 4.0;
let mut editor = Editor::new( Rc::new(RefCell::new(Buffer::new(1))));
editor.buffer.borrow_mut().splice(0..0, "abc\ndef\nghi");
editor.add_selection(Point::new(2, 3), Point::new(2, 3));
let frame = editor.render(render::Params {
line_height,
scroll_top: 2.0 * line_height,
height: 3.0 * line_height,
});
assert_eq!(frame.first_visible_row, 2);
assert_eq!(stringify_lines(frame.lines), vec!["ghi"]);
assert_eq!(frame.selections, vec![selection((2, 3), (2, 3))]);
let frame = editor.render(render::Params {
line_height,
scroll_top: 3.0 * line_height,
height: 3.0 * line_height,
});
assert_eq!(frame.first_visible_row, 2);
assert_eq!(stringify_lines(frame.lines), vec!["ghi"]);
assert_eq!(frame.selections, vec![selection((2, 3), (2, 3))]);
} | rust_cleaned_test_functions.jsonl/123917 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 494
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22781,
93019,
12195,
6528,
368,
341,
286,
1077,
1555,
9561,
284,
220,
19,
13,
15,
280,
286,
1077,
5206,
6440,
284,
12580,
486,
931,
7,
81463,
486,
931,
7,
3945,
3599,
486,
931,
55574,
486,
931... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_solid_regex_only_null_invert() {
let mut cmd = assert_cmd::Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap();
cmd.args(&["-sv","-og", "\\d+", "tr", "[:upper:]", "[:lower:]"])
.write_stdin("ABC123EFG\0\nHIJKLM456")
.assert()
.stdout("abc123efg\0\nhijklm456");
} | rust_cleaned_test_functions.jsonl/7896 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
5192,
41832,
18410,
15162,
1243,
1621,
368,
341,
286,
1077,
5206,
5439,
284,
2060,
11684,
486,
4062,
486,
66715,
21816,
16978,
17223,
34,
7581,
46,
94126,
4708,
15197,
15454,
543,
286,
5439,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_chown() {
// Testing for anything other than our own UID/GID is hard.
let uid = Some(getuid());
let gid = Some(getgid());
let tempdir = tempfile::tempdir().unwrap();
let path = tempdir.path().join("file");
{
File::create(&path).unwrap();
}
chown(&path, uid, gid).unwrap();
chown(&path, uid, None).unwrap();
chown(&path, None, gid).unwrap();
fs::remove_file(&path).unwrap();
chown(&path, uid, gid).unwrap_err();
} | rust_cleaned_test_functions.jsonl/30598 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 213
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4138,
779,
368,
341,
262,
442,
26768,
369,
4113,
1008,
1091,
1039,
1828,
37428,
15792,
915,
374,
2588,
624,
262,
1077,
14617,
284,
4329,
5433,
2423,
1423,
262,
1077,
45863,
284,
4329,
5433,
34849,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_account_grow_many() {
let paths = get_tmp_accounts_path("many2,many3");
let size = 4096;
let accounts = AccountsDB::new_with_file_size(0, &paths.paths, size, 0);
let mut keys = vec![];
for i in 0..9 {
let key = Pubkey::new_rand();
let account = Account::new(i + 1, size as usize / 4, &key);
accounts.store(0, &key, &account);
keys.push(key);
}
for (i, key) in keys.iter().enumerate() {
assert_eq!(
accounts.load(0, &key, false).unwrap().lamports,
(i as u64) + 1
);
}
let mut append_vec_histogram = HashMap::new();
let account_maps = accounts.account_index.account_maps.read().unwrap();
let account_map = account_maps.get(&0).unwrap().read().unwrap();
for map in account_map.values() {
*append_vec_histogram.entry(map.id).or_insert(0) += 1;
}
for count in append_vec_histogram.values() {
assert!(*count >= 2);
}
} | rust_cleaned_test_functions.jsonl/77670 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 547
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13500,
1889,
651,
22101,
368,
341,
286,
1077,
12716,
284,
633,
16125,
55665,
2638,
445,
34576,
17,
11,
34576,
18,
797,
286,
1077,
1379,
284,
220,
19,
15,
24,
21,
280,
286,
1077,
9618,
284,
406... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_extreme_cases() {
let mut c = RegionCollector::new();
let init_regions = &[
new_region(1, b"", b"k1", 1),
new_region(2, b"k1", b"k9", 1),
new_region(3, b"k9", b"", 1),
];
must_load_regions(&mut c, init_regions);
// been handled.
must_create_region(&mut c, &new_region(4, b"k5", b"k9", 2), StateRole::Follower);
must_update_region(&mut c, &new_region(2, b"k1", b"k9", 1), StateRole::Follower);
must_change_role(&mut c, &new_region(2, b"k1", b"k9", 1), StateRole::Leader);
must_update_region(&mut c, &new_region(2, b"k1", b"k5", 2), StateRole::Leader);
// this case may hardly happen so it can be fixed later.
check_collection(
&c,
&[
(new_region(1, b"", b"k1", 1), StateRole::Follower),
(new_region(2, b"k1", b"k5", 2), StateRole::Leader),
(new_region(4, b"k5", b"k9", 2), StateRole::Follower),
(new_region(3, b"k9", b"", 1), StateRole::Follower),
],
);
// but region 4 still has an `update` event which haven't been handled.
must_update_region(&mut c, &new_region(2, b"k1", b"k9", 3), StateRole::Leader);
must_update_region(&mut c, &new_region(4, b"k5", b"k9", 2), StateRole::Follower);
must_change_role(&mut c, &new_region(4, b"k5", b"k9", 2), StateRole::Leader);
must_destroy_region(&mut c, new_region(4, b"k5", b"k9", 2));
check_collection(
&c,
&[
(new_region(1, b"", b"k1", 1), StateRole::Follower),
(new_region(2, b"k1", b"k9", 3), StateRole::Leader),
(new_region(3, b"k9", b"", 1), StateRole::Follower),
],
);
} | rust_cleaned_test_functions.jsonl/33058 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 998
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9927,
9634,
41427,
368,
341,
286,
1077,
5206,
272,
284,
17152,
53694,
486,
931,
543,
286,
1077,
2930,
58035,
284,
609,
9640,
310,
501,
20627,
7,
16,
11,
293,
56323,
293,
62911,
16,
497,
220,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_match_token() {
assert_eq!(match_token("test", "test", false, false, false), vec![0]);
assert_eq!(match_token("test", "test", true, false, false), vec![0]);
assert_eq!(match_token("test", "Test", true, true, true), vec![]);
assert_eq!(match_token("Test", "Test", true, true, true), vec![0]);
// Whole word
assert_eq!(
match_token("just testing", "test", false, false, false),
vec![5]
);
assert_eq!(
match_token("just testing", "test", false, true, false),
vec![]
);
// Multiple occurrences in single token
assert_eq!(
match_token("tey te tey", "te", false, false, false),
vec![0, 4, 7]
);
assert_eq!(match_token("tey te tey", "te", false, true, false), vec![4]);
assert_eq!(match_token("tey Te tey", "Te", false, false, true), vec![4]);
} | rust_cleaned_test_functions.jsonl/54006 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 377
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10708,
6458,
368,
341,
262,
2060,
10714,
10297,
6347,
6458,
445,
1944,
497,
330,
1944,
497,
895,
11,
895,
11,
895,
701,
7486,
20703,
15,
2558,
262,
2060,
10714,
10297,
6347,
6458,
445,
1944,
497... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_request_parse_ipv4_socket_only() {
let mut hyper_request = HttpRequest::new(Body::empty());
*hyper_request.method_mut() = Method::GET;
*hyper_request.uri_mut() = "/path".parse().unwrap();
*hyper_request.version_mut() = HttpVersion::HTTP_10;
let socket_addr = Some("1.2.3.4:80".parse().unwrap());
let iron_request = Request::from_http(hyper_request, socket_addr, &Protocol::http())
.expect("A valid Iron request");
assert_eq!(iron_request.url.host(), Ipv4([1, 2, 3, 4].into()));
} | rust_cleaned_test_functions.jsonl/73135 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 251
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7893,
21039,
49378,
19,
19555,
18410,
368,
341,
286,
1077,
5206,
17071,
7893,
284,
44049,
486,
931,
5349,
1076,
486,
3194,
1423,
286,
353,
68192,
7893,
12908,
29523,
368,
284,
6730,
486,
3806,
280... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decimal_from_float() {
assert_eq!(
UntaggedValue::from("inf"),
UntaggedValue::decimal_from_float(f64::INFINITY, Span::default())
);
assert_eq!(
UntaggedValue::from("-inf"),
UntaggedValue::decimal_from_float(f64::NEG_INFINITY, Span::default())
);
assert_eq!(
UntaggedValue::from("NaN"),
UntaggedValue::decimal_from_float(f64::NAN, Span::default())
);
assert_eq!(
UntaggedValue::from(5.5),
UntaggedValue::decimal_from_float(5.5, Span::default())
)
} | rust_cleaned_test_functions.jsonl/124316 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 334
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74429,
5673,
17586,
368,
341,
286,
2060,
10714,
33673,
310,
15098,
96476,
1130,
486,
1499,
445,
13573,
4461,
310,
15098,
96476,
1130,
486,
23289,
5673,
17586,
955,
21,
19,
486,
687,
55990,
11,
119... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_mac_hash() {
let key = key();
let hash = vec![1, 2, 3, 4, 5];
let mac = Mac::new(
MacType::Header,
&key,
sys_time(1000, 100),
"nonny",
"POST",
"mysite.com",
443,
"/v1/api",
Some(&hash),
None,
)
.unwrap();
println!("got {:?}", mac);
assert!(
mac.0
== vec![
61, 128, 208, 253, 88, 135, 190, 196, 1, 69, 153, 193, 124, 4, 195, 87, 38, 96,
181, 34, 65, 234, 58, 157, 175, 175, 145, 151, 61, 0, 57, 5
]
);
} | rust_cleaned_test_functions.jsonl/52132 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 455
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28230,
22802,
8950,
368,
341,
286,
1077,
1376,
284,
1376,
543,
286,
1077,
5175,
284,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
286,
1077,
8978,
284,
7401,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.