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_angler_quest_status_sizewith() { let aqs = AnglerQuestStatus { completed_players: vec![TString::from("foo"), TString::from("bar")], angler_saved: TBool::True, target: AnglerQuestFish::Bonefish, }; assert_eq!(14, AnglerQuestStatus::size_with(&aqs)); }
rust_cleaned_test_functions.jsonl/75833
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 136 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 58060, 1536, 98015, 4773, 643, 449, 97809, 368, 341, 1066, 262, 1077, 264, 26358, 284, 7416, 1536, 19782, 2522, 341, 414, 8145, 46721, 25, 7486, 20703, 51, 703, 486, 1499, 445, 7975, 3975, 52226, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_iter_list() { let mut builder = get_list_builder(&DataType::Int32, 10, 10, ""); builder.append_series(&Series::new("", &[1, 2, 3])); builder.append_series(&Series::new("", &[3, 2, 1])); builder.append_series(&Series::new("", &[1, 1])); let ca = builder.finish(); ca.amortized_iter() .zip(ca.into_iter()) .for_each(|(s1, s2)| { assert!(s1.unwrap().as_ref().series_equal(&s2.unwrap())); }); }
rust_cleaned_test_functions.jsonl/4901
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 268 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11723, 2019, 368, 341, 286, 1077, 5206, 7363, 284, 633, 2019, 28532, 2099, 22653, 486, 1072, 18, 17, 11, 220, 16, 15, 11, 220, 16, 15, 11, 14498, 286, 7363, 2057, 35015, 2099, 25544, 486, 931,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_reject_conflict_with_generated_file() { let outdir = TempDir::new().unwrap(); let meta_far_path = outdir.path().join("meta.far"); let creation_manifest = CreationManifest::from_external_and_far_contents( BTreeMap::new(), btreemap! { "meta/contents".to_string() => "some-host-path".to_string(), "meta/package".to_string() => "host/meta/package".to_string() }, ) .unwrap(); let mut v = vec![]; let meta_package = MetaPackage::from_name_and_variant( "my-package-name".parse().unwrap(), "my-package-variant".parse().unwrap(), ); meta_package.serialize(&mut v).unwrap(); let file_system = FakeFileSystem { content_map: hashmap! { "some-host-path".to_string() => Vec::new(), "host/meta/package".to_string() => v }, }; let result = build_with_file_system( &creation_manifest, &meta_far_path, "published-name", &file_system, ); assert_matches!( result, Err(BuildError::ConflictingResource { conflicting_resource_path: path }) if path == "meta/contents".to_string() ); }
rust_cleaned_test_functions.jsonl/39058
{ "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, 1288, 583, 16059, 21242, 6615, 67313, 2458, 368, 341, 286, 1077, 700, 3741, 284, 19944, 6184, 486, 931, 1005, 15454, 543, 286, 1077, 8823, 67513, 2638, 284, 700, 3741, 3875, 1005, 5987, 445, 5490,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_empty_options() { // all END_OF_OPTIONS let bytes = [END_OF_OPTIONS; 64]; let options = Options::<_, DummyOptionImpl>::parse(&bytes[..]).unwrap(); assert_eq!(options.iter().count(), 0); // all NOP let bytes = [NOP; 64]; let options = Options::<_, DummyOptionImpl>::parse(&bytes[..]).unwrap(); assert_eq!(options.iter().count(), 0); }
rust_cleaned_test_functions.jsonl/15734
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 232 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15124, 8743, 368, 341, 310, 442, 678, 11176, 14234, 36321, 198, 310, 1077, 5820, 284, 508, 4689, 14234, 36321, 26, 220, 21, 19, 935, 310, 1077, 2606, 284, 14566, 27638, 6878, 50567, 5341, 9673, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_docbitset_skip() { { let mut docset = create_docbitset(&[1, 5, 6, 7, 5112], 10_000); assert_eq!(docset.seek(7), 7); assert_eq!(docset.doc(), 7); assert_eq!(docset.advance(), 5112); assert_eq!(docset.doc(), 5112); assert_eq!(docset.advance(), TERMINATED); } { let mut docset = create_docbitset(&[1, 5, 6, 7, 5112], 10_000); assert_eq!(docset.seek(3), 5); assert_eq!(docset.doc(), 5); assert_eq!(docset.advance(), 6); } { let mut docset = create_docbitset(&[5112], 10_000); assert_eq!(docset.seek(5112), 5112); assert_eq!(docset.doc(), 5112); assert_eq!(docset.advance(), TERMINATED); } { let mut docset = create_docbitset(&[5112], 10_000); assert_eq!(docset.seek(5113), TERMINATED); assert_eq!(docset.advance(), TERMINATED); } { let mut docset = create_docbitset(&[5112], 10_000); assert_eq!(docset.seek(5111), 5112); assert_eq!(docset.doc(), 5112); assert_eq!(docset.advance(), TERMINATED); } { let mut docset = create_docbitset(&[1, 5, 6, 7, 5112, 5500, 6666], 10_000); assert_eq!(docset.seek(5112), 5112); assert_eq!(docset.doc(), 5112); assert_eq!(docset.advance(), 5500); assert_eq!(docset.doc(), 5500); assert_eq!(docset.advance(), 6666); assert_eq!(docset.doc(), 6666); assert_eq!(docset.advance(), TERMINATED); } { let mut docset = create_docbitset(&[1, 5, 6, 7, 5112, 5500, 6666], 10_000); assert_eq!(docset.seek(5111), 5112); assert_eq!(docset.doc(), 5112); assert_eq!(docset.advance(), 5500); assert_eq!(docset.doc(), 5500); assert_eq!(docset.advance(), 6666); assert_eq!(docset.doc(), 6666); assert_eq!(docset.advance(), TERMINATED); } { let mut docset = create_docbitset(&[1, 5, 6, 7, 5112, 5513, 6666], 10_000); assert_eq!(docset.seek(5111), 5112); assert_eq!(docset.doc(), 5112); assert_eq!(docset.advance(), 5513); assert_eq!(docset.doc(), 5513); assert_eq!(docset.advance(), 6666); assert_eq!(docset.doc(), 6666); assert_eq!(docset.advance(), TERMINATED); } }
rust_cleaned_test_functions.jsonl/13268
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1441 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 18869, 77615, 44830, 368, 341, 286, 341, 310, 1077, 5206, 4629, 746, 284, 1855, 18869, 77615, 2099, 58, 16, 11, 220, 20, 11, 220, 21, 11, 220, 22, 11, 220, 20, 16, 16, 17, 1125, 220, 16, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_make_manager() { let config = get_test_config(); let mut mgr = NetworkManager::new(&config); assert_eq!(mgr.get_route_changes().len(), 0); }
rust_cleaned_test_functions.jsonl/108481
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 87 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 28230, 12144, 368, 341, 286, 1077, 2193, 284, 633, 4452, 5332, 543, 286, 1077, 5206, 57897, 284, 8141, 2043, 486, 931, 2099, 1676, 317, 286, 2060, 10714, 10297, 48292, 670, 28109, 47526, 1005, 289...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_select_order() { use phala_mq::{Message, MessageDispatcher}; let sender = MessageOrigin::Pallet(b"sender1".to_vec()); let mut dispatcher = MessageDispatcher::new(); let mut sub0 = dispatcher.subscribe(*b"path0"); let mut sub1 = dispatcher.subscribe(*b"path1"); dispatcher.dispatch(Message::new(sender.clone(), *b"path0", b"0".to_vec())); dispatcher.dispatch(Message::new(sender.clone(), *b"path1", b"1".to_vec())); dispatcher.dispatch(Message::new(sender.clone(), *b"path0", b"2".to_vec())); dispatcher.dispatch(Message::new(sender.clone(), *b"path0", b"3".to_vec())); dispatcher.dispatch(Message::new(sender.clone(), *b"path1", b"4".to_vec())); let mut payloads = Vec::new(); loop { let ok = phala_mq::select! { msg = sub0 => { payloads.push(msg.unwrap().0); }, msg = sub1 => { payloads.push(msg.unwrap().0); }, }; if ok.is_none() { break; } } assert_eq!(payloads, [0, 1, 2, 3, 4]); }
rust_cleaned_test_functions.jsonl/76744
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 514 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13051, 7869, 368, 341, 262, 990, 1319, 6053, 717, 80, 22964, 2052, 11, 4856, 21839, 2315, 262, 1077, 4646, 284, 4856, 13298, 486, 47, 7464, 1883, 1, 11644, 16, 3263, 983, 13251, 1423, 262, 1077,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_parse_text_in_the_middle() { let mut ps = ParseStream { content: "<b>Hello</b>".to_string(), cursor: 3, }; let parts = ps.parse_text().unwrap(); assert_eq!(ps.cursor, 8); assert_eq!(parts.len(), 1); assert!(if let Some(StringPart::Normal(s)) = parts.get(0) { s == "Hello" } else { false }); }
rust_cleaned_test_functions.jsonl/41139
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 236 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 4326, 1243, 16068, 62580, 368, 341, 286, 1077, 5206, 4726, 284, 14775, 3027, 341, 310, 2213, 25, 4055, 65, 79497, 522, 65, 52946, 983, 3904, 3148, 310, 8128, 25, 220, 18, 345, 286, 3634, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_reset_untracked_subdir() { let (_td, repo) = repo_init().unwrap(); let root = repo.path().parent().unwrap(); let repo_path = root.as_os_str().to_str().unwrap(); { fs::create_dir_all(&root.join("foo/bar")).unwrap(); File::create(&root.join("foo/bar/baz.txt")) .unwrap() .write_all(b"test\nfoo") .unwrap(); } debug_cmd_print(repo_path, "git status"); assert_eq!(get_statuses(repo_path), (1, 0)); reset_workdir(repo_path, "foo/bar").unwrap(); debug_cmd_print(repo_path, "git status"); assert_eq!(get_statuses(repo_path), (0, 0)); }
rust_cleaned_test_functions.jsonl/82917
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 374 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 18983, 4907, 58381, 5228, 3741, 368, 341, 286, 1077, 5453, 1296, 11, 15867, 8, 284, 15867, 6137, 1005, 15454, 543, 286, 1077, 3704, 284, 15867, 3875, 1005, 3765, 1005, 15454, 543, 286, 1077, 15867...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_not_so_complicated() { let lines = &[ "+------+----+", "| | |", "+------+ |", "| | |", "+---+-------+", ]; assert_eq!(2, count(lines)) }
rust_cleaned_test_functions.jsonl/40146
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 139 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 7913, 39833, 18177, 13724, 368, 341, 262, 1077, 5128, 284, 609, 9640, 286, 6630, 61247, 381, 10, 756, 286, 25203, 414, 760, 262, 760, 756, 286, 6630, 61247, 262, 760, 756, 286, 25203, 256, 760, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_agent_fails() { init!("true"); httpclient::set_next_u8_response(REGISTER_RESPONSE.to_vec()); //set response garbage let json_string = r#"{"id":"123"}"#; let c_json = CString::new(json_string).unwrap().into_raw(); let cb = return_types_u32::Return_U32::new().unwrap(); assert_eq!(vcx_agent_update_info(cb.command_handle, c_json, Some(cb.get_callback())), error::INVALID_OPTION.code_num); }
rust_cleaned_test_functions.jsonl/19371
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 313 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8882, 25730, 761, 6209, 368, 341, 286, 2930, 17223, 1866, 3071, 286, 1758, 2972, 486, 746, 11257, 7300, 23, 9655, 7, 46302, 35901, 2389, 13251, 13426, 442, 746, 2033, 25878, 198, 286, 1077, 2951, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_run_script_isolation() { // firejail tmpfs isolation not quite working inside docker if docker::in_docker() { return; } let dir = TempDir::new("repo_version.rs").expect("create temp dir for repo_version.rs test"); let parent_file = dir.path().join("private.txt"); { let mut file = fs::File::create(&parent_file).expect("create file"); file.write_all(b"I am a file").expect("write file"); } let sub_dir = dir.path().join("subdir"); fs::create_dir(&sub_dir).expect("create subdir"); let script_file = sub_dir.join("version.sh"); { let mut file = fs::File::create(&script_file).expect("create file"); file.write_all( br#" # no `set -e` on purpose: try to do them all! rm ../private.txt rm version.sh touch ../muahaha.txt touch muahaha.txt echo 1.2.3.4 "#, ) .expect("write file"); } assert_eq!("1.2.3.4", run_script("bash version.sh", &sub_dir).unwrap()); assert!( parent_file.exists(), "version scripts should not be able to delete files outside its directory" ); assert!( !dir.path().join("muahaha.txt").exists(), "version scripts should not be able to create files outside its directory" ); }
rust_cleaned_test_functions.jsonl/584
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 727 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14007, 14660, 6892, 34962, 368, 341, 286, 442, 3940, 73, 604, 4174, 3848, 30298, 537, 5008, 3238, 4766, 26588, 198, 286, 421, 26588, 486, 258, 814, 13659, 368, 341, 310, 470, 280, 286, 555, 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_perturbstate() { let distances = [1., 0.1, 3., 2., 9., 4., 0.8, 5.]; // argsort let z = vec![1, 6, 0, 3, 2, 5, 7, 4]; let switchpoint = 4; let a0 = PerturbState::new(&z, &distances, switchpoint, vec![0, 0, 0, 0]); // initial selection is the first zj [0] // This leads to: // distance/score: 0.1 // index: 1 // delta: -1 assert_eq!(a0.clone().gen_hash(), [0, -1, 0, 0]); assert_eq!(a0.score(), 0.1); assert_eq!(a0.selection, [0]); // This leads to: let mut ae = a0.clone(); ae.expand().unwrap(); assert_eq!(ae.gen_hash(), [0, -1, 1, 0]); assert_eq!(ae.score(), 0.1 + 0.8); assert_eq!(ae.selection, [0, 1]); // after shift operation selection is [1] // This leads to: // distance/ score: 0.8 // index: 2 // delta: 1 let mut a_s = a0.clone(); a_s.shift().unwrap(); assert_eq!(a_s.gen_hash(), [0, 0, 1, 0]); assert_eq!(a_s.score(), 0.8); assert_eq!(a_s.selection, [1]); }
rust_cleaned_test_functions.jsonl/107649
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 705 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 620, 529, 9048, 2454, 368, 341, 286, 1077, 26552, 284, 508, 16, 2572, 220, 15, 13, 16, 11, 220, 18, 2572, 220, 17, 2572, 220, 24, 2572, 220, 19, 2572, 220, 15, 13, 23, 11, 220, 20, 13, 9...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_put_zigzag_vlq_int() { let total = 64; let mut writer = BitWriter::new(total * 32); let values = random_numbers::<i32>(total); (0..total).for_each(|i| { assert!( writer.put_zigzag_vlq_int(values[i] as i64), "[{}]; put_zigzag_vlq_int() failed", i ); }); let mut reader = BitReader::from(writer.consume()); (0..total).for_each(|i| { let v = reader .get_zigzag_vlq_int() .expect("get_zigzag_vlq_int() should return OK"); assert_eq!( v as i32, values[i], "[{}]: expected {} but got {}", i, values[i], v ); }); }
rust_cleaned_test_functions.jsonl/115745
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 462 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15557, 6415, 343, 92674, 2273, 75, 80, 4042, 368, 341, 286, 1077, 2790, 284, 220, 21, 19, 280, 286, 1077, 5206, 6916, 284, 6495, 6492, 486, 931, 22842, 353, 220, 18, 17, 317, 286, 1077, 2750, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_eval_arith() { // It's nice if an operation and its arguments can fit on a single // line in the test program. use self::AssemblerEntry::*; use crate::constants::*; // Indices of marks in the assembly. let done = 0; let fail = 1; #[rustfmt::skip] let program = [ Op(DW_OP_const1u), U8(23), Op(DW_OP_const1s), U8((-23i8) as u8), Op(DW_OP_plus), Op(DW_OP_bra), Branch(fail), Op(DW_OP_const2u), U16(23), Op(DW_OP_const2s), U16((-23i16) as u16), Op(DW_OP_plus), Op(DW_OP_bra), Branch(fail), Op(DW_OP_const4u), U32(0x1111_2222), Op(DW_OP_const4s), U32((-0x1111_2222i32) as u32), Op(DW_OP_plus), Op(DW_OP_bra), Branch(fail), // Plus should overflow. Op(DW_OP_const1s), U8(0xff), Op(DW_OP_const1u), U8(1), Op(DW_OP_plus), Op(DW_OP_bra), Branch(fail), Op(DW_OP_const1s), U8(0xff), Op(DW_OP_plus_uconst), Uleb(1), Op(DW_OP_bra), Branch(fail), // Minus should underflow. Op(DW_OP_const1s), U8(0), Op(DW_OP_const1u), U8(1), Op(DW_OP_minus), Op(DW_OP_const1s), U8(0xff), Op(DW_OP_ne), Op(DW_OP_bra), Branch(fail), Op(DW_OP_const1s), U8(0xff), Op(DW_OP_abs), Op(DW_OP_const1u), U8(1), Op(DW_OP_minus), Op(DW_OP_bra), Branch(fail), Op(DW_OP_const4u), U32(0xf078_fffe), Op(DW_OP_const4u), U32(0x0f87_0001), Op(DW_OP_and), Op(DW_OP_bra), Branch(fail), Op(DW_OP_const4u), U32(0xf078_fffe), Op(DW_OP_const4u), U32(0xf000_00fe), Op(DW_OP_and), Op(DW_OP_const4u), U32(0xf000_00fe), Op(DW_OP_ne), Op(DW_OP_bra), Branch(fail), // Division is signed. Op(DW_OP_const1s), U8(0xfe), Op(DW_OP_const1s), U8(2), Op(DW_OP_div), Op(DW_OP_plus_uconst), Uleb(1), Op(DW_OP_bra), Branch(fail), // Mod is unsigned. Op(DW_OP_const1s), U8(0xfd), Op(DW_OP_const1s), U8(2), Op(DW_OP_mod), Op(DW_OP_neg), Op(DW_OP_plus_uconst), Uleb(1), Op(DW_OP_bra), Branch(fail), // Overflow is defined for multiplication. Op(DW_OP_const4u), U32(0x8000_0001), Op(DW_OP_lit2), Op(DW_OP_mul), Op(DW_OP_lit2), Op(DW_OP_ne), Op(DW_OP_bra), Branch(fail), Op(DW_OP_const4u), U32(0xf0f0_f0f0), Op(DW_OP_const4u), U32(0xf0f0_f0f0), Op(DW_OP_xor), Op(DW_OP_bra), Branch(fail), Op(DW_OP_const4u), U32(0xf0f0_f0f0), Op(DW_OP_const4u), U32(0x0f0f_0f0f), Op(DW_OP_or), Op(DW_OP_not), Op(DW_OP_bra), Branch(fail), Op(DW_OP_const8u), U64(0xffff_ffff_0000_0000), Op(DW_OP_lit2), Op(DW_OP_div), Op(DW_OP_bra), Branch(fail), Op(DW_OP_const1u), U8(0xff), Op(DW_OP_lit1), Op(DW_OP_shl), Op(DW_OP_const2u), U16(0x1fe), Op(DW_OP_ne), Op(DW_OP_bra), Branch(fail), Op(DW_OP_const1u), U8(0xff), Op(DW_OP_const1u), U8(50), Op(DW_OP_shl), Op(DW_OP_bra), Branch(fail), // Absurd shift. Op(DW_OP_const1u), U8(0xff), Op(DW_OP_const1s), U8(0xff), Op(DW_OP_shl), Op(DW_OP_bra), Branch(fail), Op(DW_OP_const1s), U8(0xff), Op(DW_OP_lit1), Op(DW_OP_shr), Op(DW_OP_const4u), U32(0x7fff_ffff), Op(DW_OP_ne), Op(DW_OP_bra), Branch(fail), Op(DW_OP_const1s), U8(0xff), Op(DW_OP_const1u), U8(0xff), Op(DW_OP_shr), Op(DW_OP_bra), Branch(fail), Op(DW_OP_const1s), U8(0xff), Op(DW_OP_lit1), Op(DW_OP_shra), Op(DW_OP_const1s), U8(0xff), Op(DW_OP_ne), Op(DW_OP_bra), Branch(fail), Op(DW_OP_const1s), U8(0xff), Op(DW_OP_const1u), U8(0xff), Op(DW_OP_shra), Op(DW_OP_const1s), U8(0xff), Op(DW_OP_ne), Op(DW_OP_bra), Branch(fail), // Success. Op(DW_OP_lit0), Op(DW_OP_nop), Op(DW_OP_skip), Branch(done), Mark(fail), Op(DW_OP_lit1), Mark(done), Op(DW_OP_stack_value), ]; let result = [Piece { size_in_bits: None, bit_offset: None, location: Location::Value { value: Value::Generic(0), }, }]; check_eval(&program, Ok(&result), encoding4()); }
rust_cleaned_test_functions.jsonl/45764
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 3284 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21296, 25842, 410, 368, 341, 286, 442, 1084, 594, 6419, 421, 458, 5666, 323, 1181, 5977, 646, 4946, 389, 264, 3175, 198, 286, 442, 1555, 304, 279, 1273, 2025, 624, 286, 990, 656, 486, 77858, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_highest_pair_wins() { test(&["4S 2H 6S 2D JH", "2S 4H 6C 4D JD"], &["2S 4H 6C 4D JD"]) }
rust_cleaned_test_functions.jsonl/49899
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 66 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1523, 7504, 14445, 1670, 1330, 368, 341, 262, 1273, 2099, 1183, 19, 50, 220, 17, 39, 220, 21, 50, 220, 17, 35, 619, 39, 497, 330, 17, 50, 220, 19, 39, 220, 21, 34, 220, 19, 35, 43937, 79...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_small_needle() { let haystack = "111 a 111b"; search_test!(haystack, &"a".to_string(), Some(4)); search_test!(haystack, &"a 111".to_string(), Some(4)); }
rust_cleaned_test_functions.jsonl/19397
{ "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, 31966, 71506, 273, 368, 341, 286, 1077, 88447, 284, 330, 16, 16, 16, 264, 220, 16, 16, 16, 65, 876, 286, 2711, 4452, 10297, 67312, 7693, 11, 609, 1, 64, 3263, 983, 3904, 1507, 4329, 7, 19, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_statsd_client_nop_sink_many_threaded() { let client = new_nop_client("cadence"); run_arc_threaded_test(client, NUM_THREADS, NUM_ITERATIONS); }
rust_cleaned_test_functions.jsonl/47008
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 78 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15381, 67, 8179, 1089, 453, 51567, 22101, 10814, 291, 368, 341, 262, 1077, 2943, 284, 501, 1089, 453, 8179, 445, 34455, 763, 797, 262, 1598, 62914, 10814, 291, 4452, 12805, 11, 15943, 56239, 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
#[test] fn test_process() { let mut s = sysinfo::System::new(); assert_eq!(s.get_processes().len(), 0); s.refresh_processes(); assert!(!s.get_processes().is_empty()); #[cfg(not(windows))] assert!(s .get_processes() .values() .any(|p| !p.exe().to_str().unwrap_or("").is_empty())); }
rust_cleaned_test_functions.jsonl/79803
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 165 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11305, 368, 341, 262, 1077, 5206, 274, 284, 5708, 2733, 486, 2320, 486, 931, 543, 262, 2060, 10714, 10297, 82, 670, 80143, 1005, 2892, 1507, 220, 15, 317, 262, 274, 26031, 80143, 543, 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
#[test] fn test_height() { let mut confirms = [ confirm(None, "message"), confirm(Some(true), "message"), confirm(Some(false), "message"), ]; let size = (50, 20).into(); let base_layout = Layout::new(5, size); for confirm in confirms.iter_mut() { let offsets = [21, 22, 22]; let keys = [ KeyEvent::from(KeyCode::Char('y')), KeyCode::Char('n').into(), KeyCode::Backspace.into(), ]; for (&line_offset, &key) in offsets.iter().zip(keys.iter()) { let mut layout = base_layout; assert_eq!(confirm.height(&mut layout), 1); assert_eq!(layout, base_layout.with_line_offset(line_offset)); confirm.handle_key(key); } let mut layout = base_layout; assert_eq!(confirm.height(&mut layout), 1); assert_eq!(layout, base_layout.with_line_offset(21)); } }
rust_cleaned_test_functions.jsonl/10505
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 540 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9561, 368, 341, 286, 1077, 5206, 42396, 284, 2278, 310, 7683, 26717, 11, 330, 1994, 4461, 310, 7683, 65405, 3715, 701, 330, 1994, 4461, 310, 7683, 65405, 3576, 701, 330, 1994, 4461, 286, 15424, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_scan_success() { let mut test_values = test_setup(); // Request a scan let scan_fut = test_values .iface_manager .scan(fidl_sme::ScanRequest::Passive(fidl_sme::PassiveScanRequest {})); pin_mut!(scan_fut); assert_variant!(test_values.exec.run_until_stalled(&mut scan_fut), Poll::Pending); // Verify that the service sees the request. let next_message = test_values.receiver.next(); pin_mut!(next_message); assert_variant!( test_values.exec.run_until_stalled(&mut next_message), Poll::Ready(Some(IfaceManagerRequest::Scan(ScanRequest{ scan_request: _, responder }))) => { let (proxy, _) = create_proxy::<fidl_sme::ScanTransactionMarker>() .expect("failed to create scan proxy"); responder.send(Ok(proxy)).expect("failed to send scan proxy"); } ); // Verify that the client side gets the scan proxy assert_variant!(test_values.exec.run_until_stalled(&mut scan_fut), Poll::Ready(Ok(_))); }
rust_cleaned_test_functions.jsonl/59188
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 555 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 28857, 18632, 368, 341, 286, 1077, 5206, 1273, 9146, 284, 1273, 21363, 1428, 286, 442, 6145, 264, 8569, 198, 286, 1077, 8569, 761, 332, 284, 1273, 9146, 198, 310, 659, 52674, 12144, 198, 310, 65...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_format_github_commit_link() { let repo = GitRemoteRepo::GitHubRepo { repo_slug: "dandavison/delta".to_string(), }; let commit_hash = "d3b07384d113edec49eaa6238ad5ff00"; assert_eq!( repo.format_commit_url(commit_hash), format!("https://github.com/dandavison/delta/commit/{}", commit_hash) ) }
rust_cleaned_test_functions.jsonl/20908
{ "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, 8955, 1889, 3827, 36346, 7233, 368, 341, 286, 1077, 15867, 284, 21120, 24703, 25243, 486, 75615, 25243, 341, 310, 15867, 31024, 25, 330, 67, 437, 402, 3335, 3446, 5964, 3263, 983, 3904, 3148, 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_deposit_verify_fail() { let mut mock_bridge = get_enclave_bridge_mock(); let (db, txaux, tx, witness, secret_key, accounts) = prepare_app_valid_deposit_tx(false, &mut mock_bridge); let extra_info = ChainInfo { min_fee_computed: LinearFee::new(Milli::new(1, 1), Milli::new(1, 1)) .calculate_for_txaux(&txaux) .expect("invalid fee policy"), chain_hex_id: DEFAULT_CHAIN_ID, previous_block_time: 0, unbonding_period: 1, }; let last_account_root_hash = [0u8; 32]; // WrongChainHexId { let mut extra_info = extra_info.clone(); extra_info.chain_hex_id = DEFAULT_CHAIN_ID + 1; let result = verify( &mut mock_bridge, &txaux, extra_info, &last_account_root_hash, db.clone(), &accounts, ); assert!(result.is_err()); let result = verify_bonded_deposit(&tx, &witness, extra_info, vec![], None); expect_error(&result, Error::WrongChainHexId); } // NoInputs { let mut tx = tx.clone(); tx.inputs.clear(); let txaux = replace_tx_payload( txaux.clone(), PlainTxAux::DepositStakeTx(witness.clone()), None, Some(tx.clone()), ); let result = verify( &mut mock_bridge, &txaux, extra_info, &last_account_root_hash, db.clone(), &accounts, ); assert!(result.is_err()); let result = verify_bonded_deposit(&tx, &witness, extra_info, vec![], None); expect_error(&result, Error::NoInputs); } // DuplicateInputs { let mut tx = tx.clone(); let inp = tx.inputs[0].clone(); tx.inputs.push(inp); let txaux = replace_tx_payload( txaux.clone(), PlainTxAux::DepositStakeTx(witness.clone()), None, Some(tx.clone()), ); let result = verify( &mut mock_bridge, &txaux, extra_info, &last_account_root_hash, db.clone(), &accounts, ); assert!(result.is_err()); let result = verify_bonded_deposit(&tx, &witness, extra_info, vec![], None); expect_error(&result, Error::DuplicateInputs); } // UnexpectedWitnesses { let mut witness = witness.clone(); let wp = witness[0].clone(); witness.push(wp); let txaux = replace_tx_payload( txaux.clone(), PlainTxAux::DepositStakeTx(witness.clone()), None, None, ); let result = verify( &mut mock_bridge, &txaux, extra_info, &last_account_root_hash, db.clone(), &accounts, ); assert!(result.is_err()); let result = verify_bonded_deposit(&tx, &witness, extra_info, vec![], None); expect_error(&result, Error::UnexpectedWitnesses); } // MissingWitnesses { let txaux = replace_tx_payload( txaux.clone(), PlainTxAux::DepositStakeTx(vec![].into()), None, None, ); let result = verify( &mut mock_bridge, &txaux, extra_info, &last_account_root_hash, db.clone(), &accounts, ); assert!(result.is_err()); let result = verify_bonded_deposit(&tx, &vec![].into(), extra_info, vec![], None); expect_error(&result, Error::MissingWitnesses); } // InputSpent { let mut inittx = db.transaction(); inittx.put( COL_TX_META, &tx.inputs[0].id[..], &BitVec::from_elem(1, true).to_bytes(), ); db.write(inittx).unwrap(); let result = verify( &mut mock_bridge, &txaux, extra_info, &last_account_root_hash, db.clone(), &accounts, ); expect_error(&result, Error::InputSpent); let mut reset = db.transaction(); reset.put( COL_TX_META, &tx.inputs[0].id[..], &BitVec::from_elem(1, false).to_bytes(), ); db.write(reset).unwrap(); } { let secp = Secp256k1::new(); let mut witness = witness.clone(); witness[0] = get_tx_witness( secp.clone(), &tx.id(), &SecretKey::from_slice(&[0x11; 32]).expect("32 bytes, within curve order"), &MerkleTree::new(vec![RawPubkey::from( PublicKey::from_secret_key( &secp, &SecretKey::from_slice(&[0x11; 32]).expect("32 bytes, within curve order"), ) .serialize(), )]), ); let addr = get_address(&secp, &secret_key).0; let input_tx = get_old_tx(addr, false); let result = verify_bonded_deposit( &tx, &witness, extra_info, vec![TxWithOutputs::Transfer(input_tx)], None, ); expect_error( &result, Error::EcdsaCrypto, ); let txaux = replace_tx_payload( txaux.clone(), PlainTxAux::DepositStakeTx(witness.clone()), None, None, ); let result = verify( &mut mock_bridge, &txaux, extra_info, &last_account_root_hash, db.clone(), &accounts, ); assert!(result.is_err()); } // InvalidInput { let result = verify( &mut mock_bridge, &txaux, extra_info, &last_account_root_hash, create_db(), &accounts, ); expect_error(&result, Error::InvalidInput); } // InputOutputDoNotMatch { let mut extra_info = extra_info.clone(); extra_info.min_fee_computed = Fee::new(Coin::one()); let result = verify( &mut mock_bridge, &txaux, extra_info, &last_account_root_hash, db.clone(), &accounts, ); assert!(result.is_err()); let result = verify_bonded_deposit(&tx, &witness, extra_info, vec![], None); expect_error(&result, Error::InputOutputDoNotMatch); } }
rust_cleaned_test_functions.jsonl/129490
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 4470 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 85798, 35638, 22121, 368, 341, 286, 1077, 5206, 7860, 54944, 284, 633, 6205, 40533, 54944, 34134, 543, 286, 1077, 320, 1999, 11, 259, 9591, 2200, 11, 9854, 11, 11298, 11, 6234, 3097, 11, 9618, 8...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_revoke_reporter_record_is_final() { let mut transaction_context = MockTransactionContext::default(); let reporter_key = "reporter_key"; transaction_context.add_finalized_record(); let mut state = TrackAndTraceState::new(&mut transaction_context); let transaction_handler = TrackAndTraceTransactionHandler::new(); let payload = revoke_reporter_action(reporter_key, vec![REQUIRED_PROPERTY_NAME.to_string()]); match transaction_handler._revoke_reporter(&payload, &mut state, PUBLIC_KEY) { Ok(()) => panic!("Record is final, InvalidTransaction should be returned"), Err(ApplyError::InvalidTransaction(err)) => { assert!(err.contains(&format!("Record is final: {}", RECORD_ID))); } Err(err) => panic!("Should have gotten invalid error but got {}", err), } }
rust_cleaned_test_functions.jsonl/32564
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 366 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1288, 7621, 14813, 261, 14192, 6892, 20676, 368, 341, 286, 1077, 5206, 7745, 8467, 284, 14563, 8070, 1972, 486, 2258, 543, 286, 1077, 18960, 3097, 284, 330, 11736, 261, 3097, 876, 286, 7745, 8467,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_multiple_senders() { let local_node_id = test_node_id(1); let local_node_quorum_set = QuorumSet::<ResponderId>::empty(); let mut network_state = SCPNetworkState::<ResponderId>::new(local_node_id.responder_id, local_node_quorum_set); let sender_a_id = test_node_id(11).responder_id; let sender_b_id = test_node_id(22).responder_id; let quorum_set = QuorumSet::<ResponderId>::empty(); // A Prepare message from sender A. let slot_index: SlotIndex = 5; network_state.push(Msg::new( sender_a_id.clone(), quorum_set.clone(), slot_index, Topic::Prepare(PreparePayload { B: Ballot::new(1, &["bleh"]), P: None, PP: None, HN: 0, CN: 0, }), )); assert_eq!(network_state.peer_to_current_slot().len(), 1); assert_eq!( *network_state.id_to_current_slot.get(&sender_a_id).unwrap(), 4_u64 ); // A Commit from sender B. let slot_index: SlotIndex = 6; network_state.push(Msg::new( sender_b_id.clone(), quorum_set, slot_index, Topic::Commit(CommitPayload { B: Ballot::new(1, &["bleh"]), PN: 0, HN: 0, CN: 0, }), )); // There should now be values for both nodes. assert_eq!(network_state.peer_to_current_slot().len(), 2); assert_eq!( *network_state.id_to_current_slot.get(&sender_b_id).unwrap(), 5_u64 ); }
rust_cleaned_test_functions.jsonl/60950
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 950 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 45233, 13565, 388, 368, 341, 286, 1077, 2205, 5084, 842, 284, 1273, 5084, 842, 7, 16, 317, 286, 1077, 2205, 5084, 11280, 33006, 2602, 284, 3406, 33006, 1649, 27638, 30884, 764, 6831, 3194, 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_serialize_fixed() { let (bytes, handles) = TestInterfaceEvent::Fixed { arg: Fixed::from_bits(FIXED_VALUE) } .into_message(SENDER_ID) .unwrap() .take(); assert!(handles.is_empty()); assert_eq!(bytes, message_bytes!(SENDER_ID, 2 /* opcode */, FIXED_VALUE)); }
rust_cleaned_test_functions.jsonl/55795
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 169 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 88686, 37839, 368, 341, 286, 1077, 320, 9651, 11, 13469, 8, 284, 3393, 5051, 1556, 486, 13520, 314, 1392, 25, 20149, 486, 1499, 20034, 7832, 5396, 1479, 7476, 8, 456, 310, 659, 18122, 6462, 5104...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_vm_config_memory() { vec![ ( vec!["cloud-hypervisor", "--kernel", "/path/to/kernel", "--memory", "size=1073741824"], r#"{ "kernel": {"path": "/path/to/kernel"}, "memory": {"size": 1073741824} }"#, true, ), ( vec!["cloud-hypervisor", "--kernel", "/path/to/kernel", "--memory", "size=1G"], r#"{ "kernel": {"path": "/path/to/kernel"}, "memory": {"size": 1073741824} }"#, true, ), ( vec!["cloud-hypervisor", "--kernel", "/path/to/kernel", "--memory", "size=1G,mergeable=on"], r#"{ "kernel": {"path": "/path/to/kernel"}, "memory": {"size": 1073741824, "mergeable": true} }"#, true, ), ( vec!["cloud-hypervisor", "--kernel", "/path/to/kernel", "--memory", "size=1G,mergeable=off"], r#"{ "kernel": {"path": "/path/to/kernel"}, "memory": {"size": 1073741824, "mergeable": false} }"#, true, ), ( vec!["cloud-hypervisor", "--kernel", "/path/to/kernel", "--memory", "size=1G,mergeable=on"], r#"{ "kernel": {"path": "/path/to/kernel"}, "memory": {"size": 1073741824, "mergeable": false} }"#, false, ), ( vec!["cloud-hypervisor", "--kernel", "/path/to/kernel", "--memory", "size=1G,hotplug_size=1G"], r#"{ "kernel": {"path": "/path/to/kernel"}, "memory": {"size": 1073741824, "hotplug_method": "Acpi", "hotplug_size": 1073741824} }"#, true, ), ( vec!["cloud-hypervisor", "--kernel", "/path/to/kernel", "--memory", "size=1G,hotplug_method=virtio-mem,hotplug_size=1G"], r#"{ "kernel": {"path": "/path/to/kernel"}, "memory": {"size": 1073741824, "hotplug_method": "VirtioMem", "hotplug_size": 1073741824} }"#, true, ), ] .iter() .for_each(|(cli, openapi, equal)| { compare_vm_config_cli_vs_json(cli, openapi, *equal); }); }
rust_cleaned_test_functions.jsonl/48714
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1585 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8337, 39008, 5332, 19195, 368, 341, 286, 7486, 90515, 310, 2399, 394, 7486, 0, 1183, 12361, 2832, 1082, 31396, 497, 14482, 23248, 497, 3521, 2343, 32429, 58343, 497, 14482, 17269, 497, 330, 2141, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_fg_rgb_color() { let colored = Colored::BackgroundColor(Color::Rgb { r: 1, g: 2, b: 3 }); assert_eq!(colored.to_string(), "48;2;1;2;3"); }
rust_cleaned_test_functions.jsonl/18346
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 93 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 69473, 37407, 6714, 368, 341, 286, 1077, 27197, 284, 4254, 3018, 486, 29546, 15028, 486, 80951, 314, 435, 25, 220, 16, 11, 342, 25, 220, 17, 11, 293, 25, 220, 18, 1625, 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
#[test] fn test_log_item_batch_enc_dec() { let region_id = 8; let mut batch = LogItemBatch::default(); batch.add_entry_indexes( region_id, generate_entry_indexes_opt(1, 5, None /*file_id*/), ); batch.add_entry_indexes( region_id + 100, generate_entry_indexes_opt(100, 105, None /*file_id*/), ); batch.add_command(region_id, Command::Clean); batch.put(region_id, b"key".to_vec(), b"value".to_vec()); batch.delete(region_id, b"key2".to_vec()); batch.finish_write(FileBlockHandle::dummy(LogQueue::Append)); let mut encoded_batch = vec![]; batch.encode(&mut encoded_batch).unwrap(); let decoded_batch = LogItemBatch::decode( &mut encoded_batch.as_slice(), FileBlockHandle::dummy(LogQueue::Append), CompressionType::None, ) .unwrap(); assert_eq!(batch, decoded_batch); }
rust_cleaned_test_functions.jsonl/48883
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 488 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5224, 5634, 14534, 13781, 13783, 368, 341, 286, 1077, 5537, 842, 284, 220, 23, 401, 286, 1077, 5206, 7162, 284, 2835, 1234, 21074, 486, 2258, 543, 286, 7162, 1364, 9078, 50161, 1006, 310, 5537, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_cacheable_debug() { let adapter = MockAdapter::build().with_upstream_value(42).finish(); let cacheable = CachePolicyCacheable { adapter, result: 42, }; assert_eq!(format!("{:?}", cacheable), "CachePolicyCacheable"); }
rust_cleaned_test_functions.jsonl/130406
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 112 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11529, 480, 15446, 368, 341, 262, 1077, 12956, 284, 14563, 5940, 486, 5834, 1005, 4197, 8237, 4027, 3142, 7, 19, 17, 568, 30150, 543, 262, 1077, 6500, 480, 284, 19479, 13825, 8233, 480, 341, 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_max_or_min_decimal() { let cases = vec![ (1, 1, "0.9"), (1, 0, "9"), (2, 1, "9.9"), (4, 2, "99.99"), (6, 3, "999.999"), (8, 4, "9999.9999"), (10, 5, "99999.99999"), (12, 6, "999999.999999"), (14, 7, "9999999.9999999"), (16, 8, "99999999.99999999"), (18, 9, "999999999.999999999"), (20, 10, "9999999999.9999999999"), (20, 20, "0.99999999999999999999"), (20, 0, "99999999999999999999"), (40, 20, "99999999999999999999.99999999999999999999"), ]; for (prec, frac, exp) in cases { let positive = super::max_or_min_dec(false, prec, frac); let res = positive.to_string(); assert_eq!(&res, exp); let negative = super::max_or_min_dec(true, prec, frac); let mut negative_exp = String::from("-"); negative_exp.push_str(exp); let res = negative.to_string(); assert_eq!(res, negative_exp); } }
rust_cleaned_test_functions.jsonl/13669
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 636 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6345, 8734, 7260, 74429, 368, 341, 286, 1077, 5048, 284, 7486, 90515, 310, 320, 16, 11, 220, 16, 11, 330, 15, 13, 24, 4461, 310, 320, 16, 11, 220, 15, 11, 330, 24, 4461, 310, 320, 17, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_totp() { let totp = botan::TOTP::new(b"1234567890123456789012345678901234567890123456789012345678901234", "SHA-512", 8, 30).unwrap(); assert_eq!(totp.generate(59).unwrap(), 90693936); assert_eq!(totp.generate(1111111109).unwrap(), 25091201); assert_eq!(totp.generate(1111111111).unwrap(), 99943326); assert!(totp.check(90693936, 59, 0).unwrap()); assert!(!totp.check(90693936, 60, 0).unwrap()); assert!(totp.check(90693936, 59+30, 1).unwrap()); assert!(!totp.check(90693936, 59+31, 1).unwrap()); }
rust_cleaned_test_functions.jsonl/95316
{ "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, 36138, 79, 368, 341, 262, 1077, 311, 790, 284, 10924, 276, 486, 65620, 47, 486, 931, 1883, 1, 16, 17, 18, 19, 20, 21, 22, 23, 24, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 15, 16, 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_memtable_merge_append() { type TestMemTable = MemTable<VacantAllocator>; fn empty_table(id: u64) -> TestMemTable { MemTable::new(id, Arc::new(GlobalStats::default())) } let cases = [ |mut memtable: TestMemTable, on: Option<LogQueue>| -> TestMemTable { match on { None => { memtable.append(generate_entry_indexes( 0, 10, FileId::new(LogQueue::Append, 1), )); memtable.append(generate_entry_indexes( 7, 15, FileId::new(LogQueue::Append, 2), )); memtable.rewrite( generate_entry_indexes(0, 10, FileId::new(LogQueue::Rewrite, 1)), Some(1), ); } Some(LogQueue::Append) => { memtable.append(generate_entry_indexes( 0, 10, FileId::new(LogQueue::Append, 1), )); memtable.append(generate_entry_indexes( 7, 15, FileId::new(LogQueue::Append, 2), )); memtable.compact_to(7); } Some(LogQueue::Rewrite) => { memtable.append_rewrite(generate_entry_indexes( 0, 7, FileId::new(LogQueue::Rewrite, 1), )); } } memtable }, |mut memtable: TestMemTable, on: Option<LogQueue>| -> TestMemTable { match on { None => { memtable.append(generate_entry_indexes( 0, 10, FileId::new(LogQueue::Append, 1), )); memtable.append(generate_entry_indexes( 7, 15, FileId::new(LogQueue::Append, 2), )); memtable.rewrite( generate_entry_indexes(0, 10, FileId::new(LogQueue::Rewrite, 1)), Some(1), ); memtable.compact_to(10); } Some(LogQueue::Append) => { memtable.append(generate_entry_indexes( 0, 10, FileId::new(LogQueue::Append, 1), )); memtable.append(generate_entry_indexes( 7, 15, FileId::new(LogQueue::Append, 2), )); memtable.compact_to(10); } Some(LogQueue::Rewrite) => { memtable.append_rewrite(generate_entry_indexes( 0, 7, FileId::new(LogQueue::Rewrite, 1), )); // By MemTableRecoveryContext. memtable.compact_to(10); } } memtable }, |mut memtable: TestMemTable, on: Option<LogQueue>| -> TestMemTable { match on { None => { memtable.append(generate_entry_indexes( 0, 10, FileId::new(LogQueue::Append, 1), )); memtable.rewrite( generate_entry_indexes(0, 10, FileId::new(LogQueue::Rewrite, 1)), Some(1), ); memtable.append(generate_entry_indexes( 10, 15, FileId::new(LogQueue::Append, 2), )); memtable.append(generate_entry_indexes( 5, 10, FileId::new(LogQueue::Append, 2), )); } Some(LogQueue::Append) => { let mut m1 = empty_table(memtable.region_id); m1.append(generate_entry_indexes( 10, 15, FileId::new(LogQueue::Append, 2), )); let mut m2 = empty_table(memtable.region_id); m2.append(generate_entry_indexes( 5, 10, FileId::new(LogQueue::Append, 2), )); m1.merge_newer_neighbor(&mut m2); memtable.merge_newer_neighbor(&mut m1); } Some(LogQueue::Rewrite) => { memtable.append_rewrite(generate_entry_indexes( 0, 10, FileId::new(LogQueue::Rewrite, 1), )); } } memtable }, ]; // merge against empty table. for (i, case) in cases.iter().enumerate() { let region_id = i as u64; let mut append = empty_table(region_id); let mut rewrite = case(empty_table(region_id), Some(LogQueue::Rewrite)); rewrite.merge_append_table(&mut append); assert_eq!( rewrite.entry_indexes, case(empty_table(region_id), Some(LogQueue::Rewrite)).entry_indexes, ); assert!(append.entry_indexes.is_empty()); let mut append = case(empty_table(region_id), Some(LogQueue::Append)); let mut rewrite = empty_table(region_id); rewrite.merge_append_table(&mut append); assert_eq!( rewrite.entry_indexes, case(empty_table(region_id), Some(LogQueue::Append)).entry_indexes ); assert!(append.entry_indexes.is_empty()); } for (i, case) in cases.iter().enumerate() { let region_id = i as u64; let mut append = case(empty_table(region_id), Some(LogQueue::Append)); let mut rewrite = case(empty_table(region_id), Some(LogQueue::Rewrite)); rewrite.merge_append_table(&mut append); let expected = case(empty_table(region_id), None); assert_eq!( rewrite.global_stats.live_entries(LogQueue::Append), expected.global_stats.live_entries(LogQueue::Append) ); assert_eq!( rewrite.global_stats.live_entries(LogQueue::Rewrite), expected.global_stats.live_entries(LogQueue::Rewrite) ); assert_eq!(rewrite.entry_indexes, expected.entry_indexes); assert!(append.entry_indexes.is_empty()); } }
rust_cleaned_test_functions.jsonl/52141
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 5131 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 12976, 2005, 20888, 26041, 368, 341, 286, 943, 3393, 18816, 2556, 284, 13550, 2556, 21420, 580, 517, 42730, 10133, 286, 5168, 4287, 5237, 3724, 25, 575, 21, 19, 8, 1464, 3393, 18816, 2556, 341, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_uniform_n_is_above_zero() { let mut rng = StressTestingRng::new(vec![Int256::ZERO]); assert_eq!(NonZeroExponentP256::gen_uniform(&mut rng), ONE); }
rust_cleaned_test_functions.jsonl/101336
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 91 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 45066, 1089, 6892, 77315, 19359, 368, 341, 286, 1077, 5206, 28422, 284, 50468, 16451, 49, 968, 486, 931, 25592, 20703, 1072, 17, 20, 21, 486, 73956, 10149, 286, 2060, 10714, 10297, 8121, 17999, 84...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_handle_send_from() { let (init_result, mut deps) = init_helper(vec![InitialBalance { address: HumanAddr("bob".to_string()), amount: Uint128(5000), }]); assert!( init_result.is_ok(), "Init failed: {}", init_result.err().unwrap() ); // Send before allowance let handle_msg = HandleMsg::SendFrom { owner: HumanAddr("bob".to_string()), recipient: HumanAddr("alice".to_string()), recipient_code_hash: None, amount: Uint128(2500), memo: None, msg: None, padding: None, }; let handle_result = handle(&mut deps, mock_env("alice", &[]), handle_msg); let error = extract_error_msg(handle_result); assert!(error.contains("insufficient allowance")); // Send more than allowance let handle_msg = HandleMsg::IncreaseAllowance { spender: HumanAddr("alice".to_string()), amount: Uint128(2000), padding: None, expiration: None, }; let handle_result = handle(&mut deps, mock_env("bob", &[]), handle_msg); assert!( handle_result.is_ok(), "handle() failed: {}", handle_result.err().unwrap() ); let handle_msg = HandleMsg::SendFrom { owner: HumanAddr("bob".to_string()), recipient: HumanAddr("alice".to_string()), recipient_code_hash: None, amount: Uint128(2500), memo: None, msg: None, padding: None, }; let handle_result = handle(&mut deps, mock_env("alice", &[]), handle_msg); let error = extract_error_msg(handle_result); assert!(error.contains("insufficient allowance")); // Sanity check let handle_msg = HandleMsg::RegisterReceive { code_hash: "lolz".to_string(), padding: None, }; let handle_result = handle(&mut deps, mock_env("contract", &[]), handle_msg); assert!( handle_result.is_ok(), "handle() failed: {}", handle_result.err().unwrap() ); let send_msg = Binary::from(r#"{ "some_msg": { "some_key": "some_val" } }"#.as_bytes()); let snip20_msg = Snip20ReceiveMsg::new( HumanAddr("alice".to_string()), HumanAddr("bob".to_string()), Uint128(2000), Some("my memo".to_string()), Some(send_msg.clone()), ); let handle_msg = HandleMsg::SendFrom { owner: HumanAddr("bob".to_string()), recipient: HumanAddr("contract".to_string()), recipient_code_hash: None, amount: Uint128(2000), memo: Some("my memo".to_string()), msg: Some(send_msg), padding: None, }; let handle_result = handle(&mut deps, mock_env("alice", &[]), handle_msg); assert!( handle_result.is_ok(), "handle() failed: {}", handle_result.err().unwrap() ); assert!(handle_result.unwrap().messages.contains( &snip20_msg .into_cosmos_msg("lolz".to_string(), HumanAddr("contract".to_string())) .unwrap() )); let bob_canonical = deps .api .canonical_address(&HumanAddr("bob".to_string())) .unwrap(); let contract_canonical = deps .api .canonical_address(&HumanAddr("contract".to_string())) .unwrap(); let bob_balance = crate::state::ReadonlyBalances::from_storage(&deps.storage) .account_amount(&bob_canonical); let contract_balance = crate::state::ReadonlyBalances::from_storage(&deps.storage) .account_amount(&contract_canonical); assert_eq!(bob_balance, 5000 - 2000); assert_eq!(contract_balance, 2000); let total_supply = ReadonlyConfig::from_storage(&deps.storage).total_supply(); assert_eq!(total_supply, 5000); // Second send more than allowance let handle_msg = HandleMsg::SendFrom { owner: HumanAddr("bob".to_string()), recipient: HumanAddr("alice".to_string()), recipient_code_hash: None, amount: Uint128(1), memo: None, msg: None, padding: None, }; let handle_result = handle(&mut deps, mock_env("alice", &[]), handle_msg); let error = extract_error_msg(handle_result); assert!(error.contains("insufficient allowance")); }
rust_cleaned_test_functions.jsonl/69608
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2317 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10630, 13565, 5673, 368, 341, 286, 1077, 320, 2327, 5287, 11, 5206, 48178, 8, 284, 2930, 10418, 25592, 20703, 6341, 21190, 341, 310, 2621, 25, 11097, 13986, 445, 47086, 3263, 983, 3904, 14702, 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_extension() -> Result<()> { let missing_extension_pkt = Bytes::from_static(&[ 0x90, 0x60, 0x69, 0x8f, 0xd9, 0xc2, 0x93, 0xda, 0x1c, 0x64, 0x27, 0x82, ]); let buf = &mut missing_extension_pkt.clone(); let result = Packet::unmarshal(buf); assert!( result.is_err(), "Unmarshal did not error on packet with missing extension data" ); let invalid_extension_length_pkt = Bytes::from_static(&[ 0x90, 0x60, 0x69, 0x8f, 0xd9, 0xc2, 0x93, 0xda, 0x1c, 0x64, 0x27, 0x82, 0x99, 0x99, 0x99, 0x99, ]); let buf = &mut invalid_extension_length_pkt.clone(); let result = Packet::unmarshal(buf); assert!( result.is_err(), "Unmarshal did not error on packet with invalid extension length" ); let packet = Packet { header: Header { extension: true, extension_profile: 3, extensions: vec![Extension { id: 0, payload: Bytes::from_static(&[0]), }], ..Default::default() }, payload: Bytes::from_static(&[]), }; let mut raw = BytesMut::new(); let result = packet.marshal_to(&mut raw); assert!( result.is_err(), "Marshal did not error on packet with invalid extension length" ); if let Err(err) = result { assert_eq!(Error::ErrBufferTooSmall, err); } Ok(()) }
rust_cleaned_test_functions.jsonl/128726
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 708 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 31035, 368, 1464, 5714, 71698, 341, 262, 1077, 7402, 31035, 42051, 284, 30024, 486, 1499, 25360, 2099, 9640, 286, 220, 15, 87, 24, 15, 11, 220, 15, 87, 21, 15, 11, 220, 15, 87, 21, 24, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_userfunc() { let source_code = " @function Int test(Int y) { return other_func(3, y) } @function Int other_func(Int x, Int y) { return x + y } "; let expected = ("other_func(3, y)", "This feature is unimplemented"); assert_fn_compile_error(Some("test"), source_code, expected); }
rust_cleaned_test_functions.jsonl/123302
{ "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, 3317, 2830, 368, 341, 262, 1077, 2530, 4136, 284, 6228, 286, 569, 1688, 1333, 1273, 24123, 379, 8, 341, 310, 470, 1008, 9596, 7, 18, 11, 379, 340, 286, 456, 286, 569, 1688, 1333, 1008, 9596, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_nirmala() { run_test( &TEST_DATA, "directwrite/good-nirmala.te", "indic/Nirmala.ttf", &[JOINER_GLYPH_INDEX], 0, ); }
rust_cleaned_test_functions.jsonl/91215
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 213 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1089, 2853, 6053, 368, 341, 394, 1598, 4452, 1006, 503, 609, 10033, 7896, 345, 503, 330, 19798, 4934, 4846, 1386, 5279, 2853, 6053, 31853, 756, 503, 330, 85084, 20290, 2853, 6053, 45192, 756, 503,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_get_pins() { let route = Route::GetPins { channel_id: CHANNEL_ID, }; assert_eq!( route.to_string(), format!("channels/{channel_id}/pins", channel_id = CHANNEL_ID) ); }
rust_cleaned_test_functions.jsonl/119945
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 148 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 90089, 368, 341, 286, 1077, 6021, 284, 9572, 486, 1949, 47, 1330, 341, 310, 5496, 842, 25, 58756, 3450, 345, 286, 2605, 286, 2060, 10714, 33673, 310, 6021, 2389, 3904, 3148, 310, 3561, 172...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_cost_tracker_remove() { let (mint_keypair, start_hash) = test_setup(); // build two transactions with diff accounts let second_account = Keypair::new(); let (_tx1, tx_cost1) = build_simple_transaction(&mint_keypair, &start_hash); let (_tx2, tx_cost2) = build_simple_transaction(&second_account, &start_hash); let cost1 = tx_cost1.sum(); let cost2 = tx_cost2.sum(); // build testee let mut testee = CostTracker::new(cost1 + cost2, cost1 + cost2, cost1 + cost2, None); assert!(testee.try_add(&tx_cost1).is_ok()); assert!(testee.try_add(&tx_cost2).is_ok()); assert_eq!(cost1 + cost2, testee.block_cost); // removing a tx_cost affects block_cost testee.remove(&tx_cost1); assert_eq!(cost2, testee.block_cost); // add back tx1 assert!(testee.try_add(&tx_cost1).is_ok()); assert_eq!(cost1 + cost2, testee.block_cost); assert!(testee.try_add(&tx_cost1).is_err()); }
rust_cleaned_test_functions.jsonl/23078
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 484 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15890, 50264, 18193, 368, 341, 286, 1077, 320, 67791, 3097, 12670, 11, 1191, 8950, 8, 284, 1273, 21363, 543, 286, 442, 1936, 1378, 14131, 448, 3638, 9618, 198, 286, 1077, 2086, 13500, 284, 6569, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_translate_string_and_do() { let string = "Gaggablaghblagh!"; let addr = string.as_ptr() as *const _ as u64; let memory_mapping = MemoryMapping::new::<UserError>( vec![MemoryRegion { host_addr: addr, vm_addr: 100, len: string.len() as u64, vm_gap_shift: 63, is_writable: false, }], &DEFAULT_CONFIG, ) .unwrap(); assert_eq!( 42, translate_string_and_do( &memory_mapping, 100, string.len() as u64, &bpf_loader::id(), true, &mut |string: &str| { assert_eq!(string, "Gaggablaghblagh!"); Ok(42) } ) .unwrap() ); }
rust_cleaned_test_functions.jsonl/16349
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 580 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 66381, 3904, 8378, 26309, 368, 341, 286, 1077, 914, 284, 330, 38, 15718, 370, 13363, 71, 2024, 33756, 26782, 286, 1077, 10789, 284, 914, 5357, 4348, 368, 438, 353, 1024, 716, 438, 575, 21, 19, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_fr_root_of_unity() { use ff::SqrtField; assert_eq!(Fr::S, 32); assert_eq!(Fr::multiplicative_generator(), Fr::from(7)); assert_eq!( Fr::multiplicative_generator().pow_vartime([ 0xfffe5bfeffffffffu64, 0x9a1d80553bda402, 0x299d7d483339d808, 0x73eda753 ]), Fr::root_of_unity() ); assert_eq!(Fr::root_of_unity().pow_vartime([1u64 << Fr::S]), Fr::one()); assert!(bool::from(Fr::multiplicative_generator().sqrt().is_none())); }
rust_cleaned_test_functions.jsonl/100660
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 288 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 41537, 12993, 3575, 62, 2439, 368, 341, 262, 990, 25539, 486, 50, 8140, 1877, 401, 262, 2060, 10714, 10297, 22560, 486, 50, 11, 220, 18, 17, 317, 262, 2060, 10714, 10297, 22560, 486, 77976, 6526...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_128_data_128_kek() { test_wrap_unwrap( "000102030405060708090A0B0C0D0E0F", "00112233445566778899AABBCCDDEEFF", "1FA68B0A8112B447AEF34BD8FB5A7B829D3E862371D2CFE5", ); }
rust_cleaned_test_functions.jsonl/16538
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 163 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 62, 16, 17, 23, 1769, 62, 16, 17, 23, 45476, 74, 368, 341, 286, 1273, 38550, 4907, 10097, 1006, 310, 330, 15, 15, 15, 16, 15, 17, 15, 18, 15, 19, 15, 20, 15, 21, 15, 22, 15, 23, 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_is_canceled() { let (tx, _) = channel::<()>(); assert!(tx.is_canceled()); let (_, rx) = channel::<()>(); assert!(rx.is_canceled()); let (tx, rx) = channel::<()>(); assert!(!tx.is_canceled()); assert!(!rx.is_canceled()); tx.complete(()); assert!(!rx.is_canceled()); }
rust_cleaned_test_functions.jsonl/26363
{ "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, 6892, 666, 38392, 368, 341, 286, 1077, 320, 3998, 11, 27439, 284, 5496, 27638, 368, 3913, 286, 2060, 10297, 3998, 2079, 666, 38392, 5231, 286, 1077, 39464, 19111, 8, 284, 5496, 27638, 368, 3913, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_dedicated_pinning() -> () { let core_ids = core_affinity::get_core_ids().expect("Failed to fetch core ids"); assert!( !(core_ids.len() < 2), "this test requires at least two cores" ); let system = KompactConfig::default().build().expect("System"); let cc = system.create_dedicated_pinned(CounterComponent::new, core_ids[0]); system.start(&cc); let cc_ref: ActorRef<Box<dyn Any + Send>> = cc.actor_ref(); let dc = system.create_dedicated_pinned(move || DedicatedComponent::new(cc_ref), core_ids[1]); system.start(&dc); let thousand_millis = time::Duration::from_millis(1000); thread::sleep(thousand_millis); let dc_ref: ActorRef<String> = dc.actor_ref(); dc_ref.tell(String::from("go")); thread::sleep(thousand_millis); cc.on_definition(|c| { assert_eq!(c.msg_count, 1); }); system .shutdown() .expect("Kompact didn't shut down properly"); }
rust_cleaned_test_functions.jsonl/117587
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 503 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 814, 291, 10089, 620, 19770, 368, 1464, 1719, 341, 286, 1077, 6200, 8077, 284, 6200, 48914, 13489, 486, 455, 15467, 8077, 1005, 17119, 445, 9408, 311, 7807, 6200, 14151, 797, 286, 2060, 33673, 310...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_ser_de() { let addr: InprocAddr = "test".try_into().unwrap(); let mut config = ClientConfig::new(); config.set_connect(Some(&addr)); let ron = serde_yaml::to_string(&config).unwrap(); let de: ClientConfig = serde_yaml::from_str(&ron).unwrap(); assert_eq!(config, de); }
rust_cleaned_test_functions.jsonl/29761
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 158 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 75861, 2259, 368, 341, 286, 1077, 10789, 25, 758, 15782, 13986, 284, 330, 1944, 3263, 1539, 45514, 1005, 15454, 1428, 286, 1077, 5206, 2193, 284, 8423, 2648, 486, 931, 543, 286, 2193, 980, 15720, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_field_default_value_float() { let msg = r#" optional float f = 2 [default = 10.0]; "#; let mess = parse(msg, |p| p.next_field(MessageBodyParseMode::MessageProto2)); assert_eq!("f", mess.name); assert_eq!("default", mess.options[0].name); assert_eq!("10.0", mess.options[0].value.format()); }
rust_cleaned_test_functions.jsonl/70449
{ "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, 5013, 9993, 3142, 17586, 368, 341, 286, 1077, 3750, 284, 435, 55543, 220, 10101, 2224, 282, 284, 220, 17, 508, 2258, 284, 220, 16, 15, 13, 15, 5265, 220, 5869, 280, 286, 1077, 9435, 284, 4715,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_property_map_v2() { let client = graph_serializer(GraphSON::V2); let vertex = create_vertex(&client, "Traversal"); let g = traversal().with_remote(client); let results = g.v(vertex.id()).property_map(()).to_list().unwrap(); assert_eq!(1, results.len()); let properties = &results[0]; assert_eq!( "Traversal", properties["name"].get::<List>().unwrap()[0] .get::<VertexProperty>() .unwrap() .get::<String>() .unwrap() ); let results = g.v(vertex.id()).property_map("name").to_list().unwrap(); assert_eq!(1, results.len()); let properties = &results[0]; assert_eq!( "Traversal", properties["name"].get::<List>().unwrap()[0] .get::<VertexProperty>() .unwrap() .get::<String>() .unwrap() ); let results = g.v(vertex.id()).property_map("fake").to_list().unwrap(); assert_eq!(1, results.len()); let properties = &results[0]; assert_eq!(0, properties.len()); }
rust_cleaned_test_functions.jsonl/26284
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 511 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 16638, 5376, 2273, 17, 368, 341, 262, 1077, 2943, 284, 4771, 67441, 63779, 2703, 486, 53, 17, 626, 262, 1077, 11936, 284, 1855, 26611, 2099, 2972, 11, 330, 76276, 3071, 262, 1077, 342, 284, 5630...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_into_key_slice_with_shared_root_past_bounds() { let mut map: BTreeMap<Align32, ()> = BTreeMap::new(); assert_eq!(map.get(&Align32(1)), None); assert_eq!(map.get_mut(&Align32(1)), None); }
rust_cleaned_test_functions.jsonl/103754
{ "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, 45514, 3097, 26488, 6615, 20405, 12993, 93019, 36878, 368, 341, 262, 1077, 5206, 2415, 25, 425, 6533, 2227, 27, 10069, 18, 17, 11, 1719, 29, 284, 425, 6533, 2227, 486, 931, 543, 262, 2060, 10714...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_pixel_size_for_a_vertical_canvas() { let camera = camera::Camera::new(125, 200, std::f64::consts::PI / 2.0); assert_approx_eq!(camera.pixel_size, 0.01); }
rust_cleaned_test_functions.jsonl/116185
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 95 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 29760, 2368, 5478, 4306, 61203, 47136, 368, 341, 286, 1077, 6249, 284, 6249, 486, 13445, 486, 931, 7, 16, 17, 20, 11, 220, 17, 15, 15, 11, 1460, 486, 69, 21, 19, 486, 95773, 486, 1893, 608, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_wallclock_order() { let v1 = VersionedCrdsValue::new( CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost( &Pubkey::default(), 1, ))), Cursor::default(), 1, // local_timestamp ); let v2 = VersionedCrdsValue::new( CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost( &Pubkey::default(), 0, ))), Cursor::default(), 1, // local_timestamp ); assert_eq!(v1.value.label(), v2.value.label()); assert!(overrides(&v1.value, &v2)); assert!(!overrides(&v2.value, &v1)); assert!(v1 != v2); assert!(!(v1 == v2)); }
rust_cleaned_test_functions.jsonl/10464
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 447 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 50731, 20666, 7869, 368, 341, 286, 1077, 348, 16, 284, 6079, 291, 16001, 5356, 1130, 486, 931, 1006, 310, 4553, 5356, 1130, 486, 931, 67830, 3025, 81, 5356, 1043, 486, 8732, 1731, 99102, 1731, 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_swap() { let container = [0u8; constants::MIN_ORDER_SIZE * 3]; let mut block1 = Block::new_free(&container[..], 0, 1, 2).unwrap(); let mut block2 = Block::new_free(&container[..], 1, 1, 0).unwrap(); let mut block3 = Block::new_free(&container[..], 2, 3, 4).unwrap(); // Can't swap with block of different order assert!(block1.swap(&mut block3).is_err()); assert!(block2.become_reserved().is_ok()); assert!(block1.swap(&mut block2).is_ok()); assert_eq!(block1.index(), 1); assert_eq!(block1.order(), 1); assert_eq!(block1.block_type(), BlockType::Reserved); if cfg!(debug_assertions) { assert!(block1.free_next_index().is_err()); } assert_eq!(block2.index(), 0); assert_eq!(block2.order(), 1); assert_eq!(block2.block_type(), BlockType::Free); assert_eq!(block2.free_next_index().unwrap(), 2); assert_eq!(container[..8], [0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]); assert_eq!(container[8..16], [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]); assert_eq!(container[16..24], [0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]); assert_eq!(container[24..32], [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]); assert_eq!(container[32..40], [0x03, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]); assert_eq!(container[40..48], [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]); }
rust_cleaned_test_functions.jsonl/100145
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 762 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 40991, 368, 341, 286, 1077, 5476, 284, 508, 15, 84, 23, 26, 18021, 486, 16413, 26677, 4098, 353, 220, 18, 935, 286, 1077, 5206, 2504, 16, 284, 8362, 486, 931, 8905, 2099, 3586, 95874, 1125, 22...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_array_buffer() { let gil = Python::acquire_gil(); let py = gil.python(); let array = py .import("array") .unwrap() .call_method("array", ("f", (1.0, 1.5, 2.0, 2.5)), None) .unwrap(); let buffer = PyBuffer::get(py, array).unwrap(); assert_eq!(buffer.dimensions(), 1); assert_eq!(buffer.item_count(), 4); assert_eq!(buffer.format().to_str().unwrap(), "f"); assert_eq!(buffer.shape(), [4]); assert!(buffer.as_slice::<f64>(py).is_none()); assert!(buffer.as_slice::<i32>(py).is_none()); let slice = buffer.as_slice::<f32>(py).unwrap(); assert_eq!(slice.len(), 4); assert_eq!(slice[0].get(), 1.0); assert_eq!(slice[3].get(), 2.5); let mut_slice = buffer.as_mut_slice::<f32>(py).unwrap(); assert_eq!(mut_slice.len(), 4); assert_eq!(mut_slice[0].get(), 1.0); mut_slice[3].set(2.75); assert_eq!(slice[3].get(), 2.75); buffer .copy_from_slice(py, &[10.0f32, 11.0, 12.0, 13.0]) .unwrap(); assert_eq!(slice[2].get(), 12.0); assert_eq!(buffer.to_vec::<f32>(py).unwrap(), [10.0, 11.0, 12.0, 13.0]); }
rust_cleaned_test_functions.jsonl/60683
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 670 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3858, 7776, 368, 341, 286, 1077, 342, 321, 284, 13027, 486, 580, 984, 1889, 321, 543, 286, 1077, 4510, 284, 342, 321, 43193, 543, 286, 1077, 1334, 284, 4510, 198, 310, 659, 474, 445, 1653, 113...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_plug_and_unplug_device() { test_plug_and_unplug_device_in_scope(Scope::Input); test_plug_and_unplug_device_in_scope(Scope::Output); }
rust_cleaned_test_functions.jsonl/23848
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 72 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6317, 768, 8378, 4907, 47474, 9204, 368, 341, 262, 1273, 6317, 768, 8378, 4907, 47474, 9204, 1243, 23199, 3759, 2417, 486, 2505, 317, 262, 1273, 6317, 768, 8378, 4907, 47474, 9204, 1243, 23199, 37...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_fizz_or_buzz_trivial() { let three_four = FizzBuzz::new(3, 4); assert_eq!("fizz", three_four.get_value(3)); assert_eq!("buzz", three_four.get_value(4)); }
rust_cleaned_test_functions.jsonl/74960
{ "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, 761, 8759, 8734, 880, 8889, 3547, 26658, 368, 341, 286, 1077, 2326, 56142, 284, 434, 8759, 59473, 486, 931, 7, 18, 11, 220, 19, 317, 286, 2060, 10714, 17223, 69, 8759, 497, 2326, 56142, 670, 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
#[test] fn test_get_fields() { println!("asdas"); let path_to_test_avro = Path::new("./test_assets/bttf.avro").to_str().unwrap().to_owned(); let _cli = CliService::from(path_to_test_avro, None); }
rust_cleaned_test_functions.jsonl/19655
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 136 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 12132, 368, 972, 286, 13751, 17223, 300, 34889, 2815, 286, 1077, 1815, 2346, 4452, 26173, 299, 284, 7933, 486, 931, 13988, 1944, 53299, 3470, 5566, 69, 40506, 299, 1827, 983, 2895, 1005, 154...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_struct_per_view_data_std140() { assert_eq!(std::mem::size_of::<PerViewDataStd140>(), 13360); assert_eq!(std::mem::size_of::<[[f32; 4]; 4]>(), 64); assert_eq!(std::mem::align_of::<[[f32; 4]; 4]>(), 4); assert_eq!(memoffset::offset_of!(PerViewDataStd140, view), 0); assert_eq!(std::mem::size_of::<[[f32; 4]; 4]>(), 64); assert_eq!(std::mem::align_of::<[[f32; 4]; 4]>(), 4); assert_eq!(memoffset::offset_of!(PerViewDataStd140, view_proj), 64); assert_eq!(std::mem::size_of::<[f32; 4]>(), 16); assert_eq!(std::mem::align_of::<[f32; 4]>(), 4); assert_eq!(memoffset::offset_of!(PerViewDataStd140, ambient_light), 128); assert_eq!(std::mem::size_of::<[f32; 2]>(), 8); assert_eq!(std::mem::align_of::<[f32; 2]>(), 4); assert_eq!(memoffset::offset_of!(PerViewDataStd140, jitter_amount), 144); assert_eq!(std::mem::size_of::<u32>(), 4); assert_eq!(std::mem::align_of::<u32>(), 4); assert_eq!( memoffset::offset_of!(PerViewDataStd140, viewport_width), 152 ); assert_eq!(std::mem::size_of::<u32>(), 4); assert_eq!(std::mem::align_of::<u32>(), 4); assert_eq!( memoffset::offset_of!(PerViewDataStd140, viewport_height), 156 ); assert_eq!(std::mem::size_of::<f32>(), 4); assert_eq!(std::mem::align_of::<f32>(), 4); assert_eq!(memoffset::offset_of!(PerViewDataStd140, mip_bias), 160); assert_eq!(std::mem::size_of::<f32>(), 4); assert_eq!(std::mem::align_of::<f32>(), 4); assert_eq!( memoffset::offset_of!(PerViewDataStd140, ndf_filter_amount), 164 ); assert_eq!(std::mem::size_of::<u32>(), 4); assert_eq!(std::mem::align_of::<u32>(), 4); assert_eq!( memoffset::offset_of!(PerViewDataStd140, directional_light_count), 168 ); assert_eq!(std::mem::size_of::<u32>(), 4); assert_eq!(std::mem::align_of::<u32>(), 4); assert_eq!( memoffset::offset_of!(PerViewDataStd140, use_clustered_lighting), 172 ); assert_eq!(std::mem::size_of::<[DirectionalLightStd140; 8]>(), 384); assert_eq!(std::mem::align_of::<[DirectionalLightStd140; 8]>(), 4); assert_eq!( memoffset::offset_of!(PerViewDataStd140, directional_lights), 176 ); assert_eq!(std::mem::size_of::<[ShadowMap2DDataStd140; 96]>(), 9216); assert_eq!(std::mem::align_of::<[ShadowMap2DDataStd140; 96]>(), 4); assert_eq!( memoffset::offset_of!(PerViewDataStd140, shadow_map_2d_data), 560 ); assert_eq!(std::mem::size_of::<[ShadowMapCubeDataStd140; 32]>(), 3584); assert_eq!(std::mem::align_of::<[ShadowMapCubeDataStd140; 32]>(), 4); assert_eq!( memoffset::offset_of!(PerViewDataStd140, shadow_map_cube_data), 9776 ); }
rust_cleaned_test_functions.jsonl/50161
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1611 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15126, 5678, 7122, 1769, 15656, 16, 19, 15, 368, 341, 286, 2060, 10714, 10297, 1834, 486, 10536, 486, 2141, 3575, 27638, 3889, 851, 1043, 22748, 16, 19, 15, 39019, 220, 16, 18, 18, 21, 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_downcast() { use std::any::Any; let r1: Rc<dyn Any> = Rc::new(i32::MAX); let r2: Rc<dyn Any> = Rc::new("abc"); assert!(r1.clone().downcast::<u32>().is_err()); let r1i32 = r1.downcast::<i32>(); assert!(r1i32.is_ok()); assert_eq!(r1i32.unwrap(), Rc::new(i32::MAX)); assert!(r2.clone().downcast::<i32>().is_err()); let r2str = r2.downcast::<&'static str>(); assert!(r2str.is_ok()); assert_eq!(r2str.unwrap(), Rc::new("abc")); }
rust_cleaned_test_functions.jsonl/40054
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 253 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13998, 3829, 368, 341, 262, 990, 1460, 486, 3767, 486, 8610, 401, 262, 1077, 435, 16, 25, 81463, 92846, 5765, 29, 284, 81463, 486, 931, 1956, 18, 17, 486, 10586, 317, 262, 1077, 435, 17, 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_utf8() { let uri = Uri::new(helpers::mongodb_test_connection_string()).unwrap(); let pool = ClientPool::new(uri, None); let client = pool.pop(); let mut collection = client.get_collection("rust_driver_test", "bulk_operation_utf8"); collection.drop().unwrap_or(()); let bulk_operation = collection.create_bulk_operation(None); let document = doc! {"key_1": "kācaṃ śaknomyattum; nopahinasti mām."}; bulk_operation.insert(&document).expect("Could not insert"); bulk_operation.execute().expect("Could not execute bulk operation"); let first_document = collection.find(&doc!{}, None).unwrap().next().unwrap().unwrap(); assert_eq!( first_document.get("key_1").unwrap(), &bson::Bson::String("kācaṃ śaknomyattum; nopahinasti mām.".to_string()) ); }
rust_cleaned_test_functions.jsonl/3255
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 359 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 39453, 23, 368, 341, 262, 1077, 13071, 310, 284, 17226, 486, 931, 3203, 17527, 486, 37197, 4452, 15866, 3904, 6011, 15454, 543, 262, 1077, 7314, 1843, 284, 8423, 10551, 486, 931, 25797, 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_tuple_correct() { let c: Color = (183, 65, 14).try_into().unwrap(); assert_eq!(c.red, 183); assert_eq!(c.green, 65); assert_eq!(c.blue, 14); }
rust_cleaned_test_functions.jsonl/14000
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 109 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21773, 31550, 368, 341, 286, 1077, 272, 25, 3478, 284, 320, 16, 23, 18, 11, 220, 21, 20, 11, 220, 16, 19, 568, 1539, 45514, 1005, 15454, 543, 286, 2060, 10714, 10297, 66, 17335, 11, 220, 16,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_index_and_neighbor() { use kailua_env::SourceFile; let mut source = Source::new(); let span = source.add(SourceFile::from_u8("dummy".to_string(), b"0123456789"[..].to_owned())); let pos = |i| span.clone().nth(i).unwrap(); let tokens = [Span::new(pos(1), pos(2)), Span::new(pos(2), pos(4)), Span::new(pos(5), pos(7)), Span::new(pos(8), pos(8))]; assert_eq!(index_and_neighbor(&tokens, pos(0), |&sp| sp), (0, false, false)); assert_eq!(index_and_neighbor(&tokens, pos(1), |&sp| sp), (0, false, false)); assert_eq!(index_and_neighbor(&tokens, pos(2), |&sp| sp), (0, true, true)); assert_eq!(index_and_neighbor(&tokens, pos(3), |&sp| sp), (1, false, true)); assert_eq!(index_and_neighbor(&tokens, pos(4), |&sp| sp), (1, true, true)); assert_eq!(index_and_neighbor(&tokens, pos(5), |&sp| sp), (2, false, false)); assert_eq!(index_and_neighbor(&tokens, pos(6), |&sp| sp), (2, false, true)); assert_eq!(index_and_neighbor(&tokens, pos(7), |&sp| sp), (2, true, true)); assert_eq!(index_and_neighbor(&tokens, pos(8), |&sp| sp), (3, false, false)); assert_eq!(index_and_neighbor(&tokens, pos(9), |&sp| sp), (3, false, false)); let tokens = [Span::new(pos(1), pos(2)), Span::new(pos(2), pos(4)), Span::new(pos(5), pos(8)), Span::new(pos(8), pos(8))]; assert_eq!(index_and_neighbor(&tokens, pos(7), |&sp| sp), (2, false, true)); assert_eq!(index_and_neighbor(&tokens, pos(8), |&sp| sp), (2, true, true)); assert_eq!(index_and_neighbor(&tokens, pos(9), |&sp| sp), (3, false, false)); }
rust_cleaned_test_functions.jsonl/4050
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 763 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3560, 8378, 71888, 368, 341, 262, 990, 595, 604, 4284, 15879, 486, 3608, 1703, 401, 1066, 262, 1077, 5206, 2530, 284, 8748, 486, 931, 543, 262, 1077, 9390, 284, 2530, 1364, 54296, 1703, 486, 149...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_fq2_squaring() { use super::fq::FqRepr; use PrimeField; let mut a = Fq2 { c0: Fq::one(), c1: Fq::one(), }; // u + 1 a.square(); assert_eq!( a, Fq2 { c0: Fq::zero(), c1: Fq::from_repr(FqRepr::from(2)).unwrap(), } ); // 2u let mut a = Fq2 { c0: Fq::zero(), c1: Fq::one(), }; // u a.square(); assert_eq!(a, { let mut neg1 = Fq::one(); neg1.negate(); Fq2 { c0: neg1, c1: Fq::zero(), } }); let mut a = Fq2 { c0: Fq::from_repr(FqRepr([ 0x9c2c6309bbf8b598, 0x4eef5c946536f602, 0x90e34aab6fb6a6bd, 0xf7f295a94e58ae7c, 0x41b76dcc1c3fbe5e, 0x7080c5fa1d8e042, ])).unwrap(), c1: Fq::from_repr(FqRepr([ 0x38f473b3c870a4ab, 0x6ad3291177c8c7e5, 0xdac5a4c911a4353e, 0xbfb99020604137a0, 0xfc58a7b7be815407, 0x10d1615e75250a21, ])).unwrap(), }; a.square(); assert_eq!( a, Fq2 { c0: Fq::from_repr(FqRepr([ 0xf262c28c538bcf68, 0xb9f2a66eae1073ba, 0xdc46ab8fad67ae0, 0xcb674157618da176, 0x4cf17b5893c3d327, 0x7eac81369c43361 ])).unwrap(), c1: Fq::from_repr(FqRepr([ 0xc1579cf58e980cf8, 0xa23eb7e12dd54d98, 0xe75138bce4cec7aa, 0x38d0d7275a9689e1, 0x739c983042779a65, 0x1542a61c8a8db994 ])).unwrap(), } ); }
rust_cleaned_test_functions.jsonl/130063
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1250 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 761, 80, 17, 643, 446, 3249, 368, 341, 262, 990, 2256, 486, 63919, 486, 37, 80, 693, 649, 280, 262, 990, 12518, 1877, 401, 262, 1077, 5206, 264, 284, 434, 80, 17, 341, 286, 272, 15, 25, 43...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_char_indices_last() { let s = "ศไทย中华Việt Nam"; let mut it = s.char_indices(); it.next(); assert_eq!(it.last(), Some((27, 'm'))); }
rust_cleaned_test_functions.jsonl/17641
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 95 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9232, 18333, 12195, 368, 341, 262, 1077, 274, 284, 330, 123863, 125451, 100849, 35544, 124382, 29974, 876, 262, 1077, 5206, 432, 284, 274, 11154, 18333, 543, 262, 432, 4529, 543, 262, 2060, 10714, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_dependency_parsing() { let args = Args { vers: Some("0.4.2".to_owned()), ..Args::default() }; assert_eq!( args.parse_dependencies().unwrap(), vec![Dependency::new("demo").set_version("0.4.2")] ); }
rust_cleaned_test_functions.jsonl/88107
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 173 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 62387, 620, 28598, 368, 341, 286, 1077, 2827, 284, 17693, 341, 310, 5436, 25, 4329, 445, 15, 13, 19, 13, 17, 3263, 983, 51973, 14702, 310, 5241, 4117, 486, 2258, 741, 286, 3634, 286, 2060, 107...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_step_backward() { assert_eq!(Step::backward_checked(255_u8, 200_usize), Some(55_u8)); assert_eq!(Step::backward_checked(100_u8, 200_usize), None); assert_eq!(Step::backward_checked(255_u8, 256_usize), None); assert_eq!(Step::backward_checked(90_i8, 200_usize), Some(-110_i8)); assert_eq!(Step::backward_checked(110_i8, 248_usize), None); assert_eq!(Step::backward_checked(127_i8, 256_usize), None); assert_eq!(Step::backward_checked(135_u16, 100_usize), Some(35_u16)); assert_eq!(Step::backward_checked(u16::MAX, 65500_usize), Some(35_u16)); assert_eq!(Step::backward_checked(10_u16, 11_usize), None); assert_eq!(Step::backward_checked(90_i16, 200_usize), Some(-110_i16)); assert_eq!(Step::backward_checked(30_020_i16, 50_050_usize), Some(-20_030_i16)); assert_eq!(Step::backward_checked(-10_i16, 40_000_usize), None); assert_eq!(Step::backward_checked(-10_i16, 70_000_usize), None); assert_eq!(Step::backward_checked(70_010_u128, 70_000_usize), Some(10_u128)); assert_eq!(Step::backward_checked(70_020_i128, 70_030_usize), Some(-10_i128)); assert_eq!(Step::backward_checked(10_u128, 7_usize), Some(3_u128)); assert_eq!(Step::backward_checked(10_u128, 11_usize), None); assert_eq!( Step::backward_checked(-0x7fff_ffff_ffff_ffff__ffff_ffff_ffff_ff00_i128, 0x100_usize), Some(i128::MIN) ); }
rust_cleaned_test_functions.jsonl/108059
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 636 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11946, 70477, 368, 341, 262, 2060, 10714, 10297, 8304, 486, 81196, 56456, 7, 17, 20, 20, 7300, 23, 11, 220, 17, 15, 15, 11306, 551, 701, 4329, 7, 20, 20, 7300, 23, 1106, 262, 2060, 10714, 10...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_if_let_with_match_no_else() { check_assist( replace_if_let_with_match, r#" impl VariantData { pub fn foo(&self) { if $0let VariantData::Struct(..) = *self { self.foo(); } } } "#, r#" impl VariantData { pub fn foo(&self) { match *self { VariantData::Struct(..) => { self.foo(); } _ => (), } } } "#, ) }
rust_cleaned_test_functions.jsonl/32540
{ "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, 11119, 62, 1149, 6615, 10708, 6536, 62628, 368, 341, 286, 1779, 12083, 380, 1006, 310, 8290, 11119, 62, 1149, 6615, 10708, 345, 310, 435, 2, 698, 6383, 39292, 1043, 341, 262, 6675, 5168, 15229, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_cli_help() { Command::cargo_bin("xplr") .unwrap() .arg("-h") .assert() .success() .code(0) .stderr(""); Command::cargo_bin("xplr") .unwrap() .arg("--help") .assert() .success() .code(0) .stderr(""); }
rust_cleaned_test_functions.jsonl/89765
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 260 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 47147, 26926, 368, 341, 286, 7348, 486, 66715, 21816, 445, 87, 94845, 1138, 310, 659, 15454, 741, 310, 659, 858, 13645, 71, 1138, 310, 659, 2207, 741, 310, 659, 5630, 741, 310, 659, 1851, 7, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_encryption_cyphertext_sum() { for _ in 0..10 { let msg1 = Message::random().unwrap(); let msg2 = Message::random().unwrap(); let msg3_from_sum = (msg1 + msg2).unwrap(); let sk1 = PrivateKey::new().unwrap(); let sk2 = PrivateKey::new().unwrap(); let pk2 = PublicKey::new(sk2); let cyph1 = encrypt(msg1, pk2, sk1).unwrap(); let cyph2 = encrypt(msg2, pk2, sk1).unwrap(); let cyph3_from_sum = (cyph1 + cyph2).unwrap(); let msg3_from_decrypt = decrypt(cyph3_from_sum, sk2).unwrap(); assert_eq!(msg3_from_sum, msg3_from_decrypt) } }
rust_cleaned_test_functions.jsonl/42594
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 313 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13781, 15597, 666, 88, 759, 37220, 10160, 368, 341, 262, 369, 716, 304, 220, 15, 496, 16, 15, 341, 286, 1077, 3750, 16, 284, 4856, 486, 11463, 1005, 15454, 543, 286, 1077, 3750, 17, 284, 4856,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_curve25519() { let mut keypair: SodiumDh25519 = Default::default(); let scalar = Vec::<u8>::from_hex("a546e36bf0527c9d3b16154b82465edd62144c0ac1fc5a18506a2244ba449ac4") .unwrap(); keypair.set(&scalar); let public = Vec::<u8>::from_hex("e6db6867583030db3594c1a424b15f7c726624ec26b3353b10a903a6d0ab1c4c") .unwrap(); let mut output = [0_u8; 32]; keypair.dh(&public, &mut output).unwrap(); assert_eq!( output, Vec::<u8>::from_hex("c3da55379de9c6908e94ea4df28d084f32eccf03491c71f754b4075577a28552") .unwrap() .as_ref() ); }
rust_cleaned_test_functions.jsonl/69375
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 443 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 43407, 17, 20, 20, 16, 24, 368, 341, 1789, 286, 1077, 5206, 1376, 12670, 25, 82441, 35, 71, 17, 20, 20, 16, 24, 284, 7899, 486, 2258, 543, 286, 1077, 17274, 4035, 310, 11312, 27638, 84, 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_keywords() { let mut reader = Lexer::from_str("fun let while if else self class"); assert_tok(&mut reader, TokenKind::Fun, 1, 1); assert_tok(&mut reader, TokenKind::Let, 1, 5); assert_tok(&mut reader, TokenKind::While, 1, 9); assert_tok(&mut reader, TokenKind::If, 1, 15); assert_tok(&mut reader, TokenKind::Else, 1, 18); let mut reader = Lexer::from_str("self class super"); assert_tok(&mut reader, TokenKind::This, 1, 1); assert_tok(&mut reader, TokenKind::Class, 1, 6); assert_tok(&mut reader, TokenKind::Super, 1, 12); let mut reader = Lexer::from_str("loop break continue return nil"); assert_tok(&mut reader, TokenKind::Loop, 1, 1); assert_tok(&mut reader, TokenKind::Break, 1, 6); assert_tok(&mut reader, TokenKind::Continue, 1, 12); assert_tok(&mut reader, TokenKind::Return, 1, 21); assert_tok(&mut reader, TokenKind::Nil, 1, 28); let mut reader = Lexer::from_str("type struct enum alias trait const"); assert_tok(&mut reader, TokenKind::Type, 1, 1); assert_tok(&mut reader, TokenKind::Struct, 1, 6); assert_tok(&mut reader, TokenKind::Enum, 1, 13); assert_tok(&mut reader, TokenKind::Alias, 1, 18); assert_tok(&mut reader, TokenKind::Trait, 1, 24); assert_tok(&mut reader, TokenKind::Const, 1, 30); let mut reader = Lexer::from_str("for in impl Self"); assert_tok(&mut reader, TokenKind::For, 1, 1); assert_tok(&mut reader, TokenKind::In, 1, 5); assert_tok(&mut reader, TokenKind::Impl, 1, 8); assert_tok(&mut reader, TokenKind::CapitalThis, 1, 13); let mut reader = Lexer::from_str("defer"); assert_tok(&mut reader, TokenKind::Defer, 1, 1); }
rust_cleaned_test_functions.jsonl/101136
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 775 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 51354, 368, 341, 286, 1077, 5206, 6604, 284, 85082, 486, 1499, 2895, 445, 11894, 1077, 1393, 421, 770, 656, 536, 797, 286, 2060, 76162, 2099, 6984, 6604, 11, 9660, 10629, 486, 30855, 11, 220, 16...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_listener_startup() { let mut config = ClusterConfig { node_stakes: vec![100; 1], cluster_lamports: 1_000, num_listeners: 3, validator_configs: make_identical_validator_configs(&ValidatorConfig::default(), 1), ..ClusterConfig::default() }; let cluster = LocalCluster::new(&mut config); let cluster_nodes = discover_cluster(&cluster.entry_point_info.gossip, 4).unwrap(); assert_eq!(cluster_nodes.len(), 4); }
rust_cleaned_test_functions.jsonl/45694
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 205 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 46493, 80858, 368, 341, 262, 1077, 5206, 2193, 284, 35380, 2648, 341, 286, 2436, 1261, 2050, 25, 7486, 20703, 16, 15, 15, 26, 220, 16, 1259, 286, 10652, 907, 309, 3394, 25, 220, 16, 62, 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_cache_key() -> Result<()> { let db = Connection::open_in_memory()?; let cache = &db.cache; assert_eq!(0, cache.len()); //let sql = " PRAGMA schema_version; -- comment"; let sql = "PRAGMA schema_version; "; { let mut stmt = db.prepare_cached(sql)?; assert_eq!(0, cache.len()); assert_eq!(0, stmt.query_row([], |r| r.get::<_, i64>(0))?); } assert_eq!(1, cache.len()); { let mut stmt = db.prepare_cached(sql)?; assert_eq!(0, cache.len()); assert_eq!(0, stmt.query_row([], |r| r.get::<_, i64>(0))?); } assert_eq!(1, cache.len()); Ok(()) }
rust_cleaned_test_functions.jsonl/14523
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 404 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11529, 3097, 368, 1464, 5714, 71698, 341, 286, 1077, 2927, 284, 11032, 486, 2508, 1243, 19195, 94136, 286, 1077, 6500, 284, 609, 1999, 20087, 280, 286, 2060, 10714, 10297, 15, 11, 6500, 19406, 523...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_buffer_read_allocated() { let mut ring = RingBuffer::new(vec![b'.'; 12]); ring.enqueue_many(12).copy_from_slice(b"abcdefghijkl"); let mut data = [0; 6]; assert_eq!(ring.read_allocated(0, &mut data[..]), 6); assert_eq!(&data[..], b"abcdef"); ring.dequeue_many(6).copy_from_slice(b"ABCDEF"); ring.enqueue_many(3).copy_from_slice(b"mno"); let mut data = [0; 6]; assert_eq!(ring.read_allocated(3, &mut data[..]), 6); assert_eq!(&data[..], b"jklmno"); let mut data = [0; 6]; assert_eq!(ring.read_allocated(6, &mut data[..]), 3); assert_eq!(&data[..], b"mno\x00\x00\x00"); }
rust_cleaned_test_functions.jsonl/37272
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 358 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 7776, 6443, 82342, 368, 341, 286, 1077, 5206, 10058, 284, 21525, 4095, 486, 931, 25592, 20703, 65, 6, 3159, 26, 220, 16, 17, 2558, 286, 10058, 47468, 22101, 7, 16, 17, 568, 8560, 5673, 26488, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_addition() { let ctxt = get_test_vector_only_context(); let mut state = InterpreterState::new(&ctxt); let args = vec![term_ref(array![1.0f32, 2.0f32]), term_ref(array![3.0f32, 4.0f32])]; let addition_func = BinaryFuncImpl { elem_type : TEST_VECTOR_T, f : Box::new(AddOperator {}) }; let (result, _) = addition_func.evaluate(&mut state, args); assert_equal_vector_term(result, array![4.0f32, 6.0f32].view()); }
rust_cleaned_test_functions.jsonl/49741
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 256 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2891, 680, 368, 341, 286, 1077, 59162, 284, 633, 4452, 12247, 18410, 8467, 543, 286, 1077, 5206, 1584, 284, 82493, 1397, 486, 931, 2099, 77492, 317, 286, 1077, 2827, 284, 7486, 20703, 4991, 7793, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_rotate_nearest_rgb() { fn rotate_nearest_about_center(image: &RgbImage) -> RgbImage { rotate_about_center(image, std::f32::consts::PI/4f32, Interpolation::Nearest) } compare_to_truth_rgb("elephant.png", "elephant_rotate_nearest.png", rotate_nearest_about_center); }
rust_cleaned_test_functions.jsonl/20065
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 133 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 60834, 13925, 15432, 37407, 368, 341, 262, 5168, 16919, 13925, 15432, 57975, 21087, 10075, 25, 609, 80951, 1906, 8, 1464, 431, 9511, 1906, 341, 286, 16919, 57975, 21087, 10075, 11, 1460, 486, 69, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_parse_package_set_with_packages() { let config_str = r##" name: lux env-file: sample.env actions: packages: - name: lux kind: language: python link-files: set-lux: "{{local-bin}}/set-lux" "##; let package_set: PackageSet = serde_yaml::from_str(config_str).unwrap(); println!("{:?}", package_set); assert_eq!(package_set.name(), "lux"); assert_eq!(package_set.env_file(), &Some("sample.env".to_string())); assert_eq!(package_set.packages().unwrap().count(), 1); assert!(package_set.scripts().is_none()); assert_eq!(package_set.link_files().len(), 1) }
rust_cleaned_test_functions.jsonl/25405
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 338 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 26328, 2602, 6615, 41874, 368, 341, 262, 1077, 2193, 2895, 284, 435, 565, 698, 286, 829, 25, 14050, 198, 286, 6105, 14203, 25, 6077, 9265, 198, 286, 6168, 510, 688, 14185, 510, 310, 481, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_add_builtin_account_after_frozen() { use std::str::FromStr; let (genesis_config, _mint_keypair) = create_genesis_config(100_000); let slot = 123; let program_id = Pubkey::from_str("CiXgo2KHKSDmDnV1F6B69eWFgNAPiSBjjYvfB4cvRNre").unwrap(); let bank = Bank::new_from_parent( &Arc::new(Bank::new_for_tests(&genesis_config)), &Pubkey::default(), slot, ); bank.freeze(); bank.add_builtin_account("mock_program", &program_id, false); }
rust_cleaned_test_functions.jsonl/28955
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 283 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2891, 73829, 13500, 19844, 761, 42240, 368, 341, 286, 990, 1460, 486, 495, 486, 3830, 2580, 280, 286, 1077, 320, 77894, 5332, 11, 716, 67791, 3097, 12670, 8, 284, 1855, 16322, 13774, 5332, 7, 16...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_buffered_writer_seek() { task::block_on(async { let mut w = BufWriter::with_capacity(3, io::Cursor::new(Vec::new())); w.write_all(&[0, 1, 2, 3, 4, 5]).await.unwrap(); w.write_all(&[6, 7]).await.unwrap(); assert_eq!(w.seek(SeekFrom::Current(0)).await.ok(), Some(8)); assert_eq!(&w.get_ref().get_ref()[..], &[0, 1, 2, 3, 4, 5, 6, 7][..]); assert_eq!(w.seek(SeekFrom::Start(2)).await.ok(), Some(2)); }) }
rust_cleaned_test_functions.jsonl/128033
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 249 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 7776, 291, 28908, 74473, 368, 341, 262, 3383, 486, 4574, 4470, 18285, 341, 286, 1077, 5206, 289, 284, 69013, 6492, 486, 4197, 35603, 7, 18, 11, 6399, 486, 14543, 486, 931, 49923, 486, 931, 7392,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_panics() { let mut dst = [0u8; 16]; let _ = convert_utf8_to_latin1_lossy("\u{100}".as_bytes(), &mut dst[..]); }
rust_cleaned_test_functions.jsonl/27315
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 98 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 34910, 39453, 23, 2346, 907, 14768, 16, 11193, 88, 71099, 1211, 368, 341, 286, 1077, 5206, 10648, 284, 508, 15, 84, 23, 26, 220, 16, 21, 935, 286, 1077, 716, 284, 5508, 39453, 23, 2346, 907, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_split_check() { let path = Builder::new().prefix("test-raftstore").tempdir().unwrap(); let path_str = path.path().to_str().unwrap(); let db_opts = DBOptions::new(); let mut cf_opts = ColumnFamilyOptions::new(); let f = Box::new(RangePropertiesCollectorFactory::default()); cf_opts.add_table_properties_collector_factory("tikv.range-collector", f); let cfs_opts = ALL_CFS .iter() .map(|cf| CFOptions::new(cf, cf_opts.clone())) .collect(); let engine = Arc::new(new_engine_opt(path_str, db_opts, cfs_opts).unwrap()); let mut region = Region::default(); region.set_id(1); region.set_start_key(vec![]); region.set_end_key(vec![]); region.mut_peers().push(Peer::default()); region.mut_region_epoch().set_version(2); region.mut_region_epoch().set_conf_ver(5); let (tx, rx) = mpsc::sync_channel(100); let mut cfg = Config::default(); cfg.region_max_size = ReadableSize(100); cfg.region_split_size = ReadableSize(60); cfg.batch_split_limit = 5; let mut runnable = SplitCheckRunner::new( Arc::clone(&engine), tx.clone(), Arc::new(CoprocessorHost::new(tx)), cfg, ); // so split key will be [z0006] for i in 0..7 { let s = keys::data_key(format!("{:04}", i).as_bytes()); engine.put(&s, &s).unwrap(); } runnable.run(SplitCheckTask::split_check( region.clone(), true, CheckPolicy::Scan, )); // size has not reached the max_size 100 yet. match rx.try_recv() { Ok((region_id, CasualMessage::RegionApproximateSize { .. })) => { assert_eq!(region_id, region.get_id()); } others => panic!("expect recv empty, but got {:?}", others), } for i in 7..11 { let s = keys::data_key(format!("{:04}", i).as_bytes()); engine.put(&s, &s).unwrap(); } // we flush it to SST so we can use the size properties instead. engine.flush(true).unwrap(); runnable.run(SplitCheckTask::split_check( region.clone(), true, CheckPolicy::Scan, )); must_split_at(&rx, &region, vec![b"0006".to_vec()]); for i in 11..19 { let s = keys::data_key(format!("{:04}", i).as_bytes()); engine.put(&s, &s).unwrap(); } engine.flush(true).unwrap(); runnable.run(SplitCheckTask::split_check( region.clone(), true, CheckPolicy::Scan, )); must_split_at(&rx, &region, vec![b"0006".to_vec(), b"0012".to_vec()]); // for test batch_split_limit for i in 19..51 { let s = keys::data_key(format!("{:04}", i).as_bytes()); engine.put(&s, &s).unwrap(); } engine.flush(true).unwrap(); runnable.run(SplitCheckTask::split_check( region.clone(), true, CheckPolicy::Scan, )); must_split_at( &rx, &region, vec![ b"0006".to_vec(), b"0012".to_vec(), b"0018".to_vec(), b"0024".to_vec(), b"0030".to_vec(), ], ); drop(rx); // It should be safe even the result can't be sent back. runnable.run(SplitCheckTask::split_check(region, true, CheckPolicy::Scan)); }
rust_cleaned_test_functions.jsonl/4840
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1931 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 17052, 7200, 368, 341, 286, 1077, 1815, 284, 20626, 486, 931, 1005, 11849, 445, 1944, 12, 2944, 4314, 1827, 3888, 3741, 1005, 15454, 543, 286, 1077, 1815, 2895, 284, 1815, 3875, 1005, 983, 2895, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
#[test] fn test_simple() { #[derive(PartialEq, TypedBuilder)] struct Foo { x: i32, y: i32, } assert!(Foo::builder().x(1).y(2).build() == Foo { x: 1, y: 2 }); assert!(Foo::builder().y(1).x(2).build() == Foo { x: 2, y: 1 }); }
rust_cleaned_test_functions.jsonl/36677
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 141 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 30015, 368, 341, 262, 11506, 27098, 5304, 20894, 27312, 11, 50554, 3297, 5563, 262, 2036, 33428, 341, 286, 856, 25, 600, 18, 17, 345, 286, 379, 25, 600, 18, 17, 345, 262, 555, 262, 2060, 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_map_schema() { let schema = Schema::parse_str(r#"{"type": "map", "values": "double"}"#).unwrap().schema; assert_eq!(Schema::Map(Box::new(Schema::Double)), schema); }
rust_cleaned_test_functions.jsonl/24774
{ "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, 5376, 25371, 368, 341, 286, 1077, 10802, 284, 12539, 486, 6400, 2895, 2601, 55543, 4913, 1313, 788, 330, 2186, 497, 330, 3661, 788, 330, 4331, 9207, 57676, 568, 15454, 1005, 17349, 280, 286, 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
#[test] fn test_executor_execute_same_block_multiple_times() { let executor = TestExecutor::new(); let parent_block_id = executor.committed_block_id(); let block_id = gen_block_id(1); let version = 100; let txns: Vec<_> = (0..version) .map(|i| encode_mint_transaction(gen_address(i), 100)) .collect(); let mut responses = vec![]; for _i in 0..100 { let output = executor .execute_block((block_id, txns.clone()), parent_block_id) .unwrap(); responses.push(output); } responses.dedup(); assert_eq!(responses.len(), 1); }
rust_cleaned_test_functions.jsonl/12646
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 278 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 81207, 44329, 33574, 7113, 45233, 22353, 368, 341, 262, 1077, 31558, 284, 3393, 25255, 486, 931, 543, 262, 1077, 2681, 7113, 842, 284, 31558, 905, 5483, 7113, 842, 543, 262, 1077, 2504, 842, 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...
2
#[test] fn test_rewrite_paths() { use super::{rewrite_paths, SPEC}; use openapiv3::OpenAPI; let prefix = "/test_prefix"; let spec_object: OpenAPI = serde_json::from_str(SPEC).expect("couldn't parse JSON file"); let paths_before = spec_object.paths; let paths_after = rewrite_paths(paths_before.clone(), &prefix); paths_before.iter().zip(paths_after.iter()).for_each( |((path_before, _), (path_after, _))| { assert_ne!(path_after, path_before); assert_eq!(path_after, &format!("{}{}", prefix, path_before)); assert!(path_after.as_str().starts_with(prefix)); }, ); }
rust_cleaned_test_functions.jsonl/9044
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 345 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 74052, 24152, 368, 341, 286, 990, 2256, 22964, 52473, 24152, 11, 47104, 2440, 286, 990, 1787, 391, 344, 18, 486, 5002, 7082, 401, 286, 1077, 9252, 284, 3521, 1944, 13974, 876, 286, 1077, 1398, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_raw_ir_literal_stream() { let raw_file = include_bytes!("../../testdata/random_then_unicode"); let ir = include_bytes!("../../testdata/random_then_unicode.ir"); bench_with_ir(65536, TestContextMixing{size:1024 * 1024}, 0.6, &mut Passthrough{}, &raw_file[..], 1048682, &ir[..], 3321851, ); }
rust_cleaned_test_functions.jsonl/65268
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 278 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 16067, 51433, 34100, 12673, 368, 341, 262, 1077, 7112, 2458, 284, 2924, 12524, 17223, 2748, 92425, 79442, 68367, 54662, 797, 262, 1077, 6216, 284, 2924, 12524, 17223, 2748, 92425, 79442, 68367, 54662,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_first_four() { let nums = (2..10_000).filter(|&n| perfect_number(n)) .collect::<Vec<usize>>(); assert_eq!(nums, [6, 28, 496, 8128]); }
rust_cleaned_test_functions.jsonl/20962
{ "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, 12978, 56142, 368, 341, 220, 1077, 10307, 284, 320, 17, 496, 16, 15, 62, 15, 15, 15, 568, 5315, 22428, 5, 77, 91, 4727, 5500, 1445, 1171, 4597, 659, 17384, 27638, 10050, 90244, 37038, 220, 206...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_11() { assert_eq!(Solution::max_area(vec![1, 8, 6, 2, 5, 4, 8, 3, 7]), 49); }
rust_cleaned_test_functions.jsonl/62156
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 64 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 62, 16, 16, 368, 341, 286, 2060, 10714, 10297, 36842, 486, 2810, 15030, 25592, 20703, 16, 11, 220, 23, 11, 220, 21, 11, 220, 17, 11, 220, 20, 11, 220, 19, 11, 220, 23, 11, 220, 18, 11, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_atomic_bloom() { let mut rng = rand::thread_rng(); let hash_values: Vec<_> = std::iter::repeat_with(|| solana_sdk::hash::new_rand(&mut rng)) .take(1200) .collect(); let bloom: AtomicBloom<_> = Bloom::<Hash>::random(1287, 0.1, 7424).into(); assert_eq!(bloom.keys.len(), 3); assert_eq!(bloom.num_bits, 6168); assert_eq!(bloom.bits.len(), 97); hash_values.par_iter().for_each(|v| { bloom.add(v); }); let bloom: Bloom<Hash> = bloom.into(); assert_eq!(bloom.keys.len(), 3); assert_eq!(bloom.bits.len(), 6168); assert!(bloom.num_bits_set > 2000); for hash_value in hash_values { assert!(bloom.contains(&hash_value)); } let false_positive = std::iter::repeat_with(|| solana_sdk::hash::new_rand(&mut rng)) .take(10_000) .filter(|hash_value| bloom.contains(hash_value)) .count(); assert!(false_positive < 2_000, "false_positive: {}", false_positive); }
rust_cleaned_test_functions.jsonl/34505
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 542 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 51367, 880, 18474, 368, 341, 286, 1077, 5206, 28422, 284, 10382, 486, 4528, 66849, 543, 286, 1077, 5175, 9146, 25, 11312, 32399, 29, 284, 1460, 486, 2015, 486, 30624, 6615, 79453, 2048, 3362, 6178...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_apply_creates_invalid_url() { let rule = Rule::new("fuchsia.com", "fuchsia.com", "/", "/a+b/").unwrap(); assert_matches!( rule.apply(&"fuchsia-pkg://fuchsia.com/foo".parse().unwrap()), Some(Err(ParseError::InvalidName(_))) ); }
rust_cleaned_test_functions.jsonl/57425
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 154 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 36551, 92862, 973, 31433, 2903, 368, 341, 286, 1077, 5912, 284, 18100, 486, 931, 445, 69, 73391, 905, 497, 330, 69, 73391, 905, 497, 64657, 3521, 64, 35093, 14, 1827, 15454, 543, 286, 2060, 3834...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_warn_succeed_if_rustup_sh_already_installed_y_flag() { clitools::setup(Scenario::SimpleV2, &|config| { config.create_rustup_sh_metadata(); let out = run(config, "rustup-init", &["-y", "--no-modify-path"], &[]); assert!(out.ok); assert!(out .stderr .contains("warning: it looks like you have existing rustup.sh metadata")); assert!(out .stderr .contains("error: cannot install while rustup.sh is installed")); assert!(out.stderr.contains( "warning: continuing (because the -y flag is set and the error is ignorable)" )); assert!(!out.stdout.contains("Continue? (y/N)")); }) }
rust_cleaned_test_functions.jsonl/58306
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 343 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 55045, 643, 29264, 11119, 1710, 590, 454, 3712, 80772, 79065, 4178, 10933, 368, 341, 262, 91762, 6178, 486, 15188, 7, 54031, 486, 16374, 53, 17, 11, 609, 91, 1676, 91, 341, 286, 2193, 2520, 1710...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_from_bytes_be() { fn check(s: &str, result: &str) { assert_eq!( BigInt::from_bytes_be(Plus, s.as_bytes()), BigInt::parse_bytes(result.as_bytes(), 10).unwrap() ); } check("A", "65"); check("AA", "16705"); check("AB", "16706"); check("Hello world!", "22405534230753963835153736737"); assert_eq!(BigInt::from_bytes_be(Plus, &[]), Zero::zero()); assert_eq!(BigInt::from_bytes_be(Minus, &[]), Zero::zero()); }
rust_cleaned_test_functions.jsonl/56606
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 241 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5673, 12524, 21263, 368, 341, 262, 5168, 1779, 1141, 25, 609, 495, 11, 1102, 25, 609, 495, 8, 341, 286, 2060, 10714, 33673, 310, 62608, 486, 1499, 12524, 21263, 7, 21807, 11, 274, 5357, 12524, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_etag_fmt() { assert_eq!( format!("{}", EntityTag::strong("foobar".to_owned())), "\"foobar\"" ); assert_eq!(format!("{}", EntityTag::strong("".to_owned())), "\"\""); assert_eq!( format!("{}", EntityTag::weak("weak-etag".to_owned())), "W/\"weak-etag\"" ); assert_eq!( format!("{}", EntityTag::weak("\u{0065}".to_owned())), "W/\"\x65\"" ); assert_eq!(format!("{}", EntityTag::weak("".to_owned())), "W/\"\""); }
rust_cleaned_test_functions.jsonl/21997
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 322 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 45668, 351, 38128, 368, 341, 286, 2060, 10714, 33673, 310, 3561, 79878, 10390, 5668, 486, 4519, 445, 50267, 3263, 983, 51973, 73727, 310, 15898, 50267, 2105, 698, 286, 1439, 286, 2060, 10714, 10297,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_monad_laws_left_identity() { fn f(x: usize) -> impl Iterator<Item = usize> { (0..10).map(move |y| x * y) } assert_eq!(once(42).flat_map(f.clone()).sum::<usize>(), f(42).sum()); }
rust_cleaned_test_functions.jsonl/54200
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 113 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 20737, 329, 907, 8635, 9579, 46244, 368, 341, 262, 5168, 282, 2075, 25, 22301, 8, 1464, 11605, 23023, 31857, 284, 22301, 29, 341, 286, 320, 15, 496, 16, 15, 568, 2186, 34081, 760, 88, 91, 856,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_make_rpc_request() { let (sender, receiver) = channel(); thread::spawn(move || { let rpc_addr = socketaddr!(0, 0); let mut io = IoHandler::default(); // Successful request io.add_method("getBalance", |_params: Params| { Ok(Value::Number(Number::from(50))) }); // Failed request io.add_method("getLastId", |params: Params| { if params != Params::None { Err(Error::invalid_request()) } else { Ok(Value::String( "deadbeefXjn8o3yroDHxUtKsZZgoy4GPkPPXfouKNHhx".to_string(), )) } }); let server = ServerBuilder::new(io) .threads(1) .cors(DomainsValidation::AllowOnly(vec![ AccessControlAllowOrigin::Any, ])).start_http(&rpc_addr) .expect("Unable to start RPC server"); sender.send(*server.address()).unwrap(); server.wait(); }); let rpc_addr = receiver.recv().unwrap(); let rpc_addr = format!("http://{}", rpc_addr.to_string()); let balance = RpcRequest::GetBalance.make_rpc_request( &rpc_addr, 1, Some(json!("deadbeefXjn8o3yroDHxUtKsZZgoy4GPkPPXfouKNHhx")), ); assert!(balance.is_ok()); assert_eq!(balance.unwrap().as_u64().unwrap(), 50); let last_id = RpcRequest::GetLastId.make_rpc_request(&rpc_addr, 2, None); assert!(last_id.is_ok()); assert_eq!( last_id.unwrap().as_str().unwrap(), "deadbeefXjn8o3yroDHxUtKsZZgoy4GPkPPXfouKNHhx" ); // Send erroneous parameter let last_id = RpcRequest::GetLastId.make_rpc_request(&rpc_addr, 3, Some(json!("paramter"))); assert_eq!(last_id.is_err(), true); }
rust_cleaned_test_functions.jsonl/82111
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1091 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 28230, 60799, 7893, 368, 341, 286, 1077, 320, 11644, 11, 13964, 8, 284, 5496, 543, 286, 4516, 486, 46087, 34081, 1369, 341, 310, 1077, 35596, 7387, 284, 7575, 6214, 10297, 15, 11, 220, 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...
3
#[test] fn test_subtraction_point_point() { let p1 = Point3::new(8827.1983, 89.5049494, 56.31); let p2 = Point3::new(89.0, 72.0, 936.5); let expected = Vector3::new(p1.x - p2.x, p1.y - p2.y, p1.z - p2.z); let result = p1 - p2; assert_eq!(result, expected); }
rust_cleaned_test_functions.jsonl/4555
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 170 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5228, 26425, 6085, 6085, 368, 341, 286, 1077, 281, 16, 284, 5126, 18, 486, 931, 7, 23, 23, 17, 22, 13, 16, 24, 23, 18, 11, 220, 23, 24, 13, 20, 15, 19, 24, 19, 24, 19, 11, 220, 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...
1
#[test] fn test_c_method_calls() { let mut unique_ptr = ffi::c_return_unique_ptr(); let old_value = unique_ptr.get(); assert_eq!(2020, old_value); assert_eq!(2021, unique_ptr.pin_mut().set(2021)); assert_eq!(2021, unique_ptr.get()); assert_eq!(2021, unique_ptr.get2()); assert_eq!(2021, *unique_ptr.getRef()); assert_eq!(2021, *unique_ptr.pin_mut().getMut()); assert_eq!(2022, unique_ptr.pin_mut().set_succeed(2022).unwrap()); assert!(unique_ptr.pin_mut().get_fail().is_err()); assert_eq!(2021, ffi::Shared { z: 0 }.c_method_on_shared()); assert_eq!(2022, *ffi::Shared { z: 2022 }.c_method_ref_on_shared()); assert_eq!(2023, *ffi::Shared { z: 2023 }.c_method_mut_on_shared()); let val = 42; let mut array = ffi::Array { a: [0, 0, 0, 0] }; array.c_set_array(val); assert_eq!(array.a.len() as i32 * val, array.r_get_array_sum()); }
rust_cleaned_test_functions.jsonl/50900
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 415 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 666, 9032, 45636, 368, 341, 262, 1077, 5206, 4911, 4348, 284, 76956, 486, 66, 12511, 21218, 4348, 1428, 262, 1077, 2310, 3142, 284, 4911, 4348, 670, 543, 262, 2060, 10714, 10297, 17, 15, 17, 15,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_rchunks_next_back() { let v = [0, 1, 2, 3, 4, 5]; let mut c = v.rchunks(2); assert_eq!(c.next_back().unwrap(), &[0, 1]); assert_eq!(c.next_back().unwrap(), &[2, 3]); assert_eq!(c.next_back().unwrap(), &[4, 5]); assert_eq!(c.next_back(), None); let v = [0, 1, 2, 3, 4, 5, 6, 7]; let mut c = v.rchunks(3); assert_eq!(c.next_back().unwrap(), &[0, 1]); assert_eq!(c.next_back().unwrap(), &[2, 3, 4]); assert_eq!(c.next_back().unwrap(), &[5, 6, 7]); assert_eq!(c.next_back(), None); }
rust_cleaned_test_functions.jsonl/9664
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 283 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1710, 84263, 11257, 3895, 368, 341, 262, 1077, 348, 284, 508, 15, 11, 220, 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20, 935, 262, 1077, 5206, 272, 284, 348, 1746, 84263, 7, 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_union() { let store = gen_store(); let union = store .sunion(vec!["test".to_string(), "test2".to_string()]) .unwrap(); assert_eq!(3, union.len()); }
rust_cleaned_test_functions.jsonl/58222
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 118 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 51621, 368, 341, 286, 1077, 3553, 284, 4081, 14809, 1428, 286, 1077, 11300, 284, 3553, 198, 310, 659, 82, 16192, 25592, 0, 1183, 1944, 3263, 983, 3904, 1507, 330, 1944, 17, 3263, 983, 3904, 5602...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_kary_and() { // test different numbers of operands for i in 1..15 { // with every possible assignment for them for mut b in 0..(1 << i) { let mut cs = TestConstraintSystem::<Fr>::new(); let mut expected = true; let mut bits = vec![]; for j in 0..i { expected &= b & 1 == 1; bits.push(Boolean::from( AllocatedBit::alloc(cs.ns(|| format!("bit_gadget {}", j)), || { Ok(b & 1 == 1) }) .unwrap(), )); b >>= 1; } let r = Boolean::kary_and(&mut cs, &bits).unwrap(); assert!(cs.is_satisfied()); match r { Boolean::Is(ref r) => { assert_eq!(r.value.unwrap(), expected); }, _ => unreachable!(), } } } }
rust_cleaned_test_functions.jsonl/232
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 692 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4698, 658, 8378, 368, 341, 286, 442, 1273, 2155, 5109, 315, 54510, 198, 286, 369, 600, 304, 220, 16, 496, 16, 20, 341, 310, 442, 448, 1449, 3204, 16319, 369, 1105, 198, 310, 369, 5206, 293, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
#[test] fn test_sha2() { let cases = vec![ ("pingcap", 0, "2871823be240f8ecd1d72f24c99eaa2e58af18b4b8ba99a4fc2823ba5c43930a"), ("pingcap", 224, "cd036dc9bec69e758401379c522454ea24a6327b48724b449b40c6b7"), ("pingcap", 256, "2871823be240f8ecd1d72f24c99eaa2e58af18b4b8ba99a4fc2823ba5c43930a"), ("pingcap", 384, "c50955b6b0c7b9919740d956849eedcb0f0f90bf8a34e8c1f4e071e3773f53bd6f8f16c04425ff728bed04de1b63db51"), ("pingcap", 512, "ea903c574370774c4844a83b7122105a106e04211673810e1baae7c2ae7aba2cf07465e02f6c413126111ef74a417232683ce7ba210052e63c15fc82204aad80"), ("13572468", 0, "1c91ab1c162fd0cae60a5bb9880f3e7d5a133a65b6057a644b26973d9c55dcfe"), ("13572468", 224, "8ad67735bbf49576219f364f4640d595357a440358d15bf6815a16e4"), ("13572468", 256, "1c91ab1c162fd0cae60a5bb9880f3e7d5a133a65b6057a644b26973d9c55dcfe"), ("13572468.123", 384, "3b4ee302435dc1e15251efd9f3982b1ca6fe4ac778d3260b7bbf3bea613849677eda830239420e448e4c6dc7c2649d89"), ("13572468.123", 512, "4820aa3f2760836557dc1f2d44a0ba7596333fdb60c8a1909481862f4ab0921c00abb23d57b7e67a970363cc3fcb78b25b6a0d45cdcac0e87aa0c96bc51f7f96"), ]; let mut ctx = EvalContext::default(); for (input_str, hash_length_i64, exp_str) in cases { let input = datum_expr(Datum::Bytes(input_str.as_bytes().to_vec())); let hash_length = datum_expr(Datum::I64(hash_length_i64)); let op = scalar_func_expr(ScalarFuncSig::Sha2, &[input, hash_length]); let op = Expression::build(&ctx, op).unwrap(); let got = op.eval(&mut ctx, &[]).unwrap(); let exp = Datum::Bytes(exp_str.as_bytes().to_vec()); assert_eq!(got, exp, "sha2('{:?}', {:?})", input_str, hash_length_i64); } //test NULL case let null_cases = vec![ (Datum::Null, Datum::I64(224), Datum::Null), (Datum::Bytes(b"pingcap".to_vec()), Datum::Null, Datum::Null), ( Datum::Bytes(b"pingcap".to_vec()), Datum::I64(123), Datum::Null, ), ]; for (input, hash_length, exp) in null_cases { let op = scalar_func_expr( ScalarFuncSig::Sha2, &[datum_expr(input.clone()), datum_expr(hash_length.clone())], ); let op = Expression::build(&ctx, op).unwrap(); let got = op.eval(&mut ctx, &[]).unwrap(); assert_eq!(got, exp, "sha2('{:?}', {:?})", input, hash_length); } }
rust_cleaned_test_functions.jsonl/104207
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1488 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 48836, 17, 368, 341, 286, 1077, 5048, 284, 7486, 90515, 310, 3489, 9989, 11346, 497, 220, 15, 11, 330, 17, 23, 22, 16, 23, 17, 18, 1371, 17, 19, 15, 69, 23, 37206, 16, 67, 22, 17, 69, 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...
3