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_parquet_derive_hello() { let file = get_temp_file("test_parquet_derive_hello", &[]); // schema agrees with what one would write by hand. let schema_str = "message rust_schema { REQUIRED boolean a_bool; REQUIRED BINARY a_str (STRING); REQUIRED BINARY a_string (STRING); REQUIRED BINARY a_borrowed_string (STRING); OPTIONAL BINARY maybe_a_str (STRING); OPTIONAL BINARY maybe_a_string (STRING); REQUIRED INT32 i16 (INTEGER(16,true)); REQUIRED INT32 i32; REQUIRED INT64 u64 (INTEGER(64,false)); OPTIONAL INT32 maybe_u8 (INTEGER(8,false)); OPTIONAL INT32 maybe_i16 (INTEGER(16,true)); OPTIONAL INT32 maybe_u32 (INTEGER(32,false)); OPTIONAL INT64 maybe_usize (INTEGER(64,false)); REQUIRED INT64 isize (INTEGER(64,true)); REQUIRED FLOAT float; REQUIRED DOUBLE double; OPTIONAL FLOAT maybe_float; OPTIONAL DOUBLE maybe_double; OPTIONAL BINARY borrowed_maybe_a_string (STRING); OPTIONAL BINARY borrowed_maybe_a_str (STRING); REQUIRED INT64 now (TIMESTAMP_MILLIS); }"; let schema = Arc::new(parse_message_type(schema_str).unwrap()); let a_str = "hello mother".to_owned(); let a_borrowed_string = "cool news".to_owned(); let maybe_a_string = Some("it's true, I'm a string".to_owned()); let maybe_a_str = Some(&a_str[..]); let drs: Vec<ACompleteRecord> = vec![ACompleteRecord { a_bool: true, a_str: &a_str[..], a_string: "hello father".into(), a_borrowed_string: &a_borrowed_string, maybe_a_str: Some(&a_str[..]), maybe_a_string: Some(a_str.clone()), i16: -45, i32: 456, u64: 4563424, maybe_u8: None, maybe_i16: Some(3), maybe_u32: None, maybe_usize: Some(4456), isize: -365, float: 3.5, double: std::f64::NAN, maybe_float: None, maybe_double: Some(std::f64::MAX), borrowed_maybe_a_string: &maybe_a_string, borrowed_maybe_a_str: &maybe_a_str, now: chrono::Utc::now().naive_local(), }]; let generated_schema = drs.as_slice().schema().unwrap(); assert_eq!(&schema, &generated_schema); let props = Arc::new(WriterProperties::builder().build()); let mut writer = SerializedFileWriter::new(file, generated_schema, props).unwrap(); let mut row_group = writer.next_row_group().unwrap(); drs.as_slice().write_to_row_group(&mut row_group).unwrap(); row_group.close().unwrap(); writer.close().unwrap(); }
rust_cleaned_test_functions.jsonl/128373
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1695 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 22654, 23300, 35345, 533, 96724, 368, 341, 286, 1077, 1034, 284, 633, 11771, 2458, 445, 1944, 22654, 23300, 35345, 533, 96724, 497, 609, 1294, 626, 1789, 286, 442, 10802, 32908, 448, 1128, 825, 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_pool_timer_removes_expired() { use std::time::Instant; use tokio_timer::Delay; let mut rt = ::tokio::runtime::current_thread::Runtime::new().unwrap(); let pool = Pool::new( super::Enabled(true), super::IdleTimeout(Some(Duration::from_millis(100))), super::MaxIdlePerHost(::std::usize::MAX), &Exec::Default, ); let key = (Arc::new("foo".to_string()), Ver::Http1); // call those inside a future. rt.block_on(::futures::future::lazy(|| { pool.pooled(c(key.clone()), Uniq(41)); pool.pooled(c(key.clone()), Uniq(5)); pool.pooled(c(key.clone()), Uniq(99)); Ok::<_, ()>(()) })).unwrap(); assert_eq!(pool.inner.connections.lock().unwrap().idle.get(&key).map(|entries| entries.len()), Some(3)); rt .block_on(Delay::new(Instant::now() + Duration::from_millis(200))) .expect("rt block_on 200ms"); assert!(pool.inner.connections.lock().unwrap().idle.get(&key).is_none()); }
rust_cleaned_test_functions.jsonl/35809
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 578 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15709, 16255, 19194, 10088, 80221, 368, 341, 286, 990, 1460, 486, 1678, 486, 30340, 280, 286, 990, 9628, 815, 16255, 486, 20039, 280, 286, 1077, 5206, 16677, 284, 3504, 29594, 815, 486, 22255, 486...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_to_from_ll() { { let e = Event::Quit { timestamp: 0 }; let e2 = Event::from_ll(e.clone().to_ll().unwrap()); assert_eq!(e, e2); } { let e = Event::Display { timestamp: 0, display_index: 1, display_event: DisplayEvent::Orientation(Orientation::LandscapeFlipped), }; let e2 = Event::from_ll(e.clone().to_ll().unwrap()); assert_eq!(e, e2); } { let e = Event::Window { timestamp: 0, window_id: 0, win_event: WindowEvent::Resized(1, 2), }; let e2 = Event::from_ll(e.clone().to_ll().unwrap()); assert_eq!(e, e2); } { let e = Event::KeyDown { timestamp: 0, window_id: 1, keycode: None, scancode: Some(Scancode::Q), keymod: Mod::all(), repeat: false, }; let e2 = Event::from_ll(e.clone().to_ll().unwrap()); assert_eq!(e, e2); } { let e = Event::KeyUp { timestamp: 123, window_id: 0, keycode: Some(Keycode::R), scancode: Some(Scancode::R), keymod: Mod::empty(), repeat: true, }; let e2 = Event::from_ll(e.clone().to_ll().unwrap()); assert_eq!(e, e2); } { let e = Event::MouseMotion { timestamp: 0, window_id: 0, which: 1, mousestate: MouseState::from_sdl_state(1), x: 3, y: 91, xrel: -1, yrel: 43, }; let e2 = Event::from_ll(e.clone().to_ll().unwrap()); assert_eq!(e, e2); } { let e = Event::MouseButtonDown { timestamp: 5634, window_id: 2, which: 0, mouse_btn: MouseButton::Left, clicks: 1, x: 543, y: 345, }; let e2 = Event::from_ll(e.clone().to_ll().unwrap()); assert_eq!(e, e2); } { let e = Event::MouseButtonUp { timestamp: 0, window_id: 2, which: 0, mouse_btn: MouseButton::Left, clicks: 1, x: 543, y: 345, }; let e2 = Event::from_ll(e.clone().to_ll().unwrap()); assert_eq!(e, e2); } { let e = Event::MouseWheel { timestamp: 1, window_id: 0, which: 32, x: 23, y: 91, direction: MouseWheelDirection::Flipped, precise_x: 1.6, precise_y: 2.7, }; let e2 = Event::from_ll(e.clone().to_ll().unwrap()); assert_eq!(e, e2); } { let e = Event::JoyAxisMotion { timestamp: 0, which: 1, axis_idx: 1, value: 12, }; let e2 = Event::from_ll(e.clone().to_ll().unwrap()); assert_eq!(e, e2); } { let e = Event::JoyBallMotion { timestamp: 0, which: 0, ball_idx: 1, xrel: 123, yrel: 321, }; let e2 = Event::from_ll(e.clone().to_ll().unwrap()); assert_eq!(e, e2); } { let e = Event::JoyHatMotion { timestamp: 0, which: 3, hat_idx: 1, state: HatState::Left, }; let e2 = Event::from_ll(e.clone().to_ll().unwrap()); assert_eq!(e, e2); } { let e = Event::JoyButtonDown { timestamp: 0, which: 0, button_idx: 3, }; let e2 = Event::from_ll(e.clone().to_ll().unwrap()); assert_eq!(e, e2); } { let e = Event::JoyButtonUp { timestamp: 9876, which: 1, button_idx: 2, }; let e2 = Event::from_ll(e.clone().to_ll().unwrap()); assert_eq!(e, e2); } { let e = Event::JoyDeviceAdded { timestamp: 0, which: 1, }; let e2 = Event::from_ll(e.clone().to_ll().unwrap()); assert_eq!(e, e2); } { let e = Event::JoyDeviceRemoved { timestamp: 0, which: 2, }; let e2 = Event::from_ll(e.clone().to_ll().unwrap()); assert_eq!(e, e2); } { let e = Event::ControllerAxisMotion { timestamp: 53, which: 0, axis: Axis::LeftX, value: 3, }; let e2 = Event::from_ll(e.clone().to_ll().unwrap()); assert_eq!(e, e2); } { let e = Event::ControllerButtonDown { timestamp: 0, which: 1, button: Button::Guide, }; let e2 = Event::from_ll(e.clone().to_ll().unwrap()); assert_eq!(e, e2); } { let e = Event::ControllerButtonUp { timestamp: 654214, which: 0, button: Button::DPadRight, }; let e2 = Event::from_ll(e.clone().to_ll().unwrap()); assert_eq!(e, e2); } { let e = Event::ControllerDeviceAdded { timestamp: 543, which: 3, }; let e2 = Event::from_ll(e.clone().to_ll().unwrap()); assert_eq!(e, e2); } { let e = Event::ControllerDeviceRemoved { timestamp: 555, which: 3, }; let e2 = Event::from_ll(e.clone().to_ll().unwrap()); assert_eq!(e, e2); } { let e = Event::ControllerDeviceRemapped { timestamp: 654, which: 0, }; let e2 = Event::from_ll(e.clone().to_ll().unwrap()); assert_eq!(e, e2); } }
rust_cleaned_test_functions.jsonl/75289
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 4252 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2346, 5673, 42995, 368, 341, 286, 341, 310, 1077, 384, 284, 3665, 486, 42856, 314, 11441, 25, 220, 15, 2605, 310, 1077, 384, 17, 284, 3665, 486, 1499, 42995, 2026, 15997, 1005, 983, 42995, 1005,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_strtol() { unsafe { let (val, remain) = strtol(b" 12345").ok().unwrap(); assert_eq!(12345i64, val); assert!(remain.is_none()); let (val, remain) = strtol(b"12345").ok().unwrap(); assert_eq!(12345i64, val); assert!(remain.is_none()); let (val, remain) = strtol(b"12345l").ok().unwrap(); assert_eq!(12345i64, val); assert!(remain.is_some()); assert_eq!(b"l", remain.unwrap()); let (val, remain) = strtol(b"12345lll").ok().unwrap(); assert_eq!(12345i64, val); assert!(remain.is_some()); assert_eq!(b"lll", remain.unwrap()); let (val, remain) = strtol(b"1").ok().unwrap(); assert_eq!(1, val); assert!(remain.is_none()); } }
rust_cleaned_test_functions.jsonl/92473
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 380 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2895, 20576, 368, 341, 262, 19860, 341, 414, 1077, 320, 831, 11, 7146, 8, 284, 33624, 1883, 1, 256, 220, 16, 17, 18, 19, 20, 1827, 562, 1005, 15454, 543, 414, 2060, 10714, 10297, 16, 17, 18,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_increment_minor() { let mut feature_release = Version::parse("1.4.6").unwrap(); feature_release.increment_minor(); assert_eq!(feature_release, Version::parse("1.5.0").unwrap()); }
rust_cleaned_test_functions.jsonl/43096
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 101 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 51482, 70861, 368, 341, 286, 1077, 5206, 4565, 24577, 284, 6079, 486, 6400, 445, 16, 13, 19, 13, 21, 1827, 15454, 543, 286, 4565, 24577, 56936, 70861, 543, 286, 2060, 10714, 10297, 12753, 24577, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_center() { let r: Rect<i32> = rect(-2, 5, 4, 10); assert_eq!(r.center(), point2(0, 10)); let r: Rect<f32> = rect(1.0, 2.0, 3.0, 4.0); assert_eq!(r.center(), point2(2.5, 4.0)); }
rust_cleaned_test_functions.jsonl/27468
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 136 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21087, 368, 341, 286, 1077, 435, 25, 11920, 21897, 18, 17, 29, 284, 7608, 4080, 17, 11, 220, 20, 11, 220, 19, 11, 220, 16, 15, 317, 286, 2060, 10714, 10297, 81, 13423, 1507, 1459, 17, 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...
1
#[test] fn test_bpf_loader_write() { let program_id = solana_sdk::pubkey::new_rand(); let program_key = solana_sdk::pubkey::new_rand(); let program_account = Account::new_ref(1, 0, &program_id); let keyed_accounts = vec![KeyedAccount::new(&program_key, false, &program_account)]; let instruction_data = bincode::serialize(&LoaderInstruction::Write { offset: 3, bytes: vec![1, 2, 3], }) .unwrap(); // Case: Empty keyed accounts assert_eq!( Err(InstructionError::NotEnoughAccountKeys), process_instruction( &bpf_loader::id(), &[], &instruction_data, &mut MockInvokeContext::default() ) ); // Case: Not signed assert_eq!( Err(InstructionError::MissingRequiredSignature), process_instruction( &bpf_loader::id(), &keyed_accounts, &instruction_data, &mut MockInvokeContext::default() ) ); // Case: Write bytes to an offset #[allow(unused_mut)] let mut keyed_accounts = vec![KeyedAccount::new(&program_key, true, &program_account)]; keyed_accounts[0].account.borrow_mut().data = vec![0; 6]; assert_eq!( Ok(()), process_instruction( &bpf_loader::id(), &keyed_accounts, &instruction_data, &mut MockInvokeContext::default() ) ); assert_eq!( vec![0, 0, 0, 1, 2, 3], keyed_accounts[0].account.borrow().data ); // Case: Overflow #[allow(unused_mut)] let mut keyed_accounts = vec![KeyedAccount::new(&program_key, true, &program_account)]; keyed_accounts[0].account.borrow_mut().data = vec![0; 5]; assert_eq!( Err(InstructionError::AccountDataTooSmall), process_instruction( &bpf_loader::id(), &keyed_accounts, &instruction_data, &mut MockInvokeContext::default() ) ); }
rust_cleaned_test_functions.jsonl/57222
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1198 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 880, 15897, 22139, 9165, 368, 341, 286, 1077, 2025, 842, 284, 2048, 3362, 61783, 486, 9585, 792, 486, 931, 33864, 543, 286, 1077, 2025, 3097, 284, 2048, 3362, 61783, 486, 9585, 792, 486, 931, 33...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_push_votes_with_tower() { let get_vote_slots = |cluster_info: &ClusterInfo| -> Vec<Slot> { let (labels, _) = cluster_info.get_votes_with_labels(&mut Cursor::default()); let gossip_crds = cluster_info.gossip.crds.read().unwrap(); let mut vote_slots = HashSet::new(); for label in labels { match &gossip_crds.get::<&CrdsData>(&label).unwrap() { CrdsData::Vote(_, vote) => { assert!(vote_slots.insert(vote.slot().unwrap())); } _ => panic!("this should not happen!"), } } vote_slots.into_iter().collect() }; let mut rng = rand::thread_rng(); let keys = Keypair::new(); let contact_info = ContactInfo::new_localhost(&keys.pubkey(), 0); let cluster_info = ClusterInfo::new( contact_info, Arc::new(Keypair::new()), SocketAddrSpace::Unspecified, ); let mut tower = Vec::new(); for k in 0..MAX_LOCKOUT_HISTORY { let slot = k as Slot; tower.push(slot); let vote = new_vote_transaction(&mut rng, vec![slot]); cluster_info.push_vote(&tower, vote); } let vote_slots = get_vote_slots(&cluster_info); assert_eq!(vote_slots.len(), MAX_LOCKOUT_HISTORY); for vote_slot in vote_slots { assert!(vote_slot < MAX_LOCKOUT_HISTORY as u64); } // Push a new vote evicting one. let slot = MAX_LOCKOUT_HISTORY as Slot; tower.push(slot); tower.remove(23); let vote = new_vote_transaction(&mut rng, vec![slot]); cluster_info.push_vote(&tower, vote); let vote_slots = get_vote_slots(&cluster_info); assert_eq!(vote_slots.len(), MAX_LOCKOUT_HISTORY); for vote_slot in vote_slots { assert!(vote_slot <= slot); assert!(vote_slot != 23); } // Push a new vote evicting two. // Older one should be evicted from the crds table. let slot = slot + 1; tower.push(slot); tower.remove(17); tower.remove(5); let vote = new_vote_transaction(&mut rng, vec![slot]); cluster_info.push_vote(&tower, vote); let vote_slots = get_vote_slots(&cluster_info); assert_eq!(vote_slots.len(), MAX_LOCKOUT_HISTORY); for vote_slot in vote_slots { assert!(vote_slot <= slot); assert!(vote_slot != 23); assert!(vote_slot != 5); } }
rust_cleaned_test_functions.jsonl/26028
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1323 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14218, 65116, 6615, 528, 1202, 368, 341, 286, 1077, 633, 54360, 54161, 284, 760, 18855, 3109, 25, 609, 28678, 1731, 91, 1464, 11312, 27, 19877, 29, 341, 310, 1077, 320, 16873, 11, 27439, 284, 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...
7
#[test] fn test_xor() { assert_eq!(1, xor(1,0)); assert_eq!(0, xor(0,0)); assert_eq!(0, xor(1,1)); assert_eq!(1, xor(0,1)); }
rust_cleaned_test_functions.jsonl/112907
{ "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, 76462, 368, 341, 286, 2060, 10714, 10297, 16, 11, 53941, 7, 16, 11, 15, 1106, 286, 2060, 10714, 10297, 15, 11, 53941, 7, 15, 11, 15, 1106, 286, 2060, 10714, 10297, 15, 11, 53941, 7, 16, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_parse_valid_redshift_delete_cluster() { let mock_response = MockResponseReader::read_response( "test_resources/generated/valid", "redshift-delete-cluster.xml", ); let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response); let client = RedshiftClient::new(mock, MockCredentialsProvider, rusoto_region::UsEast1); let request = DeleteClusterMessage::default(); let result = client.delete_cluster(request).sync(); assert!(result.is_ok(), "parse error: {:?}", result); }
rust_cleaned_test_functions.jsonl/12108
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 241 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 8337, 26058, 13418, 11353, 28441, 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, 13418, 40904, 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_fold_object_lit_spread_get_prop() { fold("x = {...{a}}.a", "x = a;"); fold("x = {a, b, ...{c, d, e}}.d", "x = d;"); fold("x = {...{a, b}, c, ...{d, e}}.d", "x = d;"); fold("x = {...{...{a, b}, c, d}, e}.a", "x = a"); fold("x = {...{...{a, b}, c, d}, e}.d", "x = d"); }
rust_cleaned_test_functions.jsonl/122198
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 173 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 61187, 5314, 98399, 10123, 878, 3062, 21663, 368, 341, 262, 11555, 445, 87, 284, 14916, 90, 64, 3417, 13, 64, 497, 330, 87, 284, 264, 34649, 262, 11555, 445, 87, 284, 314, 64, 11, 293, 11, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_instruction_script_match() { use diem_types::account_address::AccountAddress; use ol_types::pay_instruction::InstructionType; if let TransactionPayload::Script(s) = transaction_builder::encode_autopay_create_instruction_script_function( 1, 0, AccountAddress::ZERO, 10, 1000 ) { let instr = PayInstruction { uid: Some(1), type_of: InstructionType::PercentOfBalance, destination: AccountAddress::ZERO, end_epoch: Some(10), duration_epochs: None, note: Some("test".to_owned()), type_move: Some(0), value: 10f64, value_move: Some(1000u64), }; instr.check_instruction_match_tx(s).unwrap(); } }
rust_cleaned_test_functions.jsonl/30104
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 330 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 54923, 14660, 10708, 368, 341, 220, 990, 1853, 336, 9763, 486, 4608, 6744, 486, 7365, 4286, 280, 220, 990, 8328, 9763, 486, 13890, 54923, 486, 16664, 929, 280, 220, 421, 1077, 17869, 29683, 486, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_arena_destructors_fail() { let arena = Arena::new(); // Put some stuff in the arena. for i in 0..10 { // Arena allocate something with drop glue to make sure it // doesn't leak. arena.alloc(|| { Rc::new(i) }); // things interesting. arena.alloc(|| { [0u8, 1u8, 2u8] }); } arena.alloc::<Rc<int>, _>(|| { panic!(); }); }
rust_cleaned_test_functions.jsonl/68021
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 206 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 62, 30527, 2259, 91366, 22121, 368, 341, 262, 1077, 24902, 284, 27047, 486, 931, 543, 262, 442, 10224, 1045, 6259, 304, 279, 24902, 624, 262, 369, 600, 304, 220, 15, 496, 16, 15, 341, 286, 442...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_ascii_emulation() { let m: &'static Mission = &MISSION_ALL_X_USER_DEFINED; let mut ss = ScannerState::new(m); let input = b"abcdefg\x58\x59\x80\x82h\x83ijk\x89\x90"; let fc = FindingCollection::from(&mut ss, Some(0), input, true); assert_eq!(fc.first_byte_position, 10_000); assert_eq!(fc.str_buf_overflow, false); assert_eq!(fc.v.len(), 2); assert_eq!(fc.v[0].position, 10_000); assert_eq!(fc.v[0].position_precision, Precision::Exact); assert_eq!(fc.v[0].s, "abcdefgXY\u{f780}"); // Next output line. assert_eq!(fc.v[1].position, 10_000); assert_eq!(fc.v[1].position_precision, Precision::After); assert_eq!(fc.v[1].s, "\u{f782}h\u{f783}ijk\u{f789}\u{f790}"); assert_eq!( unsafe { str::from_utf8_unchecked(&fc.output_buffer_bytes[..35]) }, "abcdefg\u{58}\u{59}\u{f780}\u{f782}h\u{f783}ijk\u{f789}\u{f790}\ \u{0}\u{0}\u{0}\u{0}\u{0}\u{0}\u{0}" ); assert_eq!(ss.consumed_bytes, 10000 + 18); assert_eq!(ss.last_run_str_was_printed_and_is_maybe_cut_str, false); assert_eq!(ss.last_scan_run_leftover, ""); // Second run. let m: &'static Mission = &MISSION_ASCII; let mut ss = ScannerState::new(m); let input = b"abcdefg\x58\x59\x80\x82h\x83ijk\x89\x90"; let fc = FindingCollection::from(&mut ss, Some(0), input, false); assert_eq!(fc.v.len(), 2); assert_eq!(fc.first_byte_position, 10000); assert_eq!(fc.str_buf_overflow, false); assert_eq!(fc.v[0].position, 10_000); assert_eq!(fc.v[0].position_precision, Precision::Exact); assert_eq!(fc.v[0].s, "abcdefgXY"); // Next output line. assert_eq!(fc.v[1].position, 10_000); assert_eq!(fc.v[1].position_precision, Precision::After); // Note that `h` is gone. assert_eq!(fc.v[1].s, "ijk"); assert_eq!( unsafe { str::from_utf8_unchecked(&fc.output_buffer_bytes[..35]) }, "abcdefg\u{58}\u{59}\u{f780}\u{f782}h\u{f783}ijk\u{f789}\u{f790}\u{0}\u{0}\u{0}\u{0}\u{0}\u{0}\u{0}" ); assert_eq!(ss.consumed_bytes, 10000 + 18); assert_eq!(ss.last_run_str_was_printed_and_is_maybe_cut_str, false); assert_eq!(ss.last_scan_run_leftover, ""); }
rust_cleaned_test_functions.jsonl/40692
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1315 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 50238, 22504, 2914, 368, 341, 286, 1077, 296, 25, 30136, 1978, 23220, 284, 609, 25245, 16269, 6859, 9107, 59122, 401, 286, 1077, 5206, 10870, 284, 17170, 1397, 486, 931, 1255, 626, 286, 1077, 1946...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_peer() { let mut region = metapb::Region::new(); region.set_id(1); region.mut_peers().push(new_peer(1, 1)); region.mut_peers().push(new_learner_peer(2, 2)); assert!(!find_peer(&region, 1).unwrap().get_is_learner()); assert!(find_peer(&region, 2).unwrap().get_is_learner()); assert!(remove_peer(&mut region, 1).is_some()); assert!(remove_peer(&mut region, 1).is_none()); assert!(find_peer(&region, 1).is_none()); }
rust_cleaned_test_functions.jsonl/10721
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 241 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 45159, 368, 341, 286, 1077, 5206, 5537, 284, 2270, 391, 65, 486, 14091, 486, 931, 543, 286, 5537, 980, 842, 7, 16, 317, 286, 5537, 744, 332, 36367, 388, 1005, 9077, 1755, 45159, 7, 16, 11, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_convert_float_to_int() { assert!(convert_float_to_int(f64::MIN, i64::MIN, i64::MAX, FieldTypeTp::Double).is_err()); assert!(convert_float_to_int(f64::MAX, i64::MIN, i64::MAX, FieldTypeTp::Double).is_err()); let v = convert_float_to_int(0.1, i64::MIN, i64::MAX, FieldTypeTp::Double).unwrap(); assert_eq!(v, 0); }
rust_cleaned_test_functions.jsonl/75525
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 190 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 34910, 17586, 2346, 4042, 368, 341, 286, 2060, 10297, 14166, 17586, 2346, 4042, 955, 21, 19, 486, 16413, 11, 600, 21, 19, 486, 16413, 11, 600, 21, 19, 486, 10586, 11, 84614, 62241, 486, 7378, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_mut_in_ref_and_in_fn_parameters_list() { check( r"fn my_fn(&$0) {}", expect![[r#" kw mut "#]], ); check( r"fn my_fn($0) {}", expect![[r#" kw mut "#]], ); check( r"fn my_fn() { let &$0 }", expect![[r#" kw mut "#]], ); }
rust_cleaned_test_functions.jsonl/17386
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 323 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 29523, 1243, 7793, 8378, 1243, 15246, 18263, 2019, 368, 341, 286, 1779, 1006, 310, 435, 1, 8822, 847, 15246, 45023, 15, 8, 4687, 756, 310, 1720, 0, 15505, 81, 2, 698, 394, 29525, 5206, 198, 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_parser_renderer_via_dml() { let dml = datamodel::parse_datamodel(DATAMODEL_STRING).unwrap(); let rendered = datamodel::render_datamodel_to_string(&dml).unwrap(); print!("{}", rendered); assert_eq!(DATAMODEL_STRING, rendered); }
rust_cleaned_test_functions.jsonl/32020
{ "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, 18517, 52345, 80710, 814, 1014, 368, 341, 262, 1077, 294, 1014, 284, 3258, 40259, 486, 6400, 15353, 40259, 5432, 828, 1402, 2880, 43, 12283, 568, 15454, 543, 262, 1077, 22383, 284, 3258, 40259, 48...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_position_long_skip_2() { let v: Vec<u32> = (0..2_000_000).collect(); let (stream, skip) = create_stream_buffer(&v[..]); assert_eq!(skip.len(), 15_749); assert_eq!(stream.len(), 4_987_872); for &offset in &[ 10, 128 * 1024, 128 * 1024 - 1, 128 * 1024 + 7, 128 * 10 * 1024 + 10, ] { let mut position_reader = PositionReader::new(stream.clone(), skip.clone(), offset); let mut buf = [0u32; 1]; position_reader.read(&mut buf); assert_eq!(buf[0], offset as u32); } }
rust_cleaned_test_functions.jsonl/106043
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 349 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9661, 17799, 44830, 62, 17, 368, 341, 286, 1077, 348, 25, 11312, 34837, 18, 17, 29, 284, 320, 15, 496, 17, 62, 15, 15, 15, 62, 15, 15, 15, 568, 17384, 543, 286, 1077, 320, 4027, 11, 10706,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_clone_into_existing() { let temp_dir = TempDir::new("cargo-clone-tests").unwrap(); let output_path = temp_dir.path(); let status = Command::new("target/debug/cargo-clone") .arg("clone") .arg("time") .arg("--") .arg(output_path.to_str().unwrap()) .status() .unwrap(); assert!(status.success()); assert!(output_path.exists()); assert!(output_path.join("Cargo.toml").exists()); }
rust_cleaned_test_functions.jsonl/134188
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 213 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 54742, 45514, 62630, 368, 341, 262, 1077, 2730, 4334, 284, 19944, 6184, 486, 931, 445, 66715, 12, 19982, 81094, 1827, 15454, 543, 262, 1077, 2550, 2638, 284, 2730, 4334, 3875, 1428, 262, 1077, 263...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_owo_not_equal_to_uvu() { assert_ne!( SOURCE.owoify(&OwoifyLevel::Owo), SOURCE.owoify(&OwoifyLevel::Uvu) ); }
rust_cleaned_test_functions.jsonl/60224
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 108 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 62, 57715, 7913, 11478, 2346, 7300, 45690, 368, 341, 286, 2060, 13925, 33673, 310, 53331, 13, 57715, 1437, 2099, 46, 1126, 1437, 4449, 486, 46, 1126, 1326, 310, 53331, 13, 57715, 1437, 2099, 46, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_use_pod_typedef() { let cxx = indoc! {" "}; let hdr = indoc! {" #include <cstdint> struct Bob { uint32_t a; uint32_t b; }; using Horace = Bob; "}; let rs = quote! { let h = Horace { a: 3, b: 4 }; assert_eq!(h.b, 4); }; run_test(cxx, hdr, rs, &[], &["Bob"]); }
rust_cleaned_test_functions.jsonl/9800
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 226 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15951, 85337, 42111, 4219, 368, 341, 262, 1077, 272, 4146, 284, 1257, 509, 0, 314, 698, 262, 330, 2440, 262, 1077, 36615, 284, 1257, 509, 0, 314, 698, 286, 671, 997, 366, 96975, 397, 286, 2036...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_get_dbpath_for_term() { // woefully inadequate test coverage use std::os::{setenv, unsetenv}; fn x(t: &str) -> String { let p = get_dbpath_for_term(t).expect("no terminfo entry found"); p.as_str().unwrap().to_string() }; assert!(x("screen") == "/usr/share/terminfo/s/screen"); assert!(get_dbpath_for_term("") == None); setenv("TERMINFO_DIRS", ":"); assert!(x("screen") == "/usr/share/terminfo/s/screen"); unsetenv("TERMINFO_DIRS"); }
rust_cleaned_test_functions.jsonl/48176
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 235 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 8685, 2343, 5478, 17464, 368, 341, 262, 442, 23738, 72992, 45479, 1273, 10191, 7213, 262, 990, 1460, 486, 436, 22964, 746, 3160, 11, 18000, 3160, 2440, 1066, 262, 5168, 856, 1155, 25, 609, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_eq_opcode() { let mut test_vm = VM::new(); test_vm.registers[0].content = 10; test_vm.registers[1].content = 10; test_vm.registers[3].content = 3; test_vm.registers[4].content = 0; test_vm.registers[5].content = 1; test_vm.program = vec![9, 4, 5, 3]; test_vm.run(); assert_eq!(test_vm.registers[3].content, 1 as i32); test_vm.reset_program(); test_vm.registers[1].content = 25; test_vm.registers[3].content = 3; test_vm.run(); assert_eq!(test_vm.registers[3].content, 0 as i32); }
rust_cleaned_test_functions.jsonl/60347
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 317 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10714, 71319, 368, 341, 286, 1077, 5206, 1273, 39008, 284, 17792, 486, 931, 543, 286, 1273, 39008, 7031, 9303, 58, 15, 936, 1796, 284, 220, 16, 15, 280, 286, 1273, 39008, 7031, 9303, 58, 16, 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_windows_guest() { let mut workload_path = dirs::home_dir().unwrap(); workload_path.push("workloads"); let mut ovmf_path = workload_path.clone(); ovmf_path.push("OVMF.fd"); let mut osdisk_path = workload_path; osdisk_path.push("windows-server-2019.raw"); let mut child = Command::new(clh_command("cloud-hypervisor")) .args(&["--cpus", "boot=2,kvm_hyperv=on,max_phys_bits=39"]) .args(&["--memory", "size=4G"]) .args(&["--kernel", ovmf_path.to_str().unwrap()]) .args(&["--disk", &format!("path={}", osdisk_path.to_str().unwrap())]) .args(&["--serial", "tty"]) .args(&["--console", "off"]) .args(&["--net", "tap="]) .stderr(Stdio::piped()) .stdout(Stdio::piped()) .spawn() .unwrap(); let fd = child.stdout.as_ref().unwrap().as_raw_fd(); let pipesize = unsafe { libc::fcntl(fd, libc::F_SETPIPE_SZ, PIPE_SIZE * 100) }; let fd = child.stderr.as_ref().unwrap().as_raw_fd(); let pipesize1 = unsafe { libc::fcntl(fd, libc::F_SETPIPE_SZ, PIPE_SIZE * 100) }; assert!(pipesize >= PIPE_SIZE * 100 && pipesize1 >= PIPE_SIZE * 100); thread::sleep(std::time::Duration::new(40, 0)); let auth = PasswordAuth { username: String::from("administrator"), password: String::from("Admin123"), }; let r = std::panic::catch_unwind(|| { ssh_command_ip_with_auth( "shutdown /s", &auth, "192.168.249.2", DEFAULT_SSH_RETRIES, DEFAULT_SSH_TIMEOUT, ) .unwrap(); thread::sleep(std::time::Duration::new(40, 0)); }); let _ = child.kill(); let output = child.wait_with_output().unwrap(); handle_child_output(r, &output); }
rust_cleaned_test_functions.jsonl/23994
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1199 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 58220, 62739, 368, 341, 310, 1077, 5206, 53596, 2638, 284, 42248, 486, 5117, 4334, 1005, 15454, 543, 310, 53596, 2638, 2552, 445, 1778, 32685, 3071, 310, 1077, 5206, 297, 7338, 69, 2638, 284, 5359...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_flush() { let dir = Builder::new().prefix("test-flush").tempdir().unwrap(); let engine = crate::util::new_engine(dir.path().to_str().unwrap(), None, ALL_CFS, None).unwrap(); for tp in ENGINE_TICKER_TYPES { flush_engine_ticker_metrics(*tp, 2, "kv"); } for tp in ENGINE_HIST_TYPES { flush_engine_histogram_metrics(*tp, HistogramData::default(), "kv"); } let shared_block_cache = false; flush_engine_properties(engine.as_inner(), "kv", shared_block_cache); let handle = engine.as_inner().cf_handle("default").unwrap(); let info = engine .as_inner() .get_map_property_cf(handle, ROCKSDB_CFSTATS); assert!(info.is_some()); }
rust_cleaned_test_functions.jsonl/36414
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 380 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 39213, 368, 341, 286, 1077, 5419, 284, 20626, 486, 931, 1005, 11849, 445, 1944, 12276, 1116, 1827, 3888, 3741, 1005, 15454, 543, 286, 1077, 4712, 4035, 310, 17717, 486, 1314, 486, 931, 24823, 1416...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_wrapping_append_vec_id() { let db = AccountsDb::new(Vec::new(), &ClusterType::Development); let zero_lamport_account = AccountSharedData::new(0, 0, AccountSharedData::default().owner()); // set 'next' id to the max possible value db.next_id.store(AppendVecId::MAX, Ordering::Release); let slots = 3; let keys = (0..slots).map(|_| Pubkey::new_unique()).collect::<Vec<_>>(); // write unique keys to successive slots keys.iter().enumerate().for_each(|(slot, key)| { let slot = slot as Slot; db.store_uncached(slot, &[(key, &zero_lamport_account)]); db.get_accounts_delta_hash(slot); db.add_root(slot); }); assert_eq!(slots - 1, db.next_id.load(Ordering::Acquire)); let ancestors = Ancestors::default(); keys.iter().for_each(|key| { assert!(db.load_without_fixed_root(&ancestors, key).is_some()); }); }
rust_cleaned_test_functions.jsonl/40241
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 468 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 44074, 3629, 26041, 13251, 842, 368, 341, 286, 1077, 2927, 284, 40655, 7994, 486, 931, 49923, 486, 931, 1507, 609, 28678, 929, 486, 39419, 317, 286, 1077, 7168, 907, 309, 403, 13500, 4035, 310, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_create_cred_def() { init!("true"); let (id, _) = create_cred_def("did", SCHEMAS_JSON, "tag_1", None, Some(false)).unwrap(); assert_eq!(id, CRED_DEF_ID); }
rust_cleaned_test_functions.jsonl/86995
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 106 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8657, 73475, 7844, 368, 341, 286, 2930, 17223, 1866, 797, 286, 1077, 320, 307, 11, 27439, 284, 1855, 73475, 7844, 445, 22920, 497, 7531, 1799, 40092, 25356, 11, 330, 4578, 62, 16, 497, 2240, 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
#[test] fn test_check_for_existing_files() { let dir = std::env::current_dir().unwrap(); let path = format!("{}/test", dir.as_path().to_str().unwrap()); let mut rn_map = BTreeMap::new(); rn_map.insert( ParsedFilename::new("paris (1).jpg".to_owned()).unwrap(), "paris (1).jpg".to_string(), ); rn_map.insert( ParsedFilename::new("paris (1414).jpg".to_owned()).unwrap(), "paris (1414).jpg".to_string(), ); let values_ref = rn_map.values(); println!("values_ref: {:#?}", values_ref); let existing_files = check_for_existing_files(&Path::new(&path), values_ref); assert_eq!(1, existing_files.len()); assert_eq!("paris (1).jpg", existing_files[0]); }
rust_cleaned_test_functions.jsonl/16986
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 389 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 7200, 5478, 62630, 10931, 368, 341, 286, 1077, 5419, 284, 1460, 486, 3160, 486, 3231, 4334, 1005, 15454, 543, 286, 1077, 1815, 284, 3561, 88928, 4472, 1944, 497, 5419, 5357, 2638, 1005, 983, 2895,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_multiple_generate_setter() { check_assist( generate_setter, r#" struct Context<T: Clone> { data: T, cou$0nt: usize, } impl<T: Clone> Context<T> { fn set_data(&mut self, data: T) { self.data = data; } }"#, r#" struct Context<T: Clone> { data: T, count: usize, } impl<T: Clone> Context<T> { fn set_data(&mut self, data: T) { self.data = data; } fn set_count(&mut self, count: usize) { self.count = count; } }"#, ); }
rust_cleaned_test_functions.jsonl/64554
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 299 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 45233, 48851, 2602, 465, 368, 341, 286, 1779, 12083, 380, 1006, 310, 6923, 2602, 465, 345, 310, 435, 2, 698, 1235, 9608, 3125, 25, 27913, 29, 341, 262, 821, 25, 350, 345, 262, 3933, 3, 15, 4...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_dl_settings() { let dl_settings = DLSettings::new(0xcb); assert_eq!(dl_settings.rx1_dr_offset(), 4); assert_eq!(dl_settings.rx2_data_rate(), 11); }
rust_cleaned_test_functions.jsonl/81596
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 85 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 50811, 10853, 368, 341, 262, 1077, 27513, 10853, 284, 32975, 6086, 486, 931, 7, 15, 49391, 317, 262, 2060, 10714, 10297, 8736, 10853, 45348, 16, 26680, 6917, 1507, 220, 19, 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
#[test] fn test_data_read() -> Result<(), Box<dyn Error>> { TestSample { source: StringLiteral("+++>,"), expected_result: Some(BinaryLiteral(&[3, 10][..])), expected_output: None, input_data: Some(BinaryLiteral(&[10][..])), }.run() }
rust_cleaned_test_functions.jsonl/20220
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 133 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1769, 6443, 368, 1464, 5714, 68843, 8261, 92846, 4600, 2452, 341, 262, 3393, 17571, 341, 286, 2530, 25, 923, 17350, 445, 62730, 8066, 4461, 286, 3601, 5287, 25, 4329, 77833, 17350, 2099, 58, 18, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_pv_subclass_ptr_param() { let hdr = indoc! {" #include <cstdint> struct A { uint8_t a; }; class Observer { public: Observer() {} virtual void foo(const A*) const {}; virtual ~Observer() {} }; "}; run_test_ex( "", hdr, quote! { MyObserver::new_rust_owned(MyObserver { a: 3, cpp_peer: Default::default() }); }, quote! { generate!("A") subclass!("Observer",MyObserver) }, None, None, Some(quote! { use autocxx::subclass::CppSubclass; use ffi::Observer_methods; #[autocxx::subclass::subclass] pub struct MyObserver { a: u32 } impl Observer_methods for MyObserver { unsafe fn foo(&self, a: *const ffi::A) { use ffi::Observer_supers; self.foo_super(a) } } }), ); }
rust_cleaned_test_functions.jsonl/9944
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 605 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 91139, 5228, 1040, 4348, 4090, 368, 341, 262, 1077, 36615, 284, 1257, 509, 0, 314, 698, 262, 671, 997, 366, 96975, 397, 262, 2036, 362, 341, 286, 2622, 23, 528, 264, 280, 262, 3634, 262, 536, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_buckets_invalidation() { let table = vec![ (vec![], true, DEFAULT_BUCKETS.len()), (vec![-2.0, -1.0, -0.5, 0.0, 0.5, 1.0, 2.0], true, 7), (vec![-2.0, -1.0, -0.5, 10.0, 0.5, 1.0, 2.0], false, 7), (vec![-2.0, -1.0, -0.5, 0.0, 0.5, 1.0, INFINITY], true, 6), ]; for (buckets, is_ok, length) in table { let got = check_and_adjust_buckets(buckets); assert_eq!(got.is_ok(), is_ok); if is_ok { assert_eq!(got.unwrap().len(), length); } } }
rust_cleaned_test_functions.jsonl/4642
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 377 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 84156, 1243, 12284, 368, 341, 286, 1077, 1965, 284, 7486, 90515, 310, 320, 4083, 0, 12995, 830, 11, 11955, 1668, 27543, 43167, 19406, 14702, 310, 320, 4083, 0, 7609, 17, 13, 15, 11, 481, 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...
3
#[test] fn test_permissions_rw_inside_test_and_js_dir() { const PERMISSION_VARIANTS: [&str; 2] = ["read", "write"]; let test_dir = util::root_path() .join("cli") .join("tests") .into_os_string() .into_string() .unwrap(); let js_dir = util::root_path() .join("js") .into_os_string() .into_string() .unwrap(); for permission in &PERMISSION_VARIANTS { let status = util::deno_cmd() .current_dir(&util::tests_path()) .arg("run") .arg(format!("--allow-{0}={1},{2}", permission, test_dir, js_dir)) .arg("complex_permissions_test.ts") .arg(permission) .arg("complex_permissions_test.ts") .spawn() .unwrap() .wait() .unwrap(); assert!(status.success()); } }
rust_cleaned_test_functions.jsonl/5596
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 358 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 44767, 49566, 72860, 4452, 8378, 26250, 4334, 368, 341, 220, 733, 96540, 2334, 16028, 37125, 25, 34336, 495, 26, 220, 17, 60, 284, 4383, 878, 497, 330, 4934, 6332, 220, 1077, 1273, 4334, 284, 40...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_json2sbp() -> Result<()> { let tranform1 = |reader: &mut dyn Read, writer: &mut Rc<Box<dyn Write>>| -> Result<()> { json2sbp_read_loop(false, reader, writer) }; let tranform2 = |reader: &mut dyn Read, writer: &mut Rc<Box<dyn Write>>| -> Result<()> { sbp2json_read_loop(false, false, false, reader, writer) }; test_round_trip( tranform1, tranform2, "json2sbp", "roundtrip.json", make_none_transform!(), ) }
rust_cleaned_test_functions.jsonl/58777
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 247 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9455, 17, 16892, 79, 368, 1464, 5714, 71698, 341, 262, 1077, 23686, 627, 16, 284, 760, 11149, 25, 609, 6984, 31070, 4457, 11, 6916, 25, 609, 6984, 81463, 79852, 92846, 9645, 2452, 91, 1464, 5714...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_windows_drive() { Playground::setup("cd_test_20", |dirs, sandbox| { sandbox.mkdir("test_folder"); let _actual = nu!( cwd: dirs.test(), r#" subst Z: test_folder Z: echo "some text" | save test_file.txt cd ~ subst Z: /d "# ); assert!(dirs .test() .join("test_folder") .join("test_file.txt") .exists()); }) }
rust_cleaned_test_functions.jsonl/84111
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 330 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15947, 58220, 67151, 368, 341, 262, 88592, 486, 15188, 445, 4385, 4452, 62, 17, 15, 497, 760, 57623, 11, 42754, 91, 341, 286, 42754, 30163, 445, 1944, 15268, 3071, 286, 1077, 716, 11944, 284, 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_replace_add_to_nested_self_nested() { check_assist( replace_qualified_name_with_use, " use std::fmt::{Debug, nested::{Display}}; impl std::fmt::nested<|> for Foo { } ", " use std::fmt::{Debug, nested::{Display, self}}; impl nested<|> for Foo { } ", ); }
rust_cleaned_test_functions.jsonl/19570
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 172 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10633, 2891, 2346, 66279, 25637, 66279, 368, 341, 286, 1779, 12083, 380, 1006, 310, 8290, 62, 36335, 1269, 6615, 15951, 345, 310, 6228, 810, 1460, 486, 12501, 22964, 7939, 11, 24034, 22964, 7020, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_only_option_lease_without_check_quorum() { let l = default_logger(); let mut a = new_test_raft(1, vec![1, 2, 3], 10, 1, new_storage(), &l); let mut b = new_test_raft(2, vec![1, 2, 3], 10, 1, new_storage(), &l); let mut c = new_test_raft(3, vec![1, 2, 3], 10, 1, new_storage(), &l); a.read_only.option = ReadOnlyOption::LeaseBased; b.read_only.option = ReadOnlyOption::LeaseBased; c.read_only.option = ReadOnlyOption::LeaseBased; let mut nt = Network::new(vec![Some(a), Some(b), Some(c)], &l); nt.send(vec![new_message(1, 1, MessageType::MsgHup, 0)]); let ctx = "ctx1"; let entry = new_entry(0, 0, Some(ctx)); nt.send(vec![new_message_with_entries( 2, 2, MessageType::MsgReadIndex, vec![entry], )]); let read_states = &nt.peers[&2].read_states; assert!(!read_states.is_empty()); let rs = &read_states[0]; assert_eq!(rs.index, 1); let vec_ctx = ctx.as_bytes().to_vec(); assert_eq!(rs.request_ctx, vec_ctx); }
rust_cleaned_test_functions.jsonl/19128
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 486 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6443, 18410, 9672, 62, 1623, 39904, 7200, 11280, 33006, 368, 341, 262, 1077, 326, 284, 1638, 27413, 543, 262, 1077, 5206, 264, 284, 501, 4452, 62, 2944, 7, 16, 11, 7486, 20703, 16, 11, 220, 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_hash_random() { let hasher = DirectHasher; let mut rng = XorShiftRng::from_seed([ 0x2d, 0xbe, 0x62, 0x59, 0x8d, 0x31, 0x3d, 0x76, 0x32, 0x37, 0xdb, 0x17, 0xe5, 0xbc, 0x06, 0x54, ]); let mut msg: Vec<u8> = vec![0; 9820 * 4 / 8]; for i in msg.iter_mut() { *i = rng.gen(); } let result = hasher.hash(b"ULforxof", &msg, 96).unwrap(); assert_eq!(hex::encode(result), "8ed2c28681f8be94c08c6ff066bf7ab514e1d68b5b71e0e9097e6e2834f8c3eba7c4a41efc9c34e839a8a2577c08ed2273fc6ec7611b5fa62446e7b6f01827ba7860c49174afdf6d26e5cef44d7f8530ca8ccdd3febe55a1401ac83d63e00eba") }
rust_cleaned_test_functions.jsonl/45252
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 420 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8950, 22644, 368, 341, 286, 1077, 90819, 284, 7139, 6370, 261, 280, 286, 1077, 5206, 28422, 284, 1599, 269, 24841, 49, 968, 486, 1499, 33809, 8956, 310, 220, 15, 87, 17, 67, 11, 220, 15, 42459...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_canonical_request() { let auth = Auth13 { api_version: String::from("1"), body: Some(String::from(BODY)), date: String::from(DT), key: get_key_data(), method: String::from("POST"), path: String::from(PATH), userid: String::from(USER), }; assert_eq!( auth.canonical_request().unwrap(), "Method:POST\nPath:/organizations/clownco\nX-Ops-Content-Hash:\ hDlKNZhIhgso3Fs0S0pZwJ0xyBWtR1RBaeHs1DrzOho=\nX-Ops-Sign:version=1.\ 3\nX-Ops-Timestamp:2009-01-01T12:00:00Z\nX-Ops-UserId:\ spec-user\nX-Ops-Server-API-Version:1" ) }
rust_cleaned_test_functions.jsonl/129442
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 409 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 27421, 22391, 7893, 368, 341, 286, 1077, 4166, 284, 7366, 16, 18, 341, 310, 6330, 9438, 25, 923, 486, 1499, 445, 16, 4461, 310, 2487, 25, 4329, 2242, 486, 1499, 5349, 21050, 6965, 310, 2400, 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_that_python_code_parses_and_passes_pyre_check() { let registry = get_starcoin_registry(); let abis = get_stdlib_script_abis(); let dir = tempdir().unwrap(); let src_dir_path = dir.path().join("src"); let installer = serdegen::python3::Installer::new(src_dir_path.clone(), /* package */ None); let config = serdegen::CodeGeneratorConfig::new("starcoin_types".to_string()) .with_encodings(vec![serdegen::Encoding::Bcs, serdegen::Encoding::Bincode]); installer.install_module(&config, &registry).unwrap(); // installer installer.install_serde_runtime().unwrap(); installer.install_bcs_runtime().unwrap(); let stdlib_dir_path = src_dir_path.join("starcoin_stdlib"); std::fs::create_dir_all(stdlib_dir_path.clone()).unwrap(); let source_path = stdlib_dir_path.join("__init__.py"); let mut source = std::fs::File::create(&source_path).unwrap(); buildgen::python3::output(&mut source, None, None, &abis).unwrap(); std::fs::copy( "examples/python3/stdlib_demo.py", dir.path().join("src/stdlib_demo.py"), ) .unwrap(); let python_path = format!( "{}:{}", std::env::var("PYTHONPATH").unwrap_or_default(), src_dir_path.to_string_lossy(), ); let output = Command::new("python3") .env("PYTHONPATH", python_path) .arg(dir.path().join("src/stdlib_demo.py")) .output() .unwrap(); assert!(output.status.success()); assert_eq!(std::str::from_utf8(&output.stdout).unwrap(), OUTPUT); // writeln!( // r#"{{ // "source_directories": [ // "src" // "search_path": [ // "typeshed" }
rust_cleaned_test_functions.jsonl/73565
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 881 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 70197, 55869, 4136, 77113, 288, 8378, 15464, 288, 40291, 265, 7200, 368, 341, 262, 1077, 19424, 284, 633, 31681, 7160, 50650, 543, 262, 1077, 668, 285, 284, 633, 15656, 2740, 14660, 62, 15367, 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_frobenius() { let mut rng = OsRng; for _ in 0..100 { let a = Fp6::random(&mut rng); assert_eq!(a.frobenius(), a.exp(&[0xffffffff00000001, 0, 0, 0, 0, 0])); assert_eq!(a.frobenius_double(), a.frobenius().frobenius()); assert_eq!(a.frobenius_triple(), a.frobenius_double().frobenius()); } }
rust_cleaned_test_functions.jsonl/132391
{ "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, 761, 299, 7964, 9156, 368, 341, 286, 1077, 5206, 28422, 284, 15433, 49, 968, 401, 286, 369, 716, 304, 220, 15, 496, 16, 15, 15, 341, 310, 1077, 264, 284, 434, 79, 21, 486, 11463, 2099, 6984,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_raw_to_typed() { let raw = RawConfig::default(); assert!(Config::try_from(raw).is_err()); let mut raw = RawConfig::default(); raw.http.ingestion_key = Some("emptyingestionkey".to_string()); assert!(Config::try_from(raw).is_ok()); }
rust_cleaned_test_functions.jsonl/116786
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 136 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 16067, 2346, 528, 32501, 368, 341, 286, 1077, 7112, 284, 23022, 2648, 486, 2258, 543, 286, 2060, 10297, 2648, 486, 1539, 5673, 22460, 568, 285, 9266, 1423, 286, 1077, 5206, 7112, 284, 23022, 2648,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_position() { let parsed: JsonParseResult = "{\n\"foo\":42\n ".parse(); match parsed { Ok(v) => panic!("unexpected success: {:?}", v), Err(e) => { let msg = format!("{}", e); assert!(msg.contains("line:3"), "message is '{}'", msg); assert!(msg.contains("col:1"), "message is '{}'", msg); } } }
rust_cleaned_test_functions.jsonl/88097
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 196 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9661, 368, 341, 262, 1077, 15676, 25, 8308, 14463, 2077, 284, 13868, 59, 77, 2105, 7975, 11693, 19, 17, 1699, 5933, 6400, 543, 262, 2432, 15676, 341, 286, 7622, 3747, 8, 589, 21975, 17223, 53859...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_push_quoted_string() { assert_eq!(push_quoted_string(String::from_str("foo,"), &String::from_str("bar")), String::from_str("foo,\"bar\"")); assert_eq!(push_quoted_string(String::from_str("foo,"), &String::from_str("bar/baz \"yay\\\"")), String::from_str("foo,\"bar/baz \\\"yay\\\\\\\"\"")); }
rust_cleaned_test_functions.jsonl/8814
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 169 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14218, 11280, 9253, 3904, 368, 341, 286, 2060, 10714, 10297, 9077, 11280, 9253, 3904, 2242, 486, 1499, 2895, 445, 7975, 1335, 701, 609, 703, 486, 1499, 2895, 445, 2257, 35674, 923, 486, 1499, 2895...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_FX29() { // 0xFX29 - Set I to the memory address of the sprite data corresponding to the hexadecimal digit stored in register VX let opcode = 0xF029; let mut vm = get_vm(); vm.v[0x0] = 0x10; vm.execute_instruction(decode_opcode(opcode), opcode); assert_eq!(vm.i, 0x50); }
rust_cleaned_test_functions.jsonl/269
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 135 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1400, 55, 17, 24, 368, 341, 262, 442, 220, 15, 9770, 55, 17, 24, 481, 2573, 358, 311, 279, 4938, 2621, 315, 279, 17051, 821, 12159, 311, 279, 69722, 15723, 9768, 304, 4161, 78177, 271, 262, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_append_vec_sanitize_len_and_size_maximum() { const LEN: usize = 0; const SIZE: usize = 16 * 1024 * 1024 * 1024; let result = AppendVec::sanitize_len_and_size(LEN, SIZE); assert_matches!(result, Ok(_)); }
rust_cleaned_test_functions.jsonl/5413
{ "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, 26041, 13251, 643, 58652, 6043, 8378, 2368, 93581, 368, 341, 286, 733, 83099, 25, 22301, 284, 220, 15, 280, 286, 733, 25341, 25, 22301, 284, 220, 16, 21, 353, 220, 16, 15, 17, 19, 353, 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_changeset() { let changeset = one_changeset(); let mut iter = changeset.iter().unwrap(); let item = iter.next().unwrap(); assert!(item.is_some()); let item = item.unwrap(); let op = item.op().unwrap(); assert_eq!("foo", op.table_name()); assert_eq!(1, op.number_of_columns()); assert_eq!(Action::SQLITE_INSERT, op.code()); assert_eq!(false, op.indirect()); let pk = item.pk().unwrap(); assert_eq!(&[1], pk); let new_value = item.new_value(0).unwrap(); assert_eq!(Ok("bar"), new_value.as_str()); }
rust_cleaned_test_functions.jsonl/96250
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 307 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 47526, 295, 368, 341, 286, 1077, 4344, 295, 284, 825, 47526, 295, 543, 286, 1077, 5206, 5367, 284, 4344, 295, 19471, 1005, 15454, 543, 286, 1077, 1509, 284, 5367, 4529, 1005, 15454, 543, 286, 20...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_ed25519() { let rng = botan::RandomNumberGenerator::new_system().unwrap(); let msg = vec![23,42,69,6,66]; let padding = "Pure"; let ed_priv = botan::Privkey::create("Ed25519", "", &rng).unwrap(); let signer = botan::Signer::new(&ed_priv, padding).unwrap(); signer.update(&msg).unwrap(); let signature1 = signer.finish(&rng).unwrap(); let ed_bits = ed_priv.get_ed25519_key().unwrap(); let ed_loaded = botan::Privkey::load_ed25519(&ed_bits.1).unwrap(); let signer = botan::Signer::new(&ed_loaded, padding).unwrap(); signer.update(&msg).unwrap(); let signature2 = signer.finish(&rng).unwrap(); let ed_pub = ed_priv.pubkey().unwrap(); let verifier = botan::Verifier::new(&ed_pub, padding).unwrap(); verifier.update(&msg).unwrap(); assert!(verifier.finish(&signature1).unwrap()); verifier.update(&msg).unwrap(); assert!(verifier.finish(&signature2).unwrap()); let ed_loaded = botan::Pubkey::load_ed25519(&ed_bits.0).unwrap(); let verifier = botan::Verifier::new(&ed_loaded, padding).unwrap(); verifier.update(&msg).unwrap(); assert!(verifier.finish(&signature1).unwrap()); verifier.update(&msg).unwrap(); assert!(verifier.finish(&signature2).unwrap()); assert_eq!(ed_loaded.get_ed25519_key().unwrap(), ed_pub.get_ed25519_key().unwrap()); assert_eq!(signature1, signature2); }
rust_cleaned_test_functions.jsonl/95303
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 567 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 32370, 17, 20, 20, 16, 24, 368, 341, 262, 1077, 28422, 284, 10924, 276, 486, 13999, 2833, 12561, 486, 931, 17687, 1005, 15454, 1428, 262, 1077, 3750, 284, 7486, 20703, 17, 18, 11, 19, 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_should_halt() { let keypair = Keypair::new(); let contact_info = ContactInfo::new_localhost(&keypair.pubkey(), 0); let cluster_info = new_test_cluster_info(contact_info); let cluster_info = Arc::new(cluster_info); let mut known_validators = HashSet::new(); let mut slot_to_hash = HashMap::new(); assert!(!AccountsHashVerifier::should_halt( &cluster_info, Some(&known_validators), &mut slot_to_hash, )); let validator1 = Keypair::new(); let hash1 = hash(&[1]); let hash2 = hash(&[2]); { let message = make_accounts_hashes_message(&validator1, vec![(0, hash1)]).unwrap(); cluster_info.push_message(message); cluster_info.flush_push_queue(); } slot_to_hash.insert(0, hash2); known_validators.insert(validator1.pubkey()); assert!(AccountsHashVerifier::should_halt( &cluster_info, Some(&known_validators), &mut slot_to_hash, )); }
rust_cleaned_test_functions.jsonl/21875
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 535 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 43378, 1523, 3145, 368, 341, 286, 1077, 1376, 12670, 284, 6569, 1082, 1310, 486, 931, 1428, 286, 1077, 3645, 3109, 284, 9180, 1731, 486, 931, 62, 8301, 2099, 792, 12670, 47773, 792, 1507, 220, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_zip() { assert_eq!( Vector3::new(true, false, false), Vector3::new(-2, 1, 0).zip(Vector3::new(-1, -1, -1), |a, b| a < b) ); }
rust_cleaned_test_functions.jsonl/39590
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 134 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 42131, 368, 341, 310, 2060, 10714, 33673, 394, 4196, 18, 486, 931, 3715, 11, 895, 11, 895, 1326, 394, 4196, 18, 486, 931, 4080, 17, 11, 220, 16, 11, 220, 15, 568, 9964, 20258, 18, 486, 931, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_role_get_list() { let mut roles = HashSet::new(); roles.insert(Role::Admin); assert_eq!(Role::get_list("ADMIN"), roles); let mut roles = HashSet::new(); roles.insert(Role::Admin); roles.insert(Role::User); assert_eq!(Role::get_list("ADMIN,USER"), roles); assert_eq!(Role::get_list("USER,ADMIN"), roles); assert_eq!(Role::get_list(" USER , ADMIN"), roles); assert_eq!(Role::get_list(""), HashSet::new()); assert_eq!(Role::get_list(" "), HashSet::new()); }
rust_cleaned_test_functions.jsonl/60987
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 262 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 19792, 3062, 2019, 368, 341, 286, 1077, 5206, 12783, 284, 18931, 486, 931, 543, 286, 12783, 7030, 73443, 486, 7210, 317, 286, 2060, 10714, 10297, 9030, 486, 455, 2019, 445, 34697, 3975, 12783, 626...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_annotation_stripping() { use std::env; verify_stripped_sources("tests/fixtures/*.rb"); verify_stripped_sources("definitions/lib/*.rb"); match env::var("TYPEDRUBY_EXTRA_SOURCES") { Ok(ref path) => verify_stripped_sources(path), Err(..) => {}, }; }
rust_cleaned_test_functions.jsonl/2186
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 172 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 61237, 1261, 461, 10732, 368, 341, 286, 990, 1460, 486, 3160, 401, 286, 10146, 1261, 461, 6924, 52896, 445, 23841, 94275, 23540, 10681, 797, 286, 10146, 1261, 461, 6924, 52896, 445, 48563, 8194, 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_origin_hash() { use std::{ collections::hash_map::DefaultHasher, hash::{Hash, Hasher}, }; fn hash<T: Hash>(value: &T) -> u64 { let mut hasher = DefaultHasher::new(); value.hash(&mut hasher); hasher.finish() } let origin = &Url::parse("http://example.net/").unwrap().origin(); let origins_to_compare = [ Url::parse("http://example.net:80/").unwrap().origin(), Url::parse("http://example.net:81/").unwrap().origin(), Url::parse("http://example.net").unwrap().origin(), Url::parse("http://example.net/hello").unwrap().origin(), Url::parse("https://example.net").unwrap().origin(), Url::parse("ftp://example.net").unwrap().origin(), Url::parse("file://example.net").unwrap().origin(), Url::parse("http://user@example.net/").unwrap().origin(), Url::parse("http://user:pass@example.net/").unwrap().origin(), ]; for origin_to_compare in &origins_to_compare { if origin == origin_to_compare { assert_eq!(hash(origin), hash(origin_to_compare)); } else { assert_ne!(hash(origin), hash(origin_to_compare)); } } let opaque_origin = Url::parse("file://example.net").unwrap().origin(); let same_opaque_origin = Url::parse("file://example.net").unwrap().origin(); let other_opaque_origin = Url::parse("file://other").unwrap().origin(); assert_ne!(hash(&opaque_origin), hash(&same_opaque_origin)); assert_ne!(hash(&opaque_origin), hash(&other_opaque_origin)); }
rust_cleaned_test_functions.jsonl/52246
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 670 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 34043, 8950, 368, 341, 262, 990, 1460, 74843, 286, 15302, 486, 8296, 5376, 486, 3675, 6370, 261, 345, 286, 5175, 22964, 6370, 11, 6531, 261, 1583, 262, 3634, 262, 5168, 5175, 3125, 25, 6531, 223...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_bcrypt() { let pass = "password"; let rng = botan::RandomNumberGenerator::new_system().unwrap(); let bcrypt1 = botan::bcrypt_hash(pass, &rng, 10).unwrap(); assert_eq!(bcrypt1.len(), 60); let bcrypt2 = botan::bcrypt_hash(pass, &rng, 10).unwrap(); assert_eq!(bcrypt2.len(), 60); assert!(bcrypt1 != bcrypt2); assert!(botan::bcrypt_verify(pass, &bcrypt1).unwrap()); assert!(botan::bcrypt_verify(pass, &bcrypt2).unwrap()); assert_eq!(botan::bcrypt_verify("passwurd", &bcrypt2).unwrap(), false); }
rust_cleaned_test_functions.jsonl/95300
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 242 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 880, 48125, 368, 341, 262, 1077, 1494, 284, 330, 3833, 876, 262, 1077, 28422, 284, 10924, 276, 486, 13999, 2833, 12561, 486, 931, 17687, 1005, 15454, 1428, 262, 1077, 33520, 16, 284, 10924, 276, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_csv_with_projection() { let schema = Schema::new(vec![ Field::new("city", DataType::Utf8, false), Field::new("lat", DataType::Float64, false), Field::new("lng", DataType::Float64, false), ]); let file = File::open("test/data/uk_cities.csv").unwrap(); let mut csv = Reader::new( file, Arc::new(schema), false, None, 1024, None, Some(vec![0, 1]), None, ); let projected_schema = Arc::new(Schema::new(vec![ Field::new("city", DataType::Utf8, false), Field::new("lat", DataType::Float64, false), ])); assert_eq!(projected_schema, csv.schema()); let batch = csv.next().unwrap().unwrap(); assert_eq!(projected_schema, batch.schema()); assert_eq!(37, batch.num_rows()); assert_eq!(2, batch.num_columns()); }
rust_cleaned_test_functions.jsonl/16413
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 518 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14020, 6615, 72738, 368, 341, 286, 1077, 10802, 284, 12539, 486, 931, 25592, 90515, 310, 8601, 486, 931, 445, 8926, 497, 33172, 486, 38980, 23, 11, 895, 1326, 310, 8601, 486, 931, 445, 5524, 497...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_get_exec_trace() { use std::io::Write; // Test collecting stack samples across an exec call let mut cmd = std::process::Command::new("ruby") .arg("./ci/ruby-programs/ruby_exec.rb") .arg("ruby") .stdin(std::process::Stdio::piped()) .spawn() .unwrap(); let pid = cmd.id() as Pid; let mut getter = initialize(pid, true, None).expect("initialize"); std::thread::sleep(std::time::Duration::from_millis(50)); let trace1 = getter.get_trace(); assert!( trace1.is_ok(), "initial trace failed: {:?}", trace1.unwrap_err() ); assert_eq!(trace1.unwrap().pid, Some(pid)); // Trigger the exec writeln!(cmd.stdin.as_mut().unwrap()).expect("write to exec"); let allowed_attempts = 20; for _ in 0..allowed_attempts { std::thread::sleep(std::time::Duration::from_millis(50)); let trace2 = getter.get_trace(); if getter.reinit_count == 0 { continue; } assert!( trace2.is_ok(), "post-exec trace failed: {:?}", trace2.unwrap_err() ); } assert_eq!( getter.reinit_count, 1, "Trace getter should have detected one reinit" ); cmd.kill().expect("couldn't clean up test process"); }
rust_cleaned_test_functions.jsonl/90834
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 772 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 18430, 23575, 368, 341, 286, 990, 1460, 486, 815, 486, 7985, 401, 286, 442, 3393, 25895, 5611, 10469, 3941, 458, 3883, 1618, 198, 286, 1077, 5206, 5439, 284, 1460, 486, 4630, 486, 4062, 48...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_init_exit_counter() { use std::os::unix::process::ExitStatusExt; use std::process::ExitStatus; use std::process::Output; use KI; let mut counter = 0; KI.set_mock(Box::new(move |program, args| { counter += 1; match counter { 1 => { assert_eq!(program, "ipset"); assert_eq!( args, vec![ "create", "rita_exit_input", "hash:net", "family", "inet6", "counters", ] ); Ok(Output { stdout: b"".to_vec(), stderr: b"".to_vec(), status: ExitStatus::from_raw(0), }) } 2 => { assert_eq!(program, "ip6tables"); assert_eq!( args, vec![ "-w", "-C", "INPUT", "-m", "set", "!", "--match-set", "rita_exit_input", "src", "-j", "SET", "--add-set", "rita_exit_input", "src", ] ); Ok(Output { stdout: b"".to_vec(), stderr: b"".to_vec(), status: ExitStatus::from_raw(0), }) } _ => panic!("Unexpected call {} {:?} {:?}", counter, program, args), } })); KI.init_exit_counter(&ExitFilterTarget::Input) .expect("Unable to init exit counter"); }
rust_cleaned_test_functions.jsonl/108114
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1358 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6137, 16880, 15730, 368, 341, 262, 990, 1460, 486, 436, 486, 56646, 486, 4630, 486, 15339, 2522, 6756, 280, 262, 990, 1460, 486, 4630, 486, 15339, 2522, 280, 262, 990, 1460, 486, 4630, 486, 5097...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_create_proposal_record_does_not_exist() { let mut transaction_context = MockTransactionContext::default(); let receiving_agent_key = "receiving_agent_key"; transaction_context.add_agent(PUBLIC_KEY); transaction_context.add_agent(receiving_agent_key); let mut state = TrackAndTraceState::new(&mut transaction_context); let transaction_handler = TrackAndTraceTransactionHandler::new(); match transaction_handler._create_proposal( &create_proposal_action(Role::Owner, receiving_agent_key), &mut state, PUBLIC_KEY, TIMESTAMP, ) { Ok(()) => panic!("Record does not exist, InvalidTransaction should be returned"), Err(ApplyError::InvalidTransaction(err)) => { assert!(err.contains(&format!("Record does not exist: {}", RECORD_ID))); } Err(err) => panic!("Should have gotten invalid error but got {}", err), } }
rust_cleaned_test_functions.jsonl/32559
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 422 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8657, 21663, 32556, 14192, 96374, 7913, 35906, 368, 341, 286, 1077, 5206, 7745, 8467, 284, 14563, 8070, 1972, 486, 2258, 543, 286, 1077, 12308, 25730, 3097, 284, 330, 265, 46344, 25730, 3097, 876, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_convert_from_uint() { macro_rules! check { ($ty:ident, $max:expr) => { assert_eq!(BigUint::from($ty::zero()), BigUint::zero()); assert_eq!(BigUint::from($ty::one()), BigUint::one()); assert_eq!(BigUint::from($ty::MAX - $ty::one()), $max - BigUint::one()); assert_eq!(BigUint::from($ty::MAX), $max); } } check!(u8, BigUint::from_slice(&[u8::MAX as BigDigit])); check!(u16, BigUint::from_slice(&[u16::MAX as BigDigit])); check!(u32, BigUint::from_slice(&[u32::MAX])); check!(u64, BigUint::from_slice(&[u32::MAX, u32::MAX])); check!(usize, BigUint::from(usize::MAX as u64)); }
rust_cleaned_test_functions.jsonl/90126
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 400 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 34910, 5673, 15807, 368, 341, 286, 18072, 21407, 0, 1779, 341, 310, 1711, 1881, 25, 1713, 11, 400, 2810, 96011, 8, 589, 341, 394, 2060, 10714, 10297, 15636, 21570, 486, 1499, 699, 1881, 486, 141...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_equality_from_uuid() { for _ in 0..1000 { // start with a uuid::Uuid let u0 = uuid::Uuid::new_v4(); // Convert it into a protobuf Uuid let pu: graplinc_common::Uuid = u0.clone().into(); // Then back to a uuid::Uuid let u1: uuid::Uuid = pu.into(); // Hopefully it hasn't changed assert_eq!(u0, u1); } }
rust_cleaned_test_functions.jsonl/88456
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 241 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2204, 10473, 5673, 25540, 368, 341, 286, 369, 716, 304, 220, 15, 496, 16, 15, 15, 15, 341, 310, 442, 1191, 448, 264, 16040, 486, 38431, 198, 310, 1077, 575, 15, 284, 16040, 486, 38431, 486, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_pending_state() { let exercise = Exercise { name: "pending_exercise".into(), path: PathBuf::from("tests/fixture/state/pending_exercise.rs"), mode: Mode::Compile, hint: String::new(), }; let state = exercise.state(); let expected = vec![ ContextLine { line: "// fake_exercise".to_string(), number: 1, important: false, }, ContextLine { line: "".to_string(), number: 2, important: false, }, ContextLine { line: "// I AM NOT DONE".to_string(), number: 3, important: true, }, ContextLine { line: "".to_string(), number: 4, important: false, }, ContextLine { line: "fn main() {".to_string(), number: 5, important: false, }, ]; assert_eq!(state, State::Pending(expected)); }
rust_cleaned_test_functions.jsonl/75650
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 677 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 37861, 4387, 368, 341, 286, 1077, 10158, 284, 32818, 341, 310, 829, 25, 330, 28210, 2702, 18359, 3263, 18122, 3148, 310, 1815, 25, 7933, 15064, 486, 1499, 445, 23841, 14, 59612, 63796, 4322, 2459,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_claim() { let claim: Claim = "#123 @ 3,2: 5x4".parse().unwrap(); assert_eq!(claim, Claim { id: 123, pos: Pos { x: 3, y: 2 }, size: Size { w: 5, h: 4 } }); assert_eq!(claim.max_x(), 8); assert_eq!(claim.max_y(), 6); }
rust_cleaned_test_functions.jsonl/41490
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 139 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 84969, 368, 341, 286, 1077, 3717, 25, 37502, 284, 5869, 16, 17, 18, 569, 220, 18, 11, 17, 25, 220, 20, 87, 19, 3263, 6400, 1005, 15454, 543, 286, 2060, 10714, 10297, 7859, 11, 37502, 314, 87...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_merge_with_unclean_worktree() -> BitResult<()> { BitRepo::with_minimal_repo(|repo| { let ours = commit! { foo < "default foo contents" }; let theirs = commit! {}; repo.setup_three_way_merge(ours, theirs)?; modify!(repo: "foo" < "modified"); Ok(()) }) }
rust_cleaned_test_functions.jsonl/94159
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 173 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 20888, 6615, 76576, 2675, 11498, 9344, 368, 1464, 6495, 2077, 71698, 341, 262, 6495, 25243, 486, 4197, 7260, 2861, 37784, 22428, 23476, 91, 341, 286, 1077, 11350, 284, 5266, 0, 341, 310, 15229, 36...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_clone_is_reproduce() { numid!(@CloneIsReproduce struct Test); let t = Test::new(); assert_ne!(t, t.clone()); let tt = Test::create_lower(0); assert_eq!(tt, tt.clone()); }
rust_cleaned_test_functions.jsonl/10273
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 124 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 54742, 6892, 1288, 97274, 368, 341, 286, 1629, 307, 0, 5957, 37677, 3872, 693, 97274, 2036, 3393, 317, 286, 1077, 259, 284, 3393, 486, 931, 543, 286, 2060, 13925, 10297, 83, 11, 259, 15997, 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_invalid_group() { new_ucmd!() .arg("__nosuchgroup__") .arg("/") .fails() .stderr_is("chgrp: invalid group: '__nosuchgroup__'"); }
rust_cleaned_test_functions.jsonl/49266
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 104 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 31433, 6288, 368, 341, 262, 501, 68887, 2277, 0, 741, 286, 659, 858, 58406, 36391, 1387, 4074, 563, 1138, 286, 659, 858, 61710, 286, 659, 59631, 741, 286, 659, 36422, 6892, 445, 331, 42854, 25, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_exact_depth() { let te = TestEnv::new(DEFAULT_DIRS, DEFAULT_FILES); te.assert_output( &["--exact-depth", "3"], "one/two/c.foo one/two/C.Foo2 one/two/three", ); }
rust_cleaned_test_functions.jsonl/10876
{ "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, 71084, 19061, 368, 341, 262, 1077, 1013, 284, 3393, 14359, 486, 931, 43175, 90560, 11, 11955, 48010, 626, 262, 1013, 3713, 7645, 1006, 286, 609, 1183, 313, 46385, 30310, 497, 330, 18, 8097, 286, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_scalar_double() { let mut rng = XorShiftRng::from_seed([ 0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06, 0xbc, 0xe5, ]); for _ in 0..1000 { // Ensure doubling a is equivalent to adding a to itself. let a = Scalar::random(&mut rng); let mut b = a; b.add_assign(&a); assert_eq!(a.double(), b); } }
rust_cleaned_test_functions.jsonl/54673
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 284 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 41652, 24598, 368, 341, 286, 1077, 5206, 28422, 284, 1599, 269, 24841, 49, 968, 486, 1499, 33809, 8956, 310, 220, 15, 87, 20, 24, 11, 220, 15, 87, 21, 17, 11, 220, 15, 42459, 11, 220, 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_number_number_comparison() { fold("1 > 1", "false"); fold("2 == 3", "false"); fold("3.6 === 3.6", "true"); fold_same("+x > +y"); fold_same("+x == +y"); fold_same("+x === +y"); fold_same("+x == +x"); fold_same("+x === +x"); fold_same("+x > +x"); // foldable }
rust_cleaned_test_functions.jsonl/122158
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 155 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5500, 5500, 90797, 368, 341, 262, 11555, 445, 16, 861, 220, 16, 497, 330, 3849, 797, 262, 11555, 445, 17, 621, 220, 18, 497, 330, 3849, 797, 262, 11555, 445, 18, 13, 21, 2049, 220, 18, 13, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_query_multiple() { let data_model = test_model(); let mut dispatcher = ControllerDispatcher::new(data_model); let fake = Arc::new(FakeController::new("fake_result")); let fake_two = Arc::new(FakeController::new("fake_result_two")); let namespace = "/foo/bar".to_string(); let namespace_two = "/foo/baz".to_string(); dispatcher.add(Uuid::new_v4(), namespace.clone(), fake).unwrap(); dispatcher.add(Uuid::new_v4(), namespace_two.clone(), fake_two).unwrap(); assert_eq!(dispatcher.query(namespace, json!("")).unwrap(), json!("fake_result")); assert_eq!(dispatcher.query(namespace_two, json!("")).unwrap(), json!("fake_result_two")); }
rust_cleaned_test_functions.jsonl/127127
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 303 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5738, 45233, 368, 341, 286, 1077, 821, 5047, 284, 1273, 5047, 543, 286, 1077, 5206, 38799, 284, 9771, 21839, 486, 931, 2592, 5047, 317, 286, 1077, 12418, 284, 19689, 486, 931, 7832, 726, 2051, 4...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_get_max_streak() { let v = vec![ "2014-11-28T17:00:09+09:00", "2014-11-28T18:00:09+09:00", "2014-11-28T19:00:09+09:00", "2014-11-28T20:00:09+09:00", "2014-11-28T21:00:09+09:00", "2014-11-28T22:00:09+09:00", "2014-11-28T23:00:09+09:00", "2014-11-28T23:59:59+09:00", "2014-12-04T23:59:59+09:00", "2014-12-02T23:59:59+09:00", "2014-12-03T23:59:59+09:00", "2014-12-01T23:59:59+09:00", ] .into_iter() .map(|s| s.parse::<DateTime<Utc>>().unwrap()) .collect::<Vec<_>>(); let streak = get_max_streak(v); assert_eq!(streak, 4); }
rust_cleaned_test_functions.jsonl/11277
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 496 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 6345, 1261, 1108, 368, 341, 286, 1077, 348, 284, 7486, 90515, 310, 330, 17, 15, 16, 19, 12, 16, 16, 12, 17, 23, 51, 16, 22, 25, 15, 15, 25, 15, 24, 10, 15, 24, 25, 15, 15, 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...
1
#[test] fn test_document_chain() { let mut chain: DocumentChain; let mut keys: Vec<KeyPair> = Vec::new(); // Create Initial Document { let keypair: KeyPair = KeyPair::new_ed25519().unwrap(); let mut document: IotaDocument = IotaDocument::new(&keypair).unwrap(); document .sign_self( keypair.private(), document.default_signing_method().unwrap().id().clone(), ) .unwrap(); let mut resolved: ResolvedIotaDocument = ResolvedIotaDocument::from(document); resolved.set_message_id(MessageId::new([1; 32])); chain = DocumentChain::new(IntegrationChain::new(resolved).unwrap()); keys.push(keypair); assert_eq!( chain .current() .document .metadata .proof .as_ref() .unwrap() .verification_method(), format!("#{}", IotaDocument::DEFAULT_METHOD_FRAGMENT) ); assert_eq!(chain.current().diff_message_id, MessageId::null()); assert_eq!(chain.current().integration_message_id, MessageId::from([1; 32])); } // Push Integration Chain Update { let new_integration_message_id = MessageId::new([2; 32]); let mut new: ResolvedIotaDocument = chain.current().clone(); new.integration_message_id = new_integration_message_id; let keypair: KeyPair = KeyPair::new_ed25519().unwrap(); let signing_method: MethodRef<IotaDID> = MethodBuilder::default() .id(chain.id().to_url().join("#key-2").unwrap()) .controller(chain.id().clone()) .key_type(MethodType::Ed25519VerificationKey2018) .key_data(MethodData::new_multibase(keypair.public())) .build() .map(Into::into) .unwrap(); new.document.core_document_mut().capability_invocation_mut().clear(); new .document .core_document_mut() .capability_invocation_mut() .append(signing_method); new.document.metadata.updated = Timestamp::now_utc(); new.document.metadata.previous_message_id = *chain.integration_message_id(); // Sign the update using the old document. assert!(chain .current() .document .sign_data( &mut new.document, keys[0].private(), chain.current().document.default_signing_method().unwrap().id(), SignatureOptions::default(), ) .is_ok()); assert_eq!( chain.current().document.signature().unwrap().verification_method(), format!("#{}", IotaDocument::DEFAULT_METHOD_FRAGMENT) ); keys.push(keypair); assert!(chain.try_push_integration(new).is_ok()); assert_eq!(chain.current().diff_message_id, MessageId::null()); assert_eq!(chain.current().integration_message_id, new_integration_message_id); } // Push Diff Chain Update { let new: ResolvedIotaDocument = { let mut this: ResolvedIotaDocument = chain.current().clone(); this.document.properties_mut().insert("foo".into(), 123.into()); this.document.properties_mut().insert("bar".into(), 456.into()); this.document.metadata.updated = Timestamp::now_utc(); this }; // Sign using the new key added in the previous integration chain update. let message_id: MessageId = *chain.diff_message_id(); let mut diff: DiffMessage = chain .current() .document .diff(&new.document, message_id, keys[1].private(), "#key-2") .unwrap(); let new_diff_message_id: MessageId = MessageId::from([3; 32]); diff.set_message_id(new_diff_message_id); assert!(chain.try_push_diff(diff).is_ok()); // Ensure diff_message_id is updated on ResolvedIotaDocument. assert_eq!(chain.current().diff_message_id, new_diff_message_id); assert_eq!(chain.current().integration_message_id, message_id); } }
rust_cleaned_test_functions.jsonl/91583
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1700 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 26231, 30583, 368, 341, 262, 1077, 5206, 8781, 25, 11789, 18837, 280, 262, 1077, 5206, 6894, 25, 11312, 42003, 12443, 29, 284, 11312, 486, 931, 1428, 1066, 262, 442, 4230, 4127, 11789, 7213, 262, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_js_doc_tag_returns() { assert_eq!( serde_json::to_value(JsDoc::from( "@return {string} maybe doc\n\nnew paragraph".to_string() )) .unwrap(), json!({ "tags": [{ "kind": "return", "type": "string", "doc": "maybe doc\n\nnew paragraph", }] }) ); assert_eq!( serde_json::to_value(JsDoc::from( "@return maybe doc\n\nnew paragraph".to_string() )) .unwrap(), json!({ "tags": [{ "kind": "return", "doc": "maybe doc\n\nnew paragraph", }] }) ); assert_eq!( serde_json::to_value(JsDoc::from( "@returns {string} maybe doc\n\nnew paragraph".to_string() )) .unwrap(), json!({ "tags": [{ "kind": "return", "type": "string", "doc": "maybe doc\n\nnew paragraph", }] }) ); }
rust_cleaned_test_functions.jsonl/119531
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 522 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 26250, 18869, 9372, 58900, 368, 341, 262, 2060, 10714, 33673, 414, 61570, 9455, 486, 983, 3142, 16368, 82, 9550, 486, 1499, 1006, 286, 8428, 689, 314, 917, 92, 7196, 4629, 1699, 1699, 931, 14311, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_heartbeat_challenge() { new_test_ext().execute_with(|| { use phala_types::messaging::{SystemEvent, Topic}; set_block_1(); OnlineMiners::<Test>::put(20); Pallet::<Test>::heartbeat_challenge(); // Extract messages let msgs = take_messages(); let message = match msgs.as_slice() { [m] => m, _ => panic!("Wrong message events"), }; // Check the event target assert_eq!(message.destination, Topic::new("phala/system/event")); // Check the oubound message parameters let target = match message.decode_payload::<SystemEvent>() { Some(SystemEvent::HeartbeatChallenge(r)) => r.online_target, _ => panic!("Wrong outbound message"), }; assert_eq!(target, U256::from_dec_str( "771946525395830978497002573683960742805751636319313395421818009383503547160" ).unwrap()); }); }
rust_cleaned_test_functions.jsonl/86886
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 375 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 62, 72471, 87406, 368, 341, 298, 8638, 4452, 9927, 1005, 10257, 6615, 79453, 341, 571, 41819, 1319, 6053, 9763, 486, 76, 32140, 22964, 2320, 1556, 11, 32911, 2315, 571, 8196, 7113, 62, 16, 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...
4
#[test] fn test_add_to_resource_table_are_contiguous() { let mut table = ResourceTable::default(); let rid1 = table.add("fake1", Box::new(FakeResource::new(1))); let rid2 = table.add("fake2", Box::new(FakeResource::new(2))); assert_eq!(rid1 + 1, rid2); }
rust_cleaned_test_functions.jsonl/133161
{ "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, 2891, 2346, 17962, 5237, 56855, 10260, 27029, 368, 341, 262, 1077, 5206, 1965, 284, 11765, 2556, 486, 2258, 543, 262, 1077, 9279, 16, 284, 1965, 1364, 445, 30570, 16, 497, 8261, 486, 931, 7832, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_dyn_mod() { type Mod = DynMod<u32>; let mut m = Mod::new(998_244_353); assert_eq!(m.get(), 998_244_353); m.set(1_000_000_007); assert_eq!(m.get(), 1_000_000_007); }
rust_cleaned_test_functions.jsonl/38824
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 190 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 69213, 7480, 368, 972, 394, 943, 5650, 284, 43938, 4459, 34837, 18, 17, 29, 1926, 394, 1077, 5206, 296, 284, 5650, 486, 931, 7, 24, 24, 23, 62, 17, 19, 19, 62, 18, 20, 18, 736, 394, 2060, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_extract_byte_string() { assert_eq!( extract_byte_string(cbor_int!(123)), Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE) ); assert_eq!( extract_byte_string(cbor_bool!(true)), Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE) ); assert_eq!( extract_byte_string(cbor_text!("foo")), Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE) ); assert_eq!(extract_byte_string(cbor_bytes_lit!(b"")), Ok(Vec::new())); assert_eq!( extract_byte_string(cbor_bytes_lit!(b"bar")), Ok(b"bar".to_vec()) ); assert_eq!( extract_byte_string(cbor_array![]), Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE) ); assert_eq!( extract_byte_string(cbor_map! {}), Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE) ); }
rust_cleaned_test_functions.jsonl/48994
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 536 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 39123, 19737, 3904, 368, 341, 286, 2060, 10714, 33673, 310, 8649, 19737, 3904, 1337, 9368, 4042, 10297, 16, 17, 18, 6965, 310, 15495, 7, 1162, 2537, 17, 9875, 48933, 868, 6735, 80002, 4189, 340, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_initialize_encode_session() { let instance = create_vea_instance(); let config = create_config(); let _session = instance .open_session(config) .expect("failed to open a session"); // advance. }
rust_cleaned_test_functions.jsonl/29968
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 104 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 40889, 11224, 12316, 368, 341, 262, 1077, 2867, 284, 1855, 73285, 64, 11904, 543, 262, 1077, 2193, 284, 1855, 5332, 1428, 262, 1077, 716, 5920, 284, 2867, 198, 286, 659, 2508, 12316, 8754, 340, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_abs_real() { let test_cases: Vec<(Real, Option<Real>)> = vec![ (Real::new(3.5).unwrap(), Real::new(3.5).ok()), (Real::new(-3.5).unwrap(), Real::new(3.5).ok()), ]; for (arg, expect_output) in test_cases { let output = RpnFnScalarEvaluator::new() .push_param(arg) .evaluate(ScalarFuncSig::AbsReal) .unwrap(); assert_eq!(output, expect_output, "{:?}", arg); } }
rust_cleaned_test_functions.jsonl/9473
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 292 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 31170, 15266, 368, 341, 286, 1077, 1273, 41427, 25, 11312, 28706, 12768, 11, 6959, 64829, 9231, 29, 284, 7486, 90515, 310, 320, 12768, 486, 931, 7, 18, 13, 20, 568, 15454, 1507, 8800, 486, 931, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_date() { let mut rt = System::new("test"); let _ = rt.block_on(future::lazy(|| { let settings = ServiceConfig::new(KeepAlive::Os, 0, 0); let mut buf1 = BytesMut::with_capacity(DATE_VALUE_LENGTH + 10); settings.set_date(&mut buf1); let mut buf2 = BytesMut::with_capacity(DATE_VALUE_LENGTH + 10); settings.set_date(&mut buf2); assert_eq!(buf1, buf2); future::ok::<_, ()>(()) })); }
rust_cleaned_test_functions.jsonl/5112
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 265 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4164, 368, 341, 286, 1077, 5206, 16677, 284, 739, 486, 931, 445, 1944, 3071, 286, 1077, 716, 284, 16677, 15697, 4470, 955, 2976, 486, 49013, 79453, 341, 310, 1077, 5003, 284, 5362, 2648, 486, 93...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_process_entries_2_entries_tick() { let GenesisConfigInfo { genesis_config, mint_keypair, .. } = create_genesis_config(1000); let bank = Arc::new(Bank::new_for_tests(&genesis_config)); let keypair1 = Keypair::new(); let keypair2 = Keypair::new(); let keypair3 = Keypair::new(); let keypair4 = Keypair::new(); //load accounts let tx = system_transaction::transfer( &mint_keypair, &keypair1.pubkey(), 1, bank.last_blockhash(), ); assert_eq!(bank.process_transaction(&tx), Ok(())); let tx = system_transaction::transfer( &mint_keypair, &keypair2.pubkey(), 1, bank.last_blockhash(), ); assert_eq!(bank.process_transaction(&tx), Ok(())); let blockhash = bank.last_blockhash(); while blockhash == bank.last_blockhash() { bank.register_tick(&Hash::default()); } // ensure bank can process 2 entries that do not have a common account and tick is registered let tx = system_transaction::transfer(&keypair2, &keypair3.pubkey(), 1, blockhash); let entry_1 = next_entry(&blockhash, 1, vec![tx]); let tick = next_entry(&entry_1.hash, 1, vec![]); let tx = system_transaction::transfer(&keypair1, &keypair4.pubkey(), 1, bank.last_blockhash()); let entry_2 = next_entry(&tick.hash, 1, vec![tx]); assert_eq!( process_entries_for_tests( &bank, vec![entry_1, tick, entry_2.clone()], true, None, None ), Ok(()) ); assert_eq!(bank.get_balance(&keypair3.pubkey()), 1); assert_eq!(bank.get_balance(&keypair4.pubkey()), 1); let tx = system_transaction::transfer(&keypair2, &keypair3.pubkey(), 1, bank.last_blockhash()); let entry_3 = next_entry(&entry_2.hash, 1, vec![tx]); assert_eq!( process_entries_for_tests(&bank, vec![entry_3], true, None, None), Err(TransactionError::AccountNotFound) ); }
rust_cleaned_test_functions.jsonl/46815
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1135 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11305, 26092, 62, 17, 26092, 43612, 368, 341, 286, 1077, 40788, 2648, 1731, 341, 310, 59366, 5332, 345, 310, 28337, 3097, 12670, 345, 310, 54538, 286, 335, 284, 1855, 16322, 13774, 5332, 7, 16, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_uncleaned_roots_with_account() { solana_logger::setup(); let accounts = AccountsDb::new(Vec::new(), &ClusterType::Development); let pubkey = solana_sdk::pubkey::new_rand(); let account = AccountSharedData::new(1, 0, AccountSharedData::default().owner()); //store an account accounts.store_uncached(0, &[(&pubkey, &account)]); assert_eq!(accounts.accounts_index.uncleaned_roots_len(), 0); // simulate slots are rooted after while accounts.add_root(0); assert_eq!(accounts.accounts_index.uncleaned_roots_len(), 1); //now uncleaned roots are cleaned up accounts.clean_accounts(None, false, None); assert_eq!(accounts.accounts_index.uncleaned_roots_len(), 0); }
rust_cleaned_test_functions.jsonl/6970
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 326 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 76576, 2675, 291, 26608, 2412, 6615, 13500, 368, 341, 286, 2048, 3362, 27413, 486, 15188, 1428, 286, 1077, 9618, 284, 40655, 7994, 486, 931, 49923, 486, 931, 1507, 609, 28678, 929, 486, 39419, 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_primitive_slice() { let cases = vec![ ( vec![Some(1), Some(2), Some(3)], (0, 1), vec![Some(1), Some(2), Some(3)], (0, 1), true, ), ( vec![Some(1), Some(2), Some(3)], (1, 1), vec![Some(1), Some(2), Some(3)], (2, 1), false, ), ( vec![Some(1), Some(2), None], (1, 1), vec![Some(1), None, Some(2)], (2, 1), true, ), ]; for (lhs, slice_lhs, rhs, slice_rhs, expected) in cases { let lhs = Int32Array::from(lhs).data(); let lhs = lhs.slice(slice_lhs.0, slice_lhs.1); let rhs = Int32Array::from(rhs).data(); let rhs = rhs.slice(slice_rhs.0, slice_rhs.1); test_equal(&lhs, &rhs, expected); } }
rust_cleaned_test_functions.jsonl/46942
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 682 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 84087, 26488, 368, 341, 286, 1077, 5048, 284, 7486, 90515, 310, 2399, 394, 7486, 20703, 8373, 7, 16, 701, 4329, 7, 17, 701, 4329, 7, 18, 30749, 394, 320, 15, 11, 220, 16, 1326, 394, 7486, 20...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_escape_raw_insert() { let left = escape_raw_insert( r#" # LSP integration. # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ eval %sh{kak-lsp --kakoune -s "${kak_session}"} def lsp-restart %{ lsp-stop; lsp-start } # set-option global lsp_completion<gt_trigger<gt "execute-keys ''h<lt>a-h><lt><gta-k>\S[^\s,=;*(){}\[\]]\z<lt>ret>''" set global lsp_diagnostic_line_error_sign ''▓'' set global lsp_diagnostic_line_warning_sign ''▒'' # hook global WinSetOption filetype=(rust|python|dart|sh|typescript|javascript|html|css|json|go|c|cpp) %{ hook global WinSetOption filetype=(rust|typescript|javascript|python|sh|dart|json|css) %{ map buffer us<gter ''l'' '': enter-user-mode lsp<lt>ret>'' -docstring ''LSP mode'' map buffer<gt lsp ''R'' '': lsp-rename-prompt<lt>ret>'' -docstring ''rename symbol under cursor'' lsp-enable-window hook -always global KakEnd .* lsp-exit # set window lsp_hover_anchor true face buffer DiagnosticError "default+u" face buffer DiagnosticWarning "default+u" face buffer LineFlagErrors "%opt{gruvbox_c9_red}" } "#.trim()); let right = r#" # LSP integration. # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ eval %sh{kak-lsp --kakoune -s "${kak_session}"} def lsp-restart %{ lsp-stop; lsp-start } # set-option global lsp_completion<lt>gt_trigger<lt>gt "execute-keys ''h<lt>lt<gt>a-h<gt><lt>lt<gt><lt>gta-k<gt>\S[^\s,=;*(){}\[\]]\z<lt>lt<gt>ret<gt>''" set global lsp_diagnostic_line_error_sign ''▓'' set global lsp_diagnostic_line_warning_sign ''▒'' # hook global WinSetOption filetype=(rust|python|dart|sh|typescript|javascript|html|css|json|go|c|cpp) %{ hook global WinSetOption filetype=(rust|typescript|javascript|python|sh|dart|json|css) %{ map buffer us<lt>gter ''l'' '': enter-user-mode lsp<lt>lt<gt>ret<gt>'' -docstring ''LSP mode'' map buffer<lt>gt lsp ''R'' '': lsp-rename-prompt<lt>lt<gt>ret<gt>'' -docstring ''rename symbol under cursor'' lsp-enable-window hook -always global KakEnd .* lsp-exit # set window lsp_hover_anchor true face buffer DiagnosticError "default+u" face buffer DiagnosticWarning "default+u" face buffer LineFlagErrors "%opt{gruvbox_c9_red}" } "#.trim(); assert_eq!(left, right); }
rust_cleaned_test_functions.jsonl/64441
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 974 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21832, 16067, 17678, 368, 341, 262, 1077, 2115, 284, 12449, 16067, 17678, 1006, 286, 435, 2, 698, 2, 444, 4592, 17590, 624, 2, 636, 122, 146418, 146418, 146418, 146418, 146418, 146418, 146418, 14641...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_grounding_not_5_rewrite() -> TestResult { let p = Polar::new(); p.load_str( r#" f(x, y) if x > 0 and not (x >= 1 and x = 1 and y > x and g(x, y)); g(x, _) if x >= 3; g(1, y) if y >= 3 and y > 5; "#, )?; let p_rewrite = Polar::new(); p_rewrite.load_str( r#" # f(x, y) if x > 0 and (x < 1 or x != 1 or y <= x or not g(x, y)); f(x, y) if x > 0 and (x < 1 or x != 1 or y <= x or (g_1_not(x, y) and g_2_not(x, y))); g_1_not(x, _) if x < 3; g_2_not(1, y) if y < 3 or y <= 5; "#, )?; let xs = (-10..10).collect::<Vec<_>>(); let ys = (-10..10).collect::<Vec<_>>(); for x in xs.iter() { for y in ys.iter() { let mut p_query = p.new_query_from_term(term!(call!("f", [*x, *y])), false); let mut p_rewrite_query = p_rewrite.new_query_from_term(term!(call!("f", [*x, *y])), false); let p_has_next = matches!(p_query.next_event()?, QueryEvent::Result { .. }); let p_rewrite_has_next = matches!(p_rewrite_query.next_event()?, QueryEvent::Result { .. }); assert_eq!(p_has_next, p_rewrite_has_next) } } Ok(()) }
rust_cleaned_test_functions.jsonl/63055
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 816 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 72492, 287, 7913, 62, 20, 74052, 368, 1464, 3393, 2077, 341, 286, 1077, 281, 284, 55896, 486, 931, 543, 286, 281, 5104, 2895, 1006, 310, 435, 2, 698, 310, 282, 2075, 11, 379, 8, 421, 856, 86...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
#[test] fn test_const_mod_old() { type Mod = Mod1_000_000_007; assert_eq!(Mod::get(), 1_000_000_007); }
rust_cleaned_test_functions.jsonl/38822
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 98 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13610, 7480, 21108, 368, 972, 394, 943, 5650, 284, 5650, 16, 62, 15, 15, 15, 62, 15, 15, 15, 62, 15, 15, 22, 463, 394, 2060, 10714, 10297, 4459, 486, 455, 1507, 220, 16, 62, 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
#[test] fn test_stop() { run_test(async { let (sender, receiver) = channel(); let mut sender = Some(sender); let repos = setup_fake_repos(move |req| match req { RepositoryRegistryRequest::ServerStop { responder } => { sender.take().unwrap().send(()).unwrap(); responder.send(&mut Ok(())).unwrap() } other => panic!("Unexpected request: {:?}", other), }); stop(StopCommand {}, repos).await.unwrap(); assert!(receiver.await.is_ok()); }) }
rust_cleaned_test_functions.jsonl/101407
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 329 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 19039, 368, 341, 286, 1598, 4452, 18285, 341, 310, 1077, 320, 11644, 11, 13964, 8, 284, 5496, 543, 310, 1077, 5206, 4646, 284, 4329, 19377, 317, 310, 1077, 45774, 284, 6505, 56881, 1288, 966, 34...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_cmsg_nxthdr() { use std::ptr; let mut buffer = [0u8; 256]; let mut mhdr: msghdr = unsafe { mem::zeroed() }; let pmhdr = &mhdr as *const msghdr; for start_ofs in 0..64 { let pcmsghdr = &mut buffer[start_ofs] as *mut u8 as *mut cmsghdr; mhdr.msg_control = pcmsghdr as *mut c_void; mhdr.msg_controllen = (160 - start_ofs) as _; for cmsg_len in 0..64 { for next_cmsg_len in 0..32 { for i in buffer[start_ofs..].iter_mut() { *i = 0; } unsafe { (*pcmsghdr).cmsg_len = cmsg_len; let libc_next = libc::CMSG_NXTHDR(pmhdr, pcmsghdr); let next = cmsg_nxthdr(pmhdr, pcmsghdr); assert_eq!(libc_next, next); if libc_next != ptr::null_mut() { (*libc_next).cmsg_len = next_cmsg_len; let libc_next = libc::CMSG_NXTHDR(pmhdr, pcmsghdr); let next = cmsg_nxthdr(pmhdr, pcmsghdr); assert_eq!(libc_next, next); } } } } } }
rust_cleaned_test_functions.jsonl/91466
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 872 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 666, 3236, 1089, 87, 339, 3612, 368, 341, 286, 990, 1460, 486, 3505, 401, 286, 1077, 5206, 4147, 284, 508, 15, 84, 23, 26, 220, 17, 20, 21, 935, 286, 1077, 5206, 296, 28785, 25, 9829, 866, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
#[test] fn test_new_package() { let uri = PkgUri::new_package( "fuchsia.com".to_string(), "/fonts/stable".to_string(), Some("80e8721f4eba5437c8b6e1604f6ee384f42aed2b6dfbfd0b616a864839cd7b4a".to_string()), ) .unwrap(); assert_eq!("fuchsia.com", uri.host()); assert_eq!("/fonts/stable", uri.path()); assert_eq!(Some("fonts"), uri.name()); assert_eq!(Some("stable"), uri.variant()); assert_eq!( Some("80e8721f4eba5437c8b6e1604f6ee384f42aed2b6dfbfd0b616a864839cd7b4a"), uri.package_hash() ); assert_eq!(None, uri.resource()); assert_eq!(uri, uri.root_uri()); assert_eq!( PkgUri::new_package("".to_string(), "/fonts".to_string(), None), Err(ParseError::InvalidHost) ); assert_eq!( PkgUri::new_package("fuchsia.com".to_string(), "fonts".to_string(), None), Err(ParseError::InvalidPath) ); assert_eq!( PkgUri::new_package("fuchsia.com".to_string(), "/".to_string(), None), Err(ParseError::InvalidName) ); assert_eq!( PkgUri::new_package("fuchsia.com".to_string(), "/fonts/$".to_string(), None), Err(ParseError::InvalidVariant) ); assert_eq!( PkgUri::new_package( "fuchsia.com".to_string(), "/fonts".to_string(), Some( "80e8721f4eba5437c8b6e1604f6ee384f42aed2b6dfbfd0b616a864839cd7b4a".to_string() ) ), Err(ParseError::InvalidVariant) ); assert_eq!( PkgUri::new_package( "fuchsia.com".to_string(), "/fonts/stable".to_string(), Some("$".to_string()) ), Err(ParseError::InvalidHash) ); }
rust_cleaned_test_functions.jsonl/122321
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1124 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5921, 26328, 368, 341, 286, 1077, 13071, 284, 393, 7351, 13899, 486, 931, 26328, 1006, 310, 330, 69, 73391, 905, 3263, 983, 3904, 3148, 310, 3521, 20203, 14272, 480, 3263, 983, 3904, 3148, 310, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_ecdsa_duplicate_dealing() { ic_test_utilities::artifact_pool_config::with_test_pool_config(|pool_config| { with_test_replica_logger(|logger| { let (mut ecdsa_pool, pre_signer) = create_pre_signer_dependencies(pool_config, logger); let time_source = FastForwardTimeSource::new(); let id_2 = create_transcript_id(2); // Set up the ECDSA pool let dealing = create_dealing(id_2, NODE_2); let change_set = vec![EcdsaChangeAction::AddToValidated( EcdsaMessage::EcdsaSignedDealing(dealing), )]; ecdsa_pool.apply_changes(change_set); let mut dealing = create_dealing(id_2, NODE_2); dealing.content.requested_height = Height::from(100); let msg_id_2 = dealing.message_hash(); ecdsa_pool.insert(UnvalidatedArtifact { message: EcdsaMessage::EcdsaSignedDealing(dealing), peer_id: NODE_2, timestamp: time_source.get_relative_time(), }); let t2 = create_transcript_param(id_2, &[NODE_2], &[NODE_1]); let block_reader = TestEcdsaBlockReader::for_pre_signer_test(Height::from(100), vec![t2]); let change_set = pre_signer.validate_dealings(&ecdsa_pool, &block_reader); assert_eq!(change_set.len(), 1); assert!(is_handle_invalid(&change_set, &msg_id_2)); }) }) }
rust_cleaned_test_functions.jsonl/86714
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 914 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 36844, 96780, 70434, 2259, 6132, 368, 341, 286, 17902, 4452, 94044, 486, 63722, 15709, 5332, 486, 4197, 4452, 15709, 5332, 22428, 10285, 5332, 91, 341, 310, 448, 4452, 25533, 15317, 27413, 22428, 97...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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() { let dict = sample_dict("abcd"); let string = NSString::from_str("abcd"); assert!(dict.get(&string).is_some()); let string = NSString::from_str("abcde"); assert!(dict.get(&string).is_none()); }
rust_cleaned_test_functions.jsonl/108467
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 124 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 368, 341, 286, 1077, 6451, 284, 6077, 5243, 445, 68644, 3071, 286, 1077, 914, 284, 9335, 486, 1499, 2895, 445, 68644, 797, 286, 2060, 10297, 8477, 670, 2099, 917, 568, 285, 61855, 5231, 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_slice_string() { assert::all_true( r#" "abc"[1:] == "bc" # Remove the first element "abc"[:-1] == "ab" # Remove the last element "abc"[1:-1] == "b" # Remove the first and the last element "banana"[1::2] == "aaa" # Select one element out of 2, skipping the first "banana"[4::-2] == "nnb" # Select one element out of 2 in reverse order, starting at index 4 "#, ); }
rust_cleaned_test_functions.jsonl/29290
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 171 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 26488, 3904, 368, 341, 286, 2060, 486, 541, 16082, 1006, 310, 435, 2, 698, 1, 13683, 36864, 16, 28283, 621, 330, 8904, 1, 671, 10783, 279, 1156, 2392, 198, 1, 13683, 1, 26049, 16, 60, 621, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_consensus_network_events() { let (mut consensus_tx, consensus_rx) = channel::new_test(8); let mut stream = ConsensusNetworkEvents::new(consensus_rx); let peer_id = PeerId::random(); let consensus_msg = new_test_vote(); let network_msg = Message { protocol: ProtocolId::from_static(CONSENSUS_DIRECT_SEND_PROTOCOL), mdata: consensus_msg.clone().to_bytes().unwrap(), }; // Network sends inbound message to consensus block_on(consensus_tx.send(NetworkNotification::RecvMessage(peer_id, network_msg))) .unwrap(); // Consensus should receive deserialized message event let event = block_on(stream.next()).unwrap().unwrap(); assert_eq!(event, Event::Message((peer_id, consensus_msg))); // Network notifies consensus about new peer block_on(consensus_tx.send(NetworkNotification::NewPeer(peer_id))).unwrap(); // Consensus should receive notification let event = block_on(stream.next()).unwrap().unwrap(); assert_eq!(event, Event::NewPeer(peer_id)); }
rust_cleaned_test_functions.jsonl/41808
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 460 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 31971, 13626, 20966, 19691, 368, 341, 286, 1077, 320, 6984, 23869, 17805, 11, 23869, 24330, 8, 284, 5496, 486, 931, 4452, 7, 23, 317, 286, 1077, 5206, 4269, 284, 7292, 13626, 12320, 7900, 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_return() { assert_eq!( runner().ok("@function a() {@return 1 2/3 4}\n\ \nb {c: a()}\n"), "b {\ \n c: 1 2/3 4;\ \n}\n" ); }
rust_cleaned_test_functions.jsonl/103356
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 148 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 12511, 368, 341, 286, 2060, 10714, 33673, 310, 22259, 1005, 562, 10662, 1688, 264, 368, 6418, 689, 220, 16, 220, 17, 14, 18, 220, 19, 11035, 77, 5661, 1797, 1124, 18080, 314, 66, 25, 264, 368,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_fib() { // The following code was used to demonstrate that asymptotically // leads to larger numbers earlier in the sequence. It also // if we can only run a few iterations. let mut prev = 1; for x in slow_fib(25).take(200) { let rat = x as f64 / prev as f64; println!("ratio: {}/{} = {}", prev, x, rat); prev = x; } let five: Vec<_> = slow_fib(25).take(5).collect(); assert_eq!(&five, &[1, 1, 2, 3, 4]); let more: Vec<_> = slow_fib(25).take(32).collect(); assert_eq!( &more, &[ 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 28, 31, 35, 40, 46, ] ); let previous_sequence: Vec<_> = (0..32).map(|n| (1.1f64).powi(n).round() as usize).collect(); assert_eq!( &previous_sequence, &[ 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, ] ); let previous_sequence: Vec<_> = (20..40) .map(|n| (1.1f64).powi(n).round() as usize) .collect(); assert_eq!( &previous_sequence, &[7, 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, 21, 23, 26, 28, 31, 34, 37, 41,] ); }
rust_cleaned_test_functions.jsonl/26052
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 706 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 761, 579, 368, 341, 262, 442, 576, 2701, 2038, 572, 1483, 311, 19869, 429, 96254, 354, 2673, 63477, 262, 442, 11508, 311, 8131, 5109, 6788, 304, 279, 8500, 13, 220, 1084, 1083, 63477, 262, 442, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_all() { test_curve::<RegularDynamicCurve<f32, f32>, f32, f32>(true , 0.000001); test_curve::<RegularDynamicCurve< i8, f32>, i8, f32>(false, 0.000001); test_curve::<RegularDynamicCurve<f32, U1F7>, f32, U1F7>(true , 0.05); test_curve::<RegularDynamicCurve<f32, U1F15>, f32, U1F15>(true , 0.0005); }
rust_cleaned_test_functions.jsonl/64667
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 201 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5705, 368, 341, 286, 1273, 43407, 27638, 30404, 21752, 31325, 63895, 18, 17, 11, 256, 282, 18, 17, 8066, 282, 18, 17, 11, 256, 282, 18, 17, 2235, 1866, 1154, 220, 15, 13, 15, 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...
1
#[test] fn test_merge_incorrect_authorized_staker() { let stake_address = solana_sdk::pubkey::new_rand(); let merge_from_address = solana_sdk::pubkey::new_rand(); let authorized_address = solana_sdk::pubkey::new_rand(); let wrong_authorized_address = solana_sdk::pubkey::new_rand(); let stake_lamports = 42; let mut instruction_accounts = vec![ AccountMeta { pubkey: stake_address, is_signer: false, is_writable: false, }, AccountMeta { pubkey: merge_from_address, is_signer: false, is_writable: false, }, AccountMeta { pubkey: sysvar::clock::id(), is_signer: false, is_writable: false, }, AccountMeta { pubkey: sysvar::stake_history::id(), is_signer: false, is_writable: false, }, AccountMeta { pubkey: authorized_address, is_signer: true, is_writable: false, }, ]; for state in &[ StakeState::Initialized(Meta::auto(&authorized_address)), just_stake(Meta::auto(&authorized_address), stake_lamports), ] { let stake_account = AccountSharedData::new_data_with_space( stake_lamports, state, StakeState::size_of(), &id(), ) .unwrap(); for merge_from_state in &[ StakeState::Initialized(Meta::auto(&wrong_authorized_address)), just_stake(Meta::auto(&wrong_authorized_address), stake_lamports), ] { let merge_from_account = AccountSharedData::new_data_with_space( stake_lamports, merge_from_state, StakeState::size_of(), &id(), ) .unwrap(); let transaction_accounts = vec![ (stake_address, stake_account.clone()), (merge_from_address, merge_from_account), (authorized_address, AccountSharedData::default()), (wrong_authorized_address, AccountSharedData::default()), ( sysvar::clock::id(), account::create_account_shared_data_for_test(&Clock::default()), ), ( sysvar::stake_history::id(), account::create_account_shared_data_for_test(&StakeHistory::default()), ), ]; instruction_accounts[4].pubkey = wrong_authorized_address; process_instruction( &serialize(&StakeInstruction::Merge).unwrap(), transaction_accounts.clone(), instruction_accounts.clone(), Err(InstructionError::MissingRequiredSignature), ); instruction_accounts[4].pubkey = authorized_address; process_instruction( &serialize(&StakeInstruction::Merge).unwrap(), transaction_accounts, instruction_accounts.clone(), Err(StakeError::MergeMismatch.into()), ); } } }
rust_cleaned_test_functions.jsonl/31667
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1992 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 20888, 1243, 19928, 62, 19084, 1261, 4407, 368, 341, 286, 1077, 18279, 6744, 284, 2048, 3362, 61783, 486, 9585, 792, 486, 931, 33864, 543, 286, 1077, 10880, 5673, 6744, 284, 2048, 3362, 61783, 486...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_display() { assert_eq!(format!("{}", ExtendedBigInt::BigInt(BigInt::zero())), "0"); assert_eq!(format!("{}", ExtendedBigInt::Infinity), "inf"); assert_eq!(format!("{}", ExtendedBigInt::MinusInfinity), "-inf"); assert_eq!(format!("{}", ExtendedBigInt::Nan), "nan"); // FIXME Come up with a way of displaying negative zero as }
rust_cleaned_test_functions.jsonl/101401
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 203 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14825, 368, 341, 286, 2060, 10714, 10297, 2243, 79878, 40565, 87474, 486, 87474, 5349, 343, 1072, 486, 14154, 96501, 330, 15, 797, 286, 2060, 10714, 10297, 2243, 79878, 40565, 87474, 486, 45090, 701...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_error_response_serializer() { assert_eq!( "{\"error\":\"unauthorized_client\"}", serde_json::to_string(&BasicErrorResponse::new( BasicErrorResponseType::UnauthorizedClient, None, None, )) .unwrap(), ); assert_eq!( "{\ \"error\":\"invalid_client\",\ \"error_description\":\"Invalid client_id\",\ \"error_uri\":\"https://example.com/errors/invalid_client\"\ }", serde_json::to_string(&BasicErrorResponse::new( BasicErrorResponseType::InvalidClient, Some("Invalid client_id".to_string()), Some("https://example.com/errors/invalid_client".to_string()), )) .unwrap(), ); }
rust_cleaned_test_functions.jsonl/18614
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 378 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4096, 9655, 67441, 368, 341, 262, 2060, 10714, 33673, 286, 54734, 841, 23488, 359, 19084, 8179, 2105, 24375, 286, 61570, 9455, 486, 983, 3904, 2099, 15944, 55901, 486, 931, 1006, 310, 14625, 1454, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1