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_disable_block_cache() {
let mut cf_opts = ColumnFamilyOptions::new();
assert_eq!(cf_opts.get_block_cache_usage(), 0);
let mut block_opts = BlockBasedOptions::new();
block_opts.set_no_block_cache(true);
cf_opts.set_block_based_table_factory(&block_opts);
assert_eq!(cf_opts.get_block_cache_usage(), 0);
} | rust_cleaned_test_functions.jsonl/34109 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33842,
7113,
11529,
368,
341,
262,
1077,
5206,
24111,
32354,
284,
9332,
15192,
3798,
486,
931,
543,
262,
2060,
10714,
10297,
9792,
32354,
670,
7113,
11529,
31507,
1507,
220,
15,
317,
262,
1077,
52... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_empty_validators() {
let validators = vec![];
assert!(select_winner(&validators, 0).is_none());
assert!(select_winner(&validators, 2).is_none());
assert!(select_winner(&validators, 5).is_none());
} | rust_cleaned_test_functions.jsonl/129481 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 113
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
8337,
2973,
368,
341,
286,
1077,
38588,
284,
7486,
0,
40901,
286,
2060,
10297,
1742,
92588,
2099,
59424,
11,
220,
15,
568,
285,
31488,
1423,
286,
2060,
10297,
1742,
92588,
2099,
59424,
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 |
#[test]
fn test_format_1mb() {
let total_bytes = 1 * MB;
let opts = fatfs::FormatVolumeOptions::new();
let fs = test_format_fs(opts, total_bytes);
assert_eq!(fs.fat_type(), fatfs::FatType::Fat12);
} | rust_cleaned_test_functions.jsonl/35392 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8955,
62,
16,
3096,
368,
341,
262,
1077,
2790,
12524,
284,
220,
16,
353,
13339,
280,
262,
1077,
12185,
284,
8664,
3848,
486,
4061,
18902,
3798,
486,
931,
543,
262,
1077,
8619,
284,
1273,
8955,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_queue() -> Result<()> {
let mut queue = FifoQueue::default();
assert_eq!(queue.head(), None);
queue.enqueue(2);
queue.enqueue(3);
assert_eq!(queue.head(), Some(2));
queue.dequeue();
assert_eq!(queue.head(), Some(3));
queue.dequeue();
queue.enqueue(2);
queue.enqueue(3);
assert_eq!(queue.is_empty(), false);
assert_eq!(queue.head(), Some(2));
queue.clear();
assert_eq!(queue.head(), None);
assert_eq!(queue.is_empty(), true);
Ok(())
} | rust_cleaned_test_functions.jsonl/74240 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 300
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56590,
10841,
368,
1464,
5714,
71698,
341,
286,
1077,
5206,
7177,
284,
18502,
78,
7554,
486,
2258,
1428,
286,
2060,
10714,
10297,
4584,
16042,
1507,
2240,
626,
286,
7177,
47468,
7,
17,
317,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ending_with() {
assert!(ending_with(
Some(to_value("helloworld").unwrap()),
vec![to_value("world").unwrap()],
)
.unwrap());
assert!(
!ending_with(Some(to_value("hello").unwrap()), vec![to_value("hi").unwrap()],).unwrap()
);
} | rust_cleaned_test_functions.jsonl/132429 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 177
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
2459,
6615,
368,
341,
286,
2060,
10297,
2459,
6615,
1006,
310,
4329,
12186,
3142,
445,
71,
95292,
1827,
15454,
14702,
310,
7486,
20703,
983,
3142,
445,
14615,
1827,
15454,
73845,
286,
1727,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_7XNN() {
// 0x7XNN - Add the value NN to register VX
let opcode = 0x789A;
let mut vm = get_vm();
vm.v[0x8] = 0x11;
vm.execute_instruction(decode_opcode(opcode), opcode);
assert_eq!(vm.v[0x8], 0xAB);
} | rust_cleaned_test_functions.jsonl/247 | {
"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,
22,
55,
9745,
368,
341,
262,
442,
220,
15,
87,
22,
55,
9745,
481,
2691,
279,
897,
44678,
311,
4161,
78177,
271,
262,
1077,
30028,
284,
220,
15,
87,
22,
23,
24,
32,
280,
262,
1077,
5206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invalid_header_line() {
let mut buff = AsyncBuffer::new("FOOBAR\r\nHost: 0.0.0.0:8080\r\n\r\n");
let result = block_on(async { recognize(&mut buff).await });
assert!(result.is_err());
} | rust_cleaned_test_functions.jsonl/48178 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
8757,
6528,
368,
341,
220,
1077,
5206,
11522,
284,
21433,
4095,
486,
931,
445,
3788,
20608,
934,
12016,
1699,
9296,
25,
220,
15,
13,
15,
13,
15,
13,
15,
25,
23,
15,
23,
15,
12016,
169... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_explorer_transaction_statuses() {
use exonum::blockchain::TransactionResult;
use exonum::explorer::TransactionInfo;
let (mut testkit, api) = init_testkit();
let tx = {
let (pubkey, key) = crypto::gen_keypair();
TxIncrement::new(&pubkey, 5, &key)
};
let error_tx = {
let (pubkey, key) = crypto::gen_keypair();
TxIncrement::new(&pubkey, 0, &key)
};
let panicking_tx = {
let (pubkey, key) = crypto::gen_keypair();
TxIncrement::new(&pubkey, u64::max_value() - 3, &key)
};
let block = testkit.create_block_with_transactions(txvec![
tx.clone(),
error_tx.clone(),
panicking_tx.clone(),
]);
fn check_statuses(statuses: &[TransactionResult]) {
assert!(statuses[0].0.is_ok());
assert_matches!(
statuses[1],
TransactionResult(Err(ref err)) if err.error_type() == ErrorType::Code(0)
&& err.description() == Some("Adding zero does nothing!")
);
assert_matches!(
statuses[2],
TransactionResult(Err(ref err)) if err.error_type() == ErrorType::Panic
&& err.description() == Some("attempt to add with overflow")
);
}
// Check statuses retrieved from a block.
let statuses: Vec<_> = block
.transactions
.iter()
.map(|tx| TransactionResult(tx.status().map_err(Clone::clone)))
.collect();
check_statuses(&statuses);
let statuses: Vec<_> = [tx.hash(), error_tx.hash(), panicking_tx.hash()]
.iter()
.map(|hash| {
let info: TransactionInfo<Value> = api.public(ApiKind::Explorer)
.query(&TransactionQuery::new(*hash))
.get("v1/transactions")
.unwrap();
TransactionResult(info.as_committed().unwrap().status().map_err(Clone::clone))
})
.collect();
check_statuses(&statuses);
} | rust_cleaned_test_functions.jsonl/86878 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 925
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2702,
79825,
28884,
83702,
368,
341,
262,
990,
98744,
372,
486,
4574,
8819,
486,
8070,
2077,
280,
262,
990,
98744,
372,
486,
29892,
14827,
486,
8070,
1731,
401,
262,
1077,
320,
6984,
1273,
8226,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_int() {
with_graph(|graph| {
let integer: i64 = graph.query("RETURN 42").unwrap();
assert_eq!(integer, 42);
});
} | rust_cleaned_test_functions.jsonl/73407 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 78
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4042,
368,
341,
262,
448,
14738,
22428,
4439,
91,
341,
286,
1077,
7546,
25,
600,
21,
19,
284,
4771,
4786,
445,
51533,
220,
19,
17,
1827,
15454,
543,
286,
2060,
10714,
10297,
11662,
11,
220,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_nonced_failure_accounts_rollback_from_pays() {
let rent_collector = RentCollector::default();
let nonce_address = Pubkey::new_unique();
let nonce_authority = keypair_from_seed(&[0; 32]).unwrap();
let from = keypair_from_seed(&[1; 32]).unwrap();
let from_address = from.pubkey();
let to_address = Pubkey::new_unique();
let nonce_state = NonceVersions::new_current(NonceState::Initialized(
nonce::state::Data::new(nonce_authority.pubkey(), Hash::new_unique(), 0),
));
let nonce_account_post =
AccountSharedData::new_data(43, &nonce_state, &system_program::id()).unwrap();
let from_account_post = AccountSharedData::new(4199, 0, &Pubkey::default());
let to_account = AccountSharedData::new(2, 0, &Pubkey::default());
let nonce_authority_account = AccountSharedData::new(3, 0, &Pubkey::default());
let recent_blockhashes_sysvar_account = AccountSharedData::new(4, 0, &Pubkey::default());
let instructions = vec![
system_instruction::advance_nonce_account(&nonce_address, &nonce_authority.pubkey()),
system_instruction::transfer(&from_address, &to_address, 42),
];
let message = Message::new(&instructions, Some(&from_address));
let blockhash = Hash::new_unique();
let transaction_accounts = vec![
(message.account_keys[0], from_account_post),
(message.account_keys[1], nonce_authority_account),
(message.account_keys[2], nonce_account_post),
(message.account_keys[3], to_account),
(message.account_keys[4], recent_blockhashes_sysvar_account),
];
let tx = new_sanitized_tx(&[&nonce_authority, &from], message, blockhash);
let nonce_state = NonceVersions::new_current(NonceState::Initialized(
nonce::state::Data::new(nonce_authority.pubkey(), Hash::new_unique(), 0),
));
let nonce_account_pre =
AccountSharedData::new_data(42, &nonce_state, &system_program::id()).unwrap();
let from_account_pre = AccountSharedData::new(4242, 0, &Pubkey::default());
let nonce = Some(NonceFull::new(
nonce_address,
nonce_account_pre.clone(),
Some(from_account_pre.clone()),
));
let loaded = (
Ok(LoadedTransaction {
accounts: transaction_accounts,
program_indices: vec![],
rent: 0,
rent_debits: RentDebits::default(),
estimated_execution_cost: 0,
}),
nonce.clone(),
);
let mut loaded = vec![loaded];
let next_blockhash = Hash::new_unique();
let accounts = Accounts::new_with_config_for_tests(
Vec::new(),
&ClusterType::Development,
AccountSecondaryIndexes::default(),
false,
AccountShrinkThreshold::default(),
);
let txs = vec![tx];
let programs = vec![(
Err(TransactionError::InstructionError(
1,
InstructionError::InvalidArgument,
)),
nonce,
)];
let collected_accounts = accounts.collect_accounts_to_store(
&txs,
&programs,
loaded.as_mut_slice(),
&rent_collector,
&next_blockhash,
0,
true,
true, // leave_nonce_on_success
);
assert_eq!(collected_accounts.len(), 2);
assert_eq!(
collected_accounts
.iter()
.find(|(pubkey, _account)| *pubkey == &from_address)
.map(|(_pubkey, account)| *account)
.cloned()
.unwrap(),
from_account_pre,
);
let collected_nonce_account = collected_accounts
.iter()
.find(|(pubkey, _account)| *pubkey == &nonce_address)
.map(|(_pubkey, account)| *account)
.cloned()
.unwrap();
assert_eq!(
collected_nonce_account.lamports(),
nonce_account_pre.lamports(),
);
assert!(nonce_account::verify_nonce_account(
&collected_nonce_account,
&next_blockhash
));
} | rust_cleaned_test_functions.jsonl/49735 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21637,
1998,
43618,
55665,
62,
33559,
5673,
620,
942,
368,
341,
286,
1077,
8016,
10211,
27669,
284,
29737,
53694,
486,
2258,
1428,
286,
1077,
39676,
6744,
284,
22611,
792,
486,
931,
21218,
543,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_variables_valid_json() {
let form_string = r#"query=test&variables={"foo":"bar"}"#;
let mut items = FormItems::from(form_string);
let result = GraphQLRequest::from_form(&mut items, false);
assert!(result.is_ok());
let variables = ::serde_json::from_str::<InputValue>(r#"{"foo":"bar"}"#).unwrap();
let expected = GraphQLRequest(GraphQLBatchRequest::Single(http::GraphQLRequest::new(
"test".to_string(),
None,
Some(variables),
)));
assert_eq!(result.unwrap(), expected);
} | rust_cleaned_test_functions.jsonl/73210 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 270
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28182,
8337,
9455,
368,
341,
286,
1077,
1352,
3904,
284,
435,
55543,
1631,
53538,
5,
18616,
15783,
7975,
3252,
2257,
9207,
57676,
280,
286,
1077,
5206,
3589,
284,
3377,
4353,
486,
1499,
16760,
390... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_correct_value_multiple() {
let mut map = TypedHandleMap::new();
let handle1 = map.insert(Foobar(1234));
let handle2 = map.insert(Foobar(4321));
assert_eq!(map.get(handle1).unwrap(), &Foobar(1234));
assert_eq!(map.get(handle2).unwrap(), &Foobar(4321));
map.remove(handle1).unwrap();
assert_eq!(map.get(handle1), None);
assert_eq!(map.get(handle2).unwrap(), &Foobar(4321));
} | rust_cleaned_test_functions.jsonl/15921 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31550,
3142,
45233,
368,
341,
286,
1077,
5206,
2415,
284,
50554,
6999,
2227,
486,
931,
543,
286,
1077,
3705,
16,
284,
2415,
7030,
7832,
78,
31393,
7,
16,
17,
18,
19,
1106,
286,
1077,
3705,
17,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_default_config() -> Result<()> {
let expect = Config {
log: LogConfig::default(),
meta: MetaConfig::default(),
storage: StorageConfig::default(),
query: QueryConfig::default(),
config_file: "".to_string(),
};
let actual = Config::default();
assert_eq!(actual, expect);
let tom_expect = "config_file = \"\"
[query]
tenant_id = \"\"
cluster_id = \"\"
num_cpus = 8
mysql_handler_host = \"127.0.0.1\"
mysql_handler_port = 3307
max_active_sessions = 256
clickhouse_handler_host = \"127.0.0.1\"
clickhouse_handler_port = 9000
http_handler_host = \"127.0.0.1\"
http_handler_port = 8000
flight_api_address = \"127.0.0.1:9090\"
http_api_address = \"127.0.0.1:8080\"
metric_api_address = \"127.0.0.1:7070\"
api_tls_server_cert = \"\"
api_tls_server_key = \"\"
api_tls_server_root_ca_cert = \"\"
rpc_tls_server_cert = \"\"
rpc_tls_server_key = \"\"
rpc_tls_query_server_root_ca_cert = \"\"
rpc_tls_query_service_domain_name = \"localhost\"
[log]
log_level = \"INFO\"
log_dir = \"./_logs\"
[meta]
meta_embedded_dir = \"./_meta_embedded\"
meta_address = \"\"
meta_username = \"root\"
meta_password = \"\"
meta_client_timeout_in_second = 10
rpc_tls_meta_server_root_ca_cert = \"\"
rpc_tls_meta_service_domain_name = \"localhost\"
[storage]
storage_type = \"disk\"
[storage.disk]
data_path = \"\"
[storage.s3]
region = \"\"
endpoint_url = \"\"
access_key_id = \"\"
secret_access_key = \"\"
bucket = \"\"
[storage.azure_storage_blob]
account = \"\"
master_key = \"\"
container = \"\"
";
let tom_actual = toml::to_string(&actual).unwrap();
assert_eq!(tom_actual, tom_expect);
Ok(())
} | rust_cleaned_test_functions.jsonl/20223 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 700
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9993,
5332,
368,
1464,
5714,
71698,
341,
262,
1077,
1720,
284,
5532,
341,
286,
1487,
25,
2835,
2648,
486,
2258,
3148,
286,
8823,
25,
15819,
2648,
486,
2258,
3148,
286,
5819,
25,
14693,
2648,
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_escape() {
let line = " Mary had\ta little \n\t lamb\t";
let output = escape(line).expect("error processing string");
assert_eq!(output, " Mary had\\ta little \\n\\t lamb\\t");
} | rust_cleaned_test_functions.jsonl/85265 | {
"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,
21832,
368,
341,
286,
1077,
1555,
284,
330,
10244,
256,
1030,
59,
2565,
2632,
220,
1124,
77,
4955,
38306,
4955,
876,
286,
1077,
2550,
284,
12449,
8797,
568,
17119,
445,
841,
8692,
914,
797,
286,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_terminal_in_each_set_open() {
let test_str = "123m111p7999s 789m 8s";
let test = Hand::from(test_str);
let test_analyzer = HandAnalyzer::new(&test).unwrap();
let mut status = Status::new();
let settings = Settings::new();
status.has_claimed_open = true;
assert_eq!(
check_terminal_in_each_set(&test_analyzer, &status, &settings).unwrap(),
("純全帯么九(鳴)", true, 2)
);
} | rust_cleaned_test_functions.jsonl/91437 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 248
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64309,
1243,
32046,
2602,
11311,
368,
341,
286,
1077,
1273,
2895,
284,
330,
16,
17,
18,
76,
16,
16,
16,
79,
22,
24,
24,
24,
82,
220,
22,
23,
24,
76,
220,
23,
82,
876,
286,
1077,
1273,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_defer_unwind_2() {
let drops = Cell::new(0);
{
defer_on_unwind!(drops.set(1));
}
assert_eq!(drops.get(), 0);
} | rust_cleaned_test_functions.jsonl/19990 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 108
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7844,
261,
4907,
19154,
62,
17,
368,
341,
286,
1077,
21025,
284,
13972,
486,
931,
7,
15,
317,
286,
341,
310,
17956,
4470,
4907,
19154,
10297,
90512,
980,
7,
16,
1106,
286,
456,
286,
2060,
1071... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_0113_example_1() {
let root = tree![5, 4, 8, 11, null, 13, 4, 7, 2, null, null, 5, 1];
let target_sum = 22;
let result = vec![vec![5, 4, 11, 2], vec![5, 8, 4, 5]];
assert_eq!(Solution::path_sum(root, target_sum), result);
} | rust_cleaned_test_functions.jsonl/5729 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 146
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
15,
16,
16,
18,
39304,
62,
16,
368,
341,
286,
1077,
3704,
284,
4916,
20703,
20,
11,
220,
19,
11,
220,
23,
11,
220,
16,
16,
11,
845,
11,
220,
16,
18,
11,
220,
19,
11,
220,
22,
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_time_of_day() {
assert_eq!(parse_time_of_day("08:52:32"), Ok((8, 52, Some(32), "")));
assert_eq!(
parse_time_of_day("99 : \r\n\t99(comment): 99test"),
Ok((99, 99, Some(99), "test"))
);
assert_eq!(parse_time_of_day("23:09"), Ok((23, 9, None, "")));
assert_eq!(
parse_time_of_day("23:09 \r\n (comment) test:"),
Ok((23, 9, None, " \r\n (comment) test:"))
);
} | rust_cleaned_test_functions.jsonl/100507 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 272
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
3009,
3575,
16763,
368,
341,
286,
2060,
10714,
10297,
6400,
3009,
3575,
16763,
445,
15,
23,
25,
20,
17,
25,
18,
17,
3975,
7622,
1188,
23,
11,
220,
20,
17,
11,
4329,
7,
18,
17,
701,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_put_machine_config_request() {
assert!(parse_put_machine_config(&Body::new("invalid_payload")).is_err());
let config_clone = VmConfig {
vcpu_count: Some(8),
mem_size_mib: Some(1024),
ht_enabled: Some(true),
cpu_template: Some(CpuFeaturesTemplate::T2),
};
let body = r#"{
"vcpu_count": 8,
"mem_size_mib": 1024,
"ht_enabled": true,
"cpu_template": "T2"
}"#;
match parse_put_machine_config(&Body::new(body)) {
Ok(ParsedRequest::Sync(VmmAction::SetVmConfiguration(config))) => {
assert_eq!(config, config_clone)
}
_ => panic!("Test failed."),
}
let body = r#"{
"vcpu_count": 8,
"mem_size_mib": 1024
}"#;
assert!(parse_put_machine_config(&Body::new(body)).is_err());
} | rust_cleaned_test_functions.jsonl/33419 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 551
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
15557,
38695,
5332,
7893,
368,
341,
286,
2060,
10297,
6400,
15557,
38695,
5332,
2099,
5444,
486,
931,
445,
11808,
32813,
15197,
285,
9266,
5231,
286,
1077,
2193,
54742,
284,
647,
76,
2648,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_instantiate() {
let funds = Coin::new(100_000_000, "udesmos");
let custom = mock_dependencies_with_custom_querier(&[funds]);
let (instance_options, memory_limit) = mock_instance_options();
let info = mock_info("addr0001", &[]);
let mut deps = Instance::from_code(WASM, custom, instance_options, memory_limit).unwrap();
let instantiate_msg = InstantiateMsg {
token_denom: "udesmos".to_string(),
};
let res: Response = instantiate(&mut deps, mock_env(), info, instantiate_msg).unwrap();
assert_eq!(0, res.messages.len());
let exp_log = vec![attr("action", "set_token_denom")];
assert_eq!(res.attributes, exp_log);
// make sure that the state is set
deps.with_storage(|storage| {
let key = to_length_prefixed(TOKEN_DENOM_KEY);
let data = storage.get(&key).0.unwrap().unwrap();
let token_denom = String::from_utf8(data).unwrap();
assert_eq!(token_denom, "\"udesmos\"");
Ok(())
})
.unwrap();
} | rust_cleaned_test_functions.jsonl/67196 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 419
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
42251,
368,
341,
262,
1077,
10514,
284,
26233,
486,
931,
7,
16,
15,
15,
62,
15,
15,
15,
62,
15,
15,
15,
11,
330,
28146,
8631,
797,
262,
1077,
2526,
284,
7860,
71841,
6615,
15875,
11280... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_edge_references_undirected() {
let g: UnMatrix<char, bool> = UnMatrix::from_edges(&[
(0, 5),
(0, 2),
(0, 3),
(0, 1),
(1, 3),
(2, 3),
(2, 4),
(4, 0),
(6, 6),
]);
assert_eq!(g.edge_references().count(), 9);
} | rust_cleaned_test_functions.jsonl/81974 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 244
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17932,
92702,
62,
1241,
74612,
368,
341,
286,
1077,
342,
25,
1230,
6689,
21919,
11,
1807,
29,
284,
1230,
6689,
486,
1499,
28026,
2099,
9640,
310,
320,
15,
11,
220,
20,
1326,
310,
320,
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_signature_rsa_primitive_verification() {
test::from_file("src/rsa/rsa_primitive_verify_tests.txt",
|section, test_case| {
assert_eq!(section, "");
let n = test_case.consume_bytes("n");
let e = test_case.consume_bytes("e");
let msg = test_case.consume_bytes("Msg");
let sig = test_case.consume_bytes("Sig");
let expected = test_case.consume_string("Result");
let result = signature::primitive::verify_rsa(
&signature::RSA_PKCS1_2048_8192_SHA256,
(untrusted::Input::from(&n), untrusted::Input::from(&e)),
untrusted::Input::from(&msg), untrusted::Input::from(&sig));
assert_eq!(result.is_ok(), expected == "Pass");
Ok(())
})
} | rust_cleaned_test_functions.jsonl/2958 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 436
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39859,
82522,
84087,
84245,
368,
341,
286,
1273,
486,
1499,
2458,
445,
3548,
14,
60869,
14,
60869,
84087,
35638,
32509,
3909,
756,
664,
760,
2809,
11,
1273,
19096,
91,
341,
310,
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_umask_create() {
let old_mask = umask(0o077);
let tmpdir = tempfile::tempdir().unwrap();
let tmpdir_fd = crate::open(
tmpdir.path(),
OFlag::O_RDONLY | OFlag::O_DIRECTORY | OFlag::O_CLOEXEC,
0,
)
.unwrap();
let tmpdir_a = tmpdir.path().join("a");
mkdir(&tmpdir_a, 0o777).unwrap();
assert_eq!(stat(&tmpdir_a).unwrap().mode() & 0o777, 0o700);
mkdirat(tmpdir_fd.fd(), "b", 0o777).unwrap();
assert_eq!(
fstatat(tmpdir_fd.fd(), "b", crate::AtFlag::empty())
.unwrap()
.mode()
& 0o777,
0o700
);
drop(
crate::openat(
tmpdir_fd.fd(),
"c",
OFlag::O_WRONLY | OFlag::O_CLOEXEC | OFlag::O_CREAT | OFlag::O_EXCL,
0o666,
)
.unwrap(),
);
assert_eq!(
fstatat(tmpdir_fd.fd(), "c", crate::AtFlag::empty())
.unwrap()
.mode()
& 0o777,
0o600
);
assert_eq!(umask(old_mask), 0o077);
} | rust_cleaned_test_functions.jsonl/43166 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 749
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
72063,
1073,
8657,
368,
341,
286,
1077,
2310,
9999,
284,
4443,
1073,
7,
15,
78,
15,
22,
22,
626,
286,
1077,
4174,
3741,
284,
54819,
486,
3888,
3741,
1005,
15454,
543,
286,
1077,
4174,
3741,
17... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_account_address_canonical_serialization_example() {
let input = AccountAddress::new([
0xca, 0x82, 0x0b, 0xf9, 0x30, 0x5e, 0xb9, 0x7d, 0x0d, 0x78, 0x4f, 0x71, 0xb3, 0x95, 0x54,
0x57,
]);
let expected_output: Vec<u8> = vec![
0xCA, 0x82, 0x0B, 0xF9, 0x30, 0x5E, 0xB9, 0x7D, 0x0D, 0x78, 0x4F, 0x71, 0xB3, 0x95, 0x54,
0x57,
];
let actual_output = to_bytes(&input).unwrap();
assert_eq!(expected_output, actual_output);
} | rust_cleaned_test_functions.jsonl/8051 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 278
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13500,
6744,
27421,
22391,
25602,
2022,
39304,
368,
341,
262,
1077,
1946,
284,
8615,
4286,
486,
931,
8956,
286,
220,
15,
56071,
11,
220,
15,
87,
23,
17,
11,
220,
15,
87,
15,
65,
11,
220,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_print_change_pub_key_for_protocol() {
let mut rng = XorShiftRng::from_seed([1, 2, 3, 4]);
let key = gen_pk_and_msg().0;
PubKeyHash::from_privkey(&key);
let transfer = ChangePubKey::new_signed(
gen_account_id(&mut rng),
Address::from(rng.gen::<[u8; 20]>()),
PubKeyHash::from_privkey(&key),
gen_token_id(&mut rng),
BigUint::from(56_700_000_000u64),
Nonce(rng.gen()),
Default::default(),
None,
&key,
)
.expect("failed to sign transfer");
println!(
"User representation:\n{}\n",
serde_json::to_string_pretty(&transfer).expect("json serialize")
);
println!("Signer:");
println!("Private key: {}", key.0);
let (pk_x, pk_y) = public_key_from_private(&key).0.into_xy();
println!("Public key: x: {}, y: {}\n", pk_x, pk_y);
let signed_fields = vec![
("type", vec![255u8 - ChangePubKey::TX_TYPE]),
("version", vec![CURRENT_TX_VERSION]),
("accountId", transfer.account_id.to_be_bytes().to_vec()),
("account", transfer.account.as_bytes().to_vec()),
("new_pub_key_hash", transfer.new_pk_hash.data.to_vec()),
("token", transfer.fee_token.to_be_bytes().to_vec()),
("fee", pack_fee_amount(&transfer.fee)),
("nonce", transfer.nonce.to_be_bytes().to_vec()),
(
"time_range",
transfer
.time_range
.expect("no time range on transfer")
.as_be_bytes()
.to_vec(),
),
];
println!("Signed transaction fields:");
let mut field_concat = Vec::new();
for (field, value) in signed_fields.into_iter() {
println!("{}: 0x{}", field, hex::encode(&value));
field_concat.extend(value.into_iter());
}
println!("Signed bytes: 0x{}", hex::encode(&field_concat));
assert_eq!(
field_concat,
transfer.get_bytes(),
"Protocol serialization mismatch"
);
} | rust_cleaned_test_functions.jsonl/118955 | {
"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,
10064,
15947,
34014,
3097,
5478,
34880,
368,
341,
262,
1077,
5206,
28422,
284,
1599,
269,
24841,
49,
968,
486,
1499,
33809,
2561,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
2558,
262,
1077,
13... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_no_need_to_rewrite_delete_file_if_no_new_deletes() {
let mut schema_builder = schema::Schema::builder();
let text_field = schema_builder.add_text_field("text", schema::TEXT);
let index = Index::create_in_ram(schema_builder.build());
let mut index_writer = index.writer_for_tests().unwrap();
index_writer
.add_document(doc!(text_field => "hello1"))
.unwrap();
index_writer
.add_document(doc!(text_field => "hello2"))
.unwrap();
assert!(index_writer.commit().is_ok());
let reader = index.reader().unwrap();
let searcher = reader.searcher();
assert_eq!(searcher.segment_readers().len(), 1);
assert_eq!(searcher.segment_reader(0u32).num_docs(), 2);
index_writer.delete_term(Term::from_field_text(text_field, "hello1"));
assert!(index_writer.commit().is_ok());
assert!(reader.reload().is_ok());
let searcher = reader.searcher();
assert_eq!(searcher.segment_readers().len(), 1);
assert_eq!(searcher.segment_reader(0u32).num_docs(), 1);
let previous_delete_opstamp = index.load_metas().unwrap().segments[0].delete_opstamp();
// All docs containing hello1 have been already removed.
// We should not update the delete meta.
index_writer.delete_term(Term::from_field_text(text_field, "hello1"));
assert!(index_writer.commit().is_ok());
assert!(reader.reload().is_ok());
let searcher = reader.searcher();
assert_eq!(searcher.segment_readers().len(), 1);
assert_eq!(searcher.segment_reader(0u32).num_docs(), 1);
let after_delete_opstamp = index.load_metas().unwrap().segments[0].delete_opstamp();
assert_eq!(after_delete_opstamp, previous_delete_opstamp);
} | rust_cleaned_test_functions.jsonl/21494 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 812
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
71506,
2346,
74052,
11353,
2458,
11119,
6536,
5921,
2259,
13881,
368,
341,
286,
1077,
5206,
10802,
28532,
284,
10802,
486,
8632,
486,
17850,
543,
286,
1077,
1467,
5013,
284,
10802,
28532,
1364... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_map_as_tuple_list() {
use std::net::IpAddr;
let ip = "1.2.3.4".parse().unwrap();
let ip2 = "255.255.255.255".parse().unwrap();
#[serde_as]
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct StructBTree {
#[serde_as(as = "Vec<(DisplayFromStr, DisplayFromStr)>")]
values: BTreeMap<u32, IpAddr>,
};
let map: BTreeMap<_, _> = vec![(1, ip), (10, ip), (200, ip2)].into_iter().collect();
is_equal(
StructBTree {
values: map.clone(),
},
r#"{"values":[["1","1.2.3.4"],["10","1.2.3.4"],["200","255.255.255.255"]]}"#,
);
#[serde_as]
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct StructBTree2 {
#[serde_as(as = "Vec<(Same, DisplayFromStr)>")]
values: BTreeMap<u32, IpAddr>,
};
is_equal(
StructBTree2 { values: map },
r#"{"values":[[1,"1.2.3.4"],[10,"1.2.3.4"],[200,"255.255.255.255"]]}"#,
);
#[serde_as]
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct StructHash {
#[serde_as(as = "Vec<(DisplayFromStr, DisplayFromStr)>")]
values: HashMap<u32, IpAddr>,
};
// HashMap serialization tests with more than 1 entry are unrelyable
let map1: HashMap<_, _> = vec![(200, ip2)].into_iter().collect();
let map: HashMap<_, _> = vec![(1, ip), (10, ip), (200, ip2)].into_iter().collect();
is_equal(
StructHash {
values: map1.clone(),
},
r#"{"values":[["200","255.255.255.255"]]}"#,
);
check_deserialization(
StructHash {
values: map.clone(),
},
r#"{"values":[["1","1.2.3.4"],["10","1.2.3.4"],["200","255.255.255.255"]]}"#,
);
check_error_deserialization::<StructHash>(
r#"{"values":{"200":"255.255.255.255"}}"#,
"invalid type: map, expected a sequence at line 1 column 10",
);
#[serde_as]
#[derive(Debug, Serialize, Deserialize, PartialEq)]
struct StructHash2 {
#[serde_as(as = "Vec<(Same, DisplayFromStr)>")]
values: HashMap<u32, IpAddr>,
};
is_equal(
StructHash2 { values: map1 },
r#"{"values":[[200,"255.255.255.255"]]}"#,
);
check_deserialization(
StructHash2 { values: map },
r#"{"values":[[1,"1.2.3.4"],[10,"1.2.3.4"],[200,"255.255.255.255"]]}"#,
);
check_error_deserialization::<StructHash2>(
r#"{"values":1}"#,
"invalid type: integer `1`, expected a sequence at line 1 column 11",
);
} | rust_cleaned_test_functions.jsonl/23045 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1265
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5376,
11898,
21773,
2019,
368,
341,
262,
990,
1460,
486,
4711,
486,
23378,
13986,
280,
262,
1077,
5997,
284,
330,
16,
13,
17,
13,
18,
13,
19,
3263,
6400,
1005,
15454,
543,
262,
1077,
5997,
17,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_replace_job_id() {
let mut program = program_def(
"dir-%{JOB_ID}-%{TASK_ID}",
Some("%{JOB_ID}-%{TASK_ID}.out"),
Some("%{JOB_ID}-%{TASK_ID}.err"),
"",
5,
1,
);
replace_placeholders_worker(&mut program);
assert_eq!(program.cwd, Some("dir-5-1".into()));
assert_eq!(program.stdout, StdioDef::File("5-1.out".into()));
assert_eq!(program.stderr, StdioDef::File("5-1.err".into()));
} | rust_cleaned_test_functions.jsonl/107296 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 305
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10633,
20298,
842,
368,
341,
286,
1077,
5206,
2025,
284,
2025,
7844,
1006,
310,
330,
3741,
11069,
90,
74879,
3450,
92,
11069,
90,
65813,
3450,
24375,
310,
4329,
4430,
90,
74879,
3450,
92,
11069,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invite_detail_abbr() {
let invite_detail: Value = serde_json::from_str(INVITE_DETAIL_STRING).unwrap();
let abbr = abbrv_event_detail(invite_detail).unwrap();
let abbr_obj = abbr.as_object().unwrap();
assert_eq!(abbr_obj.get("sc").unwrap(), "MS-101")
} | rust_cleaned_test_functions.jsonl/34226 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
94910,
14480,
22885,
1323,
368,
341,
286,
1077,
21399,
14480,
25,
5162,
284,
61570,
9455,
486,
1499,
2895,
23515,
53,
5991,
32905,
12283,
568,
15454,
543,
286,
1077,
668,
1323,
284,
668,
1323,
85,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_naive_tf_make_term_vector(){
let terms = vec!["brown".to_string(), "fox".to_string(), "jumps".to_string()];
let tkns = vec!["red".to_string(), "fox".to_string().to_string()];
let tv = make_term_vector(&terms, &tkns);
assert_eq!(3, tv.len());
assert_eq!(vec![0, 1, 0], tv);
} | rust_cleaned_test_functions.jsonl/64508 | {
"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,
58631,
533,
47719,
28230,
17464,
12247,
3032,
262,
1077,
3793,
284,
7486,
0,
1183,
64461,
3263,
983,
3904,
1507,
330,
15011,
3263,
983,
3904,
1507,
330,
73,
11793,
3263,
983,
3904,
33800,
262,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rebase_empty_account() {
let pubkey = Pubkey::default();
let message = rebase_stake_account(&pubkey, &pubkey, 0, &pubkey, &pubkey, 0);
assert_eq!(message, None);
} | rust_cleaned_test_functions.jsonl/21749 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
3152,
15124,
13500,
368,
341,
286,
1077,
95116,
284,
22611,
792,
486,
2258,
543,
286,
1077,
1943,
284,
312,
3152,
1261,
726,
13500,
2099,
9585,
792,
11,
609,
9585,
792,
11,
220,
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 |
#[test]
fn test_subplan_produces_crate_root_with_forward_slash() {
let planner = BuildPlannerImpl::new(
dummy_workspace_crate_metadata(templates::SUBPLAN_PRODUCES_CRATE_ROOT_WITH_FORWARD_SLASH),
dummy_raze_settings(),
);
let planned_build = planner
.plan_build(Some(PlatformDetails::new(
"some_target_triple".to_owned(),
Vec::new(), /* attrs */
)))
.unwrap();
assert_eq!(
planned_build.crate_contexts[0].targets[0].path,
"src/lib.rs"
);
} | rust_cleaned_test_functions.jsonl/31793 | {
"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,
5228,
10393,
2540,
1054,
1603,
666,
7698,
12993,
6615,
32121,
11886,
988,
368,
341,
262,
1077,
49711,
284,
7854,
2120,
4887,
9673,
486,
931,
1006,
414,
17292,
75560,
666,
7698,
22220,
7,
15463,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_merge_bu_len1() {
let mut vector_in = vec![1];
merge_bottom_up_sort(&mut vector_in);
debug_assert_eq!(vector_in, vec![1]);
} | rust_cleaned_test_functions.jsonl/25085 | {
"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,
20888,
880,
84,
6043,
16,
368,
341,
286,
1077,
5206,
4621,
1243,
284,
7486,
20703,
16,
935,
286,
10880,
25473,
8237,
18435,
2099,
6984,
4621,
1243,
317,
286,
7390,
16553,
10714,
10297,
3215,
1243,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_timeout() {
exec! {
"sleep",
args: ["60"],
timeout: 3000,
log: true,
code: 1,
stdout: [],
stderr: []
};
} | rust_cleaned_test_functions.jsonl/72688 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20537,
368,
341,
262,
3883,
0,
341,
286,
330,
25809,
756,
286,
2827,
25,
4383,
21,
15,
8097,
286,
9632,
25,
220,
18,
15,
15,
15,
345,
286,
1487,
25,
830,
3554,
286,
2038,
25,
220,
16,
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 |
#[test]
fn test_pipe() {
let mut pipe = new_pipe();
let (file_bytes, file_size) = read_file();
let mut decrypt_nonce = pipe.decrypt_nonce.clone();
let mut encrypt_nonce = pipe.encrypt_nonce.clone();
let (header,decrypted_bytes) = encrypt_and_decrypt_with_pipe(DEFAULT_CHUNK_SIZE, &file_bytes, file_size, &mut pipe);
check_header(header, DEFAULT_CHUNK_SIZE, file_size);
check_decrypted_bytes(&file_bytes, &decrypted_bytes);
check_pipe_nonces(&mut pipe, &mut decrypt_nonce, &mut encrypt_nonce);
let (header,decrypted_bytes) = encrypt_and_decrypt_with_pipe(ALTERNATE_CHUNK_SIZE, &file_bytes, file_size, &mut pipe);
check_header(header, ALTERNATE_CHUNK_SIZE, file_size);
check_decrypted_bytes(&file_bytes, &decrypted_bytes);
check_pipe_nonces(&mut pipe, &mut decrypt_nonce, &mut encrypt_nonce);
example::pipe();
} | rust_cleaned_test_functions.jsonl/108997 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 395
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41862,
368,
1476,
286,
1077,
5206,
13647,
284,
501,
41862,
543,
286,
1077,
320,
1192,
12524,
11,
1034,
2368,
8,
284,
1349,
2458,
1428,
286,
1077,
5206,
38126,
48508,
284,
13647,
80315,
48508,
1599... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_str_errors() {
fn parse_error(e: &str) -> result::Result<Version, SemVerError> {
return Err(SemVerError::ParseError(e.to_string()));
}
assert_eq!("".parse(), parse_error("Error parsing major identifier"));
assert_eq!(" ".parse(), parse_error("Error parsing major identifier"));
assert_eq!("1".parse(), parse_error("Expected dot"));
assert_eq!("1.2".parse(),
parse_error("Expected dot"));
assert_eq!("1.2.3-".parse(),
parse_error("Error parsing prerelease"));
assert_eq!("a.b.c".parse(),
parse_error("Error parsing major identifier"));
assert_eq!("1.2.3 abc".parse(),
parse_error("Extra junk after valid version: abc"));
} | rust_cleaned_test_functions.jsonl/92930 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 379
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
2895,
20196,
368,
341,
286,
5168,
4715,
4096,
2026,
25,
609,
495,
8,
1464,
1102,
486,
2077,
27,
5637,
11,
14248,
10141,
1454,
29,
341,
310,
470,
15495,
3759,
336,
10141,
1454,
486,
14463,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_message_fragmentation_deterministic() {
let max_transmit_size = 500;
let config = crate::GossipsubConfigBuilder::default()
.max_transmit_size(max_transmit_size)
.validation_mode(ValidationMode::Permissive)
.build()
.unwrap();
let gs: Gossipsub = Gossipsub::new(MessageAuthenticity::RandomAuthor, config).unwrap();
// Message under the limit should be fine.
let mut rpc = empty_rpc();
rpc.messages.push(test_message());
let mut rpc_proto = rpc.clone().into_protobuf();
let fragmented_messages = gs.fragment_message(rpc_proto.clone()).unwrap();
assert_eq!(
fragmented_messages,
vec![rpc_proto.clone()],
"Messages under the limit shouldn't be fragmented"
);
// Messages over the limit should be split
while rpc_proto.encoded_len() < max_transmit_size {
rpc.messages.push(test_message());
rpc_proto = rpc.clone().into_protobuf();
}
let fragmented_messages = gs
.fragment_message(rpc_proto)
.expect("Should be able to fragment the messages");
assert!(
fragmented_messages.len() > 1,
"the message should be fragmented"
);
// all fragmented messages should be under the limit
for message in fragmented_messages {
assert!(
message.encoded_len() < max_transmit_size,
"all messages should be less than the transmission size"
);
}
} | rust_cleaned_test_functions.jsonl/93687 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 752
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6462,
43012,
367,
814,
16483,
4532,
368,
341,
286,
1077,
1932,
7965,
1763,
2368,
284,
220,
20,
15,
15,
280,
286,
1077,
2193,
284,
17717,
486,
38,
41473,
1966,
2648,
3297,
486,
2258,
741,
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... | 3 |
#[test]
fn test_to_state_tag() {
assert_eq!(&to_state_tag("sensor", "key"), "#sensor.key");
assert_eq!(&to_state_tag("sensor_1", "key_1"), "#sensor_1.key_1");
} | rust_cleaned_test_functions.jsonl/72136 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
4387,
9372,
368,
341,
286,
2060,
10714,
0,
2099,
983,
4387,
9372,
445,
29511,
497,
330,
792,
3975,
5869,
29511,
4735,
797,
286,
2060,
10714,
0,
2099,
983,
4387,
9372,
445,
29511,
62,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_matches_did() {
let did: IotaDID = IotaDID::new(b"").unwrap();
assert!(Network::matches_did(Network::Mainnet, &did));
assert!(!Network::matches_did(Network::Testnet, &did));
let did: IotaDID = IotaDID::with_network(b"", "test").unwrap();
assert!(Network::matches_did(Network::Testnet, &did));
assert!(!Network::matches_did(Network::Mainnet, &did));
} | rust_cleaned_test_functions.jsonl/91324 | {
"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,
38344,
814,
307,
368,
341,
262,
1077,
1521,
25,
358,
6089,
35,
915,
284,
358,
6089,
35,
915,
486,
931,
1883,
1,
1827,
15454,
543,
262,
2060,
10297,
12320,
486,
19914,
814,
307,
77623,
486,
620... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_arithmetic_real() {
let tests = vec![
(
ScalarFuncSig::PlusReal,
Datum::F64(1.01001),
Datum::F64(-0.01),
Datum::F64(1.00001),
),
(
ScalarFuncSig::MinusReal,
Datum::F64(1.01001),
Datum::F64(-0.01),
Datum::F64(1.02001),
),
(
ScalarFuncSig::MultiplyReal,
Datum::F64(1.01001),
Datum::F64(-0.01),
Datum::F64(-0.0101001),
),
(
ScalarFuncSig::DivideReal,
Datum::F64(2.0),
Datum::F64(0.3),
Datum::F64(6.666666666666667),
),
(
ScalarFuncSig::DivideReal,
Datum::F64(44.3),
Datum::F64(0.000),
Datum::Null,
),
(
ScalarFuncSig::DivideReal,
Datum::Null,
Datum::F64(1.0),
Datum::Null,
),
(
ScalarFuncSig::DivideReal,
Datum::F64(1.0),
Datum::Null,
Datum::Null,
), // TODO: support precision in divide.
(
ScalarFuncSig::ModReal,
Datum::F64(1.0),
Datum::F64(1.1),
Datum::F64(1.0),
),
(
ScalarFuncSig::ModReal,
Datum::F64(-1.0),
Datum::F64(1.1),
Datum::F64(-1.0),
),
(
ScalarFuncSig::ModReal,
Datum::F64(1.0),
Datum::F64(-1.1),
Datum::F64(1.0),
),
(
ScalarFuncSig::ModReal,
Datum::F64(-1.0),
Datum::F64(-1.1),
Datum::F64(-1.0),
),
(
ScalarFuncSig::ModReal,
Datum::F64(1.0),
Datum::F64(0.0),
Datum::Null,
),
];
let mut ctx = EvalContext::default();
for tt in tests {
let lhs = datum_expr(tt.1);
let rhs = datum_expr(tt.2);
let op = Expression::build(&mut ctx, scalar_func_expr(tt.0, &[lhs, rhs])).unwrap();
let got = op.eval(&mut ctx, &[]).unwrap();
assert_eq!(got, tt.3);
}
} | rust_cleaned_test_functions.jsonl/82065 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1949
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25842,
25922,
15266,
368,
341,
286,
1077,
7032,
284,
7486,
90515,
310,
2399,
394,
35176,
9626,
47246,
486,
21807,
12768,
345,
394,
68459,
486,
37,
21,
19,
7,
16,
13,
15,
16,
15,
15,
16,
1326,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_execution_summary() {
let helper = TableScanTestHelper::new();
let mut executor = BatchTableScanExecutor::new(
helper.store(),
Arc::new(EvalConfig::default()),
helper.columns_info_by_idx(&[0]),
vec![helper.whole_table_range()],
vec![],
false,
false,
vec![],
)
.unwrap()
.collect_summary(1);
executor.next_batch(1);
executor.next_batch(2);
let mut s = ExecuteStats::new(2);
executor.collect_exec_stats(&mut s);
assert_eq!(s.scanned_rows_per_range.len(), 1);
assert_eq!(s.scanned_rows_per_range[0], 3);
// 0 remains Default because our output index is 1
assert_eq!(s.summary_per_executor[0], ExecSummary::default());
let exec_summary = s.summary_per_executor[1];
assert_eq!(3, exec_summary.num_produced_rows);
assert_eq!(2, exec_summary.num_iterations);
executor.collect_exec_stats(&mut s);
// Collected statistics remain unchanged because of no newly generated delta statistics.
assert_eq!(s.scanned_rows_per_range.len(), 2);
assert_eq!(s.scanned_rows_per_range[0], 3);
assert_eq!(s.scanned_rows_per_range[1], 0);
assert_eq!(s.summary_per_executor[0], ExecSummary::default());
let exec_summary = s.summary_per_executor[1];
assert_eq!(3, exec_summary.num_produced_rows);
assert_eq!(2, exec_summary.num_iterations);
// Reset collected statistics so that now we will only collect statistics in this round.
s.clear();
executor.next_batch(10);
executor.collect_exec_stats(&mut s);
assert_eq!(s.scanned_rows_per_range.len(), 1);
assert_eq!(s.scanned_rows_per_range[0], 2);
assert_eq!(s.summary_per_executor[0], ExecSummary::default());
let exec_summary = s.summary_per_executor[1];
assert_eq!(2, exec_summary.num_produced_rows);
assert_eq!(1, exec_summary.num_iterations);
} | rust_cleaned_test_functions.jsonl/10379 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 962
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60948,
27251,
368,
341,
286,
1077,
13137,
284,
6633,
26570,
2271,
5511,
486,
931,
1428,
286,
1077,
5206,
31558,
284,
33904,
2556,
26570,
25255,
486,
931,
1006,
310,
13137,
16114,
3148,
310,
19689,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sha2() {
let output256 = hash::<Sha256>(b"This is a test of Sha256");
assert_eq!(
output256,
[
0x35, 0xa4, 0x23, 0xc9, 0x61, 0x9e, 0xc6, 0xc5, 0x63, 0x41, 0x89, 0x1b, 0xd2, 0xef,
0x26, 0x92, 0x27, 0x6b, 0xa4, 0x1a, 0x00, 0x5d, 0x0b, 0xab, 0x30, 0x18, 0x0a, 0x6f,
0x09, 0xc6, 0x95, 0x47
]
);
let output512 = hash::<Sha512>(b"This is a test of Sha512");
let expected512: [u8; 64] = [
0x89, 0x59, 0x8a, 0x74, 0xe3, 0x51, 0x62, 0xcf, 0xd2, 0x8b, 0x80, 0x9d, 0x32, 0x06,
0x18, 0x12, 0x6c, 0x84, 0x4a, 0xfa, 0xb2, 0xcb, 0xe4, 0x2d, 0xd0, 0x6d, 0xf6, 0xf1,
0xd3, 0xba, 0xcc, 0x60, 0x13, 0x09, 0x62, 0x95, 0x1d, 0x51, 0x68, 0xcc, 0xf8, 0xd1,
0xc8, 0x05, 0xfc, 0x4d, 0xde, 0xc7, 0x9d, 0x76, 0x6b, 0xe8, 0x08, 0x00, 0x8b, 0xcd,
0xe6, 0x1c, 0x47, 0xc0, 0x7a, 0x8a, 0xa7, 0xdf,
];
assert_eq!(output512.len(), expected512.len());
for i in 0..expected512.len() {
if output512[i] != expected512[i] {
assert!(false);
}
}
let output160 = hash_ripemd160(b"Ian-Kry");
assert_eq!(
output160,
[
0xbe, 0x64, 0x6f, 0x38, 0x8a, 0xf0, 0x5e, 0x6e, 0xaa, 0x4b, 0xcd, 0x0f, 0xaa, 0xcb,
0x2a, 0x1d, 0x68, 0x58, 0x43, 0x51
]
);
} | rust_cleaned_test_functions.jsonl/52027 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1005
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48836,
17,
368,
341,
286,
1077,
2550,
17,
20,
21,
284,
5175,
27638,
62316,
17,
20,
21,
2235,
65,
21520,
374,
264,
1273,
315,
27970,
17,
20,
21,
3071,
286,
2060,
10714,
33673,
310,
2550,
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_modexp() {
for (test, test_gas) in TESTS.iter().zip(BYZANTIUM_GAS.iter()) {
let input = hex::decode(&test.input).unwrap();
let res = berlin_run(&input, *test_gas).unwrap().output;
let expected = hex::decode(&test.expected).unwrap();
assert_eq!(res, expected, "test:{}", test.name);
}
} | rust_cleaned_test_functions.jsonl/3820 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 184
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7480,
4580,
368,
341,
286,
369,
320,
1944,
11,
1273,
82116,
8,
304,
13602,
50,
19471,
1005,
9964,
5349,
40209,
87622,
2794,
2646,
1911,
19471,
2140,
341,
310,
1077,
1946,
284,
12371,
486,
18196,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_copy_from_slice() {
let s: &[u32] = &[1, 2, 3];
let r: Rc<[u32]> = Rc::from(s);
assert_eq!(&r[..], [1, 2, 3]);
} | rust_cleaned_test_functions.jsonl/4672 | {
"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,
16096,
5673,
26488,
368,
341,
286,
1077,
274,
25,
44590,
84,
18,
17,
60,
284,
44590,
16,
11,
220,
17,
11,
220,
18,
935,
286,
1077,
435,
25,
81463,
66746,
84,
18,
17,
25669,
284,
81463,
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_blockchain_query_by_number_gets_canonical() {
let backend: Arc<Backend<test_client::runtime::Block>> = Arc::new(Backend::new_test(20, 20));
test_client::trait_tests::test_blockchain_query_by_number_gets_canonical(backend);
} | rust_cleaned_test_functions.jsonl/94584 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7113,
8819,
5738,
3710,
5500,
3062,
82,
27421,
22391,
368,
341,
197,
10217,
19163,
25,
19689,
27,
29699,
27,
1944,
8179,
486,
22255,
486,
4713,
2452,
284,
19689,
486,
931,
7,
29699,
486,
931,
44... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_checked_sub() {
for elm in SUM_TRIPLES.iter() {
let (a_vec, b_vec, c_vec) = *elm;
let a = BigUint::from_slice(a_vec);
let b = BigUint::from_slice(b_vec);
let c = BigUint::from_slice(c_vec);
assert!(c.checked_sub(&a).unwrap() == b);
assert!(c.checked_sub(&b).unwrap() == a);
if a > c {
assert!(a.checked_sub(&c).is_none());
}
if b > c {
assert!(b.checked_sub(&c).is_none());
}
}
} | rust_cleaned_test_functions.jsonl/90133 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 346
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56456,
5228,
368,
341,
286,
369,
42205,
304,
30735,
6410,
3298,
14017,
19471,
368,
341,
310,
1077,
320,
64,
13251,
11,
293,
13251,
11,
272,
13251,
8,
284,
353,
23162,
280,
310,
1077,
264,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_multihash_error_digest_without_typenum_no_alloc_size_errors() {
let input = quote! {
#[derive(Clone, Multihash)]
#[mh(alloc_size = U32, no_alloc_size_errors)]
pub enum Code {
#[mh(code = 0x14, hasher = multihash::Sha2_256, digest = Sha2_256Digest)]
Sha2_256,
}
};
let derive_input = syn::parse2(input).unwrap();
let s = Structure::new(&derive_input);
multihash(s);
} | rust_cleaned_test_functions.jsonl/97860 | {
"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,
26290,
6996,
988,
4096,
52994,
39904,
42111,
9018,
6536,
14802,
2368,
20196,
368,
341,
286,
1077,
1946,
284,
12641,
0,
341,
1843,
11506,
27098,
65297,
11,
22162,
6996,
988,
5563,
1843,
11506,
51916,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_scoped_success() {
let res = thread::scoped(move|| -> String {
"Success!".to_string()
}).join();
assert!(res == "Success!");
} | rust_cleaned_test_functions.jsonl/109005 | {
"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,
13171,
16367,
18632,
368,
341,
286,
1077,
592,
284,
4516,
486,
78740,
34081,
8484,
1464,
923,
341,
310,
330,
7188,
92993,
983,
3904,
741,
286,
8533,
5987,
543,
286,
2060,
10297,
416,
621,
330,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
#[test]
fn test_list() {
assert_eq!(
Val::List(Vec::new()).type_of(),
Type::List(Box::new(Type::Any))
);
assert_eq!(
Val::List(vec![Val::Int(123)]).type_of(),
Type::List(Box::new(Type::Int))
);
assert_eq!(
Val::List(vec![Val::Int(123), Val::Int(123)]).type_of(),
Type::List(Box::new(Type::Int))
);
assert_eq!(
Val::List(vec![Val::Int(123), Val::Float(3.14)]).type_of(),
Type::List(Box::new(Type::Any))
);
assert_eq!(
Val::List(vec![Val::List(vec![Val::Int(123)])]).type_of(),
Type::List(Box::new(Type::List(Box::new(Type::Int))))
);
} | rust_cleaned_test_functions.jsonl/113307 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 428
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2019,
368,
341,
286,
2060,
10714,
33673,
310,
4104,
486,
852,
49923,
486,
931,
6011,
1313,
3575,
3148,
310,
3990,
486,
852,
67758,
486,
931,
22498,
486,
8610,
1171,
286,
1439,
286,
2060,
10714,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pedersen_hash() {
let mut rng = XorShiftRng::from_seed([
0x59, 0x62, 0xbe, 0x3d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06,
0xbc, 0xe5,
]);
let params = &JubjubBls12::new();
for length in 0..751 {
for _ in 0..5 {
let input: Vec<bool> = (0..length).map(|_| rng.next_u32() % 2 != 0).collect();
let mut cs = TestConstraintSystem::<Bls12>::new();
let input_bools: Vec<Boolean> = input
.iter()
.enumerate()
.map(|(i, b)| {
Boolean::from(
AllocatedBit::alloc(cs.namespace(|| format!("input {}", i)), Some(*b))
.unwrap(),
)
})
.collect();
let res = pedersen_hash(
cs.namespace(|| "pedersen hash"),
Personalization::MerkleTree(1),
&input_bools,
params,
)
.unwrap();
assert!(cs.is_satisfied());
let expected = pedersen_hash::pedersen_hash::<Bls12, _>(
Personalization::MerkleTree(1),
input.clone().into_iter(),
params,
)
.to_xy();
assert_eq!(res.get_x().get_value().unwrap(), expected.0);
assert_eq!(res.get_y().get_value().unwrap(), expected.1);
// Test against the output of a different personalization
let unexpected = pedersen_hash::pedersen_hash::<Bls12, _>(
Personalization::MerkleTree(0),
input.into_iter(),
params,
)
.to_xy();
assert!(res.get_x().get_value().unwrap() != unexpected.0);
assert!(res.get_y().get_value().unwrap() != unexpected.1);
}
}
} | rust_cleaned_test_functions.jsonl/129766 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1281
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
93104,
87989,
8950,
368,
341,
286,
1077,
5206,
28422,
284,
1599,
269,
24841,
49,
968,
486,
1499,
33809,
8956,
310,
220,
15,
87,
20,
24,
11,
220,
15,
87,
21,
17,
11,
220,
15,
42459,
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... | 5 |
#[test]
fn test_block_id_includes_block_index() {
let mut rng: StdRng = SeedableRng::from_seed([1u8; 32]);
let mut block = get_block(&mut rng);
block.index += 1;
assert!(!block.is_block_id_valid());
} | rust_cleaned_test_functions.jsonl/4204 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 119
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7113,
842,
1243,
7396,
7113,
3560,
368,
341,
286,
1077,
5206,
28422,
25,
42517,
49,
968,
284,
35822,
480,
49,
968,
486,
1499,
33809,
2561,
16,
84,
23,
26,
220,
18,
17,
2558,
286,
1077,
5206,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_worktree_list_no_commit() {
let wt_list = &parse_worktree_list(concat!(
"worktree /home/abentley/sandbox/asdf2\n",
"HEAD 0000000000000000000000000000000000000000\n",
"branch refs/heads/master\n\n",
));
assert_eq!(
wt_list[0],
WorktreeListEntry {
path: "/home/abentley/sandbox/asdf2".to_string(),
state: WorktreeState::UncommittedBranch {
branch: "refs/heads/master".to_string()
},
}
)
} | rust_cleaned_test_functions.jsonl/114796 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 330
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
11498,
9344,
2019,
6536,
36346,
368,
341,
286,
1077,
40473,
2019,
284,
609,
6400,
11498,
9344,
2019,
96360,
33673,
310,
330,
1778,
9344,
608,
5117,
14,
370,
306,
3179,
2687,
31536,
72483,
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_atan() {
assert!(close(_0_0i.atan(), _0_0i));
assert!(close(_1_0i.atan(), _1_0i.scale(f64::consts::PI / 4.0)));
assert!(close(
_1_0i.scale(-1.0).atan(),
_1_0i.scale(-f64::consts::PI / 4.0)
));
assert!(close(_0_1i.atan(), Complex::new(0.0, f64::infinity())));
for &c in all_consts.iter() {
assert!(close(c.conj().atan(), c.atan().conj()));
assert!(close(c.scale(-1.0).atan(), c.atan().scale(-1.0)));
assert!(
-f64::consts::PI / 2.0 <= c.atan().re && c.atan().re <= f64::consts::PI / 2.0
);
}
} | rust_cleaned_test_functions.jsonl/105696 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 495
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3752,
276,
368,
341,
310,
2060,
10297,
5552,
2490,
15,
62,
15,
72,
71516,
1507,
716,
15,
62,
15,
72,
1106,
310,
2060,
10297,
5552,
2490,
16,
62,
15,
72,
71516,
1507,
716,
16,
62,
15,
72,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_parse_execute() {
let input = r#"exec "ls home""#.chars().collect::<Vec<_>>();
let r = command_exec().parse(&input);
assert_eq!(r, Ok(Action::Execute("ls home".into(), None)))
} | rust_cleaned_test_functions.jsonl/50005 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
44329,
368,
341,
286,
1077,
1946,
284,
435,
55543,
11748,
330,
4730,
2114,
3014,
87846,
19255,
1005,
17384,
27638,
10050,
32399,
37038,
286,
1077,
435,
284,
3210,
18430,
1005,
6400,
2099,
135... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_case_22() {
let key = "9b87dfc58eceb951e1e53d9e94793329199c42d004bc0f0dab3adf0cd702e99e";
let nonce = "fa5ef6e59d3b201680f8e2d5a4ef7f23";
let expected_output =
"56a208bd87c5b486b5de50fbe4c1c476532f874147eba529cbb0cbeae8f09b94";
hchacha_test_runner(key, nonce, expected_output);
} | rust_cleaned_test_functions.jsonl/44684 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 231
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19096,
62,
17,
17,
368,
341,
310,
1077,
1376,
284,
330,
24,
65,
23,
22,
2940,
66,
20,
23,
74407,
65,
24,
20,
16,
68,
16,
68,
20,
18,
67,
24,
68,
24,
19,
22,
24,
18,
18,
17,
24,
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_set_memory() {
let limit = 1024;
let tmp = create_temp_dir("test_set_memory").expect("create temp directory for test");
set_fixture(&tmp, CGROUP_MEMORY_USAGE, "0").expect("Set fixure for memory usage");
set_fixture(&tmp, CGROUP_MEMORY_MAX_USAGE, "0").expect("Set fixure for max memory usage");
set_fixture(&tmp, CGROUP_MEMORY_LIMIT, "0").expect("Set fixure for memory limit");
Memory::set_memory(limit, &tmp).expect("Set memory limit");
let content =
std::fs::read_to_string(tmp.join(CGROUP_MEMORY_LIMIT)).expect("Read to string");
assert_eq!(limit.to_string(), content)
} | rust_cleaned_test_functions.jsonl/51328 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 289
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
19195,
368,
341,
286,
1077,
3930,
284,
220,
16,
15,
17,
19,
280,
286,
1077,
4174,
284,
1855,
11771,
4334,
445,
1944,
2602,
19195,
1827,
17119,
445,
3182,
2730,
6220,
369,
1273,
797,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eu4_kandy_bin() {
let data = utils::request("kandy2.bin.eu4");
let (save, encoding) = Eu4Extractor::extract_save(Cursor::new(&data[..])).unwrap();
assert_eq!(encoding, Encoding::BinZip);
assert_eq!(save.meta.player, "BHA".parse().unwrap());
let query = Query::from_save(save);
let province_owners = query.province_owners();
let nation_events = query.nation_events(&province_owners);
let histories = query.player_histories(&nation_events);
let player = query
.save()
.game
.countries
.get(&"BHA".parse().unwrap())
.unwrap();
assert!(!player.completed_missions.is_empty());
assert_eq!(
query.country_tag_hex_color(&"BHA".parse().unwrap()),
Some(String::from("#50a50a"))
);
assert_eq!(
query
.save()
.game
.provinces
.get(&ProvinceId::from(1))
.unwrap()
.owner
.as_ref()
.unwrap(),
&"SCA".parse().unwrap()
);
assert_eq!(
query.starting_country(&histories),
Some("KND".parse().unwrap())
);
assert_eq!(
query
.players()
.iter()
.map(|x| x.name.as_str())
.collect::<Vec<_>>(),
vec!["comagoosie"]
);
let subjects: Vec<CountryTag> = vec![
"TEO".parse().unwrap(),
"YOK".parse().unwrap(),
"C21".parse().unwrap(),
"C23".parse().unwrap(),
];
assert_eq!(
query
.save()
.game
.countries
.get(&"BHA".parse().unwrap())
.unwrap()
.subjects,
subjects
);
// Testing binary encoded saves can extract province building history perfectly fine
let london = query
.save()
.game
.provinces
.get(&ProvinceId::from(236))
.unwrap();
let (date, _marketplace, val) = london
.history
.events
.iter()
.flat_map(|(date, events)| events.0.iter().map(move |event| (date.clone(), event)))
.filter_map(|(date, event)| match event {
ProvinceEvent::KV((key, value)) => Some((date, key, value)),
_ => None,
})
.find(|(_date, key, _value)| key.as_str() == "marketplace")
.unwrap();
assert!(matches!(val, ProvinceEventValue::Bool(v) if v == &true));
assert_eq!(date.game_fmt().to_string(), String::from("1486.6.3"));
let building_date = query
.province_building_history(london)
.iter()
.find(|x| x.building == "marketplace")
.map(|x| x.date.game_fmt().to_string());
assert_eq!(building_date, Some(String::from("1486.6.3")));
let building_date = query
.province_building_history(london)
.iter()
.find(|x| x.building == "fort_15th")
.map(|x| x.date);
assert_eq!(building_date, Some(query.save().game.start_date));
assert_eq!(player.active_idea_groups.len(), 9);
assert_eq!(
player.active_idea_groups[8],
(String::from("economic_ideas"), 2)
);
} | rust_cleaned_test_functions.jsonl/97708 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1559
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2204,
84,
19,
4698,
13331,
21816,
368,
341,
262,
1077,
821,
284,
12439,
486,
2035,
445,
74,
13331,
17,
29394,
35003,
19,
797,
262,
1077,
320,
6628,
11,
11170,
8,
284,
21963,
19,
56118,
486,
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... | 3 |
#[test]
fn test_serde() {
use serde_test::{Configure, Token, assert_tokens};
let s = Secp256k1::new();
let msg = Message::from_slice(&[1; 32]).unwrap();
let sk = SecretKey::from_slice(&[2; 32]).unwrap();
let sig = s.sign(&msg, &sk);
static SIG_BYTES: [u8; 71] = [
48, 69, 2, 33, 0, 157, 11, 173, 87, 103, 25, 211, 42, 231, 107, 237,
179, 76, 119, 72, 102, 103, 60, 189, 227, 244, 225, 41, 81, 85, 92, 148,
8, 230, 206, 119, 75, 2, 32, 40, 118, 231, 16, 47, 32, 79, 107, 254,
226, 108, 150, 124, 57, 38, 206, 112, 44, 249, 125, 75, 1, 0, 98, 225,
147, 247, 99, 25, 15, 103, 118
];
static SIG_STR: &'static str = "\
30450221009d0bad576719d32ae76bedb34c774866673cbde3f4e12951555c9408e6ce77\
4b02202876e7102f204f6bfee26c967c3926ce702cf97d4b010062e193f763190f6776\
";
assert_tokens(&sig.compact(), &[Token::BorrowedBytes(&SIG_BYTES[..])]);
assert_tokens(&sig.compact(), &[Token::Bytes(&SIG_BYTES)]);
assert_tokens(&sig.compact(), &[Token::ByteBuf(&SIG_BYTES)]);
assert_tokens(&sig.readable(), &[Token::BorrowedStr(SIG_STR)]);
assert_tokens(&sig.readable(), &[Token::Str(SIG_STR)]);
assert_tokens(&sig.readable(), &[Token::String(SIG_STR)]);
} | rust_cleaned_test_functions.jsonl/34776 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 711
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75861,
450,
368,
341,
286,
990,
61570,
4452,
22964,
28560,
11,
9660,
11,
2060,
28838,
2315,
286,
1077,
274,
284,
4520,
79,
17,
20,
21,
74,
16,
486,
931,
1428,
286,
1077,
3750,
284,
4856,
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_position_root_with_rtl_should_position_withoutdirection() {
let mut root = Node::new();
style!(root,
Left(72 pt),
Width(52 pt),
Height(52 pt)
);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
let root_layout = root.get_layout();
assert_eq!(72.0, root_layout.left());
assert_eq!(0.0, root_layout.top());
assert_eq!(52.0, root_layout.width());
assert_eq!(52.0, root_layout.height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
let root_layout = root.get_layout();
assert_eq!(72.0, root_layout.left());
assert_eq!(0.0, root_layout.top());
assert_eq!(52.0, root_layout.width());
assert_eq!(52.0, root_layout.height());
} | rust_cleaned_test_functions.jsonl/39982 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 281
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9661,
12993,
6615,
1710,
11544,
43378,
9661,
39904,
19071,
368,
341,
10217,
5206,
3704,
284,
6018,
486,
931,
1428,
42551,
10297,
2888,
345,
197,
197,
5415,
7,
22,
17,
10817,
1326,
197,
197,
3327,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iterate() {
let objs = objects();
assert!(objs.len() >= 1);
for o in objs {
assert_ne!(o.addr(), 0);
let obj_name = o.name().to_str().unwrap();
let path = if cfg!(target_os = "linux") && obj_name == "" {
env::current_exe().unwrap()
} else {
PathBuf::from(obj_name)
};
if !(cfg!(target_os = "linux") && path.to_str().unwrap() == LINUX_VDSO) {
assert!(path.exists());
}
assert_ne!(o.num_phdrs(), 0);
for p in o.iter_phdrs() {
assert_ne!(p.type_(), 0);
assert_ne!(p.flags(), 0);
let _ = p.offset();
let _ = p.vaddr();
let _ = p.paddr();
let _ = p.filesz();
let _ = p.memsz();
let _ = p.align();
}
}
} | rust_cleaned_test_functions.jsonl/84391 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 634
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
349,
368,
341,
286,
1077,
52937,
284,
6171,
543,
286,
2060,
10297,
88327,
19406,
368,
2604,
220,
16,
1215,
715,
286,
369,
297,
304,
52937,
341,
310,
2060,
13925,
10297,
78,
42826,
1507,
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... | 7 |
#[test]
fn test_log_signal_histograms() {
let snr_histograms = vec![fidl_stats::SnrHistogram {
hist_scope: fidl_stats::HistScope::PerAntenna,
antenna_id: Some(Box::new(fidl_stats::AntennaId {
freq: fidl_stats::AntennaFreq::Antenna2G,
index: 0,
})),
snr_samples: vec![fidl_stats::HistBucket { bucket_index: 30, num_samples: 999 }],
invalid_samples: 11,
}];
let rx_rate_histograms = vec![
fidl_stats::RxRateIndexHistogram {
hist_scope: fidl_stats::HistScope::Station,
antenna_id: None,
rx_rate_index_samples: vec![fidl_stats::HistBucket {
bucket_index: 99,
num_samples: 1400,
}],
invalid_samples: 22,
},
fidl_stats::RxRateIndexHistogram {
hist_scope: fidl_stats::HistScope::PerAntenna,
antenna_id: Some(Box::new(fidl_stats::AntennaId {
freq: fidl_stats::AntennaFreq::Antenna5G,
index: 1,
})),
rx_rate_index_samples: vec![fidl_stats::HistBucket {
bucket_index: 100,
num_samples: 1500,
}],
invalid_samples: 33,
},
];
let noise_floor_histograms = vec![fidl_stats::NoiseFloorHistogram {
hist_scope: fidl_stats::HistScope::PerAntenna,
antenna_id: Some(Box::new(fidl_stats::AntennaId {
freq: fidl_stats::AntennaFreq::Antenna2G,
index: 0,
})),
noise_floor_samples: vec![fidl_stats::HistBucket {
bucket_index: 200,
num_samples: 999,
}],
invalid_samples: 44,
}];
let rssi_histograms = vec![fidl_stats::RssiHistogram {
hist_scope: fidl_stats::HistScope::PerAntenna,
antenna_id: Some(Box::new(fidl_stats::AntennaId {
freq: fidl_stats::AntennaFreq::Antenna2G,
index: 0,
})),
rssi_samples: vec![fidl_stats::HistBucket { bucket_index: 230, num_samples: 999 }],
invalid_samples: 55,
}];
let inspector = Inspector::new();
let mut histograms_subtrees = HistogramsSubtrees::new();
histograms_subtrees.log_per_antenna_snr_histograms(&snr_histograms[..], &inspector);
histograms_subtrees.log_per_antenna_rx_rate_histograms(&rx_rate_histograms[..], &inspector);
histograms_subtrees
.log_per_antenna_noise_floor_histograms(&noise_floor_histograms[..], &inspector);
histograms_subtrees.log_per_antenna_rssi_histograms(&rssi_histograms[..], &inspector);
assert_inspect_tree!(inspector, root: {
antenna0_2Ghz: {
antenna_index: 0u64,
antenna_freq: "2Ghz",
snr_histogram: vec![30i64, 999],
snr_invalid_samples: 11u64,
noise_floor_histogram: vec![-55i64, 999],
noise_floor_invalid_samples: 44u64,
rssi_histogram: vec![-25i64, 999],
rssi_invalid_samples: 55u64,
},
antenna1_5Ghz: {
antenna_index: 1u64,
antenna_freq: "5Ghz",
rx_rate_histogram: vec![100i64, 1500],
rx_rate_invalid_samples: 33u64,
},
});
} | rust_cleaned_test_functions.jsonl/64512 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2012
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5224,
21137,
68564,
82,
368,
341,
286,
1077,
4131,
81,
68564,
82,
284,
7486,
20703,
32439,
75,
15381,
486,
50,
19618,
77210,
341,
310,
12744,
23199,
25,
32104,
75,
15381,
486,
63057,
10803,
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_string_value() {
with_key!(key, "StringValue" => {
let name = "RustStringVal";
let val1 = "Test123 \n$%^&|+-*/\\()".to_owned();
key.set_value(name, &val1).unwrap();
let val2: String = key.get_value(name).unwrap();
assert_eq!(val1, val2);
});
} | rust_cleaned_test_functions.jsonl/128088 | {
"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,
3904,
3142,
368,
341,
262,
448,
3097,
10297,
792,
11,
330,
82696,
1,
589,
341,
286,
1077,
829,
284,
330,
49,
590,
703,
2208,
876,
286,
1077,
1044,
16,
284,
330,
2271,
16,
17,
18,
1124,
77,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hand_range_add_combos() {
// valid test add paired hand
let mut c = HandRange::new();
c.add_combos(1, 1, true, true, 100);
assert_eq!(c.hands.len(), 6);
// valid: test add suited hand
c = HandRange::new();
c.add_combos(1, 0, true, false, 100);
assert_eq!(c.hands.len(), 4);
// valid: test add offsuite hand
c = HandRange::new();
c.add_combos(1, 0, false, true, 100);
assert_eq!(c.hands.len(), 12);
// valid: test add both
c = HandRange::new();
c.add_combos(1, 0, true, true, 100);
assert_eq!(c.hands.len(), 16);
} | rust_cleaned_test_functions.jsonl/68075 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 335
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23194,
9698,
2891,
34454,
436,
368,
341,
286,
442,
2697,
1273,
912,
34426,
1424,
198,
286,
1077,
5206,
272,
284,
8536,
6046,
486,
931,
543,
286,
272,
1364,
34454,
436,
7,
16,
11,
220,
16,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_sensor_serial_stream_succeed() {
let buffer_output = [
0, 58, 0, 207, 19, 39, 13, 0, 21, 0, 22, 61, 160, 24, 20, 25, 7, 98, 26, 8, 20, 35, 3, 39,
0, 0, 40, 0, 0, 41, 0, 0, 42, 0, 0, 43, 10, 253, 44, 9, 105, 45, 0, 58, 0, 206, 19, 39, 13,
0, 21, 0, 22, 61, 160, 24, 20, 25, 7, 98, 26, 8, 20, 35, 3, 39, 0, 0, 40, 0, 0, 41, 0, 0,
42, 0, 0, 43, 10, 253, 44, 9, 105, 45,
];
let header_byte: u8 = 19;
let nbytes: u8 = 39;
let mut checksum = Checksum::new();
let mut byte_data = buffer_output.to_vec();
let succeeded = extract_sublist(&mut byte_data, [header_byte, nbytes], 42, &mut checksum);
assert_eq!(
byte_data,
vec![
19, 39, 13, 0, 21, 0, 22, 61, 160, 24, 20, 25, 7, 98, 26, 8, 20, 35, 3, 39, 0, 0, 40,
0, 0, 41, 0, 0, 42, 0, 0, 43, 10, 253, 44, 9, 105, 45, 0, 58, 0, 206
]
);
assert_eq!(true, succeeded);
let checksum_low_byte = checksum.calculate_low_byte_sum();
assert_eq!(checksum_low_byte, 0);
} | rust_cleaned_test_functions.jsonl/16131 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 546
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
28899,
25602,
12673,
643,
29264,
368,
341,
262,
1077,
4147,
7645,
284,
2278,
286,
220,
15,
11,
220,
20,
23,
11,
220,
15,
11,
220,
17,
15,
22,
11,
220,
16,
24,
11,
220,
18,
24,
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_open_channel_request_establishes_channel_after_mux_startup_and_pn() {
let mut exec = fasync::Executor::new().unwrap();
// Crete and start a SessionInner that relays any opened RFCOMM channels.
let (mut session, mut outgoing_frames, mut channel_receiver) = setup_session();
// Initiate an open RFCOMM channel request with a random valid ServerChannel.
let server_channel = ServerChannel(5);
{
let mut open_fut = Box::pin(session.open_remote_channel(server_channel));
assert!(exec.run_until_stalled(&mut open_fut).is_pending());
// MUX Control DLCI to the remote peer.
expect_frame(
&mut exec,
&mut outgoing_frames,
FrameData::SetAsynchronousBalancedMode,
DLCI::MUX_CONTROL_DLCI,
);
assert_matches!(exec.run_until_stalled(&mut open_fut), Poll::Ready(Ok(_)));
}
{
// Simulate peer responding positively with a UA.
let mut handle_fut = Box::pin(
session
.handle_frame(Frame::make_ua_response(Role::Responder, DLCI::MUX_CONTROL_DLCI)),
);
assert!(exec.run_until_stalled(&mut handle_fut).is_pending());
// the session has not negotiated parameters.
expect_mux_command(
&mut exec,
&mut outgoing_frames,
MuxCommandMarker::ParameterNegotiation,
);
assert_matches!(exec.run_until_stalled(&mut handle_fut), Poll::Ready(Ok(_)));
}
let expected_dlci = server_channel.to_dlci(Role::Responder).unwrap();
{
// Simulate the peer's positive response to the DLC PN request. We then expect an
// outgoing SABM command to establish the user channel.
handle_and_expect_frame(
&mut exec,
&mut session,
&mut outgoing_frames,
make_dlc_pn_frame(
CommandResponse::Response,
expected_dlci,
true, // Supports credit-based flow control.
100, // Supports max frame size of 100.
),
FrameTypeMarker::SetAsynchronousBalancedMode, // Outgoing SABM.
);
}
{
// Remote peer replies positively to the open channel request.
let mut handle_fut = Box::pin(
session.handle_frame(Frame::make_ua_response(Role::Responder, expected_dlci)),
);
assert!(exec.run_until_stalled(&mut handle_fut).is_pending());
// We then expect to open a local RFCOMM channel to be relayed to a profile client.
let _channel = expect_channel(&mut exec, &mut channel_receiver);
assert!(exec.run_until_stalled(&mut handle_fut).is_pending());
// be sent.
expect_mux_command(&mut exec, &mut outgoing_frames, MuxCommandMarker::ModemStatus);
assert_matches!(exec.run_until_stalled(&mut handle_fut), Poll::Ready(Ok(_)));
}
// The DLCI should be established.
assert!(session.multiplexer().dlci_established(&expected_dlci));
} | rust_cleaned_test_functions.jsonl/14938 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1601
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11311,
14571,
7893,
18583,
5102,
288,
14571,
19844,
80363,
80858,
8378,
620,
77,
368,
341,
286,
1077,
5206,
3883,
284,
282,
7692,
486,
25255,
486,
931,
1005,
15454,
1428,
286,
442,
7792,
665,
323,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_array_unsigned_long() {
check([] as [u32; 0], Some(0));
check([0u32, 1, 2], Some(12));
} | rust_cleaned_test_functions.jsonl/79672 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 59
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
67830,
17799,
368,
341,
262,
1779,
10556,
438,
508,
84,
18,
17,
26,
220,
15,
1125,
4329,
7,
15,
1106,
262,
1779,
2561,
15,
84,
18,
17,
11,
220,
16,
11,
220,
17,
1125,
4329,
7,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_vec_default() {
macro_rules! t (
($ty:ty) => {{
let v: $ty = Default::default();
assert!(v.is_empty());
}}
);
t!(&[int]);
t!(Vec<int>);
} | rust_cleaned_test_functions.jsonl/31853 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
9993,
368,
341,
286,
18072,
21407,
0,
259,
2399,
310,
1711,
1881,
25,
1881,
8,
589,
80505,
394,
1077,
348,
25,
400,
1881,
284,
7899,
486,
2258,
543,
394,
2060,
10297,
85,
2079,
15124,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_cached_executors() {
let key1 = solana_sdk::pubkey::new_rand();
let key2 = solana_sdk::pubkey::new_rand();
let key3 = solana_sdk::pubkey::new_rand();
let key4 = solana_sdk::pubkey::new_rand();
let executor: Arc<dyn Executor> = Arc::new(TestExecutor {});
let mut cache = CachedExecutors::new(3, 0);
cache.put(&key1, executor.clone());
cache.put(&key2, executor.clone());
cache.put(&key3, executor.clone());
assert!(cache.get(&key1).is_some());
assert!(cache.get(&key2).is_some());
assert!(cache.get(&key3).is_some());
assert!(cache.get(&key1).is_some());
assert!(cache.get(&key1).is_some());
assert!(cache.get(&key2).is_some());
cache.put(&key4, executor.clone());
assert!(cache.get(&key1).is_some());
assert!(cache.get(&key2).is_some());
assert!(cache.get(&key3).is_none());
assert!(cache.get(&key4).is_some());
assert!(cache.get(&key4).is_some());
assert!(cache.get(&key4).is_some());
assert!(cache.get(&key4).is_some());
cache.put(&key3, executor.clone());
assert!(cache.get(&key1).is_some());
assert!(cache.get(&key2).is_none());
assert!(cache.get(&key3).is_some());
assert!(cache.get(&key4).is_some());
} | rust_cleaned_test_functions.jsonl/2650 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 654
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64369,
18430,
9475,
368,
341,
286,
1077,
1376,
16,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
1376,
17,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
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_loopback_unicast() {
// bypassing the actual check against `is_specified`. Test that that's
// actually valid.
assert!(Ipv4::LOOPBACK_ADDRESS.0.is_specified());
assert!(Ipv6::LOOPBACK_ADDRESS.0.is_specified());
} | rust_cleaned_test_functions.jsonl/31860 | {
"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,
17198,
1419,
62,
3525,
559,
368,
341,
1789,
286,
442,
30718,
287,
279,
5042,
1779,
2348,
1565,
285,
13594,
1870,
28587,
3393,
429,
429,
594,
198,
286,
442,
3520,
2697,
624,
286,
2060,
10297,
806... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read() {
let test_bytes: Vec<u8> = hex::decode(TEST_HEX).expect("");
let mut binary_parser = BinaryParser::from(test_bytes.as_ref());
let result = binary_parser.read(5);
assert!(result.is_ok());
assert_eq!(result.unwrap(), test_bytes[..5]);
} | rust_cleaned_test_functions.jsonl/20413 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
368,
341,
286,
1077,
1273,
12524,
25,
11312,
34837,
23,
29,
284,
12371,
486,
18196,
50320,
86502,
568,
17119,
13056,
286,
1077,
5206,
7868,
18517,
284,
17718,
6570,
486,
1499,
8623,
12524,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_kaikeishi() {
let mut tokenizer = Tokenizer::new().unwrap();
let tokens: Vec<&str> = tokenizer.tokenize_str("ジム・コガン").unwrap();
assert_eq!(tokens, vec!["ジム・コガン"]);
} | rust_cleaned_test_functions.jsonl/61443 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 108
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4698,
2143,
440,
38376,
368,
341,
286,
1077,
5206,
45958,
284,
9660,
3135,
486,
931,
1005,
15454,
543,
286,
1077,
11211,
25,
11312,
52244,
495,
29,
284,
45958,
96790,
2895,
445,
75328,
89962,
9274... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_converting_array() -> Result<()> {
let c = |val: Value| -> ConfigValue { ConfigValue(Some(val)) };
let conv_elem: Vec<String> = c(json!("test")).try_into()?;
assert_eq!(1, conv_elem.len());
let conv_string: Vec<String> = c(json!(["test", "test2"])).try_into()?;
assert_eq!(2, conv_string.len());
let conv_bool: Vec<bool> = c(json!([true, "false", false])).try_into()?;
assert_eq!(3, conv_bool.len());
let conv_bool_2: Vec<bool> = c(json!([36, "false", false])).try_into()?;
assert_eq!(2, conv_bool_2.len());
let conv_num: Vec<u64> = c(json!([3, "36", 1000])).try_into()?;
assert_eq!(3, conv_num.len());
let conv_num_2: Vec<u64> = c(json!([3, "false", 1000])).try_into()?;
assert_eq!(2, conv_num_2.len());
let bad_elem: std::result::Result<Vec<u64>, ConfigError> = c(json!("test")).try_into();
assert!(bad_elem.is_err());
let bad_elem_2: std::result::Result<Vec<u64>, ConfigError> = c(json!(["test"])).try_into();
assert!(bad_elem_2.is_err());
Ok(())
} | rust_cleaned_test_functions.jsonl/10096 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 553
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3382,
49417,
3858,
368,
1464,
5714,
71698,
341,
286,
1077,
272,
284,
760,
831,
25,
5162,
91,
1464,
5532,
1130,
314,
5532,
1130,
65405,
9098,
593,
2605,
286,
1077,
5686,
28179,
25,
11312,
3464,
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... | 7 |
#[test]
fn test_interpolate_onto_midpoint_values() {
let from_xs = vec![0.0, 1.0, 2.0, 3.0];
let ys = vec![5.0, 1.0, 3.0, 0.0];
let onto_xs = vec![0.5, 1.5, 2.5];
assert_eq!(
vec![3.0, 2.0, 1.5],
interpolate_data(&from_xs, &ys, &onto_xs)
);
} | rust_cleaned_test_functions.jsonl/3268 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 169
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15318,
45429,
62,
9935,
43733,
2768,
9146,
368,
341,
262,
1077,
504,
80646,
284,
7486,
20703,
15,
13,
15,
11,
220,
16,
13,
15,
11,
220,
17,
13,
15,
11,
220,
18,
13,
15,
935,
262,
1077,
318... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_to_hyphenated_str() {
let uuid1 = Uuid::new_v4();
let s = uuid1.to_hyphenated_str();
assert!(s.len() == 36);
assert!(s.iter().all(|c| c.is_digit_radix(16) || c == '-'));
} | rust_cleaned_test_functions.jsonl/66553 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 128
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
1523,
88,
14769,
657,
2895,
368,
341,
286,
1077,
16040,
16,
284,
547,
2423,
486,
931,
2273,
19,
543,
286,
1077,
274,
284,
16040,
16,
2389,
1523,
88,
14769,
657,
2895,
1428,
286,
2060,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_accountsdb_scan_snapshot_stores_illegal_range_start() {
let mut stats = HashStats::default();
let bounds = Range { start: 2, end: 2 };
AccountsDb::scan_snapshot_stores(&empty_storages(), &mut stats, 2, &bounds, false).unwrap();
} | rust_cleaned_test_functions.jsonl/1322 | {
"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,
55665,
1999,
28857,
53265,
1261,
4589,
26743,
6428,
9698,
4906,
368,
341,
286,
1077,
5206,
10472,
284,
6531,
16635,
486,
2258,
543,
286,
1077,
14262,
284,
16437,
314,
1191,
25,
220,
17,
11,
835,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_match_char_with_surrounding_properties_with_diagonal_cross() {
let k = CellGrid::k();
let m = CellGrid::m();
let o = CellGrid::o();
let e = CellGrid::e();
let u = CellGrid::u();
let mut fragments = vec![line(k, o), line(e, u)];
fragments.sort();
let top_left = &Property::empty();
let top = &Property::empty();
let top_right = &Property::from_char('/').unwrap();
let left = &Property::from_char('-').unwrap();
let right = Property::from_char('-').expect("must have a property");
let bottom_left = &Property::from_char('/').unwrap();
let bottom = &Property::empty();
let bottom_right = &Property::empty();
let ch = PropertyBuffer::match_char_with_surrounding_properties(
&Settings::default(),
&fragments,
top_left,
top,
top_right,
left,
right,
bottom_left,
bottom,
bottom_right,
);
println!("ch: {:?}", ch);
assert_eq!(ch, Some('+'));
} | rust_cleaned_test_functions.jsonl/33915 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 582
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10708,
9232,
6615,
49946,
1049,
287,
25158,
6615,
29477,
23450,
35284,
368,
341,
286,
1077,
595,
284,
13972,
3543,
486,
74,
543,
286,
1077,
296,
284,
13972,
3543,
486,
76,
543,
286,
1077,
297,
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_or_with_multiple_gte_parse() {
let name1 = _random_string(10);
let value1 = _random_string(10);
let name2 = _random_string(10);
let value2 = _random_string(10);
let name3 = _random_string(10);
let value3 = _random_string(10);
let json = format!(r#"{{"$or":[{{"~{}":{{"$gte":"{}"}}}},{{"~{}":{{"$gte":"{}"}}}},{{"~{}":{{"$gte":"{}"}}}}]}}"#,
name1, value1,
name2, value2,
name3, value3,
);
let query = parse_from_json(&json).unwrap();
let expected = Operator::Or(
vec![
Operator::Gte(
TagName::PlainTagName(name1.to_vec()),
TargetValue::Unencrypted(value1.clone())
),
Operator::Gte(
TagName::PlainTagName(name2.to_vec()),
TargetValue::Unencrypted(value2.clone())
),
Operator::Gte(
TagName::PlainTagName(name3.to_vec()),
TargetValue::Unencrypted(value3.clone())
)
]
);
assert_eq!(query, expected);
} | rust_cleaned_test_functions.jsonl/11857 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 734
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8734,
6615,
45233,
1889,
665,
21039,
368,
341,
286,
1077,
829,
16,
284,
716,
11463,
3904,
7,
16,
15,
317,
286,
1077,
897,
16,
284,
716,
11463,
3904,
7,
16,
15,
317,
286,
1077,
829,
17,
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_subtype() {
assert_eq!(TEXT_PLAIN.subtype(), PLAIN);
assert_eq!(TEXT_PLAIN_UTF_8.subtype(), PLAIN);
let mime = Mime::from_str("text/html+xml").unwrap();
assert_eq!(mime.subtype(), HTML);
} | rust_cleaned_test_functions.jsonl/99122 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
96228,
368,
341,
286,
2060,
10714,
10297,
12708,
11082,
6836,
4309,
1313,
1507,
10315,
6836,
317,
286,
2060,
10714,
10297,
12708,
11082,
6836,
55061,
62,
23,
4309,
1313,
1507,
10315,
6836,
317,
286,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_get_set() {
let e = new_env(HashMap::new());
set_value(&e, "key_bool", Object::Bool(true));
assert_eq!(get_value(&e, "key_bool").unwrap(), Object::Bool(true));
set_value(&e, "key_int", Object::Int(1));
assert_eq!(get_value(&e, "key_int").unwrap(), Object::Int(1));
assert_eq!(get_value(&e, "key_none"), None);
} | rust_cleaned_test_functions.jsonl/90742 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 163
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
3062,
2602,
368,
341,
262,
1077,
384,
284,
501,
15879,
7,
18497,
486,
931,
1423,
262,
738,
3142,
2099,
68,
11,
330,
792,
22159,
497,
3002,
486,
11233,
3715,
1106,
262,
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_uint() {
let source = [0x40, 0x01, 0xFF];
assert_eq!(uint(&source[..], 1), Ok((&source[1..], source[0] as u64)));
} | rust_cleaned_test_functions.jsonl/6829 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15807,
368,
341,
310,
1077,
2530,
284,
508,
15,
87,
19,
15,
11,
220,
15,
87,
15,
16,
11,
220,
15,
9264,
935,
310,
2060,
10714,
10297,
2496,
2099,
2427,
95874,
1125,
220,
16,
701,
7622,
42902... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_sum_f64s() {
assert_eq!([0.5f64, 3.2321f64, 1.5678f64].sum(), 5.2999);
} | rust_cleaned_test_functions.jsonl/45514 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 66
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10160,
761,
21,
19,
82,
368,
341,
286,
2060,
10714,
0,
2561,
15,
13,
20,
69,
21,
19,
11,
220,
18,
13,
17,
18,
17,
16,
69,
21,
19,
11,
220,
16,
13,
20,
21,
22,
23,
69,
21,
19,
936,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_time_warp() {
let w = TimeWarp { delta_s: 0_i64 };
assert_eq!(w.apply(100_u64), 100);
let w = TimeWarp { delta_s: 42_i64 };
assert_eq!(w.apply(100_u64), 142);
let w = TimeWarp { delta_s: -42_i64 };
assert_eq!(w.apply(100_u64), 58);
} | rust_cleaned_test_functions.jsonl/74804 | {
"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,
3009,
1670,
7876,
368,
341,
262,
1077,
289,
284,
4120,
54,
7876,
314,
9477,
643,
25,
220,
15,
5318,
21,
19,
2605,
262,
2060,
10714,
10297,
86,
13045,
7,
16,
15,
15,
7300,
21,
19,
701,
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_into_iter() {
let nonempty = NonEmpty::from((0, vec![1, 2, 3]));
for (i, n) in nonempty.into_iter().enumerate() {
assert_eq!(i as i32, n);
}
} | rust_cleaned_test_functions.jsonl/17874 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 113
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45514,
11723,
368,
341,
286,
1077,
2477,
3194,
284,
11581,
3522,
486,
1499,
1188,
15,
11,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
14382,
286,
369,
320,
72,
11,
308,
8,
304,
2477,
3194,
39... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_compatible_config() {
let pd_client = Arc::new(MockPdClient::new());
let id = "localhost:1080";
// register config
let mut cfg_handler = pd_client.clone().register(id, TiKvConfig::default(), false);
let mut cfg = cfg_handler.get_config().clone();
pd_client.update_raw(id, |cfg| {
*cfg = "
[new.config]
xyz = 1
[raftstore]
raft-log-gc-threshold = 2048
"
.to_owned();
});
// refresh local config
cfg_handler.refresh_config(pd_client.as_ref()).unwrap();
cfg.raft_store.raft_log_gc_threshold = 2048;
assert_eq!(cfg_handler.get_config(), &cfg);
} | rust_cleaned_test_functions.jsonl/103836 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 323
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2965,
37079,
5332,
368,
341,
262,
1077,
7744,
8179,
284,
19689,
486,
931,
66436,
47,
67,
2959,
486,
931,
1423,
262,
1077,
877,
284,
330,
8301,
25,
16,
15,
23,
15,
3302,
262,
442,
4161,
2193,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mut_rev_iter_wrap() {
let mut d = VecDeque::with_capacity(3);
assert!(d.iter_mut().rev().next().is_none());
d.push_back(1);
d.push_back(2);
d.push_back(3);
assert_eq!(d.pop_front(), Some(1));
d.push_back(4);
assert_eq!(d.iter_mut().rev().map(|x| *x).collect::<Vec<_>>(), vec![4, 3, 2]);
} | rust_cleaned_test_functions.jsonl/73704 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 174
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29523,
38082,
11723,
38550,
368,
341,
262,
1077,
5206,
294,
284,
11312,
73891,
486,
4197,
35603,
7,
18,
317,
262,
2060,
10297,
67,
19471,
29523,
1005,
7282,
1005,
3600,
1005,
285,
31488,
5231,
262... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_prepare_if_nonce_account_not_nonce_address() {
let (
pre_account_address,
pre_account,
mut post_account,
blockhash,
lamports_per_signature,
maybe_fee_payer_account,
) = create_accounts_prepare_if_nonce_account();
let expect_account = post_account.clone();
// Wrong key
assert!(run_prepare_if_nonce_account_test(
&Pubkey::new(&[1u8; 32]),
&mut post_account,
&Ok(()),
Some((
&pre_account_address,
&pre_account,
maybe_fee_payer_account.as_ref(),
true,
)),
&blockhash,
lamports_per_signature,
&expect_account,
));
} | rust_cleaned_test_functions.jsonl/63374 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 474
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47460,
11119,
48508,
13500,
7913,
48508,
6744,
368,
341,
286,
1077,
2399,
310,
855,
13500,
6744,
345,
310,
855,
13500,
345,
310,
5206,
1736,
13500,
345,
310,
2504,
8296,
345,
310,
31603,
3394,
567... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sorted_storages_duplicate_slots() {
SortedStorages::new_with_slots(
[Vec::new(), Vec::new()].iter().zip([0, 0].iter()),
None,
None,
);
} | rust_cleaned_test_functions.jsonl/23712 | {
"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,
41277,
1261,
269,
1134,
70434,
54161,
368,
341,
286,
52688,
623,
269,
1134,
486,
931,
6615,
54161,
1006,
310,
508,
10050,
486,
931,
1507,
11312,
486,
931,
57590,
2015,
1005,
9964,
2561,
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 |
#[test]
fn test_diff_with_merge_conflict_is_passed_on_unchanged_under_color_only() {
let mut options = get_command_line_options();
options.color_only = true;
let output = run_delta(DIFF_WITH_MERGE_CONFLICT, &options);
assert_eq!(
strip_ansi_codes(&output).to_string(),
DIFF_WITH_MERGE_CONFLICT.to_owned() + "\n"
);
} | rust_cleaned_test_functions.jsonl/61847 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 194
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15850,
6615,
20888,
16059,
21242,
6892,
87405,
4470,
62,
3185,
3726,
58228,
6714,
18410,
368,
341,
286,
1077,
5206,
2606,
284,
633,
10811,
6528,
8743,
543,
286,
2606,
7961,
18410,
284,
830,
280,
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_compile_with_dup_signer_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, true),
AccountMeta::new(id0, true),
],
)],
None,
);
// Ensure the dup signer key is writable
assert_eq!(
compiled_keys,
CompiledKeys {
payer: None,
key_meta_map: BTreeMap::from([
(id0, (KeyFlags::SIGNER | KeyFlags::WRITABLE).into()),
(program_id, KeyFlags::INVOKED.into()),
]),
}
);
} | rust_cleaned_test_functions.jsonl/52064 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 526
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74170,
6615,
51932,
11172,
261,
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,
286,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_discard() {
static FILE_1: &str = r"0
1
2
3
4
";
static FILE_2: &str = r"0
3
4
";
static FILE_3: &str = r"0
2
3
4
";
let (path, repo) = repo_init().unwrap();
let path = path.path().to_str().unwrap();
write_commit_file(&repo, "test.txt", FILE_1, "c1");
repo_write_file(&repo, "test.txt", FILE_2).unwrap();
discard_lines(
path,
"test.txt",
&[
DiffLinePosition {
old_lineno: Some(3),
new_lineno: None,
},
DiffLinePosition {
old_lineno: None,
new_lineno: Some(2),
},
],
)
.unwrap();
let result_file = load_file(&repo, "test.txt").unwrap();
assert_eq!(result_file.as_str(), FILE_3);
} | rust_cleaned_test_functions.jsonl/105096 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 539
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37745,
567,
368,
341,
286,
1099,
11837,
62,
16,
25,
609,
495,
284,
435,
1,
15,
198,
16,
198,
17,
198,
18,
198,
19,
198,
3302,
286,
1099,
11837,
62,
17,
25,
609,
495,
284,
435,
1,
15,
140... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_repository_link_in_topbar_dropdown_github() {
wrapper(|env| {
env.fake_release()
.name("testing")
.version("0.1.0")
.rustdoc_file("testing/index.html")
.github_stats("https://git.example.com", 123, 321, 333)
.create()?;
let dom = kuchiki::parse_html().one(
env.frontend()
.get("/testing/0.1.0/testing/")
.send()?
.text()?,
);
assert_eq!(
dom.select(r#"ul > li a[href="https://git.example.com"]"#)
.unwrap()
.count(),
1,
);
Ok(())
})
} | rust_cleaned_test_functions.jsonl/57024 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 500
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47301,
7233,
1243,
10426,
2257,
51024,
1889,
3827,
368,
341,
286,
13261,
22428,
3160,
91,
341,
310,
6105,
94624,
24577,
741,
394,
659,
606,
445,
8840,
1138,
394,
659,
4366,
445,
15,
13,
16,
13,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_indirect_xoffset_am_1() {
let mut cpu = setup(0x00, true, 0x21, Some(0x20));
*cpu.regset_mut().x_index_mut() = 0x04;
cpu.writ_byte(0x24, 0x74);
cpu.writ_byte(0x25, 0x20);
cpu.writ_byte(0x2074, 0x10);
let result = indirect_x_am(&mut cpu);
assert_eq!(
result.ok(),
Some(Fetched {
value: 0x10,
address: 0x2074,
})
);
} | rust_cleaned_test_functions.jsonl/26583 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 288
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9122,
1226,
3212,
3176,
22880,
62,
16,
368,
341,
286,
1077,
5206,
17319,
284,
6505,
7,
15,
87,
15,
15,
11,
830,
11,
220,
15,
87,
17,
16,
11,
4329,
7,
15,
87,
17,
15,
1106,
286,
353,
1647... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parens() {
assert_eq!(radix_calc::expr("(5 * 4)"), Ok((5 * 4)));
assert_eq!(radix_calc::expr("(5 + 4) * 2"), Ok((5 + 4) * 2));
assert_eq!(radix_calc::expr("(5 + 4) * 2**2"), Ok((5 + 4) * 4));
assert_eq!(radix_calc::expr("(5**2 + 4) * 2**2"), Ok((25 + 4) * 4));
} | rust_cleaned_test_functions.jsonl/60552 | {
"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,
620,
546,
4412,
368,
341,
262,
2060,
10714,
10297,
13281,
941,
38241,
486,
9413,
31732,
20,
353,
220,
19,
8,
3975,
7622,
1188,
20,
353,
220,
19,
4945,
262,
2060,
10714,
10297,
13281,
941,
38241,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_state_2() {
// The order in which things will be visited is important to this
// graph:
// v | |
// | v |
let graph = TestGraph::new(0, &[(0, 1), (0, 4), (1, 2), (1, 3), (2, 1), (3, 0), (4, 2)]);
// and at this point detect a cycle. The state of 2 will thus be
// will be in the state `InCycleWith { 3 }`.
// the states of the nodes are:
// 0 BeingVisited { 0 }
// 1 InCycleWith { 3 }
// 2 InCycleWith { 1 }
// 3 InCycleWith { 0 }
// If will also collapse the states to the following:
// 0 BeingVisited { 0 }
// 1 InCycleWith { 3 }
// 2 InCycleWith { 1 }
// 3 InCycleWith { 0 }
let sccs: Sccs<_, usize> = Sccs::new(&graph);
assert_eq!(sccs.num_sccs(), 1);
assert_eq!(sccs.scc(0), 0);
assert_eq!(sccs.scc(1), 0);
assert_eq!(sccs.scc(2), 0);
assert_eq!(sccs.scc(3), 0);
assert_eq!(sccs.scc(4), 0);
assert_eq!(sccs.successors(0), &[]);
} | rust_cleaned_test_functions.jsonl/83570 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 581
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
4387,
62,
17,
368,
341,
262,
442,
576,
1973,
304,
892,
2513,
686,
387,
11994,
374,
2989,
311,
419,
7213,
262,
442,
4771,
510,
9401,
41693,
262,
442,
257,
348,
262,
760,
9248,
9401,
262,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mutable_reserve() {
let mut buf = MutableBuffer::new(1);
assert_eq!(64, buf.capacity());
// Reserving a smaller capacity should have no effect.
buf.reserve(10);
assert_eq!(64, buf.capacity());
buf.reserve(80);
assert_eq!(128, buf.capacity());
buf.reserve(129);
assert_eq!(256, buf.capacity());
} | rust_cleaned_test_functions.jsonl/45257 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 186
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
5922,
89591,
368,
341,
286,
1077,
5206,
6607,
284,
31143,
4095,
486,
931,
7,
16,
317,
286,
2060,
10714,
10297,
21,
19,
11,
6607,
59168,
5231,
286,
442,
1800,
19505,
264,
9155,
8654,
1265,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_access_not_existing() {
let tempdir = tempdir().unwrap();
let dir = tempdir.path().join("does_not_exist.txt");
assert_eq!(access(&dir, AccessFlags::F_OK).err().unwrap().as_errno().unwrap(),
Errno::ENOENT);
} | rust_cleaned_test_functions.jsonl/104834 | {
"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,
12759,
7913,
62630,
368,
341,
262,
1077,
2730,
3741,
284,
2730,
3741,
1005,
15454,
543,
262,
1077,
5419,
284,
2730,
3741,
3875,
1005,
5987,
445,
27057,
7913,
35906,
3909,
797,
262,
2060,
10714,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_permissions_request_write() {
let guard = PERMISSION_PROMPT_GUARD.lock().unwrap();
let whitelist = vec![PathBuf::from("/foo/bar")];
let mut perms0 = DenoPermissions::from_flags(&Flags {
write_whitelist: whitelist.clone(),
..Default::default()
});
set_prompt_result(false);
// regardless of prompt result
assert_eq!(
perms0.request_write(&Some(Path::new("/foo/bar"))),
PermissionState::Allow
);
let mut perms1 = DenoPermissions::from_flags(&Flags {
write_whitelist: whitelist.clone(),
..Default::default()
});
set_prompt_result(true);
assert_eq!(
perms1.request_write(&Some(Path::new("/foo/baz"))),
PermissionState::Allow
);
let mut perms2 = DenoPermissions::from_flags(&Flags {
write_whitelist: whitelist,
..Default::default()
});
set_prompt_result(false);
assert_eq!(
perms2.request_write(&Some(Path::new("/foo/baz"))),
PermissionState::Deny
);
drop(guard);
} | rust_cleaned_test_functions.jsonl/78060 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 448
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44767,
7893,
9165,
368,
341,
262,
1077,
7616,
284,
96540,
71346,
2828,
84513,
7376,
21003,
1005,
15454,
543,
262,
1077,
67727,
284,
7486,
20703,
1820,
15064,
486,
1499,
4283,
7975,
49513,
899,
935,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_ldm2() {
match decode_16(0xc908) {
Instruction::LDM { params, thumb32 } => {
assert!(params.rn == Reg::R1);
let elems: Vec<_> = params.registers.iter().collect();
assert_eq!(vec![Reg::R3], elems);
assert!(!thumb32);
}
_ => {
assert!(false);
}
}
} | rust_cleaned_test_functions.jsonl/64771 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 216
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
50573,
76,
17,
368,
341,
1066,
262,
2432,
16895,
62,
16,
21,
7,
15,
8148,
24,
15,
23,
8,
341,
286,
29051,
486,
43,
8395,
314,
3628,
11,
24050,
18,
17,
335,
589,
341,
310,
2060,
1029... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_get_left_child() {
let node_1 = Node::new(
String::from("a"),
Some("ausdhiank"),
Color::Red,
None,
None,
None,
);
let node_1_rc = Rc::new(RefCell::new(node_1));
let node_2 = Node::new(
String::from("a"),
Some("asbjks"),
Color::Red,
Some(Rc::clone(&node_1_rc)),
None,
None,
);
assert!(Rc::ptr_eq(&node_1_rc, &node_2.get_left_child().unwrap()))
} | rust_cleaned_test_functions.jsonl/61993 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 346
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
9579,
17268,
368,
341,
286,
1077,
2436,
62,
16,
284,
6018,
486,
931,
1006,
310,
923,
486,
1499,
445,
64,
4461,
310,
4329,
445,
11855,
30621,
1103,
74,
4461,
310,
3478,
486,
6033,
345,
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_vote_balance_and_staked_normal() {
let stakes_cache = StakesCache::default();
impl Stakes<StakeAccount> {
pub fn vote_balance_and_warmed_staked(&self) -> u64 {
self.vote_accounts
.iter()
.map(|(_pubkey, (staked, account))| staked + account.lamports())
.sum()
}
}
let genesis_epoch = 0;
let ((vote_pubkey, vote_account), (stake_pubkey, stake_account)) =
create_warming_staked_node_accounts(10, genesis_epoch);
stakes_cache.check_and_store(&vote_pubkey, &vote_account);
stakes_cache.check_and_store(&stake_pubkey, &stake_account);
{
let stakes = stakes_cache.stakes();
assert_eq!(stakes.vote_balance_and_staked(), 11);
assert_eq!(stakes.vote_balance_and_warmed_staked(), 1);
}
let thread_pool = ThreadPoolBuilder::new().num_threads(1).build().unwrap();
for (epoch, expected_warmed_stake) in ((genesis_epoch + 1)..=3).zip(&[2, 3, 4]) {
stakes_cache.activate_epoch(epoch, &thread_pool);
let stakes = stakes_cache.stakes();
assert_eq!(stakes.vote_balance_and_staked(), 11);
assert_eq!(
stakes.vote_balance_and_warmed_staked(),
*expected_warmed_stake
);
}
} | rust_cleaned_test_functions.jsonl/22043 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 745
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54360,
29396,
8378,
1261,
7741,
13973,
368,
341,
286,
1077,
44425,
11529,
284,
794,
2050,
8233,
486,
2258,
543,
286,
11605,
794,
2050,
27,
623,
726,
7365,
29,
341,
310,
6675,
5168,
6910,
29396,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.