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_check_store_id() { let mut req = RaftCmdRequest::default(); req.mut_header().mut_peer().set_store_id(1); check_store_id(&req, 1).unwrap(); check_store_id(&req, 2).unwrap_err(); }
rust_cleaned_test_functions.jsonl/6857
{ "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, 7200, 14809, 842, 368, 341, 286, 1077, 5206, 4232, 284, 18482, 723, 15613, 1900, 486, 2258, 543, 286, 4232, 744, 332, 8757, 1005, 6984, 45159, 1005, 746, 14809, 842, 7, 16, 317, 286, 1779, 14809...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_mixed_tracing_for_multiple_enums() { #[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Clone)] enum Foo { A, B(Bar), } #[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Clone)] enum Bar { C, D, } let mut samples = Samples::new(); let mut tracer = Tracer::new(TracerConfig::default()); tracer.trace_value(&mut samples, &Bar::D).unwrap(); tracer.trace_type::<Foo>(&samples).unwrap(); tracer.trace_type::<Bar>(&samples).unwrap(); let registry = tracer.registry().unwrap(); // Note that we do not use the type parameter in the name. let variants = match registry.get("Foo").unwrap() { ContainerFormat::Enum(variants) => variants, _ => panic!("should be an enum"), }; assert_eq!(variants.len(), 2); }
rust_cleaned_test_functions.jsonl/23933
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 360 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 717, 3286, 3547, 4527, 5478, 45233, 6205, 6237, 368, 341, 262, 11506, 27098, 3759, 9050, 11, 48440, 11, 55039, 11, 33122, 11, 11091, 11, 27913, 5563, 262, 7618, 33428, 341, 286, 362, 345, 286, 4...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_number_success_edge_cases() { let parsed: JsonValue = r#"0"#.parse().unwrap(); let n: f64 = parsed.try_into().unwrap(); assert_eq!(n, 0.0); let parsed: JsonValue = r#"0e1"#.parse().unwrap(); let n: f64 = parsed.try_into().unwrap(); assert_eq!(n, 0.0); let parsed: JsonValue = r#"0.0"#.parse().unwrap(); let n: f64 = parsed.try_into().unwrap(); assert_eq!(n, 0.0); let parsed: JsonValue = r#"1e+1"#.parse().unwrap(); let n: f64 = parsed.try_into().unwrap(); assert_eq!(n, 10.0); let parsed: JsonValue = r#"1e-1"#.parse().unwrap(); let n: f64 = parsed.try_into().unwrap(); assert_eq!(n, 0.1); }
rust_cleaned_test_functions.jsonl/88099
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 320 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5500, 18632, 17932, 41427, 368, 341, 262, 1077, 15676, 25, 8308, 1130, 284, 435, 55543, 15, 57676, 13, 6400, 1005, 15454, 543, 262, 1077, 308, 25, 282, 21, 19, 284, 15676, 48779, 45514, 1005, 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_sub_panic() { let a = Int8Array::from(&[Some(-100i8)]); let b = Int8Array::from(&[Some(100i8)]); let _ = sub(&a, &b); }
rust_cleaned_test_functions.jsonl/23354
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 92 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5228, 620, 31270, 368, 341, 286, 1077, 264, 284, 1333, 23, 1857, 486, 1499, 2099, 58, 8373, 4080, 16, 15, 15, 72, 23, 41958, 286, 1077, 293, 284, 1333, 23, 1857, 486, 1499, 2099, 58, 8373, 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
#[test] fn test_cast_range_i64_max() { assert_eq!(i64::MAX.to_i8(), None); assert_eq!(i64::MAX.to_i16(), None); assert_eq!(i64::MAX.to_i32(), None); assert_eq!(i64::MAX.to_i64(), Some(i64::MAX as i64)); assert_eq!(i64::MAX.to_u8(), None); assert_eq!(i64::MAX.to_u16(), None); assert_eq!(i64::MAX.to_u32(), None); assert_eq!(i64::MAX.to_u64(), Some(i64::MAX as u64)); #[cfg(target_pointer_width = "32")] fn check_word_size() { assert_eq!(i64::MAX.to_int(), None); assert_eq!(i64::MAX.to_uint(), None); } #[cfg(target_pointer_width = "64")] fn check_word_size() { assert_eq!(i64::MAX.to_int(), Some(i64::MAX as isize)); assert_eq!(i64::MAX.to_uint(), Some(i64::MAX as usize)); } check_word_size(); }
rust_cleaned_test_functions.jsonl/25360
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 511 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5303, 9698, 5318, 21, 19, 6345, 368, 341, 1789, 286, 2060, 10714, 10297, 72, 21, 19, 486, 10586, 2389, 5318, 23, 1507, 256, 2240, 317, 286, 2060, 10714, 10297, 72, 21, 19, 486, 10586, 2389, 53...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_cpu_online() { for i in 0..TEST.len() { let t = &TEST[i]; let res = read_cpu_range(t.data); assert!((t.valid && res.is_ok()) || (!t.valid && res.is_err())); if let Ok(v) = res { for i in 0..v.len() { assert_eq!(v[i], t.expected[i]); } } } }
rust_cleaned_test_functions.jsonl/105078
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 248 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21795, 51546, 368, 341, 286, 369, 600, 304, 220, 15, 496, 10033, 19406, 368, 341, 310, 1077, 259, 284, 609, 10033, 989, 935, 310, 1077, 592, 284, 1349, 21795, 9698, 1155, 2196, 317, 310, 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...
7
#[test] fn test_dim_array_extended_fixed_length_string() { assert_eq!( linter_ok("DIM A(2) AS STRING * 3"), vec![TopLevelToken::Statement(Statement::Dim( DimNameBuilder::new() .bare_name("A") .dim_type(DimType::Array( vec![ArrayDimension { lbound: None, ubound: Expression::IntegerLiteral(2).at_rc(1, 7) }], Box::new(DimType::FixedLengthString( Expression::IntegerLiteral(3).at_rc(1, 22), 3 )) )) .build_list_rc(1, 5) )) .at_rc(1, 1)] ); }
rust_cleaned_test_functions.jsonl/122475
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 467 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10791, 3858, 61678, 37839, 5118, 3904, 368, 341, 262, 2060, 10714, 33673, 286, 326, 2245, 19817, 445, 75119, 362, 7, 17, 8, 5752, 35255, 353, 220, 18, 4461, 286, 7486, 20703, 5366, 4449, 3323, 4...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_iterator_last() { let v = &[0, 1, 2, 3, 4]; assert_eq!(v.iter().last().unwrap(), &4); assert_eq!(v.slice(0, 1).iter().last().unwrap(), &0); }
rust_cleaned_test_functions.jsonl/1008
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 103 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13491, 12195, 368, 341, 286, 1077, 348, 284, 44590, 15, 11, 220, 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 935, 286, 2060, 10714, 10297, 85, 19471, 1005, 4259, 1005, 15454, 1507, 609, 19, 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_writer_indent() { let txt = include_str!("../tests/documents/test_writer_indent.xml"); let mut reader = Reader::from_str(txt); reader.trim_text(true); let mut writer = Writer::new_with_indent(Cursor::new(Vec::new()), b' ', 4); let mut buf = Vec::new(); loop { match reader.read_event(&mut buf) { Ok(Eof) => break, Ok(e) => assert!(writer.write_event(e).is_ok()), Err(e) => panic!(e), } } let result = writer.into_inner().into_inner(); assert_eq!(result, txt.as_bytes()); }
rust_cleaned_test_functions.jsonl/42080
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 278 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 28908, 69045, 368, 341, 262, 1077, 7932, 284, 2924, 2895, 17223, 1244, 23841, 97090, 12697, 28908, 69045, 9028, 797, 262, 1077, 5206, 6604, 284, 25166, 486, 1499, 2895, 26082, 317, 262, 6604, 16419,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_selected_time_less_than_time_in_storage() { let time_service = TimeServiceFactory::default(); let artifact = time_service.artifact_id(); let mut testkit = TestKitBuilder::validator() .with_validators(1) .with_artifact(artifact.clone()) .with_instance(artifact.into_default_instance(INSTANCE_ID, INSTANCE_NAME)) .with_rust_service(time_service) .with_rust_service(Supervisor) .with_artifact(Supervisor.artifact_id()) .with_instance(Supervisor::simple()) .create(); let validators = testkit.network().validators().to_vec(); let old_keypair = validators[0].service_keypair(); let cfg_change_height = Height(5); let new_cfg = { let validator_keys = vec![testkit.network_mut().add_node().public_keys()]; testkit .consensus_config() .with_validator_keys(validator_keys) }; testkit.create_block_with_transaction( ConfigPropose::new(0, cfg_change_height) .consensus_config(new_cfg) .sign_for_supervisor(old_keypair.0, &old_keypair.1), ); testkit.create_blocks_until(cfg_change_height); let validators = testkit.network().validators().to_vec(); let new_keypair = validators[0].service_keypair(); let snapshot = testkit.snapshot(); let schema = get_schema(&snapshot); assert!(schema.time.get().is_some()); assert!(schema.validators_times.get(&old_keypair.0).is_some()); assert!(schema.validators_times.get(&new_keypair.0).is_none()); assert_eq!( schema.time.get(), schema.validators_times.get(&old_keypair.0) ); if let Some(time_in_storage) = schema.time.get() { let time_tx = time_in_storage - Duration::seconds(10); let tx = new_keypair.report_time(INSTANCE_ID, TxTime::new(time_tx)); let block = testkit.create_block_with_transaction(tx); block[0].status().unwrap(); } let snapshot = testkit.snapshot(); let schema = get_schema(&snapshot); assert!(schema.time.get().is_some()); assert!(schema.validators_times.get(&old_keypair.0).is_some()); assert!(schema.validators_times.get(&new_keypair.0).is_some()); assert_eq!( schema.time.get(), schema.validators_times.get(&old_keypair.0) ); }
rust_cleaned_test_functions.jsonl/21887
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 987 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 23755, 3009, 50747, 51613, 3009, 1243, 23310, 368, 341, 262, 1077, 882, 12267, 284, 4120, 1860, 4153, 486, 2258, 543, 262, 1077, 36639, 284, 882, 12267, 46886, 20754, 842, 543, 262, 1077, 5206, 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...
2
#[test] fn test_boolean_string_comparison() { fold_same("!x == '' + y"); fold_same("!x <= '' + y"); fold("!x !== '' + y", "true"); }
rust_cleaned_test_functions.jsonl/122156
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 73 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 46642, 3904, 90797, 368, 341, 262, 11555, 33574, 85166, 87, 621, 3355, 488, 379, 797, 262, 11555, 33574, 85166, 87, 2651, 3355, 488, 379, 797, 262, 11555, 85166, 87, 4376, 3355, 488, 379, 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
#[test] fn test_buffer_data_shreds() { let num_shreds_per_slot = 2; let (blockstore, genesis_config, _cluster_info, bank, leader_keypair, _socket, _bank_forks) = setup(num_shreds_per_slot); let (bsend, brecv) = channel(); let (ssend, _srecv) = channel(); let mut last_tick_height = 0; let mut standard_broadcast_run = StandardBroadcastRun::new(0); let mut process_ticks = |num_ticks| { let ticks = create_ticks(num_ticks, 0, genesis_config.hash()); last_tick_height += (ticks.len() - 1) as u64; let receive_results = ReceiveResults { entries: ticks, time_elapsed: Duration::new(1, 0), bank: bank.clone(), last_tick_height, }; standard_broadcast_run .process_receive_results( &leader_keypair, &blockstore, &ssend, &bsend, receive_results, ) .unwrap(); }; for i in 0..3 { process_ticks((i + 1) * 100); } let mut shreds = Vec::<Shred>::new(); while let Ok((recv_shreds, _)) = brecv.recv_timeout(Duration::from_secs(1)) { shreds.extend(recv_shreds.deref().clone()); } assert!(shreds.len() < 32, "shreds.len(): {}", shreds.len()); assert!(shreds.iter().all(|shred| shred.is_data())); process_ticks(75); while let Ok((recv_shreds, _)) = brecv.recv_timeout(Duration::from_secs(1)) { shreds.extend(recv_shreds.deref().clone()); } assert!(shreds.len() > 64, "shreds.len(): {}", shreds.len()); let num_coding_shreds = shreds.iter().filter(|shred| shred.is_code()).count(); assert_eq!( num_coding_shreds, 32, "num coding shreds: {}", num_coding_shreds ); }
rust_cleaned_test_functions.jsonl/38304
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1086 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 7776, 1769, 3712, 53369, 368, 341, 286, 1077, 1629, 3712, 53369, 5678, 27563, 284, 220, 17, 280, 286, 1077, 320, 4574, 4314, 11, 59366, 5332, 11, 716, 18855, 3109, 11, 6073, 11, 7653, 3097, 1267...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_call() { let template = compile("{{ call my_macro with nested }}"); let context = context(); let template_registry = other_templates(); let formatter_registry = formatters(); let string = template .render(&context, &template_registry, &formatter_registry) .unwrap(); assert_eq!("10", &string); }
rust_cleaned_test_functions.jsonl/2388
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 180 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13429, 368, 972, 286, 1077, 3811, 284, 19192, 445, 2979, 1618, 847, 58810, 448, 24034, 3869, 2815, 286, 1077, 2266, 284, 2266, 1647, 286, 1077, 3811, 50650, 284, 1008, 49526, 1647, 286, 1077, 2481...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_proj_sidh() { fn aux(a_sk: MyASc, b_sk: MyBSc) { let a_sk = a_sk.0; let b_sk = b_sk.0; let ab = (xpa(), xqa(), xra()); let bb = (xpb(), xqb(), xrb()); let a_steps = 2; // EA/2; let b_steps = 2; // EB; let phi_bb = a_keygen(bb, ab, a(), a24plus(), c24(), a_sk, a_steps); let phi_ab = b_keygen(ab, bb, a(), a24plus(), a24minus(), b_sk, b_steps); let a_shared_secret = a_sharedkey(phi_ab, a_sk, a_steps); let b_shared_secret = b_sharedkey(phi_bb, b_sk, b_steps); assert_eq!(a_shared_secret,b_shared_secret); } QuickCheck::new() .tests(1) .quickcheck(aux as fn(MyASc, MyBSc)); }
rust_cleaned_test_functions.jsonl/11580
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 311 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 49453, 53044, 71, 368, 341, 262, 5168, 10047, 2877, 33811, 25, 3017, 1911, 66, 11, 293, 33811, 25, 3017, 33, 3326, 8, 341, 10217, 264, 33811, 284, 264, 33811, 13, 15, 280, 10217, 293, 33811, 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_simple_operator_gte_plaintext_parse() { let name1 = _random_string(10); let value1 = _random_string(10); let json = format!(r#"{{"~{}":{{"$gte":"{}"}}}}"#, name1, value1); let query = parse_from_json(&json).unwrap(); let expected = Operator::Gte( TagName::PlainTagName(name1.to_vec()), TargetValue::Unencrypted(value1.clone()) ); assert_eq!(query, expected); }
rust_cleaned_test_functions.jsonl/11817
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 227 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 30015, 40594, 1889, 665, 6317, 1641, 427, 21039, 368, 341, 286, 1077, 829, 16, 284, 716, 11463, 3904, 7, 16, 15, 317, 286, 1077, 897, 16, 284, 716, 11463, 3904, 7, 16, 15, 626, 286, 1077, 29...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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() { let input = r#"forward 5 down 5 forward 8 up 3 down 8 forward 2"#; let parsed = parse_input(input); assert_eq!( parsed, vec![ Command { direction: Direction::Forward, length: 5, }, Command { direction: Direction::Down, length: 5, }, Command { direction: Direction::Forward, length: 8, }, Command { direction: Direction::Up, length: 3, }, Command { direction: Direction::Down, length: 8, }, Command { direction: Direction::Forward, length: 2, }, ] ); }
rust_cleaned_test_functions.jsonl/52862
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 647 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 368, 341, 286, 1077, 1946, 284, 435, 55543, 13435, 220, 20, 198, 2923, 220, 20, 198, 13435, 220, 23, 198, 454, 220, 18, 198, 2923, 220, 23, 198, 13435, 220, 17, 57676, 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_thread() { let mut s = IString::from("Hello"); write!(s, " world").unwrap(); let s2 = thread::spawn(move || { let mut s = s; s += " from another thread!"; s }).join().unwrap(); assert_eq!(s2, "Hello world from another thread!"); }
rust_cleaned_test_functions.jsonl/63440
{ "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, 10814, 368, 341, 262, 1077, 5206, 274, 284, 358, 703, 486, 1499, 445, 9707, 797, 262, 3270, 10297, 82, 11, 330, 1879, 1827, 15454, 543, 262, 1077, 274, 17, 284, 4516, 486, 46087, 34081, 1369, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_execute_invalid_private_key() { let matches = CreateNodeVssCommand::args().get_matches_from(vec![ "createnodevss", "--threshold", "2", "--public-key", "03842d51608d08bee79587fb3b54ea68f5279e13fac7d72515a7205e6672858ca2", "--private-key", "x", ]); let response = CreateNodeVssCommand::execute(&matches); assert_eq!( format!("{}", response.err().unwrap()), "InvalidArgs(\"private-key\")" ); }
rust_cleaned_test_functions.jsonl/111722
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 313 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 44329, 31433, 26249, 3097, 368, 341, 286, 1077, 9071, 284, 4230, 1955, 53, 778, 4062, 486, 2116, 1005, 455, 38344, 5673, 25592, 90515, 310, 330, 837, 13518, 534, 85, 778, 756, 310, 14482, 28902, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_pathset_to_json() { let hex: Vec<u8> = hex::decode(TEST_PATH_SET_BUFFER).expect(""); let compact: serde_json::Value = serde_json::from_str(PATH_SET_TEST).expect(""); let pathset = PathSet::new(Some(&hex)).unwrap(); assert_eq!( serde_json::to_string(&pathset).unwrap(), serde_json::to_string(&compact).expect(""), ); }
rust_cleaned_test_functions.jsonl/77249
{ "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, 2638, 746, 2346, 9455, 368, 341, 286, 1077, 12371, 25, 11312, 34837, 23, 29, 284, 12371, 486, 18196, 50320, 7944, 8481, 14394, 568, 17119, 13056, 286, 1077, 16830, 25, 61570, 9455, 486, 1130, 284,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_polymorphic_effectful() { let input = r#" $ #1 \x, y -> ^#2 'handle > x 1 ~ 'number => 'string -> > y 2 : 'number : fun ~ #3 >fun \ @x 'number -> $ ! 1 => 'string ~ ! @a * => 'number, \ @y 'number -> $ ! "a" => 'number ~ ! @b * => 'number "#; let (hirgen, expr) = parse_inner(input); let (ctx, _ty) = crate::synth(100, &expr).unwrap_or_else(|error| print_error(input, error)); assert_eq!( get_types(&hirgen, &ctx), vec![ ( 1, Type::Function { parameter: Box::new(Type::Existential(2)), body: Box::new(Type::Function { parameter: Box::new(Type::Function { parameter: Box::new(Type::Existential(23)), body: Box::new(Type::Number) }), body: Box::new(Type::Effectful { ty: Box::new(Type::Number), effects: EffectExpr::Add(vec![]) }) }) } ), ( 2, Type::Effectful { ty: Box::new(Type::Number), effects: EffectExpr::Effects(vec![ Effect { input: Type::Label { label: "a".into(), item: Box::new(Type::Product(vec![])) }, output: Type::Number, }, Effect { input: Type::Label { label: "b".into(), item: Box::new(Type::Product(vec![])) }, output: Type::Number, } ]), }, ), ] ); }
rust_cleaned_test_functions.jsonl/80438
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1687 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 47323, 1600, 40869, 27125, 1262, 368, 341, 286, 1077, 1946, 284, 435, 2, 698, 310, 400, 671, 16, 1124, 87, 11, 379, 12381, 1060, 6306, 2, 17, 364, 8192, 861, 856, 220, 16, 3968, 198, 1060, 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_replacen_failing() { let mut output = String::new(); let method = StringMethod { method: "replacen", variable: "$FOO", pattern: "[]", selection: Select::All, }; method.handle(&mut output, &VariableExpander); assert_eq!(output, ""); }
rust_cleaned_test_functions.jsonl/85284
{ "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, 1288, 500, 90487, 761, 14277, 368, 341, 286, 1077, 5206, 2550, 284, 923, 486, 931, 543, 286, 1077, 1714, 284, 923, 3523, 341, 310, 1714, 25, 262, 330, 265, 500, 90487, 756, 310, 3890, 25, 220,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_aarch64_flags_compile() -> Result<()> { let (mut input, input_path) = NamedTempFile::new()?.into_parts(); input.write_all("(module)".as_bytes())?; drop(input); let output_path = NamedTempFile::new()?.into_temp_path(); // Set all the aarch64 flags to make sure they work let command = CompileCommand::try_parse_from(vec![ "compile", "--disable-logging", "--cranelift-enable", "has_lse", "-o", output_path.to_str().unwrap(), input_path.to_str().unwrap(), ])?; command.execute()?; Ok(()) }
rust_cleaned_test_functions.jsonl/29438
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 343 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4306, 1113, 21, 19, 14130, 74170, 368, 1464, 5714, 71698, 341, 286, 1077, 320, 6984, 1946, 11, 1946, 2638, 8, 284, 40459, 12151, 1703, 486, 931, 57495, 18122, 33217, 543, 286, 1946, 3836, 5705, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_world_to_grid() { let (gx, gy) = world_to_grid(0.5, -1.0, -1.0, -0.75, -0.75); assert!(gx == 0); assert!(gy == 0); }
rust_cleaned_test_functions.jsonl/12422
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 103 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 31792, 2346, 15604, 368, 341, 286, 1077, 320, 59957, 11, 28620, 8, 284, 1879, 2346, 15604, 7, 15, 13, 20, 11, 481, 16, 13, 15, 11, 481, 16, 13, 15, 11, 481, 15, 13, 22, 20, 11, 481, 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_h_agg() { let a = Series::new("a", &[1, 2, 6]); let b = Series::new("b", &[Some(1), None, None]); let c = Series::new("c", &[Some(4), None, Some(3)]); let df = DataFrame::new(vec![a, b, c]).unwrap(); assert_eq!( Vec::from( df.hmean(NullStrategy::Ignore) .unwrap() .unwrap() .f64() .unwrap() ), &[Some(2.0), Some(2.0), Some(4.5)] ); assert_eq!( Vec::from( df.hsum(NullStrategy::Ignore) .unwrap() .unwrap() .i32() .unwrap() ), &[Some(6), Some(2), Some(9)] ); assert_eq!( Vec::from(df.hmin().unwrap().unwrap().i32().unwrap()), &[Some(1), Some(2), Some(3)] ); assert_eq!( Vec::from(df.hmax().unwrap().unwrap().i32().unwrap()), &[Some(4), Some(2), Some(6)] ); }
rust_cleaned_test_functions.jsonl/18796
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 706 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1523, 83534, 368, 341, 286, 1077, 264, 284, 11131, 486, 931, 445, 64, 497, 44590, 16, 11, 220, 17, 11, 220, 21, 2558, 286, 1077, 293, 284, 11131, 486, 931, 445, 65, 497, 44590, 8373, 7, 16, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_branch1(){ let mut solver = Solver::parse_file("./problems/branch1.pcf", Strategy::General); let r = solver.solver_loop(150); assert_eq!(SolverResultType::Refuted, r.t); }
rust_cleaned_test_functions.jsonl/23370
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 84 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 28031, 16, 3032, 10217, 5206, 28961, 284, 68295, 486, 6400, 2458, 13988, 95340, 14, 17940, 16, 556, 9792, 497, 27745, 486, 15415, 317, 10217, 435, 284, 28961, 514, 7921, 17198, 7, 16, 20, 15, 31...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_pow() { let a = backprop(scalar(5.0)); let y = pow(&a, 2.0); assert_eq!(y[[]], 25.0); let grads = gradients(&[y], &[a.clone()], false); assert_eq!(*grads[0], scalar(10.0)); }
rust_cleaned_test_functions.jsonl/118249
{ "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, 56183, 368, 341, 262, 1077, 264, 284, 1182, 2674, 1141, 59153, 7, 20, 13, 15, 1106, 262, 1077, 379, 284, 6875, 2099, 64, 11, 220, 17, 13, 15, 317, 262, 2060, 10714, 10297, 88, 58, 1294, 1125...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_sizeof() { use super::*; use std::mem::size_of; assert!(size_of::<Option<i8>>() == size_of::<BoundedI8<0, 10>>()); assert!(size_of::<Option<i16>>() == size_of::<BoundedI16<0, 10>>()); assert!(size_of::<Option<i32>>() == size_of::<BoundedI32<0, 10>>()); assert!(size_of::<Option<i64>>() == size_of::<BoundedI64<0, 10>>()); assert!(size_of::<Option<i128>>() == size_of::<BoundedI128<0, 10>>()); assert!(size_of::<Option<isize>>() == size_of::<BoundedIsize<0, 10>>()); assert!(size_of::<Option<u8>>() == size_of::<BoundedU8<0, 10>>()); assert!(size_of::<Option<u16>>() == size_of::<BoundedU16<0, 10>>()); assert!(size_of::<Option<u32>>() == size_of::<BoundedU32<0, 10>>()); assert!(size_of::<Option<u64>>() == size_of::<BoundedI64<0, 10>>()); assert!(size_of::<Option<u128>>() == size_of::<BoundedU128<0, 10>>()); assert!(size_of::<Option<usize>>() == size_of::<BoundedUsize<0, 10>>()); }
rust_cleaned_test_functions.jsonl/83783
{ "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, 2368, 1055, 368, 341, 286, 990, 2256, 56162, 286, 990, 1460, 486, 10536, 486, 2141, 3575, 280, 286, 2060, 10297, 2141, 3575, 27638, 5341, 21897, 23, 61586, 621, 1379, 3575, 27638, 33, 13082, 40, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_last_key_of_region() { let path = Builder::new() .prefix("test_last_key_of_region") .tempdir() .unwrap(); let engine = new_engine(path.path().to_str().unwrap(), None, ALL_CFS, None).unwrap(); let mut region = Region::default(); region.set_id(1); region.mut_peers().push(Peer::default()); // arbitrary padding. let padding = b"_r00000005"; let mut data_keys = vec![]; for i in 1..3 { let mut key = gen_table_prefix(i); key.extend_from_slice(padding); let k = keys::data_key(Key::from_raw(&key).as_encoded()); engine.put_cf(CF_WRITE, &k, &k).unwrap(); data_keys.push(k) } type Case = (Option<i64>, Option<i64>, Option<Vec<u8>>); let mut check_cases = |cases: Vec<Case>| { for (start_id, end_id, want) in cases { region.set_start_key( start_id .map(|id| Key::from_raw(&gen_table_prefix(id)).into_encoded()) .unwrap_or_else(Vec::new), ); region.set_end_key( end_id .map(|id| Key::from_raw(&gen_table_prefix(id)).into_encoded()) .unwrap_or_else(Vec::new), ); assert_eq!(last_key_of_region(&engine, &region).unwrap(), want); } }; check_cases(vec![ (None, None, data_keys.get(1).cloned()), (None, Some(1), None), (Some(1), None, data_keys.get(1).cloned()), (Some(1), Some(2), data_keys.get(0).cloned()), ]); }
rust_cleaned_test_functions.jsonl/75977
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1039 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 12195, 3097, 3575, 20627, 368, 341, 286, 1077, 1815, 284, 20626, 486, 931, 741, 310, 659, 11849, 445, 1944, 12195, 3097, 3575, 20627, 1138, 310, 659, 3888, 3741, 741, 310, 659, 15454, 543, 286, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_parse() { let mut buf = BytesMut::from(&[0b0000_0001u8, 0b0000_0001u8][..]); assert!(is_none(&Parser::parse(&mut buf, false, 1024))); let mut buf = BytesMut::from(&[0b0000_0001u8, 0b0000_0001u8][..]); buf.extend(b"1"); let frame = extract(Parser::parse(&mut buf, false, 1024)); assert!(!frame.finished); assert_eq!(frame.opcode, OpCode::Text); assert_eq!(frame.payload.as_ref(), &b"1"[..]); }
rust_cleaned_test_functions.jsonl/86803
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 232 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 368, 341, 286, 1077, 5206, 6607, 284, 30024, 51440, 486, 1499, 2099, 58, 15, 65, 15, 15, 15, 15, 62, 15, 15, 15, 16, 84, 23, 11, 220, 15, 65, 15, 15, 15, 15, 62, 15, 15, 15, 16,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_no_error_when_zombie() { let (_kernel, current_task) = create_kernel_and_task(); // Send the signal to the task. assert!( sys_kill(&current_task, current_task.get_pid(), UncheckedSignal::from(SIGCHLD)).is_ok() ); let zombie = ZombieTask { id: 0, parent: 3, exit_code: Some(1) }; current_task.zombie_children.lock().push(zombie.clone()); assert_eq!(wait_on_pid(&current_task, TaskSelector::Any, 0), Ok(Some(zombie))); }
rust_cleaned_test_functions.jsonl/71724
{ "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, 6536, 4096, 47636, 6415, 23342, 368, 341, 286, 1077, 5453, 23248, 11, 1482, 12184, 8, 284, 1855, 26876, 8378, 12184, 543, 286, 442, 11000, 279, 8286, 311, 279, 3383, 624, 286, 2060, 33673, 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_look_backward() { let behind = vec![Tile::Empty, Tile::Empty, Tile::Stairs]; let warrior = warrior_with_behind(8, behind.clone()); assert_eq!(warrior.look_toward(Direction::Backward), &behind); }
rust_cleaned_test_functions.jsonl/72736
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 90 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 24271, 70477, 368, 341, 262, 1077, 4815, 284, 7486, 20703, 15628, 486, 3522, 11, 20744, 486, 3522, 11, 20744, 486, 623, 4720, 935, 262, 1077, 37390, 284, 37390, 6615, 43241, 484, 7, 23, 11, 4815...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_static() { let a = S1(5); let a = &a as &dyn Tid; assert_eq!(a.downcast_ref::<S1>().unwrap().0, 5); let a = S1(5); let a: &dyn Tid = (&a as &dyn Any).into(); assert_eq!(a.downcast_any_ref::<S1>().unwrap().0, 5); }
rust_cleaned_test_functions.jsonl/16591
{ "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, 25360, 368, 341, 262, 1077, 264, 284, 328, 16, 7, 20, 317, 262, 1077, 264, 284, 609, 64, 438, 609, 43085, 350, 307, 280, 262, 2060, 10714, 10297, 64, 18148, 3829, 7793, 27638, 50, 16, 10483, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_preflight() { let mut cors = Cors::new() .send_wildcard() .max_age(3600) .allowed_methods(vec![Method::GET, Method::OPTIONS, Method::POST]) .allowed_headers(vec![header::AUTHORIZATION, header::ACCEPT]) .allowed_header(header::CONTENT_TYPE) .finish(test::ok_service()); let req = TestRequest::with_header("Origin", "https://www.example.com") .method(Method::OPTIONS) .header(header::ACCESS_CONTROL_REQUEST_HEADERS, "X-Not-Allowed") .to_srv_request(); assert!(cors.inner.validate_allowed_method(req.head()).is_err()); assert!(cors.inner.validate_allowed_headers(req.head()).is_err()); let resp = test::call_service(&mut cors, req); assert_eq!(resp.status(), StatusCode::BAD_REQUEST); let req = TestRequest::with_header("Origin", "https://www.example.com") .header(header::ACCESS_CONTROL_REQUEST_METHOD, "put") .method(Method::OPTIONS) .to_srv_request(); assert!(cors.inner.validate_allowed_method(req.head()).is_err()); assert!(cors.inner.validate_allowed_headers(req.head()).is_ok()); let req = TestRequest::with_header("Origin", "https://www.example.com") .header(header::ACCESS_CONTROL_REQUEST_METHOD, "POST") .header( header::ACCESS_CONTROL_REQUEST_HEADERS, "AUTHORIZATION,ACCEPT", ) .method(Method::OPTIONS) .to_srv_request(); let resp = test::call_service(&mut cors, req); assert_eq!( &b"*"[..], resp.headers() .get(&header::ACCESS_CONTROL_ALLOW_ORIGIN) .unwrap() .as_bytes() ); assert_eq!( &b"3600"[..], resp.headers() .get(&header::ACCESS_CONTROL_MAX_AGE) .unwrap() .as_bytes() ); let hdr = resp .headers() .get(&header::ACCESS_CONTROL_ALLOW_HEADERS) .unwrap() .to_str() .unwrap(); assert!(hdr.contains("authorization")); assert!(hdr.contains("accept")); assert!(hdr.contains("content-type")); let methods = resp .headers() .get(header::ACCESS_CONTROL_ALLOW_METHODS) .unwrap() .to_str() .unwrap(); assert!(methods.contains("POST")); assert!(methods.contains("GET")); assert!(methods.contains("OPTIONS")); Rc::get_mut(&mut cors.inner).unwrap().preflight = false; let req = TestRequest::with_header("Origin", "https://www.example.com") .header(header::ACCESS_CONTROL_REQUEST_METHOD, "POST") .header( header::ACCESS_CONTROL_REQUEST_HEADERS, "AUTHORIZATION,ACCEPT", ) .method(Method::OPTIONS) .to_srv_request(); let resp = test::call_service(&mut cors, req); assert_eq!(resp.status(), StatusCode::OK); }
rust_cleaned_test_functions.jsonl/911
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1652 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 43331, 4145, 368, 341, 286, 1077, 5206, 43911, 284, 52518, 486, 931, 741, 310, 659, 6681, 1670, 695, 4951, 741, 310, 659, 2810, 32053, 7, 18, 21, 15, 15, 340, 310, 659, 20967, 36084, 25592, 20...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_uint_from_sub_panic() { let _val = Uint256::from(1u32).sub(Uint256::from(2u8)); }
rust_cleaned_test_functions.jsonl/118514
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 55 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15807, 5673, 5228, 620, 31270, 368, 341, 262, 1077, 716, 831, 284, 27883, 17, 20, 21, 486, 1499, 7, 16, 84, 18, 17, 568, 1966, 12317, 396, 17, 20, 21, 486, 1499, 7, 17, 84, 23, 1106, 92 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_tempsize() { info("fun f() { 1+2*3; }", |_, jit_info| { assert_eq!(8, jit_info.tempsize); }); info("fun f() { 2*3+4+5; }", |_, jit_info| { assert_eq!(12, jit_info.tempsize); }); info("fun f() { 1+(2+(3+4)); }", |_, jit_info| { assert_eq!(12, jit_info.tempsize); }) }
rust_cleaned_test_functions.jsonl/73138
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 232 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 28613, 1690, 551, 368, 341, 286, 3546, 445, 11894, 282, 368, 314, 220, 16, 10, 17, 9, 18, 26, 335, 497, 760, 6878, 84573, 3109, 91, 341, 310, 2060, 10714, 10297, 23, 11, 84573, 3109, 43827, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_uint8_xor() -> Result<(), SynthesisError> { let mut rng = XorShiftRng::seed_from_u64(1231275789u64); for _ in 0..1000 { let cs = ConstraintSystem::<Fr>::new_ref(); let a: u8 = rng.gen(); let b: u8 = rng.gen(); let c: u8 = rng.gen(); let mut expected = a ^ b ^ c; let a_bit = UInt8::new_witness(ark_relations::ns!(cs, "a_bit"), || Ok(a)).unwrap(); let b_bit = UInt8::constant(b); let c_bit = UInt8::new_witness(ark_relations::ns!(cs, "c_bit"), || Ok(c)).unwrap(); let r = a_bit.xor(&b_bit).unwrap(); let r = r.xor(&c_bit).unwrap(); assert!(cs.is_satisfied().unwrap()); assert!(r.value == Some(expected)); for b in r.bits.iter() { match b { Boolean::Is(b) => assert!(b.value()? == (expected & 1 == 1)), Boolean::Not(b) => assert!(!b.value()? == (expected & 1 == 1)), Boolean::Constant(b) => assert!(*b == (expected & 1 == 1)), } expected >>= 1; } } Ok(()) }
rust_cleaned_test_functions.jsonl/35829
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 667 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15807, 23, 76462, 368, 1464, 5714, 68843, 23153, 13189, 1454, 29, 341, 286, 1077, 5206, 28422, 284, 1599, 269, 24841, 49, 968, 486, 22602, 5673, 7300, 21, 19, 7, 16, 17, 18, 16, 17, 22, 20, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
8
#[test] fn test_append_block() { let mut rng: StdRng = SeedableRng::from_seed([1u8; 32]); let mut ledger_db = create_db(); // === Create and append the origin block. === // The origin block contains a single output belonging to the `origin_account_key`. let origin_account_key = AccountKey::random(&mut rng); let (origin_block, origin_block_contents) = get_origin_block_and_contents(&origin_account_key); ledger_db .append_block(&origin_block, &origin_block_contents, None) .unwrap(); assert_eq!(1, ledger_db.num_blocks().unwrap()); assert_eq!(origin_block, ledger_db.get_block(0).unwrap()); assert_eq!(1, ledger_db.num_txos().unwrap()); let origin_tx_out = origin_block_contents.outputs.get(0).unwrap().clone(); assert_eq!(origin_tx_out, ledger_db.get_tx_out_by_index(0).unwrap()); assert_eq!( origin_block_contents, ledger_db.get_block_contents(0).unwrap() ); let key_images = ledger_db.get_key_images_by_block(0).unwrap(); assert_eq!(key_images.len(), 0); let block_index = ledger_db.get_block_index_by_tx_out_index(0).unwrap(); assert_eq!(block_index, 0); // === Create and append a non-origin block. === let recipient_account_key = AccountKey::random(&mut rng); let outputs: Vec<TxOut> = (0..4) .map(|_i| { TxOut::new( 1000, &recipient_account_key.default_subaddress(), &RistrettoPrivate::from_random(&mut rng), Default::default(), ) .unwrap() }) .collect(); let key_images: Vec<KeyImage> = (0..5).map(|_i| KeyImage::from(rng.next_u64())).collect(); let block_contents = BlockContents::new(key_images.clone(), outputs); let block = Block::new_with_parent( BLOCK_VERSION, &origin_block, &Default::default(), &block_contents, ); ledger_db .append_block(&block, &block_contents, None) .unwrap(); assert_eq!(2, ledger_db.num_blocks().unwrap()); // The origin block should still be in the ledger: assert_eq!(origin_block, ledger_db.get_block(0).unwrap()); // The new block should be in the ledger: assert_eq!(block, ledger_db.get_block(1).unwrap()); assert_eq!(5, ledger_db.num_txos().unwrap()); // The origin's TxOut should still be in the ledger: assert_eq!(origin_tx_out, ledger_db.get_tx_out_by_index(0).unwrap()); // Each TxOut from the current block should be in the ledger. for (i, tx_out) in block_contents.outputs.iter().enumerate() { assert_eq!( ledger_db.get_tx_out_by_index((i + 1) as u64).unwrap(), *tx_out ); // All tx outs are in the second block. let block_index = ledger_db .get_block_index_by_tx_out_index((i + 1) as u64) .unwrap(); assert_eq!(block_index, 1); } assert!(ledger_db .contains_key_image(key_images.get(0).unwrap()) .unwrap()); let block_one_key_images = ledger_db.get_key_images_by_block(1).unwrap(); assert_eq!(key_images, block_one_key_images); }
rust_cleaned_test_functions.jsonl/89688
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1731 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 26041, 7113, 368, 341, 286, 1077, 5206, 28422, 25, 42517, 49, 968, 284, 35822, 480, 49, 968, 486, 1499, 33809, 2561, 16, 84, 23, 26, 220, 18, 17, 2558, 286, 1077, 5206, 46933, 8685, 284, 1855,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_hz_to_mel() { assert_relative_eq!(hz_to_mel(1278.0), 18.567854754553583); }
rust_cleaned_test_functions.jsonl/104236
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 55 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 95676, 2346, 717, 301, 368, 341, 197, 6948, 29286, 10714, 10297, 37259, 2346, 717, 301, 7, 16, 17, 22, 23, 13, 15, 701, 220, 16, 23, 13, 20, 21, 22, 23, 20, 19, 22, 20, 19, 20, 20, 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
#[test] fn test_uint32_addmany_constants() { let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]); for _ in 0..1000 { let mut cs = TestConstraintSystem::<Bls12>::new(); let a: u32 = rng.gen(); let b: u32 = rng.gen(); let c: u32 = rng.gen(); let a_bit = UInt32::constant(a); let b_bit = UInt32::constant(b); let c_bit = UInt32::constant(c); let mut expected = a.wrapping_add(b).wrapping_add(c); let r = { let mut cs = MultiEq::new(&mut cs); let r = UInt32::addmany(cs.namespace(|| "addition"), &[a_bit, b_bit, c_bit]).unwrap(); r }; assert!(r.value == Some(expected)); for b in r.bits.iter() { match b { &Boolean::Is(_) => panic!(), &Boolean::Not(_) => panic!(), &Boolean::Constant(b) => { assert!(b == (expected & 1 == 1)); } } expected >>= 1; } } }
rust_cleaned_test_functions.jsonl/28527
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 708 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15807, 18, 17, 2891, 34576, 55642, 368, 341, 286, 1077, 5206, 28422, 284, 1599, 269, 24841, 49, 968, 486, 1499, 33809, 2561, 15, 87, 20, 83406, 21, 17, 20, 24, 11, 220, 15, 87, 23, 67, 18, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
#[test] fn test_delete_movement() { let mut input = StringInput::default(); let backspace_movements = [ ( KeyEvent::new(KeyCode::Char('u'), KeyModifiers::CONTROL), Movement::Home, ), ( KeyEvent::new(KeyCode::Backspace, KeyModifiers::ALT), Movement::PrevWord, ), ( KeyEvent::new(KeyCode::Char('w'), KeyModifiers::ALT), Movement::PrevWord, ), ( KeyEvent::new(KeyCode::Char('w'), KeyModifiers::CONTROL), Movement::Left, ), ( KeyEvent::new(KeyCode::Backspace, KeyModifiers::empty()), Movement::Left, ), ]; let delete_movements = [ ( KeyEvent::new(KeyCode::Char('k'), KeyModifiers::CONTROL), Movement::End, ), ( KeyEvent::new(KeyCode::Delete, KeyModifiers::ALT), Movement::NextWord, ), ( KeyEvent::new(KeyCode::Char('d'), KeyModifiers::ALT), Movement::NextWord, ), ( KeyEvent::new(KeyCode::Char('d'), KeyModifiers::CONTROL), Movement::Right, ), ( KeyEvent::new(KeyCode::Delete, KeyModifiers::empty()), Movement::Right, ), ]; assert!(backspace_movements .iter() .copied() .all(|(key, _)| input.get_delete_movement(key).is_none())); assert!(delete_movements .iter() .copied() .all(|(key, _)| input.get_delete_movement(key).is_none())); input.set_value("Hello world".into()); assert!(backspace_movements .iter() .copied() .all(|(key, _)| input.get_delete_movement(key).is_none())); assert!(delete_movements .iter() .copied() .all(|(key, mov)| input.get_delete_movement(key).unwrap() == mov)); input.set_at(11); assert!(backspace_movements .iter() .copied() .all(|(key, mov)| input.get_delete_movement(key).unwrap() == mov)); assert!(delete_movements .iter() .copied() .all(|(key, _)| input.get_delete_movement(key).is_none())); input.set_at(5); assert!(backspace_movements .iter() .copied() .all(|(key, mov)| input.get_delete_movement(key).unwrap() == mov)); assert!(delete_movements .iter() .copied() .all(|(key, mov)| input.get_delete_movement(key).unwrap() == mov)); }
rust_cleaned_test_functions.jsonl/63666
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1622 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11353, 70325, 368, 341, 286, 1077, 5206, 1946, 284, 923, 2505, 486, 2258, 1428, 286, 1077, 1182, 8746, 55798, 3723, 284, 2278, 310, 2399, 394, 48275, 486, 931, 41040, 486, 4768, 492, 84, 4567, 5...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_ffx_plugin_with_a_remote_proxy_and_daemon_proxy_and_command() -> Result<(), Error> { let proxies = Default::default(); let original: ItemFn = parse_quote! { pub async fn echo( daemon: DaemonProxy, remote: RemoteControlProxy, _cmd: EchoCommand) -> anyhow::Result<()> { Ok(()) } }; let plugin: ItemFn = parse_quote! { pub async fn ffx_plugin_impl<D, R, DFut, RFut, E, EFut, F, FFut>( daemon_factory: D, remote_factory: R, _fastboot_factory: F, _is_experiment: E, _cmd: EchoCommand ) -> anyhow::Result<()> where D: FnOnce() -> DFut, DFut: std::future::Future< Output = anyhow::Result<fidl_fuchsia_developer_bridge::DaemonProxy>, >, R: FnOnce() -> RFut, RFut: std::future::Future< Output = anyhow::Result< fidl_fuchsia_developer_remotecontrol::RemoteControlProxy >, >, E: FnOnce(&'static str) -> EFut, EFut: std::future::Future<Output = bool>, F: FnOnce() -> FFut, FFut: std::future::Future< Output = anyhow::Result<fidl_fuchsia_developer_bridge::FastbootProxy>, >, { let daemon_proxy = daemon_factory().await?; let remote_proxy = remote_factory().await?; echo(daemon_proxy, remote_proxy, _cmd).await } }; let fake_daemon_test: ItemFn = parse_quote! { #[cfg(test)] fn setup_fake_daemon<R:'static>(handle_request: R) -> DaemonProxy where R: FnOnce(fidl::endpoints::Request<<DaemonProxy as fidl::endpoints::Proxy>::Service>) + std::marker::Send + Copy { use futures::TryStreamExt; let (proxy, mut stream) = fidl::endpoints::create_proxy_and_stream::<<DaemonProxy as fidl::endpoints::Proxy>::Service>().unwrap(); fuchsia_async::Task::spawn(async move { while let Ok(Some(req)) = stream.try_next().await { handle_request(req); } }) .detach(); proxy } }; let fake_remote_test: ItemFn = parse_quote! { #[cfg(test)] fn setup_fake_remote<R:'static>(handle_request: R) -> RemoteControlProxy where R: FnOnce(fidl::endpoints::Request<<RemoteControlProxy as fidl::endpoints::Proxy>::Service>) + std::marker::Send + Copy { use futures::TryStreamExt; let (proxy, mut stream) = fidl::endpoints::create_proxy_and_stream::<<RemoteControlProxy as fidl::endpoints::Proxy>::Service>().unwrap(); fuchsia_async::Task::spawn(async move { while let Ok(Some(req)) = stream.try_next().await { handle_request(req); } }) .detach(); proxy } }; let result: WrappedFunction = parse2(ffx_plugin(original.clone(), proxies)?)?; assert_eq!(original, result.original); assert_eq!(plugin, result.plugin); assert_eq!(4, result.fake_tests.len()); assert_eq!(fake_daemon_test, result.fake_tests[0]); assert_eq!(fake_remote_test, result.fake_tests[2]); Ok(()) }
rust_cleaned_test_functions.jsonl/85699
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2016 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 58708, 87, 23110, 6615, 4306, 36425, 29712, 8378, 47070, 7291, 29712, 8378, 10811, 368, 1464, 5714, 68843, 4600, 29, 341, 286, 1077, 59365, 284, 7899, 486, 2258, 543, 286, 1077, 4024, 25, 5739, 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_values_greater_than_i64_allowed() { new_ucmd!() .args(&["9223372036854775808", "-gt", "0"]) .succeeds(); }
rust_cleaned_test_functions.jsonl/11000
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 82 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9146, 97994, 51613, 5318, 21, 19, 42155, 368, 341, 262, 501, 68887, 2277, 0, 741, 286, 659, 2116, 2099, 1183, 24, 17, 17, 18, 18, 22, 17, 15, 18, 21, 23, 20, 19, 22, 22, 20, 23, 15, 23, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_xz() { let vec = vec3(0.0, 1.0, 0.0); let rot = Quaternion::from_axis_angle(vec3(1.0, 0.0, 1.0).normalize(), Deg(90.0)); assert_ulps_eq!( vec3(-2.0f32.sqrt() / 2.0, 0.0, 2.0f32.sqrt() / 2.0), rot * vec ); }
rust_cleaned_test_functions.jsonl/38269
{ "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, 3212, 89, 368, 341, 286, 1077, 7486, 284, 7486, 18, 7, 15, 13, 15, 11, 220, 16, 13, 15, 11, 220, 15, 13, 15, 626, 286, 1077, 5749, 284, 24801, 486, 1499, 23567, 21727, 25592, 18, 7, 16, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_scalar_div_rem() { fn check(x: &BigUint, y: &BigUint, z: &BigUint, r: &BigUint) { let (x, y, z, r) = (x.clone(), y.clone(), z.clone(), r.clone()); assert_unsigned_scalar_op!(x / y == z); assert_unsigned_scalar_op!(x % y == r); } for elm in MUL_TRIPLES.iter() { let (a_vec, b_vec, c_vec) = *elm; let a = BigUint::from_slice(a_vec); let b = BigUint::from_slice(b_vec); let c = BigUint::from_slice(c_vec); if !a.is_zero() { check(&c, &a, &b, &Zero::zero()); } if !b.is_zero() { check(&c, &b, &a, &Zero::zero()); } } for elm in DIV_REM_QUADRUPLES.iter() { let (a_vec, b_vec, c_vec, d_vec) = *elm; let a = BigUint::from_slice(a_vec); let b = BigUint::from_slice(b_vec); let c = BigUint::from_slice(c_vec); let d = BigUint::from_slice(d_vec); if !b.is_zero() { check(&a, &b, &c, &d); assert_unsigned_scalar_op!(a / b == c); assert_unsigned_scalar_op!(a % b == d); } } }
rust_cleaned_test_functions.jsonl/114165
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 637 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 41652, 16237, 19194, 368, 341, 262, 5168, 1779, 2075, 25, 609, 15636, 21570, 11, 379, 25, 609, 15636, 21570, 11, 1147, 25, 609, 15636, 21570, 11, 435, 25, 609, 15636, 21570, 8, 341, 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_add_slice() { let mut a = [[-0.5]; 32]; let b = [[0.5]; 32]; dasp_slice::add_in_place(&mut a, &b); assert_eq!([[0.0]; 32], a); }
rust_cleaned_test_functions.jsonl/120381
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 90 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2891, 26488, 368, 341, 262, 1077, 5206, 264, 284, 4318, 12, 15, 13, 20, 5265, 220, 18, 17, 935, 262, 1077, 293, 284, 4318, 15, 13, 20, 5265, 220, 18, 17, 935, 262, 6616, 79, 26488, 486, 71...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_enter_challenge() { let input_out_point = random_out_point(); let type_id = calculate_state_validator_type_id(input_out_point.clone()); let rollup_type_script = { Script::new_builder() .code_hash(Pack::pack(&*STATE_VALIDATOR_CODE_HASH)) .hash_type(ScriptHashType::Data.into()) .args(Pack::pack(&Bytes::from(type_id.to_vec()))) .build() }; let stake_lock_type = build_type_id_script(b"stake_lock_type_id"); let challenge_lock_type = build_type_id_script(b"challenge_lock_type_id"); let challenge_script_type_hash: [u8; 32] = challenge_lock_type.calc_script_hash().unpack(); let finality_blocks = 10; let rollup_config = RollupConfig::new_builder() .challenge_script_type_hash(Pack::pack(&challenge_script_type_hash)) .finality_blocks(Pack::pack(&finality_blocks)) .build(); // setup chain let mut chain = setup_chain(rollup_type_script.clone(), rollup_config.clone()); // create a rollup cell let capacity = 1000_00000000u64; let rollup_cell = build_always_success_cell( capacity, Some(ckb_types::packed::Script::new_unchecked( rollup_type_script.as_bytes(), )), ); // produce a block so we can challenge it { // deposit two account let sender_script = Script::new_builder() .code_hash(Pack::pack(&ALWAYS_SUCCESS_CODE_HASH.clone())) .hash_type(ScriptHashType::Data.into()) .args(Pack::pack(&Bytes::from(b"sender".to_vec()))) .build(); let receiver_script = Script::new_builder() .code_hash(Pack::pack(&ALWAYS_SUCCESS_CODE_HASH.clone())) .hash_type(ScriptHashType::Data.into()) .args(Pack::pack(&Bytes::from(b"receiver".to_vec()))) .build(); let deposit_requests = vec![ DepositRequest::new_builder() .capacity(Pack::pack(&100_00000000u64)) .script(sender_script.clone()) .build(), DepositRequest::new_builder() .capacity(Pack::pack(&50_00000000u64)) .script(receiver_script.clone()) .build(), ]; let produce_block_result = { let mem_pool = chain.mem_pool().lock(); construct_block(&chain, &mem_pool, deposit_requests.clone()).unwrap() }; let rollup_cell = gw_types::packed::CellOutput::new_unchecked(rollup_cell.as_bytes()); apply_block_result( &mut chain, rollup_cell.clone(), produce_block_result, deposit_requests, ); let db = chain.store().begin_transaction(); let tip_block = db.get_tip_block().unwrap(); let tip_block_number = gw_types::prelude::Unpack::unpack(&tip_block.raw().number()); let state_db = StateDBTransaction::from_checkpoint( &db, CheckPoint::new(tip_block_number, SubState::Block), StateDBMode::ReadOnly, ) .unwrap(); let tree = state_db.account_state_tree().unwrap(); let sender_id = tree .get_account_id_by_script_hash(&sender_script.hash().into()) .unwrap() .unwrap(); let receiver_id = tree .get_account_id_by_script_hash(&receiver_script.hash().into()) .unwrap() .unwrap(); let receiver_script_hash = tree.get_script_hash(receiver_id).expect("get script hash"); let receiver_address = Bytes::copy_from_slice(to_short_address(&receiver_script_hash)); let produce_block_result = { let args = SUDTArgs::new_builder() .set(SUDTArgsUnion::SUDTTransfer( SUDTTransfer::new_builder() .amount(Pack::pack(&50_00000000u128)) .to(Pack::pack(&receiver_address)) .build(), )) .build() .as_bytes(); let tx = L2Transaction::new_builder() .raw( RawL2Transaction::new_builder() .from_id(Pack::pack(&sender_id)) .to_id(Pack::pack(&CKB_SUDT_ACCOUNT_ID)) .nonce(Pack::pack(&0u32)) .args(Pack::pack(&args)) .build(), ) .build(); let mut mem_pool = chain.mem_pool().lock(); mem_pool.push_transaction(tx).unwrap(); construct_block(&chain, &mem_pool, Vec::default()).unwrap() }; apply_block_result(&mut chain, rollup_cell, produce_block_result, vec![]); } // deploy scripts let param = CellContextParam { stake_lock_type: stake_lock_type.clone(), ..Default::default() }; let mut ctx = CellContext::new(&rollup_config, param); let challenged_block = chain.local_state().tip().clone(); let challenge_capacity = 10000_00000000u64; let challenge_cell = { let lock_args = ChallengeLockArgs::new_builder() .target( ChallengeTarget::new_builder() .target_index(Pack::pack(&0u32)) .target_type(ChallengeTargetType::TxExecution.into()) .block_hash(Pack::pack(&challenged_block.hash())) .build(), ) .build(); build_rollup_locked_cell( &rollup_type_script.hash(), &challenge_script_type_hash, challenge_capacity, lock_args.as_bytes(), ) }; let global_state = chain.local_state().last_global_state(); let initial_rollup_cell_data = global_state.as_bytes(); // verify enter challenge let witness = { let block_proof: Bytes = { let db = chain.store().begin_transaction(); let proof = db .block_smt() .unwrap() .merkle_proof(vec![challenged_block.smt_key().into()]) .unwrap(); proof .compile(vec![( challenged_block.smt_key().into(), challenged_block.hash().into(), )]) .unwrap() .0 .into() }; let witness = ChallengeWitness::new_builder() .raw_l2block(challenged_block.raw()) .block_proof(Pack::pack(&block_proof)) .build(); let rollup_action = RollupAction::new_builder() .set(RollupActionUnion::RollupEnterChallenge( RollupEnterChallenge::new_builder().witness(witness).build(), )) .build(); ckb_types::packed::WitnessArgs::new_builder() .output_type(CKBPack::pack(&Some(rollup_action.as_bytes()))) .build() }; let rollup_cell_data = global_state .clone() .as_builder() .status(Status::Halting.into()) .build() .as_bytes(); let tx = build_simple_tx_with_out_point( &mut ctx.inner, (rollup_cell.clone(), initial_rollup_cell_data), input_out_point, (rollup_cell, rollup_cell_data), ) .as_advanced_builder() .output(challenge_cell) .output_data(CKBPack::pack(&Bytes::default())) .cell_dep(ctx.stake_lock_dep.clone()) .cell_dep(ctx.always_success_dep.clone()) .cell_dep(ctx.state_validator_dep.clone()) .cell_dep(ctx.rollup_config_dep.clone()) .witness(CKBPack::pack(&witness.as_bytes())) .build(); ctx.verify_tx(tx).expect("return success"); }
rust_cleaned_test_functions.jsonl/124278
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 3846 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 37480, 87406, 368, 341, 262, 1077, 1946, 6068, 6085, 284, 4194, 6068, 6085, 543, 262, 1077, 943, 842, 284, 11047, 4387, 64959, 1819, 842, 5384, 6068, 6085, 15997, 1423, 262, 1077, 6502, 454, 1819,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_calculate_cell_widths_when_sum_of_cell_widths_is_greater_than_table_width() { let mut component = TableComponent::new(KeyConfig::default()); component.headers = vec!["1", "2", "3"].iter().map(|h| h.to_string()).collect(); component.rows = vec![ vec!["aaaaa", "bbbbb", "ccccc"] .iter() .map(|h| h.to_string()) .collect(), vec!["d", "e", "f"].iter().map(|h| h.to_string()).collect(), ]; let (selected_column_index, headers, rows, constraints) = component.calculate_cell_widths(10); assert_eq!(selected_column_index, 1); assert_eq!(headers, vec!["", "1", "2"]); assert_eq!(rows, vec![vec!["1", "aaaaa", "bbbbb"], vec!["2", "d", "e"]]); assert_eq!( constraints, vec![ Constraint::Length(1), Constraint::Length(5), Constraint::Min(10), ] ); }
rust_cleaned_test_functions.jsonl/120825
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 546 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 24005, 11207, 16648, 7927, 82, 47636, 10160, 3575, 16648, 7927, 82, 6892, 97994, 51613, 5237, 7927, 368, 341, 286, 1077, 5206, 3692, 284, 6633, 2189, 486, 931, 21358, 2648, 486, 2258, 1423, 286, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_chain_fork_by_hash() { let (chain_controller, shared, parent) = start_chain(None); let final_number = 20; let mut mock_store = MockStore::new(&parent, shared.store()); let mut chain1 = MockChain::new(parent.clone(), shared.consensus()); let mut chain2 = MockChain::new(parent.clone(), shared.consensus()); let mut chain3 = MockChain::new(parent.clone(), shared.consensus()); for _ in 0..final_number { chain1.gen_empty_block_with_difficulty(100u64, &mut mock_store); } for _ in 0..(final_number * 2) { chain2.gen_empty_block_with_difficulty(50u64, &mut mock_store); } for _ in 0..(final_number * 5) { chain3.gen_empty_block_with_difficulty(20u64, &mut mock_store); } for chain in vec![chain1.clone(), chain2.clone(), chain3.clone()] { for block in chain.blocks() { chain_controller .process_block(Arc::new(block.clone()), false) .expect("process block ok"); } } assert_eq!(chain1.total_difficulty(), chain2.total_difficulty()); assert_eq!(chain1.total_difficulty(), chain3.total_difficulty()); let hash1 = chain1.tip_header().hash(); let hash2 = chain2.tip_header().hash(); let hash3 = chain3.tip_header().hash(); let tips = vec![hash1.clone(), hash2.clone(), hash3.clone()]; let v = tips.iter().min().unwrap(); let best = match v { hash if hash == hash1 => chain1, hash if hash == hash2 => chain2, _ => chain3, }; assert_eq!( shared.store().get_block_hash(8), best.blocks().get(7).map(|b| b.header().hash().to_owned()) ); assert_eq!( shared.store().get_block_hash(19), best.blocks().get(18).map(|b| b.header().hash().to_owned()) ); }
rust_cleaned_test_functions.jsonl/84797
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 790 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 30583, 761, 669, 3710, 8950, 368, 341, 262, 1077, 320, 8819, 21600, 11, 6094, 11, 2681, 8, 284, 1191, 30583, 26717, 317, 262, 1077, 1590, 5500, 284, 220, 17, 15, 401, 262, 1077, 5206, 7860, 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...
9
#[test] fn test_dec_bytes_fail() { let invalid_bytes = vec![ vec![1, 2, 3, 4], vec![0, 0, 0, 0, 0, 0, 0, 247], vec![0, 0, 0, 0, 0, 0, 0, 0, 246], vec![0, 0, 0, 0, 0, 0, 0, 1, 247], vec![1, 2, 3, 4, 5, 6, 7, 8, 0], vec![1, 2, 3, 4, 5, 6, 7, 8, 255, 1], vec![1, 2, 3, 4, 5, 6, 7, 8, 255, 1, 2, 3, 4, 5, 6, 7, 8], vec![1, 2, 3, 4, 5, 6, 7, 8, 255, 1, 2, 3, 4, 5, 6, 7, 8, 255], vec![1, 2, 3, 4, 5, 6, 7, 8, 255, 1, 2, 3, 4, 5, 6, 7, 8, 0], ]; for x in invalid_bytes { assert!(x.as_slice().decode_bytes(false).is_err()); } }
rust_cleaned_test_functions.jsonl/55210
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 446 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13783, 12524, 22121, 368, 341, 286, 1077, 8318, 12524, 284, 7486, 90515, 310, 7486, 20703, 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 1259, 310, 7486, 20703, 15, 11, 220, 15, 11, 220, 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...
2
#[test] fn test_manager_serialize_deserialize_events() { // This test makes sure the events field in ChannelManager survives de/serialization let chanmon_cfgs = create_chanmon_cfgs(2); let node_cfgs = create_node_cfgs(2, &chanmon_cfgs); let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]); let fee_estimator: test_utils::TestFeeEstimator; let persister: test_utils::TestPersister; let logger: test_utils::TestLogger; let new_chain_monitor: test_utils::TestChainMonitor; let nodes_0_deserialized: ChannelManager<EnforcingSigner, &test_utils::TestChainMonitor, &test_utils::TestBroadcaster, &test_utils::TestKeysInterface, &test_utils::TestFeeEstimator, &test_utils::TestLogger>; let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs); let channel_value = 100000; let push_msat = 10001; let a_flags = InitFeatures::known(); let b_flags = InitFeatures::known(); let node_a = nodes.remove(0); let node_b = nodes.remove(0); node_a.node.create_channel(node_b.node.get_our_node_id(), channel_value, push_msat, 42, None).unwrap(); node_b.node.handle_open_channel(&node_a.node.get_our_node_id(), a_flags, &get_event_msg!(node_a, MessageSendEvent::SendOpenChannel, node_b.node.get_our_node_id())); node_a.node.handle_accept_channel(&node_b.node.get_our_node_id(), b_flags, &get_event_msg!(node_b, MessageSendEvent::SendAcceptChannel, node_a.node.get_our_node_id())); let (temporary_channel_id, tx, funding_output) = create_funding_transaction(&node_a, channel_value, 42); node_a.node.funding_transaction_generated(&temporary_channel_id, tx.clone()).unwrap(); check_added_monitors!(node_a, 0); node_b.node.handle_funding_created(&node_a.node.get_our_node_id(), &get_event_msg!(node_a, MessageSendEvent::SendFundingCreated, node_b.node.get_our_node_id())); { let mut added_monitors = node_b.chain_monitor.added_monitors.lock().unwrap(); assert_eq!(added_monitors.len(), 1); assert_eq!(added_monitors[0].0, funding_output); added_monitors.clear(); } node_a.node.handle_funding_signed(&node_b.node.get_our_node_id(), &get_event_msg!(node_b, MessageSendEvent::SendFundingSigned, node_a.node.get_our_node_id())); { let mut added_monitors = node_a.chain_monitor.added_monitors.lock().unwrap(); assert_eq!(added_monitors.len(), 1); assert_eq!(added_monitors[0].0, funding_output); added_monitors.clear(); } nodes.push(node_a); nodes.push(node_b); // Start the de/seriailization process mid-channel creation to check that the channel manager will hold onto events that are serialized let nodes_0_serialized = nodes[0].node.encode(); let mut chan_0_monitor_serialized = test_utils::TestVecWriter(Vec::new()); nodes[0].chain_monitor.chain_monitor.monitors.read().unwrap().iter().next().unwrap().1.write(&mut chan_0_monitor_serialized).unwrap(); fee_estimator = test_utils::TestFeeEstimator { sat_per_kw: Mutex::new(253) }; logger = test_utils::TestLogger::new(); persister = test_utils::TestPersister::new(); let keys_manager = &chanmon_cfgs[0].keys_manager; new_chain_monitor = test_utils::TestChainMonitor::new(Some(nodes[0].chain_source), nodes[0].tx_broadcaster.clone(), &logger, &fee_estimator, &persister, keys_manager); nodes[0].chain_monitor = &new_chain_monitor; let mut chan_0_monitor_read = &chan_0_monitor_serialized.0[..]; let (_, mut chan_0_monitor) = <(BlockHash, ChannelMonitor<EnforcingSigner>)>::read( &mut chan_0_monitor_read, keys_manager).unwrap(); assert!(chan_0_monitor_read.is_empty()); let mut nodes_0_read = &nodes_0_serialized[..]; let config = UserConfig::default(); let (_, nodes_0_deserialized_tmp) = { let mut channel_monitors = HashMap::new(); channel_monitors.insert(chan_0_monitor.get_funding_txo().0, &mut chan_0_monitor); <(BlockHash, ChannelManager<EnforcingSigner, &test_utils::TestChainMonitor, &test_utils::TestBroadcaster, &test_utils::TestKeysInterface, &test_utils::TestFeeEstimator, &test_utils::TestLogger>)>::read(&mut nodes_0_read, ChannelManagerReadArgs { default_config: config, keys_manager, fee_estimator: &fee_estimator, chain_monitor: nodes[0].chain_monitor, tx_broadcaster: nodes[0].tx_broadcaster.clone(), logger: &logger, channel_monitors, }).unwrap() }; nodes_0_deserialized = nodes_0_deserialized_tmp; assert!(nodes_0_read.is_empty()); nodes[1].node.peer_disconnected(&nodes[0].node.get_our_node_id(), false); assert!(nodes[0].chain_monitor.watch_channel(chan_0_monitor.get_funding_txo().0, chan_0_monitor).is_ok()); nodes[0].node = &nodes_0_deserialized; let events_4 = nodes[0].node.get_and_clear_pending_events(); assert_eq!(events_4.len(), 0); assert_eq!(nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap().len(), 1); assert_eq!(nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap()[0].txid(), funding_output.txid); // Make sure the channel is functioning as though the de/serialization never happened assert_eq!(nodes[0].node.list_channels().len(), 1); check_added_monitors!(nodes[0], 1); nodes[0].node.peer_connected(&nodes[1].node.get_our_node_id(), &msgs::Init { features: InitFeatures::empty() }); let reestablish_1 = get_chan_reestablish_msgs!(nodes[0], nodes[1]); nodes[1].node.peer_connected(&nodes[0].node.get_our_node_id(), &msgs::Init { features: InitFeatures::empty() }); let reestablish_2 = get_chan_reestablish_msgs!(nodes[1], nodes[0]); nodes[1].node.handle_channel_reestablish(&nodes[0].node.get_our_node_id(), &reestablish_1[0]); assert!(nodes[1].node.get_and_clear_pending_msg_events().is_empty()); nodes[0].node.handle_channel_reestablish(&nodes[1].node.get_our_node_id(), &reestablish_2[0]); assert!(nodes[0].node.get_and_clear_pending_msg_events().is_empty()); let (funding_locked, _) = create_chan_between_nodes_with_value_confirm(&nodes[0], &nodes[1], &tx); let (announcement, as_update, bs_update) = create_chan_between_nodes_with_value_b(&nodes[0], &nodes[1], &funding_locked); for node in nodes.iter() { assert!(node.net_graph_msg_handler.handle_channel_announcement(&announcement).unwrap()); node.net_graph_msg_handler.handle_channel_update(&as_update).unwrap(); node.net_graph_msg_handler.handle_channel_update(&bs_update).unwrap(); } send_payment(&nodes[0], &[&nodes[1]], 1000000); }
rust_cleaned_test_functions.jsonl/16896
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2378 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 12144, 88686, 15768, 9050, 19691, 368, 341, 197, 322, 1096, 1273, 3643, 2704, 279, 4357, 2070, 304, 13434, 2043, 82317, 409, 14, 74835, 198, 10217, 26023, 1645, 18343, 82, 284, 1855, 45552, 1645, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_sig_g1_basic() { for vec in get_dflt_vecs("sig_g1_basic").unwrap() { test_sig_basic::<G1>(vec.unwrap(), 48).unwrap(); } }
rust_cleaned_test_functions.jsonl/48362
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 86 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 29252, 1889, 16, 34729, 368, 341, 262, 369, 7486, 304, 633, 814, 79209, 13251, 82, 445, 21339, 1889, 16, 34729, 1827, 15454, 368, 341, 286, 1273, 29252, 34729, 27638, 38, 16, 2235, 4083, 55395, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_handle_prepare_reply_err() { let inst = inst!((1, 2), (0, _), [(x = "1")], [(1, 1)]); let cases: Vec<(ReplicateReply, RpcHandlerError)> = vec![ ( frepl!((None, None)), ProtocolError::LackOf("instance_id".into()).into(), ), ( frepl!(((2, 3), None)), ProtocolError::LackOf("instance_id".into()).into(), ), ( frepl!(((2, 3), (1, 2)), None), ProtocolError::LackOf("phase".into()).into(), ), ( ReplicateReply { last_ballot: blt!((0, 1)), instance_id: iid!((1, 2)), phase: Some( CommitReply { ..Default::default() } .into(), ), ..Default::default() }, ProtocolError::LackOf("phase::Prepare".into()).into(), ), ( frepl!(((0, 1), (1, 2)), (None)), ProtocolError::LackOf("phase::Prepare.deps".into()).into(), ), ( frepl!(((0, 1), (1, 2)), ([(1, 2), (2, 3)], vec![true])), ProtocolError::Incomplete("phase::Prepare.deps_committed".into(), 2, 1).into(), ), ]; for (repl, want) in cases.iter() { let mut st = ReplicationStatus::new(3, inst.clone()); let r = handle_prepare_reply(&mut st, 3, repl.clone()); assert_eq!(r.err().unwrap(), *want, "Prepare-reply: {:?}", repl); } }
rust_cleaned_test_functions.jsonl/78121
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 866 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10630, 47460, 15323, 9266, 368, 341, 262, 1077, 1761, 284, 1761, 0, 1188, 16, 11, 220, 17, 701, 320, 15, 11, 716, 701, 17826, 87, 284, 330, 16, 899, 1125, 17826, 16, 11, 220, 16, 7252, 626, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_cast_noop() { // check if we can cast categorical twice without panic let ca = Utf8Chunked::new_from_slice("foo", &["bar", "ham"]); let out = ca.cast::<CategoricalType>().unwrap(); let out = out.cast::<CategoricalType>().unwrap(); assert_eq!(out.dtype(), &DataType::Categorical) }
rust_cleaned_test_functions.jsonl/59836
{ "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, 5303, 6536, 453, 368, 341, 286, 442, 1779, 421, 582, 646, 6311, 69536, 10917, 2041, 21975, 198, 286, 1077, 2162, 284, 43432, 23, 28304, 291, 486, 931, 5673, 26488, 445, 7975, 497, 609, 1183, 225...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_included_packlist_parses() { let res: PackList = serde_yaml::from_str(DEFAULT_PACKLIST).expect("Default packlist doesn't deserialize"); assert_eq!(res.0.len(), 4); }
rust_cleaned_test_functions.jsonl/42878
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 106 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1243, 10181, 32995, 1607, 77113, 288, 368, 341, 286, 1077, 592, 25, 13795, 852, 4035, 310, 61570, 64380, 486, 1499, 2895, 43175, 23987, 22852, 568, 17119, 445, 3675, 3769, 1607, 3171, 944, 35240, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_list_matches() { let p = polar(); qeval(&p, "[] matches []"); qnull(&p, "[1] matches []"); qnull(&p, "[] matches [1]"); qnull(&p, "[1, 2] matches [1, 2, 3]"); qnull(&p, "[2, 1] matches [1, 2]"); qeval(&p, "[1, 2, 3] matches [1, 2, 3]"); qnull(&p, "[1, 2, 3] matches [1, 2]"); qnull(&p, "[x] matches []"); qnull(&p, "[] matches [x]"); qnull(&p, "[1, 2, x] matches [1, 2]"); qnull(&p, "[1, x] matches [1, 2, 3]"); qnull(&p, "[2, x] matches [1, 2]"); qvar(&p, "[1, 2, x] matches [1, 2, 3]", "x", values![3]); qnull(&p, "[1, 2, 3] matches [1, x]"); qvar(&p, "[] matches [*ys]", "ys", vec![value!([])]); qvar(&p, "[*xs] matches []", "xs", vec![value!([])]); qvar(&p, "[*xs] matches [1]", "xs", vec![value!([1])]); qvar(&p, "[1] matches [*ys]", "ys", vec![value!([1])]); qeval(&p, "[xs] matches [*ys]"); qeval(&p, "[*xs] matches [ys]"); qeval(&p, "[*xs] matches [*ys]"); qvar(&p, "[1,2,3] matches [1,2,*xs]", "xs", vec![value!([3])]); qvar( &p, "[1,2,*xs] matches [1,2,3,*ys]", "xs", vec![value!([3, Value::RestVariable(Symbol::new("ys"))])], ); }
rust_cleaned_test_functions.jsonl/68163
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 618 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2019, 38344, 368, 341, 262, 1077, 281, 284, 24660, 543, 262, 2804, 14170, 2099, 79, 11, 330, 1294, 9071, 3056, 797, 262, 2804, 2921, 2099, 79, 11, 10545, 16, 60, 9071, 3056, 797, 262, 2804, 29...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_log_register_none() { let l = Log::<Operation>::new(1024); l.next.store(MAX_REPLICAS, Ordering::Relaxed); assert!(l.register().is_none()); assert_eq!(l.next.load(Ordering::Relaxed), MAX_REPLICAS); }
rust_cleaned_test_functions.jsonl/101048
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 125 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5224, 14000, 31488, 368, 341, 286, 1077, 326, 284, 2835, 27638, 8432, 6831, 931, 7, 16, 15, 17, 19, 317, 286, 326, 4529, 16114, 55212, 2192, 36435, 1911, 11, 68621, 486, 6740, 51451, 317, 286, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_fq2_subtraction() { use super::fq::FqRepr; use ff::PrimeField; let mut a = Fq2 { c0: Fq::from_repr(FqRepr([ 0x00, 0xf8, 0xd2, 0x95, 0xb2, 0xde, 0xd9, 0xdc, 0xcc, 0xc6, 0x49, 0xc4, 0xb9, 0x53, 0x2b, 0xf3, 0xb9, 0x66, 0xce, 0x3b, 0xc2, 0x10, 0x8b, 0x13, 0x8b, 0x1a, 0x52, 0xe0, 0xa9, 0x0f, 0x59, 0xed, 0x11, 0xe5, 0x9e, 0xa2, 0x21, 0xa3, 0xb6, 0xd2, 0x2d, 0x00, 0x78, 0x03, 0x69, 0x23, 0xff, 0xc7, ])) .unwrap(), c1: Fq::from_repr(FqRepr([ 0x01, 0x2d, 0x11, 0x37, 0xb8, 0xa6, 0xa8, 0x37, 0x4e, 0x46, 0x4d, 0xea, 0x5b, 0xcf, 0xd4, 0x1e, 0xb3, 0xf8, 0xaf, 0xc0, 0xee, 0x24, 0x8c, 0xad, 0xbe, 0x20, 0x34, 0x11, 0xc6, 0x6f, 0xb3, 0xa5, 0x94, 0x6a, 0xe5, 0x2d, 0x68, 0x4f, 0xa7, 0xed, 0x97, 0x7d, 0xf6, 0xef, 0xcd, 0xae, 0xe0, 0xdb, ])) .unwrap(), }; a.sub_assign(&Fq2 { c0: Fq::from_repr(FqRepr([ 0x13, 0xce, 0x43, 0x3f, 0xa2, 0x60, 0x27, 0xf5, 0x98, 0x6a, 0x4a, 0x62, 0xfa, 0x82, 0xa4, 0x9d, 0x3b, 0x88, 0x89, 0x9a, 0x42, 0xa6, 0x31, 0x8f, 0x4b, 0xf0, 0xb9, 0x9a, 0x9f, 0x0d, 0xca, 0x12, 0xb9, 0x3a, 0xdf, 0xc9, 0x11, 0x9e, 0x33, 0xe8, 0x61, 0x9a, 0x02, 0xd7, 0x8d, 0xc7, 0x0e, 0xf2, ])) .unwrap(), c1: Fq::from_repr(FqRepr([ 0x11, 0xd6, 0xe2, 0x0e, 0x98, 0x6c, 0x20, 0x85, 0x4c, 0x8c, 0x18, 0x00, 0xeb, 0x10, 0x45, 0x66, 0x22, 0x36, 0xf5, 0x52, 0x46, 0xd0, 0xd4, 0x4d, 0x40, 0x2a, 0xef, 0x1f, 0xb7, 0x97, 0xe3, 0x2f, 0xa1, 0x37, 0x9b, 0x6f, 0xac, 0xf6, 0xe5, 0x96, 0x66, 0x32, 0x3b, 0xf8, 0x0b, 0x58, 0xb9, 0xb9, ])) .unwrap(), }); assert_eq!( a, Fq2 { c0: Fq::from_repr(FqRepr([ 0x07, 0x2b, 0xa1, 0x40, 0x49, 0xfe, 0x98, 0x81, 0x7f, 0x77, 0xa7, 0x18, 0x02, 0x1c, 0x34, 0x2d, 0xe2, 0x55, 0x90, 0x26, 0x72, 0xef, 0x6c, 0x43, 0xa6, 0x5a, 0x6b, 0xe7, 0x00, 0xb2, 0x85, 0xfe, 0x77, 0x56, 0xbe, 0xd7, 0xc1, 0x59, 0x82, 0xe9, 0x85, 0x65, 0x75, 0x2b, 0xdb, 0x5c, 0x9b, 0x80, ])) .unwrap(), c1: Fq::from_repr(FqRepr([ 0x09, 0x57, 0x41, 0x13, 0x59, 0xba, 0x6e, 0x4c, 0x4c, 0xd5, 0xdd, 0x9f, 0xb4, 0x0b, 0x3b, 0x8f, 0xf6, 0x39, 0x05, 0xf3, 0x9a, 0xd8, 0xcb, 0x1f, 0xe5, 0x26, 0x17, 0x93, 0x05, 0x88, 0xc6, 0x9a, 0x11, 0xdf, 0x49, 0xbc, 0x6c, 0xac, 0xc2, 0x56, 0xeb, 0x4a, 0xba, 0xf7, 0xc2, 0x55, 0xd1, 0xcd, ])) .unwrap(), } ); }
rust_cleaned_test_functions.jsonl/45345
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1972 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 761, 80, 17, 5228, 26425, 368, 341, 262, 990, 2256, 486, 63919, 486, 37, 80, 693, 649, 280, 262, 990, 25539, 486, 32306, 1877, 401, 262, 1077, 5206, 264, 284, 434, 80, 17, 341, 286, 272, 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_chunks_exact_last() { let v: &[i32] = &[0, 1, 2, 3, 4, 5]; let c = v.chunks_exact(2); assert_eq!(c.last().unwrap(), &[4, 5]); let v2: &[i32] = &[0, 1, 2, 3, 4]; let c2 = v2.chunks_exact(2); assert_eq!(c2.last().unwrap(), &[2, 3]); }
rust_cleaned_test_functions.jsonl/9633
{ "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, 65470, 71084, 12195, 368, 341, 262, 1077, 348, 25, 44590, 72, 18, 17, 60, 284, 44590, 15, 11, 220, 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20, 935, 262, 1077, 272, 284, 348, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_merge_with_hashmap() { let mut instant_effects1 = Vec::new(); let dir = Some(Dir::East); let effect_kill: Effect = effect::Kill { dir }.into(); instant_effects1.push((ObjId(0), vec![effect_kill.clone(), Effect::Stun])); let mut context1 = ExecuteContext { instant_effects: instant_effects1, ..Default::default() }; let effect_dodge = effect::Dodge { dir }; let mut instant_effects2 = Vec::new(); instant_effects2.push((ObjId(0), vec![Effect::Vanish, effect_dodge.clone().into()])); let context2 = ExecuteContext { instant_effects: instant_effects2, ..Default::default() }; let mut instant_effects_expected = Vec::new(); instant_effects_expected.push(( ObjId(0), vec![ effect_kill, Effect::Stun, Effect::Vanish, effect_dodge.into(), ], )); let context_expected = ExecuteContext { instant_effects: instant_effects_expected, ..Default::default() }; context1.merge_with(context2); assert_eq!(context_expected, context1); }
rust_cleaned_test_functions.jsonl/81556
{ "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, 20888, 6615, 8950, 2186, 368, 341, 286, 1077, 5206, 9690, 83171, 16, 284, 11312, 486, 931, 543, 286, 1077, 5419, 284, 4329, 5432, 404, 486, 36340, 317, 286, 1077, 2456, 73327, 25, 13449, 284, 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_node() { let graph = get_basic_graph(None); let node = graph.get_node("n1"); assert!(node.is_some()); assert_eq!(node.unwrap().name, "n1"); let node = graph.get_node("n4"); assert!(node.is_none()); }
rust_cleaned_test_functions.jsonl/100470
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 141 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 5084, 368, 341, 286, 1077, 4771, 284, 633, 34729, 14738, 26717, 626, 286, 1077, 2436, 284, 4771, 670, 5084, 445, 77, 16, 797, 286, 2060, 10297, 3509, 2079, 61855, 1423, 286, 2060, 10714, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_withdraw_stake_before_warmup() { let stake_pubkey = analog_sdk::pubkey::new_rand(); let total_lamports = 100; let stake_lamports = 42; let stake_account = AccountSharedData::new_ref_data_with_space( total_lamports, &StakeState::Initialized(Meta::auto(&stake_pubkey)), std::mem::size_of::<StakeState>(), &id(), ) .expect("stake_account"); let clock = Clock::default(); let mut future = Clock::default(); future.epoch += 16; let to = analog_sdk::pubkey::new_rand(); let to_account = AccountSharedData::new_ref(1, 0, &system_program::id()); let to_keyed_account = KeyedAccount::new(&to, false, &to_account); let stake_keyed_account = KeyedAccount::new(&stake_pubkey, true, &stake_account); let vote_pubkey = analog_sdk::pubkey::new_rand(); let vote_account = RefCell::new(vote_state::create_account( &vote_pubkey, &analog_sdk::pubkey::new_rand(), 0, 100, )); let vote_keyed_account = KeyedAccount::new(&vote_pubkey, false, &vote_account); vote_keyed_account .set_state(&VoteStateVersions::new_current(VoteState::default())) .unwrap(); let signers = vec![stake_pubkey].into_iter().collect(); assert_eq!( stake_keyed_account.delegate( &vote_keyed_account, &future, &StakeHistory::default(), &Config::default(), &signers, true, ), Ok(()) ); let stake_history = create_stake_history_from_delegations( None, 0..future.epoch, &[stake_from(&stake_keyed_account.account.borrow()) .unwrap() .delegation], ); // Try to withdraw stake assert_eq!( stake_keyed_account.withdraw( total_lamports - stake_lamports + 1, &to_keyed_account, &clock, &stake_history, &stake_keyed_account, None, true, ), Err(InstructionError::InsufficientFunds) ); }
rust_cleaned_test_functions.jsonl/15298
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1248 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6615, 7633, 1261, 726, 23708, 1670, 2178, 454, 368, 341, 286, 1077, 18279, 34014, 792, 284, 23400, 61783, 486, 9585, 792, 486, 931, 33864, 543, 286, 1077, 2790, 907, 309, 3394, 284, 220, 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_rope_cell_at() { let left = Rope::Leaf(Leaf::new(String::from("123"), 0, false)); let right = Rope::Leaf(Leaf::new(String::from("456"), 1, false)); let rope = Rope::Node(Box::new(left), Box::new(right)); let cell = rope.cell_at(5); assert_eq!(cell.text, "5"); assert_eq!(cell.hl_id, 1); let cell = rope.cell_at(1); assert_eq!(cell.text, "1"); assert_eq!(cell.hl_id, 0); }
rust_cleaned_test_functions.jsonl/14022
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 239 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 26608, 375, 16648, 3752, 368, 341, 286, 1077, 2115, 284, 97896, 486, 31461, 7, 31461, 486, 931, 2242, 486, 1499, 445, 16, 17, 18, 3975, 220, 15, 11, 895, 1106, 286, 1077, 1290, 284, 97896, 486...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_wserror_http_response() { let resp: Response = HandshakeError::GetMethodRequired.error_response(); assert_eq!(resp.status(), StatusCode::METHOD_NOT_ALLOWED); let resp: Response = HandshakeError::NoWebsocketUpgrade.error_response(); assert_eq!(resp.status(), StatusCode::BAD_REQUEST); let resp: Response = HandshakeError::NoConnectionUpgrade.error_response(); assert_eq!(resp.status(), StatusCode::BAD_REQUEST); let resp: Response = HandshakeError::NoVersionHeader.error_response(); assert_eq!(resp.status(), StatusCode::BAD_REQUEST); let resp: Response = HandshakeError::UnsupportedVersion.error_response(); assert_eq!(resp.status(), StatusCode::BAD_REQUEST); let resp: Response = HandshakeError::BadWebsocketKey.error_response(); assert_eq!(resp.status(), StatusCode::BAD_REQUEST); }
rust_cleaned_test_functions.jsonl/22429
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 340 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 50211, 841, 25888, 9655, 368, 341, 286, 1077, 9039, 25, 5949, 284, 8536, 29661, 1454, 486, 85073, 8164, 4417, 9655, 543, 286, 2060, 10714, 10297, 18243, 4299, 1507, 53403, 486, 38074, 9169, 73186, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_validate_max_gas_units_above_max() { let (config, key) = config_builder::test_config(); let (vm_validator, mut rt) = TestValidator::new(&config); let address = account_config::association_address(); let txn = transaction_test_helpers::get_test_signed_transaction( address, 1, &key, key.public_key(), None, 0, 0, /* max gas price */ Some(u64::MAX), // Max gas units ); let ret = rt.block_on(vm_validator.validate_transaction(txn)).unwrap(); assert_eq!( ret.unwrap().major_status, StatusCode::MAX_GAS_UNITS_EXCEEDS_MAX_GAS_UNITS_BOUND ); }
rust_cleaned_test_functions.jsonl/2297
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 326 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 42681, 6345, 82116, 28345, 77315, 6345, 368, 341, 262, 1077, 320, 1676, 11, 1376, 8, 284, 2193, 28532, 486, 1944, 5332, 543, 262, 1077, 320, 7338, 64959, 11, 5206, 16677, 8, 284, 3393, 14256, 48...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_valid_nested() { let deserializer = &mut Deserializer::from_str(r#"{"answer":42,"other":21}"#); let mut meta_map = MetaMap::new(); meta_map.insert("answer".to_string(), Meta::from_error("some prior error")); let value = Annotated::from(Test { answer: Annotated::new(42, Meta::from_error("some prior error")), other: 21, }); assert_eq_dbg!(value, deserialize_meta(deserializer, meta_map).unwrap()); }
rust_cleaned_test_functions.jsonl/126354
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 224 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8337, 66279, 368, 341, 286, 1077, 939, 41939, 284, 609, 6984, 3874, 41939, 486, 1499, 2895, 2601, 55543, 4913, 9217, 788, 19, 17, 1335, 1575, 788, 17, 16, 9863, 2, 317, 286, 1077, 5206, 8823, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_init_1() { check_output_default( "class Foo {\ init(val) {\ this.val = val;\ }\ }\ \ var foo = Foo(42);\ print foo.val;", "42", ) }
rust_cleaned_test_functions.jsonl/111855
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 208 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6137, 62, 16, 368, 341, 286, 1779, 7645, 9993, 1006, 310, 330, 1040, 33428, 95519, 2290, 2930, 9098, 8, 95519, 338, 419, 10835, 284, 1044, 55783, 2290, 335, 5661, 1797, 335, 5661, 1797, 3044, 17...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_check_request_limit() { let keypair = Keypair::new(); let mut drone = Drone::new(keypair, None, Some(3)); assert!(drone.check_request_limit(1)); drone.request_current = 3; assert!(!drone.check_request_limit(1)); }
rust_cleaned_test_functions.jsonl/123510
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 129 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 7200, 7893, 14763, 368, 341, 286, 1077, 1376, 12670, 284, 6569, 1082, 1310, 486, 931, 543, 286, 1077, 5206, 26713, 284, 73481, 486, 931, 4857, 12670, 11, 2240, 11, 4329, 7, 18, 1106, 286, 2060, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_generation_becomes_u64() { let t: Object<NotUsed, NotUsed> = serde_json::from_str(METADATA).expect("Valid Metadata"); let reserialized = serde_json::to_string(&t).expect("bytes"); let deserialized: Value = serde_json::from_str(&reserialized).expect("untyped JSON"); let v = filter_configuration(deserialized); assert!(v["metadata"].get("generation").unwrap().is_u64()); }
rust_cleaned_test_functions.jsonl/52346
{ "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, 64191, 880, 757, 20347, 7300, 21, 19, 368, 341, 286, 1077, 259, 25, 3002, 27, 2623, 22743, 11, 2806, 22743, 29, 284, 61570, 9455, 486, 1499, 2895, 3189, 1348, 39119, 568, 17119, 445, 4088, 33589...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_vec3_new() { let v = vec3(1.0, 2.0, 3.0); assert_eq!(v.x(), 1.0); assert_eq!(v.y(), 2.0); assert_eq!(v.z(), 3.0); let t = (1.0, 2.0, 3.0); let v = Vec3::from(t); assert_eq!(t, v.into()); let a = [1.0, 2.0, 3.0]; let v = Vec3::from(a); let a1: [f32; 3] = v.into(); assert_eq!(a, a1); let v = Vec3::new(t.0, t.1, t.2); assert_eq!(t, v.into()); assert_eq!(Vec3::new(1.0, 0.0, 0.0), Vec3::unit_x()); assert_eq!(Vec3::new(0.0, 1.0, 0.0), Vec3::unit_y()); assert_eq!(Vec3::new(0.0, 0.0, 1.0), Vec3::unit_z()); }
rust_cleaned_test_functions.jsonl/48580
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 352 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13251, 18, 5921, 368, 341, 262, 1077, 348, 284, 7486, 18, 7, 16, 13, 15, 11, 220, 17, 13, 15, 11, 220, 18, 13, 15, 626, 262, 2060, 10714, 10297, 85, 1993, 1507, 220, 16, 13, 15, 317, 262...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_from_scale() { let matrix = Matrix3x3::from_scale(3); let unit_x = Vector3::unit_x(); let unit_y = Vector3::unit_y(); let unit_z = Vector3::unit_z(); let expected = unit_x * 3 + unit_y * 3 + unit_z * 3; let result = matrix * Vector3::new(1, 1, 1); assert_eq!(result, expected); }
rust_cleaned_test_functions.jsonl/129036
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 185 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5673, 16727, 368, 341, 286, 1077, 6172, 284, 11631, 18, 87, 18, 486, 1499, 16727, 7, 18, 317, 286, 1077, 4982, 3212, 284, 4196, 18, 486, 3843, 3212, 543, 286, 1077, 4982, 4178, 284, 4196, 18, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_add_match() { use self::stdintf::org_freedesktop_dbus::PropertiesPropertiesChanged as Ppc; let c = Connection::new_session().unwrap(); let x = c.add_match(Ppc::match_rule(None, None), |_: Ppc, _, _| { true }).unwrap(); c.remove_match(x).unwrap(); }
rust_cleaned_test_functions.jsonl/20028
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 123 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2891, 10708, 368, 341, 262, 990, 656, 486, 31435, 69, 486, 1775, 761, 28516, 62204, 8685, 355, 486, 7903, 7903, 5389, 438, 393, 3992, 280, 262, 1077, 272, 284, 11032, 486, 931, 12316, 1005, 1545...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_as_dangerous() { assert_eq!(input!(b"").as_dangerous(), b""); assert_eq!(input!(b"hello").as_dangerous(), b"hello"); }
rust_cleaned_test_functions.jsonl/15430
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 70 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11898, 814, 4003, 782, 368, 341, 262, 2060, 10714, 10297, 1355, 10297, 65, 1, 1827, 300, 814, 4003, 782, 1507, 293, 1, 797, 262, 2060, 10714, 10297, 1355, 10297, 65, 1, 14990, 1827, 300, 814, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_count_pythagorean_triples() { assert_eq!(count_pythagorean_triples(pow(10, 6)), (808950, 70229)); }
rust_cleaned_test_functions.jsonl/12310
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 61 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3180, 40291, 95362, 45195, 3547, 37458, 368, 341, 262, 2060, 10714, 10297, 1830, 40291, 95362, 45195, 3547, 37458, 72507, 7, 16, 15, 11, 220, 21, 5731, 320, 23, 15, 23, 24, 20, 15, 11, 220, 22...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_syscall_with_context() { test_interpreter_and_jit_asm!( " mov64 r1, 0xAA mov64 r2, 0xBB mov64 r3, 0xCC mov64 r4, 0xDD mov64 r5, 0xEE syscall SyscallWithContext mov64 r0, 0x0 exit", [], ( b"SyscallWithContext" => syscalls::SyscallWithContext::call; syscalls::SyscallWithContext { context: 42 }, ), { |vm: &EbpfVm<UserError, TestInstructionMeter>, res: Result| { let syscall_context_object = unsafe { &*(vm.get_syscall_context_object(syscalls::SyscallWithContext::call as usize).unwrap() as *const syscalls::SyscallWithContext) }; assert_eq!(syscall_context_object.context, 84); res.unwrap() == 0 }}, 8 ); }
rust_cleaned_test_functions.jsonl/59051
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 415 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 20344, 6659, 6615, 8467, 368, 341, 262, 1273, 15318, 28637, 8378, 5374, 275, 67529, 33673, 286, 6228, 286, 1974, 21, 19, 435, 16, 11, 220, 15, 60051, 198, 286, 1974, 21, 19, 435, 17, 11, 220, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_api_error_message() { let expected = ApiError::Message(MessageApiError { embed: Some( [ MessageApiErrorEmbedField::Fields, MessageApiErrorEmbedField::Timestamp, ] .to_vec(), ), }); serde_test::assert_tokens( &expected, &[ Token::Struct { name: "MessageApiError", len: 1, }, Token::Str("embed"), Token::Some, Token::Seq { len: Some(2) }, Token::UnitVariant { name: "MessageApiErrorEmbedField", variant: "fields", }, Token::UnitVariant { name: "MessageApiErrorEmbedField", variant: "timestamp", }, Token::SeqEnd, Token::StructEnd, ], ); }
rust_cleaned_test_functions.jsonl/14459
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 666 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11697, 4096, 6462, 368, 341, 286, 1077, 3601, 284, 13443, 1454, 486, 2052, 29359, 6563, 1454, 341, 310, 11579, 25, 4329, 1006, 394, 2278, 503, 4856, 6563, 1454, 25486, 1877, 486, 8941, 345, 503, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_any_serialize_deserialize() { let inner = Foo { string: String::from("inner"), timestamp: None, boolean: false, data: None, list: vec!["een".to_string(), "twee".to_string()], payload: None, }; let original = Foo { string: String::from("original"), timestamp: Some(prost_wkt_types::Timestamp { seconds: 99, nanos: 42, }), boolean: true, data: Some(prost_wkt_types::Value::from("world".to_string())), list: vec!["one".to_string(), "two".to_string()], payload: prost_wkt_types::Any::try_pack(inner).ok(), }; let json = serde_json::to_string(&original).unwrap(); println!("Serialized Foo: {}", json); let back: Foo = serde_json::from_str(&json).unwrap(); println!("Deserialized Foo: {:?}", &back); assert_eq!(back, original) }
rust_cleaned_test_functions.jsonl/45540
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 417 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 37248, 88686, 15768, 9050, 368, 341, 262, 1077, 9179, 284, 33428, 341, 286, 914, 25, 923, 486, 1499, 445, 4382, 4461, 286, 11441, 25, 2240, 345, 286, 2710, 25, 895, 345, 286, 821, 25, 2240, 34...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_with_valid_short_arguments() { let config = Config::new(&["duckdns-ip-updater", "-d", "mydomain", "-t", "mytoken"]).unwrap(); assert_eq!(config.get_domains(), &["mydomain"]); assert_eq!(config.get_token(), "mytoken"); }
rust_cleaned_test_functions.jsonl/71848
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 140 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6615, 8337, 16673, 43433, 368, 972, 286, 1077, 2193, 32203, 310, 5532, 486, 931, 2099, 1183, 72970, 45226, 74732, 5239, 27463, 497, 6523, 67, 497, 330, 2408, 12204, 497, 6523, 83, 497, 330, 2408, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_large() { let mut val = Vec::new(); val.resize(4660, 0x12); wrap_in_sequence(&mut val); assert_eq!(vec![0x30, 0x82, 0x12, 0x34, 0x12, 0x12], val[..6].to_vec()); }
rust_cleaned_test_functions.jsonl/89557
{ "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, 45228, 368, 341, 262, 1077, 5206, 1044, 284, 11312, 486, 931, 543, 262, 1044, 17382, 7, 19, 21, 21, 15, 11, 220, 15, 87, 16, 17, 317, 262, 15061, 1243, 23735, 2099, 6984, 1044, 317, 262, 206...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_combination_of_null_and_non_null_lines() { let mut processor = processor_stub(); processor.json = r#"[null,"hello",null,"world"]"#.to_owned(); processor.program = ".[]".to_owned(); processor.pretty_output = true; let context = Context::new().unwrap(); let output = processor.run(&context).unwrap().expect("Some"); assert_eq!(output, "hello\nworld".to_owned()) }
rust_cleaned_test_functions.jsonl/90634
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 218 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 34454, 2554, 3575, 15162, 8378, 21637, 15162, 18323, 368, 341, 310, 1077, 5206, 17654, 284, 17654, 62781, 543, 310, 17654, 4323, 284, 435, 2, 36864, 2921, 1335, 14990, 497, 2921, 1335, 14615, 1341, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_fixed_size_array() { assert_eq!(map_to_solidity_type::<[u8; 1024]>(), "uint8[1024]"); assert_eq!(map_to_solidity_type::<[u16; 1024]>(), "uint16[1024]"); assert_eq!(map_to_solidity_type::<[u32; 1024]>(), "uint32[1024]"); assert_eq!(map_to_solidity_type::<[u64; 1024]>(), "uint64[1024]"); assert_eq!(map_to_solidity_type::<[u128; 1024]>(), "uint128[1024]"); assert_eq!(map_to_solidity_type::<[u256; 1024]>(), "uint256[1024]"); assert_eq!(map_to_solidity_type::<[i8; 1024]>(), "int8[1024]"); assert_eq!(map_to_solidity_type::<[i16; 1024]>(), "int16[1024]"); assert_eq!(map_to_solidity_type::<[i32; 1024]>(), "int32[1024]"); assert_eq!(map_to_solidity_type::<[i64; 1024]>(), "int64[1024]"); assert_eq!(map_to_solidity_type::<[i128; 1024]>(), "int128[1024]"); assert_eq!(map_to_solidity_type::<[i256; 1024]>(), "int256[1024]"); assert_eq!(map_to_solidity_type::<[String; 0]>(), "string[0]"); assert_eq!(map_to_solidity_type::<[Address; 0]>(), "address[0]"); assert_eq!(map_to_solidity_type::<Vec<[u8; 65535]>>(), "uint8[65535][]"); seq!(N in 1..=32 { assert_eq!( map_to_solidity_type::<[Bytes#N; (N as usize)]>(), stringify!(bytes#N[N]).replace(" ", "").replace("u64", ""), ); }); }
rust_cleaned_test_functions.jsonl/4193
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 732 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 37839, 2368, 3858, 368, 341, 286, 2060, 10714, 10297, 2186, 2346, 643, 5192, 487, 1819, 27638, 58, 84, 23, 26, 220, 16, 15, 17, 19, 25669, 1507, 330, 2496, 23, 58, 16, 15, 17, 19, 37389, 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_fill_scalar() { let hw = RefCell::new(CpuHardware::new()); let g = RefCell::new(Graph::new()); let ret = Node::fill(&g, &hw, Shape::new([]), 123.); assert_eq!(ret.shape(), Shape::new([])); assert!(ptr::eq(ret.hardware(), &hw)); assert_eq!(f32::try_from(ret), Ok(123.)); }
rust_cleaned_test_functions.jsonl/31062
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 144 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 30728, 41652, 368, 341, 262, 1077, 31256, 284, 8550, 3599, 486, 931, 3025, 5584, 66862, 486, 931, 1423, 262, 1077, 342, 284, 8550, 3599, 486, 931, 63779, 486, 931, 1423, 262, 1077, 2112, 284, 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_reaction_remove_emoji() { let cache = cache_with_message_and_reactions(); cache.update(&ReactionRemoveEmoji { channel_id: ChannelId(2), emoji: PartialEmoji { id: None, name: "😀".to_owned(), }, guild_id: GuildId(1), message_id: MessageId(4), }); let msg = cache.message(ChannelId(2), MessageId(4)).unwrap(); assert_eq!(msg.reactions.len(), 1); let world_react = msg .reactions .iter() .find(|&r| matches!(&r.emoji, ReactionType::Unicode {name} if name == "🗺️")); let smiley_react = msg .reactions .iter() .find(|&r| matches!(&r.emoji, ReactionType::Unicode {name} if name == "😀")); assert!(world_react.is_some()); assert_eq!(world_react.unwrap().count, 1); assert!(smiley_react.is_none()); }
rust_cleaned_test_functions.jsonl/88901
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 511 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 96631, 18193, 62, 37523, 368, 341, 286, 1077, 6500, 284, 6500, 6615, 6462, 8378, 1288, 4020, 543, 286, 6500, 5317, 2099, 87236, 13021, 92731, 341, 310, 5496, 842, 25, 13434, 764, 7, 17, 1326, 31...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_parse_path() { parse_tokens( VariablePathShape, vec![b::var("it"), b::op("."), b::bare("cpu")], |tokens| { let (outer_var, inner_var) = tokens[0].expect_var(); let bare = tokens[2].expect_bare(); hir::Expression::path( hir::Expression::it_variable(inner_var, outer_var), vec![PathMember::string("cpu", bare)], outer_var.until(bare), ) }, ); parse_tokens( VariablePathShape, vec![ b::var("cpu"), b::op("."), b::bare("amount"), b::op("."), b::string("max ghz"), ], |tokens| { let (outer_var, inner_var) = tokens[0].expect_var(); let amount = tokens[2].expect_bare(); let (outer_max_ghz, _) = tokens[4].expect_string(); hir::Expression::path( hir::Expression::variable(inner_var, outer_var), vec![ PathMember::string("amount", amount), PathMember::string("max ghz", outer_max_ghz), ], outer_var.until(outer_max_ghz), ) }, ); }
rust_cleaned_test_functions.jsonl/77830
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 723 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 2638, 368, 341, 262, 4715, 28838, 1006, 286, 12407, 1820, 12301, 345, 286, 7486, 20703, 65, 486, 947, 445, 275, 3975, 293, 486, 453, 73133, 701, 293, 486, 54102, 445, 16475, 899, 1259, 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_eval_single_fn_call_node() { #[derive(Debug, Clone, Copy, RpnFunction)] #[rpn_function(args = 0)] struct FnFoo; impl FnFoo { fn call(_ctx: &mut EvalContext, _payload: RpnFnCallPayload<'_>) -> Result<Option<i64>> { Ok(Some(42)) } } let exp = RpnExpressionBuilder::new() .push_fn_call(FnFoo, FieldTypeTp::LongLong) .build(); let mut ctx = EvalContext::default(); let mut columns = LazyBatchColumnVec::empty(); let result = exp.eval(&mut ctx, 4, &[], &mut columns); let val = result.unwrap(); assert!(val.is_vector()); assert_eq!( val.vector_value().unwrap().as_int_slice(), [Some(42), Some(42), Some(42), Some(42)] ); assert_eq!(val.field_type().tp(), FieldTypeTp::LongLong); }
rust_cleaned_test_functions.jsonl/111581
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 462 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21296, 19487, 15246, 13429, 5084, 368, 341, 286, 11506, 27098, 42618, 11, 27913, 11, 14540, 11, 431, 19958, 5152, 5563, 286, 11506, 81, 19958, 9174, 7356, 284, 220, 15, 5563, 286, 2036, 50182, 409...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_interfaces() { let mut memory = MemoryMap::builder() .ram(0x0000, 0xCFFF) .rom(0xD000, 0xFFFF, vec![0xEA; 0x10000 - 0xD000]) .build(); assert_eq!(0x00, memory.read().byte(0x0005)); memory.write().byte(0x0005, 0xFF); assert_eq!(0xFF, memory.read().byte(0x0005)); assert_eq!(0xEA, memory.read().byte(0xD000)); memory.write().byte(0xD000, 0x00); assert_eq!(0xEA, memory.read().byte(0xD000)); assert_eq!(None, memory.step()); }
rust_cleaned_test_functions.jsonl/111900
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 297 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 72960, 368, 341, 286, 1077, 5206, 4938, 284, 13850, 2227, 486, 17850, 741, 310, 659, 2396, 7, 15, 87, 15, 15, 15, 15, 11, 220, 15, 12125, 31203, 340, 310, 659, 441, 7, 15, 15764, 15, 15, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_delete_subkey() { let path = "Software\\WinRegRsTestDeleteSubkey"; RegKey::predef(HKEY_CURRENT_USER) .create_subkey(path) .unwrap(); assert!(RegKey::predef(HKEY_CURRENT_USER) .delete_subkey(path) .is_ok()); }
rust_cleaned_test_functions.jsonl/128084
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 136 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11353, 5228, 792, 368, 341, 262, 1077, 1815, 284, 330, 19250, 3422, 16970, 3477, 42327, 2271, 6435, 3136, 792, 876, 262, 3184, 1592, 486, 1726, 750, 10896, 4784, 32938, 9107, 340, 286, 659, 3182, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_provision_agent_async_c_closure() { let _setup = SetupMocks::init(); let config = AgentProvisionConfig { agency_did: "Ab8TvZa3Q19VNkQVzAWVL7".into(), agency_verkey: "5LXaR43B1aQyeh94VBP8LG1Sgvjk7aNfqiksBCSjwqbf".into(), agency_endpoint: "https://enym-eagency.pdev.evernym.com".into(), agent_seed: None, }; let result = _vcx_agent_provision_async_c_closure(&json!(config).to_string()).unwrap(); let _config: serde_json::Value = serde_json::from_str(&result.unwrap()).unwrap(); }
rust_cleaned_test_functions.jsonl/35821
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 301 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2540, 13013, 25730, 28346, 666, 72823, 368, 341, 286, 1077, 716, 15188, 284, 18626, 72577, 486, 2327, 1428, 286, 1077, 2193, 284, 20713, 1336, 13013, 2648, 341, 310, 9088, 814, 307, 25, 330, 5830,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_parser() { let s = r#" "sepal.length","sepal.width","petal.length","petal.width","variety" 5.1,3.5,1.4,.2,"Setosa" 4.9,3,1.4,.2,"Setosa" 4.7,3.2,1.3,.2,"Setosa" 4.6,3.1,1.5,.2,"Setosa" 5,3.6,1.4,.2,"Setosa" 5.4,3.9,1.7,.4,"Setosa" 4.6,3.4,1.4,.3,"Setosa" "#; let file = Cursor::new(s); CsvReader::new(file) .infer_schema(Some(100)) .has_header(true) .with_ignore_parser_errors(true) .finish() .unwrap(); let s = r#" "sepal.length","sepal.width","petal.length","petal.width","variety" 5.1,3.5,1.4,.2,"Setosa" 5.1,3.5,1.4,.2,"Setosa" "#; let file = Cursor::new(s); // just checks if unwrap doesn't panic CsvReader::new(file) // we also check if infer schema ignores errors .infer_schema(Some(10)) .has_header(true) .with_ignore_parser_errors(true) .finish() .unwrap(); let s = r#""sepal.length","sepal.width","petal.length","petal.width","variety" 5.1,3.5,1.4,.2,"Setosa" 4.9,3,1.4,.2,"Setosa" 4.7,3.2,1.3,.2,"Setosa" 4.6,3.1,1.5,.2,"Setosa" 5,3.6,1.4,.2,"Setosa" 5.4,3.9,1.7,.4,"Setosa" 4.6,3.4,1.4,.3,"Setosa" "#; let file = Cursor::new(s); let df = CsvReader::new(file) .infer_schema(Some(100)) .has_header(true) .finish() .unwrap(); let col = df.column("variety").unwrap(); dbg!(&df); assert_eq!(col.get(0), AnyValue::Utf8("Setosa")); assert_eq!(col.get(2), AnyValue::Utf8("Setosa")); assert_eq!("sepal.length", df.get_columns()[0].name()); assert_eq!(1, df.column("sepal.length").unwrap().chunks().len()); assert_eq!(df.height(), 7); // test windows line endings let s = "head_1,head_2\r\n1,2\r\n1,2\r\n1,2\r\n"; let file = Cursor::new(s); let df = CsvReader::new(file) .infer_schema(Some(100)) .has_header(true) .finish() .unwrap(); assert_eq!("head_1", df.get_columns()[0].name()); assert_eq!(df.shape(), (3, 2)); }
rust_cleaned_test_functions.jsonl/57560
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1308 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 18517, 368, 341, 286, 1077, 274, 284, 435, 2, 698, 330, 325, 19308, 1954, 2198, 325, 19308, 5441, 2198, 6862, 278, 1954, 2198, 6862, 278, 5441, 2198, 29165, 2611, 698, 220, 20, 13, 16, 11, 18,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_geos_1() { let line_1 = Line::new( Coordinate { x: 588750.7429703881, y: 4518950.493668233, }, Coordinate { x: 588748.2060409798, y: 4518933.9452804085, }, ); let line_2 = Line::new( Coordinate { x: 588745.824857241, y: 4518940.742239175, }, Coordinate { x: 588748.2060437313, y: 4518933.9452791475, }, ); let actual = line_intersection(line_1, line_2); let expected = LineIntersection::SinglePoint { intersection: Coordinate { x: 588748.2060416829, y: 4518933.945284994, }, is_proper: true, }; assert_eq!(actual, Some(expected)); }
rust_cleaned_test_functions.jsonl/129777
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 582 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 32933, 436, 62, 16, 368, 341, 286, 1077, 1555, 62, 16, 284, 7083, 486, 931, 1006, 310, 41035, 341, 394, 856, 25, 220, 20, 23, 23, 22, 20, 15, 13, 22, 19, 17, 24, 22, 15, 18, 23, 23, 16...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_dir_exists_absolute_pass() { let d = get_current_dir().ok(); d.and_then(|p| { assert_eq!(dir_exists(&p), true); Some(true) }); }
rust_cleaned_test_functions.jsonl/18996
{ "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, 4334, 9766, 50874, 15464, 368, 341, 286, 1077, 294, 284, 633, 11080, 4334, 1005, 562, 543, 286, 294, 34724, 68367, 22428, 79, 91, 341, 310, 2060, 10714, 10297, 3741, 9766, 2099, 79, 701, 830, 31...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_trim_multiline_block() { assert_eq!("\ if x { y } else { z }", trim_multiline(" if x { y } else { z }".into(), false, None)); assert_eq!("\ if x { \ty } else { \tz }", trim_multiline(" if x { \ty } else { \tz }".into(), false, None)); }
rust_cleaned_test_functions.jsonl/4235
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 251 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 70025, 26290, 26560, 7113, 368, 341, 286, 2060, 10714, 0, 4921, 198, 262, 421, 856, 341, 286, 379, 198, 262, 335, 770, 341, 286, 1147, 198, 262, 335, 497, 11013, 26290, 26560, 445, 262, 421, 8...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_meta_item_multiple() { run_test( "#[foo(word, name = 5, list(name2 = 6), word2)]", MetaList { ident: ident("foo").into(), paren_token: Default::default(), nested: punctuated![ NestedMeta::Meta(Meta::Word(ident("word").into())), NestedMeta::Meta( MetaNameValue { ident: ident("name").into(), eq_token: Default::default(), lit: lit(Literal::i32_unsuffixed(5)), }.into(), ), NestedMeta::Meta( MetaList { ident: ident("list").into(), paren_token: Default::default(), nested: punctuated![NestedMeta::Meta( MetaNameValue { ident: ident("name2").into(), eq_token: Default::default(), lit: lit(Literal::i32_unsuffixed(6)), }.into(), ),], }.into(), ), NestedMeta::Meta(Meta::Word(ident("word2").into())), ], }, ) }
rust_cleaned_test_functions.jsonl/63946
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 823 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13381, 5634, 45233, 368, 341, 262, 1598, 4452, 1006, 286, 5869, 58, 7975, 17008, 11, 829, 284, 220, 20, 11, 1140, 3153, 17, 284, 220, 21, 701, 3409, 17, 7252, 756, 286, 15819, 852, 341, 310, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_hashmap_backend_set_unset() { let interp = crate::interpreter().expect("init"); // given let mut backend = Memory::new(); let env_name = "7a6885c3-0c17-4310-a5e7-ed971cac69b6"; let env_value = "value"; // when backend .put(&interp, env_name.as_bytes(), Some(env_value.as_bytes())) .unwrap(); backend.put(&interp, env_name.as_bytes(), None).unwrap(); let value = backend.get(&interp, env_name.as_bytes()); // then assert_eq!(None, value.unwrap().try_into::<Option<&[u8]>>().unwrap()); }
rust_cleaned_test_functions.jsonl/68939
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 311 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8950, 2186, 40011, 2602, 98109, 368, 341, 286, 1077, 47271, 284, 17717, 486, 90554, 1005, 17119, 445, 2327, 797, 286, 442, 2661, 198, 286, 1077, 5206, 19163, 284, 13850, 486, 931, 543, 286, 1077, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_variable_sized_validity() { let array = BinaryArray::<i32>::from_iter(vec![Some("a"), Some("bc"), None, Some("defh")]); let mut a = GrowableBinary::new(&[&array], false, 0); a.extend(0, 1, 2); let result: BinaryArray<i32> = a.into(); let expected = BinaryArray::<i32>::from_iter(vec![Some("bc"), None]); assert_eq!(result, expected); }
rust_cleaned_test_functions.jsonl/115387
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 186 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14635, 643, 1506, 8337, 487, 368, 341, 286, 1077, 1334, 284, 17718, 1857, 27638, 72, 18, 17, 6831, 1499, 11723, 25592, 20703, 8373, 445, 64, 3975, 4329, 445, 8904, 3975, 2240, 11, 4329, 445, 750...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_d_h() { assert_eq!( Subcommand::parse(argv!["-h"]).unwrap(), (&EMPTY[..], Subcommand::Help { summary: true }) ); }
rust_cleaned_test_functions.jsonl/84269
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 101 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 814, 1523, 368, 341, 286, 2060, 10714, 33673, 310, 3719, 5631, 486, 6400, 15329, 0, 1183, 12, 71, 45014, 15454, 3148, 310, 15899, 32858, 95874, 1125, 3719, 5631, 486, 12689, 314, 12126, 25, 830, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_process_len() -> anyhow::Result<()> { let pf = create_procfile(); let result = pf.process_len(); assert_eq!(result, 2); Ok(()) }
rust_cleaned_test_functions.jsonl/98627
{ "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, 11305, 6043, 368, 1464, 88964, 486, 2077, 71698, 341, 286, 1077, 27418, 284, 1855, 24436, 1192, 543, 286, 1077, 1102, 284, 27418, 16988, 6043, 543, 286, 2060, 10714, 10297, 1382, 11, 220, 17, 626,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_sort() { let assigns = o!({ "value": 3, "numbers": [2, 1, 4, 3], "words": ["expected", "as", "alphabetic"], "arrays": ["flower", "are"], "case_sensitive": ["sensitive", "Expected", "case"], }); assert_template_result!("1 2 3 4", "{{numbers | sort | join}}", assigns); assert_template_result!("alphabetic as expected", "{{words | sort | join}}", assigns); assert_template_result!("3", "{{value | sort}}", assigns); assert_template_result!("are flower", "{{arrays | sort | join}}", assigns); assert_template_result!( "Expected case sensitive", "{{case_sensitive | sort | join}}", assigns ); }
rust_cleaned_test_functions.jsonl/85604
{ "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, 18435, 368, 341, 262, 1077, 49912, 284, 297, 0, 2262, 286, 330, 957, 788, 220, 18, 345, 286, 330, 37378, 788, 508, 17, 11, 220, 16, 11, 220, 19, 11, 220, 18, 1259, 286, 330, 5761, 788, 438...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_build_custom_cli_profile_file_path() { let file_path = build_cli_profile_file_path(Some(&"custom".to_owned())); assert_eq!(file_path.is_ok(), true); let mut expected_file_path = PathBuf::new(); expected_file_path.push(home_dir().unwrap()); expected_file_path.push(".fluvio/profiles/custom.toml"); assert_eq!(file_path.unwrap(), expected_file_path); }
rust_cleaned_test_functions.jsonl/109307
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 188 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 20801, 15875, 47147, 13789, 2458, 2638, 368, 341, 286, 1077, 1034, 2638, 284, 1936, 47147, 13789, 2458, 2638, 65405, 2099, 1, 9163, 3263, 983, 51973, 7392, 286, 2060, 10714, 10297, 1192, 2638, 2079,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_poseidon_hasher() { let leaves = [ PoseidonDomain(Fr::one().into_repr()), PoseidonDomain(Fr::zero().into_repr()), PoseidonDomain(Fr::zero().into_repr()), PoseidonDomain(Fr::one().into_repr()), ]; let t = MerkleTree::<PoseidonHasher, typenum::U2>::new(leaves.iter().copied()) .expect("merkle tree new failure"); assert_eq!(t.leafs(), 4); let mut a = PoseidonFunction::default(); assert_eq!(t.read_at(0).expect("read_at failure"), leaves[0]); assert_eq!(t.read_at(1).expect("read_at failure"), leaves[1]); assert_eq!(t.read_at(2).expect("read_at failure"), leaves[2]); assert_eq!(t.read_at(3).expect("read_at failure"), leaves[3]); let i1 = a.node(leaves[0], leaves[1], 0); a.reset(); let i2 = a.node(leaves[2], leaves[3], 0); a.reset(); assert_eq!(t.read_at(4).expect("read_at failure"), i1); assert_eq!(t.read_at(5).expect("read_at failure"), i2); let root = a.node(i1, i2, 1); a.reset(); assert_eq!( t.read_at(4).expect("read_at failure").0, FrRepr([ 0xb339ff6079800b5e, 0xec5907b3dc3094af, 0x93c003cc74a24f26, 0x042f94ffbe786bc3, ]) ); let expected = FrRepr([ 0xefbb8be3e291e671, 0x77cc72b8cb2b5ad2, 0x30eb6385ae6b74ae, 0x1effebb7b26ad9eb, ]); let actual = t.read_at(6).expect("read_at failure").0; assert_eq!(actual, expected); assert_eq!(t.read_at(6).expect("read_at failure"), root); }
rust_cleaned_test_functions.jsonl/73089
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 954 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 33201, 90456, 8950, 261, 368, 341, 286, 1077, 10901, 284, 2278, 310, 50373, 90456, 13636, 7832, 81, 486, 603, 1005, 18122, 68535, 14702, 310, 50373, 90456, 13636, 7832, 81, 486, 14154, 1005, 18122, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_bank_process_and_record_transactions_all_unexecuted() { solana_logger::setup(); let GenesisConfigInfo { genesis_config, mint_keypair, .. } = create_slow_genesis_config(10_000); let bank = Arc::new(Bank::new_no_wallclock_throttle_for_tests(&genesis_config)); let pubkey = solana_sdk::pubkey::new_rand(); let transactions = { let mut tx = system_transaction::transfer(&mint_keypair, &pubkey, 1, genesis_config.hash()); // Add duplicate account key tx.message.account_keys.push(pubkey); sanitize_transactions(vec![tx]) }; let ledger_path = get_tmp_ledger_path_auto_delete!(); { let blockstore = Blockstore::open(ledger_path.path()) .expect("Expected to be able to open database ledger"); let (poh_recorder, _entry_receiver, record_receiver) = PohRecorder::new( bank.tick_height(), bank.last_blockhash(), bank.clone(), Some((4, 4)), bank.ticks_per_slot(), &pubkey, &Arc::new(blockstore), &Arc::new(LeaderScheduleCache::new_from_bank(&bank)), &Arc::new(PohConfig::default()), Arc::new(AtomicBool::default()), ); let recorder = poh_recorder.recorder(); let poh_recorder = Arc::new(Mutex::new(poh_recorder)); let poh_simulator = simulate_poh(record_receiver, &poh_recorder); poh_recorder.lock().unwrap().set_bank(&bank); let (gossip_vote_sender, _gossip_vote_receiver) = unbounded(); let process_transactions_batch_output = BankingStage::process_and_record_transactions( &bank, &transactions, &recorder, 0, None, &gossip_vote_sender, &QosService::new(Arc::new(RwLock::new(CostModel::default())), 1), ); let ExecuteAndCommitTransactionsOutput { transactions_attempted_execution_count, executed_transactions_count, executed_with_successful_result_count, commit_transactions_result, retryable_transaction_indexes, .. } = process_transactions_batch_output.execute_and_commit_transactions_output; assert_eq!(transactions_attempted_execution_count, 1); assert_eq!(executed_transactions_count, 0); assert_eq!(executed_with_successful_result_count, 0); assert!(retryable_transaction_indexes.is_empty()); assert_eq!( commit_transactions_result.ok(), Some(vec![CommitTransactionDetails::NotCommitted; 1]) ); poh_recorder .lock() .unwrap() .is_exited .store(true, Ordering::Relaxed); let _ = poh_simulator.join(); } Blockstore::destroy(ledger_path.path()).unwrap(); }
rust_cleaned_test_functions.jsonl/15487
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1660 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 35733, 11305, 8378, 14192, 68182, 5705, 4907, 11748, 2774, 368, 341, 286, 2048, 3362, 27413, 486, 15188, 543, 286, 1077, 40788, 2648, 1731, 341, 310, 59366, 5332, 345, 310, 28337, 3097, 12670, 345, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1