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_serialize() { let data_orig = Foo { field0: usize::MAX, field1: format!("FOO_{}", i128::MIN), }; let data = ArcSwap::from_pointee(data_orig.clone()); let data_str = serde_json::to_string(&data).unwrap(); let data_deser = serde_json::from_str::<Foo>(&data_str).unwrap(); assert_eq!(data_deser, data_orig); let data_orig = Bar { field0: ArcSwap::from_pointee(usize::MAX), field1: ArcSwapOption::from_pointee(format!("FOO_{}", i128::MIN)), }; let data_str = serde_json::to_string(&data_orig).unwrap(); let data_deser = serde_json::from_str::<Bar>(&data_str).unwrap(); assert_eq!(data_deser.field0.load_full(), data_orig.field0.load_full()); assert_eq!(data_deser.field1.load_full(), data_orig.field1.load_full()); let data_orig = Bar { field0: ArcSwap::from_pointee(usize::MAX), field1: ArcSwapOption::from_pointee(None), }; let data_str = serde_json::to_string(&data_orig).unwrap(); let data_deser = serde_json::from_str::<Bar>(&data_str).unwrap(); assert_eq!(data_deser.field0.load_full(), data_orig.field0.load_full()); assert_eq!(data_deser.field1.load_full(), data_orig.field1.load_full()); }
rust_cleaned_test_functions.jsonl/122518
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 646 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 88686, 368, 341, 286, 1077, 821, 35328, 284, 33428, 341, 310, 2070, 15, 25, 22301, 486, 10586, 345, 310, 2070, 16, 25, 3561, 17223, 3788, 46, 62, 42351, 600, 16, 17, 23, 486, 16413, 1326, 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_h2_body_chunked_explicit() { let openssl = ssl_acceptor().unwrap(); let mut srv = TestServer::new(move || { openssl .clone() .map_err(|e| println!("Openssl error: {}", e)) .and_then( HttpService::build() .h2(|_| { let body = once::<_, Error>(Ok(Bytes::from_static(STR.as_ref()))); ok::<_, ()>( Response::Ok() .header(header::TRANSFER_ENCODING, "chunked") .streaming(body), ) }) .map_err(|_| ()), ) }); let response = srv.block_on(srv.sget("/").send()).unwrap(); assert!(response.status().is_success()); assert!(!response.headers().contains_key(header::TRANSFER_ENCODING)); // read response let bytes = srv.load_body(response).unwrap(); // decode assert_eq!(bytes, Bytes::from_static(STR.as_ref())); }
rust_cleaned_test_functions.jsonl/102559
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 637 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1523, 17, 14114, 30539, 291, 14214, 6026, 368, 341, 262, 1077, 80733, 284, 33537, 35728, 269, 1005, 15454, 543, 262, 1077, 5206, 43578, 284, 3393, 5475, 486, 931, 34081, 1369, 341, 286, 80733, 198...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_squaring_consistency() { use rand::SeedableRng; let rng = &mut rand::prng::XorShiftRng::from_seed([0; 16]); for _ in 0..10_000 { // Create a value of magnitude 2 let mut a = Fp2::rand(rng); let mut b = a; a.mul_assign(&b); a.reduce_assign(); b.square_assign(); #[cfg(debug_assertions)] { assert_eq!(a.c0.magnitude, 2); assert_eq!(a.c1.magnitude, 2); assert_eq!(b.c0.magnitude, 2); assert_eq!(b.c1.magnitude, 2); } a.sub_assign_modulus::<typenum::U1>(); b.sub_assign_modulus::<typenum::U1>(); assert!(a == b); } }
rust_cleaned_test_functions.jsonl/100727
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 399 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 643, 446, 3249, 31971, 47094, 368, 341, 262, 990, 10382, 486, 41471, 480, 49, 968, 280, 262, 1077, 28422, 284, 609, 6984, 10382, 486, 649, 968, 486, 55, 269, 24841, 49, 968, 486, 1499, 33809, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_bn128_add() { // zero-points additions { let x1 = FromHex::from_hex( "0000000000000000000000000000000000000000000000000000000000000000" ).unwrap(); let y1 = FromHex::from_hex( "0000000000000000000000000000000000000000000000000000000000000000" ).unwrap(); let x2 = FromHex::from_hex( "0000000000000000000000000000000000000000000000000000000000000000" ).unwrap(); let y2 = FromHex::from_hex( "0000000000000000000000000000000000000000000000000000000000000000" ).unwrap(); let mut output = [0u8; 64]; let expected = FromHex::from_hex( "\ 0000000000000000000000000000000000000000000000000000000000000000\ 0000000000000000000000000000000000000000000000000000000000000000", ) .unwrap(); bn128_add(&x1, &y1, &x2, &y2, &mut output).expect("Builtin should not fail"); assert_eq!(output.to_vec(), expected); } // should fail - point not on curve { let x1 = FromHex::from_hex( "1111111111111111111111111111111111111111111111111111111111111111" ).unwrap(); let y1 = FromHex::from_hex( "1111111111111111111111111111111111111111111111111111111111111111" ).unwrap(); let x2 = FromHex::from_hex( "1111111111111111111111111111111111111111111111111111111111111111" ).unwrap(); let y2 = FromHex::from_hex( "1111111111111111111111111111111111111111111111111111111111111111" ).unwrap(); let mut output = [0u8; 64]; let res = bn128_add(&x1, &y1, &x2, &y2, &mut output); assert!(res.is_err(), "There should be built-in error here"); } }
rust_cleaned_test_functions.jsonl/103158
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 976 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 58112, 16, 17, 23, 2891, 368, 341, 286, 442, 7168, 92458, 37214, 198, 286, 341, 310, 1077, 856, 16, 284, 5542, 20335, 486, 1499, 32655, 1006, 394, 330, 15, 15, 15, 15, 15, 15, 15, 15, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_modify_sources() { let (mut runtime, state_snapshot, location) = setup( false, json!({ "target": "esnext", "module": "esnext", "lib": ["deno.ns", "deno.window"], "noEmit": true, }), &[( "file:///a.ts", r#" import * as a from "https://deno.land/x/example/a.ts"; if (a.a === "b") { console.log("fail"); } "#, 1, LanguageId::TypeScript, )], ); let cache = HttpCache::new(&location); let specifier_dep = resolve_url("https://deno.land/x/example/a.ts").unwrap(); cache .set( &specifier_dep, HeadersMap::default(), b"export const b = \"b\";\n", ) .unwrap(); let specifier = resolve_url("file:///a.ts").unwrap(); let result = request( &mut runtime, state_snapshot.clone(), RequestMethod::GetDiagnostics(vec![specifier]), ); assert!(result.is_ok()); let response = result.unwrap(); assert_eq!( response, json!({ "file:///a.ts": [ { "start": { "line": 2, "character": 16, }, "end": { "line": 2, "character": 17 }, "fileName": "file:///a.ts", "messageText": "Property \'a\' does not exist on type \'typeof import(\"https://deno.land/x/example/a\")\'.", "sourceLine": " if (a.a === \"b\") {", "code": 2339, "category": 1, } ] }) ); cache .set( &specifier_dep, HeadersMap::default(), b"export const b = \"b\";\n\nexport const a = \"b\";\n", ) .unwrap(); let specifier = resolve_url("file:///a.ts").unwrap(); let result = request( &mut runtime, state_snapshot, RequestMethod::GetDiagnostics(vec![specifier]), ); assert!(result.is_ok()); let response = result.unwrap(); assert_eq!( response, json!({ "file:///a.ts": [] }) ); }
rust_cleaned_test_functions.jsonl/23628
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1150 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 57725, 52896, 368, 341, 262, 1077, 320, 6984, 15592, 11, 1584, 53265, 11, 3728, 8, 284, 6505, 1006, 414, 895, 345, 414, 2951, 0, 2262, 286, 330, 5657, 788, 330, 288, 3600, 756, 286, 330, 4352,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_record_literal_field_default_completion() { check_edit( "..Default::default()", r#" //- minicore: default struct S { foo: u32, bar: usize } impl Default for S { fn default() -> Self { S { foo: 0, bar: 0, } } } fn process(f: S) { let other = S { foo: 5, .$0 }; } "#, r#" struct S { foo: u32, bar: usize } impl Default for S { fn default() -> Self { S { foo: 0, bar: 0, } } } fn process(f: S) { let other = S { foo: 5, ..Default::default() }; } "#, ); }
rust_cleaned_test_functions.jsonl/39742
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 396 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14192, 34100, 5013, 9993, 60164, 368, 341, 286, 1779, 13156, 1006, 310, 32213, 3675, 486, 2258, 368, 756, 310, 435, 2, 698, 61463, 1308, 292, 460, 25, 1638, 198, 1235, 328, 314, 15229, 25, 575, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_validate_query_string() { let request = Request::builder() .uri("/foo?a=b&c&d=efg&hello=a%20b") .body(()) .unwrap(); validate_query_string(&request, &["a=b"]).expect("a=b is in the query string"); validate_query_string(&request, &["c", "a=b"]) .expect("both params are in the query string"); validate_query_string(&request, &["a=b", "c", "d=efg", "hello=a%20b"]) .expect("all params are in the query string"); validate_query_string(&request, &[]).expect("no required params should pass"); validate_query_string(&request, &["a"]).expect_err("no parameter should match"); validate_query_string(&request, &["a=bc"]).expect_err("no parameter should match"); validate_query_string(&request, &["a=bc"]).expect_err("no parameter should match"); validate_query_string(&request, &["hell=a%20"]).expect_err("no parameter should match"); }
rust_cleaned_test_functions.jsonl/12131
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 419 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 42681, 5738, 3904, 368, 341, 286, 1077, 1681, 284, 6145, 486, 17850, 741, 310, 659, 6070, 4283, 7975, 98461, 22086, 5, 66, 5, 67, 28, 823, 70, 5, 14990, 24239, 4, 17, 15, 65, 1138, 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_call_hierarchy_in_different_fn() { check_hierarchy( r#" //- /lib.rs fn callee() {} fn caller1() { call<|>ee(); } fn caller2() { callee(); } "#, "callee FN_DEF FileId(1) [0; 14) [3; 9)", &[ "caller1 FN_DEF FileId(1) [15; 45) [18; 25) : [[34; 40)]", "caller2 FN_DEF FileId(1) [46; 76) [49; 56) : [[65; 71)]", ], &[], ); }
rust_cleaned_test_functions.jsonl/35203
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 386 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13429, 95043, 1243, 82741, 15246, 368, 341, 286, 1779, 95043, 1006, 310, 435, 2, 698, 310, 78406, 608, 2740, 25638, 198, 310, 5168, 94800, 368, 5613, 310, 5168, 19865, 16, 368, 341, 394, 1618, 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_column_id_6() { assert_eq!(column_id_rec(100), "VVVV"); assert_eq!(column_id_iter(100), "VVVV"); }
rust_cleaned_test_functions.jsonl/20647
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 69 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8744, 842, 62, 21, 368, 341, 262, 2060, 10714, 10297, 6229, 842, 7080, 7, 16, 15, 15, 701, 330, 67707, 67707, 797, 262, 2060, 10714, 10297, 6229, 842, 11723, 7, 16, 15, 15, 701, 330, 67707, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_prefetch() { let mut mock = mock::Mock::default(); let mut ctx = mock.create_ctx(); let auth_info = transaction::AuthInfo { signer_info: vec![transaction::SignerInfo::new_sigspec( keys::alice::sigspec(), 0, )], fee: transaction::Fee { amount: Default::default(), gas: 1000, consensus_messages: 1, }, }; // Test withdraw. let tx = transaction::Transaction { version: 1, call: transaction::Call { format: transaction::CallFormat::Plain, method: "consensus.Withdraw".to_owned(), body: cbor::to_value(Withdraw { // separate `to` account to make sure everything is hooked up to the right places. to: Some(keys::bob::address()), amount: BaseUnits::new(1_000, Denomination::NATIVE), }), }, auth_info: auth_info.clone(), }; // Withdraw should result in one prefix getting prefetched. ctx.with_tx(0, tx, |mut _tx_ctx, call| { let mut prefixes = BTreeSet::new(); let result = Module::<Accounts, Consensus>::prefetch( &mut prefixes, &call.method, call.body, &auth_info, ) .ok_or(anyhow!("dispatch failure")) .expect("prefetch should succeed"); assert!(matches!(result, Ok(()))); assert_eq!(prefixes.len(), 1, "there should be 1 prefix to be fetched"); }); // Test deposit. let tx = transaction::Transaction { version: 1, call: transaction::Call { format: transaction::CallFormat::Plain, method: "consensus.Deposit".to_owned(), body: cbor::to_value(Deposit { // separate `to` account to make sure everything is hooked up to the right places. to: Some(keys::bob::address()), amount: BaseUnits::new(1_000, Denomination::NATIVE), }), }, auth_info: auth_info.clone(), }; // Deposit should result in zero prefixes. ctx.with_tx(0, tx, |mut _tx_ctx, call| { let mut prefixes = BTreeSet::new(); let result = Module::<Accounts, Consensus>::prefetch( &mut prefixes, &call.method, call.body, &auth_info, ) .ok_or(anyhow!("dispatch failure")) .expect("prefetch should succeed"); assert!(matches!(result, Ok(()))); assert_eq!( prefixes.len(), 0, "there should be 0 prefixes to be fetched" ); }); }
rust_cleaned_test_functions.jsonl/52603
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1331 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 43331, 2995, 368, 341, 262, 1077, 5206, 7860, 284, 7860, 486, 11571, 486, 2258, 543, 262, 1077, 5206, 5635, 284, 7860, 2520, 15147, 1428, 262, 1077, 4166, 3109, 284, 7745, 486, 5087, 1731, 341, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_std_cursor() { let mut cursor = Cursor::<&[u8]>::new(&[5, 10]); let foo: Foo = bincode::decode_from_std_read(&mut cursor, Configuration::standard()).unwrap(); assert_eq!(foo.a, 5); assert_eq!(foo.b, 10); }
rust_cleaned_test_functions.jsonl/85309
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 111 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15656, 28601, 368, 341, 262, 1077, 5206, 8128, 284, 28067, 27638, 5, 58, 84, 23, 60, 6831, 931, 2099, 58, 20, 11, 220, 16, 15, 2558, 262, 1077, 15229, 25, 33428, 284, 9544, 1851, 486, 18196, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_bank_epoch_vote_accounts() { let leader_id = Pubkey::new_rand(); let leader_lamports = 3; let (mut genesis_block, _) = GenesisBlock::new_with_leader(5, &leader_id, leader_lamports); const SLOTS_PER_EPOCH: u64 = 8; const STAKERS_SLOT_OFFSET: u64 = 21; genesis_block.slots_per_epoch = SLOTS_PER_EPOCH; genesis_block.stakers_slot_offset = STAKERS_SLOT_OFFSET; genesis_block.epoch_warmup = false; // allows me to do the normal division stuff below let parent = Arc::new(Bank::new(&genesis_block)); let vote_accounts0: Option<HashMap<_, _>> = parent.epoch_vote_accounts(0).map(|accounts| { accounts .iter() .filter_map(|(pubkey, account)| { if let Ok(vote_state) = VoteState::deserialize(&account.data) { if vote_state.node_id == leader_id { Some((*pubkey, true)) } else { None } } else { None } }) .collect() }); assert!(vote_accounts0.is_some()); assert!(vote_accounts0.iter().len() != 0); let mut i = 1; loop { if i > STAKERS_SLOT_OFFSET / SLOTS_PER_EPOCH { break; } assert!(parent.epoch_vote_accounts(i).is_some()); i += 1; } // child crosses epoch boundary and is the first slot in the epoch let child = Bank::new_from_parent( &parent, &leader_id, SLOTS_PER_EPOCH - (STAKERS_SLOT_OFFSET % SLOTS_PER_EPOCH), ); assert!(child.epoch_vote_accounts(i).is_some()); // child crosses epoch boundary but isn't the first slot in the epoch let child = Bank::new_from_parent( &parent, &leader_id, SLOTS_PER_EPOCH - (STAKERS_SLOT_OFFSET % SLOTS_PER_EPOCH) + 1, ); assert!(child.epoch_vote_accounts(i).is_some()); }
rust_cleaned_test_functions.jsonl/41905
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1188 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 35733, 20682, 54360, 55665, 368, 341, 286, 1077, 7653, 842, 284, 22611, 792, 486, 931, 33864, 543, 286, 1077, 7653, 907, 309, 3394, 284, 220, 18, 280, 286, 1077, 320, 6984, 59366, 7113, 11, 2743...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
4
#[test] fn test_syscall() { test_interpreter_and_jit_asm!( " mov64 r1, 0xAA mov64 r2, 0xBB mov64 r3, 0xCC mov64 r4, 0xDD mov64 r5, 0xEE syscall BpfSyscallU64 mov64 r0, 0x0 exit", [], ( b"BpfSyscallU64" => syscalls::BpfSyscallU64::call; syscalls::BpfSyscallU64 {}, ), { |_vm, res: Result| { res.unwrap() == 0 } }, 8 ); }
rust_cleaned_test_functions.jsonl/59048
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 289 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 20344, 6659, 368, 341, 262, 1273, 15318, 28637, 8378, 5374, 275, 67529, 33673, 286, 6228, 286, 1974, 21, 19, 435, 16, 11, 220, 15, 60051, 198, 286, 1974, 21, 19, 435, 17, 11, 220, 15, 80197, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_clean_first() { let mut index = AccountsIndex::<bool>::default(); index.add_root(0); index.add_root(1); index.clean_dead_slot(0); assert!(index.is_root(1)); assert!(!index.is_root(0)); }
rust_cleaned_test_functions.jsonl/20858
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 134 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 19573, 12978, 368, 341, 286, 1077, 5206, 1922, 284, 40655, 1552, 27638, 2641, 6831, 2258, 543, 286, 1922, 1364, 12993, 7, 15, 317, 286, 1922, 1364, 12993, 7, 16, 317, 286, 1922, 25237, 53427, 27...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_match_group_in_subtree() { check( r#" macro_rules! m { (fn $name:ident { $($i:ident)* } ) => ( fn $name() { $($i ();)* } ); } m! { fn baz { a b } } "#, expect![[r#" macro_rules! m { (fn $name:ident { $($i:ident)* } ) => ( fn $name() { $($i ();)* } ); } fn baz() { a(); b(); } "#]], ) }
rust_cleaned_test_functions.jsonl/85209
{ "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, 10708, 6288, 1243, 5228, 9344, 368, 341, 262, 1779, 1006, 286, 435, 2, 698, 32606, 21407, 0, 296, 341, 262, 320, 8822, 400, 606, 25, 1713, 314, 93977, 72, 25, 1713, 4806, 335, 873, 589, 320, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_that_csharp_code_compiles_and_demo_runs() { let registry = get_aptos_registry(); let abis = get_stdlib_script_abis(); // Special case this because of what the default tempdir is on a mac // It looks as if the path string might be too long for the dotnet runtime // to execute correctly because you get funny errors that don't occur when // Avoids this: if std::env::consts::OS == "macos" { std::env::set_var("TMPDIR", "/private/tmp/"); } let dir = tempdir().unwrap(); let paths = std::fs::read_dir("examples/csharp/custom_aptos_code") .unwrap() .map(|e| e.unwrap().path()); let config = serdegen::CodeGeneratorConfig::new("Aptos.Types".to_string()) .with_encodings(vec![serdegen::Encoding::Bcs]) .with_custom_code(buildgen::read_custom_code_from_paths( &["Aptos", "Types"], paths, )); let bcs_installer = serdegen::csharp::Installer::new(dir.path().to_path_buf()); bcs_installer.install_module(&config, &registry).unwrap(); bcs_installer.install_serde_runtime().unwrap(); bcs_installer.install_bcs_runtime().unwrap(); let abi_installer = buildgen::csharp::Installer::new(dir.path().to_path_buf()); abi_installer .install_transaction_builders("Aptos.Stdlib", &abis) .unwrap(); std::fs::create_dir(dir.path().join("Demo")).unwrap(); std::fs::copy( "examples/csharp/StdlibDemo.cs", dir.path().join("Demo/StdlibDemo.cs"), ) .unwrap(); let status = Command::new("dotnet") .arg("new") .arg("classlib") .arg("-n") .arg("Aptos.Stdlib") .arg("-o") .arg(dir.path().join("Aptos/Stdlib")) .status() .unwrap(); assert!(status.success()); let status = Command::new("rm") .arg(dir.path().join("Aptos/Stdlib/Class1.cs")) .status() .unwrap(); assert!(status.success()); let status = Command::new("dotnet") .arg("add") .arg(dir.path().join("Aptos/Stdlib/Aptos.Stdlib.csproj")) .arg("reference") .arg(dir.path().join("Aptos/Types/Aptos.Types.csproj")) .status() .unwrap(); assert!(status.success()); let status = Command::new("dotnet") .arg("new") .arg("sln") .arg("-n") .arg("Demo") .arg("-o") .arg(dir.path().join("Demo")) .status() .unwrap(); assert!(status.success()); let status = Command::new("dotnet") .arg("new") .arg("console") .arg("-n") .arg("Demo") .arg("-o") .arg(dir.path().join("Demo")) .status() .unwrap(); assert!(status.success()); let status = Command::new("rm") .arg(dir.path().join("Demo/Program.cs")) .status() .unwrap(); assert!(status.success()); let status = Command::new("dotnet") .arg("add") .arg(dir.path().join("Demo/Demo.csproj")) .arg("reference") .arg(dir.path().join("Aptos/Stdlib/Aptos.Stdlib.csproj")) .status() .unwrap(); assert!(status.success()); let status = Command::new("dotnet") .arg("add") .arg(dir.path().join("Demo/Demo.csproj")) .arg("reference") .arg(dir.path().join("Aptos/Types/Aptos.Types.csproj")) .status() .unwrap(); assert!(status.success()); let status = Command::new("dotnet") .arg("add") .arg(dir.path().join("Demo/Demo.csproj")) .arg("reference") .arg(dir.path().join("Serde/Serde.csproj")) .status() .unwrap(); assert!(status.success()); let status = Command::new("dotnet") .arg("add") .arg(dir.path().join("Demo/Demo.csproj")) .arg("reference") .arg(dir.path().join("Bcs/Bcs.csproj")) .status() .unwrap(); assert!(status.success()); let status = Command::new("dotnet") .arg("build") .arg(dir.path().join("Demo/Demo.csproj")) .status() .unwrap(); assert!(status.success()); let output = Command::new("dotnet") .arg("run") .arg("--project") .arg(dir.path().join("Demo/Demo.csproj")) .output() .unwrap(); assert_eq!(std::str::from_utf8(&output.stderr).unwrap(), String::new()); assert_eq!( std::str::from_utf8(&output.stdout).unwrap(), EXPECTED_OUTPUT ); assert!(output.status.success()); }
rust_cleaned_test_functions.jsonl/15230
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2205 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 70197, 666, 52917, 4136, 18177, 3658, 8378, 47830, 67352, 368, 341, 262, 1077, 19424, 284, 633, 62, 2689, 436, 50650, 543, 262, 1077, 668, 285, 284, 633, 15656, 2740, 14660, 62, 15367, 543, 262, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_cycle_string_up() { let cxx = indoc! {" std::unique_ptr<std::string> give_str_up() { return std::make_unique<std::string>(\"Bob\"); } uint32_t take_str_up(std::unique_ptr<std::string> a) { return a->length(); } "}; let hdr = indoc! {" #include <memory> #include <string> #include <cstdint> std::unique_ptr<std::string> give_str_up(); uint32_t take_str_up(std::unique_ptr<std::string> a); "}; let rs = quote! { let s = ffi::give_str_up(); assert_eq!(ffi::take_str_up(s), 3); }; run_test(cxx, hdr, rs, &["give_str_up", "take_str_up"], &[]); }
rust_cleaned_test_functions.jsonl/9724
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 367 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 39079, 3904, 8237, 368, 341, 262, 1077, 272, 4146, 284, 1257, 509, 0, 314, 698, 286, 1460, 486, 9587, 4348, 8050, 486, 917, 29, 2968, 2895, 8237, 368, 341, 310, 470, 1460, 486, 6927, 21218, 80...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_arguments_others() { parses!("-c", "foo.c", "-B", "somewhere", "-o", "foo.o"); parses!("-c", "foo.c", "-target", "x86_64-apple-darwin11", "-o", "foo.o"); parses!("-c", "foo.c", "-gcc-toolchain", "somewhere", "-o", "foo.o"); }
rust_cleaned_test_functions.jsonl/57612
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 147 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 43433, 14179, 2985, 368, 341, 286, 70835, 0, 13645, 66, 497, 330, 7975, 520, 497, 6523, 33, 497, 330, 56739, 60652, 497, 6523, 78, 497, 330, 7975, 14439, 797, 286, 70835, 0, 13645, 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_canonical_string_encoding() { assert_ne!( Rlp::new(&[0xc0 + 4, 0xb7 + 1, 2, b'a', b'b']).val_at::<String>(0), Rlp::new(&[0xc0 + 3, 0x82, b'a', b'b']).val_at::<String>(0) ); assert_eq!( Rlp::new(&[0xc0 + 4, 0xb7 + 1, 2, b'a', b'b']).val_at::<String>(0), Err(DecoderError::RlpInvalidIndirection) ); }
rust_cleaned_test_functions.jsonl/74213
{ "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, 27421, 22391, 3904, 37613, 368, 341, 6948, 13925, 33673, 197, 11143, 13545, 486, 931, 2099, 58, 15, 8148, 15, 488, 220, 19, 11, 220, 15, 7929, 22, 488, 220, 16, 11, 220, 17, 11, 293, 25184, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_fromstr() { assert_eq!(parse_non_empty::<InlinableString>(""), None); assert_eq!(parse_non_empty::<u8>("10"), Some(10u8)); assert_eq!( parse_non_empty::<InlinableString>("foo"), Some(InlinableString::from("foo")) ); }
rust_cleaned_test_functions.jsonl/109726
{ "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, 495, 368, 341, 286, 2060, 10714, 10297, 6400, 21637, 15124, 27638, 641, 3732, 480, 703, 13211, 3975, 2240, 317, 286, 2060, 10714, 10297, 6400, 21637, 15124, 27638, 84, 23, 13211, 16, 15, 397...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_unpruned_leaf_iter() { let pl = PruneList::empty(); assert_eq!( pl.unpruned_leaf_iter(8).collect::<Vec<_>>(), [1, 2, 4, 5, 8] ); let mut pl = PruneList::empty(); pl.add(2); assert_eq!(pl.iter().collect::<Vec<_>>(), [2]); assert_eq!(pl.pruned_bintree_range_iter().collect::<Vec<_>>(), [2..3]); assert_eq!(pl.unpruned_leaf_iter(5).collect::<Vec<_>>(), [1, 4, 5]); let mut pl = PruneList::empty(); pl.add(2); pl.add(4); pl.add(5); assert_eq!(pl.iter().collect::<Vec<_>>(), [2, 6]); assert_eq!( pl.pruned_bintree_range_iter().collect::<Vec<_>>(), [2..3, 4..7] ); assert_eq!(pl.unpruned_leaf_iter(9).collect::<Vec<_>>(), [1, 8, 9]); }
rust_cleaned_test_functions.jsonl/24001
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 339 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4907, 649, 48883, 38909, 11723, 368, 341, 10217, 625, 284, 2340, 2886, 852, 486, 3194, 543, 6948, 10714, 33673, 197, 72213, 6307, 649, 48883, 38909, 11723, 7, 23, 568, 17384, 27638, 10050, 32399, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_modified_etag() { let etag = ETag::from_static("\"xyzzy\""); let if_range = IfRange::etag(etag.clone()); assert!(!if_range.is_modified(Some(&etag), None)); let etag = ETag::from_static("W/\"xyzzy\""); assert!(if_range.is_modified(Some(&etag), None)); }
rust_cleaned_test_functions.jsonl/89510
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 154 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6892, 37749, 45668, 351, 368, 341, 286, 1077, 1842, 351, 284, 468, 5668, 486, 1499, 25360, 38915, 28854, 4246, 88385, 286, 1077, 421, 9698, 284, 1416, 6046, 486, 80465, 76222, 351, 15997, 5231, 28...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_setup_and_prove_custom_gate_and_tables() { use crate::pairing::bn256::{Bn256, Fr}; use crate::worker::Worker; use crate::plonk::better_better_cs::verifier::*; use crate::plonk::better_better_cs::setup::VerificationKey; let mut assembly = SetupAssembly::<Bn256, PlonkCsWidth4WithNextStepParams, Width4MainGateWithDNext>::new(); let circuit = TestCircuit4WithLookups::<Bn256> { _marker: PhantomData }; circuit.synthesize(&mut assembly).expect("must work"); println!("Assembly contains {} gates", assembly.n()); assert!(assembly.is_satisfied()); assembly.finalize(); println!("Finalized assembly contains {} gates", assembly.n()); let worker = Worker::new(); let setup = assembly.create_setup::<TestCircuit4WithLookups<Bn256>>(&worker).unwrap(); let mut assembly = ProvingAssembly::<Bn256, PlonkCsWidth4WithNextStepParams, Width4MainGateWithDNext>::new(); circuit.synthesize(&mut assembly).expect("must work"); assembly.finalize(); let size = assembly.n().next_power_of_two(); use crate::plonk::commitments::transcript::keccak_transcript::RollingKeccakTranscript; use crate::kate_commitment::*; let crs_mons = Crs::<Bn256, CrsForMonomialForm>::crs_42(size, &worker); let proof = assembly.create_proof::<TestCircuit4WithLookups<Bn256>, RollingKeccakTranscript<Fr>>( &worker, &setup, &crs_mons, None ).unwrap(); let vk = VerificationKey::from_setup(&setup, &worker, &crs_mons).unwrap(); let valid = verify::<Bn256, TestCircuit4WithLookups<Bn256>, RollingKeccakTranscript<Fr>>( &vk, &proof, None, ).unwrap(); assert!(valid); }
rust_cleaned_test_functions.jsonl/78086
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 833 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21363, 8378, 2540, 586, 15875, 54798, 8378, 35632, 368, 341, 286, 990, 17717, 486, 12670, 287, 486, 11081, 17, 20, 21, 22964, 33, 77, 17, 20, 21, 11, 2869, 2440, 286, 990, 17717, 486, 21462, 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_parse_rest_vars() { let q = "[1, 2, *x] = [*rest]"; assert_eq!(parse_query(q).to_polar(), q); assert!(matches!( super::parse_query(0, "[1, 2, 3] = [*rest, 3]").expect_err("parse error"), error::PolarError { kind: error::ErrorKind::Parse(error::ParseError::UnrecognizedToken { .. }), .. } )); assert!(matches!( super::parse_query(0, "[1, 2, *3] = [*rest]").expect_err("parse error"), error::PolarError { kind: error::ErrorKind::Parse(error::ParseError::UnrecognizedToken { .. }), .. } )); assert!(matches!( super::parse_query(0, "[1, *x, *y] = [*rest]").expect_err("parse error"), error::PolarError { kind: error::ErrorKind::Parse(error::ParseError::UnrecognizedToken { .. }), .. } )); let q = "[1, 2, 3] matches [1, 2, 3]"; assert_eq!(parse_query(q).to_polar(), q, "{} -- {}", q, parse_query(q)); let q = "[1, 2, 3] matches [1, *rest]"; assert_eq!(parse_query(q).to_polar(), q, "{} -- {}", q, parse_query(q)); }
rust_cleaned_test_functions.jsonl/12195
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 669 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 32231, 11168, 368, 341, 286, 1077, 2804, 284, 10545, 16, 11, 220, 17, 11, 353, 87, 60, 284, 60974, 3927, 59757, 286, 2060, 10714, 10297, 6400, 5738, 10583, 568, 983, 620, 7417, 1507, 2804...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_bad_address_values() { // Take the lock so changing the environment doesn't cause races. let _env_lock = ENV_LOCK.lock().unwrap(); env::remove_var(CONFIG_ENV); assert!(RocketConfig::parse(r#" [development] address = 0000 "#.to_string(), TEST_CONFIG_FILENAME).is_err()); assert!(RocketConfig::parse(r#" [development] address = true "#.to_string(), TEST_CONFIG_FILENAME).is_err()); assert!(RocketConfig::parse(r#" [development] address = "........" "#.to_string(), TEST_CONFIG_FILENAME).is_err()); assert!(RocketConfig::parse(r#" [staging] address = "1.2.3.4:100" "#.to_string(), TEST_CONFIG_FILENAME).is_err()); }
rust_cleaned_test_functions.jsonl/35239
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 408 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 34199, 6744, 9146, 368, 341, 286, 442, 11778, 279, 5296, 773, 10018, 279, 4573, 3171, 944, 5240, 20588, 624, 286, 1077, 716, 3160, 9818, 284, 32791, 27661, 21003, 1005, 15454, 543, 286, 6105, 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_simple_cycles() { assert_eq!(collect::collect_thread_cycles(), 0); { let a: Cc<RefCell<Vec<Box<dyn Trace>>>> = Cc::new(RefCell::new(Vec::new())); let b: Cc<RefCell<Vec<Box<dyn Trace>>>> = Cc::new(RefCell::new(Vec::new())); assert_eq!(collect::collect_thread_cycles(), 0); { let mut a = a.borrow_mut(); a.push(Box::new(b.clone())); } { let mut b = b.borrow_mut(); b.push(Box::new(a.clone())); } assert_eq!(collect::collect_thread_cycles(), 0); assert_eq!(collect::count_thread_tracked(), 2); } assert_eq!(collect::collect_thread_cycles(), 2); assert_eq!(collect::count_thread_tracked(), 0); }
rust_cleaned_test_functions.jsonl/76046
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 377 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 30015, 68970, 368, 341, 262, 2060, 10714, 10297, 17384, 486, 17384, 10814, 68970, 1507, 220, 15, 317, 262, 341, 286, 1077, 264, 25, 356, 66, 27, 3945, 3599, 50439, 79852, 92846, 27163, 18153, 284,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_signed_with_a_passphrase() { network::set(Network::Devnet); let fixture = json_transaction("timelock_transfer", "passphrase"); let serialized = fixture["serialized"].as_str().unwrap(); let transaction = deserializer::deserialize(&serialized); let actual = serializer::serialize(&transaction); assert_eq!(actual, serialized); }
rust_cleaned_test_functions.jsonl/35143
{ "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, 55617, 6615, 4306, 15464, 27710, 368, 341, 262, 3922, 486, 746, 77623, 486, 14592, 4711, 626, 262, 1077, 12507, 284, 2951, 28884, 445, 20091, 301, 1176, 35403, 497, 330, 6385, 27710, 797, 262, 107...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_map_single_func_consuming() { let h = hlist![9000, 9001, 9002]; let mapped = h.map(|v| v + 1); assert_eq!(mapped, hlist![9001, 9002, 9003]); }
rust_cleaned_test_functions.jsonl/24762
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 103 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5376, 19487, 9596, 3382, 61117, 368, 341, 286, 1077, 305, 284, 305, 1607, 20703, 24, 15, 15, 15, 11, 220, 24, 15, 15, 16, 11, 220, 24, 15, 15, 17, 935, 286, 1077, 23844, 284, 305, 4770, 22...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_nested_lists() { // Construct column schema let message_type = " message table { REPEATED group table_info { REQUIRED BYTE_ARRAY name; REPEATED group cols { REQUIRED BYTE_ARRAY name; REQUIRED INT32 type; OPTIONAL INT32 length; } REPEATED group tags { REQUIRED BYTE_ARRAY name; REQUIRED INT32 type; OPTIONAL INT32 length; } } } "; let schema = parse_message_type(message_type) .map(|t| Arc::new(SchemaDescriptor::new(Arc::new(t)))) .unwrap(); let arrow_schema = parquet_to_arrow_schema(schema.as_ref(), None).unwrap(); let file = tempfile::tempfile().unwrap(); let props = WriterProperties::builder() .set_max_row_group_size(200) .build(); let writer = ArrowWriter::try_new( file.try_clone().unwrap(), Arc::new(arrow_schema), Some(props), ) .unwrap(); writer.close().unwrap(); let file_reader: Arc<dyn FileReader> = Arc::new(SerializedFileReader::new(file).unwrap()); let file_metadata = file_reader.metadata().file_metadata(); let arrow_schema = parquet_to_arrow_schema( file_metadata.schema_descr(), file_metadata.key_value_metadata(), ) .unwrap(); let schema = file_metadata.schema_descr_ptr(); let mask = ProjectionMask::leaves(&schema, vec![0]); let mut array_reader = build_array_reader( schema, Arc::new(arrow_schema), mask, Box::new(file_reader), ) .unwrap(); let batch = array_reader.next_batch(100).unwrap(); assert_eq!(batch.data_type(), array_reader.get_data_type()); assert_eq!( batch.data_type(), &ArrowType::Struct(vec![Field::new( "table_info", ArrowType::List(Box::new(Field::new( "table_info", ArrowType::Struct(vec![Field::new("name", ArrowType::Binary, false)]), false ))), false )]) ); assert_eq!(batch.len(), 0); }
rust_cleaned_test_functions.jsonl/108170
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1332 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 66279, 37288, 368, 341, 286, 442, 18678, 3250, 10802, 198, 286, 1077, 1943, 1819, 284, 6228, 286, 1943, 1965, 341, 310, 3596, 1740, 9005, 1874, 1965, 3109, 341, 394, 66577, 35377, 17724, 829, 280,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_shorthand_flag() { equal_tokens! { <nodes> "-katz" -> b::token_list(vec![b::shorthand("katz")]) } }
rust_cleaned_test_functions.jsonl/5863
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 102 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3712, 61679, 10933, 368, 341, 286, 6144, 28838, 0, 341, 310, 366, 20008, 397, 310, 6523, 74, 20175, 1, 1464, 293, 486, 5839, 2019, 25592, 20703, 65, 486, 927, 61679, 445, 74, 20175, 899, 2546, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_utf8_array_agg() -> Result<()> { let array = DFUtf8Array::new_from_slice(&vec!["h", "e", "l", "o"]); let value = [ array.max()?, array.min()?, array.arg_min()?, array.arg_max()?, ]; let expected = [ DataValue::Utf8(Some("o".to_string())), DataValue::Utf8(Some("e".to_string())), DataValue::Struct(vec![ DataValue::UInt64(Some(1)), DataValue::Utf8(Some("e".to_string())), ]), DataValue::Struct(vec![ DataValue::UInt64(Some(3)), DataValue::Utf8(Some("o".to_string())), ]), ]; let len = value.len(); for i in 0..len { assert_eq!(value[i], expected[i]); } Ok(()) }
rust_cleaned_test_functions.jsonl/19223
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 402 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 39453, 23, 3858, 83534, 368, 1464, 5714, 71698, 341, 262, 1077, 1334, 284, 43376, 38980, 23, 1857, 486, 931, 5673, 26488, 2099, 4083, 0, 1183, 71, 497, 330, 68, 497, 330, 75, 497, 330, 78, 559...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_mmap_region_from_file() { let mut f = TempFile::new().unwrap().into_file(); let offset: usize = 0; let buf1 = [1u8, 2, 3, 4, 5]; f.write_all(buf1.as_ref()).unwrap(); let r = MmapRegion::from_file(FileOffset::new(f, offset as u64), buf1.len()).unwrap(); assert_eq!(r.size(), buf1.len() - offset); assert_eq!(r.file_offset().unwrap().start(), offset as u64); assert_eq!(r.prot(), libc::PROT_READ | libc::PROT_WRITE); assert_eq!(r.flags(), libc::MAP_NORESERVE | libc::MAP_SHARED); let buf2 = unsafe { slice::from_raw_parts(r.as_ptr(), buf1.len() - offset) }; assert_eq!(&buf1[offset..], buf2); }
rust_cleaned_test_functions.jsonl/38
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 342 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 717, 2186, 20627, 5673, 2458, 368, 341, 286, 1077, 5206, 282, 284, 19944, 1703, 486, 931, 1005, 15454, 1005, 18122, 2458, 543, 286, 1077, 4347, 25, 22301, 284, 220, 15, 280, 286, 1077, 6607, 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_unfit() { let haystack = "111 a 111b"; let needle = "111 a 1111"; let r = my_naive_opt_mc_1st(haystack, needle); assert_eq!(r, None); }
rust_cleaned_test_functions.jsonl/112059
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 104 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4907, 6276, 368, 341, 286, 1077, 88447, 284, 330, 16, 16, 16, 264, 220, 16, 16, 16, 65, 876, 286, 1077, 30309, 284, 330, 16, 16, 16, 264, 220, 16, 16, 16, 16, 876, 286, 1077, 435, 284, 8...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_parse_response_code() { let url = "http://localhost:8888/callback?code=AQD0yXvFEOvw&state=sN#_=_"; let spotify = SpotifyBuilder::default().build().unwrap(); let code = spotify.parse_response_code(url).unwrap(); assert_eq!(code, "AQD0yXvFEOvw"); }
rust_cleaned_test_functions.jsonl/105279
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 145 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 9655, 4136, 368, 341, 286, 1077, 2515, 284, 330, 1254, 1110, 8301, 25, 23, 23, 23, 23, 91527, 30, 1851, 46623, 48, 35, 15, 88, 55, 85, 37, 6760, 34431, 5, 2454, 14149, 45, 2, 62, 20...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_exchange_code_successful_with_basic_auth() { let mock = mock("POST", "/token") .match_header("Accept", "application/json") .match_header("Authorization", "Basic YWFhOmJiYg==") .match_body( "grant_type=authorization_code&code=ccc&redirect_uri=http%3A%2F%2Fredirect%2Fhere" ) .with_body( "{\"access_token\": \"12/34\", \"token_type\": \"bearer\", \"scope\": \"read write\"}" ) .create(); let client = new_mock_client() .set_auth_type(oauth2::AuthType::BasicAuth) .set_redirect_url(RedirectUrl::new( Url::parse("http://redirect/here").unwrap(), )); let token = client .exchange_code(AuthorizationCode::new("ccc".to_string())) .unwrap(); mock.assert(); assert_eq!("12/34", token.access_token().secret()); assert_eq!(BasicTokenType::Bearer, *token.token_type()); assert_eq!( Some(&vec![ Scope::new("read".to_string()), Scope::new("write".to_string()), ]), token.scopes() ); assert_eq!(None, token.expires_in()); assert_eq!(None, token.refresh_token()); }
rust_cleaned_test_functions.jsonl/12774
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 567 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 59212, 4136, 92951, 6615, 34729, 14014, 368, 341, 262, 1077, 7860, 284, 7860, 445, 2946, 497, 3521, 5839, 1138, 286, 659, 6347, 8757, 445, 16646, 497, 330, 5132, 8931, 1138, 286, 659, 6347, 8757, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_fetch_crate_name_for_source_file() { let current_file = format!("../{}", file!()); let path = PathBuf::from(current_file); let crate_name = fetch_crate_name_for_source_file(&path).unwrap(); assert_eq!(crate_name, "typebinder") }
rust_cleaned_test_functions.jsonl/82243
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 132 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11803, 666, 7698, 1269, 5478, 10347, 2458, 368, 341, 286, 1077, 1482, 2458, 284, 3561, 17223, 1244, 42351, 1034, 0, 1423, 286, 1077, 1815, 284, 7933, 15064, 486, 1499, 8762, 2458, 317, 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_rewrite_port_nodes() { let bulk_string = b"b5657714579550445f271ff65e47f3d39a36806c :0@0 slave,noaddr 95566d2da3382ea88f549ab5766db9a6f4fbc44b 1634273478445 1634273478445 1 disconnected 95566d2da3382ea88f549ab5766db9a6f4fbc44b :0@0 master,noaddr - 1634273478445 1634273478445 1 disconnected 0-5460 c852007a1c3b726534e6866456c1f2002fc442d9 172.31.0.6:6379@16379 myself,master - 0 1634273501000 3 connected 10923-16383 847c2efa4f5dcbca969f30a903ee54c5deb285f6 172.31.0.5:6379@16379 slave 2ee0e46acaec3fcb09fdff3ced0c267ffa2b78d3 0 1634273501428 2 connected 2ee0e46acaec3fcb09fdff3ced0c267ffa2b78d3 :0@0 master,noaddr - 1634273478446 1634273478446 2 disconnected 5461-10922 f9553ea7fc23905476efec1f949b4b3e41a44103 :0@0 slave,noaddr c852007a1c3b726534e6866456c1f2002fc442d9 1634273478445 1634273478445 3 disconnected "; // bulk_string with port numbers replaced let expected_string = b"b5657714579550445f271ff65e47f3d39a36806c :1234@0 slave,noaddr 95566d2da3382ea88f549ab5766db9a6f4fbc44b 1634273478445 1634273478445 1 disconnected 95566d2da3382ea88f549ab5766db9a6f4fbc44b :1234@0 master,noaddr - 1634273478445 1634273478445 1 disconnected 0-5460 c852007a1c3b726534e6866456c1f2002fc442d9 172.31.0.6:1234@16379 myself,master - 0 1634273501000 3 connected 10923-16383 847c2efa4f5dcbca969f30a903ee54c5deb285f6 172.31.0.5:1234@16379 slave 2ee0e46acaec3fcb09fdff3ced0c267ffa2b78d3 0 1634273501428 2 connected 2ee0e46acaec3fcb09fdff3ced0c267ffa2b78d3 :1234@0 master,noaddr - 1634273478446 1634273478446 2 disconnected 5461-10922 f9553ea7fc23905476efec1f949b4b3e41a44103 :1234@0 slave,noaddr c852007a1c3b726534e6866456c1f2002fc442d9 1634273478445 1634273478445 3 disconnected "; let mut raw_frame = Frame::Redis(RedisFrame::BulkString(Bytes::from_static(bulk_string))); rewrite_port_node(&mut raw_frame, 1234).unwrap(); let rewritten = if let Frame::Redis(RedisFrame::BulkString(string)) = raw_frame.clone() { string } else { panic!("bad input: {raw_frame:?}") }; assert_eq!(rewritten, Bytes::from_static(expected_string)); }
rust_cleaned_test_functions.jsonl/119987
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1026 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 74052, 8716, 14896, 368, 341, 286, 1077, 19583, 3904, 284, 293, 1, 65, 20, 21, 20, 22, 22, 16, 19, 20, 22, 24, 20, 20, 15, 19, 19, 20, 69, 17, 22, 16, 542, 21, 20, 68, 19, 22, 69, 18...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_match_body_with_partial_json_and_extra_fields() { let _m = mock("POST", "/") .match_body(Matcher::PartialJson(json!({"hello":"world", "foo": "bar"}))) .create(); let (status, _, _) = request_with_body("POST /", "", r#"{"hello":"world"}"#); assert_eq!("HTTP/1.1 501 Mock Not Found\r\n", status); }
rust_cleaned_test_functions.jsonl/82393
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 154 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10708, 14114, 6615, 52068, 9455, 8378, 31858, 12132, 368, 341, 262, 1077, 716, 76, 284, 7860, 445, 2946, 497, 3521, 1138, 286, 659, 6347, 14114, 3189, 28058, 486, 37314, 5014, 9304, 0, 16864, 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...
1
#[test] fn test_optimistic_confirmation_violation_detection() { solana_logger::setup(); let buf = std::env::var("OPTIMISTIC_CONF_TEST_DUMP_LOG") .err() .map(|_| BufferRedirect::stderr().unwrap()); // First set up the cluster with 2 nodes let slots_per_epoch = 2048; let node_stakes = vec![51, 50]; let validator_keys: Vec<_> = vec![ "4qhhXNTbKD1a5vxDDLZcHKj7ELNeiivtUBxn3wUK1F5VRsQVP89VUhfXqSfgiFB14GfuBgtrQ96n9NvWQADVkcCg", "3kHBzVwie5vTEaY6nFCPeFT8qDpoXzn7dCEioGRNBTnUDpvwnG85w8Wq63gVWpVTP8k2a8cgcWRjSXyUkEygpXWS", ] .iter() .map(|s| (Arc::new(Keypair::from_base58_string(s)), true)) .take(node_stakes.len()) .collect(); let config = ClusterConfig { cluster_lamports: 100_000, node_stakes: node_stakes.clone(), validator_configs: vec![ValidatorConfig::default(); node_stakes.len()], validator_keys: Some(validator_keys), slots_per_epoch, stakers_slot_offset: slots_per_epoch, skip_warmup_slots: true, ..ClusterConfig::default() }; let mut cluster = LocalCluster::new(&config); let entry_point_id = cluster.entry_point_info.id; // Let the nodes run for a while. Wait for validators to vote on slot `S` // so that the vote on `S-1` is definitely in gossip and optimistic confirmation is // validators let client = cluster.get_validator_client(&entry_point_id).unwrap(); let mut prev_voted_slot = 0; loop { let last_voted_slot = client .get_slot_with_commitment(CommitmentConfig::recent()) .unwrap(); if last_voted_slot > 50 { if prev_voted_slot == 0 { prev_voted_slot = last_voted_slot; } else { break; } } sleep(Duration::from_millis(100)); } let exited_validator_info = cluster.exit_node(&entry_point_id); // create and jump over to a new fork // optimistic confirmation { let blockstore = open_blockstore(&exited_validator_info.info.ledger_path); info!( "Setting slot: {} on main fork as dead, should cause fork", prev_voted_slot ); // marking this voted slot as dead makes the saved tower garbage // effectively. That's because its stray last vote becomes stale (= no blockstore.set_dead_slot(prev_voted_slot).unwrap(); } cluster.restart_node(&entry_point_id, exited_validator_info); // Wait for a root > prev_voted_slot to be set. Because the root is on a // violated let client = cluster.get_validator_client(&entry_point_id).unwrap(); loop { let last_root = client .get_slot_with_commitment(CommitmentConfig::max()) .unwrap(); if last_root > prev_voted_slot { break; } sleep(Duration::from_millis(100)); } // Make sure validator still makes progress cluster_tests::check_for_new_roots( 16, &[cluster.get_contact_info(&entry_point_id).unwrap().clone()], "test_optimistic_confirmation_violation", ); // Check to see that validator detected optimistic confirmation for // `prev_voted_slot` failed let expected_log = OptimisticConfirmationVerifier::format_optimistic_confirmd_slot_violation_log( prev_voted_slot, ); if let Some(mut buf) = buf { let mut output = String::new(); buf.read_to_string(&mut output).unwrap(); assert!(output.contains(&expected_log)); } else { panic!("dumped log and disaled testing"); } }
rust_cleaned_test_functions.jsonl/36005
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1659 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15032, 318, 4532, 37681, 2273, 24903, 367, 57505, 368, 341, 262, 2048, 3362, 27413, 486, 15188, 543, 262, 1077, 6607, 284, 1460, 486, 3160, 486, 947, 445, 38021, 1791, 82556, 29212, 11641, 74498, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
#[test] fn test_median_filter_matches_reference_implementation() { fn prop(image: GrayTestImage, x_radius: u32, y_radius: u32) -> TestResult { let x_radius = x_radius % 5; let y_radius = y_radius % 5; let expected = reference_median_filter(&image.0, x_radius, y_radius); let actual = median_filter(&image.0, x_radius, y_radius); match pixel_diff_summary(&actual, &expected) { None => TestResult::passed(), Some(err) => TestResult::error(err), } } quickcheck(prop as fn(GrayTestImage, u32, u32) -> TestResult); }
rust_cleaned_test_functions.jsonl/19901
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 307 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 83003, 8727, 38344, 25433, 62, 14369, 368, 341, 286, 5168, 2004, 10075, 25, 23366, 2271, 1906, 11, 856, 28936, 25, 575, 18, 17, 11, 379, 28936, 25, 575, 18, 17, 8, 1464, 3393, 2077, 341, 310, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_next_id() { let mut g = IDGen::new(); let v = g.next_id(); println!("{}", v); assert!(v > 0); std::thread::sleep(Duration::from_millis(100)); let v1 = g.next_id(); println!("{}", v); assert!(v1 > 0); std::thread::sleep(Duration::from_millis(100)); let v2 = new_sf().next_id().unwrap(); println!("{}", v2); assert!(v2 > 0) }
rust_cleaned_test_functions.jsonl/48794
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 241 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11257, 842, 368, 341, 286, 1077, 5206, 342, 284, 3034, 9967, 486, 931, 543, 286, 1077, 348, 284, 342, 4529, 842, 543, 286, 13751, 79878, 348, 317, 286, 2060, 10297, 85, 861, 220, 15, 626, 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_strcmp() { let tests = vec![ ( Datum::Bytes(b"123".to_vec()), Datum::Bytes(b"123".to_vec()), Datum::I64(0), ), ( Datum::Bytes(b"123".to_vec()), Datum::Bytes(b"1".to_vec()), Datum::I64(1), ), ( Datum::Bytes(b"1".to_vec()), Datum::Bytes(b"123".to_vec()), Datum::I64(-1), ), ( Datum::Bytes(b"123".to_vec()), Datum::Bytes(b"45".to_vec()), Datum::I64(-1), ), ( Datum::Bytes("你好".as_bytes().to_vec()), Datum::Bytes(b"hello".to_vec()), Datum::I64(1), ), ( Datum::Bytes(b"".to_vec()), Datum::Bytes(b"123".to_vec()), Datum::I64(-1), ), ( Datum::Bytes(b"123".to_vec()), Datum::Bytes(b"".to_vec()), Datum::I64(1), ), ( Datum::Bytes(b"".to_vec()), Datum::Bytes(b"".to_vec()), Datum::I64(0), ), (Datum::Null, Datum::Bytes(b"123".to_vec()), Datum::Null), (Datum::Bytes(b"123".to_vec()), Datum::Null, Datum::Null), (Datum::Bytes(b"".to_vec()), Datum::Null, Datum::Null), (Datum::Null, Datum::Bytes(b"".to_vec()), Datum::Null), ]; for (left, right, exp) in tests { let got = eval_func(ScalarFuncSig::Strcmp, &[left, right]).unwrap(); assert_eq!(got, exp); } }
rust_cleaned_test_functions.jsonl/9121
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1162 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 74523, 368, 341, 286, 1077, 7032, 284, 7486, 90515, 310, 2399, 394, 68459, 486, 7078, 1883, 1, 16, 17, 18, 3263, 983, 13251, 14702, 394, 68459, 486, 7078, 1883, 1, 16, 17, 18, 3263, 983, 13251...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_mut_rev_iter_wrap() { let mut d = VecDeque::with_capacity(3); assert!(d.iter_mut().rev().next().is_none()); d.push_back(1); d.push_back(2); d.push_back(3); assert_eq!(d.pop_front(), Some(1)); d.push_back(4); assert_eq!(d.iter_mut().rev().cloned().collect::<Vec<_>>(), vec![4, 3, 2]); }
rust_cleaned_test_functions.jsonl/93482
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 184 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 29523, 38082, 11723, 38550, 368, 341, 262, 1077, 5206, 294, 284, 11312, 73891, 486, 4197, 35603, 7, 18, 317, 262, 2060, 10297, 67, 19471, 29523, 1005, 7282, 1005, 3600, 1005, 285, 31488, 5231, 262...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_basic() { // deploy contract let mut context = Context::default(); let contract_bin: Bytes = Loader::default().load_binary("bitcoin-spv-lib"); let out_point = context.deploy_cell(contract_bin); // prepare scripts let lock_script = context .build_script(&out_point, Default::default()) .expect("script"); let lock_script_dep = CellDep::new_builder().out_point(out_point).build(); let difficulty_data = Bytes::from("hello"); let difficulty_data_out_point = context.deploy_cell(difficulty_data); let difficulty_data_dep = CellDep::new_builder() .out_point(difficulty_data_out_point) .build(); // prepare cells let input_out_point = context.create_cell( CellOutput::new_builder() .capacity(1000u64.pack()) .lock(lock_script.clone()) .build(), Bytes::new(), ); let input = CellInput::new_builder() .previous_output(input_out_point) .build(); let outputs = vec![ CellOutput::new_builder() .capacity(500u64.pack()) .lock(lock_script.clone()) .build(), CellOutput::new_builder() .capacity(500u64.pack()) .lock(lock_script) .build(), ]; let outputs_data = vec![Bytes::new(); 2]; let cc_witness: Vec<u8> = vec![1, 2, 3]; let witness = WitnessArgs::new_builder() .input_type(Some(Bytes::from(cc_witness)).pack()) .build(); // build transaction let tx = TransactionBuilder::default() .input(input) .outputs(outputs) .outputs_data(outputs_data.pack()) .cell_dep(lock_script_dep) .cell_dep(difficulty_data_dep) .witness(witness.as_bytes().pack()) .build(); let tx = context.complete_tx(tx); // run let cycles = context .verify_tx(&tx, MAX_CYCLES) .expect("pass verification"); println!("consume cycles: {}", cycles); }
rust_cleaned_test_functions.jsonl/33336
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 889 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 34729, 368, 341, 262, 442, 10517, 5116, 198, 262, 1077, 5206, 2266, 284, 9608, 486, 2258, 543, 262, 1077, 5116, 21816, 25, 30024, 284, 27811, 486, 2258, 1005, 1078, 31761, 445, 83910, 22238, 85, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_retain() { let mut a = BinaryHeap::from(vec![-10, -5, 1, 2, 4, 13]); a.retain(|x| x % 2 == 0); assert_eq!(a.into_sorted_vec(), [-10, 2, 4]) }
rust_cleaned_test_functions.jsonl/62373
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 94 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21695, 466, 368, 341, 262, 1077, 5206, 264, 284, 17718, 27909, 486, 1499, 25592, 0, 7609, 16, 15, 11, 481, 20, 11, 220, 16, 11, 220, 17, 11, 220, 19, 11, 220, 16, 18, 2558, 262, 264, 1327,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_iterstate() { let param = vec![1.0, 2.0]; let cost = 42.0; let mut state: IterState<MinimalNoOperator> = IterState::new(param.clone()); assert_eq!(state.get_param(), param); assert_eq!(state.get_prev_param(), param); assert_eq!(state.get_best_param(), param); assert_eq!(state.get_prev_best_param(), param); assert_eq!(state.get_cost(), std::f64::INFINITY); assert_eq!(state.get_prev_cost(), std::f64::INFINITY); assert_eq!(state.get_best_cost(), std::f64::INFINITY); assert_eq!(state.get_prev_best_cost(), std::f64::INFINITY); assert_eq!(state.get_target_cost(), std::f64::NEG_INFINITY); assert_eq!(state.get_grad(), None); assert_eq!(state.get_prev_grad(), None); assert_eq!(state.get_hessian(), None); assert_eq!(state.get_prev_hessian(), None); assert_eq!(state.get_jacobian(), None); assert_eq!(state.get_prev_jacobian(), None); assert_eq!(state.get_iter(), 0); assert_eq!(state.is_best(), true); assert_eq!(state.get_max_iters(), std::u64::MAX); assert_eq!(state.get_cost_func_count(), 0); assert_eq!(state.get_grad_func_count(), 0); assert_eq!(state.get_hessian_func_count(), 0); assert_eq!(state.get_jacobian_func_count(), 0); assert_eq!(state.get_modify_func_count(), 0); state.max_iters(42); assert_eq!(state.get_max_iters(), 42); state.cost(cost); assert_eq!(state.get_cost(), cost); assert_eq!(state.get_prev_cost(), std::f64::INFINITY); state.best_cost(cost); assert_eq!(state.get_best_cost(), cost); assert_eq!(state.get_prev_best_cost(), std::f64::INFINITY); let new_param = vec![2.0, 1.0]; state.param(new_param.clone()); assert_eq!(state.get_param(), new_param); assert_eq!(state.get_prev_param(), param); state.best_param(new_param.clone()); assert_eq!(state.get_best_param(), new_param); assert_eq!(state.get_prev_best_param(), param); let new_cost = 21.0; state.cost(new_cost); assert_eq!(state.get_cost(), new_cost); assert_eq!(state.get_prev_cost(), cost); state.best_cost(new_cost); assert_eq!(state.get_best_cost(), new_cost); assert_eq!(state.get_prev_best_cost(), cost); state.increment_iter(); assert_eq!(state.get_iter(), 1); assert_eq!(state.is_best(), false); state.new_best(); assert_eq!(state.is_best(), true); let grad = vec![1.0, 2.0]; state.grad(grad.clone()); assert_eq!(state.get_grad(), Some(grad.clone())); assert_eq!(state.get_prev_grad(), None); let new_grad = vec![2.0, 1.0]; state.grad(new_grad.clone()); assert_eq!(state.get_grad(), Some(new_grad.clone())); assert_eq!(state.get_prev_grad(), Some(grad.clone())); let hessian = vec![vec![1.0, 2.0], vec![2.0, 1.0]]; state.hessian(hessian.clone()); assert_eq!(state.get_hessian(), Some(hessian.clone())); assert_eq!(state.get_prev_hessian(), None); let new_hessian = vec![vec![2.0, 1.0], vec![1.0, 2.0]]; state.hessian(new_hessian.clone()); assert_eq!(state.get_hessian(), Some(new_hessian.clone())); assert_eq!(state.get_prev_hessian(), Some(hessian.clone())); let jacobian = vec![1.0, 2.0]; state.jacobian(jacobian.clone()); assert_eq!(state.get_jacobian(), Some(jacobian.clone())); assert_eq!(state.get_prev_jacobian(), None); let new_jacobian = vec![2.0, 1.0]; state.jacobian(new_jacobian.clone()); assert_eq!(state.get_jacobian(), Some(new_jacobian.clone())); assert_eq!(state.get_prev_jacobian(), Some(jacobian.clone())); state.increment_iter(); assert_eq!(state.get_iter(), 2); assert_eq!(state.get_last_best_iter(), 1); assert_eq!(state.is_best(), false); state.increment_cost_func_count(42); assert_eq!(state.get_cost_func_count(), 42); state.increment_grad_func_count(43); assert_eq!(state.get_grad_func_count(), 43); state.increment_hessian_func_count(44); assert_eq!(state.get_hessian_func_count(), 44); state.increment_jacobian_func_count(46); assert_eq!(state.get_jacobian_func_count(), 46); state.increment_modify_func_count(45); assert_eq!(state.get_modify_func_count(), 45); // check again! assert_eq!(state.get_iter(), 2); assert_eq!(state.get_last_best_iter(), 1); assert_eq!(state.get_max_iters(), 42); assert_eq!(state.is_best(), false); assert_eq!(state.get_cost(), new_cost); assert_eq!(state.get_prev_cost(), cost); assert_eq!(state.get_param(), new_param); assert_eq!(state.get_prev_param(), param); assert_eq!(state.get_best_cost(), new_cost); assert_eq!(state.get_prev_best_cost(), cost); assert_eq!(state.get_best_param(), new_param); assert_eq!(state.get_prev_best_param(), param); assert_eq!(state.get_best_cost(), new_cost); assert_eq!(state.get_prev_best_cost(), cost); assert_eq!(state.get_grad(), Some(new_grad)); assert_eq!(state.get_prev_grad(), Some(grad)); assert_eq!(state.get_hessian(), Some(new_hessian)); assert_eq!(state.get_prev_hessian(), Some(hessian)); assert_eq!(state.get_jacobian(), Some(new_jacobian)); assert_eq!(state.get_prev_jacobian(), Some(jacobian)); assert_eq!(state.get_cost_func_count(), 42); assert_eq!(state.get_grad_func_count(), 43); assert_eq!(state.get_hessian_func_count(), 44); assert_eq!(state.get_jacobian_func_count(), 46); assert_eq!(state.get_modify_func_count(), 45); }
rust_cleaned_test_functions.jsonl/21728
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2830 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11723, 2454, 368, 341, 286, 1077, 1685, 284, 7486, 20703, 16, 13, 15, 11, 220, 17, 13, 15, 935, 286, 1077, 2783, 284, 220, 19, 17, 13, 15, 401, 286, 1077, 5206, 1584, 25, 13704, 1397, 27, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_websocket() { init(); let addr = "127.0.0.1:8080"; let server_runtime = Runtime::new().unwrap(); // spawn a server server_runtime.spawn(async move { RSocketFactory::receive() .transport(WebsocketServerTransport::from(addr)) .acceptor(Box::new(|setup, _socket| { info!("accept setup: {:?}", setup); Ok(Box::new(EchoRSocket)) })) .on_start(Box::new(|| { info!("+++++++ websocket echo server started! +++++++") })) .serve() .await }); sleep(Duration::from_millis(500)); let mut client_runtime = Runtime::new().unwrap(); client_runtime.block_on(async { let cli = RSocketFactory::connect() .acceptor(Box::new(|| Box::new(EchoRSocket))) .transport(WebsocketClientTransport::from(addr)) .setup(Payload::from("READY!")) .mime_type("text/plain", "text/plain") .start() .await .unwrap(); info!("=====> begin"); exec_metadata_push(&cli).await; exec_fire_and_forget(&cli).await; exec_request_response(&cli).await; exec_request_stream(&cli).await; exec_request_channel(&cli).await; cli.close(); }); }
rust_cleaned_test_functions.jsonl/37352
{ "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, 25960, 9556, 368, 341, 262, 2930, 1428, 262, 1077, 10789, 284, 330, 16, 17, 22, 13, 15, 13, 15, 13, 16, 25, 23, 15, 23, 15, 3302, 262, 1077, 3538, 33232, 284, 10954, 486, 931, 1005, 15454, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_spinning_spsc() { let (mut tx, mut rx) = bounded::queue::<Owned, Owned, usize>(SIZE); let handle = thread::spawn(move|| { for i in 0..COUNT { loop { if let Ok(()) = tx.try_send(i) { break; } } } }); for i in 0..COUNT { loop { if let Ok(num) = rx.try_recv() { assert_eq!(num, Some(i)); break; } } } handle.join().unwrap(); thread::sleep(Duration::from_millis(10)); // to ensure atomic closure is propagated assert!(rx.is_closed()); assert_eq!(rx.try_recv(), Ok(None)); }
rust_cleaned_test_functions.jsonl/96437
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 385 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10123, 19770, 643, 81984, 368, 341, 262, 1077, 320, 6984, 9854, 11, 5206, 19111, 8, 284, 61115, 486, 4584, 27638, 57641, 11, 85093, 11, 22301, 2235, 20494, 626, 262, 1077, 3705, 284, 4516, 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...
6
#[test] fn test_session_empty() { let db = Connection::open_in_memory().unwrap(); db.execute_batch("CREATE TABLE foo(t TEXT PRIMARY KEY NOT NULL);") .unwrap(); let mut session = Session::new(&db).unwrap(); assert!(session.is_empty()); session.attach(None).unwrap(); db.execute("INSERT INTO foo (t) VALUES (?);", &["bar"]) .unwrap(); assert!(!session.is_empty()); }
rust_cleaned_test_functions.jsonl/96254
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 210 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 12316, 15124, 368, 341, 286, 1077, 2927, 284, 11032, 486, 2508, 1243, 19195, 1005, 15454, 543, 286, 2927, 7769, 14534, 445, 22599, 14363, 15229, 1155, 15762, 37467, 12013, 4183, 1770, 1215, 1138, 31...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_memstore_opcode() { let default_code = vec![0x60, 0x05, 0x60, 0x01, 0x52]; let mut vm = VM::new(default_code).with_simple_memory(); let result = vm.execute_one(); assert!(result.is_ok()); let result = vm.execute_one(); assert!(result.is_ok()); let result = vm.execute_one(); assert!(result.is_ok()); let memory = vm.memory.unwrap(); assert!(memory.size() > 0.into()); }
rust_cleaned_test_functions.jsonl/125705
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 228 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 12976, 4314, 71319, 368, 341, 286, 1077, 1638, 4136, 284, 7486, 20703, 15, 87, 21, 15, 11, 220, 15, 87, 15, 20, 11, 220, 15, 87, 21, 15, 11, 220, 15, 87, 15, 16, 11, 220, 15, 87, 20, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_windows_guest_netdev_hotplug() { let windows_guest = WindowsGuest::new(); let mut ovmf_path = dirs::home_dir().unwrap(); ovmf_path.push("workloads"); ovmf_path.push(OVMF_NAME); let tmp_dir = TempDir::new_with_prefix("/tmp/ch").unwrap(); let api_socket = temp_api_path(&tmp_dir); let mut child = GuestCommand::new(windows_guest.guest()) .args(&["--api-socket", &api_socket]) .args(&["--cpus", "boot=2,kvm_hyperv=on"]) .args(&["--memory", "size=4G"]) .args(&["--kernel", ovmf_path.to_str().unwrap()]) .args(&["--serial", "tty"]) .args(&["--console", "off"]) .default_disks() .default_net() .capture_output() .spawn() .unwrap(); let mut child_dnsmasq = windows_guest.run_dnsmasq(); let r = std::panic::catch_unwind(|| { // Wait to make sure Windows boots up assert!(windows_guest.wait_for_boot()); // Initially present network device let netdev_num = 1; assert_eq!(windows_guest.netdev_count(), netdev_num); assert_eq!(netdev_ctrl_threads_count(child.id()), netdev_num); // Hotplug network device let (cmd_success, cmd_output) = remote_command_w_output( &api_socket, "add-net", Some(windows_guest.guest().default_net_string().as_str()), ); assert!(cmd_success); assert!(String::from_utf8_lossy(&cmd_output).contains("\"id\":\"_net2\"")); thread::sleep(std::time::Duration::new(5, 0)); // Verify the device is on the system let netdev_num = 2; assert_eq!(windows_guest.netdev_count(), netdev_num); assert_eq!(netdev_ctrl_threads_count(child.id()), netdev_num); // Remove network device let cmd_success = remote_command(&api_socket, "remove-device", Some("_net2")); assert!(cmd_success); thread::sleep(std::time::Duration::new(5, 0)); // Verify the device has been removed let netdev_num = 1; assert_eq!(windows_guest.netdev_count(), netdev_num); assert_eq!(netdev_ctrl_threads_count(child.id()), netdev_num); windows_guest.shutdown(); }); let _ = child.wait_timeout(std::time::Duration::from_secs(60)); let _ = child.kill(); let output = child.wait_with_output().unwrap(); let _ = child_dnsmasq.kill(); let _ = child_dnsmasq.wait(); handle_child_output(r, &output); }
rust_cleaned_test_functions.jsonl/26187
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1348 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 58220, 62739, 19722, 3583, 33433, 47474, 368, 341, 286, 1077, 11030, 62739, 284, 5515, 37804, 486, 931, 1428, 286, 1077, 5206, 297, 7338, 69, 2638, 284, 42248, 486, 5117, 4334, 1005, 15454, 543, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_timestamp() { let id = super::ObjectId::with_string("000000000000000000000000").unwrap(); assert_eq!(Utc.ymd(1970, 1, 1).and_hms(0, 0, 0), id.timestamp()); let id = super::ObjectId::with_string("7FFFFFFF0000000000000000").unwrap(); assert_eq!(Utc.ymd(2038, 1, 19).and_hms(3, 14, 7), id.timestamp()); let id = super::ObjectId::with_string("800000000000000000000000").unwrap(); assert_eq!(Utc.ymd(2038, 1, 19).and_hms(3, 14, 8), id.timestamp()); let id = super::ObjectId::with_string("FFFFFFFF0000000000000000").unwrap(); assert_eq!(Utc.ymd(2106, 2, 7).and_hms(6, 28, 15), id.timestamp()); }
rust_cleaned_test_functions.jsonl/101731
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 335 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 23073, 368, 341, 286, 1077, 877, 284, 2256, 486, 75511, 486, 4197, 3904, 445, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 1827, 1545...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_pat_() { let rules = create_rules( r#" macro_rules! foo { ($ i:pat) => { fn foo() { let $ i; } } } "#, ); assert_expansion(MacroKind::Items, &rules, "foo! { (a, b) }", "fn foo () {let (a , b) ;}"); }
rust_cleaned_test_functions.jsonl/14716
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 146 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 55824, 62, 368, 341, 262, 1077, 5601, 284, 1855, 21407, 1006, 286, 435, 2, 698, 286, 18072, 21407, 0, 15229, 341, 310, 1711, 600, 25, 4676, 8, 589, 314, 5168, 15229, 368, 314, 1077, 400, 600, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_word_bounds() { assert_eq!( WordBounds::new("The quick (\"brown\") fox").collect::<Vec<&str>>(), &["The", " ", "quick", " ", "(", "\"", "brown", "\"", ")", " ", " ", "fox"] ); }
rust_cleaned_test_functions.jsonl/5167
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 128 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13533, 36878, 368, 341, 286, 2060, 10714, 33673, 310, 9322, 11394, 486, 931, 445, 785, 3974, 320, 2105, 64461, 62705, 220, 38835, 1827, 17384, 27638, 10050, 52244, 495, 2452, 3148, 310, 609, 1183, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_tuple() { assert_eq!( tuple_val(br"( true, false)"), Ok(( &br""[..], Record::Tuple(vec![Record::Bool(true), Record::Bool(false)]) )) ); }
rust_cleaned_test_functions.jsonl/67446
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 125 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21773, 368, 341, 262, 2060, 10714, 33673, 286, 14405, 6189, 41237, 29209, 830, 11, 895, 8, 4461, 286, 7622, 94702, 310, 609, 1323, 3014, 95874, 1259, 310, 13583, 486, 28681, 25592, 20703, 6471, 48...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_shred_filter() { solana_logger::setup(); let mut shreds_received = LruCache::new(DEFAULT_LRU_SIZE); let mut packet = Packet::default(); let mut stats = ShredFetchStats::default(); let last_root = 0; let last_slot = 100; let slots_per_epoch = 10; let hasher = PacketHasher::default(); ShredFetchStage::process_packet( &mut packet, &mut shreds_received, &mut stats, last_root, last_slot, slots_per_epoch, &|_p| {}, &hasher, ); assert_eq!(stats.index_overrun, 1); assert!(packet.meta.discard); let shred = Shred::new_from_data(1, 3, 0, None, true, true, 0, 0, 0); shred.copy_to_packet(&mut packet); ShredFetchStage::process_packet( &mut packet, &mut shreds_received, &mut stats, 3, last_slot, slots_per_epoch, &|_p| {}, &hasher, ); assert!(packet.meta.discard); ShredFetchStage::process_packet( &mut packet, &mut shreds_received, &mut stats, last_root, last_slot, slots_per_epoch, &|_p| {}, &hasher, ); assert!(!packet.meta.discard); // shreds_received should filter duplicate ShredFetchStage::process_packet( &mut packet, &mut shreds_received, &mut stats, last_root, last_slot, slots_per_epoch, &|_p| {}, &hasher, ); assert!(packet.meta.discard); let shred = Shred::new_from_data(1_000_000, 3, 0, None, true, true, 0, 0, 0); shred.copy_to_packet(&mut packet); // Slot 1 million is too high ShredFetchStage::process_packet( &mut packet, &mut shreds_received, &mut stats, last_root, last_slot, slots_per_epoch, &|_p| {}, &hasher, ); assert!(packet.meta.discard); let index = MAX_DATA_SHREDS_PER_SLOT as u32; let shred = Shred::new_from_data(5, index, 0, None, true, true, 0, 0, 0); shred.copy_to_packet(&mut packet); ShredFetchStage::process_packet( &mut packet, &mut shreds_received, &mut stats, last_root, last_slot, slots_per_epoch, &|_p| {}, &hasher, ); assert!(packet.meta.discard); }
rust_cleaned_test_functions.jsonl/3580
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1562 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3712, 1151, 8727, 368, 341, 286, 2048, 3362, 27413, 486, 15188, 543, 286, 1077, 5206, 557, 53369, 40783, 284, 444, 2672, 8233, 486, 931, 43175, 2351, 36003, 4098, 317, 286, 1077, 5206, 10151, 284,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_shard_with_id() { let mut config = Config::default(); config.shard = Some("721096872374083614".to_string()); let result = util::shard(config); assert_eq!(result, 30); }
rust_cleaned_test_functions.jsonl/118180
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 105 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3712, 567, 6615, 842, 368, 341, 286, 1077, 5206, 2193, 284, 5532, 486, 2258, 543, 286, 2193, 2395, 567, 284, 4329, 445, 22, 17, 16, 15, 24, 21, 23, 22, 17, 18, 22, 19, 15, 23, 18, 21, 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_events_data() { let event_fd = EventFd::new(0).unwrap(); let event_set = EventSet::IN; let events_raw = Events::with_data_raw(event_fd.as_raw_fd(), 42, event_set); let events = Events::with_data(&event_fd, 43, event_set); assert_ne!(events_raw, events); assert_eq!(events.data(), 43); assert_eq!(events_raw.data(), 42); }
rust_cleaned_test_functions.jsonl/78842
{ "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, 19691, 1769, 368, 341, 286, 1077, 1538, 17676, 284, 3665, 74476, 486, 931, 7, 15, 568, 15454, 543, 286, 1077, 1538, 2602, 284, 3665, 1649, 486, 687, 401, 286, 1077, 4357, 16067, 284, 17627, 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_aaaa() { let tokens = vec!["::1"]; let name = Name::from_str("example.com.").unwrap(); let record = RData::parse( RecordType::AAAA, tokens.iter().map(AsRef::as_ref), Some(&name), ) .unwrap(); assert_eq!(record, RData::AAAA("::1".parse().unwrap())); }
rust_cleaned_test_functions.jsonl/21378
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 191 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4306, 32646, 368, 341, 286, 1077, 11211, 284, 7486, 0, 1183, 486, 16, 6332, 286, 1077, 829, 284, 3988, 486, 1499, 2895, 445, 8687, 905, 98401, 15454, 543, 286, 1077, 3255, 284, 431, 1043, 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_closed_reject_after_listen() { let mut s = socket(); s.listen(LOCAL_END).unwrap(); s.close(); let tcp_repr = TcpRepr { control: TcpControl::Syn, ..SEND_TEMPL }; assert!(!s.accepts(&SEND_IP_TEMPL, &tcp_repr)); }
rust_cleaned_test_functions.jsonl/1696
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 177 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 44697, 1288, 583, 19844, 79286, 368, 341, 286, 1077, 5206, 274, 284, 7575, 543, 286, 274, 22628, 7, 39081, 10898, 568, 15454, 543, 286, 274, 4653, 1428, 286, 1077, 28051, 68535, 284, 64876, 693, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_record_type_parse() { let record_names = &[ "A", "AAAA", "ANAME", "CAA", "CNAME", "CSYNC", "HINFO", "NULL", "MX", "NAPTR", "NS", "OPENPGPKEY", "PTR", "SOA", "SRV", "SSHFP", "TLSA", "TXT", "ANY", "AXFR", ]; #[cfg(feature = "dnssec")] let dnssec_record_names = &[ "CDNSKEY", "CDS", "DNSKEY", "DS", "KEY", "NSEC", "NSEC3", "NSEC3PARAM", "RRSIG", "SIG", "TSIG", ]; #[cfg(not(feature = "dnssec"))] let dnssec_record_names = &[]; let mut rtypes = std::collections::HashSet::new(); for name in record_names.iter().chain(dnssec_record_names) { let rtype: RecordType = name.parse().unwrap(); assert_eq!(rtype.to_string().to_ascii_uppercase().as_str(), *name); assert!(rtypes.insert(rtype)); } }
rust_cleaned_test_functions.jsonl/106976
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 791 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14192, 1819, 21039, 368, 341, 286, 1077, 3255, 9187, 284, 609, 9640, 310, 330, 32, 756, 310, 330, 25699, 756, 310, 330, 1093, 2729, 756, 310, 330, 28633, 756, 310, 330, 34, 7535, 756, 310, 330...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_binomial() { use std::num::FromStrRadix; assert_eq!(binomial(20, 0), binomial(20, 20)); assert_eq!(binomial(20, 15), binomial(19, 14) + binomial(19, 15)); assert_eq!(binomial(5, 3), 10.to_biguint().unwrap()); assert_eq!(binomial(31, 17), 265182525.to_biguint().unwrap()); assert_eq!(binomial(300, 30), FromStrRadix::from_str_radix("173193226149263513034110205899732811401360", 10).unwrap()); }
rust_cleaned_test_functions.jsonl/33260
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 202 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21816, 20855, 368, 341, 262, 990, 1460, 486, 2413, 486, 3830, 2580, 41931, 941, 401, 262, 2060, 10714, 10297, 6863, 20855, 7, 17, 15, 11, 220, 15, 701, 9544, 20855, 7, 17, 15, 11, 220, 17, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_bpf_loader_upgradeable_set_buffer_authority() { let instruction = bincode::serialize(&UpgradeableLoaderInstruction::SetAuthority).unwrap(); let loader_id = bpf_loader_upgradeable::id(); let invalid_authority_address = Pubkey::new_unique(); let authority_address = Pubkey::new_unique(); let authority_account = AccountSharedData::new(1, 0, &Pubkey::new_unique()); let new_authority_address = Pubkey::new_unique(); let new_authority_account = AccountSharedData::new(1, 0, &Pubkey::new_unique()); let buffer_address = Pubkey::new_unique(); let mut buffer_account = AccountSharedData::new( 1, UpgradeableLoaderState::buffer_len(0).unwrap(), &loader_id, ); buffer_account .set_state(&UpgradeableLoaderState::Buffer { authority_address: Some(authority_address), }) .unwrap(); let mut transaction_accounts = vec![ (buffer_address, buffer_account.clone()), (authority_address, authority_account.clone()), (new_authority_address, new_authority_account.clone()), ]; let buffer_meta = AccountMeta { pubkey: buffer_address, is_signer: false, is_writable: false, }; let authority_meta = AccountMeta { pubkey: authority_address, is_signer: true, is_writable: false, }; let new_authority_meta = AccountMeta { pubkey: new_authority_address, is_signer: false, is_writable: false, }; // Case: New authority required let accounts = process_instruction( &loader_id, &[], &instruction, transaction_accounts.clone(), vec![buffer_meta.clone(), authority_meta.clone()], Err(InstructionError::IncorrectAuthority), ); let state: UpgradeableLoaderState = accounts[0].state().unwrap(); assert_eq!( state, UpgradeableLoaderState::Buffer { authority_address: Some(authority_address), } ); // Case: Set to new authority buffer_account .set_state(&UpgradeableLoaderState::Buffer { authority_address: Some(authority_address), }) .unwrap(); let accounts = process_instruction( &loader_id, &[], &instruction, transaction_accounts.clone(), vec![ buffer_meta.clone(), authority_meta.clone(), new_authority_meta.clone(), ], Ok(()), ); let state: UpgradeableLoaderState = accounts[0].state().unwrap(); assert_eq!( state, UpgradeableLoaderState::Buffer { authority_address: Some(new_authority_address), } ); // Case: Authority did not sign process_instruction( &loader_id, &[], &instruction, transaction_accounts.clone(), vec![ buffer_meta.clone(), AccountMeta { pubkey: authority_address, is_signer: false, is_writable: false, }, new_authority_meta.clone(), ], Err(InstructionError::MissingRequiredSignature), ); // Case: wrong authority process_instruction( &loader_id, &[], &instruction, vec![ (buffer_address, buffer_account.clone()), (invalid_authority_address, authority_account), (new_authority_address, new_authority_account), ], vec![ buffer_meta.clone(), AccountMeta { pubkey: invalid_authority_address, is_signer: true, is_writable: false, }, new_authority_meta.clone(), ], Err(InstructionError::IncorrectAuthority), ); // Case: No authority process_instruction( &loader_id, &[], &instruction, transaction_accounts.clone(), vec![buffer_meta.clone(), authority_meta.clone()], Err(InstructionError::IncorrectAuthority), ); // Case: Set to no authority transaction_accounts[0] .1 .set_state(&UpgradeableLoaderState::Buffer { authority_address: None, }) .unwrap(); process_instruction( &loader_id, &[], &instruction, transaction_accounts.clone(), vec![ buffer_meta.clone(), authority_meta.clone(), new_authority_meta.clone(), ], Err(InstructionError::Immutable), ); // Case: Not a Buffer account transaction_accounts[0] .1 .set_state(&UpgradeableLoaderState::Program { programdata_address: Pubkey::new_unique(), }) .unwrap(); process_instruction( &loader_id, &[], &instruction, transaction_accounts.clone(), vec![buffer_meta, authority_meta, new_authority_meta], Err(InstructionError::InvalidArgument), ); }
rust_cleaned_test_functions.jsonl/55715
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2972 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 880, 15897, 22139, 67794, 480, 2602, 7776, 22938, 487, 368, 341, 286, 1077, 7600, 284, 9544, 1851, 486, 24166, 2099, 43861, 480, 9181, 16664, 486, 1649, 45532, 568, 15454, 543, 286, 1077, 16047, 8...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_push_down_projection_aggregate_query() { let schema = Schema::new(vec![ Field::new("id", DataType::Utf8, false), Field::new("employee_name", DataType::Utf8, false), Field::new("job_title", DataType::Utf8, false), Field::new("base_pay", DataType::Utf8, false), Field::new("overtime_pay", DataType::Utf8, false), Field::new("other_pay", DataType::Utf8, false), Field::new("benefits", DataType::Utf8, false), Field::new("total_pay", DataType::Utf8, false), Field::new("total_pay_benefits", DataType::Utf8, false), Field::new("year", DataType::Utf8, false), Field::new("notes", DataType::Utf8, true), Field::new("agency", DataType::Utf8, false), Field::new("status", DataType::Utf8, false), ]); let schemas: Rc<RefCell<HashMap<String, Rc<Schema>>>> = Rc::new(RefCell::new(HashMap::new())); schemas.borrow_mut().insert("salaries".to_string(), Rc::new(schema)); // define the SQL statement let sql = "SELECT year, MIN(CAST(base_pay AS FLOAT)), MAX(CAST(base_pay AS FLOAT)) \ FROM salaries \ WHERE base_pay != 'Not Provided' AND base_pay != '' \ GROUP BY year"; let ast = Parser::parse_sql(String::from(sql)).unwrap(); let query_planner = SqlToRel::new(schemas.clone()); let plan = query_planner.sql_to_rel(&ast).unwrap(); println!("BEFORE: {:?}", plan); let new_plan = push_down_projection(&plan, HashSet::new()); println!("AFTER: {:?}", new_plan); //TODO: assertions }
rust_cleaned_test_functions.jsonl/40754
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 845 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14218, 13998, 72738, 20587, 14240, 5738, 368, 1476, 1789, 286, 1077, 10802, 284, 12539, 486, 931, 25592, 90515, 310, 8601, 486, 931, 445, 307, 497, 33172, 486, 38980, 23, 11, 895, 1326, 310, 8601,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_all_epoch_ending_ledger_infos() { // Create a new streaming service client and listener let (streaming_service_client, streaming_service_listener) = new_streaming_service_client_listener_pair(); // Note the request we expect to receive on the streaming service side let request_start_epoch = 10; let expected_request = StreamRequest::GetAllEpochEndingLedgerInfos(GetAllEpochEndingLedgerInfosRequest { start_epoch: request_start_epoch, }); // Spawn a new server thread to handle any epoch ending stream requests let _handler = spawn_service_and_expect_request(streaming_service_listener, expected_request); // Send an epoch ending stream request and verify we get a data stream listener let response = block_on(streaming_service_client.get_all_epoch_ending_ledger_infos(request_start_epoch)); assert_ok!(response); }
rust_cleaned_test_functions.jsonl/125040
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 321 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 5705, 20682, 62, 2459, 38367, 1389, 47779, 368, 341, 262, 442, 4230, 264, 501, 16842, 2473, 2943, 323, 11446, 198, 262, 1077, 320, 4027, 287, 12267, 8179, 11, 16842, 12267, 46493, 8, 4035, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_str_builder() { let mut builder = ListUtf8ChunkedBuilder::new("a", LargeStringBuilder::with_capacity(10, 10), 10); builder.append_series(&Series::new("", &["foo", "bar"])); let ca = builder.finish(); dbg!(ca); }
rust_cleaned_test_functions.jsonl/45659
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 134 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2019, 2895, 28532, 368, 341, 286, 1077, 5206, 7363, 4035, 310, 1759, 38980, 23, 28304, 291, 3297, 486, 931, 445, 64, 497, 20286, 69412, 486, 4197, 35603, 7, 16, 15, 11, 220, 16, 15, 701, 220, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_select_where_equals() { let expected = expected_values( "SELECT `naukio`.* FROM `naukio` WHERE `word` = ?", vec!["meow"], ); let query = Select::from_table("naukio").so_that("word".equals("meow")); let (sql, params) = Sqlite::build(query); assert_eq!(expected.0, sql); assert_eq!(default_params(expected.1), params); }
rust_cleaned_test_functions.jsonl/80601
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 204 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13051, 36814, 61664, 368, 341, 286, 1077, 3601, 284, 3601, 9146, 1006, 310, 330, 4858, 1565, 77, 2863, 74, 815, 63, 4908, 4295, 1565, 77, 2863, 74, 815, 63, 5288, 1565, 1158, 63, 284, 937, 756...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_cstr_contains_at_most_terminating_null_byte() { assert!(cstr_contains_at_most_terminating_null_byte(b"foobar")); assert!(cstr_contains_at_most_terminating_null_byte(b"foobar\0")); assert!(cstr_contains_at_most_terminating_null_byte(b"\0")); assert!(cstr_contains_at_most_terminating_null_byte(b"foobar\0")); assert!(!cstr_contains_at_most_terminating_null_byte(b"\0\0")); assert!(!cstr_contains_at_most_terminating_null_byte(b"foo\0bar\0")); }
rust_cleaned_test_functions.jsonl/117738
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 253 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 666, 495, 63598, 3752, 81416, 62, 22969, 1095, 15162, 19737, 368, 341, 286, 2060, 10297, 66, 495, 63598, 3752, 81416, 62, 22969, 1095, 15162, 19737, 1883, 1, 50267, 4010, 286, 2060, 10297, 66, 495...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_delta() { // The trickiness here almost entirely relates to negative maximum values for signed // integer types assert_eq!(delta::<u8, u8>(0, 2), 2); assert_eq!(delta::<u8, u8>(0, u8::max_value()), u8::max_value()); assert_eq!(delta::<i8, u8>(-2, 0), 2); assert_eq!(delta::<i8, u8>(-2, 2), 4); assert_eq!(delta::<i8, u8>(i8::min_value(), 0), 128); assert_eq!(delta::<i8, u8>(0, i8::max_value()), 127); assert_eq!( delta::<i8, u8>(i8::min_value(), i8::max_value()), u8::max_value() ); assert_eq!(delta::<i8, u8>(i8::min_value(), i8::min_value()), 0); assert_eq!( delta::<i32, u32>(i32::min_value(), i32::max_value()), (i32::max_value() as u32) * 2 + 1 ); assert_eq!( delta::<i32, usize>(i32::min_value(), i32::max_value()), (i32::max_value() as usize) * 2 + 1 ); }
rust_cleaned_test_functions.jsonl/55467
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 543 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 26710, 368, 341, 286, 442, 576, 14068, 1880, 1588, 4558, 11368, 35616, 311, 8225, 7192, 2750, 369, 8499, 198, 286, 442, 7546, 4494, 198, 286, 2060, 10714, 10297, 20255, 27638, 84, 23, 11, 575, 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_in_compress_range() { assert!(parse_level("1").is_ok()); assert!(parse_level("9").is_ok()); assert!(parse_level("0").is_err()); assert!(parse_level("10").is_err()); assert!(parse_level("f").is_err()); assert!(parse_level("5.5").is_err()); assert!(parse_level("-3").is_err()); }
rust_cleaned_test_functions.jsonl/34838
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 177 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1243, 87845, 9698, 368, 341, 286, 2060, 10297, 6400, 8274, 445, 16, 1827, 285, 19817, 1423, 286, 2060, 10297, 6400, 8274, 445, 24, 1827, 285, 19817, 1423, 286, 2060, 10297, 6400, 8274, 445, 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_selector_pseudo_contains() -> Result { let html = r#"<h1>abc</h1><div>a&amp;</div>"#; let root = Vis::load(html)?; // has 'a' let text_a = root.find(":contains('a')"); assert_eq!(text_a.length(), 2); // 'b' let text_b = root.find(":contains('b')"); assert_eq!(text_b.length(), 1); // escape ; let text_escape = root.find(":contains(\"&\")"); assert_eq!(text_escape.length(), 1); // more let html = r##" <div id="content"> <p>Visdom</p> <p> Vis<span>dom</span>! </p> <p> Vis&nbsp;<span>dom</span>! </p> </div> "##; let root = Vis::load(html)?; let content = root.find("#content"); assert_eq!(content.find("p:contains('Visdom')").length(), 2); assert_eq!(content.find("p:contains(\"Vis dom\")").length(), 0); // no quote assert_eq!(content.find("p:contains(Visdom)").length(), 2); // contains empty assert_eq!( content.find("p:contains()").length(), content.find("p").length() ); Ok(()) }
rust_cleaned_test_functions.jsonl/58020
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 442 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 28890, 620, 21952, 63598, 368, 1464, 5714, 341, 10217, 5272, 284, 435, 2, 22476, 71, 16, 29, 13683, 522, 71, 16, 1784, 611, 43875, 27066, 11347, 611, 9877, 2, 280, 10217, 3704, 284, 7656, 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_decode_max_u64() { let max_vec_encoded = vec![0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01]; assert_eq!( u64::decode_var(max_vec_encoded.as_slice()).unwrap().0, u64::max_value() ); }
rust_cleaned_test_functions.jsonl/80004
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 165 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15227, 6345, 7300, 21, 19, 368, 341, 286, 1077, 1932, 13251, 73069, 284, 7486, 20703, 15, 9264, 11, 220, 15, 9264, 11, 220, 15, 9264, 11, 220, 15, 9264, 11, 220, 15, 9264, 11, 220, 15, 9264,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_char_column_builder() { let item_each_block = (128 - 16) / 8; let mut builder = CharColumnBuilder::new( false, Some(8), ColumnBuilderOptions::default_for_block_test(), ); for _ in 0..10 { builder.append(&Utf8Array::from_iter( [Some("2333")].iter().cycle().cloned().take(item_each_block), )); } let (index, _) = builder.finish(); assert_eq!(index.len(), 10); assert_eq!(index[3].first_rowid as usize, item_each_block * 3); assert_eq!(index[3].row_count as usize, item_each_block); }
rust_cleaned_test_functions.jsonl/14126
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 332 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9232, 8744, 28532, 368, 341, 286, 1077, 1509, 32046, 7113, 284, 320, 16, 17, 23, 481, 220, 16, 21, 8, 608, 220, 23, 280, 286, 1077, 5206, 7363, 284, 4864, 2933, 3297, 486, 931, 1006, 310, 89...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_orbit() { let y0 = Vector6::<f64>::new(6450e3, 0., 0., 0., 7.66e3, 0.); let t0 = 0.; let t1 = 100.; let h = 100.; // let gm = 3.9860044188E14; /// Point accelerating at 2. m/s^2 fn earth_point_mass(s: Vector6<f64>, _: f64) -> Vector6<f64> { let gm = 3.9860044188E14; let r = s.rows_range(..3); let v = s.rows_range(3..); let a = -gm / r.norm().powi(3) * r; println!("[{}, {}, {}],", s[0], s[1], s[2]); Vector6::<f64>::new(v[0], v[1], v[2], a[0], a[1], a[2]) } let mut integrator = rk::RK4::new(y0, [t0, t1], h, earth_point_mass); integrator.step((92.68 * 60. / h) as isize); println!("{:?}", integrator.y); }
rust_cleaned_test_functions.jsonl/116545
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 472 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8734, 4489, 368, 341, 286, 1077, 379, 15, 284, 4196, 21, 27638, 69, 21, 19, 6831, 931, 7, 21, 19, 20, 15, 68, 18, 11, 220, 15, 2572, 220, 15, 2572, 220, 15, 2572, 220, 22, 13, 21, 21, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_blkio_read_iops() { let (tmp, throttle) = setup("test_set_blkio_read_iops", BLKIO_THROTTLE_READ_IOPS); let blkio = LinuxBlockIoBuilder::default() .throttle_read_iops_device(vec![LinuxThrottleDeviceBuilder::default() .major(8) .minor(0) .rate(102400u64) .build() .unwrap()]) .build() .unwrap(); Blkio::apply(&tmp, &blkio).expect("apply blkio"); let content = fs::read_to_string(throttle) .unwrap_or_else(|_| panic!("read {} content", BLKIO_THROTTLE_READ_IOPS)); assert_eq!("8:0 102400", content); }
rust_cleaned_test_functions.jsonl/130562
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 385 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2602, 51969, 815, 6443, 5318, 3721, 368, 341, 286, 1077, 320, 5173, 11, 42166, 8, 284, 6505, 445, 1944, 2602, 51969, 815, 6443, 5318, 3721, 497, 14850, 42, 3810, 10625, 1285, 14903, 867, 13117, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_leader_only_commits_log_from_current_term() { let l = default_logger(); let ents = vec![empty_entry(1, 2), empty_entry(2, 3)]; let mut tests = vec![ // do not commit log entries in previous terms (1, 1), (2, 1), // commit log in current term (4, 4), ]; for (i, (index, wcommit)) in tests.drain(..).enumerate() { let mut r = { let store = MemStorage::new_with_conf_state((vec![1, 2], vec![])); store.wl().append(&ents).unwrap(); let cfg = new_test_config(1, 10, 1); new_test_raft_with_config(&cfg, store, &l) }; r.load_state(&hard_state(2, 1, 0)); // become leader at term 3 r.become_candidate(); r.become_leader(); r.read_messages(); // propose a entry to current term r.step(new_message(1, 1, MessageType::MsgPropose, 1)) .expect(""); let mut m = new_message(2, 1, MessageType::MsgAppendResponse, 0); m.term = r.term; m.index = index; r.step(m).expect(""); if r.raft_log.committed != wcommit { panic!( "#{}: commit = {}, want {}", i, r.raft_log.committed, wcommit ); } } }
rust_cleaned_test_functions.jsonl/62312
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 666 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 79991, 18410, 25149, 1199, 5224, 5673, 11080, 17464, 368, 341, 262, 1077, 326, 284, 1638, 27413, 543, 262, 1077, 36852, 284, 7486, 20703, 3194, 9078, 7, 16, 11, 220, 17, 701, 4287, 9078, 7, 17, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_num_squaring() { let mut cs = TestConstraintSystem::<Bls12>::new(); let n = AllocatedNum::alloc(&mut cs, || Ok(Fr::from_str("3").unwrap())).unwrap(); let n2 = n.square(&mut cs).unwrap(); assert!(cs.is_satisfied()); assert!(cs.get("squared num") == Fr::from_str("9").unwrap()); assert!(n2.value.unwrap() == Fr::from_str("9").unwrap()); cs.set("squared num", Fr::from_str("10").unwrap()); assert!(!cs.is_satisfied()); }
rust_cleaned_test_functions.jsonl/4262
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 239 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4273, 643, 446, 3249, 368, 341, 286, 1077, 5206, 10532, 284, 3393, 17890, 2320, 27638, 33, 4730, 16, 17, 6831, 931, 1428, 286, 1077, 308, 284, 1674, 39463, 4651, 486, 4742, 2099, 6984, 10532, 11...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_version() { let version = botan::Version::current().unwrap(); assert_eq!(version.major, 2); assert!(version.minor >= 8); assert!(version.release_date == 0 || version.release_date >= 20181001); assert!(version.ffi_api >= 20180713); assert!(botan::Version::supports_version(version.ffi_api)); assert!(botan::Version::supports_version(20180713)); assert!(!botan::Version::supports_version(20180712)); assert!(version.at_least(2,8)); assert!(version.at_least(2,4)); assert!(version.at_least(1,100)); /* We know we are not linked against Botan 3.x because botan-sys crate links to botan-2 and the library name will change in a new major release. */ assert!(!version.at_least(3,1)); }
rust_cleaned_test_functions.jsonl/95285
{ "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, 9438, 368, 341, 262, 1077, 2319, 284, 10924, 276, 486, 5637, 486, 3231, 1005, 15454, 1428, 14808, 262, 2060, 10714, 10297, 4366, 75412, 11, 220, 17, 317, 262, 2060, 10297, 4366, 4358, 269, 2604, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_media_params() { let mut p = MediaParams::new("charset=utf-8"); let (k, v) = p.next().unwrap().unwrap(); assert_eq!(k, "charset"); assert_eq!(v, ParamValue::Unquoted("utf-8")); assert!(p.next().is_none()); let mut p = MediaParams::new(" charset=\"utf-8\""); let (k, v) = p.next().unwrap().unwrap(); assert_eq!(k, "charset"); assert_eq!(v, ParamValue::Quoted("utf-8")); assert!(p.next().is_none()); let mut p = MediaParams::new( " \tcharset=utf-8; chars=\"utf-42; wat\";key=\"some \\\"value\\\"\"; k=v \t\t" ); let (k, v) = p.next().unwrap().unwrap(); assert_eq!(k, "charset"); assert_eq!(v, ParamValue::Unquoted("utf-8")); let (k, v) = p.next().unwrap().unwrap(); assert_eq!(k, "chars"); assert_eq!(v, ParamValue::Quoted("utf-42; wat")); let (k, v) = p.next().unwrap().unwrap(); assert_eq!(k, "key"); assert_eq!(v, ParamValue::Quoted("some \\\"value\\\"")); let (k, v) = p.next().unwrap().unwrap(); assert_eq!(k, "k"); assert_eq!(v, ParamValue::Unquoted("v")); assert!(p.next().is_none()); }
rust_cleaned_test_functions.jsonl/58204
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 642 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 29173, 6745, 368, 341, 286, 1077, 5206, 281, 284, 7816, 4870, 486, 931, 445, 25327, 22264, 12, 23, 3071, 286, 1077, 320, 74, 11, 348, 8, 284, 281, 4529, 1005, 15454, 1005, 15454, 543, 286, 206...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_check_backward() { let warrior = warrior_at_level(6); assert_eq!(warrior.check_toward(Direction::Backward), Tile::Wall); let behind = [Tile::Empty, Tile::Stairs, Tile::Unit(UnitType::Sludge)]; for tile in &behind { let warrior = warrior_with_behind(6, vec![*tile]); assert_eq!(warrior.check_toward(Direction::Backward), *tile); } }
rust_cleaned_test_functions.jsonl/72734
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 162 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 7200, 70477, 368, 341, 262, 1077, 37390, 284, 37390, 3752, 8274, 7, 21, 317, 262, 2060, 10714, 10297, 11455, 3254, 9093, 528, 81971, 81740, 486, 3707, 1606, 701, 20744, 486, 32597, 626, 262, 1077,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_match_group_pattern_with_multiple_statement() { check( r#" macro_rules! m { ($($i:ident),*) => ( fn baz() { $($i ();)* } ); } m! { foo, bar } "#, expect![[r#" macro_rules! m { ($($i:ident),*) => ( fn baz() { $($i ();)* } ); } fn baz() { foo(); bar(); } "#]], ) }
rust_cleaned_test_functions.jsonl/85206
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 172 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10708, 6288, 21260, 6615, 45233, 37404, 368, 341, 262, 1779, 1006, 286, 435, 2, 698, 32606, 21407, 0, 296, 341, 262, 1711, 699, 72, 25, 1713, 701, 3764, 589, 320, 5168, 50247, 368, 314, 93977, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_wait_for_supermajority() { solana_logger::setup(); use solana_sdk::hash::hash; let node_keypair = Arc::new(Keypair::new()); let cluster_info = ClusterInfo::new( ContactInfo::new_localhost(&node_keypair.pubkey(), timestamp()), node_keypair, ); let (genesis_config, _mint_keypair) = create_genesis_config(1); let bank = Arc::new(Bank::new(&genesis_config)); let mut config = ValidatorConfig::default(); let rpc_override_health_check = Arc::new(AtomicBool::new(false)); let start_progress = Arc::new(RwLock::new(ValidatorStartProgress::default())); assert!(!wait_for_supermajority( &config, &bank, &cluster_info, rpc_override_health_check.clone(), &start_progress, ) .unwrap()); config.wait_for_supermajority = Some(1); assert_eq!( wait_for_supermajority( &config, &bank, &cluster_info, rpc_override_health_check.clone(), &start_progress, ), Err(ValidatorError::NotEnoughLedgerData) ); let bank = Bank::new_from_parent(&bank, &Pubkey::default(), 1); config.wait_for_supermajority = Some(0); assert!(!wait_for_supermajority( &config, &bank, &cluster_info, rpc_override_health_check.clone(), &start_progress, ) .unwrap()); config.wait_for_supermajority = Some(1); config.expected_bank_hash = Some(hash(&[1])); assert_eq!( wait_for_supermajority( &config, &bank, &cluster_info, rpc_override_health_check, &start_progress, ), Err(ValidatorError::BadExpectedBankHash) ); }
rust_cleaned_test_functions.jsonl/13042
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1084 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 18760, 5478, 38886, 36505, 487, 368, 341, 286, 2048, 3362, 27413, 486, 15188, 543, 286, 990, 2048, 3362, 61783, 486, 8296, 486, 8296, 280, 286, 1077, 2436, 3097, 12670, 284, 19689, 486, 931, 7, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_pooling_allocator_with_memory_pages_exeeded() { assert_eq!( PoolingInstanceAllocator::new( PoolingAllocationStrategy::Random, ModuleLimits { memory_pages: 0x10001, ..Default::default() }, InstanceLimits { count: 1, memory_reservation_size: 1, }, 4096 ) .map_err(|e| e.to_string()) .expect_err("expected a failure constructing instance allocator"), "module memory page limit of 65537 exceeds the maximum of 65536" ); }
rust_cleaned_test_functions.jsonl/132224
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 395 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15709, 287, 56910, 6615, 19195, 21655, 2702, 12051, 291, 368, 341, 286, 2060, 10714, 33673, 310, 22728, 287, 2523, 42730, 486, 931, 1006, 394, 22728, 287, 78316, 19816, 486, 13999, 345, 394, 13711, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_scalar_repr_shr() { let mut a = ScalarRepr::new([ 0xb33fbaec482a283f, 0x997de0d3a88cb3df, 0x9af62d2a9a0e5525, 0x36003ab08de70da1, ]); a.shr(0); assert_eq!( a, ScalarRepr::new([ 0xb33fbaec482a283f, 0x997de0d3a88cb3df, 0x9af62d2a9a0e5525, 0x36003ab08de70da1 ]) ); a.shr(1); assert_eq!( a, ScalarRepr::new([ 0xd99fdd762415141f, 0xccbef069d44659ef, 0xcd7b16954d072a92, 0x1b001d5846f386d0 ]) ); a.shr(50); assert_eq!( a, ScalarRepr::new([ 0xbc1a7511967bf667, 0xc5a55341caa4b32f, 0x75611bce1b4335e, 0x6c0 ]) ); a.shr(130); assert_eq!(a, ScalarRepr::new([0x1d5846f386d0cd7, 0x1b0, 0x0, 0x0])); a.shr(64); assert_eq!(a, ScalarRepr::new([0x1b0, 0x0, 0x0, 0x0])); }
rust_cleaned_test_functions.jsonl/56390
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 851 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 41652, 68535, 3712, 81, 368, 341, 286, 1077, 5206, 264, 284, 35176, 693, 649, 486, 931, 8956, 310, 220, 15, 7929, 18, 18, 69, 4645, 757, 19, 23, 17, 64, 17, 23, 18, 69, 345, 310, 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_from_iter() { let xs = [(1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6)]; let map: HashMap<_, _> = xs.iter().cloned().collect(); for &(k, v) in &xs { assert_eq!(map.get(&k), Some(&v)); } }
rust_cleaned_test_functions.jsonl/8518
{ "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, 5673, 11723, 368, 341, 286, 1077, 11943, 284, 17826, 16, 11, 220, 16, 701, 320, 17, 11, 220, 17, 701, 320, 18, 11, 220, 18, 701, 320, 19, 11, 220, 19, 701, 320, 20, 11, 220, 20, 701, 320...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_eval_val_offset() { let cie = make_test_cie(); let ctx = UnwindContext::new(); let mut expected = ctx.clone(); expected .set_register_rule( Register(5), RegisterRule::ValOffset(7 * cie.data_alignment_factor), ) .unwrap(); let instructions = [( Ok(false), CallFrameInstruction::ValOffset { register: Register(5), factored_offset: 7, }, )]; assert_eval(ctx, expected, cie, None, instructions); }
rust_cleaned_test_functions.jsonl/9358
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 330 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21296, 6189, 6917, 368, 341, 286, 1077, 272, 645, 284, 1281, 4452, 666, 645, 543, 286, 1077, 5635, 284, 1230, 19154, 1972, 486, 931, 543, 286, 1077, 5206, 3601, 284, 5635, 15997, 543, 286, 3601,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_remove_empty_segments() { assert_eq!("123", &remove_empty_segments("123")); assert_eq!("123", &remove_empty_segments(".123")); assert_eq!("123", &remove_empty_segments("..123")); assert_eq!("123", &remove_empty_segments("....123")); assert_eq!("abc.123", &remove_empty_segments("abc.123")); assert_eq!("abc.123", &remove_empty_segments("abc..123")); assert_eq!("abc.123", &remove_empty_segments("abc...123")); assert_eq!("abc.123", &remove_empty_segments("abc.....123")); assert_eq!("123", &remove_empty_segments("123.")); assert_eq!("123", &remove_empty_segments("123..")); assert_eq!("123", &remove_empty_segments("123....")); assert_eq!("abc.123", &remove_empty_segments("abc.123.")); assert_eq!("abc.123", &remove_empty_segments("abc.123..")); assert_eq!("abc.123", &remove_empty_segments("abc.123....")); assert_eq!("", &remove_empty_segments(".")); assert_eq!("", &remove_empty_segments("..")); assert_eq!("", &remove_empty_segments("....")); }
rust_cleaned_test_functions.jsonl/34891
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 500 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 18193, 15124, 55735, 368, 341, 286, 2060, 10714, 17223, 16, 17, 18, 497, 609, 5399, 15124, 55735, 445, 16, 17, 18, 4010, 286, 2060, 10714, 17223, 16, 17, 18, 497, 609, 5399, 15124, 55735, 5680, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_select_peer() { assert_eq!(select_random_peers(1..=3, &create_peers(2)).len(), 1); assert_eq!(select_random_peers(2..=5, &create_peers(9)).len(), 3); assert_eq!(select_random_peers(8..=128, &create_peers(3)).len(), 3); assert_eq!(select_random_peers(8..=128, &create_peers(4)).len(), 4); assert_eq!(select_random_peers(8..=128, &create_peers(10)).len(), 8); assert_eq!(select_random_peers(8..=128, &create_peers(25)).len(), 8); assert_eq!(select_random_peers(8..=128, &create_peers(64)).len(), 8); }
rust_cleaned_test_functions.jsonl/40058
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 283 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13051, 45159, 368, 341, 286, 2060, 10714, 10297, 1742, 22644, 36367, 388, 7, 16, 496, 28, 18, 11, 609, 3182, 36367, 388, 7, 17, 4579, 2892, 1507, 220, 16, 317, 286, 2060, 10714, 10297, 1742, 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_all_claimable_balances_by_native_asset_request_uri() { let req = all_by_asset(Asset::new_native()); let uri = req.uri(&host()).unwrap(); assert!(uri .to_string() .starts_with("https://horizon.stellar.org/claimable_balances?")); let query: HashMap<_, _> = uri.query_pairs().into_owned().collect(); assert_eq!(Some(&"native".to_string()), query.get("asset")); }
rust_cleaned_test_functions.jsonl/61927
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 212 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5705, 84969, 480, 56441, 3020, 3710, 44494, 42299, 7893, 15572, 368, 341, 286, 1077, 4232, 284, 678, 3710, 42299, 7, 16604, 486, 931, 44494, 1423, 286, 1077, 13071, 284, 4232, 42304, 2099, 3790, 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_iterator_skip_last() { let xs = [0, 1, 2, 3, 5, 13, 15, 16, 17, 19, 20, 30]; assert_eq!(xs.iter().skip(0).last(), Some(&30)); assert_eq!(xs.iter().skip(1).last(), Some(&30)); assert_eq!(xs.iter().skip(11).last(), Some(&30)); assert_eq!(xs.iter().skip(12).last(), None); assert_eq!(xs.iter().skip(13).last(), None); let mut it = xs.iter().skip(5); assert_eq!(it.next(), Some(&13)); assert_eq!(it.last(), Some(&30)); }
rust_cleaned_test_functions.jsonl/25911
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 218 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13491, 44830, 12195, 368, 341, 262, 1077, 11943, 284, 508, 15, 11, 220, 16, 11, 220, 17, 11, 220, 18, 11, 220, 20, 11, 220, 16, 18, 11, 220, 16, 20, 11, 220, 16, 21, 11, 220, 16, 22, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_stacked_porep_circuit_poseidon_base_2() { test_stacked_porep_circuit::<DiskTree<PoseidonHasher, U2, U0, U0>>(22, 1_206_212); }
rust_cleaned_test_functions.jsonl/103089
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 78 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1261, 11191, 620, 460, 79, 666, 37268, 33201, 90456, 7651, 62, 17, 368, 341, 262, 1273, 1261, 11191, 620, 460, 79, 666, 37268, 27638, 47583, 6533, 21604, 960, 90456, 6370, 261, 11, 547, 17, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_sms_new_uncompressed() { let mut sms = new_sms( 01239468786, 01239468999, "The quick brown fox jumps over the lazy dog", false, ) .unwrap(); let bin_bundle = sms.to_cbor(); dbg!(bin_bundle.len()); dbg!(bp7::hexify(&bin_bundle)); }
rust_cleaned_test_functions.jsonl/14790
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 205 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 58567, 5921, 4907, 45703, 368, 341, 286, 1077, 5206, 37929, 284, 501, 58567, 1006, 310, 220, 15, 16, 17, 18, 24, 19, 21, 23, 22, 23, 21, 345, 310, 220, 15, 16, 17, 18, 24, 19, 21, 23, 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_separate_initial_overlap() { let mut collider = Collider::<TestHbProfile>::new(4.0, 0.25); let overlaps = collider.add_hitbox( 0.into(), Shape::square(1.).place(v2(0., 0.)).moving(v2(0.0, 1.)), ); assert_eq!(overlaps, vec![]); let overlaps = collider.add_hitbox(1.into(), Shape::square(1.).place(v2(0., 0.)).still()); assert_eq!(overlaps, vec![0.into()]); advance_to_event(&mut collider, 1.25); assert_eq!( collider.next(), Some((HbEvent::Separate, 0.into(), 1.into())) ); advance(&mut collider, 1.5); }
rust_cleaned_test_functions.jsonl/36384
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 283 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3453, 67598, 15809, 65794, 368, 341, 262, 1077, 5206, 65544, 284, 73821, 27638, 2271, 39, 65, 8526, 6831, 931, 7, 19, 13, 15, 11, 220, 15, 13, 17, 20, 626, 262, 1077, 76007, 284, 65544, 1364, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_simplify_dir_rm_subdir() { let mut correct = HashSet::new(); correct.insert(["a", "b"].iter().collect::<PathBuf>()); assert_eq!(simplify_dir_names(vec!["a/b", "a/b/c", "a/b/d/f"]), correct); }
rust_cleaned_test_functions.jsonl/32363
{ "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, 643, 70206, 4334, 58537, 5228, 3741, 368, 341, 286, 1077, 5206, 4396, 284, 18931, 486, 931, 543, 286, 4396, 7030, 19065, 64, 497, 330, 65, 5521, 2015, 1005, 17384, 27638, 1820, 15064, 32872, 286, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_parse_ago() { set_default_offset(7200); // I believe the comparisons are rounded up to the next largest duration size // doesn't really make sense. assert_eq!(d("10m ago", Duration::hours(1)), "0"); assert_eq!(d("10 min ago", Duration::hours(1)), "0"); assert_eq!(d("10 minutes ago", Duration::hours(1)), "0"); assert_eq!(d("10 hours ago", Duration::days(1)), "0"); assert_eq!(d("10 h ago", Duration::days(1)), "0"); assert_eq!(t("9999999 years ago"), "0 7200"); }
rust_cleaned_test_functions.jsonl/122510
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 252 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 62, 6304, 368, 341, 286, 738, 9993, 6917, 7, 22, 17, 15, 15, 317, 286, 442, 358, 4411, 279, 35495, 525, 17976, 705, 311, 279, 1790, 7772, 8090, 1379, 8945, 286, 442, 3171, 944, 2167, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_sar_reg_reg() { assert_emit!(0xD3, 0xF8; emit_sar_reg_cl(0, RAX)); assert_emit!(0x41, 0xD3, 0xF9; emit_sar_reg_cl(0, R9)); assert_emit!(0x48, 0xD3, 0xF8; emit_sar_reg_cl(1, RAX)); assert_emit!(0x49, 0xD3, 0xF9; emit_sar_reg_cl(1, R9)); }
rust_cleaned_test_functions.jsonl/85468
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 191 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 643, 277, 4920, 4920, 368, 341, 286, 2060, 69082, 10297, 15, 15764, 18, 11, 220, 15, 9770, 23, 26, 16691, 643, 277, 4920, 6794, 7, 15, 11, 431, 2954, 1106, 286, 2060, 69082, 10297, 15, 87, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_simple_types() { assert_eq!(1i.to_string(), "1"); assert_eq!((-1i).to_string(), "-1"); assert_eq!(200u.to_string(), "200"); assert_eq!(2u8.to_string(), "2"); assert_eq!(true.to_string(), "true"); assert_eq!(false.to_string(), "false"); assert_eq!(().to_string(), "()"); assert_eq!(("hi".to_string()).to_string(), "hi"); }
rust_cleaned_test_functions.jsonl/60
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 211 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 30015, 9763, 368, 341, 286, 2060, 10714, 10297, 16, 72, 2389, 3904, 1507, 330, 16, 797, 286, 2060, 10714, 0, 54934, 16, 72, 568, 983, 3904, 1507, 6523, 16, 797, 286, 2060, 10714, 10297, 17, 15...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_intersect_point() { //intersection { let a = TriPrism::init(&[0., 0., 0., 1., 0., 0., 1., 1., 0.], 1.); let b = Point3::init(&[0.25, 0.25, 0.]); match a.get_intersect(&b) { (true, Some(loc)) => { assert!(loc.is_equal(&b._ori, 0.0001f64).unwrap()); } _ => panic!("unexpected result for triprism point intersection"), } } //intersection { let a = TriPrism::init(&[0., 0., 0., 1., 0., 0., 1., 1., 0.], 1.); let b = Point3::init(&[0.25, 0.25, 0.5]); match a.get_intersect(&b) { (true, Some(loc)) => { assert!(loc.is_equal(&b._ori, 0.0001f64).unwrap()); } _ => panic!("unexpected result for triprism point intersection"), } } //intersection { let a = TriPrism::init(&[0., 0., 0., 1., 0., 0., 1., 1., 0.], 1.); let b = Point3::init(&[0.25, 0.25, 1.]); match a.get_intersect(&b) { (true, Some(loc)) => { assert!(loc.is_equal(&b._ori, 0.0001f64).unwrap()); } _ => panic!("unexpected result for triprism point intersection"), } } { let a = TriPrism::init(&[0., 0., 0., 1., 0., 0., 1., 1., 0.], 1.); let b = Point3::init(&[0.25, 0.25, 0.]); match b.get_intersect(&a) { (true, Some(loc)) => { assert!(loc.is_equal(&b._ori, 0.0001f64).unwrap()); } _ => panic!("unexpected result for triprism point intersection"), } } { let a = TriPrism::init(&[0., 0., 0., 1., 0., 0., 1., 1., 0.], 1.); let b = Point3::init(&[0.25, 0.25, 0.5]); match b.get_intersect(&a) { (true, Some(loc)) => { assert!(loc.is_equal(&b._ori, 0.0001f64).unwrap()); } _ => panic!("unexpected result for triprism point intersection"), } } { let a = TriPrism::init(&[0., 0., 0., 1., 0., 0., 1., 1., 0.], 1.); let b = Point3::init(&[0.25, 0.25, 1.]); match b.get_intersect(&a) { (true, Some(loc)) => { assert!(loc.is_equal(&b._ori, 0.0001f64).unwrap()); } _ => panic!("unexpected result for triprism point intersection"), } } //no intersection { let a = TriPrism::init(&[0., 0., 0., 1., 0., 0., 1., 1., 0.], 1.); let b = Point3::init(&[0.25, 0.25, 1.001]); match a.get_intersect(&b) { (false, None) => (), _ => panic!("unexpected result for triprism point no intersection"), } } //no intersection { let a = TriPrism::init(&[0., 0., 0., 1., 0., 0., 1., 1., 0.], 1.); let b = Point3::init(&[0.5, 0.55, 0.5]); match a.get_intersect(&b) { (false, None) => (), _ => panic!("unexpected result for triprism point no intersection"), } } }
rust_cleaned_test_functions.jsonl/69751
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1612 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 72747, 6085, 368, 341, 262, 442, 73648, 198, 262, 341, 286, 1077, 264, 284, 12359, 3533, 2142, 486, 2327, 2099, 58, 15, 2572, 220, 15, 2572, 220, 15, 2572, 220, 16, 2572, 220, 15, 2572, 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...
9
#[test] fn test_select() { assert_parse!("SELECT 1", select); assert_parse!("SELECT 1, 'test'", select); assert_parse!("SELECT * FROM test WHERE 1", select); let c = "SELECT t1.c1 as t1c1 FROM test WHERE 1 GROUP BY id HAVING count(*) > 1"; let pairs = BqlParser::parse(Rule::select, c) .unwrap_or_else(|e| panic!("{}", e)); println!("{}", pretty_parse_tree(pairs)); let c = "select ss_item_sk ,ss_ticket_number ,ss_customer_sk ,case when sr_return_quantity is not null then (ss_quantity-sr_return_quantity)*ss_sales_price else (ss_quantity*ss_sales_price) end act_sales from store_sales left outer join store_returns on (sr_item_sk = ss_item_sk and sr_ticket_number = ss_ticket_number) ,reason where sr_reason_sk = r_reason_sk and r_reason_desc = 'Package was damaged'"; assert_parse!(c, select); }
rust_cleaned_test_functions.jsonl/76156
{ "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, 13051, 368, 341, 310, 2060, 21039, 17223, 4858, 220, 16, 497, 3293, 317, 310, 2060, 21039, 17223, 4858, 220, 16, 11, 364, 1944, 22772, 3293, 626, 310, 2060, 21039, 17223, 4858, 353, 4295, 1273, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_inline_raw_latex() { let source = r#"##- \begin{center} the \TeX \end{center} -##"#; let expected_toktype = vec![TokenType::RawLatex]; let expected_literal = r#" \begin{center} the \TeX \end{center} "#; let lex = Lexer::new(source); let lexed_token = lex .clone() .map(|lextok| lextok.token.toktype) .collect::<Vec<TokenType>>(); let lexed_literal = lex .map(|lextok| lextok.token.literal) .collect::<Vec<String>>() .concat(); assert_eq!(lexed_token, expected_toktype); assert_eq!(lexed_literal, expected_literal); }
rust_cleaned_test_functions.jsonl/108897
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 302 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 41871, 16067, 26174, 327, 368, 341, 262, 1077, 2530, 284, 435, 55543, 565, 6913, 59, 7265, 90, 3057, 532, 220, 279, 1124, 54963, 198, 59, 408, 90, 3057, 532, 12, 565, 57676, 280, 262, 1077, 36...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1