text
stringlengths
93
16.4k
id
stringlengths
20
40
metadata
dict
input_ids
listlengths
45
2.05k
attention_mask
listlengths
45
2.05k
complexity
int64
1
9
#[test] fn test_new() { let mut context = get_context(accounts(1)); testing_env!(context.build()); let contract = Shares::create( NFT_CONTRACT_ADDRESS.into(), NFT_TOKEN_ID.into(), accounts(0), TOTAL_SUPPLY.into(), DECIMALS, SHARE_PRICE.into() ); testing_env!(context.is_view(true).build()); assert_eq!(contract.ft_total_supply().0, TOTAL_SUPPLY); assert_eq!(contract.ft_balance_of(accounts(0)).0, TOTAL_SUPPLY); let expected_exit_price = TOTAL_SUPPLY * SHARE_PRICE; assert_eq!(contract.exit_price().0, expected_exit_price); }
rust_cleaned_test_functions.jsonl/21359
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 344 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5921, 368, 1476, 286, 1077, 5206, 2266, 284, 633, 8467, 91868, 7, 16, 1106, 286, 7497, 15879, 10297, 2147, 13239, 5231, 286, 1077, 5116, 284, 44185, 486, 3182, 1006, 310, 451, 3994, 4307, 41105, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_badpath3() { let mut api = ApiDescription::new(); let ret = api.register(ApiEndpoint::new( "test_badpath_handler".to_string(), test_badpath_handler, Method::GET, "/{c}/{d}", )); assert_eq!( ret, Err("path parameters are not consumed (c,d) and specified \ parameters do not appear in the path (a,b)" .to_string()) ); }
rust_cleaned_test_functions.jsonl/17568
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 266 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 34199, 2343, 18, 368, 341, 286, 1077, 5206, 6330, 284, 13443, 5009, 486, 931, 543, 286, 1077, 2112, 284, 6330, 9929, 65830, 27380, 486, 931, 1006, 310, 330, 1944, 34199, 2343, 10183, 3263, 983, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_construct_key() { // anything better we could be doing? let sregistry = Arc::new(ScopeRegistry::new()); let config = Configuration::mock(); let (clock, _) = Clock::mock(); let mregistry = Arc::new(MetricRegistry::new( sregistry.clone(), config, clock.clone(), )); let mut sink = Sink::new(mregistry, sregistry, Scope::Root, clock); let no_labels = sink.construct_key("foo"); assert_eq!(no_labels.name(), "foo"); assert_eq!(no_labels.labels().count(), 0); let labels_given = sink.construct_key(("baz", &[("type", "test")])); assert_eq!(labels_given.name(), "baz"); let label_str = labels_given .labels() .map(|l| format!("{}={}", l.key(), l.value())) .collect::<Vec<_>>() .join(","); assert_eq!(label_str, "type=test"); sink.add_default_labels(&[(("service", "foo"))]); let no_labels = sink.construct_key("bar"); assert_eq!(no_labels.name(), "bar"); let label_str = no_labels .labels() .map(|l| format!("{}={}", l.key(), l.value())) .collect::<Vec<_>>() .join(","); assert_eq!(label_str, "service=foo"); let labels_given = sink.construct_key(("quux", &[("type", "test")])); assert_eq!(labels_given.name(), "quux"); let label_str = labels_given .labels() .map(|l| format!("{}={}", l.key(), l.value())) .collect::<Vec<_>>() .join(","); assert_eq!(label_str, "type=test,service=foo"); }
rust_cleaned_test_functions.jsonl/47009
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 864 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 64803, 3097, 368, 341, 1789, 286, 442, 4113, 2664, 582, 1410, 387, 3730, 5267, 286, 1077, 274, 29172, 284, 19689, 486, 931, 3759, 2417, 15603, 486, 931, 1423, 286, 1077, 2193, 284, 12221, 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...
1
#[test] fn test_parse_line() { let result = LineParser::new(b"a.b.c.d = [ 101 , \"string\", [\"91\\n\", 91], 324.5] ").parse(); let ParseResult(chain, value) = result.unwrap(); assert_eq!(chain.len(), 4); assert_eq!(chain[0], "a"); assert_eq!(chain[1], "b"); assert_eq!(chain[2], "c"); assert_eq!(chain[3], "d"); if let Value::List(ls) = &value { if let Value::Int(101) = ls[0] {} else { panic!() } if let Value::String(s) = &ls[1] { if s != "string" { panic!() } } else { panic!() } if let Value::List(_) = ls[2] {} else { panic!() } if let Value::Float(f) = ls[3] { if f != 324.5 { panic!() } } else { panic!() } } else { panic!() } }
rust_cleaned_test_functions.jsonl/7742
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 527 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 6528, 368, 341, 286, 1077, 1102, 4035, 310, 7083, 6570, 486, 931, 1883, 56693, 948, 520, 950, 284, 508, 220, 220, 16, 15, 16, 1154, 7245, 917, 16215, 508, 2105, 24, 16, 3422, 77, 16215,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_column_and_rows() { let block = Block::<Simple>::new() .column("hello_id", vec![5_u64, 6]) .column("value", vec!["lol", "zuz"]); assert_eq!(block.column_count(), 2); assert_eq!(block.row_count(), 2); }
rust_cleaned_test_functions.jsonl/64434
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 143 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8744, 8378, 10949, 368, 341, 286, 1077, 2504, 284, 8362, 27638, 16374, 6831, 931, 741, 310, 659, 6229, 445, 14990, 842, 497, 7486, 20703, 20, 7300, 21, 19, 11, 220, 21, 2546, 310, 659, 6229, 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_purge() { let key = Keypair::new(); let index = AccountsIndex::<u64>::default(); let mut gc = Vec::new(); assert!(index.upsert( 1, &key.pubkey(), &Pubkey::default(), &[], &HashSet::new(), 12, &mut gc )); assert!(!index.upsert( 1, &key.pubkey(), &Pubkey::default(), &[], &HashSet::new(), 10, &mut gc )); let purges = index.purge_roots(&key.pubkey()); assert_eq!(purges, (vec![], false)); index.add_root(1, false); let purges = index.purge_roots(&key.pubkey()); assert_eq!(purges, (vec![(1, 10)], true)); assert!(!index.upsert( 1, &key.pubkey(), &Pubkey::default(), &[], &HashSet::new(), 9, &mut gc )); }
rust_cleaned_test_functions.jsonl/2237
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 610 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 620, 39823, 368, 341, 286, 1077, 1376, 284, 6569, 1082, 1310, 486, 931, 543, 286, 1077, 1922, 284, 40655, 1552, 27638, 84, 21, 19, 6831, 2258, 543, 286, 1077, 5206, 22122, 284, 11312, 486, 931, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_generator0() { assert_eq!( generators(0).B, hash_to_point(&RistrettoPublic::from(RISTRETTO_BASEPOINT_POINT)) ) }
rust_cleaned_test_functions.jsonl/71797
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 104 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 25813, 15, 368, 341, 286, 2060, 10714, 33673, 310, 43063, 7, 15, 568, 33, 345, 310, 5175, 2346, 6085, 2099, 49, 380, 2122, 983, 12676, 486, 1499, 2785, 3846, 38064, 5207, 11762, 21531, 27407, 11...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_left_outer_join_1() { let mut model = Model::new(); let g_id = add_get(&mut model); let b_id = add_left_outer_join(&mut model, g_id, g_id, |lhs, rhs| { vec![ exp::gt(exp::cref(lhs, 0), exp::cref(rhs, 0)), exp::lt(exp::cref(lhs, 1), exp::cref(rhs, 1)), exp::eq(exp::cref(lhs, 2), exp::cref(rhs, 2)), ] }); assert_derived_attribute(&mut model, b_id, |r#box| { HashSet::from([ cref(input(r#box, 1), 0), cref(input(r#box, 1), 1), cref(input(r#box, 1), 2), ]) }); }
rust_cleaned_test_functions.jsonl/42346
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 466 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9579, 67258, 31017, 62, 16, 368, 341, 286, 1077, 5206, 1614, 284, 4903, 486, 931, 543, 286, 1077, 342, 842, 284, 912, 3062, 2099, 6984, 1614, 317, 286, 1077, 293, 842, 284, 912, 9579, 67258, 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_op2() { let _ = op2() .easy_parse(position::Stream::new("R0 ROR $123")) .map(|(op, _)| { assert_eq!(Op2::ShifedReg(Reg::R0, Shift::ROR, 123, (1, 28)), op); }) .map_err(|_| assert!(false)); let _ = op2() .easy_parse(position::Stream::new( " \n R0 \n \n ROR $123", )) .map(|_| assert!(false)); let _ = op2() .easy_parse(position::Stream::new("$123 ROR $12 ")) .map(|(op, _)| { assert_eq!(Op2::Immediate(123, 12, (1, 20)), op); }) .map_err(|_| assert!(false)); }
rust_cleaned_test_functions.jsonl/103369
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 463 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10287, 17, 368, 341, 286, 1077, 716, 284, 1179, 17, 741, 310, 659, 45022, 21039, 12470, 486, 3027, 486, 931, 445, 49, 15, 2290, 431, 868, 256, 400, 16, 17, 18, 5455, 310, 659, 2186, 22428, 7...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_diff_branch_depth() { #[rustfmt::skip] let tests = &[ (0b0000, 0b0100, 0), (0b0000, 0b1000, 0), (0b00_0000, 0b01_0000, 1), (0b00_0000, 0b10_0000, 1), (0b0000_0000_0000_0000_0000_0000, 0b0100_0000_0000_0000_0000_0000, 10), (0b0000_0000_0000_0000_0000_0000, 0b1000_0000_0000_0000_0000_0000, 10), (0b0000_0000_0000_0000_0000_0000, 0b0100_0000_0000_0000_0000_0100, 0), (0b0000_0000_0000_0000_0000_0000, 0b1000_0000_0000_0000_0000_1000, 0), (0b0000, 0b0101, 0), (0b0000, 0b1001, 0), ]; for (pid1, pid2, expected) in tests.iter().copied() { let pid1 = ProcessId(pid1); let pid2 = ProcessId(pid2); let got = diff_branch_depth(pid1, pid2); assert_eq!(got, expected, "pid1: {}, pid2: {}", pid1, pid2); } }
rust_cleaned_test_functions.jsonl/110865
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 543 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15850, 28031, 19061, 368, 341, 286, 11506, 35788, 12501, 486, 20599, 921, 286, 1077, 7032, 284, 609, 9640, 310, 320, 15, 65, 15, 15, 15, 15, 11, 220, 15, 65, 15, 16, 15, 15, 11, 220, 15, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_set_blkio_read_iops() { let (tmp, throttle) = setup("test_set_blkio_read_iops", CGROUP_BLKIO_THROTTLE_READ_IOPS); let blkio = BlockIoBuilder::new() .with_read_iops(vec![LinuxThrottleDevice { major: 8, minor: 0, rate: 102400, }]) .build(); Blkio::apply(&tmp, &blkio).expect("apply blkio"); let content = fs::read_to_string(throttle) .unwrap_or_else(|_| panic!("read {} content", CGROUP_BLKIO_THROTTLE_READ_IOPS)); assert_eq!("8:0 102400", content); }
rust_cleaned_test_functions.jsonl/112473
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 336 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2602, 51969, 815, 6443, 5318, 3721, 368, 341, 286, 1077, 320, 5173, 11, 42166, 8, 284, 6505, 445, 1944, 2602, 51969, 815, 6443, 5318, 3721, 497, 6159, 11838, 87634, 3810, 10625, 1285, 14903, 867, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_format() { test_derive! { custom_debug_derive { struct Point { #[debug(format = "{:.02}")] x: f32, y: f32, } } expands to { #[allow(non_upper_case_globals)] const _DERIVE_core_fmt_Debug_FOR_Point: () = { impl ::core::fmt::Debug for Point { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { match self { Point { x: ref __binding_0, y: ref __binding_1, } => { let mut s = f.debug_struct("Point"); s.field("x", &format_args!("{:.02}", __binding_0)); s.field("y", __binding_1); s.finish() } } } } }; } no_build } }
rust_cleaned_test_functions.jsonl/61109
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 679 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8955, 368, 341, 262, 1273, 35345, 533, 0, 341, 286, 2526, 15446, 35345, 533, 341, 310, 2036, 5126, 341, 394, 11506, 8349, 20698, 284, 13868, 16976, 15, 17, 44665, 394, 856, 25, 282, 18, 17, 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...
2
#[test] fn test_estimate_max_chain_count() { let board = [ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 11, 0], [0, 0, 0, 0, 0, 0, 0, 0, 11, 0], [0, 0, 0, 0, 0, 0, 0, 0, 11, 9], ]; let mut evaluate_cache = EvaluateCache::new(); let (max_chain_count, height) = evaluate_cache.estimate_max_chain_count(&mut Simulator::new(), &Board::new(board)); debug_assert_eq!((max_chain_count, height), (1, 1)); let board = [ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 4, 0, 0, 0, 0, 0], [0, 0, 0, 0, 5, 0, 0, 0, 0, 0], [0, 0, 0, 0, 2, 0, 0, 0, 0, 0], [0, 0, 0, 0, 5, 7, 0, 0, 0, 0], [0, 0, 0, 0, 8, 9, 0, 0, 0, 0], [0, 0, 0, 0, 5, 6, 0, 0, 0, 0], [0, 0, 0, 0, 7, 9, 0, 0, 0, 0], [0, 0, 0, 0, 4, 9, 0, 0, 0, 0], [0, 0, 0, 8, 3, 5, 0, 0, 0, 0], [0, 0, 0, 5, 8, 1, 0, 0, 0, 0], [0, 0, 0, 8, 6, 1, 5, 0, 0, 0], [0, 0, 0, 1, 5, 3, 3, 0, 0, 0], [0, 0, 0, 8, 1, 4, 8, 0, 0, 0], [0, 0, 1, 5, 1, 7, 7, 0, 0, 0], ]; let (max_chain_count, height) = evaluate_cache.estimate_max_chain_count(&mut Simulator::new(), &Board::new(board)); debug_assert_eq!((max_chain_count, height), (12, 0)); let board = [ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 2, 1, 0, 0, 0], [0, 0, 0, 0, 0, 4, 7, 0, 0, 0], [0, 0, 0, 0, 0, 8, 4, 0, 0, 0], [0, 0, 0, 0, 0, 9, 3, 0, 0, 0], [0, 0, 0, 0, 0, 6, 3, 0, 0, 0], [0, 0, 0, 0, 0, 6, 2, 0, 0, 0], [0, 0, 0, 0, 8, 6, 2, 0, 0, 0], [0, 0, 0, 0, 8, 9, 6, 0, 0, 0], [0, 0, 0, 0, 7, 8, 8, 0, 0, 0], [0, 0, 0, 0, 8, 4, 4, 0, 0, 0], [0, 0, 0, 6, 1, 3, 2, 4, 0, 0], ]; let (max_chain_count, height) = evaluate_cache.estimate_max_chain_count(&mut Simulator::new(), &Board::new(board)); debug_assert_eq!((max_chain_count, height), (11, 1)); }
rust_cleaned_test_functions.jsonl/24653
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1690 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 78718, 6345, 30583, 3180, 368, 341, 262, 1077, 4479, 284, 2278, 286, 508, 15, 11, 220, 15, 11, 220, 15, 11, 220, 15, 11, 220, 15, 11, 220, 15, 11, 220, 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...
1
#[test] fn test_hma() { let candles = RandomCandles::default(); let src: Vec<ValueType> = candles.take(300).map(|x| x.close).collect(); #[allow(clippy::cast_possible_truncation)] #[allow(clippy::cast_sign_loss)] (2..255).for_each(|length| { let mut wma1 = WMA::new(length, &src[0]).unwrap(); let mut wma2 = WMA::new(length / 2, &src[0]).unwrap(); let mut wma3 = WMA::new((length as ValueType).sqrt() as PeriodType, &src[0]).unwrap(); let mut ma = TestingMethod::new(length, &src[0]).unwrap(); for x in &src { let value1 = ma.next(x); let value2 = wma3.next(&(2. * wma2.next(x) - wma1.next(x))); assert_eq_float(value2, value1); } }); }
rust_cleaned_test_functions.jsonl/121255
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 310 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1523, 1728, 368, 341, 197, 10217, 51205, 284, 10612, 34, 20125, 486, 2258, 1428, 197, 10217, 2286, 25, 11312, 48325, 929, 29, 284, 51205, 40161, 7, 18, 15, 15, 568, 2186, 22428, 87, 91, 856, 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_trigger() { let mut t = Triggers::new(); let a = Position { line: 0, col: 4 }; let b = Position { line: 1, col: 0 }; t.insert((a, b), 0); }
rust_cleaned_test_functions.jsonl/125825
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 100 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 32925, 368, 341, 286, 1077, 5206, 259, 284, 1163, 21385, 486, 931, 1428, 286, 1077, 264, 284, 12380, 314, 1555, 25, 220, 15, 11, 1375, 25, 220, 19, 3634, 286, 1077, 293, 284, 12380, 314, 1555,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_try_from_put_logger() { let (mut sender, receiver) = UnixStream::pair().unwrap(); let mut connection = HttpConnection::new(receiver); let body = "{ \ \"log_path\": \"string\", \ \"level\": \"Warning\", \ \"show_level\": false, \ \"show_log_origin\": false \ }"; sender .write_all(http_request("PUT", "/logger", Some(&body)).as_bytes()) .unwrap(); assert!(connection.try_read().is_ok()); let req = connection.pop_parsed_request().unwrap(); assert!(ParsedRequest::try_from_request(&req).is_ok()); }
rust_cleaned_test_functions.jsonl/106581
{ "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, 53283, 5673, 15557, 27413, 368, 341, 286, 1077, 320, 6984, 4646, 11, 13964, 8, 284, 46995, 3027, 486, 12670, 1005, 15454, 543, 286, 1077, 5206, 3633, 284, 4823, 4526, 486, 931, 78126, 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_get_batch() { const SIZE: &[usize] = &[1, 31, 32, 33, 128, 129]; for s in SIZE { for i in 0..33 { match i { 0..=8 => test_get_batch_helper::<u8>(*s, i), 9..=16 => test_get_batch_helper::<u16>(*s, i), _ => test_get_batch_helper::<u32>(*s, i), } } } }
rust_cleaned_test_functions.jsonl/115742
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 273 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 14534, 368, 341, 286, 733, 25341, 25, 44590, 51878, 60, 284, 44590, 16, 11, 220, 18, 16, 11, 220, 18, 17, 11, 220, 18, 18, 11, 220, 16, 17, 23, 11, 220, 16, 17, 24, 935, 286, 369, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_wiredconn_dhcpcd_installed() { let mut mock = MockSystemChecksImpl::new(); mock_func!(mock, 1, check_networkmanager_running, false); mock_func!(mock, 1, check_netctl_running, false); mock_func!(mock, 1, check_netctl_installed, false); mock_func!(mock, 1, check_networkmanager_installed, false); mock_func!(mock, 1, check_dhclient_installed, false); mock_func!(mock, 1, check_dhcpcd_installed, true); assert_eq!( WiredConnectionType::Dhcpcd, choose_best_from_system_impl(&mock, "fake_name") ); }
rust_cleaned_test_functions.jsonl/86488
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 285 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1670, 2690, 5148, 814, 38052, 3992, 67, 79065, 368, 341, 286, 1077, 5206, 7860, 284, 14563, 2320, 49820, 9673, 486, 931, 543, 286, 7860, 9596, 10297, 16712, 11, 220, 16, 11, 1779, 20966, 13297, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_vec3a_hmin_hmax() { let a = vec3a(-1.0, 2.0, -3.0); assert_eq!(-3.0, a.min_element()); assert_eq!(2.0, a.max_element()); }
rust_cleaned_test_functions.jsonl/23487
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 89 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13251, 18, 64, 1523, 1065, 1523, 2810, 368, 341, 262, 1077, 264, 284, 7486, 18, 64, 4080, 16, 13, 15, 11, 220, 17, 13, 15, 11, 481, 18, 13, 15, 317, 262, 2060, 10714, 0, 4080, 18, 13, 15...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_remove_last_value_from_implicit() { given(r#" [a] b = 1"# ).running(|root| { let a = root.entry("a"); assert!(a.is_table()); let a = as_table!(a); a.set_implicit(true); let value = a.remove("b"); assert!(value.is_some()); let value = value.unwrap(); assert!(value.is_value()); let value = value.as_value().unwrap(); assert_eq!(value.as_integer(), Some(1)); }).produces(r#""#); }
rust_cleaned_test_functions.jsonl/36883
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 265 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 18193, 12195, 3142, 5673, 62, 30940, 368, 341, 262, 2661, 2601, 2, 698, 286, 508, 64, 921, 286, 293, 284, 220, 16, 1, 4956, 262, 7457, 27173, 22428, 2888, 91, 341, 286, 1077, 264, 284, 3704, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_message_type_default_application_version() { define_fixt_message!(TestMessage: b"9999" => { REQUIRED, text: Text [FIX50SP1..], }); define_dictionary!(Logon, Reject, TestMessage,); //Connect. let (mut test_server, mut client, connection) = TestStream::setup_test_server(build_dictionary()); //Logon. let mut logon_message = new_logon_message(); logon_message.default_appl_ver_id = MessageVersion::FIX50; client.send_message_box_with_message_version( connection, MessageVersion::FIX50SP2, Box::new(logon_message), ); let message = test_server.recv_message::<Logon>(); assert_eq!(message.msg_seq_num, 1); let mut response_message = new_fixt_message!(Logon); response_message.encrypt_method = message.encrypt_method; response_message.heart_bt_int = message.heart_bt_int; response_message.default_appl_ver_id = message.default_appl_ver_id; let mut msg_type_grp = MsgTypeGrp::new(); msg_type_grp.ref_msg_type = TestMessage::msg_type().to_vec(); msg_type_grp.ref_appl_ver_id = Some(MessageVersion::FIX50SP1); msg_type_grp.msg_direction = MsgDirection::Send; msg_type_grp.default_ver_indicator = true; response_message.no_msg_types.push(Box::new(msg_type_grp)); test_server.send_message_with_ver( FIXVersion::FIXT_1_1, MessageVersion::FIX50SP2, response_message, ); engine_poll_event!(client,EngineEvent::SessionEstablished(_) => {}); let message = engine_poll_message!(client, connection, Logon); assert_eq!(message.msg_seq_num, 1); //Make sure specifying a message type specific default application version overrides the //default message version. { //Send TestMessage text field. let mut message = new_fixt_message!(TestMessage); message.msg_seq_num = 2; message.text = b"test".to_vec(); test_server.send_message_with_ver(FIXVersion::FIXT_1_1, MessageVersion::FIX50SP1, message); //Confirm Engine accepted message correctly. let message = engine_poll_message!(client, connection, TestMessage); assert_eq!( message.meta.unwrap().message_version, MessageVersion::FIX50SP1 ); //Set by parser what it parsed message as. assert_eq!(message.text, b"test"); } //Make sure ApplVerID overrides the message type specific default application version. { //Send TestMessage with explicit ApplVerID < FIX50 and without text field. let mut message = new_fixt_message!(TestMessage); message.msg_seq_num = 3; message.appl_ver_id = Some(MessageVersion::FIX40); test_server.send_message_with_ver( FIXVersion::FIXT_1_1, message.appl_ver_id.unwrap(), message, ); //Confirm Engine accepted message correctly. let message = engine_poll_message!(client, connection, TestMessage); assert_eq!(message.meta.unwrap().message_version, MessageVersion::FIX40); assert_eq!(message.text.len(), 0); } }
rust_cleaned_test_functions.jsonl/30
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1258 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6462, 1819, 9993, 38721, 9438, 368, 341, 262, 6979, 36060, 83, 6462, 10297, 2271, 2052, 25, 293, 1, 24, 24, 24, 24, 1, 589, 341, 286, 66577, 11, 1467, 25, 2918, 508, 39690, 20, 15, 4592, 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_check_slots_are_valid_vote_empty_slot_hashes() { let vote_state = VoteState::default(); let vote = Vote::new(vec![0], Hash::default()); assert_eq!( vote_state.check_slots_are_valid(&vote, &vec![]), Err(VoteError::VoteTooOld) ); }
rust_cleaned_test_functions.jsonl/69974
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 155 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 7200, 54161, 56855, 8337, 54360, 15124, 27563, 91616, 368, 341, 286, 1077, 6910, 4387, 284, 34034, 1397, 486, 2258, 1428, 286, 1077, 6910, 284, 34034, 486, 931, 25592, 20703, 15, 1125, 6531, 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_scalar_division() { let c = 61.891390; let p = Point2::new(89.0, 936.5); let expected = Point2::new(p.x / c, p.y / c); let result = p / c; assert_eq!(result, expected); }
rust_cleaned_test_functions.jsonl/4541
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 128 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 41652, 16237, 1816, 368, 341, 286, 1077, 272, 284, 220, 21, 16, 13, 23, 24, 16, 18, 24, 15, 280, 286, 1077, 281, 284, 5126, 17, 486, 931, 7, 23, 24, 13, 15, 11, 220, 24, 18, 21, 13, 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_endian() { disasm!( "entrypoint: be16 r1 be32 r1 be64 r1 le16 r1 le32 r1 le64 r1 " ); }
rust_cleaned_test_functions.jsonl/68770
{ "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, 87193, 368, 341, 262, 827, 10530, 33673, 286, 330, 4085, 2768, 510, 262, 387, 16, 21, 435, 16, 198, 262, 387, 18, 17, 435, 16, 198, 262, 387, 21, 19, 435, 16, 198, 262, 512, 16, 21, 435, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_try_from_record_for_program_with_invalid_record() { let record = Record::new( record::Kind::Comment, record::Value::String(String::from("noodles-sam")), ); assert_eq!( Program::try_from(record), Err(TryFromRecordError::InvalidRecord) ); }
rust_cleaned_test_functions.jsonl/16112
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 172 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 53283, 5673, 14192, 5478, 25096, 6615, 31433, 14192, 368, 341, 286, 1077, 3255, 284, 13583, 486, 931, 1006, 310, 3255, 486, 10629, 486, 10677, 345, 310, 3255, 486, 1130, 486, 703, 2242, 486, 1499,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_unknown_context_specific() { let bytes = hex!("80 01 00"); let res = parse_ber(&bytes).expect("parsing failed"); assert!(res.0.is_empty()); assert_eq!( res.1, BerObject { header: Header::new(Class::ContextSpecific, false, Tag(0), 1) .with_raw_tag(Some(&[0x80])), content: BerObjectContent::Unknown(Class::ContextSpecific, Tag(0x0), &bytes[2..]), } ); }
rust_cleaned_test_functions.jsonl/67465
{ "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, 57507, 8467, 56592, 368, 341, 262, 1077, 5820, 284, 12371, 17223, 23, 15, 220, 15, 16, 220, 15, 15, 797, 262, 1077, 592, 284, 4715, 88165, 2099, 9651, 568, 17119, 445, 79, 28598, 4641, 797, 26...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_query_shares() { let mut deps = mock_dependencies(&[]); mock_instantiate(deps.as_mut()); let voter_0_addr_raw = CanonicalAddr::from(vec![ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ]); let voter_1_addr_raw = CanonicalAddr::from(vec![ 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ]); let voter_2_addr_raw = CanonicalAddr::from(vec![ 1, 1, 1, 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, ]); let voter_0 = deps .api .addr_humanize(&voter_0_addr_raw) .unwrap() .to_string(); let voter_1 = deps .api .addr_humanize(&voter_1_addr_raw) .unwrap() .to_string(); let voter_2 = deps .api .addr_humanize(&voter_2_addr_raw) .unwrap() .to_string(); bank_store(&mut deps.storage) .save( voter_0_addr_raw.as_slice(), &TokenManager { share: Uint128::new(11u128), locked_balance: vec![], participated_polls: vec![], }, ) .unwrap(); bank_store(&mut deps.storage) .save( voter_1_addr_raw.as_slice(), &TokenManager { share: Uint128::new(22u128), locked_balance: vec![], participated_polls: vec![], }, ) .unwrap(); bank_store(&mut deps.storage) .save( voter_2_addr_raw.as_slice(), &TokenManager { share: Uint128::new(33u128), locked_balance: vec![], participated_polls: vec![], }, ) .unwrap(); // query everything Asc let res = query( deps.as_ref(), mock_env(), QueryMsg::Shares { start_after: None, limit: None, order_by: Some(OrderBy::Asc), }, ) .unwrap(); let response: SharesResponse = from_binary(&res).unwrap(); assert_eq!( response.stakers, vec![ SharesResponseItem { staker: voter_0.clone(), share: Uint128::new(11u128), }, SharesResponseItem { staker: voter_1.clone(), share: Uint128::new(22u128), }, SharesResponseItem { staker: voter_2.clone(), share: Uint128::new(33u128), }, ] ); // query everything Desc let res = query( deps.as_ref(), mock_env(), QueryMsg::Shares { start_after: None, limit: None, order_by: Some(OrderBy::Desc), }, ) .unwrap(); let response: SharesResponse = from_binary(&res).unwrap(); assert_eq!( response.stakers, vec![ SharesResponseItem { staker: voter_2.clone(), share: Uint128::new(33u128), }, SharesResponseItem { staker: voter_1.clone(), share: Uint128::new(22u128), }, SharesResponseItem { staker: voter_0.clone(), share: Uint128::new(11u128), }, ] ); // limit 2 let res = query( deps.as_ref(), mock_env(), QueryMsg::Shares { start_after: None, limit: Some(2u32), order_by: Some(OrderBy::Asc), }, ) .unwrap(); let response: SharesResponse = from_binary(&res).unwrap(); assert_eq!( response.stakers, vec![ SharesResponseItem { staker: voter_0, share: Uint128::new(11u128), }, SharesResponseItem { staker: voter_1.clone(), share: Uint128::new(22u128), }, ] ); // start after staker0001 and limit 1 let res = query( deps.as_ref(), mock_env(), QueryMsg::Shares { start_after: Some(voter_1), limit: Some(1u32), order_by: Some(OrderBy::Asc), }, ) .unwrap(); let response: SharesResponse = from_binary(&res).unwrap(); assert_eq!( response.stakers, vec![SharesResponseItem { staker: voter_2, share: Uint128::new(33u128), },] ); }
rust_cleaned_test_functions.jsonl/78578
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2779 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5738, 3712, 5403, 368, 341, 262, 1077, 5206, 48178, 284, 7860, 71841, 2099, 56703, 262, 7860, 1243, 42251, 12797, 1690, 5357, 29523, 5231, 262, 1077, 25323, 62, 15, 7387, 16067, 284, 95177, 13986, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_value() { let (pattern, output) = get_patterns_and_output( "acedgfb cdfbe gcdfa fbcad dab cefabd cdfgeb eafb cagedb ab | cdfeb fcadb cdfeb cdbaf", ); let (_, table) = decode_pattern(&pattern[0]); assert_eq!(get_value(&output[0], &table), 5353); }
rust_cleaned_test_functions.jsonl/2853
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 163 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 3142, 368, 341, 286, 1077, 320, 14339, 11, 2550, 8, 284, 633, 64923, 8378, 7645, 1006, 310, 330, 4435, 70, 10798, 272, 2940, 1371, 22122, 97549, 282, 8904, 329, 82768, 272, 823, 85920, 272...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_class_method_does_not_exist() -> oso::Result<()> { common::setup(); let mut oso = OsoTest::new(); #[derive(PolarClass)] struct Foo; impl Foo { fn a() -> i64 { 1 } } let foo_class = Foo::get_polar_class_builder() .add_class_method("a", Foo::a) .build(); oso.oso.register_class(foo_class)?; oso.load_str("getmethod_b(val) if val = Foo.b();"); let mut query = oso.oso.query_rule("getmethod_b", (1,))?; let error = query.next().unwrap().unwrap_err(); if let OsoError::Polar(PolarError { kind: PolarErrorKind::Runtime(PolarRuntimeError::Application { msg, .. }), .. }) = &error { assert_eq!(msg, "Class method b not found on type Foo."); } else { panic!("Error {} was not the expected type", error); } Ok(()) }
rust_cleaned_test_functions.jsonl/5005
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 403 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4790, 9032, 96374, 7913, 35906, 368, 1464, 297, 704, 486, 2077, 71698, 341, 262, 4185, 486, 15188, 1428, 262, 1077, 5206, 297, 704, 284, 506, 704, 2271, 486, 931, 1428, 262, 11506, 27098, 5304, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_write_vcf_record() -> Result<(), Box<dyn std::error::Error>> { let header = vcf::Header::builder() .add_contig(vcf::header::Contig::new("sq0")) .build(); let string_maps = StringMaps::from(&header); let record = vcf::Record::builder() .set_chromosome("sq0".parse()?) .set_position(vcf::record::Position::try_from(1)?) .set_reference_bases("A".parse()?) .build()?; let mut buf = Vec::new(); write_vcf_record(&mut buf, &header, &string_maps, &record)?; let expected = [ 0x1c, 0x00, 0x00, 0x00, // l_shared = 28 0x00, 0x00, 0x00, 0x00, // l_indiv = 0 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // rlen = 1 0x01, 0x00, 0x80, 0x7f, // qual = Float::Missing 0x00, 0x00, // n_info = 0 0x01, 0x00, // n_allele = 1 0x00, // n_fmt = 0 0x00, 0x00, 0x00, // n_sample = 0 0x07, // id = None 0x17, b'A', 0x00, // filter = [] ]; assert_eq!(buf, expected); Ok(()) }
rust_cleaned_test_functions.jsonl/107243
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 699 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9165, 2273, 9792, 14192, 368, 1464, 5714, 68843, 8261, 92846, 1460, 486, 841, 486, 1454, 2452, 341, 286, 1077, 4247, 284, 348, 9792, 486, 4047, 486, 17850, 741, 310, 659, 718, 10260, 343, 3747, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_struct_count_literal() { let input = b"\x12\x34"; let res = S3::parse(input); assert_eq!( res, Ok(( &input[2..], S3 { b: vec![NewType(0x12), NewType(0x34)] } )) ); }
rust_cleaned_test_functions.jsonl/18970
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 178 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15126, 3180, 34100, 368, 341, 262, 1077, 1946, 284, 293, 11934, 87, 16, 17, 3462, 18, 19, 876, 262, 1077, 592, 284, 328, 18, 486, 6400, 5384, 317, 262, 2060, 10714, 33673, 286, 592, 345, 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_async_io_cannot_destroy_when_persist_snapshot() { let mut cluster = new_node_cluster(0, 3); configure_for_snapshot(&mut cluster); let pd_client = Arc::clone(&cluster.pd_client); pd_client.disable_default_operator(); cluster.run(); let region = pd_client.get_region(b"k1").unwrap(); let peer_1 = find_peer(&region, 1).cloned().unwrap(); let peer_3 = find_peer(&region, 3).cloned().unwrap(); cluster.must_transfer_leader(region.get_id(), peer_1); cluster.must_put(b"k", b"v"); // Make sure peer 3 exists must_get_equal(&cluster.get_engine(3), b"k", b"v"); let dropped_msgs = Arc::new(Mutex::new(Vec::new())); let send_filter = Box::new( RegionPacketFilter::new(region.get_id(), 3) .direction(Direction::Send) .msg_type(MessageType::MsgAppendResponse) .reserve_dropped(Arc::clone(&dropped_msgs)), ); cluster.sim.wl().add_send_filter(3, send_filter); cluster.must_put(b"k1", b"v1"); must_get_equal(&cluster.get_engine(3), b"k1", b"v1"); cluster.sim.wl().clear_send_filters(3); cluster.add_send_filter(IsolationFilterFactory::new(3)); for i in 2..10 { cluster.must_put(format!("k{}", i).as_bytes(), b"v1"); } let raft_before_save_kv_on_store_3_fp = "raft_before_save_kv_on_store_3"; fail::cfg(raft_before_save_kv_on_store_3_fp, "pause").unwrap(); let (notify_tx, notify_rx) = mpsc::channel(); cluster.sim.wl().add_recv_filter( 3, Box::new(MessageTypeNotifier::new( MessageType::MsgSnapshot, notify_tx, Arc::new(AtomicBool::new(true)), )), ); cluster.clear_send_filters(); // Wait for leader sending snapshot to peer 3 notify_rx.recv_timeout(Duration::from_secs(5)).unwrap(); // Wait for peer 3 handling snapshot sleep_ms(100); pd_client.must_remove_peer(region.get_id(), peer_3); // Trigger leader sending tombstone msg to peer 3 let router = cluster.sim.wl().get_router(1).unwrap(); for raft_msg in dropped_msgs.lock().unwrap().drain(..).rev() { if raft_msg.get_to_peer().get_store_id() == 1 { router.send_raft_message(raft_msg).unwrap(); break; } } // Wait for peer 3 handling tombstone msg sleep_ms(100); // Peer 3 should not be destroyed because its snapshot is persisting must_get_equal(&cluster.get_engine(3), b"k1", b"v1"); fail::remove(raft_before_save_kv_on_store_3_fp); must_get_none(&cluster.get_engine(3), b"k1"); }
rust_cleaned_test_functions.jsonl/125820
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1131 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 28346, 16939, 666, 3401, 18066, 47636, 620, 4975, 53265, 368, 341, 262, 1077, 5206, 10652, 284, 501, 5084, 28441, 7, 15, 11, 220, 18, 317, 262, 14411, 5478, 53265, 2099, 6984, 10652, 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...
4
#[test] fn test_arg_parser_defaults() -> clap::Result<()> { let app = parse_args(); let config = Configuration::from(app.get_matches_from_safe(vec!["test", "-"])?); assert_eq!(config.recursive, false); assert_eq!(config.compact_output, !is_tty_stdout()); assert_eq!(config.paths.len(), 0); assert_eq!(config.use_stdin, true); Ok(()) }
rust_cleaned_test_functions.jsonl/89796
{ "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, 6057, 18517, 42290, 368, 1464, 89577, 486, 2077, 71698, 341, 286, 1077, 906, 284, 4715, 8384, 543, 286, 1077, 2193, 284, 12221, 486, 1499, 11462, 670, 38344, 5673, 34067, 25592, 0, 1183, 1944, 497...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_method_returning_struct() { test_file! { #[diplomat::bridge] mod ffi { #[diplomat::opaque] struct MyStruct(UnknownType); struct NonOpaqueStruct { a: u16, b: u8, c: u32, } impl MyStruct { pub fn get_non_opaque(&self) -> NonOpaqueStruct { unimplemented!() } } } } }
rust_cleaned_test_functions.jsonl/42851
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 386 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9032, 12511, 287, 15126, 368, 341, 286, 1273, 2458, 0, 341, 310, 11506, 8579, 500, 80768, 486, 13709, 921, 310, 1463, 76956, 341, 394, 11506, 8579, 500, 80768, 486, 95480, 921, 394, 2036, 3017, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_subscribe_event() { let initial_state = TestState { counter: -2 }; let store = StoreRef::new(TestReducer, initial_state); let callback_test: Rc<RefCell<Option<TestEvent>>> = Rc::new(RefCell::new(None)); let callback_test_copy = callback_test.clone(); let callback_zero_subscription: Callback<TestState, TestEvent> = Callback::new(move |_: Rc<TestState>, event| { assert_eq!(Some(TestEvent::CounterIsZero), event); *callback_test_copy.borrow_mut() = Some(TestEvent::CounterIsZero); }); store.subscribe_event(&callback_zero_subscription, TestEvent::CounterIsZero); store.dispatch(TestAction::Increment); assert_eq!(None, *callback_test.borrow()); store.dispatch(TestAction::Increment); assert_eq!(Some(TestEvent::CounterIsZero), *callback_test.borrow()); }
rust_cleaned_test_functions.jsonl/69277
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 387 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 88935, 6748, 368, 341, 286, 1077, 2856, 4387, 284, 3393, 1397, 314, 5546, 25, 481, 17, 2605, 286, 1077, 3553, 284, 9129, 3945, 486, 931, 31159, 20874, 11, 2856, 4387, 626, 286, 1077, 4822, 4452,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_commit_err() { test_commit_err_imp(b"k", b"v"); let long_value = "v".repeat(SHORT_VALUE_MAX_LEN + 1).into_bytes(); test_commit_err_imp(b"k2", &long_value); }
rust_cleaned_test_functions.jsonl/47473
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 108 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 36346, 9266, 368, 341, 286, 1273, 36346, 9266, 36788, 1883, 62911, 497, 293, 1, 85, 3071, 286, 1077, 1293, 3142, 284, 330, 85, 3263, 30624, 3759, 70702, 7476, 6806, 15536, 488, 220, 16, 568, 181...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_iter_size_hints() { let mut xs = [1, 2, 5, 10, 11]; assert_eq!(xs.iter().size_hint(), (5, Some(5))); assert_eq!(xs.iter_mut().size_hint(), (5, Some(5))); }
rust_cleaned_test_functions.jsonl/12884
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 98 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11723, 2368, 1523, 21042, 368, 341, 262, 1077, 5206, 11943, 284, 508, 16, 11, 220, 17, 11, 220, 20, 11, 220, 16, 15, 11, 220, 16, 16, 935, 262, 2060, 10714, 10297, 18561, 19471, 1005, 2141, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_evaluate_search_result_score() { let p1 = evaluate_search_result_score( simulator::calculate_game_score(10), 100.0, 1, DEFAULT_FATAL_FIRE_MAX_CHAIN_COUNT, ); let p2 = evaluate_search_result_score( simulator::calculate_game_score(9), 6727592.0, 1, DEFAULT_FATAL_FIRE_MAX_CHAIN_COUNT, ); assert!(p1 >= p2); }
rust_cleaned_test_functions.jsonl/24650
{ "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, 2204, 19642, 10716, 5287, 10405, 368, 341, 262, 1077, 281, 16, 284, 15442, 10716, 5287, 10405, 1006, 286, 41891, 486, 35597, 18547, 10405, 7, 16, 15, 1326, 286, 220, 16, 15, 15, 13, 15, 345, 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_get_file_path_from_git_file_meta_line_rename_containing_spaces() { assert_eq!( parse_file_meta_line("rename from with space/file1.el", true, None), ("with space/file1.el".to_string(), FileEvent::Rename) ); }
rust_cleaned_test_functions.jsonl/108158
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 132 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 2458, 2638, 5673, 68801, 2458, 13381, 6528, 79399, 10260, 2056, 67883, 368, 341, 286, 2060, 10714, 33673, 310, 4715, 2458, 13381, 6528, 445, 51058, 504, 448, 3550, 23903, 16, 15851, 497, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_validate_checksum() -> crate::Result<()> { let index_path = tempfile::tempdir().expect("dir"); let mut builder = Schema::builder(); let body = builder.add_text_field("body", TEXT | STORED); let schema = builder.build(); let index = Index::create_in_dir(&index_path, schema)?; let mut writer = index.writer(50_000_000)?; for _ in 0..5000 { writer.add_document(doc!(body => "foo")); writer.add_document(doc!(body => "boo")); } writer.commit()?; assert!(index.validate_checksum()?.is_empty()); // delete few docs writer.delete_term(Term::from_field_text(body, "foo")); writer.commit()?; let segment_ids = index.searchable_segment_ids()?; let _ = futures::executor::block_on(writer.merge(&segment_ids)); assert!(index.validate_checksum()?.is_empty()); Ok(()) }
rust_cleaned_test_functions.jsonl/35908
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 427 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 42681, 64038, 368, 1464, 17717, 486, 2077, 71698, 341, 286, 1077, 1922, 2638, 284, 54819, 486, 3888, 3741, 1005, 17119, 445, 3741, 797, 286, 1077, 5206, 7363, 284, 12539, 486, 17850, 543, 286, 107...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
9
#[test] fn test_for_breaks() { for _i in 0..10 { break; } for i in 0..10 { if i == 4 { break; } } }
rust_cleaned_test_functions.jsonl/76111
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 100 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5478, 39494, 82, 368, 341, 262, 369, 716, 72, 304, 220, 15, 496, 16, 15, 341, 286, 1438, 280, 262, 555, 262, 369, 600, 304, 220, 15, 496, 16, 15, 341, 286, 421, 600, 621, 220, 19, 341, 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 ]
4
#[test] fn test_384() { let obj = Solution::new(vec![1, 2, 3]); assert_eq!(obj.reset(), vec![1, 2, 3]); }
rust_cleaned_test_functions.jsonl/50366
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 81 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 62, 18, 23, 19, 368, 341, 286, 1077, 2839, 284, 12478, 486, 931, 25592, 20703, 16, 11, 220, 17, 11, 220, 18, 2558, 1789, 286, 2060, 10714, 10297, 2295, 13857, 1507, 7486, 20703, 16, 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
#[test] fn test_peer_fuzzers() { let mut value_gen = ValueGenerator::deterministic(); for _ in 0..50 { let corpus = generate_corpus(&mut value_gen); fuzz(&corpus); } }
rust_cleaned_test_functions.jsonl/21417
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 93 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 45159, 761, 8889, 388, 368, 341, 262, 1077, 5206, 897, 16322, 284, 5162, 12561, 486, 67, 16483, 4532, 543, 262, 369, 716, 304, 220, 15, 496, 20, 15, 341, 286, 1077, 42094, 284, 6923, 94226, 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 ]
2
#[test] fn test_parse_cfi_instruction_unknown_instruction() { let expected_rest = [1, 2, 3, 4]; let unknown_instr = constants::DwCfa(0b0011_1111); let section = Section::with_endian(Endian::Little) .D8(unknown_instr.0) .append_bytes(&expected_rest); let contents = section.get_contents().unwrap(); let input = &mut EndianSlice::new(&contents, LittleEndian); assert_eq!( parse_cfi_instruction(input, 8), Err(Error::UnknownCallFrameInstruction(unknown_instr)) ); }
rust_cleaned_test_functions.jsonl/9340
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 271 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 666, 9983, 54923, 57507, 54923, 368, 341, 286, 1077, 3601, 32231, 284, 508, 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 935, 286, 1077, 9788, 62574, 284, 18021, 486, 35, 86, 34, 3632, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_env_var_overrides_git_config() { // simple string let git_config_contents = b" [delta] plus-style = blue "; let git_config_path = "delta__test_simple_string_env_var_overrides_git_config.gitconfig"; let opt = integration_test_utils::make_options_from_args_and_git_config( &[], Some(git_config_contents), Some(git_config_path), ); assert_eq!(opt.plus_style, "blue"); env::set_var("GIT_CONFIG_PARAMETERS", "'delta.plus-style=green'"); let opt = integration_test_utils::make_options_from_args_and_git_config_honoring_env_var( &[], Some(git_config_contents), Some(git_config_path), ); assert_eq!(opt.plus_style, "green"); remove_file(git_config_path).unwrap(); // complex string let git_config_contents = br##" [delta] minus-style = red bold ul "#ffeeee" "##; let git_config_path = "delta__test_complex_string_env_var_overrides_git_config.gitconfig"; let opt = integration_test_utils::make_options_from_args_and_git_config( &[], Some(git_config_contents), Some(git_config_path), ); assert_eq!(opt.minus_style, r##"red bold ul #ffeeee"##); env::set_var( "GIT_CONFIG_PARAMETERS", r##"'delta.minus-style=magenta italic ol "#aabbcc"'"##, ); let opt = integration_test_utils::make_options_from_args_and_git_config_honoring_env_var( &[], Some(git_config_contents), Some(git_config_path), ); assert_eq!(opt.minus_style, r##"magenta italic ol "#aabbcc""##,); remove_file(git_config_path).unwrap(); // option string let git_config_contents = b" [delta] plus-style = blue "; let git_config_path = "delta__test_option_string_env_var_overrides_git_config.gitconfig"; let opt = integration_test_utils::make_options_from_args_and_git_config( &[], Some(git_config_contents), Some(git_config_path), ); assert_eq!(opt.plus_style, "blue"); env::set_var("GIT_CONFIG_PARAMETERS", "'delta.plus-style=green'"); let opt = integration_test_utils::make_options_from_args_and_git_config_honoring_env_var( &[], Some(git_config_contents), Some(git_config_path), ); assert_eq!(opt.plus_style, "green"); remove_file(git_config_path).unwrap(); // bool let git_config_contents = b" [delta] side-by-side = true "; let git_config_path = "delta__test_bool_env_var_overrides_git_config.gitconfig"; let opt = integration_test_utils::make_options_from_args_and_git_config( &[], Some(git_config_contents), Some(git_config_path), ); assert_eq!(opt.side_by_side, true); env::set_var("GIT_CONFIG_PARAMETERS", "'delta.side-by-side=false'"); let opt = integration_test_utils::make_options_from_args_and_git_config_honoring_env_var( &[], Some(git_config_contents), Some(git_config_path), ); assert_eq!(opt.side_by_side, false); remove_file(git_config_path).unwrap(); // int let git_config_contents = b" [delta] max-line-length = 1 "; let git_config_path = "delta__test_int_env_var_overrides_git_config.gitconfig"; let opt = integration_test_utils::make_options_from_args_and_git_config( &[], Some(git_config_contents), Some(git_config_path), ); assert_eq!(opt.max_line_length, 1); env::set_var("GIT_CONFIG_PARAMETERS", "'delta.max-line-length=2'"); let opt = integration_test_utils::make_options_from_args_and_git_config_honoring_env_var( &[], Some(git_config_contents), Some(git_config_path), ); assert_eq!(opt.max_line_length, 2); remove_file(git_config_path).unwrap(); // float let git_config_contents = b" [delta] max-line-distance = 0.6 "; let git_config_path = "delta__test_float_env_var_overrides_git_config.gitconfig"; let opt = integration_test_utils::make_options_from_args_and_git_config_honoring_env_var( &[], Some(git_config_contents), Some(git_config_path), ); assert_eq!(opt.max_line_distance, 0.6); env::set_var("GIT_CONFIG_PARAMETERS", "'delta.max-line-distance=0.7'"); let opt = integration_test_utils::make_options_from_args_and_git_config_honoring_env_var( &[], Some(git_config_contents), Some(git_config_path), ); assert_eq!(opt.max_line_distance, 0.7); remove_file(git_config_path).unwrap(); }
rust_cleaned_test_functions.jsonl/120497
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2497 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15879, 4612, 15431, 18245, 68801, 5332, 368, 341, 1789, 286, 442, 4285, 914, 198, 286, 1077, 16345, 5332, 16682, 284, 293, 698, 58, 20255, 921, 262, 5519, 11297, 284, 6303, 198, 876, 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_cases() { let height = vec![1, 8, 6, 2, 5, 4, 8, 3, 7]; assert_eq!(max_area(height), 49); let height = vec![1, 1]; assert_eq!(max_area(height), 1); let height = vec![1, 1, 1, 1, 2, 2, 1, 1, 1]; assert_eq!(max_area(height), 8); }
rust_cleaned_test_functions.jsonl/31976
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 167 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 41427, 368, 341, 286, 1077, 2608, 284, 7486, 20703, 16, 11, 220, 23, 11, 220, 21, 11, 220, 17, 11, 220, 20, 11, 220, 19, 11, 220, 23, 11, 220, 18, 11, 220, 22, 935, 286, 2060, 10714, 102...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_nonstandard_collection_types() { assert_round_trip(NonstandardCollectionTypes { defaultset: make_btreeset(), btreeset: make_btreeset(), hashset: make_hashset(), indexset_a: make_indexset(), indexset_b: make_indexset(), indexset_c: IndexSet::new(), defaultmap: make_btreemap(), btreemap: make_btreemap(), hashmap: make_hashmap(), indexmap_a: make_indexmap(), indexmap_b: make_indexmap(), indexmap_c: IndexMap::new(), }); }
rust_cleaned_test_functions.jsonl/112105
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 258 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21637, 20270, 25019, 9763, 368, 341, 262, 2060, 29896, 63883, 7, 8121, 20270, 6482, 4173, 341, 286, 1638, 746, 25, 1281, 48626, 7858, 295, 3148, 286, 19592, 7858, 295, 25, 1281, 48626, 7858, 295, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_overflow() { use sourcemap::internals::parse_vlq_segment; use sourcemap::Error; match parse_vlq_segment("00000000000000") { Err(Error::VlqOverflow) => {}, e => { panic!("Unexpeted result: {:?}", e); } } }
rust_cleaned_test_functions.jsonl/4081
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 119 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 79073, 368, 341, 262, 990, 20282, 66, 42040, 486, 55444, 1127, 486, 6400, 2273, 75, 80, 28061, 280, 262, 990, 20282, 66, 42040, 486, 1454, 280, 262, 2432, 4715, 2273, 75, 80, 28061, 445, 15, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_from_f64() { let vals = vec![ ("1.0", 1.0f64), ("0.5", 0.5), ("50", 50.), ("50000", 50000.), ("1e-3", 0.001), ("0.25", 0.25), ("12.34", 12.34), ("0.15625", 5.0 * 0.03125), ("0.3333333333333333", 1.0 / 3.0), ("3.141592653589793", ::std::f64::consts::PI), ("31415.92653589793", ::std::f64::consts::PI * 10000.0f64), ("94247.77960769380", ::std::f64::consts::PI * 30000.0f64), ]; for (s, n) in vals { let expected = BigDecimal::from_str(s).unwrap(); let value = BigDecimal::from_f64(n).unwrap(); assert_eq!(expected, value); } }
rust_cleaned_test_functions.jsonl/75810
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 490 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5673, 761, 21, 19, 368, 341, 286, 1077, 28356, 284, 7486, 90515, 310, 3489, 16, 13, 15, 497, 220, 16, 13, 15, 69, 21, 19, 1326, 310, 3489, 15, 13, 20, 497, 220, 15, 13, 20, 1326, 310, 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...
2
#[test] fn test_contains_only_supported_protocols() { use super::contains_only_supported_protocols; assert_eq!(false, contains_only_supported_protocols("")); assert_eq!(true, contains_only_supported_protocols("Cons=")); assert_eq!(true, contains_only_supported_protocols("Cons=1")); assert_eq!(false, contains_only_supported_protocols("Cons=0")); assert_eq!(false, contains_only_supported_protocols("Cons=0-1")); assert_eq!(false, contains_only_supported_protocols("Cons=5")); assert_eq!(false, contains_only_supported_protocols("Cons=1-5")); assert_eq!(false, contains_only_supported_protocols("Cons=1,5")); assert_eq!(false, contains_only_supported_protocols("Cons=5,6")); assert_eq!(false, contains_only_supported_protocols("Cons=1,5,6")); assert_eq!(true, contains_only_supported_protocols("Cons=1,2")); assert_eq!(true, contains_only_supported_protocols("Cons=1-2")); }
rust_cleaned_test_functions.jsonl/15613
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 424 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 63598, 18410, 57885, 22357, 22018, 368, 341, 286, 990, 2256, 486, 13372, 18410, 57885, 22357, 22018, 401, 286, 2060, 10714, 10297, 3849, 11, 5610, 18410, 57885, 22357, 22018, 89744, 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
#[test] fn test_f32_params() { test_type( "REAL", &[ (Some(f32::INFINITY), "'infinity'"), (Some(f32::NEG_INFINITY), "'-infinity'"), (Some(1000.55), "1000.55"), (None, "NULL"), ], ); }
rust_cleaned_test_functions.jsonl/120848
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 166 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 761, 18, 17, 6745, 368, 341, 262, 1273, 1819, 1006, 286, 330, 24895, 756, 286, 609, 9640, 310, 320, 8373, 955, 18, 17, 486, 687, 55990, 701, 7178, 80016, 6, 4461, 310, 320, 8373, 955, 18, 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_verify() { let y = [0; 33]; let pi = [0]; let alpha = [0, 0, 0]; assert_eq!(DummyVRF.verify(&y, &pi, &alpha).unwrap(), vec![]); }
rust_cleaned_test_functions.jsonl/120143
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 107 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 35638, 368, 341, 286, 1077, 379, 284, 508, 15, 26, 220, 18, 18, 935, 286, 1077, 8938, 284, 508, 15, 935, 286, 1077, 8287, 284, 508, 15, 11, 220, 15, 11, 220, 15, 4821, 286, 2060, 10714, 10...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_proof_success() -> Result<(), HwError> { let value = BigUint::from_u32(402).unwrap(); let threshold = BigUint::from_u32(378).unwrap(); assert_eq!(true, prove_and_verify(4, 32, &value, &threshold).is_ok()); Ok(()) }
rust_cleaned_test_functions.jsonl/32787
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 130 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 86757, 18632, 368, 1464, 5714, 68843, 472, 86, 1454, 29, 341, 286, 1077, 897, 284, 6164, 21570, 486, 1499, 7300, 18, 17, 7, 19, 15, 17, 568, 15454, 543, 286, 1077, 12171, 284, 6164, 21570, 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_varfilter_enum() { let pass = VarFilter::Pass; let dp = VarFilter::Depth; let dn = VarFilter::Density; let sb = VarFilter::StrandBias; let mut f1 = VarFilter::Pass; assert!(!f1.has_filter(dp)); f1.add_filter(pass); assert_eq!(f1, pass); f1.add_filter(dp); assert!(f1.has_filter(dp)); assert!(!f1.has_filter(dn)); assert_eq!(f1, dp); f1.add_filter(dn); assert!(f1.has_filter(dp)); assert!(f1.has_filter(dn)); assert!(!f1.has_filter(sb)); assert_eq!(f1, VarFilter::DensityAndDepth); f1.add_filter(sb); assert_eq!(f1, VarFilter::DensityAndDepthAndStrandBias); assert!(f1.has_filter(dp)); assert!(f1.has_filter(dn)); assert!(f1.has_filter(sb)); }
rust_cleaned_test_functions.jsonl/25102
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 455 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4612, 5315, 31054, 368, 341, 286, 1077, 1494, 284, 8735, 5632, 486, 12187, 280, 286, 1077, 11329, 284, 8735, 5632, 486, 19776, 280, 286, 1077, 47488, 284, 8735, 5632, 486, 66719, 280, 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_export() { let mut store = Store::new(); store.begin(); store.put( Context::default(), vec![(b"key1".to_vec(), b"value1".to_vec())], ); store.put( Context::default(), vec![(b"key2".to_vec(), b"foo".to_vec())], ); store.delete(Context::default(), vec![b"key0".to_vec()]); store.commit(); assert_eq!( store.export(), vec![ (b"key1".to_vec(), b"value1".to_vec()), (b"key2".to_vec(), b"foo".to_vec()), ] ); store.begin(); store.put( Context::default(), vec![(b"key1".to_vec(), b"value2".to_vec())], ); store.put( Context::default(), vec![(b"key2".to_vec(), b"foo".to_vec())], ); store.delete(Context::default(), vec![b"key0".to_vec()]); store.commit(); assert_eq!( store.export(), vec![ (b"key1".to_vec(), b"value2".to_vec()), (b"key2".to_vec(), b"foo".to_vec()), ] ); store.begin(); store.delete(Context::default(), vec![b"key0".to_vec(), b"key2".to_vec()]); store.commit(); assert_eq!(store.export(), vec![(b"key1".to_vec(), b"value2".to_vec())]); store.begin(); store.delete(Context::default(), vec![b"key1".to_vec()]); store.commit(); assert_eq!(store.export(), vec![]); store.begin(); store.put( Context::default(), vec![(b"key2".to_vec(), b"bar".to_vec())], ); store.put( Context::default(), vec![(b"key1".to_vec(), b"foo".to_vec())], ); store.put(Context::default(), vec![(b"k".to_vec(), b"box".to_vec())]); store.commit(); assert_eq!( store.export(), vec![ (b"k".to_vec(), b"box".to_vec()), (b"key1".to_vec(), b"foo".to_vec()), (b"key2".to_vec(), b"bar".to_vec()), ] ); store.begin(); store.delete(Context::default(), vec![b"key1".to_vec(), b"key1".to_vec()]); store.commit(); assert_eq!( store.export(), vec![ (b"k".to_vec(), b"box".to_vec()), (b"key2".to_vec(), b"bar".to_vec()), ] ); store.begin(); store.delete(Context::default(), vec![b"key2".to_vec()]); assert_eq!( store.export(), vec![ (b"k".to_vec(), b"box".to_vec()), (b"key2".to_vec(), b"bar".to_vec()), ] ); store.commit(); assert_eq!(store.export(), vec![(b"k".to_vec(), b"box".to_vec())]); store.begin(); store.put(Context::default(), vec![(b"key1".to_vec(), b"v1".to_vec())]); store.put(Context::default(), vec![(b"key2".to_vec(), b"v2".to_vec())]); assert_eq!(store.export(), vec![(b"k".to_vec(), b"box".to_vec())]); store.commit(); assert_eq!( store.export(), vec![ (b"k".to_vec(), b"box".to_vec()), (b"key1".to_vec(), b"v1".to_vec()), (b"key2".to_vec(), b"v2".to_vec()), ] ); }
rust_cleaned_test_functions.jsonl/59609
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1994 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 27114, 368, 341, 286, 1077, 5206, 3553, 284, 9129, 486, 931, 543, 286, 3553, 6848, 543, 286, 3553, 3597, 1006, 310, 9608, 486, 2258, 3148, 310, 7486, 0, 9697, 65, 1, 792, 16, 3263, 983, 13251,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_simple_app() { #[api_v2_operation] fn echo_pet(body: web::Json<Pet>) -> impl Future<Output = Result<web::Json<Pet>, Error>> { fut_ok(body) } #[api_v2_operation] async fn echo_pet_async(body: web::Json<Pet>) -> Result<web::Json<Pet>, actix_web::Error> { Ok(body) } async fn inner_async_func(body: web::Json<Pet>) -> Pet { body.into_inner() } #[api_v2_operation] async fn echo_pet_async_2(body: web::Json<Pet>) -> Result<web::Json<Pet>, actix_web::Error> { let pet = inner_async_func(body).await; Ok(web::Json(pet)) } #[api_v2_operation] fn some_pet(_data: web::Data<String>) -> impl Future<Output = Result<web::Json<Pet>, Error>> { #[allow(unreachable_code)] fut_ok(unimplemented!()) } fn config(cfg: &mut web::ServiceConfig) { cfg.service(web::resource("/echo").route(web::post().to(echo_pet))) .service(web::resource("/async_echo").route(web::post().to(echo_pet_async))) .service(web::resource("/async_echo_2").route(web::post().to(echo_pet_async_2))) .service(web::resource("/random").to(some_pet)); } run_and_check_app( || { App::new() .wrap_api() .with_json_spec_at("/api/spec") .service(web::scope("/api").configure(config)) .build() }, |addr| { let resp = CLIENT .get(&format!("http://{}/api/spec", addr)) .send() .expect("request failed?"); check_json( resp, json!({ "info":{"title":"","version":""}, "definitions": { "Pet": { "properties": { "class": { "enum": ["dog", "cat", "other"], "type": "string" }, "id": { "format": "int64", "type": "integer" }, "name": { "description": "Pick a good one.", "type": "string" }, "updatedOn": { "format": "date-time", "type": "string" }, "uuid": { "format": "uuid", "type": "string" } }, "required":["class", "name"] } }, "paths": { "/api/echo": { "parameters": [{ "in": "body", "name": "body", "required": true, "schema": { "$ref": "#/definitions/Pet" } }], "post": { "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/Pet" } } } } }, "/api/async_echo": { "parameters": [{ "in": "body", "name": "body", "required": true, "schema": { "$ref": "#/definitions/Pet" } }], "post": { "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/Pet" } } } } }, "/api/async_echo_2": { "parameters": [{ "in": "body", "name": "body", "required": true, "schema": { "$ref": "#/definitions/Pet" } }], "post": { "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/Pet" } } } } }, "/api/random": { "delete": { "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/Pet" } } } }, "get": { "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/Pet" } } } }, "head": { "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/Pet" } } } }, "options": { "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/Pet" } } } }, "patch": { "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/Pet" } } } }, "post": { "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/Pet" } } } }, "put": { "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/Pet" } } } } } }, "swagger": "2.0" }), ); }, ); }
rust_cleaned_test_functions.jsonl/18935
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 5618 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 30015, 8191, 368, 341, 262, 11506, 2068, 2273, 17, 32565, 921, 262, 5168, 1687, 75963, 15225, 25, 3482, 486, 5014, 21604, 295, 9231, 1464, 11605, 12498, 27, 5097, 284, 5714, 27, 2911, 486, 5014, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_reference_vector_l3_id3v2() { let test_vector = include_bytes!("../vectors/l3-id3v2.bit"); test_vs_minimp3(test_vector); }
rust_cleaned_test_functions.jsonl/69845
{ "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, 25433, 12247, 907, 18, 842, 18, 85, 17, 368, 341, 262, 1077, 1273, 12247, 284, 2924, 12524, 17223, 1244, 85, 10605, 13328, 18, 12897, 18, 85, 17, 30099, 797, 262, 1273, 42434, 7260, 6664, 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
#[test] fn test_example1() { init(); let input1 = "abc".chars().collect::<Vec<char>>(); let input2 = "abd".chars().collect::<Vec<char>>(); let pa = elm_ref('a'); let pb = elm_ref('b'); let pc = elm_ref('c'); let pd = elm_ref('d'); let p = (pa + pb + (pc | pd)).collect().map(String::from_iter); let result = p.parse_as_result(&input1).unwrap(); log::debug!("result = {}", result); assert_eq!(result, "abc"); let result = p.parse_as_result(&input2).unwrap(); log::debug!("result = {}", result); assert_eq!(result, "abd"); }
rust_cleaned_test_functions.jsonl/16810
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 262 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 39304, 16, 368, 341, 262, 2930, 543, 262, 1077, 1946, 16, 284, 330, 13683, 3263, 19255, 1005, 17384, 27638, 10050, 21919, 37038, 262, 1077, 1946, 17, 284, 330, 85920, 3263, 19255, 1005, 17384, 276...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_set_flags_3() { let (flags, rest, _) = set_flags(svec!["deno", "-r", "script.ts", "--allow-write"]).unwrap(); assert_eq!(rest, svec!["deno", "script.ts"]); assert_eq!( flags, DenoFlags { reload: true, allow_write: true, ..DenoFlags::default() } ); }
rust_cleaned_test_functions.jsonl/133073
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 153 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2602, 14130, 62, 18, 368, 341, 220, 1077, 320, 11161, 11, 2732, 11, 27439, 4035, 262, 738, 14130, 1141, 4083, 0, 1183, 5183, 78, 497, 6523, 81, 497, 330, 2282, 21288, 497, 14482, 7183, 62062, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_binomial_end_points() { let mut rng = ::test::rng(352); assert_eq!(rng.sample(Binomial::new(20, 0.0)), 0); assert_eq!(rng.sample(Binomial::new(20, 1.0)), 20); }
rust_cleaned_test_functions.jsonl/32036
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 112 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21816, 20855, 6213, 12928, 368, 341, 286, 1077, 5206, 28422, 284, 3504, 1944, 486, 69890, 7, 18, 20, 17, 317, 286, 2060, 10714, 10297, 69890, 23882, 5349, 258, 20855, 486, 931, 7, 17, 15, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_fetch() { let (mut hconn_c, mut hconn_s, dgram) = connect(); eprintln!("-----client"); let req = hconn_c .fetch("GET", "https", "something.com", "/", &[]) .unwrap(); assert_eq!(req, 0); let req = StreamId(req); hconn_c.stream_close_send(req).unwrap(); let out = hconn_c.process(dgram, now()); eprintln!("-----server"); let out = hconn_s.process(out.dgram(), now()); let _ = hconn_c.process(out.dgram(), now()); process_server_events(&mut hconn_s); let out = hconn_s.process(None, now()); eprintln!("-----client"); let _ = hconn_c.process(out.dgram(), now()); let out = hconn_s.process(None, now()); let _ = hconn_c.process(out.dgram(), now()); process_client_events(&mut hconn_c); }
rust_cleaned_test_functions.jsonl/20622
{ "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, 11803, 368, 341, 262, 1077, 320, 6984, 305, 5148, 666, 11, 5206, 305, 5148, 643, 11, 294, 1520, 8, 284, 4564, 1428, 262, 384, 33655, 17223, 15081, 2972, 797, 262, 1077, 4232, 284, 305, 5148, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_symlink_target_only() { let (at, mut ucmd) = at_and_ucmd!(); let dir = "test_symlink_target_only"; at.mkdir(dir); assert!(ucmd.args(&["-s", "-t", dir]).fails().stderr.len() > 0); }
rust_cleaned_test_functions.jsonl/4894
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 108 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 58530, 44243, 11123, 18410, 368, 341, 262, 1077, 320, 266, 11, 5206, 575, 8710, 8, 284, 518, 8378, 68887, 2277, 0, 543, 262, 1077, 5419, 284, 330, 1944, 58530, 44243, 11123, 18410, 3302, 262, 51...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_l_type() { let i = Instr { bits: 0b10101_01010110011101110011_0000000, format: Format::L(LType {}), }; match i.format { Format::L(f) => { assert_eq!(0b10101, f.rd(i.bits)); assert_eq!(0b01010110011101110011, f.imm(i.bits)); } _ => panic!("Expecting LType format"), } }
rust_cleaned_test_functions.jsonl/60976
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 203 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 907, 1819, 368, 341, 262, 1077, 600, 284, 758, 495, 341, 286, 9472, 25, 220, 15, 65, 16, 15, 16, 15, 16, 62, 15, 16, 15, 16, 15, 16, 16, 15, 15, 16, 16, 16, 15, 16, 16, 16, 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...
2
#[test] fn test_move_items() { let vec = vec![1, 2, 3]; let mut vec2 = vec![]; for i in vec { vec2.push(i); } assert_eq!(vec2, [1, 2, 3]); }
rust_cleaned_test_functions.jsonl/24416
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 98 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 17134, 12134, 368, 341, 262, 1077, 7486, 284, 7486, 20703, 16, 11, 220, 17, 11, 220, 18, 935, 262, 1077, 5206, 7486, 17, 284, 7486, 0, 15078, 262, 369, 600, 304, 7486, 341, 286, 7486, 17, 25...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_modified_mac_err() { let key = SecretKey::default(); let (mut sealer, nonce) = StreamSealer::new(&key).unwrap(); let mut opener = StreamOpener::new(&key, &nonce).unwrap(); let plaintext = "Secret message".as_bytes(); let mut dst_ciphertext = sealer.seal_chunk(plaintext, &StreamTag::Message).unwrap(); // Modify mac let macpos = dst_ciphertext.len() - 1; dst_ciphertext[macpos] ^= 1; assert!(opener.open_chunk(&dst_ciphertext).is_err()); }
rust_cleaned_test_functions.jsonl/104197
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 282 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 37749, 22802, 9266, 368, 341, 310, 1077, 1376, 284, 8599, 1592, 486, 2258, 543, 310, 1077, 320, 6984, 511, 13111, 11, 39676, 8, 284, 9203, 1514, 13111, 486, 931, 2099, 792, 568, 15454, 543, 310,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_transforms() { let transforms = parse!(transform_list, "Scale 1 2 3#test\nTranslate 1 2 3"); assert_eq!(transforms.len(), 2); match &transforms[0] { Transformation::Scale(s) => { assert_eq!(s.x.value, 1.0); }, _ => panic!("transformation 0 is not a Scale") }match &transforms[1] { Transformation::Translate(s) => { assert_eq!(s.x.value, 1.0); }, _ => panic!("transformation 1 is not a Scale") } }
rust_cleaned_test_functions.jsonl/68371
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 242 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 18449, 82, 368, 341, 262, 1077, 28475, 284, 4715, 10297, 4701, 2019, 11, 330, 6947, 220, 16, 220, 17, 220, 18, 2, 1944, 1699, 27473, 220, 16, 220, 17, 220, 18, 797, 262, 2060, 10714, 10297, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_namehash() { dbg!("00000000000C2E074eC69A0dFb2997BA6C7d2e1e" .from_hex::<Vec<u8>>() .unwrap()); for (name, expected) in &[ ( "", "0000000000000000000000000000000000000000000000000000000000000000", ), ( "foo.eth", "de9b09fd7c5f901e23a3f19fecc54828e9c848539801e86591bd9801b019f84f", ), ( "eth", "0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae", ), ( "alice.eth", "0x787192fc5378cc32aa956ddfdedbf26b24e8d78e40109add0eea2c1a012c3dec", ), ] { assert_hex(namehash(name), expected); } }
rust_cleaned_test_functions.jsonl/90226
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 537 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1269, 8296, 368, 341, 286, 47904, 17223, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 34, 17, 36, 15, 22, 19, 68, 34, 21, 24, 32, 15, 67, 37, 65, 17, 24, 24, 22, 7064, 21, 34, 22, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_lookup_country() { use super::geoip2::Country; let _ = env_logger::try_init(); let filename = "test-data/test-data/GeoIP2-Country-Test.mmdb"; let reader = Reader::open_readfile(filename).unwrap(); let ip: IpAddr = FromStr::from_str("89.160.20.112").unwrap(); let country: Country = reader.lookup(ip).unwrap(); let country: super::geoip2::model::Country = country.country.unwrap(); assert_eq!(country.iso_code, Some("SE")); assert_eq!(country.is_in_european_union, Some(true)); }
rust_cleaned_test_functions.jsonl/42012
{ "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, 27464, 28106, 368, 341, 262, 990, 2256, 486, 13052, 573, 17, 486, 16408, 280, 262, 1077, 716, 284, 6105, 27413, 486, 1539, 6137, 1428, 262, 1077, 3899, 284, 330, 1944, 13945, 12697, 13945, 14, 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_non_utf8_conversion() { Python::with_gil(|py| { #[cfg(not(target_os = "wasi"))] use std::os::unix::ffi::OsStrExt; #[cfg(target_os = "wasi")] use std::os::wasi::ffi::OsStrExt; // this is not valid UTF-8 let payload = &[250, 251, 252, 253, 254, 255, 0, 255]; let os_str = OsStr::from_bytes(payload); // do a roundtrip into Pythonland and back and compare let py_str: PyObject = os_str.into_py(py); let os_str_2: OsString = py_str.extract(py).unwrap(); assert_eq!(os_str, os_str_2); }); }
rust_cleaned_test_functions.jsonl/79173
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 356 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21637, 39453, 23, 64132, 368, 341, 286, 13027, 486, 4197, 1889, 321, 22428, 3288, 91, 341, 310, 11506, 14072, 24772, 8637, 29387, 284, 330, 86, 10215, 2761, 921, 310, 990, 1460, 486, 436, 486, 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_display_borrowed_template() { macro_rules! b_tree_map { () => {{ BTreeMap::new() }}; ($( $key: expr => $val: expr ),+ $(,)?) => {{ let mut map = ::std::collections::BTreeMap::new(); $( map.insert($key, $val); )* map }}; } assert_eq!( &TemplateBorrowed { name: "affix", parameters: b_tree_map! { "1" => "en", "2" => "de-", "3" => "orphan", "4" => "-ize", "5" => "-ed", }, text: None, } .to_string(), "{{affix|en|de-|orphan|-ize|-ed}}" ); assert_eq!( &TemplateBorrowed { name: "affix", parameters: b_tree_map! { "2" => "de-", "3" => "orphan", "4" => "-ize", "5" => "-ed", }, text: None, } .to_string(), "{{affix|2=de-|3=orphan|4=-ize|5=-ed}}" ); assert_eq!( &TemplateBorrowed { name: "odd test", parameters: b_tree_map! { "!" => "exclamation point", "1" => "one", "2" => "two", }, text: None, } .to_string(), "{{odd test|!=exclamation point|one|two}}" ); }
rust_cleaned_test_functions.jsonl/111929
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 883 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14825, 880, 7768, 291, 8693, 368, 341, 262, 18072, 21407, 0, 293, 11663, 5376, 341, 286, 1719, 589, 5867, 425, 6533, 2227, 486, 931, 368, 87037, 286, 39137, 400, 792, 25, 15169, 589, 400, 831, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_unix() { let res = parse_cfg::<(_, nom::error::ErrorKind)>("cfg(unix)"); println!("res = {:?}", res); assert_eq!(res, Ok(("", Unix))) }
rust_cleaned_test_functions.jsonl/50597
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 112 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 80572, 368, 341, 310, 1077, 592, 284, 4715, 18343, 27638, 41117, 9662, 486, 841, 486, 1454, 10629, 8, 13211, 14072, 18364, 941, 20996, 310, 13751, 17223, 416, 284, 71964, 592, 317, 310, 2060, 1071...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_prune() { let blocktree_path = get_tmp_ledger_path!(); let blocktree = Blocktree::open(&blocktree_path).unwrap(); let (shreds, _) = make_many_slot_entries(0, 50, 6); let shreds_per_slot = shreds.len() as u64 / 50; blocktree.insert_shreds(shreds, None, false).unwrap(); blocktree .slot_meta_iterator(0) .unwrap() .for_each(|(_, meta)| assert_eq!(meta.last_index, shreds_per_slot - 1)); blocktree.prune(5); blocktree .slot_meta_iterator(0) .unwrap() .for_each(|(slot, meta)| { assert!(slot <= 5); assert_eq!(meta.last_index, shreds_per_slot - 1) }); let data_iter = blocktree .data_shred_cf .iter(IteratorMode::From((0, 0), IteratorDirection::Forward)) .unwrap(); for ((slot, _), _) in data_iter { if slot > 5 { assert!(false); } } drop(blocktree); Blocktree::destroy(&blocktree_path).expect("Expected successful database destruction"); }
rust_cleaned_test_functions.jsonl/116896
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 609 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5294, 2886, 368, 341, 286, 1077, 2504, 9344, 2638, 284, 633, 16125, 38367, 1389, 2638, 0, 543, 286, 1077, 2504, 9344, 284, 8362, 9344, 486, 2508, 2099, 4574, 9344, 2638, 568, 15454, 543, 286, 10...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_parallel_readers() { let lock = Arc::new(RwLock::<usize>::default()); let t = 100; unsafe { *lock.data.get() = t; } let mut threads = Vec::new(); for i in 0..t { let l = lock.clone(); let child = thread::spawn(move || { let ele = l.read(i); assert_eq!(*ele, t); }); threads.push(child); } for _i in 0..threads.len() { let _retval = threads .pop() .unwrap() .join() .expect("Reading didn't finish successfully."); } }
rust_cleaned_test_functions.jsonl/77529
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 400 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 60625, 6443, 388, 368, 341, 286, 1077, 5296, 284, 19689, 486, 931, 2785, 86, 11989, 27638, 51878, 6831, 2258, 1423, 286, 1077, 259, 284, 220, 16, 15, 15, 401, 286, 19860, 341, 310, 353, 1023, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_next_sequence_send_ok() { let sequence_id = Sequence::from(0); let port_channel = (PortId::default(), ChannelId::new(0)); let mut context: Context<Test> = Context::new(); new_test_ext().execute_with(|| { assert_eq!( context.store_next_sequence_send(port_channel.clone(), sequence_id).is_ok(), true ); let result = context.get_next_sequence_send(&port_channel).unwrap(); assert_eq!(result, sequence_id); }) }
rust_cleaned_test_functions.jsonl/60070
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 172 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11257, 23735, 13565, 19817, 368, 341, 10217, 8500, 842, 284, 28871, 486, 1499, 7, 15, 317, 10217, 2635, 14571, 284, 320, 7084, 764, 486, 2258, 1507, 13434, 764, 486, 931, 7, 15, 1106, 10217, 520...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_curly_braces() { let scanner = Scanner::new(); let source = "{}".to_owned(); assert_eq!( Ok(vec![ Token { t: TokenType::LeftBrace, line: 1, lexeme: "{".to_owned(), literal: None, }, Token { t: TokenType::RightBrace, line: 1, lexeme: "}".to_owned(), literal: None, }, Token { t: TokenType::Eof, line: 1, lexeme: String::new(), literal: None, } ]), scanner.scan_tokens(source) ); }
rust_cleaned_test_functions.jsonl/92086
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 556 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 18956, 398, 17682, 2434, 368, 341, 286, 1077, 20775, 284, 17170, 486, 931, 543, 286, 1077, 2530, 284, 35503, 3263, 983, 51973, 543, 286, 2060, 10714, 33673, 310, 7622, 25592, 90515, 394, 9660, 341...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_border_no_size() { let mut config = Config::new(); let mut root = Node::new_with_config(&mut config); root.set_border(Edge::Left, 10 as f32); root.set_border(Edge::Top, 10 as f32); root.set_border(Edge::Right, 10 as f32); root.set_border(Edge::Bottom, 10 as f32); root.calculate_layout(UNDEFINED, UNDEFINED, Direction::LTR); assert_eq!(0 as f32, root.get_layout_left()); assert_eq!(0 as f32, root.get_layout_top()); assert_eq!(20 as f32, root.get_layout_width()); assert_eq!(20 as f32, root.get_layout_height()); root.calculate_layout(UNDEFINED, UNDEFINED, Direction::RTL); assert_eq!(0 as f32, root.get_layout_left()); assert_eq!(0 as f32, root.get_layout_top()); assert_eq!(20 as f32, root.get_layout_width()); assert_eq!(20 as f32, root.get_layout_height()); }
rust_cleaned_test_functions.jsonl/49846
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 328 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 31940, 6536, 2368, 368, 341, 10217, 5206, 2193, 284, 5532, 486, 931, 1428, 10217, 5206, 3704, 284, 6018, 486, 931, 6615, 5332, 2099, 6984, 2193, 317, 33698, 980, 31940, 7, 11656, 486, 5415, 11, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_is_skipped() { let ledger_path = get_tmp_ledger_path_auto_delete!(); let blockstore = Blockstore::open(ledger_path.path()).unwrap(); let roots = vec![2, 4, 7, 12, 15]; blockstore.set_roots(roots.iter()).unwrap(); for i in 0..20 { if i < 2 || roots.contains(&i) || i > 15 { assert!(!blockstore.is_skipped(i)); } else { assert!(blockstore.is_skipped(i)); } } }
rust_cleaned_test_functions.jsonl/9550
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 267 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6892, 33811, 6450, 368, 341, 286, 1077, 46933, 2638, 284, 633, 16125, 38367, 1389, 2638, 27740, 11353, 0, 543, 286, 1077, 2504, 4314, 284, 8362, 4314, 486, 2508, 7, 50704, 2638, 3875, 6011, 15454,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
5
#[test] fn test_handle_put() { let _ = fs::remove_file("test_put.kv"); let log_file = fs::File::create("test_put.kv").unwrap(); let storage_engine = Arc::new(RwLock::new(KVStorage::new(log_file))); let storage_engine_clone = storage_engine.clone(); let t = thread::spawn(move || { let tcp_listener = TcpListener::bind("127.0.0.1:1972").unwrap(); let (tcp_stream, _) = tcp_listener.accept().unwrap(); handle_connection(tcp_stream, storage_engine_clone).unwrap(); }); let key = gen_key(); let value = gen_value(); thread::sleep(Duration::from_secs(1)); let tcp_stream = TcpStream::connect("127.0.0.1:1972").unwrap(); let mut chunktps = ChunktpConnection::new(tcp_stream); chunktps.write_chunk(Request::Put(key, value).serialize()).unwrap(); let _ = chunktps.read_chunk(); chunktps.write_chunk(Request::Close.serialize()).unwrap(); t.join().unwrap(); assert_eq!(storage_engine.read().unwrap().get(&key).unwrap().data.to_vec(), value.data.to_vec()); }
rust_cleaned_test_functions.jsonl/26664
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 505 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 10630, 15557, 368, 341, 286, 1077, 716, 284, 8619, 486, 5399, 2458, 445, 1944, 15557, 5202, 85, 797, 286, 1077, 1487, 2458, 284, 8619, 486, 1703, 486, 3182, 445, 1944, 15557, 5202, 85, 1827, 154...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_grapheme_aware_width() { // UnicodeWidthStr::width would return 8 assert_eq!(2, "👩‍👩‍👦‍👦".width_graphemes()); assert_eq!(1, "Ü".width_graphemes()); assert_eq!(11, "normal text".width_graphemes()); }
rust_cleaned_test_functions.jsonl/12731
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 118 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14738, 3894, 62, 19541, 7927, 368, 341, 262, 442, 35897, 3327, 2580, 486, 3098, 1035, 470, 220, 23, 198, 262, 2060, 10714, 10297, 17, 11, 330, 145233, 378, 235, 145233, 378, 235, 145988, 378, 23...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_from_duration() -> Result<()> { let cases = vec!["11:30:45.123456", "-35:30:46"]; for case in cases { let mut ctx = EvalContext::default(); let duration = Duration::parse(&mut ctx, case.as_bytes(), MAX_FSP)?; let actual = Time::from_duration(&mut ctx, duration, TimeType::DateTime)?; let today = actual .try_into_chrono_datetime(&mut ctx)? .checked_sub_signed(chrono::Duration::nanoseconds(duration.to_nanos())) .unwrap(); let now = Utc::now(); assert_eq!(today.year(), now.year()); assert_eq!(today.month(), now.month()); assert_eq!(today.day(), now.day()); assert_eq!(today.hour(), 0); assert_eq!(today.minute(), 0); assert_eq!(today.second(), 0); } Ok(()) }
rust_cleaned_test_functions.jsonl/40467
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 456 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5673, 25454, 368, 1464, 5714, 71698, 341, 286, 1077, 5048, 284, 7486, 0, 1183, 16, 16, 25, 18, 15, 25, 19, 20, 13, 16, 17, 18, 19, 20, 21, 497, 6523, 18, 20, 25, 18, 15, 25, 19, 21, 63...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_is_zeroed() { const ZEROS_LEN: usize = 1024; let mut buf = [0; ZEROS_LEN]; assert_eq!(PreAccount::is_zeroed(&buf), true); buf[0] = 1; assert_eq!(PreAccount::is_zeroed(&buf), false); let mut buf = [0; ZEROS_LEN - 1]; assert_eq!(PreAccount::is_zeroed(&buf), true); buf[0] = 1; assert_eq!(PreAccount::is_zeroed(&buf), false); let mut buf = [0; ZEROS_LEN + 1]; assert_eq!(PreAccount::is_zeroed(&buf), true); buf[0] = 1; assert_eq!(PreAccount::is_zeroed(&buf), false); let buf = vec![]; assert_eq!(PreAccount::is_zeroed(&buf), true); }
rust_cleaned_test_functions.jsonl/71229
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 351 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6892, 19359, 291, 368, 341, 286, 733, 1863, 640, 3126, 15536, 25, 22301, 284, 220, 16, 15, 17, 19, 280, 286, 1077, 5206, 6607, 284, 508, 15, 26, 1863, 640, 3126, 15536, 935, 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
#[test] fn test_from_cmdline_with_args_overwrites() { let expected = AgentConfig { dev_mode: true, server_addr: "unix://@/tmp/foo.socket".to_string(), ..Default::default() }; let example_config_file_contents = "dev_mode = true\nserver_addr = 'unix://@/tmp/foo.socket'"; let dir = tempdir().expect("failed to create tmpdir"); let file_path = dir.path().join("config.toml"); let filename = file_path.to_str().expect("failed to create filename"); let mut file = File::create(filename).unwrap_or_else(|_| panic!("failed to create file")); file.write_all(example_config_file_contents.as_bytes()) .unwrap_or_else(|_| panic!("failed to write file contents")); let config = AgentConfig::from_cmdline("", vec!["--config".to_string(), filename.to_string()]) .expect("Failed to parse command line"); assert_eq!(expected.debug_console, config.debug_console); assert_eq!(expected.dev_mode, config.dev_mode); assert_eq!( expected.unified_cgroup_hierarchy, config.unified_cgroup_hierarchy, ); assert_eq!(expected.log_level, config.log_level); assert_eq!(expected.hotplug_timeout, config.hotplug_timeout); assert_eq!(expected.container_pipe_size, config.container_pipe_size); assert_eq!(expected.server_addr, config.server_addr); assert_eq!(expected.tracing, config.tracing); }
rust_cleaned_test_functions.jsonl/119141
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 674 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5673, 11684, 1056, 6615, 8384, 15431, 59079, 368, 341, 286, 1077, 3601, 284, 20713, 2648, 341, 310, 3483, 7302, 25, 830, 345, 310, 3538, 7387, 25, 330, 56646, 1110, 31, 14, 5173, 60555, 25926, 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_left_double() { assert_has_variable!(interpret("X# = 1.1# + 2.1"), "X#", 3.2_f64); assert_has_variable!(interpret("X# = 1.1 + 2.1#"), "X#", 3.2_f64); assert_has_variable!(interpret("X# = 1.1# + 2"), "X#", 3.1_f64); assert_linter_err!("X = 1.1# + \"hello\"", LinterError::TypeMismatch, 1, 12); }
rust_cleaned_test_functions.jsonl/22646
{ "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, 9579, 24598, 368, 341, 310, 2060, 21778, 14635, 10297, 16897, 445, 55, 2, 284, 220, 16, 13, 16, 2, 488, 220, 17, 13, 16, 3975, 330, 55, 75915, 220, 18, 13, 17, 761, 21, 19, 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...
1
#[test] fn test_decode_strex() { assert_eq!( decode_32(0xe8402c00), Instruction::STREX { params: Reg3RdRtRnImm32Params { rd: Reg::R12, rt: Reg::R2, rn: Reg::R0, imm32: 0, } } ); }
rust_cleaned_test_functions.jsonl/64883
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 217 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15227, 1261, 37539, 368, 341, 1066, 262, 2060, 10714, 33673, 286, 16895, 62, 18, 17, 7, 15, 8371, 23, 19, 15, 17, 66, 15, 15, 1326, 286, 29051, 486, 784, 787, 55, 341, 310, 3628, 25, 3184, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_bss_comparison() { // Two BSSDescription values with the same protection and RSSI are equivalent. assert_eq!( Ordering::Equal, fake_bss!(Wpa2, rssi_dbm: -10) .candidacy() .cmp(&fake_bss!(Wpa2, rssi_dbm: -10).candidacy()) ); // Higher security is better. assert_bss_comparison(&fake_bss!(Wpa1, rssi_dbm: -10), &fake_bss!(Wpa2, rssi_dbm: -50)); assert_bss_comparison(&fake_bss!(Open, rssi_dbm: -10), &fake_bss!(Wpa2, rssi_dbm: -50)); // Higher RSSI is better if security is equivalent. assert_bss_comparison(&fake_bss!(Wpa2, rssi_dbm: -50), &fake_bss!(Wpa2, rssi_dbm: -10)); // Having an RSSI measurement is always better than not having any measurement assert_bss_comparison(&fake_bss!(Wpa2, rssi_dbm: 0), &fake_bss!(Wpa2, rssi_dbm: -100)); }
rust_cleaned_test_functions.jsonl/60272
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 472 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 880, 778, 90797, 368, 341, 286, 442, 220, 9043, 425, 1220, 5009, 2750, 448, 279, 1852, 9135, 323, 29274, 40, 525, 13578, 624, 286, 2060, 10714, 33673, 310, 68621, 486, 2993, 345, 310, 12418, 880...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_cli() { let temp_dir = TempDir::new("cargo-clone-tests").unwrap(); let output_path = temp_dir.path().join("cargo-clone"); assert!(!output_path.exists()); let status = Command::new("target/debug/cargo-clone") .arg("clone") .arg("cargo-clone") .arg("--") .arg(output_path.to_str().unwrap()) .status() .unwrap(); assert!(status.success()); assert!(output_path.exists()); assert!(output_path.join("Cargo.toml").exists()); }
rust_cleaned_test_functions.jsonl/134186
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 234 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 47147, 368, 341, 262, 1077, 2730, 4334, 284, 19944, 6184, 486, 931, 445, 66715, 12, 19982, 81094, 1827, 15454, 543, 262, 1077, 2550, 2638, 284, 2730, 4334, 3875, 1005, 5987, 445, 66715, 12, 19982,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_association_ok() { with_rewards_default(|_, accounts| { assert_ok!(CrowdloanRewards::initialize(Origin::root())); for (picasso_account, remote_account) in accounts.into_iter() { assert_ok!(remote_account.associate(picasso_account)); } }); }
rust_cleaned_test_functions.jsonl/41093
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 110 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 58665, 367, 19817, 368, 341, 46948, 77997, 9993, 22428, 6878, 9618, 91, 341, 197, 6948, 19817, 10297, 93926, 67, 38329, 58465, 2347, 486, 21641, 7, 13298, 486, 2888, 7392, 197, 2023, 320, 15587, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_state_add_transform_inputs_clamped() { let min_volume = 0.0; let max_volume = 1.0; // Values below the minimum volume level are clamped to the minimum volume level. set_and_verify_max_volume(-0.0, min_volume); set_and_verify_max_volume(-0.1, min_volume); set_and_verify_max_volume(f32::MIN, min_volume); set_and_verify_max_volume(f32::NEG_INFINITY, min_volume); // Values above the maximum volume level are clamped to the maximum volume level. set_and_verify_max_volume(1.1, max_volume); set_and_verify_max_volume(f32::MAX, max_volume); set_and_verify_max_volume(f32::INFINITY, max_volume); }
rust_cleaned_test_functions.jsonl/32960
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 314 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4387, 2891, 18449, 28557, 6794, 32198, 368, 341, 286, 1077, 1308, 26941, 284, 220, 15, 13, 15, 280, 286, 1077, 1932, 26941, 284, 220, 16, 13, 15, 401, 286, 442, 24979, 3685, 279, 8028, 8123, 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_input_handler_clear_input_on_ctrl_u() { let mut app = App::new(); app.input = str_to_vec_char("My text"); handler(Key::Ctrl('u'), &mut app); assert_eq!(app.input, str_to_vec_char("")); }
rust_cleaned_test_functions.jsonl/9017
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 120 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5898, 10183, 21811, 5898, 4470, 22667, 7300, 368, 341, 286, 1077, 5206, 906, 284, 1845, 486, 931, 1428, 286, 906, 10046, 284, 607, 2346, 13251, 9232, 445, 5050, 1467, 3071, 286, 7013, 21358, 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
#[test] fn test_function_half() { let db = Connection::open_in_memory().unwrap(); db.create_scalar_function("half", 1, true, half).unwrap(); let result: Result<f64> = db.query_row("SELECT half(6)", NO_PARAMS, |r| r.get(0)); assert!((3f64 - result.unwrap()).abs() < EPSILON); }
rust_cleaned_test_functions.jsonl/41666
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 145 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9174, 40626, 368, 341, 286, 1077, 2927, 284, 11032, 486, 2508, 1243, 19195, 1005, 15454, 543, 286, 2927, 2520, 41652, 9174, 445, 37006, 497, 220, 16, 11, 830, 11, 4279, 568, 15454, 543, 286, 107...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_address() { let hex = Vec::from_hex("ca843279e3427144cead5e4d5999a3d0") .expect("You must provide a valid Hex format"); assert_eq!( hex.len(), AccountAddress::LENGTH as usize, "Address {:?} is not {}-bytes long. Addresses must be {} bytes", hex, AccountAddress::LENGTH, AccountAddress::LENGTH, ); let address: AccountAddress = AccountAddress::try_from(&hex[..]).unwrap_or_else(|_| { panic!( "The address {:?} is of invalid length. Addresses must be 16-bytes long", &hex ) }); let hash_vec = &Vec::from_hex("c965dfb50b4ebcf000d256a4b23d36ca49f0b05a905e8124ba2f8ff3112bf662") .expect("You must provide a valid Hex format"); let mut hash = [0u8; 32]; let bytes = &hash_vec[..32]; hash.copy_from_slice(&bytes); assert_eq!(address.hash(), HashValue::new(hash)); assert_eq!(address.as_ref().to_vec(), hex); }
rust_cleaned_test_functions.jsonl/106050
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 458 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6744, 368, 341, 262, 1077, 12371, 284, 11312, 486, 1499, 32655, 445, 924, 23, 19, 18, 17, 22, 24, 68, 18, 19, 17, 22, 16, 19, 19, 346, 329, 20, 68, 19, 67, 20, 24, 24, 24, 64, 18, 67, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_multithread() { #[eff::eff(LongComputation)] fn computation() -> u32 { eff::perform!(LongComputation) + 100 } use eff::Effectful; assert_eq!( computation() .handle(eff::handler! { x => x, LongComputation, k => { thread::spawn({ let waker = k.waker(); move || { thread::sleep(Duration::from_millis(500)); waker.wake(42) } }); eff::perform!(k.continuation()) + 200 } }) .block_on(), 342, ); }
rust_cleaned_test_functions.jsonl/51603
{ "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, 26290, 410, 878, 368, 341, 262, 11506, 6445, 486, 6445, 17706, 1092, 13320, 5563, 262, 5168, 34447, 368, 1464, 575, 18, 17, 341, 286, 3289, 486, 28488, 10297, 6583, 1092, 13320, 8, 488, 220, 16,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_map_enum() { use std::convert::TryFrom; ty_enum! ( #[derive(Debug, Eq, PartialEq)] enum Jinser: usize { AGE = 18, HEIGHT = 180 } ); let age: usize = Jinser::AGE.into(); assert_eq!(age, 18); assert_eq!(Jinser::try_from(180), Ok(Jinser::HEIGHT)); assert_eq!(Jinser::try_from(10), Err(10)); }
rust_cleaned_test_functions.jsonl/90797
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 210 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5376, 31054, 368, 341, 262, 990, 1460, 486, 14166, 486, 21453, 3830, 401, 262, 13580, 31054, 0, 2399, 286, 11506, 27098, 42618, 11, 33122, 11, 55039, 5563, 286, 7618, 38511, 799, 25, 22301, 341, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_copy_from_module() -> Result<(), Box<dyn Error>> { let _context = quick_init(); let ptx = CString::new(include_str!("../resources/add.ptx"))?; let module = Module::load_from_string(&ptx)?; let constant_name = CString::new("my_constant")?; let symbol = module.get_global::<u32>(&constant_name)?; let mut constant_copy = 0u32; symbol.copy_to(&mut constant_copy)?; assert_eq!(314, constant_copy); Ok(()) }
rust_cleaned_test_functions.jsonl/12
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 228 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 16096, 5673, 10750, 368, 1464, 5714, 68843, 8261, 92846, 4600, 2452, 341, 286, 1077, 716, 2147, 284, 3974, 6137, 1428, 286, 1077, 281, 3998, 284, 56956, 486, 931, 77863, 2895, 17223, 1244, 12745, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_short_usage() { let mut opts = Options::new(); opts.reqopt("b", "banana", "Desc", "VAL"); opts.optopt("a", "012345678901234567890123456789", "Desc", "VAL"); opts.optflag("k", "kiwi", "Desc"); opts.optflagopt("p", "", "Desc", "VAL"); opts.optmulti("l", "", "Desc", "VAL"); let expected = "Usage: fruits -b VAL [-a VAL] [-k] [-p [VAL]] [-l VAL]..".to_string(); let generated_usage = opts.short_usage("fruits"); debug!("expected: <<{}>>", expected); debug!("generated: <<{}>>", generated_usage); assert_eq!(generated_usage, expected); }
rust_cleaned_test_functions.jsonl/52397
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 256 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 16673, 31507, 368, 341, 262, 1077, 5206, 12185, 284, 14566, 486, 931, 543, 262, 12185, 48369, 2912, 445, 65, 497, 330, 87747, 497, 330, 11065, 497, 330, 5594, 797, 262, 12185, 28102, 2912, 445, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_env_reassign_variable() { let mut env = Environment::new(); let value = Value::Scalar(YololNumber::zero().into()); env.let_value("number", value.clone()).unwrap(); env.let_value("number", value.clone()).unwrap(); }
rust_cleaned_test_functions.jsonl/131945
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 99 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15879, 1288, 6983, 14635, 368, 341, 262, 1077, 5206, 6105, 284, 11586, 486, 931, 543, 262, 1077, 897, 284, 5162, 486, 20639, 20206, 337, 337, 2833, 486, 14154, 1005, 18122, 1423, 262, 6105, 13, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_directory_in() { let dir = tempdir().unwrap(); let options = fs_extra::dir::CopyOptions::new(); let replays_path = dir.path().join("replays"); let path = replays_path.to_str().unwrap().to_owned(); fs_extra::dir::copy("assets/replays", dir.path(), &options).unwrap(); Command::cargo_bin("rrrocket") .unwrap() .args(&["-n", "-m", &path]) .assert() .success(); assert!(replays_path.join("1ec9.replay.json").as_path().exists()); }
rust_cleaned_test_functions.jsonl/88731
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 267 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14846, 1243, 368, 341, 286, 1077, 5419, 284, 2730, 3741, 1005, 15454, 543, 286, 1077, 2606, 284, 8619, 31858, 486, 3741, 486, 12106, 3798, 486, 931, 543, 286, 1077, 5791, 942, 2638, 284, 5419, 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_htlc_ignore_latest_remote_commitment() { // Test that HTLC transactions spending the latest remote commitment transaction are simply 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 nodes = create_network(2, &node_cfgs, &node_chanmgrs); create_announced_chan_between_nodes(&nodes, 0, 1, InitFeatures::supported(), InitFeatures::supported()); route_payment(&nodes[0], &[&nodes[1]], 10000000); nodes[0].node.force_close_channel(&nodes[0].node.list_channels()[0].channel_id); check_closed_broadcast!(nodes[0], false); let node_txn = nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap(); assert_eq!(node_txn.len(), 2); let header = BlockHeader { version: 0x20000000, prev_blockhash: Default::default(), merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 }; nodes[1].block_notifier.block_connected(&Block { header, txdata: vec![node_txn[0].clone(), node_txn[1].clone()]}, 1); check_closed_broadcast!(nodes[1], false); // Duplicate the block_connected call since this may happen due to other listeners // registering new transactions nodes[1].block_notifier.block_connected(&Block { header, txdata: vec![node_txn[0].clone(), node_txn[1].clone()]}, 1); }
rust_cleaned_test_functions.jsonl/28294
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 482 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 49086, 17257, 58493, 64880, 36425, 36346, 478, 368, 341, 197, 322, 3393, 429, 5260, 8556, 14131, 10164, 279, 5535, 8699, 15155, 7745, 525, 4936, 17642, 10217, 26023, 1645, 18343, 82, 284, 1855, 4555...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_fr_repr_num_bits() { let mut a = FrRepr::from(0); assert_eq!(0, a.num_bits()); a = FrRepr::from(1); for i in 1..257 { assert_eq!(i, a.num_bits()); a.mul2(); } assert_eq!(0, a.num_bits()); }
rust_cleaned_test_functions.jsonl/66319
{ "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, 41537, 68535, 4273, 20034, 368, 341, 262, 1077, 5206, 264, 284, 2869, 693, 649, 486, 1499, 7, 15, 317, 262, 2060, 10714, 10297, 15, 11, 264, 10522, 20034, 1423, 262, 264, 284, 2869, 693, 649, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_operands() { let context = Context::create(); let module = context.create_module("ivs"); let builder = context.create_builder(); let void_type = context.void_type(); let f32_type = context.f32_type(); let f32_ptr_type = f32_type.ptr_type(AddressSpace::Generic); let fn_type = void_type.fn_type(&[f32_ptr_type.into()], false); let function = module.add_function("take_f32_ptr", fn_type, None); let basic_block = context.append_basic_block(&function, "entry"); builder.position_at_end(&basic_block); let arg1 = function.get_first_param().unwrap().into_pointer_value(); let f32_val = f32_type.const_float(::std::f64::consts::PI); let store_instruction = builder.build_store(arg1, f32_val); let free_instruction = builder.build_free(arg1); let return_instruction = builder.build_return(None); assert_eq!(store_instruction.get_opcode(), Store); assert_eq!(free_instruction.get_opcode(), Call); assert_eq!(return_instruction.get_opcode(), Return); assert!(arg1.as_instruction_value().is_none()); // Test operands assert_eq!(store_instruction.get_num_operands(), 2); assert_eq!(free_instruction.get_num_operands(), 2); let store_operand0 = store_instruction.get_operand(0).unwrap(); let store_operand1 = store_instruction.get_operand(1).unwrap(); assert_eq!(store_operand0.left().unwrap(), f32_val); // f32 const assert_eq!(store_operand1.left().unwrap(), arg1); // f32* arg1 assert!(store_instruction.get_operand(2).is_none()); assert!(store_instruction.get_operand(3).is_none()); assert!(store_instruction.get_operand(4).is_none()); let free_operand0 = free_instruction.get_operand(0).unwrap().left().unwrap(); let free_operand1 = free_instruction.get_operand(1).unwrap().left().unwrap(); let free_operand0_instruction = free_operand0.as_instruction_value().unwrap(); assert!(free_operand0.is_pointer_value()); assert!(free_operand1.is_pointer_value()); // Free function ptr assert_eq!(free_operand0_instruction.get_opcode(), BitCast); assert_eq!(free_operand0_instruction.get_operand(0).unwrap().left().unwrap(), arg1); assert!(free_operand0_instruction.get_operand(1).is_none()); assert!(free_operand0_instruction.get_operand(2).is_none()); assert!(free_instruction.get_operand(2).is_none()); assert!(free_instruction.get_operand(3).is_none()); assert!(free_instruction.get_operand(4).is_none()); assert!(module.verify().is_ok()); assert!(free_instruction.set_operand(0, arg1)); // Module is no longer valid because free takes an i8* not f32* assert!(module.verify().is_err()); assert!(free_instruction.set_operand(0, free_operand0)); assert!(module.verify().is_ok()); assert!(!free_instruction.set_operand(2, free_operand0)); assert!(module.verify().is_ok()); assert_eq!(return_instruction.get_num_operands(), 0); assert!(return_instruction.get_operand(0).is_none()); assert!(return_instruction.get_operand(1).is_none()); assert!(return_instruction.get_operand(2).is_none()); // Test Uses let bitcast_use_value = free_operand0_instruction .get_first_use() .unwrap() .get_used_value() .left() .unwrap(); let free_call_param = free_instruction.get_operand(0).unwrap().left().unwrap(); assert_eq!(bitcast_use_value, free_call_param); // These instructions/calls don't return any ir value so they aren't used anywhere assert!(store_instruction.get_first_use().is_none()); assert!(free_instruction.get_first_use().is_none()); assert!(return_instruction.get_first_use().is_none()); let arg1_first_use = arg1.get_first_use().unwrap(); let arg1_second_use = arg1_first_use.get_next_use().unwrap(); // However their operands are used let store_operand_use0 = store_instruction.get_operand_use(0).unwrap(); let store_operand_use1 = store_instruction.get_operand_use(1).unwrap(); assert!(store_operand_use0.get_next_use().is_none()); assert!(store_operand_use1.get_next_use().is_none()); assert_eq!(store_operand_use1, arg1_second_use); assert_eq!(store_operand_use0.get_user(), store_instruction); assert_eq!(store_operand_use1.get_user(), store_instruction); assert_eq!(store_operand_use0.get_used_value().left().unwrap(), f32_val); assert_eq!(store_operand_use1.get_used_value().left().unwrap(), arg1); assert!(store_instruction.get_operand_use(2).is_none()); assert!(store_instruction.get_operand_use(3).is_none()); assert!(store_instruction.get_operand_use(4).is_none()); assert!(store_instruction.get_operand_use(5).is_none()); assert!(store_instruction.get_operand_use(6).is_none()); let free_operand_use0 = free_instruction.get_operand_use(0).unwrap(); let free_operand_use1 = free_instruction.get_operand_use(1).unwrap(); assert!(free_operand_use0.get_next_use().is_none()); assert!(free_operand_use1.get_next_use().is_none()); assert!(free_instruction.get_operand_use(2).is_none()); assert!(free_instruction.get_operand_use(3).is_none()); assert!(free_instruction.get_operand_use(4).is_none()); assert!(free_instruction.get_operand_use(5).is_none()); assert!(free_instruction.get_operand_use(6).is_none()); assert!(module.verify().is_ok()); }
rust_cleaned_test_functions.jsonl/92679
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2157 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 25634, 2844, 368, 341, 262, 1077, 2266, 284, 9608, 486, 3182, 543, 262, 1077, 4688, 284, 2266, 2520, 10750, 445, 344, 82, 797, 262, 1077, 7363, 284, 2266, 2520, 28532, 543, 262, 1077, 737, 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