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_static_index() { let client = Client::tracked(rocket()).expect("valid rocket"); assert_all(&client, "index", REGULAR_FILES, true); assert_all(&client, "index", HIDDEN_FILES, false); assert_all(&client, "index", INDEXED_DIRECTORIES, true); assert_all(&client, "default", REGULAR_FILES, true); assert_all(&client, "default", HIDDEN_FILES, false); assert_all(&client, "default", INDEXED_DIRECTORIES, true); }
rust_cleaned_test_functions.jsonl/18550
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 207 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 25360, 3560, 368, 341, 286, 1077, 2943, 284, 8423, 486, 58381, 7, 46790, 6011, 17119, 445, 1891, 24306, 797, 286, 2060, 5705, 2099, 2972, 11, 330, 1252, 497, 13676, 7081, 48010, 11, 830, 317, 28...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_prefix_free() { let x = BTreeSet::from([1, 2, 3]); let y = BTreeSet::<i32>::new(); assert_ne!(hash(&(&x, &y)), hash(&(&y, &x))); }
rust_cleaned_test_functions.jsonl/106959
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 99 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13974, 8905, 368, 341, 262, 1077, 856, 284, 425, 6533, 1649, 486, 1499, 2561, 16, 11, 220, 17, 11, 220, 18, 2558, 262, 1077, 379, 284, 425, 6533, 1649, 27638, 72, 18, 17, 6831, 931, 1428, 41...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_simple() { let mut res = scan(" data 42-12=30", "data {d}-{d}={d}"); assert_eq!(res.next().unwrap(), "42"); assert_eq!(res.next().unwrap(), "12"); assert_eq!(res.next().unwrap(), "30"); assert_eq!(res.next(), None); }
rust_cleaned_test_functions.jsonl/50240
{ "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, 30015, 368, 341, 262, 1077, 5206, 592, 284, 8569, 445, 821, 220, 19, 17, 12, 16, 17, 28, 18, 15, 497, 330, 691, 314, 67, 72013, 67, 92, 1165, 67, 20305, 262, 2060, 10714, 10297, 416, 4529, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_peer_connected_successfully() { let mut pdb = get_db(); let random_peer = PeerId::random(); let (n_in, n_out) = (10, 20); for _ in 0..n_in { pdb.connect_ingoing(&random_peer, "/ip4/0.0.0.0".parse().unwrap()); } for _ in 0..n_out { pdb.connect_outgoing(&random_peer, "/ip4/0.0.0.0".parse().unwrap()); } // the peer is known let peer_info = pdb.peer_info(&random_peer); assert!(peer_info.is_some()); // this is the only peer assert_eq!(pdb.peers().count(), 1); // the peer has the default reputation assert_eq!(pdb.score(&random_peer).score(), Score::default().score()); assert_eq!(pdb.disconnected_peers, 0); assert!(peer_info.unwrap().connection_status.is_connected()); assert_eq!( peer_info.unwrap().connection_status.connections(), (n_in, n_out) ); }
rust_cleaned_test_functions.jsonl/126539
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 485 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 45159, 43276, 18632, 3641, 368, 341, 286, 1077, 5206, 47984, 284, 633, 8685, 543, 286, 1077, 4194, 45159, 284, 45147, 764, 486, 11463, 1428, 286, 1077, 320, 77, 1243, 11, 308, 6068, 8, 284, 320,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_pending_delete_ranges() { let mut pending_delete_ranges = PendingDeleteRanges::default(); let delay = Duration::from_millis(100); let id = 0; let timeout = time::Instant::now() + delay; insert_range(&mut pending_delete_ranges, id, "a", "c", timeout); insert_range(&mut pending_delete_ranges, id, "m", "n", timeout); insert_range(&mut pending_delete_ranges, id, "x", "z", timeout); insert_range(&mut pending_delete_ranges, id + 1, "f", "i", timeout); insert_range(&mut pending_delete_ranges, id + 1, "p", "t", timeout); assert_eq!(pending_delete_ranges.len(), 5); thread::sleep(delay / 2); // a____c f____i m____n p____t x____z // g___________________q let timeout = time::Instant::now() + delay; let overlap_ranges = pending_delete_ranges.drain_overlap_ranges(&b"g".to_vec(), &b"q".to_vec()); assert_eq!( overlap_ranges, [ (id + 1, b"f".to_vec(), b"i".to_vec()), (id, b"m".to_vec(), b"n".to_vec()), (id + 1, b"p".to_vec(), b"t".to_vec()), ] ); assert_eq!(pending_delete_ranges.len(), 2); insert_range(&mut pending_delete_ranges, id + 2, "g", "q", timeout); assert_eq!(pending_delete_ranges.len(), 3); thread::sleep(delay / 2); let now = time::Instant::now(); let ranges: Vec<_> = pending_delete_ranges.timeout_ranges(now).collect(); assert_eq!( ranges, [ (id, b"a".to_vec(), b"c".to_vec()), (id, b"x".to_vec(), b"z".to_vec()), ] ); for (_, start_key, _) in ranges { pending_delete_ranges.remove(&start_key); } assert_eq!(pending_delete_ranges.len(), 1); thread::sleep(delay / 2); let now = time::Instant::now(); let ranges: Vec<_> = pending_delete_ranges.timeout_ranges(now).collect(); assert_eq!(ranges, [(id + 2, b"g".to_vec(), b"q".to_vec())]); for (_, start_key, _) in ranges { pending_delete_ranges.remove(&start_key); } assert_eq!(pending_delete_ranges.len(), 0); }
rust_cleaned_test_functions.jsonl/33223
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1197 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 37861, 11353, 58748, 368, 341, 286, 1077, 5206, 15280, 11353, 58748, 284, 41840, 6435, 74902, 486, 2258, 543, 286, 1077, 7626, 284, 21045, 486, 1499, 717, 56212, 7, 16, 15, 15, 317, 286, 1077, 8...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_encode_decode() { let nodes = vec![vec![0u8], vec![1], vec![2]]; let expected = Proof{ nodes: nodes, }; let rlp_proof = rlp::encode(&expected); let out_proof:Proof = rlp::decode(&rlp_proof).unwrap(); println!("{:?}", out_proof); assert_eq!(expected, out_proof); }
rust_cleaned_test_functions.jsonl/655
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 186 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11224, 15227, 368, 341, 286, 1077, 7798, 284, 7486, 20703, 4083, 20703, 15, 84, 23, 1125, 7486, 20703, 16, 1125, 7486, 20703, 17, 13204, 286, 1077, 3601, 284, 36991, 515, 310, 7798, 25, 7798, 34...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_linkat_follow_symlink() { let _m = ::CWD_LOCK.read().expect("Mutex got poisoned by another test"); let tempdir = tempfile::tempdir().unwrap(); let oldfilename = "foo.txt"; let oldfilepath = tempdir.path().join(oldfilename); let symoldfilename = "symfoo.txt"; let symoldfilepath = tempdir.path().join(symoldfilename); let newfilename = "nofollowsymbar.txt"; let newfilepath = tempdir.path().join(newfilename); // Create file File::create(&oldfilepath).unwrap(); // Create symlink to file symlinkat(&oldfilepath, None, &symoldfilepath).unwrap(); // Get file descriptor for base directory let dirfd = fcntl::open(tempdir.path(), fcntl::OFlag::empty(), stat::Mode::empty()).unwrap(); // Attempt link target of symlink of file at relative path linkat(Some(dirfd), symoldfilename, Some(dirfd), newfilename, LinkatFlags::SymlinkFollow).unwrap(); let newfilestat = stat::stat(&newfilepath).unwrap(); // Check the file type of the new link assert!((stat::SFlag::from_bits_truncate(newfilestat.st_mode) & SFlag::S_IFMT) == SFlag::S_IFREG); // Check the number of hard links to the original file assert_eq!(newfilestat.st_nlink, 2); }
rust_cleaned_test_functions.jsonl/30618
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 454 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 7233, 266, 43490, 58530, 44243, 368, 341, 262, 1077, 716, 76, 284, 3504, 34, 17563, 27661, 4125, 1005, 17119, 445, 38099, 2684, 70498, 553, 2441, 1273, 3071, 262, 1077, 2730, 3741, 284, 54819, 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_mention() { let channel = Channel::Guild(Arc::new(RwLock::new(GuildChannel { bitrate: None, category_id: None, guild_id: GuildId(1), kind: ChannelType::Text, id: ChannelId(4), last_message_id: None, last_pin_timestamp: None, name: "a".to_string(), permission_overwrites: vec![], position: 1, topic: None, user_limit: None, nsfw: false, }))); let emoji = Emoji { animated: false, id: EmojiId(5), name: "a".to_string(), managed: true, require_colons: true, roles: vec![], }; let role = Role { id: RoleId(2), colour: Colour::ROSEWATER, hoist: false, managed: false, mentionable: false, name: "fake role".to_string(), permissions: Permissions::empty(), position: 1, }; let user = User { id: UserId(6), avatar: None, bot: false, discriminator: 4132, name: "fake".to_string(), }; let member = Member { deaf: false, guild_id: GuildId(2), joined_at: None, mute: false, nick: None, roles: vec![], user: Arc::new(RwLock::new(user.clone())), }; assert_eq!(ChannelId(1).mention(), "<#1>"); assert_eq!(channel.mention(), "<#4>"); assert_eq!(emoji.mention(), "<:a:5>"); assert_eq!(member.mention(), "<@6>"); assert_eq!(role.mention(), "<@&2>"); assert_eq!(role.id.mention(), "<@&2>"); assert_eq!(user.mention(), "<@6>"); assert_eq!(user.id.mention(), "<@6>"); }
rust_cleaned_test_functions.jsonl/18857
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1308 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 26985, 290, 368, 341, 310, 1077, 5496, 284, 13434, 486, 72574, 4346, 1287, 486, 931, 2785, 86, 11989, 486, 931, 6699, 1498, 9629, 341, 394, 82643, 25, 2240, 345, 394, 5582, 842, 25, 2240, 345, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_stakes_not_delegate() { let mut stakes = Stakes::default(); stakes.epoch = 4; let ((vote_pubkey, vote_account), (stake_pubkey, stake_account)) = create_staked_node_accounts(10); stakes.store(&vote_pubkey, &vote_account, true); stakes.store(&stake_pubkey, &stake_account, true); { let vote_accounts = stakes.vote_accounts(); assert!(vote_accounts.get(&vote_pubkey).is_some()); assert_eq!(vote_accounts.get(&vote_pubkey).unwrap().0, 10); } stakes.store( &stake_pubkey, &Account::new(1, 0, &solana_stake_program::id()), true, ); { let vote_accounts = stakes.vote_accounts(); assert!(vote_accounts.get(&vote_pubkey).is_some()); assert_eq!(vote_accounts.get(&vote_pubkey).unwrap().0, 0); } }
rust_cleaned_test_functions.jsonl/77859
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 480 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1261, 2050, 7913, 55312, 368, 341, 286, 1077, 5206, 44425, 284, 794, 2050, 486, 2258, 543, 286, 44425, 92924, 284, 220, 19, 401, 286, 1077, 1781, 29358, 34014, 792, 11, 6910, 13500, 701, 320, 26...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_prf_test_case_65_4() { let key = Vec::from_hex("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b").unwrap(); let actual = prf(&key[..], "prefix-4", "Hi There Again".as_bytes(), 512); assert_eq!(actual.is_ok(), true); let expected = Vec::from_hex("248cfbc532ab38ffa483c8a2e40bf170eb542a2e0916d7bf6d97da2c4c5ca877736c53a65b03fa4b3745ce7613f6ad68e0e4a798b7cf691c96176fd634a59a49").unwrap(); assert_eq!(actual.unwrap(), expected); }
rust_cleaned_test_functions.jsonl/132286
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 268 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5294, 69, 4452, 19096, 62, 21, 20, 62, 19, 368, 341, 286, 1077, 1376, 284, 11312, 486, 1499, 32655, 445, 15, 65, 15, 65, 15, 65, 15, 65, 15, 65, 15, 65, 15, 65, 15, 65, 15, 65, 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_locked_nft_cannot_update_characteristic_error() { let (mut context, tx) = create_test_context( Action::Update(UpdateCase::UpdateCharacteristic), NftError::LockedNFTCannotUpdateCharacteristic, ); let tx = context.complete_tx(tx); // run let err = context.verify_tx(&tx, MAX_CYCLES).unwrap_err(); let script_cell_index = 0; assert_error_eq!( err, ScriptError::ValidationFailure(LOCKED_NFT_CANNOT_UPDATE_CHARACTERISTIC) .input_type_script(script_cell_index) ); }
rust_cleaned_test_functions.jsonl/33608
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 240 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 60271, 1089, 723, 666, 3401, 8882, 40988, 4532, 4096, 368, 341, 262, 1077, 320, 6984, 2266, 11, 9854, 8, 284, 1855, 4452, 8467, 1006, 286, 5586, 486, 4289, 7, 4289, 4207, 486, 4289, 64982, 1326,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_newtype_struct() { #[derive(Debug, PartialEq, Valuable, Serialize)] struct S(u8); assert_ser_eq!(S(0), &[Token::NewtypeStruct { name: "S" }, Token::U8(0)]); }
rust_cleaned_test_functions.jsonl/44212
{ "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, 5921, 1313, 15126, 368, 341, 262, 11506, 27098, 42618, 11, 55039, 11, 4104, 13128, 11, 39900, 5563, 262, 2036, 328, 8154, 23, 626, 262, 2060, 75861, 10714, 10297, 50, 7, 15, 701, 44590, 3323, 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
#[test] fn test_once_check_count_fail_two() { let occurence: Occurences<u32> = Occurences::Once; occurence.check_count(2).unwrap(); }
rust_cleaned_test_functions.jsonl/4431
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 78 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 7630, 7200, 3180, 22121, 23241, 368, 341, 286, 1077, 2983, 86937, 25, 19927, 552, 98162, 34837, 18, 17, 29, 284, 19927, 552, 98162, 486, 12522, 280, 286, 2983, 86937, 9093, 3180, 7, 17, 568, 154...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_muxer_rxq() { let mut ctx = MuxerTestContext::new("muxer_rxq"); let local_port = 1026; let peer_port_first = 1025; let mut listener = ctx.create_local_listener(local_port); let mut streams: Vec<UnixStream> = Vec::new(); for peer_port in peer_port_first..peer_port_first + defs::MUXER_RXQ_SIZE { ctx.init_pkt(local_port, peer_port as u32, uapi::VSOCK_OP_REQUEST); ctx.send(); streams.push(listener.accept()); } // synchronized. assert!(ctx.muxer.rxq.is_synced()); // One more queued reply should desync the RX queue. ctx.init_pkt( local_port, (peer_port_first + defs::MUXER_RXQ_SIZE) as u32, uapi::VSOCK_OP_REQUEST, ); ctx.send(); assert!(!ctx.muxer.rxq.is_synced()); // take its place. We'll check that by making sure that the last packet popped from the // queue is an RST. ctx.init_pkt( local_port + 1, peer_port_first as u32, uapi::VSOCK_OP_REQUEST, ); ctx.send(); for peer_port in peer_port_first..peer_port_first + defs::MUXER_RXQ_SIZE - 1 { ctx.recv(); assert_eq!(ctx.pkt.op(), uapi::VSOCK_OP_RESPONSE); // The response order should hold. The evicted response should have been the last // enqueued. assert_eq!(ctx.pkt.dst_port(), peer_port as u32); } // There should be one more packet in the queue: the RST. assert_eq!(ctx.muxer.rxq.len(), 1); ctx.recv(); assert_eq!(ctx.pkt.op(), uapi::VSOCK_OP_RST); // pending RX. assert!(ctx.muxer.rxq.is_empty()); assert!(!ctx.muxer.rxq.is_synced()); assert!(ctx.muxer.has_pending_rx()); // The next recv should sync the queue back up. It should also yield one of the two // responses that are still left: // - the one that desynchronized the queue; and // - the one that got evicted by the RST. ctx.recv(); assert!(ctx.muxer.rxq.is_synced()); assert_eq!(ctx.pkt.op(), uapi::VSOCK_OP_RESPONSE); assert!(ctx.muxer.has_pending_rx()); ctx.recv(); assert_eq!(ctx.pkt.op(), uapi::VSOCK_OP_RESPONSE); }
rust_cleaned_test_functions.jsonl/37604
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1219 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 80363, 261, 24330, 80, 368, 341, 286, 1077, 5206, 5635, 284, 386, 2200, 261, 2271, 1972, 486, 931, 445, 75066, 261, 24330, 80, 797, 286, 1077, 2205, 8716, 284, 220, 16, 15, 17, 21, 280, 286, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_invalid_version() { assert_matches!( from_json_value(json!({"version": "2", "content": {}})), Err(CreationManifestError::Json(err)) => assert!(err.is_data())); }
rust_cleaned_test_functions.jsonl/101412
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 108 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 31433, 9438, 368, 341, 286, 2060, 38344, 33673, 310, 504, 9455, 3142, 9304, 0, 16864, 4366, 788, 330, 17, 497, 330, 1796, 788, 314, 3417, 6965, 310, 15495, 3025, 26453, 38495, 1454, 486, 5014, 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
#[test] fn test_do_not_evict_entry_that_are_referd_only_by_the_same_header_blocked_encoding() { let mut encoder = connect(false); encoder.encoder.set_max_blocked_streams(20).unwrap(); assert!(encoder.encoder.set_max_capacity(50).is_ok()); encoder .encoder .send_and_insert(&mut encoder.conn, b"something5", b"1234") .unwrap(); encoder.encoder.send(&mut encoder.conn).unwrap(); let out = encoder.conn.process(None, now()); let _ = encoder.peer_conn.process(out.dgram(), now()); // receive an insert count increment. recv_instruction(&mut encoder, &[0x01]); assert!(encoder .encoder .encode_header_block( &mut encoder.conn, &[ (String::from("something5"), String::from("1234")), (String::from("something6"), String::from("1234")), ], 3, ) .is_ok()); }
rust_cleaned_test_functions.jsonl/18415
{ "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, 26309, 7913, 43713, 849, 9078, 70197, 56855, 73386, 67, 18410, 3710, 16068, 33574, 8757, 89223, 37613, 368, 341, 286, 1077, 5206, 23668, 284, 4564, 3576, 626, 286, 23668, 69042, 980, 6345, 89223, 74...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_commit_decoration_style_omit() { _do_test_commit_style_no_decoration(&[ "--commit-style", "blue", "--commit-decoration-style", "omit", ]); }
rust_cleaned_test_functions.jsonl/70057
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 133 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 36346, 2259, 26452, 15117, 62, 77968, 368, 341, 286, 716, 2982, 4452, 36346, 15117, 6536, 2259, 26452, 2099, 9640, 310, 14482, 17413, 11297, 756, 310, 330, 12203, 756, 310, 14482, 17413, 30266, 1129...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_order() { test_error_types(move |b| b.set_order(1), &BTreeSet::new()); let container = [0u8; constants::MIN_ORDER_SIZE]; let block = Block::new_free(&container[..], 0, 1, 1).unwrap(); assert!(block.set_order(3).is_ok()); assert_eq!(block.order(), 3); }
rust_cleaned_test_functions.jsonl/100146
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 154 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2602, 7869, 368, 341, 286, 1273, 4096, 9763, 34081, 760, 65, 91, 293, 980, 7869, 7, 16, 701, 609, 33, 6533, 1649, 486, 931, 1423, 286, 1077, 5476, 284, 508, 15, 84, 23, 26, 18021, 486, 16413...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_first_child() { let item = execute_selector_query( SIMPLE_LIST, "li:first-child", false, false, Span::test_data(), ); let config = nu_protocol::Config::default(); let out = item.into_string("\n", &config); assert_eq!("[Coffee]".to_string(), out) }
rust_cleaned_test_functions.jsonl/121394
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 201 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 12978, 17268, 368, 341, 286, 1077, 1509, 284, 9026, 28890, 5738, 1006, 310, 91484, 11899, 345, 310, 330, 742, 53374, 23484, 756, 310, 895, 345, 310, 895, 345, 310, 11903, 486, 1944, 1769, 3148, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_sha256_node() { let mut h1 = [0u8; 32]; let mut h2 = [0u8; 32]; let mut h3 = [0u8; 32]; h1[0] = 0x00; h2[0] = 0x11; h3[0] = 0x22; let mut a = <Sha256Hasher as Hasher>::Function::default(); let h11 = h1; let h12 = h2; let h13 = h3; let h21 = a.node(h11.into(), h12.into(), 0); a.reset(); let h22 = a.node(h13.into(), h13.into(), 0); a.reset(); let _h31 = a.node(h21.into(), h22.into(), 1); a.reset(); let l1 = a.leaf(h1.into()); a.reset(); let l2 = a.leaf(h2.into()); a.reset(); // let mut s = vec![0x00]; // println!( // assert_eq!( // "e96c39a7e54a9ac9d54330a0f2686f7dbc2d26df8385252fca5682ac319e9c7f" // assert_eq!( // "f820fce7caf5f38f47d4893692c90ea92af47f10cdd3facd1b9e4642e5dfa84f" // assert_eq!( // "888ee00d8142c7c7ca5635c1f175e11f3aa811c00ad3a200cd36584ce2a75384" // assert_eq!( // "e6a6b12f6147ce9ce87c9f2a7f41ddd9587f6ea59ccbfb33fba08e3740d96200" let v: Vec<DigestDomain> = vec![h1.into(), h2.into(), h3.into()]; let v2: Vec<DigestDomain> = vec![h1.into(), h2.into()]; let t = VecMerkleTree::<<Sha256Hasher as Hasher>::Domain, <Sha256Hasher as Hasher>::Function>::from_iter(v); let t2 = VecMerkleTree::< <Sha256Hasher as Hasher>::Domain, <Sha256Hasher as Hasher>::Function, >::from_iter(v2); assert_eq!(t2.read_at(0).as_ref(), l1.as_ref()); assert_eq!(t2.read_at(1).as_ref(), l2.as_ref()); assert_eq!(t2.read_at(2).as_ref(), h21.as_ref()); // TODO: Verify this is the right hash — bearing in mind that the two most significant bits must be cleared after each hash. assert_eq!( format!("{}", HexSlice::new(t.root().as_ref())), "1c1afe57ff6efa4204cf4e17e20bf4d7f6ebf3a4c27391f93993291560107f88" ); }
rust_cleaned_test_functions.jsonl/77380
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1276 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 48836, 17, 20, 21, 5084, 368, 341, 286, 1077, 5206, 305, 16, 284, 508, 15, 84, 23, 26, 220, 18, 17, 935, 286, 1077, 5206, 305, 17, 284, 508, 15, 84, 23, 26, 220, 18, 17, 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...
1
#[test] fn test_get_scope_blank() { // Arrange let req = TestRequest::with_uri("/").to_request(); let scope = get_scope(); let mut srv = init_service(App::new().service(scope)); // Act let resp = block_on(srv.call(req)).unwrap(); // Assert assert_eq!(resp.status(), StatusCode::NOT_FOUND); }
rust_cleaned_test_functions.jsonl/94243
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 172 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 23199, 56103, 368, 341, 286, 442, 40580, 198, 286, 1077, 4232, 284, 3393, 1900, 486, 4197, 15572, 4283, 1827, 983, 7893, 543, 286, 1077, 6891, 284, 633, 23199, 543, 286, 1077, 5206, 43578, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_reset_to_new_value() { solana_logger::setup(); let ledger_path = get_tmp_ledger_path!(); { let blockstore = Blockstore::open(&ledger_path) .expect("Expected to be able to open database ledger"); let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(2); let bank = Arc::new(Bank::new_for_tests(&genesis_config)); let (mut poh_recorder, _entry_receiver, _record_receiver) = PohRecorder::new( 0, Hash::default(), bank.clone(), Some((4, 4)), DEFAULT_TICKS_PER_SLOT, &Pubkey::default(), &Arc::new(blockstore), &Arc::new(LeaderScheduleCache::default()), &Arc::new(PohConfig::default()), Arc::new(AtomicBool::default()), ); poh_recorder.tick(); poh_recorder.tick(); poh_recorder.tick(); poh_recorder.tick(); assert_eq!(poh_recorder.tick_cache.len(), 4); assert_eq!(poh_recorder.tick_height, 4); poh_recorder.reset(bank, Some((4, 4))); // parent slot 0 implies tick_height of 3 assert_eq!(poh_recorder.tick_cache.len(), 0); poh_recorder.tick(); assert_eq!(poh_recorder.tick_height, DEFAULT_TICKS_PER_SLOT + 1); } Blockstore::destroy(&ledger_path).unwrap(); }
rust_cleaned_test_functions.jsonl/106271
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 791 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 18983, 2346, 5921, 3142, 368, 341, 286, 2048, 3362, 27413, 486, 15188, 1428, 286, 1077, 46933, 2638, 284, 633, 16125, 38367, 1389, 2638, 0, 543, 286, 341, 310, 1077, 2504, 4314, 284, 8362, 4314, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_ssh_addr() { let sockets = vec![ SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::new(127, 0, 0, 1), 0)), SocketAddr::V6(SocketAddrV6::new("f111::3".parse().unwrap(), 0, 0, 0)), SocketAddr::V6(SocketAddrV6::new("fe80::1".parse().unwrap(), 0, 0, 0)), SocketAddr::V6(SocketAddrV6::new("fe80::2".parse().unwrap(), 0, 0, 0)), ]; let addrs = sockets.iter().map(|s| TargetAddr::from(*s)).collect::<Vec<_>>(); assert_eq!((&addrs).to_ssh_addr(), Some(addrs[2])); let sockets = vec![ SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::new(127, 0, 0, 1), 0)), SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::new(129, 0, 0, 1), 0)), ]; let addrs = sockets.iter().map(|s| TargetAddr::from(*s)).collect::<Vec<_>>(); assert_eq!((&addrs).to_ssh_addr(), Some(addrs[0])); let addrs = Vec::<TargetAddr>::new(); assert_eq!((&addrs).to_ssh_addr(), None); }
rust_cleaned_test_functions.jsonl/107755
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 524 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2346, 82805, 7387, 368, 341, 286, 1077, 47557, 284, 7486, 90515, 310, 20954, 13986, 486, 53, 19, 73066, 13986, 53, 19, 486, 931, 8972, 30168, 19, 13986, 486, 931, 7, 16, 17, 22, 11, 220, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_match_header_missing_not_matching_even_when_empty() { let _m = mock("GET", "/") .match_header("Authorization", Matcher::Missing) .create(); let (status, _, _) = request("GET /", "Authorization:\r\n"); assert_eq!("HTTP/1.1 501 Mock Not Found\r\n", status); }
rust_cleaned_test_functions.jsonl/82379
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 131 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10708, 8757, 40447, 7913, 70763, 68347, 47636, 15124, 368, 341, 262, 1077, 716, 76, 284, 7860, 445, 3806, 497, 3521, 1138, 286, 659, 6347, 8757, 445, 18124, 497, 60632, 486, 25080, 340, 286, 659, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_bvec3() { assert_eq!( Vec3::new(1.0, 2.0, 3.0).greater_than(&Vec3::new(3.0, 2.0, 1.0)), bvec3(false, false, true), ); assert_eq!( Vec3::new(1.0, 2.0, 3.0).lower_than(&Vec3::new(3.0, 2.0, 1.0)), bvec3(true, false, false), ); assert_eq!( Vec3::new(1.0, 2.0, 3.0).equal(&Vec3::new(3.0, 2.0, 1.0)), bvec3(false, true, false), ); assert_eq!( Vec3::new(1.0, 2.0, 3.0).not_equal(&Vec3::new(3.0, 2.0, 1.0)), bvec3(true, false, true), ); assert!(bvec3(true, true, false).any()); assert!(bvec3(false, true, false).any()); assert!(bvec3(true, false, false).any()); assert!(!bvec3(false, false, false).any()); assert!(bvec3(false, false, false).none()); assert!(bvec3(true, true, true).all()); assert!(!bvec3(false, true, false).all()); assert!(!bvec3(true, false, false).all()); assert!(!bvec3(false, false, false).all()); assert_eq!(bvec3(true, false, true).not(), bvec3(false, true, false)); assert_eq!(bvec3(true, false, true).and(bvec3(true, true, false)), bvec3(true, false, false)); assert_eq!(bvec3(true, false, false).or(bvec3(true, true, false)), bvec3(true, true, false)); assert_eq!( bvec3(true, false, true).select_vector(&Vec3::new(1.0, 2.0, 3.0), &Vec3::new(4.0, 5.0, 6.0)), Vec3::new(1.0, 5.0, 3.0), ); }
rust_cleaned_test_functions.jsonl/58558
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 853 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 880, 4083, 18, 368, 1476, 286, 2060, 10714, 33673, 310, 11312, 18, 486, 931, 7, 16, 13, 15, 11, 220, 17, 13, 15, 11, 220, 18, 13, 15, 568, 65235, 51613, 2099, 10050, 18, 486, 931, 7, 18, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_subjecttype_fromstr() { use std::str::FromStr; assert_eq!(SubjectType::from_str("BIC").unwrap(), SubjectType::Bic); assert_eq!(SubjectType::from_str("BISAC").unwrap(), SubjectType::Bisac); assert_eq!(SubjectType::from_str("Thema").unwrap(), SubjectType::Thema); assert_eq!(SubjectType::from_str("LCC").unwrap(), SubjectType::Lcc); assert_eq!( SubjectType::from_str("Custom").unwrap(), SubjectType::Custom ); assert_eq!( SubjectType::from_str("Keyword").unwrap(), SubjectType::Keyword ); assert!(SubjectType::from_str("bic").is_err()); assert!(SubjectType::from_str("Library of Congress Subject Code").is_err()); }
rust_cleaned_test_functions.jsonl/50573
{ "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, 28834, 1313, 5673, 495, 368, 341, 262, 990, 1460, 486, 495, 486, 3830, 2580, 280, 262, 2060, 10714, 10297, 13019, 929, 486, 1499, 2895, 445, 33, 1317, 1827, 15454, 1507, 17450, 929, 486, 33, 292...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_length_including_self() { let encoding = Encoding { format: Format::Dwarf32, version: 4, address_size: 4, }; let mut unit = UnitHeader { encoding, unit_length: 0, debug_abbrev_offset: DebugAbbrevOffset(0), entries_buf: EndianSlice::new(&[], LittleEndian), }; unit.encoding.format = Format::Dwarf32; assert_eq!(unit.length_including_self(), 4); unit.encoding.format = Format::Dwarf64; assert_eq!(unit.length_including_self(), 12); unit.unit_length = 10; assert_eq!(unit.length_including_self(), 22); }
rust_cleaned_test_functions.jsonl/102077
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 346 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5118, 1243, 10910, 25637, 368, 341, 286, 1077, 11170, 284, 29330, 341, 310, 3561, 25, 15042, 486, 35, 32634, 18, 17, 345, 310, 2319, 25, 220, 19, 345, 310, 2621, 2368, 25, 220, 19, 345, 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_dbt_query() { assert_display_snapshot!((resolve_and_translate(parse(r###" from {{ ref('stg_orders') }} aggregate (min order_id) "###, ).unwrap()).unwrap()), @r###" SELECT MIN(order_id) FROM {{ ref('stg_orders') }} "###); }
rust_cleaned_test_functions.jsonl/62575
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 183 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8685, 83, 5738, 368, 341, 286, 2060, 14825, 53265, 0, 1188, 17325, 8378, 66381, 27762, 2601, 14374, 698, 286, 504, 5867, 2053, 492, 267, 70, 37129, 863, 8096, 286, 23192, 320, 1065, 1973, 842, 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_negate_pubkeys() { let key = PrivateKey::new(Integer::from(100)); let pubkey = key.generate_pubkey(); let secp = get_context(); let x: Point = pubkey.clone().into(); let y: Point = (&secp.order - Integer::from(1)) * x; let neg_pubkey: PublicKey = y.into(); let cal_neg_pubkey = pubkey.negate(); assert_eq!(neg_pubkey, cal_neg_pubkey); }
rust_cleaned_test_functions.jsonl/36206
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 200 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 28209, 349, 34014, 10563, 368, 341, 286, 1077, 1376, 284, 9679, 1592, 486, 931, 11322, 486, 1499, 7, 16, 15, 15, 1106, 286, 1077, 95116, 284, 1376, 22019, 34014, 792, 1428, 286, 1077, 511, 4672,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_angle_function() -> Result<()> { #[allow(dead_code)] struct Test { name: &'static str, display: &'static str, nullable: bool, columns: DataColumn, expect: DataColumn, error: &'static str, func: Box<dyn Function>, } let tests = vec![ Test { name: "degress-passed", display: "degrees", nullable: false, columns: Series::new(vec![PI, PI / 2.0]).into(), func: DegressFunction::try_create("degrees")?, expect: Series::new(vec![180_f64, 90.0]).into(), error: "", }, Test { name: "radians-passed", display: "radians", nullable: false, columns: Series::new(vec![180]).into(), func: RadiansFunction::try_create("radians")?, expect: Series::new(vec![PI]).into(), error: "", }, ]; for t in tests { let func = t.func; let rows = t.columns.len(); let columns = vec![DataColumnWithField::new( t.columns.clone(), DataField::new("dummpy", t.columns.data_type(), false), )]; if let Err(e) = func.eval(&columns, rows) { assert_eq!(t.error, e.to_string(), "{}", t.name); } // Display check. let expect_display = t.display.to_string(); let actual_display = format!("{}", func); assert_eq!(expect_display, actual_display); let v = &(func.eval(&columns, rows)?); assert_eq!(v, &t.expect, "{}", t.name); let return_type = v.data_type(); let expected_type = func.return_type(&[t.columns.data_type()])?; assert_eq!(expected_type, return_type); } Ok(()) }
rust_cleaned_test_functions.jsonl/6821
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 916 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21727, 9174, 368, 1464, 5714, 71698, 341, 262, 11506, 7183, 83207, 4136, 5563, 262, 2036, 3393, 341, 286, 829, 25, 30136, 1978, 607, 345, 286, 3037, 25, 30136, 1978, 607, 345, 286, 13258, 25, 18...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
#[test] fn test_get_chunks() { let state = BlobMetaState { blob_index: 1, compressed_size: 0x6001, uncompressed_size: 0x102001, chunk_count: 5, chunks: ManuallyDrop::new(vec![ BlobChunkInfoOndisk { uncomp_info: 0x0100_0000_0000_0000, comp_info: 0x00ff_f000_0000_0000, }, BlobChunkInfoOndisk { uncomp_info: 0x01ff_f000_0000_2000, comp_info: 0x01ff_f000_0000_1000, }, BlobChunkInfoOndisk { uncomp_info: 0x01ff_f000_0000_4000, comp_info: 0x00ff_f000_0000_3000, }, BlobChunkInfoOndisk { uncomp_info: 0x01ff_f000_0010_0000, comp_info: 0x00ff_f000_0000_4000, }, BlobChunkInfoOndisk { uncomp_info: 0x01ff_f000_0010_2000, comp_info: 0x00ff_f000_0000_5000, }, ]), base: std::ptr::null(), unmap_len: 0, }; let info = BlobMetaInfo { state: Arc::new(state), }; let vec = info.get_chunks_uncompressed(0x0, 0x1001).unwrap(); assert_eq!(vec.len(), 1); assert_eq!(vec[0].blob_index(), 1); assert_eq!(vec[0].id(), 0); assert_eq!(vec[0].compress_offset(), 0); assert_eq!(vec[0].compress_size(), 0x1000); assert_eq!(vec[0].uncompress_offset(), 0); assert_eq!(vec[0].uncompress_size(), 0x1001); assert_eq!(vec[0].is_compressed(), true); assert_eq!(vec[0].is_hole(), false); let vec = info.get_chunks_uncompressed(0x0, 0x4000).unwrap(); assert_eq!(vec.len(), 2); assert_eq!(vec[1].blob_index(), 1); assert_eq!(vec[1].id(), 1); assert_eq!(vec[1].compress_offset(), 0x1000); assert_eq!(vec[1].compress_size(), 0x2000); assert_eq!(vec[1].uncompress_offset(), 0x2000); assert_eq!(vec[1].uncompress_size(), 0x2000); assert_eq!(vec[1].is_compressed(), false); assert_eq!(vec[1].is_hole(), false); let vec = info.get_chunks_uncompressed(0x0, 0x4001).unwrap(); assert_eq!(vec.len(), 3); let vec = info.get_chunks_uncompressed(0x100000, 0x2000).unwrap(); assert_eq!(vec.len(), 1); assert!(info.get_chunks_uncompressed(0x0, 0x6001).is_err()); assert!(info.get_chunks_uncompressed(0x0, 0xfffff).is_err()); assert!(info.get_chunks_uncompressed(0x0, 0x100000).is_err()); assert!(info.get_chunks_uncompressed(0x0, 0x104000).is_err()); assert!(info.get_chunks_uncompressed(0x0, 0x104001).is_err()); assert!(info.get_chunks_uncompressed(0x100000, 0x2001).is_err()); assert!(info.get_chunks_uncompressed(0x100000, 0x4000).is_err()); assert!(info.get_chunks_uncompressed(0x100000, 0x4001).is_err()); assert!(info .get_chunks_uncompressed(0x102000, 0xffff_ffff_ffff_ffff) .is_err()); assert!(info.get_chunks_uncompressed(0x104000, 0x1).is_err()); }
rust_cleaned_test_functions.jsonl/37902
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1803 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 65470, 368, 341, 286, 1077, 1584, 284, 49439, 12175, 1397, 341, 310, 23404, 3560, 25, 220, 16, 345, 310, 30649, 2368, 25, 220, 15, 87, 21, 15, 15, 16, 345, 310, 92382, 2368, 25, 220, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_rem() -> Result<(), TestingError> { TestRunner::new() .push(zinc_build::Push::new( BigInt::from(9), IntegerType::I8.into(), )) .push(zinc_build::Push::new( BigInt::from(4), IntegerType::I8.into(), )) .push(zinc_build::Rem) .push(zinc_build::Push::new( BigInt::from(9), IntegerType::I8.into(), )) .push(zinc_build::Push::new( BigInt::from(-4), IntegerType::I8.into(), )) .push(zinc_build::Rem) .push(zinc_build::Push::new( BigInt::from(-9), IntegerType::I8.into(), )) .push(zinc_build::Push::new( BigInt::from(4), IntegerType::I8.into(), )) .push(zinc_build::Rem) .push(zinc_build::Push::new( BigInt::from(-9), IntegerType::I8.into(), )) .push(zinc_build::Push::new( BigInt::from(-4), IntegerType::I8.into(), )) .push(zinc_build::Rem) .test(&[3, 3, 1, 1]) }
rust_cleaned_test_functions.jsonl/55869
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 826 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 19194, 368, 1464, 5714, 68843, 26768, 1454, 29, 341, 286, 3393, 19486, 486, 931, 741, 310, 659, 9077, 13174, 2840, 20801, 486, 16644, 486, 931, 1006, 394, 62608, 486, 1499, 7, 24, 1326, 394, 444...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_explode_list() -> Result<()> { let mut builder = get_list_builder(&DataType::Int32, 5, 5, "a"); builder.append_series(&Series::new("", &[1, 2, 3, 3])); builder.append_series(&Series::new("", &[1])); builder.append_series(&Series::new("", &[2])); let ca = builder.finish(); assert!(ca.can_fast_explode()); // normal explode let exploded = ca.explode()?; let out: Vec<_> = exploded.i32()?.into_no_null_iter().collect(); assert_eq!(out, &[1, 2, 3, 3, 1, 2]); // sliced explode let exploded = ca.slice(0, 1).explode()?; let out: Vec<_> = exploded.i32()?.into_no_null_iter().collect(); assert_eq!(out, &[1, 2, 3, 3]); Ok(()) }
rust_cleaned_test_functions.jsonl/57838
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 368 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2702, 70744, 2019, 368, 1464, 5714, 71698, 341, 286, 1077, 5206, 7363, 284, 633, 2019, 28532, 2099, 22653, 486, 1072, 18, 17, 11, 220, 20, 11, 220, 20, 11, 330, 64, 3071, 286, 7363, 2057, 3501...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_nullable_record() { use std::iter::FromIterator; let schema_str_a = r#"{ "name": "A", "type": "record", "fields": [ {"name": "field_one", "type": "float"} ] }"#; let schema_str_option_a = r#"{ "name": "OptionA", "type": "record", "fields": [ {"name": "field_one", "type": ["null", "A"], "default": "null"} ] }"#; let schema_a = Schema::parse_str(schema_str_a).unwrap(); let schema_option_a = Schema::parse_list(&[schema_str_a, schema_str_option_a]) .unwrap() .last() .unwrap() .clone(); let schema_option_a_expected = Schema::Record { name: Name::new("OptionA"), doc: None, fields: vec![RecordField { name: "field_one".to_string(), doc: None, default: Some(Value::Null), schema: Schema::Union(UnionSchema::new(vec![Schema::Null, schema_a]).unwrap()), order: RecordFieldOrder::Ignore, position: 0, }], lookup: HashMap::from_iter(vec![("field_one".to_string(), 0)]), }; assert_eq!(schema_option_a, schema_option_a_expected); }
rust_cleaned_test_functions.jsonl/108434
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 772 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 69743, 14192, 368, 341, 286, 990, 1460, 486, 2015, 486, 3830, 11951, 401, 286, 1077, 10802, 2895, 4306, 284, 435, 55543, 515, 310, 330, 606, 788, 330, 32, 756, 310, 330, 1313, 788, 330, 8548, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_fd_table_pack_values() { let kern = Kernel::new_for_testing(); let files = FdTable::new(); let file = SyslogFile::new(&kern); // Add two FDs. let fd0 = files.add(file.clone()).unwrap(); let fd1 = files.add(file.clone()).unwrap(); assert_eq!(fd0.raw(), 0); assert_eq!(fd1.raw(), 1); // Close FD 0 assert!(files.close(fd0).is_ok()); assert!(files.close(fd0).is_err()); // Now it's gone. assert!(files.get(fd0).is_err()); // The next FD we insert fills in the hole we created. let another_fd = files.add(file.clone()).unwrap(); assert_eq!(another_fd.raw(), 0); }
rust_cleaned_test_functions.jsonl/18491
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 349 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 17676, 5237, 32995, 9146, 368, 341, 286, 1077, 82585, 284, 36603, 486, 931, 5478, 70962, 543, 286, 1077, 3542, 284, 434, 67, 2556, 486, 931, 543, 286, 1077, 1034, 284, 28909, 839, 1703, 486, 931...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_restrict_domain_bad_inputs() { let original = BoundedQuadratic::new(0., 2., 1., 0., 0.); original.restrict_domain(100., -100.); }
rust_cleaned_test_functions.jsonl/19858
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 81 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 97684, 20111, 34199, 28557, 368, 341, 286, 1077, 4024, 284, 425, 13082, 2183, 88678, 486, 931, 7, 15, 2572, 220, 17, 2572, 220, 16, 2572, 220, 15, 2572, 220, 15, 58957, 286, 4024, 1327, 6627, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_fn_to_latin_iternational_passport_2013_ru_1() { assert_eq!( Passport2013::new().to_latin(SOURCE_PASSPORT_2013_RU_1), TRANSLIT_PASSPORT_2013_RU_1 ); }
rust_cleaned_test_functions.jsonl/76338
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 107 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15246, 2346, 907, 14768, 14631, 27135, 15464, 403, 62, 17, 15, 16, 18, 73584, 62, 16, 368, 341, 262, 2060, 10714, 33673, 286, 66800, 17, 15, 16, 18, 486, 931, 1005, 983, 907, 14768, 3759, 1307...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_read_sam_header() { let bam = Reader::from_path(&"test/test.bam") .ok() .expect("Error opening file."); let true_header = "@SQ\tSN:CHROMOSOME_I\tLN:15072423\n@SQ\tSN:CHROMOSOME_II\tLN:15279345\ \n@SQ\tSN:CHROMOSOME_III\tLN:13783700\n@SQ\tSN:CHROMOSOME_IV\tLN:17493793\n@SQ\t\ SN:CHROMOSOME_V\tLN:20924149\n" .to_string(); let header_text = String::from_utf8(bam.header.as_bytes().to_owned()).unwrap(); assert_eq!(header_text, true_header); }
rust_cleaned_test_functions.jsonl/34022
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 324 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6443, 643, 309, 8757, 368, 341, 286, 1077, 41304, 284, 25166, 486, 1499, 2638, 2099, 1, 1944, 12697, 71804, 1138, 310, 659, 562, 741, 310, 659, 17119, 445, 1454, 8568, 1034, 30458, 286, 1077, 83...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_packet_builder() { // DummyPacketBuilder itself doesn't have any interesting logic - it // just calls out to PacketConstraints::new. We've already tested that // method in test_packet_constraints. This test instead exercises the // logic in Nested to make sure that PacketBuilders compose correctly. // Each failure test case corresponds to one check in either // Nested::constraints or PacketConstraints::new (which is called from // corresponding comment in either of those two functions identifies // which line is being tested. use DummyPacketBuilder as DPB; use PacketConstraints as PC; // Sanity check. let pb = DPB::new(10, 10, 0, MAX_USIZE); assert_eq!( pb.encapsulate(pb).try_constraints().unwrap(), PC::new(20, 20, 0, MAX_USIZE - 20), ); // The outer PacketBuilder's minimum body length requirement of 10 is // more than satisfied by the inner PacketBuilder's combined 20 bytes of // header and footer. The resulting PacketBuilder has its minimum body // length requirement saturated to 0. let inner = DPB::new(10, 10, 0, MAX_USIZE); let outer = DPB::new(0, 0, 10, MAX_USIZE); assert_eq!( inner.encapsulate(outer).try_constraints().unwrap(), PC::new(10, 10, 0, MAX_USIZE - 20), ); // Test case 1 // The sum of the inner and outer header lengths overflows `usize`. let inner = DPB::new(MAX_USIZE, 0, 0, MAX_USIZE); let outer = DPB::new(1, 0, 0, MAX_USIZE); assert_eq!(inner.encapsulate(outer).try_constraints(), None); // Test case 2 // The sum of the inner and outer footer lengths overflows `usize`. let inner = DPB::new(0, MAX_USIZE, 0, MAX_USIZE); let outer = DPB::new(0, 1, 0, MAX_USIZE); assert_eq!(inner.encapsulate(outer).try_constraints(), None); // Test case 3 // overflows `usize`. We use MAX_USIZE / 5 + 1 as the constant so that // that an overflow in the final addition will be caught. let one_fifth_max = (MAX_USIZE / 5) + 1; let inner = DPB::new(one_fifth_max, one_fifth_max, one_fifth_max, MAX_USIZE); let outer = DPB::new(one_fifth_max, one_fifth_max, 0, MAX_USIZE); assert_eq!(inner.encapsulate(outer).try_constraints(), None); // Test case 4 // The header and footer of the inner PacketBuilder exceed the maximum // body length requirement of the outer PacketBuilder. let inner = DPB::new(10, 10, 0, MAX_USIZE); let outer = DPB::new(0, 0, 0, 10); assert_eq!(inner.encapsulate(outer).try_constraints(), None); // Test case 5 // The resulting minimum body length (thanks to the inner // PacketBuilder's minimum body length) is larger than the resulting // maximum body length. let inner = DPB::new(0, 0, 10, MAX_USIZE); let outer = DPB::new(0, 0, 0, 5); assert_eq!(inner.encapsulate(outer).try_constraints(), None); }
rust_cleaned_test_functions.jsonl/131779
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1377 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 66279, 21078, 28532, 368, 341, 286, 442, 50567, 16679, 3297, 5086, 3171, 944, 614, 894, 7040, 12218, 481, 432, 198, 286, 442, 1101, 6738, 700, 311, 28889, 12925, 486, 931, 13, 1205, 3003, 2669, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_deep_compile_2() { let expr = from_str("1.0 * 3 * 2 * x / 2 / 3").unwrap(); assert_float_eq_f64(eval(&expr, &[2.0]).unwrap(), 2.0); let expr = from_str("x*0.2*5/4+x*2*4*1*1*1*1*1*1*1+2+3+7*sin(y)-z/sin(3.0/2/(1-x*4*1*1*1*1))") .unwrap(); assert_eq!( "{x}*0.25+{x}*8.0+5.0+7.0*sin({y})-{z}/sin(1.5/(1.0-{x}*4.0))", expr.unparse_raw() ); let expr = from_str("x + 1 - 2").unwrap(); assert_float_eq_f64(eval(&expr, &[0.0]).unwrap(), -1.0); let expr = from_str("x - 1 + 2").unwrap(); assert_float_eq_f64(eval(&expr, &[0.0]).unwrap(), 1.0); let expr = from_str("x * 2 / 3").unwrap(); assert_float_eq_f64(eval(&expr, &[2.0]).unwrap(), 4.0 / 3.0); let expr = from_str("x / 2 / 3").unwrap(); assert_float_eq_f64(eval(&expr, &[2.0]).unwrap(), 1.0 / 3.0); }
rust_cleaned_test_functions.jsonl/68851
{ "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, 87044, 74170, 62, 17, 368, 341, 262, 1077, 15169, 284, 504, 2895, 445, 16, 13, 15, 353, 220, 18, 353, 220, 17, 353, 856, 608, 220, 17, 608, 220, 18, 1827, 15454, 543, 262, 2060, 17586, 10714...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_generic_enum_unit() { assert_tokens( &GenericEnum::Unit::<u32, u32>, &[Token::UnitVariant { name: "GenericEnum", variant: "Unit", }], ); }
rust_cleaned_test_functions.jsonl/56429
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 122 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 41232, 31054, 14832, 368, 341, 262, 2060, 28838, 1006, 286, 609, 19964, 10766, 486, 4562, 27638, 84, 18, 17, 11, 575, 18, 17, 12520, 286, 44590, 3323, 486, 4562, 20746, 341, 310, 829, 25, 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
#[test] fn test_leader_prng() { let mut rng = TestRng::new(); // Repeat a few times to make it likely that the inner loop runs more than once. for _ in 0..10 { let upper = rng.gen_range(1, u64::MAX); let seed = rng.next_u64(); let mut prng = ChaCha8Rng::seed_from_u64(seed); let zone = upper << upper.leading_zeros(); // A multiple of upper that fits into a u64. let expected = loop { let prod = (prng.next_u64() as u128) * (upper as u128); if (prod as u64) < zone { break (prod >> 64) as u64 + 1; } }; assert_eq!(expected, leader_prng(upper, seed)); } }
rust_cleaned_test_functions.jsonl/22512
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 405 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 79991, 5294, 968, 368, 341, 262, 1077, 5206, 28422, 284, 3393, 49, 968, 486, 931, 1428, 262, 442, 44801, 264, 2421, 3039, 311, 1281, 432, 4363, 429, 279, 9179, 6337, 8473, 803, 1091, 3055, 624, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_iter() { let schema = iter_schema(); // test schema iterator and field accessor match up for (i, (iter_col_type, iter_field)) in schema.iter().enumerate() { let (col_type, field) = schema.field(i); assert_eq!(iter_col_type, col_type); assert_eq!(iter_field, field); } assert_eq!(schema.iter().count(), 6); }
rust_cleaned_test_functions.jsonl/44070
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 197 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11723, 368, 341, 286, 1077, 10802, 284, 5367, 25371, 1428, 286, 442, 1273, 10802, 15091, 323, 2070, 44384, 2432, 705, 198, 286, 369, 320, 72, 11, 320, 2015, 10211, 1819, 11, 5367, 5013, 593, 304...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_tunneled_secure_channel_works() { let (mut ctx, mut executor) = ockam_node::start_node(); executor .execute(async move { let vault = Vault::create(&ctx).unwrap(); let mut alice = Entity::create(&ctx, &vault).unwrap(); let mut bob = Entity::create(&ctx, &vault).unwrap(); let alice_trust_policy = TrustIdentifierPolicy::new(bob.identifier().unwrap()); let bob_trust_policy = TrustIdentifierPolicy::new(alice.identifier().unwrap()); bob.create_secure_channel_listener("bob_listener", bob_trust_policy.clone()) .unwrap(); let alice_channel = alice .create_secure_channel(route!["bob_listener"], alice_trust_policy.clone()) .unwrap(); bob.create_secure_channel_listener("bob_another_listener", bob_trust_policy) .unwrap(); let alice_another_channel = alice .create_secure_channel( route![alice_channel, "bob_another_listener"], alice_trust_policy, ) .unwrap(); ctx.send( route![alice_another_channel, ctx.address()], "Hello, Bob!".to_string(), ) .await .unwrap(); let msg = ctx.receive::<String>().await.unwrap().take(); let return_route = msg.return_route(); assert_eq!("Hello, Bob!", msg.body()); ctx.send(return_route, "Hello, Alice!".to_string()) .await .unwrap(); assert_eq!( "Hello, Alice!", ctx.receive::<String>().await.unwrap().take().body() ); ctx.stop().await.unwrap(); }) .unwrap(); }
rust_cleaned_test_functions.jsonl/46787
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1130 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 528, 359, 811, 832, 73088, 14571, 11498, 82, 368, 341, 286, 1077, 320, 6984, 5635, 11, 5206, 31558, 8, 284, 297, 377, 309, 5084, 486, 2468, 5084, 543, 286, 31558, 198, 310, 659, 10257, 18285, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_matrix_fmt_display() { let mat1 = mat![ [0.0, 1.0, 2.0, 3.0], [4.0, 5.0, 6.0, 7.0], [8.0, 9.0, 10.0, 11.0] ]; println!("{}", mat1); assert_eq!( format!("{}", mat1), "\n[0.0, 1.0, 2.0, 3.0]\n[4.0, 5.0, 6.0, 7.0]\n[8.0, 9.0, 10.0, 11.0]" ); }
rust_cleaned_test_functions.jsonl/108525
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 241 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10193, 38128, 14825, 368, 341, 286, 1077, 5517, 16, 284, 5517, 90515, 298, 197, 58, 15, 13, 15, 11, 220, 16, 13, 15, 11, 220, 17, 13, 15, 11, 220, 220, 18, 13, 15, 1259, 298, 197, 58, 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_printf() { let args = ["--printf=123%-# 15q\\r\\\"\\\\\\a\\b\\e\\f\\v%+020.23m\\x12\\167\\132\\112\\n", "/"]; new_ucmd!().args(&args) .run() .stdout_is(expected_result(&args)); }
rust_cleaned_test_functions.jsonl/36727
{ "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, 21823, 368, 341, 262, 1077, 2827, 284, 4383, 313, 2517, 28, 16, 17, 18, 42973, 2, 220, 16, 20, 80, 3422, 81, 3422, 2105, 51007, 3422, 64, 3422, 65, 3422, 68, 3422, 69, 3422, 85, 4, 10, 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_watch_devices_add_remove_phy() { let mut exec = fasync::TestExecutor::new().expect("failed to create an executor"); let test_values = test_setup(); let watcher_fut = test_values.watcher_fut; pin_mut!(watcher_fut); let service_fut = serve_monitor_requests( test_values.monitor_req_stream, test_values.phys.clone(), test_values.ifaces.clone(), test_values.watcher_service, test_values.dev_proxy, ); pin_mut!(service_fut); assert_variant!(exec.run_until_stalled(&mut service_fut), Poll::Pending); // Watch for new devices. let (watcher_proxy, watcher_server_end) = fidl::endpoints::create_proxy().expect("failed to create watcher proxy"); test_values .monitor_proxy .watch_devices(watcher_server_end) .expect("failed to watch devices"); // Progress the service loop. assert_variant!(exec.run_until_stalled(&mut service_fut), Poll::Pending); // Initially there should be no devices and the future should be pending. let mut events_fut = watcher_proxy.take_event_stream(); let next_fut = events_fut.try_next(); pin_mut!(next_fut); assert_variant!(exec.run_until_stalled(&mut next_fut), Poll::Pending); // Add a PHY and make sure the update is received. let (phy, _phy_stream) = fake_phy(); test_values.phys.insert(0, phy); assert_variant!(exec.run_until_stalled(&mut watcher_fut), Poll::Pending); assert_variant!( exec.run_until_stalled(&mut next_fut), Poll::Ready(Ok(Some(fidl_svc::DeviceWatcherEvent::OnPhyAdded { phy_id: 0 }))) ); // Remove the PHY and make sure the update is received. test_values.phys.remove(&0); assert_variant!(exec.run_until_stalled(&mut watcher_fut), Poll::Pending); assert_variant!( exec.run_until_stalled(&mut next_fut), Poll::Ready(Ok(Some(fidl_svc::DeviceWatcherEvent::OnPhyRemoved { phy_id: 0 }))) ); }
rust_cleaned_test_functions.jsonl/20590
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 984 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 58562, 41334, 2891, 18193, 50266, 368, 341, 286, 1077, 5206, 3883, 284, 282, 7692, 486, 2271, 25255, 486, 931, 1005, 17119, 445, 16091, 311, 1855, 458, 31558, 797, 286, 1077, 1273, 9146, 284, 1273...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_streaming_vectors() { // test vectors from the Python implementation use std::fs::File; use std::io::{BufRead, BufReader}; let r = BufReader::new(File::open("testvectors/ed25519.input").unwrap()); for mline in r.lines() { let line = mline.unwrap(); let mut x = line.split(':'); let x0 = x.next().unwrap(); let x1 = x.next().unwrap(); let x2 = x.next().unwrap(); let seed_bytes = hex::decode(&x0[..64]).unwrap(); assert!(seed_bytes.len() == SEEDBYTES); let mut seed = Seed([0u8; SEEDBYTES]); for (s, b) in seed.0.iter_mut().zip(seed_bytes.iter()) { *s = *b } let (pk, sk) = keypair_from_seed(&seed); let m = hex::decode(x2).unwrap(); let mut creation_state = State::init(); creation_state.update(&m); let sig = creation_state.finalize(&sk); let mut validator_state = State::init(); validator_state.update(&m); assert!(validator_state.verify(&sig, &pk)); assert_eq!(x1, hex::encode(pk)); } }
rust_cleaned_test_functions.jsonl/11403
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 639 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 12673, 287, 49158, 368, 341, 286, 442, 1273, 22879, 504, 279, 13027, 8129, 8945, 286, 990, 1460, 486, 3848, 486, 1703, 280, 286, 990, 1460, 486, 815, 22964, 15064, 4418, 11, 69013, 5062, 2315, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_get_range_entries_and_versions() { let path = TempDir::new("_test_get_range_entries_and_versions").expect(""); let path_str = path.path().to_str().unwrap(); let db_opts = DBOptions::new(); let mut cf_opts = ColumnFamilyOptions::new(); cf_opts.set_level_zero_file_num_compaction_trigger(10); let f = Box::new(MvccPropertiesCollectorFactory::default()); cf_opts.add_table_properties_collector_factory("tikv.mvcc-properties-collector", f); let cfs_opts = LARGE_CFS .iter() .map(|cf| CFOptions::new(cf, cf_opts.clone())) .collect(); let db = rocks::util::new_engine_opt(path_str, db_opts, cfs_opts).unwrap(); let cases = ["a", "b", "c"]; for &key in &cases { let k1 = keys::data_key(Key::from_raw(key.as_bytes()).append_ts(2).as_encoded()); let write_cf = db.cf_handle(CF_WRITE).unwrap(); db.put_cf(write_cf, &k1, b"v1").unwrap(); db.delete_cf(write_cf, &k1).unwrap(); let key = keys::data_key(Key::from_raw(key.as_bytes()).append_ts(3).as_encoded()); db.put_cf(write_cf, &key, b"v2").unwrap(); db.flush_cf(write_cf, true).unwrap(); } let start_keys = keys::data_key(&[]); let end_keys = keys::data_end_key(&[]); let cf = rocks::util::get_cf_handle(&db, CF_WRITE).unwrap(); let (entries, versions) = get_range_entries_and_versions(&db, cf, &start_keys, &end_keys).unwrap(); assert_eq!(entries, (cases.len() * 2) as u64); assert_eq!(versions, cases.len() as u64); }
rust_cleaned_test_functions.jsonl/86354
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 821 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 9698, 26092, 8378, 65148, 368, 341, 286, 1077, 1815, 284, 19944, 6184, 486, 931, 16975, 1944, 3062, 9698, 26092, 8378, 65148, 1827, 17119, 13056, 286, 1077, 1815, 2895, 284, 1815, 3875, 1005, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_remove_legacy_attributes() { let mut event = Annotated::new(Event { other: { let mut other = Object::new(); other.insert("applecrashreport".to_string(), Value::U64(42).into()); other.insert("device".to_string(), Value::U64(42).into()); other.insert("repos".to_string(), Value::U64(42).into()); other.insert("query".to_string(), Value::U64(42).into()); other }, ..Default::default() }); process_value( &mut event, &mut RemoveOtherProcessor, ProcessingState::root(), ) .unwrap(); assert!(event.value().unwrap().other.is_empty()); }
rust_cleaned_test_functions.jsonl/14150
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 321 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 18193, 97555, 18240, 368, 341, 262, 1077, 5206, 1538, 284, 1527, 87029, 486, 931, 30469, 341, 286, 1008, 25, 341, 310, 1077, 5206, 1008, 284, 3002, 486, 931, 543, 310, 1008, 7030, 445, 22377, 50...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_vietnamese_bug() { let original: String = "ậ…".to_string(); let normalized = "a...".to_string(); assert_ne!(original, normalized); let mut n = NormalizedString::from(original); NFKD.normalize(&mut n).unwrap(); StripAccents.normalize(&mut n).unwrap(); assert_eq!(&n.get(), &normalized); Lowercase.normalize(&mut n).unwrap(); assert_eq!(&n.get(), &normalized); let original: String = "Cụ thể, bạn sẽ tham gia một nhóm các giám đốc điều hành tổ chức, các nhà lãnh đạo doanh nghiệp, các học giả, chuyên gia phát triển và tình nguyện viên riêng biệt trong lĩnh vực phi lợi nhuận…".to_string(); let normalized = "cu the, ban se tham gia mot nhom cac giam đoc đieu hanh to chuc, cac nha lanh đao doanh nghiep, cac hoc gia, chuyen gia phat trien va tinh nguyen vien rieng biet trong linh vuc phi loi nhuan...".to_string(); let mut n = NormalizedString::from(original); NFKD.normalize(&mut n).unwrap(); StripAccents.normalize(&mut n).unwrap(); Lowercase.normalize(&mut n).unwrap(); assert_eq!(&n.get(), &normalized); }
rust_cleaned_test_functions.jsonl/42845
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 603 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2273, 3891, 43419, 73232, 368, 341, 286, 1077, 4024, 25, 923, 284, 330, 23458, 1940, 3263, 983, 3904, 543, 286, 1077, 29410, 284, 330, 64, 1112, 3263, 983, 3904, 543, 286, 2060, 13925, 10297, 98...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_calc_crc() { let msg = vec![0x01, 0x03, 0x08, 0x2B, 0x00, 0x02]; assert_eq!(calc_crc(&msg), 0xB663); let msg = vec![0x01, 0x03, 0x04, 0x00, 0x20, 0x00, 0x00]; assert_eq!(calc_crc(&msg), 0xFBF9); }
rust_cleaned_test_functions.jsonl/17493
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 160 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 38241, 59084, 368, 341, 286, 1077, 3750, 284, 7486, 20703, 15, 87, 15, 16, 11, 220, 15, 87, 15, 18, 11, 220, 15, 87, 15, 23, 11, 220, 15, 87, 17, 33, 11, 220, 15, 87, 15, 15, 11, 220, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_from_str() { let address = Address::from_str("8b45e4bd1c6acb88bebf6407d16205f567e62a3e").unwrap(); assert_eq!(address.to_str(), "8b45e4bd1c6acb88bebf6407d16205f567e62a3e"); }
rust_cleaned_test_functions.jsonl/6514
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 120 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5673, 2895, 368, 341, 286, 1077, 2621, 284, 9177, 486, 1499, 2895, 445, 23, 65, 19, 20, 68, 19, 8940, 16, 66, 21, 97471, 23, 23, 1371, 13233, 21, 19, 15, 22, 67, 16, 21, 17, 15, 20, 69, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_cp_numbered_if_existing_backup_existing() { let (at, mut ucmd) = at_and_ucmd!(); let existing_backup = &*format!("{}.~1~", TEST_HOW_ARE_YOU_SOURCE); at.touch(existing_backup); ucmd.arg("--backup=existing") .arg(TEST_HELLO_WORLD_SOURCE) .arg(TEST_HOW_ARE_YOU_SOURCE) .succeeds() .no_stderr(); assert!(at.file_exists(TEST_HOW_ARE_YOU_SOURCE)); assert!(at.file_exists(existing_backup)); assert_eq!( at.read(&*format!("{}.~2~", TEST_HOW_ARE_YOU_SOURCE)), "How are you?\n" ); }
rust_cleaned_test_functions.jsonl/21256
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 290 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 39811, 5500, 291, 11119, 62630, 44710, 62630, 368, 341, 262, 1077, 320, 266, 11, 5206, 575, 8710, 8, 284, 518, 8378, 68887, 2277, 0, 543, 262, 1077, 6350, 44710, 284, 609, 9, 2243, 17223, 46391,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_2015_logv_macros() { let v = true; logv!(target: "special", Level::Trace, v); tracev!(v); debugv!(v); infov!("prefix", v); warnv!("prefix", "{:?}", v); assert!(errorv!(v)); }
rust_cleaned_test_functions.jsonl/60582
{ "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, 62, 17, 15, 16, 20, 5224, 85, 85904, 368, 341, 262, 1077, 348, 284, 830, 280, 262, 1487, 85, 10297, 5657, 25, 330, 15144, 497, 9395, 486, 6550, 11, 348, 317, 262, 11655, 85, 10297, 85, 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_send_invite_set_values_and_post(){ init!("false"); let (user_did, user_vk) = create_and_store_my_did(None).unwrap(); let (agent_did, agent_vk) = create_and_store_my_did(Some(MY2_SEED)).unwrap(); let (my_did, my_vk) = create_and_store_my_did(Some(MY1_SEED)).unwrap(); let (agency_did, agency_vk) = create_and_store_my_did(Some(MY3_SEED)).unwrap(); settings::set_config_value(settings::CONFIG_AGENCY_VERKEY, &agency_vk); settings::set_config_value(settings::CONFIG_REMOTE_TO_SDK_VERKEY, &agent_vk); settings::set_config_value(settings::CONFIG_SDK_TO_REMOTE_VERKEY, &my_vk); let msg = send_invite() .to(&user_did) .to_vk(&user_vk) .agent_did(&agent_did) .agent_vk(&agent_vk) .phone_number(&Some("phone".to_string())) .key_delegate("key") .msgpack().unwrap(); assert!(msg.len() > 0); }
rust_cleaned_test_functions.jsonl/126970
{ "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, 13565, 94910, 2602, 9146, 8378, 6333, 3032, 286, 2930, 17223, 3849, 797, 286, 1077, 320, 872, 814, 307, 11, 1196, 89852, 8, 284, 1855, 8378, 14809, 35686, 814, 307, 26717, 568, 15454, 543, 286, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_parse_valid_redshift_describe_cluster_parameter_groups() { let mock_response = MockResponseReader::read_response( "test_resources/generated/valid", "redshift-describe-cluster-parameter-groups.xml", ); let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response); let client = RedshiftClient::new(mock, MockCredentialsProvider, rusoto_region::UsEast1); let request = DescribeClusterParameterGroupsMessage::default(); let result = client.describe_cluster_parameter_groups(request).sync(); assert!(result.is_ok(), "parse error: {:?}", result); }
rust_cleaned_test_functions.jsonl/12109
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 263 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 8337, 26058, 13418, 15768, 3114, 28441, 24899, 21148, 368, 341, 286, 1077, 7860, 9655, 284, 14563, 2582, 5062, 486, 878, 9655, 1006, 310, 330, 1944, 35569, 79372, 14, 1891, 756, 310, 330, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_address_format() { assert_eq!("ff02::1", format!("{}", Address::LINK_LOCAL_ALL_NODES)); assert_eq!("fe80::1", format!("{}", LINK_LOCAL_ADDR)); assert_eq!("fe80::7f00:0:1", format!("{}", Address::new(0xfe80, 0, 0, 0, 0, 0x7f00, 0x0000, 0x0001))); assert_eq!("::", format!("{}", Address::UNSPECIFIED)); assert_eq!("::1", format!("{}", Address::LOOPBACK)); #[cfg(feature = "proto-ipv4")] assert_eq!("::ffff:192.168.1.1", format!("{}", Address::from(Ipv4Address::new(192, 168, 1, 1)))); }
rust_cleaned_test_functions.jsonl/91022
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 402 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6744, 8955, 368, 341, 286, 2060, 10714, 17223, 542, 15, 17, 486, 16, 756, 4293, 3561, 79878, 9177, 486, 35956, 28399, 16269, 92948, 1106, 286, 2060, 10714, 17223, 1859, 23, 15, 486, 16, 756, 429...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_g1_serialization_roundtrip() { let mut rng = XorShiftRng::from_seed([ 0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc, 0xe5, ]); for _ in 0..100 { let el: G1Affine = G1Projective::random(&mut rng).into(); let c = el.to_compressed(); assert_eq!(G1Affine::from_compressed(&c).unwrap(), el); assert_eq!(G1Affine::from_compressed_unchecked(&c).unwrap(), el); let u = el.to_uncompressed(); assert_eq!(G1Affine::from_uncompressed(&u).unwrap(), el); assert_eq!(G1Affine::from_uncompressed_unchecked(&u).unwrap(), el); let c = el.to_bytes(); assert_eq!(G1Affine::from_bytes(&c).unwrap(), el); assert_eq!(G1Affine::from_bytes_unchecked(&c).unwrap(), el); let el = G1Projective::random(&mut rng); let c = el.to_compressed(); assert_eq!(G1Projective::from_compressed(&c).unwrap(), el); assert_eq!(G1Projective::from_compressed_unchecked(&c).unwrap(), el); let u = el.to_uncompressed(); assert_eq!(G1Projective::from_uncompressed(&u).unwrap(), el); assert_eq!(G1Projective::from_uncompressed_unchecked(&u).unwrap(), el); let c = el.to_bytes(); assert_eq!(G1Projective::from_bytes(&c).unwrap(), el); assert_eq!(G1Projective::from_bytes_unchecked(&c).unwrap(), el); } }
rust_cleaned_test_functions.jsonl/10323
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 794 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1889, 16, 25602, 2022, 29896, 32981, 368, 341, 286, 1077, 5206, 28422, 284, 1599, 269, 24841, 49, 968, 486, 1499, 33809, 8956, 310, 220, 15, 87, 20, 24, 11, 220, 15, 87, 21, 17, 11, 220, 15,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_verify_alloc() { use crate::bytes::complete::take; let mut parser1 = verify(map(take(3u8), |s: &[u8]| s.to_vec()), |s: &[u8]| { s == &b"abc"[..] }); assert_eq!(parser1(&b"abcd"[..]), Ok((&b"d"[..], (&b"abc").to_vec()))); assert_eq!( parser1(&b"defg"[..]), Err(Err::Error((&b"defg"[..], ErrorKind::Verify))) ); }
rust_cleaned_test_functions.jsonl/120444
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 197 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 35638, 14802, 368, 341, 262, 990, 17717, 486, 9651, 486, 14737, 486, 22769, 280, 262, 1077, 5206, 6729, 16, 284, 10146, 9147, 1155, 726, 7, 18, 84, 23, 701, 760, 82, 25, 44590, 84, 23, 29685, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_open_qasm() { let bit_names = [String::from("qb")]; let qasm = Y::new().open_qasm(&bit_names, &[0]); assert_eq!(qasm, Ok(String::from("y qb"))); }
rust_cleaned_test_functions.jsonl/21203
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 107 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11311, 8976, 10530, 741, 262, 341, 286, 1077, 2699, 9187, 284, 508, 703, 486, 1499, 445, 49698, 899, 935, 286, 1077, 2804, 10530, 284, 809, 486, 931, 1005, 2508, 8976, 10530, 2099, 4489, 9187, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_invoke_pay_from_sender() { solana_logger::setup(); let amount_to_mint = 42; let accounts = mint_coins(amount_to_mint).unwrap(); let mut accounts_iter = accounts.iter(); let _script = next_libra_account(&mut accounts_iter).unwrap(); let genesis = next_libra_account(&mut accounts_iter).unwrap(); let sender = next_libra_account(&mut accounts_iter).unwrap(); let code = " import 0x0.LibraAccount; import 0x0.LibraCoin; main(payee: address, amount: u64) { LibraAccount.pay_from_sender(move(payee), move(amount)); return; } "; let script = LibraAccount::create_script(&genesis.address, code, vec![]); let payee = LibraAccount::create_unallocated(BIG_ENOUGH); let keyed_accounts = vec![KeyedAccount::new(&script.key, true, &script.account)]; MoveProcessor::do_finalize(&keyed_accounts).unwrap(); let keyed_accounts = vec![ KeyedAccount::new(&script.key, true, &script.account), KeyedAccount::new(&genesis.key, false, &genesis.account), KeyedAccount::new(&sender.key, false, &sender.account), KeyedAccount::new(&payee.key, false, &payee.account), ]; let amount = 2; MoveProcessor::do_invoke_main( &keyed_accounts, sender.address.clone(), "main".to_string(), vec![ TransactionArgument::Address(payee.address.clone()), TransactionArgument::U64(amount), ], ) .unwrap(); let data_store = MoveProcessor::keyed_accounts_to_data_store(&keyed_accounts[1..]).unwrap(); let sender_resource = data_store.read_account_resource(&sender.address).unwrap(); let payee_resource = data_store.read_account_resource(&payee.address).unwrap(); assert_eq!(amount_to_mint - amount, sender_resource.balance()); assert_eq!(0, sender_resource.sequence_number()); assert_eq!(amount, payee_resource.balance()); assert_eq!(0, payee_resource.sequence_number()); }
rust_cleaned_test_functions.jsonl/71388
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 999 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 79779, 28925, 5673, 54356, 368, 341, 286, 2048, 3362, 27413, 486, 15188, 543, 286, 1077, 3311, 2346, 717, 396, 284, 220, 19, 17, 280, 286, 1077, 9618, 284, 28337, 11393, 1330, 33989, 2346, 717, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_return_data_and_log_data_syscall() { solana_logger::setup(); let mut programs = Vec::new(); #[cfg(feature = "bpf_c")] { programs.extend_from_slice(&[("log_data")]); } #[cfg(feature = "bpf_rust")] { programs.extend_from_slice(&[("solana_bpf_rust_log_data")]); } for program in programs.iter() { let GenesisConfigInfo { genesis_config, mint_keypair, .. } = create_genesis_config(50); let mut bank = Bank::new_for_tests(&genesis_config); let (name, id, entrypoint) = solana_bpf_loader_program!(); bank.add_builtin(&name, &id, entrypoint); let bank = Arc::new(bank); let bank_client = BankClient::new_shared(&bank); let program_id = load_bpf_program(&bank_client, &bpf_loader::id(), &mint_keypair, program); bank.freeze(); let account_metas = vec![AccountMeta::new(mint_keypair.pubkey(), true)]; let instruction = Instruction::new_with_bytes(program_id, &[1, 2, 3, 0, 4, 5, 6], account_metas); let blockhash = bank.last_blockhash(); let message = Message::new(&[instruction], Some(&mint_keypair.pubkey())); let transaction = Transaction::new(&[&mint_keypair], message, blockhash); let sanitized_tx = SanitizedTransaction::from_transaction_for_tests(transaction); let result = bank.simulate_transaction(sanitized_tx); assert!(result.result.is_ok()); assert_eq!(result.logs[1], "Program data: AQID BAUG"); assert_eq!( result.logs[3], format!("Program return: {} CAFE", program_id) ); } }
rust_cleaned_test_functions.jsonl/8824
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 762 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 12511, 1769, 8378, 5224, 1769, 20344, 6659, 368, 341, 262, 2048, 3362, 27413, 486, 15188, 1428, 262, 1077, 5206, 7468, 284, 11312, 486, 931, 543, 262, 11506, 14072, 27062, 284, 330, 65, 15897, 666...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_scheme_ftv() { let s = Scheme { vars: vec![String::from("b")], t: Box::new(Type::Fun( Box::new(Type::var("a")), Box::new(Type::var("b")), )), }; assert_eq!(s.ftv(), HashSet::singleton(String::from("a"))); }
rust_cleaned_test_functions.jsonl/125810
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 194 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 53293, 41572, 85, 368, 341, 286, 1077, 274, 284, 43781, 341, 310, 19942, 25, 7486, 20703, 703, 486, 1499, 445, 65, 899, 1259, 310, 259, 25, 8261, 486, 931, 22498, 486, 30855, 1006, 394, 8261, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_multi_task() { let pool = MultiTaskRuntimeBuilder::default(); let rt = pool.build(); let mut ids = Vec::with_capacity(50); for index in 0..100 { let uid = rt.alloc(); let uid_copy = uid.clone(); let value = SyncUsize(Arc::new(RefCell::new(index))); let future = TestFuture1::new(rt.clone(), value.clone(), uid.clone()); if let Err(e) = rt.spawn(uid.clone(), async move { println!("!!!!!!async task start, uid: {:?}", uid_copy); let r = future.await; println!("!!!!!!async task finish, uid: {:?}, r: {:?}", uid_copy, r); }) { println!("!!!> spawn task failed, uid: {:?}, reason: {:?}", uid, e); } if index % 2 == 0 { ids.push((uid, value)); } } thread::sleep(Duration::from_millis(3000)); for (id, value) in ids { let id_copy = id.clone(); let uid = rt.alloc(); let rt_copy = rt.clone(); if let Err(e) = rt.spawn(uid.clone(), async move { rrow_mut() += 1; rt_copy.wakeup(&id_copy); }) { println!("!!!> spawn waker failed, id: {:?}, uid: {:?}, reason: {:?}", id, uid, e); } } thread::sleep(Duration::from_millis(100000000)); }
rust_cleaned_test_functions.jsonl/62454
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 683 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 25133, 12184, 368, 972, 262, 1077, 7314, 284, 17439, 6262, 15123, 3297, 486, 2258, 1647, 262, 1077, 16677, 284, 7314, 13239, 7317, 262, 1077, 5206, 14151, 284, 11312, 486, 4197, 35603, 7, 20, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
#[test] fn test_no_insert_but_modify_slot_meta() { // This tests correctness of the SlotMeta in various cases in which a shred // that gets filtered out by checks let (shreds0, _) = make_slot_entries(0, 0, 200); let ledger_path = get_tmp_ledger_path_auto_delete!(); let blockstore = Blockstore::open(ledger_path.path()).unwrap(); blockstore .insert_shreds(shreds0[0..5].to_vec(), None, false) .unwrap(); // for 's'. let (mut shreds2, _) = make_slot_entries(2, 0, 200); let (mut shreds3, _) = make_slot_entries(3, 0, 200); shreds2.push(shreds0[1].clone()); shreds3.insert(0, shreds0[1].clone()); blockstore.insert_shreds(shreds2, None, false).unwrap(); let slot_meta = blockstore.meta(0).unwrap().unwrap(); assert_eq!(slot_meta.next_slots, vec![2]); blockstore.insert_shreds(shreds3, None, false).unwrap(); let slot_meta = blockstore.meta(0).unwrap().unwrap(); assert_eq!(slot_meta.next_slots, vec![2, 3]); }
rust_cleaned_test_functions.jsonl/9554
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 534 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6536, 17678, 86874, 57725, 27563, 13381, 368, 341, 286, 442, 1096, 7032, 57323, 315, 279, 31316, 12175, 304, 5257, 5048, 304, 892, 264, 97762, 198, 286, 442, 429, 5221, 18293, 700, 553, 12341, 198...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_public_encrypt() { let k0 = super::Rsa::generate(512).unwrap(); let k0pkey = k0.private_key_to_pem().unwrap(); let k1 = super::Rsa::private_key_from_pem(&k0pkey).unwrap(); let msg = vec![0xdeu8, 0xadu8, 0xd0u8, 0x0du8]; let mut emesg = vec![0; k0.size()]; k0.public_encrypt(&msg, &mut emesg, PKCS1_PADDING).unwrap(); let mut dmesg = vec![0; k1.size()]; let len = k1.private_decrypt(&emesg, &mut dmesg, PKCS1_PADDING).unwrap(); assert_eq!(msg, &dmesg[..len]); }
rust_cleaned_test_functions.jsonl/6929
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 299 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 27074, 66593, 368, 341, 286, 1077, 595, 15, 284, 2256, 486, 49, 9081, 486, 19366, 7, 20, 16, 17, 568, 15454, 543, 286, 1077, 595, 15, 79, 792, 284, 595, 15, 61603, 3097, 2346, 620, 336, 1005...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_plan_with_join() { // TODO let clause_a = Clause::new(Unbound("a".into()), Bound(Ident::Entity(Entity(1))), Unbound("b".into())); let clause_b = Clause::new(Unbound("c".into()), Bound(Ident::Entity(Entity(2))), Unbound("d".into())); let clause_c = Clause::new(Unbound("b".into()), Bound(Ident::Entity(Entity(3))), Unbound("c".into())); let find = vec!["a".into(), "b".into(), "c".into(), "d".into()]; let query = Query { find: find.clone(), clauses: vec![clause_a.clone(), clause_b.clone(), clause_c.clone()], constraints: vec![], }; let fetch_plan_a = Plan::Fetch(clause_a); let fetch_plan_b = Plan::Fetch(clause_b); let lookup_plan = Plan::LookupEach(Box::new(fetch_plan_a), clause_c); assert_eq!( Plan::for_query(query), Plan::Project(Box::new(Plan::Join(Box::new(lookup_plan), Box::new(fetch_plan_b))), find) ); }
rust_cleaned_test_functions.jsonl/77549
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 480 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 26564, 6615, 31017, 368, 341, 1789, 286, 442, 5343, 198, 286, 1077, 21647, 4306, 284, 55797, 486, 931, 49289, 10891, 445, 64, 3263, 18122, 11858, 37176, 7, 28301, 486, 3030, 33761, 7, 16, 36363, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_public_exponent_constants() { for value in Exponent::ALL_CONSTANTS.iter() { let value: u64 = value.0.into(); assert_eq!(value & 1, 1); assert!(value >= Exponent::_3.0.into()); // The absolute minimum. assert!(value <= Exponent::MAX.0.into()); } }
rust_cleaned_test_functions.jsonl/80905
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 166 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 27074, 2702, 1146, 55642, 368, 341, 286, 369, 897, 304, 1374, 1146, 486, 3919, 23098, 37125, 19471, 368, 341, 310, 1077, 897, 25, 575, 21, 19, 284, 897, 13, 15, 39860, 543, 310, 2060, 10714, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_get_title() { crate::utils::setup_logger(); let mut content = r#"things # RFD 43 Identity and Access Management (IAM) sdfsdf title: https://github.com/oxidecomputer/rfd/pulls/1 dsfsdf sdf authors: nope"#; let mut title = NewRFD::get_title(content).unwrap(); let expected = "Identity and Access Management (IAM)".to_string(); assert_eq!(expected, title); content = r#"sdfsdf = RFD 43 Identity and Access Management (IAM) :title: https://github.com/oxidecomputer/rfd/pulls/1 dsfsdf = RFD 53 Bye sdf :title: nope"#; title = NewRFD::get_title(content).unwrap(); assert_eq!(expected, title); // Add a test to show what happens for rfd 31 where there is no "RFD" in // the title. content = r#"sdfsdf = Identity and Access Management (IAM) :title: https://github.com/oxidecomputer/rfd/pulls/1 dsfsdf sdf :title: nope"#; title = NewRFD::get_title(content).unwrap(); assert_eq!(expected, title); }
rust_cleaned_test_functions.jsonl/2870
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 433 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 6112, 368, 341, 286, 17717, 486, 6031, 486, 15188, 27413, 1428, 286, 1077, 5206, 2213, 284, 435, 55543, 57074, 198, 2, 431, 14596, 220, 19, 18, 26540, 323, 9549, 9551, 320, 73707, 340, 82,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_parsing_default_npm() { let r = req_npm("1.0.0"); assert_eq!(r.to_string(), "=1.0.0".to_string()); assert_match(&r, &["1.0.0"]); assert_not_match(&r, &["0.9.9", "0.10.0", "0.1.0", "1.0.1"]); }
rust_cleaned_test_functions.jsonl/85678
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 160 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 620, 28598, 9993, 1089, 5187, 368, 972, 286, 1077, 435, 284, 4232, 1089, 5187, 445, 16, 13, 15, 13, 15, 15746, 286, 2060, 10714, 10297, 81, 2389, 3904, 1507, 37827, 16, 13, 15, 13, 15, 3263, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_equality() { let a = matrix![1., 2., 3.; 4., 5., 6.]; let a_redux = a.clone(); assert_eq!(a, a_redux); }
rust_cleaned_test_functions.jsonl/55915
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 120 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2204, 10473, 368, 341, 1789, 286, 1077, 264, 284, 6172, 20703, 16, 2572, 220, 17, 2572, 220, 18, 37403, 664, 220, 19, 2572, 220, 20, 2572, 220, 21, 13, 935, 286, 1077, 264, 1288, 12138, 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
#[test] fn test_uniqueness() { do_test_uniqueness(get_builtins(ClusterType::Development)); do_test_uniqueness(get_builtins(ClusterType::Devnet)); do_test_uniqueness(get_builtins(ClusterType::Testnet)); do_test_uniqueness(get_builtins(ClusterType::MainnetBeta)); }
rust_cleaned_test_functions.jsonl/51012
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 131 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4907, 5011, 23709, 368, 341, 286, 653, 4452, 4907, 5011, 23709, 5433, 880, 11227, 1330, 43644, 4993, 929, 486, 39419, 1106, 286, 653, 4452, 4907, 5011, 23709, 5433, 880, 11227, 1330, 43644, 4993, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_one_param_should_only_set_one_query_value() { let params = TopGamesParams::new() .with_limit(10); assert_eq!(params.into_query_string(), "?limit=10"); }
rust_cleaned_test_functions.jsonl/53702
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 104 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11667, 4090, 43378, 18410, 2602, 11667, 5738, 3142, 368, 341, 286, 1077, 3628, 284, 6909, 35807, 4870, 486, 931, 741, 394, 659, 4197, 14763, 7, 16, 15, 317, 286, 2060, 10714, 10297, 3519, 39860, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_peek_var_octet_string() { let tests: &[(Vec<u8>, &[u8])] = &[ (vec![0x00], &[]), (ZERO_LENGTH_VARSTR.clone(), &[]), (ONE_BYTE_VARSTR.clone(), &[0x01]), (TWO_BYTE_VARSTR.clone(), &[0x01, 0x02]), (SIZE_128_VARSTR.clone(), &[0; 128][..]), (SIZE_5678_VARSTR.clone(), &[0; 5678][..]), ]; for (buffer, varstr) in tests { assert_eq!((&buffer[..]).peek_var_octet_string().unwrap(), *varstr,); } assert_eq!( (&[][..]).peek_var_octet_string().unwrap_err().kind(), ErrorKind::UnexpectedEof, ); assert_eq!( (&LENGTH_TOO_HIGH_VARSTR.clone()[..]) .peek_var_octet_string() .unwrap_err() .kind(), ErrorKind::UnexpectedEof, ); }
rust_cleaned_test_functions.jsonl/14909
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 532 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 62, 29107, 4612, 70135, 295, 3904, 368, 341, 286, 1077, 7032, 25, 609, 9697, 10050, 34837, 23, 8066, 44590, 84, 23, 72080, 284, 609, 9640, 310, 320, 4083, 20703, 15, 87, 15, 15, 1125, 609, 129...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_parse_firewall() { let log = "Feb 5 15:05:55 pa-test 1,2021/02/05 15:05:55,0123456789,TRAFFIC,drop,2305,2021/02/05 15:05:55,192.168.2.1,192.168.3.2,0.0.0.0,0.0.0.0,intrazone-default,,,not-applicable,vsys1,untrust,untrust,ethernet1,,Log Collector,2021/02/05 15:05:55,0,1,35861,514,0,0,0x0,udp,deny,102,102,0,1,2021/02/08 16:06:59,0,any,0,3996658540,0x0,192.168.0.0-192.168.255.255,192.168.0.0-192.168.255.255,0,1,0,policy-deny,0,0,0,0,,pa-test,from-policy,,,0,,0,,N/A,0,0,0,0,aa1d1908-68cd-467a-bc90-68a57096ef3b,0,0,,,,,,,"; let log = SiemLog::new(log.to_string(), 0, SiemIp::V4(0)); let siem_log = parse_log(log); match siem_log { Ok(log) => { assert_eq!(log.service(), "TRAFFIC"); assert_eq!( log.field("observer.id"), Some(&SiemField::from_str("0123456789")) ); assert_eq!( log.field("source.ip"), Some(&SiemField::IP(SiemIp::from_ip_str("192.168.2.1").unwrap())) ); assert_eq!( log.field("destination.ip"), Some(&SiemField::IP(SiemIp::from_ip_str("192.168.3.2").unwrap())) ); } Err(_) => assert_eq!(1, 0), } }
rust_cleaned_test_functions.jsonl/87488
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 831 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 45772, 16431, 368, 341, 286, 1077, 1487, 284, 330, 40591, 220, 220, 20, 220, 16, 20, 25, 15, 20, 25, 20, 20, 7106, 16839, 220, 16, 11, 17, 15, 17, 16, 14, 15, 17, 14, 15, 20, 220,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_slash_directions() { let mut pt = PathTransformer::new(); assert_eq!(pt.to_dist(Path::new("C:/a")).unwrap(), "/prefix/disk-C/a"); assert_eq!(pt.to_dist(Path::new("C:\\a")).unwrap(), "/prefix/disk-C/a"); assert_eq!(pt.to_local("/prefix/disk-C/a").unwrap(), Path::new("C:/a")); assert_eq!(pt.disk_mappings().count(), 1); }
rust_cleaned_test_functions.jsonl/129914
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 189 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11886, 988, 25438, 82, 368, 341, 286, 1077, 5206, 10817, 284, 7933, 46358, 486, 931, 543, 286, 2060, 10714, 10297, 417, 2389, 16031, 33030, 486, 931, 445, 34, 14375, 64, 15197, 15454, 1507, 3521, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_take_pod_by_ref_and_ptr() { let cxx = indoc! {" uint32_t take_bob_ref(const Bob& a) { return a.a; } uint32_t take_bob_ptr(const Bob* a) { return a->a; } "}; let hdr = indoc! {" #include <cstdint> struct Bob { uint32_t a; uint32_t b; }; uint32_t take_bob_ref(const Bob& a); uint32_t take_bob_ptr(const Bob* a); "}; let rs = quote! { let a = ffi::Bob { a: 12, b: 13 }; assert_eq!(ffi::take_bob_ref(&a), 12); }; run_test(cxx, hdr, rs, &["take_bob_ref", "take_bob_ptr"], &["Bob"]); }
rust_cleaned_test_functions.jsonl/9736
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 390 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 73261, 85337, 3710, 7793, 8378, 4348, 368, 341, 262, 1077, 272, 4146, 284, 1257, 509, 0, 314, 698, 286, 2622, 18, 17, 528, 1896, 880, 674, 7793, 2741, 14261, 5, 264, 8, 341, 310, 470, 264, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_event_target() { run_in_task(|mut cx| { let mut isolate = setup(); js_check( isolate.execute( "event_target_test.js", include_str!("event_target_test.js"), ), ); if let Poll::Ready(Err(_)) = isolate.poll_unpin(&mut cx) { unreachable!(); } }); }
rust_cleaned_test_functions.jsonl/17117
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 181 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6748, 11123, 368, 341, 262, 1598, 1243, 12184, 22428, 6984, 20716, 91, 341, 414, 1077, 5206, 42123, 284, 6505, 543, 414, 6994, 7200, 1006, 286, 42123, 7769, 1006, 688, 330, 3087, 11123, 4452, 2857...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_rename_dim_error_dim_dot_defined() { const UNDEF_DIM_NAME: &str = "undef_dim"; const DIM_NAME_2: &str = "dim_2"; let mut data_set = DataSet::new(); assert_eq!(0, data_set.num_dims()); assert_eq!(false, data_set.has_unlimited_dim()); assert_eq!(false, data_set.has_dim(UNDEF_DIM_NAME)); assert_eq!(None, data_set.dim_size(UNDEF_DIM_NAME)); assert_eq!(None, data_set.dim_type(UNDEF_DIM_NAME)); assert_eq!(false, data_set.has_dim(DIM_NAME_2)); assert_eq!(None, data_set.dim_size(DIM_NAME_2)); assert_eq!(None, data_set.dim_type(DIM_NAME_2)); // Try to rename an undefined dimension assert_eq!( InvalidDataSet::DimensionNotDefined(UNDEF_DIM_NAME.to_string()), data_set.rename_dim(UNDEF_DIM_NAME, DIM_NAME_2).unwrap_err() ); assert_eq!(0, data_set.num_dims()); assert_eq!(false, data_set.has_unlimited_dim()); assert_eq!(false, data_set.has_dim(UNDEF_DIM_NAME)); assert_eq!(None, data_set.dim_size(UNDEF_DIM_NAME)); assert_eq!(None, data_set.dim_type(UNDEF_DIM_NAME)); assert_eq!(false, data_set.has_dim(DIM_NAME_2)); assert_eq!(None, data_set.dim_size(DIM_NAME_2)); assert_eq!(None, data_set.dim_type(DIM_NAME_2)); }
rust_cleaned_test_functions.jsonl/40514
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 631 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 79399, 10791, 4096, 10791, 30941, 52870, 741, 515, 262, 733, 6643, 13649, 39302, 4708, 25, 609, 495, 284, 330, 16135, 10791, 876, 262, 733, 50859, 4708, 62, 17, 25, 609, 495, 284, 330, 12927, 62...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_bank_cloned_stake_delegations() { let GenesisConfigInfo { mut genesis_config, mint_keypair, .. } = create_genesis_config_with_leader( 123_456_000_000_000, &solana_sdk::pubkey::new_rand(), 123_000_000_000, ); genesis_config.rent = Rent::default(); let bank = Arc::new(Bank::new_for_tests(&genesis_config)); let stake_delegations = bank.stakes_cache.stakes().stake_delegations().clone(); assert_eq!(stake_delegations.len(), 1); // bootstrap validator has // to have a stake delegation let (vote_balance, stake_balance) = { let rent = &bank.rent_collector().rent; let vote_rent_exempt_reserve = rent.minimum_balance(VoteState::size_of()); let stake_rent_exempt_reserve = rent.minimum_balance(StakeState::size_of()); let minimum_delegation = solana_stake_program::get_minimum_delegation(&bank.feature_set); ( vote_rent_exempt_reserve, stake_rent_exempt_reserve + minimum_delegation, ) }; let vote_keypair = Keypair::new(); let mut instructions = vote_instruction::create_account( &mint_keypair.pubkey(), &vote_keypair.pubkey(), &VoteInit { node_pubkey: mint_keypair.pubkey(), authorized_voter: vote_keypair.pubkey(), authorized_withdrawer: vote_keypair.pubkey(), commission: 0, }, vote_balance, ); let stake_keypair = Keypair::new(); instructions.extend(stake_instruction::create_account_and_delegate_stake( &mint_keypair.pubkey(), &stake_keypair.pubkey(), &vote_keypair.pubkey(), &Authorized::auto(&stake_keypair.pubkey()), &Lockup::default(), stake_balance, )); let message = Message::new(&instructions, Some(&mint_keypair.pubkey())); let transaction = Transaction::new( &[&mint_keypair, &vote_keypair, &stake_keypair], message, bank.last_blockhash(), ); bank.process_transaction(&transaction).unwrap(); let stake_delegations = bank.stakes_cache.stakes().stake_delegations().clone(); assert_eq!(stake_delegations.len(), 2); assert!(stake_delegations.get(&stake_keypair.pubkey()).is_some()); }
rust_cleaned_test_functions.jsonl/28904
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1276 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 35733, 6794, 19684, 1261, 726, 2259, 1937, 804, 368, 341, 286, 1077, 40788, 2648, 1731, 341, 310, 5206, 59366, 5332, 345, 310, 28337, 3097, 12670, 345, 310, 54538, 286, 335, 284, 1855, 16322, 1377...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_printing_contextual_errors() { // Build function. let mut func = Function::new(); let block0 = func.dfg.make_block(); func.layout.append_block(block0); let inst = func.dfg.make_inst(InstructionData::UnaryImm { opcode: Opcode::Iconst, imm: 42.into(), }); func.dfg.append_result(inst, types::I32); func.dfg.append_result(inst, types::I32); func.layout.append_inst(inst, block0); // Setup verifier. let mut errors = VerifierErrors::default(); let flags = &settings::Flags::new(settings::builder()); let verifier = Verifier::new(&func, flags.into()); let _ = verifier.typecheck_results(inst, types::I32, &mut errors); assert_eq!( format!("{}", errors.0[0]), "inst0 (v0, v1 = iconst.i32 42): has more result values than expected" ) }
rust_cleaned_test_functions.jsonl/81814
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 457 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10064, 287, 8467, 928, 20196, 368, 341, 286, 442, 7854, 729, 624, 286, 1077, 5206, 2915, 284, 5712, 486, 931, 543, 286, 1077, 2504, 15, 284, 2915, 950, 4817, 10117, 7113, 543, 286, 2915, 7619, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_args_modes() { let args = options("-n -10M -vz").unwrap(); assert!(args.zeroed); assert!(args.verbose); assert_eq!(args.mode, Mode::AllButLastLines(10 * 1024 * 1024)); }
rust_cleaned_test_functions.jsonl/86823
{ "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, 8384, 59724, 368, 341, 286, 1077, 2827, 284, 2606, 13645, 77, 481, 16, 15, 44, 481, 85, 89, 1827, 15454, 543, 286, 2060, 10297, 2116, 25847, 291, 317, 286, 2060, 10297, 2116, 44649, 317, 286, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_access() { let testy = Testy { a: "one".to_owned(), b: "two".to_owned(), }; assert_eq!(testy.a(), &"one"); assert_eq!(testy.b(), &"two"); }
rust_cleaned_test_functions.jsonl/131791
{ "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, 12759, 368, 341, 286, 1077, 1273, 88, 284, 3393, 88, 341, 310, 264, 25, 330, 603, 3263, 983, 51973, 3148, 310, 293, 25, 330, 19789, 3263, 983, 51973, 3148, 286, 3634, 286, 2060, 10714, 10297, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_building_new_segment() { let dir = TempDir::new("segment_dir").unwrap(); let temp_dir = TempDir::new("segment_temp_dir").unwrap(); let segment1 = build_segment_1(dir.path()); let segment2 = build_segment_2(dir.path()); let mut builder = SegmentBuilder::new( dir.path(), temp_dir.path(), &segment1.segment_config ).unwrap(); builder.update_from(&segment1).unwrap(); builder.update_from(&segment2).unwrap(); // Check what happens if segment building fails here let segment_count = dir.path().read_dir().unwrap().count(); assert_eq!(segment_count, 2); let temp_segment_count = temp_dir.path().read_dir().unwrap().count(); assert_eq!(temp_segment_count, 1); // Now we finalize building let merged_segment: Segment = builder.try_into().unwrap(); let new_segment_count = dir.path().read_dir().unwrap().count(); assert_eq!(new_segment_count, 3); assert_eq!(merged_segment.vectors_count(), segment1.vectors_count() + segment2.vectors_count()) }
rust_cleaned_test_functions.jsonl/68921
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 518 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 82397, 5921, 28061, 368, 341, 286, 1077, 5419, 284, 19944, 6184, 486, 931, 445, 23169, 4334, 1827, 15454, 543, 286, 1077, 2730, 4334, 284, 19944, 6184, 486, 931, 445, 23169, 11771, 4334, 1827, 154...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_assign_tuple() { let out: i64 = rune! { struct Bar(baz, padding); struct Foo(padding, bar); pub fn main() { let foo = Foo((), ()); foo.1 = Bar((), ()); (foo.1).0 = 42; (foo.1).0 } }; assert_eq!(out, 42); }
rust_cleaned_test_functions.jsonl/94542
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 185 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 20688, 21773, 368, 341, 262, 1077, 700, 25, 600, 21, 19, 284, 63499, 0, 341, 286, 2036, 4716, 1883, 1370, 11, 5300, 317, 286, 2036, 33428, 90906, 11, 3619, 626, 286, 6675, 5168, 1887, 368, 341...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_integer() { match Variant::VInteger(42).plus(Variant::VInteger(2)).unwrap() { Variant::VInteger(result) => assert_eq!(result, 44), _ => panic!("assertion failed"), } }
rust_cleaned_test_functions.jsonl/84546
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 151 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 31725, 368, 341, 394, 2432, 39292, 486, 53, 3486, 7, 19, 17, 568, 7138, 12410, 15341, 486, 53, 3486, 7, 17, 4579, 15454, 368, 341, 503, 39292, 486, 53, 3486, 4456, 8, 589, 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 ]
2
#[test] fn test_syn_us_hwy() { let context = Context::new( String::from("us"), None, Tokens::new(HashMap::new(), HashMap::new(), HashMap::new()), ); assert_eq!( syn_us_hwy(&Name::new(String::from(""), 0, None, &context), &context), vec![] ); // original name priority == 0 let results = vec![ Name::new( String::from("US Route 81"), 1, Some(Source::Generated), &context, ), Name::new(String::from("US 81"), -1, Some(Source::Generated), &context), Name::new( String::from("US Highway 81"), -1, Some(Source::Generated), &context, ), Name::new( String::from("United States Route 81"), -1, Some(Source::Generated), &context, ), Name::new( String::from("United States Highway 81"), -1, Some(Source::Generated), &context, ), ]; assert_eq!( syn_us_hwy( &Name::new(String::from("us-81"), 0, None, &context), &context ), results ); assert_eq!( syn_us_hwy( &Name::new(String::from("US 81"), 0, None, &context), &context ), results ); assert_eq!( syn_us_hwy( &Name::new(String::from("U.S. Route 81"), 0, None, &context), &context ), results ); assert_eq!( syn_us_hwy( &Name::new(String::from("US Route 81"), 0, None, &context), &context ), results ); assert_eq!( syn_us_hwy( &Name::new(String::from("US Rte 81"), 0, None, &context), &context ), results ); assert_eq!( syn_us_hwy( &Name::new(String::from("US Hwy 81"), 0, None, &context), &context ), results ); assert_eq!( syn_us_hwy( &Name::new(String::from("US Highway 81"), 0, None, &context), &context ), results ); assert_eq!( syn_us_hwy( &Name::new(String::from("United States 81"), 0, None, &context), &context ), results ); assert_eq!( syn_us_hwy( &Name::new(String::from("United States Route 81"), 0, None, &context), &context ), results ); assert_eq!( syn_us_hwy( &Name::new(String::from("United States Highway 81"), 0, None, &context), &context ), results ); assert_eq!( syn_us_hwy( &Name::new(String::from("United States Hwy 81"), 0, None, &context), &context ), results ); // original name priority < 0 let results = vec![ Name::new( String::from("US Route 81"), -1, Some(Source::Generated), &context, ), Name::new(String::from("US 81"), -2, Some(Source::Generated), &context), Name::new( String::from("US Highway 81"), -2, Some(Source::Generated), &context, ), Name::new( String::from("United States Route 81"), -2, Some(Source::Generated), &context, ), Name::new( String::from("United States Highway 81"), -2, Some(Source::Generated), &context, ), ]; assert_eq!( syn_us_hwy( &Name::new(String::from("US Route 81"), -1, None, &context), &context ), results ); // original name priority > 0 let results = vec![ Name::new( String::from("US Route 81"), 2, Some(Source::Generated), &context, ), Name::new(String::from("US 81"), -1, Some(Source::Generated), &context), Name::new( String::from("US Highway 81"), -1, Some(Source::Generated), &context, ), Name::new( String::from("United States Route 81"), -1, Some(Source::Generated), &context, ), Name::new( String::from("United States Highway 81"), -1, Some(Source::Generated), &context, ), ]; assert_eq!( syn_us_hwy( &Name::new(String::from("US Route 81"), 1, None, &context), &context ), results ); }
rust_cleaned_test_functions.jsonl/25030
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 3363 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 51393, 11306, 1523, 22545, 368, 341, 286, 1077, 2266, 284, 9608, 486, 931, 1006, 310, 923, 486, 1499, 445, 355, 4461, 310, 2240, 345, 310, 58166, 486, 931, 7, 18497, 486, 931, 1507, 10528, 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_shrink_fuzz() { for _ in 0..5 { let mut batches = to_packet_batches( &(0..PACKETS_PER_BATCH * 3) .map(|_| test_tx()) .collect::<Vec<_>>(), PACKETS_PER_BATCH, ); batches.iter_mut().for_each(|b| { b.iter_mut() .for_each(|p| p.meta.set_discard(thread_rng().gen())) }); //find all the non discarded packets let mut start = vec![]; batches.iter_mut().for_each(|b| { b.iter_mut() .filter(|p| !p.meta.discard()) .for_each(|p| start.push(p.clone())) }); start.sort_by(|a, b| a.data(..).cmp(&b.data(..))); let packet_count = count_valid_packets(&batches, |_| ()); shrink_batches(&mut batches); //make sure all the non discarded packets are the same let mut end = vec![]; batches.iter_mut().for_each(|b| { b.iter_mut() .filter(|p| !p.meta.discard()) .for_each(|p| end.push(p.clone())) }); end.sort_by(|a, b| a.data(..).cmp(&b.data(..))); let packet_count2 = count_valid_packets(&batches, |_| ()); assert_eq!(packet_count, packet_count2); assert_eq!(start, end); } }
rust_cleaned_test_functions.jsonl/39093
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 861 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3712, 34365, 761, 8889, 368, 341, 286, 369, 716, 304, 220, 15, 496, 20, 341, 310, 1077, 5206, 44792, 284, 311, 21078, 57755, 1006, 394, 22796, 15, 496, 17279, 43167, 10617, 74009, 353, 220, 18, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_indexing() { let mut map = TypedHandleMap::new(); let handle = map.insert(Foobar(5454)); assert_eq!(map[handle].0, 5454); map[handle] = Foobar(6767); assert_eq!(map[handle].0, 6767); }
rust_cleaned_test_functions.jsonl/15920
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 127 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3560, 287, 368, 341, 286, 1077, 5206, 2415, 284, 50554, 6999, 2227, 486, 931, 543, 286, 1077, 3705, 284, 2415, 7030, 7832, 78, 31393, 7, 20, 19, 20, 19, 1106, 286, 2060, 10714, 10297, 2186, 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_take_nonpod_by_value() { let cxx = indoc! {" Bob::Bob(uint32_t a0, uint32_t b0) : a(a0), b(b0) {} uint32_t take_bob(Bob a) { return a.a; } "}; let hdr = indoc! {" #include <cstdint> #include <string> struct Bob { Bob(uint32_t a, uint32_t b); uint32_t a; uint32_t b; std::string reason_why_this_is_nonpod; }; uint32_t take_bob(Bob a); "}; let rs = quote! { let a = ffi::Bob::make_unique(12, 13); assert_eq!(ffi::take_bob(a), 12); }; run_test(cxx, hdr, rs, &["take_bob", "Bob"], &[]); }
rust_cleaned_test_functions.jsonl/9740
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 407 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 73261, 21637, 39073, 3710, 3142, 368, 341, 262, 1077, 272, 4146, 284, 1257, 509, 0, 314, 698, 286, 14261, 486, 32388, 8488, 18, 17, 528, 264, 15, 11, 2622, 18, 17, 528, 293, 15, 340, 1843, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_getrange_function() { ::init().unwrap(); let pad = ::Pad::builder(Some("src"), ::PadDirection::Src) .activate_function(|pad, _parent| { pad.activate_mode(::PadMode::Pull, true) .map_err(|err| err.into()) }) .getrange_function(|_pad, _parent, offset, _buffer, size| { assert_eq!(offset, 0); assert_eq!(size, 5); let buffer = ::Buffer::from_slice(b"abcde"); Ok(PadGetRangeSuccess::NewBuffer(buffer)) }) .build(); pad.set_active(true).unwrap(); let buffer = pad.get_range(0, 5).unwrap(); let map = buffer.map_readable().unwrap(); assert_eq!(&*map, b"abcde"); let mut buffer = ::Buffer::with_size(5).unwrap(); pad.get_range_fill(0, buffer.get_mut().unwrap(), 5).unwrap(); let map = buffer.map_readable().unwrap(); assert_eq!(&*map, b"abcde"); pad.set_active(false).unwrap(); drop(pad); let pad = ::Pad::builder(Some("src"), ::PadDirection::Src) .activate_function(|pad, _parent| { pad.activate_mode(::PadMode::Pull, true) .map_err(|err| err.into()) }) .getrange_function(|_pad, _parent, offset, buffer, size| { assert_eq!(offset, 0); assert_eq!(size, 5); if let Some(buffer) = buffer { buffer.copy_from_slice(0, b"fghij").unwrap(); Ok(PadGetRangeSuccess::FilledBuffer) } else { let buffer = ::Buffer::from_slice(b"abcde"); Ok(PadGetRangeSuccess::NewBuffer(buffer)) } }) .build(); pad.set_active(true).unwrap(); let buffer = pad.get_range(0, 5).unwrap(); let map = buffer.map_readable().unwrap(); assert_eq!(&*map, b"abcde"); let mut buffer = ::Buffer::with_size(5).unwrap(); pad.get_range_fill(0, buffer.get_mut().unwrap(), 5).unwrap(); let map = buffer.map_readable().unwrap(); assert_eq!(&*map, b"fghij"); }
rust_cleaned_test_functions.jsonl/116627
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1165 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 9669, 9174, 368, 341, 286, 3504, 2327, 1005, 15454, 1428, 286, 1077, 11016, 284, 3504, 13731, 486, 17850, 65405, 445, 3548, 3975, 3504, 13731, 9268, 486, 20360, 340, 310, 659, 16856, 9174, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_check_confirmed_block_subscribe() { let exit = Arc::new(AtomicBool::new(false)); let GenesisConfigInfo { genesis_config, mint_keypair, .. } = create_genesis_config(10_000); let bank = Bank::new_for_tests(&genesis_config); let rent_exempt_amount = bank.get_minimum_balance_for_rent_exemption(0); let bank_forks = Arc::new(RwLock::new(BankForks::new(bank))); let optimistically_confirmed_bank = OptimisticallyConfirmedBank::locked_from_bank_forks_root(&bank_forks); let ledger_path = get_tmp_ledger_path!(); let blockstore = Blockstore::open(&ledger_path).unwrap(); let blockstore = Arc::new(blockstore); let max_complete_transaction_status_slot = Arc::new(AtomicU64::default()); let subscriptions = Arc::new(RpcSubscriptions::new_for_tests_with_blockstore( &exit, max_complete_transaction_status_slot, blockstore.clone(), bank_forks.clone(), Arc::new(RwLock::new(BlockCommitmentCache::new_for_tests())), optimistically_confirmed_bank, )); let (rpc, mut receiver) = rpc_pubsub_service::test_connection(&subscriptions); let filter = RpcBlockSubscribeFilter::All; let config = RpcBlockSubscribeConfig { commitment: Some(CommitmentConfig::confirmed()), encoding: Some(UiTransactionEncoding::Json), transaction_details: Some(TransactionDetails::Signatures), show_rewards: None, max_supported_transaction_version: None, }; let params = BlockSubscriptionParams { kind: BlockSubscriptionKind::All, commitment: config.commitment.unwrap(), encoding: config.encoding.unwrap(), transaction_details: config.transaction_details.unwrap(), show_rewards: config.show_rewards.unwrap_or_default(), max_supported_transaction_version: config.max_supported_transaction_version, }; let sub_id = rpc.block_subscribe(filter, Some(config)).unwrap(); subscriptions .control .assert_subscribed(&SubscriptionParams::Block(params.clone())); let bank = bank_forks.read().unwrap().working_bank(); let keypair1 = Keypair::new(); let keypair2 = Keypair::new(); let keypair3 = Keypair::new(); let max_complete_transaction_status_slot = Arc::new(AtomicU64::new(blockstore.max_root())); bank.transfer(rent_exempt_amount, &mint_keypair, &keypair2.pubkey()) .unwrap(); populate_blockstore_for_tests( create_test_transaction_entries( vec![&mint_keypair, &keypair1, &keypair2, &keypair3], bank.clone(), ) .0, bank, blockstore.clone(), max_complete_transaction_status_slot, ); let slot = 0; subscriptions.notify_gossip_subscribers(slot); let actual_resp = receiver.recv(); let actual_resp = serde_json::from_str::<serde_json::Value>(&actual_resp).unwrap(); let confirmed_block = ConfirmedBlock::from(blockstore.get_complete_block(slot, false).unwrap()); let block = confirmed_block .encode_with_options( params.encoding, BlockEncodingOptions { transaction_details: params.transaction_details, show_rewards: false, max_supported_transaction_version: None, }, ) .unwrap(); let expected_resp = RpcBlockUpdate { slot, block: Some(block), err: None, }; let expected_resp = json!({ "jsonrpc": "2.0", "method": "blockNotification", "params": { "result": { "context": { "slot": slot }, "value": expected_resp, }, "subscription": 0, } }); assert_eq!(expected_resp, actual_resp); // should not trigger since commitment NOT set to finalized subscriptions.notify_subscribers(CommitmentSlots { slot, root: slot, highest_confirmed_slot: slot, highest_confirmed_root: slot, }); let should_err = receiver.recv_timeout(Duration::from_millis(300)); assert!(should_err.is_err()); rpc.slot_unsubscribe(sub_id).unwrap(); subscriptions .control .assert_unsubscribed(&SubscriptionParams::Block(params)); }
rust_cleaned_test_functions.jsonl/82532
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2241 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 7200, 16059, 8434, 7113, 88935, 368, 341, 286, 1077, 4869, 284, 19689, 486, 931, 7, 65857, 11233, 486, 931, 3576, 1106, 286, 1077, 40788, 2648, 1731, 341, 310, 59366, 5332, 345, 310, 28337, 3097, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_fib() -> TestResult { let mut p = Polar::new(); p.load_str( r#"fib(0, 1) if cut; fib(1, 1) if cut; fib(n, a+b) if fib(n-1, a) and fib(n-2, b);"#, )?; qvar(&mut p, r#"fib(0, x)"#, "x", values![1]); qvar(&mut p, r#"fib(1, x)"#, "x", values![1]); qvar(&mut p, r#"fib(2, x)"#, "x", values![2]); qvar(&mut p, r#"fib(3, x)"#, "x", values![3]); qvar(&mut p, r#"fib(4, x)"#, "x", values![5]); qvar(&mut p, r#"fib(5, x)"#, "x", values![8]); Ok(()) }
rust_cleaned_test_functions.jsonl/97659
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 320 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 761, 579, 368, 1464, 3393, 2077, 341, 262, 1077, 5206, 281, 284, 55896, 486, 931, 543, 262, 281, 5104, 2895, 1006, 286, 435, 55543, 75326, 7, 15, 11, 220, 16, 8, 421, 3931, 280, 1843, 15801, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_cfg_if_items() { let rules = create_rules( r#" macro_rules! __cfg_if_items { (($($not:meta,)*) ; ) => {}; (($($not:meta,)*) ; ( ($($m:meta),*) ($($it:item)*) ), $($rest:tt)*) => { __cfg_if_items! { ($($not,)* $($m,)*) ; $($rest)* } } } "#, ); assert_expansion(MacroKind::Items, &rules, r#"__cfg_if_items ! { ( rustdoc , ) ; ( ( ) ( # [ cfg ( any ( target_os = "redox" , unix ) ) ] # [ stable ( feature = "rust1" , since = "1.0.0" ) ] pub use sys :: ext as unix ; # [ cfg ( windows ) ] # [ stable ( feature = "rust1" , since = "1.0.0" ) ] pub use sys :: ext as windows ; # [ cfg ( any ( target_os = "linux" , target_os = "l4re" ) ) ] pub mod linux ; ) ) , }"#, "__cfg_if_items ! {(rustdoc ,) ;}"); }
rust_cleaned_test_functions.jsonl/14735
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 407 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 18343, 11119, 12134, 368, 341, 1066, 262, 1077, 5601, 284, 1855, 21407, 1006, 286, 435, 2, 698, 286, 18072, 21407, 0, 1304, 14072, 11119, 12134, 341, 310, 26856, 699, 1921, 25, 5490, 46021, 3764, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_extract_base_url() { let url = url::Url::parse("http://is24.de/test?a=a&b=b").unwrap(); let base_url = extract_base_url(&url); assert_eq!("http://is24.de/test", base_url) }
rust_cleaned_test_functions.jsonl/114227
{ "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, 39123, 7651, 2903, 368, 341, 220, 1077, 2515, 284, 2515, 486, 2864, 486, 6400, 445, 1254, 1110, 285, 17, 19, 2285, 12697, 98461, 24239, 5, 65, 22086, 1827, 15454, 543, 220, 1077, 2331, 2903, 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_datetime_from_timestamp() { let from_timestamp = |secs| NaiveDateTime::from_timestamp_opt(secs, 0); let ymdhms = |y, m, d, h, n, s| NaiveDate::from_ymd(y, m, d).and_hms(h, n, s); assert_eq!(from_timestamp(-1), Some(ymdhms(1969, 12, 31, 23, 59, 59))); assert_eq!(from_timestamp(0), Some(ymdhms(1970, 1, 1, 0, 0, 0))); assert_eq!(from_timestamp(1), Some(ymdhms(1970, 1, 1, 0, 0, 1))); assert_eq!(from_timestamp(1_000_000_000), Some(ymdhms(2001, 9, 9, 1, 46, 40))); assert_eq!(from_timestamp(0x7fffffff), Some(ymdhms(2038, 1, 19, 3, 14, 7))); assert_eq!(from_timestamp(i64::MIN), None); assert_eq!(from_timestamp(i64::MAX), None); }
rust_cleaned_test_functions.jsonl/76819
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 372 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 28943, 5673, 23073, 368, 341, 286, 1077, 504, 23073, 284, 760, 53281, 91, 12812, 533, 7689, 486, 1499, 23073, 15032, 10478, 4837, 11, 220, 15, 317, 286, 1077, 379, 2277, 71, 1011, 284, 760, 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_bitwise_not() { let buf = Buffer::from([0b01101010]); assert_eq!(Buffer::from([0b10010101]), !&buf); }
rust_cleaned_test_functions.jsonl/20570
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 73 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13996, 4482, 7913, 368, 341, 286, 1077, 6607, 284, 10312, 486, 1499, 2561, 15, 65, 15, 16, 16, 15, 16, 15, 16, 15, 2558, 286, 2060, 10714, 10297, 4095, 486, 1499, 2561, 15, 65, 16, 15, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_range_height_1() { // Tests tree with a root and 2 leaves. Depending on details we don't want or need let map: BTreeMap<_, _> = (1..=MIN_INSERTS_HEIGHT_1 as i32).map(|i| (i, i)).collect(); for &root in &[6, 7] { assert_eq!(range_keys(&map, (Excluded(root), Excluded(root + 1))), vec![]); assert_eq!(range_keys(&map, (Excluded(root), Included(root + 1))), vec![root + 1]); assert_eq!(range_keys(&map, (Included(root), Excluded(root + 1))), vec![root]); assert_eq!(range_keys(&map, (Included(root), Included(root + 1))), vec![root, root + 1]); assert_eq!(range_keys(&map, (Excluded(root - 1), Excluded(root))), vec![]); assert_eq!(range_keys(&map, (Included(root - 1), Excluded(root))), vec![root - 1]); assert_eq!(range_keys(&map, (Excluded(root - 1), Included(root))), vec![root]); assert_eq!(range_keys(&map, (Included(root - 1), Included(root))), vec![root - 1, root]); } }
rust_cleaned_test_functions.jsonl/53937
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 427 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9698, 9561, 62, 16, 368, 341, 262, 442, 20150, 4916, 448, 264, 3704, 323, 220, 17, 10901, 13, 39630, 389, 3565, 582, 1513, 944, 1366, 476, 1184, 87079, 262, 1077, 2415, 25, 425, 6533, 2227, 27...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_debug() { let mut src = UpdateInfo::default(); src.0.ucodeUpdate = 1; src.0.csmeFwUpdate = 2; src.0.pswUpdate = 3; assert_eq!( format!("{:?}", &src), "UpdateInfo { ucodeUpdate: i32(1), csmeFwUpdate: i32(2), pswUpdate: i32(3) }", ); }
rust_cleaned_test_functions.jsonl/67476
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 187 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15446, 368, 341, 286, 1077, 5206, 2286, 284, 5549, 1731, 486, 2258, 543, 286, 2286, 13, 15, 56334, 534, 4289, 284, 220, 16, 280, 286, 2286, 13, 15, 18775, 2660, 37, 86, 4289, 284, 220, 17, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1