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_stake_delegation_and_deactivation() {
panoptes_logger::setup();
let mint_keypair = Keypair::new();
let mint_pubkey = mint_keypair.pubkey();
let faucet_addr = run_local_faucet(mint_keypair, None);
let test_validator = TestValidator::with_no_fees(mint_pubkey, Some(faucet_addr));
let rpc_client =
RpcClient::new_with_commitment(test_validator.rpc_url(), CommitmentConfig::processed());
let validator_keypair = Keypair::new();
let mut config_validator = CliConfig::recent_for_tests();
config_validator.json_rpc_url = test_validator.rpc_url();
config_validator.signers = vec![&validator_keypair];
let stake_keypair = keypair_from_seed(&[0u8; 32]).unwrap();
request_and_confirm_airdrop(
&rpc_client,
&config_validator,
&config_validator.signers[0].pubkey(),
100_000,
)
.unwrap();
check_recent_balance(100_000, &rpc_client, &config_validator.signers[0].pubkey());
// Create stake account
config_validator.signers.push(&stake_keypair);
config_validator.command = CliCommand::CreateStakeAccount {
stake_account: 1,
seed: None,
staker: None,
withdrawer: None,
lockup: Lockup::default(),
amount: SpendAmount::Some(50_000),
sign_only: false,
dump_transaction_message: false,
blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster),
nonce_account: None,
nonce_authority: 0,
memo: None,
fee_payer: 0,
from: 0,
};
process_command(&config_validator).unwrap();
// Delegate stake
config_validator.signers.pop();
config_validator.command = CliCommand::DelegateStake {
stake_account_pubkey: stake_keypair.pubkey(),
vote_account_pubkey: test_validator.vote_account_address(),
stake_authority: 0,
force: true,
sign_only: false,
dump_transaction_message: false,
blockhash_query: BlockhashQuery::default(),
nonce_account: None,
nonce_authority: 0,
memo: None,
fee_payer: 0,
};
process_command(&config_validator).unwrap();
// Deactivate stake
config_validator.command = CliCommand::DeactivateStake {
stake_account_pubkey: stake_keypair.pubkey(),
stake_authority: 0,
sign_only: false,
dump_transaction_message: false,
blockhash_query: BlockhashQuery::default(),
nonce_account: None,
nonce_authority: 0,
memo: None,
seed: None,
fee_payer: 0,
};
process_command(&config_validator).unwrap();
} | rust_cleaned_test_functions.jsonl/45361 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
726,
2259,
87566,
8378,
2259,
23002,
368,
341,
262,
7215,
2912,
288,
27413,
486,
15188,
1428,
262,
1077,
28337,
3097,
12670,
284,
6569,
1082,
1310,
486,
931,
543,
262,
1077,
28337,
34014,
79... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_derivative() {
let candles = RandomCandles::default();
let src: Vec<ValueType> = candles.take(300).map(|x| x.close).collect();
(1..255).for_each(|length| {
let mut ma = TestingMethod::new(length, src[0]).unwrap();
let mut value2 = src[0];
src.iter().enumerate().for_each(|(i, &x)| {
let value = ma.next(x);
value2 = (x - src[i.saturating_sub(length as usize)]) / (length as ValueType);
assert_eq_float(value2, value);
});
});
} | rust_cleaned_test_functions.jsonl/108501 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 211
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
95930,
368,
341,
197,
10217,
51205,
284,
10612,
34,
20125,
486,
2258,
1428,
197,
10217,
2286,
25,
11312,
48325,
929,
29,
284,
51205,
40161,
7,
18,
15,
15,
568,
2186,
22428,
87,
91,
856,
4653,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_btf_type_enum() {
let endianness = Endianness::default();
let data: &[u8] = &[
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x06, 0x04, 0x00, 0x00, 0x00, 0xc9, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcf, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
];
match unsafe { BtfType::read(data, endianness) } {
Ok(BtfType::Enum(_, _)) => {}
Ok(t) => panic!("expected enum type, got {:#?}", t),
Err(_) => panic!("unexpected error"),
}
} | rust_cleaned_test_functions.jsonl/98491 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 327
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
880,
8935,
1819,
31054,
368,
341,
286,
1077,
835,
72,
82033,
284,
3972,
72,
82033,
486,
2258,
543,
286,
1077,
821,
25,
44590,
84,
23,
60,
284,
609,
9640,
310,
220,
15,
87,
15,
15,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_basic_tps() {
let mut tps = TransportParameters::default();
tps.set(
STATELESS_RESET_TOKEN,
TransportParameter::Bytes(vec![1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8]),
);
tps.params
.insert(INITIAL_MAX_STREAMS_BIDI, TransportParameter::Integer(10));
let mut enc = Encoder::default();
tps.encode(&mut enc);
let tps2 = TransportParameters::decode(&mut enc.as_decoder()).expect("Couldn't decode");
assert_eq!(tps, tps2);
println!("TPS = {:?}", tps);
assert_eq!(tps2.get_integer(IDLE_TIMEOUT), 0); // Default
assert_eq!(tps2.get_integer(MAX_ACK_DELAY), 25); // Default
assert_eq!(tps2.get_integer(INITIAL_MAX_STREAMS_BIDI), 10); // Sent
assert_eq!(
tps2.get_bytes(STATELESS_RESET_TOKEN),
Some(vec![1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8])
);
assert_eq!(tps2.get_bytes(ORIGINAL_CONNECTION_ID), None);
assert_eq!(tps2.was_sent(ORIGINAL_CONNECTION_ID), false);
assert_eq!(tps2.was_sent(STATELESS_RESET_TOKEN), true);
let mut enc = Encoder::default();
tps.encode(&mut enc);
let tps2 = TransportParameters::decode(&mut enc.as_decoder()).expect("Couldn't decode");
} | rust_cleaned_test_functions.jsonl/55322 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 670
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
528,
1690,
368,
341,
286,
1077,
5206,
259,
1690,
284,
16742,
9706,
486,
2258,
543,
286,
259,
1690,
980,
1006,
310,
22425,
37773,
27028,
18681,
345,
310,
16742,
4971,
486,
7078,
25592,
20703... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extract_data_from_schema_json() {
let data: SchemaData = serde_json::from_str(SCHEMA_JSON).unwrap();
assert_eq!(data.name, "test-licence".to_string());
} | rust_cleaned_test_functions.jsonl/29698 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 92
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
1769,
5673,
25371,
9455,
368,
341,
286,
1077,
821,
25,
12539,
1043,
284,
61570,
9455,
486,
1499,
2895,
59461,
35839,
25356,
568,
15454,
543,
286,
2060,
10714,
10297,
691,
2644,
11,
330,
194... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_cigar_modes() {
// test the cached and uncached ways of getting the cigar string.
let (_, _, _, _, cigars) = gold();
let mut bam = Reader::from_path(&Path::new("test/test.bam"))
.ok()
.expect("Error opening file.");
for (i, record) in bam.records().enumerate() {
let rec = record.expect("Expected valid record");
let cigar = rec.cigar();
assert_eq!(*cigar, cigars[i]);
}
for (i, record) in bam.records().enumerate() {
let mut rec = record.expect("Expected valid record");
rec.cache_cigar();
let cigar = rec.cigar_cached().unwrap();
assert_eq!(**cigar, cigars[i]);
let cigar = rec.cigar();
assert_eq!(*cigar, cigars[i]);
}
} | rust_cleaned_test_functions.jsonl/34035 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 415
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
51284,
59724,
368,
341,
286,
442,
1273,
279,
20579,
323,
20815,
3854,
5510,
315,
3709,
279,
53674,
914,
382,
286,
1077,
39464,
8358,
8358,
8358,
81115,
8,
284,
6623,
543,
286,
1077,
5206,
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... | 3 |
#[test]
fn test_affine_group() {
let a: EdwardsAffine = rand::random();
let b: EdwardsAffine = rand::random();
for _i in 0..100 {
group_test::<EdwardsAffine>(a, b);
}
} | rust_cleaned_test_functions.jsonl/128404 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48914,
482,
6288,
368,
341,
262,
1077,
264,
25,
36763,
25841,
482,
284,
10382,
486,
11463,
543,
262,
1077,
293,
25,
36763,
25841,
482,
284,
10382,
486,
11463,
543,
262,
369,
716,
72,
304,
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... | 2 |
#[test]
fn test_add_students_to_different_grades() {
let mut s = school::School::new();
s.add(3, "Chelsea");
s.add(7, "Logan");
assert_eq!(s.grades(), vec!(3, 7));
assert_eq!(s.grade(3).map(|v| stringvec_to_strvec(v)),
Some(vec!("Chelsea")));
assert_eq!(s.grade(7).map(|v| stringvec_to_strvec(v)),
Some(vec!("Logan")));
} | rust_cleaned_test_functions.jsonl/127494 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 196
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
71644,
2346,
82741,
15682,
3452,
368,
341,
262,
1077,
5206,
274,
284,
2906,
486,
32749,
486,
931,
543,
262,
274,
1364,
7,
18,
11,
330,
86306,
797,
262,
274,
1364,
7,
22,
11,
330,
2201,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reconstruct_latin() {
let analyzer = Analyzer::new(AnalyzerConfig::<Vec<u8>>::default());
let orig = "The quick (\"brown\") fox can't jump 32.3 feet, right? Brr, it's 29.3°F!";
let tokens = analyzer.analyze(orig);
assert_eq!(orig, tokens.reconstruct().map(|(t, _)| t).collect::<String>());
} | rust_cleaned_test_functions.jsonl/125060 | {
"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,
1288,
7596,
907,
14768,
368,
341,
286,
1077,
54660,
284,
78705,
486,
931,
7,
54911,
2648,
27638,
10050,
34837,
23,
77595,
2258,
1423,
286,
1077,
2713,
284,
330,
785,
3974,
320,
2105,
64461,
62705,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_invalid_frame_type() {
let role = Role::Unassigned;
let buf: &[u8] = &[
0b00000001,
0b10101010, // Control Field - Invalid command with P/F = 0.
0b00000001, // Length Field - Bit1 = 0 indicates 1 octet length.
0x00, // Random FCS.
];
assert_matches!(Frame::parse(role, false, buf), Err(FrameParseError::UnsupportedFrameType));
} | rust_cleaned_test_functions.jsonl/87861 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 217
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
31433,
8929,
1819,
368,
341,
286,
1077,
3476,
284,
15404,
486,
1806,
39021,
280,
286,
1077,
6607,
25,
44590,
84,
23,
60,
284,
609,
9640,
310,
220,
15,
65,
15,
15,
15,
15,
15,
15,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unit_version_incomplete() {
let buf = [0x01, 0x00, 0x00, 0x00, 0x04];
let rest = &mut EndianSlice::new(&buf, LittleEndian);
match parse_unit_header(rest) {
Err(Error::UnexpectedEof(_)) => assert!(true),
otherwise => panic!("Unexpected result: {:?}", otherwise),
};
} | rust_cleaned_test_functions.jsonl/101998 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14832,
9438,
1243,
14737,
368,
341,
286,
1077,
6607,
284,
508,
15,
87,
15,
16,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
19,
935,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_insert_dup_value() {
let mut cache = Cache::with_capacity(100);
let dbs1 = Box::new(DivBufShared::from(vec![0u8; 6]));
let dbs2 = Box::new(DivBufShared::from(vec![0u8; 6]));
let db1 = dbs1.try_const().unwrap();
let key = Key::Rid(RID(0));
cache.insert(key, dbs1);
cache.insert(key, dbs2);
let db3 = cache.get::<DivBuf>(&key).unwrap();
assert_eq!(&db1[..], &db3[..]);
// Check that the mru/lru entries are consistent
assert_eq!(cache.mru, Some(key));
assert_eq!(cache.lru, Some(key));
let entry = &cache.store[&key];
assert_eq!(entry.mru, None);
assert_eq!(entry.lru, None);
} | rust_cleaned_test_functions.jsonl/90047 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 308
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
51932,
3142,
368,
341,
262,
1077,
5206,
6500,
284,
19479,
486,
4197,
35603,
7,
16,
15,
15,
317,
262,
1077,
84581,
16,
284,
8261,
486,
931,
5432,
344,
15064,
16997,
486,
1499,
25592,
20703... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compile_with_dup_nonsigner_writable_mismatch() {
let program_id = Pubkey::new_unique();
let id0 = Pubkey::new_unique();
let compiled_keys = CompiledKeys::compile(
&[
Instruction::new_with_bincode(
program_id,
&0,
vec![
AccountMeta::new_readonly(id0, false),
AccountMeta::new(id0, false),
],
),
Instruction::new_with_bincode(program_id, &0, vec![AccountMeta::new(id0, false)]),
],
None,
);
// Ensure the dup nonsigner key is writable
assert_eq!(
compiled_keys,
CompiledKeys {
payer: None,
key_meta_map: BTreeMap::from([
(id0, KeyFlags::WRITABLE.into()),
(program_id, KeyFlags::INVOKED.into()),
]),
}
);
} | rust_cleaned_test_functions.jsonl/52065 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 624
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74170,
6615,
51932,
1089,
2382,
77656,
1670,
22533,
717,
24976,
368,
341,
286,
1077,
2025,
842,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
877,
15,
284,
22611,
792,
486,
931,
21218,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_as() {
use glam::DQuat;
assert_approx_eq!(
DQuat::from_euler(EulerRot::YXZ, 1.0, 2.0, 3.0),
Quat::from_euler(EulerRot::YXZ, 1.0, 2.0, 3.0).as_f64()
);
assert_approx_eq!(
Quat::from_euler(EulerRot::YXZ, 1.0, 2.0, 3.0),
DQuat::from_euler(EulerRot::YXZ, 1.0, 2.0, 3.0).as_f32()
);
} | rust_cleaned_test_functions.jsonl/82008 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 259
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
368,
341,
286,
990,
41012,
486,
35,
2183,
266,
280,
286,
2060,
90425,
10714,
33673,
310,
422,
2183,
266,
486,
1499,
2204,
8479,
10722,
8479,
36936,
486,
56,
55,
57,
11,
220,
16,
13,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_build_status_is_accurate() {
wrapper(|env| {
env.fake_release()
.name("hexponent")
.version("0.3.0")
.create()?;
env.fake_release()
.name("hexponent")
.version("0.2.0")
.build_result_successful(false)
.create()?;
let web = env.frontend();
let status = |version| -> Result<_, failure::Error> {
let page =
kuchiki::parse_html().one(web.get("/crate/hexponent/0.3.0").send()?.text()?);
let selector = format!(r#"ul > li a[href="/crate/hexponent/{}"]"#, version);
let anchor = page
.select(&selector)
.unwrap()
.find(|a| a.text_contents().trim() == version)
.unwrap();
let attributes = anchor.as_node().as_element().unwrap().attributes.borrow();
let classes = attributes.get("class").unwrap();
Ok(classes.split(' ').all(|c| c != "warn"))
};
assert!(status("0.3.0")?);
assert!(!status("0.2.0")?);
Ok(())
})
} | rust_cleaned_test_functions.jsonl/13872 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 733
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20801,
4773,
6892,
14718,
2352,
349,
368,
341,
286,
13261,
22428,
3160,
91,
341,
310,
6105,
94624,
24577,
741,
394,
659,
606,
445,
17308,
1146,
1138,
394,
659,
4366,
445,
15,
13,
18,
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... | 7 |
#[test]
fn test_primitive_array_add() {
let a = Int32Array::from(vec![5, 6, 7, 8, 9]);
let b = Int32Array::from(vec![6, 7, 8, 9, 8]);
let c = add(&a, &b).unwrap();
assert_eq!(11, c.value(0));
assert_eq!(13, c.value(1));
assert_eq!(15, c.value(2));
assert_eq!(17, c.value(3));
assert_eq!(17, c.value(4));
} | rust_cleaned_test_functions.jsonl/17849 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 213
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84087,
3858,
2891,
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,
293,
284,
1333,
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_unary_minus_byte() {
err(
"const m1: byte = -1Y;",
pos(1, 18),
Msg::UnOpType("-".into(), "byte".into()),
);
ok("const m1: int = -1;");
ok("const m1: long = -1L;");
} | rust_cleaned_test_functions.jsonl/106635 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 158
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
658,
38457,
19737,
368,
341,
286,
1848,
1006,
310,
330,
1024,
296,
16,
25,
4922,
284,
481,
16,
56,
64497,
310,
1133,
7,
16,
11,
220,
16,
23,
1326,
310,
24205,
486,
1806,
7125,
929,
136... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_binary_macro() {
use self::binary_macro::*;
assert_eq!( basic( 0 ), 0 );
assert_eq!( method( 1 ), 2 );
assert_eq!( func( 2 ), 4 );
assert_eq!( misc( 3 ), 33 );
} | rust_cleaned_test_functions.jsonl/930 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31761,
58810,
368,
341,
286,
990,
656,
486,
25891,
58810,
56162,
286,
2060,
10714,
10297,
6770,
7,
220,
220,
15,
6882,
220,
220,
15,
1439,
286,
2060,
10714,
10297,
1714,
7,
220,
16,
6882,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_inflation_num_slots_already_activated() {
let GenesisConfigInfo {
mut genesis_config, ..
} = create_genesis_config_with_leader(42, &solana_sdk::pubkey::new_rand(), 42);
let slots_per_epoch = 32;
genesis_config.epoch_schedule = EpochSchedule::new(slots_per_epoch);
let mut bank = Bank::new(&genesis_config);
assert_eq!(bank.get_inflation_num_slots(), 0);
for _ in 0..slots_per_epoch {
bank = new_from_parent(&Arc::new(bank));
}
assert_eq!(bank.get_inflation_num_slots(), slots_per_epoch);
for _ in 0..slots_per_epoch {
bank = new_from_parent(&Arc::new(bank));
}
assert_eq!(bank.get_inflation_num_slots(), 2 * slots_per_epoch);
} | rust_cleaned_test_functions.jsonl/2675 | {
"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,
3062,
1243,
64149,
4273,
54161,
80772,
62,
30162,
368,
341,
286,
1077,
40788,
2648,
1731,
341,
310,
5206,
59366,
5332,
11,
54538,
286,
335,
284,
1855,
16322,
13774,
5332,
6615,
79991,
7,
19,
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... | 3 |
#[test]
fn test_complete_normal() {
let height = 9;
let open_block = generate_block(height);
let path = "test-rocksdb/complete_normal";
let closed_block = generate_closed_block(open_block.clone(), path);
let backlog = Backlog {
priority: Some(Priority::BlockWithProof),
open_block: Some(open_block),
proof: Some(generate_proof(height - 1)),
closed_block: Some(closed_block),
};
assert!(backlog.is_completed());
backlog.complete();
} | rust_cleaned_test_functions.jsonl/62110 | {
"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,
27675,
13973,
368,
341,
286,
1077,
2608,
284,
220,
24,
280,
286,
1077,
1787,
7113,
284,
6923,
7113,
23052,
317,
286,
1077,
1815,
284,
330,
1944,
51934,
14553,
1999,
14,
14737,
13973,
876,
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_from_string_s() {
let d: Duration = DurationString::try_from(String::from("1s")).unwrap().into();
assert_eq!(d, Duration::from_secs(1));
} | rust_cleaned_test_functions.jsonl/97546 | {
"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,
5673,
3904,
643,
368,
341,
286,
1077,
294,
25,
21045,
284,
21045,
703,
486,
1539,
5673,
2242,
486,
1499,
445,
16,
82,
15197,
15454,
1005,
18122,
543,
286,
2060,
10714,
10297,
67,
11,
21045,
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 |
#[test]
fn test_deref() {
let f = TempFile::new().unwrap().into_file();
f.set_len(0x400).unwrap();
let start_addr = GuestAddress(0x0);
let guest_mem = GuestMemoryMmap::from_ranges(&[(start_addr, 0x400)]).unwrap();
let guest_mem_backed_by_file = GuestMemoryMmap::from_ranges_with_files(&[(
start_addr,
0x400,
Some(FileOffset::new(f, 0)),
)])
.unwrap();
let guest_mem_list = vec![guest_mem, guest_mem_backed_by_file];
for guest_mem in guest_mem_list.iter() {
let sample_buf = &[1, 2, 3, 4, 5];
assert_eq!(guest_mem.write(sample_buf, start_addr).unwrap(), 5);
let slice = guest_mem
.find_region(GuestAddress(0))
.unwrap()
.as_volatile_slice()
.unwrap();
let buf = &mut [0, 0, 0, 0, 0];
assert_eq!(slice.read(buf, 0).unwrap(), 5);
assert_eq!(buf, sample_buf);
}
} | rust_cleaned_test_functions.jsonl/63921 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 556
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
43970,
368,
341,
286,
1077,
282,
284,
19944,
1703,
486,
931,
1005,
15454,
1005,
18122,
2458,
543,
286,
282,
980,
6043,
7,
15,
87,
19,
15,
15,
568,
15454,
1428,
286,
1077,
1191,
7387,
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_transform_tpch_q3() {
let c = "SELECT
l_orderkey,
sum(l_extendedprice * (1 - l_discount)) AS revenue,
o_orderdate,
o_shippriority
FROM
customer,
orders,
lineitem
WHERE
c_mktsegment = 'BUILDING'
AND c_custkey = o_custkey
AND l_orderkey = o_orderkey
AND o_orderdate < '1995-03-15'
AND l_shipdate > '1995-03-15'
GROUP BY
l_orderkey,
o_orderdate,
o_shippriority
ORDER BY
revenue DESC,
o_orderdate
LIMIT 10
";
let pairs = BqlParser::parse(Rule::cmd, c)
.unwrap_or_else(|e| panic!("{}", e));
println!("{}", pretty_parse_tree(pairs));
} | rust_cleaned_test_functions.jsonl/76162 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 528
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18449,
55191,
331,
8976,
18,
368,
341,
310,
1077,
272,
284,
330,
4858,
198,
310,
326,
7869,
792,
345,
310,
2629,
2333,
61678,
6555,
353,
320,
16,
481,
326,
42879,
593,
5752,
12957,
345,
310,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_partial_clean() {
solana_logger::setup();
let db = AccountsDb::new(Vec::new(), &ClusterType::Development);
let account_key1 = Pubkey::new_unique();
let account_key2 = Pubkey::new_unique();
let account1 = AccountSharedData::new(1, 0, AccountSharedData::default().owner());
let account2 = AccountSharedData::new(2, 0, AccountSharedData::default().owner());
let account3 = AccountSharedData::new(3, 0, AccountSharedData::default().owner());
let account4 = AccountSharedData::new(4, 0, AccountSharedData::default().owner());
// Store accounts into slots 0 and 1
db.store_uncached(0, &[(&account_key1, &account1)]);
db.store_uncached(0, &[(&account_key2, &account1)]);
db.store_uncached(1, &[(&account_key1, &account2)]);
db.get_accounts_delta_hash(0);
db.get_accounts_delta_hash(1);
db.print_accounts_stats("pre-clean1");
// Checking that the uncleaned_pubkeys are not pre-maturely removed
// delta keys are still there.
db.clean_accounts(None, false, None);
db.print_accounts_stats("post-clean1");
// Check stores > 0
assert!(!slot_stores(&db, 0).is_empty());
assert!(!slot_stores(&db, 1).is_empty());
// root slot 0
db.add_root(0);
// store into slot 2
db.store_uncached(2, &[(&account_key2, &account3)]);
db.store_uncached(2, &[(&account_key1, &account3)]);
db.get_accounts_delta_hash(2);
db.clean_accounts(None, false, None);
db.print_accounts_stats("post-clean2");
// root slots 1
db.add_root(1);
db.clean_accounts(None, false, None);
db.print_accounts_stats("post-clean3");
db.store_uncached(3, &[(&account_key2, &account4)]);
db.get_accounts_delta_hash(3);
db.add_root(3);
// Check that we can clean where max_root=3 and slot=2 is not rooted
db.clean_accounts(None, false, None);
assert!(db.uncleaned_pubkeys.is_empty());
db.print_accounts_stats("post-clean4");
assert!(slot_stores(&db, 0).is_empty());
assert!(!slot_stores(&db, 1).is_empty());
} | rust_cleaned_test_functions.jsonl/7041 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1026
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
52068,
19573,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
2927,
284,
40655,
7994,
486,
931,
49923,
486,
931,
1507,
609,
28678,
929,
486,
39419,
317,
286,
1077,
2692,
3097,
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_scan() {
utils::with_base_dir_of_three_repos(|ref _path| {
// TODO: inject a GitGlobalConfig that takes `path` as its base directory
let result = scan::get_results();
assert!(result.is_ok());
});
} | rust_cleaned_test_functions.jsonl/30650 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28857,
368,
341,
262,
12439,
486,
4197,
7651,
4334,
3575,
50016,
1288,
966,
22428,
1097,
716,
2343,
91,
341,
286,
442,
5343,
25,
15551,
264,
21120,
11646,
2648,
429,
4990,
1565,
2343,
63,
438,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serde() {
let temp = tempdir::TempDir::new("test_serde").expect("Open temp folder error");
let data_dir = Path::new("data/large_data");
let root_dir = temp.path();
let schema_file = Path::new("data/schema.json");
let mut loader =
GraphLoader::<DefaultId, InternalId>::new(&data_dir, &root_dir, &schema_file, 20, 0, 1);
// load whole graph
loader.load().expect("Load graph error");
let graph = loader.into_mutable_graph();
graph.export().expect("Export error!");
let imported_graph = GraphDBConfig::default()
.root_dir(root_dir)
.schema_file(&schema_file)
.open::<DefaultId, InternalId, _, _>()
.expect("Import graph error");
check_graph(&imported_graph);
} | rust_cleaned_test_functions.jsonl/22817 | {
"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,
75861,
450,
368,
341,
286,
1077,
2730,
284,
2730,
3741,
486,
12151,
6184,
486,
931,
445,
1944,
75861,
450,
1827,
17119,
445,
5002,
2730,
8527,
1465,
797,
286,
1077,
821,
4334,
284,
7933,
486,
93... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_recursive_example() {
let root = Packet::from_str(&hex_to_bits("8A004A801A8002F478")).unwrap();
println!("{:?}", root);
assert_eq!(16, root.part1());
} | rust_cleaned_test_functions.jsonl/75410 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
66242,
39304,
368,
341,
286,
1077,
3704,
284,
28889,
486,
1499,
2895,
2099,
17308,
2346,
20034,
445,
23,
32,
15,
15,
19,
32,
23,
15,
16,
32,
23,
15,
15,
17,
37,
19,
22,
23,
15197,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_valid_vm_config_vsock() {
vec![
(
vec![
"cloud-hypervisor",
"--kernel",
"/path/to/kernel",
"--vsock",
"cid=123,socket=/path/to/sock/1",
],
r#"{
"kernel": {"path": "/path/to/kernel"},
"vsock": {"cid": 123, "socket": "/path/to/sock/1"}
}"#,
true,
),
(
vec![
"cloud-hypervisor",
"--kernel",
"/path/to/kernel",
"--vsock",
"cid=124,socket=/path/to/sock/1",
],
r#"{
"kernel": {"path": "/path/to/kernel"},
"vsock": {"cid": 123, "socket": "/path/to/sock/1"}
}"#,
false,
),
#[cfg(target_arch = "x86_64")]
(
vec![
"cloud-hypervisor",
"--kernel",
"/path/to/kernel",
"--vsock",
"cid=123,socket=/path/to/sock/1,iommu=on",
],
r#"{
"kernel": {"path": "/path/to/kernel"},
"vsock": {"cid": 123, "socket": "/path/to/sock/1", "iommu": true},
"iommu": true
}"#,
true,
),
#[cfg(target_arch = "x86_64")]
(
vec![
"cloud-hypervisor",
"--kernel",
"/path/to/kernel",
"--vsock",
"cid=123,socket=/path/to/sock/1,iommu=on",
],
r#"{
"kernel": {"path": "/path/to/kernel"},
"vsock": {"cid": 123, "socket": "/path/to/sock/1", "iommu": true}
}"#,
false,
),
(
vec![
"cloud-hypervisor",
"--kernel",
"/path/to/kernel",
"--vsock",
"cid=123,socket=/path/to/sock/1,iommu=off",
],
r#"{
"kernel": {"path": "/path/to/kernel"},
"vsock": {"cid": 123, "socket": "/path/to/sock/1", "iommu": false}
}"#,
true,
),
]
.iter()
.for_each(|(cli, openapi, equal)| {
compare_vm_config_cli_vs_json(cli, openapi, *equal);
});
} | rust_cleaned_test_functions.jsonl/48725 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1918
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8337,
39008,
5332,
2273,
13199,
368,
341,
286,
7486,
90515,
310,
2399,
394,
7486,
90515,
503,
330,
12361,
2832,
1082,
31396,
756,
503,
14482,
23248,
756,
503,
3521,
2343,
32429,
58343,
756,
503,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_db_restore() {
let (mut env, mut client) = setup_swarm_and_client_proxy(4, 1);
// pre-build tools
workspace_builder::get_bin("db-backup");
workspace_builder::get_bin("db-restore");
workspace_builder::get_bin("db-backup-verify");
client.create_next_account(false).unwrap();
client.create_next_account(false).unwrap();
client
.mint_coins(&["mb", "0", "1000000", "XUS"], true)
.unwrap();
client
.mint_coins(&["mb", "1", "1000000", "XUS"], true)
.unwrap();
client
.transfer_coins(&["tb", "0", "1", "1", "XUS"], true)
.unwrap();
assert!(compare_balances(
vec![(999999.0, "XUS".to_string())],
client.get_balances(&["b", "0"]).unwrap(),
));
assert!(compare_balances(
vec![(1000001.0, "XUS".to_string())],
client.get_balances(&["b", "1"]).unwrap(),
));
// start thread to transfer money from account 0 to account 1
let accounts = client.copy_all_accounts();
let transfer_quit = Arc::new(AtomicBool::new(false));
let transfer_quit_clone = transfer_quit.clone();
let transfer_thread = std::thread::spawn(|| {
transfer_and_reconfig(client, 999999.0, 1000001.0, transfer_quit_clone)
});
// make a backup from node 1
let (node1_config, _) = load_node_config(&env.validator_swarm, 1);
let backup_path = db_backup(
node1_config.storage.backup_service_address.port(),
1,
50,
20,
40,
&[],
);
// take down node 0
env.validator_swarm.kill_node(0);
// nuke db
let (mut node0_config, _) = load_node_config(&env.validator_swarm, 0);
let genesis_waypoint = node0_config.base.waypoint.genesis_waypoint();
insert_waypoint(&mut node0_config, genesis_waypoint);
save_node_config(&mut node0_config, &env.validator_swarm, 0);
let db_dir = node0_config.storage.dir();
fs::remove_dir_all(db_dir.join("diemdb")).unwrap();
fs::remove_dir_all(db_dir.join("consensusdb")).unwrap();
// restore db from backup
db_restore(backup_path.path(), db_dir.as_path(), &[]);
// start node 0 on top of restored db
env.validator_swarm.start_node(0).unwrap();
// stop transferring
transfer_quit.store(true, Ordering::Relaxed);
let transferred = transfer_thread.join().unwrap();
// verify it's caught up
assert!(env.validator_swarm.wait_for_all_nodes_to_catchup());
let mut client0 = env.get_validator_client(0, None);
client0.set_accounts(accounts);
assert!(compare_balances(
vec![(999999.0 - transferred, "XUS".to_string())],
client0.get_balances(&["b", "0"]).unwrap(),
));
} | rust_cleaned_test_functions.jsonl/102620 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1166
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8685,
62677,
368,
341,
262,
1077,
320,
6984,
6105,
11,
5206,
2943,
8,
284,
6505,
32581,
2178,
8378,
8179,
29712,
7,
19,
11,
220,
16,
626,
262,
442,
855,
32145,
7375,
198,
262,
27514,
28532,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_compile_options_set_binding_base() {
let mut c = Compiler::new().unwrap();
let mut options = CompileOptions::new().unwrap();
options.set_auto_bind_uniforms(true);
options.set_binding_base(ResourceKind::Image, 44);
let result = c
.compile_into_spirv_assembly(
UNIFORMS_NO_BINDINGS,
ShaderKind::Vertex,
"shader.glsl",
"main",
Some(&options),
)
.unwrap()
.as_text();
assert!(result.contains("OpDecorate %my_tex Binding 0"));
assert!(result.contains("OpDecorate %my_sam Binding 1"));
assert!(result.contains("OpDecorate %my_img Binding 44"));
assert!(result.contains("OpDecorate %my_imbuf Binding 45"));
assert!(result.contains("OpDecorate %my_ubo Binding 2"));
} | rust_cleaned_test_functions.jsonl/41070 | {
"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,
74170,
8743,
2602,
60815,
7651,
368,
341,
286,
1077,
5206,
272,
284,
45631,
486,
931,
1005,
15454,
543,
286,
1077,
5206,
2606,
284,
54467,
3798,
486,
931,
1005,
15454,
543,
286,
2606,
980,
27740,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_wrong_insert() {
let pool = Pool::new(DATABASE_URL.as_str());
let done = pool.get_handle().and_then(|c| {
let block = Block::new();
c.insert("unexisting", block)
});
run(done).unwrap_err();
let info = pool.info();
assert_eq!(info.ongoing, 0);
assert_eq!(info.tasks_len, 0);
assert_eq!(info.idle_len, 0);
} | rust_cleaned_test_functions.jsonl/62526 | {
"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,
75198,
17678,
368,
341,
286,
1077,
7314,
284,
22728,
486,
931,
5432,
19878,
8000,
5357,
2895,
5231,
286,
1077,
2814,
284,
7314,
670,
10630,
1005,
437,
68367,
22428,
66,
91,
341,
310,
1077,
2504,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_destroy_input_stream_after_unplugging_a_nondefault_input_device() {
test_unplug_a_device_on_an_active_stream(StreamType::INPUT, Scope::Input, false, 0);
} | rust_cleaned_test_functions.jsonl/23852 | {
"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,
18066,
5898,
12673,
19844,
4907,
500,
35268,
4306,
21637,
2258,
5898,
9204,
368,
341,
262,
1273,
4907,
47474,
4306,
9204,
4470,
12008,
12930,
12673,
52011,
929,
486,
29421,
11,
34920,
486,
2505,
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 |
#[test]
fn test_iter() {
let mut d = VecDeque::new();
assert_eq!(d.iter().next(), None);
assert_eq!(d.iter().size_hint(), (0, Some(0)));
for i in 0..5 {
d.push_back(i);
}
{
let b: &[_] = &[&0, &1, &2, &3, &4];
assert_eq!(d.iter().collect::<Vec<_>>(), b);
}
for i in 6..9 {
d.push_front(i);
}
{
let b: &[_] = &[&8, &7, &6, &0, &1, &2, &3, &4];
assert_eq!(d.iter().collect::<Vec<_>>(), b);
}
let mut it = d.iter();
let mut len = d.len();
loop {
match it.next() {
None => break,
_ => {
len -= 1;
assert_eq!(it.size_hint(), (len, Some(len)))
}
}
}
} | rust_cleaned_test_functions.jsonl/73702 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 446
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
368,
341,
262,
1077,
5206,
294,
284,
11312,
73891,
486,
931,
543,
262,
2060,
10714,
10297,
67,
19471,
1005,
3600,
1507,
2240,
317,
262,
2060,
10714,
10297,
67,
19471,
1005,
2141,
45825,
150... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_expand_selected_area_x_left() {
// before
// 1 a b c
// 2 d |e| f
// after
// 1 a b c
// 2 |d e| f
let mut component = TableComponent::new(KeyConfig::default());
component.headers = vec!["1", "2", "3"].iter().map(|h| h.to_string()).collect();
component.rows = vec![
vec!["a", "b", "c"].iter().map(|h| h.to_string()).collect(),
vec!["d", "e", "f"].iter().map(|h| h.to_string()).collect(),
];
component.selected_row.select(Some(1));
component.selected_column = 1;
component.expand_selected_area_x(false);
assert_eq!(component.selection_area_corner, Some((0, 1)));
assert_eq!(component.selected_cells(), Some("d,e".to_string()));
} | rust_cleaned_test_functions.jsonl/120816 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 415
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67875,
23755,
15030,
3212,
9579,
368,
341,
286,
442,
1573,
8945,
286,
442,
220,
16,
220,
264,
220,
293,
220,
272,
198,
286,
442,
220,
17,
220,
294,
760,
68,
91,
282,
271,
286,
442,
1283,
894... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_4digits() {
let value: u32 = 0x31_32_33_34;
#[cfg(feature = "power-of-two")]
assert!(!algorithm::is_4digits::<{ from_radix(4) }>(value));
#[cfg(feature = "radix")]
assert!(algorithm::is_4digits::<{ from_radix(5) }>(value));
assert!(algorithm::is_4digits::<{ STANDARD }>(value));
let value: u32 = 0x29_30_39_38;
assert!(!algorithm::is_4digits::<{ STANDARD }>(value));
let value: u32 = 0x31_32_33_40;
assert!(!algorithm::is_4digits::<{ STANDARD }>(value));
let value: u32 = 0x31_32_33_39;
#[cfg(feature = "radix")]
assert!(!algorithm::is_4digits::<{ from_radix(9) }>(value));
assert!(algorithm::is_4digits::<{ STANDARD }>(value));
} | rust_cleaned_test_functions.jsonl/41532 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 338
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
62,
19,
60770,
368,
341,
262,
1077,
897,
25,
575,
18,
17,
284,
220,
15,
87,
18,
16,
62,
18,
17,
62,
18,
18,
62,
18,
19,
280,
262,
11506,
14072,
27062,
284,
330,
13175,
8668,
37402,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_recv_msg_beat() {
let l = default_logger();
let mut tests = vec![
(StateRole::Leader, 2),
// candidate and follower should ignore MsgBeat
(StateRole::Candidate, 0),
(StateRole::Follower, 0),
];
for (i, (state, w_msg)) in tests.drain(..).enumerate() {
let store = MemStorage::new_with_conf_state((vec![1, 2, 3], vec![]));
let ents = &[empty_entry(0, 1), empty_entry(1, 2)];
store.wl().append(ents).unwrap();
let mut sm = new_test_raft(1, vec![1, 2, 3], 10, 1, store, &l);
sm.state = state;
sm.step(new_message(1, 1, MessageType::MsgBeat, 0))
.expect("");
let msgs = sm.read_messages();
if msgs.len() != w_msg {
panic!("#{}: msg count = {}, want {}", i, msgs.len(), w_msg);
}
for m in msgs {
if m.get_msg_type() != MessageType::MsgHeartbeat {
panic!(
"#{}: msg.type = {:?}, want {:?}",
i,
m.get_msg_type(),
MessageType::MsgHeartbeat
);
}
}
}
} | rust_cleaned_test_functions.jsonl/19133 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 631
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36118,
6483,
21263,
266,
368,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
1077,
5206,
7032,
284,
7486,
90515,
286,
320,
1397,
9030,
486,
52621,
11,
220,
17,
1326,
286,
442,
9144,
323,
48207... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_mul_assign() {
let mut v1 = Vec3::new(1.0f64, 2.0f64, 3.0f64);
let v2 = Vec3::new(2.0f64, 4.0f64, 6.0f64);
v1 *= 2f64;
assert_eq!(v1, v2);
} | rust_cleaned_test_functions.jsonl/120483 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24944,
20688,
368,
972,
286,
1077,
5206,
348,
16,
284,
11312,
18,
486,
931,
7,
16,
13,
15,
69,
21,
19,
11,
220,
17,
13,
15,
69,
21,
19,
11,
220,
18,
13,
15,
69,
21,
19,
736,
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_reach_prediction_threshold() {
let mut sync_layer = SyncLayer::<Vec<u8>>::new(2, std::mem::size_of::<u32>(), 8);
for i in 0..20 {
let serialized_input = bincode::serialize(&i).unwrap();
let game_input = GameInput::new(i, std::mem::size_of::<u32>(), serialized_input);
sync_layer.add_local_input(0, game_input).unwrap(); // should crash at frame 7
}
} | rust_cleaned_test_functions.jsonl/46405 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 205
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
610,
51446,
21858,
368,
341,
286,
1077,
5206,
12811,
12680,
284,
28937,
9188,
27638,
10050,
34837,
23,
77595,
931,
7,
17,
11,
1460,
486,
10536,
486,
2141,
3575,
27638,
84,
18,
17,
39019,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_eq_dyn_bool_scalar() {
let array = BooleanArray::from(vec![true, false, true]);
let a_eq = eq_dyn_bool_scalar(&array, false).unwrap();
assert_eq!(
a_eq,
BooleanArray::from(vec![Some(false), Some(true), Some(false)])
);
} | rust_cleaned_test_functions.jsonl/98244 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 158
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10714,
69213,
22159,
41652,
368,
341,
286,
1077,
1334,
284,
6992,
1857,
486,
1499,
25592,
20703,
1866,
11,
895,
11,
830,
2558,
286,
1077,
264,
10714,
284,
8939,
69213,
22159,
41652,
2099,
1653,
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_groups_large_interval() {
let dates = &[
NaiveDate::from_ymd(2020, 1, 1),
NaiveDate::from_ymd(2020, 1, 11),
NaiveDate::from_ymd(2020, 1, 12),
NaiveDate::from_ymd(2020, 1, 13),
];
let ts = dates
.iter()
.map(|d| d.and_hms(0, 0, 0).timestamp_nanos())
.collect::<Vec<_>>();
let dur = Duration::parse("2d");
let w = Window::new(Duration::parse("2d"), dur.clone(), Duration::from_nsecs(0));
let (groups, _, _) = groupby_windows(w, &ts, false, ClosedWindow::Both, TimeUnit::Nanoseconds);
assert_eq!(groups.len(), 4);
assert_eq!(groups[0], [0, 1]);
assert_eq!(groups[1], [1, 1]);
assert_eq!(groups[2], [1, 3]);
assert_eq!(groups[3], [3, 1]);
let (groups, _, _) = groupby_windows(w, &ts, false, ClosedWindow::Left, TimeUnit::Nanoseconds);
assert_eq!(groups.len(), 3);
assert_eq!(groups[2], [3, 1]);
let (groups, _, _) = groupby_windows(w, &ts, false, ClosedWindow::Right, TimeUnit::Nanoseconds);
assert_eq!(groups.len(), 2);
assert_eq!(groups[1], [2, 2]);
} | rust_cleaned_test_functions.jsonl/58720 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 516
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21148,
45228,
20541,
368,
341,
262,
1077,
12713,
284,
609,
9640,
286,
12812,
533,
1916,
486,
1499,
62,
1600,
67,
7,
17,
15,
17,
15,
11,
220,
16,
11,
220,
16,
1326,
286,
12812,
533,
1916,
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_manage_mode_when_lock_script_not_exist_in_inputs() {
let mut test_params = get_correct_params();
test_params.owner_lock_hash = [0u8; 32];
let mut mock = generate_correct_mock(test_params);
mock.expect_load_cell_lock_hash()
.times(1)
.returning(move |_, _| Err(SysError::IndexOutOfBound));
let adapter = ChainAdapter { chain: mock };
_verify(adapter);
} | rust_cleaned_test_functions.jsonl/23545 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 176
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56473,
7302,
47636,
9818,
14660,
7913,
35906,
1243,
28557,
368,
341,
262,
1077,
5206,
1273,
6745,
284,
633,
31550,
6745,
543,
262,
1273,
6745,
25688,
9818,
8950,
284,
508,
15,
84,
23,
26,
220,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_modn() {
assert_eq!(
ExponentP256::modn(Int256::ZERO),
ExponentP256 { int: Int256::ZERO }
);
assert_eq!(
ExponentP256::modn(Int256::ONE),
ExponentP256 { int: Int256::ONE }
);
assert_eq!(
ExponentP256::modn(N_MIN_1_INT),
ExponentP256 { int: N_MIN_1_INT }
);
assert_eq!(
ExponentP256::modn(Int256::N),
ExponentP256 { int: Int256::ZERO }
);
} | rust_cleaned_test_functions.jsonl/101330 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 316
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7480,
77,
368,
341,
286,
2060,
10714,
33673,
310,
1374,
1146,
47,
17,
20,
21,
486,
2593,
77,
24123,
17,
20,
21,
486,
73956,
1326,
310,
1374,
1146,
47,
17,
20,
21,
314,
526,
25,
1333,
17,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_build_parsed_datetime_interval_errors() {
use DateTimeField::*;
let test_cases = [
(
"1 year 2 years",
Second,
"YEAR field set twice",
),
(
"1-2 3-4",
Second,
"YEAR or MONTH field set twice",
),
(
"1-2 3 year",
Second,
"YEAR field set twice",
),
(
"1-2 3",
Month,
"MONTH field set twice",
),
(
"1-2 3:4 5",
Second,
"SECOND field set twice",
),
(
"1:2:3.4 5-6 7",
Year,
"YEAR field set twice",
),
(
"-:::::1.27",
Second,
"have unprocessed tokens 1.270000000",
),
(
"-1 ::.27",
Second,
"Cannot determine format of all parts. Add explicit time components, e.g. \
INTERVAL '1 day' or INTERVAL '1' DAY",
),
(
"1:2:3.4.5",
Second,
"have unprocessed tokens .500000000",
),
(
"1+2:3.4",
Second,
"Cannot determine format of all parts",
),
(
"1x2:3.4",
Second,
"unknown units x",
),
(
"0 foo",
Second,
"unknown units foo",
),
(
"1-2 3:4 5 second",
Second,
"SECOND field set twice",
),
(
"1-2 5 second 3:4",
Second,
"HOUR, MINUTE, SECOND field set twice",
),
(
"1 2-3 4:5",
Day,
"Cannot determine format of all parts. Add explicit time components, e.g. \
INTERVAL '1 day' or INTERVAL '1' DAY",
),
(
"9223372036854775808 months",
Day,
"Unable to parse value as a number at index 19: number too large to fit in target type",
),
(
"-9223372036854775808 months",
Day,
"Unable to parse value as a number at index 20: number too large to fit in target type",
),
(
"9223372036854775808 seconds",
Day,
"Unable to parse value as a number at index 19: number too large to fit in target type",
),
(
"-9223372036854775808 seconds",
Day,
"Unable to parse value as a number at index 20: number too large to fit in target type",
),
(
"1.234 second 5 ms",
Second,
"Cannot set MILLISECONDS or MICROSECONDS field if SECOND field has a fraction component",
),
(
"1.234 second 5 us",
Second,
"Cannot set MILLISECONDS or MICROSECONDS field if SECOND field has a fraction component",
),
(
"7 ms 4.321 second",
Second,
"Cannot set MILLISECONDS or MICROSECONDS field if SECOND field has a fraction component",
),
(
"7 us 4.321 second",
Second,
"Cannot set MILLISECONDS or MICROSECONDS field if SECOND field has a fraction component",
),
];
for test in test_cases.iter() {
match ParsedDateTime::build_parsed_datetime_interval(test.0, None, test.1) {
Err(e) => assert_eq!(e.to_string(), test.2),
Ok(pdt) => panic!(
"Test INTERVAL '{}' {} passed when expected to fail with {}, generated ParsedDateTime {:?}",
test.0,
test.1,
test.2,
pdt,
),
}
}
} | rust_cleaned_test_functions.jsonl/100334 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2719
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20801,
75788,
28943,
20541,
20196,
368,
341,
286,
990,
6520,
1877,
56162,
286,
1077,
1273,
41427,
284,
2278,
310,
2399,
394,
330,
16,
1042,
220,
17,
1635,
756,
394,
10440,
345,
394,
330,
87201,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_args_iter_unsorted() {
static ARGS: [ArgInfo; 2] = [flag!("-foo"), flag!("-bar")];
ArgsIter::new(Vec::<OsString>::new().into_iter(), &ARGS[..]);
} | rust_cleaned_test_functions.jsonl/108782 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 106
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8384,
11723,
4907,
28298,
368,
341,
310,
1099,
84149,
25,
508,
2735,
1731,
26,
220,
17,
60,
284,
508,
9903,
0,
13645,
7975,
3975,
5181,
0,
13645,
2257,
899,
935,
310,
17693,
8537,
486,
931,
49... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_as_path_segment() {
let as_path_bytes = &[
0x02, 0x04, 0x00, 0x00, 0x9a, 0x74, 0x00, 0x00, 0xdf, 0x1e, 0x00, 0x00, 0x20, 0x1a,
0x00, 0x00, 0x78, 0xfc,
];
let ctx = &ParserContext::new().four_octet_asn(true).nlri_mode(Ipv6);
let result = &ASPathAttribute::from_wire(ctx, as_path_bytes).unwrap();
let expected_aspath: Vec<u32> = vec![39540, 57118, 8218, 30972];
assert_eq!(result.1.segments.len(), 1);
assert!(result.1.segments[0].ordered);
assert_eq!(result.1.segments[0].path, expected_aspath);
let wire = result.1.to_wire(ctx).unwrap();
assert_eq!(wire, as_path_bytes);
} | rust_cleaned_test_functions.jsonl/49687 | {
"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,
11898,
2638,
28061,
368,
341,
286,
1077,
438,
2638,
12524,
284,
609,
9640,
310,
220,
15,
87,
15,
17,
11,
220,
15,
87,
15,
19,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_identifiers() {
let v: () = super::decode("null").unwrap();
assert_eq!(v, ());
let v: bool = super::decode("true").unwrap();
assert_eq!(v, true);
let v: bool = super::decode("false").unwrap();
assert_eq!(v, false);
} | rust_cleaned_test_functions.jsonl/6542 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 145
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
38399,
11836,
368,
341,
286,
1077,
348,
25,
1719,
284,
2256,
486,
18196,
445,
2921,
1827,
15454,
543,
286,
2060,
10714,
10297,
85,
11,
89684,
286,
1077,
348,
25,
1807,
284,
2256,
486,
181... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reconstruct_historical_roots() {
{
let db = AccountsDb::default_for_tests();
let historical_roots = vec![];
let historical_roots_with_hash = vec![];
reconstruct_historical_roots(&db, historical_roots, historical_roots_with_hash);
let roots_tracker = db.accounts_index.roots_tracker.read().unwrap();
assert!(roots_tracker.historical_roots.is_empty());
}
{
let db = AccountsDb::default_for_tests();
let historical_roots = vec![1];
let historical_roots_with_hash = vec![(0, Hash::default())];
reconstruct_historical_roots(&db, historical_roots, historical_roots_with_hash);
let roots_tracker = db.accounts_index.roots_tracker.read().unwrap();
assert_eq!(roots_tracker.historical_roots.get_all(), vec![0, 1]);
}
{
let db = AccountsDb::default_for_tests();
let historical_roots = vec![2, 1];
let historical_roots_with_hash = vec![0, 5]
.into_iter()
.map(|slot| (slot, Hash::default()))
.collect();
reconstruct_historical_roots(&db, historical_roots, historical_roots_with_hash);
let roots_tracker = db.accounts_index.roots_tracker.read().unwrap();
assert_eq!(roots_tracker.historical_roots.get_all(), vec![0, 1, 2, 5]);
}
} | rust_cleaned_test_functions.jsonl/74013 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 578
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
7596,
1523,
95698,
26608,
2412,
368,
341,
262,
341,
286,
1077,
2927,
284,
40655,
7994,
486,
2258,
5478,
32509,
543,
286,
1077,
13656,
26608,
2412,
284,
7486,
0,
15078,
286,
1077,
13656,
2660... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_candidate_for_shrink() {
solana_logger::setup();
let mut accounts = AccountsDb::new_single();
let dummy_path = Path::new("");
let dummy_size = 2 * PAGE_SIZE;
let entry = Arc::new(AccountStorageEntry::new(dummy_path, 0, 1, dummy_size));
match accounts.shrink_ratio {
AccountShrinkThreshold::TotalSpace { shrink_ratio } => {
assert_eq!(
(DEFAULT_ACCOUNTS_SHRINK_RATIO * 100.) as u64,
(shrink_ratio * 100.) as u64
)
}
AccountShrinkThreshold::IndividalStore { shrink_ratio: _ } => {
panic!("Expect the default to be TotalSpace")
}
}
entry.alive_bytes.store(3000, Ordering::Relaxed);
assert!(accounts.is_candidate_for_shrink(&entry));
entry.alive_bytes.store(5000, Ordering::Relaxed);
assert!(!accounts.is_candidate_for_shrink(&entry));
accounts.shrink_ratio = AccountShrinkThreshold::TotalSpace { shrink_ratio: 0.3 };
entry.alive_bytes.store(3000, Ordering::Relaxed);
assert!(accounts.is_candidate_for_shrink(&entry));
accounts.shrink_ratio = AccountShrinkThreshold::IndividalStore { shrink_ratio: 0.3 };
assert!(!accounts.is_candidate_for_shrink(&entry));
} | rust_cleaned_test_functions.jsonl/1439 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 646
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
62360,
5478,
3712,
34365,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
1428,
286,
1077,
5206,
9618,
284,
40655,
7994,
486,
931,
19487,
543,
286,
1077,
17292,
2638,
284,
7933,
486,
931,
1305... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_formatted_number_too_large() {
let cf = CoordinateFormat::new(4, 5);
let d = CoordinateNumber { nano: 12345000000 }.gerber(&cf);
assert!(d.is_err());
} | rust_cleaned_test_functions.jsonl/16456 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
86610,
5500,
2346,
78,
45228,
368,
341,
286,
1077,
24111,
284,
41035,
4061,
486,
931,
7,
19,
11,
220,
20,
317,
286,
1077,
294,
284,
41035,
2833,
314,
50493,
25,
220,
16,
17,
18,
19,
20,
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_checkout_moves_head_to_branch_not_commit() -> BitResult<()> {
BitRepo::with_sample_repo_no_sym(|repo| {
// HEAD should resolve to a branch
bit_checkout!(repo: "HEAD")?;
assert!(repo.read_head()?.is_symbolic());
bit_checkout!(repo: "HEAD^")?;
assert!(repo.is_head_detached()?);
assert_eq!(
repo.read_head()?,
BitRef::Direct("6b5041d58b7ac78bad7be3b727ba605a82a94b25".into())
);
bit_checkout!(repo: "master")?;
let head = repo.read_head()?;
assert!(head.is_symbolic());
// the symbolic reference should be expanded
assert_eq!(head, symbolic_ref!("refs/heads/master"));
Ok(())
})
} | rust_cleaned_test_functions.jsonl/62938 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 386
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68186,
45390,
13138,
2346,
28031,
7913,
36346,
368,
1464,
6495,
2077,
71698,
341,
262,
6495,
25243,
486,
4197,
17491,
37784,
6536,
26825,
22428,
23476,
91,
341,
286,
442,
33080,
1265,
8830,
311,
264... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
#[test]
fn test_repeated_nested_schema() -> Result<()> {
let mut arrow_fields = Vec::new();
{
arrow_fields.push(Field::new("leaf1", DataType::Int32, true));
let inner_group_list = Field::new(
"innerGroup",
DataType::List(Box::new(Field::new(
"innerGroup",
DataType::Struct(vec![Field::new("leaf3", DataType::Int32, true)]),
true,
))),
true,
);
let outer_group_list = Field::new(
"outerGroup",
DataType::List(Box::new(Field::new(
"outerGroup",
DataType::Struct(vec![
Field::new("leaf2", DataType::Int32, true),
inner_group_list,
]),
true,
))),
true,
);
arrow_fields.push(outer_group_list);
}
let message_type = "
message test_schema {
OPTIONAL INT32 leaf1;
REPEATED GROUP outerGroup {
OPTIONAL INT32 leaf2;
REPEATED GROUP innerGroup {
OPTIONAL INT32 leaf3;
}
}
}
";
let parquet_schema = SchemaDescriptor::try_from_message(message_type)?;
let converted_arrow_schema = parquet_to_arrow_schema(&parquet_schema, &None)?;
let converted_fields = converted_arrow_schema.fields();
assert_eq!(arrow_fields.len(), converted_fields.len());
for i in 0..arrow_fields.len() {
assert_eq!(arrow_fields[i], converted_fields[i]);
}
Ok(())
} | rust_cleaned_test_functions.jsonl/34426 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 975
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
41954,
66279,
25371,
368,
1464,
5714,
71698,
341,
286,
1077,
5206,
17921,
12132,
284,
11312,
486,
931,
543,
286,
341,
310,
17921,
12132,
2552,
57788,
486,
931,
445,
24153,
16,
497,
33172,
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... | 4 |
#[test]
fn test_from_null_value() {
assert_eq!(
AMQPValue::try_from(&Value::Null, AMQPType::Void),
Some(AMQPValue::Void)
);
} | rust_cleaned_test_functions.jsonl/115693 | {
"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,
5673,
15162,
3142,
368,
341,
286,
2060,
10714,
33673,
310,
6769,
66520,
1130,
486,
1539,
5673,
2099,
1130,
486,
3280,
11,
6769,
66520,
929,
486,
35882,
1326,
310,
4329,
7,
1402,
66520,
1130,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_sdt() {
let mut sdt = SDT::new(*b"TEST", 40, 1, *b"CROSVM", *b"TESTTEST", 1);
let sum: u8 = sdt
.as_slice()
.iter()
.fold(0u8, |acc, x| acc.wrapping_add(*x));
assert_eq!(sum, 0);
sdt.write(36, 0x12345678 as u32);
let sum: u8 = sdt
.as_slice()
.iter()
.fold(0u8, |acc, x| acc.wrapping_add(*x));
assert_eq!(sum, 0);
} | rust_cleaned_test_functions.jsonl/41161 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 287
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
8047,
368,
341,
286,
1077,
5206,
274,
8047,
284,
8030,
51,
486,
931,
4071,
65,
1,
10033,
497,
220,
19,
15,
11,
220,
16,
11,
353,
65,
46316,
33439,
11187,
497,
353,
65,
1,
10033,
10033,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_single() {
struct Entry;
impl Debug for Entry {
fn fmt(&self, fmt: &mut Formatter) {
fmt.debug_map().entry(&"bar", &true).finish()
}
}
struct KeyValue;
impl Debug for KeyValue {
fn fmt(&self, fmt: &mut Formatter) {
fmt.debug_map().key(&"bar").value(&true).finish()
}
}
assert_eq!(debug3::pprint(Entry), debug3::pprint(KeyValue));
assert_eq!("{\"bar\": true}", debug3::pprint(Entry));
} | rust_cleaned_test_functions.jsonl/124753 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 291
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19487,
368,
341,
286,
2036,
15788,
401,
286,
11605,
11091,
369,
15788,
341,
310,
5168,
8879,
2099,
721,
11,
8879,
25,
609,
6984,
81387,
8,
341,
394,
8879,
7883,
5376,
1005,
4085,
2099,
1,
2257,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rchunks_exactator() {
let v = &[1, 2, 3, 4, 5];
assert_eq!(v.rchunks_exact(2).len(), 2);
let chunks: &[&[_]] = &[&[4, 5], &[2, 3]];
assert_eq!(v.rchunks_exact(2).collect::<Vec<_>>(), chunks);
let chunks: &[&[_]] = &[&[3, 4, 5]];
assert_eq!(v.rchunks_exact(3).collect::<Vec<_>>(), chunks);
let chunks: &[&[_]] = &[];
assert_eq!(v.rchunks_exact(6).collect::<Vec<_>>(), chunks);
let chunks: &[&[_]] = &[&[2, 3], &[4, 5]];
assert_eq!(v.rchunks_exact(2).rev().collect::<Vec<_>>(), chunks);
} | rust_cleaned_test_functions.jsonl/12907 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 290
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
84263,
71084,
850,
368,
341,
262,
1077,
348,
284,
44590,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
4821,
262,
2060,
10714,
10297,
85,
1746,
84263,
71084,
7,
17,
568,
2892... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tap_test_builder_with_no_name() {
let bad_tap_test = TapTestBuilder::new().passed(true).finalize();
let expected = "A test has no name";
assert_eq!(bad_tap_test.name, expected);
} | rust_cleaned_test_functions.jsonl/74997 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
391,
4452,
28532,
6615,
6536,
1269,
368,
341,
286,
1077,
3873,
528,
391,
4452,
284,
36134,
2271,
3297,
486,
931,
1005,
35422,
3715,
568,
94405,
1428,
286,
1077,
3601,
284,
330,
32,
1273,
70... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_zero_distance() {
let metrics = DisplayMetrics::new(
Size { width: 100.0, height: 100.0 },
None,
Some(ViewingDistance::Unknown),
None,
);
let second_metrics =
DisplayMetrics::new(Size { width: 100.0, height: 100.0 }, None, None, None);
assert_eq!(metrics.width_in_pips(), second_metrics.width_in_pips());
assert_eq!(metrics.height_in_pips(), second_metrics.height_in_pips());
} | rust_cleaned_test_functions.jsonl/38012 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 246
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19359,
19464,
368,
341,
286,
1077,
16734,
284,
10623,
27328,
486,
931,
1006,
310,
8478,
314,
2374,
25,
220,
16,
15,
15,
13,
15,
11,
2608,
25,
220,
16,
15,
15,
13,
15,
1153,
310,
2240,
345,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_remote_falling_back_to_peer_addr() {
let mut request = build_test_request();
request.peer_addr = Some("127.0.0.1:8000".into());
assert_eq!(request.forwarded_for(), None);
assert_eq!(request.remote(), Some("127.0.0.1:8000".into()));
} | rust_cleaned_test_functions.jsonl/49024 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 133
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36425,
761,
16740,
3895,
2346,
45159,
7387,
368,
341,
286,
1077,
5206,
1681,
284,
1936,
4452,
7893,
543,
286,
1681,
72864,
7387,
284,
4329,
445,
16,
17,
22,
13,
15,
13,
15,
13,
16,
25,
23,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_destroy_state() {
let name = setup_env();
let s = match State::load_else_create(&name) {
Ok(s) => s,
Err(e) => {
println!("load_else_create failed! {:?}", e);
return;
}
};
drop(s);
destroy_state(&name);
let _ = State::load(&name).unwrap();
} | rust_cleaned_test_functions.jsonl/55493 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18066,
4387,
368,
341,
10217,
829,
284,
6505,
15879,
543,
10217,
274,
284,
2432,
3234,
486,
1078,
62628,
8657,
2099,
606,
8,
341,
197,
197,
11578,
1141,
8,
589,
274,
345,
197,
197,
7747,
2026,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_reads_returns_event_if_source_has_at_least_one_event() {
const EVENT: InternalEvent = InternalEvent::Event(Event::Resize(10, 10));
let source = FakeSource::with_events(&[EVENT]);
let mut reader = InternalEventReader {
events: VecDeque::new(),
source: Some(Box::new(source)),
};
assert_eq!(reader.read(&InternalEventFilter).unwrap(), EVENT);
} | rust_cleaned_test_functions.jsonl/101475 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66628,
58900,
6748,
11119,
10347,
21778,
3752,
88716,
11667,
6748,
368,
341,
286,
733,
12742,
25,
15412,
1556,
284,
15412,
1556,
486,
1556,
30469,
486,
30561,
7,
16,
15,
11,
220,
16,
15,
3237,
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_swap_front_back_remove() {
fn test(back: bool) {
// This test checks that every single combination of tail position and length is tested.
// Capacity 15 should be large enough to cover every case.
let mut tester = VecDeque::with_capacity(15);
let usable_cap = tester.capacity();
let final_len = usable_cap / 2;
for len in 0..final_len {
let expected: VecDeque<_> = if back {
(0..len).collect()
} else {
(0..len).rev().collect()
};
for tail_pos in 0..usable_cap {
tester.tail = tail_pos;
tester.head = tail_pos;
if back {
for i in 0..len * 2 {
tester.push_front(i);
}
for i in 0..len {
assert_eq!(tester.swap_remove_back(i), Some(len * 2 - 1 - i));
}
} else {
for i in 0..len * 2 {
tester.push_back(i);
}
for i in 0..len {
let idx = tester.len() - 1 - i;
assert_eq!(tester.swap_remove_front(idx), Some(len * 2 - 1 - i));
}
}
assert!(tester.tail < tester.cap());
assert!(tester.head < tester.cap());
assert_eq!(tester, expected);
}
}
}
test(true);
test(false);
} | rust_cleaned_test_functions.jsonl/3004 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1076
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40991,
22926,
3895,
18193,
368,
341,
286,
5168,
1273,
58092,
25,
1807,
8,
341,
310,
442,
1096,
1273,
12341,
429,
1449,
3175,
10601,
315,
9787,
2309,
323,
3084,
374,
12510,
624,
310,
442,
40110,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 9 |
#[test]
fn test_is_whitespace() {
assert!("".is_whitespace());
assert!(" ".is_whitespace());
assert!("\u2009".is_whitespace()); // Thin space
assert!(" \n\t ".is_whitespace());
assert!(!" _ ".is_whitespace());
} | rust_cleaned_test_functions.jsonl/56820 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 135
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
86175,
368,
341,
286,
2060,
17223,
3263,
285,
86175,
1423,
286,
2060,
17223,
5933,
285,
86175,
1423,
286,
2060,
0,
4921,
84,
17,
15,
15,
24,
3263,
285,
86175,
13426,
442,
69622,
3550,
198,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_attach_legacy_devices_without_uart() {
let mut vmm = create_vmm_object(InstanceState::Uninitialized);
assert!(vmm.init_guest_memory().is_ok());
assert!(vmm.guest_memory.is_some());
let guest_mem = vmm.guest_memory.clone().unwrap();
let device_manager = MMIODeviceManager::new(
guest_mem.clone(),
&mut (arch::get_reserved_mem_addr() as u64),
(arch::IRQ_BASE, arch::IRQ_MAX),
);
vmm.mmio_device_manager = Some(device_manager);
vmm.default_kernel_config(None);
vmm.setup_interrupt_controller()
.expect("Failed to setup interrupt controller");
assert!(vmm.attach_legacy_devices().is_ok());
let kernel_config = vmm.kernel_config.as_mut();
let dev_man = vmm.mmio_device_manager.as_ref().unwrap();
// reserved for attaching MMIO devices for measuring boot time.
assert!(dev_man
.bus
.get_device(arch::get_reserved_mem_addr() as u64)
.is_none());
assert!(dev_man
.get_device_info()
.get(&(DeviceType::Serial, "uart".to_string()))
.is_none());
assert!(dev_man
.get_device_info()
.get(&(DeviceType::RTC, "rtc".to_string()))
.is_some());
} | rust_cleaned_test_functions.jsonl/93127 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 668
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40719,
97555,
41334,
39904,
56789,
368,
341,
286,
1077,
5206,
348,
3821,
284,
1855,
2273,
3821,
5314,
7,
8846,
486,
1806,
36161,
317,
286,
2060,
10297,
85,
3821,
8271,
62739,
19195,
1005,
285,
198... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ber_read_bool_ok() {
let tests : &[(bool, &[u8])] = &[
(false, &[1, 1, 0]),
(true, &[1, 1, 1]),
(true, &[1, 1, 191]),
(true, &[1, 1, 254]),
(true, &[1, 1, 255]),
];
for &(evalue, data) in tests {
let value = parse_ber(data, |reader| {
reader.read_bool()
}).unwrap();
assert_eq!(value, evalue);
}
} | rust_cleaned_test_functions.jsonl/111099 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 236
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88165,
6443,
22159,
19817,
368,
341,
262,
1077,
7032,
549,
609,
9697,
2641,
11,
44590,
84,
23,
72080,
284,
609,
9640,
286,
320,
3849,
11,
44590,
16,
11,
220,
16,
11,
220,
15,
17036,
286,
320,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_from_vec() {
use crate::vec::Vec;
for cap in 0..35 {
for len in 0..=cap {
let mut vec = Vec::with_capacity(cap);
vec.extend(0..len);
let vd = VecDeque::from(vec.clone());
assert!(vd.cap().is_power_of_two());
assert_eq!(vd.len(), vec.len());
assert!(vd.into_iter().eq(vec));
}
}
} | rust_cleaned_test_functions.jsonl/3010 | {
"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,
5673,
13251,
368,
341,
286,
990,
17717,
486,
4083,
486,
10050,
280,
286,
369,
2062,
304,
220,
15,
496,
18,
20,
341,
310,
369,
2422,
304,
220,
15,
496,
28,
11346,
341,
394,
1077,
5206,
7486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_create_schema_to_string() {
let _setup = SetupMocks::init();
let (did, schema_name, schema_version, data) = prepare_schema_data();
let handle = create_and_publish_schema("test_create_schema_success",
did,
schema_name,
schema_version,
data.clone()).unwrap();
let schema_id = get_schema_id(handle).unwrap();
let create_schema_json = to_string(handle).unwrap();
let value: serde_json::Value = serde_json::from_str(&create_schema_json).unwrap();
assert_eq!(value["version"], "1.0");
assert!(value["data"].is_object());
let handle = from_string(&create_schema_json).unwrap();
assert_eq!(get_source_id(handle).unwrap(), String::from("test_create_schema_success"));
check_schema(handle, &create_schema_json, &schema_id, &data);
} | rust_cleaned_test_functions.jsonl/33228 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 537
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
25371,
2346,
3904,
368,
341,
286,
1077,
716,
15188,
284,
18626,
72577,
486,
2327,
1428,
286,
1077,
320,
22920,
11,
10802,
1269,
11,
10802,
9438,
11,
821,
8,
284,
10549,
25371,
1769,
543,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_version_comparison() {
let version1 = Version::from_str("0.0.0").unwrap();
let version2 = Version::from_str("0.0.1").unwrap();
assert!(version1 < version2);
let version1 = Version::from_str("0.0.2").unwrap();
let version2 = Version::from_str("0.1.1").unwrap();
assert!(version1 < version2);
let version1 = Version::from_str("0.1.2").unwrap();
let version2 = Version::from_str("0.1.3").unwrap();
assert!(version1 < version2);
let version1 = Version::from_str("0.1.3").unwrap();
let version2 = Version::from_str("1.1.3").unwrap();
assert!(version1 < version2);
let version1 = Version::from_str("1.1.2").unwrap();
let version2 = Version::from_str("1.1.3").unwrap();
assert!(version1 < version2);
let version1 = Version::from_str("1.1.3").unwrap();
let version2 = Version::from_str("1.1.3").unwrap();
assert!(version1 == version2);
} | rust_cleaned_test_functions.jsonl/32853 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 452
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9438,
90797,
368,
341,
286,
1077,
2319,
16,
284,
6079,
486,
1499,
2895,
445,
15,
13,
15,
13,
15,
1827,
15454,
543,
286,
1077,
2319,
17,
284,
6079,
486,
1499,
2895,
445,
15,
13,
15,
13,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_change_application() {
let ante_text =
"zero\none\ntwo\nthree\nfour\nfive\nsix\nseven\neight\nnine\nten\neleven\ntwelve"
.to_string();
let ante_lines: Vec<&str> = ante_text.complete_lines().collect();
let post_text =
"zero\none\ntwo\nthree mod\nfour\nfive\nextra\nsix\nseven\neight mod\nnine mod\nten\neleven\ntwelve\nextra\n".to_string();
let post_lines: Vec<&str> = post_text.complete_lines().collect();
let ante_snippets = vec![
Snippet {
start_index: 2,
lines: ante_lines[2..5].to_vec(),
},
Snippet {
start_index: 5,
lines: ante_lines[5..7].to_vec(),
},
Snippet {
start_index: 7,
lines: ante_lines[7..11].to_vec(),
},
Snippet {
start_index: 12,
lines: ante_lines[12..].to_vec(),
},
];
println!("ante snippets: {:?}", ante_snippets);
let post_snippets = vec![
Snippet {
start_index: 2,
lines: post_lines[2..5].to_vec(),
},
Snippet {
start_index: 5,
lines: post_lines[5..8].to_vec(),
},
Snippet {
start_index: 8,
lines: post_lines[8..12].to_vec(),
},
Snippet {
start_index: 13,
lines: post_lines[13..].to_vec(),
},
];
println!("post snippets: {:?}", post_snippets);
let mut changes: Vec<Change> = vec![];
for (a, p) in ante_snippets.iter().zip(post_snippets.iter()) {
let change = Change::new(a.clone(), p.clone());
changes.push(change);
}
let changed = apply_changes(&changes, &ante_text);
assert_eq!(changed.string, post_text);
let changed = apply_changes(
&changes,
&"zero\none\ntwo\nthree\nfour\nmove\nfive\nsix\nseven\neight\nnine\nten\neleven\ntwelve",
);
assert_eq!(changed.string, "zero\none\ntwo\nthree mod\nfour\nmove\nfive\nextra\nsix\nseven\neight mod\nnine mod\nten\neleven\ntwelve\nextra\n");
} | rust_cleaned_test_functions.jsonl/121951 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1323
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15947,
38721,
368,
341,
286,
1077,
39424,
4326,
4035,
310,
330,
14154,
1699,
603,
59,
406,
1126,
1699,
27856,
1699,
34024,
1699,
52670,
1699,
50364,
1699,
80185,
59,
811,
491,
1699,
93223,
59,
424... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_put_blob() {
let blob_endpoint = "http://localhost:10000/devstoreaccount1/";
let client_name = "devstoreaccount1";
let client_key = Some("Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==".to_string());
let container_name = "sccache";
let creds = AzureCredentials::new(
blob_endpoint,
client_name,
client_key,
container_name.to_string(),
);
let runtime = Runtime::new().unwrap();
let container = BlobContainer::new(creds.azure_blob_endpoint(), container_name).unwrap();
let put_future = container.put("foo", b"barbell".to_vec(), &creds);
runtime.block_on(put_future).unwrap();
let get_future = container.get("foo", &creds);
let result = runtime.block_on(get_future).unwrap();
assert_eq!(b"barbell".to_vec(), result);
} | rust_cleaned_test_functions.jsonl/72007 | {
"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,
15557,
45908,
368,
341,
23459,
286,
1077,
23404,
36699,
284,
330,
1254,
1110,
8301,
25,
16,
15,
15,
15,
15,
35061,
4314,
4608,
16,
37254,
286,
1077,
2943,
1269,
284,
330,
3583,
4314,
4608,
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_compute_checksum() {
assert_eq!(compute_checksum_incremental(&b""[..], 0), 0);
assert_eq!(
compute_checksum_incremental(
&b"qSupported:multiprocess+;xmlRegisters=i386;qRelocInsn+"[..],
0
),
0xb5
);
} | rust_cleaned_test_functions.jsonl/40101 | {
"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,
57028,
64038,
368,
341,
262,
2060,
10714,
10297,
27706,
64038,
51482,
278,
2099,
65,
3014,
95874,
1125,
220,
15,
701,
220,
15,
317,
262,
2060,
10714,
33673,
286,
12564,
64038,
51482,
278,
1006,
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_matyas() {
let a = backprop(scalar(1.0));
let b = backprop(scalar(1.0));
let y = Computed::new(scalar(0.26)) * (a.pow(2.0) + b.pow(2.0))
- Computed::new(scalar(0.48)) * a.clone() * b.clone();
let grads = gradients(&[y], &vec![a.clone(), b.clone()], false);
assert!((&*grads[0] - 0.04).iter().next().unwrap().abs() < 1e-6);
assert!((&*grads[1] - 0.04).iter().next().unwrap().abs() < 1e-6);
} | rust_cleaned_test_functions.jsonl/35596 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 227
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16610,
81453,
368,
341,
262,
1077,
264,
284,
1182,
2674,
1141,
59153,
7,
16,
13,
15,
1106,
262,
1077,
293,
284,
1182,
2674,
1141,
59153,
7,
16,
13,
15,
3237,
262,
1077,
379,
284,
1198,
19292,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_43() {
assert_eq!(multiply("123".to_owned(), "123".to_owned()), "15129");
assert_eq!(multiply("1".to_owned(), "0".to_owned()), "0");
assert_eq!(multiply("999".to_owned(), "999".to_owned()), "998001");
} | rust_cleaned_test_functions.jsonl/65704 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
19,
18,
368,
341,
286,
2060,
10714,
10297,
64648,
445,
16,
17,
18,
3263,
983,
51973,
1507,
330,
16,
17,
18,
3263,
983,
51973,
11858,
330,
16,
20,
16,
17,
24,
797,
286,
2060,
10714,
10297... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_string() {
assert_eq!(is_string(VALUE_F_PTR_OBJ), false);
assert_eq!(is_string(VALUE_F_SYM_STR), true);
assert_eq!(is_string(VALUE_F_SYM_OBJ), false);
assert_eq!(is_string(VALUE_T_PTR_STR), true);
assert_eq!(is_string(VALUE_T_PTR_OBJ), false);
assert_eq!(is_string(VALUE_T_SYM_STR), true);
assert_eq!(is_string(VALUE_T_SYM_OBJ), false);
} | rust_cleaned_test_functions.jsonl/109921 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 187
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
3904,
368,
341,
197,
6948,
10714,
10297,
285,
3904,
98893,
1400,
20657,
27559,
701,
895,
317,
197,
6948,
10714,
10297,
285,
3904,
98893,
1400,
82933,
7159,
701,
830,
317,
197,
6948,
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... | 1 |
#[test]
fn test_get_iface_bond_yaml() {
with_bond_iface(|| {
let state = NetState::retrieve().unwrap();
let iface = &state.ifaces[IFACE_NAME];
let port1 = &state.ifaces[PORT1_NAME];
let port2 = &state.ifaces[PORT2_NAME];
assert_eq!(&iface.iface_type, &nispor::IfaceType::Bond);
assert_eq!(
serde_yaml::to_string(&iface.bond).unwrap().trim(),
EXPECTED_BOND_INFO
);
assert_eq!(
serde_yaml::to_string(&port1.bond_subordinate)
.unwrap()
.trim(),
EXPECTED_PORT1_INFO
);
assert_eq!(
serde_yaml::to_string(&port2.bond_subordinate)
.unwrap()
.trim(),
EXPECTED_PORT2_INFO
);
assert_eq!(port1.controller, Some("bond99".to_string()));
assert_eq!(port2.controller, Some("bond99".to_string()));
assert_eq!(port1.controller_type, Some(nispor::ControllerType::Bond));
assert_eq!(port2.controller_type, Some(nispor::ControllerType::Bond));
});
} | rust_cleaned_test_functions.jsonl/64108 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 590
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
67666,
880,
2111,
64380,
368,
341,
262,
448,
880,
2111,
67666,
79453,
341,
286,
1077,
1584,
284,
9374,
1397,
486,
55527,
1005,
15454,
543,
286,
1077,
49313,
284,
609,
2454,
35431,
2434,
58,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_keywords_in_impl_def_with_attr() {
check(
r"impl My { #[foo] $0 }",
expect![[r#"
kw pub(crate)
kw pub
kw unsafe
kw fn
kw const
kw type
"#]],
);
} | rust_cleaned_test_functions.jsonl/72506 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 228
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51354,
1243,
21007,
7844,
6615,
10422,
368,
341,
286,
1779,
1006,
310,
435,
1,
6383,
3017,
314,
11506,
7975,
60,
400,
15,
335,
756,
310,
1720,
0,
15505,
81,
2,
698,
394,
29525,
6675,
54907,
34... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_column_descriptor() {
let result = test_column_descriptor_helper();
assert!(
result.is_ok(),
"Expected result to be OK but got err:\n {}",
result.unwrap_err()
);
} | rust_cleaned_test_functions.jsonl/16683 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 131
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8744,
33774,
368,
341,
286,
1077,
1102,
284,
1273,
8744,
33774,
10418,
543,
286,
2060,
33673,
310,
1102,
2079,
19817,
3148,
310,
330,
18896,
1102,
311,
387,
10402,
714,
2684,
1848,
7190,
77,
4687,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_image_manager() {
let mut manager = ImageManager {
images: HashMap::new(),
vao: None,
vbo: None,
vertex_num: 0,
point_relation_shader: RelationLineShader {
id: 0,
color: UniformVariable::new("uColor", Vector4::<f32>::new(1.0, 0.0, 0.0, 1.0)),
},
is_show_point_relation: true,
};
let key: &str = "default";
assert_eq!(manager.get_texture_id(key), 0);
assert!(manager.images.is_empty());
let image = get_image("default");
manager.images.insert(image.key().to_string(), image);
let keys: Vec<&String> = manager.get_image_keys().collect();
assert_eq!(keys.len(), 1);
assert_eq!(keys[0].clone(), key.to_string());
assert_eq!(manager.get_texture_id(key), 1);
let (w, h) = manager.get_texture_image_size(key);
assert_eq!(w, 1920);
assert_eq!(h, 1080);
let imshader = manager.get_current_image_shader(key);
assert_eq!(imshader.id, 0);
manager.add_point(key, 960.0, 540.0, -0.5, 0.3, 0.2, 0.5);
assert_eq!(manager.images[key].points.points.len(), 1);
assert!(manager.images[key].points.points[0].loc.x < 1e-5);
assert!(manager.images[key].points.points[0].loc.y < 1e-5);
let other_key = "other";
manager
.images
.insert(other_key.to_string(), get_image(other_key));
manager.add_point_relation(key, 960.0, 540.0, other_key, 0.0, 0.0);
assert!(manager.images[key].point_relations[other_key].lines[0].x < 1e-5);
assert!(manager.images[key].point_relations[other_key].lines[0].y < 1e-5);
assert!(
(manager.images[key].point_relations[other_key].lines[0].other_x + 1.0).abs() < 1e-5
);
assert!(
(manager.images[key].point_relations[other_key].lines[0].other_y - 1.0).abs() < 1e-5,
"other_y = {}",
manager.images[key].point_relations[other_key].lines[0].other_y
);
manager.on_mouse_wheel(key, 0.2, -0.2, 2.0);
assert!((manager.images[key].image_shader.model_mat.value[0][0] - 2.0).abs() < 1e-5);
assert!((manager.images[key].image_shader.model_mat.value[1][1] - 2.0).abs() < 1e-5);
assert!((manager.images[key].image_shader.model_mat.value[3][0] + 0.2).abs() < 1e-5);
assert!((manager.images[key].image_shader.model_mat.value[3][1] - 0.2).abs() < 1e-5);
manager.on_mouse_motion_event(key, 0.0, 0.0);
assert!((manager.images[key].image_shader.model_mat.value[3][0] + 0.2).abs() < 1e-5);
assert!((manager.images[key].image_shader.model_mat.value[3][1] - 0.2).abs() < 1e-5);
manager.on_mouse_button_up(key);
assert!(!manager.images[key].image_shader.is_dragging);
} | rust_cleaned_test_functions.jsonl/111628 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1431
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4954,
12144,
368,
341,
286,
1077,
5206,
6645,
284,
4654,
2043,
341,
310,
5335,
25,
10528,
486,
931,
3148,
310,
348,
3441,
25,
2240,
345,
310,
348,
749,
25,
2240,
345,
310,
11936,
4273,
25,
220... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bitfields_sixth() {
let mut date: bindings::bitfields::Sixth = unsafe { mem::zeroed() };
assert!(unsafe { date.assert(0, 0, 0, 0) });
date.byte = 255;
date.set_nWeekDay(6); // saturdays are the best
date.set_nMonthDay(20);
date.set_nMonth(11);
assert!(unsafe { date.assert(255, 6, 11, 20) });
} | rust_cleaned_test_functions.jsonl/28003 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 150
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13996,
9007,
643,
941,
339,
368,
341,
262,
1077,
5206,
2400,
25,
35700,
486,
4489,
9007,
486,
41460,
339,
284,
19860,
314,
1833,
486,
14154,
291,
368,
3634,
262,
2060,
10297,
38157,
314,
2400,
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_witness() {
let w0 =
Vec::from_hex("03d2e15674941bad4a996372cb87e1856d3652606d98562fe39c5e9e7e413f2105")
.unwrap();
let w1 = Vec::from_hex("000000").unwrap();
let witness_vec = vec![w0.clone(), w1.clone()];
let witness_serialized: Vec<u8> = serialize(&witness_vec);
let witness = Witness {
content: witness_serialized[1..].to_vec(),
witness_elements: 2,
last: 34,
second_to_last: 0,
};
for (i, el) in witness.iter().enumerate() {
assert_eq!(witness_vec[i], el);
}
assert_eq!(witness.last(), Some(&w1[..]));
assert_eq!(witness.second_to_last(), Some(&w0[..]));
let w_into = Witness::from_vec(witness_vec);
assert_eq!(w_into, witness);
assert_eq!(witness_serialized, serialize(&witness));
} | rust_cleaned_test_functions.jsonl/100564 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 476
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1670,
8091,
368,
341,
286,
1077,
289,
15,
4035,
310,
11312,
486,
1499,
32655,
445,
15,
18,
67,
17,
68,
16,
20,
21,
22,
19,
24,
19,
16,
13855,
19,
64,
24,
24,
21,
18,
22,
17,
7221,
23,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_from_diff() {
let method = test_method();
let mut new = method.clone();
let diff = method.diff(&new).unwrap();
let diff_method = VerificationMethod::from_diff(diff);
assert!(diff_method.is_err());
// add property
let mut properties = Object::new();
properties.insert("key1".to_string(), Value::String("value1".to_string()));
*new.properties_mut() = properties;
let diff = method.diff(&new).unwrap();
let diff_method = VerificationMethod::from_diff(diff);
assert!(diff_method.is_err());
// add id
*new.id_mut() = "did:diff:123".parse().unwrap();
let diff = method.diff(&new).unwrap();
let diff_method = VerificationMethod::from_diff(diff);
assert!(diff_method.is_err());
// add controller
*new.controller_mut() = "did:diff:123".parse().unwrap();
let diff = method.diff(&new).unwrap();
let diff_method = VerificationMethod::from_diff(diff);
assert!(diff_method.is_err());
// add key_type
*new.key_type_mut() = MethodType::MerkleKeyCollection2021;
let diff = method.diff(&new).unwrap();
let diff_method = VerificationMethod::from_diff(diff);
assert!(diff_method.is_err());
// add key_data
*new.key_data_mut() = MethodData::PublicKeyMultibase("diff".into());
let diff = method.diff(&new).unwrap();
let diff_method = VerificationMethod::from_diff(diff.clone());
assert!(diff_method.is_ok());
let diff_method = diff_method.unwrap();
assert_eq!(diff_method, new);
let merge = method.merge(diff.clone()).unwrap();
assert_eq!(merge, new);
assert_eq!(new.into_diff().unwrap(), diff);
} | rust_cleaned_test_functions.jsonl/124424 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 624
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
15850,
368,
341,
262,
1077,
1714,
284,
1273,
9032,
543,
262,
1077,
5206,
501,
284,
1714,
15997,
1428,
262,
1077,
3638,
284,
1714,
40679,
2099,
931,
568,
15454,
543,
262,
1077,
3638,
9032,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fifo_error_reference_file_only() {
let (at, mut ucmd) = at_and_ucmd!();
at.mkfifo("fifo");
at.make_file("reference_file");
ucmd.args(&["-r", "reference_file", "fifo"])
.fails()
.no_stdout()
.stderr_contains("cannot open 'fifo' for writing: No such device or address");
} | rust_cleaned_test_functions.jsonl/77106 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 157
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56590,
4096,
25433,
2458,
18410,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
518,
35011,
74031,
445,
74031,
797,
262,
518,
10117,
2458,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_negative_take_as_pod_with_move_constructor() {
let cxx = indoc! {"
uint32_t take_bob(Bob a) {
return a.a;
}
"};
let hdr = indoc! {"
#include <cstdint>
#include <type_traits>
struct Bob {
uint32_t a;
uint32_t b;
inline Bob(Bob&& other_bob) {}
};
uint32_t take_bob(Bob a);
"};
let rs = quote! {
let a = ffi::Bob { a: 12, b: 13 };
assert_eq!(ffi::take_bob(a), 12);
};
run_test_expect_fail(cxx, hdr, rs, &["take_bob"], &["Bob"]);
} | rust_cleaned_test_functions.jsonl/9733 | {
"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,
53865,
73261,
11898,
85337,
6615,
17134,
66210,
368,
341,
262,
1077,
272,
4146,
284,
1257,
509,
0,
314,
698,
286,
2622,
18,
17,
528,
1896,
880,
674,
5349,
674,
264,
8,
341,
310,
470,
264,
5849... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_occ() {
let bwt = vec![1u8, 3u8, 3u8, 1u8, 2u8, 0u8];
let alphabet = Alphabet::new(&[0u8, 1u8, 2u8, 3u8]);
let occ = Occ::new(&bwt, 3, &alphabet);
assert_eq!(occ.occ, [[0, 1, 0, 0], [0, 2, 0, 2]]);
assert_eq!(occ.get(&bwt, 4, 2u8), 1);
assert_eq!(occ.get(&bwt, 4, 3u8), 2);
} | rust_cleaned_test_functions.jsonl/16551 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 209
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57291,
368,
341,
286,
1077,
293,
9306,
284,
7486,
20703,
16,
84,
23,
11,
220,
18,
84,
23,
11,
220,
18,
84,
23,
11,
220,
16,
84,
23,
11,
220,
17,
84,
23,
11,
220,
15,
84,
23,
935,
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_fmt_debug() {
let req = TestRequest::get()
.uri("/index.html?test=1")
.header("x-test", "111")
.to_srv_request();
let s = format!("{:?}", req);
assert!(s.contains("ServiceRequest"));
assert!(s.contains("test=1"));
assert!(s.contains("x-test"));
let res = HttpResponse::Ok().header("x-test", "111").finish();
let res = TestRequest::post()
.uri("/index.html?test=1")
.to_srv_response(res);
let s = format!("{:?}", res);
assert!(s.contains("ServiceResponse"));
assert!(s.contains("x-test"));
} | rust_cleaned_test_functions.jsonl/5310 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 343
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38128,
15446,
368,
341,
286,
1077,
4232,
284,
3393,
1900,
486,
455,
741,
310,
659,
6070,
4283,
1252,
2564,
30,
1944,
28,
16,
1138,
310,
659,
2708,
445,
87,
16839,
497,
330,
16,
16,
16,
1138,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bpf_loader_check_load_dw() {
let prog = &[
0x18, 0x00, 0x00, 0x00, 0x88, 0x77, 0x66, 0x55, // first half of lddw
];
bpf_verifier::check(prog, true).unwrap();
} | rust_cleaned_test_functions.jsonl/71751 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 130
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
15897,
22139,
7200,
12411,
79503,
368,
341,
286,
1077,
29271,
284,
609,
9640,
310,
220,
15,
87,
16,
23,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_short_short_int() {
assert_eq!(parse_short_short_int(&[0][..]), Ok((EMPTY, 0)));
assert_eq!(parse_short_short_int(&[255][..]), Ok((EMPTY, -1)));
} | rust_cleaned_test_functions.jsonl/25449 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 97
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
16673,
16673,
4042,
368,
341,
286,
2060,
10714,
10297,
6400,
16673,
16673,
4042,
2099,
58,
15,
1457,
496,
9719,
7622,
1188,
32858,
11,
220,
15,
4945,
286,
2060,
10714,
10297,
6400,
16673,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_skip_bcast_commit() {
setup_for_test();
let mut config = new_test_config(1, 10, 1);
config.skip_bcast_commit = true;
let s = MemStorage::new_with_conf_state((vec![1, 2, 3], vec![]));
let r1 = new_test_raft_with_config(&config, s);
let r2 = new_test_raft(2, vec![1, 2, 3], 10, 1, new_storage());
let r3 = new_test_raft(3, vec![1, 2, 3], 10, 1, new_storage());
let mut nt = Network::new(vec![Some(r1), Some(r2), Some(r3)]);
// elect r1 as leader
nt.send(vec![new_message(1, 1, MessageType::MsgHup, 0)]);
let mut test_entries = Entry::new_();
test_entries.set_data(b"testdata".to_vec());
let msg = new_message_with_entries(1, 1, MessageType::MsgPropose, vec![test_entries.clone()]);
nt.send(vec![msg.clone()]);
assert_eq!(nt.peers[&1].raft_log.committed, 3);
assert_eq!(nt.peers[&2].raft_log.committed, 2);
assert_eq!(nt.peers[&3].raft_log.committed, 2);
for _ in 0..nt.peers[&1].get_randomized_election_timeout() {
nt.peers.get_mut(&1).unwrap().tick();
}
nt.send(vec![new_message(1, 1, MessageType::MsgHup, 0)]);
assert_eq!(nt.peers[&2].raft_log.committed, 3);
assert_eq!(nt.peers[&3].raft_log.committed, 3);
// The feature should be able to be adjusted at run time.
nt.peers.get_mut(&1).unwrap().skip_bcast_commit(false);
nt.send(vec![msg.clone()]);
assert_eq!(nt.peers[&1].raft_log.committed, 4);
assert_eq!(nt.peers[&2].raft_log.committed, 4);
assert_eq!(nt.peers[&3].raft_log.committed, 4);
nt.peers.get_mut(&1).unwrap().skip_bcast_commit(true);
// Later proposal should commit former proposal.
nt.send(vec![msg.clone()]);
nt.send(vec![msg]);
assert_eq!(nt.peers[&1].raft_log.committed, 6);
assert_eq!(nt.peers[&2].raft_log.committed, 5);
assert_eq!(nt.peers[&3].raft_log.committed, 5);
let mut cc = ConfChange::new_();
cc.set_change_type(ConfChangeType::RemoveNode);
cc.set_node_id(3);
let mut data = Vec::with_capacity(ProstMsg::encoded_len(&cc));
data.reserve_exact(ProstMsg::encoded_len(&cc));
cc.encode(&mut data).unwrap();
let mut cc_entry = Entry::new_();
cc_entry.set_entry_type(EntryType::EntryConfChange);
cc_entry.set_data(data);
nt.send(vec![new_message_with_entries(
1,
1,
MessageType::MsgPropose,
vec![cc_entry],
)]);
assert!(nt.peers[&1].should_bcast_commit());
assert!(nt.peers[&2].should_bcast_commit());
assert!(nt.peers[&3].should_bcast_commit());
assert_eq!(nt.peers[&1].raft_log.committed, 7);
assert_eq!(nt.peers[&2].raft_log.committed, 7);
assert_eq!(nt.peers[&3].raft_log.committed, 7);
} | rust_cleaned_test_functions.jsonl/50341 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1256
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44830,
880,
3829,
36346,
368,
341,
262,
6505,
5478,
4452,
543,
262,
1077,
5206,
2193,
284,
501,
4452,
5332,
7,
16,
11,
220,
16,
15,
11,
220,
16,
317,
262,
2193,
36596,
880,
3829,
36346,
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_convert_options_declaration() {
let b = ast::BaseNode::default();
let pkg = ast::Package {
base: b.clone(),
path: "path".to_string(),
package: "main".to_string(),
files: vec![ast::File {
base: b.clone(),
name: "foo.flux".to_string(),
metadata: String::new(),
package: None,
imports: Vec::new(),
body: vec![ast::Statement::Option(Box::new(ast::OptionStmt {
base: b.clone(),
assignment: ast::Assignment::Variable(Box::new(ast::VariableAssgn {
base: b.clone(),
id: ast::Identifier {
base: b.clone(),
name: "task".to_string(),
},
init: ast::Expression::Object(Box::new(ast::ObjectExpr {
base: b.clone(),
lbrace: None,
with: None,
properties: vec![
ast::Property {
base: b.clone(),
key: ast::PropertyKey::Identifier(ast::Identifier {
base: b.clone(),
name: "name".to_string(),
}),
separator: None,
value: Some(ast::Expression::StringLit(ast::StringLit {
base: b.clone(),
value: "foo".to_string(),
})),
comma: None,
},
ast::Property {
base: b.clone(),
key: ast::PropertyKey::Identifier(ast::Identifier {
base: b.clone(),
name: "every".to_string(),
}),
separator: None,
value: Some(ast::Expression::Duration(ast::DurationLit {
base: b.clone(),
values: vec![ast::Duration {
magnitude: 1,
unit: "h".to_string(),
}],
})),
comma: None,
},
ast::Property {
base: b.clone(),
key: ast::PropertyKey::Identifier(ast::Identifier {
base: b.clone(),
name: "delay".to_string(),
}),
separator: None,
value: Some(ast::Expression::Duration(ast::DurationLit {
base: b.clone(),
values: vec![ast::Duration {
magnitude: 10,
unit: "m".to_string(),
}],
})),
comma: None,
},
ast::Property {
base: b.clone(),
key: ast::PropertyKey::Identifier(ast::Identifier {
base: b.clone(),
name: "cron".to_string(),
}),
separator: None,
value: Some(ast::Expression::StringLit(ast::StringLit {
base: b.clone(),
value: "0 2 * * *".to_string(),
})),
comma: None,
},
ast::Property {
base: b.clone(),
key: ast::PropertyKey::Identifier(ast::Identifier {
base: b.clone(),
name: "retry".to_string(),
}),
separator: None,
value: Some(ast::Expression::Integer(ast::IntegerLit {
base: b.clone(),
value: 5,
})),
comma: None,
},
],
rbrace: None,
})),
})),
}))],
eof: None,
}],
};
let want = Package {
loc: b.location.clone(),
package: "main".to_string(),
files: vec![File {
loc: b.location.clone(),
package: None,
imports: Vec::new(),
body: vec![Statement::Option(Box::new(OptionStmt {
loc: b.location.clone(),
assignment: Assignment::Variable(VariableAssgn::new(
Identifier {
loc: b.location.clone(),
name: "task".to_string(),
},
Expression::Object(Box::new(ObjectExpr {
loc: b.location.clone(),
typ: type_info(),
with: None,
properties: vec![
Property {
loc: b.location.clone(),
key: Identifier {
loc: b.location.clone(),
name: "name".to_string(),
},
value: Expression::StringLit(StringLit {
loc: b.location.clone(),
value: "foo".to_string(),
}),
},
Property {
loc: b.location.clone(),
key: Identifier {
loc: b.location.clone(),
name: "every".to_string(),
},
value: Expression::Duration(DurationLit {
loc: b.location.clone(),
value: Duration {
months: 5,
nanoseconds: 5000,
negative: false,
},
}),
},
Property {
loc: b.location.clone(),
key: Identifier {
loc: b.location.clone(),
name: "delay".to_string(),
},
value: Expression::Duration(DurationLit {
loc: b.location.clone(),
value: Duration {
months: 1,
nanoseconds: 50,
negative: true,
},
}),
},
Property {
loc: b.location.clone(),
key: Identifier {
loc: b.location.clone(),
name: "cron".to_string(),
},
value: Expression::StringLit(StringLit {
loc: b.location.clone(),
value: "0 2 * * *".to_string(),
}),
},
Property {
loc: b.location.clone(),
key: Identifier {
loc: b.location.clone(),
name: "retry".to_string(),
},
value: Expression::Integer(IntegerLit {
loc: b.location.clone(),
value: 5,
}),
},
],
})),
b.location.clone(),
)),
}))],
}],
};
let got = test_convert(pkg).unwrap();
assert_eq!(want, got);
} | rust_cleaned_test_functions.jsonl/30444 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 7386
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
8743,
77926,
368,
341,
286,
1077,
293,
284,
11763,
486,
3978,
1955,
486,
2258,
543,
286,
1077,
24793,
284,
11763,
486,
13100,
341,
310,
2331,
25,
293,
15997,
3148,
310,
1815,
25,
330,
234... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_verify_empty_accumulator() {
let element_hash = b"hello".test_only_hash();
let root_hash = *ACCUMULATOR_PLACEHOLDER_HASH;
let proof = TestAccumulatorProof::new(vec![]);
assert!(proof.verify(root_hash, element_hash, 0).is_err());
} | rust_cleaned_test_functions.jsonl/33618 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35638,
15124,
75837,
10511,
368,
341,
262,
1077,
2392,
8950,
284,
293,
1,
14990,
3263,
1944,
18410,
8950,
543,
262,
1077,
3704,
8950,
284,
353,
29442,
2794,
71680,
81924,
94629,
32309,
280,
262,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_total_data_blocks() {
let mut d64 = D64::open_memory(D64::geometry(false)).unwrap();
d64.write_format(&"test".into(), &"t1".into()).unwrap();
assert_eq!(d64.disk_format().unwrap().total_data_blocks(), 664);
let mut d71 = D71::open_memory(D71::geometry(false)).unwrap();
d71.write_format(&"test".into(), &"t1".into()).unwrap();
assert_eq!(d71.disk_format().unwrap().total_data_blocks(), 1328);
let mut d81 = D81::open_memory(D81::geometry(false)).unwrap();
d81.write_format(&"test".into(), &"t1".into()).unwrap();
assert_eq!(d81.disk_format().unwrap().total_data_blocks(), 3160);
} | rust_cleaned_test_functions.jsonl/9184 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 308
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10784,
1769,
25201,
368,
341,
286,
1077,
5206,
294,
21,
19,
284,
422,
21,
19,
486,
2508,
19195,
5432,
21,
19,
486,
15281,
3576,
4579,
15454,
543,
286,
294,
21,
19,
3836,
8955,
2099,
1,
1944,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_store_account_and_update_capitalization_unchanged() {
let lamports = 400;
let (genesis_config, mint_keypair) = create_genesis_config(lamports);
let bank = Bank::new(&genesis_config);
let pubkey = mint_keypair.pubkey();
let account = AccountSharedData::new(lamports, 1, &system_program::id());
assert_capitalization_diff(
&bank,
|| bank.store_account_and_update_capitalization(&pubkey, &account),
|old, new| assert_eq!(old, new),
);
assert_eq!(account, bank.get_account(&pubkey).unwrap());
} | rust_cleaned_test_functions.jsonl/2531 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 273
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14809,
13500,
8378,
8882,
16388,
2174,
2022,
62,
3185,
3726,
368,
341,
286,
1077,
31603,
3394,
284,
220,
19,
15,
15,
280,
286,
1077,
320,
77894,
5332,
11,
28337,
3097,
12670,
8,
284,
1855,
16322... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_cluster_info_new() {
let d = ContactInfo::new_localhost(&solana_sdk::pubkey::new_rand(), timestamp());
let cluster_info = ClusterInfo::new(
d.clone(),
Arc::new(Keypair::new()),
SocketAddrSpace::Unspecified,
);
assert_eq!(d.id, cluster_info.id());
} | rust_cleaned_test_functions.jsonl/26024 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 168
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28441,
3109,
5921,
368,
341,
286,
1077,
294,
284,
9180,
1731,
486,
931,
62,
8301,
2099,
38198,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
1507,
11441,
1423,
286,
1077,
10652,
3109,
284,
35380,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mvcc_txn_commit_ok() {
test_mvcc_txn_commit_ok_imp(b"x", b"v", b"y", b"z");
let long_value = gen_value(b'v', SHORT_VALUE_MAX_LEN + 1);
test_mvcc_txn_commit_ok_imp(b"x", &long_value, b"y", b"z");
} | rust_cleaned_test_functions.jsonl/23327 | {
"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,
73187,
638,
92299,
36346,
19817,
368,
341,
286,
1273,
73187,
638,
92299,
36346,
19817,
36788,
1883,
65438,
497,
293,
1,
85,
497,
293,
1,
88,
497,
293,
1,
89,
3071,
286,
1077,
1293,
3142,
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_status() {
let cgm: CgroupManager = serde_json::from_str(TEST_CGM_DATA).unwrap();
let oci_state = create_dummy_oci_state();
let created = SystemTime::now();
let status = Status::new(
Path::new(TEST_BUNDLE_PATH),
oci_state.clone(),
1,
created,
cgm,
create_dummy_opts(),
)
.unwrap();
assert_eq!(status.id, oci_state.id);
assert_eq!(status.pid, oci_state.pid);
assert_eq!(status.process_start_time, 1);
assert_eq!(status.created, DateTime::<Utc>::from(created));
} | rust_cleaned_test_functions.jsonl/79472 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 341
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4773,
368,
341,
286,
1077,
272,
26186,
25,
356,
4074,
2043,
284,
61570,
9455,
486,
1499,
2895,
50320,
920,
20637,
7896,
568,
15454,
543,
286,
1077,
93975,
4387,
284,
1855,
60321,
62,
2119,
4387,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cookie_value_string_is_added() {
let cookie = CookieOptions {
cookie_name: "".to_string(),
cookie_value: Some("value".to_string()),
max_age: None,
domain: None,
path: None,
secure: false,
http_only: false,
same_site: None,
};
assert_eq!(cookie.to_string(), "=value");
} | rust_cleaned_test_functions.jsonl/101596 | {
"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,
38663,
3142,
3904,
6892,
37653,
368,
341,
286,
1077,
12544,
284,
24356,
3798,
341,
310,
12544,
1269,
25,
44907,
983,
3904,
3148,
310,
12544,
3142,
25,
4329,
445,
957,
3263,
983,
3904,
14702,
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_remove_node() {
let mut g: MatrixGraph<char, ()> = MatrixGraph::new();
let a = g.add_node('a');
g.remove_node(a);
assert_eq!(g.node_count(), 0);
assert_eq!(g.edge_count(), 0);
} | rust_cleaned_test_functions.jsonl/81957 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
5084,
368,
341,
286,
1077,
5206,
342,
25,
11631,
11212,
21919,
11,
1719,
29,
284,
11631,
11212,
486,
931,
543,
286,
1077,
264,
284,
342,
1364,
5084,
492,
64,
3755,
286,
342,
4850,
5084,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_diseq_0() {
with_globals(|| {
let test_res = string_to_ts("::bar::baz");
let test_eqs = string_to_ts("bar::baz");
assert_eq!(test_res == test_eqs, false)
})
} | rust_cleaned_test_functions.jsonl/71395 | {
"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,
814,
1064,
80,
62,
15,
368,
341,
286,
448,
58775,
79453,
341,
310,
1077,
1273,
4918,
284,
914,
2346,
25023,
445,
486,
2257,
486,
42573,
797,
310,
1077,
1273,
10714,
82,
284,
914,
2346,
25023,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_authorize_random() {
let client = new_client();
let (url, csrf_state) = client.authorize_url(CsrfToken::new_random);
assert_eq!(
Url::parse(&format!(
"http://example.com/auth?response_type=code&client_id=aaa&state={}",
byte_serialize(csrf_state.secret().clone().into_bytes().as_slice())
.collect::<Vec<_>>()
.join("")
)).unwrap(),
url
);
} | rust_cleaned_test_functions.jsonl/12758 | {
"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,
22938,
551,
22644,
368,
341,
262,
1077,
2943,
284,
501,
8179,
543,
262,
1077,
320,
1085,
11,
35522,
4387,
8,
284,
2943,
16314,
551,
2903,
72636,
8052,
3323,
486,
931,
22644,
626,
262,
2060,
1071... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_replace_if_let_with_match_doesnt_unwrap_multiline_expressions() {
check_assist(
replace_if_let_with_match,
r#"
fn foo() {
if <|>let VariantData::Struct(..) = a {
bar(
123
)
} else {
false
}
} "#,
r#"
fn foo() {
match a {
VariantData::Struct(..) => {
bar(
123
)
}
_ => false,
}
} "#,
)
} | rust_cleaned_test_functions.jsonl/6156 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 321
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10633,
11119,
62,
1149,
6615,
10708,
96374,
406,
4907,
10097,
26290,
26560,
2702,
39873,
368,
341,
286,
1779,
12083,
380,
1006,
310,
8290,
11119,
62,
1149,
6615,
10708,
345,
310,
435,
2,
698,
8822... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
let empty_map : TrieMap<usize> = TrieMap::new();
assert_eq!(empty_map.lower_bound(0).next(), None);
assert_eq!(empty_map.upper_bound(0).next(), None);
let last = 999;
let step = 3;
let value = 42;
let mut map : TrieMap<usize> = TrieMap::new();
for x in range_step(0, last, step) {
assert!(x % step == 0);
map.insert(x, value);
}
for i in range(0, last - step) {
let mut lb = map.lower_bound(i);
let mut ub = map.upper_bound(i);
let next_key = i - i % step + step;
let next_pair = (next_key, &value);
if i % step == 0 {
assert_eq!(lb.next(), Some((i, &value)));
} else {
assert_eq!(lb.next(), Some(next_pair));
}
assert_eq!(ub.next(), Some(next_pair));
}
let mut lb = map.lower_bound(last - step);
assert_eq!(lb.next(), Some((last - step, &value)));
let mut ub = map.upper_bound(last - step);
assert_eq!(ub.next(), None);
for i in range(last - step + 1, last) {
let mut lb = map.lower_bound(i);
assert_eq!(lb.next(), None);
let mut ub = map.upper_bound(i);
assert_eq!(ub.next(), None);
}
} | rust_cleaned_test_functions.jsonl/88427 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 720
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19447,
368,
341,
286,
1077,
4287,
5376,
549,
62783,
2227,
90244,
29,
284,
62783,
2227,
486,
931,
543,
286,
2060,
10714,
10297,
3194,
5376,
18073,
19447,
7,
15,
568,
3600,
1507,
2240,
317,
286,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.