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_new_signaling_state() { let tests = vec![ ("Unspecified", RTCSignalingState::Unspecified), ("stable", RTCSignalingState::Stable), ("have-local-offer", RTCSignalingState::HaveLocalOffer), ("have-remote-offer", RTCSignalingState::HaveRemoteOffer), ("have-local-pranswer", RTCSignalingState::HaveLocalPranswer), ( "have-remote-pranswer", RTCSignalingState::HaveRemotePranswer, ), ("closed", RTCSignalingState::Closed), ]; for (state_string, expected_state) in tests { assert_eq!(expected_state, RTCSignalingState::from(state_string)); } }
rust_cleaned_test_functions.jsonl/115798
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 354 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5921, 11172, 6132, 4387, 368, 341, 286, 1077, 7032, 284, 7486, 90515, 310, 3489, 1806, 53434, 497, 10635, 6412, 622, 6132, 1397, 486, 1806, 53434, 1326, 310, 3489, 27992, 497, 10635, 6412, 622, 61...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_duplicated_transaction() { let (p_key, s_key) = gen_keypair(); let db = Arc::from(Box::new(MemoryDB::new()) as Box<dyn Database>) as Arc<dyn Database>; let services = vec![Box::new(TestService) as Box<dyn Service>]; let node_cfg = helpers::generate_testnet_config(1, 16_500)[0].clone(); let mut node = Node::new(db, services, node_cfg, None); let tx = create_simple_tx(p_key, &s_key); // Create original transaction. let tx_orig = tx.clone(); let event = ExternalMessage::Transaction(tx_orig); node.handler.handle_event(event.into()); // Initial transaction should be added to the pool. let snapshot = node.blockchain().snapshot(); let schema = Schema::new(&snapshot); assert_eq!(schema.transactions_pool_len(), 1); // Create duplicated transaction. let tx_copy = tx.clone(); let event = ExternalMessage::Transaction(tx_copy); node.handler.handle_event(event.into()); // Duplicated transaction shouldn't be added to the pool. let snapshot = node.blockchain().snapshot(); let schema = Schema::new(&snapshot); assert_eq!(schema.transactions_pool_len(), 1); }
rust_cleaned_test_functions.jsonl/22029
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 509 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 814, 98984, 28884, 368, 341, 286, 1077, 320, 79, 3097, 11, 274, 3097, 8, 284, 4081, 3097, 12670, 1428, 286, 1077, 2927, 284, 19689, 486, 1499, 67758, 486, 931, 3189, 4731, 3506, 486, 931, 2140, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_324_fragment_expansion() { let mut templates = [ UriTemplate::new("{#var}"), UriTemplate::new("{#hello}"), UriTemplate::new("{#half}"), UriTemplate::new("foo{#empty}"), UriTemplate::new("foo{#undef}"), UriTemplate::new("{#x,hello,y}"), UriTemplate::new("{#path,x}/here"), UriTemplate::new("{#path:6}/here"), UriTemplate::new("{#list}"), UriTemplate::new("{#list*}"), UriTemplate::new("{#keys}"), ]; for i in 0..templates.len() { templates[i].set("dub", "me/too"); templates[i].set("v", "6"); templates[i].set("var", "value"); templates[i].set("hello", "Hello World!"); templates[i].set("list", &["red", "green", "blue"] as &[&str]); templates[i].set("dom", &["example", "com"] as &[&str]); templates[i].set("count", &["one", "two", "three"] as &[&str]); templates[i].set("half", "50%"); templates[i].set("x", "1024"); templates[i].set( "keys", &[("semi", ";"), ("dot", "."), ("comma", ",")] as &[(&str, &str)], ); templates[i].set("y", "768"); templates[i].set("who", "fred"); templates[i].set("empty", ""); templates[i].set("path", "/foo/bar"); templates[i].set("empty_keys", &[] as &[&str]); templates[i].set("base", "http://example.com/home/"); } assert_eq!(templates[0].build(), "#value"); assert_eq!(templates[1].build(), "#Hello%20World!"); assert_eq!(templates[2].build(), "#50%25"); assert_eq!(templates[3].build(), "foo#"); assert_eq!(templates[4].build(), "foo"); assert_eq!(templates[5].build(), "#1024,Hello%20World!,768"); assert_eq!(templates[6].build(), "#/foo/bar,1024/here"); assert_eq!(templates[7].build(), "#/foo/b/here"); assert_eq!(templates[8].build(), "#red,green,blue"); assert_eq!(templates[9].build(), "#red,green,blue"); let template_10_answers = vec![ "#comma,,,dot,.,semi,;", "#comma,,,semi,;,dot,.", "#dot,.,comma,,,semi,;", "#dot,.,semi,;,comma,,", "#semi,;,comma,,,dot,.", "#semi,;,dot,.,comma,,", ]; assert!(template_10_answers.contains(&templates[10].build().as_ref())); }
rust_cleaned_test_functions.jsonl/36934
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1101 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 62, 18, 17, 19, 43012, 14214, 10501, 368, 341, 262, 1077, 5206, 19911, 284, 2278, 286, 17226, 7275, 486, 931, 13976, 2, 947, 92, 4461, 286, 17226, 7275, 486, 931, 13976, 2, 14990, 92, 4461, 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...
2
#[test] fn test_email_get_and_put() { let (_app, _anon, user) = TestApp::init().with_user(); let json = user.show_me(); assert_eq!(json.user.email.unwrap(), "something@example.com"); user.update_email("mango@mangos.mango"); let json = user.show_me(); assert_eq!(json.user.email.unwrap(), "mango@mangos.mango"); assert!(!json.user.email_verified); assert!(json.user.email_verification_sent); }
rust_cleaned_test_functions.jsonl/34235
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 182 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9172, 3062, 8378, 15557, 368, 341, 262, 1077, 5453, 676, 11, 716, 58910, 11, 1196, 8, 284, 3393, 2164, 486, 2327, 1005, 4197, 3317, 1428, 262, 1077, 2951, 284, 1196, 5460, 16612, 543, 262, 2060,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_node_types_simple() { let node_types = get_node_types(InputGrammar { name: String::new(), extra_symbols: Vec::new(), external_tokens: Vec::new(), expected_conflicts: Vec::new(), variables_to_inline: Vec::new(), word_token: None, supertype_symbols: vec![], variables: vec![ Variable { name: "v1".to_string(), kind: VariableType::Named, rule: Rule::seq(vec![ Rule::field("f1".to_string(), Rule::named("v2")), Rule::field("f2".to_string(), Rule::string(";")), ]), }, Variable { name: "v2".to_string(), kind: VariableType::Named, rule: Rule::string("x"), }, ], }); assert_eq!( node_types[0], NodeInfoJSON { kind: "v1".to_string(), named: true, subtypes: None, children: None, fields: Some( vec![ ( "f1".to_string(), FieldInfoJSON { multiple: false, required: true, types: vec![NodeTypeJSON { kind: "v2".to_string(), named: true, }] } ), ( "f2".to_string(), FieldInfoJSON { multiple: false, required: true, types: vec![NodeTypeJSON { kind: ";".to_string(), named: false, }] } ), ] .into_iter() .collect() ) } ); assert_eq!( node_types[1], NodeInfoJSON { kind: ";".to_string(), named: false, subtypes: None, children: None, fields: None } ); assert_eq!( node_types[2], NodeInfoJSON { kind: "v2".to_string(), named: true, subtypes: None, children: None, fields: None } ); }
rust_cleaned_test_functions.jsonl/8317
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1978 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5084, 9763, 30015, 368, 341, 286, 1077, 2436, 9763, 284, 633, 5084, 9763, 29773, 97178, 341, 310, 829, 25, 923, 486, 931, 3148, 310, 4960, 55752, 25, 11312, 486, 931, 3148, 310, 9250, 28838, 25,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_error_display() { let orig = io::Error::new(io::ErrorKind::Other, "other"); let desc = orig.to_string(); let e = Error::from(orig); assert_eq!(format!("{}", e), desc); }
rust_cleaned_test_functions.jsonl/18012
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 108 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4096, 14825, 368, 341, 286, 1077, 2713, 284, 6399, 486, 1454, 486, 931, 37258, 486, 1454, 10629, 486, 11409, 11, 330, 1575, 797, 286, 1077, 6560, 284, 2713, 2389, 3904, 543, 286, 1077, 384, 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
#[test] fn test_argon2() { let django = Django { version: DjangoVersion::V4_0, }; let encoded = django.make_password_with_algorithm("lètmein", Algorithm::Argon2); assert!(is_password_usable(&encoded)); assert!(encoded.starts_with("argon2$")); assert!(check_password("lètmein", &encoded).unwrap()); assert!(!check_password("lètmeinz", &encoded).unwrap()); // Blank passwords let blank_encoded = django.make_password_with_algorithm("", Algorithm::Argon2); assert!(blank_encoded.starts_with("argon2$")); assert!(is_password_usable(&blank_encoded)); assert!(check_password("", &blank_encoded).unwrap()); assert!(!check_password(" ", &blank_encoded).unwrap()); }
rust_cleaned_test_functions.jsonl/104485
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 291 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6057, 263, 17, 368, 341, 262, 1077, 8262, 284, 52604, 341, 286, 2319, 25, 52604, 5637, 486, 53, 19, 62, 15, 345, 262, 2605, 262, 1077, 20498, 284, 8262, 10117, 10122, 6615, 59531, 445, 75, 445...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_pod_condition() { let status = PodStatus { conditions: Some(vec![]), ..PodStatus::default() }; assert_eq!(None, get_pod_condition(&status, "doesntexist")); let condition = PodCondition { status: "OrNot".to_string(), type_: "Ready".to_string(), ..PodCondition::default() }; let status = PodStatus { conditions: Some(vec![condition.clone()]), ..PodStatus::default() }; assert_eq!(Some(&condition), get_pod_condition(&status, "Ready")); }
rust_cleaned_test_functions.jsonl/59342
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 295 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 85337, 27656, 368, 341, 286, 1077, 2639, 284, 16821, 2522, 341, 310, 4682, 25, 4329, 25592, 0, 1294, 1326, 310, 5241, 23527, 2522, 486, 2258, 741, 286, 2605, 286, 2060, 10714, 10297, 4064, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_use_tree_merge() { macro_rules! test_merge { ([$($input:expr),* $(,)*], [$($output:expr),* $(,)*]) => { assert_eq!( merge_use_trees(parse_use_trees!($($input,)*)), parse_use_trees!($($output,)*), ); } } test_merge!(["a::b::{c, d}", "a::b::{e, f}"], ["a::b::{c, d, e, f}"]); test_merge!(["a::b::c", "a::b"], ["a::b::{self, c}"]); test_merge!(["a::b", "a::b"], ["a::b"]); test_merge!(["a", "a::b", "a::b::c"], ["a::{self, b::{self, c}}"]); test_merge!( ["a::{b::{self, c}, d::e}", "a::d::f"], ["a::{b::{self, c}, d::{e, f}}"] ); test_merge!( ["a::d::f", "a::{b::{self, c}, d::e}"], ["a::{b::{self, c}, d::{e, f}}"] ); test_merge!( ["a::{c, d, b}", "a::{d, e, b, a, f}", "a::{f, g, c}"], ["a::{a, b, c, d, e, f, g}"] ); }
rust_cleaned_test_functions.jsonl/85154
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 660 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15951, 11663, 20888, 368, 341, 286, 18072, 21407, 0, 1273, 20888, 341, 310, 320, 3442, 699, 1355, 96011, 701, 9, 4930, 11, 4806, 1125, 24264, 699, 3006, 96011, 701, 9, 4930, 11, 4806, 2467, 589,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_reset_clear_bank() { let ledger_path = get_tmp_ledger_path!(); { let blockstore = Blockstore::open(&ledger_path) .expect("Expected to be able to open database ledger"); let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(2); let bank = Arc::new(Bank::new(&genesis_config)); let (mut poh_recorder, _entry_receiver, _record_receiver) = PohRecorder::new( 0, Hash::default(), 0, Some((4, 4)), bank.ticks_per_slot(), &Pubkey::default(), &Arc::new(blockstore), &Arc::new(LeaderScheduleCache::new_from_bank(&bank)), &Arc::new(PohConfig::default()), Arc::new(AtomicBool::default()), ); let start = Arc::new(Instant::now()); let working_bank = WorkingBank { bank, start, min_tick_height: 2, max_tick_height: 3, }; poh_recorder.set_working_bank(working_bank); poh_recorder.reset(hash(b"hello"), 0, Some((4, 4))); assert!(poh_recorder.working_bank.is_none()); } Blockstore::destroy(&ledger_path).unwrap(); }
rust_cleaned_test_functions.jsonl/39785
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 730 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 18983, 21811, 35733, 368, 341, 286, 1077, 46933, 2638, 284, 633, 16125, 38367, 1389, 2638, 0, 543, 286, 341, 310, 1077, 2504, 4314, 284, 8362, 4314, 486, 2508, 2099, 50704, 2638, 340, 394, 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_write_enum_to_chunk() { let data = [ ("a".as_bytes(), 3), ("b".as_bytes(), 2), ("c".as_bytes(), 1), ]; let res: &[u8] = &[ 3, 0, 0, 0, 0, 0, 0, 0, 97, // 1st 2, 0, 0, 0, 0, 0, 0, 0, 98, // 2nd 1, 0, 0, 0, 0, 0, 0, 0, 99, // 3rd ]; let mut buf = Vec::new(); for datum in &data { buf.write_enum_to_chunk(datum.1, datum.0) .expect("write_enum_to_chunk"); } assert_eq!(buf.as_slice(), res); }
rust_cleaned_test_functions.jsonl/77402
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 363 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9165, 31054, 2346, 30539, 368, 341, 286, 1077, 821, 284, 2278, 310, 3489, 64, 3263, 300, 12524, 1507, 220, 18, 1326, 310, 3489, 65, 3263, 300, 12524, 1507, 220, 17, 1326, 310, 3489, 66, 3263, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_process_instruction() { let callee_program_id = solana_sdk::pubkey::new_rand(); let builtin_programs = &[BuiltinProgram { program_id: callee_program_id, process_instruction: mock_process_instruction, }]; let owned_account = AccountSharedData::new(42, 1, &callee_program_id); let not_owned_account = AccountSharedData::new(84, 1, &solana_sdk::pubkey::new_rand()); let readonly_account = AccountSharedData::new(168, 1, &solana_sdk::pubkey::new_rand()); let loader_account = AccountSharedData::new(0, 0, &native_loader::id()); let mut program_account = AccountSharedData::new(1, 0, &native_loader::id()); program_account.set_executable(true); let accounts = vec![ (solana_sdk::pubkey::new_rand(), owned_account), (solana_sdk::pubkey::new_rand(), not_owned_account), (solana_sdk::pubkey::new_rand(), readonly_account), (callee_program_id, program_account), (solana_sdk::pubkey::new_rand(), loader_account), ]; let metas = vec![ AccountMeta::new(accounts.get(0).unwrap().0, false), AccountMeta::new(accounts.get(1).unwrap().0, false), AccountMeta::new_readonly(accounts.get(2).unwrap().0, false), ]; let instruction_accounts = (0..4) .map(|index_in_transaction| InstructionAccount { index_in_transaction, index_in_caller: 1 + index_in_transaction, is_signer: false, is_writable: index_in_transaction < 2, }) .collect::<Vec<_>>(); let mut transaction_context = TransactionContext::new(accounts, 2, 8); let mut invoke_context = InvokeContext::new_mock(&mut transaction_context, builtin_programs); // External modification tests { invoke_context .push(&instruction_accounts, &[4], &[]) .unwrap(); let inner_instruction = Instruction::new_with_bincode( callee_program_id, &MockInstruction::NoopSuccess, metas.clone(), ); // not owned account *invoke_context .transaction_context .get_account_at_index(1) .unwrap() .borrow_mut() .data_as_mut_slice() .get_mut(0) .unwrap() = 1; assert_eq!( invoke_context.native_invoke(inner_instruction.clone(), &[]), Err(InstructionError::ExternalAccountDataModified) ); *invoke_context .transaction_context .get_account_at_index(1) .unwrap() .borrow_mut() .data_as_mut_slice() .get_mut(0) .unwrap() = 0; // readonly account *invoke_context .transaction_context .get_account_at_index(2) .unwrap() .borrow_mut() .data_as_mut_slice() .get_mut(0) .unwrap() = 1; assert_eq!( invoke_context.native_invoke(inner_instruction, &[]), Err(InstructionError::ReadonlyDataModified) ); *invoke_context .transaction_context .get_account_at_index(2) .unwrap() .borrow_mut() .data_as_mut_slice() .get_mut(0) .unwrap() = 0; invoke_context.pop().unwrap(); } // Internal modification tests let cases = vec![ (MockInstruction::NoopSuccess, Ok(())), ( MockInstruction::NoopFail, Err(InstructionError::GenericError), ), (MockInstruction::ModifyOwned, Ok(())), ( MockInstruction::ModifyNotOwned, Err(InstructionError::ExternalAccountDataModified), ), ( MockInstruction::ModifyReadonly, Err(InstructionError::ReadonlyDataModified), ), ]; for case in cases { invoke_context .push(&instruction_accounts, &[4], &[]) .unwrap(); let inner_instruction = Instruction::new_with_bincode(callee_program_id, &case.0, metas.clone()); assert_eq!(invoke_context.native_invoke(inner_instruction, &[]), case.1); invoke_context.pop().unwrap(); } // Compute unit consumption tests let compute_units_to_consume = 10; let expected_results = vec![Ok(()), Err(InstructionError::GenericError)]; for expected_result in expected_results { invoke_context .push(&instruction_accounts, &[4], &[]) .unwrap(); let inner_instruction = Instruction::new_with_bincode( callee_program_id, &MockInstruction::ConsumeComputeUnits { compute_units_to_consume, desired_result: expected_result.clone(), }, metas.clone(), ); let (inner_instruction_accounts, program_indices) = invoke_context .prepare_instruction(&inner_instruction, &[]) .unwrap(); let mut compute_units_consumed = 0; let result = invoke_context.process_instruction( &inner_instruction.data, &inner_instruction_accounts, &program_indices, &mut compute_units_consumed, &mut ExecuteTimings::default(), ); // the number of compute units consumed should be a non-default which is something greater // than zero. assert!(compute_units_consumed > 0); assert_eq!(compute_units_consumed, compute_units_to_consume); assert_eq!(result, expected_result); invoke_context.pop().unwrap(); } }
rust_cleaned_test_functions.jsonl/14510
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 3330 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11305, 54923, 368, 341, 286, 1077, 94800, 25096, 842, 284, 2048, 3362, 61783, 486, 9585, 792, 486, 931, 33864, 543, 286, 1077, 59626, 25096, 82, 284, 44590, 33, 25628, 10690, 341, 310, 2025, 842, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
#[test] fn test_rel_base() { let mem = vec![ 109, 1, 204, -1, 1001, 100, 1, 100, 1008, 100, 16, 101, 1006, 101, 0, 99, ]; let mut m = Machine::new(&mem); let mut output = Vec::new(); m.run(|| unreachable!(), |x| output.push(x)); assert_eq!(mem, output); }
rust_cleaned_test_functions.jsonl/42160
{ "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, 13557, 7651, 368, 341, 286, 1077, 1833, 284, 7486, 90515, 310, 220, 16, 15, 24, 11, 220, 16, 11, 220, 17, 15, 19, 11, 481, 16, 11, 220, 16, 15, 15, 16, 11, 220, 16, 15, 15, 11, 220, 16...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_load_table_stats() { let action = Add { stats: Some( serde_json::json!({ "numRecords": 22, "minValues": {"a": 1, "nested": {"b": 2, "c": "a"}}, "maxValues": {"a": 10, "nested": {"b": 20, "c": "z"}}, "nullCount": {"a": 1, "nested": {"b": 0, "c": 1}}, }) .to_string(), ), ..Default::default() }; let stats = action.get_stats().unwrap().unwrap(); assert_eq!(stats.num_records, 22); assert_eq!( stats.min_values["a"].as_value().unwrap(), &serde_json::json!(1) ); assert_eq!( stats.min_values["nested"].as_column().unwrap()["b"] .as_value() .unwrap(), &serde_json::json!(2) ); assert_eq!( stats.min_values["nested"].as_column().unwrap()["c"] .as_value() .unwrap(), &serde_json::json!("a") ); assert_eq!( stats.max_values["a"].as_value().unwrap(), &serde_json::json!(10) ); assert_eq!( stats.max_values["nested"].as_column().unwrap()["b"] .as_value() .unwrap(), &serde_json::json!(20) ); assert_eq!( stats.max_values["nested"].as_column().unwrap()["c"] .as_value() .unwrap(), &serde_json::json!("z") ); assert_eq!(stats.null_count["a"].as_value().unwrap(), 1); assert_eq!( stats.null_count["nested"].as_column().unwrap()["b"] .as_value() .unwrap(), 0 ); assert_eq!( stats.null_count["nested"].as_column().unwrap()["c"] .as_value() .unwrap(), 1 ); }
rust_cleaned_test_functions.jsonl/114702
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1227 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 12411, 5237, 15381, 368, 341, 286, 1077, 1917, 284, 2691, 341, 310, 10472, 25, 4329, 1006, 394, 61570, 9455, 486, 2236, 0, 2262, 503, 330, 2413, 25876, 788, 220, 17, 17, 345, 503, 330, 1065, 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_narrow_call() { let code = quote! { async fn go() { let _ = Client::new().operation_id().send().await?; } }; let config = Config { max_width: Some(45), ..Default::default() }; assert_eq!( dos2unix(rustfmt_config(config, code).unwrap().as_str()), "async fn go() { let _ = Client::new() .operation_id() .send() .await?; }\n" ); }
rust_cleaned_test_functions.jsonl/94068
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 298 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1089, 6044, 13429, 368, 341, 286, 1077, 2038, 284, 12641, 0, 341, 310, 3312, 5168, 728, 368, 341, 394, 1077, 716, 284, 8423, 486, 931, 1005, 9262, 842, 1005, 6681, 1005, 11421, 37445, 310, 456, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_index() { let mut map: HashMap<int, int> = HashMap::new(); map.insert(1, 2); map.insert(2, 1); map.insert(3, 4); assert_eq!(map[2], 1); }
rust_cleaned_test_functions.jsonl/41868
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 114 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3560, 368, 341, 286, 1077, 5206, 2415, 25, 10528, 4159, 11, 526, 29, 284, 10528, 486, 931, 1428, 286, 2415, 7030, 7, 16, 11, 220, 17, 317, 286, 2415, 7030, 7, 17, 11, 220, 16, 317, 286, 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_get_and_process_vote_packets() { let (s, r) = unbounded(); let pubkey = solana_sdk::pubkey::new_rand(); let label1 = CrdsValueLabel::Vote(0, pubkey); let label2 = CrdsValueLabel::Vote(1, pubkey); let mut update_version = 0; s.send(vec![(label1.clone(), 17, Packets::default())]) .unwrap(); s.send(vec![(label2.clone(), 23, Packets::default())]) .unwrap(); let data = Packet { meta: Meta { repair: true, ..Meta::default() }, ..Packet::default() }; let later_packets = Packets::new(vec![data, Packet::default()]); s.send(vec![(label1.clone(), 42, later_packets)]).unwrap(); let mut verified_vote_packets = VerifiedVotePackets(HashMap::new()); verified_vote_packets .receive_and_process_vote_packets(&r, &mut update_version) .unwrap(); // Test timestamps for same batch are the same let update_version1 = verified_vote_packets.get_vote_packets(&label1).unwrap().0; assert_eq!( update_version1, verified_vote_packets.get_vote_packets(&label2).unwrap().0 ); // Test the later value overwrote the earlier one for this label assert!( verified_vote_packets .get_vote_packets(&label1) .unwrap() .2 .packets .len() > 1 ); assert_eq!( verified_vote_packets .get_vote_packets(&label2) .unwrap() .2 .packets .len(), 0 ); // Test timestamp for next batch overwrites the original s.send(vec![(label2.clone(), 51, Packets::default())]) .unwrap(); verified_vote_packets .receive_and_process_vote_packets(&r, &mut update_version) .unwrap(); let update_version2 = verified_vote_packets.get_vote_packets(&label2).unwrap().0; assert!(update_version2 > update_version1); // Test empty doesn't bump the version let before = update_version; assert_matches!( verified_vote_packets.receive_and_process_vote_packets(&r, &mut update_version), Err(Error::CrossbeamRecvTimeoutError(RecvTimeoutError::Timeout)) ); assert_eq!(before, update_version); }
rust_cleaned_test_functions.jsonl/57266
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1280 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 8378, 11305, 54360, 63569, 368, 341, 286, 1077, 320, 82, 11, 435, 8, 284, 650, 65686, 543, 286, 1077, 95116, 284, 2048, 3362, 61783, 486, 9585, 792, 486, 931, 33864, 543, 286, 1077, 2383, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_entry_gpu_verify() { let verify_transaction = { move |versioned_tx: VersionedTransaction, verification_mode: TransactionVerificationMode| -> Result<SanitizedTransaction> { let sanitized_tx = { let message_hash = if verification_mode == TransactionVerificationMode::FullVerification { versioned_tx.verify_and_hash_message()? } else { versioned_tx.message.hash() }; SanitizedTransaction::try_create( versioned_tx, message_hash, None, SimpleAddressLoader::Disabled, true, // require_static_program_ids ) }?; Ok(sanitized_tx) } }; let recycler = VerifyRecyclers::default(); // Make sure we test with a number of transactions that's not a multiple of PACKETS_PER_BATCH let entries_invalid = (0..1025) .map(|_| { let transaction = test_invalid_tx(); next_entry_mut(&mut Hash::default(), 0, vec![transaction]) }) .collect::<Vec<_>>(); let entries_valid = (0..1025) .map(|_| { let transaction = test_tx(); next_entry_mut(&mut Hash::default(), 0, vec![transaction]) }) .collect::<Vec<_>>(); assert!(!test_verify_transactions( entries_invalid, false, recycler.clone(), Arc::new(verify_transaction) )); assert!(test_verify_transactions( entries_valid, false, recycler, Arc::new(verify_transaction) )); }
rust_cleaned_test_functions.jsonl/1629
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1108 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9078, 35628, 35638, 368, 341, 286, 1077, 10146, 28884, 284, 341, 310, 3271, 760, 4366, 291, 17805, 25, 6079, 291, 8070, 345, 1698, 22901, 7302, 25, 17869, 62339, 3636, 7360, 1698, 1464, 5714, 1885...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_cp_target_file_dev_null() { let (at, mut ucmd) = at_and_ucmd!(); let file1 = "/dev/null"; let file2 = "test_cp_target_file_file_i2"; at.touch(file2); ucmd.arg(file1).arg(file2).succeeds().no_stderr(); assert!(at.file_exists(file2)); }
rust_cleaned_test_functions.jsonl/21274
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 139 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 39811, 11123, 2458, 10433, 15162, 368, 341, 262, 1077, 320, 266, 11, 5206, 575, 8710, 8, 284, 518, 8378, 68887, 2277, 0, 543, 262, 1077, 1034, 16, 284, 3521, 3583, 19293, 876, 262, 1077, 1034, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_find_address_signatures_for_slot() { let ledger_path = get_tmp_ledger_path_auto_delete!(); let blockstore = Blockstore::open(ledger_path.path()).unwrap(); let address0 = solana_sdk::pubkey::new_rand(); let address1 = solana_sdk::pubkey::new_rand(); let slot1 = 1; for x in 1..5 { let signature = Signature::new(&[x; 64]); blockstore .write_transaction_status( slot1, signature, vec![&address0], vec![&address1], TransactionStatusMeta::default(), ) .unwrap(); } let slot2 = 2; for x in 5..7 { let signature = Signature::new(&[x; 64]); blockstore .write_transaction_status( slot2, signature, vec![&address0], vec![&address1], TransactionStatusMeta::default(), ) .unwrap(); } // Purge to freeze index 0 blockstore.run_purge(0, 1, PurgeType::PrimaryIndex).unwrap(); for x in 7..9 { let signature = Signature::new(&[x; 64]); blockstore .write_transaction_status( slot2, signature, vec![&address0], vec![&address1], TransactionStatusMeta::default(), ) .unwrap(); } let slot3 = 3; for x in 9..13 { let signature = Signature::new(&[x; 64]); blockstore .write_transaction_status( slot3, signature, vec![&address0], vec![&address1], TransactionStatusMeta::default(), ) .unwrap(); } blockstore.set_roots(std::iter::once(&slot1)).unwrap(); let slot1_signatures = blockstore .find_address_signatures_for_slot(address0, 1) .unwrap(); for (i, (slot, signature)) in slot1_signatures.iter().enumerate() { assert_eq!(*slot, slot1); assert_eq!(*signature, Signature::new(&[i as u8 + 1; 64])); } let slot2_signatures = blockstore .find_address_signatures_for_slot(address0, 2) .unwrap(); for (i, (slot, signature)) in slot2_signatures.iter().enumerate() { assert_eq!(*slot, slot2); assert_eq!(*signature, Signature::new(&[i as u8 + 5; 64])); } let slot3_signatures = blockstore .find_address_signatures_for_slot(address0, 3) .unwrap(); for (i, (slot, signature)) in slot3_signatures.iter().enumerate() { assert_eq!(*slot, slot3); assert_eq!(*signature, Signature::new(&[i as u8 + 9; 64])); } }
rust_cleaned_test_functions.jsonl/9568
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1719 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21814, 6744, 11172, 2789, 5478, 27563, 368, 341, 286, 1077, 46933, 2638, 284, 633, 16125, 38367, 1389, 2638, 27740, 11353, 0, 543, 286, 1077, 2504, 4314, 284, 8362, 4314, 486, 2508, 7, 50704, 2638...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
#[test] fn test_measure_with_bytes() { use super::ctx::MeasureWith; let bytes: [u8; 4] = [0xef, 0xbe, 0xad, 0xde]; assert_eq!(bytes.measure_with(&()), 4); }
rust_cleaned_test_functions.jsonl/32107
{ "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, 48938, 6615, 12524, 368, 341, 286, 990, 2256, 486, 3773, 486, 32236, 2354, 280, 286, 1077, 5820, 25, 508, 84, 23, 26, 220, 19, 60, 284, 508, 15, 47510, 11, 220, 15, 42459, 11, 220, 15, 55254...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_approve_kyc() { let fixture = fixture_for_approve_kyc(); let driver = fake::FakeDriver::default() .with_ledger_from_neurons( &fixture .neurons .iter() .map(|(_, y)| y) .cloned() .collect::<Vec<Neuron>>(), ) .with_supply(Tokens::from_tokens(1_000_000).unwrap()); let mut gov = Governance::new(fixture, driver.get_fake_env(), driver.get_fake_ledger()); let neuron_a = gov.proto.neurons.get(&1).unwrap().clone(); let neuron_b = gov.proto.neurons.get(&2).unwrap().clone(); let principal1 = *neuron_a.controller.as_ref().unwrap(); let principal2 = *neuron_b.controller.as_ref().unwrap(); // Test that non kyc'd neurons can't be disbursed to accounts. let result = gov .disburse_neuron( neuron_a.id.as_ref().unwrap(), &principal1, &Disburse { amount: None, to_account: Some(AccountIdentifier::new(principal1, None).into()), }, ) .now_or_never() .unwrap(); assert_matches!(result, Err(msg) if msg.error_message.to_lowercase().contains("kyc verified")); // Test that non kyc'd neurons can't be disbursed to another neuron. let result = gov .disburse_to_neuron( neuron_b.id.as_ref().unwrap(), &principal2, &DisburseToNeuron { new_controller: Some(principal2), amount_e8s: 5 * 100_000_000, dissolve_delay_seconds: 0, kyc_verified: true, nonce: 1234, }, ) .now_or_never() .unwrap(); assert!(result.is_err()); assert_eq!( result.unwrap_err().error_message, "Neuron is not kyc verified: 2" ); assert!(!gov.proto.neurons.get(&1).unwrap().kyc_verified); assert!(!gov.proto.neurons.get(&2).unwrap().kyc_verified); assert!(!gov.proto.neurons.get(&3).unwrap().kyc_verified); assert!(!gov.proto.neurons.get(&4).unwrap().kyc_verified); gov.approve_genesis_kyc(&[principal1, principal2]); assert!(gov.proto.neurons.get(&1).unwrap().kyc_verified); assert!(gov.proto.neurons.get(&2).unwrap().kyc_verified); assert!(gov.proto.neurons.get(&3).unwrap().kyc_verified); assert!(!gov.proto.neurons.get(&4).unwrap().kyc_verified); // Disbursing should now work. let _ = gov .disburse_neuron( neuron_a.id.as_ref().unwrap(), &principal1, &Disburse { amount: None, to_account: Some(AccountIdentifier::new(principal1, None).into()), }, ) .now_or_never() .unwrap() .expect("Error disbursing neuron."); let _ = gov .disburse_to_neuron( neuron_b.id.as_ref().unwrap(), &principal2, &DisburseToNeuron { new_controller: Some(principal2), amount_e8s: 5 * 100_000_000, dissolve_delay_seconds: 0, kyc_verified: true, nonce: 1234, }, ) .now_or_never() .unwrap() .expect("Error disbursing to neuron."); }
rust_cleaned_test_functions.jsonl/1139
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1745 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 36057, 586, 4698, 3337, 368, 341, 262, 1077, 12507, 284, 12507, 5478, 36057, 586, 4698, 3337, 543, 262, 1077, 5579, 284, 12418, 486, 52317, 11349, 486, 2258, 741, 286, 659, 4197, 38367, 1389, 5673...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_transfer_sysvar() { solana_logger::setup(); let GenesisConfigInfo { genesis_config, mint_keypair, .. } = create_genesis_config_with_leader( 1_000_000_000_000_000, &Pubkey::new_unique(), bootstrap_validator_stake_lamports(), ); let mut bank = Bank::new_for_tests(&genesis_config); fn mock_ix_processor( _first_instruction_account: usize, invoke_context: &mut InvokeContext, ) -> std::result::Result<(), InstructionError> { let transaction_context = &invoke_context.transaction_context; let instruction_context = transaction_context.get_current_instruction_context()?; instruction_context .try_borrow_instruction_account(transaction_context, 1)? .set_data(&[0; 40])?; Ok(()) } let program_id = solana_sdk::pubkey::new_rand(); bank.add_builtin("mock_program1", &program_id, mock_ix_processor); let blockhash = bank.last_blockhash(); #[allow(deprecated)] let blockhash_sysvar = sysvar::clock::id(); #[allow(deprecated)] let orig_lamports = bank.get_account(&sysvar::clock::id()).unwrap().lamports(); let tx = system_transaction::transfer(&mint_keypair, &blockhash_sysvar, 10, blockhash); assert_eq!( bank.process_transaction(&tx), Err(TransactionError::InstructionError( 0, InstructionError::ReadonlyLamportChange )) ); assert_eq!( bank.get_account(&sysvar::clock::id()).unwrap().lamports(), orig_lamports ); let accounts = vec![ AccountMeta::new(mint_keypair.pubkey(), true), AccountMeta::new(blockhash_sysvar, false), ]; let ix = Instruction::new_with_bincode(program_id, &0, accounts); let message = Message::new(&[ix], Some(&mint_keypair.pubkey())); let tx = Transaction::new(&[&mint_keypair], message, blockhash); assert_eq!( bank.process_transaction(&tx), Err(TransactionError::InstructionError( 0, InstructionError::ReadonlyDataModified )) ); }
rust_cleaned_test_functions.jsonl/28993
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1133 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 35403, 20344, 947, 368, 341, 286, 2048, 3362, 27413, 486, 15188, 543, 286, 1077, 40788, 2648, 1731, 341, 310, 59366, 5332, 345, 310, 28337, 3097, 12670, 345, 310, 54538, 286, 335, 284, 1855, 16322...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_add_package_to() { let system_image = generate_test_manifest("system_image", "0", None); let update = generate_test_manifest("update", "0", None); let valid = generate_test_manifest("valid", "0", None); let mut packages = PackageList::default(); assert!(add_package_to(&mut packages, system_image).is_err()); assert!(add_package_to(&mut packages, update).is_err()); assert!(add_package_to(&mut packages, valid).is_ok()); }
rust_cleaned_test_functions.jsonl/91940
{ "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, 2891, 26328, 2346, 368, 341, 286, 1077, 1849, 4954, 284, 6923, 4452, 74269, 445, 8948, 4954, 497, 330, 15, 497, 2240, 317, 286, 1077, 2647, 284, 6923, 4452, 74269, 445, 2386, 497, 330, 15, 497, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_parse_request() { let p = Parsed::parse(&[ 0x51, 0x84, 0x01, 0x20, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x03, 0x63, 0x6f, 0x6d, 0x00, 0x00, 0x01, 0x00, 0x01, ]) .unwrap(); assert_eq!(p.packet.transaction_id(), 0x5184); assert_eq!( p.packet.flags(), Flags::RECURSION_DESIRED | Flags::AUTHENTIC_DATA ); assert_eq!(p.packet.opcode(), Opcode::Query); assert_eq!(p.packet.question_count(), 1); assert_eq!(p.packet.answer_record_count(), 0); assert_eq!(p.packet.authority_record_count(), 0); assert_eq!(p.packet.additional_record_count(), 0); assert_eq!(p.questions.len(), 1); assert_eq!( p.questions[0].name, &[0x06, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x03, 0x63, 0x6f, 0x6d, 0x00] ); assert_eq!(p.questions[0].type_, Type::A); assert_eq!(p.answers.len(), 0); assert_eq!(p.authorities.len(), 0); assert_eq!(p.additionals.len(), 0); }
rust_cleaned_test_functions.jsonl/88882
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 659 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 7893, 368, 341, 286, 1077, 281, 284, 393, 18112, 486, 6400, 2099, 9640, 310, 220, 15, 87, 20, 16, 11, 220, 15, 87, 23, 19, 11, 220, 15, 87, 15, 16, 11, 220, 15, 87, 17, 15, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_whitespace_control() { let options = Language::default(); let mut context = Context::new(); context.stack_mut().set_global("exp", Value::scalar(5)); let text = " \n {{ exp }} \n "; let template = parse(text, &options).map(Template::new).unwrap(); let output = template.render(&mut context).unwrap(); assert_eq!(output, " \n 5 \n "); let text = " \n {{- exp }} \n "; let template = parse(text, &options).map(Template::new).unwrap(); let output = template.render(&mut context).unwrap(); assert_eq!(output, "5 \n "); let text = " \n {{ exp -}} \n "; let template = parse(text, &options).map(Template::new).unwrap(); let output = template.render(&mut context).unwrap(); assert_eq!(output, " \n 5"); let text = " \n {{- exp -}} \n "; let template = parse(text, &options).map(Template::new).unwrap(); let output = template.render(&mut context).unwrap(); assert_eq!(output, "5"); }
rust_cleaned_test_functions.jsonl/70783
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 519 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 86175, 13436, 368, 341, 286, 1077, 2606, 284, 11434, 486, 2258, 1428, 286, 1077, 5206, 2266, 284, 9608, 486, 931, 543, 286, 2266, 22420, 29523, 1005, 746, 19296, 445, 4580, 497, 5162, 486, 35342, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_lt() { let empty: [isize; 0] = []; let xs = [1,2,3]; let ys = [1,2,0]; assert!(!xs.iter().lt(ys.iter())); assert!(!xs.iter().le(ys.iter())); assert!( xs.iter().gt(ys.iter())); assert!( xs.iter().ge(ys.iter())); assert!( ys.iter().lt(xs.iter())); assert!( ys.iter().le(xs.iter())); assert!(!ys.iter().gt(xs.iter())); assert!(!ys.iter().ge(xs.iter())); assert!( empty.iter().lt(xs.iter())); assert!( empty.iter().le(xs.iter())); assert!(!empty.iter().gt(xs.iter())); assert!(!empty.iter().ge(xs.iter())); // Sequence with NaN let u = [1.0f64, 2.0]; let v = [0.0f64/0.0, 3.0]; assert!(!u.iter().lt(v.iter())); assert!(!u.iter().le(v.iter())); assert!(!u.iter().gt(v.iter())); assert!(!u.iter().ge(v.iter())); let a = [0.0f64/0.0]; let b = [1.0f64]; let c = [2.0f64]; assert!(a.iter().lt(b.iter()) == (a[0] < b[0])); assert!(a.iter().le(b.iter()) == (a[0] <= b[0])); assert!(a.iter().gt(b.iter()) == (a[0] > b[0])); assert!(a.iter().ge(b.iter()) == (a[0] >= b[0])); assert!(c.iter().lt(b.iter()) == (c[0] < b[0])); assert!(c.iter().le(b.iter()) == (c[0] <= b[0])); assert!(c.iter().gt(b.iter()) == (c[0] > b[0])); assert!(c.iter().ge(b.iter()) == (c[0] >= b[0])); }
rust_cleaned_test_functions.jsonl/25885
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 697 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 39164, 368, 341, 262, 1077, 4287, 25, 508, 285, 551, 26, 220, 15, 60, 284, 5907, 262, 1077, 11943, 284, 508, 16, 11, 17, 11, 18, 935, 262, 1077, 31810, 284, 508, 16, 11, 17, 11, 15, 4821, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_bytes_or_string() { #[serde_as] #[derive(Debug, Serialize, Deserialize, PartialEq)] struct S(#[serde_as(as = "BytesOrString")] Vec<u8>); is_equal( S(vec![1, 2, 3]), expect![[r#" [ 1, 2, 3 ]"#]], ); check_deserialization(S(vec![72, 101, 108, 108, 111]), r#""Hello""#); #[serde_as] #[derive(Debug, Serialize, Deserialize, PartialEq)] struct SVec(#[serde_as(as = "Vec<BytesOrString>")] Vec<Vec<u8>>); is_equal( SVec(vec![vec![1, 2, 3]]), expect![[r#" [ [ 1, 2, 3 ] ]"#]], ); check_deserialization( SVec(vec![ vec![72, 101, 108, 108, 111], vec![87, 111, 114, 108, 100], vec![1, 2, 3], ]), r#"["Hello","World",[1,2,3]]"#, ); }
rust_cleaned_test_functions.jsonl/45732
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 608 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 12524, 8734, 3904, 368, 341, 262, 11506, 47024, 11898, 921, 262, 11506, 27098, 42618, 11, 39900, 11, 48440, 11, 55039, 5563, 262, 2036, 328, 7, 13353, 47024, 11898, 36951, 284, 330, 7078, 2195, 70...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_addressing_mode() { // 3 * [4] = 3 * 33 = 99 -> store at [4] let prog = vec![1002, 4, 3, 4, 33]; assert_eq!(eval(&prog, 4), 99); // 100 - 1 = 99 -> store at [4] let prog = vec![1101, 100, -1, 4, 0]; assert_eq!(eval(&prog, 4), 99); }
rust_cleaned_test_functions.jsonl/55725
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 166 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6744, 287, 7302, 368, 341, 286, 442, 220, 18, 353, 508, 19, 60, 284, 220, 18, 353, 220, 18, 18, 284, 220, 24, 24, 1464, 3553, 518, 508, 19, 921, 286, 1077, 29271, 284, 7486, 20703, 16, 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_minimize() { let n = 100; let prec = 500; let f = |x: &Float| x.clone() * x * x - x; let eps = 1e-70; let iter = 1000; let result = minimize(f, &Float::with_val(prec, 0.0), &Float::with_val(prec, 1.0), prec, eps, iter); let minimizer = Float::with_val(prec, 3.0).recip_sqrt(); let diff = (result.unwrap() - minimizer).to_f64(); println!("diff = {diff:.6e}"); assert!(diff.abs() < eps); }
rust_cleaned_test_functions.jsonl/20099
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 266 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 7260, 11853, 368, 341, 286, 1077, 308, 284, 220, 16, 15, 15, 280, 286, 1077, 5833, 284, 220, 20, 15, 15, 280, 286, 1077, 282, 284, 760, 87, 25, 609, 5442, 91, 856, 15997, 368, 353, 856, 35...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_quote() { let cases: Vec<(&str, &str)> = vec![ (r"Don\'t!", r"'Don\\\'t!'"), (r"Don't", r"'Don\'t'"), (r"\'", r"'\\\''"), (r#"\""#, r#"'\\"'"#), (r"萌萌哒(๑•ᴗ•๑)😊", r"'萌萌哒(๑•ᴗ•๑)😊'"), (r"㍿㌍㍑㌫", r"'㍿㌍㍑㌫'"), (str::from_utf8(&[26, 0]).unwrap(), r"'\Z\0'"), ]; for (input, expect) in cases { let input = Datum::Bytes(input.as_bytes().to_vec()); let expect_vec = Datum::Bytes(expect.as_bytes().to_vec()); let got = eval_func(ScalarFuncSig::Quote, &[input]).unwrap(); assert_eq!(got, expect_vec) } //check for null let got = eval_func(ScalarFunatum::Null]).unwrap(); assert_eq!(got, Datum::Bytes(b"NULL".to_vec())) }
rust_cleaned_test_functions.jsonl/44152
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 517 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 45236, 368, 341, 286, 1077, 5048, 25, 11312, 27, 2099, 495, 11, 609, 495, 16018, 284, 7486, 90515, 310, 320, 81, 91650, 10169, 83, 18789, 435, 20584, 8002, 3422, 10169, 83, 31383, 4461, 310, 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_vcx_issuer_send_a_credential() { init!("true"); settings::set_config_value(settings::CONFIG_INSTITUTION_DID, DEFAULT_DID); let test_name = "test_vcx_issuer_send_a_credential"; let handle = issuer_credential::from_string(&issuer_credential_state_accepted()).unwrap(); // create connection let connection_handle = ::connection::tests::build_test_connection(); connection::connect(connection_handle, None).unwrap(); // send the credential let cb = return_types_u32::Return_U32::new().unwrap(); assert_eq!(vcx_issuer_send_credential(cb.command_handle, handle, connection_handle, Some(cb.get_callback())), error::SUCCESS.code_num); cb.receive(Some(Duration::from_secs(10))).unwrap(); }
rust_cleaned_test_functions.jsonl/66774
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 487 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2273, 25844, 62, 66817, 13565, 4306, 666, 30320, 368, 341, 286, 2930, 17223, 1866, 797, 286, 5003, 486, 746, 5332, 3142, 23369, 486, 24652, 2158, 25765, 28617, 1557, 915, 11, 11955, 1557, 915, 317...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_unicode_command() { let mut parser = simple_config(); parser.config_mut().command("\u{1f44e}").add(); // thumbs down unicode assert!(parser.parse("!\u{1f44e}").is_some()); }
rust_cleaned_test_functions.jsonl/74786
{ "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, 54662, 10811, 368, 341, 286, 1077, 5206, 6729, 284, 4285, 5332, 543, 286, 6729, 5423, 29523, 1005, 5631, 4921, 84, 90, 16, 69, 19, 19, 68, 92, 1827, 718, 2129, 442, 56849, 1495, 26077, 271, 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
#[test] fn test_pipe_write_broken() { let devpipe = Arc::new(Pipe::default()); task::spawn(async move { let p = Chan::attach(devpipe, b"").await.unwrap(); let data = p.open(b"data", None).await.unwrap().unwrap(); assert_eq!(data.write(b"", 0).await.is_err(), true); data.close().await; p.close().await; }) .unwrap(); task::run(); }
rust_cleaned_test_functions.jsonl/36085
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 234 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 41862, 9165, 880, 81709, 368, 341, 286, 1077, 3483, 13768, 284, 19689, 486, 931, 5304, 3444, 486, 2258, 1423, 286, 3383, 486, 46087, 18285, 3271, 341, 310, 1077, 281, 284, 41302, 486, 16330, 17622...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_construct_subtree_at_bottom_found_internal_node() { let left_child = Arc::new(SparseMerkleNode::new_subtree(HashValue::new( [1; HashValue::LENGTH], ))); let right_child = Arc::new(SparseMerkleNode::new_empty()); let current_node = Arc::new(SparseMerkleNode::new_internal(left_child, right_child)); let key = b"hello".test_only_hash(); let new_blob = AccountStateBlob::from(b"new_blob".to_vec()); let remaining_bits = key.iter_bits(); let proof_reader = ProofReader::default(); let _subtree_node = SparseMerkleTree::construct_subtree_at_bottom( current_node, key, new_blob, remaining_bits, &proof_reader, ); }
rust_cleaned_test_functions.jsonl/15415
{ "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, 64803, 5228, 9344, 3752, 25473, 21480, 23472, 5084, 368, 341, 262, 1077, 2115, 17268, 284, 19689, 486, 931, 3759, 6400, 44, 16754, 273, 1955, 486, 931, 5228, 9344, 7, 6370, 1130, 486, 931, 1006, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_macro_def_simple() { mark::check!(parse_macro_def_simple); parse_macro2( r#" macro foo($id:ident) { fn $id() {} } "#, ) .assert_expand_items("foo!(bar);", "fn bar () {}"); }
rust_cleaned_test_functions.jsonl/28726
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 119 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 58810, 7844, 30015, 368, 341, 262, 1868, 486, 2028, 10297, 6400, 58810, 7844, 30015, 626, 262, 4715, 58810, 17, 1006, 286, 435, 2, 698, 32606, 15229, 699, 307, 25, 1713, 8, 341, 262, 5168...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_on_a_colon_slash() { let string = "+a:example.com/24"; let option_test: Option<Mechanism<String>>; option_test = helpers::capture_matches(&string, Kind::A); let test = option_test.unwrap(); assert_eq!(test.is_pass(), true); assert_eq!(test.raw(), "example.com/24"); assert_eq!(test.to_string(), "a:example.com/24"); }
rust_cleaned_test_functions.jsonl/90569
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 159 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10708, 4470, 4306, 10211, 263, 11886, 988, 368, 341, 262, 1077, 914, 284, 6630, 64, 25, 8687, 905, 14, 17, 19, 876, 262, 1077, 2999, 4452, 25, 6959, 33274, 4737, 67813, 3464, 2452, 401, 262, 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_shift() { let mut x = vec![1, 2, 3]; assert_eq!(x.shift(), Some(1)); assert_eq!(&x, &vec![2, 3]); assert_eq!(x.shift(), Some(2)); assert_eq!(x.shift(), Some(3)); assert_eq!(x.shift(), None); assert_eq!(x.len(), 0); }
rust_cleaned_test_functions.jsonl/75614
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 167 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 22230, 368, 341, 286, 1077, 5206, 856, 284, 7486, 20703, 16, 11, 220, 17, 11, 220, 18, 935, 286, 2060, 10714, 10297, 87, 29154, 1507, 4329, 7, 16, 1106, 286, 2060, 10714, 0, 2099, 87, 11, 60...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_pass_disable_balance_limits() { ExtBuilder::build().execute_with(|| { let celer_ledger_account = CelerPayModule::get_celer_ledger_id(); let alice_pair = account_pair("Alice"); let bob_pair = account_pair("Bob"); let (channel_peers, peers_pair) = get_sorted_peer(alice_pair.clone(), bob_pair.clone()); assert_ok!(Pool::<TestRuntime>::deposit_pool( Origin::signed(channel_peers[0]), channel_peers[0], 100, )); approve(channel_peers[0], celer_ledger_account, 100); let open_channel_request = get_open_channel_request( true, 10000, 50000, 10, false, channel_peers.clone(), 1, peers_pair, ); assert_ok!(CelerPayModule::open_channel( Origin::signed(channel_peers[0]), open_channel_request.clone(), 200 )); let channel_id = calculate_channel_id(open_channel_request, channel_peers.clone()); assert_ok!(CelerPayModule::disable_balance_limits( Origin::signed(channel_peers[0]), channel_id )); }) }
rust_cleaned_test_functions.jsonl/81761
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 750 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15464, 33842, 29396, 31820, 368, 341, 286, 9447, 3297, 486, 5834, 1005, 10257, 6615, 79453, 314, 5872, 310, 1077, 272, 7865, 38367, 1389, 13500, 284, 356, 7865, 20595, 3332, 486, 455, 666, 7865, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_alias_anonymous_pattern() { let mut grok = Grok::empty(); grok.insert_definition("USERNAME", r"[a-zA-Z0-9._-]+"); grok.insert_definition("USER", r"%{USERNAME}"); let pattern = grok.compile("%{USER}", false) .expect("Error while compiling!"); let matches = pattern.match_against("root").expect("No matches found!"); assert_eq!("root", matches.get("USER").unwrap()); let matches = pattern .match_against("john doe") .expect("No matches found!"); assert_eq!("john", matches.get("USER").unwrap()); }
rust_cleaned_test_functions.jsonl/117566
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 277 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 35947, 12008, 9757, 21260, 368, 341, 286, 1077, 5206, 10487, 74, 284, 17888, 74, 486, 3194, 543, 286, 10487, 74, 7030, 31698, 445, 63516, 497, 435, 36864, 64, 21088, 11171, 15, 12, 24, 1436, 12,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_null_default() { new_ucmd!() .arg("-z") .arg(FOOBAR_WITH_NULL_TXT) .run() .stdout_is_fixture("foobar_with_null_default.expected"); }
rust_cleaned_test_functions.jsonl/31121
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 107 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15162, 9993, 368, 341, 262, 501, 68887, 2277, 0, 741, 286, 659, 858, 13645, 89, 1138, 286, 659, 858, 7, 3788, 20608, 934, 23929, 18119, 84411, 340, 286, 659, 6108, 741, 286, 659, 36358, 6892, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_vec4_signum() { assert_eq!(Vec4::zero().signum(), Vec4::one()); assert_eq!(-Vec4::zero().signum(), -Vec4::one()); assert_eq!(Vec4::one().signum(), Vec4::one()); assert_eq!((-Vec4::one()).signum(), -Vec4::one()); assert_eq!(Vec4::splat(f32::INFINITY).signum(), Vec4::one()); assert_eq!(Vec4::splat(f32::NEG_INFINITY).signum(), -Vec4::one()); assert!(Vec4::splat(f32::NAN).signum().is_nan().all()); }
rust_cleaned_test_functions.jsonl/68869
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 217 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13251, 19, 11172, 372, 368, 341, 262, 2060, 10714, 10297, 10050, 19, 486, 14154, 1005, 7752, 372, 1507, 11312, 19, 486, 603, 1423, 262, 2060, 10714, 0, 4080, 10050, 19, 486, 14154, 1005, 7752, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_ser() { let cases = &[ (1.0, "1"), (1.42, "1.42"), (f64::NAN, "null"), (f64::INFINITY, "null"), (f64::NEG_INFINITY, "null"), ]; for (number, expected) in cases { let actual = json::to_string(number); assert_eq!(actual, *expected); } }
rust_cleaned_test_functions.jsonl/7372
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 181 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 75861, 368, 341, 262, 1077, 5048, 284, 609, 9640, 286, 320, 16, 13, 15, 11, 330, 16, 4461, 286, 320, 16, 13, 19, 17, 11, 330, 16, 13, 19, 17, 4461, 286, 320, 69, 21, 19, 486, 45, 1093, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_js_doc_from_str() { assert_eq!( serde_json::to_value(JsDoc::from( "Line 1 Line 2 @param {string} a comment @param {string} b comment multi-line @returns {Promise<T>} nothing " .to_string() )) .unwrap(), json!({ "doc": "Line 1\nLine 2\n", "tags": [ { "kind": "param", "name": "a", "type": "string", "doc": "comment", }, { "kind": "param", "name": "b", "type": "string", "doc": "comment\nmulti-line", }, { "kind": "return", "type": "Promise<T>", "doc": "nothing" } ] }) ); }
rust_cleaned_test_functions.jsonl/119532
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 470 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 26250, 18869, 5673, 2895, 368, 341, 262, 2060, 10714, 33673, 414, 61570, 9455, 486, 983, 3142, 16368, 82, 9550, 486, 1499, 1006, 286, 330, 2460, 220, 16, 198, 2460, 220, 17, 271, 35813, 314, 917...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_take_out_of_bounds() { let index = UInt32Array::from(vec![Some(3), None, Some(1), Some(3), Some(6)]); let take_opt = TakeOptions { check_bounds: true }; // int64 test_take_primitive_arrays::<Int64Type>( vec![Some(0), None, Some(2), Some(3), None], &index, Some(take_opt), vec![None], ); }
rust_cleaned_test_functions.jsonl/4077
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 216 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 73261, 6068, 3575, 36878, 368, 341, 286, 1077, 1922, 284, 22275, 18, 17, 1857, 486, 1499, 25592, 20703, 8373, 7, 18, 701, 2240, 11, 4329, 7, 16, 701, 4329, 7, 18, 701, 4329, 7, 21, 41958, 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_batch_get_memory_lock() { let (_cluster, client, ctx) = must_new_cluster_and_kv_client(); let mut req = BatchGetRequest::default(); req.set_context(ctx); req.set_keys(vec![b"a".to_vec(), b"b".to_vec()].into()); req.version = 50; fail::cfg("raftkv_async_snapshot_err", "return").unwrap(); let resp = client.kv_batch_get(&req).unwrap(); // the injected error should be returned at both places for backward compatibility. assert!(!resp.pairs[0].get_error().get_abort().is_empty()); assert!(!resp.get_error().get_abort().is_empty()); fail::remove("raftkv_async_snapshot_err"); }
rust_cleaned_test_functions.jsonl/26791
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 259 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14534, 3062, 19195, 9818, 368, 341, 262, 1077, 5453, 18855, 11, 2943, 11, 5635, 8, 284, 1969, 5921, 28441, 8378, 97066, 8179, 1428, 262, 1077, 5206, 4232, 284, 33904, 1949, 1900, 486, 2258, 543, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_if_else_taken() { let template = compile("{{ if boolean }}Hello!{{ else }}Goodbye!{{ endif }}"); let context = context(); let template_registry = other_templates(); let formatter_registry = formatters(); let string = template .render(&context, &template_registry, &formatter_registry) .unwrap(); assert_eq!("Hello!", &string); }
rust_cleaned_test_functions.jsonl/2375
{ "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, 11119, 62628, 72933, 368, 972, 286, 1077, 3811, 284, 19192, 445, 2979, 421, 2710, 3869, 9707, 0, 2979, 770, 3869, 15216, 28374, 0, 2979, 12330, 3869, 2815, 286, 1077, 2266, 284, 2266, 1647, 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_short_str_lossless() { let address = AccountAddress::from_hex("00c0f1f95c5b1c5f0eda533eff269000").unwrap(); assert_eq!( address.short_str_lossless(), "c0f1f95c5b1c5f0eda533eff269000", ); }
rust_cleaned_test_functions.jsonl/38747
{ "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, 16673, 2895, 11193, 1717, 368, 341, 286, 1077, 2621, 284, 8615, 4286, 486, 1499, 32655, 445, 15, 15, 66, 15, 69, 16, 69, 24, 20, 66, 20, 65, 16, 66, 20, 69, 15, 13830, 20, 18, 18, 6445, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_fork_proposal_table() { let builder = SharedBuilder::with_temp_db(); let consensus = Consensus { tx_proposal_window: ProposalWindow(2, 3), ..Default::default() }; let (shared, mut pack) = builder.consensus(consensus).build().unwrap(); let mut chain_service = ChainService::new(shared.clone(), pack.take_proposal_table()); let genesis = shared .store() .get_block_header(&shared.store().get_block_hash(0).unwrap()) .unwrap(); let mock_store = MockStore::new(&genesis, shared.store()); let mut mock = MockChain::new(genesis, shared.consensus()); for i in 1..12 { let ids = vec![packed::ProposalShortId::new([ 0u8, 0, 0, 0, 0, 0, 0, 0, 0, i, ])]; mock.gen_block_with_proposal_ids(40u64, ids, &mock_store); } for blk in mock.blocks() { chain_service .process_block(Arc::new(blk.clone()), Switch::DISABLE_ALL) .unwrap(); } for _ in 1..9 { mock.rollback(&mock_store); } for i in 4..6 { let ids = vec![packed::ProposalShortId::new([ 1u8, 0, 0, 0, 0, 0, 0, 0, 0, i, ])]; mock.gen_block_with_proposal_ids(200u64, ids, &mock_store); } for blk in mock.blocks().iter().skip(3) { chain_service .process_block(Arc::new(blk.clone()), Switch::DISABLE_ALL) .unwrap(); } let snapshot = shared.snapshot(); let proposals = snapshot.proposals(); assert_eq!( &vec![ packed::ProposalShortId::new([0u8, 0, 0, 0, 0, 0, 0, 0, 0, 3]), packed::ProposalShortId::new([1u8, 0, 0, 0, 0, 0, 0, 0, 0, 4]) ] .into_iter() .collect::<HashSet<_>>(), proposals.set() ); assert_eq!( &vec![packed::ProposalShortId::new([ 1u8, 0, 0, 0, 0, 0, 0, 0, 0, 5 ])] .into_iter() .collect::<HashSet<_>>(), proposals.gap() ); }
rust_cleaned_test_functions.jsonl/5137
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 996 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 761, 669, 21663, 32556, 5237, 368, 341, 262, 1077, 7363, 284, 16990, 3297, 486, 4197, 11771, 8685, 543, 262, 1077, 23869, 284, 7292, 13626, 341, 286, 9854, 21663, 32556, 12571, 25, 65890, 4267, 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...
6
#[test] fn test_update() { let mut registry = Registry::new(); let key = vec![1, 2, 3, 4]; // Updating without the key existing should fail. let value = vec![5, 6, 7, 8]; let value2 = vec![9, 10, 11, 12]; assert_eq!( registry.verify_mutation_type(&[update(&key, &value)]), vec![Error::KeyNotPresent(key.clone())] ); // After a regular insert the update should succeed. assert_empty!(apply_mutations_skip_invariant_checks( &mut registry, vec![insert(&key, &value)] )); assert_empty!(apply_mutations_skip_invariant_checks( &mut registry, vec![update(&key, &value2)] )); let result = registry.get(&key, registry.latest_version()); assert_eq!(value2, result.unwrap().value); // After the key is deleted the update should fail. assert_empty!(apply_mutations_skip_invariant_checks( &mut registry, vec![delete(&key)] )); assert_eq!( apply_mutations_skip_invariant_checks(&mut registry, vec![update(&key, &value)]), vec![Error::KeyNotPresent(key)] ); serialize_then_deserialize(registry); }
rust_cleaned_test_functions.jsonl/86100
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 606 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8882, 368, 341, 286, 1077, 5206, 19424, 284, 32112, 486, 931, 543, 286, 1077, 1376, 284, 7486, 20703, 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 935, 286, 442, 78118, 2041, 279, 1376, 6350, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_float_seconds() { assert_eq!(Duration::from_secs(10), parse_dur("10").unwrap()); assert_eq!(Duration::from_secs_f32(1.2), parse_dur("1.2").unwrap()); }
rust_cleaned_test_functions.jsonl/51534
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 95 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 17586, 34825, 368, 341, 286, 2060, 10714, 10297, 12945, 486, 1499, 68718, 7, 16, 15, 701, 4715, 82289, 445, 16, 15, 1827, 15454, 1423, 286, 2060, 10714, 10297, 12945, 486, 1499, 68718, 761, 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
#[test] fn test_egui_zero_window_size() { let mut demo_windows = crate::DemoWindows::default(); let mut ctx = egui::CtxRef::default(); let raw_input = egui::RawInput { screen_rect: Some(egui::Rect::from_min_max(egui::Pos2::ZERO, egui::Pos2::ZERO)), ..Default::default() }; const NUM_FRAMES: usize = 5; for _ in 0..NUM_FRAMES { ctx.begin_frame(raw_input.clone()); demo_windows.ui(&ctx); let (_output, shapes) = ctx.end_frame(); let clipped_meshes = ctx.tessellate(shapes); assert!(clipped_meshes.is_empty(), "There should be nothing to show"); } }
rust_cleaned_test_functions.jsonl/27071
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 284 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 90209, 1963, 19359, 12571, 2368, 368, 341, 262, 1077, 5206, 16661, 58220, 284, 17717, 486, 37413, 13164, 486, 2258, 543, 262, 1077, 5206, 5635, 284, 8695, 1963, 486, 23684, 3945, 486, 2258, 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_simple_diff() { use crate::git::{Parser, Section}; // Setup let diff = std::fs::read_to_string("test_files/git/one_diff.patch").unwrap(); let expected_sections: Vec<Section> = vec![ Section { file_name: "src/git.rs".to_string(), line_start: 4, line_end: 11, }, Section { file_name: "src/git.rs".to_string(), line_start: 117, line_end: 147, }, ]; let parser = Parser::new(false); // Run let actual_sections = parser.sections(&diff); // Assert assert_eq!(expected_sections, actual_sections); }
rust_cleaned_test_functions.jsonl/81567
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 401 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 30015, 15850, 368, 341, 286, 990, 17717, 486, 12882, 22964, 6570, 11, 11113, 2440, 286, 442, 18626, 198, 286, 1077, 3638, 284, 1460, 486, 3848, 486, 878, 2346, 3904, 445, 1944, 10931, 60590, 14, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_dot() { let v1 = Tuple::vector(1.0, 2.0, 3.0); let v2 = Tuple::vector(2.0, 3.0, 4.0); assert_eq!(v1.dot(&v2), 20.0); }
rust_cleaned_test_functions.jsonl/113525
{ "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, 30941, 368, 341, 286, 1077, 348, 16, 284, 24622, 486, 3215, 7, 16, 13, 15, 11, 220, 17, 13, 15, 11, 220, 18, 13, 15, 317, 286, 1077, 348, 17, 284, 24622, 486, 3215, 7, 17, 13, 15, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_random_bytes() { let cases = vec![1, 32, 233, 1024]; for len in cases { let got = RpnFnScalarEvaluator::new() .push_param(Some(Int::from(len as i64))) .evaluate::<Bytes>(ScalarFuncSig::RandomBytes) .unwrap(); assert_eq!(got.unwrap().len(), len); } let overflow_tests = vec![ ScalarValue::Int(Some(-32)), ScalarValue::Int(Some(1025)), ScalarValue::Int(Some(0)), ]; for len in overflow_tests { assert!(RpnFnScalarEvaluator::new() .push_param(len) .evaluate::<Bytes>(ScalarFuncSig::RandomBytes) .is_err(),); } //test NULL case assert!(RpnFnScalarEvaluator::new() .push_param(ScalarValue::Int(None)) .evaluate::<Bytes>(ScalarFuncSig::RandomBytes) .unwrap() .is_none()) }
rust_cleaned_test_functions.jsonl/91314
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 556 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 22644, 12524, 368, 341, 286, 1077, 5048, 284, 7486, 20703, 16, 11, 220, 18, 17, 11, 220, 17, 18, 18, 11, 220, 16, 15, 17, 19, 4821, 286, 369, 2422, 304, 5048, 341, 310, 1077, 2684, 284, 43...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_awkward_chunks() { assert_parses(&vec!["const", "ructor.length = 1;"]); assert_parses(&vec!["const", " x = 1;"]); // Try feeding one character at a time to the parser. let chars: Vec<&str> = "function f() { ok(); }".split("").collect(); assert_parses(&chars); // XXX TODO //assertEqual( let allocator = &Bump::new(); let actual = try_parse(allocator, &vec!["x/", "=2;"]).unwrap(); let atoms = Rc::new(RefCell::new(SourceAtomSet::new())); let expected = Script { directives: arena::Vec::new_in(allocator), statements: bumpalo::vec![ in allocator; Statement::ExpressionStatement(arena::alloc( allocator, Expression::CompoundAssignmentExpression { operator: CompoundAssignmentOperator::Div { loc: SourceLocation::new(1, 3), }, binding: SimpleAssignmentTarget::AssignmentTargetIdentifier( AssignmentTargetIdentifier { name: Identifier { value: atoms.borrow_mut().insert("x"), loc: SourceLocation::new(0, 1), }, loc: SourceLocation::new(0, 1), }, ), expression: arena::alloc( allocator, Expression::LiteralNumericExpression(NumericLiteral { value: 2.0, loc: SourceLocation::new(3, 4), }), ), loc: SourceLocation::new(0, 4), }, )) ], loc: SourceLocation::new(0, 4), }; assert_eq!(format!("{:?}", actual), format!("{:?}", expected)); }
rust_cleaned_test_functions.jsonl/7973
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1092 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 62, 23397, 1606, 65470, 368, 341, 262, 2060, 77113, 288, 2099, 4083, 0, 1183, 1024, 497, 330, 81, 79222, 1954, 284, 220, 16, 26, 15049, 262, 2060, 77113, 288, 2099, 4083, 0, 1183, 1024, 497, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_create_account_with_seed_missing_sig() { let new_owner = Pubkey::new(&[9; 32]); let from = solana_sdk::pubkey::new_rand(); let seed = "dull boy"; let to = Pubkey::create_with_seed(&from, seed, &new_owner).unwrap(); let from_account = AccountSharedData::new_ref(100, 0, &system_program::id()); let to_account = AccountSharedData::new_ref(0, 0, &Pubkey::default()); let to_address = Address::create( &to, Some((&from, seed, &new_owner)), &MockInvokeContext::new(vec![]), ) .unwrap(); assert_eq!( create_account( &KeyedAccount::new(&from, false, &from_account), &KeyedAccount::new(&to, false, &to_account), &to_address, 50, 2, &new_owner, &HashSet::new(), &MockInvokeContext::new(vec![]), ), Err(InstructionError::MissingRequiredSignature) ); assert_eq!(from_account.borrow().lamports, 100); assert_eq!(*to_account.borrow(), AccountSharedData::default()); }
rust_cleaned_test_functions.jsonl/73039
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 614 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8657, 13500, 6615, 33809, 40447, 29252, 368, 341, 286, 1077, 501, 29027, 284, 22611, 792, 486, 931, 2099, 58, 24, 26, 220, 18, 17, 2558, 286, 1077, 504, 284, 2048, 3362, 61783, 486, 9585, 792, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_run_inline_pipelines() -> Result<()> { let query = parse( r#" func sum x -> s"SUM({x})" from a aggregate [one = (foo | sum), two = (foo | sum)] "#, )?; let (res, context) = resolve(query.nodes, None)?; let pipeline = find_pipeline(res); let (mat, _, _) = materialize(pipeline.clone(), context.into(), None)?; assert_snapshot!(diff(&to_string(&pipeline.functions)?, &to_string(&mat.functions)?), @r###" @@ -7,6 +7,14 @@ - Transform: Aggregate: assigns: - - Ident: one - - Ident: two + - SString: + - String: SUM( + - Expr: + Ident: foo + - String: ) + - SString: + - String: SUM( + - Expr: + Ident: foo + - String: ) by: [] "###); // Test it'll run the `sum foo` function first. let query = parse( r#" func sum x -> s"SUM({x})" func plus_one x -> x + 1 from a aggregate [a = (sum foo | plus_one)] "#, )?; let mat = resolve_and_materialize(query).unwrap(); assert_yaml_snapshot!(mat, @r###" --- - Transform: From: name: a alias: ~ declared_at: 41 - Transform: Aggregate: assigns: - Expr: - SString: - String: SUM( - Expr: Ident: foo - String: ) - Operator: + - Literal: Integer: 1 by: [] "###); Ok(()) }
rust_cleaned_test_functions.jsonl/90559
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1217 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14007, 41871, 620, 93997, 368, 1464, 5714, 71698, 341, 286, 1077, 3239, 284, 4715, 1006, 310, 435, 2, 698, 286, 2915, 2629, 856, 1464, 220, 274, 1, 27377, 2306, 87, 5410, 1837, 286, 504, 264, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
7
#[test] fn test_clashing_tx_instants() { let mut conn = TestConn::default(); conn.sanitized_partition_map(); // Transact a basic schema. assert_transact!( conn, r#" [{:db/ident :person/name :db/valueType :db.type/string :db/cardinality :db.cardinality/one :db/unique :db.unique/identity :db/index true}] "# ); // Make an assertion against our schema. assert_transact!(conn, r#"[{:person/name "Vanya"}]"#); // Move that assertion away from the main timeline. let (new_schema, new_partition_map) = move_from_main_timeline( &conn.sqlite, &conn.schema, conn.partition_map.clone(), conn.last_tx_id().., 1, ) .expect("moved single tx"); update_conn(&mut conn, &new_schema, &new_partition_map); // Assert that our datoms are now just the schema. assert_matches!( conn.datoms(), " [[?e :db/ident :person/name] [?e :db/valueType :db.type/string] [?e :db/cardinality :db.cardinality/one] [?e :db/unique :db.unique/identity] [?e :db/index true]]" ); // Same for transactions. assert_matches!( conn.transactions(), " [[[?e :db/ident :person/name ?tx true] [?e :db/valueType :db.type/string ?tx true] [?e :db/cardinality :db.cardinality/one ?tx true] [?e :db/unique :db.unique/identity ?tx true] [?e :db/index true ?tx true] [?tx :db/txInstant ?ms ?tx true]]]" ); // Re-assert our initial fact against our schema. assert_transact!( conn, r#" [[:db/add "tempid" :person/name "Vanya"]]"# ); // performing a timeline move using the transactor. assert_transact!( conn, r#" [[:db/add (lookup-ref :person/name "Vanya") :person/name "Ivan"]]"# ); // Assert that our datoms are now the schema and the final assertion. assert_matches!( conn.datoms(), r#" [[?e1 :db/ident :person/name] [?e1 :db/valueType :db.type/string] [?e1 :db/cardinality :db.cardinality/one] [?e1 :db/unique :db.unique/identity] [?e1 :db/index true] [?e2 :person/name "Ivan"]] "# ); // Assert that we have three correct looking transactions. // This will fail if we're not cleaning up the 'datoms' table // after the timeline move. assert_matches!( conn.transactions(), r#" [[ [?e1 :db/ident :person/name ?tx1 true] [?e1 :db/valueType :db.type/string ?tx1 true] [?e1 :db/cardinality :db.cardinality/one ?tx1 true] [?e1 :db/unique :db.unique/identity ?tx1 true] [?e1 :db/index true ?tx1 true] [?tx1 :db/txInstant ?ms1 ?tx1 true] ] [ [?e2 :person/name "Vanya" ?tx2 true] [?tx2 :db/txInstant ?ms2 ?tx2 true] ] [ [?e2 :person/name "Ivan" ?tx3 true] [?e2 :person/name "Vanya" ?tx3 false] [?tx3 :db/txInstant ?ms3 ?tx3 true] ]] "# ); }
rust_cleaned_test_functions.jsonl/93662
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1931 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6794, 19049, 17805, 1243, 6886, 368, 341, 286, 1077, 5206, 4534, 284, 3393, 9701, 486, 2258, 543, 286, 4534, 514, 276, 83443, 43840, 5376, 1428, 286, 442, 4058, 531, 264, 6770, 10802, 624, 286, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_from_string() { let program = IntCodeProgram::from_string(String::from("1,0,0,0,99")); assert_eq!(vec![1,0,0,0,99], program.program); }
rust_cleaned_test_functions.jsonl/97
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 88 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5673, 3904, 368, 341, 286, 1077, 2025, 284, 1333, 2078, 10690, 486, 1499, 3904, 2242, 486, 1499, 445, 16, 11, 15, 11, 15, 11, 15, 11, 24, 24, 4010, 286, 2060, 10714, 10297, 4083, 20703, 16, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_check_us_ref() { let ref_image_shape: [usize; 2] = [40, 30]; let us_key_size = 2; let us_ref = arr2( &[[10., 20.], [0., 0.]] ); let result = check_us_ref(&us_ref, us_key_size, &ref_image_shape); assert_eq!(result.unwrap(), ()); let us_ref = arr2(&[[10., -2.]]); let result = check_us_ref(&us_ref, us_key_size, &ref_image_shape); assert_eq!(result.unwrap_err(), Flag::RefEpipolarTooShort); let us_ref = arr2( &[[10., -2.], [0., 0.]] ); let result = check_us_ref(&us_ref, us_key_size, &ref_image_shape); assert_eq!(result.unwrap_err(), Flag::RefCloseOutOfRange); let us_ref = arr2( &[[0., 0.], [10., -2.]] ); let result = check_us_ref(&us_ref, us_key_size, &ref_image_shape); assert_eq!(result.unwrap_err(), Flag::RefFarOutOfRange); }
rust_cleaned_test_functions.jsonl/73552
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 526 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 7200, 11306, 7793, 368, 341, 286, 1077, 2053, 4954, 13597, 25, 508, 51878, 26, 220, 17, 60, 284, 508, 19, 15, 11, 220, 18, 15, 935, 286, 1077, 601, 3097, 2368, 284, 220, 17, 401, 286, 1077, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_parse_data_from_file() { let datafile = "tests/data/heart_scale"; check_data_file(datafile).unwrap(); let problem = load_problem(datafile).unwrap(); let mut params = SvmParam::new(2); params.probability = true; let model = problem.train(&params).unwrap(); assert_eq!(model.get_num_classes(), 2); }
rust_cleaned_test_functions.jsonl/42831
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 138 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 1769, 5673, 2458, 368, 341, 262, 1077, 821, 1192, 284, 330, 23841, 13167, 14, 17735, 16727, 876, 262, 1779, 1769, 2458, 2592, 1192, 568, 15454, 543, 262, 1077, 3491, 284, 2795, 60139, 2592,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_wrap_return_type_not_applicable_when_return_type_is_not_result() { let content = r#" //- /main.rs use std::{string::String, result::Result::{self, Ok, Err}}; enum SomeOtherEnum { Ok(i32), Err(String), } fn foo() -> SomeOtherEnum { 0<|> } //- /std/lib.rs pub mod string { pub struct String { } } pub mod result { pub enum Result<T, E> { Ok(T), Err(E) } } "#; check_no_diagnostic_for_target_file(content); }
rust_cleaned_test_functions.jsonl/71651
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 400 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 38550, 12511, 1819, 7913, 8191, 46114, 47636, 12511, 1819, 6892, 7913, 5287, 368, 341, 286, 1077, 2213, 284, 435, 2, 698, 310, 78406, 608, 3817, 25638, 198, 310, 990, 1460, 22964, 917, 486, 703, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_format() { let mut varstruct = Variables::new(); let vars = &mut varstruct; assert_eq!( expand( b"%p1%s%p2%2s%p3%2s%p4%.2s", &[ Words("foo".to_string()), Words("foo".to_string()), Words("f".to_string()), Words("foo".to_string()) ], vars ), Ok("foofoo ffo".bytes().collect::<Vec<_>>()) ); assert_eq!( expand(b"%p1%:-4.2s", &[Words("foo".to_string())], vars), Ok("fo ".bytes().collect::<Vec<_>>()) ); assert_eq!( expand(b"%p1%d%p1%.3d%p1%5d%p1%:+d", &[Number(1)], vars), Ok("1001 1+1".bytes().collect::<Vec<_>>()) ); assert_eq!( expand(b"%p1%o%p1%#o%p2%6.4x%p2%#6.4X", &[Number(15), Number(27)], vars), Ok("17017 001b0X001B".bytes().collect::<Vec<_>>()) ); }
rust_cleaned_test_functions.jsonl/35450
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 548 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8955, 368, 341, 262, 1077, 5206, 762, 1235, 284, 21419, 486, 931, 543, 262, 1077, 19942, 284, 609, 6984, 762, 1235, 280, 262, 2060, 10714, 33673, 286, 9225, 1006, 310, 293, 31391, 79, 16, 12952,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_boxed_thiserror() { let error = MyError { source: io::Error::new(io::ErrorKind::Other, "oh no!"), }; let error = anyhow!(error); assert_eq!("oh no!", error.source().unwrap().to_string()); }
rust_cleaned_test_functions.jsonl/91394
{ "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, 10194, 291, 24868, 841, 368, 341, 262, 1077, 1465, 284, 3017, 1454, 341, 286, 2530, 25, 6399, 486, 1454, 486, 931, 37258, 486, 1454, 10629, 486, 11409, 11, 330, 2267, 902, 0, 4461, 262, 2605, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_os_string_clear() { let mut os_string = OsString::from("abc"); assert_eq!(3, os_string.inner.as_inner().len()); os_string.clear(); assert_eq!(&os_string, ""); assert_eq!(0, os_string.inner.as_inner().len()); }
rust_cleaned_test_functions.jsonl/105019
{ "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, 29387, 3904, 21811, 368, 341, 286, 1077, 5206, 2643, 3904, 284, 15433, 703, 486, 1499, 445, 13683, 797, 286, 2060, 10714, 10297, 18, 11, 2643, 3904, 9398, 5357, 34345, 1005, 2892, 5231, 286, 2643,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_shrink_to_fit() { let mut s = <String as StringExt>::with_capacity(100); StringExt::push_str(&mut s, "foo"); StringExt::shrink_to_fit(&mut s); assert_eq!(String::capacity(&s), 3); }
rust_cleaned_test_functions.jsonl/125207
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 115 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3712, 34365, 2346, 32416, 368, 341, 286, 1077, 5206, 274, 284, 366, 703, 438, 923, 6756, 6831, 4197, 35603, 7, 16, 15, 15, 317, 286, 923, 6756, 486, 9077, 2895, 2099, 6984, 274, 11, 330, 7975,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_until_error() { let mut ps = ParseStream { content: "Hello World".to_string(), cursor: 1, }; let err = ps.until("H", true).unwrap_err(); assert_eq!(ps.cursor, 1); assert_eq!(err.cursor, 1); assert_eq!(err.message, "expected `H`".to_string()); }
rust_cleaned_test_functions.jsonl/41159
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 178 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 44352, 4096, 368, 341, 286, 1077, 5206, 4726, 284, 14775, 3027, 341, 310, 2213, 25, 330, 9707, 4337, 3263, 983, 3904, 3148, 310, 8128, 25, 220, 16, 345, 286, 3634, 286, 1077, 1848, 284, 4726, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_context_function_build_arg_from_ctx() -> Result<()> { use pretty_assertions::assert_eq; let ctx = crate::tests::create_query_context()?; // Ok. { let args = ContextFunction::build_args_from_ctx(ctx.clone(), "database")?; assert_eq!("default", format!("{:?}", args[0])); } // Ok. { let args = ContextFunction::build_args_from_ctx(ctx.clone(), "current_user")?; assert_eq!("'root'@'127.0.0.1'", format!("{:?}", args[0])); } // Error. { let result = ContextFunction::build_args_from_ctx(ctx, "databasexx").is_err(); assert!(result); } Ok(()) }
rust_cleaned_test_functions.jsonl/78039
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 303 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8467, 9174, 20801, 6057, 5673, 15147, 368, 1464, 5714, 71698, 341, 262, 990, 5020, 16553, 908, 486, 2207, 10714, 280, 262, 1077, 5635, 284, 17717, 486, 23841, 486, 3182, 5738, 8467, 368, 69493, 26...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_connect_with_configured_iface() { let mut exec = fuchsia_async::Executor::new().expect("failed to create an executor"); // Create a configured ClientIfaceContainer. let mut test_values = test_setup(&mut exec); let (mut iface_manager, _) = create_iface_manager_with_client(&test_values, true); let temp_dir = TempDir::new().expect("failed to create temporary directory"); let path = temp_dir.path().join(rand_string()); let tmp_path = temp_dir.path().join(rand_string()); let (saved_networks, mut stash_server) = exec.run_singlethreaded(SavedNetworksManager::new_and_stash_server(path, tmp_path)); test_values.saved_networks = Arc::new(saved_networks); // Update the saved networks with knowledge of the test SSID and credentials. let network_id = NetworkIdentifier::new(TEST_SSID.as_bytes().to_vec(), SecurityType::Wpa); let credential = Credential::Password(TEST_PASSWORD.as_bytes().to_vec()); let save_network_fut = test_values.saved_networks.store(network_id, credential); pin_mut!(save_network_fut); assert_variant!(exec.run_until_stalled(&mut save_network_fut), Poll::Pending); process_stash_write(&mut exec, &mut stash_server); // Ask the IfaceManager to connect. let (connect_response_fut, mut sme_stream) = { let config = create_connect_request(TEST_SSID, TEST_PASSWORD); let connect_fut = iface_manager.connect(config); pin_mut!(connect_fut); assert_variant!(exec.run_until_stalled(&mut connect_fut), Poll::Pending); // Expect a client SME proxy request. let mut device_service_fut = test_values.device_service_stream.into_future(); let sme_server = assert_variant!( poll_device_service_req(&mut exec, &mut device_service_fut), Poll::Ready(fidl_fuchsia_wlan_device_service::DeviceServiceRequest::GetClientSme { iface_id: TEST_CLIENT_IFACE_ID, sme, responder }) => { // Send back a positive acknowledgement. assert!(responder.send(fuchsia_zircon::sys::ZX_OK).is_ok()); sme } ); // Run the connect request to completion. let connect_response_fut = match exec.run_until_stalled(&mut connect_fut) { Poll::Ready(connect_result) => match connect_result { Ok(receiver) => receiver.into_future(), Err(e) => panic!("failed to connect with {}", e), }, Poll::Pending => panic!("expected the connect request to finish"), }; (connect_response_fut, sme_server.into_stream().unwrap().into_future()) }; // Start running the client state machine. run_state_machine_futures(&mut exec, &mut iface_manager); // Acknowledge the disconnection attempt. assert_variant!( poll_sme_req(&mut exec, &mut sme_stream), Poll::Ready(fidl_fuchsia_wlan_sme::ClientSmeRequest::Disconnect{ responder }) => { responder.send().expect("could not send response") } ); // Make sure that the connect request has been sent out. run_state_machine_futures(&mut exec, &mut iface_manager); assert_variant!( poll_sme_req(&mut exec, &mut sme_stream), Poll::Ready(fidl_fuchsia_wlan_sme::ClientSmeRequest::Connect{ req, txn, control_handle: _ }) => { assert_eq!(req.ssid, TEST_SSID.as_bytes().to_vec()); assert_eq!(req.credential, fidl_fuchsia_wlan_sme::Credential::Password(TEST_PASSWORD.as_bytes().to_vec())); let (_stream, ctrl) = txn.expect("connect txn unused") .into_stream_and_control_handle().expect("error accessing control handle"); ctrl.send_on_finished(fidl_fuchsia_wlan_sme::ConnectResultCode::Success) .expect("failed to send connection completion"); } ); // Run the state machine future again so that it acks the oneshot. run_state_machine_futures(&mut exec, &mut iface_manager); // Verify that the oneshot has been acked. pin_mut!(connect_response_fut); assert_variant!(exec.run_until_stalled(&mut connect_response_fut), Poll::Ready(Ok(()))); }
rust_cleaned_test_functions.jsonl/62687
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2022 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15720, 6615, 5332, 3073, 67666, 368, 341, 286, 1077, 5206, 3883, 284, 282, 73391, 28346, 486, 25255, 486, 931, 1005, 17119, 445, 16091, 311, 1855, 458, 31558, 3071, 286, 442, 4230, 264, 19755, 842...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_empty_path() { let path = Path::builder().build(); test_path( path.as_slice(), &StrokeOptions::default(), Some(0), ); }
rust_cleaned_test_functions.jsonl/117059
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 89 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15124, 2638, 368, 341, 262, 1077, 1815, 284, 7933, 486, 17850, 1005, 5834, 543, 262, 1273, 2638, 1006, 286, 1815, 5357, 26488, 3148, 286, 609, 31557, 3798, 486, 2258, 3148, 286, 4329, 7, 15, 132...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_error_rate_limit() { crate::testutil::set_logger_for_test(); /// Call `send_icmpv4_ttl_expired` with dummy values. fn send_icmpv4_ttl_expired_helper(ctx: &mut Dummyv4Context) { send_icmpv4_ttl_expired( ctx, DummyDeviceId, FrameDestination::Unicast, DUMMY_CONFIG_V4.remote_ip, DUMMY_CONFIG_V4.local_ip, IpProto::Udp.into(), Buf::new(&mut [], ..), 0, ); } /// Call `send_icmpv4_parameter_problem` with dummy values. fn send_icmpv4_parameter_problem_helper(ctx: &mut Dummyv4Context) { send_icmpv4_parameter_problem( ctx, DummyDeviceId, FrameDestination::Unicast, DUMMY_CONFIG_V4.remote_ip, DUMMY_CONFIG_V4.local_ip, Icmpv4ParameterProblemCode::PointerIndicatesError, Icmpv4ParameterProblem::new(0), Buf::new(&mut [], ..), 0, ); } /// Call `send_icmpv4_dest_unreachable` with dummy values. fn send_icmpv4_dest_unreachable_helper(ctx: &mut Dummyv4Context) { send_icmpv4_dest_unreachable( ctx, DummyDeviceId, FrameDestination::Unicast, DUMMY_CONFIG_V4.remote_ip, DUMMY_CONFIG_V4.local_ip, Icmpv4DestUnreachableCode::DestNetworkUnreachable, Buf::new(&mut [], ..), 0, ); } /// Call `send_icmpv6_ttl_expired` with dummy values. fn send_icmpv6_ttl_expired_helper(ctx: &mut Dummyv6Context) { send_icmpv6_ttl_expired( ctx, DummyDeviceId, FrameDestination::Unicast, UnicastAddr::from_witness(DUMMY_CONFIG_V6.remote_ip).unwrap(), DUMMY_CONFIG_V6.local_ip, IpProto::Udp.into(), Buf::new(&mut [], ..), 0, ); } /// Call `send_icmpv6_packet_too_big` with dummy values. fn send_icmpv6_packet_too_big_helper(ctx: &mut Dummyv6Context) { send_icmpv6_packet_too_big( ctx, DummyDeviceId, FrameDestination::Unicast, UnicastAddr::from_witness(DUMMY_CONFIG_V6.remote_ip).unwrap(), DUMMY_CONFIG_V6.local_ip, IpProto::Udp.into(), 0, Buf::new(&mut [], ..), 0, ); } /// Call `send_icmpv6_parameter_problem` with dummy values. fn send_icmpv6_parameter_problem_helper(ctx: &mut Dummyv6Context) { send_icmpv6_parameter_problem( ctx, DummyDeviceId, FrameDestination::Unicast, DUMMY_CONFIG_V6.remote_ip, DUMMY_CONFIG_V6.local_ip, Icmpv6ParameterProblemCode::ErroneousHeaderField, Icmpv6ParameterProblem::new(0), Buf::new(&mut [], ..), false, ); } /// Call `send_icmpv6_dest_unreachable` with dummy values. fn send_icmpv6_dest_unreachable_helper(ctx: &mut Dummyv6Context) { send_icmpv6_dest_unreachable( ctx, DummyDeviceId, FrameDestination::Unicast, UnicastAddr::from_witness(DUMMY_CONFIG_V6.remote_ip).unwrap(), DUMMY_CONFIG_V6.local_ip, Icmpv6DestUnreachableCode::NoRoute, Buf::new(&mut [], ..), ); } // Run tests for each function that sends error messages to make sure // they're all properly rate limited. fn run_test<C, W: Fn(u64) -> DummyContext<C>, S: Fn(&mut DummyContext<C>)>( with_errors_per_second: W, send: S, ) { // Note that we could theoretically have more precise tests here // just have a few sanity checks to make sure that we're actually // invoking it when we expect to (as opposed to bypassing it // Don't use `DEFAULT_ERRORS_PER_SECOND` because it's 2^16 and it // makes this test take a long time. const ERRORS_PER_SECOND: u64 = 64; let mut ctx = with_errors_per_second(ERRORS_PER_SECOND); for i in 0..ERRORS_PER_SECOND { send(&mut ctx); assert_eq!(ctx.get_counter("IcmpContext::send_icmp_error_message"), i as usize + 1); } assert_eq!( ctx.get_counter("IcmpContext::send_icmp_error_message"), ERRORS_PER_SECOND as usize ); send(&mut ctx); assert_eq!( ctx.get_counter("IcmpContext::send_icmp_error_message"), ERRORS_PER_SECOND as usize ); // error messages regardless of how much time has elapsed. let mut ctx = with_errors_per_second(0); send(&mut ctx); assert_eq!(ctx.get_counter("IcmpContext::send_icmp_error_message"), 0); ctx.sleep_skip_timers(Duration::from_secs(1)); send(&mut ctx); assert_eq!(ctx.get_counter("IcmpContext::send_icmp_error_message"), 0); ctx.sleep_skip_timers(Duration::from_secs(1)); send(&mut ctx); assert_eq!(ctx.get_counter("IcmpContext::send_icmp_error_message"), 0); } fn with_errors_per_second_v4(errors_per_second: u64) -> Dummyv4Context { Dummyv4Context::with_state(DummyIcmpv4Context::with_errors_per_second( errors_per_second, )) } run_test(with_errors_per_second_v4, send_icmpv4_ttl_expired_helper); run_test(with_errors_per_second_v4, send_icmpv4_parameter_problem_helper); run_test(with_errors_per_second_v4, send_icmpv4_dest_unreachable_helper); fn with_errors_per_second_v6(errors_per_second: u64) -> Dummyv6Context { Dummyv6Context::with_state(DummyIcmpv6Context::with_errors_per_second( errors_per_second, )) } run_test(with_errors_per_second_v6, send_icmpv6_ttl_expired_helper); run_test(with_errors_per_second_v6, send_icmpv6_packet_too_big_helper); run_test(with_errors_per_second_v6, send_icmpv6_parameter_problem_helper); run_test(with_errors_per_second_v6, send_icmpv6_dest_unreachable_helper); }
rust_cleaned_test_functions.jsonl/65676
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 3804 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4096, 9246, 14763, 368, 341, 286, 17717, 486, 1944, 1314, 486, 746, 27413, 5478, 4452, 1428, 286, 1048, 7143, 1565, 6681, 32747, 1307, 85, 19, 87157, 80221, 63, 448, 17292, 2750, 624, 286, 5168, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_public_exponent_debug() { let exponent = PublicExponent::from_be_bytes(untrusted::Input::from(&[0x1, 0x00, 0x01]), 65537) .unwrap(); assert_eq!("PublicExponent(65537)", format!("{:?}", exponent)); }
rust_cleaned_test_functions.jsonl/55431
{ "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, 27074, 2702, 1146, 15446, 368, 341, 286, 1077, 27690, 4035, 310, 3066, 840, 1146, 486, 1499, 21263, 12524, 18364, 83837, 486, 2505, 486, 1499, 2099, 58, 15, 87, 16, 11, 220, 15, 87, 15, 15, 11...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_basic_string() { let p = Parser::new(); assert_eq!(p.basic_string("\"Tλïƨ ïƨ á βáƨïç ƨƭřïñϱ.\"").1, Done("", "Tλïƨ ïƨ á βáƨïç ƨƭřïñϱ.")); }
rust_cleaned_test_functions.jsonl/27407
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 163 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 34729, 3904, 368, 341, 262, 1077, 281, 284, 21102, 486, 931, 543, 262, 2060, 10714, 10297, 79, 33257, 3904, 38915, 51, 71807, 12992, 18791, 33985, 144839, 75005, 73780, 33985, 144839, 75005, 73780, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_part2() { let ex = " .#..##.###...####### ##.############..##. .#.######.########.# .###.#######.####.#. #####.##.#.##.###.## ..#####..#.######### #################### #.####....###.#.#.## ##.################# #####.##.###..####.. ..######..##.####### ####.##.####...##..# .#####..#.######.### ##...#.##########... #.##########.####### .####.#.###.###.#.## ....##.##.###..##### .#.#.###########.### #.#.#.#####.####.### ###.##.####.##.#..##"; assert_eq!(part2(ex), 802); }
rust_cleaned_test_functions.jsonl/12242
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 237 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10495, 17, 368, 341, 286, 1077, 505, 284, 6228, 43326, 496, 565, 13, 14374, 1112, 82024, 565, 13, 17455, 496, 565, 624, 43326, 13, 77129, 13, 1357, 13, 4956, 13, 14374, 13, 97864, 13, 820, 433...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_query_config() { let msg = InstantiateMsg { owner: h(OWNER), nebula_token: h(NEB_TOKEN), }; let info = mock_info(OWNER, &[]); let mut deps = mock_dependencies(&[]); let _res = instantiate(deps.as_mut(), mock_env(), info, msg) .expect("contract successfully executes InstantiateMsg"); let msg = QueryMsg::Config {}; let res = query(deps.as_ref(), mock_env(), msg).unwrap(); let config: ConfigResponse = from_binary(&res).unwrap(); assert_eq!(config, ConfigResponse { owner: h(OWNER) }); }
rust_cleaned_test_functions.jsonl/76314
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 230 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5738, 5332, 368, 341, 262, 1077, 3750, 284, 32288, 6611, 341, 286, 6372, 25, 305, 7, 99031, 1326, 286, 80867, 5607, 6458, 25, 305, 7, 3944, 33, 18681, 1326, 262, 3634, 262, 1077, 3546, 284, 78...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_version_rebase_by_branch() { let hdr: MapxOrdRawKeyVs<usize> = MapxOrdRawKeyVs::new(); let bn = BranchName(b"test"); let vn = VersionName(b"test1"); pnk!(hdr.branch_create(bn, vn, false)); let key = <usize as ValueEnDe>::encode(&0); pnk!(hdr.insert_by_branch(key.clone(), 0, bn)); pnk!(hdr.version_create_by_branch(VersionName(&[0]), bn)); pnk!(hdr.insert_by_branch(key.clone(), 1, bn)); pnk!(hdr.version_create_by_branch(VersionName(&[1]), bn)); pnk!(hdr.insert_by_branch(key.clone(), 2, bn)); pnk!(hdr.version_create_by_branch(VersionName(&[2]), bn)); pnk!(hdr.insert_by_branch(key.clone(), 3, bn)); pnk!(hdr.version_create_by_branch(VersionName(&[3]), bn)); pnk!(hdr.insert_by_branch(key.clone(), 4, bn)); pnk!(hdr.version_create_by_branch(VersionName(&[4]), bn)); pnk!(hdr.insert_by_branch(key.clone(), 5, bn)); assert_eq!(0, pnk!(hdr.get_by_branch_version(&key, bn, vn))); assert_eq!( 1, pnk!(hdr.get_by_branch_version(&key, bn, VersionName(&[0]))) ); assert_eq!( 2, pnk!(hdr.get_by_branch_version(&key, bn, VersionName(&[1]))) ); assert_eq!( 3, pnk!(hdr.get_by_branch_version(&key, bn, VersionName(&[2]))) ); assert_eq!( 4, pnk!(hdr.get_by_branch_version(&key, bn, VersionName(&[3]))) ); assert_eq!( 5, pnk!(hdr.get_by_branch_version(&key, bn, VersionName(&[4]))) ); unsafe { pnk!(hdr.version_rebase_by_branch(VersionName(&[1]), bn)); } assert!(hdr.version_exists_on_branch(VersionName(&[0]), bn)); assert!(hdr.version_exists_on_branch(VersionName(&[1]), bn)); assert!(!hdr.version_exists_on_branch(VersionName(&[2]), bn)); assert!(!hdr.version_exists_on_branch(VersionName(&[3]), bn)); assert!(!hdr.version_exists_on_branch(VersionName(&[4]), bn)); assert_eq!( 1, pnk!(hdr.get_by_branch_version(&key, bn, VersionName(&[0]))) ); assert_eq!( 5, pnk!(hdr.get_by_branch_version(&key, bn, VersionName(&[1]))) ); assert!( hdr.get_by_branch_version(&key, bn, VersionName(&[2])) .is_none() ); assert!( hdr.get_by_branch_version(&key, bn, VersionName(&[3])) .is_none() ); assert!( hdr.get_by_branch_version(&key, bn, VersionName(&[4])) .is_none() ); assert_eq!(5, pnk!(hdr.get_by_branch(&key, bn))); }
rust_cleaned_test_functions.jsonl/53991
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1322 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9438, 1288, 3152, 3710, 28031, 368, 341, 262, 1077, 36615, 25, 5027, 87, 24621, 20015, 1592, 51737, 90244, 29, 284, 5027, 87, 24621, 20015, 1592, 51737, 486, 931, 1428, 262, 1077, 40597, 284, 2511...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_blocks_intersecting_bbox() { let chunk_map = chunk_map(); let froms = [ position!(0.0, 66.0, 0.0), position!(100.0, 65.0, 0.0), position!(0.0, 100.0, 0.0), ]; let dests = [ position!(0.0, 65.0, 0.0), position!(100.0, 65.0, 0.0), position!(0.0, 90.0, 0.0), ]; let results = [ position!(0.0, 65.0, 0.0), position!(100.0, 65.0, 0.0), position!(0.0, 90.0, 0.0), ]; let bbox = crate::physics::component::bbox(0.25, 0.25, 0.25); for ((from, dest), result) in froms.iter().zip(&dests).zip(&results) { let intersect = blocks_intersecting_bbox(&chunk_map, *from, *dest, &bbox); let mut pos = *dest; intersect.apply_to(&mut pos); assert_pos_eq!(pos, result); } }
rust_cleaned_test_functions.jsonl/130419
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 531 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 25201, 72747, 287, 59390, 368, 341, 286, 1077, 11879, 5376, 284, 11879, 5376, 1428, 286, 1077, 504, 82, 284, 2278, 310, 2309, 10297, 15, 13, 15, 11, 220, 21, 21, 13, 15, 11, 220, 15, 13, 15,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_create_schema_with_pool() { let _setup = SetupLibraryWalletPool::init(); let handle = create_schema_real(); let _source_id = get_source_id(handle).unwrap(); let _schema_id = get_schema_id(handle).unwrap(); let _schema_json = to_string(handle).unwrap(); let payment = &get_payment_txn(handle).unwrap(); assert!(payment.amount > 0); }
rust_cleaned_test_functions.jsonl/33234
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 183 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8657, 25371, 6615, 15709, 368, 341, 286, 1077, 716, 15188, 284, 18626, 16915, 38259, 10551, 486, 2327, 1428, 286, 1077, 3705, 284, 1855, 25371, 15266, 1428, 286, 1077, 716, 2427, 842, 284, 633, 10...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_find_roots_quartic_quadruple_root() { assert_eq!( find_roots_quartic(2401f64, 2744f64, 1176f64, 224f64, 16f64), Roots::One([-0.2857142857142857f64]) ); // 32-bit floating point is less accurate assert_eq!( find_roots_quartic(2401f32, 2744f32, 1176f32, 224f32, 16f32), Roots::One([-0.2857143f32]) ); }
rust_cleaned_test_functions.jsonl/18575
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 242 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21814, 26608, 2412, 11280, 80887, 11280, 14666, 6061, 12993, 368, 341, 1789, 286, 2060, 10714, 33673, 310, 1477, 26608, 2412, 11280, 80887, 7, 17, 19, 15, 16, 69, 21, 19, 11, 220, 17, 22, 19, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_unregister_ioevent() { assert_eq!(std::mem::size_of::<NoDatamatch>(), 0); let kvm = Kvm::new().unwrap(); let vm_fd = kvm.create_vm().unwrap(); let evtfd = EventFd::new(EFD_NONBLOCK).unwrap(); let pio_addr = IoEventAddress::Pio(0xf4); let mmio_addr = IoEventAddress::Mmio(0x1000); // First try to unregister addresses which have not been registered. assert!(vm_fd.unregister_ioevent(&evtfd, &pio_addr).is_err()); assert!(vm_fd.unregister_ioevent(&evtfd, &mmio_addr).is_err()); // Now register the addresses assert!(vm_fd .register_ioevent(&evtfd, &pio_addr, NoDatamatch) .is_ok()); assert!(vm_fd .register_ioevent(&evtfd, &mmio_addr, NoDatamatch) .is_ok()); // Try again unregistering the addresses. This time it should work // since they have been previously registered. assert!(vm_fd.unregister_ioevent(&evtfd, &pio_addr).is_ok()); assert!(vm_fd.unregister_ioevent(&evtfd, &mmio_addr).is_ok()); }
rust_cleaned_test_functions.jsonl/102241
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 520 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 68992, 16939, 3087, 368, 341, 286, 2060, 10714, 10297, 1834, 486, 10536, 486, 2141, 3575, 27638, 2753, 45696, 309, 754, 39019, 220, 15, 626, 286, 1077, 94748, 284, 730, 7338, 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...
1
#[test] fn test_do_withdrawal() { let mut account = Account { client: 1, available: 5.0, held: 0.0, total: 0.0, locked: false, }; let transaction = Transaction::new(TransactionType::Withdrawal, 1, 1, Some(1.1234)); let performed_correctly = account.perform(&transaction).is_ok(); assert!(performed_correctly); assert_eq!(account.available, 3.8766); assert_eq!(account.total, 3.8766); }
rust_cleaned_test_functions.jsonl/117003
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 255 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 26309, 6615, 7633, 278, 368, 341, 286, 1077, 5206, 2692, 284, 8615, 341, 310, 2943, 25, 220, 16, 345, 310, 2500, 25, 220, 20, 13, 15, 345, 310, 5644, 25, 220, 15, 13, 15, 345, 310, 2790, 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_insert() { let mut wheel = LocalTimer::<i32, 1000, 60, 60, 24>::new(1, 0); let mut timer_refs = vec![]; for i in 0..1000000 { timer_refs.push(wheel.insert(i, 10000 )); } let mut index = 0 as usize; for i in 0..10000 { let time = i; while wheel.check_sleep(time) == 0 { if let Some(_) = wheel.pop(time) { index += 1; } } } assert_eq!(timer_refs.len(), index); }
rust_cleaned_test_functions.jsonl/24002
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 277 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 17678, 368, 8022, 262, 1077, 5206, 13284, 284, 8774, 10105, 27638, 72, 18, 17, 11, 220, 16, 15, 15, 15, 11, 220, 21, 15, 11, 220, 21, 15, 11, 220, 17, 19, 6831, 931, 7, 16, 11, 220, 15, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
#[test] fn test_arena_contains() { let mut arena = Arena::new(); assert_eq!(0, arena.len()); let index0 = arena.insert("test"); let index1 = arena.insert("foo"); assert_eq!(2, arena.len()); assert!(arena.contains(index0)); assert!(arena.contains(index1)); assert_eq!(Some("test"), arena.remove(index0)); assert_eq!(1, arena.len()); assert!(!arena.contains(index0)); // element not in the arena assert!(arena.contains(index1)); }
rust_cleaned_test_functions.jsonl/30763
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 246 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 62, 30527, 63598, 368, 341, 286, 1077, 5206, 24902, 284, 27047, 486, 931, 543, 286, 2060, 10714, 10297, 15, 11, 24902, 19406, 1423, 286, 1077, 1922, 15, 284, 24902, 7030, 445, 1944, 797, 286, 10...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_stdin_show_tabs() { for same_param in vec!["-T", "--show-tabs"] { new_ucmd!() .args(&[same_param]) .pipe_in("\t\0\n") .succeeds() .stdout_only("^I\0\n"); } }
rust_cleaned_test_functions.jsonl/90933
{ "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, 15656, 258, 15267, 57953, 368, 341, 262, 369, 1852, 4090, 304, 7486, 0, 1183, 12, 51, 497, 14482, 3445, 31741, 1341, 341, 286, 501, 68887, 2277, 0, 741, 310, 659, 2116, 2099, 58, 24063, 4090, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_simple_for_loop_value_of_variable_after_loop_never_entering() { let input = " FOR i% = 1 TO -1 PRINT i% NEXT "; let mut interpreter = interpret(input); assert_has_variable!(interpreter, "i%", 1); assert_eq!(interpreter.stdout().output(), ""); }
rust_cleaned_test_functions.jsonl/64155
{ "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, 30015, 5478, 17198, 3142, 3575, 14635, 19844, 17198, 13925, 423, 37480, 287, 368, 341, 262, 1077, 1946, 284, 6228, 262, 4613, 600, 4, 284, 220, 16, 5146, 481, 16, 198, 286, 35893, 600, 13744, 26...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_infallible_try_from_int_error() { let func = |x: i8| -> Result<i32, TryFromIntError> { Ok(x.try_into()?) }; assert!(func(0).is_ok()); }
rust_cleaned_test_functions.jsonl/108506
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 79 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1243, 13464, 1238, 53283, 5673, 4042, 4096, 368, 341, 262, 1077, 2915, 284, 760, 87, 25, 600, 23, 91, 1464, 5714, 21897, 18, 17, 11, 9735, 3830, 1072, 1454, 29, 314, 7622, 2075, 48779, 45514, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_gga_north_east() { let mut nmea = Nmea::new(); nmea.parse("$GPGGA,092750.000,5321.6802,N,00630.3372,E,1,8,1.03,61.7,M,55.2,M,,*64") .unwrap(); assert_eq!(nmea.latitude().unwrap(), 53. + 21.6802 / 60.); assert_eq!(nmea.longitude().unwrap(), 6. + 30.3372 / 60.); }
rust_cleaned_test_functions.jsonl/65852
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 195 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1889, 6743, 1089, 2364, 2204, 559, 368, 341, 286, 1077, 5206, 308, 2660, 64, 284, 451, 2660, 64, 486, 931, 543, 286, 308, 2660, 64, 4632, 20912, 38, 11383, 16128, 11, 15, 24, 17, 22, 20, 15,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_check_colocated() { let hw1 = RefCell::new(CpuHardware::new()); let hw2 = RefCell::new(CpuHardware::new()); unsafe { let buf1 = Buffer::raw(&hw1, 1); let buf2 = Buffer::raw(&hw1, 1); let buf3 = Buffer::raw(&hw2, 1); assert!(buf1.check_colocated(&buf1).is_ok()); assert!(buf1.check_colocated(&buf2).is_ok()); assert!(buf1.check_colocated(&buf3).is_err()); assert!(buf2.check_colocated(&buf1).is_ok()); assert!(buf2.check_colocated(&buf2).is_ok()); assert!(buf2.check_colocated(&buf3).is_err()); assert!(buf3.check_colocated(&buf1).is_err()); assert!(buf3.check_colocated(&buf2).is_err()); assert!(buf3.check_colocated(&buf3).is_ok()); } }
rust_cleaned_test_functions.jsonl/78625
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 437 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 7200, 10211, 509, 657, 368, 341, 286, 1077, 31256, 16, 284, 8550, 3599, 486, 931, 3025, 5584, 66862, 486, 931, 1423, 286, 1077, 31256, 17, 284, 8550, 3599, 486, 931, 3025, 5584, 66862, 486, 931,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_batch_matmul_trans_not_square() { // blas is not used with(|g: &mut ag::Graph<f32>| { let a: ag::Tensor<f32> = g.constant(array![[[1., 2.], [3., 4.]], [[1., 2.], [3., 4.]]]); let b: ag::Tensor<f32> = g.constant(array![[[1., 2.], [3., 4.]], [[1., 2.], [3., 4.]]]); let c = g.batch_matmul(a, b); let ans = array![[[7., 10.], [15., 22.]], [[7., 10.], [15., 22.]]].into_dyn(); let ret = c.eval(&[]).unwrap(); assert!(ret.all_close(&ans, 1e-4)); assert_eq!(ret.shape(), &[2, 2, 2]); }); }
rust_cleaned_test_functions.jsonl/22774
{ "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, 14534, 16610, 24160, 7965, 7913, 39794, 368, 341, 262, 442, 48577, 374, 537, 1483, 198, 262, 448, 22428, 70, 25, 609, 6984, 933, 486, 11212, 63895, 18, 17, 69844, 341, 286, 1077, 264, 25, 933, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_compile_value_with_formatter() { let text = "{ foobar | my_formatter }"; let instructions = compile(text).unwrap(); assert_eq!(1, instructions.len()); assert_eq!( &FormattedValue(vec!["foobar"], "my_formatter"), &instructions[0] ); }
rust_cleaned_test_functions.jsonl/131986
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 166 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 74170, 3142, 6615, 73965, 368, 972, 286, 1077, 1467, 284, 13868, 11756, 31393, 760, 847, 73965, 335, 3534, 286, 1077, 11221, 284, 19192, 7235, 568, 15454, 1647, 286, 2060, 10714, 10297, 16, 11, 11...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_hstore_params() { macro_rules! make_map { ($($k:expr => $v:expr),+) => ({ let mut map = HashMap::new(); $(map.insert($k, $v);)+ map }) } test_type( "hstore", &[ ( Some(make_map!("a".to_owned() => Some("1".to_owned()))), "'a=>1'", ), ( Some(make_map!("hello".to_owned() => Some("world!".to_owned()), "hola".to_owned() => Some("mundo!".to_owned()), "what".to_owned() => None)), "'hello=>world!,hola=>mundo!,what=>NULL'", ), (None, "NULL"), ], ); }
rust_cleaned_test_functions.jsonl/120857
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 465 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1523, 4314, 6745, 368, 341, 262, 18072, 21407, 0, 1281, 5376, 341, 286, 1711, 699, 74, 96011, 589, 400, 85, 96011, 701, 36197, 589, 13861, 310, 1077, 5206, 2415, 284, 10528, 486, 931, 543, 310, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_compare_reference_impl() { const OUT: usize = 303; let mut input_buf = [0; TEST_CASES_MAX]; paint_test_input(&mut input_buf); for &case in TEST_CASES { let input = &input_buf[..case]; #[cfg(feature = "std")] dbg!(case); // regular { let mut reference_hasher = reference_impl::Hasher::new(); reference_hasher.update(input); let mut expected_out = [0; OUT]; reference_hasher.finalize(&mut expected_out); let mut test_hasher = crate::Hasher::new(); test_hasher.update(input); let mut test_out = [0; OUT]; test_hasher.finalize(&mut test_out); assert_eq!(test_out[..], expected_out[..]); } // keyed { let mut reference_hasher = reference_impl::Hasher::new_keyed(&TEST_KEY); reference_hasher.update(input); let mut expected_out = [0; OUT]; reference_hasher.finalize(&mut expected_out); let mut test_hasher = crate::Hasher::new_keyed(&TEST_KEY); test_hasher.update(input); let mut test_out = [0; OUT]; test_hasher.finalize(&mut test_out); assert_eq!(test_out[..], expected_out[..]); } // derive_key { let context = "BLAKE3 2019-12-27 16:13:59 example context (not the test vector one)"; let mut reference_hasher = reference_impl::Hasher::new_derive_key(context); reference_hasher.update(input); let mut expected_out = [0; OUT]; reference_hasher.finalize(&mut expected_out); let mut test_hasher = crate::Hasher::new_derive_key(context); test_hasher.update(input); let mut test_out = [0; OUT]; test_hasher.finalize(&mut test_out); assert_eq!(test_out[..], expected_out[..]); } } }
rust_cleaned_test_functions.jsonl/79368
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 963 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 32235, 25433, 21007, 368, 341, 262, 733, 9808, 25, 22301, 284, 220, 18, 15, 18, 26, 715, 262, 1077, 5206, 1946, 10363, 284, 508, 15, 26, 13602, 28540, 50, 6806, 935, 262, 6177, 4452, 5898, 209...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
#[test] fn test_solid_regex_only_null() { let mut cmd = assert_cmd::Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap(); cmd.args(&[ "-sz", "-og", ".\\n.", "--", "perl", "-pne", "$. == 2 and printf \"_\"", ]) .write_stdin("ABC\nDEF\nGHI\nJKL\n") .assert() .stdout("ABC\n_DEF\n_GHI\n_JKL\n"); }
rust_cleaned_test_functions.jsonl/7897
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 277 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 643, 5192, 41832, 18410, 15162, 368, 341, 286, 1077, 5206, 5439, 284, 2060, 11684, 486, 4062, 486, 66715, 21816, 16978, 17223, 34, 7581, 46, 94126, 4708, 15197, 15454, 543, 286, 5439, 16365, 2099, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_bytes_or_string() { #[serde_as] #[derive(Debug, Serialize, Deserialize, PartialEq)] struct Struct { #[serde_as(as = "BytesOrString")] value: Vec<u8>, }; is_equal( Struct { value: vec![1, 2, 3], }, r#"{"value":[1,2,3]}"#, ); check_deserialization( Struct { value: vec![72, 101, 108, 108, 111], }, r#"{"value":"Hello"}"#, ); #[serde_as] #[derive(Debug, Serialize, Deserialize, PartialEq)] struct StructVec { #[serde_as(as = "Vec<BytesOrString>")] value: Vec<Vec<u8>>, }; is_equal( StructVec { value: vec![vec![1, 2, 3]], }, r#"{"value":[[1,2,3]]}"#, ); check_deserialization( StructVec { value: vec![ vec![72, 101, 108, 108, 111], vec![87, 111, 114, 108, 100], vec![1, 2, 3], ], }, r#"{"value":["Hello","World",[1,2,3]]}"#, ); }
rust_cleaned_test_functions.jsonl/23049
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 619 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 12524, 8734, 3904, 368, 341, 262, 11506, 47024, 11898, 921, 262, 11506, 27098, 42618, 11, 39900, 11, 48440, 11, 55039, 5563, 262, 2036, 16139, 341, 286, 11506, 47024, 11898, 36951, 284, 330, 7078, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_increase_total_stake_ok() { new_test_ext().execute_with(|| { let increment = 10000; assert_eq!(Subtensor::get_total_stake(), 0); Subtensor::increase_total_stake(increment); assert_eq!(Subtensor::get_total_stake(), increment); }); }
rust_cleaned_test_functions.jsonl/17166
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 117 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 73807, 10784, 1261, 726, 19817, 368, 341, 8638, 4452, 9927, 1005, 10257, 6615, 79453, 341, 197, 10217, 16252, 284, 220, 16, 15, 15, 15, 15, 401, 286, 2060, 10714, 10297, 3136, 46111, 486, 455, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_redis_storage() { let a: i64 = 6; let mut counter: i64 = 0; let mut s = RedisStorage::new("redis://127.0.0.1").unwrap(); s.flush().unwrap(); assert_eq!(a * 10, test_func_1(a, &mut counter)); assert_eq!(counter, 1); assert_eq!(a * 10, cache!(s, test_func_1(a, &mut counter))); assert_eq!(counter, 2); let mut counter: i64 = 1; assert_eq!(a * 10, cache!(s, test_func_1(a, &mut counter))); assert_eq!(counter, 1); s.flush().unwrap(); }
rust_cleaned_test_functions.jsonl/123185
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 287 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 87542, 23310, 368, 341, 286, 1077, 264, 25, 600, 21, 19, 284, 220, 21, 280, 286, 1077, 5206, 5546, 25, 600, 21, 19, 284, 220, 15, 280, 286, 1077, 5206, 274, 284, 34158, 5793, 486, 931, 445, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_dhcp_type_with_dhcp_type_option_returns_value() { let mut msg = Message::new(); msg.options.push(ConfigOption { code: OptionCode::DhcpMessageType, value: vec![MessageType::DHCPDISCOVER.into()], }); let got = msg.get_dhcp_type().unwrap(); let want = MessageType::DHCPDISCOVER; assert_eq!(got, want); }
rust_cleaned_test_functions.jsonl/93680
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 197 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 814, 62169, 1819, 6615, 814, 62169, 1819, 9672, 58900, 3142, 368, 341, 286, 1077, 5206, 3750, 284, 4856, 486, 931, 543, 286, 3750, 10912, 2552, 33687, 5341, 341, 310, 2038, 25, 6959, 2078, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_legacy_message_serialization() { let program_id0 = Pubkey::new_unique(); let program_id1 = Pubkey::new_unique(); let id0 = Pubkey::new_unique(); let id1 = Pubkey::new_unique(); let id2 = Pubkey::new_unique(); let id3 = Pubkey::new_unique(); let instructions = vec![ Instruction::new_with_bincode(program_id0, &0, vec![AccountMeta::new(id0, false)]), Instruction::new_with_bincode(program_id0, &0, vec![AccountMeta::new(id1, true)]), Instruction::new_with_bincode( program_id1, &0, vec![AccountMeta::new_readonly(id2, false)], ), Instruction::new_with_bincode( program_id1, &0, vec![AccountMeta::new_readonly(id3, true)], ), ]; let mut message = LegacyMessage::new(&instructions, Some(&id1)); message.recent_blockhash = Hash::new_unique(); let bytes1 = bincode::serialize(&message).unwrap(); let bytes2 = bincode::serialize(&VersionedMessage::Legacy(message.clone())).unwrap(); assert_eq!(bytes1, bytes2); let message1: LegacyMessage = bincode::deserialize(&bytes1).unwrap(); let message2: VersionedMessage = bincode::deserialize(&bytes2).unwrap(); if let VersionedMessage::Legacy(message2) = message2 { assert_eq!(message, message1); assert_eq!(message1, message2); } else { panic!("should deserialize to legacy message"); } }
rust_cleaned_test_functions.jsonl/22812
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 768 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 97555, 6462, 25602, 2022, 368, 341, 286, 1077, 2025, 842, 15, 284, 22611, 792, 486, 931, 21218, 543, 286, 1077, 2025, 842, 16, 284, 22611, 792, 486, 931, 21218, 543, 286, 1077, 877, 15, 284, 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_dyn_keypairs_compile() { let xs: Vec<Box<dyn Signer>> = vec![Box::new(Foo {}), Box::new(Bar {})]; assert_eq!( xs.sign_message(b""), vec![Signature::default(), Signature::default()], ); let xs_ref: &[Box<dyn Signer>] = &xs; assert_eq!( Signers::sign_message(xs_ref, b""), vec![Signature::default(), Signature::default()], ); }
rust_cleaned_test_functions.jsonl/57151
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 249 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 69213, 3097, 77256, 74170, 368, 341, 286, 1077, 11943, 25, 11312, 79852, 92846, 7075, 261, 2452, 284, 7486, 20703, 1611, 486, 931, 7832, 2624, 4687, 701, 8261, 486, 931, 7, 3428, 4687, 12587, 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