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_hash() { let hash = compute_hash(b"hello world"); assert_eq!( &hash, "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9" ); }
rust_cleaned_test_functions.jsonl/10325
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 132 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8950, 368, 341, 286, 1077, 5175, 284, 12564, 8950, 1883, 1, 14990, 1879, 797, 286, 2060, 10714, 33673, 310, 609, 8296, 345, 310, 330, 65, 24, 19, 67, 17, 22, 65, 24, 24, 18, 19, 67, 18, 68...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_split_off_unicode() { let mut nihon = String::from("日本語"); let go = nihon.split_off("日本".len()); assert_eq!(nihon, "日本"); assert_eq!(go, "語"); }
rust_cleaned_test_functions.jsonl/3172
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 100 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 17052, 13651, 54662, 368, 341, 262, 1077, 5206, 308, 6996, 263, 284, 923, 486, 1499, 445, 101059, 102819, 797, 262, 1077, 728, 284, 308, 6996, 263, 5289, 13651, 445, 101059, 3263, 2892, 1423, 262,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_shape_boundaries() { let sample_rate = SampleRate(128); let mut context = OfflineAudioContext::new(1, 3 * 128, sample_rate); let shaper = context.create_wave_shaper(); let curve = vec![-0.5, 0., 0.5]; shaper.set_curve(curve); shaper.connect(&context.destination()); let mut data = vec![0.; 3 * 128]; let mut expected = vec![0.; 3 * 128]; for i in 0..(3 * 128) { if i < 128 { data[i] = -1.; expected[i] = -0.5; } else if i < 2 * 128 { data[i] = 0.; expected[i] = 0.; } else { data[i] = 1.; expected[i] = 0.5; } } let mut buffer = context.create_buffer(1, 3 * 128, sample_rate); buffer.copy_to_channel(&data, 0); let src = context.create_buffer_source(); src.connect(&shaper); src.set_buffer(buffer); src.start_at(0.); let result = context.start_rendering(); let channel = result.get_channel_data(0); assert_float_eq!(channel[..], expected[..], abs_all <= 0.); }
rust_cleaned_test_functions.jsonl/94710
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 618 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13597, 19447, 5431, 368, 341, 286, 1077, 6077, 9246, 284, 19143, 11564, 7, 16, 17, 23, 317, 286, 1077, 5206, 2266, 284, 66370, 14755, 1972, 486, 931, 7, 16, 11, 220, 18, 353, 220, 16, 17, 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...
4
#[test] fn test_find_sig_with_root_ancestor_fork() { let sig = Signature::default(); let mut status_cache = BankStatusCache::default(); let blockhash = hash(Hash::default().as_ref()); let ancestors = HashMap::new(); status_cache.insert(&blockhash, &sig, 0, ()); status_cache.add_root(0); assert_eq!( status_cache.get_signature_status(&sig, &blockhash, &ancestors), Some((0, ())) ); }
rust_cleaned_test_functions.jsonl/23941
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 225 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21814, 29252, 6615, 12993, 62, 66878, 761, 669, 368, 341, 286, 1077, 8366, 284, 32232, 486, 2258, 543, 286, 1077, 5206, 2639, 11529, 284, 8547, 2522, 8233, 486, 2258, 543, 286, 1077, 2504, 8296, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_first_order_problem_rkf45_adaptive() -> Result<(), Error> { let lambda = -0.1; let dydt = |_t: f64, y: &[f64]| -> Vec<f64> { vec![lambda * y[0]] }; let y_true = |t: f64| -> f64 { f64::exp(lambda * t) }; let options = AdaptiveOdeSolverOptions { t_initial: 0.0, t_final: 3.0, dt_initial: 0.1, error_control: ErrorControlOptions::simple(1e-6), }; let mut y = [1.0]; rkf45_adaptive(&mut y, &dydt, &options)?; let actual_error = (y_true(options.t_final) - y[0]).abs(); assert_lt!(actual_error, 1e-5); assert_gt!(actual_error, 1e-7); Ok(()) }
rust_cleaned_test_functions.jsonl/23081
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 390 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 12978, 7869, 60139, 1710, 81869, 19, 20, 10027, 27781, 368, 1464, 5714, 68843, 4600, 29, 341, 286, 1077, 12459, 284, 481, 15, 13, 16, 280, 286, 1077, 13955, 8047, 284, 70886, 83, 25, 282, 21, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_aes256() { let src = b"\x00\x01\x02\x03\x04\x05\x06\x07\ \x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"; let key = b"\x00\x01\x02\x03\x04\x05\x06\x07\ \x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\ \x10\x11\x12\x13\x14\x15\x16\x17\ \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"; let expect = b"\x5a\x6e\x04\x57\x08\xfb\x71\x96\ \xf0\x2e\x55\x3d\x02\xc3\xa6\x92"; let dst = aes256_ret(src, key); assert_eq!(&dst, expect); }
rust_cleaned_test_functions.jsonl/89380
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 427 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 90958, 17, 20, 21, 368, 341, 286, 1077, 2286, 284, 293, 11934, 87, 15, 15, 3462, 15, 16, 3462, 15, 17, 3462, 15, 18, 3462, 15, 19, 3462, 15, 20, 3462, 15, 21, 3462, 15, 22, 5661, 503, 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_record_after() { let tmp_dir = tempdir().unwrap().path().to_owned(); let mut c = CommitLog::new(tmp_dir, 50, 10000).unwrap(); c.write(b"this-has-less-20b").unwrap(); c.write(b"second-record").unwrap(); c.write(b"third-record-bigger-goes-to-another-segment") .unwrap(); // segment switch trigger let record = Record { current_offset: 0, segment_index: 0 }; let reader = Reader { commit_log: &c, }; let record_after = Reader::record_after(&record, 1); assert_eq!(record_after.current_offset, 1); assert_eq!(record_after.segment_index, 0); assert_eq!(reader.read(&record_after).unwrap(), "second-record".as_bytes()); }
rust_cleaned_test_functions.jsonl/115600
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 376 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14192, 19844, 368, 341, 286, 1077, 4174, 4334, 284, 2730, 3741, 1005, 15454, 1005, 2343, 1005, 983, 51973, 543, 286, 1077, 5206, 272, 284, 9205, 2201, 486, 931, 10368, 4334, 11, 220, 20, 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_field_operations() { let f1 = PerfStatisticsFields { internal_key_skipped_count: 1, internal_delete_skipped_count: 2, block_cache_hit_count: 3, block_read_count: 4, block_read_byte: 5, ..Default::default() }; let f2 = PerfStatisticsFields { internal_key_skipped_count: 2, internal_delete_skipped_count: 3, block_cache_hit_count: 5, block_read_count: 7, block_read_byte: 11, ..Default::default() }; let f3 = f1 + f2; assert_eq!(f3.internal_key_skipped_count, 3); assert_eq!(f3.block_cache_hit_count, 8); assert_eq!(f3.block_read_byte, 16); let mut f3 = f1; f3 += f2; assert_eq!(f3.internal_key_skipped_count, 3); assert_eq!(f3.block_cache_hit_count, 8); assert_eq!(f3.block_read_byte, 16); let f3 = f2 - f1; assert_eq!(f3.internal_key_skipped_count, 1); assert_eq!(f3.block_cache_hit_count, 2); assert_eq!(f3.block_read_byte, 6); let mut f3 = f2; f3 -= f1; assert_eq!(f3.internal_key_skipped_count, 1); assert_eq!(f3.block_cache_hit_count, 2); assert_eq!(f3.block_read_byte, 6); }
rust_cleaned_test_functions.jsonl/76515
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 733 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5013, 57345, 368, 341, 286, 1077, 282, 16, 284, 71448, 38599, 8941, 341, 310, 5306, 3097, 33811, 6450, 3180, 25, 220, 16, 345, 310, 5306, 11353, 33811, 6450, 3180, 25, 220, 17, 345, 310, 2504, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_cast_bool_to_f64() { let a = BooleanArray::from(vec![Some(true), Some(false), None]); let array = Arc::new(a) as ArrayRef; let b = cast(&array, &DataType::Float64).unwrap(); let c = b.as_any().downcast_ref::<Float64Array>().unwrap(); assert!(1.0 - c.value(0) < f64::EPSILON); assert!(0.0 - c.value(1) < f64::EPSILON); assert_eq!(false, c.is_valid(2)); }
rust_cleaned_test_functions.jsonl/29608
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 218 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5303, 22159, 2346, 761, 21, 19, 368, 341, 286, 1077, 264, 284, 6992, 1857, 486, 1499, 25592, 20703, 8373, 3715, 701, 4329, 3576, 701, 2240, 2558, 286, 1077, 1334, 284, 19689, 486, 931, 2877, 8, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_cancel_transfer() { let mut accounts = vec![ Account::new(1, 0, id()), Account::new(0, 512, id()), Account::new(0, 0, id()), ]; let from_account = 0; let contract_account = 1; let pay_account = 2; let from = Keypair::new(); let contract = Keypair::new(); let to = Keypair::new(); let dt = Utc::now(); let tx = BudgetTransaction::new_on_date( &from, to.pubkey(), contract.pubkey(), dt, from.pubkey(), Some(from.pubkey()), 1, Hash::default(), ); process_transaction(&tx, &mut accounts).unwrap(); assert_eq!(accounts[from_account].tokens, 0); assert_eq!(accounts[contract_account].tokens, 1); let program = BudgetProgram::deserialize(&accounts[contract_account].userdata).unwrap(); assert!(program.is_pending()); // Attack! try to put the tokens into the wrong account with cancel let tx = BudgetTransaction::new_signature(&to, contract.pubkey(), to.pubkey(), Hash::default()); // creating more account vectors process_transaction(&tx, &mut accounts).unwrap(); // nothing should be changed because apply witness didn't finalize a payment assert_eq!(accounts[from_account].tokens, 0); assert_eq!(accounts[contract_account].tokens, 1); assert_eq!(accounts[pay_account].tokens, 0); let tx = BudgetTransaction::new_signature( &from, contract.pubkey(), from.pubkey(), Hash::default(), ); process_transaction(&tx, &mut accounts).unwrap(); assert_eq!(accounts[from_account].tokens, 1); assert_eq!(accounts[contract_account].tokens, 0); assert_eq!(accounts[pay_account].tokens, 0); // try to replay the cancel contract let tx = BudgetTransaction::new_signature( &from, contract.pubkey(), from.pubkey(), Hash::default(), ); assert_eq!( process_transaction(&tx, &mut accounts), Err(BudgetError::ContractNotPending) ); assert_eq!(accounts[from_account].tokens, 1); assert_eq!(accounts[contract_account].tokens, 0); assert_eq!(accounts[pay_account].tokens, 0); }
rust_cleaned_test_functions.jsonl/30411
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1189 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 28895, 35403, 368, 341, 286, 1077, 5206, 9618, 284, 7486, 90515, 310, 8615, 486, 931, 7, 16, 11, 220, 15, 11, 877, 14702, 310, 8615, 486, 931, 7, 15, 11, 220, 20, 16, 17, 11, 877, 14702, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_whole_workflow () { let current_dir = env!("CARGO_MANIFEST_DIR").replace("\\", "/"); let config = config_manager::create_config_from_args(&format!("{}/src,{}/tests --threads 1 3 ",current_dir, current_dir)).unwrap(); let language_map = io_handler::parse_supported_languages_to_map(&LOCAL_APP_PATHS.languages_dir).unwrap().0; let language_map_len = language_map.len(); assert_eq!(Threads::new(1,3), config.threads); assert_eq!(vec![format!("{}/src",current_dir), format!("{}/tests", current_dir)], config.dirs); assert!(language_map.len() != 0); let config = Arc::new(config); let mut files_present = FilesPresent::default(); let faulty_files_ref : FaultyFilesListMut = Arc::new(Mutex::new(Vec::new())); let finish_condition_ref = Arc::new(AtomicBool::new(false)); let language_map = Arc::new(language_map); let languages_content_info_ref = Arc::new(Mutex::new(make_language_stats(language_map.clone()))); let files_injector = Arc::new(Injector::new()); let dirs_injector = Arc::new(Injector::new()); let producer_termination_states = Arc::new(Mutex::new(vec![false])); let languages_metadata_map = Arc::new(Mutex::new(make_language_metadata(&language_map))); assert!(languages_metadata_map.lock().unwrap().len() == language_map_len); calculate_single_file_stats_or_add_to_injector(&config, &dirs_injector, &files_injector, &mut files_present, &language_map, &languages_metadata_map); let (total_files_num, relevant_files_num, _) = producer::search_for_files(0, files_injector.clone(), dirs_injector.clone(), Worker::new_fifo(), producer_termination_states, language_map.clone(), languages_metadata_map.clone(), config.clone()); finish_condition_ref.store(true, Ordering::Relaxed); consumer::start_parsing_files(0, files_injector, faulty_files_ref.clone(), finish_condition_ref, languages_content_info_ref.clone(), language_map.clone(), config); let mut content_info_map_guard = languages_content_info_ref.lock(); let content_info_map = content_info_map_guard.as_deref_mut().unwrap(); let mut languages_metadata_map_guard = languages_metadata_map.lock(); let languages_metadata_map = languages_metadata_map_guard.as_deref_mut().unwrap(); remove_languages_with_0_files(content_info_map, languages_metadata_map); assert!(relevant_files_num != 0 && total_files_num != 0); let first_lang_metadata = languages_metadata_map.iter().next().unwrap().1; assert!(first_lang_metadata.files != 0 && first_lang_metadata.bytes != 0); assert!(faulty_files_ref.clone().lock().unwrap().len() == 0); let mut keyword_num = 0; for content_info in content_info_map.iter() { content_info.1.keyword_occurences.iter().for_each(|x| keyword_num += x.1); } assert!(keyword_num != 0); }
rust_cleaned_test_functions.jsonl/53483
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1070 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 36225, 1263, 86418, 1719, 341, 262, 1077, 1482, 4334, 284, 6105, 17223, 34, 7581, 46, 25143, 91120, 8291, 1827, 8156, 29710, 497, 97539, 262, 1077, 2193, 284, 2193, 12144, 486, 3182, 5332, 5673, 8...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
#[test] fn test_column_expand() { check_expansion( r#" #[rustc_builtin_macro] macro_rules! column {() => {}} column!() "#, expect![["0"]], ); }
rust_cleaned_test_functions.jsonl/112668
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 155 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8744, 67875, 368, 341, 286, 1779, 14214, 10501, 1006, 310, 435, 2, 698, 310, 11506, 35788, 66, 73829, 58810, 921, 310, 18072, 21407, 0, 3250, 314, 368, 589, 4687, 532, 310, 3250, 0, 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
#[test] fn test_linear_search_sse2_128_u32() { let mut block = [0u32; COMPRESSION_BLOCK_SIZE]; for el in 0u32..128u32 { block[el as usize] = el * 2 + 1 << 18; } let target = block[64] + 1; assert_eq!(linear_search_sse2_128(&AlignedBuffer(block), target), 65); }
rust_cleaned_test_functions.jsonl/29769
{ "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, 40674, 10716, 643, 325, 17, 62, 16, 17, 23, 7300, 18, 17, 368, 341, 310, 1077, 5206, 2504, 284, 508, 15, 84, 18, 17, 26, 7682, 63824, 18756, 4098, 935, 310, 369, 655, 304, 220, 15, 84, 18,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_system_transaction_layout() { let tx = test_tx(); let tx_bytes = serialize(&tx).unwrap(); let message_data = tx.message_data(); let mut packet = sigverify::make_packet_from_transaction(tx.clone()); let packet_offsets = sigverify::get_packet_offsets(&mut packet, 0, false); assert_eq!( memfind(&tx_bytes, tx.signatures[0].as_ref()), Some(SIG_OFFSET) ); assert_eq!( memfind(&tx_bytes, tx.message().account_keys[0].as_ref()), Some(packet_offsets.pubkey_start as usize) ); assert_eq!( memfind(&tx_bytes, &message_data), Some(packet_offsets.msg_start as usize) ); assert_eq!( memfind(&tx_bytes, tx.signatures[0].as_ref()), Some(packet_offsets.sig_start as usize) ); assert_eq!(packet_offsets.sig_len, 1); }
rust_cleaned_test_functions.jsonl/22071
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 482 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 17687, 28884, 14466, 368, 341, 286, 1077, 9854, 284, 1273, 17805, 543, 286, 1077, 9854, 12524, 284, 24235, 2099, 3998, 568, 15454, 543, 286, 1077, 1943, 1769, 284, 9854, 6698, 1769, 543, 286, 1077...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_signed_with_a_second_passphrase() { let transaction = builder::build_transfer( "this is a top secret passphrase", Some("this is a top secret second passphrase"), "AXoXnFi4z1Z6aFvjEYkDVCtBGW2PaRiM25", 133_380_000_000, "This is a transaction from Rust", ); let second_public_key = public_key::from_passphrase("this is a top secret second passphrase") .unwrap() .to_string(); assert!(transaction.is_ok()); assert!(transaction.as_ref().unwrap().verify()); assert!(transaction .as_ref() .unwrap() .second_verify(&second_public_key)); }
rust_cleaned_test_functions.jsonl/117169
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 293 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 55617, 6615, 4306, 29644, 15464, 27710, 368, 341, 262, 1077, 7745, 284, 7363, 486, 5834, 35403, 1006, 286, 330, 574, 374, 264, 1909, 6234, 75493, 756, 286, 4329, 445, 574, 374, 264, 1909, 6234, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_rotate_bicubic_rgb() { fn rotate_bicubic_about_center(image: &RgbImage) -> RgbImage { rotate_about_center( image, std::f32::consts::PI / 4f32, Interpolation::Bicubic, Rgb::black(), ) } compare_to_truth_with_tolerance( "elephant.png", "elephant_rotate_bicubic.png", rotate_bicubic_about_center, 2, ); }
rust_cleaned_test_functions.jsonl/81464
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 247 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 60834, 880, 292, 41181, 37407, 368, 341, 262, 5168, 16919, 880, 292, 41181, 57975, 21087, 10075, 25, 609, 80951, 1906, 8, 1464, 431, 9511, 1906, 341, 286, 16919, 57975, 21087, 1006, 310, 2168, 345...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_add_timeout_stop() { System::new().block_on(async { let _addr = MyActor { op: Op::TimeoutStop, } .start(); }); }
rust_cleaned_test_functions.jsonl/56893
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 97 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2891, 20537, 19039, 368, 341, 262, 739, 486, 931, 1005, 4574, 4470, 18285, 341, 286, 1077, 716, 6214, 284, 3017, 18870, 341, 310, 1179, 25, 10672, 486, 7636, 10674, 345, 286, 456, 286, 659, 2468...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_against_modified_index_deeply_nested() { let temp_dir = TempDir::default(); let mut index = test_repo(&temp_dir, &vec![Path::new("dir_1/dir_2/dir_3/file.txt")]); let dir_entries = index.entries.get_mut("dir_1/dir_2/dir_3").unwrap(); dir_entries[0].stat.mtime += 1; dir_entries[0].stat.size += 1; let value = WorkTree::diff_against_index(&temp_dir, index).unwrap(); let entries = vec![StatusEntry { name: "dir_1/dir_2/dir_3/file.txt".to_string(), state: Status::Modified(None), }]; assert_eq!(value.entries, entries); }
rust_cleaned_test_functions.jsonl/36170
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 311 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15850, 62427, 267, 37749, 3560, 87044, 398, 66279, 368, 341, 286, 1077, 2730, 4334, 284, 19944, 6184, 486, 2258, 543, 286, 1077, 5206, 1922, 284, 1273, 37784, 2099, 3888, 4334, 11, 609, 4083, 2070...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_puzzle_with_eight_letters() { assert_alphametic_solution_eq( "SEND + MORE == MONEY", &[ ('S', 9), ('E', 5), ('N', 6), ('D', 7), ('M', 1), ('O', 0), ('R', 8), ('Y', 2), ], ); }
rust_cleaned_test_functions.jsonl/60615
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 218 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 620, 14945, 6615, 2204, 491, 67330, 368, 341, 262, 2060, 8418, 759, 309, 5298, 50274, 10714, 1006, 286, 330, 61674, 488, 18447, 621, 93462, 756, 286, 609, 9640, 310, 4319, 50, 516, 220, 24, 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...
1
#[test] fn test_candidate_spu_no_online() { let status = PartitionStatus::new( (5000, 100, 110), vec![ (5001, 95, 110).into(), (5002, 100, 105).into(), // need 5 offset to caught with leaser ], ); let online_spu = HashSet::new(); let policy = SimplePolicy {}; assert!(status.candidate_leader(&online_spu, &policy).is_none()); }
rust_cleaned_test_functions.jsonl/106841
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 230 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 62360, 643, 5584, 6536, 51546, 368, 341, 286, 1077, 2639, 284, 54626, 2522, 486, 931, 1006, 310, 320, 20, 15, 15, 15, 11, 220, 16, 15, 15, 11, 220, 16, 16, 15, 1326, 310, 7486, 90515, 394, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_isaac_construction() { // Test that various construction techniques produce a working RNG. let seed = [1,0,0,0, 23,0,0,0, 200,1,0,0, 210,30,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0]; let mut rng1 = IsaacRng::from_seed(seed); assert_eq!(rng1.next_u32(), 2869442790); let mut rng2 = IsaacRng::from_rng(rng1).unwrap(); assert_eq!(rng2.next_u32(), 3094074039); }
rust_cleaned_test_functions.jsonl/52738
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 251 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6892, 64705, 3382, 3024, 368, 341, 286, 442, 3393, 429, 5257, 8086, 12538, 8193, 264, 3238, 72606, 624, 286, 1077, 10320, 284, 508, 16, 11, 15, 11, 15, 11, 15, 11, 220, 17, 18, 11, 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_build_microvm_from_requests() { // Use atomics to be able to use them non-mutably in closures below. use std::sync::atomic::{AtomicUsize, Ordering}; let cmd_step = AtomicUsize::new(0); let commands = || { cmd_step.fetch_add(1, Ordering::SeqCst); match cmd_step.load(Ordering::SeqCst) { 1 => VmmAction::FlushMetrics, 2 => VmmAction::Pause, 3 => VmmAction::Resume, 4 => VmmAction::StartMicroVm, _ => unreachable!(), } }; let resp_step = AtomicUsize::new(0); let expected_resp = |resp: ActionResult| { resp_step.fetch_add(1, Ordering::SeqCst); let expect = match resp_step.load(Ordering::SeqCst) { 1 => Err(VmmActionError::OperationNotSupportedPreBoot), 2 => Err(VmmActionError::OperationNotSupportedPreBoot), 3 => Err(VmmActionError::OperationNotSupportedPreBoot), 4 => Ok(VmmData::Empty), _ => unreachable!(), }; assert_eq!(resp, expect); }; let (_vm_res, _vmm) = PrebootApiController::build_microvm_from_requests( vec![], &mut EventManager::new().unwrap(), InstanceInfo { id: String::new(), state: "Not started".to_string(), vmm_version: String::new(), app_name: String::new(), }, commands, expected_resp, false, ); }
rust_cleaned_test_functions.jsonl/44537
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 859 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 20801, 73003, 7338, 5673, 37216, 368, 341, 286, 442, 5443, 19124, 1211, 311, 387, 2952, 311, 990, 1105, 2477, 1448, 332, 2845, 304, 59900, 3685, 624, 286, 990, 1460, 486, 12996, 486, 6618, 22964, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_add_used() { let m = &GuestMemoryMmap::from_ranges(&[(GuestAddress(0), 0x10000)]).unwrap(); let vq = VirtQueue::new(GuestAddress(0), m, 16); let mut q = vq.create_queue(); assert_eq!(vq.used.idx.get(), 0); //index too large q.add_used(m, 16, 0x1000); assert_eq!(vq.used.idx.get(), 0); //should be ok q.add_used(m, 1, 0x1000); assert_eq!(vq.used.idx.get(), 1); let x = vq.used.ring[0].get(); assert_eq!(x.id, 1); assert_eq!(x.len, 0x1000); }
rust_cleaned_test_functions.jsonl/3578
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 311 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2891, 27803, 368, 341, 286, 1077, 296, 284, 609, 37804, 10642, 44, 2186, 486, 1499, 58748, 2099, 9697, 37804, 4286, 7, 15, 701, 220, 15, 87, 16, 15, 15, 15, 15, 7252, 568, 15454, 543, 286, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_multiple_experiment_keys_should_err() -> Result<(), Error> { let ex_key = "test_experimental_key".to_string(); let ex_key_2 = "test_experimental_key_2".to_string(); let result: Result<ProxyMap, Error> = parse2(quote! { #ex_key, #ex_key_2, }); assert!(result.is_err()); Ok(()) }
rust_cleaned_test_functions.jsonl/85725
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 189 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 45233, 82302, 12631, 43378, 9266, 368, 1464, 5714, 68843, 4600, 29, 341, 286, 1077, 505, 3097, 284, 330, 1944, 2702, 25513, 3097, 3263, 983, 3904, 543, 286, 1077, 505, 3097, 62, 17, 284, 330, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_parse_bytes_not_indexed() { let error = parse_query_to_logical_ast("bytes_not_indexed:aaa", false).unwrap_err(); assert!(matches!(error, QueryParserError::FieldNotIndexed(_))); }
rust_cleaned_test_functions.jsonl/27030
{ "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, 21039, 12524, 7913, 3560, 291, 368, 341, 286, 1077, 1465, 284, 4715, 5738, 2346, 86484, 48019, 445, 9651, 7913, 3560, 291, 25, 32646, 497, 895, 568, 15454, 9266, 543, 286, 2060, 10297, 19914, 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
#[test] fn test_pool_cap() { new_test_ext().execute_with(|| { set_block_1(); let worker1 = worker_pubkey(1); assert_ok!(PhalaRegistry::force_register_worker( Origin::root(), worker1.clone(), ecdh_pubkey(1), Some(1) )); assert_ok!(PhalaStakePool::create(Origin::signed(1))); // pid = 0 assert_eq!(PhalaStakePool::stake_pools(0).unwrap().cap, None); // Pool existence assert_noop!( PhalaStakePool::set_cap(Origin::signed(2), 100, 1), Error::<Test>::PoolDoesNotExist, ); // Owner only assert_noop!( PhalaStakePool::set_cap(Origin::signed(2), 0, 1), Error::<Test>::UnauthorizedPoolOwner, ); // Cap to 1000 PHA assert_ok!(PhalaStakePool::set_cap( Origin::signed(1), 0, 1000 * DOLLARS )); assert_eq!( PhalaStakePool::stake_pools(0).unwrap().cap, Some(1000 * DOLLARS) ); // Check cap shouldn't be less than the current stake assert_ok!(PhalaStakePool::contribute( Origin::signed(1), 0, 100 * DOLLARS )); assert_noop!( PhalaStakePool::set_cap(Origin::signed(1), 0, 99 * DOLLARS), Error::<Test>::InadequateCapacity, ); // Stake to the cap assert_ok!(PhalaStakePool::contribute( Origin::signed(1), 0, 900 * DOLLARS )); // Exceed the cap assert_noop!( PhalaStakePool::contribute(Origin::signed(2), 0, 900 * DOLLARS), Error::<Test>::StakeExceedsCapacity, ); }); }
rust_cleaned_test_functions.jsonl/60462
{ "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, 15709, 16388, 368, 341, 298, 8638, 4452, 9927, 1005, 10257, 6615, 79453, 341, 571, 8196, 7113, 62, 16, 543, 571, 10217, 11864, 16, 284, 11864, 34014, 792, 7, 16, 317, 571, 6948, 19817, 10297, 33...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_unitary() { let g = G1Affine::generator(); let h = G2Affine::generator(); let p = -pairing(&g, &h); let q = pairing(&g, &-h); let r = pairing(&-g, &h); assert_eq!(p, q); assert_eq!(q, r); }
rust_cleaned_test_functions.jsonl/30787
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 122 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14832, 658, 368, 341, 262, 1077, 342, 284, 479, 16, 25841, 482, 486, 35851, 543, 262, 1077, 305, 284, 479, 17, 25841, 482, 486, 35851, 543, 262, 1077, 281, 284, 481, 12670, 287, 2099, 70, 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_fqdn() { assert!(Name::root().is_fqdn()); assert!(Name::from_str(".").unwrap().is_fqdn()); assert!(Name::from_str("www.example.com.").unwrap().is_fqdn()); assert!(Name::from_labels(vec![b"www" as &[u8], b"example", b"com"]) .unwrap() .is_fqdn()); assert!(!Name::new().is_fqdn()); assert!(!Name::from_str("www.example.com").unwrap().is_fqdn()); assert!(!Name::from_str("www.example").unwrap().is_fqdn()); assert!(!Name::from_str("www").unwrap().is_fqdn()); }
rust_cleaned_test_functions.jsonl/38218
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 296 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 761, 80, 17395, 368, 341, 286, 2060, 10297, 675, 486, 2888, 1005, 285, 761, 80, 17395, 1423, 286, 2060, 10297, 675, 486, 1499, 2895, 73133, 568, 15454, 1005, 285, 761, 80, 17395, 1423, 286, 2060...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_finitedomain_3() { // copy_before sparse let fd = FiniteDomain::from(vec![1, 2, 3, 4, 5, 6, 7, 8]); let before = fd.copy_before(|x| *x > 6).unwrap(); assert_eq!(before.min(), 1); assert_eq!(before.max(), 6); let before = fd.copy_before(|x| *x < 0).unwrap(); assert_eq!(before, fd); assert!(fd.copy_before(|x| *x > -1).is_none()); }
rust_cleaned_test_functions.jsonl/31709
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 239 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 39737, 1608, 3121, 62, 18, 368, 341, 286, 442, 2975, 23708, 33444, 198, 286, 1077, 12414, 284, 93619, 13636, 486, 1499, 25592, 20703, 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_lazy_melt() { let df = get_df(); let out = df .lazy() .melt( vec!["petal.width".to_string(), "petal.length".to_string()], vec!["sepal.length".to_string(), "sepal.width".to_string()], ) .filter(col("variable").eq(lit("sepal.length"))) .select([col("variable"), col("petal.width"), col("value")]) .collect() .unwrap(); assert_eq!(out.shape(), (7, 3)); }
rust_cleaned_test_functions.jsonl/106
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 238 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 49646, 717, 3818, 368, 341, 262, 1077, 6764, 284, 633, 10894, 543, 262, 1077, 700, 284, 6764, 198, 286, 659, 49013, 741, 286, 659, 76, 3818, 1006, 310, 7486, 0, 1183, 6862, 278, 5441, 3263, 98...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_accounts_db_cache_clean_max_root_with_scan() { let requested_flush_root = 5; run_test_accounts_db_cache_clean_max_root( 10, requested_flush_root, Some(requested_flush_root - 1), ); run_test_accounts_db_cache_clean_max_root( 10, requested_flush_root, Some(requested_flush_root + 1), ); }
rust_cleaned_test_functions.jsonl/1422
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 232 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 55665, 8685, 11529, 19573, 6345, 12993, 6615, 28857, 368, 341, 286, 1077, 11223, 39213, 12993, 284, 220, 20, 280, 286, 1598, 4452, 55665, 8685, 11529, 19573, 6345, 12993, 1006, 310, 220, 16, 15, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_hhvm_flags_cli_de_missing_equals() { let args = ["eval.jitenablerenamefunction"]; let exp = Options::from_cli_args(args.as_ref()); assert!(exp.is_err()); let err = exp.unwrap_err(); assert!(err.starts_with("Missing '='")); assert!(err.ends_with("function")); }
rust_cleaned_test_functions.jsonl/18285
{ "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, 1523, 71, 7338, 14130, 47147, 2259, 40447, 61664, 368, 341, 286, 1077, 2827, 284, 4383, 14170, 1169, 14668, 91967, 1840, 1688, 6332, 286, 1077, 1343, 284, 14566, 486, 1499, 47147, 8384, 7356, 5357, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_seek_track() { let mut oauth = SpotifyOAuth::default() .scope("user-modify-playback-state") .build(); match get_token(&mut oauth) { Some(token_info) => { let client_credential = SpotifyClientCredentials::default() .token_info(token_info) .build(); let spotify = Spotify::default() .client_credentials_manager(client_credential) .build(); let result = spotify.seek_track(25000, None); assert!(result.is_ok()); } None => assert!(false), }; }
rust_cleaned_test_functions.jsonl/79279
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 316 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 74473, 28545, 368, 341, 262, 1077, 5206, 46415, 284, 40537, 57850, 486, 2258, 741, 286, 659, 4186, 445, 872, 17078, 1437, 26544, 1419, 20733, 1138, 286, 659, 5834, 543, 262, 2432, 633, 6458, 2099,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_rom_pad_power_of_two() { let mut rom = Vec::new(); pad_rom(&mut rom); assert_eq!(vec![PAD_BYTE; 2 * 1024 * 1024], rom); }
rust_cleaned_test_functions.jsonl/99943
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 91 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 81383, 30290, 20421, 3575, 23241, 368, 341, 286, 1077, 5206, 9882, 284, 11312, 486, 931, 1428, 286, 11016, 81383, 2099, 6984, 9882, 626, 286, 2060, 10714, 10297, 4083, 20703, 43818, 27349, 26, 220, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_new_field_with_default() { let reader_schema = Schema::parse_str( r#" {"type":"record", "name":"Record", "fields":[ {"name":"oldfield1", "type":"int"}, {"name":"newfield1", "type":"int", "default":42} ]} "#, ) .unwrap(); assert!(SchemaCompatibility::can_read( &writer_schema(), &reader_schema )); assert_eq!( SchemaCompatibility::can_read(&reader_schema, &writer_schema()), false ); }
rust_cleaned_test_functions.jsonl/21772
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 301 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5921, 5013, 6615, 9993, 368, 341, 286, 1077, 6604, 25371, 284, 12539, 486, 6400, 2895, 1006, 310, 435, 2, 698, 286, 5212, 1313, 3252, 8548, 497, 330, 606, 3252, 6471, 497, 330, 9007, 8899, 198, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_sum_forward() { let mut left = LinkedList::<i32>::new(); left.append(6); left.append(1); left.append(7); let mut right = LinkedList::<i32>::new(); right.append(2); right.append(9); right.append(5); let result = sum_forward(&left, &right); let mut iter = result.iter(); assert_eq!(iter.next().unwrap().borrow().data, 9); assert_eq!(iter.next().unwrap().borrow().data, 1); assert_eq!(iter.next().unwrap().borrow().data, 2); }
rust_cleaned_test_functions.jsonl/103822
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 271 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10160, 32121, 368, 341, 286, 1077, 5206, 2115, 284, 22917, 27638, 72, 18, 17, 6831, 931, 543, 286, 2115, 2057, 7, 21, 317, 286, 2115, 2057, 7, 16, 317, 286, 2115, 2057, 7, 22, 626, 286, 1077...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_panic_propagates_single_thread() { let _result: Vec<usize> = Executor::single_thread() .map( |_| { panic!("panic should propagate"); }, vec![0].into_iter(), ) .unwrap(); }
rust_cleaned_test_functions.jsonl/113303
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 188 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 620, 31270, 21663, 351, 973, 19487, 10814, 368, 341, 286, 1077, 716, 1382, 25, 11312, 90244, 29, 284, 56032, 486, 15338, 10814, 741, 310, 659, 2186, 1006, 394, 66091, 341, 503, 21975, 17223, 19079...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_date_from_isoywd() { let isoywd_opt = NaiveDate::from_isoywd_opt; let ymd = NaiveDate::from_ymd; assert_eq!(isoywd_opt(2004, 0, Weekday::Sun), None); assert_eq!(isoywd_opt(2004, 1, Weekday::Mon), Some(ymd(2003, 12, 29))); assert_eq!(isoywd_opt(2004, 1, Weekday::Sun), Some(ymd(2004, 1, 4))); assert_eq!(isoywd_opt(2004, 2, Weekday::Mon), Some(ymd(2004, 1, 5))); assert_eq!(isoywd_opt(2004, 2, Weekday::Sun), Some(ymd(2004, 1, 11))); assert_eq!(isoywd_opt(2004, 52, Weekday::Mon), Some(ymd(2004, 12, 20))); assert_eq!(isoywd_opt(2004, 52, Weekday::Sun), Some(ymd(2004, 12, 26))); assert_eq!(isoywd_opt(2004, 53, Weekday::Mon), Some(ymd(2004, 12, 27))); assert_eq!(isoywd_opt(2004, 53, Weekday::Sun), Some(ymd(2005, 1, 2))); assert_eq!(isoywd_opt(2004, 54, Weekday::Mon), None); assert_eq!(isoywd_opt(2011, 0, Weekday::Sun), None); assert_eq!(isoywd_opt(2011, 1, Weekday::Mon), Some(ymd(2011, 1, 3))); assert_eq!(isoywd_opt(2011, 1, Weekday::Sun), Some(ymd(2011, 1, 9))); assert_eq!(isoywd_opt(2011, 2, Weekday::Mon), Some(ymd(2011, 1, 10))); assert_eq!(isoywd_opt(2011, 2, Weekday::Sun), Some(ymd(2011, 1, 16))); assert_eq!(isoywd_opt(2018, 51, Weekday::Mon), Some(ymd(2018, 12, 17))); assert_eq!(isoywd_opt(2018, 51, Weekday::Sun), Some(ymd(2018, 12, 23))); assert_eq!(isoywd_opt(2018, 52, Weekday::Mon), Some(ymd(2018, 12, 24))); assert_eq!(isoywd_opt(2018, 52, Weekday::Sun), Some(ymd(2018, 12, 30))); assert_eq!(isoywd_opt(2018, 53, Weekday::Mon), None); }
rust_cleaned_test_functions.jsonl/29543
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 836 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4164, 5673, 6892, 2253, 6377, 368, 341, 286, 1077, 374, 2253, 6377, 15032, 284, 12812, 533, 1916, 486, 1499, 6892, 2253, 6377, 15032, 280, 286, 1077, 379, 2277, 284, 12812, 533, 1916, 486, 1499, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_rust_function() -> Result<()> { let lua = Lua::new(); let globals = lua.globals(); lua.load( r#" function lua_function() return rust_function() end -- Test to make sure chunk return is ignored return 1 "#, ) .exec()?; let lua_function = globals.get::<_, Function>("lua_function")?; let rust_function = lua.create_function(|_, ()| Ok("hello"))?; globals.set("rust_function", rust_function)?; assert_eq!(lua_function.call::<_, String>(())?, "hello"); Ok(()) }
rust_cleaned_test_functions.jsonl/4914
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 265 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1710, 590, 9174, 368, 1464, 5714, 71698, 341, 262, 1077, 20357, 284, 37662, 486, 931, 1428, 262, 1077, 37785, 284, 20357, 1302, 16616, 543, 262, 20357, 5104, 1006, 286, 435, 2, 698, 286, 729, 20...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
#[test] fn test_dim_extended_inside_function_name_clashing_function_name() { let program = r#" FUNCTION Hello Dim Hello AS STRING END FUNCTION "#; assert_linter_err!(program, QError::DuplicateDefinition, 3, 17); }
rust_cleaned_test_functions.jsonl/122465
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 134 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10791, 61678, 72860, 9174, 1269, 6794, 19049, 9174, 1269, 368, 341, 262, 1077, 2025, 284, 435, 2, 698, 310, 24819, 21927, 198, 310, 8126, 21927, 5752, 35255, 198, 310, 11176, 24819, 198, 310, 5869...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_der_optional() { let empty = &b""[..]; let bytes1 = [ 0x30, 0x0a, 0x0a, 0x03, 0x00, 0x00, 0x01, 0x02, 0x03, 0x01, 0x00, 0x01, ]; let bytes2 = [0x30, 0x05, 0x02, 0x03, 0x01, 0x00, 0x01]; let expected1 = DerObject::from_seq(vec![ DerObject::from_obj(BerObjectContent::Optional(Some(Box::new( DerObject::from_obj(BerObjectContent::Enum(1)), )))), DerObject::from_int_slice(b"\x01\x00\x01"), ]); let expected2 = DerObject::from_seq(vec![ DerObject::from_obj(BerObjectContent::Optional(None)), DerObject::from_int_slice(b"\x01\x00\x01"), ]); fn parse_optional_enum(i: &[u8]) -> DerResult { parse_ber_optional(parse_der_enum)(i) } fn parser(i: &[u8]) -> DerResult { parse_der_sequence_defined( // to a list map(tuple((parse_optional_enum, parse_der_integer)), |(a, b)| { vec![a, b] }), )(i) } assert_eq!(parser(&bytes1), Ok((empty, expected1))); assert_eq!(parser(&bytes2), Ok((empty, expected2))); }
rust_cleaned_test_functions.jsonl/45884
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 583 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 35345, 74644, 368, 341, 262, 1077, 4287, 284, 609, 65, 3014, 95874, 935, 262, 1077, 5820, 16, 284, 2278, 286, 220, 15, 87, 18, 15, 11, 220, 15, 87, 15, 64, 11, 220, 15, 87, 15, 64, 11, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_parse_no_max_age() { let r: Raw = "includeSubDomains".into(); let h: ::Result<StrictTransportSecurity> = Header::parse_header(&r); assert!(h.is_err()); }
rust_cleaned_test_functions.jsonl/58565
{ "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, 21039, 6536, 6345, 32053, 368, 341, 286, 1077, 435, 25, 23022, 284, 330, 997, 3136, 74713, 3263, 18122, 543, 286, 1077, 305, 25, 3504, 2077, 27, 41857, 27560, 15352, 29, 284, 12104, 486, 6400, 8...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_show_only_started_no_tasks() { let dir = tempdir().unwrap(); let repo = init_repo_with_tasks( dir.path(), &[ Task::new(TaskStatus::ToDo, "Bar"), Task::new(TaskStatus::Blocked, "Baz"), Task::new(TaskStatus::Done, "Boo"), ], ); check_current_status(&repo, DisplayMode::ShowOnly(TaskStatus::Started), ""); }
rust_cleaned_test_functions.jsonl/36286
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 239 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15267, 18410, 55679, 6536, 32823, 368, 341, 286, 1077, 5419, 284, 2730, 3741, 1005, 15454, 543, 286, 1077, 15867, 284, 2930, 37784, 6615, 32823, 1006, 310, 5419, 3875, 3148, 310, 609, 9640, 394, 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_message_stream_wait_context() { let m = Arc::new(AtomicUsize::new(0)); let m2 = Arc::clone(&m); System::run(move || { let _addr = ContextWait::create(move |ctx| { let (tx, rx) = unbounded(); let _ = tx.unbounded_send(Ping); let _ = tx.unbounded_send(Ping); let _ = tx.unbounded_send(Ping); let actor = ContextWait { cnt: m2 }; ctx.add_message_stream(rx); actor }); }) .unwrap(); assert_eq!(m.load(Ordering::Relaxed), 1); }
rust_cleaned_test_functions.jsonl/35706
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 294 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6462, 12673, 18760, 8467, 368, 341, 262, 1077, 296, 284, 19689, 486, 931, 7, 65857, 52, 2141, 486, 931, 7, 15, 1106, 262, 1077, 296, 17, 284, 19689, 486, 19982, 2099, 76, 626, 262, 739, 486, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_fn_signature_two_args_first_generics() { let info = call_info( r#"fn foo<T, U: Copy + Display>(x: T, y: U) -> u32 where T: Copy + Display, U: Debug {x + y} fn bar() { foo(<|>3, ); }"#, ); assert_eq!(info.parameters(), ["x: T", "y: U"]); assert_eq!( info.label(), r#" fn foo<T, U: Copy + Display>(x: T, y: U) -> u32 where T: Copy + Display, U: Debug "# .trim() ); assert_eq!(info.active_parameter, Some(0)); }
rust_cleaned_test_functions.jsonl/55349
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 294 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15246, 39859, 23241, 8384, 12978, 71963, 1211, 368, 341, 286, 1077, 3546, 284, 1618, 3109, 1006, 310, 435, 55543, 8822, 15229, 3125, 11, 547, 25, 14540, 488, 10623, 2235, 87, 25, 350, 11, 379, 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_wait_for_reboot() { let mut pool = LocalPool::new(); let spawner = pool.spawner(); let response = json!({"response":{ "server": "prod", "protocol": "3.0", "app": [{ "appid": "{00000000-0000-0000-0000-000000000001}", "status": "ok", "updatecheck": { "status": "ok" } }], }}); let response = serde_json::to_vec(&response).unwrap(); let mut http = MockHttpRequest::new(HttpResponse::new(response.clone())); // Responses to events. http.add_response(HttpResponse::new(response.clone())); http.add_response(HttpResponse::new(response.clone())); http.add_response(HttpResponse::new(response.clone())); // Response to the ping. http.add_response(HttpResponse::new(response)); let ping_request_viewer = MockHttpRequest::from_request_cell(http.get_request_cell()); let second_ping_request_viewer = MockHttpRequest::from_request_cell(http.get_request_cell()); let mut mock_time = MockTimeSource::new_from_now(); mock_time.truncate_submicrosecond_walltime(); let next_update_time = mock_time.now() + Duration::from_secs(1000); let (timer, mut timers) = BlockingTimer::new(); let reboot_allowed = Rc::new(RefCell::new(false)); let policy_engine = MockPolicyEngine { time_source: mock_time.clone(), reboot_allowed: Rc::clone(&reboot_allowed), check_timing: Some(CheckTiming::builder().time(next_update_time).build()), ..MockPolicyEngine::default() }; let installer = TestInstaller::builder(mock_time.clone()).build(); let reboot_called = Rc::clone(&installer.reboot_called); let storage_ref = Rc::new(Mutex::new(MemStorage::new())); let apps = make_test_app_set(); let (mut ctl, state_machine) = pool.run_until( StateMachineBuilder::new_stub() .app_set(apps.clone()) .http(http) .installer(installer) .policy_engine(policy_engine) .timer(timer) .storage(Rc::clone(&storage_ref)) .start(), ); let observer = TestObserver::default(); spawner.spawn_local(observer.observe(state_machine)).unwrap(); // The first wait before update check. let blocked_timer = pool.run_until(timers.next()).unwrap(); assert_eq!(blocked_timer.requested_wait(), RequestedWait::Until(next_update_time.into())); blocked_timer.unblock(); pool.run_until_stalled(); let blocked_timer1 = pool.run_until(timers.next()).unwrap(); let blocked_timer2 = pool.run_until(timers.next()).unwrap(); let (wait_for_reboot_timer, wait_for_next_ping_timer) = match blocked_timer1.requested_wait() { RequestedWait::For(_) => (blocked_timer1, blocked_timer2), RequestedWait::Until(_) => (blocked_timer2, blocked_timer1), }; // This is the timer waiting for next reboot_allowed check. assert_eq!( wait_for_reboot_timer.requested_wait(), RequestedWait::For(CHECK_REBOOT_ALLOWED_INTERVAL) ); // This is the timer waiting for the next ping. assert_eq!( wait_for_next_ping_timer.requested_wait(), RequestedWait::Until(next_update_time.into()) ); // Unblock the ping. mock_time.advance(Duration::from_secs(1000)); wait_for_next_ping_timer.unblock(); pool.run_until_stalled(); // Verify that it sends a ping. let config = crate::configuration::test_support::config_generator(); let request_params = RequestParams::default(); let apps = pool.run_until(apps.to_vec()); let mut expected_request_builder = RequestBuilder::new(&config, &request_params) // 0: session id for update check // 1: request id for update check // 2-4: request id for events .session_id(GUID::from_u128(5)) .request_id(GUID::from_u128(6)); for app in &apps { expected_request_builder = expected_request_builder.add_ping(&app); } pool.run_until(assert_request(ping_request_viewer, expected_request_builder)); pool.run_until(async { assert_eq!( ctl.start_update_check(CheckOptions::default()).await, Ok(StartUpdateCheckResponse::AlreadyRunning) ); }); // Last update time is updated in storage. pool.run_until(async { let storage = storage_ref.lock().await; let context = update_check::Context::load(&*storage).await; assert_eq!(context.schedule.last_update_time, Some(mock_time.now_in_walltime().into())); }); // State machine should be waiting for the next ping. let wait_for_next_ping_timer = pool.run_until(timers.next()).unwrap(); assert_eq!( wait_for_next_ping_timer.requested_wait(), RequestedWait::Until(next_update_time.into()) ); wait_for_reboot_timer.unblock(); pool.run_until_stalled(); assert!(!*reboot_called.borrow()); // State machine should be waiting for the next reboot. let wait_for_reboot_timer = pool.run_until(timers.next()).unwrap(); assert_eq!( wait_for_reboot_timer.requested_wait(), RequestedWait::For(CHECK_REBOOT_ALLOWED_INTERVAL) ); // Time for a second ping. wait_for_next_ping_timer.unblock(); pool.run_until_stalled(); // Verify that it sends another ping. let mut expected_request_builder = RequestBuilder::new(&config, &request_params) .session_id(GUID::from_u128(7)) .request_id(GUID::from_u128(8)); for app in &apps { expected_request_builder = expected_request_builder.add_ping(&app); } pool.run_until(assert_request(second_ping_request_viewer, expected_request_builder)); assert!(!*reboot_called.borrow()); // Now allow reboot. *reboot_called.borrow_mut() = true; wait_for_reboot_timer.unblock(); pool.run_until_stalled(); assert!(*reboot_called.borrow()); }
rust_cleaned_test_functions.jsonl/59714
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2965 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 18760, 5478, 1288, 4619, 368, 341, 286, 1077, 5206, 7314, 284, 8774, 10551, 486, 931, 543, 286, 1077, 978, 67193, 284, 7314, 8572, 67193, 1428, 286, 1077, 2033, 284, 2951, 0, 16864, 2322, 12602, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_cmd_epoch_checker() { use engine_test::kv::KvTestSnapshot; fn new_admin_request(cmd_type: AdminCmdType) -> RaftCmdRequest { let mut request = RaftCmdRequest::default(); request.mut_admin_request().set_cmd_type(cmd_type); request } let region = metapb::Region::default(); let normal_cmd = RaftCmdRequest::default(); let split_admin = new_admin_request(AdminCmdType::BatchSplit); let prepare_merge_admin = new_admin_request(AdminCmdType::PrepareMerge); let change_peer_admin = new_admin_request(AdminCmdType::ChangePeer); let mut epoch_checker = CmdEpochChecker::<KvTestSnapshot>::default(); assert_eq!(epoch_checker.propose_check_epoch(&split_admin, 10), None); assert_eq!(epoch_checker.term, 10); epoch_checker.post_propose(AdminCmdType::BatchSplit, 5, 10); assert_eq!(epoch_checker.proposed_admin_cmd.len(), 1); // Both conflict with the split admin cmd assert_eq!(epoch_checker.propose_check_epoch(&normal_cmd, 10), Some(5)); assert_eq!( epoch_checker.propose_check_epoch(&prepare_merge_admin, 10), Some(5) ); assert_eq!( epoch_checker.propose_check_epoch(&change_peer_admin, 10), None ); epoch_checker.post_propose(AdminCmdType::ChangePeer, 6, 10); assert_eq!(epoch_checker.proposed_admin_cmd.len(), 2); assert_eq!( epoch_checker.last_cmd_index(AdminCmdType::BatchSplit), Some(5) ); assert_eq!( epoch_checker.last_cmd_index(AdminCmdType::ChangePeer), Some(6) ); assert_eq!( epoch_checker.last_cmd_index(AdminCmdType::PrepareMerge), None ); // Conflict with the change peer admin cmd assert_eq!( epoch_checker.propose_check_epoch(&change_peer_admin, 10), Some(6) ); // Conflict with the split admin cmd assert_eq!(epoch_checker.propose_check_epoch(&normal_cmd, 10), Some(5)); // Conflict with the change peer admin cmd assert_eq!( epoch_checker.propose_check_epoch(&prepare_merge_admin, 10), Some(6) ); epoch_checker.advance_apply(4, 10, &region); // Have no effect on `proposed_admin_cmd` assert_eq!(epoch_checker.proposed_admin_cmd.len(), 2); epoch_checker.advance_apply(5, 10, &region); // Left one change peer admin cmd assert_eq!(epoch_checker.proposed_admin_cmd.len(), 1); assert_eq!(epoch_checker.propose_check_epoch(&normal_cmd, 10), None); assert_eq!(epoch_checker.propose_check_epoch(&split_admin, 10), Some(6)); // Change term to 11 assert_eq!(epoch_checker.propose_check_epoch(&split_admin, 11), None); assert_eq!(epoch_checker.term, 11); // Should be empty assert_eq!(epoch_checker.proposed_admin_cmd.len(), 0); }
rust_cleaned_test_functions.jsonl/8303
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1448 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11684, 20682, 62715, 368, 341, 286, 990, 4712, 4452, 486, 43408, 486, 42, 85, 2271, 15009, 280, 286, 5168, 501, 12207, 7893, 14160, 1819, 25, 7582, 15613, 929, 8, 1464, 18482, 723, 15613, 1900, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_destroy_source_peer_while_merging() { let mut cluster = new_node_cluster(0, 5); configure_for_merge(&mut cluster); let pd_client = Arc::clone(&cluster.pd_client); pd_client.disable_default_operator(); cluster.run(); cluster.must_put(b"k1", b"v1"); cluster.must_put(b"k3", b"v3"); for i in 1..=5 { must_get_equal(&cluster.get_engine(i), b"k1", b"v1"); must_get_equal(&cluster.get_engine(i), b"k3", b"v3"); } cluster.must_split(&pd_client.get_region(b"k1").unwrap(), b"k2"); let left = pd_client.get_region(b"k1").unwrap(); let right = pd_client.get_region(b"k3").unwrap(); cluster.must_transfer_leader(right.get_id(), new_peer(1, 1)); let schedule_merge_fp = "on_schedule_merge"; fail::cfg(schedule_merge_fp, "return()").unwrap(); // Start merge and wait until peer 5 apply prepare merge cluster.must_try_merge(right.get_id(), left.get_id()); cluster.must_peer_state(right.get_id(), 5, PeerState::Merging); // filter heartbeat and append message for peer 5 cluster.add_send_filter(CloneFilterFactory( RegionPacketFilter::new(right.get_id(), 5) .direction(Direction::Recv) .msg_type(MessageType::MsgHeartbeat) .msg_type(MessageType::MsgAppend), )); // remove peer from target region to trigger merge rollback. pd_client.must_remove_peer(left.get_id(), find_peer(&left, 2).unwrap().clone()); must_get_none(&cluster.get_engine(2), b"k1"); // Merge must rollbacked if we can put more data to the source region fail::remove(schedule_merge_fp); cluster.must_put(b"k4", b"v4"); for i in 1..=4 { must_get_equal(&cluster.get_engine(i), b"k4", b"v4"); } // remove peer 5 from peer list so it will destroy itself by tombstone message // and should not persist the `merge_state` pd_client.must_remove_peer(right.get_id(), new_peer(5, 5)); must_get_none(&cluster.get_engine(5), b"k3"); // so that other peers will send message to store 5 pd_client.must_add_peer(right.get_id(), new_peer(5, 6)); // but it is still in tombstone state due to the message filter let state = cluster.region_local_state(right.get_id(), 5); assert_eq!(state.get_state(), PeerState::Tombstone); // let the peer on store 4 have a larger peer id pd_client.must_remove_peer(right.get_id(), new_peer(4, 4)); pd_client.must_add_peer(right.get_id(), new_peer(4, 7)); must_get_equal(&cluster.get_engine(4), b"k4", b"v4"); // store 5 panic because peer 7 have larger peer id than the peer in the merge state cluster.clear_send_filters(); cluster.add_send_filter(IsolationFilterFactory::new(1)); cluster.must_put(b"k5", b"v5"); assert!(!state.has_merge_state(), "{:?}", state); for i in 2..=5 { must_get_equal(&cluster.get_engine(i), b"k5", b"v5"); } }
rust_cleaned_test_functions.jsonl/56299
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1208 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 18066, 10347, 45159, 86069, 717, 95296, 368, 341, 262, 1077, 5206, 10652, 284, 501, 5084, 28441, 7, 15, 11, 220, 20, 317, 262, 14411, 5478, 20888, 2099, 6984, 10652, 317, 262, 1077, 7744, 8179, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_set_command_permissions() { let route = Route::SetCommandPermissions { application_id: APPLICATION_ID, guild_id: GUILD_ID, }; assert_eq!( route.to_string(), format!( "applications/{application_id}/guilds/{guild_id}/commands/permissions", application_id = APPLICATION_ID, guild_id = GUILD_ID ) ); }
rust_cleaned_test_functions.jsonl/119931
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 257 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2602, 10811, 44767, 368, 341, 286, 1077, 6021, 284, 9572, 486, 1649, 4062, 23851, 341, 310, 3766, 842, 25, 59237, 3450, 345, 310, 26411, 842, 25, 479, 18023, 3450, 345, 286, 2605, 286, 2060, 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_list_stores_with_empty_state() { let context = get_context(vec![], false); testing_env!(context); let contract = Marketplace::default(); let stores = contract.list_stores(); assert_eq!(0, stores.len()); }
rust_cleaned_test_functions.jsonl/50733
{ "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, 2019, 1261, 4589, 6615, 15124, 4387, 368, 341, 286, 1077, 2266, 284, 633, 8467, 25592, 0, 12995, 895, 317, 286, 7497, 15879, 10297, 2147, 317, 286, 1077, 5116, 284, 57258, 486, 2258, 543, 286, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_default() { let hasher_a = AHasher::default(); let a_enc: [u64; 2] = hasher_a.enc.convert(); let a_sum: [u64; 2] = hasher_a.sum.convert(); assert_ne!(0, a_enc[0]); assert_ne!(0, a_enc[1]); assert_ne!(0, a_sum[0]); assert_ne!(0, a_sum[1]); assert_ne!(a_enc[0], a_enc[1]); assert_ne!(a_sum[0], a_sum[1]); assert_ne!(a_enc[0], a_sum[0]); assert_ne!(a_enc[1], a_sum[1]); let hasher_b = AHasher::default(); let b_enc: [u64; 2] = hasher_b.enc.convert(); let b_sum: [u64; 2] = hasher_b.sum.convert(); assert_eq!(a_enc[0], b_enc[0]); assert_eq!(a_enc[1], b_enc[1]); assert_eq!(a_sum[0], b_sum[0]); assert_eq!(a_sum[1], b_sum[1]); }
rust_cleaned_test_functions.jsonl/26619
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 466 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9993, 368, 341, 286, 1077, 90819, 4306, 284, 362, 6370, 261, 486, 2258, 543, 286, 1077, 264, 13781, 25, 508, 84, 21, 19, 26, 220, 17, 60, 284, 90819, 4306, 54444, 24012, 543, 286, 1077, 264, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_ASL_accumulator_nocarry() { let code = vec![0xA9, 0x64, 0x0A]; let mut nes = Cpu::new(); let mut memory = new_memory(code); nes.next(&mut memory).unwrap(); nes.next(&mut memory).unwrap(); assert_eq!(0xc8, nes.A); assert_eq!(0, nes.Z); assert_eq!(1, nes.N); }
rust_cleaned_test_functions.jsonl/38692
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 195 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1566, 7984, 75837, 10511, 1089, 509, 11433, 368, 341, 286, 1077, 2038, 284, 7486, 20703, 15, 14673, 24, 11, 220, 15, 87, 21, 19, 11, 220, 15, 87, 15, 32, 935, 286, 1077, 5206, 308, 288, 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_vec_truncate_fail() { struct BadElem(int); impl Drop for BadElem { fn drop(&mut self) { let BadElem(ref mut x) = *self; if *x == 0xbadbeef { fail!("BadElem failure: 0xbadbeef") } } } let mut v = vec![BadElem(1), BadElem(2), BadElem(0xbadbeef), BadElem(4)]; v.truncate(0); }
rust_cleaned_test_functions.jsonl/58458
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 265 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13251, 3547, 26900, 22121, 368, 341, 286, 2036, 11461, 25586, 1548, 317, 286, 11605, 15733, 369, 11461, 25586, 341, 310, 5168, 5943, 2099, 6984, 656, 8, 341, 394, 1077, 11461, 25586, 13321, 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...
2
#[test] fn test_ls_ignore_hide() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; at.touch("README.md"); at.touch("CONTRIBUTING.md"); at.touch("some_other_file"); at.touch("READMECAREFULLY.md"); scene .ucmd() .arg("--hide") .arg("*") .arg("-1") .succeeds() .stdout_only(""); scene .ucmd() .arg("--ignore") .arg("*") .arg("-1") .succeeds() .stdout_only(""); scene .ucmd() .arg("--ignore") .arg("irrelevant pattern") .arg("-1") .succeeds() .stdout_only("CONTRIBUTING.md\nREADME.md\nREADMECAREFULLY.md\nsome_other_file\n"); scene .ucmd() .arg("--ignore") .arg("README*.md") .arg("-1") .succeeds() .stdout_only("CONTRIBUTING.md\nsome_other_file\n"); scene .ucmd() .arg("--hide") .arg("README*.md") .arg("-1") .succeeds() .stdout_only("CONTRIBUTING.md\nsome_other_file\n"); scene .ucmd() .arg("--ignore") .arg("*.md") .arg("-1") .succeeds() .stdout_only("some_other_file\n"); scene .ucmd() .arg("-a") .arg("--ignore") .arg("*.md") .arg("-1") .succeeds() .stdout_only(".\n..\nsome_other_file\n"); scene .ucmd() .arg("-a") .arg("--hide") .arg("*.md") .arg("-1") .succeeds() .stdout_only(".\n..\nCONTRIBUTING.md\nREADME.md\nREADMECAREFULLY.md\nsome_other_file\n"); scene .ucmd() .arg("-A") .arg("--ignore") .arg("*.md") .arg("-1") .succeeds() .stdout_only("some_other_file\n"); scene .ucmd() .arg("-A") .arg("--hide") .arg("*.md") .arg("-1") .succeeds() .stdout_only("CONTRIBUTING.md\nREADME.md\nREADMECAREFULLY.md\nsome_other_file\n"); // Stacking multiple patterns scene .ucmd() .arg("--ignore") .arg("README*") .arg("--ignore") .arg("CONTRIBUTING*") .arg("-1") .succeeds() .stdout_only("some_other_file\n"); scene .ucmd() .arg("--hide") .arg("README*") .arg("--ignore") .arg("CONTRIBUTING*") .arg("-1") .succeeds() .stdout_only("some_other_file\n"); scene .ucmd() .arg("--hide") .arg("README*") .arg("--hide") .arg("CONTRIBUTING*") .arg("-1") .succeeds() .stdout_only("some_other_file\n"); // Invalid patterns scene .ucmd() .arg("--ignore") .arg("READ[ME") .arg("-1") .succeeds() .stderr_contains(&"Invalid pattern") .stdout_is("CONTRIBUTING.md\nREADME.md\nREADMECAREFULLY.md\nsome_other_file\n"); scene .ucmd() .arg("--hide") .arg("READ[ME") .arg("-1") .succeeds() .stderr_contains(&"Invalid pattern") .stdout_is("CONTRIBUTING.md\nREADME.md\nREADMECAREFULLY.md\nsome_other_file\n"); }
rust_cleaned_test_functions.jsonl/71219
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1902 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 53174, 58493, 49735, 368, 341, 262, 1077, 6109, 284, 3393, 54031, 486, 931, 67811, 1269, 0, 1423, 262, 1077, 518, 284, 609, 22483, 67785, 18513, 401, 262, 518, 42129, 445, 54675, 21324, 797, 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_is_oriya() { assert_eq!(is_oriya('ଐ'), true); assert_eq!(is_oriya('୷'), true); assert_eq!(is_oriya('౿'), false); }
rust_cleaned_test_functions.jsonl/123611
{ "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, 6892, 8734, 79474, 368, 341, 286, 2060, 10714, 10297, 285, 8734, 79474, 492, 124593, 238, 4567, 830, 317, 286, 2060, 10714, 10297, 285, 8734, 79474, 492, 156, 255, 115, 4567, 830, 317, 286, 2060, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_open_path() { let file = File::open_path(PathBuf::from("tests/samples/test1")) .expect("Open test1"); let bss = file.get_section(".bss").expect("Get .bss section"); assert!(bss.data.iter().all(|&b| b == 0)); }
rust_cleaned_test_functions.jsonl/79420
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 134 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11311, 2638, 368, 341, 286, 1077, 1034, 284, 2887, 486, 2508, 2638, 33030, 15064, 486, 1499, 445, 23841, 2687, 4023, 12697, 16, 5455, 310, 659, 17119, 445, 5002, 1273, 16, 797, 286, 1077, 293, 7...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_gjk_exact_3d() { let shape = Cuboid::new(1., 1., 1.); let t = transform_3d(0., 0., 0., 0.); let gjk = GJK3::new(); let p = gjk.intersection(&CollisionStrategy::FullResolution, &shape, &t, &shape, &t); assert!(p.is_some()); let d = gjk.distance(&shape, &t, &shape, &t); assert!(d.is_none()); }
rust_cleaned_test_functions.jsonl/90901
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 199 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1889, 41808, 71084, 62, 18, 67, 368, 341, 286, 1077, 6083, 284, 18030, 588, 486, 931, 7, 16, 2572, 220, 16, 2572, 220, 16, 58957, 286, 1077, 259, 284, 5165, 62, 18, 67, 7, 15, 2572, 220, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_parse_data() { let data: [u8; 64] = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 121, 48, 20, 183, 133, 34, 51, 49, 47, 6, 31, 35, 114, 158, 231, 84, 35, 113, 40, 143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 52, 10, 173, 33, 179, 183, 0, 0, 0, ]; let address_bytes = [ 121, 48, 20, 183, 133, 34, 51, 49, 47, 6, 31, 35, 114, 158, 231, 84, 35, 113, 40, 143, ]; assert_eq!(&data[12..32], address_bytes); let ammount_bytes = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 52, 10, 173, 33, 179, 183, 0, 0, 0, ]; assert_eq!(&data[32..64], ammount_bytes); let (address, ammount) = parse_receiver_data(&data).unwrap(); assert_eq!(address, Address::from_slice(&address_bytes).unwrap()); assert_eq!(ammount, Uint256::from_bytes_be(&ammount_bytes)); assert_eq!(address.as_bytes(), address_bytes); }
rust_cleaned_test_functions.jsonl/21537
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 560 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 1769, 368, 341, 286, 1077, 821, 25, 508, 84, 23, 26, 220, 21, 19, 60, 284, 2278, 310, 220, 15, 11, 220, 15, 11, 220, 15, 11, 220, 15, 11, 220, 15, 11, 220, 15, 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...
1
#[test] fn test_transfer_from() { let mut service = TestService::new(); let caller = TestService::caller(); let ctx = mock_context(caller.clone()); let asset = create_asset!(service, ctx.clone(), 1000, 10); let recipient = Address::from_hex("0x666cdba6ae4f479f7164792b318b2a06c759833b").unwrap(); service_call!(service, approve, ctx.clone(), ApprovePayload { asset_id: asset.id.clone(), to: recipient.clone(), value: 1024, memo: "test".to_owned(), }); let recipient_ctx = mock_context(recipient.clone()); service_call!( service, transfer_from, recipient_ctx.clone(), TransferFromPayload { asset_id: asset.id.clone(), sender: caller.clone(), recipient: recipient.clone(), value: 24, memo: "test".to_owned(), } ); let allowance = service_call!(service, get_allowance, ctx.clone(), GetAllowancePayload { asset_id: asset.id.clone(), grantor: caller.clone(), grantee: recipient.clone(), }); assert_eq!(allowance.asset_id, asset.id); assert_eq!(allowance.grantee, recipient); assert_eq!(allowance.value, 1000); let sender_balance = service_call!(service, get_balance, ctx, GetBalancePayload { asset_id: asset.id.clone(), user: caller, }); assert_eq!(sender_balance.balance, asset.supply - 24); let recipient_balance = service_call!(service, get_balance, recipient_ctx, GetBalancePayload { asset_id: asset.id, user: recipient, }); assert_eq!(recipient_balance.balance, 24); }
rust_cleaned_test_functions.jsonl/27231
{ "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, 35403, 5673, 368, 341, 262, 1077, 5206, 2473, 284, 3393, 1860, 486, 931, 543, 262, 1077, 19865, 284, 3393, 1860, 486, 56126, 543, 262, 1077, 5635, 284, 7860, 8467, 1337, 13956, 15997, 1423, 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_iter() { let sum: u64 = gen_iter(10).sum(); assert_eq!(sum, 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9); }
rust_cleaned_test_functions.jsonl/12831
{ "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, 11723, 368, 341, 262, 1077, 2629, 25, 575, 21, 19, 284, 4081, 11723, 7, 16, 15, 568, 1242, 543, 262, 2060, 10714, 10297, 1242, 11, 220, 16, 488, 220, 17, 488, 220, 18, 488, 220, 19, 488, 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
#[test] fn test_union() { #[derive(Copy, Clone, NoCopy)] #[nocopy_macro(endian = "big")] #[repr(C)] pub struct TestDefault { one: u8, two: u16, three: u32, four: u64, five: [u8; 10], } let mut test_big = TestDefaultBuffer::new_buffer([0; std::mem::size_of::<TestDefault>()]); test_big.set_one(1); test_big.set_two(20); test_big.set_three(50); test_big.set_four(50); test_big.set_five([1; 10]); assert_eq!(test_big.get_one(), 1); assert_eq!(test_big.get_two(), 20); assert_eq!(test_big.get_three(), 50); assert_eq!(test_big.get_four(), 50); assert_eq!(test_big.get_five(), [1; 10]); assert_eq!( test_big.as_buffer(), [ 1, 0, 0, 20, 0, 0, 0, 50, 0, 0, 0, 0, 0, 0, 0, 50, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 ] ) }
rust_cleaned_test_functions.jsonl/41355
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 487 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 51621, 368, 341, 262, 11506, 27098, 3025, 1266, 11, 27913, 11, 2308, 12106, 5563, 262, 11506, 47991, 1266, 58810, 15076, 1103, 284, 330, 16154, 5422, 262, 11506, 30837, 3025, 5563, 262, 6675, 2036, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_user_counting_returned() { block_on(async { let config = config_generator(); let response = json!({"response":{ "server": "prod", "protocol": "3.0", "daystart": { "elapsed_days": 1234567, "elapsed_seconds": 3645 }, "app": [{ "appid": "{00000000-0000-0000-0000-000000000001}", "status": "ok", "cohort": "1", "cohortname": "stable-channel", "updatecheck": { "status": "noupdate" } }] }}); let response = serde_json::to_vec(&response).unwrap(); let http = MockHttpRequest::new(hyper::Response::new(response.into())); let response = StateMachineBuilder::new( StubPolicyEngine, http, StubInstaller::default(), StubTimer, StubMetricsReporter, Rc::new(Mutex::new(StubStorage)), config, make_test_app_set(), ) .oneshot() .await .unwrap(); assert_eq!( UserCounting::ClientRegulatedByDate(Some(1234567)), response.app_responses[0].user_counting ); }); }
rust_cleaned_test_functions.jsonl/126400
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 823 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3317, 3180, 287, 12511, 291, 368, 341, 286, 2504, 4470, 18285, 341, 310, 1077, 2193, 284, 2193, 25813, 543, 310, 1077, 2033, 284, 2951, 0, 16864, 2322, 12602, 310, 330, 4030, 788, 330, 19748, 75...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_query_type() { use crate::query::QueryType; let query = Timestamp::Hours(11) .into_query("weather".to_string()) .add_field("temperature", 82) .add_tag("location", "us-midwest") .add_tag("season", "summer"); assert_eq!(query.get_type(), QueryType::WriteQuery("h".to_owned())); }
rust_cleaned_test_functions.jsonl/40009
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 185 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 31550, 5738, 1819, 368, 341, 286, 990, 17717, 486, 1631, 486, 2859, 929, 401, 286, 1077, 3239, 284, 32758, 486, 23235, 7, 16, 16, 340, 310, 659, 18122, 5738, 445, 15206, 3263, 983, 3904, 2398, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_contains() { let mut v = VecDeque::new(); v.extend(&[2, 3, 4]); assert!(v.contains(&3)); assert!(!v.contains(&1)); v.clear(); assert!(!v.contains(&3)); }
rust_cleaned_test_functions.jsonl/73733
{ "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, 63598, 368, 341, 262, 1077, 5206, 348, 284, 11312, 73891, 486, 931, 543, 262, 348, 15831, 2099, 58, 17, 11, 220, 18, 11, 220, 19, 10149, 262, 2060, 10297, 85, 8786, 2099, 18, 1106, 262, 2060, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_default_config() -> Result<()> { let actual = Config::default(); let tom_expect = r#"config_file = "" [query] tenant_id = "admin" cluster_id = "" num_cpus = 0 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 http_handler_result_timeout_millis = 10000 flight_api_address = "127.0.0.1:9090" admin_api_address = "127.0.0.1:8080" metric_api_address = "127.0.0.1:7070" http_handler_tls_server_cert = "" http_handler_tls_server_key = "" http_handler_tls_server_root_ca_cert = "" 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" table_engine_csv_enabled = false table_engine_parquet_enabled = false table_engine_memory_enabled = true database_engine_github_enabled = true wait_timeout_mills = 5000 max_query_log_size = 10000 table_cache_enabled = false table_cache_snapshot_count = 256 table_cache_segment_count = 10240 table_cache_block_meta_count = 102400 table_memory_cache_mb_size = 256 table_disk_cache_root = "_cache" table_disk_cache_mb_size = 1024 management_mode = false jwt_key_file = "" [log] level = "INFO" dir = "./_logs" query_enabled = false [meta] embedded_dir = "./_meta_embedded" address = "" username = "root" password = "" client_timeout_in_second = 10 rpc_tls_meta_server_root_ca_cert = "" rpc_tls_meta_service_domain_name = "localhost" [storage] type = "fs" num_cpus = 0 [storage.fs] data_path = "_data" [storage.s3] region = "" endpoint_url = "https://s3.amazonaws.com" access_key_id = "" secret_access_key = "" bucket = "" root = "" [storage.azblob] account_name = "" account_key = "" container = "" endpoint_url = "" root = "" "#; let tom_actual = toml::to_string(&actual).unwrap(); assert_eq!(tom_actual, tom_expect); Ok(()) }
rust_cleaned_test_functions.jsonl/32230
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 813 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9993, 5332, 368, 1464, 5714, 71698, 341, 262, 1077, 5042, 284, 5532, 486, 2258, 1428, 262, 1077, 10180, 68918, 284, 435, 55543, 1676, 2458, 284, 35829, 58, 1631, 921, 43919, 842, 284, 330, 2882, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_defaults() { let null = Config::default(); let defaulted = Config::from_defaults(); assert_ne!(defaulted, null); assert_ne!(defaulted.files, null.files); assert_ne!(defaulted.default, null.default); assert_ne!(defaulted.default.tokenizer, null.default.tokenizer); assert_ne!(defaulted.default.dict, null.default.dict); }
rust_cleaned_test_functions.jsonl/4424
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 175 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5673, 42290, 368, 341, 286, 1077, 845, 284, 5532, 486, 2258, 543, 286, 1077, 92989, 284, 5532, 486, 1499, 42290, 543, 286, 2060, 13925, 10297, 2258, 291, 11, 845, 317, 286, 2060, 13925, 10297, 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_against_rust_internal() { use super::UnicodeVersion; let core_unicode_version: UnicodeVersion = char::UNICODE_VERSION.into(); assert!(core_unicode_version.major >= 10); }
rust_cleaned_test_functions.jsonl/20216
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 93 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 62427, 267, 1710, 590, 23472, 368, 341, 286, 990, 2256, 486, 33920, 5637, 401, 286, 1077, 6200, 54662, 9438, 25, 35897, 5637, 284, 1161, 486, 1861, 44769, 10678, 39860, 543, 286, 2060, 10297, 2153...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_serialization_system() { use num_format::SystemLocale; use serde::{Deserialize, Serialize}; fn serializable<T: Serialize>() {} serializable::<SystemLocale>(); fn deserializable<'de, T: Deserialize<'de>>() {} deserializable::<SystemLocale>(); }
rust_cleaned_test_functions.jsonl/92817
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 116 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 25602, 2022, 17687, 368, 341, 262, 990, 1629, 8955, 486, 2320, 19231, 280, 262, 990, 61570, 22964, 64465, 11, 39900, 2315, 262, 5168, 6146, 8335, 3125, 25, 39900, 13555, 5613, 262, 6146, 8335, 276...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_decrypt_oaep_invalid_hash() { let mut rng = thread_rng(); let priv_key = get_private_key(); let pub_key: RSAPublicKey = (&priv_key).into(); let ciphertext = pub_key .encrypt( &mut rng, PaddingScheme::new_oaep::<Sha1>(), "a_plain_text".as_bytes(), ) .unwrap(); assert!( priv_key .decrypt_blinded( &mut rng, PaddingScheme::new_oaep_with_label::<Sha1, _>("label"), &ciphertext, ) .is_err(), "decrypt should have failed on hash verification" ); }
rust_cleaned_test_functions.jsonl/60130
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 445 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 80764, 14179, 64, 747, 31433, 8950, 368, 341, 286, 1077, 5206, 28422, 284, 4516, 66849, 543, 286, 1077, 6095, 3097, 284, 633, 26249, 3097, 543, 286, 1077, 6675, 3097, 25, 23229, 2537, 475, 1592, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_large() { // 5000 should be greater than a single page on most systems. const SIZE: usize = 5000; let arg = format!("{}", SIZE); let mem = read_test_process(Some(&[&arg])).unwrap(); let expected = (0..SIZE) .map(|v| (v % (u8::max_value() as usize + 1)) as u8) .collect::<Vec<u8>>(); assert_eq!(mem, expected); }
rust_cleaned_test_functions.jsonl/79382
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 204 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6443, 45228, 368, 341, 286, 442, 220, 20, 15, 15, 15, 1265, 387, 7046, 1091, 264, 3175, 2150, 389, 1429, 5942, 624, 286, 733, 25341, 25, 22301, 284, 220, 20, 15, 15, 15, 280, 286, 1077, 1392...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_ldrb_imm() { assert_eq!( decode_16(0x7800), Instruction::LDRB_imm { params: Reg2FullParams { rt: Reg::R0, rn: Reg::R0, imm32: 0, index: true, add: true, wback: false, }, thumb32: false, } ); }
rust_cleaned_test_functions.jsonl/64752
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 266 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15227, 50573, 10681, 71370, 368, 341, 1066, 262, 2060, 10714, 33673, 286, 16895, 62, 16, 21, 7, 15, 87, 22, 23, 15, 15, 1326, 286, 29051, 486, 43, 7687, 33, 71370, 341, 310, 3628, 25, 3184, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_swma_const() { for i in 2..30 { let input = (i as ValueType + 56.0) / 16.3251; let mut method = TestingMethod::new(i, input).unwrap(); let output = method.next(input); test_const(&mut method, input, output); } }
rust_cleaned_test_functions.jsonl/122819
{ "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, 32581, 1728, 13610, 368, 341, 197, 2023, 600, 304, 220, 17, 496, 18, 15, 341, 298, 10217, 1946, 284, 320, 72, 438, 55545, 488, 220, 20, 21, 13, 15, 8, 608, 220, 16, 21, 13, 18, 17, 20, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_vec() { let empty_vec: Vec<i32> = Vec::new(); morq!( expect(vec![1, 2, 3]).to.not.be.empty(); expect(empty_vec).to.be.empty(); ); }
rust_cleaned_test_functions.jsonl/61831
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 121 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13251, 368, 341, 286, 1077, 4287, 13251, 25, 11312, 21897, 18, 17, 29, 284, 11312, 486, 931, 1428, 286, 4313, 80, 33673, 310, 1720, 25592, 20703, 16, 11, 220, 17, 11, 220, 18, 10697, 983, 1197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_offset_too_large() { let expr = "let a = 1;in\na"; range(expr, TextRange::new(TextSize::from(50), TextSize::from(50))); }
rust_cleaned_test_functions.jsonl/113849
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 79 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6917, 2346, 78, 45228, 368, 341, 286, 1077, 15169, 284, 330, 1149, 264, 284, 220, 16, 26, 258, 1699, 64, 876, 286, 2088, 34322, 11, 2918, 6046, 486, 931, 34082, 1695, 486, 1499, 7, 20, 15, 7...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_iso_2022_jp_length_after_escape() { let mut output = [0u16; 20]; let mut decoder = ISO_2022_JP.new_decoder(); { let (result, read, written, had_errors) = decoder.decode_to_utf16(b"\x1B", &mut output, false); assert_eq!(result, CoderResult::InputEmpty); assert_eq!(read, 1); assert_eq!(written, 0); assert!(!had_errors); } { let needed = decoder.max_utf16_buffer_length(1).unwrap(); let (result, read, written, had_errors) = decoder.decode_to_utf16(b"A", &mut output[..needed], true); assert_eq!(result, CoderResult::InputEmpty); assert_eq!(read, 1); assert_eq!(written, 2); assert!(had_errors); assert_eq!(output[0], 0xFFFD); assert_eq!(output[1], 0x0041); } }
rust_cleaned_test_functions.jsonl/107396
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 502 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 49660, 62, 17, 15, 17, 17, 5374, 79, 5118, 19844, 21832, 368, 341, 286, 1077, 5206, 2550, 284, 508, 15, 84, 16, 21, 26, 220, 17, 15, 935, 286, 1077, 5206, 24551, 284, 21940, 62, 17, 15, 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_serve_phys_exits_when_watching_devices_fails() { let mut exec = fasync::TestExecutor::new().expect("failed to create an executor"); let (phys, _phy_events) = PhyMap::new(); let phys = Arc::new(phys); let inspector = Inspector::new_with_size(inspect::VMO_SIZE_BYTES); let inspect_tree = Arc::new(inspect::WlanMonitorTree::new(inspector)); // Serve PHYs from the bogus device environment that returns errors for all operations. // This will ensure that attempting to watch devices fails immediately. let fut = serve_phys::<FaultyDeviceEnv>(phys.clone(), inspect_tree); pin_mut!(fut); assert_variant!(exec.run_until_stalled(&mut fut), Poll::Ready(Err(_))); }
rust_cleaned_test_functions.jsonl/62163
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 299 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 643, 5852, 69319, 2702, 1199, 47636, 1670, 31924, 41334, 761, 6209, 368, 341, 286, 1077, 5206, 3883, 284, 282, 7692, 486, 2271, 25255, 486, 931, 1005, 17119, 445, 16091, 311, 1855, 458, 31558, 797...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_monthly() { let mut services = TransferQuotaServiceCollection::default(); services.set_user_1_tags(L1); services.set_record((*ASSET_ID).clone(), (*USER_1).clone(), Record { last_op_time: *TIME_ORIGINAL, daily_used_amount: 0, monthly_used_amount: 59_000, yearly_used_amount: 0, }); let res = quota_transfer!(services, 1000); assert_eq!(res.code, 0); let res = quota_transfer!(services, 1); assert_eq!(res.code, *ERROR_EXCEED_MONTHLY); // go to same day services.set_timestamp(&TIME_SAME_DAY); let res = quota_transfer!(services, 1); assert_eq!(res.code, *ERROR_EXCEED_MONTHLY); // go to same month services.set_timestamp(&TIME_SAME_MONTH); let res = quota_transfer!(services, 1); assert_eq!(res.code, *ERROR_EXCEED_MONTHLY); // go to another day of month services.set_timestamp(&TIME_SAME_YEAR); let res = quota_transfer!(services, 500); assert_eq!(res.code, 0); }
rust_cleaned_test_functions.jsonl/68193
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 434 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 18933, 398, 368, 341, 262, 1077, 5206, 3516, 284, 23200, 2183, 6089, 1860, 6482, 486, 2258, 1428, 262, 3516, 980, 3317, 62, 16, 16333, 4957, 16, 626, 262, 3516, 980, 14192, 26609, 1911, 5884, 34...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_hash_many() { if !crate::platform::avx2_detected() { return; } crate::test::test_hash_many_fn(hash_many, hash_many); }
rust_cleaned_test_functions.jsonl/46924
{ "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, 8950, 22101, 368, 341, 286, 421, 753, 61711, 486, 15734, 486, 402, 87, 17, 98876, 368, 341, 310, 470, 280, 286, 456, 286, 17717, 486, 1944, 486, 1944, 8950, 22101, 15246, 27580, 22101, 11, 5175,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_template_literal() { expect_printed("`hello world`", "\"hello world\";\n"); expect_printed("`hello ${a} from ${b}`", "`hello ${a} from ${b}`;\n"); expect_printed("`hello ${3 * 3}`", "`hello ${3 * 3}`;\n"); }
rust_cleaned_test_functions.jsonl/93454
{ "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, 8693, 34100, 368, 341, 262, 1720, 10064, 291, 93314, 14990, 1879, 63, 497, 15898, 14990, 1879, 2105, 17882, 77, 797, 262, 1720, 10064, 291, 93314, 14990, 3570, 64, 92, 504, 3570, 65, 5541, 497, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_tombstone_block_list() { let pd_server = test_pd::Server::new(1); let eps = pd_server.bind_addrs(); let pd_client = Arc::new(test_pd::util::new_client(eps, None)); let bg_worker = WorkerBuilder::new(thd_name!("background")) .thread_count(2) .create(); let resolver = resolve::new_resolver::<_, _, RocksEngine>(pd_client, &bg_worker, RaftStoreBlackHole).0; let msg_count = Arc::new(AtomicUsize::new(0)); let batch_msg_count = Arc::new(AtomicUsize::new(0)); let service = MockKvForRaft::new(Arc::clone(&msg_count), Arc::clone(&batch_msg_count), true); let (_mock_server, port) = create_mock_server(service, 60200, 60300).unwrap(); let mut raft_client = get_raft_client(RaftStoreBlackHole, resolver); let mut store1 = metapb::Store::default(); store1.set_id(1); store1.set_address(format!("127.0.0.1:{}", port)); pd_server.default_handler().add_store(store1.clone()); // `send` should success. for _ in 0..10 { // 5M per RaftMessage. let mut raft_m = RaftMessage::default(); raft_m.mut_to_peer().set_store_id(1); for _ in 0..(5 * 1024) { let mut e = Entry::default(); e.set_data(vec![b'a'; 1024].into()); raft_m.mut_message().mut_entries().push(e); } raft_client.send(raft_m).unwrap(); } raft_client.flush(); check_msg_count(500, &msg_count, 10); let mut store2 = metapb::Store::default(); store2.set_id(2); store2.set_address(store1.get_address().to_owned()); store2.set_state(metapb::StoreState::Tombstone); pd_server.default_handler().add_store(store2); let mut message = RaftMessage::default(); message.mut_to_peer().set_store_id(2); // First message should be OK. raft_client.send(message.clone()).unwrap(); // Wait some time for the resolve result. thread::sleep(time::Duration::from_millis(50)); // Second message should fail as the store should be added to block list. assert_eq!( DiscardReason::Disconnected, raft_client.send(message).unwrap_err() ); }
rust_cleaned_test_functions.jsonl/37843
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 911 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 528, 2855, 10812, 7113, 2019, 368, 341, 262, 1077, 7744, 12015, 284, 1273, 31322, 486, 5475, 486, 931, 7, 16, 317, 262, 1077, 17986, 284, 7744, 12015, 6090, 2891, 5428, 543, 262, 1077, 7744, 817...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_mask_i32() { let mask = 0b01010101_01010101; let actual = Int32Type::mask_from_u64(mask); let expected = expected_mask!(i32, mask); let expected = m32x16::from_cast(i32x16::from_slice_unaligned(expected.as_slice())); assert_eq!(expected, actual); }
rust_cleaned_test_functions.jsonl/107642
{ "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, 9999, 5318, 18, 17, 368, 341, 286, 1077, 6911, 284, 220, 15, 65, 15, 16, 15, 16, 15, 16, 15, 16, 62, 15, 16, 15, 16, 15, 16, 15, 16, 280, 286, 1077, 5042, 284, 1333, 18, 17, 929, 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_reverse_iterate() { let path = TempDir::new("test-raftstore").unwrap(); let engines = new_temp_engine(&path); let (store, test_data) = load_default_dataset(engines.clone()); let snap = RegionSnapshot::new(&store); let mut statistics = CFStatistics::default(); let it = snap.iter(IterOption::default()); let mut iter = Cursor::new(it, ScanMode::Mixed); assert!(!iter .reverse_seek(&Key::from_encoded_slice(b"a2"), &mut statistics) .unwrap()); assert!(iter .reverse_seek(&Key::from_encoded_slice(b"a7"), &mut statistics) .unwrap()); let mut pair = ( iter.key(&mut statistics).to_vec(), iter.value(&mut statistics).to_vec(), ); assert_eq!(pair, (b"a5".to_vec(), b"v5".to_vec())); assert!(iter .reverse_seek(&Key::from_encoded_slice(b"a5"), &mut statistics) .unwrap()); pair = ( iter.key(&mut statistics).to_vec(), iter.value(&mut statistics).to_vec(), ); assert_eq!(pair, (b"a3".to_vec(), b"v3".to_vec())); assert!(!iter .reverse_seek(&Key::from_encoded_slice(b"a3"), &mut statistics) .unwrap()); assert!(iter .reverse_seek(&Key::from_encoded_slice(b"a1"), &mut statistics) .is_err()); assert!(iter .reverse_seek(&Key::from_encoded_slice(b"a8"), &mut statistics) .is_err()); assert!(iter.seek_to_last(&mut statistics)); let mut res = vec![]; loop { res.push(( iter.key(&mut statistics).to_vec(), iter.value(&mut statistics).to_vec(), )); if !iter.prev(&mut statistics) { break; } } let mut expect = test_data[1..3].to_vec(); expect.reverse(); assert_eq!(res, expect); // test last region let mut region = Region::new(); region.mut_peers().push(Peer::new()); let store = new_peer_storage(engines, &region); let snap = RegionSnapshot::new(&store); let it = snap.iter(IterOption::default()); let mut iter = Cursor::new(it, ScanMode::Mixed); assert!(!iter .reverse_seek(&Key::from_encoded_slice(b"a1"), &mut statistics) .unwrap()); assert!(iter .reverse_seek(&Key::from_encoded_slice(b"a2"), &mut statistics) .unwrap()); let pair = ( iter.key(&mut statistics).to_vec(), iter.value(&mut statistics).to_vec(), ); assert_eq!(pair, (b"a1".to_vec(), b"v1".to_vec())); for kv_pairs in test_data.windows(2) { let seek_key = Key::from_encoded(kv_pairs[1].0.clone()); assert!( iter.reverse_seek(&seek_key, &mut statistics).unwrap(), "{}", seek_key ); let pair = ( iter.key(&mut statistics).to_vec(), iter.value(&mut statistics).to_vec(), ); assert_eq!(pair, kv_pairs[0]); } assert!(iter.seek_to_last(&mut statistics)); let mut res = vec![]; loop { res.push(( iter.key(&mut statistics).to_vec(), iter.value(&mut statistics).to_vec(), )); if !iter.prev(&mut statistics) { break; } } let mut expect = test_data.clone(); expect.reverse(); assert_eq!(res, expect); }
rust_cleaned_test_functions.jsonl/7199
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1895 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 43277, 11723, 349, 368, 341, 286, 1077, 1815, 284, 19944, 6184, 486, 931, 445, 1944, 12, 2944, 4314, 1827, 15454, 543, 286, 1077, 21106, 284, 501, 11771, 24823, 2099, 2343, 317, 286, 1077, 320, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
#[test] fn test_static_spendable_outputs_preimage_tx() { let chanmon_cfgs = create_chanmon_cfgs(2); let node_cfgs = create_node_cfgs(2, &chanmon_cfgs); let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]); let nodes = create_network(2, &node_cfgs, &node_chanmgrs); // Create some initial channels let chan_1 = create_announced_chan_between_nodes(&nodes, 0, 1, InitFeatures::known(), InitFeatures::known()); let payment_preimage = route_payment(&nodes[0], &vec!(&nodes[1])[..], 3000000).0; let commitment_tx = get_local_commitment_txn!(nodes[0], chan_1.2); assert_eq!(commitment_tx[0].input.len(), 1); assert_eq!(commitment_tx[0].input[0].previous_output.txid, chan_1.3.txid()); // Settle A's commitment tx on B's chain assert!(nodes[1].node.claim_funds(payment_preimage)); check_added_monitors!(nodes[1], 1); mine_transaction(&nodes[1], &commitment_tx[0]); check_added_monitors!(nodes[1], 1); let events = nodes[1].node.get_and_clear_pending_msg_events(); match events[0] { MessageSendEvent::UpdateHTLCs { .. } => {}, _ => panic!("Unexpected event"), } match events[1] { MessageSendEvent::BroadcastChannelUpdate { .. } => {}, _ => panic!("Unexepected event"), } // Check B's monitor was able to send back output descriptor event for preimage tx on A's commitment tx let node_txn = nodes[1].tx_broadcaster.txn_broadcasted.lock().unwrap(); assert_eq!(node_txn.len(), 3); check_spends!(node_txn[0], commitment_tx[0]); assert_eq!(node_txn[0].input[0].witness.last().unwrap().len(), OFFERED_HTLC_SCRIPT_WEIGHT); check_spends!(node_txn[1], chan_1.3); check_spends!(node_txn[2], node_txn[1]); mine_transaction(&nodes[1], &node_txn[0]); check_closed_event!(nodes[1], 1, ClosureReason::CommitmentTxConfirmed); connect_blocks(&nodes[1], ANTI_REORG_DELAY - 1); let spend_txn = check_spendable_outputs!(nodes[1], node_cfgs[1].keys_manager); assert_eq!(spend_txn.len(), 1); check_spends!(spend_txn[0], node_txn[0]); }
rust_cleaned_test_functions.jsonl/16902
{ "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, 25360, 643, 3740, 480, 35189, 10442, 1805, 17805, 368, 341, 10217, 26023, 1645, 18343, 82, 284, 1855, 45552, 1645, 18343, 82, 7, 17, 317, 10217, 2436, 18343, 82, 284, 1855, 5084, 18343, 82, 7, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_recover() { let (privkey, pubkey) = Generator::random_keypair(); let message = random_message(); let signature = privkey.sign_recoverable(&message).unwrap(); assert_eq!(pubkey, signature.recover(&message).unwrap()); }
rust_cleaned_test_functions.jsonl/122790
{ "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, 1288, 3688, 368, 341, 286, 1077, 320, 11887, 792, 11, 95116, 8, 284, 28358, 486, 11463, 3097, 12670, 543, 286, 1077, 1943, 284, 4194, 6462, 543, 286, 1077, 11957, 284, 6095, 792, 15499, 1288, 36...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_mode_not_specified() { assert_eq!( split_mode_string(""), Err( "Must have exactly one of create/read/write/append mode and at most one plus" .to_owned() ) ); assert_eq!( split_mode_string("b"), Err( "Must have exactly one of create/read/write/append mode and at most one plus" .to_owned() ) ); assert_eq!( split_mode_string("t"), Err( "Must have exactly one of create/read/write/append mode and at most one plus" .to_owned() ) ); }
rust_cleaned_test_functions.jsonl/105633
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 503 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 7302, 7913, 13594, 1870, 368, 341, 310, 2060, 10714, 33673, 394, 6718, 7302, 3904, 445, 4461, 394, 15495, 1006, 503, 330, 31776, 614, 6896, 825, 315, 1855, 69199, 64264, 14, 5090, 3856, 323, 518, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_basic_set_then_get_on_mixed_tables() { let _ = env_logger::init(); let parser = TOMLParser::new(); let (mut parser, _) = parser.parse(TT::get()); // test setting bare key assert!(parser.set_value("fish", Value::int(1))); // test table key set assert!(parser.set_value("foo.\"δïáϱñôƨïƨ\"", Value::int(2))); assert!(parser.set_value("foo.\"ƥřôϱñôƨïƨ\"", Value::float(1.2))); assert!(parser.set_value("foo.hypnosis", Value::float(2.3))); // test array tablset_value("foo.\"bar\"[0].baz", Value::float(3.4))); assert!(parser.set_value("foo.\"bar\"[0].qux", Value::Boolean(true))); assert!(parser.set_value("foo.\"bar\"[1].baz", Value::Boolean(false))); assert!(parser.set_value("foo.\"bar\"[1].qux", Value::basic_string("ONE").unwrap())); // Test sibling arset_value("foo.quality[0].furniture", Value::date_from_int(2000, 1, 1).unwrap())); // Test standard tset_value("foo.quality[0].machine.parts.service.\"ƥèřïôδ\"", Value::datetime_from_int(2001, 2, 2, 1, 1, 1).unwrap())); // Test inline table vallue("foo.quality[0].machine.parts.service.\"inline table\"", Value::InlineTable( Rc::new(vec![ ("KEYONE".into(), Value::literal_string("VALUEONE").unwrap()), ("KEYTWO".into(), Value::literal_string("VALUETWO").unwrap()) ]) ))); // Test child array of tlue("foo.quality[0].labor[0].Name", Value::ml_basic_string("TWO").unwrap())); assert!(parser.set_value("foo.quality[0].labor[1].Name", Value::ml_literal_string("THREE").unwrap())); // Test new parent arraylue("foo.quality[1].money", Value::datetime_parse("2002-03-03T02:02:02.01234-08:35").unwrap())); // Test restarting addinlue("foo.\"bar\"[2].baz", Value::datetime_parse("2003-04-04").unwrap())); assert!(parser.set_value("foo.\"bar\"[2].qux", Value::datetime_parse("2004-05-05T03:03:03").unwrap())); // Test resetting array lue("foo.\"bar\"[2].array", Value::Array(Rc::new(vec![ Value::int(3), Value::int(4), Value::int(5), Value::int(6), Value::int(7) ])))); // test getting bare key assert_eq!(Value::int(1), parser.get_value("fish").unwrap()); // test table key lookup assert_eq!(Value::int(2), parser.get_value("foo.\"δïáϱñôƨïƨ\"").unwrap()); assert_eq!(Value::float(1.2), parser.get_value("foo.\"ƥřôϱñôƨïƨ\"").unwrap()); assert_eq!(Value::float(2.3), parser.get_value("foo.hypnosis").unwrap()); // test array table key lookup assert_eqt_value("foo.\"bar\"[0].baz").unwrap()); assert_eq!(Value::Boolean(true), parser.get_value("foo.\"bar\"[0].qux").unwrap()); assert_eq!(Value::Boolean(false), parser.get_value("foo.\"bar\"[1].baz").unwrap()); assert_eq!(Value::basic_string("ONE").unwrap(), parser.get_value("foo.\"bar\"[1].qux").unwrap()); //Test sibling array of tables assert_eq, 1).unwrap(), parser.get_value("foo.quality[0].furniture").unwrap()); // Test standard table nested in array of tables assert_eq!(Value::datetime_from_int(2001, 2, 2, 1, 1, 1).unwrap(), parser.get_value("foo.quality[0].machine.parts.service.\"ƥèřïôδ\"").unwrap()); // Test inline table value assert_eq!(Value::lunwrap(), parser.get_value("foo.quality[0].machine.parts.service.\"inline table\".KEYONE").unwrap()); assert_eq!(Value::literal_string("VALUETWO").unwrap(), parser.get_value("foo.quality[0].machine.parts.service.\"inline table\".KEYTWO").unwrap()); // Test child array of tables assert_eq!(Valueap(), parser.get_value("foo.quality[0].labor[0].Name").unwrap()); assert_eq!(Value::ml_literal_string("THREE").unwrap(), parser.get_value("foo.quality[0].labor[1].Name").unwrap()); // Test new parent array of tables assert_eq!(Value::datetime_parse("2002-03-03T02:02:02.01234-08:35").unwrap(), parser.get_value("foo.quality[1].money").unwrap()); // Test restarting adding tables to previously defined array of tables assert_eq!(Value::datetime_parse("2003-04-04").unwrap(), parser.get_value("foo.\"bar\"[2].baz").unwrap()); assert_eq!(Value::datetime_parse("2004-05-05T03:03:03").unwrap(), parser.get_value("foo.\"bar\"[2].qux").unwrap()); // Test inline table nested in array assert_eqoo.\"bar\"[2].array[0]").unwrap()); assert_eq!(Value::int(4), parser.get_value("foo.\"bar\"[2].array[1]").unwrap()); assert_eq!(Value::int(5), parser.get_value("foo.\"bar\"[2].array[2]").unwrap()); assert_eq!(Value::int(6), parser.get_value("foo.\"bar\"[2].array[3]").unwrap()); assert_eq!(Value::int(7), parser.get_value("foo.\"bar\"[2].array[4]").unwrap()); }
rust_cleaned_test_functions.jsonl/122803
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1751 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 34729, 2602, 68367, 3062, 4470, 717, 3286, 35632, 368, 341, 220, 1077, 716, 284, 6105, 27413, 486, 2327, 1428, 220, 1077, 6729, 284, 82465, 43, 6570, 486, 931, 543, 220, 1077, 320, 6984, 6729, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_subscribe_with_encoding() { let GenesisConfigInfo { genesis_config, mint_keypair: alice, .. } = create_genesis_config(10_000); let nonce_account = Keypair::new(); let bank = Bank::new(&genesis_config); let blockhash = bank.last_blockhash(); let bank_forks = Arc::new(RwLock::new(BankForks::new(bank))); let bank0 = bank_forks.read().unwrap().get(0).unwrap().clone(); let bank1 = Bank::new_from_parent(&bank0, &Pubkey::default(), 1); bank_forks.write().unwrap().insert(bank1); let rpc = RpcSolPubSubImpl { subscriptions: Arc::new(RpcSubscriptions::new( &Arc::new(AtomicBool::new(false)), bank_forks.clone(), Arc::new(RwLock::new(BlockCommitmentCache::new_for_tests_with_slots( 1, 1, ))), OptimisticallyConfirmedBank::locked_from_bank_forks_root(&bank_forks), )), uid: Arc::new(atomic::AtomicUsize::default()), max_active_subscriptions: MAX_ACTIVE_SUBSCRIPTIONS, }; let session = create_session(); let (subscriber, _id_receiver, receiver) = Subscriber::new_test("accountNotification"); rpc.account_subscribe( session, subscriber, nonce_account.pubkey().to_string(), Some(RpcAccountInfoConfig { commitment: Some(CommitmentConfig::processed()), encoding: Some(UiAccountEncoding::JsonParsed), data_slice: None, }), ); let ixs = system_instruction::create_nonce_account( &alice.pubkey(), &nonce_account.pubkey(), &alice.pubkey(), 100, ); let message = Message::new(&ixs, Some(&alice.pubkey())); let tx = Transaction::new(&[&alice, &nonce_account], message, blockhash); process_transaction_and_notify(&bank_forks, &tx, &rpc.subscriptions, 1).unwrap(); sleep(Duration::from_millis(200)); // Test signature confirmation notification #1 let account = bank_forks .read() .unwrap() .get(1) .unwrap() .get_account(&nonce_account.pubkey()) .unwrap(); let expected_data = account.data(); let expected_data = parse_account_data( &nonce_account.pubkey(), &system_program::id(), expected_data, None, ) .unwrap(); let expected = json!({ "jsonrpc": "2.0", "method": "accountNotification", "params": { "result": { "context": { "slot": 1 }, "value": { "owner": system_program::id().to_string(), "lamports": 100, "lamportsStr": "100", "data": expected_data, "executable": false, "rentEpoch": 0, }, }, "subscription": 0, } }); let (response, _) = robust_poll_or_panic(receiver); assert_eq!(serde_json::to_string(&expected).unwrap(), response); }
rust_cleaned_test_functions.jsonl/4701
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1779 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13500, 88935, 6615, 37613, 368, 341, 286, 1077, 40788, 2648, 1731, 341, 310, 59366, 5332, 345, 310, 28337, 3097, 12670, 25, 70433, 345, 310, 54538, 286, 335, 284, 1855, 16322, 13774, 5332, 7, 16, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_ex2() { let input = " shiny gold bags contain 2 dark red bags. dark red bags contain 2 dark orange bags. dark orange bags contain 2 dark yellow bags. dark yellow bags contain 2 dark green bags. dark green bags contain 2 dark blue bags. dark blue bags contain 2 dark violet bags. dark violet bags contain no other bags. "; assert_eq!(126, Solver::run_on(input).1); }
rust_cleaned_test_functions.jsonl/5159
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 217 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2702, 17, 368, 341, 286, 1077, 1946, 284, 6228, 310, 41199, 6623, 17899, 6644, 220, 17, 6319, 2518, 17899, 624, 310, 6319, 2518, 17899, 6644, 220, 17, 6319, 18575, 17899, 624, 310, 6319, 18575, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_serde() { use serde_test::{assert_tokens, Configure, Token}; static SK_BYTES: [u8; 32] = [ 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 2, 3, 4, 5, 6, 7, 0xff, 0xff, 0, 0, 0xff, 0xff, 0, 0, 99, 99, 99, 99, 99, 99, 99, 99, ]; static SK_STR: &'static str = "\ 01010101010101010001020304050607ffff0000ffff00006363636363636363\ "; static PK_BYTES: [u8; 33] = [ 0x02, 0x18, 0x84, 0x57, 0x81, 0xf6, 0x31, 0xc4, 0x8f, 0x1c, 0x97, 0x09, 0xe2, 0x30, 0x92, 0x06, 0x7d, 0x06, 0x83, 0x7f, 0x30, 0xaa, 0x0c, 0xd0, 0x54, 0x4a, 0xc8, 0x87, 0xfe, 0x91, 0xdd, 0xd1, 0x66, ]; static PK_STR: &'static str = "\ 0218845781f631c48f1c9709e23092067d06837f30aa0cd0544ac887fe91ddd166\ "; let s = Secp256k1::new(); let sk = SecretKey::from_slice(&SK_BYTES).unwrap(); let pk = PublicKey::from_secret_key(&s, &sk); assert_tokens(&sk.compact(), &[Token::BorrowedBytes(&SK_BYTES[..])]); assert_tokens(&sk.readable(), &[Token::BorrowedStr(SK_STR)]); assert_tokens(&pk.compact(), &[Token::BorrowedBytes(&PK_BYTES[..])]); assert_tokens(&pk.readable(), &[Token::BorrowedStr(PK_STR)]); }
rust_cleaned_test_functions.jsonl/32195
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 740 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 39859, 75861, 450, 368, 341, 286, 990, 61570, 4452, 22964, 2207, 28838, 11, 22169, 11, 9660, 2440, 286, 1099, 12072, 40705, 25, 508, 84, 23, 26, 220, 18, 17, 60, 284, 2278, 310, 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_translate_to_fuzz() { let mut seed = vec![0; 1000]; for _ in 0..1000 { let mut rng = rand::thread_rng(); rng.fill_bytes(&mut seed); let module = translate_to_fuzz(&seed); assert!(module.is_valid()); } }
rust_cleaned_test_functions.jsonl/17825
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 162 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 66381, 2346, 761, 8889, 368, 341, 286, 1077, 5206, 10320, 284, 7486, 20703, 15, 26, 220, 16, 15, 15, 15, 935, 286, 369, 716, 304, 220, 15, 496, 16, 15, 15, 15, 341, 310, 1077, 5206, 28422, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_f_string() { let query: Query = parse( r###" from employees derive age = year_born - s'now()' select [ f"Hello my name is {prefix}{first_name} {last_name}", f"and I am {age} years old." ] "###, ) .unwrap(); let sql = resolve_and_translate(query).unwrap(); assert_display_snapshot!(sql, @r###" SELECT CONCAT( 'Hello my name is ', prefix, first_name, ' ', last_name ), CONCAT('and I am ', year_born - now(), ' years old.') FROM employees "### ); }
rust_cleaned_test_functions.jsonl/62551
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 423 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 761, 3904, 368, 341, 286, 1077, 3239, 25, 11361, 284, 4715, 1006, 310, 435, 14374, 698, 286, 504, 8256, 198, 286, 42430, 4231, 284, 1042, 880, 1512, 481, 274, 6, 3328, 368, 1248, 286, 3293, 22...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_process_collector() { let pc = ProcessCollector::for_self(); { // Seven metrics per process collector. let descs = pc.desc(); assert_eq!(descs.len(), super::METRICS_NUMBER); let mfs = pc.collect(); assert_eq!(mfs.len(), super::METRICS_NUMBER); } let r = registry::Registry::new(); let res = r.register(Box::new(pc)); assert!(res.is_ok()); }
rust_cleaned_test_functions.jsonl/100484
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 239 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11305, 10211, 27669, 368, 341, 286, 1077, 13312, 284, 8603, 53694, 486, 1958, 25637, 543, 286, 341, 310, 442, 29948, 16734, 817, 1882, 31953, 624, 310, 1077, 939, 4837, 284, 13312, 30514, 543, 310...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_bad_message() { let (peer_mgr_notifs_tx, peer_mgr_notifs_rx) = aptos_channel::new(QueueStyle::FIFO, 8, None); let (connection_notifs_tx, connection_notifs_rx) = aptos_channel::new(QueueStyle::FIFO, 8, None); let consensus_network_events = ConsensusNetworkEvents::new(peer_mgr_notifs_rx, connection_notifs_rx); let (self_sender, self_receiver) = channel::new_test(8); let (network_task, mut network_receivers) = NetworkTask::new(consensus_network_events, self_receiver); let peer_id = PeerId::random(); let protocol_id = ProtocolId::ConsensusDirectSendBcs; let bad_msg = PeerManagerNotification::RecvMessage( peer_id, Message { protocol_id, mdata: Bytes::from_static(b"\xde\xad\xbe\xef"), }, ); peer_mgr_notifs_tx .push((peer_id, protocol_id), bad_msg) .unwrap(); let liveness_check_msg = ConsensusMsg::BlockRetrievalRequest(Box::new( BlockRetrievalRequest::new(HashValue::random(), 1), )); let protocol_id = ProtocolId::ConsensusRpcJson; let (res_tx, _res_rx) = oneshot::channel(); let liveness_check_msg = PeerManagerNotification::RecvRpc( peer_id, InboundRpcRequest { protocol_id, data: Bytes::from(serde_json::to_vec(&liveness_check_msg).unwrap()), res_tx, }, ); peer_mgr_notifs_tx .push((peer_id, protocol_id), liveness_check_msg) .unwrap(); let f_check = async move { assert!(network_receivers.block_retrieval.next().await.is_some()); drop(peer_mgr_notifs_tx); drop(connection_notifs_tx); drop(self_sender); assert!(network_receivers.block_retrieval.next().await.is_none()); assert!(network_receivers.consensus_messages.next().await.is_none()); }; let f_network_task = network_task.start(); let mut runtime = consensus_runtime(); timed_block_on(&mut runtime, future::join(f_network_task, f_check)); }
rust_cleaned_test_functions.jsonl/14623
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1124 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 34199, 6462, 368, 341, 286, 1077, 320, 16537, 42438, 7913, 21835, 17805, 11, 14397, 42438, 7913, 21835, 24330, 8, 4035, 310, 20095, 436, 14571, 486, 931, 6253, 6318, 2323, 486, 37, 25997, 11, 220,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_powers_of_two_and_half() { for p in 0..64 { let po2 = 1u64 << p; let delta = po2 / 2; let x = po2.wrapping_sub(delta / 4); let y = po2.wrapping_add(delta); check(x); check(y); for i in 1..=8 { check(x.wrapping_sub(i)); check(x.wrapping_add(i)); check(y.wrapping_sub(i)); check(y.wrapping_add(i)); } } }
rust_cleaned_test_functions.jsonl/65996
{ "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, 620, 15965, 3575, 23241, 8378, 40626, 368, 341, 286, 369, 281, 304, 220, 15, 496, 21, 19, 341, 310, 1077, 3193, 17, 284, 220, 16, 84, 21, 19, 1115, 281, 280, 310, 1077, 9477, 284, 3193, 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_indices_to_hashstack_indices() { let config = "feature_index_prefix_bit: 12\nslots_config:\n Test:\n dim: 32\n hash_stack_config:\n hash_stack_rounds: 2\n embedding_size: 10\nfeature_groups: {}\n"; let config: EmbeddingConfig = serde_yaml::from_str(config).expect("failed to parse config"); let raw_batch: Vec<Vec<u64>> = vec![vec![12, 23, 34], vec![56, 78, 90], vec![12, 56]]; let feature_name = "Test".to_string(); let feature_batch = FeatureBatch::new(feature_name.clone(), raw_batch); let mut sparse_batch = SparseBatch { requires_grad: false, batches: vec![feature_batch], enter_forward_id_buffer_time: None, enter_post_forward_buffer_time: None, batcher_idx: None, }; indices_to_hashstack_indices(&mut sparse_batch, &config); let hashstack_feature_batch = sparse_batch.batches.first().unwrap(); let target_raw_batch: Vec<Vec<u64>> = vec![ vec![2, 18, 5, 10, 0, 11], vec![6, 17, 7, 12, 8, 16], vec![2, 18, 6, 17], ]; let target_feature_batch = FeatureBatch::new(feature_name, target_raw_batch); for single_sign in hashstack_feature_batch.index_batch.iter() { for target_single_sign in target_feature_batch.index_batch.iter() { if single_sign.sign == target_single_sign.sign { let mut result = single_sign.in_which_batch_samples.clone(); let mut target = target_single_sign.in_which_batch_samples.clone(); assert_eq!(result.len(), target.len()); result.sort(); target.sort(); let matching = result .iter() .zip(&target) .filter(|&((r, _), (t, _))| r == t) .count(); assert_eq!(matching, target.len()); } } } }
rust_cleaned_test_functions.jsonl/22514
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1060 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 18333, 2346, 8950, 7693, 18333, 368, 341, 286, 1077, 2193, 284, 330, 12753, 3560, 13974, 13996, 25, 220, 16, 17, 1699, 49767, 5332, 7190, 77, 220, 3393, 7190, 77, 262, 5103, 25, 220, 18, 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...
4
#[test] fn test_pwhash_verify_tamper() { use randombytes::randombytes; for i in 0..16usize { let mut pw = randombytes(i); let pwh = pwhash(&pw, OPSLIMIT_INTERACTIVE, MEMLIMIT_INTERACTIVE).unwrap(); for j in 0..pw.len() { pw[j] ^= 0x20; assert!(!pwhash_verify(&pwh, &pw)); pw[j] ^= 0x20; } } }
rust_cleaned_test_functions.jsonl/26381
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 262 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 620, 1312, 988, 35638, 528, 309, 712, 368, 341, 286, 990, 4194, 9651, 486, 11463, 9651, 280, 286, 369, 600, 304, 220, 15, 496, 16, 21, 51878, 341, 310, 1077, 5206, 26581, 284, 4194, 9651, 1956...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_record() { let e = (html! { tag { |tmpl| tmpl.record_error("test"); } }) .into_string() .err() .unwrap(); assert!(e.write.is_none()); assert_eq!(e.render.len(), 1); assert_eq!(&e.render[0].to_string(), "test"); }
rust_cleaned_test_functions.jsonl/89534
{ "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, 14192, 368, 341, 262, 1077, 384, 284, 320, 1551, 0, 341, 286, 4772, 341, 310, 760, 71359, 91, 79839, 32024, 4096, 445, 1944, 797, 286, 456, 262, 2751, 262, 659, 18122, 3904, 741, 262, 659, 615...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_tail_invalid_num() { new_ucmd!() .args(&["-c", "1024R", "emptyfile.txt"]) .fails() .stderr_is("tail: invalid number of bytes: '1024R'"); new_ucmd!() .args(&["-n", "1024R", "emptyfile.txt"]) .fails() .stderr_is("tail: invalid number of lines: '1024R'"); #[cfg(not(target_pointer_width = "128"))] new_ucmd!() .args(&["-c", "1Y", "emptyfile.txt"]) .fails() .stderr_is("tail: invalid number of bytes: '1Y': Value too large for defined data type"); #[cfg(not(target_pointer_width = "128"))] new_ucmd!() .args(&["-n", "1Y", "emptyfile.txt"]) .fails() .stderr_is("tail: invalid number of lines: '1Y': Value too large for defined data type"); #[cfg(target_pointer_width = "32")] { let sizes = ["1000G", "10T"]; for size in &sizes { new_ucmd!() .args(&["-c", size]) .fails() .code_is(1) .stderr_only(format!( "tail: invalid number of bytes: '{}': Value too large for defined data type", size )); } } }
rust_cleaned_test_functions.jsonl/39308
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 640 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 35471, 31433, 4273, 368, 341, 262, 501, 68887, 2277, 0, 741, 286, 659, 2116, 2099, 1183, 12, 66, 497, 330, 16, 15, 17, 19, 49, 497, 330, 3194, 1192, 3909, 14108, 286, 659, 59631, 741, 286, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_to_nearest_power_of_two() { assert_eq!( to_nearest_power_of_two( 1, 1 ), 1 ); assert_eq!( to_nearest_power_of_two( 1, 2 ), 2 ); assert_eq!( to_nearest_power_of_two( 1, 3 ), 4 ); assert_eq!( to_nearest_power_of_two( 1, 1 ), 1 ); assert_eq!( to_nearest_power_of_two( 2, 1 ), 2 ); assert_eq!( to_nearest_power_of_two( 3, 1 ), 4 ); assert_eq!( to_nearest_power_of_two( 3, 3 ), 4 ); assert_eq!( to_nearest_power_of_two( 4, 3 ), 4 ); assert_eq!( to_nearest_power_of_two( 3, 4 ), 4 ); assert_eq!( to_nearest_power_of_two( 4, 4 ), 4 ); }
rust_cleaned_test_functions.jsonl/84258
{ "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, 2346, 13925, 15432, 20421, 3575, 23241, 368, 341, 262, 2060, 10714, 10297, 311, 13925, 15432, 20421, 3575, 23241, 7, 220, 16, 11, 220, 16, 6882, 220, 16, 1439, 262, 2060, 10714, 10297, 311, 13925,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_crud() { // Short name. multi_crud(10, 200, 1..20, 0..BSIZE * 2); // Long name. multi_crud(10, 100, 20..100, 0..BSIZE * 2); // Large data. multi_crud(10, 50, 1..20, 0..BSIZE * 10); }
rust_cleaned_test_functions.jsonl/130732
{ "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, 32331, 661, 368, 341, 286, 442, 10698, 829, 624, 286, 7299, 32331, 661, 7, 16, 15, 11, 220, 17, 15, 15, 11, 220, 16, 496, 17, 15, 11, 220, 15, 496, 7347, 3282, 353, 220, 17, 317, 286, 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