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_variant_iter_tuple() { let v = Variant::tuple(&vec![ "foo".to_string().to_variant(), "bar".to_string().to_variant(), ]); let vec: Vec<String> = v.iter().map(|i| i.get().unwrap()).collect(); assert_eq!(vec, vec!["foo".to_string(), "bar".to_string()]); }
rust_cleaned_test_functions.jsonl/59854
{ "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, 46112, 11723, 21773, 368, 341, 286, 1077, 348, 284, 39292, 486, 24590, 2099, 4083, 90515, 310, 330, 7975, 3263, 983, 3904, 1005, 983, 46112, 3148, 310, 330, 2257, 3263, 983, 3904, 1005, 983, 46112...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_matmn() { let m0 = MatMN::from(&[[1., 2.], [3., 4.], [5., 6.]]); let m1 = m0.transpose(); assert_eq!(m1, MatMN::from(&[[1., 3., 5.], [2., 4., 6.]])); }
rust_cleaned_test_functions.jsonl/61596
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 99 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 16610, 21775, 368, 341, 262, 1077, 296, 15, 284, 6867, 55181, 486, 1499, 2099, 15505, 16, 2572, 220, 17, 13, 1125, 508, 18, 2572, 220, 19, 13, 1125, 508, 20, 2572, 220, 21, 24719, 2558, 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_mod_bad_stack() { let mut vm = ShrekVM::new(Vec::new()); vm.push(3); assert!(mod_(&mut vm).is_err()); }
rust_cleaned_test_functions.jsonl/71703
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 84 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 7480, 34199, 15528, 368, 341, 286, 1077, 5206, 10995, 284, 1417, 41861, 11187, 486, 931, 49923, 486, 931, 1423, 286, 10995, 2552, 7, 18, 317, 286, 2060, 10297, 2593, 62, 2099, 6984, 10995, 568, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_isaac_true_values_64() { let seed = [1,0,0,0, 23,0,0,0, 200,1,0,0, 210,30,0,0, 57,48,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0]; let mut rng = IsaacRng::from_seed(seed); let mut results = [0u64; 5]; for i in results.iter_mut() { *i = rng.next_u64(); } let expected = [ 3752888579798383186, 9035083239252078381,18052294697452424037, 11876559110374379111, 16751462502657800130]; assert_eq!(results, expected); }
rust_cleaned_test_functions.jsonl/52740
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 306 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6892, 64705, 16082, 9146, 62, 21, 19, 368, 341, 1789, 286, 1077, 10320, 284, 508, 16, 11, 15, 11, 15, 11, 15, 11, 220, 17, 18, 11, 15, 11, 15, 11, 15, 11, 220, 17, 15, 15, 11, 16, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_find_mut() { let mut m = TrieMap::new(); assert!(m.insert(1, 12)); assert!(m.insert(2, 8)); assert!(m.insert(5, 14)); let new = 100; match m.find_mut(&5) { None => fail!(), Some(x) => *x = new } assert_eq!(m.find(&5), Some(&new)); }
rust_cleaned_test_functions.jsonl/5902
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 188 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21814, 29523, 368, 341, 286, 1077, 5206, 296, 284, 62783, 2227, 486, 931, 543, 286, 2060, 10297, 76, 7030, 7, 16, 11, 220, 16, 17, 1106, 286, 2060, 10297, 76, 7030, 7, 17, 11, 220, 23, 1106,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_drop_on_broken() { static DROPPED: AtomicBool = ATOMIC_BOOL_INIT; DROPPED.store(false, Ordering::SeqCst); struct Connection; impl Drop for Connection { fn drop(&mut self) { DROPPED.store(true, Ordering::SeqCst); } } struct Handler; impl ManageConnection for Handler { type Connection = Connection; type Error = Error; fn connect(&self) -> Result<Connection, Error> { Ok(Connection) } fn is_valid(&self, _: &mut Connection) -> Result<(), Error> { Ok(()) } fn has_broken(&self, _: &mut Connection) -> bool { true } } let pool = Pool::new(Handler).unwrap(); drop(pool.get().ok().unwrap()); assert!(DROPPED.load(Ordering::SeqCst)); }
rust_cleaned_test_functions.jsonl/6403
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 388 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 29584, 4470, 880, 81709, 368, 341, 262, 1099, 422, 1285, 4406, 1479, 25, 30316, 11233, 284, 7369, 51793, 32491, 14446, 280, 262, 422, 1285, 4406, 1479, 16114, 3576, 11, 68621, 486, 20183, 34, 267,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_badge_message_configuration_load() { let mut msg_config = BadgeMessageConfiguration::default(); let mut badge = Badge::new().unwrap(); for i in 0..N_MESSAGES { badge .set_effect_pattern( i, BadgeEffect::try_from((N_MESSAGES - i - 1) as u8).unwrap(), ) .unwrap(); badge.set_effect_blink(i, true).unwrap(); badge.set_effect_speed(i, (i + 1) as u8).unwrap(); badge.set_effect_frame(i, true).unwrap(); badge.messages[i] .data .extend_from_slice(&[i as u8; BADGE_MSG_FONT_HEIGHT]); } msg_config.load(&badge); assert_eq!( msg_config.effect, [0x8F, 0x9E, 0xAD, 0xBC, 0xCB, 0xDA, 0xE9, 0xF8] ); for i in 0..N_MESSAGES { assert_eq!(msg_config.offset_length[i].header, 0x08); assert_eq!(msg_config.offset_length[i].offset, i as u8); assert_eq!(msg_config.offset_length[i].length, 1); } }
rust_cleaned_test_functions.jsonl/48656
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 532 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 34199, 709, 6462, 35726, 12411, 368, 341, 262, 1077, 5206, 3750, 5332, 284, 59083, 2052, 7688, 486, 2258, 1428, 262, 1077, 5206, 23961, 284, 59083, 486, 931, 1005, 15454, 543, 262, 369, 600, 304, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_range_equal_excluded() { let map: BTreeMap<_, _> = (0..5).map(|i| (i, i)).collect(); map.range((Excluded(2), Excluded(2))); }
rust_cleaned_test_functions.jsonl/49385
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 76 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9698, 11478, 2702, 10181, 368, 341, 262, 1077, 2415, 25, 425, 6533, 2227, 27, 6878, 716, 29, 284, 320, 15, 496, 20, 568, 2186, 22428, 72, 91, 320, 72, 11, 600, 4579, 17384, 543, 262, 2415, 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
#[test] fn test_earth_mag_cell_lookup() { // for comparison: let home_pos = get_test_reference_position(); let needle = [home_pos.lat, home_pos.lon]; let parent_cell = EARTH_MAG_TABLE.nearest_neighbor(&needle).unwrap(); println!("found parent_cell: {:?}", parent_cell); assert_approx_eq!(parent_cell.lat_deg, home_pos.lat, geomag_record::GEOMAG_CELL_LAT_RADIUS); assert_approx_eq!(parent_cell.lon_deg, home_pos.lon, geomag_record::GEOMAG_CELL_LON_RADIUS); let planet = PlanetEarth::new(&home_pos); let mfield = planet.calculate_mag_field(&home_pos); assert_approx_eq!(mfield[0], BERKELEY_CA_MAG_DATA[5], (BERKELEY_CA_MAG_DATA[5]*0.05).abs()); assert_approx_eq!(mfield[1], BERKELEY_CA_MAG_DATA[6], (BERKELEY_CA_MAG_DATA[6]*0.05).abs()); assert_approx_eq!(mfield[2], BERKELEY_CA_MAG_DATA[7], (BERKELEY_CA_MAG_DATA[7]*0.05).abs()); }
rust_cleaned_test_functions.jsonl/18365
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 489 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 62, 27541, 48310, 16648, 27464, 368, 341, 286, 442, 369, 12313, 510, 73363, 286, 1077, 2114, 6479, 284, 633, 4452, 25433, 9661, 1428, 286, 1077, 30309, 284, 508, 5117, 6479, 28631, 11, 2114, 6479,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_channel_from_fidl() { let _exec = fasync::Executor::new().unwrap(); let empty = bredr::Channel::new_empty(); assert!(Channel::try_from(empty).is_err()); let (remote, local) = zx::Socket::create(zx::SocketOpts::DATAGRAM).unwrap(); let okay = bredr::Channel { socket: Some(remote), channel_mode: Some(bredr::ChannelMode::Basic), max_tx_sdu_size: Some(1004), ..Decodable::new_empty() }; let chan = Channel::try_from(okay).expect("okay channel to be converted"); assert_eq!(1004, chan.max_tx_size()); assert_eq!(&ChannelMode::Basic, chan.channel_mode()); }
rust_cleaned_test_functions.jsonl/76853
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 328 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14571, 5673, 761, 55464, 368, 341, 286, 1077, 716, 11748, 284, 282, 7692, 486, 25255, 486, 931, 1005, 15454, 543, 286, 1077, 4287, 284, 54087, 81, 486, 9629, 486, 931, 15124, 543, 286, 2060, 102...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_reconstruct_chinese() { let stop_words = Set::default(); let analyzer = Analyzer::new(AnalyzerConfig::default_with_stopwords(&stop_words)); let orig = "人人生而自由﹐在尊严和权利上一律平等。他们赋有理性和良心﹐并应以兄弟关系的精神互相对待。"; let tokens = analyzer.analyze(orig); assert_eq!(orig, tokens.reconstruct().map(|(t, _)| t).collect::<String>()); }
rust_cleaned_test_functions.jsonl/98418
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 231 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1288, 7596, 4138, 7346, 368, 341, 286, 1077, 2936, 18981, 284, 2573, 486, 2258, 543, 286, 1077, 54660, 284, 78705, 486, 931, 7, 54911, 2648, 486, 2258, 6615, 19039, 5761, 2099, 9495, 18981, 1106, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_zipmap_not_compress() { struct TestRdbHandler { map: HashMap<String, String>, } impl EventHandler for TestRdbHandler { fn handle(&mut self, data: Event) { match data { Event::RDB(rdb) => match rdb { Object::Hash(hash) => { assert_eq!("zimap_doesnt_compress", String::from_utf8_lossy(hash.key)); for field in hash.fields { let name = String::from_utf8_lossy(&field.name).to_string(); let val = String::from_utf8_lossy(&field.value).to_string(); self.map.insert(name, val); } } Object::EOR => { assert_eq!("2", self.map.get("MKD1G6").unwrap()); assert_eq!("F7TI", self.map.get("YNNXK").unwrap()); } _ => {} }, Event::AOF(_) => {} } } } start_redis_test( "zipmap_that_doesnt_compress.rdb", 10014, Rc::new(RefCell::new(TestRdbHandler { map: HashMap::new() })), ); }
rust_cleaned_test_functions.jsonl/93098
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 740 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 42131, 2186, 7913, 87845, 368, 341, 262, 2036, 3393, 49, 1999, 3050, 341, 286, 2415, 25, 10528, 3464, 11, 923, 12520, 262, 555, 262, 11605, 31957, 369, 3393, 49, 1999, 3050, 341, 286, 5168, 3705...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_ser_de_hexbytes_option() { let call_data = MessageCall { from: None, to: Address::from([0; 20]), gas: None, gas_price: None, value: None, data: None, }; let hexstring = r#"{"from":null,"to":"0x0000000000000000000000000000000000000000","gas":null,"gasPrice":null,"value":null,"data":null}"#; assert_eq!(serde_json::to_string(&call_data).unwrap(), hexstring); assert_eq!( serde_json::from_str::<MessageCall>(hexstring).unwrap(), call_data ); let call_data_with_data = MessageCall { from: None, to: Address::from([0; 20]), gas: None, gas_price: None, value: None, data: Some(Bytes::from(&b"Hello Akula"[..])), }; let hexstring_with_data = r#"{"from":null,"to":"0x0000000000000000000000000000000000000000","gas":null,"gasPrice":null,"value":null,"data":"0x48656c6c6f20416b756c61"}"#; assert_eq!( serde_json::to_string(&call_data_with_data).unwrap(), hexstring_with_data ); assert_eq!( serde_json::from_str::<MessageCall>(hexstring_with_data).unwrap(), call_data_with_data ); }
rust_cleaned_test_functions.jsonl/10831
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 665 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 75861, 2259, 32655, 9651, 9672, 368, 341, 286, 1077, 1618, 1769, 284, 4856, 7220, 341, 310, 504, 25, 2240, 345, 310, 311, 25, 9177, 486, 1499, 2561, 15, 26, 220, 17, 15, 17036, 310, 6819, 25, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_i64_converter() { assert_eq!(i64_to_u64(i64::min_value()), u64::min_value()); assert_eq!(i64_to_u64(i64::max_value()), u64::max_value()); test_i64_converter_helper(0i64); test_i64_converter_helper(i64::min_value()); test_i64_converter_helper(i64::max_value()); for i in -1000i64..1000i64 { test_i64_converter_helper(i); } }
rust_cleaned_test_functions.jsonl/86448
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 232 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5318, 21, 19, 74073, 368, 341, 286, 2060, 10714, 10297, 72, 21, 19, 2346, 7300, 21, 19, 1956, 21, 19, 486, 1065, 3142, 11858, 575, 21, 19, 486, 1065, 3142, 1423, 286, 2060, 10714, 10297, 72, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_cache_usage() { let mut sqlite = db::new_connection("").unwrap(); let mut conn = Conn::connect(&mut sqlite).unwrap(); let db_ident = (*conn.current_schema()) .get_entid(&kw!(:db/ident)) .expect("db_ident") .0; let db_type = (*conn.current_schema()) .get_entid(&kw!(:db/valueType)) .expect("db_ident") .0; println!("db/ident is {}", db_ident); println!("db/type is {}", db_type); let query = format!( "[:find ?ident . :where [?e {} :db/doc][?e {} ?type][?type {} ?ident]]", db_ident, db_type, db_ident ); println!("Query is {}", query); assert!(!conn.current_cache().is_attribute_cached_forward(db_ident)); { let mut ip = conn.begin_transaction(&mut sqlite).expect("began"); let ident = ip .q_once(query.as_str(), None) .into_scalar_result() .expect("query"); assert_eq!( ident, Some(TypedValue::typed_ns_keyword("db.type", "string").into()) ); let start = time::Instant::now(); ip.q_once(query.as_str(), None) .into_scalar_result() .expect("query"); let end = time::Instant::now(); println!("Uncached took {}µs", (end - start).whole_microseconds()); ip.cache( &kw!(:db/ident), CacheDirection::Forward, CacheAction::Register, ) .expect("registered"); ip.cache( &kw!(:db/valueType), CacheDirection::Forward, CacheAction::Register, ) .expect("registered"); assert!(ip.cache.is_attribute_cached_forward(db_ident)); let ident = ip .q_once(query.as_str(), None) .into_scalar_result() .expect("query"); assert_eq!( ident, Some(TypedValue::typed_ns_keyword("db.type", "string").into()) ); let start = time::Instant::now(); ip.q_once(query.as_str(), None) .into_scalar_result() .expect("query"); let end = time::Instant::now(); println!("Cached took {}µs", (end - start).whole_microseconds()); // ip.rollback().expect("rolled back"); } assert!(!conn.current_cache().is_attribute_cached_forward(db_ident)); { let mut ip = conn.begin_transaction(&mut sqlite).expect("began"); let ident = ip .q_once(query.as_str(), None) .into_scalar_result() .expect("query"); assert_eq!( ident, Some(TypedValue::typed_ns_keyword("db.type", "string").into()) ); ip.cache( &kw!(:db/ident), CacheDirection::Forward, CacheAction::Register, ) .expect("registered"); ip.cache( &kw!(:db/valueType), CacheDirection::Forward, CacheAction::Register, ) .expect("registered"); assert!(ip.cache.is_attribute_cached_forward(db_ident)); ip.commit().expect("rolled back"); } assert!(conn.current_cache().is_attribute_cached_forward(db_ident)); assert!(conn.current_cache().is_attribute_cached_forward(db_type)); }
rust_cleaned_test_functions.jsonl/76425
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2024 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11529, 31507, 368, 341, 286, 1077, 5206, 22003, 284, 2927, 486, 931, 15866, 80821, 15454, 543, 286, 1077, 5206, 4534, 284, 18213, 486, 6459, 2099, 6984, 22003, 568, 15454, 1428, 286, 1077, 2927, 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_multi_file_with_missing() { let dirs = &["real"]; let files = &["real/a.foo", "real/b.foo"]; let te = TestEnv::new(dirs, files); te.assert_output(&["a.foo", "real", "fake"], "real/a.foo"); te.assert_error( &["a.foo", "real", "fake"], "[fd error]: Search path 'fake' is not a directory.", ); te.assert_output( &["", "real", "fake"], "real/a.foo real/b.foo", ); te.assert_output( &["", "real", "fake1", "fake2"], "real/a.foo real/b.foo", ); te.assert_error( &["", "real", "fake1", "fake2"], "[fd error]: Search path 'fake1' is not a directory. [fd error]: Search path 'fake2' is not a directory.", ); te.assert_failure_with_error( &["", "fake1", "fake2"], "[fd error]: Search path 'fake1' is not a directory. [fd error]: Search path 'fake2' is not a directory. [fd error]: No valid search paths given.", ); }
rust_cleaned_test_functions.jsonl/10849
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 475 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 25133, 2458, 6615, 40447, 368, 341, 262, 1077, 42248, 284, 609, 1183, 7951, 6332, 262, 1077, 3542, 284, 609, 1183, 7951, 14186, 58432, 497, 330, 7951, 3470, 58432, 6332, 262, 1077, 1013, 284, 3393...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_lexing_whitespaces() { let source = "\t \t\n\r\n \t\r"; let expected_toktype = vec![ TokenType::Tab, TokenType::Space, TokenType::Space, TokenType::Tab, TokenType::Newline, TokenType::Newline, TokenType::Space, TokenType::Tab, TokenType::Newline, ]; let lex = Lexer::new(source); let lexed_token = lex .clone() .map(|lextok| lextok.token.toktype) .collect::<Vec<TokenType>>(); let lexed_literal = lex .map(|lextok| lextok.token.literal) .collect::<Vec<String>>() .concat(); assert_eq!(lexed_token, expected_toktype); assert_eq!(lexed_literal, "\t \t\n\n \t\n"); }
rust_cleaned_test_functions.jsonl/108894
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 383 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 74547, 287, 36225, 3611, 27338, 368, 341, 262, 1077, 2530, 284, 2917, 83, 220, 1124, 83, 1699, 12016, 1699, 1124, 83, 12016, 876, 262, 1077, 3601, 76162, 1313, 284, 7486, 90515, 286, 56582, 486, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_function_type_many_params() { let want = FunctionType { base: BaseNode::default(), parameters: vec![ ParameterType::Pipe { base: BaseNode::default(), name: Some(Identifier { base: BaseNode::default(), name: "tables".to_string(), }), monotype: MonoType::Array(Box::new(ArrayType { base: BaseNode::default(), element: MonoType::Basic(NamedType { base: BaseNode::default(), name: Identifier { base: BaseNode::default(), name: "int".to_string(), }, }), })), }, ParameterType::Required { base: BaseNode::default(), name: Identifier { base: BaseNode::default(), name: "x".to_string(), }, monotype: MonoType::Basic(NamedType { base: BaseNode::default(), name: Identifier { base: BaseNode::default(), name: "int".to_string(), }, }), }, ParameterType::Optional { base: BaseNode::default(), name: Identifier { base: BaseNode::default(), name: "y".to_string(), }, monotype: MonoType::Basic(NamedType { base: BaseNode::default(), name: Identifier { base: BaseNode::default(), name: "bool".to_string(), }, }), }, ], monotype: MonoType::Basic(NamedType { base: BaseNode::default(), name: Identifier { base: BaseNode::default(), name: "int".to_string(), }, }), }; let mut builder = flatbuffers::FlatBufferBuilder::new(); assert_eq!( want, flatbuffers::get_root::<fb::FunctionType>(serialize( &mut builder, want.clone(), build_function_type, )) .into() ); }
rust_cleaned_test_functions.jsonl/112512
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1714 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9174, 1819, 22101, 6745, 368, 341, 286, 1077, 1366, 284, 5712, 929, 341, 310, 2331, 25, 5351, 1955, 486, 2258, 3148, 310, 5029, 25, 7486, 90515, 394, 15168, 929, 486, 34077, 341, 503, 2331, 25, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_find_class_method_precedence() { // finding class method should have precedence over // trait methods ok("class A { fun foo() {} } trait Foo { fun foo(); } impl Foo for A { fun foo() {} } fun test(a: A) { a.foo(); }"); err( "class A { fun foo() {} } trait Foo { fun foo(a: int); } impl Foo for A { fun foo(a: int) {} } fun test(a: A) { a.foo(1); }", pos(4, 31), Msg::ParamTypesIncompatible("foo".into(), Vec::new(), vec!["int".into()]), ); ok("class A { static fun foo() {} } trait Foo { fun foo(a: int); } impl Foo for A { fun foo(a: int) {} } fun test(a: A) { a.foo(1); }"); }
rust_cleaned_test_functions.jsonl/106639
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 411 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21814, 4790, 9032, 10442, 1998, 763, 368, 341, 286, 442, 9271, 536, 1714, 1265, 614, 53056, 916, 198, 286, 442, 17567, 5413, 198, 286, 5394, 445, 1040, 362, 314, 2464, 15229, 368, 4687, 456, 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_supplies_ammo_left() { let mut supplies = Supplies::new(); supplies.buy_ammo(150).unwrap(); assert_eq!(150, supplies.ammo_left()); }
rust_cleaned_test_functions.jsonl/28652
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 87 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 23723, 7202, 22880, 6355, 9579, 368, 341, 286, 1077, 5206, 16720, 284, 50252, 486, 931, 543, 286, 16720, 63871, 22880, 6355, 7, 16, 20, 15, 568, 15454, 543, 286, 2060, 10714, 10297, 16, 20, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_different_futures() { let fut = async move { 10 }; // Not zero sized! assert_eq!(Layout::for_value(&fut).size(), 1); let mut b = ReusableBoxFuture::new(fut); assert_eq!(b.get_pin().now_or_never(), Some(10)); b.try_set(async move { 20 }) .unwrap_or_else(|_| panic!("incorrect size")); assert_eq!(b.get_pin().now_or_never(), Some(20)); b.try_set(async move { 30 }) .unwrap_or_else(|_| panic!("incorrect size")); assert_eq!(b.get_pin().now_or_never(), Some(30)); }
rust_cleaned_test_functions.jsonl/8648
{ "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, 82741, 761, 74606, 368, 341, 286, 1077, 17645, 284, 3312, 3271, 314, 220, 16, 15, 2605, 286, 442, 2806, 7168, 29287, 4894, 286, 2060, 10714, 10297, 2175, 486, 1958, 3142, 2099, 69, 332, 568, 214...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_pretty_bytes_formatting() { fn format_bytes(bytes: u64) -> String { format!("{}", Bytes::new(bytes)) } let b = 1; let kb = b * 1000; let mb = kb * 1000; let gb = mb * 1000; assert_eq!("0 B", format_bytes(0)); // This is weird assert_eq!("1.00 B", format_bytes(b)); assert_eq!("999.00 B", format_bytes(b * 999)); assert_eq!("12.00 MB", format_bytes(mb * 12)); assert_eq!("123.00 MB", format_bytes(mb * 123)); assert_eq!("5.50 MB", format_bytes(mb * 5 + kb * 500)); assert_eq!("7.54 GB", format_bytes(gb * 7 + 540 * mb)); assert_eq!("1.20 TB", format_bytes(gb * 1200)); // bytes assert_eq!("234.00 B", format_bytes(234)); assert_eq!("999.00 B", format_bytes(999)); // kilobytes assert_eq!("2.23 kB", format_bytes(2234)); assert_eq!("62.50 kB", format_bytes(62500)); assert_eq!("329.99 kB", format_bytes(329990)); // megabytes assert_eq!("2.75 MB", format_bytes(2750000)); assert_eq!("55.00 MB", format_bytes(55000000)); assert_eq!("987.65 MB", format_bytes(987654321)); // gigabytes assert_eq!("5.28 GB", format_bytes(5280000000)); assert_eq!("95.20 GB", format_bytes(95200000000)); assert_eq!("302.00 GB", format_bytes(302000000000)); }
rust_cleaned_test_functions.jsonl/102326
{ "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, 620, 21322, 12524, 8955, 1280, 368, 341, 286, 5168, 3561, 12524, 23158, 25, 575, 21, 19, 8, 1464, 923, 341, 310, 3561, 79878, 30024, 486, 931, 23158, 1171, 286, 456, 286, 1077, 293, 284, 220, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_option_from_valid_buffer_has_correct_values() { let buf = vec![1, 4, 255, 255, 255, 0]; let mut buf = OptionBuffer { buf: &buf }; let result = buf.next(); match result { Some(opt) => { let code: u8 = opt.code.into(); assert_eq!(code, 1); assert_eq!(opt.value, vec![255, 255, 255, 0]); } None => assert!(false), // test failure } }
rust_cleaned_test_functions.jsonl/93676
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 257 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9672, 5673, 8337, 7776, 21778, 31550, 9146, 368, 341, 286, 1077, 6607, 284, 7486, 20703, 16, 11, 220, 19, 11, 220, 17, 20, 20, 11, 220, 17, 20, 20, 11, 220, 17, 20, 20, 11, 220, 15, 935, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_clean_zero_lamport_and_dead_slot() { solana_logger::setup(); let accounts = AccountsDb::new(Vec::new(), &ClusterType::Development); let pubkey1 = solana_sdk::pubkey::new_rand(); let pubkey2 = solana_sdk::pubkey::new_rand(); let account = AccountSharedData::new(1, 1, AccountSharedData::default().owner()); let zero_lamport_account = AccountSharedData::new(0, 0, AccountSharedData::default().owner()); // Store two accounts accounts.store_uncached(0, &[(&pubkey1, &account)]); accounts.store_uncached(0, &[(&pubkey2, &account)]); // will prevent pubkey1 from being cleaned up later even when it's a // zero-lamport account let ancestors = vec![(0, 1)].into_iter().collect(); let (slot1, account_info1) = accounts .accounts_index .get(&pubkey1, Some(&ancestors), None) .map(|(account_list1, index1)| account_list1.slot_list()[index1].clone()) .unwrap(); let (slot2, account_info2) = accounts .accounts_index .get(&pubkey2, Some(&ancestors), None) .map(|(account_list2, index2)| account_list2.slot_list()[index2].clone()) .unwrap(); assert_eq!(slot1, 0); assert_eq!(slot1, slot2); assert_eq!(account_info1.store_id, account_info2.store_id); // Update account 1 in slot 1 accounts.store_uncached(1, &[(&pubkey1, &account)]); // Update account 1 as zero lamports account accounts.store_uncached(2, &[(&pubkey1, &zero_lamport_account)]); // slot 1 should be purged accounts.add_root(0); accounts.add_root(1); accounts.add_root(2); // the latest update for pubkey 2 accounts.clean_accounts(None, false); assert!(accounts.storage.get_slot_stores(0).is_some()); assert!(accounts.storage.get_slot_stores(1).is_none()); // Slot 1 should be cleaned because all it's accounts are // storage entries assert_eq!(accounts.alive_account_count_in_slot(1), 0); }
rust_cleaned_test_functions.jsonl/1350
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 993 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 19573, 19359, 907, 309, 403, 8378, 53427, 27563, 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...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_state_cmp() { let init = NameServerStats { state: NameServerState::Init { send_edns: None }, successes: 0, failures: 0, }; let established = NameServerStats { state: NameServerState::Established { remote_edns: None }, successes: 0, failures: 0, }; let failed = NameServerStats { state: NameServerState::Failed { error: ResolveErrorKind::Msg("test".to_string()).into(), when: Instant::now(), }, successes: 0, failures: 0, }; let established_successes = NameServerStats { state: NameServerState::Established { remote_edns: None }, successes: 1, failures: 0, }; let established_failed = NameServerStats { state: NameServerState::Established { remote_edns: None }, successes: 0, failures: 1, }; assert_eq!(init.cmp(&init), Ordering::Equal); assert_eq!(init.cmp(&established), Ordering::Greater); assert_eq!(established.cmp(&failed), Ordering::Greater); assert_eq!(established.cmp(&established_successes), Ordering::Greater); assert_eq!(established.cmp(&established_failed), Ordering::Greater); }
rust_cleaned_test_functions.jsonl/104488
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 641 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4387, 35193, 368, 341, 286, 1077, 2930, 284, 3988, 5475, 16635, 341, 310, 1584, 25, 3988, 5475, 1397, 486, 3803, 314, 3624, 32370, 4412, 25, 2240, 1153, 310, 47088, 25, 220, 15, 345, 310, 27850,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_root_ns_func_ret_pod() { let hdr = indoc! {" #include <cstdint> #include <memory> struct Bob { uint32_t a; }; namespace B { inline Bob daft() { Bob bob; bob.a = 12; return bob; } } "}; let rs = quote! { assert_eq!(ffi::B::daft().a, 12); }; run_test("", hdr, rs, &["B::daft"], &["Bob"]); }
rust_cleaned_test_functions.jsonl/9839
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 228 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 12993, 34728, 9596, 21695, 85337, 368, 341, 262, 1077, 36615, 284, 1257, 509, 0, 314, 698, 286, 671, 997, 366, 96975, 397, 286, 671, 997, 366, 17269, 397, 286, 2036, 14261, 341, 310, 2622, 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_eval_single_constant_node() { let exp = RpnExpressionBuilder::new_for_test() .push_constant_for_test(1.5f64) .build_for_test(); let mut ctx = EvalContext::default(); let mut columns = LazyBatchColumnVec::empty(); let result = exp.eval(&mut ctx, &[], &mut columns, &[], 10); let val = result.unwrap(); assert!(val.is_scalar()); assert_eq!( val.scalar_value().unwrap().as_real(), Real::new(1.5).ok().as_ref() ); assert_eq!(val.field_type().as_accessor().tp(), FieldTypeTp::Double); }
rust_cleaned_test_functions.jsonl/92658
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 313 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21296, 19487, 34967, 5084, 368, 341, 286, 1077, 1343, 284, 431, 19958, 9595, 3297, 486, 931, 5478, 4452, 741, 310, 659, 9077, 34967, 5478, 4452, 7, 16, 13, 20, 69, 21, 19, 340, 310, 659, 5834,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_vote() { let (vote_pubkey, vote_account) = create_test_account(); let vote = Vote::new(vec![1], Hash::default()); let vote_state = simulate_process_vote_unchecked(&vote_pubkey, &vote_account, &vote).unwrap(); assert_eq!( vote_state.votes, vec![Lockout::new(*vote.slots.last().unwrap())] ); assert_eq!(vote_state.credits(), 0); }
rust_cleaned_test_functions.jsonl/43726
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 215 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 54360, 368, 341, 286, 1077, 320, 29358, 34014, 792, 11, 6910, 13500, 8, 284, 1855, 4452, 13500, 1428, 286, 1077, 6910, 284, 34034, 486, 931, 25592, 20703, 16, 1125, 6531, 486, 2258, 1423, 286, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_mvcc_resolve_lock_gc_and_delete() { use kvproto::kvrpcpb::*; use protobuf; let (_cluster, client, ctx) = must_new_cluster_and_kv_client(); let (k, v) = (b"key".to_vec(), b"value".to_vec()); let mut ts = 0; // Prewrite ts += 1; let prewrite_start_version = ts; let mut mutation = Mutation::new(); mutation.op = Op::Put; mutation.key = k.clone(); mutation.value = v.clone(); must_kv_prewrite( &client, ctx.clone(), vec![mutation], k.clone(), prewrite_start_version, ); // Commit ts += 1; let commit_version = ts; must_kv_commit( &client, ctx.clone(), vec![k.clone()], prewrite_start_version, commit_version, ); // Prewrite puts some locks. ts += 1; let prewrite_start_version2 = ts; let (k2, v2) = (b"key2".to_vec(), b"value2".to_vec()); let new_v = b"new value".to_vec(); let mut mut_pri = Mutation::new(); mut_pri.op = Op::Put; mut_pri.key = k.clone(); mut_pri.value = new_v.clone(); let mut mut_sec = Mutation::new(); mut_sec.op = Op::Put; mut_sec.key = k2.clone(); mut_sec.value = v2.to_vec(); must_kv_prewrite( &client, ctx.clone(), vec![mut_pri, mut_sec], k.clone(), prewrite_start_version2, ); // Resolve lock ts += 1; let resolve_lock_commit_version = ts; let mut resolve_lock_req = ResolveLockRequest::new(); let mut temp_txninfo = TxnInfo::new(); temp_txninfo.txn = prewrite_start_version2; temp_txninfo.status = resolve_lock_commit_version; let vec_txninfo = vec![temp_txninfo]; resolve_lock_req.set_context(ctx.clone()); resolve_lock_req.set_txn_infos(protobuf::RepeatedField::from_vec(vec_txninfo)); let resolve_lock_resp = client.kv_resolve_lock(&resolve_lock_req).unwrap(); assert!(!resolve_lock_resp.has_region_error()); assert!(!resolve_lock_resp.has_error()); // Get `k` at the latest ts. ts += 1; let get_version1 = ts; let mut get_req1 = GetRequest::new(); get_req1.set_context(ctx.clone()); get_req1.key = k.clone(); get_req1.version = get_version1; let get_resp1 = client.kv_get(&get_req1).unwrap(); assert!(!get_resp1.has_region_error()); assert!(!get_resp1.has_error()); assert_eq!(get_resp1.value, new_v); // GC `k` at the latest ts. ts += 1; let gc_safe_ponit = ts; let mut gc_req = GCRequest::new(); gc_req.set_context(ctx.clone()); gc_req.safe_point = gc_safe_ponit; let gc_resp = client.kv_gc(&gc_req).unwrap(); assert!(!gc_resp.has_region_error()); assert!(!gc_resp.has_error()); // the `k` at the old ts should be none. let get_version2 = commit_version + 1; let mut get_req2 = GetRequest::new(); get_req2.set_context(ctx.clone()); get_req2.key = k.clone(); get_req2.version = get_version2; let get_resp2 = client.kv_get(&get_req2).unwrap(); assert!(!get_resp2.has_region_error()); assert!(!get_resp2.has_error()); assert_eq!(get_resp2.value, b"".to_vec()); // Transaction debugger commands // MvccGetByKey let mut mvcc_get_by_key_req = MvccGetByKeyRequest::new(); mvcc_get_by_key_req.set_context(ctx.clone()); mvcc_get_by_key_req.key = k.clone(); let mvcc_get_by_key_resp = client.mvcc_get_by_key(&mvcc_get_by_key_req).unwrap(); assert!(!mvcc_get_by_key_resp.has_region_error()); assert!(mvcc_get_by_key_resp.error.is_empty()); assert!(mvcc_get_by_key_resp.has_info()); // MvccGetByStartTs let mut mvcc_get_by_start_ts_req = MvccGetByStartTsRequest::new(); mvcc_get_by_start_ts_req.set_context(ctx.clone()); mvcc_get_by_start_ts_req.start_ts = prewrite_start_version2; let mvcc_get_by_start_ts_resp = client .mvcc_get_by_start_ts(&mvcc_get_by_start_ts_req) .unwrap(); assert!(!mvcc_get_by_start_ts_resp.has_region_error()); assert!(mvcc_get_by_start_ts_resp.error.is_empty()); assert!(mvcc_get_by_start_ts_resp.has_info()); assert_eq!(mvcc_get_by_start_ts_resp.key, k); // Delete range let mut del_req = DeleteRangeRequest::new(); del_req.set_context(ctx.clone()); del_req.start_key = b"a".to_vec(); del_req.end_key = b"z".to_vec(); let del_resp = client.kv_delete_range(&del_req).unwrap(); assert!(!del_resp.has_region_error()); assert!(del_resp.error.is_empty()); }
rust_cleaned_test_functions.jsonl/8797
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2079 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 73187, 638, 77291, 9818, 49423, 8378, 11353, 368, 341, 262, 990, 16178, 15110, 486, 74, 18920, 3992, 16650, 56162, 262, 990, 69634, 280, 262, 1077, 5453, 18855, 11, 2943, 11, 5635, 8, 284, 1969, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_simple_aliases() { let mut syntax_grammar = SyntaxGrammar { variables: vec![ SyntaxVariable { name: "v1".to_owned(), kind: VariableType::Named, productions: vec![Production { dynamic_precedence: 0, steps: vec![ ProductionStep::new(Symbol::terminal(0)).with_alias("a1", true), ProductionStep::new(Symbol::terminal(1)).with_alias("a2", true), ProductionStep::new(Symbol::terminal(2)).with_alias("a3", true), ], }], }, SyntaxVariable { name: "v2".to_owned(), kind: VariableType::Named, productions: vec![Production { dynamic_precedence: 0, steps: vec![ // Token 0 is always aliased as "a1". ProductionStep::new(Symbol::terminal(0)).with_alias("a1", true), ProductionStep::new(Symbol::terminal(1)), // Token 2 is aliased differently than above. ProductionStep::new(Symbol::terminal(2)).with_alias("a4", true), ], }], }, ], extra_tokens: Vec::new(), expected_conflicts: Vec::new(), variables_to_inline: Vec::new(), external_tokens: Vec::new(), word_token: None, }; let lexical_grammar = LexicalGrammar { nfa: Nfa::new(), variables: vec![ LexicalVariable { name: "t1".to_string(), kind: VariableType::Anonymous, implicit_precedence: 0, start_state: 0, }, LexicalVariable { name: "t2".to_string(), kind: VariableType::Anonymous, implicit_precedence: 0, start_state: 0, }, LexicalVariable { name: "t3".to_string(), kind: VariableType::Anonymous, implicit_precedence: 0, start_state: 0, }, ], }; let simple_aliases = extract_simple_aliases(&mut syntax_grammar, &lexical_grammar); assert_eq!(simple_aliases.len(), 1); assert_eq!( simple_aliases[&Symbol::terminal(0)], Alias { value: "a1".to_string(), is_named: true, } ); assert_eq!( syntax_grammar.variables, vec![ SyntaxVariable { name: "v1".to_owned(), kind: VariableType::Named, productions: vec![Production { dynamic_precedence: 0, steps: vec![ // 'Simple' alias removed ProductionStep::new(Symbol::terminal(0)), // Other aliases unchanged ProductionStep::new(Symbol::terminal(1)).with_alias("a2", true), ProductionStep::new(Symbol::terminal(2)).with_alias("a3", true), ], },], }, SyntaxVariable { name: "v2".to_owned(), kind: VariableType::Named, productions: vec![Production { dynamic_precedence: 0, steps: vec![ ProductionStep::new(Symbol::terminal(0)), ProductionStep::new(Symbol::terminal(1)), ProductionStep::new(Symbol::terminal(2)).with_alias("a4", true), ], },], }, ] ); }
rust_cleaned_test_functions.jsonl/12335
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2625 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 39123, 30015, 90233, 368, 341, 286, 1077, 5206, 19482, 62, 41094, 284, 32117, 97178, 341, 310, 7332, 25, 7486, 90515, 394, 32117, 7827, 341, 503, 829, 25, 330, 85, 16, 3263, 983, 51973, 3148, 50...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_request_snapshot_step_down() { let (mut nt, _) = prepare_request_snapshot(); // Commit a new entry and leader steps down while peer 2 is isolated. nt.isolate(2); let mut test_entries = Entry::default(); test_entries.data = b"testdata".to_vec(); let msg = new_message_with_entries(1, 1, MessageType::MsgPropose, vec![test_entries]); nt.send(vec![msg]); nt.send(vec![new_message(3, 3, MessageType::MsgHup, 0)]); assert_eq!(nt.peers[&3].state, StateRole::Leader); // Recover and request the latest snapshot. nt.recover(); let request_idx = nt.peers[&2].raft_log.committed; nt.peers .get_mut(&2) .unwrap() .request_snapshot(request_idx) .unwrap(); nt.send(vec![new_message(3, 3, MessageType::MsgBeat, 0)]); assert!( nt.peers[&2].pending_request_snapshot == INVALID_INDEX, "{}", nt.peers[&2].pending_request_snapshot ); }
rust_cleaned_test_functions.jsonl/19197
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 438 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 7893, 53265, 11946, 13998, 368, 341, 262, 1077, 320, 6984, 31412, 11, 27439, 284, 10549, 7893, 53265, 1428, 262, 442, 9205, 264, 501, 4343, 323, 7653, 7354, 1495, 1393, 14397, 220, 17, 374, 24203,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_mempool_not_listening() { // Create runtime and mempool notifier let runtime = create_runtime(); let _enter = runtime.enter(); let (mempool_notifier, mut mempool_listener) = crate::new_mempool_notifier_listener_pair(); let notify_result = block_on(mempool_notifier.notify_new_commit(vec![create_user_transaction()], 0, 1000)); assert_matches!(notify_result, Err(Error::TimeoutWaitingForMempool)); // Drop the receiver and try again mempool_listener.notification_receiver.close(); let notify_result = block_on(mempool_notifier.notify_new_commit(vec![create_user_transaction()], 0, 1000)); assert_matches!(notify_result, Err(Error::CommitNotificationError(_))); }
rust_cleaned_test_functions.jsonl/24569
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 335 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 717, 3262, 1749, 7913, 2019, 6019, 368, 341, 286, 442, 4230, 15592, 323, 1833, 10285, 73169, 198, 286, 1077, 15592, 284, 1855, 33232, 543, 286, 1077, 716, 1950, 284, 15592, 35690, 543, 286, 1077, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_parse_valid_redshift_create_cluster_subnet_group() { let mock_response = MockResponseReader::read_response( "test_resources/generated/valid", "redshift-create-cluster-subnet-group.xml", ); let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response); let client = RedshiftClient::new(mock, MockCredentialsProvider, rusoto_region::UsEast1); let request = CreateClusterSubnetGroupMessage::default(); let result = client.create_cluster_subnet_group(request).sync(); assert!(result.is_ok(), "parse error: {:?}", result); }
rust_cleaned_test_functions.jsonl/12104
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 259 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 8337, 26058, 13418, 8657, 28441, 95681, 6288, 368, 341, 286, 1077, 7860, 9655, 284, 14563, 2582, 5062, 486, 878, 9655, 1006, 310, 330, 1944, 35569, 79372, 14, 1891, 756, 310, 330, 1151, 134...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_serde() { let mut rng = OsRng; let element = Fp6::random(&mut rng); let encoded = bincode::serialize(&element).unwrap(); let parsed: Fp6 = bincode::deserialize(&encoded).unwrap(); assert_eq!(parsed, element); // Check that the encoding is 48 bytes exactly assert_eq!(encoded.len(), 48); // Check that the encoding itself matches the usual one assert_eq!(element, bincode::deserialize(&element.to_bytes()).unwrap()); // Check that invalid encodings fail let wrong_encoding = [255; 48]; assert!(bincode::deserialize::<Fp6>(&wrong_encoding).is_err()); let element = Fp6::random(&mut rng); let encoded = bincode::serialize(&element).unwrap(); assert!(bincode::deserialize::<Fp6>(&encoded[0..47]).is_err()); }
rust_cleaned_test_functions.jsonl/132399
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 369 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 75861, 450, 368, 341, 286, 1077, 5206, 28422, 284, 15433, 49, 968, 280, 286, 1077, 2392, 284, 434, 79, 21, 486, 11463, 2099, 6984, 28422, 317, 286, 1077, 20498, 284, 9544, 1851, 486, 24166, 2099...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_neuron_add_all_permissions_to_self() { local_test_on_sns_subnet(|runtime| async move { let user = Sender::from_keypair(&TEST_USER1_KEYPAIR); let account_identifier = AccountIdentifier::from(user.get_principal_id()); let alloc = Tokens::from_tokens(1000).unwrap(); let system_params = NervousSystemParameters { // Just grant ManagePrincipals to the claimer neuron_claimer_permissions: Some(NeuronPermissionList { permissions: vec![NeuronPermissionType::ManagePrincipals as i32], }), // Be able to grant all permissions neuron_grantable_permissions: Some(NeuronPermissionList { permissions: NeuronPermissionType::all(), }), ..NervousSystemParameters::with_default_values() }; let sns_init_payload = SnsInitPayloadsBuilder::new() .with_ledger_account(account_identifier, alloc) .with_nervous_system_parameters(system_params) .build(); let sns_canisters = SnsCanisters::set_up(&runtime, sns_init_payload).await; let neuron_id = sns_canisters.stake_and_claim_neuron(&user, None).await; let neuron = sns_canisters.get_neuron(&neuron_id).await; let subaccount = neuron.subaccount().expect("Error creating the subaccount"); // Assert that the default claimer permissions are as expected before adding more assert_eq!(neuron.permissions.len(), 1); assert_eq!( neuron.permissions[0].principal.unwrap(), user.get_principal_id() ); assert_eq!(neuron.permissions[0].permission_type.len(), 1); assert_eq!( neuron.permissions[0].permission_type[0], NeuronPermissionType::ManagePrincipals as i32 ); // Grant the claimer all permissions sns_canisters .add_neuron_permissions( &user, &subaccount, Some(user.get_principal_id()), NeuronPermissionType::all(), ) .await; let neuron = sns_canisters.get_neuron(&neuron_id).await; assert_eq!(neuron.permissions.len(), 1); let mut neuron_permission = get_neuron_permission_from_neuron(&neuron, &user.get_principal_id()); // There is no guarantee to order so sort is required for comparison neuron_permission.permission_type.sort_unstable(); assert_eq!( neuron_permission.permission_type, NeuronPermissionType::all() ); Ok(()) }); }
rust_cleaned_test_functions.jsonl/107255
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1224 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13925, 36090, 2891, 5705, 44767, 2346, 25637, 368, 341, 262, 2205, 4452, 4470, 643, 4412, 95681, 22428, 22255, 91, 3312, 3271, 341, 286, 1077, 1196, 284, 54610, 486, 1499, 3097, 12670, 2099, 10033, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_txt_input() -> Result<(), Error> { let txt = "# Directed graph (each unordered pair of nodes is saved once): CA-AstroPh.txt # Collaboration network of Arxiv Astro Physics category (there is an edge if authors coauthored at least one paper) # Nodes: 6 Edges: 396160 # FromNodeId ToNodeId 0 1 2 3 1 4 2 5 "; let buf = BufReader::new(txt.as_bytes()); let mut graph = Graph::new_ordered(6); graph.add_edge(0, 1)?; graph.add_edge(2, 3)?; graph.add_edge(1, 4)?; graph.add_edge(2, 5)?; let parsed = parse_txt_input(buf)?; assert_eq!(graph, parsed); Ok(()) }
rust_cleaned_test_functions.jsonl/91746
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 298 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 22436, 5898, 368, 1464, 5714, 68843, 4600, 29, 341, 286, 1077, 7932, 284, 5869, 77205, 4771, 320, 9547, 55733, 6716, 315, 7798, 374, 6781, 3055, 1648, 9183, 6691, 95941, 3357, 3909, 715, 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...
6
#[test] fn test_z() { let vec = vec3(1.0, 0.0, 0.0); let rot = Quaternion::from_angle_z(Deg(90.0)); assert_ulps_eq!(vec3(0.0, 1.0, 0.0), rot * vec); }
rust_cleaned_test_functions.jsonl/38266
{ "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, 6415, 368, 341, 286, 1077, 7486, 284, 7486, 18, 7, 16, 13, 15, 11, 220, 15, 13, 15, 11, 220, 15, 13, 15, 626, 286, 1077, 5749, 284, 24801, 486, 1499, 21727, 6415, 5432, 791, 7, 24, 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_mvcc_txn_rollback_before_prewrite() { let engine = TestEngineBuilder::new().build().unwrap(); let key = b"key"; must_rollback(&engine, key, 5); must_prewrite_lock_err(&engine, key, key, 5); }
rust_cleaned_test_functions.jsonl/16077
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 118 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 73187, 638, 92299, 62, 33559, 23708, 620, 52473, 368, 341, 286, 1077, 4712, 284, 3393, 4571, 3297, 486, 931, 1005, 5834, 1005, 15454, 543, 286, 1077, 1376, 284, 293, 1, 792, 876, 286, 1969, 62, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_deadline_config_exceeded() { let mut testkit = testkit_with_supervisor(4); let initiator_id = testkit.network().us().validator_id().unwrap(); let consensus_config = testkit.consensus_config(); let new_consensus_config = consensus_config_propose_first_variant(&testkit); let config_proposal = ConfigProposeBuilder::new(CFG_CHANGE_HEIGHT) .extend_consensus_config_propose(new_consensus_config.clone()) .build(); testkit .create_block_with_transaction(sign_config_propose_transaction( &testkit, config_proposal, initiator_id, )) .transactions[0] .status() .expect("Transaction with change propose discarded."); testkit.create_blocks_until(CFG_CHANGE_HEIGHT.next()); assert_eq!(config_propose_entry(&testkit), None); assert_eq!(testkit.consensus_config(), consensus_config); }
rust_cleaned_test_functions.jsonl/93829
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 383 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 53427, 1056, 5332, 2702, 94206, 368, 341, 262, 1077, 5206, 1273, 8226, 284, 1273, 8226, 6615, 23723, 31396, 7, 19, 317, 262, 1077, 98040, 842, 284, 1273, 8226, 20573, 1005, 355, 1005, 16112, 842, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_emit_mov_imm64() { assert_emit!(0x48, 0xb8, 0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11; emit_movq_imm64_reg(0x1122334455667788, RAX)); assert_emit!(0x49, 0xbf, 0, 0x55, 0x44, 0x33, 0x22, 0x11, 0, 0; emit_movq_imm64_reg(0x0000112233445500, R15)); assert_emit!(0x48, 0xbc, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11, 0; emit_movq_imm64_reg(0x0011223344556677, RSP)); }
rust_cleaned_test_functions.jsonl/85483
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 290 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 69082, 55798, 71370, 21, 19, 368, 341, 286, 2060, 69082, 10297, 15, 87, 19, 23, 11, 220, 15, 7929, 23, 11, 220, 15, 87, 23, 23, 11, 220, 15, 87, 22, 22, 11, 220, 15, 87, 21, 21, 11, 22...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_client_received_unknown_stream() { let (mut client, mut server) = connect(); // create a stream with unknown type. let new_stream_id = server.conn.stream_create(StreamType::UniDi).unwrap(); let _ = server .conn .stream_send(new_stream_id, &[0x41, 0x19, 0x4, 0x4, 0x6, 0x0, 0x8, 0x0]) .unwrap(); let out = server.conn.process(None, now()); let out = client.process(out.dgram(), now()); mem::drop(server.conn.process(out.dgram(), now())); // check for stop-sending with Error::HttpStreamCreation. let mut stop_sending_event_found = false; while let Some(e) = server.conn.next_event() { if let ConnectionEvent::SendStreamStopSending { stream_id, app_error, } = e { stop_sending_event_found = true; assert_eq!(stream_id, new_stream_id); assert_eq!(app_error, Error::HttpStreamCreation.code()); } } assert!(stop_sending_event_found); assert_eq!(client.state(), Http3State::Connected); }
rust_cleaned_test_functions.jsonl/101894
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 582 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8179, 40783, 57507, 12673, 368, 341, 286, 1077, 320, 6984, 2943, 11, 5206, 3538, 8, 284, 4564, 1428, 286, 442, 1855, 264, 4269, 448, 9788, 943, 624, 286, 1077, 501, 12673, 842, 284, 3538, 22810,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_sample_threshold() -> Result<()> { fn check_number_of_mutants(threshold: i32) -> usize { let module = WasmModule::from_file("testdata/count_words/test.wasm").unwrap(); let config = Config::parse_file("testdata/count_words/wasmut.toml").unwrap(); let engine = MutationEngine::new(&config, threshold).unwrap(); engine.discover_mutation_positions(&module).unwrap().len() } assert_eq!(check_number_of_mutants(100), 23); // but I don't really see a way to test this without having // a seedable RNG - and this requires a bit of refactoring // TODO ! assert!(check_number_of_mutants(50) < 23); Ok(()) }
rust_cleaned_test_functions.jsonl/51516
{ "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, 17491, 21858, 368, 1464, 5714, 71698, 341, 286, 5168, 1779, 5500, 3575, 29523, 1783, 24365, 7161, 25, 600, 18, 17, 8, 1464, 22301, 341, 310, 1077, 4688, 284, 467, 10530, 3332, 486, 1499, 2458, 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_in_channel() -> Result<(), Box<dyn Error>> { let cache = InMemoryCache::new(); let permissions = cache.permissions(); cache.update(&GuildCreate(base_guild())); assert!(matches!( permissions.in_channel(USER_ID, CHANNEL_ID).unwrap_err().kind(), ChannelErrorType::ChannelUnavailable { channel_id: c_id } if *c_id == CHANNEL_ID )); cache.update(&ChannelCreate(channel())); assert!(matches!( permissions.in_channel(USER_ID, CHANNEL_ID).unwrap_err().kind(), ChannelErrorType::MemberUnavailable { guild_id: g_id, user_id: u_id } if *g_id == GUILD_ID && *u_id == USER_ID )); cache.update(&MemberAdd({ let mut member = test::member(USER_ID, GUILD_ID); member.roles.push(OTHER_ROLE_ID); member })); assert!(matches!( permissions.in_channel(USER_ID, CHANNEL_ID).unwrap_err().kind(), &ChannelErrorType::RoleUnavailable { role_id } if role_id == OTHER_ROLE_ID )); cache.update(&role_create( GUILD_ID, role_with_permissions( OTHER_ROLE_ID, Permissions::SEND_MESSAGES | Permissions::BAN_MEMBERS, ), )); assert_eq!( Permissions::EMBED_LINKS | Permissions::SEND_MESSAGES, permissions.in_channel(USER_ID, CHANNEL_ID)?, ); Ok(()) }
rust_cleaned_test_functions.jsonl/98886
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 775 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1243, 14571, 368, 1464, 5714, 68843, 8261, 92846, 4600, 2452, 341, 286, 1077, 6500, 284, 758, 10642, 8233, 486, 931, 543, 286, 1077, 8541, 284, 6500, 62584, 1428, 286, 6500, 5317, 2099, 72574, 402...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_e2e_reconfiguration() { let (env, mut client_proxy_1) = setup_swarm_and_client_proxy(3, 1); // the client connected to the removed validator let mut client_proxy_0 = env.get_validator_client(0, None); client_proxy_1.create_next_account(false).unwrap(); client_proxy_0.set_accounts(client_proxy_1.copy_all_accounts()); client_proxy_1 .mint_coins(&["mintb", "0", "10", "Coin1"], true) .unwrap(); assert!(compare_balances( vec![(10.0, "Coin1".to_string())], client_proxy_1.get_balances(&["b", "0"]).unwrap(), )); // wait for the mint txn in node 0 client_proxy_0 .wait_for_transaction(testnet_dd_account_address(), 1) .unwrap(); assert!(compare_balances( vec![(10.0, "Coin1".to_string())], client_proxy_0.get_balances(&["b", "0"]).unwrap(), )); let peer_id = env .get_validator(0) .unwrap() .validator_peer_id() .unwrap() .to_string(); client_proxy_1 .remove_validator(&["remove_validator", &peer_id], true) .unwrap(); // mint another 10 coins after remove node 0 client_proxy_1 .mint_coins(&["mintb", "0", "10", "Coin1"], true) .unwrap(); assert!(compare_balances( vec![(20.0, "Coin1".to_string())], client_proxy_1.get_balances(&["b", "0"]).unwrap(), )); // client connected to removed validator can not see the update assert!(compare_balances( vec![(10.0, "Coin1".to_string())], client_proxy_0.get_balances(&["b", "0"]).unwrap(), )); // Add the node back client_proxy_1 .add_validator(&["add_validator", &peer_id], true) .unwrap(); client_proxy_0 .wait_for_transaction(testnet_dd_account_address(), 2) .unwrap(); assert!(compare_balances( vec![(20.0, "Coin1".to_string())], client_proxy_0.get_balances(&["b", "0"]).unwrap(), )); }
rust_cleaned_test_functions.jsonl/62881
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 931 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2204, 17, 68, 1288, 21138, 368, 341, 262, 1077, 320, 3160, 11, 5206, 2943, 29712, 62, 16, 8, 284, 6505, 32581, 2178, 8378, 8179, 29712, 7, 18, 11, 220, 16, 626, 262, 442, 279, 2943, 8433, 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_get_device_streams() { if let Some(device) = test_get_default_device(Scope::Input) { let streams = get_device_streams(device, DeviceType::INPUT).unwrap(); println!("streams on the input device: {:?}", streams); } else { println!("No input device."); } if let Some(device) = test_get_default_device(Scope::Output) { let streams = get_device_streams(device, DeviceType::OUTPUT).unwrap(); println!("streams on the output device: {:?}", streams); } else { println!("No output device."); } }
rust_cleaned_test_functions.jsonl/113822
{ "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, 9204, 74872, 368, 341, 262, 421, 1077, 4329, 17848, 8, 284, 1273, 3062, 9993, 9204, 3759, 2417, 486, 2505, 8, 341, 286, 1077, 23045, 284, 633, 9204, 74872, 17848, 11, 13903, 929, 486, 2942...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_compress_algorithm_none() { let buf = [ 0x1u8, 0x2u8, 0x3u8, 0x4u8, 0x1u8, 0x2u8, 0x3u8, 0x4u8, 0x1u8, 0x2u8, 0x3u8, 0x4u8, 0x1u8, 0x2u8, 0x3u8, 0x4u8, ]; let (compressed, _) = compress(&buf, Algorithm::None).unwrap(); assert_eq!(buf.to_vec(), compressed.to_vec()); }
rust_cleaned_test_functions.jsonl/106790
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 222 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 87845, 59531, 31488, 368, 341, 286, 1077, 6607, 284, 2278, 310, 220, 15, 87, 16, 84, 23, 11, 220, 15, 87, 17, 84, 23, 11, 220, 15, 87, 18, 84, 23, 11, 220, 15, 87, 19, 84, 23, 11, 220,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_bcs_taken_positive() { let code = vec![0xB0, 0x07]; // offset is +7. let mut nes = Cpu::new(); let mut memory = new_memory(code); nes.C = 1; nes.next(&mut memory).unwrap(); assert_eq!(0x8009, nes.PC); }
rust_cleaned_test_functions.jsonl/38701
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 150 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 880, 4837, 72933, 54160, 368, 341, 286, 1077, 2038, 284, 7486, 20703, 15, 14377, 15, 11, 220, 15, 87, 15, 22, 5265, 442, 4347, 374, 488, 22, 624, 286, 1077, 5206, 308, 288, 284, 356, 5584, 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_setup_msrs() { use hypervisor::arch::x86::msr_index; use hypervisor::x86_64::{MsrEntries, MsrEntry}; let hv = hypervisor::new().unwrap(); let vm = hv.create_vm().expect("new VM fd creation failed"); let vcpu = vm.create_vcpu(0, None).unwrap(); setup_msrs(&vcpu).unwrap(); // See create_msr_entries for details. let mut msrs = MsrEntries::from_entries(&[MsrEntry { index: msr_index::MSR_IA32_MISC_ENABLE, ..Default::default() }]) .unwrap(); // get_msrs returns the number of msrs that it succeed in reading. We only want to read 1 // in this test case scenario. let read_msrs = vcpu.get_msrs(&mut msrs).unwrap(); assert_eq!(read_msrs, 1); // Official entries that were setup when we did setup_msrs. We need to assert that the // expect. let entry_vec = hypervisor::x86_64::boot_msr_entries(); assert_eq!(entry_vec.as_slice()[9], msrs.as_slice()[0]); }
rust_cleaned_test_functions.jsonl/38425
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 500 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21363, 21416, 5428, 368, 341, 286, 990, 9751, 31396, 486, 1113, 486, 87, 23, 21, 486, 1011, 81, 3560, 280, 286, 990, 9751, 31396, 486, 87, 23, 21, 62, 21, 19, 22964, 44, 15094, 24533, 11, 38...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_output_ser_deser() { let keychain = ExtKeychain::from_random_seed(false).unwrap(); let key_id = ExtKeychain::derive_key_id(1, 1, 0, 0, 0); let switch = keychain::SwitchCommitmentType::Regular; let commit = keychain.commit(5, &key_id, switch).unwrap(); let builder = ProofBuilder::new(&keychain); let proof = proof::create(&keychain, &builder, 5, &key_id, switch, commit, None).unwrap(); let out = Output::new(OutputFeatures::Plain, commit, proof); let mut vec = vec![]; ser::serialize_default(&mut vec, &out).expect("serialized failed"); let dout: Output = ser::deserialize_default(&mut &vec[..]).unwrap(); assert_eq!(dout.features(), OutputFeatures::Plain); assert_eq!(dout.commitment(), out.commitment()); assert_eq!(dout.proof, out.proof); }
rust_cleaned_test_functions.jsonl/51629
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 283 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 7645, 75861, 15768, 261, 368, 341, 10217, 1376, 8819, 284, 9447, 1592, 8819, 486, 1499, 22644, 33809, 3576, 568, 15454, 543, 10217, 1376, 842, 284, 9447, 1592, 8819, 486, 27098, 3097, 842, 7, 16, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_sha1() { let cases = vec![ ("", "da39a3ee5e6b4b0d3255bfef95601890afd80709"), ("a", "86f7e437faa5a7fce15d1ddcb9eaeaea377667b8"), ("ab", "da23614e02469a0d7c7bd1bdab5c9c474b1904dc"), ("abc", "a9993e364706816aba3e25717850c26c9cd0d89d"), ("123", "40bd001563085fc35165329ea1ff5c5ecbdbbeef"), ]; let mut ctx = EvalContext::default(); for (input_str, exp_str) in cases { let input = datum_expr(Datum::Bytes(input_str.as_bytes().to_vec())); let op = scalar_func_expr(ScalarFuncSig::Sha1, &[input]); let op = Expression::build(&ctx, op).unwrap(); let got = op.eval(&mut ctx, &[]).unwrap(); let exp = Datum::Bytes(exp_str.as_bytes().to_vec()); assert_eq!(got, exp, "sha1('{:?}')", input_str); } // test NULL case let input = datum_expr(Datum::Null); let op = scalar_func_expr(ScalarFuncSig::Sha1, &[input]); let op = Expression::build(&ctx, op).unwrap(); let got = op.eval(&mut ctx, &[]).unwrap(); let exp = Datum::Null; assert_eq!(got, exp, "sha1(NULL)"); }
rust_cleaned_test_functions.jsonl/104206
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 649 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 48836, 16, 368, 341, 286, 1077, 5048, 284, 7486, 90515, 310, 3489, 497, 330, 3235, 18, 24, 64, 18, 2127, 20, 68, 21, 65, 19, 65, 15, 67, 18, 17, 20, 20, 13233, 823, 24, 20, 21, 15, 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_batch_response_single() { let resp = BatchResponse::Single(Response::new(Value::Boolean(true))); assert_eq!(serde_json::to_string(&resp).unwrap(), r#"{"data":true}"#); }
rust_cleaned_test_functions.jsonl/27267
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 92 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14534, 9655, 19487, 368, 341, 286, 1077, 9039, 284, 33904, 2582, 486, 10888, 47979, 486, 931, 25346, 486, 6890, 3715, 4945, 286, 2060, 10714, 10297, 47024, 9455, 486, 983, 3904, 2099, 18243, 568, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_dsym_parent_framework() { let dwarf_path = fixture("macos/Example.framework.dSYM/Contents/Resources/DWARF/Example"); let dsym_path = dwarf_path.dsym_parent().unwrap(); assert!(dsym_path.exists()); assert!(dsym_path.ends_with("macos/Example.framework.dSYM")); }
rust_cleaned_test_functions.jsonl/121783
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 140 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 814, 23802, 15960, 27565, 368, 341, 286, 1077, 49461, 2638, 284, 12507, 445, 11948, 436, 14, 13314, 20997, 950, 79234, 14, 14803, 76099, 14953, 45458, 37, 14, 13314, 797, 286, 1077, 11472, 1600, 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_give_pod_class_by_value() { let cxx = indoc! {" Bob give_bob() { Bob a; a.a = 3; a.b = 4; return a; } "}; let hdr = indoc! {" #include <cstdint> class Bob { public: uint32_t a; uint32_t b; }; Bob give_bob(); "}; let rs = quote! { assert_eq!(ffi::give_bob().b, 4); }; run_test(cxx, hdr, rs, &["give_bob"], &["Bob"]); }
rust_cleaned_test_functions.jsonl/9729
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 316 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1889, 533, 85337, 4790, 3710, 3142, 368, 341, 262, 1077, 272, 4146, 284, 1257, 509, 0, 314, 698, 286, 14261, 2968, 880, 674, 368, 341, 310, 14261, 264, 280, 310, 264, 5849, 284, 220, 18, 280, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_patch_mmds() { let vmm_shared_info = Arc::new(RwLock::new(InstanceInfo { started: false, id: "test_patch_mmds".to_string(), vmm_version: "version 0.1.0".to_string(), app_name: "app name".to_string(), })); let to_vmm_fd = EventFd::new(libc::EFD_NONBLOCK).unwrap(); let (api_request_sender, _from_api) = channel(); let (_to_api, vmm_response_receiver) = channel(); let mmds_info = Arc::new(Mutex::new(Mmds::default())); let api_server = ApiServer::new( mmds_info, vmm_shared_info, api_request_sender, vmm_response_receiver, to_vmm_fd, ) .unwrap(); // MMDS data store is not yet initialized. let response = api_server.patch_mmds(serde_json::Value::Bool(true)); assert_eq!(response.status(), StatusCode::BadRequest); let response = api_server.put_mmds(serde_json::Value::String("string".to_string())); assert_eq!(response.status(), StatusCode::NoContent); let response = api_server.patch_mmds(serde_json::Value::String( "{ \"key\" : \"value\" }".to_string(), )); assert_eq!(response.status(), StatusCode::NoContent); }
rust_cleaned_test_functions.jsonl/23177
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 628 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 39643, 717, 2277, 82, 368, 341, 286, 1077, 348, 3821, 20405, 3109, 284, 19689, 486, 931, 2785, 86, 11989, 486, 931, 7, 2523, 1731, 341, 310, 3855, 25, 895, 345, 310, 877, 25, 330, 1944, 39643,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_conn_packet() { use token; use std::net::SocketAddr; use std::str::FromStr; let protocol_id = 0xFFCC; let sequence = 0xCCDD; let pkey = crypto::generate_key(); let token = token::ConnectToken::generate( [SocketAddr::from_str("127.0.0.1:8080").unwrap()].iter().cloned(), &pkey, 30, //Expire sequence, protocol_id, 0xFFEE, //Client Id None).unwrap(); let packet = Packet::ConnectionRequest(ConnectionRequestPacket { version: NETCODE_VERSION_STRING.clone(), protocol_id: protocol_id, token_expire: token.expire_utc, sequence: sequence, private_data: token.private_data }); test_encode_decode(packet, None, Some(pkey), |p| { match p { Packet::ConnectionRequest(p) => { for i in 0..p.version.len() { assert_eq!(p.version[i], NETCODE_VERSION_STRING[i], "mismatch at index {}", i); } assert_eq!(p.protocol_id, protocol_id); assert_eq!(p.token_expire, token.expire_utc); assert_eq!(p.sequence, sequence); for i in 0..p.private_data.len() { assert_eq!(p.private_data[i], token.private_data[i]); } }, _ => assert!(false) } }); }
rust_cleaned_test_functions.jsonl/118290
{ "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, 17241, 21078, 368, 341, 262, 990, 3950, 280, 262, 990, 1460, 486, 4711, 486, 10286, 13986, 280, 262, 990, 1460, 486, 495, 486, 3830, 2580, 401, 262, 1077, 11507, 842, 284, 220, 15, 9264, 3706, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_parse_query_with_range() { test_parse_query_to_ast_helper("[1 TO 5]", "[\"1\" TO \"5\"]"); test_parse_query_to_ast_helper("foo:{a TO z}", "\"foo\":{\"a\" TO \"z\"}"); test_parse_query_to_ast_helper("foo:[1 TO toto}", "\"foo\":[\"1\" TO \"toto\"}"); test_parse_query_to_ast_helper("foo:[* TO toto}", "\"foo\":{\"*\" TO \"toto\"}"); test_parse_query_to_ast_helper("foo:[1 TO *}", "\"foo\":[\"1\" TO \"*\"}"); test_parse_query_to_ast_helper( "1.2.foo.bar:[1.1 TO *}", "\"1.2.foo.bar\":[\"1.1\" TO \"*\"}", ); test_is_parse_err("abc + "); }
rust_cleaned_test_functions.jsonl/64423
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 352 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 5738, 6615, 9698, 368, 341, 286, 1273, 21039, 5738, 2346, 48019, 10418, 10937, 16, 5146, 220, 20, 19076, 10545, 2105, 16, 2105, 5146, 7245, 20, 75104, 797, 286, 1273, 21039, 5738, 2346, 480...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_bellman_ford() { let m: Csr<(), _> = Csr::from_sorted_edges(&[ (0, 1, 0.5), (0, 2, 2.), (1, 0, 1.), (1, 1, 1.), (1, 2, 1.), (1, 3, 1.), (2, 3, 3.), (4, 5, 1.), (5, 7, 2.), (6, 7, 1.), (7, 8, 3.), ]).unwrap(); println!("{:?}", m); let result = bellman_ford(&m, 0).unwrap(); println!("{:?}", result); let answer = [0., 0.5, 1.5, 1.5]; assert_eq!(&answer, &result.0[..4]); assert!(answer[4..].iter().all(|&x| f64::is_infinite(x))); }
rust_cleaned_test_functions.jsonl/36542
{ "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, 880, 613, 1515, 761, 539, 368, 341, 286, 1077, 296, 25, 356, 15094, 68843, 716, 29, 284, 356, 15094, 486, 1499, 41277, 28026, 2099, 9640, 310, 320, 15, 11, 220, 16, 11, 220, 15, 13, 20, 1326...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_rfc3164_decode_invalid_date() { let msg = r#"Aug 36 11:15:24 testhostname appname 69 42 [origin@123 software="te\st sc\"ript" swVersion="0.0.1"] test message"#; let cfg = Config::from_string("[input]\n[input.ltsv_schema]\nformat = \"rfc3164\"\n").unwrap(); let decoder = RFC3164Decoder::new(&cfg); let res = decoder.decode(msg); assert!(res.is_err()); }
rust_cleaned_test_functions.jsonl/100809
{ "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, 1710, 8316, 18, 16, 21, 19, 15227, 31433, 4164, 368, 341, 262, 1077, 3750, 284, 435, 55543, 21872, 220, 220, 18, 21, 220, 16, 16, 25, 16, 20, 25, 17, 19, 1273, 27806, 906, 606, 220, 21, 24...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_on_external_with_same_name_as_non_terminal() { let mut grammar = build_grammar(vec![ Variable::named( "rule_0", Rule::seq(vec![Rule::non_terminal(1), Rule::non_terminal(2)]), ), Variable::named( "rule_1", Rule::seq(vec![Rule::non_terminal(2), Rule::non_terminal(2)]), ), Variable::named("rule_2", Rule::string("a")), ]); grammar.external_tokens = vec![Variable::named("rule_1", Rule::non_terminal(1))]; match extract_tokens(grammar) { Err(e) => { assert_eq!(e.to_string(), "Rule 'rule_1' cannot be used as both an external token and a non-terminal rule"); } _ => { panic!("Expected an error but got no error"); } } }
rust_cleaned_test_functions.jsonl/99764
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 482 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4096, 4470, 47432, 6615, 33574, 1269, 11898, 21637, 64309, 368, 341, 286, 1077, 5206, 31428, 284, 1936, 62, 41094, 25592, 90515, 310, 12407, 486, 30245, 1006, 394, 330, 12937, 62, 15, 756, 394, 18...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_ipv4() { assert_eq!( parse( &mut &[ // Proxy command 1u8, // Inet << 4 | Stream (1 << 4) | 1, // Length beyond this: 12 // Let's throw in a TLV with no data; 3 bytes. 0, 15, // Source IP 127, 0, 0, 1, // Destination IP 192, 168, 0, 1, // Source port 255, 255, // Destination port 1, 1, // TLV 69, 0, 0, ][..] ), Ok(ProxyHeader::Version2 { command: ProxyCommand::Proxy, transport_protocol: ProxyTransportProtocol::Stream, addresses: ProxyAddresses::Ipv4 { source: SocketAddrV4::new(Ipv4Addr::new(127, 0, 0, 1), 65535), destination: SocketAddrV4::new(Ipv4Addr::new(192, 168, 0, 1), 257), }, }) ); let mut data = Bytes::from_static( &[ // Local command 0u8, // Inet << 4 | Datagram (1 << 4) | 2, // Length beyond this: 12 0, 12, // Source IP 0, 0, 0, 0, // Destination IP 255, 255, 255, 255, // Source port 0, 0, // Destination port 255, 0, // Extra data 1, 2, 3, 4, ][..], ); assert_eq!( parse(&mut data), Ok(ProxyHeader::Version2 { command: ProxyCommand::Local, transport_protocol: ProxyTransportProtocol::Datagram, addresses: ProxyAddresses::Ipv4 { source: SocketAddrV4::new(Ipv4Addr::new(0, 0, 0, 0), 0), destination: SocketAddrV4::new(Ipv4Addr::new(255, 255, 255, 255), 255 << 8), }, }) ); assert!(data.remaining() == 4); // Consume the entire header }
rust_cleaned_test_functions.jsonl/124003
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1913 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 49378, 19, 368, 341, 286, 2060, 10714, 33673, 310, 4715, 1006, 394, 609, 6984, 609, 9640, 503, 442, 32778, 3210, 198, 503, 220, 16, 84, 23, 345, 503, 442, 758, 295, 1115, 220, 19, 760, 9203, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_writer_append() { let schema = Schema::parse_str(SCHEMA).unwrap(); let mut writer = Writer::new(&schema, Vec::new()); let mut record = Record::new(&schema).unwrap(); record.put("a", 27i64); record.put("b", "foo"); let n1 = writer.append(record.clone()).unwrap(); let n2 = writer.append(record.clone()).unwrap(); let n3 = writer.flush().unwrap(); let result = writer.into_inner().unwrap(); assert_eq!(n1 + n2 + n3, result.len()); let mut data = Vec::new(); zig_i64(27, &mut data); zig_i64(3, &mut data); data.extend(b"foo"); data.extend(data.clone()); // starts with magic assert_eq!(&result[..AVRO_OBJECT_HEADER_LEN], AVRO_OBJECT_HEADER); // ends with data and sync marker let last_data_byte = result.len() - 16; assert_eq!( &result[last_data_byte - data.len()..last_data_byte], data.as_slice() ); }
rust_cleaned_test_functions.jsonl/37659
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 491 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 28908, 26041, 368, 341, 286, 1077, 10802, 284, 12539, 486, 6400, 2895, 59461, 35839, 568, 15454, 543, 286, 1077, 5206, 6916, 284, 29404, 486, 931, 2099, 17349, 11, 11312, 486, 931, 5231, 286, 1077...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_get_set_remove_registration() { run_async_test(async { ffx_config::set((CONFIG_KEY_REGISTRATIONS, ConfigLevel::User), json!({})) .await .unwrap(); // Initially the registration does not exist. assert_eq!(get_registration("repo", "target").await.unwrap(), None); // Add the registration. let registration = RepositoryTarget { repo_name: "repo".into(), target_identifier: Some("target".into()), aliases: vec![], storage_type: None, }; set_registration("target", &registration).await.unwrap(); // Make sure it was written to the config. assert_eq!( ffx_config::get::<Value, _>(CONFIG_KEY_REGISTRATIONS).await.unwrap(), json!({ "repo": { "target": { "repo_name": "repo", "target_identifier": "target", "aliases": [], "storage_type": (), }, } }), ); // Make sure we can get the registration. assert_eq!(get_registration("repo", "target").await.unwrap(), Some(registration)); // We can't get unknown registrations. assert_eq!(get_registration("unkown", "target").await.unwrap(), None); assert_eq!(get_registration("repo", "unknown").await.unwrap(), None); // Remove the registration. remove_registration("repo", "target").await.unwrap(); assert_eq!(get_registration("repo", "target").await.unwrap(), None); }); }
rust_cleaned_test_functions.jsonl/98266
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 975 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 2602, 18193, 49101, 368, 341, 286, 1598, 28346, 4452, 18285, 341, 310, 282, 8298, 5332, 486, 746, 1188, 24652, 6600, 8064, 29503, 21792, 11, 5532, 4449, 486, 1474, 701, 2951, 0, 2306, 44194,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_interface_by_device_id() { let mut test_config = create_test_config_no_paths(); test_config.device_config = Some(build_full_config()); match test_config.get_interface_by_device_id("/dev/sys/pci/test_wan_up_id/ethernet") { Some(i) => { let intfs = &build_full_config().device.interfaces.unwrap()[1]; assert_eq!(*i, intfs.interface, "Got {:?}, Want: {:?}", *i, intfs.interface); } None => panic!("Got unexpected 'None' option"), } match test_config.get_interface_by_device_id("does_not_exist") { Some(_) => panic!("Got unexpected 'None' option"), None => (), } }
rust_cleaned_test_functions.jsonl/83809
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 352 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 20546, 3710, 9204, 842, 368, 341, 286, 1077, 5206, 1273, 5332, 284, 1855, 4452, 5332, 6536, 24152, 543, 286, 1273, 5332, 18355, 5332, 284, 4329, 43333, 16372, 5332, 1423, 286, 2432, 1273, 53...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_rocksdb_fork_iter() { let dir = TempDir::new("exonum_rocksdb1").unwrap(); let path = dir.path(); super::fork_iter(rocksdb_database(path)); }
rust_cleaned_test_functions.jsonl/12968
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 93 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 26608, 14553, 1999, 761, 669, 11723, 368, 341, 286, 1077, 5419, 284, 19944, 6184, 486, 931, 445, 327, 263, 372, 26608, 14553, 1999, 16, 1827, 15454, 543, 286, 1077, 1815, 284, 5419, 3875, 543, 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
#[test] fn test_select_3() { let mut model = Model::new(); let g_id = add_get(&mut model); let b_id = add_select(&mut model, g_id, |input| { vec![ exp::or( exp::not(exp::or( exp::lt(exp::cref(input, 0), exp::cref(input, 1)), exp::lt(exp::cref(input, 1), exp::cref(input, 2)), )), exp::and( exp::not(exp::isnull(exp::cref(input, 1))), exp::and( exp::eq(exp::cref(input, 0), exp::cref(input, 2)), exp::eq(exp::cref(input, 2), exp::cref(input, 3)), ), ), ), exp::not(exp::isnull(exp::cref(input, 3))), ] }); assert_derived_attribute(&mut model, b_id, |r#box| { HashSet::from([ cref(input(&r#box, 0), 0), cref(input(&r#box, 0), 1), cref(input(&r#box, 0), 2), cref(input(&r#box, 0), 3), ]) }); }
rust_cleaned_test_functions.jsonl/42344
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 807 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13051, 62, 18, 368, 341, 286, 1077, 5206, 1614, 284, 4903, 486, 931, 543, 286, 1077, 342, 842, 284, 912, 3062, 2099, 6984, 1614, 317, 286, 1077, 293, 842, 284, 912, 13051, 2099, 6984, 1614, 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_get_default_branch() -> Result<()> { let gh_token = env::github_token(&None::<String>)?; let branch = get_default_branch(&gh_token, "suecharo", "gh-trs", None)?; assert_eq!(branch, "main"); Ok(()) }
rust_cleaned_test_functions.jsonl/6701
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 125 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 9993, 28031, 368, 1464, 5714, 71698, 341, 286, 1077, 36124, 6458, 284, 6105, 486, 5204, 6458, 2099, 4064, 27638, 703, 9231, 37445, 286, 1077, 8870, 284, 633, 9993, 28031, 2099, 866, 6458, 11...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_byteswap() { let u = 42u32.to_variant(); assert_eq!(u.byteswap().get::<u32>().unwrap(), 704643072u32); assert_eq!(u.byteswap().byteswap().get::<u32>().unwrap(), 42u32); }
rust_cleaned_test_functions.jsonl/30227
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 118 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 12524, 21726, 368, 341, 286, 1077, 575, 284, 220, 19, 17, 84, 18, 17, 2389, 46112, 543, 286, 2060, 10714, 10297, 84, 42697, 21726, 1005, 455, 27638, 84, 18, 17, 10483, 15454, 1507, 220, 22, 15...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_tree() { let root = TreeNode::root(); let a = Rc::clone(&root).add_child("a"); let one = Rc::clone(&a).add_child("1"); let two = Rc::clone(&a).add_child("2"); let b = Rc::clone(&root).add_child("b"); assert_eq!(Vec::from(&*two.borrow()), vec!["a", "2"]); assert_eq!(Vec::from(&*one.borrow()), vec!["a", "1"]); assert_eq!(Vec::from(&*b.borrow()), vec!["b"]); // This should cause panic as root node has no value Vec::<&str>::from(&*TreeNode::root().borrow()); }
rust_cleaned_test_functions.jsonl/54758
{ "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, 11663, 368, 341, 262, 1077, 3704, 284, 17111, 486, 2888, 543, 262, 1077, 264, 284, 81463, 486, 19982, 2099, 2888, 568, 718, 17268, 445, 64, 797, 262, 1077, 825, 284, 81463, 486, 19982, 2099, 64,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_invoke_context() { const MAX_DEPTH: usize = 10; let mut program_ids = vec![]; let mut keys = vec![]; let mut pre_accounts = vec![]; let mut accounts = vec![]; for i in 0..MAX_DEPTH { program_ids.push(Pubkey::new_rand()); keys.push(Pubkey::new_rand()); accounts.push(Rc::new(RefCell::new(Account::new( i as u64, 1, &program_ids[i], )))); pre_accounts.push(PreAccount::new( &keys[i], &accounts[i].borrow(), false, true, )) } let mut invoke_context = ThisInvokeContext::new( &program_ids[0], Rent::default(), pre_accounts, vec![], None, true, ComputeBudget::default(), Rc::new(RefCell::new(Executors::default())), ); // Check call depth increases and has a limit let mut depth_reached = 1; for program_id in program_ids.iter().skip(1) { if Err(InstructionError::CallDepth) == invoke_context.push(program_id) { break; } depth_reached += 1; } assert_ne!(depth_reached, 0); assert!(depth_reached < MAX_DEPTH); // Mock each invocation for owned_index in (1..depth_reached).rev() { let not_owned_index = owned_index - 1; let metas = vec![ AccountMeta::new(keys[not_owned_index], false), AccountMeta::new(keys[owned_index], false), ]; let message = Message::new( &[Instruction::new(program_ids[owned_index], &[0_u8], metas)], None, ); // modify account owned by the program accounts[owned_index].borrow_mut().data[0] = (MAX_DEPTH + owned_index) as u8; invoke_context .verify_and_update( &message, &message.instructions[0], &accounts[not_owned_index..owned_index + 1], ) .unwrap(); assert_eq!( invoke_context.pre_accounts[owned_index].data[0], (MAX_DEPTH + owned_index) as u8 ); // modify account not owned by the program let data = accounts[not_owned_index].borrow_mut().data[0]; accounts[not_owned_index].borrow_mut().data[0] = (MAX_DEPTH + not_owned_index) as u8; assert_eq!( invoke_context.verify_and_update( &message, &message.instructions[0], &accounts[not_owned_index..owned_index + 1], ), Err(InstructionError::ExternalAccountDataModified) ); assert_eq!(invoke_context.pre_accounts[not_owned_index].data[0], data); accounts[not_owned_index].borrow_mut().data[0] = data; invoke_context.pop(); } }
rust_cleaned_test_functions.jsonl/91599
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1725 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 79779, 8467, 368, 341, 286, 733, 8334, 32644, 25, 22301, 284, 220, 16, 15, 280, 286, 1077, 5206, 2025, 8077, 284, 7486, 0, 15078, 286, 1077, 5206, 6894, 284, 7486, 0, 15078, 286, 1077, 5206, 8...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
#[test] fn test_compile_options_set_auto_bind_uniforms_true() { let mut c = Compiler::new().unwrap(); let mut options = CompileOptions::new().unwrap(); options.set_auto_bind_uniforms(true); let result = c .compile_into_spirv_assembly( UNIFORMS_NO_BINDINGS, ShaderKind::Vertex, "shader.glsl", "main", Some(&options), ) .unwrap() .as_text(); assert!(result.contains("OpDecorate %my_tex Binding 0")); assert!(result.contains("OpDecorate %my_sam Binding 1")); assert!(result.contains("OpDecorate %my_img Binding 2")); assert!(result.contains("OpDecorate %my_imbuf Binding 3")); assert!(result.contains("OpDecorate %my_ubo Binding 4")); }
rust_cleaned_test_functions.jsonl/41067
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 430 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 74170, 8743, 2602, 27740, 27461, 45066, 82, 16082, 368, 341, 286, 1077, 5206, 272, 284, 45631, 486, 931, 1005, 15454, 543, 286, 1077, 5206, 2606, 284, 54467, 3798, 486, 931, 1005, 15454, 543, 286,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_parse_opcode() { let test_cases = [ (0x00E0, ClearDisplay), (0x00EE, Return), (0x1123, Jump(0x123)), (0x2123, Call(0x123)), (0x3136, SkipEqImm(V1, 0x36)), (0x4A36, SkipNotEqImm(VA, 0x36)), (0x5560, SkipEqReg(V5, V6)), (0x6247, LoadImm(V2, 0x47)), (0x7A71, AddImm(VA, 0x71)), (0x85A0, LoadReg(V5, VA)), (0x85A1, OrReg(V5, VA)), (0x85A2, AndReg(V5, VA)), (0x85A3, XorReg(V5, VA)), (0x85A4, AddReg(V5, VA)), (0x85A5, SubReg(V5, VA)), (0x85A6, ShiftRight(V5, VA)), (0x85A7, SubN(V5, VA)), (0x85AE, ShiftLeft(V5, VA)), (0x9470, SkipNotEqReg(V4, V7)), (0xA123, LoadI(0x123)), (0xB72F, JumpV0(0x72F)), (0xCA48, Random(VA, 0x48)), (0xD737, Draw(V7, V3, 0x7)), (0xE59E, SkipKeyPressed(V5)), (0xE5A1, SkipKeyNotPressed(V5)), (0xF207, LoadDelayTimer(V2)), (0xF20A, WaitKeyPress(V2)), (0xF215, SetDelayTimer(V2)), (0xF218, SetSoundTimer(V2)), (0xF21E, AddI(V2)), (0xF229, LoadSprite(V2)), (0xF233, LoadBCD(V2)), (0xF255, SaveRegs(V2)), (0xF265, LoadRegs(V2)), ]; for (o, i) in test_cases { assert_eq!(parse_opcode(o), Some(i)); } }
rust_cleaned_test_functions.jsonl/17501
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1007 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 71319, 368, 341, 286, 1077, 1273, 41427, 284, 2278, 310, 320, 15, 87, 15, 15, 36, 15, 11, 12023, 7020, 1326, 310, 320, 15, 87, 15, 15, 7099, 11, 3411, 1326, 310, 320, 15, 87, 16, 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_start_stop() { let (c, _) = new_test_collector(); // Not started. get_collected_locks(&c, 1).unwrap_err(); stop_collecting(&c, 1).unwrap_err(); // Started. start_collecting(&c, 2).unwrap(); assert_eq!(c.concurrency_manager.max_ts(), 2.into()); get_collected_locks(&c, 2).unwrap(); stop_collecting(&c, 2).unwrap(); // Stopped. get_collected_locks(&c, 2).unwrap_err(); stop_collecting(&c, 2).unwrap_err(); // previous one. start_collecting(&c, 3).unwrap(); assert_eq!(c.concurrency_manager.max_ts(), 3.into()); get_collected_locks(&c, 3).unwrap(); get_collected_locks(&c, 4).unwrap_err(); start_collecting(&c, 4).unwrap(); assert_eq!(c.concurrency_manager.max_ts(), 4.into()); get_collected_locks(&c, 3).unwrap_err(); get_collected_locks(&c, 4).unwrap(); // Do not allow aborting previous observing with a smaller max_ts. start_collecting(&c, 3).unwrap_err(); get_collected_locks(&c, 3).unwrap_err(); get_collected_locks(&c, 4).unwrap(); // Do not allow stoping observing with a different max_ts. stop_collecting(&c, 3).unwrap_err(); stop_collecting(&c, 5).unwrap_err(); stop_collecting(&c, 4).unwrap(); }
rust_cleaned_test_functions.jsonl/15207
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 649 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4906, 19039, 368, 341, 286, 1077, 320, 66, 11, 27439, 284, 501, 4452, 10211, 27669, 543, 286, 442, 2806, 3855, 624, 286, 633, 10211, 2209, 9818, 82, 2099, 66, 11, 220, 16, 568, 15454, 9266, 54...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_out_of_range() { struct BadRng(u8); impl RngCore for BadRng { fn next_u32(&mut self) -> u32 { unimplemented!() } fn next_u64(&mut self) -> u64 { unimplemented!() } // This will set a secret key to a little over the // until it returns a valid key fn fill_bytes(&mut self, data: &mut [u8]) { let group_order: [u8; 32] = [ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xba, 0xae, 0xdc, 0xe6, 0xaf, 0x48, 0xa0, 0x3b, 0xbf, 0xd2, 0x5e, 0x8c, 0xd0, 0x36, 0x41, 0x41, ]; assert_eq!(data.len(), 32); data.copy_from_slice(&group_order[..]); data[31] = self.0; self.0 -= 1; } fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { self.fill_bytes(dest); Ok(()) } } let s = Secp256k1::new(); s.generate_keypair(&mut BadRng(0xff)); }
rust_cleaned_test_functions.jsonl/32186
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 746 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6068, 3575, 9698, 368, 341, 286, 2036, 11461, 49, 968, 8154, 23, 317, 286, 11605, 431, 968, 5386, 369, 11461, 49, 968, 341, 310, 5168, 1790, 7300, 18, 17, 2099, 6984, 656, 8, 1464, 575, 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_membership_change_configuration_promote_learner() -> Result<()> { check_membership_change_configuration((vec![1], vec![2]), (vec![1, 2], vec![])) }
rust_cleaned_test_functions.jsonl/91385
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 79 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 84635, 15947, 35726, 47877, 1272, 62, 93595, 368, 1464, 5714, 71698, 341, 286, 1779, 84635, 15947, 35726, 1188, 4083, 20703, 16, 1125, 7486, 20703, 17, 9719, 320, 4083, 20703, 16, 11, 220, 17, 112...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_save_reuse_name() { Tester::default() .set_program(Some("loaded.bas"), "content\n") .run("SAVE") .expect_program(Some("MEMORY:loaded.bas"), "content\n") .expect_prints(["Saved as MEMORY:loaded.bas"]) .expect_file("MEMORY:/loaded.bas", "content\n") .check(); }
rust_cleaned_test_functions.jsonl/112761
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 195 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15376, 1288, 810, 1269, 368, 341, 286, 76816, 486, 2258, 741, 310, 659, 746, 25096, 65405, 445, 15589, 948, 300, 3975, 330, 1796, 1699, 1138, 310, 659, 6108, 445, 66110, 1138, 310, 659, 17119, 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_edge_inserted_directed() { let mut net: Network<usize, f64> = Network::new(true); net.add_node(0); net.add_node(1); net.add_edge(0, 1, 10.0); check_network(net, 2, 1, vec![0, 1], vec![(0, 1, vec![&10.0])]); }
rust_cleaned_test_functions.jsonl/127175
{ "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, 17932, 17678, 291, 32871, 291, 368, 341, 262, 1077, 5206, 4179, 25, 8141, 90244, 11, 282, 21, 19, 29, 284, 8141, 486, 931, 3715, 626, 262, 4179, 1364, 5084, 7, 15, 317, 262, 4179, 1364, 5084, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_no_query() { check_error( "operation_name=foo&variables={}", vec![Error::from(ErrorKind::Missing).with_name("query")], false, ); }
rust_cleaned_test_functions.jsonl/24075
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 114 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6536, 5738, 368, 341, 286, 1779, 4096, 1006, 310, 330, 9262, 1269, 28, 7975, 5, 18616, 1165, 24375, 310, 7486, 20703, 1454, 486, 1499, 37396, 10629, 486, 25080, 568, 4197, 1269, 445, 1631, 899, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_max_value_two_digits() { // Given: let mut actual = Counter::from(vec![UINT_MAX, 42]); // When: actual.increment(); // Then: let expected = Counter::from(vec![UINT_MIN, 43]); assert_eq!(expected, actual); }
rust_cleaned_test_functions.jsonl/79511
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 178 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 51482, 6345, 3142, 23241, 41432, 368, 341, 310, 442, 16246, 510, 310, 1077, 5206, 5042, 284, 19735, 486, 1499, 25592, 20703, 25712, 6806, 11, 220, 19, 17, 10149, 310, 442, 3197, 510, 310, 5042, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_new_env() { let good_arg_vals = ArgVals::new(); let arg_parser = build_arg_parser(); let mut args = arg_parser.arguments().clone(); args.parse(&make_args(&good_arg_vals)).unwrap(); // This should be fine. let good_env = Env::new(&args, 0, 0).expect("This new environment should be created successfully."); let mut chroot_dir = PathBuf::from(good_arg_vals.chroot_base); chroot_dir.push(Path::new(good_arg_vals.exec_file).file_name().unwrap()); chroot_dir.push(good_arg_vals.id); chroot_dir.push("root"); assert_eq!(good_env.chroot_dir(), chroot_dir); assert_eq!(format!("{}", good_env.gid()), good_arg_vals.gid); assert_eq!(format!("{}", good_env.uid()), good_arg_vals.uid); assert_eq!(good_env.netns, good_arg_vals.netns.map(String::from)); assert!(good_env.daemonize); let another_good_arg_vals = ArgVals { netns: None, daemonize: false, ..good_arg_vals }; let arg_parser = build_arg_parser(); args = arg_parser.arguments().clone(); args.parse(&make_args(&another_good_arg_vals)).unwrap(); let another_good_env = Env::new(&args, 0, 0) .expect("This another new environment should be created successfully."); assert!(!another_good_env.daemonize); let base_invalid_arg_vals = ArgVals { daemonize: true, ..another_good_arg_vals.clone() }; let invalid_node_arg_vals = ArgVals { node: "zzz", ..base_invalid_arg_vals.clone() }; let arg_parser = build_arg_parser(); args = arg_parser.arguments().clone(); args.parse(&make_args(&invalid_node_arg_vals)).unwrap(); assert!(Env::new(&args, 0, 0).is_err()); let invalid_id_arg_vals = ArgVals { id: "/ad./sa12", ..base_invalid_arg_vals.clone() }; let arg_parser = build_arg_parser(); args = arg_parser.arguments().clone(); args.parse(&make_args(&invalid_id_arg_vals)).unwrap(); assert!(Env::new(&args, 0, 0).is_err()); let inexistent_exec_file_arg_vals = ArgVals { exec_file: "/this!/file!/should!/not!/exist!/", ..base_invalid_arg_vals.clone() }; let arg_parser = build_arg_parser(); args = arg_parser.arguments().clone(); args.parse(&make_args(&inexistent_exec_file_arg_vals)) .unwrap(); assert!(Env::new(&args, 0, 0).is_err()); let invalid_uid_arg_vals = ArgVals { uid: "zzz", ..base_invalid_arg_vals.clone() }; let arg_parser = build_arg_parser(); args = arg_parser.arguments().clone(); args.parse(&make_args(&invalid_uid_arg_vals)).unwrap(); assert!(Env::new(&args, 0, 0).is_err()); let invalid_gid_arg_vals = ArgVals { gid: "zzz", ..base_invalid_arg_vals.clone() }; let arg_parser = build_arg_parser(); args = arg_parser.arguments().clone(); args.parse(&make_args(&invalid_gid_arg_vals)).unwrap(); assert!(Env::new(&args, 0, 0).is_err()); }
rust_cleaned_test_functions.jsonl/24733
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1596 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5921, 15879, 368, 341, 286, 1077, 1661, 6057, 29550, 284, 7638, 52452, 486, 931, 543, 286, 1077, 1392, 18517, 284, 1936, 6057, 18517, 543, 286, 1077, 5206, 2827, 284, 1392, 18517, 52415, 1005, 199...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_repr_parse_valid() { let header = Header::new_unchecked(&BYTES_HEADER_MORE_FRAG); let repr = Repr::parse(&header).unwrap(); assert_eq!(repr, Repr{ next_header: Protocol::Tcp, frag_offset: 0, more_frags: true, ident: 12345 }); let header = Header::new_unchecked(&BYTES_HEADER_LAST_FRAG); let repr = Repr::parse(&header).unwrap(); assert_eq!(repr, Repr{ next_header: Protocol::Tcp, frag_offset: 320, more_frags: false, ident: 67890 }); }
rust_cleaned_test_functions.jsonl/22425
{ "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, 68535, 21039, 8337, 368, 341, 286, 1077, 4247, 284, 12104, 486, 931, 4907, 7549, 2099, 97849, 20330, 75131, 14220, 1890, 317, 286, 1077, 30636, 284, 1032, 649, 486, 6400, 2099, 2708, 568, 15454, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_reads_shorter_than_guides_ok() { let tempdir = TempDir::new().unwrap(); // Write the library to disk let library = test_library(); let library_path = tempdir.path().join("library.txt"); let mut lib_lines = vec!["guide\tbases\tgene".to_string()]; for guide in library.guides.iter() { lib_lines.push(format!("{}\t{}\t{}", guide.id, guide.bases_str, guide.gene)); } Io::default().write_lines(&library_path, &lib_lines).unwrap(); // Generate a fastq of reads to count let mut reads = vec![]; reads.push("A".to_string()); reads.push("AC".to_string()); reads.push("ACG".to_string()); reads.push("ACGT".to_string()); reads.push("ACGTA".to_string()); reads.push("ACGTAC".to_string()); reads.push("ACGTACG".to_string()); reads.push("ACGTACGT".to_string()); reads.push("ACGTACGTA".to_string()); reads.push("ACGTACGTAC".to_string()); for _ in 0..100 { for guide in library.guides.iter() { for _ in 0..=guide.index { reads.push(format!("ttttt{}ggggg", guide.bases_str)); } } } // Lastly create some reads that are longer than a guide length but shorter than // guide-length + max prefix reads.push("tttttACGTACGT".to_string()); reads.push("tttttACGTACGTA".to_string()); reads.push("tttttACGTACGTAC".to_string()); let fastq = write_fastq(&reads, tempdir.path().join("in.fastq")); // Run the count command let prefix = tempdir.path().join("out").to_str().unwrap().to_string(); let counts = tempdir.path().join("out.counts.txt"); let stats = tempdir.path().join("out.stats.txt"); let cmd = Count { library: library_path, input: vec![fastq], essential_genes: None, nonessential_genes: None, control_guides: None, control_pattern: None, samples: vec!["sample1".to_string()], output: prefix, exact_match: false, offset_min_fraction: 0.005, offset_sample_size: 100000, }; cmd.execute().unwrap(); assert!(counts.exists()); assert!(stats.exists()); }
rust_cleaned_test_functions.jsonl/75183
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1151 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 66628, 16673, 261, 51613, 43756, 288, 19817, 368, 341, 286, 1077, 2730, 3741, 284, 19944, 6184, 486, 931, 1005, 15454, 1428, 286, 442, 9645, 279, 6733, 311, 13364, 198, 286, 1077, 6733, 284, 1273,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
#[test] fn test_not_existing_source() { let tmp_dir = TempDir::new().expect("failed to make tempdir"); let err = Exporter::new( PathBuf::from("tests/testdata/no-such-file.md"), tmp_dir.path().to_path_buf(), ) .run() .unwrap_err(); match err { ExportError::PathDoesNotExist { path: _ } => {} _ => panic!("Wrong error variant: {:?}", err), } }
rust_cleaned_test_functions.jsonl/116598
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 186 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 7913, 62630, 10347, 368, 341, 262, 1077, 4174, 4334, 284, 19944, 6184, 486, 931, 1005, 17119, 445, 16091, 311, 1281, 2730, 3741, 3071, 262, 1077, 1848, 284, 22191, 261, 486, 931, 1006, 286, 7933, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_tcp_stream_ipv4() { use trust_dns_proto::tests::tcp_stream_test; let exec = FuchsiaExec::new().expect("failed to create fuchsia executor"); tcp_stream_test::<DnsTcpStream, FuchsiaExec, FuchsiaTime>(ip!("127.0.0.1"), exec) }
rust_cleaned_test_functions.jsonl/70344
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 129 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 45562, 12673, 49378, 19, 368, 341, 286, 990, 6950, 71125, 37689, 486, 23841, 486, 27161, 12673, 4452, 280, 286, 1077, 3883, 284, 434, 73391, 10216, 486, 931, 1005, 17119, 445, 16091, 311, 1855, 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_build_listen_all_query_with_multiple_channels() { let output = build_listen_all_query(&["channel.0", "channel.1"]); assert_eq!(output.as_str(), r#"LISTEN "channel.0";LISTEN "channel.1";"#); }
rust_cleaned_test_functions.jsonl/65324
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 95 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 20801, 79286, 5705, 5738, 6615, 45233, 19291, 368, 341, 262, 1077, 2550, 284, 1936, 79286, 5705, 5738, 2099, 1183, 10119, 13, 15, 497, 330, 10119, 13, 16, 15049, 262, 2060, 10714, 10297, 3006, 535...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_reset() { let mut stoch = SlowStochastic::new(3, 2).unwrap(); assert_eq!(stoch.nexta(10.0), 50.0); assert_eq!(stoch.nexta(50.0).round(), 83.0); assert_eq!(stoch.nexta(50.0).round(), 94.0); stoch.reset(); assert_eq!(stoch.nexta(10.0), 50.0); }
rust_cleaned_test_functions.jsonl/87186
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 174 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 18983, 368, 341, 286, 1077, 5206, 357, 4953, 284, 38147, 623, 65954, 486, 931, 7, 18, 11, 220, 17, 568, 15454, 543, 286, 2060, 10714, 10297, 267, 4953, 4529, 64, 7, 16, 15, 13, 15, 701, 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_pass_thru_rust_reference() { let hdr = indoc! {" #include <cstdint> struct RustType; inline const RustType& pass_rust_reference(const RustType& a) { return a; } "}; let rs = quote! { let foo = RustType(3); assert_eq!(ffi::pass_rust_reference(&foo).0, 3); }; run_test_ex( "", hdr, rs, quote! { generate!("pass_rust_reference") extern_rust_type!(RustType) }, None, None, Some(quote! { pub struct RustType(i32); }), ); }
rust_cleaned_test_functions.jsonl/9933
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 333 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15464, 5854, 2672, 1710, 590, 25433, 368, 341, 262, 1077, 36615, 284, 1257, 509, 0, 314, 698, 262, 671, 997, 366, 96975, 1339, 262, 2036, 33789, 929, 280, 262, 7381, 733, 33789, 929, 5, 1494, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_from_i64() { let cs: Vec<(i64, i8, Result<Duration>, bool)> = vec![ // UNSPECIFIED_FSP ( 8385959, UNSPECIFIED_FSP as i8, Ok(Duration::parse(b"838:59:59", 0).unwrap()), false, ), ( 101010, 0, Ok(Duration::parse(b"10:10:10", 0).unwrap()), false, ), ( 101010, 5, Ok(Duration::parse(b"10:10:10", 5).unwrap()), false, ), ( 8385959, 0, Ok(Duration::parse(b"838:59:59", 0).unwrap()), false, ), ( 8385959, 6, Ok(Duration::parse(b"838:59:59", 6).unwrap()), false, ), ( -101010, 0, Ok(Duration::parse(b"-10:10:10", 0).unwrap()), false, ), ( -101010, 5, Ok(Duration::parse(b"-10:10:10", 5).unwrap()), false, ), ( -8385959, 0, Ok(Duration::parse(b"-838:59:59", 0).unwrap()), false, ), ( -8385959, 6, Ok(Duration::parse(b"-838:59:59", 6).unwrap()), false, ), // will overflow ( 8385960, 0, Ok(Duration::parse(b"838:59:59", 0).unwrap()), true, ), ( 8385960, 1, Ok(Duration::parse(b"838:59:59", 1).unwrap()), true, ), ( 8385960, 5, Ok(Duration::parse(b"838:59:59", 5).unwrap()), true, ), ( 8385960, 6, Ok(Duration::parse(b"838:59:59", 6).unwrap()), true, ), ( -8385960, 0, Ok(Duration::parse(b"-838:59:59", 0).unwrap()), true, ), ( -8385960, 1, Ok(Duration::parse(b"-838:59:59", 1).unwrap()), true, ), ( -8385960, 5, Ok(Duration::parse(b"-838:59:59", 5).unwrap()), true, ), ( -8385960, 6, Ok(Duration::parse(b"-838:59:59", 6).unwrap()), true, ), // will truncated (8376049, 0, Err(Error::truncated_wrong_val("", "")), false), (8375960, 0, Err(Error::truncated_wrong_val("", "")), false), (8376049, 0, Err(Error::truncated_wrong_val("", "")), false), ( 10000000000, 0, Ok(Duration::new_from_parts(false, 0, 0, 0, 0, 0).unwrap()), false, ), ( 10000235959, 0, Ok(Duration::new_from_parts(false, 23, 59, 59, 0, 0).unwrap()), false, ), ( -10000235959, 0, Ok(Duration::new_from_parts( true, MAX_HOUR_PART, MAX_MINUTE_PART, MAX_SECOND_PART, 0, 0, ) .unwrap()), false, ), ]; for (input, fsp, expect, overflow) in cs { let cfg = Arc::new(EvalConfig::from_flag(Flag::OVERFLOW_AS_WARNING)); let mut ctx = EvalContext::new(cfg); let r = Duration::from_i64(&mut ctx, input, fsp); let expect_str = if expect.is_ok() { format!("{}", expect.as_ref().unwrap()) } else { format!("{:?}", &expect) }; let result_str = if r.is_ok() { format!("{}", r.as_ref().unwrap()) } else { format!("{:?}", &r) }; let log = format!( "input: {}, fsp: {}, expect: {}, output: {}", input, fsp, expect_str, result_str ); assert_eq!(r.is_ok(), expect.is_ok(), "{}", log.as_str()); if let Ok(r) = r { assert_eq!(r, expect.unwrap(), "{}", log.as_str()); } else { let e = r.err().unwrap(); let e2 = expect.err().unwrap(); assert_eq!(e.code(), e2.code(), "{}", log.as_str()); } if overflow { assert_eq!(ctx.warnings.warning_cnt, 1, "{}", log.as_str()); assert_eq!( ctx.warnings.warnings[0].get_code(), ERR_DATA_OUT_OF_RANGE, "{}", log.as_str() ); } } }
rust_cleaned_test_functions.jsonl/130041
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 3708 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5673, 5318, 21, 19, 368, 341, 286, 1077, 10532, 25, 11312, 28706, 72, 21, 19, 11, 600, 23, 11, 5714, 27, 12945, 8066, 1807, 16018, 284, 7486, 90515, 3374, 310, 442, 45983, 10943, 27320, 1400, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_pragma() { let s = to_chars("pragma"); let cur = &mut 0; expect_next_token(&s, cur, Token::Pragma); }
rust_cleaned_test_functions.jsonl/21080
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 83 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 620, 4101, 1728, 368, 341, 286, 1077, 274, 284, 311, 37418, 445, 6015, 797, 286, 1077, 2847, 284, 609, 6984, 220, 15, 280, 286, 1720, 11257, 6458, 2099, 82, 11, 2847, 11, 9660, 486, 93018, 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
#[test] fn test_sigmoid_derivative() { fn f(x: f32) -> f32 { let y = 1.0 / (1.0 + x.exp()); y * (1.0 - y) } let activation = Activation::Sigmoid; assert_eq!( activation.calculate_derivative(&array![[0.0]]).unwrap(), &array![[f(0.0)]] ); assert_eq!( activation .calculate_derivative(&array![[0.0, 1.0]]) .unwrap(), &array![[f(0.0), f(1.0)]] ); assert_eq!( activation .calculate_derivative(&array![[0.0], [1.0]]) .unwrap(), &array![[f(0.0)], [f(1.0)]] ); assert_eq!( activation .calculate_derivative(&array![[0.0, 1.0], [2.0, 3.0]]) .unwrap(), &array![[f(0.0), f(1.0)], [f(2.0), f(3.0)]] ); }
rust_cleaned_test_functions.jsonl/65372
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 591 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 643, 52111, 95930, 368, 341, 286, 5168, 282, 2075, 25, 282, 18, 17, 8, 1464, 282, 18, 17, 341, 310, 1077, 379, 284, 220, 16, 13, 15, 608, 320, 16, 13, 15, 488, 856, 13754, 1423, 310, 379, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_unsupported_anysegwit_upfront_shutdown_script() { let chanmon_cfgs = create_chanmon_cfgs(2); let node_cfgs = create_node_cfgs(2, &chanmon_cfgs); let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]); let nodes = create_network(2, &node_cfgs, &node_chanmgrs); // Use a non-v0 segwit script supported by option_shutdown_anysegwit let node_features = InitFeatures::known().clear_shutdown_anysegwit(); let anysegwit_shutdown_script = Builder::new() .push_int(16) .push_slice(&[0, 40]) .into_script(); // Check script when handling an open_channel message nodes[0].node.create_channel(nodes[1].node.get_our_node_id(), 100000, 10001, 42, None).unwrap(); let mut open_channel = get_event_msg!(nodes[0], MessageSendEvent::SendOpenChannel, nodes[1].node.get_our_node_id()); open_channel.shutdown_scriptpubkey = Present(anysegwit_shutdown_script.clone()); nodes[1].node.handle_open_channel(&nodes[0].node.get_our_node_id(), node_features.clone(), &open_channel); let events = nodes[1].node.get_and_clear_pending_msg_events(); assert_eq!(events.len(), 1); match events[0] { MessageSendEvent::HandleError { action: ErrorAction::SendErrorMessage { ref msg }, node_id } => { assert_eq!(node_id, nodes[0].node.get_our_node_id()); assert_eq!(msg.data, "Peer is signaling upfront_shutdown but has provided an unacceptable scriptpubkey format: Script(OP_PUSHNUM_16 OP_PUSHBYTES_2 0028)"); }, _ => panic!("Unexpected event"), } // Check script when handling an accept_channel message nodes[0].node.create_channel(nodes[1].node.get_our_node_id(), 100000, 10001, 42, None).unwrap(); let open_channel = get_event_msg!(nodes[0], MessageSendEvent::SendOpenChannel, nodes[1].node.get_our_node_id()); nodes[1].node.handle_open_channel(&nodes[0].node.get_our_node_id(), InitFeatures::known(), &open_channel); let mut accept_channel = get_event_msg!(nodes[1], MessageSendEvent::SendAcceptChannel, nodes[0].node.get_our_node_id()); accept_channel.shutdown_scriptpubkey = Present(anysegwit_shutdown_script.clone()); nodes[0].node.handle_accept_channel(&nodes[1].node.get_our_node_id(), node_features, &accept_channel); let events = nodes[0].node.get_and_clear_pending_msg_events(); assert_eq!(events.len(), 1); match events[0] { MessageSendEvent::HandleError { action: ErrorAction::SendErrorMessage { ref msg }, node_id } => { assert_eq!(node_id, nodes[1].node.get_our_node_id()); assert_eq!(msg.data, "Peer is signaling upfront_shutdown but has provided an unacceptable scriptpubkey format: Script(OP_PUSHNUM_16 OP_PUSHBYTES_2 0028)"); }, _ => panic!("Unexpected event"), } check_closed_event!(nodes[0], 1, ClosureReason::ProcessingError { err: "Peer is signaling upfront_shutdown but has provided an unacceptable scriptpubkey format: Script(OP_PUSHNUM_16 OP_PUSHBYTES_2 0028)".to_string() }); }
rust_cleaned_test_functions.jsonl/6683
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1052 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4907, 18216, 37248, 14607, 88519, 8237, 6951, 54804, 14660, 368, 341, 10217, 26023, 1645, 18343, 82, 284, 1855, 45552, 1645, 18343, 82, 7, 17, 317, 10217, 2436, 18343, 82, 284, 1855, 5084, 18343, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_multipart_encrypted() { let text = "From: Alice Lovelace <alice@openpgp.example> To: Bob Babbage <bob@openpgp.example> Subject: Encrypted message MIME-Version: 1.0 Content-Type: multipart/encrypted; protocol=\"application/pgp-encrypted\"; boundary=\"boundary_encrypted\" This is an OpenPGP/MIME encrypted message (RFC 4880 and 3156) --boundary_encrypted Content-Type: application/pgp-encrypted Content-Description: PGP/MIME version identification Version: 1 --boundary_encrypted Content-Type: application/octet-stream; name=\"encrypted.asc\" Content-Description: OpenPGP encrypted message Content-Disposition: inline; filename=\"encrypted.asc\" -----BEGIN PGP MESSAGE----- -----END PGP MESSAGE----- --boundary_encrypted--"; let mime = MimeMessage::parse(text).unwrap(); assert_eq!(mime.message_type.unwrap(), MimeMultipartType::Encrypted); assert_eq!(mime.headers.len(), 5); assert_eq!(mime.body, "This is an OpenPGP/MIME encrypted message \ (RFC 4880 and 3156)\n"); assert_eq!(mime.children.len(), 2); assert_eq!(mime.children[1].body, "-----BEGIN PGP MESSAGE-----\n\ -----END PGP MESSAGE-----\n\n--boundary_encrypted--"); // XXX: parse add extra new lines. assert_eq!(mime.children[0].body, "Version: 1\n\n"); assert_eq!(mime.boundary, "boundary_encrypted"); let mime2 = MimeMessage::parse(&mime.as_string()).unwrap(); assert_eq!(format!("{}\r\n", mime.body), mime2.body); assert_eq!(mime.boundary, mime2.boundary); assert_eq!(mime.message_type, mime2.message_type); let ct: String = mime.headers.get("Content-Type".to_string()) .unwrap().get_value().unwrap(); assert_eq!(ct, "multipart/encrypted; \ protocol=\"application/pgp-encrypted\";\ boundary=\"boundary_encrypted\""); // XXX: the space after `multipart` gets removed. let ct2: String = mime2.headers.get("Content-Type".to_string()) .unwrap().get_value().unwrap(); assert_eq!(ct2, "multipart/encrypted;\ protocol=\"application/pgp-encrypted\";\ boundary=\"boundary_encrypted\""); assert_eq!(format!("{}\r\n\r\n", mime.children[0].body), mime2.children[0].body); assert_eq!(mime.children[1].body, format!("{}--boundary_encrypted--", mime2.children[1].body)); }
rust_cleaned_test_functions.jsonl/112551
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1166 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 717, 18204, 13781, 14026, 368, 341, 286, 1077, 1467, 284, 330, 3830, 25, 29405, 34293, 301, 578, 366, 63195, 31, 2508, 3517, 79, 7724, 397, 1249, 25, 14261, 425, 56489, 366, 47086, 31, 2508, 351...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_from_vec() { let vec = vec![]; let small_vec: SmallVec<[u8; 3]> = SmallVec::from_vec(vec); assert_eq!(&*small_vec, &[]); drop(small_vec); let vec = vec![]; let small_vec: SmallVec<[u8; 1]> = SmallVec::from_vec(vec); assert_eq!(&*small_vec, &[]); drop(small_vec); let vec = vec![1]; let small_vec: SmallVec<[u8; 3]> = SmallVec::from_vec(vec); assert_eq!(&*small_vec, &[1]); drop(small_vec); let vec = vec![1, 2, 3]; let small_vec: SmallVec<[u8; 3]> = SmallVec::from_vec(vec); assert_eq!(&*small_vec, &[1, 2, 3]); drop(small_vec); let vec = vec![1, 2, 3, 4, 5]; let small_vec: SmallVec<[u8; 3]> = SmallVec::from_vec(vec); assert_eq!(&*small_vec, &[1, 2, 3, 4, 5]); drop(small_vec); let vec = vec![1, 2, 3, 4, 5]; let small_vec: SmallVec<[u8; 1]> = SmallVec::from_vec(vec); assert_eq!(&*small_vec, &[1, 2, 3, 4, 5]); drop(small_vec); }
rust_cleaned_test_functions.jsonl/88172
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 582 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5673, 13251, 368, 341, 286, 1077, 7486, 284, 7486, 0, 15078, 286, 1077, 2613, 13251, 25, 14994, 10050, 66746, 84, 23, 26, 220, 18, 25669, 284, 14994, 10050, 486, 1499, 13251, 25592, 317, 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_augmentation_parse_P() { let bases = Default::default(); let address_size = 8; let rest = [9, 8, 7, 6, 5, 4, 3, 2, 1]; let section = Section::with_endian(Endian::Little) .uleb(9) .D8(constants::DW_EH_PE_udata8.0) .L64(0xf00d_f00d) .append_bytes(&rest) .get_contents() .unwrap(); let section = EhFrame::new(&section, LittleEndian); let input = &mut section.section().clone(); let aug_str = &mut EndianSlice::new(b"zP", LittleEndian); let mut augmentation = Augmentation::default(); augmentation.personality = Some((constants::DW_EH_PE_udata8, Pointer::Direct(0xf00d_f00d))); assert_eq!( Augmentation::parse(aug_str, &bases, address_size, &section, input), Ok(augmentation) ); assert_eq!(*input, EndianSlice::new(&rest, LittleEndian)); }
rust_cleaned_test_functions.jsonl/9391
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 474 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 60411, 31099, 21039, 1088, 368, 341, 286, 1077, 23092, 284, 7899, 486, 2258, 543, 286, 1077, 2621, 2368, 284, 220, 23, 280, 286, 1077, 2732, 284, 508, 24, 11, 220, 23, 11, 220, 22, 11, 220, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_execute_block_response_roundtrip() { with_stack_size(4 * 1024 * 1024, || { proptest!(|(execute_block_response in any::<ExecuteBlockResponse>())| { assert_protobuf_encode_decode(&execute_block_response); }) }) .unwrap(); }
rust_cleaned_test_functions.jsonl/59561
{ "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, 44329, 7113, 9655, 29896, 32981, 368, 341, 262, 448, 15528, 2368, 7, 19, 353, 220, 16, 15, 17, 19, 353, 220, 16, 15, 17, 19, 11, 1369, 341, 286, 462, 70334, 10297, 60016, 10257, 7113, 9655, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_load() { let a = ["1234567890123456789012345678901234567890"]; let b = ["ABCD", "EFGH", "IJKL", "MNOP", "QRST", "UVWX", "YZ"]; let atxt = gen_texts(&a); let btxt = gen_texts(&b); let mut pane = gen_pane!(OpenOptions::new().write(true).open("/dev/null").unwrap()); let width: u16 = 2; let height: u16 = 5; pane.replace_termsize_getter(Box::new(TestTerminal::new(width, height))); pane.load(atxt.clone()); assert_eq!(pane.position(), (0, 0)); assert_eq!(pane.linebuf.borrow().len(), atxt.borrow().len()); pane.scroll_right(&ScrollStep::Char(1)).unwrap(); assert_eq!(pane.position(), (1, 0)); pane.load(btxt.clone()); assert_eq!(pane.position(), (0, 0)); assert_eq!(pane.linebuf.borrow().len(), btxt.borrow().len()); }
rust_cleaned_test_functions.jsonl/1686
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 429 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 12411, 368, 341, 286, 1077, 264, 284, 4383, 16, 17, 18, 19, 20, 21, 22, 23, 24, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 15, 16, 17, 18, 19, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_mktemp_mktemp() { let scene = TestScenario::new(util_name!()); let pathname = scene.fixtures.as_string(); scene .ucmd() .env(TMPDIR, &pathname) .arg(TEST_TEMPLATE1) .succeeds(); scene .ucmd() .env(TMPDIR, &pathname) .arg(TEST_TEMPLATE2) .fails(); scene .ucmd() .env(TMPDIR, &pathname) .arg(TEST_TEMPLATE3) .fails(); scene .ucmd() .env(TMPDIR, &pathname) .arg(TEST_TEMPLATE4) .fails(); scene .ucmd() .env(TMPDIR, &pathname) .arg(TEST_TEMPLATE5) .succeeds(); scene .ucmd() .env(TMPDIR, &pathname) .arg(TEST_TEMPLATE6) .succeeds(); scene .ucmd() .env(TMPDIR, &pathname) .arg(TEST_TEMPLATE7) .succeeds(); scene .ucmd() .env(TMPDIR, &pathname) .arg(TEST_TEMPLATE8) .fails(); }
rust_cleaned_test_functions.jsonl/38026
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 610 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 64861, 3888, 64861, 3888, 368, 341, 262, 1077, 6109, 284, 3393, 54031, 486, 931, 67811, 1269, 0, 5231, 262, 1077, 39683, 284, 6109, 67785, 18513, 5357, 3904, 1428, 262, 6109, 198, 286, 659, 1754, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_mindroid() { let t = "I/Runtime: Mindroid runtime system node id: 1"; let p = MindroidParser {}; let r = p.try_parse_str(t).unwrap(); assert_eq!(r.level, Level::Info); assert_eq!(r.tag, "Runtime"); assert_eq!(r.process, ""); assert_eq!(r.thread, ""); assert_eq!(r.message, "Mindroid runtime system node id: 1"); let t = "D/ServiceManager(000000000000000C): foo bar"; let r = p.try_parse_str(t).unwrap(); assert_eq!(r.level, Level::Debug); assert_eq!(r.tag, "ServiceManager"); assert_eq!(r.process, "000000000000000C"); assert_eq!(r.thread, ""); assert_eq!(r.message, "foo bar"); let t = "D/ServiceManager(0x123): Service MediaPlayer has been created in process main"; let r = p.try_parse_str(t).unwrap(); assert_eq!(r.level, Level::Debug); assert_eq!(r.tag, "ServiceManager"); assert_eq!(r.process, "123"); assert_eq!(r.thread, ""); assert_eq!( r.message, "Service MediaPlayer has been created in process main" ); let t = "D/ServiceManager(0xabc): Service MediaPlayer has been created in process main"; let r = p.try_parse_str(t).unwrap(); assert_eq!(r.process, "abc"); let t = "2017-03-25 19:11:19.052 0x3b7fe700 D SomeThing: Parsing IPV6 address \ fd53:7cb8:383:4:0:0:0:68"; let r = p.try_parse_str(t).unwrap(); assert_eq!(r.level, Level::Debug); assert_eq!(r.tag, "SomeThing"); assert_eq!(r.process, "3b7fe700"); assert_eq!(r.thread, ""); assert_eq!(r.message, "Parsing IPV6 address fd53:7cb8:383:4:0:0:0:68"); let t = "2017-03-25 19:11:19.052 0x3b7fe700 D SomeThing:"; let r = p.try_parse_str(t).unwrap(); assert_eq!(r.message, ""); }
rust_cleaned_test_functions.jsonl/53438
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 780 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 717, 484, 1577, 368, 341, 262, 1077, 259, 284, 330, 40, 82636, 25, 22904, 1577, 15592, 1849, 2436, 877, 25, 220, 16, 876, 262, 1077, 281, 284, 22904, 1577, 6570, 9321, 262, 1077, 435, 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_one_node_renew_lease() { let count = 1; let mut cluster = new_node_cluster(0, count); test_renew_lease(&mut cluster); }
rust_cleaned_test_functions.jsonl/108455
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 68 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11667, 5084, 1288, 931, 62, 1623, 368, 341, 262, 1077, 1760, 284, 220, 16, 280, 262, 1077, 5206, 10652, 284, 501, 5084, 28441, 7, 15, 11, 1760, 317, 262, 1273, 1288, 931, 62, 1623, 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
#[test] fn test_function_abbr() { let formatter = Formatter::new(); // tests with functions { let test_metadata = test::MetadataProvider::new(HashMap::new()); { let expression = formatter.parser().parse("$abbr(hello world)").unwrap(); let s = expression.apply(&test_metadata); assert_eq!("hw", s.to_string().as_str()); } { let expression = formatter .parser() .parse("$abbr('Hunting & Gathering (Cydonia)')") .unwrap(); let s = expression.apply(&test_metadata); assert_eq!("H&GC", s.to_string().as_str()); } { let expression = formatter .parser() .parse("$abbr('21st Century Schizoid Man (including Mirrors)')") .unwrap(); let s = expression.apply(&test_metadata); assert_eq!("2CSMiM", s.to_string().as_str()); } } }
rust_cleaned_test_functions.jsonl/35266
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 510 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9174, 22885, 1323, 368, 341, 262, 1077, 24814, 284, 81387, 486, 931, 543, 262, 442, 7032, 448, 5746, 198, 262, 341, 286, 1077, 1273, 22220, 284, 1273, 486, 14610, 5179, 486, 931, 7, 18497, 486, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_fr_from_str() { let f100_from_repr = Fr::from(BigInteger([0x64, 0, 0, 0])); let f100 = Fr::from_str("100").unwrap(); assert_eq!(f100_from_repr, f100); }
rust_cleaned_test_functions.jsonl/81835
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 93 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 41537, 5673, 2895, 368, 341, 262, 1077, 282, 16, 15, 15, 5673, 68535, 284, 2869, 486, 1499, 91756, 2561, 15, 87, 21, 19, 11, 220, 15, 11, 220, 15, 11, 220, 15, 14382, 262, 1077, 282, 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...
1