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_resume() {
let runc_id = format!("{}", Uuid::new_v4());
let runc_path = env::temp_dir().join(&runc_id).join("runc.amd64");
let runc_root =
PathBuf::from(env::var_os("XDG_RUNTIME_DIR").expect("expected temporary path"))
.join("rust-runc")
.join(&runc_id);
fs::create_dir_all(&runc_root).expect("unable to create runc root");
extract_tarball(
&PathBuf::from("test_fixture/runc_v1.0.0-rc10.tar.gz"),
&env::temp_dir().join(&runc_id),
)
.expect("unable to extract runc");
let mut config: RuncConfiguration = Default::default();
config.command = Some(runc_path.clone());
config.root = Some(runc_root.clone());
let runc = Runc::new(config).expect("Unable to create runc instance");
let task = async move {
let container = ManagedContainer::new(
&runc_path,
&runc_root,
&PathBuf::from("test_fixture/busybox.tar.gz"),
)
.await?;
runc.pause(&container.id).await?;
let container_state = runc.state(&container.id).await?;
let status = container_state.status.unwrap();
assert_eq!(status, "paused");
runc.resume(&container.id).await?;
runc.state(&container.id).await
};
let mut runtime = Runtime::new().expect("unable to create runtime");
let container = runtime.block_on(task).expect("test failed");
assert_eq!(container.status, Some(String::from("running")));
} | rust_cleaned_test_functions.jsonl/24471 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 802
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58132,
368,
341,
286,
1077,
435,
1347,
842,
284,
3561,
79878,
547,
2423,
486,
931,
2273,
19,
1423,
286,
1077,
435,
1347,
2638,
284,
6105,
486,
3888,
4334,
1005,
5987,
2099,
81,
1347,
842,
568,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_module_abi() {
use mvm::abi::FuncVisibility::*;
use mvm::abi::Type::*;
use mvm::abi::TypeAbility::*;
let bytecode = include_bytes!("assets/artifacts/modules/EventProxy.mv");
let abi = ModuleAbi::from(CompiledModule::deserialize(bytecode).unwrap());
assert_eq!(
abi,
ModuleAbi {
id: ModuleId::new(CORE_CODE_ADDRESS, Identifier::new("EventProxy").unwrap()),
friends: vec![],
structs: vec![mvm::abi::Struct {
name: Identifier::new("U64").unwrap(),
type_parameters: vec![],
abilities: TypeAbilities {
abilities: vec![Copy, Drop, Store, Key]
},
fields: vec![Field {
name: Identifier::new("val").unwrap(),
tp: Type::U64
}]
}],
funcs: vec![
Func {
name: Identifier::new("create_val").unwrap(),
visibility: Public,
type_parameters: vec![],
parameters: vec![U64],
returns: vec![Struct(StructDef {
id: ModuleId::new(
CORE_CODE_ADDRESS,
Identifier::new("EventProxy").unwrap()
),
name: Identifier::new("U64").unwrap(),
type_parameters: vec![]
})]
},
Func {
name: Identifier::new("emit_event").unwrap(),
visibility: Public,
type_parameters: vec![],
parameters: vec![Reference(Box::new(Signer)), U64],
returns: vec![]
},
Func {
name: Identifier::new("test_only").unwrap(),
visibility: Script,
type_parameters: vec![TypeAbilities { abilities: vec![] }],
parameters: vec![],
returns: vec![
U64,
Struct(StructDef {
id: ModuleId::new(
CORE_CODE_ADDRESS,
Identifier::new("EventProxy").unwrap()
),
name: Identifier::new("U64").unwrap(),
type_parameters: vec![]
})
]
},
],
}
);
} | rust_cleaned_test_functions.jsonl/13993 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1624
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10750,
22885,
72,
368,
341,
262,
990,
296,
7338,
486,
25084,
486,
9626,
11432,
56162,
262,
990,
296,
7338,
486,
25084,
486,
929,
56162,
262,
990,
296,
7338,
486,
25084,
486,
929,
33903,
79304,
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_into_response() {
let req = TestRequest::default().finish();
let resp: HttpResponse = "test".into();
assert_eq!(resp.status(), StatusCode::OK);
assert_eq!(
resp.headers().get(CONTENT_TYPE).unwrap(),
HeaderValue::from_static("text/plain; charset=utf-8")
);
assert_eq!(resp.status(), StatusCode::OK);
assert_eq!(resp.body().bin_ref(), &Binary::from("test"));
let resp: HttpResponse = "test".respond_to(&req).ok().unwrap();
assert_eq!(resp.status(), StatusCode::OK);
assert_eq!(
resp.headers().get(CONTENT_TYPE).unwrap(),
HeaderValue::from_static("text/plain; charset=utf-8")
);
assert_eq!(resp.status(), StatusCode::OK);
assert_eq!(resp.body().bin_ref(), &Binary::from("test"));
let resp: HttpResponse = b"test".as_ref().into();
assert_eq!(resp.status(), StatusCode::OK);
assert_eq!(
resp.headers().get(CONTENT_TYPE).unwrap(),
HeaderValue::from_static("application/octet-stream")
);
assert_eq!(resp.status(), StatusCode::OK);
assert_eq!(resp.body().bin_ref(), &Binary::from(b"test".as_ref()));
let resp: HttpResponse = b"test".as_ref().respond_to(&req).ok().unwrap();
assert_eq!(resp.status(), StatusCode::OK);
assert_eq!(
resp.headers().get(CONTENT_TYPE).unwrap(),
HeaderValue::from_static("application/octet-stream")
);
assert_eq!(resp.status(), StatusCode::OK);
assert_eq!(resp.body().bin_ref(), &Binary::from(b"test".as_ref()));
let resp: HttpResponse = "test".to_owned().into();
assert_eq!(resp.status(), StatusCode::OK);
assert_eq!(
resp.headers().get(CONTENT_TYPE).unwrap(),
HeaderValue::from_static("text/plain; charset=utf-8")
);
assert_eq!(resp.status(), StatusCode::OK);
assert_eq!(resp.body().bin_ref(), &Binary::from("test".to_owned()));
let resp: HttpResponse = "test".to_owned().respond_to(&req).ok().unwrap();
assert_eq!(resp.status(), StatusCode::OK);
assert_eq!(
resp.headers().get(CONTENT_TYPE).unwrap(),
HeaderValue::from_static("text/plain; charset=utf-8")
);
assert_eq!(resp.status(), StatusCode::OK);
assert_eq!(resp.body().bin_ref(), &Binary::from("test".to_owned()));
let resp: HttpResponse = (&"test".to_owned()).into();
assert_eq!(resp.status(), StatusCode::OK);
assert_eq!(
resp.headers().get(CONTENT_TYPE).unwrap(),
HeaderValue::from_static("text/plain; charset=utf-8")
);
assert_eq!(resp.status(), StatusCode::OK);
assert_eq!(resp.body().bin_ref(), &Binary::from(&"test".to_owned()));
let resp: HttpResponse = (&"test".to_owned()).respond_to(&req).ok().unwrap();
assert_eq!(resp.status(), StatusCode::OK);
assert_eq!(
resp.headers().get(CONTENT_TYPE).unwrap(),
HeaderValue::from_static("text/plain; charset=utf-8")
);
assert_eq!(resp.status(), StatusCode::OK);
assert_eq!(resp.body().bin_ref(), &Binary::from(&"test".to_owned()));
let b = Bytes::from_static(b"test");
let resp: HttpResponse = b.into();
assert_eq!(resp.status(), StatusCode::OK);
assert_eq!(
resp.headers().get(CONTENT_TYPE).unwrap(),
HeaderValue::from_static("application/octet-stream")
);
assert_eq!(resp.status(), StatusCode::OK);
assert_eq!(
resp.body().bin_ref(),
&Binary::from(Bytes::from_static(b"test"))
);
let b = Bytes::from_static(b"test");
let resp: HttpResponse = b.respond_to(&req).ok().unwrap();
assert_eq!(resp.status(), StatusCode::OK);
assert_eq!(
resp.headers().get(CONTENT_TYPE).unwrap(),
HeaderValue::from_static("application/octet-stream")
);
assert_eq!(resp.status(), StatusCode::OK);
assert_eq!(
resp.body().bin_ref(),
&Binary::from(Bytes::from_static(b"test"))
);
let b = BytesMut::from("test");
let resp: HttpResponse = b.into();
assert_eq!(resp.status(), StatusCode::OK);
assert_eq!(
resp.headers().get(CONTENT_TYPE).unwrap(),
HeaderValue::from_static("application/octet-stream")
);
assert_eq!(resp.status(), StatusCode::OK);
assert_eq!(resp.body().bin_ref(), &Binary::from(BytesMut::from("test")));
let b = BytesMut::from("test");
let resp: HttpResponse = b.respond_to(&req).ok().unwrap();
assert_eq!(resp.status(), StatusCode::OK);
assert_eq!(
resp.headers().get(CONTENT_TYPE).unwrap(),
HeaderValue::from_static("application/octet-stream")
);
assert_eq!(resp.status(), StatusCode::OK);
assert_eq!(resp.body().bin_ref(), &Binary::from(BytesMut::from("test")));
} | rust_cleaned_test_functions.jsonl/80873 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2365
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45514,
9655,
368,
341,
286,
1077,
4232,
284,
3393,
1900,
486,
2258,
1005,
30150,
1428,
286,
1077,
9039,
25,
17580,
284,
330,
1944,
3263,
18122,
543,
286,
2060,
10714,
10297,
18243,
4299,
1507,
534... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_top_dict_operand_limit() {
let mut ctxt = ReadScope::new(&[0x8c; MAX_OPERANDS + 1]).ctxt();
match TopDict::read(&mut ctxt) {
Err(ParseError::LimitExceeded) => {}
_ => panic!("expected Err(ParseError::LimitExceeded) got something else"),
}
} | rust_cleaned_test_functions.jsonl/85333 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
10426,
5243,
69259,
14763,
368,
341,
286,
1077,
5206,
59162,
284,
4457,
10803,
486,
931,
2099,
58,
15,
87,
23,
66,
26,
8334,
27205,
3976,
50,
488,
220,
16,
10697,
77492,
543,
286,
2432,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_withdraw_after_chargeback() {
let mut eng = Engine::new();
eng.process_tx(Transaction::new(TxType::Deposit, 1, 1, 5));
eng.process_tx(Transaction::new(TxType::Deposit, 1, 2, 15));
eng.process_tx(Transaction::new(TxType::Dispute, 1, 2, 0));
eng.process_tx(Transaction::new(TxType::Chargeback, 1, 2, 0));
// Withdrawal should not work
eng.process_tx(Transaction::new(TxType::Withdrawal, 1, 3, 1));
let value = eng.accounts_iter().next().unwrap();
let mut expected = Account::new(1, 5, 0);
expected.locked = true;
assert_eq!(value, &expected);
} | rust_cleaned_test_functions.jsonl/63624 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 242
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
7633,
19844,
46008,
1419,
368,
341,
262,
1077,
5206,
2922,
284,
8200,
486,
931,
543,
262,
2922,
16988,
17805,
76627,
486,
931,
4140,
87,
929,
486,
78982,
11,
220,
16,
11,
220,
16,
11,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_boundary_round_even() {
check!(33554450.0);
check!(9000000000.0);
check!(34366720000.0);
} | rust_cleaned_test_functions.jsonl/58237 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 66
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54004,
29896,
68347,
368,
341,
262,
1779,
10297,
18,
18,
20,
20,
19,
19,
20,
15,
13,
15,
317,
262,
1779,
10297,
24,
15,
15,
15,
15,
15,
15,
15,
15,
15,
13,
15,
317,
262,
1779,
10297,
18,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_parse_request_validate_key() {
let bytes = Bytes::from("{\"event_id\":\"9ec79c33ec9942ab8353589fcb2e04dc\",\"dsn\":\"https://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:@sentry.io/42\"}");
Envelope::parse_request(bytes, request_meta()).unwrap();
} | rust_cleaned_test_functions.jsonl/103617 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
7893,
42681,
3097,
368,
341,
286,
1077,
5820,
284,
30024,
486,
1499,
99141,
3087,
842,
23488,
24,
757,
22,
24,
66,
18,
18,
757,
24,
24,
19,
17,
370,
23,
18,
20,
18,
20,
23,
24,
69,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_process_message_readonly_handling() {
#[derive(Serialize, Deserialize)]
enum MockSystemInstruction {
Correct,
AttemptCredit { lamports: u64 },
AttemptDataChange { data: u8 },
}
fn mock_system_process_instruction(
_program_id: &Pubkey,
data: &[u8],
invoke_context: &mut dyn InvokeContext,
) -> Result<(), InstructionError> {
let keyed_accounts = invoke_context.get_keyed_accounts()?;
if let Ok(instruction) = bincode::deserialize(data) {
match instruction {
MockSystemInstruction::Correct => Ok(()),
MockSystemInstruction::AttemptCredit { lamports } => {
keyed_accounts[0]
.account
.borrow_mut()
.checked_sub_lamports(lamports)?;
keyed_accounts[1]
.account
.borrow_mut()
.checked_add_lamports(lamports)?;
Ok(())
}
// Change data in a read-only account
MockSystemInstruction::AttemptDataChange { data } => {
keyed_accounts[1].account.borrow_mut().set_data(vec![data]);
Ok(())
}
}
} else {
Err(InstructionError::InvalidInstructionData)
}
}
let mock_system_program_id = Pubkey::new(&[2u8; 32]);
let rent_collector = RentCollector::default();
let mut message_processor = MessageProcessor::default();
message_processor.add_program(mock_system_program_id, mock_system_process_instruction);
let mut accounts: Vec<Rc<RefCell<AccountSharedData>>> = Vec::new();
let account = AccountSharedData::new_ref(100, 1, &mock_system_program_id);
accounts.push(account);
let account = AccountSharedData::new_ref(0, 1, &mock_system_program_id);
accounts.push(account);
let mut loaders: Vec<Vec<(Pubkey, Rc<RefCell<AccountSharedData>>)>> = Vec::new();
let account = Rc::new(RefCell::new(create_loadable_account_for_test(
"mock_system_program",
)));
loaders.push(vec![(mock_system_program_id, account)]);
let executors = Rc::new(RefCell::new(Executors::default()));
let ancestors = Ancestors::default();
let from_pubkey = solana_sdk::pubkey::new_rand();
let to_pubkey = solana_sdk::pubkey::new_rand();
let account_metas = vec![
AccountMeta::new(from_pubkey, true),
AccountMeta::new_readonly(to_pubkey, false),
];
let message = Message::new(
&[Instruction::new_with_bincode(
mock_system_program_id,
&MockSystemInstruction::Correct,
account_metas.clone(),
)],
Some(&from_pubkey),
);
let result = message_processor.process_message(
&message,
&loaders,
&accounts,
&[],
&rent_collector,
None,
executors.clone(),
None,
Arc::new(FeatureSet::all_enabled()),
BpfComputeBudget::new(),
&mut ExecuteDetailsTimings::default(),
Arc::new(Accounts::default()),
&ancestors,
);
assert_eq!(result, Ok(()));
assert_eq!(accounts[0].borrow().lamports(), 100);
assert_eq!(accounts[1].borrow().lamports(), 0);
let message = Message::new(
&[Instruction::new_with_bincode(
mock_system_program_id,
&MockSystemInstruction::AttemptCredit { lamports: 50 },
account_metas.clone(),
)],
Some(&from_pubkey),
);
let result = message_processor.process_message(
&message,
&loaders,
&accounts,
&[],
&rent_collector,
None,
executors.clone(),
None,
Arc::new(FeatureSet::all_enabled()),
BpfComputeBudget::new(),
&mut ExecuteDetailsTimings::default(),
Arc::new(Accounts::default()),
&ancestors,
);
assert_eq!(
result,
Err(TransactionError::InstructionError(
0,
InstructionError::ReadonlyLamportChange
))
);
let message = Message::new(
&[Instruction::new_with_bincode(
mock_system_program_id,
&MockSystemInstruction::AttemptDataChange { data: 50 },
account_metas,
)],
Some(&from_pubkey),
);
let result = message_processor.process_message(
&message,
&loaders,
&accounts,
&[],
&rent_collector,
None,
executors,
None,
Arc::new(FeatureSet::all_enabled()),
BpfComputeBudget::new(),
&mut ExecuteDetailsTimings::default(),
Arc::new(Accounts::default()),
&ancestors,
);
assert_eq!(
result,
Err(TransactionError::InstructionError(
0,
InstructionError::ReadonlyDataModified
))
);
} | rust_cleaned_test_functions.jsonl/15700 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3015
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
6462,
6443,
3243,
75642,
368,
341,
286,
11506,
27098,
3759,
9050,
11,
48440,
5563,
286,
7618,
14563,
2320,
16664,
341,
310,
39970,
345,
310,
43517,
33493,
314,
31603,
3394,
25,
575,
21,
19,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_list_empty_dir() {
let dir = tempdir().unwrap();
let repo = LogRepository::new(dir.path());
let paths = repo.list().unwrap();
assert_eq!(paths.len(), 0);
} | rust_cleaned_test_functions.jsonl/101104 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2019,
15124,
4334,
368,
341,
286,
1077,
5419,
284,
2730,
3741,
1005,
15454,
543,
286,
1077,
15867,
284,
2835,
4624,
486,
931,
14161,
3875,
1423,
286,
1077,
12716,
284,
15867,
6420,
1005,
15454,
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 |
#[test]
fn test_variant_named_field() {
let name = "my_field".to_string();
let fields = [NamedField::new(&name[..])];
let variant = VariantDef::new("Hello", Fields::Named(&fields[..]));
assert_eq!(variant.name(), "Hello");
match *variant.fields() {
Fields::Named(f) => {
assert!(std::ptr::eq((&fields[..]).as_ptr(), f.as_ptr(),));
}
_ => panic!(),
}
} | rust_cleaned_test_functions.jsonl/55829 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 193
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46112,
71834,
5013,
368,
341,
262,
1077,
829,
284,
330,
2408,
5013,
3263,
983,
3904,
543,
262,
1077,
5043,
284,
508,
15810,
1877,
486,
931,
2099,
606,
95874,
2467,
935,
262,
1077,
11424,
284,
39... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_build_upload_policy_for_object() -> Result<(), Box<dyn Error>> {
let policy =
UploadPolicyBuilder::new_policy_for_object("test_bucket", "test:object", &Config::default()).build();
let now = SystemTime::now();
let one_hour_later = now + Duration::from_secs(60 * 60);
assert_eq!(policy.bucket(), Some("test_bucket"));
assert_eq!(policy.key(), Some("test:object"));
assert!(!policy.use_prefixal_object_key());
assert!(
one_hour_later.duration_since(SystemTime::UNIX_EPOCH)?
- policy
.token_deadline()
.unwrap()
.duration_since(SystemTime::UNIX_EPOCH)?
< Duration::from_secs(5)
);
let v: Value = serde_json::from_str(policy.as_json().as_str())?;
assert_eq!(v.as_object().unwrap().len(), 2);
assert_eq!(v["scope"], "test_bucket:test:object");
assert!(
one_hour_later.duration_since(SystemTime::UNIX_EPOCH)?
- Duration::from_secs(v["deadline"].as_u64().unwrap())
< Duration::from_secs(5)
);
assert_eq!(v["isPrefixalScope"], json!(null));
Ok(())
} | rust_cleaned_test_functions.jsonl/2345 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 631
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20801,
21691,
22773,
5478,
5314,
368,
1464,
5714,
68843,
8261,
92846,
4600,
2452,
341,
286,
1077,
4842,
4035,
310,
24996,
13825,
3297,
486,
931,
22773,
5478,
5314,
445,
1944,
38749,
497,
330,
1944,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_int_as_int_others() {
test_none_with_nothing(cast_int_as_int_others);
let cs = vec![
(i64::MAX, i64::MAX),
(i64::MIN, i64::MIN),
(u64::MAX as i64, u64::MAX as i64),
];
for (input, expect) in cs {
let r = cast_int_as_int_others(Some(&input));
let log = make_log(&input, &expect, &r);
check_result(Some(&expect), &r, log.as_str());
}
} | rust_cleaned_test_functions.jsonl/1937 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 268
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4042,
11898,
4042,
14179,
2985,
368,
341,
286,
1273,
31488,
6615,
6536,
1596,
1337,
559,
4042,
11898,
4042,
14179,
2985,
317,
286,
1077,
10532,
284,
7486,
90515,
310,
320,
72,
21,
19,
486,
10586,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_paragraph_alignment() {
assert_markdown_eq(
common::parts::paragraph_alignment,
r###"
left-aligned
right-aligned
center-aligned
both-aligned
"###,
);
} | rust_cleaned_test_functions.jsonl/133512 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 89
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
96713,
51006,
368,
341,
262,
2060,
18924,
2923,
10714,
1006,
286,
4185,
486,
18252,
486,
27727,
51006,
345,
286,
435,
14374,
698,
2359,
97451,
271,
1291,
97451,
271,
3057,
97451,
271,
21028,
97451,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_non_utf8_conversion() {
Python::with_gil(|py| {
use std::os::unix::ffi::OsStrExt;
// this is not valid UTF-8
let payload = &[250, 251, 252, 253, 254, 255, 0, 255];
let os_str = OsStr::from_bytes(payload);
// do a roundtrip into Pythonland and back and compare
let py_str: PyObject = os_str.into_py(py);
let os_str_2: OsString = py_str.extract(py).unwrap();
assert_eq!(os_str, os_str_2);
});
} | rust_cleaned_test_functions.jsonl/21880 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 277
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21637,
39453,
23,
64132,
368,
341,
286,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
341,
310,
990,
1460,
486,
436,
486,
56646,
486,
53799,
486,
28867,
2580,
6756,
401,
310,
442,
419,
374,
537,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_issue_47() {
let mut encoder = create_test_encoder::<ByteArrayType>(0, Encoding::DELTA_BYTE_ARRAY);
let mut decoder = create_test_decoder::<ByteArrayType>(0, Encoding::DELTA_BYTE_ARRAY);
let mut input = vec![];
input.push(ByteArray::from("aa"));
input.push(ByteArray::from("aaa"));
input.push(ByteArray::from("aa"));
input.push(ByteArray::from("aaa"));
let mut output = vec![ByteArray::default(); input.len()];
let mut result = put_and_get(
&mut encoder, &mut decoder, &input[..2], &mut output[..2]);
assert!(result.is_ok(), "first put_and_get() failed with: {}", result.unwrap_err());
result = put_and_get(&mut encoder, &mut decoder, &input[2..], &mut output[2..]);
assert!(result.is_ok(), "second put_and_get() failed with: {}", result.unwrap_err());
assert_eq!(output, input);
} | rust_cleaned_test_functions.jsonl/45130 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 347
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53340,
62,
19,
22,
368,
341,
262,
1077,
5206,
23668,
284,
1855,
4452,
39068,
27638,
18394,
929,
2235,
15,
11,
29330,
486,
38332,
15204,
27349,
17724,
317,
262,
1077,
5206,
24551,
284,
1855,
4452,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_correct_ri_extracted() {
// RescaleIntercept exists for this scan
let test_file = dicom_test_files::path("pydicom/693_J2KR.dcm").unwrap();
let obj = open_file(test_file).unwrap();
let pixel_data = obj.decode_pixel_data().unwrap();
assert_eq!(pixel_data.rescale_intercept, -1024);
} | rust_cleaned_test_functions.jsonl/22482 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 157
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31550,
62,
461,
39123,
291,
368,
341,
286,
442,
1800,
2246,
3306,
1484,
6724,
369,
419,
8569,
198,
286,
1077,
1273,
2458,
284,
21249,
316,
4452,
10931,
486,
2343,
445,
3288,
29680,
316,
14,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_primitive_array_sum_all_nulls() {
let a = Primitive::<i32>::from(vec![None, None, None]).to(DataType::Int32);
assert_eq!(None, sum(&a));
} | rust_cleaned_test_functions.jsonl/101315 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 89
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84087,
3858,
10160,
5705,
15162,
82,
368,
341,
286,
1077,
264,
284,
51460,
27638,
72,
18,
17,
6831,
1499,
25592,
20703,
4064,
11,
2240,
11,
2240,
10697,
983,
63941,
486,
1072,
18,
17,
317,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_clear_unconfirmed_slot() {
let ledger_path = get_tmp_ledger_path_auto_delete!();
let blockstore = Blockstore::open(ledger_path.path()).unwrap();
let unconfirmed_slot = 9;
let unconfirmed_child_slot = 10;
let slots = vec![2, unconfirmed_slot, unconfirmed_child_slot];
let shreds: Vec<_> = make_chaining_slot_entries(&slots, 1)
.into_iter()
.flat_map(|x| x.0)
.collect();
blockstore.insert_shreds(shreds, None, false).unwrap();
// Should only be one shred in slot 9
assert!(blockstore
.get_data_shred(unconfirmed_slot, 0)
.unwrap()
.is_some());
assert!(blockstore
.get_data_shred(unconfirmed_slot, 1)
.unwrap()
.is_none());
blockstore.set_dead_slot(unconfirmed_slot).unwrap();
// Purge the slot
blockstore.clear_unconfirmed_slot(unconfirmed_slot);
assert!(!blockstore.is_dead(unconfirmed_slot));
assert_eq!(
blockstore
.meta(unconfirmed_slot)
.unwrap()
.unwrap()
.next_slots,
vec![unconfirmed_child_slot]
);
assert!(blockstore
.get_data_shred(unconfirmed_slot, 0)
.unwrap()
.is_none());
} | rust_cleaned_test_functions.jsonl/9577 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 733
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21811,
4907,
41028,
27563,
368,
341,
286,
1077,
46933,
2638,
284,
633,
16125,
38367,
1389,
2638,
27740,
11353,
0,
543,
286,
1077,
2504,
4314,
284,
8362,
4314,
486,
2508,
7,
50704,
2638,
3875,
6011... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_part1() {
assert_eq!(
parse_input("9 players; last marble is worth 25 points").play_the(),
32,
);
assert_eq!(
parse_input("10 players; last marble is worth 1618 points").play_the(),
8317,
);
assert_eq!(
parse_input("13 players; last marble is worth 7999 points").play_the(),
146373,
);
assert_eq!(
parse_input("17 players; last marble is worth 1104 points").play_the(),
2764,
);
assert_eq!(
parse_input("21 players; last marble is worth 6111 points").play_the(),
54718,
);
assert_eq!(
parse_input("30 players; last marble is worth 5807 points").play_the(),
37305,
);
} | rust_cleaned_test_functions.jsonl/39251 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 430
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10495,
16,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
5898,
445,
24,
4217,
26,
1537,
41290,
374,
5802,
220,
17,
20,
3501,
1827,
1363,
16068,
3148,
310,
220,
18,
17,
345,
286,
1439,
286,
206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_owned_bytes_read_u8() -> io::Result<()> {
let mut bytes = OwnedBytes::new(b"\xFF".as_ref());
assert_eq!(bytes.read_u8(), 255);
assert_eq!(bytes.len(), 0);
Ok(())
} | rust_cleaned_test_functions.jsonl/48685 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51973,
12524,
6443,
7300,
23,
368,
1464,
6399,
486,
2077,
71698,
341,
286,
1077,
5206,
5820,
284,
85093,
7078,
486,
931,
1883,
11934,
9264,
3263,
300,
7793,
1423,
286,
2060,
10714,
10297,
9651,
41... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse() {
let non_ignored_output = indoc! {"
tests::foo::test_bar: test
tests::baz::test_quux: test
benches::should_be_skipped: benchmark
"};
let ignored_output = indoc! {"
benches::ignored_should_be_skipped: benchmark
tests::ignored::test_bar: test
tests::baz::test_ignored: test
"};
let test_filter = TestFilterBuilder::any(RunIgnored::Default);
let fake_cwd: Utf8PathBuf = "/fake/cwd".into();
let fake_binary_name = "fake-binary".to_owned();
let fake_binary_id = "fake-package::fake-binary".to_owned();
let test_binary = RustTestArtifact {
binary_path: "/fake/binary".into(),
cwd: fake_cwd.clone(),
package: package_metadata(),
binary_name: fake_binary_name.clone(),
binary_id: fake_binary_id.clone(),
};
let test_list = TestList::new_with_outputs(
iter::once((test_binary, &non_ignored_output, &ignored_output)),
&test_filter,
)
.expect("valid output");
assert_eq!(
test_list.rust_suites,
btreemap! {
"/fake/binary".into() => RustTestSuite {
testcases: btreemap! {
"tests::foo::test_bar".to_owned() => RustTestCaseSummary {
ignored: false,
filter_match: FilterMatch::Matches,
},
"tests::baz::test_quux".to_owned() => RustTestCaseSummary {
ignored: false,
filter_match: FilterMatch::Matches,
},
"tests::ignored::test_bar".to_owned() => RustTestCaseSummary {
ignored: true,
filter_match: FilterMatch::Mismatch { reason: MismatchReason::Ignored },
},
"tests::baz::test_ignored".to_owned() => RustTestCaseSummary {
ignored: true,
filter_match: FilterMatch::Mismatch { reason: MismatchReason::Ignored },
},
},
cwd: fake_cwd,
package: package_metadata(),
binary_name: fake_binary_name,
binary_id: fake_binary_id,
}
}
);
// Check that the expected outputs are valid.
static EXPECTED_HUMAN: &str = indoc! {"
fake-package::fake-binary:
tests::baz::test_ignored (skipped)
tests::baz::test_quux
tests::foo::test_bar
tests::ignored::test_bar (skipped)
"};
static EXPECTED_HUMAN_VERBOSE: &str = indoc! {"
fake-package::fake-binary:
bin: /fake/binary
cwd: /fake/cwd
tests::baz::test_ignored (skipped)
tests::baz::test_quux
tests::foo::test_bar
tests::ignored::test_bar (skipped)
"};
static EXPECTED_JSON_PRETTY: &str = indoc! {r#"
{
"test-count": 4,
"rust-suites": {
"fake-package::fake-binary": {
"package-name": "metadata-helper",
"binary-name": "fake-binary",
"package-id": "metadata-helper 0.1.0 (path+file:///Users/fakeuser/local/testcrates/metadata/metadata-helper)",
"binary-path": "/fake/binary",
"cwd": "/fake/cwd",
"testcases": {
"tests::baz::test_ignored": {
"ignored": true,
"filter-match": {
"status": "mismatch",
"reason": "ignored"
}
},
"tests::baz::test_quux": {
"ignored": false,
"filter-match": {
"status": "matches"
}
},
"tests::foo::test_bar": {
"ignored": false,
"filter-match": {
"status": "matches"
}
},
"tests::ignored::test_bar": {
"ignored": true,
"filter-match": {
"status": "mismatch",
"reason": "ignored"
}
}
}
}
}
}"#};
assert_eq!(
test_list
.to_string(OutputFormat::Human { verbose: false })
.expect("human succeeded"),
EXPECTED_HUMAN
);
assert_eq!(
test_list
.to_string(OutputFormat::Human { verbose: true })
.expect("human succeeded"),
EXPECTED_HUMAN_VERBOSE
);
println!(
"{}",
test_list
.to_string(OutputFormat::Serializable(SerializableFormat::JsonPretty))
.expect("json-pretty succeeded")
);
assert_eq!(
test_list
.to_string(OutputFormat::Serializable(SerializableFormat::JsonPretty))
.expect("json-pretty succeeded"),
EXPECTED_JSON_PRETTY
);
} | rust_cleaned_test_functions.jsonl/42451 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3325
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
368,
341,
1789,
286,
1077,
2477,
62,
58471,
7645,
284,
1257,
509,
0,
314,
698,
310,
7032,
486,
7975,
486,
1944,
14388,
25,
1273,
198,
310,
7032,
486,
42573,
486,
1944,
11280,
2200,
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_handles_empty_global_options() {
let settings = json!({
"gopls": {
"local": "github.com/import/path/to/package"
}
});
let command = ServerCommand::Detailed(ServerDetails {
name: "gopls".into(),
command: vec!["gopls".into()],
initialization_options: None,
handlers: None,
});
let options = merged_initialization_options(&command, &settings);
assert!(options.is_some());
assert_eq!(
json!({
"local": "github.com/import/path/to/package",
}),
options.unwrap()
);
} | rust_cleaned_test_functions.jsonl/121119 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 362
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68017,
15124,
19296,
8743,
368,
341,
286,
1077,
5003,
284,
2951,
0,
2262,
310,
330,
70,
453,
4730,
788,
341,
394,
330,
2438,
788,
330,
5204,
905,
87284,
50976,
32429,
64000,
698,
310,
456,
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_cat() {
let a = ByteArray::from_slice_unnamed(b"A");
let b = ByteArray::from_slice_unnamed(b"B");
let c = ByteArray::from_slice_unnamed(b"C");
let d = ByteArray::from_slice_unnamed(b"D");
let ab = a.concat(b);
{
assert_eq!(ab.data.as_ref(), b"AB");
let preimage = ab.preimage.as_ref().expect("No preimage");
assert_eq!(preimage[0].data.as_ref(), b"A");
assert_eq!(preimage[0].preimage, None);
assert_eq!(preimage[1].data.as_ref(), b"B");
assert_eq!(preimage[1].preimage, None);
}
let abcd = ab.concat(c.concat(d));
{
assert_eq!(abcd.data.as_ref(), b"ABCD");
let preimage = abcd.preimage.as_ref().expect("No preimage");
assert_eq!(preimage.len(), 4);
assert_eq!(preimage[0].data.as_ref(), b"A");
assert_eq!(preimage[0].preimage, None);
assert_eq!(preimage[1].data.as_ref(), b"B");
assert_eq!(preimage[1].preimage, None);
assert_eq!(preimage[2].data.as_ref(), b"C");
assert_eq!(preimage[2].preimage, None);
assert_eq!(preimage[3].data.as_ref(), b"D");
assert_eq!(preimage[3].preimage, None);
}
} | rust_cleaned_test_functions.jsonl/86773 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 703
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20825,
368,
341,
286,
1077,
264,
284,
32920,
486,
1499,
26488,
4907,
30245,
1883,
29133,
797,
286,
1077,
293,
284,
32920,
486,
1499,
26488,
4907,
30245,
1883,
63590,
797,
286,
1077,
272,
284,
3292... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cpu_consume8() {
const N_IT: u16 = 5;
let mut mem = TestMemory { buff: [0; 65536] };
for i in 0..N_IT {
mem.buff[i as usize] = i as u8;
}
let mut cpu = Cpu8080::new();
cpu.state.reg_pc = 0;
for i in 0..N_IT {
let b = cpu.consume8(&mem).unwrap();
println!("PC: {}; b: {}", cpu.state.reg_pc, b);
assert_eq!(b, i as u8);
assert_eq!(cpu.state.reg_pc, i + 1 as u16);
}
} | rust_cleaned_test_functions.jsonl/35543 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 299
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21795,
3382,
31323,
23,
368,
341,
286,
733,
451,
41681,
25,
575,
16,
21,
284,
220,
20,
280,
286,
1077,
5206,
1833,
284,
3393,
10642,
314,
11522,
25,
508,
15,
26,
220,
21,
20,
20,
18,
21,
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... | 3 |
#[test]
fn test_emit_movq_memq_reg() {
assert_emit!(0x48, 0x8b, 0x44, 0x24, 1; emit_movq_memq_reg(RSP, 1, RAX));
assert_emit!(0x48, 0x8b, 0x05, 0xff, 0xff, 0xff, 0xff; emit_movq_memq_reg(RIP, -1, RAX));
assert_emit!(0x48, 0x8b, 0x05, 0, 0, 0, 0; emit_movq_memq_reg(RIP, 0, RAX));
assert_emit!(0x48, 0x8b, 0x05, 1, 0, 0, 0; emit_movq_memq_reg(RIP, 1, RAX));
assert_emit!(0x48, 0x8b, 0; emit_movq_memq_reg(RAX, 0, RAX));
} | rust_cleaned_test_functions.jsonl/85438 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 292
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
69082,
55798,
80,
12976,
80,
4920,
368,
341,
286,
2060,
69082,
10297,
15,
87,
19,
23,
11,
220,
15,
87,
23,
65,
11,
220,
15,
87,
19,
19,
11,
220,
15,
87,
17,
19,
11,
220,
16,
26,
16691,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_valid_sqs_get_queue_attributes() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/valid",
"sqs-get-queue-attributes.xml",
);
let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
let client = SqsClient::new_with(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = GetQueueAttributesRequest::default();
let result = client.get_queue_attributes(request).sync();
assert!(result.is_ok(), "parse error: {:?}", result);
} | rust_cleaned_test_functions.jsonl/49936 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 249
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8337,
643,
26358,
3062,
10841,
18240,
368,
341,
286,
1077,
7860,
9655,
284,
14563,
2582,
5062,
486,
878,
9655,
1006,
310,
330,
1944,
35569,
79372,
14,
1891,
756,
310,
330,
82,
26358,
22491,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_drain_items() {
let mut vec = vec![1, 2, 3];
let mut vec2 = vec![];
for i in vec.drain(..) {
vec2.push(i);
}
assert_eq!(vec, []);
assert_eq!(vec2, [1, 2, 3]);
} | rust_cleaned_test_functions.jsonl/24419 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 119
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26680,
466,
12134,
368,
341,
262,
1077,
5206,
7486,
284,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
935,
262,
1077,
5206,
7486,
17,
284,
7486,
0,
15078,
262,
369,
600,
304,
7486,
950,
29093,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_is_delta_with_no_committables() {
let (genesis_config, mint_keypair) = create_genesis_config(8000);
let bank = Bank::new(&genesis_config);
bank.is_delta.store(false, Relaxed);
let keypair1 = Keypair::new();
let keypair2 = Keypair::new();
let fail_tx =
system_transaction::transfer(&keypair1, &keypair2.pubkey(), 1, bank.last_blockhash());
// the account which this tx operated on will not be committed. Thus
// the bank is_delta should still be false
assert_eq!(
bank.process_transaction(&fail_tx),
Err(TransactionError::AccountNotFound)
);
// Check the bank is_delta is still false
assert!(!bank.is_delta.load(Relaxed));
// so is_delta should be true
assert_eq!(
bank.transfer(10_001, &mint_keypair, &solana_sdk::pubkey::new_rand()),
Err(TransactionError::InstructionError(
0,
SystemError::ResultWithNegativeLamports.into(),
))
);
assert!(bank.is_delta.load(Relaxed));
} | rust_cleaned_test_functions.jsonl/2604 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 548
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
26710,
6615,
6536,
2965,
23692,
4788,
368,
341,
286,
1077,
320,
77894,
5332,
11,
28337,
3097,
12670,
8,
284,
1855,
16322,
13774,
5332,
7,
23,
15,
15,
15,
317,
286,
1077,
6073,
284,
8547,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_block_decode_single_client() {
let packet_size: u16 = 1280;
let data_size: usize = packet_size as usize * MAX_SYMBOLS_IN_BLOCK as usize;
let data = gen_data(data_size);
let encoder = match BlockEncoder::new(0, packet_size, data.clone(), None) {
Ok(succ) => succ,
Err(error) => panic!("Failed to create encoder: {}", error),
};
let blocks = encoder.generate_encoded_blocks();
let decoder = match BlockDecoder::new(encoder.get_block_info()) {
Ok(succ) => succ,
Err(error) => panic!("Failed to create encoder: {}", error),
};
match decoder.decode_blocks(blocks) {
Ok(recovered_data) => assert_eq!(arr_eq(&recovered_data, &data), true),
Err(error) => panic!("Failed to decode data: {}", error),
}
} | rust_cleaned_test_functions.jsonl/96425 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 338
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7113,
15227,
19487,
8179,
368,
341,
262,
1077,
10151,
2368,
25,
575,
16,
21,
284,
220,
16,
17,
23,
15,
280,
262,
1077,
821,
2368,
25,
22301,
284,
10151,
2368,
438,
22301,
353,
8334,
23598,
50,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_csv_small() {
let data = "author,year,title\nalice,2000,my title".as_bytes();
let mut parser = Reader::new(data, ",", false);
let result: std::collections::HashMap<String, String> = [
(String::from("author"), String::from("alice")),
(String::from("year"), String::from("2000")),
(String::from("title"), String::from("my title")),
]
.iter()
.cloned()
.collect();
assert_eq!(parser.next().unwrap().unwrap(), result);
} | rust_cleaned_test_functions.jsonl/71999 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 251
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14020,
31966,
368,
341,
286,
1077,
821,
284,
330,
3094,
11,
3157,
65477,
1699,
63195,
11,
17,
15,
15,
15,
11,
2408,
2265,
3263,
300,
12524,
543,
286,
1077,
5206,
6729,
284,
25166,
486,
931,
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_vshlq_n_u8() {
unsafe {
let a: [u8; 16] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16];
let e: [u8; 16] = [4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64];
let r = vshlq_n_u8(transmute(a), 2);
assert!(cmp_arm(r, transmute(e)));
}
} | rust_cleaned_test_functions.jsonl/33023 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 219
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
927,
75,
80,
1089,
7300,
23,
368,
341,
286,
19860,
341,
310,
1077,
264,
25,
508,
84,
23,
26,
220,
16,
21,
60,
284,
508,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_string_str() {
let s = String::from;
let mut map = indexmap! {
s("a") => 1, s("b") => 2,
s("x") => 3, s("y") => 4,
};
assert!(map.contains_key("a"));
assert!(!map.contains_key("z"));
assert_eq!(map.swap_remove("b"), Some(2));
} | rust_cleaned_test_functions.jsonl/20960 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 150
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
2895,
368,
341,
262,
1077,
274,
284,
923,
486,
1499,
280,
262,
1077,
5206,
2415,
284,
1922,
2186,
0,
341,
286,
274,
445,
64,
899,
589,
220,
16,
11,
274,
445,
65,
899,
589,
220,
17,
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_whitespace_tokenize() {
// Given
let test_tuples = [
(
"Sentence with 4 tokens.",
(
vec!["Sentence", "with", "4", "tokens."],
vec![
Offset::new(0, 8),
Offset::new(9, 13),
Offset::new(14, 15),
Offset::new(16, 23),
],
),
),
(
"Nowhitespacesinthissentence.",
(
vec!["Nowhitespacesinthissentence."],
vec![Offset::new(0, 28)],
),
),
(
"Tab\tSeparated\tSentence",
(
vec!["Tab", "Separated", "Sentence"],
vec![Offset::new(0, 3), Offset::new(4, 13), Offset::new(14, 22)],
),
),
(
"Newlines\nseparated\nsentence",
(
vec!["Newlines", "separated", "sentence"],
vec![Offset::new(0, 8), Offset::new(9, 18), Offset::new(19, 27)],
),
),
(
"Sentence with �replacement character.",
(
vec!["Sentence", "with", "�replacement", "character."], /* i vec![
Offset::new(0, 8),
Offset::new(9, 13),
Offset::new(14, 26),
Offset::new(27, 37),
],
),
),
(
" leading and trailing spaces ",
(
vec!["leading", "and", "trailing", "spaces"],
vec![
Offset::new(1, 8),
Offset::new(9, 12),
Offset::new(13, 21),
Offset::new(22, 28),
],
),
),
(
" Multiple spaces in-between ",
(
vec!["Multiple", "spaces", "in-between"],
vec![Offset::new(1, 9), Offset::new(10, 16), Offset::new(19, 29)],
),
),
];
// for (source_text, expected_result) in test_tuples.iter() {
let offsets =
(0..source_text.chars().count() as OffsetSize).collect::<Vec<OffsetSize>>();
let (tokens, offsets): (Vec<&str>, Vec<Offset>) =
whitespace_tokenize(TokenRef::new(source_text, offsets.as_slice()))
.into_iter()
.map(|t| (t.text, t.offset))
.unzip();
assert_eq!(tokens, expected_result.0);
assert_eq!(offsets, expected_result.1);
}
}
} | rust_cleaned_test_functions.jsonl/13631 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1952
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
86175,
86508,
368,
341,
286,
442,
286,
16246,
198,
286,
1077,
1273,
89269,
284,
2278,
310,
2399,
394,
330,
84564,
448,
220,
19,
11211,
10346,
394,
2399,
503,
7486,
0,
1183,
84564,
497,
330,
4197... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_0023_example_1() {
let lists = vec![linked![1, 4, 5], linked![1, 3, 4], linked![2, 6]];
let result = linked![1, 1, 2, 3, 4, 4, 5, 6];
assert_eq!(Solution::merge_k_lists(lists), result);
} | rust_cleaned_test_functions.jsonl/69633 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 123
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
15,
15,
17,
18,
39304,
62,
16,
368,
341,
286,
1077,
11469,
284,
7486,
20703,
43133,
20703,
16,
11,
220,
19,
11,
220,
20,
1125,
10592,
20703,
16,
11,
220,
18,
11,
220,
19,
1125,
10592,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_size() {
assert_leaf! {
parsers [ size ]
"123MB" -> 0..5 { Size(Number::Int(123), Unit::MB) }
}
assert_leaf! {
parsers [ size ]
"10GB" -> 0..4 { Size(Number::Int(10), Unit::GB) }
}
} | rust_cleaned_test_functions.jsonl/50646 | {
"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,
2368,
368,
341,
286,
2060,
38909,
0,
341,
310,
87073,
508,
1379,
5133,
310,
330,
16,
17,
18,
8412,
1,
1464,
220,
15,
496,
20,
314,
8478,
42999,
486,
1072,
7,
16,
17,
18,
701,
7954,
486,
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_alpn_server_unilateral() {
let server = Server::builder().build();
let mut client = server.client();
client.ctx().set_alpn_protos(b"\x06http/2").unwrap();
let s = client.connect();
assert_eq!(None, s.ssl().selected_alpn_protocol());
} | rust_cleaned_test_functions.jsonl/40295 | {
"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,
8418,
19958,
12015,
4907,
42939,
368,
341,
262,
1077,
3538,
284,
8422,
486,
17850,
1005,
5834,
1428,
262,
1077,
5206,
2943,
284,
3538,
6581,
543,
262,
2943,
30608,
1005,
746,
8418,
19958,
22357,
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_stackoverflow_does_not_occur_issue_186() {
assert_does_not_demangle("__ZNSt3__18__bind_rINS_4pairINS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE8cc_errorEEZN5stlab2v15asyncIZNSB_14serial_queue_tclIZN12_GLOBAL__N_114future_adaptorIN10redacteLib12ValueOrErrorIS7_EEZNK10cc_element17rendition_requestEmbE4$_14EEDaNS_6futureIT_EEOT0_EUlSO_E_JNSN_ISJ_EEEEESM_OSO_DpOT0_EUlSU_E_SS_JST_EEENSB_6futureINS_9result_ofIFNS_5decayISQ_E4typeEDpNS11_IT1_E4typeEEE4typeEvEESO_SR_DpOS14_EUlRST_E_JST_EEC1IS1F_JST_EvEESU_SX_");
} | rust_cleaned_test_functions.jsonl/87924 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 285
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15528,
20823,
96374,
7913,
49648,
2352,
53340,
62,
16,
23,
21,
368,
341,
262,
2060,
96374,
7913,
69403,
4044,
58406,
44847,
623,
18,
563,
16,
23,
563,
7666,
1710,
9557,
62,
19,
12670,
9557,
62,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_established_fin_after_missing() {
let mut s = socket_established();
send!(s, TcpRepr {
control: TcpControl::Fin,
seq_number: REMOTE_SEQ + 1 + 6,
ack_number: Some(LOCAL_SEQ + 1),
payload: &b"123456"[..],
..SEND_TEMPL
}, Ok(Some(TcpRepr {
seq_number: LOCAL_SEQ + 1,
ack_number: Some(REMOTE_SEQ + 1),
..RECV_TEMPL
})));
assert_eq!(s.state, State::Established);
send!(s, TcpRepr {
seq_number: REMOTE_SEQ + 1,
ack_number: Some(LOCAL_SEQ + 1),
payload: &b"abcdef"[..],
..SEND_TEMPL
}, Ok(Some(TcpRepr {
seq_number: LOCAL_SEQ + 1,
ack_number: Some(REMOTE_SEQ + 1 + 6 + 6),
window_len: 52,
..RECV_TEMPL
})));
assert_eq!(s.state, State::Established);
} | rust_cleaned_test_functions.jsonl/1729 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 550
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18583,
5102,
291,
39737,
19844,
40447,
368,
341,
286,
1077,
5206,
274,
284,
7575,
18583,
5102,
291,
543,
286,
3624,
10297,
82,
11,
64876,
693,
649,
341,
310,
2524,
25,
64876,
3273,
486,
9134,
34... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_scalar_value_custom() {
assert_eq!(
<CustomUserId as GraphQLType<DefaultScalarValue>>::name(&()),
Some("MyUserId")
);
let mut registry: Registry = Registry::new(FnvHashMap::default());
let meta = CustomUserId::meta(&(), &mut registry);
assert_eq!(meta.name(), Some("MyUserId"));
assert_eq!(
meta.description(),
Some(&"custom description...".to_string())
);
let input: InputValue = serde_json::from_value(serde_json::json!("userId1")).unwrap();
let output: CustomUserId = FromInputValue::from_input_value(&input).unwrap();
assert_eq!(output, CustomUserId("userId1".into()),);
let id = CustomUserId("111".into());
let output = ToInputValue::<DefaultScalarValue>::to_input_value(&id);
assert_eq!(output, InputValue::scalar("111"),);
} | rust_cleaned_test_functions.jsonl/27375 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 332
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41652,
3142,
15875,
368,
341,
262,
2060,
10714,
33673,
286,
366,
10268,
13504,
438,
35087,
929,
27,
3675,
20639,
1130,
77595,
606,
2099,
14702,
286,
4329,
445,
5050,
13504,
1138,
262,
3475,
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... | 1 |
#[test]
fn test_set_and_get_remote_head() {
let mut conn = schemaReplicant::tests::setup_conn_bare();
let causetx = schemaReplicant::tests::setup_causecausetx(&mut conn);
let uuid = Uuid::new_v4();
SyncSpacetime::set_remote_head(&causetx, &uuid).expect("update succeeded");
assert_eq!(uuid, SyncSpacetime::remote_head(&causetx).expect("fetch succeeded"));
} | rust_cleaned_test_functions.jsonl/85374 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 178
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
8378,
3062,
36425,
13138,
368,
341,
286,
1077,
5206,
4534,
284,
10802,
18327,
35237,
486,
23841,
486,
15188,
17241,
880,
546,
543,
286,
1077,
2162,
18187,
87,
284,
10802,
18327,
35237,
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_invalid_json() {
let invalid_json = [
r#"{"name": "William Henderson}"#,
r#"William Henderson"#,
r#"{"age": 16..}"#,
r#"{"height": {"feet": six, "inches": 0}}"#,
r#"1337a"#,
r#"{"middleNames":]}"#,
];
for json in &invalid_json {
assert!(Document::new("test", json).is_none());
}
} | rust_cleaned_test_functions.jsonl/98059 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 196
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
9455,
368,
341,
262,
1077,
8318,
9455,
284,
2278,
286,
435,
55543,
4913,
606,
788,
330,
44787,
44577,
9863,
2,
345,
286,
435,
55543,
44787,
44577,
57676,
345,
286,
435,
55543,
4913,
424,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_events_via_websocket_stream() {
let num_nodes = 2;
let mut env = SmokeTestEnvironment::new(num_nodes);
// Update all nodes to enable websockets
for node_index in 0..num_nodes {
let (mut node_config, _) = load_node_config(&env.validator_swarm, node_index);
node_config.json_rpc.stream_rpc.enabled = true;
save_node_config(&mut node_config, &env.validator_swarm, node_index);
}
env.validator_swarm.launch();
let client = env.get_validator_client(0, None);
let currencies = client
.client
.get_currency_info()
.expect("Could not get currency info");
let rt = Runtime::new().unwrap();
let _guard = rt.enter();
let ms_500 = Duration::from_millis(500);
let config = Some(StreamingClientConfig {
channel_size: 1,
ok_timeout_millis: 1_000,
});
let mut s_client = rt
.block_on(timeout(ms_500, client.streaming_client(config)))
.unwrap_or_else(|e| panic!("Timeout creating StreamingClient: {}", e))
.unwrap_or_else(|e| panic!("Error connecting to WS endpoint: {}", e));
for (i, currency) in currencies.iter().enumerate() {
println!("Subscribing to events for {}", ¤cy.code);
let mut subscription_stream = rt
.block_on(timeout(
ms_500,
s_client.subscribe_events(currency.mint_events_key, 0),
))
.unwrap_or_else(|e| panic!("Timeout subscribing to {}: {}", ¤cy.code, e))
.unwrap_or_else(|e| {
panic!("Error subscribing to currency '{}': {}", ¤cy.code, e)
});
assert_eq!(subscription_stream.id(), &Id::Number(i as u64));
let count_before = rt
.block_on(timeout(ms_500, s_client.subscription_count()))
.unwrap_or_else(|e| panic!("Timeout count for {}: {}", ¤cy.code, e));
assert_eq!(count_before, 1, "Only one subscription should be running");
let count_after;
if ¤cy.code == "XUS" {
println!("Getting msg 1 for {}", ¤cy.code);
let response = rt
.block_on(timeout(ms_500, subscription_stream.next()))
.unwrap_or_else(|e| panic!("Timeout getting message 1: {}", e))
.unwrap_or_else(|| panic!("Currency '{}' response 1 is None", ¤cy.code))
.unwrap_or_else(|e| {
panic!("Currency '{}' response 1 is Err: {}", ¤cy.code, e)
});
println!("Got msg 1 for {}: {:?}", ¤cy.code, &response);
let response_view = response
.parse_result(&StreamMethod::SubscribeToEvents)
.unwrap_or_else(|e| {
panic!(
"Currency '{}' response 1 view is err: {}",
¤cy.code, e
)
})
.unwrap_or_else(|| panic!("Currency '{}' response 1 view is None", ¤cy.code));
match response_view {
StreamJsonRpcResponseView::Event(_) => {}
_ => panic!("Expected 'Event', but got: {:?}", response_view),
}
}
drop(subscription_stream);
rt.block_on(sleep(ms_500));
count_after = rt
.block_on(timeout(ms_500, s_client.subscription_count()))
.unwrap_or_else(|e| panic!("Timeout count for {}: {}", ¤cy.code, e));
assert_eq!(
count_after, 0,
"No subscriptions should be running at the end"
);
}
} | rust_cleaned_test_functions.jsonl/81627 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1744
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
19691,
80710,
25960,
9556,
12673,
368,
341,
262,
1077,
1629,
14896,
284,
220,
17,
280,
262,
1077,
5206,
6105,
284,
53204,
2271,
12723,
486,
931,
8068,
14896,
626,
262,
442,
5549,
678,
7798,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
#[test]
fn test_vote_state_commission_split() {
let vote_state = VoteState::default();
assert_eq!(vote_state.commission_split(1), (0, 1, false));
let mut vote_state = VoteState {
commission: std::u8::MAX,
..VoteState::default()
};
assert_eq!(vote_state.commission_split(1), (1, 0, false));
vote_state.commission = 99;
assert_eq!(vote_state.commission_split(10), (9, 0, true));
vote_state.commission = 1;
assert_eq!(vote_state.commission_split(10), (0, 9, true));
vote_state.commission = 50;
let (voter_portion, staker_portion, was_split) = vote_state.commission_split(10);
assert_eq!((voter_portion, staker_portion, was_split), (5, 5, true));
} | rust_cleaned_test_functions.jsonl/6102 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 357
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54360,
4387,
2965,
2728,
17052,
368,
341,
286,
1077,
6910,
4387,
284,
34034,
1397,
486,
2258,
1428,
286,
2060,
10714,
10297,
29358,
4387,
905,
2728,
17052,
7,
16,
701,
320,
15,
11,
220,
16,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_all_refs_super_mod_vis() {
check(
r#"
//- /lib.rs
mod foo;
//- /foo.rs
mod some;
use some::Foo;
fn f() {
let i = Foo { n: 5 };
}
//- /foo/some.rs
pub(super) struct Foo$0 {
pub n: u32,
}
"#,
expect![[r#"
Foo Struct FileId(2) 0..41 18..21
FileId(1) 20..23
FileId(1) 47..50
"#]],
);
} | rust_cleaned_test_functions.jsonl/60652 | {
"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,
21814,
5705,
60638,
38886,
7480,
15887,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
61463,
608,
2740,
25638,
198,
2593,
15229,
401,
61463,
608,
7975,
25638,
198,
2593,
1045,
280,
810,
1045,
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_compatible_networks() {
assert!(check_compatibility(Network::Bitcoin, Network::Bitcoin).is_ok());
assert!(check_compatibility(Network::Regtest, Network::Regtest).is_ok());
assert!(check_compatibility(Network::Regtest, Network::Testnet).is_ok());
assert!(check_compatibility(Network::Testnet, Network::Regtest).is_ok());
assert!(check_compatibility(Network::Testnet, Network::Testnet).is_ok());
assert!(check_compatibility(Network::Bitcoin, Network::Testnet).is_err());
assert!(check_compatibility(Network::Bitcoin, Network::Regtest).is_err());
assert!(check_compatibility(Network::Regtest, Network::Bitcoin).is_err());
assert!(check_compatibility(Network::Testnet, Network::Bitcoin).is_err());
} | rust_cleaned_test_functions.jsonl/116946 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 289
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2965,
37079,
20966,
82,
368,
341,
286,
2060,
10297,
2028,
2965,
53053,
77623,
486,
48287,
11,
8141,
486,
48287,
568,
285,
19817,
1423,
286,
2060,
10297,
2028,
2965,
53053,
77623,
486,
3477,
1944,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_insert_cname() {
let name = Name::from_str("web.example.com.").unwrap();
let cname = Name::from_str("www.example.com.").unwrap();
let new_cname = Name::from_str("w2.example.com.").unwrap();
let record_type = RecordType::CNAME;
let mut rr_set = RecordSet::new(&name, record_type, 0);
let insert = Record::new()
.set_name(name.clone())
.set_ttl(3600)
.set_rr_type(RecordType::CNAME)
.set_dns_class(DNSClass::IN)
.set_rdata(RData::CNAME(cname.clone()))
.clone();
let new_record = Record::new()
.set_name(name.clone())
.set_ttl(3600)
.set_rr_type(RecordType::CNAME)
.set_dns_class(DNSClass::IN)
.set_rdata(RData::CNAME(new_cname.clone()))
.clone();
assert!(rr_set.insert(insert.clone(), 0));
assert!(rr_set.records_without_rrsigs().any(|ref x| x == &&insert));
// update the record
assert!(rr_set.insert(new_record.clone(), 0));
assert!(!rr_set.records_without_rrsigs().any(|ref x| x == &&insert));
assert!(rr_set
.records_without_rrsigs()
.any(|ref x| x == &&new_record));
} | rust_cleaned_test_functions.jsonl/119979 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 661
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
666,
606,
368,
341,
286,
1077,
829,
284,
3988,
486,
1499,
2895,
445,
2911,
7724,
905,
98401,
15454,
543,
286,
1077,
78514,
284,
3988,
486,
1499,
2895,
445,
2136,
7724,
905,
98401,
15454,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_ptsname_equivalence() {
let _m = crate::PTSNAME_MTX.lock();
// Open a new PTTY master
let master_fd = posix_openpt(OFlag::O_RDWR).unwrap();
assert!(master_fd.as_raw_fd() > 0);
// Get the name of the slave
let slave_name = unsafe { ptsname(&master_fd) }.unwrap() ;
let slave_name_r = ptsname_r(&master_fd).unwrap();
assert_eq!(slave_name, slave_name_r);
} | rust_cleaned_test_functions.jsonl/72575 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 178
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41878,
606,
41443,
88790,
368,
341,
262,
1077,
716,
76,
284,
17717,
486,
73693,
7535,
1245,
22867,
21003,
1428,
262,
442,
5264,
264,
501,
393,
55544,
7341,
198,
262,
1077,
7341,
17676,
284,
98343,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_ipaddress_to_lifipaddr() {
assert_eq!(
LifIpAddr::from(&fnet::IpAddress::Ipv4(fnet::Ipv4Address { addr: [1, 2, 3, 4] })),
LifIpAddr { address: "1.2.3.4".parse().unwrap(), prefix: 32 }
);
assert_eq!(
LifIpAddr::from(&fnet::IpAddress::Ipv6(fnet::Ipv6Address {
addr: [0xfe, 0x80, 0, 0, 0, 0, 0, 0, 0xfc, 0xb6, 0x5b, 0x27, 0xfd, 0x2c, 0xf, 0x12]
})),
LifIpAddr { address: "fe80::fcb6:5b27:fd2c:f12".parse().unwrap(), prefix: 128 }
);
} | rust_cleaned_test_functions.jsonl/81920 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 342
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
10385,
4995,
2346,
907,
333,
573,
6214,
368,
341,
286,
2060,
10714,
33673,
310,
64763,
23378,
13986,
486,
1499,
2099,
69,
4711,
486,
98567,
486,
80656,
19,
955,
4711,
486,
80656,
19,
4286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_display_error() {
assert_eq!(
format!("{}", Error::TxBufFull),
"Attempted to push data to a full TX buffer"
);
assert_eq!(
format!("{}", Error::TxBufFlush(std::io::Error::from(std::io::ErrorKind::Other))),
"An I/O error occurred, when attempting to flush the connection TX buffer: other os error"
);
assert_eq!(
format!("{}", Error::StreamWrite(std::io::Error::from(std::io::ErrorKind::Other))),
"An I/O error occurred, when attempting to write data to the host-side stream: other os error"
);
} | rust_cleaned_test_functions.jsonl/109148 | {
"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,
14825,
4096,
368,
341,
286,
2060,
10714,
33673,
310,
3561,
79878,
4600,
486,
51,
14377,
1704,
9432,
1326,
310,
330,
47052,
291,
311,
4484,
821,
311,
264,
2480,
17031,
4147,
698,
286,
3475,
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_closure5() {
assert_eq!(
eval_ok(
"class T {}
direct method closeOver: value
return { |x | value + x }!
direct method test
return (self closeOver: 40) value: 2!
end
T test"
)
.integer(),
42
);
} | rust_cleaned_test_functions.jsonl/15565 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 228
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
72823,
20,
368,
341,
262,
2060,
10714,
33673,
286,
5603,
19817,
1006,
310,
330,
1040,
350,
5613,
338,
2118,
1714,
3265,
1918,
25,
897,
198,
3824,
470,
314,
760,
87,
760,
897,
488,
856,
335,
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_position_parse_result_extract() {
let input_and_expected:Vec<(PositionParseResult,(Teban,Banmen,MochigomaCollections,u32,Vec<Move>))> = vec![
(PositionParseResult(
Teban::Sente,UsiInitialPosition::Startpos,1,vec![]
),(Teban::Sente,Banmen([
[GKyou,GKei,GGin,GKin,GOu,GKin,GGin,GKei,GKyou],
[Blank,GHisha,Blank,Blank,Blank,Blank,Blank,GKaku,Blank],
[GFu,GFu,GFu,GFu,GFu,GFu,GFu,GFu,GFu],
[Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank],
[Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank],
[Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank],
[SFu,SFu,SFu,SFu,SFu,SFu,SFu,SFu,SFu],
[Blank,SKaku,Blank,Blank,Blank,Blank,Blank,SHisha,Blank],
[SKyou,SKei,SGin,SKin,SOu,SKin,SGin,SKei,SKyou],
]),MochigomaCollections::Pair(HashMap::new(),HashMap::new()),1,vec![])),
(PositionParseResult(
Teban::Gote,UsiInitialPosition::Sfen(Banmen([
[Blank,Blank,Blank,Blank,GOu,GKin,GGin,GKei,GKyou],
[Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank],
[Blank,GFu,GFu,GFu,GFu,GFu,GFu,GFu,GFu],
[Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank],
[Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank],
[Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank],
[SFu,SFu,SFu,SFu,SFu,SFu,SFu,SFu,Blank],
[Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank],
[SKyou,SKei,SGin,SKin,SOu,Blank,Blank,Blank,Blank],
]),MochigomaCollections::Pair(vec![
(MochigomaKind::Hisha,1),
(MochigomaKind::Kaku,1),
(MochigomaKind::Kin,1),
(MochigomaKind::Gin,1),
(MochigomaKind::Kei,1),
(MochigomaKind::Kyou,1),
(MochigomaKind::Fu,1),
].into_iter().fold(HashMap::new(), |mut acc,(k,n)| {
acc.insert(k,n);
acc
}),vec![
(MochigomaKind::Hisha,1),
(MochigomaKind::Kaku,1),
(MochigomaKind::Kin,1),
(MochigomaKind::Gin,1),
(MochigomaKind::Kei,1),
(MochigomaKind::Kyou,1),
(MochigomaKind::Fu,1),
].into_iter().fold(HashMap::new(), |mut acc,(k,n)| {
acc.insert(k,n);
acc
}))),1,vec![
Move::To(KomaSrcPosition(7,7),KomaDstToPosition(7,6,false)),
Move::To(KomaSrcPosition(3,3),KomaDstToPosition(3,4,false)),
Move::To(KomaSrcPosition(8,8),KomaDstToPosition(3,3,false)),
]
),(Teban::Gote,Banmen([
[Blank,Blank,Blank,Blank,GOu,GKin,GGin,GKei,GKyou],
[Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank],
[Blank,GFu,GFu,GFu,GFu,GFu,GFu,GFu,GFu],
[Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank],
[Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank],
[Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank],
[SFu,SFu,SFu,SFu,SFu,SFu,SFu,SFu,Blank],
[Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank],
[SKyou,SKei,SGin,SKin,SOu,Blank,Blank,Blank,Blank],
]),MochigomaCollections::Pair(vec![
(MochigomaKind::Hisha,1),
(MochigomaKind::Kaku,1),
(MochigomaKind::Kin,1),
(MochigomaKind::Gin,1),
(MochigomaKind::Kei,1),
(MochigomaKind::Kyou,1),
(MochigomaKind::Fu,1),
].into_iter().fold(HashMap::new(), |mut acc,(k,n)| {
acc.insert(k,n);
acc
}),vec![
(MochigomaKind::Hisha,1),
(MochigomaKind::Kaku,1),
(MochigomaKind::Kin,1),
(MochigomaKind::Gin,1),
(MochigomaKind::Kei,1),
(MochigomaKind::Kyou,1),
(MochigomaKind::Fu,1),
].into_iter().fold(HashMap::new(), |mut acc,(k,n)| {
acc.insert(k,n);
acc
})),1,vec![
Move::To(KomaSrcPosition(7,7),KomaDstToPosition(7,6,false)),
Move::To(KomaSrcPosition(3,3),KomaDstToPosition(3,4,false)),
Move::To(KomaSrcPosition(8,8),KomaDstToPosition(3,3,false)),
])),
(PositionParseResult(
Teban::Sente,UsiInitialPosition::Sfen(Banmen([
[GKyou,GKei,GGin,GKin,GOu,GKin,GGin,GKei,GKyou],
[Blank,GHisha,Blank,Blank,Blank,Blank,Blank,GKaku,Blank],
[GFu,GFu,GFu,GFu,GFu,GFu,GFu,Blank,GFu],
[Blank,Blank,Blank,Blank,Blank,Blank,Blank,GFu,Blank],
[Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank],
[Blank,SFu,Blank,Blank,Blank,Blank,Blank,Blank,Blank],
[SFu,Blank,SFu,SFu,SFu,SFu,SFu,SFu,SFu],
[Blank,SKaku,Blank,Blank,Blank,Blank,Blank,SHisha,Blank],
[SKyou,SKei,SGin,SKin,SOu,SKin,SGin,SKei,SKyou],
]),MochigomaCollections::Empty),1,vec![]
),(Teban::Sente,Banmen([
[GKyou,GKei,GGin,GKin,GOu,GKin,GGin,GKei,GKyou],
[Blank,GHisha,Blank,Blank,Blank,Blank,Blank,GKaku,Blank],
[GFu,GFu,GFu,GFu,GFu,GFu,GFu,Blank,GFu],
[Blank,Blank,Blank,Blank,Blank,Blank,Blank,GFu,Blank],
[Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank,Blank],
[Blank,SFu,Blank,Blank,Blank,Blank,Blank,Blank,Blank],
[SFu,Blank,SFu,SFu,SFu,SFu,SFu,SFu,SFu],
[Blank,SKaku,Blank,Blank,Blank,Blank,Blank,SHisha,Blank],
[SKyou,SKei,SGin,SKin,SOu,SKin,SGin,SKei,SKyou],
]),MochigomaCollections::Pair(HashMap::new(),HashMap::new()),1,vec![])),
];
for (i,r) in input_and_expected.into_iter() {
assert_eq!(i.extract(),r);
}
} | rust_cleaned_test_functions.jsonl/46549 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2842
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9661,
21039,
5287,
39123,
368,
972,
10217,
1946,
8378,
32190,
25,
10050,
28706,
3812,
14463,
2077,
12950,
51,
3065,
276,
8161,
276,
5676,
27014,
4953,
343,
7786,
52730,
36883,
18,
17,
11,
10050,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_encrypt_decrypt_oaep() {
let priv_key = get_private_key();
do_test_encrypt_decrypt_oaep::<Sha1>(&priv_key);
do_test_encrypt_decrypt_oaep::<Sha224>(&priv_key);
do_test_encrypt_decrypt_oaep::<Sha256>(&priv_key);
do_test_encrypt_decrypt_oaep::<Sha384>(&priv_key);
do_test_encrypt_decrypt_oaep::<Sha512>(&priv_key);
do_test_encrypt_decrypt_oaep::<Sha3_256>(&priv_key);
do_test_encrypt_decrypt_oaep::<Sha3_384>(&priv_key);
do_test_encrypt_decrypt_oaep::<Sha3_512>(&priv_key);
} | rust_cleaned_test_functions.jsonl/29040 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 302
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66593,
80764,
14179,
64,
747,
368,
341,
286,
1077,
6095,
3097,
284,
633,
26249,
3097,
543,
286,
653,
4452,
66593,
80764,
14179,
64,
747,
27638,
62316,
16,
44784,
11887,
3097,
317,
286,
653,
4452,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_task() {
crate::init().unwrap();
let pad = crate::Pad::new(Some("sink"), crate::PadDirection::Sink);
let (sender, receiver) = channel();
let mut i = 0;
let pad_clone = pad.clone();
pad.start_task(move || {
i += 1;
if i == 3 {
sender.send(i).unwrap();
pad_clone.pause_task().unwrap();
}
})
.unwrap();
assert_eq!(receiver.recv().unwrap(), 3);
} | rust_cleaned_test_functions.jsonl/4736 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 277
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12184,
368,
341,
286,
17717,
486,
2327,
1005,
15454,
1428,
286,
1077,
11016,
284,
17717,
486,
13731,
486,
931,
65405,
445,
66738,
3975,
17717,
486,
13731,
9268,
486,
45094,
317,
286,
1077,
320,
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_resize_and_rent() {
let GenesisConfigInfo {
mut genesis_config,
mint_keypair,
..
} = create_genesis_config_with_leader(1_000_000_000, &Pubkey::new_unique(), 42);
genesis_config.rent = Rent::default();
activate_all_features(&mut genesis_config);
let mut bank = Bank::new_for_tests(&genesis_config);
let mock_program_id = Pubkey::new_unique();
bank.add_builtin(
"mock_realloc_program",
&mock_program_id,
mock_realloc_process_instruction,
);
let recent_blockhash = bank.last_blockhash();
let account_data_size_small = 1024;
let rent_exempt_minimum_small =
genesis_config.rent.minimum_balance(account_data_size_small);
let account_data_size_large = 2048;
let rent_exempt_minimum_large =
genesis_config.rent.minimum_balance(account_data_size_large);
let funding_keypair = Keypair::new();
bank.store_account(
&funding_keypair.pubkey(),
&AccountSharedData::new(1_000_000_000, 0, &mock_program_id),
);
let rent_paying_pubkey = solana_sdk::pubkey::new_rand();
let mut rent_paying_account = AccountSharedData::new(
rent_exempt_minimum_small - 1,
account_data_size_small,
&mock_program_id,
);
rent_paying_account.set_rent_epoch(1);
// restore program-owned account
bank.store_account(&rent_paying_pubkey, &rent_paying_account);
let tx = create_mock_realloc_tx(
&mint_keypair,
&funding_keypair,
&rent_paying_pubkey,
account_data_size_large,
rent_exempt_minimum_small - 1,
mock_program_id,
recent_blockhash,
);
let expected_err = {
let account_index = tx
.message
.account_keys
.iter()
.position(|key| key == &rent_paying_pubkey)
.unwrap() as u8;
TransactionError::InsufficientFundsForRent { account_index }
};
assert_eq!(bank.process_transaction(&tx).unwrap_err(), expected_err);
assert_eq!(
rent_exempt_minimum_small - 1,
bank.get_account(&rent_paying_pubkey).unwrap().lamports()
);
let tx = create_mock_realloc_tx(
&mint_keypair,
&funding_keypair,
&rent_paying_pubkey,
account_data_size_large,
rent_exempt_minimum_large,
mock_program_id,
recent_blockhash,
);
let result = bank.process_transaction(&tx);
assert!(result.is_ok());
assert_eq!(
rent_exempt_minimum_large,
bank.get_account(&rent_paying_pubkey).unwrap().lamports()
);
let tx = create_mock_realloc_tx(
&mint_keypair,
&funding_keypair,
&rent_paying_pubkey,
account_data_size_small,
rent_exempt_minimum_small - 1,
mock_program_id,
recent_blockhash,
);
let expected_err = {
let account_index = tx
.message
.account_keys
.iter()
.position(|key| key == &rent_paying_pubkey)
.unwrap() as u8;
TransactionError::InsufficientFundsForRent { account_index }
};
assert_eq!(bank.process_transaction(&tx).unwrap_err(), expected_err);
assert_eq!(
rent_exempt_minimum_large,
bank.get_account(&rent_paying_pubkey).unwrap().lamports()
);
let tx = create_mock_realloc_tx(
&mint_keypair,
&funding_keypair,
&rent_paying_pubkey,
account_data_size_small,
rent_exempt_minimum_small,
mock_program_id,
recent_blockhash,
);
let result = bank.process_transaction(&tx);
assert!(result.is_ok());
assert_eq!(
rent_exempt_minimum_small,
bank.get_account(&rent_paying_pubkey).unwrap().lamports()
);
let tx = create_mock_realloc_tx(
&mint_keypair,
&funding_keypair,
&rent_paying_pubkey,
account_data_size_large,
rent_exempt_minimum_large - 1,
mock_program_id,
recent_blockhash,
);
let expected_err = {
let account_index = tx
.message
.account_keys
.iter()
.position(|key| key == &rent_paying_pubkey)
.unwrap() as u8;
TransactionError::InsufficientFundsForRent { account_index }
};
assert_eq!(bank.process_transaction(&tx).unwrap_err(), expected_err);
assert_eq!(
rent_exempt_minimum_small,
bank.get_account(&rent_paying_pubkey).unwrap().lamports()
);
let tx = create_mock_realloc_tx(
&mint_keypair,
&funding_keypair,
&rent_paying_pubkey,
account_data_size_large,
rent_exempt_minimum_large,
mock_program_id,
recent_blockhash,
);
let result = bank.process_transaction(&tx);
assert!(result.is_ok());
assert_eq!(
rent_exempt_minimum_large,
bank.get_account(&rent_paying_pubkey).unwrap().lamports()
);
let created_keypair = Keypair::new();
let tx = system_transaction::create_account(
&mint_keypair,
&created_keypair,
recent_blockhash,
rent_exempt_minimum_small - 1,
account_data_size_small as u64,
&system_program::id(),
);
let expected_err = {
let account_index = tx
.message
.account_keys
.iter()
.position(|key| key == &created_keypair.pubkey())
.unwrap() as u8;
TransactionError::InsufficientFundsForRent { account_index }
};
assert_eq!(bank.process_transaction(&tx).unwrap_err(), expected_err);
let tx = system_transaction::create_account(
&mint_keypair,
&created_keypair,
recent_blockhash,
rent_exempt_minimum_small,
account_data_size_small as u64,
&system_program::id(),
);
let result = bank.process_transaction(&tx);
assert!(result.is_ok());
assert_eq!(
rent_exempt_minimum_small,
bank.get_account(&created_keypair.pubkey())
.unwrap()
.lamports()
);
let created_keypair = Keypair::new();
let tx = system_transaction::create_account(
&mint_keypair,
&created_keypair,
recent_blockhash,
rent_exempt_minimum_small - 1,
0,
&system_program::id(),
);
let result = bank.process_transaction(&tx);
assert!(result.is_ok());
assert_eq!(
rent_exempt_minimum_small - 1,
bank.get_account(&created_keypair.pubkey())
.unwrap()
.lamports()
);
// alloc but not rent exempt
let tx = system_transaction::allocate(
&mint_keypair,
&created_keypair,
recent_blockhash,
(account_data_size_small + 1) as u64,
);
let expected_err = {
let account_index = tx
.message
.account_keys
.iter()
.position(|key| key == &created_keypair.pubkey())
.unwrap() as u8;
TransactionError::InsufficientFundsForRent { account_index }
};
assert_eq!(bank.process_transaction(&tx).unwrap_err(), expected_err);
// bring balance of account up to rent exemption
let tx = system_transaction::transfer(
&mint_keypair,
&created_keypair.pubkey(),
1,
recent_blockhash,
);
let result = bank.process_transaction(&tx);
assert!(result.is_ok());
assert_eq!(
rent_exempt_minimum_small,
bank.get_account(&created_keypair.pubkey())
.unwrap()
.lamports()
);
// allocate as rent exempt
let tx = system_transaction::allocate(
&mint_keypair,
&created_keypair,
recent_blockhash,
account_data_size_small as u64,
);
let result = bank.process_transaction(&tx);
assert!(result.is_ok());
assert_eq!(
rent_exempt_minimum_small,
bank.get_account(&created_keypair.pubkey())
.unwrap()
.lamports()
);
} | rust_cleaned_test_functions.jsonl/29023 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 4805
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53370,
8378,
83127,
368,
341,
286,
1077,
40788,
2648,
1731,
341,
310,
5206,
59366,
5332,
345,
310,
28337,
3097,
12670,
345,
310,
54538,
286,
335,
284,
1855,
16322,
13774,
5332,
6615,
79991,
7,
16,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_div_rounded() {
for (divident, divisor, rnd_mode, result) in TESTDATA {
let quot = i128_div_rounded(divident, divisor, Some(rnd_mode));
assert_eq!(quot, result);
}
} | rust_cleaned_test_functions.jsonl/54683 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 119
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16237,
29896,
291,
368,
341,
286,
369,
320,
611,
1713,
11,
49109,
11,
37193,
7302,
11,
1102,
8,
304,
13602,
17777,
341,
310,
1077,
26370,
284,
600,
16,
17,
23,
16237,
29896,
291,
38291,
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
] | 2 |
#[test]
fn test_lmdb() {
run_test(|blockstore_path| {
let ctx = LmdbContext::new(Path::new(blockstore_path), 3, Some(1024 * 1024))
.map_err(|err| DatabaseError::InitError(format!("{}", err)))
.unwrap();
let database = LmdbDatabase::new(ctx, &["a", "b"])
.map_err(|err| DatabaseError::InitError(format!("{}", err)))
.unwrap();
assert_database_count(0, &database);
assert_not_in_database(3, &database);
assert_not_in_database(5, &database);
// Add {3: 4}
let mut writer = database.writer().unwrap();
writer.put(&[3], &[4]).unwrap();
assert_database_count(0, &database);
assert_not_in_database(3, &database);
writer.commit().unwrap();
assert_database_count(1, &database);
assert_key_value(3, 4, &database);
// Add {5: 6}
let mut writer = database.writer().unwrap();
writer.put(&[5], &[6]).unwrap();
writer.commit().unwrap();
assert_database_count(2, &database);
assert_key_value(5, 6, &database);
assert_key_value(3, 4, &database);
// Delete {3: 4}
let mut writer = database.writer().unwrap();
writer.delete(&[3]).unwrap();
assert_database_count(2, &database);
writer.commit().unwrap();
assert_database_count(1, &database);
assert_key_value(5, 6, &database);
assert_not_in_database(3, &database);
// Add {55: 5} in "a"
assert_index_count("a", 0, &database);
assert_index_count("b", 0, &database);
assert_not_in_index("a", 5, &database);
assert_not_in_index("b", 5, &database);
let mut writer = database.writer().unwrap();
writer.index_put("a", &[55], &[5]).unwrap();
assert_index_count("a", 0, &database);
assert_index_count("b", 0, &database);
assert_not_in_index("a", 5, &database);
assert_not_in_index("b", 5, &database);
writer.commit().unwrap();
assert_index_count("a", 1, &database);
assert_index_count("b", 0, &database);
assert_index_key_value("a", 55, 5, &database);
assert_not_in_index("b", 5, &database);
assert_database_count(1, &database);
assert_key_value(5, 6, &database);
assert_not_in_database(3, &database);
// Delete {55: 5} in "a"
let mut writer = database.writer().unwrap();
writer.index_delete("a", &[55]).unwrap();
assert_index_count("a", 1, &database);
assert_index_count("b", 0, &database);
assert_index_key_value("a", 55, 5, &database);
assert_not_in_index("b", 5, &database);
writer.commit().unwrap();
assert_index_count("a", 0, &database);
assert_index_count("b", 0, &database);
assert_not_in_index("a", 5, &database);
assert_not_in_index("b", 5, &database);
assert_database_count(1, &database);
assert_key_value(5, 6, &database);
assert_not_in_database(3, &database);
})
} | rust_cleaned_test_functions.jsonl/92525 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1693
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
907,
78127,
368,
341,
286,
1598,
4452,
22428,
4574,
4314,
2638,
91,
341,
310,
1077,
5635,
284,
444,
76,
69762,
486,
931,
33030,
486,
931,
18682,
4314,
2638,
701,
220,
18,
11,
4329,
7,
16,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_not_found_http_get_request() {
let port = start_server();
// Check that GET requests return a NotFound status
let resp =
reqwest::blocking::get(&format!("http://127.0.0.1:{}/test/not_here", port)).unwrap();
assert_eq!(resp.status(), StatusCode::NOT_FOUND);
} | rust_cleaned_test_functions.jsonl/126001 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7913,
21480,
25888,
3062,
7893,
368,
341,
286,
1077,
2635,
284,
1191,
12015,
1428,
286,
442,
4248,
429,
7890,
7388,
470,
264,
23420,
2639,
198,
286,
1077,
9039,
4035,
310,
4232,
11039,
486,
70356,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_aggregate_partition() {
let metrics = ExecutionPlanMetricsSet::new();
// Note cpu_time1 has labels so it is not aggregated with 2 and 3
let elapsed_compute1 = MetricBuilder::new(&metrics)
.with_new_label("foo", "bar")
.elapsed_compute(1);
elapsed_compute1.add_duration(Duration::from_nanos(12));
let elapsed_compute2 = MetricBuilder::new(&metrics).elapsed_compute(2);
elapsed_compute2.add_duration(Duration::from_nanos(34));
let elapsed_compute3 = MetricBuilder::new(&metrics).elapsed_compute(4);
elapsed_compute3.add_duration(Duration::from_nanos(56));
let output_rows = MetricBuilder::new(&metrics).output_rows(1); // output rows
output_rows.add(56);
let aggregated = metrics.clone_inner().aggregate_by_partition();
// cpu time should be aggregated:
let elapsed_computes = aggregated
.iter()
.filter(|metric| {
matches!(metric.value(), MetricValue::ElapsedCompute(_))
&& metric.labels().is_empty()
})
.collect::<Vec<_>>();
assert_eq!(elapsed_computes.len(), 1);
assert_eq!(elapsed_computes[0].value().as_usize(), 34 + 56);
assert!(elapsed_computes[0].partition().is_none());
// output rows should
let output_rows = aggregated
.iter()
.filter(|metric| matches!(metric.value(), MetricValue::OutputRows(_)))
.collect::<Vec<_>>();
assert_eq!(output_rows.len(), 1);
assert_eq!(output_rows[0].value().as_usize(), 56);
assert!(output_rows[0].partition.is_none())
} | rust_cleaned_test_functions.jsonl/28186 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 778
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20587,
14240,
43840,
368,
341,
286,
1077,
16734,
284,
30928,
20485,
27328,
1649,
486,
931,
1428,
286,
442,
7036,
17319,
3009,
16,
702,
9201,
773,
432,
374,
537,
70822,
448,
220,
17,
323,
220,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_next_node() {
let p = build_problem();
let s = find_optimal_sequence(&p);
let n1 = new_node(&p);
let n2 = build_next_node(&n1, &s, true, &p);
let m2 = Node {
value: 3,
contained: vec![true],
room: 4,
estimate: 4.8f64,
};
assert_eq!(n2.unwrap(), m2);
let n3 = build_next_node(&n1, &s, false, &p);
let m3 = Node {
value: 0,
contained: vec![false],
room: 5,
estimate: 2.2f64,
};
assert_eq!(n3.unwrap(), m3);
} | rust_cleaned_test_functions.jsonl/69081 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 447
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11257,
5084,
368,
341,
310,
1077,
281,
284,
1936,
60139,
543,
310,
1077,
274,
284,
1477,
15032,
2861,
23735,
2099,
79,
317,
310,
1077,
308,
16,
284,
501,
5084,
2099,
79,
317,
310,
1077,
308,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_size_cursor() {
let file = File::open("Cargo.toml").unwrap();
let mut curs = SizeCursor::new_pos(file, 10);
let mut buf = [0; 4];
curs.seek(SeekFrom::End(-2)).unwrap();
assert_eq!(2, curs.read(&mut buf).unwrap());
let s = str::from_utf8(buf.as_ref()).unwrap();
assert!(s.contains("\n"));
} | rust_cleaned_test_functions.jsonl/115218 | {
"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,
2368,
28601,
368,
341,
262,
1077,
1034,
284,
2887,
486,
2508,
445,
98228,
73494,
75,
1827,
15454,
543,
262,
1077,
5206,
23143,
284,
8478,
14543,
486,
931,
6479,
4866,
11,
220,
16,
15,
317,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_load_policy() {
let linux = Policy::from_name("linux").unwrap();
assert!(linux.symbol_versions.is_empty());
assert!(linux.lib_whitelist.is_empty());
let manylinux2010 = Policy::from_name("manylinux2010").unwrap();
assert!(manylinux2010.lib_whitelist.contains("libc.so.6"));
let symbol_version = &manylinux2010.symbol_versions["x86_64"];
assert_eq!(symbol_version["CXXABI"].len(), 4);
let cxxabi = &symbol_version["CXXABI"];
for version in &["1.3", "1.3.1", "1.3.2", "1.3.3"] {
assert!(cxxabi.contains(*version));
}
} | rust_cleaned_test_functions.jsonl/19481 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 309
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12411,
22773,
368,
341,
286,
1077,
36245,
284,
10974,
486,
1499,
1269,
445,
14210,
1827,
15454,
543,
286,
2060,
10297,
14210,
39209,
65148,
2079,
15124,
1423,
286,
2060,
10297,
14210,
14947,
36225,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_raft_engine() {
let content = r#"
[raft-engine]
enable = true
recovery_mode = "tolerate-corrupted-tail-records"
bytes-per-sync = "64KB"
purge-threshold = "1GB"
"#;
let cfg: TiKvConfig = toml::from_str(content).unwrap();
assert!(cfg.raft_engine.enable);
let config = &cfg.raft_engine.config;
assert_eq!(
config.recovery_mode,
RecoveryMode::TolerateCorruptedTailRecords
);
assert_eq!(config.bytes_per_sync.0, ReadableSize::kb(64).0);
assert_eq!(config.purge_threshold.0, ReadableSize::gb(1).0);
} | rust_cleaned_test_functions.jsonl/31108 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 352
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
2944,
24823,
368,
341,
286,
1077,
2213,
284,
435,
2,
698,
310,
508,
2944,
49625,
921,
310,
7283,
284,
830,
198,
310,
13351,
7302,
284,
330,
20576,
58668,
45613,
85954,
2385,
604,
12,
26203,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_resolve_parent_module_for_inline() {
let (analysis, pos) = analysis_and_position(
"
//- /lib.rs
mod foo {
mod bar {
mod baz { <|> }
}
}
",
);
let symbols = analysis.parent_module(pos).unwrap();
assert_eq_dbg(
r#"[(FileId(1), FileSymbol { name: "bar", node_range: [18; 21), kind: MODULE })]"#,
&symbols,
);
} | rust_cleaned_test_functions.jsonl/75850 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 240
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77291,
15960,
10750,
5478,
41871,
368,
341,
262,
1077,
320,
34484,
11,
1133,
8,
284,
6358,
8378,
9661,
1006,
286,
6228,
286,
78406,
608,
2740,
25638,
198,
286,
1463,
15229,
341,
310,
1463,
3619,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_account_updates() {
// Reverse updates
let account_map_initial = {
let mut map = AccountMap::default();
let account_0 = Account {
nonce: Nonce(8),
..Default::default()
};
let account_1 = Account {
nonce: Nonce(16),
..Default::default()
};
map.insert(AccountId(0), account_0);
map.insert(AccountId(1), account_1);
map
};
let account_map_updated_expected = {
let mut map = AccountMap::default();
let mut account_1 = Account {
nonce: Nonce(17),
..Default::default()
};
account_1.set_balance(TokenId(0), 256u32.into());
map.insert(AccountId(1), account_1);
let account_2 = Account {
nonce: Nonce(36),
..Default::default()
};
map.insert(AccountId(2), account_2);
map
};
let updates = {
let mut updates = AccountUpdates::new();
updates.push((
AccountId(0),
AccountUpdate::Delete {
address: Address::default(),
nonce: Nonce(8),
},
));
updates.push((
AccountId(1),
AccountUpdate::UpdateBalance {
old_nonce: Nonce(16),
new_nonce: Nonce(17),
balance_update: (TokenId(0), 0u32.into(), 256u32.into()),
},
));
updates.push((
AccountId(2),
AccountUpdate::Create {
address: Address::default(),
nonce: Nonce(36),
},
));
updates
};
let account_map_updated = {
let mut map = account_map_initial.clone();
apply_updates(&mut map, updates.clone());
map
};
assert_eq!(account_map_updated, account_map_updated_expected);
let account_map_updated_back = {
let mut map = account_map_updated;
let mut reversed = updates;
reverse_updates(&mut reversed);
apply_updates(&mut map, reversed);
map
};
assert_eq!(account_map_updated_back, account_map_initial);
} | rust_cleaned_test_functions.jsonl/52688 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1408
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13500,
57829,
368,
341,
16885,
286,
442,
24277,
8837,
271,
286,
1077,
2692,
5376,
15809,
284,
341,
310,
1077,
5206,
2415,
284,
8615,
2227,
486,
2258,
543,
310,
1077,
2692,
62,
15,
284,
8615,
341... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_load_header_linux() -> Result<(), Error> {
let buffer = ByteView::open("../testutils/fixtures/symcache/current/linux.symc")?;
let symcache = SymCache::parse(&buffer)?;
insta::assert_debug_snapshot_matches!(symcache, @r###"
⋮SymCache {
⋮ debug_id: DebugId {
⋮ uuid: "c0bcc3f1-9827-fe65-3058-404b2831d9e6",
⋮ appendix: 0,
⋮ },
⋮ arch: Amd64,
⋮ has_line_info: true,
⋮ has_file_info: true,
⋮ functions: 1955,
⋮}
"###);
Ok(())
} | rust_cleaned_test_functions.jsonl/30027 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 281
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12411,
8757,
77463,
368,
1464,
5714,
68843,
4600,
29,
341,
262,
1077,
4147,
284,
10906,
851,
486,
2508,
17409,
1944,
6031,
94275,
2687,
1600,
9360,
74053,
63844,
50901,
66,
899,
37445,
262,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_rand() {
let got1 = RpnFnScalarEvaluator::new()
.evaluate::<Real>(ScalarFuncSig::Rand)
.unwrap()
.unwrap();
let got2 = RpnFnScalarEvaluator::new()
.evaluate::<Real>(ScalarFuncSig::Rand)
.unwrap()
.unwrap();
assert!(got1 < Real::from(1.0));
assert!(got1 >= Real::from(0.0));
assert!(got2 < Real::from(1.0));
assert!(got2 >= Real::from(0.0));
assert_ne!(got1, got2);
} | rust_cleaned_test_functions.jsonl/37500 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 301
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33864,
368,
341,
286,
1077,
2684,
16,
284,
431,
19958,
24911,
20639,
89042,
486,
931,
741,
310,
659,
47291,
27638,
12768,
2235,
20639,
9626,
47246,
486,
56124,
340,
310,
659,
15454,
741,
310,
659,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bulk_load_large() {
let random_points = create_random_integers::<[i32; 2]>(3000, SEED_1);
create_and_check_bulk_loading_with_points(&random_points);
} | rust_cleaned_test_functions.jsonl/115385 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 89
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71392,
12411,
45228,
368,
341,
286,
1077,
4194,
12928,
284,
1855,
22644,
4042,
67592,
27638,
58,
72,
18,
17,
26,
220,
17,
60,
2235,
18,
15,
15,
15,
11,
5052,
1479,
62,
16,
317,
286,
1855,
83... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_datetime_format_with_local() {
let dt = Local::now().with_month(5).unwrap();
assert_eq!(dt.format("%Y").to_string(), dt.with_timezone(&Utc).format("%Y").to_string());
} | rust_cleaned_test_functions.jsonl/17724 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28943,
8955,
6615,
13564,
368,
341,
1789,
286,
1077,
7594,
284,
8774,
486,
3328,
1005,
4197,
18933,
7,
20,
568,
15454,
543,
286,
2060,
10714,
10297,
8047,
8021,
4430,
56,
1827,
983,
3904,
1507,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_trivial() {
let mut r = crate::test::rng(1);
let always_false = Bernoulli::new(0.0).unwrap();
let always_true = Bernoulli::new(1.0).unwrap();
for _ in 0..5 {
assert_eq!(r.sample::<bool, _>(&always_false), false);
assert_eq!(r.sample::<bool, _>(&always_true), true);
assert_eq!(Distribution::<bool>::sample(&always_false, &mut r), false);
assert_eq!(Distribution::<bool>::sample(&always_true, &mut r), true);
}
} | rust_cleaned_test_functions.jsonl/4565 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 259
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3547,
26658,
368,
341,
286,
1077,
5206,
435,
284,
17717,
486,
1944,
486,
69890,
7,
16,
317,
286,
1077,
2677,
36015,
284,
14168,
283,
39976,
486,
931,
7,
15,
13,
15,
568,
15454,
543,
286,
1077,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_each_feature() {
let output = cargo_hack()
.args(&["hack", "check", "--each-feature"])
.current_dir(test_dir("tests/fixtures/real"))
.output()
.unwrap();
output
.assert_success()
.assert_stderr_contains("running `cargo check` on real")
.assert_stderr_contains("running `cargo check --no-default-features` on real")
.assert_stderr_contains("running `cargo check --no-default-features --features a` on real")
.assert_stderr_contains("running `cargo check --no-default-features --features b` on real")
.assert_stderr_contains("running `cargo check --no-default-features --features c` on real");
} | rust_cleaned_test_functions.jsonl/25308 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 289
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32046,
17069,
368,
341,
262,
1077,
2550,
284,
25652,
1523,
473,
741,
286,
659,
2116,
2099,
1183,
65972,
497,
330,
2028,
497,
14482,
9547,
91840,
14108,
286,
659,
3231,
4334,
8623,
4334,
445,
23841... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unchanged_at_end() {
let arena = Arena::new();
let config = from_language(guess_language::Language::EmacsLisp);
let lhs_nodes = parse(&arena, "A B unchanged", &config);
let rhs_nodes = parse(&arena, "X unchanged", &config);
init_info(&lhs_nodes, &rhs_nodes);
let (lhs_after_skip, rhs_after_skip) = skip_unchanged_at_ends(&lhs_nodes, &rhs_nodes);
assert_eq!(
lhs_nodes[2].change(),
Some(ChangeKind::Unchanged(rhs_nodes[1]))
);
assert_eq!(
rhs_nodes[1].change(),
Some(ChangeKind::Unchanged(lhs_nodes[2]))
);
assert_eq!(lhs_after_skip.len(), 2);
assert_eq!(rhs_after_skip.len(), 1);
} | rust_cleaned_test_functions.jsonl/20814 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 390
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
3185,
3726,
3752,
6213,
368,
341,
286,
1077,
24902,
284,
27047,
486,
931,
543,
286,
1077,
2193,
284,
504,
29021,
98302,
29021,
486,
13806,
486,
2269,
19252,
43,
13090,
626,
286,
1077,
22505,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_range_step_inclusive() {
assert_eq!(range_step_inclusive(0, 20, 5).collect::<Vec<int>>(), [0, 5, 10, 15, 20]);
assert_eq!(range_step_inclusive(20, 0, -5).collect::<Vec<int>>(), [20, 15, 10, 5, 0]);
assert_eq!(range_step_inclusive(20, 0, -6).collect::<Vec<int>>(), [20, 14, 8, 2]);
assert_eq!(range_step_inclusive(200u8, 255, 50).collect::<Vec<u8>>(), [200u8, 250]);
assert_eq!(range_step_inclusive(200, -5, 1).collect::<Vec<int>>(), []);
assert_eq!(range_step_inclusive(200, 200, 1).collect::<Vec<int>>(), [200]);
} | rust_cleaned_test_functions.jsonl/112375 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 259
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9698,
11946,
1243,
8336,
368,
341,
262,
2060,
10714,
10297,
9669,
11946,
1243,
8336,
7,
15,
11,
220,
17,
15,
11,
220,
20,
568,
17384,
27638,
10050,
4159,
2452,
1507,
508,
15,
11,
220,
20,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_program_bpf_finalize() {
solana_logger::setup();
let GenesisConfigInfo {
genesis_config,
mint_keypair,
..
} = create_genesis_config(50);
let mut bank = Bank::new_for_tests(&genesis_config);
let (name, id, entrypoint) = solana_bpf_loader_program!();
bank.add_builtin(&name, &id, entrypoint);
let bank = Arc::new(bank);
let bank_client = BankClient::new_shared(&bank);
let program_pubkey = load_bpf_program(
&bank_client,
&bpf_loader::id(),
&mint_keypair,
"solana_bpf_rust_finalize",
);
let noop_keypair = Keypair::new();
// Write the noop program into the same program account
let elf = read_bpf_program("solana_bpf_rust_noop");
let message = Message::new(
&[system_instruction::create_account(
&mint_keypair.pubkey(),
&noop_keypair.pubkey(),
1,
elf.len() as u64 * 2,
&bpf_loader::id(),
)],
Some(&mint_keypair.pubkey()),
);
assert!(bank_client
.send_and_confirm_message(&[&mint_keypair, &noop_keypair], message)
.is_ok());
write_bpf_program(
&bank_client,
&bpf_loader::id(),
&mint_keypair,
&noop_keypair,
&elf,
);
let account_metas = vec![
AccountMeta::new(noop_keypair.pubkey(), true),
AccountMeta::new_readonly(bpf_loader::id(), false),
AccountMeta::new(rent::id(), false),
];
let instruction = Instruction::new_with_bytes(program_pubkey, &[], account_metas.clone());
let message = Message::new(&[instruction], Some(&mint_keypair.pubkey()));
let result = bank_client.send_and_confirm_message(&[&mint_keypair, &noop_keypair], message);
assert_eq!(
result.unwrap_err().unwrap(),
TransactionError::InstructionError(0, InstructionError::ProgramFailedToComplete)
);
} | rust_cleaned_test_functions.jsonl/5759 | {
"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,
25096,
880,
15897,
70616,
368,
341,
262,
2048,
3362,
27413,
486,
15188,
1428,
262,
1077,
40788,
2648,
1731,
341,
286,
59366,
5332,
345,
286,
28337,
3097,
12670,
345,
286,
54538,
262,
335,
284,
185... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_complement() {
let mut graph: Graph<(), (), Directed> = Graph::new();
let a = graph.add_node(());
let b = graph.add_node(());
let c = graph.add_node(());
let d = graph.add_node(());
graph.extend_with_edges(&[(a, b), (b, c), (c, d)]);
let mut output: Graph<(), (), Directed> = Graph::new();
complement(&graph, &mut output, ());
let mut expected_res: Graph<(), (), Directed> = Graph::new();
let a = expected_res.add_node(());
let b = expected_res.add_node(());
let c = expected_res.add_node(());
let d = expected_res.add_node(());
expected_res.extend_with_edges(&[
(a, c),
(a, d),
(b, a),
(b, d),
(c, a),
(c, b),
(d, a),
(d, b),
(d, c),
]);
for x in graph.node_indices() {
for y in graph.node_indices() {
assert_eq!(output.contains_edge(x, y), expected_res.contains_edge(x, y));
}
}
} | rust_cleaned_test_functions.jsonl/13569 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 475
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2965,
2764,
368,
341,
262,
1077,
5206,
4771,
25,
12165,
68843,
38104,
77205,
29,
284,
12165,
486,
931,
543,
262,
1077,
264,
284,
4771,
1364,
5084,
7,
1423,
262,
1077,
293,
284,
4771,
1364,
5084,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_accounts_locks_multithreaded() {
let counter = Arc::new(AtomicU64::new(0));
let exit = Arc::new(AtomicBool::new(false));
let keypair0 = Keypair::new();
let keypair1 = Keypair::new();
let keypair2 = Keypair::new();
let account0 = AccountSharedData::new(1, 0, &Pubkey::default());
let account1 = AccountSharedData::new(2, 0, &Pubkey::default());
let account2 = AccountSharedData::new(3, 0, &Pubkey::default());
let accounts = Accounts::new_with_config_for_tests(
Vec::new(),
&ClusterType::Development,
AccountSecondaryIndexes::default(),
false,
AccountShrinkThreshold::default(),
);
accounts.store_slow_uncached(0, &keypair0.pubkey(), &account0);
accounts.store_slow_uncached(0, &keypair1.pubkey(), &account1);
accounts.store_slow_uncached(0, &keypair2.pubkey(), &account2);
let accounts_arc = Arc::new(accounts);
let instructions = vec![CompiledInstruction::new(2, &(), vec![0, 1])];
let readonly_message = Message::new_with_compiled_instructions(
1,
0,
2,
vec![keypair0.pubkey(), keypair1.pubkey(), native_loader::id()],
Hash::default(),
instructions,
);
let readonly_tx = new_sanitized_tx(&[&keypair0], readonly_message, Hash::default());
let instructions = vec![CompiledInstruction::new(2, &(), vec![0, 1])];
let writable_message = Message::new_with_compiled_instructions(
1,
0,
2,
vec![keypair1.pubkey(), keypair2.pubkey(), native_loader::id()],
Hash::default(),
instructions,
);
let writable_tx = new_sanitized_tx(&[&keypair1], writable_message, Hash::default());
let counter_clone = counter.clone();
let accounts_clone = accounts_arc.clone();
let exit_clone = exit.clone();
thread::spawn(move || {
let counter_clone = counter_clone.clone();
let exit_clone = exit_clone.clone();
loop {
let txs = vec![writable_tx.clone()];
let results = accounts_clone
.clone()
.lock_accounts(txs.iter(), &FeatureSet::all_enabled());
for result in results.iter() {
if result.is_ok() {
counter_clone.clone().fetch_add(1, Ordering::SeqCst);
}
}
accounts_clone.unlock_accounts(txs.iter(), &results);
if exit_clone.clone().load(Ordering::Relaxed) {
break;
}
}
});
let counter_clone = counter;
for _ in 0..5 {
let txs = vec![readonly_tx.clone()];
let results = accounts_arc
.clone()
.lock_accounts(txs.iter(), &FeatureSet::all_enabled());
if results[0].is_ok() {
let counter_value = counter_clone.clone().load(Ordering::SeqCst);
thread::sleep(time::Duration::from_millis(50));
assert_eq!(counter_value, counter_clone.clone().load(Ordering::SeqCst));
}
accounts_arc.unlock_accounts(txs.iter(), &results);
thread::sleep(time::Duration::from_millis(50));
}
exit.store(true, Ordering::Relaxed);
} | rust_cleaned_test_functions.jsonl/13220 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1746
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55665,
9818,
82,
26290,
410,
878,
291,
368,
341,
286,
1077,
5546,
284,
19689,
486,
931,
7,
65857,
52,
21,
19,
486,
931,
7,
15,
1106,
286,
1077,
4869,
284,
19689,
486,
931,
7,
65857,
11233,
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... | 7 |
#[test]
fn test_bit_set_symmetric_difference() {
let mut a = BitSet::new();
let mut b = BitSet::new();
assert!(a.insert(1));
assert!(a.insert(3));
assert!(a.insert(5));
assert!(a.insert(9));
assert!(a.insert(11));
assert!(b.insert(3));
assert!(b.insert(9));
assert!(b.insert(14));
assert!(b.insert(220));
let expected = [1, 5, 11, 14, 220];
let actual: Vec<_> = a.symmetric_difference(&b).collect();
assert_eq!(actual, expected);
} | rust_cleaned_test_functions.jsonl/76228 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 285
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13996,
2602,
26825,
15903,
47525,
368,
341,
286,
1077,
5206,
264,
284,
57227,
486,
931,
543,
286,
1077,
5206,
293,
284,
57227,
486,
931,
1428,
286,
2060,
10297,
64,
7030,
7,
16,
1106,
286,
2060,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_broadcast_4() {
let a = arange(0., 4., 1.).to_matrix().reshape(1, 4);
let b = arange(0., 4., 1.).to_matrix().reshape(4, 1);
let c = broadcast_sub(&a, &b);
assert_eq!(
c,
Matrix::new(
[0., 1., 2., 3., -1., 0., 1., 2., -2., -1., 0., 1., -3., -2., -1., 0.],
4,
4
)
);
let d = broadcast_mul(&a, &b.t());
assert_eq!(d, Matrix::new([0., 1., 4., 9.], 1, 4));
let e = broadcast_add(&b, &a.t());
assert_eq!(e, Matrix::new([0., 2., 4., 6.], 4, 1));
} | rust_cleaned_test_functions.jsonl/55659 | {
"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,
74923,
62,
19,
368,
341,
286,
1077,
264,
284,
796,
844,
7,
15,
2572,
220,
19,
2572,
220,
16,
35334,
983,
10193,
1005,
16137,
7,
16,
11,
220,
19,
317,
286,
1077,
293,
284,
796,
844,
7,
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_strip() {
let markdown = indoc!(
"
# Header
```shell, script(name=\"something\")
run
```
"
);
let expected = indoc!(
"
# Header
``` shell
run
```
"
);
assert_eq!(strip(markdown), expected.to_string());
} | rust_cleaned_test_functions.jsonl/72478 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 339
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66130,
368,
341,
310,
1077,
50494,
284,
1257,
509,
33673,
394,
6228,
394,
671,
12104,
271,
394,
54275,
21384,
11,
5316,
3153,
4070,
33331,
59,
1138,
394,
1598,
198,
394,
41233,
394,
6228,
310,
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_ne() {
assert!(decimal("0.0") != decimal("1.0"));
assert!(decimal(BIGS[0]) != decimal(BIGS[1]));
} | rust_cleaned_test_functions.jsonl/58105 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 65
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13925,
368,
341,
262,
2060,
10297,
23289,
445,
15,
13,
15,
899,
961,
12122,
445,
16,
13,
15,
4010,
262,
2060,
10297,
23289,
5349,
1914,
50,
58,
15,
2467,
961,
12122,
5349,
1914,
50,
58,
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 |
#[test]
fn test_system_spawn() -> () {
let system = KompactConfig::default().build().expect("system");
let handle = system.spawn(async move { "test".to_string() });
let res = futures::executor::block_on(handle).expect("result");
assert_eq!(res, "test");
} | rust_cleaned_test_functions.jsonl/36839 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 123
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17687,
76026,
368,
1464,
1719,
341,
286,
1077,
1849,
284,
730,
14435,
531,
2648,
486,
2258,
1005,
5834,
1005,
17119,
445,
8948,
797,
286,
1077,
3705,
284,
1849,
59296,
18285,
3271,
314,
330,
1944,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_param() {
let uuid_str = "c1aa1e3b-9614-4895-9ebd-705255fa5bc2";
let uuid = Uuid::from_param(uuid_str).unwrap();
assert_eq!(uuid_str, uuid.to_string());
} | rust_cleaned_test_functions.jsonl/1535 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
4090,
368,
341,
286,
1077,
16040,
2895,
284,
330,
66,
16,
5305,
16,
68,
18,
65,
12,
24,
21,
16,
19,
12,
19,
23,
24,
20,
12,
24,
3065,
67,
12,
22,
15,
20,
17,
20,
20,
3632,
20,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cache_addresses_refill() {
let db = MemoryDatabase::new();
let wallet: OfflineWallet<_> = Wallet::new_offline("wpkh(tpubEBr4i6yk5nf5DAaJpsi9N2pPYBeJ7fZ5Z9rmN4977iYLCGco1VyjB9tvvuvYtfZzjD5A8igzgw3HeWeeKFmanHYqksqZXYXGsw5zjnj7KM9/*)", None, Network::Testnet, db).unwrap();
assert_eq!(
wallet.get_new_address().unwrap().to_string(),
"tb1q6yn66vajcctph75pvylgkksgpp6nq04ppwct9a"
);
assert!(wallet
.database
.borrow_mut()
.get_script_pubkey_from_path(ScriptType::External, CACHE_ADDR_BATCH_SIZE - 1)
.unwrap()
.is_some());
for _ in 0..CACHE_ADDR_BATCH_SIZE {
wallet.get_new_address().unwrap();
}
assert!(wallet
.database
.borrow_mut()
.get_script_pubkey_from_path(ScriptType::External, CACHE_ADDR_BATCH_SIZE * 2 - 1)
.unwrap()
.is_some());
} | rust_cleaned_test_functions.jsonl/11306 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 563
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11529,
59471,
7793,
483,
368,
341,
286,
1077,
2927,
284,
13850,
5988,
486,
931,
543,
286,
1077,
15085,
25,
66370,
38259,
32399,
29,
284,
36483,
486,
931,
13651,
1056,
445,
8421,
30664,
38852,
392,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_job_scheduling() {
let test_cases = vec![
(
vec![1],
vec![5],
vec![3],
3,
),
(
vec![1,2,3,3],
vec![3,4,5,6],
vec![50,10,40,70],
120,
),
(
vec![1,2,3,4,6],
vec![3,5,10,6,9],
vec![20,20,100,70,60],
150,
),
(
vec![1,1,1],
vec![2,3,4],
vec![5,6,4],
6,
),
];
for (s,e,v, expect) in test_cases {
assert_eq!(Solution::job_scheduling(s.clone(), e.clone(), v.clone()), expect, "start: {:?}, end: {:?}, value: {:?}", s,e,v);
}
} | rust_cleaned_test_functions.jsonl/4318 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 628
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20298,
643,
44356,
368,
341,
286,
1077,
1273,
41427,
284,
7486,
90515,
310,
2399,
394,
7486,
20703,
16,
1259,
394,
7486,
20703,
20,
1259,
394,
7486,
20703,
18,
1259,
394,
220,
18,
345,
310,
2837... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_hover_shadowing_pat() {
check(
r#"
fn x() {}
fn y() {
let x = 0i32;
x<|>;
}
"#,
expect![[r#"
*x*
```rust
i32
```
"#]],
)
} | rust_cleaned_test_functions.jsonl/66120 | {
"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,
53445,
53120,
287,
55824,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
8822,
856,
368,
10086,
8822,
379,
368,
341,
262,
1077,
856,
284,
220,
15,
72,
18,
17,
280,
262,
856,
27,
91,
10133,
532... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_new_directory_in_worktree_does_not_show() {
let temp_dir = TempDir::default();
let index = test_repo(&temp_dir, &vec![Path::new("simple_file.txt")]);
fs::create_dir_all(temp_dir.join("new_dir")).unwrap();
let value = WorkTree::diff_against_index(&temp_dir, index).unwrap();
assert_eq!(value.entries, vec![]);
} | rust_cleaned_test_functions.jsonl/36173 | {
"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,
5921,
14846,
1243,
11498,
9344,
96374,
7913,
15267,
368,
341,
286,
1077,
2730,
4334,
284,
19944,
6184,
486,
2258,
543,
286,
1077,
1922,
284,
1273,
37784,
2099,
3888,
4334,
11,
609,
4083,
20703,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_random() {
let seed_len = 32;
let niters = 50;
let ngroups = 1000;
let max_group_size = 15;
let mut values = vec![];
for _ in 0..niters {
values.clear();
let mut rng = thread_rng();
let seed_vec: Vec<u8> = Standard.sample_iter(&mut rng).take(seed_len).collect();
let mut seed = [0u8; 32];
seed.copy_from_slice(&seed_vec[0..seed_len]);
let mut gen = rand::StdRng::from_seed(seed);
let mut parity = false;
for _ in 0..ngroups {
let mut group_size = gen.gen_range::<u32>(1, 20);
if group_size > max_group_size {
group_size = 1;
}
for _ in 0..group_size {
values.push(parity as i32);
}
parity = !parity;
}
let bit_width = bit_util::num_required_bits(values.len() as u64);
assert!(bit_width < 64);
test_round_trip(&values[..], bit_width as u8);
}
} | rust_cleaned_test_functions.jsonl/72793 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 620
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22644,
368,
341,
286,
1077,
10320,
6043,
284,
220,
18,
17,
280,
286,
1077,
24691,
388,
284,
220,
20,
15,
280,
286,
1077,
308,
16753,
284,
220,
16,
15,
15,
15,
280,
286,
1077,
1932,
6288,
236... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_add_new() {
// Check output of generation
check_assist(
add_new,
"struct Foo {<|>}",
"struct Foo {}
impl Foo {
fn new() -> Self { Self { } }<|>
}
",
);
check_assist(
add_new,
"struct Foo<T: Clone> {<|>}",
"struct Foo<T: Clone> {}
impl<T: Clone> Foo<T> {
fn new() -> Self { Self { } }<|>
}
",
);
check_assist(
add_new,
"struct Foo<'a, T: Foo<'a>> {<|>}",
"struct Foo<'a, T: Foo<'a>> {}
impl<'a, T: Foo<'a>> Foo<'a, T> {
fn new() -> Self { Self { } }<|>
}
",
);
check_assist(
add_new,
"struct Foo { baz: String <|>}",
"struct Foo { baz: String }
impl Foo {
fn new(baz: String) -> Self { Self { baz } }<|>
}
",
);
check_assist(
add_new,
"struct Foo { baz: String, qux: Vec<i32> <|>}",
"struct Foo { baz: String, qux: Vec<i32> }
impl Foo {
fn new(baz: String, qux: Vec<i32>) -> Self { Self { baz, qux } }<|>
}
",
);
// Check that visibility modifiers don't get brought in for fields
check_assist(
add_new,
"struct Foo { pub baz: String, pub qux: Vec<i32> <|>}",
"struct Foo { pub baz: String, pub qux: Vec<i32> }
impl Foo {
fn new(baz: String, qux: Vec<i32>) -> Self { Self { baz, qux } }<|>
}
",
);
// Check that it reuses existing impls
check_assist(
add_new,
"struct Foo {<|>}
impl Foo {}
",
"struct Foo {}
impl Foo {
fn new() -> Self { Self { } }<|>
}
",
);
check_assist(
add_new,
"struct Foo {<|>}
impl Foo {
fn qux(&self) {}
}
",
"struct Foo {}
impl Foo {
fn new() -> Self { Self { } }<|>
fn qux(&self) {}
}
",
);
check_assist(
add_new,
"struct Foo {<|>}
impl Foo {
fn qux(&self) {}
fn baz() -> i32 {
5
}
}
",
"struct Foo {}
impl Foo {
fn new() -> Self { Self { } }<|>
fn qux(&self) {}
fn baz() -> i32 {
5
}
}
",
);
// Check visibility of new fn based on struct
check_assist(
add_new,
"pub struct Foo {<|>}",
"pub struct Foo {}
impl Foo {
pub fn new() -> Self { Self { } }<|>
}
",
);
check_assist(
add_new,
"pub(crate) struct Foo {<|>}",
"pub(crate) struct Foo {}
impl Foo {
pub(crate) fn new() -> Self { Self { } }<|>
}
",
);
} | rust_cleaned_test_functions.jsonl/32517 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1271
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
5921,
368,
341,
286,
442,
4248,
2550,
315,
9471,
198,
286,
1779,
12083,
380,
1006,
310,
912,
5921,
345,
80575,
33428,
314,
27,
91,
29,
24375,
80575,
33428,
10086,
6383,
33428,
341,
262,
51... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_xor_psuedo_rng_u32() {
for _ in 0..1000 {
assert_ne!(xor_psuedo_rng_u32(), xor_psuedo_rng_u32());
}
} | rust_cleaned_test_functions.jsonl/49244 | {
"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,
76462,
26047,
3260,
78,
66849,
7300,
18,
17,
368,
341,
286,
369,
716,
304,
220,
15,
496,
16,
15,
15,
15,
341,
310,
2060,
13925,
10297,
71311,
26047,
3260,
78,
66849,
7300,
18,
17,
1507,
53941,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_abs_sub() {
let zero: BigInt = Zero::zero();
let one: BigInt = One::one();
assert_eq!((-one).abs_sub(&one), zero);
let one: BigInt = One::one();
let zero: BigInt = Zero::zero();
assert_eq!(one.abs_sub(&one), zero);
let one: BigInt = One::one();
let zero: BigInt = Zero::zero();
assert_eq!(one.abs_sub(&zero), one);
let one: BigInt = One::one();
let two: BigInt = FromPrimitive::from_int(2).unwrap();
assert_eq!(one.abs_sub(&-one), two);
} | rust_cleaned_test_functions.jsonl/96934 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 271
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31170,
5228,
368,
341,
286,
1077,
7168,
25,
62608,
284,
18306,
486,
14154,
543,
286,
1077,
825,
25,
62608,
284,
3776,
486,
603,
543,
286,
2060,
10714,
0,
54934,
603,
568,
3435,
5228,
2099,
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... | 1 |
#[test]
fn test_bad_password() {
// malformed sequences here taken from:
for bytes in [b"\x80".to_vec(), b"\xbf".to_vec(), b"\xed\xa0\xa0".to_vec()] {
match decode_password(bytes.clone()) {
Err(Error::BadEncoding(str)) => assert_eq!(str, bytes),
Err(other) => panic!(
"Bad password ({:?}) decode gave wrong error: {}",
bytes, other
),
Ok(s) => panic!("Bad password ({:?}) decode gave results: {:?}", bytes, &s),
}
}
} | rust_cleaned_test_functions.jsonl/18827 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 320
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34199,
10122,
368,
341,
286,
442,
79250,
23700,
1588,
4429,
504,
510,
1789,
286,
369,
5820,
304,
508,
65,
11934,
87,
23,
15,
3263,
983,
13251,
1507,
293,
11934,
47659,
3263,
983,
13251,
1507,
29... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_from_password() {
let key = include_bytes!("../test/rsa-encrypted.pem");
Rsa::private_key_from_pem_passphrase(key, b"mypass").unwrap();
} | rust_cleaned_test_functions.jsonl/6924 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 84
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
10122,
368,
341,
286,
1077,
1376,
284,
2924,
12524,
17223,
1244,
1944,
14,
60869,
12,
36444,
49373,
797,
286,
431,
9081,
486,
1996,
3097,
5673,
620,
336,
15464,
27710,
4857,
11,
293,
1,
76... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_delta_bit_packed_int32_with_empty_blocks() {
let data = vec![
Int32Type::gen_vec(-1, 128),
vec![0; 0],
Int32Type::gen_vec(-1, 64),
];
test_delta_bit_packed_decode::<Int32Type>(data);
} | rust_cleaned_test_functions.jsonl/38525 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26710,
13996,
620,
11191,
4042,
18,
17,
6615,
15124,
25201,
368,
341,
286,
1077,
821,
284,
7486,
90515,
310,
1333,
18,
17,
929,
486,
4370,
13251,
4080,
16,
11,
220,
16,
17,
23,
1326,
310,
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... | 1 |
#[test]
fn test_txn_pack_unpack() {
let mut txn = SrvTxn(TXN_ID_MASK);
assert_eq!(txn.is_complete(), false);
assert_eq!(txn.is_response(), false);
txn.set_complete();
assert_eq!(txn.is_complete(), true);
assert_eq!(txn.is_response(), false);
txn.set_response();
assert_eq!(txn.is_complete(), true);
assert_eq!(txn.is_response(), true);
} | rust_cleaned_test_functions.jsonl/100369 | {
"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,
92299,
32995,
54889,
368,
341,
286,
1077,
5206,
49721,
284,
328,
10553,
31584,
77,
4140,
55,
45,
3450,
11720,
317,
286,
2060,
10714,
10297,
73370,
2079,
27675,
1507,
895,
317,
286,
2060,
10714,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_generalized_time_parse() {
let datetime =
*GeneralizedTime::parse(b"19851106210627.3Z").unwrap().datetime();
assert_eq!(datetime.year(), 1985);
assert_eq!(datetime.month(), 11);
assert_eq!(datetime.day(), 6);
assert_eq!(datetime.hour(), 21);
assert_eq!(datetime.minute(), 6);
assert_eq!(datetime.second(), 27);
assert_eq!(datetime.nanosecond(), 300_000_000);
let datetime = GeneralizedTime::parse(b"19851106210627.3-0500").unwrap();
assert_eq!(&datetime.to_string(), "19851107020627.3Z");
let datetime = GeneralizedTime::parse(b"198511062106Z").unwrap();
assert_eq!(&datetime.to_string(), "19851106210600Z");
let datetime = GeneralizedTime::parse(b"198511062106.456Z").unwrap();
assert_eq!(&datetime.to_string(), "19851106210627.36Z");
let datetime = GeneralizedTime::parse(b"1985110621Z").unwrap();
assert_eq!(&datetime.to_string(), "19851106210000Z");
let datetime = GeneralizedTime::parse(b"1985110621.14159Z").unwrap();
assert_eq!(&datetime.to_string(), "19851106210829.724Z");
let datetime =
GeneralizedTime::parse(b"19990101085960.1234+0900").unwrap();
assert_eq!(&datetime.to_string(), "19981231235960.1234Z");
let datetime =
GeneralizedTime::parse(
b"20080229033411.3625431984612391672391625532918636000680000-0500"
).unwrap();
assert_eq!(&datetime.to_string(),
"20080229083411.362543198461239167239162553291863600068Z");
} | rust_cleaned_test_functions.jsonl/17374 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 647
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39177,
1506,
3009,
21039,
368,
341,
262,
1077,
8874,
4035,
286,
353,
15415,
1506,
1462,
486,
6400,
1883,
1,
16,
24,
23,
20,
16,
16,
15,
21,
17,
16,
15,
21,
17,
22,
13,
18,
57,
1827,
15454,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_roots_quartic_tim_luecke() {
// Reported in December 2019
assert_eq!(
find_roots_quartic(-14.0625f64, -3.75f64, 29.75f64, 4.0f64, -16.0f64),
Roots::Two([-1.1016116464173349f64, 0.9682783130840016f64])
);
assert_eq!(
find_roots_quartic(-14.0625f32, -3.75f32, 29.75f32, 4.0f32, -16.0f32),
Roots::No([])
);
assert_eq!(
find_roots_quartic(
1f32,
-3.75f32 / -14.0625f32,
29.75f32 / -14.0625f32,
4.0f32 / -14.0625f32,
-16.0f32 / -14.0625f32
),
Roots::No([])
);
// assert_eq!(
} | rust_cleaned_test_functions.jsonl/18573 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 524
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
26608,
2412,
11280,
80887,
29087,
907,
361,
60273,
368,
341,
286,
442,
78611,
304,
6652,
220,
17,
15,
16,
24,
198,
286,
2060,
10714,
33673,
310,
1477,
26608,
2412,
11280,
80887,
4080,
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_get_packet_commitment_state_ok() {
let mut context: Context<Test> = Context::new();
let range = (0..10).into_iter().collect::<Vec<u8>>();
let mut port_id_vec = vec![];
let mut channel_id_vec = vec![];
let mut sequence_vec = vec![];
let mut timestamp_vec = vec![];
let mut height_vec = vec![];
let mut data_vec = vec![];
let mut value_vec = vec![];
for index in range.clone() {
let port_id = PortId::from_str(&format!("port-{}", index)).unwrap();
port_id_vec.push(port_id);
let channel_id = ChannelId::from_str(&format!("channel-{}", index)).unwrap();
channel_id_vec.push(channel_id);
let sequence = Sequence::from(index as u64);
sequence_vec.push(sequence);
let timestamp = Timestamp::from_nanoseconds(index as u64).unwrap();
timestamp_vec.push(timestamp);
let height = Height::new(0, index as u64);
height_vec.push(height);
let data = vec![index];
data_vec.push(data.clone());
let input = format!("{:?},{:?},{:?}", timestamp, height, data);
let value = ChannelReader::hash(&context, input).encode();
value_vec.push(value);
}
new_test_ext().execute_with(|| {
for index in 0..range.len() {
assert_eq!(
context
.store_packet_commitment(
(
port_id_vec[index].clone(),
channel_id_vec[index].clone(),
sequence_vec[index].clone()
),
timestamp_vec[index].clone(),
height_vec[index].clone(),
data_vec[index].clone(),
)
.is_ok(),
true
);
}
let result = Pallet::<Test>::get_packet_commitment_state();
assert_eq!(result.len(), range.len());
for (port_id_1, channel_id_1, sequence_1, value_1) in result {
let port_id_2 =
PortId::from_str(String::from_utf8(port_id_1).unwrap().as_str()).unwrap();
let channel_id_2 =
ChannelId::from_str(String::from_utf8(channel_id_1).unwrap().as_str()).unwrap();
let sequence_2 = u64::decode(&mut sequence_1.as_slice()).unwrap();
let sequence_2 = Sequence::from(sequence_2);
// let sequence_2 =
// assert key
assert_eq!(port_id_vec.iter().find(|&val| val == &port_id_2).is_some(), true);
assert_eq!(channel_id_vec.iter().find(|&val| val == &channel_id_2).is_some(), true);
assert_eq!(sequence_vec.iter().find(|&val| val == &sequence_2).is_some(), true);
// assert value
assert_eq!(value_vec.iter().find(|&val| val == &value_1).is_some(), true);
}
})
} | rust_cleaned_test_functions.jsonl/60063 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1016
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
21078,
36346,
478,
4387,
19817,
368,
341,
10217,
5206,
2266,
25,
9608,
71273,
29,
284,
9608,
486,
931,
1428,
10217,
2088,
284,
320,
15,
496,
16,
15,
568,
18122,
11723,
1005,
17384,
27638,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_skip_to() {
let mut symbols = create_iter();
let symbol = symbols.skip_to(SymbolIndex(0x8)).expect("get symbol");
let expected = Symbol {
index: SymbolIndex(0x8),
data: &[0x06, 0x00], // S_END
};
assert_eq!(symbol, Some(expected));
} | rust_cleaned_test_functions.jsonl/109255 | {
"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,
44830,
2346,
368,
341,
310,
1077,
5206,
17738,
284,
1855,
11723,
543,
310,
1077,
7735,
284,
17738,
36596,
2346,
99095,
1552,
7,
15,
87,
23,
4579,
17119,
445,
455,
7735,
3071,
310,
1077,
3601,
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_lookup() {
let lexicon = read_lexicon();
let results1 = lexicon.lookup("東京都".as_bytes(), 0);
assert_eq!((4, 3), results1[0]); // 東
assert_eq!((5, 6), results1[1]); // 東京
assert_eq!((6, 9), results1[2]); // 東京都
a results1.len());
let results2 = lexicon.lookup("東京都に".as_bytes(), 9);
assert_eq!((1, 12), results2[0]); // に(接続助詞)
assert_eq!(); // に(格助詞)
assert_eq!(2, results2 results3 = lexicon.lookup("あれ".as_bytes(), 0);
assert_eq!(0, results3.len());
} | rust_cleaned_test_functions.jsonl/113033 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 273
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27464,
368,
341,
262,
1077,
22429,
1924,
284,
1349,
74547,
1924,
543,
262,
1077,
3059,
16,
284,
22429,
1924,
39937,
445,
102356,
115806,
3263,
300,
12524,
1507,
220,
15,
317,
262,
2060,
10714,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_try_from_row_for_tuple_1() -> Result<()> {
use crate::ToSql;
use std::convert::TryFrom;
let conn = Connection::open_in_memory()?;
conn.execute(
"CREATE TABLE test (a INTEGER)",
crate::params_from_iter(std::iter::empty::<&dyn ToSql>()),
)?;
conn.execute("INSERT INTO test VALUES (42)", [])?;
let val = conn.query_row("SELECT a FROM test", [], |row| <(u32,)>::try_from(row))?;
assert_eq!(val, (42,));
let fail = conn.query_row("SELECT a FROM test", [], |row| <(u32, u32)>::try_from(row));
assert!(fail.is_err());
Ok(())
} | rust_cleaned_test_functions.jsonl/42675 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 330
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
5673,
8530,
5478,
21773,
62,
16,
368,
1464,
5714,
71698,
341,
286,
990,
17717,
486,
1249,
8269,
280,
286,
990,
1460,
486,
14166,
486,
21453,
3830,
401,
286,
1077,
4534,
284,
11032,
486,
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... | 5 |
#[test]
fn test_head_empty() -> Result<()> {
let (_td, repo) = repo_init_empty()?;
let root = repo.path().parent().unwrap();
let repo_path = root.as_os_str().to_str().unwrap();
assert_eq!(get_head(repo_path).is_ok(), false);
Ok(())
} | rust_cleaned_test_functions.jsonl/36669 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13138,
15124,
368,
1464,
5714,
71698,
341,
286,
1077,
5453,
1296,
11,
15867,
8,
284,
15867,
6137,
15124,
94136,
286,
1077,
3704,
284,
15867,
3875,
1005,
3765,
1005,
15454,
543,
286,
1077,
15867,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.