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_counting_sort() { let mut arr: Vec<i32> = vec![1, 3, 2, 4, 4, 2, 1]; assert_eq!(counting_sort(&mut arr, 4), [1, 1, 2, 2, 3, 4, 4]); }
rust_cleaned_test_functions.jsonl/132683
{ "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, 3180, 287, 18435, 368, 341, 220, 1077, 5206, 2890, 25, 11312, 21897, 18, 17, 29, 284, 7486, 20703, 16, 11, 220, 18, 11, 220, 17, 11, 220, 19, 11, 220, 19, 11, 220, 17, 11, 220, 16, 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...
1
#[test] fn test_std_rng_reseed() { let s = task_rng().gen_iter::<uint>().take(256).collect::<Vec<uint>>(); let mut r: StdRng = SeedableRng::from_seed(s.as_slice()); let string1 = r.gen_ascii_chars().take(100).collect::<String>(); r.reseed(s.as_slice()); let string2 = r.gen_ascii_chars().take(100).collect::<String>(); assert_eq!(string1, string2); }
rust_cleaned_test_functions.jsonl/23768
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 201 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15656, 66849, 1288, 22602, 368, 341, 286, 1077, 274, 284, 3383, 66849, 1005, 4370, 11723, 27638, 2496, 10483, 22769, 7, 17, 20, 21, 568, 17384, 27638, 10050, 16434, 37038, 286, 1077, 5206, 435, 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_snippet_generator_term_score() { let mut schema_builder = Schema::builder(); let text_field = schema_builder.add_text_field("text", TEXT); let schema = schema_builder.build(); let index = Index::create_in_ram(schema); { // writing the segment let mut index_writer = index.writer_for_tests().unwrap(); index_writer.add_document(doc!(text_field => "a")); index_writer.add_document(doc!(text_field => "a")); index_writer.add_document(doc!(text_field => "a b")); index_writer.commit().unwrap(); } let searcher = index.reader().unwrap().searcher(); let query_parser = QueryParser::for_index(&index, vec![text_field]); { let query = query_parser.parse_query("e").unwrap(); let snippet_generator = SnippetGenerator::create(&searcher, &*query, text_field).unwrap(); assert!(snippet_generator.terms_text().is_empty()); } { let query = query_parser.parse_query("a").unwrap(); let snippet_generator = SnippetGenerator::create(&searcher, &*query, text_field).unwrap(); assert_eq!( &btreemap!("a".to_string() => 0.25), snippet_generator.terms_text() ); } { let query = query_parser.parse_query("a b").unwrap(); let snippet_generator = SnippetGenerator::create(&searcher, &*query, text_field).unwrap(); assert_eq!( &btreemap!("a".to_string() => 0.25, "b".to_string() => 0.5), snippet_generator.terms_text() ); } { let query = query_parser.parse_query("a b c").unwrap(); let snippet_generator = SnippetGenerator::create(&searcher, &*query, text_field).unwrap(); assert_eq!( &btreemap!("a".to_string() => 0.25, "b".to_string() => 0.5), snippet_generator.terms_text() ); } }
rust_cleaned_test_functions.jsonl/610
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1082 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 28022, 21581, 25813, 17464, 10405, 368, 341, 286, 1077, 5206, 10802, 28532, 284, 12539, 486, 17850, 543, 286, 1077, 1467, 5013, 284, 10802, 28532, 1364, 4326, 5013, 445, 1318, 497, 15762, 317, 286, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_incorrect_file_descriptor() { let msg = r#" message Foo {} dfgdg "#; let err = FileDescriptor::parse(msg).err().expect("err"); assert_eq!(4, err.line); }
rust_cleaned_test_functions.jsonl/70463
{ "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, 1243, 19928, 2458, 33774, 368, 341, 286, 1077, 3750, 284, 435, 2, 698, 310, 1943, 33428, 10086, 310, 294, 4817, 35138, 198, 286, 5869, 401, 286, 1077, 1848, 284, 2887, 11709, 486, 6400, 8119, 56...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_to_list() -> Result<()> { let s = Series::new("a", &[1, 2, 3]); let mut builder = get_list_builder(s.dtype(), s.len(), 1, s.name()); builder.append_series(&s); let expected = builder.finish(); let out = s.to_list()?; assert!(expected.into_series().series_equal(&out.into_series())); Ok(()) }
rust_cleaned_test_functions.jsonl/55644
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 177 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2346, 2019, 368, 1464, 5714, 71698, 341, 286, 1077, 274, 284, 11131, 486, 931, 445, 64, 497, 44590, 16, 11, 220, 17, 11, 220, 18, 10149, 286, 1077, 5206, 7363, 284, 633, 2019, 28532, 1141, 457...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_signed_int_to_string() { let pos_int = ast::LitInt(42, ast::SignedIntLit(ast::TyI32, ast::Plus)); let neg_int = ast::LitInt((!42 + 1) as u64, ast::SignedIntLit(ast::TyI32, ast::Minus)); assert_eq!(format!("-{}", lit_to_string(&codemap::dummy_spanned(pos_int))), lit_to_string(&codemap::dummy_spanned(neg_int))); }
rust_cleaned_test_functions.jsonl/298
{ "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, 55617, 4042, 2346, 3904, 368, 341, 286, 1077, 1133, 4042, 284, 11763, 486, 68954, 1072, 7, 19, 17, 11, 11763, 486, 49312, 1072, 68954, 52574, 486, 31874, 40, 18, 17, 11, 11763, 486, 21807, 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_update_to_invalid() { let pd_client = Arc::new(MockPdClient::new()); let id = "localhost:1080"; let mut cfg = TiKvConfig::default(); cfg.raft_store.raft_log_gc_threshold = 2000; // register config let mut cfg_handler = pd_client.clone().register(id, cfg, false); // update invalid config on pd side pd_client.update_cfg(id, |cfg| { cfg.raft_store.raft_log_gc_threshold = 0; }); // refresh local config cfg_handler.refresh_config(pd_client.as_ref()).unwrap(); // local config should not change assert_eq!( cfg_handler.get_config().raft_store.raft_log_gc_threshold, 2000 ); // config on pd side should be rollbacked to valid config let cfg = pd_client.get(id); assert_eq!(cfg.update.len(), 1); assert_eq!(cfg.update[0].name, "raftstore.raft-log-gc-threshold"); assert_eq!(cfg.update[0].value, toml::to_string(&2000).unwrap()); }
rust_cleaned_test_functions.jsonl/103835
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 399 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8882, 2346, 31433, 368, 341, 262, 1077, 7744, 8179, 284, 19689, 486, 931, 66436, 47, 67, 2959, 486, 931, 1423, 262, 1077, 877, 284, 330, 8301, 25, 16, 15, 23, 15, 3302, 262, 1077, 5206, 13286,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_append() { let l = default_logger(); let previous_ents = vec![new_entry(1, 1), new_entry(2, 2)]; let tests = vec![ (vec![], 2, vec![new_entry(1, 1), new_entry(2, 2)], 3), ( vec![new_entry(3, 2)], 3, vec![new_entry(1, 1), new_entry(2, 2), new_entry(3, 2)], 3, ), // conflicts with index 1 (vec![new_entry(1, 2)], 1, vec![new_entry(1, 2)], 1), // conflicts with index 2 ( vec![new_entry(2, 3), new_entry(3, 3)], 3, vec![new_entry(1, 1), new_entry(2, 3), new_entry(3, 3)], 2, ), ]; for (i, &(ref ents, windex, ref wents, wunstable)) in tests.iter().enumerate() { let store = MemStorage::new(); store.wl().append(&previous_ents).expect("append failed"); let mut raft_log = RaftLog::new(store, l.clone()); let index = raft_log.append(ents); if index != windex { panic!("#{}: last_index = {}, want {}", i, index, windex); } match raft_log.entries(1, None) { Err(e) => panic!("#{}: unexpected error {}", i, e), Ok(ref g) if g != wents => panic!("#{}: logEnts = {:?}, want {:?}", i, &g, &wents), _ => { let goff = raft_log.unstable.offset; if goff != wunstable { panic!("#{}: unstable = {}, want {}", i, goff, wunstable); } } } } }
rust_cleaned_test_functions.jsonl/48407
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 996 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 26041, 368, 341, 286, 1077, 326, 284, 1638, 27413, 543, 286, 1077, 3681, 62, 805, 284, 7486, 20703, 931, 9078, 7, 16, 11, 220, 16, 701, 501, 9078, 7, 17, 11, 220, 17, 12587, 286, 1077, 7032,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_number_failures() { assert_token!("00", TokenKind::ErrorUnsupportedNumberLiteral, 0, 2); assert_token!("01", TokenKind::ErrorUnsupportedNumberLiteral, 0, 2); assert_token!("-01", TokenKind::ErrorUnsupportedNumberLiteral, 0, 3); assert_token!("+1", TokenKind::ErrorUnsupportedNumberLiteral, 0, 2); assert_token!("01.23", TokenKind::ErrorUnsupportedNumberLiteral, 0, 5); assert_token!("1.", TokenKind::ErrorUnsupportedNumberLiteral, 0, 2); assert_token!("1e", TokenKind::ErrorUnsupportedNumberLiteral, 0, 2); assert_token!("1.e1", TokenKind::ErrorUnsupportedNumberLiteral, 0, 4); assert_token!("1.A", TokenKind::ErrorUnsupportedNumberLiteral, 0, 3); assert_token!("-A", TokenKind::ErrorUnsupportedNumberLiteral, 0, 2); assert_token!("1.0e", TokenKind::ErrorUnsupportedNumberLiteral, 0, 4); assert_token!("1.0eA", TokenKind::ErrorUnsupportedNumberLiteral, 0, 5); assert_token!("1.2e3e", TokenKind::ErrorUnsupportedNumberLiteral, 0, 6); assert_token!("1.2e3.4", TokenKind::ErrorUnsupportedNumberLiteral, 0, 7); assert_token!("1.23.4", TokenKind::ErrorUnsupportedNumberLiteral, 0, 6); assert_token!(".123", TokenKind::ErrorUnsupportedNumberLiteral, 0, 4); // check that we don't consume trailing valid items assert_token!("1.23.4{}", TokenKind::ErrorUnsupportedNumberLiteral, 0, 6); assert_token!("1.23.4 {}", TokenKind::ErrorUnsupportedNumberLiteral, 0, 6); assert_token!("1.23.4 []", TokenKind::ErrorUnsupportedNumberLiteral, 0, 6); assert_token!("1.23.4 foo", TokenKind::ErrorUnsupportedNumberLiteral, 0, 6); assert_token!( "1.23.4 $foo", TokenKind::ErrorUnsupportedNumberLiteral, 0, 6 ); }
rust_cleaned_test_functions.jsonl/1904
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 791 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5500, 22121, 1413, 368, 341, 286, 2060, 6458, 17223, 15, 15, 497, 9660, 10629, 486, 1454, 41884, 2833, 17350, 11, 220, 15, 11, 220, 17, 317, 286, 2060, 6458, 17223, 15, 16, 497, 9660, 10629, 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_is_subset() { fn is_subset(a: &[i32], b: &[i32]) -> bool { let set_a = a.iter().collect::<BTreeSet<_>>(); let set_b = b.iter().collect::<BTreeSet<_>>(); set_a.is_subset(&set_b) } assert_eq!(is_subset(&[], &[]), true); assert_eq!(is_subset(&[], &[1, 2]), true); assert_eq!(is_subset(&[0], &[1, 2]), false); assert_eq!(is_subset(&[1], &[1, 2]), true); assert_eq!(is_subset(&[2], &[1, 2]), true); assert_eq!(is_subset(&[3], &[1, 2]), false); assert_eq!(is_subset(&[1, 2], &[1]), false); assert_eq!(is_subset(&[1, 2], &[1, 2]), true); assert_eq!(is_subset(&[1, 2], &[2, 3]), false); assert_eq!( is_subset(&[-5, 11, 22, 33, 40, 42], &[-12, -5, 11, 14, 22, 23, 33, 34, 38, 39, 40, 42]), true ); assert_eq!(is_subset(&[-5, 11, 22, 33, 40, 42], &[-12, -5, 11, 14, 22, 23, 34, 38]), false); if cfg!(miri) { // Miri is too slow return; } let large = (0..100).collect::<Vec<_>>(); assert_eq!(is_subset(&[], &large), true); assert_eq!(is_subset(&large, &[]), false); assert_eq!(is_subset(&[-1], &large), false); assert_eq!(is_subset(&[0], &large), true); assert_eq!(is_subset(&[1, 2], &large), true); assert_eq!(is_subset(&[99, 100], &large), false); }
rust_cleaned_test_functions.jsonl/12213
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 679 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6892, 47532, 368, 341, 262, 5168, 374, 47532, 2877, 25, 44590, 72, 18, 17, 1125, 293, 25, 44590, 72, 18, 17, 2467, 1464, 1807, 341, 286, 1077, 738, 4306, 284, 264, 19471, 1005, 17384, 27638, 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_config_manager__config_read__success() -> TestResult { let cm = ConfigManager {}; let (config_dir, _tmp_dir) = set_and_create_config_dir()?; let mut file = fs::File::create(&path::Path::new(&config_dir.join("repo_path").as_os_str()))?; file.write_all("this-repo-path-value".as_bytes())?; let actual = cm.config_read(ConfigType::Repo)?; let expected = "this-repo-path-value"; env::remove_var("HOME"); assert_eq!(actual, expected); Ok(()) }
rust_cleaned_test_functions.jsonl/81015
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 254 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5332, 12144, 563, 1676, 6443, 563, 5630, 368, 1464, 3393, 2077, 341, 286, 1077, 9961, 284, 5532, 2043, 9321, 286, 1077, 320, 1676, 4334, 11, 716, 5173, 4334, 8, 284, 738, 8378, 8657, 5332, 4334,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_readexactly() { run_on(|| { let (mut sender, payload) = Payload::create(false); let mut payload = PayloadBuffer::new(payload); assert_eq!(None, payload.read_exact(2)); sender.feed_data(Bytes::from("line1")); sender.feed_data(Bytes::from("line2")); payload.poll_stream().unwrap(); assert_eq!(Some(Bytes::from_static(b"li")), payload.read_exact(2)); assert_eq!(payload.buf.len(), 8); assert_eq!(Some(Bytes::from_static(b"ne1l")), payload.read_exact(4)); assert_eq!(payload.buf.len(), 4); }) }
rust_cleaned_test_functions.jsonl/43769
{ "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, 6443, 327, 32739, 368, 341, 286, 1598, 4470, 79453, 341, 310, 1077, 320, 6984, 4646, 11, 7729, 8, 284, 52916, 486, 3182, 3576, 317, 310, 1077, 5206, 7729, 284, 52916, 4095, 486, 931, 26772, 626,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_extra_op_old_value() { let engine = TestEngineBuilder::new().build().unwrap(); let key = Key::from_raw(b"key"); let ctx = Context::default(); let new_old_value = |short_value, start_ts| OldValue { short_value, start_ts, }; let cases = vec![ ( Mutation::Put((key.clone(), b"v0".to_vec())), false, 5, 5, None, true, ), ( Mutation::Put((key.clone(), b"v1".to_vec())), false, 6, 6, Some(new_old_value(Some(b"v0".to_vec()), 5.into())), true, ), (Mutation::Lock(key.clone()), false, 7, 7, None, false), ( Mutation::Lock(key.clone()), false, 8, 8, Some(new_old_value(Some(b"v1".to_vec()), 6.into())), false, ), ( Mutation::Put((key.clone(), vec![b'0'; 5120])), false, 9, 9, Some(new_old_value(Some(b"v1".to_vec()), 6.into())), true, ), ( Mutation::Put((key.clone(), b"v3".to_vec())), false, 10, 10, Some(new_old_value(None, 9.into())), true, ), ( Mutation::Put((key.clone(), b"v4".to_vec())), true, 11, 11, None, true, ), ]; let write = |modifies| { engine.write(&ctx, modifies).unwrap(); }; let new_txn = |start_ts, cm| { let snapshot = engine.snapshot(&ctx).unwrap(); MvccTxn::new(snapshot, start_ts, true, cm) }; for case in cases { let (mutation, is_pessimistic, start_ts, commit_ts, old_value, check_old_value) = case; let mutation_type = mutation.mutation_type(); let cm = ConcurrencyManager::new(start_ts.into()); let mut txn = new_txn(start_ts.into(), cm.clone()); txn.extra_op = ExtraOp::ReadOldValue; if is_pessimistic { acquire_pessimistic_lock( &mut txn, key.clone(), b"key", false, 0, start_ts.into(), false, TimeStamp::zero(), ) .unwrap(); write(WriteData::from_modifies(txn.into_modifies())); txn = new_txn(start_ts.into(), cm.clone()); txn.extra_op = ExtraOp::ReadOldValue; pessimistic_prewrite( &mut txn, mutation, b"key", &None, true, 0, start_ts.into(), 0, TimeStamp::zero(), TimeStamp::zero(), false, ) .unwrap(); } else { prewrite( &mut txn, mutation, b"key", &None, false, 0, 0, TimeStamp::default(), TimeStamp::default(), ) .unwrap(); } if check_old_value { let extra = txn.take_extra(); let ts_key = key.clone().append_ts(start_ts.into()); assert!( extra.old_values.get(&ts_key).is_some(), "{}@{}", ts_key, start_ts ); assert_eq!(extra.old_values[&ts_key], (old_value, mutation_type)); } write(WriteData::from_modifies(txn.into_modifies())); let mut txn = new_txn(start_ts.into(), cm); commit(&mut txn, key.clone(), commit_ts.into()).unwrap(); engine .write(&ctx, WriteData::from_modifies(txn.into_modifies())) .unwrap(); } }
rust_cleaned_test_functions.jsonl/35972
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2930 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 31858, 10287, 21108, 3142, 368, 341, 286, 1077, 4712, 284, 3393, 4571, 3297, 486, 931, 1005, 5834, 1005, 15454, 543, 286, 1077, 1376, 284, 5309, 486, 1499, 16067, 1883, 1, 792, 797, 286, 1077, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
#[test] fn test_raw_node_propose_and_conf_change() { setup_for_test(); let s = new_storage(); let mut raw_node = new_raw_node(1, vec![1], 10, 1, s.clone()); raw_node.campaign().expect(""); let mut proposed = false; let mut last_index; let mut ccdata = vec![]; loop { let rd = raw_node.ready(); s.wl().append(rd.entries()).expect(""); if !proposed && rd.ss().is_some() && rd.ss().unwrap().leader_id == raw_node.raft.id { raw_node.propose(vec![], b"somedata".to_vec()).expect(""); let cc = conf_change(ConfChangeType::AddNode, 2); ccdata.reserve_exact(ProstMsg::encoded_len(&cc)); cc.encode(&mut ccdata).unwrap(); raw_node.propose_conf_change(vec![], cc).expect(""); proposed = true; } raw_node.advance(rd); // and proposed ConfChange. last_index = s.last_index().unwrap(); if last_index >= 3 { break; } } let entries = s.entries(last_index - 1, last_index + 1, None).unwrap(); assert_eq!(entries.len(), 2); assert_eq!(entries[0].get_data(), b"somedata"); assert_eq!(entries[1].get_entry_type(), EntryType::EntryConfChange); assert_eq!(entries[1].get_data(), &*ccdata); }
rust_cleaned_test_functions.jsonl/50334
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 632 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 16067, 5084, 21663, 960, 8378, 16059, 15947, 368, 341, 262, 6505, 5478, 4452, 543, 262, 1077, 274, 284, 501, 23310, 543, 262, 1077, 5206, 7112, 5084, 284, 501, 16067, 5084, 7, 16, 11, 7486, 2070...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_ops_u8() { array!(Array55, 55, u8); let x = Array55::from_native_slice(&get_random_vec_u8(55)); let y = Array55::from_native_slice(&get_random_vec_u8(55)); let z1 = x + y; let z2 = x - z1; let mut z3 = x * z2; for i in 0..z3.len() { if z3[i] == 0 { z3[i] = 1 } } let _z = x / z3; }
rust_cleaned_test_functions.jsonl/6635
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 208 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21959, 7300, 23, 368, 341, 262, 1334, 10297, 1857, 20, 20, 11, 220, 20, 20, 11, 575, 23, 317, 262, 1077, 856, 284, 2910, 20, 20, 486, 1499, 44494, 26488, 2099, 455, 22644, 13251, 7300, 23, 7...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_validate_ring_elements_are_sorted() { let (mut tx, _ledger) = create_test_tx(); assert_eq!(validate_ring_elements_are_sorted(&tx.prefix), Ok(())); // Change the ordering of a ring. tx.prefix.inputs[0].ring.swap(0, 3); assert_eq!( validate_ring_elements_are_sorted(&tx.prefix), Err(TransactionValidationError::UnsortedRingElements) ); }
rust_cleaned_test_functions.jsonl/78556
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 209 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 42681, 34683, 22801, 56855, 41277, 368, 341, 286, 1077, 320, 6984, 9854, 11, 716, 50704, 8, 284, 1855, 4452, 17805, 543, 286, 2060, 10714, 10297, 7067, 34683, 22801, 56855, 41277, 2099, 3998, 38543,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_profile_matric() { let fasta_eg = concat!(">Rosalind_1\nATCCAGCT\n>Rosalind_2\nGGGCAACT\n>Rosalind_3\nATGGATCT\n", ">Rosalind_4\nAAGCAACC\n>Rosalind_5\nTTGGAACT\n>Rosalind_6\nATGCCATT\n", ">Rosalind_7\nATGGCACT\n"); let fasta = read_fasta(io::Cursor::new(fasta_eg)).unwrap(); let pm = profile_matrix(fasta).unwrap(); assert_eq!(pm.g_count, vec![1, 1, 6, 3, 0, 1, 0, 0]); assert_eq!(pm.consensus(), "ATGCAACT".to_string()); }
rust_cleaned_test_functions.jsonl/28462
{ "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, 13789, 16610, 2216, 368, 341, 262, 1077, 85249, 90209, 284, 33720, 17223, 29, 49, 32556, 484, 62, 16, 1699, 828, 3706, 1890, 1162, 1699, 43960, 32556, 484, 62, 17, 1699, 22254, 38, 5049, 6823, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_version_from_str() { let version = Version::from_str("1.2.3").unwrap(); assert_eq!( version, Version { major: 1, minor: 2, patch: 3 } ); }
rust_cleaned_test_functions.jsonl/32854
{ "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, 9438, 5673, 2895, 368, 341, 286, 1077, 2319, 284, 6079, 486, 1499, 2895, 445, 16, 13, 17, 13, 18, 1827, 15454, 1428, 286, 2060, 10714, 33673, 310, 2319, 345, 310, 6079, 341, 394, 3598, 25, 220...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_closest() { let mut node_ids: Vec<NodeId> = Vec::new(); node_ids.push(NodeId::try_from(&[144, 28, 106, 112, 220, 197, 216, 119, 9, 217, 42, 77, 159][..]).unwrap()); node_ids.push(NodeId::try_from(&[75, 249, 102, 1, 2, 166, 155, 37, 22, 54, 84, 98, 56][..]).unwrap()); node_ids.push(NodeId::try_from(&[60, 32, 246, 39, 108, 201, 214, 91, 30, 230, 3, 126, 31][..]).unwrap()); node_ids.push(NodeId::try_from(&[134, 116, 78, 53, 246, 206, 200, 147, 126, 96, 54, 113, 67][..]).unwrap()); node_ids.push(NodeId::try_from(&[75, 146, 162, 130, 22, 63, 247, 182, 156, 103, 174, 32, 134][..]).unwrap()); node_ids.push(NodeId::try_from(&[186, 43, 62, 14, 60, 214, 9, 180, 145, 122, 55, 160, 83][..]).unwrap()); node_ids.push(NodeId::try_from(&[143, 189, 32, 210, 30, 231, 82, 5, 86, 85, 28, 82, 154][..]).unwrap()); node_ids.push(NodeId::try_from(&[155, 210, 214, 160, 153, 70, 172, 234, 177, 178, 62, 82, 166][..]).unwrap()); node_ids.push(NodeId::try_from(&[173, 218, 34, 188, 211, 173, 235, 82, 18, 159, 55, 47, 242][..]).unwrap()); let node_id = NodeId::try_from(&[169, 125, 200, 137, 210, 73, 241, 238, 25, 108, 8, 48, 66][..]).unwrap(); let k = 3; let knn_node_ids = node_id.closest(&node_ids, k); assert_eq!(knn_node_ids.len(), k); // XOR metric nearest neighbours assert_eq!(knn_node_ids[0].0, [ 173, 218, 34, 188, 211, 173, 235, 82, 18, 159, 55, 47, 242 ]); assert_eq!(knn_node_ids[1].0, [ 186, 43, 62, 14, 60, 214, 9, 180, 145, 122, 55, 160, 83 ]); assert_eq!(knn_node_ids[2].0, [ 143, 189, 32, 210, 30, 231, 82, 5, 86, 85, 28, 82, 154 ]); // Hamming distance nearest neighbours assert_eq!(node_id.closest(&node_ids, node_ids.len() + 1).len(), node_ids.len()); }
rust_cleaned_test_functions.jsonl/76527
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1011 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 12704, 267, 368, 341, 286, 1077, 5206, 2436, 8077, 25, 11312, 30807, 764, 29, 284, 11312, 486, 931, 543, 286, 2436, 8077, 2552, 22078, 764, 486, 1539, 5673, 2099, 58, 16, 19, 19, 11, 220, 17, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_h2_head_binary() { let openssl = ssl_acceptor().unwrap(); let mut srv = TestServer::new(move || { openssl .clone() .map_err(|e| println!("Openssl error: {}", e)) .and_then( HttpService::build() .h2(|_| { ok::<_, ()>( Response::Ok().content_length(STR.len() as u64).body(STR), ) }) .map_err(|_| ()), ) }); let response = srv.block_on(srv.shead("/").send()).unwrap(); assert!(response.status().is_success()); { let len = response .headers() .get(http::header::CONTENT_LENGTH) .unwrap(); assert_eq!(format!("{}", STR.len()), len.to_str().unwrap()); } // read response let bytes = srv.load_body(response).unwrap(); assert!(bytes.is_empty()); }
rust_cleaned_test_functions.jsonl/102553
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 548 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1523, 17, 13138, 31761, 368, 341, 262, 1077, 80733, 284, 33537, 35728, 269, 1005, 15454, 543, 262, 1077, 5206, 43578, 284, 3393, 5475, 486, 931, 34081, 1369, 341, 286, 80733, 198, 310, 659, 19982,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_request_message_side_effects_1() { let mut system_state = SystemStateBuilder::default().build(); system_state.freeze_threshold = NumSeconds::from(0); inject_request(&mut system_state); test_outgoing_messages( system_state, CALL_SIMPLE_WAT, |mut execute_message_result| { // The extra queue is the empty queue created due to the inter-canister request // generated by the Canister. assert_eq!( execute_message_result .canister .system_state .queues() .output_queues_len(), 2 ); assert_eq!( execute_message_result .canister .system_state .queues() .output_message_count(), 1 ); assert_correct_request(&mut execute_message_result.canister.system_state); }, ); }
rust_cleaned_test_functions.jsonl/17018
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 564 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 7893, 6462, 30862, 83171, 62, 16, 368, 341, 262, 1077, 5206, 1849, 4387, 284, 739, 1397, 3297, 486, 2258, 1005, 5834, 543, 262, 1849, 4387, 76685, 21858, 284, 16212, 15343, 486, 1499, 7, 15, 317...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_neq_dyn_binary_scalar() { let data: Vec<Option<&[u8]>> = vec![Some(b"arrow"), Some(b"datafusion"), Some(b"flight"), Some(b"parquet"), Some(&[0xff, 0xf8]), None]; let array = BinaryArray::from(data.clone()); let large_array = LargeBinaryArray::from(data); let scalar = "flight".as_bytes(); let expected = BooleanArray::from( vec![Some(true), Some(true), Some(false), Some(true), Some(true), None], ); assert_eq!(neq_dyn_binary_scalar(&array, scalar).unwrap(), expected); assert_eq!( neq_dyn_binary_scalar(&large_array, scalar).unwrap(), expected ); }
rust_cleaned_test_functions.jsonl/98227
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 323 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13925, 80, 69213, 31761, 41652, 368, 341, 286, 1077, 821, 25, 11312, 94150, 52244, 58, 84, 23, 60, 2452, 284, 7486, 20703, 8373, 1883, 1, 6044, 3975, 4329, 1883, 97115, 54565, 3975, 4329, 1883, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_subject() { #[cfg(not(feature = "component"))] let elem: Element = "<message xmlns='jabber:client' to='coucou@example.org' type='chat'><subject>Hello world!</subject></message>".parse().unwrap(); #[cfg(feature = "component")] let elem: Element = "<message xmlns='jabber:component:accept' to='coucou@example.org' type='chat'><subject>Hello world!</subject></message>".parse().unwrap(); let elem1 = elem.clone(); let message = Message::try_from(elem).unwrap(); assert_eq!( message.subjects[""], Subject::from_str("Hello world!").unwrap() ); { let (lang, subject) = message.get_best_subject(vec!["en"]).unwrap(); assert_eq!(lang, ""); assert_eq!(subject, &Subject::from_str("Hello world!").unwrap()); } let elem2 = message.into(); assert_eq!(elem1, elem2); }
rust_cleaned_test_functions.jsonl/112974
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 426 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 28834, 368, 341, 286, 11506, 14072, 24772, 27062, 284, 330, 8571, 2761, 921, 286, 1077, 11750, 25, 8543, 284, 4055, 1994, 24967, 1131, 38916, 652, 25, 2972, 6, 311, 1131, 22249, 22249, 35487, 2659...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_to_hex() { assert_eq!(to_hex(vec![0, 0, 0, 0]), "00000000"); assert_eq!(to_hex(vec![10, 11, 12, 13]), "0a0b0c0d"); assert_eq!(to_hex(vec![0, 0, 0, 255]), "000000ff"); }
rust_cleaned_test_functions.jsonl/5826
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 108 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2346, 32655, 368, 341, 197, 6948, 10714, 10297, 983, 32655, 25592, 20703, 15, 11, 220, 15, 11, 220, 15, 11, 220, 15, 9719, 330, 15, 15, 15, 15, 15, 15, 15, 15, 797, 197, 6948, 10714, 10297, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_str_default() { use core::default::Default; fn t<S: Default + Str>() { let s: S = Default::default(); assert_eq!(s.as_slice(), ""); } t::<&str>(); t::<String>(); }
rust_cleaned_test_functions.jsonl/2482
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 142 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2895, 9993, 368, 341, 286, 990, 6200, 486, 2258, 486, 3675, 280, 286, 5168, 259, 18858, 25, 7899, 488, 4509, 13555, 341, 310, 1077, 274, 25, 328, 284, 7899, 486, 2258, 543, 310, 2060, 10714, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_parse_arrow_multi() { let text = "Do you recall how it came to that place"; let text: Vec<_> = text.split_whitespace().collect(); let (a, b) = parse_arrow(&text).unwrap(); assert_eq!(a, text.as_slice()); assert!(b.is_empty()); }
rust_cleaned_test_functions.jsonl/65977
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 135 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 46566, 25133, 368, 341, 286, 1077, 1467, 284, 330, 5404, 498, 19091, 1246, 432, 3697, 311, 429, 1992, 876, 286, 1077, 1467, 25, 11312, 32399, 29, 284, 1467, 5289, 86175, 1005, 17384, 543, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_signed_msg_hash() { let hash = signed_msg_hash("test"); assert_eq!(hash.to_hex(), "a6f87fe6d58a032c320ff8d1541656f0282c2c7bfcc69d61af4c8e8ed528e49c"); }
rust_cleaned_test_functions.jsonl/80482
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 107 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 55617, 6483, 8950, 368, 341, 286, 1077, 5175, 284, 8499, 6483, 8950, 445, 1944, 797, 286, 2060, 10714, 10297, 8296, 2389, 32655, 1507, 330, 64, 21, 69, 23, 22, 1859, 21, 67, 20, 23, 64, 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_parse_wallet_esplora() { let cli_args = vec!["bdk-cli", "--network", "bitcoin", "wallet", "--descriptor", "wpkh(xpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/0/*)", "--change_descriptor", "wpkh(xpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/1/*)", "--esplora", "https://blockstream.info/api/", "--esplora_concurrency", "5", "get_new_address"]; let cli_opts = CliOpts::from_iter(&cli_args); let expected_cli_opts = CliOpts { network: Network::Bitcoin, subcommand: CliSubCommand::Wallet { wallet_opts: WalletOpts { wallet: "main".to_string(), descriptor: "wpkh(xpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/0/*)".to_string(), change_descriptor: Some("wpkh(xpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/1/*)".to_string()), #[cfg(feature = "electrum")] electrum_opts: ElectrumOpts { timeout: None, electrum: "ssl://electrum.blockstream.info:60002".to_string(), }, #[cfg(feature = "esplora")] esplora_opts: EsploraOpts { esplora: Some("https://blockstream.info/api/".to_string()), esplora_concurrency: 5, }, #[cfg(feature = "compact_filters")] compactfilter_opts: CompactFilterOpts{ address: vec!["127.0.0.1:18444".to_string()], skip_blocks: 0, conn_count: 4, }, #[cfg(any(feature="compact_filters", feature="electrum"))] proxy_opts: ProxyOpts{ proxy: None, proxy_auth: None, retries: 5, } }, subcommand: WalletSubCommand::OfflineWalletSubCommand(GetNewAddress), }, }; assert_eq!(expected_cli_opts, cli_opts); }
rust_cleaned_test_functions.jsonl/53338
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1612 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 62308, 33741, 500, 6215, 368, 341, 286, 1077, 21348, 8384, 284, 7486, 0, 1183, 65, 7584, 54797, 497, 14482, 17511, 497, 330, 83910, 497, 330, 35735, 756, 999, 14482, 53132, 497, 330, 8421, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_diff_so_fancy_respects_git_config() { let git_config_contents = b" [color \"diff\"] meta = 11 frag = magenta bold commit = purple bold old = red bold new = green bold whitespace = red reverse "; let git_config_path = "delta__test_diff_so_fancy.gitconfig"; let opt = integration_test_utils::make_options_from_args_and_git_config( &["--features", "diff-so-fancy some-other-feature"], Some(git_config_contents), Some(git_config_path), ); assert_eq!(opt.commit_style, "purple bold"); assert_eq!(opt.file_style, "11"); assert_eq!(opt.hunk_header_style, "magenta bold"); assert_eq!(opt.commit_decoration_style, "none"); assert_eq!(opt.file_decoration_style, "bold yellow ul ol"); assert_eq!(opt.hunk_header_decoration_style, "magenta box"); remove_file(git_config_path).unwrap(); }
rust_cleaned_test_functions.jsonl/91073
{ "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, 15850, 39833, 761, 6572, 4918, 7973, 68801, 5332, 368, 341, 286, 1077, 16345, 5332, 16682, 284, 293, 698, 84111, 7245, 13490, 2105, 921, 262, 8823, 284, 220, 16, 16, 198, 262, 8343, 284, 4878, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_json_depth() { let cases = vec![ (None, None), (Some("null"), Some(1)), (Some("[true, 2017]"), Some(2)), ( Some(r#"{"a": {"a1": [3]}, "b": {"b1": {"c": {"d": [5]}}}}"#), Some(6), ), (Some("{}"), Some(1)), (Some("[]"), Some(1)), (Some("true"), Some(1)), (Some("1"), Some(1)), (Some("-1"), Some(1)), (Some(r#""a""#), Some(1)), (Some(r#"[10, 20]"#), Some(2)), (Some(r#"[[], {}]"#), Some(2)), (Some(r#"[10, {"a": 20}]"#), Some(3)), (Some(r#"[[2], 3, [[[4]]]]"#), Some(5)), (Some(r#"{"Name": "Homer"}"#), Some(2)), (Some(r#"[10, {"a": 20}]"#), Some(3)), ( Some( r#"{"Person": {"Name": "Homer", "Age": 39, "Hobbies": ["Eating", "Sleeping"]} }"#, ), Some(4), ), (Some(r#"{"a":1}"#), Some(2)), (Some(r#"{"a":[1]}"#), Some(3)), (Some(r#"{"b":2, "c":3}"#), Some(2)), (Some(r#"[1]"#), Some(2)), (Some(r#"[1,2]"#), Some(2)), (Some(r#"[1,2,[1,3]]"#), Some(3)), (Some(r#"[1,2,[1,[5,[3]]]]"#), Some(5)), (Some(r#"[1,2,[1,[5,{"a":[2,3]}]]]"#), Some(6)), (Some(r#"[{"a":1}]"#), Some(3)), (Some(r#"[{"a":1,"b":2}]"#), Some(3)), (Some(r#"[{"a":{"a":1},"b":2}]"#), Some(4)), ]; let mut ctx = EvalContext::default(); for (input, exp) in cases { let input = match input { None => Datum::Null, Some(s) => Datum::Json(s.parse().unwrap()), }; let exp = match exp { None => Datum::Null, Some(s) => Datum::I64(s.to_owned()), }; let arg = datum_expr(input); let op = scalar_func_expr(ScalarFuncSig::JsonDepthSig, &[arg]); let op = Expression::build(&mut ctx, op).unwrap(); let got = op.eval(&mut ctx, &[]).unwrap(); assert_eq!(got, exp); } }
rust_cleaned_test_functions.jsonl/5032
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1384 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9455, 19061, 368, 341, 286, 1077, 5048, 284, 7486, 90515, 310, 320, 4064, 11, 2240, 1326, 310, 320, 8373, 445, 2921, 3975, 4329, 7, 16, 6965, 310, 320, 8373, 10937, 1866, 11, 220, 17, 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...
4
#[test] fn test_basic_traits() { pyo3::prepare_freethreaded_python(); Python::with_gil(|py| -> () { let input = create_measurement(py); let program_type = py.get_type::<QuantumProgramWrapper>(); let program = program_type .call1((input, vec!["test".to_string()])) .unwrap() .cast_as::<PyCell<QuantumProgramWrapper>>() .unwrap(); let program_wrapper = program.extract::<QuantumProgramWrapper>().unwrap(); let helper_ne: bool = QuantumProgramWrapper::new(input, vec!["error".into()]).unwrap() != program_wrapper.clone(); assert!(helper_ne); let helper_eq: bool = QuantumProgramWrapper::new(input, vec!["test".into()]).unwrap() == program_wrapper.clone(); assert!(helper_eq); let helper_eq: bool = program_wrapper.clone() == program_wrapper; assert!(helper_eq); assert_eq!( format!("{:?}", QuantumProgramWrapper::new(input, vec!["test".into()]).unwrap()), "QuantumProgramWrapper { internal: CheatedBasisRotation { measurement: CheatedBasisRotation { constant_circuit: Some(Circuit { definitions: [], operations: [], _roqoqo_version: RoqoqoVersion }), circuits: [Circuit { definitions: [], operations: [], _roqoqo_version: RoqoqoVersion }, Circuit { definitions: [], operations: [RotateX(RotateX { qubit: 0, theta: Float(0.0) })], _roqoqo_version: RoqoqoVersion }], input: CheatedBasisRotationInput { measured_exp_vals: {}, pauli_product_keys: {\"ro\": 0} } }, input_parameter_names: [\"test\"] } }" ); }) }
rust_cleaned_test_functions.jsonl/8600
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 685 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 34729, 39693, 368, 341, 262, 4510, 78, 18, 486, 13609, 74179, 769, 878, 291, 55869, 543, 262, 13027, 486, 4197, 1889, 321, 22428, 3288, 91, 1464, 1719, 341, 286, 1077, 1946, 284, 1855, 87342, 46...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_unicast_eui_addresses() { let addresses = [ ( "a0b1c2d3e4f5", "101000001011000111000010110100111110010011110101", 176685338322165, "a0b1c2d3e4f5", "a0-b1-c2-d3-e4-f5", "a0:b1:c2:d3:e4:f5", "a0b1.c2d3.e4f5", ("a0b1c2", "d3e4f5"), "unique", true, false, false, false, true, true, false, ), ( "A0B1C2D3E4F5", "101000001011000111000010110100111110010011110101", 176685338322165, "a0b1c2d3e4f5", "a0-b1-c2-d3-e4-f5", "a0:b1:c2:d3:e4:f5", "a0b1.c2d3.e4f5", ("a0b1c2", "d3e4f5"), "unique", true, false, false, false, true, true, false, ), ( "a0-b1-c2-d3-e4-f5", "101000001011000111000010110100111110010011110101", 176685338322165, "a0b1c2d3e4f5", "a0-b1-c2-d3-e4-f5", "a0:b1:c2:d3:e4:f5", "a0b1.c2d3.e4f5", ("a0b1c2", "d3e4f5"), "unique", true, false, false, false, true, true, false, ), ( "A0-B1-C2-D3-E4-F5", "101000001011000111000010110100111110010011110101", 176685338322165, "a0b1c2d3e4f5", "a0-b1-c2-d3-e4-f5", "a0:b1:c2:d3:e4:f5", "a0b1.c2d3.e4f5", ("a0b1c2", "d3e4f5"), "unique", true, false, false, false, true, true, false, ), ( "a0:b1:c2:d3:e4:f5", "101000001011000111000010110100111110010011110101", 176685338322165, "a0b1c2d3e4f5", "a0-b1-c2-d3-e4-f5", "a0:b1:c2:d3:e4:f5", "a0b1.c2d3.e4f5", ("a0b1c2", "d3e4f5"), "unique", true, false, false, false, true, true, false, ), ( "A0:B1:C2:D3:E4:F5", "101000001011000111000010110100111110010011110101", 176685338322165, "a0b1c2d3e4f5", "a0-b1-c2-d3-e4-f5", "a0:b1:c2:d3:e4:f5", "a0b1.c2d3.e4f5", ("a0b1c2", "d3e4f5"), "unique", true, false, false, false, true, true, false, ), ( "a0b1.c2d3.e4f5", "101000001011000111000010110100111110010011110101", 176685338322165, "a0b1c2d3e4f5", "a0-b1-c2-d3-e4-f5", "a0:b1:c2:d3:e4:f5", "a0b1.c2d3.e4f5", ("a0b1c2", "d3e4f5"), "unique", true, false, false, false, true, true, false, ), ( "A0B1.C2D3.E4F5", "101000001011000111000010110100111110010011110101", 176685338322165, "a0b1c2d3e4f5", "a0-b1-c2-d3-e4-f5", "a0:b1:c2:d3:e4:f5", "a0b1.c2d3.e4f5", ("a0b1c2", "d3e4f5"), "unique", true, false, false, false, true, true, false, ), ]; for element in addresses.into_iter() { let digits = element.0.to_string(); let mac = MediaAccessControlAddress::new(&digits).unwrap(); assert_eq!(mac.to_binary_representation(), element.1); assert_eq!(mac.to_decimal_representation(), element.2); assert_eq!(mac.to_plain_notation(), element.3); assert_eq!(mac.to_hyphen_notation(), element.4); assert_eq!(mac.to_colon_notation(), element.5); assert_eq!(mac.to_dot_notation(), element.6); assert_eq!(mac.to_fragments(), element.7); assert_eq!(mac.kind(), element.8); assert_eq!(mac.has_oui(), element.9); assert_eq!(mac.has_cid(), element.10); assert_eq!(mac.is_broadcast(), element.11); assert_eq!(mac.is_multicast(), element.12); assert_eq!(mac.is_unicast(), element.13); assert_eq!(mac.is_uaa(), element.14); assert_eq!(mac.is_laa(), element.15); } }
rust_cleaned_test_functions.jsonl/9040
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 3982 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 62, 3525, 559, 2204, 1963, 59471, 368, 341, 286, 1077, 14230, 284, 2278, 310, 2399, 394, 330, 64, 15, 65, 16, 66, 17, 67, 18, 68, 19, 69, 20, 497, 715, 394, 330, 16, 15, 16, 15, 15, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_rsplitator() { let xs = &[1,2,3,4,5]; let splits: &[&[_]] = &[&[5], &[3], &[1]]; assert_eq!(xs.split(|x| *x % 2 == 0).rev().collect::<Vec<_>>(), splits); let splits: &[&[_]] = &[&[2,3,4,5], &[]]; assert_eq!(xs.split(|x| *x == 1).rev().collect::<Vec<_>>(), splits); let splits: &[&[_]] = &[&[], &[1,2,3,4]]; assert_eq!(xs.split(|x| *x == 5).rev().collect::<Vec<_>>(), splits); let splits: &[&[_]] = &[&[1,2,3,4,5]]; assert_eq!(xs.split(|x| *x == 10).rev().collect::<Vec<_>>(), splits); let xs: &[i32] = &[]; let splits: &[&[i32]] = &[&[]]; assert_eq!(xs.split(|x| *x == 5).rev().collect::<Vec<&[i32]>>(), splits); }
rust_cleaned_test_functions.jsonl/111427
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 495 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1710, 6960, 850, 368, 341, 286, 1077, 11943, 284, 44590, 16, 11, 17, 11, 18, 11, 19, 11, 20, 4821, 286, 1077, 40467, 25, 44590, 5, 13496, 5053, 284, 44590, 5, 58, 20, 1125, 44590, 18, 1125, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_construct_twitter_url_profile() { let fake_query = "tw @fbOpenSource"; assert_eq!( construct_twitter_url(fake_query), "https://twitter.com/fbOpenSource" ); }
rust_cleaned_test_functions.jsonl/125789
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 115 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 64803, 83338, 2903, 13789, 368, 341, 286, 1077, 12418, 5738, 284, 330, 15560, 569, 10798, 5002, 3608, 876, 286, 2060, 10714, 33673, 310, 9245, 83338, 2903, 74138, 5738, 1326, 310, 330, 2428, 1110, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_map() { let input = json!([ {"id": 1, "year": 2015}, {"id": 2, "year": true}, {"id": 3, "year": 2016.5}, {"id": 4, "year": "2017"}, {"id": 5, "year": 2017}, {"id": 6, "year": 2017}, {"id": 7, "year": [1900, 1901]}, {"id": 8, "year": {"a": 2018, "b": 2019}}, {"id": 9}, {"id": 10, "year": null}, ]); let mut args = HashMap::new(); args.insert("attribute".to_string(), to_value("year").unwrap()); let expected = json!([2015, true, 2016.5, "2017", 2017, 2017, [1900, 1901], {"a": 2018, "b": 2019}]); let res = map(&input, &args); assert!(res.is_ok()); assert_eq!(res.unwrap(), to_value(expected).unwrap()); }
rust_cleaned_test_functions.jsonl/62071
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 440 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5376, 368, 341, 286, 1077, 1946, 284, 2951, 0, 8956, 310, 5212, 307, 788, 220, 16, 11, 330, 3157, 788, 220, 17, 15, 16, 20, 1583, 310, 5212, 307, 788, 220, 17, 11, 330, 3157, 788, 830, 158...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_uncompress() { let cases = vec![ ("", Datum::Bytes(b"".to_vec())), ( "0B000000789CCB48CDC9C95728CF2FCA4901001A0B045D", Datum::Bytes(b"hello world".to_vec()), ), ( "0C000000789CCB48CDC9C95728CF2F32303402001D8004202E", Datum::Bytes(b"hello wor012".to_vec()), ), // length is greater than the string ( "12000000789CCB48CDC9C95728CF2FCA4901001A0B045D", Datum::Bytes(b"hello world".to_vec()), ), ("010203", Datum::Null), ("01020304", Datum::Null), ("020000000000", Datum::Null), // ZlibDecoder#read_to_end return 0 ("0000000001", Datum::Null), // length is less than the string ( "02000000789CCB48CDC9C95728CF2FCA4901001A0B045D", Datum::Null, ), ]; for (s, exp) in cases { let s = Datum::Bytes(hex::decode(s.as_bytes().to_vec()).unwrap()); let got = eval_func(ScalarFuncSig::Uncompress, &[s]).unwrap(); assert_eq!(got, exp); } }
rust_cleaned_test_functions.jsonl/104209
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 735 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4907, 38360, 368, 341, 286, 1077, 5048, 284, 7486, 90515, 310, 3489, 497, 68459, 486, 7078, 1883, 69355, 983, 13251, 73727, 310, 2399, 394, 330, 15, 33, 15, 15, 15, 15, 15, 15, 22, 23, 24, 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...
2
#[test] fn test_fold_at_tab_as_word_boundary() { new_ucmd!() .args(&["-w8", "-s"]) .pipe_in("a\tbbb\n") .succeeds() .stdout_is("a\t\nbbb\n"); }
rust_cleaned_test_functions.jsonl/23285
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 119 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 61187, 3752, 17344, 11898, 13533, 54004, 368, 341, 262, 501, 68887, 2277, 0, 741, 286, 659, 2116, 2099, 1183, 12, 86, 23, 497, 6523, 82, 14108, 286, 659, 13768, 1243, 445, 64, 4955, 53151, 1699,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_calculate_power_consumption() { let input: Vec<String> = vec![ "00100", "11110", "10110", "10111", "10101", "01111", "00111", "11100", "10000", "11001", "00010", "01010", ].iter().map(|&s| s.into()).collect(); let result = calculate_power_consumption(&input); assert_eq!(result, 198); }
rust_cleaned_test_functions.jsonl/20057
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 364 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 24005, 11207, 20421, 69870, 560, 368, 341, 286, 1077, 1946, 25, 11312, 3464, 29, 4035, 310, 7486, 90515, 394, 330, 15, 15, 16, 15, 15, 756, 394, 330, 16, 16, 16, 16, 15, 756, 394, 330, 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_decode_sxth_w() { assert_eq!( decode_32(0xfa0ffa8a), Instruction::SXTH { params: Reg2UsizeParams { rd: Reg::R10, rm: Reg::R10, rotation: 0 }, thumb32: true, } ); }
rust_cleaned_test_functions.jsonl/64826
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 206 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15227, 643, 87, 339, 1670, 368, 341, 1066, 262, 2060, 10714, 33673, 286, 16895, 62, 18, 17, 7, 15, 48890, 15, 71942, 23, 64, 1326, 286, 29051, 486, 90488, 3617, 341, 310, 3628, 25, 3184, 17, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_windows_path() { assert_eq!(PathBuf::from("C:\\path.txt"), Common::normalize_windows_path("c:/PATH.tXt")); assert_eq!(PathBuf::from("H:\\reka\\weza\\roman.txt"), Common::normalize_windows_path("h:/RekA/Weza\\roMan.Txt")); assert_eq!(PathBuf::from("T:\\a"), Common::normalize_windows_path("T:\\A")); assert_eq!(PathBuf::from("\\\\aBBa"), Common::normalize_windows_path("\\\\aBBa")); assert_eq!(PathBuf::from("a"), Common::normalize_windows_path("a")); assert_eq!(PathBuf::from(""), Common::normalize_windows_path("")); }
rust_cleaned_test_functions.jsonl/38125
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 267 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 58220, 2638, 368, 341, 286, 2060, 10714, 10297, 1820, 15064, 486, 1499, 445, 34, 23817, 2343, 3909, 3975, 7718, 486, 30590, 58220, 2638, 445, 66, 14375, 13593, 734, 55, 83, 4010, 286, 2060, 10714,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_medium() { let mut val = Vec::new(); val.resize(255, 0x12); wrap_in_sequence(&mut val); assert_eq!(vec![0x30, 0x81, 0xff, 0x12, 0x12, 0x12], val[..6].to_vec()); }
rust_cleaned_test_functions.jsonl/89556
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 103 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 54867, 368, 341, 262, 1077, 5206, 1044, 284, 11312, 486, 931, 543, 262, 1044, 17382, 7, 17, 20, 20, 11, 220, 15, 87, 16, 17, 317, 262, 15061, 1243, 23735, 2099, 6984, 1044, 317, 262, 2060, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_fold_literals_type_mismatches() { fold("true == true", "true"); fold("true == false", "false"); fold("true == null", "false"); fold("false == null", "false"); // relational operators convert its operands fold("null <= null", "true"); fold("null >= null", "true"); fold("null > null", "false"); fold("null < null", "false"); fold("false >= null", "true"); fold("false <= null", "true"); fold("false > null", "false"); fold("false < null", "false"); fold("true >= null", "true"); fold("true <= null", "false"); fold("true > null", "true"); fold("true < null", "false"); fold("true >= false", "true"); fold("true <= false", "false"); fold("true > false", "true"); fold("true < false", "false"); }
rust_cleaned_test_functions.jsonl/122213
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 303 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 61187, 49643, 1819, 717, 2142, 9118, 368, 341, 262, 11555, 445, 1866, 621, 830, 497, 330, 1866, 797, 262, 11555, 445, 1866, 621, 895, 497, 330, 3849, 797, 262, 11555, 445, 1866, 621, 845, 497, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_mint_initialize_with_governance() { new_test_ext().execute_with(|| { assert_eq!(Pallet::<Test>::total_balance(ASSET_ID, &TO_ACCOUNT), INIT_AMOUNT); Pallet::<Test>::mint_initialize_with_governance( Origin::root(), TRANSFER_AMOUNT, TO_ACCOUNT, TO_ACCOUNT, ) .expect("mint_initialize_with_governance should work"); assert_eq!( Pallet::<Test>::total_balance(ASSET_ID, &TO_ACCOUNT), INIT_AMOUNT + TRANSFER_AMOUNT ); ensure_admin_or_governance::<Test>(Origin::signed(TO_ACCOUNT), &ASSET_ID).expect( "mint_initialize_with_governance should add governance_origin to GovernanceRegistry", ); }); }
rust_cleaned_test_functions.jsonl/9173
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 276 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 717, 396, 40889, 6615, 1889, 6706, 681, 368, 341, 8638, 4452, 9927, 1005, 10257, 6615, 79453, 341, 197, 6948, 10714, 10297, 47, 7464, 27638, 2271, 6831, 5035, 29396, 7, 1911, 5884, 3450, 11, 609, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_generated_and_parse() { const KIND: SecureTokenKind = SecureTokenKind::Api; let token = SecureToken::generate(KIND); assert!(token.plaintext().starts_with(KIND.prefix())); assert_eq!( token.sha256, Sha256::digest(token.plaintext().as_bytes()).as_slice() ); let parsed = SecureToken::parse(KIND, token.plaintext()).expect("failed to parse back the token"); assert_eq!(parsed.sha256, token.sha256); }
rust_cleaned_test_functions.jsonl/90682
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 239 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 67313, 8378, 21039, 368, 341, 286, 733, 9297, 25, 34502, 3323, 10629, 284, 34502, 3323, 10629, 486, 6563, 401, 286, 1077, 3950, 284, 34502, 3323, 486, 19366, 16738, 5245, 317, 286, 2060, 10297, 58...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_zinc_parse_grid_meta() { let mut input = Cursor::new(r#"foo: T bar:M test:[12,34]"#.as_bytes()); let mut parser = Parser::make(&mut input).expect("Parser"); let meta = parse_grid_meta(&mut parser); assert_eq!( meta.ok(), Some(dict! {"foo"=> Value::make_true(), "bar" => Value::Marker, "test" => vec![Value::make_number(12.0),Value::make_number(34.0)].into()}) ) }
rust_cleaned_test_functions.jsonl/21735
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 239 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6415, 2840, 21039, 15604, 13381, 368, 341, 286, 1077, 5206, 1946, 284, 28067, 486, 931, 2601, 55543, 7975, 25, 350, 3619, 65207, 1273, 7259, 16, 17, 11, 18, 19, 19177, 87846, 300, 12524, 1423, 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_array_in_array() { check([[]] as [[usize; 0]; 1], Some(0)); check([[3.14f64, 2.71, 1.41], [1.73, 2.23, 2.44]], Some(48)); }
rust_cleaned_test_functions.jsonl/79680
{ "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, 3858, 1243, 3858, 368, 341, 262, 1779, 2561, 1294, 60, 438, 4318, 51878, 26, 220, 15, 5265, 220, 16, 1125, 4329, 7, 15, 1106, 262, 1779, 27119, 18, 13, 16, 19, 69, 21, 19, 11, 220, 17, 13,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_human_tie () { use crate::lib::model::player::Human; let mut h = Human::new(); h.chip = 1; h.bet = 1; h.tie(); //get chip back from bet assert!(h.chip == 2); //chips in bet get set back to zero assert!(h.bet == 0); }
rust_cleaned_test_functions.jsonl/125153
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 167 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 86247, 528, 645, 1719, 1476, 286, 990, 17717, 486, 2740, 486, 2528, 486, 3434, 486, 33975, 280, 286, 1077, 5206, 305, 284, 11097, 486, 931, 1428, 286, 305, 5329, 573, 284, 220, 16, 280, 286, 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_object_literal_initializer_string_literal() { assert_parse_success!( primary_expression(false, false), "{ 'id': true }", Expression::ObjectExpression { loc: Some(((1, 0), (1, 14)).into()), properties: vec![ObjectExpressionProperty::Property(Property { kind: PropertyKind::Init, key: Expression::Literal { value: Literal::StringLiteral(StringLiteral("id".to_string())), loc: Some(((1, 2), (1, 6)).into()), }, value: Expression::Literal { value: Literal::BooleanLiteral(BooleanLiteral(true)), loc: Some(((1, 8), (1, 12)).into()), }, method: false, shorthand: false, computed: false, loc: Some(((1, 2), (1, 12)).into()), })], } ); }
rust_cleaned_test_functions.jsonl/66476
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 522 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5314, 34100, 36462, 3904, 34100, 368, 341, 262, 2060, 21039, 18632, 33673, 286, 6028, 28068, 3576, 11, 895, 1326, 286, 13868, 364, 307, 1210, 830, 335, 756, 286, 16378, 486, 1190, 9595, 341, 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_check_ts_conflict() { let key = Key::from_raw(b"foo"); let mut lock = Lock::new( LockType::Put, vec![], 100.into(), 3, None, TimeStamp::zero(), 1, TimeStamp::zero(), ); let empty = Default::default(); // Ignore the lock if read ts is less than the lock version Lock::check_ts_conflict( Cow::Borrowed(&lock), &key, 50.into(), &empty, IsolationLevel::Si, ) .unwrap(); // Returns the lock if read ts >= lock version Lock::check_ts_conflict( Cow::Borrowed(&lock), &key, 110.into(), &empty, IsolationLevel::Si, ) .unwrap_err(); // Ignore locks that occurs in the `bypass_locks` set. Lock::check_ts_conflict( Cow::Borrowed(&lock), &key, 110.into(), &TsSet::from_u64s(vec![109]), IsolationLevel::Si, ) .unwrap_err(); Lock::check_ts_conflict( Cow::Borrowed(&lock), &key, 110.into(), &TsSet::from_u64s(vec![110]), IsolationLevel::Si, ) .unwrap_err(); Lock::check_ts_conflict( Cow::Borrowed(&lock), &key, 110.into(), &TsSet::from_u64s(vec![100]), IsolationLevel::Si, ) .unwrap(); Lock::check_ts_conflict( Cow::Borrowed(&lock), &key, 110.into(), &TsSet::from_u64s(vec![99, 101, 102, 100, 80]), IsolationLevel::Si, ) .unwrap(); // Ignore the lock if it is Lock or Pessimistic. lock.lock_type = LockType::Lock; Lock::check_ts_conflict( Cow::Borrowed(&lock), &key, 110.into(), &empty, IsolationLevel::Si, ) .unwrap(); lock.lock_type = LockType::Pessimistic; Lock::check_ts_conflict( Cow::Borrowed(&lock), &key, 110.into(), &empty, IsolationLevel::Si, ) .unwrap(); // Ignore the primary lock when reading the latest committed version by setting u64::MAX as ts lock.lock_type = LockType::Put; lock.primary = b"foo".to_vec(); Lock::check_ts_conflict( Cow::Borrowed(&lock), &key, TimeStamp::max(), &empty, IsolationLevel::Si, ) .unwrap(); // Should not ignore the primary lock of an async commit transaction even if setting u64::MAX as ts let async_commit_lock = lock.clone().use_async_commit(vec![]); Lock::check_ts_conflict( Cow::Borrowed(&async_commit_lock), &key, TimeStamp::max(), &empty, IsolationLevel::Si, ) .unwrap_err(); // Should not ignore the secondary lock even though reading the latest version lock.primary = b"bar".to_vec(); Lock::check_ts_conflict( Cow::Borrowed(&lock), &key, TimeStamp::max(), &empty, IsolationLevel::Si, ) .unwrap_err(); // Ignore the lock if read ts is less than min_commit_ts lock.min_commit_ts = 150.into(); Lock::check_ts_conflict( Cow::Borrowed(&lock), &key, 140.into(), &empty, IsolationLevel::Si, ) .unwrap(); Lock::check_ts_conflict( Cow::Borrowed(&lock), &key, 150.into(), &empty, IsolationLevel::Si, ) .unwrap_err(); Lock::check_ts_conflict( Cow::Borrowed(&lock), &key, 160.into(), &empty, IsolationLevel::Si, ) .unwrap_err(); }
rust_cleaned_test_functions.jsonl/71661
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2336 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 7200, 25023, 16059, 21242, 368, 341, 286, 1077, 1376, 284, 5309, 486, 1499, 16067, 1883, 1, 7975, 797, 286, 1077, 5206, 5296, 284, 15701, 486, 931, 1006, 310, 15701, 929, 486, 19103, 345, 310, 7...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_clone_in_other_thread() { let gil = Python::acquire_gil(); let py = gil.python(); let obj = get_object(py); let count = obj.get_refcnt(py); let t = std::thread::spawn(move || { // Cloning without GIL should not update reference count #[allow(clippy::redundant_clone)] let _ = obj.clone(); assert_eq!( count, obj.get_refcnt(unsafe { Python::assume_gil_acquired() }) ); // Return obj so original thread can continue to use obj }); let obj = t.join().unwrap(); let ptr = NonNull::new(obj.as_ptr()).unwrap(); assert_eq!(&POOL.pointer_ops.lock().0, &vec![ptr]); assert_eq!(&POOL.pointer_ops.lock().1, &vec![ptr]); // Re-acquring GIL will clear these pending changes drop(gil); let gil = Python::acquire_gil(); assert!(POOL.pointer_ops.lock().0.is_empty()); assert!(POOL.pointer_ops.lock().1.is_empty()); // Overall count is still unchanged assert_eq!(count, obj.get_refcnt(gil.python())); }
rust_cleaned_test_functions.jsonl/25433
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 595 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 54742, 1243, 30456, 10814, 368, 341, 286, 1077, 342, 321, 284, 13027, 486, 580, 984, 1889, 321, 543, 286, 1077, 4510, 284, 342, 321, 43193, 543, 286, 1077, 2839, 284, 633, 5314, 46827, 317, 286,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_gen_expanded_code_blocks() -> io::Result<()> { let entities = setup(); const ENTITY_FILES: [&str; 6] = [ include_str!("../../tests/expanded/cake.rs"), include_str!("../../tests/expanded/cake_filling.rs"), include_str!("../../tests/expanded/filling.rs"), include_str!("../../tests/expanded/fruit.rs"), include_str!("../../tests/expanded/vendor.rs"), include_str!("../../tests/expanded/rust_keyword.rs"), ]; assert_eq!(entities.len(), ENTITY_FILES.len()); for (i, entity) in entities.iter().enumerate() { let mut reader = BufReader::new(ENTITY_FILES[i].as_bytes()); let mut lines: Vec<String> = Vec::new(); reader.read_until(b';', &mut Vec::new())?; let mut line = String::new(); while reader.read_line(&mut line)? > 0 { lines.push(line.to_owned()); line.clear(); } let content = lines.join(""); let expected: TokenStream = content.parse().unwrap(); let generated = EntityWriter::gen_expanded_code_blocks(entity, &crate::WithSerde::None) .into_iter() .skip(1) .fold(TokenStream::new(), |mut acc, tok| { acc.extend(tok); acc }); assert_eq!(expected.to_string(), generated.to_string()); } Ok(()) }
rust_cleaned_test_functions.jsonl/76350
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 771 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 16322, 14214, 6465, 4136, 25201, 368, 1464, 6399, 486, 2077, 71698, 341, 286, 1077, 14744, 284, 6505, 543, 286, 733, 73871, 48010, 25, 34336, 495, 26, 220, 21, 60, 284, 2278, 310, 2924, 2895, 17...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
#[test] fn test_parse_linear_gradient_3() { assert_eq!( parse_style_background_content( "repeating-linear-gradient(50deg, blue, yellow, #00FF00)" ), Ok(StyleBackgroundContent::LinearGradient(LinearGradient { direction: Direction::Angle(50.0.into()), extend_mode: ExtendMode::Repeat, stops: vec![ GradientStopPre { offset: Some(PercentageValue::new(0.0)), color: ColorU { r: 0, g: 0, b: 255, a: 255 }, }, GradientStopPre { offset: Some(PercentageValue::new(50.0)), color: ColorU { r: 255, g: 255, b: 0, a: 255 }, }, GradientStopPre { offset: Some(PercentageValue::new(100.0)), color: ColorU { r: 0, g: 255, b: 0, a: 255 }, } ], })) ); }
rust_cleaned_test_functions.jsonl/114005
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1049 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 40674, 49482, 62, 18, 368, 341, 286, 2060, 10714, 33673, 310, 4715, 15117, 24103, 7495, 1006, 394, 330, 265, 64877, 61299, 42738, 7, 20, 15, 16508, 11, 6303, 11, 13753, 11, 671, 15, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_str_container() { fn sum_len(v: &[&str]) -> uint { v.iter().map(|x| x.len()).sum() } let s = String::from_str("01234"); assert_eq!(5, sum_len(&["012", "", "34"])); assert_eq!(5, sum_len(&[&String::from_str("01"), &String::from_str("2"), &String::from_str("34"), &String::from_str("")])); assert_eq!(5, sum_len(&[&s])); }
rust_cleaned_test_functions.jsonl/46131
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 309 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2895, 15847, 368, 341, 286, 5168, 2629, 6043, 3747, 25, 44590, 5, 495, 2467, 1464, 2622, 341, 310, 348, 19471, 1005, 2186, 22428, 87, 91, 856, 19406, 6011, 1242, 741, 286, 555, 286, 1077, 274, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_pull_request_time_pruning() { let node = Node::new_localhost(); let cluster_info = Arc::new(ClusterInfo::new_with_invalid_keypair(node.info)); let entrypoint_pubkey = solana_sdk::pubkey::new_rand(); let entrypoint = ContactInfo::new_localhost(&entrypoint_pubkey, timestamp()); cluster_info.set_entrypoint(entrypoint); let mut rng = rand::thread_rng(); let shred_version = cluster_info.my_shred_version(); let mut peers: Vec<Pubkey> = vec![]; const NO_ENTRIES: usize = CRDS_UNIQUE_PUBKEY_CAPACITY + 128; let data: Vec<_> = repeat_with(|| { let keypair = Keypair::new(); peers.push(keypair.pubkey()); let mut rand_ci = ContactInfo::new_rand(&mut rng, Some(keypair.pubkey())); rand_ci.shred_version = shred_version; rand_ci.wallclock = timestamp(); CrdsValue::new_signed(CrdsData::ContactInfo(rand_ci), &keypair) }) .take(NO_ENTRIES) .collect(); let mut timeouts = HashMap::new(); timeouts.insert(Pubkey::default(), CRDS_GOSSIP_PULL_CRDS_TIMEOUT_MS * 4); assert_eq!( (0, 0, NO_ENTRIES), cluster_info.handle_pull_response(&entrypoint_pubkey, data, &timeouts) ); let now = timestamp(); for peer in peers { cluster_info .gossip .write() .unwrap() .mark_pull_request_creation_time(&peer, now); } assert_eq!( cluster_info .gossip .read() .unwrap() .pull .pull_request_time .len(), CRDS_UNIQUE_PUBKEY_CAPACITY ); }
rust_cleaned_test_functions.jsonl/66595
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 932 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 65693, 7893, 3009, 5294, 37202, 368, 341, 286, 1077, 2436, 284, 6018, 486, 931, 62, 8301, 543, 286, 1077, 10652, 3109, 284, 19689, 486, 931, 43644, 4993, 1731, 486, 931, 6615, 31433, 3097, 12670, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_check_time_request_limit() { let keypair = Keypair::new(); let mut faucet = Faucet::new(keypair, None, Some(3), None); assert!(faucet.check_time_request_limit(1)); faucet.request_current = 3; assert!(!faucet.check_time_request_limit(1)); faucet.request_current = 1; assert!(!faucet.check_time_request_limit(u64::MAX)); }
rust_cleaned_test_functions.jsonl/117720
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 192 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 7200, 3009, 7893, 14763, 368, 341, 286, 1077, 1376, 12670, 284, 6569, 1082, 1310, 486, 931, 543, 286, 1077, 5206, 71453, 284, 96362, 295, 486, 931, 4857, 12670, 11, 2240, 11, 4329, 7, 18, 701, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_der_seq_dn() { let empty = &b""[..]; let bytes = [ 0x30, 0x45, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x46, 0x52, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0c, 0x0a, 0x53, 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x0c, 0x18, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, 0x67, 0x69, 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, 0x20, 0x4c, 0x74, 0x64, ]; let expected = DerObject::from_seq(vec![ DerObject::from_set(vec![DerObject::from_seq(vec![ DerObject::from_obj(BerObjectContent::OID(Oid::from(&[2, 5, 4, 6]).unwrap())), // countryName DerObject::from_obj(BerObjectContent::PrintableString("FR")), ])]), DerObject::from_set(vec![DerObject::from_seq(vec![ DerObject::from_obj(BerObjectContent::OID(Oid::from(&[2, 5, 4, 8]).unwrap())), // stateOrProvinceName DerObject::from_obj(BerObjectContent::UTF8String("Some-State")), ])]), DerObject::from_set(vec![DerObject::from_seq(vec![ DerObject::from_obj(BerObjectContent::OID(Oid::from(&[2, 5, 4, 10]).unwrap())), // organizationName DerObject::from_obj(BerObjectContent::UTF8String("Internet Widgits Pty Ltd")), ])]), ]); assert_eq!(parse_der(&bytes), Ok((empty, expected))); }
rust_cleaned_test_functions.jsonl/45885
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 789 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 35345, 14486, 69799, 368, 341, 262, 1077, 4287, 284, 609, 65, 3014, 95874, 935, 262, 1077, 5820, 284, 2278, 286, 220, 15, 87, 18, 15, 11, 220, 15, 87, 19, 20, 11, 220, 15, 87, 18, 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...
1
#[test] fn test_pyerr_cause() { Python::with_gil(|py| { let err = py .run("raise Exception('banana')", None, None) .expect_err("raising should have given us an error"); assert!(err.cause(py).is_none()); let err = py .run( "raise Exception('banana') from Exception('apple')", None, None, ) .expect_err("raising should have given us an error"); let cause = err .cause(py) .expect("raising from should have given us a cause"); assert_eq!(cause.to_string(), "Exception: apple"); err.set_cause(py, None); assert!(err.cause(py).is_none()); let new_cause = exceptions::PyValueError::new_err("orange"); err.set_cause(py, Some(new_cause)); let cause = err .cause(py) .expect("set_cause should have given us a cause"); assert_eq!(cause.to_string(), "ValueError: orange"); }); }
rust_cleaned_test_functions.jsonl/56599
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 604 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 40291, 615, 666, 3454, 368, 341, 286, 13027, 486, 4197, 1889, 321, 22428, 3288, 91, 341, 310, 1077, 1848, 284, 4510, 198, 394, 659, 6108, 445, 18704, 4112, 492, 87747, 863, 497, 2240, 11, 2240, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_convert_utf8_to_latin1_lossy() { let mut reference: Vec<u8> = Vec::with_capacity(256); reference.resize(256, 0); let mut src16: Vec<u16> = Vec::with_capacity(256); src16.resize(256, 0); for i in 0..256 { src16[i] = i as u16; reference[i] = i as u8; } let src = String::from_utf16(&src16[..]).unwrap(); let mut dst: Vec<u8> = Vec::with_capacity(src.len()); dst.resize(src.len(), 0); let len = convert_utf8_to_latin1_lossy(src.as_bytes(), &mut dst[..]); dst.truncate(len); assert_eq!(dst, reference); }
rust_cleaned_test_functions.jsonl/27314
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 336 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 34910, 39453, 23, 2346, 907, 14768, 16, 11193, 88, 368, 341, 286, 1077, 5206, 5785, 25, 11312, 34837, 23, 29, 284, 11312, 486, 4197, 35603, 7, 17, 20, 21, 317, 286, 5785, 17382, 7, 17, 20, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_reduce_into_unknown_currency() { let bank = Bank::new(); assert_eq!(Money::new(1.0, "BTC"), bank.reduce(&dollar(9000.0), "BTC")); }
rust_cleaned_test_functions.jsonl/133363
{ "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, 64596, 45514, 57507, 34710, 368, 341, 286, 1077, 6073, 284, 8547, 486, 931, 543, 286, 2060, 10714, 10297, 24786, 486, 931, 7, 16, 13, 15, 11, 330, 59118, 3975, 6073, 23792, 2099, 67, 21295, 7, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_numeric() { let seeds: Vec<Box<dyn FieldResolveCell>> = vec![Box::new(NumericResolveCell::get_seed())]; let mut resolver = CellResolver::new(seeds); let input: DeriveInput = parse_quote! { #[Table(name="test_table", indexes( integer(columns("integer"), unique=true) ))] pub struct Test { integer: u32 } }; if let Err(e) = resolver.parse(input, "test") { panic!(e.to_string()) }; let definitions = resolver.get_definitions().unwrap(); let expect_definition = TableDefinition { name: "test_table".to_string(), indexes: vec![IndexDefinition { name: "integer".to_string(), method: IndexMethod::BTree, columns: vec!["integer".to_string()], unique: true, }], columns: vec![ ColumnDefinition { name: "__test_id".to_string(), column_type: DatabaseType::String, unique: true, auto_increase: false, is_primary_key: true, }, ColumnDefinition { name: "integer".to_string(), column_type: DatabaseType::UnsignedInteger, unique: false, auto_increase: false, is_primary_key: false, }, ], foreign_keys: vec![], auto_generated: false, }; assert_eq!(definitions[0], expect_definition); print!("{}", resolver.get_implements().unwrap().to_string()) }
rust_cleaned_test_functions.jsonl/119457
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 782 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 29418, 368, 341, 262, 1077, 19056, 25, 11312, 79852, 92846, 8601, 56808, 3599, 2452, 284, 7486, 20703, 1611, 486, 931, 8204, 12572, 56808, 3599, 486, 455, 33809, 2140, 4821, 262, 1077, 5206, 36220, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_server_split_region_twice() { let count = 5; let mut cluster = new_server_cluster(0, count); cluster.run(); let pd_client = Arc::clone(&cluster.pd_client); let (split_key, left_key, right_key) = (b"k22", b"k11", b"k33"); cluster.must_put(left_key, b"v1"); cluster.must_put(right_key, b"v3"); // Left and right key must be in same region before split. let region = pd_client.get_region(left_key).unwrap(); let region2 = pd_client.get_region(right_key).unwrap(); assert_eq!(region.get_id(), region2.get_id()); let (tx, rx) = channel(); let key = split_key.to_vec(); let c = Box::new(move |write_resp: WriteResponse| { let mut resp = write_resp.response; let admin_resp = resp.mut_admin_response(); let split_resp = admin_resp.mut_splits(); let mut regions = split_resp.take_regions().into_vec(); let mut d = regions.drain(..); let (left, right) = (d.next().unwrap(), d.next().unwrap()); assert_eq!(left.get_end_key(), key.as_slice()); assert_eq!(region2.get_start_key(), left.get_start_key()); assert_eq!(left.get_end_key(), right.get_start_key()); assert_eq!(region2.get_end_key(), right.get_end_key()); tx.send(right).unwrap(); }); cluster.split_region(&region, split_key, Callback::Write(c)); let region3 = rx.recv_timeout(Duration::from_secs(5)).unwrap(); cluster.must_put(split_key, b"v2"); let (tx1, rx1) = channel(); let c = Box::new(move |write_resp: WriteResponse| { assert!(write_resp.response.has_header()); assert!(write_resp.response.get_header().has_error()); assert!(!write_resp.response.has_admin_response()); tx1.send(()).unwrap(); }); cluster.split_region(&region3, split_key, Callback::Write(c)); rx1.recv_timeout(Duration::from_secs(5)).unwrap(); }
rust_cleaned_test_functions.jsonl/25765
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 814 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 12015, 17052, 20627, 54178, 558, 368, 341, 262, 1077, 1760, 284, 220, 20, 280, 262, 1077, 5206, 10652, 284, 501, 12015, 28441, 7, 15, 11, 1760, 317, 262, 10652, 7634, 543, 262, 1077, 7744, 8179,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_token_tree_last_child_is_white_space() { let source_file = ast::SourceFile::parse("f!({} );").ok().unwrap(); let macro_call = source_file.syntax().descendants().find_map(ast::MacroCall::cast).unwrap(); let token_tree = macro_call.token_tree().unwrap(); // Token Tree now is : // TokenTree // - T!['('] // - TokenTree // - T!['{'] // - T!['}'] // - WHITE_SPACE // - T![')'] let rbrace = token_tree.syntax().descendants_with_tokens().find(|it| it.kind() == T!['}']).unwrap(); let space = token_tree .syntax() .descendants_with_tokens() .find(|it| it.kind() == SyntaxKind::WHITESPACE) .unwrap(); let token_tree = insert_children( &rbrace.parent().unwrap(), InsertPosition::Last, &mut std::iter::once(space), ); // Token Tree now is : // TokenTree // - T!['{'] // - T!['}'] // - WHITE_SPACE let token_tree = ast::TokenTree::cast(token_tree).unwrap(); let tt = ast_to_token_tree(&token_tree).unwrap().0; assert_eq!(tt.delimiter, tt::Delimiter::Brace); }
rust_cleaned_test_functions.jsonl/86904
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 650 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6458, 11663, 12195, 17268, 6892, 44431, 14663, 368, 341, 286, 1077, 2530, 2458, 284, 11763, 486, 3608, 1703, 486, 6400, 445, 69, 0, 2306, 92, 6903, 1827, 562, 1005, 15454, 543, 286, 1077, 18072, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_read_line() { let in_buf: &[u8] = b"a\nb\nc"; let mut reader = BufReader::with_capacity(2, in_buf); let mut s = String::new(); reader.read_line(&mut s).unwrap(); assert_eq!(s, "a\n"); s.truncate(0); reader.read_line(&mut s).unwrap(); assert_eq!(s, "b\n"); s.truncate(0); reader.read_line(&mut s).unwrap(); assert_eq!(s, "c"); s.truncate(0); reader.read_line(&mut s).unwrap(); assert_eq!(s, ""); }
rust_cleaned_test_functions.jsonl/12411
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 296 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6443, 6528, 368, 341, 286, 1077, 304, 10363, 25, 44590, 84, 23, 60, 284, 293, 56693, 1699, 65, 59, 1016, 876, 286, 1077, 5206, 6604, 284, 69013, 5062, 486, 4197, 35603, 7, 17, 11, 304, 10363, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_api_quota_config() { let config = "1000/s".parse::<ApiQuotaConfig>().unwrap(); assert_eq!(config.max_burst.get(), 1000u32); assert_eq!(config.duration, QuotaDuration::Second); assert_eq!("1000/s", config.to_string().as_str()); }
rust_cleaned_test_functions.jsonl/29804
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 131 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11697, 97093, 5332, 368, 341, 286, 1077, 2193, 284, 330, 16, 15, 15, 15, 2687, 3263, 6400, 27638, 6563, 2183, 6089, 2648, 10483, 15454, 543, 286, 2060, 10714, 10297, 1676, 6678, 880, 32612, 670, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_display_mock_matching_regex_path() { let mock = mock("GET", Matcher::Regex(r"^/hello/\d+$".to_string())); assert_eq!("\r\nGET ^/hello/\\d+$ (regex)\r\n", format!("{}", mock)); }
rust_cleaned_test_functions.jsonl/82417
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 101 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14825, 34134, 70763, 41832, 2638, 368, 341, 262, 1077, 7860, 284, 7860, 445, 3806, 497, 60632, 486, 32464, 2601, 86490, 14, 14990, 34319, 67, 31719, 3263, 983, 3904, 25138, 262, 2060, 10714, 0, 49...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_double() { assert_eq!( Variant::VSingle(5.9).divide(Variant::VDouble(2.4)).unwrap(), Variant::VDouble(2.45833333333333) ); }
rust_cleaned_test_functions.jsonl/84605
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 145 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 24598, 368, 341, 394, 2060, 10714, 33673, 503, 39292, 486, 53, 10888, 7, 20, 13, 24, 568, 59394, 12410, 15341, 486, 53, 7378, 7, 17, 13, 19, 4579, 15454, 3148, 503, 39292, 486, 53, 7378, 7, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_new_user_info_claims() { let claims = CoreUserInfoClaims::new( StandardClaims { sub: SubjectIdentifier::new("the_subject".to_string()), name: Some(EndUserName::new("John Doe".to_string()).into()), given_name: None, family_name: None, middle_name: None, nickname: None, preferred_username: None, profile: None, picture: None, website: None, email: None, email_verified: None, gender: None, birthday: None, zoneinfo: None, locale: None, phone_number: None, phone_number_verified: None, address: None, updated_at: Some(Utc.timestamp(1544928548, 0)), }, Default::default(), ); assert_eq!( "{\"sub\":\"the_subject\",\"name\":\"John Doe\",\"updated_at\":1544928548}", serde_json::to_string(&claims).unwrap() ); let rsa_priv_key = CoreRsaPrivateSigningKey::from_pem(TEST_RSA_PRIV_KEY, None).unwrap(); let claims_jwt = CoreUserInfoJsonWebToken::new( claims, &rsa_priv_key, CoreJwsSigningAlgorithm::RsaSsaPkcs1V15Sha256, ) .unwrap(); assert_eq!( "eyJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJ0aGVfc3ViamVjdCIsIm5hbWUiOiJKb2huIERvZSIsInVwZGF0ZWRfY\ XQiOjE1NDQ5Mjg1NDh9.nJ7Buckt_p_ACXkyVRCQLqyaW8KhDsk5H9Nu7PdNf4daEcEWm-lGjoSTAfAbDPgHAZ\ 78knomgLgDxiGWrj1qdFTIEFep32I3q18VBP_DcMdyuQafipK6T98RgZFWP8YnxlxLPHeJQlRsdMpemHK4vxas\ ZD4A4aIn0K7z5J9RvrR3L7DWnc3fJQ0VU2v5QLePyqNWnFxks5eyl8Ios8JrZhwr4Q8GES8Q4Iw8Sz6W9vYpHK\ 2r1YdaACMM4g_TTtV91lpjn-Li2-HxW9NERdLvYvF6HwGIwbss26trp2yjNTARlxBUT6LR7y82oPIJKXIKL1GD\ YeSLeErhb6oTQ0a5gQ", serde_json::to_value(&claims_jwt).unwrap().as_str().unwrap() ); }
rust_cleaned_test_functions.jsonl/60970
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1297 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5921, 3317, 3109, 6794, 25676, 368, 341, 286, 1077, 8186, 284, 9518, 36158, 51133, 486, 931, 1006, 310, 11766, 51133, 341, 394, 1186, 25, 17450, 8714, 486, 931, 445, 1782, 28834, 3263, 983, 3904, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_packet_from_slice() { let p = Packet::from_slice(DATA_GLQ_1); assert_eq!(1i16, p.event_size); assert_eq!(&Action::GAMES_LIST_QUERY, &p.action); assert_eq!(&DATA_GLQ_1_FIXED_SIZE_4[3..6], &p.data[..]); assert_eq!(DATA_GLQ_1_FIXED_SIZE_4, &p.as_bytes()[..]); let p = Packet::from_slice(&DATA_GLQ_4); assert_eq!(4i16, p.event_size); assert_eq!(&Action::GAMES_LIST_QUERY, &p.action); assert_eq!(&DATA_GLQ_4[3..6], &p.data[..]); assert_eq!(DATA_GLQ_4, &p.as_bytes()[..]); // Action is undefined let p = Packet::from_slice(&DATA_UNDEFINED); assert_eq!(4i16, p.event_size); assert_eq!(&Action::UNKNOWN, &p.action); assert_eq!(&DATA_UNDEFINED[3..6], &p.data[..]); assert_eq!(DATA_UNDEFINED, &p.as_bytes()[..]); let p = Packet::from_slice(&DATA_UNKNOWN_3); assert_eq!(4i16, p.event_size); assert_eq!(&Action::UNKNOWN, &p.action); assert_eq!(&DATA_UNKNOWN_3[3..6], &p.data[..]); assert_eq!(DATA_UNKNOWN_3, &p.as_bytes()[..]); // empty `data` let p = Packet::from_slice(&DATA_UNKNOWN_3[0..3]); assert_eq!(4i16, p.event_size); assert_eq!(&Action::UNKNOWN, &p.action); assert_eq!(&[] as &[u8], &p.data[..]); assert_eq!(&[0x01, 0x00, 0x00], &p.as_bytes()[..]); }
rust_cleaned_test_functions.jsonl/54647
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 760 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21078, 5673, 26488, 368, 341, 286, 1077, 281, 284, 28889, 486, 1499, 26488, 59093, 36700, 48, 62, 16, 317, 286, 2060, 10714, 10297, 16, 72, 16, 21, 11, 281, 5773, 2368, 317, 286, 2060, 10714, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_dep_set_union() { let s = |x: &[u64]| DepSet::from(HashTrieSet::from_iter(x.iter().copied().map(Dep::new))); assert_eq!(s(&[4, 7]).union(&s(&[1, 4, 3])), s(&[1, 4, 3, 7])); assert_eq!(s(&[1, 4, 3]).union(&s(&[4, 7])), s(&[1, 4, 3, 7])); }
rust_cleaned_test_functions.jsonl/3506
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 162 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 49258, 2602, 51621, 368, 341, 286, 1077, 274, 284, 760, 87, 25, 44590, 84, 21, 19, 29685, 4148, 1649, 486, 1499, 7, 6370, 51, 7231, 1649, 486, 1499, 11723, 2075, 19471, 1005, 37728, 1122, 1005, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_xaddrs_extraction() { fn make_xml(relates_to: &str, xaddrs: &str) -> String { format!( r#"<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:d="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:dn="http://www.onvif.org/ver10/network/wsdl"> <SOAP-ENV:Header> <wsa:RelatesTo>{relates_to}</wsa:RelatesTo> </SOAP-ENV:Header> <SOAP-ENV:Body> <d:ProbeMatches> <d:ProbeMatch> <d:XAddrs>http://something.else</d:XAddrs> </d:ProbeMatch> <d:ProbeMatch> <d:Scopes>onvif://www.onvif.org/name/MyCamera2000</d:Scopes> <d:XAddrs>{xaddrs}</d:XAddrs> </d:ProbeMatch> </d:ProbeMatches> </SOAP-ENV:Body> </SOAP-ENV:Envelope> "#, relates_to = relates_to, xaddrs = xaddrs ) } let our_uuid = "uuid:84ede3de-7dec-11d0-c360-F01234567890"; let bad_uuid = "uuid:84ede3de-7dec-11d0-c360-F00000000000"; let input = vec![ make_xml(our_uuid, "http://addr_10"), make_xml(our_uuid, "http://addr_20 http://addr_21 http://addr_22"), make_xml(bad_uuid, "http://addr_30 http://addr_31"), ]; async fn is_addr_responding(uri: Url) -> bool { let responding_addrs = vec![ "http://addr_10".parse().unwrap(), "http://addr_21".parse().unwrap(), "http://addr_30".parse().unwrap(), ]; responding_addrs.contains(&uri) } let actual = input .iter() .filter_map(|xml| yaserde::de::from_str::<probe_matches::Envelope>(xml).ok()) .filter(|envelope| envelope.header.relates_to == our_uuid) .flat_map(|envelope| { tokio::runtime::Runtime::new() .unwrap() .block_on(get_responding_addr(envelope, is_addr_responding)) }) .collect::<Vec<_>>(); assert_eq!(actual.len(), 2); // OK: message UUID matches and addr responds assert!(actual.contains(&Device { url: Url::parse("http://addr_10").unwrap(), name: Some("MyCamera2000".to_string()) })); // OK: message UUID matches and one of addresses responds assert!( actual.contains(&Device { url: Url::parse("http://addr_21").unwrap(), name: Some("MyCamera2000".to_string()) }) || actual.contains(&Device { url: Url::parse("http://addr_22").unwrap(), name: Some("MyCamera2000".to_string()) }) ); // BAD: wrong message UUID assert!(!actual.contains(&Device { url: Url::parse("http://addr_30").unwrap(), name: Some("MyCamera2000".to_string()) })); }
rust_cleaned_test_functions.jsonl/38140
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1750 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3212, 718, 5428, 94842, 368, 341, 262, 5168, 1281, 23855, 49235, 973, 2346, 25, 609, 495, 11, 856, 718, 5428, 25, 609, 495, 8, 1464, 923, 341, 286, 3561, 33673, 310, 435, 55543, 1316, 6455, 23...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_crash_recovery_no_runtime_snapshot() { cleanup(); for _ in 0..100 { let child = unsafe { libc::fork() }; if child == 0 { run_without_snapshot() } else { let mut status = 0; unsafe { libc::waitpid( child, &mut status as *mut libc::c_int, 0, ); } if status != 9 { cleanup(); panic!("child exited abnormally"); } } } cleanup(); }
rust_cleaned_test_functions.jsonl/28555
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 363 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 32331, 988, 91475, 6536, 33232, 53265, 368, 341, 262, 21290, 543, 262, 369, 716, 304, 220, 15, 496, 16, 15, 15, 341, 286, 1077, 1682, 284, 19860, 314, 42142, 486, 44738, 368, 2605, 286, 421, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_accumulator_proof_sibling_overflow() { let element_hash = b"hello".test_only_hash(); let mut siblings = vec![]; for i in 0..MAX_ACCUMULATOR_PROOF_DEPTH as u8 + 1 { siblings.push(HashValue::new([i; 32])); } let root_hash = siblings .iter() .rev() .fold(element_hash, |hash, sibling_hash| { TestAccumulatorInternalNode::new(hash, *sibling_hash).hash() }); let proof = TestAccumulatorProof::new(siblings); assert!(proof.verify(root_hash, element_hash, 0).is_err()); }
rust_cleaned_test_functions.jsonl/33624
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 254 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 75837, 10511, 86757, 96328, 79073, 368, 341, 262, 1077, 2392, 8950, 284, 293, 1, 14990, 3263, 1944, 18410, 8950, 543, 262, 1077, 5206, 36683, 284, 7486, 0, 15078, 262, 369, 600, 304, 220, 15, 49...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_point_cross() { test_point_cross_case(1., Vector::new(1., 0., 0.), Vector::new(1., 0., 0.)); test_point_cross_case(2., Vector::new(1., 0., 0.), Vector::new(0., 1., 0.)); test_point_cross_case(2., Vector::new(0., 1., 0.), Vector::new(1., 0., 0.)); test_point_cross_case( 2. * 934f64.sqrt(), Vector::new(1., 2., 3.), Vector::new(-4., 5., -6.), ); }
rust_cleaned_test_functions.jsonl/70554
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 234 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6085, 35284, 368, 341, 286, 1273, 6085, 35284, 19096, 7, 16, 2572, 4196, 486, 931, 7, 16, 2572, 220, 15, 2572, 220, 15, 24389, 4196, 486, 931, 7, 16, 2572, 220, 15, 2572, 220, 15, 13, 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_vgg_single() { let canary = Pubkey::new_unique(); let mut hm: HashMap<Pubkey, Pubkey> = HashMap::new(); hm.insert(canary, Pubkey::new_unique()); let vgg = VoteGroupGenerator::new(&hm, hm.len()); for h in hm.keys() { let found = vgg.in_group_using_seeds(0, 1, *h); assert!(found); } let not_canary = Pubkey::new_unique(); assert_eq!(vgg.in_group_using_seeds(0, 1, not_canary), false); }
rust_cleaned_test_functions.jsonl/130331
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 255 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2273, 14398, 19487, 368, 341, 286, 1077, 646, 658, 284, 22611, 792, 486, 931, 21218, 543, 286, 1077, 5206, 49362, 25, 10528, 21604, 392, 792, 11, 22611, 792, 29, 284, 10528, 486, 931, 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...
2
#[test] fn test_sprite_fetch_full() { let mut context = Context::new(); let mut sprites = Sprites::new(); // set scanline position context.vpos = 200; context.hpos = 65; // init oam test in range sprites init_oam(&mut sprites.primary_oam); // fill oam entirely with sprites but only 8 on line set_sprite_full(&mut sprites.primary_oam, 200, 0x1, 0x2, 0x3, 0); set_sprite_full(&mut sprites.primary_oam, 200, 0x1, 0x2, 0x3, 1); set_sprite_full(&mut sprites.primary_oam, 200, 0x1, 0x2, 0x3, 2); set_sprite_full(&mut sprites.primary_oam, 200, 0x1, 0x2, 0x3, 3); set_sprite_full(&mut sprites.primary_oam, 200, 0x1, 0x2, 0x3, 4); set_sprite_full(&mut sprites.primary_oam, 200, 0x1, 0x2, 0x3, 5); set_sprite_full(&mut sprites.primary_oam, 200, 0x1, 0x2, 0x3, 6); set_sprite_full(&mut sprites.primary_oam, 200, 0x1, 0x2, 0x3, 7); for n in 8..31 { set_sprite(&mut sprites.primary_oam, 0x1, 0x8, n); } // sprite evaluation for _i in 65..=256 { sprites.process_sprite_evaluation(&mut context); context.hpos += 1; } // sprite tile fetch sprites.fetch_sprite_tile_data(&mut context); assert_eq!(sprites.sprites[7].valid_sprite, true); assert_eq!(sprites.sprites[7].sprite_line, 0); assert_eq!(sprites.sprites[7].xpos_counter, 1); assert_eq!(sprites.sprites[7].attribute, 2); assert_eq!(sprites.sprites[7].tile_index, 3); }
rust_cleaned_test_functions.jsonl/74933
{ "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, 45489, 11803, 16372, 368, 341, 197, 10217, 5206, 2266, 284, 9608, 486, 931, 543, 197, 10217, 5206, 46757, 284, 15515, 3611, 486, 931, 543, 197, 197, 322, 738, 8569, 1056, 2309, 198, 197, 28413, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_simple() { let mut doc = PackageDoc { path: "".to_string(), name: "".to_string(), headline: "".to_string(), description: None, members: BTreeMap::new(), examples: vec![Example { title: "".to_string(), content: r#" Example on using array.from ``` # import "array" < array.from(rows: [{_value: "a"}, {_value: "b"}]) > |> map(fn: (r) => ({r with _value: "b"})) ``` "# .to_string(), input: None, output: None, }], metadata: None, }; let mut executor = MockExecutor { code: expect![[r#"import "array" array.from(rows: [{_value: "a"}, {_value: "b"}]) |> yield(name: "input") |> map(fn: (r) => ({r with _value: "b"})) |> yield(name: "output")"#]], results: r#"#datatype,string,long,string #group,false,false,false #default,input,, ,result,table,_value ,,0,a ,,0,b #datatype,string,long,string #group,false,false,false #default,output,, ,result,table,_value ,,0,b ,,0,b "#, }; evaluate_package_examples(&mut doc, &mut executor).unwrap(); let example = doc.examples.first().unwrap(); let input = example.input.as_ref().unwrap().join("\n"); let output = example.output.as_ref().unwrap().join("\n"); let want_content = expect![[r#" Example on using array.from ```flux array.from(rows: [{_value: "a"}, {_value: "b"}]) |> map(fn: (r) => ({r with _value: "b"})) ``` "#]]; want_content.assert_eq(&example.content); let want_input = expect![[r#" | _value | | ------- | | a | | b | "#]]; want_input.assert_eq(input.as_str()); let want_output = expect![[r#" | _value | | ------- | | b | | b | "#]]; want_output.assert_eq(output.as_str()); }
rust_cleaned_test_functions.jsonl/30693
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1126 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 30015, 368, 341, 286, 1077, 5206, 4629, 284, 16906, 9550, 341, 310, 1815, 25, 44907, 983, 3904, 3148, 310, 829, 25, 44907, 983, 3904, 3148, 310, 31163, 25, 44907, 983, 3904, 3148, 310, 4008, 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_attach_block_devices() { let mut vmm = create_vmm_object(InstanceState::Uninitialized); let block_file = NamedTempFile::new().unwrap(); // Use Case 1: Root Block Device is not specified through PARTUUID. let root_block_device = BlockDeviceConfig { drive_id: String::from("root"), path_on_host: block_file.path().to_path_buf(), is_root_device: true, partuuid: None, is_read_only: false, rate_limiter: None, }; // Test that creating a new block device returns the correct output. assert!(vmm.insert_block_device(root_block_device.clone()).is_ok()); assert!(vmm.init_guest_memory().is_ok()); assert!(vmm.guest_memory.is_some()); assert!(vmm.setup_interrupt_controller().is_ok()); vmm.default_kernel_config(None); vmm.init_mmio_device_manager() .expect("Cannot initialize mmio device manager"); assert!(vmm.attach_block_devices().is_ok()); assert!(vmm.get_kernel_cmdline_str().contains("root=/dev/vda rw")); // Use Case 2: Root Block Device is specified through PARTUUID. let mut vmm = create_vmm_object(InstanceState::Uninitialized); let root_block_device = BlockDeviceConfig { drive_id: String::from("root"), path_on_host: block_file.path().to_path_buf(), is_root_device: true, partuuid: Some("0eaa91a0-01".to_string()), is_read_only: false, rate_limiter: None, }; // Test that creating a new block device returns the correct output. assert!(vmm.insert_block_device(root_block_device.clone()).is_ok()); assert!(vmm.init_guest_memory().is_ok()); assert!(vmm.guest_memory.is_some()); assert!(vmm.setup_interrupt_controller().is_ok()); vmm.default_kernel_config(None); vmm.init_mmio_device_manager() .expect("Cannot initialize mmio device manager"); assert!(vmm.attach_block_devices().is_ok()); assert!(vmm .get_kernel_cmdline_str() .contains("root=PARTUUID=0eaa91a0-01 rw")); // Use Case 3: Root Block Device is not added at all. let mut vmm = create_vmm_object(InstanceState::Uninitialized); let non_root_block_device = BlockDeviceConfig { drive_id: String::from("not_root"), path_on_host: block_file.path().to_path_buf(), is_root_device: false, partuuid: Some("0eaa91a0-01".to_string()), is_read_only: false, rate_limiter: None, }; // Test that creating a new block device returns the correct output. assert!(vmm .insert_block_device(non_root_block_device.clone()) .is_ok()); assert!(vmm.init_guest_memory().is_ok()); assert!(vmm.guest_memory.is_some()); assert!(vmm.setup_interrupt_controller().is_ok()); vmm.default_kernel_config(None); vmm.init_mmio_device_manager() .expect("Cannot initialize mmio device manager"); assert!(vmm.attach_block_devices().is_ok()); // Test that kernel commandline does not contain either /dev/vda or PARTUUID. assert!(!vmm.get_kernel_cmdline_str().contains("root=PARTUUID=")); assert!(!vmm.get_kernel_cmdline_str().contains("root=/dev/vda")); // Test that the non root device is attached. { let device_manager = vmm.mmio_device_manager.as_ref().unwrap(); assert!(device_manager .get_device( DeviceType::Virtio(TYPE_BLOCK), &non_root_block_device.drive_id ) .is_some()); } // Test partial update of block devices. let new_block = NamedTempFile::new().unwrap(); let path = String::from(new_block.path().to_path_buf().to_str().unwrap()); assert!(vmm .set_block_device_path("not_root".to_string(), path) .is_ok()); // Test partial update of block device fails due to invalid file. assert!(vmm .set_block_device_path("not_root".to_string(), String::from("dummy_path")) .is_err()); vmm.set_instance_state(InstanceState::Running); let path = String::from(new_block.path().to_path_buf().to_str().unwrap()); match vmm.set_block_device_path("not_root".to_string(), path) { Err(VmmActionError::DriveConfig(ErrorKind::User, DriveError::EpollHandlerNotFound)) => { } Err(e) => panic!("Unexpected error: {:?}", e), Ok(_) => { panic!("Updating block device path shouldn't be possible without an epoll handler.") } } }
rust_cleaned_test_functions.jsonl/93116
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2251 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 40719, 7113, 41334, 368, 341, 286, 1077, 5206, 348, 3821, 284, 1855, 2273, 3821, 5314, 7, 8846, 486, 1806, 36161, 317, 286, 1077, 2504, 2458, 284, 40459, 12151, 1703, 486, 931, 1005, 15454, 1428, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_symbol_lookup() { let mut p = Polar::new(); qvar(&mut p, "{x: 1}.x = res", "res", values![1]); qvar(&mut p, "{x: 1} = d and d.x = res", "res", values![1]); }
rust_cleaned_test_functions.jsonl/97628
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 94 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21179, 27464, 368, 341, 262, 1077, 5206, 281, 284, 55896, 486, 931, 543, 262, 2804, 947, 2099, 6984, 281, 11, 13868, 87, 25, 220, 16, 7810, 87, 284, 592, 497, 330, 416, 497, 2750, 20703, 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_create_rtree_with_parameters() { let tree: RTree<[f32; 2], TestParams> = RTree::new_with_params(); assert_eq!(tree.size(), 0); }
rust_cleaned_test_functions.jsonl/71300
{ "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, 8657, 1710, 9344, 6615, 18263, 368, 341, 286, 1077, 4916, 25, 431, 6533, 66746, 69, 18, 17, 26, 220, 17, 1125, 3393, 4870, 29, 284, 431, 6533, 486, 931, 6615, 6745, 543, 286, 2060, 10714, 1029...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_guild_2() { let broken_guild = r#"{ "d": { "afk_channel_id": null, "afk_timeout": 300, "application_id": null, "banner": null, "default_message_notifications": 0, "description": null, "discovery_splash": null, "embed_channel_id": null, "embed_enabled": true, "emojis": [ { "animated": false, "available": true, "id": "42", "managed": false, "name": "emmet", "require_colons": true, "roles": [] } ], "explicit_content_filter": 2, "features": [], "guild_id": "43", "icon": "44", "id": "45", "max_members": 250000, "max_presences": null, "mfa_level": 0, "name": "FooBar", "owner_id": "46", "preferred_locale": "en-US", "premium_subscription_count": null, "premium_tier": 0, "region": "us-central", "roles": [ { "color": 0, "hoist": false, "id": "47", "managed": false, "mentionable": false, "name": "@everyone", "permissions": 104324673, "position": 0 } ], "rules_channel_id": null, "splash": null, "system_channel_flags": 0, "system_channel_id": "48", "vanity_url_code": null, "verification_level": 4, "widget_channel_id": null, "widget_enabled": true }, "op": 0, "s": 1190911, "t": "GUILD_UPDATE" }"#; serde_json::from_str::<GatewayEvent>(broken_guild).unwrap(); }
rust_cleaned_test_functions.jsonl/114189
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 757 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1889, 1498, 62, 17, 368, 341, 286, 1077, 10865, 1889, 1498, 284, 435, 55543, 515, 220, 330, 67, 788, 341, 262, 330, 2577, 74, 14571, 842, 788, 845, 345, 262, 330, 2577, 74, 20537, 788, 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_config_set_protocol_preferences() { let mut config = Config::new(); let protocols = vec!["http/1.1", "spdy/3.1"]; config.set_protocol_preferences(&protocols).unwrap(); }
rust_cleaned_test_functions.jsonl/51677
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 102 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5332, 2602, 34880, 65513, 368, 341, 286, 1077, 5206, 2193, 284, 5532, 486, 931, 543, 286, 1077, 31785, 284, 7486, 0, 1183, 1254, 14, 16, 13, 16, 497, 330, 2154, 10258, 14, 18, 13, 16, 6332, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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() { let expr = SuffixExpr::new("key", "Rust"); let expected = SuffixExpr::<Unescaped> { column: Cow::Borrowed("key"), target: Cow::Borrowed("Rust"), _marker: PhantomData, }; assert_eq!(expected, expr) }
rust_cleaned_test_functions.jsonl/122490
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 157 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5921, 368, 341, 286, 1077, 15169, 284, 328, 13554, 16041, 486, 931, 445, 792, 497, 330, 49, 590, 797, 286, 1077, 3601, 284, 328, 13554, 16041, 27638, 1806, 65826, 29, 341, 310, 3250, 25, 21851, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_format_sexp() { assert_eq!( format_sexp(&"(a b: (c) (d) e: (f (g (h (MISSING i)))))".to_string()), r#" (a b: (c) (d) e: (f (g (h (MISSING i))))) "# .trim() .to_string() ); }
rust_cleaned_test_functions.jsonl/99087
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 196 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8955, 3453, 35725, 368, 341, 286, 2060, 10714, 33673, 310, 3561, 3453, 35725, 2099, 29209, 64, 293, 25, 320, 66, 8, 320, 67, 8, 384, 25, 320, 69, 320, 70, 320, 71, 320, 79470, 1718, 600, 593...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_hex_to_base64() { assert_eq!(hex_to_base64("49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d"), "SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t"); }
rust_cleaned_test_functions.jsonl/119095
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 144 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 32655, 2346, 7651, 21, 19, 368, 341, 286, 2060, 10714, 10297, 17308, 2346, 7651, 21, 19, 445, 19, 24, 17, 22, 21, 67, 17, 15, 21, 65, 21, 24, 21, 66, 21, 66, 21, 24, 21, 68, 21, 22, 17...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_valid_chain_fact() { let mut u = Unstructured::new(&crate::NOISE); let chain = build_seq(&mut u, 5, valid_chain()); check_seq(chain.as_slice(), valid_chain()).unwrap(); let hashes: Vec<_> = chain .iter() .map(|h| HeaderHash::with_data_sync(h)) .collect(); let backlinks: Vec<_> = chain .iter() .filter_map(|h| h.prev_header()) .cloned() .collect(); let header_seqs: Vec<_> = chain.iter().map(|h| h.header_seq()).collect(); // Ensure that the backlinks line up with the actual hashes assert_eq!(hashes[0..chain.len() - 1], backlinks[..]); // Ensure that the header seqs form a sequence assert_eq!(header_seqs, vec![0, 1, 2, 3, 4]); }
rust_cleaned_test_functions.jsonl/57357
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 399 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8337, 30583, 47805, 368, 341, 286, 1077, 5206, 575, 284, 1230, 51143, 486, 931, 2099, 61711, 486, 8996, 9133, 626, 286, 1077, 8781, 284, 1936, 14486, 2099, 6984, 575, 11, 220, 20, 11, 2697, 3058...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_unary_not_int() { let test_cases = vec![ (None, None), (0.into(), Some(1)), (1.into(), Some(0)), (2.into(), Some(0)), ((-1).into(), Some(0)), ]; for (arg, expect_output) in test_cases { let output = RpnFnScalarEvaluator::new() .push_param(arg) .evaluate(ScalarFuncSig::UnaryNotInt) .unwrap(); assert_eq!(output, expect_output, "{:?}", arg); } }
rust_cleaned_test_functions.jsonl/29746
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 318 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4907, 658, 7913, 4042, 368, 341, 286, 1077, 1273, 41427, 284, 7486, 90515, 310, 320, 4064, 11, 2240, 1326, 310, 320, 15, 39860, 1507, 4329, 7, 16, 6965, 310, 320, 16, 39860, 1507, 4329, 7, 15,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_rolling_var() { let values = &[1.0f64, 5.0, 3.0, 4.0]; let out = rolling_var(values, 2, 2, false, None); let out = out.as_any().downcast_ref::<PrimitiveArray<f64>>().unwrap(); let out = out.into_iter().map(|v| v.copied()).collect::<Vec<_>>(); assert_eq!(out, &[None, Some(8.0), Some(2.0), Some(0.5)]); let out = rolling_var(values, 2, 1, false, None); let out = out.as_any().downcast_ref::<PrimitiveArray<f64>>().unwrap(); let out = out .into_iter() .map(|v| v.copied().unwrap()) .collect::<Vec<_>>(); assert_eq!( format!("{:?}", out.as_slice()), format!("{:?}", &[f64::nan(), 8.0, 2.0, 0.5]) ); // test nan handling. let values = &[-10.0, 2.0, 3.0, f64::nan(), 5.0, 6.0, 7.0]; let out = rolling_var(values, 3, 3, false, None); let out = out.as_any().downcast_ref::<PrimitiveArray<f64>>().unwrap(); let out = out.into_iter().map(|v| v.copied()).collect::<Vec<_>>(); assert_eq!( format!("{:?}", out.as_slice()), format!( "{:?}", &[ None, None, Some(52.33333333333333), Some(f64::nan()), Some(f64::nan()), Some(f64::nan()), Some(0.9999999999999964) ] ) ); }
rust_cleaned_test_functions.jsonl/69986
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 903 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 62, 16210, 4612, 368, 341, 286, 1077, 2750, 284, 44590, 16, 13, 15, 69, 21, 19, 11, 220, 20, 13, 15, 11, 220, 18, 13, 15, 11, 220, 19, 13, 15, 4821, 286, 1077, 700, 284, 20097, 4612, 201...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_feature_grouping() { let component_list = vec![ ComponentManifest { url: String::from("foo"), manifest: String::from("empty"), features: ManifestContent { features: None }, }, ComponentManifest { url: String::from("bar"), manifest: String::from("empty"), features: ManifestContent { features: Some(vec![String::from("config-data")]) }, }, ]; let mut expected: HashMap<Option<String>, Vec<&ComponentManifest>> = HashMap::new(); expected.insert(None, vec![&component_list.get(0).unwrap()]); expected.insert(Some(String::from("config-data")), vec![&component_list.get(1).unwrap()]); assert_eq!(expected, group_by_feature(&component_list)); let component_list = vec![ ComponentManifest { url: String::from("foo"), manifest: String::from("empty"), features: ManifestContent { features: None }, }, ComponentManifest { url: String::from("bar"), manifest: String::from("empty"), features: ManifestContent { features: Some(vec![String::from("config-data")]) }, }, ComponentManifest { url: String::from("buzz"), manifest: String::from("empty"), features: ManifestContent { features: Some(vec![ String::from("config-data"), String::from("isolated-storage"), ]), }, }, ]; let mut expected: HashMap<Option<String>, Vec<&ComponentManifest>> = HashMap::new(); expected.insert(None, vec![&component_list.get(0).unwrap()]); expected.insert( Some(String::from("config-data")), vec![&component_list.get(1).unwrap(), &component_list.get(2).unwrap()], ); expected .insert(Some(String::from("isolated-storage")), vec![&component_list.get(2).unwrap()]); assert_eq!(expected, group_by_feature(&component_list)); }
rust_cleaned_test_functions.jsonl/28542
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1088 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 17069, 6288, 287, 368, 341, 286, 1077, 3692, 2019, 284, 7486, 90515, 310, 5578, 38495, 341, 394, 2515, 25, 923, 486, 1499, 445, 7975, 4461, 394, 14455, 25, 923, 486, 1499, 445, 3194, 4461, 394, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_size() { mock_mgp_once!(mgp_path_size_context, |_, size_ptr| unsafe { (*size_ptr) = 2; mgp_error::MGP_ERROR_NO_ERROR }); with_dummy!(Path, |path: &Path| { assert_eq!(path.size(), 2); }); }
rust_cleaned_test_functions.jsonl/101743
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 134 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2368, 368, 341, 262, 7860, 717, 21888, 7630, 10297, 12311, 79, 2638, 2368, 8467, 11, 760, 6878, 1379, 4348, 91, 19860, 341, 286, 4609, 2141, 4348, 8, 284, 220, 17, 280, 286, 13742, 79, 4096, 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_module_imported_functions_limit() { let limits = ModuleLimits { imported_functions: 0, ..Default::default() }; let mut module = Module::default(); module.functions.push(SignatureIndex::new(0)); assert!(limits.validate(&module).is_ok()); module.num_imported_funcs = 1; assert_eq!( limits.validate(&module).map_err(|e| e.to_string()), Err("imported function count of 1 exceeds the limit of 0".into()) ); }
rust_cleaned_test_functions.jsonl/48859
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 254 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10750, 18434, 291, 31708, 14763, 368, 341, 286, 1077, 13388, 284, 13711, 94588, 341, 310, 24928, 31708, 25, 220, 15, 345, 310, 5241, 3675, 486, 2258, 741, 286, 3634, 286, 1077, 5206, 4688, 284, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_vec3a_abs() { assert_eq!(Vec3A::zero().abs(), Vec3A::zero()); assert_eq!(Vec3A::one().abs(), Vec3A::one()); assert_eq!((-Vec3A::one()).abs(), Vec3A::one()); }
rust_cleaned_test_functions.jsonl/23505
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 97 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13251, 18, 64, 31170, 368, 341, 262, 2060, 10714, 10297, 10050, 18, 32, 486, 14154, 1005, 3435, 1507, 11312, 18, 32, 486, 14154, 1423, 262, 2060, 10714, 10297, 10050, 18, 32, 486, 603, 1005, 343...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_primitive_array_reader_temporal_types() { test_primitive_array_reader_one_type!( Int32Type, PhysicalType::INT32, "DATE", ArrowDate32, ArrowInt32, i32 ); test_primitive_array_reader_one_type!( Int32Type, PhysicalType::INT32, "TIME_MILLIS", ArrowTime32MillisecondArray, ArrowInt32, i32 ); test_primitive_array_reader_one_type!( Int64Type, PhysicalType::INT64, "TIME_MICROS", ArrowTime64MicrosecondArray, ArrowInt64, i64 ); test_primitive_array_reader_one_type!( Int64Type, PhysicalType::INT64, "TIMESTAMP_MILLIS", ArrowTimestampMillisecondType, ArrowInt64, i64 ); test_primitive_array_reader_one_type!( Int64Type, PhysicalType::INT64, "TIMESTAMP_MICROS", ArrowTimestampMicrosecondType, ArrowInt64, i64 ); }
rust_cleaned_test_functions.jsonl/10213
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 699 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 84087, 3858, 22306, 11771, 9819, 9763, 368, 341, 286, 1273, 84087, 3858, 22306, 11667, 1819, 33673, 310, 1333, 18, 17, 929, 345, 310, 27379, 929, 486, 3221, 18, 17, 345, 310, 330, 7097, 756, 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_sphere3f_radius_squared() { let r = 2.2f32; assert!(Sphere3f::from_radius(r).radius_squared() == (r * r)); }
rust_cleaned_test_functions.jsonl/77690
{ "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, 86973, 18, 69, 28936, 54641, 368, 341, 262, 1077, 435, 284, 220, 17, 13, 17, 69, 18, 17, 280, 262, 2060, 10297, 42959, 18, 69, 486, 1499, 28936, 2601, 568, 26715, 54641, 368, 621, 320, 81, 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
#[test] fn test_epoll_stdin_event() { let mut epoll_context = EpollContext::new().unwrap(); if unsafe { libc::isatty(libc::STDIN_FILENO as i32) } == 1 { epoll_context.enable_stdin_event(); assert_eq!( epoll_context.dispatch_table[epoll_context.stdin_index as usize].unwrap(), EpollDispatch::Stdin ); } epoll_context.enable_stdin_event(); epoll_context.disable_stdin_event(); assert!(epoll_context.dispatch_table[epoll_context.stdin_index as usize].is_none()); }
rust_cleaned_test_functions.jsonl/28146
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 337 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 12476, 965, 15656, 258, 6748, 368, 341, 286, 1077, 5206, 95861, 8467, 284, 11020, 965, 1972, 486, 931, 1005, 15454, 1428, 16885, 73363, 286, 421, 19860, 314, 42142, 486, 285, 22908, 44828, 66, 486...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_cross_cmp() { assert!(LogLevel::Debug > LogLevelFilter::Error); assert!(LogLevelFilter::Warn < LogLevel::Trace); assert!(LogLevelFilter::Off < LogLevel::Error); }
rust_cleaned_test_functions.jsonl/73933
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 96 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 35284, 35193, 368, 341, 260, 2060, 10297, 72676, 486, 7939, 861, 63321, 5632, 486, 1454, 317, 260, 2060, 10297, 72676, 5632, 486, 38244, 366, 63321, 486, 6550, 317, 260, 2060, 10297, 72676, 5632, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_hashing_create_commitment_with_user_defined_randomness() { let mut digest = Sha3_256::new(); let message = BigInt::one(); let commitment = HashCommitment::create_commitment_with_user_defined_randomness( &message, &BigInt::zero(), ); let message2: Vec<u8> = (&message).into(); digest.input(&message2); let bytes_blinding_factor: Vec<u8> = (&BigInt::zero()).into(); digest.input(&bytes_blinding_factor); let hash_result = BigInt::from(digest.result().as_ref()); assert_eq!(&commitment, &hash_result); }
rust_cleaned_test_functions.jsonl/63247
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 280 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8950, 287, 8657, 36346, 478, 6615, 3317, 52870, 22644, 2090, 368, 341, 286, 1077, 5206, 20882, 284, 27970, 18, 62, 17, 20, 21, 486, 931, 543, 286, 1077, 1943, 284, 62608, 486, 603, 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...
1
#[test] fn test_switch_threshold_use_gossip_votes() { let num_validators = 2; let (bank0, mut vote_simulator, total_stake) = setup_switch_test(2); let ancestors = vote_simulator.bank_forks.read().unwrap().ancestors(); let descendants = vote_simulator .bank_forks .read() .unwrap() .descendants() .clone(); let mut tower = Tower::default(); let other_vote_account = vote_simulator.vote_pubkeys[1]; // Last vote is 47 tower.record_vote(47, Hash::default()); // Trying to switch to another fork at 110 should fail assert_eq!( tower.check_switch_threshold( 110, &ancestors, &descendants, &vote_simulator.progress, total_stake, bank0.epoch_vote_accounts(0).unwrap(), &vote_simulator.latest_validator_votes_for_frozen_banks, &vote_simulator.heaviest_subtree_fork_choice, ), SwitchForkDecision::FailedSwitchThreshold(0, num_validators * 10000) ); // Adding a vote on the descendant shouldn't count toward the switch threshold vote_simulator.simulate_lockout_interval(50, (49, 100), &other_vote_account); assert_eq!( tower.check_switch_threshold( 110, &ancestors, &descendants, &vote_simulator.progress, total_stake, bank0.epoch_vote_accounts(0).unwrap(), &vote_simulator.latest_validator_votes_for_frozen_banks, &vote_simulator.heaviest_subtree_fork_choice, ), SwitchForkDecision::FailedSwitchThreshold(0, 20000) ); // Adding a later vote from gossip that isn't on the same fork should count toward the // switch threshold vote_simulator .latest_validator_votes_for_frozen_banks .check_add_vote( other_vote_account, 112, Some( vote_simulator .bank_forks .read() .unwrap() .get(112) .unwrap() .hash(), ), false, ); assert_eq!( tower.check_switch_threshold( 110, &ancestors, &descendants, &vote_simulator.progress, total_stake, bank0.epoch_vote_accounts(0).unwrap(), &vote_simulator.latest_validator_votes_for_frozen_banks, &vote_simulator.heaviest_subtree_fork_choice, ), SwitchForkDecision::SwitchProof(Hash::default()) ); // the switch proof will now fail since that validator's vote can no longer be // included in the switching proof vote_simulator.set_root(44); let ancestors = vote_simulator.bank_forks.read().unwrap().ancestors(); let descendants = vote_simulator .bank_forks .read() .unwrap() .descendants() .clone(); assert_eq!( tower.check_switch_threshold( 110, &ancestors, &descendants, &vote_simulator.progress, total_stake, bank0.epoch_vote_accounts(0).unwrap(), &vote_simulator.latest_validator_votes_for_frozen_banks, &vote_simulator.heaviest_subtree_fork_choice, ), SwitchForkDecision::FailedSwitchThreshold(0, 20000) ); }
rust_cleaned_test_functions.jsonl/61120
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2101 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 27652, 21858, 15951, 1889, 41473, 65116, 368, 341, 286, 1077, 1629, 8337, 2973, 284, 220, 17, 280, 286, 1077, 320, 17033, 15, 11, 5206, 6910, 18314, 10511, 11, 2790, 1261, 726, 8, 284, 6505, 276...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_create_payment_does_not_work_without_transaction() { new_test_ext().execute_with(|| { assert_ok!(<Payment as PaymentHandler<Test>>::create_payment( &PAYMENT_CREATOR, &PAYMENT_RECIPENT, CURRENCY_ID, 20, PaymentState::Created, Percent::from_percent(0), None, )); }); }
rust_cleaned_test_functions.jsonl/111998
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 144 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8657, 26696, 96374, 7913, 11498, 39904, 28884, 368, 341, 8638, 4452, 9927, 1005, 10257, 6615, 79453, 341, 197, 6948, 19817, 10297, 27, 20188, 438, 20453, 3050, 71273, 77595, 3182, 26696, 1006, 298, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_candidates() { let inturn : u64 = 7913472; let opponent : u64 = 251666496; let candidates : u64 = 33286000768; let ccands : u64 = B36::get_candidates(inturn, opponent); assert_eq!(candidates, ccands); }
rust_cleaned_test_functions.jsonl/124869
{ "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, 73553, 368, 341, 286, 1077, 304, 412, 549, 575, 21, 19, 284, 220, 22, 24, 16, 18, 19, 22, 17, 280, 286, 1077, 14704, 549, 575, 21, 19, 284, 220, 17, 20, 16, 21, 21, 21, 19, 24, 21, 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_vector_unit_vector() { let vector = Vector { x: 1.0, y: 2.0, z: 3.0, }; assert_approx_eq!(vector.unit_vector().len(), 1.0) }
rust_cleaned_test_functions.jsonl/134051
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 130 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 12247, 14832, 12247, 368, 341, 286, 1077, 4621, 284, 4196, 341, 310, 856, 25, 220, 16, 13, 15, 345, 310, 379, 25, 220, 17, 13, 15, 345, 310, 1147, 25, 220, 18, 13, 15, 345, 286, 3634, 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