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_array_with_integer_map() {
let data = vec![0x81, 0xA1, 0x01, 0x02];
let parsed: ParsedArray<super::ParsedArraySize1> =
ParsedArray::deserialize_data(&data).expect("Failed to parse");
assert_eq!(parsed.raw_values(), vec![vec![0xA1, 0x01, 0x02]]);
assert_eq!(
parsed.get::<HashMap<u8, u8>>(0).unwrap(),
maplit::hashmap! {1 => 2}
);
assert_eq!(parsed.tag(), None);
let serialized = parsed.serialize_data().expect("Failed to serialize");
assert_eq!(serialized, data);
} | rust_cleaned_test_functions.jsonl/10825 | {
"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,
3858,
6615,
31725,
5376,
368,
341,
286,
1077,
821,
284,
7486,
20703,
15,
87,
23,
16,
11,
220,
15,
14673,
16,
11,
220,
15,
87,
15,
16,
11,
220,
15,
87,
15,
17,
935,
286,
1077,
15676,
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_ground_tuple() {
let schemaReplicant = prepopulated_schemaReplicant();
// Verify that we accept inline constants.
let causetq = r#"[:find ?x ?y :where [(ground [1 "yyy"]) [?x ?y]]]"#;
let constant = translate_to_constant(&schemaReplicant, causetq);
assert_eq!(constant.project_without_rows().unwrap()
.into_rel().unwrap(),
vec![vec![MinkowskiType::Long(1), MinkowskiType::typed_string("yyy")]].into());
// Verify that we accept bound input constants.
let causetq = r#"[:find [?x ?y] :in ?u ?v :where [(ground [?u ?v]) [?x ?y]]]"#;
let inputs = CausetQInputs::with_value_sequence(vec![(ToUpper::from_valid_name("?u"), MinkowskiType::Long(2)),
(ToUpper::from_valid_name("?v"), "aaa".into()),]);
let constant = translate_with_inputs_to_constant(&schemaReplicant, causetq, inputs);
assert_eq!(constant.project_without_rows().unwrap()
.into_tuple().unwrap(),
Some(vec![MinkowskiType::Long(2).into(), MinkowskiType::typed_string("aaa").into()]));
} | rust_cleaned_test_functions.jsonl/90720 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 551
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
72492,
21773,
368,
341,
262,
1077,
10802,
18327,
35237,
284,
855,
8374,
7757,
25371,
18327,
35237,
1428,
262,
442,
25429,
429,
582,
4193,
7381,
18021,
624,
262,
1077,
2162,
18187,
80,
284,
435,
55... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_text_only_children() {
const DATA: &'static str = r#"<a>A
<b>B</b>
<c>
C
<d>D</d>
</c>
<e> </e>
<f></f>
</a>"#;
let doc = Document::parse(DATA).unwrap();
let mut result = HashMap::new();
result.insert("b", "B");
result.insert("e", " ");
result.insert("f", "");
assert_eq!(
text_only_children(&doc.root().first_child().unwrap()),
result
)
} | rust_cleaned_test_functions.jsonl/40137 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 310
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4326,
18410,
31206,
368,
341,
286,
733,
14112,
25,
30136,
1978,
607,
284,
435,
2,
22476,
64,
23465,
198,
286,
366,
65,
36721,
522,
65,
397,
286,
366,
66,
397,
310,
356,
198,
310,
366,
67,
36... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tx_ctx_message_slots() {
let mut mock = Mock::default();
let max_messages = mock.max_messages;
let mut ctx = mock.create_ctx();
ctx.with_tx(0, mock::transaction(), |mut tx_ctx, _call| {
for i in 0..max_messages {
assert_eq!(tx_ctx.remaining_messages(), max_messages - i);
tx_ctx
.emit_message(
roothash::Message::Staking(Versioned::new(
0,
roothash::StakingMessage::Transfer(staking::Transfer::default()),
)),
MessageEventHookInvocation::new("test".to_string(), ""),
)
.expect("message should be emitted");
assert_eq!(tx_ctx.remaining_messages(), max_messages - i - 1);
}
// Another message should error.
tx_ctx
.emit_message(
roothash::Message::Staking(Versioned::new(
0,
roothash::StakingMessage::Transfer(staking::Transfer::default()),
)),
MessageEventHookInvocation::new("test".to_string(), ""),
)
.expect_err("message emitting should fail");
assert_eq!(tx_ctx.remaining_messages(), 0);
});
} | rust_cleaned_test_functions.jsonl/105380 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 802
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17805,
15147,
6462,
54161,
368,
341,
286,
1077,
5206,
7860,
284,
14563,
486,
2258,
543,
286,
1077,
1932,
23428,
284,
7860,
6678,
23428,
280,
286,
1077,
5206,
5635,
284,
7860,
2520,
15147,
1428,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_aessafe_128_x8() {
let key: [u8; 16] = [
0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c ];
let plain: [u8; 128] = [
0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10,
0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 ];
let cipher: [u8; 128] = [
0x3a, 0xd7, 0x7b, 0xb4, 0x0d, 0x7a, 0x36, 0x60,
0xa8, 0x9e, 0xca, 0xf3, 0x24, 0x66, 0xef, 0x97,
0xf5, 0xd3, 0xd5, 0x85, 0x03, 0xb9, 0x69, 0x9d,
0xe7, 0x85, 0x89, 0x5a, 0x96, 0xfd, 0xba, 0xaf,
0x43, 0xb1, 0xcd, 0x7f, 0x59, 0x8e, 0xce, 0x23,
0x88, 0x1b, 0x00, 0xe3, 0xed, 0x03, 0x06, 0x88,
0x7b, 0x0c, 0x78, 0x5e, 0x27, 0xe8, 0xad, 0x3f,
0x82, 0x23, 0x20, 0x71, 0x04, 0x72, 0x5d, 0xd4,
0x3a, 0xd7, 0x7b, 0xb4, 0x0d, 0x7a, 0x36, 0x60,
0xa8, 0x9e, 0xca, 0xf3, 0x24, 0x66, 0xef, 0x97,
0xf5, 0xd3, 0xd5, 0x85, 0x03, 0xb9, 0x69, 0x9d,
0xe7, 0x85, 0x89, 0x5a, 0x96, 0xfd, 0xba, 0xaf,
0x43, 0xb1, 0xcd, 0x7f, 0x59, 0x8e, 0xce, 0x23,
0x88, 0x1b, 0x00, 0xe3, 0xed, 0x03, 0x06, 0x88,
0x7b, 0x0c, 0x78, 0x5e, 0x27, 0xe8, 0xad, 0x3f,
0x82, 0x23, 0x20, 0x71, 0x04, 0x72, 0x5d, 0xd4 ];
let enc = aessafe::AesSafe128EncryptorX8::new(&key);
let dec = aessafe::AesSafe128DecryptorX8::new(&key);
let mut tmp = [0u8; 128];
enc.encrypt_block_x8(&plain, &mut tmp);
assert!(tmp[..] == cipher[..]);
dec.decrypt_block_x8(&cipher, &mut tmp);
assert!(tmp[..] == plain[..]);
} | rust_cleaned_test_functions.jsonl/60756 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1828
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4306,
433,
5645,
62,
16,
17,
23,
3212,
23,
368,
341,
286,
1077,
1376,
25,
508,
84,
23,
26,
220,
16,
21,
60,
284,
2278,
310,
220,
15,
87,
17,
65,
11,
220,
15,
87,
22,
68,
11,
220,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vote_process_instruction_decode_bail() {
assert_eq!(
super::handle_opcode(&BvmAddr::default(), &mut [], &[], 0,),
Err(OpCodeErr::BadOpCodeContext),
);
} | rust_cleaned_test_functions.jsonl/127642 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54360,
11305,
54923,
15227,
880,
604,
368,
341,
286,
2060,
10714,
33673,
310,
2256,
486,
8192,
71319,
2099,
33,
7338,
13986,
486,
2258,
1507,
609,
6984,
10071,
609,
12995,
220,
15,
52438,
310,
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 |
#[test]
fn test_del_select() {
let mut data = vec![
(1, Some("name:0"), 2),
(2, Some("name:3"), 3),
(4, Some("name:0"), 1),
(5, Some("name:5"), 4),
(6, Some("name:5"), 4),
(7, None, 4),
];
let product = ProductTable::new();
let (mut store, endpoint) = init_with_data(&product, &data);
store.begin();
let (id, name, cnt) = data.remove(3);
let name_datum = name.map(|s| s.as_bytes()).into();
store
.delete_from(&product.table)
.execute(id, vec![id.into(), name_datum, cnt.into()]);
store.commit();
// for dag
let req = DAGSelect::from_index(&product.table, &product.id).build();
let mut resp = handle_select(&endpoint, req);
let spliter = DAGChunkSpliter::new(resp.take_chunks().into_vec(), 1);
let mut row_count = 0;
for _ in spliter {
row_count += 1;
}
assert_eq!(row_count, 5);
} | rust_cleaned_test_functions.jsonl/34861 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 433
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18029,
13051,
368,
341,
262,
1077,
5206,
821,
284,
7486,
90515,
286,
320,
16,
11,
4329,
445,
606,
25,
15,
3975,
220,
17,
1326,
286,
320,
17,
11,
4329,
445,
606,
25,
18,
3975,
220,
18,
1326,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_non_square_eigendecomp() {
let a: Matrix<f64> = Matrix::ones(2, 3);
let _ = a.eigendecomp();
} | rust_cleaned_test_functions.jsonl/96797 | {
"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,
21637,
39794,
2204,
343,
408,
757,
14435,
368,
341,
286,
1077,
264,
25,
11631,
63895,
21,
19,
29,
284,
11631,
486,
3154,
7,
17,
11,
220,
18,
626,
286,
1077,
716,
284,
264,
1734,
343,
408,
75... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_dependency_fails_verification() {
let mut executor = FakeExecutor::from_genesis_with_options(VMPublishingOption::open());
executor.set_golden_file(current_function_name!());
// Get a module that fails verification into the store.
let (bad_module, bad_module_bytes) = bad_module();
executor.add_module(&bad_module.self_id(), bad_module_bytes);
// Create a transaction that tries to use that module.
let sender = executor.create_raw_account_data(1_000_000, 10);
executor.add_account_data(&sender);
let good_module = {
let (_, serialized_module) = good_module_uses_bad(*sender.address(), bad_module);
diem_types::transaction::Module::new(serialized_module)
};
let txn = sender
.account()
.transaction()
.module(good_module)
.sequence_number(10)
.max_gas_amount(100_000)
.gas_unit_price(1)
.sign();
// invariant violation as we try to load `Test`
assert_eq!(executor.verify_transaction(txn.clone()).status(), None);
match executor.execute_transaction(txn).status() {
TransactionStatus::Discard(status) => {
assert_eq!(status, &StatusCode::UNEXPECTED_VERIFIER_ERROR);
}
_ => panic!("Kept transaction with an invariant violation!"),
}
} | rust_cleaned_test_functions.jsonl/38968 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 537
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10750,
62387,
761,
6209,
84245,
368,
341,
262,
1077,
5206,
31558,
284,
36965,
25255,
486,
1499,
16322,
13774,
6615,
8743,
12410,
5781,
2538,
287,
5341,
486,
2508,
1423,
262,
31558,
980,
54696,
268,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_extract_toml_paths() {
let config = toml::toml! {
extract_root = true
ignore_root = false
[extract_section]
ok = true
[extract_section.subsection]
ok = true
[ignore_section]
ok = false
[extract_subsection]
ok = false
[extract_subsection.extracted]
ok = true
[extract_subsection.ignored]
ok = false
};
let expected_config = toml::toml! {
extract_root = true
[extract_section]
ok = true
[extract_section.subsection]
ok = true
[extract_subsection.extracted]
ok = true
};
let actual_config = extract_toml_paths(
config,
&[
"extract_root",
"extract_section",
"extract_subsection.extracted",
],
);
assert_eq!(expected_config, actual_config);
} | rust_cleaned_test_functions.jsonl/134235 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 613
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
528,
316,
75,
24152,
368,
341,
286,
1077,
2193,
284,
311,
1014,
486,
37401,
75,
0,
341,
310,
8649,
12993,
284,
830,
198,
310,
10034,
12993,
284,
895,
271,
310,
508,
23493,
16221,
921,
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_eval() -> Result<(), Box<EvalAltResult>> {
let engine = Engine::new();
assert_eq!(
engine.eval::<INT>(
r#"
eval("40 + 2")
"#
)?,
42
);
Ok(())
} | rust_cleaned_test_functions.jsonl/114781 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21296,
368,
1464,
5714,
68843,
8261,
23835,
831,
26017,
2077,
2452,
341,
262,
1077,
4712,
284,
8200,
486,
931,
1428,
262,
2060,
10714,
33673,
286,
4712,
31710,
27638,
3221,
17055,
310,
435,
2,
698... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_limit_batch_size() {
let (_, client, _runtime) = create_database_client_and_runtime();
let mut batch = Vec::new();
for i in 0..21 {
batch.push(MethodRequest::get_metadata_by_version(i));
}
let ret = client.batch(batch).unwrap_err();
let error = ret.json_rpc_error().unwrap();
let expected = "JsonRpcError { code: -32600, message: \"Invalid Request: batch size = 21, exceed limit 20\", data: None }";
assert_eq!(format!("{:?}", error), expected)
} | rust_cleaned_test_functions.jsonl/102708 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 197
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14763,
14534,
2368,
368,
341,
262,
1077,
39464,
2943,
11,
716,
22255,
8,
284,
1855,
27341,
8179,
8378,
33232,
1428,
262,
1077,
5206,
7162,
284,
11312,
486,
931,
1428,
262,
369,
600,
304,
220,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_inspected_snapshot() {
let mut cluster = new_server_cluster(1, 3);
cluster.cfg.prefer_mem = false;
cluster.cfg.raft_store.raft_log_gc_tick_interval = ReadableDuration::millis(20);
cluster.cfg.raft_store.raft_log_gc_count_limit = 8;
cluster.cfg.raft_store.merge_max_log_gap = 3;
let pd_client = Arc::clone(&cluster.pd_client);
pd_client.disable_default_operator();
cluster.run();
cluster.must_transfer_leader(1, new_peer(1, 1));
cluster.stop_node(3);
(0..10).for_each(|_| cluster.must_put(b"k2", b"v2"));
// Sleep for a while to ensure all logs are compacted.
sleep_ms(100);
let stats = cluster
.io_rate_limiter
.as_ref()
.unwrap()
.statistics()
.unwrap();
assert_eq!(stats.fetch(IOType::Replication, IOOp::Read), 0);
assert_eq!(stats.fetch(IOType::Replication, IOOp::Write), 0);
// Make sure snapshot read hits disk
cluster.flush_data();
// Let store 3 inform leader to generate a snapshot.
cluster.run_node(3).unwrap();
must_get_equal(&cluster.get_engine(3), b"k2", b"v2");
assert_ne!(stats.fetch(IOType::Replication, IOOp::Read), 0);
assert_ne!(stats.fetch(IOType::Replication, IOOp::Write), 0);
pd_client.must_remove_peer(1, new_peer(2, 2));
assert_eq!(stats.fetch(IOType::LoadBalance, IOOp::Read), 0);
assert_eq!(stats.fetch(IOType::LoadBalance, IOOp::Write), 0);
pd_client.must_add_peer(1, new_peer(2, 2));
must_get_equal(&cluster.get_engine(2), b"k2", b"v2");
assert_ne!(stats.fetch(IOType::LoadBalance, IOOp::Read), 0);
assert_ne!(stats.fetch(IOType::LoadBalance, IOOp::Write), 0);
} | rust_cleaned_test_functions.jsonl/94645 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 737
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34386,
4046,
53265,
368,
341,
262,
1077,
5206,
10652,
284,
501,
12015,
28441,
7,
16,
11,
220,
18,
317,
262,
10652,
30481,
6225,
802,
12976,
284,
895,
280,
262,
10652,
30481,
13,
2944,
14809,
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_node_types_with_inlined_rules() {
let node_types = get_node_types(InputGrammar {
name: String::new(),
word_token: None,
extra_symbols: Vec::new(),
external_tokens: Vec::new(),
expected_conflicts: Vec::new(),
variables_to_inline: vec!["v2".to_string()],
supertype_symbols: vec![],
variables: vec![
Variable {
name: "v1".to_string(),
kind: VariableType::Named,
rule: Rule::seq(vec![Rule::named("v2"), Rule::named("v3")]),
},
Variable {
name: "v2".to_string(),
kind: VariableType::Named,
rule: Rule::alias(Rule::string("a"), "x".to_string(), true),
},
Variable {
name: "v3".to_string(),
kind: VariableType::Named,
rule: Rule::string("b"),
},
],
});
assert_eq!(
node_types[0],
NodeInfoJSON {
kind: "v1".to_string(),
named: true,
subtypes: None,
children: Some(FieldInfoJSON {
multiple: true,
required: true,
types: vec![
NodeTypeJSON {
kind: "v3".to_string(),
named: true,
},
NodeTypeJSON {
kind: "x".to_string(),
named: true,
},
]
}),
fields: Some(BTreeMap::new()),
}
);
} | rust_cleaned_test_functions.jsonl/8320 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5084,
9763,
6615,
1243,
15121,
21407,
368,
341,
286,
1077,
2436,
9763,
284,
633,
5084,
9763,
29773,
97178,
341,
310,
829,
25,
923,
486,
931,
3148,
310,
3409,
6458,
25,
2240,
345,
310,
4960,
5575... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_string() {
let slk_reader = SLKScanner::open("resources/sample_1.slk");
let mut document = Document::default();
document.load(slk_reader);
let cells = document.get_contents();
let cell1 = &cells[0].get_value().unwrap();
let cell6 = &cells[6].get_value().unwrap();
println!("{:?}", cell1);
println!("{:?}", cell6);
} | rust_cleaned_test_functions.jsonl/42053 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 191
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
3904,
368,
341,
286,
1077,
1739,
74,
22306,
284,
16797,
42,
31002,
486,
2508,
445,
12745,
69851,
62,
16,
25101,
74,
797,
286,
1077,
5206,
2197,
284,
11789,
486,
2258,
543,
286,
2197,
5104,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_types_for_aliased_nodes() {
let node_types = get_node_types(InputGrammar {
name: String::new(),
extra_symbols: Vec::new(),
external_tokens: Vec::new(),
expected_conflicts: Vec::new(),
variables_to_inline: Vec::new(),
word_token: None,
supertype_symbols: vec![],
variables: vec![
Variable {
name: "thing".to_string(),
kind: VariableType::Named,
rule: Rule::choice(vec![Rule::named("type"), Rule::named("expression")]),
},
Variable {
name: "type".to_string(),
kind: VariableType::Named,
rule: Rule::choice(vec![
Rule::alias(
Rule::named("identifier"),
"type_identifier".to_string(),
true,
),
Rule::string("void"),
]),
},
Variable {
name: "expression".to_string(),
kind: VariableType::Named,
rule: Rule::choice(vec![
Rule::named("identifier"),
Rule::alias(
Rule::named("foo_identifier"),
"identifier".to_string(),
true,
),
]),
},
Variable {
name: "identifier".to_string(),
kind: VariableType::Named,
rule: Rule::pattern("\\w+"),
},
Variable {
name: "foo_identifier".to_string(),
kind: VariableType::Named,
rule: Rule::pattern("[\\w-]+"),
},
],
});
assert_eq!(node_types.iter().find(|t| t.kind == "foo_identifier"), None);
assert_eq!(
node_types.iter().find(|t| t.kind == "identifier"),
Some(&NodeInfoJSON {
kind: "identifier".to_string(),
named: true,
subtypes: None,
children: None,
fields: None,
})
);
assert_eq!(
node_types.iter().find(|t| t.kind == "type_identifier"),
Some(&NodeInfoJSON {
kind: "type_identifier".to_string(),
named: true,
subtypes: None,
children: None,
fields: None,
})
);
} | rust_cleaned_test_functions.jsonl/8321 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1706
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5084,
9763,
5478,
62,
7956,
1475,
14896,
368,
341,
286,
1077,
2436,
9763,
284,
633,
5084,
9763,
29773,
97178,
341,
310,
829,
25,
923,
486,
931,
3148,
310,
4960,
55752,
25,
11312,
486,
931,
3148,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_strings() {
let mut vcf = Reader::from_path(&"test/test_string.vcf").expect("Error opening file.");
let fs1 = [
&b"LongString1"[..],
&b"LongString2"[..],
&b"."[..],
&b"LongString4"[..],
&b"evenlength"[..],
&b"ss6"[..],
];
let mut buffer = Buffer::new();
for (i, rec) in vcf.records().enumerate() {
println!("record {}", i);
let mut record = rec.expect("Error reading record.");
assert_eq!(
record
.info_shared_buffer(b"S1", &mut buffer)
.string()
.expect("Error reading string.")
.expect("Missing tag")[0],
format!("string{}", i + 1).as_bytes()
);
println!(
"{}",
String::from_utf8_lossy(
record
.format(b"FS1")
.string()
.expect("Error reading string.")[0]
)
);
assert_eq!(
record
.format(b"FS1")
.string()
.expect("Error reading string.")[0],
fs1[i]
);
}
} | rust_cleaned_test_functions.jsonl/8764 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 849
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33500,
368,
341,
286,
1077,
5206,
348,
9792,
284,
25166,
486,
1499,
2638,
2099,
1,
1944,
12697,
3904,
3133,
9792,
1827,
17119,
445,
1454,
8568,
1034,
7320,
286,
1077,
8619,
16,
284,
2278,
310,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_checked_sub() {
assert_eq!(5_usize.checked_sub(0), Some(5));
assert_eq!(5_usize.checked_sub(1), Some(4));
assert_eq!(5_usize.checked_sub(2), Some(3));
assert_eq!(5_usize.checked_sub(3), Some(2));
assert_eq!(5_usize.checked_sub(4), Some(1));
assert_eq!(5_usize.checked_sub(5), Some(0));
assert_eq!(5_usize.checked_sub(6), None);
assert_eq!(5_usize.checked_sub(7), None);
} | rust_cleaned_test_functions.jsonl/21923 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 244
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56456,
5228,
368,
341,
286,
2060,
10714,
10297,
20,
11306,
551,
29101,
5228,
7,
15,
701,
4329,
7,
20,
1106,
286,
2060,
10714,
10297,
20,
11306,
551,
29101,
5228,
7,
16,
701,
4329,
7,
19,
1106,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parameters() {
let mut lexicon = read_lexicon();
assert_eq!(1, lexicon.get_left_id(0));
assert_eq!(1, lexicon.get_right_id(0));
assert_eq!(8729, lexicon.get_cost(0));
// 東京都
lexicon = read_lexicon();
assert_eq!(6, lexicon.get_left_id(6));
assert_eq!(8, lexicon.get_right_id(6));
assert_eq!(5320, lexicon.get_cost(6));
// 都
lexicon = read_lexicon();
assert_eq!(8, lexicon.get_left_id(9));
assert_eq!(8, lexicon.get_right_id(9));
assert_eq!(2914, lexicon.get_cost(9));
} | rust_cleaned_test_functions.jsonl/113034 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 277
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18263,
368,
341,
981,
1077,
5206,
22429,
1924,
284,
1349,
74547,
1924,
543,
262,
2060,
10714,
10297,
16,
11,
22429,
1924,
670,
9579,
842,
7,
15,
1106,
262,
2060,
10714,
10297,
16,
11,
22429,
192... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_exclusive_one_empty_struct() {
#![allow(dead_code)]
#[derive(JsonSchema)]
struct A {}
#[derive(JsonSchema)]
struct B {
a: (),
b: Option<()>,
bb: (),
}
let a = schema_for!(A).schema.into();
let b = schema_for!(B).schema.into();
assert!(schemas_mutually_exclusive(&a, &b));
assert!(schemas_mutually_exclusive(&b, &a));
} | rust_cleaned_test_functions.jsonl/53302 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 257
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2702,
8336,
11667,
15124,
15126,
368,
341,
286,
671,
20703,
7183,
83207,
4136,
27771,
286,
11506,
27098,
39341,
8632,
5563,
286,
2036,
362,
10086,
286,
11506,
27098,
39341,
8632,
5563,
286,
2036,
42... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_timestamp() {
assert_eq!(Metric::parse_timestamp(""), Ok(("", None)));
assert_eq!(Metric::parse_timestamp("123"), Ok(("", Some(123))));
assert_eq!(Metric::parse_timestamp(" -23"), Ok(("", Some(-23))));
} | rust_cleaned_test_functions.jsonl/78091 | {
"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,
21039,
23073,
368,
341,
286,
2060,
10714,
10297,
54310,
486,
6400,
23073,
86076,
7622,
7,
19814,
2240,
4945,
286,
2060,
10714,
10297,
54310,
486,
6400,
23073,
445,
16,
17,
18,
3975,
7622,
7,
19814... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_internally_tagged_braced_struct_with_zero_fields() {
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type")]
struct S {}
assert_tokens(
&S {},
&[
Token::Struct { name: "S", len: 1 },
Token::Str("type"),
Token::Str("S"),
Token::StructEnd,
],
);
} | rust_cleaned_test_functions.jsonl/56444 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 202
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4042,
932,
745,
9372,
3556,
17682,
4435,
15126,
6615,
19359,
12132,
368,
341,
262,
11506,
27098,
42618,
11,
55039,
11,
39900,
11,
48440,
5563,
262,
11506,
47024,
19343,
284,
330,
1313,
5422,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_packet_roundtrip_0002() {
packet_roundtrip(
"0002",
vec![
(82, 199), // invalid hash alg 06
(85, 196), // invalid hash alg 06
(836, 3136), // non canoncial length encoding
(1200, 2772), // non canoncial length encoding
(1268, 1223), // non canoncial length encoding
(1670, 3419), // non canoncial length encoding
],
)
} | rust_cleaned_test_functions.jsonl/54779 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 269
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21078,
29896,
32981,
62,
15,
15,
15,
17,
368,
341,
286,
10151,
29896,
32981,
1006,
310,
330,
15,
15,
15,
17,
756,
310,
7486,
90515,
394,
320,
23,
17,
11,
220,
16,
24,
24,
701,
262,
442,
83... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_scan_accounts() {
run_test_scan_accounts(0);
run_test_scan_accounts(1);
run_test_scan_accounts(ITER_BATCH_SIZE * 10);
run_test_scan_accounts(ITER_BATCH_SIZE * 10 - 1);
run_test_scan_accounts(ITER_BATCH_SIZE * 10 + 1);
} | rust_cleaned_test_functions.jsonl/2227 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28857,
55665,
368,
341,
286,
1598,
4452,
28857,
55665,
7,
15,
317,
286,
1598,
4452,
28857,
55665,
7,
16,
317,
286,
1598,
4452,
28857,
55665,
7,
24733,
74009,
4098,
353,
220,
16,
15,
317,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ssh_keys() {
let mut provider = OpenstackProviderNetwork::try_new().unwrap();
provider.client = provider.client.max_retries(0);
let key1 = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCsXe6CfHl45kCIzMF92VhDf2NpBWUyS1+IiTtxm5a83mT9730Hb8xim7GYeJu47kiESw2DAN8vNJ/Irg0apZ217ah2rXXjPQuWYSXuEuap8yLBSjqw8exgqVj/kzW+YqmnHASxI13eoFDxTQQGzyqbqowvxu/5gQmDwBmNAa9bT809ziB/qmpS1mD6qyyFDpR23kUwu3TkgAbwMXBDoqK+pdwfaF9uo9XaLHNEH8lD5BZuG2BeDafm2o76DhNSo83MvcCPNXKLxu3BbX/FCMFO6O8RRqony4i91fEV1b8TbXrbJz1bwEYEnJRvmjnqI/389tQFeYvplXR2WdT9PCKyEAG+j8y6XgecIcdTqV/7gFfak1mp2S7mYHZDnXixsn3MjCP/cIxxJVDitKusnj1TdFqtSXl4tqGccbg/5Sqnt/EVSK4bGwwBxv/YmE0P9cbXLxuEVI0JYzgrQvC8TtUgd8kUu2jqi1/Yj9IWm3aFsl/hhh8YwYrv/gm8PV0TxkM= root@example1";
let key2 = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDj6FBVgkTt7/DB93VVLk6304Nx7WUjLBJDSCh38zjCimHUpeo9uYDxflfu2N1CLtrSImIKBVP/JRy9g7K4zmRAH/wXw2UxYziX+hZoFIpbW3GmYQqhjx2lDvIRXJI7blhHhTUNWX5f10lFAYOLqA9J859AB1w7ND09+MS3jQgSazCx17h+QZ0qQ6kLSfnXw9PMUOE1Xba9hD1nYj14ryTVj9jrFPMFuUfXdb/G9lsDJ+cGvdE2/RMuPfDmEdo04zvZ5fQJJKvS7OyAuYev4Y+JC8MhEr756ITDZ17yq4BEMo/8rNPxZ5Von/8xnvry+8/2C3ep9rZyHtCwpRb6WT6TndV2ddXKhEIneyd1XiOcWPJguHj5vSoMN3mo8k2PvznGauvxBstvpjUSFLQu869/ZQwyMnbQi3wnkJk5CpLXePXn1J9njocJjt8+SKGijmmIAsmYosx8gmmu3H1mvq9Wi0qqWDITMm+J24AZBEPBhwVrjhLZb5MKxylF6JFJJBs= root@example2";
let endpoints = maplit::btreemap! {
"/public-keys" => "0=test1\n1=test2",
"/public-keys/0/openssh-key" => key1,
"/public-keys/1/openssh-key" => key2,
};
let mut mocks = Vec::with_capacity(endpoints.len());
for (endpoint, body) in endpoints {
let m = mockito::mock("GET", endpoint)
.with_status(200)
.with_body(body)
.create();
mocks.push(m)
}
let keys = provider.ssh_keys().unwrap();
assert_eq!(keys.len(), 2);
assert_eq!(keys[0].options, None);
assert_eq!(keys[0].comment, Some("root@example1".to_string()));
assert_eq!(keys[1].options, None);
assert_eq!(keys[1].comment, Some("root@example2".to_string()));
mockito::reset();
provider.ssh_keys().unwrap_err();
} | rust_cleaned_test_functions.jsonl/45107 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1312
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82805,
12631,
368,
341,
262,
1077,
5206,
9109,
284,
5264,
7693,
5179,
12320,
486,
1539,
5921,
1005,
15454,
543,
262,
9109,
6581,
284,
9109,
6581,
6678,
1288,
4543,
7,
15,
626,
262,
1077,
1376,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_promote_learner() -> Result<()> {
let mut set = ProgressSet::new(default_logger());
let default_progress = Progress::new(0, 256);
set.insert_voter(1, default_progress)?;
let pre = set.get(1).expect("Should have been inserted").clone();
assert!(
set.promote_learner(1).is_err(),
"Should return an error on invalid promote_learner."
);
assert!(
set.promote_learner(2).is_err(),
"Should return an error on invalid promote_learner."
);
assert_eq!(pre, *set.get(1).expect("Peer should not have been deleted"));
Ok(())
} | rust_cleaned_test_functions.jsonl/48662 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 308
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47877,
1272,
62,
93595,
368,
1464,
5714,
71698,
341,
286,
1077,
5206,
738,
284,
16033,
1649,
486,
931,
18978,
27413,
1423,
286,
1077,
1638,
27200,
284,
16033,
486,
931,
7,
15,
11,
220,
17,
20,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_remove_elements() {
let head = node(ListNode {
val: 1,
next: node(ListNode {
val: 2,
next: node(ListNode {
val: 6,
next: node(ListNode {
val: 3,
next: node(ListNode {
val: 4,
next: node(ListNode {
val: 5,
next: node(ListNode { val: 6, next: None }),
}),
}),
}),
}),
}),
});
let want = node(ListNode {
val: 1,
next: node(ListNode {
val: 2,
next: node(ListNode {
val: 3,
next: node(ListNode {
val: 4,
next: node(ListNode { val: 5, next: None }),
}),
}),
}),
});
assert_eq!(Solution::remove_elements(head, 6), want);
} | rust_cleaned_test_functions.jsonl/103210 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 801
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
22801,
368,
341,
286,
1077,
1968,
284,
2436,
78039,
341,
310,
1044,
25,
220,
16,
345,
310,
1790,
25,
2436,
78039,
341,
394,
1044,
25,
220,
17,
345,
394,
1790,
25,
2436,
78039,
341,
503,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_char() {
let value = edn!(
({
let mut map = BTreeMap::new();
map.insert('c', ());
map
})
);
assert_eq!(&Value::Nil, value.get("c").unwrap());
} | rust_cleaned_test_functions.jsonl/49325 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 133
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
9232,
368,
341,
262,
1077,
897,
284,
1578,
77,
33673,
286,
13861,
310,
1077,
5206,
2415,
284,
425,
6533,
2227,
486,
931,
543,
310,
2415,
7030,
492,
66,
516,
49323,
310,
2415,
198,
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 |
#[test]
fn test_longs() {
let app = built_with_version();
let longs = longs_and_visible_aliases(&app);
assert_eq!(longs.len(), 2);
assert_eq!(longs[0], "help");
assert_eq!(longs[1], "version");
let sc_longs = longs_and_visible_aliases(find_subcommand_with_path(&app, vec!["test"]));
assert_eq!(sc_longs.len(), 3);
assert_eq!(sc_longs[0], "path");
assert_eq!(sc_longs[1], "file");
assert_eq!(sc_longs[2], "help");
} | rust_cleaned_test_functions.jsonl/94 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 258
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
907,
13181,
368,
341,
286,
1077,
906,
284,
5798,
6615,
9438,
543,
286,
1077,
1293,
82,
284,
1293,
82,
8378,
34371,
90233,
2099,
676,
626,
286,
2060,
10714,
10297,
4825,
82,
19406,
1507,
220,
17,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_two() {
let dir = tempfile::tempdir().unwrap();
let status = command(&dir).arg("init").status().unwrap();
assert!(status.success());
assert!(dir.path().join(".protovend.yml").exists());
let status = command(&dir)
.arg("add")
.arg("https://github.com/Skyscanner/protovend-test-protos.git")
.status()
.unwrap();
assert!(status.success());
let status = command(&dir)
.arg("add")
.arg("git@github.com:Skyscanner/protovend-test-protos-fake.git")
.arg("-d=src/proto")
.arg("-p=path/to")
.arg("-f=^(a|b)c$")
.status()
.unwrap();
assert!(status.success());
let expected_contents = String::from(
"---\
\nmin_protovend_version: 4.2.0\
\nvendor:\
\n - url: \"git@github.com:Skyscanner/protovend-test-protos-fake.git\"\
\n branch: master\
\n proto_dir: src/proto\
\n proto_paths:\
\n - path/to\
\n filename_regex: ^(a|b)c$\
\n resolve_dependency: false\
\n - url: \"https://github.com/Skyscanner/protovend-test-protos.git\"\
\n branch: master\
\n proto_dir: proto\
\n proto_paths:\
\n - skyscanner/protovendtestprotos\
\n filename_regex: \".*\"\
\n resolve_dependency: false\n",
);
tests_utils::fs::assert_file_contents_eq(
expected_contents,
dir.path().join(".protovend.yml").as_path(),
);
} | rust_cleaned_test_functions.jsonl/79896 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 810
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
23241,
368,
341,
262,
1077,
5419,
284,
54819,
486,
3888,
3741,
1005,
15454,
543,
262,
1077,
2639,
284,
3210,
2099,
3741,
568,
858,
445,
2327,
1827,
2829,
1005,
15454,
1428,
262,
2060,
10297,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_state_store_reader_writer() {
let tmp_dir = TempPath::new();
let db = AptosDB::new_for_test(&tmp_dir);
let store = &db.state_store;
let address1 = AccountAddress::new([1u8; AccountAddress::LENGTH]);
let address2 = AccountAddress::new([2u8; AccountAddress::LENGTH]);
let address3 = AccountAddress::new([3u8; AccountAddress::LENGTH]);
let value1 = AccountStateBlob::from(vec![0x01]);
let value1_update = AccountStateBlob::from(vec![0x00]);
let value2 = AccountStateBlob::from(vec![0x02]);
let value3 = AccountStateBlob::from(vec![0x03]);
// Insert address1 with value 1 and verify new states.
let mut root = put_account_state_set(
store,
vec![(address1, value1.clone())],
0, /* version */
1, /* expected_nodes_created */
0, /* expected_nodes_retired */
0, /* expected_blobs_retired */
);
verify_value_and_proof(store, address1, Some(&value1), 0, root);
verify_value_and_proof(store, address2, None, 0, root);
verify_value_and_proof(store, address3, None, 0, root);
// verify new states.
root = put_account_state_set(
store,
vec![
(address1, value1_update.clone()),
(address2, value2.clone()),
(address3, value3.clone()),
],
1, /* version */
4, /* expected_nodes_created */
1, /* expected_nodes_retired */
1, /* expected_blobs_retired */
);
verify_value_and_proof(store, address1, Some(&value1_update), 1, root);
verify_value_and_proof(store, address2, Some(&value2), 1, root);
verify_value_and_proof(store, address3, Some(&value3), 1, root);
} | rust_cleaned_test_functions.jsonl/60442 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 723
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4387,
14809,
22306,
28908,
368,
341,
262,
1077,
4174,
4334,
284,
19944,
1820,
486,
931,
543,
262,
1077,
2927,
284,
96987,
436,
3506,
486,
931,
5478,
4452,
2099,
5173,
4334,
317,
262,
1077,
3553,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_docfreq1() {
let mut schema_builder = Schema::builder();
let text_field = schema_builder.add_text_field("text", TEXT);
let index = Index::create_in_ram(schema_builder.build());
let mut index_writer = index.writer_with_num_threads(1, 3_000_000).unwrap();
{
index_writer.add_document(doc!(text_field=>"a b c"));
index_writer.commit().unwrap();
}
{
{
let doc = doc!(text_field=>"a");
index_writer.add_document(doc);
}
{
let doc = doc!(text_field=>"a a");
index_writer.add_document(doc);
}
index_writer.commit().unwrap();
}
{
let doc = doc!(text_field=>"c");
index_writer.add_document(doc);
index_writer.commit().unwrap();
}
{
let reader = index.reader().unwrap();
let searcher = reader.searcher();
let term_a = Term::from_field_text(text_field, "a");
assert_eq!(searcher.doc_freq(&term_a), 3);
let term_b = Term::from_field_text(text_field, "b");
assert_eq!(searcher.doc_freq(&term_b), 1);
let term_c = Term::from_field_text(text_field, "c");
assert_eq!(searcher.doc_freq(&term_c), 2);
let term_d = Term::from_field_text(text_field, "d");
assert_eq!(searcher.doc_freq(&term_d), 0);
}
} | rust_cleaned_test_functions.jsonl/41942 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 811
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18869,
33540,
16,
368,
341,
286,
1077,
5206,
10802,
28532,
284,
12539,
486,
17850,
543,
286,
1077,
1467,
5013,
284,
10802,
28532,
1364,
4326,
5013,
445,
1318,
497,
15762,
317,
286,
1077,
1922,
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_selector_pseudo_last_of_type() -> Result {
let html = r#"
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>:last-of-type</title>
</head>
<body>
<dl>
<dt>dt1</dt>
<dd>dd1</dd>
<dd>dd2</dd>
<dd>dd3</dd>
<dt>dt2</dt>
<dd>dd4</dd>
<dt>dt3</dt>
<dd>dd5</dd>
<dd>dd6</dd>
</dl>
</body>
</html>
"#;
let root = Vis::load(html)?;
let dl = root.find("dl");
// :last-of-type
let type_child = dl.find(":last-of-type");
assert_eq!(type_child.length(), 2);
assert_eq!(type_child.text(), "dt3dd6");
// prevs
let type_child_prevs = type_child.prev_all(":last-of-type");
assert_eq!(type_child_prevs.length(), 1);
assert_eq!(type_child_prevs.text(), "dt3");
// nexts
let type_child_nexts = type_child.next_all(":last-of-type");
assert_eq!(type_child_nexts.length(), 1);
assert_eq!(type_child_nexts.text(), "dd6");
Ok(())
} | rust_cleaned_test_functions.jsonl/58028 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 540
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28890,
620,
21952,
12195,
3575,
1819,
368,
1464,
5714,
341,
10217,
5272,
284,
435,
2,
698,
262,
71341,
50139,
5272,
397,
262,
366,
1551,
8688,
428,
268,
881,
414,
366,
1983,
397,
286,
366,
5490,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_calculate_height() {
let buffer: Vec<char> = String::from("012345").chars().collect();
let mut line = InputLine::from_buffer(buffer);
assert_eq!(line.calculate_height(6, 2), 2);
// one extra line for the cursor
assert_eq!(line.calculate_height(6, 0), 2);
assert_eq!(line.calculate_height(3, 0), 3);
line.insert(3, ' ');
assert_eq!(line.calculate_height(6, 0), 2);
// Input containing lines that are longer than the width
let buffer: Vec<char> = String::from("01 3456").chars().collect();
let mut line = InputLine::from_buffer(buffer);
assert_eq!(line.calculate_height(3, 0), 3);
line.insert(line.len(), ' ');
// Each line should be:
assert_eq!(line.calculate_height(3, 0), 3);
line.insert(line.len(), '8');
line.insert(line.len(), '9');
line.insert(line.len(), 'X');
line.insert(line.len(), '1');
line.insert(line.len(), '2');
line.insert(line.len(), ' ');
line.insert(line.len(), '4');
// "01 3456 89X12 "
// Each line should be:
// "89X"
assert_eq!(line.calculate_height(3, 0), 6);
let buffer: Vec<char> = String::from("012345 78 X 12 34").chars().collect();
let mut line = InputLine::from_buffer(buffer);
// "78 X"
assert_eq!(line.calculate_height(4, 0), 5);
} | rust_cleaned_test_functions.jsonl/102101 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 796
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24005,
11207,
9561,
368,
341,
286,
1077,
4147,
25,
11312,
21919,
29,
284,
923,
486,
1499,
445,
15,
16,
17,
18,
19,
20,
1827,
19255,
1005,
17384,
543,
286,
1077,
5206,
1555,
284,
5571,
2460,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_no_header() {
let input: &[_] = b"[1, 2, 3]";
let mut reader = io::BufReader::new(StripHeaderReader::new(input));
let mut text = String::new();
reader.read_line(&mut text).ok();
assert_eq!(text, "[1, 2, 3]");
} | rust_cleaned_test_functions.jsonl/79088 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
8757,
368,
341,
262,
1077,
1946,
25,
609,
13496,
60,
284,
293,
36864,
16,
11,
220,
17,
11,
220,
18,
59757,
262,
1077,
5206,
6604,
284,
6399,
486,
15064,
5062,
486,
931,
7,
5901,
4047,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_statsd_client_time_duration_with_tags() {
let client = StatsdClient::from_sink("prefix", NopMetricSink);
let res = client
.time_with_tags("key", Duration::from_millis(157))
.with_tag("foo", "bar")
.with_tag_value("quux")
.try_send();
assert_eq!("prefix.key:157|ms|#foo:bar,quux", res.unwrap().as_metric_str());
} | rust_cleaned_test_functions.jsonl/10594 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 206
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15381,
67,
8179,
3009,
25454,
6615,
16333,
368,
341,
286,
1077,
2943,
284,
29927,
67,
2959,
486,
1499,
51567,
445,
11849,
497,
451,
453,
54310,
45094,
317,
286,
1077,
592,
284,
2943,
198,
310,
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_creation() {
assert!(PositiveNonzeroInteger::new(10).is_ok());
assert_eq!(
Err(CreationError::Negative),
PositiveNonzeroInteger::new(-10)
);
} | rust_cleaned_test_functions.jsonl/39792 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 90
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46163,
368,
341,
262,
2060,
10297,
35490,
8121,
14154,
3486,
486,
931,
7,
16,
15,
568,
285,
19817,
1423,
262,
2060,
10714,
33673,
286,
15495,
3025,
26453,
1454,
486,
38489,
1326,
286,
43903,
8121,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_pipe2() {
let (fd0, fd1) = pipe2(OFlag::O_CLOEXEC).unwrap();
let f0 = FdFlag::from_bits_truncate(fcntl(fd0, FcntlArg::F_GETFD).unwrap());
assert!(f0.contains(FdFlag::FD_CLOEXEC));
let f1 = FdFlag::from_bits_truncate(fcntl(fd1, FcntlArg::F_GETFD).unwrap());
assert!(f1.contains(FdFlag::FD_CLOEXEC));
} | rust_cleaned_test_functions.jsonl/9004 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 180
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41862,
17,
368,
341,
262,
1077,
320,
6902,
15,
11,
12414,
16,
8,
284,
13647,
17,
19238,
12135,
486,
46,
920,
1593,
46340,
568,
15454,
543,
262,
1077,
282,
15,
284,
434,
67,
12135,
486,
1499,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_args() {
let ctx = TestContext::new();
let con = ctx.connection();
redis::cmd("SET").arg("key1").arg(b"foo").execute(&con);
redis::cmd("SET").arg(["key2", "bar"][]).execute(&con);
assert_eq!(redis::cmd("MGET").arg(["key1", "key2"][]).query(&con),
Ok(("foo".to_string(), b"bar".to_vec())));
} | rust_cleaned_test_functions.jsonl/31503 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 163
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8384,
368,
341,
262,
1077,
5635,
284,
3393,
1972,
486,
931,
543,
262,
1077,
390,
284,
5635,
20310,
1428,
262,
20870,
486,
8710,
445,
5884,
1827,
858,
445,
792,
16,
1827,
858,
1883,
1,
7975,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_function_name_from_verb_and_path() {
let operation = WebOperation {
id: None,
path: "/horse".to_owned(),
verb: WebVerb::Get,
parameters: Vec::new(),
responses: IndexMap::new(),
examples: IndexMap::new(),
};
assert_eq!(None, operation.rust_module_name());
assert_eq!("get_horse", operation.rust_function_name());
} | rust_cleaned_test_functions.jsonl/10011 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 216
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9174,
1269,
5673,
62,
22328,
8378,
2638,
368,
341,
286,
1077,
5666,
284,
4895,
8432,
341,
310,
877,
25,
2240,
345,
310,
1815,
25,
3521,
59675,
3263,
983,
51973,
3148,
310,
18607,
25,
4895,
66946... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_diagnostics() {
let (mut runtime, state_snapshot, _) = setup(
false,
json!({
"target": "esnext",
"module": "esnext",
"noEmit": true,
}),
&[(
"file:///a.ts",
r#"console.log("hello deno");"#,
1,
LanguageId::TypeScript,
)],
);
let specifier = resolve_url("file:///a.ts").expect("could not resolve url");
let result = request(
&mut runtime,
state_snapshot,
RequestMethod::GetDiagnostics(vec![specifier]),
);
assert!(result.is_ok());
let response = result.unwrap();
assert_eq!(
response,
json!({
"file:///a.ts": [
{
"start": {
"line": 0,
"character": 0,
},
"end": {
"line": 0,
"character": 7
},
"fileName": "file:///a.ts",
"messageText": "Cannot find name 'console'. Do you need to change your target library? Try changing the \'lib\' compiler option to include 'dom'.",
"sourceLine": "console.log(\"hello deno\");",
"category": 1,
"code": 2584
}
]
})
);
} | rust_cleaned_test_functions.jsonl/23620 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 655
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
814,
18938,
368,
341,
262,
1077,
320,
6984,
15592,
11,
1584,
53265,
11,
27439,
284,
6505,
1006,
414,
895,
345,
414,
2951,
0,
2262,
286,
330,
5657,
788,
330,
288,
3600,
756,
286,
330,
435... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_define_error_code() {
define_error_codes!(
"KV:Raftstore:",
ENTRY_TOO_LARGE => ("EntryTooLarge", "", ""),
NOT_LEADER => ("NotLeader", "", "")
);
assert_eq!(
ENTRY_TOO_LARGE,
ErrorCode {
code: "KV:Raftstore:EntryTooLarge",
description: "",
workaround: "",
}
);
assert_eq!(
NOT_LEADER,
ErrorCode {
code: "KV:Raftstore:NotLeader",
description: "",
workaround: "",
}
);
} | rust_cleaned_test_functions.jsonl/24449 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 407
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51049,
4096,
4136,
368,
341,
286,
6979,
4096,
38482,
33673,
310,
330,
82707,
25,
55535,
723,
4314,
12147,
271,
310,
72792,
74555,
83861,
589,
3489,
5874,
31246,
34253,
497,
7342,
72712,
310,
4183,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_const() {
let mut c = Compiler::new("<unknown>", "");
c.add(Instruction::LoadConst(Value::from("a")));
c.add(Instruction::LoadConst(Value::from(42)));
c.add(Instruction::StringConcat);
insta::assert_debug_snapshot!(&c);
} | rust_cleaned_test_functions.jsonl/34189 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13610,
368,
341,
262,
1077,
5206,
272,
284,
45631,
486,
931,
9639,
16088,
21156,
50970,
262,
272,
1364,
7,
16664,
486,
5879,
19167,
25346,
486,
1499,
445,
64,
17621,
262,
272,
1364,
7,
16664,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_existing_edge_constraint() {
let mut cdt = CDT::new();
let v0 = cdt.insert(Point2::new(0.0, 0.0));
let v1 = cdt.insert(Point2::new(2.0, 2.0));
let v2 = cdt.insert(Point2::new(1.0, 0.0));
assert!(cdt.add_constraint(v0, v1));
assert!(cdt.add_constraint(v0, v2));
assert!(cdt.add_constraint(v1, v2));
for edge in cdt.edges() {
assert!(cdt.is_constraint_edge(edge.fix()));
}
assert!(!cdt.add_constraint(v1, v0));
assert!(!cdt.add_constraint(v1, v2));
assert_eq!(cdt.num_constraints, 3);
} | rust_cleaned_test_functions.jsonl/70751 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 350
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62630,
17932,
46973,
368,
341,
286,
1077,
5206,
272,
8047,
284,
356,
10599,
486,
931,
543,
286,
1077,
348,
15,
284,
272,
8047,
7030,
32737,
17,
486,
931,
7,
15,
13,
15,
11,
220,
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_leaf_split() {
let leaf = Leaf::new(String::from("1234"), 0, false);
let (left, right) = leaf.split(2);
assert_eq!("12", left.text());
assert_eq!("34", right.text());
} | rust_cleaned_test_functions.jsonl/14023 | {
"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,
38909,
17052,
368,
341,
286,
1077,
15933,
284,
26869,
486,
931,
2242,
486,
1499,
445,
16,
17,
18,
19,
3975,
220,
15,
11,
895,
317,
286,
1077,
320,
2359,
11,
1290,
8,
284,
15933,
5289,
7,
17,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_seq_set_item_refcnt() {
let obj = get_object();
Python::with_gil(|py| {
let v: Vec<i32> = vec![1, 2];
let ob = v.to_object(py);
let seq = ob.cast_as::<PySequence>(py).unwrap();
assert!(seq.set_item(1, &obj).is_ok());
assert!(seq[1].as_ptr() == obj.as_ptr());
});
Python::with_gil(|py| {
assert_eq!(1, obj.get_refcnt(py));
});
} | rust_cleaned_test_functions.jsonl/70316 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 270
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14486,
2602,
5634,
7793,
15853,
368,
341,
286,
1077,
2839,
284,
633,
5314,
1428,
286,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
341,
310,
1077,
348,
25,
11312,
21897,
18,
17,
29,
284,
7486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bitfields_second() {
let mut second: bindings::bitfields::Second = unsafe { mem::zeroed() };
assert!(unsafe { second.assert(0, false) });
second.set_thirty_one_bits(1337);
second.set_one_bit(true);
assert!(unsafe { second.assert(1337, true) });
} | rust_cleaned_test_functions.jsonl/27998 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13996,
9007,
29644,
368,
341,
262,
1077,
5206,
2086,
25,
35700,
486,
4489,
9007,
486,
15666,
284,
19860,
314,
1833,
486,
14154,
291,
368,
2605,
262,
2060,
10297,
38157,
314,
2086,
3713,
7,
15,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_array_out_of_range_positive() {
let c: Result<Color, _> = [1000, 10000, 256].try_into();
assert_eq!(c, Err(IntoColorError::IntConversion));
} | rust_cleaned_test_functions.jsonl/756 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 85
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
6068,
3575,
9698,
54160,
368,
341,
286,
1077,
272,
25,
5714,
88827,
11,
716,
29,
284,
508,
16,
15,
15,
15,
11,
220,
16,
15,
15,
15,
15,
11,
220,
17,
20,
21,
936,
1539,
45514,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_backward_with_gap() {
let mut masm = MacroAssembler::new();
let lbl = masm.create_label();
masm.bind_label(lbl);
masm.emit_u8(0x33);
masm.emit_label(lbl);
assert_eq!(vec![0x33, 0xfb, 0xff, 0xff, 0xff], masm.data());
} | rust_cleaned_test_functions.jsonl/17051 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 162
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70477,
6615,
51790,
368,
341,
286,
1077,
5206,
9243,
76,
284,
53317,
77858,
486,
931,
543,
286,
1077,
16421,
284,
9243,
76,
2520,
6106,
543,
286,
9243,
76,
6090,
6106,
70491,
317,
286,
9243,
76,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_doc_links_enum_variant() {
check(
r#"
enum E {
/// [E]
V<|> { field: i32 }
}
"#,
expect
"#]],
);
} | rust_cleaned_test_functions.jsonl/66151 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 310
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18869,
25258,
31054,
46112,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
9018,
468,
341,
262,
1048,
508,
36,
921,
262,
647,
27,
91,
29,
314,
2070,
25,
600,
18,
17,
456,
532,
57676,
345,
310,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_file_not_owned_by_euid() {
new_ucmd!()
.args(&["-f", "/bin/sh", "-a", "!", "-O", "/bin/sh"])
.succeeds();
} | rust_cleaned_test_functions.jsonl/11021 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 86
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2458,
7913,
51973,
3710,
2204,
2423,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
12,
69,
497,
3521,
6863,
14688,
497,
6523,
64,
497,
330,
18789,
6523,
46,
497,
3521,
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 |
#[test]
fn test_read_line() {
let in_buf = MemReader::new(Vec::from_slice(bytes!("a\nb\nc")));
let mut reader = BufferedReader::with_capacity(2, in_buf);
assert_eq!(reader.read_line(), Ok("a\n".to_owned()));
assert_eq!(reader.read_line(), Ok("b\n".to_owned()));
assert_eq!(reader.read_line(), Ok("c".to_owned()));
assert!(reader.read_line().is_err());
} | rust_cleaned_test_functions.jsonl/115537 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 194
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
6528,
368,
341,
286,
1077,
304,
10363,
284,
13550,
5062,
486,
931,
49923,
486,
1499,
26488,
23158,
17223,
64,
1699,
65,
59,
1016,
17621,
286,
1077,
5206,
6604,
284,
25568,
486,
4197,
35603,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_count_and2_c10_2() {
let m1 = 4*128;
let m2 = 4*1024;
let seed = 92;
let mut sum = 0;
let mut bset1 = Bitset::zeros(m1 * 32);
let mut bset2 = Bitset::zeros(m2 * 32);
let indexes_iter = (0..m1).map(|i| ((((i*31)%m2)+12284+seed)%m2) as u32);
let mut indexes = BitBlocks::from_iter(m1, indexes_iter);
indexes.cast_mut::<u32>()[0..m1].sort();
for i in 0..m1 {
for j in 0..32 {
let b1 = (((1123*(i*32+j)) % 3 + 51) % 3 + seed) % 3 == 1;
let b2 = (((8827*(i*32+j)) % 2 + 99) % 2 + seed) % 2 == 1;
bset1.set_bit(i*32+j, b1);
bset2.set_bit(*indexes.get::<u32>(i) as usize*32+j, b2);
if b1 && b2 { sum += 1; }
}
}
let indexes_ptr = indexes.as_ptr() as *const __m256i;
let bset1_ptr = bset1.as_ptr() as *const __m256i;
let bset2_ptr = bset2.as_ptr() as *const __m256i;
let sum_harley_seal1 = harley_seal64(&(indexes_ptr, bset1_ptr, bset2_ptr),
bset1.len(), load_and2_c10, (1, 1, 1, 1));
let sum_harley_seal2 = count_and2_c10(&indexes, &bset1, &bset2);
assert_eq!(sum, sum_harley_seal1);
assert_eq!(sum, sum_harley_seal2);
} | rust_cleaned_test_functions.jsonl/133207 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 784
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3180,
8378,
17,
666,
16,
15,
62,
17,
368,
341,
286,
1077,
296,
16,
284,
220,
19,
9,
16,
17,
23,
280,
286,
1077,
296,
17,
284,
220,
19,
9,
16,
15,
17,
19,
280,
286,
1077,
10320,
284,
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... | 5 |
#[test]
fn test_merge_nothing() {
let items = vec![
Path::new("a/b/c"),
Path::new("a/b2/d"),
];
//0 a/
//1 b/
//2 c
//3 b2/
//4 d
let tree =
FileTreeItems::new(&items, &BTreeSet::new()).unwrap();
let mut it = tree
.iterate(0, 10)
.map(|(_, item)| item.info().full_path_str());
assert_eq!(it.next().unwrap(), "a");
assert_eq!(it.next().unwrap(), "a/b");
assert_eq!(it.next().unwrap(), "a/b/c");
assert_eq!(it.next().unwrap(), "a/b2");
assert_eq!(it.next().unwrap(), "a/b2/d");
assert_eq!(it.next(), None);
} | rust_cleaned_test_functions.jsonl/129805 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 303
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20888,
6536,
1596,
368,
341,
197,
10217,
3589,
284,
7486,
90515,
298,
69640,
486,
931,
445,
64,
3470,
2899,
3975,
2303,
298,
69640,
486,
931,
445,
64,
3470,
17,
3446,
3975,
715,
197,
197,
4821,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cascade_following() {
let driver = fake::FakeDriver::default();
let mut gov = Governance::new(
fixture_for_following(),
driver.get_fake_env(),
driver.get_fake_ledger(),
);
gov.make_proposal(
&NeuronId { id: 1 },
// Must match neuron 1's serialized_id.
&principal(1),
&Proposal {
summary: "test".to_string(),
action: Some(proposal::Action::Motion(Motion {
motion_text: "dummy text".to_string(),
})),
..Default::default()
},
)
.unwrap();
// The fee should now be 1 ICPT since the fees are charged upfront.
assert_eq!(
gov.proto.neurons.get(&1).unwrap().neuron_fees_e8s,
100_000_000
);
// Once the proposal passes
// Check that the vote is registered in the proposing neuron.
assert_eq!(
&BallotInfo {
proposal_id: Some(ProposalId { id: 1 }),
vote: Vote::Yes as i32
},
gov.proto
.neurons
.get(&1)
.unwrap()
.recent_ballots
.get(0)
.unwrap()
);
// Check that the vote is registered in the proposal
assert_eq!(
(Vote::Yes as i32),
gov.get_proposal_data(ProposalId { id: 1 })
.unwrap()
.ballots
.get(&1)
.unwrap()
.vote
);
// Now vote yes for neurons 5 and 6.
fake::register_vote_assert_success(
&mut gov,
principal(5),
NeuronId { id: 5 },
ProposalId { id: 1 },
Vote::Yes,
);
fake::register_vote_assert_success(
&mut gov,
principal(6),
NeuronId { id: 6 },
ProposalId { id: 1 },
Vote::Yes,
);
// Check that the vote for neuron 2 is registered in the proposal
assert_eq!(
(Vote::Yes as i32),
gov.get_proposal_data(ProposalId { id: 1 })
.unwrap()
.ballots
.get(&2)
.unwrap()
.vote
);
// Check that neuron's vote is registered in the neuron
assert_eq!(
&BallotInfo {
proposal_id: Some(ProposalId { id: 1 }),
vote: Vote::Yes as i32
},
gov.proto
.neurons
.get(&2)
.unwrap()
.recent_ballots
.get(0)
.unwrap()
);
// The proposal should now be accepted and executed.
assert_eq!(
ProposalStatus::Executed,
gov.get_proposal_data(ProposalId { id: 1 })
.unwrap()
.status()
);
// After the proposal is accepted the Neuron 1 should have 0 fees again
assert_eq!(gov.proto.neurons.get(&1).unwrap().neuron_fees_e8s, 0);
} | rust_cleaned_test_functions.jsonl/1117 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1465
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
19977,
43490,
287,
368,
341,
262,
1077,
5579,
284,
12418,
486,
52317,
11349,
486,
2258,
543,
262,
1077,
5206,
47625,
284,
80589,
486,
931,
1006,
286,
12507,
5478,
43490,
287,
3148,
286,
5579,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_load_cfg() {
let cfg = load_cfg("config.yaml");
assert_eq!(cfg.timeout, 5000);
let mut pb = PathBuf::new();
pb.push("test_data");
assert_eq!(cfg.plot_dirs, vec![pb]);
} | rust_cleaned_test_functions.jsonl/111899 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12411,
18343,
368,
341,
286,
1077,
13286,
284,
2795,
18343,
445,
1676,
33406,
797,
286,
2060,
10714,
10297,
14072,
36110,
11,
220,
20,
15,
15,
15,
317,
286,
1077,
5206,
17310,
284,
7933,
15064,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_issuer_type_args_error() {
let (mut context, tx) = create_test_context(Action::Create, IssuerError::TypeArgsInvalid);
let tx = context.complete_tx(tx);
// run
let err = context.verify_tx(&tx, MAX_CYCLES).unwrap_err();
let script_cell_index = 0;
assert_error_eq!(
err,
ScriptError::ValidationFailure(TYPE_ARGS_INVALID).output_type_script(script_cell_index)
);
} | rust_cleaned_test_functions.jsonl/54749 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 182
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
62,
66817,
1819,
8384,
4096,
368,
341,
262,
1077,
320,
6984,
2266,
11,
9854,
8,
284,
1855,
4452,
8467,
21905,
486,
4021,
11,
15935,
8801,
1454,
486,
929,
4117,
7928,
626,
262,
1077,
9854,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_delete_repository_by_name() {
assert_eq!("DELETE FROM repositories WHERE name='rejasupotaro/cref'",
delete_repository_by_name("rejasupotaro/cref".to_string()));
} | rust_cleaned_test_functions.jsonl/33812 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 97
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11353,
47301,
3710,
1269,
368,
341,
286,
2060,
10714,
17223,
14424,
4295,
49657,
5288,
829,
1131,
265,
29726,
454,
354,
17165,
14,
837,
69,
38330,
310,
3698,
47301,
3710,
1269,
445,
265,
29726,
45... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_problem() {
let p = AtCoderProblem {
id: "id".to_owned(),
contest_id: "contest_id".to_owned(),
title: "title".to_owned(),
position: "A".to_owned(),
};
let p = convert_problem(p);
assert_eq!(p.id, "id".to_owned());
assert_eq!(p.contest_id, "contest_id".to_owned());
assert_eq!(p.title, "A. title".to_owned());
} | rust_cleaned_test_functions.jsonl/30010 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 236
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
60139,
368,
341,
286,
1077,
281,
284,
2411,
35290,
31198,
341,
310,
877,
25,
330,
307,
3263,
983,
51973,
3148,
310,
13810,
842,
25,
330,
65717,
842,
3263,
983,
51973,
3148,
310,
2265,
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_ffx_command() -> Result<(), Error> {
let item: ItemStruct = parse_quote! {pub struct EchoCommand {}};
let plugin: ItemType = parse_quote! {pub type FfxPluginCommand = EchoCommand;};
let result: WrappedCommand = parse2(ffx_command(item.clone()))?;
assert_eq!(item, result.original);
assert_eq!(plugin, result.plugin);
Ok(())
} | rust_cleaned_test_functions.jsonl/85693 | {
"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,
58708,
87,
10811,
368,
1464,
5714,
68843,
4600,
29,
341,
286,
1077,
1509,
25,
5739,
9422,
284,
4715,
45236,
0,
314,
9585,
2036,
37806,
4062,
4687,
2440,
286,
1077,
9006,
25,
73081,
284,
4715,
45... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_correct_recursive_extraction() {
init();
let raw_outer_schema = r#"{
"type": "record",
"name": "X",
"fields": [
{
"name": "y",
"type": {
"type": "record",
"name": "Y",
"fields": [
{
"name": "Z",
"type": "X"
}
]
}
}
]
}"#;
let outer_schema = Schema::parse_str(raw_outer_schema).unwrap();
if let Schema::Record {
fields: outer_fields,
..
} = outer_schema
{
let inner_schema = &outer_fields[0].schema;
if let Schema::Record {
fields: inner_fields,
..
} = inner_schema
{
if let Schema::Record {
name: recursive_type,
..
} = &inner_fields[0].schema
{
assert_eq!("X", recursive_type.name.as_str());
}
} else {
panic!("inner schema {:?} should have been a record", inner_schema)
}
} else {
panic!("outer schema {:?} should have been a record", outer_schema)
}
} | rust_cleaned_test_functions.jsonl/69024 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 803
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31550,
66242,
94842,
368,
341,
262,
2930,
543,
262,
1077,
7112,
67258,
25371,
284,
435,
55543,
515,
286,
330,
1313,
788,
330,
8548,
756,
286,
330,
606,
788,
330,
55,
756,
286,
330,
9007,
788,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_hover_non_ascii_space_doc() {
check(
"
/// <- `\u{3000}` here
fn foo() { }
fn bar() { fo$0o(); }
",
expect![[r#"
*foo*
```rust
test
```
```rust
fn foo()
```
---
\<- ` ` here
"#]],
);
} | rust_cleaned_test_functions.jsonl/66650 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 301
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53445,
21637,
50238,
14663,
18869,
368,
341,
286,
1779,
1006,
310,
6228,
2575,
22441,
45342,
91405,
84,
90,
18,
15,
15,
15,
5541,
1588,
198,
8822,
15229,
368,
314,
555,
8822,
3619,
368,
314,
117... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cv(){
const ALLOWED_ERROR: f64 = 0.1;
let mut nn = FeedForward::new(&[2, 2, 2]);
let mut data = DataSet::new();
data.push(&[0f64, 0f64], &[0f64, 0f64]);
data.push(&[1f64, 0f64], &[1f64, 0f64]);
data.push(&[0f64, 1f64], &[1f64, 0f64]);
data.push(&[1f64, 1f64], &[0f64, 0f64]);
data.push(&[0f64, 2f64], &[1f64, 0f64]);
data.push(&[1f64, 2f64], &[2f64, 0f64]);
data.push(&[2f64, 1f64], &[1f64, 0f64]);
data.divide(0.5);
nn.activation(activators::Type::Tanh)
.learning_rate(0.05)
.momentum(0.15)
.train(&data, 30_000);
println!("{:?}", data.cv(&mut nn));
} | rust_cleaned_test_functions.jsonl/84739 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 361
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43233,
3032,
262,
733,
72260,
1479,
5414,
25,
282,
21,
19,
284,
220,
15,
13,
16,
26,
715,
262,
1077,
5206,
10883,
284,
28870,
25925,
486,
931,
2099,
58,
17,
11,
220,
17,
11,
220,
17,
2558,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_help() {
// Test that global options are separated out in the help output
let test_env = TestEnvironment::default();
let stdout = test_env.jj_cmd_success(test_env.env_root(), &["edit", "-h"]);
insta::assert_snapshot!(stdout.replace(".exe", ""), @r###"
jj-edit
Edit the content changes in a revision
USAGE:
jj edit [OPTIONS]
OPTIONS:
-r, --revision <REVISION> The revision to edit [default: @]
GLOBAL OPTIONS:
--at-operation <AT_OPERATION> Operation to load the repo at [default: @] [aliases: at-op]
--color <WHEN> When to colorize output (always, never, auto)
-h, --help Print help information, more help with --help than with -h
--no-commit-working-copy Don't commit the working copy
-R, --repository <REPOSITORY> Path to repository to operate on
"###);
} | rust_cleaned_test_functions.jsonl/77492 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 420
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26926,
368,
341,
262,
442,
3393,
429,
3644,
2606,
525,
18663,
700,
304,
279,
1492,
2550,
198,
262,
1077,
1273,
15879,
284,
3393,
12723,
486,
2258,
1428,
262,
1077,
20075,
284,
1273,
15879,
1169,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_local_from_def_did_you_mean() {
assert::fail(
"def f(discreet): return discrete",
"Variable `discrete` not found, did you mean `discreet`?",
);
} | rust_cleaned_test_functions.jsonl/92445 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 85
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13564,
5673,
7844,
814,
307,
70456,
16933,
368,
341,
262,
2060,
486,
18403,
1006,
286,
330,
750,
282,
16361,
837,
295,
1648,
470,
43179,
756,
286,
330,
7827,
1565,
4243,
9353,
63,
537,
1730,
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 |
#[test]
fn test_frozen_account_data_modified() {
let frozen_pubkey =
Pubkey::from_str("My11111111111111111111111111111111111111111").unwrap();
let mut db = AccountsDB::new(Vec::new(), &ClusterType::Development);
let mut account = Account::new(1, 42, &frozen_pubkey);
db.store_uncached(0, &[(&frozen_pubkey, &account)]);
let ancestors = vec![(0, 0)].into_iter().collect();
db.freeze_accounts(&ancestors, &[frozen_pubkey]);
account.data[0] = 42;
db.store_uncached(0, &[(&frozen_pubkey, &account)]);
} | rust_cleaned_test_functions.jsonl/60891 | {
"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,
761,
42240,
13500,
1769,
37749,
368,
341,
286,
1077,
19690,
34014,
792,
4035,
310,
22611,
792,
486,
1499,
2895,
445,
5050,
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... | 1 |
#[test]
fn test_from_str() {
let uuid_str = "c1aa1e3b-9614-4895-9ebd-705255fa5bc2";
let uuid_wrapper = UUID::from_str(uuid_str).unwrap();
assert_eq!(uuid_str, uuid_wrapper.to_string())
} | rust_cleaned_test_functions.jsonl/8210 | {
"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,
5673,
2895,
368,
341,
286,
1077,
16040,
2895,
284,
330,
66,
16,
5305,
16,
68,
18,
65,
12,
24,
21,
16,
19,
12,
19,
23,
24,
20,
12,
24,
3065,
67,
12,
22,
15,
20,
17,
20,
20,
3632,
20,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_smoke_single_command() {
equal_tokens! {
<nodes>
"git add ." -> b::token_list(vec![b::bare("git"), b::sp(), b::bare("add"), b::sp(), b::op(".")])
}
equal_tokens! {
<nodes>
"open Cargo.toml" -> b::token_list(vec![b::bare("open"), b::sp(), b::bare("Cargo"), b::op("."), b::bare("toml")])
}
equal_tokens! {
<nodes>
"select package.version" -> b::token_list(vec![b::bare("select"), b::sp(), b::bare("package"), b::op("."), b::bare("version")])
}
equal_tokens! {
<nodes>
"echo $it" -> b::token_list(vec![b::bare("echo"), b::sp(), b::var("it")])
}
equal_tokens! {
<nodes>
"open Cargo.toml --raw" -> b::token_list(vec![b::bare("open"), b::sp(), b::bare("Cargo"), b::op("."), b::bare("toml"), b::sp(), b::flag("raw")])
}
equal_tokens! {
<nodes>
"open Cargo.toml -r" -> b::token_list(vec![b::bare("open"), b::sp(), b::bare("Cargo"), b::op("."), b::bare("toml"), b::sp(), b::shorthand("r")])
}
equal_tokens! {
<nodes>
"config --set tabs 2" -> b::token_list(vec![b::bare("config"), b::sp(), b::flag("set"), b::sp(), b::bare("tabs"), b::sp(), b::int(2)])
}
equal_tokens! {
<nodes>
"inc --patch package.version" -> b::token_list(
vec![
b::bare("inc"),
b::sp(),
b::flag("patch"),
b::sp(),
b::bare("package"), b::op("."), b::bare("version")
]
)
}
} | rust_cleaned_test_functions.jsonl/5871 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 987
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15874,
4740,
19487,
10811,
368,
341,
286,
6144,
28838,
0,
341,
310,
366,
20008,
397,
310,
330,
12882,
912,
41348,
1464,
293,
486,
5839,
2019,
25592,
20703,
65,
486,
54102,
445,
12882,
3975,
293,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_state_store_reader_writer() {
let tmp_dir = TempPath::new();
let db = LibraDB::new(&tmp_dir);
let store = &db.state_store;
let address1 = AccountAddress::new([1u8; ADDRESS_LENGTH]);
let address2 = AccountAddress::new([2u8; ADDRESS_LENGTH]);
let address3 = AccountAddress::new([3u8; ADDRESS_LENGTH]);
let value1 = AccountStateBlob::from(vec![0x01]);
let value1_update = AccountStateBlob::from(vec![0x00]);
let value2 = AccountStateBlob::from(vec![0x02]);
let value3 = AccountStateBlob::from(vec![0x03]);
// Insert address1 with value 1 and verify new states.
let mut root = put_account_state_set(
store,
vec![(address1, value1.clone())],
0, /* version */
1, /* expected_nodes_created */
0, /* expected_nodes_retired */
0, /* expected_blobs_retired */
);
verify_state_in_store(store, address1, Some(&value1), 0, root);
verify_state_in_store(store, address2, None, 0, root);
verify_state_in_store(store, address3, None, 0, root);
// verify new states.
root = put_account_state_set(
store,
vec![
(address1, value1_update.clone()),
(address2, value2.clone()),
(address3, value3.clone()),
],
1, /* version */
4, /* expected_nodes_created */
1, /* expected_nodes_retired */
1, /* expected_blobs_retired */
);
verify_state_in_store(store, address1, Some(&value1_update), 1, root);
verify_state_in_store(store, address2, Some(&value2), 1, root);
verify_state_in_store(store, address3, Some(&value3), 1, root);
} | rust_cleaned_test_functions.jsonl/77835 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 721
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4387,
14809,
22306,
28908,
368,
341,
262,
1077,
4174,
4334,
284,
19944,
1820,
486,
931,
543,
262,
1077,
2927,
284,
5688,
956,
3506,
486,
931,
2099,
5173,
4334,
317,
262,
1077,
3553,
284,
609,
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_is_ntp_not_synced() {
let s = r#"b false"#;
assert_eq!(parse_ntp_synced(s), Some(time::Synced::Unsynced));
} | rust_cleaned_test_functions.jsonl/14475 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 83
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
38945,
79,
7913,
23008,
291,
368,
341,
286,
1077,
274,
284,
435,
55543,
65,
895,
57676,
401,
286,
2060,
10714,
10297,
6400,
38945,
79,
23008,
291,
1141,
701,
4329,
9730,
486,
12154,
291,
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 |
#[test]
fn test_u32() {
assert_eq!(
u32::from_record(&Record::Int(25_u32.to_bigint().unwrap())),
Ok(25)
);
assert_eq!(
u32::from_record(&Record::Int(0xab.to_bigint().unwrap())),
Ok(0xab)
);
assert_eq!(
u32::from_record(&Record::Int(0xabcdef.to_bigint().unwrap())),
Ok(0xabcdef)
);
assert_eq!(
u32::from_record(&Record::Int((-0xabcdef).to_bigint().unwrap())),
Err("cannot convert -11259375 to u32".to_string())
);
} | rust_cleaned_test_functions.jsonl/8007 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 274
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7300,
18,
17,
368,
341,
262,
2060,
10714,
33673,
286,
575,
18,
17,
486,
1499,
14192,
2099,
6471,
486,
1072,
7,
17,
20,
7300,
18,
17,
2389,
36386,
396,
1005,
15454,
73727,
286,
7622,
7,
17,
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_naive(){
let epsilon = 1.3;
let outcomes = (0..10).collect();
let rng = GeneratorOpenSSL {};
fn utility_fn(x: &i64)->f64 { *x as f64 }
let result = naive_exponential_mechanism(epsilon, &outcomes, utility_fn, rng);
assert!(result.is_ok());
} | rust_cleaned_test_functions.jsonl/28509 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 155
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58631,
533,
3032,
286,
1077,
31204,
284,
220,
16,
13,
18,
280,
286,
1077,
19554,
284,
320,
15,
496,
16,
15,
568,
17384,
543,
286,
1077,
28422,
284,
28358,
5002,
22594,
9321,
286,
5168,
15549,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bug_merge() {
let mut schema_builder = schema::Schema::builder();
let int_field = schema_builder.add_u64_field("intvals", INDEXED);
let index = Index::create_in_ram(schema_builder.build());
let mut index_writer = index.writer_with_num_threads(1, 3_000_000).unwrap();
index_writer.add_document(doc!(int_field => 1u64));
index_writer.commit().expect("commit failed");
index_writer.add_document(doc!(int_field => 1u64));
index_writer.commit().expect("commit failed");
let reader = index.reader().unwrap();
let searcher = reader.searcher();
assert_eq!(searcher.num_docs(), 2);
index_writer.delete_term(Term::from_field_u64(int_field, 1));
let segment_ids = index
.searchable_segment_ids()
.expect("Searchable segments failed.");
index_writer
.merge(&segment_ids)
.expect("Failed to initiate merge")
.wait()
.expect("Merging failed");
reader.reload().unwrap();
// commit has not been called yet. The document should still be
// there.
assert_eq!(reader.searcher().num_docs(), 2);
} | rust_cleaned_test_functions.jsonl/107477 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 542
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73232,
20888,
368,
341,
286,
1077,
5206,
10802,
28532,
284,
10802,
486,
8632,
486,
17850,
543,
286,
1077,
526,
5013,
284,
10802,
28532,
1364,
7300,
21,
19,
5013,
445,
396,
25596,
497,
39300,
1479,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_single_wildcard_diff_prefixes() {
check_assist(
merge_imports,
r"
use std<|>::cell::*;
use std::str;
",
r"
use std::{cell::*, str};
",
)
} | rust_cleaned_test_functions.jsonl/93999 | {
"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,
20888,
19487,
1670,
695,
4951,
15850,
13974,
288,
368,
341,
286,
1779,
12083,
380,
1006,
310,
10880,
18434,
82,
345,
310,
435,
698,
810,
1460,
27,
91,
6831,
5873,
56162,
810,
1460,
486,
495,
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 |
#[test]
fn test_local_close() {
let mut ctx = CsmTestContext::new_established();
let mut stream = TestStream::new();
stream.read_state = StreamState::Closed;
ctx.set_stream(stream);
ctx.notify_epollin();
ctx.recv();
// the no-more-send and the no-more-recv indications.
assert_eq!(ctx.pkt.op(), uapi::VSOCK_OP_SHUTDOWN);
assert_ne!(ctx.pkt.flags() & uapi::VSOCK_FLAGS_SHUTDOWN_SEND, 0);
assert_ne!(ctx.pkt.flags() & uapi::VSOCK_FLAGS_SHUTDOWN_RCV, 0);
// The kill timer should now be armed.
assert!(ctx.conn.will_expire());
assert!(
ctx.conn.expiry().unwrap()
< Instant::now() + Duration::from_millis(defs::CONN_SHUTDOWN_TIMEOUT_MS)
);
} | rust_cleaned_test_functions.jsonl/83288 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 410
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13564,
12704,
368,
341,
286,
1077,
5206,
5635,
284,
356,
3563,
2271,
1972,
486,
931,
18583,
5102,
291,
543,
286,
1077,
5206,
4269,
284,
3393,
3027,
486,
931,
543,
286,
4269,
4125,
4387,
284,
920... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_white_pawn_push() {
let position = PositionBuilder::new()
.place(Square::E3, Piece::WhitePawn, Color::White)
.build();
let moves = MoveGenerator::new().moves(&position);
assert_targets(&[Square::E4], &moves);
// Double pawn push works and has the right move type
let position = PositionBuilder::new()
.place(Square::E2, Piece::WhitePawn, Color::White)
.build();
let moves = MoveGenerator::new().moves(&position);
assert_moves(
&[
Move { kind: MoveKind::Move, from: Square::E2, to: Square::E3 },
Move {
kind: MoveKind::DoublePawnPush,
from: Square::E2,
to: Square::E4,
},
],
&moves,
);
// Double pawn push is blocked if single pawn push is blocked
let position = PositionBuilder::new()
.place(Square::E2, Piece::WhitePawn, Color::White)
.place(Square::E3, Piece::BlackPawn, Color::Black)
.build();
let moves = MoveGenerator::new().moves(&position);
assert_targets(&[], &moves);
} | rust_cleaned_test_functions.jsonl/134608 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 448
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44431,
620,
6379,
14218,
368,
341,
262,
1077,
2309,
284,
12380,
3297,
486,
931,
741,
414,
659,
2007,
3759,
5151,
486,
36,
18,
11,
28930,
486,
14075,
85313,
11,
3478,
486,
14075,
340,
414,
659,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_end_of_bilou_slot() {
// Given
let tags = &[
OUTSIDE.to_string(),
LAST_PREFIX.to_string(),
UNIT_PREFIX.to_string(),
BEGINNING_PREFIX.to_string(),
UNIT_PREFIX.to_string(),
INSIDE_PREFIX.to_string(),
LAST_PREFIX.to_string(),
LAST_PREFIX.to_string(),
UNIT_PREFIX.to_string(),
UNIT_PREFIX.to_string(),
LAST_PREFIX.to_string(),
OUTSIDE.to_string(),
INSIDE_PREFIX.to_string(),
BEGINNING_PREFIX.to_string(),
OUTSIDE.to_string(),
BEGINNING_PREFIX.to_string(),
INSIDE_PREFIX.to_string(),
INSIDE_PREFIX.to_string(),
LAST_PREFIX.to_string(),
];
// When
let ends_of_bilou = tags
.iter()
.enumerate()
.map(|(i, _)| is_end_of_bilou_slot(tags, i))
.collect_vec();
// Then
let expected_ends = [
false, true, true, true, true, false, true, true, true, true, true, false, true, true,
false, false, false, false, true,
];
assert_eq!(ends_of_bilou, expected_ends);
} | rust_cleaned_test_functions.jsonl/55317 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 720
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
6213,
3575,
880,
321,
283,
27563,
368,
341,
286,
442,
16246,
198,
286,
1077,
9492,
284,
609,
9640,
310,
9808,
73673,
2389,
3904,
3148,
310,
47295,
18519,
2389,
3904,
3148,
310,
38202,
18519,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_event_notification() {
let mut fixture = setup_language_server();
let mut events = Box::pin(fixture.client.events());
events.expect_pending();
let root_id = uuid::Uuid::parse_str("00000000-0000-0000-0000-000000000000");
let root_id = root_id.expect("Couldn't parse uuid.");
let expected_event = FileEvent {
path: Path { root_id, segments: vec!["Main.txt".into()] },
kind: FileEventKind::Modified,
};
let notification_text = r#"{
"jsonrpc": "2.0",
"method": "file/event",
"params": {
"path" : {
"rootId" : "00000000-0000-0000-0000-000000000000",
"segments" : ["Main.txt"]
},
"kind" : "Modified"
}
}"#;
fixture.transport.mock_peer_text_message(notification_text);
events.expect_pending();
fixture.executor.run_until_stalled();
if let Event::Notification(n) = events.expect_next() {
assert_eq!(n, Notification::FileEvent(expected_event));
} else {
panic!("expected notification event");
}
} | rust_cleaned_test_functions.jsonl/32826 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 537
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2458,
6748,
34296,
368,
341,
262,
1077,
5206,
12507,
284,
6505,
29021,
12015,
543,
262,
1077,
5206,
4357,
284,
8261,
486,
13273,
94886,
6581,
18133,
1423,
262,
4357,
25952,
37861,
1428,
262,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_day_22() {
let board = input();
assert_eq!(part_1(board, 10000), 5447);
let input = input();
assert_eq!(part_2(input, 10000000), 2511705);
} | rust_cleaned_test_functions.jsonl/32453 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16763,
62,
17,
17,
368,
341,
286,
1077,
4479,
284,
1946,
543,
286,
2060,
10714,
10297,
4480,
62,
16,
20770,
11,
220,
16,
15,
15,
15,
15,
701,
220,
20,
19,
19,
22,
317,
286,
1077,
1946,
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_merge_self_fails() {
let invoke_context = ThisInvokeContext::new_mock(&[], &[]);
let stake_address = Pubkey::new_unique();
let authority_pubkey = Pubkey::new_unique();
let signers = HashSet::from_iter(vec![authority_pubkey]);
let rent = Rent::default();
let rent_exempt_reserve = rent.minimum_balance(std::mem::size_of::<StakeState>());
let stake_amount = 4242424242;
let stake_lamports = rent_exempt_reserve + stake_amount;
let meta = Meta {
rent_exempt_reserve,
..Meta::auto(&authority_pubkey)
};
let stake = Stake {
delegation: Delegation {
stake: stake_amount,
activation_epoch: 0,
..Delegation::default()
},
..Stake::default()
};
let stake_account = AccountSharedData::new_ref_data_with_space(
stake_lamports,
&StakeState::Stake(meta, stake),
std::mem::size_of::<StakeState>(),
&id(),
)
.expect("stake_account");
let stake_keyed_account = KeyedAccount::new(&stake_address, true, &stake_account);
assert_eq!(
stake_keyed_account.merge(
&invoke_context,
&stake_keyed_account,
&Clock::default(),
&StakeHistory::default(),
&signers,
false,
),
Err(InstructionError::InvalidArgument),
);
} | rust_cleaned_test_functions.jsonl/15323 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 801
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20888,
25637,
761,
6209,
368,
341,
286,
1077,
19873,
8467,
284,
1096,
17604,
1972,
486,
931,
34134,
2099,
12995,
609,
56703,
286,
1077,
18279,
6744,
284,
22611,
792,
486,
931,
21218,
543,
286,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_retry() {
struct MockClient {
cluster: RwLock<(Mutex<usize>, Instant)>,
}
#[async_trait]
impl Reconnect for MockClient {
type Cl = Mutex<usize>;
async fn reconnect(&self, _: u64) -> Result<()> {
Ok(())
}
}
async fn retry_max_err(
client: Arc<MockClient>,
max_retries: Arc<Mutex<usize>>,
) -> Result<()> {
retry!(client, "test", |c| {
let mut c = c.lock().unwrap();
*c += 1;
let mut max_retries = max_retries.lock().unwrap();
*max_retries -= 1;
if *max_retries == 0 {
ready(Ok(()))
} else {
ready(Err(internal_err!("whoops")))
}
})
}
async fn retry_max_ok(
client: Arc<MockClient>,
max_retries: Arc<Mutex<usize>>,
) -> Result<()> {
retry!(client, "test", |c| {
let mut c = c.lock().unwrap();
*c += 1;
let mut max_retries = max_retries.lock().unwrap();
*max_retries -= 1;
if *max_retries == 0 {
ready(Ok(()))
} else {
ready(Err(internal_err!("whoops")))
}
})
}
executor::block_on(async {
let client = Arc::new(MockClient {
cluster: RwLock::new((Mutex::new(0), Instant::now())),
});
let max_retries = Arc::new(Mutex::new(1000));
assert!(retry_max_err(client.clone(), max_retries).await.is_err());
assert_eq!(
*client.cluster.read().await.0.lock().unwrap(),
LEADER_CHANGE_RETRY
);
let client = Arc::new(MockClient {
cluster: RwLock::new((Mutex::new(0), Instant::now())),
});
let max_retries = Arc::new(Mutex::new(2));
assert!(retry_max_ok(client.clone(), max_retries).await.is_ok());
assert_eq!(*client.cluster.read().await.0.lock().unwrap(), 2);
})
} | rust_cleaned_test_functions.jsonl/9520 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1324
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62745,
368,
341,
286,
2036,
14563,
2959,
341,
310,
10652,
25,
55294,
11989,
28706,
38099,
90244,
8066,
18058,
8,
12520,
286,
555,
286,
11506,
7692,
78491,
921,
286,
11605,
1032,
6459,
369,
14563,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hw33() {
assert_eq!(
compute_hw(
&OffsetInfo { hw: 0, leo: 10 },
3,
&offsets_maps(vec![
(5001, OffsetInfo::default()),
(5002, OffsetInfo::default()),
])
),
None
);
// need at least 2 replicas
assert_eq!(
compute_hw(
&OffsetInfo { leo: 10, hw: 0 },
3,
&offsets_maps(vec![
(5001, OffsetInfo { leo: 4, hw: 0 }),
(5002, OffsetInfo::default())
])
),
None
);
// 4 is min offset
assert_eq!(
compute_hw(
&OffsetInfo { leo: 10, hw: 0 },
3,
&offsets_maps(vec![
(5001, OffsetInfo { leo: 4, hw: 0 }),
(5002, OffsetInfo { leo: 7, hw: 0 }),
])
),
Some(4)
);
// no hw update since nothing with 2 followers has replicated
assert_eq!(
compute_hw(
&OffsetInfo { leo: 10, hw: 7 },
3,
&offsets_maps(vec![
(5001, OffsetInfo { leo: 7, hw: 6 }),
(5002, OffsetInfo { leo: 8, hw: 6 }),
])
),
None
);
// leader can progress to 8
assert_eq!(
compute_hw(
&OffsetInfo { leo: 10, hw: 7 },
3,
&offsets_maps(vec![
(5001, OffsetInfo { leo: 9, hw: 6 }),
(5002, OffsetInfo { leo: 8, hw: 6 }),
])
),
Some(8)
);
} | rust_cleaned_test_functions.jsonl/1569 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1226
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28792,
18,
18,
368,
341,
286,
2060,
10714,
33673,
310,
12564,
28792,
1006,
394,
609,
6446,
1731,
314,
31256,
25,
220,
15,
11,
88501,
25,
220,
16,
15,
1153,
394,
220,
18,
345,
394,
609,
3176,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_filter_manager_label() {
let id_id = 1;
let age_id = 2;
let label_id = -1000;
let mut eq_compare = message::LogicalCompare::new();
eq_compare.set_prop_id(label_id);
eq_compare.set_compare(message::CompareType::EQ);
eq_compare.set_field_type(VariantType::VT_LONG);
let mut compare_value = Value::new();
compare_value.set_value_type(VariantType::VT_LONG);
compare_value.set_long_value(100);
eq_compare.set_value(compare_value);
let compare_list = vec![eq_compare];
let filter_manager = FilterManager::new(&compare_list, Arc::new(LocalGraphSchema::new(Arc::new(build_modern_mock_schema()))));
let v1 = LocalStoreVertex::new(1, 1);
let mut vm1 = RawMessage::from_vertex(v1);
vm1.add_native_property(id_id, Property::Long(1));
vm1.add_native_property(age_id, Property::Int(29));
vm1.add_label_entity(RawMessage::from_value(ValuePayload::Long(100)), label_id);
assert_eq!(true, filter_manager.filter_message(&vm1));
let v2 = LocalStoreVertex::new(1, 1);
let mut vm2 = RawMessage::from_vertex(v2);
vm2.add_native_property(id_id, Property::Long(1));
vm2.add_native_property(age_id, Property::Int(29));
vm2.add_label_entity(RawMessage::from_value(ValuePayload::Long(1000)), label_id);
assert_eq!(false, filter_manager.filter_message(&vm2));
let v3 = LocalStoreVertex::new(1, 1);
let mut vm3 = RawMessage::from_vertex(v3);
vm3.add_native_property(id_id, Property::Long(1));
vm3.add_native_property(age_id, Property::Int(29));
assert_eq!(false, filter_manager.filter_message(&vm3));
} | rust_cleaned_test_functions.jsonl/43858 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 783
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8727,
12144,
6106,
368,
341,
286,
1077,
877,
842,
284,
220,
16,
280,
286,
1077,
4231,
842,
284,
220,
17,
280,
286,
1077,
2383,
842,
284,
481,
16,
15,
15,
15,
401,
286,
1077,
5206,
8939,
3223... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rrb_backend() {
let backends: Vec<Backend> = vec![
Backend::new(Server::new(
FromStr::from_str("http://127.0.0.1:6000").unwrap(),
false,
)),
Backend::new(Server::new(
FromStr::from_str("http://127.0.0.1:6001").unwrap(),
false,
)),
];
let mut rrb = InnerPool::new(backends);
assert_eq!(2, rrb.backends.len());
let first = rrb.get().unwrap();
let second = rrb.get().unwrap();
let third = rrb.get().unwrap();
let fourth = rrb.get().unwrap();
assert_eq!(first, third);
assert_eq!(second, fourth);
assert!(first != second);
} | rust_cleaned_test_functions.jsonl/13910 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 408
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56285,
65,
40011,
368,
341,
286,
1077,
1182,
1412,
25,
11312,
27,
29699,
29,
284,
7486,
90515,
310,
55260,
486,
931,
54489,
486,
931,
1006,
394,
5542,
2580,
486,
1499,
2895,
445,
1254,
1110,
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_symlink_circular() {
let (at, mut ucmd) = at_and_ucmd!();
let link = "test_symlink_circular";
ucmd.args(&["-s", link]).succeeds().no_stderr();
assert!(at.is_symlink(link));
assert_eq!(at.resolve_link(link), link);
} | rust_cleaned_test_functions.jsonl/4881 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58530,
44243,
666,
21472,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
1077,
2656,
284,
330,
1944,
58530,
44243,
666,
21472,
3302,
262,
575,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_prover_handle_verify_presentation_message_from_presentation_request_sent_state() {
let _setup = SetupAriesMocks::init();
let mut verifier_sm = _verifier_sm();
verifier_sm = verifier_sm.step(VerifierMessages::SendPresentationRequest(mock_connection())).unwrap();
verifier_sm = verifier_sm.step(VerifierMessages::VerifyPresentation(_presentation())).unwrap();
assert_match!(VerifierState::Finished(_), verifier_sm.state);
assert_eq!(Status::Success.code(), verifier_sm.presentation_status());
} | rust_cleaned_test_functions.jsonl/57247 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 246
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2540,
423,
10630,
35638,
620,
13584,
6462,
5673,
620,
13584,
7893,
24115,
4387,
368,
341,
310,
1077,
716,
15188,
284,
18626,
32,
4019,
72577,
486,
2327,
1428,
310,
1077,
5206,
88737,
15874,
284,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_url_serialization() -> Result<(), failure::Error> {
let info_hash = "test";
let peer_id = "CN1";
let tracker_id = None;
let port = 1000;
let torrent_state = &TorrentState {
uploaded: 0,
downloaded: 0,
left: 1000,
};
let num_peers = 10;
let event = Some(Event::Started);
let req = Request {
base: Url::parse("https://localhost/announce")?,
info_hash,
peer_id,
tracker_id,
port,
torrent_state,
num_peers,
event,
};
let url = req.into_url()?;
let mut pairs = url.query_pairs();
assert_eq!(
pairs.next(),
Some((Cow::Borrowed("peer_id"), Cow::Borrowed("CN1")))
);
assert_eq!(
pairs.next(),
Some((Cow::Borrowed("port"), Cow::Borrowed("1000")))
);
assert_eq!(
pairs.next(),
Some((Cow::Borrowed("uploaded"), Cow::Borrowed("0")))
);
assert_eq!(
pairs.next(),
Some((Cow::Borrowed("downloaded"), Cow::Borrowed("0")))
);
assert_eq!(
pairs.next(),
Some((Cow::Borrowed("left"), Cow::Borrowed("1000")))
);
assert_eq!(
pairs.next(),
Some((Cow::Borrowed("numwant"), Cow::Borrowed("10")))
);
assert_eq!(
pairs.next(),
Some((Cow::Borrowed("event"), Cow::Borrowed("started")))
);
assert_eq!(
pairs.next(),
Some((Cow::Borrowed("info_hash"), Cow::Borrowed("test")))
);
assert_eq!(
pairs.next(),
Some((Cow::Borrowed("compact"), Cow::Borrowed("1")))
);
assert_eq!(pairs.next(), None);
Ok(())
} | rust_cleaned_test_functions.jsonl/126245 | {
"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,
2903,
25602,
2022,
368,
1464,
5714,
68843,
7901,
486,
1454,
29,
341,
286,
1077,
3546,
8950,
284,
330,
1944,
876,
286,
1077,
14397,
842,
284,
330,
28668,
16,
876,
286,
1077,
28331,
842,
284,
2240... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_valid_price() {
assert_eq!(
parse_price("P 2017-01-01 EUR SEK 9.552532877").unwrap(),
(
"",
Price {
commodity: "EUR".to_string(),
date: NaiveDate::from_ymd(2017, 1, 1),
amount: Amount {
currency: "SEK".to_string(),
value: dec!(9.552532877),
}
}
)
)
} | rust_cleaned_test_functions.jsonl/59642 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 342
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8337,
9040,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
9040,
445,
47,
220,
17,
15,
16,
22,
12,
15,
16,
12,
15,
16,
37088,
5052,
42,
220,
24,
13,
20,
20,
17,
20,
18,
17,
23,
22,
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_output_to_default_log() {
let message = CString::new("Hello!").unwrap();
unsafe {
wrapped_os_log_debug(wrapped_get_default_log(), message.as_ptr());
wrapped_os_log_info(wrapped_get_default_log(), message.as_ptr());
wrapped_os_log_default(wrapped_get_default_log(), message.as_ptr());
wrapped_os_log_error(wrapped_get_default_log(), message.as_ptr());
wrapped_os_log_fault(wrapped_get_default_log(), message.as_ptr());
wrapped_os_log_with_type(
wrapped_get_default_log(),
OS_LOG_TYPE_DEBUG,
message.as_ptr(),
);
wrapped_os_log_with_type(
wrapped_get_default_log(),
OS_LOG_TYPE_INFO,
message.as_ptr(),
);
wrapped_os_log_with_type(
wrapped_get_default_log(),
OS_LOG_TYPE_DEFAULT,
message.as_ptr(),
);
wrapped_os_log_with_type(
wrapped_get_default_log(),
OS_LOG_TYPE_ERROR,
message.as_ptr(),
);
wrapped_os_log_with_type(
wrapped_get_default_log(),
OS_LOG_TYPE_FAULT,
message.as_ptr(),
);
}
} | rust_cleaned_test_functions.jsonl/125806 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 771
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7645,
2346,
9993,
5224,
368,
341,
286,
1077,
1943,
284,
56956,
486,
931,
445,
9707,
0,
1827,
15454,
1428,
286,
19860,
341,
310,
19472,
29387,
5224,
15446,
3622,
56289,
3062,
9993,
5224,
1507,
1943... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_case_sensitive() {
let mut parser = simple_config();
let message_ascii = "!EcHo this is case insensitive";
let message_unicode = "!wEiSS is white";
let message_unicode_2 = "!\u{3b4} is delta";
// Case insensitive - ASCII
let Command { name, .. } = parser
.parse(message_ascii)
.expect("Parser is case sensitive");
assert_eq!(
"echo", name,
"Command name should have the same case as in the CommandParserConfig"
);
// Case insensitive - Unicode
parser.config.command("wei\u{df}").add();
let Command { name, .. } = parser
.parse(message_unicode)
.expect("Parser is case sensitive");
assert_eq!(
"wei\u{df}", name,
"Command name should have the same case as in the CommandParserConfig"
);
parser.config.command("\u{394}").add();
let Command { name, .. } = parser
.parse(message_unicode_2)
.expect("Parser is case sensitive");
assert_eq!(
"\u{394}", name,
"Command name should have the same case as in the CommandParserConfig"
);
// Case sensitive
let config = parser.config_mut();
config.commands_mut().clear();
config.command("echo").case_sensitive().add();
config.command("wei\u{df}").case_sensitive().add();
config.command("\u{394}").case_sensitive().add();
assert!(
parser.parse(message_ascii).is_none(),
"Parser is not case sensitive"
);
assert!(
parser.parse(message_unicode).is_none(),
"Parser is not case sensitive"
);
assert!(
parser.parse(message_unicode_2).is_none(),
"Parser is not case sensitive"
);
} | rust_cleaned_test_functions.jsonl/74783 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 878
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19096,
65324,
368,
341,
286,
1077,
5206,
6729,
284,
4285,
5332,
543,
286,
1077,
1943,
50238,
284,
53074,
50730,
47978,
419,
374,
1142,
70480,
876,
286,
1077,
1943,
54662,
284,
53074,
86,
36,
72,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_day_name() {
let cases = vec![
(None, None, None),
(Some("0000-00-00"), Some(ERR_TRUNCATE_WRONG_VALUE), None),
(Some("2019-11-17"), None, Some("Sunday")),
(Some("2019-11-18"), None, Some("Monday")),
(Some("2019-11-19"), None, Some("Tuesday")),
(Some("2019-11-20"), None, Some("Wednesday")),
(Some("2019-11-21"), None, Some("Thursday")),
(Some("2019-11-22"), None, Some("Friday")),
(Some("2019-11-23"), None, Some("Saturday")),
(Some("2019-11-24"), None, Some("Sunday")),
(Some("2019-11-00"), Some(ERR_TRUNCATE_WRONG_VALUE), None),
(Some("2019-00-00"), Some(ERR_TRUNCATE_WRONG_VALUE), None),
(Some("2019-00-01"), Some(ERR_TRUNCATE_WRONG_VALUE), None),
(Some("2019-11-24 00:00:00.000000"), None, Some("Sunday")),
];
for (arg, err_code, exp) in cases {
let mut ctx = EvalContext::default();
let arg = arg.map(|arg: &str| Time::parse_date(&mut ctx, arg).unwrap());
let (output, ctx) = RpnFnScalarEvaluator::new()
.push_param(arg)
.context(ctx)
.evaluate_raw(FieldTypeTp::String, ScalarFuncSig::DayName);
let output = output.unwrap();
assert_eq!(output.as_bytes(), exp.map(|v| v.as_bytes()));
if let Some(err_code) = err_code {
assert_eq!(ctx.warnings.warnings[0].get_code(), err_code);
}
}
} | rust_cleaned_test_functions.jsonl/36256 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 819
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16763,
1269,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
320,
4064,
11,
2240,
11,
2240,
1326,
310,
320,
8373,
445,
15,
15,
15,
15,
12,
15,
15,
12,
15,
15,
3975,
4329,
68174,
94642,
233... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_page_lookup_result_iter_no_patch() {
let lookup = PageLookupResult::with_page(PathBuf::from("test.page"));
let mut iter = lookup.paths();
assert_eq!(iter.next(), Some(Path::new("test.page")));
assert_eq!(iter.next(), None);
} | rust_cleaned_test_functions.jsonl/18692 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 128
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6129,
27464,
5287,
11723,
6536,
39643,
368,
341,
286,
1077,
18615,
284,
5755,
34247,
2077,
486,
4197,
6129,
33030,
15064,
486,
1499,
445,
1944,
10460,
4010,
286,
1077,
5206,
5367,
284,
18615,
65345,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mld_unspecified_src_no_addr() {
let mut ctx = DummyEventDispatcherBuilder::default().build();
let dev_id = ctx.state.add_ethernet_device(MY_MAC, 1500);
crate::device::initialize_device(&mut ctx, dev_id);
// The IP address of the device is intentionally unspecified.
mld_join_group(&mut ctx, dev_id, MulticastAddr::new(GROUP_ADDR).unwrap());
assert!(testutil::trigger_next_timer(&mut ctx));
for (_, frame) in ctx.dispatcher.frames_sent() {
ensure_frame(&frame, 131, GROUP_ADDR, GROUP_ADDR);
ensure_slice_addr(&frame, 22, 38, Ipv6::UNSPECIFIED_ADDRESS);
}
} | rust_cleaned_test_functions.jsonl/123220 | {
"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,
717,
507,
4907,
53434,
16274,
6536,
7387,
368,
341,
286,
1077,
5206,
5635,
284,
50567,
1556,
21839,
3297,
486,
2258,
1005,
5834,
543,
286,
1077,
3483,
842,
284,
5635,
3467,
1364,
57757,
13845,
920... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_pipe() {
let devpipe = Arc::new(Pipe::default());
task::spawn(async move {
let p = Chan::attach(devpipe, b"").await.unwrap();
let data = p.open(b"data", None).await.unwrap().unwrap();
let data1 = p.open(b"data1", None).await.unwrap().unwrap();
assert_eq!(data.is_dir(), false);
assert_eq!(data1.is_dir(), false);
task::spawn(async move {
assert_eq!(data.write(b"12345", 0).await.unwrap(), 5);
let mut buf = [0u8; 10];
assert_eq!(data.read(&mut buf, 0).await.unwrap(), 4);
assert_eq!(&buf[0..4], b"abcd");
data.close().await;
})
.unwrap();
task::spawn(async move {
let mut buf = [0u8; 5];
assert_eq!(data1.read(&mut buf, 0).await.unwrap(), 5);
assert_eq!(&buf, b"12345");
assert_eq!(data1.write(b"abcd", 0).await.unwrap(), 4);
data1.close().await;
})
.unwrap();
p.close().await;
})
.unwrap();
task::run();
} | rust_cleaned_test_functions.jsonl/36083 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 680
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41862,
368,
341,
286,
1077,
3483,
13768,
284,
19689,
486,
931,
5304,
3444,
486,
2258,
1423,
286,
3383,
486,
46087,
18285,
3271,
341,
310,
1077,
281,
284,
41302,
486,
16330,
17622,
13768,
11,
293,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_receiver() {
let (tx, rx) = channel();
tx.send("whale".to_owned());
let mut f = Future::from_receiver(rx);
assert_eq!(f.get(), "whale".to_owned());
} | rust_cleaned_test_functions.jsonl/113765 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 108
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
65691,
368,
341,
286,
1077,
320,
3998,
11,
19111,
8,
284,
5496,
543,
286,
9854,
5219,
445,
1312,
1574,
3263,
983,
51973,
1423,
286,
1077,
5206,
282,
284,
12498,
486,
1499,
65691,
75279,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_search() -> Result<(), IndexError> {
let mut x: MyVec<usize> = MyVec::new();
for i in &[1, 2, 3, 3, 3, 4, 5, 6, 9, 11] {
x.push(*i);
}
assert_eq!(x.search(&3), Some(4));
assert_eq!(x.search(&4), Some(5));
assert_eq!(x.search(&0), None);
assert_eq!(x.search(&12), Some(9));
assert_eq!(x.search(&1), Some(0));
assert_eq!(x.search(&11), Some(9));
let mut x: MyVec<usize> = MyVec::new();
x.push(1);
assert_eq!(x.search(&1), Some(0));
assert_eq!(x.search(&0), None);
assert_eq!(x.search(&11), Some(0));
Ok(())
} | rust_cleaned_test_functions.jsonl/24017 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 303
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10716,
368,
1464,
5714,
68843,
60203,
29,
341,
262,
1077,
5206,
856,
25,
3017,
10050,
90244,
29,
284,
3017,
10050,
486,
931,
543,
262,
369,
600,
304,
44590,
16,
11,
220,
17,
11,
220,
18,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_contains_flatten (){
let attr1 = make_dummy_attr ("foo");
let attr2 = make_dummy_attr ("bar");
let escape_attr = make_dummy_attr ("macro_escape");
let attrs1 = vec!(attr1, escape_attr, attr2);
assert_eq!(contains_macro_escape(attrs1.as_slice()),true);
let attrs2 = vec!(attr1,attr2);
assert_eq!(contains_macro_escape(attrs2.as_slice()),false);
} | rust_cleaned_test_functions.jsonl/12838 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
63598,
5081,
14456,
40653,
286,
1077,
6376,
16,
284,
1281,
60321,
10422,
3489,
7975,
797,
286,
1077,
6376,
17,
284,
1281,
60321,
10422,
3489,
2257,
797,
286,
1077,
12449,
10422,
284,
1281,
60321,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_json_as_int() {
test_none_with_ctx(cast_json_as_any::<Int>);
// no overflow
let cs = vec![
(Json::from_object(BTreeMap::default()).unwrap(), 0, false),
(Json::from_array(vec![]).unwrap(), 0, false),
(Json::from_i64(10).unwrap(), 10i64, false),
(Json::from_i64(i64::MAX).unwrap(), i64::MAX, false),
(Json::from_i64(i64::MIN).unwrap(), i64::MIN, false),
(Json::from_u64(0).unwrap(), 0, false),
(Json::from_u64(u64::MAX).unwrap(), u64::MAX as i64, false),
(
Json::from_f64(i64::MIN as u64 as f64).unwrap(),
i64::MAX,
false,
),
(
Json::from_f64(i64::MAX as u64 as f64).unwrap(),
i64::MAX,
false,
),
(
Json::from_f64(i64::MIN as u64 as f64).unwrap(),
i64::MAX,
false,
),
(Json::from_f64(i64::MIN as f64).unwrap(), i64::MIN, false),
(Json::from_f64(10.5).unwrap(), 11, false),
(Json::from_f64(10.4).unwrap(), 10, false),
(Json::from_f64(-10.4).unwrap(), -10, false),
(Json::from_f64(-10.5).unwrap(), -11, false),
(Json::from_string(String::from("10.0")).unwrap(), 10, false),
(Json::from_bool(true).unwrap(), 1, false),
(Json::from_bool(false).unwrap(), 0, false),
(Json::none().unwrap(), 0, false),
(
Json::from_f64(((1u64 << 63) + (1u64 << 62)) as u64 as f64).unwrap(),
i64::MAX,
true,
),
(
Json::from_f64(-((1u64 << 63) as f64 + (1u64 << 62) as f64)).unwrap(),
i64::MIN,
true,
),
];
for (input, expect, overflow) in cs {
let mut ctx = CtxConfig {
overflow_as_warning: true,
..CtxConfig::default()
}
.into();
let r = cast_json_as_any::<Int>(&mut ctx, Some(input.as_ref()));
let log = make_log(&input, &expect, &r);
check_result(Some(&expect), &r, log.as_str());
check_overflow(&ctx, overflow, log.as_str());
}
} | rust_cleaned_test_functions.jsonl/59964 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1413
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9455,
11898,
4042,
368,
341,
286,
1273,
31488,
6615,
15147,
1337,
559,
9455,
11898,
37248,
27638,
1072,
29,
626,
286,
442,
902,
16484,
198,
286,
1077,
10532,
284,
7486,
90515,
3374,
310,
320,
5014... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_is_word_delimiter_false() {
assert!(!Navigator::is_word_delimiter('a', 'a'));
assert!(!Navigator::is_word_delimiter('a', ' '));
assert!(!Navigator::is_word_delimiter('a', '_'));
assert!(!Navigator::is_word_delimiter('_', 'a'));
assert!(!Navigator::is_word_delimiter(':', ':'));
} | rust_cleaned_test_functions.jsonl/52832 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 151
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
13533,
18029,
17700,
36015,
368,
341,
262,
2060,
0,
3471,
19994,
486,
285,
13533,
18029,
17700,
492,
64,
516,
364,
64,
6336,
262,
2060,
0,
3471,
19994,
486,
285,
13533,
18029,
17700,
492,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_diff_insert_at_end() {
let before = [from((1, 2, 3, 4, 5)), from((6, 7, 8, 9, 10))];
let after = [from((1, 2, 3, 4, 5)), from((6, 7, 8, 9, 10)), from((11, 12, 13, 14, 15))];
let edits = diff_tokens(&before, &after);
assert_eq!(
edits[0],
SemanticTokensEdit {
start: 10,
delete_count: 0,
data: Some(vec![from((11, 12, 13, 14, 15))])
}
);
} | rust_cleaned_test_functions.jsonl/85525 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 282
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15850,
17678,
3752,
6213,
368,
341,
286,
1077,
1573,
284,
508,
1499,
1188,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
5731,
504,
1188,
21,
11,
220,
22,
11,
220,
23,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.