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_raw_node_restart_from_snapshot() { let l = default_logger(); let snap = new_snapshot(2, 1, vec![1, 2]); let entries = vec![new_entry(1, 3, Some("foo"))]; let mut raw_node = { let store = new_storage(); store.wl().apply_snapshot(snap).unwrap(); store.wl().append(&entries).unwrap(); store.wl().set_hardstate(hard_state(1, 3, 0)); RawNode::new(&new_test_config(1, 10, 1), store, &l).unwrap() }; let rd = raw_node.ready(); must_cmp_ready(&rd, &None, &None, &[], &entries, &None, true, false); let _ = raw_node.advance(rd); assert!(!raw_node.has_ready()); }
rust_cleaned_test_functions.jsonl/53368
{ "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, 16067, 5084, 69392, 5673, 53265, 368, 341, 262, 1077, 326, 284, 1638, 27413, 543, 262, 1077, 10658, 284, 501, 53265, 7, 17, 11, 220, 16, 11, 7486, 20703, 16, 11, 220, 17, 2558, 262, 1077, 1069...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_lseek64() { const CONTENTS: &[u8] = b"abcdef123456"; let mut tmp = tempfile().unwrap(); tmp.write_all(CONTENTS).unwrap(); let tmpfd = tmp.into_raw_fd(); lseek64(tmpfd, 5, Whence::SeekSet).unwrap(); let mut buf = [0u8; 7]; ::read_exact(tmpfd, &mut buf); assert_eq!(b"f123456", &buf); close(tmpfd).unwrap(); }
rust_cleaned_test_functions.jsonl/8996
{ "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, 907, 25713, 21, 19, 368, 341, 262, 733, 35768, 50, 25, 44590, 84, 23, 60, 284, 293, 1, 41202, 16, 17, 18, 19, 20, 21, 876, 262, 1077, 5206, 4174, 284, 54819, 1005, 15454, 543, 262, 4174, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_feature_gate() { let (mut ep, raft_router, _task_rx) = mock_endpoint(&CdcConfig { min_ts_interval: ReadableDuration(Duration::from_secs(60)), ..Default::default() }); let _raft_rx = raft_router.add_region(1 /* region id */, 100 /* cap */); let quota = crate::channel::MemoryQuota::new(usize::MAX); let (tx, mut rx) = channel::channel(1, quota); let mut rx = rx.drain(); let mut region = Region::default(); region.set_id(1); let conn = Conn::new(tx, String::new()); let conn_id = conn.get_id(); ep.run(Task::OpenConn { conn }); let mut req_header = Header::default(); req_header.set_cluster_id(0); let mut req = ChangeDataRequest::default(); req.set_region_id(1); let region_epoch = req.get_region_epoch().clone(); let downstream = Downstream::new("".to_string(), region_epoch.clone(), 0, conn_id, true); ep.run(Task::Register { request: req.clone(), downstream, conn_id, version: semver::Version::new(4, 0, 6), }); let resolver = Resolver::new(1); let observe_id = ep.capture_regions[&1].handle.id; ep.on_region_ready(observe_id, resolver, region.clone()); ep.run(Task::MinTS { regions: vec![1], min_ts: TimeStamp::from(1), }); let cdc_event = channel::recv_timeout(&mut rx, Duration::from_millis(500)) .unwrap() .unwrap(); if let CdcEvent::ResolvedTs(r) = cdc_event.0 { assert_eq!(r.regions, vec![1]); assert_eq!(r.ts, 1); } else { panic!("unknown cdc event {:?}", cdc_event); } // Register region 2 to the conn. req.set_region_id(2); let downstream = Downstream::new("".to_string(), region_epoch.clone(), 0, conn_id, true); ep.run(Task::Register { request: req.clone(), downstream, conn_id, version: semver::Version::new(4, 0, 6), }); let resolver = Resolver::new(2); region.set_id(2); let observe_id = ep.capture_regions[&2].handle.id; ep.on_region_ready(observe_id, resolver, region); ep.run(Task::MinTS { regions: vec![1, 2], min_ts: TimeStamp::from(2), }); let cdc_event = channel::recv_timeout(&mut rx, Duration::from_millis(500)) .unwrap() .unwrap(); if let CdcEvent::ResolvedTs(mut r) = cdc_event.0 { r.regions.as_mut_slice().sort_unstable(); assert_eq!(r.regions, vec![1, 2]); assert_eq!(r.ts, 2); } else { panic!("unknown cdc event {:?}", cdc_event); } // Register region 3 to another conn which is not support batch resolved ts. let quota = crate::channel::MemoryQuota::new(usize::MAX); let (tx, mut rx2) = channel::channel(1, quota); let mut rx2 = rx2.drain(); let mut region = Region::default(); region.set_id(3); let conn = Conn::new(tx, String::new()); let conn_id = conn.get_id(); ep.run(Task::OpenConn { conn }); req.set_region_id(3); let downstream = Downstream::new("".to_string(), region_epoch, 3, conn_id, true); ep.run(Task::Register { request: req, downstream, conn_id, version: semver::Version::new(4, 0, 5), }); let resolver = Resolver::new(3); region.set_id(3); let observe_id = ep.capture_regions[&3].handle.id; ep.on_region_ready(observe_id, resolver, region); ep.run(Task::MinTS { regions: vec![1, 2, 3], min_ts: TimeStamp::from(3), }); let cdc_event = channel::recv_timeout(&mut rx, Duration::from_millis(500)) .unwrap() .unwrap(); if let CdcEvent::ResolvedTs(mut r) = cdc_event.0 { r.regions.as_mut_slice().sort_unstable(); // sends all region ids. assert_eq!(r.regions, vec![1, 2, 3]); assert_eq!(r.ts, 3); } else { panic!("unknown cdc event {:?}", cdc_event); } let cdc_event = channel::recv_timeout(&mut rx2, Duration::from_millis(500)) .unwrap() .unwrap(); if let CdcEvent::Event(mut e) = cdc_event.0 { assert_eq!(e.region_id, 3); assert_eq!(e.request_id, 3); let event = e.event.take().unwrap(); match event { Event_oneof_event::ResolvedTs(ts) => { assert_eq!(ts, 3); } other => panic!("unknown event {:?}", other), } } else { panic!("unknown cdc event {:?}", cdc_event); } }
rust_cleaned_test_functions.jsonl/41995
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2544 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 17069, 54798, 368, 341, 286, 1077, 320, 6984, 4155, 11, 52455, 55587, 11, 716, 8202, 24330, 8, 284, 7860, 36699, 2099, 34, 7628, 2648, 341, 310, 1308, 25023, 20541, 25, 4457, 480, 12945, 64114, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_accountsdb_squash_one_fork() { let paths = get_tmp_accounts_path!(); let db = AccountsDB::new(0, &paths.paths); let key = Pubkey::default(); let account0 = Account::new(1, 0, &key); db.store(0, &key, &account0); db.add_fork(1, Some(0)); db.add_fork(2, Some(0)); // now we have: // root0 -> key.lamports==1 // key.lamports==0 <- fork1 \ // fork2 -> key.lamports==1 // store value 0 in one child let account1 = Account::new(0, 0, &key); db.store(1, &key, &account1); // at the Accounts level) assert_eq!(&db.load(1, &key, true).unwrap(), &account1); // we should see 1 token in fork 2 assert_eq!(&db.load(2, &key, true).unwrap(), &account0); db.squash(1); // now we should have: // root0 -> key.lamports==1 // key.lamports==ANF <- root1 \ assert_eq!(db.load(1, &key, true), None); // purged assert_eq!(&db.load(2, &key, true).unwrap(), &account0); // original value }
rust_cleaned_test_functions.jsonl/77663
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 728 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 55665, 1999, 643, 446, 988, 11667, 761, 669, 368, 341, 286, 1077, 12716, 284, 633, 16125, 55665, 2638, 0, 543, 286, 1077, 2927, 284, 40655, 3506, 486, 931, 7, 15, 11, 609, 21623, 65345, 317, 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_generate_paillier_keypair() { let (paillier_pk, _) = generate_paillier_keypair(); assert!(NumberTests::bits(&paillier_pk.n) >= PAILLIER_KEY_SIZE - 1); }
rust_cleaned_test_functions.jsonl/62595
{ "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, 48851, 55475, 483, 1268, 3097, 12670, 368, 341, 286, 1077, 320, 6595, 483, 1268, 33321, 11, 27439, 284, 6923, 55475, 483, 1268, 3097, 12670, 543, 286, 2060, 10297, 2833, 18200, 486, 11516, 2099, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_transactions() { let (mock_db, client, mut runtime) = create_database_client_and_runtime(); let version = mock_db.get_latest_version().unwrap(); let page = 800usize; for base_version in (0..version) .map(u64::from) .take(page) .collect::<Vec<_>>() .into_iter() { let mut batch = JsonRpcBatch::default(); batch.add_get_transactions_request(base_version, page as u64, true); let result = execute_batch_and_get_first_response(&client, &mut runtime, batch); let txns = TransactionView::vec_from_response(result).unwrap(); for (i, view) in txns.iter().enumerate() { let version = base_version + i as u64; assert_eq!(view.version, version); let (tx, status) = &mock_db.all_txns[version as usize]; assert_eq!(view.hash, tx.hash().to_hex()); // Check we returned correct events let expected_events = mock_db .events .iter() .filter(|(v, _)| *v == view.version) .map(|(_, e)| e) .collect::<Vec<_>>(); assert_eq!(expected_events.len(), view.events.len()); assert_eq!(VMStatusView::from(status), view.vm_status); for (i, event_view) in view.events.iter().enumerate() { let expected_event = expected_events.get(i).expect("Expected event didn't find"); assert_eq!(event_view.sequence_number, expected_event.sequence_number()); assert_eq!(event_view.transaction_version, version); assert_eq!( event_view.key.0, BytesView::from(expected_event.key().as_bytes()).0 ); // TODO: check event_data } match tx { Transaction::BlockMetadata(t) => match view.transaction { TransactionDataView::BlockMetadata { timestamp_usecs } => { assert_eq!(t.clone().into_inner().unwrap().1, timestamp_usecs); } _ => panic!("Returned value doesn't match!"), }, Transaction::GenesisTransaction(_) => match view.transaction { TransactionDataView::WriteSet { .. } => {} _ => panic!("Returned value doesn't match!"), }, Transaction::UserTransaction(t) => match &view.transaction { TransactionDataView::UserTransaction { sender, script_hash, chain_id, .. } => { assert_eq!(&t.sender().to_string(), sender); assert_eq!(&t.chain_id().id(), chain_id); // TODO: verify every field if let TransactionPayload::Script(s) = t.payload() { assert_eq!(script_hash, &HashValue::sha3_256_of(s.code()).to_hex()); } } _ => panic!("Returned value doesn't match!"), }, } } } }
rust_cleaned_test_functions.jsonl/4631
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1734 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 68182, 368, 341, 262, 1077, 320, 16712, 8685, 11, 2943, 11, 5206, 15592, 8, 284, 1855, 27341, 8179, 8378, 33232, 1428, 262, 1077, 2319, 284, 7860, 8685, 670, 64880, 9438, 1005, 15454, 543, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
9
#[test] fn test_fails_when_secure_compare_different_strings() { let str1 = "same same".as_bytes(); let str2 = "same same but different".as_bytes(); let res = secure_compare(str1, str2); assert!(!res); }
rust_cleaned_test_functions.jsonl/45841
{ "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, 761, 6209, 47636, 73088, 32235, 82741, 33500, 368, 341, 286, 1077, 607, 16, 284, 330, 24063, 1852, 3263, 300, 12524, 543, 286, 1077, 607, 17, 284, 330, 24063, 1852, 714, 2155, 3263, 300, 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
#[test] fn test_ping_find_value() { let node_table = DummyNodeTable { node: None }; let mut svc: Service<TestsIdType, net::SocketAddr, DummyNodeTable, String> = Service::new(node_table); let node = test::new_node(test::make_id(43)); let id1: TestsIdType = test::make_id(44); let id2: TestsIdType = test::make_id(43); svc.handler.on_ping(&node); svc.stored_data_mut() .insert(id1.clone(), "foobar".to_string()); { let res1 = svc.handler.on_find_value(&node, &id1); match res1 { FindResult::Value(value) => assert_eq!("foobar", value), _ => panic!("wrong result {:?}", res1), } } { let res2 = svc.handler.on_find_value(&node, &id2); match res2 { FindResult::ClosestNodes(nodes) => assert_eq!(1, nodes.len()), _ => panic!("wrong result {:?}", res2), } } }
rust_cleaned_test_functions.jsonl/110958
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 535 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 71661, 21814, 3142, 368, 341, 286, 1077, 2436, 5237, 284, 50567, 1955, 2556, 314, 2436, 25, 2240, 2605, 286, 1077, 5206, 46154, 25, 5362, 27, 18200, 764, 929, 11, 4179, 486, 10286, 13986, 11, 50...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_build_parsed_datetime_timestamp() { run_test_build_parsed_datetime_timestamp( "2000-01-02", ParsedDateTime { year: Some(DateTimeFieldValue::new(2000, 0)), month: Some(DateTimeFieldValue::new(1, 0)), day: Some(DateTimeFieldValue::new(2, 0)), ..Default::default() }, ); run_test_build_parsed_datetime_timestamp( "2000", ParsedDateTime { year: Some(DateTimeFieldValue::new(2000, 0)), ..Default::default() }, ); run_test_build_parsed_datetime_timestamp( "2000-1-", ParsedDateTime { year: Some(DateTimeFieldValue::new(2000, 0)), month: Some(DateTimeFieldValue::new(1, 0)), ..Default::default() }, ); run_test_build_parsed_datetime_timestamp( "2000-01-02 3:4:5.6", ParsedDateTime { year: Some(DateTimeFieldValue::new(2000, 0)), month: Some(DateTimeFieldValue::new(1, 0)), day: Some(DateTimeFieldValue::new(2, 0)), hour: Some(DateTimeFieldValue::new(3, 0)), minute: Some(DateTimeFieldValue::new(4, 0)), second: Some(DateTimeFieldValue::new(5, 600_000_000)), ..Default::default() }, ); run_test_build_parsed_datetime_timestamp( "2000-01-02T3:4:5.6", ParsedDateTime { year: Some(DateTimeFieldValue::new(2000, 0)), month: Some(DateTimeFieldValue::new(1, 0)), day: Some(DateTimeFieldValue::new(2, 0)), hour: Some(DateTimeFieldValue::new(3, 0)), minute: Some(DateTimeFieldValue::new(4, 0)), second: Some(DateTimeFieldValue::new(5, 600_000_000)), ..Default::default() }, ); fn run_test_build_parsed_datetime_timestamp(test: &str, res: ParsedDateTime) { assert_eq!( ParsedDateTime::build_parsed_datetime_timestamp(test).unwrap(), res ); } }
rust_cleaned_test_functions.jsonl/100332
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1255 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 20801, 75788, 28943, 23073, 368, 341, 286, 1598, 4452, 20801, 75788, 28943, 23073, 1006, 310, 330, 17, 15, 15, 15, 12, 15, 16, 12, 15, 17, 756, 310, 393, 18112, 7689, 341, 394, 1042, 25, 4329,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_less_than() { let mut machine1 = Machine::new(vec![1107,1,2,5,99,-1]); machine1.execute().unwrap(); assert_eq!(machine1.mem, vec![1107,1,2,5,99,1]); let mut machine2 = Machine::new(vec![1107,2,2,5,99,-1]); machine2.execute().unwrap(); assert_eq!(machine2.mem, vec![1107,2,2,5,99,0]); }
rust_cleaned_test_functions.jsonl/43087
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 151 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 50747, 51613, 368, 341, 10217, 5206, 5662, 16, 284, 12960, 486, 931, 25592, 20703, 16, 16, 15, 22, 11, 16, 11, 17, 11, 20, 11, 24, 24, 4999, 16, 2558, 2109, 3814, 16, 7769, 1005, 15454, 543,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_subnet_new() { Subnet::new(Ipv4Addr::new([255, 255, 255, 255]), 32).unwrap(); // Prefix exceeds 32 bits assert_eq!(Subnet::new(Ipv4Addr::new([255, 255, 0, 0]), 33), None); // Network address has more than top 8 bits set assert_eq!(Subnet::new(Ipv4Addr::new([255, 255, 0, 0]), 8), None); AddrSubnet::<_, SpecifiedAddr<_>>::new(Ipv4Addr::new([1, 2, 3, 4]), 32).unwrap(); // The unspecified address is not considered to be a unicast address in // impl Debug) assert!(AddrSubnet::<_, SpecifiedAddr<_>>::new(Ipv4::UNSPECIFIED_ADDRESS, 16) == None); assert!(AddrSubnet::<_, SpecifiedAddr<_>>::new(Ipv6::UNSPECIFIED_ADDRESS, 64) == None); // Prefix exceeds 32/128 bits assert!(AddrSubnet::<_, SpecifiedAddr<_>>::new(Ipv4Addr::new([1, 2, 3, 4]), 33) == None); assert!( AddrSubnet::<_, SpecifiedAddr<_>>::new( Ipv6Addr::new([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]), 129 ) == None ); // Global broadcast assert!( AddrSubnet::<_, SpecifiedAddr<_>>::new(Ipv4::GLOBAL_BROADCAST_ADDRESS.into_addr(), 16) == None ); // Subnet broadcast assert!( AddrSubnet::<_, SpecifiedAddr<_>>::new(Ipv4Addr::new([192, 168, 255, 255]), 16) == None ); // Multicast assert!(AddrSubnet::<_, SpecifiedAddr<_>>::new(Ipv4Addr::new([224, 0, 0, 1]), 16) == None); assert!( AddrSubnet::<_, SpecifiedAddr<_>>::new( Ipv6Addr::new([0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]), 64 ) == None ); // addresses are rejected. Note that this address was accepted above // when `SpecifiedAddr` was used. assert!(AddrSubnet::<_, LinkLocalAddr<_>>::new(Ipv4Addr::new([1, 2, 3, 4]), 32) == None); }
rust_cleaned_test_functions.jsonl/59635
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1048 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 95681, 5921, 368, 341, 286, 3719, 4711, 486, 931, 8972, 30168, 19, 13986, 486, 931, 2561, 17, 20, 20, 11, 220, 17, 20, 20, 11, 220, 17, 20, 20, 11, 220, 17, 20, 20, 9719, 220, 18, 17, 56...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_deck_next_card() { let mut deck = Deck::from_input("9 2 6 3 1"); assert_eq!(deck.next_card(), 9); assert_eq!(deck.next_card(), 2); assert_eq!(deck.next_card(), 6); assert_eq!(deck.next_card(), 3); assert_eq!(deck.next_card(), 1); assert!(deck.cards.is_empty()); }
rust_cleaned_test_functions.jsonl/25646
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 143 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 83860, 11257, 16888, 368, 341, 262, 1077, 5206, 9530, 284, 28416, 486, 1499, 5898, 445, 24, 220, 17, 220, 21, 220, 18, 220, 16, 797, 262, 2060, 10714, 10297, 33425, 4529, 16888, 1507, 220, 24, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_bytes_in_vbuf() { use impls::ROIobuf; let bs = [ ROIobuf::from_str("1234"), ROIobuf::from_str("5678"), ROIobuf::from_str("9"), ]; assert_eq!(bytes_in_vbuf(&bs), 9); assert_eq!(bytes_in_vbuf(&bs[1..]), 5); assert_eq!(bytes_in_vbuf(&bs[2..]), 1); }
rust_cleaned_test_functions.jsonl/5460
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 152 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 12524, 1243, 2273, 5909, 368, 341, 220, 990, 11605, 82, 486, 71270, 18464, 401, 220, 1077, 17065, 284, 2278, 262, 50652, 18464, 486, 1499, 2895, 445, 16, 17, 18, 19, 4461, 262, 50652, 18464, 486...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_is_corner_fast12_12_contiguous_lighter_pixels() { let image = gray_image!( 00, 00, 10, 10, 10, 00, 00; 00, 10, 00, 00, 00, 10, 00; 10, 00, 00, 00, 00, 00, 00; 10, 00, 00, 00, 00, 00, 00; 10, 00, 00, 00, 00, 00, 00; 00, 10, 00, 00, 00, 00, 00; 00, 00, 10, 10, 10, 00, 00); assert_eq!(is_corner_fast12(&image, 8, 3, 3), true); }
rust_cleaned_test_functions.jsonl/114613
{ "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, 6892, 66884, 35743, 16, 17, 62, 16, 17, 10260, 27029, 28663, 261, 49745, 368, 341, 286, 1077, 2168, 284, 17545, 4954, 33673, 310, 220, 15, 15, 11, 220, 15, 15, 11, 220, 16, 15, 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_router_response_to_router_solicitation_from_unspecified_source() { /// Get a Router Solicitation ICMPv6 packet buffer. fn rs_msg(src_ip: Ipv6Addr, dst_ip: Ipv6Addr) -> Buf<Vec<u8>> { Buf::new(Vec::new(), ..) .encapsulate(IcmpPacketBuilder::<Ipv6, &[u8], _>::new( src_ip, dst_ip, IcmpUnusedCode, RouterSolicitation::default(), )) .serialize_vec_outer() .unwrap() .into_inner() } let mut ndp_configs = NdpConfigurations::default(); let mut ndp_rc_configs = NdpRouterConfigurations::default(); ndp_rc_configs.set_should_send_advertisements(true); ndp_rc_configs.set_router_advertisements_interval(200..=300); ndp_configs.set_router_configurations(ndp_rc_configs.clone()); ndp_configs.set_dup_addr_detect_transmits(None); ndp_configs.set_max_router_solicitations(None); let dummy_config = Ipv6::DUMMY_CONFIG; let mut state_builder = StackStateBuilder::default(); state_builder.ipv6_builder().forward(true); state_builder.device_builder().set_default_ndp_configs(ndp_configs.clone()); let mut ctx = DummyEventDispatcherBuilder::default() .build_with(state_builder, DummyEventDispatcher::default()); let device = ctx.state_mut().add_ethernet_device(TEST_LOCAL_MAC, Ipv6::MINIMUM_LINK_MTU.into()); crate::device::initialize_device(&mut ctx, device); // Assign an address to the device (should be assigned immediately since add_ip_addr_subnet( &mut ctx, device, AddrSubnet::new(dummy_config.local_ip.get(), 128).unwrap(), ) .unwrap(); // Make device a router so it will start sending router advertisements crate::device::set_routing_enabled::<_, Ipv6>(&mut ctx, device, true); // Should not have sent anything yet. assert_eq!(ctx.dispatcher().frames_sent().len(), 0); let now = ctx.now(); // First `MAX_INITIAL_RTR_ADVERTISEMENTS` will have an interval of assert_eq!( ctx.dispatcher() .timer_events() .filter(|x| (*x.0 == now.checked_add(MAX_INITIAL_RTR_ADVERT_INTERVAL).unwrap()) && (*x.1 == NdpTimerId::new_router_advertisement_transmit(device.id().into()) .into())) .count(), 1 ); // Receiving a Router Solicitation when the next scheduled Router // Advertisement transmission is too far away will update the Router // Advertisement timer to be at max `MAX_RA_DELAY_TIME`. let src_ip = Ipv6Addr::default(); let mut rs_buf = rs_msg(src_ip, dummy_config.local_ip.get()); let rs = rs_buf .parse_with::<_, Icmpv6Packet<_>>(IcmpParseArgs::new(src_ip, dummy_config.local_ip)) .unwrap(); ctx.receive_ndp_packet( device, src_ip.try_into().unwrap(), dummy_config.local_ip, rs.unwrap_ndp(), ); assert_eq!( ctx.dispatcher() .timer_events() .filter(|x| (*x.0 <= now.checked_add(MAX_RA_DELAY_TIME).unwrap()) && (*x.1 == NdpTimerId::new_router_advertisement_transmit(device.id().into()) .into())) .count(), 1 ); // Send the Router Advertisement. assert_eq!(ctx.dispatcher().frames_sent().len(), 0); assert_eq!( trigger_next_timer(&mut ctx).unwrap(), NdpTimerId::new_router_advertisement_transmit(device.id().into()).into() ); assert_eq!(ctx.dispatcher().frames_sent().len(), 1); validate_simple_ra(&ctx.dispatcher().frames_sent()[0].1, 1800); // Receiving a router solicitation close to the next scheduled router // advertisement transmission should not reschedule the router // advertisement. let now = ctx.now(); // First `MAX_INITIAL_RTR_ADVERTISEMENTS` will have an interval of assert_eq!( ctx.dispatcher() .timer_events() .filter(|x| (*x.0 == now.checked_add(MAX_INITIAL_RTR_ADVERT_INTERVAL).unwrap()) && (*x.1 == NdpTimerId::new_router_advertisement_transmit(device.id().into()) .into())) .count(), 1 ); // Skip time to right before the next Router Advertisement transmission. run_for(&mut ctx, MAX_INITIAL_RTR_ADVERT_INTERVAL - MIN_RA_DELAY_TIME); let now = ctx.now(); assert_eq!( ctx.dispatcher() .timer_events() .filter(|x| (x.0.duration_since(now) == MIN_RA_DELAY_TIME) && (*x.1 == NdpTimerId::new_router_advertisement_transmit(device.id().into()) .into())) .count(), 1 ); // Receiving a Router Solicitation. let mut rs_buf = rs_msg(src_ip, dummy_config.local_ip.get()); let rs = rs_buf .parse_with::<_, Icmpv6Packet<_>>(IcmpParseArgs::new(src_ip, dummy_config.local_ip)) .unwrap(); ctx.receive_ndp_packet( device, src_ip.try_into().unwrap(), dummy_config.local_ip, rs.unwrap_ndp(), ); // Timer should not have been updated. assert_eq!( ctx.dispatcher() .timer_events() .filter(|x| (x.0.duration_since(now) == MIN_RA_DELAY_TIME) && (*x.1 == NdpTimerId::new_router_advertisement_transmit(device.id().into()) .into())) .count(), 1 ); // Send the Router Advertisement. assert_eq!(ctx.dispatcher().frames_sent().len(), 1); assert_eq!( trigger_next_timer(&mut ctx).unwrap(), NdpTimerId::new_router_advertisement_transmit(device.id().into()).into() ); assert_eq!(ctx.dispatcher().frames_sent().len(), 2); validate_simple_ra(&ctx.dispatcher().frames_sent()[1].1, 1800); // Receiving a router solicitation within `MIN_DELAY_BETWEEN_RAS` of // sending a Router Advertisement to the all-nodes multicast address // will update the transmission time of the next Router Advertisement // message to be at max `MIN_DELAY_BETWEEN_RAS` + `MAX_RA_DELAY_TIME` // from the time the last Router Advertisement was sent. // Time the last router advertisement was sent. let last_instant = ctx.now(); run_for(&mut ctx, MIN_DELAY_BETWEEN_RAS - Duration::from_secs(1)); assert_eq!( ctx.dispatcher() .timer_events() .filter(|x| (*x.0 == last_instant.checked_add(MAX_INITIAL_RTR_ADVERT_INTERVAL).unwrap()) && (*x.1 == NdpTimerId::new_router_advertisement_transmit(device.id().into()) .into())) .count(), 1 ); // Receiving a Router Solicitation. let mut rs_buf = rs_msg(src_ip, dummy_config.local_ip.get()); let rs = rs_buf .parse_with::<_, Icmpv6Packet<_>>(IcmpParseArgs::new(src_ip, dummy_config.local_ip)) .unwrap(); ctx.receive_ndp_packet( device, src_ip.try_into().unwrap(), dummy_config.local_ip, rs.unwrap_ndp(), ); // Timer should be updated to be at max `MIN_DELAY_BETWEEN_RAS` + // `MAX_RA_DELAY_TIME` from the time the last Router Advertisement was // sent. assert_eq!( ctx.dispatcher() .timer_events() .filter(|x| (x.0.duration_since(last_instant) <= (MIN_DELAY_BETWEEN_RAS + MAX_RA_DELAY_TIME)) && (*x.1 == NdpTimerId::new_router_advertisement_transmit(device.id().into()) .into())) .count(), 1 ); // Send the Router Advertisement. assert_eq!(ctx.dispatcher().frames_sent().len(), 2); assert_eq!( trigger_next_timer(&mut ctx).unwrap(), NdpTimerId::new_router_advertisement_transmit(device.id().into()).into() ); assert_eq!(ctx.dispatcher().frames_sent().len(), 3); validate_simple_ra(&ctx.dispatcher().frames_sent()[2].1, 1800); }
rust_cleaned_test_functions.jsonl/82820
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 4670 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 55587, 9655, 2346, 55587, 643, 7762, 7556, 5673, 4907, 53434, 10347, 368, 341, 286, 1048, 2126, 264, 10554, 76194, 7556, 83988, 85, 21, 10151, 4147, 624, 286, 5168, 10036, 6483, 14705, 10385, 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_include_bytes_expand() { check_expansion( r#" #[rustc_builtin_macro] macro_rules! include_bytes { ($file:expr) => {{ /* compiler built-in */ }}; ($file:expr,) => {{ /* compiler built-in */ }}; } include_bytes("foo"); "#, expect![[r#"b"""#]], ); }
rust_cleaned_test_functions.jsonl/112678
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 237 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 37878, 12524, 67875, 368, 341, 286, 1779, 14214, 10501, 1006, 310, 435, 2, 698, 310, 11506, 35788, 66, 73829, 58810, 921, 310, 18072, 21407, 0, 2924, 12524, 341, 394, 1711, 1192, 96011, 8, 589, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_read_batch_values_rep_levels() { test_read_batch_int32(16, &mut vec![0; 10], None, Some(&mut vec![0; 10])); test_read_batch_int32(16, &mut vec![0; 16], None, Some(&mut vec![0; 16])); test_read_batch_int32(16, &mut vec![0; 51], None, Some(&mut vec![0; 51])); }
rust_cleaned_test_functions.jsonl/64662
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 153 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6443, 14534, 9146, 25533, 37819, 368, 341, 286, 1273, 6443, 14534, 4042, 18, 17, 7, 16, 21, 11, 609, 6984, 7486, 20703, 15, 26, 220, 16, 15, 1125, 2240, 11, 4329, 2099, 6984, 7486, 20703, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_from_arg_matches_fancy() { let argv = vec!["lsd", "--icon-theme", "fancy"]; let matches = app::build().get_matches_from_safe(argv).unwrap(); assert_eq!( Some(IconTheme::Fancy), IconTheme::from_arg_matches(&matches) ); }
rust_cleaned_test_functions.jsonl/17364
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 156 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5673, 6057, 38344, 761, 6572, 368, 341, 286, 1077, 10213, 284, 7486, 0, 1183, 4730, 67, 497, 14482, 1924, 33185, 497, 330, 69, 6572, 6332, 286, 1077, 9071, 284, 906, 486, 5834, 1005, 455, 38344,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_github_12546() -> Result<(), Box<dyn Error>> { mz_ore::test::init_logging(); let config = util::Config::default(); let server = util::start_server(config)?; server.runtime.block_on(async { let (client, conn_task) = server.connect_async(tokio_postgres::NoTls).await?; client.batch_execute("CREATE TABLE test(a text);").await?; client .batch_execute("INSERT INTO test VALUES ('a');") .await?; let query = client.query("SELECT mz_internal.mz_panic(a) FROM test", &[]); let timeout = tokio::time::timeout(Duration::from_secs(2), query); // We expect the timeout to trigger because the query should be crashing the // compute instance. assert_eq!( timeout.await.unwrap_err().to_string(), "deadline has elapsed" ); // allowing the compute instances to stop crashing while trying to execute // them. conn_task.abort(); // Need to await `conn_task` to actually deliver the `abort`. let _ = conn_task.await; // Make a new connection to verify the compute instance can now start. let (client, _conn_task) = server.connect_async(tokio_postgres::NoTls).await?; assert_eq!( client .query_one("SELECT count(*) FROM test", &[]) .await? .get::<_, i64>(0), 1, ); Ok::<_, Box<dyn Error>>(()) })?; Ok(()) }
rust_cleaned_test_functions.jsonl/8400
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 697 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1889, 3827, 62, 16, 17, 20, 19, 21, 368, 1464, 5714, 68843, 8261, 92846, 4600, 2452, 341, 262, 95392, 62, 460, 486, 1944, 486, 2327, 59982, 543, 262, 1077, 2193, 284, 4094, 486, 2648, 486, 225...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
#[test] fn test_default_resource() { let mut app = App::new() .resource("/test", |r| r.f(|_| HttpResponse::Ok())) .finish(); let req = TestRequest::with_uri("/test").finish(); let resp = app.run(req); assert_eq!(resp.as_msg().status(), StatusCode::OK); let req = TestRequest::with_uri("/blah").finish(); let resp = app.run(req); assert_eq!(resp.as_msg().status(), StatusCode::NOT_FOUND); let mut app = App::new() .default_resource(|r| r.f(|_| HttpResponse::MethodNotAllowed())) .finish(); let req = TestRequest::with_uri("/blah").finish(); let resp = app.run(req); assert_eq!(resp.as_msg().status(), StatusCode::METHOD_NOT_ALLOWED); }
rust_cleaned_test_functions.jsonl/24266
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 372 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9993, 17962, 368, 341, 286, 1077, 5206, 906, 284, 1845, 486, 931, 741, 310, 659, 9233, 4283, 1944, 497, 760, 81, 91, 435, 833, 22428, 35395, 17580, 486, 11578, 12145, 310, 659, 30150, 1428, 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_read_char_no_case() { let mut reader = ParserInput::new("This is a test"); let result = read_char_no_case('t')(&mut reader); assert_eq!(result, Ok('T')); let result = read_char_no_case('H')(&mut reader); assert_eq!(result, Ok('h')); let result = read_char_no_case('T')(&mut reader); assert_eq!(result, Err(ParserResultError::NotFound)); }
rust_cleaned_test_functions.jsonl/10083
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 193 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6443, 9232, 6536, 19096, 368, 341, 286, 1077, 5206, 6604, 284, 21102, 2505, 486, 931, 445, 1986, 374, 264, 1273, 3071, 286, 1077, 1102, 284, 1349, 9232, 6536, 19096, 492, 83, 863, 2099, 6984, 66...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_and_format_number() { assert_eq!( "%05d" .parse::<CFormatSpec>() .unwrap() .format_number(&BigInt::from(27)), "00027".to_string() ); assert_eq!( "%+05d" .parse::<CFormatSpec>() .unwrap() .format_number(&BigInt::from(27)), "+0027".to_string() ); assert_eq!( "%-d" .parse::<CFormatSpec>() .unwrap() .format_number(&BigInt::from(-27)), "-27".to_string() ); assert_eq!( "% d" .parse::<CFormatSpec>() .unwrap() .format_number(&BigInt::from(27)), " 27".to_string() ); assert_eq!( "% d" .parse::<CFormatSpec>() .unwrap() .format_number(&BigInt::from(-27)), "-27".to_string() ); assert_eq!( "%08x" .parse::<CFormatSpec>() .unwrap() .format_number(&BigInt::from(0x1337)), "00001337".to_string() ); assert_eq!( "%#010x" .parse::<CFormatSpec>() .unwrap() .format_number(&BigInt::from(0x1337)), "0x00001337".to_string() ); assert_eq!( "%-#010x" .parse::<CFormatSpec>() .unwrap() .format_number(&BigInt::from(0x1337)), "0x1337 ".to_string() ); }
rust_cleaned_test_functions.jsonl/37688
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1093 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 8378, 8955, 5500, 368, 341, 286, 2060, 10714, 33673, 310, 5962, 15, 20, 67, 698, 394, 659, 6400, 27638, 34, 4061, 8327, 18949, 394, 659, 15454, 741, 394, 659, 2243, 5500, 2099, 87474, 486...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_cast_i32_to_f64() { let a = Int32Array::from(vec![5, 6, 7, 8, 9]); let array = Arc::new(a) as ArrayRef; let b = cast(&array, &DataType::Float64).unwrap(); let c = b.as_any().downcast_ref::<Float64Array>().unwrap(); assert!(5.0 - c.value(0) < f64::EPSILON); assert!(6.0 - c.value(1) < f64::EPSILON); assert!(7.0 - c.value(2) < f64::EPSILON); assert!(8.0 - c.value(3) < f64::EPSILON); assert!(9.0 - c.value(4) < f64::EPSILON); }
rust_cleaned_test_functions.jsonl/29599
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 287 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5303, 5318, 18, 17, 2346, 761, 21, 19, 368, 341, 286, 1077, 264, 284, 1333, 18, 17, 1857, 486, 1499, 25592, 20703, 20, 11, 220, 21, 11, 220, 22, 11, 220, 23, 11, 220, 24, 2558, 286, 1077, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_chi_squared_one() { let mut chi = ChiSquared::new(1.0); let mut rng = task_rng(); for _ in range(0, 1000) { chi.sample(&mut rng); chi.ind_sample(&mut rng); } }
rust_cleaned_test_functions.jsonl/89948
{ "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, 98826, 54641, 11667, 368, 341, 286, 1077, 5206, 25798, 284, 33282, 88294, 486, 931, 7, 16, 13, 15, 317, 286, 1077, 5206, 28422, 284, 3383, 66849, 543, 286, 369, 716, 304, 2088, 7, 15, 11, 220,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_match_group_in_group() { let rules = create_rules( r#" macro_rules! foo { { $( ( $($i:ident)* ) )* } => ( $( ( $($i)* ) )* ); }"#, ); assert_expansion(MacroKind::Items, &rules, "foo! ( (a b) );", "(a b)"); }
rust_cleaned_test_functions.jsonl/14702
{ "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, 10708, 6288, 1243, 6288, 368, 341, 262, 1077, 5601, 284, 1855, 21407, 1006, 286, 435, 2, 698, 286, 18072, 21407, 0, 15229, 341, 310, 314, 4930, 320, 93977, 72, 25, 1713, 4806, 873, 89401, 335, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_read_after_cleanup_range_for_snap() { let mut cluster = new_server_cluster(1, 3); configure_for_snapshot(&mut cluster); configure_for_lease_read(&mut cluster, Some(100), Some(10)); let pd_client = Arc::clone(&cluster.pd_client); pd_client.disable_default_operator(); // Set region and peers let r1 = cluster.run_conf_change(); let p1 = new_peer(1, 1); let p2 = new_peer(2, 2); cluster.pd_client.must_add_peer(r1, p2.clone()); let p3 = new_peer(3, 3); cluster.pd_client.must_add_peer(r1, p3.clone()); cluster.must_put(b"k0", b"v0"); cluster.pd_client.must_none_pending_peer(p2); cluster.pd_client.must_none_pending_peer(p3.clone()); let region = cluster.get_region(b"k0"); assert_eq!(cluster.leader_of_region(region.get_id()).unwrap(), p1); must_get_equal(&cluster.get_engine(3), b"k0", b"v0"); cluster.stop_node(3); let last_index = cluster.raft_local_state(r1, 1).last_index; (0..10).for_each(|_| cluster.must_put(b"k1", b"v1")); must_truncated_to(cluster.get_engine(1), r1, last_index + 1); fail::cfg("send_snapshot", "pause").unwrap(); cluster.run_node(3).unwrap(); // Sleep for a while to ensure peer 3 receives a HeartBeat thread::sleep(Duration::from_millis(500)); // Add filter for delaying ReadIndexResp and MsgSnapshot let (read_index_sx, read_index_rx) = channel::unbounded::<RaftMessage>(); let (snap_sx, snap_rx) = channel::unbounded::<RaftMessage>(); let recv_filter = Box::new( RegionPacketFilter::new(region.get_id(), 3) .direction(Direction::Recv) .msg_type(MessageType::MsgSnapshot) .set_msg_callback(Arc::new(move |msg: &RaftMessage| { snap_sx.send(msg.clone()).unwrap(); })), ); let send_read_index_filter = RegionPacketFilter::new(region.get_id(), 3) .direction(Direction::Recv) .msg_type(MessageType::MsgReadIndexResp) .set_msg_callback(Arc::new(move |msg: &RaftMessage| { read_index_sx.send(msg.clone()).unwrap(); })); cluster.sim.wl().add_recv_filter(3, recv_filter); cluster.add_send_filter(CloneFilterFactory(send_read_index_filter)); fail::remove("send_snapshot"); let mut request = new_request( region.get_id(), region.get_region_epoch().clone(), vec![new_get_cf_cmd("default", b"k0")], false, ); request.mut_header().set_peer(p3); request.mut_header().set_replica_read(true); // Send follower read request to peer 3 let (cb1, rx1) = make_cb(&request); cluster .sim .rl() .async_command_on_node(3, request, cb1) .unwrap(); let read_index_msg = read_index_rx.recv_timeout(Duration::from_secs(5)).unwrap(); let snap_msg = snap_rx.recv_timeout(Duration::from_secs(5)).unwrap(); fail::cfg("apply_snap_cleanup_range", "pause").unwrap(); let router = cluster.sim.wl().get_router(3).unwrap(); fail::cfg("pause_on_peer_collect_message", "pause").unwrap(); cluster.sim.wl().clear_recv_filters(3); cluster.clear_send_filters(); router.send_raft_message(snap_msg).unwrap(); router.send_raft_message(read_index_msg).unwrap(); cluster.add_send_filter(IsolationFilterFactory::new(3)); fail::remove("pause_on_peer_collect_message"); must_get_none(&cluster.get_engine(3), b"k0"); // Should not receive resp rx1.recv_timeout(Duration::from_millis(500)).unwrap_err(); fail::remove("apply_snap_cleanup_range"); rx1.recv_timeout(Duration::from_secs(5)).unwrap(); }
rust_cleaned_test_functions.jsonl/47454
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1566 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6443, 19844, 42444, 9698, 5478, 74175, 368, 341, 262, 1077, 5206, 10652, 284, 501, 12015, 28441, 7, 16, 11, 220, 18, 317, 262, 14411, 5478, 53265, 2099, 6984, 10652, 317, 262, 14411, 5478, 62, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_parse_too_many_fields() { let expression = "1 2 3 4 5 6 7 8 9 2019"; assert!(Schedule::from_str(expression).is_err()); }
rust_cleaned_test_functions.jsonl/50809
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 75 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 2346, 78, 22101, 12132, 368, 341, 286, 1077, 7493, 284, 330, 16, 220, 17, 220, 18, 220, 19, 220, 20, 220, 21, 220, 22, 220, 23, 220, 24, 220, 17, 15, 16, 24, 876, 286, 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
#[test] fn test_empty_flag_treated_as_false_json_de() { // verify a true-by-default flag was parsed as false if "" let hhvm: Hhvm = serde_json::from_str( r#"{ "hhvm.emit_meth_caller_func_pointers": { "global_value": "" } }"#, ) .unwrap(); assert!( !hhvm .flags .contains(HhvmFlags::EMIT_METH_CALLER_FUNC_POINTERS) ); }
rust_cleaned_test_functions.jsonl/18278
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 244 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15124, 10933, 528, 2850, 11898, 36015, 9455, 2259, 368, 341, 286, 442, 10146, 264, 830, 14319, 13672, 5181, 572, 15676, 438, 895, 421, 8389, 286, 1077, 37914, 7338, 25, 472, 71, 7338, 284, 61570, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_invalid() { let item = b'\x1B'; let mut iter = "[x".bytes().map(|x| Ok(x)); assert_eq!( parse_event(item, &mut iter).unwrap(), Event::Unsupported(vec![b'\x1B', b'[', b'x']), ) }
rust_cleaned_test_functions.jsonl/122260
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 152 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 31433, 368, 341, 286, 1077, 1509, 284, 293, 15777, 87, 16, 33, 1010, 286, 1077, 5206, 5367, 284, 10545, 87, 3263, 9651, 1005, 2186, 22428, 87, 91, 7622, 2075, 1106, 286, 2060, 10714, 3367...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_abstract_classes_not_supported() { let ir = ir_from_cc("struct MyStruct { virtual void run() = 0; };").unwrap(); assert_ir_matches!(ir, quote! { UnsupportedItem { name: "MyStruct" ... } }); }
rust_cleaned_test_functions.jsonl/37243
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 85 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 85939, 16833, 7913, 57885, 368, 341, 262, 1077, 6216, 284, 6216, 5673, 28955, 445, 1235, 3017, 9422, 314, 4108, 737, 1598, 368, 284, 220, 15, 26, 20066, 1827, 15454, 543, 262, 2060, 51433, 38344, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_pubsub_unsubscribe() { let ctx = TestContext::new(); let mut con = ctx.connection(); { let mut pubsub = con.as_pubsub(); pubsub.subscribe("foo").unwrap(); pubsub.subscribe("bar").unwrap(); pubsub.subscribe("baz").unwrap(); pubsub.psubscribe("foo*").unwrap(); pubsub.psubscribe("bar*").unwrap(); pubsub.psubscribe("baz*").unwrap(); } // Connection should be usable again for non-pubsub commands let _: redis::Value = con.set("foo", "bar").unwrap(); let value: String = con.get("foo").unwrap(); assert_eq!(&value[..], "bar"); }
rust_cleaned_test_functions.jsonl/108959
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 276 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 34014, 1966, 4907, 9384, 368, 341, 262, 1077, 5635, 284, 3393, 1972, 486, 931, 543, 262, 1077, 5206, 390, 284, 5635, 20310, 1428, 262, 341, 286, 1077, 5206, 6675, 1966, 284, 390, 5357, 34014, 19...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_parse_bpf_upgradeable_loader_accounts() { let bpf_loader_state = UpgradeableLoaderState::Uninitialized; let account_data = serialize(&bpf_loader_state).unwrap(); assert_eq!( parse_bpf_upgradeable_loader(&account_data).unwrap(), BpfUpgradeableLoaderAccountType::Uninitialized ); let program = vec![7u8; 64]; // Arbitrary program data let authority = Pubkey::new_unique(); let bpf_loader_state = UpgradeableLoaderState::Buffer { authority_address: Some(authority), }; let mut account_data = serialize(&bpf_loader_state).unwrap(); account_data.extend_from_slice(&program); assert_eq!( parse_bpf_upgradeable_loader(&account_data).unwrap(), BpfUpgradeableLoaderAccountType::Buffer(UiBuffer { authority: Some(authority.to_string()), data: UiAccountData::Binary(base64::encode(&program), UiAccountEncoding::Base64), }) ); let bpf_loader_state = UpgradeableLoaderState::Buffer { authority_address: None, }; let mut account_data = serialize(&bpf_loader_state).unwrap(); account_data.extend_from_slice(&program); assert_eq!( parse_bpf_upgradeable_loader(&account_data).unwrap(), BpfUpgradeableLoaderAccountType::Buffer(UiBuffer { authority: None, data: UiAccountData::Binary(base64::encode(&program), UiAccountEncoding::Base64), }) ); let programdata_address = Pubkey::new_unique(); let bpf_loader_state = UpgradeableLoaderState::Program { programdata_address, }; let account_data = serialize(&bpf_loader_state).unwrap(); assert_eq!( parse_bpf_upgradeable_loader(&account_data).unwrap(), BpfUpgradeableLoaderAccountType::Program(UiProgram { program_data: programdata_address.to_string(), }) ); let authority = Pubkey::new_unique(); let slot = 42; let bpf_loader_state = UpgradeableLoaderState::ProgramData { slot, upgrade_authority_address: Some(authority), }; let mut account_data = serialize(&bpf_loader_state).unwrap(); account_data.extend_from_slice(&program); assert_eq!( parse_bpf_upgradeable_loader(&account_data).unwrap(), BpfUpgradeableLoaderAccountType::ProgramData(UiProgramData { slot, authority: Some(authority.to_string()), data: UiAccountData::Binary(base64::encode(&program), UiAccountEncoding::Base64), }) ); let bpf_loader_state = UpgradeableLoaderState::ProgramData { slot, upgrade_authority_address: None, }; let mut account_data = serialize(&bpf_loader_state).unwrap(); account_data.extend_from_slice(&program); assert_eq!( parse_bpf_upgradeable_loader(&account_data).unwrap(), BpfUpgradeableLoaderAccountType::ProgramData(UiProgramData { slot, authority: None, data: UiAccountData::Binary(base64::encode(&program), UiAccountEncoding::Base64), }) ); }
rust_cleaned_test_functions.jsonl/80399
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1584 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 880, 15897, 67794, 480, 22139, 55665, 368, 341, 286, 1077, 293, 15897, 22139, 4387, 284, 40713, 480, 9181, 1397, 486, 1806, 36161, 280, 286, 1077, 2692, 1769, 284, 24235, 2099, 65, 15897, 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_decode_cmp_imm_w() { assert_eq!( decode_32(0xf1ba0f00), Instruction::CMP_imm { params: RegImmParams { r: Reg::R10, imm32: 0, }, thumb32: true, } ); }
rust_cleaned_test_functions.jsonl/64810
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 182 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15227, 35193, 71370, 1670, 368, 341, 1066, 262, 2060, 10714, 33673, 286, 16895, 62, 18, 17, 7, 15, 5848, 16, 4645, 15, 69, 15, 15, 1326, 286, 29051, 486, 93158, 71370, 341, 310, 3628, 25, 3184...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_input() { let input = vec![ "p=<-35,0,0>, v=<2,0,0>, a=<-1,0,0>", "p=<4,0,0>, v=<0,0,0>, a=<-2,0,0>", ]; let expected = vec![ Particle { id: 0, position: (-35, 0, 0), velocity: (2, 0, 0), acceleration: (-1, 0, 0), }, Particle { id: 1, position: (4, 0, 0), velocity: (0, 0, 0), acceleration: (-2, 0, 0), }, ]; assert_eq!(parse_input(input), expected); }
rust_cleaned_test_functions.jsonl/85377
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 247 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 5898, 368, 341, 10217, 1946, 284, 7486, 90515, 197, 197, 1, 79, 38698, 12, 18, 20, 11, 15, 11, 15, 8066, 348, 38698, 17, 11, 15, 11, 15, 8066, 264, 38698, 12, 16, 11, 15, 11, 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_set_psk() { let params: NoiseParams = "Noise_XXpsk3_25519_AESGCM_SHA256".parse().unwrap(); let mut h_i = Builder::new(params.clone()) .local_private_key(&get_inc_key(0)) .build_initiator().unwrap(); let mut h_r = Builder::new(params) .local_private_key(&get_inc_key(1)) .build_responder().unwrap(); let mut buf = [0u8; 1024]; let mut buf2 = [0u8; 1024]; let psk = get_inc_key(3); // -> e let len = h_i.write_message(&[], &mut buf).unwrap(); let _ = h_r.read_message(&buf[..len], &mut buf2).unwrap(); let len = h_r.write_message(&[], &mut buf).unwrap(); let _ = h_i.read_message(&buf[..len], &mut buf2).unwrap(); h_i.set_psk(3, &psk).unwrap(); h_r.set_psk(3, &psk).unwrap(); let len = h_i.write_message(&[], &mut buf).unwrap(); let _ = h_r.read_message(&buf[..len], &mut buf2).unwrap(); }
rust_cleaned_test_functions.jsonl/27119
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 449 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2602, 620, 4886, 368, 341, 262, 1077, 3628, 25, 50523, 4870, 284, 330, 61819, 62, 6148, 1690, 74, 18, 62, 17, 20, 20, 16, 24, 69381, 38, 9985, 38096, 17, 20, 21, 3263, 6400, 1005, 15454, 543...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_echo_construct() { let mut bytes = vec![0xa5; 12]; let mut packet = Packet::new_unchecked(&mut bytes); packet.set_msg_type(Message::EchoRequest); packet.set_msg_code(0); packet.set_echo_ident(0x1234); packet.set_echo_seq_no(0xabcd); packet .payload_mut() .copy_from_slice(&ECHO_PACKET_PAYLOAD[..]); packet.fill_checksum(&MOCK_IP_ADDR_1, &MOCK_IP_ADDR_2); assert_eq!(&packet.into_inner()[..], &ECHO_PACKET_BYTES[..]); }
rust_cleaned_test_functions.jsonl/44724
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 284 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 68628, 64803, 368, 341, 286, 1077, 5206, 5820, 284, 7486, 20703, 15, 9591, 20, 26, 220, 16, 17, 935, 286, 1077, 5206, 10151, 284, 28889, 486, 931, 4907, 7549, 2099, 6984, 5820, 317, 286, 10151, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_can_write_and_read() { let mut be = Miniz::new(InMemory::new(), 9); be.write("x".into(), b"hello world").unwrap(); let result = be.read_vec("x".into()).unwrap(); assert_eq!(b"hello world", &result[..]); }
rust_cleaned_test_functions.jsonl/10290
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 124 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 27421, 9165, 8378, 6443, 368, 341, 286, 1077, 5206, 387, 284, 3386, 449, 486, 931, 47614, 10642, 486, 931, 1507, 220, 24, 626, 286, 387, 3836, 445, 87, 3263, 18122, 1507, 293, 1, 14990, 1879, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_args_with_errors_shared_connection() { let ctx = TestContext::new(); block_on_all(future::lazy(|| { ctx.shared_async_connection() .and_then(|con| { let cmds = (0..100).map(move |i| { if i % 2 == 0 { test_cmd(&con, i) } else { test_error(&con) } }); future::join_all(cmds).map(|results| { assert_eq!(results.len(), 100); }) }) .map_err(|err| panic!("{}", err)) })) .unwrap(); }
rust_cleaned_test_functions.jsonl/10905
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 412 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8384, 6615, 20196, 20405, 15866, 368, 341, 262, 1077, 5635, 284, 3393, 1972, 486, 931, 543, 262, 2504, 4470, 5705, 955, 2976, 486, 49013, 79453, 341, 286, 5635, 18062, 28346, 15866, 741, 310, 659,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_windows_7_or_server_2008() { let mut os = OsContext { raw_description: "Microsoft Windows NT 6.1.7601 Service Pack 1" .to_string() .into(), ..OsContext::default() }; normalize_os_context(&mut os); assert_eq_dbg!(Some("Windows"), os.name.as_str()); assert_eq_dbg!(Some("6.1.7601"), os.version.as_str()); }
rust_cleaned_test_functions.jsonl/68952
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 185 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 58220, 62, 22, 8734, 12015, 62, 17, 15, 15, 23, 368, 341, 1066, 262, 1077, 5206, 2643, 284, 15433, 1972, 341, 286, 7112, 11448, 25, 330, 12778, 5515, 17658, 220, 21, 13, 16, 13, 22, 21, 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_dispatcher_worker_stop() { let (stop_tx, stop_rx) = mpsc::channel(); let (_, worker_rx) = mpsc::channel(); let (worker_tx, _) = mpsc::channel(); let worker = DispatcherWorker { dispatch_byte: 1, stop: stop_rx, timeout: Duration::from_micros(0), rx: worker_rx, tx: worker_tx, }; stop_tx.send(()).unwrap(); assert_eq!(worker.can_continue(), false); }
rust_cleaned_test_functions.jsonl/126113
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 257 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 92189, 40385, 19039, 368, 341, 286, 1077, 320, 9495, 17805, 11, 2936, 24330, 8, 284, 296, 81984, 486, 10119, 543, 286, 1077, 39464, 11864, 24330, 8, 284, 296, 81984, 486, 10119, 543, 286, 1077, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_install_when_setting_memory_allocation_to_zero() { with_setup(|canister_manager, mut state, subnet_id| { let wasm = ic_test_utilities::universal_canister::UNIVERSAL_CANISTER_WASM.to_vec(); let sender = canister_test_id(100).get(); let settings = CanisterSettings::new(None, None, None, None, None); let canister_id = canister_manager .create_canister(sender, subnet_id, *INITIAL_CYCLES, settings, &mut state) .0 .unwrap(); // Set memory allocation to 0. let settings = CanisterSettings::new( None, None, None, Some(MemoryAllocation::try_from(NumBytes::from(0)).unwrap()), None, ); let compute_allocation_used = state.total_compute_allocation(); let memory_allocation_used = state.total_memory_taken(); let mut canister = state.canister_state_mut(&canister_id).unwrap(); canister_manager .update_settings( sender, settings, &mut canister, compute_allocation_used, memory_allocation_used, ) .unwrap(); canister_manager .install_code( InstallCodeContext { sender, canister_id, wasm_module: wasm, arg: vec![], compute_allocation: None, memory_allocation: None, mode: CanisterInstallMode::Install, query_allocation: QueryAllocation::default(), }, &mut state, EXECUTION_PARAMETERS.clone(), ) .1 .unwrap(); }) }
rust_cleaned_test_functions.jsonl/69189
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 981 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 34245, 47636, 20313, 19195, 81267, 2346, 19359, 368, 341, 262, 448, 21363, 22428, 4814, 1571, 12144, 11, 5206, 1584, 11, 51457, 842, 91, 341, 286, 1077, 98263, 284, 17902, 4452, 94044, 486, 95300, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_search_response_ser() { let resp = SearchResponse(vec!["A".to_string(), "B".to_string()]); let actual = serde_json::to_string(&resp).unwrap(); assert_eq!(actual, r#"["A","B"]"#.to_string()); }
rust_cleaned_test_functions.jsonl/95417
{ "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, 10716, 9655, 75861, 368, 341, 286, 1077, 9039, 284, 7542, 2582, 25592, 0, 1183, 32, 3263, 983, 3904, 1507, 330, 33, 3263, 983, 3904, 57887, 286, 1077, 5042, 284, 61570, 9455, 486, 983, 3904, 209...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_file_content_type() { let mut reader = Reader::init("text/html"); assert_eq!( file_content_type(&mut reader).unwrap(), "text/html".to_string() ); assert_eq!(reader.state.cursor, 9); let mut reader = Reader::init("text/plain; charset=us-ascii"); assert_eq!( file_content_type(&mut reader).unwrap(), "text/plain; charset=us-ascii".to_string() ); assert_eq!(reader.state.cursor, 28); let mut reader = Reader::init("text/html # comment"); assert_eq!( file_content_type(&mut reader).unwrap(), "text/html".to_string() ); assert_eq!(reader.state.cursor, 9); }
rust_cleaned_test_functions.jsonl/17071
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 373 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2458, 7495, 1819, 368, 341, 286, 1077, 5206, 6604, 284, 25166, 486, 2327, 445, 1318, 13739, 797, 286, 2060, 10714, 33673, 310, 1034, 7495, 1819, 2099, 6984, 6604, 568, 15454, 3148, 310, 330, 1318,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_rng_64_rand_seeded() { let s = task_rng().gen_vec::<u64>(256); let mut ra: Isaac64Rng = SeedableRng::from_seed(s.as_slice()); let mut rb: Isaac64Rng = SeedableRng::from_seed(s.as_slice()); assert_eq!(ra.gen_ascii_str(100u), rb.gen_ascii_str(100u)); }
rust_cleaned_test_functions.jsonl/85137
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 161 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 66849, 62, 21, 19, 33864, 3453, 29935, 368, 341, 286, 1077, 274, 284, 3383, 66849, 1005, 4370, 13251, 27638, 84, 21, 19, 2235, 17, 20, 21, 317, 286, 1077, 5206, 15122, 25, 41508, 21, 19, 49, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_render_short_html() { with_globals(|| { assert_eq!( word_cfg("unix").render_short_html(), "Unix" ); assert_eq!( name_value_cfg("target_os", "macos").render_short_html(), "macOS" ); assert_eq!( name_value_cfg("target_pointer_width", "16").render_short_html(), "16-bit" ); assert_eq!( name_value_cfg("target_endian", "little").render_short_html(), "Little-endian" ); assert_eq!( (!word_cfg("windows")).render_short_html(), "Non-Windows" ); assert_eq!( (word_cfg("unix") & word_cfg("windows")).render_short_html(), "Unix and Windows" ); assert_eq!( (word_cfg("unix") | word_cfg("windows")).render_short_html(), "Unix or Windows" ); assert_eq!( ( word_cfg("unix") & word_cfg("windows") & word_cfg("debug_assertions") ).render_short_html(), "Unix and Windows and debug-assertions enabled" ); assert_eq!( ( word_cfg("unix") | word_cfg("windows") | word_cfg("debug_assertions") ).render_short_html(), "Unix or Windows or debug-assertions enabled" ); assert_eq!( ( !(word_cfg("unix") | word_cfg("windows") | word_cfg("debug_assertions")) ).render_short_html(), "Neither Unix nor Windows nor debug-assertions enabled" ); assert_eq!( ( (word_cfg("unix") & name_value_cfg("target_arch", "x86_64")) | (word_cfg("windows") & name_value_cfg("target_pointer_width", "64")) ).render_short_html(), "Unix and x86-64, or Windows and 64-bit" ); assert_eq!( (!(word_cfg("unix") & word_cfg("windows"))).render_short_html(), "Not (Unix and Windows)" ); assert_eq!( ( (word_cfg("debug_assertions") | word_cfg("windows")) & word_cfg("unix") ).render_short_html(), "(Debug-assertions enabled or Windows) and Unix" ); assert_eq!( name_value_cfg("target_feature", "sse2").render_short_html(), "<code>sse2</code>" ); assert_eq!( ( name_value_cfg("target_arch", "x86_64") & name_value_cfg("target_feature", "sse2") ).render_short_html(), "x86-64 and <code>sse2</code>" ); }) }
rust_cleaned_test_functions.jsonl/53558
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1766 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 22781, 16673, 9564, 368, 341, 286, 448, 58775, 79453, 341, 310, 2060, 10714, 33673, 394, 3409, 18343, 445, 56646, 1827, 7322, 16673, 9564, 3148, 394, 330, 55832, 698, 310, 1439, 310, 2060, 10714, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_skip_field() { let mut body: &[u8] = b"--boundary\r\nfield1\r\n--boundary\r\nfield2\r\n--boundary--"; let mut reader = BoundaryReader::from_reader(&mut body, "boundary"); assert_eq!(reader.consume_boundary().unwrap(), true); // skip `field1` assert_eq!(reader.consume_boundary().unwrap(), true); let mut buf = String::new(); reader.read_to_string(&mut buf).unwrap(); assert_eq!(buf, "field2"); assert_eq!(reader.consume_boundary().unwrap(), false); }
rust_cleaned_test_functions.jsonl/80596
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 251 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 44830, 5013, 368, 341, 286, 1077, 5206, 2487, 25, 44590, 84, 23, 60, 284, 293, 74757, 65180, 12016, 1699, 2566, 16, 12016, 1699, 313, 65180, 12016, 1699, 2566, 17, 12016, 1699, 313, 65180, 313, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_insert_field_with_wrong_name_index_from_static_table() { let mut buf = vec![]; InsertWithNameRef::new_static(3000, "") .encode(&mut buf) .unwrap(); let mut enc = Cursor::new(&buf); let mut table = build_table_with_size(0); let res = on_encoder_recv(&mut table.inserter(), &mut enc, &mut vec![]); assert_eq!(res, Err(Error::InvalidStaticIndex(3000))); }
rust_cleaned_test_functions.jsonl/37414
{ "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, 17678, 5013, 6615, 75198, 1269, 3560, 5673, 25360, 5237, 368, 341, 286, 1077, 5206, 6607, 284, 7486, 0, 15078, 286, 17101, 54523, 3945, 486, 931, 25360, 7, 18, 15, 15, 15, 11, 14676, 310, 659, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_zero_plus_matrix_equals_matrix() { let zero = Matrix2x2::zero(); let matrix = Matrix2x2::new( 36.84, 427.46, 7.47, 61.89 ); assert_eq!(zero + matrix, matrix); }
rust_cleaned_test_functions.jsonl/128967
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 138 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 19359, 28043, 10193, 61664, 10193, 368, 341, 286, 1077, 7168, 284, 11631, 17, 87, 17, 486, 14154, 543, 286, 1077, 6172, 284, 11631, 17, 87, 17, 486, 931, 1006, 310, 220, 18, 21, 13, 23, 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_init_devices() { let mut vmm = create_vmm_object(InstanceState::Uninitialized); vmm.default_kernel_config(None); assert!(vmm.init_guest_memory().is_ok()); vmm.setup_interrupt_controller() .expect("Failed to setup interrupt controller"); vmm.init_mmio_device_manager(); assert!(vmm.attach_virtio_devices().is_ok()); }
rust_cleaned_test_functions.jsonl/28149
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 180 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6137, 41334, 368, 341, 286, 1077, 5206, 348, 3821, 284, 1855, 2273, 3821, 5314, 7, 8846, 486, 1806, 36161, 317, 286, 348, 3821, 8764, 26876, 5332, 26717, 317, 286, 2060, 10297, 85, 3821, 8271, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_legal_moves_banmen_with_fu_corner_gote() { let answer:Vec<Vec<((u32,u32),(u32,u32,bool),Option<ObtainKind>)>> = vec![ vec![ ], vec![ ((0,1),(0,0,true),None), ], vec![ ((0,2),(0,1,true),None), ((0,2),(0,1,false),None) ], vec![ ], vec![ ((8,1),(8,0,true),None) ], vec![ ((8,2),(8,1,true),None), ((8,2),(8,1,false),None) ] ]; const POSITIONS:[(usize,usize); 6] = [ (0,0),(0,1),(0,2), (8,0),(8,1),(8,2) ]; let answer = answer.into_iter().map(|mvs| { mvs.into_iter().map(|m| { match m { ((sx,sy),(dx,dy,nari),_) => { LegalMove::from(((8 - sx, 8 - sy),(8- dx, 8 - dy, nari),None)) } } }).collect::<Vec<LegalMove>>() }).collect::<Vec<Vec<LegalMove>>>(); let blank_banmen = Banmen([[Blank; 9]; 9]); for (a,p) in answer.iter().zip(&POSITIONS) { let mut banmen = blank_banmen.clone(); banmen.0[8-p.1][8-p.0] = GFu; assert_eq!( a, &Rule::legal_moves_from_banmen(Teban::Gote,&State::new(banmen.clone())).into_iter().map(|m| { LegalMove::from(m) }).collect::<Vec<LegalMove>>() ) } }
rust_cleaned_test_functions.jsonl/81084
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 676 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 82324, 45390, 880, 276, 5676, 6615, 36467, 66884, 1889, 1272, 368, 972, 10217, 4226, 25, 10050, 50439, 27, 1188, 84, 18, 17, 36883, 18, 17, 23547, 84, 18, 17, 36883, 18, 17, 63634, 701, 5341, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_delimiter_mismatch() { assert_code_is_not_ok(r#"(]"#); assert_code_is_not_ok(r#"(}"#); assert_code_is_not_ok(r#"[)"#); assert_code_is_not_ok(r#"[}"#); assert_code_is_not_ok(r#"{)"#); assert_code_is_not_ok(r#"{]"#); }
rust_cleaned_test_functions.jsonl/116466
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 174 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 18029, 17700, 717, 24976, 368, 341, 286, 2060, 4136, 6892, 7913, 19817, 2601, 2, 29209, 19177, 2, 317, 286, 2060, 4136, 6892, 7913, 19817, 2601, 2, 29209, 9863, 2, 317, 286, 2060, 4136, 6892, 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, 1...
1
#[test] fn test_residential_process_get_assertion_with_cred_protect() { let mut rng = ThreadRng256 {}; let private_key = crypto::ecdsa::SecKey::gensk(&mut rng); let credential_id = rng.gen_uniform_u8x32().to_vec(); let user_immediately_present = |_| Ok(()); let mut ctap_state = CtapState::new(&mut rng, user_immediately_present); let cred_desc = PublicKeyCredentialDescriptor { key_type: PublicKeyCredentialType::PublicKey, key_id: credential_id.clone(), transports: None, // You can set USB as a hint here. }; let credential = PublicKeyCredentialSource { key_type: PublicKeyCredentialType::PublicKey, credential_id: credential_id.clone(), private_key: private_key.clone(), rp_id: String::from("example.com"), user_handle: vec![0x00], other_ui: None, cred_random: None, cred_protect_policy: Some( CredentialProtectionPolicy::UserVerificationOptionalWithCredentialIdList, ), }; assert!(ctap_state .persistent_store .store_credential(credential) .is_ok()); let get_assertion_params = AuthenticatorGetAssertionParameters { rp_id: String::from("example.com"), client_data_hash: vec![0xCD], allow_list: None, extensions: None, options: GetAssertionOptions { up: false, uv: false, }, pin_uv_auth_param: None, pin_uv_auth_protocol: None, }; let get_assertion_response = ctap_state.process_get_assertion(get_assertion_params, DUMMY_CHANNEL_ID); assert_eq!( get_assertion_response, Err(Ctap2StatusCode::CTAP2_ERR_NO_CREDENTIALS), ); let get_assertion_params = AuthenticatorGetAssertionParameters { rp_id: String::from("example.com"), client_data_hash: vec![0xCD], allow_list: Some(vec![cred_desc.clone()]), extensions: None, options: GetAssertionOptions { up: false, uv: false, }, pin_uv_auth_param: None, pin_uv_auth_protocol: None, }; let get_assertion_response = ctap_state.process_get_assertion(get_assertion_params, DUMMY_CHANNEL_ID); assert!(get_assertion_response.is_ok()); let credential = PublicKeyCredentialSource { key_type: PublicKeyCredentialType::PublicKey, credential_id, private_key, rp_id: String::from("example.com"), user_handle: vec![0x00], other_ui: None, cred_random: None, cred_protect_policy: Some(CredentialProtectionPolicy::UserVerificationRequired), }; assert!(ctap_state .persistent_store .store_credential(credential) .is_ok()); let get_assertion_params = AuthenticatorGetAssertionParameters { rp_id: String::from("example.com"), client_data_hash: vec![0xCD], allow_list: Some(vec![cred_desc]), extensions: None, options: GetAssertionOptions { up: false, uv: false, }, pin_uv_auth_param: None, pin_uv_auth_protocol: None, }; let get_assertion_response = ctap_state.process_get_assertion(get_assertion_params, DUMMY_CHANNEL_ID); assert_eq!( get_assertion_response, Err(Ctap2StatusCode::CTAP2_ERR_NO_CREDENTIALS), ); }
rust_cleaned_test_functions.jsonl/35316
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1940 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4918, 11234, 11305, 3062, 16553, 290, 6615, 73475, 22357, 439, 368, 341, 286, 1077, 5206, 28422, 284, 8752, 49, 968, 17, 20, 21, 9321, 286, 1077, 869, 3097, 284, 19028, 486, 757, 96780, 486, 843...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_get_config_error_opening_file() { let cli = Cli { config: PathBuf::from_str("/tmp/http-adapter-test.json").expect("Bad file path string"), verbose: true, }; let result = cli.get_config(); assert!(result.is_err()); let error = result.unwrap_err(); assert!(matches!(error, CliError::Io(_))); }
rust_cleaned_test_functions.jsonl/115804
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 194 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 47147, 3062, 5332, 4096, 11311, 287, 2458, 368, 341, 286, 1077, 21348, 284, 96971, 341, 310, 2193, 25, 7933, 15064, 486, 1499, 2895, 4283, 5173, 15627, 12, 19731, 16839, 4323, 1827, 17119, 445, 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_default_ranking() { assert_ranked_match!(&["/hello", "/<name>"], "/hello" => "/hello"); assert_ranked_match!(&["/<name>", "/hello"], "/hello" => "/hello"); assert_ranked_match!(&["/<a>", "/hi", "/hi/<b>"], "/hi" => "/hi"); assert_ranked_match!(&["/<a>/b", "/hi/c"], "/hi/c" => "/hi/c"); assert_ranked_match!(&["/<a>/<b>", "/hi/a"], "/hi/c" => "/<a>/<b>"); assert_ranked_match!(&["/hi/a", "/hi/<c>"], "/hi/c" => "/hi/<c>"); assert_ranked_match!(&["/a", "/a?<b>"], "/a?b=c" => "/a?<b>"); assert_ranked_match!(&["/a", "/a?<b>"], "/a" => "/a?<b>"); assert_ranked_match!(&["/a", "/<a>", "/a?<b>", "/<a>?<b>"], "/a" => "/a?<b>"); assert_ranked_match!(&["/a", "/<a>", "/a?<b>", "/<a>?<b>"], "/b" => "/<a>?<b>"); assert_ranked_match!(&["/a", "/<a>", "/a?<b>", "/<a>?<b>"], "/b?v=1" => "/<a>?<b>"); assert_ranked_match!(&["/a", "/<a>", "/a?<b>", "/<a>?<b>"], "/a?b=c" => "/a?<b>"); assert_ranked_match!(&["/a", "/a?b"], "/a?b" => "/a?b"); assert_ranked_match!(&["/<a>", "/a?b"], "/a?b" => "/a?b"); assert_ranked_match!(&["/a", "/<a>?b"], "/a?b" => "/a"); assert_ranked_match!(&["/a?<c>&b", "/a?<b>"], "/a" => "/a?<b>"); assert_ranked_match!(&["/a?<c>&b", "/a?<b>"], "/a?b" => "/a?<c>&b"); assert_ranked_match!(&["/a?<c>&b", "/a?<b>"], "/a?c" => "/a?<b>"); assert_ranked_match!(&["/", "/<foo..>"], "/" => "/"); assert_ranked_match!(&["/", "/<foo..>"], "/hi" => "/<foo..>"); assert_ranked_match!(&["/hi", "/<foo..>"], "/hi" => "/hi"); }
rust_cleaned_test_functions.jsonl/25748
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 880 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9993, 20417, 287, 368, 341, 286, 2060, 20417, 291, 10708, 0, 2099, 1183, 14, 14990, 497, 3521, 27, 606, 29, 7914, 3521, 14990, 1, 589, 3521, 14990, 797, 286, 2060, 20417, 291, 10708, 0, 2099, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_239() { let mut mf = MedianFinder::new(); mf.add_num(1); mf.add_num(2); assert_eq!(mf.find_median(), 1.5); mf.add_num(3); assert_eq!(mf.find_median(), 2.0); }
rust_cleaned_test_functions.jsonl/6362
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 130 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 62, 17, 18, 24, 368, 341, 414, 1077, 5206, 43969, 284, 62590, 42300, 486, 931, 543, 414, 43969, 1364, 4273, 7, 16, 317, 414, 43969, 1364, 4273, 7, 17, 317, 414, 2060, 10714, 10297, 28124, 2658...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_unnamed() { let a_1 = StructUnnamed::<Runtime, ImplNone, ImplNone>(1, 2, 3, Default::default()); let a_default: StructUnnamed<Runtime, ImplNone, ImplNone> = Default::default(); assert_eq!(a_default.0, 0); assert_eq!(a_default.1, 0); assert_eq!(a_default.2, 0); assert_eq!(a_default.3, Default::default()); let a_2 = a_1.clone(); assert_eq!(a_2.0, 1); assert_eq!(a_2.1, 2); assert_eq!(a_2.2, 3); assert_eq!(a_2, a_1); assert_eq!(format!("{:?}", a_1), String::from("StructUnnamed(1, 2, 3, PhantomData)")); let b = StructUnnamed::<Runtime, ImplNone, ImplNone>(1, 2, 4, Default::default()); assert!(b != a_1); }
rust_cleaned_test_functions.jsonl/125758
{ "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, 15126, 4907, 30245, 368, 341, 10217, 264, 62, 16, 284, 16139, 78925, 27638, 15123, 11, 88092, 4064, 11, 88092, 4064, 2235, 16, 11, 220, 17, 11, 220, 18, 11, 7899, 486, 2258, 5231, 10217, 264, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_line_one_singular_bag() { assert_eq!( parse_line("bright white bags contain 1 shiny gold bag."), ( "bright white".to_string(), vec![(1, "shiny gold".to_string())] ) ) }
rust_cleaned_test_functions.jsonl/42313
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 161 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 6528, 11667, 93240, 74368, 368, 341, 286, 2060, 10714, 33673, 310, 4715, 6528, 445, 72116, 4158, 17899, 6644, 220, 16, 41199, 6623, 8968, 62497, 310, 2399, 394, 330, 72116, 4158, 3263, 983, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_gc_ready_transaction() { let mut pool = setup_mempool().0; add_txn(&mut pool, TestTransaction::new(1, 0, 1)).unwrap(); // insert in the middle transaction that's going to be expired let txn = TestTransaction::new(1, 1, 1) .make_signed_transaction_with_expiration_time(Duration::from_secs(0)); pool.add_txn(txn, 0, 0, 100, TimelineState::NotReady); // insert few transactions after it // They supposed to be ready because there's sequential path from 0 to them add_txn(&mut pool, TestTransaction::new(1, 2, 1)).unwrap(); add_txn(&mut pool, TestTransaction::new(1, 3, 1)).unwrap(); // check that all txns are ready let (timeline, _) = pool.read_timeline(0, 10); assert_eq!(timeline.len(), 4); // gc expired transaction pool.gc_by_expiration_time(Duration::from_secs(1)); // make sure txns 2 and 3 became not ready and we can't read them from any API let block = pool.get_block(10, HashSet::new()); assert_eq!(block.len(), 1); assert_eq!(block[0].sequence_number(), 0); let (timeline, _) = pool.read_timeline(0, 10); assert_eq!(timeline.len(), 1); assert_eq!(timeline[0].sequence_number(), 0); }
rust_cleaned_test_functions.jsonl/1807
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 460 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 49423, 35456, 28884, 368, 341, 262, 1077, 5206, 7314, 284, 6505, 717, 3262, 1749, 1005, 15, 280, 262, 912, 92299, 2099, 6984, 7314, 11, 3393, 8070, 486, 931, 7, 16, 11, 220, 15, 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_unsafe_ptrs() { unsafe { let a = [1i32, 2, 3]; let ptr = a.as_ptr(); let b = Soa2::from_raw_bufs(ptr, ptr, 3); assert_eq!(b.as_slices(), (&[1, 2, 3][..], &[1, 2, 3][..])); let c = [1i32, 2, 3, 4, 5]; let ptr = c.as_ptr(); let d = Soa2::from_raw_bufs(ptr, ptr, 5); assert_eq!(d.as_slices(), (&c[..], &c[..])); } }
rust_cleaned_test_functions.jsonl/121405
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 242 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4907, 18675, 79533, 368, 341, 262, 19860, 341, 286, 1077, 264, 284, 508, 16, 72, 18, 17, 11, 220, 17, 11, 220, 18, 935, 286, 1077, 10087, 284, 264, 5357, 4348, 543, 286, 1077, 293, 284, 2055...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_issue_82282() { fn overflowed_zip(arr: &[i32]) -> impl Iterator<Item = (i32, &())> { static UNIT_EMPTY_ARR: [(); 0] = []; let mapped = arr.into_iter().map(|i| *i); let mut zipped = mapped.zip(UNIT_EMPTY_ARR.iter()); zipped.next(); zipped } let arr = [1, 2, 3]; let zip = overflowed_zip(&arr).zip(overflowed_zip(&arr)); assert_eq!(zip.size_hint(), (0, Some(0))); for _ in zip { panic!(); } }
rust_cleaned_test_functions.jsonl/8970
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 245 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 53340, 62, 23, 17, 17, 23, 17, 368, 341, 262, 5168, 16484, 291, 42131, 10939, 25, 44590, 72, 18, 17, 2467, 1464, 11605, 23023, 31857, 284, 320, 72, 18, 17, 11, 609, 2140, 29, 341, 286, 1099,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_pydate_out_of_bounds() { use pyo3::types::PyDate; // This test is an XFAIL on Python < 3.6 until bounds checking is implemented let gil = Python::acquire_gil(); let py = gil.python(); for val in INVALID_DATES { let (year, month, day) = val; let dt = PyDate::new(py, *year, *month, *day); dt.unwrap_err(); } }
rust_cleaned_test_functions.jsonl/113016
{ "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, 40291, 1028, 6068, 3575, 36878, 368, 341, 262, 990, 4510, 78, 18, 486, 9242, 486, 13828, 1916, 401, 262, 442, 1096, 1273, 374, 458, 1599, 36973, 389, 13027, 366, 220, 18, 13, 21, 3080, 14262, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_message_unique_keys_order_preserved() { let program_id = Pubkey::default(); let id0 = Pubkey::new_unique(); let id1 = Pubkey::default(); // Key less than id0 let keys = get_keys( &[ Instruction::new_with_bincode(program_id, &0, vec![AccountMeta::new(id0, false)]), Instruction::new_with_bincode(program_id, &0, vec![AccountMeta::new(id1, false)]), ], None, ); assert_eq!(keys, InstructionKeys::new(vec![], vec![id0, id1], 0, 0)); }
rust_cleaned_test_functions.jsonl/55523
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 287 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6462, 21218, 12631, 7869, 32116, 2771, 368, 341, 286, 1077, 2025, 842, 284, 22611, 792, 486, 2258, 543, 286, 1077, 877, 15, 284, 22611, 792, 486, 931, 21218, 543, 286, 1077, 877, 16, 284, 22611,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_prove_false_prop() { let bool_false_tree = ErgoTree::try_from(Expr::Const(Constant { tpe: SType::SBoolean, v: Literal::Boolean(false), })) .unwrap(); let message = vec![0u8; 100]; let prover = TestProver { secrets: vec![] }; let res = prover.prove( &bool_false_tree, &Env::empty(), Rc::new(force_any_val::<Context>()), message.as_slice(), &HintsBag::empty(), ); assert!(res.is_err()); assert_eq!(res.err().unwrap(), ProverError::ReducedToFalse); }
rust_cleaned_test_functions.jsonl/3882
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 341 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2540, 586, 36015, 21663, 368, 341, 286, 1077, 1807, 36015, 11663, 284, 73202, 78, 6533, 486, 1539, 5673, 7, 16041, 486, 19167, 50989, 341, 310, 259, 375, 25, 328, 929, 486, 50, 6890, 345, 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_point_in_poly() { let poly = [ Point2D::new(0.0, 0.0), Point2D::new(5.0, 0.0), Point2D::new(5.0, 5.0), Point2D::new(0.0, 0.0), ]; // point inside rectangle assert!(point_in_poly(&Point2D::new(2.0, 2.0), &poly)); // point outside rectangle assert_eq!(point_in_poly(&Point2D::new(12.0, 12.0), &poly), false); }
rust_cleaned_test_functions.jsonl/40384
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 247 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6085, 1243, 36133, 368, 341, 286, 1077, 9861, 284, 2278, 310, 5126, 17, 35, 486, 931, 7, 15, 13, 15, 11, 220, 15, 13, 15, 1326, 310, 5126, 17, 35, 486, 931, 7, 20, 13, 15, 11, 220, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_decode_eth_signed_transaction() { let encoded_tx = hex::decode("f86a8086d55698372431831e848094f0109fc8df283027b6285cc889f5aa624eac1f55843b9aca008025a009ebb6ca057a0535d6186462bc0b465b561c94a295bdb0621fc19208ab149a9ca0440ffd775ce91a833ab410777204d5341a6f9fa91216a6f3ee2c051fea6a0428").unwrap(); let tx = EthSignedTransaction::decode(&Rlp::new(&encoded_tx)).unwrap(); assert_eq!(tx.v, 37); assert_eq!(tx.chain_id(), Some(1)); assert_eq!( tx.transaction, EthTransaction { nonce: U256::zero(), gas_price: U256::from(234567897654321u128), gas: U256::from(2000000u128), to: Some(address_from_arr( &hex::decode("F0109fC8DF283027b6285cc889F5aA624EaC1F55").unwrap() )), value: U256::from(1000000000), data: vec![], } ); assert_eq!( tx.sender().unwrap(), address_from_arr(&hex::decode("2c7536e3605d9c16a7a3d7b1898e529396a65c23").unwrap()) ); }
rust_cleaned_test_functions.jsonl/27270
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 648 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15227, 57757, 55617, 28884, 368, 341, 286, 1077, 20498, 17805, 284, 12371, 486, 18196, 445, 69, 23, 21, 64, 23, 15, 23, 21, 67, 20, 20, 21, 24, 23, 18, 22, 17, 19, 18, 16, 23, 18, 16, 68...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_repository_registrations_encoding() { run_async_test(async { ffx_config::set( (CONFIG_KEY_REGISTRATIONS, ConfigLevel::User), json!({ "repo%2Ename": { "target%2Ename": { "repo_name": "repo.name", "target_identifier": "target.name", "aliases": [], "storage_type": (), }, "target%25name": { "repo_name": "repo.name", "target_identifier": "target%name", "aliases": [], "storage_type": (), }, }, }), ) .await .unwrap(); assert_eq!( get_repository_registrations("repo.name").await, hashmap! { "target.name".into() => RepositoryTarget { repo_name: "repo.name".into(), target_identifier: Some("target.name".into()), aliases: vec![], storage_type: None, }, "target%name".into() => RepositoryTarget { repo_name: "repo.name".into(), target_identifier: Some("target%name".into()), aliases: vec![], storage_type: None, }, }, ); }); }
rust_cleaned_test_functions.jsonl/98277
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1195 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 47301, 4920, 3758, 804, 37613, 368, 341, 286, 1598, 28346, 4452, 18285, 341, 310, 282, 8298, 5332, 486, 746, 1006, 394, 320, 24652, 6600, 8064, 29503, 21792, 11, 5532, 4449, 486, 1474, 1326,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_call_hierarchy_in_tests_mod() { check_hierarchy( r#" //- /lib.rs cfg:test fn callee() {} fn caller1() { call$0ee(); } #[cfg(test)] mod tests { use super::*; #[test] fn test_caller() { callee(); } } "#, expect![["callee Function FileId(0) 0..14 3..9"]], expect![[r#" caller1 Function FileId(0) 15..45 18..25 : [34..40] test_caller Function FileId(0) 95..149 110..121 : [134..140]"#]], expect![[]], ); }
rust_cleaned_test_functions.jsonl/38288
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 311 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13429, 95043, 1243, 32509, 7480, 368, 341, 286, 1779, 95043, 1006, 310, 435, 2, 698, 61463, 608, 2740, 25638, 13286, 84476, 198, 8822, 94800, 368, 5613, 8822, 19865, 16, 368, 341, 262, 1618, 3, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_bug1059649() { // ensure that folding blocks with a single var node doesn't explode test( "if(x){var y=3;}var z=5; use(y, z)", "if(x)var y=3; use(y, 5)", ); test( "for(var i=0;i<10;i++){var y=3;}var z=5; use(y, z)", "for(var i=0;i<10;i++)var y=3; use(y, 5)", ); test( "for(var i in x){var y=3;}var z=5; use(y, z)", "for(var i in x)var y=3; use(y, 5)", ); test( "do{var y=3;}while(x);var z=5; use(y, z)", "do var y=3;while(x); use(y, 5)", ); }
rust_cleaned_test_functions.jsonl/114461
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 323 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 73232, 16, 15, 20, 24, 21, 19, 24, 368, 341, 262, 442, 5978, 429, 44742, 10010, 448, 264, 3175, 762, 2436, 3171, 944, 15758, 198, 262, 1273, 1006, 286, 330, 333, 2075, 6098, 947, 379, 28, 18...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_tt_composite() { check( r#" macro_rules! m { ($tt:tt) => { ok!(); } } m! { => } m! { = > } "#, expect![[r#" macro_rules! m { ($tt:tt) => { ok!(); } } ok!(); /* error: leftover tokens */ok!(); "#]], ); }
rust_cleaned_test_functions.jsonl/85241
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 135 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 66740, 2965, 13607, 368, 341, 262, 1779, 1006, 286, 435, 2, 698, 32606, 21407, 0, 296, 314, 1711, 5566, 25, 5566, 8, 589, 314, 5394, 0, 2129, 335, 456, 76, 0, 314, 589, 456, 76, 0, 314, 28...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_eintr_when_no_zombie() { let (_kernel, current_task) = create_kernel_and_task(); // Send the signal to the task. assert!( sys_kill(&current_task, current_task.get_pid(), UncheckedSignal::from(SIGCHLD)).is_ok() ); // Verify that EINTR is returned because there is no zombie task. assert_eq!(wait_on_pid(&current_task, TaskSelector::Any, 0), Err(EINTR)); }
rust_cleaned_test_functions.jsonl/71723
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 196 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2204, 58788, 47636, 6536, 6415, 23342, 368, 341, 286, 1077, 5453, 23248, 11, 1482, 12184, 8, 284, 1855, 26876, 8378, 12184, 543, 286, 442, 11000, 279, 8286, 311, 279, 3383, 624, 286, 2060, 33673, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_riddle_increase_bounty() { let mut riddle = Riddle::new( "title".to_string(), "text".to_string(), "hint".to_string(), "answer".to_string(), 1, ); riddle.increase_bounty(1); assert_eq!(riddle.get_bounty(), 2); }
rust_cleaned_test_functions.jsonl/34254
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 189 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1710, 3310, 73807, 880, 36725, 368, 341, 286, 1077, 5206, 435, 3310, 284, 431, 3310, 486, 931, 1006, 310, 330, 2102, 3263, 983, 3904, 3148, 310, 330, 1318, 3263, 983, 3904, 3148, 310, 330, 46125...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_bool() { BoolType::test(Encoding::PLAIN, TEST_SET_SIZE, -1); BoolType::test(Encoding::PLAIN_DICTIONARY, TEST_SET_SIZE, -1); BoolType::test(Encoding::RLE, TEST_SET_SIZE, -1); }
rust_cleaned_test_functions.jsonl/45120
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 100 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 22159, 368, 341, 262, 12608, 929, 486, 1944, 85177, 486, 90889, 11, 13602, 8481, 4098, 11, 481, 16, 317, 262, 12608, 929, 486, 1944, 85177, 486, 90889, 44663, 3580, 8642, 11, 13602, 8481, 4098, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_serialization() { let torchscript_input = TorchScriptInput { positional_arguments: vec![ SerializableIValue::List(vec![ SerializableIValue::Str("<bos>".to_string()), SerializableIValue::Str("call".to_string()), SerializableIValue::Str("mom".to_string()), SerializableIValue::Str("<eos>".to_string()), ]), SerializableIValue::Bool(true), SerializableIValue::Int(3), SerializableIValue::Int(3), ], }; let serialized = serde_json::to_string(&torchscript_input).unwrap(); let unserialized: TorchScriptInput = serde_json::from_str(&serialized).unwrap(); assert_eq!(torchscript_input, unserialized) }
rust_cleaned_test_functions.jsonl/10093
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 437 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 25602, 2022, 368, 341, 286, 1077, 7834, 2282, 5898, 284, 78743, 5910, 2505, 341, 310, 67547, 43433, 25, 7486, 90515, 394, 24859, 40, 1130, 486, 852, 25592, 90515, 503, 24859, 40, 1130, 486, 2580, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_ledger_fees() { settings::set_defaults(); settings::set_config_value(settings::CONFIG_ENABLE_TEST_MODE, "true"); let cb = return_types_u32::Return_U32_STR::new().unwrap(); assert_eq!(vcx_ledger_get_fees(cb.command_handle, Some(cb.get_callback())), error::SUCCESS.code_num); }
rust_cleaned_test_functions.jsonl/111536
{ "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, 3062, 38367, 1389, 761, 5516, 368, 341, 286, 5003, 486, 746, 42290, 543, 286, 5003, 486, 746, 5332, 3142, 23369, 486, 24652, 14379, 11641, 8414, 11, 330, 1866, 3071, 286, 1077, 9858, 284, 470, 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_rv32m() { let shared_builder = settings::builder(); let shared_flags = settings::Flags::new(shared_builder); // Set the supports_m stting which in turn enables the use_m predicate that unlocks // encodings for imul. let mut isa_builder = isa::lookup(triple!("riscv32")).unwrap(); isa_builder.enable("supports_m").unwrap(); let isa = isa_builder.finish(shared_flags); let mut func = Function::new(); let ebb = func.dfg.make_ebb(); let arg32 = func.dfg.append_ebb_param(ebb, types::I32); let mul32 = InstructionData::Binary { opcode: Opcode::Imul, args: [arg32, arg32], }; assert_eq!( encstr(&*isa, isa.encode(&func, &mul32, types::I32)), "R#10c" ); }
rust_cleaned_test_functions.jsonl/10516
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 413 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1710, 85, 18, 17, 76, 368, 341, 286, 1077, 6094, 28532, 284, 5003, 486, 17850, 543, 286, 1077, 6094, 14130, 284, 5003, 486, 9195, 486, 931, 65069, 28532, 626, 286, 442, 2573, 279, 11554, 717, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_create_guild_prune_compute_prune_count_true() { let route = Route::CreateGuildPrune { compute_prune_count: Some(true), days: None, guild_id: GUILD_ID, include_roles: &[], }; assert_eq!( route.to_string(), format!( "guilds/{guild_id}/prune?compute_prune_count=true", guild_id = GUILD_ID ) ); }
rust_cleaned_test_functions.jsonl/119964
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 279 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8657, 1889, 1498, 5294, 2886, 57028, 5294, 2886, 3180, 16082, 368, 341, 286, 1077, 6021, 284, 9572, 486, 4021, 72574, 3533, 2886, 341, 310, 12564, 5294, 2886, 3180, 25, 4329, 3715, 1326, 310, 2849...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_multiline_errors() { assert_eq!(Json::from_str("{\n \"foo\":\n \"bar\""), Err(SyntaxError(EOFWhileParsingObject, 3, 8))); }
rust_cleaned_test_functions.jsonl/22732
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 89 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 26290, 26560, 20196, 368, 341, 286, 2060, 10714, 10297, 5014, 486, 1499, 2895, 13976, 59, 77, 220, 7245, 7975, 11693, 59, 77, 7245, 2257, 2105, 4461, 310, 15495, 93549, 1454, 7, 23483, 7983, 68839...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_dad_duplicate_address_detected_solicitation() { // Tests whether a duplicate address will get detected by solicitation // so they will both give up using that address. set_logger_for_test(); let mac = Mac::new([1, 2, 3, 4, 5, 6]); let addr = AddrSubnet::new(mac.to_ipv6_link_local().get(), 128).unwrap(); let multicast_addr = mac.to_ipv6_link_local().get().to_solicited_node_address(); let mut local = DummyEventDispatcherBuilder::default(); local.add_device(mac); let mut remote = DummyEventDispatcherBuilder::default(); remote.add_device(mac); let device_id = DeviceId::new_ethernet(0); let mut stack_builder = StackStateBuilder::default(); let mut ndp_configs = crate::device::ndp::NdpConfigurations::default(); ndp_configs.set_max_router_solicitations(None); stack_builder.device_builder().set_default_ndp_configs(ndp_configs); // We explicitly call `build_with` when building our contexts below because `build` will // set the default NDP parameter DUP_ADDR_DETECT_TRANSMITS to 0 (effectively disabling // DAD) so we use our own custom `StackStateBuilder` to set it to the default value let mut net = DummyNetwork::new( vec![ ("local", local.build_with(stack_builder.clone(), DummyEventDispatcher::default())), ("remote", remote.build_with(stack_builder, DummyEventDispatcher::default())), ] .into_iter(), |ctx, dev| { if *ctx == "local" { ("remote", device_id, None) } else { ("local", device_id, None) } }, ); set_ip_addr_subnet(net.context("local"), device_id, addr); set_ip_addr_subnet(net.context("remote"), device_id, addr); assert_eq!(net.context("local").dispatcher.frames_sent().len(), 1); assert_eq!(net.context("remote").dispatcher.frames_sent().len(), 1); // Both devices should be in the solicited-node multicast group. assert!(is_in_ip_multicast(net.context("local"), device_id, multicast_addr)); assert!(is_in_ip_multicast(net.context("remote"), device_id, multicast_addr)); net.step(); // they should now realize the address they intend to use has a duplicate // in the local network assert!(get_ip_addr_subnet::<_, Ipv6Addr>(net.context("local"), device_id).is_none()); assert!(get_ip_addr_subnet::<_, Ipv6Addr>(net.context("remote"), device_id).is_none()); // Both devices should not be in the multicast group assert!(!is_in_ip_multicast(net.context("local"), device_id, multicast_addr)); assert!(!is_in_ip_multicast(net.context("remote"), device_id, multicast_addr)); }
rust_cleaned_test_functions.jsonl/16136
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1270 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 814, 329, 70434, 6744, 98876, 643, 7762, 7556, 368, 341, 286, 442, 20150, 3425, 264, 22513, 2621, 686, 633, 16507, 553, 29744, 7556, 8945, 16885, 286, 442, 773, 807, 686, 2176, 2968, 705, 1667, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_merge_blob_to_tree_into_blob_to_tree_no_conflict() -> BitResult<()> { BitRepo::with_minimal_repo(|repo| { let ours = commit! { foo { bar < "bar" } }; let theirs = commit! { foo { baz < "baz" } }; repo.three_way_merge(ours, theirs)?; assert_eq!(cat!(repo: "foo/bar"), "bar"); assert_eq!(cat!(repo: "foo/baz"), "baz"); Ok(()) }) }
rust_cleaned_test_functions.jsonl/94179
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 306 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 20888, 45908, 2346, 11663, 45514, 45908, 2346, 11663, 6536, 16059, 21242, 368, 1464, 6495, 2077, 71698, 341, 262, 6495, 25243, 486, 4197, 7260, 2861, 37784, 22428, 23476, 91, 341, 286, 1077, 11350, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_account_balance_for_capitalization_native_program() { let normal_native_program = solana_sdk::native_loader::create_loadable_account_for_test("foo"); assert_eq!(normal_native_program.lamports(), 1); }
rust_cleaned_test_functions.jsonl/1403
{ "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, 13500, 29396, 5478, 16388, 2174, 2022, 44494, 25096, 368, 341, 286, 1077, 4622, 44494, 25096, 4035, 310, 2048, 3362, 61783, 486, 29738, 22139, 486, 3182, 12411, 480, 13500, 5478, 4452, 445, 7975, 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
#[test] fn test_list_attempts_by_endpoint_query_parameters_validation() { let q: ListAttemptsByEndpointQueryParameters = serde_json::from_value(json!({ "event_types": INVALID_EVENT_TYPES })).unwrap(); assert!(q.validate().is_err()); let q: ListAttemptsByEndpointQueryParameters = serde_json::from_value(json!({ "channel": INVALID_CHANNEL })).unwrap(); assert!(q.validate().is_err()); }
rust_cleaned_test_functions.jsonl/64492
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 200 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2019, 79490, 3710, 36699, 5738, 18263, 19416, 368, 341, 286, 1077, 2804, 25, 1759, 81517, 1359, 27380, 2859, 9706, 4035, 310, 61570, 9455, 486, 1499, 3142, 9304, 0, 2306, 330, 3087, 9763, 788, 322...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_has_compact_perbill() { let data = WithCompact { data: Perbill(1) }; let encoded = data.encode(); assert_eq!(data, WithCompact::<Perbill>::decode(&mut &encoded[..]).unwrap()); }
rust_cleaned_test_functions.jsonl/34805
{ "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, 21778, 18177, 531, 5678, 29642, 368, 341, 197, 10217, 821, 284, 3085, 98335, 314, 821, 25, 3616, 29642, 7, 16, 8, 2605, 197, 10217, 20498, 284, 821, 17313, 543, 197, 6948, 10714, 10297, 691, 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
#[test] fn test_scoped_dir_builder() { // create temporary directory to emulate container rootfs with symlink let rootfs_dir = tempdir().expect("failed to create tmpdir"); DirBuilder::new() .create(rootfs_dir.path().join("b")) .unwrap(); symlink(rootfs_dir.path().join("b"), rootfs_dir.path().join("a")).unwrap(); let rootfs_path = &rootfs_dir.path().join("a"); // root directory doesn't exist ScopedDirBuilder::new(rootfs_path.join("__does_not_exist__")).unwrap_err(); ScopedDirBuilder::new("__does_not_exist__").unwrap_err(); // root is a file fs::write(rootfs_path.join("txt"), "test").unwrap(); ScopedDirBuilder::new(rootfs_path.join("txt")).unwrap_err(); let mut builder = ScopedDirBuilder::new(&rootfs_path).unwrap(); // file with the same name already exists. builder .create_with_unscoped_path(rootfs_path.join("txt")) .unwrap_err(); // parent is a file builder.create("/txt/a").unwrap_err(); // Not starting with root builder.create_with_unscoped_path("/txt/a").unwrap_err(); // creating "." without recursive mode should fail builder .create_with_unscoped_path(rootfs_path.join(".")) .unwrap_err(); // parent doesn't exist builder .create_with_unscoped_path(rootfs_path.join("a/b")) .unwrap_err(); builder.create("a/b/c").unwrap_err(); let path = builder.create("a").unwrap(); assert!(rootfs_path.join("a").is_dir()); assert_eq!(path.target(), rootfs_path.join("a").canonicalize().unwrap()); // Creating an existing directory without recursive mode should fail. builder .create_with_unscoped_path(rootfs_path.join("a")) .unwrap_err(); // Creating an existing directory with recursive mode should succeed. builder.recursive(true); let path = builder .create_with_unscoped_path(rootfs_path.join("a")) .unwrap(); assert_eq!(path.target(), rootfs_path.join("a").canonicalize().unwrap()); let path = builder.create(".").unwrap(); assert_eq!(path.target(), rootfs_path.canonicalize().unwrap()); let umask = unsafe { libc::umask(0022) }; unsafe { libc::umask(umask) }; builder.mode(0o740); let path = builder.create("a/b/c/d").unwrap(); assert_eq!( path.target(), rootfs_path.join("a/b/c/d").canonicalize().unwrap() ); assert!(rootfs_path.join("a/b/c/d").is_dir()); assert_eq!( rootfs_path.join("a").metadata().unwrap().mode() & 0o777, DIRECTORY_MODE_DEFAULT & !umask, ); assert_eq!( rootfs_path.join("a/b").metadata().unwrap().mode() & 0o777, 0o740 & !umask ); assert_eq!( rootfs_path.join("a/b/c").metadata().unwrap().mode() & 0o777, 0o740 & !umask ); assert_eq!( rootfs_path.join("a/b/c/d").metadata().unwrap().mode() & 0o777, 0o740 & !umask ); // Creating should fail if some components are not directory. builder.create("txt/e/f").unwrap_err(); fs::write(rootfs_path.join("a/b/txt"), "test").unwrap(); builder.create("a/b/txt/h/i").unwrap_err(); }
rust_cleaned_test_functions.jsonl/71712
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1627 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13171, 16367, 4334, 28532, 368, 341, 286, 442, 1855, 13340, 6220, 311, 65485, 5476, 3704, 3848, 448, 83221, 198, 286, 1077, 3704, 3848, 4334, 284, 2730, 3741, 1005, 17119, 445, 16091, 311, 1855, 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_to_value_tuple_enum() { let test = TestTupleExternalEnum { a: TupleExternalEnum::Val2(1.0, 2.0, 3.0), }; let expected = Value::Record(vec![( "a".to_owned(), Value::Record(vec![ ("type".to_owned(), Value::Enum(1, "Val2".to_owned())), ( "value".to_owned(), Value::Array(vec![ Value::Union(Box::new(Value::Float(1.0))), Value::Union(Box::new(Value::Float(2.0))), Value::Union(Box::new(Value::Float(3.0))), ]), ), ]), )]); assert_eq!( to_value(test).unwrap(), expected, "error serializing tuple external enum" ); let test = TestTupleAdjacentEnum { a: TupleAdjacentEnum::Val1(1.0, 2.0), }; let expected = Value::Record(vec![( "a".to_owned(), Value::Record(vec![ ("t".to_owned(), Value::String("Val1".to_owned())), ( "v".to_owned(), Value::Array(vec![Value::Float(1.0), Value::Float(2.0)]), ), ]), )]); assert_eq!( to_value(test).unwrap(), expected, "error serializing tuple adjacent enum" ); let test = TestTupleUntaggedEnum { a: TupleUntaggedEnum::Val1(1.0, 2.0), }; let expected = Value::Record(vec![( "a".to_owned(), Value::Array(vec![Value::Float(1.0), Value::Float(2.0)]), )]); assert_eq!( to_value(test).unwrap(), expected, "error serializing tuple untagged enum" ); }
rust_cleaned_test_functions.jsonl/52765
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1103 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2346, 3142, 21773, 31054, 368, 341, 286, 1077, 1273, 284, 3393, 28681, 25913, 10766, 341, 310, 264, 25, 24622, 25913, 10766, 486, 2208, 17, 7, 16, 13, 15, 11, 220, 17, 13, 15, 11, 220, 18, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_sha512_hash() { use std::collections::HashMap; let mut message_hashes: HashMap<&str, [u64; 8]> = HashMap::new(); message_hashes.insert( "", [ 0xcf83e1357eefb8bd, 0xf1542850d66d8007, 0xd620e4050b5715dc, 0x83f4a921d36ce9ce, 0x47d0d13c5d85f2b0, 0xff8318d2877eec2f, 0x63b931bd47417a81, 0xa538327af927da3e, ], ); message_hashes.insert( "abc", [ 0xddaf35a193617aba, 0xcc417349ae204131, 0x12e6fa4e89a97ea2, 0x0a9eeee64b55d39a, 0x2192992a274fc1a8, 0x36ba3c23a3feebbd, 0x454d4423643ce80e, 0x2a9ac94fa54ca49f, ], ); message_hashes.insert( "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", [ 0x204a8fc6dda82f0a, 0x0ced7beb8e08a416, 0x57c16ef468b228a8, 0x279be331a703c335, 0x96fd15c13b1b07f9, 0xaa1d3bea57789ca0, 0x31ad85c7a71dd703, 0x54ec631238ca3445, ], ); message_hashes.insert( "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu", [0x8e959b75dae313da, 0x8cf4f72814fc143f, 0x8f7779c6eb9f7fa1, 0x7299aeadb6889018, 0x501d289e4900f7e4, 0x331b99dec4b5433a, 0xc7d329eeb6dd2654, 0x5e96e55b874be909] ); for (msg, hash) in message_hashes.iter() { let test_hashes = super::hash(&msg.as_bytes()); for (i, test_hash) in test_hashes.iter().enumerate() { assert_eq!(hash[i], test_hash[i]); } } }
rust_cleaned_test_functions.jsonl/119258
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1326 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 48836, 20, 16, 17, 8950, 368, 341, 286, 990, 1460, 486, 51137, 486, 18497, 280, 286, 1077, 5206, 1943, 91616, 25, 10528, 52244, 495, 11, 508, 84, 21, 19, 26, 220, 23, 25669, 284, 10528, 486, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_generate_self_attested_proof() { init!("ledger"); let did = settings::get_config_value(settings::CONFIG_INSTITUTION_DID).unwrap(); let mut proof_req = ProofRequestMessage::create(); let indy_proof_req = json!({ "nonce":"123432421212", "name":"proof_req_1", "version":"0.1", "requested_attributes": json!({ "address1_1": json!({ "name":"address1", }), "zip_2": json!({ "name":"zip", }), }), "requested_predicates": json!({}), }).to_string(); proof_req.proof_request_data = serde_json::from_str(&indy_proof_req).unwrap(); let selected_credentials: Value = json!({}); let self_attested: Value = json!({ "address1_1":"attested_address", "zip_2": "attested_zip" }); let mut proof: DisclosedProof = Default::default(); proof.proof_request = Some(proof_req); proof.link_secret_alias = "main".to_string(); let generated_proof = proof.generate_proof(&selected_credentials.to_string(), &self_attested.to_string()); assert!(generated_proof.is_ok()); }
rust_cleaned_test_functions.jsonl/106029
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 635 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 48851, 25637, 13356, 9980, 86757, 368, 341, 286, 2930, 17223, 50704, 797, 286, 1077, 1521, 284, 5003, 486, 455, 5332, 3142, 23369, 486, 24652, 2158, 25765, 28617, 1557, 915, 568, 15454, 1428, 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_from_str_fail() { fn test(s: &str) { let rational: Option<Rational> = FromStr::from_str(s); assert_eq!(rational, None); } let xs = ["0 /1", "abc", "", "1/", "--1/2","3/2/1"]; for &s in xs.iter() { test(s); } }
rust_cleaned_test_functions.jsonl/80850
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 185 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5673, 2895, 22121, 368, 341, 286, 5168, 1273, 1141, 25, 609, 495, 8, 341, 310, 1077, 24438, 25, 6959, 23370, 1663, 29, 284, 5542, 2580, 486, 1499, 2895, 1141, 317, 310, 2060, 10714, 10297, 81, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_permissions_net_fetch_localhost_4545_fail() { let (_, err) = util::run_and_collect_output( false, "run --allow-net=localhost:4545 complex_permissions_test.ts netFetch http://localhost:4546/", None, None, true, ); assert!(err.contains(util::PERMISSION_DENIED_PATTERN)); }
rust_cleaned_test_functions.jsonl/5601
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 135 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 44767, 19722, 11803, 62, 8301, 62, 19, 20, 19, 20, 22121, 368, 341, 220, 1077, 39464, 1848, 8, 284, 4094, 486, 6108, 8378, 68140, 7645, 1006, 262, 895, 345, 298, 197, 1, 6108, 1177, 7183, 6649...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_access() { let tuple = (false, true, false, true); let bit_tuple = Bit::from(tuple); assert_eq!(bit!(bit_tuple.0).extract(), false); assert_eq!(bit!(bit_tuple.1).extract(), true); assert_eq!(bit!(bit_tuple.2).extract(), false); assert_eq!(bit!(bit_tuple.3).extract(), true); let tuple = (false, true, false, [true, true, true, false, true, true]); let bit_tuple = Bit::from(tuple); assert_eq!(bit!(bit_tuple.0).extract(), false); assert_eq!(bit!(bit_tuple.1).extract(), true); assert_eq!(bit!(bit_tuple.2).extract(), false); for i in 0..6 { assert_eq!(bit!(bit_tuple.3[i]).extract(), i != 3); } }
rust_cleaned_test_functions.jsonl/44784
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 371 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 12759, 368, 341, 286, 1077, 14405, 284, 320, 3849, 11, 830, 11, 895, 11, 830, 317, 286, 1077, 2699, 21773, 284, 6495, 486, 1499, 58602, 626, 286, 2060, 10714, 10297, 4489, 10297, 4489, 21773, 13...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_vec3mask_fmt() { let a = Vec3Mask::new(true, false, false); // debug fmt assert_eq!(format!("{:?}", a), "Vec3Mask(0xffffffff, 0x0, 0x0)"); // display fmt assert_eq!(format!("{}", a), "[true, false, false]"); }
rust_cleaned_test_functions.jsonl/75051
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 121 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13251, 18, 11258, 38128, 368, 341, 262, 1077, 264, 284, 11312, 18, 12686, 486, 931, 3715, 11, 895, 11, 895, 626, 262, 442, 7390, 8879, 198, 262, 2060, 10714, 10297, 2243, 88928, 25, 52652, 264, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_index_expression() { let b = ast::BaseNode::default(); let pkg = Parser::new("a[3]").parse_single_package("path".to_string(), "foo.flux".to_string()); let want = Package { loc: b.location.clone(), package: "main".to_string(), files: vec![File { loc: b.location.clone(), package: None, imports: Vec::new(), body: vec![Statement::Expr(ExprStmt { loc: b.location.clone(), expression: Expression::Index(Box::new(IndexExpr { loc: b.location.clone(), typ: type_info(), array: Expression::Identifier(IdentifierExpr { loc: b.location.clone(), typ: type_info(), name: Symbol::from("a"), }), index: Expression::Integer(IntegerLit { loc: b.location.clone(), value: 3, }), })), })], }], }; let got = test_convert(pkg).unwrap(); assert_eq!(want, got); }
rust_cleaned_test_functions.jsonl/132527
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 792 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 34910, 3560, 28068, 368, 341, 286, 1077, 293, 284, 11763, 486, 3978, 1955, 486, 2258, 543, 286, 1077, 24793, 4035, 310, 21102, 486, 931, 445, 64, 58, 18, 44891, 6400, 19487, 26328, 445, 2343, 32...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_play_multiple() { let mut state = PlaybackState::default(); state.queue(song("1")); state.queue(song("2")); state.queue(song("3")); assert_eq!(state.songs().count(), 3); state.play("2"); assert!(state.is_playing()); assert_eq!(state.current_position(), Some(1)); assert_eq!(state.prev_song().map(|s| &s.id[..]), Some("1")); assert_eq!(state.song_id(), Some("2")); assert_eq!(state.next_song().map(|s| &s.id[..]), Some("3")); state.toggle_play(); assert!(!state.is_playing()); state.play_next(); assert!(state.is_playing()); assert_eq!(state.current_position(), Some(2)); assert_eq!(state.prev_song().map(|s| &s.id[..]), Some("2")); assert_eq!(state.song_id(), Some("3")); assert!(state.next_song().is_none()); state.play_next(); assert!(state.is_playing()); assert_eq!(state.current_position(), Some(2)); assert_eq!(state.song_id(), Some("3")); state.play_prev(); state.play_prev(); assert!(state.is_playing()); assert_eq!(state.current_position(), Some(0)); assert!(state.prev_song().is_none()); assert_eq!(state.song_id(), Some("1")); assert_eq!(state.next_song().map(|s| &s.id[..]), Some("2")); state.play_prev(); assert!(state.is_playing()); assert_eq!(state.current_position(), Some(0)); assert_eq!(state.song_id(), Some("1")); }
rust_cleaned_test_functions.jsonl/20826
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 737 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 22144, 45233, 368, 341, 286, 1077, 5206, 1584, 284, 95301, 1397, 486, 2258, 543, 286, 1584, 29598, 60873, 445, 16, 4010, 286, 1584, 29598, 60873, 445, 17, 4010, 286, 1584, 29598, 60873, 445, 18, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_from_err() { let gil = Python::acquire_gil(); let py = gil.python(); if let Err(err) = PyByteArray::from(py, &py.None()) { assert!(err.is_instance::<exceptions::PyTypeError>(py)); } else { panic!("error"); } }
rust_cleaned_test_functions.jsonl/60118
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 156 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5673, 9266, 368, 341, 286, 1077, 342, 321, 284, 13027, 486, 580, 984, 1889, 321, 543, 286, 1077, 4510, 284, 342, 321, 43193, 1428, 286, 421, 1077, 15495, 3964, 8, 284, 5355, 18394, 486, 1499, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_vsqx4_parse() { let vsqx4 = include_str!("../test/v4.vsqx"); let _v: Vsqx4 = quick_xml::de::from_str(&vsqx4).unwrap(); }
rust_cleaned_test_functions.jsonl/124625
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 80 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2273, 28343, 87, 19, 21039, 368, 341, 262, 1077, 6165, 88735, 19, 284, 2924, 2895, 17223, 1244, 1944, 5457, 19, 3133, 28343, 87, 797, 262, 1077, 716, 85, 25, 647, 28343, 87, 19, 284, 3974, 238...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_source_from_string() { let values = [ "oPeN", "HIGH", "low", "cLose", "volume", "vOluMeD_prIcE", "tP", "hlc3", "Hl2", ]; values.iter().enumerate().for_each(|(i, s)| { let r: Source = s.parse().unwrap(); match i { 0 => assert_eq!(Source::Open, r), 1 => assert_eq!(Source::High, r), 2 => assert_eq!(Source::Low, r), 3 => assert_eq!(Source::Close, r), 4 => assert_eq!(Source::Volume, r), 5 => assert_eq!(Source::VolumedPrice, r), 6 | 7 => assert_eq!(Source::TP, r), 8 => assert_eq!(Source::HL2, r), _ => panic!("Wow. You cannot be here."), } }); let src: Result<Source, _> = "some other string".parse(); assert!(src.is_err()); }
rust_cleaned_test_functions.jsonl/28054
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 370 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10347, 5673, 3904, 368, 341, 197, 10217, 2750, 284, 2278, 298, 197, 1, 78, 10197, 45, 756, 298, 197, 45539, 16768, 756, 298, 197, 1, 10303, 756, 298, 197, 96946, 43, 960, 756, 298, 197, 1, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_split() { let sn = parse_line("[[[[0,7],4],[0,[0,0]]],[1,1]]"); sn.borrow().left_unwrap().borrow().right_unwrap().borrow().left_unwrap().borrow_mut().value = Some(15); sn.borrow().left_unwrap().borrow().right_unwrap().borrow().right_unwrap().borrow().right_unwrap().borrow_mut().value = Some(13); assert_eq!("[[[[0,7],4],[15,[0,13]]],[1,1]]", format!("{:?}", sn.borrow())); split(sn.clone()); split(sn.clone()); assert_eq!("[[[[0,7],4],[[7,8],[0,[6,7]]]],[1,1]]", format!("{:?}", sn.borrow())); }
rust_cleaned_test_functions.jsonl/51417
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 301 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 17052, 368, 341, 1789, 286, 1077, 4131, 284, 4715, 6528, 10937, 15505, 58, 15, 11, 22, 1125, 19, 14955, 15, 17259, 15, 11, 15, 5053, 14955, 16, 11, 16, 5053, 797, 286, 4131, 83640, 1005, 2359,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_binary_function_raw_column() { #[derive(Debug, Clone, Copy, RpnFunction)] #[rpn_function(args = 2)] struct FnFoo; impl FnFoo { fn call( _ctx: &mut EvalContext, _payload: RpnFnCallPayload<'_>, v1: &Option<i64>, v2: &Option<i64>, ) -> Result<Option<i64>> { Ok(Some(v1.unwrap() * v2.unwrap())) } } let mut columns = LazyBatchColumnVec::from(vec![{ let mut col = LazyBatchColumn::raw_with_capacity(3); let mut datum_raw = Vec::new(); DatumEncoder::encode(&mut datum_raw, &[Datum::I64(-5)], false).unwrap(); col.push_raw(&datum_raw); let mut datum_raw = Vec::new(); DatumEncoder::encode(&mut datum_raw, &[Datum::I64(-7)], false).unwrap(); col.push_raw(&datum_raw); let mut datum_raw = Vec::new(); DatumEncoder::encode(&mut datum_raw, &[Datum::I64(3)], false).unwrap(); col.push_raw(&datum_raw); col }]); let schema = &[FieldTypeTp::LongLong.into(), FieldTypeTp::LongLong.into()]; let exp = RpnExpressionBuilder::new() .push_column_ref(0) .push_column_ref(0) .push_fn_call(FnFoo, FieldTypeTp::LongLong) .build(); let mut ctx = EvalContext::default(); let result = exp.eval(&mut ctx, 3, schema, &mut columns); let val = result.unwrap(); assert!(val.is_vector()); assert_eq!( val.vector_value().unwrap().as_int_slice(), [Some(25), Some(49), Some(9)] ); assert_eq!(val.field_type().tp(), FieldTypeTp::LongLong); }
rust_cleaned_test_functions.jsonl/111589
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 970 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21296, 31761, 9174, 16067, 8744, 368, 341, 394, 11506, 27098, 42618, 11, 27913, 11, 14540, 11, 431, 19958, 5152, 5563, 286, 11506, 81, 19958, 9174, 7356, 284, 220, 17, 5563, 286, 2036, 50182, 4092...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_rpc_get_block_commitment() { let rpc = RpcHandler::start(); let expected_total_stake = 42; let mut block_0_commitment = BlockCommitment::default(); block_0_commitment.increase_confirmation_stake(2, 9); let _ = std::mem::replace( &mut *rpc.block_commitment_cache.write().unwrap(), BlockCommitmentCache::new( HashMap::from_iter(std::iter::once((0, block_0_commitment.clone()))), expected_total_stake, CommitmentSlots::new_from_slot(0), ), ); let request = create_test_request("getBlockCommitment", Some(json!([0u64]))); let result: RpcBlockCommitment<_> = parse_success_result(rpc.handle_request_sync(request)); let expected = RpcBlockCommitment { commitment: Some(block_0_commitment.commitment), total_stake: expected_total_stake, }; assert_eq!(result, expected); let request = create_test_request("getBlockCommitment", Some(json!([1u64]))); let result: Value = parse_success_result(rpc.handle_request_sync(request)); let expected = json!({ "commitment": null, "totalStake": expected_total_stake, }); assert_eq!(result, expected); }
rust_cleaned_test_functions.jsonl/6326
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 612 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 60799, 3062, 7113, 36346, 478, 368, 341, 286, 1077, 35596, 284, 79961, 3050, 486, 2468, 1428, 286, 1077, 3601, 10784, 1261, 726, 284, 220, 19, 17, 280, 286, 1077, 5206, 2504, 62, 15, 36346, 478,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_total() { let mut total_op = PreAggAdapter::new(Box::new(TotalDef::new( Expr::Column("count".to_string()), "_total".to_string(), ))); let agg = Aggregate::new( &["kc1".to_string(), "kc2".to_string()], "count".to_string(), &[ ( hashmap! { "kc1".to_string() => "k1".to_string(), "kc2".to_string() => "k2".to_string() }, Value::Int(100), ), ( hashmap! { "kc1".to_string() => "k300".to_string(), "kc2".to_string() => "k40000".to_string() }, Value::Int(500), ), ], ); total_op.process(Row::Aggregate(agg.clone())); let result = total_op.emit().data; assert_eq!(result[0].get("_total").unwrap(), &Value::from_float(100.0)); assert_eq!(result[1].get("_total").unwrap(), &Value::from_float(600.0)); assert_eq!(result.len(), 2); total_op.process(Row::Aggregate(agg.clone())); let result = total_op.emit().data; assert_eq!(result[0].get("_total").unwrap(), &Value::from_float(100.0)); assert_eq!(result[1].get("_total").unwrap(), &Value::from_float(600.0)); assert_eq!(result.len(), 2); }
rust_cleaned_test_functions.jsonl/31017
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 865 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10784, 368, 341, 286, 1077, 5206, 2790, 10287, 284, 4968, 9042, 70, 5940, 486, 931, 67758, 486, 931, 4140, 2370, 2620, 486, 931, 1006, 310, 28819, 486, 2933, 445, 1830, 3263, 983, 3904, 14702, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_resolving_with_dev_deps() { let reg = registry(vec![ pkg!("foo" => ["bar", dep_kind("baz", DepKind::Development)]), pkg!("baz" => ["bat", dep_kind("bam", DepKind::Development)]), pkg!("bar"), pkg!("bat"), ]); let res = resolve( vec![dep("foo"), dep_kind("baz", DepKind::Development)], &reg, ) .unwrap(); assert_same(&res, &names(&["root", "foo", "bar", "baz", "bat"])); }
rust_cleaned_test_functions.jsonl/46429
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 227 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4918, 19648, 6615, 10433, 76489, 368, 341, 262, 1077, 1217, 284, 19424, 25592, 90515, 286, 24793, 17223, 7975, 1, 589, 4383, 2257, 497, 2170, 33162, 445, 42573, 497, 4148, 10629, 486, 39419, 7252, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1