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_strings() {
assert_parses("f(\"\",\"\")");
assert_parses("f(\"\")");
assert_parses("(\"\")");
assert_parses("f('','')");
assert_parses("f('')");
assert_parses("('')");
} | rust_cleaned_test_functions.jsonl/7972 | {
"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,
33500,
368,
341,
262,
2060,
77113,
288,
445,
69,
36014,
16215,
22245,
899,
797,
262,
2060,
77113,
288,
445,
69,
7,
22245,
899,
797,
262,
2060,
77113,
288,
31732,
22245,
899,
797,
262,
2060,
7711... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_capacity() {
let mut ll = LinkedList::<u8>::with_capacity(2);
assert_eq!(ll.len(), 0);
assert_eq!(ll.capacity(), 2);
for _ in 0..5 {
ll.push_head(11);
}
assert_eq!(ll.len(), 5);
assert_eq!(ll.capacity(), 8);
//now add another 3
for _ in 0..3 {
ll.push_head(11);
}
assert_eq!(ll.len(), 8);
assert_eq!(ll.capacity(), 8);
//add one more
ll.push_head(11);
assert_eq!(ll.len(), 9);
assert_eq!(ll.capacity(), 16);
//now add another 8
for _ in 0..8 {
ll.push_head(11);
}
assert_eq!(ll.len(), 17);
assert_eq!(ll.capacity(), 32);
let mut ll = LinkedList::<u8>::with_capacity(17);
for _ in 0..18 {
ll.push_head(11);
}
assert_eq!(ll.len(), 18);
assert_eq!(ll.capacity(), 34);
} | rust_cleaned_test_functions.jsonl/59887 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 534
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35603,
368,
341,
286,
1077,
5206,
9323,
284,
22917,
27638,
84,
23,
6831,
4197,
35603,
7,
17,
317,
286,
2060,
10714,
10297,
654,
19406,
1507,
220,
15,
317,
286,
2060,
10714,
10297,
654,
59168,
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... | 5 |
#[test]
fn test_functionality() -> Result<()> {
use p256::NistP256;
#[cfg(feature = "ristretto255")]
{
use crate::Ristretto255;
verifiable_retrieval::<Ristretto255>();
verifiable_bad_public_key::<Ristretto255>();
zeroize_verifiable_client::<Ristretto255>();
zeroize_verifiable_server::<Ristretto255>();
}
verifiable_retrieval::<NistP256>();
verifiable_bad_public_key::<NistP256>();
zeroize_verifiable_client::<NistP256>();
zeroize_verifiable_server::<NistP256>();
Ok(())
} | rust_cleaned_test_functions.jsonl/78626 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 320
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9174,
2719,
368,
1464,
5714,
71698,
341,
286,
990,
281,
17,
20,
21,
486,
45,
380,
47,
17,
20,
21,
401,
286,
11506,
14072,
27062,
284,
330,
2819,
2122,
983,
17,
20,
20,
5422,
286,
341,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_chacha() {
let cipher = botan::Cipher::new("ChaCha20", botan::CipherDirection::Encrypt).unwrap();
assert_eq!(cipher.tag_length(), 0);
let key_spec = cipher.key_spec().unwrap();
assert!(key_spec.is_valid_keylength(0) == false);
assert!(key_spec.is_valid_keylength(16));
assert!(key_spec.is_valid_keylength(32));
assert!(key_spec.is_valid_keylength(48) == false);
let key = vec![0; 32];
let expected = botan::hex_decode("76B8E0ADA0F13D90405D6AE55386BD28BDD219B8A08DED1AA836EFCC8B770DC7DA41597C5157488D7724E03FB8D84A376A43B8F41518A11CC387B669").unwrap();
cipher.set_key(&key).unwrap();
assert!(cipher.set_associated_data(&[1,2,3]).is_err()); // not an AEAD
assert!(cipher.set_associated_data(&[]).is_err());
let iv = vec![];
let input = vec![0; expected.len()];
let ctext = cipher.process(&iv, &input).unwrap();
assert_eq!(ctext, expected);
} | rust_cleaned_test_functions.jsonl/95291 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 411
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4138,
51576,
368,
341,
262,
1077,
31088,
284,
10924,
276,
486,
79460,
486,
931,
445,
95971,
95971,
17,
15,
497,
10924,
276,
486,
79460,
9268,
486,
61520,
568,
15454,
1428,
262,
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_ipv4_fragment_not_multiple_of_offset_unit() {
let mut ctx = DummyContext::default();
let fragment_id = 0;
assert_eq!(ctx.get_state_mut().cache_size, 0);
// Test that fragment bodies must be a multiple of
// Process fragment #0
process_ipv4_fragment(&mut ctx, fragment_id, 0, 2, ExpectedResult::NeedMore);
// Process fragment #1 (body size is not a multiple of
let mut builder = get_ipv4_builder();
builder.id(fragment_id);
builder.fragment_offset(1);
builder.mf_flag(true);
// Body with 1 byte less than `FRAGMENT_BLOCK_SIZE` so it is not a
// multiple of `FRAGMENT_BLOCK_SIZE`.
let mut body: Vec<u8> = Vec::new();
body.extend(FRAGMENT_BLOCK_SIZE..FRAGMENT_BLOCK_SIZE * 2 - 1);
let mut buffer = Buf::new(body, ..).encapsulate(builder).serialize_vec_outer().unwrap();
let packet = buffer.parse::<Ipv4Packet<_>>().unwrap();
assert_frag_proc_state_invalid!(process_fragment::<Ipv4, _, &[u8]>(&mut ctx, packet));
// Process fragment #1 (body size is not a multiple of
// allowed to not be a multiple of `FRAGMENT_BLOCK_SIZE`.
let mut builder = get_ipv4_builder();
builder.id(fragment_id);
builder.fragment_offset(1);
builder.mf_flag(false);
// Body with 1 byte less than `FRAGMENT_BLOCK_SIZE` so it is not a
// multiple of `FRAGMENT_BLOCK_SIZE`.
let mut body: Vec<u8> = Vec::new();
body.extend(FRAGMENT_BLOCK_SIZE..FRAGMENT_BLOCK_SIZE * 2 - 1);
let mut buffer = Buf::new(body, ..).encapsulate(builder).serialize_vec_outer().unwrap();
let packet = buffer.parse::<Ipv4Packet<_>>().unwrap();
let (key, packet_len) = assert_frag_proc_state_ready!(
process_fragment::<Ipv4, _, &[u8]>(&mut ctx, packet),
DUMMY_CONFIG_V4.remote_ip.get(),
DUMMY_CONFIG_V4.local_ip.get(),
fragment_id,
35
);
validate_cache_size(ctx.get_state());
let mut buffer: Vec<u8> = vec![0; packet_len];
let mut buffer = &mut buffer[..];
let packet =
reassemble_packet::<Ipv4, _, &mut [u8], _>(&mut ctx, &key, &mut buffer).unwrap();
let mut expected_body: Vec<u8> = Vec::new();
expected_body.extend(0..15);
assert_eq!(packet.body(), &expected_body[..]);
assert_eq!(ctx.get_state_mut().cache_size, 0);
} | rust_cleaned_test_functions.jsonl/22027 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1187
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49378,
19,
43012,
7913,
45233,
3575,
6917,
14832,
368,
341,
286,
1077,
5206,
5635,
284,
50567,
1972,
486,
2258,
543,
286,
1077,
12289,
842,
284,
220,
15,
401,
286,
2060,
10714,
10297,
3773,
670,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_if_let_with_match_available_range_left() {
check_assist_not_applicable(
replace_if_let_with_match,
r#"
impl VariantData {
pub fn foo(&self) {
$0 if let VariantData::Struct(..) = *self {
self.foo();
}
}
}
"#,
)
} | rust_cleaned_test_functions.jsonl/32541 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 174
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11119,
62,
1149,
6615,
10708,
26962,
9698,
9579,
368,
341,
286,
1779,
12083,
380,
7913,
8191,
46114,
1006,
310,
8290,
11119,
62,
1149,
6615,
10708,
345,
310,
435,
2,
698,
6383,
39292,
1043,
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_mixed_mode() {
let a_rsne = make_rsne(
Some(cipher::CCMP_128),
vec![cipher::CCMP_128, cipher::TKIP],
vec![akm::PSK, akm::FT_PSK],
);
assert_eq!(is_rsn_compatible(&a_rsne), true);
let s_rsne = derive_s_rsne(&a_rsne).unwrap();
let expected_rsne_bytes =
vec![48, 18, 1, 0, 0, 15, 172, 4, 1, 0, 0, 15, 172, 4, 1, 0, 0, 15, 172, 2];
assert_eq!(rsne_as_bytes(s_rsne), expected_rsne_bytes);
} | rust_cleaned_test_functions.jsonl/113754 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 292
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
3286,
7302,
368,
341,
286,
1077,
264,
47115,
811,
284,
1281,
47115,
811,
1006,
310,
4329,
1337,
10558,
486,
3706,
5781,
62,
16,
17,
23,
1326,
310,
7486,
20703,
67586,
486,
3706,
5781,
62,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_for_destructoring_ref_tuple() {
let v = [
((('a',), NotClonable('b')), &'c'),
((('d',), NotClonable('e')), &'f'),
((('g',), NotClonable('h')), &'i'),
];
let t = ForDestructoringRefTupleTemplate { v: &v };
assert_eq!(t.render().unwrap(), "abc-def-ghi-");
} | rust_cleaned_test_functions.jsonl/24302 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5478,
2259,
3086,
287,
7793,
21773,
368,
341,
262,
1077,
348,
284,
2278,
286,
1781,
492,
64,
516,
701,
2806,
5066,
263,
480,
492,
65,
46259,
30136,
66,
3299,
286,
1781,
492,
67,
516,
701,
2806... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_single() {
assert_eq!(
Variant::VSingle(1.1).plus(Variant::VSingle(2.4)).unwrap(),
Variant::VSingle(3.5)
);
} | rust_cleaned_test_functions.jsonl/84528 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19487,
368,
341,
394,
2060,
10714,
33673,
503,
39292,
486,
53,
10888,
7,
16,
13,
16,
568,
7138,
12410,
15341,
486,
53,
10888,
7,
17,
13,
19,
4579,
15454,
3148,
503,
39292,
486,
53,
10888,
7,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_3XNN() {
// 0x3XNN - Skip the following instruction if the value of register VX equals NN
let opcode = 0x3456;
let mut vm = get_vm();
//not equal
vm.program_counter = 0x0;
vm.execute_instruction(decode_opcode(opcode), opcode);
assert_eq!(vm.program_counter, 0x0);
//equal
vm.program_counter = 0x0;
vm.v[0x4] = 0x56;
vm.execute_instruction(decode_opcode(opcode), opcode);
assert_eq!(vm.program_counter, 0x2);
} | rust_cleaned_test_functions.jsonl/243 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 213
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
18,
55,
9745,
368,
341,
262,
442,
220,
15,
87,
18,
55,
9745,
481,
25784,
279,
2701,
7600,
421,
279,
897,
315,
4161,
78177,
16819,
44678,
271,
262,
1077,
30028,
284,
220,
15,
87,
18,
19,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dispatch_with_inform_returns_ack() {
let inform = new_test_inform();
let mut server = new_test_server(|| 42);
let got = server.dispatch(inform).unwrap();
let want = new_test_inform_ack();
assert_eq!(got, want, "expected: {:?}\ngot: {:?}", want, got);
} | rust_cleaned_test_functions.jsonl/61739 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42991,
6615,
1243,
627,
58900,
48447,
368,
341,
286,
1077,
6051,
284,
501,
4452,
1243,
627,
543,
286,
1077,
5206,
3538,
284,
501,
4452,
12015,
79453,
220,
19,
17,
626,
286,
1077,
2684,
284,
3538... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_burn_one() {
let mut contract = TestContract::new();
let ali_pk = PublicKey::ed25519_from_bytes([3u8; 32]).unwrap();
let ali: Key = ali_pk.to_account_hash().into();
let token_to_burn = "a".to_string();
let tokens_to_remain = vec!["c".to_string(), "d".to_string(), "e".to_string()];
let token_ids: Vec<String> = vec![token_to_burn.clone()]
.iter()
.cloned()
.chain(tokens_to_remain.iter().cloned())
.collect();
contract
.mint_copies(&ali, Some(token_ids), meta::banana(), 4)
.unwrap();
contract.burn_one(&ali, token_to_burn.clone()).unwrap();
// Check balances
assert_eq!(contract.total_supply(), U256::from(3));
assert_eq!(contract.balance_of(&ali), U256::from(3));
// Check burned tokens
assert!(contract.owner_of(&token_to_burn).is_none());
assert!(contract.token_meta(&token_to_burn).is_none());
// Check rest of tokens.
for token_id in &tokens_to_remain {
assert_eq!(&contract.owner_of(token_id).unwrap(), &ali);
assert_eq!(&contract.token_meta(token_id).unwrap(), &meta::banana());
}
} | rust_cleaned_test_functions.jsonl/122726 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 498
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
399,
11667,
368,
341,
262,
1077,
5206,
5116,
284,
3393,
14067,
486,
931,
543,
262,
1077,
18991,
33321,
284,
70280,
486,
291,
17,
20,
20,
16,
24,
5673,
12524,
2561,
18,
84,
23,
26,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_max_kdf_size() {
let max_kdf_size = ScryptKDF::max_kdf_size();
assert_eq!(max_kdf_size, MAX_KDF_SIZE);
} | rust_cleaned_test_functions.jsonl/31979 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 82
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6345,
4698,
2940,
2368,
368,
341,
286,
1077,
1932,
4698,
2940,
2368,
284,
2463,
3571,
42,
5262,
486,
2810,
4698,
2940,
2368,
543,
286,
2060,
10714,
10297,
2810,
4698,
2940,
2368,
11,
8334,
10102,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_add_saturating() {
let a = PrimitiveArray::from([Some(11111i128), Some(11100i128), None, Some(22200i128)])
.to(DataType::Decimal(5, 2));
let b = PrimitiveArray::from([Some(22222i128), Some(22200i128), None, Some(11100i128)])
.to(DataType::Decimal(5, 2));
let result = saturating_add(&a, &b).unwrap();
let expected =
PrimitiveArray::from([Some(33333i128), Some(33300i128), None, Some(33300i128)])
.to(DataType::Decimal(5, 2));
assert_eq!(result, expected);
// Testing trait
let result = a.saturating_add(&b).unwrap();
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/6876 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 333
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
643,
2628,
1095,
368,
341,
286,
1077,
264,
284,
51460,
1857,
486,
1499,
2561,
8373,
7,
16,
16,
16,
16,
16,
72,
16,
17,
23,
701,
4329,
7,
16,
16,
16,
15,
15,
72,
16,
17,
23,
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_assign() {
let mut puzzle = Puzzle::new();
let v0 = puzzle.new_var_with_candidates(&[1]);
let v1 = puzzle.new_var_with_candidates(&[1,2,3]);
puzzle.equals(v0 + v1, 4);
let search = puzzle.step().expect("contradiction");
assert_eq!(search[v0], 1);
assert_eq!(search[v1], 3);
} | rust_cleaned_test_functions.jsonl/73198 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 178
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20688,
368,
341,
286,
1077,
5206,
24626,
284,
60012,
486,
931,
543,
286,
1077,
348,
15,
284,
24626,
4618,
4612,
6615,
73553,
2099,
58,
16,
2558,
286,
1077,
348,
16,
284,
24626,
4618,
4612,
6615,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_int_to_ipv6() {
let a = Ipv6Addr::new(0x1122, 0x3344, 0x5566, 0x7788, 0x99aa, 0xbbcc, 0xddee, 0xff11);
assert_eq!(Ipv6Addr::from(0x112233445566778899aabbccddeeff11u128), a);
} | rust_cleaned_test_functions.jsonl/8038 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 120
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4042,
2346,
49378,
21,
368,
341,
262,
1077,
264,
284,
358,
30168,
21,
13986,
486,
931,
7,
15,
87,
16,
16,
17,
17,
11,
220,
15,
87,
18,
18,
19,
19,
11,
220,
15,
87,
20,
20,
21,
21,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_handle_batch_burn_from() {
let (init_result, mut deps) = init_helper_with_config(
vec![
InitialBalance {
address: HumanAddr("bob".to_string()),
amount: Uint128(10000),
},
InitialBalance {
address: HumanAddr("jerry".to_string()),
amount: Uint128(10000),
},
InitialBalance {
address: HumanAddr("mike".to_string()),
amount: Uint128(10000),
},
],
false,
false,
false,
true,
0,
);
assert!(
init_result.is_ok(),
"Init failed: {}",
init_result.err().unwrap()
);
let (init_result_for_failure, mut deps_for_failure) = init_helper(vec![InitialBalance {
address: HumanAddr("bob".to_string()),
amount: Uint128(10000),
}]);
assert!(
init_result_for_failure.is_ok(),
"Init failed: {}",
init_result_for_failure.err().unwrap()
);
// test when burn disabled
let actions: Vec<_> = ["bob", "jerry", "mike"]
.iter()
.map(|name| batch::BurnFromAction {
owner: HumanAddr(name.to_string()),
amount: Uint128(2500),
memo: None,
})
.collect();
let handle_msg = HandleMsg::BatchBurnFrom {
actions,
padding: None,
};
let handle_result = handle(
&mut deps_for_failure,
mock_env("alice", &[]),
handle_msg.clone(),
);
let error = extract_error_msg(handle_result);
assert!(error.contains("Burn functionality is not enabled for this token."));
// Burn before allowance
let handle_result = handle(&mut deps, mock_env("alice", &[]), handle_msg);
let error = extract_error_msg(handle_result);
assert!(error.contains("insufficient allowance"));
// Burn more than allowance
let allowance_size = 2000;
for name in &["bob", "jerry", "mike"] {
let handle_msg = HandleMsg::IncreaseAllowance {
spender: HumanAddr("alice".to_string()),
amount: Uint128(allowance_size),
padding: None,
expiration: None,
};
let handle_result = handle(&mut deps, mock_env(*name, &[]), handle_msg);
assert!(
handle_result.is_ok(),
"handle() failed: {}",
handle_result.err().unwrap()
);
let handle_msg = HandleMsg::BurnFrom {
owner: HumanAddr(name.to_string()),
amount: Uint128(2500),
memo: None,
padding: None,
};
let handle_result = handle(&mut deps, mock_env("alice", &[]), handle_msg);
let error = extract_error_msg(handle_result);
assert!(error.contains("insufficient allowance"));
}
// Burn some of the allowance
let actions: Vec<_> = [("bob", 200_u128), ("jerry", 300), ("mike", 400)]
.iter()
.map(|(name, amount)| batch::BurnFromAction {
owner: HumanAddr(name.to_string()),
amount: Uint128(*amount),
memo: None,
})
.collect();
let handle_msg = HandleMsg::BatchBurnFrom {
actions,
padding: None,
};
let handle_result = handle(&mut deps, mock_env("alice", &[]), handle_msg);
assert!(
handle_result.is_ok(),
"handle() failed: {}",
handle_result.err().unwrap()
);
for (name, amount) in &[("bob", 200_u128), ("jerry", 300), ("mike", 400)] {
let name_canon = deps
.api
.canonical_address(&HumanAddr(name.to_string()))
.unwrap();
let balance = crate::state::ReadonlyBalances::from_storage(&deps.storage)
.account_amount(&name_canon);
assert_eq!(balance, 10000 - amount);
}
let total_supply = ReadonlyConfig::from_storage(&deps.storage).total_supply();
assert_eq!(total_supply, 10000 * 3 - (200 + 300 + 400));
// Burn the rest of the allowance
let actions: Vec<_> = [("bob", 200_u128), ("jerry", 300), ("mike", 400)]
.iter()
.map(|(name, amount)| batch::BurnFromAction {
owner: HumanAddr(name.to_string()),
amount: Uint128(allowance_size - *amount),
memo: None,
})
.collect();
let handle_msg = HandleMsg::BatchBurnFrom {
actions,
padding: None,
};
let handle_result = handle(&mut deps, mock_env("alice", &[]), handle_msg);
assert!(
handle_result.is_ok(),
"handle() failed: {}",
handle_result.err().unwrap()
);
for name in &["bob", "jerry", "mike"] {
let name_canon = deps
.api
.canonical_address(&HumanAddr(name.to_string()))
.unwrap();
let balance = crate::state::ReadonlyBalances::from_storage(&deps.storage)
.account_amount(&name_canon);
assert_eq!(balance, 10000 - allowance_size);
}
let total_supply = ReadonlyConfig::from_storage(&deps.storage).total_supply();
assert_eq!(total_supply, 3 * (10000 - allowance_size));
// Second burn more than allowance
let actions: Vec<_> = ["bob", "jerry", "mike"]
.iter()
.map(|name| batch::BurnFromAction {
owner: HumanAddr(name.to_string()),
amount: Uint128(1),
memo: None,
})
.collect();
let handle_msg = HandleMsg::BatchBurnFrom {
actions,
padding: None,
};
let handle_result = handle(&mut deps, mock_env("alice", &[]), handle_msg);
let error = extract_error_msg(handle_result);
assert!(error.contains("insufficient allowance"));
} | rust_cleaned_test_functions.jsonl/69610 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3333
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10630,
14534,
880,
399,
5673,
368,
341,
286,
1077,
320,
2327,
5287,
11,
5206,
48178,
8,
284,
2930,
10418,
6615,
5332,
1006,
310,
7486,
90515,
394,
4127,
21190,
341,
503,
2621,
25,
11097,
13986,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_sgx() {
let mut focal = UbuntuDiskConfig::new(FOCAL_SGX_IMAGE_NAME.to_string());
let guest = Guest::new(&mut focal);
let mut workload_path = dirs::home_dir().unwrap();
workload_path.push("workloads");
let mut kernel_path = workload_path;
kernel_path.push("bzImage_w_sgx");
let mut child = GuestCommand::new(&guest)
.args(&["--cpus", "boot=1"])
.args(&["--memory", "size=512M"])
.args(&["--kernel", kernel_path.to_str().unwrap()])
.default_disks()
.default_net()
.args(&["--cmdline", DIRECT_KERNEL_BOOT_CMDLINE])
.args(&["--sgx-epc", "size=64M"])
.capture_output()
.spawn()
.unwrap();
thread::sleep(std::time::Duration::new(20, 0));
let r = std::panic::catch_unwind(|| {
// Check if SGX is correctly detected in the guest.
assert!(guest.check_sgx_support().unwrap());
// Validate the SGX EPC section is 64MiB.
assert_eq!(
guest
.ssh_command("cpuid -l 0x12 -s 2 | grep 'section size' | cut -d '=' -f 2")
.unwrap_or_default()
.trim(),
"0x0000000004000000"
);
// Run a test relying on SGX enclaves and check if it runs
// successfully.
assert!(guest
.ssh_command("cd /linux-sgx/SampleCode/LocalAttestation/bin/ && sudo ./app")
.unwrap_or_default()
.trim()
.contains(
"succeed to load enclaves.\nsucceed to \
establish secure channel.\nSucceed to exchange \
secure message...\nSucceed to close Session..."
));
});
let _ = child.kill();
let output = child.wait_with_output().unwrap();
handle_child_output(r, &output);
} | rust_cleaned_test_functions.jsonl/23995 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1231
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
59957,
368,
341,
310,
1077,
5206,
41099,
284,
34960,
47583,
2648,
486,
931,
7,
3788,
49533,
1098,
84432,
19121,
4708,
2389,
3904,
1423,
310,
1077,
8640,
284,
26215,
486,
931,
2099,
6984,
4109... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_last() {
let mut m = list_from(&[0,1,2,3,4,5]);
assert_eq!(m.last().unwrap(), &5);
m = ImmutSList::new();
assert_eq!(m.last(), None);
} | rust_cleaned_test_functions.jsonl/64460 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12195,
368,
341,
286,
1077,
5206,
296,
284,
1140,
5673,
2099,
58,
15,
11,
16,
11,
17,
11,
18,
11,
19,
11,
20,
2558,
286,
2060,
10714,
10297,
76,
9110,
1005,
15454,
1507,
609,
20,
626,
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_ecdsa_adaptor_signature_recover_from_high_s_signature() {
let encryption_key = "02042537e913ad74c4bbd8da9607ad3b9cb297d08e014afc51133083f1bd687a62"
.parse()
.unwrap();
let adaptor_sig: EcdsaAdaptorSignature = "032c637cd797dd8c2ce261907ed43e82d6d1a48cbabbbece801133dd8d70a01b1403eb615a3e59b1cbbf4f87acaf645be1eda32a066611f35dd5557802802b14b19c81c04c3fefac5783b2077bd43fa0a39ab8a64d4d78332a5d621ea23eca46bc011011ab82dda6deb85699f508744d70d4134bea03f784d285b5c6c15a56e4e1fab4bc356abbdebb3b8fe1e55e6dd6d2a9ea457e91b2e6642fae69f9dbb5258854"
.parse()
.unwrap();
let sig = compact_sig_from_str("2c637cd797dd8c2ce261907ed43e82d6d1a48cbabbbece801133dd8d70a01b14b5f24321f550b7b9dd06ee4fcfd82bdad8b142ff93a790cc4d9f7962b38c6a3b");
let expected_decryption_key: SecretKey =
"324719b51ff2474c9438eb76494b0dc0bcceeb529f0a5428fd198ad8f886e99c"
.parse()
.unwrap();
let recovered = adaptor_sig
.recover(&SECP256K1, &sig, &encryption_key)
.expect("with high s we should still be able to recover the decryption key");
assert_eq!(expected_decryption_key, recovered);
} | rust_cleaned_test_functions.jsonl/62237 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 690
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36844,
96780,
10027,
32657,
39859,
1288,
3688,
5673,
22680,
643,
39859,
368,
341,
286,
1077,
25463,
3097,
284,
330,
15,
17,
15,
19,
17,
20,
18,
22,
68,
24,
16,
18,
329,
22,
19,
66,
19,
6066,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_text() {
assert!(matches!(
EmbedBuilder::new().footer(EmbedFooterBuilder::new("")).build().unwrap_err().kind(),
EmbedErrorType::FooterTextEmpty { text }
if text.is_empty()
));
let too_long_len = EmbedBuilder::FOOTER_TEXT_LENGTH_LIMIT + 1;
assert!(matches!(
EmbedBuilder::new().footer(EmbedFooterBuilder::new("a".repeat(too_long_len))).build().unwrap_err().kind(),
EmbedErrorType::FooterTextTooLong { text }
if text.len() == too_long_len
));
let expected = EmbedFooter {
icon_url: None,
proxy_icon_url: None,
text: "a footer".to_owned(),
};
let actual = EmbedFooterBuilder::new("a footer").build();
assert_eq!(actual, expected);
} | rust_cleaned_test_functions.jsonl/25441 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 412
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4326,
368,
341,
286,
2060,
10297,
19914,
33673,
310,
37068,
3297,
486,
931,
1005,
6956,
7,
25486,
19445,
3297,
486,
931,
445,
15197,
5834,
1005,
15454,
9266,
1005,
15314,
3148,
310,
37068,
1454,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_rpc_request() {
// \"0x68687474703a2f2f3134312e3136342e35382e3234313a35353636\"]}"
// Try title : Vec<u8> encode 746172652d6f63773a3a70726963655f726571756573745f646f6d61696e
// Try body : Vec<u8> encode 68687474703a2f2f3134312e3136342e35382e3234313a35353636
// 687474703a2f2f3134312e3136342e35382e3234313a35353838
let target_json = "are-ocw::price_request_domain";
let target_json_v8 = target_json.encode();
println!("Try title : Vec<u8> encode {:?} ", HexDisplay::from(&target_json_v8));
let target_json = 385329431u32;
let target_json_v8 = target_json.encode();
println!("Try body : Vec<u8> encode {:?} ", HexDisplay::from(&target_json_v8));
// let target_json = "are-ocw::make_price_request_pool";
assert!(true);
} | rust_cleaned_test_functions.jsonl/35135 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 370
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60799,
7893,
368,
341,
11120,
197,
322,
7245,
15,
87,
21,
23,
21,
23,
22,
19,
22,
19,
22,
15,
18,
64,
17,
69,
17,
69,
18,
16,
18,
19,
18,
16,
17,
68,
18,
16,
18,
21,
18,
19,
17,
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_binary_array_get_value_index_out_of_bound() {
let values: [u8; 12] = [
b'h', b'e', b'l', b'l', b'o', b'p', b'a', b'r', b'q', b'u', b'e', b't',
];
let offsets: [i32; 4] = [0, 5, 5, 12];
let array_data = ArrayData::builder(DataType::Utf8)
.len(3)
.add_buffer(Buffer::from(offsets.to_byte_slice()))
.add_buffer(Buffer::from(&values[..]))
.build();
let binary_array = BinaryArray::from(array_data);
binary_array.value(4);
} | rust_cleaned_test_functions.jsonl/19355 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 302
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31761,
3858,
3062,
3142,
3560,
6068,
3575,
19447,
368,
341,
286,
1077,
2750,
25,
508,
84,
23,
26,
220,
16,
17,
60,
284,
2278,
310,
293,
38882,
516,
293,
47868,
516,
293,
63866,
516,
293,
63866... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_srv_encode() {
let srv_bin = vec![
0x00, 0x0a, 0x00, 0x01, 0x1f, 0x90, 0x03, 0x66, 0x74, 0x70, 0x0c, 0x7a, 0x68, 0x61,
0x6e, 0x67, 0x6d, 0x69, 0x6e, 0x67, 0x6b, 0x61, 0x69, 0x02, 0x63, 0x6e, 0x00,
];
let srv_record = DnsTypeSRV::from_str("10 1 8080 ftp.zhangmingkai.cn.", None);
assert_eq!(srv_record.is_ok(), true);
let srv_record = srv_record.unwrap();
let encoded = srv_record.encode(None);
assert_eq!(encoded.is_ok(), true);
assert_eq!(encoded.unwrap(), srv_bin);
} | rust_cleaned_test_functions.jsonl/63629 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 346
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
63921,
11224,
368,
341,
286,
1077,
43578,
21816,
284,
7486,
90515,
310,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
64,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
16,
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_parse_config() {
let f = File::open("testdata/basic-parse.conf").unwrap();
let config = Config::from_toml_read(f).unwrap();
assert_eq!(*BASIC_PARSER_CHECK, config);
} | rust_cleaned_test_functions.jsonl/15730 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 85
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
5332,
368,
341,
262,
1077,
282,
284,
2887,
486,
2508,
445,
92425,
77909,
85382,
13937,
1827,
15454,
543,
262,
1077,
2193,
284,
5532,
486,
1499,
528,
316,
75,
6443,
955,
568,
15454,
543,
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 |
#[test]
fn test_mut_exact_chunks() {
let mut v = [0, 1, 2, 3, 4, 5, 6];
assert_eq!(v.exact_chunks_mut(2).len(), 3);
for (i, chunk) in v.exact_chunks_mut(3).enumerate() {
for x in chunk {
*x = i as u8;
}
}
let result = [0, 0, 0, 1, 1, 1, 6];
assert_eq!(v, result);
} | rust_cleaned_test_functions.jsonl/73394 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 183
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29523,
71084,
65470,
368,
341,
262,
1077,
5206,
348,
284,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,
935,
262,
2060,
10714,
10297,
85,
2223,
531... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_wpa2_get_auth_method() {
let bss = fake_bss!(Wpa2);
let credential = fidl_sme::Credential::Psk(vec![0xAA; 32]);
let protection = get_wpa2_rsna(&fake_device_info(CLIENT_ADDR), &credential, &bss)
.expect("expected successful RSNA with valid PSK");
assert_variant!(protection, Protection::Rsna(rsna) => {
assert_eq!(rsna.supplicant.get_auth_method(), auth::MethodName::Psk);
});
} | rust_cleaned_test_functions.jsonl/6067 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1670,
6595,
17,
3062,
14014,
9032,
368,
341,
286,
1077,
293,
778,
284,
12418,
880,
778,
10297,
54,
6595,
17,
317,
286,
1077,
40207,
284,
32104,
75,
643,
2660,
486,
48265,
486,
47,
4886,
25592,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_claim_neuron_without_minimum_stake_fails() {
let owner = *TEST_NEURON_1_OWNER_PRINCIPAL;
let memo = 1234u64;
let stake = Tokens::from_e8s(50000000u64);
let (_, mut gov, _) = governance_with_staked_unclaimed_neuron(&owner, memo, stake);
let manage_neuron_response = gov
.manage_neuron(
&owner,
&ManageNeuron {
neuron_id_or_subaccount: None,
id: None,
command: Some(Command::ClaimOrRefresh(ClaimOrRefresh {
by: Some(By::MemoAndController(MemoAndController {
memo,
controller: None,
})),
})),
},
)
.now_or_never()
.unwrap();
match manage_neuron_response.command.unwrap() {
CommandResponse::Error(error) => {
assert_eq!(
ErrorType::from_i32(error.error_type).unwrap(),
ErrorType::InsufficientFunds
);
}
_ => panic!("Invalid response."),
};
} | rust_cleaned_test_functions.jsonl/1146 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 594
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84969,
13925,
36090,
39904,
84855,
1261,
726,
761,
6209,
368,
341,
262,
1077,
6372,
284,
353,
10033,
14039,
1511,
711,
62,
16,
74323,
10571,
38439,
3298,
969,
280,
262,
1077,
21438,
284,
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... | 2 |
#[test]
fn test_from_ipv4() {
let ip = IpAddr::V4(Ipv4Addr::new(26, 3, 0, 103));
let name = Name::from_str("103.0.3.26.in-addr.arpa").unwrap();
assert_eq!(Into::<Name>::into(ip), name);
} | rust_cleaned_test_functions.jsonl/38215 | {
"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,
5673,
49378,
19,
368,
341,
286,
1077,
5997,
284,
35033,
13986,
486,
53,
19,
8972,
30168,
19,
13986,
486,
931,
7,
17,
21,
11,
220,
18,
11,
220,
15,
11,
220,
16,
15,
18,
1106,
286,
1077,
829... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_deep_clone_array() {
let mut builder = UInt32Array::builder(1000);
builder.append_slice(&[1, 2, 3, 4, 5, 6]).unwrap();
let array: ArrayRef = Arc::new(builder.finish());
assert_eq!(array.len(), 6);
let sliced = array.slice(0, 2);
assert_eq!(sliced.len(), 2);
let deep_cloned = deep_clone_array(&sliced);
assert!(sliced.data().get_array_memory_size() > deep_cloned.data().get_array_memory_size());
} | rust_cleaned_test_functions.jsonl/30626 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
87044,
54742,
3858,
368,
341,
286,
1077,
5206,
7363,
284,
22275,
18,
17,
1857,
486,
17850,
7,
16,
15,
15,
15,
317,
286,
7363,
2057,
26488,
2099,
58,
16,
11,
220,
17,
11,
220,
18,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_repo_clone() {
let tmpdir = setup("git_repo_clone");
let repo1 = tmpdir.mash("repo1");
let repo2 = tmpdir.mash("repo2");
let repo1file = repo1.mash("README.md");
let repo2file = repo2.mash("README.md");
assert!(sys::remove_all(&tmpdir).is_ok());
// Clone repo 1
assert_eq!(repo1file.exists(), false);
assert!(git::Repo::new(&repo1).unwrap().url("https://github.com/phR0ze/alpine-base.git").clone().is_ok());
assert_eq!(sys::readlines(&repo1file).unwrap()[0], "alpine-base".to_string());
assert_eq!(repo1file.exists(), true);
// Clone repo 2
assert_eq!(repo2file.exists(), false);
assert!(git::Repo::new(&repo2).unwrap().url("https://github.com/phR0ze/alpine-core.git").clone().is_ok());
assert_eq!(sys::readlines(&repo2file).unwrap()[0], "alpine-core".to_string());
assert_eq!(repo2file.exists(), true);
assert!(sys::remove_all(&tmpdir).is_ok());
} | rust_cleaned_test_functions.jsonl/114246 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 482
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37784,
54742,
368,
341,
286,
1077,
4174,
3741,
284,
6505,
445,
12882,
37784,
54742,
797,
286,
1077,
15867,
16,
284,
4174,
3741,
744,
988,
445,
23476,
16,
797,
286,
1077,
15867,
17,
284,
4174,
37... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_exclude_mail() {
let filter = Filter {
exclude_mail: true,
..Filter::default()
};
assert!(filter.is_excluded(&mail("mail@example.org")));
assert!(filter.is_excluded(&mail("foo@bar.dev")));
assert!(!filter.is_excluded(&website("http://bar.dev")));
} | rust_cleaned_test_functions.jsonl/65566 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 165
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88668,
25176,
368,
341,
286,
1077,
4051,
284,
12339,
341,
310,
21687,
25176,
25,
830,
345,
310,
5241,
5632,
486,
2258,
741,
286,
3634,
286,
2060,
10297,
5315,
2079,
2702,
10181,
2099,
3711,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_index_of_next_word() {
let test_cases: Vec<(usize, usize)> = vec![
// const STATUS_FG_COLOR
(0, 6),
// const STATUS_FG_COLOR: color::Rgb
(6, 21),
// const STATUS_FG_COLOR: color::Rgb
(21, 23),
// const STATUS_FG_COLOR: color::Rgb
(23, 28),
(58, 58), // EOL
];
for (start_index, expected_next_word_start_index) in test_cases {
assert_eq!(
Navigator::find_index_of_next_or_previous_word(
&test_row_word_nav(),
start_index,
&Boundary::End
),
expected_next_word_start_index
);
}
} | rust_cleaned_test_functions.jsonl/52835 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 420
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
3560,
3575,
11257,
13533,
368,
341,
262,
1077,
1273,
41427,
25,
11312,
28706,
51878,
11,
22301,
16018,
284,
7486,
90515,
286,
442,
733,
24014,
1400,
38,
14471,
8945,
286,
320,
15,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_set_flags_3() {
let (flags, rest) =
set_flags(svec!["deno", "-r", "--deps", "script.ts", "--allow-write"])
.unwrap();
assert_eq!(rest, svec!["deno", "script.ts"]);
assert_eq!(
flags,
DenoFlags {
reload: true,
allow_write: true,
deps_flag: true,
..DenoFlags::default()
}
);
} | rust_cleaned_test_functions.jsonl/110198 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 176
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
14130,
62,
18,
368,
341,
220,
1077,
320,
11161,
11,
2732,
8,
4035,
262,
738,
14130,
1141,
4083,
0,
1183,
5183,
78,
497,
6523,
81,
497,
14482,
72587,
497,
330,
2282,
21288,
497,
14482,
71... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_realtime_stream_integer_offset_sample_and_hold() {
let spec = "
output a @3Hz := 0
output a_offset := a[-1].defaults(to: 0)
output b @2Hz := b[-1].defaults(to: 0) + a_offset.hold().defaults(to: 0)
";
// workaround using sample and hold
assert_eq!(0, num_type_errors(spec));
} | rust_cleaned_test_functions.jsonl/110728 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 186
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15266,
1678,
12673,
31725,
6917,
17491,
8378,
65824,
368,
341,
286,
1077,
1398,
284,
6228,
310,
2550,
264,
569,
18,
11475,
1669,
220,
15,
198,
310,
2550,
264,
6917,
1669,
264,
7609,
16,
936,
267... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse() {
let mut buf = BytesMut::from("GET /test HTTP/1.1\r\n\r\n");
let settings = WorkerSettings::<HttpApplication>::new(Vec::new(), KeepAlive::Os);
let mut reader = H1Decoder::new();
match reader.decode(&mut buf, &settings) {
Ok(Some(msg)) => {
let req = HttpRequest::from_message(msg.message());
assert_eq!(req.version(), Version::HTTP_11);
assert_eq!(*req.method(), Method::GET);
assert_eq!(req.path(), "/test");
}
Ok(_) | Err(_) => unreachable!("Error during parsing http request"),
}
} | rust_cleaned_test_functions.jsonl/110379 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 320
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
368,
341,
286,
1077,
5206,
6607,
284,
30024,
51440,
486,
1499,
445,
3806,
608,
1944,
10130,
14,
16,
13,
16,
12016,
1699,
12016,
1699,
797,
286,
1077,
5003,
284,
33086,
6086,
27638,
2905,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_from_base_for_char() {
assert_eq!(char::from(Base::A), 'A');
assert_eq!(char::from(Base::C), 'C');
assert_eq!(char::from(Base::G), 'G');
assert_eq!(char::from(Base::T), 'T');
assert_eq!(char::from(Base::N), 'N');
} | rust_cleaned_test_functions.jsonl/26312 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
7651,
5478,
9232,
368,
341,
286,
2060,
10714,
10297,
1762,
486,
1499,
22225,
486,
32,
701,
364,
32,
1157,
286,
2060,
10714,
10297,
1762,
486,
1499,
22225,
486,
34,
701,
364,
34,
1157,
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_is_dot_dir() {
let dirname = ".";
assert!(FileUtil::is_dot_dir(dirname));
let dirname = "./";
assert!(FileUtil::is_dot_dir(dirname));
let dirname = "..";
assert!(FileUtil::is_dot_dir(dirname));
let dirname = "../";
assert!(FileUtil::is_dot_dir(dirname));
let dirname = ".git";
assert!(!FileUtil::is_dot_dir(dirname));
} | rust_cleaned_test_functions.jsonl/94431 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 222
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
30941,
4334,
368,
341,
286,
1077,
29908,
284,
91223,
286,
2060,
10297,
1703,
2742,
486,
285,
30941,
4334,
38802,
1106,
286,
1077,
29908,
284,
5924,
876,
286,
2060,
10297,
1703,
2742,
486,
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_write_response() {
let mut response = Response::new(Version::Http10, StatusCode::OK);
let body = "This is a test";
response.set_body(Body::new(body));
response.set_content_type(MediaType::PlainText);
assert!(response.status() == StatusCode::OK);
assert_eq!(response.body().unwrap(), Body::new(body));
assert_eq!(response.http_version(), Version::Http10);
assert_eq!(response.content_length(), 14);
assert_eq!(response.content_type(), MediaType::PlainText);
let expected_response: &'static [u8] = b"HTTP/1.0 200 \r\n\
Server: Firecracker API\r\n\
Connection: keep-alive\r\n\
Content-Type: text/plain\r\n\
Content-Length: 14\r\n\r\n\
This is a test";
let mut response_buf: [u8; 126] = [0; 126];
assert!(response.write_all(&mut response_buf.as_mut()).is_ok());
assert!(response_buf.as_ref() == expected_response);
// Test response `Allow` header.
let mut response = Response::new(Version::Http10, StatusCode::OK);
let allowed_methods = vec![Method::Get, Method::Patch, Method::Put];
response.set_allow(allowed_methods.clone());
assert_eq!(response.allow(), allowed_methods);
let expected_response: &'static [u8] = b"HTTP/1.0 200 \r\n\
Server: Firecracker API\r\n\
Connection: keep-alive\r\n\
Allow: GET, PATCH, PUT\r\n\r\n";
let mut response_buf: [u8; 90] = [0; 90];
assert!(response.write_all(&mut response_buf.as_mut()).is_ok());
assert_eq!(response_buf.as_ref(), expected_response);
// Test write failed.
let mut response_buf: [u8; 1] = [0; 1];
assert!(response.write_all(&mut response_buf.as_mut()).is_err());
} | rust_cleaned_test_functions.jsonl/33879 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 832
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
9655,
368,
341,
286,
1077,
5206,
2033,
284,
5949,
486,
931,
7,
5637,
486,
2905,
16,
15,
11,
53403,
486,
3925,
317,
286,
1077,
2487,
284,
330,
1986,
374,
264,
1273,
876,
286,
2033,
980,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_exact_chunks_remainder() {
let v: &[i32] = &[0, 1, 2, 3, 4];
let c = v.exact_chunks(2);
assert_eq!(c.remainder(), &[4]);
} | rust_cleaned_test_functions.jsonl/8452 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 88
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71084,
65470,
86607,
1107,
368,
341,
262,
1077,
348,
25,
44590,
72,
18,
17,
60,
284,
44590,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
935,
262,
1077,
272,
284,
348,
2223,
531... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_range_from_take_collect() {
let v: Vec<_> = (0..).take(3).collect();
assert_eq!(v, vec![0, 1, 2]);
} | rust_cleaned_test_functions.jsonl/54154 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 66
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9698,
5673,
73261,
68140,
368,
341,
262,
1077,
348,
25,
11312,
32399,
29,
284,
320,
15,
496,
568,
22769,
7,
18,
568,
17384,
543,
262,
2060,
10714,
10297,
85,
11,
7486,
20703,
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 |
#[test]
fn test_multi_packet() {
let (mut encoder, mut decoder) =
new_optional_multi_packet_codec::<Vec<BinSafeStr>, RespVec>();
let mut buf = BytesMut::new();
let cmd = OptionalMulti::Multi(vec![vec![b"PING1".to_vec()], vec![b"PING2".to_vec()]]);
encoder
.encode(cmd, |data| buf.extend_from_slice(data))
.unwrap();
assert_eq!(buf.as_ref(), b"*1\r\n$5\r\nPING1\r\n*1\r\n$5\r\nPING2\r\n");
let res = decoder.decode(&mut buf);
assert!(decoder.curr_hint.is_none());
assert!(decoder.buf.is_empty());
assert!(decoder.state.consume().is_none());
let pkt = res.unwrap().unwrap();
let response = match pkt {
OptionalMulti::Single(_) => panic!("test_multi_packet"),
OptionalMulti::Multi(response) => response,
};
assert_eq!(response.len(), 2);
} | rust_cleaned_test_functions.jsonl/42453 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 467
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25133,
21078,
368,
341,
286,
1077,
320,
6984,
23668,
11,
5206,
24551,
8,
4035,
310,
501,
74644,
25133,
21078,
51084,
27638,
10050,
27,
28794,
25663,
2580,
8066,
79786,
10050,
3913,
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... | 2 |
#[test]
fn test_get_completed_data_ranges() {
let completed_data_end_indexes = [2, 4, 9, 11].iter().copied().collect();
let start_index = 0;
let consumed = 1;
assert_eq!(
Blockstore::get_completed_data_ranges(
start_index,
&completed_data_end_indexes,
consumed
),
vec![]
);
let start_index = 0;
let consumed = 3;
assert_eq!(
Blockstore::get_completed_data_ranges(
start_index,
&completed_data_end_indexes,
consumed
),
vec![(0, 2)]
);
// Test all possible ranges:
// `completed_data_end_indexes[j] + 1`. Thus the completed data blocks is everything in the
// range:
let completed_data_end_indexes: Vec<_> = completed_data_end_indexes.into_iter().collect();
for i in 0..completed_data_end_indexes.len() {
for j in i..completed_data_end_indexes.len() {
let start_index = completed_data_end_indexes[i];
let consumed = completed_data_end_indexes[j] + 1;
// so the start index is the end index for that data block.
let mut expected = vec![(start_index, start_index)];
expected.extend(
completed_data_end_indexes[i..=j]
.windows(2)
.map(|end_indexes| (end_indexes[0] + 1, end_indexes[1])),
);
let completed_data_end_indexes =
completed_data_end_indexes.iter().copied().collect();
assert_eq!(
Blockstore::get_completed_data_ranges(
start_index,
&completed_data_end_indexes,
consumed
),
expected
);
}
}
} | rust_cleaned_test_functions.jsonl/11705 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
49068,
1769,
58748,
368,
341,
286,
1077,
8145,
1769,
6213,
50161,
284,
508,
17,
11,
220,
19,
11,
220,
24,
11,
220,
16,
16,
936,
2015,
1005,
37728,
1122,
1005,
17384,
1428,
1789,
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... | 3 |
#[test]
fn test_overload_method_in_super_class() {
errors(
"open class A { fun f() {} }
class B: A { fun f(a: int) {} }",
&[
(pos(2, 26), Msg::MissingOverride("f".into())),
(pos(2, 26), Msg::MethodNotOverridable("f".into())),
],
);
ok("open class A { static fun f() {} }
class B: A { static fun f(a: int) {} }");
} | rust_cleaned_test_functions.jsonl/75950 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 245
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15431,
1078,
9032,
1243,
38886,
4790,
368,
341,
286,
5975,
1006,
310,
330,
2508,
536,
362,
314,
2464,
282,
368,
4687,
456,
310,
536,
425,
25,
362,
314,
2464,
282,
2877,
25,
526,
8,
4687,
335,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_next_is() {
let mut ctx = EvalPtr::new("123");
assert!(ctx.next_is('1'));
assert!(!ctx.next_is('2'));
let mut ctx = EvalPtr::new("");
assert!(!ctx.next_is('1'));
} | rust_cleaned_test_functions.jsonl/58899 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11257,
6892,
368,
341,
286,
1077,
5206,
5635,
284,
58239,
5348,
486,
931,
445,
16,
17,
18,
797,
286,
2060,
10297,
3773,
4529,
6892,
492,
16,
6336,
286,
2060,
0,
3471,
3773,
4529,
6892,
492,
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_query_matches_within_byte_range() {
allocations::record(|| {
let language = get_language("javascript");
let query = Query::new(language, "(identifier) @element").unwrap();
let source = "[a, b, c, d, e, f, g]";
let mut parser = Parser::new();
parser.set_language(language).unwrap();
let tree = parser.parse(&source, None).unwrap();
let mut cursor = QueryCursor::new();
let matches =
cursor
.set_byte_range(5, 15)
.matches(&query, tree.root_node(), to_callback(source));
assert_eq!(
collect_matches(matches, &query, source),
&[
(0, vec![("element", "c")]),
(0, vec![("element", "d")]),
(0, vec![("element", "e")]),
]
);
});
} | rust_cleaned_test_functions.jsonl/25177 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 436
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5738,
38344,
72385,
19737,
9698,
368,
341,
262,
69642,
486,
8548,
79453,
341,
286,
1077,
4128,
284,
633,
29021,
445,
14073,
797,
286,
1077,
3239,
284,
11361,
486,
931,
60740,
11,
11993,
15909,
8,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_uri_parse_error() {
fn err(s: &str) {
Uri::from_str(s).unwrap_err();
}
err("http://");
err("htt:p//host");
err("hyper.rs/");
err("hyper.rs?key=val");
err("?key=val");
err("localhost/");
err("localhost?key=val");
err("\0");
err("http://[::1");
err("http://::1]");
err("localhost:8080:3030");
} | rust_cleaned_test_functions.jsonl/29064 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 187
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15572,
21039,
4096,
368,
341,
262,
5168,
1848,
1141,
25,
609,
495,
8,
341,
286,
17226,
486,
1499,
2895,
1141,
568,
15454,
9266,
543,
262,
555,
262,
1848,
445,
1254,
1110,
797,
262,
1848,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_strip_ci_prefix() {
assert_eq!(
strip_ci_prefix("Topic:hello", "topic:"),
Some(String::from("hello"))
);
assert_eq!(
strip_ci_prefix("Topic: hello", "topic:"),
Some(String::from("hello"))
);
assert_eq!(
strip_ci_prefix("topic: hello", "topic:"),
Some(String::from("hello"))
);
assert_eq!(strip_ci_prefix("Issue: hello", "topic:"), None);
assert_eq!(strip_ci_prefix("Topic: hello", "issue:"), None);
assert_eq!(strip_ci_prefix("Github topic: hello", "topic:"), None);
} | rust_cleaned_test_functions.jsonl/31456 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 319
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66130,
43514,
13974,
368,
341,
286,
2060,
10714,
33673,
310,
13316,
43514,
13974,
445,
26406,
25,
14990,
497,
330,
16411,
25,
4461,
310,
4329,
2242,
486,
1499,
445,
14990,
5455,
286,
1439,
286,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_random_uuid4_hex() {
let src_uuid = UUID4::random();
let uuid_hex = src_uuid.hex();
let uuid_parsed =
UUID4::parse(uuid_hex.as_str()).expect("should parse generated uuid correctly");
assert_eq!(src_uuid, uuid_parsed);
let uuid_parsed_hex = uuid_parsed.hex();
assert_eq!(uuid_hex, uuid_parsed_hex);
} | rust_cleaned_test_functions.jsonl/7583 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 202
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22644,
25540,
19,
32655,
368,
341,
286,
1077,
2286,
25540,
284,
23698,
19,
486,
11463,
543,
286,
1077,
16040,
32655,
284,
2286,
25540,
45639,
543,
286,
1077,
16040,
75788,
4035,
310,
23698,
19,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_benchmarks() {
new_test_ext().execute_with(|| {
assert_ok!(test_benchmark_remark::<Test>());
assert_ok!(test_benchmark_set_heap_pages::<Test>());
assert_ok!(test_benchmark_set_code_without_checks::<Test>());
assert_ok!(test_benchmark_set_changes_trie_config::<Test>());
assert_ok!(test_benchmark_set_storage::<Test>());
assert_ok!(test_benchmark_kill_storage::<Test>());
assert_ok!(test_benchmark_kill_prefix::<Test>());
assert_ok!(test_benchmark_suicide::<Test>());
});
} | rust_cleaned_test_functions.jsonl/24682 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 226
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
19762,
15544,
368,
341,
197,
8638,
4452,
9927,
1005,
10257,
6615,
79453,
341,
298,
6948,
19817,
10297,
1944,
880,
39381,
1288,
3987,
27638,
2271,
32872,
298,
6948,
19817,
10297,
1944,
880,
3938... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bpf_loader_upgradeable_set_upgrade_authority() {
let instruction = bincode::serialize(&UpgradeableLoaderInstruction::SetAuthority).unwrap();
let loader_id = bpf_loader_upgradeable::id();
let slot = 0;
let upgrade_authority_address = Pubkey::new_unique();
let upgrade_authority_account = AccountSharedData::new(1, 0, &Pubkey::new_unique());
let new_upgrade_authority_address = Pubkey::new_unique();
let new_upgrade_authority_account = AccountSharedData::new(1, 0, &Pubkey::new_unique());
let program_address = Pubkey::new_unique();
let (programdata_address, _) = Pubkey::find_program_address(
&[program_address.as_ref()],
&bpf_loader_upgradeable::id(),
);
let mut programdata_account = AccountSharedData::new(
1,
UpgradeableLoaderState::programdata_len(0).unwrap(),
&bpf_loader_upgradeable::id(),
);
programdata_account
.set_state(&UpgradeableLoaderState::ProgramData {
slot,
upgrade_authority_address: Some(upgrade_authority_address),
})
.unwrap();
let programdata_meta = AccountMeta {
pubkey: programdata_address,
is_signer: false,
is_writable: false,
};
let upgrade_authority_meta = AccountMeta {
pubkey: upgrade_authority_address,
is_signer: true,
is_writable: false,
};
let new_upgrade_authority_meta = AccountMeta {
pubkey: new_upgrade_authority_address,
is_signer: false,
is_writable: false,
};
// Case: Set to new authority
let accounts = process_instruction(
&loader_id,
&[],
&instruction,
vec![
(programdata_address, programdata_account.clone()),
(upgrade_authority_address, upgrade_authority_account.clone()),
(
new_upgrade_authority_address,
new_upgrade_authority_account.clone(),
),
],
vec![
programdata_meta.clone(),
upgrade_authority_meta.clone(),
new_upgrade_authority_meta.clone(),
],
Ok(()),
);
let state: UpgradeableLoaderState = accounts.first().unwrap().state().unwrap();
assert_eq!(
state,
UpgradeableLoaderState::ProgramData {
slot,
upgrade_authority_address: Some(new_upgrade_authority_address),
}
);
// Case: Not upgradeable
let accounts = process_instruction(
&loader_id,
&[],
&instruction,
vec![
(programdata_address, programdata_account.clone()),
(upgrade_authority_address, upgrade_authority_account.clone()),
],
vec![programdata_meta.clone(), upgrade_authority_meta.clone()],
Ok(()),
);
let state: UpgradeableLoaderState = accounts.first().unwrap().state().unwrap();
assert_eq!(
state,
UpgradeableLoaderState::ProgramData {
slot,
upgrade_authority_address: None,
}
);
// Case: Authority did not sign
process_instruction(
&loader_id,
&[],
&instruction,
vec![
(programdata_address, programdata_account.clone()),
(upgrade_authority_address, upgrade_authority_account.clone()),
],
vec![
programdata_meta.clone(),
AccountMeta {
pubkey: upgrade_authority_address,
is_signer: false,
is_writable: false,
},
],
Err(InstructionError::MissingRequiredSignature),
);
// Case: wrong authority
let invalid_upgrade_authority_address = Pubkey::new_unique();
process_instruction(
&loader_id,
&[],
&instruction,
vec![
(programdata_address, programdata_account.clone()),
(
invalid_upgrade_authority_address,
upgrade_authority_account.clone(),
),
(new_upgrade_authority_address, new_upgrade_authority_account),
],
vec![
programdata_meta.clone(),
AccountMeta {
pubkey: invalid_upgrade_authority_address,
is_signer: true,
is_writable: false,
},
new_upgrade_authority_meta,
],
Err(InstructionError::IncorrectAuthority),
);
// Case: No authority
programdata_account
.set_state(&UpgradeableLoaderState::ProgramData {
slot,
upgrade_authority_address: None,
})
.unwrap();
process_instruction(
&loader_id,
&[],
&instruction,
vec![
(programdata_address, programdata_account.clone()),
(upgrade_authority_address, upgrade_authority_account.clone()),
],
vec![programdata_meta.clone(), upgrade_authority_meta.clone()],
Err(InstructionError::Immutable),
);
// Case: Not a ProgramData account
programdata_account
.set_state(&UpgradeableLoaderState::Program {
programdata_address: Pubkey::new_unique(),
})
.unwrap();
process_instruction(
&loader_id,
&[],
&instruction,
vec![
(programdata_address, programdata_account.clone()),
(upgrade_authority_address, upgrade_authority_account),
],
vec![programdata_meta, upgrade_authority_meta],
Err(InstructionError::InvalidArgument),
);
} | rust_cleaned_test_functions.jsonl/3079 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3273
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
15897,
22139,
67794,
480,
2602,
67794,
22938,
487,
368,
341,
286,
1077,
7600,
284,
9544,
1851,
486,
24166,
2099,
43861,
480,
9181,
16664,
486,
1649,
45532,
568,
15454,
543,
286,
1077,
16047,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_process_notification() {
let exit = Arc::new(AtomicBool::new(false));
let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(100);
let bank = Bank::new_for_tests(&genesis_config);
let bank_forks = Arc::new(RwLock::new(BankForks::new(bank)));
let bank0 = bank_forks.read().unwrap().get(0).unwrap().clone();
let bank1 = Bank::new_from_parent(&bank0, &Pubkey::default(), 1);
bank_forks.write().unwrap().insert(bank1);
let bank1 = bank_forks.read().unwrap().get(1).unwrap().clone();
let bank2 = Bank::new_from_parent(&bank1, &Pubkey::default(), 2);
bank_forks.write().unwrap().insert(bank2);
let bank2 = bank_forks.read().unwrap().get(2).unwrap().clone();
let bank3 = Bank::new_from_parent(&bank2, &Pubkey::default(), 3);
bank_forks.write().unwrap().insert(bank3);
let optimistically_confirmed_bank =
OptimisticallyConfirmedBank::locked_from_bank_forks_root(&bank_forks);
let block_commitment_cache = Arc::new(RwLock::new(BlockCommitmentCache::default()));
let subscriptions = Arc::new(RpcSubscriptions::new_for_tests(
&exit,
bank_forks.clone(),
block_commitment_cache,
optimistically_confirmed_bank.clone(),
));
let mut pending_optimistically_confirmed_banks = HashSet::new();
assert_eq!(optimistically_confirmed_bank.read().unwrap().bank.slot(), 0);
let mut highest_confirmed_slot: Slot = 0;
let mut last_notified_confirmed_slot: Slot = 0;
OptimisticallyConfirmedBankTracker::process_notification(
BankNotification::OptimisticallyConfirmed(2),
&bank_forks,
&optimistically_confirmed_bank,
&subscriptions,
&mut pending_optimistically_confirmed_banks,
&mut last_notified_confirmed_slot,
&mut highest_confirmed_slot,
&None,
);
assert_eq!(optimistically_confirmed_bank.read().unwrap().bank.slot(), 2);
assert_eq!(highest_confirmed_slot, 2);
// Test max optimistically confirmed bank remains in the cache
OptimisticallyConfirmedBankTracker::process_notification(
BankNotification::OptimisticallyConfirmed(1),
&bank_forks,
&optimistically_confirmed_bank,
&subscriptions,
&mut pending_optimistically_confirmed_banks,
&mut last_notified_confirmed_slot,
&mut highest_confirmed_slot,
&None,
);
assert_eq!(optimistically_confirmed_bank.read().unwrap().bank.slot(), 2);
assert_eq!(highest_confirmed_slot, 2);
// Test bank will only be cached when frozen
OptimisticallyConfirmedBankTracker::process_notification(
BankNotification::OptimisticallyConfirmed(3),
&bank_forks,
&optimistically_confirmed_bank,
&subscriptions,
&mut pending_optimistically_confirmed_banks,
&mut last_notified_confirmed_slot,
&mut highest_confirmed_slot,
&None,
);
assert_eq!(optimistically_confirmed_bank.read().unwrap().bank.slot(), 2);
assert_eq!(pending_optimistically_confirmed_banks.len(), 1);
assert!(pending_optimistically_confirmed_banks.contains(&3));
assert_eq!(highest_confirmed_slot, 3);
// Test bank will only be cached when frozen
let bank3 = bank_forks.read().unwrap().get(3).unwrap().clone();
bank3.freeze();
OptimisticallyConfirmedBankTracker::process_notification(
BankNotification::Frozen(bank3),
&bank_forks,
&optimistically_confirmed_bank,
&subscriptions,
&mut pending_optimistically_confirmed_banks,
&mut last_notified_confirmed_slot,
&mut highest_confirmed_slot,
&None,
);
assert_eq!(optimistically_confirmed_bank.read().unwrap().bank.slot(), 3);
assert_eq!(highest_confirmed_slot, 3);
assert_eq!(pending_optimistically_confirmed_banks.len(), 0);
// Test higher root will be cached and clear pending_optimistically_confirmed_banks
let bank3 = bank_forks.read().unwrap().get(3).unwrap().clone();
let bank4 = Bank::new_from_parent(&bank3, &Pubkey::default(), 4);
bank_forks.write().unwrap().insert(bank4);
OptimisticallyConfirmedBankTracker::process_notification(
BankNotification::OptimisticallyConfirmed(4),
&bank_forks,
&optimistically_confirmed_bank,
&subscriptions,
&mut pending_optimistically_confirmed_banks,
&mut last_notified_confirmed_slot,
&mut highest_confirmed_slot,
&None,
);
assert_eq!(optimistically_confirmed_bank.read().unwrap().bank.slot(), 3);
assert_eq!(pending_optimistically_confirmed_banks.len(), 1);
assert!(pending_optimistically_confirmed_banks.contains(&4));
assert_eq!(highest_confirmed_slot, 4);
let bank4 = bank_forks.read().unwrap().get(4).unwrap().clone();
let bank5 = Bank::new_from_parent(&bank4, &Pubkey::default(), 5);
bank_forks.write().unwrap().insert(bank5);
let bank5 = bank_forks.read().unwrap().get(5).unwrap().clone();
OptimisticallyConfirmedBankTracker::process_notification(
BankNotification::Root(bank5),
&bank_forks,
&optimistically_confirmed_bank,
&subscriptions,
&mut pending_optimistically_confirmed_banks,
&mut last_notified_confirmed_slot,
&mut highest_confirmed_slot,
&None,
);
assert_eq!(optimistically_confirmed_bank.read().unwrap().bank.slot(), 5);
assert_eq!(pending_optimistically_confirmed_banks.len(), 0);
assert!(!pending_optimistically_confirmed_banks.contains(&4));
assert_eq!(highest_confirmed_slot, 4);
let bank5 = bank_forks.read().unwrap().get(5).unwrap().clone();
let bank6 = Bank::new_from_parent(&bank5, &Pubkey::default(), 6);
bank_forks.write().unwrap().insert(bank6);
let bank5 = bank_forks.read().unwrap().get(5).unwrap().clone();
let bank7 = Bank::new_from_parent(&bank5, &Pubkey::default(), 7);
bank_forks.write().unwrap().insert(bank7);
bank_forks
.write()
.unwrap()
.set_root(7, &AbsRequestSender::default(), None);
OptimisticallyConfirmedBankTracker::process_notification(
BankNotification::OptimisticallyConfirmed(6),
&bank_forks,
&optimistically_confirmed_bank,
&subscriptions,
&mut pending_optimistically_confirmed_banks,
&mut last_notified_confirmed_slot,
&mut highest_confirmed_slot,
&None,
);
assert_eq!(optimistically_confirmed_bank.read().unwrap().bank.slot(), 5);
assert_eq!(pending_optimistically_confirmed_banks.len(), 0);
assert!(!pending_optimistically_confirmed_banks.contains(&6));
assert_eq!(highest_confirmed_slot, 4);
} | rust_cleaned_test_functions.jsonl/55635 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
34296,
368,
341,
286,
1077,
4869,
284,
19689,
486,
931,
7,
65857,
11233,
486,
931,
3576,
1106,
286,
1077,
40788,
2648,
1731,
314,
59366,
5332,
11,
5241,
335,
284,
1855,
16322,
13774,
5332,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sonar_sweep_window() {
let file = read_file("input/day1.txt");
let input = clean_input(file.as_str());
let vec = input
.map(|l| l.parse::<u64>().unwrap())
.collect::<Vec<u64>>();
assert_eq!(sonar_sweep_window(vec), 1724);
} | rust_cleaned_test_functions.jsonl/16466 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 162
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
263,
277,
643,
48542,
12571,
368,
341,
286,
1077,
1034,
284,
1349,
2458,
445,
1355,
44739,
16,
3909,
797,
286,
1077,
1946,
284,
4240,
5898,
4866,
5357,
2895,
1423,
286,
1077,
7486,
284,
194... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_t10() {
// Truncate
let (r, sioe) = do_execute!(&["-s", ".!"], super::IN_DAT_10);
assert_eq!(buff!(sioe, serr), "");
assert_eq!(buff!(sioe, sout), "{\"foo\":{}}\n",);
assert_eq!(r.is_ok(), true);
let (r, sioe) = do_execute!(&["-s", "\"foo\"!"], super::IN_DAT_10);
assert_eq!(buff!(sioe, serr), "");
assert_eq!(
buff!(sioe, sout),
"{\"a\":null,\"b\":\"bar\",\"c\":1337,\"d\":{}}\n",
);
assert_eq!(r.is_ok(), true);
} | rust_cleaned_test_functions.jsonl/118365 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 330
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
16,
15,
368,
341,
286,
442,
1163,
26900,
198,
286,
1077,
320,
81,
11,
274,
815,
68,
8,
284,
653,
44329,
0,
2099,
1183,
12,
82,
497,
5933,
0,
7914,
2256,
486,
687,
36347,
62,
16,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_min_compares() {
let x = "225.33543601344182".parse::<Decimal>().unwrap();
let y = Decimal::min_value();
assert!(x > y);
assert!(y < x);
assert_ne!(y, x);
} | rust_cleaned_test_functions.jsonl/35139 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7260,
18177,
5403,
368,
341,
262,
1077,
856,
284,
330,
17,
17,
20,
13,
18,
18,
20,
19,
18,
21,
15,
16,
18,
19,
19,
16,
23,
17,
3263,
6400,
27638,
11269,
10483,
15454,
543,
262,
1077,
379,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bootstrap_failed_if_jsonprc_and_api_configured_same_port_and_different_host() {
let runtime = tokio::runtime::Runtime::new().unwrap();
let context = runtime.block_on(new_test_context_async());
let mut cfg = NodeConfig::default();
cfg.randomize_ports();
// same port but different host
cfg.api.address = format!("10.10.10.10:{}", cfg.json_rpc.address.port())
.parse()
.unwrap();
let ret = bootstrap(
&cfg,
ChainId::test(),
context.db.clone(),
context.mempool.ac_client.clone(),
);
assert!(ret.is_err());
} | rust_cleaned_test_functions.jsonl/659 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 330
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88424,
35060,
11119,
9455,
649,
66,
8378,
11697,
5332,
3073,
33574,
8716,
8378,
82741,
12848,
368,
341,
286,
1077,
15592,
284,
9628,
815,
486,
22255,
486,
15123,
486,
931,
1005,
15454,
543,
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... | 1 |
#[test]
fn test_internal_key_encode_decode() {
let test_keys = ["", "k", "hello", "longggggggggggggggggggggg"];
let test_seqs = [
1,
2,
3,
(1u64 << 8) - 1,
1u64 << 8,
(1u64 << 8) + 1,
(1u64 << 16) - 1,
1u64 << 16,
(1u64 << 16) + 1,
(1u64 << 32) - 1,
1u64 << 32,
(1u64 << 32) + 1,
];
for i in 0..test_keys.len() {
for j in 0..test_seqs.len() {
assert_encoded_decoded(test_keys[i], test_seqs[j], ValueType::Value);
assert_encoded_decoded(test_keys[i], test_seqs[j], ValueType::Deletion);
}
}
} | rust_cleaned_test_functions.jsonl/69364 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 471
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23472,
3097,
11224,
15227,
368,
341,
286,
1077,
1273,
12631,
284,
4383,
497,
330,
74,
497,
330,
14990,
497,
330,
4825,
14398,
14398,
14398,
14398,
14398,
14398,
14398,
14398,
14398,
14398,
70,
6332,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_skip_serializing_tuple_struct() {
let a = 1;
assert_ser_tokens(
&SkipSerializingTupleStruct(&a, 2, 3),
&[
Token::TupleStruct {
name: "SkipSerializingTupleStruct",
len: 2,
},
Token::I8(1),
Token::I32(3),
Token::TupleStructEnd,
],
);
assert_ser_tokens(
&SkipSerializingTupleStruct(&a, 2, 123),
&[
Token::TupleStruct {
name: "SkipSerializingTupleStruct",
len: 1,
},
Token::I8(1),
Token::TupleStructEnd,
],
);
} | rust_cleaned_test_functions.jsonl/59142 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 401
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44830,
25602,
4849,
21773,
15126,
368,
341,
262,
1077,
264,
284,
220,
16,
280,
262,
2060,
75861,
28838,
1006,
286,
609,
35134,
5915,
4849,
28681,
9422,
2099,
64,
11,
220,
17,
11,
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... | 1 |
#[test]
fn test_length() {
let cases = vec![
("", 0i64),
("你好", 6i64),
("TiKV", 4i64),
("あなたのことが好きです", 33i64),
("분산 데이터베이스", 25i64),
("россия в мире кубок", 38i64),
("قاعدة البيانات", 27i64),
];
let mut ctx = EvalContext::default();
for (input_str, exp) in cases {
let input = datum_expr(Datum::Bytes(input_str.as_bytes().to_vec()));
let op = scalar_func_expr(ScalarFuncSig::Length, &[input]);
let op = Expression::build(&mut ctx, op).unwrap();
let got = op.eval(&mut ctx, &[]).unwrap();
let exp = Datum::from(exp);
assert_eq!(got, exp, "length('{:?}')", input_str);
}
// test NULL case
let input = datum_expr(Datum::Null);
let op = scalar_func_expr(ScalarFuncSig::Length, &[input]);
let op = Expression::build(&mut ctx, op).unwrap();
let got = op.eval(&mut ctx, &[]).unwrap();
let exp = Datum::Null;
assert_eq!(got, exp, "length(NULL)");
} | rust_cleaned_test_functions.jsonl/9082 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 632
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5118,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
3489,
497,
220,
15,
72,
21,
19,
1326,
310,
3489,
108386,
497,
220,
21,
72,
21,
19,
1326,
310,
3489,
45351,
82707,
497,
220,
19,
72,
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_ncomponents_err() {
let input = DatasetBase::from(Array::random((4, 4), Uniform::new(0.0, 1.0)));
let ica = FastIca::params().ncomponents(100);
let ica = ica.fit(&input);
assert!(ica.is_err());
} | rust_cleaned_test_functions.jsonl/5319 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1089,
5149,
9266,
368,
341,
286,
1077,
1946,
284,
39183,
3978,
486,
1499,
38192,
486,
11463,
1188,
19,
11,
220,
19,
701,
47889,
486,
931,
7,
15,
13,
15,
11,
220,
16,
13,
15,
4945,
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_phantom_data() {
struct Bar;
#[derive(PeekPoke)]
struct Foo {
x: u32,
y: u32,
_marker: PhantomData<Bar>,
}
assert_eq!(Foo::max_size(), 2 * size_of::<u32>())
} | rust_cleaned_test_functions.jsonl/24562 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9782,
30002,
1769,
368,
341,
262,
2036,
4716,
280,
262,
11506,
27098,
5304,
68,
1225,
47,
4740,
5563,
262,
2036,
33428,
341,
286,
856,
25,
575,
18,
17,
345,
286,
379,
25,
575,
18,
17,
345,
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_parse_atom() {
let input = vec![Token::Integer(1)];
let stmt = parse(&input).unwrap();
assert_eq!(stmt, Stmt::Eval(integer_expr(1)));
} | rust_cleaned_test_functions.jsonl/55665 | {
"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,
21039,
42292,
368,
341,
1789,
286,
1077,
1946,
284,
7486,
20703,
3323,
486,
3486,
7,
16,
12587,
286,
1077,
20020,
284,
4715,
2099,
1355,
568,
15454,
543,
286,
2060,
10714,
10297,
9215,
11,
97023,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_reflection_matrix() {
let root = to_ratio(array![[1, -1, 0, 0]]);
let expected = to_ratio(array![
[0, 1, 0, 0],
[1, 0, 0, 0],
[0, 0, 1, 0],
[0, 0, 0, 1]
]);
assert_eq!(reflection_matrix(&root), expected);
} | rust_cleaned_test_functions.jsonl/12043 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 191
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7793,
1170,
10193,
368,
341,
286,
1077,
3704,
284,
311,
19917,
6110,
0,
15505,
16,
11,
481,
16,
11,
220,
15,
11,
220,
15,
49854,
286,
1077,
3601,
284,
311,
19917,
6110,
90515,
310,
508,
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_u32_value() {
with_key!(key, "U32Value" => {
let name = "RustU32Val";
let val1 = 1_234_567_890u32;
key.set_value(name, &val1).unwrap();
let val2: u32 = key.get_value(name).unwrap();
assert_eq!(val1, val2);
});
} | rust_cleaned_test_functions.jsonl/128092 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7300,
18,
17,
3142,
368,
341,
262,
448,
3097,
10297,
792,
11,
330,
52,
18,
17,
1130,
1,
589,
341,
286,
1077,
829,
284,
330,
49,
590,
52,
18,
17,
2208,
876,
286,
1077,
1044,
16,
284,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_check_functions() {
let mut game = Game::new();
game.create_piece(1, 5, 0);
game.create_piece(0, 5, 16);
game.create_piece(0, 3, 7);
game.set_moves();
assert!(game.in_check(1));
assert!(game.in_checkmate(1));
} | rust_cleaned_test_functions.jsonl/120651 | {
"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,
7200,
31708,
368,
341,
286,
1077,
5206,
1809,
284,
4050,
486,
931,
543,
286,
1809,
2520,
48470,
7,
16,
11,
220,
20,
11,
220,
15,
317,
286,
1809,
2520,
48470,
7,
15,
11,
220,
20,
11,
220,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_provision_agent() {
init!("true");
let json_string = r#"{"agency_url":"https://enym-eagency.pdev.evernym.com","agency_did":"Ab8TvZa3Q19VNkQVzAWVL7","agency_verkey":"5LXaR43B1aQyeh94VBP8LG1Sgvjk7aNfqiksBCSjwqbf","wallet_name":"test_provision_agent","agent_seed":null,"enterprise_seed":null,"wallet_key":"key"}"#;
let c_json = CString::new(json_string).unwrap().into_raw();
let result = vcx_provision_agent(c_json);
let result = CStringUtils::c_str_to_string(result).unwrap().unwrap();
assert!(result.len() > 0);
} | rust_cleaned_test_functions.jsonl/112442 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 276
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2540,
13013,
25730,
368,
341,
286,
2930,
17223,
1866,
3071,
286,
1077,
2951,
3904,
284,
435,
55543,
4913,
55565,
2903,
3252,
2428,
1110,
268,
1600,
5655,
55565,
556,
3583,
1734,
423,
48121,
905,
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_mask2() {
let s = "000000000000000000000000000000X1001X";
let (mask, keep, mut addrs) = mask_part2(s);
let addr = 42;
for f in addrs.iter_mut() {
*f |= addr & mask | keep;
}
addrs.sort_unstable();
assert_eq!(addrs, vec![26, 27, 58, 59]);
} | rust_cleaned_test_functions.jsonl/104566 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 174
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9999,
17,
368,
341,
286,
1077,
274,
284,
330,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
55,
16,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_halving_epoch_reward() {
let cellbase = TransactionBuilder::default()
.witness(Bytes::default())
.build();
let epoch_ext = build_genesis_epoch_ext(
capacity_bytes!(100),
DIFF_TWO,
GENESIS_EPOCH_LENGTH,
DEFAULT_EPOCH_DURATION_TARGET,
);
let genesis = BlockBuilder::default().transaction(cellbase).build();
let consensus = ConsensusBuilder::new(genesis.clone(), epoch_ext)
.initial_primary_epoch_reward(capacity_bytes!(100))
.build();
let genesis_epoch = consensus.genesis_epoch_ext();
let get_block_header = |_hash: &Byte32| Some(genesis.header().clone());
let total_uncles_count = |_hash: &Byte32| Some(0);
let header = |number: u64| HeaderBuilder::default().number(number.pack()).build();
let initial_primary_epoch_reward = genesis_epoch.primary_reward();
{
let epoch = consensus
.next_epoch_ext(
&consensus.genesis_epoch_ext(),
&header(genesis_epoch.length() - 1),
get_block_header,
total_uncles_count,
)
.expect("test: get next epoch");
assert_eq!(initial_primary_epoch_reward, epoch.primary_reward());
}
let first_halving_epoch_number = consensus.primary_epoch_reward_halving_interval();
// first_halving_epoch_number - 2
let epoch = genesis_epoch
.clone()
.into_builder()
.number(first_halving_epoch_number - 2)
.build();
// first_halving_epoch_number - 1
let epoch = consensus
.next_epoch_ext(
&epoch,
&header(epoch.start_number() + epoch.length() - 1),
get_block_header,
total_uncles_count,
)
.expect("test: get next epoch");
assert_eq!(initial_primary_epoch_reward, epoch.primary_reward());
// first_halving_epoch_number
let epoch = consensus
.next_epoch_ext(
&epoch,
&header(epoch.start_number() + epoch.length() - 1),
get_block_header,
total_uncles_count,
)
.expect("test: get next epoch");
assert_eq!(
initial_primary_epoch_reward.as_u64() / 2,
epoch.primary_reward().as_u64()
);
// first_halving_epoch_number + 1
let epoch = consensus
.next_epoch_ext(
&epoch,
&header(epoch.start_number() + epoch.length() - 1),
get_block_header,
total_uncles_count,
)
.expect("test: get next epoch");
assert_eq!(
initial_primary_epoch_reward.as_u64() / 2,
epoch.primary_reward().as_u64()
);
// first_halving_epoch_number * 4 - 2
let epoch = genesis_epoch
.clone()
.into_builder()
.number(first_halving_epoch_number * 4 - 2)
.base_block_reward(Capacity::shannons(
initial_primary_epoch_reward.as_u64() / 8 / genesis_epoch.length(),
))
.remainder_reward(Capacity::shannons(
initial_primary_epoch_reward.as_u64() / 8 % genesis_epoch.length(),
))
.build();
// first_halving_epoch_number * 4 - 1
let epoch = consensus
.next_epoch_ext(
&epoch,
&header(epoch.start_number() + epoch.length() - 1),
get_block_header,
total_uncles_count,
)
.expect("test: get next epoch");
assert_eq!(
initial_primary_epoch_reward.as_u64() / 8,
epoch.primary_reward().as_u64()
);
// first_halving_epoch_number * 4
let epoch = consensus
.next_epoch_ext(
&epoch,
&header(epoch.start_number() + epoch.length() - 1),
get_block_header,
total_uncles_count,
)
.expect("test: get next epoch");
assert_eq!(
initial_primary_epoch_reward.as_u64() / 16,
epoch.primary_reward().as_u64()
);
} | rust_cleaned_test_functions.jsonl/73438 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2375
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
52580,
4405,
20682,
38260,
368,
341,
286,
1077,
2779,
3152,
284,
17869,
3297,
486,
2258,
741,
310,
659,
86,
8091,
76423,
486,
2258,
2398,
310,
659,
5834,
543,
286,
1077,
16342,
9927,
284,
1936,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_with_structs() {
let mut db = MerkleTree::new();
db.push(Person {
age: 3,
name: "Bob".to_string(),
});
db.push(Person {
age: 4,
name: "Bobb".to_string(),
});
db.push(Person {
age: 5,
name: "Bobbb".to_string(),
});
db.push(Person {
age: 6,
name: "Bobbbb".to_string(),
});
assert_eq!(4, db.len());
let good_proof = db.get_proof(Person {
age: 3,
name: "Bob".to_string(),
});
assert!(good_proof.validate(db.root_hash().unwrap()));
let bad_proof = db.get_proof(Person {
age: 3,
name: "Bobx".to_string(),
});
assert!(!bad_proof.validate(db.root_hash().unwrap()));
} | rust_cleaned_test_functions.jsonl/98837 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 658
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
15126,
82,
368,
341,
262,
1077,
5206,
2927,
284,
8755,
23089,
6533,
486,
931,
543,
262,
2927,
2552,
58174,
341,
394,
4231,
25,
220,
18,
345,
394,
829,
25,
330,
32388,
3263,
983,
3904,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_changelog_mentions_version() {
version_sync::assert_contains_regex!("CHANGELOG.md", r"^## \[{version}] - \d{4}-\d{2}-\d{2}");
} | rust_cleaned_test_functions.jsonl/98155 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 79
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4138,
61873,
30063,
9438,
368,
341,
262,
2319,
23008,
486,
2207,
63598,
41832,
17223,
40873,
7243,
21324,
497,
435,
86490,
565,
1124,
52108,
4366,
25439,
481,
1124,
67,
90,
19,
19732,
59,
67,
90,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_early_claim() {
with_rewards_default(|_, accounts| {
assert_ok!(CrowdloanRewards::initialize(Origin::root()));
for (picasso_account, remote_account) in accounts.into_iter() {
assert_ok!(remote_account.associate(picasso_account.clone()));
assert_noop!(remote_account.claim(picasso_account), Error::<Test>::NothingToClaim);
}
});
} | rust_cleaned_test_functions.jsonl/41091 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 146
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
62,
22140,
84969,
368,
341,
46948,
77997,
9993,
22428,
6878,
9618,
91,
341,
197,
6948,
19817,
10297,
93926,
67,
38329,
58465,
2347,
486,
21641,
7,
13298,
486,
2888,
7392,
197,
2023,
320,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_query_and_then_fails() {
let db = checked_memory_handle();
let sql = "BEGIN;
CREATE TABLE foo(x INTEGER, y TEXT);
INSERT INTO foo VALUES(4, \"hello\");
INSERT INTO foo VALUES(3, \", \");
INSERT INTO foo VALUES(2, \"world\");
INSERT INTO foo VALUES(1, \"!\");
END;";
db.execute_batch(sql).unwrap();
let mut query = db.prepare("SELECT x, y FROM foo ORDER BY x DESC").unwrap();
let bad_type: Result<Vec<f64>> = query
.query_and_then(NO_PARAMS, |row| row.get(1))
.unwrap()
.collect();
match bad_type.unwrap_err() {
Error::InvalidColumnType(..) => (),
err => panic!("Unexpected error {}", err),
}
let bad_idx: Result<Vec<String>> = query
.query_and_then(NO_PARAMS, |row| row.get(3))
.unwrap()
.collect();
match bad_idx.unwrap_err() {
Error::InvalidColumnIndex(_) => (),
err => panic!("Unexpected error {}", err),
}
} | rust_cleaned_test_functions.jsonl/25526 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 724
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5738,
8378,
68367,
761,
6209,
368,
341,
310,
1077,
2927,
284,
10067,
19195,
10630,
543,
310,
1077,
5704,
284,
330,
37588,
280,
5180,
30776,
14363,
15229,
2075,
30381,
11,
379,
15762,
317,
5180,
39... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_into_iter_drops() {
let key = AtomicUsize::new(0);
let value = AtomicUsize::new(0);
let hm = {
let mut hm = HashMap::new();
assert_eq!(key.load(Ordering::Relaxed), 0);
assert_eq!(value.load(Ordering::Relaxed), 0);
for i in 0..100 {
let d1 = Dropable::new(i, &key);
let d2 = Dropable::new(i + 100, &value);
hm.insert(d1, d2);
}
assert_eq!(key.load(Ordering::Relaxed), 100);
assert_eq!(value.load(Ordering::Relaxed), 100);
hm
};
drop(hm.clone());
assert_eq!(key.load(Ordering::Relaxed), 100);
assert_eq!(value.load(Ordering::Relaxed), 100);
// Ensure that dropping the iterator does not leak anything.
drop(hm.clone().into_par_iter());
{
assert_eq!(key.load(Ordering::Relaxed), 100);
assert_eq!(value.load(Ordering::Relaxed), 100);
// retain only half
let _v: Vec<_> = hm
.into_par_iter()
.filter(|&(ref key, _)| key.k < 50)
.collect();
assert_eq!(key.load(Ordering::Relaxed), 50);
assert_eq!(value.load(Ordering::Relaxed), 50);
};
assert_eq!(key.load(Ordering::Relaxed), 0);
assert_eq!(value.load(Ordering::Relaxed), 0);
} | rust_cleaned_test_functions.jsonl/45210 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 780
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45514,
11723,
814,
3702,
368,
341,
286,
1077,
1376,
284,
30316,
52,
2141,
486,
931,
7,
15,
317,
286,
1077,
897,
284,
30316,
52,
2141,
486,
931,
7,
15,
626,
286,
1077,
49362,
284,
341,
310,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_missing_second_field() {
let reader_schema = Schema::parse_str(
r#"
{"type":"record", "name":"Record", "fields":[
{"name":"oldfield2", "type":"string"}
]}
"#,
)
.unwrap();
assert!(SchemaCompatibility::can_read(
&writer_schema(),
&reader_schema
));
assert_eq!(
SchemaCompatibility::can_read(&reader_schema, &writer_schema()),
false
);
} | rust_cleaned_test_functions.jsonl/21770 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 272
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40447,
29644,
5013,
368,
341,
286,
1077,
6604,
25371,
284,
12539,
486,
6400,
2895,
1006,
310,
435,
2,
698,
286,
5212,
1313,
3252,
8548,
497,
330,
606,
3252,
6471,
497,
330,
9007,
8899,
198,
688,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cgroup_sys() {
let temp_dir = TempDir::new().unwrap();
let path1 = temp_dir.path().join("cgroup");
let mut f1 = File::create(path1.clone()).unwrap();
f1.write_all(b"4:memory:/kubepods/burstable/poda2ebe2cd-64c7-11ea-8799-eeeeeeeeeeee/a026c487f1168b7f5442444ac8e35161dfcde87c175ef27d9a806270e267a575\n").unwrap();
f1.write_all(b"5:cpuacct,cpu:/kubepods/burstable/poda2ebe2cd-64c7-11ea-8799-eeeeeeeeeeee/a026c487f1168b7f5442444ac8e35161dfcde87c175ef27d9a806270e267a575\n").unwrap();
f1.sync_all().unwrap();
let path2 = temp_dir.path().join("mountinfo");
let mut f2 = File::create(path2.clone()).unwrap();
f2.write_all(b"5871 5867 0:26 /kubepods/burstable/poda2ebe2cd-64c7-11ea-8799-eeeeeeeeeeee/a026c487f1168b7f5442444ac8e35161dfcde87c175ef27d9a806270e267a575 /sys/fs/cgroup/memory ro,nosuid,nodev,noexec,relatime master:12 - cgroup cgroup rw,memory\n").unwrap();
f2.write_all(b"5872 5867 0:27 /kubepods/burstable/poda2ebe2cd-64c7-11ea-8799-eeeeeeeeeeee/a026c487f1168b7f5442444ac8e35161dfcde87c175ef27d9a806270e267a575 /sys/fs/cgroup/cpu,cpuacct ro,nosuid,nodev,noexec,relatime master:13 - cgroup cgroup rw,cpuacct,cpu\n").unwrap();
f2.sync_all().unwrap();
// Create CGroupSys by f1 and f2.
let cgroup = CGroupSys::new(path1.to_str().unwrap(), path2.to_str().unwrap());
let mut expected_cgroups: HashMap<String, CGroup> = HashMap::new();
expected_cgroups.insert(
"memory".to_string(),
CGroup::new("/sys/fs/cgroup/memory/".to_string()),
);
expected_cgroups.insert(
"cpu".to_string(),
CGroup::new("/sys/fs/cgroup/cpu,cpuacct/".to_string()),
);
expected_cgroups.insert(
"cpuacct".to_string(),
CGroup::new("/sys/fs/cgroup/cpu,cpuacct/".to_string()),
);
for (key, value) in expected_cgroups.iter() {
let v = cgroup
.cgroups
.get(key)
.unwrap_or_else(|| panic!("key {} doesn't exist", key));
assert_eq!(v, value);
}
} | rust_cleaned_test_functions.jsonl/45106 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
4074,
20344,
368,
341,
286,
1077,
2730,
4334,
284,
19944,
6184,
486,
931,
1005,
15454,
543,
286,
1077,
1815,
16,
284,
2730,
4334,
3875,
1005,
5987,
445,
66,
4074,
797,
286,
1077,
5206,
282,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_serialize_variable_with_float_value() {
#[derive(serde_derive::Serialize)]
struct Map {
num: f64,
};
let map = Map { num: 41.0 };
let var = Variable::from_serializable(&map).unwrap();
let json_string = serde_json::to_string(&var).unwrap();
assert_eq!(r#"{"num":41.0}"#, json_string);
} | rust_cleaned_test_functions.jsonl/108398 | {
"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,
88686,
14635,
6615,
17586,
3142,
368,
341,
286,
11506,
27098,
7,
47024,
35345,
533,
486,
15680,
5563,
286,
2036,
5027,
341,
310,
1629,
25,
282,
21,
19,
345,
286,
3634,
286,
1077,
2415,
284,
5027... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_inspect_log_basic() {
let (inspector, mut node) = inspector_and_list_node();
// Logging string and full-size numeric type
inspect_log!(node, k1: "1".to_string(), meaning_of_life: 42u64, k3: 3i64, k4: 4f64);
inspect_log!(node, small_uint: 1u8, small_int: 2i8, float: 3f32);
// Logging reference types + using bracket format
inspect_log!(node, {
s: "str",
uint: &13u8,
});
// Logging empty event
inspect_log!(node, {});
assert_data_tree!(inspector, root: {
list_node: {
"0": { "@time": AnyProperty, k1: "1", meaning_of_life: 42u64, k3: 3i64, k4: 4f64 },
"1": { "@time": AnyProperty, small_uint: 1u64, small_int: 2i64, float: 3f64 },
"2": { "@time": AnyProperty, s: "str", uint: 13u64 },
"3": { "@time": AnyProperty },
}
});
} | rust_cleaned_test_functions.jsonl/96856 | {
"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,
34386,
987,
5224,
34729,
368,
341,
286,
1077,
320,
1330,
18997,
11,
5206,
2436,
8,
284,
44725,
8378,
2019,
5084,
1428,
286,
442,
41706,
914,
323,
2480,
7174,
24064,
943,
198,
286,
24085,
5224,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_i32_f32() {
binary_cast_test(
DataType::Int32,
DataType::Float32,
"CAST(#0 AS Float32) Plus #1",
);
binary_cast_test(
DataType::Float32,
DataType::Int32,
"#0 Plus CAST(#1 AS Float32)",
);
} | rust_cleaned_test_functions.jsonl/16559 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 195
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
5318,
18,
17,
761,
18,
17,
368,
341,
286,
7868,
5303,
4452,
1006,
310,
33172,
486,
1072,
18,
17,
345,
310,
33172,
486,
5442,
18,
17,
345,
310,
330,
34163,
32735,
15,
5752,
13001,
18,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_field_auth_status_not_logged_in() {
let context_builder = ContextBuilder::new();
let runner = QueryRunner::new(context_builder);
assert_eq!(
runner.query(QUERY, hashmap! {}),
(
json!({
"authStatus": {
"authenticated": false,
"userCreated": false,
"user": serde_json::Value::Null,
}
}),
vec![]
)
);
} | rust_cleaned_test_functions.jsonl/129722 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 278
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5013,
14014,
4773,
7913,
47333,
1243,
368,
341,
262,
1077,
2266,
28532,
284,
9608,
3297,
486,
931,
543,
262,
1077,
22259,
284,
11361,
19486,
486,
931,
5378,
28532,
626,
262,
2060,
10714,
33673,
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_did_doc_from_invitation_works() {
let mut did_doc = DidDoc::default();
did_doc.set_id(MessageId::id().0);
did_doc.set_service_endpoint(_service_endpoint());
did_doc.set_keys(_recipient_keys(), _routing_keys());
assert_eq!(did_doc, DidDoc::from(_invitation()))
} | rust_cleaned_test_functions.jsonl/21969 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 150
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
307,
18869,
5673,
19996,
7556,
11498,
82,
368,
341,
286,
1077,
5206,
1521,
18869,
284,
14568,
9550,
486,
2258,
543,
286,
1521,
18869,
980,
842,
29359,
764,
486,
307,
1005,
15,
317,
286,
152... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_set_operator() {
let storage_helper = StorageHelper::new();
let local_owner_ns = "local";
let remote_owner_ns = "owner";
storage_helper.initialize(local_owner_ns.into());
// Upload an operator key to the remote storage
let operator_name = "operator";
let operator_key = Ed25519PrivateKey::generate_for_testing().public_key();
let mut shared_storage = storage_helper.storage(operator_name.into());
shared_storage
.set(OPERATOR_KEY, Value::Ed25519PublicKey(operator_key))
.map_err(|e| Error::StorageWriteError("shared", OPERATOR_KEY, e.to_string()))
.unwrap();
// Owner calls the set-operator command
let local_operator_name = storage_helper
.set_operator(operator_name, local_owner_ns, remote_owner_ns)
.unwrap();
// Verify that a file setting the operator was uploaded to the remote storage
let shared_storage = storage_helper.storage(remote_owner_ns.into());
let uploaded_operator_name = shared_storage
.get(constants::VALIDATOR_OPERATOR)
.unwrap()
.value
.string()
.unwrap();
assert_eq!(local_operator_name, uploaded_operator_name);
} | rust_cleaned_test_functions.jsonl/8046 | {
"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,
2602,
40594,
368,
341,
286,
1077,
5819,
10418,
284,
14693,
5511,
486,
931,
543,
286,
1077,
2205,
29027,
34728,
284,
330,
2438,
876,
286,
1077,
8699,
29027,
34728,
284,
330,
8118,
876,
286,
5819,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rot13() {
assert_eq!(rot13("hello"), "uryyb");
assert_eq!(rot13("uryyb"), "hello");
assert_eq!(
rot13("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"),
"NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm"
);
assert_eq!(rot13("peter"), "crgre");
} | rust_cleaned_test_functions.jsonl/51111 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 172
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38256,
16,
18,
368,
341,
262,
2060,
10714,
10297,
4640,
16,
18,
445,
14990,
3975,
330,
3350,
84307,
797,
262,
2060,
10714,
10297,
4640,
16,
18,
445,
3350,
84307,
3975,
330,
14990,
3071,
262,
206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_chrome_trace_deserialization() {
use xi_trace::*;
let trace = Trace::enabled(Config::with_limit_count(10));
trace.instant("sample1", &["test", "chrome"]);
trace.instant_payload("sample2", &["test", "chrome"], to_payload("payload 2"));
trace.instant_payload("sample3", &["test", "chrome"], to_payload("payload 3"));
trace.closure_payload("sample4", &["test", "chrome"],|| (), to_payload("payload 4"));
let samples = trace.samples_cloned_unsorted();
let mut serialized = Vec::<u8>::new();
let result = chrome_trace::serialize(
&samples, chrome_trace::OutputFormat::JsonArray, &mut serialized);
assert!(result.is_ok());
let deserialized_samples = chrome_trace::deserialize(serialized.as_slice()).unwrap();
assert_eq!(deserialized_samples, samples);
} | rust_cleaned_test_functions.jsonl/132308 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 370
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4138,
6648,
23575,
15768,
50563,
368,
341,
286,
990,
37590,
23575,
79304,
286,
1077,
11655,
284,
27163,
486,
15868,
33687,
486,
4197,
14763,
3180,
7,
16,
15,
1106,
286,
11655,
89108,
445,
13611,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_wait_ptrace() {
require_capability!("test_wait_ptrace", CAP_SYS_PTRACE);
let _m = crate::FORK_MTX.lock().expect("Mutex got poisoned by another test");
match unsafe{fork()}.expect("Error: Fork Failed") {
Child => ptrace_child(),
Parent { child } => ptrace_parent(child),
}
} | rust_cleaned_test_functions.jsonl/102295 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 163
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18760,
4348,
578,
368,
341,
286,
1373,
89686,
17223,
1944,
18760,
4348,
578,
497,
26101,
26783,
20657,
5576,
317,
286,
1077,
716,
76,
284,
17717,
486,
37,
10647,
1245,
22867,
21003,
1005,
17119,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_apply_TextEdit() {
let lines: Vec<String> = r#"fn main() {
0;
}
"#
.lines()
.map(|l| l.to_owned())
.collect();
let expect: Vec<String> = r#"fn main() {
0;
}
"#
.lines()
.map(|l| l.to_owned())
.collect();
let edit = TextEdit {
range: Range {
start: Position {
line: 0,
character: 0,
},
end: Position {
line: 3,
character: 0,
},
},
new_text: r#"fn main() {
0;
}
"#
.to_owned(),
};
assert_eq!(apply_TextEdits(&lines, &[edit]).unwrap(), expect);
} | rust_cleaned_test_functions.jsonl/86858 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 382
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36551,
20550,
4036,
368,
341,
262,
1077,
5128,
25,
11312,
3464,
29,
284,
435,
55543,
8822,
1887,
368,
341,
15,
280,
532,
1,
4956,
262,
659,
7969,
741,
262,
659,
2186,
22428,
75,
91,
326,
2389,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_angle_translation() {
let angle = Degrees(70_f64);
let distance = Vector2::new(12_f64, 5_f64);
let rotation = Rotation2::from_angle(angle);
let translation = Translation2::from_vector(&distance);
let expected = Isometry2::from_parts(&translation, &rotation);
let result = Isometry2::from_angle_translation(angle, &distance);
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/77213 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 180
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
21727,
49273,
368,
341,
286,
1077,
9210,
284,
92901,
7,
22,
15,
761,
21,
19,
317,
286,
1077,
6010,
284,
4196,
17,
486,
931,
7,
16,
17,
761,
21,
19,
11,
220,
20,
761,
21,
19,
317,
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_normalize_path() {
for test in NORMALIZE_PATH_TESTS.iter() {
let path = Path::new(test.path);
let normalized = normalize_path(path);
assert_eq!(
test.test
.replace("/", std::path::MAIN_SEPARATOR.to_string().as_str()),
normalized.to_str().expect("Path is not valid utf-8!")
);
}
} | rust_cleaned_test_functions.jsonl/92487 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 232
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
80807,
2638,
368,
341,
286,
369,
1273,
304,
52431,
3282,
7944,
80312,
19471,
368,
341,
310,
1077,
1815,
284,
7933,
486,
931,
8623,
3875,
317,
310,
1077,
29410,
284,
21694,
2638,
5581,
317,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_short_from_u16() {
let x: Bits<12> = 14323_u16.into();
let y: u16 = x.into();
assert_eq!(y, 14323 & (0x0FFF));
} | rust_cleaned_test_functions.jsonl/75132 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16673,
5673,
7300,
16,
21,
368,
341,
286,
1077,
856,
25,
49457,
27,
16,
17,
29,
284,
220,
16,
19,
18,
17,
18,
7300,
16,
21,
39860,
543,
286,
1077,
379,
25,
575,
16,
21,
284,
856,
39860,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_contact_dont_panic() {
unsafe {
let mut error = 0;
let error_ptr = &mut error as *mut c_int;
let test_contact_private_key = private_key_generate();
let test_contact_public_key = public_key_from_private_key(test_contact_private_key, error_ptr);
let test_str = "Test Contact";
let test_contact_str = CString::new(test_str).unwrap();
let test_contact_alias: *const c_char = CString::into_raw(test_contact_str) as *const c_char;
let mut _test_contact = contact_create(ptr::null_mut(), test_contact_public_key, error_ptr);
assert_eq!(
error,
LibWalletError::from(InterfaceError::NullError("alias_ptr".to_string())).code
);
_test_contact = contact_create(test_contact_alias, ptr::null_mut(), error_ptr);
assert_eq!(
error,
LibWalletError::from(InterfaceError::NullError("public_key_ptr".to_string())).code
);
let _alias = contact_get_alias(ptr::null_mut(), error_ptr);
assert_eq!(
error,
LibWalletError::from(InterfaceError::NullError("contact_ptr".to_string())).code
);
let _contact_key = contact_get_public_key(ptr::null_mut(), error_ptr);
assert_eq!(
error,
LibWalletError::from(InterfaceError::NullError("contact_ptr".to_string())).code
);
let contact_key_bytes = public_key_get_bytes(ptr::null_mut(), error_ptr);
assert_eq!(
error,
LibWalletError::from(InterfaceError::NullError("contact_ptr".to_string())).code
);
let contact_bytes_len = byte_vector_get_length(ptr::null_mut(), error_ptr);
assert_eq!(
error,
LibWalletError::from(InterfaceError::NullError("contact_ptr".to_string())).code
);
assert_eq!(contact_bytes_len, 0);
contact_destroy(_test_contact);
public_key_destroy(test_contact_public_key);
private_key_destroy(test_contact_private_key);
string_destroy(test_contact_alias as *mut c_char);
byte_vector_destroy(contact_key_bytes);
}
} | rust_cleaned_test_functions.jsonl/66630 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1146
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20597,
814,
544,
620,
31270,
368,
341,
286,
19860,
341,
310,
1077,
5206,
1465,
284,
220,
15,
280,
310,
1077,
1465,
4348,
284,
609,
6984,
1465,
438,
353,
6984,
272,
4042,
280,
310,
1077,
1273,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bf_ofb() {
let pt = "37363534333231204E6F77206973207468652074696D6520666F722000";
let ct = "E73214A2822139CA62B343CC5B65587310DD908D0C241B2263C2CF80DA";
let key = "0123456789ABCDEFF0E1D2C3B4A59687";
let iv = "FEDCBA9876543210";
cipher_test_nopad(super::Cipher::bf_ofb(), pt, ct, key, iv);
} | rust_cleaned_test_functions.jsonl/110552 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 205
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
69,
3575,
65,
368,
341,
286,
1077,
10817,
284,
330,
18,
22,
18,
21,
18,
20,
18,
19,
18,
18,
18,
17,
18,
16,
17,
15,
19,
36,
21,
37,
22,
22,
17,
15,
21,
24,
22,
18,
17,
15,
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_from_str() {
assert_eq!("AD".parse(), Ok(Key::ReadDepths));
assert_eq!("ADF".parse(), Ok(Key::ForwardStrandReadDepths));
assert_eq!("ADR".parse(), Ok(Key::ReverseStrandReadDepths));
assert_eq!("DP".parse(), Ok(Key::ReadDepth));
assert_eq!("EC".parse(), Ok(Key::ExpectedAlternateAlleleCounts));
assert_eq!("FT".parse(), Ok(Key::Filter));
assert_eq!("GL".parse(), Ok(Key::GenotypeLikelihoods));
assert_eq!("GP".parse(), Ok(Key::GenotypePosteriorProbabilities));
assert_eq!("GQ".parse(), Ok(Key::ConditionalGenotypeQuality));
assert_eq!("GT".parse(), Ok(Key::Genotype));
assert_eq!("HQ".parse(), Ok(Key::HaplotypeQuality));
assert_eq!("MQ".parse(), Ok(Key::MappingQuality));
assert_eq!("PL".parse(), Ok(Key::RoundedGenotypeLikelihoods));
assert_eq!("PP".parse(), Ok(Key::RoundedGenotypePosteriorProbabilities));
assert_eq!("PQ".parse(), Ok(Key::PhasingQuality));
assert_eq!("PS".parse(), Ok(Key::PhaseSet));
assert_eq!("CN".parse(), Ok(Key::GenotypeCopyNumber));
assert_eq!("CNQ".parse(), Ok(Key::GenotypeCopyNumberQuality));
assert_eq!("CNL".parse(), Ok(Key::GenotypeCopyNumberLikelihoods));
assert_eq!(
"CNP".parse(),
Ok(Key::GenotypeCopyNumberPosteriorProbabilities)
);
assert_eq!("NQ".parse(), Ok(Key::NovelVariantQualityScore));
assert_eq!("HAP".parse(), Ok(Key::HaplotypeId));
assert_eq!("AHAP".parse(), Ok(Key::AncestralHaplotypeId));
assert_eq!(
"NDLS".parse(),
Ok(Key::Other(
String::from("NDLS"),
Number::Count(1),
Type::String
))
);
assert_eq!("".parse::<Key>(), Err(ParseError::Empty));
} | rust_cleaned_test_functions.jsonl/19791 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 855
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
2895,
368,
341,
286,
2060,
10714,
17223,
1808,
3263,
6400,
1507,
7622,
21358,
486,
4418,
7839,
16896,
1106,
286,
2060,
10714,
17223,
91263,
3263,
6400,
1507,
7622,
21358,
486,
25925,
2580,
437... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_named_enum() {
let x = TestEnum::Named{foo: 1.0, bar: 2.0};
let y = TestEnum::Named{foo: 1.000001, bar: 2.0000001};
assert_abs_diff_eq!(x, y, epsilon=1e-5);
} | rust_cleaned_test_functions.jsonl/45664 | {
"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,
71834,
31054,
368,
341,
262,
1077,
856,
284,
3393,
10766,
486,
15810,
90,
7975,
25,
220,
16,
13,
15,
11,
3619,
25,
220,
17,
13,
15,
2440,
262,
1077,
379,
284,
3393,
10766,
486,
15810,
90,
79... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reduce() {
let mut reduce0 = Number::new("[[[[[4,3],4],4],[7,[[8,4],9]]],[1,1]]");
reduce0.reduce();
assert_eq!(reduce0, Number::new("[[[[0,7],4],[[7,8],[6,0]]],[8,1]]"));
} | rust_cleaned_test_functions.jsonl/100422 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64596,
368,
341,
286,
1077,
5206,
7949,
15,
284,
5624,
486,
931,
10937,
15505,
15505,
19,
11,
18,
1125,
19,
1125,
19,
14955,
22,
11,
15505,
23,
11,
19,
1125,
24,
5053,
14955,
16,
11,
16,
505... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_prevote_migration_can_complete_election() {
let l = default_logger();
// n1 is leader with term 2
// n2 is follower with term 2
let mut nt = new_prevote_migration_cluster(&l);
// simulate leader down
nt.isolate(1);
// Call for elections from both n2 and n3.
nt.send(vec![new_message(3, 3, MessageType::MsgHup, 0)]);
nt.send(vec![new_message(2, 2, MessageType::MsgHup, 0)]);
// check state
// n2.state == Follower
// n3.state == PreCandidate
assert_eq!(nt.peers[&2].state, StateRole::Follower);
assert_eq!(nt.peers[&3].state, StateRole::PreCandidate);
nt.send(vec![new_message(3, 3, MessageType::MsgHup, 0)]);
nt.send(vec![new_message(2, 2, MessageType::MsgHup, 0)]);
// Do we have a leader?
assert!(
(nt.peers[&2].state == StateRole::Leader) || (nt.peers[&3].state == StateRole::Follower)
);
} | rust_cleaned_test_functions.jsonl/19184 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 396
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25566,
1272,
90373,
27421,
27675,
2204,
1170,
368,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
442,
308,
16,
374,
7653,
448,
4647,
220,
17,
198,
262,
442,
308,
17,
374,
48207,
448,
4647,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_criteria() {
assert_eq!(calculate_matches(5_000_000, (65, 8921), Some((4, 8))), 309);
} | rust_cleaned_test_functions.jsonl/27444 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 57
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
80990,
368,
341,
262,
2060,
10714,
10297,
35597,
38344,
7,
20,
62,
15,
15,
15,
62,
15,
15,
15,
11,
320,
21,
20,
11,
220,
23,
24,
17,
16,
701,
4329,
1188,
19,
11,
220,
23,
36363,
220,
18,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_from_int_node() {
let node = IntNode::new(666);
let clone = node;
assert_eq!(ExpressionNode::from(node), ExpressionNode::Int(clone));
} | rust_cleaned_test_functions.jsonl/89512 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 85
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
4042,
5084,
368,
341,
286,
1077,
2436,
284,
1333,
1955,
486,
931,
7,
21,
21,
21,
626,
286,
1077,
14715,
284,
2436,
401,
286,
2060,
10714,
10297,
9595,
1955,
486,
1499,
6958,
701,
16378,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_same() {
// Operator 5: Same
produces("[[1 1] 5 0 1]", "0");
produces("[[1 2] 5 0 1]", "1");
// Various bignum combinations.
produces("[[18446744073709551615 18446744073709551615] 5 0 1]", "0");
produces("[[18446744073709551615 18446744073709551616] 5 0 1]", "1");
produces("[[18446744073709551615 2] 5 0 1]", "1");
produces("[[2 18446744073709551615] 5 0 1]", "1");
produces("[42 [5 [0 1] [0 1]]]", "0");
produces("[42 [5 [0 1] [1 42]]]", "0");
produces("[42 [5 [0 1] [1 43]]]", "1");
} | rust_cleaned_test_functions.jsonl/29737 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 311
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33574,
368,
341,
286,
442,
28498,
220,
20,
25,
25739,
198,
286,
18644,
10937,
58,
16,
220,
16,
60,
220,
20,
220,
15,
220,
16,
19076,
330,
15,
797,
286,
18644,
10937,
58,
16,
220,
17,
60,
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_job_description_serialization() {
let servant = JobDescription::Servant;
assert_eq!(r#""Servant""#, encode(&servant));
let pony = JobDescription::Pony;
assert_eq!(r#""Pony""#, encode(&pony));
let scholar = JobDescription::Scholar;
assert_eq!(r#""Scholar""#, encode(&scholar));
let cop = JobDescription::Cop;
assert_eq!(r#""Cop""#, encode(&cop));
let princess = JobDescription::Princess;
assert_eq!(r#""Princess""#, encode(&princess));
let figurehead = JobDescription::Figurehead;
assert_eq!(r#""Figurehead""#, encode(&figurehead));
} | rust_cleaned_test_functions.jsonl/36142 | {
"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,
20298,
11448,
25602,
2022,
368,
1476,
286,
1077,
40464,
284,
12011,
5009,
486,
39159,
517,
280,
286,
2060,
10714,
10297,
81,
2,
3014,
39159,
517,
3014,
60778,
16164,
2099,
30775,
517,
41843,
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_solution_2() {
assert_eq!(3, solution_2(&mut parse("C200B40A82")));
assert_eq!(7, solution_2(&mut parse("880086C3E88112")));
assert_eq!(1, solution_2(&mut parse("9C0141080250320F1802104A08")));
} | rust_cleaned_test_functions.jsonl/20584 | {
"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,
50274,
62,
17,
368,
341,
286,
2060,
10714,
10297,
18,
11,
6291,
62,
17,
2099,
6984,
4715,
445,
34,
17,
15,
15,
33,
19,
15,
32,
23,
17,
17621,
286,
2060,
10714,
10297,
22,
11,
6291,
62,
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_fold_block_with_declaration() {
test_same("{let x}");
test_same("function f() {let x}");
test_same("{const x = 1}");
test_same("{x = 2; y = 4; let z;}");
test("{'hi'; let x;}", "{let x}");
test("{x = 4; {let y}}", "x = 4; {let y}");
test_same("{class C {}} {class C {}}");
test("{label: var x}", "label: var x");
// `{label: let x}` is a syntax error
test_same("{label: var x; let y;}");
} | rust_cleaned_test_functions.jsonl/368 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 209
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
61187,
7113,
6615,
77926,
368,
341,
262,
1273,
33574,
13976,
1149,
856,
20305,
262,
1273,
33574,
445,
1688,
282,
368,
314,
1149,
856,
20305,
262,
1273,
33574,
13976,
1024,
856,
284,
220,
16,
20305... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.