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_replica_read_lock_check_when_not_leader() {
let cm = ConcurrencyManager::new(1.into());
let checker = ReplicaReadLockChecker::new(cm);
let mut m = eraftpb::Message::default();
m.set_msg_type(MessageType::MsgReadIndex);
let mut request = raft_cmdpb::ReadIndexRequest::default();
request.set_start_ts(100);
let rctx = ReadIndexContext {
id: Uuid::new_v4(),
request: Some(request),
locked: None,
};
let mut e = eraftpb::Entry::default();
e.set_data(rctx.to_bytes().into());
m.mut_entries().push(e);
checker.on_step(&mut m, StateRole::Follower);
assert_eq!(m.get_entries()[0].get_data(), rctx.to_bytes());
} | rust_cleaned_test_functions.jsonl/41783 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 364
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25533,
15317,
6443,
9818,
7200,
47636,
7913,
79991,
368,
341,
286,
1077,
9961,
284,
1200,
15973,
2043,
486,
931,
7,
16,
39860,
1423,
286,
1077,
40915,
284,
94036,
4418,
11989,
35188,
486,
931,
511... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_consume_flush_buffer() {
let mut writer1 = BitWriter::new(3);
let mut writer2 = BitWriter::new(3);
for i in 1..10 {
writer1.put_value(i, 4);
writer2.put_value(i, 4);
}
let res1 = writer1.flush_buffer();
let res2 = writer2.consume();
assert_eq!(res1, &res2[..]);
} | rust_cleaned_test_functions.jsonl/115739 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 196
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3382,
31323,
39213,
7776,
368,
341,
286,
1077,
5206,
6916,
16,
284,
6495,
6492,
486,
931,
7,
18,
317,
286,
1077,
5206,
6916,
17,
284,
6495,
6492,
486,
931,
7,
18,
317,
286,
369,
600,
304,
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_get_ledger_fees() {
init!("true");
let cb = return_types_u32::Return_U32_STR::new().unwrap();
assert_eq!(vcx_ledger_get_fees(cb.command_handle,
Some(cb.get_callback())),
error::SUCCESS.code_num);
} | rust_cleaned_test_functions.jsonl/19372 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 179
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
38367,
1389,
761,
5516,
368,
341,
286,
2930,
17223,
1866,
3071,
286,
1077,
9858,
284,
470,
9763,
7300,
18,
17,
486,
5598,
6665,
18,
17,
7159,
486,
931,
1005,
15454,
543,
286,
2060,
10714,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_file() {
let path = "tests/cheats/ssh.cheat";
let mut variables = VariableMap::new();
let mut child = Command::new("cat").stdin(Stdio::piped()).stdout(Stdio::null()).spawn().unwrap();
let child_stdin = child.stdin.as_mut().unwrap();
let mut visited_lines: HashSet<u64> = HashSet::new();
let mut writer: Box<dyn Writer> = Box::new(display::terminal::Writer::new());
read_file(path, &mut variables, &mut visited_lines, &mut *writer, child_stdin).unwrap();
let expected_suggestion = (
r#" echo -e "$(whoami)\nroot" "#.to_string(),
Some(FinderOpts {
header_lines: 0,
column: None,
delimiter: None,
suggestion_type: SuggestionType::SingleSelection,
..Default::default()
}),
);
let actual_suggestion = variables.get_suggestion("ssh", "user");
assert_eq!(Some(&expected_suggestion), actual_suggestion);
} | rust_cleaned_test_functions.jsonl/119169 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 479
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
2458,
368,
341,
286,
1077,
1815,
284,
330,
23841,
14,
1528,
1862,
14,
25537,
13,
1528,
266,
876,
286,
1077,
5206,
7332,
284,
12407,
2227,
486,
931,
543,
286,
1077,
5206,
1682,
284,
7348,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_request_issue_succeeds() {
run_test(|| {
let origin = USER;
let vault = VAULT;
let amount: Balance = 3;
let issue_fee = 1;
let issue_griefing_collateral = 20;
ext::vault_registry::get_active_vault_from_id::<Test>
.mock_safe(|_| MockResult::Return(Ok(init_zero_vault(VAULT))));
ext::fee::get_issue_fee::<Test>.mock_safe(move |_| MockResult::Return(Ok(wrapped(issue_fee))));
ext::fee::get_issue_griefing_collateral::<Test>
.mock_safe(move |_| MockResult::Return(Ok(griefing(issue_griefing_collateral))));
let issue_id = request_issue_ok(origin, amount, vault.clone(), issue_griefing_collateral);
let request_issue_event = TestEvent::Issue(Event::RequestIssue {
issue_id,
requester: origin,
amount: amount - issue_fee,
fee: issue_fee,
griefing_collateral: issue_griefing_collateral,
vault_id: vault,
vault_address: BtcAddress::default(),
vault_public_key: BtcPublicKey::default(),
});
assert!(System::events().iter().any(|a| a.event == request_issue_event));
})
} | rust_cleaned_test_functions.jsonl/104083 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 567
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7893,
53340,
643,
29264,
82,
368,
341,
262,
1598,
4452,
79453,
341,
286,
1077,
6238,
284,
13872,
280,
286,
1077,
34584,
284,
20901,
3532,
280,
286,
1077,
3311,
25,
30846,
284,
220,
18,
280,
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_recompute_tally() {
let ballot = |v: Vote| -> Ballot {
Ballot {
vote: v as i32,
voting_power: 10,
}
};
let mut pinfo = ProposalData {
ballots: [
(1, ballot(Vote::Yes)),
(2, ballot(Vote::Yes)),
(3, ballot(Vote::Yes)),
(4, ballot(Vote::No)),
(5, ballot(Vote::Unspecified)),
]
.to_vec()
.into_iter()
.collect(),
..Default::default()
};
pinfo.recompute_tally(10, ONE_DAY_SECONDS);
assert_eq!(
Some(Tally {
timestamp_seconds: 10,
yes: 30,
no: 10,
total: 50,
}),
pinfo.latest_tally
);
} | rust_cleaned_test_functions.jsonl/1171 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 438
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
27706,
528,
745,
368,
341,
262,
1077,
25853,
284,
760,
85,
25,
34034,
91,
1464,
12836,
354,
341,
286,
12836,
354,
341,
310,
6910,
25,
348,
438,
600,
18,
17,
345,
310,
15668,
20421,
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_window_post_partition_matching_2kib_base_8() -> Result<()> {
let sector_size = SECTOR_SIZE_2_KIB;
let sector_count = *WINDOW_POST_SECTOR_COUNT
.read()
.expect("WINDOW_POST_SECTOR_COUNT poisoned")
.get(§or_size)
.expect("unknown sector size");
partition_window_post::<SectorShape2KiB>(
sector_size,
3, // Validate the scenarios of two partition
sector_count,
false,
ApiVersion::V1_0_0,
)?;
partition_window_post::<SectorShape2KiB>(
sector_size,
3,
sector_count,
true,
ApiVersion::V1_0_0,
)?;
partition_window_post::<SectorShape2KiB>(
sector_size,
3,
sector_count,
false,
ApiVersion::V1_1_0,
)?;
partition_window_post::<SectorShape2KiB>(sector_size, 3, sector_count, true, ApiVersion::V1_1_0)
} | rust_cleaned_test_functions.jsonl/114522 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 465
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12571,
6333,
43840,
70763,
62,
17,
74,
579,
7651,
62,
23,
368,
1464,
5714,
71698,
341,
262,
1077,
10486,
2368,
284,
5052,
26275,
4098,
62,
17,
10102,
3256,
280,
262,
1077,
10486,
3180,
284,
353,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_get_account() {
let (mock_db, client, mut runtime) = create_database_client_and_runtime();
// test case 1: single call
let (first_account, blob) = mock_db.all_accounts.iter().next().unwrap();
let expected_resource = AccountState::try_from(blob).unwrap();
let mut batch = JsonRpcBatch::default();
batch.add_get_account_request(*first_account);
let result = execute_batch_and_get_first_response(&client, &mut runtime, batch);
let account = AccountView::optional_from_response(result)
.unwrap()
.expect("account does not exist");
let account_balances: Vec<_> = account.balances.iter().map(|bal| bal.amount).collect();
let expected_resource_balances: Vec<_> = expected_resource
.get_balance_resources(&[from_currency_code_string(COIN1_NAME).unwrap()])
.unwrap()
.iter()
.map(|(_, bal_resource)| bal_resource.coin())
.collect();
assert_eq!(
account.address.into_bytes().unwrap(),
first_account.to_vec()
);
assert_eq!(account_balances, expected_resource_balances);
assert_eq!(
account.sequence_number,
expected_resource
.get_account_resource()
.unwrap()
.unwrap()
.sequence_number()
);
// test case 2: batch call
let mut batch = JsonRpcBatch::default();
let mut states = vec![];
for (account, blob) in mock_db.all_accounts.iter() {
if account == first_account {
continue;
}
states.push(AccountState::try_from(blob).unwrap());
batch.add_get_account_request(*account);
}
let responses = runtime.block_on(client.execute(batch)).unwrap();
assert_eq!(responses.len(), states.len());
for (idx, response) in responses.into_iter().enumerate() {
let account = AccountView::optional_from_response(response.expect("error in response"))
.unwrap()
.expect("account does not exist");
let account_balances: Vec<_> = account.balances.iter().map(|bal| bal.amount).collect();
let expected_resource_balances: Vec<_> = states[idx]
.get_balance_resources(&[from_currency_code_string(COIN1_NAME).unwrap()])
.unwrap()
.iter()
.map(|(_, bal_resource)| bal_resource.coin())
.collect();
assert_eq!(account_balances, expected_resource_balances);
assert_eq!(
account.sequence_number,
states[idx]
.get_account_resource()
.unwrap()
.unwrap()
.sequence_number()
);
}
} | rust_cleaned_test_functions.jsonl/46605 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1163
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
13500,
368,
341,
262,
1077,
320,
16712,
8685,
11,
2943,
11,
5206,
15592,
8,
284,
1855,
27341,
8179,
8378,
33232,
1428,
262,
442,
1273,
1142,
220,
16,
25,
3175,
1618,
198,
262,
1077,
320,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_simplify_divide_by_same_non_null() {
let expr = binary_expr(col("c2_non_null"), Operator::Divide, col("c2_non_null"));
let expected = lit(1);
assert_eq!(simplify(expr), expected);
} | rust_cleaned_test_functions.jsonl/77793 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
70206,
16237,
577,
3710,
33574,
21637,
15162,
368,
341,
286,
1077,
15169,
284,
7868,
21915,
19611,
445,
66,
17,
21637,
15162,
3975,
28498,
486,
12509,
577,
11,
1375,
445,
66,
17,
21637,
15162... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_deduced_type() {
let source: &str = "auto";
let diag: RefCell<DiagContext> = RefCell::new(DiagContext::new());
let mut parser: Parser = Parser::new(
0, source, &diag
);
if let ConcreteType::DeducedType(_) = parser.parse_type(&[]).unwrap() {} else {
panic!("should be a deduced type")
}
} | rust_cleaned_test_functions.jsonl/118030 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
814,
291,
23967,
1819,
368,
341,
286,
1077,
2530,
25,
609,
495,
284,
330,
3902,
876,
286,
1077,
39717,
25,
8550,
3599,
27,
21685,
351,
1972,
29,
284,
8550,
3599,
486,
931,
5432,
72,
351... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_floor_division() {
let quotients = [["123456", "100", "1234"], ["7", "3", "2"], ["3", "6", "0"]];
for item in quotients.iter() {
assert_eq!(
FieldElement::from_dec_str(item[0])
.unwrap()
.floor_div(FieldElement::from_dec_str(item[1]).unwrap()),
FieldElement::from_dec_str(item[2]).unwrap()
);
}
} | rust_cleaned_test_functions.jsonl/128301 | {
"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,
60044,
16237,
1816,
368,
341,
286,
1077,
26370,
4075,
284,
78686,
16,
17,
18,
19,
20,
21,
497,
330,
16,
15,
15,
497,
330,
16,
17,
18,
19,
7914,
4383,
22,
497,
330,
18,
497,
330,
17,
7914,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_inline_order() {
let grammar = parser::parse_grammar(
r#"
grammar;
extern { }
#[inline] A: () = B;
B: () = C;
#[inline] C: () = A;
"#,
)
.unwrap();
let grammar = lower_helper(&Session::test(), grammar, true).unwrap();
let a = NonterminalString(Atom::from("A"));
let c = NonterminalString(Atom::from("C"));
assert_eq!(inline_order(&grammar).unwrap(), vec![a, c]);
} | rust_cleaned_test_functions.jsonl/43648 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 209
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41871,
7869,
368,
341,
1066,
262,
1077,
31428,
284,
6729,
486,
6400,
62,
41094,
1006,
286,
435,
2,
698,
262,
31428,
280,
262,
15637,
314,
456,
262,
11506,
5057,
60,
362,
25,
1719,
284,
425,
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_align_addr() {
assert_eq!(GlobalStateInner::align_addr(37, 4), 40);
assert_eq!(GlobalStateInner::align_addr(44, 4), 44);
} | rust_cleaned_test_functions.jsonl/103391 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 80
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37015,
7387,
368,
341,
286,
2060,
10714,
10297,
11646,
1397,
31597,
486,
6612,
7387,
7,
18,
22,
11,
220,
19,
701,
220,
19,
15,
317,
286,
2060,
10714,
10297,
11646,
1397,
31597,
486,
6612,
7387,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_base58_random_mutation() -> Result<(), Error> {
let kp = SampiKeyPair::new();
let data = SampiData::String("Hello, World".to_string());
let s = kp.new_sampi().build(vec![data])?;
let bytes = s.to_base58().into_bytes();
for _ in 0..100 {
for i in 0..bytes.len() {
let mut mutated_bytes = bytes.clone();
mutated_bytes[i] = rand::thread_rng().gen();
if &mutated_bytes == &bytes {
continue;
}
assert!(std::str::from_utf8(&mutated_bytes)
.map_err(|_| SampiError::ValidationError)
.and_then(|str| Sampi::from_base58(str))
.is_err());
}
}
Ok(())
} | rust_cleaned_test_functions.jsonl/67877 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 380
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7651,
20,
23,
22644,
717,
22705,
368,
1464,
5714,
68843,
4600,
29,
341,
262,
1077,
60319,
284,
90174,
72,
1592,
12443,
486,
931,
543,
262,
1077,
821,
284,
90174,
72,
1043,
486,
703,
445,
9707,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_display_debug() {
assert_eq!(format!("{}", SrtVersion::new(12, 12, 12)), "12.12.12");
assert_eq!(format!("{:?}", SrtVersion::new(12, 12, 12)), "12.12.12");
} | rust_cleaned_test_functions.jsonl/38038 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14825,
15446,
368,
341,
286,
2060,
10714,
10297,
2243,
79878,
328,
3342,
5637,
486,
931,
7,
16,
17,
11,
220,
16,
17,
11,
220,
16,
17,
5731,
330,
16,
17,
13,
16,
17,
13,
16,
17,
797,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_new_and_lost_peers() {
// Create a coordinator for a validator node
let mut validator_coordinator = test_utils::create_validator_coordinator();
// Create a public peer
let network_id = NetworkId::Public;
let peer_id = PeerId::random();
let connection_metadata = ConnectionMetadata::mock_with_role_and_origin(
peer_id,
PeerRole::Validator,
ConnectionOrigin::Inbound,
);
// Verify error is returned when adding peer that is not a valid peer
let new_peer_result =
validator_coordinator.process_new_peer(network_id, connection_metadata.clone());
assert_matches!(new_peer_result, Err(Error::InvalidStateSyncPeer(..)));
// Verify the same error is not returned when adding a validator node
let network_id = NetworkId::Validator;
assert_ok!(validator_coordinator.process_new_peer(network_id, connection_metadata));
// Verify no error is returned when removing the node
assert_ok!(validator_coordinator.process_lost_peer(network_id, peer_id));
} | rust_cleaned_test_functions.jsonl/84046 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 441
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
8378,
88661,
36367,
388,
368,
341,
286,
442,
4230,
264,
30284,
369,
264,
22935,
2436,
198,
286,
1077,
5206,
22935,
11393,
17442,
284,
1273,
17309,
486,
3182,
64959,
11393,
17442,
1428,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_match_returns_matched_segments_in_regex() {
let exp = compile_expr("match(&'foo', a.b)".to_string()).unwrap();
let r = exp.search(json!({
"a": {
"b": "food"
}
})).unwrap();
assert!(r.is_truthy());
let arr = r.as_array().unwrap();
assert!(arr.len() > 0);
assert_eq!(arr[0].as_string().unwrap(), "foo");
} | rust_cleaned_test_functions.jsonl/35843 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 233
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10708,
58900,
93900,
55735,
1243,
41832,
368,
341,
286,
1077,
1343,
284,
19192,
21915,
445,
6347,
2099,
6,
7975,
516,
264,
948,
94010,
983,
3904,
6011,
15454,
543,
286,
1077,
435,
284,
1343,
9288,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vector() {
let vector = Vector3::new(2.0, 2.0, 2.0);
let (wrapped, norm) = Unit::from_value_with_magnitude(vector);
let unit_vector = wrapped.as_ref();
assert_eq!(unit_vector.magnitude(), 1.0);
assert_eq!(vector.magnitude(), norm);
} | rust_cleaned_test_functions.jsonl/21685 | {
"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,
12247,
368,
341,
262,
1077,
4621,
284,
4196,
18,
486,
931,
7,
17,
13,
15,
11,
220,
17,
13,
15,
11,
220,
17,
13,
15,
317,
262,
1077,
320,
75704,
11,
7465,
8,
284,
7954,
486,
1499,
3142,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_to_large_literals() {
let spec = "output a: Int32 := 1111111111111111111111111110";
assert_eq!(1, num_type_errors(spec));
} | rust_cleaned_test_functions.jsonl/110729 | {
"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,
2346,
45228,
49643,
368,
341,
286,
1077,
1398,
284,
330,
3006,
264,
25,
1333,
18,
17,
1669,
220,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
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_bulk_index() -> Result<(), Error> {
let mut runtime = Runtime::new().unwrap();
let server = create_test_catalog("test_index");
let handler = BulkHandler::new(Arc::clone(&server));
let body = r#"
{"test_text": "asdf1234", "test_i64": 123, "test_u64": 321, "test_unindex": "asdf"}
{"test_text": "asdf5678", "test_i64": 456, "test_u64": 678, "test_unindex": "asdf"}
{"test_text": "asdf9012", "test_i64": -12, "test_u64": 901, "test_unindex": "asdf"}"#;
let index_docs = handler.bulk_insert(Body::from(body), "test_index".into());
let result = runtime.block_on(index_docs);
assert_eq!(result.is_ok(), true);
sleep(Duration::from_secs(1));
let search = SearchHandler::new(Arc::clone(&server));
let check_docs = search.all_docs("test_index".into()).wait().expect("");
let body = check_docs.into_body().concat2().wait()?;
let docs: SearchResults = serde_json::from_slice(&body.into_bytes())?;
Ok(assert_eq!(docs.hits, 8))
} | rust_cleaned_test_functions.jsonl/7398 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 478
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71392,
3560,
368,
1464,
5714,
68843,
4600,
29,
341,
286,
1077,
5206,
15592,
284,
10954,
486,
931,
1005,
15454,
543,
286,
1077,
3538,
284,
1855,
4452,
47310,
445,
1944,
3560,
797,
286,
1077,
7013,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_throw_statement() {
expect_printed("throw 3 + 3", "throw 3 + 3;\n");
expect_printed("throw err", "throw err;\n");
expect_printed("throw new Error()", "throw new Error();\n");
} | rust_cleaned_test_functions.jsonl/93439 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 82
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
72161,
37404,
368,
341,
262,
1720,
10064,
291,
445,
7119,
220,
18,
488,
220,
18,
497,
330,
7119,
220,
18,
488,
220,
18,
17882,
77,
797,
262,
1720,
10064,
291,
445,
7119,
1848,
497,
330,
7119,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_scalar_roundtrip() {
let mut cursor = Cursor::new(Vec::<u8>::new());
cursor
.write_scalar(
&Tag("accuracy".to_string()),
Step(777),
WallTime::new(1234.5).unwrap(),
0.875,
)
.unwrap();
cursor.set_position(0);
let events = read_all_events(cursor).unwrap();
assert_eq!(events.len(), 1);
let event = &events[0];
let expected = pb::Event {
step: 777,
wall_time: 1234.5,
what: Some(pb::event::What::Summary(pb::Summary {
value: vec![pb::summary::Value {
tag: "accuracy".to_string(),
value: Some(pb::summary::value::Value::SimpleValue(0.875)),
..Default::default()
}],
..Default::default()
})),
..Default::default()
};
assert_eq!(event, &expected);
} | rust_cleaned_test_functions.jsonl/96449 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 580
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41652,
29896,
32981,
368,
341,
286,
1077,
5206,
8128,
284,
28067,
486,
931,
49923,
27638,
84,
23,
6831,
931,
1423,
286,
8128,
198,
310,
659,
4934,
41652,
1006,
394,
609,
5668,
445,
32729,
3263,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fx0a() {
let mut test = setup_opcode(0xF70A);
test.keypad.set(0x5, true);
test.tick();
assert_eq!(test.registers[0x7], 0x5);
} | rust_cleaned_test_functions.jsonl/69465 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 106
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62691,
15,
64,
368,
341,
286,
1077,
5206,
1273,
284,
6505,
71319,
7,
15,
9770,
22,
15,
32,
317,
286,
1273,
4735,
13242,
980,
7,
15,
87,
20,
11,
830,
317,
286,
1273,
40323,
543,
286,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_cdc_stale_epoch_after_region_ready() {
let mut suite = TestSuite::new(3);
let req = suite.new_changedata_request(1);
let (mut req_tx, event_feed_wrap, receive_event) =
new_event_feed(suite.get_region_cdc_client(1));
block_on(req_tx.send((req, WriteFlags::default()))).unwrap();
// Make sure region 1 is registered.
let mut events = receive_event(false).events.to_vec();
assert_eq!(events.len(), 1);
match events.pop().unwrap().event.unwrap() {
// it should always outputs an Initialized event.
Event_oneof_event::Entries(es) => {
assert!(es.entries.len() == 1, "{:?}", es);
let e = &es.entries[0];
assert_eq!(e.get_type(), EventLogType::Initialized, "{:?}", es);
}
other => panic!("unknown event {:?}", other),
}
let mut req = suite.new_changedata_request(1);
req.set_region_epoch(Default::default()); // zero epoch is always stale.
let (mut req_tx, resp_rx) = suite.get_region_cdc_client(1).event_feed().unwrap();
let _resp_rx = event_feed_wrap.replace(Some(resp_rx));
block_on(req_tx.send((req.clone(), WriteFlags::default()))).unwrap();
// Must receive epoch not match error.
let mut events = receive_event(false).events.to_vec();
assert_eq!(events.len(), 1);
match events.pop().unwrap().event.unwrap() {
Event_oneof_event::Error(err) => {
assert!(err.has_epoch_not_match(), "{:?}", err);
}
other => panic!("unknown event {:?}", other),
}
req.set_region_epoch(suite.get_context(1).take_region_epoch());
block_on(req_tx.send((req, WriteFlags::default()))).unwrap();
// Must receive epoch not match error.
let mut events = receive_event(false).events.to_vec();
assert_eq!(events.len(), 1);
match events.pop().unwrap().event.unwrap() {
// it should always outputs an Initialized event.
Event_oneof_event::Entries(es) => {
assert!(es.entries.len() == 1, "{:?}", es);
let e = &es.entries[0];
assert_eq!(e.get_type(), EventLogType::Initialized, "{:?}", es);
}
Event_oneof_event::Error(err) => {
assert!(err.has_epoch_not_match(), "{:?}", err);
}
other => panic!("unknown event {:?}", other),
}
// Cancel event feed before finishing test.
event_feed_wrap.replace(None);
suite.stop();
} | rust_cleaned_test_functions.jsonl/13002 | {
"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,
666,
7628,
1261,
1574,
20682,
19844,
20627,
35456,
368,
341,
262,
1077,
5206,
16182,
284,
3393,
28000,
486,
931,
7,
18,
626,
262,
1077,
4232,
284,
16182,
4618,
25213,
459,
7893,
7,
16,
317,
262,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_full_node_basic_flow() {
let mut env = SmokeTestEnvironment::new(7);
env.setup_vfn_swarm();
let vfn_swarm = env.vfn_swarm();
env.add_public_fn_swarm(PUBLIC, 2, None, &vfn_swarm.lock().config);
env.validator_swarm.launch();
env.vfn_swarm().lock().launch();
env.public_swarm(PUBLIC).lock().launch();
// read state from full node client
let mut validator_client = env.get_validator_client(0, None);
let mut vfn_client = env.get_vfn_client(1, None);
let mut pfn_client = env.get_pfn_client(PUBLIC, 0, None);
// mint from full node and check both validator and full node have correct balance
let account = validator_client.create_next_account(false).unwrap().address;
vfn_client.create_next_account(false).unwrap();
pfn_client.create_next_account(false).unwrap();
let sender_account = testnet_dd_account_address();
let creation_account = treasury_compliance_account_address();
get_and_reset_sequence_number(&mut vfn_client, sender_account);
get_and_reset_sequence_number(&mut vfn_client, creation_account);
mint_coins(&mut vfn_client, 0, 10, XUS, true);
assert!(compare_balances(
vec![(10.0, XUS.to_string())],
get_balances(&mut vfn_client, 0)
));
let sequence = get_and_reset_sequence_number(&mut vfn_client, sender_account);
wait_for_transaction(&mut validator_client, sender_account, sequence - 1);
assert!(compare_balances(
vec![(10.0, XUS.to_string())],
get_balances(&mut validator_client, 0),
));
// reset sequence number for sender account
get_and_reset_sequence_number(&mut validator_client, sender_account);
get_and_reset_sequence_number(&mut vfn_client, sender_account);
get_and_reset_sequence_number(&mut validator_client, creation_account);
get_and_reset_sequence_number(&mut vfn_client, creation_account);
// mint from validator and check both nodes have correct balance
validator_client.create_next_account(false).unwrap();
vfn_client.create_next_account(false).unwrap();
pfn_client.create_next_account(false).unwrap();
mint_coins(&mut validator_client, 1, 10, XUS, true);
let sequence = get_and_reset_sequence_number(&mut validator_client, sender_account);
wait_for_transaction(&mut vfn_client, sender_account, sequence - 1);
assert!(compare_balances(
vec![(10.0, XUS.to_string())],
get_balances(&mut validator_client, 1)
));
assert!(compare_balances(
vec![(10.0, XUS.to_string())],
get_balances(&mut vfn_client, 1)
));
// minting again on validator doesn't cause error since client sequence has been updated
mint_coins(&mut validator_client, 1, 10, XUS, true);
// test transferring balance from 0 to 1 through full node proxy
transfer_coins(&mut vfn_client, 0, 1, 10, XUS, true);
assert!(compare_balances(
vec![(0.0, XUS.to_string())],
get_balances(&mut vfn_client, 0)
));
assert!(compare_balances(
vec![(30.0, XUS.to_string())],
get_balances(&mut validator_client, 1)
));
let sequence = get_and_reset_sequence_number(&mut validator_client, account);
wait_for_transaction(&mut pfn_client, account, sequence - 1);
assert!(compare_balances(
vec![(0.0, XUS.to_string())],
get_balances(&mut pfn_client, 0)
));
assert!(compare_balances(
vec![(30.0, XUS.to_string())],
get_balances(&mut pfn_client, 1)
));
} | rust_cleaned_test_functions.jsonl/131348 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1379
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16372,
5084,
34729,
27441,
368,
341,
262,
1077,
5206,
6105,
284,
53204,
2271,
12723,
486,
931,
7,
22,
317,
262,
6105,
25338,
2273,
8822,
32581,
2178,
543,
262,
1077,
348,
8822,
32581,
2178,
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_find_corners() {
assert_eq!(
find_corners(vec![
Rc::new(Tile::from_lines(vec![
"Tile 2311:".to_string(),
"..##.#..#.".to_string(),
"##..#.....".to_string(),
"#...##..#.".to_string(),
"####.#...#".to_string(),
"##.##.###.".to_string(),
"##...#.###".to_string(),
".#.#.#..##".to_string(),
"..#....#..".to_string(),
"###...#.#.".to_string(),
"..###..###".to_string(),
])),
Rc::new(Tile::from_lines(vec![
"Tile 1951:".to_string(),
"#.##...##.".to_string(),
"#.####...#".to_string(),
".....#..##".to_string(),
"#...######".to_string(),
".##.#....#".to_string(),
".###.#####".to_string(),
"###.##.##.".to_string(),
".###....#.".to_string(),
"..#.#..#.#".to_string(),
"#...##.#..".to_string(),
])),
Rc::new(Tile::from_lines(vec![
"Tile 1171:".to_string(),
"####...##.".to_string(),
"#..##.#..#".to_string(),
"##.#..#.#.".to_string(),
".###.####.".to_string(),
"..###.####".to_string(),
".##....##.".to_string(),
".#...####.".to_string(),
"#.##.####.".to_string(),
"####..#...".to_string(),
".....##...".to_string(),
])),
Rc::new(Tile::from_lines(vec![
"Tile 1427:".to_string(),
"###.##.#..".to_string(),
".#..#.##..".to_string(),
".#.##.#..#".to_string(),
"#.#.#.##.#".to_string(),
"....#...##".to_string(),
"...##..##.".to_string(),
"...#.#####".to_string(),
".#.####.#.".to_string(),
"..#..###.#".to_string(),
"..##.#..#.".to_string(),
])),
Rc::new(Tile::from_lines(vec![
"Tile 1489:".to_string(),
"##.#.#....".to_string(),
"..##...#..".to_string(),
".##..##...".to_string(),
"..#...#...".to_string(),
"#####...#.".to_string(),
"#..#.#.#.#".to_string(),
"...#.#.#..".to_string(),
"##.#...##.".to_string(),
"..##.##.##".to_string(),
"###.##.#..".to_string(),
])),
Rc::new(Tile::from_lines(vec![
"Tile 2473:".to_string(),
"#....####.".to_string(),
"#..#.##...".to_string(),
"#.##..#...".to_string(),
"######.#.#".to_string(),
".#...#.#.#".to_string(),
".#########".to_string(),
".###.#..#.".to_string(),
"########.#".to_string(),
"##...##.#.".to_string(),
"..###.#.#.".to_string(),
])),
Rc::new(Tile::from_lines(vec![
"Tile 2971:".to_string(),
"..#.#....#".to_string(),
"#...###...".to_string(),
"#.#.###...".to_string(),
"##.##..#..".to_string(),
".#####..##".to_string(),
".#..####.#".to_string(),
"#..#.#..#.".to_string(),
"..####.###".to_string(),
"..#.#.###.".to_string(),
"...#.#.#.#".to_string(),
])),
Rc::new(Tile::from_lines(vec![
"Tile 2729:".to_string(),
"...#.#.#.#".to_string(),
"####.#....".to_string(),
"..#.#.....".to_string(),
"....#..#.#".to_string(),
".##..##.#.".to_string(),
".#.####...".to_string(),
"####.#.#..".to_string(),
"##.####...".to_string(),
"##..#.##..".to_string(),
"#.##...##.".to_string(),
])),
Rc::new(Tile::from_lines(vec![
"Tile 3079:".to_string(),
"#.#.#####.".to_string(),
".#..######".to_string(),
"..#.......".to_string(),
"######....".to_string(),
"####.#..#.".to_string(),
".#...#.##.".to_string(),
"#.#####.##".to_string(),
"..#.###...".to_string(),
"..#.......".to_string(),
"..#.###...".to_string(),
]))
]),
hashset!(1951, 3079, 1171, 2971)
)
} | rust_cleaned_test_functions.jsonl/34530 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3563
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
82774,
368,
341,
286,
2060,
10714,
33673,
310,
1477,
82774,
25592,
90515,
394,
81463,
486,
931,
94391,
486,
1499,
18323,
25592,
90515,
503,
330,
15628,
220,
17,
18,
16,
16,
95740,
983,
3904... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hello() {
let client = Client::new(rocket()).unwrap();
let mut response = client.get("/").dispatch();
assert_eq!(response.status(), Status::Ok);
assert_eq!(response.body_string(), Some("Hello, world!".into()));
} | rust_cleaned_test_functions.jsonl/108768 | {
"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,
96724,
368,
341,
286,
1077,
2943,
284,
8423,
486,
931,
7,
46790,
6011,
15454,
543,
286,
1077,
5206,
2033,
284,
2943,
670,
4283,
1827,
18274,
543,
286,
2060,
10714,
10297,
2322,
4299,
1507,
8104,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_origin_from_config() {
vec![
(Some("*"), HeaderValue::from_static("*")),
(Some(" * "), HeaderValue::from_static("*")),
(None, HeaderValue::from_static("null")),
(Some(""), HeaderValue::from_static("null")),
(Some(" null "), HeaderValue::from_static("null")),
(Some("abc"), HeaderValue::from_static("abc")),
(Some(" xyz "), HeaderValue::from_static("xyz")),
]
.into_iter()
.for_each(|(origin, result)| {
let origin = origin.map(String::from);
assert_eq!(Origin::from_config(&origin).unwrap(), result);
});
let invalid = String::from_utf8(vec![127]).unwrap();
assert!(Origin::from_config(&Some(invalid)).is_err());
} | rust_cleaned_test_functions.jsonl/59754 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 386
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34043,
5673,
5332,
368,
341,
286,
7486,
90515,
310,
320,
8373,
29592,
3975,
12104,
1130,
486,
1499,
25360,
29592,
30154,
310,
320,
8373,
445,
353,
59312,
12104,
1130,
486,
1499,
25360,
29592,
30154,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_host_chmod() {
let tmpdir: tempfile::TempDir = tempfile::TempDir::new().unwrap();
let file: tempfile::NamedTempFile = create_sample_file();
let host: Localhost = Localhost::new(PathBuf::from(tmpdir.path())).ok().unwrap();
// mode_to_u32
assert_eq!(host.mode_to_u32((6, 4, 4)), 0o644);
assert_eq!(host.mode_to_u32((7, 7, 5)), 0o775);
// Chmod to file
assert!(host.chmod(file.path(), (7, 7, 5)).is_ok());
// Chmod to dir
assert!(host.chmod(tmpdir.path(), (7, 5, 0)).is_ok());
// Error
assert!(host
.chmod(Path::new("/tmp/krgiogoiegj/kwrgnoerig"), (7, 7, 7))
.is_err());
} | rust_cleaned_test_functions.jsonl/53633 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 365
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12848,
4138,
2593,
368,
341,
286,
1077,
4174,
3741,
25,
54819,
486,
12151,
6184,
284,
54819,
486,
12151,
6184,
486,
931,
1005,
15454,
543,
286,
1077,
1034,
25,
54819,
486,
15810,
12151,
1703,
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_cot() {
let tests = vec![
(Datum::F64(-1.0), -0.6420926159343308_f64),
(Datum::F64(1.0), 0.6420926159343308_f64),
(
Datum::F64(f64::consts::PI / 4.0_f64),
1.0_f64 / f64::tan(f64::consts::PI / 4.0_f64),
),
(
Datum::F64(f64::consts::PI / 2.0_f64),
1.0_f64 / f64::tan(f64::consts::PI / 2.0_f64),
),
(
Datum::F64(f64::consts::PI),
1.0_f64 / f64::tan(f64::consts::PI),
),
];
for (arg, exp) in tests {
let got = eval_func(ScalarFuncSig::Cot, &[arg]).unwrap();
assert!((got.f64() - exp).abs() < f64::EPSILON);
}
// for overflow
let tests_invalid_f64 = vec![Datum::F64(0.0)];
for arg in tests_invalid_f64 {
let got = eval_func(ScalarFuncSig::Cot, &[arg]).unwrap_err();
assert!(check_overflow(got).is_ok());
}
} | rust_cleaned_test_functions.jsonl/13185 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 652
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
354,
368,
341,
286,
1077,
7032,
284,
7486,
90515,
310,
320,
68036,
486,
37,
21,
19,
4080,
16,
13,
15,
701,
481,
15,
13,
21,
19,
17,
15,
24,
17,
21,
16,
20,
24,
18,
19,
18,
18,
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... | 3 |
#[test]
fn test_convert_u64() {
fn check(b1: BigUint, u: u64) {
let b2: BigUint = FromPrimitive::from_u64(u).unwrap();
assert!(b1 == b2);
assert!(b1.to_u64().unwrap() == u);
}
check(Zero::zero(), 0);
check(One::one(), 1);
check(u64::MIN.to_biguint().unwrap(), u64::MIN);
check(u64::MAX.to_biguint().unwrap(), u64::MAX);
check(BigUint::new(vec!( )), 0);
check(BigUint::new(vec!( 1 )), (1 << (0*big_digit::BITS)));
check(BigUint::new(vec!(N1 )), (1 << (1*big_digit::BITS)) - 1);
check(BigUint::new(vec!( 0, 1)), (1 << (1*big_digit::BITS)));
check(BigUint::new(vec!(N1, N1)), u64::MAX);
assert_eq!(BigUint::new(vec!( 0, 0, 1)).to_u64(), None);
assert_eq!(BigUint::new(vec!(N1, N1, N1)).to_u64(), None);
} | rust_cleaned_test_functions.jsonl/90122 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 483
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
7300,
21,
19,
368,
341,
286,
5168,
1779,
1883,
16,
25,
6164,
21570,
11,
575,
25,
575,
21,
19,
8,
341,
310,
1077,
293,
17,
25,
6164,
21570,
284,
5542,
33313,
486,
1499,
7300,
21,
19,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_bic_imm_w() {
assert_eq!(
decode_32(0xf02400ff),
Instruction::BIC_imm {
params: Reg2ImmCarryParams {
rd: Reg::R0,
rn: Reg::R4,
imm32: Imm32Carry::Carry {
imm32_c0: (255, false),
imm32_c1: (255, true),
},
setflags: false,
}
}
);
} | rust_cleaned_test_functions.jsonl/64846 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 298
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
880,
292,
71370,
1670,
368,
341,
14808,
262,
2060,
10714,
33673,
286,
16895,
62,
18,
17,
7,
15,
5848,
15,
17,
19,
15,
15,
542,
1326,
286,
29051,
486,
33,
1317,
71370,
341,
310,
3628,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_two_level_storage() {
let tmpdir = starcoin_config::temp_dir();
let instance = StorageInstance::new_cache_and_db_instance(
CacheStorage::new(None),
DBStorage::new(tmpdir.path(), RocksdbConfig::default(), None).unwrap(),
);
let cache_storage = instance.cache().unwrap();
let db_storage = instance.db().unwrap();
let storage = Storage::new(instance.clone()).unwrap();
let transaction_info1 = RichTransactionInfo::new(
HashValue::random(),
rand::random(),
TransactionInfo::new(
HashValue::random(),
HashValue::zero(),
vec![].as_slice(),
0,
KeptVMStatus::Executed,
),
rand::random(),
rand::random(),
);
let id = transaction_info1.id();
storage
.transaction_info_storage
.put(id, transaction_info1.clone())
.unwrap();
let transaction_info2 = storage.transaction_info_storage.get(id).unwrap();
assert!(transaction_info2.is_some());
assert_eq!(transaction_info1, transaction_info2.unwrap());
//verfiy cache storage
let value3 = cache_storage
.get(TRANSACTION_INFO_PREFIX_NAME_V2, id.to_vec())
.unwrap()
.unwrap();
let transation_info3 = RichTransactionInfo::decode_value(&value3).unwrap();
assert_eq!(transation_info3, transaction_info1);
// // verify db storage
let value4 = db_storage
.get(TRANSACTION_INFO_PREFIX_NAME_V2, id.to_vec())
.unwrap()
.unwrap();
let transaction_info4 = RichTransactionInfo::decode_value(&value4).unwrap();
assert_eq!(transaction_info4, transaction_info1);
// // test remove
storage.transaction_info_storage.remove(id).unwrap();
let transaction_info5 = storage.transaction_info_storage.get(id).unwrap();
assert_eq!(transaction_info5, None);
// verify cache storage is null
let value6 = cache_storage
.get(TRANSACTION_INFO_PREFIX_NAME_V2, id.to_vec())
.unwrap();
assert!(value6.is_none());
let value7 = db_storage
.get(TRANSACTION_INFO_PREFIX_NAME_V2, id.to_vec())
.unwrap();
assert_eq!(value7, None);
} | rust_cleaned_test_functions.jsonl/73686 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 935
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23241,
8274,
23310,
368,
341,
262,
1077,
4174,
3741,
284,
6774,
7160,
5332,
486,
3888,
4334,
543,
262,
1077,
2867,
284,
14693,
2523,
486,
931,
11529,
8378,
8685,
11904,
1006,
286,
19479,
5793,
486... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_utf_16be_decode_three_at_a_time() {
let input = b"\x00\xE4\x26\x03\xD8\x3D\xDC\xA9\x00\x61\x00\xE4";
let mut output = [0u16; 20];
let mut decoder = UTF_16BE.new_decoder();
for b in input.chunks(3) {
assert_eq!(b.len(), 3);
let needed = decoder.max_utf16_buffer_length(b.len()).unwrap();
let (result, read, _, had_errors) =
decoder.decode_to_utf16(b, &mut output[..needed], false);
assert_eq!(result, CoderResult::InputEmpty);
assert_eq!(read, b.len());
assert!(!had_errors);
}
} | rust_cleaned_test_functions.jsonl/86896 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 351
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39453,
62,
16,
21,
1371,
15227,
50016,
3752,
4306,
3009,
368,
341,
286,
1077,
1946,
284,
293,
11934,
87,
15,
15,
3462,
36,
19,
3462,
17,
21,
3462,
15,
18,
3462,
35,
23,
3462,
18,
35,
3462,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_seq_repeat() {
let gil = Python::acquire_gil();
let py = gil.python();
let v = vec!["foo", "bar"];
let seq = v.to_py_object(py).into_object().cast_into::<PySequence>(py).unwrap();
let repeat_seq = seq.repeat(py, 3).unwrap().cast_into::<PySequence>(py).unwrap();
assert_eq!(6, repeat_seq.len(py).unwrap());
let repeated = vec!["foo", "bar", "foo", "bar", "foo", "bar"];
for (el, rpt) in seq.iter(py).unwrap().zip(repeated.iter()) {
assert_eq!(*rpt, el.unwrap().extract::<String>(py).unwrap());
}
} | rust_cleaned_test_functions.jsonl/22535 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 292
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14486,
41975,
368,
341,
286,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
286,
1077,
4510,
284,
342,
321,
43193,
543,
286,
1077,
348,
284,
7486,
0,
1183,
7975,
497,
330,
2257,
63... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_puts() {
puts!(2, "hi", &[2,3,4]);
puts!(Apple { width: 4, color: Color::Blue }, Color::Red)
} | rust_cleaned_test_functions.jsonl/114370 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 74
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88574,
368,
341,
286,
9521,
10297,
17,
11,
330,
6023,
497,
44590,
17,
11,
18,
11,
19,
2558,
286,
9521,
10297,
26567,
314,
2374,
25,
220,
19,
11,
1894,
25,
3478,
486,
10331,
2470,
3478,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_recv_logout_with_high_msg_seq_num() {
define_dictionary!(Logon, Logout, ResendRequest, SequenceReset,);
//Connect and Logon.
let (mut test_server, mut client, connection) =
TestStream::setup_test_server_and_logon(build_dictionary());
//Send Logout with a high MsgSeqNum
let mut message = new_fixt_message!(Logout);
message.msg_seq_num = 15;
test_server.send_message(message);
//Make sure client tries to retrieve the missing messages.
let message = test_server.recv_message::<ResendRequest>();
assert_eq!(message.begin_seq_no, 2);
assert!(message.end_seq_no == 0 || message.end_seq_no == 14);
//Respond with gap-fill.
let mut message = new_fixt_message!(SequenceReset);
message.gap_fill_flag = true;
message.new_seq_no = 15;
message.msg_seq_num = 2;
test_server.send_message(message);
let _ = engine_poll_message!(client, connection, SequenceReset);
//Make sure client responds with Logout now that it's caught up.
let message = test_server.recv_message::<Logout>();
assert_eq!(message.msg_seq_num, 3);
//Close connection and make sure client notifies that connection closed cleanly.
let _ = test_server.stream.shutdown(Shutdown::Both);
engine_poll_event!(client,EngineEvent::ConnectionTerminated(terminated_connection,reason) => {
assert_eq!(terminated_connection,connection);
assert!(if let ConnectionTerminatedReason::RemoteRequested = reason { true } else { false });
});
} | rust_cleaned_test_functions.jsonl/17 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 552
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36118,
69386,
6615,
22680,
6483,
14486,
4273,
368,
341,
262,
6979,
42605,
10297,
2201,
263,
11,
46285,
11,
1800,
408,
1900,
11,
28871,
14828,
11,
626,
262,
442,
14611,
323,
2835,
263,
624,
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... | 3 |
#[test]
fn test_casting_explicit_types() {
let spec = "input x: Int32\noutput y: UInt32 := cast<Int32,UInt32>(x)";
assert_eq!(0, num_type_errors(spec));
} | rust_cleaned_test_functions.jsonl/110714 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 88
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5303,
287,
14214,
6026,
9763,
368,
341,
286,
1077,
1398,
284,
330,
1355,
856,
25,
1333,
18,
17,
1699,
3006,
379,
25,
22275,
18,
17,
1669,
6311,
34520,
18,
17,
11,
18777,
18,
17,
2235,
87,
24... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_find_lcs_element_moved_later() {
assert_eq!(
find_lcs(&[0, 1, 3, 4, 2, 5, 6]),
vec![(0, 0), (1, 1), (3, 2), (4, 3), (5, 5), (6, 6)]
);
} | rust_cleaned_test_functions.jsonl/89246 | {
"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,
21814,
907,
4837,
7894,
717,
4941,
907,
962,
368,
341,
286,
2060,
10714,
33673,
310,
1477,
907,
4837,
2099,
58,
15,
11,
220,
16,
11,
220,
18,
11,
220,
19,
11,
220,
17,
11,
220,
20,
11,
220... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_logic_xor_function() -> Result<()> {
let tests = vec![
ScalarFunction2Test {
name: "xor",
columns: vec![
Series::from_data(vec![true, true, false, false]),
Series::from_data(vec![true, false, true, false]),
],
expect: Series::from_data(vec![false, true, true, false]),
error: "",
},
ScalarFunction2Test {
name: "xor-null",
columns: vec![
Series::from_data(vec![None, Some(true), Some(false), Some(false)]),
Series::from_data(vec![Some(true), None, Some(true), Some(false)]),
],
expect: Series::from_data(vec![None, None, Some(true), Some(false)]),
error: "",
},
ScalarFunction2Test {
name: "xor-null",
columns: vec![
Series::from_data(vec![None, Some(true), Some(false), Some(false)]),
Arc::new(NullColumn::new(4)),
],
expect: Arc::new(NullColumn::new(4)),
error: "",
},
];
test_scalar_functions2(LogicXorFunction::try_create("or")?, &tests)
} | rust_cleaned_test_functions.jsonl/38917 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 645
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54335,
76462,
9174,
368,
1464,
5714,
71698,
341,
262,
1077,
7032,
284,
7486,
90515,
286,
35176,
5152,
17,
2271,
341,
310,
829,
25,
330,
71311,
756,
310,
8147,
25,
7486,
90515,
394,
11131,
486,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_args_from_q() {
let v = args_from("-e 'exec-target' Cargo.toml");
assert_eq!(v[0], "-e");
assert_eq!(v[1], "exec-target");
assert_eq!(v[2], "Cargo.toml");
} | rust_cleaned_test_functions.jsonl/48620 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 120
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8384,
5673,
8976,
368,
341,
286,
1077,
348,
284,
2827,
5673,
13645,
68,
364,
11748,
18489,
6,
220,
61288,
73494,
75,
797,
286,
2060,
10714,
10297,
85,
58,
15,
1125,
6523,
68,
797,
286,
2060,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_table() {
let config = Config::new(&r#"
max_memory_pool_page_num = 2
table_meta_dir = "test_file/table_meta/"
table_file_dir = "test_file/table_file""#.to_string());
let manager = TableManager::make_ref(&config);
assert_pattern!(manager.borrow().get_table("msg"), None);
let mut plan = gen_plan_helper!(
"create table msg(id int not null primary, content char(233))", &manager);
plan.open();
assert_pattern!(plan.get_next(), None);
let table = extract!(manager.borrow().get_table("msg"), Some(tab), tab);
let tab = table.borrow();
assert_eq!(tab.name, "msg");
assert_eq!(tab.attr_list.len(), 2);
} | rust_cleaned_test_functions.jsonl/67281 | {
"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,
8657,
5237,
368,
972,
262,
1077,
2193,
284,
5532,
486,
931,
2099,
81,
2,
5031,
286,
1932,
19195,
15709,
6129,
4273,
284,
220,
17,
319,
286,
1965,
13381,
4334,
284,
330,
1944,
2458,
45326,
13381,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_insert() {
let name = Name::from_str("www.example.com.").unwrap();
let record_type = RecordType::A;
let mut rr_set = RecordSet::new(&name, record_type, 0);
let insert = Record::new()
.set_name(name.clone())
.set_ttl(86400)
.set_rr_type(record_type)
.set_dns_class(DNSClass::IN)
.set_rdata(RData::A(Ipv4Addr::new(93, 184, 216, 24)))
.clone();
assert!(rr_set.insert(insert.clone(), 0));
assert_eq!(rr_set.records_without_rrsigs().count(), 1);
assert!(rr_set.records_without_rrsigs().any(|ref x| x == &&insert));
// dups ignored
assert!(!rr_set.insert(insert.clone(), 0));
assert_eq!(rr_set.records_without_rrsigs().count(), 1);
assert!(rr_set.records_without_rrsigs().any(|ref x| x == &&insert));
// add one
let insert1 = Record::new()
.set_name(name.clone())
.set_ttl(86400)
.set_rr_type(record_type)
.set_dns_class(DNSClass::IN)
.set_rdata(RData::A(Ipv4Addr::new(93, 184, 216, 25)))
.clone();
assert!(rr_set.insert(insert1.clone(), 0));
assert_eq!(rr_set.records_without_rrsigs().count(), 2);
assert!(rr_set.records_without_rrsigs().any(|ref x| x == &&insert));
assert!(rr_set.records_without_rrsigs().any(|ref x| x == &&insert1));
} | rust_cleaned_test_functions.jsonl/119977 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 743
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
368,
341,
286,
1077,
829,
284,
3988,
486,
1499,
2895,
445,
2136,
7724,
905,
98401,
15454,
543,
286,
1077,
3255,
1819,
284,
13583,
929,
486,
32,
280,
286,
1077,
5206,
34393,
2602,
284,
135... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_default_generation_no_acct() {
let dir1 = TempDir::new("test").unwrap().into_path();
let dir2 = TempDir::new("test").unwrap().into_path();
write_default_keyfiles(&dir1, 10, None, DEFAULT_SEED).unwrap();
write_default_keyfiles(&dir2, 10, None, DEFAULT_SEED).unwrap();
{
let pub1 = read_default_pubfiles(&dir1).unwrap();
let pub2 = read_default_pubfiles(&dir2).unwrap();
assert_eq!(pub1.len(), 10);
assert_eq!(pub2.len(), 10);
assert_eq!(&pub1[..], &pub2[..]);
}
{
let bin1 = read_default_root_entropies(&dir1).unwrap();
let bin2 = read_default_root_entropies(&dir2).unwrap();
assert_eq!(bin1.len(), 10);
assert_eq!(bin2.len(), 10);
assert_eq!(&bin1[..], &bin2[..]);
}
} | rust_cleaned_test_functions.jsonl/89560 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 453
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9993,
64191,
6536,
14718,
302,
368,
341,
286,
1077,
5419,
16,
284,
19944,
6184,
486,
931,
445,
1944,
1827,
15454,
1005,
18122,
2638,
543,
286,
1077,
5419,
17,
284,
19944,
6184,
486,
931,
445,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bvec2() {
assert_eq!(
Vec2::new(1.0, 2.0).greater_than(&Vec2::new(2.0, 1.0)),
bvec2(false, true),
);
assert_eq!(
Vec2::new(1.0, 2.0).lower_than(&Vec2::new(2.0, 1.0)),
bvec2(true, false),
);
assert_eq!(
Vec2::new(1.0, 2.0).equal(&Vec2::new(1.0, 3.0)),
bvec2(true, false),
);
assert_eq!(
Vec2::new(1.0, 2.0).not_equal(&Vec2::new(1.0, 3.0)),
bvec2(false, true),
);
assert!(bvec2(true, true).any());
assert!(bvec2(false, true).any());
assert!(bvec2(true, false).any());
assert!(!bvec2(false, false).any());
assert!(bvec2(false, false).none());
assert!(bvec2(true, true).all());
assert!(!bvec2(false, true).all());
assert!(!bvec2(true, false).all());
assert!(!bvec2(false, false).all());
assert_eq!(bvec2(true, false).not(), bvec2(false, true));
assert_eq!(bvec2(true, false).and(bvec2(true, true)), bvec2(true, false));
assert_eq!(bvec2(true, false).or(bvec2(true, true)), bvec2(true, true));
assert_eq!(
bvec2(true, false).select_vector(&Vec2::new(1.0, 2.0), &Vec2::new(3.0, 4.0)),
Vec2::new(1.0, 4.0),
);
} | rust_cleaned_test_functions.jsonl/58557 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 765
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
4083,
17,
368,
1476,
286,
2060,
10714,
33673,
310,
11312,
17,
486,
931,
7,
16,
13,
15,
11,
220,
17,
13,
15,
568,
65235,
51613,
2099,
10050,
17,
486,
931,
7,
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_path_has_name() {
let mut buf = PathBuf::from("/");
let files = vec!["package.json"];
assert_eq!(path_has_name(&buf, &files), false);
buf.set_file_name("some-file.js");
assert_eq!(path_has_name(&buf, &files), false);
buf.set_file_name("package.json");
assert_eq!(path_has_name(&buf, &files), true);
} | rust_cleaned_test_functions.jsonl/36952 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2638,
21778,
1269,
368,
341,
286,
1077,
5206,
6607,
284,
7933,
15064,
486,
1499,
58423,
286,
1077,
3542,
284,
7486,
0,
1183,
1722,
4323,
31797,
286,
2060,
10714,
10297,
2343,
21778,
1269,
2099,
59... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_env_assign_same_lowercase() {
let mut env = Environment::new();
let value = Value::Scalar(YololNumber::zero().into());
env.let_value("number", value.clone()).unwrap();
env.let_value("NUMBER", value.clone()).unwrap();
} | rust_cleaned_test_functions.jsonl/131947 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15879,
20688,
33574,
93129,
368,
341,
262,
1077,
5206,
6105,
284,
11586,
486,
931,
543,
262,
1077,
897,
284,
5162,
486,
20639,
20206,
337,
337,
2833,
486,
14154,
1005,
18122,
1423,
262,
6105,
13,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rans_decode_with_order_1() -> io::Result<()> {
let expected = b"noodles";
let data = vec![
0x01, 0x3b, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x64, 0x84, 0x00, 0x6e,
0x84, 0x00, 0x6f, 0x00, 0x87, 0xff, 0x00, 0x64, 0x6c, 0x8f, 0xff, 0x00, 0x65, 0x00,
0x73, 0x8f, 0xff, 0x00, 0x6c, 0x65, 0x8f, 0xff, 0x00, 0x6e, 0x6f, 0x8f, 0xff, 0x00,
0x6f, 0x00, 0x64, 0x87, 0xff, 0x6f, 0x88, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x02,
0x02, 0x28, 0x00, 0x01, 0x02, 0x28, 0x00, 0x01, 0x02, 0x60, 0x00, 0x02,
];
let mut reader = &data[..];
let actual = rans_decode(&mut reader)?;
assert_eq!(actual, expected);
Ok(())
} | rust_cleaned_test_functions.jsonl/121774 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 483
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
596,
15227,
6615,
7869,
62,
16,
368,
1464,
6399,
486,
2077,
71698,
341,
286,
1077,
3601,
284,
293,
1,
77,
97121,
3302,
286,
1077,
821,
284,
7486,
90515,
310,
220,
15,
87,
15,
16,
11,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_variants_fn_enum() {
let expected: &'static [&'static str] = &["FOO", "BAR", "BAZ"];
assert_eq!(TestEnum::variants(), expected);
let expected_empty: &'static [&'static str] = &[];
assert_eq!(TestEnumEmpty::variants(), expected_empty);
} | rust_cleaned_test_functions.jsonl/112106 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4612,
62278,
15246,
31054,
368,
341,
262,
1077,
3601,
25,
30136,
1978,
34336,
6,
1978,
607,
60,
284,
609,
1183,
3788,
46,
497,
330,
33065,
497,
330,
7064,
57,
6332,
262,
2060,
10714,
10297,
2271... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_not_empty() {
let game_state = GameState::from_file("test-inputs/hard-solved-to-5.txt").unwrap();
let expected = vec![
(
Cascade(vec![
Card { suit: Diamond, rank: 10 },
Card { suit: Heart, rank: 9 },
Card { suit: Spade, rank: 9 },
Card { suit: Diamond, rank: 6 },
]),
Card { suit: Spade, rank: 6 }
)
];
assert_eq!(game_state.cascades[3].pop_card(), expected);
} | rust_cleaned_test_functions.jsonl/21569 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 273
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7913,
15124,
368,
341,
262,
1077,
1809,
4387,
284,
47987,
486,
1499,
2458,
445,
1944,
13933,
82,
7530,
567,
1331,
8731,
4686,
12,
20,
3909,
1827,
15454,
543,
262,
1077,
3601,
284,
7486,
90515,
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_fuzz_corpus() {
// This test runs test cases which were discovered via fuzzing to crash
// the implementation.
let frag_offs = [8191, 7936, 7936, 771, 7936, 7936, 7952, 771, 7946, 7936, 1327];
let mut ctx = DummyCtx::<Ipv4>::default();
let mut cache = IpPacketFragmentCache::<Ipv4>::default();
for offset in frag_offs {
process_ipv4_fragment(&mut cache, &mut ctx, 0, offset, false, ExpectedResult::NeedMore);
}
} | rust_cleaned_test_functions.jsonl/52574 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 231
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
8889,
94226,
368,
341,
286,
442,
1096,
1273,
8473,
1273,
5048,
892,
1033,
11105,
4566,
76142,
287,
311,
9920,
198,
286,
442,
279,
8129,
382,
286,
1077,
8343,
13651,
82,
284,
508,
23,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_lmdb_resize_before_full() {
let db_env_name = "resize_dynamic";
{
let path = get_path(&db_env_name);
std::fs::create_dir(&path).unwrap_or_default();
let db_name = "test_full";
{
// Create db with 1MB capacity
let store = LMDBBuilder::new()
.set_path(&path)
.set_env_config(LMDBConfig::new(1024 * 1024, 512 * 1024, 100 * 1024))
.set_max_number_of_databases(1)
.add_database(&db_name, db::CREATE)
.build()
.unwrap();
let db = store.get_handle(&db_name).unwrap();
// Add enough data to exceed our 1MB db
let value = load_users();
// one insertion requires approx 92KB so after ~11 insertions
// our 1MB env size should be out of space
// however the db should now be allocating additional space as it fills up
for key in 0..32 {
if let Err(_e) = db.insert(&key, &value) {
panic!("Failed to resize the LMDB store.");
}
}
let env_info = store.env().info().unwrap();
let psize = store.env().stat().unwrap().psize as usize;
let page_size_total = psize * env_info.last_pgno;
let percent_left = 1.0 - page_size_total as f64 / env_info.mapsize as f64;
// check the allocated size is now greater than it was initially
assert!(page_size_total > 1024 * 1024);
assert!(percent_left > 0.0);
store.flush().unwrap();
}
}
clean_up(&db_env_name); // In Windows file handles must be released before files can be deleted
} | rust_cleaned_test_functions.jsonl/73622 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 869
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
907,
78127,
53370,
23708,
16372,
368,
341,
262,
1077,
2927,
15879,
1269,
284,
330,
17347,
45992,
876,
262,
341,
286,
1077,
1815,
284,
633,
2638,
2099,
1999,
15879,
1269,
317,
286,
1460,
486,
3848,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_group_commit() {
let l = default_logger();
let mut tests = vec![
// Single
(vec![1], vec![0], 1, 1),
(vec![1], vec![1], 1, 1),
// Odd
(vec![2, 2, 1], vec![1, 2, 1], 2, 2),
(vec![2, 2, 1], vec![1, 1, 2], 1, 2),
(vec![2, 2, 1], vec![1, 0, 1], 1, 2),
(vec![2, 2, 1], vec![0, 0, 0], 1, 2),
// Even
(vec![4, 2, 1, 3], vec![0, 0, 0, 0], 1, 2),
(vec![4, 2, 1, 3], vec![1, 0, 0, 0], 1, 2),
(vec![4, 2, 1, 3], vec![0, 1, 0, 2], 2, 2),
(vec![4, 2, 1, 3], vec![0, 2, 1, 0], 1, 2),
(vec![4, 2, 1, 3], vec![1, 1, 1, 1], 2, 2),
(vec![4, 2, 1, 3], vec![1, 1, 2, 1], 1, 2),
(vec![4, 2, 1, 3], vec![1, 2, 1, 1], 2, 2),
(vec![4, 2, 1, 3], vec![4, 3, 2, 1], 2, 2),
];
for (i, (matches, group_ids, g_w, q_w)) in tests.drain(..).enumerate() {
let store = MemStorage::new_with_conf_state((vec![1], vec![]));
let min_index = *matches.iter().min().unwrap();
let max_index = *matches.iter().max().unwrap();
let logs: Vec<_> = (min_index..=max_index).map(|i| empty_entry(1, i)).collect();
store.wl().append(&logs).unwrap();
let mut hs = HardState::default();
hs.term = 1;
store.wl().set_hardstate(hs);
let cfg = new_test_config(1, 5, 1);
let mut sm = new_test_raft_with_config(&cfg, store, &l);
let mut groups = vec![];
for (j, (m, g)) in matches.into_iter().zip(group_ids).enumerate() {
let id = j as u64 + 1;
if sm.mut_prs().get(id).is_none() {
sm.apply_conf_change(&add_node(id)).unwrap();
let pr = sm.mut_prs().get_mut(id).unwrap();
pr.matched = m;
pr.next_idx = m + 1;
}
if g != 0 {
groups.push((id, g));
}
}
sm.enable_group_commit(true);
sm.assign_commit_groups(&groups);
if sm.raft_log.committed != 0 {
panic!(
"#{}: follower group committed {}, want 0",
i, sm.raft_log.committed
);
}
sm.state = StateRole::Leader;
sm.assign_commit_groups(&groups);
if sm.raft_log.committed != g_w {
panic!(
"#{}: leader group committed {}, want {}",
i, sm.raft_log.committed, g_w
);
}
sm.enable_group_commit(false);
if sm.raft_log.committed != q_w {
panic!(
"#{}: quorum committed {}, want {}",
i, sm.raft_log.committed, q_w
);
}
}
} | rust_cleaned_test_functions.jsonl/19199 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1544
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6288,
36346,
368,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
1077,
5206,
7032,
284,
7486,
90515,
286,
442,
11327,
198,
286,
320,
4083,
20703,
16,
1125,
7486,
20703,
15,
1125,
220,
16,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
#[test]
fn test_parse_invalid_data() {
let input = "-----BEGIN DATA-----
MIIBOgIBAAJBAMIeCnn9G/7g2Z6J+qHOE2XCLLuPoh5NHTO2Fm+PbzBvafBo0oY?
QVVy7frzxmOqx6iIZBxTyfAQqBPO3Br59BMCAwEAAQJAX+PjHPuxdqiwF6blTkS0
RFI1MrnzRbCmOkM6tgVO0cd6r5Z4bDGLusH9yjI9iI84gPRjK0AzymXFmBGuREHI
sQIhAPKf4pp+Prvutgq2ayygleZChBr1DC4XnnufBNtaswyvAiEAzNGVKgNvzuhk
ijoUXIDruJQEGFGvZTsi1D2RehXiT90CIQC4HOQUYKCydB7oWi1SHDokFW2yFyo6
/+lf3fgNjPI6OQIgUPmTFXciXxT1msh3gFLf3qt2Kv8wbr9Ad9SXjULVpGkCIB+g
RzHX0lkJl9Stshd/7Gbt65/QYq+v+xvAeT0CoyIg
-----END DATA-----";
match parse(&input) {
Err(e @ PemError::InvalidData(_)) => {
assert_eq!(
&format!("{}", e.source().unwrap()),
"Invalid byte 63, offset 63."
);
}
_ => assert!(false),
}
} | rust_cleaned_test_functions.jsonl/61392 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 559
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
31433,
1769,
368,
341,
286,
1077,
1946,
284,
330,
15081,
37588,
14112,
34764,
9773,
3256,
46,
70,
3256,
6029,
46107,
66568,
68,
34,
7370,
24,
38,
14,
22,
70,
17,
57,
21,
41,
10,
80,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_unwrap_nopad_16_byte_key_16_byte_data() {
let ct = hex!("1FA68B0A8112B447AEF34BD8FB5A7B829D3E862371D2CFE5").to_vec();
let key = hex!("000102030405060708090A0B0C0D0E0F").to_vec();
let pt = aes_unwrap_with_nopadding(&ct, &key);
assert!(pt.is_ok(), "Test unexpectantly failed: {:?}", pt);
assert_eq!(pt.unwrap(), hex!("00112233445566778899AABBCCDDEEFF").to_vec());
} | rust_cleaned_test_functions.jsonl/49067 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 230
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
10097,
1089,
453,
329,
62,
16,
21,
19737,
3097,
62,
16,
21,
19737,
1769,
368,
341,
286,
1077,
20251,
284,
12371,
17223,
16,
3627,
21,
23,
33,
15,
32,
23,
16,
16,
17,
33,
19,
19,
22,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_real_f32() {
quick_test(
"SELECT CAST(1.1 AS REAL)",
"Projection: CAST(Float64(1.1) AS Float32)\
\n EmptyRelation",
);
} | rust_cleaned_test_functions.jsonl/62889 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 119
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15266,
761,
18,
17,
368,
341,
286,
3974,
4452,
1006,
310,
330,
4858,
61687,
7,
16,
13,
16,
5752,
25272,
15752,
310,
330,
46321,
25,
61687,
57178,
21,
19,
7,
16,
13,
16,
8,
5752,
13001,
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 |
#[test]
fn test_basic_loopback() {
assert!(!Address::LOOPBACK.is_unspecified());
assert!(!Address::LOOPBACK.is_multicast());
assert!(!Address::LOOPBACK.is_link_local());
assert!(Address::LOOPBACK.is_loopback());
} | rust_cleaned_test_functions.jsonl/91021 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 118
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
17198,
1419,
368,
341,
286,
2060,
0,
3471,
4286,
486,
89571,
15839,
2079,
4907,
53434,
1423,
286,
2060,
0,
3471,
4286,
486,
89571,
15839,
2079,
26290,
35446,
1423,
286,
2060,
0,
3471,
4286,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_join_lines_use_items_right_comma() {
// No space after the '}'
check_join_lines(
r"
use ra_syntax::{
<|> TextUnit, TextRange,
};",
r"
use ra_syntax::{
<|> TextUnit, TextRange};",
);
} | rust_cleaned_test_functions.jsonl/109162 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 146
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31017,
18323,
15951,
12134,
10539,
2965,
1728,
368,
341,
286,
442,
2308,
3550,
1283,
279,
40074,
1248,
286,
1779,
31017,
18323,
1006,
310,
435,
698,
810,
15122,
78894,
74843,
27,
91,
29,
262,
2918... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_inclusion() {
let (shared, chain1, _) = prepare();
let dummy_context = dummy_context(&shared);
let block_number = 7;
let uncle_number = 2;
let block = chain1[block_number]
.to_owned()
.as_advanced_builder()
.uncle(chain1[uncle_number].to_owned().as_uncle())
.build();
let epoch = epoch(&shared, &chain1, block_number - 1);
let uncle_verifier_context = UncleVerifierContext::new(&dummy_context, &epoch);
let verifier = UnclesVerifier::new(uncle_verifier_context, &block);
assert_eq!(
verifier.verify(),
Err(Error::Uncles(UnclesError::DoubleInclusion(
block.uncles().get(0).unwrap().hash().unpack()
)))
);
} | rust_cleaned_test_functions.jsonl/118900 | {
"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,
24598,
1243,
8957,
368,
341,
262,
1077,
320,
6100,
11,
8781,
16,
11,
27439,
284,
10549,
543,
262,
1077,
17292,
8467,
284,
17292,
8467,
2099,
6100,
626,
262,
1077,
2504,
5500,
284,
220,
22,
280,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_r4_type() {
let i = Instr {
bits: 0b10101010101100111011100110000000,
format: Format::R4(R4Type {}),
};
match i.format {
Format::R4(f) => {
assert_eq!(0b10101, f.rd(i.bits));
assert_eq!(0b01010, f.rs1(i.bits));
assert_eq!(0b11001, f.rs2(i.bits));
assert_eq!(0b11011, f.rs3(i.bits));
assert_eq!(0b10011, f.funct5(i.bits));
}
_ => panic!("Expecting R4Type format"),
}
} | rust_cleaned_test_functions.jsonl/60973 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 295
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
19,
1819,
368,
341,
262,
1077,
600,
284,
758,
495,
341,
286,
9472,
25,
220,
15,
65,
16,
15,
16,
15,
16,
15,
16,
15,
16,
15,
16,
16,
15,
15,
16,
16,
16,
15,
16,
16,
16,
15,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_prefix_query() {
let query = QueryRequest::new().with_query(Query::prefix("bla", "blub"));
let json = serde_json::to_string(&query).unwrap();
assert_that(&json.as_str()).is_equal_to(r#"{"query":{"prefix":{"bla":"blub"}}}"#);
let actual = serde_json::from_str::<QueryRequest>(&json).unwrap();
assert_that(&actual).is_equal_to(query);
} | rust_cleaned_test_functions.jsonl/35090 | {
"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,
13974,
5738,
368,
341,
220,
1077,
3239,
284,
11361,
1900,
486,
931,
1005,
4197,
5738,
59036,
486,
11849,
445,
64726,
497,
330,
2024,
392,
4010,
220,
1077,
2951,
284,
61570,
9455,
486,
983,
3904,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reset() {
// Set up tree with a root and additional node
let mut tree = Tree::new();
let root_node = Node::new("root", "The root node.");
tree.nodes.insert("root".to_owned(), root_node);
tree.set_root_key("root").unwrap();
tree.reset();
// Test reset
assert_eq!(0, tree.nodes.len());
assert!(tree.root_node().is_none());
assert!(tree.current_node().is_none());
} | rust_cleaned_test_functions.jsonl/110240 | {
"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,
18983,
368,
341,
262,
442,
2573,
705,
4916,
448,
264,
3704,
323,
5107,
2436,
198,
262,
1077,
5206,
4916,
284,
8942,
486,
931,
543,
262,
1077,
3704,
5084,
284,
6018,
486,
931,
445,
2888,
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_unrecognized() {
let cmd = 249.into(); // not an actual relay command.
// Hand-generated and arbitrary: we don't parse these.
msg(
cmd,
"617262697472617279206279746573",
&msg::Unrecognized::new(cmd, &b"arbitrary bytes"[..]).into(),
);
} | rust_cleaned_test_functions.jsonl/66352 | {
"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,
4907,
46067,
368,
341,
262,
1077,
5439,
284,
220,
17,
19,
24,
39860,
2129,
442,
537,
458,
5042,
31851,
3210,
382,
262,
442,
8536,
16185,
323,
24168,
25,
582,
1513,
944,
4715,
1493,
624,
262,
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_iterator_clone() {
let mut n = ImmutSList::new();
n = n.append(1).append(2).append(3);
let mut it = n.iter();
it.next();
let mut jt = it.clone();
assert_eq!(it.next(), jt.next());
assert_eq!(it.next(), jt.next());
} | rust_cleaned_test_functions.jsonl/64463 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13491,
54742,
368,
341,
286,
1077,
5206,
308,
284,
2362,
6984,
50,
852,
486,
931,
543,
286,
308,
284,
308,
2057,
7,
16,
568,
5090,
7,
17,
568,
5090,
7,
18,
317,
286,
1077,
5206,
432,
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_query_row_and_then_custom_error() {
let db = checked_memory_handle();
let sql = "BEGIN;
CREATE TABLE foo(x INTEGER, y TEXT);
INSERT INTO foo VALUES(4, \"hello\");
END;";
db.execute_batch(sql).unwrap();
let query = "SELECT x, y FROM foo ORDER BY x DESC";
let results: CustomResult<String> = db.query_row_and_then(query, NO_PARAMS, |row| {
row.get(1).map_err(CustomError::Sqlite)
});
assert_eq!(results.unwrap(), "hello");
} | rust_cleaned_test_functions.jsonl/25529 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 338
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5738,
8530,
8378,
68367,
15875,
4096,
368,
341,
310,
1077,
2927,
284,
10067,
19195,
10630,
543,
310,
1077,
5704,
284,
330,
37588,
280,
5180,
30776,
14363,
15229,
2075,
30381,
11,
379,
15762,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_txn_store_commit_illegal_tso() {
let store = AssertionStorage::default();
let commit_ts = 4;
let spacelike_ts = 5;
store.prewrite_ok(
vec![
Mutation::Put((Key::from_raw(b"primary"), b"p-5".to_vec())),
Mutation::Put((Key::from_raw(b"secondary"), b"s-5".to_vec())),
],
b"primary",
spacelike_ts,
);
store.commit_with_illegal_tso(vec![b"primary"], spacelike_ts, commit_ts);
} | rust_cleaned_test_functions.jsonl/120729 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 238
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
92299,
14809,
36346,
26743,
6428,
528,
704,
368,
341,
262,
1077,
3553,
284,
46730,
5793,
486,
2258,
543,
262,
1077,
5266,
25023,
284,
220,
19,
280,
262,
1077,
99008,
301,
2970,
25023,
284,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_final_state() {
let config = RegExpConfig::new();
let dfa = DFA::from(
vec![GraphemeCluster::from("abcd", &RegExpConfig::new())],
&config,
);
let intermediate_state = State::new(3);
assert_eq!(dfa.is_final_state(intermediate_state), false);
let final_state = State::new(4);
assert_eq!(dfa.is_final_state(final_state), true);
} | rust_cleaned_test_functions.jsonl/29702 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 214
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
20676,
4387,
368,
341,
286,
1077,
2193,
284,
28487,
2648,
486,
931,
543,
286,
1077,
294,
3632,
284,
93631,
486,
1499,
1006,
310,
7486,
20703,
11212,
3894,
28678,
486,
1499,
445,
68644,
497,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bytes_deserialize() {
let bytes0: Result<Bytes, serde_json::Error> = serde_json::from_str(r#""∀∂""#);
let bytes1: Result<Bytes, serde_json::Error> = serde_json::from_str(r#""""#);
let bytes2: Result<Bytes, serde_json::Error> = serde_json::from_str(r#""0x123""#);
let bytes3: Result<Bytes, serde_json::Error> = serde_json::from_str(r#""0xgg""#);
let bytes4: Bytes = serde_json::from_str(r#""0x""#).unwrap();
let bytes5: Bytes = serde_json::from_str(r#""0x12""#).unwrap();
let bytes6: Bytes = serde_json::from_str(r#""0x0123""#).unwrap();
assert!(bytes0.is_err());
assert!(bytes1.is_err());
assert!(bytes2.is_err());
assert!(bytes3.is_err());
assert_eq!(bytes4, Bytes(vec![]));
assert_eq!(bytes5, Bytes(vec![0x12]));
assert_eq!(bytes6, Bytes(vec![0x1, 0x23]));
} | rust_cleaned_test_functions.jsonl/4802 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 382
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12524,
15768,
9050,
368,
341,
197,
10217,
5820,
15,
25,
5714,
27,
7078,
11,
61570,
9455,
486,
1454,
29,
284,
61570,
9455,
486,
1499,
2895,
2601,
2,
3014,
144192,
145371,
3014,
2,
317,
197,
10217... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_unreal_context() {
let raw_context = br##"<?xml version="1.0" encoding="UTF-8"?>
<FGenericCrashContext>
<RuntimeProperties>
<UserName>bruno</UserName>
<MemoryStats.TotalPhysical>6896832512</MemoryStats.TotalPhysical>
<Misc.OSVersionMajor>Windows 10</Misc.OSVersionMajor>
<Misc.OSVersionMinor />
<Misc.PrimaryGPUBrand>Parallels Display Adapter (WDDM)</Misc.PrimaryGPUBrand>
<ErrorMessage>Access violation - code c0000005 (first/second chance not available)</ErrorMessage>
<CrashVersion>3</CrashVersion>
<Misc.Is64bitOperatingSystem>1</Misc.Is64bitOperatingSystem>
<Misc.CPUVendor>GenuineIntel</Misc.CPUVendor>
<Misc.CPUBrand>Intel(R) Core(TM) i7-7920HQ CPU @ 3.10GHz</Misc.CPUBrand>
<GameStateName />
<MemoryStats.TotalVirtual>140737488224256</MemoryStats.TotalVirtual>
<PlatformFullName>Win64 [Windows 10 64b]</PlatformFullName>
<CrashReportClientVersion>1.0</CrashReportClientVersion>
<Modules>\\Mac\Home\Desktop\WindowsNoEditor\YetAnother\Binaries\Win64\YetAnother.exe
\\Mac\Home\Desktop\WindowsNoEditor\Engine\Binaries\ThirdParty\PhysX3\Win64\VS2015\PxFoundationPROFILE_x64.dll</Modules>
</RuntimeProperties>
<PlatformProperties>
<PlatformIsRunningWindows>1</PlatformIsRunningWindows>
<PlatformCallbackResult>0</PlatformCallbackResult>
</PlatformProperties>
</FGenericCrashContext>
"##;
let context = Unreal4Context::parse(raw_context).unwrap();
let mut event = Event::default();
merge_unreal_context(&mut event, context);
let user_name = event.user.value().unwrap().username.value().unwrap();
assert_eq!(&**user_name, "bruno");
let contexts = event.contexts.value().unwrap();
let device_context = get_context!(contexts, DeviceContext::default_key(), Context::Device);
let mem_size = device_context.memory_size.value().unwrap();
assert_eq!(*mem_size, 6_896_832_512);
let os_context = get_context!(contexts, OsContext::default_key(), Context::Os);
let os_name = os_context.name.value().unwrap();
assert_eq!(&**os_name, "Windows 10");
let gpu_context = get_context!(contexts, GpuContext::default_key(), Context::Gpu);
let gpu_name = gpu_context
.get("name")
.unwrap()
.value()
.unwrap()
.as_str()
.unwrap();
assert_eq!(gpu_name, "Parallels Display Adapter (WDDM)");
let unreal_context = get_context!(contexts, "unreal", Context::Other);
let mem_stats_total_virtual = unreal_context
.get("memory_stats_total_virtual")
.unwrap()
.value()
.unwrap();
assert_eq!(&Value::I64(140_737_488_224_256), mem_stats_total_virtual);
let cpu_brand = unreal_context
.get("misc_cpu_brand")
.unwrap()
.value()
.unwrap();
assert_eq!(
"Intel(R) Core(TM) i7-7920HQ CPU @ 3.10GHz",
cpu_brand.as_str().unwrap()
);
let cpu_brand = unreal_context
.get("misc_cpu_brand")
.unwrap()
.value()
.unwrap();
assert_eq!(
"Intel(R) Core(TM) i7-7920HQ CPU @ 3.10GHz",
cpu_brand.as_str().unwrap()
);
let cpu_vendor = unreal_context
.get("misc_cpu_vendor")
.unwrap()
.value()
.unwrap();
assert_eq!("GenuineIntel", cpu_vendor.as_str().unwrap());
} | rust_cleaned_test_functions.jsonl/107424 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1571
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20888,
4907,
7951,
8467,
368,
341,
286,
1077,
7112,
8467,
284,
1411,
565,
60347,
6455,
2319,
428,
16,
13,
15,
1,
11170,
428,
8561,
12,
23,
85990,
27,
12001,
3469,
16001,
988,
1972,
397,
197,
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_result_size() {
let selector = StochasticSelector::new(20);
let population: Vec<Test> = (0..100).map(|i| Test { f: i }).collect();
assert_eq!(20, selector.select(&population).unwrap().len() * 2);
} | rust_cleaned_test_functions.jsonl/133832 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5287,
2368,
368,
341,
286,
1077,
9367,
284,
794,
65954,
5877,
486,
931,
7,
17,
15,
317,
286,
1077,
7042,
25,
11312,
71273,
29,
284,
320,
15,
496,
16,
15,
15,
568,
2186,
22428,
72,
91,
3393,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_push() {
macro_rules! t(
(s: $path:expr, $join:expr) => (
{
let path = $path;
let join = $join;
let mut p1 = Path::new(path);
let p2 = p1.clone();
p1.push(join);
assert!(p1 == p2.join(join));
}
)
)
t!(s: "a/b/c", "..");
t!(s: "/a/b/c", "d");
t!(s: "a/b", "c/d");
t!(s: "a/b", "/c/d");
} | rust_cleaned_test_functions.jsonl/7682 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 383
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14218,
368,
341,
286,
18072,
21407,
0,
259,
1006,
310,
320,
82,
25,
400,
2343,
96011,
11,
400,
5987,
96011,
8,
589,
2399,
394,
341,
503,
1077,
1815,
284,
400,
2343,
280,
503,
1077,
5138,
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_to_json() {
let d0 = Dynamic::from("tomcat".to_owned());
assert_eq!(
Json::String("tomcat".to_owned()),
from_dynamic::<Json>(&d0).unwrap()
);
} | rust_cleaned_test_functions.jsonl/111682 | {
"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,
2346,
9455,
368,
341,
286,
1077,
294,
15,
284,
21886,
486,
1499,
445,
37401,
4616,
3263,
983,
51973,
5231,
286,
2060,
10714,
33673,
310,
8308,
486,
703,
445,
37401,
4616,
3263,
983,
51973,
14702,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_expect_something_present() {
let ctx = TestContext::new();
let cmx_path = ctx.new_include(
"some.cmx",
json!({
"include": [ "foo.cmx", "bar.cmx" ],
"program": {
"binary": "bin/hello_world"
}
}),
);
let foo_path = ctx.new_include("foo.cmx", json!({}));
let bar_path = ctx.new_include("bar.cmx", json!({}));
assert_matches!(ctx.check_includes(&cmx_path, vec!["bar.cmx".into()]), Ok(()));
ctx.assert_depfile_eq(&ctx.stamp, &[&bar_path, &foo_path]);
} | rust_cleaned_test_functions.jsonl/50696 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 374
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68918,
643,
11532,
36976,
368,
341,
286,
1077,
5635,
284,
3393,
1972,
486,
931,
543,
286,
1077,
9961,
87,
2638,
284,
5635,
4618,
37878,
1006,
310,
330,
14689,
520,
18085,
756,
310,
2951,
0,
2262... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_module_with_deprecated_name() {
#[pymodule(custom_name)]
fn my_module(_py: Python, _m: &PyModule) -> PyResult<()> {
Ok(())
}
Python::with_gil(|py| {
let m = pyo3::wrap_pymodule!(custom_name)(py);
py_assert!(py, m, "m.__name__ == 'custom_name'");
})
} | rust_cleaned_test_functions.jsonl/22692 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 158
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10750,
6615,
2259,
19889,
1269,
368,
341,
262,
11506,
79,
1600,
1756,
61301,
1269,
5563,
262,
5168,
847,
10750,
2490,
3288,
25,
13027,
11,
716,
76,
25,
609,
13828,
3332,
8,
1464,
5355,
2077,
716... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_node_failed_merge_before_succeed_merge() {
let mut cluster = new_node_cluster(0, 3);
configure_for_merge(&mut cluster);
cluster.cfg.raft_store.merge_max_log_gap = 30;
cluster.cfg.raft_store.store_batch_system.max_batch_size = 1;
cluster.cfg.raft_store.store_batch_system.pool_size = 2;
let pd_client = Arc::clone(&cluster.pd_client);
pd_client.disable_default_operator();
cluster.run();
for i in 0..10 {
cluster.must_put(format!("k{}", i).as_bytes(), b"v1");
}
let region = pd_client.get_region(b"k1").unwrap();
cluster.must_split(®ion, b"k5");
let left = pd_client.get_region(b"k1").unwrap();
let mut right = pd_client.get_region(b"k5").unwrap();
let left_peer_1 = find_peer(&left, 1).cloned().unwrap();
cluster.must_transfer_leader(left.get_id(), left_peer_1);
let left_peer_3 = find_peer(&left, 3).cloned().unwrap();
assert_eq!(left_peer_3.get_id(), 1003);
// Prevent sched_merge_tick to propose CommitMerge
let schedule_merge_fp = "on_schedule_merge";
fail::cfg(schedule_merge_fp, "return()").unwrap();
// To minimize peers log gap for merging
cluster.must_put(b"k11", b"v2");
must_get_equal(&cluster.get_engine(2), b"k11", b"v2");
must_get_equal(&cluster.get_engine(3), b"k11", b"v2");
// Make peer 1003 can't receive PrepareMerge and RollbackMerge log
cluster.add_send_filter(IsolationFilterFactory::new(3));
cluster.try_merge(left.get_id(), right.get_id());
// Change right region's epoch to make this merge failed
cluster.must_split(&right, b"k8");
fail::remove(schedule_merge_fp);
// Wait for left region to rollback merge
cluster.must_put(b"k12", b"v2");
// Prevent the `PrepareMerge` and `RollbackMerge` log sending to apply fsm after
let before_send_rollback_merge_1003_fp = "before_send_rollback_merge_1003";
fail::cfg(before_send_rollback_merge_1003_fp, "return").unwrap();
cluster.clear_send_filters();
right = pd_client.get_region(b"k5").unwrap();
let right_peer_1 = find_peer(&right, 1).cloned().unwrap();
cluster.must_transfer_leader(right.get_id(), right_peer_1);
// Add some data for checking data integrity check at a later time
for i in 0..5 {
cluster.must_put(format!("k2{}", i).as_bytes(), b"v3");
}
// Do a really succeed merge
pd_client.must_merge(left.get_id(), right.get_id());
// Wait right region to send CatchUpLogs to left region.
sleep_ms(100);
// to apply fsm in the end of this batch. So even the first `on_ready_prepare_merge`
// if CatchUpLogs and `on_ready_prepare_merge` is in different batch.
// first `on_ready_prepare_merge` is sent after all committed log.
// Sleep a while to wait apply fsm to send `on_ready_prepare_merge` to peer fsm.
let after_send_to_apply_1003_fp = "after_send_to_apply_1003";
fail::cfg(after_send_to_apply_1003_fp, "sleep(300)").unwrap();
fail::remove(before_send_rollback_merge_1003_fp);
// Wait `after_send_to_apply_1003` timeout
sleep_ms(300);
fail::remove(after_send_to_apply_1003_fp);
// Check the data integrity
for i in 0..5 {
must_get_equal(&cluster.get_engine(3), format!("k2{}", i).as_bytes(), b"v3");
}
} | rust_cleaned_test_functions.jsonl/10786 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1362
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5084,
35060,
20888,
23708,
643,
29264,
20888,
368,
341,
262,
1077,
5206,
10652,
284,
501,
5084,
28441,
7,
15,
11,
220,
18,
317,
262,
14411,
5478,
20888,
2099,
6984,
10652,
317,
262,
10652,
30481,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_mempool_transactions_queue() {
let mut transactions_queue = MempoolTransactionsQueue {
ready_txs: VecDeque::new(),
pending_txs: BinaryHeap::new(),
};
let withdraw0 = get_withdraw();
let transfer1 = get_transfer_with_timestamps(5, 13);
let transfer2 = get_transfer_with_timestamps(10, 15);
// Insert transactions to the mempool transcations queue
{
transactions_queue.add_tx_variant(withdraw0.clone());
assert_eq!(transactions_queue.pending_txs.peek().unwrap().valid_from, 0);
// Some "random" order for trancsactions
transactions_queue.add_tx_variant(transfer2.clone());
transactions_queue.add_tx_variant(transfer1.clone());
}
// At first we should have only one transaction ready
{
transactions_queue.prepare_new_ready_transactions(3);
assert_eq!(transactions_queue.ready_txs.len(), 1);
assert_eq!(transactions_queue.ready_txs[0].hashes(), withdraw0.hashes());
}
// One more transaction is ready
{
transactions_queue.prepare_new_ready_transactions(9);
assert_eq!(transactions_queue.ready_txs.len(), 2);
assert_eq!(transactions_queue.ready_txs[1].hashes(), transfer1.hashes());
}
// The last one is ready
{
transactions_queue.prepare_new_ready_transactions(10);
assert_eq!(transactions_queue.ready_txs.len(), 3);
assert_eq!(transactions_queue.ready_txs[2].hashes(), transfer2.hashes());
}
} | rust_cleaned_test_functions.jsonl/75784 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 747
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
3262,
1749,
68182,
10841,
368,
341,
286,
1077,
5206,
14131,
10841,
284,
386,
3262,
1749,
48761,
7554,
341,
310,
5527,
17805,
82,
25,
11312,
73891,
486,
931,
3148,
310,
15280,
17805,
82,
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_offset_str() {
let s = "abcřèÂßÇd123";
let a = &s[..];
let b = &a[7..];
let c = &a[..5];
let d = &a[5..9];
assert_eq!(a.offset(b), 7);
assert_eq!(a.offset(c), 0);
assert_eq!(a.offset(d), 5);
} | rust_cleaned_test_functions.jsonl/30006 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6917,
2895,
368,
341,
262,
1077,
274,
284,
330,
13683,
28332,
4458,
32795,
7997,
45913,
67,
16,
17,
18,
876,
262,
1077,
264,
284,
609,
82,
95874,
935,
262,
1077,
293,
284,
609,
64,
58,
22,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_ipv4() {
let cases = vec![
("127.0.0.1", 1i64),
("127.0.0.256", 0i64),
];
let mut ctx = EvalContext::default();
for (input_str, expected) in cases {
let input = datum_expr(Datum::Bytes(input_str.as_bytes().to_vec()));
let op = scalar_func_expr(ScalarFuncSig::IsIPv4, &[input]);
let op = Expression::build(&mut ctx, op).unwrap();
let got = op.eval(&mut ctx, &[]).unwrap();
let exp = Datum::from(expected);
assert_eq!(got, exp);
}
} | rust_cleaned_test_functions.jsonl/75114 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 335
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
49378,
19,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
3374,
310,
3489,
16,
17,
22,
13,
15,
13,
15,
13,
16,
497,
220,
16,
72,
21,
19,
1326,
310,
3489,
16,
17,
22,
13,
15,
13,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_scan_lock() {
let storage = TestStorageBuilder::new(DummyLockManager {}, false)
.build()
.unwrap();
let (tx, rx) = channel();
storage
.sched_txn_command(
commands::Prewrite::with_defaults(
vec![
Mutation::Put((Key::from_raw(b"x"), b"foo".to_vec())),
Mutation::Put((Key::from_raw(b"y"), b"foo".to_vec())),
Mutation::Put((Key::from_raw(b"z"), b"foo".to_vec())),
],
b"x".to_vec(),
100.into(),
),
expect_ok_callback(tx.clone(), 0),
)
.unwrap();
rx.recv().unwrap();
storage
.sched_txn_command(
commands::Prewrite::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(),
101.into(),
123,
false,
3,
TimeStamp::default(),
TimeStamp::default(),
None,
false,
Context::default(),
),
expect_ok_callback(tx, 0),
)
.unwrap();
rx.recv().unwrap();
let (lock_a, lock_b, lock_c, lock_x, lock_y, lock_z) = (
{
let mut lock = LockInfo::default();
lock.set_primary_lock(b"c".to_vec());
lock.set_lock_version(101);
lock.set_key(b"a".to_vec());
lock.set_lock_ttl(123);
lock.set_txn_size(3);
lock
},
{
let mut lock = LockInfo::default();
lock.set_primary_lock(b"c".to_vec());
lock.set_lock_version(101);
lock.set_key(b"b".to_vec());
lock.set_lock_ttl(123);
lock.set_txn_size(3);
lock
},
{
let mut lock = LockInfo::default();
lock.set_primary_lock(b"c".to_vec());
lock.set_lock_version(101);
lock.set_key(b"c".to_vec());
lock.set_lock_ttl(123);
lock.set_txn_size(3);
lock
},
{
let mut lock = LockInfo::default();
lock.set_primary_lock(b"x".to_vec());
lock.set_lock_version(100);
lock.set_key(b"x".to_vec());
lock
},
{
let mut lock = LockInfo::default();
lock.set_primary_lock(b"x".to_vec());
lock.set_lock_version(100);
lock.set_key(b"y".to_vec());
lock
},
{
let mut lock = LockInfo::default();
lock.set_primary_lock(b"x".to_vec());
lock.set_lock_version(100);
lock.set_key(b"z".to_vec());
lock
},
);
let cm = storage.concurrency_manager.clone();
let res =
block_on(storage.scan_lock(Context::default(), 99.into(), None, None, 10)).unwrap();
assert_eq!(res, vec![]);
assert_eq!(cm.max_ts(), 99.into());
let res =
block_on(storage.scan_lock(Context::default(), 100.into(), None, None, 10)).unwrap();
assert_eq!(res, vec![lock_x.clone(), lock_y.clone(), lock_z.clone()]);
assert_eq!(cm.max_ts(), 100.into());
let res = block_on(storage.scan_lock(
Context::default(),
100.into(),
Some(Key::from_raw(b"a")),
None,
10,
))
.unwrap();
assert_eq!(res, vec![lock_x.clone(), lock_y.clone(), lock_z.clone()]);
let res = block_on(storage.scan_lock(
Context::default(),
100.into(),
Some(Key::from_raw(b"y")),
None,
10,
))
.unwrap();
assert_eq!(res, vec![lock_y.clone(), lock_z.clone()]);
let res =
block_on(storage.scan_lock(Context::default(), 101.into(), None, None, 10)).unwrap();
assert_eq!(
res,
vec![
lock_a.clone(),
lock_b.clone(),
lock_c.clone(),
lock_x.clone(),
lock_y.clone(),
lock_z.clone(),
]
);
assert_eq!(cm.max_ts(), 101.into());
let res =
block_on(storage.scan_lock(Context::default(), 101.into(), None, None, 4)).unwrap();
assert_eq!(
res,
vec![lock_a, lock_b.clone(), lock_c.clone(), lock_x.clone()]
);
let res = block_on(storage.scan_lock(
Context::default(),
101.into(),
Some(Key::from_raw(b"b")),
None,
4,
))
.unwrap();
assert_eq!(
res,
vec![
lock_b.clone(),
lock_c.clone(),
lock_x.clone(),
lock_y.clone(),
]
);
let res = block_on(storage.scan_lock(
Context::default(),
101.into(),
Some(Key::from_raw(b"b")),
None,
0,
))
.unwrap();
assert_eq!(
res,
vec![
lock_b.clone(),
lock_c.clone(),
lock_x.clone(),
lock_y.clone(),
lock_z
]
);
let res = block_on(storage.scan_lock(
Context::default(),
101.into(),
Some(Key::from_raw(b"b")),
Some(Key::from_raw(b"c")),
0,
))
.unwrap();
assert_eq!(res, vec![lock_b.clone()]);
let res = block_on(storage.scan_lock(
Context::default(),
101.into(),
Some(Key::from_raw(b"b")),
Some(Key::from_raw(b"z")),
4,
))
.unwrap();
assert_eq!(
res,
vec![
lock_b.clone(),
lock_c.clone(),
lock_x.clone(),
lock_y.clone()
]
);
let res = block_on(storage.scan_lock(
Context::default(),
101.into(),
Some(Key::from_raw(b"b")),
Some(Key::from_raw(b"z")),
3,
))
.unwrap();
assert_eq!(res, vec![lock_b.clone(), lock_c.clone(), lock_x.clone()]);
let mem_lock = |k: &[u8], ts: u64, lock_type| {
let key = Key::from_raw(k);
let guard = block_on(cm.lock_key(&key));
guard.with_lock(|lock| {
*lock = Some(txn_types::Lock::new(
lock_type,
k.to_vec(),
ts.into(),
100,
None,
0.into(),
1,
20.into(),
));
});
guard
};
let guard = mem_lock(b"z", 80, LockType::Put);
block_on(storage.scan_lock(Context::default(), 101.into(), None, None, 1)).unwrap_err();
let guard2 = mem_lock(b"a", 80, LockType::Put);
let res = block_on(storage.scan_lock(
Context::default(),
101.into(),
Some(Key::from_raw(b"b")),
Some(Key::from_raw(b"z")),
0,
))
.unwrap();
assert_eq!(
res,
vec![
lock_b.clone(),
lock_c.clone(),
lock_x.clone(),
lock_y.clone()
]
);
drop(guard);
drop(guard2);
// LockType::Lock can't be ignored by scan_lock
let guard = mem_lock(b"c", 80, LockType::Lock);
block_on(storage.scan_lock(
Context::default(),
101.into(),
Some(Key::from_raw(b"b")),
Some(Key::from_raw(b"z")),
1,
))
.unwrap_err();
drop(guard);
let guard = mem_lock(b"c", 102, LockType::Put);
let res = block_on(storage.scan_lock(
Context::default(),
101.into(),
Some(Key::from_raw(b"b")),
Some(Key::from_raw(b"z")),
0,
))
.unwrap();
assert_eq!(res, vec![lock_b, lock_c, lock_x, lock_y]);
drop(guard);
} | rust_cleaned_test_functions.jsonl/2098 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 5524
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28857,
9818,
368,
341,
286,
1077,
5819,
284,
3393,
5793,
3297,
486,
931,
5432,
8574,
11989,
2043,
16452,
895,
340,
310,
659,
5834,
741,
310,
659,
15454,
543,
286,
1077,
320,
3998,
11,
19111,
8,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_requested_transport_string() -> Result<()> {
let mut r = RequestedTransport {
protocol: PROTO_UDP,
};
assert_eq!(
r.to_string(),
"protocol: UDP",
"bad string {}, expected {}",
r,
"protocol: UDP",
);
r.protocol = Protocol(254);
if r.to_string() != "protocol: 254" {
assert_eq!(
r.to_string(),
"protocol: UDP",
"bad string {}, expected {}",
r,
"protocol: 254",
);
}
Ok(())
} | rust_cleaned_test_functions.jsonl/15705 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 300
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
72709,
46398,
3904,
368,
1464,
5714,
71698,
341,
262,
1077,
5206,
435,
284,
6145,
291,
27560,
341,
286,
11507,
25,
5308,
5207,
75201,
345,
262,
2605,
262,
2060,
10714,
33673,
286,
435,
2389,
3904,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_get_raster_count() {
let dataset = Dataset::open(fixture!("tinymarble.png")).unwrap();
let count = dataset.count();
assert_eq!(count, 3);
} | rust_cleaned_test_functions.jsonl/83429 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 75
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
1710,
2300,
3180,
368,
341,
262,
1077,
10337,
284,
39183,
486,
2508,
94886,
17223,
55971,
1600,
277,
891,
3508,
15197,
15454,
543,
262,
1077,
1760,
284,
10337,
6501,
543,
262,
2060,
10714,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_unresolved_module_diagnostic_no_diag_for_inline_mode() {
let (analysis, file_id) = single_file("mod foo {}");
let diagnostics = analysis.diagnostics(file_id).unwrap();
assert!(diagnostics.is_empty());
} | rust_cleaned_test_functions.jsonl/19264 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 92
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
39747,
10750,
29477,
11953,
6536,
61304,
5478,
41871,
7302,
368,
341,
262,
1077,
320,
34484,
11,
1034,
842,
8,
284,
3175,
2458,
445,
2593,
15229,
4687,
797,
262,
1077,
49418,
284,
6358,
950,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_convert_compatible_crate_name() {
let spec = "info,a-b=trace,c-d_e-f=warn,g-h-i=debug,jkl=trace/*[0-9]";
let expected = "info,a-b=trace,a_b=trace,c-d_e-f=warn,c_d_e_f=warn,g-h-i=debug,g_h_i=debug,jkl=trace/*[0-9]";
let result = convert_compatible_crate_name(spec);
assert_eq!(&result, &expected);
let spec = "info,a-b=trace,c-d_e-f=warn,g-h-i=debug,jkl=trace";
let expected =
"info,a-b=trace,a_b=trace,c-d_e-f=warn,c_d_e_f=warn,g-h-i=debug,g_h_i=debug,jkl=trace";
let result = convert_compatible_crate_name(spec);
assert_eq!(&result, &expected);
let spec = "info/*[0-9]";
let expected = "info/*[0-9]";
let result = convert_compatible_crate_name(spec);
assert_eq!(&result, &expected);
let spec = "info";
let expected = "info";
let result = convert_compatible_crate_name(spec);
assert_eq!(&result, &expected);
} | rust_cleaned_test_functions.jsonl/121495 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 431
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
2965,
37079,
666,
7698,
1269,
368,
341,
262,
1077,
1398,
284,
330,
2733,
15012,
1455,
28,
15067,
10109,
1737,
2204,
2220,
28,
33481,
21644,
2832,
17600,
28,
8349,
10327,
10561,
28,
15067,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_file_reader_rows_nulls() {
let rows = test_file_reader_rows::<Group>("nulls.snappy.parquet", None).unwrap();
let expected_rows = vec![
row![(
"b_struct".to_string(),
somev![groupv![("b_c_int".to_string(), nonev![])]]
)],
row![(
"b_struct".to_string(),
somev![groupv![("b_c_int".to_string(), nonev![])]]
)],
row![(
"b_struct".to_string(),
somev![groupv![("b_c_int".to_string(), nonev![])]]
)],
row![(
"b_struct".to_string(),
somev![groupv![("b_c_int".to_string(), nonev![])]]
)],
row![(
"b_struct".to_string(),
somev![groupv![("b_c_int".to_string(), nonev![])]]
)],
row![(
"b_struct".to_string(),
somev![groupv![("b_c_int".to_string(), nonev![])]]
)],
row![(
"b_struct".to_string(),
somev![groupv![("b_c_int".to_string(), nonev![])]]
)],
row![(
"b_struct".to_string(),
somev![groupv![("b_c_int".to_string(), nonev![])]]
)],
];
assert_eq!(rows, expected_rows);
} | rust_cleaned_test_functions.jsonl/92457 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 552
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2458,
22306,
10949,
15162,
82,
368,
341,
197,
10217,
6978,
284,
1273,
2458,
22306,
10949,
27638,
2808,
13211,
2921,
82,
37672,
11144,
33277,
23300,
497,
2240,
568,
15454,
1428,
197,
10217,
3601,
109... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_index_merger_no_deletes() {
let mut schema_builder = schema::SchemaBuilder::default();
let text_fieldtype = schema::TextOptions::default()
.set_indexing_options(
TextFieldIndexing::default()
.set_tokenizer("default")
.set_index_option(IndexRecordOption::WithFreqs),
)
.set_stored();
let text_field = schema_builder.add_text_field("text", text_fieldtype);
let score_fieldtype = schema::IntOptions::default().set_fast(Cardinality::SingleValue);
let score_field = schema_builder.add_u64_field("score", score_fieldtype);
let bytes_score_field = schema_builder.add_bytes_field("score_bytes");
let index = Index::create_in_ram(schema_builder.build());
let add_score_bytes = |doc: &mut Document, score: u32| {
let mut bytes = Vec::new();
bytes
.write_u32::<BigEndian>(score)
.expect("failed to write u32 bytes to Vec...");
doc.add_bytes(bytes_score_field, bytes);
};
{
let mut index_writer = index.writer_with_num_threads(1, 3_000_000).unwrap();
{
// writing the segment
{
let mut doc = Document::default();
doc.add_text(text_field, "af b");
doc.add_u64(score_field, 3);
add_score_bytes(&mut doc, 3);
index_writer.add_document(doc);
}
{
let mut doc = Document::default();
doc.add_text(text_field, "a b c");
doc.add_u64(score_field, 5);
add_score_bytes(&mut doc, 5);
index_writer.add_document(doc);
}
{
let mut doc = Document::default();
doc.add_text(text_field, "a b c d");
doc.add_u64(score_field, 7);
add_score_bytes(&mut doc, 7);
index_writer.add_document(doc);
}
index_writer.commit().expect("committed");
}
{
// writing the segment
{
let mut doc = Document::default();
doc.add_text(text_field, "af b");
doc.add_u64(score_field, 11);
add_score_bytes(&mut doc, 11);
index_writer.add_document(doc);
}
{
let mut doc = Document::default();
doc.add_text(text_field, "a b c g");
doc.add_u64(score_field, 13);
add_score_bytes(&mut doc, 13);
index_writer.add_document(doc);
}
index_writer.commit().expect("Commit failed");
}
}
{
let segment_ids = index
.searchable_segment_ids()
.expect("Searchable segments failed.");
let mut index_writer = index.writer_with_num_threads(1, 3_000_000).unwrap();
index_writer
.merge(&segment_ids)
.expect("Failed to initiate merge")
.wait()
.expect("Merging failed");
index_writer.wait_merging_threads().unwrap();
}
{
index.load_searchers().unwrap();
let searcher = index.searcher();
let get_doc_ids = |terms: Vec<Term>| {
let mut collector = TestCollector::default();
let query = BooleanQuery::new_multiterms_query(terms);
assert!(searcher.search(&query, &mut collector).is_ok());
collector.docs()
};
{
assert_eq!(
get_doc_ids(vec![Term::from_field_text(text_field, "a")]),
vec![1, 2, 4]
);
assert_eq!(
get_doc_ids(vec![Term::from_field_text(text_field, "af")]),
vec![0, 3]
);
assert_eq!(
get_doc_ids(vec![Term::from_field_text(text_field, "g")]),
vec![4]
);
assert_eq!(
get_doc_ids(vec![Term::from_field_text(text_field, "b")]),
vec![0, 1, 2, 3, 4]
);
}
{
let doc = searcher.doc(&DocAddress(0, 0)).unwrap();
assert_eq!(doc.get_first(text_field).unwrap().text(), "af b");
}
{
let doc = searcher.doc(&DocAddress(0, 1)).unwrap();
assert_eq!(doc.get_first(text_field).unwrap().text(), "a b c");
}
{
let doc = searcher.doc(&DocAddress(0, 2)).unwrap();
assert_eq!(doc.get_first(text_field).unwrap().text(), "a b c d");
}
{
let doc = searcher.doc(&DocAddress(0, 3)).unwrap();
assert_eq!(doc.get_first(text_field).unwrap().text(), "af b");
}
{
let doc = searcher.doc(&DocAddress(0, 4)).unwrap();
assert_eq!(doc.get_first(text_field).unwrap().text(), "a b c g");
}
{
let get_fast_vals = |terms: Vec<Term>| {
let query = BooleanQuery::new_multiterms_query(terms);
let mut collector = FastFieldTestCollector::for_field(score_field);
assert!(searcher.search(&query, &mut collector).is_ok());
collector.vals()
};
let get_fast_vals_bytes = |terms: Vec<Term>| {
let query = BooleanQuery::new_multiterms_query(terms);
let mut collector = BytesFastFieldTestCollector::for_field(bytes_score_field);
searcher
.search(&query, &mut collector)
.expect("failed to search");
collector.vals()
};
assert_eq!(
get_fast_vals(vec![Term::from_field_text(text_field, "a")]),
vec![5, 7, 13]
);
assert_eq!(
get_fast_vals_bytes(vec![Term::from_field_text(text_field, "a")]),
vec![0, 0, 0, 5, 0, 0, 0, 7, 0, 0, 0, 13]
);
}
}
} | rust_cleaned_test_functions.jsonl/72010 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3828
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3560,
717,
261,
1389,
6536,
2259,
13881,
368,
341,
286,
1077,
5206,
10802,
28532,
284,
10802,
486,
8632,
3297,
486,
2258,
543,
286,
1077,
1467,
5013,
1313,
284,
10802,
486,
1178,
3798,
486,
2258,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_one_shot() {
let mut tfd = TimerFd::new().expect("failed to create timerfd");
assert!(!tfd.is_armed().unwrap());
let dur = Duration::from_millis(200);
let now = Instant::now();
tfd.reset(dur, None).expect("failed to arm timer");
assert!(tfd.is_armed().unwrap());
let count = tfd.wait().expect("unable to wait for timer");
assert_eq!(count, 1);
assert!(now.elapsed() >= dur);
tfd.clear().expect("unable to clear the timer");
assert!(!tfd.is_armed().unwrap());
} | rust_cleaned_test_functions.jsonl/66517 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 264
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11667,
81226,
368,
341,
286,
1077,
5206,
6409,
67,
284,
17759,
74476,
486,
931,
1005,
17119,
445,
16091,
311,
1855,
9021,
6902,
797,
286,
2060,
0,
3471,
83,
6902,
2079,
25842,
2061,
1005,
15454,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_bencode_str() {
let left = vec![
Value::Str("foo".to_string()),
Value::Str("1234567890\n".to_string()),
Value::Str("".to_string()),
];
let right = vec!["3:foo", "11:1234567890\n", "0:"];
for i in 0..left.len() {
let mut bufread = BufReader::new(right[i].as_bytes());
assert_eq!(left[i], parse_bencode(&mut bufread).unwrap().unwrap());
assert_eq!(left[i].to_bencode(), right[i]);
}
} | rust_cleaned_test_functions.jsonl/107901 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 280
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
880,
6180,
2895,
368,
341,
286,
1077,
2115,
284,
7486,
90515,
310,
5162,
486,
2580,
445,
7975,
3263,
983,
3904,
14702,
310,
5162,
486,
2580,
445,
16,
17,
18,
19,
20,
21,
22,
23,
24,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_add_push_request_build() {
let endpoint = "https://example.com/push/endpoint";
let keys = Keys::new("anetohias===", "oeatssah=");
let mut req = AddPushRequest::new(endpoint, &keys);
req.follow().reblog();
let form = req.build().expect("Couldn't build form");
assert_eq!(
form,
add_subscription::Form {
subscription: add_subscription::Subscription {
endpoint: "https://example.com/push/endpoint".to_string(),
keys: add_subscription::Keys {
p256dh: "anetohias===".to_string(),
auth: "oeatssah=".to_string(),
},
},
data: Some(add_subscription::Data {
alerts: Some(Alerts {
follow: Some(true),
favourite: None,
reblog: Some(true),
mention: None,
}),
}),
}
);
} | rust_cleaned_test_functions.jsonl/116578 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 628
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
14218,
7893,
20801,
368,
341,
286,
1077,
14887,
284,
330,
2428,
1110,
8687,
905,
4322,
1116,
14,
32540,
876,
286,
1077,
6894,
284,
24133,
486,
931,
445,
276,
295,
2267,
3473,
418,
21369,
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_generate_update_operations() {
let mut heaviest_subtree_fork_choice = setup_forks();
let stake = 100;
let (bank, vote_pubkeys) = bank_utils::setup_bank_and_vote_pubkeys_for_tests(3, stake);
let pubkey_votes: Vec<(Pubkey, SlotHashKey)> = vec![
(vote_pubkeys[0], (3, Hash::default())),
(vote_pubkeys[1], (4, Hash::default())),
(vote_pubkeys[2], (1, Hash::default())),
];
let expected_update_operations: UpdateOperations = vec![
// Add/remove from new/old forks
(
((1, Hash::default()), UpdateLabel::Add),
UpdateOperation::Add(stake),
),
(
((3, Hash::default()), UpdateLabel::Add),
UpdateOperation::Add(stake),
),
(
((4, Hash::default()), UpdateLabel::Add),
UpdateOperation::Add(stake),
),
// Aggregate all ancestors of changed slots
(
((0, Hash::default()), UpdateLabel::Aggregate),
UpdateOperation::Aggregate,
),
(
((1, Hash::default()), UpdateLabel::Aggregate),
UpdateOperation::Aggregate,
),
(
((2, Hash::default()), UpdateLabel::Aggregate),
UpdateOperation::Aggregate,
),
]
.into_iter()
.collect();
let generated_update_operations = heaviest_subtree_fork_choice.generate_update_operations(
pubkey_votes.iter(),
bank.epoch_stakes_map(),
bank.epoch_schedule(),
);
assert_eq!(expected_update_operations, generated_update_operations);
let pubkey_votes: Vec<(Pubkey, SlotHashKey)> = vec![
(vote_pubkeys[0], (3, Hash::default())),
(vote_pubkeys[1], (2, Hash::default())),
(vote_pubkeys[2], (1, Hash::default())),
];
let generated_update_operations = heaviest_subtree_fork_choice.generate_update_operations(
pubkey_votes.iter(),
bank.epoch_stakes_map(),
bank.epoch_schedule(),
);
assert!(generated_update_operations.is_empty());
// Some people make newer votes
let pubkey_votes: Vec<(Pubkey, SlotHashKey)> = vec![
(vote_pubkeys[0], (3, Hash::default())),
(vote_pubkeys[1], (5, Hash::default())),
(vote_pubkeys[2], (3, Hash::default())),
];
let expected_update_operations: BTreeMap<(SlotHashKey, UpdateLabel), UpdateOperation> =
vec![
// Add/remove to/from new/old forks
(
((3, Hash::default()), UpdateLabel::Add),
UpdateOperation::Add(stake),
),
(
((5, Hash::default()), UpdateLabel::Add),
UpdateOperation::Add(stake),
),
(
((1, Hash::default()), UpdateLabel::Subtract),
UpdateOperation::Subtract(stake),
),
(
((4, Hash::default()), UpdateLabel::Subtract),
UpdateOperation::Subtract(stake),
),
// Aggregate all ancestors of changed slots
(
((0, Hash::default()), UpdateLabel::Aggregate),
UpdateOperation::Aggregate,
),
(
((1, Hash::default()), UpdateLabel::Aggregate),
UpdateOperation::Aggregate,
),
(
((2, Hash::default()), UpdateLabel::Aggregate),
UpdateOperation::Aggregate,
),
(
((3, Hash::default()), UpdateLabel::Aggregate),
UpdateOperation::Aggregate,
),
]
.into_iter()
.collect();
let generated_update_operations = heaviest_subtree_fork_choice.generate_update_operations(
pubkey_votes.iter(),
bank.epoch_stakes_map(),
bank.epoch_schedule(),
);
assert_eq!(expected_update_operations, generated_update_operations);
// People make new votes
let pubkey_votes: Vec<(Pubkey, SlotHashKey)> = vec![
(vote_pubkeys[0], (4, Hash::default())),
(vote_pubkeys[1], (6, Hash::default())),
(vote_pubkeys[2], (6, Hash::default())),
];
let expected_update_operations: BTreeMap<(SlotHashKey, UpdateLabel), UpdateOperation> =
vec![
// Add/remove from new/old forks
(
((4, Hash::default()), UpdateLabel::Add),
UpdateOperation::Add(stake),
),
(
((6, Hash::default()), UpdateLabel::Add),
UpdateOperation::Add(2 * stake),
),
(
((3, Hash::default()), UpdateLabel::Subtract),
UpdateOperation::Subtract(2 * stake),
),
(
((5, Hash::default()), UpdateLabel::Subtract),
UpdateOperation::Subtract(stake),
),
// Aggregate all ancestors of changed slots
(
((0, Hash::default()), UpdateLabel::Aggregate),
UpdateOperation::Aggregate,
),
(
((1, Hash::default()), UpdateLabel::Aggregate),
UpdateOperation::Aggregate,
),
(
((2, Hash::default()), UpdateLabel::Aggregate),
UpdateOperation::Aggregate,
),
(
((3, Hash::default()), UpdateLabel::Aggregate),
UpdateOperation::Aggregate,
),
(
((5, Hash::default()), UpdateLabel::Aggregate),
UpdateOperation::Aggregate,
),
]
.into_iter()
.collect();
let generated_update_operations = heaviest_subtree_fork_choice.generate_update_operations(
pubkey_votes.iter(),
bank.epoch_stakes_map(),
bank.epoch_schedule(),
);
assert_eq!(expected_update_operations, generated_update_operations);
} | rust_cleaned_test_functions.jsonl/70815 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3695
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48851,
8882,
57345,
368,
341,
286,
1077,
5206,
566,
98362,
5228,
9344,
761,
669,
31936,
284,
6505,
761,
73302,
543,
286,
1077,
18279,
284,
220,
16,
15,
15,
280,
286,
1077,
320,
17033,
11,
6910,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serde_interval_ym() {
test_interval_ym(false, 0, 0);
test_interval_ym(false, 0, 1);
test_interval_ym(false, 1, 1);
test_interval_ym(false, 178000000, 0);
test_interval_ym(true, 0000, 1);
test_interval_ym(true, 1, 1);
test_interval_ym(true, 178000000, 0);
} | rust_cleaned_test_functions.jsonl/54048 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 177
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75861,
450,
20541,
62,
1600,
368,
341,
286,
1273,
20541,
62,
1600,
3576,
11,
220,
15,
11,
220,
15,
317,
286,
1273,
20541,
62,
1600,
3576,
11,
220,
15,
11,
220,
16,
317,
286,
1273,
20541,
62,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_show() {
let mut e = EnumSet::new();
assert!(format!("{:?}", e) == "{}");
e.insert(A);
assert!(format!("{:?}", e) == "{A}");
e.insert(C);
assert!(format!("{:?}", e) == "{A, C}");
} | rust_cleaned_test_functions.jsonl/68308 | {
"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,
15267,
368,
341,
286,
1077,
5206,
384,
284,
14086,
1649,
486,
931,
543,
286,
2060,
10297,
2243,
88928,
25,
52652,
384,
8,
621,
35503,
797,
286,
384,
7030,
4346,
317,
286,
2060,
10297,
2243,
8892... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_as_list(){
let json_value = from_str("[1, 2, 3]").unwrap();
let json_list = json_value.as_list();
let expected_length = 3;
assert!(json_list.is_some() && json_list.unwrap().len() == expected_length);
} | rust_cleaned_test_functions.jsonl/111045 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 121
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
2019,
3032,
286,
1077,
2951,
3142,
284,
504,
2895,
10937,
16,
11,
220,
17,
11,
220,
18,
44891,
15454,
543,
286,
1077,
2951,
2019,
284,
2951,
3142,
5357,
2019,
543,
286,
1077,
3601,
5118,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_does_support_cmac() {
tink_mac::init();
let km = tink_core::registry::get_key_manager(tink_tests::AES_CMAC_TYPE_URL)
.expect("AES CMAC key manager not found");
assert!(
km.does_support(tink_tests::AES_CMAC_TYPE_URL),
"AesCmacKeyManager must support {}",
tink_tests::AES_CMAC_TYPE_URL
);
assert!(
!km.does_support("some bad type"),
"AesCmacKeyManager must support only {}",
tink_tests::AES_CMAC_TYPE_URL
);
} | rust_cleaned_test_functions.jsonl/37677 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 243
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
96374,
25827,
666,
11948,
368,
341,
262,
90584,
22802,
486,
2327,
543,
262,
1077,
13136,
284,
90584,
15467,
486,
29172,
486,
455,
3097,
12144,
1155,
766,
32509,
486,
69168,
920,
25788,
4189,
8000,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_no_args() {
assert_eq!(
Config::new_from(["exename"].iter()).unwrap(),
Config { file: "".to_string(), size: 3, iterations: 100, heuristic: Heuristic::LinearConflict, search_type: SearchType::Normal, solvable: true, visual: false }
);
} | rust_cleaned_test_functions.jsonl/114184 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
8384,
368,
341,
286,
2060,
10714,
33673,
310,
5532,
486,
931,
5673,
19065,
327,
1840,
5521,
2015,
6011,
15454,
3148,
310,
5532,
314,
1034,
25,
44907,
983,
3904,
1507,
1379,
25,
220,
18,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multi_sort_use_last() {
let argv = vec!["lsd", "--sort", "size", "-t", "-S", "-X", "--sort", "time"];
let matches = app::build().get_matches_from_safe(argv).unwrap();
assert_eq!(
Some(SortColumn::Time),
SortColumn::from_arg_matches(&matches)
);
} | rust_cleaned_test_functions.jsonl/54295 | {
"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,
25133,
18435,
15951,
12195,
368,
341,
286,
1077,
10213,
284,
7486,
0,
1183,
4730,
67,
497,
14482,
6860,
497,
330,
2141,
497,
6523,
83,
497,
6523,
50,
497,
6523,
55,
497,
14482,
6860,
497,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serialize_keyword() {
let kw = Keyword::namespaced("foo", "bar");
assert_tokens(&kw, &[
Token::NewtypeStruct { name: "Keyword" },
Token::Struct { name: "NamespaceableName", len: 2 },
Token::Str("namespace"),
Token::Some,
Token::BorrowedStr("foo"),
Token::Str("name"),
Token::BorrowedStr("bar"),
Token::StructEnd,
]);
} | rust_cleaned_test_functions.jsonl/133192 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 195
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
45824,
368,
341,
262,
1077,
29525,
284,
48970,
486,
11400,
68552,
445,
7975,
497,
330,
2257,
797,
262,
2060,
28838,
2099,
28600,
11,
609,
9640,
286,
9660,
486,
3564,
1313,
9422,
314,
829,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bootstrapping_already_bootstrapped_db() {
let tmp_dir = TempPath::new();
let db = db_with_mock_genesis(&tmp_dir).unwrap();
let ledger_info = db.ledger_store.get_latest_ledger_info().unwrap();
let genesis_ledger_info_with_sigs = GENESIS_INFO.1.clone();
let genesis_txn = GENESIS_INFO.2.clone();
assert!(db
.save_transactions(&[genesis_txn], 0, &Some(genesis_ledger_info_with_sigs))
.is_ok());
assert_eq!(
ledger_info,
db.ledger_store.get_latest_ledger_info().unwrap()
);
} | rust_cleaned_test_functions.jsonl/35797 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 256
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
52062,
495,
3629,
80772,
52062,
495,
5677,
8685,
368,
341,
262,
1077,
4174,
4334,
284,
19944,
1820,
486,
931,
543,
262,
1077,
2927,
284,
2927,
6615,
34134,
16322,
13774,
2099,
5173,
4334,
568,
154... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_startup_sync_state() {
let (mut env, mut client_proxy_1) = setup_swarm_and_client_proxy(4, 1);
client_proxy_1.create_next_account(false).unwrap();
client_proxy_1.create_next_account(false).unwrap();
client_proxy_1
.mint_coins(&["mb", "0", "100", "Coin1"], true)
.unwrap();
client_proxy_1
.mint_coins(&["mb", "1", "10", "Coin1"], true)
.unwrap();
client_proxy_1
.transfer_coins(&["tb", "0", "1", "10", "Coin1"], true)
.unwrap();
assert!(compare_balances(
vec![(90.0, "Coin1".to_string())],
client_proxy_1.get_balances(&["b", "0"]).unwrap(),
));
assert!(compare_balances(
vec![(20.0, "Coin1".to_string())],
client_proxy_1.get_balances(&["b", "1"]).unwrap(),
));
let peer_to_stop = 0;
env.validator_swarm.kill_node(peer_to_stop);
let node_config = NodeConfig::load(
env.validator_swarm
.config
.config_files
.get(peer_to_stop)
.unwrap(),
)
.unwrap();
// TODO Remove hardcoded path to state db
let state_db_path = node_config.storage.dir().join("libradb");
// Verify that state_db_path exists and
// we are not deleting a non-existent directory
assert!(state_db_path.as_path().exists());
// Delete the state db to simulate state db lagging
// behind consensus db and forcing a state sync
// during a node startup
fs::remove_dir_all(state_db_path).unwrap();
assert!(env.validator_swarm.add_node(peer_to_stop, false).is_ok());
// create the client for the restarted node
let accounts = client_proxy_1.copy_all_accounts();
let mut client_proxy_0 = env.get_validator_client(0, None);
let sender_address = accounts[0].address;
client_proxy_0.set_accounts(accounts);
client_proxy_0
.wait_for_transaction(sender_address, 1)
.unwrap();
assert!(compare_balances(
vec![(90.0, "Coin1".to_string())],
client_proxy_0.get_balances(&["b", "0"]).unwrap(),
));
assert!(compare_balances(
vec![(20.0, "Coin1".to_string())],
client_proxy_0.get_balances(&["b", "1"]).unwrap(),
));
client_proxy_1
.transfer_coins(&["tb", "0", "1", "10", "Coin1"], true)
.unwrap();
client_proxy_0
.wait_for_transaction(sender_address, 2)
.unwrap();
assert!(compare_balances(
vec![(80.0, "Coin1".to_string())],
client_proxy_0.get_balances(&["b", "0"]).unwrap(),
));
assert!(compare_balances(
vec![(30.0, "Coin1".to_string())],
client_proxy_0.get_balances(&["b", "1"]).unwrap(),
));
} | rust_cleaned_test_functions.jsonl/62876 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1234
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
80858,
23008,
4387,
368,
341,
262,
1077,
320,
6984,
6105,
11,
5206,
2943,
29712,
62,
16,
8,
284,
6505,
32581,
2178,
8378,
8179,
29712,
7,
19,
11,
220,
16,
317,
262,
2943,
29712,
62,
16,
2520,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iter_size_hint() {
Python::with_gil(|py| {
let mut v = HashMap::new();
v.insert(7, 32);
v.insert(8, 42);
v.insert(9, 123);
let ob = v.to_object(py);
let dict = <PyDict as PyTryFrom>::try_from(ob.as_ref(py)).unwrap();
let mut iter = dict.iter();
assert_eq!(iter.size_hint(), (v.len(), Some(v.len())));
iter.next();
assert_eq!(iter.size_hint(), (v.len() - 1, Some(v.len() - 1)));
// Exhust iterator.
for _ in &mut iter {}
assert_eq!(iter.size_hint(), (0, Some(0)));
});
} | rust_cleaned_test_functions.jsonl/7730 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 382
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
2368,
45825,
368,
341,
286,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
341,
310,
1077,
5206,
348,
284,
10528,
486,
931,
543,
310,
348,
7030,
7,
22,
11,
220,
18,
17,
317,
310,
348,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_format_default_single_item_hard_host_alert() {
let mapping = Mapping {
name: "foobar".to_string(),
query: "up{random_label=\"random_value\"}".to_string(),
thresholds: ThresholdPair {
warning: None,
critical: Some(NagiosRange::from("@10:20").unwrap()),
},
host: "foo".to_string(),
service: None,
interval: Duration::from_secs(60),
last_apply: Instant::now(),
plugin_output: None,
performance_data: PerformanceData::default(),
};
let result =
"[DOWN] PromQL query returned one result within the critical range (15.00 in @10:20)"
.to_string();
assert_eq!(
format_default_single_item(&mapping, 15.0, 2, "DOWN".to_string()),
result
);
} | rust_cleaned_test_functions.jsonl/96128 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 456
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8955,
9993,
19487,
5634,
77712,
12848,
35717,
368,
341,
286,
1077,
12731,
284,
38446,
341,
310,
829,
25,
330,
50267,
3263,
983,
3904,
3148,
310,
3239,
25,
330,
454,
90,
11463,
6106,
4070,
11463,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.