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_read_iface_counters() { use std::os::unix::process::ExitStatusExt; use std::process::ExitStatus; use std::process::Output; use KI; let mut counter = 0; KI.set_mock(Box::new(move |program, args| { counter += 1; match counter { 1 => { assert_eq!(program, "iptables"); assert_eq!( args, vec!["-w", "-L", "veth-5-8_weird^name-counter", "-Z", "-x", "-v"] ); Ok(Output { stdout: b"Chain veth-5-8_weird^name-counter (2 references) pkts bytes target prot opt in out source destination 4567 123456 all -- any eth1 anywhere anywhere 201 455840 all -- any veth-5-8_weird^name anywhere anywhere 87 5873 all -- veth-5-8_weird^name any anywhere anywhere 288 461713 RETURN all -- any any anywhere anywhere 42 6666 all -- eth1 any anywhere anywhere" .to_vec(), stderr: b"".to_vec(), status: ExitStatus::from_raw(0), }) } _ => panic!("Unexpected call {} {:?} {:?}", counter, program, args), } })); let (input_counter, output_counter) = KI .read_iface_counters("veth-5-8_weird^name") .expect("Unable to parse iface counters"); assert_eq!(input_counter.bytes, 5873); assert_eq!(input_counter.packets, 87); assert_eq!(output_counter.bytes, 455840); assert_eq!(output_counter.packets, 201); }
rust_cleaned_test_functions.jsonl/62403
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1010 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6443, 67666, 85632, 368, 341, 262, 990, 1460, 486, 436, 486, 56646, 486, 4630, 486, 15339, 2522, 6756, 280, 262, 990, 1460, 486, 4630, 486, 15339, 2522, 280, 262, 990, 1460, 486, 4630, 486, 5097...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_sub() { let cases = vec![ ( ".00012345000098765", "123.45", Res::Ok("-123.44987654999901235"), ), ( "1234500009876.5", ".00012345000098765", Res::Ok("1234500009876.49987654999901235"), ), ("9999900000000.5", ".555", Res::Ok("9999899999999.945")), ("1111.5551", "1111.555", Res::Ok("0.0001")), (".555", ".555", Res::Ok("0")), ("10000000", "1", Res::Ok("9999999")), ("1000001000", ".1", Res::Ok("1000000999.9")), ("1000000000", ".1", Res::Ok("999999999.9")), ("12345", "123.45", Res::Ok("12221.55")), ("-12345", "-123.45", Res::Ok("-12221.55")), ("123.45", "12345", Res::Ok("-12221.55")), ("-123.45", "-12345", Res::Ok("12221.55")), ("-12345", "123.45", Res::Ok("-12468.45")), ("12345", "-123.45", Res::Ok("12468.45")), ("3.10000000000", "2.00", Res::Ok("1.10000000000")), ("3.00", "2.0000000000000", Res::Ok("1.0000000000000")), ( "-20048271934704078000000000000000000000000000000000000", "-20048271934734512000000000000000000000000000000000000", Res::Ok("30434000000000000000000000000000000000000"), ), ]; for (lhs_str, rhs_str, exp) in cases { let lhs = lhs_str.parse::<Decimal>().unwrap(); let rhs = rhs_str.parse::<Decimal>().unwrap(); let res_dec = &lhs - &rhs; let res = res_dec.map(|s| s.to_string()); assert_eq!(res, exp.map(|s| s.to_owned())); } }
rust_cleaned_test_functions.jsonl/13665
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 991 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5228, 368, 341, 286, 1077, 5048, 284, 7486, 90515, 310, 2399, 394, 5933, 15, 15, 15, 16, 17, 18, 19, 20, 15, 15, 15, 15, 24, 23, 22, 21, 20, 756, 394, 330, 16, 17, 18, 13, 19, 20, 756,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_update_nft_ext_info_len_error() { let (mut context, tx) = create_test_context( Action::Update(UpdateCase::AddExtInfo), NftError::NFTAllowAddExtInfoShortError, ); let tx = context.complete_tx(tx); // run let err = context.verify_tx(&tx, MAX_CYCLES).unwrap_err(); let script_cell_index = 0; assert_error_eq!( err, ScriptError::ValidationFailure(NFT_EXT_INFO_LEN_ERROR).input_type_script(script_cell_index) ); }
rust_cleaned_test_functions.jsonl/33599
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 220 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 8882, 1089, 723, 9927, 3109, 6043, 4096, 368, 341, 262, 1077, 320, 6984, 2266, 11, 9854, 8, 284, 1855, 4452, 8467, 1006, 286, 5586, 486, 4289, 7, 4289, 4207, 486, 2212, 6756, 1731, 1326, 286, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_comment() { let options = options(); let comment = comment_block( "comment", &[], &vec![Element::Expression(vec![], "This is a test".to_string())], &options, ); assert_eq!( comment.unwrap().render(&mut Default::default()).unwrap(), None ); }
rust_cleaned_test_functions.jsonl/9227
{ "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, 17638, 368, 341, 286, 1077, 2606, 284, 2606, 543, 286, 1077, 3980, 284, 3980, 7113, 1006, 310, 330, 6182, 756, 310, 44590, 1259, 310, 609, 4083, 20703, 1691, 486, 9595, 25592, 0, 12995, 330, 198...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_increment() { let mut register = GearRegister::init(); let mut compound = GearCompound::new(&mut register, 1, 1); let add = register .instantiator(register.internal.math_gears.add) .instantiate(); let one = Literal::instantiate(&mut register, TypedValue::U64(1)); compound.connect(compound.input_id, 0, add, 0); compound.connect(one, 0, add, 1); compound.connect(add, 0, compound.output_id, 0); let gear = register .builder(compound.into()) .name(String::from("Increment")) .input(IOInformation::new( String::from("number"), TypedValue::I32(Default::default()).ty(), )) .output(IOInformation::new( String::from("incremented"), TypedValue::I32(Default::default()).ty(), )) .instantiate(); assert_eq!( register.evaluate(gear, vec![TypedValue::U64(0)]).unwrap()[0], TypedValue::U64(1) ); }
rust_cleaned_test_functions.jsonl/98621
{ "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, 51482, 368, 341, 286, 1077, 5206, 4161, 284, 27503, 8690, 486, 2327, 1428, 286, 1077, 5206, 23628, 284, 27503, 43134, 486, 931, 2099, 6984, 4161, 11, 220, 16, 11, 220, 16, 317, 286, 1077, 912, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_tips_no_deltas() { let (mut db, _dir) = create_test_db(); let contract_address_a: ContractAddress = [7u8; 32].into(); let key_type_a = Stype::State; let dk_a = DeltaKey { contract_address: contract_address_a, key_type: key_type_a }; let v_a = b"Enigma_a"; let contract_address_b: ContractAddress = [4u8; 32].into(); let key_type_b = Stype::ByteCode; let dk_b = DeltaKey { contract_address: contract_address_b, key_type: key_type_b }; let v_b = b"Enigma_b"; db.create(&dk_a, &v_a[..]).unwrap(); db.create(&dk_b, &v_b[..]).unwrap(); let _accepted_tips: Vec<(DeltaKey, Vec<u8>)> = db.get_tips(&[contract_address_a, contract_address_b]).unwrap(); }
rust_cleaned_test_functions.jsonl/48698
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 364 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 528, 3077, 6536, 814, 71906, 368, 341, 286, 1077, 320, 6984, 2927, 11, 716, 3741, 8, 284, 1855, 4452, 8685, 1428, 286, 1077, 5116, 6744, 4306, 25, 19185, 4286, 284, 508, 22, 84, 23, 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_example_bingo() { let draws = [ 7, 4, 9, 5, 11, 17, 23, 2, 0, 14, 21, 24, 10, 16, 13, 6, 15, 25, 12, 22, 18, 20, 8, 19, 3, 26, 1, ]; let boards = [ [ [22, 13, 17, 11, 0], [8, 2, 23, 4, 24], [21, 9, 14, 16, 7], [6, 10, 3, 18, 5], [1, 12, 20, 15, 19], ], [ [3, 15, 0, 2, 22], [9, 18, 13, 17, 5], [19, 8, 7, 25, 23], [20, 11, 10, 24, 4], [14, 21, 16, 12, 6], ], [ [14, 21, 17, 24, 4], [10, 16, 15, 9, 19], [18, 8, 23, 26, 20], [22, 11, 13, 6, 5], [2, 0, 12, 3, 7], ], ]; let mut bingo_boards: Vec<Board<5, 5>> = Vec::new(); for board in boards { bingo_boards.push(Board::build_board_from_array(&board)); } assert_eq!(4512, play_bingo(&mut bingo_boards, &draws)); }
rust_cleaned_test_functions.jsonl/130765
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 740 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 39304, 880, 27908, 368, 341, 286, 1077, 26643, 284, 2278, 310, 220, 22, 11, 220, 19, 11, 220, 24, 11, 220, 20, 11, 220, 16, 16, 11, 220, 16, 22, 11, 220, 17, 18, 11, 220, 17, 11, 220, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_timestamp_seconds_with_frac_systemtime() { let zero = SystemTime::UNIX_EPOCH; let one_second = SystemTime::UNIX_EPOCH .checked_add(Duration::new(1, 0)) .unwrap(); let half_second = SystemTime::UNIX_EPOCH .checked_add(Duration::new(0, 500_000_000)) .unwrap(); let minus_one_second = SystemTime::UNIX_EPOCH .checked_sub(Duration::new(1, 0)) .unwrap(); let minus_half_second = SystemTime::UNIX_EPOCH .checked_sub(Duration::new(0, 500_000_000)) .unwrap(); #[serde_as] #[derive(Debug, Serialize, Deserialize, PartialEq)] struct Structf64Strict(#[serde_as(as = "TimestampSecondsWithFrac<f64>")] SystemTime); is_equal(Structf64Strict(zero), expect![[r#"0.0"#]]); is_equal(Structf64Strict(one_second), expect![[r#"1.0"#]]); is_equal(Structf64Strict(minus_one_second), expect![[r#"-1.0"#]]); is_equal(Structf64Strict(half_second), expect![[r#"0.5"#]]); is_equal(Structf64Strict(minus_half_second), expect![[r#"-0.5"#]]); check_error_deserialization::<Structf64Strict>( r#""1""#, expect![[r#"invalid type: string "1", expected f64 at line 1 column 3"#]], ); #[serde_as] #[derive(Debug, Serialize, Deserialize, PartialEq)] struct Structf64Flexible( #[serde_as(as = "TimestampSecondsWithFrac<f64, Flexible>")] SystemTime, ); is_equal(Structf64Flexible(zero), expect![[r#"0.0"#]]); is_equal(Structf64Flexible(one_second), expect![[r#"1.0"#]]); is_equal(Structf64Flexible(minus_one_second), expect![[r#"-1.0"#]]); is_equal(Structf64Flexible(half_second), expect![[r#"0.5"#]]); is_equal(Structf64Flexible(minus_half_second), expect![[r#"-0.5"#]]); check_deserialization(Structf64Flexible(one_second), r#""1""#); check_deserialization(Structf64Flexible(one_second), r#"1.0"#); check_deserialization(Structf64Flexible(minus_half_second), r#""-0.5""#); check_deserialization(Structf64Flexible(half_second), r#"0.5"#); check_error_deserialization::<Structf64Flexible>( r#""a""#, expect![[ r#"invalid value: string "a", expected an integer, a float, or a string containing a number at line 1 column 3"# ]], ); #[serde_as] #[derive(Debug, Serialize, Deserialize, PartialEq)] struct StructStringStrict(#[serde_as(as = "TimestampSecondsWithFrac<String>")] SystemTime); is_equal(StructStringStrict(zero), expect![[r#""0""#]]); is_equal(StructStringStrict(one_second), expect![[r#""1""#]]); is_equal(StructStringStrict(minus_one_second), expect![[r#""-1""#]]); is_equal(StructStringStrict(half_second), expect![[r#""0.5""#]]); is_equal( StructStringStrict(minus_half_second), expect![[r#""-0.5""#]], ); check_error_deserialization::<StructStringStrict>( r#"1"#, expect![[r#"invalid type: integer `1`, expected a string at line 1 column 1"#]], ); check_error_deserialization::<StructStringStrict>( r#"0.0"#, expect![[r#"invalid type: floating point `0`, expected a string at line 1 column 3"#]], ); #[serde_as] #[derive(Debug, Serialize, Deserialize, PartialEq)] struct StructStringFlexible( #[serde_as(as = "TimestampSecondsWithFrac<String, Flexible>")] SystemTime, ); is_equal(StructStringFlexible(zero), expect![[r#""0""#]]); is_equal(StructStringFlexible(one_second), expect![[r#""1""#]]); is_equal(StructStringFlexible(minus_one_second), expect![[r#""-1""#]]); is_equal(StructStringFlexible(half_second), expect![[r#""0.5""#]]); is_equal( StructStringFlexible(minus_half_second), expect![[r#""-0.5""#]], ); check_deserialization(StructStringFlexible(one_second), r#"1"#); check_deserialization(StructStringFlexible(one_second), r#"1.0"#); check_deserialization(StructStringFlexible(half_second), r#"0.5"#); check_error_deserialization::<StructStringFlexible>( r#""a""#, expect![[ r#"invalid value: string "a", expected an integer, a float, or a string containing a number at line 1 column 3"# ]], ); }
rust_cleaned_test_functions.jsonl/105403
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1867 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 23073, 34825, 6615, 70358, 17687, 1678, 368, 341, 262, 1077, 7168, 284, 739, 1462, 486, 99089, 2089, 69945, 280, 262, 1077, 825, 29644, 284, 739, 1462, 486, 99089, 2089, 69945, 198, 286, 659, 7549...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_move_a_b() { let mut cpu: CPU = CPU::new(); cpu = cpu.set_a(Register { value: 0 }); cpu = cpu.set_b(Register { value: 10 }); cpu = execute_move(cpu, 0b000, 0b001); assert_eq!(cpu.pc.value, 0); assert_eq!(cpu.f.value, 0); assert_eq!(cpu.a.value, 10); }
rust_cleaned_test_functions.jsonl/123558
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 175 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 17134, 4306, 880, 368, 341, 286, 1077, 5206, 17319, 25, 13940, 284, 13940, 486, 931, 1428, 286, 17319, 284, 17319, 980, 4306, 79203, 314, 897, 25, 220, 15, 1625, 286, 17319, 284, 17319, 980, 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_spoofed_vote() { process_instruction_as_one_arg( &vote( &invalid_vote_state_pubkey(), &Pubkey::new_unique(), Vote::default(), ), Err(InstructionError::InvalidAccountOwner), ); process_instruction_as_one_arg( &update_vote_state( &invalid_vote_state_pubkey(), &Pubkey::default(), VoteStateUpdate::default(), ), Err(InstructionError::InvalidAccountOwner), ); }
rust_cleaned_test_functions.jsonl/83687
{ "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, 643, 5368, 1055, 291, 54360, 368, 341, 286, 1882, 54923, 11898, 11667, 6057, 1006, 310, 609, 29358, 1006, 394, 609, 11808, 54360, 4387, 34014, 792, 3148, 394, 609, 29162, 792, 486, 931, 21218, 314...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_include_additions() { let entry = Entry { components: Vec::new(), value: b"42".to_vec(), }; let mut result = Vec::new(); parse_database(b"#include\"test\"", &mut result, |file, result| { assert_eq!(file, b"test"); result.push(entry.clone()); }); assert_eq!(result, [entry]); }
rust_cleaned_test_functions.jsonl/113435
{ "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, 37878, 2891, 5930, 368, 341, 286, 1077, 4343, 284, 15788, 341, 310, 6813, 25, 11312, 486, 931, 3148, 310, 897, 25, 293, 1, 19, 17, 3263, 983, 13251, 3148, 286, 2605, 286, 1077, 5206, 1102, 284...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_hoisted_function6() { test( concat!( "var debug = 1;", "a();", "function b() { return debug; }", "function a() { return b(); }" ), "var debug; a(); function b() { return 1; } function a() { return b(); }", ); }
rust_cleaned_test_functions.jsonl/27731
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 165 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1523, 78, 13236, 9174, 21, 368, 341, 262, 1273, 1006, 286, 33720, 33673, 310, 330, 947, 7390, 284, 220, 16, 64497, 310, 330, 64, 2129, 756, 310, 330, 1688, 293, 368, 314, 470, 7390, 26, 335, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_save_pdf() { let k = Kaleido::new(); let dst = PathBuf::from("example.pdf"); let r = k.save(dst.as_path(), TEST_PLOT, "pdf", 1200, 900, 4.5); assert!(r.is_ok()); assert!(std::fs::remove_file(dst.as_path()).is_ok()); }
rust_cleaned_test_functions.jsonl/33870
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 148 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 15376, 39948, 368, 341, 286, 1077, 595, 284, 96742, 5249, 486, 931, 543, 286, 1077, 10648, 284, 7933, 15064, 486, 1499, 445, 8687, 15995, 797, 286, 1077, 435, 284, 595, 5681, 30260, 5357, 2638, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_list_index_methods() { let db = TemporaryDB::default(); let fork = db.fork(); let mut list_index = fork.get_sparse_list(IDX_NAME); assert!(list_index.is_empty()); assert_eq!(0, list_index.capacity()); assert!(list_index.get(0).is_none()); assert_eq!(None, list_index.pop()); let extended_by = vec![45, 3422, 234]; list_index.extend(extended_by); assert!(!list_index.is_empty()); assert_eq!(Some(45), list_index.get(0)); assert_eq!(Some(3422), list_index.get(1)); assert_eq!(Some(234), list_index.get(2)); assert_eq!(3, list_index.capacity()); assert_eq!(3, list_index.len()); assert_eq!(Some(234), list_index.set(2, 777)); assert_eq!(Some(777), list_index.get(2)); assert_eq!(3, list_index.capacity()); assert_eq!(3, list_index.len()); let extended_by_again = vec![666, 999]; for el in &extended_by_again { list_index.push(*el); } assert_eq!(Some(666), list_index.get(3)); assert_eq!(Some(999), list_index.get(4)); assert_eq!(5, list_index.capacity()); assert_eq!(5, list_index.len()); assert_eq!(Some(3422), list_index.remove(1)); assert_eq!(None, list_index.remove(1)); assert_eq!(5, list_index.capacity()); assert_eq!(4, list_index.len()); assert_eq!(Some(777), list_index.remove(2)); assert_eq!(5, list_index.capacity()); assert_eq!(3, list_index.len()); assert_eq!(Some(45), list_index.pop()); assert_eq!(5, list_index.capacity()); assert_eq!(2, list_index.len()); assert_eq!(Some(666), list_index.pop()); assert_eq!(5, list_index.capacity()); assert_eq!(1, list_index.len()); list_index.push(42); assert_eq!(6, list_index.capacity()); assert_eq!(2, list_index.len()); assert_eq!(Some(999), list_index.pop()); assert_eq!(6, list_index.capacity()); assert_eq!(1, list_index.len()); assert_eq!(Some(42), list_index.pop()); assert_eq!(6, list_index.capacity()); assert_eq!(0, list_index.len()); assert_eq!(None, list_index.pop()); // check that capacity gets overwritten by bigger index correctly assert_eq!(None, list_index.set(42, 1024)); assert_eq!(43, list_index.capacity()); list_index.clear(); assert_eq!(0, list_index.len()); }
rust_cleaned_test_functions.jsonl/29222
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1204 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2019, 3560, 36084, 368, 341, 286, 1077, 2927, 284, 54448, 3506, 486, 2258, 543, 286, 1077, 22435, 284, 2927, 833, 669, 543, 286, 1077, 5206, 1140, 3560, 284, 22435, 670, 71123, 2019, 18742, 55, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_pow_mod_large() { let q = Scalar::new_modulus(12289); let two = Scalar::new(2); let mut a: Scalar = Scalar::from_u64_raw(3); a = Scalar::modulus(&a, &q); for _ in 0..10 { a = Scalar::pow_mod(&a, &two, &q); assert!(a.rep < q.rep); } }
rust_cleaned_test_functions.jsonl/1932
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 192 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 56183, 7480, 45228, 368, 341, 286, 1077, 2804, 284, 35176, 486, 931, 7480, 19425, 7, 16, 17, 17, 23, 24, 317, 286, 1077, 1378, 284, 35176, 486, 931, 7, 17, 317, 286, 1077, 5206, 264, 25, 351...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_global_timer() { let handle = super::GLOBAL_TIMER_HANDLE.clone(); let delay = handle.delay(::std::time::Instant::now() + std::time::Duration::from_millis(100)); let timer = Instant::now(); block_on(delay.compat()).unwrap(); assert!(timer.saturating_elapsed() >= Duration::from_millis(100)); }
rust_cleaned_test_functions.jsonl/1909
{ "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, 19296, 16255, 368, 341, 286, 1077, 3705, 284, 2256, 486, 16492, 31833, 23683, 15997, 543, 286, 1077, 7626, 4035, 310, 3705, 40620, 38732, 1834, 486, 1678, 486, 30340, 486, 3328, 368, 488, 1460, 48...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_linuxcontainer_get_process() { let _ = new_linux_container_and_then(|mut c: LinuxContainer| { c.processes.insert( 1, Process::new(&sl!(), &oci::Process::default(), "123", true, 1).unwrap(), ); let p = c.get_process("123"); assert!(p.is_ok(), "Expecting Ok, Got {:?}", p); Ok(()) }); }
rust_cleaned_test_functions.jsonl/16628
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 226 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 77463, 3586, 3062, 11305, 368, 341, 286, 1077, 716, 284, 501, 77463, 15847, 8378, 68367, 22428, 6984, 272, 25, 14340, 4502, 91, 341, 310, 272, 16988, 288, 7030, 1006, 394, 220, 16, 345, 394, 860...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_multipart_stream_uploads() { init_logging(); let bucket_name = format!("test-bucket-{}-{}", "multipart".to_owned(), get_time().sec); let test_client = TestS3Client::new(bucket_name.clone()); test_client.create_test_bucket(bucket_name.clone()); let multipart_filename = format!("test_multipart_file_{}", get_time().sec); let credentials = DefaultCredentialsProvider::new() .unwrap() .credentials() .wait() .unwrap(); // test put via multipart upload test_multipart_upload( &test_client.s3, &test_client.region, &credentials, &test_client.bucket_name, &multipart_filename, ); // PUT an object via stream let streaming_filename = format!("streaming_test_file_{}", get_time().sec); test_put_object_stream_with_filename( &test_client.s3, &test_client.bucket_name, &streaming_filename, &"tests/sample-data/binary-file", ); test_delete_object( &test_client.s3, &test_client.bucket_name, &multipart_filename, ); test_delete_object( &test_client.s3, &test_client.bucket_name, &streaming_filename, ) }
rust_cleaned_test_functions.jsonl/112578
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 568 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 717, 18204, 12673, 62, 19374, 368, 341, 262, 2930, 59982, 1428, 262, 1077, 15621, 1269, 284, 3561, 17223, 1944, 1455, 11152, 12, 6257, 12, 42351, 330, 29542, 3263, 983, 51973, 1507, 633, 3009, 100...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_signature_jwt_hs384_invalid() { let p1 = json!({ "key1" : "val1", "key2" : "val2", "key3" : "val3" }); let secret = "secret123".to_string(); let header = json!({}); let jwt1 = encode(header, &secret, &p1, Algorithm::HS384).unwrap(); let bad_secret = "secret1234".to_string(); let maybe_res = validate_signature(&jwt1, &bad_secret, Algorithm::HS384); assert!(!maybe_res.unwrap()); }
rust_cleaned_test_functions.jsonl/45844
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 264 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 42681, 39859, 95576, 85956, 18, 23, 19, 31433, 368, 341, 286, 1077, 281, 16, 284, 2951, 0, 2262, 310, 330, 792, 16, 1, 549, 330, 831, 16, 756, 310, 330, 792, 17, 1, 549, 330, 831, 17, 756,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_seq_concat() { let gil = Python::acquire_gil(); let py = gil.python(); let v: Vec<i32> = vec![1, 2, 3]; let ob = v.to_object(py); let seq = ob.cast_as::<PySequence>(py).unwrap(); let concat_seq = seq.concat(&seq).unwrap(); assert_eq!(6, concat_seq.len().unwrap()); let concat_v: Vec<i32> = vec![1, 2, 3, 1, 2, 3]; for (el, cc) in concat_seq.iter().unwrap().zip(concat_v) { assert_eq!(cc, el.unwrap().extract::<i32>().unwrap()); } }
rust_cleaned_test_functions.jsonl/47420
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 293 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14486, 57478, 368, 341, 286, 1077, 342, 321, 284, 13027, 486, 580, 984, 1889, 321, 543, 286, 1077, 4510, 284, 342, 321, 43193, 543, 286, 1077, 348, 25, 11312, 21897, 18, 17, 29, 284, 7486, 207...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_symlink_dangling_file() { let (at, mut ucmd) = at_and_ucmd!(); let file = "test_symlink_dangling_file"; let link = "test_symlink_dangling_file_link"; ucmd.args(&["-s", file, link]).succeeds().no_stderr(); assert!(!at.file_exists(file)); assert!(at.is_symlink(link)); assert_eq!(at.resolve_link(link), file); }
rust_cleaned_test_functions.jsonl/4878
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 169 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 58530, 44243, 814, 90104, 2458, 368, 341, 262, 1077, 320, 266, 11, 5206, 575, 8710, 8, 284, 518, 8378, 68887, 2277, 0, 543, 262, 1077, 1034, 284, 330, 1944, 58530, 44243, 814, 90104, 2458, 876, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_push_row() { let date_value: Date<Tz> = UTC.ymd(2016, 10, 22); let date_time_value: DateTime<Tz> = UTC.ymd(2014, 7, 8).and_hms(14, 0, 0); let decimal = Decimal::of(2.0_f64, 4); let mut block = Block::<Simple>::new(); block .push(row! { i8_field: 1_i8, i16_field: 1_i16, i32_field: 1_i32, i64_field: 1_i64, u8_field: 1_u8, u16_field: 1_u16, u32_field: 1_u32, u64_field: 1_u64, f32_field: 4.66_f32, f64_field: 2.71_f64, str_field: "text", opt_filed: Some("text"), nil_filed: Option::<&str>::None, date_field: date_value, date_time_field: date_time_value, decimal_field: decimal }) .unwrap(); assert_eq!(block.row_count(), 1); assert_eq!(block.columns[0].sql_type(), SqlType::Int8); assert_eq!(block.columns[1].sql_type(), SqlType::Int16); assert_eq!(block.columns[2].sql_type(), SqlType::Int32); assert_eq!(block.columns[3].sql_type(), SqlType::Int64); assert_eq!(block.columns[4].sql_type(), SqlType::UInt8); assert_eq!(block.columns[5].sql_type(), SqlType::UInt16); assert_eq!(block.columns[6].sql_type(), SqlType::UInt32); assert_eq!(block.columns[7].sql_type(), SqlType::UInt64); assert_eq!(block.columns[8].sql_type(), SqlType::Float32); assert_eq!(block.columns[9].sql_type(), SqlType::Float64); assert_eq!(block.columns[10].sql_type(), SqlType::String); assert_eq!( block.columns[11].sql_type(), SqlType::Nullable(SqlType::String.into()) ); assert_eq!( block.columns[12].sql_type(), SqlType::Nullable(SqlType::String.into()) ); assert_eq!(block.columns[13].sql_type(), SqlType::Date); assert_eq!( block.columns[14].sql_type(), SqlType::DateTime(DateTimeType::DateTime32) ); assert_eq!(block.columns[15].sql_type(), SqlType::Decimal(18, 4)); }
rust_cleaned_test_functions.jsonl/27927
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1260 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14218, 8530, 368, 341, 286, 1077, 2400, 3142, 25, 2631, 3125, 89, 29, 284, 27403, 13, 1600, 67, 7, 17, 15, 16, 21, 11, 220, 16, 15, 11, 220, 17, 17, 317, 286, 1077, 2400, 3009, 3142, 25, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_typedef_to_std() { let hdr = indoc! {" #include <string> typedef std::string my_string; inline uint32_t take_str(my_string a) { return a.size(); } "}; let rs = quote! { use ffi::ToCppString; assert_eq!(ffi::take_str("hello".into_cpp()), 5); }; run_test("", hdr, rs, &["take_str"], &[]); }
rust_cleaned_test_functions.jsonl/9861
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 206 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 42111, 4219, 2346, 15656, 368, 341, 262, 1077, 36615, 284, 1257, 509, 0, 314, 698, 286, 671, 997, 366, 917, 397, 286, 13501, 1460, 486, 917, 847, 3904, 280, 286, 7381, 2622, 18, 17, 528, 1896,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_overlaps() { let mut collider = Collider::<TestHbProfile>::new(4.0, 0.25); collider.add_hitbox( 0.into(), Shape::square(2.0).place(v2(-5.0, 0.0)).moving(v2(1.0, 0.0)), ); collider.add_hitbox(1.into(), Shape::circle(2.0).place(v2(0.0, 0.0)).still()); collider.add_hitbox( 2.into(), Shape::circle(2.0) .place(v2(10.0, 0.0)) .moving(v2(-1.0, 0.0)), ); let test_shape = Shape::circle(2.0).place(v2(-1.0, 0.5)); assert_eq!( collider.query_overlaps(&test_shape, &5.into()), vec![1.into()] ); advance(&mut collider, 3.0); assert_eq!( sort(collider.query_overlaps(&test_shape, &5.into())), vec![0.into(), 1.into()] ); }
rust_cleaned_test_functions.jsonl/36383
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 422 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5738, 15431, 89722, 368, 341, 262, 1077, 5206, 65544, 284, 73821, 27638, 2271, 39, 65, 8526, 6831, 931, 7, 19, 13, 15, 11, 220, 15, 13, 17, 20, 626, 262, 65544, 1364, 37697, 2011, 1006, 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_borrowing_example() { let mut x = Table::new(); x.add_rows( vec![vec![Nil, Nil, Obj("Hello")], vec![Num(101.into())], vec![]] .into_iter() .map(|x| x.into_iter()), ); let mut brw = Table::new(); brw.add_rows(x.rows()); assert_eq!(brw, x); }
rust_cleaned_test_functions.jsonl/4485
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 171 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 880, 7768, 287, 39304, 368, 341, 262, 1077, 5206, 856, 284, 6633, 486, 931, 543, 262, 856, 1364, 10949, 1006, 286, 7486, 20703, 4083, 20703, 19064, 11, 32274, 11, 26639, 445, 9707, 899, 1125, 74...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_pruned_different_schema() { test_helpers::maybe_start_logging(); // column1 > 100 where let observer = TestObserver::new(); let c1 = Arc::new( TestChunk::new("chunk1") .with_i64_field_column_with_stats("column1", Some(0), Some(100)) .with_i64_field_column_with_stats("column2", Some(0), Some(4)), ); let c2 = Arc::new( TestChunk::new("chunk2") .with_i64_field_column_with_stats("column1", Some(0), Some(1000)) .with_i64_field_column_with_stats("column2", Some(0), Some(4)), ); let c3 = Arc::new(TestChunk::new("chunk3").with_i64_field_column_with_stats( "column2", Some(0), Some(4), )); let predicate = PredicateBuilder::new() .add_expr(col("column1").gt(lit(100))) .build(); let pruned = prune_chunks(&observer, vec![c1, c2, c3], &predicate); assert_eq!( observer.events(), vec![ "chunk1: Pruned", "chunk3: Could not prune chunk: Can not evaluate pruning predicate" ] ); assert_eq!(names(&pruned), vec!["chunk2", "chunk3"]); }
rust_cleaned_test_functions.jsonl/47399
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 712 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5294, 48883, 82741, 25371, 368, 341, 286, 1273, 54473, 486, 36760, 4906, 59982, 543, 286, 442, 3250, 16, 861, 220, 16, 15, 15, 1380, 8945, 16885, 286, 1077, 22067, 284, 3393, 17151, 486, 931, 54...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_permissions_request_run() { let guard = PERMISSION_PROMPT_GUARD.lock().unwrap(); let mut perms0 = DenoPermissions::from_flags(&Flags { ..Default::default() }); set_prompt_result(true); assert_eq!(perms0.request_run(), PermissionState::Allow); let mut perms1 = DenoPermissions::from_flags(&Flags { ..Default::default() }); set_prompt_result(false); assert_eq!(perms1.request_run(), PermissionState::Deny); drop(guard); }
rust_cleaned_test_functions.jsonl/78058
{ "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, 44767, 7893, 14007, 368, 341, 262, 1077, 7616, 284, 96540, 71346, 2828, 84513, 7376, 21003, 1005, 15454, 543, 262, 1077, 5206, 82282, 15, 284, 9774, 78, 23851, 486, 1499, 14130, 2099, 9195, 341, 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_read_block_with_invalid_block_size() { let data = { let mut eof = BGZF_EOF.to_vec(); // BSIZE = 0 eof[16] = 0x00; eof[17] = 0x00; eof }; let mut reader = &data[..]; let mut cdata = Vec::new(); let mut block = Block::default(); assert!(read_block(&mut reader, &mut cdata, &mut block).is_err()); }
rust_cleaned_test_functions.jsonl/46146
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 238 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6443, 7113, 6615, 31433, 7113, 2368, 368, 341, 286, 1077, 821, 284, 341, 310, 1077, 5206, 76760, 284, 43011, 90814, 89287, 2389, 13251, 543, 310, 442, 425, 20494, 284, 220, 15, 198, 310, 76760, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_relative() { let base: Url = "sc://%C3%B1".parse().unwrap(); let url = base.join("/resources/testharness.js").unwrap(); assert_eq!(url.as_str(), "sc://%C3%B1/resources/testharness.js"); }
rust_cleaned_test_functions.jsonl/79035
{ "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, 29286, 368, 341, 262, 1077, 2331, 25, 22840, 284, 330, 2388, 86791, 34, 18, 49157, 16, 3263, 6400, 1005, 15454, 543, 262, 1077, 2515, 284, 2331, 5446, 4283, 12745, 12697, 71, 23518, 2857, 1827, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_method_completion() { check_ref_completion( "method_completion", r" struct A {} impl A { fn the_method(&self) {} } fn foo(a: A) { a.<|> } ", ); }
rust_cleaned_test_functions.jsonl/53645
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 213 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9032, 60164, 368, 341, 286, 1779, 7793, 60164, 1006, 310, 330, 4393, 60164, 756, 310, 435, 698, 310, 2036, 362, 5613, 310, 11605, 362, 341, 394, 5168, 279, 9032, 2099, 721, 8, 5613, 310, 456, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_flags_from_vec_27() { let (flags, subcommand, argv) = flags_from_vec(svec![ "deno", "run", "--importmap=importmap.json", "script.ts" ]); assert_eq!( flags, DenoFlags { import_map_path: Some("importmap.json".to_owned()), ..DenoFlags::default() } ); assert_eq!(subcommand, DenoSubcommand::Run); assert_eq!(argv, svec!["deno", "script.ts"]); let (flags, subcommand, argv) = flags_from_vec(svec!["deno", "--importmap=importmap.json", "script.ts"]); assert_eq!( flags, DenoFlags { import_map_path: Some("importmap.json".to_owned()), ..DenoFlags::default() } ); assert_eq!(subcommand, DenoSubcommand::Run); assert_eq!(argv, svec!["deno", "script.ts"]); let (flags, subcommand, argv) = flags_from_vec(svec![ "deno", "fetch", "--importmap=importmap.json", "script.ts" ]); assert_eq!( flags, DenoFlags { import_map_path: Some("importmap.json".to_owned()), ..DenoFlags::default() } ); assert_eq!(subcommand, DenoSubcommand::Fetch); assert_eq!(argv, svec!["deno", "script.ts"]); }
rust_cleaned_test_functions.jsonl/112856
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 604 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14130, 5673, 13251, 62, 17, 22, 368, 341, 262, 1077, 320, 11161, 11, 1186, 5631, 11, 10213, 8, 284, 8042, 5673, 13251, 1141, 4083, 90515, 414, 330, 5183, 78, 756, 414, 330, 6108, 756, 414, 144...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_key_manager_create_get_delete() { let _guard = LOCK_FOR_GAUGE.lock().unwrap(); let tmp_dir = tempfile::TempDir::new().unwrap(); let manager = new_key_manager_def(&tmp_dir, None).unwrap(); let new_file = manager.new_file("foo").unwrap(); let get_file = manager.get_file("foo").unwrap(); assert_eq!(new_file, get_file); manager.delete_file("foo").unwrap(); manager.delete_file("foo").unwrap(); manager.delete_file("foo1").unwrap(); // Must be plaintext if file not found. assert_eq!(manager.get_file_exists("foo").unwrap(), None,); let manager = new_key_manager_def(&tmp_dir, Some(EncryptionMethod::Aes192Ctr)).unwrap(); assert_eq!(manager.get_file_exists("foo").unwrap(), None,); // Must fail if key is specified but not found. let file = FileInfo { method: EncryptionMethod::Aes192Ctr as _, key_id: 7, // Not exists ..Default::default() }; manager .dicts .file_dict .lock() .unwrap() .files .insert("foo".to_owned(), file); assert_eq!( manager.get_file_exists("foo").unwrap_err().kind(), ErrorKind::NotFound, ); }
rust_cleaned_test_functions.jsonl/22017
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 634 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3097, 12144, 8657, 3062, 11353, 368, 341, 286, 1077, 716, 26098, 284, 49463, 14516, 2646, 32, 47644, 21003, 1005, 15454, 543, 286, 1077, 4174, 4334, 284, 54819, 486, 12151, 6184, 486, 931, 1005, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_visibility() { assert_eq!(*visibility::FOO, Box::new(0)); assert_eq!(*visibility::inner::BAG, Box::new(37)); }
rust_cleaned_test_functions.jsonl/17559
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 64 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 71256, 368, 341, 262, 2060, 10714, 0, 4071, 28176, 486, 3788, 46, 11, 8261, 486, 931, 7, 15, 1106, 262, 2060, 10714, 0, 4071, 28176, 486, 4382, 486, 33, 1890, 11, 8261, 486, 931, 7, 18, 22, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_enrich_tf1x_histogram_empty() { let hp = pb::HistogramProto::default(); let v = EventValue::Summary(SummaryValue(Box::new(Value::Histo(hp)))); assert_eq!( v.into_tensor(&blank("histogram", pb::DataClass::Tensor)), Ok(pb::TensorProto { dtype: pb::DataType::DtDouble.into(), tensor_shape: Some(tensor_shape(&[0, 3])), ..Default::default() }) ); }
rust_cleaned_test_functions.jsonl/6206
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 303 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6205, 13851, 47719, 16, 87, 68564, 15124, 368, 341, 310, 1077, 20630, 284, 17310, 486, 77210, 31549, 486, 2258, 543, 310, 1077, 348, 284, 3665, 1130, 486, 19237, 3759, 372, 1534, 1130, 67758, 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_fold_at_word_boundary_preserve_final_newline() { new_ucmd!() .args(&["-w4", "-s"]) .pipe_in("one two\n") .succeeds() .stdout_is("one \ntwo\n"); }
rust_cleaned_test_functions.jsonl/23282
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 117 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 61187, 3752, 13533, 54004, 32116, 5852, 20676, 5921, 1056, 368, 341, 262, 501, 68887, 2277, 0, 741, 286, 659, 2116, 2099, 1183, 12, 86, 19, 497, 6523, 82, 14108, 286, 659, 13768, 1243, 445, 603,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_rgb_u8() { test_image_sum_u8("rgb-3c-8b.tiff", ColorType::RGB(8), 7842108); }
rust_cleaned_test_functions.jsonl/75196
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 59 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 37407, 7300, 23, 368, 341, 262, 1273, 4954, 10160, 7300, 23, 445, 16509, 12, 18, 66, 12, 23, 65, 734, 3092, 497, 3478, 929, 486, 18184, 7, 23, 701, 220, 22, 23, 19, 17, 16, 15, 23, 317, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_bb_empty() { let mut bb = ByteBuffer::default(); assert_eq!(bb.as_slice(), &[]); assert_eq!(bb.as_mut_slice(), &[]); assert_eq!(bb.destroy_into_vec(), &[]); }
rust_cleaned_test_functions.jsonl/11781
{ "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, 50255, 15124, 368, 341, 286, 1077, 5206, 16520, 284, 50299, 486, 2258, 543, 286, 2060, 10714, 10297, 6066, 5357, 26488, 1507, 609, 56703, 286, 2060, 10714, 10297, 6066, 5357, 29523, 26488, 1507, 609...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_select() { assert_eq!( parse_select("select [a, b, c]"), Ok(("", Transformation::Select(vec!["a", "b", "c"]))) ); assert_eq!( parse_select( "select [ a, b, c ]" ), Ok(("", Transformation::Select(vec!["a", "b", "c"]))) ); }
rust_cleaned_test_functions.jsonl/104934
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 197 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21039, 13051, 368, 341, 262, 2060, 10714, 33673, 286, 4715, 13051, 445, 1742, 508, 64, 11, 293, 11, 272, 60, 4461, 286, 7622, 7, 19814, 53652, 486, 3379, 25592, 0, 1183, 64, 497, 330, 65, 497,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_entity_encode() { let entity = Entity::from_address(EntityType::HoldingRegister, 1876); let mut buffer = [0; 8]; assert_eq!(entity.encode_to_str(&mut buffer), Ok("41877".as_bytes())); assert_eq!( entity.encode_to_str_ext(&mut buffer), Ok("401877".as_bytes()) ); let entity = Entity::from_address(EntityType::DiscreteInput, 3); assert_eq!(entity.encode_to_str(&mut buffer), Ok("10004".as_bytes())); assert_eq!( entity.encode_to_str_ext(&mut buffer), Ok("100004".as_bytes()) ); assert_eq!( entity.encode_to_str(&mut buffer[..4]), Err(error::Error::InvalidLength) ); assert_eq!( entity.encode_to_str_ext(&mut buffer[..5]), Err(error::Error::InvalidLength) ); }
rust_cleaned_test_functions.jsonl/104435
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 454 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 19169, 11224, 368, 341, 286, 1077, 5387, 284, 10390, 486, 1499, 6744, 33761, 929, 486, 39, 14995, 8690, 11, 220, 16, 23, 22, 21, 317, 286, 1077, 5206, 4147, 284, 508, 15, 26, 220, 23, 4821, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_read_sized_early_eof() { let mut bytes = &b"foo bar"[..]; let mut decoder = Decoder::length(10); assert_eq!(decoder.decode(&mut bytes).unwrap().unwrap().len(), 7); let e = decoder.decode(&mut bytes).unwrap_err(); assert_eq!(e.kind(), io::ErrorKind::UnexpectedEof); }
rust_cleaned_test_functions.jsonl/13923
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 152 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6443, 643, 1506, 62, 22140, 90792, 368, 341, 286, 1077, 5206, 5820, 284, 609, 65, 1, 7975, 3619, 36864, 496, 935, 286, 1077, 5206, 24551, 284, 50472, 486, 4129, 7, 16, 15, 317, 286, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_duration_as_json() { test_none_with_ctx(cast_any_as_any::<Duration, Json>); // TODO: add more case let cs = vec![ ( Duration::zero(), Json::String("00:00:00.000000".to_string()), ), ( Duration::parse(b"10:10:10", 0).unwrap(), Json::String("10:10:10.000000".to_string()), ), ]; for (input, expect) in cs { let mut ctx = EvalContext::default(); let result = cast_any_as_any::<Duration, Json>(&mut ctx, &Some(input)); let log = make_log(&input, &expect, &result); check_result(Some(&expect), &result, log.as_str()); } }
rust_cleaned_test_functions.jsonl/101819
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 413 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 25454, 11898, 9455, 368, 341, 286, 1273, 31488, 6615, 15147, 1337, 559, 37248, 11898, 37248, 27638, 12945, 11, 8308, 29, 626, 286, 442, 5343, 25, 912, 803, 1142, 198, 286, 1077, 10532, 284, 7486, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_unsafe_recovery_has_commit_merge() { let mut cluster = new_node_cluster(0, 3); configure_for_merge(&mut cluster); cluster.run(); cluster.must_put(b"k1", b"v1"); cluster.must_put(b"k3", b"v3"); let pd_client = Arc::clone(&cluster.pd_client); pd_client.disable_default_operator(); let region = pd_client.get_region(b"k1").unwrap(); cluster.must_split(&region, b"k2"); let left = pd_client.get_region(b"k1").unwrap(); let right = pd_client.get_region(b"k3").unwrap(); let left_on_store1 = find_peer(&left, 1).unwrap(); cluster.must_transfer_leader(left.get_id(), left_on_store1.clone()); let right_on_store1 = find_peer(&right, 1).unwrap(); cluster.must_transfer_leader(right.get_id(), right_on_store1.clone()); // will only be replicated but not committed. let recv_filter = Box::new( RegionPacketFilter::new(right.get_id(), 1) .direction(Direction::Recv) .msg_type(MessageType::MsgAppendResponse), ); cluster.sim.wl().add_recv_filter(1, recv_filter); pd_client.merge_region(left.get_id(), right.get_id()); // Wait until the commit merge is proposed. sleep_ms(300); // Send a empty recovery plan to trigger report. let plan = pdpb::RecoveryPlan::default(); pd_client.must_set_unsafe_recovery_plan(1, plan); cluster.must_send_store_heartbeat(1); let mut store_report = None; for _ in 0..20 { store_report = pd_client.must_get_store_report(1); if store_report.is_some() { break; } sleep_ms(200); } assert_ne!(store_report, None); let mut has_commit_merge = false; for peer_report in store_report.unwrap().get_peer_reports().iter() { if peer_report.get_region_state().get_region().get_id() == right.get_id() && peer_report.get_has_commit_merge() { has_commit_merge = true; } } assert!(has_commit_merge); }
rust_cleaned_test_functions.jsonl/6012
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 873 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4907, 18675, 91475, 21778, 36346, 20888, 368, 341, 262, 1077, 5206, 10652, 284, 501, 5084, 28441, 7, 15, 11, 220, 18, 317, 262, 14411, 5478, 20888, 2099, 6984, 10652, 626, 262, 10652, 7634, 1428, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_iterate_into_string() { let words = vec!["hello", " ", "world"]; let capitalized_words: String = words.iter().map(|x| capitalize_first(x)).collect(); assert_eq!(capitalized_words, "Hello World"); }
rust_cleaned_test_functions.jsonl/32069
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 105 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11723, 349, 45514, 3904, 368, 341, 286, 1077, 4244, 284, 7486, 0, 1183, 14990, 497, 330, 3670, 330, 14615, 6332, 286, 1077, 97321, 18981, 25, 923, 220, 284, 4244, 19471, 1005, 2186, 22428, 87, 9...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_conversion() { assert_eq!(CloseCode::try_from(4000).unwrap(), CloseCode::UnknownError); assert_eq!(CloseCode::try_from(4001).unwrap(), CloseCode::UnknownOpcode); assert_eq!(CloseCode::try_from(4002).unwrap(), CloseCode::DecodeError); assert_eq!( CloseCode::try_from(4003).unwrap(), CloseCode::NotAuthenticated ); assert_eq!( CloseCode::try_from(4004).unwrap(), CloseCode::AuthenticationFailed ); assert_eq!( CloseCode::try_from(4005).unwrap(), CloseCode::AlreadyAuthenticated ); assert_eq!( CloseCode::try_from(4007).unwrap(), CloseCode::InvalidSequence ); assert_eq!(CloseCode::try_from(4008).unwrap(), CloseCode::RateLimited); assert_eq!( CloseCode::try_from(4009).unwrap(), CloseCode::SessionTimedOut ); assert_eq!(CloseCode::try_from(4010).unwrap(), CloseCode::InvalidShard); assert_eq!( CloseCode::try_from(4011).unwrap(), CloseCode::ShardingRequired ); assert_eq!( CloseCode::try_from(4012).unwrap(), CloseCode::InvalidApiVersion ); assert_eq!( CloseCode::try_from(4013).unwrap(), CloseCode::InvalidIntents ); assert_eq!( CloseCode::try_from(4014).unwrap(), CloseCode::DisallowedIntents ); assert!(CloseCode::try_from(5000).is_err()); }
rust_cleaned_test_functions.jsonl/4567
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 798 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 64132, 368, 341, 286, 2060, 10714, 10297, 7925, 2078, 486, 1539, 5673, 7, 19, 15, 15, 15, 568, 15454, 1507, 13032, 2078, 486, 13790, 1454, 317, 286, 2060, 10714, 10297, 7925, 2078, 486, 1539, 56...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_exchange_new_account_not_unallocated() { panoptes_logger::setup(); let (bank, mint_keypair) = create_bank(10_000); let (client, owner) = create_client(bank, mint_keypair); let new = create_token_account(&client, &owner); let instruction = exchange_instruction::account_request(&owner.pubkey(), &new); client .send_and_confirm_instruction(&owner, instruction) .expect_err(&format!("{}:{}", line!(), file!())); }
rust_cleaned_test_functions.jsonl/56976
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 221 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 59212, 5921, 13500, 7913, 4907, 57372, 368, 341, 286, 7215, 2912, 288, 27413, 486, 15188, 543, 286, 1077, 320, 17033, 11, 28337, 3097, 12670, 8, 284, 1855, 35733, 7, 16, 15, 62, 15, 15, 15, 31...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_rpc_get_slot_leader() { let rpc = RpcHandler::start(); let request = create_test_request("getSlotLeader", None); let result: String = parse_success_result(rpc.handle_request_sync(request)); let expected = rpc.leader_pubkey().to_string(); assert_eq!(result, expected); }
rust_cleaned_test_functions.jsonl/6295
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 140 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 60799, 3062, 27563, 79991, 368, 341, 286, 1077, 35596, 284, 79961, 3050, 486, 2468, 543, 286, 1077, 1681, 284, 1855, 4452, 7893, 445, 455, 19877, 52621, 497, 2240, 317, 286, 1077, 1102, 25, 923, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_bad_convert() { let v = ValueRef::from(42_u16); match u32::from_sql(v) { Ok(_) => panic!("should fail"), Err(e) => assert_eq!( "From SQL error: `SqlType::UInt16 cannot be cast to u32.`".to_string(), format!("{}", e) ), } }
rust_cleaned_test_functions.jsonl/93986
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 197 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 34199, 34910, 368, 341, 286, 1077, 348, 284, 5162, 3945, 486, 1499, 7, 19, 17, 7300, 16, 21, 317, 286, 2432, 575, 18, 17, 486, 1499, 18063, 3747, 8, 341, 310, 7622, 48139, 589, 21975, 17223, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_dead_entity_is_deleted() { let mut store = World::default(); let entity_1 = store.insert_entity().unwrap(); let entity_2 = store.insert_entity().unwrap(); query!( mutate store { EntityId, HpComponent, .insert(entity_1, HpComponent { hp: 0, hp_max: 123 }); EntityId, HpComponent, .insert(entity_2, HpComponent { hp: 50, hp_max: 123 }); EventKey, Events<EntityDied>, .insert(Default::default()); } ); let entities: Vec<_> = store .view::<EntityId, HpComponent>() .iter() .map(|(id, _)| id) .collect(); assert_eq!(entities, vec![entity_1, entity_2]); death_update( FromWorldMut::from_world_mut(&mut store), FromWorld::from_world(&mut store), ); store.post_process(); let entities: Vec<_> = store .view::<EntityId, HpComponent>() .iter() .map(|(id, _)| id) .collect(); assert_eq!(entities, vec![entity_2]); }
rust_cleaned_test_functions.jsonl/115698
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 712 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 53427, 19169, 6892, 39418, 368, 341, 286, 1077, 5206, 3553, 284, 4337, 486, 2258, 1428, 286, 1077, 5387, 62, 16, 284, 3553, 7030, 19169, 1005, 15454, 543, 286, 1077, 5387, 62, 17, 284, 3553, 703...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_latest_version() { wrapper(|env| { let db = env.db(); env.fake_release().name("foo").version("0.0.1").create()?; env.fake_release().name("foo").version("0.0.3").create()?; env.fake_release().name("foo").version("0.0.2").create()?; for version in &["0.0.1", "0.0.2", "0.0.3"] { let details = CrateDetails::new(&mut *db.conn(), "foo", version, version, None) .unwrap() .unwrap(); assert_eq!( details.latest_release().version, semver::Version::parse("0.0.3")? ); } Ok(()) }) }
rust_cleaned_test_functions.jsonl/6497
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 421 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 64880, 9438, 368, 341, 286, 13261, 22428, 3160, 91, 341, 310, 1077, 2927, 284, 6105, 7076, 1428, 310, 6105, 94624, 24577, 1005, 606, 445, 7975, 1827, 4366, 445, 15, 13, 15, 13, 16, 1827, 3182, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
6
#[test] fn test_gen_vec() { let mut r = task_rng(); assert_eq!(r.gen_iter::<u8>().take(0).count(), 0u); assert_eq!(r.gen_iter::<u8>().take(10).count(), 10u); assert_eq!(r.gen_iter::<f64>().take(16).count(), 16u); }
rust_cleaned_test_functions.jsonl/23764
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 140 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 16322, 13251, 368, 341, 286, 1077, 5206, 435, 284, 3383, 66849, 543, 286, 2060, 10714, 10297, 81, 22822, 11723, 27638, 84, 23, 10483, 22769, 7, 15, 568, 1830, 1507, 220, 15, 84, 317, 286, 2060, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_execute_script_return_value() { let mut runtime = JsRuntime::new(Default::default()); let value_global = runtime.execute_script("a.js", "a = 1 + 2").unwrap(); { let scope = &mut runtime.handle_scope(); let value = value_global.get(scope); assert_eq!(value.integer_value(scope).unwrap(), 3); } let value_global = runtime.execute_script("b.js", "b = 'foobar'").unwrap(); { let scope = &mut runtime.handle_scope(); let value = value_global.get(scope); assert!(value.is_string()); assert_eq!( value.to_string(scope).unwrap().to_rust_string_lossy(scope), "foobar" ); } }
rust_cleaned_test_functions.jsonl/23452
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 290 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 44329, 14660, 12511, 3142, 368, 341, 262, 1077, 5206, 15592, 284, 39122, 15123, 486, 931, 87874, 486, 2258, 1423, 262, 1077, 897, 19296, 284, 15592, 7769, 14660, 445, 64, 2857, 497, 330, 64, 284, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_add() { for elm in sum_triples.iter() { let (a_vec, b_vec, c_vec) = *elm; let a = BigUint::from_slice(a_vec); let b = BigUint::from_slice(b_vec); let c = BigUint::from_slice(c_vec); assert!(a + b == c); assert!(b + a == c); } }
rust_cleaned_test_functions.jsonl/96898
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 205 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2891, 368, 341, 286, 369, 42205, 304, 2629, 3547, 37458, 19471, 368, 341, 310, 1077, 320, 64, 13251, 11, 293, 13251, 11, 272, 13251, 8, 284, 353, 23162, 280, 310, 1077, 264, 284, 6164, 21570, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_extend_ref() { let mut a = "foo".to_string(); a.extend(&['b', 'a', 'r']); assert_eq!(&a, "foobar"); }
rust_cleaned_test_functions.jsonl/3183
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 71 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 70265, 7793, 368, 341, 262, 1077, 5206, 264, 284, 330, 7975, 3263, 983, 3904, 543, 262, 264, 15831, 2099, 677, 65, 516, 364, 64, 516, 364, 81, 21906, 262, 2060, 10714, 0, 2099, 64, 11, 330, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_translate_invalid_cm_fails() { let input = json!({ "exposes": [ { } ] }); let res = translate(&format!("{}", input)); assert_matches!(res, Err(Error::Parse(_))); }
rust_cleaned_test_functions.jsonl/24879
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 164 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 66381, 31433, 43619, 761, 6209, 368, 341, 286, 1077, 1946, 284, 2951, 0, 2262, 310, 330, 327, 8285, 788, 2278, 394, 341, 394, 456, 310, 5133, 286, 3011, 286, 1077, 592, 284, 14683, 2099, 2243, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_add_carry_assign_decimal() { let mut d = DecimalDigit(0u8); let overflow = d.add_carry_assign(DecimalDigit(47), false); assert!(!overflow); assert_eq!(d, DecimalDigit(47)); let mut d = DecimalDigit(50u8); let overflow = d.add_carry_assign(DecimalDigit(49), false); assert!(!overflow); assert_eq!(d, DecimalDigit(99)); let mut d = DecimalDigit(50u8); let overflow = d.add_carry_assign(DecimalDigit(49), true); assert!(overflow); assert_eq!(d, DecimalDigit(0)); let mut d = DecimalDigit(50u8); let overflow = d.add_carry_assign(DecimalDigit(50), false); assert!(overflow); assert_eq!(d, DecimalDigit(0)); let mut d = DecimalDigit(50u8); let overflow = d.add_carry_assign(DecimalDigit(55), true); assert!(overflow); assert_eq!(d, DecimalDigit(6)); let mut d = DecimalDigit(50u16); let overflow = d.add_carry_assign(DecimalDigit(9_900), true); assert!(!overflow); assert_eq!(d, DecimalDigit(9_951)); let mut d = DecimalDigit(5000u16); let overflow = d.add_carry_assign(DecimalDigit(9_900), false); assert!(overflow); assert_eq!(d, DecimalDigit(4_900)); let mut d = DecimalDigit(50u32); let overflow = d.add_carry_assign(DecimalDigit(999_001_100), false); assert!(!overflow); assert_eq!(d, DecimalDigit(999_001_150)); let mut d = DecimalDigit(1_001_234u32); let overflow = d.add_carry_assign(DecimalDigit(999_781_234), true); assert!(overflow); assert_eq!(d, DecimalDigit(782_469)); let mut d = DecimalDigit(9_999_999_999_999_999_999u64); let overflow = d.add_carry_assign(DecimalDigit(0), true); assert!(overflow); assert_eq!(d, DecimalDigit(0)); let mut d = DecimalDigit(9_999_999_999_999_999_999u64); let overflow = d.add_carry_assign(DecimalDigit(46), false); assert!(overflow); assert_eq!(d, DecimalDigit(45)); let mut d = DecimalDigit(9_999_999_999_999_999_999u64); let overflow = d.add_carry_assign(DecimalDigit(9_999_999_999_999_999_999), true); assert!(overflow); assert_eq!(d, DecimalDigit(9_999_999_999_999_999_999)); }
rust_cleaned_test_functions.jsonl/26390
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1156 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2891, 666, 11433, 20688, 74429, 741, 262, 341, 286, 1077, 5206, 294, 284, 26728, 36420, 7, 15, 84, 23, 317, 286, 1077, 16484, 284, 294, 1364, 666, 11433, 20688, 7, 11269, 36420, 7, 19, 22, 701...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_decryption_failure_counter() { let clock = Clock::default(); let key = TestKey { fail_on_decrypt: true, ..Default::default() }; let mut keyset = KeySet::new(key, Default::default()); let mut data = [0; 128]; let remote_address = SocketAddress::default(); let connection_info = ConnectionInfo::new(&remote_address); let decoder_buffer = DecoderBufferMut::new(&mut data); let (encoded_packet, _remaining) = ProtectedShort::decode(0, decoder_buffer, &connection_info, &20).unwrap(); let encrypted_packet = encoded_packet .unprotect( &TestHeaderKey::default(), PacketNumberSpace::ApplicationData.new_packet_number(VarInt::from_u8(0)), ) .unwrap(); assert_eq!(keyset.decryption_error_count(), 0); assert!(keyset .decrypt_packet( encrypted_packet, PacketNumberSpace::ApplicationData.new_packet_number(VarInt::from_u8(0)), clock.get_time(), ) .is_err()); assert_eq!(keyset.decryption_error_count(), 1); }
rust_cleaned_test_functions.jsonl/61048
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 589 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 13783, 15597, 43618, 15730, 368, 341, 286, 1077, 8866, 284, 26142, 486, 2258, 543, 286, 1077, 1376, 284, 3393, 1592, 341, 310, 3690, 4470, 80764, 25, 830, 345, 310, 5241, 3675, 486, 2258, 741, 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_seraizlie() { let serializer = StringSerializer::default(); let mut buf = Vec::new(); let data = vec![230, 181, 139, 232, 175, 149]; serializer.serialize_to("topic", "测试", &mut buf).unwrap(); assert_eq!(&buf, &data); assert_eq!(serializer.serialize("topic", "测试").unwrap(), Bytes::from(data)); }
rust_cleaned_test_functions.jsonl/110127
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 171 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 643, 2416, 449, 11567, 368, 341, 286, 1077, 21759, 284, 923, 13909, 486, 2258, 543, 286, 1077, 5206, 6607, 284, 11312, 486, 931, 543, 286, 1077, 821, 284, 7486, 20703, 17, 18, 15, 11, 220, 16,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_chunk_ordering() { let images = get_testimages("o", "", false); for path in images.iter() { assert!(match load_image(path) { Ok(_) => { true }, Err(err) => {println!("file {:?}, failed with {:?}", path.display(), err); false } }) } }
rust_cleaned_test_functions.jsonl/26482
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 174 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 30539, 7869, 287, 368, 341, 286, 1077, 5335, 284, 633, 4452, 3642, 445, 78, 497, 7342, 895, 626, 286, 369, 1815, 304, 5335, 19471, 368, 341, 310, 2060, 10297, 6347, 2795, 4954, 5581, 8, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_unary_op() { let tests = vec![ (ScalarFuncSig::UnaryNot, Datum::I64(1), Some(0)), (ScalarFuncSig::UnaryNot, Datum::I64(0), Some(1)), (ScalarFuncSig::UnaryNot, Datum::I64(123), Some(0)), (ScalarFuncSig::UnaryNot, Datum::I64(-123), Some(0)), (ScalarFuncSig::UnaryNot, Datum::Null, None), (ScalarFuncSig::RealIsTrue, Datum::F64(0.25), Some(1)), (ScalarFuncSig::RealIsTrue, Datum::F64(0.0), Some(0)), (ScalarFuncSig::RealIsTrue, Datum::Null, Some(0)), (ScalarFuncSig::RealIsFalse, Datum::F64(0.25), Some(0)), (ScalarFuncSig::RealIsFalse, Datum::F64(0.000), Some(1)), (ScalarFuncSig::RealIsFalse, Datum::F64(-0.00), Some(1)), (ScalarFuncSig::RealIsFalse, Datum::F64(-0.011), Some(0)), (ScalarFuncSig::RealIsFalse, Datum::Null, Some(0)), (ScalarFuncSig::RealIsNull, Datum::F64(1.25), Some(0)), (ScalarFuncSig::RealIsNull, Datum::Null, Some(1)), (ScalarFuncSig::DecimalIsTrue, str2dec("1.1"), Some(1)), (ScalarFuncSig::DecimalIsTrue, str2dec("0"), Some(0)), (ScalarFuncSig::DecimalIsTrue, Datum::Null, Some(0)), (ScalarFuncSig::DecimalIsFalse, str2dec("1.1"), Some(0)), (ScalarFuncSig::DecimalIsFalse, str2dec("0"), Some(1)), (ScalarFuncSig::DecimalIsFalse, Datum::Null, Some(0)), (ScalarFuncSig::DecimalIsNull, str2dec("1.1"), Some(0)), (ScalarFuncSig::DecimalIsNull, Datum::Null, Some(1)), (ScalarFuncSig::IntIsTrue, Datum::I64(0), Some(0)), (ScalarFuncSig::IntIsTrue, Datum::I64(12), Some(1)), (ScalarFuncSig::IntIsTrue, Datum::Null, Some(0)), (ScalarFuncSig::IntIsFalse, Datum::I64(0), Some(1)), (ScalarFuncSig::IntIsFalse, Datum::I64(1), Some(0)), (ScalarFuncSig::IntIsFalse, Datum::Null, Some(0)), (ScalarFuncSig::IntIsNull, Datum::I64(1), Some(0)), (ScalarFuncSig::IntIsNull, Datum::Null, Some(1)), (ScalarFuncSig::StringIsNull, Datum::Null, Some(1)), ( ScalarFuncSig::StringIsNull, Datum::Bytes(b"abc".to_vec()), Some(0), ), (ScalarFuncSig::TimeIsNull, Datum::Null, Some(1)), // TODO: add Time related tests after Time is implemented in Expression::build ( ScalarFuncSig::DurationIsNull, Datum::Dur(Duration::zero()), Some(0), ), (ScalarFuncSig::DurationIsNull, Datum::Null, Some(1)), ]; let mut ctx = EvalContext::default(); for (op, arg, exp) in tests { let arg1 = datum_expr(arg); let op = Expression::build(&ctx, scalar_func_expr(op, &[arg1])).unwrap(); let res = op.eval_int(&mut ctx, &[]).unwrap(); assert_eq!(res, exp); } }
rust_cleaned_test_functions.jsonl/16152
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1673 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4907, 658, 10287, 368, 341, 286, 1077, 7032, 284, 7486, 90515, 310, 320, 20639, 9626, 47246, 486, 94545, 2623, 11, 68459, 486, 40, 21, 19, 7, 16, 701, 4329, 7, 15, 6965, 310, 320, 20639, 9626,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_drop_query_and_replace() { let mut state = State::new("GET", "www.example.com", "/path/to/something?foo=bar"); state.clear_value(); state.move_value_to_part(RequestPart::Query); state.move_string_to_value("another=query"); state.move_value_to_part(RequestPart::Query); state.move_string_to_value("/another/path"); state.test_value_equals("/another/path"); state.move_value_to_part(RequestPart::Path); assert_eq!( state.key(), "GET www.example.com /another/path?another=query" ); }
rust_cleaned_test_functions.jsonl/101351
{ "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, 4387, 29584, 5738, 8378, 10633, 368, 341, 220, 1077, 5206, 1584, 284, 3234, 486, 931, 445, 3806, 497, 330, 2136, 7724, 905, 497, 3521, 2343, 32429, 2687, 11532, 30, 7975, 28, 2257, 3071, 220, 15...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_frame_null_context_lines() { let mut frame = Annotated::new(Frame { pre_context: Annotated::new(vec![Annotated::default(), Annotated::new("".to_string())]), post_context: Annotated::new(vec![Annotated::new("".to_string()), Annotated::default()]), ..Frame::default() }); let mut processor = NormalizeProcessor::default(); process_value(&mut frame, &mut processor, ProcessingState::root()).unwrap(); let frame = frame.value().unwrap(); assert_eq_dbg!( *frame.pre_context.value().unwrap(), vec![ Annotated::new("".to_string()), Annotated::new("".to_string()) ], ); assert_eq_dbg!( *frame.post_context.value().unwrap(), vec![ Annotated::new("".to_string()), Annotated::new("".to_string()) ], ); }
rust_cleaned_test_functions.jsonl/14100
{ "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, 8929, 15162, 8467, 18323, 368, 341, 262, 1077, 5206, 4034, 284, 1527, 87029, 486, 931, 91008, 341, 286, 855, 8467, 25, 1527, 87029, 486, 931, 25592, 20703, 2082, 87029, 486, 2258, 1507, 1527, 8702...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_file() { let mut p = Parcel { label: Label { sha256: "yubbadubbadoonow".to_owned(), name: "water".to_owned(), media_type: WASM_MEDIA_TYPE.to_owned(), size: 1234, annotations: None, feature: None, }, conditions: Some(Condition { member_of: None, requires: None, }), }; assert!(!super::is_file(&p)); let mut features = BTreeMap::new(); let mut wagifeatures = BTreeMap::new(); wagifeatures.insert("file".to_owned(), "true".to_owned()); features.insert("wagi".to_owned(), wagifeatures); p.label.feature = Some(features); assert!(super::is_file(&p)); }
rust_cleaned_test_functions.jsonl/82235
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 450 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6892, 2458, 368, 341, 286, 1077, 5206, 281, 284, 42994, 341, 310, 2383, 25, 9402, 341, 394, 15870, 17, 20, 21, 25, 330, 88, 392, 13855, 20683, 2123, 263, 363, 3263, 983, 51973, 3148, 394, 829,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_json_logical_expression() { let n = LogicalExpr { base: BaseNode::default(), operator: LogicalOperator::OrOperator, left: Expression::Boolean(BooleanLit { base: BaseNode::default(), value: false, }), right: Expression::Boolean(BooleanLit { base: BaseNode::default(), value: true, }), }; let serialized = serde_json::to_string(&n).unwrap(); assert_eq!( serialized, r#"{"type":"LogicalExpression","operator":"or","left":{"type":"BooleanLiteral","value":false},"right":{"type":"BooleanLiteral","value":true}}"# ); let deserialized: LogicalExpr = serde_json::from_str(serialized.as_str()).unwrap(); assert_eq!(deserialized, n) }
rust_cleaned_test_functions.jsonl/40433
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 354 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 9455, 86484, 28068, 368, 341, 262, 1077, 308, 284, 62069, 16041, 341, 286, 2331, 25, 5351, 1955, 486, 2258, 3148, 286, 5675, 25, 62069, 18461, 486, 2195, 18461, 345, 286, 2115, 25, 16378, 486, 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_no_proxy() { let server = server! { request: b"\ GET /4 HTTP/1.1\r\n\ user-agent: $USERAGENT\r\n\ accept: */*\r\n\ accept-encoding: gzip\r\n\ host: $HOST\r\n\ \r\n\ ", response: b"\ HTTP/1.1 200 OK\r\n\ Server: test\r\n\ Content-Length: 0\r\n\ \r\n\ " }; let proxy = format!("http://{}", server.addr()); let url = format!("http://{}/4", server.addr()); // set up proxy and use no_proxy to clear up client builder proxies. let res = reqwest::Client::builder() .proxy( reqwest::Proxy::http(&proxy).unwrap() ) .no_proxy() .build() .unwrap() .get(&url) .send() .unwrap(); assert_eq!(res.url().as_str(), &url); assert_eq!(res.status(), reqwest::StatusCode::OK); }
rust_cleaned_test_functions.jsonl/15937
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 536 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6536, 29712, 368, 341, 262, 1077, 3538, 284, 3538, 0, 341, 286, 1681, 25, 293, 83383, 310, 7890, 608, 19, 10130, 14, 16, 13, 16, 12016, 1699, 5661, 310, 1196, 41935, 25, 400, 6448, 90315, 1201...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_mut() { let mut m = RwLock::new(NonCopy(10)); *m.get_mut() = NonCopy(20); assert_eq!(m.into_inner(), NonCopy(20)); }
rust_cleaned_test_functions.jsonl/15758
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 91 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3062, 29523, 368, 341, 286, 1077, 5206, 296, 284, 55294, 11989, 486, 931, 7, 8121, 12106, 7, 16, 15, 1106, 286, 353, 76, 670, 29523, 368, 284, 11581, 12106, 7, 17, 15, 317, 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
#[test] fn test_pop_ident() { let mut conn = TestConn::default(); conn.sanitized_partition_map(); let t = r#" [{:db/ident :test/entid :db/doc "test" :db.schema/version 1}] "#; let partition_map0 = conn.partition_map.clone(); let schema0 = conn.schema.clone(); let report1 = assert_transact!(conn, t); let partition_map1 = conn.partition_map.clone(); let schema1 = conn.schema.clone(); let (new_schema, new_partition_map) = move_from_main_timeline( &conn.sqlite, &conn.schema, conn.partition_map.clone(), conn.last_tx_id().., 1, ) .expect("moved single tx"); update_conn(&mut conn, &new_schema, &new_partition_map); assert_matches!(conn.datoms(), "[]"); assert_matches!(conn.transactions(), "[]"); assert_eq!(conn.partition_map, partition_map0); assert_eq!(conn.schema, schema0); let report2 = assert_transact!(conn, t); assert_eq!(report1.tx_id, report2.tx_id); assert_eq!(conn.partition_map, partition_map1); assert_eq!(conn.schema, schema1); assert_matches!( conn.datoms(), r#" [[?e :db/ident :test/entid] [?e :db/doc "test"] [?e :db.schema/version 1]] "# ); assert_matches!( conn.transactions(), r#" [[[?e :db/ident :test/entid ?tx true] [?e :db/doc "test" ?tx true] [?e :db.schema/version 1 ?tx true] [?tx :db/txInstant ?ms ?tx true]]] "# ); }
rust_cleaned_test_functions.jsonl/93661
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 910 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 17061, 38399, 368, 341, 286, 1077, 5206, 4534, 284, 3393, 9701, 486, 2258, 543, 286, 4534, 514, 276, 83443, 43840, 5376, 1428, 286, 1077, 259, 284, 435, 2, 698, 310, 18466, 25, 1999, 14, 1713, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_quality_item_from_str1() { let x: ::Result<QualityItem<Encoding>> = "chunked".parse(); assert_eq!(x.unwrap(), QualityItem{ item: Chunked, quality: Quality(1000), }); }
rust_cleaned_test_functions.jsonl/65732
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 91 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 55074, 5634, 5673, 2895, 16, 368, 341, 286, 1077, 856, 25, 3504, 2077, 32380, 10733, 1234, 27, 14690, 2452, 284, 330, 25979, 291, 3263, 6400, 543, 286, 2060, 10714, 10297, 87, 55395, 1507, 17927, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_data_kind_info_to_kind() { assert_eq!(DataKindInfo::new(DataKind::Skipped).to_kind().unwrap(), DataKind::Skipped); assert_eq!(DataKindInfo::new(DataKind::Zeroes).to_kind().unwrap(), DataKind::Zeroes); assert_eq!( DataKindInfo::new(DataKind::Unmodified).to_kind().unwrap(), DataKind::Unmodified ); assert_eq!(DataKindInfo::new(DataKind::Modified).to_kind().unwrap(), DataKind::Modified); }
rust_cleaned_test_functions.jsonl/51125
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 216 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 1769, 33162, 3109, 2346, 33162, 368, 341, 286, 2060, 10714, 10297, 1043, 10629, 1731, 486, 931, 18959, 10629, 486, 19290, 6450, 568, 983, 33162, 1005, 15454, 1507, 2885, 10629, 486, 19290, 6450, 317...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_parentheses() { assert_eq!(eval("(1+1)"), 2.); assert_eq!(eval("2*(2+1)"), 6.); assert_eq!(eval("(2+1)*2"), 6.); assert_eq!(eval("(2+1)*(2+3)"), 15.); assert_eq!(eval("(2*1)+(2*3)"), 8.); assert_eq!(eval("(4*(1+2))*2"), 24.); assert_eq!(eval("(4+(1+2))+2"), 9.); assert_eq!(eval("2*(2+1*2)"), 8.); assert_eq!(eval("2*(2-1*2)"), 0.); assert_eq!(eval("-(2)"), -2.); assert_eq!(eval("-(-1)"), 1.); assert_eq!(eval("(2*2)*(1+2)-4"), 8.); assert_eq!(eval("(2*2)-(1+2)*4"), -8.); assert_eq!(eval("2*(1-2*4)"), -14.); }
rust_cleaned_test_functions.jsonl/556
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 405 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 620, 9151, 38322, 368, 341, 286, 2060, 10714, 10297, 14170, 31732, 16, 10, 16, 8, 3975, 220, 17, 58957, 286, 2060, 10714, 10297, 14170, 445, 17, 6599, 17, 10, 16, 8, 3975, 220, 21, 58957, 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_max_shortest_path1() { const INPUT: &str = "^WNE$"; let (_, pattern) = parse(INPUT.as_bytes()).expect("parser failed"); let mut graph = Graph::new(); pattern.walk(&mut graph, vec![(0, 0)]); let dist = shortest_paths(&graph); let max_shortest_path = dist.iter().map(|(_, &d)| d).max().unwrap(); assert_eq!(max_shortest_path, 3); }
rust_cleaned_test_functions.jsonl/7640
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 194 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 6345, 16673, 477, 2638, 16, 368, 341, 286, 733, 26149, 25, 609, 495, 284, 39915, 54, 3944, 3, 876, 286, 1077, 39464, 5383, 8, 284, 4715, 57911, 5357, 12524, 6011, 17119, 445, 9657, 4641, 797, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_genesis_issuers_balance_overflow() { let storage = ImplStorage::new(Arc::new(MemoryAdapter::new())); let chain_db = DefaultChainQuerier::new(Arc::new(storage)); let trie = MPTTrie::new(Arc::new(MemoryDB::new(false))); let state = GeneralServiceState::new(trie); let sdk = DefaultServiceSDK::new( Rc::new(RefCell::new(state)), Rc::new(chain_db), NoopDispatcher {}, ); let admin = Address::from_hex(ADMIN).unwrap(); let caller = Address::from_hex(CALLER).unwrap(); let mut service = AssetService::new(sdk); let asset_id = Hash::digest(Bytes::from_static(b"test")); let genesis = InitGenesisPayload { id: asset_id, name: "test".to_owned(), symbol: "TEST".to_owned(), supply: 1000, precision: 10, issuers: vec![ IssuerWithBalance::new(admin.clone(), u64::MAX), IssuerWithBalance::new(caller, 500), ], fee_account: admin.clone(), fee: 1, admin, relayable: true, }; service.init_genesis(genesis); }
rust_cleaned_test_functions.jsonl/27240
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 498 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 16322, 13774, 62, 1038, 83425, 29396, 79073, 368, 341, 262, 1077, 5819, 284, 88092, 5793, 486, 931, 4346, 1287, 486, 931, 3189, 4731, 5940, 486, 931, 7392, 262, 1077, 8781, 8685, 284, 7899, 18837,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_not_inline_mut_variable() { check_assist_not_applicable( inline_local_variable, " fn foo() { let mut a<|> = 1 + 1; a + 1; }", ); }
rust_cleaned_test_functions.jsonl/60317
{ "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, 7913, 41871, 29523, 14635, 368, 341, 286, 1779, 12083, 380, 7913, 8191, 46114, 1006, 310, 7381, 13564, 14635, 345, 310, 6228, 8822, 15229, 368, 341, 262, 1077, 5206, 264, 27, 91, 29, 284, 220, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_auto_import_split_self_for_use() { check_assist( add_import, " use std::fmt; impl std::fmt::Debug<|> for Foo { } ", " use std::fmt::{ self, Debug, }; impl Debug<|> for Foo { } ", ); }
rust_cleaned_test_functions.jsonl/39952
{ "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, 27740, 18434, 17052, 25637, 5478, 15951, 368, 341, 286, 1779, 12083, 380, 1006, 310, 912, 18434, 345, 310, 6228, 810, 1460, 486, 12501, 401, 6383, 1460, 486, 12501, 486, 7939, 27, 91, 29, 369, 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_duration() { let time_duration = DBDuration(555687); let str_time_duration = serde_json::to_string(&time_duration).unwrap(); assert_eq!("555687", str_time_duration); assert_eq!( time_duration, serde_json::from_str(str_time_duration.as_str()).unwrap() ); }
rust_cleaned_test_functions.jsonl/130046
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 168 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 25454, 368, 341, 286, 1077, 882, 25454, 284, 5952, 12945, 7, 20, 20, 20, 21, 23, 22, 317, 286, 1077, 607, 3009, 25454, 284, 61570, 9455, 486, 983, 3904, 2099, 1678, 25454, 568, 15454, 1428, 28...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_from_bytes_mod_order() { let l_plus_two_bytes: [u8; 32] = [ 0xef, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, ]; let curve_scalar = CurveScalar::from_bytes_mod_order(l_plus_two_bytes); let two: Scalar = Scalar::one() + Scalar::one(); assert_eq!(curve_scalar.scalar, two); }
rust_cleaned_test_functions.jsonl/65702
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 325 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 5673, 12524, 7480, 7869, 368, 341, 1789, 286, 1077, 326, 28043, 23241, 12524, 25, 508, 84, 23, 26, 220, 18, 17, 60, 284, 2278, 310, 220, 15, 47510, 11, 220, 15, 9703, 18, 11, 220, 15, 5848, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_rchunks_exact_mut_remainder() { let v: &mut [i32] = &mut [0, 1, 2, 3, 4]; let c = v.rchunks_exact_mut(2); assert_eq!(c.into_remainder(), &[0]); }
rust_cleaned_test_functions.jsonl/9684
{ "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, 1710, 84263, 71084, 29523, 86607, 1107, 368, 341, 262, 1077, 348, 25, 609, 6984, 508, 72, 18, 17, 60, 284, 609, 6984, 508, 15, 11, 220, 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 935, 262,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_ownershipvoucher_parsing() { let ov_path = TC::test_asset_path("testdevice1.ov"); let result = TC::run_external("ownershipvoucher", &[ov_path.to_str().unwrap()]); assert!(result.status.success()); result.stdout_equals( "Protocol version: 101 Device GUID: 18907279-a41d-049a-ae3c-4da4ce61c14b Device Info: testdevice", ); result.stderr_equals(""); }
rust_cleaned_test_functions.jsonl/24701
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 209 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 62, 78147, 79013, 620, 28598, 368, 341, 286, 1077, 24550, 2638, 284, 24591, 486, 1944, 42299, 2638, 445, 1944, 6111, 16, 93150, 3071, 286, 1077, 1102, 284, 24591, 486, 6108, 47432, 445, 78147, 790...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_iteration() { let empty_map : TrieMap<uint> = TrieMap::new(); assert_eq!(empty_map.iter().next(), None); let first = uint::MAX - 10000; let last = uint::MAX; let mut map = TrieMap::new(); for x in range(first, last).rev() { map.insert(x, x / 2); } let mut i = 0; for (k, &v) in map.iter() { assert_eq!(k, first + i); assert_eq!(v, k / 2); i += 1; } assert_eq!(i, last - first); }
rust_cleaned_test_functions.jsonl/5909
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 298 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 62772, 368, 341, 286, 1077, 4287, 5376, 549, 62783, 2227, 16434, 29, 284, 62783, 2227, 486, 931, 543, 286, 2060, 10714, 10297, 3194, 5376, 19471, 1005, 3600, 1507, 2240, 626, 286, 1077, 1156, 284,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
3
#[test] fn test_display_column_order() { assert_eq!( ColumnOrder::TypeDefinedOrder(SortOrder::Signed).to_string(), "TYPE_DEFINED_ORDER(SIGNED)" ); assert_eq!( ColumnOrder::TypeDefinedOrder(SortOrder::Unsigned).to_string(), "TYPE_DEFINED_ORDER(UNSIGNED)" ); assert_eq!( ColumnOrder::TypeDefinedOrder(SortOrder::Undefined).to_string(), "TYPE_DEFINED_ORDER(UNDEFINED)" ); assert_eq!(ColumnOrder::Undefined.to_string(), "UNDEFINED"); }
rust_cleaned_test_functions.jsonl/126081
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 204 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14825, 8744, 7869, 368, 341, 197, 6948, 10714, 33673, 298, 197, 2933, 4431, 486, 929, 29361, 4431, 3759, 371, 4431, 486, 49312, 568, 983, 3904, 3148, 298, 197, 1, 9502, 59122, 26677, 3759, 25015, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_keycodes() { assert!(keycode_from_native(self::ffi::TCOD_keycode_t::TCODK_NONE).unwrap() == KeyCode::NoKey); assert!(keycode_from_native(self::ffi::TCOD_keycode_t::TCODK_6).unwrap() == KeyCode::Number6); assert!(keycode_from_native(self::ffi::TCOD_keycode_t::TCODK_TEXT).unwrap() == KeyCode::Text); }
rust_cleaned_test_functions.jsonl/61805
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 149 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 3097, 25814, 368, 341, 262, 2060, 10297, 792, 1851, 5673, 44494, 1193, 486, 53799, 486, 7749, 2069, 3097, 1851, 528, 486, 7749, 2069, 42, 14904, 568, 15454, 368, 621, 65152, 486, 2753, 1592, 317, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_mul_redc() { let a = u256h!("0548c135e26faa9c977fb2eda057b54b2e0baa9a77a0be7c80278f4f03462d4c"); let b = u256h!("024385f6bebc1c496e09955db534ef4b1eaff9a78e27d4093cfa8f7c8f886f6b"); let c = u256h!("012b854fc6321976d374ad069cfdec8bb7b2bd184259dae8f530cbb28f0805b4"); assert_eq!(mul_redc_inline(M3, &a, &b), c); }
rust_cleaned_test_functions.jsonl/10081
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 229 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 24944, 26058, 66, 368, 341, 286, 1077, 264, 284, 575, 17, 20, 21, 71, 17223, 15, 20, 19, 23, 66, 16, 18, 20, 68, 17, 21, 3632, 64, 24, 66, 24, 22, 22, 10798, 17, 13830, 15, 20, 22, 65,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_canceling_snapshot() { let td = Builder::new().prefix("tikv-store-test").tempdir().unwrap(); let worker = Worker::new("snap-manager"); let sched = worker.scheduler(); let mut s = new_storage(sched, &td); // PENDING can be canceled directly. s.snap_state = RefCell::new(SnapState::Applying(Arc::new(AtomicUsize::new( JOB_STATUS_PENDING, )))); assert!(s.cancel_applying_snap()); assert_eq!(*s.snap_state.borrow(), SnapState::ApplyAborted); // RUNNING can't be canceled directly. s.snap_state = RefCell::new(SnapState::Applying(Arc::new(AtomicUsize::new( JOB_STATUS_RUNNING, )))); assert!(!s.cancel_applying_snap()); assert_eq!( *s.snap_state.borrow(), SnapState::Applying(Arc::new(AtomicUsize::new(JOB_STATUS_CANCELLING))) ); // CANCEL can't be canceled again. assert!(!s.cancel_applying_snap()); s.snap_state = RefCell::new(SnapState::Applying(Arc::new(AtomicUsize::new( JOB_STATUS_CANCELLED, )))); // canceled snapshot can be cancel directly. assert!(s.cancel_applying_snap()); assert_eq!(*s.snap_state.borrow(), SnapState::ApplyAborted); s.snap_state = RefCell::new(SnapState::Applying(Arc::new(AtomicUsize::new( JOB_STATUS_FINISHED, )))); assert!(s.cancel_applying_snap()); assert_eq!(*s.snap_state.borrow(), SnapState::Relax); s.snap_state = RefCell::new(SnapState::Applying(Arc::new(AtomicUsize::new( JOB_STATUS_FAILED, )))); let res = panic_hook::recover_safe(|| s.cancel_applying_snap()); assert!(res.is_err()); }
rust_cleaned_test_functions.jsonl/3775
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 850 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 28895, 287, 53265, 368, 341, 286, 1077, 17941, 284, 20626, 486, 931, 1005, 11849, 445, 83, 1579, 85, 33252, 16839, 1827, 3888, 3741, 1005, 15454, 543, 286, 1077, 11864, 284, 33086, 486, 931, 445, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
2
#[test] fn test_frexp() { // We have to use from_str until base-2 exponents // are supported in floating-point literals let f1: f32 = from_str_hex("1p-123").unwrap(); let f2: f32 = from_str_hex("1p-111").unwrap(); let (x1, exp1) = f1.frexp(); let (x2, exp2) = f2.frexp(); assert_eq!((x1, exp1), (0.5f32, -122)); assert_eq!((x2, exp2), (0.5f32, -110)); assert_eq!(Float::ldexp(x1, exp1), f1); assert_eq!(Float::ldexp(x2, exp2), f2); assert_eq!(0f32.frexp(), (0f32, 0)); assert_eq!((-0f32).frexp(), (-0f32, 0)); assert_eq!(match Float::infinity::<f32>().frexp() { (x, _) => x }, Float::infinity::<f32>()) assert_eq!(match Float::neg_infinity::<f32>().frexp() { (x, _) => x }, Float::neg_infinity::<f32>()) assert!(match Float::NaN::<f32>().frexp() { (x, _) => x.is_NaN() }) }
rust_cleaned_test_functions.jsonl/101571
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 507 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 74179, 35725, 368, 341, 286, 442, 1205, 614, 311, 990, 504, 2895, 3080, 2331, 12, 17, 505, 2700, 198, 286, 442, 525, 7248, 304, 19057, 16574, 75275, 198, 286, 1077, 282, 16, 25, 282, 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...
4
#[test] fn test_chacha_multiple_blocks() { let seed = [0,0,0,0, 1,0,0,0, 2,0,0,0, 3,0,0,0, 4,0,0,0, 5,0,0,0, 6,0,0,0, 7,0,0,0]; let mut rng = ChaChaRng::from_seed(seed); let mut results = [0u32; 16]; for i in results.iter_mut() { *i = rng.next_u32(); for _ in 0..16 { rng.next_u32(); } } let expected = [0xf225c81a, 0x6ab1be57, 0x04d42951, 0x70858036, 0x49884684, 0x64efec72, 0x4be2d186, 0x3615b384, 0x11cfa18e, 0xd3c50049, 0x75c775f6, 0x434c6530, 0x2c5bad8f, 0x898881dc, 0x5f1c86d9, 0xc1f8e7f4]; assert_eq!(results, expected); }
rust_cleaned_test_functions.jsonl/113002
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 496 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 4138, 51576, 45233, 25201, 368, 341, 286, 1077, 10320, 284, 508, 15, 11, 15, 11, 15, 11, 15, 11, 220, 16, 11, 15, 11, 15, 11, 15, 11, 220, 17, 11, 15, 11, 15, 11, 15, 11, 220, 18, 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...
3
#[test] fn test_if_else() { let lexer = Lexer::new("fn t() { if true {} else {} }"); let actual: Vec<TokType> = lexer.map(|t| t.0).collect(); let expected = vec![ TokType::KwFn, TokType::Iden("t".to_string()), TokType::OpenParent, TokType::CloseParent, TokType::OpenBracket, TokType::KwIf, TokType::KwTrue, TokType::OpenBracket, TokType::CloseBracket, TokType::KwElse, TokType::OpenBracket, TokType::CloseBracket, TokType::CloseBracket ]; assert_eq!(actual, expected) }
rust_cleaned_test_functions.jsonl/24693
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 374 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 11119, 62628, 368, 341, 286, 1077, 53259, 284, 85082, 486, 931, 445, 8822, 259, 368, 314, 421, 830, 4687, 770, 4687, 335, 797, 286, 1077, 5042, 25, 11312, 3125, 562, 929, 29, 284, 53259, 4770, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_stat_fstat_lstat() { use nix::sys::stat::{fstat, lstat}; let tempdir = tempfile::tempdir().unwrap(); let filename = tempdir.path().join("bar.txt"); let linkname = tempdir.path().join("barlink"); File::create(&filename).unwrap(); symlink("bar.txt", &linkname).unwrap(); let link = File::open(&linkname).unwrap(); // since it's a regular file let stat_result = stat(&filename); assert_stat_results(stat_result); let lstat_result = lstat(&linkname); assert_lstat_results(lstat_result); let fstat_result = fstat(link.as_raw_fd()); assert_stat_results(fstat_result); }
rust_cleaned_test_functions.jsonl/48640
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 257 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 16271, 761, 9878, 907, 9878, 368, 341, 262, 990, 308, 941, 486, 7791, 486, 9878, 22964, 69, 9878, 11, 326, 9878, 2315, 262, 1077, 2730, 3741, 284, 54819, 486, 3888, 3741, 1005, 15454, 543, 262, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_channel_list() { let update = Update::from_args(&["update"], &["channel", "list"]).unwrap(); assert_eq!( update, Update { cmd: Command::Channel(Channel { cmd: channel::Command::List(channel::List {}) }) } ); }
rust_cleaned_test_functions.jsonl/50077
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 156 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 14571, 2019, 368, 341, 286, 1077, 2647, 284, 5549, 486, 1499, 8384, 2099, 1183, 2386, 7914, 609, 1183, 10119, 497, 330, 1607, 45014, 15454, 543, 286, 2060, 10714, 33673, 310, 2647, 345, 310, 5549,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_eval_binary_function_vector_scalar() { #[derive(Debug, Clone, Copy, RpnFunction)] #[rpn_function(args = 2)] struct FnFoo; impl FnFoo { fn call( _ctx: &mut EvalContext, _payload: RpnFnCallPayload<'_>, v1: &Option<f64>, v2: &Option<f64>, ) -> Result<Option<f64>> { Ok(Some(v1.unwrap() - v2.unwrap())) } } let mut columns = LazyBatchColumnVec::from(vec![{ let mut col = LazyBatchColumn::decoded_with_capacity_and_tp(3, EvalType::Real); col.mut_decoded().push_real(Some(1.0)); col.mut_decoded().push_real(Some(5.5)); col.mut_decoded().push_real(Some(-4.3)); col }]); let schema = &[FieldTypeTp::Double.into()]; let exp = RpnExpressionBuilder::new() .push_column_ref(0) .push_constant(1.5f64) .push_fn_call(FnFoo, FieldTypeTp::Double) .build(); let mut ctx = EvalContext::default(); let result = exp.eval(&mut ctx, 3, schema, &mut columns); let val = result.unwrap(); assert!(val.is_vector()); assert_eq!( val.vector_value().unwrap().as_real_slice(), [Some(-0.5), Some(4.0), Some(-5.8)] ); assert_eq!(val.field_type().tp(), FieldTypeTp::Double); }
rust_cleaned_test_functions.jsonl/111586
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 801 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 21296, 31761, 9174, 12247, 41652, 368, 341, 394, 11506, 27098, 42618, 11, 27913, 11, 14540, 11, 431, 19958, 5152, 5563, 286, 11506, 81, 19958, 9174, 7356, 284, 220, 17, 5563, 286, 2036, 50182, 409...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_rewrite_replace_dynamic_configs() { let static_rules = vec![rule!("fuchsia.com" => "foo.com", "/" => "/")]; let dynamic_rules = vec![rule!("fuchsia.com" => "bar.com", "/" => "/")]; let new_dynamic_rules = vec![rule!("fuchsia.com" => "baz.com", "/" => "/")]; let static_config = make_rule_config(static_rules); let dynamic_config = make_rule_config(dynamic_rules); let manager = RewriteManagerBuilder::new(Some(&dynamic_config)) .unwrap() .static_rules_path(&static_config) .unwrap() .replace_dynamic_rules(new_dynamic_rules.clone()) .build(); let url = "fuchsia-pkg://fuchsia.com/package".parse().unwrap(); assert_eq!(manager.rewrite(&url), "fuchsia-pkg://baz.com/package".parse().unwrap()); }
rust_cleaned_test_functions.jsonl/46500
{ "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, 74052, 10633, 45992, 59150, 368, 341, 286, 1077, 1099, 21407, 284, 7486, 20703, 12937, 17223, 69, 73391, 905, 1, 589, 330, 7975, 905, 497, 16891, 589, 3521, 899, 935, 286, 1077, 8741, 21407, 284, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_scalar_from_u64() { let a = Scalar::from(100); let mut expected_bytes = [0u8; 32]; expected_bytes[0] = 100; assert_eq!(a.to_bytes_le(), expected_bytes); }
rust_cleaned_test_functions.jsonl/54663
{ "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, 41652, 5673, 7300, 21, 19, 368, 341, 286, 1077, 264, 284, 35176, 486, 1499, 7, 16, 15, 15, 317, 286, 1077, 5206, 3601, 12524, 284, 508, 15, 84, 23, 26, 220, 18, 17, 935, 286, 3601, 12524, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_cache_read_at_and_write_at_with_hit() { let (_ramdisk, remote_block_device) = make_ramdisk(); let mut cache = Cache::new(remote_block_device).expect("Cache::new failed"); const OFFSET: u64 = 11; const DATA: &[u8] = b"hello"; cache.write_at(DATA, OFFSET).expect("cache.write failed"); let mut buf = [0; 5]; cache.read_at(&mut buf, OFFSET).expect("cache.read_at failed"); assert_eq!(&buf, DATA); assert_eq!(cache.stats(), &Stats { read_count: 1, write_count: 0, cache_hits: 1 }); }
rust_cleaned_test_functions.jsonl/96354
{ "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, 11529, 6443, 3752, 8378, 9165, 3752, 6615, 37697, 368, 341, 286, 1077, 5453, 2396, 30496, 11, 8699, 7113, 9204, 8, 284, 1281, 62124, 30496, 543, 286, 1077, 5206, 6500, 284, 19479, 486, 931, 61381,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_polls_migration() { let mut deps = mock_dependencies(20, &[]); polls_old_store(&mut deps.storage) .save( &1u64.to_be_bytes(), &LegacyPoll { id: 1u64, creator: CanonicalAddr::default(), status: PollStatus::Executed, yes_votes: Uint128::zero(), no_votes: Uint128::zero(), end_height: 50u64, title: "test".to_string(), description: "description".to_string(), link: None, execute_data: None, deposit_amount: Uint128::zero(), total_balance_at_end_poll: None, }, ) .unwrap(); polls_old_store(&mut deps.storage) .save( &2u64.to_be_bytes(), &LegacyPoll { id: 2u64, creator: CanonicalAddr::default(), status: PollStatus::InProgress, yes_votes: Uint128::zero(), no_votes: Uint128::zero(), end_height: 125u64, title: "test2".to_string(), description: "description".to_string(), link: None, execute_data: None, deposit_amount: Uint128::zero(), total_balance_at_end_poll: None, }, ) .unwrap(); let env = mock_env_height("addr0000", &[], 100, 650); migrate_polls(&mut deps.storage, env).unwrap(); let poll1: Poll = poll_read(&mut deps.storage) .load(&1u64.to_be_bytes()) .unwrap(); assert_eq!( poll1, Poll { id: 1u64, creator: CanonicalAddr::default(), status: PollStatus::Executed, yes_votes: Uint128::zero(), no_votes: Uint128::zero(), end_time: 325u64, title: "test".to_string(), description: "description".to_string(), link: None, execute_data: None, deposit_amount: Uint128::zero(), total_balance_at_end_poll: None, abstain_votes: Uint128::zero(), voters_reward: Uint128::zero(), staked_amount: None, } ); let poll2: Poll = poll_read(&mut deps.storage) .load(&2u64.to_be_bytes()) .unwrap(); assert_eq!( poll2, Poll { id: 2u64, creator: CanonicalAddr::default(), status: PollStatus::InProgress, yes_votes: Uint128::zero(), no_votes: Uint128::zero(), end_time: 812u64, title: "test2".to_string(), description: "description".to_string(), link: None, execute_data: None, deposit_amount: Uint128::zero(), total_balance_at_end_poll: None, abstain_votes: Uint128::zero(), voters_reward: Uint128::zero(), staked_amount: None, } ); }
rust_cleaned_test_functions.jsonl/44519
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 2043 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 40002, 82, 90373, 368, 341, 286, 1077, 5206, 48178, 284, 7860, 71841, 7, 17, 15, 11, 609, 56703, 286, 23056, 21108, 14809, 2099, 6984, 48178, 22403, 340, 310, 659, 6628, 1006, 394, 609, 16, 84, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_add() { let a = "2".to_owned() + &repeat('1').take(71).collect::<String>(); let b: String = repeat('8').take(81).collect(); let c = "8888888890".to_owned() + &repeat('9').take(71).collect::<String>(); let cases = vec![ ( ".00012345000098765", "123.45", Res::Ok("123.45012345000098765"), ), (".1", ".45", Res::Ok("0.55")), ( "1234500009876.5", ".00012345000098765", Res::Ok("1234500009876.50012345000098765"), ), ("9999909999999.5", ".555", Res::Ok("9999910000000.055")), ("99999999", "1", Res::Ok("100000000")), ("989999999", "1", Res::Ok("990000000")), ("999999999", "1", Res::Ok("1000000000")), ("12345", "123.45", Res::Ok("12468.45")), ("-12345", "-123.45", Res::Ok("-12468.45")), ("-12345", "123.45", Res::Ok("-12221.55")), ("12345", "-123.45", Res::Ok("12221.55")), ("123.45", "-12345", Res::Ok("-12221.55")), ("-123.45", "12345", Res::Ok("12221.55")), ("5", "-6.0", Res::Ok("-1.0")), ("2", "3", Res::Ok("5")), ("2454495034", "3451204593", Res::Ok("5905699627")), ("24544.95034", ".3451204593", Res::Ok("24545.2954604593")), (".1", ".1", Res::Ok("0.2")), (".1", "-.1", Res::Ok("0")), ("0", "1.001", Res::Ok("1.001")), (&a, &b, Res::Ok(&c)), ]; for (lhs_str, rhs_str, exp) in cases { let lhs = lhs_str.parse::<Decimal>().unwrap(); let rhs = rhs_str.parse::<Decimal>().unwrap(); let res_dec = &lhs + &rhs; let res = res_dec.map(|s| s.to_string()); let exp_str = exp.map(|s| s.to_owned()); assert_eq!(res, exp_str); let res_dec = &rhs + &lhs; let res = res_dec.map(|s| s.to_string()); assert_eq!(res, exp_str); } }
rust_cleaned_test_functions.jsonl/13664
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 1206 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 2891, 368, 341, 286, 1077, 264, 284, 330, 17, 3263, 983, 51973, 368, 488, 609, 30624, 492, 16, 1823, 22769, 7, 22, 16, 568, 17384, 27638, 703, 3913, 286, 1077, 293, 25, 923, 284, 13153, 492, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_checksum() { let cases = vec![ ("empty", "", 0xef46db3751d8e999), ("a", "a", 0xd24ec4f1a98c6e5b), ("as", "as", 0x1c330fb2d66be179), ("asd", "asd", 0x631c37ce72a97393), ("asdf", "asdf", 0x415872f599cea71e), ( "len=63", "Call me Ishmael. Some years ago--never mind how long precisely-", 0x02a2e85470d6fd96, ), ]; for (name, input, expect) in cases { assert_eq!(checksum(input.as_bytes()), expect, "{}", name); } }
rust_cleaned_test_functions.jsonl/16730
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 392 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 64038, 368, 341, 286, 1077, 5048, 284, 7486, 90515, 310, 3489, 3194, 497, 7342, 220, 15, 47510, 19, 21, 1999, 18, 22, 20, 16, 67, 23, 68, 24, 24, 24, 1326, 310, 3489, 64, 497, 330, 64, 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_release_all() { init!("true"); let h1 = issuer_credential_create(::credential_def::tests::create_cred_def_fake(),"1".to_string(),"8XFh8yBzrpJQmNyZzgoTqB".to_owned(),"credential_name".to_string(),"{\"attr\":\"value\"}".to_owned(),1).unwrap(); let h2 = issuer_credential_create(::credential_def::tests::create_cred_def_fake(),"1".to_string(),"8XFh8yBzrpJQmNyZzgoTqB".to_owned(),"credential_name".to_string(),"{\"attr\":\"value\"}".to_owned(),1).unwrap(); let h3 = issuer_credential_create(::credential_def::tests::create_cred_def_fake(),"1".to_string(),"8XFh8yBzrpJQmNyZzgoTqB".to_owned(),"credential_name".to_string(),"{\"attr\":\"value\"}".to_owned(),1).unwrap(); let h4 = issuer_credential_create(::credential_def::tests::create_cred_def_fake(),"1".to_string(),"8XFh8yBzrpJQmNyZzgoTqB".to_owned(),"credential_name".to_string(),"{\"attr\":\"value\"}".to_owned(),1).unwrap(); let h5 = issuer_credential_create(::credential_def::tests::create_cred_def_fake(),"1".to_string(),"8XFh8yBzrpJQmNyZzgoTqB".to_owned(),"credential_name".to_string(),"{\"attr\":\"value\"}".to_owned(),1).unwrap(); release_all(); assert_eq!(release(h1),Err(IssuerCredError::InvalidHandle())); assert_eq!(release(h2),Err(IssuerCredError::InvalidHandle())); assert_eq!(release(h3),Err(IssuerCredError::InvalidHandle())); assert_eq!(release(h4),Err(IssuerCredError::InvalidHandle())); assert_eq!(release(h5),Err(IssuerCredError::InvalidHandle())); }
rust_cleaned_test_functions.jsonl/104602
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 714 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 24577, 5705, 368, 341, 286, 2930, 17223, 1866, 797, 286, 1077, 305, 16, 284, 54835, 666, 30320, 8657, 38732, 66799, 7844, 486, 23841, 486, 3182, 73475, 7844, 56881, 41892, 16, 3263, 983, 3904, 418...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_bad_tag() { let bad_under15 = b"-"; let mut decoder = BinDecoder::new(bad_under15); assert!(read_tag(&mut decoder, bad_under15.len() as u8).is_err()); }
rust_cleaned_test_functions.jsonl/24511
{ "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, 34199, 9372, 368, 341, 286, 1077, 3873, 58228, 16, 20, 284, 293, 34294, 876, 286, 1077, 5206, 24551, 284, 29344, 20732, 486, 931, 1883, 329, 58228, 16, 20, 626, 286, 2060, 10297, 878, 9372, 2099...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
1
#[test] fn test_mp() { let mut a = botan::MPI::new().unwrap(); let mut b = botan::MPI::new().unwrap(); assert_eq!(a.to_u32().unwrap(), 0); assert_eq!(b.to_u32().unwrap(), 0); a.set_i32(9).unwrap(); b.set_i32(81).unwrap(); assert_eq!(a.to_u32().unwrap(), 9); assert_eq!(b.to_u32().unwrap(), 81); let mut c = &a + &b; assert_eq!(c.to_u32().unwrap(), 90); let d = botan::MPI::from_str("0x5A").unwrap(); assert_eq!(c, d); c *= &botan::MPI::from_str("1030").unwrap(); assert_eq!(c.to_string().unwrap(), "92700"); assert_eq!(format!("{}", c), "92700"); assert_eq!(format!("{:x}", c), "016a1c"); assert_eq!(format!("{:X}", c), "016A1C"); assert_eq!(format!("{:#x}", c), "0x016a1c"); assert_eq!(format!("{:#X}", c), "0x016A1C"); assert_eq!(c.to_bin().unwrap(), vec![0x01, 0x6a, 0x1c]); let mut s = &c << 32; assert_eq!(s.to_hex().unwrap(), "016A1C00000000"); s <<= 4; s += 5; assert_eq!(s.to_hex().unwrap(), "16A1C000000005"); let mut s = s - 19; assert_eq!(s.to_hex().unwrap(), "16A1BFFFFFFFF2"); s += 14; s >>= 8; assert_eq!(s.to_hex().unwrap(), "16A1C0000000"); let mut t = &s >> 28; assert_eq!(t, c); t += &s; t <<= 4; assert_eq!(t.to_hex().unwrap(), "016A1C0016A1C0"); let ten = botan::MPI::new_from_u32(10).unwrap(); let d = &t / &ten; assert_eq!(d.to_hex().unwrap(), "243600024360"); t /= &ten; assert_eq!(d, t); t /= &ten; let r = &t % &ten; assert_eq!(r.to_string().unwrap(), "4"); let t = -t * &ten; assert!(t.is_negative().unwrap(), true); assert_eq!(format!("{}", t), "-39814346982240"); }
rust_cleaned_test_functions.jsonl/95313
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 877 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 39898, 368, 341, 262, 1077, 5206, 264, 284, 10924, 276, 486, 56369, 486, 931, 1005, 15454, 543, 262, 1077, 5206, 293, 284, 10924, 276, 486, 56369, 486, 931, 1005, 15454, 1428, 262, 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_basic_flow() { let (tx, rx) = mpsc::channel(); let sender = Box::new(TestNotifier { tx }); let (_tmp, engine) = create_tmp_engine("apply-basic"); let (_dir, importer) = create_tmp_importer("apply-basic"); let (region_scheduler, mut snapshot_rx) = dummy_scheduler(); let cfg = Arc::new(VersionTrack::new(Config::default())); let (router, mut system) = create_apply_batch_system(&cfg.value()); let pending_create_peers = Arc::new(Mutex::new(HashMap::default())); let builder = super::Builder::<KvTestEngine, KvTestWriteBatch> { tag: "test-store".to_owned(), cfg, coprocessor_host: CoprocessorHost::<KvTestEngine>::default(), importer, region_scheduler, sender, engine, router: router.clone(), _phantom: Default::default(), store_id: 1, pending_create_peers, }; system.spawn("test-basic".to_owned(), builder); let mut reg = Registration { id: 1, term: 4, applied_index_term: 5, ..Default::default() }; reg.region.set_id(2); reg.apply_state.set_applied_index(3); router.schedule_task(2, Msg::Registration(reg.clone())); validate(&router, 2, move |delegate| { assert_eq!(delegate.id, 1); assert_eq!(delegate.tag, "[region 2] 1"); assert_eq!(delegate.region, reg.region); assert!(!delegate.pending_remove); assert_eq!(delegate.apply_state, reg.apply_state); assert_eq!(delegate.term, reg.term); assert_eq!(delegate.applied_index_term, reg.applied_index_term); }); let (resp_tx, resp_rx) = mpsc::channel(); let p = proposal( false, 1, 0, Callback::write(Box::new(move |resp: WriteResponse| { resp_tx.send(resp.response).unwrap(); })), ); router.schedule_task( 1, Msg::apply(apply(1, 1, 0, vec![new_entry(0, 1, true)], vec![p])), ); // unregistered region should be ignored and notify failed. let resp = resp_rx.recv_timeout(Duration::from_secs(3)).unwrap(); assert!(resp.get_header().get_error().has_region_not_found()); assert!(rx.try_recv().is_err()); let (cc_tx, cc_rx) = mpsc::channel(); let pops = vec![ proposal( false, 4, 4, Callback::write(Box::new(move |write: WriteResponse| { cc_tx.send(write.response).unwrap(); })), ), proposal(false, 4, 5, Callback::None), ]; router.schedule_task( 2, Msg::apply(apply(1, 2, 11, vec![new_entry(5, 4, true)], pops)), ); // proposal with not commit entry should be ignore validate(&router, 2, move |delegate| { assert_eq!(delegate.term, 11); }); let cc_resp = cc_rx.try_recv().unwrap(); assert!(cc_resp.get_header().get_error().has_stale_command()); assert!(rx.recv_timeout(Duration::from_secs(3)).is_ok()); // Make sure Apply and Snapshot are in the same batch. let (snap_tx, _) = mpsc::sync_channel(0); batch_messages( &router, 2, vec![ Msg::apply(apply(1, 2, 11, vec![new_entry(5, 5, false)], vec![])), Msg::Snapshot(GenSnapTask::new(2, snap_tx)), ], ); let apply_res = match rx.recv_timeout(Duration::from_secs(3)) { Ok(PeerMsg::ApplyRes { res: TaskRes::Apply(res), .. }) => res, e => panic!("unexpected apply result: {:?}", e), }; let apply_state_key = keys::apply_state_key(2); let apply_state = match snapshot_rx.recv_timeout(Duration::from_secs(3)) { Ok(Some(RegionTask::Gen { kv_snap, .. })) => kv_snap .get_msg_cf(CF_RAFT, &apply_state_key) .unwrap() .unwrap(), e => panic!("unexpected apply result: {:?}", e), }; assert_eq!(apply_res.region_id, 2); assert_eq!(apply_res.apply_state, apply_state); assert_eq!(apply_res.apply_state.get_applied_index(), 5); assert!(apply_res.exec_res.is_empty()); // empty entry will make applied_index step forward and should write apply state to engine. assert_eq!(apply_res.metrics.written_keys, 1); assert_eq!(apply_res.applied_index_term, 5); validate(&router, 2, |delegate| { assert_eq!(delegate.term, 11); assert_eq!(delegate.applied_index_term, 5); assert_eq!(delegate.apply_state.get_applied_index(), 5); assert_eq!( delegate.apply_state.get_applied_index(), delegate.last_sync_apply_index ); }); router.schedule_task(2, Msg::destroy(2, false)); let (region_id, peer_id) = match rx.recv_timeout(Duration::from_secs(3)) { Ok(PeerMsg::ApplyRes { res: TaskRes::Destroy { region_id, peer_id, .. }, .. }) => (region_id, peer_id), e => panic!("expected destroy result, but got {:?}", e), }; assert_eq!(peer_id, 1); assert_eq!(region_id, 2); // Stopped peer should be removed. let (resp_tx, resp_rx) = mpsc::channel(); let p = proposal( false, 1, 0, Callback::write(Box::new(move |resp: WriteResponse| { resp_tx.send(resp.response).unwrap(); })), ); router.schedule_task( 2, Msg::apply(apply(1, 1, 0, vec![new_entry(0, 1, true)], vec![p])), ); // unregistered region should be ignored and notify failed. let resp = resp_rx.recv_timeout(Duration::from_secs(3)).unwrap(); assert!( resp.get_header().get_error().has_region_not_found(), "{:?}", resp ); assert!(rx.try_recv().is_err()); system.shutdown(); }
rust_cleaned_test_functions.jsonl/3980
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 3335 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 34729, 27441, 368, 341, 286, 1077, 320, 3998, 11, 19111, 8, 284, 296, 81984, 486, 10119, 543, 286, 1077, 4646, 284, 8261, 486, 931, 31159, 64729, 314, 9854, 1625, 286, 1077, 5453, 5173, 11, 4712...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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_radio_mock_check_receive() { let mut radio = MockRadio::new(&[ Transaction::check_receive(true, Ok(false)), Transaction::check_receive(true, Ok(true)), ]); let res = radio.check_receive(true).unwrap(); assert_eq!(false, res); let res = radio.check_receive(true).unwrap(); assert_eq!(true, res); radio.done(); }
rust_cleaned_test_functions.jsonl/35592
{ "file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl", "token_count": 200 }
[ 262, 11506, 1944, 921, 262, 5168, 1273, 49740, 34134, 7200, 38557, 368, 341, 286, 1077, 5206, 8887, 284, 14563, 28203, 486, 931, 2099, 9640, 310, 17869, 486, 2028, 38557, 3715, 11, 7622, 3576, 6965, 310, 17869, 486, 2028, 38557, 3715, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
1
#[test] fn test_csv_builder_with_bounds() { let file = File::open("test/data/uk_cities.csv").unwrap(); let mut csv = ReaderBuilder::new().with_bounds(0, 2).build(file).unwrap(); let batch = csv.next().unwrap().unwrap(); let city = batch .column(0) .as_any() .downcast_ref::<StringArray>() .unwrap(); // The value on line 0 is within the bounds assert_eq!("Elgin, Scotland, the UK", city.value(0)); // The value on line 13 is outside of the bounds. Therefore let result = std::panic::catch_unwind(|| city.value(13)); assert!(result.is_err()); }
rust_cleaned_test_functions.jsonl/80290
{ "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, 14020, 28532, 6615, 36878, 368, 341, 286, 1077, 1034, 284, 2887, 486, 2508, 445, 1944, 13167, 14, 3101, 666, 1361, 11219, 1827, 15454, 1428, 1789, 286, 1077, 5206, 13147, 284, 25166, 3297, 486, 93...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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