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_vote_rountrip_with_sig() {
let dt = "2017-12-25T03:00:01.234Z".parse::<DateTime<Utc>>().unwrap();
let t = TimeMsg {
seconds: dt.timestamp(),
nanos: dt.timestamp_subsec_nanos() as i32,
};
let vote = Vote {
validator_address: vec![
0xa3, 0xb2, 0xcc, 0xdd, 0x71, 0x86, 0xf1, 0x68, 0x5f, 0x21, 0xf2, 0x48, 0x2a, 0xf4,
0xfb, 0x34, 0x46, 0xa8, 0x4b, 0x35,
],
validator_index: 56789,
height: 12345,
round: 2,
timestamp: Some(t),
vote_type: 0x01,
block_id: Some(BlockId {
hash: "hash".as_bytes().to_vec(),
parts_header: Some(PartsSetHeader {
total: 1000000,
hash: "parts_hash".as_bytes().to_vec(),
}),
}),
signature: vec![
130u8, 246, 183, 50, 153, 248, 28, 57, 51, 142, 55, 217, 194, 24, 134, 212, 233,
100, 211, 10, 24, 174, 179, 117, 41, 65, 141, 134, 149, 239, 65, 174, 217, 42, 6,
184, 112, 17, 7, 97, 255, 221, 252, 16, 60, 144, 30, 212, 167, 39, 67, 35, 118,
192, 133, 130, 193, 115, 32, 206, 152, 91, 173, 10,
],
};
let mut got = vec![];
let _have = vote.encode(&mut got);
let v = Vote::decode(&got).unwrap();
assert_eq!(v, vote);
// SignVoteRequest
{
let svr = SignVoteRequest { vote: Some(vote) };
let mut got = vec![];
let _have = svr.encode(&mut got);
let svr2 = SignVoteRequest::decode(&got).unwrap();
assert_eq!(svr, svr2);
}
} | rust_cleaned_test_functions.jsonl/13372 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1042
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54360,
62,
581,
77,
32981,
6615,
29252,
368,
341,
286,
1077,
7594,
284,
330,
17,
15,
16,
22,
12,
16,
17,
12,
17,
20,
51,
15,
18,
25,
15,
15,
25,
15,
16,
13,
17,
18,
19,
57,
3263,
6400,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_err() {
let input = "a = ";
let ctx = &Ctx::empty();
let result = Assign.parse(input, ctx, ParseState::Operator);
assert!(result.is_err());
assert_eq!(result.unwrap_err(), parser::Error::ExpectedExpression);
} | rust_cleaned_test_functions.jsonl/14381 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 132
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
9266,
368,
341,
286,
1077,
1946,
284,
330,
64,
284,
7620,
286,
1077,
5635,
284,
609,
23684,
486,
3194,
543,
286,
1077,
1102,
284,
31639,
4632,
5384,
11,
5635,
11,
14775,
1397,
486,
18461,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extension_with_custom_json_error() {
use self::custom_errors::*;
let client = CustomErrorClient::new(
ClientId::new("aaa".to_string()),
Some(ClientSecret::new("bbb".to_string())),
AuthUrl::new("https://example.com/auth".to_string()).unwrap(),
Some(TokenUrl::new("https://example.com/token".to_string()).unwrap()),
);
let token = client
.exchange_code(AuthorizationCode::new("ccc".to_string()))
.request(mock_http_client(
vec![
(ACCEPT, "application/json"),
(CONTENT_TYPE, "application/x-www-form-urlencoded"),
(AUTHORIZATION, "Basic YWFhOmJiYg=="),
],
"grant_type=authorization_code&code=ccc",
None,
HttpResponse {
status_code: StatusCode::BAD_REQUEST,
headers: vec![(
CONTENT_TYPE,
HeaderValue::from_str("application/json").unwrap(),
)]
.into_iter()
.collect(),
body: "{\"custom_error\": \"non-compliant oauth implementation ;-)\"}"
.to_string()
.into_bytes(),
},
));
assert!(token.is_err());
match token.err().unwrap() {
RequestTokenError::ServerResponse(e) => {
assert_eq!("non-compliant oauth implementation ;-)", e.custom_error)
}
e => panic!("failed to correctly parse custom server error, got {:?}", e),
};
} | rust_cleaned_test_functions.jsonl/18612 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 794
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31035,
6615,
15875,
9455,
4096,
368,
341,
262,
990,
656,
486,
9163,
20196,
56162,
262,
1077,
2943,
284,
8406,
1454,
2959,
486,
931,
1006,
286,
8423,
764,
486,
931,
445,
32646,
3263,
983,
3904,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_nonnull_pointer() {
let mut x = 1i8;
let ptr = NonNull::new(&mut x as *mut _).unwrap();
assert_size_of_val_eq!(ptr, POINTER_BYTE_SIZE);
} | rust_cleaned_test_functions.jsonl/74459 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21637,
2921,
21425,
368,
341,
286,
1077,
5206,
856,
284,
220,
16,
72,
23,
280,
286,
1077,
10087,
284,
11581,
3280,
486,
931,
2099,
6984,
856,
438,
353,
6984,
716,
568,
15454,
543,
286,
2060,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_read_encrypted_keystore() {
// todo: change this to read config.toml
// this test requires an encrypted keystore
// current way to run this test:
// add encrypt_keystore = true to config.toml
// change keystore_location to your location
let keystore_location = PathBuf::from("/tmp/forest-db");
let ks = KeyStore::new(KeyStoreConfig::Encrypted(
keystore_location,
PASSPHRASE.to_string(),
))
.unwrap();
ks.flush().unwrap();
assert!(true);
} | rust_cleaned_test_functions.jsonl/37720 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 257
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
13781,
14026,
45476,
63373,
368,
341,
286,
442,
11804,
25,
2297,
419,
311,
1349,
2193,
73494,
75,
198,
286,
442,
419,
1273,
7460,
458,
24455,
1962,
63373,
198,
286,
442,
1482,
1616,
311,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_boolean_array_gt_eq_scalar() {
let a: BooleanArray = vec![Some(true), Some(false), None].into();
let res1: Vec<Option<bool>> =
gt_eq_bool_scalar(&a, false).unwrap().iter().collect();
assert_eq!(res1, vec![Some(true), Some(true), None]);
let res2: Vec<Option<bool>> =
gt_eq_bool_scalar(&a, true).unwrap().iter().collect();
assert_eq!(res2, vec![Some(true), Some(false), None]);
} | rust_cleaned_test_functions.jsonl/45803 | {
"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,
46642,
3858,
37479,
10714,
41652,
368,
341,
286,
1077,
264,
25,
6992,
1857,
284,
7486,
20703,
8373,
3715,
701,
4329,
3576,
701,
2240,
936,
18122,
1428,
286,
1077,
592,
16,
25,
11312,
94150,
17028,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_endpoint_bad_metadata() {
let ret = do_endpoint(
quote! {
methud = GET,
path = "/a/b/c"
},
quote! {
const POTATO = "potato";
},
);
let msg = format!("{}", ret.err().unwrap());
assert_eq!("extraneous member `methud`", msg);
} | rust_cleaned_test_functions.jsonl/39858 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 229
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36699,
34199,
22220,
368,
341,
286,
1077,
2112,
284,
653,
36699,
1006,
310,
12641,
0,
341,
394,
21068,
661,
284,
7890,
345,
394,
1815,
284,
3521,
64,
3470,
2899,
698,
310,
1153,
310,
12641,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_transfer_lamports() {
let mut transaction_context = TransactionContext::new(Vec::new(), 1);
let invoke_context = InvokeContext::new_mock(&mut transaction_context, &[]);
let from = Pubkey::new_unique();
let from_account = RefCell::new(AccountSharedData::new(100, 0, &Pubkey::new(&[2; 32]))); // account owner should not matter
let to = Pubkey::new(&[3; 32]);
let to_account = RefCell::new(AccountSharedData::new(1, 0, &to)); // account owner should not matter
let from_keyed_account = KeyedAccount::new(&from, true, &from_account);
let to_keyed_account = KeyedAccount::new(&to, false, &to_account);
transfer(&from_keyed_account, &to_keyed_account, 50, &invoke_context).unwrap();
let from_lamports = from_keyed_account.account.borrow().lamports();
let to_lamports = to_keyed_account.account.borrow().lamports();
assert_eq!(from_lamports, 50);
assert_eq!(to_lamports, 51);
// Attempt to move more lamports than remaining in from_account
let from_keyed_account = KeyedAccount::new(&from, true, &from_account);
let result = transfer(&from_keyed_account, &to_keyed_account, 100, &invoke_context);
assert_eq!(result, Err(SystemError::ResultWithNegativeLamports.into()));
assert_eq!(from_keyed_account.account.borrow().lamports(), 50);
assert_eq!(to_keyed_account.account.borrow().lamports(), 51);
// test signed transfer of zero
assert!(transfer(&from_keyed_account, &to_keyed_account, 0, &invoke_context).is_ok());
assert_eq!(from_keyed_account.account.borrow().lamports(), 50);
assert_eq!(to_keyed_account.account.borrow().lamports(), 51);
// test unsigned transfer of zero
let from_keyed_account = KeyedAccount::new(&from, false, &from_account);
assert_eq!(
transfer(&from_keyed_account, &to_keyed_account, 0, &invoke_context),
Err(InstructionError::MissingRequiredSignature)
);
assert_eq!(from_keyed_account.account.borrow().lamports(), 50);
assert_eq!(to_keyed_account.account.borrow().lamports(), 51);
} | rust_cleaned_test_functions.jsonl/106203 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 878
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35403,
907,
309,
3394,
368,
341,
286,
1077,
5206,
7745,
8467,
284,
17869,
1972,
486,
931,
49923,
486,
931,
1507,
220,
16,
317,
286,
1077,
19873,
8467,
284,
39667,
1972,
486,
931,
34134,
2099,
69... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_inflater() -> Result<(), Box<dyn Error>> {
let mut inflater = Inflater::new(SHARD);
inflater.extend(&MESSAGE[0..MESSAGE.len() - 2]);
assert_eq!(None, inflater.msg()?);
inflater.reset();
inflater.extend(MESSAGE);
// Check the state of fields.
assert!(!inflater.compressed.is_empty());
assert!(inflater.internal_buffer.is_empty());
assert!(inflater.buffer.is_empty());
assert_eq!(Some(OUTPUT), inflater.msg()?.as_deref());
// Calling `msg` clears `compressed` and fills `buffer` and `internal_buffer`.
assert!(inflater.compressed.is_empty());
assert!(!inflater.buffer.is_empty());
assert!(!inflater.internal_buffer.is_empty());
assert_eq!(OUTPUT, inflater.buffer_mut());
// Check to make sure `buffer` and `internal_buffer` haven't been cleared.
assert!(!inflater.internal_buffer.is_empty());
assert!(!inflater.buffer.is_empty());
// Now clear the inflater and make sure all buffers are empty.
inflater.clear();
assert!(inflater.compressed.is_empty());
assert!(inflater.internal_buffer.is_empty());
assert!(inflater.buffer.is_empty());
// state.
inflater.extend(b"test");
assert!(!inflater.compressed.is_empty());
inflater.reset();
assert!(inflater.compressed.is_empty());
Ok(())
} | rust_cleaned_test_functions.jsonl/46053 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 657
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
11729,
368,
1464,
5714,
68843,
8261,
92846,
4600,
2452,
341,
286,
1077,
5206,
21993,
284,
758,
11729,
486,
931,
3759,
39,
7376,
317,
286,
21993,
15831,
2099,
50498,
58,
15,
496,
50498,
19406... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_two_readers_dependency() {
let mut t: Turbine<TestSlot> = Turbine::new(1024);
let e1 = t.ep_new().unwrap();
let e2 = t.ep_new().unwrap();
let _ = t.ep_depends(e2, e1);
let event_processor = t.ep_finalize(e1);
let (tx, rx): (Sender<isize>, Receiver<isize>) = channel();
let _future = thread::spawn(move|| {
event_processor.start::<_, BusyWait>(|data: &[TestSlot]| -> Result<(),()> {
let mut counter = 0;
let mut last = -1;
for x in data.iter() {
assert!(last + 1 == x.value);
counter += 1;
last = x.value;
}
if counter >= 1200 {
return Err(());
} else {
return Ok(());
}
});
let _ = tx.send(1);
});
let event_processor2 = t.ep_finalize(e2);
let (tx2, rx2): (Sender<isize>, Receiver<isize>) = channel();
let _future = thread::spawn(move|| {
event_processor2.start::<_, BusyWait>(|data: &[TestSlot]| -> Result<(),()> {
let mut counter = 0;
let mut last = -1;
for x in data.iter() {
assert!(last + 1 == x.value);
counter += 1;
last = x.value;
}
if counter >= 1200 {
return Err(());
} else {
return Ok(());
}
});
let _ = tx2.send(1);
});
for i in 0..1200 {
let mut x: TestSlot = Slot::new();
x.value = i as i32;
t.write(x);
}
let _ = rx.recv();
let _ = rx2.recv();
} | rust_cleaned_test_functions.jsonl/65722 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1206
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23241,
6443,
388,
62387,
368,
341,
286,
1077,
5206,
259,
25,
8705,
46561,
71273,
19877,
29,
284,
8705,
46561,
486,
931,
7,
16,
15,
17,
19,
317,
286,
1077,
384,
16,
284,
259,
33376,
5921,
1005,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
#[test]
fn test_write_padded_multiple_aligned() {
let mut data = vec![255u8; 254];
let buf = Vec::new();
let mut cursor = Cursor::new(buf);
let mut written = write_padded(&mut data[0..127].as_ref(), &mut cursor).unwrap();
written += write_padded(&mut data[127..].as_ref(), &mut cursor).unwrap();
let padded = cursor.into_inner();
assert_eq!(written, 254);
assert_eq!(
padded.len(),
FR32_PADDING_MAP.transform_byte_offset(254, true)
);
assert_eq!(padded[127], 0b0011_1111);
assert_eq!(padded[128], 0b1111_1111);
assert_eq!(&padded[128..159], vec![255u8; 31].as_slice());
assert_eq!(padded.into_boxed_slice(), bit_vec_padding(data));
} | rust_cleaned_test_functions.jsonl/32995 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 367
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
620,
16828,
45233,
66385,
368,
341,
286,
1077,
5206,
821,
284,
7486,
20703,
17,
20,
20,
84,
23,
26,
220,
17,
20,
19,
935,
286,
1077,
6607,
284,
11312,
486,
931,
543,
286,
1077,
5206,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bytes_buffer() {
let gil = Python::acquire_gil();
let py = gil.python();
let bytes = py.eval("b'abcde'", None, None).unwrap();
let buffer = PyBuffer::get(py, &bytes).unwrap();
assert_eq!(buffer.dimensions(), 1);
assert_eq!(buffer.item_count(), 5);
assert_eq!(buffer.format().to_str().unwrap(), "B");
assert_eq!(buffer.shape(), [5]);
// single-dimensional buffer is always contiguous
assert!(buffer.is_c_contiguous());
assert!(buffer.is_fortran_contiguous());
assert!(buffer.as_slice::<f64>(py).is_none());
assert!(buffer.as_slice::<i8>(py).is_none());
let slice = buffer.as_slice::<u8>(py).unwrap();
assert_eq!(slice.len(), 5);
assert_eq!(slice[0].get(), b'a');
assert_eq!(slice[2].get(), b'c');
assert!(buffer.as_mut_slice::<u8>(py).is_none());
assert!(buffer.copy_to_slice(py, &mut [0u8]).is_err());
let mut arr = [0; 5];
buffer.copy_to_slice(py, &mut arr).unwrap();
assert_eq!(arr, b"abcde" as &[u8]);
assert!(buffer.copy_from_slice(py, &[0u8; 5]).is_err());
assert!(buffer.to_vec::<i8>(py).is_err());
assert!(buffer.to_vec::<u16>(py).is_err());
assert_eq!(buffer.to_vec::<u8>(py).unwrap(), b"abcde");
} | rust_cleaned_test_functions.jsonl/60682 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 650
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12524,
7776,
368,
341,
286,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
286,
1077,
4510,
284,
342,
321,
43193,
543,
286,
1077,
5820,
284,
4510,
31710,
445,
65,
6,
13683,
450,
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_raw_zero() {
let hw = RefCell::new(CpuHardware::new());
unsafe {
let buf = Buffer::raw(&hw, 0);
assert!(ptr::eq(buf.hardware, &hw));
assert_eq!(buf.size, 0);
// We don't care about the pointer value of zero-length memory.
}
} | rust_cleaned_test_functions.jsonl/78618 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 166
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16067,
19359,
368,
341,
286,
1077,
31256,
284,
8550,
3599,
486,
931,
3025,
5584,
66862,
486,
931,
1423,
286,
19860,
341,
310,
1077,
6607,
284,
10312,
486,
1041,
2099,
27827,
11,
220,
15,
317,
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_create_account() {
let account = create_account(1, 0.0, 0.0);
let rewards = Rewards::from_account(&account).unwrap();
assert_eq!(rewards, Rewards::default());
} | rust_cleaned_test_functions.jsonl/100538 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
13500,
368,
341,
286,
1077,
2692,
284,
1855,
13500,
7,
16,
11,
220,
15,
13,
15,
11,
220,
15,
13,
15,
317,
286,
1077,
21160,
284,
49768,
486,
1499,
13500,
2099,
4608,
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,
1
] | 1 |
#[test]
fn test_nesting_scope() {
let ok = compile(
r#"
1 + 1
f = () => {
1 + 1
return () => {
1 + 1
return () => {
return 1 + 1
}
}
}
"#,
);
let mut v = RepeatedPlusChecker::new();
walk(&mut v, Node::Package(&ok));
assert_eq!(v.err.as_str(), "");
let not_ok1 = compile(
r#"
1 + 1
f = () => {
1 + 1
return () => {
return () => {
return 1
}
}
}
1 + 1 // error on line 11
"#,
);
let mut v = RepeatedPlusChecker::new();
walk(&mut v, Node::Package(¬_ok1));
assert_eq!(v.err.as_str(), "repeated + on line 11");
let not_ok2 = compile(
r#"
1 + 1
f = () => {
1 + 1
return () => {
1 + 1
return 1 + () => { // error on line 7
return 1
}()
}
}
"#,
);
let mut v = RepeatedPlusChecker::new();
walk(&mut v, Node::Package(¬_ok2));
assert_eq!(v.err.as_str(), "repeated + on line 7");
let not_ok3 = compile(
r#"
f = () => {
1 + 1
return () => {
1 + 1
return 1 + () => { // error on line 6
return 1 + 1 + 1 // error but should be ignored
}()
}
}
"#,
);
let mut v = RepeatedPlusChecker::new();
walk(&mut v, Node::Package(¬_ok3));
assert_eq!(v.err.as_str(), "repeated + on line 6");
} | rust_cleaned_test_functions.jsonl/3344 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 907
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1089,
59855,
23199,
368,
341,
310,
1077,
5394,
284,
19192,
1006,
394,
435,
2,
698,
16,
488,
220,
16,
198,
69,
284,
1719,
589,
341,
262,
220,
16,
488,
220,
16,
198,
262,
470,
1719,
589,
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_set_rate_inconsistent() {
let mut bank = Bank::new();
// End the USA economics!!
bank.set_rate(dollar(1.0), dollar(2.0));
} | rust_cleaned_test_functions.jsonl/133360 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 84
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
9246,
1243,
78399,
368,
341,
286,
1077,
5206,
6073,
284,
8547,
486,
931,
1428,
286,
442,
3972,
279,
7279,
27889,
50347,
286,
6073,
980,
9246,
1500,
21295,
7,
16,
13,
15,
701,
17692,
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 |
#[test]
fn test_try_catch() -> Result<(), Box<EvalAltResult>> {
let engine = Engine::new();
assert_eq!(
engine.eval::<INT>("try { throw 42; } catch (x) { return x; }")?,
42
);
assert_eq!(
engine.eval::<INT>("try { throw 42; } catch { return 123; }")?,
123
);
#[cfg(not(feature = "unchecked"))]
assert_eq!(
engine.eval::<INT>("let x = 42; try { let y = 123; print(x/0); } catch { x = 0 } x")?,
0
);
#[cfg(not(feature = "no_function"))]
assert_eq!(
engine.eval::<INT>(
"
fn foo(x) { try { throw 42; } catch (x) { return x; } }
foo(0)
"
)?,
42
);
assert_eq!(
engine.eval::<INT>(
"
let err = 123;
let x = 0;
try { throw 42; } catch(err) { return err; }
"
)?,
42
);
assert_eq!(
engine.eval::<INT>(
"
let err = 123;
let x = 0;
try { throw 42; } catch(err) { print(err); }
err
"
)?,
123
);
assert_eq!(
engine.eval::<INT>(
"
let foo = 123;
let x = 0;
try { throw 42; } catch(err) { return foo; }
"
)?,
123
);
assert_eq!(
engine.eval::<INT>(
"
let foo = 123;
let x = 0;
try { throw 42; } catch(err) { return err; }
"
)?,
42
);
#[cfg(not(feature = "unchecked"))]
assert!(matches!(
*engine
.run("try { 42/0; } catch { throw; }")
.expect_err("expects error"),
EvalAltResult::ErrorArithmetic(_, _)
));
Ok(())
} | rust_cleaned_test_functions.jsonl/10814 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1111
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
666,
754,
368,
1464,
5714,
68843,
8261,
23835,
831,
26017,
2077,
2452,
341,
262,
1077,
4712,
284,
8200,
486,
931,
1428,
262,
2060,
10714,
33673,
286,
4712,
31710,
27638,
3221,
13211,
1539,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 9 |
#[test]
fn test_function_score_query() {
let function_score_query = Query::build_function_score()
.with_function(Function::build_script_score("this_is_a_script")
.with_lang("made_up")
.add_param("A", 12)
.build())
.build();
assert_eq!("{\"function_score\":{\"functions\":[{\"script_score\":{\"lang\":\"made_up\",\"params\":{\"A\":12},\"inline\":\"this_is_a_script\"}}]}}",
serde_json::to_string(&function_score_query).unwrap());
} | rust_cleaned_test_functions.jsonl/4271 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 301
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9174,
10405,
5738,
368,
341,
286,
1077,
729,
10405,
5738,
284,
11361,
486,
5834,
9174,
10405,
741,
310,
659,
4197,
9174,
53916,
486,
5834,
14660,
10405,
445,
574,
6892,
4306,
14660,
1138,
5968,
65... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tag_class() {
let input = "{blue_circle}";
let input_chars: Vec<char> = input.chars().collect();
let tag = tag_classes().parse(&input_chars).expect("should parse");
assert_eq!(tag, vec!["blue_circle".to_string()]);
} | rust_cleaned_test_functions.jsonl/36476 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9372,
4790,
368,
341,
310,
1077,
1946,
284,
13868,
12203,
42222,
26259,
310,
1077,
1946,
37418,
25,
11312,
21919,
29,
284,
1946,
85062,
1005,
17384,
543,
310,
1077,
4772,
284,
4772,
16833,
1005,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_string_at_position_d() {
let example: Vec<char> = "a".to_string().chars().collect();
assert!(!is_string_at_position(&example, 0, "aaaa"));
} | rust_cleaned_test_functions.jsonl/126888 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 86
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
3904,
3752,
9661,
814,
368,
341,
286,
1077,
3110,
25,
11312,
21919,
29,
284,
330,
64,
3263,
983,
3904,
1005,
19255,
1005,
17384,
543,
286,
2060,
0,
3471,
285,
3904,
3752,
9661,
2099,
8687,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_static_assert_2() {
let mut l = Lexer::<DefaultContext>::new(b"_Static_assert(a != b, \"an assertion\")");
let p = StaticAssertParser::new(&mut l);
let mut context = Context::default();
let (_, u) = p.parse(None, &mut context).unwrap();
assert_eq!(
u.unwrap(),
StaticAssert {
condition: node!(BinaryOp {
op: Operator::Neq,
arg1: ExprNode::Variable(Box::new(mk_var!("a"))),
arg2: ExprNode::Variable(Box::new(mk_var!("b"))),
}),
string: Some("an assertion".to_string()),
cpp: false,
}
);
} | rust_cleaned_test_functions.jsonl/35937 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 398
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25360,
16553,
62,
17,
368,
341,
286,
1077,
5206,
326,
284,
85082,
27638,
3675,
1972,
6831,
931,
1883,
35089,
11690,
16553,
2877,
961,
293,
11,
7245,
276,
27419,
62705,
797,
286,
1077,
281,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_trans_segment_transactions() {
let data = data_lots_of_data().take(100).collect::<Vec<_>>();
// Populate a queue:
let mut sender = SenderBuilder::new()
.segment_size(512)
.open("data/trans-segment-transactions")
.unwrap();
sender.try_send_batch(&data).unwrap();
futures::executor::block_on(async move {
let mut receiver = Receiver::open("data/trans-segment-transactions").unwrap();
// Do some rollbacks:
for _ in 0..7 {
let batch = receiver.recv_batch(50).await.unwrap();
for (batch_item, item) in batch.iter().zip(&data) {
assert_eq!(batch_item, item);
}
batch.rollback().unwrap();
}
// Now commit:
let batch = receiver.recv_batch(50).await.unwrap();
for (batch_item, item) in batch.iter().zip(&data) {
assert_eq!(batch_item, item);
}
batch.commit().unwrap();
// And now do some more rollbacks:
for _ in 0..7 {
let batch = receiver.recv_batch(50).await.unwrap();
for (batch_item, item) in batch.iter().zip(&data[50..]) {
assert_eq!(batch_item, item);
}
batch.rollback().unwrap();
}
});
} | rust_cleaned_test_functions.jsonl/95835 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 759
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7965,
28061,
68182,
368,
341,
286,
1077,
821,
284,
821,
907,
2412,
3575,
1769,
1005,
22769,
7,
16,
15,
15,
568,
17384,
27638,
10050,
32399,
79279,
286,
442,
70938,
264,
7177,
510,
286,
1077,
520... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_point_to_point() {
let la = Point::new(-118.2437, 34.0522);
let ny = Point::new(-74.0060, 40.7128);
let nyg = Geometry::Point(ny);
match distance(&la, &nyg) {
Some(d) => assert_eq!(d.round(), 3944422.),
None => assert!(false, "Should get distance"),
}
} | rust_cleaned_test_functions.jsonl/93757 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 177
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6085,
2346,
6085,
368,
341,
286,
1077,
1187,
284,
5126,
486,
931,
4080,
16,
16,
23,
13,
17,
19,
18,
22,
11,
220,
18,
19,
13,
15,
20,
17,
17,
317,
286,
1077,
19004,
284,
5126,
486,
931,
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_new_passthrough() {
let conf = Config::new("testdata/passthrough_test.toml").unwrap();
let mut srv = passthrough::Server::new(conf.clone(), false);
let mut lb = srv.lbs[0].clone();
{
// set a backend server to healthy
let mut srvs_map = lb.backend.servers_map.write().unwrap();
let mut srvs_ring = lb.backend.ring.lock().unwrap();
let health = srvs_map
.get_mut(&SocketAddr::new(
IpAddr::V4("127.0.0.1".parse().unwrap()),
3080,
))
.unwrap();
*health = true;
srvs_ring.add_node(&Node {
host: IpAddr::V4("127.0.0.1".parse().unwrap()),
port: 3080,
})
}
assert_eq!(lb.dsr, false);
assert_eq!(lb.conn_tracker.read().unwrap().len(), 0);
assert_eq!(
*lb.backend
.servers_map
.read()
.unwrap()
.get(&SocketAddr::new(
IpAddr::V4("127.0.0.1".parse().unwrap()),
3080
))
.unwrap(),
true
);
assert_eq!(
*lb.backend
.servers_map
.read()
.unwrap()
.get(&SocketAddr::new(
IpAddr::V4("127.0.0.1".parse().unwrap()),
3081
))
.unwrap(),
false
);
//TODO: verify messages sent over channel to stats endpoint from proxy
let (stats_tx, _) = channel();
thread::spawn(move || {
srv.run(stats_tx);
});
let dummy_ip = "127.0.0.1".parse().unwrap();
let protocol = Layer3(IpNextHeaderProtocols::Tcp);
let (mut ipv4_tx, _) = transport_channel(4096, protocol).unwrap();
for i in 0..5 {
let mut ip_header = build_dummy_ip(dummy_ip, dummy_ip, 35000 + i, 3000);
let mut tcp_header = MutableTcpPacket::owned(ip_header.payload().to_owned()).unwrap();
lb.client_handler(&mut ip_header, &mut tcp_header, &mut ipv4_tx);
}
assert_eq!(lb.conn_tracker.read().unwrap().len(), 2);
} | rust_cleaned_test_functions.jsonl/83799 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1337
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
79578,
86901,
368,
341,
286,
1077,
2335,
284,
5532,
486,
931,
445,
92425,
4322,
300,
86901,
4452,
73494,
75,
1827,
15454,
543,
286,
1077,
5206,
43578,
284,
6368,
86901,
486,
5475,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_login() {
run_test(|url, client| {
let registration_response = client
.post(&format!("{}/biome/register", url))
.json(&UsernamePassword {
username: "test_login@gmail.com".to_string(),
hashed_password: "Admin2193!".to_string(),
})
.send()
.unwrap();
assert_eq!(registration_response.status().as_u16(), 200);
let login_response = client
.post(&format!("{}/biome/login", url))
.json(&UsernamePassword {
username: "test_login@gmail.com".to_string(),
hashed_password: "Admin2193!".to_string(),
})
.send()
.unwrap();
assert_eq!(login_response.status().as_u16(), 200);
})
} | rust_cleaned_test_functions.jsonl/32286 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 506
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13681,
368,
341,
286,
1598,
4452,
22428,
1085,
11,
2943,
91,
341,
310,
1077,
12227,
9655,
284,
2943,
198,
394,
659,
2203,
2099,
2243,
88928,
4472,
8221,
635,
37837,
497,
2515,
1171,
394,
659,
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_api_post_timestamp() {
let (testkit, _) = init_testkit();
let info = Timestamp::new(&Hash::zero(), "metadata");
let keypair = gen_keypair();
let tx = TxTimestamp::sign(&keypair.0, info, &keypair.1);
let api = testkit.api();
let data = to_hex_string(&tx);
let tx_info: TransactionResponse = api
.public(ApiKind::Explorer)
.query(&json!({ "tx_body": data }))
.post("v1/transactions")
.unwrap();
assert_eq!(tx.hash(), tx_info.tx_hash);
} | rust_cleaned_test_functions.jsonl/32316 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 230
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11697,
6333,
23073,
368,
341,
262,
1077,
320,
1944,
8226,
11,
27439,
284,
2930,
4452,
8226,
1428,
262,
1077,
3546,
284,
32758,
486,
931,
2099,
6370,
486,
14154,
1507,
330,
17637,
797,
262,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_expr_to_sql_i64() {
let pred = DeletePredicate {
range: TimestampRange::new(1, 2),
exprs: vec![
DeleteExpr {
column: String::from("col1"),
op: Op::Eq,
scalar: Scalar::I64(0),
},
DeleteExpr {
column: String::from("col2"),
op: Op::Eq,
scalar: Scalar::I64(-1),
},
DeleteExpr {
column: String::from("col3"),
op: Op::Eq,
scalar: Scalar::I64(1),
},
DeleteExpr {
column: String::from("col4"),
op: Op::Eq,
scalar: Scalar::I64(i64::MIN),
},
DeleteExpr {
column: String::from("col5"),
op: Op::Eq,
scalar: Scalar::I64(i64::MAX),
},
],
};
assert_eq!(
&pred.expr_sql_string(),
r#""col1"=0 AND "col2"=-1 AND "col3"=1 AND "col4"=-9223372036854775808 AND "col5"=9223372036854775807"#
);
} | rust_cleaned_test_functions.jsonl/49506 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 843
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21915,
2346,
18063,
5318,
21,
19,
368,
341,
286,
1077,
4162,
284,
10428,
36329,
341,
310,
2088,
25,
32758,
6046,
486,
931,
7,
16,
11,
220,
17,
1326,
310,
15169,
82,
25,
7486,
90515,
394,
10428... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_credential_finalization() -> Result<(), ProtocolError> {
let parameters = populate_test_vectors(&serde_json::from_str(TEST_VECTOR).unwrap());
let client_login_finish_result = ClientLogin::<RistrettoSha5123dhNoSlowHash>::deserialize(
¶meters.client_login_state[..],
)?
.finish(
CredentialResponse::<RistrettoSha5123dhNoSlowHash>::deserialize(
¶meters.credential_response[..],
)?,
ClientLoginFinishParameters::WithIdentifiers(parameters.id_u, parameters.id_s),
)?;
assert_eq!(
hex::encode(¶meters.einfo2),
hex::encode(&client_login_finish_result.confidential_info)
);
assert_eq!(
hex::encode(¶meters.server_s_pk),
hex::encode(&client_login_finish_result.server_s_pk.to_arr().to_vec())
);
assert_eq!(
hex::encode(¶meters.session_key),
hex::encode(&client_login_finish_result.session_key)
);
assert_eq!(
hex::encode(¶meters.credential_finalization),
hex::encode(client_login_finish_result.message.serialize())
);
assert_eq!(
hex::encode(¶meters.export_key),
hex::encode(client_login_finish_result.export_key)
);
Ok(())
} | rust_cleaned_test_functions.jsonl/27839 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 563
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
30320,
20676,
2022,
368,
1464,
5714,
68843,
24572,
1454,
29,
341,
262,
1077,
5029,
284,
30446,
4452,
49158,
2099,
47024,
9455,
486,
1499,
2895,
50320,
47993,
568,
15454,
5231,
262,
1077,
2943,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_node_space() {
assert_eq!(node_space(" "), Ok(("", ())));
assert_eq!(node_space("\t "), Ok(("", ())));
assert_eq!(node_space("\t \\ // hello\n "), Ok(("", ())));
assert!(node_space("blah").is_err());
} | rust_cleaned_test_functions.jsonl/116076 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 130
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5084,
14663,
368,
341,
286,
2060,
10714,
10297,
3509,
14663,
445,
59312,
7622,
7,
19814,
320,
38776,
286,
2060,
10714,
10297,
3509,
14663,
4921,
83,
59312,
7622,
7,
19814,
320,
38776,
286,
2060,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_generate_btree_ranges_conj() {
let index_schema = IndexSchema::new(vec![FieldSpec::new(
vec![String::from("a")],
Value::Int32(0),
)]);
let constraint = &HashMap::from([(
vec![String::from("a")],
Constraint::And(
Box::new(Constraint::GreaterThan(Value::Int32(-0))),
Box::new(Constraint::LessThan(Value::Int32(3))),
),
)]);
assert!(are_ranges_equal_unordered(
&index_schema.generate_btree_ranges(constraint),
&vec![(
Bound::Included(Index::new(vec![Value::Int32(0)])),
Bound::Included(Index::new(vec![Value::Int32(3)])),
)]
));
} | rust_cleaned_test_functions.jsonl/71770 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 430
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48851,
880,
9344,
58748,
3382,
73,
368,
341,
286,
1077,
1922,
25371,
284,
8008,
8632,
486,
931,
25592,
20703,
1877,
8327,
486,
931,
1006,
310,
7486,
20703,
703,
486,
1499,
445,
64,
899,
1259,
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_clone_reseeding() {
let mut zero = StepRng::new(0, 0);
let rng = ChaChaCore::from_rng(&mut zero).unwrap();
let mut rng1 = ReseedingRng::new(rng, 32*4, zero);
let first: u32 = rng1.gen();
for _ in 0..10 { let _ = rng1.gen::<u32>(); }
let mut rng2 = rng1.clone();
assert_eq!(first, rng2.gen::<u32>());
} | rust_cleaned_test_functions.jsonl/18025 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 203
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54742,
1288,
325,
16100,
368,
341,
286,
1077,
5206,
7168,
284,
14822,
49,
968,
486,
931,
7,
15,
11,
220,
15,
317,
286,
1077,
28422,
284,
27721,
95971,
5386,
486,
1499,
66849,
2099,
6984,
7168,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_to_rsne() {
let rsne = make_rsne(Some(cipher::CCMP_128), vec![cipher::CCMP_128], vec![akm::PSK]);
let negotiated_protection = NegotiatedProtection::from_rsne(&rsne)
.expect("error, could not create negotiated RSNE")
.to_full_protection();
assert_variant!(negotiated_protection, ProtectionInfo::Rsne(actual_protection) => {
assert_eq!(actual_protection, rsne);
});
} | rust_cleaned_test_functions.jsonl/22696 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
47115,
811,
368,
341,
286,
1077,
10036,
811,
284,
1281,
47115,
811,
65405,
1337,
10558,
486,
3706,
5781,
62,
16,
17,
23,
701,
7486,
20703,
67586,
486,
3706,
5781,
62,
16,
17,
23,
1125,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_comment() {
let b = Paragraph::new()
.add_comment_start(Comment::new(1))
.add_run(Run::new().add_text("Hello"))
.add_comment_end(1)
.build();
assert_eq!(
str::from_utf8(&b).unwrap(),
r#"<w:p w14:paraId="12345678"><w:pPr><w:rPr /></w:pPr><w:commentRangeStart w:id="1" /><w:r><w:rPr /><w:t xml:space="preserve">Hello</w:t></w:r><w:r>
<w:rPr />
</w:r>
<w:commentRangeEnd w:id="1" />
<w:r>
<w:commentReference w:id="1" />
</w:r></w:p>"#
);
} | rust_cleaned_test_functions.jsonl/50377 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 324
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17638,
368,
341,
286,
1077,
293,
284,
49351,
486,
931,
741,
310,
659,
718,
17638,
4906,
7,
10677,
486,
931,
7,
16,
1171,
310,
659,
718,
14007,
2785,
359,
486,
931,
1005,
718,
4326,
445,
9707,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_apply_snapshot() {
let locks: Vec<_> = vec![
(b"k0", 10),
(b"k1", 110),
(b"k5", 100),
(b"k2", 101),
(b"k3", 90),
(b"k2", 99),
]
.into_iter()
.map(|(k, ts)| {
let mut lock_info = LockInfo::default();
lock_info.set_key(k.to_vec());
lock_info.set_primary_lock(k.to_vec());
lock_info.set_lock_type(Op::Put);
lock_info.set_lock_version(ts);
lock_info
})
.collect();
let lock_kvs: Vec<_> = locks
.iter()
.map(|lock| lock_info_to_kv(lock.clone()))
.map(|(k, v)| (keys::data_key(&k), v))
.collect();
let (c, coprocessor_host) = new_test_collector();
start_collecting(&c, 100).unwrap();
coprocessor_host.post_apply_plain_kvs_from_snapshot(
&Region::default(),
CF_DEFAULT,
&lock_kvs,
);
assert_eq!(get_collected_locks(&c, 100).unwrap(), (vec![], true));
let expected_locks: Vec<_> = locks
.iter()
.filter(|l| l.get_lock_version() <= 100)
.cloned()
.collect();
coprocessor_host.post_apply_plain_kvs_from_snapshot(&Region::default(), CF_LOCK, &lock_kvs);
assert_eq!(
get_collected_locks(&c, 100).unwrap(),
(expected_locks.clone(), true)
);
// Fetch result twice gets the same result.
assert_eq!(
get_collected_locks(&c, 100).unwrap(),
(expected_locks.clone(), true)
);
// be dropped.
start_collecting(&c, 100).unwrap();
assert_eq!(
get_collected_locks(&c, 100).unwrap(),
(expected_locks.clone(), true)
);
start_collecting(&c, 90).unwrap_err();
assert_eq!(
get_collected_locks(&c, 100).unwrap(),
(expected_locks, true)
);
// dropped.
start_collecting(&c, 110).unwrap();
assert_eq!(get_collected_locks(&c, 110).unwrap(), (vec![], true));
coprocessor_host.post_apply_plain_kvs_from_snapshot(&Region::default(), CF_LOCK, &lock_kvs);
assert_eq!(get_collected_locks(&c, 110).unwrap(), (locks.clone(), true));
coprocessor_host.post_apply_sst_from_snapshot(&Region::default(), CF_DEFAULT, "");
assert_eq!(get_collected_locks(&c, 110).unwrap(), (locks.clone(), true));
// Apply SST file to lock cf is not supported. This will cause error and therefore
// `is_clean` will be set to false.
coprocessor_host.post_apply_sst_from_snapshot(&Region::default(), CF_LOCK, "");
assert_eq!(get_collected_locks(&c, 110).unwrap(), (locks, false));
} | rust_cleaned_test_functions.jsonl/15210 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1505
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36551,
53265,
368,
341,
286,
1077,
31676,
25,
11312,
32399,
29,
284,
7486,
90515,
310,
320,
65,
62911,
15,
497,
220,
16,
15,
1326,
310,
320,
65,
62911,
16,
497,
220,
16,
16,
15,
1326,
310,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_exchange_code_successful_with_redirect_url() {
let client = new_client()
.set_auth_type(AuthType::RequestBody)
.set_redirect_uri(RedirectUrl::new("https://redirect/here".to_string()).unwrap());
let token = client
.exchange_code(AuthorizationCode::new("ccc".to_string()))
.request(mock_http_client(
vec![
(ACCEPT, "application/json"),
(CONTENT_TYPE, "application/x-www-form-urlencoded"),
],
"grant_type=authorization_code&code=ccc&client_id=aaa&client_secret=bbb&\
redirect_uri=https%3A%2F%2Fredirect%2Fhere",
None,
HttpResponse {
status_code: StatusCode::OK,
headers: vec![(
CONTENT_TYPE,
HeaderValue::from_str("application/json").unwrap(),
)]
.into_iter()
.collect(),
body: "{\
\"access_token\": \"12/34\", \
\"token_type\": \"bearer\", \
\"scope\": \"read write\"\
}"
.to_string()
.into_bytes(),
},
))
.unwrap();
assert_eq!("12/34", token.access_token().secret());
assert_eq!(BasicTokenType::Bearer, *token.token_type());
assert_eq!(
Some(&vec![
Scope::new("read".to_string()),
Scope::new("write".to_string()),
]),
token.scopes()
);
assert_eq!(None, token.expires_in());
assert!(token.refresh_token().is_none());
} | rust_cleaned_test_functions.jsonl/18598 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 905
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
59212,
4136,
92951,
6615,
30043,
2903,
368,
341,
262,
1077,
2943,
284,
501,
8179,
741,
286,
659,
746,
14014,
1819,
37640,
929,
486,
33334,
340,
286,
659,
746,
30043,
15572,
2785,
291,
1226,
2864,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_input() {
let s = include_str!("../../input/2019/day15.txt").trim();
let code = Intcode::parse(s);
assert_eq!(solve1(code), 374);
} | rust_cleaned_test_functions.jsonl/86119 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5898,
368,
341,
286,
1077,
274,
284,
2924,
2895,
17223,
2748,
1355,
14,
17,
15,
16,
24,
44739,
16,
20,
3909,
1827,
10666,
543,
286,
1077,
2038,
284,
1333,
1851,
486,
6400,
1141,
626,
286,
2060... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_day4() {
let example1 = "\
ecl:gry pid:860033327 eyr:2020 hcl:#fffffd
byr:1937 iyr:2017 cid:147 hgt:183cm
iyr:2013 ecl:amb cid:350 eyr:2023 pid:028048884
hcl:#cfa07d byr:1929
hcl:#ae17e1 iyr:2013
eyr:2024
ecl:brn pid:760753108 byr:1931
hgt:179cm
hcl:#cfa07d eyr:2025 pid:166559648
iyr:2011 ecl:brn hgt:59in";
assert_eq!(part1(example1), 2);
let example2 = "\
eyr:1972 cid:100
hcl:#18171d ecl:amb hgt:170 pid:186cm iyr:2018 byr:1926
iyr:2019
hcl:#602927 eyr:1967 hgt:170cm
ecl:grn pid:012533040 byr:1946
hcl:dab227 iyr:2012
ecl:brn hgt:182cm pid:021572410 eyr:2020 byr:1992 cid:277
hgt:59cm ecl:zzz
eyr:2038 hcl:74454a iyr:2023
pid:3556412378 byr:2007
pid:087499704 hgt:74in ecl:grn iyr:2012 eyr:2030 byr:1980
hcl:#623a2f
eyr:2029 ecl:blu cid:129 byr:1989
iyr:2014 pid:896056539 hcl:#a97842 hgt:165cm
hcl:#888785
hgt:164cm byr:2001 iyr:2015 cid:88
pid:545766238 ecl:hzl
eyr:2022
iyr:2010 hgt:158cm hcl:#b6652a ecl:blu byr:1944 eyr:2021 pid:093154719
";
assert_eq!(part2(example2), 4);
} | rust_cleaned_test_functions.jsonl/96725 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 548
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16763,
19,
368,
341,
262,
1077,
3110,
16,
284,
93317,
68,
564,
70418,
884,
14814,
25,
23,
21,
15,
15,
18,
18,
18,
17,
22,
3912,
81,
25,
17,
15,
17,
15,
305,
564,
14111,
7238,
6902,
198,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_json_invalid_arguments() {
let cases = vec![
(ScalarFuncSig::JsonObjectSig, make_null_datums(3)),
(ScalarFuncSig::JsonSetSig, make_null_datums(4)),
(ScalarFuncSig::JsonInsertSig, make_null_datums(6)),
(ScalarFuncSig::JsonReplaceSig, make_null_datums(8)),
];
let mut ctx = EvalContext::default();
for (sig, args) in cases {
let args: Vec<_> = args.into_iter().map(datum_expr).collect();
let op = Expression::build(&mut ctx, scalar_func_expr(sig, &args));
assert!(op.is_err());
}
} | rust_cleaned_test_functions.jsonl/5039 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 332
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9455,
31433,
43433,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
320,
20639,
9626,
47246,
486,
43375,
47246,
11,
1281,
15162,
15353,
6237,
7,
18,
6965,
310,
320,
20639,
9626,
47246,
486,
5014... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_get_timeout() {
let mut server = CoAPServer::new("127.0.0.1:5684").unwrap(); // may fail if port happens to be in use!
server.handle(request_handler).unwrap();
let error = CoAPClient::get_with_timeout("coap://127.0.0.1:5684/Rust", Duration::new(1, 0))
.unwrap_err();
if cfg!(windows) {
assert_eq!(error.kind(), ErrorKind::TimedOut);
} else {
assert_eq!(error.kind(), ErrorKind::WouldBlock);
}
} | rust_cleaned_test_functions.jsonl/92078 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 241
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
20537,
368,
341,
286,
1077,
5206,
3538,
284,
3539,
2537,
5475,
486,
931,
445,
16,
17,
22,
13,
15,
13,
15,
13,
16,
25,
20,
21,
23,
19,
1827,
15454,
2129,
220,
442,
1231,
3690,
421,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_json_arrays() {
let builder = ReaderBuilder::new().infer_schema(None).with_batch_size(64);
let mut reader: Reader<File> = builder
.build::<File>(File::open("test/data/arrays.json").unwrap())
.unwrap();
let batch = reader.next().unwrap().unwrap();
assert_eq!(4, batch.num_columns());
assert_eq!(3, batch.num_rows());
let schema = batch.schema();
let a = schema.column_with_name("a").unwrap();
assert_eq!(&DataType::Int64, a.1.data_type());
let b = schema.column_with_name("b").unwrap();
assert_eq!(
&DataType::List(Box::new(Field::new("item", DataType::Float64, true))),
b.1.data_type()
);
let c = schema.column_with_name("c").unwrap();
assert_eq!(
&DataType::List(Box::new(Field::new("item", DataType::Boolean, true))),
c.1.data_type()
);
let d = schema.column_with_name("d").unwrap();
assert_eq!(&DataType::Utf8, d.1.data_type());
let aa = batch
.column(a.0)
.as_any()
.downcast_ref::<Int64Array>()
.unwrap();
assert_eq!(1, aa.value(0));
assert_eq!(-10, aa.value(1));
assert_eq!(1627668684594000000, aa.value(2));
let bb = batch
.column(b.0)
.as_any()
.downcast_ref::<ListArray>()
.unwrap();
let bb = bb.values();
let bb = bb.as_any().downcast_ref::<Float64Array>().unwrap();
assert_eq!(9, bb.len());
assert_eq!(2.0, bb.value(0));
assert_eq!(-6.1, bb.value(5));
assert!(!bb.is_valid(7));
let cc = batch
.column(c.0)
.as_any()
.downcast_ref::<ListArray>()
.unwrap();
let cc = cc.values();
let cc = cc.as_any().downcast_ref::<BooleanArray>().unwrap();
assert_eq!(6, cc.len());
assert!(!cc.value(0));
assert!(!cc.value(4));
assert!(!cc.is_valid(5));
} | rust_cleaned_test_functions.jsonl/22590 | {
"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,
9455,
68983,
368,
341,
286,
1077,
7363,
284,
25166,
3297,
486,
931,
1005,
89559,
25371,
26717,
568,
4197,
14534,
2368,
7,
21,
19,
317,
286,
1077,
5206,
6604,
25,
25166,
52014,
29,
284,
7363,
198... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pi_std() {
let result = get_actual_result("test_csvs/PiDigits.csv", "stddev");
assert_abs_diff_eq!(result, 2.86733906028871, epsilon = stddev_epsilon());
} | rust_cleaned_test_functions.jsonl/80541 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 87
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47771,
15656,
368,
341,
262,
1077,
1102,
284,
633,
40149,
5287,
445,
1944,
14020,
82,
16341,
72,
47167,
11219,
497,
330,
1834,
3583,
797,
262,
2060,
31170,
15850,
10714,
10297,
1382,
11,
220,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_smoke() {
let (_td, repo) = repo_init().unwrap();
let root = repo.path().parent().unwrap();
let repo_path = root.as_os_str().to_str().unwrap();
assert_eq!(
stash_save(repo_path, None, true, false).is_ok(),
false
);
assert_eq!(get_stashes(repo_path).unwrap().is_empty(), true);
} | rust_cleaned_test_functions.jsonl/20964 | {
"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,
15874,
4740,
368,
341,
286,
1077,
5453,
1296,
11,
15867,
8,
284,
15867,
6137,
1005,
15454,
543,
286,
1077,
3704,
284,
15867,
3875,
1005,
3765,
1005,
15454,
543,
286,
1077,
15867,
2638,
284,
3704,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_categories() {
let mut oauth = SpotifyOAuth::default().scope("user-follow-read").build();
match get_token(&mut oauth) {
Some(token_info) => {
let client_credential = SpotifyClientCredentials::default()
.token_info(token_info)
.build();
let spotify = Spotify::default()
.client_credentials_manager(client_credential)
.build();
let categories = spotify.categories(None, Some(Country::UnitedStates), 10, 0);
assert!(categories.is_ok());
}
None => assert!(false),
};
} | rust_cleaned_test_functions.jsonl/79251 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 301
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27542,
368,
341,
262,
1077,
5206,
46415,
284,
40537,
57850,
486,
2258,
1005,
4186,
445,
872,
92585,
28806,
1827,
5834,
543,
262,
2432,
633,
6458,
2099,
6984,
46415,
8,
341,
286,
4329,
13274,
3109,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_parse_type() {
const TYPES: [Type; 5] = [Type::A, Type::Aaaa, Type::Ptr, Type::Srv, Type::Txt];
for t in TYPES.iter() {
match Type::try_from(u16::from(*t)) {
Ok(parsed_type) => assert_eq!(*t, parsed_type),
Err(e) => panic!("parse error {:?}", e),
}
}
} | rust_cleaned_test_functions.jsonl/34431 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 203
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
1819,
368,
341,
286,
733,
82325,
25,
508,
929,
26,
220,
20,
60,
284,
508,
929,
486,
32,
11,
3990,
486,
32,
32646,
11,
3990,
486,
5348,
11,
3990,
486,
50,
10553,
11,
3990,
486,
35629,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_eth_transfer_not_enough_gas() {
let (mut runner, mut source_account, dest_address) = initialize_transfer();
let source_address = test_utils::address_from_secret_key(&source_account.secret_key);
let transaction = |nonce| {
let mut tx = test_utils::transfer(dest_address, TRANSFER_AMOUNT, nonce);
tx.gas = 10_000.into(); // this is not enough gas
tx
};
// validate pre-state
test_utils::validate_address_balance_and_nonce(
&runner,
source_address,
INITIAL_BALANCE,
INITIAL_NONCE.into(),
);
test_utils::validate_address_balance_and_nonce(&runner, dest_address, Wei::zero(), 0.into());
// attempt transfer
let err = runner
.submit_with_signer(&mut source_account, transaction)
.unwrap_err();
let error_message = format!("{:?}", err);
assert!(error_message.contains("ERR_INTRINSIC_GAS"));
test_utils::validate_address_balance_and_nonce(
&runner,
source_address,
INITIAL_BALANCE,
INITIAL_NONCE.into(),
);
test_utils::validate_address_balance_and_nonce(&runner, dest_address, Wei::zero(), 0.into());
} | rust_cleaned_test_functions.jsonl/131047 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 503
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57757,
35403,
7913,
6205,
1384,
82116,
368,
341,
262,
1077,
320,
6984,
22259,
11,
5206,
2530,
13500,
11,
3201,
6744,
8,
284,
9468,
35403,
543,
262,
1077,
2530,
6744,
284,
1273,
17309,
486,
4995,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_exp() {
assert_eq!((0.0_f64).exp(), exp(0.0));
assert_eq!((1.0_f64).exp(), exp(1.0));
assert_eq!((-1.0_f64).exp(), exp(-1.0));
} | rust_cleaned_test_functions.jsonl/50094 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 93
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14214,
368,
341,
262,
2060,
10714,
0,
1188,
15,
13,
15,
761,
21,
19,
568,
4580,
1507,
1343,
7,
15,
13,
15,
1106,
262,
2060,
10714,
0,
1188,
16,
13,
15,
761,
21,
19,
568,
4580,
1507,
1343,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_token() {
let token = "eyJ0eXAiOiJKV1QiLCJraWQiOm51bGwsImFsZyI6IkhTMjU2In0.eyJpc3MiOm51bGwsInN1YiI6IjEiLCJhdWQiOm51bGwsImV4cCI6MTU4NzAyNzkyNSwibmJmIjpudWxsLCJpYXQiOjE1ODcwMjQzMjUsImp0aSI6bnVsbH0.AN8RMyD8pHcMOft+LxXsLu1cTOKiEWk2mC6YYu6pDKw";
let result = read_token(token);
assert!(result.is_ok());
} | rust_cleaned_test_functions.jsonl/87827 | {
"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,
6443,
6458,
368,
341,
262,
1077,
3950,
284,
330,
84609,
15,
68,
59450,
72,
81096,
34070,
53,
16,
96175,
8556,
41,
956,
54,
96175,
63488,
20,
16,
65,
38,
8915,
1427,
48300,
57,
88,
40,
21,
40... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_disconnect_over_mux_control_closes_session() {
let mut exec = fasync::Executor::new().unwrap();
let (session_fut, remote) = setup_session_task();
pin_mut!(session_fut);
assert!(exec.run_until_stalled(&mut session_fut).is_pending());
let remote_closed_fut = remote.closed();
pin_mut!(remote_closed_fut);
assert!(exec.run_until_stalled(&mut remote_closed_fut).is_pending());
// Remote sends SABM to start up session multiplexer.
let sabm = Frame::make_sabm_command(Role::Unassigned, DLCI::MUX_CONTROL_DLCI);
let mut buf = vec![0; sabm.encoded_len()];
assert!(sabm.encode(&mut buf).is_ok());
remote.as_ref().write(&buf).expect("Should send");
assert!(exec.run_until_stalled(&mut session_fut).is_pending());
// Remote sends us a disconnect frame over the Mux Control DLCI.
let disconnect = Frame::make_disc_command(Role::Initiator, DLCI::MUX_CONTROL_DLCI);
let mut buf = vec![0; disconnect.encoded_len()];
assert!(disconnect.encode(&mut buf).is_ok());
remote.as_ref().write(&buf).expect("Should send");
assert!(exec.run_until_stalled(&mut session_fut).is_ready());
assert!(exec.run_until_stalled(&mut remote_closed_fut).is_ready());
} | rust_cleaned_test_functions.jsonl/14935 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 590
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67972,
15431,
80363,
13436,
666,
49341,
12316,
368,
341,
286,
1077,
5206,
3883,
284,
282,
7692,
486,
25255,
486,
931,
1005,
15454,
1428,
286,
1077,
320,
5920,
761,
332,
11,
8699,
8,
284,
6505,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_side_metadata_sanity_verify_global_specs_total_size() {
let spec_1 = SideMetadataSpec {
name: "spec_1",
is_global: true,
offset: SideMetadataOffset::addr(Address::ZERO),
log_num_of_bits: 0,
log_bytes_in_region: 0,
};
let spec_2 = SideMetadataSpec {
name: "spec_2",
is_global: true,
offset: SideMetadataOffset::layout_after(&spec_1),
log_num_of_bits: 0,
log_bytes_in_region: 0,
};
assert!(verify_global_specs_total_size(&[spec_1]).is_ok());
#[cfg(target_pointer_width = "64")]
assert!(verify_global_specs_total_size(&[spec_1, spec_2]).is_ok());
#[cfg(target_pointer_width = "32")]
assert!(verify_global_specs_total_size(&[spec_1, spec_2]).is_err());
let spec_2 = SideMetadataSpec {
name: "spec_2",
is_global: true,
offset: SideMetadataOffset::layout_after(&spec_1),
log_num_of_bits: 3,
log_bytes_in_region: 1,
};
assert!(verify_global_specs_total_size(&[spec_1, spec_2]).is_err());
let spec_1 = SideMetadataSpec {
name: "spec_1",
is_global: true,
offset: SideMetadataOffset::addr(Address::ZERO),
log_num_of_bits: 1,
#[cfg(target_pointer_width = "64")]
log_bytes_in_region: 0,
#[cfg(target_pointer_width = "32")]
log_bytes_in_region: 2,
};
let spec_2 = SideMetadataSpec {
name: "spec_2",
is_global: true,
offset: SideMetadataOffset::layout_after(&spec_1),
log_num_of_bits: 3,
#[cfg(target_pointer_width = "64")]
log_bytes_in_region: 2,
#[cfg(target_pointer_width = "32")]
log_bytes_in_region: 4,
};
assert!(verify_global_specs_total_size(&[spec_1, spec_2]).is_ok());
assert!(verify_global_specs_total_size(&[spec_1, spec_2, spec_1]).is_err());
} | rust_cleaned_test_functions.jsonl/50088 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1120
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30862,
22220,
643,
38270,
35638,
19296,
71200,
10784,
2368,
368,
341,
286,
1077,
1398,
62,
16,
284,
16659,
14610,
8327,
341,
310,
829,
25,
330,
9535,
62,
16,
756,
310,
374,
19296,
25,
830,
345,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stdin_show_ends() {
for same_param in vec!["-E", "--show-ends"] {
new_ucmd!()
.args(&[same_param, "-"])
.pipe_in("\t\0\n\t")
.succeeds()
.stdout_only("\t\0$\n\t");
}
} | rust_cleaned_test_functions.jsonl/90934 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 160
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15656,
258,
15267,
90729,
368,
341,
262,
369,
1852,
4090,
304,
7486,
0,
1183,
12,
36,
497,
14482,
3445,
12,
1412,
1341,
341,
286,
501,
68887,
2277,
0,
741,
310,
659,
2116,
2099,
58,
24063,
409... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_arithmetic() {
let mut file_names = vec![];
let name = "test_mvir/test-arithmetic.mvir".to_string();
file_names.push(name);
let (modules, source_maps) = compile_files(file_names.to_vec());
let mut ts = BoogieTranslator::new(&modules, &source_maps);
let mut res = String::new();
// handwritten boogie code
let written_code = fs::read_to_string("src/bytecode_instrs.bpl").unwrap();
res.push_str(&written_code);
res.push_str(&ts.translate());
} | rust_cleaned_test_functions.jsonl/5433 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25842,
25922,
368,
341,
262,
1077,
5206,
1034,
9187,
284,
7486,
0,
15078,
262,
1077,
829,
284,
330,
1944,
717,
45857,
12697,
57393,
25922,
744,
45857,
3263,
983,
3904,
543,
262,
1034,
9187,
2552,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serialize_basepoint() {
// make sure elements are serialized same as the python library
let exp = "5866666666666666666666666666666666666666666666666666666666666666";
let base_vec = ED25519_BASEPOINT_POINT.compress().as_bytes().to_vec();
let base_hex = hex::encode(base_vec);
println!("exp: {:?}", exp);
println!("got: {:?}", base_hex);
assert_eq!(exp, base_hex);
} | rust_cleaned_test_functions.jsonl/13886 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 157
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
7651,
2768,
368,
341,
262,
442,
1281,
2704,
5424,
525,
32916,
1852,
438,
279,
10135,
6733,
198,
262,
1077,
1343,
284,
330,
20,
23,
21,
21,
21,
21,
21,
21,
21,
21,
21,
21,
21,
21,
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... | 1 |
#[test]
fn test_channel_id_calculation() {
let tx: Transaction = serialize::deserialize(&hex::decode("020000000001010e0adef48412e4361325ac1c6e36411299ab09d4f083b9d8ddb55fbc06e1b0c00000000000feffffff0220a1070000000000220020f81d95e040bd0a493e38bae27bff52fe2bb58b93b293eb579c01c31b05c5af1dc072cfee54a3000016001434b1d6211af5551905dc2642d05f5b04d25a8fe80247304402207f570e3f0de50546aad25a872e3df059d277e776dda4269fa0d2cc8c2ee6ec9a022054e7fae5ca94d47534c86705857c24ceea3ad51c69dd6051c5850304880fc43a012103cb11a1bacc223d98d91f1946c6752e358a5eb1a1c983b3e6fb15378f453b76bd00000000").unwrap()[..]).unwrap();
assert_eq!(&OutPoint {
txid: tx.txid(),
index: 0
}.to_channel_id(), &hex::decode("3e88dd7165faf7be58b3c5bb2c9c452aebef682807ea57080f62e6f6e113c25e").unwrap()[..]);
assert_eq!(&OutPoint {
txid: tx.txid(),
index: 1
}.to_channel_id(), &hex::decode("3e88dd7165faf7be58b3c5bb2c9c452aebef682807ea57080f62e6f6e113c25f").unwrap()[..]);
} | rust_cleaned_test_functions.jsonl/42865 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 500
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14571,
842,
38241,
2914,
368,
341,
197,
10217,
9854,
25,
17869,
284,
24235,
486,
66777,
2099,
17308,
486,
18196,
445,
15,
17,
15,
15,
15,
15,
15,
15,
15,
15,
15,
16,
15,
16,
15,
68,
15,
32... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_shuffle_proof_encoded() {
let (mut t, _, _) = ExternalityBuilder::build();
t.execute_with(|| {
assert_ok!(test_benchmark_shuffle_proof_3_encoded::<TestRuntime>());
assert_ok!(test_benchmark_verify_shuffle_proof_3_encoded::<TestRuntime>());
});
} | rust_cleaned_test_functions.jsonl/24794 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 158
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
19762,
15544,
73484,
86757,
73069,
368,
341,
286,
1077,
320,
6984,
259,
11,
8358,
27439,
284,
1374,
4160,
2719,
3297,
486,
5834,
543,
286,
259,
7769,
6615,
79453,
341,
310,
2060,
19817,
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... | 2 |
#[test]
fn test_flip() {
let mut dcel = DCEL::new();
let v0 = dcel.insert_vertex(());
let v1 = dcel.insert_vertex(());
let v2 = dcel.insert_vertex(());
let v3 = dcel.insert_vertex(());
let e01 = dcel.connect_two_isolated_vertices(v0, v1, 0);
let e12 = dcel.connect_edge_to_isolated_vertex(e01, v2);
let e23 = dcel.connect_edge_to_isolated_vertex(e12, v3);
let e30 = dcel.create_face(e23, e01);
let e_flip = dcel.create_face(e30, e23);
assert_eq!(
dcel.edges[e_flip],
HalfEdgeEntry {
next: e23,
prev: e30,
twin: dcel.edges[e_flip].twin,
origin: 0,
face: 2,
data: (),
}
);
dcel.flip_cw(e_flip);
let twin = dcel.edges[e_flip].twin;
assert_eq!(
dcel.edges[e_flip],
HalfEdgeEntry {
next: e12,
prev: e23,
twin: twin,
origin: 3,
face: 2,
data: (),
}
);
assert_eq!(
dcel.edges[twin],
HalfEdgeEntry {
next: e30,
prev: e01,
twin: e_flip,
origin: 1,
face: 1,
data: (),
}
);
} | rust_cleaned_test_functions.jsonl/7374 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 921
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56012,
368,
341,
286,
1077,
5206,
294,
3672,
284,
422,
41664,
486,
931,
543,
286,
1077,
348,
15,
284,
294,
3672,
7030,
26611,
7,
1423,
286,
1077,
348,
16,
284,
294,
3672,
7030,
26611,
7,
1423,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invalid_url_scheme() {
expect_err!(UrlScheme, "");
expect_err!(UrlScheme, "0fuch.sia-pkg+0");
expect_err!(UrlScheme, "fuchsia_pkg");
expect_err!(UrlScheme, "FUCHSIA-PKG");
expect_err!(UrlScheme, &format!("{}", repeat("f").take(101).collect::<String>()));
} | rust_cleaned_test_functions.jsonl/98672 | {
"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,
31433,
2903,
53293,
368,
341,
286,
1720,
9266,
10297,
2864,
28906,
11,
14498,
286,
1720,
9266,
10297,
2864,
28906,
11,
330,
15,
69,
1387,
514,
685,
2268,
7351,
10,
15,
797,
286,
1720,
9266,
1029... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_predicate_after_renaming() -> Result<()> {
let df = df![
"foo" => [1, 2, 3],
"bar" => [3, 2, 1]
]?
.lazy()
.rename(["foo", "bar"], ["foo2", "bar2"])
.filter(col("foo2").eq(col("bar2")))
.collect()?;
let expected = df![
"foo2" => [2],
"bar2" => [2],
]?;
assert!(df.frame_equal(&expected));
Ok(())
} | rust_cleaned_test_functions.jsonl/110632 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 215
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
97474,
19844,
1288,
77,
6469,
368,
1464,
5714,
71698,
341,
262,
1077,
6764,
284,
6764,
90515,
286,
330,
7975,
1,
589,
508,
16,
11,
220,
17,
11,
220,
18,
1259,
286,
330,
2257,
1,
589,
508,
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... | 4 |
#[test]
fn test_parse() {
assert_eq!(
Condition::Or("foo", "bar"),
Condition::parse_first("foo||bar")
);
assert_eq!(
Condition::And("foo", "bar"),
Condition::parse_first("foo&&bar")
);
assert_eq!(
Condition::And("foo", "bar||baz"),
Condition::parse_first("foo&&bar||baz")
);
assert_eq!(
Condition::And("foo ", " bar || baz"),
Condition::parse_first("foo && bar || baz")
);
} | rust_cleaned_test_functions.jsonl/51718 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 294
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
368,
341,
286,
2060,
10714,
33673,
310,
15180,
486,
2195,
445,
7975,
497,
330,
2257,
4461,
310,
15180,
486,
6400,
12978,
445,
7975,
8484,
2257,
1138,
286,
1439,
286,
2060,
10714,
33673,
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_vec3a_floor() {
assert_eq!(
Vec3A::new(1.35, 1.5, -1.5).floor(),
Vec3A::new(1.0, 1.0, -2.0)
);
assert_eq!(
Vec3A::new(f32::INFINITY, f32::NEG_INFINITY, 0.0).floor(),
Vec3A::new(f32::INFINITY, f32::NEG_INFINITY, 0.0)
);
assert!(Vec3A::new(f32::NAN, 0.0, 0.0).floor().x.is_nan());
assert_eq!(
Vec3A::new(-2000000.123, 10000000.123, 1000.9).floor(),
Vec3A::new(-2000001.0, 10000000.0, 1000.0)
);
} | rust_cleaned_test_functions.jsonl/23507 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 287
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
18,
64,
60044,
368,
341,
262,
2060,
10714,
33673,
286,
11312,
18,
32,
486,
931,
7,
16,
13,
18,
20,
11,
220,
16,
13,
20,
11,
481,
16,
13,
20,
568,
30449,
3148,
286,
11312,
18,
32,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_data_dir_name() {
let mut path = PathBuf::new();
path.push(".");
let config = WalletConfig {
version: "v1".to_string(),
chain_type: ChainTypes::Mainnet,
current_dir: Some(path),
create_path: false,
sub_command: "account".to_string(),
account: "default".to_string(),
node: "".to_string(),
node_api_secret: None,
init_args: None,
outputs_args: None,
send_args: None,
burn_args: None,
claim_args: None,
cancel_args: None,
account_args: None,
txs_args: None,
pass: None,
};
let res = get_data_dir_name(&config);
assert_eq!(res.is_ok(), true);
let mut path = PathBuf::new();
path.push(".".to_string());
path.push("wallet_data".to_string());
let mut path2 = PathBuf::new();
path2.push(res.unwrap());
assert_eq!(path, path2);
} | rust_cleaned_test_functions.jsonl/38582 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 367
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
1769,
4334,
1269,
368,
341,
197,
10217,
5206,
1815,
284,
7933,
15064,
486,
931,
543,
197,
26781,
2552,
85847,
197,
10217,
2193,
284,
36483,
2648,
341,
298,
74954,
25,
330,
85,
16,
3263,
98... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vec_tvm() {
let data: &[u8] = &[0x2, 0, 0, 0, 0, 0, 0, 0, 0x12, 0x34, 0x56, 0x78];
let result: Vec<u16> = from_bytes(data, PodType::TVM).unwrap();
assert_eq!(result, vec![0x3412, 0x7856]);
} | rust_cleaned_test_functions.jsonl/57364 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
528,
7338,
368,
341,
286,
1077,
821,
25,
44590,
84,
23,
60,
284,
44590,
15,
87,
17,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_disable_peer() {
let (mut request_manager, validators) = generate_request_manager_and_validators(0, 1);
let validator_0 = validators[0].clone();
// Verify single validator in peers
assert!(request_manager.is_known_upstream_peer(&validator_0));
assert!(!request_manager.no_available_peers());
// Disable validator 0
request_manager
.disable_peer(&validator_0, ConnectionOrigin::Outbound)
.unwrap();
assert!(request_manager.is_known_upstream_peer(&validator_0));
assert!(request_manager.no_available_peers());
// Add validator 0 and verify it's now enabled
request_manager
.enable_peer(validator_0, ConnectionOrigin::Outbound)
.unwrap();
assert!(!request_manager.no_available_peers());
} | rust_cleaned_test_functions.jsonl/42109 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 371
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33842,
45159,
368,
341,
286,
1077,
320,
6984,
1681,
12144,
11,
38588,
8,
284,
6923,
7893,
12144,
8378,
8337,
2973,
7,
15,
11,
220,
16,
626,
286,
1077,
22935,
62,
15,
284,
38588,
58,
15,
936,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_object_literal_method_definition_setter() {
assert_parse_success!(
primary_expression(false, false),
"{ set key(value) { } }",
Expression::ObjectExpression {
properties: vec![ObjectExpressionProperty::Property(Property {
key: Expression::Identifier {
name: "key".to_string(),
loc: Some(((1, 6), (1, 9)).into()),
},
value: Expression::FunctionExpression {
id: None,
params: vec![Pattern::Identifier {
name: "value".to_string(),
loc: Some(((1, 10), (1, 15)).into()),
}],
body: vec![],
async: false,
generator: false,
},
kind: PropertyKind::Set,
method: false,
shorthand: false,
computed: false,
loc: Some(((1, 2), (1, 21)).into()),
})],
loc: Some(((1, 0), (1, 23)).into()),
}
);
} | rust_cleaned_test_functions.jsonl/66484 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 659
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5314,
34100,
9032,
31698,
2602,
465,
368,
341,
262,
2060,
21039,
18632,
33673,
286,
6028,
28068,
3576,
11,
895,
1326,
286,
13868,
738,
1376,
3679,
8,
314,
220,
335,
335,
756,
286,
16378,
486,
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_field_range_to_last() {
let mut cmd = assert_cmd::Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap();
cmd.args(&["-d", ",", "-f", "3-", "sed", "s/./_/"])
.write_stdin("AAA,BBB,CCC,DDD\nEEE,FFF,GGG,HHH\n")
.assert()
.stdout("AAA,BBB,_CC,_DD\nEEE,FFF,_GG,_HH\n");
} | rust_cleaned_test_functions.jsonl/7924 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5013,
9698,
2346,
12195,
368,
341,
286,
1077,
5206,
5439,
284,
2060,
11684,
486,
4062,
486,
66715,
21816,
16978,
17223,
34,
7581,
46,
94126,
4708,
15197,
15454,
543,
286,
5439,
16365,
2099,
1183,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_deserialize_invalid_array_length() {
let _guard = LOCK.run_concurrently();
let buffer = b"\n\x00\x00\x00\x04\x00\x00\x00\x00\x00";
Document::from_reader(&mut std::io::Cursor::new(buffer))
.expect_err("expected deserialization to fail");
} | rust_cleaned_test_functions.jsonl/49164 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15768,
9050,
31433,
3858,
5118,
368,
341,
262,
1077,
716,
26098,
284,
49463,
7634,
3382,
58202,
543,
262,
1077,
4147,
284,
293,
11934,
77,
3462,
15,
15,
3462,
15,
15,
3462,
15,
15,
3462,
15,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_auto_m_versions() {
let ctx = TestContext::new();
let mut con = ctx.connection();
assert_eq!(con.set_multiple(&[("key1", 1), ("key2", 2)]), Ok(()));
assert_eq!(con.get(&["key1", "key2"]), Ok((1, 2)));
} | rust_cleaned_test_functions.jsonl/108966 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 111
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27740,
717,
65148,
368,
341,
262,
1077,
5635,
284,
3393,
1972,
486,
931,
543,
262,
1077,
5206,
390,
284,
5635,
20310,
1428,
262,
2060,
10714,
10297,
443,
980,
45233,
2099,
58,
445,
792,
16,
497,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_statetable() {
let grm = YaccGrammar::new(
YaccKind::Original(YaccOriginalActionKind::GenericParseTree),
&"
%start Expr
%%
Expr : Term '-' Expr | Term;
Term : Factor '*' Term | Factor;
Factor : 'id';
"
).unwrap();
let sg = pager_stategraph(&grm);
assert_eq!(sg.all_states_len(), StIdx(9));
let s0 = StIdx(0);
let s1 = sg.edge(s0, Symbol::Rule(grm.rule_idx("Expr").unwrap())).unwrap();
let s2 = sg.edge(s0, Symbol::Rule(grm.rule_idx("Term").unwrap())).unwrap();
let s3 = sg.edge(s0, Symbol::Rule(grm.rule_idx("Factor").unwrap())).unwrap();
let s4 = sg.edge(s0, Symbol::Token(grm.token_idx("id").unwrap())).unwrap();
let s5 = sg.edge(s2, Symbol::Token(grm.token_idx("-").unwrap())).unwrap();
let s6 = sg.edge(s3, Symbol::Token(grm.token_idx("*").unwrap())).unwrap();
let s7 = sg.edge(s5, Symbol::Rule(grm.rule_idx("Expr").unwrap())).unwrap();
let s8 = sg.edge(s6, Symbol::Rule(grm.rule_idx("Term").unwrap())).unwrap();
let st = StateTable::new(&grm, &sg).unwrap();
// Actions
assert_eq!(st.actions.len(), 9*4);
let assert_reduce = |stidx: StIdx, tidx: TIdx<_>, rule: &str, prod_off: usize| {
let pidx = grm.rule_to_prods(grm.rule_idx(rule).unwrap())[prod_off];
assert_eq!(st.action(stidx, tidx), Action::Reduce(pidx));
};
assert_eq!(st.action(s0, grm.token_idx("id").unwrap()), Action::Shift(s4));
assert_eq!(st.action(s1, grm.eof_token_idx()), Action::Accept);
assert_eq!(st.final_state, s1);
assert_eq!(st.action(s2, grm.token_idx("-").unwrap()), Action::Shift(s5));
assert_reduce(s2, grm.eof_token_idx(), "Expr", 1);
assert_reduce(s3, grm.token_idx("-").unwrap(), "Term", 1);
assert_eq!(st.action(s3, grm.token_idx("*").unwrap()), Action::Shift(s6));
assert_reduce(s3, grm.eof_token_idx(), "Term", 1);
assert_reduce(s4, grm.token_idx("-").unwrap(), "Factor", 0);
assert_reduce(s4, grm.token_idx("*").unwrap(), "Factor", 0);
assert_reduce(s4, grm.eof_token_idx(), "Factor", 0);
assert_eq!(st.action(s5, grm.token_idx("id").unwrap()), Action::Shift(s4));
assert_eq!(st.action(s6, grm.token_idx("id").unwrap()), Action::Shift(s4));
assert_reduce(s7, grm.eof_token_idx(), "Expr", 0);
assert_reduce(s8, grm.token_idx("-").unwrap(), "Term", 0);
assert_reduce(s8, grm.eof_token_idx(), "Term", 0);
let mut s4_actions = HashSet::new();
s4_actions.extend(&[grm.token_idx("-").unwrap(),
grm.token_idx("*").unwrap(),
grm.eof_token_idx()]);
assert_eq!(st.state_actions(s4).collect::<HashSet<_>>(), s4_actions);
let s2_state_shifts = &[grm.token_idx("-").unwrap()]
.iter()
.cloned()
.collect::<HashSet<_>>();
assert_eq!(st.state_shifts(s2).collect::<HashSet<_>>(), *s2_state_shifts);
let s4_core_reduces = &[grm.rule_to_prods(grm.rule_idx("Factor").unwrap())[0]]
.iter()
.cloned()
.collect::<HashSet<_>>();
assert_eq!(st.core_reduces(s4).collect::<HashSet<_>>(), *s4_core_reduces);
// Gotos
assert_eq!(st.gotos.len(), 9*4);
assert_eq!(st.goto(s0, grm.rule_idx("Expr").unwrap()).unwrap(), s1);
assert_eq!(st.goto(s0, grm.rule_idx("Term").unwrap()).unwrap(), s2);
assert_eq!(st.goto(s0, grm.rule_idx("Factor").unwrap()).unwrap(), s3);
assert_eq!(st.goto(s5, grm.rule_idx("Expr").unwrap()).unwrap(), s7);
assert_eq!(st.goto(s5, grm.rule_idx("Term").unwrap()).unwrap(), s2);
assert_eq!(st.goto(s5, grm.rule_idx("Factor").unwrap()).unwrap(), s3);
assert_eq!(st.goto(s6, grm.rule_idx("Term").unwrap()).unwrap(), s8);
assert_eq!(st.goto(s6, grm.rule_idx("Factor").unwrap()).unwrap(), s3);
} | rust_cleaned_test_functions.jsonl/38019 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2270
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16271,
35064,
368,
341,
1789,
286,
1077,
1081,
76,
284,
809,
4475,
97178,
486,
931,
1006,
310,
809,
4475,
10629,
486,
18395,
20206,
4475,
18395,
2512,
10629,
486,
19964,
14463,
6533,
1326,
310,
60... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pipe_read_empty() {
let devpipe = Arc::new(Pipe::default());
task::spawn(async move {
let p = Chan::attach(devpipe, b"").await.unwrap();
let data = p.open(b"data", None).await.unwrap().unwrap();
let mut buf = [0; 10];
assert_eq!(data.read(&mut buf, 0).await.unwrap(), 0);
data.close().await;
p.close().await;
})
.unwrap();
task::run();
} | rust_cleaned_test_functions.jsonl/36086 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 254
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41862,
6443,
15124,
368,
341,
286,
1077,
3483,
13768,
284,
19689,
486,
931,
5304,
3444,
486,
2258,
1423,
286,
3383,
486,
46087,
18285,
3271,
341,
310,
1077,
281,
284,
41302,
486,
16330,
17622,
137... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_draw_flower_pot() {
let flower = draw_empty_space(7, 2, FlowerColor::WHITE);
let flower_pot = draw_pot(flower, Color::RgbLowRes(5, 5, 5));
assert_eq!(
flower_pot,
vec![
vec![
FlowerGlyphxel {
foreground_color: FlowerColor::LIGHT_BROWN,
background_color: FlowerColor::WHITE,
character: ' '
},
FlowerGlyphxel {
foreground_color: FlowerColor::LIGHT_BROWN,
background_color: FlowerColor::WHITE,
character: '\\'
},
FlowerGlyphxel {
foreground_color: FlowerColor::LIGHT_BROWN,
background_color: FlowerColor::WHITE,
character: '░'
},
FlowerGlyphxel {
foreground_color: FlowerColor::LIGHT_BROWN,
background_color: FlowerColor::WHITE,
character: '░'
},
FlowerGlyphxel {
foreground_color: FlowerColor::LIGHT_BROWN,
background_color: FlowerColor::WHITE,
character: '░'
},
FlowerGlyphxel {
foreground_color: FlowerColor::LIGHT_BROWN,
background_color: FlowerColor::WHITE,
character: '/'
},
FlowerGlyphxel {
foreground_color: FlowerColor::LIGHT_BROWN,
background_color: FlowerColor::WHITE,
character: ' '
},
],
vec![
FlowerGlyphxel {
foreground_color: FlowerColor::LIGHT_BROWN,
background_color: FlowerColor::WHITE,
character: '\\'
},
FlowerGlyphxel {
foreground_color: FlowerColor::LIGHT_BROWN,
background_color: FlowerColor::WHITE,
character: '░'
},
FlowerGlyphxel {
foreground_color: FlowerColor::LIGHT_BROWN,
background_color: FlowerColor::WHITE,
character: '░'
},
FlowerGlyphxel {
foreground_color: FlowerColor::LIGHT_BROWN,
background_color: FlowerColor::WHITE,
character: '░'
},
FlowerGlyphxel {
foreground_color: FlowerColor::LIGHT_BROWN,
background_color: FlowerColor::WHITE,
character: '░'
},
FlowerGlyphxel {
foreground_color: FlowerColor::LIGHT_BROWN,
background_color: FlowerColor::WHITE,
character: '░'
},
FlowerGlyphxel {
foreground_color: FlowerColor::LIGHT_BROWN,
background_color: FlowerColor::WHITE,
character: '/'
},
]
]
)
} | rust_cleaned_test_functions.jsonl/44031 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1964
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23021,
5081,
1202,
57952,
368,
341,
262,
1077,
22351,
284,
4038,
15124,
14663,
7,
22,
11,
220,
17,
11,
42686,
1636,
486,
56999,
317,
262,
1077,
22351,
57952,
284,
4038,
57952,
955,
14772,
11,
34... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vec3mask_bitmask() {
assert_eq!(Vec3AMask::new(false, false, false).bitmask(), 0b000);
assert_eq!(Vec3AMask::new(true, false, false).bitmask(), 0b001);
assert_eq!(Vec3AMask::new(false, true, true).bitmask(), 0b110);
assert_eq!(Vec3AMask::new(false, true, false).bitmask(), 0b010);
assert_eq!(Vec3AMask::new(true, false, true).bitmask(), 0b101);
assert_eq!(Vec3AMask::new(true, true, true).bitmask(), 0b111);
} | rust_cleaned_test_functions.jsonl/23494 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 204
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
18,
11258,
13996,
11258,
368,
341,
262,
2060,
10714,
10297,
10050,
18,
1402,
1073,
486,
931,
3576,
11,
895,
11,
895,
568,
4489,
11258,
1507,
220,
15,
65,
15,
15,
15,
317,
262,
2060,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_raw_ptr() {
let c = ffi::c_return_mut_ptr(2023);
let mut c_unique = unsafe { cxx::UniquePtr::from_raw(c) };
assert_eq!(2023, c_unique.pin_mut().set_succeed(2023).unwrap());
// c will be dropped as it's now in a UniquePtr
let c2 = ffi::c_return_mut_ptr(2024);
assert_eq!(2024, unsafe { ffi::c_take_const_ptr(c2) });
assert_eq!(2024, unsafe { ffi::c_take_mut_ptr(c2) }); // deletes c2
let c3 = ffi::c_return_const_ptr(2025);
assert_eq!(2025, unsafe { ffi::c_take_const_ptr(c3) });
assert_eq!(2025, unsafe { ffi::c_take_mut_ptr(c3 as *mut ffi::C) }); // deletes c3
} | rust_cleaned_test_functions.jsonl/50908 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 293
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16067,
4348,
368,
341,
262,
1077,
272,
284,
76956,
486,
66,
12511,
29523,
4348,
7,
17,
15,
17,
18,
317,
262,
1077,
5206,
272,
21218,
284,
19860,
314,
272,
4146,
486,
22811,
5348,
486,
1499,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_trie2() {
let mut trie = Trie::new();
trie.insert("emplacement".to_string());
trie.insert("emporia".to_string());
trie.insert("embowed".to_string());
assert!(!trie.search("em".to_string()));
} | rust_cleaned_test_functions.jsonl/113668 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3547,
645,
17,
368,
341,
286,
1077,
5206,
59067,
284,
62783,
486,
931,
543,
286,
59067,
7030,
445,
336,
16101,
3263,
983,
3904,
1423,
286,
59067,
7030,
445,
3262,
10782,
3263,
983,
3904,
1423,
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_positive_num_at_the_end() {
assert_eq!(Solution::max_sub_array(vec![-1, -2, -3, -4, 1]), 1);
} | rust_cleaned_test_functions.jsonl/47447 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 70
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54160,
4273,
3752,
16068,
6213,
368,
341,
286,
2060,
10714,
10297,
36842,
486,
2810,
5228,
3858,
25592,
0,
7609,
16,
11,
481,
17,
11,
481,
18,
11,
481,
19,
11,
220,
16,
9719,
220,
16,
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 |
#[test]
fn test_hover_infer_associated_const_in_pattern() {
check(
r#"
struct X;
impl X {
const C: u32 = 1;
}
fn main() {
match 1 {
X::C$0 => {},
2 => {},
_ => {}
};
}
"#,
expect![[r#"
*C*
```rust
test
```
```rust
const C: u32
```
"#]],
)
} | rust_cleaned_test_functions.jsonl/66637 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 316
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53445,
1243,
802,
58665,
657,
13610,
1243,
21260,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
1235,
1599,
280,
6383,
1599,
341,
262,
733,
356,
25,
575,
18,
17,
284,
220,
16,
280,
630,
8822,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_canonicalize_idents_by_stripping_trailing_url_slash() {
let ident1 = ident(&url("https://github.com/PistonDevelopers/piston/")).unwrap();
let ident2 = ident(&url("https://github.com/PistonDevelopers/piston")).unwrap();
assert_eq!(ident1, ident2);
} | rust_cleaned_test_functions.jsonl/21282 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27421,
22391,
551,
842,
805,
3710,
1261,
461,
10732,
3547,
14277,
2903,
11886,
988,
368,
341,
286,
1077,
3524,
16,
284,
3524,
2099,
1085,
445,
2428,
1110,
5204,
905,
16341,
58819,
20444,
388,
4322... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_string_split() -> Result<(), Box<EvalAltResult>> {
let engine = Engine::new();
assert_eq!(
engine.eval::<INT>(
r#"let x = "\u2764\u2764\u2764 hello! \u2764\u2764\u2764"; x.split(' ').len"#
)?,
3
);
assert_eq!(
engine.eval::<INT>(
r#"let x = "\u2764\u2764\u2764 hello! \u2764\u2764\u2764"; x.split("hello").len"#
)?,
2
);
Ok(())
} | rust_cleaned_test_functions.jsonl/21606 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 254
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
17052,
368,
1464,
5714,
68843,
8261,
23835,
831,
26017,
2077,
2452,
341,
262,
1077,
4712,
284,
8200,
486,
931,
1428,
262,
2060,
10714,
33673,
286,
4712,
31710,
27638,
3221,
17055,
310,
435,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_generate_wallet_from_seed_mainnet() {
let out_dir = std::env::var("OUT_DIR").unwrap();
let mut jscontext = JavaScript::new(format!("{}/xpring.js", out_dir))?;
let wallet = from_seed(
&mut jscontext,
"snYP7oArxKepd3GPDcrjMsJYiJeJB".to_owned(),
None,
false,
)
.unwrap();
assert_eq!(
wallet.address.unwrap(),
"XVnJMYQFqA8EAijpKh5EdjEY5JqyxykMKKSbrUX8uchF6U8"
);
} | rust_cleaned_test_functions.jsonl/118744 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 301
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48851,
62308,
5673,
33809,
11027,
4711,
368,
341,
286,
1077,
700,
4334,
284,
1460,
486,
3160,
486,
947,
445,
3656,
8291,
1827,
15454,
543,
286,
1077,
5206,
6994,
2147,
284,
12914,
486,
931,
20698,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_valid_size() {
use core::mem::size_of;
use structures::frame_store::FrameStoreNode;
assert!(size_of::<FrameStoreNode<::memory::Frame>>() as u64 <= ::memory::Frame::SIZE);
assert!(size_of::<FrameStoreNode<::memory::HugeFrame>>() as u64 <= ::memory::Frame::SIZE);
} | rust_cleaned_test_functions.jsonl/112392 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8337,
2368,
368,
341,
41819,
6200,
486,
10536,
486,
2141,
3575,
280,
41819,
14389,
486,
6763,
14809,
486,
4369,
6093,
1955,
280,
6948,
10297,
2141,
3575,
27638,
4369,
6093,
1955,
87398,
17269,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_revoke() {
let mut perms = Permissions {
read: UnaryPermission {
global_state: PermissionState::Prompt,
..Permissions::new_read(
&Some(vec![PathBuf::from("/foo"), PathBuf::from("/foo/baz")]),
false,
)
},
write: UnaryPermission {
global_state: PermissionState::Prompt,
..Permissions::new_write(
&Some(vec![PathBuf::from("/foo"), PathBuf::from("/foo/baz")]),
false,
)
},
net: UnaryPermission {
global_state: PermissionState::Prompt,
..Permissions::new_net(
&Some(svec!["127.0.0.1", "127.0.0.1:8000"]),
false,
)
},
env: UnaryPermission {
global_state: PermissionState::Prompt,
..Permissions::new_env(&Some(svec!["HOME"]), false)
},
run: UnaryPermission {
global_state: PermissionState::Prompt,
..Permissions::new_run(&Some(svec!["deno"]), false)
},
ffi: UnaryPermission {
global_state: PermissionState::Prompt,
..Permissions::new_ffi(&Some(svec!["deno"]), false)
},
hrtime: UnitPermission {
state: PermissionState::Denied,
..Default::default()
},
};
#[rustfmt::skip]
{
assert_eq!(perms.read.revoke(Some(Path::new("/foo/bar"))), PermissionState::Prompt);
assert_eq!(perms.read.query(Some(Path::new("/foo"))), PermissionState::Prompt);
assert_eq!(perms.read.query(Some(Path::new("/foo/baz"))), PermissionState::Granted);
assert_eq!(perms.write.revoke(Some(Path::new("/foo/bar"))), PermissionState::Prompt);
assert_eq!(perms.write.query(Some(Path::new("/foo"))), PermissionState::Prompt);
assert_eq!(perms.write.query(Some(Path::new("/foo/baz"))), PermissionState::Granted);
assert_eq!(perms.net.revoke(Some(&("127.0.0.1", Some(9000)))), PermissionState::Prompt);
assert_eq!(perms.net.query(Some(&("127.0.0.1", None))), PermissionState::Prompt);
assert_eq!(perms.net.query(Some(&("127.0.0.1", Some(8000)))), PermissionState::Granted);
assert_eq!(perms.env.revoke(Some(&"HOME".to_string())), PermissionState::Prompt);
assert_eq!(perms.run.revoke(Some(&"deno".to_string())), PermissionState::Prompt);
assert_eq!(perms.ffi.revoke(Some(&"deno".to_string())), PermissionState::Prompt);
assert_eq!(perms.hrtime.revoke(), PermissionState::Denied);
};
} | rust_cleaned_test_functions.jsonl/24816 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
7621,
368,
341,
262,
1077,
5206,
82282,
284,
53357,
341,
414,
1349,
25,
86951,
14966,
341,
286,
3644,
4387,
25,
18135,
1397,
486,
54615,
345,
286,
5241,
23851,
486,
931,
6443,
1006,
688,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_igmp_state_igmpv1_router_present_timer_expires() {
let mut s = IgmpGroupState::default();
let mut rng = new_rng(0);
s.join_group(&mut rng, time::Instant::now());
s.query_received(&mut rng, Duration::from_secs(0), time::Instant::now());
match s.get_inner() {
MemberState::Delaying(state) => {
assert!(state.get_protocol_specific().v1_router_present);
}
_ => panic!("Wrong State!"),
}
s.v1_router_present_timer_expired();
match s.get_inner() {
MemberState::Delaying(state) => {
assert!(!state.get_protocol_specific().v1_router_present);
}
_ => panic!("Wrong State!"),
}
s.query_received(&mut rng, Duration::from_secs(0), time::Instant::now());
s.report_received();
s.v1_router_present_timer_expired();
match s.get_inner() {
MemberState::Idle(state) => {
assert!(!state.get_protocol_specific().v1_router_present);
}
_ => panic!("Wrong State!"),
}
} | rust_cleaned_test_functions.jsonl/30900 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 585
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
343,
1307,
4387,
62,
343,
1307,
85,
16,
55587,
36976,
16255,
2702,
18968,
368,
341,
286,
1077,
5206,
274,
284,
38451,
1307,
2808,
1397,
486,
2258,
543,
286,
1077,
5206,
28422,
284,
501,
6684... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_write_ring_rollover() {
let mut t: Turbine<TestSlot> = Turbine::new(1024);
let e1 = t.ep_new().unwrap();
let _event_processor = t.ep_finalize(e1);
assert!(t.current_pos == 0);
//move our reader's cursor so we can rollover
t.cursors.get(1).unwrap().store(1);
for i in 1u64..1025 {
t.write(Slot::new());
assert!(t.current_pos == i);
}
t.write(Slot::new());
assert!(t.current_pos == 1025);
} | rust_cleaned_test_functions.jsonl/65714 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 269
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
34683,
62,
43684,
423,
368,
341,
286,
1077,
5206,
259,
25,
8705,
46561,
71273,
19877,
29,
284,
8705,
46561,
486,
931,
7,
16,
15,
17,
19,
317,
286,
1077,
384,
16,
284,
259,
33376,
5921,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_into_static_str() {
assert_eq!("RedRed", <&'static str>::from(Color::Red));
assert_eq!("blue", <&'static str>::from(Color::Blue { hue: 0 }));
assert_eq!("yellow", <&'static str>::from(Color::Yellow));
assert_eq!("RedRed", <&'static str>::from(&Color::Red));
assert_eq!("blue", <&'static str>::from(&Color::Blue { hue: 0 }));
assert_eq!("yellow", <&'static str>::from(&Color::Yellow));
assert_eq!("A", <&'static str>::from(Foo::A));
assert_eq!("C", <&'static str>::from(Foo::C(&17)));
assert_eq!("A", <&'static str>::from(Boo::A(17)));
assert_eq!("B", <&'static str>::from(Boo::B::<i32>));
assert_eq!("C", <&'static str>::from(Boo::C::<i32>(&17)));
assert_eq!("A", <&'static str>::from(Moo::A::<String>("aaa".into())));
assert_eq!("B", <&'static str>::from(Moo::B::<String>));
assert_eq!("C", <&'static str>::from(Moo::C::<String>(&17)));
} | rust_cleaned_test_functions.jsonl/47643 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 416
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45514,
25360,
2895,
368,
341,
262,
2060,
10714,
17223,
6033,
6033,
497,
366,
5,
6,
1978,
607,
6831,
1499,
15028,
486,
6033,
1106,
262,
2060,
10714,
17223,
12203,
497,
366,
5,
6,
1978,
607,
6831,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_FX07() {
// 0xFX07 - Store the current value of the delay timer in register VX
let opcode = 0xF007;
let mut vm = get_vm();
vm.delay_timer = 0x32;
vm.execute_instruction(decode_opcode(opcode), opcode);
assert_eq!(vm.v[0x0], vm.delay_timer);
} | rust_cleaned_test_functions.jsonl/264 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1400,
55,
15,
22,
368,
341,
262,
442,
220,
15,
9770,
55,
15,
22,
481,
9129,
279,
1482,
897,
315,
279,
7626,
9021,
304,
4161,
78177,
271,
262,
1077,
30028,
284,
220,
15,
9770,
15,
15,
22,
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_scan_error_after_some_results_returned() {
let exec = fuchsia_async::TestExecutor::new().unwrap();
let (mut sme, _mlme_strem, _time_stream) = create_sme(&exec);
let mut recv =
sme.on_scan_command(fidl_sme::ScanRequest::Passive(fidl_sme::PassiveScanRequest {}));
let mut bss = fake_fidl_bss_description!(Open, ssid: Ssid::try_from("foo").unwrap());
bss.bssid = [3; 6];
sme.on_mlme_event(fidl_mlme::MlmeEvent::OnScanResult {
result: fidl_mlme::ScanResult {
txn_id: 1,
timestamp_nanos: zx::Time::get_monotonic().into_nanos(),
bss,
},
});
let mut bss = fake_fidl_bss_description!(Open, ssid: Ssid::try_from("foo").unwrap());
bss.bssid = [4; 6];
sme.on_mlme_event(fidl_mlme::MlmeEvent::OnScanResult {
result: fidl_mlme::ScanResult {
txn_id: 1,
timestamp_nanos: zx::Time::get_monotonic().into_nanos(),
bss,
},
});
sme.on_mlme_event(fidl_mlme::MlmeEvent::OnScanEnd {
end: fidl_mlme::ScanEnd {
txn_id: 1,
code: fidl_mlme::ScanResultCode::CanceledByDriverOrFirmware,
},
});
// Scan results are lost when an error occurs.
assert_eq!(
recv.try_recv(),
Ok(Some(Err(fidl_mlme::ScanResultCode::CanceledByDriverOrFirmware)))
);
} | rust_cleaned_test_functions.jsonl/33064 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 834
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28857,
4096,
19844,
61855,
13576,
12511,
291,
368,
341,
286,
1077,
3883,
284,
282,
73391,
28346,
486,
2271,
25255,
486,
931,
1005,
15454,
543,
286,
1077,
320,
6984,
90467,
11,
716,
1014,
2660,
126... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_enrich_rank_0_tensor() {
let v = EventValue::Summary(SummaryValue(Box::new(Value::Tensor(pb::TensorProto {
dtype: pb::DataType::DtString.into(),
tensor_shape: Some(tensor_shape(&[])),
string_val: vec![Bytes::from_static(b"no scalars for you")],
..Default::default()
}))));
assert_eq!(
v.into_blob_sequence(&blank("myblobs", pb::DataClass::BlobSequence)),
Err(DataLoss)
);
} | rust_cleaned_test_functions.jsonl/6221 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 303
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6205,
13851,
20417,
62,
15,
23188,
368,
341,
310,
1077,
348,
284,
3665,
1130,
486,
19237,
3759,
372,
1534,
1130,
67758,
486,
931,
25346,
486,
25336,
76878,
486,
25336,
31549,
341,
394,
13231,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mint_initialize() {
new_test_ext().execute_with(|| {
assert_eq!(Pallet::<Test>::total_balance(ASSET_ID, &TO_ACCOUNT), INIT_AMOUNT);
Pallet::<Test>::mint_initialize(Origin::root(), TRANSFER_AMOUNT, TO_ACCOUNT)
.expect("mint_initialize should work");
assert_eq!(
Pallet::<Test>::total_balance(ASSET_ID, &TO_ACCOUNT),
INIT_AMOUNT + TRANSFER_AMOUNT
);
});
} | rust_cleaned_test_functions.jsonl/9172 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 173
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
396,
40889,
368,
341,
8638,
4452,
9927,
1005,
10257,
6615,
79453,
341,
197,
6948,
10714,
10297,
47,
7464,
27638,
2271,
6831,
5035,
29396,
7,
1911,
5884,
3450,
11,
609,
5207,
38831,
701,
29964... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_file_format() {
assert!(matches!(
get_file_format("test.GEOJSON", None),
Ok(InputFormat::GeoJson)
));
assert!(matches!(
get_file_format("test.geojson", Some("csv")),
Ok(InputFormat::Csv)
));
} | rust_cleaned_test_functions.jsonl/132994 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
2458,
8955,
368,
341,
286,
2060,
10297,
19914,
33673,
310,
633,
2458,
8955,
445,
1944,
1224,
6760,
5370,
497,
2240,
1326,
310,
7622,
29773,
4061,
486,
37344,
5014,
340,
286,
16518,
286,
2060... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rotate() {
let mut ship = Ship::new();
assert_eq!(ship.direction, Direction::East);
ship.rotate(RelDirection::Left, 270);
assert_eq!(ship.direction, Direction::South);
ship.rotate(RelDirection::Right, 90);
assert_eq!(ship.direction, Direction::West);
ship.rotate(RelDirection::Right, 180);
assert_eq!(ship.direction, Direction::East);
} | rust_cleaned_test_functions.jsonl/8905 | {
"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,
60834,
368,
341,
286,
1077,
5206,
8284,
284,
26803,
486,
931,
543,
286,
2060,
10714,
10297,
5270,
27621,
11,
18904,
486,
36340,
317,
286,
8284,
35944,
2785,
301,
9268,
486,
5415,
11,
220,
17,
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_batch_raft_cmd_request_builder() {
let max_batch_size = 1000.0;
let mut builder = BatchRaftCmdRequestBuilder::<KvTestEngine>::new(max_batch_size);
let mut q = Request::default();
let mut metric = RaftProposeMetrics::default();
let mut req = RaftCmdRequest::default();
req.set_admin_request(AdminRequest::default());
assert!(!builder.can_batch(&req, 0));
let mut req = RaftCmdRequest::default();
req.set_status_request(StatusRequest::default());
assert!(!builder.can_batch(&req, 0));
let mut req = RaftCmdRequest::default();
let mut put = PutRequest::default();
put.set_key(b"aaaa".to_vec());
put.set_value(b"bbbb".to_vec());
q.set_cmd_type(CmdType::Put);
q.set_put(put);
req.mut_requests().push(q.clone());
let _ = q.take_put();
let req_size = req.compute_size();
assert!(builder.can_batch(&req, req_size));
let mut req = RaftCmdRequest::default();
q.set_cmd_type(CmdType::Snap);
req.mut_requests().push(q.clone());
let mut put = PutRequest::default();
put.set_key(b"aaaa".to_vec());
put.set_value(b"bbbb".to_vec());
q.set_cmd_type(CmdType::Put);
q.set_put(put);
req.mut_requests().push(q.clone());
let req_size = req.compute_size();
assert!(!builder.can_batch(&req, req_size));
let mut req = RaftCmdRequest::default();
let mut put = PutRequest::default();
put.set_key(b"aaaa".to_vec());
put.set_value(vec![8 as u8; 2000]);
q.set_cmd_type(CmdType::Put);
q.set_put(put);
req.mut_requests().push(q.clone());
let req_size = req.compute_size();
assert!(!builder.can_batch(&req, req_size));
// Check batch callback
let mut req = RaftCmdRequest::default();
let mut put = PutRequest::default();
put.set_key(b"aaaa".to_vec());
put.set_value(vec![8 as u8; 20]);
q.set_cmd_type(CmdType::Put);
q.set_put(put);
req.mut_requests().push(q);
let mut cbs_flags = vec![];
let mut proposed_cbs_flags = vec![];
let mut committed_cbs_flags = vec![];
let mut response = RaftCmdResponse::default();
for i in 0..10 {
let flag = Arc::new(AtomicBool::new(false));
cbs_flags.push(flag.clone());
// Some commands don't have proposed_cb.
let proposed_cb: Option<ExtCallback> = if i % 2 == 0 {
let proposed_flag = Arc::new(AtomicBool::new(false));
proposed_cbs_flags.push(proposed_flag.clone());
Some(Box::new(move || {
proposed_flag.store(true, Ordering::Release);
}))
} else {
None
};
let committed_cb: Option<ExtCallback> = if i % 3 == 0 {
let committed_flag = Arc::new(AtomicBool::new(false));
committed_cbs_flags.push(committed_flag.clone());
Some(Box::new(move || {
committed_flag.store(true, Ordering::Release);
}))
} else {
None
};
let cb = Callback::write_ext(
Box::new(move |_resp| {
flag.store(true, Ordering::Release);
}),
proposed_cb,
committed_cb,
);
response.mut_responses().push(Response::default());
let cmd = RaftCommand::new(req.clone(), cb);
builder.add(cmd, 100);
}
let mut cmd = builder.build(&mut metric).unwrap();
cmd.callback.invoke_proposed();
for flag in proposed_cbs_flags {
assert!(flag.load(Ordering::Acquire));
}
cmd.callback.invoke_committed();
for flag in committed_cbs_flags {
assert!(flag.load(Ordering::Acquire));
}
assert_eq!(10, cmd.request.get_requests().len());
cmd.callback.invoke_with_response(response);
for flag in cbs_flags {
assert!(flag.load(Ordering::Acquire));
}
} | rust_cleaned_test_functions.jsonl/39383 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2094
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14534,
62,
2944,
11684,
7893,
28532,
368,
341,
286,
1077,
1932,
14534,
2368,
284,
220,
16,
15,
15,
15,
13,
15,
280,
286,
1077,
5206,
7363,
284,
33904,
55535,
723,
15613,
1900,
3297,
27638,
42,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 9 |
#[test]
fn test_exp() {
assert_eq!(1.0, 0.0f64.exp());
assert_approx_eq!(2.718282, 1.0f64.exp());
assert_approx_eq!(148.413159, 5.0f64.exp());
let inf: f64 = INFINITY;
let neg_inf: f64 = NEG_INFINITY;
let nan: f64 = NAN;
assert_eq!(inf, inf.exp());
assert_eq!(0.0, neg_inf.exp());
assert!(nan.exp().is_nan());
} | rust_cleaned_test_functions.jsonl/7839 | {
"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,
14214,
368,
341,
286,
2060,
10714,
10297,
16,
13,
15,
11,
220,
15,
13,
15,
69,
21,
19,
13754,
1423,
286,
2060,
90425,
10714,
10297,
17,
13,
22,
16,
23,
17,
23,
17,
11,
220,
16,
13,
15,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_shred_reference_tick() {
let keypair = Arc::new(Keypair::new());
let slot = 1;
let parent_slot = 0;
let shredder = Shredder::new(slot, parent_slot, 0.0, keypair.clone(), 5, 0)
.expect("Failed in creating shredder");
let entries: Vec<_> = (0..5)
.map(|_| {
let keypair0 = Keypair::new();
let keypair1 = Keypair::new();
let tx0 =
system_transaction::transfer(&keypair0, &keypair1.pubkey(), 1, Hash::default());
Entry::new(&Hash::default(), 1, vec![tx0])
})
.collect();
let data_shreds = shredder.entries_to_shreds(&entries, true, 0).0;
data_shreds.iter().for_each(|s| {
assert_eq!(s.reference_tick(), 5);
assert_eq!(Shred::reference_tick_from_data(&s.payload), 5);
});
let deserialized_shred =
Shred::new_from_serialized_shred(data_shreds.last().unwrap().payload.clone()).unwrap();
assert_eq!(deserialized_shred.reference_tick(), 5);
} | rust_cleaned_test_functions.jsonl/28193 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 568
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3712,
1151,
25433,
43612,
368,
341,
286,
1077,
1376,
12670,
284,
19689,
486,
931,
7,
6608,
1082,
1310,
486,
931,
1423,
286,
1077,
9446,
284,
220,
16,
401,
286,
1077,
2681,
27563,
284,
220,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_accounts_db_cache_clean_max_root_with_cache_limit_hit() {
let requested_flush_root = 5;
// will be flushed
run_test_accounts_db_cache_clean_max_root(
MAX_CACHE_SLOTS + requested_flush_root as usize + 2,
requested_flush_root,
None,
);
} | rust_cleaned_test_functions.jsonl/1423 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 177
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55665,
8685,
11529,
19573,
6345,
12993,
6615,
11529,
14763,
37697,
368,
341,
286,
1077,
11223,
39213,
12993,
284,
220,
20,
280,
1789,
286,
442,
686,
387,
73720,
198,
286,
1598,
4452,
55665,
8685,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_last_expr() {
check(
r#"
macro_rules! vec {
($($item:expr),*) => {{
let mut v = Vec::new();
$( v.push($item); )*
v
}};
}
fn f() {
vec![1,2,3];
}
"#,
expect![[r#"
macro_rules! vec {
($($item:expr),*) => {{
let mut v = Vec::new();
$( v.push($item); )*
v
}};
}
fn f() {
{
let mut v = Vec::new();
v.push(1);
v.push(2);
v.push(3);
v
};
}
"#]],
);
} | rust_cleaned_test_functions.jsonl/85225 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 339
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12195,
21915,
368,
341,
262,
1779,
1006,
286,
435,
2,
698,
32606,
21407,
0,
7486,
341,
262,
1711,
699,
1203,
96011,
701,
3764,
589,
80505,
310,
1077,
5206,
348,
284,
11312,
486,
931,
543,
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_pow() {
let cases = vec![
(
Some(Real::new(1.0f64).unwrap()),
Some(Real::new(3.0f64).unwrap()),
Some(Real::new(1.0f64).unwrap()),
),
(
Some(Real::new(3.0f64).unwrap()),
Some(Real::new(0.0f64).unwrap()),
Some(Real::new(1.0f64).unwrap()),
),
(
Some(Real::new(2.0f64).unwrap()),
Some(Real::new(4.0f64).unwrap()),
Some(Real::new(16.0f64).unwrap()),
),
(
Some(Real::new(f64::INFINITY).unwrap()),
Some(Real::new(0.0f64).unwrap()),
Some(Real::new(1.0f64).unwrap()),
),
(Some(Real::new(4.0f64).unwrap()), None, None),
(None, Some(Real::new(4.0f64).unwrap()), None),
(None, None, None),
];
for (lhs, rhs, expect) in cases {
let output: Option<Real> = RpnFnScalarEvaluator::new()
.push_param(lhs)
.push_param(rhs)
.evaluate(ScalarFuncSig::Pow)
.unwrap();
assert_eq!(output, expect);
}
let invalid_cases = vec![
(
Some(Real::new(f64::INFINITY).unwrap()),
Some(Real::new(f64::INFINITY).unwrap()),
),
(
Some(Real::new(0.0f64).unwrap()),
Some(Real::new(-9999999.0f64).unwrap()),
),
];
for (lhs, rhs) in invalid_cases {
assert!(
RpnFnScalarEvaluator::new()
.push_param(lhs)
.push_param(rhs)
.evaluate::<Real>(ScalarFuncSig::Pow)
.is_err()
);
}
} | rust_cleaned_test_functions.jsonl/9494 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1217
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56183,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
2399,
394,
4329,
7,
12768,
486,
931,
7,
16,
13,
15,
69,
21,
19,
568,
15454,
14702,
394,
4329,
7,
12768,
486,
931,
7,
18,
13,
15,
69... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_get_supported_cpuid() {
let kvm = Kvm::new().unwrap();
let mut cpuid = kvm.get_supported_cpuid(KVM_MAX_CPUID_ENTRIES).unwrap();
let cpuid_entries = cpuid.as_mut_slice();
assert!(!cpuid_entries.is_empty());
assert!(cpuid_entries.len() <= KVM_MAX_CPUID_ENTRIES);
// Test case for more than MAX entries
let cpuid_err = kvm.get_emulated_cpuid(KVM_MAX_CPUID_ENTRIES + 1 as usize);
assert!(cpuid_err.is_err());
} | rust_cleaned_test_functions.jsonl/127390 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 241
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
57885,
39811,
2423,
368,
341,
286,
1077,
94748,
284,
730,
7338,
486,
931,
1005,
15454,
543,
286,
1077,
5206,
12490,
2423,
284,
94748,
670,
57885,
39811,
2423,
16738,
11187,
6806,
29741,
915,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_success() -> Result<(), Box<dyn Error>> {
test_successful(MkvDimensionsExtractor, "video/rust-logo-blk.mkv", Some(Dimensions { width: 144, height: 144 }))
} | rust_cleaned_test_functions.jsonl/83139 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 80
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18632,
368,
1464,
5714,
68843,
8261,
92846,
4600,
2452,
341,
286,
1273,
92951,
3189,
43408,
21351,
56118,
11,
330,
9986,
7382,
590,
33797,
16278,
74,
35011,
85,
497,
4329,
5432,
318,
4664,
314,
23... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_cellbase_ckb_codec() {
let cellbase = CellbaseCkb::new(
RationalU256::new(mock_u256(), mock_u256()),
Capacity::shannons(random::<u64>()),
);
let bytes = bincode::serialize(&cellbase).unwrap();
assert_eq!(
bincode::deserialize::<CellbaseCkb>(&bytes).unwrap(),
cellbase
);
} | rust_cleaned_test_functions.jsonl/130624 | {
"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,
16648,
3152,
89236,
65,
51084,
368,
341,
286,
1077,
2779,
3152,
284,
13972,
3152,
34,
21310,
486,
931,
1006,
310,
54525,
52,
17,
20,
21,
486,
931,
30389,
7300,
17,
20,
21,
1507,
7860,
7300,
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_function_declaration_invalid_newline_in_declaration() {
let mut p = make_parser("function\nname() { echo body; }");
assert_eq!(
Err(Unexpected(Token::Newline, src(8, 1, 9))),
p.function_declaration()
);
let mut p = make_parser("function name\n() { echo body; }");
assert_eq!(
Err(Unexpected(Token::ParenClose, src(15, 2, 2))),
p.function_declaration()
);
} | rust_cleaned_test_functions.jsonl/69865 | {
"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,
9174,
77926,
31433,
5921,
1056,
1243,
77926,
368,
341,
262,
1077,
5206,
281,
284,
1281,
18517,
445,
1688,
1699,
606,
368,
314,
1687,
2487,
26,
335,
797,
262,
2060,
10714,
33673,
286,
15495,
7,
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_strip_unc_prefix() {
run_test(r"C:\", r"C:\");
run_test(r"C:\test\file.txt", r"C:\test\file.txt");
run_test(r"\\?\C:\", r"C:\");
run_test(r"\\?\C:\test\file.txt", r"C:\test\file.txt");
run_test(r"\\.\C:\", r"\\.\C:\");
run_test(r"\\.\C:\Test\file.txt", r"\\.\C:\Test\file.txt");
run_test(r"\\?\UNC\localhost\", r"\\localhost");
run_test(r"\\?\UNC\localhost\c$\", r"\\localhost\c$");
run_test(
r"\\?\UNC\localhost\c$\Windows\file.txt",
r"\\localhost\c$\Windows\file.txt",
);
run_test(r"\\?\UNC\wsl$\deno.json", r"\\wsl$\deno.json");
run_test(r"\\?\server1", r"\\server1");
run_test(r"\\?\server1\e$\", r"\\server1\e$\");
run_test(
r"\\?\server1\e$\test\file.txt",
r"\\server1\e$\test\file.txt",
);
fn run_test(input: &str, expected: &str) {
assert_eq!(
strip_unc_prefix(PathBuf::from(input)),
PathBuf::from(expected)
);
}
} | rust_cleaned_test_functions.jsonl/79113 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 516
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66130,
76576,
13974,
368,
341,
262,
1598,
4452,
2601,
46316,
7190,
497,
435,
46316,
7190,
797,
262,
1598,
4452,
2601,
46316,
7190,
1944,
59,
1192,
3909,
497,
435,
46316,
7190,
1944,
59,
1192,
3909... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_address_manager_validate_address() {
let socket = SocketAddr::from_str("127.0.0.1:8444").expect("bad address format");
let address = Address::new(
&socket,
ServiceFlags::NETWORK | ServiceFlags::NETWORK_LIMITED,
);
assert!(validate_address(&address));
let address = Address::new(&socket, ServiceFlags::NETWORK_LIMITED);
assert!(!validate_address(&address));
} | rust_cleaned_test_functions.jsonl/10128 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 197
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6744,
12144,
42681,
6744,
368,
341,
286,
1077,
7575,
284,
20954,
13986,
486,
1499,
2895,
445,
16,
17,
22,
13,
15,
13,
15,
13,
16,
25,
23,
19,
19,
19,
1827,
17119,
445,
13855,
2621,
3561,
797... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.