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_sign() -> Result<(), Error> {
let key: SecretKey = KEY_SECRET_ASN1_HEX.parse()?;
let signature = key.sign(MESSAGE.as_bytes());
assert_eq!(SIGNATURE, signature.to_string());
Ok(())
} | rust_cleaned_test_functions.jsonl/75 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11172,
368,
1464,
5714,
68843,
4600,
29,
341,
286,
1077,
1376,
25,
8599,
1592,
284,
12013,
31408,
1566,
18966,
16,
86502,
4632,
94136,
286,
1077,
11957,
284,
1376,
15499,
3189,
11963,
5357,
12524,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
#[test]
fn test_into_string_small_str() {
let data = "abcdef";
let str_addr = data.as_ptr();
let str_len = data.len();
let compact = CompactString::from(data);
let new_string = String::from(compact);
let new_str_addr = new_string.as_ptr();
let new_str_len = new_string.len();
let new_str_cap = new_string.capacity();
assert_ne!(str_addr, new_str_addr);
assert_eq!(str_len, new_str_len);
assert_eq!(str_len, new_str_cap);
} | rust_cleaned_test_functions.jsonl/2809 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 204
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45514,
3904,
31966,
2895,
368,
341,
262,
1077,
821,
284,
330,
41202,
876,
262,
1077,
607,
7387,
284,
821,
5357,
4348,
543,
262,
1077,
607,
6043,
284,
821,
19406,
1428,
262,
1077,
16830,
284,
547... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_variable_line() {
let (variable, command, command_options) =
parse_variable_line("$ user : echo -e \"$(whoami)\\nroot\" --- --prevent-extra").unwrap();
assert_eq!(command, " echo -e \"$(whoami)\\nroot\" ");
assert_eq!(variable, "user");
assert_eq!(
command_options,
Some(FinderOpts {
header_lines: 0,
column: None,
delimiter: None,
suggestion_type: SuggestionType::SingleSelection,
..Default::default()
})
);
} | rust_cleaned_test_functions.jsonl/116112 | {
"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,
21039,
14635,
6528,
368,
341,
286,
1077,
320,
9813,
11,
3210,
11,
3210,
8743,
8,
4035,
310,
4715,
14635,
6528,
20912,
1196,
549,
1687,
481,
68,
7245,
8525,
14623,
10606,
8,
3422,
77,
2888,
2105,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_key_value_encoding() {
let key = "KKKKKKKKKK".to_string();
let value = "VVVVVVVVVV".to_string();
let record = Record::new_key_value(key, value);
let mut encoded = Vec::new();
record.encode(&mut encoded, 0).unwrap();
let decoded = Record::<RecordData>::decode_from(&mut Cursor::new(encoded), 0).unwrap();
let record_key = record.key.unwrap();
let decoded_key = decoded.key.unwrap();
assert_eq!(record_key.as_ref(), decoded_key.as_ref());
assert_eq!(record.value.as_ref(), decoded.value.as_ref());
} | rust_cleaned_test_functions.jsonl/30922 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 276
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3097,
3142,
37613,
368,
341,
286,
1077,
1376,
284,
330,
50457,
50457,
50457,
50457,
50457,
3263,
983,
3904,
543,
286,
1077,
897,
284,
330,
67707,
67707,
67707,
67707,
67707,
3263,
983,
3904,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_struct() {
#[derive(Debug, PartialEq, Valuable, Serialize)]
struct S1 {}
#[derive(Debug, PartialEq, Valuable, Serialize)]
struct S2 {
f: u8,
}
assert_ser_eq!(
S1 {},
&[Token::Struct { name: "S1", len: 0 }, Token::StructEnd]
);
assert_ser_eq!(
S2 { f: 1 },
&[
Token::Struct { name: "S2", len: 1 },
Token::Str("f"),
Token::U8(1),
Token::StructEnd
]
);
} | rust_cleaned_test_functions.jsonl/44219 | {
"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,
15126,
368,
341,
262,
11506,
27098,
42618,
11,
55039,
11,
4104,
13128,
11,
39900,
5563,
262,
2036,
328,
16,
5613,
262,
11506,
27098,
42618,
11,
55039,
11,
4104,
13128,
11,
39900,
5563,
262,
2036,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_runnables_project() {
if skip_slow_tests() {
return;
}
let code = r#"
//- /foo/Cargo.toml
[package]
name = "foo"
version = "0.0.0"
//- /foo/src/lib.rs
pub fn foo() {}
//- /foo/tests/spam.rs
#[test]
fn test_eggs() {}
//- /bar/Cargo.toml
[package]
name = "bar"
version = "0.0.0"
//- /bar/src/main.rs
fn main() {}
"#;
let server = Project::with_fixture(code).root("foo").root("bar").server();
server.wait_until_workspace_is_loaded();
server.request::<Runnables>(
RunnablesParams { text_document: server.doc_id("foo/tests/spam.rs"), position: None },
json!([
{
"args": {
"cargoArgs": ["test", "--package", "foo", "--test", "spam"],
"executableArgs": ["test_eggs", "--exact", "--nocapture"],
"workspaceRoot": server.path().join("foo")
},
"kind": "cargo",
"label": "test test_eggs",
"location": {
"targetRange": {
"end": { "character": 17, "line": 1 },
"start": { "character": 0, "line": 0 }
},
"targetSelectionRange": {
"end": { "character": 12, "line": 1 },
"start": { "character": 3, "line": 1 }
},
"targetUri": "file:///[..]/tests/spam.rs"
}
},
{
"args": {
"cargoArgs": ["check", "--package", "foo"],
"executableArgs": [],
"workspaceRoot": server.path().join("foo")
},
"kind": "cargo",
"label": "cargo check -p foo"
},
{
"args": {
"cargoArgs": ["test", "--package", "foo"],
"executableArgs": [],
"workspaceRoot": server.path().join("foo")
},
"kind": "cargo",
"label": "cargo test -p foo"
}
]),
);
} | rust_cleaned_test_functions.jsonl/117984 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1093
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14007,
77,
4788,
16352,
368,
341,
262,
421,
10706,
82447,
32509,
368,
341,
286,
470,
280,
262,
555,
262,
1077,
2038,
284,
435,
2,
698,
61463,
608,
7975,
11295,
12088,
73494,
75,
198,
58,
1722,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_drain_before_limit() {
let src_exec = MockExecutor::new(
vec![FieldTypeTp::LongLong.into()],
vec![
BatchExecuteResult {
physical_columns: QuiesceBatchColumnVec::from(vec![VectorValue::Int(
vec![Some(-5), None, None].into(),
)]),
logical_rows: Vec::new(),
warnings: EvalWarnings::default(),
is_drained: Ok(false),
},
BatchExecuteResult {
physical_columns: QuiesceBatchColumnVec::from(vec![VectorValue::Int(
vec![None, Some(50), None].into(),
)]),
logical_rows: vec![1, 2],
warnings: EvalWarnings::default(),
is_drained: Ok(true),
},
],
);
let mut exec = BatchLimitExecutor::new(src_exec, 10).unwrap();
let r = exec.next_batch(1);
assert!(r.logical_rows.is_empty());
assert_eq!(r.physical_columns.rows_len(), 3);
assert!(!r.is_drained.unwrap());
let r = exec.next_batch(1);
assert_eq!(&r.logical_rows, &[1, 2]);
assert_eq!(r.physical_columns.rows_len(), 3);
assert!(r.is_drained.unwrap());
} | rust_cleaned_test_functions.jsonl/49576 | {
"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,
26680,
466,
23708,
14763,
368,
341,
286,
1077,
2286,
18430,
284,
14563,
25255,
486,
931,
1006,
310,
7486,
20703,
63733,
62241,
486,
6583,
6583,
39860,
73845,
310,
7486,
90515,
394,
33904,
17174,
207... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_histogram_too_high_is_ignored() {
let mut histogram_computer = HistogramComputer {
counts: vec![0u64; 5],
min_value: 0,
divider: DividerU64::divide_by(2),
};
histogram_computer.add_value(10);
assert_eq!(histogram_computer.harvest(), vec![0, 0, 0, 0, 0]);
} | rust_cleaned_test_functions.jsonl/125923 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68564,
2346,
78,
22680,
6892,
62,
58471,
368,
341,
286,
1077,
5206,
30281,
2965,
11281,
284,
82138,
37332,
341,
310,
14579,
25,
7486,
20703,
15,
84,
21,
19,
26,
220,
20,
1259,
310,
1308,
3142,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_boolean_negation() {
let mut cs = TestConstraintSystem::<Fr>::new();
let mut b = Boolean::from(AllocatedBit::alloc(&mut cs, || Ok(true)).unwrap());
match b {
Boolean::Is(_) => {},
_ => panic!("unexpected value"),
}
b = b.not();
match b {
Boolean::Not(_) => {},
_ => panic!("unexpected value"),
}
b = b.not();
match b {
Boolean::Is(_) => {},
_ => panic!("unexpected value"),
}
b = Boolean::constant(true);
match b {
Boolean::Constant(true) => {},
_ => panic!("unexpected value"),
}
b = b.not();
match b {
Boolean::Constant(false) => {},
_ => panic!("unexpected value"),
}
b = b.not();
match b {
Boolean::Constant(true) => {},
_ => panic!("unexpected value"),
}
} | rust_cleaned_test_functions.jsonl/226 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 528
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46642,
28209,
367,
368,
341,
286,
1077,
5206,
10532,
284,
3393,
17890,
2320,
27638,
22560,
6831,
931,
1428,
286,
1077,
5206,
293,
284,
6992,
486,
1499,
7,
25154,
657,
8344,
486,
4742,
2099,
6984,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
#[test]
fn test_parse_quoted_pair() {
assert_eq!(parse_quoted_pair("\\\""), Ok(("\\\"", "")));
assert_eq!(parse_quoted_pair("\\\\test"), Ok(("\\\\", "test")));
assert!(parse_quoted_pair("\\\n").is_err());
assert!(parse_quoted_pair("\\\u{3041}").is_err());
} | rust_cleaned_test_functions.jsonl/100505 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 147
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
11280,
9253,
14445,
368,
341,
286,
2060,
10714,
10297,
6400,
11280,
9253,
14445,
29710,
2105,
3975,
7622,
7,
29710,
55853,
1591,
4945,
286,
2060,
10714,
10297,
6400,
11280,
9253,
14445,
29710,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unnecessary_zeroes() {
fn extract(value: &str) -> Decimal {
Decimal::from_str(value).unwrap()
}
let tests = &[
("0.000001660"),
("41.120255926293000"),
("0.5538973300"),
("08883.55986854293100"),
("0.0000_0000_0016_6000_00"),
("0.00000166650000"),
("1666500000000"),
("1666500000000.0000054500"),
("8944.000000000000"),
];
for &value in tests {
let value = extract(value);
let pg = PgNumeric::from(value);
let dec = Decimal::try_from(pg).unwrap();
assert_eq!(dec, value);
}
} | rust_cleaned_test_functions.jsonl/55959 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 488
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
94217,
19359,
288,
368,
341,
310,
5168,
8649,
3679,
25,
609,
495,
8,
1464,
26728,
341,
394,
26728,
486,
1499,
2895,
3679,
568,
15454,
741,
310,
555,
310,
1077,
7032,
284,
609,
9640,
394,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_validate_transaction() {
let (env, op_tool, backend, _) = launch_swarm_with_op_tool_and_backend(1, 0);
// Validate an unknown transaction and verify no VM state found
let operator_account = op_tool.print_account(OPERATOR_ACCOUNT, &backend).unwrap();
assert_eq!(
None,
op_tool
.validate_transaction(operator_account, 1000)
.unwrap()
.execution_result
);
let (txn_ctx, _) = op_tool.rotate_operator_key(&backend, true).unwrap();
let mut client = env.get_validator_client(0, None);
client
.wait_for_transaction(operator_account, txn_ctx.sequence_number + 1)
.unwrap();
let result = op_tool
.validate_transaction(operator_account, txn_ctx.sequence_number)
.unwrap()
.execution_result;
assert_eq!(VMStatusView::Executed, result.unwrap());
let (txn_ctx, _) = op_tool.rotate_operator_key(&backend, false).unwrap();
assert_eq!(VMStatusView::Executed, txn_ctx.execution_result.unwrap());
let result = op_tool
.validate_transaction(operator_account, txn_ctx.sequence_number)
.unwrap()
.execution_result;
assert_eq!(VMStatusView::Executed, result.unwrap());
} | rust_cleaned_test_functions.jsonl/64974 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 543
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
28884,
368,
341,
262,
1077,
320,
3160,
11,
1179,
22785,
11,
19163,
11,
27439,
284,
7050,
32581,
2178,
6615,
10287,
22785,
8378,
40011,
7,
16,
11,
220,
15,
626,
262,
442,
23282,
458,
9788,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_nonced_pay_tx() {
solana_logger::setup();
let TestValidator {
server,
leader_data,
alice,
ledger_path,
..
} = TestValidator::run();
let (sender, receiver) = channel();
run_local_faucet(alice, sender, None);
let faucet_addr = receiver.recv().unwrap();
let rpc_client = RpcClient::new_socket(leader_data.rpc);
let default_signer = Keypair::new();
let mut config = CliConfig::default();
config.json_rpc_url = format!("http://{}:{}", leader_data.rpc.ip(), leader_data.rpc.port());
config.signers = vec![&default_signer];
let minimum_nonce_balance = rpc_client
.get_minimum_balance_for_rent_exemption(NonceState::size())
.unwrap();
request_and_confirm_airdrop(
&rpc_client,
&faucet_addr,
&config.signers[0].pubkey(),
50 + minimum_nonce_balance,
)
.unwrap();
check_balance(
50 + minimum_nonce_balance,
&rpc_client,
&config.signers[0].pubkey(),
);
// Create nonce account
let nonce_account = Keypair::new();
config.command = CliCommand::CreateNonceAccount {
nonce_account: 1,
seed: None,
nonce_authority: Some(config.signers[0].pubkey()),
lamports: minimum_nonce_balance,
};
config.signers.push(&nonce_account);
process_command(&config).unwrap();
check_balance(50, &rpc_client, &config.signers[0].pubkey());
check_balance(minimum_nonce_balance, &rpc_client, &nonce_account.pubkey());
// Fetch nonce hash
let nonce_hash = nonce::get_account(&rpc_client, &nonce_account.pubkey())
.and_then(|ref a| nonce::data_from_account(a))
.unwrap()
.blockhash;
let bob_pubkey = Pubkey::new_rand();
config.signers = vec![&default_signer];
config.command = CliCommand::Pay(PayCommand {
lamports: 10,
to: bob_pubkey,
blockhash_query: BlockhashQuery::FeeCalculator(
blockhash_query::Source::NonceAccount(nonce_account.pubkey()),
nonce_hash,
),
nonce_account: Some(nonce_account.pubkey()),
..PayCommand::default()
});
process_command(&config).expect("failed to process pay command");
check_balance(40, &rpc_client, &config.signers[0].pubkey());
check_balance(10, &rpc_client, &bob_pubkey);
// Verify that nonce has been used
let nonce_hash2 = nonce::get_account(&rpc_client, &nonce_account.pubkey())
.and_then(|ref a| nonce::data_from_account(a))
.unwrap()
.blockhash;
assert_ne!(nonce_hash, nonce_hash2);
server.close().unwrap();
remove_dir_all(ledger_path).unwrap();
} | rust_cleaned_test_functions.jsonl/88225 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1202
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21637,
1998,
28925,
17805,
368,
341,
262,
2048,
3362,
27413,
486,
15188,
1428,
262,
1077,
3393,
14256,
341,
286,
3538,
345,
286,
7653,
1769,
345,
286,
70433,
345,
286,
46933,
2638,
345,
286,
54538... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sizes() {
let v = ArrayVec::from([0u8; 1 << 16]);
assert_eq!(vec![0u8; v.len()], &v[..]);
} | rust_cleaned_test_functions.jsonl/36792 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 67
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32159,
368,
341,
262,
1077,
348,
284,
2910,
10050,
486,
1499,
2561,
15,
84,
23,
26,
220,
16,
1115,
220,
16,
21,
2558,
262,
2060,
10714,
10297,
4083,
20703,
15,
84,
23,
26,
348,
19406,
79558,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_sequence_set_iter() {
let tests = &[
("*", vec![3]),
("1:*", vec![1, 2, 3]),
("5,1:*,2:*", vec![5, 1, 2, 3, 2, 3]),
("*:2", vec![]),
("*:*", vec![3]),
("4:6,*", vec![4, 5, 6, 3]),
];
for (test, expected) in tests {
let seq_set = SequenceSet(test.to_sequence().unwrap());
let got: Vec<u32> = seq_set.iter(Strategy::Naive { largest: 3 }).collect();
assert_eq!(*expected, got);
}
} | rust_cleaned_test_functions.jsonl/103942 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 318
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23735,
2602,
11723,
368,
341,
286,
1077,
7032,
284,
609,
9640,
310,
3489,
78729,
7486,
20703,
18,
17036,
310,
3489,
16,
53386,
497,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
17036,
310,
3489,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_push_small() {
let mut bitmap = MutableBitmap::new();
bitmap.push(true);
bitmap.push(true);
bitmap.push(false);
let bitmap: Option<Bitmap> = bitmap.into();
let bitmap = bitmap.unwrap();
assert_eq!(bitmap.len(), 3);
assert_eq!(bitmap.as_slice()[0], 0b00000011);
} | rust_cleaned_test_functions.jsonl/64516 | {
"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,
14218,
31966,
368,
341,
286,
1077,
5206,
19746,
284,
31143,
16773,
486,
931,
543,
286,
19746,
2552,
3715,
317,
286,
19746,
2552,
3715,
317,
286,
19746,
2552,
3576,
317,
286,
1077,
19746,
25,
6959,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_double_to_long() {
assert_less(Variant::from(1.0), Variant::from(2_i64));
assert_equal(Variant::from(3.0), Variant::from(3_i64));
assert_greater(Variant::from(5.0), Variant::from(4_i64));
} | rust_cleaned_test_functions.jsonl/84519 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 133
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24598,
2346,
17799,
368,
341,
310,
2060,
50747,
12410,
15341,
486,
1499,
7,
16,
13,
15,
701,
39292,
486,
1499,
7,
17,
5318,
21,
19,
1106,
310,
2060,
11478,
12410,
15341,
486,
1499,
7,
18,
13,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eq_size_drop_count() {
let mut count = 0;
{
let dc = DropCounter::new(&mut count);
assert_eq!(dc.count(), 1);
assert_size_eq_val!(dc, 0usize);
assert_eq!(dc.count(), 1);
assert_size_eq_val!(dc, 0usize, dc);
assert_eq!(dc.count(), 1);
}
assert_eq!(count, 0);
assert_size_eq_val!(DropCounter::new(&mut count), 0usize);
assert_eq!(count, 0);
} | rust_cleaned_test_functions.jsonl/43873 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 220
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10714,
2368,
29584,
3180,
368,
341,
262,
1077,
5206,
1760,
284,
220,
15,
280,
262,
341,
286,
1077,
19402,
284,
15733,
14099,
486,
931,
2099,
6984,
1760,
317,
286,
2060,
10714,
10297,
7628,
6501,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rx_close_rst() {
let mut s = socket_established();
send!(s, TcpRepr {
seq_number: REMOTE_SEQ + 1,
ack_number: Some(LOCAL_SEQ + 1),
payload: &b"abc"[..],
..SEND_TEMPL
});
send!(s, TcpRepr {
control: TcpControl::Rst,
seq_number: REMOTE_SEQ + 1 + 3,
ack_number: Some(LOCAL_SEQ + 1),
..SEND_TEMPL
});
s.recv(|data| {
assert_eq!(data, b"abc");
(3, ())
}).unwrap();
assert_eq!(s.recv(|_| (0, ())), Err(Error::Illegal));
} | rust_cleaned_test_functions.jsonl/91923 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 389
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24330,
12704,
1710,
267,
368,
341,
286,
1077,
5206,
274,
284,
7575,
18583,
5102,
291,
543,
286,
3624,
10297,
82,
11,
64876,
693,
649,
341,
310,
12981,
5500,
25,
25587,
19158,
50045,
488,
220,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_new_from_json() {
// Test config file for one sensor.
let json_data = json::json!({
"power_drivers": [{
"name": "power_1",
"topological_path": "/dev/sys/platform/power_1"
}]
});
let _ = ServerBuilder::new_from_json(Some(json_data));
// Test config file for two sensors.
let json_data = json::json!({
"temperature_drivers": [{
"name": "temp_1",
"topological_path": "/dev/sys/platform/temp_1"
}],
"power_drivers": [{
"name": "power_1",
"topological_path": "/dev/sys/platform/power_1"
}]
});
let _ = ServerBuilder::new_from_json(Some(json_data));
} | rust_cleaned_test_functions.jsonl/66695 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 435
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
5673,
9455,
368,
341,
286,
442,
3393,
2193,
1034,
369,
825,
12002,
624,
286,
1077,
2951,
1769,
284,
2951,
486,
2236,
0,
2262,
310,
330,
13175,
26680,
1945,
788,
18396,
394,
330,
606,
788,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_f32x4_only_last_not_all() {
let x1 = f32x4::new(2.0, 2.0, 2.0, 1.0);
let x2 = f32x4::splat(1.0);
assert!(!(x1.eq(x2)).all());
} | rust_cleaned_test_functions.jsonl/43322 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
18,
17,
87,
19,
18410,
12195,
7913,
5705,
368,
341,
286,
1077,
856,
16,
284,
282,
18,
17,
87,
19,
486,
931,
7,
17,
13,
15,
11,
220,
17,
13,
15,
11,
220,
17,
13,
15,
11,
220,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_squaring() {
let mut cur = LARGEST;
for _ in 0..100 {
let mut tmp = cur;
tmp = tmp.square();
let mut tmp2 = Scalar::zero();
for b in cur
.to_bytes()
.iter()
.rev()
.flat_map(|byte| (0..8).rev().map(move |i| ((byte >> i) & 1u8) == 1u8))
{
let tmp3 = tmp2;
tmp2.add_assign(&tmp3);
if b {
tmp2.add_assign(&cur);
}
}
assert_eq!(tmp, tmp2);
cur.add_assign(&LARGEST);
}
} | rust_cleaned_test_functions.jsonl/5582 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 384
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
446,
3249,
368,
972,
262,
1077,
5206,
2847,
284,
444,
7581,
5177,
1926,
262,
369,
716,
304,
220,
15,
496,
16,
15,
15,
972,
286,
1077,
5206,
4174,
284,
2847,
463,
286,
4174,
284,
4174,
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... | 4 |
#[test]
fn test_complex_concurrent() {
let base = StrVectorClock::new();
let mut c1 = base.incr_clone("A");
let mut c2 = base.incr_clone("B");
c1.incr("A");
c1.incr("B");
c2.incr("A");
c2.incr("B");
assert!(!(c1 == c2));
assert_eq!(
c1.temporal_relation(&c2),
TemporalRelation::ConcurrentGreater
);
assert_eq!(
c2.temporal_relation(&c1),
TemporalRelation::ConcurrentSmaller
);
} | rust_cleaned_test_functions.jsonl/60187 | {
"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,
41522,
3382,
3231,
368,
341,
286,
1077,
2331,
284,
4509,
3781,
26104,
486,
931,
543,
286,
1077,
5206,
272,
16,
284,
2331,
1858,
5082,
54742,
445,
32,
797,
286,
1077,
5206,
272,
17,
284,
2331,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_modular_offset() {
assert_eq!(modular_offset(&3.0_f64, &0.0_f64, &-1.0_f64), 2.0_f64);
assert_eq!(modular_offset(&3.0_f64, &1.0_f64, &-1.0_f64), 0.0_f64);
assert_eq!(modular_offset(&3.0_f64, &2.0_f64, &-1.0_f64), 1.0_f64);
assert_eq!(modular_offset(&3.0_f64, &3.0_f64, &-1.0_f64), 2.0_f64);
assert_eq!(modular_offset(&3.0_f64, &0.0_f64, &1.0_f64), 1.0_f64);
assert_eq!(modular_offset(&3.0_f64, &1.0_f64, &1.0_f64), 2.0_f64);
assert_eq!(modular_offset(&3.0_f64, &2.0_f64, &1.0_f64), 0.0_f64);
assert_eq!(modular_offset(&3.0_f64, &3.0_f64, &1.0_f64), 1.0_f64);
} | rust_cleaned_test_functions.jsonl/85585 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 413
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7480,
1276,
6917,
368,
341,
286,
2060,
10714,
10297,
2593,
1276,
6917,
2099,
18,
13,
15,
761,
21,
19,
11,
609,
15,
13,
15,
761,
21,
19,
11,
609,
12,
16,
13,
15,
761,
21,
19,
701,
220,
17... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mod_decimal() {
let tests = vec![
("13", "11", "2"),
("-13", "11", "-2"),
("13", "-11", "2"),
("-13", "-11", "-2"),
("33", "11", "0"),
("-33", "11", "0"),
("33", "-11", "0"),
("-33", "-11", "0"),
("0.0000000001", "1.0", "0.0000000001"),
("1", "1.1", "1"),
("-1", "1.1", "-1"),
("1", "-1.1", "1"),
("-1", "-1.1", "-1"),
("3", "0", ""),
("-3", "0", ""),
("0", "0", ""),
("-3", "", ""),
("", ("-3"), ""),
("", "", ""),
];
for (lhs, rhs, expected) in tests {
let expected = expected.parse::<Decimal>().ok();
let output = RpnFnScalarEvaluator::new()
.push_param(lhs.parse::<Decimal>().ok())
.push_param(rhs.parse::<Decimal>().ok())
.evaluate(ScalarFuncSig::ModDecimal)
.unwrap();
assert_eq!(output, expected, "lhs={:?}, rhs={:?}", lhs, rhs);
}
} | rust_cleaned_test_functions.jsonl/5289 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 705
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7480,
74429,
368,
341,
286,
1077,
7032,
284,
7486,
90515,
310,
3489,
16,
18,
497,
330,
16,
16,
497,
330,
17,
4461,
310,
98670,
16,
18,
497,
330,
16,
16,
497,
6523,
17,
4461,
310,
3489,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_server_pref() {
let client = vec![
CipherSuite::TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
CipherSuite::TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
];
let server = vec![
&TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
&TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
];
let chosen = choose_ciphersuite_preferring_server(&client, &server);
assert!(chosen.is_some());
assert_eq!(chosen.unwrap(), &TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384);
} | rust_cleaned_test_functions.jsonl/3960 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 311
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12015,
43331,
368,
341,
286,
1077,
2943,
284,
7486,
90515,
310,
63288,
28000,
486,
45439,
2089,
6484,
1799,
76994,
23929,
69381,
62,
16,
17,
23,
2646,
9985,
38096,
17,
20,
21,
345,
310,
63288,
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_genesis_in_the_future_in_supported() {
let mut fake_driver = fake::FakeDriver::default()
.at(78)
.with_supply(Tokens::from_e8s(365_250));
let mut fixture = fixture_two_neurons_second_is_bigger();
fixture.wait_for_quiet_threshold_seconds = 2 * REWARD_DISTRIBUTION_PERIOD_SECONDS;
fixture.short_voting_period_seconds = 13;
// Let's set genesis
let genesis_timestamp_seconds = fake_driver.now() + 3 * REWARD_DISTRIBUTION_PERIOD_SECONDS / 2;
fixture.genesis_timestamp_seconds = genesis_timestamp_seconds;
let mut gov = Governance::new(
fixture,
fake_driver.get_fake_env(),
fake_driver.get_fake_ledger(),
);
gov.run_periodic_tasks().now_or_never();
assert_eq!(
*gov.latest_reward_event(),
RewardEvent {
day_after_genesis: 0,
actual_timestamp_seconds: 78,
settled_proposals: vec![],
distributed_e8s_equivalent: 0,
}
);
let long_early_proposal_pid = gov
.make_proposal(
&NeuronId { id: 1 },
// Must match neuron 1's serialized_id.
&principal(1),
&Proposal {
summary: "proposal 1 (long)".to_string(),
action: Some(proposal::Action::Motion(Motion {
motion_text: "a".to_string(),
})),
..Default::default()
},
)
.unwrap();
let short_proposal_pid = gov
.make_proposal(
&NeuronId { id: 1 },
// Must match neuron 1's serialized_id.
&principal(1),
&Proposal {
summary: "proposal 2 (short)".to_string(),
action: Some(proposal::Action::ExecuteNnsFunction(ExecuteNnsFunction {
nns_function: NnsFunction::IcpXdrConversionRate as i32,
payload: Encode!(&UpdateIcpXdrConversionRatePayload {
xdr_permyriad_per_icp: 9256,
data_source: "the data source".to_string(),
timestamp_seconds: 111_222_333,
})
.unwrap(),
})),
..Default::default()
},
)
.unwrap();
fake_driver.advance_time_by(REWARD_DISTRIBUTION_PERIOD_SECONDS);
gov.run_periodic_tasks().now_or_never();
// We're still pre-genesis at that point
assert!(fake_driver.now() < genesis_timestamp_seconds);
assert_eq!(
*gov.latest_reward_event(),
RewardEvent {
day_after_genesis: 0,
actual_timestamp_seconds: 78,
settled_proposals: vec![],
distributed_e8s_equivalent: 0,
}
);
let short_info = gov
.get_proposal_info(&PrincipalId::new_anonymous(), short_proposal_pid)
.unwrap();
assert_eq!(
short_info.reward_status, ReadyToSettle as i32,
"Proposal info for the 'short' proposal: {:#?}",
short_info
);
assert_eq!(
short_info.reward_event_round, 0,
"Proposal info for the 'short' proposal: {:#?}",
short_info
);
let long_early_info = gov
.get_proposal_info(&PrincipalId::new_anonymous(), long_early_proposal_pid)
.unwrap();
assert_eq!(
long_early_info.reward_status, AcceptVotes as i32,
"Proposal info for the 'long' proposal: {:#?}",
long_early_info
);
assert_eq!(
long_early_info.reward_event_round, 0,
"Proposal info for the 'long' proposal: {:#?}",
long_early_info
);
// before the first reward distribution.
let pre_genesis_proposal_that_should_settle_in_period_2_pid = gov
.make_proposal(
&NeuronId { id: 1 },
// Must match neuron 1's serialized_id.
&principal(1),
&Proposal {
summary: "pre_genesis_proposal_that_should_settle_in_period_2".to_string(),
action: Some(proposal::Action::Motion(Motion {
motion_text: "b".to_string(),
})),
..Default::default()
},
)
.unwrap();
fake_driver.advance_time_by(REWARD_DISTRIBUTION_PERIOD_SECONDS);
gov.run_periodic_tasks().now_or_never();
// expected.
assert_eq!(
fake_driver.now(),
genesis_timestamp_seconds + REWARD_DISTRIBUTION_PERIOD_SECONDS / 2
);
assert_eq!(
*gov.latest_reward_event(),
RewardEvent {
day_after_genesis: 0,
actual_timestamp_seconds: 78,
settled_proposals: vec![],
distributed_e8s_equivalent: 0,
}
);
// The long early proposal should now be ready to settle
let long_early_info = gov
.get_proposal_info(&PrincipalId::new_anonymous(), long_early_proposal_pid)
.unwrap();
assert_eq!(
long_early_info.reward_status, ReadyToSettle as i32,
"Proposal info for the 'long' proposal: {:#?}",
long_early_info
);
// Let's go just at the time we should create the first reward event
fake_driver.advance_time_by(REWARD_DISTRIBUTION_PERIOD_SECONDS / 2);
gov.run_periodic_tasks().now_or_never();
assert_eq!(
fake_driver.now(),
genesis_timestamp_seconds + REWARD_DISTRIBUTION_PERIOD_SECONDS
);
assert_eq!(
*gov.latest_reward_event(),
RewardEvent {
day_after_genesis: 1,
actual_timestamp_seconds: fake_driver.now(),
// Settled proposals are sorted
settled_proposals: vec![long_early_proposal_pid, short_proposal_pid],
distributed_e8s_equivalent: 100,
}
);
// Let's go just at the time we should create the first reward event
fake_driver.advance_time_by(REWARD_DISTRIBUTION_PERIOD_SECONDS);
gov.run_periodic_tasks().now_or_never();
// considered
assert_eq!(
*gov.latest_reward_event(),
RewardEvent {
day_after_genesis: 2,
actual_timestamp_seconds: fake_driver.now(),
settled_proposals: vec![pre_genesis_proposal_that_should_settle_in_period_2_pid],
distributed_e8s_equivalent: gov.latest_reward_event().distributed_e8s_equivalent,
}
);
assert_eq!(
gov.get_proposal_info(&PrincipalId::new_anonymous(), long_early_proposal_pid)
.unwrap()
.reward_event_round,
1
);
assert_eq!(
gov.get_proposal_info(&PrincipalId::new_anonymous(), short_proposal_pid)
.unwrap()
.reward_event_round,
1
);
assert_eq!(
gov.get_proposal_info(
&PrincipalId::new_anonymous(),
pre_genesis_proposal_that_should_settle_in_period_2_pid
)
.unwrap()
.reward_event_round,
2
);
} | rust_cleaned_test_functions.jsonl/1130 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3521
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16322,
13774,
1243,
16068,
59740,
1243,
57885,
368,
341,
262,
1077,
5206,
12418,
20602,
284,
12418,
486,
52317,
11349,
486,
2258,
741,
286,
659,
266,
7,
22,
23,
340,
16885,
286,
659,
4197,
65630,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serialize() {
let json_expected = format!("\"{}\"", ID);
let track = TrackId::from_uri(URI).unwrap();
let json = serde_json::to_string(&track).unwrap();
assert_eq!(json, json_expected);
} | rust_cleaned_test_functions.jsonl/69262 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 113
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
368,
341,
286,
1077,
2951,
32190,
284,
3561,
17223,
2105,
6257,
55853,
3034,
317,
286,
1077,
3754,
284,
19785,
764,
486,
1499,
15572,
7,
10301,
568,
15454,
543,
286,
1077,
2951,
284,
61570,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_first_bracket_negative_window() {
let fin = |x| x * x;
let f = RealFn::new(&fin);
first_bracket(&f, &Bounds::new(-20.0, 20.0), -1.0);
} | rust_cleaned_test_functions.jsonl/7166 | {
"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,
12978,
17682,
5709,
53865,
12571,
368,
341,
286,
1077,
1875,
284,
760,
87,
91,
856,
353,
856,
280,
286,
1077,
282,
284,
8800,
24911,
486,
931,
2099,
5472,
317,
286,
1156,
17682,
5709,
2099,
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_strings() {
match_tokens(
"var a = \"hello there kind sir\"\nvar b = \"how are you \\\"doing\\\" today?\"",
vec![
Token::Var,
Token::Ident("a"),
Token::Assign,
Token::String("hello there kind sir".to_string()),
Token::Var,
Token::Ident("b"),
Token::Assign,
Token::String("how are you \"doing\" today?".to_string())
]
)
} | rust_cleaned_test_functions.jsonl/47921 | {
"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,
33500,
368,
341,
286,
2432,
28838,
1006,
310,
330,
947,
264,
284,
7245,
14990,
1052,
3093,
27048,
22245,
77,
947,
293,
284,
7245,
5158,
525,
498,
24984,
2105,
44259,
3422,
2105,
3351,
30,
95901,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_move_empty_account() {
let pubkey = Pubkey::default();
let message = move_stake_account(
&pubkey, &pubkey, 0, &pubkey, &pubkey, &pubkey, &pubkey, &pubkey, 0,
);
assert_eq!(message, None);
} | rust_cleaned_test_functions.jsonl/21750 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 131
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17134,
15124,
13500,
368,
341,
286,
1077,
95116,
284,
22611,
792,
486,
2258,
543,
286,
1077,
1943,
284,
3271,
1261,
726,
13500,
1006,
310,
609,
9585,
792,
11,
609,
9585,
792,
11,
220,
15,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lt() {
let checker = MutationsChecker::new("tests/integration.rs").unwrap();
let lt_msgs = &[
"REPLACE_WITH_TRUE",
"REPLACE_WITH_FALSE",
"NEGATE_EXPRESSION",
"COMPARISION",
];
assert!(checker.has_multiple(lt_msgs, "24"));
} | rust_cleaned_test_functions.jsonl/117862 | {
"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,
39164,
368,
341,
262,
1077,
40915,
284,
31228,
804,
35188,
486,
931,
445,
23841,
31114,
17376,
25638,
1827,
15454,
1428,
262,
1077,
25175,
20777,
284,
609,
9640,
286,
330,
787,
35875,
23929,
14044,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_check_already_voted() {
let mut tower = Tower::new_for_tests(0, 0.67);
tower.record_vote(0, Hash::default());
assert!(tower.has_voted(0));
assert!(!tower.has_voted(1));
} | rust_cleaned_test_functions.jsonl/61133 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
80772,
2273,
9253,
368,
341,
286,
1077,
5206,
21271,
284,
21938,
486,
931,
5478,
32509,
7,
15,
11,
220,
15,
13,
21,
22,
317,
286,
21271,
32024,
54360,
7,
15,
11,
6531,
486,
2258,
1423,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rename_for_param_inside() {
test_rename(
r#"
fn foo(i : u32) -> u32 {
i<|>
}"#,
"j",
r#"
fn foo(j : u32) -> u32 {
j
}"#,
);
} | rust_cleaned_test_functions.jsonl/16213 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 165
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
79399,
5478,
4090,
72860,
368,
341,
286,
1273,
79399,
1006,
310,
435,
2,
698,
262,
5168,
15229,
1956,
549,
575,
18,
17,
8,
1464,
575,
18,
17,
341,
286,
600,
27,
91,
397,
262,
335,
57676,
345... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_receiving_invalid_mux_command_results_in_non_supported_command() {
let mut exec = fasync::Executor::new().unwrap();
let (mut session, mut outgoing_frames, _rfcomm_channels) = setup_session();
let mut outgoing_frames_stream = Box::pin(outgoing_frames.next());
assert!(session.multiplexer().start(Role::Responder).is_ok());
let unsupported_command = 0xff;
let mut handle_fut = Box::pin(session.handle_frame_parse_error(
FrameParseError::UnsupportedMuxCommandType(unsupported_command),
));
assert!(exec.run_until_stalled(&mut handle_fut).is_pending());
// We expect an NSC Frame response.
let expected_frame = Frame::make_mux_command(
Role::Responder,
MuxCommand {
params: MuxCommandParams::NonSupported(NonSupportedCommandParams {
cr_bit: true,
non_supported_command: unsupported_command,
}),
command_response: CommandResponse::Response,
},
);
match exec.run_until_stalled(&mut outgoing_frames_stream) {
Poll::Ready(Some(frame)) => {
assert_eq!(frame, expected_frame);
}
x => panic!("Expected a frame but got: {:?}", x),
}
assert!(exec.run_until_stalled(&mut handle_fut).is_ready());
} | rust_cleaned_test_functions.jsonl/14933 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 648
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
46344,
31433,
80363,
10811,
13576,
1243,
21637,
57885,
10811,
368,
341,
286,
1077,
5206,
3883,
284,
282,
7692,
486,
25255,
486,
931,
1005,
15454,
1428,
286,
1077,
320,
6984,
3797,
11,
5206,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_op_eq() {
let mut c = Compiler::new();
c.add(Instruction::LoadConst(Value::from(1)));
c.add(Instruction::LoadConst(Value::from(1)));
c.add(Instruction::Eq);
c.add(Instruction::Emit);
let mut output = String::new();
simple_eval(&c.finish().0, (), &mut output).unwrap();
assert_eq!(output, "true");
let mut c = Compiler::new();
c.add(Instruction::LoadConst(Value::from(1)));
c.add(Instruction::LoadConst(Value::from(2)));
c.add(Instruction::Eq);
c.add(Instruction::Emit);
let mut output = String::new();
simple_eval(&c.finish().0, (), &mut output).unwrap();
assert_eq!(output, "false");
} | rust_cleaned_test_functions.jsonl/72126 | {
"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,
10287,
10714,
368,
341,
262,
1077,
5206,
272,
284,
45631,
486,
931,
543,
262,
272,
1364,
7,
16664,
486,
5879,
19167,
25346,
486,
1499,
7,
16,
4945,
262,
272,
1364,
7,
16664,
486,
5879,
19167,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_zero_commit_fails() {
let keychain = ExtKeychain::from_random_seed().unwrap();
let key_id1 = ExtKeychain::derive_key_id(1, 1, 0, 0, 0);
// blinding should fail as signing with a zero r*G shouldn't work
build::transaction(
vec![
input(10, key_id1.clone()),
output(9, key_id1.clone()),
with_fee(1),
],
&keychain,
).unwrap();
} | rust_cleaned_test_functions.jsonl/49797 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19359,
36346,
761,
6209,
368,
341,
10217,
1376,
8819,
284,
9447,
1592,
8819,
486,
1499,
22644,
33809,
1005,
15454,
543,
10217,
1376,
842,
16,
284,
9447,
1592,
8819,
486,
27098,
3097,
842,
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_eval_offset_extended_sf() {
let cie = make_test_cie();
let ctx = UnwindContext::new();
let mut expected = ctx.clone();
expected
.set_register_rule(
Register(4),
RegisterRule::Offset(-3 * cie.data_alignment_factor),
)
.unwrap();
let instructions = [(
Ok(false),
CallFrameInstruction::OffsetExtendedSf {
register: Register(4),
factored_offset: -3,
},
)];
assert_eval(ctx, expected, cie, None, instructions);
} | rust_cleaned_test_functions.jsonl/9357 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 336
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21296,
6917,
61678,
56182,
368,
341,
286,
1077,
272,
645,
284,
1281,
4452,
666,
645,
543,
286,
1077,
5635,
284,
1230,
19154,
1972,
486,
931,
543,
286,
1077,
5206,
3601,
284,
5635,
15997,
543,
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_get_bit_mask() {
let mut output = Vec::new();
for i in 0..=3 {
let mask = get_bit_mask(2, i);
output.push(mask);
}
assert_eq!(output, vec![0, 4, 8, 12]);
} | rust_cleaned_test_functions.jsonl/118239 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
13996,
9999,
368,
341,
286,
1077,
5206,
2550,
284,
11312,
486,
931,
543,
286,
369,
600,
304,
220,
15,
496,
28,
18,
341,
310,
1077,
6911,
284,
633,
13996,
9999,
7,
17,
11,
600,
317,
310... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_to_formatted_string_date() {
let value = String::from("45435");
assert_eq!(
r#"2024-05-23"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_YYYYMMDD2)
);
assert_eq!(
r#"2024-05-23"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_YYYYMMDD)
);
assert_eq!(
r#"23-05-2024"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_DDMMYYYY)
);
assert_eq!(
r#"23/05/2024"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_DDMMYYYYSLASH)
);
assert_eq!(
r#"23/5/24"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_DMYSLASH)
);
assert_eq!(
r#"23-5-24"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_DMYMINUS)
);
assert_eq!(
r#"23-5"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_DMMINUS)
);
assert_eq!(
r#"5-24"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_MYMINUS)
);
assert_eq!(
r#"05-23-24"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_XLSX14)
);
assert_eq!(
r#"23-May-24"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_XLSX15)
);
assert_eq!(
r#"23-May"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_XLSX16)
);
assert_eq!(
r#"May-24"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_XLSX17)
);
assert_eq!(
r#"5/23/24 0:00"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_XLSX22)
);
assert_eq!(
r#"23/5/24 0:00"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_DATETIME)
);
assert_eq!(
r#"12:00 am"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_TIME1)
);
assert_eq!(
r#"12:00:00 am"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_TIME2)
);
assert_eq!(
r#"0:00"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_TIME3)
);
assert_eq!(
r#"0:00:00"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_TIME4)
);
assert_eq!(
r#"00:00"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_TIME5)
);
assert_eq!(
r#"0:00:00"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_TIME6)
);
assert_eq!(
r#"0:00:00"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_TIME8)
);
assert_eq!(
r#"2024/05/23"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_YYYYMMDDSLASH)
);
let value = String::from("44349.211134259262");
assert_eq!(
r#"2021-06-02"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_YYYYMMDD2)
);
assert_eq!(
r#"2021-06-02"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_YYYYMMDD)
);
assert_eq!(
r#"02-06-2021"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_DDMMYYYY)
);
assert_eq!(
r#"02/06/2021"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_DDMMYYYYSLASH)
);
assert_eq!(
r#"2/6/21"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_DMYSLASH)
);
assert_eq!(
r#"2-6-21"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_DMYMINUS)
);
assert_eq!(
r#"2-6"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_DMMINUS)
);
assert_eq!(
r#"6-21"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_MYMINUS)
);
assert_eq!(
r#"06-02-21"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_XLSX14)
);
assert_eq!(
r#"2-Jun-21"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_XLSX15)
);
assert_eq!(
r#"2-Jun"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_XLSX16)
);
assert_eq!(
r#"Jun-21"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_XLSX17)
);
assert_eq!(
r#"6/2/21 5:04"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_XLSX22)
);
assert_eq!(
r#"2/6/21 5:04"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_DATETIME)
);
assert_eq!(
r#"5:04 am"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_TIME1)
);
assert_eq!(
r#"5:04:02 am"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_TIME2)
);
assert_eq!(
r#"5:04"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_TIME3)
);
assert_eq!(
r#"5:04:02"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_TIME4)
);
assert_eq!(
r#"04:02"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_TIME5)
);
assert_eq!(
r#"5:04:02"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_TIME6)
);
assert_eq!(
r#"5:04:02"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_TIME8)
);
assert_eq!(
r#"2021/06/02"#,
to_formatted_string(&value, &NumberingFormat::FORMAT_DATE_YYYYMMDDSLASH)
);
} | rust_cleaned_test_functions.jsonl/87066 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2945
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
86610,
3904,
4164,
368,
341,
262,
1077,
897,
284,
923,
486,
1499,
445,
19,
20,
19,
18,
20,
5038,
715,
262,
2060,
10714,
33673,
286,
435,
55543,
17,
15,
17,
19,
12,
15,
20,
12,
17,
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_primitives() {
let _setup_guard = setup();
let isolate = &mut v8::Isolate::new(Default::default());
{
let scope = &mut v8::HandleScope::new(isolate);
let null = v8::null(scope);
assert!(!null.is_undefined());
assert!(null.is_null());
assert!(null.is_null_or_undefined());
let undefined = v8::undefined(scope);
assert!(undefined.is_undefined());
assert!(!undefined.is_null());
assert!(undefined.is_null_or_undefined());
let true_ = v8::Boolean::new(scope, true);
assert!(true_.is_true());
assert!(!true_.is_undefined());
assert!(!true_.is_null());
assert!(!true_.is_null_or_undefined());
let false_ = v8::Boolean::new(scope, false);
assert!(false_.is_false());
assert!(!false_.is_undefined());
assert!(!false_.is_null());
assert!(!false_.is_null_or_undefined());
}
} | rust_cleaned_test_functions.jsonl/1219 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 361
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5294,
35209,
368,
341,
220,
1077,
716,
15188,
36796,
284,
6505,
543,
220,
1077,
42123,
284,
609,
6984,
348,
23,
486,
3872,
33066,
486,
931,
87874,
486,
2258,
1423,
220,
341,
262,
1077,
6891,
284... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_typed_map() {
#[derive(Serialize, Deserialize, MartianStruct)]
struct ReadsStruct {
name: String,
reads_map: HashMap<String, FastqFile>,
multi_reads_map: Vec<HashMap<String, FastqFile>>,
}
#[derive(Serialize, Deserialize, MartianStruct)]
struct ComplicatedStruct {
name: String,
matrix: Vec<Vec<usize>>,
map_of_struct: HashMap<String, ReadsStruct>,
map_vec_struct: HashMap<usize, Vec<ReadsStruct>>,
map_of_lists: HashMap<String, Vec<usize>>,
map_of_matrices: HashMap<String, Vec<Vec<usize>>>,
vec_of_maps: Vec<HashMap<String, FastqFile>>,
ludicrous_map: Option<Vec<Vec<HashMap<String, Vec<Vec<FastqFile>>>>>>,
}
#[derive(Serialize, Deserialize, MartianStruct)]
pub struct SI {
complicated_stuff: Vec<HashMap<usize, Vec<Option<ReadsStruct>>>>,
reads_struct: ReadsStruct,
complicated_struct: ComplicatedStruct,
}
#[derive(Serialize, Deserialize, MartianStruct)]
pub struct SO {
multi_reads_struct: Vec<ReadsStruct>,
complicated_struct2: ComplicatedStruct,
}
pub struct StageName;
#[make_mro]
impl MartianMain for StageName {
type StageInputs = SI;
type StageOutputs = SO;
fn main(&self, _: Self::StageInputs, _: MartianRover) -> Result<Self::StageOutputs, Error> {
unimplemented!()
}
}
let expected = include_str!("mro/test_typed_map.mro");
assert_eq!(
make_mro_string(HEADER, &[StageName::stage_mro("my_adapter", "stage_name")]),
expected
);
} | rust_cleaned_test_functions.jsonl/104058 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 724
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
32501,
5376,
368,
341,
262,
11506,
27098,
3759,
9050,
11,
48440,
11,
81028,
9422,
5563,
262,
2036,
43721,
9422,
341,
286,
829,
25,
923,
345,
286,
15804,
5376,
25,
10528,
3464,
11,
17288,
80... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_std_ip() {
assert_eq!(
std::net::IpAddr::V4(std::net::Ipv4Addr::new(192, 168, 0, 1)),
std_ip!("192.168.0.1")
);
assert_eq!(
std::net::IpAddr::V6(std::net::Ipv6Addr::new(0xFF01, 0, 0, 0, 0, 0, 0, 0x0102)),
std_ip!("ff01::0102")
);
} | rust_cleaned_test_functions.jsonl/12522 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 220
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15656,
10385,
368,
341,
286,
2060,
10714,
33673,
310,
1460,
486,
4711,
486,
23378,
13986,
486,
53,
19,
5194,
486,
4711,
486,
80656,
19,
13986,
486,
931,
7,
16,
24,
17,
11,
220,
16,
21,
23,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_value_display() {
assert_eq!(format!("{}", Value::Bool(true)), "true");
assert_eq!(format!("{}", Value::Int(1)), "1");
assert_eq!(format!("{}", Value::String("lol".to_owned())), "lol");
} | rust_cleaned_test_functions.jsonl/35098 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 93
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3142,
14825,
368,
341,
220,
2060,
10714,
10297,
2243,
79878,
5162,
486,
11233,
3715,
5731,
330,
1866,
797,
220,
2060,
10714,
10297,
2243,
79878,
5162,
486,
1072,
7,
16,
5731,
330,
16,
797,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_async_message_pool() {
let keystore = MemKeyStore::new();
let mut wallet = Wallet::new(keystore);
let sender = wallet.generate_addr(SignatureType::Secp256k1).unwrap();
let target = wallet.generate_addr(SignatureType::Secp256k1).unwrap();
let mut tma = TestApi::default();
tma.set_state_sequence(&sender, 0);
task::block_on(async move {
let mpool = MessagePool::new(tma, "mptest".to_string()).await.unwrap();
let mut smsg_vec = Vec::new();
for i in 0..3 {
let msg = create_smsg(&target, &sender, wallet.borrow_mut(), i);
smsg_vec.push(msg);
}
assert_eq!(mpool.get_sequence(&sender).await.unwrap(), 0);
mpool.push(smsg_vec[0].clone()).await.unwrap();
assert_eq!(mpool.get_sequence(&sender).await.unwrap(), 1);
mpool.push(smsg_vec[1].clone()).await.unwrap();
assert_eq!(mpool.get_sequence(&sender).await.unwrap(), 2);
mpool.push(smsg_vec[2].clone()).await.unwrap();
assert_eq!(mpool.get_sequence(&sender).await.unwrap(), 3);
let header = mock_block(1, 1);
let tipset = Tipset::new(vec![header.clone()]).unwrap();
let ts = tipset.clone();
mpool
.api
.write()
.await
.set_heaviest_tipset(Arc::new(ts))
.await;
// sleep allows for async block to update mpool's cur_tipset
sleep(Duration::new(2, 0));
let cur_ts = mpool.cur_tipset.read().await.clone();
assert_eq!(cur_ts, tipset);
})
} | rust_cleaned_test_functions.jsonl/8492 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 894
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28346,
6462,
15709,
368,
341,
286,
1077,
1962,
63373,
284,
13550,
1592,
6093,
486,
931,
543,
286,
1077,
5206,
15085,
284,
36483,
486,
931,
7,
440,
63373,
317,
286,
1077,
4646,
284,
15085,
22019,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_parse_route() {
use lightning::routing::network_graph::RoutingFees;
use lightning::routing::router::{RouteHint, RouteHintHop};
use ::PrivateRoute;
use bech32::FromBase32;
use de::parse_int_be;
let input = from_bech32(
"q20q82gphp2nflc7jtzrcazrra7wwgzxqc8u7754cdlpfrmccae92qgzqvzq2ps8pqqqqqqpqqqqq9qqqvpeuqa\
fqxu92d8lr6fvg0r5gv0heeeqgcrqlnm6jhphu9y00rrhy4grqszsvpcgpy9qqqqqqgqqqqq7qqzq".as_bytes()
);
let mut expected = Vec::<RouteHintHop>::new();
expected.push(RouteHintHop {
src_node_id: PublicKey::from_slice(
&[
0x02u8, 0x9e, 0x03, 0xa9, 0x01, 0xb8, 0x55, 0x34, 0xff, 0x1e, 0x92, 0xc4, 0x3c,
0x74, 0x43, 0x1f, 0x7c, 0xe7, 0x20, 0x46, 0x06, 0x0f, 0xcf, 0x7a, 0x95, 0xc3,
0x7e, 0x14, 0x8f, 0x78, 0xc7, 0x72, 0x55
][..]
).unwrap(),
short_channel_id: parse_int_be(&[0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08], 256).expect("short chan ID slice too big?"),
fees: RoutingFees {
base_msat: 1,
proportional_millionths: 20,
},
cltv_expiry_delta: 3,
htlc_minimum_msat: None,
htlc_maximum_msat: None
});
expected.push(RouteHintHop {
src_node_id: PublicKey::from_slice(
&[
0x03u8, 0x9e, 0x03, 0xa9, 0x01, 0xb8, 0x55, 0x34, 0xff, 0x1e, 0x92, 0xc4, 0x3c,
0x74, 0x43, 0x1f, 0x7c, 0xe7, 0x20, 0x46, 0x06, 0x0f, 0xcf, 0x7a, 0x95, 0xc3,
0x7e, 0x14, 0x8f, 0x78, 0xc7, 0x72, 0x55
][..]
).unwrap(),
short_channel_id: parse_int_be(&[0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a], 256).expect("short chan ID slice too big?"),
fees: RoutingFees {
base_msat: 2,
proportional_millionths: 30,
},
cltv_expiry_delta: 4,
htlc_minimum_msat: None,
htlc_maximum_msat: None
});
assert_eq!(PrivateRoute::from_base32(&input), Ok(PrivateRoute(RouteHint(expected))));
assert_eq!(
PrivateRoute::from_base32(&[u5::try_from_u8(0).unwrap(); 40][..]),
Err(ParseError::UnexpectedEndOfTaggedFields)
);
} | rust_cleaned_test_functions.jsonl/123250 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1076
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
28109,
368,
341,
197,
41819,
32438,
486,
73320,
486,
17511,
14738,
486,
24701,
37,
5516,
280,
197,
41819,
32438,
486,
73320,
486,
9937,
22964,
4899,
26987,
11,
9572,
26987,
87273,
2440,
197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simple() {
let mut f = TestFixture::new();
let mut stack = Section::new();
stack.start().set_const(0x80000000);
stack = stack.D32(0).D32(0); // end-of-stack marker
f.raw.eip = 0x40000200;
f.raw.ebp = 0x80000000;
let s = f.walk_stack(stack);
assert_eq!(s.frames.len(), 1);
let f = &s.frames[0];
let m = f.module.as_ref().unwrap();
assert_eq!(m.code_file(), "module1");
} | rust_cleaned_test_functions.jsonl/82701 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 203
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
368,
341,
262,
1077,
5206,
282,
284,
3393,
18930,
486,
931,
543,
262,
1077,
5206,
5611,
284,
11113,
486,
931,
543,
262,
5611,
4962,
1005,
746,
13610,
7,
15,
87,
23,
15,
15,
15,
15,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_filter_with_env_var_set() {
// way
let (at, mut ucmd) = at_and_ucmd!();
let name = "filtered";
let n_lines = 3;
RandomFile::new(&at, name).add_lines(n_lines);
let env_var_value = "some-value";
env::set_var("FILE", &env_var_value);
ucmd.args(&[format!("--filter={}", "cat > $FILE").as_str(), name])
.succeeds();
let glob = Glob::new(&at, ".", r"x[[:alpha:]][[:alpha:]]$");
assert_eq!(glob.collate(), at.read_bytes(name));
assert!(env::var("FILE").unwrap_or_else(|_| "var was unset".to_owned()) == env_var_value);
} | rust_cleaned_test_functions.jsonl/25860 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 279
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8727,
6615,
15879,
4612,
2602,
368,
341,
1066,
262,
442,
1616,
7213,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
1077,
829,
284,
330,
41131,
876,
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_bank_tx_fee() {
let leader = Pubkey::new_rand();
let (genesis_block, mint_keypair) = GenesisBlock::new_with_leader(100, &leader, 3);
let mut bank = Bank::new(&genesis_block);
bank.fee_calculator.lamports_per_signature = 3;
let key1 = Keypair::new();
let key2 = Keypair::new();
let tx =
system_transaction::transfer(&mint_keypair, &key1.pubkey(), 2, genesis_block.hash(), 0);
let initial_balance = bank.get_balance(&leader);
assert_eq!(bank.process_transaction(&tx), Ok(()));
assert_eq!(bank.get_balance(&leader), initial_balance + 3);
assert_eq!(bank.get_balance(&key1.pubkey()), 2);
assert_eq!(bank.get_balance(&mint_keypair.pubkey()), 100 - 5 - 3);
bank.fee_calculator.lamports_per_signature = 1;
let tx = system_transaction::transfer(&key1, &key2.pubkey(), 1, genesis_block.hash(), 0);
assert_eq!(bank.process_transaction(&tx), Ok(()));
assert_eq!(bank.get_balance(&leader), initial_balance + 4);
assert_eq!(bank.get_balance(&key1.pubkey()), 0);
assert_eq!(bank.get_balance(&key2.pubkey()), 1);
assert_eq!(bank.get_balance(&mint_keypair.pubkey()), 100 - 5 - 3);
let mut tx =
system_transaction::transfer(&mint_keypair, &key2.pubkey(), 1, genesis_block.hash(), 0);
tx.message.instructions[0].data[0] = 40;
bank.process_transaction(&tx).is_err(); // fails with an instruction error
assert_eq!(bank.get_balance(&leader), initial_balance + 5); // gots our bucks
assert_eq!(bank.get_balance(&key2.pubkey()), 1); // our fee ------V
assert_eq!(bank.get_balance(&mint_keypair.pubkey()), 100 - 5 - 3 - 1);
} | rust_cleaned_test_functions.jsonl/41890 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 782
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35733,
17805,
34305,
368,
341,
286,
1077,
7653,
284,
22611,
792,
486,
931,
33864,
543,
286,
1077,
320,
77894,
7113,
11,
28337,
3097,
12670,
8,
284,
40788,
4713,
486,
931,
6615,
79991,
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_vec3mask_select() {
let a = Vec3A::new(1.0, 2.0, 3.0);
let b = Vec3A::new(4.0, 5.0, 6.0);
assert_eq!(
Vec3AMask::new(true, true, true).select(a, b),
Vec3A::new(1.0, 2.0, 3.0),
);
assert_eq!(
Vec3AMask::new(true, false, true).select(a, b),
Vec3A::new(1.0, 5.0, 3.0),
);
assert_eq!(
Vec3AMask::new(false, true, false).select(a, b),
Vec3A::new(4.0, 2.0, 6.0),
);
assert_eq!(
Vec3AMask::new(false, false, false).select(a, b),
Vec3A::new(4.0, 5.0, 6.0),
);
} | rust_cleaned_test_functions.jsonl/23497 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 341
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
18,
11258,
13051,
368,
341,
262,
1077,
264,
284,
11312,
18,
32,
486,
931,
7,
16,
13,
15,
11,
220,
17,
13,
15,
11,
220,
18,
13,
15,
317,
262,
1077,
293,
284,
11312,
18,
32,
486,
93... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ptrace_getsiginfo() {
match ptrace::getsiginfo(getpid()) {
Err(Error::UnsupportedOperation) => {
panic!("ptrace_getsiginfo returns Error::UnsupportedOperation!")
}
_ => (),
}
} | rust_cleaned_test_functions.jsonl/63566 | {
"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,
4348,
578,
3062,
21339,
2733,
368,
341,
262,
2432,
10087,
578,
486,
18691,
343,
2733,
5433,
10412,
2140,
341,
286,
15495,
37396,
486,
41884,
8432,
8,
589,
341,
310,
21975,
17223,
3505,
578,
3062,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
#[test]
fn test_index_expr() {
check_assist(
inline_local_variable,
r"
fn foo() {
let x = vec![1, 2, 3];
let a$0 = x[0];
let b = a * 10;
let c = a as usize;
}",
r"
fn foo() {
let x = vec![1, 2, 3];
let b = x[0] * 10;
let c = x[0] as usize;
}",
);
} | rust_cleaned_test_functions.jsonl/3230 | {
"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,
3560,
21915,
368,
341,
286,
1779,
12083,
380,
1006,
310,
7381,
13564,
14635,
345,
310,
435,
698,
8822,
15229,
368,
341,
262,
1077,
856,
284,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
935,
262... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iterator_len2() {
let nums = vec![13, 1];
let mut sap = SumPairs::new(&nums);
assert_eq!(sap.next(), Some(14));
assert_eq!(sap.next(), None);
} | rust_cleaned_test_functions.jsonl/2009 | {
"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,
13491,
6043,
17,
368,
341,
286,
1077,
10307,
284,
7486,
20703,
16,
18,
11,
220,
16,
935,
286,
1077,
5206,
34635,
284,
8116,
54228,
486,
931,
2099,
26350,
626,
286,
2060,
10714,
10297,
64613,
452... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_transaction_signature() {
let sapling = sapling_bls12::SAPLING.clone();
let spender_key = SaplingKey::generate_key(sapling.clone());
let receiver_key = SaplingKey::generate_key(sapling.clone());
let spender_address = spender_key.generate_public_address();
let receiver_address = receiver_key.generate_public_address();
let mut transaction = SimpleTransaction::new(sapling.clone(), spender_key, 0);
let in_note = Note::new(sapling.clone(), spender_address.clone(), 42, Memo([0; 32]));
let out_note = Note::new(sapling.clone(), receiver_address.clone(), 41, Memo([0; 32]));
let witness = make_fake_witness(sapling.clone(), &in_note);
transaction
.spend(&in_note, &witness)
.expect("should be able to spend note");
transaction
.receive(&out_note)
.expect("Should be able to receive note");
let public_transaction = transaction
.post()
.expect("should be able to post transaction");
let mut serialized_signature = vec![];
public_transaction
.binding_signature()
.write(&mut serialized_signature)
.unwrap();
assert_eq!(serialized_signature.len(), 64);
Signature::read(&mut serialized_signature[..].as_ref())
.expect("Can deserialize back into a valid Signature");
} | rust_cleaned_test_functions.jsonl/58439 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 507
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28884,
39859,
368,
341,
262,
1077,
34635,
2718,
284,
34635,
2718,
880,
4730,
16,
17,
486,
50,
2537,
74115,
15997,
543,
262,
1077,
83888,
3097,
284,
80175,
2718,
1592,
486,
19366,
3097,
1141,
391,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_append_refcnt() {
let gil = Python::acquire_gil();
let py = gil.python();
let cnt;
{
let _pool = crate::GILPool::new(py);
let list = PyList::empty(py);
let none = py.None();
cnt = none.get_refcnt();
list.append(none).unwrap();
}
assert_eq!(cnt, py.None().get_refcnt());
} | rust_cleaned_test_functions.jsonl/16318 | {
"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,
26041,
7793,
15853,
368,
341,
286,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
286,
1077,
4510,
284,
342,
321,
43193,
1428,
286,
1077,
13195,
280,
286,
341,
310,
1077,
716,
10285,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unsupported_anysegwit_shutdown_script() {
let mut config = UserConfig::default();
config.channel_options.announced_channel = true;
config.peer_channel_config_limits.force_announced_channel_preference = false;
config.channel_options.commit_upfront_shutdown_pubkey = false;
let user_cfgs = [None, Some(config), None];
let chanmon_cfgs = create_chanmon_cfgs(3);
let mut node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
node_cfgs[0].features = InitFeatures::known().clear_shutdown_anysegwit();
node_cfgs[1].features = InitFeatures::known().clear_shutdown_anysegwit();
let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &user_cfgs);
let nodes = create_network(3, &node_cfgs, &node_chanmgrs);
// Check that using an unsupported shutdown script fails and a supported one succeeds.
let supported_shutdown_script = chanmon_cfgs[1].keys_manager.get_shutdown_scriptpubkey();
let unsupported_shutdown_script =
ShutdownScript::new_witness_program(NonZeroU8::new(16).unwrap(), &[0, 40]).unwrap();
chanmon_cfgs[1].keys_manager
.expect(OnGetShutdownScriptpubkey { returns: unsupported_shutdown_script.clone() })
.expect(OnGetShutdownScriptpubkey { returns: supported_shutdown_script });
let chan = create_announced_chan_between_nodes(&nodes, 0, 1, node_cfgs[0].features.clone(), node_cfgs[1].features.clone());
match nodes[1].node.close_channel(&OutPoint { txid: chan.3.txid(), index: 0 }.to_channel_id()) {
Err(APIError::IncompatibleShutdownScript { script }) => {
assert_eq!(script.into_inner(), unsupported_shutdown_script.clone().into_inner());
},
Err(e) => panic!("Unexpected error: {:?}", e),
Ok(_) => panic!("Expected error"),
}
nodes[1].node.close_channel(&OutPoint { txid: chan.3.txid(), index: 0 }.to_channel_id()).unwrap();
check_added_monitors!(nodes[1], 1);
// Use a non-v0 segwit script unsupported without option_shutdown_anysegwit
let mut node_0_shutdown = get_event_msg!(nodes[1], MessageSendEvent::SendShutdown, nodes[0].node.get_our_node_id());
node_0_shutdown.scriptpubkey = unsupported_shutdown_script.into_inner();
nodes[0].node.handle_shutdown(&nodes[1].node.get_our_node_id(), &node_cfgs[1].features, &node_0_shutdown);
let events = nodes[0].node.get_and_clear_pending_msg_events();
assert_eq!(events.len(), 2);
match events[1] {
MessageSendEvent::HandleError { action: ErrorAction::SendErrorMessage { ref msg }, node_id } => {
assert_eq!(node_id, nodes[1].node.get_our_node_id());
assert_eq!(msg.data, "Got a nonstandard scriptpubkey (60020028) from remote peer".to_owned());
},
_ => panic!("Unexpected event"),
}
check_added_monitors!(nodes[0], 1);
check_closed_event!(nodes[0], 1, ClosureReason::ProcessingError { err: "Got a nonstandard scriptpubkey (60020028) from remote peer".to_string() });
} | rust_cleaned_test_functions.jsonl/6687 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1021
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
18216,
37248,
14607,
88519,
54804,
14660,
368,
341,
10217,
5206,
2193,
284,
2657,
2648,
486,
2258,
543,
25873,
16195,
8743,
13,
1020,
19453,
14571,
284,
830,
280,
25873,
72864,
14571,
5332,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_non_existent_proposal_id_is_not_a_bad_input() {
local_test_on_sns_subnet(|runtime| {
async move {
// Initialize the ledger with an account for a user.
let user = Sender::from_keypair(&TEST_USER1_KEYPAIR);
let alloc = Tokens::from_tokens(1000).unwrap();
let sns_init_payload = SnsInitPayloadsBuilder::new()
.with_ledger_account(user.get_principal_id().into(), alloc)
.build();
let sns_canisters = SnsCanisters::set_up(&runtime, sns_init_payload).await;
let req = GetProposal {
proposal_id: Some(ProposalId { id: 23 }),
};
// There is no proposal 23. This should return and error
let res: Result<Option<GetProposalResponse>, String> = sns_canisters
.governance
.query_("get_proposal", candid, (req,))
.await;
let get_proposal_response = res.unwrap().unwrap().result.unwrap();
match get_proposal_response {
Error(e) => assert_eq!(e.error_type, PreconditionFailed as i32),
ResponseProposal(_) => {
panic!("Proposal does not exist. get_proposal should return an error")
}
};
Ok(())
}
});
} | rust_cleaned_test_functions.jsonl/93508 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 682
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21637,
2702,
18128,
21663,
32556,
842,
6892,
7913,
4306,
34199,
5898,
368,
341,
262,
2205,
4452,
4470,
643,
4412,
95681,
22428,
22255,
91,
341,
286,
3312,
3271,
341,
310,
442,
9008,
279,
46933,
44... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_stack() {
let mut stack = Stack::new();
assert!(stack.is_empty());
assert!(stack.len() == 0);
assert!(!stack.last_is_index());
stack.push_index(0);
stack.bump_index();
assert!(stack.len() == 1);
assert!(stack.is_equal_to(&[Index(1)]));
assert!(stack.starts_with(&[Index(1)]));
assert!(stack.ends_with(&[Index(1)]));
assert!(stack.last_is_index());
assert!(stack.get(0) == Index(1));
stack.push_key("foo".to_string());
assert!(stack.len() == 2);
assert!(stack.is_equal_to(&[Index(1), Key("foo")]));
assert!(stack.starts_with(&[Index(1), Key("foo")]));
assert!(stack.starts_with(&[Index(1)]));
assert!(stack.ends_with(&[Index(1), Key("foo")]));
assert!(stack.ends_with(&[Key("foo")]));
assert!(!stack.last_is_index());
assert!(stack.get(0) == Index(1));
assert!(stack.get(1) == Key("foo"));
stack.push_key("bar".to_string());
assert!(stack.len() == 3);
assert!(stack.is_equal_to(&[Index(1), Key("foo"), Key("bar")]));
assert!(stack.starts_with(&[Index(1)]));
assert!(stack.starts_with(&[Index(1), Key("foo")]));
assert!(stack.starts_with(&[Index(1), Key("foo"), Key("bar")]));
assert!(stack.ends_with(&[Key("bar")]));
assert!(stack.ends_with(&[Key("foo"), Key("bar")]));
assert!(stack.ends_with(&[Index(1), Key("foo"), Key("bar")]));
assert!(!stack.last_is_index());
assert!(stack.get(0) == Index(1));
assert!(stack.get(1) == Key("foo"));
assert!(stack.get(2) == Key("bar"));
stack.pop();
assert!(stack.len() == 2);
assert!(stack.is_equal_to(&[Index(1), Key("foo")]));
assert!(stack.starts_with(&[Index(1), Key("foo")]));
assert!(stack.starts_with(&[Index(1)]));
assert!(stack.ends_with(&[Index(1), Key("foo")]));
assert!(stack.ends_with(&[Key("foo")]));
assert!(!stack.last_is_index());
assert!(stack.get(0) == Index(1));
assert!(stack.get(1) == Key("foo"));
} | rust_cleaned_test_functions.jsonl/22765 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1059
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15528,
368,
341,
286,
1077,
5206,
5611,
284,
14284,
486,
931,
1428,
286,
2060,
10297,
7693,
2079,
15124,
1423,
286,
2060,
10297,
7693,
19406,
368,
621,
220,
15,
317,
286,
2060,
0,
3471,
7693,
91... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_make_cast_default() -> Fallible<()> {
let transformation = Result::from(opendp_trans__make_cast_default(
"String".to_char_p(),
"i32".to_char_p(),
))?;
let arg = AnyObject::new_raw(vec!["a".to_string(), "1".to_string()]);
let res = core::opendp_core__transformation_invoke(&transformation, arg);
let res: Vec<i32> = Fallible::from(res)?.downcast()?;
assert_eq!(res, vec![0, 1]);
Ok(())
} | rust_cleaned_test_functions.jsonl/60451 | {
"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,
28230,
5303,
9993,
368,
1464,
14785,
1238,
71698,
341,
286,
1077,
17991,
284,
5714,
486,
1499,
17096,
408,
79,
7965,
563,
6927,
5303,
9993,
1006,
310,
330,
703,
3263,
983,
9232,
620,
3148,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_terminate() {
let location = TempLocation::new();
request_stream_test(
location.to_persistent_lifetime(),
create_clean_pre_auth_manager(),
None,
Arc::new(Inspector::new()),
|proxy| {
async move {
proxy.create_account(None).await??;
// Keep an open channel to an account.
let (account_client_end, account_server_end) = create_endpoints().unwrap();
let (acp_client_end, _) = create_endpoints().unwrap();
proxy.get_account(acp_client_end, account_server_end).await??;
let account_proxy = account_client_end.into_proxy().unwrap();
// Terminate the handler
proxy.terminate()?;
// Check that further operations fail
assert!(proxy.remove_account(FORCE_REMOVE_ON).await.is_err());
assert!(proxy.terminate().is_err());
// Make sure that the channel closed too.
assert!(account_proxy
.get_auth_state(&mut DEFAULT_SCENARIO.clone())
.await
.is_err());
Ok(())
}
},
);
} | rust_cleaned_test_functions.jsonl/105850 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 764
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
48061,
368,
341,
286,
1077,
3728,
284,
19944,
4707,
486,
931,
543,
286,
1681,
12673,
4452,
1006,
310,
3728,
2389,
620,
13931,
98827,
3148,
310,
1855,
19573,
10442,
14014,
12144,
3148,
310,
224... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_get_config() {
let mut yubikey = YUBIKEY.lock().unwrap();
let config_result = yubikey.config();
assert!(config_result.is_ok());
trace!("config: {:?}", config_result.unwrap());
} | rust_cleaned_test_functions.jsonl/33332 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 93
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
5332,
368,
341,
262,
1077,
5206,
379,
54233,
792,
284,
809,
4493,
40,
4784,
21003,
1005,
15454,
543,
262,
1077,
2193,
5287,
284,
379,
54233,
792,
5423,
543,
262,
2060,
10297,
1676,
5287,
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 |
#[test]
fn test_parse_single_regex_with_prefix_and_suffix() {
let segments = PathParser::new(r"/prefix<abc:/\d+/>suffix.png").parse().unwrap();
assert_eq!(
format!("{:?}", segments),
r#"[CombPart([ConstPart("prefix"), RegexPart { name: "abc", regex: \d+ }, ConstPart("suffix.png")])]"#
);
} | rust_cleaned_test_functions.jsonl/63591 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 166
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
19487,
41832,
6615,
13974,
8378,
37151,
368,
341,
286,
1077,
20632,
284,
7933,
6570,
486,
931,
2601,
3115,
11849,
27,
13683,
14375,
59,
67,
10,
9685,
26786,
3508,
1827,
6400,
1005,
15454,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_boolean_builder_increases_buffer_len() {
let buf = Buffer::from([72_u8, 2_u8]);
let mut builder = BooleanBufferBuilder::new(8);
for i in 0..10 {
if i == 3 || i == 6 || i == 9 {
builder.append(true).unwrap();
} else {
builder.append(false).unwrap();
}
}
let buf2 = builder.finish();
assert_eq!(buf.len(), buf2.len());
assert_eq!(buf.data(), buf2.data());
} | rust_cleaned_test_functions.jsonl/30970 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 274
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46642,
28532,
1243,
837,
2264,
7776,
6043,
368,
341,
1789,
286,
1077,
6607,
284,
10312,
486,
1499,
2561,
22,
17,
7300,
23,
11,
220,
17,
7300,
23,
2558,
286,
1077,
5206,
7363,
284,
6992,
4095,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_list_array_builder_nulls() {
let values_builder = Int32Builder::new(10);
let mut builder = ListBuilder::new(values_builder);
builder.values().append_value(0).unwrap();
builder.values().append_value(1).unwrap();
builder.values().append_value(2).unwrap();
builder.append(true).unwrap();
builder.append(false).unwrap();
builder.values().append_value(3).unwrap();
builder.values().append_null().unwrap();
builder.values().append_value(5).unwrap();
builder.append(true).unwrap();
builder.values().append_value(6).unwrap();
builder.values().append_value(7).unwrap();
builder.append(true).unwrap();
let list_array = builder.finish();
assert_eq!(DataType::Int32, list_array.value_type());
assert_eq!(4, list_array.len());
assert_eq!(1, list_array.null_count());
assert_eq!(3, list_array.value_offsets()[2]);
assert_eq!(3, list_array.value_length(2));
} | rust_cleaned_test_functions.jsonl/74127 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 455
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2019,
3858,
28532,
15162,
82,
368,
341,
286,
1077,
2750,
28532,
284,
1333,
18,
17,
3297,
486,
931,
7,
16,
15,
317,
286,
1077,
5206,
7363,
284,
1759,
3297,
486,
931,
20103,
28532,
626,
1789,
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_non_breaking_space() {
assert_eq!(tokenize("\u{00a0}"), ["\u{00a0}"]);
assert_eq!(tokenize("\u{00a0}s"), ["\u{00a0}", "s"]);
} | rust_cleaned_test_functions.jsonl/79730 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21637,
39494,
287,
14663,
368,
341,
286,
2060,
10714,
10297,
5839,
551,
4921,
84,
90,
15,
15,
64,
15,
92,
3975,
4383,
59,
84,
90,
15,
15,
64,
15,
92,
15049,
286,
2060,
10714,
10297,
5839,
55... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fullname_name_namespace_and_default_namespace_specified() {
init();
let name: Name =
serde_json::from_str(r#"{"name": "a", "namespace": "o.a.a", "aliases": null}"#).unwrap();
assert_eq!(&name.name, "a");
assert_eq!(name.namespace, Some("o.a.a".to_owned()));
let fullname = name.fullname(Some("o.a.h".into()));
assert_eq!("o.a.a.a", fullname);
} | rust_cleaned_test_functions.jsonl/69040 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 184
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16372,
606,
1269,
41571,
8378,
9993,
41571,
13594,
1870,
368,
341,
262,
2930,
543,
262,
1077,
829,
25,
3988,
4035,
286,
61570,
9455,
486,
1499,
2895,
2601,
55543,
4913,
606,
788,
330,
64,
497,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unsigned_payload() {
let req = test_request("get-vanilla-query-order-key-case");
let req = SignableRequest::new(
req.method(),
req.uri(),
req.headers(),
SignableBody::UnsignedPayload,
);
let settings = SigningSettings {
payload_checksum_kind: PayloadChecksumKind::XAmzSha256,
..Default::default()
};
let signing_params = signing_params(settings);
let creq = CanonicalRequest::from(&req, &signing_params).unwrap();
assert_eq!(creq.values.content_sha256(), "UNSIGNED-PAYLOAD");
assert!(creq.to_string().ends_with("UNSIGNED-PAYLOAD"));
} | rust_cleaned_test_functions.jsonl/83737 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 333
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67830,
32813,
368,
341,
286,
1077,
4232,
284,
1273,
7893,
445,
455,
8273,
276,
6241,
65489,
23810,
16173,
38485,
797,
286,
1077,
4232,
284,
7075,
480,
1900,
486,
931,
1006,
310,
4232,
12908,
3148,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_numbers() {
let mut reader = Lexer::from_str("1 2\n0123 10");
assert_tok(
&mut reader,
TokenKind::LitInt("1".into(), IntBase::Dec, IntSuffix::Int),
1,
1,
);
assert_tok(
&mut reader,
TokenKind::LitInt("2".into(), IntBase::Dec, IntSuffix::Int),
1,
3,
);
assert_tok(
&mut reader,
TokenKind::LitInt("0123".into(), IntBase::Dec, IntSuffix::Int),
2,
1,
);
assert_tok(
&mut reader,
TokenKind::LitInt("10".into(), IntBase::Dec, IntSuffix::Int),
2,
6,
);
assert_end(&mut reader, 2, 8);
let mut reader = Lexer::from_str("12Y 300Y 1_000 1__1");
assert_tok(
&mut reader,
TokenKind::LitInt("12".into(), IntBase::Dec, IntSuffix::Byte),
1,
1,
);
assert_tok(
&mut reader,
TokenKind::LitInt("300".into(), IntBase::Dec, IntSuffix::Byte),
1,
5,
);
assert_tok(
&mut reader,
TokenKind::LitInt("1_000".into(), IntBase::Dec, IntSuffix::Int),
1,
10,
);
assert_tok(
&mut reader,
TokenKind::LitInt("1__1".into(), IntBase::Dec, IntSuffix::Int),
1,
16,
);
} | rust_cleaned_test_functions.jsonl/101118 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 914
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
32964,
368,
341,
286,
1077,
5206,
6604,
284,
85082,
486,
1499,
2895,
445,
16,
220,
17,
1699,
15,
16,
17,
18,
220,
16,
15,
797,
286,
2060,
76162,
1006,
310,
609,
6984,
6604,
345,
310,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unary_minus_int() {
let unsigned_test_cases = vec![
(None, None),
(Some((std::i64::MAX as u64 + 1) as i64), Some(std::i64::MIN)),
(Some(12345), Some(-12345)),
(Some(0), Some(0)),
];
for (arg, expect_output) in unsigned_test_cases {
let field_type = FieldTypeBuilder::new()
.tp(FieldTypeTp::LongLong)
.flag(FieldTypeFlag::UNSIGNED)
.build();
let output = RpnFnScalarEvaluator::new()
.push_param_with_field_type(arg, field_type)
.evaluate::<Int>(ScalarFuncSig::UnaryMinusInt)
.unwrap();
assert_eq!(output, expect_output, "{:?}", arg);
}
assert!(RpnFnScalarEvaluator::new()
.push_param_with_field_type(
Some((std::i64::MAX as u64 + 2) as i64),
FieldTypeBuilder::new()
.tp(FieldTypeTp::LongLong)
.flag(FieldTypeFlag::UNSIGNED)
.build()
)
.evaluate::<Int>(ScalarFuncSig::UnaryMinusInt)
.is_err());
let signed_test_cases = vec![
(None, None),
(Some(std::i64::MAX), Some(-std::i64::MAX)),
(Some(-std::i64::MAX), Some(std::i64::MAX)),
(Some(std::i64::MIN + 1), Some(std::i64::MAX)),
(Some(0), Some(0)),
];
for (arg, expect_output) in signed_test_cases {
let output = RpnFnScalarEvaluator::new()
.push_param(arg)
.evaluate::<Int>(ScalarFuncSig::UnaryMinusInt)
.unwrap();
assert_eq!(output, expect_output, "{:?}", arg);
}
assert!(RpnFnScalarEvaluator::new()
.push_param(std::i64::MIN)
.evaluate::<Int>(ScalarFuncSig::UnaryMinusInt)
.is_err());
} | rust_cleaned_test_functions.jsonl/29749 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
658,
38457,
4042,
368,
341,
286,
1077,
3774,
4452,
41427,
284,
7486,
90515,
310,
320,
4064,
11,
2240,
1326,
310,
320,
8373,
1188,
1834,
486,
72,
21,
19,
486,
10586,
438,
575,
21,
19,
488... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_include_space() {
let mut reader = Reader::init("file\\ with\\ spaces");
assert_eq!(
parse(&mut reader).unwrap(),
Filename {
value: String::from("file with spaces"),
source_info: SourceInfo::init(1, 1, 1, 19),
}
);
assert_eq!(reader.state.cursor, 18);
} | rust_cleaned_test_functions.jsonl/88739 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 197
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37878,
14663,
368,
341,
286,
1077,
5206,
6604,
284,
25166,
486,
2327,
445,
1192,
3422,
448,
3422,
12621,
797,
286,
2060,
10714,
33673,
310,
4715,
2099,
6984,
6604,
568,
15454,
3148,
310,
49811,
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_duplicate_name() {
let db = Database::temp().unwrap();
let config = Config::default();
let ctx = ActionsCtx::new(&db, &config);
crate::crates::lists::setup_test_lists(&db, &config).unwrap();
// The first experiment can be created successfully
CreateExperiment {
name: "foo".to_string(),
toolchains: [MAIN_TOOLCHAIN.clone(), TEST_TOOLCHAIN.clone()],
mode: Mode::BuildAndTest,
crates: CrateSelect::Local,
cap_lints: CapLints::Forbid,
priority: 0,
github_issue: None,
ignore_blacklist: false,
assign: None,
requirement: None,
}
.apply(&ctx)
.unwrap();
// While the second one fails
let err = CreateExperiment {
name: "foo".to_string(),
toolchains: [MAIN_TOOLCHAIN.clone(), TEST_TOOLCHAIN.clone()],
mode: Mode::BuildAndTest,
crates: CrateSelect::Local,
cap_lints: CapLints::Forbid,
priority: 0,
github_issue: None,
ignore_blacklist: false,
assign: None,
requirement: None,
}
.apply(&ctx)
.unwrap_err();
assert_eq!(
err.downcast_ref(),
Some(&ExperimentError::AlreadyExists("foo".into()))
);
} | rust_cleaned_test_functions.jsonl/74502 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 716
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70434,
1269,
368,
341,
286,
1077,
2927,
284,
9994,
486,
3888,
1005,
15454,
543,
286,
1077,
2193,
284,
5532,
486,
2258,
543,
286,
1077,
5635,
284,
26722,
23684,
486,
931,
2099,
1999,
11,
609,
167... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fs_from_into_repr() {
// r + 1 should not be in the field
assert!(Fs::from_repr(FsRepr([0xd0970e5ed6f72cb8, 0xa6682093ccc81082, 0x6673b0101343b00, 0xe7db4ea6533afa9])).is_err());
// r should not be in the field
assert!(Fs::from_repr(Fs::char()).is_err());
// Multiply some arbitrary representations to see if the result is as expected.
let a = FsRepr([0x5f2d0c05d0337b71, 0xa1df2b0f8a20479, 0xad73785e71bb863, 0x504a00480c9acec]);
let mut a_fs = Fs::from_repr(a).unwrap();
let b = FsRepr([0x66356ff51e477562, 0x60a92ab55cf7603, 0x8e4273c7364dd192, 0x36df8844a344dc5]);
let b_fs = Fs::from_repr(b).unwrap();
let c = FsRepr([0x7eef61708f4f2868, 0x747a7e6cf52946fb, 0x83dd75d7c9120017, 0x762f5177f0f3df7]);
a_fs.mul_assign(&b_fs);
assert_eq!(a_fs.into_repr(), c);
// Zero should be in the field.
assert!(Fs::from_repr(FsRepr::from(0)).unwrap().is_zero());
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
for _ in 0..1000 {
let a = Fs::rand(&mut rng);
let a_repr = a.into_repr();
let b_repr = FsRepr::from(a);
assert_eq!(a_repr, b_repr);
let a_again = Fs::from_repr(a_repr).unwrap();
assert_eq!(a, a_again);
}
} | rust_cleaned_test_functions.jsonl/95520 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 678
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34470,
5673,
45514,
68535,
368,
341,
262,
442,
435,
488,
220,
16,
1265,
537,
387,
304,
279,
2070,
198,
262,
2060,
10297,
48300,
486,
1499,
68535,
7832,
82,
693,
649,
2561,
15,
9703,
15,
24,
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... | 2 |
#[test]
fn test_stdout_does_not_contain_fail() {
let res = CmdResult {
bin_path: "".into(),
util_name: None,
tmpd: None,
code: None,
success: true,
stdout: "This is a likely error message\n".into(),
stderr: "".into(),
};
res.stdout_does_not_contain("likely");
} | rust_cleaned_test_functions.jsonl/12795 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 212
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67416,
96374,
7913,
10260,
466,
22121,
368,
341,
286,
1077,
592,
284,
40210,
2077,
341,
310,
9544,
2638,
25,
44907,
18122,
3148,
310,
4094,
1269,
25,
2240,
345,
310,
4174,
67,
25,
2240,
345,
310... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_remove_inactive_device() {
let mut d = TestDevices::default();
let a = d.add_device(|id| id + 10);
let b = d.add_device(|id| id + 20);
assert_ne!(a, b, "allocated same id");
// check that ids are incrementing
assert_eq!(d.last_id, 2);
// check that devices are correctly inserted and don't
// carry a core id.
assert_eq!(d.get_device(a).unwrap().core_id, None);
assert_eq!(d.get_device(b).unwrap().core_id, None);
assert_eq!(d.get_core_id(a), None);
assert_eq!(d.get_core_id(b), None);
// remove both devices
let info_a = d.remove_device(a).expect("can remove device");
let info_b = d.remove_device(b).expect("can remove device");
assert_eq!(info_a.info, a + 10);
assert_eq!(info_b.info, b + 20);
assert_eq!(info_a.core_id, None);
assert_eq!(info_b.core_id, None);
// removing device again will fail
assert_eq!(d.remove_device(a), None);
// retrieving the device now should fail:
assert_eq!(d.get_device(a), None);
assert_eq!(d.get_core_id(a), None);
assert!(d.active_devices.is_empty());
assert!(d.inactive_devices.is_empty());
assert!(d.id_map.is_empty());
} | rust_cleaned_test_functions.jsonl/18161 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 622
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
18193,
90882,
9204,
368,
341,
286,
1077,
5206,
294,
284,
3393,
40835,
486,
2258,
543,
286,
1077,
264,
284,
294,
1364,
9204,
22428,
307,
91,
877,
488,
220,
16,
15,
317,
286,
1077,
293,
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_num_caracter() {
assert_eq!(caracter("\"a\""), Ok(("", ("a", "char"))));
assert_eq!(caracter("\"-\""), Ok(("", ("-", "char"))));
} | rust_cleaned_test_functions.jsonl/46883 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 77
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4273,
26616,
2481,
368,
341,
262,
2060,
10714,
10297,
135523,
38915,
64,
2105,
3975,
7622,
7,
19814,
3489,
64,
497,
330,
1762,
2761,
1106,
262,
2060,
10714,
10297,
135523,
38915,
12,
2105,
3975,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_wmi_keyboard () {
let reader: Box<dyn WmiKeyboardIface> = Box::new(Test {});
let keyboard_info = &WmiKeyboard::get_specific_ex(reader.borrow())[0];
assert_eq!(WmiKeyboard::get_specific_ex(reader.borrow()).len(), 2);
assert_eq!(keyboard_info.name, "Enhanced (101- or 102-key)");
assert_eq!(keyboard_info.description, "USB Input Device");
assert_eq!(keyboard_info.device_id, "USB\\VID_046D&0&0000");
assert_eq!(keyboard_info.status, "OK");
} | rust_cleaned_test_functions.jsonl/5532 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 248
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1670,
8155,
58797,
1719,
972,
286,
1077,
6604,
25,
8261,
92846,
467,
8155,
18912,
40,
1564,
29,
284,
8261,
486,
931,
31159,
4687,
736,
286,
1077,
13625,
3109,
284,
609,
54,
8155,
18912,
486,
455... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fidl_ip_v6() {
assert_eq!(
fidl::Ipv6Address {
addr: [0xFF, 0x01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x01, 0x02]
},
fidl_ip_v6!("ff01::0102")
);
} | rust_cleaned_test_functions.jsonl/12530 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
55464,
10385,
2273,
21,
368,
341,
286,
2060,
10714,
33673,
310,
32104,
75,
486,
80656,
21,
4286,
341,
394,
10789,
25,
508,
15,
9264,
11,
220,
15,
87,
15,
16,
11,
220,
15,
11,
220,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_group_by() {
let data = vec![
(1, Some("name:0"), 2),
(2, Some("name:2"), 3),
(4, Some("name:0"), 1),
(5, Some("name:1"), 4),
];
let product = ProductTable::new();
let (_, endpoint) = init_with_data(&product, &data);
// for dag
let req = DAGSelect::from(&product.table)
.group_by(&[&product.name])
.build();
let mut resp = handle_select(&endpoint, req);
let mut row_count = 0;
let spliter = DAGChunkSpliter::new(resp.take_chunks().into_vec(), 1);
for (row, name) in spliter.zip(&[b"name:0", b"name:2", b"name:1"]) {
let expected_encoded = datum::encode_value(&[Datum::Bytes(name.to_vec())]).unwrap();
let result_encoded = datum::encode_value(&row).unwrap();
assert_eq!(result_encoded, &*expected_encoded);
row_count += 1;
}
assert_eq!(row_count, 3);
} | rust_cleaned_test_functions.jsonl/34847 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 425
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6288,
3710,
368,
341,
262,
1077,
821,
284,
7486,
90515,
286,
320,
16,
11,
4329,
445,
606,
25,
15,
3975,
220,
17,
1326,
286,
320,
17,
11,
4329,
445,
606,
25,
17,
3975,
220,
18,
1326,
286,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_raw_string() {
assert_eq!(raw_string(r#"r"foo""#), Ok(("", "foo")));
assert_eq!(raw_string("r\"foo\nbar\""), Ok(("", "foo\nbar")));
assert_eq!(raw_string(r##"r#"foo"#"##), Ok(("", "foo")));
assert_eq!(raw_string(r###"r##"foo"##"###), Ok(("", "foo")));
assert_eq!(raw_string(r#"r"\nfoo\r""#), Ok(("", r"\nfoo\r")));
assert!(raw_string(r###"r##"foo"#"###).is_err());
} | rust_cleaned_test_functions.jsonl/116074 | {
"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,
16067,
3904,
368,
341,
286,
2060,
10714,
10297,
1041,
3904,
2601,
55543,
81,
1,
7975,
3014,
2,
701,
7622,
7,
19814,
330,
7975,
17621,
286,
2060,
10714,
10297,
1041,
3904,
445,
81,
2105,
7975,
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_normal_info() {
let e2e4 = ChessMove::new(
Square::make_square(Rank::Second, File::E),
Square::make_square(Rank::Fourth, File::E),
None,
);
let e7e5 = ChessMove::new(
Square::make_square(Rank::Seventh, File::E),
Square::make_square(Rank::Fifth, File::E),
None,
);
test_info("info depth 2 seldepth 3 multipv 1 score cp 6 nodes 100 time 1 nps 1000 currmove e2e4 currmovenumber 1 tbhits 0 pv e2e4 e7e5\n",
Info::pv(vec![e2e4, e7e5])
.combine(&Info::depth(2))
.combine(&Info::seldepth(3))
.combine(&Info::multi_pv(1))
.combine(&Info::nodes(100))
.combine(&Info::time(1))
.combine(&Info::score(Score::Cp(6)))
.combine(&Info::cur_move(e2e4))
.combine(&Info::cur_move_number(1))
.combine(&Info::nps(1000))
.combine(&Info::tb_hits(0)));
} | rust_cleaned_test_functions.jsonl/134560 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 529
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13973,
3109,
368,
341,
262,
1077,
384,
17,
68,
19,
284,
47387,
9860,
486,
931,
1006,
286,
15619,
486,
6927,
39794,
2785,
1180,
486,
15666,
11,
2887,
486,
36,
1326,
286,
15619,
486,
6927,
39794,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rpc_wallet_name() {
let secp = Secp256k1::new();
let name =
wallet_name_from_descriptor(DESCRIPTOR_PUB, None, Network::Regtest, &secp).unwrap();
assert_eq!("tmg7aqay", name);
} | rust_cleaned_test_functions.jsonl/108193 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60799,
62308,
1269,
368,
341,
286,
1077,
511,
4672,
284,
4520,
79,
17,
20,
21,
74,
16,
486,
931,
543,
286,
1077,
829,
4035,
310,
15085,
1269,
5673,
33774,
82208,
50920,
1088,
4493,
11,
2240,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_merge_multivalued_int_fields_simple() -> crate::Result<()> {
let mut schema_builder = schema::Schema::builder();
let int_options = NumericOptions::default()
.set_fast(Cardinality::MultiValues)
.set_indexed();
let int_field = schema_builder.add_u64_field("intvals", int_options);
let index = Index::create_in_ram(schema_builder.build());
{
let mut index_writer = index.writer_for_tests()?;
let index_doc = |index_writer: &mut IndexWriter, int_vals: &[u64]| {
let mut doc = Document::default();
for &val in int_vals {
doc.add_u64(int_field, val);
}
index_writer.add_document(doc).unwrap();
};
index_doc(&mut index_writer, &[1, 2]);
index_doc(&mut index_writer, &[1, 2, 3]);
index_doc(&mut index_writer, &[4, 5]);
index_doc(&mut index_writer, &[1, 2]);
index_doc(&mut index_writer, &[1, 5]);
index_doc(&mut index_writer, &[3]);
index_doc(&mut index_writer, &[17]);
assert!(index_writer.commit().is_ok());
index_doc(&mut index_writer, &[20]);
assert!(index_writer.commit().is_ok());
index_doc(&mut index_writer, &[28, 27]);
index_doc(&mut index_writer, &[1_000]);
assert!(index_writer.commit().is_ok());
}
let reader = index.reader()?;
let searcher = reader.searcher();
let mut vals: Vec<u64> = Vec::new();
{
let segment = searcher.segment_reader(0u32);
let ff_reader = segment.fast_fields().u64s(int_field).unwrap();
ff_reader.get_vals(0, &mut vals);
assert_eq!(&vals, &[1, 2]);
ff_reader.get_vals(1, &mut vals);
assert_eq!(&vals, &[1, 2, 3]);
ff_reader.get_vals(2, &mut vals);
assert_eq!(&vals, &[4, 5]);
ff_reader.get_vals(3, &mut vals);
assert_eq!(&vals, &[1, 2]);
ff_reader.get_vals(4, &mut vals);
assert_eq!(&vals, &[1, 5]);
ff_reader.get_vals(5, &mut vals);
assert_eq!(&vals, &[3]);
ff_reader.get_vals(6, &mut vals);
assert_eq!(&vals, &[17]);
}
{
let segment = searcher.segment_reader(1u32);
let ff_reader = segment.fast_fields().u64s(int_field).unwrap();
ff_reader.get_vals(0, &mut vals);
assert_eq!(&vals, &[28, 27]);
ff_reader.get_vals(1, &mut vals);
assert_eq!(&vals, &[1_000]);
}
{
let segment = searcher.segment_reader(2u32);
let ff_reader = segment.fast_fields().u64s(int_field).unwrap();
ff_reader.get_vals(0, &mut vals);
assert_eq!(&vals, &[20]);
}
// Merging the segments
{
let segment_ids = index.searchable_segment_ids()?;
let mut index_writer = index.writer_for_tests()?;
block_on(index_writer.merge(&segment_ids))?;
index_writer.wait_merging_threads()?;
}
reader.reload()?;
{
let searcher = reader.searcher();
let segment = searcher.segment_reader(0u32);
let ff_reader = segment.fast_fields().u64s(int_field).unwrap();
ff_reader.get_vals(0, &mut vals);
assert_eq!(&vals, &[1, 2]);
ff_reader.get_vals(1, &mut vals);
assert_eq!(&vals, &[1, 2, 3]);
ff_reader.get_vals(2, &mut vals);
assert_eq!(&vals, &[4, 5]);
ff_reader.get_vals(3, &mut vals);
assert_eq!(&vals, &[1, 2]);
ff_reader.get_vals(4, &mut vals);
assert_eq!(&vals, &[1, 5]);
ff_reader.get_vals(5, &mut vals);
assert_eq!(&vals, &[3]);
ff_reader.get_vals(6, &mut vals);
assert_eq!(&vals, &[17]);
ff_reader.get_vals(7, &mut vals);
assert_eq!(&vals, &[28, 27]);
ff_reader.get_vals(8, &mut vals);
assert_eq!(&vals, &[1_000]);
ff_reader.get_vals(9, &mut vals);
assert_eq!(&vals, &[20]);
}
Ok(())
} | rust_cleaned_test_functions.jsonl/943 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2342
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20888,
26290,
3936,
3260,
4042,
12132,
30015,
368,
1464,
17717,
486,
2077,
71698,
341,
286,
1077,
5206,
10802,
28532,
284,
10802,
486,
8632,
486,
17850,
543,
286,
1077,
526,
8743,
284,
50367,
3798,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 9 |
#[test]
fn test_decimal_as_duration() {
test_none_with_ctx_and_extra(cast_decimal_as_duration);
let cs = vec![
Decimal::from(i64::MIN),
Decimal::from(i64::MAX),
Decimal::from(u64::MAX),
Decimal::zero(),
Decimal::from_bytes(b"-9223372036854775808")
.unwrap()
.unwrap(),
Decimal::from_bytes(b"9223372036854775808")
.unwrap()
.unwrap(),
Decimal::from_bytes(b"-9223372036854775809")
.unwrap()
.unwrap(),
Decimal::from_bytes(b"9223372036854775809")
.unwrap()
.unwrap(),
Decimal::from_bytes(b"-18446744073709551615")
.unwrap()
.unwrap(),
Decimal::from_bytes(b"18446744073709551615")
.unwrap()
.unwrap(),
Decimal::from_bytes(b"-18446744073709551616")
.unwrap()
.unwrap(),
Decimal::from_bytes(b"18446744073709551616")
.unwrap()
.unwrap(),
Decimal::from_bytes(b"-184467440737095516160")
.unwrap()
.unwrap(),
Decimal::from_bytes(b"184467440737095516160")
.unwrap()
.unwrap(),
Decimal::from_bytes(b"-99999999999999999999999999999999")
.unwrap()
.unwrap(),
Decimal::from_bytes(b"99999999999999999999999999999999")
.unwrap()
.unwrap(),
];
let cs_ref: Vec<&Decimal> = cs.iter().collect();
test_as_duration_helper(
cs_ref,
|x| x.to_string(),
|x| x.to_string(),
cast_decimal_as_duration,
"cast_decimal_as_duration",
);
let values = vec![
Decimal::from_bytes(b"9995959").unwrap().unwrap(),
Decimal::from_bytes(b"-9995959").unwrap().unwrap(),
];
let values_ref: Vec<&Decimal> = values.iter().collect();
test_as_duration_overflow_helper(
"cast_decimal_as_duration",
values_ref,
|x| x.to_string(),
cast_decimal_as_duration,
false,
)
} | rust_cleaned_test_functions.jsonl/103277 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1399
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74429,
11898,
25454,
368,
341,
286,
1273,
31488,
6615,
15147,
8378,
31858,
1337,
559,
74429,
11898,
25454,
626,
286,
1077,
10532,
284,
7486,
90515,
310,
26728,
486,
1499,
1956,
21,
19,
486,
16413,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_inline_aliases1b() {
test(
"var x = this.foo(); this.bar(); var y; y = x; this.baz(y);",
"var x = this.foo(); this.bar(); var y; x; this.baz(x);",
);
} | rust_cleaned_test_functions.jsonl/27669 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 103
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41871,
90233,
16,
65,
368,
341,
262,
1273,
1006,
286,
330,
947,
856,
284,
419,
58432,
2129,
419,
22001,
2129,
762,
379,
26,
379,
284,
856,
26,
419,
948,
1370,
7021,
1215,
756,
286,
330,
947,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_proc_macro_libraries() {
let tmp_dir = TempDir::new().expect("Cannot create temp dir");
setup_project_with_derives(&tmp_dir.path()).expect("Cannot setup test project");
let getset_lib = compile_proc_macro(&tmp_dir.path(), "getset")
.expect("Cannot find proc macro!");
{
let expansion_task = ExpansionTask {
libs: vec![getset_lib.clone()],
macro_body: "struct S { #[set] y: i32 }".to_string(),
macro_name: "Setters".to_string(),
attributes: None,
};
let expansion_result = perform_expansion(expansion_task).expect(
"Cannot perform expansion for 'Setters'"
);
assert_matches!(
expansion_result,
ExpansionResult::Success { ref expansion }
if expansion.contains("fn set_y")
);
}
} | rust_cleaned_test_functions.jsonl/76874 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 397
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24436,
58810,
907,
72616,
368,
341,
262,
1077,
4174,
4334,
284,
19944,
6184,
486,
931,
1005,
17119,
445,
17444,
1855,
2730,
5419,
797,
262,
6505,
16352,
6615,
35345,
1886,
2099,
5173,
4334,
3875,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_set_bit() {
use consts::*;
use Same;
type T1 = <SetBitOut<U2, U0, B0> as Same<U2>>::Output;
type T2 = <SetBitOut<U2, U0, B1> as Same<U3>>::Output;
type T3 = <SetBitOut<U2, U1, B0> as Same<U0>>::Output;
type T4 = <SetBitOut<U2, U1, B1> as Same<U2>>::Output;
type T5 = <SetBitOut<U2, U2, B0> as Same<U2>>::Output;
type T6 = <SetBitOut<U2, U2, B1> as Same<U6>>::Output;
type T7 = <SetBitOut<U2, U3, B0> as Same<U2>>::Output;
type T8 = <SetBitOut<U2, U3, B1> as Same<U10>>::Output;
type T9 = <SetBitOut<U2, U4, B0> as Same<U2>>::Output;
type T10 = <SetBitOut<U2, U4, B1> as Same<U18>>::Output;
type T11 = <SetBitOut<U3, U0, B0> as Same<U2>>::Output;
<T1 as Unsigned>::to_u32();
<T2 as Unsigned>::to_u32();
<T3 as Unsigned>::to_u32();
<T4 as Unsigned>::to_u32();
<T5 as Unsigned>::to_u32();
<T6 as Unsigned>::to_u32();
<T7 as Unsigned>::to_u32();
<T8 as Unsigned>::to_u32();
<T9 as Unsigned>::to_u32();
<T10 as Unsigned>::to_u32();
<T11 as Unsigned>::to_u32();
} | rust_cleaned_test_functions.jsonl/37835 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 566
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
13996,
368,
341,
262,
990,
95432,
56162,
262,
990,
25739,
280,
262,
943,
350,
16,
284,
366,
1649,
8344,
2662,
36397,
17,
11,
547,
15,
11,
425,
15,
29,
438,
25739,
36397,
17,
77595,
5097,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_struct_variant() {
#[derive(Debug, PartialEq, Valuable, Serialize)]
enum E {
V1 {},
V2 { f: u8 },
}
assert_ser_eq!(
E::V1 {},
&[
Token::StructVariant {
name: "E",
variant: "V1",
len: 0
},
Token::StructVariantEnd
]
);
assert_ser_eq!(
E::V2 { f: 1 },
&[
Token::StructVariant {
name: "E",
variant: "V2",
len: 1
},
Token::Str("f"),
Token::U8(1),
Token::StructVariantEnd
]
);
} | rust_cleaned_test_functions.jsonl/44220 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 443
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15126,
46112,
368,
341,
262,
11506,
27098,
42618,
11,
55039,
11,
4104,
13128,
11,
39900,
5563,
262,
7618,
468,
341,
286,
647,
16,
14573,
286,
647,
17,
314,
282,
25,
575,
23,
1153,
262,
555,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_resolve_lock() {
use crate::storage::txn::RESOLVE_LOCK_BATCH_SIZE;
let storage = TestStorageBuilder::new().build().unwrap();
let (tx, rx) = channel();
storage
.async_prewrite(
Context::new(),
vec![
Mutation::Put((Key::from_raw(b"a"), b"foo".to_vec())),
Mutation::Put((Key::from_raw(b"b"), b"foo".to_vec())),
Mutation::Put((Key::from_raw(b"c"), b"foo".to_vec())),
],
b"c".to_vec(),
99,
Options::default(),
expect_ok_callback(tx.clone(), 0),
)
.unwrap();
rx.recv().unwrap();
let (lock_a, lock_b, lock_c) = (
{
let mut lock = LockInfo::new();
lock.set_primary_lock(b"c".to_vec());
lock.set_lock_version(99);
lock.set_key(b"a".to_vec());
lock
},
{
let mut lock = LockInfo::new();
lock.set_primary_lock(b"c".to_vec());
lock.set_lock_version(99);
lock.set_key(b"b".to_vec());
lock
},
{
let mut lock = LockInfo::new();
lock.set_primary_lock(b"c".to_vec());
lock.set_lock_version(99);
lock.set_key(b"c".to_vec());
lock
},
);
// We should be able to resolve all locks for transaction ts=100 when there are this
// many locks.
let scanned_locks_coll = vec![
1,
RESOLVE_LOCK_BATCH_SIZE,
RESOLVE_LOCK_BATCH_SIZE - 1,
RESOLVE_LOCK_BATCH_SIZE + 1,
RESOLVE_LOCK_BATCH_SIZE * 2,
RESOLVE_LOCK_BATCH_SIZE * 2 - 1,
RESOLVE_LOCK_BATCH_SIZE * 2 + 1,
];
let is_rollback_coll = vec![
false, // commit
true, // rollback
];
let mut ts = 100;
for scanned_locks in scanned_locks_coll {
for is_rollback in &is_rollback_coll {
let mut mutations = vec![];
for i in 0..scanned_locks {
mutations.push(Mutation::Put((
Key::from_raw(format!("x{:08}", i).as_bytes()),
b"foo".to_vec(),
)));
}
storage
.async_prewrite(
Context::new(),
mutations,
b"x".to_vec(),
ts,
Options::default(),
expect_ok_callback(tx.clone(), 0),
)
.unwrap();
rx.recv().unwrap();
let mut txn_status = HashMap::default();
txn_status.insert(
ts,
if *is_rollback {
0 // rollback
} else {
ts + 5
},
);
storage
.async_resolve_lock(
Context::new(),
txn_status,
expect_ok_callback(tx.clone(), 0),
)
.unwrap();
rx.recv().unwrap();
storage
.async_scan_locks(
Context::new(),
ts,
vec![],
0,
expect_value_callback(
tx.clone(),
0,
vec![lock_a.clone(), lock_b.clone(), lock_c.clone()],
),
)
.unwrap();
rx.recv().unwrap();
ts += 10;
}
}
} | rust_cleaned_test_functions.jsonl/38073 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2669
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77291,
9818,
368,
341,
286,
990,
17717,
486,
16172,
486,
73370,
486,
7012,
84322,
27661,
74009,
4098,
401,
286,
1077,
5819,
284,
3393,
5793,
3297,
486,
931,
1005,
5834,
1005,
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... | 5 |
#[test]
fn test_iterator_osc_hyperlinks_styled_non_ascii() {
let s = "\x1b[38;5;4m\x1b]8;;file:///Users/dan/src/delta/src/ansi/mod.rs\x1b\\src/ansi/modバー.rs\x1b]8;;\x1b\\\x1b[0m\n";
assert_eq!(&s[0..9], "\x1b[38;5;4m");
assert_eq!(
&s[9..58],
"\x1b]8;;file:///Users/dan/src/delta/src/ansi/mod.rs\x1b"
);
assert_eq!(&s[58..59], "\\");
assert_eq!(&s[59..80], "src/ansi/modバー.rs");
assert_eq!(&s[80..86], "\x1b]8;;\x1b");
assert_eq!(&s[86..87], "\\");
assert_eq!(&s[87..91], "\x1b[0m");
assert_eq!(&s[91..92], "\n");
let actual_elements: Vec<Element> = AnsiElementIterator::new(s).collect();
assert_eq!(
actual_elements,
vec![
Element::CSI(
ansi_term::Style {
foreground: Some(ansi_term::Color::Fixed(4)),
..ansi_term::Style::default()
},
0,
9
),
Element::OSC(9, 58),
Element::ESC(58, 59),
Element::Text(59, 80),
Element::OSC(80, 86),
Element::ESC(86, 87),
Element::CSI(ansi_term::Style::default(), 87, 91),
Element::Text(91, 92),
]
);
} | rust_cleaned_test_functions.jsonl/42122 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 874
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13491,
62,
23469,
93416,
15880,
1261,
7601,
21637,
50238,
368,
341,
286,
1077,
274,
284,
2917,
87,
16,
65,
58,
18,
23,
26,
20,
26,
19,
76,
3462,
16,
65,
60,
23,
6768,
1192,
60896,
7137,
3446... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mq_send_and_receive() {
const MSG_SIZE: mq_attr_member_t = 32;
let attr = MqAttr::new(0, 10, MSG_SIZE, 0);
let mq_name= &CString::new(b"/a_nix_test_queue".as_ref()).unwrap();
let oflag0 = MQ_OFlag::O_CREAT | MQ_OFlag::O_WRONLY;
let mode = Mode::S_IWUSR | Mode::S_IRUSR | Mode::S_IRGRP | Mode::S_IROTH;
let r0 = mq_open(mq_name, oflag0, mode, Some(&attr));
if let Err(Errno::ENOSYS) = r0 {
println!("message queues not supported or module not loaded?");
return;
};
let mqd0 = r0.unwrap();
let msg_to_send = "msg_1";
mq_send(mqd0, msg_to_send.as_bytes(), 1).unwrap();
let oflag1 = MQ_OFlag::O_CREAT | MQ_OFlag::O_RDONLY;
let mqd1 = mq_open(mq_name, oflag1, mode, Some(&attr)).unwrap();
let mut buf = [0u8; 32];
let mut prio = 0u32;
let len = mq_receive(mqd1, &mut buf, &mut prio).unwrap();
assert_eq!(prio, 1);
mq_close(mqd1).unwrap();
mq_close(mqd0).unwrap();
assert_eq!(msg_to_send, str::from_utf8(&buf[0..len]).unwrap());
} | rust_cleaned_test_functions.jsonl/28036 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 527
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
80,
13565,
8378,
38557,
368,
341,
262,
733,
23317,
4098,
25,
72298,
10422,
19388,
528,
284,
220,
18,
17,
280,
262,
1077,
6376,
284,
220,
386,
80,
13371,
486,
931,
7,
15,
11,
220,
16,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_in_memory_history_truncating() {
let mut h = History::new();
h.set_max_buffers_size(2);
for _ in 0..4 {
h.push(Buffer::from("a")).unwrap();
h.push(Buffer::from("b")).unwrap();
}
h.commit_to_file();
assert_eq!(h.len(), 2);
} | rust_cleaned_test_functions.jsonl/29128 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
19195,
19802,
3547,
1347,
1095,
368,
341,
262,
1077,
5206,
305,
284,
11099,
486,
931,
543,
262,
305,
980,
6345,
54591,
2368,
7,
17,
317,
262,
369,
716,
304,
220,
15,
496,
19,
341,
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... | 2 |
#[test]
fn test_rebase_descendants_basic_branch_update_with_non_local_branch() {
let settings = testutils::user_settings();
let test_repo = testutils::init_repo(&settings, false);
let repo = &test_repo.repo;
// get updated.
// B2 main
// A A
let mut tx = repo.start_transaction("test");
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
let commit_a = graph_builder.initial_commit();
let commit_b = graph_builder.commit_with_parents(&[&commit_a]);
tx.mut_repo()
.set_local_branch("main".to_string(), RefTarget::Normal(commit_b.id().clone()));
tx.mut_repo().set_remote_branch(
"main".to_string(),
"origin".to_string(),
RefTarget::Normal(commit_b.id().clone()),
);
tx.mut_repo()
.set_tag("v1".to_string(), RefTarget::Normal(commit_b.id().clone()));
let repo = tx.commit();
let mut tx = repo.start_transaction("test");
let commit_b2 = CommitBuilder::for_rewrite_from(&settings, repo.store(), &commit_b)
.write_to_repo(tx.mut_repo());
tx.mut_repo().rebase_descendants(&settings);
assert_eq!(
tx.mut_repo().get_local_branch("main"),
Some(RefTarget::Normal(commit_b2.id().clone()))
);
// The remote branch and tag should not get updated
assert_eq!(
tx.mut_repo().get_remote_branch("main", "origin"),
Some(RefTarget::Normal(commit_b.id().clone()))
);
assert_eq!(
tx.mut_repo().get_tag("v1"),
Some(RefTarget::Normal(commit_b.id().clone()))
);
// Commit B is no longer visible even though the remote branch points to it.
assert_eq!(
*tx.mut_repo().view().heads(),
hashset! {commit_b2.id().clone()}
);
} | rust_cleaned_test_functions.jsonl/130810 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 834
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
3152,
10986,
28310,
34729,
28031,
8882,
6615,
21637,
13564,
28031,
368,
341,
262,
1077,
5003,
284,
1273,
6031,
486,
872,
10853,
543,
262,
1077,
1273,
37784,
284,
1273,
6031,
486,
2327,
37784,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_der_contextspecific() {
let bytes = [0xa0, 0x03, 0x02, 0x01, 0x02];
let empty = &b""[..];
let expected = DerObject {
header: BerObjectHeader::new(BerClass::ContextSpecific, 1, BerTag(0), 3)
.with_raw_tag(Some(&[0xa0])),
content: BerObjectContent::Unknown(BerClass::ContextSpecific, BerTag(0), &bytes[2..]),
};
assert_eq!(parse_der(&bytes), Ok((empty, expected)));
} | rust_cleaned_test_functions.jsonl/45880 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 191
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35345,
8467,
51240,
368,
341,
262,
1077,
5820,
284,
508,
15,
9591,
15,
11,
220,
15,
87,
15,
18,
11,
220,
15,
87,
15,
17,
11,
220,
15,
87,
15,
16,
11,
220,
15,
87,
15,
17,
935,
262,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decrypt_handle() {
let ElGamalKeypair {
public: public_0,
secret: secret_0,
} = ElGamalKeypair::new_rand();
let ElGamalKeypair {
public: public_1,
secret: secret_1,
} = ElGamalKeypair::new_rand();
let amount: u32 = 77;
let (commitment, opening) = Pedersen::new(amount);
let handle_0 = public_0.decrypt_handle(&opening);
let handle_1 = public_1.decrypt_handle(&opening);
let ciphertext_0 = ElGamalCiphertext {
commitment,
handle: handle_0,
};
let ciphertext_1 = ElGamalCiphertext {
commitment,
handle: handle_1,
};
let expected_instance = DiscreteLog {
generator: *G,
target: Scalar::from(amount) * (*G),
};
assert_eq!(expected_instance, secret_0.decrypt(&ciphertext_0));
assert_eq!(expected_instance, secret_1.decrypt(&ciphertext_1));
} | rust_cleaned_test_functions.jsonl/36650 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 506
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
80764,
10630,
368,
341,
286,
1077,
3984,
78884,
278,
6608,
1082,
1310,
341,
310,
584,
25,
584,
62,
15,
345,
310,
6234,
25,
6234,
62,
15,
345,
286,
335,
284,
3984,
78884,
278,
6608,
1082,
1310,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_label_to_path_works() {
let tmpdir = std::env::temp_dir();
assert_eq!(
test_label_to_path(&tmpdir, "//:test", 0),
tmpdir.join("test/test.log")
);
assert_eq!(
test_label_to_path(&tmpdir, "//foo/bar", 0),
tmpdir.join("foo/bar/test.log")
);
assert_eq!(
test_label_to_path(&tmpdir, "//foo/bar", 1),
tmpdir.join("foo/bar/attempt_1.log")
);
} | rust_cleaned_test_functions.jsonl/22046 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 282
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6106,
2346,
2638,
11498,
82,
368,
341,
286,
1077,
4174,
3741,
284,
1460,
486,
3160,
486,
3888,
4334,
1428,
286,
2060,
10714,
33673,
310,
1273,
6106,
2346,
2638,
2099,
5173,
3741,
11,
35574,
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_align() {
use std::mem;
assert_eq!(128, mem::size_of::<DMat4>());
assert_eq!(8, mem::align_of::<DMat4>());
} | rust_cleaned_test_functions.jsonl/29521 | {
"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,
37015,
368,
341,
286,
990,
1460,
486,
10536,
280,
286,
2060,
10714,
10297,
16,
17,
23,
11,
1833,
486,
2141,
3575,
27638,
8395,
266,
19,
32872,
286,
2060,
10714,
10297,
23,
11,
1833,
486,
6612,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_headings() {
let addition_defs = vec![
AdditionDef::new(AdditionCode::HDT, 8, 10),
AdditionDef::new(AdditionCode::HDM, 11, 13),
];
let record = KRecord::parse_with_additions(b"K160310090299", &addition_defs).unwrap();
assert_eq!(record.heading(), Some(90));
assert_eq!(record.heading_magnetic(), Some(299));
let record = KRecord::parse_with_additions(b"K160310090???", &addition_defs).unwrap();
assert_eq!(record.heading(), Some(90));
assert_eq!(record.heading_magnetic(), None);
assert!(KRecord::parse_with_additions(b"K160310090", &addition_defs).is_err());
assert!(KRecord::parse_with_additions(b"K1603100901", &addition_defs).is_err());
} | rust_cleaned_test_functions.jsonl/117089 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 355
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13138,
819,
368,
341,
286,
1077,
5256,
56535,
284,
7486,
90515,
310,
78646,
2620,
486,
931,
7,
2212,
680,
2078,
486,
39,
10599,
11,
220,
23,
11,
220,
16,
15,
1326,
310,
78646,
2620,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tap_test_builder() {
let tap_test_from_builder = TapTestBuilder::new()
.name("Panda")
.passed(true)
.diagnostics(&vec!["Doing fine"])
.finalize();
let tap_test_from_scratch = TapTest {
name: "Panda".to_string(),
passed: true,
diagnostics: vec!["Doing fine".to_string()],
};
assert_eq!(tap_test_from_builder, tap_test_from_scratch);
} | rust_cleaned_test_functions.jsonl/74996 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 250
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
391,
4452,
28532,
368,
341,
286,
1077,
15239,
4452,
5673,
28532,
284,
36134,
2271,
3297,
486,
931,
741,
310,
659,
606,
445,
47,
9817,
1138,
310,
659,
35422,
3715,
340,
310,
659,
8579,
15550... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_busy() {
let db = checked_memory_handle();
assert!(!db.is_busy());
let mut stmt = db.prepare("PRAGMA schema_version").unwrap();
assert!(!db.is_busy());
{
let mut rows = stmt.query(NO_PARAMS).unwrap();
assert!(!db.is_busy());
let row = rows.next().unwrap();
assert!(db.is_busy());
assert!(row.is_some());
}
assert!(!db.is_busy());
} | rust_cleaned_test_functions.jsonl/25517 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 262
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
75959,
368,
341,
286,
1077,
2927,
284,
10067,
19195,
10630,
543,
286,
2060,
0,
3471,
1999,
2079,
75959,
1423,
286,
1077,
5206,
20020,
284,
2927,
21934,
445,
6480,
76168,
10802,
9438,
1827,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dropped_handoff_recovery() {
logger::setup();
// The number of validators
const N: usize = 3;
assert!(N > 1);
logger::setup();
// Create the bootstrap leader node information
let bootstrap_leader_keypair = Arc::new(Keypair::new());
let bootstrap_leader_node = Node::new_localhost_with_pubkey(bootstrap_leader_keypair.pubkey());
let bootstrap_leader_info = bootstrap_leader_node.info.clone();
// Make a common mint and a genesis entry for both leader + validator's ledgers
let num_ending_ticks = 1;
let (mint, bootstrap_leader_ledger_path, genesis_entries) = create_tmp_sample_ledger(
"test_dropped_handoff_recovery",
10_000,
num_ending_ticks,
bootstrap_leader_info.id,
500,
);
let last_id = genesis_entries
.last()
.expect("expected at least one genesis entry")
.id;
// Create the validator keypair that will be the next leader in line
let next_leader_keypair = Arc::new(Keypair::new());
// Create a common ledger with entries in the beginning that will add only
// they are the next leader after bootstrap_height
let mut ledger_paths = Vec::new();
ledger_paths.push(bootstrap_leader_ledger_path.clone());
// Make the entries to give the next_leader validator some stake so that they will be in
// leader election active set
let (active_set_entries, vote_account_keypair) =
make_active_set_entries(&next_leader_keypair, &mint.keypair(), &last_id, &last_id, 0);
// Write the entries
let mut ledger_writer = LedgerWriter::open(&bootstrap_leader_ledger_path, false).unwrap();
ledger_writer.write_entries(&active_set_entries).unwrap();
let next_leader_ledger_path = tmp_copy_ledger(
&bootstrap_leader_ledger_path,
"test_dropped_handoff_recovery",
);
ledger_paths.push(next_leader_ledger_path.clone());
// Create the common leader scheduling configuration
let initial_tick_height = genesis_entries
.iter()
.fold(0, |tick_count, entry| tick_count + entry.is_tick() as u64);
let num_slots_per_epoch = (N + 1) as u64;
let leader_rotation_interval = 5;
let seed_rotation_interval = num_slots_per_epoch * leader_rotation_interval;
let bootstrap_height = initial_tick_height + 1;
let leader_scheduler_config = LeaderSchedulerConfig::new(
Some(bootstrap_height),
Some(leader_rotation_interval),
Some(seed_rotation_interval),
Some(leader_rotation_interval),
);
// Start up the bootstrap leader fullnode
let bootstrap_leader = Fullnode::new(
bootstrap_leader_node,
&bootstrap_leader_ledger_path,
bootstrap_leader_keypair,
Arc::new(Keypair::new()),
Some(bootstrap_leader_info.ncp),
false,
LeaderScheduler::new(&leader_scheduler_config),
None,
);
let mut nodes = vec![bootstrap_leader];
// Start up the validators other than the "next_leader" validator
for _ in 0..(N - 1) {
let kp = Arc::new(Keypair::new());
let validator_ledger_path = tmp_copy_ledger(
&bootstrap_leader_ledger_path,
"test_dropped_handoff_recovery",
);
ledger_paths.push(validator_ledger_path.clone());
let validator_id = kp.pubkey();
let validator_node = Node::new_localhost_with_pubkey(validator_id);
let validator = Fullnode::new(
validator_node,
&validator_ledger_path,
kp,
Arc::new(Keypair::new()),
Some(bootstrap_leader_info.ncp),
false,
LeaderScheduler::new(&leader_scheduler_config),
None,
);
nodes.push(validator);
}
// Wait for convergence
let num_converged = converge(&bootstrap_leader_info, N).len();
assert_eq!(num_converged, N);
// Wait for leader transition
match nodes[0].handle_role_transition().unwrap() {
Some(FullnodeReturnType::LeaderToValidatorRotation) => (),
_ => panic!("Expected reason for exit to be leader rotation"),
}
// Now start up the "next leader" node
let next_leader_node = Node::new_localhost_with_pubkey(next_leader_keypair.pubkey());
let mut next_leader = Fullnode::new(
next_leader_node,
&next_leader_ledger_path,
next_leader_keypair,
Arc::new(vote_account_keypair),
Some(bootstrap_leader_info.ncp),
false,
LeaderScheduler::new(&leader_scheduler_config),
None,
);
// Wait for catchup
match next_leader.handle_role_transition().unwrap() {
Some(FullnodeReturnType::ValidatorToLeaderRotation) => (),
_ => panic!("Expected reason for exit to be leader rotation"),
}
nodes.push(next_leader);
for node in nodes {
node.close().unwrap();
}
for path in ledger_paths {
remove_dir_all(path).unwrap();
}
} | rust_cleaned_test_functions.jsonl/36560 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2061
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
41716,
23194,
1847,
91475,
368,
341,
262,
5925,
486,
15188,
543,
262,
442,
576,
1372,
315,
38588,
198,
262,
733,
451,
25,
22301,
284,
220,
18,
280,
262,
2060,
10297,
45,
861,
220,
16,
317... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.