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_skipmap_iterator_concurrent_insert() {
time_test!();
// Asserts that the map can be mutated while an iterator exists; this is intentional.
let mut skm = make_skipmap();
let mut iter = skm.iter();
assert!(iter.advance());
skm.insert("abccc".as_bytes().to_vec(), "defff".as_bytes().to_vec());
// Assert that value inserted after obtaining iterator is present.
for (k, _) in LdbIteratorIter::wrap(&mut iter) {
if k == "abccc".as_bytes() {
return;
}
}
panic!("abccc not found in map.");
} | rust_cleaned_test_functions.jsonl/89161 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 289
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44830,
2186,
13491,
3382,
3231,
17678,
368,
341,
286,
882,
4452,
0,
543,
286,
442,
5319,
82,
429,
279,
2415,
646,
387,
84822,
1393,
458,
15091,
6724,
26,
419,
374,
46864,
624,
286,
1077,
5206,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_exp() {
assert!(close(_1_0i.exp(), _1_0i.scale(f64::consts::E)));
assert!(close(_0_0i.exp(), _1_0i));
assert!(close(_0_1i.exp(), Complex::new(1.0.cos(), 1.0.sin())));
assert!(close(_05_05i.exp() * _05_05i.exp(), _1_1i.exp()));
assert!(close(
_0_1i.scale(-f64::consts::PI).exp(),
_1_0i.scale(-1.0)
));
for &c in all_consts.iter() {
assert!(close(c.conj().exp(), c.exp().conj()));
assert!(close(
c.exp(),
(c + _0_1i.scale(f64::consts::PI * 2.0)).exp()
));
}
} | rust_cleaned_test_functions.jsonl/105679 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 487
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14214,
368,
341,
310,
2060,
10297,
5552,
2490,
16,
62,
15,
72,
13754,
1507,
716,
16,
62,
15,
72,
17266,
955,
21,
19,
486,
95773,
486,
36,
4945,
310,
2060,
10297,
5552,
2490,
15,
62,
15,
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... | 2 |
#[test]
fn test_beetle_correct_moves_surrounded()
{
let mut board = Board::default();
let beetle_square = (0, 0, 0);
let beetle = Piece::new(BoardPiece::Beetle, Color::White);
let mut vec = vec![(beetle_square, BoardSquare::new(beetle.clone()))];
for sq in neighbors(&beetle_square)
{
vec.push((sq, BoardSquare::new(Piece::new(BoardPiece::Ant, Color::Black))));
}
board.from_iter(vec.into_iter());
board.turns = 8; // To avoid queen check
let mut legal_moves = beetle_move(&board, beetle_square);
let mut ans = neighbors(&beetle_square);
ans.sort();
legal_moves.sort();
assert_eq!(legal_moves, ans);
} | rust_cleaned_test_functions.jsonl/61310 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 343
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21263,
295,
273,
31550,
45390,
49946,
43991,
741,
262,
341,
286,
1077,
5206,
4479,
284,
8751,
486,
2258,
1428,
286,
1077,
97386,
39794,
284,
320,
15,
11,
220,
15,
11,
220,
15,
317,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_scalar_sub_assign() {
{
// Test arbitrary subtraction that tests reduction.
let mut tmp = Scalar(blst::blst_fr {
l: [
0x6a68c64b6f735a2b,
0xd5f4d143fe0a1972,
0x37c17f3829267c62,
0xa2f37391f30915c,
],
});
tmp.sub_assign(&Scalar(blst::blst_fr {
l: [
0xade5adacdccb6190,
0xaa21ee0f27db3ccd,
0x2550f4704ae39086,
0x591d1902e7c5ba27,
],
}));
assert_eq!(
tmp,
Scalar(blst::blst_fr {
l: [
0xbc83189d92a7f89c,
0x7f908737d62d38a3,
0x45aa62cfe7e4c3e1,
0x24ffc5896108547d
]
})
);
// Test the opposite subtraction which doesn't test reduction.
tmp = Scalar(blst::blst_fr {
l: [
0xade5adacdccb6190,
0xaa21ee0f27db3ccd,
0x2550f4704ae39086,
0x591d1902e7c5ba27,
],
});
tmp.sub_assign(&Scalar(blst::blst_fr {
l: [
0x6a68c64b6f735a2b,
0xd5f4d143fe0a1972,
0x37c17f3829267c62,
0xa2f37391f30915c,
],
}));
assert_eq!(
tmp,
Scalar(blst::blst_fr {
l: [
0x437ce7616d580765,
0xd42d1ccb29d1235b,
0xed8f753821bd1423,
0x4eede1c9c89528ca
]
})
);
// Test for sensible results with zero
tmp = Scalar(blst::blst_fr { l: [0, 0, 0, 0] });
tmp.sub_assign(&Scalar(blst::blst_fr { l: [0, 0, 0, 0] }));
assert!(bool::from(tmp.is_zero()));
tmp = Scalar(blst::blst_fr {
l: [
0x437ce7616d580765,
0xd42d1ccb29d1235b,
0xed8f753821bd1423,
0x4eede1c9c89528ca,
],
});
tmp.sub_assign(&Scalar(blst::blst_fr { l: [0, 0, 0, 0] }));
assert_eq!(
tmp,
Scalar(blst::blst_fr {
l: [
0x437ce7616d580765,
0xd42d1ccb29d1235b,
0xed8f753821bd1423,
0x4eede1c9c89528ca
]
})
);
}
let mut rng = XorShiftRng::from_seed([
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06,
0xbc, 0xe5,
]);
for _ in 0..1000 {
let a = Scalar::random(&mut rng);
let b = Scalar::random(&mut rng);
let mut tmp1 = a;
tmp1.sub_assign(&b);
let mut tmp2 = b;
tmp2.sub_assign(&a);
tmp1.add_assign(&tmp2);
assert!(bool::from(tmp1.is_zero()));
}
} | rust_cleaned_test_functions.jsonl/54669 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2486
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41652,
5228,
20688,
368,
341,
286,
341,
310,
442,
3393,
24168,
75240,
429,
7032,
13951,
624,
310,
1077,
5206,
4174,
284,
35176,
29811,
267,
486,
2024,
267,
41537,
341,
394,
326,
25,
2278,
503,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_token_revocation_with_refresh_token() {
let client = new_client()
.set_revocation_uri(RevocationUrl::new("https://revocation/url".to_string()).unwrap());
client
.revoke_token(RefreshToken::new("refresh_token_123".to_string()).into())
.unwrap()
.request(mock_http_client(
vec![
(ACCEPT, "application/json"),
(CONTENT_TYPE, "application/x-www-form-urlencoded"),
(AUTHORIZATION, "Basic YWFhOmJiYg=="),
],
"token=refresh_token_123&token_type_hint=refresh_token",
Some("https://revocation/url".parse().unwrap()),
HttpResponse {
status_code: StatusCode::OK,
headers: vec![(
CONTENT_TYPE,
HeaderValue::from_str("application/json").unwrap(),
)]
.into_iter()
.collect(),
body: b"{}".to_vec(),
},
))
.unwrap();
} | rust_cleaned_test_functions.jsonl/18626 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 571
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6458,
38082,
2276,
6615,
42076,
6458,
368,
341,
262,
1077,
2943,
284,
501,
8179,
741,
286,
659,
746,
38082,
2276,
15572,
7,
36184,
2276,
2864,
486,
931,
445,
2428,
1110,
7282,
2276,
57254,
3263,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_block_header_hash() -> Result<(), failure::Error> {
let decoded = HashType::BlockHash.string_to_bytes("BKyQ9EofHrgaZKENioHyP4FZNsTmiSEcVmcghgzCC9cGhE7oCET")?;
let decoded = hex::encode(&decoded);
let expected = "2253698f0c94788689fb95ca35eb1535ec3a8b7c613a97e6683f8007d7959e4b";
assert_eq!(expected, decoded);
Ok(())
} | rust_cleaned_test_functions.jsonl/65927 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
7113,
8757,
8950,
368,
1464,
5714,
68843,
7901,
486,
1454,
29,
341,
286,
1077,
29213,
284,
6531,
929,
486,
4713,
6370,
4804,
2346,
12524,
445,
33,
77118,
48,
24,
36,
1055,
39,
1984,
64,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_decode() {
let v: RbBytes = serde_json::from_str("{\"rb_bytes\":[1,2]}").unwrap();
println!("{:?}", v);
let v: RbBytes = serde_json::from_str("[1,2]").unwrap();
println!("{:?}", v);
} | rust_cleaned_test_functions.jsonl/122648 | {
"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,
15227,
368,
341,
286,
1077,
348,
25,
431,
65,
7078,
284,
61570,
9455,
486,
1499,
2895,
99141,
10681,
12524,
59,
8899,
16,
11,
17,
13989,
1827,
15454,
543,
286,
13751,
88928,
25,
52652,
348,
317,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_file_backend_ase_256_ctr() {
let pt = Vec::from_hex(
"6bc1bee22e409f96e93d7e117393172aae2d8a571e03ac9c9eb76fac45af8e5130c81c46a35ce411\
e5fbc1191a0a52eff69f2445df4f9b17ad2b417be66c3710",
)
.unwrap();
let ct = Vec::from_hex(
"601ec313775789a5b7a7f504bbf3d228f443e3ca4d62b59aca84e990cacaf5c52b0930daa23de94c\
e87017ba2d84988ddfc9c58db67aada613c2dd08457941a6",
)
.unwrap();
let (key_path, _tmp_key_dir) = create_key_file("key");
let backend = FileBackend::new(EncryptionMethod::Aes256Ctr, &key_path).unwrap();
let iv = Vec::from_hex("f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff").unwrap();
let iv = Iv::from(iv.as_slice());
let encrypted_content = backend.mem_backend.encrypt_content(&pt, iv).unwrap();
assert_eq!(encrypted_content.get_content(), ct.as_slice());
let plaintext = backend.decrypt(&encrypted_content).unwrap();
assert_eq!(plaintext, pt);
} | rust_cleaned_test_functions.jsonl/81006 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 572
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2458,
40011,
62,
519,
62,
17,
20,
21,
69096,
368,
341,
1789,
286,
1077,
10817,
284,
11312,
486,
1499,
32655,
1006,
310,
330,
21,
8904,
16,
32031,
17,
17,
68,
19,
15,
24,
69,
24,
21,
68,
24... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_zero_confirmation_reconciliation() {
let mut dummy_chain = DummyChainImpl::new();
let head_header = block::BlockHeader {
height: 1,
..block::BlockHeader::default()
};
dummy_chain.store_head_header(&head_header);
// single Output
let new_output = DummyOutputSet::empty().with_output(test_output(100));
dummy_chain.update_output_set(new_output);
let chain_ref = Arc::new(dummy_chain);
let pool = RwLock::new(test_setup(&chain_ref));
// now create two txs
// tx1 spends the Output
// tx2 spends output from tx1
let tx1 = test_transaction(vec![100], vec![90]);
let tx2 = test_transaction(vec![90], vec![80]);
{
let mut write_pool = pool.write().unwrap();
assert_eq!(write_pool.total_size(), 0);
// both should be accepted if tx1 added before tx2
write_pool
.add_to_memory_pool(test_source(), tx1, false)
.unwrap();
write_pool
.add_to_memory_pool(test_source(), tx2, false)
.unwrap();
assert_eq!(write_pool.pool_size(), 2);
}
let txs: Vec<transaction::Transaction>;
{
let read_pool = pool.read().unwrap();
let mut mineable_txs = read_pool.prepare_mineable_transactions(3);
txs = mineable_txs.drain(..).map(|x| *x).collect();
// confirm we can preparing both txs for mining here
assert_eq!(txs.len(), 2);
}
let keychain = Keychain::from_random_seed().unwrap();
let key_id = keychain.derive_key_id(1).unwrap();
// now "mine" the block passing in the mineable txs from earlier
let block = block::Block::new(
&block::BlockHeader::default(),
txs.iter().collect(),
&keychain,
&key_id,
Difficulty::one(),
).unwrap();
// now apply the block to ensure the chainstate is updated before we reconcile
chain_ref.apply_block(&block);
// now reconcile the block
// we should evict both txs here
{
let mut write_pool = pool.write().unwrap();
let evicted_transactions = write_pool.reconcile_block(&block).unwrap();
assert_eq!(evicted_transactions.len(), 2);
}
// check the pool is consistent after reconciling the block
{
let read_pool = pool.write().unwrap();
assert_eq!(read_pool.pool.len_vertices(), 0);
assert_eq!(read_pool.pool.len_roots(), 0);
}
} | rust_cleaned_test_functions.jsonl/17039 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 881
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19359,
37681,
1288,
98240,
368,
341,
197,
10217,
5206,
17292,
30583,
284,
50567,
18837,
9673,
486,
931,
543,
197,
10217,
1968,
8757,
284,
2504,
486,
4713,
4047,
341,
298,
30500,
25,
220,
16,
345,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serialize() -> SoliResult<()> {
let product_id_bytes = [21u8; 32];
let price_id_bytes = [222u8; 32];
println!("Hex product_id: {:02X?}", &product_id_bytes);
println!("Hex price_id: {:02X?}", &price_id_bytes);
let attestation: PriceAttestation = PriceAttestation {
product_id: Pubkey::new_from_array(product_id_bytes),
price_id: Pubkey::new_from_array(price_id_bytes),
price: (0xdeadbeefdeadbabe as u64) as i64,
price_type: P2WPriceType::Price,
twap: P2WEma {
val: -42,
numer: 15,
denom: 37,
},
twac: P2WEma {
val: 42,
numer: 1111,
denom: 2222,
},
expo: -3,
status: P2WPriceStatus::Trading,
confidence_interval: 101,
corp_act: P2WCorpAction::NoCorpAct,
timestamp: 123456789i64,
};
println!("Regular: {:#?}", &attestation);
println!("Hex: {:#02X?}", &attestation);
println!("Hex Bytes: {:02X?}", attestation.serialize());
Ok(())
} | rust_cleaned_test_functions.jsonl/36893 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 636
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
368,
1464,
11473,
72,
2077,
71698,
341,
286,
1077,
1985,
842,
12524,
284,
508,
17,
16,
84,
23,
26,
220,
18,
17,
935,
286,
1077,
3349,
842,
12524,
284,
508,
17,
17,
17,
84,
23,
26,
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_swap_pairs() {
let head = ListNode::new_from_arr(&vec![1, 2, 3, 4]);
let want = ListNode::new_from_arr(&vec![2, 1, 4, 3]);
let ans = Solution::swap_pairs(head);
assert_eq!(ans, want);
} | rust_cleaned_test_functions.jsonl/73297 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40991,
36430,
368,
341,
286,
1077,
1968,
284,
20501,
486,
931,
5673,
11210,
2099,
4083,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
2558,
286,
1077,
1366,
284,
20501,
486,
931,
5673,
112... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_part2() {
assert_eq!(part2(&as_input(INPUT)), 1068781);
assert_eq!(part2(&as_input("0\n17,x,13,19")), 3417);
assert_eq!(part2(&as_input("0\n67,7,59,61")), 754018);
assert_eq!(part2(&as_input("0\n67,x,7,59,61")), 779210);
assert_eq!(part2(&as_input("0\n67,7,x,59,61")), 1261476);
assert_eq!(part2(&as_input("0\n1789,37,47,1889")), 1202161486);
} | rust_cleaned_test_functions.jsonl/234 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 237
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10495,
17,
368,
341,
286,
2060,
10714,
10297,
4480,
17,
2099,
300,
5898,
57911,
5731,
220,
16,
15,
21,
23,
22,
23,
16,
317,
286,
2060,
10714,
10297,
4480,
17,
2099,
300,
5898,
445,
15,
1699,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_account_doesnt_exist() -> Result<(), Box<dyn std::error::Error>> {
let mut cmd = Command::cargo_bin(BIN_NAME)?;
cmd.arg("config")
.arg("--url")
.arg("https://net.ton.dev");
cmd.assert()
.success();
let mut cmd = Command::cargo_bin(BIN_NAME)?;
cmd.arg("account");
cmd.assert()
.failure()
.stderr(predicate::str::contains("The following required arguments were not provided:"))
.stderr(predicate::str::contains("<ADDRESS>"));
Ok(())
} | rust_cleaned_test_functions.jsonl/118327 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 237
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13500,
96374,
406,
35906,
368,
1464,
5714,
68843,
8261,
92846,
1460,
486,
841,
486,
1454,
2452,
341,
262,
1077,
5206,
5439,
284,
7348,
486,
66715,
21816,
5349,
687,
4708,
40007,
262,
5439,
21186,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_mul_assign() {
let mut vector = Vector3D::new(3, 4, 5);
vector *= 3;
assert_eq!(vector, Vector3D::from([9, 12, 15]));
} | rust_cleaned_test_functions.jsonl/21642 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24944,
20688,
368,
341,
310,
1077,
5206,
4621,
284,
4196,
18,
35,
486,
931,
7,
18,
11,
220,
19,
11,
220,
20,
317,
310,
4621,
11404,
220,
18,
280,
310,
2060,
10714,
10297,
3215,
11,
4196,
18,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_space_parse() {
let space: Space = indoc!(
"
..#..........
..#..........
#######...###
#.#...#...#.#
#############
..#...#...#..
..#####...^.."
)
.parse()
.unwrap();
assert_eq!(space.height, 7);
assert_eq!(space.width, 13);
let bad_space = ".#!".parse::<Space>();
assert!(bad_space.is_err());
assert_eq!(
bad_space.unwrap_err(),
SpaceParseError::ObjectParseError(ObjectParseError::UnknownSymbol(b'!'))
);
let uneven_space = indoc!(
"
.#.
.<.."
)
.parse::<Space>();
assert!(uneven_space.is_err());
assert_eq!(uneven_space.unwrap_err(), SpaceParseError::UnevenLines);
} | rust_cleaned_test_functions.jsonl/109681 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 502
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14663,
21039,
368,
341,
286,
1077,
3550,
25,
11487,
284,
1257,
509,
33673,
310,
6228,
310,
5241,
2,
4007,
33947,
310,
5241,
2,
4007,
33947,
310,
26274,
14374,
1112,
26840,
310,
671,
43326,
1112,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rand_actuator() {
const TEST_INTERVAL: TimeBaseUnits = 10;
let mut simulato = Simulato::new(&get_test_reference_position());
let mut rng = rand::thread_rng();
simulato.increment_simulated_time();
let start_time = simulato.get_simulated_time();
for i in 1..100 {
let next_time = i*TEST_INTERVAL + start_time;
let rand_act_level = rng.gen::<f32>().abs();
let actuators: ActuatorControls = [rand_act_level; 16];
simulato.update(&actuators);
simulato.set_simulated_time(next_time);
if i > 1 {
assert_eq!(true, check_basic_motion(&simulato.vehicle_state));
}
}
} | rust_cleaned_test_functions.jsonl/67807 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 366
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33864,
29370,
45162,
368,
341,
286,
733,
13602,
37353,
25,
4120,
3978,
26314,
284,
220,
16,
15,
280,
286,
1077,
5206,
75673,
4330,
284,
4467,
360,
4330,
486,
931,
2099,
455,
4452,
25433,
9661,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_read_btf_type_typedef() {
let endianness = Endianness::default();
let data: &[u8] = &[
0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x0b, 0x00, 0x00, 0x00,
];
match unsafe { BtfType::read(data, endianness) } {
Ok(BtfType::Typedef(_)) => {}
Ok(t) => panic!("expected typedef type, got {:#?}", t),
Err(_) => panic!("unexpected error"),
}
} | rust_cleaned_test_functions.jsonl/98493 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 254
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
880,
8935,
1819,
42111,
4219,
368,
341,
286,
1077,
835,
72,
82033,
284,
3972,
72,
82033,
486,
2258,
543,
286,
1077,
821,
25,
44590,
84,
23,
60,
284,
609,
9640,
310,
220,
15,
87,
18,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_keygen() {
let (pk, pks, _sks) = dealer_keygen(5, 15);
assert_eq!(pks.len(), 15);
let pka = pks.aggregate(5);
assert_eq!(pka, pk);
} | rust_cleaned_test_functions.jsonl/31033 | {
"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,
3097,
4370,
368,
341,
286,
1077,
320,
20819,
11,
281,
2787,
11,
716,
82,
2787,
8,
284,
23321,
3097,
4370,
7,
20,
11,
220,
16,
20,
317,
286,
2060,
10714,
10297,
79,
2787,
19406,
1507,
220,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eval_unary_function_raw_column() {
#[rpn_fn]
fn foo(v: &Option<i64>) -> Result<Option<i64>> {
Ok(Some(v.unwrap() + 5))
}
let mut columns = LazyBatchColumnVec::from(vec![{
let mut col = LazyBatchColumn::raw_with_capacity(3);
let mut datum_raw = Vec::new();
DatumEncoder::encode(&mut datum_raw, &[Datum::I64(-5)], false).unwrap();
col.mut_raw().push(&datum_raw);
let mut datum_raw = Vec::new();
DatumEncoder::encode(&mut datum_raw, &[Datum::I64(-7)], false).unwrap();
col.mut_raw().push(&datum_raw);
let mut datum_raw = Vec::new();
DatumEncoder::encode(&mut datum_raw, &[Datum::I64(3)], false).unwrap();
col.mut_raw().push(&datum_raw);
col
}]);
let schema = &[FieldTypeTp::LongLong.into()];
let exp = RpnExpressionBuilder::new()
.push_column_ref(0)
.push_fn_call(foo_fn_meta(), 1, FieldTypeTp::LongLong)
.build();
let mut ctx = EvalContext::default();
let result = exp.eval(&mut ctx, schema, &mut columns, &[2, 0, 1], 3);
let val = result.unwrap();
assert!(val.is_vector());
assert_eq!(
val.vector_value().unwrap().as_ref().as_int_slice(),
[Some(8), Some(0), Some(-2)]
);
assert_eq!(val.vector_value().unwrap().logical_rows(), &[0, 1, 2]);
assert_eq!(val.field_type().tp(), FieldTypeTp::LongLong);
} | rust_cleaned_test_functions.jsonl/65654 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 806
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21296,
4907,
658,
9174,
16067,
8744,
368,
341,
394,
11506,
81,
19958,
15246,
921,
286,
5168,
15229,
3747,
25,
609,
5341,
21897,
21,
19,
9231,
1464,
5714,
94150,
21897,
21,
19,
2452,
341,
310,
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_empty_path() {
let path = Path::builder().build();
test_path(path.as_slice(), &StrokeOptions::default(), Some(0));
let path = Path::builder_with_attributes(1).build();
test_path(path.as_slice(), &StrokeOptions::default(), Some(0));
} | rust_cleaned_test_functions.jsonl/83681 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 106
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
2638,
368,
341,
262,
1077,
1815,
284,
7933,
486,
17850,
1005,
5834,
543,
262,
1273,
2638,
5581,
5357,
26488,
1507,
609,
31557,
3798,
486,
2258,
1507,
4329,
7,
15,
3237,
262,
1077,
1815,
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_to_hex() {
assert_eq!(vec![0, 0, 0, 0].to_hex(), "00000000");
assert_eq!(vec![10, 11, 12, 13].to_hex(), "0a0b0c0d");
assert_eq!([0, 0, 0, 255].to_hex(), "000000ff");
} | rust_cleaned_test_functions.jsonl/15826 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
32655,
368,
341,
197,
6948,
10714,
10297,
4083,
20703,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
936,
983,
32655,
1507,
330,
15,
15,
15,
15,
15,
15,
15,
15,
797,
197,
6948,
10714,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multiplication_with_scalar() {
let length_mm: Length<f32, Mm> = Length::new(10.0);
let result = length_mm * 2.0;
let expected: Length<f32, Mm> = Length::new(20.0);
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/50585 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 123
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
91802,
1693,
6615,
41652,
368,
341,
286,
1077,
3084,
35599,
25,
17287,
63895,
18,
17,
11,
386,
76,
29,
284,
17287,
486,
931,
7,
16,
15,
13,
15,
626,
286,
1077,
1102,
284,
3084,
35599,
353,
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_compare_different_symbols() {
let ref a = parse_expr("|| let a = 1; let b = 1; a").unwrap();
let ref b = parse_expr("|| let c = 1; let d = 1; c").unwrap();
assert_eq!(ExprHash::from(a).unwrap(), ExprHash::from(b).unwrap());
} | rust_cleaned_test_functions.jsonl/103358 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 113
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32235,
82741,
55752,
368,
341,
262,
1077,
2053,
264,
284,
4715,
21915,
445,
8484,
1077,
264,
284,
220,
16,
26,
1077,
293,
284,
220,
16,
26,
264,
1827,
15454,
543,
262,
1077,
2053,
293,
284,
47... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_lockfile_json() {
let ver_file = VersionFile {
filename: "package.json".to_string(),
version_value: "0.1.2".to_version().unwrap(),
version_filetype: VersionFiletype::TOML,
lockfile: None,
};
assert_eq!(ver_file.get_tracked_files(), vec!["package.json"]);
} | rust_cleaned_test_functions.jsonl/46669 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 179
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
9818,
1192,
9455,
368,
341,
286,
1077,
2739,
2458,
284,
6079,
1703,
341,
310,
3899,
25,
330,
1722,
4323,
3263,
983,
3904,
3148,
310,
2319,
3142,
25,
330,
15,
13,
16,
13,
17,
3263,
983,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_numeric() {
// vald
assert!(Token::from_str0("10").is_numeric());
assert!(Token::from_str0("10e10").is_numeric());
assert!(Token::from_str0("10e+10").is_numeric());
assert!(Token::from_str0("10e-10").is_numeric());
assert!(Token::from_str0(".11").is_numeric());
assert!(Token::from_str0(".11e10").is_numeric());
assert!(Token::from_str0(".11e+10").is_numeric());
assert!(Token::from_str0(".11e-10").is_numeric());
assert!(Token::from_str0("10.11").is_numeric());
assert!(Token::from_str0("10.11E10").is_numeric());
assert!(Token::from_str0("10.11E+10").is_numeric());
assert!(Token::from_str0("10.11E-10").is_numeric());
// invalid
assert!(!Token::from_str0("e10").is_numeric());
assert!(!Token::from_str0("xxx").is_numeric());
assert!(!Token::from_str0("x01").is_numeric());
} | rust_cleaned_test_functions.jsonl/67672 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 391
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
29418,
368,
341,
262,
442,
1044,
67,
198,
262,
2060,
10297,
3323,
486,
1499,
2895,
15,
445,
16,
15,
1827,
285,
29418,
1423,
262,
2060,
10297,
3323,
486,
1499,
2895,
15,
445,
16,
15,
68,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_protocol_method() {
let class = test_utils::custom_class();
let result: i32 = unsafe { msg_send![class, addNumber: 1, toNumber: 2] };
assert_eq!(result, 3);
} | rust_cleaned_test_functions.jsonl/7128 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34880,
9032,
368,
341,
286,
1077,
536,
284,
1273,
17309,
486,
9163,
4790,
543,
286,
1077,
1102,
25,
600,
18,
17,
284,
19860,
314,
3750,
13565,
20703,
1040,
11,
912,
2833,
25,
220,
16,
11,
311,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_write_zero() {
let packet = Connect {
protocol: Protocol::new("MQTT", 4).unwrap(),
keep_alive: 120,
client_id: "imvj",
clean_session: true,
last_will: None,
username: None,
password: None,
}
.into();
let mut slice = [0u8; 8];
match encode_slice(&packet, &mut slice) {
Ok(_) => panic!("Expected Error::WriteZero, as input slice is too small"),
Err(e) => assert_eq!(e, Error::WriteZero),
}
let mut buf = [0u8; 80];
let written = encode_slice(&packet, &mut buf).unwrap();
assert_eq!(written, 18);
} | rust_cleaned_test_functions.jsonl/59346 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 288
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
19359,
368,
341,
262,
1077,
10151,
284,
13015,
341,
286,
11507,
25,
24572,
486,
931,
445,
35169,
14903,
497,
220,
19,
568,
15454,
3148,
286,
2506,
58850,
25,
220,
16,
17,
15,
345,
286,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_poll_async_immediate_ops() {
let mut isolate = TestBehavior::setup(TestBehaviorMode::AsyncImmediate);
js_check(isolate.execute(
"setup2.js",
r#"
let nrecv = 0;
DenoCore.setAsyncHandler((buf) => {
nrecv++;
});
"#,
));
assert_eq!(isolate.behavior.dispatch_count, 0);
js_check(isolate.execute(
"check1.js",
r#"
assert(nrecv == 0);
let control = new Uint8Array([42]);
libdeno.send(control);
assert(nrecv == 0);
"#,
));
assert_eq!(isolate.behavior.dispatch_count, 1);
assert_eq!(Ok(Async::Ready(())), isolate.poll());
assert_eq!(isolate.behavior.dispatch_count, 1);
js_check(isolate.execute(
"check2.js",
r#"
assert(nrecv == 1);
libdeno.send(control);
assert(nrecv == 1);
"#,
));
assert_eq!(isolate.behavior.dispatch_count, 2);
assert_eq!(Ok(Async::Ready(())), isolate.poll());
js_check(isolate.execute("check3.js", "assert(nrecv == 2)"));
assert_eq!(isolate.behavior.dispatch_count, 2);
assert_eq!(Ok(Async::Ready(())), isolate.poll());
} | rust_cleaned_test_functions.jsonl/113676 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 573
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40002,
28346,
17895,
14636,
21959,
368,
341,
262,
1077,
5206,
42123,
284,
3393,
22753,
486,
15188,
31159,
22753,
3636,
486,
6525,
52734,
626,
262,
6994,
7200,
82669,
7769,
1006,
414,
330,
15188,
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_for_loop_with_positive_step() {
let input = "
FOR i% = 1 TO 7 STEP 2
PRINT i%
NEXT
";
let interpreter = interpret(input);
let stdlib = interpreter.stdlib;
assert_eq!(stdlib.output, vec!["1", "3", "5", "7"]);
} | rust_cleaned_test_functions.jsonl/109179 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 159
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5478,
17198,
6615,
54160,
11946,
368,
341,
286,
1077,
1946,
284,
6228,
286,
4613,
600,
4,
284,
220,
16,
5146,
220,
22,
48356,
220,
17,
198,
310,
35893,
600,
13744,
286,
45011,
198,
286,
7620,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invalid_bzimage_underflow() {
use super::super::super::Error as LoaderError;
let path = concat!(
env!("CARGO_MANIFEST_DIR"),
"/src/loader/x86_64/bzimage/fuzz_invalid_bzimage.bin"
);
let gm = create_guest_mem();
let mut image = File::open(path).unwrap();
let kernel_offset = GuestAddress(0x200000);
let highmem_start_address = GuestAddress(0x0);
// load bzImage with good kernel_offset and himem_start setting
let loader_result = BzImage::load(
&gm,
Some(kernel_offset),
&mut image,
Some(highmem_start_address),
);
assert_eq!(
loader_result.unwrap_err(),
LoaderError::Bzimage(Error::Underflow)
);
} | rust_cleaned_test_functions.jsonl/51145 | {
"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,
31433,
880,
89,
1805,
58228,
4965,
368,
341,
286,
990,
2256,
486,
9522,
486,
9522,
486,
1454,
438,
27811,
1454,
401,
286,
1077,
1815,
284,
33720,
33673,
310,
6105,
17223,
34,
7581,
46,
25143,
91... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stake() {
new_test_ext().execute_with(|| {
set_block_1();
let worker1 = worker_pubkey(1);
assert_ok!(PhalaRegistry::force_register_worker(
Origin::root(),
worker1.clone(),
ecdh_pubkey(1),
Some(1)
));
assert_ok!(PhalaStakePool::create(Origin::signed(1))); // pid = 0
assert_ok!(PhalaStakePool::create(Origin::signed(2))); // pid = 1
// Stake normally
assert_ok!(PhalaStakePool::contribute(
Origin::signed(1),
0,
1 * DOLLARS
));
assert_ok!(PhalaStakePool::contribute(
Origin::signed(2),
0,
10 * DOLLARS
));
assert_ok!(PhalaStakePool::contribute(
Origin::signed(1),
1,
100 * DOLLARS
));
assert_ok!(PhalaStakePool::contribute(
Origin::signed(2),
1,
1000 * DOLLARS
));
// Check total stake
assert_eq!(
PhalaStakePool::stake_pools(0).unwrap().total_stake,
11 * DOLLARS
);
assert_eq!(
PhalaStakePool::stake_pools(1).unwrap().total_stake,
1100 * DOLLARS
);
// Check total locks
assert_eq!(PhalaStakePool::stake_ledger(1), Some(101 * DOLLARS));
assert_eq!(PhalaStakePool::stake_ledger(2), Some(1010 * DOLLARS));
assert_eq!(Balances::locks(1), vec![the_lock(101 * DOLLARS)]);
assert_eq!(Balances::locks(2), vec![the_lock(1010 * DOLLARS)]);
// Pool existence
assert_noop!(
PhalaStakePool::contribute(Origin::signed(1), 100, 1 * DOLLARS),
Error::<Test>::PoolDoesNotExist
);
// Dust contribution
assert_noop!(
PhalaStakePool::contribute(Origin::signed(1), 0, 1),
Error::<Test>::InsufficientContribution
);
// Stake more than account1 has
assert_noop!(
PhalaStakePool::contribute(
Origin::signed(1),
0,
Balances::usable_balance(1) + 1
),
Error::<Test>::InsufficientBalance,
);
});
} | rust_cleaned_test_functions.jsonl/60463 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 934
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
726,
368,
341,
298,
8638,
4452,
9927,
1005,
10257,
6615,
79453,
341,
571,
8196,
7113,
62,
16,
543,
571,
10217,
11864,
16,
284,
11864,
34014,
792,
7,
16,
317,
571,
6948,
19817,
10297,
3357,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_virtio_fs_dax_on_cache_size_1_gib() {
test_virtio_fs(true, Some(0x4000_0000), "none", &prepare_virtiofsd, false)
} | rust_cleaned_test_functions.jsonl/23983 | {
"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,
2273,
2106,
815,
34470,
814,
706,
4470,
11529,
2368,
62,
16,
1889,
579,
368,
341,
310,
1273,
2273,
2106,
815,
34470,
3715,
11,
4329,
7,
15,
87,
19,
15,
15,
15,
62,
15,
15,
15,
15,
701,
330... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_functions_reorder() -> TestResult {
let parts = vec![
"f(1)",
"f(2)",
"g(1)",
"g(2)",
"h(2)",
"k(x) if f(x) and g(x) and h(x)",
];
for (i, permutation) in permute(parts).into_iter().enumerate() {
let mut p = Polar::new();
let mut joined = permutation.join(";");
joined.push(';');
p.load_str(&joined)?;
assert!(
null(&mut p, "k(1)"),
"k(1) was true for permutation {:?}",
&permutation
);
assert!(
eval(&mut p, "k(2)"),
"k(2) failed for permutation {:?}",
&permutation
);
assert_eq!(
var(&mut p, "k(a)", "a"),
values![2],
"k(a) failed for permutation {:?}",
&permutation
);
println!("permute: {}", i);
}
Ok(())
} | rust_cleaned_test_functions.jsonl/97611 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 532
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31708,
1288,
1358,
368,
1464,
3393,
2077,
341,
1066,
262,
1077,
5479,
284,
7486,
90515,
286,
330,
69,
7,
16,
15752,
286,
330,
69,
7,
17,
15752,
286,
330,
70,
7,
16,
15752,
286,
330,
70,
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... | 3 |
#[test]
fn test_segwit_txid() {
let tx = Transaction::from_hex(
"02000000000101a4fe140f92eb5fa5a4788b6271a22f07fa91cb2f8ac328cd0065bfc43adb16c90100000\
01716001446decf32d70ee1fad5aa11d02158810316e6790bfeffffff02a08601000000000017a9147f14\
23e3359d1754ae9427e313c1d9581f3f280a87e8e520070000000017a914b83c7a100c7ff491e5edb5f1d\
fcd39e298e50f4b87024830450221008f9378080defdb2029f9c96e149e85e93d8fb860a1c06a7c988908\
09077eec8b02206049967206a4bd35f8fa4c59a8cd9f46b08e48f794a6b325986b4e9227b9d8d30121037\
f72563a0750831ab4fb762e01cfe368ddd412042be6b78af5ee5a9bd38d0ed093a81300",
)
.unwrap();
let txid_hex = "6ed431718c73787ad92e6bcbd6ac7c8151e08dffeeebb6d9e5af2d25b6837d98";
assert_eq!(tx.id().to_string(), txid_hex);
} | rust_cleaned_test_functions.jsonl/61857 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 514
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35325,
88519,
17805,
307,
368,
341,
286,
1077,
9854,
284,
17869,
486,
1499,
32655,
1006,
310,
330,
15,
17,
15,
15,
15,
15,
15,
15,
15,
15,
15,
16,
15,
16,
64,
19,
1859,
16,
19,
15,
69,
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_malformed_json() {
assert_matches!(
CreationManifest::from_json("<invalid json document>".as_bytes()),
Err(CreationManifestError::Json(err)) => assert!(err.is_syntax())
);
} | rust_cleaned_test_functions.jsonl/101411 | {
"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,
717,
278,
10155,
9455,
368,
341,
286,
2060,
38344,
33673,
310,
34286,
38495,
486,
1499,
9455,
9639,
11808,
2951,
2197,
52946,
300,
12524,
14702,
310,
15495,
3025,
26453,
38495,
1454,
486,
5014,
3964... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_human_numeric_zero_stable() {
let input = "0M\n0K\n-0K\n-P\n-0M\n";
new_ucmd!()
.arg("-hs")
.pipe_in(input)
.succeeds()
.stdout_only(input);
} | rust_cleaned_test_functions.jsonl/20495 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
86247,
29418,
19359,
1261,
480,
368,
341,
262,
1077,
1946,
284,
330,
15,
44,
1699,
15,
42,
1699,
12,
15,
42,
1699,
9299,
1699,
12,
15,
44,
1699,
876,
262,
501,
68887,
2277,
0,
741,
286,
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_probability_complex() {
let validators = vec![1, 2, 3, 4];
let mut leaders = HashMap::new();
let random = broken_random(validators.len() as i64 * 10);
for leader in random {
*leaders
.entry(select_winner(&validators, leader).unwrap())
.or_insert(0) += 1;
}
assert!(leaders[&3] == leaders[&0] * 4);
assert_eq!(leaders[&2], leaders[&0] * 3);
assert_eq!(leaders[&1], leaders[&0] * 2);
} | rust_cleaned_test_functions.jsonl/129486 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 262
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68589,
41522,
368,
341,
286,
1077,
38588,
284,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
4821,
286,
1077,
5206,
6036,
284,
10528,
486,
931,
1428,
286,
1077,
4194,
284,
10865,
226... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_enrich_tf1x_histogram() {
let hp = pb::HistogramProto {
min: -1.999,
max: 1.999,
num: 60.0,
bucket_limit: vec![-2.0, -1.0, 0.0, 1.0, 2.0, f64::MAX],
bucket: vec![0.0, 10.0, 20.0, 20.0, 10.0, 0.0],
..Default::default()
};
let v = EventValue::Summary(SummaryValue(Box::new(Value::Histo(hp))));
assert_eq!(
v.into_tensor(&blank("histogram", pb::DataClass::Tensor)),
Ok(pb::TensorProto {
dtype: pb::DataType::DtDouble.into(),
tensor_shape: Some(tensor_shape(&[6, 3])),
tensor_content: {
#[rustfmt::skip]
let b = to_le_bytes![
-1.999, -2.0, 0.0,
-2.0, -1.0, 10.0,
-1.0, 0.0, 20.0,
0.0, 1.0, 20.0,
1.0, 2.0, 10.0,
2.0, 1.999, 0.0f64
];
b
},
..Default::default()
})
);
} | rust_cleaned_test_functions.jsonl/6204 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 904
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6205,
13851,
47719,
16,
87,
68564,
368,
341,
310,
1077,
20630,
284,
17310,
486,
77210,
31549,
341,
394,
1308,
25,
481,
16,
13,
24,
24,
24,
345,
394,
1932,
25,
220,
16,
13,
24,
24,
24,
345,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_computed_topic() {
let p1: PartitionMaps = vec![(1, vec![0]), (2, vec![2])].into();
let t1 = ReplicaSpec::new_assigned(p1);
assert!(!t1.is_computed());
let t2 = ReplicaSpec::new_computed(0, 0, None);
assert!(t2.is_computed());
} | rust_cleaned_test_functions.jsonl/79993 | {
"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,
6892,
2965,
19292,
31414,
368,
341,
286,
1077,
281,
16,
25,
54626,
36562,
284,
7486,
0,
9697,
16,
11,
7486,
20703,
15,
9719,
320,
17,
11,
7486,
20703,
17,
2467,
936,
18122,
543,
286,
1077,
259... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_key_leading_fields() {
assert_eq!(
"options word ssh-dss abcdefg".parse::<KeyEntry>().unwrap_err(),
ParseKeyError::InvalidKeyType
);
} | rust_cleaned_test_functions.jsonl/31210 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3097,
11751,
2228,
12132,
368,
341,
286,
2060,
10714,
33673,
310,
330,
2875,
3409,
29230,
1737,
778,
39022,
750,
70,
3263,
6400,
27638,
1592,
5874,
10483,
15454,
9266,
3148,
310,
14775,
1592,
1454,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_partial_negated_isa() -> TestResult {
let p = Polar::new();
p.load_str(
r#"f(y) if (not y matches Foo{} or not g(y)) and y == 1;
g(_: Bar);"#,
)?;
let mut q = p.new_query_from_term(term!(call!("f", [sym!("x")])), false);
assert_partial_expression!(nextb!(&mut q), "x", "not 1 matches Foo{}");
assert_partial_expression!(nextb!(&mut q), "x", "not 1 matches Bar{}");
assert_query_done!(q);
Ok(())
} | rust_cleaned_test_functions.jsonl/63042 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 265
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
52068,
28209,
657,
6892,
64,
368,
1464,
3393,
2077,
341,
286,
1077,
281,
284,
55896,
486,
931,
543,
286,
281,
5104,
2895,
1006,
310,
435,
55543,
69,
7021,
8,
421,
320,
1921,
379,
9071,
33428,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_inline_catch_alias_let1() {
test(
concat!(
"try {",
"} catch (e) {",
" let y = e;",
" g();",
" y;y;",
"}",
),
concat!("try {", "} catch (e) {", " g();", " e;e;", "}"),
);
} | rust_cleaned_test_functions.jsonl/27705 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 203
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41871,
666,
754,
35947,
62,
1149,
16,
368,
341,
262,
1273,
1006,
286,
33720,
33673,
310,
330,
1539,
314,
756,
310,
80548,
2287,
320,
68,
8,
314,
756,
310,
330,
220,
1077,
379,
284,
384,
64497,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_basic_calls() {
use common::traits::{EmptyConfig, SharedServiceState};
use serde_json::Value;
geckobridge::service::GeckoBridgeService::init_shared_state(&EmptyConfig);
let config = DeviceCapabilityConfig::default();
assert_eq!(*config.get("device.bt").unwrap(), Value::Bool(true));
assert_eq!(
*config.get("ro.build.type").unwrap(),
Value::String("".into())
);
assert!(config.get("hardware.memory").unwrap().as_i64().unwrap() > 0);
} | rust_cleaned_test_functions.jsonl/2415 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 199
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
45636,
368,
341,
262,
990,
4185,
486,
62633,
22964,
3522,
2648,
11,
16990,
1860,
1397,
2440,
262,
990,
61570,
9455,
486,
1130,
401,
262,
3893,
377,
674,
11183,
486,
7936,
486,
9499,
31463,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_flags_from_vec_30() {
let (flags, subcommand, argv) = flags_from_vec(svec![
"deno",
"install",
"deno_colors",
"https://deno.land/std/examples/colors.ts"
]);
assert_eq!(
flags,
DenoFlags {
allow_write: true,
allow_net: true,
allow_read: true,
allow_env: true,
allow_run: true,
..DenoFlags::default()
}
);
assert_eq!(subcommand, DenoSubcommand::Run);
assert_eq!(
argv,
svec![
"deno",
INSTALLER_URL,
"deno_colors",
"https://deno.land/std/examples/colors.ts"
]
);
let (flags, subcommand, argv) = flags_from_vec(svec![
"deno",
"install",
"file_server",
"https://deno.land/std/http/file_server.ts",
"--allow-net",
"--allow-read"
]);
assert_eq!(
flags,
DenoFlags {
allow_write: true,
allow_net: true,
allow_read: true,
allow_env: true,
allow_run: true,
..DenoFlags::default()
}
);
assert_eq!(subcommand, DenoSubcommand::Run);
assert_eq!(
argv,
svec![
"deno",
INSTALLER_URL,
"file_server",
"https://deno.land/std/http/file_server.ts",
"--allow-net",
"--allow-read"
]
);
let (flags, subcommand, argv) = flags_from_vec(svec![
"deno",
"install",
"-d",
"/usr/local/bin",
"file_server",
"https://deno.land/std/http/file_server.ts",
"--allow-net",
"--allow-read"
]);
assert_eq!(
flags,
DenoFlags {
allow_write: true,
allow_net: true,
allow_read: true,
allow_env: true,
allow_run: true,
..DenoFlags::default()
}
);
assert_eq!(subcommand, DenoSubcommand::Run);
assert_eq!(
argv,
svec![
"deno",
INSTALLER_URL,
"--dir",
"/usr/local/bin",
"file_server",
"https://deno.land/std/http/file_server.ts",
"--allow-net",
"--allow-read"
]
);
} | rust_cleaned_test_functions.jsonl/112859 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1182
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14130,
5673,
13251,
62,
18,
15,
368,
341,
262,
1077,
320,
11161,
11,
1186,
5631,
11,
10213,
8,
284,
8042,
5673,
13251,
1141,
4083,
90515,
414,
330,
5183,
78,
756,
414,
330,
12248,
756,
414,
33... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_minutes() {
let cases: Vec<(&str, i8, u64)> = vec![
("31 11:30:45", 0, 30),
("11:30:45", 0, 30),
("-11:30:45.9233456", 0, 30),
];
for (input, fsp, exp) in cases {
let dur = Duration::parse(input.as_bytes(), fsp).unwrap();
let res = dur.minutes();
assert_eq!(exp, res);
}
} | rust_cleaned_test_functions.jsonl/17456 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 235
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67655,
368,
341,
286,
1077,
5048,
25,
11312,
27,
2099,
495,
11,
600,
23,
11,
575,
21,
19,
16018,
284,
7486,
90515,
310,
3489,
18,
16,
220,
16,
16,
25,
18,
15,
25,
19,
20,
497,
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... | 2 |
#[test]
fn test_types() {
assert_eq!(parse_test_yaml::<XCheckType>("default"),
XCheckType::Default);
assert_eq!(parse_test_yaml::<XCheckType>("none"),
XCheckType::None);
assert_eq!(parse_test_yaml::<XCheckType>("disabled"),
XCheckType::Disabled);
assert_eq!(parse_test_yaml::<XCheckType>("{ \"fixed\": 1234 }"),
XCheckType::Fixed(1234));
assert_eq!(parse_test_yaml::<XCheckType>("{ \"djb2\": \"foo\" }"),
XCheckType::Djb2(String::from("foo")));
} | rust_cleaned_test_functions.jsonl/30068 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 316
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9763,
368,
341,
286,
2060,
10714,
10297,
6400,
4452,
64380,
27638,
55,
3973,
929,
13211,
2258,
4461,
4293,
1599,
3973,
929,
486,
3675,
317,
286,
2060,
10714,
10297,
6400,
4452,
64380,
27638,
55,
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_merge_both_wildcard_diff_prefixes() {
check_assist(
merge_imports,
r"
use std<|>::cell::*;
use std::str::*;
",
r"
use std::{cell::*, str::*};
",
)
} | rust_cleaned_test_functions.jsonl/94000 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 135
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20888,
88819,
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,
561... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_command_in_shell() {
let subcommand = vec![String::from("foo"), String::from("bar")];
let result = command_in_shell("bash", &subcommand);
let expected = String::from("bash -c \"foo bar\"");
assert!(result == expected);
} | rust_cleaned_test_functions.jsonl/60134 | {
"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,
10811,
1243,
48945,
368,
341,
286,
1077,
1186,
5631,
284,
7486,
20703,
703,
486,
1499,
445,
7975,
3975,
923,
486,
1499,
445,
2257,
899,
4821,
286,
1077,
1102,
284,
3210,
1243,
48945,
445,
46216,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_primary_node_only() {
let mut bytecode: Vec<u8> = BIND_HEADER.to_vec();
append_section_header(&mut bytecode, SYMB_MAGIC_NUM, 18);
let device_name: [u8; 5] = [0x49, 0x42, 0x49, 0x53, 0]; // "IBIS"
bytecode.extend_from_slice(&[1, 0, 0, 0]);
bytecode.extend_from_slice(&device_name);
let primary_node_name: [u8; 5] = [0x43, 0x4F, 0x4F, 0x54, 0]; // "RAIL"
bytecode.extend_from_slice(&[2, 0, 0, 0]);
bytecode.extend_from_slice(&primary_node_name);
let primary_node_inst = [0x30, 0x01, 0x01, 0, 0, 0, 0x05, 0x01, 0x10, 0, 0x20, 0];
let composite_insts_sz =
COMPOSITE_NAME_ID_BYTES + (NODE_TYPE_HEADER_SZ + primary_node_inst.len()) as u32;
append_section_header(&mut bytecode, COMPOSITE_MAGIC_NUM, composite_insts_sz);
// Add device name ID.
bytecode.extend_from_slice(&[1, 0, 0, 0]);
// Add the node instructions.
append_node_header(&mut bytecode, RawNodeType::Primary, 2, primary_node_inst.len() as u32);
bytecode.extend_from_slice(&primary_node_inst);
let mut expected_symbol_table: HashMap<u32, String> = HashMap::new();
expected_symbol_table.insert(1, "IBIS".to_string());
expected_symbol_table.insert(2, "COOT".to_string());
assert_eq!(
DecodedRules::Composite(DecodedCompositeBindRules {
symbol_table: expected_symbol_table,
device_name_id: 1,
primary_node: Node { name_id: 2, instructions: primary_node_inst.to_vec() },
additional_nodes: vec![]
}),
DecodedRules::new(bytecode).unwrap()
);
} | rust_cleaned_test_functions.jsonl/24042 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 835
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45314,
5084,
18410,
368,
341,
286,
1077,
5206,
75129,
25,
11312,
34837,
23,
29,
284,
91370,
20330,
2389,
13251,
543,
286,
8737,
16221,
8757,
2099,
6984,
75129,
11,
16079,
8412,
49194,
9631,
11,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tree_from_one() {
let input = b"test";
let mt = MerkleTree::new(&[input]);
let expected = hash_leaf!(input);
assert_eq!(mt.get_root(), Some(&expected));
} | rust_cleaned_test_functions.jsonl/112979 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 103
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11663,
5673,
11667,
368,
341,
286,
1077,
1946,
284,
293,
1,
1944,
876,
286,
1077,
11965,
284,
8755,
23089,
6533,
486,
931,
2099,
58,
1355,
2558,
286,
1077,
3601,
284,
5175,
38909,
10297,
1355,
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 |
#[test]
fn test_generate_from_impl_for_enum() {
check_assist(
generate_from_impl_for_enum,
r#"
//- minicore: from
enum A { $0One(u32) }
"#,
r#"
enum A { One(u32) }
impl From<u32> for A {
fn from(v: u32) -> Self {
Self::One(v)
}
}
"#,
);
} | rust_cleaned_test_functions.jsonl/4568 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 190
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48851,
5673,
21007,
5478,
31054,
368,
341,
286,
1779,
12083,
380,
1006,
310,
6923,
5673,
21007,
5478,
31054,
345,
310,
435,
2,
698,
61463,
1308,
292,
460,
25,
504,
198,
9018,
362,
314,
400,
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_discard2() {
static FILE_1: &str = r"start
end
";
static FILE_2: &str = r"start
1
2
end
";
static FILE_3: &str = r"start
1
end
";
let (path, repo) = repo_init().unwrap();
let path = path.path().to_str().unwrap();
write_commit_file(&repo, "test.txt", FILE_1, "c1");
repo_write_file(&repo, "test.txt", FILE_2).unwrap();
discard_lines(
path,
"test.txt",
&[DiffLinePosition {
old_lineno: None,
new_lineno: Some(3),
}],
)
.unwrap();
let result_file = load_file(&repo, "test.txt").unwrap();
assert_eq!(result_file.as_str(), FILE_3);
} | rust_cleaned_test_functions.jsonl/105097 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 399
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37745,
567,
17,
368,
341,
286,
1099,
11837,
62,
16,
25,
609,
495,
284,
435,
1,
2468,
198,
408,
198,
3302,
286,
1099,
11837,
62,
17,
25,
609,
495,
284,
435,
1,
2468,
198,
16,
198,
17,
198,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iterate_string_vec() {
let words = vec!["hello", "world"];
let capitalized_words: Vec<String> = words.into_iter().map(|word| {capitalize_first(&word)}).collect();
assert_eq!(capitalized_words, ["Hello", "World"]);
} | rust_cleaned_test_functions.jsonl/22124 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 113
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
349,
3904,
13251,
368,
341,
286,
1077,
4244,
284,
7486,
0,
1183,
14990,
497,
330,
14615,
6332,
286,
1077,
97321,
18981,
25,
11312,
3464,
29,
284,
4244,
39860,
11723,
1005,
2186,
22428,
1158... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_calculate_cost_weight() {
let (mint_keypair, start_hash) = test_setup();
let keypair = Keypair::new();
let simple_transaction = SanitizedTransaction::from_transaction_for_tests(
system_transaction::transfer(&mint_keypair, &keypair.pubkey(), 2, start_hash),
);
let vote_transaction = SanitizedTransaction::from_transaction_for_tests(
vote_transaction::new_vote_transaction(
vec![42],
Hash::default(),
Hash::default(),
&keypair,
&keypair,
&keypair,
None,
),
);
let testee = CostModel::default();
assert_eq!(1u32, testee.calculate_cost_weight(&simple_transaction));
assert_eq!(0u32, testee.calculate_cost_weight(&vote_transaction));
} | rust_cleaned_test_functions.jsonl/109039 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 446
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24005,
11207,
15890,
15876,
368,
341,
286,
1077,
320,
67791,
3097,
12670,
11,
1191,
8950,
8,
284,
1273,
21363,
1428,
286,
1077,
1376,
12670,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
4285,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_missing_argument() {
let err = OptParseError::missing_argument("<input>");
let thing = format!("{}", err);
let expect = "Missing argument: <input>";
assert_eq!(thing, expect);
} | rust_cleaned_test_functions.jsonl/8276 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 103
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40447,
9025,
368,
341,
286,
1077,
1848,
284,
16554,
14463,
1454,
486,
30616,
9025,
9639,
1355,
15084,
286,
1077,
3166,
284,
3561,
79878,
1848,
317,
286,
1077,
1720,
284,
330,
25080,
5693,
25,
366,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_header() {
struct Case {
input: String,
want: Header,
tail: String,
}
fn wrap(s: &str) -> String {
format!(" \t {} .", s)
}
let tail = " .";
for case in vec![
Case {
input: wrap("# TYPE abc_def counter"),
want: Header {
metric_name: "abc_def".into(),
kind: MetricKind::Counter,
},
tail: tail.to_owned(),
},
Case {
input: wrap("# TYPE abc_def counteraaaaaaaaaaa"),
want: Header {
metric_name: "abc_def".into(),
kind: MetricKind::Counter,
},
tail: "aaaaaaaaaaa .".to_string(),
},
Case {
input: wrap("#TYPE \t abc_def \t gauge"),
want: Header {
metric_name: "abc_def".into(),
kind: MetricKind::Gauge,
},
tail: tail.to_owned(),
},
Case {
input: wrap("# TYPE abc_def histogram"),
want: Header {
metric_name: "abc_def".into(),
kind: MetricKind::Histogram,
},
tail: tail.to_owned(),
},
Case {
input: wrap("# TYPE abc_def summary"),
want: Header {
metric_name: "abc_def".into(),
kind: MetricKind::Summary,
},
tail: tail.to_owned(),
},
Case {
input: wrap("# TYPE abc_def untyped"),
want: Header {
metric_name: "abc_def".into(),
kind: MetricKind::Untyped,
},
tail: tail.to_owned(),
},
] {
let (left, r) = Header::parse(&case.input).unwrap();
assert_eq!(left, case.tail);
assert_eq!(r, case.want);
}
} | rust_cleaned_test_functions.jsonl/78089 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1340
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8757,
368,
341,
286,
2036,
11538,
341,
310,
1946,
25,
923,
345,
310,
1366,
25,
12104,
345,
310,
9787,
25,
923,
345,
286,
555,
286,
5168,
15061,
1141,
25,
609,
495,
8,
1464,
923,
341,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tx_out_from_tx_out_stored() {
let mut rng: StdRng = SeedableRng::from_seed([1u8; 32]);
let source = tx::TxOut {
amount: Amount::new(1u64 << 13, &RistrettoPublic::from_random(&mut rng)).unwrap(),
target_key: RistrettoPublic::from_random(&mut rng).into(),
public_key: RistrettoPublic::from_random(&mut rng).into(),
e_fog_hint: (&[0u8; ENCRYPTED_FOG_HINT_LEN]).into(),
e_memo: None,
};
let converted = external::TxOut::from(&source);
let recovered_tx_out = tx::TxOut::try_from(&converted).unwrap();
assert_eq!(source.amount, recovered_tx_out.amount);
} | rust_cleaned_test_functions.jsonl/55002 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 334
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17805,
6068,
5673,
17805,
6068,
1261,
3018,
368,
341,
286,
1077,
5206,
28422,
25,
42517,
49,
968,
284,
35822,
480,
49,
968,
486,
1499,
33809,
2561,
16,
84,
23,
26,
220,
18,
17,
10149,
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_state_from_account() {
let mut nonce_account = nonce_account::create_account(1).into_inner();
assert_eq!(state_from_account(&nonce_account), Ok(State::Uninitialized));
let data = nonce::state::Data {
authority: Pubkey::new(&[1u8; 32]),
blockhash: Hash::new(&[42u8; 32]),
fee_calculator: FeeCalculator::new(42),
};
nonce_account
.set_state(&Versions::new_current(State::Initialized(data.clone())))
.unwrap();
assert_eq!(
state_from_account(&nonce_account),
Ok(State::Initialized(data))
);
let wrong_data_size_account = Account::new(1, 1, &system_program::id());
assert_eq!(
state_from_account(&wrong_data_size_account),
Err(Error::InvalidAccountData),
);
} | rust_cleaned_test_functions.jsonl/18821 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 418
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4387,
5673,
13500,
368,
341,
286,
1077,
5206,
39676,
13500,
284,
39676,
13500,
486,
3182,
13500,
7,
16,
568,
18122,
34345,
543,
286,
2060,
10714,
10297,
2454,
5673,
13500,
2099,
39593,
13500,
701,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_statement_error() {
let mut mint = Mint::new("tests/it/testdata");
let mut file = mint.new_goldenfile("statement-error.txt").unwrap();
let cases = &[
r#"create table a.b (c integer not null 1, b varchar(10))"#,
r#"create table a (c varchar(10))"#,
r#"create table a (c varch)"#,
r#"drop table if a.b"#,
r#"truncate table a.b.c.d"#,
r#"truncate a"#,
r#"drop a"#,
];
for case in cases {
test_parse!(file, statement, case);
}
} | rust_cleaned_test_functions.jsonl/118103 | {
"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,
37404,
4096,
368,
341,
262,
1077,
5206,
28337,
284,
41310,
486,
931,
445,
23841,
14,
275,
12697,
691,
797,
262,
1077,
5206,
1034,
284,
28337,
4618,
54696,
268,
1192,
445,
24184,
18917,
3909,
1827,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_file2() -> std::io::Result<()> {
let model = process_file("tests/data/file2.log")?;
assert_eq!(model.terms().len(), 150031);
assert_eq!(model.instantiations().len(), 10242);
Ok(())
} | rust_cleaned_test_functions.jsonl/74600 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2458,
17,
368,
1464,
1460,
486,
815,
486,
2077,
71698,
341,
262,
1077,
1614,
284,
1882,
2458,
445,
23841,
13167,
23903,
17,
1665,
899,
37445,
262,
2060,
10714,
10297,
2528,
13,
18347,
1005,
2892,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_serde_page_default() {
let src = Page::default();
let str = serde_json::to_string(&src).unwrap();
let out: Page = serde_json::from_str(&str).unwrap();
assert!(out.parent.is_none());
} | rust_cleaned_test_functions.jsonl/114806 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 113
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75861,
450,
6129,
9993,
368,
341,
286,
1077,
2286,
284,
5755,
486,
2258,
543,
286,
1077,
607,
284,
61570,
9455,
486,
983,
3904,
2099,
3548,
568,
15454,
543,
286,
1077,
700,
25,
5755,
284,
61570,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_primitive() {
let b = Primitive::<u8>::from(vec![Some(1), Some(2), Some(3)]).to(DataType::UInt8);
let mut a = GrowablePrimitive::new(&[&b], false, 3);
a.extend(0, 0, 2);
let result: PrimitiveArray<u8> = a.into();
let expected = Primitive::<u8>::from(vec![Some(1), Some(2)]).to(DataType::UInt8);
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/80109 | {
"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,
84087,
368,
341,
286,
1077,
293,
284,
51460,
27638,
84,
23,
6831,
1499,
25592,
20703,
8373,
7,
16,
701,
4329,
7,
17,
701,
4329,
7,
18,
7252,
568,
983,
63941,
486,
18777,
23,
317,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_config_get_config_file_returns_config_file_path() {
let config = Config::default();
assert_eq!(
config.get_config_file_path(),
config.config_file,
"should return config file path"
);
} | rust_cleaned_test_functions.jsonl/91434 | {
"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,
5332,
3062,
5332,
2458,
58900,
5332,
2458,
2638,
368,
341,
286,
1077,
2193,
284,
5532,
486,
2258,
543,
286,
2060,
10714,
33673,
310,
2193,
670,
5332,
2458,
2638,
3148,
310,
2193,
5423,
2458,
345,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_value_of() {
let matches = app()
.clone()
.get_matches_from(vec!["test", "--single", "50"]);
assert_eq!(value_of(&matches, "single"), Some(50));
assert_eq!(value_of::<u64>(&matches, "multiple"), None);
let pubkey = Pubkey::new_rand();
let matches = app()
.clone()
.get_matches_from(vec!["test", "--single", &pubkey.to_string()]);
assert_eq!(value_of(&matches, "single"), Some(pubkey));
} | rust_cleaned_test_functions.jsonl/36684 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 255
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3142,
3575,
368,
341,
286,
1077,
9071,
284,
906,
741,
310,
659,
19982,
741,
310,
659,
455,
38344,
5673,
25592,
0,
1183,
1944,
497,
14482,
15338,
497,
330,
20,
15,
15049,
286,
2060,
10714,
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_uuid() {
let got = RpnFnScalarEvaluator::new()
.evaluate::<Bytes>(ScalarFuncSig::Uuid)
.unwrap();
let r = got.unwrap().into_string().unwrap_or_default();
let v: Vec<&str> = r.split('-').collect();
assert_eq!(v.len(), 5);
assert_eq!(v[0].len(), 8);
assert_eq!(v[1].len(), 4);
assert_eq!(v[2].len(), 4);
assert_eq!(v[3].len(), 4);
assert_eq!(v[4].len(), 12);
} | rust_cleaned_test_functions.jsonl/59419 | {
"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,
25540,
368,
341,
286,
1077,
2684,
284,
431,
19958,
24911,
20639,
89042,
486,
931,
741,
310,
659,
47291,
27638,
7078,
2235,
20639,
9626,
47246,
486,
38431,
340,
310,
659,
15454,
543,
286,
1077,
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_retain_latest() {
let mut cached_schedules = HashMap::new();
let mut order = VecDeque::new();
for i in 0..=MAX_SCHEDULES {
cached_schedules.insert(i as u64, Arc::new(LeaderSchedule::default()));
order.push_back(i as u64);
}
LeaderScheduleCache::retain_latest(&mut cached_schedules, &mut order, MAX_SCHEDULES);
assert_eq!(cached_schedules.len(), MAX_SCHEDULES);
let mut keys: Vec<_> = cached_schedules.keys().cloned().collect();
keys.sort_unstable();
let expected: Vec<_> = (1..=MAX_SCHEDULES as u64).collect();
let expected_order: VecDeque<_> = (1..=MAX_SCHEDULES as u64).collect();
assert_eq!(expected, keys);
assert_eq!(expected_order, order);
} | rust_cleaned_test_functions.jsonl/26068 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 369
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21695,
466,
64880,
368,
341,
286,
1077,
5206,
20579,
643,
49613,
284,
10528,
486,
931,
543,
286,
1077,
5206,
1973,
284,
11312,
73891,
486,
931,
543,
286,
369,
600,
304,
220,
15,
496,
28,
10586,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_compute_next_update_time() {
let now = clock::now();
let policy_data = PolicyData { current_time: now };
let result = StubPolicy::compute_next_update_time(
&policy_data,
&[],
&SCHEDULING,
&ProtocolState::default(),
);
let expected = UpdateCheckSchedule {
last_update_time: SCHEDULING.last_update_time,
next_update_window_start: now,
next_update_time: now,
};
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/80114 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 281
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57028,
11257,
8882,
3009,
368,
341,
286,
1077,
1431,
284,
8866,
486,
3328,
543,
286,
1077,
4842,
1769,
284,
10974,
1043,
314,
1482,
3009,
25,
1431,
2605,
286,
1077,
1102,
284,
66611,
13825,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_error_duplicate_value() {
let mut tree = Tree {
raw: "2 + 6 5".to_owned(),
..Default::default()
};
tree.parse_pos().unwrap();
tree.parse_operators().unwrap();
assert_eq!(tree.parse_node(), Err(Error::DuplicateValueNode));
} | rust_cleaned_test_functions.jsonl/28446 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4096,
70434,
3142,
368,
341,
286,
1077,
5206,
4916,
284,
8942,
341,
310,
7112,
25,
330,
17,
488,
220,
21,
220,
20,
3263,
983,
51973,
3148,
310,
5241,
3675,
486,
2258,
741,
286,
3634,
286,
4916... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_idempotence() {
let mut graph = setup_basic_graph();
println!("{:?}", graph);
assert!(graph.contains_vertex(1));
graph.remove_vertex(1, None);
graph.remove_vertex(1, None);
graph.remove_vertex(1, None);
assert!(!graph.contains_vertex(1));
graph.add_vertex(2, None);
graph.add_vertex(2, None);
graph.add_vertex(2, None);
assert!(graph.contains_vertex(2));
graph.add_edge(2, 3, None);
graph.add_edge(2, 3, None);
graph.add_edge(2, 3, None);
assert_eq!(graph.get_connected_vertices(2), [3]);
} | rust_cleaned_test_functions.jsonl/40989 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 263
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
842,
3262,
97560,
368,
341,
262,
1077,
5206,
4771,
284,
6505,
34729,
14738,
543,
262,
13751,
88928,
25,
52652,
4771,
317,
262,
2060,
10297,
4439,
8786,
26611,
7,
16,
3237,
262,
4771,
4850,
26611,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pending_update_fee_ack_on_reconnect() {
// previous channel feerate after sending an undelivered revoke_and_ack when re-sending an
// undelivered commitment_signed.
// A sends B update_fee + CS
// reconnect
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
create_announced_chan_between_nodes(&nodes, 0, 1, InitFeatures::known(), InitFeatures::known());
send_payment(&nodes[0], &[&nodes[1]], 100_000_00);
let (route, payment_hash, payment_preimage, payment_secret) = get_route_and_payment_hash!(&nodes[1], nodes[0], 1_000_000);
nodes[1].node.send_payment(&route, payment_hash, &Some(payment_secret)).unwrap();
check_added_monitors!(nodes[1], 1);
let bs_initial_send_msgs = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
// bs_initial_send_msgs are not delivered until they are re-generated after reconnect
{
let mut feerate_lock = chanmon_cfgs[0].fee_estimator.sat_per_kw.lock().unwrap();
*feerate_lock *= 2;
}
nodes[0].node.timer_tick_occurred();
check_added_monitors!(nodes[0], 1);
let as_update_fee_msgs = get_htlc_update_msgs!(nodes[0], nodes[1].node.get_our_node_id());
assert!(as_update_fee_msgs.update_fee.is_some());
nodes[1].node.handle_update_fee(&nodes[0].node.get_our_node_id(), as_update_fee_msgs.update_fee.as_ref().unwrap());
nodes[1].node.handle_commitment_signed(&nodes[0].node.get_our_node_id(), &as_update_fee_msgs.commitment_signed);
check_added_monitors!(nodes[1], 1);
let bs_first_raa = get_event_msg!(nodes[1], MessageSendEvent::SendRevokeAndACK, nodes[0].node.get_our_node_id());
// bs_first_raa is not delivered until it is re-generated after reconnect
nodes[0].node.peer_disconnected(&nodes[1].node.get_our_node_id(), false);
nodes[1].node.peer_disconnected(&nodes[0].node.get_our_node_id(), false);
nodes[0].node.peer_connected(&nodes[1].node.get_our_node_id(), &msgs::Init { features: InitFeatures::known(), remote_network_address: None });
let as_connect_msg = get_event_msg!(nodes[0], MessageSendEvent::SendChannelReestablish, nodes[1].node.get_our_node_id());
nodes[1].node.peer_connected(&nodes[0].node.get_our_node_id(), &msgs::Init { features: InitFeatures::known(), remote_network_address: None });
let bs_connect_msg = get_event_msg!(nodes[1], MessageSendEvent::SendChannelReestablish, nodes[0].node.get_our_node_id());
nodes[1].node.handle_channel_reestablish(&nodes[0].node.get_our_node_id(), &as_connect_msg);
let bs_resend_msgs = nodes[1].node.get_and_clear_pending_msg_events();
assert_eq!(bs_resend_msgs.len(), 3);
if let MessageSendEvent::UpdateHTLCs { ref updates, .. } = bs_resend_msgs[0] {
assert_eq!(*updates, bs_initial_send_msgs);
} else { panic!(); }
if let MessageSendEvent::SendRevokeAndACK { ref msg, .. } = bs_resend_msgs[1] {
assert_eq!(*msg, bs_first_raa);
} else { panic!(); }
if let MessageSendEvent::SendChannelUpdate { .. } = bs_resend_msgs[2] { } else { panic!(); }
nodes[0].node.handle_channel_reestablish(&nodes[1].node.get_our_node_id(), &bs_connect_msg);
get_event_msg!(nodes[0], MessageSendEvent::SendChannelUpdate, nodes[1].node.get_our_node_id());
nodes[0].node.handle_update_add_htlc(&nodes[1].node.get_our_node_id(), &bs_initial_send_msgs.update_add_htlcs[0]);
nodes[0].node.handle_commitment_signed(&nodes[1].node.get_our_node_id(), &bs_initial_send_msgs.commitment_signed);
check_added_monitors!(nodes[0], 1);
nodes[1].node.handle_revoke_and_ack(&nodes[0].node.get_our_node_id(), &get_event_msg!(nodes[0], MessageSendEvent::SendRevokeAndACK, nodes[1].node.get_our_node_id()));
check_added_monitors!(nodes[1], 1);
let bs_second_cs = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id()).commitment_signed;
nodes[0].node.handle_revoke_and_ack(&nodes[1].node.get_our_node_id(), &bs_first_raa);
check_added_monitors!(nodes[0], 1);
nodes[1].node.handle_commitment_signed(&nodes[0].node.get_our_node_id(), &get_htlc_update_msgs!(nodes[0], nodes[1].node.get_our_node_id()).commitment_signed);
check_added_monitors!(nodes[1], 1);
let bs_third_raa = get_event_msg!(nodes[1], MessageSendEvent::SendRevokeAndACK, nodes[0].node.get_our_node_id());
nodes[0].node.handle_commitment_signed(&nodes[1].node.get_our_node_id(), &bs_second_cs);
check_added_monitors!(nodes[0], 1);
nodes[0].node.handle_revoke_and_ack(&nodes[1].node.get_our_node_id(), &bs_third_raa);
check_added_monitors!(nodes[0], 1);
nodes[1].node.handle_revoke_and_ack(&nodes[0].node.get_our_node_id(), &get_event_msg!(nodes[0], MessageSendEvent::SendRevokeAndACK, nodes[1].node.get_our_node_id()));
check_added_monitors!(nodes[1], 1);
expect_pending_htlcs_forwardable!(nodes[0]);
expect_payment_received!(nodes[0], payment_hash, payment_secret, 1_000_000);
claim_payment(&nodes[1], &[&nodes[0]], payment_preimage);
} | rust_cleaned_test_functions.jsonl/58347 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2020
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37861,
8882,
34305,
48447,
4470,
1288,
6459,
368,
341,
1572,
197,
322,
3681,
5496,
1152,
58668,
1283,
11628,
458,
2030,
301,
43056,
72038,
8378,
48447,
979,
312,
1331,
2459,
458,
198,
197,
322,
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... | 4 |
#[test]
fn test_reference_vector_ILL2_ext_switching() {
let test_vector = include_bytes!("../vectors/ILL2_ext_switching.bit");
test_vs_minimp3(test_vector);
} | rust_cleaned_test_functions.jsonl/69796 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 73
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25433,
12247,
62,
9228,
17,
9927,
27652,
287,
368,
341,
262,
1077,
1273,
12247,
284,
2924,
12524,
17223,
1244,
85,
10605,
14,
9228,
17,
9927,
27652,
287,
30099,
797,
262,
1273,
42434,
7260,
6664,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_err() {
let message = "some error message I'm getting";
let formatted = format!("-ERR {}\r\n", message);
let result = parse_line(&formatted);
assert_eq!(ParseResult::Error(message), result.unwrap());
} | rust_cleaned_test_functions.jsonl/5699 | {
"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,
21039,
9266,
368,
341,
286,
1077,
1943,
284,
330,
14689,
1465,
1943,
358,
2776,
3709,
876,
286,
1077,
23126,
284,
3561,
0,
13645,
2650,
56057,
81,
1699,
497,
1943,
317,
286,
1077,
1102,
284,
471... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_batch_row_limit() {
let data = vec![
(1, Some("name:0"), 2),
(2, Some("name:4"), 3),
(4, Some("name:3"), 1),
(5, Some("name:1"), 4),
];
let batch_row_limit = 3;
let chunk_datum_limit = batch_row_limit * 3; // we have 3 fields.
let product = ProductTable::new();
let (_, mut end_point) = {
let engine = engine::new_local_engine(TEMP_DIR, ALL_CFS).unwrap();
let mut cfg = Config::default();
cfg.end_point_batch_row_limit = batch_row_limit;
init_data_with_details(Context::new(), engine, &product, &data, true, cfg)
};
// for dag selection
let req = DAGSelect::from(&product.table).build();
let mut resp = handle_select(&end_point, req);
check_chunk_datum_count(resp.get_chunks(), chunk_datum_limit);
let spliter = DAGChunkSpliter::new(resp.take_chunks().into_vec(), 3);
for (row, (id, name, cnt)) in spliter.zip(data) {
let name_datum = name.map(|s| s.as_bytes()).into();
let expected_encoded =
datum::encode_value(&[Datum::I64(id), name_datum, cnt.into()]).unwrap();
let result_encoded = datum::encode_value(&row).unwrap();
assert_eq!(result_encoded, &*expected_encoded);
}
end_point.stop().unwrap().join().unwrap();
} | rust_cleaned_test_functions.jsonl/47088 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 583
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14534,
8530,
14763,
368,
341,
262,
1077,
821,
284,
7486,
90515,
286,
320,
16,
11,
4329,
445,
606,
25,
15,
3975,
220,
17,
1326,
286,
320,
17,
11,
4329,
445,
606,
25,
19,
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_pem() {
let key = include_bytes!("../test/key.pem");
let key = PKey::private_key_from_pem(key).unwrap();
let priv_key = key.private_key_to_pem_pkcs8().unwrap();
let pub_key = key.public_key_to_pem().unwrap();
// the `PRIVATE KEY` or `PUBLIC KEY` strings.
assert!(priv_key.windows(11).any(|s| s == b"PRIVATE KEY"));
assert!(pub_key.windows(10).any(|s| s == b"PUBLIC KEY"));
} | rust_cleaned_test_functions.jsonl/18714 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 234
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
336,
368,
341,
286,
1077,
1376,
284,
2924,
12524,
17223,
1244,
1944,
68864,
49373,
797,
286,
1077,
1376,
284,
393,
1592,
486,
1996,
3097,
5673,
620,
336,
4857,
568,
15454,
1428,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lookup_pos_in_expr() {
let expr = "let a = 1;\nbuiltins.trace a 23";
let pos = lookup_pos(
expr,
Position {
line: 0,
character: 0,
},
);
assert_eq!(0, pos.expect("expected position to be not None!"));
} | rust_cleaned_test_functions.jsonl/113850 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27464,
6479,
1243,
21915,
368,
341,
286,
1077,
15169,
284,
330,
1149,
264,
284,
220,
16,
17882,
18080,
11227,
1330,
34412,
264,
220,
17,
18,
876,
286,
1077,
1133,
284,
18615,
6479,
1006,
310,
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_eq_hdr_name() {
use self::StandardHeader::Vary;
let a = HeaderName {
inner: Repr::Standard(Vary),
};
let b = HdrName {
inner: Repr::Standard(Vary),
};
assert_eq!(a, b);
let a = HeaderName {
inner: Repr::Custom(Custom(ByteStr::from_static("vaary"))),
};
assert_ne!(a, b);
let b = HdrName {
inner: Repr::Custom(MaybeLower {
buf: b"vaary",
lower: true,
}),
};
assert_eq!(a, b);
let b = HdrName {
inner: Repr::Custom(MaybeLower {
buf: b"vaary",
lower: false,
}),
};
assert_eq!(a, b);
let b = HdrName {
inner: Repr::Custom(MaybeLower {
buf: b"VAARY",
lower: false,
}),
};
assert_eq!(a, b);
let a = HeaderName {
inner: Repr::Standard(Vary),
};
assert_ne!(a, b);
} | rust_cleaned_test_functions.jsonl/3406 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 646
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10714,
28238,
1269,
368,
341,
286,
990,
656,
486,
19781,
4047,
486,
53,
658,
401,
286,
1077,
264,
284,
12104,
675,
341,
310,
9179,
25,
1032,
649,
486,
19781,
12410,
658,
1326,
286,
2605,
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_help_argument() -> Result<(), Box<dyn std::error::Error>> {
let mut cmd = Command::cargo_bin("git-mob")?;
cmd.arg("--help");
cmd.assert()
.stdout(predicate::str::contains("git-mob 0.1"))
.stdout(predicate::str::contains(
"James Thompson <james@thomps.onl>",
))
.stdout(predicate::str::contains(
"makes mob programming easier with Git",
));
Ok(())
} | rust_cleaned_test_functions.jsonl/3013 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 214
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26926,
9025,
368,
1464,
5714,
68843,
8261,
92846,
1460,
486,
841,
486,
1454,
2452,
341,
262,
1077,
5206,
5439,
284,
7348,
486,
66715,
21816,
445,
12882,
1448,
674,
899,
37445,
262,
5439,
21186,
21... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_read_timeout() {
let dir = tmpdir();
let socket_path = dir.path().join("sock");
let _listener = or_panic!(UnixListener::bind(&socket_path));
let mut stream = or_panic!(UnixStream::connect(&socket_path));
or_panic!(stream.set_read_timeout(Some(Duration::from_millis(1000))));
let mut buf = [0; 10];
let kind = stream.read_exact(&mut buf).err().expect("expected error").kind();
assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut,
"unexpected_error: {:?}", kind);
} | rust_cleaned_test_functions.jsonl/98539 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 250
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
20537,
368,
341,
286,
1077,
5419,
284,
4174,
3741,
543,
286,
1077,
7575,
2638,
284,
5419,
3875,
1005,
5987,
445,
13199,
3071,
286,
1077,
716,
35039,
284,
476,
620,
31270,
10297,
55832,
2743,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_subscript_neg() {
let parsed: Expression = from_str("abcd[-1]").unwrap();
let expected = Subscript(Box::new(Identifier("abcd".into())), -1);
assert_eq!(parsed, expected);
} | rust_cleaned_test_functions.jsonl/127055 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5228,
2282,
28209,
368,
341,
286,
1077,
15676,
25,
16378,
284,
504,
2895,
445,
68644,
7609,
16,
44891,
15454,
543,
286,
1077,
3601,
284,
3719,
2282,
67758,
486,
931,
7,
8714,
445,
68644,
3263,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_update_simd_rand() {
let mut rng = new_rng(70812476915813);
// Test updating with random values and update size big enough to test
// simd implementation with overflow
const MIN_BYTES: usize = 1 << 20;
const BUF_LEN: usize = (1 << 21) + 79;
let buf: Vec<u8> = iter::repeat_with(|| rng.gen()).take(BUF_LEN).collect();
let orig_checksum = {
let mut c = Checksum::new();
c.add_bytes(&buf);
c.checksum()
};
let (begin, end) = loop {
let begin = rng.gen::<usize>() % ((BUF_LEN - MIN_BYTES) / 2);
let end = begin
+ MIN_BYTES
+ (rng.gen::<usize>() % (((BUF_LEN - MIN_BYTES) / 2) + 1 - begin));
// update requires that begin is even and end is either even or the
// end of the input
if begin % 2 == 0 && (end % 2 == 0 || end == BUF_LEN) {
break (begin, end);
}
};
let mut new_buf: Vec<u8> = buf.to_vec();
for i in begin..end {
new_buf[i] = rng.gen();
}
let from_update = update(orig_checksum, &buf[begin..end], &new_buf[begin..end]);
let from_scratch = {
let mut c = Checksum::new();
c.add_bytes(&new_buf);
c.checksum()
};
assert_eq!(from_scratch, from_update);
} | rust_cleaned_test_functions.jsonl/113596 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 743
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
18314,
67,
33864,
368,
341,
286,
1077,
5206,
28422,
284,
501,
66849,
7,
22,
15,
23,
16,
17,
19,
22,
21,
24,
16,
20,
23,
16,
18,
626,
286,
442,
3393,
21010,
448,
4194,
2750,
323,
2647... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_spec_order() {
let vs = [
"1.0.0-alpha",
"1.0.0-alpha.1",
"1.0.0-alpha.beta",
"1.0.0-beta",
"1.0.0-beta.2",
"1.0.0-beta.11",
"1.0.0-rc.1",
"1.0.0",
];
let mut i = 1;
while i < vs.len() {
let a = Version::parse(vs[i - 1]);
let b = Version::parse(vs[i]);
assert!(a < b, "nope {:?} < {:?}", a, b);
i += 1;
}
} | rust_cleaned_test_functions.jsonl/43110 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 358
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13594,
7869,
368,
341,
286,
1077,
6165,
284,
2278,
310,
330,
16,
13,
15,
13,
15,
64538,
756,
310,
330,
16,
13,
15,
13,
15,
64538,
13,
16,
756,
310,
330,
16,
13,
15,
13,
15,
64538,
61929,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_query_matches_with_multiple_captures_on_a_node() {
allocations::record(|| {
let language = get_language("javascript");
let mut query = Query::new(
language,
"(function_declaration
(identifier) @name1 @name2 @name3
(statement_block) @body1 @body2)",
)
.unwrap();
let source = "function foo() { return 1; }";
let mut parser = Parser::new();
let mut cursor = QueryCursor::new();
parser.set_language(language).unwrap();
let tree = parser.parse(&source, None).unwrap();
let matches = cursor.matches(&query, tree.root_node(), to_callback(source));
assert_eq!(
collect_matches(matches, &query, source),
&[(
0,
vec![
("name1", "foo"),
("name2", "foo"),
("name3", "foo"),
("body1", "{ return 1; }"),
("body2", "{ return 1; }"),
]
),]
);
// disabling captures still works when there are multiple captures on a
// single node.
query.disable_capture("name2");
let matches = cursor.matches(&query, tree.root_node(), to_callback(source));
assert_eq!(
collect_matches(matches, &query, source),
&[(
0,
vec![
("name1", "foo"),
("name3", "foo"),
("body1", "{ return 1; }"),
("body2", "{ return 1; }"),
]
),]
);
});
} | rust_cleaned_test_functions.jsonl/25180 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 914
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5738,
38344,
6615,
45233,
666,
2689,
1413,
4470,
4306,
5084,
368,
341,
262,
69642,
486,
8548,
79453,
341,
286,
1077,
4128,
284,
633,
29021,
445,
14073,
797,
286,
1077,
5206,
3239,
284,
11361,
486,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_name_seg() {
let mut context = AmlContext::new();
check_ok!(
name_seg().parse(&[b'A', b'F', b'3', b'Z'], &mut context),
NameSeg([b'A', b'F', b'3', b'Z']),
&[]
);
check_ok!(
name_seg().parse(&[b'A', b'F', b'3', b'Z', 0xff], &mut context),
NameSeg([b'A', b'F', b'3', b'Z']),
&[0xff]
);
check_err!(
name_seg().parse(&[0xff, b'E', b'A', b'7'], &mut context),
AmlError::UnexpectedByte(0xff),
&[0xff, b'E', b'A', b'7']
);
check_err!(name_seg().parse(&[], &mut context), AmlError::UnexpectedEndOfStream, &[]);
} | rust_cleaned_test_functions.jsonl/13930 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 419
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1269,
35325,
368,
341,
286,
1077,
5206,
2266,
284,
362,
1014,
1972,
486,
931,
1428,
286,
1779,
19817,
33673,
310,
829,
35325,
1005,
6400,
2099,
58,
65,
51274,
516,
293,
6,
37,
516,
293,
6,
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_linked_list() {
struct TestRdbHandler {
list: Vec<String>,
}
impl EventHandler for TestRdbHandler {
fn handle(&mut self, data: Event) {
match data {
Event::RDB(rdb) => match rdb {
Object::List(list) => {
assert_eq!("force_linkedlist", String::from_utf8_lossy(list.key));
for val in list.values {
let value = String::from_utf8_lossy(val).to_string();
self.list.push(value);
}
}
Object::EOR => {
assert_eq!(1000, self.list.len());
assert_eq!(
"41PJSO2KRV6SK1WJ6936L06YQDPV68R5J2TAZO3YAR5IL5GUI8",
self.list.get(0).unwrap()
);
assert_eq!(
"E41JRQX2DB4P1AQZI86BAT7NHPBHPRIIHQKA4UXG94ELZZ7P3Y",
self.list.get(1).unwrap()
);
}
_ => {}
},
Event::AOF(_) => {}
}
}
}
start_redis_test(
"linkedlist.rdb",
10008,
Rc::new(RefCell::new(TestRdbHandler { list: vec![] })),
);
} | rust_cleaned_test_functions.jsonl/93092 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 925
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
76145,
2019,
368,
341,
262,
2036,
3393,
49,
1999,
3050,
341,
286,
1140,
25,
11312,
3464,
12520,
262,
555,
262,
11605,
31957,
369,
3393,
49,
1999,
3050,
341,
286,
5168,
3705,
2099,
6984,
656,
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... | 4 |
#[test]
fn test_latin1_bin() {
use crate::codec::collation::collator::CollatorLatin1Bin;
use std::cmp::Ordering;
use std::collections::hash_map::DefaultHasher;
use std::hash::Hasher;
let cases = vec![
(
vec![0xFF, 0x88, 0x00, 0x13],
vec![0xFF, 0x88, 0x00, 0x13],
Ordering::Equal,
),
(
vec![0xFF, 0x88, 0x00, 0x13, 0x20, 0x20, 0x20],
vec![0xFF, 0x88, 0x00, 0x13],
Ordering::Equal,
),
(
vec![0xFF, 0x88, 0x00, 0x13, 0x09, 0x09, 0x09],
vec![0xFF, 0x88, 0x00, 0x13],
Ordering::Greater,
),
];
for (sa, sb, od) in cases {
let eval_hash = |s| {
let mut hasher = DefaultHasher::default();
CollatorLatin1Bin::sort_hash(&mut hasher, s).unwrap();
hasher.finish()
};
let cmp = CollatorLatin1Bin::sort_compare(sa.as_slice(), sb.as_slice()).unwrap();
let ha = eval_hash(sa.as_slice());
let hb = eval_hash(sb.as_slice());
assert_eq!(cmp, od, "when comparing {:?} and {:?}", sa, sb);
if od == Ordering::Equal {
assert_eq!(
ha, hb,
"when comparing the hash of {:?} and {:?}, which should be equal",
sa, sb
);
} else {
assert_ne!(
ha, hb,
"when comparing the hash of {:?} and {:?}, which should not be equal",
sa, sb
);
}
}
} | rust_cleaned_test_functions.jsonl/45981 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1089
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
907,
14768,
16,
21816,
368,
341,
286,
990,
17717,
486,
34607,
486,
17222,
367,
486,
17222,
850,
486,
15265,
850,
41547,
16,
28794,
280,
286,
990,
1460,
486,
7293,
486,
4431,
287,
280,
286,
990,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_unrecognized_file_type_no_theme() {
let mut options = get_command_line_options();
options.theme = Some("none".to_string());
let input = ADDED_FILE_INPUT.replace("a.py", "a");
let output = get_line_of_code_from_delta(&input, &options);
assert_has_plus_color_only(&output, &options);
} | rust_cleaned_test_functions.jsonl/61841 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 170
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
46067,
2458,
1819,
6536,
19864,
368,
341,
16885,
286,
1077,
5206,
2606,
284,
633,
10811,
6528,
8743,
543,
286,
2606,
29451,
284,
4329,
445,
6697,
3263,
983,
3904,
1423,
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_try_from_record_for_sample() {
let record = build_record();
let actual = Sample::try_from(record);
let mut fields = IndexMap::new();
fields.insert(String::from("Assay"), String::from("WholeGenome"));
let expected = Sample::new(String::from("sample0"), fields);
assert_eq!(actual, Ok(expected));
} | rust_cleaned_test_functions.jsonl/125329 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
5673,
14192,
5478,
17491,
368,
341,
286,
1077,
3255,
284,
1936,
14192,
543,
286,
1077,
5042,
284,
19143,
486,
1539,
5673,
23794,
626,
286,
1077,
5206,
5043,
284,
8008,
2227,
486,
931,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_estimatable() {
let mut estimatable = TestEstimateable { point: None };
estimatable.estimate(StoryPoint::new(2).unwrap());
assert_eq!(estimatable.point, Some(StoryPoint::new(2).unwrap()))
} | rust_cleaned_test_functions.jsonl/24246 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18583,
318,
15086,
368,
341,
286,
1077,
5206,
14932,
15086,
284,
3393,
13782,
3426,
480,
314,
1459,
25,
2240,
2605,
286,
14932,
15086,
13,
40130,
7,
17938,
2609,
486,
931,
7,
17,
568,
15454,
142... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_number_errors() {
test_parse_err::<f64>(&[
("+", "expected value at line 1 column 1"),
(".", "expected value at line 1 column 1"),
("-", "invalid number at line 1 column 1"),
("00", "invalid number at line 1 column 2"),
("0x80", "trailing characters at line 1 column 2"),
("\\0", "expected value at line 1 column 1"),
("1.", "invalid number at line 1 column 2"),
("1.a", "invalid number at line 1 column 3"),
("1.e1", "invalid number at line 1 column 3"),
("1e", "invalid number at line 1 column 2"),
("1e+", "invalid number at line 1 column 3"),
("1a", "trailing characters at line 1 column 2"),
(
"100e777777777777777777777777777",
"number out of range at line 1 column 14",
),
(
"-100e777777777777777777777777777",
"number out of range at line 1 column 15",
),
(
"1000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000000000000000000000000000000000\
000000000", // 1e309
"number out of range at line 1 column 310",
),
(
"1000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000000000000000000000000000000000\
.0e9", // 1e309
"number out of range at line 1 column 305",
),
(
"1000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000000000000000000000000000000000\
000000000000000000000000000000000000000000000000000000000000\
e9", // 1e309
"number out of range at line 1 column 303",
),
]);
} | rust_cleaned_test_functions.jsonl/29830 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 930
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
5500,
20196,
368,
341,
262,
1273,
21039,
9266,
27638,
69,
21,
19,
44784,
9640,
286,
3489,
44056,
330,
7325,
897,
518,
1555,
220,
16,
3250,
220,
16,
4461,
286,
320,
3263,
497,
330,
7325,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_boolean_equal() {
let a = BooleanArray::from(vec![false, false, true]).data();
let b = BooleanArray::from(vec![false, false, true]).data();
test_equal(a.as_ref(), b.as_ref(), true);
let b = BooleanArray::from(vec![false, false, false]).data();
test_equal(a.as_ref(), b.as_ref(), false);
// Test the case where null_count > 0
let a = BooleanArray::from(vec![Some(false), None, None, Some(true)]).data();
let b = BooleanArray::from(vec![Some(false), None, None, Some(true)]).data();
test_equal(a.as_ref(), b.as_ref(), true);
let b = BooleanArray::from(vec![None, None, None, Some(true)]).data();
test_equal(a.as_ref(), b.as_ref(), false);
let b = BooleanArray::from(vec![Some(true), None, None, Some(true)]).data();
test_equal(a.as_ref(), b.as_ref(), false);
// Test the case where offset != 0
let a =
BooleanArray::from(vec![false, true, false, true, false, false, true]).data();
let b =
BooleanArray::from(vec![false, false, false, true, false, true, true]).data();
assert_eq!(equal(a.as_ref(), b.as_ref()), false);
assert_eq!(equal(b.as_ref(), a.as_ref()), false);
let a_slice = a.slice(2, 3);
let b_slice = b.slice(2, 3);
assert_eq!(equal(&a_slice, &b_slice), true);
assert_eq!(equal(&b_slice, &a_slice), true);
let a_slice = a.slice(3, 4);
let b_slice = b.slice(3, 4);
assert_eq!(equal(&a_slice, &b_slice), false);
assert_eq!(equal(&b_slice, &a_slice), false);
} | rust_cleaned_test_functions.jsonl/46940 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 746
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46642,
11478,
368,
341,
286,
1077,
264,
284,
6992,
1857,
486,
1499,
25592,
20703,
3849,
11,
895,
11,
830,
10697,
691,
543,
286,
1077,
293,
284,
6992,
1857,
486,
1499,
25592,
20703,
3849,
11,
895... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ancestor_match() {
let doc_text = br#"
<b><a>rad</a></b>
"#;
let css_text = br#"
* {
color: black;
}
b a {
color:red;
}
"#;
let (doc, stylesheet,stree,lbox, rbox) = standard_test_run(doc_text, css_text).unwrap();
let snode = stree.root.borrow();
println!("doc is {:#?} {:#?} {:#?}",doc,stylesheet,snode);
//check b
assert_eq!(snode.specified_values.get("color").unwrap(),
&Keyword(String::from("black")));
// check b a
let f = snode.children.borrow();
let f2 = &f[0];
f2.specified_values.get("color").unwrap();
assert_eq!(snode.children.borrow()[0].specified_values.get("color").unwrap(),
&Keyword(String::from("red")));
} | rust_cleaned_test_functions.jsonl/101342 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 399
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
66878,
10708,
368,
341,
262,
1077,
4629,
4326,
284,
1411,
2,
698,
262,
366,
65,
1784,
64,
29,
13281,
522,
64,
1472,
65,
397,
262,
5869,
280,
262,
1077,
15877,
4326,
284,
1411,
2,
698,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_naive_time() -> Result<()> {
let db = checked_memory_handle()?;
let time = NaiveTime::from_hms(23, 56, 4);
db.execute("INSERT INTO foo (t) VALUES (?)", [time])?;
let s: String = db.query_row("SELECT t FROM foo", [], |r| r.get(0))?;
assert_eq!("23:56:04", s);
let v: NaiveTime = db.query_row("SELECT t FROM foo", [], |r| r.get(0))?;
assert_eq!(time, v);
Ok(())
} | rust_cleaned_test_functions.jsonl/88684 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 229
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58631,
533,
3009,
368,
1464,
5714,
71698,
341,
286,
1077,
2927,
284,
10067,
19195,
10630,
94136,
286,
1077,
882,
284,
12812,
533,
1462,
486,
1499,
1523,
1011,
7,
17,
18,
11,
220,
20,
21,
11,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_generic() {
let mut g = Generic::new(
{
let mut v = Zeros::new();
v.push_back((0, 0.69));
v.push_back((1, 0.32));
v.push_back((2, 0.13));
v.push_back((6, 0.4892));
v
},
{
let mut v = Poles::new();
v.push_back((1, 0.378_946_24));
v.push_back((5, 0.125_012_84));
v.push_back((300, 0.104_536_59));
v
},
);
let mut s = Sine::new(440.0);
let mut t = bae_rs::SampleTrackT::new();
for _ in 0..bae_rs::SAMPLE_RATE {
t.push(g.process(s.process() * 0.25));
}
let f = ".junk/modifiers/generic.wav";
write_wav(vec![t], 24, &mut File::create(f).unwrap(), false).unwrap();
} | rust_cleaned_test_functions.jsonl/67275 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 555
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41232,
368,
341,
286,
1077,
5206,
342,
284,
21281,
486,
931,
1006,
310,
341,
394,
1077,
5206,
348,
284,
1863,
6264,
486,
931,
1428,
394,
348,
2552,
3895,
1188,
15,
11,
220,
15,
13,
21,
24,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_empty_objects_to_skip2() {
let data = [
0x38, 0x28, 0x01, 0x00, 0x03, 0x00, 0x03, 0x00, 0x04, 0x00, 0x38, 0x29, 0x01, 0x00,
0x03, 0x00, 0x38, 0x30, 0x04, 0x00, 0x04, 0x00,
];
let tape = parse(&data[..]).unwrap();
assert_eq!(
tape.token_tape,
vec![
BinaryToken::Token(0x2838),
BinaryToken::Object(6),
BinaryToken::Token(0x2938),
BinaryToken::Array(5),
BinaryToken::Token(0x3038),
BinaryToken::End(3),
BinaryToken::End(1),
]
);
} | rust_cleaned_test_functions.jsonl/109421 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 421
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
24873,
2346,
44830,
17,
368,
341,
286,
1077,
821,
284,
2278,
310,
220,
15,
87,
18,
23,
11,
220,
15,
87,
17,
23,
11,
220,
15,
87,
15,
16,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_status_service() {
let temp_dir = tempfile::TempDir::new().unwrap();
let mut status_server = StatusServer::new(
1,
ConfigController::default(),
Arc::new(SecurityConfig::default()),
MockRouter,
temp_dir.path().to_path_buf(),
)
.unwrap();
let addr = "127.0.0.1:0".to_owned();
let _ = status_server.start(addr);
let client = Client::new();
let uri = Uri::builder()
.scheme("http")
.authority(status_server.listening_addr().to_string().as_str())
.path_and_query("/metrics")
.build()
.unwrap();
let handle = status_server.thread_pool.spawn(async move {
let res = client.get(uri).await.unwrap();
assert_eq!(res.status(), StatusCode::OK);
});
block_on(handle).unwrap();
status_server.stop();
} | rust_cleaned_test_functions.jsonl/6911 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 480
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4773,
12267,
368,
341,
286,
1077,
2730,
4334,
284,
54819,
486,
12151,
6184,
486,
931,
1005,
15454,
543,
286,
1077,
5206,
2639,
12015,
284,
8104,
5475,
486,
931,
1006,
310,
220,
16,
345,
310,
553... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_alloc_bio_desc() {
let mut f = OpenOptions::new()
.truncate(true)
.create(true)
.write(true)
.read(true)
.open("/tmp/buf_3")
.unwrap();
let mut writer = Box::new(f.try_clone().unwrap()) as RafsIoWriter;
let mut reader = Box::new(f.try_clone().unwrap()) as RafsIoReader;
let file_name = OsString::from("c_inode_3");
let mut ondisk_inode = OndiskInode::new();
ondisk_inode.i_name_size = align_to_rafs(file_name.len()) as u16;
ondisk_inode.i_child_count = 4;
ondisk_inode.i_mode = libc::S_IFREG;
ondisk_inode.i_size = 1024 * 1024 * 3 + 8192;
let inode = OndiskInodeWrapper {
name: file_name.as_os_str(),
symlink: None,
inode: &ondisk_inode,
};
inode.store(&mut writer).unwrap();
let mut size = ondisk_inode.i_size;
for i in 0..ondisk_inode.i_child_count {
let mut chunk = OndiskChunkInfo::new();
chunk.decompress_size = cmp::min(1024 * 1024, size as u32);
chunk.decompress_offset = (i * 1024 * 1024) as u64;
chunk.compress_size = chunk.decompress_size / 2;
chunk.compress_offset = ((i * 1024 * 1024) / 2) as u64;
chunk.file_offset = chunk.decompress_offset;
chunk.store(&mut writer).unwrap();
size -= chunk.decompress_size as u64;
}
f.seek(Start(0)).unwrap();
let mut meta = Arc::new(RafsSuperMeta::default());
Arc::get_mut(&mut meta).unwrap().block_size = 1024 * 1024;
let mut blob_table = Arc::new(OndiskBlobTable::new());
Arc::get_mut(&mut blob_table)
.unwrap()
.add(String::from("123333"), 0, 0);
let mut cached_inode = CachedInode::new(blob_table, meta.clone());
cached_inode.load(&meta, &mut reader).unwrap();
let desc1 = cached_inode.alloc_bio_desc(0, 100).unwrap();
assert_eq!(desc1.bi_size, 100);
assert_eq!(desc1.bi_vec.len(), 1);
assert_eq!(desc1.bi_vec[0].offset, 0);
assert_eq!(desc1.bi_vec[0].blob_id, "123333");
let desc2 = cached_inode.alloc_bio_desc(1024 * 1024 - 100, 200).unwrap();
assert_eq!(desc2.bi_size, 200);
assert_eq!(desc2.bi_vec.len(), 2);
assert_eq!(desc2.bi_vec[0].offset, 1024 * 1024 - 100);
assert_eq!(desc2.bi_vec[0].size, 100);
assert_eq!(desc2.bi_vec[1].offset, 0);
assert_eq!(desc2.bi_vec[1].size, 100);
let desc3 = cached_inode
.alloc_bio_desc(1024 * 1024 + 8192, 1024 * 1024 * 4)
.unwrap();
assert_eq!(desc3.bi_size, 1024 * 1024 * 2);
assert_eq!(desc3.bi_vec.len(), 3);
assert_eq!(desc3.bi_vec[2].size, 8192);
drop(f);
std::fs::remove_file("/tmp/buf_3").unwrap();
} | rust_cleaned_test_functions.jsonl/74899 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1487
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14802,
89641,
10986,
368,
341,
286,
1077,
5206,
282,
284,
5264,
3798,
486,
931,
741,
310,
659,
66054,
3715,
340,
310,
659,
3182,
3715,
340,
310,
659,
4934,
3715,
340,
310,
659,
878,
3715,
340,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_unclosed_bracket_errors() {
assert!(Pattern::new("abc[def").unwrap_err().pos == 3);
assert!(Pattern::new("abc[!def").unwrap_err().pos == 3);
assert!(Pattern::new("abc[").unwrap_err().pos == 3);
assert!(Pattern::new("abc[!").unwrap_err().pos == 3);
assert!(Pattern::new("abc[d").unwrap_err().pos == 3);
assert!(Pattern::new("abc[!d").unwrap_err().pos == 3);
assert!(Pattern::new("abc[]").unwrap_err().pos == 3);
assert!(Pattern::new("abc[!]").unwrap_err().pos == 3);
} | rust_cleaned_test_functions.jsonl/40567 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
76576,
9259,
17682,
5709,
20196,
368,
341,
286,
2060,
10297,
15760,
486,
931,
445,
13683,
58,
750,
1827,
15454,
9266,
1005,
966,
621,
220,
18,
317,
286,
2060,
10297,
15760,
486,
931,
445,
13683,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reconstruct1() {
let result = reconstruct(&vec![
Clue::None,
Clue::Plus,
Clue::Plus,
Clue::Minus,
Clue::Plus,
]);
assert_eq!(result, vec![1, 2, 3, 0, 4]);
} | rust_cleaned_test_functions.jsonl/38562 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 129
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
7596,
16,
368,
341,
262,
1077,
1102,
284,
43828,
2099,
4083,
90515,
286,
2435,
361,
486,
4064,
345,
286,
2435,
361,
486,
21807,
345,
286,
2435,
361,
486,
21807,
345,
286,
2435,
361,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_splice_inclusive_range() {
let mut v = vec![1, 2, 3, 4, 5];
let a = [10, 11, 12];
let t1: Vec<_> = v.splice(2..=3, a.iter().cloned()).collect();
assert_eq!(v, &[1, 2, 10, 11, 12, 5]);
assert_eq!(t1, &[3, 4]);
let t2: Vec<_> = v.splice(1..=2, Some(20)).collect();
assert_eq!(v, &[1, 20, 11, 12, 5]);
assert_eq!(t2, &[2, 10]);
} | rust_cleaned_test_functions.jsonl/24429 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 204
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10123,
4754,
1243,
8336,
9698,
368,
341,
262,
1077,
5206,
348,
284,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
262,
1077,
264,
284,
508,
16,
15,
11,
220,
16,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multiple_attributes() {
let input = "\x1B[1;31mhi";
let ansistring = ANSIParser::default().parse_ansi(input);
let mut it = ansistring.iter();
let attr = Attr {
fg: Color::AnsiValue(1),
effect: Effect::BOLD,
..Attr::default()
};
assert_eq!(Some(('h', attr)), it.next());
assert_eq!(Some(('i', attr)), it.next());
assert_eq!(None, it.next());
assert_eq!(ansistring.stripped(), "hi");
} | rust_cleaned_test_functions.jsonl/92164 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 268
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45233,
18240,
368,
341,
286,
1077,
1946,
284,
2917,
87,
16,
33,
58,
16,
26,
18,
16,
76,
6023,
876,
286,
1077,
8099,
73756,
284,
2100,
50,
3298,
10425,
486,
2258,
1005,
6400,
62,
52067,
5384,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.