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_chain() {
#[rustfmt::skip]
let tests = vec![
(
vec![3,15,3,16,1002,16,10,16,1,16,15,15,4,15,99,0,0],
&[4,3,2,1,0],
43210,
),
(
vec![3,23,3,24,1002,24,10,24,1002,23,-1,23,
101,5,23,23,1,24,23,23,4,23,99,0,0],
&[0,1,2,3,4],
54321,
),
(
vec![3,31,3,32,1002,32,10,32,1001,31,-2,31,1007,31,0,33,
1002,33,7,33,1,33,31,31,1,32,31,31,4,31,99,0,0,0],
&[1,0,4,3,2],
65210,
),
];
for (prog, settings, output) in tests {
let prog = Intcode::new(prog);
assert_eq!(output, chain_output(&prog, settings.as_ref()));
assert_eq!(output, max_output(&prog, chain_output, 0..=4));
}
} | rust_cleaned_test_functions.jsonl/75778 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 555
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30583,
368,
341,
262,
11506,
35788,
12501,
486,
20599,
921,
262,
1077,
7032,
284,
7486,
90515,
286,
2399,
310,
7486,
20703,
18,
11,
16,
20,
11,
18,
11,
16,
21,
11,
16,
15,
15,
17,
11,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_find_strobogrammatic() {
let test_cases = vec![
(2, vec!["11", "69", "88", "96"]),
(1, vec!["0", "1", "8"]),
];
for (n, expect) in test_cases {
assert_eq!(Solution::find_strobogrammatic(n), expect, "n: {}", n);
}
} | rust_cleaned_test_functions.jsonl/36757 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 174
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
1261,
22740,
12958,
37244,
368,
341,
286,
1077,
1273,
41427,
284,
7486,
90515,
310,
320,
17,
11,
7486,
0,
1183,
16,
16,
497,
330,
21,
24,
497,
330,
23,
23,
497,
330,
24,
21,
46442,
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... | 2 |
#[test]
fn test_ldd_parse_v2_30() {
let archlinux_ls_output = "\tlinux-vdso.so.1 (0x00007ffddc1f6000)
\tlibcap.so.2 => /usr/lib/libcap.so.2 (0x00007f4980989000)
\tlibc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f69ca6a1000)
\tlibc.so.6 => /usr/lib/libc.so.6 (0x00007f49807c2000)
\t/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f49809e9000)
";
assert_eq!(
parse_ldd_output(archlinux_ls_output)
.iter()
.map(|p| p.to_str().unwrap())
.collect::<Vec<_>>(),
&[
"/usr/lib/libcap.so.2",
"/lib/x86_64-linux-gnu/libc.so.6",
"/usr/lib/libc.so.6",
"/lib64/ld-linux-x86-64.so.2",
"/usr/lib64/ld-linux-x86-64.so.2",
]
)
} | rust_cleaned_test_functions.jsonl/77642 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 529
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
50573,
67,
21039,
2273,
17,
62,
18,
15,
368,
341,
286,
1077,
5325,
14210,
53174,
7645,
284,
2917,
83,
14210,
8273,
67,
704,
26476,
13,
16,
320,
15,
87,
15,
15,
15,
15,
22,
542,
631,
66,
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_parse_body() {
let mut buf =
BytesMut::from("GET /test HTTP/1.1\r\nContent-Length: 4\r\n\r\nbody");
let mut reader = MessageDecoder::<Request>::default();
let (req, pl) = reader.decode(&mut buf).unwrap().unwrap();
let mut pl = pl.unwrap();
assert_eq!(req.version(), Version::HTTP_11);
assert_eq!(*req.method(), Method::GET);
assert_eq!(req.path(), "/test");
assert_eq!(
pl.decode(&mut buf).unwrap().unwrap().chunk().as_ref(),
b"body"
);
} | rust_cleaned_test_functions.jsonl/22260 | {
"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,
21039,
14114,
368,
341,
286,
1077,
5206,
6607,
4035,
310,
30024,
51440,
486,
1499,
445,
3806,
608,
1944,
10130,
14,
16,
13,
16,
12016,
1699,
2762,
52493,
25,
220,
19,
12016,
1699,
12016,
1699,
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_consecutive_skips() {
let constraint: Box<dyn SinglePartConstraint> = Box::new(NoConsecutiveSkips);
run_scale_free_test(&constraint, &[1, 2, 1], 4, true);
run_scale_free_test(&constraint, &[1, 4, 3], 4, true);
run_scale_free_test(&constraint, &[1, 4, 1], 4, false);
run_scale_free_test(&constraint, &[1, 4, 6], 4, false);
} | rust_cleaned_test_functions.jsonl/74369 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3382,
85780,
33811,
3077,
368,
341,
286,
1077,
21568,
25,
8261,
92846,
11327,
5800,
17890,
29,
284,
8261,
486,
931,
7,
2753,
1109,
85780,
19290,
3077,
317,
286,
1598,
16727,
8905,
4452,
2099,
4805... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_truncate() {
let mut v: Vec<Box<_>> = vec![box 6, box 5, box 4];
v.truncate(1);
let v = v;
assert_eq!(v.len(), 1);
assert_eq!(*(v[0]), 6);
} | rust_cleaned_test_functions.jsonl/12863 | {
"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,
3547,
26900,
368,
341,
262,
1077,
5206,
348,
25,
11312,
79852,
32399,
2452,
284,
7486,
20703,
2011,
220,
21,
11,
3745,
220,
20,
11,
3745,
220,
19,
935,
262,
348,
5427,
26900,
7,
16,
317,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ignore_union_typedef_from_decl_context_redecl() {
let ir = ir_from_cc(
r#"
namespace test_namespace_bindings { union MyUnion {}; }
namespace test_namespace_bindings { typedef MyUnion MyUnion; }
"#,
)
.unwrap();
assert_ir_matches!(ir, quote! { Record { ... cc_name: "MyUnion" ...}});
assert_ir_not_matches!(ir, quote! { TypeAlias { identifier: "MyUnion" ... } });
} | rust_cleaned_test_functions.jsonl/37194 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58493,
51621,
42111,
4219,
5673,
35814,
8467,
1288,
10005,
368,
341,
262,
1077,
6216,
284,
6216,
5673,
28955,
1006,
286,
435,
2,
698,
286,
4473,
1273,
41571,
94516,
314,
11300,
3017,
32658,
52166,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multipart_no_end_crlf() {
run_on(|| {
let (sender, payload) = create_stream();
let (bytes, headers) = create_simple_request_with_header();
let bytes_stripped = bytes.slice_to(bytes.len()); // strip crlf
sender.unbounded_send(Ok(bytes_stripped)).unwrap();
drop(sender); // eof
let mut multipart = Multipart::new(&headers, payload);
match multipart.poll().unwrap() {
Async::Ready(Some(_)) => (),
_ => unreachable!(),
}
match multipart.poll().unwrap() {
Async::Ready(Some(_)) => (),
_ => unreachable!(),
}
match multipart.poll().unwrap() {
Async::Ready(None) => (),
_ => unreachable!(),
}
})
} | rust_cleaned_test_functions.jsonl/43762 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 464
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
18204,
6536,
6213,
666,
2381,
69,
368,
341,
286,
1598,
4470,
79453,
341,
310,
1077,
320,
11644,
11,
7729,
8,
284,
1855,
12673,
543,
310,
1077,
320,
9651,
11,
7102,
8,
284,
1855,
30015,
78... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_unkeyed_empty() {
let mut st = Xoodyak::hash();
let mut out = [0u8; 32];
st.squeeze(&mut out);
assert_eq!(
out,
[
141, 216, 213, 137, 191, 252, 99, 169, 25, 45, 35, 27, 20, 160, 165, 255, 204, 246,
41, 214, 87, 39, 76, 114, 39, 130, 131, 52, 124, 189, 128, 53
]
);
let mut st = Xoodyak::hash();
let mut out = [0u8; 32];
st.absorb(&[]);
st.squeeze(&mut out);
assert_eq!(
out,
[
234, 21, 47, 43, 71, 188, 226, 78, 251, 102, 196, 121, 212, 173, 241, 123, 211, 36,
216, 6, 232, 95, 247, 94, 227, 105, 238, 80, 220, 143, 139, 209
]
);
} | rust_cleaned_test_functions.jsonl/125256 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 465
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
792,
291,
15124,
368,
341,
286,
1077,
5206,
357,
284,
1599,
78,
1076,
585,
486,
8296,
543,
286,
1077,
5206,
700,
284,
508,
15,
84,
23,
26,
220,
18,
17,
935,
286,
357,
61720,
2099,
6984... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pipeline_transaction() {
let ctx = TestContext::new();
block_on_all(ctx.async_connection().and_then(|con| {
let mut pipe = redis::pipe();
pipe.atomic()
.cmd("SET")
.arg("key_1")
.arg(42)
.ignore()
.cmd("SET")
.arg("key_2")
.arg(43)
.ignore()
.cmd("MGET")
.arg(&["key_1", "key_2"]);
pipe.query_async(con)
.and_then(|(_con, ((k1, k2),)): (_, ((i32, i32),))| {
assert_eq!(k1, 42);
assert_eq!(k2, 43);
Ok(())
})
}))
.unwrap();
} | rust_cleaned_test_functions.jsonl/10903 | {
"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,
45187,
28884,
368,
341,
262,
1077,
5635,
284,
3393,
1972,
486,
931,
543,
262,
2504,
4470,
5705,
7502,
24747,
15866,
1005,
437,
68367,
22428,
443,
91,
341,
286,
1077,
5206,
13647,
284,
20870,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serialize_id_unset() {
let mut builder = new_builder();
builder.id(0x0405);
builder.df_flag(true);
let mut buf = (&[0, 1, 2, 3, 3, 4, 5, 7, 8, 9])
.into_serializer()
.encapsulate(builder)
.serialize_vec_outer()
.unwrap();
let packet = buf.parse::<Ipv4Packet<_>>().unwrap();
assert_eq!(packet.id(), 0);
assert!(packet.df_flag());
assert_eq!(packet.mf_flag(), false);
assert_eq!(packet.fragment_offset(), 0);
assert_eq!(packet.fragment_type(), Ipv4FragmentType::InitialFragment);
} | rust_cleaned_test_functions.jsonl/31693 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 332
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
842,
98109,
368,
341,
286,
1077,
5206,
7363,
284,
501,
28532,
543,
286,
7363,
1764,
7,
15,
87,
15,
19,
15,
20,
317,
286,
7363,
48378,
10933,
3715,
626,
286,
1077,
5206,
6607,
284,
15899... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_typ_override() {
let p1 = json!({
"key1" : "val1",
"key2" : "val2",
"key3" : "val3"
});
let h1 = json!({"typ" : "cust", "alg" : Algorithm::ES512.to_string()});
let header = json!({"typ" : "cust"});
let jwt1 = encode(header, &get_ec_private_key_path(), &p1, Algorithm::ES512).unwrap();
let (header, payload) = decode(&jwt1, &get_ec_public_key_path(), Algorithm::ES512).unwrap();
assert_eq!(h1, header);
assert_eq!(p1, payload);
} | rust_cleaned_test_functions.jsonl/45858 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 295
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8757,
42111,
48576,
368,
341,
286,
1077,
281,
16,
284,
2951,
0,
2262,
310,
330,
792,
16,
1,
549,
330,
831,
16,
756,
310,
330,
792,
17,
1,
549,
330,
831,
17,
756,
310,
330,
792,
18,
1,
54... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_before_init() {
let _guard = crate::setup();
// Initialize cluster
let mut cluster = new_node_cluster(0, 3);
configure_for_lease_read(&mut cluster, Some(50), Some(10_000));
let pd_client = Arc::clone(&cluster.pd_client);
pd_client.disable_default_operator();
// Set region and peers
let r1 = cluster.run_conf_change();
let p1 = new_peer(1, 1);
let p2 = new_peer(2, 2);
cluster.pd_client.must_add_peer(r1, p2.clone());
cluster.must_put(b"k0", b"v0");
cluster.pd_client.must_none_pending_peer(p2.clone());
must_get_equal(&cluster.get_engine(2), b"k0", b"v0");
fail::cfg("before_apply_snap_update_region", "return").unwrap();
// Add peer 3
let p3 = new_peer(3, 3);
cluster.pd_client.must_add_peer(r1, p3.clone());
thread::sleep(Duration::from_millis(500));
let region = cluster.get_region(b"k0");
assert_eq!(cluster.leader_of_region(r1).unwrap(), p1);
let mut request = new_request(
region.get_id(),
region.get_region_epoch().clone(),
vec![new_get_cf_cmd("default", b"k0")],
false,
);
request.mut_header().set_peer(p3.clone());
request.mut_header().set_replica_read(true);
let (cb, rx) = make_cb(&request);
cluster
.sim
.rl()
.async_command_on_node(3, request, cb)
.unwrap();
let resp = rx.recv_timeout(Duration::from_secs(5)).unwrap();
assert!(
resp.get_header()
.get_error()
.get_message()
.contains("not initialized yet"),
"{:?}",
resp.get_header().get_error()
);
} | rust_cleaned_test_functions.jsonl/19972 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 755
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
23708,
6137,
368,
341,
262,
1077,
716,
26098,
284,
17717,
486,
15188,
543,
262,
442,
9008,
10652,
198,
262,
1077,
5206,
10652,
284,
501,
5084,
28441,
7,
15,
11,
220,
18,
317,
262,
14411,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_euc_jp_decode() {
// Empty
decode_euc_jp(b"", &"");
// ASCII
decode_euc_jp(b"\x61\x62", "\u{0061}\u{0062}");
// Half-width
decode_euc_jp(b"\x8E\xA1", "\u{FF61}");
decode_euc_jp(b"\x8E\xDF", "\u{FF9F}");
decode_euc_jp(b"\x8E\xA0", "\u{FFFD}");
decode_euc_jp(b"\x8E\xE0", "\u{FFFD}");
decode_euc_jp(b"\x8E\xFF", "\u{FFFD}");
decode_euc_jp(b"\x8E", "\u{FFFD}");
// JIS 0212
decode_euc_jp(b"\x8F\xA1\xA1", "\u{FFFD}");
decode_euc_jp(b"\x8F\xA2\xAF", "\u{02D8}");
decode_euc_jp(b"\x8F\xA2\xFF", "\u{FFFD}");
decode_euc_jp(b"\x8F\xA1", "\u{FFFD}");
decode_euc_jp(b"\x8F", "\u{FFFD}");
// JIS 0208
decode_euc_jp(b"\xA1\xA1", "\u{3000}");
decode_euc_jp(b"\xA1\xA0", "\u{FFFD}");
decode_euc_jp(b"\xFC\xFE", "\u{FF02}");
decode_euc_jp(b"\xFE\xFE", "\u{FFFD}");
decode_euc_jp(b"\xA1", "\u{FFFD}");
// Bad leads
decode_euc_jp(b"\xFF\xA1\xA1", "\u{FFFD}\u{3000}");
decode_euc_jp(b"\xA0\xA1\xA1", "\u{FFFD}\u{3000}");
decode_euc_jp(b"\x80\xA1\xA1", "\u{FFFD}\u{3000}");
decode_euc_jp(b"\x81\xA1\xA1", "\u{FFFD}\u{3000}");
decode_euc_jp(b"\x82\xA1\xA1", "\u{FFFD}\u{3000}");
decode_euc_jp(b"\x83\xA1\xA1", "\u{FFFD}\u{3000}");
decode_euc_jp(b"\x84\xA1\xA1", "\u{FFFD}\u{3000}");
decode_euc_jp(b"\x85\xA1\xA1", "\u{FFFD}\u{3000}");
decode_euc_jp(b"\x86\xA1\xA1", "\u{FFFD}\u{3000}");
decode_euc_jp(b"\x87\xA1\xA1", "\u{FFFD}\u{3000}");
decode_euc_jp(b"\x88\xA1\xA1", "\u{FFFD}\u{3000}");
decode_euc_jp(b"\x89\xA1\xA1", "\u{FFFD}\u{3000}");
decode_euc_jp(b"\x8A\xA1\xA1", "\u{FFFD}\u{3000}");
decode_euc_jp(b"\x8B\xA1\xA1", "\u{FFFD}\u{3000}");
decode_euc_jp(b"\x8C\xA1\xA1", "\u{FFFD}\u{3000}");
decode_euc_jp(b"\x8D\xA1\xA1", "\u{FFFD}\u{3000}");
// Bad ASCII trail
decode_euc_jp(b"\xA1\x40", "\u{FFFD}\u{0040}");
} | rust_cleaned_test_functions.jsonl/15055 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1369
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2204,
1754,
5374,
79,
15227,
368,
341,
286,
442,
22228,
198,
286,
16895,
2204,
1754,
5374,
79,
1883,
56323,
609,
3014,
626,
286,
442,
39316,
198,
286,
16895,
2204,
1754,
5374,
79,
1883,
11934,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parser() {
assert_eq!(
ByteRange {
length: 99999,
start: Some(2),
},
"99999@2".parse::<ByteRange>().unwrap()
);
assert_eq!(
ByteRange {
length: 99999,
start: Some(2),
},
"99999@2".parse::<ByteRange>().unwrap()
);
assert_eq!(
ByteRange {
length: 99999,
start: None,
},
"99999".parse::<ByteRange>().unwrap()
);
assert!("".parse::<ByteRange>().is_err());
} | rust_cleaned_test_functions.jsonl/8004 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 404
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18517,
368,
341,
286,
2060,
10714,
33673,
310,
10906,
6046,
341,
394,
3084,
25,
220,
24,
24,
24,
24,
24,
345,
394,
1191,
25,
4329,
7,
17,
1326,
310,
1153,
310,
330,
24,
24,
24,
24,
24,
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_panic_mark_file_path() {
let dir = Builder::new()
.prefix("test_panic_mark_file_path")
.tempdir()
.unwrap();
let panic_mark_file = panic_mark_file_path(dir.path());
assert_eq!(panic_mark_file, dir.path().join(PANIC_MARK_FILE))
} | rust_cleaned_test_functions.jsonl/20424 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
31270,
18924,
2458,
2638,
368,
341,
286,
1077,
5419,
284,
20626,
486,
931,
741,
310,
659,
11849,
445,
1944,
620,
31270,
18924,
2458,
2638,
1138,
310,
659,
3888,
3741,
741,
310,
659,
15454,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_object_literal_initializer_numeric_literal() {
assert_parse_success!(
primary_expression(false, false),
"{ 0: true }",
Expression::ObjectExpression {
loc: Some(((1, 0), (1, 11)).into()),
properties: vec![ObjectExpressionProperty::Property(Property {
kind: PropertyKind::Init,
key: Expression::Literal {
value: Literal::NumericLiteral(NumericLiteral(0f64)),
loc: Some(((1, 2), (1, 3)).into()),
},
value: Expression::Literal {
value: Literal::BooleanLiteral(BooleanLiteral(true)),
loc: Some(((1, 5), (1, 9)).into()),
},
method: false,
shorthand: false,
computed: false,
loc: Some(((1, 2), (1, 9)).into()),
})],
}
);
} | rust_cleaned_test_functions.jsonl/66477 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 521
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5314,
34100,
36462,
29418,
34100,
368,
341,
262,
2060,
21039,
18632,
33673,
286,
6028,
28068,
3576,
11,
895,
1326,
286,
13868,
220,
15,
25,
830,
335,
756,
286,
16378,
486,
1190,
9595,
341,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rwlock_default() {
let lock = RwLock::<usize>::default();
assert_eq!(lock.wlock.load(Ordering::Relaxed), false);
for idx in 0..MAX_READER_THREADS {
assert_eq!(lock.rlock[idx].load(Ordering::Relaxed), 0);
}
assert_eq!(unsafe { *lock.data.get() }, usize::default());
} | rust_cleaned_test_functions.jsonl/77521 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 172
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
98850,
9993,
368,
341,
286,
1077,
5296,
284,
55294,
11989,
27638,
51878,
6831,
2258,
1428,
286,
2060,
10714,
10297,
1023,
1418,
1023,
5104,
39692,
287,
486,
6740,
51451,
701,
895,
317,
286,
369,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_split_datum() {
let table = vec![
vec![Datum::I64(1)],
vec![
Datum::F64(1f64),
Datum::F64(3.15),
Datum::Bytes(b"123".to_vec()),
],
vec![
Datum::U64(1),
Datum::F64(3.15),
Datum::Bytes(b"123".to_vec()),
Datum::I64(-1),
],
vec![Datum::I64(1), Datum::I64(0)],
vec![Datum::Null],
vec![Datum::I64(100), Datum::U64(100)],
vec![Datum::U64(1), Datum::U64(1)],
vec![Datum::Dec(10.into())],
vec![
Datum::F64(1f64),
Datum::F64(3.15),
Datum::Bytes(b"123456789012345".to_vec()),
],
vec![Datum::Json(Json::from_str(r#"{"key":"value"}"#).unwrap())],
vec![
Datum::F64(1f64),
Datum::Json(Json::from_str(r#"{"key":"value"}"#).unwrap()),
Datum::F64(3.15),
Datum::Bytes(b"123456789012345".to_vec()),
],
];
for case in table {
let key_bs = encode_key(&case).unwrap();
let mut buf = key_bs.as_slice();
for exp in &case {
let (act, rem) = split_datum(buf, false).unwrap();
let exp_bs = encode_key(as_slice(exp)).unwrap();
assert_eq!(exp_bs, act);
buf = rem;
}
assert!(buf.is_empty());
let value_bs = encode_value(&case).unwrap();
let mut buf = value_bs.as_slice();
for exp in &case {
let (act, rem) = split_datum(buf, false).unwrap();
let exp_bs = encode_value(as_slice(exp)).unwrap();
assert_eq!(exp_bs, act);
buf = rem;
}
assert!(buf.is_empty());
}
} | rust_cleaned_test_functions.jsonl/10806 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1232
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
15353,
372,
368,
341,
286,
1077,
1965,
284,
7486,
90515,
310,
7486,
20703,
68036,
486,
40,
21,
19,
7,
16,
30749,
310,
7486,
90515,
394,
68459,
486,
37,
21,
19,
7,
16,
69,
21,
19,
1326... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 9 |
#[test]
fn test_single_task() {
let runner = SingleTaskRunner::default();
let rt = runner.startup().unwrap();
thread::spawn(move || {
loop {
if let Err(e) = runner.run() {
println!("!!!!!!run failed, reason: {:?}", e);
break;
}
thread::sleep(Duration::from_millis(10));
}
});
let mut ids = Vec::with_capacity(50);
for index in 0..100 {
let uid = rt.alloc();
let uid_copy = uid.clone();
let value = SyncUsize(Arc::new(RefCell::new(index)));
let future = TestFuture0::new(rt.clone(), value.clone(), uid.clone());
if let Err(e) = rt.spawn(uid.clone(), async move {
println!("!!!!!!async task start, uid: {:?}", uid_copy);
let r = future.await;
println!("!!!!!!async task finish, uid: {:?}, r: {:?}", uid_copy, r);
}) {
println!("!!!> spawn task failed, uid: {:?}, reason: {:?}", uid, e);
}
if index % 2 == 0 {
ids.push((uid, value));
}
}
thread::sleep(Duration::from_millis(3000));
for (id, value) in ids {
let id_copy = id.clone();
let uid = rt.alloc();
let uid_copy = uid.clone();
let rt_copy = rt.clone();
if let Err(e) = rt.spawn(uid, async move {
rrow_mut() += 1;
rt_copy.wakeup(&id_copy);
}) {
println!("!!!> spawn waker failed, id: {:?}, uid: {:?}, reason: {:?}", id, uid_copy, e);
}
}
thread::sleep(Duration::from_millis(100000000));
} | rust_cleaned_test_functions.jsonl/62453 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 864
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19487,
12184,
368,
972,
262,
1077,
22259,
284,
11327,
6262,
19486,
486,
2258,
1647,
262,
1077,
16677,
284,
22259,
4962,
454,
1005,
15454,
7317,
262,
4516,
486,
46087,
34081,
1369,
972,
286,
6337,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_rows_properties() {
let mut collector = MvccPropertiesCollector::new();
let num_rows = PROP_ROWS_INDEX_DISTANCE * 3 + 2;
for i in 0..num_rows {
let key = format!("k-{}", i);
let k1 = Key::from_raw(key.as_bytes()).append_ts(2);
let k1 = keys::data_key(k1.encoded());
let k2 = Key::from_raw(key.as_bytes()).append_ts(1);
let k2 = keys::data_key(k2.encoded());
let v = Write::new(WriteType::Put, 0, None).to_bytes();
collector.add(&k1, &v, DBEntryType::Put, 0, 0);
collector.add(&k2, &v, DBEntryType::Put, 0, 0);
}
let result = UserProperties(collector.finish());
let props = RowsProperties::decode(&result).unwrap();
assert_eq!(props.total_rows, num_rows);
assert_eq!(props.index_handles.len(), 5);
let cases = [
("k-0", 1, 1),
(
"k-10000",
PROP_ROWS_INDEX_DISTANCE,
PROP_ROWS_INDEX_DISTANCE + 1,
),
(
"k-20000",
PROP_ROWS_INDEX_DISTANCE,
PROP_ROWS_INDEX_DISTANCE * 2 + 1,
),
(
"k-30000",
PROP_ROWS_INDEX_DISTANCE,
PROP_ROWS_INDEX_DISTANCE * 3 + 1,
),
("k-30001", 1, PROP_ROWS_INDEX_DISTANCE * 3 + 2),
];
for &(key, size, offset) in &cases {
let k = Key::from_raw(key.as_bytes());
let k = keys::data_key(k.encoded());
let h = &props.index_handles[&k];
assert_eq!(h.size, size);
assert_eq!(h.offset, offset);
}
let h: Vec<_> = props.index_handles.values().collect();
let cases = [
("a", "z", h[4].offset),
("a", "a", 0),
("z", "z", 0),
("k-1", "k-10000", h[1].offset - h[0].offset),
("k-1", "k-20000", h[2].offset - h[0].offset),
("k-16666", "k-18888", h[2].offset - h[1].offset),
("k-16666", "k-26666", h[3].offset - h[1].offset),
];
for &(start, end, rows) in &cases {
let start = keys::data_key(start.as_bytes());
let end = keys::data_key(end.as_bytes());
assert_eq!(props.get_approximate_rows_in_range(&start, &end), rows);
}
} | rust_cleaned_test_functions.jsonl/22207 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1384
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10949,
25158,
368,
341,
286,
1077,
5206,
31953,
284,
386,
85,
638,
7903,
53694,
486,
931,
543,
286,
1077,
1629,
10949,
284,
41977,
62725,
14515,
63217,
353,
220,
18,
488,
220,
17,
280,
286,
369,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_sigpipe_panic() {
let mut cmd = new_ucmd!();
let mut child = cmd.args(&["ext_sort.txt"]).run_no_wait();
// Dropping the stdout should not lead to an error.
// The "Broken pipe" error should be silently ignored.
drop(child.stdout.take());
assert_eq!(
String::from_utf8(child.wait_with_output().unwrap().stderr),
Ok(String::new())
);
} | rust_cleaned_test_functions.jsonl/20538 | {
"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,
29252,
13768,
620,
31270,
368,
341,
262,
1077,
5206,
5439,
284,
501,
68887,
2277,
0,
543,
262,
1077,
5206,
1682,
284,
5439,
16365,
2099,
1183,
427,
18435,
3909,
45014,
6108,
6536,
18760,
543,
262,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_primitive_type() {
let x = 0xf312_u16;
let mut wtr: Vec<u8> = vec![];
wtr.extend_from_slice(&x.to_le_bytes());
assert_eq!(x.test_only_hash(), HashValue::sha3_256_of(&wtr[..]));
let x = 0x_ff001234_u32;
let mut wtr: Vec<u8> = vec![];
wtr.extend_from_slice(&x.to_le_bytes());
assert_eq!(x.test_only_hash(), HashValue::sha3_256_of(&wtr[..]));
let x = 0x_89abcdef_01234567_u64;
let mut wtr: Vec<u8> = vec![];
wtr.extend_from_slice(&x.to_le_bytes());
assert_eq!(x.test_only_hash(), HashValue::sha3_256_of(&wtr[..]));
} | rust_cleaned_test_functions.jsonl/118035 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 298
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84087,
1819,
368,
341,
262,
1077,
856,
284,
220,
15,
5848,
18,
16,
17,
7300,
16,
21,
280,
262,
1077,
5206,
289,
376,
25,
11312,
34837,
23,
29,
284,
7486,
0,
15078,
262,
289,
376,
15831,
5673... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_keys() {
if get_effective_uid() == 0 {
panic!("can't run tests as root");
}
let dir = make_ssh_dir().expect("make_ssh_dir() failed");
let formatted_dir = dir.path().join(KEYS_SUBDIR).to_string_lossy().into_owned();
do_read_keys(
dir.path(),
&format!(
"# {dir}/a
file-a-no-newline
# {dir}/b
file-b
file-b2
# {dir}/e
# {dir}/nl\u{fffd}nl
file-nl
# {dir}/sf
file-a-no-newline
",
dir = formatted_dir
),
&format!(
"Error: {dir}/.h is a dotfile, ignoring
Error: opening {dir}/c
Caused by: Permission denied (os error 13)
Error: {dir}/d is not a file, ignoring
Error: {dir}/dnp is not a file, ignoring
Error: {dir}/fifo is not a file, ignoring
Error: {dir}/sd is not a file, ignoring
Error: couldn't stat {dir}/snx
Caused by: No such file or directory (os error 2)
",
dir = formatted_dir
),
)
.expect("read_keys() failed");
} | rust_cleaned_test_functions.jsonl/76309 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 536
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
12631,
368,
341,
286,
421,
633,
27125,
533,
25396,
368,
621,
220,
15,
341,
310,
21975,
17223,
4814,
944,
1598,
7032,
438,
3704,
797,
286,
555,
286,
1077,
5419,
284,
1281,
82805,
4334,
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... | 2 |
#[test]
fn test_resource_block_with_undeclared_nonlocal_shorthand_rule_body() {
let p = Polar::new();
p.register_constant(sym!("Repo"), term!("unimportant"))
.unwrap();
p.register_constant(sym!("Org"), term!("unimportant"))
.unwrap();
expect_error(
&p,
r#"resource Repo {
roles = ["writer"];
relations = { parent: Org };
"writer" if "owner" on "parent";
}"#,
r#"Repo: Relation "parent" in rule body `"owner" on "parent"` has type 'Org', but no such resource block exists. Try declaring one: `resource Org {}`"#,
);
expect_error(
&p,
r#"resource Repo {
roles = ["writer"];
relations = { parent: Org };
"writer" if "owner" on "parent";
}
resource Org {}"#,
r#"Repo: Term "owner" not declared in related resource block 'Org'. Did you mean to declare it as a role, permission, or relation in the 'Org' resource block?"#,
);
} | rust_cleaned_test_functions.jsonl/31743 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 561
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17962,
7113,
6615,
62,
28865,
86251,
21637,
2438,
3712,
61679,
21124,
14114,
368,
341,
286,
1077,
281,
284,
55896,
486,
931,
543,
286,
281,
9929,
34967,
62512,
17223,
25243,
3975,
4647,
17223,
359,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sample() {
let min_val = 1;
let max_val = 100;
let mut r = task_rng();
let vals = range(min_val, max_val).collect::<Vec<int>>();
let small_sample = r.sample(vals.iter(), 5);
let large_sample = r.sample(vals.iter(), vals.len() + 5);
assert_eq!(small_sample.len(), 5);
assert_eq!(large_sample.len(), vals.len());
assert!(small_sample.iter().all(|e| {
**e >= min_val && **e <= max_val
}));
} | rust_cleaned_test_functions.jsonl/46783 | {
"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,
17491,
368,
341,
286,
1077,
1308,
6189,
284,
220,
16,
280,
286,
1077,
1932,
6189,
284,
220,
16,
15,
15,
401,
286,
1077,
5206,
435,
284,
3383,
66849,
543,
286,
1077,
28356,
284,
2088,
14146,
61... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_doc_stripping_specs() {
Command::cargo_bin("specdown")
.unwrap()
.arg("--no-colour")
.arg("run")
.arg("--running-dir")
.arg(".specdown")
.arg("docs/cli/stripping_specs_windows.md")
.assert()
.success();
} | rust_cleaned_test_functions.jsonl/104105 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 158
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18869,
1261,
461,
10732,
71200,
368,
341,
262,
7348,
486,
66715,
21816,
445,
9535,
2923,
1138,
286,
659,
15454,
741,
286,
659,
858,
21549,
2152,
19459,
413,
1138,
286,
659,
858,
445,
6108,
1138,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_t124() {
init();
let result = t124(&OS_TYPE, &OS_VERSION, &SIM_INFO, &APN);
println!("{}", result.len());
println!("{:?}", result);
} | rust_cleaned_test_functions.jsonl/104730 | {
"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,
528,
16,
17,
19,
368,
341,
286,
2930,
543,
286,
1077,
1102,
284,
259,
16,
17,
19,
2099,
3126,
4189,
11,
609,
3126,
10678,
11,
609,
46616,
9068,
11,
609,
2537,
45,
317,
286,
13751,
79878,
110... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_atan_2_args() {
let test_cases = vec![
(
Some(Real::new(0.0_f64).unwrap()),
Some(Real::new(0.0_f64).unwrap()),
Some(Real::new(0.0_f64).unwrap()),
),
(
Some(Real::new(0.0_f64).unwrap()),
Some(Real::new(-1.0_f64).unwrap()),
Some(Real::new(std::f64::consts::PI).unwrap()),
),
(
Some(Real::new(1.0_f64).unwrap()),
Some(Real::new(-1.0_f64).unwrap()),
Some(Real::new(3.0_f64 * std::f64::consts::PI / 4.0_f64).unwrap()),
),
(
Some(Real::new(-1.0_f64).unwrap()),
Some(Real::new(1.0_f64).unwrap()),
Some(Real::new(-std::f64::consts::PI / 4.0_f64).unwrap()),
),
(
Some(Real::new(1.0_f64).unwrap()),
Some(Real::new(0.0_f64).unwrap()),
Some(Real::new(std::f64::consts::PI / 2.0_f64).unwrap()),
),
];
for (arg0, arg1, expect) in test_cases {
let output: Option<Real> = RpnFnScalarEvaluator::new()
.push_param(arg0)
.push_param(arg1)
.evaluate(ScalarFuncSig::Atan2Args)
.unwrap();
assert!((output.unwrap() - expect.unwrap()).abs() < f64::EPSILON);
}
} | rust_cleaned_test_functions.jsonl/9500 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 920
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3752,
276,
62,
17,
8384,
368,
341,
286,
1077,
1273,
41427,
284,
7486,
90515,
310,
2399,
394,
4329,
7,
12768,
486,
931,
7,
15,
13,
15,
761,
21,
19,
568,
15454,
14702,
394,
4329,
7,
12768,
486... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_tera_templates() {
let rocket = rocket();
let mut map = HashMap::new();
map.insert("title", "_test_");
map.insert("content", "<script />");
let template = Template::show(&rocket, "tera/txt_test", &map);
assert_eq!(template, Some(UNESCAPED_EXPECTED.into()));
let template = Template::show(&rocket, "tera/html_test", &map);
assert_eq!(template, Some(ESCAPED_EXPECTED.into()));
} | rust_cleaned_test_functions.jsonl/32041 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 220
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
50037,
49526,
368,
341,
286,
1077,
24306,
284,
24306,
543,
286,
1077,
5206,
2415,
284,
10528,
486,
931,
543,
286,
2415,
7030,
445,
2102,
497,
9000,
1944,
62,
797,
286,
2415,
7030,
445,
1796,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stack_overflow_fn_calls() -> Result<(), Box<EvalAltResult>> {
let engine = Engine::new();
assert_eq!(
engine.eval::<INT>(
r"
fn foo(n) { if n <= 1 { 0 } else { n + foo(n-1) } }
foo(6)
",
)?,
20
);
let max = engine.max_call_levels();
#[cfg(not(feature = "unchecked"))]
assert!(matches!(
*engine
.eval::<()>(&format!(
r"
fn foo(n) {{ if n == 0 {{ 0 }} else {{ n + foo(n-1) }} }}
foo({})
",
max + 1
))
.expect_err("should error"),
EvalAltResult::ErrorStackOverflow(_)
));
Ok(())
} | rust_cleaned_test_functions.jsonl/18320 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 446
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15528,
79073,
15246,
45636,
368,
1464,
5714,
68843,
8261,
23835,
831,
26017,
2077,
2452,
341,
262,
1077,
4712,
284,
8200,
486,
931,
1428,
262,
2060,
10714,
33673,
286,
4712,
31710,
27638,
3221,
1705... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_configure_system() {
let mut vmm = create_vmm_object(InstanceState::Uninitialized);
assert_eq!(
vmm.configure_system().unwrap_err().to_string(),
"Cannot start microvm without kernel configuration."
);
vmm.default_kernel_config(None);
assert_eq!(
vmm.configure_system().unwrap_err().to_string(),
"Invalid Memory Configuration: MemoryNotInitialized"
);
assert!(vmm.init_guest_memory().is_ok());
assert!(vmm.vm.get_memory().is_some());
assert!(vmm.configure_system().is_ok());
} | rust_cleaned_test_functions.jsonl/93124 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 287
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75887,
17687,
368,
341,
286,
1077,
5206,
348,
3821,
284,
1855,
2273,
3821,
5314,
7,
8846,
486,
1806,
36161,
317,
286,
2060,
10714,
33673,
310,
348,
3821,
21343,
17687,
1005,
15454,
9266,
1005,
983... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_psbt_malformed_tx_input() {
let (wallet, _, _) = get_funded_wallet(get_test_wpkh());
let send_to = wallet.get_address(AddressIndex::New).unwrap();
let mut builder = wallet.build_tx();
builder.add_recipient(send_to.script_pubkey(), 10_000);
let (mut psbt, _) = builder.finish().unwrap();
psbt.global.unsigned_tx.input.push(TxIn::default());
let options = SignOptions {
trust_witness_utxo: true,
..Default::default()
};
let _ = wallet.sign(&mut psbt, options).unwrap();
} | rust_cleaned_test_functions.jsonl/94322 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 271
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26047,
12755,
717,
278,
10155,
17805,
5898,
368,
341,
286,
1077,
320,
35735,
11,
8358,
27439,
284,
633,
761,
36053,
62308,
5433,
4452,
1670,
20819,
71,
1423,
286,
1077,
3624,
2346,
284,
15085,
670... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sorts_lexically() {
let test_cases = [(&b"A$C$G$T$"[..], "simple"),
(&b"A$A$T$T$"[..], "duplicates"),
(&b"AA$GA$CA$TA$TC$TG$GT$GC$"[..], "two letter"),
(&b"AGCCAT$\
CAGCC$"[..],
"substring"),
(&b"GTAGGCCTAATTATAATCAGCGGACATTTCGTATTGCTCGGGCTGCCAGGATTTTAGCATCAGTAGCCGGGTAATGGAACCTCAAGAGGTCAGCGTCGAA$\
AATCAGCGGACATTTCGTATTGCTCGGGCTGCCAGGATTTTAGCATCAGTAGCCGGGTAATGGAACCTCAAGAGGTCAGCGTCGAATGGCTATTCCAATA$"[..],
"complex"),
(&b"GTAGGCCTAATTATAATCAGCGGACATTTCGTATTGCTCGGGCTGCCAGGATTTTAGCATCAGTAGCCGGGTAATGGAACCTCAAGAGGTCAGCGTCGAA$\
TTCGACGCTGACCTCTTGAGGTTCCATTACCCGGCTACTGATGCTAAAATCCTGGCAGCCCGAGCAATACGAAATGTCCGCTGATTATAATTAGGCCTAC$\
AATCAGCGGACATTTCGTATTGCTCGGGCTGCCAGGATTTTAGCATCAGTAGCCGGGTAATGGAACCTCAAGAGGTCAGCGTCGAATGGCTATTCCAATA$\
TATTGGAATAGCCATTCGACGCTGACCTCTTGAGGTTCCATTACCCGGCTACTGATGCTAAAATCCTGGCAGCCCGAGCAATACGAAATGTCCGCTGATT$"[..],
"complex with revcomps"),
];
for &(text, test_name) in test_cases.iter() {
let pos = suffix_array(text);
for i in 0..(pos.len() - 2) {
// Check that every element in the suffix array is lexically <= the next elem
let cur = str_from_pos(&pos, &text, i);
let next = str_from_pos(&pos, &text, i + 1);
assert!(
cur <= next,
format!(
"Failed:\n{}\n{}\nat positions {} and {} are out of order in \
test: {}",
cur,
next,
pos[i],
pos[i + 1],
test_name
)
);
}
}
} | rust_cleaned_test_functions.jsonl/71446 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1207
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18435,
82,
74547,
2673,
368,
341,
286,
1077,
1273,
41427,
284,
1797,
508,
2099,
65,
29133,
3,
34,
3,
38,
3,
51,
3,
36864,
496,
1125,
330,
22944,
4461,
1797,
15899,
65,
29133,
3,
32,
3,
51,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_local_connection() {
let mut ctx = MuxerTestContext::new("local_connection");
let peer_port = 1025;
let (mut stream, local_port) = ctx.local_connect(peer_port);
// Test guest -> host data flow.
let data = [1, 2, 3, 4];
ctx.init_data_pkt(local_port, peer_port, &data);
ctx.send();
let mut buf = vec![0u8; data.len()];
stream.read_exact(buf.as_mut_slice()).unwrap();
assert_eq!(buf.as_slice(), &data);
// Test host -> guest data flow.
let data = [5, 6, 7, 8];
stream.write_all(&data).unwrap();
ctx.notify_muxer();
assert!(ctx.muxer.has_pending_rx());
ctx.recv();
assert_eq!(ctx.pkt.op(), uapi::VSOCK_OP_RW);
assert_eq!(ctx.pkt.src_port(), local_port);
assert_eq!(ctx.pkt.dst_port(), peer_port);
assert_eq!(ctx.pkt.buf().unwrap()[..data.len()], data);
} | rust_cleaned_test_functions.jsonl/37601 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 471
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13564,
15866,
368,
341,
286,
1077,
5206,
5635,
284,
386,
2200,
261,
2271,
1972,
486,
931,
445,
2438,
15866,
797,
286,
1077,
14397,
8716,
284,
220,
16,
15,
17,
20,
280,
286,
1077,
320,
6984,
42... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_optflag_missing() {
let args = vec!["blah".to_string()];
match Options::new().optflag("t", "test", "testing").parse(&args) {
Ok(ref m) => {
assert!(!m.opt_present("test"));
assert!(!m.opt_present("t"));
}
_ => panic!(),
}
} | rust_cleaned_test_functions.jsonl/52363 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 157
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15032,
9903,
40447,
368,
341,
262,
1077,
2827,
284,
7486,
0,
1183,
70614,
3263,
983,
3904,
33800,
262,
2432,
14566,
486,
931,
1005,
2912,
9903,
445,
83,
497,
330,
1944,
497,
330,
8840,
1827,
640... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_transaction_with_program_ids_passed_to_programs() {
let (genesis_config, mint_keypair) = create_genesis_config(500);
let mut bank = Bank::new(&genesis_config);
#[allow(clippy::unnecessary_wraps)]
fn mock_process_instruction(
_program_id: &Pubkey,
_data: &[u8],
_invoke_context: &mut dyn InvokeContext,
) -> result::Result<(), InstructionError> {
Ok(())
}
let mock_program_id = Pubkey::new(&[2u8; 32]);
bank.add_builtin("mock_program", mock_program_id, mock_process_instruction);
let from_pubkey = solana_sdk::pubkey::new_rand();
let to_pubkey = solana_sdk::pubkey::new_rand();
let dup_pubkey = from_pubkey;
let from_account = AccountSharedData::new(100, 1, &mock_program_id);
let to_account = AccountSharedData::new(0, 1, &mock_program_id);
bank.store_account(&from_pubkey, &from_account);
bank.store_account(&to_pubkey, &to_account);
let account_metas = vec![
AccountMeta::new(from_pubkey, false),
AccountMeta::new(to_pubkey, false),
AccountMeta::new(dup_pubkey, false),
AccountMeta::new(mock_program_id, false),
];
let instruction = Instruction::new_with_bincode(mock_program_id, &10, account_metas);
let tx = Transaction::new_signed_with_payer(
&[instruction],
Some(&mint_keypair.pubkey()),
&[&mint_keypair],
bank.last_blockhash(),
);
let result = bank.process_transaction(&tx);
assert_eq!(result, Ok(()));
} | rust_cleaned_test_functions.jsonl/2629 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 787
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28884,
6615,
25096,
8077,
87405,
2346,
25096,
82,
368,
341,
286,
1077,
320,
77894,
5332,
11,
28337,
3097,
12670,
8,
284,
1855,
16322,
13774,
5332,
7,
20,
15,
15,
317,
286,
1077,
5206,
6073,
284,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_coersion_of_nulls() {
assert_eq!(coerce_data_type(&[DataType::Null]), DataType::Null);
assert_eq!(
coerce_data_type(&[DataType::Null, DataType::Boolean]),
DataType::Utf8
);
let vec: Vec<DataType> = vec![];
assert_eq!(coerce_data_type(vec.as_slice()), DataType::Null);
} | rust_cleaned_test_functions.jsonl/45742 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11393,
1325,
3575,
15162,
82,
368,
341,
286,
2060,
10714,
10297,
1015,
25641,
1769,
1819,
2099,
58,
22653,
486,
3280,
9719,
33172,
486,
3280,
317,
286,
2060,
10714,
33673,
310,
83025,
1769,
1819,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_last_successful_build_when_all_releases_failed_or_yanked() {
wrapper(|env| {
let db = env.db();
env.fake_release()
.name("foo")
.version("0.0.1")
.build_result_failed()
.create()?;
env.fake_release()
.name("foo")
.version("0.0.2")
.build_result_failed()
.create()?;
env.fake_release()
.name("foo")
.version("0.0.3")
.yanked(true)
.create()?;
assert_last_successful_build_equals(db, "foo", "0.0.1", None)?;
assert_last_successful_build_equals(db, "foo", "0.0.2", None)?;
assert_last_successful_build_equals(db, "foo", "0.0.3", None)?;
Ok(())
});
} | rust_cleaned_test_functions.jsonl/6494 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 534
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12195,
92951,
20801,
47636,
5705,
1288,
28299,
35060,
8734,
4178,
40772,
368,
341,
286,
13261,
22428,
3160,
91,
341,
310,
1077,
2927,
284,
6105,
7076,
1428,
310,
6105,
94624,
24577,
741,
394,
659,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
#[test]
fn test_find_all_refs_nested_module() {
check(
r#"
//- /lib.rs
mod foo { mod bar; }
fn f$0() {}
//- /foo/bar.rs
use crate::f;
fn g() { f(); }
"#,
expect![[r#"
f Function FileId(0) 22..31 25..26
FileId(1) 11..12
FileId(1) 24..25
"#]],
);
} | rust_cleaned_test_functions.jsonl/60659 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 228
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
5705,
60638,
66279,
10750,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
61463,
608,
2740,
25638,
198,
2593,
15229,
314,
1463,
3619,
26,
555,
8822,
282,
3,
15,
368,
10086,
61463,
608,
7975... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create() {
let xyz = ThinStr::empty();
let abc = ThinStr::new("foo").clone();
assert_eq!(xyz.len(), 0);
assert_eq!(xyz, "");
assert!(xyz.is_empty());
assert_eq!(abc.len(), 3);
assert_eq!(abc, "foo");
let xyz2 = xyz.clone();
assert_eq!(xyz2.len(), 0);
assert_eq!(xyz2, "");
let s = ThinStr::new("abcde");
assert_eq!(s.len(), 5);
let t: ThinStr = "foo".into();
assert_ne!(t, s);
let q = s.clone();
assert_eq!(s, q);
let z3 = ThinStr::new_zeroed(3);
assert_eq!(z3, "\0\0\0");
let z3 = ThinStr::new_zeroed(0);
assert_eq!(z3, "");
} | rust_cleaned_test_functions.jsonl/59275 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 402
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
368,
341,
286,
1077,
40511,
284,
69622,
2580,
486,
3194,
543,
286,
1077,
39022,
284,
69622,
2580,
486,
931,
445,
7975,
1827,
19982,
543,
286,
2060,
10714,
10297,
28854,
19406,
1507,
220,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_next() {
let storage = create_storage();
// Currently we accept unordered ranges.
let ranges: Vec<Range> = vec![
IntervalRange::from(("foo", "foo_2a")).into(),
PointRange::from("foo_2b").into(),
PointRange::from("foo_3").into(),
IntervalRange::from(("a", "c")).into(),
];
let mut scanner = RangesScanner::new(RangesScannerOptions {
storage: storage.clone(),
ranges,
scan_backward_in_range: false,
is_key_only: false,
is_scanned_range_aware: false,
});
assert_eq!(
scanner.next().unwrap(),
Some((b"foo".to_vec(), b"1".to_vec()))
);
assert_eq!(
scanner.next().unwrap(),
Some((b"foo_2".to_vec(), b"3".to_vec()))
);
assert_eq!(
scanner.next().unwrap(),
Some((b"foo_3".to_vec(), b"5".to_vec()))
);
assert_eq!(
scanner.next().unwrap(),
Some((b"bar".to_vec(), b"2".to_vec()))
);
assert_eq!(
scanner.next().unwrap(),
Some((b"bar_2".to_vec(), b"4".to_vec()))
);
assert_eq!(scanner.next().unwrap(), None);
// Backward in range
let ranges: Vec<Range> = vec![
IntervalRange::from(("foo", "foo_2a")).into(),
PointRange::from("foo_2b").into(),
PointRange::from("foo_3").into(),
IntervalRange::from(("a", "bar_2")).into(),
];
let mut scanner = RangesScanner::new(RangesScannerOptions {
storage: storage.clone(),
ranges,
scan_backward_in_range: true,
is_key_only: false,
is_scanned_range_aware: false,
});
assert_eq!(
scanner.next().unwrap(),
Some((b"foo_2".to_vec(), b"3".to_vec()))
);
assert_eq!(
scanner.next().unwrap(),
Some((b"foo".to_vec(), b"1".to_vec()))
);
assert_eq!(
scanner.next().unwrap(),
Some((b"foo_3".to_vec(), b"5".to_vec()))
);
assert_eq!(
scanner.next().unwrap(),
Some((b"bar".to_vec(), b"2".to_vec()))
);
assert_eq!(scanner.next().unwrap(), None);
// Key only
let ranges: Vec<Range> = vec![
IntervalRange::from(("bar", "foo_2a")).into(),
PointRange::from("foo_3").into(),
PointRange::from("bar_3").into(),
];
let mut scanner = RangesScanner::new(RangesScannerOptions {
storage,
ranges,
scan_backward_in_range: false,
is_key_only: true,
is_scanned_range_aware: false,
});
assert_eq!(scanner.next().unwrap(), Some((b"bar".to_vec(), Vec::new())));
assert_eq!(
scanner.next().unwrap(),
Some((b"bar_2".to_vec(), Vec::new()))
);
assert_eq!(scanner.next().unwrap(), Some((b"foo".to_vec(), Vec::new())));
assert_eq!(
scanner.next().unwrap(),
Some((b"foo_2".to_vec(), Vec::new()))
);
assert_eq!(
scanner.next().unwrap(),
Some((b"foo_3".to_vec(), Vec::new()))
);
assert_eq!(scanner.next().unwrap(), None);
} | rust_cleaned_test_functions.jsonl/17917 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1850
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11257,
368,
341,
286,
1077,
5819,
284,
1855,
23310,
1428,
286,
442,
24150,
582,
4193,
55733,
21283,
624,
286,
1077,
21283,
25,
11312,
27,
6046,
29,
284,
7486,
90515,
310,
40584,
6046,
486,
1499,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_old_messages() {
setup_for_test();
let mut tt = Network::new(vec![None, None, None]);
tt.send(vec![new_message(1, 1, MessageType::MsgHup, 0)]);
tt.send(vec![new_message(2, 2, MessageType::MsgHup, 0)]);
tt.send(vec![new_message(1, 1, MessageType::MsgHup, 0)]);
// pretend we're an old leader trying to make progress; this entry is expected to be ignored.
let mut m = new_message(2, 1, MessageType::MsgAppend, 0);
m.set_term(2);
m.set_entries(RepeatedField::from_vec(vec![empty_entry(2, 3)]));
tt.send(vec![m]);
// commit a new entry
tt.send(vec![new_message(1, 1, MessageType::MsgPropose, 1)]);
let ents = vec![
empty_entry(1, 1),
empty_entry(2, 2),
empty_entry(3, 3),
new_entry(3, 4, SOME_DATA),
];
let ilog = new_raft_log(&ents, 5, 4);
let base = ltoa(&ilog);
for (id, p) in &tt.peers {
let l = ltoa(&p.raft_log);
if l != base {
panic!("#{}: raft_log: {}, want: {}", id, l, base);
}
}
} | rust_cleaned_test_functions.jsonl/107109 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 512
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21108,
23428,
368,
341,
262,
6505,
5478,
4452,
543,
262,
1077,
5206,
17853,
284,
8141,
486,
931,
25592,
20703,
4064,
11,
2240,
11,
2240,
2558,
1066,
262,
17853,
5219,
25592,
20703,
931,
6462,
7,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_unix() {
let ready = Arc::new((Mutex::new(false), Condvar::new()));
let ready_clone = Arc::clone(&ready);
let tmp = tempfile::tempdir().unwrap();
let path = tmp.path().join("soccer");
let send_path = path.to_owned();
let server = thread::Builder::new()
.name("server".to_string())
.spawn(move || {
server(ready, &send_path);
})
.unwrap();
let send_path = path.to_owned();
let client = thread::Builder::new()
.name("client".to_string())
.spawn(move || {
client(
ready_clone,
&send_path,
&[
(&["1", "2"], 3),
(&["4", "77", "103"], 184),
(&["5", "78", "104"], 187),
(&[], 0),
],
);
})
.unwrap();
client.join().unwrap();
server.join().unwrap();
} | rust_cleaned_test_functions.jsonl/15671 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 515
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
80572,
368,
341,
262,
1077,
5527,
284,
19689,
486,
931,
1188,
38099,
486,
931,
3576,
701,
44826,
947,
486,
931,
7392,
262,
1077,
5527,
54742,
284,
19689,
486,
19982,
2099,
2307,
626,
262,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_store_opcode() {
let default_code = vec![0x60, 0x00, 0x60, 0x05, 0x55];
let mut vm = VM::new(default_code).with_simple_memory().with_random_address();
vm.storage = Some(Storage::new(vm.address.unwrap()));
assert!(vm.execute_one().is_ok());
assert!(vm.execute_one().is_ok());
} | rust_cleaned_test_functions.jsonl/125712 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14809,
71319,
368,
341,
286,
1077,
1638,
4136,
284,
7486,
20703,
15,
87,
21,
15,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
21,
15,
11,
220,
15,
87,
15,
20,
11,
220,
15,
87,
20,
20,
935... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compute_retransmit_peers_with_fanout_five() {
const FANOUT: usize = 5;
const NUM_NODES: usize = 2048;
const SEED: [u8; 32] = [0x55; 32];
let mut rng = ChaChaRng::from_seed(SEED);
let mut index: Vec<_> = (0..NUM_NODES).collect();
index.shuffle(&mut rng);
let (neighbors, children) = compute_retransmit_peers(FANOUT, 17, &index);
assert_eq!(neighbors, vec![1410, 1293, 1810, 552, 512]);
assert_eq!(children, vec![511, 1989, 283, 1606, 1154]);
} | rust_cleaned_test_functions.jsonl/11680 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 270
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57028,
1288,
1458,
1763,
36367,
388,
6615,
761,
276,
411,
95258,
368,
341,
286,
733,
434,
1093,
3656,
25,
22301,
284,
220,
20,
280,
286,
733,
15943,
92948,
25,
22301,
284,
220,
17,
15,
19,
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_monte_carlo_pi_1() {
let pi = monte_carlo_pi(1);
assert!(pi == 0_f32 || pi == 4_f32);
} | rust_cleaned_test_functions.jsonl/14769 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 76
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
52277,
26616,
385,
47771,
62,
16,
368,
341,
286,
1077,
8938,
284,
20007,
68,
26616,
385,
47771,
7,
16,
317,
286,
2060,
10297,
2493,
621,
220,
15,
761,
18,
17,
1369,
8938,
621,
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
] | 2 |
#[test]
fn test_list_dex_ids_should_pass() {
let mut ext = ExtBuilder {
initial_dex_list: vec![
(
DEX_A_ID,
DEXInfo {
base_asset_id: XOR,
is_public: true,
},
),
(
DEX_B_ID,
DEXInfo {
base_asset_id: XOR,
is_public: true,
},
),
],
initial_permission_owners: vec![
(MANAGE_DEX, Scope::Limited(hash(&DEX_A_ID)), vec![ALICE]),
(MANAGE_DEX, Scope::Limited(hash(&DEX_B_ID)), vec![BOB]),
],
initial_permissions: vec![
(ALICE, Scope::Limited(hash(&DEX_A_ID)), vec![MANAGE_DEX]),
(ALICE, Scope::Limited(hash(&DEX_B_ID)), vec![MANAGE_DEX]),
],
..Default::default()
}
.build();
ext.execute_with(|| {
assert_eq!(DEXModule::list_dex_ids(), vec![DEX_A_ID, DEX_B_ID]);
})
} | rust_cleaned_test_functions.jsonl/110308 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 637
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2019,
814,
327,
8077,
43378,
15464,
368,
341,
262,
1077,
5206,
1303,
284,
9447,
3297,
341,
286,
2856,
814,
327,
2019,
25,
7486,
90515,
310,
2399,
394,
422,
3257,
1566,
3450,
345,
394,
422,
3257,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_adjust_lockouts_after_replay_all_not_found_even_if_rooted() {
let mut tower = Tower::new_for_tests(10, 0.9);
tower.vote_state.root_slot = Some(4);
tower.record_vote(5, Hash::default());
tower.record_vote(6, Hash::default());
let mut slot_history = SlotHistory::default();
slot_history.add(0);
slot_history.add(1);
slot_history.add(2);
slot_history.add(7);
let replayed_root_slot = 7;
let result = tower.adjust_lockouts_after_replay(replayed_root_slot, &slot_history);
assert_eq!(
format!("{}", result.unwrap_err()),
"The tower is fatally inconsistent with blockstore: no common slot for rooted tower"
);
} | rust_cleaned_test_functions.jsonl/61169 | {
"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,
44153,
9818,
11672,
19844,
1288,
1363,
5705,
7913,
21480,
68347,
11119,
12993,
291,
368,
341,
286,
1077,
5206,
21271,
284,
21938,
486,
931,
5478,
32509,
7,
16,
15,
11,
220,
15,
13,
24,
317,
286,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_transfer() {
let data: Vec<u8> = (0..2 * BUFF_SIZE).map(|_| rand::random::<u8>()).collect();
let _ret = fs::create_dir("tmp");
let mut src = File::create("tmp/src").unwrap();
let mut dst = File::create("tmp/dst").unwrap();
let _ret = src.write_all(&data);
let mut src = File::open("tmp/src").unwrap();
while !transfer(&mut src, &mut dst) {}
let status = Command::new("cmp")
.arg("tmp/src")
.arg("tmp/dst")
.status()
.expect("command");
let _ret = fs::remove_dir_all("tmp");
assert!(status.success());
} | rust_cleaned_test_functions.jsonl/26652 | {
"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,
35403,
368,
341,
286,
1077,
821,
25,
11312,
34837,
23,
29,
284,
320,
15,
496,
17,
353,
94924,
4098,
568,
2186,
22428,
35395,
10382,
486,
11463,
27638,
84,
23,
29,
6011,
17384,
1428,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_shareable_file_close_unblocks_reads_without_error() {
// This test exercises a threading condition that cannot be reproduced in a non-racy manner.
// correctly fail. Running this same test a few times ensures that we have higher chances
// of catching a problem.
for _ in 0..10 {
try_shareable_file_close_unblocks_reads_without_error()
}
} | rust_cleaned_test_functions.jsonl/54830 | {
"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,
38272,
480,
2458,
12704,
4907,
21928,
66628,
39904,
4096,
368,
341,
286,
442,
1096,
1273,
22932,
264,
30159,
2971,
429,
4157,
387,
54617,
304,
264,
2477,
3795,
2757,
11566,
624,
1789,
286,
442,
12... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_compress_fail() {
#[cfg(not(windows))]
TestScenario::new(util_name!())
.ucmd_keepenv()
.args(&[
"ext_sort.txt",
"-n",
"--compress-program",
"nonexistent-program",
"-S",
"10",
])
.fails()
.stderr_only("sort: couldn't execute compress program: errno 2");
#[cfg(windows)]
TestScenario::new(util_name!())
.ucmd_keepenv()
.args(&[
"ext_sort.txt",
"-n",
"--compress-program",
"nonexistent-program",
"-S",
"10",
])
.fails();
} | rust_cleaned_test_functions.jsonl/20535 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 417
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
87845,
22121,
368,
341,
262,
11506,
14072,
24772,
3622,
1491,
22297,
262,
3393,
54031,
486,
931,
67811,
1269,
0,
2398,
286,
659,
1754,
2277,
50293,
3160,
741,
286,
659,
2116,
2099,
9640,
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... | 1 |
#[test]
fn test_since_now() {
let _executor = fasync::Executor::new().expect("unable to create executor");
let tmp_dir = TempDir::new().expect("should have created tempdir");
let file_path = tmp_dir.path().join("tmp_file");
let tmp_file = File::create(&file_path).expect("should have created file");
let mut expected = "".to_string();
// since_now message filter test
let mut filter_options = LocalOptions::default();
// ignored
filter_options.since_time = Some(1000000000);
let mut l = Listener::new(tmp_file, filter_options, Decorator::new());
let mut msg = LogMessage {
pid: 0,
tid: 0,
severity: 0,
time: 0,
msg: String::default(),
dropped_logs: 0,
tags: vec![],
};
msg.msg = "foobar".to_string();
l.log(copy_log_message(&msg));
msg.msg = "foobar".to_string();
msg.time = 2000000000;
l.log(copy_log_message(&msg));
expected.push_str("[00002.000000][0][0][] INFO: foobar\n");
// Compare the log output with the expectation.
let mut tmp_file = File::open(&file_path).expect("should have opened the file");
let mut content = String::new();
tmp_file.read_to_string(&mut content).expect("something went wrong reading the file");
assert_eq!(content, expected);
} | rust_cleaned_test_functions.jsonl/113586 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 661
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56262,
20813,
368,
341,
286,
1077,
716,
80787,
284,
282,
7692,
486,
25255,
486,
931,
1005,
17119,
445,
45928,
311,
1855,
31558,
797,
286,
1077,
4174,
4334,
284,
19944,
6184,
486,
931,
1005,
17119,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_spoofed_stake_accounts() {
assert_eq!(
process_instruction(&initialize(
&spoofed_stake_state_pubkey(),
&Authorized::default(),
&Lockup::default()
)),
Err(InstructionError::InvalidAccountOwner),
);
assert_eq!(
process_instruction(&authorize(
&spoofed_stake_state_pubkey(),
&Pubkey::default(),
&Pubkey::default(),
StakeAuthorize::Staker,
None,
)),
Err(InstructionError::InvalidAccountOwner),
);
assert_eq!(
process_instruction(
&split(
&spoofed_stake_state_pubkey(),
&Pubkey::default(),
100,
&Pubkey::default(),
)[2]
),
Err(InstructionError::InvalidAccountOwner),
);
assert_eq!(
process_instruction(
&split(
&Pubkey::default(),
&Pubkey::default(),
100,
&spoofed_stake_state_pubkey(),
)[2]
),
Err(InstructionError::IncorrectProgramId),
);
assert_eq!(
process_instruction(
&merge(
&spoofed_stake_state_pubkey(),
&Pubkey::default(),
&Pubkey::default(),
)[0]
),
Err(InstructionError::InvalidAccountOwner),
);
assert_eq!(
process_instruction(
&merge(
&Pubkey::default(),
&spoofed_stake_state_pubkey(),
&Pubkey::default(),
)[0]
),
Err(InstructionError::IncorrectProgramId),
);
assert_eq!(
process_instruction(
&split_with_seed(
&spoofed_stake_state_pubkey(),
&Pubkey::default(),
100,
&Pubkey::default(),
&Pubkey::default(),
"seed"
)[1]
),
Err(InstructionError::InvalidAccountOwner),
);
assert_eq!(
process_instruction(&delegate_stake(
&spoofed_stake_state_pubkey(),
&Pubkey::default(),
&Pubkey::default(),
)),
Err(InstructionError::InvalidAccountOwner),
);
assert_eq!(
process_instruction(&withdraw(
&spoofed_stake_state_pubkey(),
&Pubkey::default(),
&solana_sdk::pubkey::new_rand(),
100,
None,
)),
Err(InstructionError::InvalidAccountOwner),
);
assert_eq!(
process_instruction(&deactivate_stake(
&spoofed_stake_state_pubkey(),
&Pubkey::default()
)),
Err(InstructionError::InvalidAccountOwner),
);
assert_eq!(
process_instruction(&set_lockup(
&spoofed_stake_state_pubkey(),
&LockupArgs::default(),
&Pubkey::default()
)),
Err(InstructionError::InvalidAccountOwner),
);
} | rust_cleaned_test_functions.jsonl/40813 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
5368,
1055,
291,
1261,
726,
55665,
368,
341,
286,
2060,
10714,
33673,
310,
1882,
54923,
2099,
21641,
1006,
394,
609,
82859,
1055,
291,
1261,
726,
4387,
34014,
792,
3148,
394,
609,
60454,
486,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_values() {
let vec = vec![(1i, 'a'), (2i, 'b'), (3i, 'c')];
let map = vec.move_iter().collect::<TreeMap<int, char>>();
let values = map.values().map(|&v| v).collect::<Vec<char>>();
assert_eq!(values.len(), 3);
assert!(values.contains(&'a'));
assert!(values.contains(&'b'));
assert!(values.contains(&'c'));
} | rust_cleaned_test_functions.jsonl/66369 | {
"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,
9146,
368,
341,
286,
1077,
7486,
284,
7486,
0,
9697,
16,
72,
11,
364,
64,
4567,
320,
17,
72,
11,
364,
65,
4567,
320,
18,
72,
11,
364,
66,
863,
935,
286,
1077,
2415,
284,
7486,
13635,
11723... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_clone_is_clone() {
numid!(@CloneIsClone struct Test);
let t = Test::new();
assert_eq!(t, t.clone());
let tt = Test::create_lower(0);
assert_eq!(tt, tt.clone());
} | rust_cleaned_test_functions.jsonl/10271 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 121
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54742,
6892,
54742,
368,
341,
286,
1629,
307,
0,
5957,
37677,
3872,
37677,
2036,
3393,
317,
286,
1077,
259,
284,
3393,
486,
931,
543,
286,
2060,
10714,
10297,
83,
11,
259,
15997,
1423,
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 |
#[test]
fn test_from() {
let array = BinaryArray::<i32>::from(&[Some(b"hello".as_ref()), Some(b" ".as_ref()), None]);
let a = array.validity().as_ref().unwrap();
assert_eq!(a.len(), 3);
assert_eq!(a.as_slice()[0], 0b00000011);
} | rust_cleaned_test_functions.jsonl/42985 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
368,
341,
286,
1077,
1334,
284,
17718,
1857,
27638,
72,
18,
17,
6831,
1499,
2099,
58,
8373,
1883,
1,
14990,
3263,
300,
7793,
11858,
4329,
1883,
1,
5933,
300,
7793,
11858,
2240,
10149,
286,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_negated_variable() {
assert_expression!(
"-N",
Expression::UnaryExpression(UnaryOperator::Minus, Box::new("N".as_var_expr(1, 8)))
);
} | rust_cleaned_test_functions.jsonl/102633 | {
"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,
28209,
657,
14635,
368,
341,
286,
2060,
28068,
33673,
310,
6523,
45,
756,
310,
16378,
486,
94545,
9595,
49289,
658,
18461,
486,
74458,
11,
8261,
486,
931,
445,
45,
3263,
300,
4612,
21915,
7,
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 |
#[test]
fn test_four_of_a_kind_ranks() {
test(
&vec!["2S 2H 2C 8D 2D", "4S 5H 5S 5D 5C"],
&vec!["4S 5H 5S 5D 5C"],
)
} | rust_cleaned_test_functions.jsonl/121282 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56142,
3575,
4306,
33162,
1710,
4039,
368,
341,
1066,
262,
1273,
1006,
286,
609,
4083,
0,
1183,
17,
50,
220,
17,
39,
220,
17,
34,
220,
23,
35,
220,
17,
35,
497,
330,
19,
50,
220,
20,
39,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ipv4_reassembly_not_needed() {
let mut ctx = DummyContext::default();
// Test that we don't attempt reassembly if the packet is not
// fragmented.
let builder = get_ipv4_builder();
let body = [1, 2, 3, 4, 5];
let mut buffer =
Buf::new(body.to_vec(), ..).encapsulate(builder).serialize_vec_outer().unwrap();
let packet = buffer.parse::<Ipv4Packet<_>>().unwrap();
matches::assert_matches!(
process_fragment::<Ipv4, _, &[u8]>(&mut ctx, packet),
FragmentProcessingState::NotNeeded(unfragmented) if unfragmented.body() == body
);
} | rust_cleaned_test_functions.jsonl/22025 | {
"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,
49378,
19,
1288,
14993,
7913,
57426,
368,
341,
286,
1077,
5206,
5635,
284,
50567,
1972,
486,
2258,
1428,
286,
442,
3393,
429,
582,
1513,
944,
4774,
312,
14993,
421,
279,
10151,
374,
537,
198,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_stddev() {
let data = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
assert_eq!(mean(&data), 5.0);
assert_eq!(variance(&data), 11.0);
assert_eq!(stddev(&data), 11.0_f32.sqrt());
} | rust_cleaned_test_functions.jsonl/81027 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 111
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15656,
3583,
368,
341,
262,
1077,
821,
284,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,
11,
220,
22,
11,
220,
23,
11,
220,
24,
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_symbols_are_separators() {
check_word_count(
"hey,my_spacebar_is_broken.",
vec![("hey", 1),
("my", 1),
("spacebar", 1),
("is", 1),
("broken", 1)]);
} | rust_cleaned_test_functions.jsonl/109974 | {
"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,
55752,
56855,
3453,
1732,
2973,
368,
341,
262,
1779,
13533,
3180,
1006,
286,
330,
35561,
11,
2408,
14663,
2257,
6892,
880,
81709,
10346,
286,
7486,
20703,
445,
35561,
497,
220,
16,
1326,
1797,
348... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_transactions() {
let entry = Entry::new(&Hash::default(), 1, vec![]);
let empty_vec: Vec<Vec<u8>> = vec![];
assert_eq!(serialize_transactions(&entry), empty_vec);
let keypair0 = Keypair::new();
let keypair1 = Keypair::new();
let tx0 =
system_transaction::transfer(&keypair0, &keypair1.pubkey(), 1, Hash::default(), 0);
let tx1 =
system_transaction::transfer(&keypair1, &keypair0.pubkey(), 2, Hash::default(), 0);
let serialized_tx0 = serialize(&tx0).unwrap();
let serialized_tx1 = serialize(&tx1).unwrap();
let entry = Entry::new(&Hash::default(), 1, vec![tx0, tx1]);
assert_eq!(
serialize_transactions(&entry),
vec![serialized_tx0, serialized_tx1]
);
} | rust_cleaned_test_functions.jsonl/100169 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 387
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
68182,
368,
341,
286,
1077,
4343,
284,
15788,
486,
931,
2099,
6370,
486,
2258,
1507,
220,
16,
11,
7486,
0,
56703,
286,
1077,
4287,
13251,
25,
11312,
50439,
34837,
23,
2452,
284,
7486,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sphere_len() {
let mut sphere = SphereUv::new(5, 5);
assert_eq!(25, sphere.len());
sphere.next();
assert_eq!(24, sphere.len());
assert_eq!(24, sphere.count());
} | rust_cleaned_test_functions.jsonl/86772 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 93
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
86973,
6043,
368,
341,
262,
1077,
5206,
25366,
284,
54499,
52,
85,
486,
931,
7,
20,
11,
220,
20,
317,
262,
2060,
10714,
10297,
17,
20,
11,
25366,
19406,
1423,
262,
25366,
4529,
543,
262,
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 |
#[test]
fn test_query_balance() {
let msg = InstantiateMsg {
owner: h(OWNER),
nebula_token: h(NEB_TOKEN),
};
let info = mock_info(OWNER, &[]);
let mut deps = mock_dependencies(&[]);
let _res = instantiate(deps.as_mut(), mock_env(), info, msg)
.expect("contract successfully executes InstantiateMsg");
let amount = Uint128::new(1000u128);
deps.querier
.with_token_balances(&[(&h(NEB_TOKEN), &[(&MOCK_CONTRACT_ADDR.to_string(), &amount)])]);
let msg = QueryMsg::Balance {};
let res = query(deps.as_ref(), mock_env(), msg).unwrap();
let balance: Uint128 = from_binary(&res).unwrap();
assert_eq!(balance, amount);
} | rust_cleaned_test_functions.jsonl/76313 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 296
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5738,
29396,
368,
341,
262,
1077,
3750,
284,
32288,
6611,
341,
286,
6372,
25,
305,
7,
99031,
1326,
286,
80867,
5607,
6458,
25,
305,
7,
3944,
33,
18681,
1326,
262,
3634,
262,
1077,
3546,
284,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_txn_encode_decode() {
let tx_bytes = Vec::from_hex("0100000001a15d57094aa7a21a28cb20b59aab8fc7d1149a3bdbcddba9c622e4f5f6a99ece010000006c493046022100f93bb0e7d8db7bd46e40132d1f8242026e045f03a0efe71bbb8e3f475e970d790221009337cd7f1f929f00cc6ff01f03729b069a7c21b59b1736ddfee5db5946c5da8c0121033b9b137ee87d5a812d6f506efdd37f0affa7ffc310711c06c7f3e097c9447c52ffffffff0100e1f505000000001976a9140389035a9225b3839e2bbf32d826a1e222031fd888ac00000000").unwrap();
let tx: Transaction = deserialize(&tx_bytes).unwrap();
serde_round_trip!(tx);
} | rust_cleaned_test_functions.jsonl/332 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 319
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
92299,
11224,
15227,
368,
341,
286,
1077,
9854,
12524,
284,
11312,
486,
1499,
32655,
445,
15,
16,
15,
15,
15,
15,
15,
15,
15,
16,
64,
16,
20,
67,
20,
22,
15,
24,
19,
5305,
22,
64,
17,
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_try_from_cigar_for_sam_record_cigar() -> io::Result<()> {
use sam::record::cigar::{op, Op};
let bytes = [0x40, 0x02, 0x00, 0x00, 0x62, 0x03, 0x00, 0x00];
let cigar = Cigar::new(&bytes);
let actual = sam::record::Cigar::try_from(cigar)?;
let expected = sam::record::Cigar::from(vec![
Op::new(op::Kind::Match, 36),
Op::new(op::Kind::Deletion, 54),
]);
assert_eq!(actual, expected);
Ok(())
} | rust_cleaned_test_functions.jsonl/29764 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 265
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
5673,
666,
51284,
5478,
643,
309,
14192,
666,
51284,
368,
1464,
6399,
486,
2077,
71698,
341,
286,
990,
9962,
486,
8548,
486,
66,
51284,
22964,
453,
11,
10672,
2315,
286,
1077,
5820,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_recent_blockhashes_sysvar() {
let (genesis_config, _mint_keypair) = create_genesis_config(500);
let mut bank = Arc::new(Bank::new(&genesis_config));
for i in 1..5 {
let bhq_account = bank.get_account(&sysvar::recent_blockhashes::id()).unwrap();
let recent_blockhashes =
sysvar::recent_blockhashes::RecentBlockhashes::from_account(&bhq_account).unwrap();
// Check length
assert_eq!(recent_blockhashes.len(), i);
let most_recent_hash = recent_blockhashes.iter().nth(0).unwrap();
// Check order
assert_eq!(Some(true), bank.check_hash_age(most_recent_hash, 0));
goto_end_of_slot(Arc::get_mut(&mut bank).unwrap());
bank = Arc::new(new_from_parent(&bank));
}
} | rust_cleaned_test_functions.jsonl/42429 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 397
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62361,
7113,
8296,
288,
20344,
947,
368,
341,
286,
1077,
320,
77894,
5332,
11,
716,
67791,
3097,
12670,
8,
284,
1855,
16322,
13774,
5332,
7,
20,
15,
15,
317,
286,
1077,
5206,
6073,
284,
19689,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_fn() {
let mut stack = DynStack::<dyn Fn() -> usize>::new();
for i in 0..100 {
dyn_push!(stack, move || i);
}
let mut item2 = 0;
for func in stack.iter() {
item2 += func();
}
assert_eq!(item2, 4950);
} | rust_cleaned_test_functions.jsonl/21297 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 133
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15246,
368,
341,
262,
1077,
5206,
5611,
284,
43938,
4336,
27638,
43085,
50182,
368,
1464,
22301,
6831,
931,
543,
262,
369,
600,
304,
220,
15,
496,
16,
15,
15,
341,
286,
31070,
14218,
10297,
7693... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_incorrect_transfer_account_from() {
const TOKEN_ID: u16 = 0;
const INITIAL_BALANCE: u64 = 10;
const TOKEN_AMOUNT: u64 = 7;
const FEE_AMOUNT: u64 = 3;
const ERR_MSG: &str = "op_valid is true/enforce equal to one";
let incorrect_from_account = WitnessTestAccount::new(3, INITIAL_BALANCE);
// Input data: transaction is signed by an incorrect account (address of account
let accounts = vec![
WitnessTestAccount::new(1, INITIAL_BALANCE),
WitnessTestAccount::new_empty(2),
];
let (account_from, account_to) = (&accounts[0], &accounts[1]);
let transfer_op = TransferOp {
tx: incorrect_from_account
.zksync_account
.sign_transfer(
TOKEN_ID,
"",
BigUint::from(TOKEN_AMOUNT),
BigUint::from(FEE_AMOUNT),
&account_to.account.address,
None,
true,
)
.0,
from: account_from.id,
to: account_to.id,
};
let input = SigDataInput::from_transfer_op(&transfer_op).expect("SigDataInput creation failed");
incorrect_op_test_scenario::<TransferWitness<Bn256>, _>(
&accounts,
transfer_op,
input,
ERR_MSG,
|| {
vec![CollectedFee {
token: TOKEN_ID,
amount: FEE_AMOUNT.into(),
}]
},
);
} | rust_cleaned_test_functions.jsonl/56188 | {
"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,
1243,
19928,
35403,
13500,
5673,
368,
341,
262,
733,
43574,
3450,
25,
575,
16,
21,
284,
220,
15,
280,
262,
733,
56854,
79952,
8440,
25,
575,
21,
19,
284,
220,
16,
15,
280,
262,
733,
43574,
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... | 2 |
#[test]
fn test_write_and_load() {
let mut regfile = Registers::new();
regfile.write(2, 3);
let mut r3 = regfile.load(3);
assert_eq!(r3, 2);
regfile.write(1, 3);
r3 = regfile.load(3);
assert_ne!(r3, 2);
} | rust_cleaned_test_functions.jsonl/112388 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 152
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
8378,
12411,
368,
341,
286,
1077,
5206,
1217,
1192,
284,
54774,
486,
931,
543,
286,
1217,
1192,
3836,
7,
17,
11,
220,
18,
317,
286,
1077,
5206,
435,
18,
284,
1217,
1192,
5104,
7,
18,
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_parse_mask() {
assert_eq!(
Some("XXXXXXXXXXXXXXXXXXXXXXXXXXXXX1XXXX0X"),
parse_mask("mask = XXXXXXXXXXXXXXXXXXXXXXXXXXXXX1XXXX0X")
);
assert_eq!(None, parse_mask("mem[8] = 11"));
} | rust_cleaned_test_functions.jsonl/90588 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 131
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
9999,
368,
341,
286,
2060,
10714,
33673,
310,
4329,
445,
61516,
61516,
61516,
23830,
55,
16,
23830,
15,
55,
4461,
310,
4715,
9999,
445,
11258,
284,
19975,
61516,
61516,
61516,
6148,
16,
238... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_json() {
let val = json!({"arr": [ "one", 2, true, null ]});
let t = JsonTemplate {
foo: "a",
bar: &val,
};
// Note: the json filter lacks a way to specify initial indentation
assert_eq!(
t.render().unwrap(),
r#"{
"foo": "a",
"bar": {
"arr": [
"one",
2,
true,
null
]
}
}"#
);
} | rust_cleaned_test_functions.jsonl/8699 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 196
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9455,
368,
341,
262,
1077,
1044,
284,
2951,
0,
16864,
1118,
788,
508,
330,
603,
497,
220,
17,
11,
830,
11,
845,
2279,
2960,
262,
1077,
259,
284,
8308,
7275,
341,
286,
15229,
25,
330,
64,
756... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_which_absolute_extension() {
let f = TestFixture::new();
// Don't append EXE_EXTENSION here.
let b = f.bins[3].parent().unwrap().join(&BIN_NAME);
assert_eq!(_which(&f, &b).unwrap(), f.bins[3].canonicalize().unwrap());
} | rust_cleaned_test_functions.jsonl/13405 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
8206,
50874,
31035,
368,
341,
262,
1077,
282,
284,
3393,
18930,
486,
931,
543,
262,
442,
4320,
944,
8737,
4063,
36,
37012,
1588,
624,
262,
1077,
293,
284,
282,
948,
1330,
58,
18,
936,
3765... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_arithmetic3() {
fold("x = null * undefined", "x = NaN");
fold("x = null * 1", "x = 0");
fold("x = (null - 1) * 2", "x = -2");
fold("x = (null + 1) * 2", "x = 2");
fold("x = null ** 0", "x = 1");
} | rust_cleaned_test_functions.jsonl/122184 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 118
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
61187,
25842,
25922,
18,
368,
341,
262,
11555,
445,
87,
284,
845,
353,
5614,
497,
330,
87,
284,
32178,
797,
262,
11555,
445,
87,
284,
845,
353,
220,
16,
497,
330,
87,
284,
220,
15,
797,
262,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_to_pretty_oct() {
assert_eq!(to_pretty_oct(0o0), "0o0");
assert_eq!(to_pretty_oct(0o12), "0o12");
assert_eq!(to_pretty_oct(0o123), "0o123");
assert_eq!(to_pretty_oct(0o1234), "0o1_234");
assert_eq!(to_pretty_oct(0o12345), "0o12_345");
assert_eq!(to_pretty_oct(0o123456), "0o123_456");
assert_eq!(to_pretty_oct(0o1234567), "0o1_234_567");
assert_eq!(to_pretty_oct(0o12345670), "0o12_345_670");
assert_eq!(to_pretty_oct(0o123456701), "0o123_456_701");
} | rust_cleaned_test_functions.jsonl/17923 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 343
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
620,
21322,
70135,
368,
341,
286,
2060,
10714,
10297,
983,
620,
21322,
70135,
7,
15,
78,
15,
701,
260,
330,
15,
78,
15,
797,
286,
2060,
10714,
10297,
983,
620,
21322,
70135,
7,
15,
78,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_results_page() {
/*
* It would be a neat paginated fibonacci API if the page selector was
* just the last two numbers! Dropshot doesn't support that and it's
* not clear that's a practical use case anyway.
*/
let items = vec![1, 1, 2, 3, 5, 8, 13];
let dummy_scan_params = 21;
#[derive(Debug, Deserialize, Serialize)]
struct FibPageSelector {
prev: usize,
}
let get_page = |item: &usize, scan_params: &usize| FibPageSelector {
prev: *item + *scan_params,
};
let results =
ResultsPage::new(items.clone(), &dummy_scan_params, get_page)
.unwrap();
assert_eq!(results.items, items);
assert!(results.next_page.is_some());
let token = results.next_page.unwrap();
let deserialized: FibPageSelector =
deserialize_page_token(&token).unwrap();
assert_eq!(deserialized.prev, 34);
let results =
ResultsPage::new(Vec::new(), &dummy_scan_params, get_page).unwrap();
assert_eq!(results.items.len(), 0);
assert!(results.next_page.is_none());
} | rust_cleaned_test_functions.jsonl/16569 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 564
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13576,
6129,
368,
341,
286,
9049,
260,
353,
1084,
1035,
387,
264,
28485,
14774,
15479,
75698,
5333,
421,
279,
2150,
9367,
572,
198,
260,
353,
1101,
279,
1537,
1378,
5109,
0,
220,
15733,
6340,
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_txn_store_lock_primary() {
let store = AssertionStorage::default();
// txn1 locks "p" then aborts.
store.prewrite_ok(
vec![Mutation::Put((Key::from_raw(b"p"), b"p1".to_vec()))],
b"p",
1,
);
store.prewrite_locked(
vec![
Mutation::Put((Key::from_raw(b"p"), b"p2".to_vec())),
Mutation::Put((Key::from_raw(b"s"), b"s2".to_vec())),
],
b"p",
2,
vec![(b"p", b"p", 1.into())],
);
// txn2 cleanups txn1's lock.
store.rollback_ok(vec![b"p"], 1);
store.resolve_lock_ok(1, None::<TimeStamp>);
store.prewrite_ok(
vec![
Mutation::Put((Key::from_raw(b"p"), b"p3".to_vec())),
Mutation::Put((Key::from_raw(b"s"), b"s3".to_vec())),
],
b"p",
3,
);
} | rust_cleaned_test_functions.jsonl/63411 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 492
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
92299,
14809,
9818,
45314,
368,
341,
262,
1077,
3553,
284,
46730,
5793,
486,
2258,
543,
262,
442,
49721,
16,
31676,
330,
79,
1,
1221,
11326,
82,
624,
262,
3553,
556,
52473,
19817,
1006,
286,
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_no_connected_storage() {
let mut world = World::default();
world.insert_resource(TestAmount { amount: 2.0 });
let mut stage = SystemStage::parallel();
stage.add_system(distribute_to_storage_test_system.system());
world.spawn().insert(StorageConsolidator::default());
stage.run(&mut world);
// should not panic
} | rust_cleaned_test_functions.jsonl/112996 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
43276,
23310,
368,
341,
262,
1077,
5206,
1879,
284,
4337,
486,
2258,
543,
262,
1879,
7030,
17962,
31159,
10093,
314,
3311,
25,
220,
17,
13,
15,
3011,
262,
1077,
5206,
6430,
284,
739,
19398... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_shld() {
let mut state = State8080::empty_state();
state.memory = vec![0x22, 0x03, 0x00, 0x00, 0x00];
state.h = 0xae;
state.l = 0x29;
emulate_8080_op(&mut state);
assert_eq!(state.read_memory(0x03), 0x29);
assert_eq!(state.read_memory(0x04), 0xae);
assert_eq!(state.program_counter(), 3);
} | rust_cleaned_test_functions.jsonl/7799 | {
"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,
3712,
507,
368,
341,
286,
1077,
5206,
1584,
284,
3234,
23,
15,
23,
15,
486,
3194,
4387,
543,
286,
1584,
36611,
284,
7486,
20703,
15,
87,
17,
17,
11,
220,
15,
87,
15,
18,
11,
220,
15,
87,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fuzz() {
assert_eq!(
parse("\x2D\x38\x31\x39\x34\x38\x34"),
Err(ParseError::ImpossibleTimestamp("Invalid month"))
);
// Garbage in the third delimited field
assert_eq!(
parse("2..\x00\x000d\x00+\x010d\x01\x00\x00\x00+"),
Err(ParseError::UnrecognizedFormat)
);
let default = NaiveDate::from_ymd(2016, 6, 29).and_hms(0, 0, 0);
let p = Parser::default();
let res = p.parse(
"\x0D\x31",
None,
None,
false,
false,
Some(&default),
false,
&HashMap::new(),
);
assert_eq!(res, Err(ParseError::NoDate));
assert_eq!(
parse("\x2D\x2D\x32\x31\x38\x6D"),
Err(ParseError::ImpossibleTimestamp("Invalid minute"))
);
} | rust_cleaned_test_functions.jsonl/4776 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 417
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
8889,
368,
341,
262,
2060,
10714,
33673,
286,
4715,
4921,
87,
17,
35,
3462,
18,
23,
3462,
18,
16,
3462,
18,
24,
3462,
18,
19,
3462,
18,
23,
3462,
18,
19,
4461,
286,
15495,
71812,
1454,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_truncated_frame() {
#[rustfmt::skip]
let bad_frame: Vec<u8> = vec![
// WPA version
0x01, 0x00,
0x00, 0x50
];
let wpa_frame = from_bytes(&bad_frame[..]);
assert!(!wpa_frame.is_ok());
} | rust_cleaned_test_functions.jsonl/54819 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 186
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3547,
38007,
8929,
368,
341,
286,
11506,
35788,
12501,
486,
20599,
921,
286,
1077,
3873,
8929,
25,
11312,
34837,
23,
29,
284,
7486,
90515,
310,
442,
467,
8041,
2319,
198,
310,
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 |
#[test]
fn test_write_pin() {
let counter = Counter { total: 20 };
pin_mut!(counter); // works with future that requires unpin
counter.as_mut().update_total(30);
assert_eq!(counter.get_total(), 30);
} | rust_cleaned_test_functions.jsonl/59839 | {
"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,
9165,
26296,
368,
341,
286,
1077,
5546,
284,
19735,
314,
2790,
25,
220,
17,
15,
2605,
286,
8983,
29523,
10297,
8292,
1215,
442,
4278,
448,
3853,
429,
7460,
650,
13273,
198,
286,
5546,
5357,
2952... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_count() {
for opt in vec!["-q", "--count"] {
new_ucmd!()
.arg(opt)
.succeeds()
.stdout_is(expected_result(&[opt]));
}
} | rust_cleaned_test_functions.jsonl/79388 | {
"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,
3180,
368,
341,
262,
369,
3387,
304,
7486,
0,
1183,
12,
80,
497,
14482,
1830,
1341,
341,
286,
501,
68887,
2277,
0,
741,
310,
659,
858,
24539,
340,
310,
659,
82,
29264,
82,
741,
310,
659,
363... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_transaction_wrong_key() {
let program_id = Pubkey::default();
let keypair0 = Keypair::new();
let wrong_id = Pubkey::default();
let ix =
Instruction::new_with_bincode(program_id, &0, vec![AccountMeta::new(wrong_id, true)]);
let message = Message::new(&[ix], Some(&wrong_id));
Transaction::new_unsigned(message).sign(&[&keypair0], Hash::default());
} | rust_cleaned_test_functions.jsonl/11241 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28884,
75198,
3097,
368,
341,
286,
1077,
2025,
842,
284,
22611,
792,
486,
2258,
543,
286,
1077,
1376,
12670,
15,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
4969,
842,
284,
22611,
792,
486,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_kvm_getters() {
let kvm = Kvm::new().unwrap();
// vCPU related getters
let nr_vcpus = kvm.get_nr_vcpus();
assert!(nr_vcpus >= 4);
assert!(kvm.get_max_vcpus() >= nr_vcpus);
// Memory related getters
assert!(kvm.get_vcpu_mmap_size().unwrap() > 0);
assert!(kvm.get_nr_memslots() >= 32);
} | rust_cleaned_test_functions.jsonl/127386 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 205
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4698,
7338,
3062,
5045,
368,
341,
286,
1077,
94748,
284,
730,
7338,
486,
931,
1005,
15454,
1428,
286,
442,
348,
31615,
5435,
52894,
198,
286,
1077,
20262,
2273,
4672,
355,
284,
94748,
670,
36513,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mvcc_txn_commit_ok() {
test_mvcc_txn_commit_ok_imp(b"x", b"v", b"y", b"z");
let long_value = "v".repeat(SHORT_VALUE_MAX_LEN + 1).into_bytes();
test_mvcc_txn_commit_ok_imp(b"x", &long_value, b"y", b"z");
} | rust_cleaned_test_functions.jsonl/61085 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73187,
638,
92299,
36346,
19817,
368,
341,
286,
1273,
73187,
638,
92299,
36346,
19817,
36788,
1883,
65438,
497,
293,
1,
85,
497,
293,
1,
88,
497,
293,
1,
89,
3071,
286,
1077,
1293,
3142,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_prev_index() {
let sql = "SELECT version";
all_dialects().run_parser_method(sql, |parser| {
assert_eq!(parser.peek_token(), Some(Token::make_keyword("SELECT")));
assert_eq!(parser.next_token(), Some(Token::make_keyword("SELECT")));
parser.prev_token();
assert_eq!(parser.next_token(), Some(Token::make_keyword("SELECT")));
assert_eq!(parser.next_token(), Some(Token::make_word("version", None)));
parser.prev_token();
assert_eq!(parser.peek_token(), Some(Token::make_word("version", None)));
assert_eq!(parser.next_token(), Some(Token::make_word("version", None)));
assert_eq!(parser.peek_token(), None);
parser.prev_token();
assert_eq!(parser.next_token(), Some(Token::make_word("version", None)));
assert_eq!(parser.next_token(), None);
assert_eq!(parser.next_token(), None);
parser.prev_token();
});
} | rust_cleaned_test_functions.jsonl/92121 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 473
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25566,
3560,
368,
341,
286,
1077,
5704,
284,
330,
4858,
2319,
876,
286,
678,
814,
55056,
82,
1005,
6108,
18517,
9032,
13148,
11,
760,
9657,
91,
341,
310,
2060,
10714,
10297,
9657,
41249,
6458,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_remove_account_before_initialization() {
let location = TempLocation::new();
request_stream_test(
location.to_persistent_lifetime(),
create_clean_pre_auth_manager(),
None,
Arc::new(Inspector::new()),
|proxy| async move {
assert_eq!(
proxy.remove_account(FORCE_REMOVE_ON).await?,
Err(ApiError::FailedPrecondition)
);
Ok(())
},
);
} | rust_cleaned_test_functions.jsonl/105849 | {
"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,
18193,
13500,
23708,
15809,
2022,
368,
341,
286,
1077,
3728,
284,
19944,
4707,
486,
931,
543,
286,
1681,
12673,
4452,
1006,
310,
3728,
2389,
620,
13931,
98827,
3148,
310,
1855,
19573,
10442,
14014,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_memcmp_try_decode_first_error() {
let cases = vec![
vec![1, 2, 3, 4],
vec![0, 0, 0, 0, 0, 0, 0, 247],
vec![0, 0, 0, 0, 0, 0, 0, 0, 246],
vec![0, 0, 0, 0, 0, 0, 0, 1, 247],
vec![1, 2, 3, 4, 5, 6, 7, 8, 0],
vec![1, 2, 3, 4, 5, 6, 7, 8, 255, 1],
vec![1, 2, 3, 4, 5, 6, 7, 8, 255, 1, 2, 3, 4, 5, 6, 7, 8],
vec![1, 2, 3, 4, 5, 6, 7, 8, 255, 1, 2, 3, 4, 5, 6, 7, 8, 255],
vec![1, 2, 3, 4, 5, 6, 7, 8, 255, 1, 2, 3, 4, 5, 6, 7, 8, 0],
vec![1, 2, 3, 4, 5, 6, 7, 8, 255, 1, 0, 0, 0, 0, 0, 0, 0, 247],
];
for invalid_src in cases {
let mut dest = vec![0; invalid_src.len()];
let result = MemComparableByteCodec::try_decode_first(
invalid_src.as_slice(),
dest.as_mut_slice(),
);
assert!(result.is_err());
}
} | rust_cleaned_test_functions.jsonl/26698 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 608
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12976,
7293,
53283,
15227,
12978,
4096,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
1259,
310,
7486,
20703,
15,
11,
220,
15,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_builders() {
let my_struct = MyTestStruct::new(String::from("Reid"), 25).with_weight(100);
assert_eq!(my_struct.weight(), &Some(100));
assert_eq!(my_struct.married(), &None);
} | rust_cleaned_test_functions.jsonl/117669 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 87
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20801,
388,
368,
341,
262,
1077,
847,
15126,
284,
3017,
2271,
9422,
486,
931,
2242,
486,
1499,
445,
693,
307,
3975,
220,
17,
20,
568,
4197,
15876,
7,
16,
15,
15,
317,
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_insert_query_with_escaped_single_quote_in_the_begining() {
let mut lexer = Lexer::new("insert into tab1 values ('''abs');");
assert_eq!(lexer.next_lexem(), Some(Token::Word("insert".to_string())));
assert_eq!(lexer.next_lexem(), Some(Token::Word("into".to_string())));
assert_eq!(lexer.next_lexem(), Some(Token::Word("tab1".to_string())));
assert_eq!(lexer.next_lexem(), Some(Token::Word("values".to_string())));
assert_eq!(lexer.next_lexem(), Some(Token::LeftParenthesis));
assert_eq!(lexer.next_lexem(), Some(Token::SingleQuote));
assert_eq!(lexer.next_lexem(), Some(Token::Word("'abs".to_string())));
assert_eq!(lexer.next_lexem(), Some(Token::SingleQuote));
assert_eq!(lexer.next_lexem(), Some(Token::RightParenthesis));
assert_eq!(lexer.next_lexem(), Some(Token::SemiColon));
} | rust_cleaned_test_functions.jsonl/98883 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 348
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
5738,
6615,
62,
65826,
19487,
45236,
1243,
16068,
23338,
287,
368,
341,
262,
1077,
5206,
53259,
284,
85082,
486,
931,
445,
4208,
1119,
5651,
16,
2750,
4319,
4605,
3435,
4667,
3071,
262,
206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_test_strndup() {
assert_emscripten_output!(
"../../emtests/test_strndup.wasm",
"test_strndup",
vec![],
"../../emtests/test_strndup.out"
);
} | rust_cleaned_test_functions.jsonl/66877 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 113
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4452,
2895,
303,
454,
368,
341,
262,
2060,
22504,
2282,
268,
7645,
33673,
286,
10208,
336,
23841,
12697,
2895,
303,
454,
1418,
10530,
756,
286,
330,
1944,
2895,
303,
454,
756,
286,
7486,
20703,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_transfer_multisession_signing() {
paychains_logger::setup();
let mint_keypair = Keypair::new();
let mint_pubkey = mint_keypair.pubkey();
let faucet_addr = run_local_faucet(mint_keypair, None);
let test_validator = TestValidator::with_custom_fees(
mint_pubkey,
1,
Some(faucet_addr),
SocketAddrSpace::Unspecified,
);
let to_pubkey = Pubkey::new(&[1u8; 32]);
let offline_from_signer = keypair_from_seed(&[2u8; 32]).unwrap();
let offline_fee_payer_signer = keypair_from_seed(&[3u8; 32]).unwrap();
let from_null_signer = NullSigner::new(&offline_from_signer.pubkey());
// Setup accounts
let rpc_client =
RpcClient::new_with_commitment(test_validator.rpc_url(), CommitmentConfig::processed());
request_and_confirm_airdrop(
&rpc_client,
&CliConfig::recent_for_tests(),
&offline_from_signer.pubkey(),
pay_to_lamports(43.0),
)
.unwrap();
request_and_confirm_airdrop(
&rpc_client,
&CliConfig::recent_for_tests(),
&offline_fee_payer_signer.pubkey(),
pay_to_lamports(1.0) + 3,
)
.unwrap();
check_recent_balance(
pay_to_lamports(43.0),
&rpc_client,
&offline_from_signer.pubkey(),
);
check_recent_balance(
pay_to_lamports(1.0) + 3,
&rpc_client,
&offline_fee_payer_signer.pubkey(),
);
check_recent_balance(0, &rpc_client, &to_pubkey);
check_ready(&rpc_client);
let blockhash = rpc_client.get_latest_blockhash().unwrap();
// Offline fee-payer signs first
let mut fee_payer_config = CliConfig::recent_for_tests();
fee_payer_config.json_rpc_url = String::default();
fee_payer_config.signers = vec![&offline_fee_payer_signer, &from_null_signer];
// Verify we cannot contact the cluster
fee_payer_config.command = CliCommand::ClusterVersion;
process_command(&fee_payer_config).unwrap_err();
fee_payer_config.command = CliCommand::Transfer {
amount: SpendAmount::Some(pay_to_lamports(42.0)),
to: to_pubkey,
from: 1,
sign_only: true,
dump_transaction_message: false,
allow_unfunded_recipient: true,
no_wait: false,
blockhash_query: BlockhashQuery::None(blockhash),
nonce_account: None,
nonce_authority: 0,
memo: None,
fee_payer: 0,
derived_address_seed: None,
derived_address_program_id: None,
};
fee_payer_config.output_format = OutputFormat::JsonCompact;
let sign_only_reply = process_command(&fee_payer_config).unwrap();
let sign_only = parse_sign_only_reply_string(&sign_only_reply);
assert!(!sign_only.has_all_signers());
let fee_payer_presigner = sign_only
.presigner_of(&offline_fee_payer_signer.pubkey())
.unwrap();
// Now the offline fund source
let mut from_config = CliConfig::recent_for_tests();
from_config.json_rpc_url = String::default();
from_config.signers = vec![&fee_payer_presigner, &offline_from_signer];
// Verify we cannot contact the cluster
from_config.command = CliCommand::ClusterVersion;
process_command(&from_config).unwrap_err();
from_config.command = CliCommand::Transfer {
amount: SpendAmount::Some(pay_to_lamports(42.0)),
to: to_pubkey,
from: 1,
sign_only: true,
dump_transaction_message: false,
allow_unfunded_recipient: true,
no_wait: false,
blockhash_query: BlockhashQuery::None(blockhash),
nonce_account: None,
nonce_authority: 0,
memo: None,
fee_payer: 0,
derived_address_seed: None,
derived_address_program_id: None,
};
from_config.output_format = OutputFormat::JsonCompact;
let sign_only_reply = process_command(&from_config).unwrap();
let sign_only = parse_sign_only_reply_string(&sign_only_reply);
assert!(sign_only.has_all_signers());
let from_presigner = sign_only
.presigner_of(&offline_from_signer.pubkey())
.unwrap();
// Finally submit to the cluster
let mut config = CliConfig::recent_for_tests();
config.json_rpc_url = test_validator.rpc_url();
config.signers = vec![&fee_payer_presigner, &from_presigner];
config.command = CliCommand::Transfer {
amount: SpendAmount::Some(pay_to_lamports(42.0)),
to: to_pubkey,
from: 1,
sign_only: false,
dump_transaction_message: false,
allow_unfunded_recipient: true,
no_wait: false,
blockhash_query: BlockhashQuery::FeeCalculator(blockhash_query::Source::Cluster, blockhash),
nonce_account: None,
nonce_authority: 0,
memo: None,
fee_payer: 0,
derived_address_seed: None,
derived_address_program_id: None,
};
process_command(&config).unwrap();
check_recent_balance(
pay_to_lamports(1.0),
&rpc_client,
&offline_from_signer.pubkey(),
);
check_recent_balance(
pay_to_lamports(1.0) + 1,
&rpc_client,
&offline_fee_payer_signer.pubkey(),
);
check_recent_balance(pay_to_lamports(42.0), &rpc_client, &to_pubkey);
} | rust_cleaned_test_functions.jsonl/71164 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2325
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35403,
26290,
285,
1338,
11172,
287,
368,
341,
262,
2291,
58358,
27413,
486,
15188,
543,
262,
1077,
28337,
3097,
12670,
284,
6569,
1082,
1310,
486,
931,
543,
262,
1077,
28337,
34014,
792,
284,
283... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_constant_initializer_explicit() {
let mut context = Scope::new();
let init = constant_initializer(&mut context, 3_i32, [2, 2, 2].as_ref()).unwrap();
let var = context
.get_variable_with_initializer(init, true, "")
.unwrap();
let results = test_suite!(run_op: [var]; context, input: {});
test_suite!(results; assert_len: {[0;Int32] == 8});
test_suite!(results; assert: {[0;Int32] == [3_i32, 3, 3, 3, 3, 3, 3, 3]});
} | rust_cleaned_test_functions.jsonl/96395 | {
"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,
34967,
36462,
14214,
6026,
368,
341,
262,
1077,
5206,
2266,
284,
34920,
486,
931,
1428,
262,
1077,
2930,
284,
6783,
36462,
2099,
6984,
2266,
11,
220,
18,
5318,
18,
17,
11,
508,
17,
11,
220,
17... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_timestamps_with_different_days_are_not_equal() -> IonResult<()> {
let builder = Timestamp::with_year(2021).with_month(2);
let timestamp1 = builder.clone().with_day(5).build();
let timestamp2 = builder.clone().with_day(6).build();
assert_ne!(timestamp1, timestamp2);
Ok(())
} | rust_cleaned_test_functions.jsonl/13960 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23073,
82,
6615,
82741,
28353,
56855,
7913,
11478,
368,
1464,
44805,
2077,
71698,
341,
286,
1077,
7363,
284,
32758,
486,
4197,
14645,
7,
17,
15,
17,
16,
568,
4197,
18933,
7,
17,
317,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_path_band() {
let mut files = FileMap::new();
files.add_file(PathBuf::from("a/b"));
files.add_relative(PathBuf::from("d/e/f"), &PathBuf::from("d"));
dbg!(&files.tree);
assert!(files.tree.contains_key(&String::from("a")));
assert!(files.tree.contains_key(&String::from("e")));
} | rust_cleaned_test_functions.jsonl/81407 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 172
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2638,
45344,
368,
341,
286,
1077,
5206,
3542,
284,
2887,
2227,
486,
931,
543,
286,
3542,
1364,
2458,
33030,
15064,
486,
1499,
445,
64,
3470,
4010,
286,
3542,
1364,
29286,
33030,
15064,
486,
1499,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_checkout_deleted_tree_and_added_blob() -> BitResult<()> {
BitRepo::with_sample_repo_no_sym(|repo| {
bit_branch!(repo: "checkpoint");
let target = commit! {
foo
bar
dir < "changed to a file"
};
rmdir!(repo: "dir");
bit_checkout!(repo: &rev!(target))?;
// reset and test force checkout as well
bit_reset!(repo: --hard "checkpoint");
assert!(exists!(repo: "dir/bar"));
rmdir!(repo: "dir");
bit_checkout!(repo: &rev!(target))?;
assert_eq!(cat!(repo: "dir"), "changed to a file");
Ok(())
})
} | rust_cleaned_test_functions.jsonl/62982 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 346
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68186,
39418,
11663,
8378,
37653,
45908,
368,
1464,
6495,
2077,
71698,
341,
262,
6495,
25243,
486,
4197,
17491,
37784,
6536,
26825,
22428,
23476,
91,
341,
286,
2699,
28031,
10297,
23476,
25,
330,
69... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_a_bench() {
if !is_nightly() {
return;
}
let p = project()
.file(
"Cargo.toml",
r#"
[project]
name = "foo"
authors = []
version = "0.1.0"
[lib]
name = "foo"
test = false
doctest = false
[[bench]]
name = "b"
test = true
"#,
).file("src/lib.rs", "")
.file("benches/b.rs", "#[test] fn foo() {}")
.build();
p.cargo("test")
.with_stderr(
"\
[COMPILING] foo v0.1.0 ([..])
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
[RUNNING] target/debug/deps/b-[..][EXE]",
).with_stdout_contains("test foo ... ok")
.run();
} | rust_cleaned_test_functions.jsonl/50459 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 480
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4306,
880,
19762,
368,
341,
262,
421,
753,
285,
1089,
71948,
368,
341,
286,
470,
280,
262,
555,
262,
1077,
281,
284,
2390,
741,
286,
659,
1192,
1006,
310,
330,
98228,
73494,
75,
756,
310,
435,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_invalid_arms() {
fn check(macro_body: &str, err: ParseError) {
let m = parse_macro_arm(macro_body);
assert_eq!(m, Err(err.into()));
}
check("invalid", ParseError::Expected("expected subtree".into()));
check("$i:ident => ()", ParseError::Expected("expected subtree".into()));
check("($i:ident) ()", ParseError::Expected("expected `=`".into()));
check("($($i:ident)_) => ()", ParseError::InvalidRepeat);
check("($i) => ($i)", ParseError::UnexpectedToken("bad fragment specifier 1".into()));
check("($i:) => ($i)", ParseError::UnexpectedToken("bad fragment specifier 1".into()));
} | rust_cleaned_test_functions.jsonl/28781 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 300
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
62,
15914,
368,
341,
286,
5168,
1779,
1255,
49507,
14114,
25,
609,
495,
11,
1848,
25,
14775,
1454,
8,
341,
310,
1077,
296,
284,
4715,
58810,
34680,
1255,
49507,
14114,
317,
310,
2060,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.