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_authenticate_verify_bad_key() { let sec_key_correct = SecretKey::generate(64).unwrap(); let sec_key_false = SecretKey::default(); let msg = "what do ya want for nothing?".as_bytes().to_vec(); let mac_bob = authenticate(&sec_key_correct, &msg).unwrap(); assert!(authenticate_verify(&mac_bob, &sec_key_correct, &msg).is_ok()); assert!(authenticate_verify(&mac_bob, &sec_key_false, &msg).is_err()); }
rust_cleaned_test_functions.jsonl/18976
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 179 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14014, 22661, 35638, 34199, 3097, 368, 341, 298, 10217, 5701, 3097, 31550, 284, 8599, 1592, 486, 19366, 7, 21, 19, 568, 15454, 543, 298, 10217, 5701, 3097, 36015, 284, 8599, 1592, 486, 2258, 543, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_invalid_offsets() { solana_logger::setup(); let mut instruction_data = vec![0u8; DATA_START]; let offsets = SecpSignatureOffsets::default(); instruction_data[0] = 1; let writer = std::io::Cursor::new(&mut instruction_data[1..]); bincode::serialize_into(writer, &offsets).unwrap(); instruction_data.truncate(instruction_data.len() - 1); assert_eq!( verify_eth_addresses(&instruction_data, &[&[0u8; 100]]), Err(Secp256k1Error::InvalidInstructionDataSize) ); let offsets = SecpSignatureOffsets { signature_instruction_index: 1, ..SecpSignatureOffsets::default() }; assert_eq!( test_case(1, &offsets), Err(Secp256k1Error::InvalidInstructionDataSize) ); let offsets = SecpSignatureOffsets { message_instruction_index: 1, ..SecpSignatureOffsets::default() }; assert_eq!( test_case(1, &offsets), Err(Secp256k1Error::InvalidDataOffsets) ); let offsets = SecpSignatureOffsets { eth_address_instruction_index: 1, ..SecpSignatureOffsets::default() }; assert_eq!( test_case(1, &offsets), Err(Secp256k1Error::InvalidDataOffsets) ); }
rust_cleaned_test_functions.jsonl/47857
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 692 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 31433, 56924, 368, 341, 286, 2048, 3362, 27413, 486, 15188, 1428, 286, 1077, 5206, 7600, 1769, 284, 7486, 20703, 15, 84, 23, 26, 14112, 13044, 935, 286, 1077, 35046, 284, 4520, 79, 25088, 81095, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_is_python_lib() { assert!(is_python_lib("C:\\Users\\test\\AppData\\Local\\Programs\\Python\\Python37\\python37.dll")); assert!(is_python_lib("C:\\Users\\test\\AppData\\Local\\Programs\\Python\\Python37\\python37.DLL")); }
rust_cleaned_test_functions.jsonl/41253
{ "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, 6892, 55869, 16142, 368, 341, 286, 2060, 10297, 285, 55869, 16142, 445, 34, 23817, 7137, 3422, 1944, 3422, 2164, 1043, 3422, 7319, 3422, 10690, 82, 3422, 30280, 3422, 30280, 18, 22, 3422, 12669, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_timestamp_slots() { let timestamp_sample_range = 5; let ticks_per_slot = 5; // Smaller interval than TIMESTAMP_SLOT_INTERVAL for convenience of building blockstore let timestamp_interval = 7; /* Build a blockstore with < TIMESTAMP_SLOT_RANGE roots */ let blockstore_path = get_tmp_ledger_path!(); let blockstore = Blockstore::open(&blockstore_path).unwrap(); blockstore.set_roots(&[0]).unwrap(); let mut last_entry_hash = Hash::default(); for slot in 0..=3 { let parent = { if slot == 0 { 0 } else { slot - 1 } }; last_entry_hash = fill_blockstore_slot_with_ticks( &blockstore, ticks_per_slot, slot, parent, last_entry_hash, ); } blockstore.set_roots(&[1, 2, 3]).unwrap(); assert_eq!( blockstore.get_timestamp_slots(2, timestamp_interval, timestamp_sample_range), vec![0, 1, 2] ); assert_eq!( blockstore.get_timestamp_slots(3, timestamp_interval, timestamp_sample_range), vec![0, 1, 2, 3] ); drop(blockstore); Blockstore::destroy(&blockstore_path).expect("Expected successful database destruction"); let blockstore_path = get_tmp_ledger_path!(); let blockstore = Blockstore::open(&blockstore_path).unwrap(); blockstore.set_roots(&[0]).unwrap(); let desired_roots = vec![1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 16, 17, 18, 19]; let mut last_entry_hash = Hash::default(); for (i, slot) in desired_roots.iter().enumerate() { let parent = { if i == 0 { 0 } else { desired_roots[i - 1] } }; last_entry_hash = fill_blockstore_slot_with_ticks( &blockstore, ticks_per_slot, *slot, parent, last_entry_hash, ); } blockstore.set_roots(&desired_roots).unwrap(); assert_eq!( blockstore.get_timestamp_slots(2, timestamp_interval, timestamp_sample_range), vec![0, 1, 2] ); assert_eq!( blockstore.get_timestamp_slots(6, timestamp_interval, timestamp_sample_range), vec![0, 1, 2, 3, 4] ); assert_eq!( blockstore.get_timestamp_slots(8, timestamp_interval, timestamp_sample_range), vec![0, 1, 2, 3, 4] ); assert_eq!( blockstore.get_timestamp_slots(13, timestamp_interval, timestamp_sample_range), vec![8, 9, 10, 11, 12] ); assert_eq!( blockstore.get_timestamp_slots(18, timestamp_interval, timestamp_sample_range), vec![8, 9, 10, 11, 12] ); assert_eq!( blockstore.get_timestamp_slots(19, timestamp_interval, timestamp_sample_range), vec![14, 16, 17, 18, 19] ); }
rust_cleaned_test_functions.jsonl/77174
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1745 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 23073, 54161, 368, 341, 286, 1077, 11441, 17491, 9698, 284, 220, 20, 280, 286, 1077, 29957, 5678, 27563, 284, 220, 20, 280, 286, 442, 4388, 13956, 9873, 1091, 92592, 53047, 37353, 369, 19132...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_column_writer_dictionary_fallback_small_data_page() { let props = WriterProperties::builder() .set_dictionary_pagesize_limit(32) .set_data_pagesize_limit(32) .build(); column_roundtrip_random::<Int32Type>( "test_col_writer_rnd_4", props, 1024, ::std::i32::MIN, ::std::i32::MAX, 10, 10, ); }
rust_cleaned_test_functions.jsonl/30536
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 266 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8744, 28908, 42605, 761, 3420, 31966, 1769, 6129, 368, 341, 286, 1077, 6914, 284, 29404, 7903, 486, 17850, 741, 310, 659, 746, 42605, 21655, 551, 14763, 7, 18, 17, 340, 310, 659, 746, 1769, 2165...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_hsv() { let color = QColor::from_hsv(255, 200, 100, Some(213)); assert_eq!(255, color.hsv_hue()); assert_eq!(200, color.hsv_saturation()); assert_eq!(100, color.value()); assert_eq!(213, color.alpha()); assert_eq!((255, 200, 100, 213), color.get_hsva()); }
rust_cleaned_test_functions.jsonl/25424
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 164 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1523, 3492, 368, 341, 286, 1077, 1894, 284, 55758, 486, 1499, 1523, 3492, 7, 17, 20, 20, 11, 220, 17, 15, 15, 11, 220, 16, 15, 15, 11, 4329, 7, 17, 16, 18, 1106, 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_ftp() { let (mut ftp_stream, welcome_msg) = FtpStream::connect("127.0.0.1:21").unwrap(); println!("Welcome message: {:?}", welcome_msg); let _ = ftp_stream.login("Doe", "mumble").unwrap(); ftp_stream.mkdir("test_dir").unwrap(); ftp_stream.cwd("test_dir").unwrap(); assert!(ftp_stream.pwd().unwrap().ends_with("/test_dir")); // store a file let file_data = "test data\n"; let mut reader = Cursor::new(file_data.as_bytes()); assert!(ftp_stream.put("test_file.txt", &mut reader).is_ok()); // retrieve file assert!(ftp_stream .simple_retr("test_file.txt") .map(|bytes| assert_eq!(bytes.into_inner(), file_data.as_bytes())) .is_ok()); // remove file assert!(ftp_stream.rm("test_file.txt").is_ok()); assert!(ftp_stream .cdup() .and_then(|_| ftp_stream.rmdir("test_dir")) .and_then(|_| ftp_stream.quit()) .is_ok()); }
rust_cleaned_test_functions.jsonl/130706
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 446 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 62, 25068, 368, 341, 262, 1077, 320, 6984, 45427, 12673, 11, 10565, 6483, 8, 284, 434, 790, 3027, 486, 6459, 445, 16, 17, 22, 13, 15, 13, 15, 13, 16, 25, 17, 16, 1827, 15454, 543, 262, 137...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_until_single_line_comment_end() { assert_eq!( take_until_single_line_comment_end(" thing\nmore"), Done("\nmore", " thing") ); assert_eq!( take_until_single_line_comment_end(" thing\n"), Done("\n", " thing") ); assert_eq!( take_until_single_line_comment_end(" thing--"), Done("--", " thing") ); assert_eq!( take_until_single_line_comment_end(" dash-in-middle--"), Done("--", " dash-in-middle") ); assert_eq!( take_until_single_line_comment_end(" dash-in-middle\x0C"), Done("\x0C", " dash-in-middle") ); // Empty comments assert_eq!(take_until_single_line_comment_end("\n"), Done("\n", "")); assert_eq!(take_until_single_line_comment_end("--"), Done("--", "")); assert_eq!( take_until_single_line_comment_end("stuff-"), done_result!("stuff-") ); assert_eq!(take_until_single_line_comment_end("-"), done_result!("-")); }
rust_cleaned_test_functions.jsonl/29986
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 585 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 73261, 44352, 19487, 6528, 17638, 6213, 368, 341, 286, 2060, 10714, 33673, 310, 1896, 44352, 19487, 6528, 17638, 6213, 445, 3166, 1699, 6384, 4461, 310, 27357, 4921, 77, 6384, 497, 330, 3166, 1138, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_xdg_data() { let home = dirs_next::home_dir().unwrap(); let path = RootLocation::from("xdg-data").path().unwrap(); assert_eq!(path, home.join(".local/share")); }
rust_cleaned_test_functions.jsonl/92110
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 115 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3212, 35138, 1769, 368, 341, 310, 1077, 2114, 284, 42248, 11257, 486, 5117, 4334, 1005, 15454, 543, 310, 1077, 1815, 284, 18854, 4707, 486, 1499, 445, 9703, 70, 13945, 1827, 2343, 1005, 15454, 543...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_defaults() { let z = Angle::zero(); let h = Angle::half_circle(); let f = Angle::full_circle(); let d = Angle::default(); assert_approx_eq!(z.degrees(), 0.0); assert_approx_eq!(z.radians(), 0.0); assert_approx_eq!(h.degrees(), 180.0); assert_approx_eq!(h.radians(), PI); assert_approx_eq!(f.degrees(), 360.0); assert_approx_eq!(f.radians(), 2.0*PI); assert_approx_eq!(z, d); }
rust_cleaned_test_functions.jsonl/109957
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 257 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 42290, 368, 341, 286, 1077, 1147, 284, 36237, 486, 14154, 543, 286, 1077, 305, 284, 36237, 486, 37006, 42222, 543, 286, 1077, 282, 284, 36237, 486, 8878, 42222, 543, 286, 1077, 294, 284, 36237, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_backup_mode_long_preferred_over_short() { let _dummy = TEST_MUTEX.lock().unwrap(); let matches = make_app().get_matches_from(vec!["app", "-b", "--backup=none"]); let result = determine_backup_mode(&matches).unwrap(); assert_eq!(result, BackupMode::NoBackup); }
rust_cleaned_test_functions.jsonl/98141
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 142 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 44710, 7302, 17799, 10442, 5554, 15431, 16673, 368, 341, 286, 1077, 716, 31390, 284, 13602, 66994, 21003, 1005, 15454, 543, 286, 1077, 9071, 284, 1281, 8191, 1005, 455, 38344, 5673, 25592, 0, 1183, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_package_version_without_version() -> io::Result<()> { let config_name = "package.json"; let config_content = json::json!({ "name": "starship" }) .to_string(); let project_dir = create_project_dir()?; fill_config(&project_dir, config_name, Some(&config_content))?; expect_output(&project_dir, None, None)?; project_dir.close() }
rust_cleaned_test_functions.jsonl/19237
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 199 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 39123, 26328, 9438, 39904, 9438, 368, 1464, 6399, 486, 2077, 71698, 341, 286, 1077, 2193, 1269, 284, 330, 1722, 4323, 876, 286, 1077, 2193, 7495, 284, 2951, 486, 2236, 0, 2262, 310, 330, 606, 78...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
#[test] fn test_enum() { #[derive(Serialize)] enum E { Unit, Newtype(u32), Tuple(u32, u32), Struct { a: u32 }, } let u = E::Unit; let expected = b"4:Unit"; assert_eq!(to_bytes(&u).unwrap(), expected); let n = E::Newtype(1); let expected = b"d7:Newtypei1ee"; assert_eq!(to_bytes(&n).unwrap(), expected); let t = E::Tuple(1, 2); let expected = b"d5:Tupleli1ei2eee"; assert_eq!(to_bytes(&t).unwrap(), expected); let s = E::Struct { a: 1 }; let expected = b"d6:Structd1:ai1eee"; assert_eq!(to_bytes(&s).unwrap(), expected); }
rust_cleaned_test_functions.jsonl/113656
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 308 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 31054, 368, 341, 262, 11506, 27098, 3759, 9050, 5563, 262, 7618, 468, 341, 286, 7954, 345, 286, 1532, 1313, 8154, 18, 17, 1326, 286, 24622, 8154, 18, 17, 11, 575, 18, 17, 1326, 286, 16139, 314...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_calculate_array_levels_twitter_example() { let parent_levels = LevelInfo { definition: vec![0, 0], repetition: None, array_offsets: vec![0, 1, 2], array_mask: vec![true, true], // both lists defined max_definition: 0, is_list: false, // root is never list is_nullable: false, // root in example is non-nullable }; let array_offsets = vec![0, 2, 4]; let array_mask = vec![true, true]; // calculate level1 levels let levels = parent_levels.calculate_child_levels( array_offsets.clone(), array_mask, true, false, ); let expected_levels = LevelInfo { definition: vec![1, 1, 1, 1], repetition: Some(vec![0, 1, 0, 1]), array_offsets, array_mask: vec![true, true, true, true], max_definition: 1, is_list: true, is_nullable: false, }; // the separate asserts make it easier to see what's failing assert_eq!(&levels.definition, &expected_levels.definition); assert_eq!(&levels.repetition, &expected_levels.repetition); assert_eq!(&levels.array_mask, &expected_levels.array_mask); assert_eq!(&levels.array_offsets, &expected_levels.array_offsets); assert_eq!(&levels.max_definition, &expected_levels.max_definition); assert_eq!(&levels.is_list, &expected_levels.is_list); assert_eq!(&levels.is_nullable, &expected_levels.is_nullable); // this assert is to help if there are more variables added to the struct assert_eq!(&levels, &expected_levels); // level2 let parent_levels = levels; let array_offsets = vec![0, 3, 7, 8, 10]; let array_mask = vec![true, true, true, true]; let levels = parent_levels.calculate_child_levels( array_offsets.clone(), array_mask, true, false, ); let expected_levels = LevelInfo { definition: vec![2, 2, 2, 2, 2, 2, 2, 2, 2, 2], repetition: Some(vec![0, 2, 2, 1, 2, 2, 2, 0, 1, 2]), array_offsets, array_mask: vec![true; 10], max_definition: 2, is_list: true, is_nullable: false, }; assert_eq!(&levels.definition, &expected_levels.definition); assert_eq!(&levels.repetition, &expected_levels.repetition); assert_eq!(&levels.array_mask, &expected_levels.array_mask); assert_eq!(&levels.max_definition, &expected_levels.max_definition); assert_eq!(&levels.array_offsets, &expected_levels.array_offsets); assert_eq!(&levels.is_list, &expected_levels.is_list); assert_eq!(&levels.is_nullable, &expected_levels.is_nullable); assert_eq!(&levels, &expected_levels); }
rust_cleaned_test_functions.jsonl/77701
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1427 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 24005, 11207, 3858, 37819, 83338, 39304, 368, 341, 16885, 286, 1077, 2681, 37819, 284, 9395, 1731, 341, 310, 7271, 25, 7486, 20703, 15, 11, 220, 15, 1259, 310, 53415, 25, 2240, 345, 310, 1334, 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_parse_specializers() { let rule = parse_rule(r#"f(x: 1);"#); assert_eq!(rule, rule!("f", ["x"; 1])); let rule = parse_rule(r#"f(x: 1, y: [x]) if y = 2;"#); assert_eq!( rule, rule!("f", ["x" ; 1 , "y" ; value!([sym!("x")])] => op!(Unify, term!(sym!("y")), term!(2))) ); // parenthesized => parse as a symbol let rule = parse_rule(r#"f(x: (y));"#); assert_eq!(rule, rule!("f", ["x"; value!(sym!("y"))])); // not parenthesized => parse as a type let rule = parse_rule(r#"f(x: y);"#); assert_eq!(rule, rule!("f", ["x"; value!(instance!("y"))])); }
rust_cleaned_test_functions.jsonl/12187
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 364 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 41629, 12230, 368, 341, 286, 1077, 5912, 284, 4715, 21124, 2601, 55543, 69, 2075, 25, 220, 16, 42788, 2, 317, 286, 2060, 10714, 10297, 12937, 11, 5912, 17223, 69, 497, 4383, 87, 5123, 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_iterator_sum_result() { let v: &[Result<i32, ()>] = &[Ok(1), Ok(2), Ok(3), Ok(4)]; assert_eq!(v.iter().cloned().sum::<Result<i32, _>>(), Ok(10)); let v: &[Result<i32, ()>] = &[Ok(1), Err(()), Ok(3), Ok(4)]; assert_eq!(v.iter().cloned().sum::<Result<i32, _>>(), Err(())); }
rust_cleaned_test_functions.jsonl/25923
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 157 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13491, 10160, 5287, 368, 341, 262, 1077, 348, 25, 44590, 2077, 21897, 18, 17, 11, 1719, 53529, 284, 44590, 11578, 7, 16, 701, 7622, 7, 17, 701, 7622, 7, 18, 701, 7622, 7, 19, 12587, 262, 206...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_bad_native_loader() { let (genesis_config, mint_keypair) = create_genesis_config(50000); let bank = Bank::new(&genesis_config); let to_keypair = Keypair::new(); let tx = Transaction::new_signed_with_payer( &[ system_instruction::create_account( &mint_keypair.pubkey(), &to_keypair.pubkey(), 10000, 0, &native_loader::id(), ), Instruction::new_with_bincode( native_loader::id(), &(), vec![AccountMeta::new(to_keypair.pubkey(), false)], ), ], Some(&mint_keypair.pubkey()), &[&mint_keypair, &to_keypair], bank.last_blockhash(), ); assert_eq!( bank.process_transaction(&tx), Err(TransactionError::InstructionError( 1, InstructionError::Custom(NativeLoaderError::InvalidAccountData as u32) )) ); let tx = Transaction::new_signed_with_payer( &[ system_instruction::create_account( &mint_keypair.pubkey(), &to_keypair.pubkey(), 10000, 100, &native_loader::id(), ), Instruction::new_with_bincode( native_loader::id(), &(), vec![AccountMeta::new(to_keypair.pubkey(), false)], ), ], Some(&mint_keypair.pubkey()), &[&mint_keypair, &to_keypair], bank.last_blockhash(), ); assert_eq!( bank.process_transaction(&tx), Err(TransactionError::InstructionError( 1, InstructionError::Custom(NativeLoaderError::InvalidAccountData as u32) )) ); }
rust_cleaned_test_functions.jsonl/2664
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1202 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 34199, 44494, 22139, 368, 341, 286, 1077, 320, 77894, 5332, 11, 28337, 3097, 12670, 8, 284, 1855, 16322, 13774, 5332, 7, 20, 15, 15, 15, 15, 317, 286, 1077, 6073, 284, 8547, 486, 931, 2099, 77...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_same_weight_select_lower_slot() { // Init state let mut vote_simulator = VoteSimulator::new(1); let node_pubkey = vote_simulator.node_pubkeys[0]; let tower = Tower::new_with_key(&node_pubkey); // Create the tree of banks in a BankForks object let forks = tr(0) / (tr(1)) / (tr(2)); vote_simulator.fill_bank_forks(forks, &HashMap::new()); let mut frozen_banks: Vec<_> = vote_simulator .bank_forks .read() .unwrap() .frozen_banks() .values() .cloned() .collect(); let ancestors = vote_simulator.bank_forks.read().unwrap().ancestors(); ReplayStage::compute_bank_stats( &Pubkey::default(), &ancestors, &mut frozen_banks, &tower, &mut vote_simulator.progress, &VoteTracker::default(), &ClusterSlots::default(), &vote_simulator.bank_forks, &mut HashSet::new(), ); assert_eq!( vote_simulator .progress .get_fork_stats(1) .unwrap() .fork_weight, vote_simulator .progress .get_fork_stats(2) .unwrap() .fork_weight, ); let (heaviest_bank, _) = ReplayStage::select_forks(&frozen_banks, &tower, &vote_simulator.progress, &ancestors); // Should pick the lower of the two equally weighted banks assert_eq!(heaviest_bank.unwrap().slot(), 1); }
rust_cleaned_test_functions.jsonl/91764
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 877 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 33574, 15876, 13051, 30425, 27563, 368, 341, 286, 442, 15690, 1584, 198, 286, 1077, 5206, 6910, 18314, 10511, 284, 34034, 14027, 10511, 486, 931, 7, 16, 317, 286, 1077, 2436, 34014, 792, 284, 6910...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_less_version_487() { let output = b"less 487 (GNU regular expressions) Copyright (C) 1984-2016 Mark Nudelman less comes with NO WARRANTY, to the extent permitted by law. For information about the terms of redistribution, see the file named README in the less distribution. Homepage: http://www.greenwoodsoftware.com/less"; assert_eq!(Some(487), parse_less_version(output)); }
rust_cleaned_test_functions.jsonl/1466
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 130 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 50747, 9438, 62, 19, 23, 22, 368, 341, 262, 1077, 2550, 284, 293, 1, 1717, 220, 19, 23, 22, 320, 36223, 5792, 23393, 340, 13547, 320, 34, 8, 220, 16, 24, 23, 19, 12, 17, 15, 16, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_format_java_version_sapmachine() { let java_11 = String::from("OpenJDK 64-Bit Server VM (11.0.4+11-LTS-sapmachine) for linux-amd64 JRE (11.0.4+11-LTS-sapmachine), built on Jul 17 2019 08:58:43 by \"\" with gcc 7.3.0"); assert_eq!(format_java_version(java_11), Some(String::from("v11.0.4"))); }
rust_cleaned_test_functions.jsonl/104948
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 152 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8955, 77323, 9438, 643, 391, 32056, 368, 341, 286, 1077, 1642, 62, 16, 16, 284, 923, 486, 1499, 445, 5002, 41, 18301, 220, 21, 19, 7671, 275, 8422, 17792, 320, 16, 16, 13, 15, 13, 19, 10, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_from_box_str() { use std::string::String; let s = String::from("foo").into_boxed_str(); let r: Rc<str> = Rc::from(s); assert_eq!(&r[..], "foo"); }
rust_cleaned_test_functions.jsonl/4675
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 109 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5673, 10194, 2895, 368, 341, 286, 990, 1460, 486, 917, 486, 703, 401, 286, 1077, 274, 284, 923, 486, 1499, 445, 7975, 1827, 18122, 10194, 291, 2895, 543, 286, 1077, 435, 25, 81463, 27, 495, 29...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_fn_signature_for_method_with_arg() { let (desc, param) = get_signature( r#"struct F; impl F { pub fn new() -> F{ F{} } pub fn do_it(&self, x: i32) {} } fn bar() { let f : F = F::new(); f.do_it(<|>); }"#, ); assert_eq!(desc.name, "do_it".to_string()); assert_eq!(desc.params, vec!["&self".to_string(), "x".to_string()]); assert_eq!(desc.ret_type, None); assert_eq!(param, Some(1)); }
rust_cleaned_test_functions.jsonl/75856
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 238 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15246, 39859, 5478, 9032, 6615, 6057, 368, 341, 262, 1077, 320, 8614, 11, 1685, 8, 284, 633, 39859, 1006, 286, 435, 55543, 1235, 434, 280, 6383, 434, 341, 262, 6675, 5168, 501, 368, 1464, 434, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_domain() { let spec = ChainSpec::mainnet(); test_domain(Domain::BeaconProposer, spec.domain_beacon_proposer, &spec); test_domain(Domain::Randao, spec.domain_randao, &spec); test_domain(Domain::Attestation, spec.domain_attestation, &spec); test_domain(Domain::Deposit, spec.domain_deposit, &spec); test_domain(Domain::VoluntaryExit, spec.domain_voluntary_exit, &spec); test_domain(Domain::Transfer, spec.domain_transfer, &spec); }
rust_cleaned_test_functions.jsonl/53262
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 212 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 20111, 368, 341, 286, 1077, 1398, 284, 28525, 8327, 486, 3817, 4711, 1428, 286, 1273, 20111, 5432, 3121, 486, 3430, 22379, 2008, 23438, 11, 1398, 11003, 880, 12508, 443, 21663, 23438, 11, 60...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_create_cluster_parameter_group() { let mock_response = MockResponseReader::read_response( "test_resources/generated/valid", "redshift-create-cluster-parameter-group.xml", ); let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response); let client = RedshiftClient::new(mock, MockCredentialsProvider, rusoto_region::UsEast1); let request = CreateClusterParameterGroupMessage::default(); let result = client.create_cluster_parameter_group(request).sync(); assert!(result.is_ok(), "parse error: {:?}", result); }
rust_cleaned_test_functions.jsonl/12101
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 258 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 8337, 26058, 13418, 8657, 28441, 24899, 6288, 368, 341, 286, 1077, 7860, 9655, 284, 14563, 2582, 5062, 486, 878, 9655, 1006, 310, 330, 1944, 35569, 79372, 14, 1891, 756, 310, 330, 1151, 134...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_pad() { assert_eq!(pad("0000").unwrap().1.len, 0); assert_eq!(pad("123").unwrap().1.len, 23); assert_eq!(pad("001").unwrap().1.len, 1); assert!(pad("1").to_full_result().is_err()); assert!(pad("").to_full_result().is_err()); assert!(pad("x").to_full_result().is_err()); }
rust_cleaned_test_functions.jsonl/110351
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 147 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 30290, 368, 341, 262, 2060, 10714, 10297, 13242, 445, 15, 15, 15, 15, 1827, 15454, 1005, 16, 19406, 11, 220, 15, 317, 262, 2060, 10714, 10297, 13242, 445, 16, 17, 18, 1827, 15454, 1005, 16, 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_duplicated_rule() -> TestResult { let mut p = Polar::new(); p.load_str( r#"f(1); f(1);"#, )?; qvar(&mut p, "f(x)", "x", values![1, 1]); Ok(()) }
rust_cleaned_test_functions.jsonl/97660
{ "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, 814, 98984, 21124, 368, 1464, 3393, 2077, 341, 262, 1077, 5206, 281, 284, 55896, 486, 931, 543, 262, 281, 5104, 2895, 1006, 286, 435, 55543, 69, 7, 16, 317, 1843, 282, 7, 16, 42788, 2, 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...
2
#[test] fn test_if() { // Operator 6: If produces("[[40 43] 6 [3 0 1] [4 0 2] [4 0 1]]", "41"); produces("[42 6 [1 0] [4 0 1] 1 233]", "43"); produces("[42 6 [1 1] [4 0 1] 1 233]", "233"); produces("[42 [6 [1 0] [4 0 1] [1 233]]]", "43"); produces("[42 [6 [1 1] [4 0 1] [1 233]]]", "233"); }
rust_cleaned_test_functions.jsonl/29738
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 191 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11119, 368, 341, 286, 442, 28498, 220, 21, 25, 1416, 198, 286, 18644, 10937, 58, 19, 15, 220, 19, 18, 60, 220, 21, 508, 18, 220, 15, 220, 16, 60, 508, 19, 220, 15, 220, 17, 60, 508, 19, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_parse_ok() { let r = Response { response: &[0, 1, 2, 8, 84, 137, 127, 13, 10] }; assert_eq!(r.parse(), ParsedResponse::Ok); }
rust_cleaned_test_functions.jsonl/77732
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 83 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 19817, 368, 341, 286, 1077, 435, 284, 5949, 314, 2033, 25, 44590, 15, 11, 220, 16, 11, 220, 17, 11, 220, 23, 11, 220, 23, 19, 11, 220, 16, 18, 22, 11, 220, 16, 17, 22, 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_read_config_fail_back_to_default_values() { let want = Config::default(); let got = read_config(Path::new("")).unwrap(); assert_eq!(want, got); }
rust_cleaned_test_functions.jsonl/60585
{ "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, 6443, 5332, 22121, 3895, 2346, 9993, 9146, 368, 341, 286, 1077, 1366, 284, 5532, 486, 2258, 543, 286, 1077, 2684, 284, 1349, 5332, 33030, 486, 931, 445, 15197, 15454, 543, 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
#[test] fn test_iterator_last() { let s = "ศไทย中华Việt Nam"; let mut it = s.chars(); it.next(); assert_eq!(it.last(), Some('m')); }
rust_cleaned_test_functions.jsonl/17633
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 86 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13491, 12195, 368, 341, 262, 1077, 274, 284, 330, 123863, 125451, 100849, 35544, 124382, 29974, 876, 262, 1077, 5206, 432, 284, 274, 85062, 543, 262, 432, 4529, 543, 262, 2060, 10714, 10297, 275, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_ip_nm_serialize() { use serde_json::from_str; let expected = IpNm { ip: "0.0.0.0".parse().unwrap(), nm: IpNm::default_netmask(), }; let stringy = r#"{"ip":"0.0.0.0"}"#; let actual: IpNm = from_str(stringy).unwrap(); assert_eq!(expected, actual); }
rust_cleaned_test_functions.jsonl/102214
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 146 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10385, 57572, 88686, 368, 341, 197, 41819, 61570, 9455, 486, 1499, 2895, 280, 197, 10217, 3601, 284, 35033, 68205, 341, 298, 46531, 25, 330, 15, 13, 15, 13, 15, 13, 15, 3263, 6400, 1005, 15454, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_make_command_line() { use super::make_command_line; assert_eq!( make_command_line("prog", ["aaa".to_owned(), "bbb".to_owned(), "ccc".to_owned()]), "prog aaa bbb ccc".to_owned() ); assert_eq!( make_command_line("C:\\Program Files\\blah\\blah.exe", ["aaa".to_owned()]), "\"C:\\Program Files\\blah\\blah.exe\" aaa".to_owned() ); assert_eq!( make_command_line("C:\\Program Files\\test", ["aa\"bb".to_owned()]), "\"C:\\Program Files\\test\" aa\\\"bb".to_owned() ); assert_eq!( make_command_line("echo", ["a b c".to_owned()]), "echo \"a b c\"".to_owned() ); assert_eq!( make_command_line("\u03c0\u042f\u97f3\u00e6\u221e", []), "\u03c0\u042f\u97f3\u00e6\u221e".to_owned() ); }
rust_cleaned_test_functions.jsonl/10222
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 507 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 28230, 10811, 6528, 368, 341, 286, 990, 2256, 486, 6927, 10811, 6528, 280, 286, 2060, 10714, 33673, 310, 1281, 10811, 6528, 445, 32992, 497, 4383, 32646, 3263, 983, 51973, 1507, 330, 53151, 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_boring() { use Token::*; let (tokens, maybe_error) = tokenize_string(" add to into subtract from loop do end times while calc + - * / % ?= <> == < <= > >= :: && || ! if # else split "); assert_eq!( tokens, vec![ Add, To, Into, Subtract, From, Loop, Do, End, Times, While, Calc, Plus, SatMinus, Mult, Div, Mod, OrdCmp, OrdNe, OrdEq, OrdLt, OrdLe, OrdGt, OrdGe, Join, LogAnd, LogOr, LogNot, If, Split, ] ); assert!(maybe_error.is_none()); }
rust_cleaned_test_functions.jsonl/78242
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 374 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 880, 5503, 368, 341, 286, 990, 9660, 56162, 286, 1077, 320, 30566, 11, 7196, 4096, 8, 284, 77651, 3904, 70576, 310, 912, 311, 1119, 32256, 504, 6337, 653, 835, 3039, 1393, 10035, 198, 310, 488, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_garbage_ir_fails_create_module_from_ir() { let context = Context::create(); let memory_buffer = MemoryBuffer::create_from_memory_range("garbage ir data", "my_ir"); assert_eq!(memory_buffer.get_size(), 15); assert_eq!(from_utf8(memory_buffer.as_slice()).unwrap(), "garbage ir data"); assert!(context.create_module_from_ir(memory_buffer).is_err()); }
rust_cleaned_test_functions.jsonl/63536
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 150 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1889, 277, 20652, 51433, 761, 6209, 8657, 10750, 5673, 51433, 368, 341, 262, 1077, 2266, 284, 9608, 486, 3182, 543, 262, 1077, 4938, 7776, 284, 13850, 4095, 486, 3182, 5673, 19195, 9698, 445, 1216...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_decode_string() { // test read string1 let d: [u8; 9] = [0x06, 0x07, b'f', b'o', b'o', b' ', b'b', b'a', b'r']; let mut de = TarsDecoder::from(&d[..]); assert_eq!( de.read_string(0, true, String::default()).unwrap(), String::from(&"foo bar"[..]) ); // test read string4 let size: [u8; 4] = unsafe { mem::transmute(7u32.to_be()) }; let d2: [u8; 12] = [ 0x27, size[0], size[1], size[2], size[3], b'f', b'o', b'o', b' ', b'b', b'a', b'r', ]; let mut de2 = TarsDecoder::from(&d2[..]); assert_eq!( de2.read_string(2, true, String::default()).unwrap(), String::from(&"foo bar"[..]) ); let i2: String = de2.read_string(244, false, String::default()).unwrap(); assert_eq!(i2, String::default()); let err: Result<String, DecodeErr> = de2.read_string(129, true, String::default()); assert_eq!(err, Err(DecodeErr::TarsTagNotFoundErr)); }
rust_cleaned_test_functions.jsonl/128478
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 545 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15227, 3904, 368, 341, 286, 442, 1273, 1349, 914, 16, 198, 286, 1077, 294, 25, 508, 84, 23, 26, 220, 24, 60, 284, 508, 15, 87, 15, 21, 11, 220, 15, 87, 15, 22, 11, 293, 6, 69, 516, 293...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_proof_commitment() { let rng = &mut rand::thread_rng(); let channelId = Fr::rand(rng); let nonce = Fr::rand(rng); let rl = Fr::rand(rng); let rho = Fr::rand(rng); let tau = Fr::rand(rng); let tau_bar = Fr::rand(rng); let bc = rng.gen_range(100, 1000); let bm = rng.gen_range(100, 1000); let wallet = Wallet::<Bls12> { channelId: channelId, nonce: nonce, rev_lock: rl, bc: bc, bm: bm, }; let comParams = CSMultiParams::setup_gen_params(rng, 5); let rl_com = comParams.commit(&vec![wallet.rev_lock], &rho); let s_com = comParams.commit(&wallet.as_fr_vec().clone(), &tau); let s_bar_com = comParams.commit(&wallet.as_fr_vec_bar().clone(), &tau_bar); let rl_proof = CommitmentProof::<Bls12>::new( rng, &comParams, &rl_com.c, &vec![wallet.rev_lock], &rho, &vec![], ); let xvec: Vec<G1> = vec![rl_proof.T.clone(), rl_com.c]; let challenge = util::hash_g1_to_fr::<Bls12>(&xvec); assert_eq!( rl_proof.verify_proof(&comParams, &rl_com.c, &challenge, None), true ); let s_proof = CommitmentProof::<Bls12>::new( rng, &comParams, &s_com.c, &wallet.as_fr_vec(), &tau, &vec![], ); let xvec: Vec<G1> = vec![s_proof.T.clone(), s_com.c]; let challenge = util::hash_g1_to_fr::<Bls12>(&xvec); assert_eq!( s_proof.verify_proof(&comParams, &s_com.c, &challenge, None), true ); let s_bar_proof = CommitmentProof::<Bls12>::new( rng, &comParams, &s_bar_com.c, &wallet.as_fr_vec_bar(), &tau_bar, &vec![], ); let xvec: Vec<G1> = vec![s_bar_proof.T.clone(), s_bar_com.c]; let challenge = util::hash_g1_to_fr::<Bls12>(&xvec); assert_eq!( s_bar_proof.verify_proof(&comParams, &s_bar_com.c, &challenge, None), true ); }
rust_cleaned_test_functions.jsonl/12986
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1312 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 86757, 36346, 478, 368, 341, 286, 1077, 28422, 284, 609, 6984, 10382, 486, 4528, 66849, 543, 286, 1077, 81725, 284, 2869, 486, 11335, 87597, 317, 286, 1077, 39676, 284, 2869, 486, 11335, 87597, 31...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_ber_read_bytes_ok() { let tests : &[(&[u8], &[u8])] = &[ (&[1, 0, 100, 255], &[4, 4, 1, 0, 100, 255]), (&[], &[4, 0]), (&[4, 4, 4, 4], &[4, 4, 4, 4, 4, 4]), (&[], &[36, 128, 0, 0]), (&[12, 34], &[36, 128, 4, 2, 12, 34, 0, 0]), (&[12, 34, 56], &[36, 128, 36, 128, 4, 3, 12, 34, 56, 0, 0, 0, 0]), (&[], &[36, 128, 36, 128, 36, 128, 36, 128, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0]), (&[2, 3, 1], &[36, 128, 4, 1, 2, 36, 128, 4, 2, 3, 1, 0, 0, 0, 0]), (&[], &[36, 0]), (&[12, 34], &[36, 4, 4, 2, 12, 34]), (&[12, 34, 56], &[36, 128, 36, 5, 4, 3, 12 ,34, 56, 0, 0]), (&[12, 34, 56], &[36, 9, 36, 128, 4, 3, 12, 34, 56, 0, 0]), (&[12, 34, 56], &[36, 7, 36, 5, 4, 3, 12 ,34, 56]), ]; for &(evalue, data) in tests { let value = parse_ber(data, |reader| { reader.read_bytes() }).unwrap(); assert_eq!(value, evalue); } }
rust_cleaned_test_functions.jsonl/111142
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 592 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 88165, 6443, 12524, 19817, 368, 341, 262, 1077, 7032, 549, 44590, 2099, 58, 84, 23, 1125, 44590, 84, 23, 72080, 284, 609, 9640, 286, 15899, 58, 16, 11, 220, 15, 11, 220, 16, 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...
2
#[test] fn test_interior_nul_in_args_is_error() { match Command::new("echo").args(&["has-some-\0\0s-inside"]).spawn() { Err(e) => assert_eq!(e.kind(), ErrorKind::InvalidInput), Ok(_) => panic!(), } }
rust_cleaned_test_functions.jsonl/5491
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 128 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15318, 2462, 1089, 360, 1243, 8384, 6892, 4096, 368, 341, 286, 2432, 7348, 486, 931, 445, 3047, 1827, 2116, 2099, 1183, 4648, 1331, 635, 30529, 15, 59, 15, 82, 21853, 577, 45014, 46087, 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...
2
#[test] fn test_read_line_segments_from_input_file() { let mut hydrothermal_map = HydrothermalMap::new(); hydrothermal_map.read_lines_from_input_file("sample_input.txt"); assert_eq!(hydrothermal_map.line_segments.len(), 10); }
rust_cleaned_test_functions.jsonl/121171
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 115 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6443, 6528, 55735, 5673, 5898, 2458, 368, 341, 286, 1077, 5206, 16643, 68118, 5376, 284, 39502, 68118, 2227, 486, 931, 543, 286, 16643, 68118, 5376, 4125, 18323, 5673, 5898, 2458, 445, 13611, 5898, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_partial_execution() { let mut engine = super::MatchingEngine::new(String::from("QWERTY")); // buy 100 units at 51 engine.add_order(super::OrderType::BUY, 100, 51.0); // sell 1000 units at 50 engine.add_order(super::OrderType::SELL, 1000, 50.0); assert_eq!(engine.get_sell_order_book()[0].quantity, 900); assert_eq!(engine.get_sell_order_book().len(), 1); assert_eq!(engine.get_buy_order_book().len(), 0); }
rust_cleaned_test_functions.jsonl/23020
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 188 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 52068, 60948, 368, 341, 262, 1077, 5206, 4712, 284, 2256, 486, 64430, 4571, 486, 931, 2242, 486, 1499, 445, 48, 54, 3399, 56, 14929, 262, 442, 3695, 220, 16, 15, 15, 8153, 518, 220, 20, 16, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_duplicate_qualifier_is_error() { let input = "abc$%"; let eol_reader = EolReader::from(input); let mut parser = word_p(); let (_, err) = parser.parse(eol_reader).expect_err("Should not parse"); assert_eq!(err, QError::syntax_error("Expected: end of name expr")); }
rust_cleaned_test_functions.jsonl/102679
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 221 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 70434, 64391, 3049, 6892, 4096, 368, 341, 503, 1077, 1946, 284, 330, 13683, 3, 95670, 503, 1077, 384, 337, 22306, 284, 468, 337, 5062, 486, 1499, 5384, 317, 503, 1077, 5206, 6729, 284, 3409, 620...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_extract_session_metrics_errored() { let update1 = SessionUpdate::parse( r#"{ "init": true, "started": "2021-04-26T08:00:00+0100", "attrs": { "release": "1.0.0" }, "did": "user123", "status": "errored" }"# .as_bytes(), ) .unwrap(); let mut update2 = update1.clone(); update2.init = false; let mut update3 = update2.clone(); update3.status = SessionStatus::Ok; update3.errors = 123; for (update, expected_metrics) in vec![ (update1, 4), (update2, 2), (update3, 2), ] { let mut metrics = vec![]; extract_session_metrics(&update.attributes, &update, &mut metrics); assert_eq!(metrics.len(), expected_metrics); let session_metric = &metrics[expected_metrics - 2]; assert_eq!(session_metric.timestamp, started()); assert_eq!(session_metric.name, "sentry.sessions.session.error"); assert!(matches!(session_metric.value, MetricValue::Set(_))); assert_eq!(session_metric.tags.len(), 1); // Only the release tag let user_metric = &metrics[expected_metrics - 1]; assert_eq!(session_metric.timestamp, started()); assert_eq!(user_metric.name, "sentry.sessions.user"); assert!(matches!(user_metric.value, MetricValue::Set(_))); assert_eq!(user_metric.tags["session.status"], "errored"); assert_eq!(user_metric.tags["release"], "1.0.0"); } }
rust_cleaned_test_functions.jsonl/63639
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 890 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 39123, 12316, 37686, 62, 40296, 1151, 368, 341, 286, 1077, 2647, 16, 284, 9164, 4289, 486, 6400, 1006, 310, 435, 55543, 515, 394, 330, 2327, 788, 830, 345, 394, 330, 46723, 788, 330, 17, 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...
2
#[test] fn test_token_stx_transfer_with_postcondition() { let input_path = { let mut r = PathBuf::new(); r.push(env!("CARGO_MANIFEST_DIR")); r.push("tests"); r.push("stx_token_transfer_postcondition"); r.set_extension("json"); r }; let str = std::fs::read_to_string(input_path).expect("Error opening json file"); let json: StxTransaction = serde_json::from_str(&str).unwrap(); let bytes = hex::decode(&json.raw).unwrap(); let mut transaction = Transaction::from_bytes(&bytes).unwrap(); transaction.read(&bytes).unwrap(); assert!(transaction.transaction_auth.is_standard_auth()); let spending_condition = transaction.transaction_auth.origin(); assert_eq!(json.nonce, spending_condition.nonce()); assert_eq!(json.fee, spending_condition.fee() as u32); let origin = spending_condition .signer_address(TransactionVersion::Mainnet) .unwrap(); let origin = core::str::from_utf8(&origin[0..origin.len()]).unwrap(); assert_eq!(&json.sender, origin); let recipient = transaction.payload_recipient_address().unwrap(); let addr_len = recipient.len(); let address = core::str::from_utf8(&recipient[0..addr_len]).unwrap(); assert_eq!(&json.recipient, address); // Check postconditions assert_eq!(1, transaction.post_conditions.conditions.len()); let conditions = transaction.post_conditions.get_postconditions(); let post_condition = TransactionPostCondition::from_bytes(conditions[0]) .unwrap() .1; assert!(post_condition.is_stx()); let condition_code = post_condition.fungible_condition_code().unwrap(); assert_eq!(condition_code, FungibleConditionCode::SentGe); let stx_condition_amount = post_condition.amount_stx().unwrap(); assert_eq!(12345, stx_condition_amount); assert!(!post_condition.is_origin_principal()); assert!(Transaction::validate(&mut transaction).is_ok()); }
rust_cleaned_test_functions.jsonl/134586
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 900 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6458, 1261, 87, 35403, 6615, 6333, 9056, 368, 341, 286, 1077, 1946, 2638, 284, 341, 310, 1077, 5206, 435, 284, 7933, 15064, 486, 931, 543, 310, 435, 2552, 16978, 17223, 34, 7581, 46, 25143, 9112...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_apply_with_alpha_rgba() { let mut rgba = Rgba([0, 0, 0, 0]); rgba.apply_with_alpha(|s| s, |_| 0xFF); assert_eq!(rgba, Rgba([0, 0, 0, 0xFF])); }
rust_cleaned_test_functions.jsonl/46636
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 114 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 36551, 6615, 26633, 95229, 368, 341, 286, 1077, 5206, 23524, 284, 431, 56380, 2561, 15, 11, 220, 15, 11, 220, 15, 11, 220, 15, 2558, 286, 23524, 13045, 6615, 26633, 22428, 82, 91, 274, 11, 660...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_domain() { let buffer = std::fs::read("./testdata/GeoIP2-Domain-Test.mmdb").unwrap(); let reader = Reader::<Domain>::from_bytes(&buffer).unwrap(); { let result = reader .lookup(IpAddr::from_str("1.2.0.0").unwrap()) .unwrap() .domain .unwrap(); assert_eq!(result, "maxmind.com"); } { let result = reader .lookup(IpAddr::from_str("186.30.236.0").unwrap()) .unwrap() .domain .unwrap(); assert_eq!(result, "replaced.com"); } }
rust_cleaned_test_functions.jsonl/37385
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 399 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 20111, 368, 341, 286, 1077, 4147, 284, 1460, 486, 3848, 486, 878, 13988, 92425, 14, 37344, 3298, 17, 9420, 3121, 12, 2271, 37008, 1999, 1827, 15454, 543, 286, 1077, 6604, 284, 25166, 27638, 13636,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_bitmasks_requiring_params_mem_access_missing_param() { let mut v = ZERO_BOUND_HEADER.to_vec(); v.append(&mut vec![0x3e, 0x00, 0x04, 0x00]); // OpStore v.append(&mut vec![0x01, 0x00, 0x00, 0x00]); // pointer: 1 v.append(&mut vec![0x02, 0x00, 0x00, 0x00]); // object: 2 v.append(&mut vec![0x03, 0x00, 0x00, 0x00]); let mut c = RetainingConsumer::new(); let p = Parser::new(&v, &mut c); assert_matches!(p.parse(), // so in total 36 bytes. Err(State::OperandError(DecodeError::LimitReached(36)))); }
rust_cleaned_test_functions.jsonl/85757
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 364 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 620, 28598, 13996, 76, 4604, 1288, 70094, 6745, 12976, 12759, 40447, 4090, 368, 341, 286, 1077, 5206, 348, 284, 54593, 73644, 20330, 2389, 13251, 543, 286, 348, 2057, 2099, 6984, 7486, 20703, 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_encrypt_decrypt() { let params = Parameters::default(); let (secret_key, _cloud_key) = generate_keys(&params); let every_combo = vec![true, false]; for x in every_combo { let encrypted = encrypt(x, &secret_key); let decrypted = decrypt(&encrypted, &secret_key); assert_eq!(x, decrypted); } }
rust_cleaned_test_functions.jsonl/69336
{ "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, 66593, 80764, 368, 341, 220, 1077, 3628, 284, 13522, 486, 2258, 543, 220, 1077, 320, 20474, 3097, 11, 716, 12361, 3097, 8, 284, 6923, 12631, 2099, 3519, 317, 220, 1077, 1449, 54781, 284, 7486, 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_single() { let mut map = MultiMap::<char, u8>::new(); map.insert('x', 1); assert_tokens( &map, &[ Token::Map { len: Some(1) }, Token::Char('x'), Token::Seq { len: Some(1) }, Token::U8(1), Token::SeqEnd, Token::MapEnd, ], ); }
rust_cleaned_test_functions.jsonl/28209
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 270 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 19487, 368, 341, 286, 1077, 5206, 2415, 284, 17439, 2227, 27638, 1762, 11, 575, 23, 6831, 931, 543, 286, 2415, 7030, 492, 87, 516, 220, 16, 626, 286, 2060, 28838, 1006, 310, 609, 2186, 345, 31...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_path_ext_html_jinja() { let t = PathHtmlJinja; assert_eq!(t.render().unwrap(), "foo.html.jinja"); assert_eq!(PathHtmlJinja::EXTENSION, Some("html")); }
rust_cleaned_test_functions.jsonl/133243
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 89 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2638, 9927, 9564, 5374, 41420, 368, 341, 262, 1077, 259, 284, 7933, 13591, 41, 41420, 280, 262, 2060, 10714, 10297, 83, 8740, 1005, 15454, 1507, 330, 7975, 2564, 1169, 41420, 797, 262, 2060, 10714...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_new_push_messages() { let mut contact_info_table = ContactInfoTable::default(); let mut push = NodeTbleGspPush::default(); let peer = ContInfTblValue::ContactInfo(ContactInfo::new_localhost(&BvmAddr::new_rand(), 0)); assert_eq!(contact_info_table.insert(peer.clone(), 0), Ok(None)); push.refresh_push_active_set(&contact_info_table, &HashMap::new(), &BvmAddr::default(), 1, 1); let new_msg = ContInfTblValue::ContactInfo(ContactInfo::new_localhost(&BvmAddr::new_rand(), 0)); assert_eq!( push.process_push_message(&mut contact_info_table, new_msg.clone(), 0), Ok(None) ); assert_eq!(push.active_set.len(), 1); assert_eq!( push.new_push_messages(&contact_info_table, 0), (vec![peer.label().address()], vec![new_msg]) ); }
rust_cleaned_test_functions.jsonl/120875
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 399 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5921, 14218, 23428, 368, 341, 286, 1077, 5206, 3645, 3109, 5237, 284, 9180, 1731, 2556, 486, 2258, 543, 286, 1077, 5206, 4484, 284, 6018, 51, 891, 38, 2154, 16644, 486, 2258, 543, 286, 1077, 143...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_update_hash_value_modifies_a_registers_value() { let mut test_hash: HashMap<String, i32> = HashMap::new(); test_hash.insert("foo".to_string(), 0); test_hash.insert("bar".to_string(), 0); update_hash_value(&mut test_hash, "foo", 10); update_hash_value(&mut test_hash, "bar", -10); assert_eq!(&(10 as i32), test_hash.get("foo").unwrap()); assert_eq!(&(-10 as i32), test_hash.get("bar").unwrap()); }
rust_cleaned_test_functions.jsonl/42000
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 217 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8882, 8950, 3142, 7480, 9606, 4306, 78360, 3142, 368, 341, 286, 1077, 5206, 1273, 8950, 25, 10528, 3464, 11, 600, 18, 17, 29, 284, 10528, 486, 931, 543, 286, 1273, 8950, 7030, 445, 7975, 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_chain_1() { let src = HASH_ELEMENT; let expect = hash_n_to_n_ret(&src); let dst = hash_n_to_n_chain_ret(&src, 1); assert_eq!(dst, expect); }
rust_cleaned_test_functions.jsonl/127327
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 110 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 30583, 62, 16, 368, 341, 286, 1077, 2286, 284, 58857, 27156, 280, 286, 1077, 1720, 284, 5175, 1089, 2346, 1089, 21695, 2099, 3548, 317, 286, 1077, 10648, 284, 5175, 1089, 2346, 1089, 30583, 21695,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_sdiv() { let mut v = [0, 0, 0, 0, 0, 0]; sdiv(&mut v, &[1, 1, 1, 1, 1, 1], 1); assert!(v == [1, 1, 1, 1, 1, 1]); }
rust_cleaned_test_functions.jsonl/86851
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 89 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 643, 611, 368, 341, 262, 1077, 5206, 348, 284, 508, 15, 11, 220, 15, 11, 220, 15, 11, 220, 15, 11, 220, 15, 11, 220, 15, 935, 262, 274, 611, 2099, 6984, 348, 11, 44590, 16, 11, 220, 16, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_recover() { let mut data = read_bad("wrong-start"); data += TESTDATA; let res: Vec<Result<_>> = MicrodescReader::new(&data, &AllowAnnotations::AnnotationsAllowed).collect(); assert_eq!(res.len(), 2); assert!(res[0].is_err()); assert!(res[1].is_ok()); }
rust_cleaned_test_functions.jsonl/73583
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 163 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1288, 3688, 368, 341, 286, 1077, 5206, 821, 284, 1349, 34199, 445, 34870, 18935, 797, 286, 821, 1421, 13602, 17777, 401, 286, 1077, 592, 25, 11312, 61329, 32399, 2452, 4035, 310, 18157, 8614, 5062...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_debug_abbrev_offset_32_incomplete() { let buf = [0x01, 0x02]; let buf = &mut EndianSlice::new(&buf, LittleEndian); match parse_debug_abbrev_offset(buf, Format::Dwarf32) { Err(Error::UnexpectedEof(_)) => assert!(true), otherwise => panic!("Unexpected result: {:?}", otherwise), }; }
rust_cleaned_test_functions.jsonl/101989
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 174 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 15446, 62, 44272, 6917, 62, 18, 17, 1243, 14737, 368, 341, 286, 1077, 6607, 284, 508, 15, 87, 15, 16, 11, 220, 15, 87, 15, 17, 935, 286, 1077, 6607, 284, 609, 6984, 3972, 1103, 33236,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_Elf_from_dynamic_hdr_mut() { let mut buf = ELF32_DYNAMIC_ELF_HDR.clone(); let elf: Result<Elf<'_, LittleEndian, Elf32>, ElfError> = Elf::try_from(&mut buf[0..]); assert!(elf.is_ok()); }
rust_cleaned_test_functions.jsonl/119487
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 111 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2089, 11008, 5673, 45992, 28238, 29523, 368, 341, 262, 1077, 5206, 6607, 284, 72568, 18, 17, 57356, 2089, 22609, 55765, 15997, 543, 262, 1077, 40745, 25, 5714, 27, 75832, 18291, 6878, 14671, 43231, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_single() -> Result<(), Box<dyn error::Error>> { let content = fs::read_to_string(PathBuf::new().join("tests/files/simple.go"))?; let str = content .lines() .skip(15) .take(4) .collect::<Vec<_>>() .join("\r\n"); assert_eq!( TypeDecl { type_specs: vec![TypeSpec::TypeDef(TypeDef { name: "TreeNode".to_owned(), r#type: Type::StructType(StructType { field_decls: vec![ FieldDecl { struct_field: StructField::IdentifierListType( vec!["left".to_owned(), "right".to_owned()], Type::PointerType(PointerType( Type::TypeName(TypeName::Identifier("TreeNode".to_owned())) .into() )) .into() ), tag: None, }, FieldDecl { struct_field: StructField::IdentifierListType( vec!["value".to_owned()], Type::PointerType(PointerType( Type::TypeName(TypeName::Identifier("Comparable".to_owned())) .into() )) .into() ), tag: None, }, ] }) })] }, str.parse()? ); Ok(()) }
rust_cleaned_test_functions.jsonl/129652
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1175 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 19487, 368, 1464, 5714, 68843, 8261, 92846, 1465, 486, 1454, 2452, 341, 262, 1077, 2213, 284, 8619, 486, 878, 2346, 3904, 33030, 15064, 486, 931, 1005, 5987, 445, 23841, 33220, 67195, 18002, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_write_update_to_file() { let (mut cfg, tmp_dir) = TiKvConfig::with_tmp().unwrap(); cfg.cfg_path = tmp_dir.path().join("cfg_file").to_str().unwrap().to_owned(); { let c = r#" ## comment should be reserve [raftstore] ## comment should be reserve # comment with one `#` should also be reserve sync-log = true # config that comment out by one `#` should be update in place ## pd-heartbeat-tick-interval = "30s" # pd-heartbeat-tick-interval = "30s" [rocksdb.defaultcf] ## config should be update in place block-cache-size = "10GB" [rocksdb.lockcf] ## this config will not update even it has the same last ## name as `rocksdb.defaultcf.block-cache-size` block-cache-size = "512MB" [coprocessor] ## the update to `coprocessor.region-split-keys`, which do not show up ## as key-value pair after [coprocessor], will be written at the end of [coprocessor] [gc] ## config should be update in place max-write-bytes-per-sec = "1KB" [rocksdb.defaultcf.titan] blob-run-mode = "normal" "#; let mut f = File::create(&cfg.cfg_path).unwrap(); f.write_all(c.as_bytes()).unwrap(); f.sync_all().unwrap(); } let mut cfg_controller = ConfigController::new(cfg); let change = { let mut change = HashMap::new(); change.insert( "raftstore.pd-heartbeat-tick-interval".to_owned(), "1h".to_owned(), ); change.insert("raftstore.sync-log".to_owned(), "false".to_owned()); change.insert( "coprocessor.region-split-keys".to_owned(), "10000".to_owned(), ); change.insert("gc.max-write-bytes-per-sec".to_owned(), "100MB".to_owned()); change.insert( "rocksdb.defaultcf.block-cache-size".to_owned(), "1GB".to_owned(), ); change.insert( "rocksdb.defaultcf.titan.blob-run-mode".to_owned(), "read-only".to_owned(), ); change }; cfg_controller.update(change).unwrap(); let res = { let mut buf = Vec::new(); let mut f = File::open(&cfg_controller.get_current().cfg_path).unwrap(); f.read_to_end(&mut buf).unwrap(); buf }; let expect = r#" ## comment should be reserve [raftstore] ## comment should be reserve # comment with one `#` should also be reserve sync-log = false # config that comment out by one `#` should be update in place ## pd-heartbeat-tick-interval = "30s" pd-heartbeat-tick-interval = "1h" [rocksdb.defaultcf] ## config should be update in place block-cache-size = "1GB" [rocksdb.lockcf] ## this config will not update even it has the same last ## name as `rocksdb.defaultcf.block-cache-size` block-cache-size = "512MB" [coprocessor] ## the update to `coprocessor.region-split-keys`, which do not show up ## as key-value pair after [coprocessor], will be written at the end of [coprocessor] region-split-keys = 10000 [gc] ## config should be update in place max-write-bytes-per-sec = "100MB" [rocksdb.defaultcf.titan] blob-run-mode = "read-only" "#; assert_eq!(expect.as_bytes(), res.as_slice()); }
rust_cleaned_test_functions.jsonl/63652
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1298 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9165, 8882, 2346, 2458, 368, 341, 262, 1077, 320, 6984, 13286, 11, 4174, 4334, 8, 284, 22325, 42, 85, 2648, 486, 4197, 16125, 1005, 15454, 543, 262, 13286, 30481, 2638, 284, 4174, 4334, 3875, 10...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_keyrange_inf() { let k1 = KeyRange::Inf; let k2 = KeyRange::new( Bytes::from_static(b"dddd00000000"), Bytes::from_static(b"ffff00000000"), ); assert_eq!(k1.extend(&k2), KeyRange::Inf); assert_eq!(k2.extend(&k1), KeyRange::Inf); assert_eq!(k1.extend(&KeyRange::Empty), k1); assert_eq!(k2.extend(&KeyRange::Empty), k2); assert!(!KeyRange::Inf.overlaps_with(&KeyRange::Empty)); assert!(KeyRange::Empty.overlaps_with(&KeyRange::Inf)); assert!(KeyRange::Empty.overlaps_with(&KeyRange::Empty)); }
rust_cleaned_test_functions.jsonl/112190
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 308 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3097, 9669, 26051, 368, 341, 286, 1077, 595, 16, 284, 5309, 6046, 486, 19433, 280, 286, 1077, 595, 17, 284, 5309, 6046, 486, 931, 1006, 310, 30024, 486, 1499, 25360, 1883, 1, 64100, 15, 15, 15...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_wrong_input_since() { let mut case = get_correct_btc_case(); case.toCKB_cells.inputs[0].since = 1; case.expect_return_code = Error::InputSinceInvalid as i8; case_runner::run_test(case) }
rust_cleaned_test_functions.jsonl/31024
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 97 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 75198, 5898, 56262, 368, 341, 262, 1077, 5206, 1142, 284, 633, 31550, 880, 10413, 19096, 543, 262, 1142, 2389, 3021, 33, 37796, 42388, 58, 15, 936, 11284, 284, 220, 16, 280, 262, 1142, 25952, 12...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_tt_to_stmts() { check( r#" macro_rules! m { () => { let a = 0; a = 10 + 1; a } } fn f() -> i32 { // +tree m!{} } "#, expect![[r#" macro_rules! m { () => { let a = 0; a = 10 + 1; a } } fn f() -> i32 { let a = 0; a = 10+1; a // MACRO_STMTS@0..15 // LET_STMT@0..7 // LET_KW@0..3 "let" // IDENT_PAT@3..4 // NAME@3..4 // IDENT@3..4 "a" // EQ@4..5 "=" // LITERAL@5..6 // INT_NUMBER@5..6 "0" // SEMICOLON@6..7 ";" // EXPR_STMT@7..14 // BIN_EXPR@7..13 // PATH_EXPR@7..8 // PATH@7..8 // PATH_SEGMENT@7..8 // NAME_REF@7..8 // IDENT@7..8 "a" // EQ@8..9 "=" // BIN_EXPR@9..13 // LITERAL@9..11 // INT_NUMBER@9..11 "10" // PLUS@11..12 "+" // LITERAL@12..13 // INT_NUMBER@12..13 "1" // SEMICOLON@13..14 ";" // PATH_EXPR@14..15 // PATH@14..15 // PATH_SEGMENT@14..15 // NAME_REF@14..15 // IDENT@14..15 "a" } "#]], ); }
rust_cleaned_test_functions.jsonl/85216
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 746 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 66740, 2346, 21824, 82, 368, 341, 262, 1779, 1006, 286, 435, 2, 698, 32606, 21407, 0, 296, 341, 262, 1719, 589, 341, 286, 1077, 264, 284, 220, 15, 280, 286, 264, 284, 220, 16, 15, 488, 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_date_add() { fn check((y1,m1,d1): (i32, u32, u32), rhs: Duration, ymd: Option<(i32, u32, u32)>) { let lhs = NaiveDate::from_ymd(y1, m1, d1); let sum = ymd.map(|(y,m,d)| NaiveDate::from_ymd(y, m, d)); assert_eq!(lhs.checked_add_signed(rhs), sum); assert_eq!(lhs.checked_sub_signed(-rhs), sum); } check((2014, 1, 1), Duration::zero(), Some((2014, 1, 1))); check((2014, 1, 1), Duration::seconds(86399), Some((2014, 1, 1))); // always round towards zero check((2014, 1, 1), Duration::seconds(-86399), Some((2014, 1, 1))); check((2014, 1, 1), Duration::days(1), Some((2014, 1, 2))); check((2014, 1, 1), Duration::days(-1), Some((2013, 12, 31))); check((2014, 1, 1), Duration::days(364), Some((2014, 12, 31))); check((2014, 1, 1), Duration::days(365*4 + 1), Some((2018, 1, 1))); check((2014, 1, 1), Duration::days(365*400 + 97), Some((2414, 1, 1))); check((-7, 1, 1), Duration::days(365*12 + 3), Some((5, 1, 1))); // overflow check check((0, 1, 1), Duration::days(MAX_DAYS_FROM_YEAR_0 as i64), Some((MAX_YEAR, 12, 31))); check((0, 1, 1), Duration::days(MAX_DAYS_FROM_YEAR_0 as i64 + 1), None); check((0, 1, 1), Duration::max_value(), None); check((0, 1, 1), Duration::days(MIN_DAYS_FROM_YEAR_0 as i64), Some((MIN_YEAR, 1, 1))); check((0, 1, 1), Duration::days(MIN_DAYS_FROM_YEAR_0 as i64 - 1), None); check((0, 1, 1), Duration::min_value(), None); }
rust_cleaned_test_functions.jsonl/4768
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 765 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4164, 2891, 368, 341, 286, 5168, 1779, 1188, 88, 16, 13086, 16, 11991, 16, 1648, 320, 72, 18, 17, 11, 575, 18, 17, 11, 575, 18, 17, 701, 12916, 25, 21045, 11, 379, 2277, 25, 6959, 28706, 7...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_offline_pay_tx() { let (server, leader_data, alice, ledger_path) = new_validator_for_tests(); let bob_pubkey = Pubkey::new_rand(); let (sender, receiver) = channel(); run_local_faucet(alice, sender, None); let faucet_addr = receiver.recv().unwrap(); let rpc_client = RpcClient::new_socket(leader_data.rpc); let mut config_offline = CliConfig::default(); config_offline.json_rpc_url = format!("http://{}:{}", leader_data.rpc.ip(), leader_data.rpc.port()); let mut config_online = CliConfig::default(); config_online.json_rpc_url = format!("http://{}:{}", leader_data.rpc.ip(), leader_data.rpc.port()); assert_ne!( config_offline.keypair.pubkey(), config_online.keypair.pubkey() ); request_and_confirm_airdrop( &rpc_client, &faucet_addr, &config_offline.keypair.pubkey(), 50, ) .unwrap(); request_and_confirm_airdrop( &rpc_client, &faucet_addr, &config_online.keypair.pubkey(), 50, ) .unwrap(); check_balance(50, &rpc_client, &config_offline.keypair.pubkey()); check_balance(50, &rpc_client, &config_online.keypair.pubkey()); config_offline.command = CliCommand::Pay { lamports: 10, to: bob_pubkey, timestamp: None, timestamp_pubkey: None, witnesses: None, cancelable: false, sign_only: true, signers: None, blockhash: None, }; let sig_response = process_command(&config_offline).unwrap(); check_balance(50, &rpc_client, &config_offline.keypair.pubkey()); check_balance(50, &rpc_client, &config_online.keypair.pubkey()); check_balance(0, &rpc_client, &bob_pubkey); let object: Value = serde_json::from_str(&sig_response).unwrap(); let blockhash_str = object.get("blockhash").unwrap().as_str().unwrap(); let signer_strings = object.get("signers").unwrap().as_array().unwrap(); let signers: Vec<_> = signer_strings .iter() .map(|signer_string| { let mut signer = signer_string.as_str().unwrap().split('='); let key = Pubkey::from_str(signer.next().unwrap()).unwrap(); let sig = Signature::from_str(signer.next().unwrap()).unwrap(); (key, sig) }) .collect(); config_online.command = CliCommand::Pay { lamports: 10, to: bob_pubkey, timestamp: None, timestamp_pubkey: None, witnesses: None, cancelable: false, sign_only: false, signers: Some(signers), blockhash: Some(blockhash_str.parse::<Hash>().unwrap()), }; process_command(&config_online).unwrap(); check_balance(40, &rpc_client, &config_offline.keypair.pubkey()); check_balance(50, &rpc_client, &config_online.keypair.pubkey()); check_balance(10, &rpc_client, &bob_pubkey); server.close().unwrap(); remove_dir_all(ledger_path).unwrap(); }
rust_cleaned_test_functions.jsonl/78056
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1344 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13651, 1056, 28925, 17805, 368, 341, 262, 1077, 320, 4030, 11, 7653, 1769, 11, 70433, 11, 46933, 2638, 8, 284, 501, 64959, 5478, 32509, 543, 262, 1077, 35192, 34014, 792, 284, 22611, 792, 486, 9...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_crc32() { let tmp_dir = TempDir::new("").unwrap(); let small_file = tmp_dir.path().join("small.txt"); let small_checksum = gen_rand_file(&small_file, 1024); assert_eq!(calc_crc32(&small_file).unwrap(), small_checksum); let large_file = tmp_dir.path().join("large.txt"); let large_checksum = gen_rand_file(&large_file, DIGEST_BUFFER_SIZE * 4); assert_eq!(calc_crc32(&large_file).unwrap(), large_checksum); }
rust_cleaned_test_functions.jsonl/15184
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 224 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 38241, 59084, 18, 17, 368, 341, 286, 1077, 4174, 4334, 284, 19944, 6184, 486, 931, 80821, 15454, 1428, 286, 1077, 2613, 2458, 284, 4174, 4334, 3875, 1005, 5987, 445, 9004, 3909, 797, 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_bit_vec_push_pop() { let mut s = BitVec::from_elem(5 * u32::BITS as usize - 2, false); assert_eq!(s.len(), 5 * u32::BITS as usize - 2); assert_eq!(s[5 * u32::BITS as usize - 3], false); s.push(true); s.push(true); assert_eq!(s[5 * u32::BITS as usize - 2], true); assert_eq!(s[5 * u32::BITS as usize - 1], true); // Here the internal vector will need to be extended s.push(false); assert_eq!(s[5 * u32::BITS as usize], false); s.push(false); assert_eq!(s[5 * u32::BITS as usize + 1], false); assert_eq!(s.len(), 5 * u32::BITS as usize + 2); // Pop it all off assert_eq!(s.pop(), Some(false)); assert_eq!(s.pop(), Some(false)); assert_eq!(s.pop(), Some(true)); assert_eq!(s.pop(), Some(true)); assert_eq!(s.len(), 5 * u32::BITS as usize - 2); }
rust_cleaned_test_functions.jsonl/88622
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 394 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13996, 13251, 14218, 17061, 368, 341, 262, 1077, 5206, 274, 284, 6495, 10050, 486, 1499, 28179, 7, 20, 353, 575, 18, 17, 486, 69542, 438, 22301, 481, 220, 17, 11, 895, 317, 262, 2060, 10714, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_encoding() { let actors = Coin::generate_coins(3, 1); let coin_name = "Hello world! Hello world! Hello!"; let mut data = [0u8; 32]; data.copy_from_slice(coin_name.as_bytes()); let share = actors[0].generate_share(&data); // encode let encoded_share: EncodedCoinShare = share.clone().into(); let decoded_share: CoinShare = encoded_share.into(); assert_eq!(share, decoded_share); }
rust_cleaned_test_functions.jsonl/61855
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 210 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 37613, 368, 341, 286, 1077, 19571, 284, 26233, 486, 19366, 11393, 1330, 7, 18, 11, 220, 16, 626, 286, 1077, 16254, 1269, 284, 330, 9707, 1879, 0, 21927, 1879, 0, 21927, 0, 3302, 286, 1077, 520...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_random_73k_test_not_a_multiple_obs_gt_ibs() { new_ucmd!() .args(&[ "ibs=521", "obs=1031", "if=random-5828891cb1230748e146f34223bbd3b5.test", ]) .succeeds() .stdout_is_fixture_bytes("random-5828891cb1230748e146f34223bbd3b5.test"); }
rust_cleaned_test_functions.jsonl/99865
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 199 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 22644, 62, 22, 18, 74, 4452, 7913, 4306, 45233, 30405, 37479, 62, 54341, 368, 341, 262, 501, 68887, 2277, 0, 741, 286, 659, 2116, 2099, 9640, 310, 330, 54341, 28, 20, 17, 16, 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
#[test] fn test_is_numerical_type() { let mut c = Context::new(); let voidt = c.type_void(); { let t = c.get_type(voidt); assert!(!t.is_numerical_type()); } let i32t = c.type_int(32, 1); { let t = c.get_type(i32t); assert!(t.is_numerical_type()); } let f64t = c.type_float(64); { let t = c.get_type(f64t); assert!(t.is_numerical_type()); } let boolt = c.type_bool(); { let t = c.get_type(boolt); assert!(!t.is_numerical_type()); } }
rust_cleaned_test_functions.jsonl/125844
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 396 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6892, 99001, 938, 1819, 368, 341, 286, 1077, 5206, 272, 284, 9608, 486, 931, 543, 286, 1077, 737, 83, 284, 272, 4852, 37775, 543, 286, 341, 310, 1077, 259, 284, 272, 670, 1819, 4333, 83, 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_serialize_get_request() { let request = &PocketGetRequest { search: Some("search"), domain: Some("domain"), tag: Some(PocketGetTag::Untagged), state: Some(PocketGetState::All), content_type: Some(PocketGetType::Article), detail_type: Some(PocketGetDetail::Complete), favorite: Some(false), since: Some(Utc::now()), sort: Some(PocketGetSort::Newest), count: Some(1), offset: Some(2), }; let actual = serde_json::to_string(request).unwrap(); let expected = remove_whitespace(&format!( r#" {{ "search": "{search}", "domain": "{domain}", "tag": "{tag}", "state": "{state}", "contentType": "{content_type}", "detailType": "{detail_type}", "favorite": "{favorite}", "since": "{since}", "sort": "{sort}", "count": "{count}", "offset": "{offset}" }} "#, search = request.search.unwrap(), domain = request.domain.unwrap(), tag = to_inner_json_string(&request.tag.as_ref()), state = to_inner_json_string(&request.state.unwrap()), content_type = to_inner_json_string(&request.content_type.unwrap()), detail_type = to_inner_json_string(&request.detail_type.unwrap()), favorite = if request.favorite.unwrap() { 1 } else { 0 }, since = request.since.unwrap().timestamp().to_string(), sort = to_inner_json_string(&request.sort.unwrap()), count = request.count.unwrap(), offset = request.offset.unwrap(), )); assert_eq!(actual, expected); }
rust_cleaned_test_functions.jsonl/123699
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1072 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 88686, 3062, 7893, 368, 341, 286, 1077, 1681, 284, 609, 63374, 1949, 1900, 341, 310, 2711, 25, 4329, 445, 1836, 4461, 310, 7947, 25, 4329, 445, 12204, 65974, 310, 4772, 25, 4329, 5304, 4537, 194...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_read_real() { let mut ctxt = ReadScope::new(&[ 0x1e, 0xe2, 0xa2, 0x5f, 0x1e, 0x0a, 0x14, 0x05, 0x41, 0xc3, 0xff, ]) .ctxt(); assert_eq!( Op::read(&mut ctxt).unwrap(), Op::Operand(Operand::Real(Real(vec![0xe2, 0xa2, 0x5f]))) ); assert_eq!( Op::read(&mut ctxt).unwrap(), Op::Operand(Operand::Real(Real(vec![ 0x0a, 0x14, 0x05, 0x41, 0xc3, 0xff ]))) ); }
rust_cleaned_test_functions.jsonl/85328
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 345 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6443, 15266, 368, 341, 286, 1077, 5206, 59162, 284, 4457, 10803, 486, 931, 2099, 9640, 5180, 220, 15, 87, 16, 68, 11, 220, 15, 8371, 17, 11, 220, 15, 9591, 17, 11, 220, 15, 87, 20, 69, 11,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_peekable() { let path = Builder::new().prefix("test-raftstore").tempdir().unwrap(); let engines = new_temp_engine(&path); let mut r = Region::default(); r.set_id(10); r.set_start_key(b"key0".to_vec()); r.set_end_key(b"key4".to_vec()); let store = new_peer_storage(engines.clone(), &r); let key3 = b"key3"; engines.kv.put_msg(&data_key(key3), &r).expect(""); let snap = RegionSnapshot::<RocksEngine>::new(&store); let v3 = snap.get_msg(key3).expect(""); assert_eq!(v3, Some(r)); let v0 = snap.get_value(b"key0").expect(""); assert!(v0.is_none()); let v4 = snap.get_value(b"key5"); assert!(v4.is_err()); }
rust_cleaned_test_functions.jsonl/57239
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 382 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 62, 29107, 480, 368, 341, 286, 1077, 1815, 284, 20626, 486, 931, 1005, 11849, 445, 1944, 12, 2944, 4314, 1827, 3888, 3741, 1005, 15454, 543, 286, 1077, 21106, 284, 501, 11771, 24823, 2099, 2343, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_pre_order_traversal_ids() { let mut tree = Tree::new(); let root_id = tree.insert(Node::new(0), AsRoot).unwrap(); let node_1 = tree.insert(Node::new(1), UnderNode(&root_id)).unwrap(); let node_2 = tree.insert(Node::new(2), UnderNode(&root_id)).unwrap(); let node_3 = tree.insert(Node::new(3), UnderNode(&node_1)).unwrap(); let data = [0, 1, 3, 2]; for (index, node_id) in tree.traverse_pre_order_ids(&root_id).unwrap().enumerate() { assert_eq!(tree.get(&node_id).unwrap().data(), &data[index]); } let data = [1, 3]; for (index, node_id) in tree.traverse_pre_order_ids(&node_1).unwrap().enumerate() { assert_eq!(tree.get(&node_id).unwrap().data(), &data[index]); } let data = [2]; for (index, node_id) in tree.traverse_pre_order_ids(&node_2).unwrap().enumerate() { assert_eq!(tree.get(&node_id).unwrap().data(), &data[index]); } let data = [3]; for (index, node_id) in tree.traverse_pre_order_ids(&node_3).unwrap().enumerate() { assert_eq!(tree.get(&node_id).unwrap().data(), &data[index]); } }
rust_cleaned_test_functions.jsonl/49562
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 619 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10442, 7869, 3547, 45545, 8077, 368, 341, 286, 1077, 5206, 4916, 284, 8942, 486, 931, 1428, 16885, 73363, 286, 1077, 3704, 842, 284, 4916, 7030, 22078, 486, 931, 7, 15, 701, 1634, 8439, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
#[test] fn test_parse_arguments_passthrough() { let args = ovec![ "-Oy", "-Gw", "-EHa", "-Fmdictionary-map", "-c", "-Fohost_dictionary.obj", "dictionary.c" ]; let ParsedArguments { input, common_args, dependency_args, preprocessor_args, .. } = match parse_arguments(args) { CompilerArguments::Ok(args) => args, o => panic!("Got unexpected parse result: {:?}", o), }; assert_eq!(Some("dictionary.c"), input.to_str()); assert!(preprocessor_args.is_empty()); assert!(dependency_args.is_empty()); assert!(!common_args.is_empty()); assert_eq!( common_args, ovec!("-Oy", "-Gw", "-EHa", "-Fmdictionary-map") ); }
rust_cleaned_test_functions.jsonl/24589
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 504 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 43433, 79578, 86901, 368, 341, 286, 1077, 2827, 284, 297, 4083, 90515, 310, 6523, 46, 88, 756, 310, 6523, 38, 86, 756, 310, 6523, 36, 32942, 756, 310, 6523, 37, 2277, 3916, 25858, 756, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_lines() { let (at, mut ucmd) = at_and_ucmd!(); let file_read = |f| { let mut s = String::new(); at.open(f).read_to_string(&mut s).unwrap(); s }; // Split into two files without splitting up lines. ucmd.args(&["-n", "l/2", "fivelines.txt"]).succeeds(); assert_eq!(file_read("xaa"), "1\n2\n3\n"); assert_eq!(file_read("xab"), "4\n5\n"); }
rust_cleaned_test_functions.jsonl/25878
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 204 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 18323, 368, 341, 262, 1077, 320, 266, 11, 5206, 575, 8710, 8, 284, 518, 8378, 68887, 2277, 0, 1428, 262, 1077, 1034, 6443, 284, 760, 69, 91, 341, 286, 1077, 5206, 274, 284, 923, 486, 931, 54...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_workspace_settings_defaults() { let config = setup(); config .set_workspace_settings(json!({})) .expect("could not update"); assert_eq!( config.get_workspace_settings(), WorkspaceSettings { enable: false, cache: None, config: None, import_map: None, code_lens: CodeLensSettings { implementations: false, references: false, references_all_functions: false, test: true, }, internal_debug: false, lint: false, suggest: CompletionSettings { complete_function_calls: false, names: true, paths: true, auto_imports: true, imports: ImportCompletionSettings { auto_discover: true, hosts: HashMap::new(), } }, unstable: false, } ); }
rust_cleaned_test_functions.jsonl/20064
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 450 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2602, 75560, 10853, 42290, 368, 341, 262, 1077, 2193, 284, 6505, 543, 262, 2193, 198, 414, 659, 746, 75560, 10853, 9304, 0, 2306, 44194, 414, 659, 17119, 445, 28077, 537, 2647, 797, 262, 2060, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_successive_add() { // we hope these get optimised away with adjacent plus optimisation assert::eq("x = 'c'\n'a' + 'b' + x + 'd' + 'e'", "'abcde'"); }
rust_cleaned_test_functions.jsonl/8197
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 88 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 18632, 533, 2891, 368, 341, 286, 442, 582, 3900, 1493, 633, 7553, 4056, 3123, 448, 23942, 5519, 7553, 7923, 198, 286, 2060, 486, 11006, 445, 87, 284, 364, 66, 15777, 77, 25184, 6, 488, 364, 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
#[test] fn test_gen_keypair() { let (privkey, pubkey) = Generator::random_keypair(); assert_eq!(privkey.pubkey().expect("pubkey"), pubkey); }
rust_cleaned_test_functions.jsonl/122788
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 77 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 16322, 3097, 12670, 368, 341, 286, 1077, 320, 11887, 792, 11, 95116, 8, 284, 28358, 486, 11463, 3097, 12670, 543, 286, 2060, 10714, 10297, 11887, 792, 47773, 792, 1005, 17119, 445, 9585, 792, 3975...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_urlencoded_error() { let (req, mut pl) = TestRequest::with_header(CONTENT_TYPE, "application/x-www-form-urlencoded") .header(CONTENT_LENGTH, "xxxx") .to_http_parts(); let info = block_on(UrlEncoded::<Info>::new(&req, &mut pl)); assert!(eq(info.err().unwrap(), UrlencodedError::UnknownLength)); let (req, mut pl) = TestRequest::with_header(CONTENT_TYPE, "application/x-www-form-urlencoded") .header(CONTENT_LENGTH, "1000000") .to_http_parts(); let info = block_on(UrlEncoded::<Info>::new(&req, &mut pl)); assert!(eq(info.err().unwrap(), UrlencodedError::Overflow)); let (req, mut pl) = TestRequest::with_header(CONTENT_TYPE, "text/plain") .header(CONTENT_LENGTH, "10") .to_http_parts(); let info = block_on(UrlEncoded::<Info>::new(&req, &mut pl)); assert!(eq(info.err().unwrap(), UrlencodedError::ContentType)); }
rust_cleaned_test_functions.jsonl/94523
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 488 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2903, 19329, 4096, 368, 341, 286, 1077, 320, 2958, 11, 5206, 625, 8, 4035, 310, 3393, 1900, 486, 4197, 8757, 98747, 1825, 4189, 11, 330, 5132, 10776, 41242, 8460, 44557, 1138, 394, 659, 2708, 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_max_coding_shreds() { let keypair = Arc::new(Keypair::new()); let hash = hash(Hash::default().as_ref()); let version = shred_version::version_from_hash(&hash); assert_ne!(version, 0); let shredder = Shredder::new(0, 0, 0, version).unwrap(); let entries: Vec<_> = (0..500) .map(|_| { let keypair0 = Keypair::new(); let keypair1 = Keypair::new(); let tx0 = system_transaction::transfer(&keypair0, &keypair1.pubkey(), 1, Hash::default()); Entry::new(&Hash::default(), 1, vec![tx0]) }) .collect(); let mut stats = ProcessShredsStats::default(); let start_index = 0x12; let data_shreds = shredder.entries_to_data_shreds( &keypair, &entries, true, // is_last_in_slot start_index, start_index, // fec_set_offset &mut stats, ); assert!(data_shreds.len() > MAX_DATA_SHREDS_PER_FEC_BLOCK as usize); let next_code_index = data_shreds[0].index(); (1..=MAX_DATA_SHREDS_PER_FEC_BLOCK as usize).for_each(|count| { let coding_shreds = Shredder::data_shreds_to_coding_shreds( &keypair, &data_shreds[..count], false, // is_last_in_slot next_code_index, &mut stats, ) .unwrap(); assert_eq!(coding_shreds.len(), count); let coding_shreds = Shredder::data_shreds_to_coding_shreds( &keypair, &data_shreds[..count], true, // is_last_in_slot next_code_index, &mut stats, ) .unwrap(); assert_eq!( coding_shreds.len(), 2 * MAX_DATA_SHREDS_PER_FEC_BLOCK as usize - count ); }); let coding_shreds = Shredder::data_shreds_to_coding_shreds( &keypair, &data_shreds[..MAX_DATA_SHREDS_PER_FEC_BLOCK as usize + 1], false, // is_last_in_slot next_code_index, &mut stats, ) .unwrap(); assert_eq!( coding_shreds.len(), MAX_DATA_SHREDS_PER_FEC_BLOCK as usize + 1 ); let coding_shreds = Shredder::data_shreds_to_coding_shreds( &keypair, &data_shreds[..MAX_DATA_SHREDS_PER_FEC_BLOCK as usize + 1], true, // is_last_in_slot next_code_index, &mut stats, ) .unwrap(); assert_eq!( coding_shreds.len(), 3 * MAX_DATA_SHREDS_PER_FEC_BLOCK as usize - 1 ); }
rust_cleaned_test_functions.jsonl/22338
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1619 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6345, 666, 3700, 3712, 53369, 368, 341, 286, 1077, 1376, 12670, 284, 19689, 486, 931, 7, 6608, 1082, 1310, 486, 931, 1423, 286, 1077, 5175, 284, 5175, 7, 6370, 486, 2258, 1005, 300, 7793, 1423, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_change_position() { test_harness(|| unsafe { library_init(); let session = get_session(); const N: usize = 10; let uris = vec!["http://localhost/".into()]; let mut gids = [A2Gid::default(); N]; for i in 0..N { assert_eq!(add_uri(session, &mut gids[i], &uris, &vec![], -1), 0); } assert_eq!( change_position(session, 0, -2, OffsetMode::OFFSET_MODE_CUR), -1 ); assert_eq!( change_position(session, gids[4], -2, OffsetMode::OFFSET_MODE_CUR), 2 ); assert_eq!( change_position(session, gids[4], 5, OffsetMode::OFFSET_MODE_SET), 5 ); assert_eq!( change_position(session, gids[4], -2, OffsetMode::OFFSET_MODE_END), 7 ); session_final(session); library_deinit(); }); }
rust_cleaned_test_functions.jsonl/25965
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 509 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15947, 9661, 368, 341, 262, 1273, 1523, 23518, 79453, 19860, 341, 286, 6733, 6137, 543, 286, 1077, 3797, 284, 633, 12316, 1428, 286, 733, 451, 25, 22301, 284, 220, 16, 15, 280, 286, 1077, 4335, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_bad_form_missing_fields() { let bad_inputs: [&str; 8] = [ "&", "=", "username=Sergio", "password=pass", "age=30", "username=Sergio&password=pass", "username=Sergio&age=30", "password=pass&age=30" ]; for bad_input in &bad_inputs { check_bad_form(bad_input, Status::UnprocessableEntity); } }
rust_cleaned_test_functions.jsonl/46559
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 210 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 34199, 7915, 40447, 12132, 368, 341, 262, 1077, 3873, 28557, 25, 34336, 495, 26, 220, 23, 60, 284, 2278, 286, 13399, 756, 286, 36234, 345, 286, 330, 5113, 72196, 2375, 815, 756, 286, 330, 3833, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_unsupported_items_are_emitted() -> Result<()> { // We will have to rewrite this test to use something else that is unsupported // once we start importing nested structs. let ir = ir_from_cc("struct X { struct Y {}; };")?; assert_strings_contain( ir.unsupported_items().map(|i| i.name.as_str()).collect_vec().as_slice(), "X::Y", ); Ok(()) }
rust_cleaned_test_functions.jsonl/37220
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 161 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4907, 18216, 12134, 56855, 22504, 3762, 368, 1464, 5714, 71698, 341, 262, 442, 1205, 686, 614, 311, 18130, 419, 1273, 311, 990, 2494, 770, 429, 374, 40409, 198, 262, 442, 3055, 582, 1191, 49895, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_storage_create_snapshot() { setup_for_test(); let ents = vec![new_entry(3, 3), new_entry(4, 4), new_entry(5, 5)]; let nodes = vec![1, 2, 3]; let mut cs = ConfState::new(); cs.set_nodes(nodes.clone()); let data = b"data".to_vec(); let mut tests = vec![ (4, Ok(new_snapshot(4, 4, nodes.clone(), data.clone()))), (5, Ok(new_snapshot(5, 5, nodes.clone(), data.clone()))), ]; for (i, (idx, wresult)) in tests.drain(..).enumerate() { let storage = MemStorage::new(); storage.wl().entries = ents.clone(); storage .wl() .create_snapshot(idx, Some(cs.clone()), data.clone()) .expect("create snapshot failed"); let result = storage.snapshot(); if result != wresult { panic!("#{}: want {:?}, got {:?}", i, wresult, result); } } }
rust_cleaned_test_functions.jsonl/50262
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 519 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 23310, 8657, 53265, 368, 341, 286, 6505, 5478, 4452, 543, 286, 1077, 36852, 284, 7486, 20703, 931, 9078, 7, 18, 11, 220, 18, 701, 501, 9078, 7, 19, 11, 220, 19, 701, 501, 9078, 7, 20, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_cairo_short_string_to_felt() { let data = [ ( "abcdefghijklmnopqrstuvwxyz", "156490583352162063278528710879425690470022892627113539022649722", ), ( "1234567890123456789012345678901", "86921973946889608444641514252360676678984087116218318142845213717418291249", ), ]; for (str, felt_dec) in data.into_iter() { assert_eq!( cairo_short_string_to_felt(str).unwrap(), FieldElement::from_dec_str(felt_dec).unwrap() ); } }
rust_cleaned_test_functions.jsonl/53656
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 393 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 666, 25549, 16673, 3904, 2346, 761, 3818, 368, 341, 286, 1077, 821, 284, 2278, 310, 2399, 394, 330, 67512, 756, 394, 330, 16, 20, 21, 19, 24, 15, 20, 23, 18, 18, 20, 17, 16, 21, 17, 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_params() { block_on(async { let srv = TestServer::start(|| { HttpService::new( App::new() .service(get_param_test) .service(put_param_test) .service(delete_param_test), ) }); let request = srv.request(http::Method::GET, srv.url("/test/it")); let response = request.send().await.unwrap(); assert_eq!(response.status(), http::StatusCode::OK); let request = srv.request(http::Method::PUT, srv.url("/test/it")); let response = request.send().await.unwrap(); assert_eq!(response.status(), http::StatusCode::CREATED); let request = srv.request(http::Method::DELETE, srv.url("/test/it")); let response = request.send().await.unwrap(); assert_eq!(response.status(), http::StatusCode::NO_CONTENT); }) }
rust_cleaned_test_functions.jsonl/129740
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 441 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6745, 368, 341, 262, 2504, 4470, 18285, 341, 286, 1077, 43578, 284, 3393, 5475, 486, 2468, 79453, 341, 310, 4823, 1860, 486, 931, 1006, 394, 1845, 486, 931, 741, 503, 659, 7936, 5433, 4090, 4452...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_tree_walk() { let mut parser = Parser::new(); parser.set_language(get_language("rust")).unwrap(); let tree = parser .parse( " struct Stuff { a: A; b: Option<B>, } ", None, ) .unwrap(); let mut cursor = tree.walk(); assert_eq!(cursor.node().kind(), "source_file"); assert!(cursor.goto_first_child()); assert_eq!(cursor.node().kind(), "struct_item"); assert!(cursor.goto_first_child()); assert_eq!(cursor.node().kind(), "struct"); assert_eq!(cursor.node().is_named(), false); assert!(cursor.goto_next_sibling()); assert_eq!(cursor.node().kind(), "type_identifier"); assert_eq!(cursor.node().is_named(), true); assert!(cursor.goto_next_sibling()); assert_eq!(cursor.node().kind(), "field_declaration_list"); assert_eq!(cursor.node().is_named(), true); }
rust_cleaned_test_functions.jsonl/131720
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 469 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11663, 56131, 368, 341, 262, 1077, 5206, 6729, 284, 21102, 486, 931, 543, 262, 6729, 980, 29021, 5433, 29021, 445, 35788, 15197, 15454, 1428, 262, 1077, 4916, 284, 6729, 198, 286, 659, 6400, 1006,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_endpoint() { let mut buf1 = [0u8; 500]; let mut buf2 = [0u8; 500]; let mut write_buf = [0u8; RCV_BUF_MAX_SIZE + 100]; let mut t = ConnectionTester::new(); let mut syn = t.write_syn(buf1.as_mut()); // Put another flag on the SYN so it becomes invalid. syn.set_flags_after_ns(TcpFlags::ACK); assert_eq!( Endpoint::new_with_defaults(&syn).unwrap_err(), PassiveOpenError::InvalidSyn ); // Fix the SYN and create an endpoint. syn.set_flags_after_ns(TcpFlags::SYN); let remote_isn = syn.sequence_number(); let mut e = Endpoint::new_with_defaults(&syn).unwrap(); // Let's complete the three-way handshake. The next segment sent by the endpoint should // be a SYNACK. assert_eq!(e.next_segment_status(), NextSegmentStatus::Available); let endpoint_isn = { // We need this block to delimit the mut borrow of write_buf. let s = e .write_next_segment(write_buf.as_mut(), t.mss_reserved) .unwrap(); assert_eq!(s.inner().flags_after_ns(), TcpFlags::SYN | TcpFlags::ACK); s.inner().sequence_number() }; // A RTO should be pending until the SYNACK is ACKed. if let NextSegmentStatus::Timeout(_) = e.next_segment_status() { assert_eq!( e.next_segment_status(), e.connection().control_segment_or_timeout_status() ); } else { panic!("missing expected timeout."); } // And now we ACK the SYNACK. let mut ctrl = t.write_ctrl(buf2.as_mut()); ctrl.set_flags_after_ns(TcpFlags::ACK); ctrl.set_ack_number(endpoint_isn.wrapping_add(1)); assert!(!e.connection.is_established()); e.receive_segment(&ctrl); assert!(e.connection.is_established()); assert_eq!(e.next_segment_status(), NextSegmentStatus::Nothing); // Incomplete because it's missing the newlines at the end. let incomplete_request = b"GET http://169.254.169.255/asdfghjkl HTTP/1.1"; { let mut data = t.write_data(write_buf.as_mut(), incomplete_request.as_ref()); data.set_flags_after_ns(TcpFlags::ACK); data.set_sequence_number(remote_isn.wrapping_add(1)); data.set_ack_number(endpoint_isn.wrapping_add(1)); e.receive_segment(&data); } assert_eq!(e.receive_buf_left, incomplete_request.len()); // 1 for the SYN. let mut remote_first_not_sent = remote_isn.wrapping_add(1 + incomplete_request.len() as u32); // The endpoint should write an ACK at this point. { assert_eq!(e.next_segment_status(), NextSegmentStatus::Available); let s = e .write_next_segment(write_buf.as_mut(), t.mss_reserved) .unwrap(); assert_eq!(s.inner().flags_after_ns(), TcpFlags::ACK); assert_eq!(s.inner().ack_number(), remote_first_not_sent); } // There should be nothing else to send. assert_eq!(e.next_segment_status(), NextSegmentStatus::Nothing); let rest_of_the_request = b"\r\n\r\n"; // Let's also send the newlines. { let mut data = t.write_data(write_buf.as_mut(), rest_of_the_request.as_ref()); data.set_flags_after_ns(TcpFlags::ACK); data.set_sequence_number(remote_first_not_sent); data.set_ack_number(endpoint_isn + 1); e.receive_segment(&data); } remote_first_not_sent = remote_first_not_sent.wrapping_add(rest_of_the_request.len() as u32); let mut endpoint_first_not_sent; // We should get a data segment that also ACKs the latest bytes received. { assert_eq!(e.next_segment_status(), NextSegmentStatus::Available); let s = e .write_next_segment(write_buf.as_mut(), t.mss_reserved) .unwrap(); assert_eq!(s.inner().flags_after_ns(), TcpFlags::ACK); assert_eq!(s.inner().ack_number(), remote_first_not_sent); let response = from_utf8(s.inner().payload()).unwrap(); // The response should contain "404" because the MMDS is empty. assert!(response.contains("404")); endpoint_first_not_sent = s .inner() .sequence_number() .wrapping_add(s.inner().payload_len() as u32); } // We're going to use the simple approach where we send the same request over and over let complete_request = b"GET http://169.254.169.255/asdfghjkl HTTP/1.1\r\n\r\n"; let last_request = b"GET http://169.254.169.255/asdfghjkl HTTP/1.1\n\n123"; let max_iter = e.receive_buf.len(); for i in 1..=max_iter { // We want to use last_request for the last request. let request = if i == max_iter { last_request.as_ref() } else { complete_request.as_ref() }; // Send request. { let mut data = t.write_data(write_buf.as_mut(), request); data.set_flags_after_ns(TcpFlags::ACK); data.set_sequence_number(remote_first_not_sent); data.set_ack_number(endpoint_first_not_sent); e.receive_segment(&data); } remote_first_not_sent = remote_first_not_sent.wrapping_add(request.len() as u32); // Check response. { let s = e .write_next_segment(write_buf.as_mut(), t.mss_reserved) .unwrap(); assert_eq!(s.inner().flags_after_ns(), TcpFlags::ACK); assert_eq!(s.inner().ack_number(), remote_first_not_sent); let response = from_utf8(s.inner().payload()).unwrap(); assert!(response.contains("404")); endpoint_first_not_sent = endpoint_first_not_sent.wrapping_add(s.inner().payload_len() as u32); } } // last_request. assert_eq!(e.receive_buf_left, 3); // near the expiry of the eviction timer. assert!(!e.is_evictable()); // Let's hack this a bit and change the eviction_threshold to 0. e.set_eviction_threshold(0); // The endpoint should be evictable now. assert!(e.is_evictable()); // reset we expect on the next segment. let request_to_fill = vec![0u8; RCV_BUF_MAX_SIZE - e.receive_buf_left]; { t.mss = RCV_BUF_MAX_SIZE as u16; let mut data = t.write_data(write_buf.as_mut(), request_to_fill.as_ref()); data.set_flags_after_ns(TcpFlags::ACK); data.set_sequence_number(remote_first_not_sent); data.set_ack_number(endpoint_first_not_sent); e.receive_segment(&data); } { let s = e .write_next_segment(write_buf.as_mut(), t.mss_reserved) .unwrap(); assert_eq!(s.inner().flags_after_ns(), TcpFlags::RST); } }
rust_cleaned_test_functions.jsonl/4125
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 3722 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 36699, 368, 341, 286, 1077, 5206, 6607, 16, 284, 508, 15, 84, 23, 26, 220, 20, 15, 15, 935, 286, 1077, 5206, 6607, 17, 284, 508, 15, 84, 23, 26, 220, 20, 15, 15, 4821, 286, 1077, 5206, 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...
4
#[test] fn test_samples() { assert_eq!( Passenger { id: 357, row: 44, column: 5 }, Passenger::parse("FBFBBFFRLR").unwrap() ); assert_eq!( Passenger { id: 567, row: 70, column: 7 }, Passenger::parse("BFFFBBFRRR").unwrap() ); assert_eq!( Passenger { id: 119, row: 14, column: 7 }, Passenger::parse("FFFBBBFRRR").unwrap() ); assert_eq!( Passenger { id: 820, row: 102, column: 4 }, Passenger::parse("BBFFBBFRLL").unwrap() ); }
rust_cleaned_test_functions.jsonl/78082
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 428 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 18297, 368, 341, 262, 2060, 10714, 33673, 286, 67634, 341, 310, 877, 25, 220, 18, 20, 22, 345, 310, 2802, 25, 220, 19, 19, 345, 310, 3250, 25, 220, 20, 198, 286, 1153, 286, 67634, 486, 6400,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_entry_success() { let tests = [ // Basics ( &b"First: 1"[..], vec![(Binding::Tight, Component::Normal("First".to_string()))], &b"1"[..], ), ( b"First.second: 1", vec![ (Binding::Tight, Component::Normal("First".to_string())), (Binding::Tight, Component::Normal("second".to_string())), ], b"1", ), ( b"First..second: 1", vec![ (Binding::Tight, Component::Normal("First".to_string())), (Binding::Tight, Component::Normal("second".to_string())), ], b"1", ), // Wildcards ( b"?.second: 1", vec![ (Binding::Tight, Component::Wildcard), (Binding::Tight, Component::Normal("second".to_string())), ], b"1", ), ( b"First.?.third: 1", vec![ (Binding::Tight, Component::Normal("First".to_string())), (Binding::Tight, Component::Wildcard), (Binding::Tight, Component::Normal("third".to_string())), ], b"1", ), // Loose bindings ( b"*second: 1", vec![(Binding::Loose, Component::Normal("second".to_string()))], b"1", ), ( b"First*third: 1", vec![ (Binding::Tight, Component::Normal("First".to_string())), (Binding::Loose, Component::Normal("third".to_string())), ], b"1", ), ( b"First**third: 1", vec![ (Binding::Tight, Component::Normal("First".to_string())), (Binding::Loose, Component::Normal("third".to_string())), ], b"1", ), // Combinations ( b"First*?.fourth: 1", vec![ (Binding::Tight, Component::Normal("First".to_string())), (Binding::Loose, Component::Wildcard), (Binding::Tight, Component::Normal("fourth".to_string())), ], b"1", ), // Values ( b"First: 1337", vec![(Binding::Tight, Component::Normal("First".to_string()))], b"1337", ), ( b"First: -1337", vec![(Binding::Tight, Component::Normal("First".to_string()))], b"-1337", ), ( b"First: 13.37", vec![(Binding::Tight, Component::Normal("First".to_string()))], b"13.37", ), ( b"First: value", vec![(Binding::Tight, Component::Normal("First".to_string()))], b"value", ), ( b"First: #abcdef", vec![(Binding::Tight, Component::Normal("First".to_string()))], b"#abcdef", ), ( b"First: { key: 'value' }", vec![(Binding::Tight, Component::Normal("First".to_string()))], b"{ key: 'value' }", ), ( b"First: x?y", vec![(Binding::Tight, Component::Normal("First".to_string()))], b"x?y", ), ( b"First: x*y", vec![(Binding::Tight, Component::Normal("First".to_string()))], b"x*y", ), // Whitespace ( b"First: x", vec![(Binding::Tight, Component::Normal("First".to_string()))], b"x", ), ( b"First: x ", vec![(Binding::Tight, Component::Normal("First".to_string()))], b"x ", ), ( b"First: x ", vec![(Binding::Tight, Component::Normal("First".to_string()))], b"x ", ), ( b"First:x", vec![(Binding::Tight, Component::Normal("First".to_string()))], b"x", ), ( b"First: \t x", vec![(Binding::Tight, Component::Normal("First".to_string()))], b"x", ), ( b"First: \t x \t", vec![(Binding::Tight, Component::Normal("First".to_string()))], b"x \t", ), // Special characters ( b"First: \\ x", vec![(Binding::Tight, Component::Normal("First".to_string()))], b" x", ), ( b"First: x\\ x", vec![(Binding::Tight, Component::Normal("First".to_string()))], b"x x", ), ( b"First: \\\tx", vec![(Binding::Tight, Component::Normal("First".to_string()))], b"\tx", ), ( b"First: \\011x", vec![(Binding::Tight, Component::Normal("First".to_string()))], b"\tx", ), ( b"First: x\\\\x", vec![(Binding::Tight, Component::Normal("First".to_string()))], b"x\\x", ), ( b"First: x\\nx", vec![(Binding::Tight, Component::Normal("First".to_string()))], b"x\nx", ), ( b"First: \\080", vec![(Binding::Tight, Component::Normal("First".to_string()))], b"\\080", ), ( b"First: \\00a", vec![(Binding::Tight, Component::Normal("First".to_string()))], b"\\00a", ), // Own tests ( b"First: \\", vec![(Binding::Tight, Component::Normal("First".to_string()))], b"\\", ), ( b"First: \\xxx", vec![(Binding::Tight, Component::Normal("First".to_string()))], b"\\xxx", ), ( b"First: \\1xx", vec![(Binding::Tight, Component::Normal("First".to_string()))], b"\\1xx", ), ( b"First: \\10x", vec![(Binding::Tight, Component::Normal("First".to_string()))], b"\\10x", ), ( b"First: \\100", vec![(Binding::Tight, Component::Normal("First".to_string()))], b"@", ), ( b"First: \\n", vec![(Binding::Tight, Component::Normal("First".to_string()))], b"\n", ), ]; for (data, resource, value) in tests.iter() { run_entry_test(data, resource, value); } }
rust_cleaned_test_functions.jsonl/113429
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 4849 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 9078, 18632, 368, 341, 286, 1077, 7032, 284, 2278, 310, 442, 67176, 198, 310, 2399, 394, 609, 65, 1, 5338, 25, 220, 16, 36864, 496, 1259, 394, 7486, 0, 9697, 15059, 486, 51, 491, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_angle() { assert!(Vector2::new(1.0f64, 0.0f64).angle(&Vector2::new(0.0f64, 1.0f64)).approx_eq( &rad(f64::consts::FRAC_PI_2) )); assert!(Vector2::new(10.0f64, 0.0f64).angle(&Vector2::new(0.0f64, 5.0f64)).approx_eq( &rad(f64::consts::FRAC_PI_2) )); assert!(Vector2::new(-1.0f64, 0.0f64).angle(&Vector2::new(0.0f64, 1.0f64)).approx_eq( &-rad(f64::consts::FRAC_PI_2) )); assert!(Vector3::new(1.0f64, 0.0f64, 1.0f64).angle(&Vector3::new(1.0f64, 1.0f64, 0.0f64)).approx_eq( &rad(f64::consts::FRAC_PI_3) )); assert!(Vector3::new(10.0f64, 0.0f64, 10.0f64).angle(&Vector3::new(5.0f64, 5.0f64, 0.0f64)).approx_eq( &rad(f64::consts::FRAC_PI_3) )); assert!(Vector3::new(-1.0f64, 0.0f64, -1.0f64).angle(&Vector3::new(1.0f64, -1.0f64, 0.0f64)).approx_eq( &rad(2.0f64 * f64::consts::FRAC_PI_3) )); assert!(Vector4::new(1.0f64, 0.0f64, 1.0f64, 0.0f64).angle(&Vector4::new(0.0f64, 1.0f64, 0.0f64, 1.0f64)).approx_eq( &rad(f64::consts::FRAC_PI_2) )); assert!(Vector4::new(10.0f64, 0.0f64, 10.0f64, 0.0f64).angle(&Vector4::new(0.0f64, 5.0f64, 0.0f64, 5.0f64)).approx_eq( &rad(f64::consts::FRAC_PI_2) )); assert!(Vector4::new(-1.0f64, 0.0f64, -1.0f64, 0.0f64).angle(&Vector4::new(0.0f64, 1.0f64, 0.0f64, 1.0f64)).approx_eq( &rad(f64::consts::FRAC_PI_2) )); }
rust_cleaned_test_functions.jsonl/5670
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 722 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21727, 368, 341, 262, 2060, 10297, 3781, 17, 486, 931, 7, 16, 13, 15, 69, 21, 19, 11, 220, 15, 13, 15, 69, 21, 19, 568, 4044, 2099, 3781, 17, 486, 931, 7, 15, 13, 15, 69, 21, 19, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_proxy_view_assistant_first_call_input_event() -> std::result::Result<(), anyhow::Error> { let context = &mut ViewAssistantContext::new_for_testing(); let mut mock1 = MockProxyViewAssistant::new(); mock1.expect_handle_input_event().times(2).returning(|_, _| Ok(())); mock1.expect_handle_focus_event().times(1).returning(|_, _| Ok(())); let mut proxy = ProxyViewAssistant::new(Box::new(mock1)).unwrap(); let event = get_input_event(); assert_eq!(proxy.first_call_after_switch, true); proxy.handle_input_event(context, &event)?; assert_eq!(proxy.first_call_after_switch, false); proxy.handle_input_event(context, &event)?; assert_eq!(proxy.first_call_after_switch, false); Ok(()) }
rust_cleaned_test_functions.jsonl/86703
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 343 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 29712, 7122, 12083, 11202, 12978, 13429, 5898, 6748, 368, 1464, 1460, 486, 1382, 486, 2077, 68843, 88964, 486, 1454, 397, 262, 341, 286, 1077, 2266, 284, 609, 6984, 2738, 71703, 1972, 486, 931, 54...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_decode_movt() { assert_eq!( decode_32(0xf2c20100), Instruction::MOVT { params: MovtParams { rd: Reg::R1, imm16: 0x2000 } } ); }
rust_cleaned_test_functions.jsonl/64874
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 163 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15227, 55798, 83, 368, 341, 14808, 262, 2060, 10714, 33673, 286, 16895, 62, 18, 17, 7, 15, 5848, 17, 66, 17, 15, 16, 15, 15, 1326, 286, 29051, 486, 10531, 20457, 341, 310, 3628, 25, 53285, 8...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_touch_start_event() { let event: TouchStart = js!( return new TouchEvent( @{TouchStart::EVENT_TYPE} ); ).try_into().unwrap(); assert_eq!( event.event_type(), TouchStart::EVENT_TYPE ); }
rust_cleaned_test_functions.jsonl/86599
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 114 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 60840, 4906, 6748, 368, 341, 286, 1077, 1538, 25, 19338, 3479, 284, 6994, 33673, 310, 470, 501, 19338, 1556, 7, 33267, 11309, 3479, 486, 37349, 4189, 92, 1439, 286, 7457, 1539, 45514, 1005, 15454,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_multiply_dice_launches() { assert_eq!(multiply_dice_launches(&vec![6, 6], 6), BigUint::from(35u32)); assert_eq!(multiply_dice_launches(&vec![6], 6), BigUint::from(5u32)); assert_eq!( multiply_dice_launches(&vec![10, 10], 10), BigUint::from(99u32) ); assert_eq!( multiply_dice_launches(&vec![1, 1, 1], 2), BigUint::from(0u32) ); assert_eq!(multiply_dice_launches(&vec![2], 2), BigUint::from(1u32)); }
rust_cleaned_test_functions.jsonl/39503
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 300 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 93054, 97196, 51617, 288, 368, 341, 286, 2060, 10714, 10297, 64648, 97196, 51617, 288, 2099, 4083, 20703, 21, 11, 220, 21, 1125, 220, 21, 701, 6164, 21570, 486, 1499, 7, 18, 20, 84, 18, 17, 11...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_parse_fallback() { use Fallback; use bech32::FromBase32; let cases = vec![ ( from_bech32("3x9et2e20v6pu37c5d9vax37wxq72un98".as_bytes()), Ok(Fallback::PubKeyHash([ 0x31, 0x72, 0xb5, 0x65, 0x4f, 0x66, 0x83, 0xc8, 0xfb, 0x14, 0x69, 0x59, 0xd3, 0x47, 0xce, 0x30, 0x3c, 0xae, 0x4c, 0xa7 ])) ), ( from_bech32("j3a24vwu6r8ejrss3axul8rxldph2q7z9".as_bytes()), Ok(Fallback::ScriptHash([ 0x8f, 0x55, 0x56, 0x3b, 0x9a, 0x19, 0xf3, 0x21, 0xc2, 0x11, 0xe9, 0xb9, 0xf3, 0x8c, 0xdf, 0x68, 0x6e, 0xa0, 0x78, 0x45 ])) ), ( from_bech32("qw508d6qejxtdg4y5r3zarvary0c5xw7k".as_bytes()), Ok(Fallback::SegWitProgram { version: u5::try_from_u8(0).unwrap(), program: Vec::from(&[ 0x75u8, 0x1e, 0x76, 0xe8, 0x19, 0x91, 0x96, 0xd4, 0x54, 0x94, 0x1c, 0x45, 0xd1, 0xb3, 0xa3, 0x23, 0xf1, 0x43, 0x3b, 0xd6 ][..]) }) ), ( vec![u5::try_from_u8(21).unwrap(); 41], Err(ParseError::Skip) ), ( vec![], Err(ParseError::UnexpectedEndOfTaggedFields) ), ( vec![u5::try_from_u8(1).unwrap(); 81], Err(ParseError::InvalidSegWitProgramLength) ), ( vec![u5::try_from_u8(17).unwrap(); 1], Err(ParseError::InvalidPubKeyHashLength) ), ( vec![u5::try_from_u8(18).unwrap(); 1], Err(ParseError::InvalidScriptHashLength) ) ]; for (input, expected) in cases.into_iter() { assert_eq!(Fallback::from_base32(&input), expected); } }
rust_cleaned_test_functions.jsonl/123249
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 894 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 761, 3420, 368, 341, 197, 41819, 434, 3420, 280, 197, 41819, 387, 331, 18, 17, 486, 3830, 3978, 18, 17, 401, 197, 10217, 5048, 284, 7486, 90515, 298, 197, 1006, 571, 42727, 880, 4737, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_spec() { let project = Project { name: "Example".to_owned(), targets: vec![( "Example".to_owned(), Target { product_type: ProductType::Application, platform: vec![Platform::IOS].into_iter().collect(), deployment_targets: vec![(Platform::IOS, "8.0".to_owned())] .into_iter() .collect(), sources: vec![TargetSource { path: "Sources".to_owned(), }], settings: vec![ ( "LIBRARY_SEARCH_PATHS".to_owned(), "../x86_64-apple-ios/debug".to_owned(), ), ("OTHER_LDFLAGS".to_owned(), "-ObjC".to_owned()), ] .into_iter() .collect(), dependencies: vec![Dependency::Framework { framework: "libexample.a".to_owned(), embed: false, }], }, )] .into_iter() .collect(), }; let result = serde_yaml::to_string(&project).unwrap(); println!("Result: {}", result); }
rust_cleaned_test_functions.jsonl/47164
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 873 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13594, 368, 341, 286, 1077, 2390, 284, 5787, 341, 310, 829, 25, 330, 13314, 3263, 983, 51973, 3148, 310, 11550, 25, 7486, 20703, 1006, 394, 330, 13314, 3263, 983, 51973, 3148, 394, 13483, 341, 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_generic_named_fields_struct() { Python::with_gil(|py| { let pye = PyE { test: "test".into(), test2: 2, } .into_py(py); let e: E<String, usize> = E::extract(pye.as_ref(py)).expect("Failed to extract E<String, usize> from PyE"); assert_eq!(e.test, "test"); assert_eq!(e.test2, 2); let e = E::<usize, usize>::extract(pye.as_ref(py)); assert!(e.is_err()); }); }
rust_cleaned_test_functions.jsonl/59468
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 272 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 41232, 71834, 12132, 15126, 368, 341, 262, 13027, 486, 4197, 1889, 321, 22428, 3288, 91, 341, 286, 1077, 4510, 68, 284, 5355, 36, 341, 310, 1273, 25, 330, 1944, 3263, 18122, 3148, 310, 1273, 17,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_slice_mod() { let cases: [(Vec<u8>, usize, usize); 5] = [ (vec![0], 10, 0), (vec![1], 10, 1), (vec![9], 10, 9), (vec![10], 10, 0), (vec![100, 0, 0, 1], 10, 1), ]; for (challenge, count, expected) in &cases { assert_eq!(slice_mod(challenge, *count), *expected); } }
rust_cleaned_test_functions.jsonl/101155
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 237 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 26488, 7480, 368, 341, 286, 1077, 5048, 25, 17826, 10050, 34837, 23, 8066, 22301, 11, 22301, 1215, 220, 20, 60, 284, 2278, 310, 320, 4083, 20703, 15, 1125, 220, 16, 15, 11, 220, 15, 1326, 310,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_insert() { Interpreter::default().enter(|vm| { let dict = Dict::default(); assert_eq!(0, dict.len()); let key1 = vm.ctx.new_bool(true); let value1 = vm.ctx.new_str("abc"); dict.insert(&vm, key1.clone(), value1.clone()).unwrap(); assert_eq!(1, dict.len()); let key2 = vm.ctx.new_str("x"); let value2 = vm.ctx.new_str("def"); dict.insert(&vm, key2.clone(), value2.clone()).unwrap(); assert_eq!(2, dict.len()); dict.insert(&vm, key1.clone(), value2.clone()).unwrap(); assert_eq!(2, dict.len()); dict.delete(&vm, key1.clone()).unwrap(); assert_eq!(1, dict.len()); dict.insert(&vm, key1.clone(), value2.clone()).unwrap(); assert_eq!(2, dict.len()); assert_eq!(true, dict.contains(&vm, &key1).unwrap()); assert_eq!(true, dict.contains(&vm, &"x").unwrap()); let val = dict.get(&vm, &"x").unwrap().unwrap(); vm.bool_eq(&val, &value2) .expect("retrieved value must be equal to inserted value."); }) }
rust_cleaned_test_functions.jsonl/8338
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 620 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 17678, 368, 341, 286, 82493, 486, 2258, 1005, 1950, 22428, 7338, 91, 341, 310, 1077, 6451, 284, 29126, 486, 2258, 543, 310, 2060, 10714, 10297, 15, 11, 6451, 19406, 5231, 310, 1077, 1376, 16, 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_rsub_assign_big_decimal() { let mut nr0: [DecimalDigit<u8>; 0] = []; let nr1: [DecimalDigit<u8>; 0] = []; let res = rsub_assign_big(&mut nr0, &nr1); assert_eq!(nr0, []); assert_eq!(res, Ok(0)); let mut nr0 = [DecimalDigit(34u8), DecimalDigit(12)]; let nr1 = [DecimalDigit(36u8), DecimalDigit(16)]; let res = rsub_assign_big(&mut nr0, &nr1); assert_eq!(nr0, [DecimalDigit(2), DecimalDigit(4)]); assert_eq!(res, Ok(2)); let mut nr0 = [DecimalDigit(36u8), DecimalDigit(16)]; let nr1 = [DecimalDigit(34u8), DecimalDigit(12)]; let res = rsub_assign_big(&mut nr0, &nr1); assert_eq!(nr0, [DecimalDigit(98), DecimalDigit(95)]); assert_eq!(res, Err(Error::Underflow)); let mut nr0 = [DecimalDigit(36u8), DecimalDigit(16)]; let nr1 = [DecimalDigit(34u8), DecimalDigit(17)]; let res = rsub_assign_big(&mut nr0, &nr1); assert_eq!(nr0, [DecimalDigit(98), DecimalDigit(0)]); assert_eq!(res, Ok(1)); let mut nr0 = [DecimalDigit(36u8), DecimalDigit(16)]; let nr1 = [DecimalDigit(34u8), DecimalDigit(16)]; let res = rsub_assign_big(&mut nr0, &nr1); assert_eq!(nr0, [DecimalDigit(98), DecimalDigit(99)]); assert_eq!(res, Err(Error::Underflow)); let mut nr0 = [DecimalDigit(287_091_918u32), DecimalDigit(827_909_001), DecimalDigit(275_599_012)]; let nr1 = [DecimalDigit(874_762_199u32), DecimalDigit(564_887_009), DecimalDigit(387_764_666)]; let res = rsub_assign_big(&mut nr0, &nr1); assert_eq!(nr0, [DecimalDigit(587_670_281), DecimalDigit(736_978_008), DecimalDigit(112_165_653)]); assert_eq!(res, Ok(3)); }
rust_cleaned_test_functions.jsonl/45901
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 934 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1710, 1966, 20688, 36386, 74429, 741, 262, 341, 286, 1077, 5206, 20262, 15, 25, 508, 11269, 36420, 34837, 23, 65795, 220, 15, 60, 284, 5907, 286, 1077, 20262, 16, 25, 508, 11269, 36420, 34837, 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