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_exonum_time_service_with_7_validators() {
let mut testkit = TestKitBuilder::validator()
.with_validators(7)
.with_service(TimeService::new())
.create();
let validators = testkit.network().validators().to_vec();
let mut validators_times = vec![None; 7];
assert_storage_times_eq(testkit.snapshot(), &validators, None, &validators_times);
let time = Utc::now();
let times = (0..7)
.map(|x| time + Duration::seconds(x * 10))
.collect::<Vec<_>>();
let expected_storage_times = vec![
None,
None,
None,
None,
Some(times[2]),
Some(times[3]),
Some(times[4]),
];
for (i, validator) in validators.iter().enumerate() {
let tx = {
let (pub_key, sec_key) = validator.service_keypair();
TxTime::new(times[i], pub_key, sec_key)
};
testkit.create_block_with_transactions(txvec![tx.clone()]);
assert_eq!(
Schema::new(testkit.snapshot())
.transaction_results()
.get(&tx.hash()),
Some(TransactionResult(Ok(())))
);
validators_times[i] = Some(times[i]);
assert_storage_times_eq(
testkit.snapshot(),
&validators,
expected_storage_times[i],
&validators_times,
);
}
} | rust_cleaned_test_functions.jsonl/57375 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 697
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2702,
263,
372,
3009,
12267,
6615,
62,
22,
8337,
2973,
368,
341,
262,
1077,
5206,
1273,
8226,
284,
3393,
7695,
3297,
486,
16112,
741,
286,
659,
4197,
8337,
2973,
7,
22,
340,
286,
659,
4197,
12... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_url_query() {
let url = Url::parse("http://example.dom?q=value").unwrap();
let req = Request::with_connector(
Get, url, &mut MockConnector
).unwrap();
let bytes = run_request(req);
let s = from_utf8(&bytes[..]).unwrap();
assert!(s.contains("?q=value"));
} | rust_cleaned_test_functions.jsonl/2066 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 165
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2903,
5738,
368,
341,
286,
1077,
2515,
284,
22840,
486,
6400,
445,
1254,
1110,
8687,
21435,
43782,
46538,
1827,
15454,
543,
286,
1077,
4232,
284,
6145,
486,
4197,
76393,
1006,
310,
2126,
11,
2515,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_uint_from_sub_no_panic() {
assert_eq!(
Uint256::from(1 as u32).sub(Uint256::from(1)),
Uint256::from(0 as u32)
);
} | rust_cleaned_test_functions.jsonl/47732 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 108
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15807,
5673,
5228,
6536,
620,
31270,
368,
341,
286,
2060,
10714,
33673,
310,
27883,
17,
20,
21,
486,
1499,
7,
16,
438,
575,
18,
17,
568,
1966,
12317,
396,
17,
20,
21,
486,
1499,
7,
16,
6965,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_buy() {
let mut supplies = Supplies::new();
let mut cout = Cursor::new(Vec::new());
let mut cin = Cursor::new(Vec::new());
cin.write(b"50\r\n75\r\n100\r\n150\r\n").unwrap();
cin.seek(SeekFrom::Start(0)).unwrap();
supplies.buy(&mut cout, &mut cin);
assert_eq!(50, supplies.food_left());
assert_eq!(75, supplies.ammo_left());
assert_eq!(100, supplies.clothes_left());
assert_eq!(150, supplies.misc_left());
} | rust_cleaned_test_functions.jsonl/28676 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 253
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46348,
368,
341,
286,
1077,
5206,
16720,
284,
50252,
486,
931,
543,
286,
1077,
5206,
5034,
284,
28067,
486,
931,
49923,
486,
931,
1423,
286,
1077,
5206,
8461,
284,
28067,
486,
931,
49923,
486,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_primitive_array_add_mismatched_length() {
let a = Int32Array::from(vec![5, 6, 7, 8, 9]);
let b = Int32Array::from(vec![6, 7, 8]);
let e = add(&a, &b)
.err()
.expect("should have failed due to different lengths");
assert_eq!(
"ComputeError(\"Cannot perform math operation on arrays of different length\")",
format!("{:?}", e)
);
} | rust_cleaned_test_functions.jsonl/17851 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 221
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84087,
3858,
2891,
717,
24976,
291,
5118,
368,
341,
286,
1077,
264,
284,
1333,
18,
17,
1857,
486,
1499,
25592,
20703,
20,
11,
220,
21,
11,
220,
22,
11,
220,
23,
11,
220,
24,
2558,
286,
1077,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_line_wrap() {
assert_eq!("abcd".wrap(7), "abcd");
assert_eq!(
"1 3 5 7 9 1 39234 290 290 5 7 9".wrap(10),
"1 3 5 7 9\n1 39234\n290 290 5\n7 9"
);
assert_eq!(
"1 3 5 7 9 1 39234 290 290 5 7 9".wrap(10),
"1 3 5 7 9\n1 39234\n290 290 5\n7 9"
);
} | rust_cleaned_test_functions.jsonl/19543 | {
"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,
6528,
38550,
368,
341,
286,
2060,
10714,
17223,
68644,
3263,
10097,
7,
22,
701,
330,
68644,
797,
286,
2060,
10714,
33673,
310,
330,
16,
220,
18,
220,
20,
220,
22,
220,
24,
220,
16,
220,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_host_localhost_open_write_err() {
let host: Localhost = Localhost::new(PathBuf::from("/dev")).ok().unwrap();
let file: tempfile::NamedTempFile = create_sample_file();
fs::set_permissions(file.path(), PermissionsExt::from_mode(0o444)).unwrap();
assert!(host.open_file_write(file.path()).is_err());
} | rust_cleaned_test_functions.jsonl/53628 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 169
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12848,
62,
8301,
11311,
9165,
9266,
368,
341,
286,
1077,
3468,
25,
8774,
3790,
284,
8774,
3790,
486,
931,
33030,
15064,
486,
1499,
4283,
3583,
15197,
562,
1005,
15454,
543,
286,
1077,
1034,
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_empty_key() {
let mut handlebars = Registry::new();
assert!(handlebars
.register_template_string("t0", "{{#each this}}{{@key}}-{{value}}\n{{/each}}")
.is_ok());
let r0 = handlebars
.render(
"t0",
&({
let mut rv = BTreeMap::new();
rv.insert("foo".to_owned(), {
let mut rv = BTreeMap::new();
rv.insert("value".to_owned(), "bar".to_owned());
rv
});
rv.insert("".to_owned(), {
let mut rv = BTreeMap::new();
rv.insert("value".to_owned(), "baz".to_owned());
rv
});
rv
}),
)
.unwrap();
let mut r0_sp: Vec<_> = r0.split('\n').collect();
r0_sp.sort();
assert_eq!(r0_sp, vec!["", "-baz", "foo-bar"]);
} | rust_cleaned_test_functions.jsonl/127937 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 669
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
3097,
368,
341,
286,
1077,
5206,
3705,
24950,
284,
32112,
486,
931,
543,
286,
2060,
10297,
8192,
24950,
198,
310,
659,
6343,
8693,
3904,
445,
83,
15,
497,
47219,
2,
9547,
419,
77286,
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_from_bits() {
let bytes = Scalar::zero().to_bytes();
assert_eq!(Scalar::from_bits(bytes.as_bits::<Lsb0>()), Scalar::zero());
let bytes = Scalar::one().to_bytes();
assert_eq!(Scalar::from_bits(bytes.as_bits::<Lsb0>()), Scalar::one());
// -1 should work
let bytes = (-Scalar::one()).to_bytes();
assert_eq!(Scalar::from_bits(bytes.as_bits::<Lsb0>()), -Scalar::one());
let bytes = [
165, 106, 149, 48, 225, 174, 19, 30, 39, 43, 36, 53, 240, 100, 242, 242, 201, 236, 143,
161, 185, 235, 182, 182, 124, 247, 149, 39, 117, 127, 51, 38,
];
assert_eq!(Scalar::from_bits(bytes.as_bits::<Lsb0>()), Scalar::zero());
} | rust_cleaned_test_functions.jsonl/14286 | {
"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,
5673,
20034,
368,
341,
286,
1077,
5820,
284,
35176,
486,
14154,
1005,
983,
12524,
543,
286,
2060,
10714,
10297,
20639,
486,
1499,
20034,
23158,
5357,
20034,
27638,
43,
16892,
15,
29,
11858,
35176,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_block_signature_try_from() {
let mut rng: StdRng = SeedableRng::from_seed([1u8; 32]);
let expected_block_signature = mc_transaction_core::BlockSignature::new(
Ed25519Signature::new([1; 64]),
(&Ed25519Private::from_random(&mut rng)).into(),
31337,
);
let mut source_block_signature = blockchain::BlockSignature::new();
let mut signature = external::Ed25519Signature::new();
signature.set_data(expected_block_signature.signature().to_bytes().to_vec());
source_block_signature.set_signature(signature);
let mut signer = external::Ed25519Public::new();
signer.set_data(expected_block_signature.signer().to_bytes().to_vec());
source_block_signature.set_signer(signer);
source_block_signature.set_signed_at(31337);
let block_signature =
mc_transaction_core::BlockSignature::try_from(&source_block_signature).unwrap();
assert_eq!(block_signature, expected_block_signature);
} | rust_cleaned_test_functions.jsonl/57759 | {
"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,
7113,
39859,
53283,
5673,
368,
341,
286,
1077,
5206,
28422,
25,
42517,
49,
968,
284,
35822,
480,
49,
968,
486,
1499,
33809,
2561,
16,
84,
23,
26,
220,
18,
17,
10149,
286,
1077,
3601,
7113,
398... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_change_admin() {
let (init_result, mut deps) = init_helper(vec![InitialBalance {
address: HumanAddr("bob".to_string()),
amount: Uint128(5000),
}]);
assert!(
init_result.is_ok(),
"Init failed: {}",
init_result.err().unwrap()
);
let handle_msg = HandleMsg::ChangeAdmin {
address: HumanAddr("bob".to_string()),
padding: None,
};
let handle_result = handle(&mut deps, mock_env("admin", &[]), handle_msg);
assert!(
handle_result.is_ok(),
"handle() failed: {}",
handle_result.err().unwrap()
);
let admin = ReadonlyConfig::from_storage(&deps.storage)
.constants()
.unwrap()
.admin;
assert_eq!(admin, HumanAddr("bob".to_string()));
} | rust_cleaned_test_functions.jsonl/69613 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 471
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10630,
15947,
12207,
368,
341,
286,
1077,
320,
2327,
5287,
11,
5206,
48178,
8,
284,
2930,
10418,
25592,
20703,
6341,
21190,
341,
310,
2621,
25,
11097,
13986,
445,
47086,
3263,
983,
3904,
14702,
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_max_size() {
let token_owner_record = TokenOwnerRecordV2 {
account_type: GovernanceAccountType::TokenOwnerRecordV2,
realm: Pubkey::new_unique(),
governing_token_mint: Pubkey::new_unique(),
governing_token_owner: Pubkey::new_unique(),
governing_token_deposit_amount: 10,
governance_delegate: Some(Pubkey::new_unique()),
unrelinquished_votes_count: 1,
total_votes_count: 1,
outstanding_proposal_count: 1,
reserved: [0; 7],
reserved_v2: [0; 128],
};
let size = get_packed_len::<TokenOwnerRecordV2>();
assert_eq!(token_owner_record.get_max_size(), Some(size));
} | rust_cleaned_test_functions.jsonl/36012 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 360
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6345,
2368,
368,
341,
286,
1077,
3950,
29027,
14192,
284,
9660,
13801,
6471,
53,
17,
341,
310,
2692,
1819,
25,
80589,
7365,
929,
486,
3323,
13801,
6471,
53,
17,
345,
310,
21889,
25,
22611,
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_set_shares() {
// arrange
let (tmp, weight) = setup("test_set_shares", CGROUP_CPU_WEIGHT);
let _ = set_fixture(&tmp, CGROUP_CPU_MAX, "")
.unwrap_or_else(|_| panic!("set test fixture for {}", CGROUP_CPU_MAX));
let cpu = LinuxCpuBuilder::new().with_shares(22000).build();
// act
Cpu::apply(&tmp, &cpu).expect("apply cpu");
// assert
let content = fs::read_to_string(weight)
.unwrap_or_else(|_| panic!("read {} file content", CGROUP_CPU_WEIGHT));
assert_eq!(content, 840.to_string());
} | rust_cleaned_test_functions.jsonl/126558 | {
"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,
2602,
3712,
5403,
368,
341,
286,
442,
30893,
198,
286,
1077,
320,
5173,
11,
4680,
8,
284,
6505,
445,
1944,
2602,
3712,
5403,
497,
6159,
11838,
29741,
60697,
317,
286,
1077,
716,
284,
738,
74409,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_all_and_write() -> io::Result<()> {
let temp = std::env::temp_dir();
let temp = temp.join("gazebo");
let temp = temp.join(random_part());
let remove_dir = RemoveDir(temp.clone());
let temp = temp.join("foo/bar");
create_dirs_and_write(&temp, "contents")?;
let contents = fs::read_to_string(temp)?;
assert_eq!(contents, "contents");
drop(remove_dir);
Ok(())
} | rust_cleaned_test_functions.jsonl/15674 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 251
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
5705,
8378,
9165,
368,
1464,
6399,
486,
2077,
71698,
341,
16885,
286,
1077,
2730,
284,
1460,
486,
3160,
486,
3888,
4334,
543,
286,
1077,
2730,
284,
2730,
5446,
445,
70,
9832,
749,
797,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_from_char_iter() {
let s = "\u{0} 0 \u{0}a𐀀𐀀 𐀀a𐀀";
println!("{}", s.len());
let compact: CompactString = s.chars().into_iter().collect();
assert!(!compact.is_heap_allocated());
assert_eq!(s, compact);
} | rust_cleaned_test_functions.jsonl/2785 | {
"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,
5673,
9232,
11723,
368,
341,
262,
1077,
274,
284,
2917,
84,
90,
15,
92,
220,
15,
1124,
84,
90,
15,
92,
64,
123934,
222,
222,
123934,
222,
222,
220,
123934,
222,
222,
64,
123934,
222,
222,
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_ser_new() {
let date_picker = DatePickerElement::new("action_id");
let json = serde_json::to_string_pretty(&date_picker).unwrap();
let expected = r#"{
"type": "datepicker",
"action_id": "action_id"
}"#;
assert_eq!(json, expected)
} | rust_cleaned_test_functions.jsonl/3897 | {
"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,
75861,
5921,
368,
341,
286,
1077,
2400,
68230,
284,
63426,
1691,
486,
931,
445,
1311,
842,
797,
286,
1077,
2951,
284,
61570,
9455,
486,
983,
3904,
620,
21322,
2099,
1028,
68230,
568,
15454,
1428,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_accountsdb_scan_snapshot_stores_illegal_bins() {
let mut stats = HashStats::default();
AccountsDb::scan_snapshot_stores(&[], &mut stats, 0);
} | rust_cleaned_test_functions.jsonl/44254 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 79
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55665,
1999,
28857,
53265,
1261,
4589,
26743,
6428,
44912,
368,
341,
286,
1077,
5206,
10472,
284,
6531,
16635,
486,
2258,
543,
286,
40655,
7994,
486,
16405,
53265,
1261,
4589,
2099,
12995,
609,
6984... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_string() {
let data = Data {
base: "https://example.com".into(),
client_id: "adbc01234".into(),
client_secret: "0987dcba".into(),
redirect: "urn:ietf:wg:oauth:2.0:oob".into(),
token: "fedc5678".into(),
};
let s = to_string(&data).expect("Couldn't serialize Data");
let desered = from_str(&s).expect("Couldn't deserialize Data");
assert_eq!(data, desered);
} | rust_cleaned_test_functions.jsonl/39221 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 248
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
3904,
368,
341,
286,
1077,
821,
284,
2885,
341,
310,
2331,
25,
330,
2428,
1110,
8687,
905,
3263,
18122,
3148,
310,
2943,
842,
25,
330,
329,
8904,
15,
16,
17,
18,
19,
3263,
18122,
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_bolt_invalid_invoices() {
// Tests the BOLT 11 invalid invoice test vectors
assert_eq!(Invoice::from_str(
"lnbc25m1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdq5vdhkven9v5sxyetpdeessp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygs9q4psqqqqqqqqqqqqqqqqsgqtqyx5vggfcsll4wu246hz02kp85x4katwsk9639we5n5yngc3yhqkm35jnjw4len8vrnqnf5ejh0mzj9n3vz2px97evektfm2l6wqccp3y7372"
), Err(ParseOrSemanticError::SemanticError(SemanticError::InvalidFeatures)));
assert_eq!(Invoice::from_str(
"lnbc2500u1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdpquwpc4curk03c9wlrswe78q4eyqc7d8d0xqzpuyk0sg5g70me25alkluzd2x62aysf2pyy8edtjeevuv4p2d5p76r4zkmneet7uvyakky2zr4cusd45tftc9c5fh0nnqpnl2jfll544esqchsrnt"
), Err(ParseOrSemanticError::ParseError(ParseError::Bech32Error(bech32::Error::InvalidChecksum))));
assert_eq!(Invoice::from_str(
"pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdpquwpc4curk03c9wlrswe78q4eyqc7d8d0xqzpuyk0sg5g70me25alkluzd2x62aysf2pyy8edtjeevuv4p2d5p76r4zkmneet7uvyakky2zr4cusd45tftc9c5fh0nnqpnl2jfll544esqchsrny"
), Err(ParseOrSemanticError::ParseError(ParseError::Bech32Error(bech32::Error::MissingSeparator))));
assert_eq!(Invoice::from_str(
"LNBC2500u1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdpquwpc4curk03c9wlrswe78q4eyqc7d8d0xqzpuyk0sg5g70me25alkluzd2x62aysf2pyy8edtjeevuv4p2d5p76r4zkmneet7uvyakky2zr4cusd45tftc9c5fh0nnqpnl2jfll544esqchsrny"
), Err(ParseOrSemanticError::ParseError(ParseError::Bech32Error(bech32::Error::MixedCase))));
assert_eq!(Invoice::from_str(
"lnbc2500u1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdq5xysxxatsyp3k7enxv4jsxqzpusp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygs9qrsgqwgt7mcn5yqw3yx0w94pswkpq6j9uh6xfqqqtsk4tnarugeektd4hg5975x9am52rz4qskukxdmjemg92vvqz8nvmsye63r5ykel43pgz7zq0g2"
), Err(ParseOrSemanticError::SemanticError(SemanticError::InvalidSignature)));
assert_eq!(Invoice::from_str(
"lnbc1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdpl2pkx2ctnv5sxxmmwwd5kgetjypeh2ursdae8g6na6hlh"
), Err(ParseOrSemanticError::ParseError(ParseError::TooShortDataPart)));
assert_eq!(Invoice::from_str(
"lnbc2500x1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdq5xysxxatsyp3k7enxv4jsxqzpusp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygs9qrsgqrrzc4cvfue4zp3hggxp47ag7xnrlr8vgcmkjxk3j5jqethnumgkpqp23z9jclu3v0a7e0aruz366e9wqdykw6dxhdzcjjhldxq0w6wgqcnu43j"
), Err(ParseOrSemanticError::ParseError(ParseError::UnknownSiPrefix)));
assert_eq!(Invoice::from_str(
"lnbc2500000001p1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdq5xysxxatsyp3k7enxv4jsxqzpusp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygs9qrsgq0lzc236j96a95uv0m3umg28gclm5lqxtqqwk32uuk4k6673k6n5kfvx3d2h8s295fad45fdhmusm8sjudfhlf6dcsxmfvkeywmjdkxcp99202x"
), Err(ParseOrSemanticError::SemanticError(SemanticError::ImpreciseAmount)));
} | rust_cleaned_test_functions.jsonl/22555 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1767
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
6181,
31433,
1243,
40683,
368,
341,
197,
322,
20150,
279,
425,
35320,
220,
16,
16,
8318,
24615,
1273,
22879,
198,
6948,
10714,
10297,
34674,
486,
1499,
2895,
1006,
197,
197,
1,
2261,
8904,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_local_mdns() {
// lookup to UDP should fail
// then lookup on TCP
let query = Query::query(Name::from_str("www.example.local.").unwrap(), RecordType::A);
let tcp_message: Result<DnsResponse, _> = Err(ResolveError::from("Forced Testing Error"));
let udp_message: Result<DnsResponse, _> = Err(ResolveError::from("Forced Testing Error"));
let mdns_record = v4_record(query.name().clone(), Ipv4Addr::new(127, 0, 0, 2));
let mdns_message = message(query.clone(), vec![mdns_record.clone()], vec![], vec![]);
let udp_nameserver = mock_nameserver(vec![udp_message.map(Into::into)], Default::default());
let tcp_nameserver = mock_nameserver(vec![tcp_message.map(Into::into)], Default::default());
let mdns_nameserver = mock_nameserver(vec![Ok(mdns_message.into())], Default::default());
let mut pool = mock_nameserver_pool(
vec![udp_nameserver],
vec![tcp_nameserver],
Some(mdns_nameserver),
Default::default(),
);
let request = message(query, vec![], vec![], vec![]);
let future = pool.send(request);
let response = block_on(future).unwrap();
assert_eq!(response.answers()[0], mdns_record);
} | rust_cleaned_test_functions.jsonl/86468 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 477
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13564,
32994,
4412,
368,
341,
262,
442,
18615,
311,
42394,
1265,
3690,
198,
262,
442,
1221,
18615,
389,
26656,
271,
262,
1077,
3239,
284,
11361,
486,
1631,
21182,
486,
1499,
2895,
445,
2136,
7724,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_work_with_rc() {
parse_code(
"test_work_with_rc",
r#"
foreigner_class!(class Boo {
self_type Boo;
constructor create_boo() -> Rc<RefCell<Boo>>;
method Boo::test(&self, _: bool) -> f32;
method Boo::set_a(&mut self, _: i32);
});
"#,
&[ForeignLang::Java, ForeignLang::Cpp],
);
} | rust_cleaned_test_functions.jsonl/71614 | {
"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,
11498,
6615,
30299,
368,
341,
262,
4715,
4136,
1006,
286,
330,
1944,
11498,
6615,
30299,
756,
286,
435,
2,
698,
28443,
261,
4790,
10297,
1040,
73684,
341,
262,
656,
1819,
73684,
280,
262,
4692,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lockout_is_updated_for_entire_branch() {
let mut stake_lockouts = HashMap::new();
let vote = Lockout {
slot: 2,
confirmation_count: 1,
};
let set: HashSet<u64> = vec![0u64, 1u64].into_iter().collect();
let mut ancestors = HashMap::new();
ancestors.insert(2, set);
let set: HashSet<u64> = vec![0u64].into_iter().collect();
ancestors.insert(1, set);
Locktower::update_ancestor_lockouts(&mut stake_lockouts, &vote, &ancestors);
assert_eq!(stake_lockouts[&0].lockout, 2);
assert_eq!(stake_lockouts[&1].lockout, 2);
assert_eq!(stake_lockouts[&2].lockout, 2);
} | rust_cleaned_test_functions.jsonl/25575 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 342
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9818,
411,
6892,
33492,
5478,
27425,
554,
28031,
368,
341,
286,
1077,
5206,
18279,
9818,
11672,
284,
10528,
486,
931,
543,
286,
1077,
6910,
284,
15701,
411,
341,
310,
9446,
25,
220,
17,
345,
310... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_neg_infinity() {
let vec = to_vec(&::std::f64::NEG_INFINITY).unwrap();
assert_eq!(vec, b"\xf9\xfc\x00");
} | rust_cleaned_test_functions.jsonl/110268 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 72
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28209,
1243,
19888,
368,
341,
262,
1077,
7486,
284,
311,
13251,
2099,
486,
1834,
486,
69,
21,
19,
486,
97127,
91110,
568,
15454,
543,
262,
2060,
10714,
10297,
4083,
11,
293,
11934,
5848,
24,
346... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_from_iter_unchanged() -> Result<()> {
// Given
let unchanged_entry_1 = given_entry("unchanged_1.txt");
let unchanged_entry_2 = given_entry("unchanged_2.txt");
let events = vec![
Event::UNCHANGED {
old: &unchanged_entry_1,
new: &unchanged_entry_1,
},
Event::UNCHANGED {
old: &unchanged_entry_2,
new: &unchanged_entry_2,
},
];
// When
let stats = Stats::from_iter(events);
// Then
assert_eq!(stats.total, 2);
assert_eq!(stats.unchanged, vec![&unchanged_entry_1, &unchanged_entry_2]);
Ok(())
} | rust_cleaned_test_functions.jsonl/4108 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 389
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
11723,
62,
3185,
3726,
368,
1464,
5714,
71698,
341,
286,
442,
16246,
198,
286,
1077,
34857,
9078,
62,
16,
284,
2661,
9078,
445,
3185,
3726,
62,
16,
3909,
797,
286,
1077,
34857,
9078,
62,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sculpt_enum() {
let value = LabelledEnum1::VariantC {
x: "test".into(),
y: true,
};
let repr = match into_labelled_generic(value).subset() {
Ok(repr) => repr,
Err(rem) => match rem {}, // should be unreachable
};
let new_value: LabelledEnum2 = from_labelled_generic(repr);
assert_eq!(
new_value,
LabelledEnum2::VariantC {
x: "test".into(),
y: true
}
);
} | rust_cleaned_test_functions.jsonl/32229 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 247
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
3314,
417,
31054,
368,
341,
262,
1077,
897,
284,
9402,
832,
10766,
16,
486,
20746,
34,
341,
286,
856,
25,
330,
1944,
3263,
18122,
3148,
286,
379,
25,
830,
345,
262,
2605,
262,
1077,
30636... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_report_deferred_by_policy() {
block_on(async {
let response = json!({"response":{
"server": "prod",
"protocol": "3.0",
"app": [{
"appid": "{00000000-0000-0000-0000-000000000001}",
"status": "ok",
"updatecheck": {
"status": "ok"
}
}],
}});
let response = serde_json::to_vec(&response).unwrap();
let http = MockHttpRequest::new(HttpResponse::new(response));
let policy_engine = MockPolicyEngine {
update_decision: UpdateDecision::DeferredByPolicy,
..MockPolicyEngine::default()
};
let mut state_machine = StateMachineBuilder::new_stub()
.policy_engine(policy_engine)
.http(http)
.build()
.await;
let (response, install_result) = state_machine.oneshot().await.unwrap();
assert_eq!(Action::DeferredByPolicy, response.app_responses[0].result);
assert_eq!(None, install_result);
let request_params = RequestParams::default();
let mut request_builder = RequestBuilder::new(&state_machine.config, &request_params);
let event = Event {
event_type: EventType::UpdateComplete,
event_result: EventResult::UpdateDeferred,
previous_version: Some("1.2.3.4".to_string()),
..Event::default()
};
let apps = state_machine.app_set.to_vec().await;
request_builder = request_builder
.add_event(&apps[0], &event)
.session_id(GUID::from_u128(0))
.request_id(GUID::from_u128(2));
assert_request(state_machine.http, request_builder).await;
});
} | rust_cleaned_test_functions.jsonl/59672 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 998
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14813,
7844,
261,
1151,
3710,
22773,
368,
341,
286,
2504,
4470,
18285,
341,
310,
1077,
2033,
284,
2951,
0,
16864,
2322,
12602,
1060,
330,
4030,
788,
330,
19748,
756,
1060,
330,
17014,
788,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dkim_header_builder() {
let header = DKIMHeaderBuilder::new()
.add_tag("v", "1")
.add_tag("a", "something")
.build()
.unwrap();
assert_eq!(header.raw_bytes, "v=1; a=something;".to_owned());
} | rust_cleaned_test_functions.jsonl/126127 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
57893,
8757,
28532,
368,
341,
286,
1077,
4247,
284,
55240,
1791,
4047,
3297,
486,
931,
741,
310,
659,
718,
9372,
445,
85,
497,
330,
16,
1138,
310,
659,
718,
9372,
445,
64,
497,
330,
33331... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_score_differences() {
let cov_a = Coverage::from_counts(
vec![100, 0, 0, 25],
vec![0, 100, 0, 25],
vec![0, 0, 100, 25],
vec![0, 0, 100, 25],
);
let cov_b = Coverage::from_counts(
vec![0, 0, 100, 50],
vec![100, 0, 0, 50],
vec![0, 0, 0, 0],
vec![0, 0, 100, 0],
);
let res = cov_a.score_differences(&cov_b, 0.0, 0);
assert!(res.len() == 3);
assert_eq!(res[0].relative_pos, 0);
assert_eq!(res[1].relative_pos, 2);
assert_eq!(res[2].relative_pos, 3);
assert!(res[0].score.abs_diff_eq(&800.53764f32, 1e-3));
assert!(res[1].score.abs_diff_eq(&690.67554f32, 1e-3));
assert!(res[2].score.abs_diff_eq(&69.21466f32, 1e-3));
assert_eq!(res[0].haplotype_self, AA as u8);
assert_eq!(res[0].haplotype_other, CC as u8);
assert_eq!(res[1].haplotype_self, GT as u8);
assert_eq!(res[1].haplotype_other, AT as u8);
assert_eq!(res[2].haplotype_self, NN as u8);
assert_eq!(res[2].haplotype_other, AC as u8);
} | rust_cleaned_test_functions.jsonl/21912 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 659
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10405,
814,
58326,
368,
341,
286,
1077,
21836,
4306,
284,
55669,
486,
1499,
25977,
1006,
310,
7486,
20703,
16,
15,
15,
11,
220,
15,
11,
220,
15,
11,
220,
17,
20,
1259,
310,
7486,
20703,
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_priority_update_push_on_request_stream() {
test_wrong_frame_on_request_stream(&[0x80, 0x0f, 0x07, 0x01, 0x01, 0x03]);
} | rust_cleaned_test_functions.jsonl/101900 | {
"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,
38161,
8882,
14218,
4470,
7893,
12673,
368,
341,
286,
1273,
75198,
8929,
4470,
7893,
12673,
2099,
58,
15,
87,
23,
15,
11,
220,
15,
87,
15,
69,
11,
220,
15,
87,
15,
22,
11,
220,
15,
87,
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 |
#[test]
fn test_incomplet_data_frame() {
test_incomplet_frame(
&[
// headers
0x01, 0x06, 0x00, 0x00, 0xd9, 0x54, 0x01, 0x33,
// the data frame is incomplete.
0x0, 0x3, 0x61, 0x62,
],
Error::MalformedFrame(H3_FRAME_TYPE_DATA),
);
} | rust_cleaned_test_functions.jsonl/10938 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 229
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
874,
10819,
1769,
8929,
368,
341,
286,
1273,
1243,
874,
10819,
8929,
1006,
310,
609,
9640,
394,
442,
7102,
198,
394,
220,
15,
87,
15,
16,
11,
220,
15,
87,
15,
21,
11,
220,
15,
87,
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_network_max_message_len() {
let first = "127.0.0.1:17202".parse().unwrap();
let second = "127.0.0.1:17303".parse().unwrap();
let max_message_length = ConsensusConfig::DEFAULT_MAX_MESSAGE_LEN as usize;
// Minimal size of protobuf messages can't be determined exactly.
let acceptable_message =
raw_message(max_message_length - SIGNATURE_LENGTH - PUBLIC_KEY_LENGTH - 100);
let too_big_message = raw_message(max_message_length + 1000);
assert!(too_big_message.to_bytes().len() > max_message_length);
assert!(acceptable_message.to_bytes().len() <= max_message_length);
let mut connect_list = ConnectList::default();
let mut t1 = ConnectionParams::from_address(first);
connect_list.add(t1.connect_info.clone());
let first_key = t1.connect_info.public_key;
let mut t2 = ConnectionParams::from_address(second);
connect_list.add(t2.connect_info.clone());
let second_key = t2.connect_info.public_key;
let connect_list = SharedConnectList::from_connect_list(connect_list);
let e1 = TestEvents::with_addr(first, &connect_list);
let e2 = TestEvents::with_addr(second, &connect_list);
let mut e1 = t1.spawn(e1, connect_list.clone());
let mut e2 = t2.spawn(e2, connect_list);
e1.connect_with(second_key, t1.connect.clone());
e2.wait_for_connect();
e1.wait_for_connect();
e1.send_to(second_key, acceptable_message.clone());
assert_eq!(e2.wait_for_message(), acceptable_message);
e2.send_to(first_key, too_big_message.clone());
assert_eq!(e1.wait_for_disconnect(), second_key);
} | rust_cleaned_test_functions.jsonl/46393 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 617
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20966,
6345,
6462,
6043,
368,
341,
262,
1077,
1156,
284,
330,
16,
17,
22,
13,
15,
13,
15,
13,
16,
25,
16,
22,
17,
15,
17,
3263,
6400,
1005,
15454,
543,
262,
1077,
2086,
284,
330,
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_null_packet() {
let p: PacketInfo = PacketInfo::null_packet();
assert_eq!(p.pid(), packet::NULL_PACKET_PID);
assert_eq!(p.continuity_counter(), 0);
assert!(p.has_payload());
let payload = p.payload().unwrap();
for i in 0..payload.len() {
assert_eq!(payload[i], 0xff);
}
assert!(p.has_discontinuity());
assert!(!p.has_adaptation_field());
assert!(!p.has_adaptation_field());
} | rust_cleaned_test_functions.jsonl/47177 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 251
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15162,
21078,
368,
341,
286,
1077,
281,
25,
28889,
1731,
284,
28889,
1731,
486,
2921,
21078,
543,
286,
2060,
10714,
10297,
79,
40939,
1507,
10151,
486,
4576,
40328,
55794,
317,
286,
2060,
10714,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_long_only_mode_no_short_parse() {
let mut opts = Options::new();
opts.long_only(true);
opts.optflag("h", "help", "Description");
opts.optflag("i", "ignore", "Description");
opts.optflag("", "hi", "Description");
let args = vec!["-hi"];
let matches = &match opts.parse(&args) {
Ok(m) => m,
Err(e) => panic!("{}", e),
};
assert!(matches.opt_present("hi"));
assert!(!matches.opt_present("h"));
assert!(!matches.opt_present("i"));
} | rust_cleaned_test_functions.jsonl/52402 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 233
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17799,
18410,
7302,
6536,
16673,
21039,
368,
341,
262,
1077,
5206,
12185,
284,
14566,
486,
931,
543,
262,
12185,
23510,
18410,
3715,
317,
262,
12185,
28102,
9903,
445,
71,
497,
330,
8653,
497,
330... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_change_endpoint_cfg() {
let cfg = CdcConfig::default();
let mut suite = mock_endpoint(&cfg, None);
let ep = &mut suite.endpoint;
// Modify min_ts_interval and hibernate_regions_compatible.
{
let mut updated_cfg = cfg.clone();
{
updated_cfg.min_ts_interval = ReadableDuration::secs(0);
}
let diff = cfg.diff(&updated_cfg);
ep.run(Task::ChangeConfig(diff));
assert_eq!(ep.config.min_ts_interval, ReadableDuration::secs(1));
assert_eq!(ep.config.hibernate_regions_compatible, true);
{
// update fields.
updated_cfg.min_ts_interval = ReadableDuration::secs(100);
updated_cfg.hibernate_regions_compatible = false
}
let diff = cfg.diff(&updated_cfg);
ep.run(Task::ChangeConfig(diff));
assert_eq!(ep.config.min_ts_interval, ReadableDuration::secs(100));
assert_eq!(ep.config.hibernate_regions_compatible, false);
}
// Modify old_value_cache_memory_quota.
{
let mut updated_cfg = cfg.clone();
{
updated_cfg.old_value_cache_memory_quota = ReadableSize::mb(1024);
}
let diff = cfg.diff(&updated_cfg);
assert_eq!(
ep.config.old_value_cache_memory_quota,
ReadableSize::mb(512)
);
assert_eq!(
ep.old_value_cache.capacity(),
ReadableSize::mb(512).0 as usize
);
ep.run(Task::ChangeConfig(diff));
assert_eq!(
ep.config.old_value_cache_memory_quota,
ReadableSize::mb(1024)
);
assert_eq!(
ep.old_value_cache.capacity(),
ReadableSize::mb(1024).0 as usize
);
}
// Modify incremental_scan_concurrency.
{
let mut updated_cfg = cfg.clone();
{
// which will be an invalid change and will be lost.
updated_cfg.incremental_scan_concurrency = 2;
}
let diff = cfg.diff(&updated_cfg);
ep.run(Task::ChangeConfig(diff));
assert_eq!(ep.config.incremental_scan_concurrency, 6);
assert_eq!(ep.scan_concurrency_semaphore.available_permits(), 6);
{
// Correct update.
updated_cfg.incremental_scan_concurrency = 8;
}
let diff = cfg.diff(&updated_cfg);
ep.run(Task::ChangeConfig(diff));
assert_eq!(ep.config.incremental_scan_concurrency, 8);
assert_eq!(ep.scan_concurrency_semaphore.available_permits(), 8);
}
// Modify sink_memory_quota.
{
let mut updated_cfg = cfg.clone();
{
updated_cfg.sink_memory_quota = ReadableSize::mb(1024);
}
let diff = cfg.diff(&updated_cfg);
assert_eq!(ep.sink_memory_quota.capacity(), usize::MAX);
ep.run(Task::ChangeConfig(diff));
assert_eq!(ep.config.sink_memory_quota, ReadableSize::mb(1024));
assert_eq!(
ep.sink_memory_quota.capacity(),
ReadableSize::mb(1024).0 as usize
);
}
// Modify incremental_scan_speed_limit.
{
let mut updated_cfg = cfg.clone();
{
updated_cfg.incremental_scan_speed_limit = ReadableSize::mb(1024);
}
let diff = cfg.diff(&updated_cfg);
assert_eq!(
ep.config.incremental_scan_speed_limit,
ReadableSize::mb(128)
);
assert!(
(ep.scan_speed_limiter.speed_limit() - ReadableSize::mb(128).0 as f64).abs()
< f64::EPSILON
);
ep.run(Task::ChangeConfig(diff));
assert_eq!(
ep.config.incremental_scan_speed_limit,
ReadableSize::mb(1024)
);
assert!(
(ep.scan_speed_limiter.speed_limit() - ReadableSize::mb(1024).0 as f64).abs()
< f64::EPSILON
);
}
} | rust_cleaned_test_functions.jsonl/29095 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2418
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15947,
36699,
18343,
368,
341,
286,
1077,
13286,
284,
356,
7628,
2648,
486,
2258,
543,
286,
1077,
5206,
16182,
284,
7860,
36699,
2099,
14072,
11,
2240,
317,
286,
1077,
4155,
284,
609,
6984,
16182,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_valid_gen_protects_chip() {
let floors: Vec<BTreeSet<ScienceThing>> = vec![
[
gen("thulium"), chip("strontium"), gen("strontium")
].iter().cloned().collect(),
];
assert_eq!(true, is_valid(&floors));
} | rust_cleaned_test_functions.jsonl/55909 | {
"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,
6892,
8337,
16322,
22357,
439,
82,
49514,
368,
341,
10217,
25945,
25,
11312,
32519,
6533,
1649,
27,
35400,
52940,
2452,
284,
7486,
90515,
197,
197,
9640,
298,
82281,
445,
339,
360,
2356,
3975,
163... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lambda() {
let res = expression(Span::new(r"\x -> y"));
if let Expr::Lambda(name, expr) = res.unwrap().1 {
assert_eq!(name, "x");
if let Expr::Ref(name) = expr.expr {
assert_eq!(name, "y");
} else {
panic!("Did not expect non-ref")
}
} else {
panic!("Did not expect non-lambda")
}
} | rust_cleaned_test_functions.jsonl/32922 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51884,
368,
341,
262,
1077,
592,
284,
7493,
3759,
848,
486,
931,
2601,
11934,
87,
1464,
379,
14929,
262,
421,
1077,
28819,
486,
58266,
3153,
11,
15169,
8,
284,
592,
55395,
1005,
16,
341,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_merge() {
let mut vector_in = vec![10, 20, 11, 13, 24];
merge_sort(&mut vector_in);
debug_assert_eq!(vector_in, vec![10, 11, 13, 20, 24]);
} | rust_cleaned_test_functions.jsonl/25080 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20888,
368,
341,
286,
1077,
5206,
4621,
1243,
284,
7486,
20703,
16,
15,
11,
220,
17,
15,
11,
220,
16,
16,
11,
220,
16,
18,
11,
220,
17,
19,
935,
286,
10880,
18435,
2099,
6984,
4621,
1243,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_checked_add() {
for elm in SUM_TRIPLES.iter() {
let (a_vec, b_vec, c_vec) = *elm;
let a = BigInt::from_slice(Plus, a_vec);
let b = BigInt::from_slice(Plus, b_vec);
let c = BigInt::from_slice(Plus, c_vec);
assert!(a.checked_add(&b).unwrap() == c);
assert!(b.checked_add(&a).unwrap() == c);
assert!(c.checked_add(&(-&a)).unwrap() == b);
assert!(c.checked_add(&(-&b)).unwrap() == a);
assert!(a.checked_add(&(-&c)).unwrap() == (-&b));
assert!(b.checked_add(&(-&c)).unwrap() == (-&a));
assert!((-&a).checked_add(&(-&b)).unwrap() == (-&c));
assert!(a.checked_add(&(-&a)).unwrap() == Zero::zero());
}
} | rust_cleaned_test_functions.jsonl/56633 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 364
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56456,
2891,
368,
341,
262,
369,
42205,
304,
30735,
6410,
3298,
14017,
19471,
368,
341,
286,
1077,
320,
64,
13251,
11,
293,
13251,
11,
272,
13251,
8,
284,
353,
23162,
280,
286,
1077,
264,
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... | 2 |
#[test]
fn test_minimize_loop_with_constant_condition_do_while() {
test("do { foo(); } while (true)", "for(;;)foo();");
test("do { foo(); } while (0)", "foo();");
test("do { foo(); } while (0.0)", "foo();");
test("do { foo(); } while (NaN)", "foo();");
test("do { foo(); } while (null)", "foo();");
test("do { foo(); } while (undefined)", "foo();");
test("do { foo(); } while ('')", "foo();");
} | rust_cleaned_test_functions.jsonl/385 | {
"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,
7260,
11853,
17198,
6615,
34967,
27656,
26309,
86069,
368,
341,
262,
1273,
445,
2982,
314,
15229,
2129,
335,
1393,
320,
1866,
11583,
330,
1958,
7,
6768,
8,
7975,
2129,
797,
262,
1273,
445,
2982,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_value_enum_untagged() -> Result<(), Box<dyn std::error::Error>> {
let lua = Lua::new();
lua.globals().set("null", lua.null())?;
#[derive(Deserialize, PartialEq, Debug)]
#[serde(untagged)]
enum Eut {
Unit,
Integer(u64),
Tuple(u32, u32),
Struct { a: u32 },
}
let value = lua.load(r#"null"#).eval()?;
let got = lua.from_value(value)?;
assert_eq!(Eut::Unit, got);
let value = lua.load(r#"1"#).eval()?;
let got = lua.from_value(value)?;
assert_eq!(Eut::Integer(1), got);
let value = lua.load(r#"{3, 1}"#).eval()?;
let got = lua.from_value(value)?;
assert_eq!(Eut::Tuple(3, 1), got);
let value = lua.load(r#"{a = 10}"#).eval()?;
let got = lua.from_value(value)?;
assert_eq!(Eut::Struct { a: 10 }, got);
let value = lua.load(r#"{b = 12}"#).eval()?;
match lua.from_value::<Eut>(value) {
Ok(v) => panic!("expected Error::DeserializeError, got {:?}", v),
Err(Error::DeserializeError(_)) => {}
Err(e) => panic!("expected Error::DeserializeError, got {}", e),
}
Ok(())
} | rust_cleaned_test_functions.jsonl/50710 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 551
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
3142,
31054,
62,
3850,
96476,
368,
1464,
5714,
68843,
8261,
92846,
1460,
486,
841,
486,
1454,
2452,
341,
262,
1077,
20357,
284,
37662,
486,
931,
543,
262,
20357,
1302,
16616,
1005,
746,
445,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
#[test]
fn test_sum_aggregate() {
quick_test(
"SELECT SUM(age) from person",
"Aggregate: groupBy=[[]], aggr=[[SUM(#age)]]\
\n TableScan: person projection=None",
);
} | rust_cleaned_test_functions.jsonl/29972 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10160,
20587,
14240,
368,
341,
286,
3974,
4452,
1006,
310,
330,
4858,
30735,
66595,
8,
504,
1697,
756,
310,
330,
64580,
25,
1874,
1359,
5818,
1294,
1125,
933,
901,
45937,
27377,
32735,
424,
8,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_hyper_links() {
assert_markdown_eq(
common::parts::hyper_links,
r###"
[](https://example.org/)
[example](https://example.org/)
[](#section-2)
[example](#section-2)
"###,
);
} | rust_cleaned_test_functions.jsonl/133528 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
93416,
25258,
368,
341,
262,
2060,
18924,
2923,
10714,
1006,
286,
4185,
486,
18252,
486,
68192,
25258,
345,
286,
435,
14374,
698,
50994,
2428,
1110,
8687,
2659,
14,
692,
58,
8687,
9533,
2428,
1110... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_supplies_buy_clothes_insufficient() {
let mut supplies = Supplies::new();
let reason = supplies.buy_clothes(1000).unwrap_err().reason;
assert_eq!(BuyErrorType::InsufficientFunds, reason);
assert_eq!(700, supplies.money);
assert_eq!(0, supplies.clothes);
} | rust_cleaned_test_functions.jsonl/28667 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23723,
7202,
46348,
666,
385,
6375,
34386,
26683,
368,
341,
286,
1077,
5206,
16720,
284,
50252,
486,
931,
543,
286,
1077,
2874,
284,
16720,
63871,
666,
385,
6375,
7,
16,
15,
15,
15,
568,
15454,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mask_f64() {
let mask = 0b10101010;
let actual = Float64Type::mask_from_u64(mask);
let expected = expected_mask!(i64, mask);
let expected = m64x8::from_cast(i64x8::from_slice_unaligned(expected.as_slice()));
assert_eq!(expected, actual);
} | rust_cleaned_test_functions.jsonl/107639 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9999,
761,
21,
19,
368,
341,
286,
1077,
6911,
284,
220,
15,
65,
16,
15,
16,
15,
16,
15,
16,
15,
280,
286,
1077,
5042,
284,
13001,
21,
19,
929,
486,
11258,
5673,
7300,
21,
19,
35306,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_convert_band_info() {
let wlanmac_info = fake_wlanmac_info();
let band0 = convert_ddk_band_info(wlanmac_info.bands[0], 10);
assert_eq!(band0.band_id, fidl_common::Band::WlanBand2Ghz);
assert_eq!(band0.rates, vec![12, 24, 48, 54, 96, 108]);
assert_eq!(band0.base_frequency, 2407);
assert_eq!(band0.channels, vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]);
assert_eq!(band0.cap, 10);
assert!(band0.ht_cap.is_some());
assert!(band0.vht_cap.is_none());
} | rust_cleaned_test_functions.jsonl/122389 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 288
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
45344,
3109,
368,
341,
286,
1077,
78353,
11948,
3109,
284,
12418,
1670,
10715,
11948,
3109,
543,
286,
1077,
7055,
15,
284,
5508,
43174,
74,
45344,
3109,
3622,
10715,
11948,
3109,
948,
2844,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_expectstaple_basic() {
let json = r#"{
"expect-staple-report": {
"date-time": "2014-04-06T13:00:50Z",
"hostname": "www.example.com",
"port": 443,
"response-status": "ERROR_RESPONSE",
"cert-status": "REVOKED",
"effective-expiration-date": "2014-05-01T12:40:50Z",
"served-certificate-chain": ["-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----"],
"validated-certificate-chain": ["-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----"]
}
}"#;
let mut event = Event::default();
ExpectStaple::apply_to_event(json.as_bytes(), &mut event).unwrap();
assert_annotated_snapshot!(Annotated::new(event), @r###"
{
"culprit": "www.example.com",
"logentry": {
"formatted": "Expect-Staple failed for 'www.example.com'"
},
"request": {
"url": "www.example.com"
},
"tags": [
[
"hostname",
"www.example.com"
],
[
"port",
"443"
],
[
"response_status",
"ERROR_RESPONSE"
],
[
"cert_status",
"REVOKED"
]
],
"expectstaple": {
"date_time": "2014-04-06T13:00:50+00:00",
"hostname": "www.example.com",
"port": 443,
"effective_expiration_date": "2014-05-01T12:40:50+00:00",
"response_status": "ERROR_RESPONSE",
"cert_status": "REVOKED",
"served_certificate_chain": [
"-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----"
],
"validated_certificate_chain": [
"-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----"
]
}
}
"###);
} | rust_cleaned_test_functions.jsonl/4039 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68918,
267,
391,
273,
34729,
368,
341,
286,
1077,
2951,
284,
435,
55543,
515,
310,
330,
17119,
5477,
391,
273,
47411,
788,
341,
394,
330,
1028,
7246,
788,
330,
17,
15,
16,
19,
12,
15,
19,
12... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_anonymous_and_unauthorized_users_cannot_update_icp_xdr_coversion_rate() {
local_test_on_nns_subnet(|runtime| async move {
let attacker_fake = set_up_universal_canister(&runtime).await;
assert_ne!(
attacker_fake.canister_id(),
ic_nns_constants::GOVERNANCE_CANISTER_ID
);
let registry =
set_up_registry_canister(&runtime, RegistryCanisterInitPayload::default()).await;
let payload = UpdateIcpXdrConversionRatePayload {
data_source: "".to_string(),
timestamp_seconds: 0,
xdr_permyriad_per_icp: TEST_VAL1,
};
// The anonymous end-user tries to change the conversion rate
let response: Result<(), String> = registry
.update_(
"update_icp_xdr_conversion_rate",
dfn_candid::candid,
(&payload,),
)
.await;
assert_matches!(response,
Err(s) if s.contains("is not authorized to call this method: update_icp_xdr_conversion_rate"));
// There should therefore be no new conversion rate record
assert_eq!(
get_value::<IcpXdrConversionRateRecord>(®istry, &XDR_PER_ICP_KEY.as_bytes()).await,
IcpXdrConversionRateRecord::default()
);
// A non-governance canister tries to change the conversion rate
assert!(
!forward_call_via_universal_canister(
&attacker_fake,
®istry,
"update_icp_xdr_conversion_rate",
Encode!(&payload).unwrap()
)
.await
);
// There should therefore be no new conversion rate record
assert_eq!(
get_value::<IcpXdrConversionRateRecord>(®istry, &XDR_PER_ICP_KEY.as_bytes()).await,
IcpXdrConversionRateRecord::default()
);
Ok(())
});
} | rust_cleaned_test_functions.jsonl/81877 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 967
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12008,
9757,
8378,
4907,
19084,
16348,
666,
3401,
8882,
32747,
79,
3212,
3612,
50028,
1325,
9246,
368,
341,
262,
2205,
4452,
4470,
1089,
4412,
95681,
22428,
22255,
91,
3312,
3271,
341,
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... | 2 |
#[test]
fn test_exchange_code_successful_with_minimal_json_response() {
let client = BasicClient::new(
ClientId::new("aaa".to_string()),
Some(ClientSecret::new("bbb".to_string())),
AuthUrl::new("https://example.com/auth".to_string()).unwrap(),
Some(TokenUrl::new("https://example.com/token".to_string()).unwrap()),
);
let token = client
.exchange_code(AuthorizationCode::new("ccc".to_string()))
.request(mock_http_client(
vec![
(ACCEPT, "application/json"),
(CONTENT_TYPE, "application/x-www-form-urlencoded"),
(AUTHORIZATION, "Basic YWFhOmJiYg=="),
],
"grant_type=authorization_code&code=ccc",
None,
HttpResponse {
status_code: StatusCode::OK,
headers: HeaderMap::new(),
body: "{\"access_token\": \"12/34\", \"token_type\": \"BEARER\"}"
.to_string()
.into_bytes(),
},
))
.unwrap();
assert_eq!("12/34", token.access_token().secret());
assert_eq!(BasicTokenType::Bearer, *token.token_type());
assert_eq!(None, token.expires_in());
assert!(token.refresh_token().is_none());
// Ensure that serialization produces an equivalent JSON value.
let serialized_json = serde_json::to_string(&token).unwrap();
assert_eq!(
"{\"access_token\":\"12/34\",\"token_type\":\"bearer\"}".to_string(),
serialized_json
);
let deserialized_token = serde_json::from_str::<BasicTokenResponse>(&serialized_json).unwrap();
assert_token_eq(&token, &deserialized_token);
} | rust_cleaned_test_functions.jsonl/18591 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 794
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
59212,
4136,
92951,
6615,
7260,
2861,
9455,
9655,
368,
341,
262,
1077,
2943,
284,
14625,
2959,
486,
931,
1006,
286,
8423,
764,
486,
931,
445,
32646,
3263,
983,
3904,
14702,
286,
4329,
46851,
19773... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_split() {
let stake_address = solana_sdk::pubkey::new_rand();
let minimum_delegation = crate::get_minimum_delegation(&FeatureSet::all_enabled());
let stake_lamports = minimum_delegation * 2;
let split_to_address = solana_sdk::pubkey::new_rand();
let split_to_account = AccountSharedData::new_data_with_space(
0,
&StakeState::Uninitialized,
StakeState::size_of(),
&id(),
)
.unwrap();
let mut transaction_accounts = vec![
(stake_address, AccountSharedData::default()),
(split_to_address, split_to_account),
];
let instruction_accounts = vec![
AccountMeta {
pubkey: stake_address,
is_signer: true,
is_writable: false,
},
AccountMeta {
pubkey: split_to_address,
is_signer: false,
is_writable: false,
},
];
// Define rent here so that it's used consistently for setting the rent exempt reserve
// and in the sysvar cache used for mock instruction processing.
let mut sysvar_cache_override = SysvarCache::default();
sysvar_cache_override.set_rent(Rent {
lamports_per_byte_year: 0,
..Rent::default()
});
for state in [
StakeState::Initialized(Meta::auto(&stake_address)),
just_stake(Meta::auto(&stake_address), stake_lamports),
] {
let stake_account = AccountSharedData::new_data_with_space(
stake_lamports,
&state,
StakeState::size_of(),
&id(),
)
.unwrap();
transaction_accounts[0] = (stake_address, stake_account);
process_instruction_with_sysvar_cache(
&serialize(&StakeInstruction::Split(stake_lamports + 1)).unwrap(),
transaction_accounts.clone(),
instruction_accounts.clone(),
Some(&sysvar_cache_override),
Err(InstructionError::InsufficientFunds),
);
// should pass
let accounts = process_instruction_with_sysvar_cache(
&serialize(&StakeInstruction::Split(stake_lamports / 2)).unwrap(),
transaction_accounts.clone(),
instruction_accounts.clone(),
Some(&sysvar_cache_override),
Ok(()),
);
// no lamport leakage
assert_eq!(
accounts[0].lamports() + accounts[1].lamports(),
stake_lamports
);
assert_eq!(from(&accounts[0]).unwrap(), from(&accounts[1]).unwrap());
match state {
StakeState::Initialized(_meta) => {
assert_eq!(from(&accounts[0]).unwrap(), state);
}
StakeState::Stake(_meta, _stake) => {
let stake_0 = from(&accounts[0]).unwrap().stake();
assert_eq!(stake_0.unwrap().delegation.stake, stake_lamports / 2);
}
_ => unreachable!(),
}
}
let split_to_account = AccountSharedData::new_data_with_space(
0,
&StakeState::Uninitialized,
StakeState::size_of(),
&solana_sdk::pubkey::new_rand(),
)
.unwrap();
transaction_accounts[1] = (split_to_address, split_to_account);
process_instruction(
&serialize(&StakeInstruction::Split(stake_lamports / 2)).unwrap(),
transaction_accounts,
instruction_accounts,
Err(InstructionError::IncorrectProgramId),
);
} | rust_cleaned_test_functions.jsonl/31641 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2003
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
368,
341,
286,
1077,
18279,
6744,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
8028,
2259,
87566,
284,
17717,
486,
455,
84855,
2259,
87566,
2099,
13859,
1649,
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... | 3 |
#[test]
fn test_resharing_added_members() {
// SCENARIO: reshare with some new members
let n = 5;
let thr = default_threshold(n);
let n2 = 8;
let thr2 = 5;
let (dkgs, public) = setup_reshare::<BCurve>(n, thr, n2, thr2);
let (_, reshared) = full_dkg(thr2, dkgs);
// test that it gives the same public key
assert_eq!(public.public_key(), reshared.public_key());
} | rust_cleaned_test_functions.jsonl/75099 | {
"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,
62,
2488,
3249,
37653,
30397,
368,
341,
286,
442,
7531,
94274,
25,
63693,
546,
448,
1045,
501,
3613,
198,
286,
1077,
308,
284,
220,
20,
280,
286,
1077,
8807,
284,
1638,
21858,
1445,
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_recognize_utf8_boundary_half_dangle_three() {
let buf: &[u8] = &[0x61, 0x61, 0xF0, 0x90, 0x86, 0x92, 0x0d, 0x0a, 0x0d, 0x0a];
let mut full = buffer_from(buf);
let result = block_on(async { recognize(&mut full).await });
assert_eq!(result.unwrap().find_header("Complex"), Some("aa𐆒".to_string()));
} | rust_cleaned_test_functions.jsonl/48192 | {
"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,
7080,
3934,
551,
39453,
23,
54004,
40626,
814,
4044,
50016,
368,
341,
220,
1077,
6607,
25,
44590,
84,
23,
60,
284,
44590,
15,
87,
21,
16,
11,
220,
15,
87,
21,
16,
11,
220,
15,
9770,
15,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_shift_lineend() {
let mut buffer = setup_buffer("Test");
buffer.shift_mark(Mark::Cursor(0), Direction::LineEnd, 0);
assert_eq!(buffer.get_mark_idx(Mark::Cursor(0)).unwrap(), 4);
} | rust_cleaned_test_functions.jsonl/94761 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22230,
6528,
408,
368,
341,
286,
1077,
5206,
4147,
284,
6505,
7776,
445,
2271,
797,
286,
4147,
29154,
18924,
3189,
838,
486,
14543,
7,
15,
701,
18904,
486,
2460,
3727,
11,
220,
15,
626,
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 |
#[test]
fn test_parse_float_no_decimal() {
let res = expression(Span::new("2."));
assert!(res.is_ok());
assert_eq!(res.unwrap().1, Expr::Literal(Literal::Float(2.)))
} | rust_cleaned_test_functions.jsonl/32920 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 88
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
17586,
6536,
74429,
368,
341,
262,
1077,
592,
284,
7493,
3759,
848,
486,
931,
445,
17,
1189,
3237,
262,
2060,
10297,
416,
2079,
19817,
5231,
262,
2060,
10714,
10297,
416,
55395,
1005,
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 |
#[test]
fn test_nth() {
let a: VolAddress<i32> = unsafe { VolAddress::new(4) };
let mut i: VolIter<i32> = unsafe { a.iter_slots(2) };
let mut i2: VolIter<i32> = i.clone();
assert_eq!(i.nth(0), i2.next());
assert_eq!(i.nth(0), i2.next());
assert_eq!(i.nth(0), i2.next());
let mut i: VolIter<i32> = unsafe { a.iter_slots(2) };
assert_eq!(i.nth(0), Some(unsafe { VolAddress::new(4) }));
let mut i: VolIter<i32> = unsafe { a.iter_slots(2) };
assert_eq!(i.nth(1), Some(unsafe { VolAddress::new(8) }));
let mut i: VolIter<i32> = unsafe { a.iter_slots(2) };
assert_eq!(i.nth(2), None);
} | rust_cleaned_test_functions.jsonl/116634 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 289
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
78342,
368,
341,
220,
1077,
264,
25,
10882,
4286,
21897,
18,
17,
29,
284,
19860,
314,
10882,
4286,
486,
931,
7,
19,
8,
2605,
220,
1077,
5206,
600,
25,
10882,
8537,
21897,
18,
17,
29,
284,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_skewness() {
test_case(-0.0, 2.0, 0.0, |x| x.skewness());
test_case(0.0, 2.0, 0.0, |x| x.skewness());
test_case(0.1, 4.0, 0.0, |x| x.skewness());
test_case(1.0, 10.0, 0.0, |x| x.skewness());
test_case(10.0, 11.0, 0.0, |x| x.skewness());
test_case(0.0, f64::INFINITY, 0.0, |x| x.skewness());
} | rust_cleaned_test_functions.jsonl/47371 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 232
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33811,
365,
2090,
368,
341,
286,
1273,
19096,
4080,
15,
13,
15,
11,
220,
17,
13,
15,
11,
220,
15,
13,
15,
11,
760,
87,
91,
856,
39454,
365,
2090,
1423,
286,
1273,
19096,
7,
15,
13,
15,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_generic_opaque_types() {
// Test printing opaque types with generic parameters
reparse_test!(
program {
struct Foo {}
trait Bar<T> {}
opaque type Baz<T>: Bar<T> = Foo;
struct Fou<T> {}
struct Unit {}
trait Bau<T, U> {}
opaque type Boz<U, T>: Bau<Unit, U> = Fou<T>;
}
);
} | rust_cleaned_test_functions.jsonl/34206 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 216
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41232,
10287,
19659,
9763,
368,
341,
262,
442,
3393,
18484,
46484,
4494,
448,
13954,
5029,
198,
262,
312,
6400,
4452,
33673,
286,
2025,
341,
310,
2036,
33428,
5613,
310,
17567,
4716,
3125,
29,
561... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_minimize1() {
let res = minimize_rpaths(&[
"rpath1".to_string(),
"rpath2".to_string(),
"rpath1".to_string()
]);
assert!(res == [
"rpath1",
"rpath2",
]);
} | rust_cleaned_test_functions.jsonl/20102 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 173
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7260,
11853,
16,
368,
341,
286,
1077,
592,
284,
29337,
1710,
21623,
2099,
9640,
310,
330,
81,
2343,
16,
3263,
983,
3904,
3148,
310,
330,
81,
2343,
17,
3263,
983,
3904,
3148,
310,
330,
81,
2343... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_packet_constraints() {
use PacketConstraints as PC;
// Sanity check.
assert!(PC::try_new(0, 0, 0, 0).is_some());
// header_len + min_body_len + footer_len doesn't overflow usize
assert!(PC::try_new(MAX_USIZE / 2, MAX_USIZE / 2, 0, 0).is_some());
// header_len + min_body_len + footer_len overflows usize
assert_eq!(PC::try_new(MAX_USIZE, 1, 0, 0), None);
// min_body_len > max_body_len
assert_eq!(PC::try_new(0, 0, 1, 0), None);
} | rust_cleaned_test_functions.jsonl/131778 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 261
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21078,
60267,
368,
341,
286,
990,
28889,
12925,
438,
6673,
401,
286,
442,
96302,
1779,
624,
286,
2060,
10297,
4872,
486,
1539,
5921,
7,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
568,
285,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_signal() {
assert_eq!(
calculate_signal(
&mut [3, 15, 3, 16, 1002, 16, 10, 16, 1, 16, 15, 15, 4, 15, 99, 0, 0],
&[4, 3, 2, 1, 0]
),
43210
);
assert_eq!(
calculate_signal(
&mut [
3, 23, 3, 24, 1002, 24, 10, 24, 1002, 23, -1, 23, 101, 5, 23, 23, 1, 24, 23,
23, 4, 23, 99, 0, 0
],
&[0, 1, 2, 3, 4]
),
54321
);
assert_eq!(
calculate_signal(
&mut [
3, 31, 3, 32, 1002, 32, 10, 32, 1001, 31, -2, 31, 1007, 31, 0, 33, 1002, 33, 7,
33, 1, 33, 31, 31, 1, 32, 31, 31, 4, 31, 99, 0, 0, 0
],
&[1, 0, 4, 3, 2]
),
65210
);
} | rust_cleaned_test_functions.jsonl/100798 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 637
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21137,
368,
341,
286,
2060,
10714,
33673,
310,
11047,
21137,
1006,
394,
609,
6984,
508,
18,
11,
220,
16,
20,
11,
220,
18,
11,
220,
16,
21,
11,
220,
16,
15,
15,
17,
11,
220,
16,
21,
11,
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_5XY0() {
// 0x5XY0 - Skip the following instruction if the value of register VX is equal to the value of register VY
let opcode = 0x5670;
let mut vm = get_vm();
//not equal
vm.v[0x6] = 0x0;
vm.v[0x7] = 0x1;
vm.program_counter = 0x0;
vm.execute_instruction(decode_opcode(opcode), opcode);
assert_eq!(vm.program_counter, 0x0);
//equal
vm.v[0x6] = 0x1;
vm.v[0x7] = 0x1;
vm.program_counter = 0x0;
vm.execute_instruction(decode_opcode(opcode), opcode);
assert_eq!(vm.program_counter, 0x2);
} | rust_cleaned_test_functions.jsonl/245 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 270
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
20,
16356,
15,
368,
341,
262,
442,
220,
15,
87,
20,
16356,
15,
481,
25784,
279,
2701,
7600,
421,
279,
897,
315,
4161,
78177,
374,
6144,
311,
279,
897,
315,
4161,
647,
56,
271,
262,
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_from_page_type() {
assert_eq!(
PageType::from(parquet::PageType::DataPage),
PageType::DataPage
);
assert_eq!(
PageType::from(parquet::PageType::IndexPage),
PageType::IndexPage
);
assert_eq!(
PageType::from(parquet::PageType::DictionaryPage),
PageType::DictionaryPage
);
assert_eq!(
PageType::from(parquet::PageType::DataPageV2),
PageType::DataPageV2
);
} | rust_cleaned_test_functions.jsonl/126078 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 186
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
6129,
1819,
368,
341,
197,
6948,
10714,
33673,
298,
65439,
929,
486,
1499,
31975,
23300,
486,
2665,
929,
486,
1043,
2665,
1326,
298,
65439,
929,
486,
1043,
2665,
198,
197,
197,
317,
197,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_type() {
let mut m = Module::new();
let s = m.new_struct();
s.set_name(String::from("Order"));
s.module_mut();
println!("done");
} | rust_cleaned_test_functions.jsonl/32848 | {
"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,
1819,
368,
341,
286,
1077,
5206,
296,
284,
13711,
486,
931,
1428,
286,
1077,
274,
284,
296,
4618,
15126,
543,
286,
274,
980,
1269,
2242,
486,
1499,
445,
4431,
4010,
286,
274,
10076,
29523,
1428,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_thread_member() -> Result<(), TimestampParseError> {
const DATETIME: &str = "2021-09-19T14:17:32.000000+00:00";
let join_timestamp = Timestamp::from_str(DATETIME)?;
let value = ThreadMember {
flags: 3,
id: Some(Id::new(1)),
member: None,
presence: None,
join_timestamp,
user_id: Some(Id::new(2)),
};
serde_test::assert_tokens(
&value,
&[
Token::Struct {
name: "ThreadMember",
len: 4,
},
Token::Str("flags"),
Token::U64(3),
Token::Str("id"),
Token::Some,
Token::NewtypeStruct { name: "Id" },
Token::Str("1"),
Token::Str("join_timestamp"),
Token::Str(DATETIME),
Token::Str("user_id"),
Token::Some,
Token::NewtypeStruct { name: "Id" },
Token::Str("2"),
Token::StructEnd,
],
);
Ok(())
} | rust_cleaned_test_functions.jsonl/101212 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 702
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10814,
19388,
368,
1464,
5714,
68843,
32758,
14463,
1454,
29,
341,
286,
733,
39362,
44618,
25,
609,
495,
284,
330,
17,
15,
17,
16,
12,
15,
24,
12,
16,
24,
51,
16,
19,
25,
16,
22,
25,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_encode_lengths() -> Result<()> {
#[bitcoin_code(crate = "crate")]
#[derive(BitcoinCode, PartialEq, Debug)]
struct Test {
array: ByteArray,
};
fn make(vec: Vec<u8>) -> Test {
Test { array: vec.into() }
}
let encoded = make(vec![0x77; 0xfc]).ser();
assert_eq!(encoded[0], 0xfc);
assert_eq!(&encoded[1..], &[0x77; 0xfc][..]);
let encoded = make(vec![0x88; 0xfd]).ser();
assert_eq!(&encoded[0..3], &[0xfd, 0xfd, 0x00][..]);
assert_eq!(&encoded[3..], &[0x88; 0xfd][..]);
let encoded = make(vec![0x99; 0x103]).ser();
assert_eq!(&encoded[0..3], &[0xfd, 0x03, 0x01][..]);
assert_eq!(&encoded[3..], &[0x99; 0x103][..]);
let encoded = make(vec![0xaa; 0xffff]).ser();
assert_eq!(&encoded[0..3], &[0xfd, 0xff, 0xff][..]);
assert_eq!(&encoded[3..], &[0xaa; 0xffff][..]);
let encoded = make(vec![0xbb; 0x10000]).ser();
assert_eq!(&encoded[0..5], &[0xfe, 0x00, 0x00, 0x01, 0x00][..]);
assert_eq!(&encoded[5..], &[0xbb; 0x10000][..]);
let encoded = make(vec![0xbb; 0x123456]).ser();
assert_eq!(&encoded[0..5], &[0xfe, 0x56, 0x34, 0x12, 0x00][..]);
assert_eq!(&encoded[5..], &[0xbb; 0x123456][..]);
Ok(())
} | rust_cleaned_test_functions.jsonl/77195 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 734
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
54416,
368,
1464,
5714,
71698,
341,
286,
11506,
83910,
4136,
54907,
284,
330,
61711,
5422,
286,
11506,
27098,
68653,
7160,
2078,
11,
55039,
11,
11091,
5563,
286,
2036,
3393,
341,
310,
1334,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_pound_line_to_key_value() {
let a = from_pound_line_to_key_value("# ignore");
assert_eq!(None, a);
let a = from_pound_line_to_key_value("# soooo much space ");
assert_eq!(None, a);
let a = from_pound_line_to_key_value(
"# test = This can be tricky ",
);
let a = a.expect("this should have been Some!");
assert_eq!(a.0, "test");
assert_eq!(a.1, "This can be tricky");
let a = from_pound_line_to_key_value("# nasty =");
let a = a.expect("this should have been Some!");
assert_eq!(a.0, "nasty");
assert_eq!(a.1, "");
let a = from_pound_line_to_key_value("# nasty 2 = ");
let a = a.expect("this should have been Some!");
assert_eq!(a.0, "nasty 2");
assert_eq!(a.1, "");
} | rust_cleaned_test_functions.jsonl/64385 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 539
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
620,
795,
6528,
2346,
3097,
3142,
368,
341,
286,
1077,
264,
284,
504,
620,
795,
6528,
2346,
3097,
3142,
3584,
10034,
797,
286,
2060,
10714,
10297,
4064,
11,
264,
626,
286,
1077,
264,
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_duration_seconds_with_frac() {
use std::time::Duration;
let zero = Duration::new(0, 0);
let one_second = Duration::new(1, 0);
let half_second = Duration::new(0, 500_000_000);
#[serde_as]
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct Structf64Strict {
#[serde_as(as = "DurationSecondsWithFrac<f64>")]
value: Duration,
};
is_equal(Structf64Strict { value: zero }, r#"{"value":0.0}"#);
is_equal(Structf64Strict { value: one_second }, r#"{"value":1.0}"#);
is_equal(Structf64Strict { value: half_second }, r#"{"value":0.5}"#);
check_error_deserialization::<Structf64Strict>(
r#"{"value":"1"}"#,
r#"invalid type: string "1", expected f64 at line 1 column 12"#,
);
check_error_deserialization::<Structf64Strict>(
r#"{"value":-1.0}"#,
r#"underflow when converting float to duration at line 1 column 14"#,
);
#[serde_as]
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct Structf64Flexible {
#[serde_as(as = "DurationSecondsWithFrac<f64, Flexible>")]
value: Duration,
};
is_equal(Structf64Flexible { value: zero }, r#"{"value":0.0}"#);
is_equal(Structf64Flexible { value: one_second }, r#"{"value":1.0}"#);
is_equal(Structf64Flexible { value: half_second }, r#"{"value":0.5}"#);
check_deserialization(Structf64Flexible { value: one_second }, r#"{"value":"1"}"#);
check_deserialization(Structf64Flexible { value: zero }, r#"{"value":"0"}"#);
check_error_deserialization::<Structf64Flexible>(
r#"{"value":"a"}"#,
r#"invalid value: string "a", expected an integer, a float, or a string containing a number at line 1 column 12"#,
);
check_error_deserialization::<Structf64Flexible>(
r#"{"value":-1}"#,
r#"Negative values are not supported for Duration. Found -1 at line 1 column 11"#,
);
#[serde_as]
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct StructStringStrict {
#[serde_as(as = "DurationSecondsWithFrac<String>")]
value: Duration,
};
is_equal(StructStringStrict { value: zero }, r#"{"value":"0"}"#);
is_equal(StructStringStrict { value: one_second }, r#"{"value":"1"}"#);
is_equal(
StructStringStrict { value: half_second },
r#"{"value":"0.5"}"#,
);
check_error_deserialization::<StructStringStrict>(
r#"{"value":1}"#,
r#"invalid type: integer `1`, expected a string at line 1 column 10"#,
);
check_error_deserialization::<StructStringStrict>(
r#"{"value":-1}"#,
r#"invalid type: integer `-1`, expected a string at line 1 column 11"#,
);
#[serde_as]
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct StructStringFlexible {
#[serde_as(as = "DurationSecondsWithFrac<String, Flexible>")]
value: Duration,
};
is_equal(StructStringFlexible { value: zero }, r#"{"value":"0"}"#);
is_equal(
StructStringFlexible { value: one_second },
r#"{"value":"1"}"#,
);
is_equal(
StructStringFlexible { value: half_second },
r#"{"value":"0.5"}"#,
);
check_deserialization(StructStringFlexible { value: zero }, r#"{"value":"0"}"#);
check_error_deserialization::<StructStringFlexible>(
r#"{"value":"a"}"#,
r#"invalid value: string "a", expected an integer, a float, or a string containing a number at line 1 column 12"#,
);
check_error_deserialization::<StructStringFlexible>(
r#"{"value":-1}"#,
r#"Negative values are not supported for Duration. Found -1 at line 1 column 11"#,
);
} | rust_cleaned_test_functions.jsonl/23051 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1591
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25454,
34825,
6615,
70358,
368,
341,
262,
990,
1460,
486,
1678,
486,
12945,
280,
262,
1077,
7168,
284,
21045,
486,
931,
7,
15,
11,
220,
15,
317,
262,
1077,
825,
29644,
284,
21045,
486,
931,
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_203() {
assert_eq!(Solution::remove_elements(linked![1,2,6,3,4,5,6], 6), linked![1,2,3,4,5]);
} | rust_cleaned_test_functions.jsonl/2188 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 74
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
17,
15,
18,
368,
341,
286,
2060,
10714,
10297,
36842,
486,
5399,
22801,
25389,
291,
20703,
16,
11,
17,
11,
21,
11,
18,
11,
19,
11,
20,
11,
21,
1125,
220,
21,
701,
10592,
20703,
16,
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 |
#[test]
fn test_auth() {
let client_auth_port = sccache::dist::client_auth::VALID_PORTS[0];
assert_eq!(TcpStream::connect(("localhost", client_auth_port)).unwrap_err().kind(), io::ErrorKind::ConnectionRefused);
assert_eq!(TcpStream::connect(("localhost", 4444)).unwrap_err().kind(), io::ErrorKind::ConnectionRefused);
let _selenium = SeleniumContainer::new();
thread::sleep(Duration::from_secs(3));
// Code grant PKCE
println!("Testing code grant pkce auth");
test_auth_with_config(generate_code_grant_pkce_auth_config());
// Implicit
println!("Testing implicit auth");
test_auth_with_config(generate_implicit_auth_config());
} | rust_cleaned_test_functions.jsonl/44088 | {
"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,
14014,
368,
341,
1066,
262,
1077,
2943,
14014,
8716,
284,
274,
638,
1777,
486,
12211,
486,
2972,
14014,
486,
10044,
95559,
58,
15,
935,
262,
2060,
10714,
10297,
77536,
3027,
486,
6459,
30873,
8301... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_scoring_p2() {
let config = GossipsubConfig::default();
let mut peer_score_params = PeerScoreParams::default();
let topic = Topic::new("test");
let topic_hash = topic.hash();
let mut topic_params = TopicScoreParams::default();
topic_params.time_in_mesh_weight = 0.0; //deactivate time in mesh
topic_params.first_message_deliveries_weight = 2.0;
topic_params.first_message_deliveries_cap = 10.0;
topic_params.first_message_deliveries_decay = 0.9;
topic_params.topic_weight = 0.7;
peer_score_params
.topics
.insert(topic_hash.clone(), topic_params.clone());
let peer_score_thresholds = PeerScoreThresholds::default();
//build mesh with one peer
let (mut gs, peers, topics) = inject_nodes1()
.peer_no(2)
.topics(vec!["test".into()])
.to_subscribe(true)
.gs_config(config.clone())
.explicit(0)
.outbound(0)
.scoring(Some((peer_score_params, peer_score_thresholds)))
.create_network();
let mut seq = 0;
let deliver_message = |gs: &mut Gossipsub, index: usize, msg: RawGossipsubMessage| {
gs.handle_received_message(msg, &peers[index]);
};
let m1 = random_message(&mut seq, &topics);
//peer 0 delivers message first
deliver_message(&mut gs, 0, m1.clone());
//peer 1 delivers message second
deliver_message(&mut gs, 1, m1.clone());
assert_eq!(
gs.peer_score.as_ref().unwrap().0.score(&peers[0]),
1.0 * topic_params.first_message_deliveries_weight * topic_params.topic_weight,
"score should be exactly first_message_deliveries_weight * topic_weight"
);
assert_eq!(
gs.peer_score.as_ref().unwrap().0.score(&peers[1]),
0.0,
"there should be no score for second message deliveries * topic_weight"
);
//peer 2 delivers two new messages
deliver_message(&mut gs, 1, random_message(&mut seq, &topics));
deliver_message(&mut gs, 1, random_message(&mut seq, &topics));
assert_eq!(
gs.peer_score.as_ref().unwrap().0.score(&peers[1]),
2.0 * topic_params.first_message_deliveries_weight * topic_params.topic_weight,
"score should be exactly 2 * first_message_deliveries_weight * topic_weight"
);
//test decaying
gs.peer_score.as_mut().unwrap().0.refresh_scores();
assert_eq!(
gs.peer_score.as_ref().unwrap().0.score(&peers[0]),
1.0 * topic_params.first_message_deliveries_decay
* topic_params.first_message_deliveries_weight
* topic_params.topic_weight,
"score should be exactly first_message_deliveries_decay * \
first_message_deliveries_weight * topic_weight"
);
assert_eq!(
gs.peer_score.as_ref().unwrap().0.score(&peers[1]),
2.0 * topic_params.first_message_deliveries_decay
* topic_params.first_message_deliveries_weight
* topic_params.topic_weight,
"score should be exactly 2 * first_message_deliveries_decay * \
first_message_deliveries_weight * topic_weight"
);
//test cap
for _ in 0..topic_params.first_message_deliveries_cap as u64 {
deliver_message(&mut gs, 1, random_message(&mut seq, &topics));
}
assert_eq!(
gs.peer_score.as_ref().unwrap().0.score(&peers[1]),
topic_params.first_message_deliveries_cap
* topic_params.first_message_deliveries_weight
* topic_params.topic_weight,
"score should be exactly first_message_deliveries_cap * \
first_message_deliveries_weight * topic_weight"
);
} | rust_cleaned_test_functions.jsonl/66921 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1885
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13171,
5503,
620,
17,
368,
341,
286,
1077,
2193,
284,
479,
41473,
1966,
2648,
486,
2258,
543,
286,
1077,
5206,
14397,
10405,
6745,
284,
45147,
10570,
4870,
486,
2258,
543,
286,
1077,
8544,
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... | 2 |
#[test]
fn test_random_seed() {
let perlin = Perlin::new().set_seed(random());
let _ = perlin.get([1.0, 2.0, 3.0]);
} | rust_cleaned_test_functions.jsonl/117173 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 75
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22644,
33809,
368,
341,
286,
1077,
817,
3732,
284,
3616,
3732,
486,
931,
1005,
746,
33809,
25110,
1423,
286,
1077,
716,
284,
817,
3732,
670,
2561,
16,
13,
15,
11,
220,
17,
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 |
#[test]
fn test_wait_many_connections() {
let path_to_socket = "/tmp/test_socket_http_server4.sock";
fs::remove_file(path_to_socket).unwrap_or_default();
let mut server = HttpServer::new(path_to_socket.to_string()).unwrap();
server.start_server().unwrap();
let mut sockets: Vec<UnixStream> = Vec::with_capacity(11);
for _ in 0..MAX_CONNECTIONS {
sockets.push(UnixStream::connect(path_to_socket).unwrap());
assert!(server.requests().unwrap().is_empty());
}
sockets.push(UnixStream::connect(path_to_socket).unwrap());
assert!(server.requests().unwrap().is_empty());
let mut buf: [u8; 120] = [0; 120];
sockets[MAX_CONNECTIONS].read_exact(&mut buf).unwrap();
assert_eq!(&buf[..], SERVER_FULL_ERROR_MESSAGE);
fs::remove_file(path_to_socket).unwrap();
} | rust_cleaned_test_functions.jsonl/2923 | {
"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,
18760,
22101,
56402,
368,
341,
286,
1077,
1815,
2346,
19555,
284,
3521,
5173,
12697,
19555,
25888,
12015,
19,
68171,
876,
286,
8619,
486,
5399,
2458,
5581,
2346,
19555,
568,
15454,
8734,
9993,
1428,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_ident() {
assert_eq!(ident(&b"foo "[..]), Done(&b" "[..], "foo"));
assert_eq!(ident(&b" foo "[..]), Done(&b" "[..], "foo"));
assert_eq!(ident(&b" bool "[..]), Error(Err::Position(ErrorKind::Custom(1), &b"bool"[..])));
} | rust_cleaned_test_functions.jsonl/11382 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38399,
368,
341,
262,
2060,
10714,
10297,
1713,
2099,
65,
1,
7975,
10545,
496,
9719,
27357,
2099,
65,
1,
10545,
496,
1125,
330,
7975,
4010,
262,
2060,
10714,
10297,
1713,
2099,
65,
1,
15229,
105... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_domain_type_integer() {
let ty = DomainType {
annotation: Default::default(),
id: "ty".to_string(),
r#type: Type::Integer,
};
let prog = Context::new_root(&Default::default())
.with_domain("foo")
.render_with(&ty);
let expect = quote! {
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Ty(u32);
impl From<u32> for Ty {
fn from(v: u32) -> Self {
Self(v)
}
}
impl Deref for Ty {
type Target = u32;
fn deref(&self) -> &Self::Target {
&self.0
}
}
};
assert_eq(&prog, &expect);
} | rust_cleaned_test_functions.jsonl/26902 | {
"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,
20111,
1819,
31725,
368,
341,
262,
1077,
13580,
284,
21070,
929,
341,
286,
21223,
25,
7899,
486,
2258,
3148,
286,
877,
25,
330,
1881,
3263,
983,
3904,
3148,
286,
435,
2,
1313,
25,
3990,
486,
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_blake2s_constraints() {
let cs = ConstraintSystem::<Fr>::new_ref();
let input_bits: Vec<_> = (0..512)
.map(|_| Boolean::new_witness(r1cs_core::ns!(cs, "input bit"), || Ok(true)).unwrap())
.collect();
evaluate_blake2s(&input_bits).unwrap();
assert!(cs.is_satisfied().unwrap());
assert_eq!(cs.num_constraints(), 21792);
} | rust_cleaned_test_functions.jsonl/101935 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 206
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13141,
726,
17,
82,
60267,
368,
341,
286,
1077,
10532,
284,
44264,
2320,
27638,
22560,
6831,
931,
7793,
543,
286,
1077,
1946,
20034,
25,
11312,
32399,
29,
284,
320,
15,
496,
20,
16,
17,
340,
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... | 2 |
#[test]
fn test_version_not_equal() {
assert!(Version::parse("1.0").unwrap() != Version::parse("2.0.0").unwrap());
assert!(!(Version::parse("1.0").unwrap() != Version::parse("1.0.0").unwrap()));
} | rust_cleaned_test_functions.jsonl/6350 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9438,
7913,
11478,
368,
341,
286,
2060,
10297,
5637,
486,
6400,
445,
16,
13,
15,
1827,
15454,
368,
961,
6079,
486,
6400,
445,
17,
13,
15,
13,
15,
1827,
15454,
1423,
286,
2060,
0,
33660,
5637,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_and_format_float() {
assert_eq!(
"%f".parse::<CFormatSpec>()
.unwrap()
.format_float(f64::from(1.2345))
.ok(),
Some("1.234500".to_string())
);
assert_eq!(
"%+f"
.parse::<CFormatSpec>()
.unwrap()
.format_float(f64::from(1.2345))
.ok(),
Some("+1.234500".to_string())
);
assert_eq!(
"% f"
.parse::<CFormatSpec>()
.unwrap()
.format_float(f64::from(1.2345))
.ok(),
Some(" 1.234500".to_string())
);
assert_eq!(
"%f".parse::<CFormatSpec>()
.unwrap()
.format_float(f64::from(-1.2345))
.ok(),
Some("-1.234500".to_string())
);
assert_eq!(
"%f".parse::<CFormatSpec>()
.unwrap()
.format_float(f64::from(1.2345678901))
.ok(),
Some("1.234568".to_string())
);
} | rust_cleaned_test_functions.jsonl/37689 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 763
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8378,
8955,
17586,
368,
341,
286,
2060,
10714,
33673,
310,
5962,
69,
3263,
6400,
27638,
34,
4061,
8327,
18949,
394,
659,
15454,
741,
394,
659,
2243,
17586,
955,
21,
19,
486,
1499,
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_short_get_version() {
let expected = vec![0, 3, 0, 0, 0];
let mut bb = ByteBuffer::new();
ShortEncoder::encode(&mut bb, CommandAPDU::new(U2fCommand::Version, 0, 0, vec![], Some(256))).unwrap();
assert_eq!(bb.to_bytes(), expected);
} | rust_cleaned_test_functions.jsonl/124401 | {
"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,
16673,
3062,
9438,
368,
341,
286,
1077,
3601,
284,
7486,
20703,
15,
11,
220,
18,
11,
220,
15,
11,
220,
15,
11,
220,
15,
935,
286,
1077,
5206,
16520,
284,
50299,
486,
931,
543,
286,
10698,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mention_without_member() {
let value = Mention {
avatar: None,
bot: false,
discriminator: "0001".to_owned(),
id: UserId(1),
member: None,
name: "foo".to_owned(),
public_flags: UserFlags::empty(),
};
serde_test::assert_tokens(
&value,
&[
Token::Struct {
name: "Mention",
len: 7,
},
Token::Str("avatar"),
Token::None,
Token::Str("bot"),
Token::Bool(false),
Token::Str("discriminator"),
Token::Str("0001"),
Token::Str("id"),
Token::NewtypeStruct { name: "UserId" },
Token::Str("1"),
Token::Str("member"),
Token::None,
Token::Str("username"),
Token::Str("foo"),
Token::Str("public_flags"),
Token::U64(0),
Token::StructEnd,
],
);
} | rust_cleaned_test_functions.jsonl/67373 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 699
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26985,
290,
39904,
19388,
368,
341,
286,
1077,
897,
284,
85148,
341,
310,
20701,
25,
2240,
345,
310,
10924,
25,
895,
345,
310,
81738,
25,
330,
15,
15,
15,
16,
3263,
983,
51973,
3148,
310,
877,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_foldl_consuming() {
let h = hlist![1, false, 42f32];
let folded = h.foldl(
hlist![
|acc, i| i + acc,
|acc, b: bool| if !b && acc > 42 { 9000f32 } else { 0f32 },
|acc, f| f + acc,
],
1,
);
assert_eq!(42f32, folded)
} | rust_cleaned_test_functions.jsonl/24757 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 226
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
61187,
75,
3382,
61117,
368,
341,
286,
1077,
305,
284,
305,
1607,
20703,
16,
11,
895,
11,
220,
19,
17,
69,
18,
17,
935,
286,
1077,
47035,
284,
305,
55031,
75,
1006,
310,
305,
1607,
90515,
39... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_multiple_patterns() {
assert_eq!(run("foo=warn,bar=trace", "foo", Level::Warn), true);
assert_eq!(run("foo=warn,bar=trace", "foo", Level::Info), false);
assert_eq!(run("foo=warn,bar=trace", "foo", Level::Debug), false);
assert_eq!(run("foo=warn,bar=trace", "bar", Level::Warn), true);
assert_eq!(run("foo=warn,bar=trace", "bar", Level::Info), true);
assert_eq!(run("foo=warn,bar=trace", "bar", Level::Debug), true);
} | rust_cleaned_test_functions.jsonl/126008 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 219
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45233,
64923,
368,
341,
286,
2060,
10714,
10297,
6108,
445,
7975,
28,
33481,
11,
2257,
28,
15067,
497,
330,
7975,
497,
9395,
486,
38244,
701,
830,
317,
286,
2060,
10714,
10297,
6108,
445,
7975,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_executor_multiple_blocks() {
let executor = TestExecutor::new();
let mut parent_block_id = executor.committed_block_id();
for i in 0..100 {
parent_block_id = execute_and_commit_block(&executor, parent_block_id, i);
}
} | rust_cleaned_test_functions.jsonl/12643 | {
"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,
81207,
45233,
25201,
368,
341,
262,
1077,
31558,
284,
3393,
25255,
486,
931,
543,
262,
1077,
5206,
2681,
7113,
842,
284,
31558,
905,
5483,
7113,
842,
1428,
262,
369,
600,
304,
220,
15,
496,
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_parse_static() {
let re = ResourceDef::new("/");
assert!(re.is_match("/"));
assert!(!re.is_match("/a"));
let re = ResourceDef::new("/name");
assert!(re.is_match("/name"));
assert!(!re.is_match("/name1"));
assert!(!re.is_match("/name/"));
assert!(!re.is_match("/name~"));
assert_eq!(re.is_prefix_match("/name"), Some(5));
assert_eq!(re.is_prefix_match("/name1"), None);
assert_eq!(re.is_prefix_match("/name/"), None);
assert_eq!(re.is_prefix_match("/name~"), None);
let re = ResourceDef::new("/name/");
assert!(re.is_match("/name/"));
assert!(!re.is_match("/name"));
assert!(!re.is_match("/name/gs"));
let re = ResourceDef::new("/user/profile");
assert!(re.is_match("/user/profile"));
assert!(!re.is_match("/user/profile/profile"));
} | rust_cleaned_test_functions.jsonl/87890 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 460
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
25360,
368,
341,
286,
1077,
312,
284,
11765,
2620,
486,
931,
58423,
286,
2060,
10297,
265,
2079,
10708,
4283,
4010,
286,
2060,
0,
3471,
265,
2079,
10708,
4283,
64,
14929,
286,
1077,
312,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
let tf = parse_test(
r#"; before
test cfg option=5
test verify
set enable_float=false
feature "foo"
feature !"bar"
; still preamble
function %comment() system_v {}"#,
ParseOptions::default(),
)
.unwrap();
assert_eq!(tf.commands.len(), 2);
assert_eq!(tf.commands[0].command, "cfg");
assert_eq!(tf.commands[1].command, "verify");
match tf.isa_spec {
IsaSpec::None(s) => {
assert!(s.enable_verifier());
assert!(!s.enable_float());
}
_ => panic!("unexpected ISAs"),
}
assert_eq!(tf.features[0], Feature::With(&"foo"));
assert_eq!(tf.features[1], Feature::Without(&"bar"));
assert_eq!(tf.preamble_comments.len(), 2);
assert_eq!(tf.preamble_comments[0].text, "; before");
assert_eq!(tf.preamble_comments[1].text, "; still preamble");
assert_eq!(tf.functions.len(), 1);
assert_eq!(tf.functions[0].0.name.to_string(), "%comment");
} | rust_cleaned_test_functions.jsonl/8365 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 732
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2458,
368,
341,
286,
1077,
6409,
284,
4715,
4452,
1006,
310,
435,
2,
5123,
1573,
198,
6526,
1273,
13286,
2999,
28,
20,
198,
6526,
1273,
10146,
198,
6526,
738,
7283,
17586,
12219,
198,
6526,
4565... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_extract_lock_from_result() {
let raw_key = b"key".to_vec();
let key = Key::from_raw(&raw_key);
let ts = 100;
let mut info = LockInfo::default();
info.set_key(raw_key);
info.set_lock_version(ts);
info.set_lock_ttl(100);
let case = StorageError::from(StorageErrorInner::Txn(Error::from(ErrorInner::Mvcc(
MvccError::from(MvccErrorInner::KeyIsLocked(info)),
))));
let lock = extract_lock_from_result(&Err(case));
assert_eq!(lock.ts, ts.into());
assert_eq!(lock.hash, key.gen_hash());
} | rust_cleaned_test_functions.jsonl/80860 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 303
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
9818,
5673,
5287,
368,
341,
286,
1077,
7112,
3097,
284,
293,
1,
792,
3263,
983,
13251,
543,
286,
1077,
1376,
284,
5309,
486,
1499,
16067,
2099,
1041,
3097,
317,
286,
1077,
10591,
284,
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... | 3 |
#[test]
fn test_add_timeout_stop() {
System::run(|| {
let _addr = MyActor {
op: Op::TimeoutStop,
}
.start();
})
.unwrap();
} | rust_cleaned_test_functions.jsonl/35702 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
20537,
19039,
368,
341,
262,
739,
486,
6108,
79453,
341,
286,
1077,
716,
6214,
284,
3017,
18870,
341,
310,
1179,
25,
10672,
486,
7636,
10674,
345,
286,
456,
286,
659,
2468,
543,
262,
2751,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_extract_package_version() -> io::Result<()> {
let config_name = "package.json";
let config_content = json::json!({
"name": "starship",
"version": "0.1.0"
})
.to_string();
let project_dir = create_project_dir()?;
fill_config(&project_dir, config_name, Some(&config_content))?;
expect_output(&project_dir, Some("v0.1.0"), None)?;
project_dir.close()
} | rust_cleaned_test_functions.jsonl/19236 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
26328,
9438,
368,
1464,
6399,
486,
2077,
71698,
341,
286,
1077,
2193,
1269,
284,
330,
1722,
4323,
876,
286,
1077,
2193,
7495,
284,
2951,
486,
2236,
0,
2262,
310,
330,
606,
788,
330,
11870... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_from_base64() {
let tests = vec![
("", ""),
("YWJj", "abc"),
("YWIgYw==", "ab c"),
("YWIKYw==", "ab\nc"),
("YWIJYw==", "ab\tc"),
("cXdlcnR5MTIzNDU2", "qwerty123456"),
(
"QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0\nNTY3ODkrL0FCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFlaYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4\neXowMTIzNDU2Nzg5Ky9BQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWmFiY2RlZmdoaWprbG1ub3Bx\ncnN0dXZ3eHl6MDEyMzQ1Njc4OSsv",
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
),
(
"QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLw==",
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
),
(
"QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLw==",
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
),
(
"QUJDREVGR0hJSkt\tMTU5PUFFSU1RVVld\nYWVphYmNkZ\rWZnaGlqa2xt bm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLw==",
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
),
];
for (s, exp) in tests {
let s = Datum::Bytes(s.to_string().into_bytes());
let exp = Datum::Bytes(exp.to_string().into_bytes());
let got = eval_func(ScalarFuncSig::FromBase64, &[s]).unwrap();
assert_eq!(got, exp);
}
let s = Datum::Bytes(b"src".to_vec());
let exp = Datum::Bytes(b"".to_vec());
let got = eval_func(ScalarFuncSig::FromBase64, &[s]).unwrap();
assert_eq!(got, exp);
} | rust_cleaned_test_functions.jsonl/9114 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1310
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
7651,
21,
19,
368,
341,
286,
1077,
7032,
284,
7486,
90515,
310,
3489,
497,
72712,
310,
3489,
98117,
41,
73,
497,
330,
13683,
4461,
310,
3489,
56,
60195,
70,
56,
86,
418,
497,
330,
370,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_map_api() {
let _setup_guard = setup();
let mut isolate = v8::Isolate::new(Default::default());
{
let mut hs = v8::HandleScope::new(&mut isolate);
let scope = hs.enter();
let context = v8::Context::new(scope);
let mut cs = v8::ContextScope::new(scope, context);
let scope = cs.enter();
let value = eval(scope, context, "new Map([['r','s'],['v',8]])").unwrap();
assert!(value.is_map());
assert!(value == v8::Local::<v8::Map>::try_from(value).unwrap());
assert!(value != v8::Object::new(scope));
assert_eq!(v8::Local::<v8::Map>::try_from(value).unwrap().size(), 2);
let map = v8::Local::<v8::Map>::try_from(value).unwrap();
assert_eq!(map.size(), 2);
let map_array = map.as_array(scope);
assert_eq!(map_array.length(), 4);
assert!(
map_array.get_index(scope, context, 0).unwrap()
== v8::String::new(scope, "r").unwrap()
);
assert!(
map_array.get_index(scope, context, 1).unwrap()
== v8::String::new(scope, "s").unwrap()
);
assert!(
map_array.get_index(scope, context, 2).unwrap()
== v8::String::new(scope, "v").unwrap()
);
assert!(
map_array.get_index(scope, context, 3).unwrap()
== v8::Number::new(scope, 8f64)
);
}
} | rust_cleaned_test_functions.jsonl/77894 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 573
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5376,
11697,
368,
341,
220,
1077,
716,
15188,
36796,
284,
6505,
543,
220,
1077,
5206,
42123,
284,
348,
23,
486,
3872,
33066,
486,
931,
87874,
486,
2258,
1423,
220,
341,
262,
1077,
5206,
32220,
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_case_9() {
let key = "f999b20ab4769eb1d01c057c5295ed042b4536561dce32478b113adb5b605cac";
let nonce = "75bcfcacb5e3e811b78e72e398fdd118";
let expected_output =
"564eb6b2ac2b92270af7c0b054cc7a721313e4ed3651b0970db9dfcdfda27220";
hchacha_test_runner(key, nonce, expected_output);
} | rust_cleaned_test_functions.jsonl/44671 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 225
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19096,
62,
24,
368,
341,
310,
1077,
1376,
284,
330,
69,
24,
24,
24,
65,
17,
15,
370,
19,
22,
21,
24,
3065,
16,
67,
15,
16,
66,
15,
20,
22,
66,
20,
17,
24,
20,
291,
15,
19,
17,
65,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_or_simd() {
let buf1 = [0b00110011u8; 64];
let buf2 = [0b11110000u8; 64];
let mut buf3 = [0b00000000; 64];
unsafe { bitwise_bin_op_simd(&buf1, &buf2, &mut buf3, |a, b| a | b) };
for i in buf3.iter() {
assert_eq!(&0b11110011u8, i);
}
} | rust_cleaned_test_functions.jsonl/6792 | {
"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,
13996,
4482,
8734,
18314,
67,
368,
341,
286,
1077,
6607,
16,
284,
508,
15,
65,
15,
15,
16,
16,
15,
15,
16,
16,
84,
23,
26,
220,
21,
19,
935,
286,
1077,
6607,
17,
284,
508,
15,
65,
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_validator_info_max_space() {
// 70-character string
let max_short_string =
"Max Length String KWpP299aFCBWvWg1MHpSuaoTsud7cv8zMJsh99aAtP8X1s26yrR1".to_string();
// 300-character string
let max_long_string = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut libero quam, volutpat et aliquet eu, varius in mi. Aenean vestibulum ex in tristique faucibus. Maecenas in imperdiet turpis. Nullam feugiat aliquet erat. Morbi malesuada turpis sed dui pulvinar lobortis. Pellentesque a lectus eu leo nullam.".to_string();
let mut info = Map::new();
info.insert("name".to_string(), Value::String(max_short_string.clone()));
info.insert(
"website".to_string(),
Value::String(max_short_string.clone()),
);
info.insert(
"keybaseUsername".to_string(),
Value::String(max_short_string),
);
info.insert("details".to_string(), Value::String(max_long_string));
let info_string = serde_json::to_string(&Value::Object(info)).unwrap();
let validator_info = ValidatorInfo { info: info_string };
assert_eq!(
serialized_size(&validator_info).unwrap(),
ValidatorInfo::max_space()
);
} | rust_cleaned_test_functions.jsonl/12699 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 587
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64959,
3109,
6345,
14663,
368,
341,
286,
442,
220,
22,
15,
79225,
914,
198,
286,
1077,
1932,
16673,
3904,
4035,
310,
330,
5974,
17287,
923,
71915,
79,
47,
17,
24,
24,
64,
6754,
77563,
85,
54,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_filters() {
let opt_warn = LoggerOptions {
filter: log::LevelFilter::Warn,
..Default::default()
};
assert_eq!(opt_warn.effective_global_filter(), log::LevelFilter::Warn);
assert_eq!(opt_warn.issue_filter(), log::LevelFilter::Error);
let opt_debug = LoggerOptions {
global_filter: Some(log::LevelFilter::Debug),
filter: log::LevelFilter::Warn,
..Default::default()
};
assert_eq!(opt_debug.effective_global_filter(), log::LevelFilter::Debug);
let opt_debug_inverse = LoggerOptions {
global_filter: Some(log::LevelFilter::Warn),
filter: log::LevelFilter::Debug,
..Default::default()
};
assert_eq!(
opt_debug_inverse.effective_global_filter(),
log::LevelFilter::Debug
);
let opt_weird = LoggerOptions {
filter: log::LevelFilter::Error,
emit_warning_events: true,
..Default::default()
};
assert_eq!(opt_weird.issue_filter(), log::LevelFilter::Warn);
assert_eq!(opt_weird.effective_global_filter(), log::LevelFilter::Warn);
} | rust_cleaned_test_functions.jsonl/20056 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 457
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22481,
368,
341,
262,
1077,
3387,
55045,
284,
9514,
3798,
341,
286,
4051,
25,
1487,
486,
4449,
5632,
486,
38244,
345,
286,
5241,
3675,
486,
2258,
741,
262,
2605,
262,
2060,
10714,
10297,
2912,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_display_path() {
let dir = TempDir::new("test-display-path").unwrap();
let key = SnapKey::new(1, 1, 1);
let prefix = format!("{}_{}", SNAP_GEN_PREFIX, key);
let display_path = Snap::get_display_path(dir.path(), &prefix);
assert_ne!(display_path, "");
} | rust_cleaned_test_functions.jsonl/9594 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 147
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14825,
2638,
368,
341,
286,
1077,
5419,
284,
19944,
6184,
486,
931,
445,
1944,
52839,
33095,
1827,
15454,
543,
286,
1077,
1376,
284,
28232,
1592,
486,
931,
7,
16,
11,
220,
16,
11,
220,
16,
317... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_writable_index() {
let message = check_test_loaded_message().0;
assert!(message.is_writable_index(0));
assert!(!message.is_writable_index(1));
assert!(message.is_writable_index(2));
assert!(!message.is_writable_index(3));
assert!(message.is_writable_index(4));
assert!(!message.is_writable_index(5));
} | rust_cleaned_test_functions.jsonl/34144 | {
"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,
6892,
1670,
22533,
3560,
368,
341,
286,
1077,
1943,
284,
1779,
4452,
49205,
6462,
1005,
15,
401,
286,
2060,
10297,
1994,
2079,
1670,
22533,
3560,
7,
15,
1106,
286,
2060,
0,
3471,
1994,
2079,
167... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_flags_noatime() {
const FS_NOATIME_FL: std::os::raw::c_long = 0x00000080;
let tempdir = tempfile::tempdir().unwrap();
let tempfile = File::create(tempdir.path().join("foo")).unwrap();
unsafe {
use std::os::unix::io::AsRawFd as _;
let fd = tempfile.as_raw_fd();
assert_eq!(ioctls::fs_ioc_setflags(fd, &FS_NOATIME_FL), 0);
}
let flags = flags(tempdir.path().join("foo")).unwrap();
assert_eq!(flags & FS_NOATIME_FL as u32, FS_NOATIME_FL as u32);
} | rust_cleaned_test_functions.jsonl/43879 | {
"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,
14130,
6536,
266,
545,
368,
341,
1789,
286,
733,
24289,
9100,
828,
5660,
22588,
25,
1460,
486,
436,
486,
1041,
486,
66,
17799,
284,
220,
15,
87,
15,
15,
15,
15,
15,
15,
23,
15,
401,
286,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_peer_close() {
let peer_port = 1025;
let local_port = 1026;
let mut ctx = MuxerTestContext::new("peer_close");
let mut sock = ctx.create_local_listener(local_port);
ctx.init_pkt(local_port, peer_port, uapi::VSOCK_OP_REQUEST);
ctx.send();
let mut stream = sock.accept();
assert!(ctx.muxer.has_pending_rx());
ctx.recv();
assert_eq!(ctx.pkt.op(), uapi::VSOCK_OP_RESPONSE);
assert_eq!(ctx.pkt.src_port(), local_port);
assert_eq!(ctx.pkt.dst_port(), peer_port);
let key = ConnMapKey {
local_port,
peer_port,
};
assert!(ctx.muxer.conn_map.contains_key(&key));
ctx.init_pkt(local_port, peer_port, uapi::VSOCK_OP_SHUTDOWN)
.set_flag(uapi::VSOCK_FLAGS_SHUTDOWN_SEND)
.set_flag(uapi::VSOCK_FLAGS_SHUTDOWN_RCV);
ctx.send();
assert!(ctx.muxer.has_pending_rx());
ctx.recv();
assert_eq!(ctx.pkt.op(), uapi::VSOCK_OP_RST);
assert_eq!(ctx.pkt.src_port(), local_port);
assert_eq!(ctx.pkt.dst_port(), peer_port);
let key = ConnMapKey {
local_port,
peer_port,
};
assert!(!ctx.muxer.conn_map.contains_key(&key));
// The muxer should also drop / close the local Unix socket for this connection.
let mut buf = vec![0u8; 16];
assert_eq!(stream.read(buf.as_mut_slice()).unwrap(), 0);
} | rust_cleaned_test_functions.jsonl/37603 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 797
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45159,
12704,
368,
341,
286,
1077,
14397,
8716,
284,
220,
16,
15,
17,
20,
280,
286,
1077,
2205,
8716,
284,
220,
16,
15,
17,
21,
280,
286,
1077,
5206,
5635,
284,
386,
2200,
261,
2271,
1972,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_port_range_fromstr() {
// A single `port` value between 0-65k should parse: the start and end values should be the
// same.
match "22".parse::<PortRange>() {
Ok(v) => {
assert_eq!(v.from, 22u16);
assert_eq!(v.to, 22u16);
}
Err(e) => panic!("Unexpected 'Error' result: {:?}", e),
}
// Valid port range should parse successfully.
match "6667-6669".parse::<PortRange>() {
Ok(v) => {
assert_eq!(v.from, 6667u16);
assert_eq!(v.to, 6669u16);
}
Err(e) => panic!("Unexpected 'Error' result: {:?}", e),
}
// Multiple port ranges are not supported yet: fxb/45891.
match "6666,6667-6669".parse::<PortRange>() {
Ok(v) => panic!("Unexpected 'Ok' result: {:?}", v),
Err(_) => (),
}
} | rust_cleaned_test_functions.jsonl/83832 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 504
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8716,
9698,
5673,
495,
368,
341,
286,
442,
362,
3175,
1565,
403,
63,
897,
1948,
220,
15,
12,
21,
20,
74,
1265,
4715,
25,
279,
1191,
323,
835,
2750,
1265,
387,
279,
198,
286,
442,
1852... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_register() {
assert_ne!(crate::Type::INVALID, MySharedArc::type_());
assert_ne!(crate::Type::INVALID, MySharedRc::type_());
} | rust_cleaned_test_functions.jsonl/49616 | {
"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,
14000,
368,
341,
286,
2060,
13925,
10297,
61711,
486,
929,
486,
46859,
11,
3017,
16997,
36809,
486,
1313,
62,
1423,
286,
2060,
13925,
10297,
61711,
486,
929,
486,
46859,
11,
3017,
16997,
49,
66,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_statistics_partial_eq() {
let expected = Statistics::int32(Some(12), Some(45), None, 11, true);
assert!(Statistics::int32(Some(12), Some(45), None, 11, true) == expected);
assert!(Statistics::int32(Some(11), Some(45), None, 11, true) != expected);
assert!(Statistics::int32(Some(12), Some(44), None, 11, true) != expected);
assert!(Statistics::int32(Some(12), Some(45), None, 23, true) != expected);
assert!(Statistics::int32(Some(12), Some(45), None, 11, false) != expected);
assert!(
Statistics::int32(Some(12), Some(45), None, 11, false)
!= Statistics::int64(Some(12), Some(45), None, 11, false)
);
assert!(
Statistics::boolean(Some(false), Some(true), None, 0, true)
!= Statistics::double(Some(1.2), Some(4.5), None, 0, true)
);
assert!(
Statistics::byte_array(
Some(ByteArray::from(vec![1, 2, 3])),
Some(ByteArray::from(vec![1, 2, 3])),
None,
0,
true
) != Statistics::fixed_len_byte_array(
Some(ByteArray::from(vec![1, 2, 3])),
Some(ByteArray::from(vec![1, 2, 3])),
None,
0,
true
)
);
} | rust_cleaned_test_functions.jsonl/15834 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 712
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49569,
52068,
10714,
368,
341,
286,
1077,
3601,
284,
24624,
486,
396,
18,
17,
65405,
7,
16,
17,
701,
4329,
7,
19,
20,
701,
2240,
11,
220,
16,
16,
11,
830,
626,
286,
2060,
10297,
38599,
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_bound_difference() {
let bound = ClosedInterval::new(0, 3);
let empty = ClosedInterval::empty();
let res = bound.difference(&ClosedInterval::new(-2, -1));
assert_eq!(res.difference, [empty, bound]);
assert_eq!(res.intersection, empty);
let res = bound.difference(&ClosedInterval::new(-2, 0));
assert_eq!(res.difference, [empty, ClosedInterval::new(1, 3)]);
assert_eq!(res.intersection, ClosedInterval::new(0, 0));
let res = bound.difference(&ClosedInterval::new(0, 0));
assert_eq!(res.difference, [empty, ClosedInterval::new(1, 3)]);
assert_eq!(res.intersection, ClosedInterval::new(0, 0));
let res = bound.difference(&ClosedInterval::new(0, 1));
assert_eq!(res.difference, [empty, ClosedInterval::new(2, 3)]);
assert_eq!(res.intersection, ClosedInterval::new(0, 1));
let res = bound.difference(&ClosedInterval::new(1, 1));
assert_eq!(
res.difference,
[ClosedInterval::new(0, 0), ClosedInterval::new(2, 3)]
);
assert_eq!(res.intersection, ClosedInterval::new(1, 1));
let res = bound.difference(&ClosedInterval::new(1, 2));
assert_eq!(
res.difference,
[ClosedInterval::new(0, 0), ClosedInterval::new(3, 3)]
);
assert_eq!(res.intersection, ClosedInterval::new(1, 2));
let res = bound.difference(&ClosedInterval::new(1, 3));
assert_eq!(res.difference, [ClosedInterval::new(0, 0), empty]);
assert_eq!(res.intersection, ClosedInterval::new(1, 3));
let res = bound.difference(&ClosedInterval::new(2, 3));
assert_eq!(res.difference, [ClosedInterval::new(0, 1), empty]);
assert_eq!(res.intersection, ClosedInterval::new(2, 3));
let res = bound.difference(&ClosedInterval::new(2, 4));
assert_eq!(res.difference, [ClosedInterval::new(0, 1), empty]);
assert_eq!(res.intersection, ClosedInterval::new(2, 3));
let res = bound.difference(&ClosedInterval::new(3, 3));
assert_eq!(res.difference, [ClosedInterval::new(0, 2), empty]);
assert_eq!(res.intersection, ClosedInterval::new(3, 3));
let res = bound.difference(&ClosedInterval::new(4, 5));
assert_eq!(res.difference, [bound, empty]);
assert_eq!(res.intersection, empty);
} | rust_cleaned_test_functions.jsonl/105383 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1069
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19447,
47525,
368,
341,
286,
1077,
6822,
284,
44679,
10256,
486,
931,
7,
15,
11,
220,
18,
317,
286,
1077,
4287,
284,
44679,
10256,
486,
3194,
1428,
286,
1077,
592,
284,
6822,
950,
18192,
2099,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.