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_to_bool_float() { let val: ScalarCow<'_> = 42f64.into(); assert_eq!(val.to_bool(), None); let val: ScalarCow<'_> = 42.34.into(); assert_eq!(val.to_bool(), None); }
rust_cleaned_test_functions.jsonl/108137
{ "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, 2346, 22159, 17586, 368, 341, 286, 1077, 1044, 25, 35176, 89915, 18291, 98377, 284, 220, 19, 17, 69, 21, 19, 39860, 543, 286, 2060, 10714, 10297, 831, 2389, 22159, 1507, 2240, 626, 286, 1077, 10...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_delete_dependencies() { solana_logger::setup(); let accounts_index = AccountsIndex::default_for_tests(); let key0 = Pubkey::new_from_array([0u8; 32]); let key1 = Pubkey::new_from_array([1u8; 32]); let key2 = Pubkey::new_from_array([2u8; 32]); let info0 = AccountInfo { store_id: 0, offset: 0, stored_size: 0, lamports: 0, }; let info1 = AccountInfo { store_id: 1, offset: 0, stored_size: 0, lamports: 0, }; let info2 = AccountInfo { store_id: 2, offset: 0, stored_size: 0, lamports: 0, }; let info3 = AccountInfo { store_id: 3, offset: 0, stored_size: 0, lamports: 0, }; let mut reclaims = vec![]; accounts_index.upsert( 0, &key0, &Pubkey::default(), &[], &AccountSecondaryIndexes::default(), info0, &mut reclaims, UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE, ); accounts_index.upsert( 1, &key0, &Pubkey::default(), &[], &AccountSecondaryIndexes::default(), info1, &mut reclaims, UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE, ); accounts_index.upsert( 1, &key1, &Pubkey::default(), &[], &AccountSecondaryIndexes::default(), info1, &mut reclaims, UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE, ); accounts_index.upsert( 2, &key1, &Pubkey::default(), &[], &AccountSecondaryIndexes::default(), info2, &mut reclaims, UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE, ); accounts_index.upsert( 2, &key2, &Pubkey::default(), &[], &AccountSecondaryIndexes::default(), info2, &mut reclaims, UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE, ); accounts_index.upsert( 3, &key2, &Pubkey::default(), &[], &AccountSecondaryIndexes::default(), info3, &mut reclaims, UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE, ); accounts_index.add_root(0, false); accounts_index.add_root(1, false); accounts_index.add_root(2, false); accounts_index.add_root(3, false); let mut purges = HashMap::new(); let (key0_entry, _) = accounts_index.get(&key0, None, None).unwrap(); purges.insert(key0, accounts_index.roots_and_ref_count(&key0_entry, None)); let (key1_entry, _) = accounts_index.get(&key1, None, None).unwrap(); purges.insert(key1, accounts_index.roots_and_ref_count(&key1_entry, None)); let (key2_entry, _) = accounts_index.get(&key2, None, None).unwrap(); purges.insert(key2, accounts_index.roots_and_ref_count(&key2_entry, None)); for (key, (list, ref_count)) in &purges { info!(" purge {} ref_count {} =>", key, ref_count); for x in list { info!(" {:?}", x); } } let mut store_counts = HashMap::new(); store_counts.insert(0, (0, HashSet::from_iter(vec![key0]))); store_counts.insert(1, (0, HashSet::from_iter(vec![key0, key1]))); store_counts.insert(2, (0, HashSet::from_iter(vec![key1, key2]))); store_counts.insert(3, (1, HashSet::from_iter(vec![key2]))); AccountsDb::calc_delete_dependencies(&purges, &mut store_counts); let mut stores: Vec<_> = store_counts.keys().cloned().collect(); stores.sort_unstable(); for store in &stores { info!( "store: {:?} : {:?}", store, store_counts.get(store).unwrap() ); } for x in 0..3 { assert!(store_counts[&x].0 >= 1); } }
rust_cleaned_test_functions.jsonl/7013
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2419 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11353, 71841, 368, 341, 286, 2048, 3362, 27413, 486, 15188, 543, 286, 1077, 9618, 3560, 284, 40655, 1552, 486, 2258, 5478, 32509, 543, 286, 1077, 1376, 15, 284, 22611, 792, 486, 931, 5673, 3858, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
#[test] fn test_non_printing_chars() { new_ucmd!() .pipe_in("a👦🏻aa\naaaa") // spell-checker:disable-line .arg("-i") .succeeds() .stdout_only("a👦🏻aa\naaaa\n"); // spell-checker:disable-line }
rust_cleaned_test_functions.jsonl/20481
{ "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, 21637, 10064, 287, 37418, 368, 341, 262, 501, 68887, 2277, 0, 741, 286, 659, 13768, 1243, 445, 64, 145988, 144321, 5305, 1699, 28458, 899, 442, 12845, 15934, 261, 42066, 8447, 198, 286, 659, 858, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_branch_pop_version() { let hdr: MapxOrdRawKeyVs<usize> = MapxOrdRawKeyVs::new(); assert_eq!(false, hdr.branch_has_versions(INITIAL_BRANCH_NAME)); pnk!(hdr.version_create(VersionName(b"manster0"))); assert!(hdr.branch_has_versions(INITIAL_BRANCH_NAME)); pnk!(hdr.branch_pop_version(INITIAL_BRANCH_NAME)); assert_eq!(false, hdr.branch_has_versions(INITIAL_BRANCH_NAME)); }
rust_cleaned_test_functions.jsonl/53979
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 196 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 28031, 17061, 9438, 368, 341, 262, 1077, 36615, 25, 5027, 87, 24621, 20015, 1592, 51737, 90244, 29, 284, 5027, 87, 24621, 20015, 1592, 51737, 486, 931, 543, 262, 2060, 10714, 10297, 3849, 11, 3661...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_nested_text_styles() { assert_markdown_eq( common::parts::nested_text_styles, r###" Here is some ***bold italic*** text. Here is some bold italic plain text. Here is some *bold plain italic* text. "###, ); }
rust_cleaned_test_functions.jsonl/133527
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 109 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 66279, 4326, 37857, 368, 341, 262, 2060, 18924, 2923, 10714, 1006, 286, 4185, 486, 18252, 486, 59271, 4326, 37857, 345, 286, 435, 14374, 698, 8420, 374, 1045, 17160, 14824, 60763, 12210, 1467, 382, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_insert_to_pre_genesis() { let db = MockTreeStore::default(); let key1 = HashValue::new([0x00u8; HashValue::LENGTH]); let value1 = ValueBlob::from(vec![1u8, 2u8]); let pre_genesis_root_key = NodeKey::new_empty_path(PRE_GENESIS_VERSION); db.put_node(pre_genesis_root_key, Node::new_leaf(key1, value1.clone())) .unwrap(); // Genesis inserts one more leaf. let tree = JellyfishMerkleTree::new(&db); let key2 = update_nibble(&key1, 0, 15); let value2 = ValueBlob::from(vec![3u8, 4u8]); // batch version let (_root_hash, batch) = tree .batch_put_value_sets( vec![vec![(key2, value2.clone())]], None, 0, /* version */ ) .unwrap(); // Check pre-genesis node prunes okay. assert_eq!(batch.stale_node_index_batch.len(), 1); db.write_tree_update_batch(batch).unwrap(); assert_eq!(db.num_nodes(), 4); db.purge_stale_nodes(0).unwrap(); assert_eq!(db.num_nodes(), 3); // Check mixed state reads okay. assert_eq!(tree.get(key1, 0).unwrap().unwrap(), value1); assert_eq!(tree.get(key2, 0).unwrap().unwrap(), value2); }
rust_cleaned_test_functions.jsonl/46369
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 543 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 17678, 2346, 10442, 16322, 13774, 368, 341, 1066, 262, 1077, 2927, 284, 14563, 6533, 6093, 486, 2258, 543, 262, 1077, 1376, 16, 284, 6531, 1130, 486, 931, 2561, 15, 87, 15, 15, 84, 23, 26, 653...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_start_intersecting_activity() { let test_dir = tempdir().expect("error while creating tempdir"); let mut service = build_json_service(&test_dir); let finished = OngoingActivity::new( Local .datetime_from_str("2020-12-25T09:00:00", "%Y-%m-%dT%H:%M:%S") .unwrap() .into(), vec![], None, ) .into_activity( Local .datetime_from_str("2020-12-25T10:00:00", "%Y-%m-%dT%H:%M:%S") .unwrap() .into(), ) .unwrap(); let tracked = service.track_activity(finished, true); assert!(tracked.is_ok()); let other = OngoingActivity::new( Local .datetime_from_str("2020-12-25T09:30:00", "%Y-%m-%dT%H:%M:%S") .unwrap() .into(), vec![], None, ); let started = service.start_activity(other, true); assert!(started.is_err()); }
rust_cleaned_test_functions.jsonl/116412
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 616 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4906, 72747, 287, 30026, 368, 341, 286, 1077, 1273, 4334, 284, 2730, 3741, 1005, 17119, 445, 841, 1393, 6825, 2730, 3741, 797, 286, 1077, 5206, 2473, 284, 1936, 9455, 12267, 2099, 1944, 4334, 317,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_ssh_url_clone_url() { let url = "ssh://aur@aur.archlinux.org/user/repo.git"; assert_eq!( Repo::parse(url).get_clone_url(), "ssh://aur@aur.archlinux.org/user/repo.git" ); }
rust_cleaned_test_functions.jsonl/31153
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 136 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 82805, 2903, 54742, 2903, 368, 341, 286, 1077, 2515, 284, 330, 25537, 1110, 4110, 31, 4110, 38091, 14210, 2659, 11739, 10758, 5368, 32799, 876, 286, 2060, 10714, 33673, 310, 71509, 486, 6400, 6522, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_blockstream() -> () { let blockstream = MockBlockstream::new("test_stream".to_string()); let ticks_per_slot = 5; let mut blockhash = Hash::default(); let mut entries = Vec::new(); let mut expected_entries = Vec::new(); let tick_height_initial = 0; let tick_height_final = tick_height_initial + ticks_per_slot + 2; let mut curr_slot = 0; let leader_id = Pubkey::new_rand(); for tick_height in tick_height_initial..=tick_height_final { if tick_height == 5 { blockstream .emit_block_event(curr_slot, tick_height - 1, &leader_id, blockhash) .unwrap(); curr_slot += 1; } let entry = Entry::new(&mut blockhash, 1, vec![]); // just ticks blockhash = entry.hash; blockstream .emit_entry_event(curr_slot, tick_height, &leader_id, &entry) .unwrap(); expected_entries.push(entry.clone()); entries.push(entry); } assert_eq!( blockstream.entries().len() as u64, ticks_per_slot + 3 + 1 ); let mut j = 0; let mut matched_entries = 0; let mut matched_slots = HashSet::new(); let mut matched_blocks = HashSet::new(); for item in blockstream.entries() { let json: Value = serde_json::from_str(&item).unwrap(); let dt_str = json["dt"].as_str().unwrap(); // Ensure `ts` field parses as valid DateTime let _dt: DateTime<FixedOffset> = DateTime::parse_from_rfc3339(dt_str).unwrap(); let item_type = json["t"].as_str().unwrap(); match item_type { "block" => { let hash = json["hash"].to_string(); matched_blocks.insert(hash); } "entry" => { let slot = json["s"].as_u64().unwrap(); matched_slots.insert(slot); let entry_obj = json["entry"].clone(); let entry: Entry = serde_json::from_value(entry_obj).unwrap(); assert_eq!(entry, expected_entries[j]); matched_entries += 1; j += 1; } _ => { assert!(false, "unknown item type {}", item); } } } assert_eq!(matched_entries, expected_entries.len()); assert_eq!(matched_slots.len(), 2); assert_eq!(matched_blocks.len(), 1); }
rust_cleaned_test_functions.jsonl/100170
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1408 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 7113, 4027, 368, 1464, 1719, 341, 286, 1077, 2504, 4027, 284, 14563, 4713, 4027, 486, 931, 445, 1944, 12673, 3263, 983, 3904, 1423, 286, 1077, 29957, 5678, 27563, 284, 220, 20, 401, 286, 1077, 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...
5
#[test] fn test_qualify_path_and_substitute_param() { check_assist( add_missing_impl_members, " mod foo { pub struct Bar<T>; trait Foo<T> { fn foo(&self, bar: Bar<T>); } } struct S; impl foo::Foo<u32> for S { <|> }", " mod foo { pub struct Bar<T>; trait Foo<T> { fn foo(&self, bar: Bar<T>); } } struct S; impl foo::Foo<u32> for S { <|>fn foo(&self, bar: foo::Bar<u32>) { unimplemented!() } }", ); }
rust_cleaned_test_functions.jsonl/106818
{ "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, 64391, 1437, 2638, 8378, 5228, 7660, 4090, 368, 341, 286, 1779, 12083, 380, 1006, 310, 912, 40447, 21007, 30397, 345, 310, 6228, 2593, 15229, 341, 262, 6675, 2036, 4716, 3125, 10133, 262, 17567, 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_addassign() { fn inner(mut bounds: Vec<f64>, lpyld: Vec<f64>, rpyld: Vec<f64>) -> TestResult { if bounds.is_empty() { return TestResult::discard(); } bounds.sort_by(|a, b| a.partial_cmp(b).unwrap()); let mut x = Histogram::new(bounds.clone()).unwrap(); for i in lpyld { x.insert(i); } let mut y = Histogram::new(bounds).unwrap(); for i in rpyld { y.insert(i); } let mut res = x.clone(); res += y.clone(); assert_eq!(res.count(), x.count() + y.count()); if res.sum().is_some() { match (x.sum().is_some(), y.sum().is_some()) { (true, true) => { assert_eq!(res.sum().unwrap(), x.sum().unwrap() + y.sum().unwrap()); } (false, true) => { assert_eq!(res.sum().unwrap(), y.sum().unwrap()); } (true, false) => { assert_eq!(res.sum().unwrap(), x.sum().unwrap()); } (false, false) => unreachable!(), } } else { assert!(x.sum().is_none()); assert!(y.sum().is_none()); } let mut x_iter = x.iter(); let mut y_iter = y.iter(); for &(bound, count) in res.iter() { let next_x = x_iter.next().unwrap(); let next_y = y_iter.next().unwrap(); assert_eq!(bound, next_x.0); assert_eq!(bound, next_y.0); assert_eq!(count, next_x.1 + next_y.1) } TestResult::passed() } QuickCheck::new().quickcheck(inner as fn(Vec<f64>, Vec<f64>, Vec<f64>) -> TestResult); }
rust_cleaned_test_functions.jsonl/38533
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1157 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2891, 6983, 368, 341, 286, 5168, 9179, 70305, 14262, 25, 11312, 63895, 21, 19, 8066, 326, 3288, 507, 25, 11312, 63895, 21, 19, 8066, 435, 3288, 507, 25, 11312, 63895, 21, 19, 9231, 1464, 3393, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
#[test] fn test_empty_object() { let mut jbl = JBL::new_object().unwrap(); jbl.set_prop("a", true).unwrap(); jbl.set_prop("b", 12345 as f64).unwrap(); jbl.set_prop("c", JBLValue::Null).unwrap(); jbl.set_prop("d", JBLValue::EmptyArray).unwrap(); jbl.set_prop("e", "{\"a\":1,\"b\":2}".parse::<JBL>().unwrap()) .unwrap(); let json: String = jbl.as_json(None).unwrap(); assert_eq!( json, "{\"a\":true,\"b\":12345,\"c\":null,\"d\":[],\"e\":{\"a\":1,\"b\":2}}" ); }
rust_cleaned_test_functions.jsonl/80410
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 326 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15124, 5314, 368, 972, 286, 1077, 5206, 502, 2024, 284, 619, 9389, 486, 931, 5314, 1005, 15454, 1647, 286, 502, 2024, 980, 21663, 445, 64, 497, 830, 568, 15454, 1647, 286, 502, 2024, 980, 21663,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_encode_decode() { use crate::rr::dnssec::SupportedAlgorithms; let mut edns: Edns = Edns::new(); edns.set_dnssec_ok(true); edns.set_max_payload(0x8008); edns.set_version(0x40); edns.set_rcode_high(0x01); edns.options_mut() .insert(EdnsOption::DAU(SupportedAlgorithms::all())); let record: Record = (&edns).into(); let edns_decode: Edns = (&record).into(); assert_eq!(edns.dnssec_ok(), edns_decode.dnssec_ok()); assert_eq!(edns.max_payload(), edns_decode.max_payload()); assert_eq!(edns.version(), edns_decode.version()); assert_eq!(edns.rcode_high(), edns_decode.rcode_high()); assert_eq!(edns.options(), edns_decode.options()); // re-insert and remove using mut edns.options_mut() .insert(EdnsOption::DAU(SupportedAlgorithms::all())); edns.options_mut().remove(EdnsCode::DAU); assert!(edns.option(EdnsCode::DAU).is_none()); }
rust_cleaned_test_functions.jsonl/93008
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 420 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11224, 15227, 368, 341, 262, 990, 17717, 486, 634, 486, 45226, 5024, 486, 34636, 2101, 18980, 401, 262, 1077, 5206, 1578, 4412, 25, 3199, 4412, 284, 3199, 4412, 486, 931, 1428, 262, 1578, 4412, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_no_leak_with_double_indirection() { use crate::collect::*; #[derive(Debug, Clone)] struct S { ty: Cc<Cc<i32>>, } let ty = Cc::new(5); drop(ty.clone()); let s = S { ty: Cc::new(ty) }; drop(s.ty.clone()); std::mem::drop(s); collect_cycles(); }
rust_cleaned_test_functions.jsonl/110858
{ "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, 6536, 11751, 585, 6615, 24598, 9122, 2866, 368, 341, 286, 990, 17717, 486, 17384, 56162, 286, 11506, 27098, 42618, 11, 27913, 5563, 286, 2036, 328, 341, 310, 13580, 25, 356, 66, 20373, 66, 21897, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_output_to_custom_log() { let subsystem = CString::new("com.example.test").unwrap(); let category = CString::new("category").unwrap(); let log = unsafe { os_log_create(subsystem.as_ptr(), category.as_ptr()) }; let message = CString::new("Hello!").unwrap(); unsafe { wrapped_os_log_debug(log, message.as_ptr()); wrapped_os_log_info(log, message.as_ptr()); wrapped_os_log_default(log, message.as_ptr()); wrapped_os_log_error(log, message.as_ptr()); wrapped_os_log_fault(log, message.as_ptr()); wrapped_os_log_with_type(log, OS_LOG_TYPE_DEBUG, message.as_ptr()); wrapped_os_log_with_type(log, OS_LOG_TYPE_INFO, message.as_ptr()); wrapped_os_log_with_type(log, OS_LOG_TYPE_DEFAULT, message.as_ptr()); wrapped_os_log_with_type(log, OS_LOG_TYPE_ERROR, message.as_ptr()); wrapped_os_log_with_type(log, OS_LOG_TYPE_FAULT, message.as_ptr()); os_release(log as *mut _); } }
rust_cleaned_test_functions.jsonl/125807
{ "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, 7645, 2346, 15875, 5224, 368, 341, 286, 1077, 52785, 284, 56956, 486, 931, 445, 874, 7724, 5958, 1827, 15454, 543, 286, 1077, 5582, 284, 56956, 486, 931, 445, 5471, 1827, 15454, 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_get_time() { delay(); let client: Public<Sync> = Public::new(SANDBOX_URL); let time = client.get_time().unwrap(); let time_str = format!("{:?}", time); assert!(time_str.starts_with("Time {")); assert!(time_str.contains("iso:")); assert!(time_str.contains("epoch:")); assert!(time_str.ends_with("}")); }
rust_cleaned_test_functions.jsonl/50630
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 159 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 3009, 368, 341, 262, 7626, 543, 262, 1077, 2943, 25, 3066, 27, 12154, 29, 284, 3066, 486, 931, 3759, 1093, 3506, 60155, 8000, 317, 262, 1077, 882, 284, 2943, 670, 3009, 1005, 15454, 543, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_cpuidfeature_try_from_usize() { for value in CpuidFeature::values() { let converted = <CpuidFeature as TryFrom<usize>>::try_from(value as usize).unwrap(); assert_eq!(converted, value); } assert!(<CpuidFeature as TryFrom<usize>>::try_from(IcedConstants::CPUID_FEATURE_ENUM_COUNT).is_err()); assert!(<CpuidFeature as TryFrom<usize>>::try_from(core::usize::MAX).is_err()); }
rust_cleaned_test_functions.jsonl/5965
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 164 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 39811, 2423, 12753, 53283, 5673, 11306, 551, 368, 341, 2023, 897, 304, 64256, 2423, 13859, 486, 3661, 368, 341, 197, 10217, 16099, 284, 366, 34, 79, 2423, 13859, 438, 9735, 3830, 90244, 77595, 153...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_unbound_attribute_with_ground() { let causetq = r#"[:find ?x ?v :where [?x _ ?v] (not [(ground 17) ?v])]"#; let schemaReplicant = prepopulated_schemaReplicant(); let SQLCausetQ { allegrosql, .. } = translate(&schemaReplicant, causetq); assert_eq!(allegrosql, "SELECT DISTINCT `all_Causets00`.e AS `?x`, \ `all_Causets00`.v AS `?v`, \ `all_Causets00`.value_type_tag AS `?v_value_type_tag` \ FROM `all_Causets` AS `all_Causets00` \ WHERE NOT EXISTS (SELECT 1 WHERE `all_Causets00`.v = 17 AND \ (`all_Causets00`.value_type_tag = 5))"); }
rust_cleaned_test_functions.jsonl/90725
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 417 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4907, 10891, 16791, 6615, 72492, 368, 341, 262, 1077, 2162, 18187, 80, 284, 435, 55543, 3447, 3903, 937, 87, 937, 85, 549, 2870, 508, 30, 87, 716, 937, 85, 60, 320, 1921, 17826, 1951, 220, 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_day_4_2_valid() { assert_eq!( day_4_2(&vec!( String::from("pid:087499704 hgt:74in ecl:grn iyr:2012 eyr:2030 byr:1980"), String::from("hcl:#623a2f"), String::from(""), String::from("eyr:2029 ecl:blu cid:129 byr:1989"), String::from("iyr:2014 pid:896056539 hcl:#a97842 hgt:165cm"), String::from(""), String::from("hcl:#888785"), String::from("hgt:164cm byr:2001 iyr:2015 cid:88"), String::from("pid:545766238 ecl:hzl"), String::from("eyr:2022"), String::from(""), String::from( "iyr:2010 hgt:158cm hcl:#b6652a ecl:blu byr:1944 eyr:2021 pid:093154719" ), )), 4 ); }
rust_cleaned_test_functions.jsonl/21949
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 538 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 16763, 62, 19, 62, 17, 8337, 368, 341, 286, 2060, 10714, 33673, 310, 1899, 62, 19, 62, 17, 2099, 4083, 33673, 394, 923, 486, 1499, 445, 10412, 25, 15, 23, 22, 19, 24, 24, 22, 15, 19, 305, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_should_fail() { fn f() { panic!(); } let desc = TestDescAndFn { desc: TestDesc { name: StaticTestName("whatever"), ignore: false, should_fail: ShouldFail::Yes(None) }, testfn: DynTestFn(Thunk::new(move|| f())), }; let (tx, rx) = channel(); run_test(&TestOpts::new(), false, desc, tx); let (_, res, _) = rx.recv().unwrap(); assert!(res == TrOk); }
rust_cleaned_test_functions.jsonl/7110
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 280 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 43378, 22121, 368, 341, 286, 5168, 282, 368, 314, 21975, 0, 2129, 456, 286, 1077, 6560, 284, 3393, 11065, 3036, 24911, 341, 310, 6560, 25, 3393, 11065, 341, 394, 829, 25, 23105, 2271, 675, 445, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_dynamic_convert() { let j0 = json! { [{"name": "tomcat"}, {"name": "jetty"}] }; let d0 = to_dynamic(&j0).unwrap(); assert_eq!("array", d0.type_name()); let j1 = json!({ "name": "tomcat", "value": 4000, }); let d1 = to_dynamic(&j1).unwrap(); assert_eq!("map", d1.type_name()); }
rust_cleaned_test_functions.jsonl/111681
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 228 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 45992, 34910, 368, 341, 286, 1077, 502, 15, 284, 2951, 0, 341, 310, 61753, 606, 788, 330, 37401, 4616, 14345, 5212, 606, 788, 330, 15407, 1881, 9207, 921, 286, 3634, 286, 1077, 294, 15, 284, 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_packet_discard() { solana_logger::setup(); let mut batch = PacketBatch::default(); batch.packets.resize(10, Packet::default()); batch.packets[3].meta.addr = std::net::IpAddr::from([1u16; 8]); batch.packets[3].meta.set_discard(true); batch.packets[4].meta.addr = std::net::IpAddr::from([2u16; 8]); let mut batches = vec![batch]; let max = 3; SigVerifyStage::discard_excess_packets(&mut batches, max); assert_eq!(count_non_discard(&batches), max); assert!(!batches[0].packets[0].meta.discard()); assert!(batches[0].packets[3].meta.discard()); assert!(!batches[0].packets[4].meta.discard()); }
rust_cleaned_test_functions.jsonl/17097
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 342 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21078, 37745, 567, 368, 341, 286, 2048, 3362, 27413, 486, 15188, 543, 286, 1077, 5206, 7162, 284, 28889, 21074, 486, 2258, 543, 286, 7162, 556, 18382, 17382, 7, 16, 15, 11, 28889, 486, 2258, 142...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_lohit() { run_test( &TEST_DATA, "harfbuzz/good-lohit.or", "oriya/lohit_or.ttf", &[JOINER_GLYPH_INDEX], 24, ); }
rust_cleaned_test_functions.jsonl/91163
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 216 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5560, 22492, 368, 341, 394, 1598, 4452, 1006, 503, 609, 10033, 7896, 345, 503, 330, 12982, 10798, 8889, 4846, 1386, 26480, 22492, 24282, 756, 503, 330, 13601, 7755, 14, 385, 22492, 8734, 45192, 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
#[test] fn test_banking_stage_shutdown1() { let genesis_block = create_genesis_block(2).genesis_block; let bank = Arc::new(Bank::new(&genesis_block)); let (verified_sender, verified_receiver) = channel(); let (vote_sender, vote_receiver) = channel(); let ledger_path = get_tmp_ledger_path!(); { let blocktree = Arc::new( Blocktree::open(&ledger_path).expect("Expected to be able to open database ledger"), ); let (exit, poh_recorder, poh_service, _entry_receiever) = create_test_recorder(&bank, &blocktree); let cluster_info = ClusterInfo::new_with_invalid_keypair(Node::new_localhost().info); let cluster_info = Arc::new(RwLock::new(cluster_info)); let banking_stage = BankingStage::new( &cluster_info, &poh_recorder, verified_receiver, vote_receiver, ); drop(verified_sender); drop(vote_sender); exit.store(true, Ordering::Relaxed); banking_stage.join().unwrap(); poh_service.join().unwrap(); } Blocktree::destroy(&ledger_path).unwrap(); }
rust_cleaned_test_functions.jsonl/53027
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 622 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 880, 32334, 35238, 54804, 16, 368, 341, 286, 1077, 59366, 7113, 284, 1855, 16322, 13774, 7113, 7, 17, 568, 77894, 7113, 280, 286, 1077, 6073, 284, 19689, 486, 931, 5349, 1180, 486, 931, 2099, 77...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_to_log_level() { assert_eq!(Some(LogLevel::Error), LogLevelFilter::Error.to_log_level()); assert_eq!(None, LogLevelFilter::Off.to_log_level()); assert_eq!(Some(LogLevel::Debug), LogLevelFilter::Debug.to_log_level()); }
rust_cleaned_test_functions.jsonl/73935
{ "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, 2346, 5224, 8274, 368, 341, 260, 2060, 10714, 10297, 8373, 94931, 486, 1454, 701, 63321, 5632, 486, 1454, 2389, 5224, 8274, 1423, 260, 2060, 10714, 10297, 4064, 11, 63321, 5632, 486, 4596, 2389, 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
#[test] fn test_median_robust_on_infinities() { let data3 = [2.0, f64::NEG_INFINITY, f64::INFINITY]; let data3 = Data::new(data3); assert_eq!(data3.median(), 2.0); assert_eq!(data3.median(), 2.0); let data3 = [f64::NEG_INFINITY, 2.0, f64::INFINITY]; let data3 = Data::new(data3); assert_eq!(data3.median(), 2.0); assert_eq!(data3.median(), 2.0); let data3 = [f64::NEG_INFINITY, f64::INFINITY, 2.0]; let data3 = Data::new(data3); assert_eq!(data3.median(), 2.0); assert_eq!(data3.median(), 2.0); let data4 = [f64::NEG_INFINITY, 2.0, 3.0, f64::INFINITY]; let data4 = Data::new(data4); assert_eq!(data4.median(), 2.5); assert_eq!(data4.median(), 2.5); }
rust_cleaned_test_functions.jsonl/81934
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 432 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 83003, 62, 22740, 590, 4470, 1243, 5472, 1361, 368, 341, 286, 1077, 821, 18, 284, 508, 17, 13, 15, 11, 282, 21, 19, 486, 97127, 91110, 11, 282, 21, 19, 486, 687, 55990, 935, 286, 1077, 821, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_missing_option() { let err = OptParseError::missing_option("--abc"); let thing = format!("{}", err); let expect = "Missing option: --abc"; assert_eq!(thing, expect); }
rust_cleaned_test_functions.jsonl/8271
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 101 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 40447, 9672, 368, 341, 286, 1077, 1848, 284, 16554, 14463, 1454, 486, 30616, 9672, 21549, 13683, 797, 286, 1077, 3166, 284, 3561, 79878, 1848, 317, 286, 1077, 1720, 284, 330, 25080, 2999, 25, 1177...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_log_replication() { let l = default_logger(); let mut tests = vec![ ( Network::new(vec![None, None, None], &l), vec![new_message(1, 1, MessageType::MsgPropose, 1)], 2, ), ( Network::new(vec![None, None, None], &l), vec![ new_message(1, 1, MessageType::MsgPropose, 1), new_message(1, 2, MessageType::MsgHup, 0), new_message(1, 2, MessageType::MsgPropose, 1), ], 4, ), ]; for (i, &mut (ref mut network, ref msgs, wcommitted)) in tests.iter_mut().enumerate() { network.send(vec![new_message(1, 1, MessageType::MsgHup, 0)]); for m in msgs { network.send(vec![m.clone()]); } for (j, x) in &mut network.peers { if x.raft_log.committed != wcommitted { panic!( "#{}.{}: committed = {}, want {}", i, j, x.raft_log.committed, wcommitted ); } let mut ents = next_ents(x, &network.storage[j]); let ents: Vec<Entry> = ents.drain(..).filter(|e| !e.data.is_empty()).collect(); for (k, m) in msgs .iter() .filter(|m| m.get_msg_type() == MessageType::MsgPropose) .enumerate() { if ents[k].data != m.entries[0].data { panic!( "#{}.{}: data = {:?}, want {:?}", i, j, ents[k].data, m.entries[0].data ); } } } } }
rust_cleaned_test_functions.jsonl/19093
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1001 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5224, 25533, 1693, 368, 341, 262, 1077, 326, 284, 1638, 27413, 543, 262, 1077, 5206, 7032, 284, 7486, 90515, 286, 2399, 310, 8141, 486, 931, 25592, 20703, 4064, 11, 2240, 11, 2240, 1125, 609, 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...
7
#[test] fn test_property_sheet_with_array_by_declaring_property_multiple_times() { let sheet = generate_property_sheet( "foo.css", " a { b: 'foo'; b: 'bar'; b: 'baz'; c: f(g()); c: h(); } ", ) .unwrap(); let p = query_simple(&sheet, vec!["a"]); assert_eq!( p["b"], array(vec![string("foo"), string("bar"), string("baz"),]) ); assert_eq!( p["c"], array(vec![ object(&[ ("name", string("f")), ( "args", array(vec![object(&[ ("name", string("g")), ("args", array(vec![])), ])]) ) ]), object(&[("name", string("h")), ("args", array(vec![])),]), ]), ); }
rust_cleaned_test_functions.jsonl/45088
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 736 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 16638, 43112, 6615, 3858, 3710, 35814, 3249, 16638, 45233, 22353, 368, 341, 286, 1077, 10834, 284, 6923, 16638, 43112, 1006, 310, 330, 7975, 4327, 756, 310, 6228, 394, 264, 341, 1698, 293, 25, 364...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_encode_then_decode_v1() { assert_eq!( encode_then_decode( Protocol::Status, Version::V1, RPCCodedResponse::Success(RPCResponse::Status(status_message())) ), Ok(Some(RPCResponse::Status(status_message()))) ); assert_eq!( encode_then_decode( Protocol::Ping, Version::V1, RPCCodedResponse::Success(RPCResponse::Pong(ping_message())) ), Ok(Some(RPCResponse::Pong(ping_message()))) ); assert_eq!( encode_then_decode( Protocol::BlocksByRange, Version::V1, RPCCodedResponse::Success(RPCResponse::BlocksByRange(Box::new(base_block()))) ), Ok(Some(RPCResponse::BlocksByRange(Box::new(base_block())))) ); assert!( matches!( encode_then_decode( Protocol::BlocksByRange, Version::V1, RPCCodedResponse::Success(RPCResponse::BlocksByRange(Box::new(altair_block()))), ) .unwrap_err(), RPCError::SSZDecodeError(_) ), "altair block cannot be decoded with blocks by range V1 version" ); assert_eq!( encode_then_decode( Protocol::BlocksByRoot, Version::V1, RPCCodedResponse::Success(RPCResponse::BlocksByRoot(Box::new(base_block()))) ), Ok(Some(RPCResponse::BlocksByRoot(Box::new(base_block())))) ); assert!( matches!( encode_then_decode( Protocol::BlocksByRoot, Version::V1, RPCCodedResponse::Success(RPCResponse::BlocksByRoot(Box::new(altair_block()))), ) .unwrap_err(), RPCError::SSZDecodeError(_) ), "altair block cannot be decoded with blocks by range V1 version" ); assert_eq!( encode_then_decode( Protocol::MetaData, Version::V1, RPCCodedResponse::Success(RPCResponse::MetaData(metadata())), ), Ok(Some(RPCResponse::MetaData(metadata()))), ); assert_eq!( encode_then_decode( Protocol::MetaData, Version::V1, RPCCodedResponse::Success(RPCResponse::MetaData(metadata())), ), Ok(Some(RPCResponse::MetaData(metadata()))), ); // A MetaDataV2 still encodes as a MetaDataV1 since version is Version::V1 assert_eq!( encode_then_decode( Protocol::MetaData, Version::V1, RPCCodedResponse::Success(RPCResponse::MetaData(metadata_v2())), ), Ok(Some(RPCResponse::MetaData(metadata()))), ); }
rust_cleaned_test_functions.jsonl/57905
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1712 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11224, 68367, 15227, 2273, 16, 368, 341, 286, 2060, 10714, 33673, 310, 16164, 68367, 15227, 1006, 394, 24572, 486, 2522, 345, 394, 6079, 486, 53, 16, 345, 394, 41461, 3706, 6737, 2582, 486, 7188, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_array_out_of_range_negative() { let c: Result<Color, _> = [-10, -256, -1].try_into(); assert_eq!(c, Err(IntoColorError::IntConversion)); }
rust_cleaned_test_functions.jsonl/757
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 87 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3858, 6068, 3575, 9698, 53865, 368, 341, 286, 1077, 272, 25, 5714, 88827, 11, 716, 29, 284, 10055, 16, 15, 11, 481, 17, 20, 21, 11, 481, 16, 936, 1539, 45514, 543, 286, 2060, 10714, 10297, 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
#[test] fn test_notify_limits() { let chanmon_cfgs = create_chanmon_cfgs(3); let node_cfgs = create_node_cfgs(3, &chanmon_cfgs); let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[None, None, None]); let nodes = create_network(3, &node_cfgs, &node_chanmgrs); let mut chan = create_announced_chan_between_nodes(&nodes, 0, 1, InitFeatures::known(), InitFeatures::known()); // to connect messages with new values chan.0.contents.fee_base_msat *= 2; chan.1.contents.fee_base_msat *= 2; let node_a_chan_info = nodes[0].node.list_channels()[0].clone(); let node_b_chan_info = nodes[1].node.list_channels()[0].clone(); assert!(nodes[0].node.await_persistable_update_timeout(Duration::from_millis(1))); assert!(nodes[1].node.await_persistable_update_timeout(Duration::from_millis(1))); assert!(!nodes[2].node.await_persistable_update_timeout(Duration::from_millis(1))); // After persisting the first two nodes they should no longer need fresh persistence. assert!(!nodes[0].node.await_persistable_update_timeout(Duration::from_millis(1))); assert!(!nodes[1].node.await_persistable_update_timeout(Duration::from_millis(1))); // about the channel. nodes[2].node.handle_channel_update(&nodes[1].node.get_our_node_id(), &chan.0); nodes[2].node.handle_channel_update(&nodes[1].node.get_our_node_id(), &chan.1); assert!(!nodes[2].node.await_persistable_update_timeout(Duration::from_millis(1))); // The nodes which are a party to the channel should also ignore messages from unrelated // parties. nodes[0].node.handle_channel_update(&nodes[2].node.get_our_node_id(), &chan.0); nodes[0].node.handle_channel_update(&nodes[2].node.get_our_node_id(), &chan.1); nodes[1].node.handle_channel_update(&nodes[2].node.get_our_node_id(), &chan.0); nodes[1].node.handle_channel_update(&nodes[2].node.get_our_node_id(), &chan.1); assert!(!nodes[0].node.await_persistable_update_timeout(Duration::from_millis(1))); assert!(!nodes[1].node.await_persistable_update_timeout(Duration::from_millis(1))); // At this point the channel info given by peers should still be the same. assert_eq!(nodes[0].node.list_channels()[0], node_a_chan_info); assert_eq!(nodes[1].node.list_channels()[0], node_b_chan_info); }
rust_cleaned_test_functions.jsonl/79989
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 918 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 36654, 31820, 368, 341, 18363, 197, 10217, 26023, 1645, 18343, 82, 284, 1855, 45552, 1645, 18343, 82, 7, 18, 317, 197, 10217, 2436, 18343, 82, 284, 1855, 5084, 18343, 82, 7, 18, 11, 609, 5658, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_remote_crate() -> Result<(), Error> { combined_keys_gen!(sender_combined_key, receiver_combined_key); let shared_key = SharedKey::generate(); mod other_crate { // Neither Serde nor the other crate provides Serialize and Deserialize // impls for this struct. #[derive(PartialEq, Debug)] pub struct Duration { pub secs: i64, pub nanos: i32, } } use other_crate::Duration; // Serde calls this the definition of the remote type. It is just a copy of the // remote data structure. The `remote` attribute gives the path to the actual // type we intend to derive code for. #[derive(PartialEq, Debug, Serialize, Deserialize)] #[serde(remote = "Duration")] struct DurationDef { secs: i64, nanos: i32, } // Now the remote type can be used almost like it had its own Serialize and // Deserialize impls all along. The `with` attribute gives the path to the // definition for the remote type. Note that the real type of the field is the #[derive(PartialEq, Debug, Serialize, Deserialize)] struct Process { command_line: String, #[serde(with = "DurationDef")] wall_time: Duration, } impl SerdeEncryptPublicKey for Process { type S = BincodeSerializer<Self>; } impl SerdeEncryptSharedKey for Process { type S = BincodeSerializer<Self>; } let msg = Process { command_line: "sl".into(), wall_time: Duration { secs: 33, nanos: 4 }, }; public_key_enc_dec_assert_eq(&msg, &sender_combined_key, &receiver_combined_key)?; shared_key_enc_dec_assert_eq(&msg, &shared_key)?; Ok(()) }
rust_cleaned_test_functions.jsonl/31591
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 708 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 36425, 666, 7698, 368, 1464, 5714, 68843, 4600, 29, 341, 262, 10856, 12631, 16322, 10297, 11644, 89945, 3097, 11, 13964, 89945, 3097, 317, 262, 1077, 6094, 3097, 284, 16990, 1592, 486, 19366, 1428, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
#[test] fn test_eval_derivative_ood() { let quad = BoundedQuadratic::new(0., 3., 1., 1., 1.); assert!(!quad.eval_derivative(-1.).is_finite()); }
rust_cleaned_test_functions.jsonl/19881
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 85 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21296, 95930, 62, 1386, 368, 341, 286, 1077, 27082, 284, 425, 13082, 2183, 88678, 486, 931, 7, 15, 2572, 220, 18, 2572, 220, 16, 2572, 220, 16, 2572, 220, 16, 58957, 286, 2060, 0, 3471, 31610,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_write_file() { let dir = tempfile::Builder::new() .prefix("test_write_file") .tempdir() .unwrap(); let fs = SyncPoxisFileSystem {}; let mut f = fs .open_writable_file_writer(dir.path().join("sst")) .unwrap(); let r = Runtime::new().unwrap(); r.block_on(async move { f.append("abcd".as_bytes()).await.unwrap(); f.append("efgh".as_bytes()).await.unwrap(); f.append("ijkl".as_bytes()).await.unwrap(); f.sync().await.unwrap(); }); let mut f = fs.open_sequencial_file(dir.path().join("sst")).unwrap(); r.block_on(async move { let mut v = vec![0; 7]; let x = f.read(&mut v).await.unwrap(); assert_eq!(x, 7); let s = String::from_utf8(v.clone()).unwrap(); assert_eq!(s.as_str(), "abcdefg"); let x = f.read(&mut v).await.unwrap(); assert_eq!(x, 5); let s = String::from_utf8((&v[..5]).to_vec()).unwrap(); assert_eq!(s.as_str(), "hijkl"); }); }
rust_cleaned_test_functions.jsonl/86499
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 636 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9165, 2458, 368, 341, 286, 1077, 5419, 284, 54819, 486, 3297, 486, 931, 741, 310, 659, 11849, 445, 1944, 9165, 2458, 1138, 310, 659, 3888, 3741, 741, 310, 659, 15454, 543, 286, 1077, 8619, 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_month_name() { let cases = vec![ (None, None, None), ( Some("0000-00-00 00:00:00"), Some(ERR_TRUNCATE_WRONG_VALUE), None, ), ( Some("2018-01-00 01:01:01"), Some(ERR_TRUNCATE_WRONG_VALUE), None, ), ( Some("2018-00-00 01:01:01"), Some(ERR_TRUNCATE_WRONG_VALUE), None, ), ( Some("2018-00-01 01:01:01"), Some(ERR_TRUNCATE_WRONG_VALUE), None, ), (Some("2018-01-01 01:01:01"), None, Some("January")), (Some("2018-02-01 01:01:01"), None, Some("February")), (Some("2018-03-01 01:01:01"), None, Some("March")), (Some("2018-04-01 01:01:01"), None, Some("April")), (Some("2018-05-01 01:01:01"), None, Some("May")), (Some("2018-06-01 01:01:01"), None, Some("June")), (Some("2018-07-01 01:01:01"), None, Some("July")), (Some("2018-08-01 01:01:01"), None, Some("August")), (Some("2018-09-01 01:01:01"), None, Some("September")), (Some("2018-10-01 01:01:01"), None, Some("October")), (Some("2018-11-01 01:01:01"), None, Some("November")), (Some("2018-12-01 01:01:01"), None, Some("December")), ]; for (time, err_code, expect) in cases { let mut ctx = EvalContext::default(); let time = time.map(|time: &str| Time::parse_date(&mut ctx, time).unwrap()); let (output, ctx) = RpnFnScalarEvaluator::new() .push_param(time) .context(ctx) .evaluate_raw(FieldTypeTp::String, ScalarFuncSig::MonthName); let output = output.unwrap(); assert_eq!(output.as_bytes(), expect.map(|v| v.as_bytes())); if let Some(err_code) = err_code { assert_eq!(ctx.warnings.warnings[0].get_code(), err_code); } } }
rust_cleaned_test_functions.jsonl/36251
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1220 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 18933, 1269, 368, 341, 286, 1077, 5048, 284, 7486, 90515, 310, 320, 4064, 11, 2240, 11, 2240, 1326, 310, 2399, 394, 4329, 445, 15, 15, 15, 15, 12, 15, 15, 12, 15, 15, 220, 15, 15, 25, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_install_backup_short_no_args_file_to_dir() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; let file = "test_install_simple_backup_file_a"; let dest_dir = "test_install_dest/"; let expect = format!("{}{}", dest_dir, file); at.touch(file); at.mkdir(dest_dir); at.touch(&expect); scene .ucmd() .arg("-b") .arg(file) .arg(dest_dir) .succeeds() .no_stderr(); assert!(at.file_exists(file)); assert!(at.file_exists(&expect)); assert!(at.file_exists(&format!("{}~", expect))); }
rust_cleaned_test_functions.jsonl/47043
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 302 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 34245, 44710, 16673, 6536, 8384, 2458, 2346, 4334, 368, 341, 262, 1077, 6109, 284, 3393, 54031, 486, 931, 67811, 1269, 0, 1423, 262, 1077, 518, 284, 609, 22483, 67785, 18513, 401, 262, 1077, 1034,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_schema_id_midstate() { let midstate = tagged_hash::Midstate::with(b"rgb:schema"); assert_eq!(midstate.into_inner(), MIDSTATE_SHEMA_ID); }
rust_cleaned_test_functions.jsonl/193
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 85 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 25371, 842, 43733, 2454, 368, 341, 286, 1077, 5099, 2454, 284, 37113, 8950, 486, 33648, 2454, 486, 4197, 1883, 1, 16509, 14495, 3416, 797, 286, 2060, 10714, 10297, 16106, 2454, 39860, 34345, 1507, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_consume_message() { let tests = vec![ MessageTestCase { input: "From: \"Joe Blogs\" <joe@example.org>\r\n\r\nBody", headers: vec![ ("From", "\"Joe Blogs\" <joe@example.org>"), ], body: "Body", }, // Support parsing messages with \n instead of \r\n MessageTestCase { input: "From: \"Joe Blogs\" <joe@example.org>\n\nBody", headers: vec![ ("From", "\"Joe Blogs\" <joe@example.org>"), ], body: "Body", }, MessageTestCase { input: "From: \"Joe Blogs\" <joe@example.org>\r\n\r\nMultiline\r\nBody", headers: vec![ ("From", "\"Joe Blogs\" <joe@example.org>"), ], body: "Multiline\r\nBody", }, MessageTestCase { input: "From: \"Joe Blogs\" <joe@example.org>\r\nTo: \"John Doe\" <john@example.org>\r\n\r\nMultiple headers", headers: vec![ ("From", "\"Joe Blogs\" <joe@example.org>"), ("To", "\"John Doe\" <john@example.org>"), ], body: "Multiple headers", }, MessageTestCase { input: "Folded-Header: Some content that is \r\n\t wrapped with a tab.\r\n\r\nFolding whitespace test", headers: vec![ ("Folded-Header", "Some content that is wrapped with a tab."), ], body: "Folding whitespace test", }, MessageTestCase { input: "Folded-Header: Some content that is \r\n wrapped with spaces.\r\n\r\nFolding whitespace test", headers: vec![ ("Folded-Header", "Some content that is wrapped with spaces."), ], body: "Folding whitespace test", }, ]; for test in tests.iter() { let mut p = Rfc5322Parser::new(test.input); let message = p.consume_message(); match message { Some((headers, body)) => { assert_eq!(body, test.body.to_string()); for &(header_title, header_value) in test.headers.iter() { let matching_headers = headers.find(&header_title.to_string()).unwrap(); assert!( matching_headers .iter() .filter(|h| { let val: String = h.get_value().unwrap(); val == header_value.to_string() }) .count() > 0 ); } } None => panic!("Failed to parse message"), }; } }
rust_cleaned_test_functions.jsonl/69098
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1845 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3382, 31323, 6462, 368, 341, 286, 1077, 7032, 284, 7486, 90515, 310, 4856, 16458, 341, 394, 1946, 25, 330, 3830, 25, 7245, 40344, 75236, 2105, 366, 73, 4644, 35487, 2659, 8449, 81, 1699, 12016, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_get_platform_properties_missing_element() { let root = Element::from_reader(ONLY_ROOT_NODE.as_bytes()).unwrap(); assert!(Unreal4ContextPlatformProperties::from_xml(&root).is_none()); }
rust_cleaned_test_functions.jsonl/28092
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 82 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 34260, 25158, 40447, 7894, 368, 341, 262, 1077, 3704, 284, 8543, 486, 1499, 22306, 7, 31092, 16197, 19218, 5357, 12524, 6011, 15454, 543, 262, 2060, 10297, 1806, 7951, 19, 1972, 17296, 7903, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_pp_types_empty() { let string = "[ [ ] ( ) #{ } { }, \"\" ]"; let data = parse::value(string).unwrap().without_spans(); assert_eq!(data.to_pretty(40).unwrap(), "[[] () #{} {} \"\"]"); }
rust_cleaned_test_functions.jsonl/97798
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 111 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 31600, 9763, 15124, 368, 341, 286, 1077, 914, 284, 10545, 508, 2279, 320, 873, 11273, 335, 314, 2470, 7245, 2105, 2279, 876, 286, 1077, 821, 284, 4715, 486, 957, 3609, 568, 15454, 1005, 28996, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_set_freezer_state() { let tmp = create_temp_dir("test_set_freezer_state").expect("create temp directory for test"); set_fixture(&tmp, CGROUP_FREEZER_STATE, "").expect("Set fixure for freezer state"); // set Frozen state. { let freezer_state = FreezerState::Frozen; Freezer::apply(freezer_state, &tmp).expect("Set freezer state"); let state_content = std::fs::read_to_string(tmp.join(CGROUP_FREEZER_STATE)).expect("Read to string"); assert_eq!(FREEZER_STATE_FROZEN, state_content); } // set Thawed state. { let freezer_state = FreezerState::Thawed; Freezer::apply(freezer_state, &tmp).expect("Set freezer state"); let state_content = std::fs::read_to_string(tmp.join(CGROUP_FREEZER_STATE)).expect("Read to string"); assert_eq!(FREEZER_STATE_THAWED, state_content); } // set Undefined state. { let old_state_content = std::fs::read_to_string(tmp.join(CGROUP_FREEZER_STATE)).expect("Read to string"); let freezer_state = FreezerState::Undefined; Freezer::apply(freezer_state, &tmp).expect("Set freezer state"); let state_content = std::fs::read_to_string(tmp.join(CGROUP_FREEZER_STATE)).expect("Read to string"); assert_eq!(old_state_content, state_content); } }
rust_cleaned_test_functions.jsonl/55983
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 717 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2602, 8905, 7070, 4387, 368, 341, 286, 1077, 4174, 4035, 310, 1855, 11771, 4334, 445, 1944, 2602, 8905, 7070, 4387, 1827, 17119, 445, 3182, 2730, 6220, 369, 1273, 797, 286, 738, 74409, 2099, 5173,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_syn_sent_syn_ack() { let mut s = socket_syn_sent(); recv!(s, [TcpRepr { control: TcpControl::Syn, seq_number: LOCAL_SEQ, ack_number: None, max_seg_size: Some(BASE_MSS), ..RECV_TEMPL }]); send!(s, TcpRepr { control: TcpControl::Syn, seq_number: REMOTE_SEQ, ack_number: Some(LOCAL_SEQ + 1), max_seg_size: Some(BASE_MSS - 80), ..SEND_TEMPL }); recv!(s, [TcpRepr { seq_number: LOCAL_SEQ + 1, ack_number: Some(REMOTE_SEQ + 1), ..RECV_TEMPL }]); recv!(s, time 1000, Err(Error::Exhausted)); assert_eq!(s.state, State::Established); sanity!(s, socket_established()); }
rust_cleaned_test_functions.jsonl/1715
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 497 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 51393, 24115, 51393, 48447, 368, 341, 286, 1077, 5206, 274, 284, 7575, 51393, 24115, 543, 286, 27006, 10297, 82, 11, 508, 77536, 693, 649, 341, 310, 2524, 25, 262, 64876, 3273, 486, 37134, 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_parse_normal3_parameter() { let params = match parse_normal3_parameter(FileSpan::new(Rc::new(String::from("\"normal3 test\" [20.5 10 0]")), Rc::new(String::from("input")))).unwrap().1 { Parameter::Normal3(i) => i, _ => panic!() }; assert_eq!(params.values.len(), 1); assert_eq!((params.values[0].0.value, params.values[0].1.value, params.values[0].2.value), (20.5, 10.0, 0.0)); let params = match parse_normal3_parameter(FileSpan::new(Rc::new(String::from("\"normal test\" [20.5 10 0]")), Rc::new(String::from("input")))).unwrap().1 { Parameter::Normal3(i) => i, _ => panic!() }; assert_eq!(params.values.len(), 1); assert_eq!((params.values[0].0.value, params.values[0].1.value, params.values[0].2.value), (20.5, 10.0, 0.0)); }
rust_cleaned_test_functions.jsonl/68364
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 362 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 13973, 18, 24899, 368, 341, 262, 1077, 3628, 284, 2432, 4715, 13973, 18, 24899, 19821, 12485, 486, 931, 2785, 66, 486, 931, 2242, 486, 1499, 38915, 8252, 18, 1273, 2105, 508, 17, 15, 13, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_vector_6() { let address = "DdzFFzCqrhsfi5fFjJUHYPSnfTYrnMohzh3PrrtrVQgwua33HWPKUdTJXo3o77pSGCmDNrjYaAiZmJddaPW9iHyUDatvU2WhX7MgnNMy".parse().unwrap(); let public_key = XPub::from_bytes([ 0x2a, 0x6a, 0xd1, 0x51, 0x09, 0x96, 0xff, 0x2d, 0x10, 0x89, 0xcb, 0x8e, 0xd5, 0xf5, 0xc0, 0x61, 0xf6, 0xad, 0x0a, 0xfb, 0xb5, 0x3d, 0x95, 0x40, 0xa0, 0xfc, 0x89, 0xef, 0xc0, 0xa2, 0x63, 0xb9, 0x6d, 0xac, 0x00, 0xbd, 0x0d, 0x7b, 0xda, 0x7d, 0x16, 0x3a, 0x08, 0xdb, 0x20, 0xba, 0x64, 0xb6, 0x33, 0x4d, 0xca, 0x34, 0xea, 0xc8, 0x2c, 0xf7, 0xb4, 0x91, 0xc3, 0x5f, 0x5c, 0xae, 0xc7, 0xb0, ]); assert_same_address(address, public_key) }
rust_cleaned_test_functions.jsonl/1898
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 501 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 12247, 62, 21, 368, 341, 286, 1077, 2621, 284, 330, 35, 37877, 1748, 89, 34, 23004, 4997, 9983, 20, 69, 37, 73, 41, 52, 48852, 5012, 31737, 22098, 35622, 82605, 23815, 18, 47, 634, 376, 53, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_a2dp_version_check() { let p1: ProfileDescriptor = ProfileDescriptor { profile_id: ServiceClassProfileIdentifier::AdvancedAudioDistribution, major_version: 1, minor_version: 3, }; let res = a2dp_version_check(p1); assert_eq!(true, res); let p1: ProfileDescriptor = ProfileDescriptor { profile_id: ServiceClassProfileIdentifier::AdvancedAudioDistribution, major_version: 2, minor_version: 10, }; let res = a2dp_version_check(p1); assert_eq!(true, res); let p1: ProfileDescriptor = ProfileDescriptor { profile_id: ServiceClassProfileIdentifier::AdvancedAudioDistribution, major_version: 1, minor_version: 0, }; let res = a2dp_version_check(p1); assert_eq!(false, res); let p1: ProfileDescriptor = ProfileDescriptor { profile_id: ServiceClassProfileIdentifier::AdvancedAudioDistribution, major_version: 0, minor_version: 9, }; let res = a2dp_version_check(p1); assert_eq!(false, res); let p1: ProfileDescriptor = ProfileDescriptor { profile_id: ServiceClassProfileIdentifier::AdvancedAudioDistribution, major_version: 2, minor_version: 2, }; let res = a2dp_version_check(p1); assert_eq!(true, res); }
rust_cleaned_test_functions.jsonl/125261
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 693 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4306, 17, 9796, 9438, 7200, 368, 341, 286, 1077, 281, 16, 25, 12329, 11709, 284, 12329, 11709, 341, 310, 5526, 842, 25, 5362, 1957, 8526, 8714, 486, 35457, 14755, 62377, 345, 310, 3598, 9438, 25...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_errors(){ init!("false"); assert_eq!(get_sequence_num(145661).err(), Some(SchemaError::CommonError(error::INVALID_OBJ_HANDLE.code_num))); assert_eq!(to_string(13435178).err(), Some(SchemaError::CommonError(error::INVALID_OBJ_HANDLE.code_num))); let test: Result<LedgerSchema, SchemaError> = LedgerSchema::new_from_ledger(SCHEMA_ID); assert_eq!(from_string("{}").err(), Some(SchemaError::CommonError(INVALID_JSON.code_num))); }
rust_cleaned_test_functions.jsonl/29697
{ "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, 20196, 3032, 286, 2930, 17223, 3849, 797, 286, 2060, 10714, 10297, 455, 23735, 4273, 7, 16, 19, 20, 21, 21, 16, 568, 615, 1507, 4329, 3759, 3416, 1454, 486, 10839, 1454, 6390, 486, 46859, 27559,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_delta_with_no_committables() { let (genesis_block, mint_keypair) = GenesisBlock::new(8000); let bank = Bank::new(&genesis_block); bank.is_delta.store(false, Ordering::Relaxed); let keypair1 = Keypair::new(); let keypair2 = Keypair::new(); let fail_tx = system_transaction::create_user_account( &keypair1, &keypair2.pubkey(), 1, bank.last_blockhash(), 0, ); // the account which this tx operated on will not be committed. Thus // the bank is_delta should still be false assert_eq!( bank.process_transaction(&fail_tx), Err(TransactionError::AccountNotFound) ); // Check the bank is_delta is still false assert!(!bank.is_delta.load(Ordering::Relaxed)); // so is_delta should be true assert_eq!( bank.transfer(10_001, &mint_keypair, &Pubkey::new_rand()), Err(TransactionError::InstructionError( 0, InstructionError::new_result_with_negative_lamports(), )) ); assert!(bank.is_delta.load(Ordering::Relaxed)); }
rust_cleaned_test_functions.jsonl/41914
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 615 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6892, 26710, 6615, 6536, 2965, 23692, 4788, 368, 341, 286, 1077, 320, 77894, 7113, 11, 28337, 3097, 12670, 8, 284, 40788, 4713, 486, 931, 7, 23, 15, 15, 15, 317, 286, 1077, 6073, 284, 8547, 48...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_add_f32_f64() { binary_cast_test( DataType::Float32, DataType::Float64, "CAST(#0 AS Float64) Plus #1", ); binary_cast_test( DataType::Float64, DataType::Float32, "#0 Plus CAST(#1 AS Float64)", ); }
rust_cleaned_test_functions.jsonl/16558
{ "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, 2891, 761, 18, 17, 761, 21, 19, 368, 341, 286, 7868, 5303, 4452, 1006, 310, 33172, 486, 5442, 18, 17, 345, 310, 33172, 486, 5442, 21, 19, 345, 310, 330, 34163, 32735, 15, 5752, 13001, 21, 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_wrap_nopad_invalid_key_length() { let pt = hex!("000102030405060708090a0b0c0d0e0f").to_vec(); let key = hex!("000102030405060708090a0b0c0d0e").to_vec(); let ct = aes_wrap_with_nopadding(&pt, &key); assert!(ct.is_err(), "Invalid key length erroneously passed"); }
rust_cleaned_test_functions.jsonl/15904
{ "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, 38550, 1089, 453, 329, 31433, 3097, 5118, 368, 341, 286, 1077, 10817, 284, 12371, 17223, 15, 15, 15, 16, 15, 17, 15, 18, 15, 19, 15, 20, 15, 21, 15, 22, 15, 23, 15, 24, 15, 64, 15, 65, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_rsa() { let rng = botan::RandomNumberGenerator::new_system().unwrap(); let padding = "EMSA-PKCS1-v1_5(SHA-256)"; let msg = rng.read(32).unwrap(); let privkey = botan::Privkey::create("RSA", "1024", &rng).unwrap(); let pubkey = privkey.pubkey().unwrap(); assert_eq!(privkey.get_field("e"), botan::MPI::from_str("65537")); assert_eq!(privkey.get_field("n").unwrap().bit_count().unwrap(), 1024); assert_eq!(pubkey.get_field("n"), privkey.get_field("n")); let p = privkey.get_field("p").unwrap(); let q = privkey.get_field("q").unwrap(); assert_eq!(&p * &q, privkey.get_field("n").unwrap()); let signer = botan::Signer::new(&privkey, padding).unwrap(); signer.update(&msg).unwrap(); let signature = signer.finish(&rng).unwrap(); let verifier = botan::Verifier::new(&pubkey, padding).unwrap(); verifier.update(&msg).unwrap(); assert_eq!(verifier.finish(&signature).unwrap(), true); let pubkey = botan::Pubkey::load_rsa(&privkey.get_field("n").unwrap(), &privkey.get_field("e").unwrap()).unwrap(); let verifier = botan::Verifier::new(&pubkey, padding).unwrap(); verifier.update(&msg).unwrap(); assert_eq!(verifier.finish(&signature).unwrap(), true); }
rust_cleaned_test_functions.jsonl/95304
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 513 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 82522, 368, 341, 262, 1077, 28422, 284, 10924, 276, 486, 13999, 2833, 12561, 486, 931, 17687, 1005, 15454, 1428, 262, 1077, 5300, 284, 330, 2716, 7778, 9299, 42, 6412, 16, 8273, 16, 62, 20, 3759...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_resolve_module_referrer_dot() { let (_temp_dir, deno_dir) = test_setup(); let specifier = "tests/001_hello.js"; let cwd = std::env::current_dir().unwrap(); let expected_path = cwd.join(specifier); let expected_module_name = deno_fs::normalize_path(&expected_path); let expected_filename = expected_module_name.clone(); let (module_name, filename) = deno_dir.resolve_module(specifier, ".").unwrap(); assert_eq!(module_name, expected_module_name); assert_eq!(filename, expected_filename); let (module_name, filename) = deno_dir.resolve_module(specifier, "./").unwrap(); assert_eq!(module_name, expected_module_name); assert_eq!(filename, expected_filename); }
rust_cleaned_test_functions.jsonl/72759
{ "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, 77291, 10750, 7793, 30929, 30941, 368, 341, 262, 1077, 5453, 3888, 4334, 11, 3371, 78, 4334, 8, 284, 1273, 21363, 1428, 262, 1077, 97616, 284, 330, 23841, 14, 15, 15, 16, 96724, 2857, 3302, 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_zero_terminated_negative_lines() { new_ucmd!() .args(&["-z", "-n", "-1"]) .pipe_in("x\0y\0z\0") .run() .stdout_is("x\0y\0"); }
rust_cleaned_test_functions.jsonl/32768
{ "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, 19359, 62, 68659, 53865, 18323, 368, 341, 262, 501, 68887, 2277, 0, 741, 286, 659, 2116, 2099, 1183, 12, 89, 497, 6523, 77, 497, 6523, 16, 14108, 286, 659, 13768, 1243, 445, 87, 59, 15, 88, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_propagation_complex() { let writer = WriterId::new(1u8); let model = &mut Model::new(); let a = model.new_bvar("a"); let b = model.new_bvar("b"); let c = model.new_bvar("c"); let d = model.new_bvar("d"); let check_values = |model: &Model, values: [Option<bool>; 4]| { assert_eq!(model.boolean_value_of(a), values[0]); assert_eq!(model.boolean_value_of(b), values[1]); assert_eq!(model.boolean_value_of(c), values[2]); assert_eq!(model.boolean_value_of(d), values[3]); }; check_values(&model, [None, None, None, None]); let mut sat = SatSolver::new(writer); let clause = vec![a.true_lit(), b.true_lit(), c.true_lit(), d.true_lit()]; sat.add_clause(clause); sat.propagate(&mut model.state).unwrap(); check_values(&model, [None, None, None, None]); model.save_state(); model.state.decide(a.false_lit()).unwrap(); check_values(&model, [Some(false), None, None, None]); sat.propagate(&mut model.state).unwrap(); check_values(&model, [Some(false), None, None, None]); model.save_state(); model.state.decide(b.false_lit()).unwrap(); check_values(&model, [Some(false), Some(false), None, None]); sat.propagate(&mut model.state).unwrap(); check_values(&model, [Some(false), Some(false), None, None]); model.save_state(); model.state.decide(c.true_lit()).unwrap(); check_values(&model, [Some(false), Some(false), Some(true), None]); sat.propagate(&mut model.state).unwrap(); check_values(&model, [Some(false), Some(false), Some(true), None]); model.save_state(); model.state.decide(d.false_lit()).unwrap(); check_values(&model, [Some(false), Some(false), Some(true), Some(false)]); sat.propagate(&mut model.state).unwrap(); check_values(&model, [Some(false), Some(false), Some(true), Some(false)]); model.restore_last(); check_values(&model, [Some(false), Some(false), Some(true), None]); sat.propagate(&mut model.state).unwrap(); check_values(&model, [Some(false), Some(false), Some(true), None]); model.restore_last(); check_values(&model, [Some(false), Some(false), None, None]); sat.propagate(&mut model.state).unwrap(); check_values(&model, [Some(false), Some(false), None, None]); model.state.decide(c.false_lit()).unwrap(); check_values(&model, [Some(false), Some(false), Some(false), None]); sat.propagate(&mut model.state).unwrap(); check_values(&model, [Some(false), Some(false), Some(false), Some(true)]); }
rust_cleaned_test_functions.jsonl/55205
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1212 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21663, 27137, 41522, 368, 341, 286, 1077, 6916, 284, 29404, 764, 486, 931, 7, 16, 84, 23, 317, 286, 1077, 1614, 284, 609, 6984, 4903, 486, 931, 543, 286, 1077, 264, 284, 1614, 4618, 880, 947, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_calc_ref_ends() { let transform_wk = arr2( &[[1., 0., 0., -2.], [0., 1., 0., 0.], [0., 0., 1., 7.], [0., 0., 0., 1.]] ); let transform_wr = arr2( &[[1., 0., 0., 6.], [0., 1., 0., 0.], [0., 0., 1., 7.], [0., 0., 0., 1.]] ); let transform_rk = transform_rk(&transform_wk, &transform_wr); assert_eq!( transform_rk, arr2(&[[1., 0., 0., -8.], [0., 1., 0., 0.], [0., 0., 1., 0.], [0., 0., 0., 1.]]) ); let x_key = arr1(&[2., 0.]); let (x_min_ref, x_max_ref) = calc_ref_ends(&transform_rk, &x_key, (2., 3.)); assert_eq!(x_min_ref, arr1(&[-2., 0.])); assert_eq!(x_max_ref, arr1(&[-2./3., 0.])); }
rust_cleaned_test_functions.jsonl/73550
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 575 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 38241, 7793, 90729, 368, 341, 286, 1077, 5165, 1670, 74, 284, 2890, 17, 1006, 310, 609, 15505, 16, 2572, 220, 15, 2572, 220, 15, 2572, 481, 17, 13, 1259, 1060, 508, 15, 2572, 220, 16, 2572, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_snap_corruption_on_size_or_checksum() { let region_id = 1; let region = gen_test_region(region_id, 1, 1); let db_dir = Builder::new() .prefix("test-snap-corruption-db") .tempdir() .unwrap(); let db = open_test_db(&db_dir.path(), None, None).unwrap(); let snapshot = RocksSnapshot::new(db); let dir = Builder::new() .prefix("test-snap-corruption") .tempdir() .unwrap(); let key = SnapKey::new(region_id, 1, 1); let size_track = Arc::new(AtomicU64::new(0)); let deleter = Box::new(DummyDeleter {}); let mut s1 = Snap::new_for_building( dir.path(), &key, Arc::clone(&size_track), deleter.clone(), Limiter::new(INFINITY), ) .unwrap(); assert!(!s1.exists()); let mut snap_data = RaftSnapshotData::default(); snap_data.set_region(region.clone()); let mut stat = SnapshotStatistics::new(); Snapshot::<RocksEngine>::build( &mut s1, &snapshot, &region, &mut snap_data, &mut stat, deleter.clone(), ) .unwrap(); assert!(s1.exists()); corrupt_snapshot_size_in(dir.path()); assert!( Snap::new_for_sending(dir.path(), &key, Arc::clone(&size_track), deleter.clone()) .is_err() ); let mut s2 = Snap::new_for_building( dir.path(), &key, Arc::clone(&size_track), deleter.clone(), Limiter::new(INFINITY), ) .unwrap(); assert!(!s2.exists()); Snapshot::<RocksEngine>::build( &mut s2, &snapshot, &region, &mut snap_data, &mut stat, deleter.clone(), ) .unwrap(); assert!(s2.exists()); let dst_dir = Builder::new() .prefix("test-snap-corruption-dst") .tempdir() .unwrap(); copy_snapshot( &dir, &dst_dir, &key, Arc::clone(&size_track), snap_data.get_meta().clone(), deleter.clone(), ); let mut metas = corrupt_snapshot_checksum_in(dst_dir.path()); assert_eq!(1, metas.len()); let snap_meta = metas.pop().unwrap(); let mut s5 = Snap::new_for_applying( dst_dir.path(), &key, Arc::clone(&size_track), deleter.clone(), ) .unwrap(); assert!(s5.exists()); let dst_db_dir = Builder::new() .prefix("test-snap-corruption-dst-db") .tempdir() .unwrap(); let dst_db = open_test_empty_db(&dst_db_dir.path(), None, None).unwrap(); let options = ApplyOptions { db: dst_db.c().clone(), region, abort: Arc::new(AtomicUsize::new(JOB_STATUS_RUNNING)), write_batch_size: TEST_WRITE_BATCH_SIZE, coprocessor_host: CoprocessorHost::default(), }; assert!(s5.apply(options).is_err()); corrupt_snapshot_size_in(dst_dir.path()); assert!(Snap::new_for_receiving( dst_dir.path(), &key, snap_meta, Arc::clone(&size_track), deleter.clone(), Limiter::new(INFINITY), ) .is_err()); assert!( Snap::new_for_applying(dst_dir.path(), &key, Arc::clone(&size_track), deleter).is_err() ); }
rust_cleaned_test_functions.jsonl/41921
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2036 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 74175, 14734, 14123, 4470, 2368, 8734, 64038, 368, 341, 286, 1077, 5537, 842, 284, 220, 16, 280, 286, 1077, 5537, 284, 4081, 4452, 20627, 48059, 842, 11, 220, 16, 11, 220, 16, 317, 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_ubx_packet_recv_dyn_len() { let src_code = quote! { #[ubx_packet_recv] #[ubx(class = 1, id = 2, max_payload_len = 38)] struct Test { #[ubx(map_type = &str, get_as_ref, from = unpack_str)] f1: [u8; 8], rest: [u8; 0], } }; let src_code = src_code.to_string(); let code: syn::ItemStruct = syn::parse_str(&src_code).unwrap_or_else(|err| { panic_on_parse_error("test_ubx_packet_recv_dyn_len", &src_code, &err) }); let tokens = generate_code_for_recv_packet(code.ident, code.attrs, code.fields).unwrap_or_else(|err| { panic_on_parse_error("test_ubx_packet_recv_dyn_len", &src_code, &err) }); run_compare_test( tokens, quote! { #[doc = ""] pub struct Test; impl UbxPacketMeta for Test { const CLASS: u8 = 1u8; const ID: u8 = 2u8; const FIXED_PAYLOAD_LEN: Option<u16> = None; const MAX_PAYLOAD_LEN: u16 = 38u16; } #[doc = ""] #[doc = "Contains a reference to an underlying buffer, contains accessor methods to retrieve data."] pub struct TestRef<'a>(&'a [u8]); impl<'a> TestRef<'a> { #[doc = ""] #[inline] pub fn f1_raw(&self) -> &[u8] { let val = &self.0[0usize..(0usize + 8usize)]; val } #[doc = ""] #[inline] pub fn f1(&self) -> &str { let val = &self.0[0usize..(0usize + 8usize)]; let val = unpack_str(val); val } #[doc = ""] #[inline] pub fn rest(&self) -> &[u8] { &self.0[8usize..] } fn validate(payload: &[u8]) -> Result<(), ParserError> { let min = 8usize; let got = payload.len(); if got >= min { Ok(()) } else { Err(ParserError::InvalidPacketLen{packet: "Test", expect: min, got}) } } } }, ); }
rust_cleaned_test_functions.jsonl/16493
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1445 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 66794, 87, 21078, 36118, 69213, 6043, 368, 341, 262, 1077, 2286, 4136, 284, 12641, 0, 341, 286, 11506, 392, 87, 21078, 36118, 921, 286, 11506, 392, 87, 21956, 284, 220, 16, 11, 877, 284, 220, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_ts18661_float() { use parser::declaration; assert_eq!( declaration("_Float64 foo = 1.5;", &mut Env::new()), Ok(Declaration { specifiers: vec![TS18661FloatType { format: TS18661FloatFormat::BinaryInterchange, width: 64, } .into()], declarators: vec![InitDeclarator { declarator: Declarator { kind: ident("foo"), derived: vec![], extensions: vec![], } .into(), initializer: Some(float::dec("1.5")), } .into()], } .into()) ); }
rust_cleaned_test_functions.jsonl/107582
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 431 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 25023, 16, 23, 21, 21, 16, 17586, 368, 341, 262, 990, 6729, 486, 80383, 280, 262, 2060, 10714, 33673, 286, 18004, 16975, 5442, 21, 19, 15229, 284, 220, 16, 13, 20, 32503, 609, 6984, 37039, 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_offline_stake_delegation_and_deactivation() { panoptes_logger::setup(); let mint_keypair = Keypair::new(); let mint_pubkey = mint_keypair.pubkey(); let faucet_addr = run_local_faucet(mint_keypair, None); let test_validator = TestValidator::with_no_fees(mint_pubkey, Some(faucet_addr)); let rpc_client = RpcClient::new_with_commitment(test_validator.rpc_url(), CommitmentConfig::processed()); let mut config_validator = CliConfig::recent_for_tests(); config_validator.json_rpc_url = test_validator.rpc_url(); let validator_keypair = Keypair::new(); config_validator.signers = vec![&validator_keypair]; let mut config_payer = CliConfig::recent_for_tests(); config_payer.json_rpc_url = test_validator.rpc_url(); let stake_keypair = keypair_from_seed(&[0u8; 32]).unwrap(); let mut config_offline = CliConfig::recent_for_tests(); config_offline.json_rpc_url = String::default(); config_offline.command = CliCommand::ClusterVersion; let offline_keypair = Keypair::new(); config_offline.signers = vec![&offline_keypair]; // Verify that we cannot reach the cluster process_command(&config_offline).unwrap_err(); request_and_confirm_airdrop( &rpc_client, &config_validator, &config_validator.signers[0].pubkey(), 100_000, ) .unwrap(); check_recent_balance(100_000, &rpc_client, &config_validator.signers[0].pubkey()); request_and_confirm_airdrop( &rpc_client, &config_offline, &config_offline.signers[0].pubkey(), 100_000, ) .unwrap(); check_recent_balance(100_000, &rpc_client, &config_offline.signers[0].pubkey()); // Create stake account config_validator.signers.push(&stake_keypair); config_validator.command = CliCommand::CreateStakeAccount { stake_account: 1, seed: None, staker: Some(config_offline.signers[0].pubkey()), withdrawer: None, lockup: Lockup::default(), amount: SpendAmount::Some(50_000), sign_only: false, dump_transaction_message: false, blockhash_query: BlockhashQuery::All(blockhash_query::Source::Cluster), nonce_account: None, nonce_authority: 0, memo: None, fee_payer: 0, from: 0, }; process_command(&config_validator).unwrap(); // Delegate stake offline let (blockhash, _) = rpc_client.get_recent_blockhash().unwrap(); config_offline.command = CliCommand::DelegateStake { stake_account_pubkey: stake_keypair.pubkey(), vote_account_pubkey: test_validator.vote_account_address(), stake_authority: 0, force: true, sign_only: true, dump_transaction_message: false, blockhash_query: BlockhashQuery::None(blockhash), nonce_account: None, nonce_authority: 0, memo: None, fee_payer: 0, }; config_offline.output_format = OutputFormat::JsonCompact; let sig_response = process_command(&config_offline).unwrap(); let sign_only = parse_sign_only_reply_string(&sig_response); assert!(sign_only.has_all_signers()); let offline_presigner = sign_only .presigner_of(&config_offline.signers[0].pubkey()) .unwrap(); config_payer.signers = vec![&offline_presigner]; config_payer.command = CliCommand::DelegateStake { stake_account_pubkey: stake_keypair.pubkey(), vote_account_pubkey: test_validator.vote_account_address(), stake_authority: 0, force: true, sign_only: false, dump_transaction_message: false, blockhash_query: BlockhashQuery::FeeCalculator(blockhash_query::Source::Cluster, blockhash), nonce_account: None, nonce_authority: 0, memo: None, fee_payer: 0, }; process_command(&config_payer).unwrap(); // Deactivate stake offline let (blockhash, _) = rpc_client.get_recent_blockhash().unwrap(); config_offline.command = CliCommand::DeactivateStake { stake_account_pubkey: stake_keypair.pubkey(), stake_authority: 0, sign_only: true, dump_transaction_message: false, blockhash_query: BlockhashQuery::None(blockhash), nonce_account: None, nonce_authority: 0, memo: None, seed: None, fee_payer: 0, }; let sig_response = process_command(&config_offline).unwrap(); let sign_only = parse_sign_only_reply_string(&sig_response); assert!(sign_only.has_all_signers()); let offline_presigner = sign_only .presigner_of(&config_offline.signers[0].pubkey()) .unwrap(); config_payer.signers = vec![&offline_presigner]; config_payer.command = CliCommand::DeactivateStake { stake_account_pubkey: stake_keypair.pubkey(), stake_authority: 0, sign_only: false, dump_transaction_message: false, blockhash_query: BlockhashQuery::FeeCalculator(blockhash_query::Source::Cluster, blockhash), nonce_account: None, nonce_authority: 0, memo: None, seed: None, fee_payer: 0, }; process_command(&config_payer).unwrap(); }
rust_cleaned_test_functions.jsonl/45362
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2232 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13651, 1056, 1261, 726, 2259, 87566, 8378, 2259, 23002, 368, 341, 262, 7215, 2912, 288, 27413, 486, 15188, 1428, 262, 1077, 28337, 3097, 12670, 284, 6569, 1082, 1310, 486, 931, 543, 262, 1077, 283...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_verify_16() { use randombytes::randombytes_into; for _ in 0usize..256 { let mut x = [0; 16]; let mut y = [0; 16]; assert!(verify_16(&x, &y)); randombytes_into(&mut x); randombytes_into(&mut y); if x == y { assert!(verify_16(&x, &y)) } else { assert!(!verify_16(&x, &y)) } } }
rust_cleaned_test_functions.jsonl/26521
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 279 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 35638, 62, 16, 21, 368, 341, 286, 990, 4194, 9651, 486, 11463, 9651, 45514, 401, 286, 369, 716, 304, 220, 15, 51878, 496, 17, 20, 21, 341, 310, 1077, 5206, 856, 284, 508, 15, 26, 220, 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...
3
#[test] fn test_format_message() { let mut msg = Message::new("measurement"); msg.insert_tag("tag1", "1"); msg.insert_tag("tag2", "2"); msg.insert_metric("field1", "1"); msg.insert_metric("field2", "2"); assert_eq!( Stdout::format_message(&msg), format!( "[{}] [source=\"measurement\" tag1=\"1\" tag2=\"2\"] field1=\"1\" field2=\"2\"", msg.timestamp().to_rfc3339() ) ); }
rust_cleaned_test_functions.jsonl/67351
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 275 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8955, 6462, 368, 341, 286, 1077, 5206, 3750, 284, 4856, 486, 931, 445, 81425, 797, 286, 3750, 7030, 9372, 445, 4578, 16, 497, 330, 16, 797, 286, 3750, 7030, 9372, 445, 4578, 17, 497, 330, 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_scaling_user_fee_by_two() { let provided_fee = BigDecimal::from_str("0.005").unwrap(); let provided_fee_scaled_by_two = BigDecimal::from_str("0.01").unwrap(); let scaled_fee = scale_user_fee_up(provided_fee); assert_eq!(provided_fee_scaled_by_two, scaled_fee); }
rust_cleaned_test_functions.jsonl/19256
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 147 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 79216, 3317, 34305, 3710, 23241, 368, 341, 286, 1077, 3897, 34305, 284, 20618, 486, 1499, 2895, 445, 15, 13, 15, 15, 20, 1827, 15454, 543, 286, 1077, 3897, 34305, 61715, 3710, 23241, 284, 20618, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_lerp() { let tol = 1e-12; let r1 = lerp(0.0, 3.0, 0.5); assert!(approx_eq(r1, 1.5, tol)); let r2 = lerp(0.0, 3.0, 0.0); assert!(approx_eq(r2, 0.0, tol)); let r3 = lerp(8.0, 9.0, 0.5); assert!(approx_eq(r3, 8.5, tol)); let r4 = lerp(8.0, 9.0, 1.0); assert!(approx_eq(r4, 9.0, tol)); }
rust_cleaned_test_functions.jsonl/97676
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 256 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 907, 22632, 368, 341, 286, 1077, 38574, 284, 220, 16, 68, 12, 16, 17, 401, 286, 1077, 435, 16, 284, 326, 22632, 7, 15, 13, 15, 11, 220, 18, 13, 15, 11, 220, 15, 13, 20, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_cpx() { let mut r = Register::new(); let mut b = MockBus::new(); r.set_X(0x40); b.memory[0x80] = 0x50; cpx(0x80, &mut r, &mut b); assert_eq!(r.get_status_negative(), true); assert_eq!(r.get_status_carry(), false) }
rust_cleaned_test_functions.jsonl/14204
{ "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, 666, 1767, 368, 341, 262, 1077, 5206, 435, 284, 8451, 486, 931, 543, 262, 1077, 5206, 293, 284, 14563, 15073, 486, 931, 543, 262, 435, 980, 6859, 7, 15, 87, 19, 15, 317, 262, 293, 36611, 58,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_from_perspective_fov() { let vfov = Degrees(72.0); let aspect = 800 as f32 / 600 as f32; let near = 0.1; let far = 100.0; let expected = Matrix4x4::new( 1.0322863, 0.0, 0.0, 0.0, 0.0, 1.3763818, 0.0, 0.0, 0.0, 0.0, -1.002002, -1.0, 0.0, 0.0, -0.2002002, 0.0 ); let result = Matrix4x4::from_perspective_fov(vfov, aspect, near, far); assert_eq!(result, expected); }
rust_cleaned_test_functions.jsonl/129134
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 358 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5673, 620, 85091, 761, 859, 368, 341, 286, 1077, 348, 85582, 284, 92901, 7, 22, 17, 13, 15, 317, 286, 1077, 12893, 284, 220, 23, 15, 15, 438, 282, 18, 17, 608, 220, 21, 15, 15, 438, 282, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_scroll_up_down() { let t = [ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ]; let texts = gen_texts(&t); let mut pane = gen_pane!(OpenOptions::new().write(true).open("/dev/null").unwrap()); pane.load(texts.clone()); let width: u16 = 2; let height: u16 = 5; pane.replace_termsize_getter(Box::new(TestTerminal::new(width, height))); let pane_height = 4; let _ = pane.set_height(pane_height); // to update numof_semantic_flushed_lines let _ = pane.refresh(); let stride_page = pane_height; let stride_hpage = pane_height / 2; // in range { assert_eq!(pane.position(), (0, 0)); assert_eq!(pane.scroll_down(&ScrollStep::Char(1)).unwrap(), 1); assert_eq!(pane.scroll_down(&ScrollStep::Char(2)).unwrap(), 2); assert_eq!(pane.position(), (0, 3)); assert_eq!(pane.scroll_up(&ScrollStep::Char(1)).unwrap(), 1); assert_eq!(pane.scroll_up(&ScrollStep::Char(2)).unwrap(), 2); assert_eq!(pane.position(), (0, 0)); assert_eq!( pane.scroll_down(&ScrollStep::HalfPage(1)).unwrap(), stride_hpage ); assert_eq!( pane.scroll_down(&ScrollStep::HalfPage(2)).unwrap(), stride_hpage * 2 ); assert_eq!(pane.position(), (0, stride_hpage * 3)); assert_eq!( pane.scroll_up(&ScrollStep::HalfPage(1)).unwrap(), stride_hpage ); assert_eq!( pane.scroll_up(&ScrollStep::HalfPage(2)).unwrap(), stride_hpage * 2 ); assert_eq!(pane.position(), (0, 0)); assert_eq!(pane.scroll_down(&ScrollStep::Page(1)).unwrap(), stride_page); assert_eq!( pane.scroll_down(&ScrollStep::Page(2)).unwrap(), stride_page * 2 ); assert_eq!(pane.position(), (0, stride_page * 3)); assert_eq!(pane.scroll_up(&ScrollStep::Page(1)).unwrap(), stride_page); assert_eq!( pane.scroll_up(&ScrollStep::Page(2)).unwrap(), stride_page * 2 ); assert_eq!(pane.position(), (0, 0)); } // out of range { assert_eq!( pane.scroll_down(&ScrollStep::Page(10)).unwrap(), texts.borrow().len() as u16 - pane_height ); assert_eq!( pane.position(), (0, texts.borrow().len() as u16 - pane_height) ); assert_eq!( pane.scroll_up(&ScrollStep::Page(10)).unwrap(), texts.borrow().len() as u16 - pane_height ); assert_eq!(pane.position(), (0, 0)); } }
rust_cleaned_test_functions.jsonl/1678
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1621 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 41407, 8237, 13998, 368, 341, 286, 1077, 259, 284, 2278, 310, 7342, 7342, 7342, 7342, 7342, 7342, 7342, 7342, 7342, 7342, 7342, 7342, 7342, 7342, 7342, 7342, 7342, 7342, 7342, 8324, 286, 9747, 286...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_load_app() { block_on(async { let app_set = AppSet::new(vec![App::builder( "{00000000-0000-0000-0000-000000000001}", [1, 2, 3, 4], ) .build()]); let mut storage = MemStorage::new(); let persisted_app = PersistedApp { cohort: Cohort { id: Some("cohort_id".to_string()), hint: Some("test_channel".to_string()), name: None, }, user_counting: UserCounting::ClientRegulatedByDate(Some(22222)), }; let json = serde_json::to_string(&persisted_app).unwrap(); let apps = app_set.to_vec().await; storage.set_string(&apps[0].id, &json).await.unwrap(); let _state_machine = StateMachineBuilder::new_stub() .storage(Rc::new(Mutex::new(storage))) .app_set(app_set.clone()) .build() .await; let apps = app_set.to_vec().await; assert_eq!(persisted_app.cohort, apps[0].cohort); assert_eq!(UserCounting::ClientRegulatedByDate(Some(22222)), apps[0].user_counting); }); }
rust_cleaned_test_functions.jsonl/59699
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 697 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 12411, 8191, 368, 341, 286, 2504, 4470, 18285, 341, 310, 1077, 906, 2602, 284, 1845, 1649, 486, 931, 25592, 20703, 2164, 486, 17850, 1006, 394, 13868, 15, 15, 15, 15, 15, 15, 15, 15, 12, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_deserialize_snapshot_data_file_extra_data() { let expected_data = 2323_u32; let expected_consumed_size = size_of::<u32>() as u64; let temp_dir = tempfile::TempDir::new().unwrap(); serialize_snapshot_data_file_capped( &temp_dir.path().join("data-file"), expected_consumed_size * 2, |stream| { serialize_into(stream.by_ref(), &expected_data)?; serialize_into(stream.by_ref(), &expected_data)?; Ok(()) }, ) .unwrap(); let result = deserialize_snapshot_data_file_capped( &temp_dir.path().join("data-file"), expected_consumed_size * 2, |stream| Ok(deserialize_from::<_, u32>(stream)?), ); assert_matches!(result, Err(SnapshotError::Io(ref message)) if message.to_string().starts_with("invalid snapshot data file")); }
rust_cleaned_test_functions.jsonl/53296
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 468 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15768, 9050, 53265, 1769, 2458, 31858, 1769, 368, 341, 286, 1077, 3601, 1769, 284, 220, 17, 18, 17, 18, 7300, 18, 17, 280, 286, 1077, 3601, 69870, 291, 2368, 284, 1379, 3575, 27638, 84, 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...
5
#[test] fn test_long_format_o_default() { assert_eq!( parse_format_flags_str(&vec!["od", "--format=o"]).unwrap(), vec![FORMAT_ITEM_OCT32] ); }
rust_cleaned_test_functions.jsonl/112176
{ "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, 17799, 8955, 14179, 9993, 368, 341, 262, 2060, 10714, 33673, 286, 4715, 8955, 14130, 2895, 2099, 4083, 0, 1183, 347, 497, 14482, 2243, 85876, 45014, 15454, 3148, 286, 7486, 20703, 46559, 16461, 2232...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_no_headers() { let multipart = Multipart::with_body(mock_stream(&[b"--boundary", b"\r\n", b"\r\n", b"--boundary--"]), BOUNDARY); pin_mut!(multipart); ready_assert_ok_eq!(|cx| multipart.as_mut().poll_has_next_field(cx), true); until_ready!(|cx| multipart.as_mut().poll_field_headers(cx)).unwrap_err(); ready_assert_ok_eq!(|cx| multipart.as_mut().poll_has_next_field(cx), false); }
rust_cleaned_test_functions.jsonl/118933
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 219 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6536, 26719, 368, 341, 286, 1077, 68058, 284, 386, 18204, 486, 4197, 14114, 30389, 12673, 2099, 58, 65, 74757, 65180, 497, 293, 11934, 81, 1699, 497, 293, 11934, 81, 1699, 497, 293, 74757, 65180, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_message_build_works() { let basic_message: BasicMessage = BasicMessage::default() .set_content(_content()) .set_time() .set_default_localization(); assert_eq!(_content(), basic_message.content); }
rust_cleaned_test_functions.jsonl/48425
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 126 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 34729, 6462, 20801, 11498, 82, 368, 341, 286, 1077, 6770, 6462, 25, 14625, 2052, 284, 14625, 2052, 486, 2258, 741, 310, 659, 746, 7495, 2490, 1796, 2398, 310, 659, 746, 3009, 741, 310, 659, 746,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_err() { Python::with_gil(|py| { if let Err(err) = PyByteArray::from(py, &py.None()) { assert!(err.is_instance::<exceptions::PyTypeError>(py)); } else { panic!("error"); } }); }
rust_cleaned_test_functions.jsonl/47844
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 168 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5673, 9266, 368, 341, 286, 13027, 486, 4197, 1889, 321, 22428, 3288, 91, 341, 310, 421, 1077, 15495, 3964, 8, 284, 5355, 18394, 486, 1499, 46827, 11, 609, 3288, 18475, 2140, 341, 394, 2060, 1029...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_id_to_str() { use super::metadata::MetadataID::*; assert_eq!(metadata::id_to_str(FNM), "FNM"); assert_eq!(metadata::id_to_str(SNM), "SNM"); assert_eq!(metadata::id_to_str(FSZ), "FSZ"); assert_eq!(metadata::id_to_str(FDT), "FDT"); assert_eq!(metadata::id_to_str(SDT), "SDT"); assert_eq!(metadata::id_to_str(HSH), "HSH"); assert_eq!(metadata::id_to_str(RSD), "RSD"); assert_eq!(metadata::id_to_str(RSP), "RSP"); }
rust_cleaned_test_functions.jsonl/24709
{ "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, 842, 2346, 2895, 368, 341, 262, 990, 2256, 486, 17637, 486, 14610, 915, 79304, 262, 2060, 10714, 10297, 17637, 486, 307, 2346, 2895, 7832, 37325, 701, 330, 37, 37325, 797, 262, 2060, 10714, 10297,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_base64() { let mut reader = Reader::init("base64, T WE=;xxx"); assert_eq!( base64(&mut reader).unwrap(), Base64 { space0: Whitespace { value: String::from(" "), source_info: SourceInfo::init(1, 8, 1, 10), }, value: vec![77, 97], encoded: String::from("T WE="), space1: Whitespace { value: String::from(""), source_info: SourceInfo::init(1, 15, 1, 15), }, } ); assert_eq!(reader.state.cursor, 15); }
rust_cleaned_test_functions.jsonl/119592
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 401 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 7651, 21, 19, 368, 341, 286, 1077, 5206, 6604, 284, 25166, 486, 2327, 445, 3152, 21, 19, 11, 220, 350, 19677, 28, 26, 24048, 797, 286, 2060, 10714, 33673, 310, 2331, 21, 19, 2099, 6984, 6604, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_linear() { assert_eq!(linear(&mut [0, 0], &[0, 0], &[200, 0], 0.25), &[50, 0]); assert_eq!(linear(&mut [0, 0], &[0, 0], &[200, 0], 0.5), &[100, 0]); assert_eq!(linear(&mut [0, 0], &[0, 0], &[200, 0], 0.75), &[150, 0]); }
rust_cleaned_test_functions.jsonl/67711
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 136 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 40674, 368, 341, 262, 2060, 10714, 10297, 22763, 2099, 6984, 508, 15, 11, 220, 15, 1125, 44590, 15, 11, 220, 15, 1125, 44590, 17, 15, 15, 11, 220, 15, 1125, 220, 15, 13, 17, 20, 701, 44590, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_emit_movl_memq_reg() { assert_emit!(0x8b, 0x44, 0x24, 1; emit_movl_memq_reg(RSP, 1, RAX)); assert_emit!(0x8b, 0x04, 0x24; emit_movl_memq_reg(RSP, 0, RAX)); assert_emit!(0x44, 0x8b, 0x45, 0; emit_movl_memq_reg(RBP, 0, R8)); assert_emit!(0x8b, 0x05, 0, 0, 0, 0; emit_movl_memq_reg(RIP, 0, RAX)); assert_emit!(0x8b, 0x0d, 0, 0, 0, 0; emit_movl_memq_reg(RIP, 0, RCX)); }
rust_cleaned_test_functions.jsonl/85436
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 273 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 69082, 55798, 75, 12976, 80, 4920, 368, 341, 286, 2060, 69082, 10297, 15, 87, 23, 65, 11, 220, 15, 87, 19, 19, 11, 220, 15, 87, 17, 19, 11, 220, 16, 26, 16691, 55798, 75, 12976, 80, 4920, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_with_csv_plan() -> Result<()> { let testdata = arrow_testdata_path(); let path = format!("{}/csv/aggregate_test_100.csv", testdata); let options = CsvReadOptions::new().schema_infer_max_records(100); let logical_plan = LogicalPlanBuilder::scan_csv(&path, options, None)? .filter(col("c7").lt(col("c12")))? .build()?; let plan = plan(&logical_plan)?; let expected = "predicate: BinaryExpr { left: CastExpr { expr: Column { name: \"c7\" }, cast_type: Float64 }, op: Lt, right: Column { name: \"c12\" } }"; assert!(format!("{:?}", plan).contains(expected)); Ok(()) }
rust_cleaned_test_functions.jsonl/15408
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 310 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6615, 14020, 26564, 368, 1464, 5714, 71698, 341, 286, 1077, 1273, 691, 284, 17921, 4452, 691, 2638, 543, 286, 1077, 1815, 284, 3561, 88928, 4472, 18104, 14, 59606, 4452, 62, 16, 15, 15, 11219, 4...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
#[test] fn test_gcs_credential_provider() { const EXPIRE_TIME: &str = "3000-01-01T00:00:00.0Z"; let addr = ([127, 0, 0, 1], 3000).into(); let make_service = || { hyper::service::service_fn_ok(|_| { let token = serde_json::json!({ "accessToken": "1234567890", "expireTime": EXPIRE_TIME, }); hyper::Response::new(hyper::Body::from(token.to_string())) }) }; let server = hyper::Server::bind(&addr).serve(make_service); let credential_provider = GCSCredentialProvider::new( RWMode::ReadWrite, ServiceAccountInfo::URL("http://127.0.0.1:3000/".to_string()), ); let client = Client::new(); let cred_fut = credential_provider .credentials(&client) .map(move |credential| { assert_eq!(credential.token, "1234567890"); assert_eq!( credential.expiration_time.timestamp(), EXPIRE_TIME .parse::<chrono::DateTime<chrono::offset::Utc>>() .unwrap() .timestamp(), ); }) .map_err(move |err| panic!(err.to_string())); server.with_graceful_shutdown(cred_fut); }
rust_cleaned_test_functions.jsonl/77536
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 643 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1889, 4837, 666, 30320, 29518, 368, 341, 262, 733, 4063, 1893, 787, 10051, 25, 609, 495, 284, 330, 18, 15, 15, 15, 12, 15, 16, 12, 15, 16, 51, 15, 15, 25, 15, 15, 25, 15, 15, 13, 15, 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...
2
#[test] fn test_array_auto_size() { compare_stderr_output( r#" package main func main() { x := [...]int{2, 3, 4, 5} println(x) println(len(x)) var y [4][4]int = [...][4]int{ [4]int{1, 2, 3, 4}, [4]int{1, 2, 5, 7}, x, x, } println(y) println(len(y)) } "#, r#"<[4]int>[2 3 4 5] 4 <[4][4]int>[<[4]int>[1 2 3 4] <[4]int>[1 2 5 7] <[4]int>[2 3 4 5] <[4]int>[2 3 4 5]] 4 "#, ) }
rust_cleaned_test_functions.jsonl/32006
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 286 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3858, 27740, 2368, 368, 341, 262, 9429, 93033, 7645, 1006, 286, 435, 2, 698, 1722, 1887, 271, 2830, 1887, 368, 341, 262, 856, 1669, 48179, 396, 90, 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_error() { let mut client = RetryDnsHandle::new( TestClient { last_succeed: false, retries: 1, attempts: Arc::new(AtomicU16::new(0)), }, 2, ); let test1 = Message::new(); assert!(block_on(client.send(test1).first_answer()).is_err()); }
rust_cleaned_test_functions.jsonl/90301
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 216 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4096, 368, 341, 286, 1077, 5206, 2943, 284, 78870, 35, 4412, 6999, 486, 931, 1006, 310, 3393, 2959, 341, 394, 1537, 643, 29264, 25, 895, 345, 394, 60601, 25, 220, 16, 345, 394, 13553, 25, 1968...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_outline_lvl() { let props = ParagraphProperty::new(); let bytes = props.outline_lvl(1).build(); assert_eq!( str::from_utf8(&bytes).unwrap(), r#"<w:pPr><w:rPr /><w:outlineLvl w:val="1" /></w:pPr>"# ) }
rust_cleaned_test_functions.jsonl/67556
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 157 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 72980, 67975, 368, 341, 286, 1077, 6914, 284, 49351, 3052, 486, 931, 543, 286, 1077, 5820, 284, 6914, 2532, 1056, 67975, 7, 16, 568, 5834, 543, 286, 2060, 10714, 33673, 310, 607, 486, 1499, 3945...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_random_normal_initializer() { let mut context = Scope::new(); let init = random_normal_initializer(&mut context, 0.0_f32, 1.0, None, [2, 2].as_ref()).unwrap(); let var = context .get_variable_with_initializer(init, true, "") .unwrap(); let results = test_suite!(run_op: [var]; context, input: {}); test_suite!(results; assert_len: {[0;Float] == 4}); }
rust_cleaned_test_functions.jsonl/96396
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 182 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 22644, 13973, 36462, 368, 341, 262, 1077, 5206, 2266, 284, 34920, 486, 931, 1428, 262, 1077, 2930, 4035, 286, 4194, 13973, 36462, 2099, 6984, 2266, 11, 220, 15, 13, 15, 761, 18, 17, 11, 220, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_add_repo_to_configuration() { let toml_str = r#" clone_path = "/path" repositories = [ {org = "crvshlab", name="repo1"}, {org = "crvshlab", name="repo2"}, {org = "crvshlab", regex="node-*"}, ] "#; let reader = || read_bytes(toml_str.as_bytes()); let config = &mut Configuration::read_from(reader).expect(""); let repos = config.repositories_mut(); repos.add(Repository::new( Org("test".to_string()), Some(Name("foo".to_string())), None, )); assert_eq!(4, repos.0.len()); }
rust_cleaned_test_functions.jsonl/76834
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 371 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2891, 37784, 2346, 35726, 368, 341, 286, 1077, 311, 1014, 2895, 284, 435, 2, 698, 310, 14715, 2638, 284, 3521, 2343, 698, 310, 49657, 284, 2278, 1060, 314, 1775, 284, 330, 5082, 85, 927, 14380, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_bitv_set_intersect_with() { // Explicitly 0'ed bits let mut a = BitvSet::from_bitv(Bitv::from_bytes(&[0b10100010])); let mut b = BitvSet::from_bitv(Bitv::from_bytes(&[0b00000000])); let c = a.clone(); a.intersect_with(&b); b.intersect_with(&c); assert!(a.is_empty()); assert!(b.is_empty()); // Uninitialized bits should behave like 0's let mut a = BitvSet::from_bitv(Bitv::from_bytes(&[0b10100010])); let mut b = BitvSet::new(); let c = a.clone(); a.intersect_with(&b); b.intersect_with(&c); assert!(a.is_empty()); assert!(b.is_empty()); // Standard let mut a = BitvSet::from_bitv(Bitv::from_bytes(&[0b10100010])); let mut b = BitvSet::from_bitv(Bitv::from_bytes(&[0b01100010])); let c = a.clone(); a.intersect_with(&b); b.intersect_with(&c); assert_eq!(a.len(), 2); assert_eq!(b.len(), 2); }
rust_cleaned_test_functions.jsonl/119314
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 521 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13996, 85, 2602, 72747, 6615, 368, 341, 286, 442, 31330, 398, 220, 15, 6, 291, 9472, 198, 286, 1077, 5206, 264, 284, 6495, 85, 1649, 486, 1499, 13996, 85, 68653, 85, 486, 1499, 12524, 2099, 58...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_wrong_argument_arity() -> oso::Result<()> { common::setup(); let mut oso = OsoTest::new(); #[derive(PolarClass)] struct Foo; impl Foo { fn a(&self, x: i64) -> i64 { x } } let foo_class = Foo::get_polar_class_builder() .add_method("a", Foo::a) .build(); oso.oso.register_class(foo_class)?; oso.load_str( r#"getmethod_a1(x, val) if val = x.a(val); getmethod_a2(x, val, val2) if val = x.a(val, val2); getmethod_a0(x) if x.a();"#, ); // Correct number of arguments let mut query = oso.oso.query_rule("getmethod_a1", (Foo, 1))?; assert_eq!(query.next().unwrap().unwrap().keys().count(), 0); // Too many arguments let mut query = oso.oso.query_rule("getmethod_a2", (Foo, 1, 2))?; assert!(query.next().unwrap().is_err()); // Too few arguments let mut query = oso.oso.query_rule("getmethod_a0", (Foo,))?; assert!(query.next().unwrap().is_err()); Ok(()) }
rust_cleaned_test_functions.jsonl/5010
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 494 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 75198, 9025, 62, 10748, 368, 1464, 297, 704, 486, 2077, 71698, 341, 262, 4185, 486, 15188, 1428, 262, 1077, 5206, 297, 704, 284, 506, 704, 2271, 486, 931, 1428, 262, 11506, 27098, 5304, 7417, 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_get_sys_proxies_parsing() { // Stop other threads from modifying process-global ENV while we are. let _lock = ENVLOCK.lock(); // save system setting first. let _g1 = env_guard("HTTP_PROXY"); let _g2 = env_guard("http_proxy"); // to avoid assert! -> panic! -> Mutex Poisoned. let baseline_proxies = get_sys_proxies(None); // the system proxy setting url is invalid. env::set_var("http_proxy", "123465"); let invalid_proxies = get_sys_proxies(None); // set valid proxy env::set_var("http_proxy", "http://127.0.0.1/"); let valid_proxies = get_sys_proxies(None); // reset user setting when guards drop drop(_g1); drop(_g2); // Let other threads run now drop(_lock); assert_eq!(baseline_proxies.contains_key("http"), false); assert_eq!(invalid_proxies.contains_key("http"), false); let p = &valid_proxies["http"]; assert_eq!(p.scheme(), "http"); assert_eq!(p.host(), "127.0.0.1"); }
rust_cleaned_test_functions.jsonl/66498
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 511 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 20344, 2540, 80934, 620, 28598, 368, 341, 286, 442, 14215, 1008, 14564, 504, 46041, 1882, 73319, 32791, 1393, 582, 525, 624, 286, 1077, 716, 1023, 284, 32791, 8044, 21003, 543, 286, 442, 358...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_to_string() { let cases = vec![(vec!["a", "b", "c"], 1, "a"), (vec!["a", "b", "c"], 3, "c")]; for (data, value, expect) in cases { let mut buf = BufferVec::new(); for v in data { buf.push(v) } let e = Enum { data: Arc::new(buf), value, }; assert_eq!(e.to_string(), expect.to_string()) } }
rust_cleaned_test_functions.jsonl/28818
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 277 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2346, 3904, 368, 341, 286, 1077, 5048, 284, 7486, 0, 9697, 4083, 0, 1183, 64, 497, 330, 65, 497, 330, 66, 7914, 220, 16, 11, 330, 64, 3975, 320, 4083, 0, 1183, 64, 497, 330, 65, 497, 330, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_new() { let vanilla_column_create = ColumnCopyCommand::new("Test".to_string(), "element".to_string(), "NewTest".to_string(), "new_element".to_string()); let expected = ColumnCopyCommand { command: ColumnCopy, from_table: "Test".to_string(), from_name: "element".to_string(), to_table: "NewTest".to_string(), to_name: "new_element".to_string(), arguments: HashMap::new(), }; assert_eq!(expected, vanilla_column_create); }
rust_cleaned_test_functions.jsonl/51234
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 426 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5921, 368, 341, 286, 1077, 32065, 8744, 8657, 284, 9332, 12106, 4062, 486, 931, 445, 2271, 3263, 983, 3904, 3148, 32678, 330, 6101, 3263, 983, 3904, 3148, 32678, 330, 3564, 2271, 3263, 983, 3904, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_0393_example_2() { let data = vec![235, 140, 4]; let result = false; assert_eq!(Solution::valid_utf8(data), result); }
rust_cleaned_test_functions.jsonl/52269
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 84 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 62, 15, 18, 24, 18, 39304, 62, 17, 368, 341, 286, 1077, 821, 284, 7486, 20703, 17, 18, 20, 11, 220, 16, 19, 15, 11, 220, 19, 935, 286, 1077, 1102, 284, 895, 401, 286, 2060, 10714, 10297, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_aggregate_commitment_validity() { let ancestors = vec![3, 4, 5, 7, 9, 10, 11]; let GenesisConfigInfo { mut genesis_config, .. } = create_genesis_config(10_000); let rooted_stake_amount = 40; let sk1 = solana_sdk::pubkey::new_rand(); let pk1 = solana_sdk::pubkey::new_rand(); let mut vote_account1 = vote_state::create_account(&pk1, &solana_sdk::pubkey::new_rand(), 0, 100); let stake_account1 = stake_state::create_account(&sk1, &pk1, &vote_account1, &genesis_config.rent, 100); let sk2 = solana_sdk::pubkey::new_rand(); let pk2 = solana_sdk::pubkey::new_rand(); let mut vote_account2 = vote_state::create_account(&pk2, &solana_sdk::pubkey::new_rand(), 0, 50); let stake_account2 = stake_state::create_account(&sk2, &pk2, &vote_account2, &genesis_config.rent, 50); let sk3 = solana_sdk::pubkey::new_rand(); let pk3 = solana_sdk::pubkey::new_rand(); let mut vote_account3 = vote_state::create_account(&pk3, &solana_sdk::pubkey::new_rand(), 0, 1); let stake_account3 = stake_state::create_account( &sk3, &pk3, &vote_account3, &genesis_config.rent, rooted_stake_amount, ); let sk4 = solana_sdk::pubkey::new_rand(); let pk4 = solana_sdk::pubkey::new_rand(); let mut vote_account4 = vote_state::create_account(&pk4, &solana_sdk::pubkey::new_rand(), 0, 1); let stake_account4 = stake_state::create_account( &sk4, &pk4, &vote_account4, &genesis_config.rent, rooted_stake_amount, ); genesis_config.accounts.extend( vec![ (pk1, vote_account1.clone()), (sk1, stake_account1), (pk2, vote_account2.clone()), (sk2, stake_account2), (pk3, vote_account3.clone()), (sk3, stake_account3), (pk4, vote_account4.clone()), (sk4, stake_account4), ] .into_iter() .map(|(key, account)| (key, Account::from(account))), ); // Create bank let bank = Arc::new(Bank::new(&genesis_config)); let mut vote_state1 = VoteState::from(&vote_account1).unwrap(); vote_state1.process_slot_vote_unchecked(3); vote_state1.process_slot_vote_unchecked(5); let versioned = VoteStateVersions::new_current(vote_state1); VoteState::to(&versioned, &mut vote_account1).unwrap(); bank.store_account(&pk1, &vote_account1); let mut vote_state2 = VoteState::from(&vote_account2).unwrap(); vote_state2.process_slot_vote_unchecked(9); vote_state2.process_slot_vote_unchecked(10); let versioned = VoteStateVersions::new_current(vote_state2); VoteState::to(&versioned, &mut vote_account2).unwrap(); bank.store_account(&pk2, &vote_account2); let mut vote_state3 = VoteState::from(&vote_account3).unwrap(); vote_state3.root_slot = Some(1); let versioned = VoteStateVersions::new_current(vote_state3); VoteState::to(&versioned, &mut vote_account3).unwrap(); bank.store_account(&pk3, &vote_account3); let mut vote_state4 = VoteState::from(&vote_account4).unwrap(); vote_state4.root_slot = Some(2); let versioned = VoteStateVersions::new_current(vote_state4); VoteState::to(&versioned, &mut vote_account4).unwrap(); bank.store_account(&pk4, &vote_account4); let (commitment, rooted_stake) = AggregateCommitmentService::aggregate_commitment(&ancestors, &bank); for a in ancestors { if a <= 3 { let mut expected = BlockCommitment::default(); expected.increase_confirmation_stake(2, 150); assert_eq!(*commitment.get(&a).unwrap(), expected); } else if a <= 5 { let mut expected = BlockCommitment::default(); expected.increase_confirmation_stake(1, 100); expected.increase_confirmation_stake(2, 50); assert_eq!(*commitment.get(&a).unwrap(), expected); } else if a <= 9 { let mut expected = BlockCommitment::default(); expected.increase_confirmation_stake(2, 50); assert_eq!(*commitment.get(&a).unwrap(), expected); } else if a <= 10 { let mut expected = BlockCommitment::default(); expected.increase_confirmation_stake(1, 50); assert_eq!(*commitment.get(&a).unwrap(), expected); } else { assert!(commitment.get(&a).is_none()); } } assert_eq!(rooted_stake.len(), 2); assert_eq!(get_highest_confirmed_root(rooted_stake, 100), 1) }
rust_cleaned_test_functions.jsonl/9080
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2475 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 20587, 14240, 36346, 478, 8337, 487, 368, 341, 286, 1077, 37518, 284, 7486, 20703, 18, 11, 220, 19, 11, 220, 20, 11, 220, 22, 11, 220, 24, 11, 220, 16, 15, 11, 220, 16, 16, 935, 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...
6
#[test] fn test_genesis_transaction_spend() { let tx = TransactionBuilder::default() .witness(Script::default().into_witness()) .input(CellInput::new(OutPoint::null(), 0)) .outputs(vec![ CellOutput::new( capacity_bytes!(100_000_000), Bytes::default(), Script::default(), None ); 100 ]) .build(); let mut root_hash = tx.hash().to_owned(); let genesis_tx_hash = root_hash.clone(); let dao = genesis_dao_data(&tx).unwrap(); let genesis_block = build_block!( transaction: tx, transaction: create_always_success_tx(), header_builder: header_builder!(difficulty: U256::from(1000u64), dao: dao,), ); let consensus = Consensus::default().set_genesis_block(genesis_block); let (chain_controller, shared, parent) = start_chain(Some(consensus)); let end = 21; let mut mock_store = MockStore::new(&parent, shared.store()); let mut chain = MockChain::new(parent.clone(), shared.consensus()); for i in 1..end { let tx = create_transaction(&root_hash, i as u8); root_hash = tx.hash().to_owned(); // commit txs in block chain.gen_block_with_commit_txs(vec![tx], &mut mock_store, false); } for block in &chain.blocks()[0..10] { assert!(chain_controller .process_block(Arc::new(block.clone()), false) .is_ok()); } assert_eq!( shared .lock_chain_state() .cell(&OutPoint::new_cell(genesis_tx_hash, 0)), CellStatus::Dead ); }
rust_cleaned_test_functions.jsonl/84789
{ "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, 16322, 13774, 28884, 643, 3740, 368, 341, 262, 1077, 9854, 284, 17869, 3297, 486, 2258, 741, 286, 659, 86, 8091, 3759, 1228, 486, 2258, 1005, 18122, 1670, 8091, 2398, 286, 659, 1355, 82530, 2505, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_remove() { let name = Name::from_str("www.example.com.").unwrap(); let record_type = RecordType::A; let mut rr_set = RecordSet::new(&name, record_type, 0); let insert = Record::new() .set_name(name.clone()) .set_ttl(86400) .set_rr_type(record_type) .set_dns_class(DNSClass::IN) .set_rdata(RData::A(Ipv4Addr::new(93, 184, 216, 24))) .clone(); let insert1 = Record::new() .set_name(name.clone()) .set_ttl(86400) .set_rr_type(record_type) .set_dns_class(DNSClass::IN) .set_rdata(RData::A(Ipv4Addr::new(93, 184, 216, 25))) .clone(); assert!(rr_set.insert(insert.clone(), 0)); assert!(rr_set.insert(insert1.clone(), 0)); assert!(rr_set.remove(&insert, 0)); assert!(!rr_set.remove(&insert, 0)); assert!(rr_set.remove(&insert1, 0)); assert!(!rr_set.remove(&insert1, 0)); }
rust_cleaned_test_functions.jsonl/119980
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 553 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 18193, 368, 341, 286, 1077, 829, 284, 3988, 486, 1499, 2895, 445, 2136, 7724, 905, 98401, 15454, 543, 286, 1077, 3255, 1819, 284, 13583, 929, 486, 32, 280, 286, 1077, 5206, 34393, 2602, 284, 135...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_disconnect() { let mut data: &[u8] = &[0b11100000, 0b00000000]; assert_eq!(Ok(Some(Packet::Disconnect)), decode_slice(&mut data)); }
rust_cleaned_test_functions.jsonl/77902
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 72 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 67972, 368, 341, 262, 1077, 5206, 821, 25, 44590, 84, 23, 60, 284, 44590, 15, 65, 16, 16, 16, 15, 15, 15, 15, 15, 11, 220, 15, 65, 15, 15, 15, 15, 15, 15, 15, 15, 935, 262, 2060, 10714...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_iter_debug() { let path = Path::new("/tmp"); let mut iter = path.iter(); let expected = "Iter([\"/\", \"tmp\"])"; let actual = format!("{:?}", iter); assert_eq!(expected, actual); let _ = iter.next().unwrap(); let expected = "Iter([\"tmp\"])"; let actual = format!("{:?}", iter); assert_eq!(expected, actual); let _ = iter.next().unwrap(); let expected = "Iter([])"; let actual = format!("{:?}", iter); assert_eq!(expected, actual); }
rust_cleaned_test_functions.jsonl/19660
{ "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, 11723, 15446, 368, 341, 286, 1077, 1815, 284, 7933, 486, 931, 4283, 5173, 3071, 286, 1077, 5206, 5367, 284, 1815, 19471, 1428, 286, 1077, 3601, 284, 330, 8537, 2561, 2105, 14, 16215, 7245, 5173, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_explicit_round_robin_select() { let system = new_kompact_system(); let receivers: Vec<Arc<Component<ReceiverComponent>>> = (0..GROUP_SIZE) .map(|_i| system.create(ReceiverComponent::default)) .collect(); let group_ref = system .set_routing_policy(RoundRobinRouting::default(), "routing-group", false) .wait_expect(SLEEP_TIME, "Could not register policy"); let receiver_refs: Vec<ActorPath> = receivers .iter() .enumerate() .map(|(i, c)| system.register_by_alias(c, &format!("routing-group/receiver{}", i))) .map(|f| f.wait_expect(SLEEP_TIME, "Could not register component")) .collect(); receivers.iter().for_each(|c| system.start(c)); group_ref.tell(CountMe, &system); std::thread::sleep(SLEEP_TIME); assert_eq!(1, total_count(&receivers)); group_ref.tell(CountMe, &system); let alternative_group_ref: ActorPath = (group_ref.clone().unwrap_named() / '?').into(); alternative_group_ref.tell(CountMe, &system); std::thread::sleep(SLEEP_TIME); assert_eq!(3, total_count(&receivers)); let counts = individual_count(&receivers); assert!(counts.iter().all(|&v| v == 1)); group_ref.tell(CountMe, &system); std::thread::sleep(SLEEP_TIME); assert_eq!(4, total_count(&receivers)); let counts = individual_count(&receivers); // can't really guarantee that the indices match up here assert!(counts.iter().any(|&v| v == 2)); assert_eq!(2, counts.iter().filter(|&&v| v == 1).count()); for _i in 0..NUM_MESSAGES { group_ref.tell(CountMe, &system); } std::thread::sleep(SLEEP_TIME); assert_eq!(NUM_MESSAGES + 4, total_count(&receivers)); drop(receiver_refs); system.shutdown().expect("shutdown"); }
rust_cleaned_test_functions.jsonl/32532
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 904 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14214, 6026, 29896, 26608, 6863, 13051, 368, 341, 286, 1077, 1849, 284, 501, 4698, 14435, 531, 17687, 1428, 286, 1077, 39906, 25, 11312, 30192, 1287, 96689, 27, 25436, 2189, 20154, 284, 320, 15, 4...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_dispatch_no_zero_copy_buf() { let (mut runtime, dispatch_count) = setup(Mode::AsyncZeroCopy(false)); runtime .execute_script( "filename.js", r#" Deno.core.opAsync("op_test"); "#, ) .unwrap(); assert_eq!(dispatch_count.load(Ordering::Relaxed), 1); }
rust_cleaned_test_functions.jsonl/23450
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 165 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 42991, 6536, 19359, 16096, 10363, 368, 341, 262, 1077, 320, 6984, 15592, 11, 6845, 3180, 8, 284, 6505, 3189, 534, 486, 6525, 17999, 12106, 3576, 1106, 262, 15592, 198, 414, 659, 10257, 14660, 1006...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_zero_counts_stats() { let values = vec![1.0, 2.0]; let counts = vec![0, 0]; assert!(stats(&values, &counts).is_none()); }
rust_cleaned_test_functions.jsonl/60629
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 90 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 19359, 25977, 15381, 368, 341, 286, 1077, 2750, 284, 7486, 20703, 16, 13, 15, 11, 220, 17, 13, 15, 935, 286, 1077, 14579, 284, 7486, 20703, 15, 11, 220, 15, 935, 286, 2060, 10297, 16260, 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
#[test] fn test_codec_datetime() -> Result<()> { let cases = vec![ ("2010-10-10 10:11:11", 0), ("2017-01-01 00:00:00", 0), ("2004-01-01 00:00:00", UNSPECIFIED_FSP), ("2013-01-01 00:00:00.000000", MAX_FSP), ("2019-01-01 00:00:00.123456", MAX_FSP), ("2001-01-01 00:00:00.123456", MAX_FSP), ("2007-06-01 00:00:00.999999", MAX_FSP), // Invalid cases ("0000-00-00 00:00:00", 0), ("2007-00-01 00:00:00.999999", MAX_FSP), ("2017-01-00 00:00:00.999999", MAX_FSP), ("2027-00-00 00:00:00.999999", MAX_FSP), ("2027-04-31 00:00:00.999999", MAX_FSP), ]; for (case, fsp) in cases { let mut ctx = EvalContext::from(TimeEnv { allow_invalid_date: true, ..TimeEnv::default() }); let time = Time::parse_datetime(&mut ctx, case, fsp, false)?; let packed = time.to_packed_u64(&mut ctx)?; let reverted_datetime = Time::from_packed_u64(&mut ctx, packed, TimeType::DateTime, fsp)?; assert_eq!(time, reverted_datetime); } Ok(()) }
rust_cleaned_test_functions.jsonl/40464
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 706 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 51084, 28943, 368, 1464, 5714, 71698, 341, 286, 1077, 5048, 284, 7486, 90515, 310, 3489, 17, 15, 16, 15, 12, 16, 15, 12, 16, 15, 220, 16, 15, 25, 16, 16, 25, 16, 16, 497, 220, 15, 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...
7
#[test] fn test_parse_cie_incomplete_id_32() { let kind = debug_frame_be(); let section = Section::with_endian(kind.endian()) // The length is not large enough to contain the ID. .B32(3) .B32(0xffff_ffff); assert_parse_cie( kind, section, 8, Err(Error::UnexpectedEof(ReaderOffsetId(4))), ); }
rust_cleaned_test_functions.jsonl/9296
{ "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, 21039, 666, 645, 1243, 14737, 842, 62, 18, 17, 368, 341, 286, 1077, 3093, 284, 7390, 8929, 21263, 543, 286, 1077, 3772, 284, 11113, 486, 4197, 87193, 62697, 5073, 1103, 2398, 310, 442, 576, 3084...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_cint_vector() { let hdr = indoc! {" #include <vector> #include <cstdint> inline std::vector<int32_t> give_vec() { return std::vector<int32_t> {1,2}; } "}; let rs = quote! { assert_eq!(ffi::give_vec().as_ref().unwrap().as_slice(), &[1,2]); }; run_test("", hdr, rs, &["give_vec"], &[]); }
rust_cleaned_test_functions.jsonl/9915
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 202 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 666, 396, 12247, 368, 341, 262, 1077, 36615, 284, 1257, 509, 0, 314, 698, 286, 671, 997, 366, 3215, 397, 286, 671, 997, 366, 96975, 397, 286, 7381, 1460, 486, 3215, 4159, 18, 17, 528, 29, 29...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1