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_nested_loops() {
assert::pass(
r#"
def foo(y):
for x in [1,2,3,4]:
if x == 3:
return y
def bar(xs):
res = []
for x in xs:
if type(x) == type(1):
fail("Type confusion")
res.append(foo(x))
assert_eq(xs, res)
bar(["a","b","c"])
"#,
);
} | rust_cleaned_test_functions.jsonl/92449 | {
"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,
66279,
5560,
3721,
368,
341,
1066,
262,
2060,
486,
6385,
1006,
286,
435,
2,
698,
750,
15229,
7021,
982,
262,
369,
856,
304,
508,
16,
11,
17,
11,
18,
11,
19,
10343,
286,
421,
856,
621,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_response_timeout() {
let server = server! {
request: b"\
GET /response-timeout HTTP/1.1\r\n\
Host: $HOST\r\n\
User-Agent: $USERAGENT\r\n\
Accept: */*\r\n\
Accept-Encoding: gzip\r\n\
\r\n\
",
response: b"\
HTTP/1.1 200 OK\r\n\
Content-Length: 0\r\n\
",
response_timeout: Duration::from_secs(1)
};
let url = format!("http://{}/response-timeout", server.addr());
let err = reqwest::Client::builder()
.timeout(Duration::from_millis(500))
.build()
.unwrap()
.get(&url)
.send()
.unwrap_err();
assert_eq!(err.get_ref().unwrap().to_string(), "timed out");
assert_eq!(err.url().map(|u| u.as_str()), Some(url.as_str()));
} | rust_cleaned_test_functions.jsonl/28042 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 470
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9655,
20537,
368,
341,
262,
1077,
3538,
284,
3538,
0,
341,
286,
1681,
25,
293,
83383,
310,
7890,
608,
2322,
7246,
411,
10130,
14,
16,
13,
16,
12016,
1699,
5661,
310,
16102,
25,
400,
28687,
120... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_empty_no_response() {
assert_eq!(
*LookupFuture::lookup(
vec![Name::root()],
RecordType::A,
DnsRequestOptions::default(),
CachingClient::new(0, mock(vec![empty()])),
)
.wait()
.unwrap_err()
.kind(),
ResolveErrorKind::NoRecordsFound {
query: Query::query(Name::root(), RecordType::A),
valid_until: None,
}
);
} | rust_cleaned_test_functions.jsonl/122939 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 318
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
6536,
9655,
368,
341,
286,
2060,
10714,
33673,
310,
353,
34247,
24206,
486,
21020,
1006,
394,
7486,
20703,
675,
486,
2888,
73845,
394,
13583,
929,
486,
32,
345,
394,
422,
4412,
1900,
3798,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ethernet_frame() {
let mut a = [0u8; 10000];
let mut bad_array = [0u8; 1];
let dst_mac = MacAddr::parse_str("01:23:45:67:89:ab").unwrap();
let src_mac = MacAddr::parse_str("cd:ef:01:23:45:67").unwrap();
let ethertype = 1289;
assert_eq!(
EthernetFrame::from_bytes(bad_array.as_ref()).unwrap_err(),
Error::SliceTooShort
);
assert_eq!(
EthernetFrame::new_with_header(bad_array.as_mut(), dst_mac, src_mac, ethertype)
.unwrap_err(),
Error::SliceTooShort
);
{
let mut f1 =
EthernetFrame::new_with_header(a.as_mut(), dst_mac, src_mac, ethertype).unwrap();
assert_eq!(f1.dst_mac(), dst_mac);
assert_eq!(f1.src_mac(), src_mac);
assert_eq!(f1.ethertype(), ethertype);
f1.payload_mut()[1] = 132;
}
{
let f2 = EthernetFrame::from_bytes(a.as_ref()).unwrap();
assert_eq!(f2.dst_mac(), dst_mac);
assert_eq!(f2.src_mac(), src_mac);
assert_eq!(f2.ethertype(), ethertype);
assert_eq!(f2.payload()[1], 132);
assert_eq!(f2.len(), f2.bytes.len());
}
{
let f3 =
EthernetFrame::write_incomplete(a.as_mut(), dst_mac, src_mac, ethertype).unwrap();
let f3_complete = f3.with_payload_len_unchecked(123);
assert_eq!(f3_complete.len(), f3_complete.payload_offset() + 123);
}
} | rust_cleaned_test_functions.jsonl/58598 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 856
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57757,
13845,
8929,
368,
341,
286,
1077,
5206,
264,
284,
508,
15,
84,
23,
26,
220,
16,
15,
15,
15,
15,
935,
286,
1077,
5206,
3873,
3858,
284,
508,
15,
84,
23,
26,
220,
16,
4821,
286,
1077,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_as_bytes() {
let gil = Python::acquire_gil();
let py = gil.python();
let src = b"Hello Python";
let bytearray = PyByteArray::new(py, src);
let slice = unsafe { bytearray.as_bytes() };
assert_eq!(src, slice);
assert_eq!(bytearray.data() as *const _, slice.as_ptr());
} | rust_cleaned_test_functions.jsonl/60114 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 170
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
12524,
368,
341,
286,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
286,
1077,
4510,
284,
342,
321,
43193,
1428,
286,
1077,
2286,
284,
293,
1,
9707,
13027,
876,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fold_object_spread() {
fold("x = {...{}}", "x = {}");
fold("x = {a, ...{}, b}", "x = {a, b}");
fold("x = {...{a, b}, c, ...{d, e}}", "x = {a, b, c, d, e}");
fold("x = {...{...{a}, b}, c}", "x = {a, b, c}");
fold_same("({...{x}} = obj)");
} | rust_cleaned_test_functions.jsonl/122200 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
61187,
5314,
10123,
878,
368,
341,
262,
11555,
445,
87,
284,
14916,
90,
3417,
497,
330,
87,
284,
4687,
797,
262,
11555,
445,
87,
284,
314,
64,
11,
2503,
22655,
293,
9545,
330,
87,
284,
314,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_db_path_from_option() {
let mut opts = DBOptions::new();
opts.create_if_missing(true);
let dir = tempdir_with_prefix("_rust_rocksdb_get_db_path_from_option");
let path = dir.path().to_str().unwrap();
let db = DB::open(opts, path).unwrap();
let path_num = db.get_db_options().get_db_paths_num();
assert_eq!(1, path_num);
let first_path = db.get_db_options().get_db_path(0).unwrap();
assert_eq!(path, first_path.as_str());
} | rust_cleaned_test_functions.jsonl/36967 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
8685,
2638,
5673,
9672,
368,
341,
286,
1077,
5206,
12185,
284,
5952,
3798,
486,
931,
543,
286,
12185,
2520,
11119,
40447,
3715,
317,
286,
1077,
5419,
284,
2730,
3741,
6615,
13974,
16975,
357... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bad_bank_hash() {
use solana_sdk::signature::{Keypair, Signer};
let db = AccountsDB::new(Vec::new());
let some_slot: Slot = 0;
let ancestors = vec![(some_slot, 0)].into_iter().collect();
for _ in 0..10_000 {
let num_accounts = thread_rng().gen_range(0, 100);
let accounts_keys: Vec<_> = (0..num_accounts)
.into_iter()
.map(|_| {
let key = Keypair::new().pubkey();
let lamports = thread_rng().gen_range(0, 100);
let some_data_len = thread_rng().gen_range(0, 1000);
let account = Account::new(lamports, some_data_len, &key);
(key, account)
})
.collect();
let account_refs: Vec<_> = accounts_keys
.iter()
.map(|(key, account)| (key, account))
.collect();
db.store(some_slot, &account_refs);
for (key, account) in &accounts_keys {
let loaded_account = db.load_slow(&ancestors, key).unwrap().0;
assert_eq!(
loaded_account.hash,
AccountsDB::hash_account(some_slot, &account, &key)
);
}
}
} | rust_cleaned_test_functions.jsonl/33694 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 750
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34199,
35733,
8950,
368,
341,
286,
990,
2048,
3362,
61783,
486,
34140,
22964,
6608,
1082,
1310,
11,
7075,
261,
2440,
286,
1077,
2927,
284,
40655,
3506,
486,
931,
49923,
486,
931,
5231,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_service() {
let mut srv = init_service(
App::new().service(web::service("/test").name("test").finish(
|req: ServiceRequest| req.into_response(HttpResponse::Ok().finish()),
)),
);
let req = TestRequest::with_uri("/test").to_request();
let resp = call_service(&mut srv, req);
assert_eq!(resp.status(), http::StatusCode::OK);
let mut srv = init_service(
App::new().service(web::service("/test").guard(guard::Get()).finish(
|req: ServiceRequest| req.into_response(HttpResponse::Ok().finish()),
)),
);
let req = TestRequest::with_uri("/test")
.method(http::Method::PUT)
.to_request();
let resp = call_service(&mut srv, req);
assert_eq!(resp.status(), http::StatusCode::NOT_FOUND);
} | rust_cleaned_test_functions.jsonl/83091 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 420
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12267,
368,
341,
286,
1077,
5206,
43578,
284,
2930,
12267,
1006,
310,
1845,
486,
931,
1005,
7936,
39769,
486,
7936,
4283,
1944,
1827,
606,
445,
1944,
1827,
30150,
1006,
394,
760,
2958,
25,
5362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rebase_descendants_rewrite_resolves_branch_conflict() {
let settings = testutils::user_settings();
let test_repo = testutils::init_repo(&settings, false);
let repo = &test_repo.repo;
// Branch "main" is a conflict removing ancestor commit A and adding commit B
// and C (maybe it moved forward to B locally and moved forward to C
// resolved to B2.
let mut tx = repo.start_transaction("test");
let mut graph_builder = CommitGraphBuilder::new(&settings, tx.mut_repo());
let commit_a = graph_builder.initial_commit();
let commit_b = graph_builder.commit_with_parents(&[&commit_a]);
let commit_c = graph_builder.commit_with_parents(&[&commit_a]);
tx.mut_repo().set_local_branch(
"main".to_string(),
RefTarget::Conflict {
removes: vec![commit_a.id().clone()],
adds: vec![commit_b.id().clone(), commit_c.id().clone()],
},
);
let repo = tx.commit();
let mut tx = repo.start_transaction("test");
let commit_b2 = CommitBuilder::for_rewrite_from(&settings, repo.store(), &commit_b)
.set_parents(vec![commit_c.id().clone()])
.write_to_repo(tx.mut_repo());
tx.mut_repo().rebase_descendants(&settings);
assert_eq!(
tx.mut_repo().get_local_branch("main"),
Some(RefTarget::Normal(commit_b2.id().clone()))
);
assert_eq!(
*tx.mut_repo().view().heads(),
hashset! { commit_b2.id().clone()}
);
} | rust_cleaned_test_functions.jsonl/130814 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 632
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
3152,
10986,
28310,
74052,
4918,
18186,
28031,
16059,
21242,
368,
341,
262,
1077,
5003,
284,
1273,
6031,
486,
872,
10853,
543,
262,
1077,
1273,
37784,
284,
1273,
6031,
486,
2327,
37784,
2099,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_block_time() {
let bob_pubkey = Pubkey::new_rand();
let base_timestamp = 1_576_183_541;
let RpcHandler {
io,
meta,
bank,
block_commitment_cache,
..
} = start_rpc_handler_with_tx_and_blockstore(
&bob_pubkey,
vec![1, 2, 3, 4, 5, 6, 7],
base_timestamp,
);
block_commitment_cache
.write()
.unwrap()
.set_largest_confirmed_root(7);
let slot_duration = slot_duration_from_slots_per_year(bank.slots_per_year());
let slot = 2;
let req = format!(
r#"{{"jsonrpc":"2.0","id":1,"method":"getBlockTime","params":[{}]}}"#,
slot
);
let res = io.handle_request_sync(&req, meta.clone());
let expected = format!(r#"{{"jsonrpc":"2.0","result":{},"id":1}}"#, base_timestamp);
let expected: Response =
serde_json::from_str(&expected).expect("expected response deserialization");
let result: Response = serde_json::from_str(&res.expect("actual response"))
.expect("actual response deserialization");
assert_eq!(expected, result);
let slot = 7;
let req = format!(
r#"{{"jsonrpc":"2.0","id":1,"method":"getBlockTime","params":[{}]}}"#,
slot
);
let res = io.handle_request_sync(&req, meta.clone());
let expected = format!(
r#"{{"jsonrpc":"2.0","result":{},"id":1}}"#,
base_timestamp + (5 * slot_duration).as_secs() as i64
);
let expected: Response =
serde_json::from_str(&expected).expect("expected response deserialization");
let result: Response = serde_json::from_str(&res.expect("actual response"))
.expect("actual response deserialization");
assert_eq!(expected, result);
let slot = 12345;
let req = format!(
r#"{{"jsonrpc":"2.0","id":1,"method":"getBlockTime","params":[{}]}}"#,
slot
);
let res = io.handle_request_sync(&req, meta);
let expected = r#"{"jsonrpc":"2.0","result":null,"id":1}"#;
let expected: Response =
serde_json::from_str(&expected).expect("expected response deserialization");
let result: Response = serde_json::from_str(&res.expect("actual response"))
.expect("actual response deserialization");
assert_eq!(expected, result);
} | rust_cleaned_test_functions.jsonl/14456 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1222
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
7113,
3009,
368,
341,
286,
1077,
35192,
34014,
792,
284,
22611,
792,
486,
931,
33864,
543,
286,
1077,
2331,
23073,
284,
220,
16,
62,
20,
22,
21,
62,
16,
23,
18,
62,
20,
19,
16,
280,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_loop_backedges_two() {
let mir_body = switchint_loop_then_inner_loop_else_break();
let basic_coverage_blocks = graph::CoverageGraph::from_mir(&mir_body);
let backedges = graph::find_loop_backedges(&basic_coverage_blocks);
assert_eq!(
backedges.iter_enumerated().map(|(_bcb, backedges)| backedges.len()).sum::<usize>(),
2,
"backedges: {:?}",
backedges
);
let_bcb!(1);
let_bcb!(4);
let_bcb!(5);
let_bcb!(6);
assert_eq!(backedges[bcb1], vec![bcb5]);
assert_eq!(backedges[bcb4], vec![bcb6]);
} | rust_cleaned_test_functions.jsonl/68935 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 284
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
17198,
3895,
16900,
23241,
368,
341,
262,
1077,
8652,
14114,
284,
3398,
396,
17198,
68367,
34345,
17198,
62628,
39494,
543,
262,
1077,
6770,
73384,
25201,
284,
4771,
486,
66312,
11212,
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... | 1 |
#[test]
fn test_varlist_get_variants_range2() {
let vlst = generate_test_lst1();
let t = 1;
let c: String = "chr1".to_string();
let p1 = 0;
let p2 = 3000;
let interval = GenomicInterval {
tid: t,
chrom: c,
start_pos: p1,
end_pos: p2,
};
let vars = vlst.get_variants_range(interval).unwrap();
let mut exp: Vec<Var> = vec![];
exp.push(generate_var1(6, 1, 5, "A".to_string(), "G".to_string()));
exp.push(generate_var1(7, 1, 1000, "T".to_string(), "A".to_string()));
exp.push(generate_var1(8, 1, 2005, "T".to_string(), "G".to_string()));
exp.push(generate_var1(9, 1, 2900, "C".to_string(), "G".to_string()));
assert!(pos_alleles_eq(vars, exp));
} | rust_cleaned_test_functions.jsonl/25104 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 440
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4612,
1607,
3062,
4612,
62278,
9698,
17,
368,
341,
286,
1077,
348,
36687,
284,
6923,
4452,
31983,
16,
543,
286,
1077,
259,
284,
220,
16,
280,
286,
1077,
272,
25,
923,
284,
330,
16789,
16,
3263... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vanished() {
match parse_response(b"* VANISHED (EARLIER) 1,2,3:8\r\n") {
Ok((_, Response::Vanished { earlier, uids })) => {
assert_eq!(earlier, true);
assert_eq!(uids.len(), 3);
let v = &uids[0];
assert_eq!(*v.start(), 1);
assert_eq!(*v.end(), 1);
let v = &uids[1];
assert_eq!(*v.start(), 2);
assert_eq!(*v.end(), 2);
let v = &uids[2];
assert_eq!(*v.start(), 3);
assert_eq!(*v.end(), 8);
}
rsp => panic!("Unexpected response: {:?}", rsp),
}
match parse_response(b"* VANISHED 1,2,3:8,10\r\n") {
Ok((_, Response::Vanished { earlier, uids })) => {
assert_eq!(earlier, false);
assert_eq!(uids.len(), 4);
}
rsp => panic!("Unexpected response: {:?}", rsp),
}
match parse_response(b"* VANISHED (EARLIER) 1\r\n") {
Ok((_, Response::Vanished { earlier, uids })) => {
assert_eq!(earlier, true);
assert_eq!(uids.len(), 1);
assert_eq!(uids[0].clone().collect::<Vec<u32>>(), vec![1]);
}
rsp => panic!("Unexpected response: {:?}", rsp),
}
match parse_response(b"* VANISHED 1\r\n") {
Ok((_, Response::Vanished { earlier, uids })) => {
assert_eq!(earlier, false);
assert_eq!(uids.len(), 1);
}
rsp => panic!("Unexpected response: {:?}", rsp),
}
assert!(parse_response(b"* VANISHED \r\n").is_err());
assert!(parse_response(b"* VANISHED (EARLIER) \r\n").is_err());
} | rust_cleaned_test_functions.jsonl/24546 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 875
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
276,
3304,
368,
341,
262,
2432,
4715,
9655,
1883,
61593,
96653,
38879,
320,
20535,
43,
16289,
8,
220,
16,
11,
17,
11,
18,
25,
23,
12016,
1699,
899,
341,
286,
7622,
1188,
6878,
5949,
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... | 5 |
#[test]
fn test_string_as_signed_real() {
test_none_with_ctx_and_extra(cast_string_as_signed_real);
let ul = UNSPECIFIED_LENGTH;
let cs: Vec<(String, f64, isize, isize, bool, bool)> = vec![
// no special flen and decimal
(String::from("99999999"), 99999999f64, ul, ul, false, false),
(String::from("1234abc"), 1234f64, ul, ul, true, false),
(String::from("-1234abc"), -1234f64, ul, ul, true, false),
(
(0..400).map(|_| '9').collect::<String>(),
f64::MAX,
ul,
ul,
true,
false,
),
(
(0..401)
.map(|x| if x == 0 { '-' } else { '9' })
.collect::<String>(),
f64::MIN,
ul,
ul,
true,
false,
),
// with special flen and decimal
(String::from("99999999"), 99999999f64, 8, 0, false, false),
(String::from("99999999"), 99999999f64, 9, 0, false, false),
(String::from("99999999"), 9999999f64, 7, 0, false, true),
(String::from("99999999"), 999999.99, 8, 2, false, true),
(String::from("1234abc"), 0.9f64, 1, 1, true, true),
(String::from("-1234abc"), -0.9f64, 1, 1, true, true),
];
for (input, expect, flen, decimal, truncated, overflow) in cs {
let mut ctx = make_ctx_about_overflow_truncate_should_clip_to_zero(true, true, false);
let ia = make_implicit_args(false);
let rft = make_ret_field_type_2(false, flen, decimal);
let extra = make_extra(&rft, &ia);
let r = cast_string_as_signed_real(&mut ctx, &extra, &Some(input.clone().into_bytes()));
let r = r.map(|x| x.map(|x| x.into_inner()));
let log = format!(
"input: {}, expect: {}, flen: {}, decimal: {}, expect_truncated: {}, expect_overflow: {}",
input.as_str(), expect, flen, decimal, truncated, overflow
);
check_result(Some(&expect), &r, log.as_str());
match (truncated, overflow) {
(true, true) => {
assert_eq!(ctx.warnings.warning_cnt, 2, "{}", log.as_str());
let a = ctx.warnings.warnings[0].get_code();
let b = ctx.warnings.warnings[1].get_code();
let (a, b) = if a > b { (b, a) } else { (a, b) };
assert_eq!(a, ERR_TRUNCATE_WRONG_VALUE, "{}", log.as_str());
assert_eq!(b, ERR_DATA_OUT_OF_RANGE, "{}", log.as_str());
}
(true, false) => check_warning(&ctx, Some(ERR_TRUNCATE_WRONG_VALUE), log.as_str()),
(false, true) => check_overflow(&ctx, true, log.as_str()),
_ => (),
}
}
} | rust_cleaned_test_functions.jsonl/101778 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1674
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
11898,
55617,
15266,
368,
341,
286,
1273,
31488,
6615,
15147,
8378,
31858,
1337,
559,
3904,
11898,
55617,
15266,
626,
286,
1077,
8557,
284,
45983,
10943,
27320,
15023,
280,
286,
1077,
10532,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_load_instruction_at_checked() {
let instruction1 = Instruction::new_with_bincode(
Pubkey::new_unique(),
&0,
vec![AccountMeta::new(Pubkey::new_unique(), false)],
);
let instruction2 = Instruction::new_with_bincode(
Pubkey::new_unique(),
&0,
vec![AccountMeta::new(Pubkey::new_unique(), false)],
);
let sanitized_message = crate::message::SanitizedMessage::try_from(Message::new(
&[instruction1.clone(), instruction2.clone()],
Some(&Pubkey::new_unique()),
))
.unwrap();
let key = id();
let mut lamports = 0;
let mut data = construct_instructions_data(&sanitized_message, true);
let owner = crate::sysvar::id();
let account_info = AccountInfo::new(
&key,
false,
false,
&mut lamports,
&mut data,
&owner,
false,
0,
);
assert_eq!(
instruction1,
load_instruction_at_checked(0, &account_info).unwrap()
);
assert_eq!(
instruction2,
load_instruction_at_checked(1, &account_info).unwrap()
);
assert_eq!(
Err(ProgramError::InvalidArgument),
load_instruction_at_checked(2, &account_info)
);
} | rust_cleaned_test_functions.jsonl/20346 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 744
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12411,
54923,
3752,
56456,
368,
341,
286,
1077,
7600,
16,
284,
29051,
486,
931,
6615,
21816,
1851,
1006,
310,
22611,
792,
486,
931,
21218,
3148,
310,
609,
15,
345,
310,
7486,
20703,
7365,
12175,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multiply_int_unsigned() {
let cases = vec![
(Datum::I64(1), Datum::I64(2), Datum::U64(2)),
(
Datum::I64(i64::MIN),
Datum::I64(1),
Datum::U64(i64::MIN as u64),
),
(
Datum::I64(i64::MAX),
Datum::I64(1),
Datum::U64(i64::MAX as u64),
),
(Datum::U64(u64::MAX), Datum::I64(1), Datum::U64(u64::MAX)),
];
let mut ctx = EvalContext::default();
for (left, right, exp) in cases {
let lhs = datum_expr(left);
let rhs = datum_expr(right);
let mut op = Expression::build(
&mut ctx,
scalar_func_expr(ScalarFuncSig::MultiplyIntUnsigned, &[lhs, rhs]),
)
.unwrap();
op.mut_field_type()
.as_mut_accessor()
.set_flag(FieldTypeFlag::UNSIGNED);
let got = op.eval(&mut ctx, &[]).unwrap();
assert_eq!(got, exp);
}
// test overflow
let cases = vec![
(Datum::I64(-1), Datum::I64(2)),
(Datum::I64(i64::MAX), Datum::I64(i64::MAX)),
(Datum::I64(i64::MIN), Datum::I64(i64::MIN)),
];
for (left, right) in cases {
let lhs = datum_expr(left);
let rhs = datum_expr(right);
let mut op = Expression::build(
&mut ctx,
scalar_func_expr(ScalarFuncSig::MultiplyIntUnsigned, &[lhs, rhs]),
)
.unwrap();
op.mut_field_type()
.as_mut_accessor()
.set_flag(FieldTypeFlag::UNSIGNED);
let got = op.eval(&mut ctx, &[]).unwrap_err();
assert!(check_overflow(got).is_ok());
}
} | rust_cleaned_test_functions.jsonl/82068 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
93054,
4042,
67830,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
320,
68036,
486,
40,
21,
19,
7,
16,
701,
68459,
486,
40,
21,
19,
7,
17,
701,
68459,
486,
52,
21,
19,
7,
17,
6965,
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... | 3 |
#[test]
fn test_number_array() {
assert_eq!(
fm::<Vec<u8>>(quote!(ignore = "[16, 0xff]")),
vec![0x10, 0xff]
);
assert_eq!(
fm::<Vec<u16>>(quote!(ignore = "[32, 0xffff]")),
vec![0x20, 0xffff]
);
assert_eq!(
fm::<Vec<u32>>(quote!(ignore = "[48, 0xffffffff]")),
vec![0x30, 0xffffffff]
);
assert_eq!(
fm::<Vec<u64>>(quote!(ignore = "[64, 0xffffffffffffffff]")),
vec![0x40, 0xffffffffffffffff]
);
assert_eq!(
fm::<Vec<usize>>(quote!(ignore = "[80, 0xffffffff]")),
vec![0x50, 0xffffffff]
);
} | rust_cleaned_test_functions.jsonl/10240 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 442
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5500,
3858,
368,
341,
286,
2060,
10714,
33673,
310,
31121,
27638,
10050,
34837,
23,
25526,
2949,
10297,
13130,
284,
10545,
16,
21,
11,
220,
15,
9020,
60,
30154,
310,
7486,
20703,
15,
87,
16,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fun_1_ptr() {
let mut l = Lexer::<DefaultContext>::new(b"double ** foo(int x)");
let p = TypeDeclaratorParser::new(&mut l);
let mut context = Context::default();
let (_, decl) = p.parse(None, None, true, &mut context).unwrap();
let decl = decl.unwrap();
assert_eq!(
decl,
Rc::new(TypeDeclarator {
typ: Type {
base: BaseType::Function(Box::new(Function {
return_type: Some(Type {
base: BaseType::Primitive(Primitive::Double),
cv: CVQualifier::empty(),
pointers: Some(vec![
Pointer {
kind: PtrKind::Pointer,
attributes: None,
cv: CVQualifier::empty(),
ms: MSModifier::empty(),
},
Pointer {
kind: PtrKind::Pointer,
attributes: None,
cv: CVQualifier::empty(),
ms: MSModifier::empty(),
},
]),
}),
params: vec![Parameter {
attributes: None,
decl: Rc::new(TypeDeclarator {
typ: Type {
base: BaseType::Primitive(Primitive::Int),
cv: CVQualifier::empty(),
pointers: None,
},
specifier: Specifier::empty(),
identifier: Identifier {
identifier: Some(mk_id!("x")),
attributes: None
},
init: None,
bitfield_size: None,
}),
}],
cv: CVQualifier::empty(),
refq: RefQualifier::None,
except: None,
attributes: None,
trailing: None,
virt_specifier: VirtSpecifier::empty(),
status: FunStatus::None,
requires: None,
ctor_init: None,
body: RefCell::new(None)
})),
cv: CVQualifier::empty(),
pointers: None,
},
specifier: Specifier::empty(),
identifier: Identifier {
identifier: Some(mk_id!("foo")),
attributes: None
},
init: None,
bitfield_size: None,
})
);
} | rust_cleaned_test_functions.jsonl/117532 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28315,
62,
16,
4348,
368,
341,
286,
1077,
5206,
326,
284,
85082,
27638,
3675,
1972,
6831,
931,
1883,
1,
4331,
3070,
15229,
1548,
856,
20996,
286,
1077,
281,
284,
3990,
1912,
12821,
850,
6570,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_block_based_options() {
let path = tempdir_with_prefix("_rust_rocksdb_block_based_options");
let path_str = path.path().to_str().unwrap();
let mut opts = DBOptions::new();
opts.create_if_missing(true);
opts.enable_statistics(true);
opts.set_stats_dump_period_sec(60);
let mut bopts = BlockBasedOptions::new();
bopts.set_read_amp_bytes_per_bit(4);
let mut cfopts = ColumnFamilyOptions::new();
cfopts.set_block_based_table_factory(&bopts);
let db = DB::open_cf(opts.clone(), path_str, vec![("default", cfopts)]).unwrap();
// sure the statistics will not be 0.
db.put(b"a", b"abcdef").unwrap();
db.flush(true).unwrap();
db.get(b"a").unwrap();
assert_ne!(
opts.get_statistics_ticker_count(TickerType::ReadAmpTotalReadBytes),
0
);
assert_ne!(
opts.get_statistics_ticker_count(TickerType::ReadAmpEstimateUsefulBytes),
0
);
} | rust_cleaned_test_functions.jsonl/34129 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 429
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7113,
66679,
8743,
368,
341,
262,
1077,
1815,
284,
2730,
3741,
6615,
13974,
16975,
35788,
26608,
14553,
1999,
7113,
66679,
8743,
797,
262,
1077,
1815,
2895,
284,
1815,
3875,
1005,
983,
2895,
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... | 1 |
#[test]
fn test_or4() {
let compiled = compile("SET B 255\nOR B B");
let out_cpu = test_program(compiled);
assert_eq!(out_cpu.b.value, 255);
assert_eq!(out_cpu.f.value, 0);
} | rust_cleaned_test_functions.jsonl/63171 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 92
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8734,
19,
368,
341,
262,
1077,
19697,
284,
19192,
445,
5884,
425,
220,
17,
20,
20,
1699,
868,
425,
425,
797,
262,
1077,
700,
21795,
284,
1273,
25096,
30008,
2181,
626,
262,
2060,
10714,
10297,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_aac_switch() {
let mut exec = fasync::TestExecutor::new().expect("executor should build");
let (sender, _) = fake_cobalt_sender();
let mut config = A2dpConfiguration {
source: AudioSourceType::BigBen,
enable_sink: false,
..Default::default()
};
let mut builder_fut = Box::pin(StreamsBuilder::system_available(sender.clone(), &config));
let builder = exec.run_singlethreaded(&mut builder_fut);
let streams = builder.expect("should generate streams").streams().expect("gather streams");
assert_eq!(streams.information().len(), 2, "Source AAC & SBC should be available");
drop(builder_fut);
drop(streams);
config.enable_aac = false;
let mut builder_fut = Box::pin(StreamsBuilder::system_available(sender.clone(), &config));
let builder = exec.run_singlethreaded(&mut builder_fut);
let streams = builder.expect("should generate streams").streams().expect("gather streams");
assert_eq!(streams.information().len(), 1, "Source SBC only should be available");
} | rust_cleaned_test_functions.jsonl/69380 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 451
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4306,
580,
27652,
368,
341,
286,
1077,
5206,
3883,
284,
282,
7692,
486,
2271,
25255,
486,
931,
1005,
17119,
445,
80787,
1265,
1936,
797,
286,
1077,
320,
11644,
11,
27439,
284,
12418,
666,
674,
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_reader_gtf2_dup_attr_keys() {
let mut reader = Reader::new(GTF_FILE_DUP_ATTR_KEYS, GffType::GTF2);
let mut records = reader.records().collect::<Vec<_>>();
assert_eq!(records.len(), 1);
let record = records.pop().unwrap().expect("expected one record");
assert_eq!(record.attributes.get("tag"), Some(&"basic".to_owned()));
assert_eq!(
record.attributes.get_vec("tag"),
Some(&vec!["basic".to_owned(), "appris_principal_1".to_owned()])
);
} | rust_cleaned_test_functions.jsonl/74494 | {
"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,
22306,
1889,
8935,
17,
51932,
10422,
12631,
368,
341,
286,
1077,
5206,
6604,
284,
25166,
486,
931,
6699,
10808,
8087,
1557,
3124,
12865,
51251,
11,
479,
542,
929,
486,
38,
10808,
17,
317,
286,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extension_with_no_data() {
let account_size =
ExtensionType::get_account_len::<Account>(&[ExtensionType::ImmutableOwner]);
let mut buffer = vec![0; account_size];
let mut state =
StateWithExtensionsMut::<Account>::unpack_uninitialized(&mut buffer).unwrap();
state.base = TEST_ACCOUNT;
state.pack_base();
state.init_account_type().unwrap();
state.init_extension::<ImmutableOwner>(true).unwrap();
assert_eq!(
get_first_extension_type(state.tlv_data).unwrap(),
Some(ExtensionType::ImmutableOwner)
);
assert_eq!(
get_extension_types(state.tlv_data).unwrap(),
vec![ExtensionType::ImmutableOwner]
);
} | rust_cleaned_test_functions.jsonl/90552 | {
"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,
31035,
6615,
6536,
1769,
368,
341,
286,
1077,
2692,
2368,
4035,
310,
26473,
929,
486,
455,
13500,
6043,
27638,
7365,
44784,
58,
12049,
929,
486,
58890,
13801,
2558,
286,
1077,
5206,
4147,
284,
748... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_debug() {
let resp = Response::Ok()
.append_header((COOKIE, HeaderValue::from_static("cookie1=value1; ")))
.append_header((COOKIE, HeaderValue::from_static("cookie2=value2; ")))
.finish();
let dbg = format!("{:?}", resp);
assert!(dbg.contains("Response"));
} | rust_cleaned_test_functions.jsonl/52666 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15446,
368,
341,
286,
1077,
9039,
284,
5949,
486,
11578,
741,
310,
659,
5090,
8757,
1188,
44796,
11,
12104,
1130,
486,
1499,
25360,
445,
16236,
16,
46538,
16,
26,
330,
5929,
310,
659,
5090,
8757... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extract_config_data_with_only_duplicate_apps() {
let mock_reader = Box::new(MockPackageReader::new());
// We will need 2 service package definitions that map different services
mock_reader.append_service_pkg_def(create_svc_pkg_def(
vec![],
vec![String::from("fuchsia-pkg://fuchsia.com/foo#meta/foo-app.cmx")],
));
mock_reader.append_service_pkg_def(create_svc_pkg_def(
vec![],
vec![String::from("fuchsia-pkg://fuchsia.com/foo#meta/foo-app.cmx")],
));
let collector = PackageDataCollector::default();
let mut meta = HashMap::new();
meta.insert(String::from("data/sysmgr/service1.config"), String::from("test_merkle"));
meta.insert(String::from("data/sysmgr/service2.config"), String::from("test_merkle_2"));
let pkg = create_test_package_with_meta(String::from(CONFIG_DATA_PKG_URL), meta);
let served = vec![pkg];
let package_reader: Box<dyn PackageReader> = mock_reader;
let result = collector.extract_config_data(&package_reader, &served).unwrap();
assert_eq!(1, result.apps.len());
assert!(result.apps.contains("fuchsia-pkg://fuchsia.com/foo#meta/foo-app.cmx"));
assert_eq!(0, result.services.len());
} | rust_cleaned_test_functions.jsonl/19468 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 581
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
5332,
1769,
6615,
18410,
70434,
69899,
368,
341,
286,
1077,
7860,
22306,
284,
8261,
486,
931,
66436,
13100,
5062,
486,
931,
1423,
286,
442,
1205,
686,
1184,
220,
17,
2473,
6328,
17473,
429,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_script_to_address() {
let script = hex_script("76a91437d8a6977e2b61459c594c8da713a2aeac7516b188ac");
let address = script_to_address(&script, Network::new("prod", 1)).unwrap();
assert_eq!(address, "166Hhi6oFtpMmugcLY2uyBFDC6caDFjT9s".to_string());
let script = hex_script("21c13c630f9d53c11847a662c963dfb1e05a8630dcb901262533cb2f590c480cc734bc76a91437d8a6977e2b61459c594c8da713a2aeac7516b188ac");
let address = script_to_address(&script, Network::new("prod", 1)).unwrap();
assert_eq!(
address,
"vhUcGQDo5abu4Ld1azfVWyzTDxFzYu9kk93VJ9ozv8zjq8vaGtGemPHKXfRnxPzbNXaxSk5sxd8Neh"
.to_string()
);
} | rust_cleaned_test_functions.jsonl/29237 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 396
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14660,
2346,
6744,
368,
341,
286,
1077,
5316,
284,
12371,
14660,
445,
22,
21,
64,
24,
16,
19,
18,
22,
67,
23,
64,
21,
24,
22,
22,
68,
17,
65,
21,
16,
19,
20,
24,
66,
20,
24,
19,
66,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_expand_ed25519() {
let input_bytes: [u8; 32] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2];
match MiniSecretKey::from_bytes(&input_bytes) {
Ok(msc) => {
println!("msc : {:?}", msc.to_bytes());
let kp: Keypair = msc.expand_to_keypair(ExpansionMode::Ed25519);
println!("kp: {:?}", kp)
},
Err(err) => println!("{:?}", err)
}
} | rust_cleaned_test_functions.jsonl/106253 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 306
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67875,
32370,
17,
20,
20,
16,
24,
368,
341,
286,
1077,
1946,
12524,
25,
508,
84,
23,
26,
220,
18,
17,
60,
284,
508,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_is_confirmed_rooted() {
let bank = Arc::new(Bank::default());
let ledger_path = get_tmp_ledger_path!();
let blockstore = Arc::new(Blockstore::open(&ledger_path).unwrap());
blockstore.set_roots(&[0, 1]).unwrap();
// Build BlockCommitmentCache with rooted slots
let mut cache0 = BlockCommitment::default();
cache0.increase_rooted_stake(50);
let mut cache1 = BlockCommitment::default();
cache1.increase_rooted_stake(40);
let mut cache2 = BlockCommitment::default();
cache2.increase_rooted_stake(20);
let mut block_commitment = HashMap::new();
block_commitment.entry(1).or_insert(cache0);
block_commitment.entry(2).or_insert(cache1);
block_commitment.entry(3).or_insert(cache2);
let highest_confirmed_root = 1;
let block_commitment_cache = BlockCommitmentCache::new(
block_commitment,
50,
CommitmentSlots {
slot: bank.slot(),
highest_confirmed_root,
..CommitmentSlots::default()
},
);
assert!(is_confirmed_rooted(
&block_commitment_cache,
&bank,
&blockstore,
0
));
assert!(is_confirmed_rooted(
&block_commitment_cache,
&bank,
&blockstore,
1
));
assert!(!is_confirmed_rooted(
&block_commitment_cache,
&bank,
&blockstore,
2
));
assert!(!is_confirmed_rooted(
&block_commitment_cache,
&bank,
&blockstore,
3
));
} | rust_cleaned_test_functions.jsonl/48003 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 903
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
16059,
8434,
12993,
291,
368,
341,
286,
1077,
6073,
284,
19689,
486,
931,
5349,
1180,
486,
2258,
1423,
286,
1077,
46933,
2638,
284,
633,
16125,
38367,
1389,
2638,
0,
543,
286,
1077,
2504,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_into_signature_algorithm() {
let cbor_signature_algorithm: cbor::Value = cbor_int!(ecdsa::PubKey::ES256_ALGORITHM);
let signature_algorithm = SignatureAlgorithm::try_from(cbor_signature_algorithm.clone());
let expected_signature_algorithm = SignatureAlgorithm::ES256;
assert_eq!(signature_algorithm, Ok(expected_signature_algorithm));
let created_cbor: cbor::Value = signature_algorithm.unwrap().into();
assert_eq!(created_cbor, cbor_signature_algorithm);
let cbor_unknown_algorithm: cbor::Value = cbor_int!(-1);
let unknown_algorithm = SignatureAlgorithm::try_from(cbor_unknown_algorithm);
let expected_unknown_algorithm = SignatureAlgorithm::Unknown;
assert_eq!(unknown_algorithm, Ok(expected_unknown_algorithm));
} | rust_cleaned_test_functions.jsonl/49002 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 326
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
45514,
39859,
59531,
368,
341,
286,
1077,
272,
9368,
39859,
59531,
25,
272,
9368,
486,
1130,
284,
272,
9368,
4042,
10297,
757,
96780,
486,
29162,
1592,
486,
1570,
17,
20,
21,
8912,
74585,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_boxed_snapshot() {
let snapshot = {
let mut isolate = CoreIsolate::new(StartupData::None, true);
js_check(isolate.execute("a.js", "a = 1 + 2"));
let snap: &[u8] = &*isolate.snapshot();
Vec::from(snap).into_boxed_slice()
};
let startup_data = StartupData::Snapshot(Snapshot::Boxed(snapshot));
let mut isolate2 = CoreIsolate::new(startup_data, false);
js_check(isolate2.execute("check.js", "if (a != 3) throw Error('x')"));
} | rust_cleaned_test_functions.jsonl/23807 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 210
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
10194,
291,
53265,
368,
341,
262,
1077,
16295,
284,
341,
414,
1077,
5206,
42123,
284,
9518,
3872,
33066,
486,
931,
7,
39076,
1043,
486,
4064,
11,
830,
317,
414,
6994,
7200,
82669,
7769,
44... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_record_to_string_for_esa_record() {
let esa_record_1 = Record::ExtendedSegmentAddress(0x1200);
assert_eq!(
esa_record_1.to_record_string(),
Ok(String::from(":020000021200EA"))
);
let esa_record_2 = Record::ExtendedSegmentAddress(0x55AA);
assert_eq!(
esa_record_2.to_record_string(),
Ok(String::from(":0200000255AAFD"))
);
} | rust_cleaned_test_functions.jsonl/105908 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 190
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14192,
2346,
3904,
5478,
62,
22371,
14192,
368,
341,
262,
1077,
49880,
14192,
62,
16,
284,
13583,
486,
53190,
21086,
4286,
7,
15,
87,
16,
17,
15,
15,
317,
262,
2060,
10714,
33673,
286,
49880,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_t07() {
// Multi-selection
let (r, sioe) = do_execute!(&["-s", "\"one\".[2:0],\"two\",\"three\""], super::IN_DAT_07);
assert_eq!(buff!(sioe, serr), "");
assert_eq!(buff!(sioe, sout), "[[3,2,1],2,3]\n",);
assert_eq!(r.is_ok(), true);
} | rust_cleaned_test_functions.jsonl/118362 | {
"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,
528,
15,
22,
368,
341,
286,
442,
17439,
75705,
198,
286,
1077,
320,
81,
11,
274,
815,
68,
8,
284,
653,
44329,
0,
2099,
1183,
12,
82,
497,
15898,
603,
2105,
7873,
17,
25,
15,
1125,
2105,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_wallet_witness_tx() {
let (server, leader_data, alice, ledger_path) = new_fullnode("test_wallet_witness_tx");
let bob_pubkey = Keypair::new().pubkey();
let (sender, receiver) = channel();
run_local_drone(alice, sender);
let drone_addr = receiver.recv().unwrap();
let rpc_client = RpcClient::new_from_socket(leader_data.rpc);
let mut config_payer = WalletConfig::default();
config_payer.drone_port = drone_addr.port();
config_payer.rpc_port = leader_data.rpc.port();
let mut config_witness = WalletConfig::default();
config_witness.drone_port = drone_addr.port();
config_witness.rpc_port = leader_data.rpc.port();
assert_ne!(config_payer.id.pubkey(), config_witness.id.pubkey());
request_and_confirm_airdrop(&rpc_client, &drone_addr, &config_payer.id, 50).unwrap();
config_payer.command = WalletCommand::Pay(
10,
bob_pubkey,
None,
None,
Some(vec![config_witness.id.pubkey()]),
None,
);
let sig_response = process_command(&config_payer);
let object: Value = serde_json::from_str(&sig_response.unwrap()).unwrap();
let process_id_str = object.get("processId").unwrap().as_str().unwrap();
let process_id_vec = bs58::decode(process_id_str)
.into_vec()
.expect("base58-encoded public key");
let process_id = Pubkey::new(&process_id_vec);
let params = json!([format!("{}", config_payer.id.pubkey())]);
check_balance(39, &rpc_client, params); // config_payer balance
let params = json!([format!("{}", process_id)]);
check_balance(11, &rpc_client, params); // contract balance
let params = json!([format!("{}", bob_pubkey)]);
check_balance(0, &rpc_client, params); // recipient balance
// Sign transaction by config_witness
config_witness.command = WalletCommand::Witness(bob_pubkey, process_id);
process_command(&config_witness).unwrap();
let params = json!([format!("{}", config_payer.id.pubkey())]);
check_balance(39, &rpc_client, params); // config_payer balance
let params = json!([format!("{}", process_id)]);
check_balance(1, &rpc_client, params); // contract balance
let params = json!([format!("{}", bob_pubkey)]);
check_balance(10, &rpc_client, params); // recipient balance
server.close().unwrap();
remove_dir_all(ledger_path).unwrap();
} | rust_cleaned_test_functions.jsonl/83769 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 937
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62308,
1670,
8091,
17805,
368,
341,
262,
1077,
320,
4030,
11,
7653,
1769,
11,
70433,
11,
46933,
2638,
8,
284,
501,
16372,
3509,
445,
1944,
62308,
1670,
8091,
17805,
797,
262,
1077,
35192,
34014,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tga() {
assert_eq_ok!(
ImageInfo::from_file_path("images/valid/tga/sample.tga"),
ImageInfo {
format: ImageFormat::TGA,
ext: "tga",
full_ext: "tga",
mimetype: "image/tga",
size: ImageSize { width: 123, height: 456 },
entry_sizes: vec![],
}
);
} | rust_cleaned_test_functions.jsonl/65171 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 212
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
6743,
368,
341,
262,
2060,
10714,
19817,
33673,
286,
4654,
1731,
486,
1499,
2458,
2638,
445,
3642,
14,
1891,
5523,
6743,
69851,
734,
6743,
4461,
286,
4654,
1731,
341,
310,
3561,
25,
4654,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_content_type() {
let content_type = Header::parse_header([b"text/plain".to_vec()].as_ref());
assert_eq!(content_type.ok(), Some(ContentType(Mime(Text, Plain, vec![]))));
} | rust_cleaned_test_functions.jsonl/38838 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7495,
1819,
368,
341,
286,
1077,
2213,
1819,
284,
12104,
486,
6400,
8757,
2561,
65,
66251,
36971,
3263,
983,
13251,
57590,
300,
7793,
1423,
286,
2060,
10714,
10297,
1796,
1819,
18165,
1507,
4329,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_deserialize() {
const N_TESTS: u32 = 100;
let mut rng = rand::thread_rng();
for _ in 0..N_TESTS {
let vec = gen_random_path_sequence(&mut rng);
let ser = BezPath::from_path_segments(vec.iter().cloned()).to_svg();
let deser = BezPath::from_svg(&ser).expect("failed deserialization");
let deser_vec = deser.segments().collect::<Vec<PathSeg>>();
assert_eq!(vec, deser_vec);
}
} | rust_cleaned_test_functions.jsonl/46310 | {
"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,
88686,
15768,
9050,
368,
341,
286,
733,
451,
80312,
25,
575,
18,
17,
284,
220,
16,
15,
15,
280,
286,
1077,
5206,
28422,
284,
10382,
486,
4528,
66849,
1428,
286,
369,
716,
304,
220,
15,
496,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_or_with_one_lt_parse() {
let name1 = _random_string(10);
let value1 = _random_string(10);
let json = format!(r#"{{"$or":[{{"~{}":{{"$lt":"{}"}}}}]}}"#, name1, value1);
let query = parse_from_json(&json).unwrap();
let expected = Operator::Or(
vec![
Operator::Lt(
TagName::PlainTagName(name1.to_vec()),
TargetValue::Unencrypted(value1.clone())
)
]
);
assert_eq!(query, expected);
} | rust_cleaned_test_functions.jsonl/11849 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 311
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8734,
6615,
11667,
39164,
21039,
368,
341,
286,
1077,
829,
16,
284,
716,
11463,
3904,
7,
16,
15,
317,
286,
1077,
897,
16,
284,
716,
11463,
3904,
7,
16,
15,
626,
286,
1077,
2951,
284,
3561,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_key_lookup() {
let mut m = BTreeMap::new();
m.insert(Key::String("foo".into()), Value::from(42));
let m = Value::from(m);
assert_eq!(m.get_item(&Value::from("foo")).unwrap(), Value::from(42));
} | rust_cleaned_test_functions.jsonl/108536 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
3097,
27464,
368,
341,
262,
1077,
5206,
296,
284,
425,
6533,
2227,
486,
931,
543,
262,
296,
7030,
21358,
486,
703,
445,
7975,
3263,
18122,
11858,
5162,
486,
1499,
7,
19,
17,
1106,
262,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_product_except_self() {
assert_eq!(
Solution::product_except_self(vec![1,2,3,4]),
vec![24,12,8,6]
);
assert_eq!(
Solution::product_except_self(vec![1,1,1,1]),
vec![1,1,1,1]
);
assert_eq!(
Solution::product_except_self(vec![1,1,0,1]),
vec![0,0,1,0]
);
assert_eq!(
Solution::product_except_self(vec![5,9]),
vec![9,5]
);
} | rust_cleaned_test_functions.jsonl/28244 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 322
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9840,
54633,
25637,
368,
341,
286,
2060,
10714,
33673,
310,
12478,
486,
3031,
54633,
25637,
25592,
20703,
16,
11,
17,
11,
18,
11,
19,
17036,
310,
7486,
20703,
17,
19,
11,
16,
17,
11,
23,
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_int_local_counter_negative_inc() {
let counter = IntCounter::new("foo", "bar").unwrap();
let local = counter.local();
local.inc_by(-42);
} | rust_cleaned_test_functions.jsonl/65916 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 85
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4042,
13564,
15730,
53865,
31285,
368,
341,
286,
1077,
5546,
284,
1333,
14099,
486,
931,
445,
7975,
497,
330,
2257,
1827,
15454,
543,
286,
1077,
2205,
284,
5546,
11033,
543,
286,
2205,
26797,
3710... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_iteration() {
let mut r: Table<()> = Table::new();
r.add_rows(
vec![
vec![Nil, Num(101.into())].into_iter(),
vec![Num(202.into()), Obj(())].into_iter(),
]
.into_iter(),
);
let mut row = r.row(0).unwrap();
assert_eq!(row.next(), Some(&Nil));
assert_eq!(row.next(), Some(&Num(101.into())));
let mut row = r.row(1).unwrap();
assert_eq!(row.next(), Some(&Num(202.into())));
assert_eq!(row.next(), Some(&Obj(())));
assert_eq!(r.col(2).is_none(), true);
let mut col = r.col(0).unwrap();
assert_eq!(col.next(), Some(&Nil));
assert_eq!(col.next(), Some(&Num(202.into())));
let mut col = r.col(1).unwrap();
assert_eq!(col.next(), Some(&Num(101.into())));
assert_eq!(col.next(), Some(&Obj(())));
assert_eq!(r.col(2).is_none(), true);
// iteration
let mut rows = r.rows();
let mut row = rows.next().unwrap();
assert_eq!(row.next(), Some(&Nil));
assert_eq!(row.next(), Some(&Num(101.into())));
let mut row = rows.next().unwrap();
assert_eq!(row.next(), Some(&Num(202.into())));
assert_eq!(row.next(), Some(&Obj(())));
assert_eq!(row.next().is_none(), true);
let mut cols = r.cols();
let mut col = cols.next().unwrap();
assert_eq!(col.next(), Some(&Nil));
assert_eq!(col.next(), Some(&Num(202.into())));
let mut col = cols.next().unwrap();
assert_eq!(col.next(), Some(&Num(101.into())));
assert_eq!(col.next(), Some(&Obj(())));
assert_eq!(cols.next().is_none(), true);
} | rust_cleaned_test_functions.jsonl/4484 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 723
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62772,
368,
341,
262,
1077,
5206,
435,
25,
6633,
71698,
284,
6633,
486,
931,
543,
262,
435,
1364,
10949,
1006,
286,
7486,
90515,
310,
7486,
20703,
19064,
11,
16212,
7,
16,
15,
16,
39860,
2140,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_struct_array_builder_from_schema_unsupported_type() {
let mut fields = Vec::new();
fields.push(Field::new("f1", DataType::Int16, false));
let list_type =
DataType::List(Box::new(Field::new("item", DataType::Int64, true)));
fields.push(Field::new("f2", list_type, false));
let _ = StructBuilder::from_fields(fields, 5);
} | rust_cleaned_test_functions.jsonl/30998 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 175
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15126,
3858,
28532,
5673,
25371,
4907,
18216,
1819,
368,
341,
286,
1077,
5206,
5043,
284,
11312,
486,
931,
543,
286,
5043,
2552,
57788,
486,
931,
445,
69,
16,
497,
33172,
486,
1072,
16,
21,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_authorize_lockup() {
let stake_authority = solana_sdk::pubkey::new_rand();
let stake_lamports = 42;
let stake_account = AccountSharedData::new_ref_data_with_space(
stake_lamports,
&StakeState::Initialized(Meta::auto(&stake_authority)),
std::mem::size_of::<StakeState>(),
&id(),
)
.expect("stake_account");
let to = solana_sdk::pubkey::new_rand();
let to_account = AccountSharedData::new_ref(1, 0, &system_program::id());
let to_keyed_account = KeyedAccount::new(&to, false, &to_account);
let clock = Clock::default();
let stake_keyed_account = KeyedAccount::new(&stake_authority, true, &stake_account);
let stake_pubkey0 = solana_sdk::pubkey::new_rand();
let signers = vec![stake_authority].into_iter().collect();
assert_eq!(
stake_keyed_account.authorize(
&signers,
&stake_pubkey0,
StakeAuthorize::Staker,
false,
&Clock::default(),
None
),
Ok(())
);
assert_eq!(
stake_keyed_account.authorize(
&signers,
&stake_pubkey0,
StakeAuthorize::Withdrawer,
false,
&Clock::default(),
None
),
Ok(())
);
if let StakeState::Initialized(Meta { authorized, .. }) =
StakeState::from(&stake_keyed_account.account.borrow()).unwrap()
{
assert_eq!(authorized.staker, stake_pubkey0);
assert_eq!(authorized.withdrawer, stake_pubkey0);
} else {
panic!();
}
// A second authorization signed by the stake_keyed_account should fail
let stake_pubkey1 = solana_sdk::pubkey::new_rand();
assert_eq!(
stake_keyed_account.authorize(
&signers,
&stake_pubkey1,
StakeAuthorize::Staker,
false,
&Clock::default(),
None
),
Err(InstructionError::MissingRequiredSignature)
);
let signers0 = vec![stake_pubkey0].into_iter().collect();
// Test a second authorization by the newly authorized pubkey
let stake_pubkey2 = solana_sdk::pubkey::new_rand();
assert_eq!(
stake_keyed_account.authorize(
&signers0,
&stake_pubkey2,
StakeAuthorize::Staker,
false,
&Clock::default(),
None
),
Ok(())
);
if let StakeState::Initialized(Meta { authorized, .. }) =
StakeState::from(&stake_keyed_account.account.borrow()).unwrap()
{
assert_eq!(authorized.staker, stake_pubkey2);
}
assert_eq!(
stake_keyed_account.authorize(
&signers0,
&stake_pubkey2,
StakeAuthorize::Withdrawer,
false,
&Clock::default(),
None
),
Ok(())
);
if let StakeState::Initialized(Meta { authorized, .. }) =
StakeState::from(&stake_keyed_account.account.borrow()).unwrap()
{
assert_eq!(authorized.staker, stake_pubkey2);
}
// Test that withdrawal to account fails without authorized withdrawer
assert_eq!(
stake_keyed_account.withdraw(
stake_lamports,
&to_keyed_account,
&clock,
&StakeHistory::default(),
&stake_keyed_account, // old signer
None,
),
Err(InstructionError::MissingRequiredSignature)
);
let stake_keyed_account2 = KeyedAccount::new(&stake_pubkey2, true, &stake_account);
// Test a successful action by the currently authorized withdrawer
let to_keyed_account = KeyedAccount::new(&to, false, &to_account);
assert_eq!(
stake_keyed_account.withdraw(
stake_lamports,
&to_keyed_account,
&clock,
&StakeHistory::default(),
&stake_keyed_account2,
None,
),
Ok(())
);
assert_eq!(stake_keyed_account.state(), Ok(StakeState::Uninitialized));
} | rust_cleaned_test_functions.jsonl/65809 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2446
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22938,
551,
9818,
454,
368,
341,
286,
1077,
18279,
22938,
487,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
18279,
907,
309,
3394,
284,
220,
19,
17,
280,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_handshake_message_server_hello_done() -> Result<(), Error> {
let raw_server_hello_done = vec![];
let parsed_server_hello_done = HandshakeMessageServerHelloDone {};
let mut reader = BufReader::new(raw_server_hello_done.as_slice());
let c = HandshakeMessageServerHelloDone::unmarshal(&mut reader)?;
assert_eq!(
c, parsed_server_hello_done,
"handshakeMessageServerHelloDone unmarshal: got {:?}, want {:?}",
c, parsed_server_hello_done
);
let mut raw = vec![];
{
let mut writer = BufWriter::<&mut Vec<u8>>::new(raw.as_mut());
c.marshal(&mut writer)?;
}
assert_eq!(
raw, raw_server_hello_done,
"handshakeMessageServerHelloDone marshal: got {:?}, want {:?}",
raw, raw_server_hello_done
);
Ok(())
} | rust_cleaned_test_functions.jsonl/29086 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 354
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23194,
29661,
6462,
12015,
96724,
24390,
368,
1464,
5714,
68843,
4600,
29,
341,
262,
1077,
7112,
12015,
96724,
24390,
284,
7486,
0,
15078,
262,
1077,
15676,
12015,
96724,
24390,
284,
8536,
29661,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_encode_cache() {
let sr_settings = SrSettings::new(format!("http://{}", server_address()));
let mut encoder = ProtoRawEncoder::new(sr_settings);
let strategy =
SubjectNameStrategy::RecordNameStrategy(String::from("nl.openweb.data.Heartbeat"));
let error = encoder
.encode(
get_proto_hb_101_only_data(),
"nl.openweb.data.Heartbeat",
&strategy,
)
.unwrap_err();
assert_eq!(true, error.cached);
let _m = mock("GET", "/subjects/nl.openweb.data.Heartbeat/versions/latest")
.with_status(200)
.with_header("content-type", "application/vnd.schemaregistry.v1+json")
.with_body(&get_proto_body(get_proto_hb_schema(), 7))
.create();
let error = encoder
.encode(
get_proto_hb_101_only_data(),
"nl.openweb.data.Heartbeat",
&strategy,
)
.unwrap_err();
assert_eq!(true, error.cached);
encoder.remove_errors_from_cache();
let encoded_data = encoder
.encode(
get_proto_hb_101_only_data(),
"nl.openweb.data.Heartbeat",
&strategy,
)
.unwrap();
assert_eq!(encoded_data, get_proto_hb_101())
} | rust_cleaned_test_functions.jsonl/100935 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 769
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
11529,
368,
341,
286,
1077,
18962,
10853,
284,
33588,
6086,
486,
931,
20698,
17223,
1254,
1110,
42351,
3538,
6744,
7392,
286,
1077,
5206,
23668,
284,
57677,
20015,
19921,
486,
931,
67650,
108... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_chunk_size() {
assert_eq!(chunk_size(b""), "0");
assert_eq!(chunk_size(b"1"), "1");
assert_eq!(chunk_size(b"1234567890"), "A");
assert_eq!(chunk_size(b"12345678901234"), "E");
} | rust_cleaned_test_functions.jsonl/131328 | {
"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,
30539,
2368,
368,
341,
286,
2060,
10714,
10297,
25979,
2368,
1883,
3014,
701,
330,
15,
797,
286,
2060,
10714,
10297,
25979,
2368,
1883,
1,
16,
3975,
330,
16,
797,
286,
2060,
10714,
10297,
25979,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_poh_recorder_record_sets_start_slot() {
solana_logger::setup();
let ledger_path = get_tmp_ledger_path!();
{
let blockstore = Blockstore::open(&ledger_path)
.expect("Expected to be able to open database ledger");
let ticks_per_slot = 5;
let GenesisConfigInfo {
mut genesis_config, ..
} = create_genesis_config(2);
genesis_config.ticks_per_slot = ticks_per_slot;
let bank = Arc::new(Bank::new_for_tests(&genesis_config));
let prev_hash = bank.last_blockhash();
let (mut poh_recorder, _entry_receiver, _record_receiver) = PohRecorder::new(
0,
prev_hash,
bank.clone(),
Some((4, 4)),
bank.ticks_per_slot(),
&Pubkey::default(),
&Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::new_from_bank(&bank)),
&Arc::new(PohConfig::default()),
Arc::new(AtomicBool::default()),
);
poh_recorder.set_bank(&bank);
// Simulate ticking much further than working_bank.max_tick_height
let max_tick_height = poh_recorder.working_bank.as_ref().unwrap().max_tick_height;
for _ in 0..3 * max_tick_height {
poh_recorder.tick();
}
let tx = test_tx();
let h1 = hash(b"hello world!");
assert!(poh_recorder
.record(bank.slot(), h1, vec![tx.into()])
.is_err());
assert!(poh_recorder.working_bank.is_none());
// the `start_slot` is still the slot of the last workign bank set by
assert_eq!(poh_recorder.start_slot(), bank.slot());
}
Blockstore::destroy(&ledger_path).unwrap();
} | rust_cleaned_test_functions.jsonl/106273 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1022
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
2267,
7080,
1358,
14192,
21289,
4906,
27563,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
46933,
2638,
284,
633,
16125,
38367,
1389,
2638,
0,
543,
286,
341,
310,
1077,
2504,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_cost_model_update_instruction_cost() {
let key1 = Pubkey::new_unique();
let cost1 = 100;
let cost2 = 200;
let updated_cost = (cost1 + cost2) / 2;
let mut cost_model = CostModel::default();
// insert instruction cost to table
cost_model.upsert_instruction_cost(&key1, cost1);
assert_eq!(cost1, cost_model.find_instruction_cost(&key1));
// update instruction cost
cost_model.upsert_instruction_cost(&key1, cost2);
assert_eq!(updated_cost, cost_model.find_instruction_cost(&key1));
} | rust_cleaned_test_functions.jsonl/10431 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 259
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15890,
5047,
8882,
54923,
15890,
368,
341,
286,
1077,
1376,
16,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
2783,
16,
284,
220,
16,
15,
15,
280,
286,
1077,
2783,
17,
284,
220,
17,
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_disjoint() {
let mut xs = HashSet::new();
let mut ys = HashSet::new();
assert!(xs.is_disjoint(&ys));
assert!(ys.is_disjoint(&xs));
assert!(xs.insert(5));
assert!(ys.insert(11));
assert!(xs.is_disjoint(&ys));
assert!(ys.is_disjoint(&xs));
assert!(xs.insert(7));
assert!(xs.insert(19));
assert!(xs.insert(4));
assert!(ys.insert(2));
assert!(ys.insert(-11));
assert!(xs.is_disjoint(&ys));
assert!(ys.is_disjoint(&xs));
assert!(ys.insert(7));
assert!(!xs.is_disjoint(&ys));
assert!(!ys.is_disjoint(&xs));
} | rust_cleaned_test_functions.jsonl/5395 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 366
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9932,
32850,
368,
341,
286,
1077,
5206,
11943,
284,
18931,
486,
931,
543,
286,
1077,
5206,
31810,
284,
18931,
486,
931,
543,
286,
2060,
10297,
18561,
2079,
9932,
32850,
2099,
1047,
1106,
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_instrs_method() {
let mut a = CodeAssembler::new(64).unwrap();
assert_eq!(a.instructions, &[]);
a.rdtsc().unwrap();
assert_eq!(a.instructions, &[Instruction::with(Code::Rdtsc)]);
a.xor(ecx, 0x1234_5678).unwrap();
assert_eq!(a.instructions, &[Instruction::with(Code::Rdtsc), Instruction::with2(Code::Xor_rm32_imm32, Register::ECX, 0x1234_5678).unwrap()]);
} | rust_cleaned_test_functions.jsonl/71803 | {
"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,
62574,
82,
9032,
368,
341,
10217,
5206,
264,
284,
6119,
77858,
486,
931,
7,
21,
19,
568,
15454,
543,
6948,
10714,
10297,
64,
80599,
11,
609,
56703,
11323,
1746,
8047,
2388,
1005,
15454,
543,
694... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_array() {
assert_eq!(eval("array(1, 2, 3, 4)"), Ok(to_value(vec![1, 2, 3, 4])));
} | rust_cleaned_test_functions.jsonl/28420 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 67
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
368,
341,
286,
2060,
10714,
10297,
14170,
445,
1653,
7,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
8,
3975,
7622,
12186,
3142,
25592,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_tuple_array_as_map() {
#[serde_as]
#[derive(Debug, PartialEq, Serialize, Deserialize)]
struct S1(#[serde_as(as = "BTreeMap<_, _>")] [(u8, u8); 1]);
is_equal(
S1([(1, 2)]),
expect![[r#"
{
"1": 2
}"#]],
);
#[serde_as]
#[derive(Debug, PartialEq, Serialize, Deserialize)]
struct S2(#[serde_as(as = "HashMap<_, _>")] [(u8, u8); 33]);
is_equal(
S2([
(0, 0),
(1, 1),
(2, 2),
(3, 3),
(4, 4),
(5, 5),
(6, 6),
(7, 7),
(8, 8),
(9, 9),
(10, 10),
(11, 11),
(12, 12),
(13, 13),
(14, 14),
(15, 15),
(16, 16),
(17, 17),
(18, 18),
(19, 19),
(20, 20),
(21, 21),
(22, 22),
(23, 23),
(24, 24),
(25, 25),
(26, 26),
(27, 27),
(28, 28),
(29, 29),
(30, 30),
(31, 31),
(32, 32),
]),
expect![[r#"
{
"0": 0,
"1": 1,
"2": 2,
"3": 3,
"4": 4,
"5": 5,
"6": 6,
"7": 7,
"8": 8,
"9": 9,
"10": 10,
"11": 11,
"12": 12,
"13": 13,
"14": 14,
"15": 15,
"16": 16,
"17": 17,
"18": 18,
"19": 19,
"20": 20,
"21": 21,
"22": 22,
"23": 23,
"24": 24,
"25": 25,
"26": 26,
"27": 27,
"28": 28,
"29": 29,
"30": 30,
"31": 31,
"32": 32
}"#]],
);
} | rust_cleaned_test_functions.jsonl/86189 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1522
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21773,
3858,
11898,
5376,
368,
341,
262,
11506,
47024,
11898,
921,
262,
11506,
27098,
42618,
11,
55039,
11,
39900,
11,
48440,
5563,
262,
2036,
328,
16,
7,
13353,
47024,
11898,
36951,
284,
330,
33,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_multiple_headers() {
let req = TestRequest::default()
.insert_header((header::CACHE_CONTROL, "no-cache, private"))
.finish();
let cache = Header::parse(&req);
assert_eq!(
cache.ok(),
Some(CacheControl(vec![
CacheDirective::NoCache,
CacheDirective::Private,
]))
)
} | rust_cleaned_test_functions.jsonl/62430 | {
"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,
21039,
45233,
26719,
368,
341,
286,
1077,
4232,
284,
3393,
1900,
486,
2258,
741,
310,
659,
4208,
8757,
1188,
2708,
486,
61736,
23680,
11,
330,
2152,
36680,
11,
869,
5455,
310,
659,
30150,
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,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_case0() {
assert_eq!(
Solution::find_kth_largest(
vec![7, 3, 82, 9, 2, 17, 4, 29, 1, 8, 36, 33, 18, 22, 19],
2
),
36
);
assert_eq!(Solution::find_kth_largest(vec![7, 6, 5, 4, 3, 2, 1], 5), 3);
assert_eq!(Solution::find_kth_largest(vec![5, 2, 4, 1, 3, 6, 0], 4), 3)
} | rust_cleaned_test_functions.jsonl/2910 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 244
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19096,
15,
368,
341,
286,
2060,
10714,
33673,
310,
12478,
486,
3903,
4698,
339,
907,
32381,
1006,
394,
7486,
20703,
22,
11,
220,
18,
11,
220,
23,
17,
11,
220,
24,
11,
220,
17,
11,
220,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_solution() {
let test_case = vec![
("/home/", "/home"),
("/../", "/"),
("/", "/"),
("/.", "/"),
("/.a", "/.a"),
("/..a", "/..a"),
("/home//foo/", "/home/foo"),
("/a/./b/../../c/", "/c"),
("/a/../../b/../c//.//", "/c")
];
for (nums, answer) in test_case {
let ans = Solution::simplify_path(nums.to_string());
assert_eq!(ans, answer);
}
} | rust_cleaned_test_functions.jsonl/125795 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 321
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
50274,
368,
341,
286,
1077,
1273,
19096,
284,
7486,
90515,
310,
88889,
5117,
28105,
3521,
5117,
4461,
310,
88889,
1244,
497,
3521,
4461,
310,
88889,
497,
3521,
4461,
310,
88889,
10465,
3521,
4461,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_value() {
assert_that!(&Variables::to_value("v1").unwrap())
.is_equal_to(&serde_yaml::Value::String("v1".to_owned()));
assert_that!(&Variables::to_value("true").unwrap())
.is_equal_to(&serde_yaml::Value::Bool(true));
assert_that!(&Variables::to_value("false").unwrap())
.is_equal_to(&serde_yaml::Value::Bool(false));
assert_that!(&Variables::to_value("\"true\"").unwrap())
.is_equal_to(&serde_yaml::Value::String("true".to_owned()));
assert_that!(&Variables::to_value("42").unwrap())
.is_equal_to(&serde_yaml::to_value(42).unwrap());
} | rust_cleaned_test_functions.jsonl/20262 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 323
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
3142,
368,
341,
286,
2060,
70197,
0,
2099,
22678,
486,
983,
3142,
445,
85,
16,
1827,
15454,
2398,
310,
659,
285,
11478,
2346,
2099,
47024,
64380,
486,
1130,
486,
703,
445,
85,
16,
3263,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pop_empty2() {
let mut s = Stack::new();
s.push(Elt::Int(0)).unwrap();
let res = s.pop();
assert!(res.is_ok());
let res = s.pop();
assert!(res.is_err());
if let Err(Error::Underflow) = res {
} else {
assert!(false);
}
} | rust_cleaned_test_functions.jsonl/34516 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 184
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17061,
15124,
17,
368,
341,
286,
1077,
5206,
274,
284,
14284,
486,
931,
543,
286,
274,
2552,
10722,
4832,
486,
1072,
7,
15,
4579,
15454,
1428,
286,
1077,
592,
284,
274,
8288,
543,
286,
2060,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_closes_file_descriptors() {
new_ucmd!()
.arg("-r")
.arg("--reflink=auto")
.arg("dir_with_10_files/")
.arg("dir_with_10_files_new/")
.with_limit(Resource::NOFILE, 9, 9)
.succeeds();
} | rust_cleaned_test_functions.jsonl/21281 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 146
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
49341,
2458,
15768,
25705,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
858,
13645,
81,
1138,
286,
659,
858,
21549,
1097,
2080,
28,
3902,
1138,
286,
659,
858,
445,
3741,
6615,
62,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_p2pkh_from_key() {
let key = hex_key!("048d5141948c1702e8c95f438815794b87f706a8d4cd2bffad1dc1570971032c9b6042a0431ded2478b5c9cf2d81c124a5e57347a3c63ef0e7716cf54d613ba183");
let addr = Address::p2pkh(&key, Bitcoin);
assert_eq!(&addr.to_string(), "1QJVDzdqb1VpbDK7uDeyVXy9mR27CJiyhY");
let key = hex_key!(&"03df154ebfcf29d29cc10d5c2565018bce2d9edbab267c31d2caf44a63056cf99f");
let addr = Address::p2pkh(&key, Testnet);
assert_eq!(&addr.to_string(), "mqkhEMH6NCeYjFybv7pvFC22MFeaNT9AQC");
assert_eq!(addr.address_type(), Some(AddressType::P2pkh));
roundtrips(&addr);
} | rust_cleaned_test_functions.jsonl/59113 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 365
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
17,
20819,
71,
5673,
3097,
368,
341,
286,
1077,
1376,
284,
12371,
3097,
17223,
15,
19,
23,
67,
20,
16,
19,
16,
24,
19,
23,
66,
16,
22,
15,
17,
68,
23,
66,
24,
20,
69,
19,
18,
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,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_arith_instructions() {
let allocator = Arena::new();
let module_cache = VMModuleCache::new(&allocator);
let main_module = fake_script().into_module();
let loaded_main = LoadedModule::new(main_module);
let entry_func = FunctionRef::new(&loaded_main, CompiledScript::MAIN_INDEX);
let data_cache = FakeDataCache::new();
let mut vm =
TransactionExecutor::new(module_cache, &data_cache, TransactionMetadata::default());
vm.execution_stack.push_frame(entry_func);
test_binop_instruction(
&mut vm,
Bytecode::Add,
vec![Local::u64(1), Local::u64(2)],
Local::u64(3),
);
test_binop_instruction_overflow(
&mut vm,
Bytecode::Add,
vec![Local::u64(u64::max_value()), Local::u64(1)],
);
test_binop_instruction(
&mut vm,
Bytecode::Sub,
vec![Local::u64(10), Local::u64(2)],
Local::u64(8),
);
test_binop_instruction_overflow(&mut vm, Bytecode::Sub, vec![Local::u64(0), Local::u64(1)]);
test_binop_instruction(
&mut vm,
Bytecode::Mul,
vec![Local::u64(2), Local::u64(3)],
Local::u64(6),
);
test_binop_instruction_overflow(
&mut vm,
Bytecode::Mul,
vec![Local::u64(u64::max_value() / 2), Local::u64(3)],
);
test_binop_instruction(
&mut vm,
Bytecode::Mod,
vec![Local::u64(10), Local::u64(4)],
Local::u64(2),
);
test_binop_instruction_overflow(&mut vm, Bytecode::Mod, vec![Local::u64(1), Local::u64(0)]);
test_binop_instruction(
&mut vm,
Bytecode::Div,
vec![Local::u64(6), Local::u64(2)],
Local::u64(3),
);
test_binop_instruction_overflow(&mut vm, Bytecode::Div, vec![Local::u64(1), Local::u64(0)]);
test_binop_instruction(
&mut vm,
Bytecode::BitOr,
vec![Local::u64(5), Local::u64(6)],
Local::u64(7),
);
test_binop_instruction(
&mut vm,
Bytecode::BitAnd,
vec![Local::u64(5), Local::u64(6)],
Local::u64(4),
);
test_binop_instruction(
&mut vm,
Bytecode::Xor,
vec![Local::u64(5), Local::u64(6)],
Local::u64(3),
);
test_binop_instruction(
&mut vm,
Bytecode::Or,
vec![Local::bool(false), Local::bool(true)],
Local::bool(true),
);
test_binop_instruction(
&mut vm,
Bytecode::Or,
vec![Local::bool(false), Local::bool(false)],
Local::bool(false),
);
test_binop_instruction(
&mut vm,
Bytecode::And,
vec![Local::bool(false), Local::bool(true)],
Local::bool(false),
);
test_binop_instruction(
&mut vm,
Bytecode::And,
vec![Local::bool(true), Local::bool(true)],
Local::bool(true),
);
test_binop_instruction(
&mut vm,
Bytecode::Eq,
vec![Local::bool(false), Local::bool(true)],
Local::bool(false),
);
test_binop_instruction(
&mut vm,
Bytecode::Eq,
vec![Local::u64(5), Local::u64(6)],
Local::bool(false),
);
test_binop_instruction(
&mut vm,
Bytecode::Neq,
vec![Local::bool(false), Local::bool(true)],
Local::bool(true),
);
test_binop_instruction(
&mut vm,
Bytecode::Neq,
vec![Local::u64(5), Local::u64(6)],
Local::bool(true),
);
test_binop_instruction(
&mut vm,
Bytecode::Lt,
vec![Local::u64(5), Local::u64(6)],
Local::bool(true),
);
test_binop_instruction(
&mut vm,
Bytecode::Lt,
vec![Local::u64(5), Local::u64(5)],
Local::bool(false),
);
test_binop_instruction(
&mut vm,
Bytecode::Gt,
vec![Local::u64(7), Local::u64(6)],
Local::bool(true),
);
test_binop_instruction(
&mut vm,
Bytecode::Gt,
vec![Local::u64(5), Local::u64(5)],
Local::bool(false),
);
test_binop_instruction(
&mut vm,
Bytecode::Le,
vec![Local::u64(5), Local::u64(6)],
Local::bool(true),
);
test_binop_instruction(
&mut vm,
Bytecode::Le,
vec![Local::u64(5), Local::u64(5)],
Local::bool(true),
);
test_binop_instruction(
&mut vm,
Bytecode::Ge,
vec![Local::u64(7), Local::u64(6)],
Local::bool(true),
);
test_binop_instruction(
&mut vm,
Bytecode::Ge,
vec![Local::u64(5), Local::u64(5)],
Local::bool(true),
);
} | rust_cleaned_test_functions.jsonl/65238 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2442
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25842,
410,
82427,
368,
341,
262,
1077,
43655,
284,
27047,
486,
931,
543,
262,
1077,
4688,
11529,
284,
17792,
3332,
8233,
486,
931,
2099,
57631,
317,
262,
1077,
1887,
10750,
284,
12418,
14660,
100... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_point_on_edge_right() {
// a
// / x <--- point exactly on edge ab
// x-' | \
// b--x
let mut builder = Path::builder();
builder.begin(point(0.0, 0.0));
builder.line_to(point(0.0, 100.0));
builder.line_to(point(50.0, 100.0));
builder.line_to(point(0.0, 50.0));
builder.line_to(point(-50.0, 100.0));
builder.end(true);
let path = builder.build();
test_path(path.as_slice());
} | rust_cleaned_test_functions.jsonl/102427 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 233
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6085,
4470,
17932,
10539,
368,
341,
262,
442,
257,
264,
7213,
262,
442,
256,
608,
856,
220,
366,
4421,
1459,
6896,
389,
6821,
668,
7213,
262,
442,
856,
22512,
760,
3044,
262,
442,
257,
293,
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_example_8() {
let input: &str = "ab\nac";
let valid: usize = count_common_chars(&input);
assert_eq!(valid, 1);
} | rust_cleaned_test_functions.jsonl/120250 | {
"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,
39304,
62,
23,
368,
341,
286,
1077,
1946,
25,
609,
495,
284,
330,
370,
1699,
580,
876,
286,
1077,
2697,
25,
22301,
284,
1760,
21107,
37418,
2099,
1355,
317,
286,
2060,
10714,
10297,
1891,
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 |
#[test]
fn test_time_sub() {
let a = ::time::now();
let b = at(a.to_timespec() + Duration::seconds(5));
let c = b - a;
assert_eq!(c.num_nanoseconds(), Some(super::NSEC_PER_SEC as i64 * 5));
} | rust_cleaned_test_functions.jsonl/7349 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 120
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3009,
5228,
368,
341,
286,
1077,
264,
284,
3504,
1678,
486,
3328,
543,
286,
1077,
293,
284,
518,
2877,
2389,
22353,
992,
368,
488,
21045,
486,
17403,
7,
20,
1106,
286,
1077,
272,
284,
293,
481... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_header_accept() {
let key = FromStr::from_str("dGhlIHNhbXBsZSBub25jZQ==").unwrap();
let accept = WebSocketAccept::new(&key);
let mut headers = Headers::new();
headers.set(accept);
assert_eq!(
&headers.to_string()[..],
"Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n"
);
} | rust_cleaned_test_functions.jsonl/79217 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 159
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8757,
35728,
368,
341,
197,
10217,
1376,
284,
5542,
2580,
486,
1499,
2895,
445,
67,
38,
17958,
40,
43165,
49039,
59272,
82,
57,
16680,
392,
17,
20,
73,
57,
48,
418,
1827,
15454,
543,
197,
1021... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multiline_string_literal() {
assert_eq!(lex("\\\\"), (Token::MultilineStringLiteralLine, 2));
assert_eq!(lex("\\\\hello"), (Token::MultilineStringLiteralLine, 7));
assert_eq!(lex("\\\\ hello\n"), (Token::MultilineStringLiteralLine, 8));
} | rust_cleaned_test_functions.jsonl/80522 | {
"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,
26290,
26560,
3904,
34100,
368,
341,
286,
2060,
10714,
10297,
2571,
29710,
69947,
701,
320,
3323,
486,
40404,
26560,
703,
17350,
2460,
11,
220,
17,
1106,
286,
2060,
10714,
10297,
2571,
29710,
3422,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pay_for_credential_with_handle() {
init!("true");
let handle = from_string(DEFAULT_SERIALIZED_CREDENTIAL_PAYMENT_REQUIRED).unwrap();
submit_payment(handle).unwrap();
get_payment_information(handle).unwrap();
let handle2 = from_string(DEFAULT_SERIALIZED_CREDENTIAL).unwrap();
assert!(!is_payment_required(handle2).unwrap());
let invalid_handle = 12345;
assert_eq!(is_payment_required(invalid_handle).unwrap_err().kind(), VcxErrorKind::InvalidCredentialHandle);
} | rust_cleaned_test_functions.jsonl/82316 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 235
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28925,
5478,
666,
30320,
6615,
10630,
368,
341,
286,
2930,
17223,
1866,
797,
286,
1077,
3705,
284,
504,
3904,
43175,
14844,
88727,
920,
81509,
67566,
53912,
568,
15454,
543,
286,
9318,
26696,
26405,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_user_dict_number_of_fields_is_11() {
let config = TokenizerConfig {
user_dict_path: Some(&Path::new(
"test/fixtures/userdic_insufficient_number_of_fields.csv",
)),
mode: Mode::Normal,
..TokenizerConfig::default()
};
Tokenizer::with_config(config).unwrap();
} | rust_cleaned_test_functions.jsonl/61453 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 190
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3317,
5243,
5500,
3575,
12132,
6892,
62,
16,
16,
368,
341,
286,
1077,
2193,
284,
9660,
3135,
2648,
341,
310,
1196,
5243,
2638,
25,
4329,
2099,
1820,
486,
931,
1006,
394,
330,
1944,
94275,
11739,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_interval_bidirectional_backward_closure() {
let anchor = Interval::starting_at(Moment(Local.ymd(2017, 04, 25).and_hms(9, 10, 11)),
Grain::Second);
let mut only_backward =
BidirectionalWalker::new().backward_with(anchor, |prev| prev - PeriodComp::days(1));
assert_eq!(None, only_backward.forward.next());
assert_eq!(Moment(Local.ymd(2017, 04, 25).and_hms(9, 10, 11)),
only_backward.backward.next().unwrap().start);
assert_eq!(Moment(Local.ymd(2017, 04, 24).and_hms(9, 10, 11)),
only_backward.backward.next().unwrap().start);
} | rust_cleaned_test_functions.jsonl/56551 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 344
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20541,
62509,
44670,
70477,
72823,
368,
341,
286,
1077,
17105,
284,
40584,
486,
39289,
3752,
3189,
12913,
42718,
13,
1600,
67,
7,
17,
15,
16,
22,
11,
220,
15,
19,
11,
220,
17,
20,
568,
437,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_scope_root() {
let app = App::new()
.scope("/app", |scope| {
scope
.resource("", |r| r.f(|_| HttpResponse::Ok()))
.resource("/", |r| r.f(|_| HttpResponse::Created()))
})
.finish();
let req = TestRequest::with_uri("/app").request();
let resp = app.run(req);
assert_eq!(resp.as_msg().status(), StatusCode::OK);
let req = TestRequest::with_uri("/app/").request();
let resp = app.run(req);
assert_eq!(resp.as_msg().status(), StatusCode::CREATED);
} | rust_cleaned_test_functions.jsonl/22439 | {
"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,
23199,
12993,
368,
341,
286,
1077,
906,
284,
1845,
486,
931,
741,
310,
659,
4186,
4283,
676,
497,
760,
4186,
91,
341,
394,
6891,
198,
503,
659,
9233,
19814,
760,
81,
91,
435,
833,
22428,
35395... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_path_to_package() {
let package = RpVersionedPackage::new(
RpPackage::new(vec!["foo".to_string(), "bar".to_string()]),
Some(version("2.0.0")),
);
assert_eq!(
package,
path_to_package("foo/bar-2.0.0.reproto").expect("bad path")
);
let package = RpVersionedPackage::new(
RpPackage::new(vec!["bar".to_string()]),
Some(version("2.0.0")),
);
assert_eq!(
package,
path_to_package("bar-2.0.0.reproto").expect("bad path")
);
let package = RpVersionedPackage::empty();
assert_eq!(package, path_to_package(".").expect("bad path"));
assert!(path_to_package("./foo.txt").is_err());
} | rust_cleaned_test_functions.jsonl/27226 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 413
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2638,
2346,
26328,
368,
341,
286,
1077,
6328,
284,
68108,
5637,
291,
13100,
486,
931,
1006,
310,
68108,
13100,
486,
931,
25592,
0,
1183,
7975,
3263,
983,
3904,
1507,
330,
2257,
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 |
#[test]
fn test_from_compression_method_for_u8() {
assert_eq!(u8::from(CompressionMethod::None), 0);
assert_eq!(u8::from(CompressionMethod::Gzip), 1);
assert_eq!(u8::from(CompressionMethod::Bzip2), 2);
assert_eq!(u8::from(CompressionMethod::Lzma), 3);
assert_eq!(u8::from(CompressionMethod::Rans), 4);
} | rust_cleaned_test_functions.jsonl/115689 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 168
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
2965,
4011,
9032,
5478,
7300,
23,
368,
341,
286,
2060,
10714,
10297,
84,
23,
486,
1499,
7,
81411,
3523,
486,
4064,
701,
220,
15,
317,
286,
2060,
10714,
10297,
84,
23,
486,
1499,
7,
81411... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_poll_future_notify_with_slow_poller() {
let (tx, rx) = oneshot::channel::<usize>();
let (signal_tx, signal_rx) = oneshot::channel();
thread::Builder::new()
.name("source".to_owned())
.spawn(move || {
tx.send(100).unwrap();
signal_tx.send(()).unwrap();
})
.unwrap();
let (tx1, rx1) = oneshot::channel::<usize>();
signal_rx.wait().unwrap();
poll_future_notify(
rx.map(move |i| {
assert_ne!(thread::current().name(), Some("source"));
tx1.send(i + 100).unwrap();
})
.map_err(|_| ()),
);
assert_eq!(rx1.wait().unwrap(), 200);
} | rust_cleaned_test_functions.jsonl/7269 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 428
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40002,
59740,
36654,
6615,
82447,
40002,
261,
368,
341,
286,
1077,
320,
3998,
11,
19111,
8,
284,
389,
4288,
354,
486,
10119,
27638,
51878,
3913,
286,
1077,
320,
26622,
17805,
11,
8286,
24330,
8,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_app_properties() -> Result<(), AmqpCodecError> {
let msg = InMessage::default().set_app_property(ByteString::from("test"), 1);
let mut buf = BytesMut::with_capacity(msg.encoded_size());
msg.encode(&mut buf);
let msg2 = InMessage::decode(&buf)?.1;
let props = msg2.application_properties.as_ref().unwrap();
assert_eq!(*props.get("test").unwrap(), Variant::from(1));
Ok(())
} | rust_cleaned_test_functions.jsonl/38635 | {
"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,
8191,
25158,
368,
1464,
5714,
68843,
3303,
32763,
36913,
1454,
29,
341,
286,
1077,
3750,
284,
758,
2052,
486,
2258,
1005,
746,
8191,
16638,
55823,
703,
486,
1499,
445,
1944,
3975,
220,
16,
626,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_stdin_skip_and_check_2_chars() {
new_ucmd!()
.args(&["-s3", "-w2"]).pipe_in_fixture(SKIP_CHARS)
.run().stdout_is_fixture("skip-3-check-2-chars.expected");
} | rust_cleaned_test_functions.jsonl/23099 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15656,
258,
44830,
8378,
7200,
62,
17,
37418,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
12,
82,
18,
497,
6523,
86,
17,
45014,
13768,
1243,
74409,
72504,
3298,
82319,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_gc_ptr_collect_invalid_reclaimed() {
let driver = TestDriver::new(
r#"
struct Foo;
pub fn main() -> Foo { Foo }
"#,
);
let handle = unsafe { mun_gc_collect(driver.runtime, ptr::null_mut()) };
let message = unsafe { CStr::from_ptr(mun_error_message(handle)) };
assert_eq!(
message.to_str().unwrap(),
"Invalid argument: 'reclaimed' is null pointer."
);
unsafe { mun_destroy_string(message.as_ptr()) };
} | rust_cleaned_test_functions.jsonl/120564 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 212
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49423,
4348,
68140,
31433,
1288,
21275,
368,
341,
262,
1077,
5579,
284,
3393,
11349,
486,
931,
1006,
286,
435,
2,
698,
286,
2036,
33428,
401,
286,
6675,
5168,
1887,
368,
1464,
33428,
314,
33428,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_shr_carry_assign_binary()
{
let mut d = BinaryDigit(0u8);
let carry = d.shr_carry_assign(5, BinaryDigit(0x10));
assert_eq!(d, BinaryDigit(0x80));
assert_eq!(carry, BinaryDigit(0));
let mut d = BinaryDigit(0x43u8);
let carry = d.shr_carry_assign(5, BinaryDigit(0x10));
assert_eq!(d, BinaryDigit(0x82));
assert_eq!(carry, BinaryDigit(0x03));
let mut d = BinaryDigit(0xffu8);
let carry = d.shl_carry_assign(3, BinaryDigit(0x07));
assert_eq!(d, BinaryDigit(0xff));
assert_eq!(carry, BinaryDigit(0x07));
let mut d = BinaryDigit(0xffu16);
let carry = d.shr_carry_assign(3, BinaryDigit(0x07));
assert_eq!(d, BinaryDigit(0xe01f));
assert_eq!(carry, BinaryDigit(0x07));
let mut d = BinaryDigit(0xa3b4u16);
let carry = d.shr_carry_assign(11, BinaryDigit(0x83));
assert_eq!(d, BinaryDigit(0x1074));
assert_eq!(carry, BinaryDigit(0x03b4));
let mut d = BinaryDigit(0xa3b4u32);
let carry = d.shr_carry_assign(11, BinaryDigit(0x83));
assert_eq!(d, BinaryDigit(0x10600014));
assert_eq!(carry, BinaryDigit(0x000003b4));
let mut d = BinaryDigit(0x7f99a3b4u32);
let carry = d.shr_carry_assign(21, BinaryDigit(0x21483));
assert_eq!(d, BinaryDigit(0x10a41bfc));
assert_eq!(carry, BinaryDigit(0x019a3b4));
} | rust_cleaned_test_functions.jsonl/26395 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 741
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3712,
81,
666,
11433,
20688,
31761,
741,
262,
341,
286,
1077,
5206,
294,
284,
17718,
36420,
7,
15,
84,
23,
317,
286,
1077,
6777,
284,
294,
2395,
81,
666,
11433,
20688,
7,
20,
11,
17718,
36420,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_assign_string() {
let mut p = make_parser_with(r#"{{ with $bar := "foo" }}{{ $bar }}{{ end }}"#);
let r = p.parse_tree();
assert!(r.is_ok());
} | rust_cleaned_test_functions.jsonl/8631 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20688,
3904,
368,
341,
286,
1077,
5206,
281,
284,
1281,
18517,
6615,
2601,
55543,
2979,
448,
400,
2257,
1669,
330,
7975,
1,
3869,
2979,
400,
2257,
3869,
2979,
835,
14483,
2,
317,
286,
1077,
435,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_switch_threshold() {
// Init state
let mut vote_simulator = VoteSimulator::new(2);
let my_pubkey = vote_simulator.node_pubkeys[0];
let other_vote_account = vote_simulator.vote_pubkeys[1];
let bank0 = vote_simulator
.bank_forks
.read()
.unwrap()
.get(0)
.unwrap()
.clone();
let total_stake = bank0.total_epoch_stake();
assert_eq!(
total_stake,
vote_simulator.validator_keypairs.len() as u64 * 10_000
);
// Create the tree of banks
let forks = tr(0)
/ (tr(1)
/ (tr(2)
// Minor fork 1
/ (tr(10) / (tr(11) / (tr(12) / (tr(13) / (tr(14))))))
/ (tr(43)
/ (tr(44)
// Minor fork 2
/ (tr(45) / (tr(46) / (tr(47) / (tr(48) / (tr(49) / (tr(50)))))))
/ (tr(110))))));
// Fill the BankForks according to the above fork structure
vote_simulator.fill_bank_forks(forks, &HashMap::new());
for (_, fork_progress) in vote_simulator.progress.iter_mut() {
fork_progress.fork_stats.computed = true;
}
let ancestors = vote_simulator.bank_forks.read().unwrap().ancestors();
let mut descendants = vote_simulator.bank_forks.read().unwrap().descendants();
let mut tower = Tower::new_with_key(&my_pubkey);
// Last vote is 47
tower.record_vote(47, Hash::default());
// Trying to switch to a descendant of last vote should always work
assert_eq!(
tower.check_switch_threshold(
48,
&ancestors,
&descendants,
&vote_simulator.progress,
total_stake,
bank0.epoch_vote_accounts(0).unwrap(),
),
SwitchForkDecision::NoSwitch
);
// Trying to switch to another fork at 110 should fail
assert_eq!(
tower.check_switch_threshold(
110,
&ancestors,
&descendants,
&vote_simulator.progress,
total_stake,
bank0.epoch_vote_accounts(0).unwrap(),
),
SwitchForkDecision::FailedSwitchThreshold
);
// Adding another validator lockout on a descendant of last vote should
// not count toward the switch threshold
vote_simulator.simulate_lockout_interval(50, (49, 100), &other_vote_account);
assert_eq!(
tower.check_switch_threshold(
110,
&ancestors,
&descendants,
&vote_simulator.progress,
total_stake,
bank0.epoch_vote_accounts(0).unwrap(),
),
SwitchForkDecision::FailedSwitchThreshold
);
// Adding another validator lockout on an ancestor of last vote should
// not count toward the switch threshold
vote_simulator.simulate_lockout_interval(50, (45, 100), &other_vote_account);
assert_eq!(
tower.check_switch_threshold(
110,
&ancestors,
&descendants,
&vote_simulator.progress,
total_stake,
bank0.epoch_vote_accounts(0).unwrap(),
),
SwitchForkDecision::FailedSwitchThreshold
);
vote_simulator.simulate_lockout_interval(14, (12, 46), &other_vote_account);
assert_eq!(
tower.check_switch_threshold(
110,
&ancestors,
&descendants,
&vote_simulator.progress,
total_stake,
bank0.epoch_vote_accounts(0).unwrap(),
),
SwitchForkDecision::FailedSwitchThreshold
);
// unless the bank is not the most recent frozen bank on the fork (14 is a
// frozen/computed bank > 13 on the same fork in this case)
vote_simulator.simulate_lockout_interval(13, (12, 47), &other_vote_account);
assert_eq!(
tower.check_switch_threshold(
110,
&ancestors,
&descendants,
&vote_simulator.progress,
total_stake,
bank0.epoch_vote_accounts(0).unwrap(),
),
SwitchForkDecision::FailedSwitchThreshold
);
vote_simulator.simulate_lockout_interval(14, (12, 47), &other_vote_account);
assert_eq!(
tower.check_switch_threshold(
110,
&ancestors,
&descendants,
&vote_simulator.progress,
total_stake,
bank0.epoch_vote_accounts(0).unwrap(),
),
SwitchForkDecision::SwitchProof(Hash::default())
);
// Adding another unfrozen descendant of the tip of 14 should not remove
// slot 14 from consideration because it is still the most recent frozen
// bank on its fork
descendants.get_mut(&14).unwrap().insert(10000);
assert_eq!(
tower.check_switch_threshold(
110,
&ancestors,
&descendants,
&vote_simulator.progress,
total_stake,
bank0.epoch_vote_accounts(0).unwrap(),
),
SwitchForkDecision::SwitchProof(Hash::default())
);
// count toward the switch threshold. This means the other validator's
// vote lockout no longer counts
tower.lockouts.root_slot = Some(43);
// Refresh ancestors and descendants for new root.
let ancestors = vote_simulator.bank_forks.read().unwrap().ancestors();
let descendants = vote_simulator.bank_forks.read().unwrap().descendants();
assert_eq!(
tower.check_switch_threshold(
110,
&ancestors,
&descendants,
&vote_simulator.progress,
total_stake,
bank0.epoch_vote_accounts(0).unwrap(),
),
SwitchForkDecision::FailedSwitchThreshold
);
} | rust_cleaned_test_functions.jsonl/77016 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3435
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27652,
21858,
368,
341,
286,
442,
15690,
1584,
198,
286,
1077,
5206,
6910,
18314,
10511,
284,
34034,
14027,
10511,
486,
931,
7,
17,
317,
286,
1077,
847,
34014,
792,
284,
6910,
18314,
10511,
12097,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_sanity() {
let program_id = Pubkey::default();
let key = Pubkey::default();
let mut lamports = 0;
let mut data = vec![0; mem::size_of::<u32>()];
let owner = Pubkey::default();
let account = AccountInfo::new(
&key,
false,
true,
&mut lamports,
&mut data,
&owner,
false,
Epoch::default(),
);
let instruction_data: Vec<u8> = Vec::new();
let accounts = vec![account];
assert_eq!(
GreetingAccount::try_from_slice(&accounts[0].data.borrow())
.unwrap()
.counter,
0
);
process_instruction(&program_id, &accounts, &instruction_data).unwrap();
assert_eq!(
GreetingAccount::try_from_slice(&accounts[0].data.borrow())
.unwrap()
.counter,
1
);
process_instruction(&program_id, &accounts, &instruction_data).unwrap();
assert_eq!(
GreetingAccount::try_from_slice(&accounts[0].data.borrow())
.unwrap()
.counter,
2
);
} | rust_cleaned_test_functions.jsonl/19620 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 684
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
38270,
368,
341,
286,
1077,
2025,
842,
284,
22611,
792,
486,
2258,
543,
286,
1077,
1376,
284,
22611,
792,
486,
2258,
543,
286,
1077,
5206,
31603,
3394,
284,
220,
15,
280,
286,
1077,
5206,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sign_verify_that_merkle_key_ed25519_sha256() {
for method_data_base in [MethodData::new_b58, MethodData::new_multibase] {
let total: usize = 1 << 11;
let index: usize = 1 << 9;
let keys: KeyCollection = KeyCollection::new_ed25519(total).unwrap();
let controller: CoreDID = "did:example:1234".parse().unwrap();
let root: Hash<Sha256> = keys.merkle_root();
let proof: Proof<Sha256> = keys.merkle_proof(index).unwrap();
let mkey: Vec<u8> = MerkleKey::encode_key::<Sha256, Ed25519>(&root);
let method: VerificationMethod = VerificationMethod::builder(Default::default())
.id(controller.to_url().join("#key-collection").unwrap())
.controller(controller.clone())
.key_type(MethodType::MerkleKeyCollection2021)
.key_data(method_data_base(mkey))
.build()
.unwrap();
let document: CoreDocument<Properties> = CoreDocument::builder(Default::default())
.id(controller)
.verification_method(method)
.build()
.unwrap();
let public: &PublicKey = keys.public(index).unwrap();
let private: &PrivateKey = keys.private(index).unwrap();
let mut that: That = That::new(123);
assert!(document.verifier().verify(&that).is_err());
document
.signer(private)
.method("#key-collection")
.merkle_key((public, &proof))
.sign(&mut that)
.unwrap();
assert!(document.verifier().verify(&that).is_ok());
}
} | rust_cleaned_test_functions.jsonl/53496 | {
"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,
11172,
35638,
70197,
717,
16754,
273,
3097,
32370,
17,
20,
20,
16,
24,
48836,
17,
20,
21,
368,
341,
220,
369,
1714,
1769,
7651,
304,
508,
3523,
1043,
486,
931,
880,
20,
23,
11,
6730,
1043,
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_read1() -> io::Result<()> {
let iothread = IoThread::new(1);
let expected_bytes = include_bytes!("../../testfiles/plain.txt");
let mut reader1 =
iothread.add_reader_with_capacity(fs::File::open("./testfiles/plain.txt")?, 9)?;
let mut reader2 =
iothread.add_reader_with_capacity(fs::File::open("./testfiles/plain.txt")?, 9)?;
let mut buffer1 = vec![0u8; 9];
assert_eq!(reader1.read(&mut buffer1)?, 9);
assert_eq!(buffer1, expected_bytes[0..9]);
assert_eq!(reader1.read(&mut buffer1)?, 7);
assert_eq!(buffer1[0..7], expected_bytes[9..16]);
let mut buffer2 = Vec::new();
reader2.read_to_end(&mut buffer2)?;
assert_eq!(buffer2, expected_bytes);
Ok(())
} | rust_cleaned_test_functions.jsonl/57446 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 401
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
16,
368,
1464,
6399,
486,
2077,
71698,
341,
16885,
286,
1077,
6399,
4528,
284,
29655,
6855,
486,
931,
7,
16,
317,
286,
1077,
3601,
12524,
284,
2924,
12524,
17223,
2748,
1944,
7198,
36971,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_v2_proxy_map_using_out_fails() {
let result: Result<ProxyMap, Error> = parse2(quote! {
test = "test:out"
});
assert!(result.is_err());
} | rust_cleaned_test_functions.jsonl/85715 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
17,
29712,
5376,
75180,
6068,
761,
6209,
368,
341,
286,
1077,
1102,
25,
5714,
27,
16219,
2227,
11,
4600,
29,
284,
4715,
17,
7,
2949,
0,
341,
310,
1273,
284,
330,
1944,
25,
411,
698,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_incomplete_purge() {
let dir = tempfile::Builder::new()
.prefix("test_incomplete_purge")
.tempdir()
.unwrap();
let cfg = Config {
dir: dir.path().to_str().unwrap().to_owned(),
target_file_size: ReadableSize(1),
purge_threshold: ReadableSize(1),
..Default::default()
};
let rid = 1;
let data = vec![b'7'; 1024];
let engine = Engine::open(cfg.clone()).unwrap();
{
let _f = FailGuard::new("file_pipe_log::remove_file_failure", "return");
append(&engine, rid, 0, 20, Some(&data));
let append_first = engine.file_span(LogQueue::Append).0;
engine.compact_to(rid, 18);
engine.purge_expired_files().unwrap();
assert!(engine.file_span(LogQueue::Append).0 > append_first);
}
// Create a hole.
append(&engine, rid, 20, 40, Some(&data));
let append_first = engine.file_span(LogQueue::Append).0;
engine.compact_to(rid, 38);
engine.purge_expired_files().unwrap();
assert!(engine.file_span(LogQueue::Append).0 > append_first);
append(&engine, rid, 40, 60, Some(&data));
let append_first = engine.file_span(LogQueue::Append).0;
drop(engine);
let engine = Engine::open(cfg).unwrap();
assert_eq!(engine.file_span(LogQueue::Append).0, append_first);
assert_eq!(engine.first_index(rid).unwrap(), 38);
assert_eq!(engine.last_index(rid).unwrap(), 59);
} | rust_cleaned_test_functions.jsonl/25317 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 620
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
14737,
620,
39823,
368,
341,
262,
1077,
5419,
284,
54819,
486,
3297,
486,
931,
741,
286,
659,
11849,
445,
1944,
1243,
14737,
620,
39823,
1138,
286,
659,
3888,
3741,
741,
286,
659,
15454,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_child_doesnt_ref_parent() {
const GENERATIONS: u32 = 16;
fn child_no(x: u32) -> Box<Fn() + Send> {
return Box::new(move|| {
if x < GENERATIONS {
thread::spawn(move|| child_no(x+1)());
}
});
}
thread::spawn(|| child_no(0)());
} | rust_cleaned_test_functions.jsonl/18924 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 248
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17268,
96374,
406,
7793,
15960,
368,
341,
16885,
16885,
286,
733,
28108,
21792,
25,
575,
18,
17,
284,
220,
16,
21,
280,
286,
5168,
1682,
6536,
2075,
25,
575,
18,
17,
8,
1464,
8261,
27,
24911,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_enums_pass_field_validation() {
const ROOT_SCHEMA: &str = r#"
enum Color {
RED
GREEN
}
type A @entity {
id: ID!
color: Color
}"#;
let document = graphql_parser::parse_schema(ROOT_SCHEMA).expect("Failed to parse root schema");
let schema = Schema::new(DeploymentHash::new("id").unwrap(), document);
assert_eq!(schema.validate_fields().len(), 0);
} | rust_cleaned_test_functions.jsonl/10137 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 159
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6205,
6237,
15464,
5013,
19416,
368,
341,
262,
733,
35736,
46220,
25,
609,
495,
284,
435,
2,
698,
9018,
3478,
341,
220,
25810,
198,
220,
53559,
198,
630,
1313,
362,
569,
2996,
341,
220,
877,
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_basic_struct_with_aliases2() {
let schema = r#"
{
"type":"record",
"name":"TestBasicStructWithAliases2",
"aliases":["d", "e", "f"],
"fields":[
{
"name":"a",
"type":"int"
}
]
}
"#;
let schema = Schema::parse_str(schema).unwrap();
if let Schema::Record { name, aliases, .. } = TestBasicStructWithAliases2::get_schema() {
assert_eq!("TestBasicStructWithAliases2", name.fullname(None));
assert_eq!(
Some(vec!["d".to_owned(), "e".to_owned(), "f".to_owned()]),
aliases
);
} else {
panic!("TestBasicStructWithAliases2 schema must be a record schema")
}
assert_eq!(schema, TestBasicStructWithAliases2::get_schema());
serde_assert(TestBasicStructWithAliases2 { a: i32::MAX });
} | rust_cleaned_test_functions.jsonl/27828 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 535
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
15126,
6615,
90233,
17,
368,
341,
286,
1077,
10802,
284,
435,
2,
698,
286,
341,
310,
330,
1313,
3252,
8548,
756,
310,
330,
606,
3252,
2271,
15944,
9422,
2354,
95209,
17,
756,
310,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_blake2s_precomp_constraints() {
// doesn't result in more constraints.
let cs = ConstraintSystem::<Fr>::new_ref();
let mut rng = XorShiftRng::seed_from_u64(1231275789u64);
let input_bits: Vec<_> = (0..512)
.map(|_| Boolean::constant(rng.gen()))
.chain((0..512).map(|_| {
Boolean::new_witness(r1cs_core::ns!(cs, "input bit"), || Ok(true)).unwrap()
}))
.collect();
evaluate_blake2s(&input_bits).unwrap();
assert!(cs.is_satisfied().unwrap());
assert_eq!(cs.num_constraints(), 21792);
} | rust_cleaned_test_functions.jsonl/101937 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 333
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13141,
726,
17,
82,
10442,
5689,
60267,
368,
341,
1789,
286,
442,
3171,
944,
1102,
304,
803,
16982,
382,
286,
1077,
10532,
284,
44264,
2320,
27638,
22560,
6831,
931,
7793,
543,
286,
1077,
5206,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_read_be_int_n() {
let ints = [::i32::MIN, -123456, -42, -5, 0, 1, ::i32::MAX];
let mut writer = MemWriter::new();
for i in ints.iter() {
writer.write_be_i32(*i).unwrap();
}
let mut reader = MemReader::new(writer.unwrap());
for i in ints.iter() {
// this tests that the sign extension is working
assert!(reader.read_be_int_n(4).unwrap() == *i as i64);
}
} | rust_cleaned_test_functions.jsonl/4837 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 255
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
21263,
4042,
1089,
368,
341,
286,
1077,
54724,
284,
508,
486,
72,
18,
17,
486,
16413,
11,
481,
16,
17,
18,
19,
20,
21,
11,
481,
19,
17,
11,
481,
20,
11,
220,
15,
11,
220,
16,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_tabs_space_only() {
new_ucmd!()
.args(&["--tabs", " "])
.pipe_in("a\tb\tc")
.succeeds()
.stdout_is("a b c");
} | rust_cleaned_test_functions.jsonl/121796 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57953,
14663,
18410,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
313,
30993,
497,
330,
330,
2546,
286,
659,
13768,
1243,
445,
64,
4955,
65,
4955,
66,
1138,
286,
659,
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 |
#[test]
fn test_ordered_onelevel_batch_single_insert() {
let mut batch = OrderedOneLevelBatch::<u32, u32>::default();
batch.insert(0, Some(0));
assert_eq!(batch.count(), 1);
assert_eq!(batch.iter().collect::<Vec<_>>(), vec![(&0, 0..1)]);
} | rust_cleaned_test_functions.jsonl/4 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75272,
11667,
3294,
14534,
19487,
17678,
368,
341,
286,
1077,
5206,
7162,
284,
39581,
3966,
4449,
21074,
27638,
84,
18,
17,
11,
575,
18,
17,
6831,
2258,
543,
286,
7162,
7030,
7,
15,
11,
4329,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_missing_lease_expiry() {
let event = DhcpEvent::LeaseAdded {
event_timestamp: DateTime::<FixedOffset>::from(Local::now()),
lease_info: full_lease_info_v4(),
};
let mut result_command = Command::new(namib_dnsmasq_hook_exe());
let (args, mut envs) = create_args_and_env_map_from_event(&event);
envs.remove("DNSMASQ_LEASE_EXPIRES");
assert_eq!(
3,
result_command
.args(args)
.env_clear()
.envs(envs)
.stdout(Stdio::null())
.stderr(Stdio::null())
.status()
.expect("Error while running command.")
.code()
.expect("Command was terminated by a signal.")
);
} | rust_cleaned_test_functions.jsonl/48464 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 459
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40447,
62,
1623,
96509,
368,
341,
286,
1077,
1538,
284,
43227,
4672,
1556,
486,
2304,
519,
19337,
341,
310,
1538,
23073,
25,
6520,
27638,
13520,
6446,
6831,
1499,
42718,
486,
3328,
14702,
310,
250... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mut_rev_iter() {
let mut m = generate_test();
for (i, elt) in m.iter_mut().rev().enumerate() {
assert_eq!((6-i) as int, *elt);
}
let mut n = DList::new();
assert!(n.iter_mut().rev().next().is_none());
n.push_front(4);
let mut it = n.iter_mut().rev();
assert!(it.next().is_some());
assert!(it.next().is_none());
} | rust_cleaned_test_functions.jsonl/56739 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 223
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29523,
38082,
11723,
368,
341,
286,
1077,
5206,
296,
284,
6923,
4452,
543,
286,
369,
320,
72,
11,
54139,
8,
304,
296,
19471,
29523,
1005,
7282,
1005,
76569,
368,
341,
310,
2060,
10714,
0,
1188,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_keycode() {
let mut k = KeyCode::default();
assert!(k.set_film_mfc_code(-1).is_err());
assert!(k.set_film_mfc_code(1).is_ok());
assert_eq!(k.film_mfc_code(), 1);
} | rust_cleaned_test_functions.jsonl/192 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3097,
1851,
368,
341,
262,
1077,
5206,
595,
284,
65152,
486,
2258,
1428,
262,
2060,
10297,
74,
980,
761,
9484,
717,
8316,
4136,
4080,
16,
568,
285,
9266,
1423,
262,
2060,
10297,
74,
980,
761,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_null_string() {
let prog = &mut [
0xb7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // r1 = 0
0x85, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, // call -1
0xb7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // r0 = 0
0x95, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // exit
];
LittleEndian::write_u32(&mut prog[12..16], ebpf::hash_symbol_name(b"log"));
let mut mem = [72, 101, 108, 108, 111, 0];
let mut vm = EbpfVm::new(Some(prog)).unwrap();
vm.register_helper_ex("log", bpf_helper_string, None).unwrap();
vm.execute_program(&mut mem, &[], &[]).unwrap();
} | rust_cleaned_test_functions.jsonl/15533 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 340
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15162,
3904,
368,
341,
262,
1077,
29271,
284,
609,
6984,
2278,
286,
220,
15,
7929,
22,
11,
220,
15,
87,
15,
16,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
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_forced_checkout_update_to_modified_blob() -> BitResult<()> {
BitRepo::with_minimal_repo(|repo| {
let target = commit! {
foo < "new content"
};
modify!(repo: "foo" < "differing new content");
bit_checkout!(repo: --force &rev!(target))?;
assert_eq!(cat!(repo: "foo"), "new content");
Ok(())
})
} | rust_cleaned_test_functions.jsonl/62966 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 192
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5478,
1998,
68186,
8882,
2346,
37749,
45908,
368,
1464,
6495,
2077,
71698,
341,
262,
6495,
25243,
486,
4197,
7260,
2861,
37784,
22428,
23476,
91,
341,
286,
1077,
2169,
284,
5266,
0,
341,
310,
1522... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
let deserializer = &mut Deserializer::from_str("42");
let mut meta_map = MetaMap::new();
meta_map.insert(".".to_string(), Meta::from_error("some prior error"));
let value = Annotated::new(42, Meta::from_error("some prior error"));
assert_eq_dbg!(value, deserialize_meta(deserializer, meta_map).unwrap());
} | rust_cleaned_test_functions.jsonl/126353 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 162
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8337,
368,
341,
286,
1077,
939,
41939,
284,
609,
6984,
3874,
41939,
486,
1499,
2895,
445,
19,
17,
797,
286,
1077,
5206,
8823,
5376,
284,
15819,
2227,
486,
931,
543,
286,
8823,
5376,
7030,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_length_serde() {
let one_cm: Length<f32, Mm> = Length::new(10.0);
assert_tokens(&one_cm, &[Token::F32(10.0)]);
} | rust_cleaned_test_functions.jsonl/50596 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 97
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5118,
75861,
450,
368,
341,
310,
1077,
825,
43619,
25,
17287,
63895,
18,
17,
11,
386,
76,
29,
284,
17287,
486,
931,
7,
16,
15,
13,
15,
626,
310,
2060,
28838,
2099,
603,
43619,
11,
44590,
332... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_int_number_suffix() {
check_int_suffix("123", None);
check_int_suffix("123i32", "i32");
check_int_suffix("1_0_1_l_o_l", "l_o_l");
check_int_suffix("0b11", None);
check_int_suffix("0o11", None);
check_int_suffix("0xff", None);
check_int_suffix("0b11u32", "u32");
check_int_suffix("0o11u32", "u32");
check_int_suffix("0xffu32", "u32");
} | rust_cleaned_test_functions.jsonl/116110 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 239
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4042,
5500,
37151,
368,
341,
286,
1779,
4042,
37151,
445,
16,
17,
18,
497,
2240,
317,
286,
1779,
4042,
37151,
445,
16,
17,
18,
72,
18,
17,
497,
330,
72,
18,
17,
797,
286,
1779,
4042,
37151,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_float_bits_conv() {
assert_eq!((1f64).to_bits(), 0x3ff0000000000000);
assert_eq!((12.5f64).to_bits(), 0x4029000000000000);
assert_eq!((1337f64).to_bits(), 0x4094e40000000000);
assert_eq!((-14.25f64).to_bits(), 0xc02c800000000000);
assert_approx_eq!(f64::from_bits(0x3ff0000000000000), 1.0);
assert_approx_eq!(f64::from_bits(0x4029000000000000), 12.5);
assert_approx_eq!(f64::from_bits(0x4094e40000000000), 1337.0);
assert_approx_eq!(f64::from_bits(0xc02c800000000000), -14.25);
} | rust_cleaned_test_functions.jsonl/42224 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 288
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17586,
20034,
22716,
368,
341,
286,
2060,
10714,
0,
1188,
16,
69,
21,
19,
568,
983,
20034,
1507,
220,
15,
87,
18,
542,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
317,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.