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_take_pod_by_ref() {
let cxx = indoc! {"
uint32_t take_bob(const Bob& a) {
return a.a;
}
"};
let hdr = indoc! {"
#include <cstdint>
struct Bob {
uint32_t a;
uint32_t b;
};
uint32_t take_bob(const Bob& a);
"};
let rs = quote! {
let a = ffi::Bob { a: 12, b: 13 };
assert_eq!(ffi::take_bob(&a), 12);
};
run_test(cxx, hdr, rs, &["take_bob"], &["Bob"]);
} | rust_cleaned_test_functions.jsonl/9735 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 295
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73261,
85337,
3710,
7793,
368,
341,
262,
1077,
272,
4146,
284,
1257,
509,
0,
314,
698,
286,
2622,
18,
17,
528,
1896,
880,
674,
2741,
14261,
5,
264,
8,
341,
310,
470,
264,
5849,
280,
286,
456... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_set_oracle() {
let oracle = 1;
new_test_ext().execute_with(|| {
assert_err!(
RWS::set_oracle(Origin::none(), oracle),
DispatchError::BadOrigin
);
assert_err!(
RWS::set_oracle(Origin::signed(oracle), oracle),
DispatchError::BadOrigin
);
assert_ok!(RWS::set_oracle(Origin::root(), oracle),);
assert_eq!(RWS::oracle(), Some(oracle));
})
} | rust_cleaned_test_functions.jsonl/101696 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 296
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
8734,
7902,
368,
341,
286,
1077,
52741,
284,
220,
16,
280,
286,
501,
4452,
9927,
1005,
10257,
6615,
79453,
341,
310,
2060,
9266,
33673,
394,
431,
7433,
486,
746,
8734,
7902,
7,
13298,
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... | 2 |
#[test]
fn test_stakes_not_delegate() {
let mut stakes = Stakes {
epoch: 4,
..Stakes::default()
};
let ((vote_pubkey, vote_account), (stake_pubkey, stake_account)) =
create_staked_node_accounts(10);
stakes.store(&vote_pubkey, &vote_account, true);
stakes.store(&stake_pubkey, &stake_account, true);
{
let vote_accounts = stakes.vote_accounts();
assert!(vote_accounts.get(&vote_pubkey).is_some());
assert_eq!(vote_accounts.get(&vote_pubkey).unwrap().0, 10);
}
stakes.store(
&stake_pubkey,
&AccountSharedData::new(1, 0, &stake::program::id()),
true,
);
{
let vote_accounts = stakes.vote_accounts();
assert!(vote_accounts.get(&vote_pubkey).is_some());
assert_eq!(vote_accounts.get(&vote_pubkey).unwrap().0, 0);
}
} | rust_cleaned_test_functions.jsonl/94749 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 506
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
2050,
7913,
55312,
368,
341,
286,
1077,
5206,
44425,
284,
794,
2050,
341,
310,
16342,
25,
220,
19,
345,
310,
5241,
623,
2050,
486,
2258,
741,
286,
3634,
286,
1077,
1781,
29358,
34014,
792,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_no_generic_generate_dummy_fn_trait_impl() {
let gen = no_generic_fn();
let expected: TokenStream = quote! {
impl<D_: crate::rpn_expr::function::ArgDef> Foo_Fn for D_ {
default fn eval(
self,
ctx: &mut crate::expr::EvalContext,
output_rows: usize,
args: &[crate::rpn_expr::RpnStackNode<'_>],
extra: &mut crate::rpn_expr::RpnFnCallExtra<'_>,
) -> crate::Result<crate::codec::data_type::VectorValue> {
unreachable!()
}
}
};
assert_eq!(
expected.to_string(),
gen.generate_dummy_fn_trait_impl().to_string()
);
} | rust_cleaned_test_functions.jsonl/25656 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 461
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
41232,
48851,
60321,
15246,
78491,
21007,
368,
341,
286,
1077,
4081,
284,
902,
41232,
15246,
543,
286,
1077,
3601,
25,
9660,
3027,
284,
12641,
0,
341,
310,
11605,
29061,
23211,
17717,
486,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_file_reader_iter() -> Result<()> {
let path = get_test_path("alltypes_plain.parquet");
let vec = vec![path]
.iter()
.map(|p| SerializedFileReader::try_from(p.as_path()).unwrap())
.flat_map(|r| RowIter::from_file_into(Box::new(r)))
.flat_map(|r| r.get_int(0))
.collect::<Vec<_>>();
assert_eq!(vec, vec![4, 5, 6, 7, 2, 3, 0, 1]);
Ok(())
} | rust_cleaned_test_functions.jsonl/69595 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 254
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2458,
22306,
11723,
368,
1464,
5714,
71698,
341,
286,
1077,
1815,
284,
633,
4452,
2638,
445,
541,
9242,
41015,
33277,
23300,
797,
286,
1077,
7486,
284,
7486,
20703,
2343,
921,
310,
659,
2015,
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... | 1 |
#[test]
fn test_plan_build_missing_resolve_fails() {
let mut fetcher = StubMetadataFetcher::with_metadata(metadata_testing::dummy_metadata());
let mut planner = BuildPlannerImpl::new(&mut fetcher);
let planned_build_res = planner.plan_build(
&settings_testing::dummy_raze_settings(),
dummy_workspace_files(),
);
println!("{:#?}", planned_build_res);
assert!(planned_build_res.is_err());
} | rust_cleaned_test_functions.jsonl/130148 | {
"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,
26564,
20801,
40447,
77291,
761,
6209,
368,
341,
262,
1077,
5206,
7807,
261,
284,
66611,
14610,
97492,
486,
4197,
22220,
54436,
70962,
486,
31390,
22220,
1423,
262,
1077,
5206,
49711,
284,
7854,
212... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_map_error() {
assert!(matches!(
parse_map(&fake_section("maps/foo", &[]), "foo"),
Err(ParseError::InvalidMapDefinition { .. })
));
} | rust_cleaned_test_functions.jsonl/132922 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
5376,
4096,
368,
341,
286,
2060,
10297,
19914,
33673,
310,
4715,
5376,
2099,
30570,
16221,
445,
17640,
60555,
497,
609,
1294,
701,
330,
7975,
4461,
310,
15495,
71812,
1454,
486,
7928,
2227,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_pre_commit_py() {
let (_td, repo) = repo_init().unwrap();
let root = repo.path().parent().unwrap();
let repo_path = root.as_os_str().to_str().unwrap();
// mirror how python pre-commmit sets itself up
#[cfg(not(windows))]
let hook = b"#!/usr/bin/env python
import sys
sys.exit(0)
";
#[cfg(windows)]
let hook = b"#!/bin/env python.exe
import sys
sys.exit(0)
";
create_hook(root, HOOK_PRE_COMMIT, hook);
let res = hooks_pre_commit(repo_path).unwrap();
assert_eq!(res, HookResult::Ok);
} | rust_cleaned_test_functions.jsonl/96229 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 297
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10442,
36346,
40291,
368,
341,
286,
1077,
5453,
1296,
11,
15867,
8,
284,
15867,
6137,
1005,
15454,
543,
286,
1077,
3704,
284,
15867,
3875,
1005,
3765,
1005,
15454,
543,
286,
1077,
15867,
2638,
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_fetch_empty_repo() {
let test_data = GitRepoData::create();
let mut tx = test_data.repo.start_transaction("test");
let default_branch = git::fetch(tx.mut_repo(), &test_data.git_repo, "origin").unwrap();
// No default branch and no refs
assert_eq!(default_branch, None);
assert_eq!(*tx.mut_repo().view().git_refs(), btreemap! {});
assert_eq!(*tx.mut_repo().view().branches(), btreemap! {});
} | rust_cleaned_test_functions.jsonl/96064 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 187
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11803,
15124,
37784,
368,
341,
262,
1077,
1273,
1769,
284,
21120,
25243,
1043,
486,
3182,
1428,
262,
1077,
5206,
9854,
284,
1273,
1769,
46169,
4962,
28884,
445,
1944,
797,
262,
1077,
1638,
28031,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ascii_521k_to_file() {
let tname = "ascii-521k";
let input = build_ascii_block(512 * 1024);
let tmp_fn = format!("TESTFILE-{}.tmp", &tname);
let (fix, mut ucmd) = at_and_ucmd!();
ucmd.args(&["status=none", of!(tmp_fn)])
.pipe_in(input.clone())
.run()
.no_stderr()
.no_stdout()
.success();
assert_eq!(512 * 1024, fix.metadata(&tmp_fn).len());
cmp_file!(
{
let mut input_f = tempfile().unwrap();
input_f.write_all(&input).unwrap();
input_f
},
fix.open(&tmp_fn)
);
} | rust_cleaned_test_functions.jsonl/59400 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 336
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
50238,
62,
20,
17,
16,
74,
2346,
2458,
368,
341,
262,
1077,
259,
606,
284,
330,
23324,
12,
20,
17,
16,
74,
876,
262,
1077,
1946,
284,
1936,
50238,
7113,
7,
20,
16,
17,
353,
220,
16,
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_rent_exempt_temporal_escape() {
let mut account = AccountSharedData::default();
let epoch = 3;
let huge_lamports = 123_456_789_012;
let tiny_lamports = 789_012;
let mut collected;
let pubkey = solana_sdk::pubkey::new_rand();
account.lamports = huge_lamports;
assert_eq!(account.rent_epoch(), 0);
// create a tested rent collector
let rent_collector = RentCollector::default().clone_with_epoch(epoch);
// first mark account as being collected while being rent-exempt
collected = rent_collector.collect_from_existing_account(&pubkey, &mut account);
assert_eq!(account.lamports, huge_lamports);
assert_eq!(collected, 0);
// decrease the balance not to be rent-exempt
account.lamports = tiny_lamports;
collected = rent_collector.collect_from_existing_account(&pubkey, &mut account);
assert_eq!(account.lamports, tiny_lamports - collected);
assert_ne!(collected, 0);
} | rust_cleaned_test_functions.jsonl/93222 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 432
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
83127,
95736,
11771,
9819,
21832,
368,
341,
286,
1077,
5206,
2692,
284,
8615,
16997,
1043,
486,
2258,
543,
286,
1077,
16342,
284,
220,
18,
280,
286,
1077,
6765,
907,
309,
3394,
284,
220,
16,
17,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_close_file_logger() {
let tmp_dir = TempDir::new("").unwrap();
let log_file = tmp_dir
.path()
.join("test_close_file_logger.log")
.to_str()
.unwrap()
.to_string();
let one_day = Duration::days(1);
let mut logger = RotatingFileLogger::new(&log_file, one_day).unwrap();
// Handles written amount returned.
let _ = logger.write(b"write before close").unwrap();
logger.flush().unwrap();
logger.close().unwrap();
assert!(::panic_hook::recover_safe(|| logger.write(b"write after close")).is_err());
assert!(::panic_hook::recover_safe(|| logger.flush()).is_err());
assert!(::panic_hook::recover_safe(|| logger.close()).is_err());
logger.open().unwrap();
drop(logger);
} | rust_cleaned_test_functions.jsonl/23413 | {
"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,
12704,
2458,
27413,
368,
341,
286,
1077,
4174,
4334,
284,
19944,
6184,
486,
931,
80821,
15454,
543,
286,
1077,
1487,
2458,
284,
4174,
4334,
198,
310,
659,
2343,
741,
310,
659,
5987,
445,
1944,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_yield() {
let j = go!(move || {
println!("hello, coroutine");
yield_now();
println!("goodbye, coroutine");
});
j.join().unwrap();
} | rust_cleaned_test_functions.jsonl/51818 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
83709,
368,
341,
262,
1077,
502,
284,
728,
10297,
3397,
1369,
341,
286,
13751,
17223,
14990,
11,
77799,
797,
286,
7540,
20813,
543,
286,
13751,
17223,
18536,
28374,
11,
77799,
797,
262,
1625,
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
] | 2 |
#[test]
fn test_get_region_stats() {
let mut peer_storage = PeerStorage::new_indexed(HashmapDatabase::new()).unwrap();
assert!(peer_storage
.add_peer(create_test_peer(PeerFeatures::COMMUNICATION_NODE, false, true))
.is_ok());
assert!(peer_storage
.add_peer(create_test_peer(PeerFeatures::COMMUNICATION_NODE, true, true))
.is_ok());
assert!(peer_storage
.add_peer(create_test_peer(PeerFeatures::COMMUNICATION_CLIENT, false, false))
.is_ok());
assert!(peer_storage
.add_peer(create_test_peer(PeerFeatures::COMMUNICATION_CLIENT, false, false))
.is_ok());
assert!(peer_storage
.add_peer(create_test_peer(PeerFeatures::COMMUNICATION_NODE, false, false))
.is_ok());
assert!(peer_storage
.add_peer(create_test_peer(PeerFeatures::COMMUNICATION_CLIENT, false, true))
.is_ok());
assert!(peer_storage
.add_peer(create_test_peer(PeerFeatures::COMMUNICATION_NODE, false, false))
.is_ok());
assert!(peer_storage
.add_peer(create_test_peer(PeerFeatures::COMMUNICATION_CLIENT, false, false))
.is_ok());
assert_eq!(peer_storage.peer_db.len().unwrap(), 8);
let main_peer = create_test_peer(PeerFeatures::COMMUNICATION_NODE, false, false);
let node_region_stats = peer_storage
.get_region_stats(&main_peer.node_id, 4, PeerFeatures::COMMUNICATION_NODE)
.unwrap();
assert_eq!(node_region_stats.distance, NodeDistance::max_distance());
assert_eq!(node_region_stats.num_banned, 1);
assert_eq!(node_region_stats.num_offline, 2);
assert_eq!(node_region_stats.total, 2);
let client_region_stats = peer_storage
.get_region_stats(&main_peer.node_id, 4, PeerFeatures::COMMUNICATION_CLIENT)
.unwrap();
assert_eq!(client_region_stats.distance, NodeDistance::max_distance());
assert_eq!(client_region_stats.num_banned, 0);
assert_eq!(client_region_stats.num_offline, 1);
assert_eq!(client_region_stats.total, 3);
assert!(peer_storage
.add_peer(create_test_peer(PeerFeatures::COMMUNICATION_CLIENT, false, false))
.is_ok());
assert!(peer_storage
.add_peer(create_test_peer(PeerFeatures::COMMUNICATION_NODE, false, false))
.is_ok());
assert!(peer_storage
.add_peer(create_test_peer(PeerFeatures::COMMUNICATION_NODE, false, false))
.is_ok());
assert!(peer_storage
.add_peer(create_test_peer(PeerFeatures::COMMUNICATION_CLIENT, false, false))
.is_ok());
assert!(peer_storage
.add_peer(create_test_peer(PeerFeatures::COMMUNICATION_CLIENT, false, false))
.is_ok());
assert!(peer_storage
.add_peer(create_test_peer(PeerFeatures::COMMUNICATION_NODE, false, false))
.is_ok());
let node_region_stats = peer_storage
.get_region_stats(&main_peer.node_id, 4, PeerFeatures::COMMUNICATION_NODE)
.unwrap();
assert!(node_region_stats.distance < NodeDistance::max_distance());
assert_eq!(node_region_stats.total, 4);
let client_region_stats = peer_storage
.get_region_stats(&main_peer.node_id, 4, PeerFeatures::COMMUNICATION_CLIENT)
.unwrap();
assert!(client_region_stats.distance < NodeDistance::max_distance());
assert_eq!(client_region_stats.total, 4);
} | rust_cleaned_test_functions.jsonl/106861 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1720
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
20627,
15381,
368,
341,
286,
1077,
5206,
14397,
23310,
284,
45147,
5793,
486,
931,
3560,
291,
7,
6370,
2186,
5988,
486,
931,
6011,
15454,
1428,
286,
2060,
10297,
16537,
23310,
198,
310,
659,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_grade_returns_students_sorted_by_name() {
let mut s = school::School::new();
s.add(2, "James");
s.add(2, "Blair");
s.add(2, "Paul");
assert_eq!(s.grade(2).map(|v| stringvec_to_strvec(v)),
Some(vec!("Blair", "James", "Paul")));
} | rust_cleaned_test_functions.jsonl/127493 | {
"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,
50515,
58900,
71644,
41277,
3710,
1269,
368,
341,
262,
1077,
5206,
274,
284,
2906,
486,
32749,
486,
931,
543,
262,
274,
1364,
7,
17,
11,
330,
28084,
797,
262,
274,
1364,
7,
17,
11,
330,
4923,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_broadcast_ledger() {
solana_logger::setup();
let ledger_path = get_tmp_ledger_path!();
{
// Create the leader scheduler
let leader_keypair = Keypair::new();
let (entry_sender, entry_receiver) = channel();
let (retransmit_slots_sender, retransmit_slots_receiver) = unbounded();
let broadcast_service = setup_dummy_broadcast_service(
&leader_keypair.pubkey(),
&ledger_path,
entry_receiver,
retransmit_slots_receiver,
);
let start_tick_height;
let max_tick_height;
let ticks_per_slot;
let slot;
{
let bank = broadcast_service.bank.clone();
start_tick_height = bank.tick_height();
max_tick_height = bank.max_tick_height();
ticks_per_slot = bank.ticks_per_slot();
slot = bank.slot();
let ticks = create_ticks(max_tick_height - start_tick_height, 0, Hash::default());
for (i, tick) in ticks.into_iter().enumerate() {
entry_sender
.send((bank.clone(), (tick, i as u64 + 1)))
.expect("Expect successful send to broadcast service");
}
}
trace!(
"[broadcast_ledger] max_tick_height: {}, start_tick_height: {}, ticks_per_slot: {}",
max_tick_height,
start_tick_height,
ticks_per_slot,
);
let mut entries = vec![];
for _ in 0..10 {
entries = broadcast_service
.blockstore
.get_slot_entries(slot, 0)
.expect("Expect entries to be present");
if entries.len() >= max_tick_height as usize {
break;
}
sleep(Duration::from_millis(1000));
}
assert_eq!(entries.len(), max_tick_height as usize);
drop(entry_sender);
drop(retransmit_slots_sender);
broadcast_service
.broadcast_service
.join()
.expect("Expect successful join of broadcast service");
}
Blockstore::destroy(&ledger_path).expect("Expected successful database destruction");
} | rust_cleaned_test_functions.jsonl/51620 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1334
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74923,
38367,
1389,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
46933,
2638,
284,
633,
16125,
38367,
1389,
2638,
0,
1428,
286,
341,
310,
442,
4230,
279,
7653,
28809,
198,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_parse_pkt_syn() {
assert_pkt_encdec_works(
&[
0x00, 0x01, // Packet ID
0x00, // Packet kind
0x00, 0x01, // Session ID
0x00, 0x01, // Init sequence
0x00, 0x01,
b'h', b'e', b'l', b'l', b'o', 0x00, // Session name
],
new_session_packet(1, PacketKind::SYN, 1, SynBody {
init_seq: Sequence(1),
flags: PacketFlags::NAME,
sess_name: "hello".into(),
})
);
} | rust_cleaned_test_functions.jsonl/32438 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 376
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
42051,
51393,
368,
341,
286,
2060,
42051,
13781,
8169,
11498,
82,
1006,
310,
609,
9640,
394,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
16,
11,
442,
28889,
3034,
198,
394,
220,
15,
87,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bit_and_iterator_empty() {
let mut cnt = 0;
for i in BitAndIterator::new(&[], 2333) {
assert!(i);
cnt += 1;
}
assert_eq!(cnt, 2333);
} | rust_cleaned_test_functions.jsonl/59463 | {
"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,
13996,
8378,
13491,
15124,
368,
341,
286,
1077,
5206,
13195,
284,
220,
15,
280,
286,
369,
600,
304,
6495,
3036,
11951,
486,
931,
2099,
12995,
220,
17,
18,
18,
18,
8,
341,
310,
2060,
10297,
72,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_builder_i32_empty() {
let b = BufferBuilder::<i32>::new(5);
assert_eq!(0, b.len());
assert_eq!(16, b.capacity());
let a = b.finish();
assert_eq!(0, a.len());
} | rust_cleaned_test_functions.jsonl/127614 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 123
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28532,
5318,
18,
17,
15124,
368,
341,
286,
1077,
293,
284,
10312,
3297,
27638,
72,
18,
17,
6831,
931,
7,
20,
317,
286,
2060,
10714,
10297,
15,
11,
293,
19406,
1423,
286,
2060,
10714,
10297,
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_uri_fromstr() {
fn read(s: &str, result: RequestUri) {
assert_eq!(s.parse::<RequestUri>().unwrap(), result);
}
read("*", RequestUri::Star);
read("http://hyper.rs/", RequestUri::AbsoluteUri(Url::parse("http://hyper.rs/").unwrap()));
read("hyper.rs", RequestUri::Authority("hyper.rs".to_string()));
read("/", RequestUri::AbsolutePath("/".to_string()));
} | rust_cleaned_test_functions.jsonl/17846 | {
"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,
15572,
5673,
495,
368,
341,
262,
5168,
1349,
1141,
25,
609,
495,
11,
1102,
25,
6145,
13899,
8,
341,
286,
2060,
10714,
10297,
82,
4632,
27638,
1900,
13899,
10483,
15454,
1507,
1102,
317,
262,
555... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rbtree() {
let mut tree:RdxTree<u32> = RdxTree::new();
tree.insert(1);
tree.insert(22);
tree.insert(2);
tree.insert(1024);
tree.insert(0);
let should = vec![0, 1, 2, 22, 1024];
let is: Vec<u32> = tree.iter().cloned().collect();
assert_eq!(should, is);
assert_eq!(tree.nnodes(), 11);
} | rust_cleaned_test_functions.jsonl/90505 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 212
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68544,
9344,
368,
341,
286,
1077,
5206,
4916,
25,
49,
12719,
6533,
34837,
18,
17,
29,
284,
431,
12719,
6533,
486,
931,
543,
286,
4916,
7030,
7,
16,
317,
286,
4916,
7030,
7,
17,
17,
317,
286,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_validate_max_gas_units_below_min() {
let vm_validator = TestValidator::new();
let address = account_config::aptos_root_address();
// Calculate a size for the transaction script that will ensure
// that the minimum transaction gas is at least 1 after scaling to the
// external gas units.
let gas_constants = &GasConstants::default();
let txn_bytes = gas_constants.large_transaction_cutoff.get()
+ (gas_constants.gas_unit_scaling_factor / gas_constants.intrinsic_gas_per_byte.get());
let transaction = transaction_test_helpers::get_test_signed_transaction(
address,
1,
&vm_genesis::GENESIS_KEYPAIR.0,
vm_genesis::GENESIS_KEYPAIR.1.clone(),
Some(TransactionPayload::Script(Script::new(
vec![42; txn_bytes as usize],
vec![],
vec![],
))),
0,
0, /* max gas price */
XUS_NAME.to_owned(), /* gas currency code */
Some(0), // Max gas units
);
let ret = vm_validator.validate_transaction(transaction).unwrap();
assert_eq!(
ret.status().unwrap(),
StatusCode::MAX_GAS_UNITS_BELOW_MIN_TRANSACTION_GAS_UNITS
);
} | rust_cleaned_test_functions.jsonl/35404 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 555
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
6345,
82116,
28345,
82750,
7260,
368,
341,
262,
1077,
10995,
64959,
284,
3393,
14256,
486,
931,
1428,
262,
1077,
2621,
284,
2692,
5332,
486,
2689,
436,
12993,
6744,
543,
262,
442,
20517,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_base58_encode() {
// Basics
assert_eq!(&encode_slice(&[0][..]), "1");
assert_eq!(&encode_slice(&[1][..]), "2");
assert_eq!(&encode_slice(&[58][..]), "21");
assert_eq!(&encode_slice(&[13, 36][..]), "211");
// Leading zeroes
assert_eq!(&encode_slice(&[0, 13, 36][..]), "1211");
assert_eq!(&encode_slice(&[0, 0, 0, 0, 13, 36][..]), "1111211");
let res = encode_slice("GroestlcoinGroestlcoinGroestlcoinGroestlcoinGroestlcoinGroestlcoinGroestlcoinGroestlcoinGroestlcoinGroestl\
coinGroestlcoinGroestlcoinGroestlcoinGroestlcoinGroestlcoinGroestlcoinGroestlcoinGroestlcoinGroestlcoinGroestlcoin".as_bytes());
let exp = "2hXiLBbH9kmBoA9HWRRpWuHu29Hg49ApfMGzw6CXJkHn2sVUFjm8qF8FQQm29jFNXHjUXs59Q\
K9gk2MrWjiLokRHQ2t71bY5HjQUmutR2rTU91sc9gZjixxegH45Zs19PkCweG4bshVEm3XvqSDnELis8yjxkb\
aeV3DFCuYA69mxwtsqZpJxqWCSbu9vPBAoX5bWKeF5bRXNSd9tp4F7GMWCmvQqC2fxpVqk78YkxCs6H4EAJncp\
sNxAxCwrLQ164Pzn2y5zupcmLmwEf1SRmN997q5J3rU3ytRf3ot1iuymf";
assert_eq!(&res, exp);
// Addresses
let addr = Vec::from_hex("24f8917303bfa8ef24f292e8fa1419b20460ba064d").unwrap();
assert_eq!(&check_encode_slice(&addr[..]), "Fsq2GUc7R9f3JSfv3ma5JwkGPaFm3uH23D");
} | rust_cleaned_test_functions.jsonl/96807 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 742
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7651,
20,
23,
11224,
368,
341,
286,
442,
67176,
198,
286,
2060,
10714,
0,
2099,
6180,
26488,
2099,
58,
15,
1457,
496,
9719,
330,
16,
797,
286,
2060,
10714,
0,
2099,
6180,
26488,
2099,
58,
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_erasure_meta_status() {
use ErasureMetaStatus::*;
let set_index = 0;
let erasure_config = ErasureConfig::default();
let mut e_meta = ErasureMeta::new(set_index, set_index, &erasure_config);
let mut rng = thread_rng();
let mut index = Index::new(0);
e_meta.size = 1;
let data_indexes = 0..erasure_config.num_data() as u64;
let coding_indexes = 0..erasure_config.num_coding() as u64;
assert_eq!(e_meta.status(&index), StillNeed(erasure_config.num_data()));
index
.data_mut()
.set_many_present(data_indexes.clone().zip(repeat(true)));
assert_eq!(e_meta.status(&index), DataFull);
index
.coding_mut()
.set_many_present(coding_indexes.clone().zip(repeat(true)));
for &idx in data_indexes
.clone()
.collect::<Vec<_>>()
.choose_multiple(&mut rng, erasure_config.num_data())
{
index.data_mut().set_present(idx, false);
assert_eq!(e_meta.status(&index), CanRecover);
}
index
.data_mut()
.set_many_present(data_indexes.zip(repeat(true)));
for &idx in coding_indexes
.collect::<Vec<_>>()
.choose_multiple(&mut rng, erasure_config.num_coding())
{
index.coding_mut().set_present(idx, false);
assert_eq!(e_meta.status(&index), DataFull);
}
} | rust_cleaned_test_functions.jsonl/50368 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 762
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
80604,
3970,
13381,
4773,
368,
341,
286,
990,
9740,
3970,
12175,
2522,
79304,
286,
1077,
738,
3560,
284,
220,
15,
280,
286,
1077,
2714,
3970,
5332,
284,
9740,
3970,
2648,
486,
2258,
1428,
286,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_send_logout_and_recv_resend_request() {
define_dictionary!(
Heartbeat,
Logon,
Logout,
ResendRequest,
SequenceReset,
TestRequest,
);
//Connect and Logon.
let (mut test_server, mut client, connection) =
TestStream::setup_test_server_and_logon(build_dictionary());
//Wait around for a Heartbeat and TestRequest. Ignore these so we can send a valid
//ResendRequest below.
thread::sleep(Duration::from_millis(5500));
let _ = test_server.recv_message::<Heartbeat>();
let _ = test_server.recv_message::<TestRequest>();
//Begin Logout.
client.logout(connection);
let _ = test_server.recv_message::<Logout>();
//Have server send a ResendRequest.
let mut message = new_fixt_message!(ResendRequest);
message.msg_seq_num = 2;
message.begin_seq_no = 2;
message.end_seq_no = 0;
test_server.send_message(message);
engine_gap_fill_resend_request!(client, connection, 2..5);
let _ = engine_poll_message!(client, connection, ResendRequest);
//Make sure client still responds to ResendRequest while logging out.
let message = test_server.recv_message::<SequenceReset>();
assert_eq!(message.msg_seq_num, 2);
assert_eq!(message.new_seq_no, 5);
//Respond to logout and make sure client still logs out cleanly.
let mut message = new_fixt_message!(Logout);
message.msg_seq_num = 3;
test_server.send_message(message);
engine_poll_event!(client,EngineEvent::ConnectionTerminated(terminated_connection,reason) => {
assert_eq!(terminated_connection,connection);
assert!(if let ConnectionTerminatedReason::LocalRequested = reason { true } else { false });
});
} | rust_cleaned_test_functions.jsonl/20 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 668
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13565,
69386,
8378,
36118,
4918,
408,
7893,
368,
341,
262,
6979,
42605,
33673,
286,
17965,
22227,
345,
286,
2835,
263,
345,
286,
46285,
345,
286,
1800,
408,
1900,
345,
286,
28871,
14828,
345,
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_set_blkio_read_bps() {
let (tmp, throttle) = setup("test_set_blkio_read_bps", BLKIO_THROTTLE_READ_BPS);
let blkio = LinuxBlockIoBuilder::default()
.throttle_read_bps_device(vec![LinuxThrottleDeviceBuilder::default()
.major(8)
.minor(0)
.rate(102400u64)
.build()
.unwrap()])
.build()
.unwrap();
Blkio::apply(&tmp, &blkio).expect("apply blkio");
let content = fs::read_to_string(throttle)
.unwrap_or_else(|_| panic!("read {} content", BLKIO_THROTTLE_READ_BPS));
assert_eq!("8:0 102400", content);
} | rust_cleaned_test_functions.jsonl/130560 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 382
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
51969,
815,
6443,
880,
1690,
368,
341,
286,
1077,
320,
5173,
11,
42166,
8,
284,
6505,
445,
1944,
2602,
51969,
815,
6443,
880,
1690,
497,
14850,
42,
3810,
10625,
1285,
14903,
867,
13117,
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_session_default_values() {
let json = r#"{
"sid": "8333339f-5675-4f89-a9a0-1c935255ab58",
"timestamp": "2020-02-07T15:17:00Z",
"started": "2020-02-07T14:16:00Z",
"attrs": {
"release": "sentry-test@1.0.0"
}
}"#;
let output = r#"{
"sid": "8333339f-5675-4f89-a9a0-1c935255ab58",
"did": null,
"seq": 4711,
"timestamp": "2020-02-07T15:17:00Z",
"started": "2020-02-07T14:16:00Z",
"status": "ok",
"errors": 0,
"attrs": {
"release": "sentry-test@1.0.0"
}
}"#;
let update = SessionUpdate {
session_id: "8333339f-5675-4f89-a9a0-1c935255ab58".parse().unwrap(),
distinct_id: None,
sequence: 4711, // this would be a timestamp instead
timestamp: "2020-02-07T15:17:00Z".parse().unwrap(),
started: "2020-02-07T14:16:00Z".parse().unwrap(),
duration: None,
init: false,
status: SessionStatus::Ok,
errors: 0,
attributes: SessionAttributes {
release: "sentry-test@1.0.0".to_owned(),
environment: None,
ip_address: None,
user_agent: None,
},
};
let mut parsed = SessionUpdate::parse(json.as_bytes()).unwrap();
assert!((default_sequence() - parsed.sequence) <= 1);
parsed.sequence = 4711;
assert_eq_dbg!(update, parsed);
assert_eq_str!(output, serde_json::to_string_pretty(&update).unwrap());
} | rust_cleaned_test_functions.jsonl/4847 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 792
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12316,
9993,
9146,
368,
341,
286,
1077,
2951,
284,
435,
55543,
515,
220,
330,
21027,
788,
330,
23,
18,
18,
18,
18,
18,
24,
69,
12,
20,
21,
22,
20,
12,
19,
69,
23,
24,
7409,
24,
64,
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_castle_kingside_black() {
let castle_move = Move {
kind: MoveKind::CastleKingside,
from: Square::E8,
to: Square::G8,
};
let mut builder = PositionBuilder::new();
builder
.side_to_move(Color::Black)
.place(Square::E8, Piece::King, Color::Black)
.place(Square::H8, Piece::Rook, Color::Black);
let position = builder.build();
let moves = MoveGenerator::new().moves(&position);
assert_eq!(false, moves.contains(&castle_move));
// Castle flag must be set
builder.can_castle_kside(Color::Black, true);
let position = builder.build();
let moves = MoveGenerator::new().moves(&position);
assert_eq!(true, moves.contains(&castle_move));
} | rust_cleaned_test_functions.jsonl/134614 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 291
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5303,
273,
4698,
819,
577,
40272,
368,
341,
262,
1077,
32584,
17134,
284,
14561,
341,
414,
3093,
25,
14561,
10629,
486,
86603,
42,
819,
577,
345,
414,
504,
25,
15619,
486,
36,
23,
345,
414,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_merge_batch_size() {
TestScenario::new(util_name!())
.ucmd_keepenv()
.arg("--batch-size=2")
.arg("-m")
.arg("--unique")
.arg("merge_ints_interleaved_1.txt")
.arg("merge_ints_interleaved_2.txt")
.arg("merge_ints_interleaved_3.txt")
.arg("merge_ints_interleaved_3.txt")
.arg("merge_ints_interleaved_2.txt")
.arg("merge_ints_interleaved_1.txt")
.succeeds()
.stdout_only_fixture("merge_ints_interleaved.expected");
} | rust_cleaned_test_functions.jsonl/20537 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 286
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20888,
14534,
2368,
368,
341,
262,
3393,
54031,
486,
931,
67811,
1269,
0,
2398,
286,
659,
1754,
2277,
50293,
3160,
741,
286,
659,
858,
21549,
14049,
7174,
28,
17,
1138,
286,
659,
858,
13645,
76,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_null_and_number() {
assert_eq!(eval("hos != 0"), Ok(to_value(true)));
assert_eq!(eval("hos > 0"), Ok(to_value(false)));
} | rust_cleaned_test_functions.jsonl/28401 | {
"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,
15162,
8378,
5500,
368,
341,
286,
2060,
10714,
10297,
14170,
445,
41835,
961,
220,
15,
3975,
7622,
12186,
3142,
3715,
4945,
286,
2060,
10714,
10297,
14170,
445,
41835,
861,
220,
15,
3975,
7622,
12... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_binaryparser_from() {
let test_bytes: Vec<u8> = hex::decode(TEST_HEX).expect("");
let ref_bytes: &[u8] = test_bytes.as_ref();
let slice_parser = BinaryParser::from(ref_bytes);
let vec_parser = BinaryParser::from(test_bytes.to_owned());
assert_eq!(slice_parser, test_bytes[..]);
assert_eq!(vec_parser, test_bytes[..]);
} | rust_cleaned_test_functions.jsonl/20409 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 180
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31761,
9657,
5673,
368,
341,
286,
1077,
1273,
12524,
25,
11312,
34837,
23,
29,
284,
12371,
486,
18196,
50320,
86502,
568,
17119,
13056,
286,
1077,
2053,
12524,
25,
44590,
84,
23,
60,
284,
1273,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unconf_chan() {
do_test_unconf_chan(true, true, false, ConnectStyle::BestBlockFirstSkippingBlocks);
do_test_unconf_chan(false, true, false, ConnectStyle::BestBlockFirstSkippingBlocks);
do_test_unconf_chan(true, false, false, ConnectStyle::BestBlockFirstSkippingBlocks);
do_test_unconf_chan(false, false, false, ConnectStyle::BestBlockFirstSkippingBlocks);
} | rust_cleaned_test_functions.jsonl/97702 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
6135,
45552,
368,
341,
19935,
4452,
4907,
6135,
45552,
3715,
11,
830,
11,
895,
11,
13015,
2323,
486,
14470,
4713,
5338,
85945,
29804,
317,
19935,
4452,
4907,
6135,
45552,
3576,
11,
830,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_boolean_with_null_fmt_debug() {
let mut builder = BooleanArray::builder(3);
builder.append_value(true).unwrap();
builder.append_null().unwrap();
builder.append_value(false).unwrap();
let arr = builder.finish();
assert_eq!(
"PrimitiveArray<Boolean>\n[\n true,\n null,\n false,\n]",
format!("{:?}", arr)
);
} | rust_cleaned_test_functions.jsonl/11594 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46642,
6615,
15162,
38128,
15446,
368,
341,
286,
1077,
5206,
7363,
284,
6992,
1857,
486,
17850,
7,
18,
317,
286,
7363,
2057,
3142,
3715,
568,
15454,
543,
286,
7363,
2057,
15162,
1005,
15454,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bitwise() {
assert_eq!(radix_calc::expr("0b11111111 | 0b00000000"), Ok(0b11111111));
assert_eq!(radix_calc::expr("0b00000000 | 0b00000000"), Ok(0b00000000));
assert_eq!(radix_calc::expr("0b11111111 & 0b00000000"), Ok(0b00000000));
assert_eq!(radix_calc::expr("0b00000000 & 0b00000000"), Ok(0b00000000));
assert_eq!(radix_calc::expr("0b11111111 & 0b11111111"), Ok(0b11111111));
assert_eq!(radix_calc::expr("0b10101010 ^ 0b11110000"), Ok(0b10101010 ^ 0b11110000));
} | rust_cleaned_test_functions.jsonl/60553 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 222
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13996,
4482,
368,
341,
262,
2060,
10714,
10297,
13281,
941,
38241,
486,
9413,
445,
15,
65,
16,
16,
16,
16,
16,
16,
16,
16,
760,
220,
15,
65,
15,
15,
15,
15,
15,
15,
15,
15,
3975,
7622,
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_ext_euclid_modinv() {
for &p in SMALL_PRIMES.iter() {
for x in 1..p {
let y = ext_euclid_modinv(x, p);
assert!((1..p).contains(&y));
assert_eq!(x * y % p, 1);
}
}
} | rust_cleaned_test_functions.jsonl/57317 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9927,
2204,
84,
75044,
7480,
14057,
368,
341,
286,
369,
609,
79,
304,
49197,
10571,
1791,
1570,
19471,
368,
341,
310,
369,
856,
304,
220,
16,
496,
79,
341,
394,
1077,
379,
284,
1303,
2204,
84,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_pbkdf2() {
let django = Django {
version: DjangoVersion::V1_6,
};
let encoded = django.make_password_with_settings("lètmein", "seasalt", Algorithm::PBKDF2);
assert!(
encoded
== "pbkdf2_sha256$12000$seasalt$Ybw8zsFxqja97tY/o6G+Fy1ksY4U/Hw3DRrGED6Up4s="
.to_string()
);
assert!(is_password_usable(&encoded));
assert!(check_password("lètmein", &encoded).unwrap());
assert!(!check_password("lètmeinz", &encoded).unwrap());
// Blank passwords
let blank_encoded = django.make_password_with_settings("", "seasalt", Algorithm::PBKDF2);
assert!(blank_encoded.starts_with("pbkdf2_sha256$"));
assert!(is_password_usable(&blank_encoded));
assert!(check_password("", &blank_encoded).unwrap());
assert!(!check_password(" ", &blank_encoded).unwrap());
} | rust_cleaned_test_functions.jsonl/95839 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 397
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31409,
74,
2940,
17,
368,
341,
262,
1077,
8262,
284,
52604,
341,
286,
2319,
25,
52604,
5637,
486,
53,
16,
62,
21,
345,
262,
2605,
262,
1077,
20498,
284,
8262,
10117,
10122,
6615,
10853,
445,
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_is_connected() {
let graph = Graph::<(), (), Undirected>::from_edges(&[
(0, 1),
(1, 2),
(2, 3),
(3, 4),
(4, 5),
(5, 6),
(6, 7),
(7, 4),
]);
let node = NodeIndex::new(6);
let component: HashSet<usize> =
connectivity::bfs_undirected(&graph, node, &mut graph.visit_map())
.into_iter()
.map(|x| x.index())
.collect();
assert_eq!(component.len(), graph.node_count());
} | rust_cleaned_test_functions.jsonl/115298 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 285
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
43276,
368,
341,
262,
1077,
4771,
284,
12165,
27638,
1507,
38104,
16887,
74612,
6831,
1499,
28026,
2099,
9640,
286,
320,
15,
11,
220,
16,
1326,
286,
320,
16,
11,
220,
17,
1326,
286,
320,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_inode_contained_in() {
let inode = Inode(1234);
let buf = "socket:[1234]";
assert!(inode.contained_in(buf));
} | rust_cleaned_test_functions.jsonl/44576 | {
"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,
46748,
10260,
2627,
1243,
368,
341,
286,
1077,
34803,
284,
758,
534,
7,
16,
17,
18,
19,
317,
286,
1077,
6607,
284,
330,
9556,
7259,
16,
17,
18,
19,
60,
3302,
286,
2060,
10297,
52239,
5345,
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 |
#[test]
fn test_must_compile() {
let argv = std::env::args().collect::<Vec<String>>();
let argc = argv.len();
let mut c_argc = argc as c_int;
let mut c_argv = argv
.into_iter()
.map(|arg| CString::new(arg).unwrap().into_raw())
.collect::<Vec<*mut c_char>>();
let mut c_argv_ptr = c_argv.as_mut_ptr();
unsafe {
let ierr = SlepcInitialize(
&mut c_argc,
&mut c_argv_ptr,
std::ptr::null(),
std::ptr::null(),
);
if ierr != 0 {
println!("error code {} from SlepcInitialize", ierr);
}
let ierr = SlepcFinalize();
if ierr != 0 {
println!("error code {} from SlepcFinalize", ierr);
}
};
} | rust_cleaned_test_functions.jsonl/77263 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 507
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
590,
74170,
368,
341,
286,
1077,
10213,
284,
1460,
486,
3160,
486,
2116,
1005,
17384,
27638,
10050,
3464,
37038,
286,
1077,
11844,
284,
10213,
19406,
1428,
286,
1077,
5206,
272,
6057,
66,
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... | 3 |
#[test]
fn test_context_key_format() {
let cycle: i64 = 5;
let snapshot: i16 = 9;
assert_eq!(
context_key!("data/rolls/owner/snapshot/{}/{}", cycle, snapshot),
vec![
"data".to_string(),
"rolls".to_string(),
"owner".to_string(),
"snapshot".to_string(),
"5".to_string(),
"9".to_string()
],
);
} | rust_cleaned_test_functions.jsonl/98513 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 285
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8467,
3097,
8955,
368,
341,
286,
1077,
10775,
25,
600,
21,
19,
284,
220,
20,
280,
286,
1077,
16295,
25,
600,
16,
21,
284,
220,
24,
280,
286,
2060,
10714,
33673,
310,
2266,
3097,
17223,
691,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_disconnect_list_add_and_get() {
let mut disconnects = DisconnectList::new();
let curr_time = zx::Time::get_monotonic();
assert!(disconnects.get_recent(curr_time).is_empty());
let bssid = [1; 6];
let uptime = zx::Duration::from_seconds(2);
// Add a disconnect and check that we get it back.
disconnects.add(bssid, uptime, curr_time);
// We should get back the added disconnect when specifying the same or an earlier time.
let expected_disconnect = Disconnect { bssid, uptime, time: curr_time };
assert_eq!(disconnects.get_recent(curr_time).len(), 1);
assert_variant!(disconnects.get_recent(curr_time).as_slice(), [d] => {
assert_eq!(d, &expected_disconnect.clone());
});
let earlier_time = curr_time - zx::Duration::from_seconds(1);
assert_variant!(disconnects.get_recent(earlier_time).as_slice(), [d] => {
assert_eq!(d, &expected_disconnect.clone());
});
// The results should be empty if the requested time is after the disconnect's time.
// The disconnect is considered stale.
let later_time = curr_time + zx::Duration::from_seconds(1);
assert!(disconnects.get_recent(later_time).is_empty());
} | rust_cleaned_test_functions.jsonl/114356 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 544
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67972,
2019,
2891,
8378,
3062,
368,
341,
286,
1077,
5206,
28969,
82,
284,
69090,
852,
486,
931,
1428,
286,
1077,
9804,
3009,
284,
71322,
486,
1462,
486,
455,
20737,
354,
14011,
543,
286,
2060,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_storage_returns_bogus_error_when_loading_module() {
let mut gas_status = GasStatus::new_unmetered();
let module_id = ModuleId::new(TEST_ADDR, Identifier::new("N").unwrap());
let fun_name = Identifier::new("bar").unwrap();
for error_code in LIST_OF_ERROR_CODES {
let storage = BogusStorage {
bad_status_code: *error_code,
};
let vm = MoveVM::new(vec![]).unwrap();
let mut sess = vm.new_session(&storage);
let err = sess
.execute_function_bypass_visibility(
&module_id,
&fun_name,
vec![],
Vec::<Vec<u8>>::new(),
&mut gas_status,
)
.unwrap_err();
assert_eq!(err.status_type(), StatusType::InvariantViolation);
}
} | rust_cleaned_test_functions.jsonl/119336 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 424
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23310,
58900,
880,
538,
355,
4096,
47636,
57726,
10750,
368,
341,
262,
1077,
5206,
6819,
4773,
284,
20854,
2522,
486,
931,
4907,
59422,
291,
543,
262,
1077,
4688,
842,
284,
13711,
764,
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... | 2 |
#[test]
fn test_leading_double_wildcard() {
let file = build_ignore("**/foo");
assert!(file.is_excluded(&base_dir().join("foo")));
assert!(file.is_excluded(&base_dir().join("target").join("foo")));
assert!(file.is_excluded(&base_dir().join("target").join("subdir").join("foo")));
} | rust_cleaned_test_functions.jsonl/9288 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 140
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11751,
2228,
24598,
1670,
695,
4951,
368,
341,
286,
1077,
1034,
284,
1936,
58493,
91389,
14,
7975,
3071,
286,
2060,
10297,
1192,
2079,
2702,
10181,
2099,
3152,
4334,
1005,
5987,
445,
7975,
17621,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_encoder() {
let msg = Message::new(OpCode::Frame, Something { empty: true });
let encoded = msg.encode().unwrap();
let decoded = Message::decode(&encoded).unwrap();
assert_eq!(msg, decoded);
} | rust_cleaned_test_functions.jsonl/72610 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39068,
368,
341,
286,
1077,
3750,
284,
4856,
486,
931,
54494,
2078,
486,
4369,
11,
24656,
314,
4287,
25,
830,
1625,
286,
1077,
20498,
284,
3750,
17313,
1005,
15454,
543,
286,
1077,
29213,
284,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_cmd_new() {
let _cleanup = Cleanup;
Command::new("target/debug/hibana")
.arg("new")
.arg(NATORI)
.output()
.expect("failed to run new command");
let path = Path::new(NATORI);
assert!(path.exists());
assert!(path.join("contents").exists());
assert!(path.join("layouts").exists());
assert!(path.join("public").exists());
assert!(path.join("assets").exists());
assert!(path.join("config.toml").exists());
assert!(path.join("contents").join("index.md").exists());
} | rust_cleaned_test_functions.jsonl/108361 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 240
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11684,
5921,
368,
341,
262,
1077,
716,
55235,
284,
53512,
280,
262,
7348,
486,
931,
445,
5657,
67479,
14,
5803,
3362,
1138,
286,
659,
858,
445,
931,
1138,
286,
659,
858,
8204,
11857,
40,
340,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rgb_to_hsl() {
assert_eq!(hsl(0.0, 0.0, 0.0), rgb(0.0, 0.0, 0.0).into(Hsl));
assert_eq!(hsl(0.0, 0.0, 0.25), rgb(0.25, 0.25, 0.25).into(Hsl));
assert_eq!(hsl(0.0, 1.0, 0.5), rgb(1.0, 0.0, 0.0).into(Hsl));
assert_eq!(hsl(60.0, 1.0, 0.5), rgb(1.0, 1.0, 0.0).into(Hsl));
assert_eq!(hsl(120.0, 1.0, 0.5), rgb(0.0, 1.0, 0.0).into(Hsl));
assert_eq!(hsl(180.0, 1.0, 0.5), rgb(0.0, 1.0, 1.0).into(Hsl));
assert_eq!(hsl(240.0, 1.0, 0.5), rgb(0.0, 0.0, 1.0).into(Hsl));
assert_eq!(hsl(300.0, 1.0, 0.5), rgb(1.0, 0.0, 1.0).into(Hsl));
} | rust_cleaned_test_functions.jsonl/107532 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 413
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37407,
2346,
1523,
3226,
368,
341,
286,
2060,
10714,
10297,
71,
3226,
7,
15,
13,
15,
11,
220,
15,
13,
15,
11,
220,
15,
13,
15,
701,
17993,
7,
15,
13,
15,
11,
220,
15,
13,
15,
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_get_job_firecracker() -> Result<(), Box<dyn std::error::Error>> {
let arbitrary_uuid = uuid::Uuid::new_v4();
let plugin = PluginRow {
plugin_id: arbitrary_uuid,
tenant_id: arbitrary_uuid,
display_name: "arbitrary".to_owned(),
plugin_type: "analyzer".to_owned(),
artifact_s3_key: "arbitrary".to_owned(),
};
let service_config = arbitrary_service_config();
let cli = NomadCli::default();
let plugin_runtime = PluginRuntime::Firecracker;
get_job(&plugin, &service_config, &cli, &plugin_runtime)?;
Ok(())
} | rust_cleaned_test_functions.jsonl/85949 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 306
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
20298,
45772,
5082,
9683,
368,
1464,
5714,
68843,
8261,
92846,
1460,
486,
841,
486,
1454,
2452,
341,
286,
1077,
24168,
25540,
284,
16040,
486,
38431,
486,
931,
2273,
19,
543,
286,
1077,
9006... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_from_str_with_duplicate_sample_names() {
let s = "##fileformat=VCFv4.3
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT sample0 sample0
";
assert_eq!(
parse(s),
Err(ParseError::DuplicateSampleName(String::from("sample0")))
);
} | rust_cleaned_test_functions.jsonl/62676 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 157
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
2895,
6615,
70434,
17491,
9187,
368,
341,
286,
1077,
274,
284,
330,
565,
1192,
2243,
28,
53,
9650,
85,
19,
13,
18,
198,
2,
2149,
3361,
197,
17456,
29580,
197,
5996,
197,
35830,
197,
1420... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_squared_gear() {
let mut register = GearRegister::init();
let squared = squared_gear_template(&mut register);
let gear = register.instantiate(squared);
assert_eq!(
register.evaluate(gear, vec![TypedValue::U64(5)]).unwrap()[0],
TypedValue::U64(25)
);
} | rust_cleaned_test_functions.jsonl/98617 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 162
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54641,
1889,
682,
368,
341,
286,
1077,
5206,
4161,
284,
27503,
8690,
486,
2327,
543,
286,
1077,
52263,
284,
52263,
1889,
682,
8693,
2099,
6984,
4161,
626,
286,
1077,
14448,
284,
4161,
1858,
42251,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_physical_core_numbers() {
use sysinfo::SystemExt;
let s = sysinfo::System::new();
let count = s.get_physical_core_count();
assert_ne!(count, None);
assert!(count.unwrap() > 0);
} | rust_cleaned_test_functions.jsonl/13123 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84980,
15467,
32964,
368,
341,
262,
990,
5708,
2733,
486,
2320,
6756,
401,
262,
1077,
274,
284,
5708,
2733,
486,
2320,
486,
931,
543,
262,
1077,
1760,
284,
274,
670,
84980,
15467,
3180,
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 |
#[test]
fn test_fill_and_align() {
assert_eq!(
"%10s"
.parse::<CFormatSpec>()
.unwrap()
.format_string("test".to_owned()),
" test".to_owned()
);
assert_eq!(
"%-10s"
.parse::<CFormatSpec>()
.unwrap()
.format_string("test".to_owned()),
"test ".to_owned()
);
assert_eq!(
"%#10x"
.parse::<CFormatSpec>()
.unwrap()
.format_number(&BigInt::from(0x1337)),
" 0x1337".to_owned()
);
assert_eq!(
"%-#10x"
.parse::<CFormatSpec>()
.unwrap()
.format_number(&BigInt::from(0x1337)),
"0x1337 ".to_owned()
);
} | rust_cleaned_test_functions.jsonl/40346 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 578
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30728,
8378,
37015,
368,
341,
286,
2060,
10714,
33673,
310,
5962,
16,
15,
82,
698,
394,
659,
6400,
27638,
34,
4061,
8327,
18949,
394,
659,
15454,
741,
394,
659,
2243,
3904,
445,
1944,
3263,
983,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_valid_jwt_rs256() {
let p1 = json!({
"key1" : "val1",
"key2" : "val2"
});
let header = json!({});
let jwt1 = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJrZXkxIjoidmFsMSIsImtleTIiOiJ2YWwyIn0=.RQdLX70LEWL3PFePR2ec7fsBLwi29qK9GL_YfiBKcOWnWsgWMrw0PeJw8h21FloKAYYRq73GmSlF39B5TWbquscf3obfD_y3TYmSjY_STlQ1UTMBnCmwZeMgxuIlq4l7RNpGh_j-42u6YJ3b4zwFiiIGWANYTL0pzXjdIFcUhuY7yeYlFHmWgUOOfv_E_MaP0CgCK6rgeorPtFZ80Z-zYc2R7oXLylgiwJQmwLGzxAcOOcNaZurhQxUQ7GrErY9fOLxfw0vmF4FMSIhQvWIiUV9Meh3MoIwybDhuy5-Y85WZwtXYC7blAZhU0h6tFqwBozt7PS34htj8rkCIqqi0Ng==".to_string();
let (h1, p1) = decode(&jwt1, &get_rsa_256_public_key_full_path(), Algorithm::RS256).unwrap();
println!("\n{}",h1);
println!("{}",p1);
let jwt2 = encode(header, &get_rsa_256_private_key_full_path(), &p1, Algorithm::RS256).unwrap();
let (h2, p2) = decode(&jwt2, &get_rsa_256_public_key_full_path(), Algorithm::RS256).unwrap();
println!("{}",h2);
println!("{}",p2);
assert_eq!(jwt1, jwt2);
} | rust_cleaned_test_functions.jsonl/45851 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 680
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
8337,
95576,
47115,
17,
20,
21,
368,
341,
286,
1077,
281,
16,
284,
2951,
0,
2262,
310,
330,
792,
16,
1,
549,
330,
831,
16,
756,
310,
330,
792,
17,
1,
549,
330,
831,
17,
698,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_handle_truncate() {
let mut ctx = EvalContext::new(Arc::new(EvalConfig::new()));
assert!(ctx.handle_truncate(false).is_ok());
assert!(ctx.handle_truncate(true).is_err());
assert!(ctx.take_warnings().warnings.is_empty());
// ignore_truncate = false;
let mut ctx = EvalContext::new(Arc::new(EvalConfig::default_for_test()));
assert!(ctx.handle_truncate(false).is_ok());
assert!(ctx.handle_truncate(true).is_ok());
assert!(ctx.take_warnings().warnings.is_empty());
let mut ctx = EvalContext::new(Arc::new(EvalConfig::from_flags(FLAG_TRUNCATE_AS_WARNING)));
assert!(ctx.handle_truncate(false).is_ok());
assert!(ctx.handle_truncate(true).is_ok());
assert!(!ctx.take_warnings().warnings.is_empty());
} | rust_cleaned_test_functions.jsonl/75320 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 391
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10630,
3547,
26900,
368,
341,
1789,
286,
1077,
5206,
5635,
284,
58239,
1972,
486,
931,
4346,
1287,
486,
931,
10722,
831,
2648,
486,
931,
7392,
286,
2060,
10297,
3773,
10132,
3547,
26900,
3576,
568... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_struct_align_and_padding() {
let res = StructWithAlignment::parse(INPUT_16);
assert_eq!(
res,
Ok((
&INPUT_16[12..],
StructWithAlignment {
a: 0,
b: 0x1234_5678_1234_5678
}
))
);
let res = StructWithAlignmentAndPadding::parse(INPUT_16);
assert_eq!(
res,
Ok((
&INPUT_16[10..],
StructWithAlignmentAndPadding {
a: 0,
b: 0x5678_1234
}
))
);
let res = StructWithLongSkip::parse(INPUT_16).expect_err("parse error");
if let nom::Err::Incomplete(sz) = res {
assert_eq!(sz, nom::Needed::new(185));
} else {
panic!("wrong error type");
}
let res = StructWithOffset::parse(INPUT_16);
assert_eq!(
res,
Ok((
&INPUT_16[8..],
StructWithOffset {
a: 0,
b: 0x1234_5678,
b2: 0x1234_5678
}
))
);
let res = StructWithOffsetAbs::parse(INPUT_16);
assert_eq!(
res,
Ok((&INPUT_16[5..], StructWithOffsetAbs { a: 0, a2: 0x12 }))
);
} | rust_cleaned_test_functions.jsonl/48211 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 714
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15126,
37015,
8378,
40726,
368,
341,
262,
1077,
592,
284,
16139,
2354,
7033,
486,
6400,
57911,
62,
16,
21,
317,
262,
2060,
10714,
33673,
286,
592,
345,
286,
7622,
94702,
310,
609,
29421,
62,
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... | 2 |
#[test]
fn test_filter_gametype2() {
let filter = Filter::new()
.appid(440)
.gametype(&vec!["cp"])
.nor()
.gametype(&vec!["alltalk"])
.end();
assert_eq!(
filter.as_string(),
"\\appid\\440\\gametype\\cp\\nor\\1\\gametype\\alltalk"
);
} | rust_cleaned_test_functions.jsonl/4949 | {
"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,
8727,
1889,
309,
16214,
17,
368,
341,
262,
1077,
4051,
284,
12339,
486,
931,
741,
286,
659,
58342,
7,
19,
19,
15,
340,
286,
659,
39329,
16214,
2099,
4083,
0,
1183,
4672,
14108,
286,
659,
44707... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_null_fullblock() {
new_ucmd!()
.args(&["if=null.txt", "status=none", "iflag=fullblock"])
.run()
.no_stdout()
.no_stderr()
.success();
} | rust_cleaned_test_functions.jsonl/59392 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15162,
16372,
4574,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
333,
18911,
3909,
497,
330,
2829,
28,
6697,
497,
330,
333,
13363,
28,
8878,
4574,
14108,
286,
659,
6108,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_to_trigram_char() {
assert_valuable_trigram_chars(&['a', 'z', 'A', 'Z', 'Ж', 'ß']);
// // // 0x00 - 0x40
assert_not_valuable_trigram_chars(&['\t', '\n', ' ', '.', '0', '9', ',', '@']);
// 0x5B - 0x60
assert_not_valuable_trigram_chars(&['[', ']', '^', '\\', '`']);
// 0x7B - 0x7E
assert_not_valuable_trigram_chars(&['[', '|', '{', '}', '~']);
} | rust_cleaned_test_functions.jsonl/73149 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 265
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
3547,
49127,
9232,
368,
341,
1789,
286,
2060,
6189,
13128,
3547,
49127,
37418,
2099,
677,
64,
516,
364,
89,
516,
364,
32,
516,
364,
57,
516,
364,
132042,
516,
364,
7997,
21906,
286,
442,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_void_union_with_fields() {
let json = r#"{
".tag": "reset",
"some field": "some value",
"another field": "another value"
}"#;
let x = serde_json::from_str::<dropbox_sdk::files::ListFolderLongpollError>(json).unwrap();
if let dropbox_sdk::files::ListFolderLongpollError::Reset = x {
// yay
} else {
panic!("wrong variant");
}
} | rust_cleaned_test_functions.jsonl/12419 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37775,
51621,
6615,
12132,
368,
341,
262,
1077,
2951,
284,
435,
55543,
515,
286,
5933,
4578,
788,
330,
9716,
756,
286,
330,
14689,
2070,
788,
330,
14689,
897,
756,
286,
330,
41963,
2070,
788,
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... | 2 |
#[test]
fn test_expand_to_item_list() {
let rules = create_rules(
"
macro_rules! structs {
($($i:ident),*) => {
$(struct $i { field: u32 } )*
}
}
",
);
let expansion = expand(&rules, "structs!(Foo, Bar);");
let tree = token_tree_to_macro_items(&expansion).unwrap().tree();
assert_eq!(
format!("{:#?}", tree.syntax()).trim(),
r#"
MACRO_ITEMS@[0; 40)
STRUCT_DEF@[0; 20)
STRUCT_KW@[0; 6) "struct"
NAME@[6; 9)
IDENT@[6; 9) "Foo"
RECORD_FIELD_DEF_LIST@[9; 20)
L_CURLY@[9; 10) "{"
RECORD_FIELD_DEF@[10; 19)
NAME@[10; 15)
IDENT@[10; 15) "field"
COLON@[15; 16) ":"
PATH_TYPE@[16; 19)
PATH@[16; 19)
PATH_SEGMENT@[16; 19)
NAME_REF@[16; 19)
IDENT@[16; 19) "u32"
R_CURLY@[19; 20) "}"
STRUCT_DEF@[20; 40)
STRUCT_KW@[20; 26) "struct"
NAME@[26; 29)
IDENT@[26; 29) "Bar"
RECORD_FIELD_DEF_LIST@[29; 40)
L_CURLY@[29; 30) "{"
RECORD_FIELD_DEF@[30; 39)
NAME@[30; 35)
IDENT@[30; 35) "field"
COLON@[35; 36) ":"
PATH_TYPE@[36; 39)
PATH@[36; 39)
PATH_SEGMENT@[36; 39)
NAME_REF@[36; 39)
IDENT@[36; 39) "u32"
R_CURLY@[39; 40) "}""#
.trim()
);
} | rust_cleaned_test_functions.jsonl/14703 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 887
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67875,
2346,
5634,
2019,
368,
341,
262,
1077,
5601,
284,
1855,
21407,
1006,
286,
6228,
310,
18072,
21407,
0,
62845,
341,
394,
1711,
699,
72,
25,
1713,
701,
3764,
589,
341,
503,
4930,
1235,
400,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tls12_exporter() {
for kt in ALL_KEY_TYPES.iter() {
let mut client_config = make_client_config(*kt);
let server_config = make_server_config(*kt);
client_config.versions = vec![ ProtocolVersion::TLSv1_2 ];
do_exporter_test(client_config, server_config);
}
} | rust_cleaned_test_functions.jsonl/10028 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71262,
16,
17,
27114,
261,
368,
341,
262,
369,
18541,
304,
13097,
6600,
25794,
19471,
368,
341,
286,
1077,
5206,
2943,
5332,
284,
1281,
8179,
5332,
4071,
5840,
317,
286,
1077,
3538,
5332,
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... | 2 |
#[test]
fn test_function() {
// ptr to dynamic function.
let function = rune! {
Function => r#"
fn foo(a, b) {
a + b
}
fn main() {
foo
}
"#
};
assert_eq!(function.call::<_, i64>((1i64, 3i64)).unwrap(), 4i64);
assert!(function.call::<_, i64>((1i64,)).is_err());
// ptr to native function
let function = rune! {
Function => r#"fn main() { Vec::new }"#
};
let value: Vec<Value> = function.call(()).unwrap();
assert_eq!(value.len(), 0);
// ptr to dynamic function.
let function = rune! {
Function => r#"
enum Custom { A(a) }
fn main() { Custom::A }
"#
};
assert!(function.call::<_, Value>(()).is_err());
let value: Value = function.call((1i64,)).unwrap();
assert!(matches!(value, Value::TupleVariant(..)));
// ptr to dynamic function.
let function = rune! {
Function => r#"
struct Custom(a)
fn main() { Custom }
"#
};
assert!(function.call::<_, Value>(()).is_err());
let value: Value = function.call((1i64,)).unwrap();
assert!(matches!(value, Value::TypedTuple(..)));
// non-capturing closure == free function
let function = rune! {
Function => r#"
fn main() { |a, b| a + b }
"#
};
assert!(function.call::<_, Value>((1i64,)).is_err());
let value: Value = function.call((1i64, 2i64)).unwrap();
assert!(matches!(value, Value::Integer(3)));
// closure with captures
let function: Function = run(&["main"], (1i64, 2i64), r#"fn main(a, b) { || a + b }"#).unwrap();
assert!(function.call::<_, Value>((1i64,)).is_err());
let value: Value = function.call(()).unwrap();
assert!(matches!(value, Value::Integer(3)));
} | rust_cleaned_test_functions.jsonl/49178 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 828
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9174,
368,
341,
262,
442,
10087,
311,
8741,
729,
624,
262,
1077,
729,
284,
63499,
0,
341,
286,
5712,
589,
435,
2,
698,
286,
5168,
15229,
2877,
11,
293,
8,
341,
310,
264,
488,
293,
198,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_noop_drop_elsewhere() {
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
use std::thread;
let was_called = Arc::new(AtomicBool::new(false));
{
let was_called = was_called.clone();
thread::spawn(move || {
struct X(Arc<AtomicBool>);
impl Drop for X {
fn drop(&mut self) {
self.0.store(true, Ordering::SeqCst);
}
}
let val = Sticky::new(X(was_called.clone()));
assert!(thread::spawn(move || {
// moves it here but do not deallocate
val.try_get().ok();
})
.join()
.is_ok());
assert_eq!(was_called.load(Ordering::SeqCst), false);
})
.join()
.unwrap();
}
assert_eq!(was_called.load(Ordering::SeqCst), true);
} | rust_cleaned_test_functions.jsonl/13459 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 496
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
453,
29584,
62628,
2870,
368,
341,
262,
990,
1460,
486,
12996,
486,
6618,
22964,
65857,
11233,
11,
68621,
2440,
262,
990,
1460,
486,
12996,
486,
36809,
280,
262,
990,
1460,
486,
4528,
401,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_records_offset() {
let mut batch = DefaultBatch::default();
assert_eq!(batch.get_last_offset_delta(), 0);
batch.add_record(DefaultRecord::default());
assert_eq!(batch.get_last_offset_delta(), 0);
batch.add_record(DefaultRecord::default());
assert_eq!(batch.get_last_offset_delta(), 1);
batch.add_record(DefaultRecord::default());
assert_eq!(batch.get_last_offset_delta(), 2);
assert_eq!(
batch
.records
.get(0)
.expect("index 0 should exists")
.get_offset_delta(),
0
);
assert_eq!(
batch
.records
.get(1)
.expect("index 1 should exists")
.get_offset_delta(),
1
);
assert_eq!(
batch
.records
.get(2)
.expect("index 2 should exists")
.get_offset_delta(),
2
);
assert_eq!(batch.get_last_offset_delta(), 2);
} | rust_cleaned_test_functions.jsonl/89503 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 641
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31279,
6917,
368,
341,
286,
1077,
5206,
7162,
284,
7899,
21074,
486,
2258,
543,
286,
2060,
10714,
10297,
14049,
670,
12195,
6917,
26710,
1507,
220,
15,
626,
286,
7162,
1364,
14192,
87874,
6471,
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_request() {
let client = Client::new("token".to_owned());
let mut builder = UpdateWebhookMessage::new(&client, WebhookId(1), "token", MessageId(2))
.content(Some("test"))
.expect("'test' content couldn't be set")
.reason("reason")
.expect("'reason' is not a valid reason");
let actual = builder.request().expect("failed to create request");
let body = UpdateWebhookMessageFields {
allowed_mentions: None,
attachments: &[],
components: None,
content: Some(NullableField(Some("test"))),
embeds: None,
payload_json: None,
};
let route = Route::UpdateWebhookMessage {
message_id: 2,
token: "token",
webhook_id: 1,
};
let expected = Request::builder(&route)
.json(&body)
.expect("failed to serialize body")
.build();
assert_eq!(expected.body, actual.body);
assert_eq!(expected.path, actual.path);
} | rust_cleaned_test_functions.jsonl/92292 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 520
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7893,
368,
341,
286,
1077,
2943,
284,
8423,
486,
931,
445,
5839,
3263,
983,
51973,
1423,
286,
1077,
5206,
7363,
284,
5549,
5981,
20873,
2052,
486,
931,
2099,
2972,
11,
4895,
20873,
764,
7,
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_setter_and_getter() {
let mut register = Register::new();
assert_eq!(register.get_pc(), 0);
register.set_pc(1);
assert_eq!(register.get_pc(), 1);
assert_eq!(register.get_c(), 0);
register.set_c(1);
assert_eq!(register.get_c(), 1);
assert_eq!(register.get_a(), 0);
register.set_a(1);
assert_eq!(register.get_a(), 1);
assert_eq!(register.get_b(), 0);
register.set_b(1);
assert_eq!(register.get_b(), 1);
} | rust_cleaned_test_functions.jsonl/113009 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 276
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
465,
8378,
3062,
465,
368,
341,
286,
1077,
5206,
4161,
284,
8451,
486,
931,
1428,
286,
2060,
10714,
10297,
6343,
670,
35612,
1507,
220,
15,
317,
286,
4161,
980,
35612,
7,
16,
317,
286,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_buf_reader() {
let in_buf = vec![0, 1, 2, 3, 4, 5, 6, 7];
let mut reader = BufReader::new(in_buf.as_slice());
let mut buf = [];
assert_eq!(reader.read(&mut buf), Ok(0));
assert_eq!(reader.tell(), Ok(0));
let mut buf = [0];
assert_eq!(reader.read(&mut buf), Ok(1));
assert_eq!(reader.tell(), Ok(1));
let b: &[_] = &[0];
assert_eq!(buf, b);
let mut buf = [0, ..4];
assert_eq!(reader.read(&mut buf), Ok(4));
assert_eq!(reader.tell(), Ok(5));
let b: &[_] = &[1, 2, 3, 4];
assert_eq!(buf, b);
assert_eq!(reader.read(&mut buf), Ok(3));
let b: &[_] = &[5, 6, 7];
assert_eq!(buf[0..3], b);
assert!(reader.read(&mut buf).is_err());
let mut reader = BufReader::new(in_buf.as_slice());
assert_eq!(reader.read_until(3).unwrap(), vec!(0, 1, 2, 3));
assert_eq!(reader.read_until(3).unwrap(), vec!(4, 5, 6, 7));
assert!(reader.read(&mut buf).is_err());
} | rust_cleaned_test_functions.jsonl/7090 | {
"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,
10363,
22306,
368,
341,
286,
1077,
304,
10363,
284,
7486,
20703,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,
11,
220,
22,
935,
286,
1077,
5206,
6604,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rgb() {
let color = QColor::from_rgb(255, 128, 0, None);
assert_eq!(255, color.red());
assert_eq!(128, color.green());
assert_eq!(0, color.blue());
assert_eq!(255, color.alpha());
assert_eq!((255, 128, 0, 255), color.get_rgba());
} | rust_cleaned_test_functions.jsonl/25421 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37407,
368,
341,
286,
1077,
1894,
284,
55758,
486,
1499,
37407,
7,
17,
20,
20,
11,
220,
16,
17,
23,
11,
220,
15,
11,
2240,
317,
286,
2060,
10714,
10297,
17,
20,
20,
11,
1894,
17335,
1423,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_wildcard_errors() {
assert!(Pattern::new("a/**b").unwrap_err().pos == 4);
assert!(Pattern::new("a/bc**").unwrap_err().pos == 3);
assert!(Pattern::new("a/*****").unwrap_err().pos == 4);
assert!(Pattern::new("a/b**c**d").unwrap_err().pos == 2);
assert!(Pattern::new("a**b").unwrap_err().pos == 0);
} | rust_cleaned_test_functions.jsonl/40566 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 170
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1670,
695,
4951,
20196,
368,
341,
286,
2060,
10297,
15760,
486,
931,
445,
64,
3663,
65,
1827,
15454,
9266,
1005,
966,
621,
220,
19,
317,
286,
2060,
10297,
15760,
486,
931,
445,
64,
3470,
66,
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_process_initialize_ix_no_keyed_accs_fail() {
process_instruction(
&serialize(&SystemInstruction::InitializeNonceAccount(Pubkey::default())).unwrap(),
Vec::new(),
Vec::new(),
Err(InstructionError::NotEnoughAccountKeys),
super::process_instruction,
);
} | rust_cleaned_test_functions.jsonl/95899 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 168
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
40889,
62686,
6536,
3097,
291,
17737,
82,
22121,
368,
341,
286,
1882,
54923,
1006,
310,
609,
24166,
2099,
2320,
16664,
486,
9928,
90528,
7365,
5304,
392,
792,
486,
2258,
34670,
15454,
3148,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_conflicts() {
let mut m = HashMap::with_capacity(4);
assert!(m.insert(1i, 2i));
assert!(m.insert(5i, 3i));
assert!(m.insert(9i, 4i));
assert_eq!(*m.find(&9).unwrap(), 4);
assert_eq!(*m.find(&5).unwrap(), 3);
assert_eq!(*m.find(&1).unwrap(), 2);
} | rust_cleaned_test_functions.jsonl/41862 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
16059,
56445,
368,
341,
286,
1077,
5206,
296,
284,
10528,
486,
4197,
35603,
7,
19,
317,
286,
2060,
10297,
76,
7030,
7,
16,
72,
11,
220,
17,
72,
1106,
286,
2060,
10297,
76,
7030,
7,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_u8x16_none_not_any() {
let x1 = u8x16::splat(1);
let x2 = u8x16::splat(2);
assert!(!(x1.eq(x2)).any());
} | rust_cleaned_test_functions.jsonl/43253 | {
"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,
7300,
23,
87,
16,
21,
31488,
7913,
37248,
368,
341,
286,
1077,
856,
16,
284,
575,
23,
87,
16,
21,
486,
82,
42339,
7,
16,
317,
286,
1077,
856,
17,
284,
575,
23,
87,
16,
21,
486,
82,
42339... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() -> Result<(), Box<dyn error::Error>> {
assert_eq!(
Type::ParenthesizedType(ParenthesizedType(Type::TypeName(TypeName::Int).into()).into()),
"(int)".parse()?
);
Ok(())
} | rust_cleaned_test_functions.jsonl/109156 | {
"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,
21039,
368,
1464,
5714,
68843,
8261,
92846,
1465,
486,
1454,
2452,
341,
262,
2060,
10714,
33673,
286,
3990,
486,
83997,
82879,
929,
5304,
9151,
82879,
929,
22498,
486,
39429,
22498,
675,
486,
1072,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_extend_from_empty_strs() {
let strs = vec![
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "",
];
let compact: CompactString = strs.clone().into_iter().collect();
assert_eq!(compact, "");
assert!(compact.is_empty());
assert!(!compact.is_heap_allocated());
} | rust_cleaned_test_functions.jsonl/2788 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 177
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70265,
5673,
15124,
2895,
82,
368,
341,
262,
1077,
57584,
284,
7486,
90515,
286,
7342,
7342,
7342,
7342,
7342,
7342,
7342,
7342,
7342,
7342,
7342,
7342,
7342,
7342,
7342,
7342,
7342,
7342,
7342,
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_skip_struct() {
assert_ser_tokens(
&SkipStruct { a: 1, b: 2 },
&[
Token::Struct { name: "SkipStruct", len: 1 },
Token::Str("a"),
Token::I8(1),
Token::StructEnd,
],
);
assert_de_tokens(
&SkipStruct { a: 1, b: 0 },
&[
Token::Struct { name: "SkipStruct", len: 1 },
Token::Str("a"),
Token::I8(1),
Token::StructEnd,
],
);
} | rust_cleaned_test_functions.jsonl/58613 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 293
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44830,
15126,
368,
341,
262,
2060,
75861,
28838,
1006,
286,
609,
35134,
9422,
314,
264,
25,
220,
16,
11,
293,
25,
220,
17,
1153,
286,
609,
9640,
310,
9660,
486,
9422,
314,
829,
25,
330,
35134,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mean_with_low_d2() {
let mean = |x: FisherSnedecor| x.mean().unwrap();
get_value(0.1, 0.1, mean);
} | rust_cleaned_test_functions.jsonl/42681 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 78
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16933,
6615,
23767,
814,
17,
368,
341,
286,
1077,
3076,
284,
760,
87,
25,
35504,
50,
18694,
757,
269,
91,
856,
18711,
1005,
15454,
543,
286,
633,
3142,
7,
15,
13,
16,
11,
220,
15,
13,
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 |
#[test]
fn test_calculate_n_for_row_and_column() {
assert_eq!(1, calculate_n_for_row_and_column(1, 1));
assert_eq!(2, calculate_n_for_row_and_column(2, 1));
assert_eq!(3, calculate_n_for_row_and_column(1, 2));
assert_eq!(4, calculate_n_for_row_and_column(3, 1));
assert_eq!(5, calculate_n_for_row_and_column(2, 2));
assert_eq!(6, calculate_n_for_row_and_column(1, 3));
} | rust_cleaned_test_functions.jsonl/64657 | {
"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,
24005,
11207,
1089,
5478,
8530,
8378,
8744,
368,
341,
286,
2060,
10714,
10297,
16,
11,
11047,
1089,
5478,
8530,
8378,
8744,
7,
16,
11,
220,
16,
1106,
286,
2060,
10714,
10297,
17,
11,
11047,
1089... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_err_syscall_string() {
test_interpreter_and_jit_asm!(
"
mov64 r1, 0x0
syscall BpfSyscallString
mov64 r0, 0x0
exit",
[72, 101, 108, 108, 111],
(
b"BpfSyscallString" => syscalls::BpfSyscallString::call; syscalls::BpfSyscallString {},
),
{
|_vm, res: Result| {
matches!(res.unwrap_err(),
EbpfError::AccessViolation(pc, access_type, vm_addr, len, name)
if access_type == AccessType::Load && pc == 0 && vm_addr == 0 && len == 0 && name == "unknown"
)
}
},
2
);
} | rust_cleaned_test_functions.jsonl/59046 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 394
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9266,
20344,
6659,
3904,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
6228,
286,
1974,
21,
19,
435,
16,
11,
220,
15,
87,
15,
198,
286,
49345,
425,
15897,
32792,
6659,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_no_completions_required() {
// There must be no hint for 'in' keyword.
check_no_completion(r#"fn foo() { for i i$0 }"#);
// After 'in' keyword hints may be spawned.
check_detail_and_documentation(
r#"
/// Do the foo
fn foo() -> &'static str { "foo" }
fn bar() {
for c in fo$0
}
"#,
DetailAndDocumentation { detail: "fn() -> &str", documentation: "Do the foo" },
);
} | rust_cleaned_test_functions.jsonl/128377 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 214
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
2965,
10819,
908,
18743,
368,
341,
286,
442,
2619,
1969,
387,
902,
13012,
369,
364,
258,
6,
16174,
624,
286,
1779,
6536,
60164,
2601,
55543,
8822,
15229,
368,
314,
369,
600,
600,
3,
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_rchunks_mut_next_back() {
let mut v = [0, 1, 2, 3, 4, 5];
let mut c = v.rchunks_mut(2);
assert_eq!(c.next_back().unwrap(), &mut [0, 1]);
assert_eq!(c.next_back().unwrap(), &mut [2, 3]);
assert_eq!(c.next_back().unwrap(), &mut [4, 5]);
assert_eq!(c.next_back(), None);
let mut v = [0, 1, 2, 3, 4, 5, 6, 7];
let mut c = v.rchunks_mut(3);
assert_eq!(c.next_back().unwrap(), &mut [0, 1]);
assert_eq!(c.next_back().unwrap(), &mut [2, 3, 4]);
assert_eq!(c.next_back().unwrap(), &mut [5, 6, 7]);
assert_eq!(c.next_back(), None);
} | rust_cleaned_test_functions.jsonl/9671 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 297
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
84263,
29523,
11257,
3895,
368,
341,
262,
1077,
5206,
348,
284,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
262,
1077,
5206,
272,
284,
348,
1746,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_full_path_glob_searches() {
let te = TestEnv::new(DEFAULT_DIRS, DEFAULT_FILES);
te.assert_output(
&["--glob", "--full-path", "**/one/**/*.foo"],
"one/b.foo
one/two/c.foo
one/two/three/d.foo",
);
te.assert_output(
&["--glob", "--full-path", "**/one/*/*.foo"],
" one/two/c.foo",
);
te.assert_output(
&["--glob", "--full-path", "**/one/*/*/*.foo"],
" one/two/three/d.foo",
);
} | rust_cleaned_test_functions.jsonl/10856 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 269
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16372,
2638,
95133,
10716,
288,
368,
341,
262,
1077,
1013,
284,
3393,
14359,
486,
931,
43175,
90560,
11,
11955,
48010,
626,
262,
1013,
3713,
7645,
1006,
286,
609,
1183,
313,
58926,
497,
14482,
887... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_take_value_index_from_list() {
let value_data = Int32Array::from((0..10).collect::<Vec<i32>>()).data();
let value_offsets = Buffer::from(&[0, 2, 5, 10].to_byte_slice());
let list_data_type = DataType::List(Box::new(DataType::Int32));
let list_data = ArrayData::builder(list_data_type.clone())
.len(3)
.add_buffer(value_offsets.clone())
.add_child_data(value_data.clone())
.build();
let array = Arc::new(ListArray::from(list_data)) as ArrayRef;
let index = UInt32Array::from(vec![2, 0]);
let (indexed, offsets) = take_value_indices_from_list(&array, &index);
assert_eq!(vec![0, 5, 7], offsets);
let data = UInt32Array::from(vec![
Some(5),
Some(6),
Some(7),
Some(8),
Some(9),
Some(0),
Some(1),
])
.data();
assert_eq!(data, indexed.data());
} | rust_cleaned_test_functions.jsonl/16032 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 517
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73261,
3142,
3560,
5673,
2019,
368,
341,
286,
1077,
897,
1769,
284,
1333,
18,
17,
1857,
486,
1499,
1188,
15,
496,
16,
15,
568,
17384,
27638,
10050,
21897,
18,
17,
2452,
6011,
691,
543,
286,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_coma() {
assert_eq!(coma(","), Ok(("", ",")));
assert_eq!(
coma("a"),
Err(NomErr::Error(VerboseError {
errors: vec![
("a", VerboseErrorKind::Nom(ErrorKind::Tag)),
("a", VerboseErrorKind::Context("coma")),
]
}))
);
} | rust_cleaned_test_functions.jsonl/17450 | {
"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,
2965,
64,
368,
341,
286,
2060,
10714,
10297,
81845,
47503,
701,
7622,
7,
19814,
15553,
4945,
286,
2060,
10714,
33673,
310,
69298,
445,
64,
4461,
310,
15495,
8204,
316,
7747,
486,
1454,
7,
63404,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_root_subscribe() {
let (subscriber, _id_receiver, mut transport_receiver) =
Subscriber::new_test("rootNotification");
let sub_id = SubscriptionId::Number(0);
let exit = Arc::new(AtomicBool::new(false));
let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(10_000);
let bank = Bank::new(&genesis_config);
let bank_forks = Arc::new(RwLock::new(BankForks::new(bank)));
let optimistically_confirmed_bank =
OptimisticallyConfirmedBank::locked_from_bank_forks_root(&bank_forks);
let subscriptions = RpcSubscriptions::new(
&exit,
bank_forks,
Arc::new(RwLock::new(BlockCommitmentCache::new_for_tests())),
optimistically_confirmed_bank,
);
subscriptions.add_root_subscription(sub_id.clone(), subscriber);
assert!(subscriptions
.subscriptions
.root_subscriptions
.read()
.unwrap()
.contains_key(&sub_id));
subscriptions.notify_roots(vec![2, 1, 3]);
for expected_root in 1..=3 {
let (response, receiver) = robust_poll_or_panic(transport_receiver);
transport_receiver = receiver;
let expected_res_str =
serde_json::to_string(&serde_json::to_value(expected_root).unwrap()).unwrap();
let expected = format!(
r#"{{"jsonrpc":"2.0","method":"rootNotification","params":{{"result":{},"subscription":0}}}}"#,
expected_res_str
);
assert_eq!(expected, response);
}
subscriptions.remove_root_subscription(&sub_id);
assert!(!subscriptions
.subscriptions
.root_subscriptions
.read()
.unwrap()
.contains_key(&sub_id));
} | rust_cleaned_test_functions.jsonl/74727 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 912
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
12993,
88935,
368,
341,
286,
1077,
320,
59205,
11,
716,
307,
65691,
11,
5206,
7557,
65691,
8,
4035,
310,
69653,
486,
931,
4452,
445,
2888,
11196,
797,
286,
1077,
1186,
842,
284,
29617,
764... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_to_ipv6_link_local() {
assert_eq!(
Mac::new([0x00, 0x1a, 0xaa, 0x12, 0x34, 0x56]).to_ipv6_link_local().get(),
Ipv6Addr::new([
0xfe, 0x80, // IPv6 link-local prefix
0, 0, 0, 0, 0, 0, // Padding zeroes
0x02, 0x1a, 0xaa, 0xff, 0xfe, 0x12, 0x34, 0x56, // EUI-64
])
);
assert_eq!(
Mac::new([0x00, 0x1a, 0xaa, 0x12, 0x34, 0x56])
.to_ipv6_link_local_with_magic([0xfe, 0xfe])
.get(),
Ipv6Addr::new([
0xfe, 0x80, // IPv6 link-local prefix
0, 0, 0, 0, 0, 0, // Padding zeroes
0x02, 0x1a, 0xaa, 0xfe, 0xfe, 0x12, 0x34, 0x56, // EUI-64
])
);
} | rust_cleaned_test_functions.jsonl/19936 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 531
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
49378,
21,
7233,
13564,
368,
341,
286,
2060,
10714,
33673,
310,
7401,
486,
931,
2561,
15,
87,
15,
15,
11,
220,
15,
87,
16,
64,
11,
220,
15,
43300,
11,
220,
15,
87,
16,
17,
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_hkdf() {
use crate::CryptoCtx;
let ctx = CryptoCtx::new();
let mut out = vec![0u8; 32];
let key_handle = ctx
.symmetric_key_import("HKDF-EXTRACT/SHA-512", b"IKM")
.unwrap();
let state_handle = ctx
.symmetric_state_open("HKDF-EXTRACT/SHA-512", Some(key_handle), None)
.unwrap();
ctx.symmetric_state_absorb(state_handle, b"salt").unwrap();
let prk_handle = ctx
.symmetric_state_squeeze_key(state_handle, "HKDF-EXPAND/SHA-512")
.unwrap();
ctx.symmetric_state_close(state_handle).unwrap();
ctx.symmetric_key_close(key_handle).unwrap();
let state_handle = ctx
.symmetric_state_open("HKDF-EXPAND/SHA-512", Some(prk_handle), None)
.unwrap();
ctx.symmetric_state_absorb(state_handle, b"info").unwrap();
ctx.symmetric_state_squeeze(state_handle, &mut out).unwrap();
ctx.symmetric_state_close(state_handle).unwrap();
} | rust_cleaned_test_functions.jsonl/132173 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 447
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1523,
74,
2940,
368,
341,
262,
990,
17717,
486,
58288,
23684,
401,
262,
1077,
5635,
284,
32886,
23684,
486,
931,
1428,
262,
1077,
5206,
700,
284,
7486,
20703,
15,
84,
23,
26,
220,
18,
17,
4821... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_cstr_mut() {
let mut buf = [1, 2, 3];
let cstr_mut = unsafe { CStrMut::new(buf.as_mut_ptr(), buf.len()) };
// panics as there is no null terminator.
cstr_mut.as_ref();
} | rust_cleaned_test_functions.jsonl/42134 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 118
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
666,
495,
29523,
368,
341,
286,
1077,
5206,
6607,
284,
508,
16,
11,
220,
17,
11,
220,
18,
935,
286,
1077,
272,
495,
29523,
284,
19860,
314,
356,
2580,
51440,
486,
931,
10731,
5357,
2952... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_calculate_stake_weighted_timestamp_uses_median() {
let recent_timestamp: UnixTimestamp = 1_578_909_061;
let slot = 5;
let slot_duration = Duration::from_millis(400);
let pubkey0 = solana_sdk::pubkey::new_rand();
let pubkey1 = solana_sdk::pubkey::new_rand();
let pubkey2 = solana_sdk::pubkey::new_rand();
let pubkey3 = solana_sdk::pubkey::new_rand();
let pubkey4 = solana_sdk::pubkey::new_rand();
let max_allowable_drift = MaxAllowableDrift { fast: 25, slow: 25 };
let stakes: HashMap<Pubkey, (u64, Account)> = [
(
pubkey0,
(sol_to_lamports(1.0), Account::new(1, 0, &Pubkey::default())),
),
(
pubkey1,
(sol_to_lamports(1.0), Account::new(1, 0, &Pubkey::default())),
),
(
pubkey2,
(
sol_to_lamports(1_000_000.0),
Account::new(1, 0, &Pubkey::default()),
),
),
(
pubkey3,
(
sol_to_lamports(1_000_000.0),
Account::new(1, 0, &Pubkey::default()),
),
),
(
pubkey4,
(
sol_to_lamports(1_000_000.0),
Account::new(1, 0, &Pubkey::default()),
),
),
]
.iter()
.cloned()
.collect();
let unique_timestamps: HashMap<Pubkey, (Slot, UnixTimestamp)> = [
(pubkey0, (5, 0)),
(pubkey1, (5, recent_timestamp)),
(pubkey2, (5, recent_timestamp)),
(pubkey3, (5, recent_timestamp)),
(pubkey4, (5, recent_timestamp)),
]
.iter()
.cloned()
.collect();
let bounded = calculate_stake_weighted_timestamp(
&unique_timestamps,
&stakes,
slot as Slot,
slot_duration,
None,
max_allowable_drift,
true,
)
.unwrap();
assert_eq!(bounded, recent_timestamp); // low-staked outlier cannot affect bounded timestamp
let unique_timestamps: HashMap<Pubkey, (Slot, UnixTimestamp)> = [
(pubkey0, (5, recent_timestamp)),
(pubkey1, (5, i64::MAX)),
(pubkey2, (5, recent_timestamp)),
(pubkey3, (5, recent_timestamp)),
(pubkey4, (5, recent_timestamp)),
]
.iter()
.cloned()
.collect();
let bounded = calculate_stake_weighted_timestamp(
&unique_timestamps,
&stakes,
slot as Slot,
slot_duration,
None,
max_allowable_drift,
true,
)
.unwrap();
assert_eq!(bounded, recent_timestamp); // low-staked outlier cannot affect bounded timestamp
let unique_timestamps: HashMap<Pubkey, (Slot, UnixTimestamp)> = [
(pubkey0, (5, 0)),
(pubkey1, (5, i64::MAX)),
(pubkey2, (5, recent_timestamp)),
(pubkey3, (5, recent_timestamp)),
(pubkey4, (5, recent_timestamp)),
]
.iter()
.cloned()
.collect();
let bounded = calculate_stake_weighted_timestamp(
&unique_timestamps,
&stakes,
slot as Slot,
slot_duration,
None,
max_allowable_drift,
true,
)
.unwrap();
assert_eq!(bounded, recent_timestamp); // multiple low-staked outliers cannot affect bounded timestamp if they don't shift the median
let stakes: HashMap<Pubkey, (u64, Account)> = [
(
pubkey0,
(
sol_to_lamports(1_000_000.0), // 1/3 stake
Account::new(1, 0, &Pubkey::default()),
),
),
(
pubkey1,
(
sol_to_lamports(1_000_000.0),
Account::new(1, 0, &Pubkey::default()),
),
),
(
pubkey2,
(
sol_to_lamports(1_000_000.0),
Account::new(1, 0, &Pubkey::default()),
),
),
]
.iter()
.cloned()
.collect();
let unique_timestamps: HashMap<Pubkey, (Slot, UnixTimestamp)> = [
(pubkey0, (5, 0)),
(pubkey1, (5, i64::MAX)),
(pubkey2, (5, recent_timestamp)),
]
.iter()
.cloned()
.collect();
let bounded = calculate_stake_weighted_timestamp(
&unique_timestamps,
&stakes,
slot as Slot,
slot_duration,
None,
max_allowable_drift,
true,
)
.unwrap();
assert_eq!(bounded, recent_timestamp);
let stakes: HashMap<Pubkey, (u64, Account)> = [
(
pubkey0,
(
sol_to_lamports(1_000_001.0), // 1/3 stake
Account::new(1, 0, &Pubkey::default()),
),
),
(
pubkey1,
(
sol_to_lamports(1_000_000.0),
Account::new(1, 0, &Pubkey::default()),
),
),
]
.iter()
.cloned()
.collect();
let unique_timestamps: HashMap<Pubkey, (Slot, UnixTimestamp)> =
[(pubkey0, (5, 0)), (pubkey1, (5, recent_timestamp))]
.iter()
.cloned()
.collect();
let bounded = calculate_stake_weighted_timestamp(
&unique_timestamps,
&stakes,
slot as Slot,
slot_duration,
None,
max_allowable_drift,
true,
)
.unwrap();
assert_eq!(recent_timestamp - bounded, 1578909061); // outliers > 1/2 of available stake can affect timestamp
} | rust_cleaned_test_functions.jsonl/62272 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3703
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24005,
11207,
1261,
726,
15876,
291,
23073,
62,
4776,
83003,
368,
341,
286,
1077,
3213,
23073,
25,
46995,
20812,
284,
220,
16,
62,
20,
22,
23,
62,
24,
15,
24,
62,
15,
21,
16,
280,
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_manual_static_impl() {
enum Enum {
Struct { x: &'static str },
Tuple(u8),
Unit,
}
static ENUM_STRUCT_FIELDS: &[NamedField<'static>] = &[NamedField::new("x")];
static ENUM_VARIANTS: &[VariantDef<'static>] = &[
VariantDef::new("Struct", Fields::Named(&ENUM_STRUCT_FIELDS)),
VariantDef::new("Tuple", Fields::Unnamed),
VariantDef::new("Unit", Fields::Unnamed),
];
impl Enumerable for Enum {
fn definition(&self) -> EnumDef<'_> {
EnumDef::new_static("Enum", ENUM_VARIANTS)
}
fn variant(&self) -> Variant<'_> {
match *self {
Enum::Struct { .. } => Variant::Static(&ENUM_VARIANTS[0]),
Enum::Tuple(..) => Variant::Static(&ENUM_VARIANTS[1]),
Enum::Unit => Variant::Static(&ENUM_VARIANTS[2]),
}
}
}
impl Valuable for Enum {
fn as_value(&self) -> Value<'_> {
Value::Enumerable(self)
}
fn visit(&self, visitor: &mut dyn Visit) {
match self {
Enum::Struct { x } => {
visitor.visit_named_fields(&NamedValues::new(
ENUM_STRUCT_FIELDS,
&[Value::String(x)],
));
}
Enum::Tuple(y) => {
visitor.visit_unnamed_fields(&[Value::U8(*y)]);
}
Enum::Unit => {
visitor.visit_unnamed_fields(&[]);
}
}
}
}
let v = Enum::Struct { x: "a" };
assert_eq!(format!("{:?}", v.as_value()), r#"Enum::Struct { x: "a" }"#);
let v = Enum::Tuple(0);
assert_eq!(format!("{:?}", v.as_value()), r#"Enum::Tuple(0)"#);
let v = Enum::Unit;
assert_eq!(format!("{:?}", v.as_value()), r#"Enum::Unit"#);
} | rust_cleaned_test_functions.jsonl/55827 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1056
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75428,
25360,
21007,
368,
341,
262,
7618,
14086,
341,
286,
16139,
314,
856,
25,
30136,
1978,
607,
1153,
286,
24622,
8154,
23,
1326,
286,
7954,
345,
262,
555,
262,
1099,
68404,
30474,
52999,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_custom_request() {
let rpc_client = RpcClient::new_mock("succeeds".to_string());
let slot = rpc_client.get_slot().unwrap();
assert_eq!(slot, 0);
let custom_slot = rpc_client
.send::<Slot>(RpcRequest::Custom { method: "getSlot" }, Value::Null)
.unwrap();
assert_eq!(slot, custom_slot);
} | rust_cleaned_test_functions.jsonl/2733 | {
"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,
15875,
7893,
368,
341,
286,
1077,
35596,
8179,
284,
79961,
2959,
486,
931,
34134,
445,
82,
29264,
82,
3263,
983,
3904,
5231,
286,
1077,
9446,
284,
35596,
8179,
670,
27563,
1005,
15454,
543,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_calculates_distance() {
let reindeer = Reindeer::parse("Dancer can fly 16 km/s for 11 seconds, but then must rest for 162 seconds.");
assert_eq!(reindeer.distance(10), 160);
assert_eq!(reindeer.distance(11), 176);
assert_eq!(reindeer.distance(12), 176);
assert_eq!(reindeer.distance(173), 176);
assert_eq!(reindeer.distance(174), 192);
} | rust_cleaned_test_functions.jsonl/45043 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24005,
3314,
973,
19464,
368,
341,
286,
1077,
15244,
96262,
284,
1032,
26976,
261,
486,
6400,
445,
35,
11705,
646,
11466,
220,
16,
21,
13136,
2687,
369,
220,
16,
16,
6486,
11,
714,
1221,
1969,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reconcile_blockstore_roots_with_tower_panic_no_common_root() {
solana_logger::setup();
let blockstore_path = get_tmp_ledger_path!();
{
let blockstore = Blockstore::open(&blockstore_path).unwrap();
let (shreds, _) = make_slot_entries(1, 0, 42);
blockstore.insert_shreds(shreds, None, false).unwrap();
let (shreds, _) = make_slot_entries(3, 1, 42);
blockstore.insert_shreds(shreds, None, false).unwrap();
let (shreds, _) = make_slot_entries(4, 1, 42);
blockstore.insert_shreds(shreds, None, false).unwrap();
blockstore.set_roots(std::iter::once(&3)).unwrap();
assert!(!blockstore.is_root(0));
assert!(!blockstore.is_root(1));
assert!(blockstore.is_root(3));
assert!(!blockstore.is_root(4));
let mut tower = Tower::default();
tower.vote_state.root_slot = Some(4);
reconcile_blockstore_roots_with_tower(&tower, &blockstore).unwrap();
}
Blockstore::destroy(&blockstore_path).expect("Expected successful database destruction");
} | rust_cleaned_test_functions.jsonl/61161 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 561
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
40446,
457,
7113,
4314,
26608,
2412,
6615,
528,
1202,
620,
31270,
6536,
21107,
12993,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
2504,
4314,
2638,
284,
633,
16125,
38367,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_string() {
let j = r#""line\nnewline\"\\abc\uD83D\uDC96""#.as_bytes();
assert_eq!(Parser::from_reader(j).next().unwrap().unwrap(),
Event::String("line\nnewline\"\\abc💖".to_string()));
} | rust_cleaned_test_functions.jsonl/12579 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
368,
341,
262,
1077,
502,
284,
435,
2,
3014,
1056,
1699,
89202,
2105,
3422,
13683,
86649,
23,
18,
35,
3770,
5626,
24,
21,
3014,
87846,
300,
12524,
543,
262,
2060,
10714,
10297,
6570,
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_merge_operator() {
let n = DBPath::new("_rust_rocksdb_cftest_merge");
{
let mut opts = Options::default();
opts.set_merge_operator_associative("test operator", test_provided_merge);
let db = match DB::open_cf(&opts, &n, &["cf1"]) {
Ok(db) => {
println!("successfully opened db with column family");
db
}
Err(e) => panic!("failed to open db with column family: {}", e),
};
let cf1 = db.cf_handle("cf1").unwrap();
assert!(db.put_cf(&cf1, b"k1", b"v1").is_ok());
assert_eq!(db.get_cf(&cf1, b"k1").unwrap().unwrap(), b"v1");
let p = db.put_cf(&cf1, b"k1", b"a");
assert!(p.is_ok());
db.merge_cf(&cf1, b"k1", b"b").unwrap();
db.merge_cf(&cf1, b"k1", b"c").unwrap();
db.merge_cf(&cf1, b"k1", b"d").unwrap();
db.merge_cf(&cf1, b"k1", b"efg").unwrap();
let m = db.merge_cf(&cf1, b"k1", b"h");
println!("m is {:?}", m);
match db.get(b"k1") {
Ok(Some(value)) => match std::str::from_utf8(&value) {
Ok(v) => println!("retrieved utf8 value: {}", v),
Err(_) => println!("did not read valid utf-8 out of the db"),
},
Err(_) => println!("error reading value"),
_ => panic!("value not present!"),
}
let _ = db.get_cf(&cf1, b"k1");
assert!(db.delete(b"k1").is_ok());
assert!(db.get(b"k1").unwrap().is_none());
}
} | rust_cleaned_test_functions.jsonl/79607 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 853
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20888,
40594,
368,
341,
262,
1077,
308,
284,
5952,
1820,
486,
931,
16975,
35788,
26608,
14553,
1999,
666,
723,
477,
20888,
797,
1066,
262,
341,
286,
1077,
5206,
12185,
284,
14566,
486,
2258,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_vec3mask_and() {
assert_eq!(
(Vec3AMask::new(false, false, false) & Vec3AMask::new(false, false, false)).bitmask(),
0b000,
);
assert_eq!(
(Vec3AMask::new(true, true, true) & Vec3AMask::new(true, true, true)).bitmask(),
0b111,
);
assert_eq!(
(Vec3AMask::new(true, false, true) & Vec3AMask::new(false, true, false)).bitmask(),
0b000,
);
assert_eq!(
(Vec3AMask::new(true, false, true) & Vec3AMask::new(true, true, true)).bitmask(),
0b101,
);
let mut mask = Vec3AMask::new(true, true, false);
mask &= Vec3AMask::new(true, false, false);
assert_eq!(mask.bitmask(), 0b001);
} | rust_cleaned_test_functions.jsonl/23498 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 346
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
18,
11258,
8378,
368,
341,
262,
2060,
10714,
33673,
286,
320,
10050,
18,
1402,
1073,
486,
931,
3576,
11,
895,
11,
895,
8,
609,
11312,
18,
1402,
1073,
486,
931,
3576,
11,
895,
11,
895,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ir_reader() {
let ctx = Context::new();
let ir_text = "define i32 @main() { ret i32 42 }";
let module = Module::parse_ir_from_str(&ctx, ir_text);
assert!(
module.is_ok(),
"Failed to prase LLVM IR: {}",
module.err().unwrap()
);
} | rust_cleaned_test_functions.jsonl/72315 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 140
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51433,
22306,
368,
341,
262,
1077,
5635,
284,
9608,
486,
931,
543,
262,
1077,
6216,
4326,
284,
330,
1289,
600,
18,
17,
569,
3817,
368,
314,
2112,
600,
18,
17,
220,
19,
17,
335,
3302,
262,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_plus_garbage() {
let mut fb = FooBar(0);
fb.set_foo1(0b10);
assert_eq!(0x0, fb.0);
assert_eq!(0x0, fb.foo1());
assert_eq!(0x0, fb.foo2());
fb.set_foo1(0b11);
assert_eq!(0x1, fb.0);
assert_eq!(0x1, fb.foo1());
assert_eq!(0x0, fb.foo2());
} | rust_cleaned_test_functions.jsonl/2262 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 184
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19487,
13996,
28043,
1889,
277,
20652,
368,
341,
262,
1077,
5206,
25469,
284,
33428,
3428,
7,
15,
626,
262,
25469,
980,
761,
2624,
16,
7,
15,
65,
16,
15,
317,
262,
2060,
10714,
10297,
15,
87,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_no_generic_generate_evaluator() {
let gen = no_generic_fn();
let expected: TokenStream = quote! {
pub struct Foo_Evaluator(std::marker::PhantomData<()>);
impl<'arg_> crate::function::Evaluator<'arg_> for Foo_Evaluator {
#[inline]
fn eval(
self,
def: impl crate::function::ArgDef,
ctx: &mut tidb_query_datatype::expr::EvalContext,
output_rows: usize,
args: &[crate::RpnStackNode<'_>],
extra: &mut crate::RpnFnCallExtra<'_>,
metadata: &(dyn std::any::Any + Send),
) -> tidb_query_common::Result<tidb_query_datatype::codec::data_type::VectorValue> {
Foo_Fn::eval(def, ctx, output_rows, args, extra, metadata)
}
}
};
assert_eq!(expected.to_string(), gen.generate_evaluator().to_string());
} | rust_cleaned_test_functions.jsonl/17080 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 559
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
41232,
48851,
21296,
45162,
368,
341,
286,
1077,
4081,
284,
902,
41232,
15246,
543,
286,
1077,
3601,
25,
9660,
3027,
284,
12641,
0,
341,
310,
6675,
2036,
33428,
2089,
52389,
5194,
486,
27742... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ccsds_parser_version_valid() {
let mut parser = CcsdsParser::new();
parser.recv_slice(&[0x1F,0xFF,0xFF,0xFF,0x00,0x00,0xFF, 0xFF]);
assert_eq!(parser.current_status(), CcsdsParserStatus::ValidPacket);
assert_ne!(parser.pull_packet(), None);
} | rust_cleaned_test_functions.jsonl/105738 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 137
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28955,
82,
5356,
18517,
9438,
8337,
368,
972,
262,
1077,
5206,
6729,
284,
356,
4837,
5356,
6570,
486,
931,
1647,
262,
6729,
40433,
26488,
2099,
58,
15,
87,
16,
37,
11,
15,
9264,
11,
15,
9264,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_delimiter_preserves_leading_whitespace_in_unselected_fields() {
new_ucmd!()
.args(&["-d=|", "--to=si"])
.pipe_in(" 1000| 2000")
.succeeds()
.stdout_only("1.0K| 2000\n");
} | rust_cleaned_test_functions.jsonl/46029 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18029,
17700,
32116,
13280,
11751,
2228,
86175,
1243,
4907,
4525,
12132,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
12,
67,
28,
91,
497,
14482,
983,
28,
6321,
14108,
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_match_group_pattern_with_multiple_statement() {
parse_macro(
r#"
macro_rules! foo {
($ ($ i:ident),*) => ( fn baz { $ (
$ i ();
)*} );
}
"#,
)
.assert_expand_items("foo! { foo, bar }", "fn baz {foo () ; bar () ;}");
} | rust_cleaned_test_functions.jsonl/28712 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 176
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10708,
6288,
21260,
6615,
45233,
37404,
368,
341,
262,
4715,
58810,
1006,
286,
435,
2,
698,
286,
18072,
21407,
0,
15229,
341,
310,
1711,
1711,
600,
25,
1713,
701,
3764,
589,
320,
5168,
50247,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.