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_generic_transparent_named_field_struct() {
Python::with_gil(|py| {
let test = "test".into_py(py);
let d: D<String> =
D::extract(test.as_ref(py)).expect("Failed to extract D<String> from String");
assert_eq!(d.test, "test");
let test = 1usize.into_py(py);
let d: D<usize> =
D::extract(test.as_ref(py)).expect("Failed to extract D<usize> from String");
assert_eq!(d.test, 1);
});
} | rust_cleaned_test_functions.jsonl/59467 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 239
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41232,
7965,
3765,
71834,
5013,
15126,
368,
341,
262,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
341,
286,
1077,
1273,
284,
330,
1944,
3263,
18122,
40291,
46827,
317,
286,
1077,
294,
25,
422,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_symlink_and_full_path_abs_path() {
let (te, abs_path) = get_test_env_with_abs_path(DEFAULT_DIRS, DEFAULT_FILES);
let root = te.system_root();
let prefix = escape(&root.to_string_lossy());
te.assert_output(
&[
"--full-path",
&format!("^{prefix}.*symlink.*three", prefix = prefix),
&format!("{abs_path}/symlink", abs_path = abs_path),
],
&format!(
"{abs_path}/symlink/three
{abs_path}/symlink/three/d.foo
{abs_path}/symlink/three/directory_foo",
abs_path = &abs_path
),
);
} | rust_cleaned_test_functions.jsonl/10888 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 334
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58530,
44243,
8378,
16372,
2638,
31170,
2638,
368,
341,
262,
1077,
320,
665,
11,
3647,
2638,
8,
284,
633,
4452,
15879,
6615,
31170,
2638,
43175,
90560,
11,
11955,
48010,
317,
262,
1077,
3704,
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_nil() {
#[allow(clippy::let_unit_value)]
with_graph(|graph| {
let _nil: () = graph.query("RETURN null").unwrap();
});
} | rust_cleaned_test_functions.jsonl/73404 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 78
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36175,
368,
341,
262,
11506,
7183,
9849,
45749,
486,
1149,
14832,
3142,
5563,
262,
448,
14738,
22428,
4439,
91,
341,
286,
1077,
716,
8385,
25,
1719,
284,
4771,
4786,
445,
51533,
845,
1827,
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 |
#[test]
fn test_storage_term() {
let ents = vec![new_entry(3, 3), new_entry(4, 4), new_entry(5, 5)];
let mut tests = vec![
(2, Err(RaftError::Store(StorageError::Compacted))),
(3, Ok(3)),
(4, Ok(4)),
(5, Ok(5)),
];
for (i, (idx, wterm)) in tests.drain(..).enumerate() {
let td = TempDir::new("tikv-store-test").unwrap();
let worker = Worker::new("snap-manager");
let sched = worker.scheduler();
let store = new_storage_from_ents(sched, &td, &ents);
let t = store.term(idx);
if wterm != t {
panic!("#{}: expect res {:?}, got {:?}", i, wterm, t);
}
}
} | rust_cleaned_test_functions.jsonl/121483 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 415
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23310,
17464,
368,
341,
286,
1077,
36852,
284,
7486,
20703,
931,
9078,
7,
18,
11,
220,
18,
701,
501,
9078,
7,
19,
11,
220,
19,
701,
501,
9078,
7,
20,
11,
220,
20,
73663,
286,
1077,
5206,
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_uint_from_div_no_panic() {
assert_eq!(Uint256::from(6).div(Uint256::from(2)), Uint256::from(3));
} | rust_cleaned_test_functions.jsonl/47741 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 69
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15807,
5673,
16237,
6536,
620,
31270,
368,
341,
286,
2060,
10714,
10297,
21570,
17,
20,
21,
486,
1499,
7,
21,
568,
611,
12317,
396,
17,
20,
21,
486,
1499,
7,
17,
5731,
27883,
17,
20,
21,
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 |
#[test]
fn test_hash_keccak_256() {
let mut output = [0x00_u8; 32];
keccak_256(TEST_INPUT, &mut output);
assert_eq!(
output,
[
24, 230, 209, 59, 127, 30, 158, 244, 60, 177, 132, 150, 167, 244, 64, 69,
184, 123, 185, 44, 211, 199, 208, 179, 14, 64, 126, 140, 217, 69, 36,
216
]
);
} | rust_cleaned_test_functions.jsonl/37531 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 247
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
45476,
84262,
62,
17,
20,
21,
368,
341,
286,
1077,
5206,
2550,
284,
508,
15,
87,
15,
15,
7300,
23,
26,
220,
18,
17,
935,
286,
1962,
84262,
62,
17,
20,
21,
50320,
21022,
11,
609,
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_double() {
assert_eq!(
Variant::VSingle(5.9).minus(Variant::VDouble(2.4)).unwrap(),
Variant::VDouble(3.5)
);
} | rust_cleaned_test_functions.jsonl/84554 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24598,
368,
341,
394,
2060,
10714,
33673,
503,
39292,
486,
53,
10888,
7,
20,
13,
24,
568,
38365,
12410,
15341,
486,
53,
7378,
7,
17,
13,
19,
4579,
15454,
3148,
503,
39292,
486,
53,
7378,
7,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_clear_str_decode() -> Result<(), String> {
let result = InstructionRegister::decode(CLEAR_STR).expect("failed decode");
match result.target {
Target::Str => Ok(()),
_ => Err("incorrect target".to_string())
}?;
match result.action {
Action::Clear => Ok(()),
_ => Err("incorrect action".to_string())
}?;
Ok(())
} | rust_cleaned_test_functions.jsonl/61612 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21811,
2895,
15227,
368,
1464,
5714,
68843,
923,
29,
341,
286,
1077,
1102,
284,
29051,
8690,
486,
18196,
3025,
23944,
7159,
568,
17119,
445,
16091,
16895,
797,
286,
2432,
1102,
6539,
341,
310,
134... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_zero_args_heler() {
let mut r = Registry::new();
r.register_helper(
"name",
Box::new(
|_: &Helper<'_, '_>,
_: &Registry<'_>,
_: &Context,
_: &mut RenderContext<'_, '_>,
out: &mut dyn Output|
-> Result<(), RenderError> { out.write("N/A").map_err(Into::into) },
),
);
r.register_template_string("t0", "Output name: {{name}}")
.unwrap();
r.register_template_string("t1", "Output name: {{first_name}}")
.unwrap();
r.register_template_string("t2", "Output name: {{./name}}")
.unwrap();
assert_eq!(
r.render("t0", &json!({"name": "Alex"})).unwrap(),
"Output name: N/A"
);
assert_eq!(
r.render("t2", &json!({"name": "Alex"})).unwrap(),
"Output name: Alex"
);
// output nothing when neither context nor helper available
assert_eq!(
r.render("t1", &json!({"name": "Alex"})).unwrap(),
"Output name: "
);
// generate error in strict mode for above case
r.set_strict_mode(true);
assert!(r.render("t1", &json!({"name": "Alex"})).is_err());
// output nothing when helperMissing was defined
r.set_strict_mode(false);
r.register_helper(
"helperMissing",
Box::new(
|h: &Helper<'_, '_>,
_: &Registry<'_>,
_: &Context,
_: &mut RenderContext<'_, '_>,
out: &mut dyn Output|
-> Result<(), RenderError> {
let name = h.name();
out.write(&format!("{} not resolved", name))?;
Ok(())
},
),
);
assert_eq!(
r.render("t1", &json!({"name": "Alex"})).unwrap(),
"Output name: first_name not resolved"
);
} | rust_cleaned_test_functions.jsonl/15115 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 949
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19359,
8384,
1523,
7865,
368,
341,
262,
1077,
5206,
435,
284,
32112,
486,
931,
1428,
262,
435,
9929,
10418,
1006,
286,
330,
606,
756,
286,
8261,
486,
931,
1006,
310,
760,
23211,
609,
5511,
18291... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_from_sequence_err() {
let gil = Python::acquire_gil();
let py = gil.python();
let items = PyList::new(py, &vec!["a", "b"]);
assert!(PyDict::from_sequence(py, items.to_object(py)).is_err());
} | rust_cleaned_test_functions.jsonl/87931 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
23735,
9266,
368,
341,
286,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
286,
1077,
4510,
284,
342,
321,
43193,
543,
286,
1077,
3589,
284,
5355,
852,
486,
931,
46827,
11,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_to_numeric_string() {
let cases = vec![
("2012-12-31 11:30:45.123456", 4, "20121231113045.1235"),
("2012-12-31 11:30:45.123456", 6, "20121231113045.123456"),
("2012-12-31 11:30:45.123456", 0, "20121231113045"),
("2012-12-31 11:30:45.999999", 0, "20121231113046"),
("2017-01-05 08:40:59.575601", 0, "20170105084100"),
("2017-01-05 23:59:59.575601", 0, "20170106000000"),
("0000-00-00 00:00:00", 6, "00000000000000"),
];
for (s, fsp, expect) in cases {
let t = Time::parse_utc_datetime(s, fsp).unwrap();
let get = t.to_numeric_string();
assert_eq!(get, expect);
}
} | rust_cleaned_test_functions.jsonl/93953 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 408
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
29418,
3904,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
3489,
17,
15,
16,
17,
12,
16,
17,
12,
18,
16,
220,
16,
16,
25,
18,
15,
25,
19,
20,
13,
16,
17,
18,
19,
20,
21,
497,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_key_manager_disallow_plaintext_metadata() {
let (_tmp, manager) = new_tmp_key_manager(
None,
Some(EncryptionMethod::Aes256Ctr),
Some(MasterKeyConfig::Plaintext),
None,
);
manager.err().unwrap();
} | rust_cleaned_test_functions.jsonl/32256 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3097,
12144,
9932,
7183,
6317,
1641,
427,
22220,
368,
341,
286,
1077,
5453,
5173,
11,
6645,
8,
284,
501,
16125,
3097,
12144,
1006,
310,
2240,
345,
310,
4329,
7,
79239,
3523,
486,
32,
288,
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_current_user_playlists() {
let mut oauth = SpotifyOAuth::default()
.scope("playlist-read-private")
.build();
match get_token(&mut oauth) {
Some(token_info) => {
let client_credential = SpotifyClientCredentials::default()
.token_info(token_info)
.build();
let spotify = Spotify::default()
.client_credentials_manager(client_credential)
.build();
let playlists = spotify.current_user_playlists(10, None);
assert!(playlists.is_ok());
}
None => assert!(false),
};
} | rust_cleaned_test_functions.jsonl/79256 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 320
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11080,
3317,
22144,
17575,
368,
341,
262,
1077,
5206,
46415,
284,
40537,
57850,
486,
2258,
741,
286,
659,
4186,
445,
34233,
28806,
65277,
1138,
286,
659,
5834,
543,
262,
2432,
633,
6458,
2099,
698... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_include_newlines() {
let (at, mut ucmd) = at_and_ucmd!();
ucmd.args(&["-l", "2", "fivelines.txt"]).succeeds();
let mut s = String::new();
at.open("xaa").read_to_string(&mut s).unwrap();
assert_eq!(s, "1\n2\n");
let mut s = String::new();
at.open("xab").read_to_string(&mut s).unwrap();
assert_eq!(s, "3\n4\n");
let mut s = String::new();
at.open("xac").read_to_string(&mut s).unwrap();
assert_eq!(s, "5\n");
} | rust_cleaned_test_functions.jsonl/25875 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 230
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37878,
5921,
7969,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
575,
8710,
16365,
2099,
1183,
12,
75,
497,
330,
17,
497,
330,
69,
344,
109... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_search_ipv4_large_ndots() {
let mut io_loop = Runtime::new().unwrap();
let mut config = ResolverConfig::default();
config.add_search(Name::from_str("example.com").unwrap());
let (resolver, bg) = AsyncResolver::new(
config,
ResolverOpts {
ip_strategy: LookupIpStrategy::Ipv4Only,
ndots: 5,
..ResolverOpts::default()
},
);
io_loop.spawn(bg);
let response = io_loop
.block_on(resolver.lookup_ip("198.51.100.35"))
.expect("failed to run lookup");
let mut iter = response.iter();
assert_eq!(
iter.next().expect("no rdatas"),
IpAddr::V4(Ipv4Addr::new(198, 51, 100, 35))
);
} | rust_cleaned_test_functions.jsonl/36497 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 437
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10716,
49378,
19,
45228,
43544,
2412,
368,
341,
286,
1077,
5206,
6399,
17198,
284,
10954,
486,
931,
1005,
15454,
543,
286,
1077,
5206,
2193,
284,
81854,
2648,
486,
2258,
543,
286,
2193,
1364,
1071... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_flush_cascade() {
test(
&vec!["4H 7H 8H 9H 6H", "2S 4S 5S 6S 7S"],
&vec!["4H 7H 8H 9H 6H"],
)
} | rust_cleaned_test_functions.jsonl/121277 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39213,
666,
19977,
368,
341,
1066,
262,
1273,
1006,
286,
609,
4083,
0,
1183,
19,
39,
220,
22,
39,
220,
23,
39,
220,
24,
39,
220,
21,
39,
497,
330,
17,
50,
220,
19,
50,
220,
20,
50,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_too_large_code() {
let mut code: Vec<u8> = vec![];
for _ in 0..0x6000 {
code.push(0x00);
}
code.push(0x00);
let mut builder = Code::builder();
let code = builder.append(code.as_slice());
for revision in Revision::iter() {
let host = TransientHost::new();
let host = Rc::new(RefCell::new(host));
let mut executor = Executor::new_with(host.clone(), false, revision);
let output = executor.execute_raw(&code);
if revision >= Revision::Spurious {
assert_eq!(StatusCode::Failure(FailureKind::OutOfGas), output.status_code);
}else{
assert_eq!(StatusCode::Success, output.status_code);
}
}
} | rust_cleaned_test_functions.jsonl/77205 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 329
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
78,
45228,
4136,
368,
341,
262,
1077,
5206,
2038,
25,
11312,
34837,
23,
29,
284,
7486,
0,
15078,
262,
369,
716,
304,
220,
15,
496,
15,
87,
21,
15,
15,
15,
341,
286,
2038,
2552,
7,
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... | 4 |
#[test]
fn test_create_with_zero_lamports() {
// create account with zero lamports tranferred
let new_program_owner = Pubkey::new(&[9; 32]);
let from = Pubkey::new_rand();
let mut from_account = Account::new(100, 0, &Pubkey::new_rand()); // not from system account
let to = Pubkey::new_rand();
let mut to_account = Account::new(0, 0, &Pubkey::default());
assert_eq!(
create_account(
&mut KeyedAccount::new(&from, false, &mut from_account), // no signer
&mut KeyedAccount::new(&to, true, &mut to_account),
0,
2,
&new_program_owner,
),
Ok(())
);
let from_lamports = from_account.lamports;
let to_lamports = to_account.lamports;
let to_owner = to_account.owner;
let to_data = to_account.data.clone();
assert_eq!(from_lamports, 100);
assert_eq!(to_lamports, 0);
assert_eq!(to_owner, new_program_owner);
assert_eq!(to_data, [0, 0]);
} | rust_cleaned_test_functions.jsonl/24253 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 535
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
6615,
19359,
907,
309,
3394,
368,
341,
286,
442,
1855,
2692,
448,
7168,
31603,
3394,
23686,
5554,
198,
286,
1077,
501,
25096,
29027,
284,
22611,
792,
486,
931,
2099,
58,
24,
26,
220,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_invalid_method_id() {
assert!(DID::parse("did:method:").is_err());
assert!(DID::parse("did:method:: :").is_err());
assert!(DID::parse("did:method: - - -").is_err());
assert!(DID::parse("did:method:*****").is_err());
assert!(DID::parse("did:method:identifier-|$|").is_err());
} | rust_cleaned_test_functions.jsonl/93399 | {
"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,
31433,
9032,
842,
368,
341,
220,
2060,
10297,
35,
915,
486,
6400,
445,
22920,
25,
4393,
25,
1827,
285,
9266,
1423,
220,
2060,
10297,
35,
915,
486,
6400,
445,
22920,
25,
4393,
486,
549,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_make_profile() -> Result<(), Error> {
if let Some(store) = get_store() {
let mut profile: Profile =
serde_json::from_str(include_str!("../data/user_profile_null.json")).unwrap();
profile.primary_email.value = Some(String::from("hknall@mozilla.com"));
profile.user_id.value = Some(String::from("ad|Mozilla-LDAP|hknall"));
profile.primary_username.value = Some(String::from("hknall"));
profile.uuid.value = Some(String::from("746dad92-3f94-4eed-9e25-7bc20e0041ec"));
sign_full_profile(&mut profile, &store)?;
}
Ok(())
} | rust_cleaned_test_functions.jsonl/80441 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 315
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28230,
13789,
368,
1464,
5714,
68843,
4600,
29,
341,
286,
421,
1077,
4329,
31200,
8,
284,
633,
14809,
368,
341,
310,
1077,
5206,
5526,
25,
12329,
4035,
394,
61570,
9455,
486,
1499,
2895,
77863,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_branch_truncate() {
let hdr: MapxOrdRawKeyVs<usize> = MapxOrdRawKeyVs::new();
pnk!(hdr.version_create(VersionName(b"manster0")));
let mkey0 = <usize as ValueEnDe>::encode(&1);
let mvalue0 = 1;
pnk!(hdr.insert(mkey0.clone(), mvalue0));
let mkey1 = <usize as ValueEnDe>::encode(&2);
let mvalue1 = 2;
pnk!(hdr.insert(mkey1.clone(), mvalue1));
pnk!(hdr.branch_truncate(INITIAL_BRANCH_NAME));
assert!(hdr.get(&mkey0).is_none());
assert!(hdr.get(&mkey1).is_none());
} | rust_cleaned_test_functions.jsonl/53981 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 263
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28031,
3547,
26900,
368,
341,
262,
1077,
36615,
25,
5027,
87,
24621,
20015,
1592,
51737,
90244,
29,
284,
5027,
87,
24621,
20015,
1592,
51737,
486,
931,
543,
262,
43050,
74,
10297,
28785,
19484,
86... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_batch_for() {
let mut list = SongList::new_from_initial_batch(batch(0));
list.add(batch(1));
list.add(batch(2));
list.add(batch(3));
assert_eq!(list.partial_len(), 8);
let batch = list.song_batch_for(3);
assert_eq!(batch.unwrap().batch.offset, 2);
} | rust_cleaned_test_functions.jsonl/101862 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 165
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14534,
5478,
368,
341,
286,
1077,
5206,
1140,
284,
18971,
852,
486,
931,
5673,
15809,
14534,
30139,
7,
15,
1106,
286,
1140,
1364,
30139,
7,
16,
1106,
286,
1140,
1364,
30139,
7,
17,
1106,
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_1vcpu_ht_on() {
check_update_amd_features_entry(1, true);
check_update_extended_apic_id_entry(0, 1, true, 0, 0);
} | rust_cleaned_test_functions.jsonl/94922 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 82
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
16,
85,
16475,
49086,
4470,
368,
341,
286,
1779,
8882,
22880,
67,
14965,
9078,
7,
16,
11,
830,
626,
286,
1779,
8882,
61678,
21093,
292,
842,
9078,
7,
15,
11,
220,
16,
11,
830,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_decode_mov_rxx_w() {
assert_eq!(
decode_32(0xea4f0232),
Instruction::RRX {
params: Reg2Params {
rd: Reg::R2,
rm: Reg::R2,
setflags: false,
}
}
);
} | rust_cleaned_test_functions.jsonl/64877 | {
"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,
15227,
55798,
1710,
4146,
1670,
368,
341,
1066,
262,
2060,
10714,
33673,
286,
16895,
62,
18,
17,
7,
15,
56570,
19,
69,
15,
17,
18,
17,
1326,
286,
29051,
486,
8106,
55,
341,
310,
3628,
25,
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_copy_from_slice() {
let src = [0, 1, 2, 3, 4, 5];
let mut dst = [0; 6];
dst.copy_from_slice(&src);
assert_eq!(src, dst)
} | rust_cleaned_test_functions.jsonl/12936 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 83
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16096,
5673,
26488,
368,
341,
262,
1077,
2286,
284,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
262,
1077,
5206,
10648,
284,
508,
15,
26,
220,
21,
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 |
#[test]
fn test_client_shutdown() {
let server_port = utils::get_available_port();
let server_addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), server_port);
let mut server = NetworkServer::new(server_addr);
let mut client = NetworkClient::new(server_addr);
let data = vec![0, 1, 2, 3];
client.write(&data).unwrap();
let result = server.read().unwrap();
assert_eq!(data, result);
client.shutdown().unwrap();
let mut client = NetworkClient::new(server_addr);
assert!(server.read().is_err());
let data = vec![4, 5, 6, 7];
client.write(&data).unwrap();
let result = server.read().unwrap();
assert_eq!(data, result);
} | rust_cleaned_test_functions.jsonl/52046 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 336
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8179,
54804,
368,
341,
286,
1077,
3538,
8716,
284,
12439,
486,
455,
26962,
8716,
543,
286,
1077,
3538,
7387,
284,
20954,
13986,
486,
931,
8972,
79,
13986,
486,
53,
19,
8972,
30168,
19,
13986,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sha256_with_empty_context_and_emtpy_data() {
let context = TestContext::new(&[]);
let data = b"";
let mut state = Sha256::new_with_context(&context);
state.write(data);
let digest = state.finish();
assert_eq!(
digest,
[
0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f,
0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b,
0x78, 0x52, 0xb8, 0x55,
]
);
} | rust_cleaned_test_functions.jsonl/10225 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 316
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48836,
17,
20,
21,
6615,
15124,
8467,
8378,
22504,
790,
88,
1769,
368,
341,
262,
1077,
2266,
284,
3393,
1972,
486,
931,
2099,
56703,
262,
1077,
821,
284,
293,
3014,
401,
262,
1077,
5206,
1584,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_user_defined_eq() {
// Our type.
struct SketchyNum {
num : int
}
// Our implementation of `PartialEq` to support `==` and `!=`.
impl PartialEq for SketchyNum {
// Our custom eq allows numbers which are near each other to be equal! :D
fn eq(&self, other: &SketchyNum) -> bool {
(self.num - other.num).abs() < 5
}
}
// Now these binary operators will work when applied!
assert!(SketchyNum {num: 37} == SketchyNum {num: 34});
assert!(SketchyNum {num: 25} != SketchyNum {num: 57});
} | rust_cleaned_test_functions.jsonl/101461 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 245
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3317,
52870,
10714,
368,
341,
262,
442,
5633,
943,
624,
262,
2036,
38401,
88,
4651,
341,
286,
1629,
549,
526,
198,
262,
555,
262,
442,
5633,
8129,
315,
1565,
37314,
27312,
63,
311,
1824,
1565,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vector2() {
let data = b"what do ya want for nothing?";
let key = b"Jefe";
let expected = "effcdf6ae5eb2fa2d27416d5f184df9c259a7c79";
let mut hash = HmacSha::new(key, data, Sha1::default());
let buf = hash.compute_digest();
assert_eq!(hex::encode(buf), expected);
} | rust_cleaned_test_functions.jsonl/90604 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 176
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12247,
17,
368,
341,
1789,
286,
1077,
821,
284,
293,
1,
12555,
653,
13526,
1366,
369,
4302,
75558,
286,
1077,
1376,
284,
293,
1,
41,
44953,
876,
286,
1077,
3601,
284,
330,
6445,
58348,
21,
591... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_apply_with_alpha_rgb() {
let mut rgb = Rgb([0, 0, 0]);
rgb.apply_with_alpha(|s| s, |_| panic!("bug"));
assert_eq!(rgb, Rgb([0, 0, 0]));
} | rust_cleaned_test_functions.jsonl/46637 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 106
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36551,
6615,
26633,
37407,
368,
341,
286,
1077,
5206,
17993,
284,
431,
9511,
2561,
15,
11,
220,
15,
11,
220,
15,
2558,
286,
17993,
13045,
6615,
26633,
22428,
82,
91,
274,
11,
66091,
21975,
17223... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_null_equal() {
let a = NullArray::new(12).data();
let b = NullArray::new(12).data();
test_equal(&a, &b, true);
let b = NullArray::new(10).data();
test_equal(&a, &b, false);
// Test the case where offset != 0
let a_slice = a.slice(2, 3);
let b_slice = b.slice(1, 3);
test_equal(&a_slice, &b_slice, true);
let a_slice = a.slice(5, 4);
let b_slice = b.slice(3, 3);
test_equal(&a_slice, &b_slice, false);
} | rust_cleaned_test_functions.jsonl/46939 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 268
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15162,
11478,
368,
341,
286,
1077,
264,
284,
18084,
1857,
486,
931,
7,
16,
17,
568,
691,
543,
286,
1077,
293,
284,
18084,
1857,
486,
931,
7,
16,
17,
568,
691,
543,
286,
1273,
11478,
2099,
64... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_queue_basic_double_stack() {
let data = vec![1, 2, 3, 4];
let mut v1 = vec![0; 2];
let mut v2 = vec![0; 2];
let s1 = SliceStack::from(v1.as_mut_slice());
let s2 = SliceStack::from(v2.as_mut_slice());
let mut queue = DoubleStack(s1, s2);
for elem in data.iter() {
assert_eq!(queue.enqueue(*elem), None);
}
for elem in data.iter() {
assert_eq!(queue.dequeue(), Some(*elem));
}
assert_eq!(queue.dequeue(), None);
} | rust_cleaned_test_functions.jsonl/23386 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 291
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10841,
34729,
24598,
15528,
368,
341,
286,
1077,
821,
284,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
935,
286,
1077,
5206,
348,
16,
284,
7486,
20703,
15,
26,
220,
17,
935,
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... | 3 |
#[test]
fn test_scalar_root_of_unity() {
use fff::SqrtField;
assert_eq!(Scalar::S, 32);
assert_eq!(
Scalar::multiplicative_generator(),
Scalar::from_repr(ScalarRepr::from(7)).unwrap()
);
assert_eq!(
Scalar::multiplicative_generator().pow([
0xfffe5bfeffffffff,
0x9a1d80553bda402,
0x299d7d483339d808,
0x73eda753
]),
Scalar::root_of_unity()
);
assert_eq!(Scalar::root_of_unity().pow([1 << Scalar::S]), Scalar::one());
assert!(Scalar::multiplicative_generator().sqrt().is_none());
} | rust_cleaned_test_functions.jsonl/56409 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 392
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41652,
12993,
3575,
62,
2439,
368,
341,
286,
990,
282,
542,
486,
50,
8140,
1877,
401,
286,
2060,
10714,
10297,
20639,
486,
50,
11,
220,
18,
17,
317,
286,
2060,
10714,
33673,
310,
35176,
486,
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_lock_and_unlock_through_allowance() {
// Acting as carol
testing_env!(get_context(carol()));
let total_supply = 1_000_000_000_000_000u128;
let mut contract = FunToken::new(carol(), total_supply.to_string()).unwrap();
assert_eq!(contract.get_total_supply(), total_supply.to_string());
let allowance = total_supply / 3;
let lock_amount = allowance / 2;
contract.set_allowance(bob(), format!("{}", allowance)).unwrap();
assert_eq!(contract.get_allowance(carol(), bob()), format!("{}", allowance));
// Acting as bob now
testing_env!(get_context(bob()));
contract.lock(carol(), lock_amount.to_string()).unwrap();
assert_eq!(contract.get_allowance(carol(), bob()), (allowance - lock_amount).to_string());
assert_eq!(
contract.get_unlocked_balance(carol()),
(total_supply - lock_amount).to_string()
);
assert_eq!(contract.get_total_balance(carol()), total_supply.to_string());
contract.unlock(carol(), lock_amount.to_string()).unwrap();
assert_eq!(contract.get_allowance(carol(), bob()), format!("{}", allowance));
assert_eq!(contract.get_unlocked_balance(carol()), total_supply.to_string());
assert_eq!(contract.get_total_balance(carol()), total_supply.to_string());
} | rust_cleaned_test_functions.jsonl/74527 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 593
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9818,
8378,
19465,
87399,
55731,
681,
368,
341,
286,
442,
72689,
438,
1803,
337,
198,
286,
7497,
15879,
10297,
455,
8467,
42078,
337,
7392,
286,
1077,
2790,
65630,
284,
220,
16,
62,
15,
15,
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_build_response_base() {
let mut headers = Headers::new();
let content_type_hdr = ContentType::plaintext();
headers.set(ContentType::plaintext());
let body = String::from("This is a test");
let resp = build_response_base::<String>(StatusCode::Ok, Some(headers), Some(body.clone()));
assert_eq!(resp.status(), StatusCode::Ok);
assert_eq!(resp.headers().len(), 1);
assert_eq!(resp.headers().get::<ContentType>(), Some(&content_type_hdr));
assert_eq!(body_to_string(resp.body()), body);
} | rust_cleaned_test_functions.jsonl/14362 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 241
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20801,
9655,
7651,
368,
341,
286,
1077,
5206,
7102,
284,
21426,
486,
931,
543,
286,
1077,
2213,
1819,
28238,
284,
70431,
486,
71223,
543,
286,
7102,
980,
7,
29504,
486,
71223,
1423,
286,
1077,
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_atom_id() {
let mut atoms = AtomSpace::default();
let atom = Atom::Tx(new_tx_port(1));
let atom_id = atoms.do_share_atom(atom);
let atom = atoms.get_atom(atom_id).unwrap();
assert_eq!(atom.get_atom_id().unwrap(), atom_id);
} | rust_cleaned_test_functions.jsonl/5083 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42292,
842,
368,
341,
286,
1077,
5206,
32199,
284,
39516,
9914,
486,
2258,
543,
286,
1077,
19124,
284,
39516,
486,
31584,
1755,
17805,
8716,
7,
16,
1106,
286,
1077,
19124,
842,
284,
32199,
16521,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_account_lengths() {
assert_eq!(
4,
serialized_size(&UpgradeableLoaderState::Uninitialized).unwrap()
);
assert_eq!(36, UpgradeableLoaderState::program_len().unwrap());
assert_eq!(
45,
UpgradeableLoaderState::programdata_data_offset().unwrap()
);
assert_eq!(
45 + 42,
UpgradeableLoaderState::programdata_len(42).unwrap()
);
} | rust_cleaned_test_functions.jsonl/29083 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 244
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13500,
54416,
368,
341,
286,
2060,
10714,
33673,
310,
220,
19,
345,
310,
32916,
2368,
2099,
43861,
480,
9181,
1397,
486,
1806,
36161,
568,
15454,
741,
286,
1439,
286,
2060,
10714,
10297,
18,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_recall() {
let (y_true, y_pred) = setup();
let cm = confusion_matrix::ConfusionMatrix::new(y_true.clone(),
y_pred.clone());
let rec_score = cm.recall_score(1);
let result = 0.7;
assert_eq!(utils::round_f64(rec_score, 1), result);
} | rust_cleaned_test_functions.jsonl/120959 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
90311,
368,
341,
286,
1077,
320,
88,
16082,
11,
379,
12830,
8,
284,
6505,
1428,
286,
1077,
9961,
284,
21340,
10193,
486,
15578,
7560,
6689,
486,
931,
7021,
16082,
15997,
1507,
715,
8136,
379,
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... | 1 |
#[test]
fn test_kleene() {
let a = BooleanChunked::new("", &[Some(true), Some(false), None]);
let trues = BooleanChunked::from_slice("", &[true, true, true]);
let falses = BooleanChunked::from_slice("", &[false, false, false]);
let c = &a | &trues;
assert_eq!(Vec::from(&c), &[Some(true), Some(true), Some(true)]);
let c = &a | &falses;
assert_eq!(Vec::from(&c), &[Some(true), Some(false), None])
} | rust_cleaned_test_functions.jsonl/96371 | {
"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,
4698,
273,
1952,
368,
341,
286,
1077,
264,
284,
6992,
28304,
291,
486,
931,
19814,
44590,
8373,
3715,
701,
4329,
3576,
701,
2240,
2558,
286,
1077,
489,
1137,
284,
6992,
28304,
291,
486,
1499,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_panic() {
let point = FailPoint::new();
point.set_actions("", vec![Action::new(Task::Panic(None), 1.0, None)]);
point.eval("test_fail_point_panic");
} | rust_cleaned_test_functions.jsonl/18298 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
31270,
368,
341,
286,
1077,
1459,
284,
39645,
2609,
486,
931,
543,
286,
1459,
980,
25368,
19814,
7486,
20703,
2512,
486,
931,
47531,
486,
47,
31270,
26717,
701,
220,
16,
13,
15,
11,
2240,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_add_vector_and_scalar() {
let vector = Vector {
x: 1.0,
y: 1.5,
z: 2.0,
};
let scalar = 2.0;
let expected_result = Vector {
x: 3.0,
y: 3.5,
z: 4.0,
};
assert_eq!(vector + scalar, expected_result);
assert_eq!(vector + scalar, expected_result);
assert_eq!(scalar + vector, expected_result);
assert_eq!(scalar + vector, expected_result);
} | rust_cleaned_test_functions.jsonl/134055 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 290
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
12247,
8378,
41652,
368,
341,
286,
1077,
4621,
284,
4196,
341,
310,
856,
25,
220,
16,
13,
15,
345,
310,
379,
25,
220,
16,
13,
20,
345,
310,
1147,
25,
220,
17,
13,
15,
345,
286,
2605,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_default_profile_ok() {
let mut profile_path = PathBuf::new();
profile_path.push("./test-data/profiles/default.toml");
let result = ProfileFile::from_file(profile_path);
assert!(result.is_ok());
// compare with expected result
let expected = ProfileFile {
version: "1.0".to_owned(),
sc: Some(TargetAddr {
host: "127.0.0.1".to_owned(),
port: 9033,
}),
spu: Some(TargetAddr {
host: "127.0.0.1".to_owned(),
port: 9034,
}),
kf: Some(TargetAddr {
host: "127.0.0.1".to_owned(),
port: 9093,
}),
};
assert_eq!(result.unwrap(), expected);
} | rust_cleaned_test_functions.jsonl/109303 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 462
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9993,
13789,
19817,
368,
341,
286,
1077,
5206,
5526,
2638,
284,
7933,
15064,
486,
931,
543,
286,
5526,
2638,
2552,
13988,
1944,
13945,
23580,
82,
28989,
73494,
75,
3071,
1789,
286,
1077,
1102,
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_invalid_password() {
test_login("Sergio", "password1", "30", Status::Ok, "Wrong password!");
test_login("Sergio", "ok", "30", Status::Ok, "Password is invalid: too short!");
} | rust_cleaned_test_functions.jsonl/46556 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 82
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
10122,
368,
341,
262,
1273,
13681,
445,
50,
2375,
815,
497,
330,
3833,
16,
497,
330,
18,
15,
497,
8104,
486,
11578,
11,
330,
29185,
3552,
11142,
262,
1273,
13681,
445,
50,
2375,
815,
49... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_dictionary_array() {
// Construct a value array
let value_data = ArrayData::builder(DataType::Int8)
.len(8)
.add_buffer(Buffer::from(
&[10_i8, 11, 12, 13, 14, 15, 16, 17].to_byte_slice(),
))
.build();
let keys = Buffer::from(&[2_i16, 3, 4].to_byte_slice());
// Construct a dictionary array from the above two
let key_type = DataType::Int16;
let value_type = DataType::Int8;
let dict_data_type =
DataType::Dictionary(Box::new(key_type), Box::new(value_type));
let dict_data = ArrayData::builder(dict_data_type.clone())
.len(3)
.add_buffer(keys.clone())
.add_child_data(value_data.clone())
.build();
let dict_array = Int16DictionaryArray::from(dict_data);
let values = dict_array.values();
assert_eq!(value_data, values.data());
assert_eq!(DataType::Int8, dict_array.value_type());
assert_eq!(3, dict_array.len());
// Null count only makes sense in terms of the component arrays.
assert_eq!(0, dict_array.null_count());
assert_eq!(0, dict_array.values().null_count());
assert_eq!(Some(Some(3)), dict_array.keys().nth(1));
assert_eq!(Some(Some(4)), dict_array.keys().nth(2));
assert_eq!(
dict_array.keys().collect::<Vec<Option<i16>>>(),
vec![Some(2), Some(3), Some(4)]
);
// Now test with a non-zero offset
let dict_data = ArrayData::builder(dict_data_type)
.len(2)
.offset(1)
.add_buffer(keys)
.add_child_data(value_data.clone())
.build();
let dict_array = Int16DictionaryArray::from(dict_data);
let values = dict_array.values();
assert_eq!(value_data, values.data());
assert_eq!(DataType::Int8, dict_array.value_type());
assert_eq!(2, dict_array.len());
assert_eq!(Some(Some(3)), dict_array.keys().nth(0));
assert_eq!(Some(Some(4)), dict_array.keys().nth(1));
assert_eq!(
dict_array.keys().collect::<Vec<Option<i16>>>(),
vec![Some(3), Some(4)]
);
} | rust_cleaned_test_functions.jsonl/11607 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1118
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42605,
3858,
368,
341,
286,
442,
18678,
264,
897,
1334,
198,
286,
1077,
897,
1769,
284,
2910,
1043,
486,
17850,
63941,
486,
1072,
23,
340,
310,
659,
2892,
7,
23,
340,
310,
659,
718,
7776,
5557... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_one_minus_one_plus_line() {
DeltaTest::with_args(&[
"--side-by-side",
"--width",
"40",
"--line-fill-method=spaces",
])
.with_input(ONE_MINUS_ONE_PLUS_LINE_DIFF)
.expect_after_header(
r#"
│ 1 │a = 1 │ 1 │a = 1
│ 2 │b = 2 │ 2 │bb = 2 "#,
);
} | rust_cleaned_test_functions.jsonl/72598 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 274
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11667,
38457,
11667,
28043,
6528,
368,
341,
286,
24957,
2271,
486,
4197,
8384,
2099,
9640,
310,
14482,
2929,
14319,
24067,
756,
310,
14482,
3098,
756,
310,
330,
19,
15,
756,
310,
14482,
1056,
5898... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_flags_from_vec_19() {
use tempfile::TempDir;
let temp_dir = TempDir::new().expect("tempdir fail");
let (_, temp_dir_path) =
deno_fs::resolve_from_cwd(temp_dir.path().to_str().unwrap()).unwrap();
let (flags, subcommand, argv) = flags_from_vec(svec![
"deno",
"run",
format!("--allow-read={}", &temp_dir_path),
"script.ts"
]);
assert_eq!(
flags,
DenoFlags {
allow_read: false,
read_whitelist: svec![&temp_dir_path],
..DenoFlags::default()
}
);
assert_eq!(subcommand, DenoSubcommand::Run);
assert_eq!(argv, svec!["deno", "script.ts"]);
} | rust_cleaned_test_functions.jsonl/112848 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 329
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14130,
5673,
13251,
62,
16,
24,
368,
341,
262,
990,
54819,
486,
12151,
6184,
280,
262,
1077,
2730,
4334,
284,
19944,
6184,
486,
931,
1005,
17119,
445,
3888,
3741,
3690,
797,
262,
1077,
39464,
27... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_wakeup() {
let latches = Latches::new(256);
let slots_a: Vec<u64> = vec![1, 3, 5];
let mut lock_a = Lock::new(slots_a);
let slots_b: Vec<u64> = vec![4, 5, 6];
let mut lock_b = Lock::new(slots_b);
let cid_a: u64 = 1;
let cid_b: u64 = 2;
// a acquire lock success
let acquired_a = latches.acquire(&mut lock_a, cid_a);
assert_eq!(acquired_a, true);
// b acquire lock failed
let mut acquired_b = latches.acquire(&mut lock_b, cid_b);
assert_eq!(acquired_b, false);
let wakeup = latches.release(&lock_a, cid_a);
assert_eq!(wakeup[0], cid_b);
// b acquire lock success
acquired_b = latches.acquire(&mut lock_b, cid_b);
assert_eq!(acquired_b, true);
} | rust_cleaned_test_functions.jsonl/123025 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 426
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1670,
62744,
368,
341,
286,
1077,
326,
9118,
284,
444,
9118,
486,
931,
7,
17,
20,
21,
626,
286,
1077,
15711,
4306,
25,
11312,
34837,
21,
19,
29,
284,
7486,
20703,
16,
11,
220,
18,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pow_complex() {
let in_out = vec![
((2f64, 0f64), (0f64, 3f64), (-0.4869944f64, 0.8734050f64)),
((2f64, 0f64), (2f64, 3f64), (-1.9479776f64, 3.4936203f64)),
((0f64, 2f64), (0f64, 3f64), (-0.0043748f64, 0.0078460f64)),
((3f64, 2f64), (0f64, 3f64), (-0.1304148f64, -0.111153f64)),
((3f64, 2f64), (4f64, 3f64), (28.8577819f64, -2.422530f64)),
(
(3f64, 0f64),
(0f64, 1f64 / 3f64),
(0.9336932f64, 0.3580738f64),
),
(
(3f64, 4f64),
(0f64, 1f64 / 4f64),
(0.7297490f64, 0.3105648f64),
),
];
for (a, b, expected_result) in in_out {
let actual_result =
KalkNum::new_with_imaginary(KalkNum::from(a.0).value, "", KalkNum::from(a.1).value)
.pow_without_unit(KalkNum::new_with_imaginary(
KalkNum::from(b.0).value,
"",
KalkNum::from(b.1).value,
));
assert!(cmp(actual_result.to_f64(), expected_result.0));
assert!(cmp(actual_result.imaginary_to_f64(), expected_result.1));
}
} | rust_cleaned_test_functions.jsonl/132411 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 841
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56183,
41522,
368,
341,
286,
1077,
304,
6068,
284,
7486,
90515,
310,
1781,
17,
69,
21,
19,
11,
220,
15,
69,
21,
19,
701,
320,
15,
69,
21,
19,
11,
220,
18,
69,
21,
19,
701,
10293,
15,
13,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_from_static_custom_short() {
let a = HeaderName {
inner: Repr::Custom(Custom(ByteStr::from_static("customheader"))),
};
let b = HeaderName::from_static("customheader");
assert_eq!(a, b);
} | rust_cleaned_test_functions.jsonl/3410 | {
"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,
5673,
25360,
15875,
16673,
368,
341,
286,
1077,
264,
284,
12104,
675,
341,
310,
9179,
25,
1032,
649,
486,
10268,
3025,
1450,
55823,
2580,
486,
1499,
25360,
445,
9163,
2708,
2761,
1326,
286,
2605,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sort_stability() {
for len in range(4, 25) {
for _ in range(0 , 10) {
let mut counts = [0, .. 10];
// the second item represents which occurrence of that
// will occur in sorted order.
let mut v = range(0, len).map(|_| {
let n = task_rng().gen::<uint>() % 10;
counts[n] += 1;
(n, counts[n])
}).collect::<Vec<(uint, int)>>();
// may mix up the counts.
v.sort_by(|&(a,_), &(b,_)| a.cmp(&b));
// this comparison includes the count (the second item
// will need to be ordered with increasing
// stable.
assert!(v.as_slice().windows(2).all(|w| w[0] <= w[1]));
}
}
} | rust_cleaned_test_functions.jsonl/75611 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 610
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18435,
1261,
2897,
368,
341,
286,
369,
2422,
304,
2088,
7,
19,
11,
220,
17,
20,
8,
341,
310,
369,
716,
304,
2088,
7,
15,
1154,
220,
16,
15,
8,
341,
394,
1077,
5206,
14579,
284,
508,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_args_dim() {
let mut args = Args::new();
assert_eq!(100, args.dim());
args.set_dim(50);
assert_eq!(50, args.dim());
} | rust_cleaned_test_functions.jsonl/118613 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8384,
10791,
368,
341,
286,
1077,
5206,
2827,
284,
17693,
486,
931,
543,
286,
2060,
10714,
10297,
16,
15,
15,
11,
2827,
34265,
5231,
286,
2827,
980,
10791,
7,
20,
15,
317,
286,
2060,
10714,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_expand_lines_weird_symbol_1() {
let fake_screen: Vec<&'static str> = vec!["abc ▸ <root>#efg"];
let os = get_observed_screen(&fake_screen);
let hits = os.find_occurences("root");
assert_eq!(hits.len(), 1);
let hit = hits.first().unwrap();
assert_eq!(hit.size(), Vec2::new(4, 1));
let expanded_left = hit.expanded_line(3, 0);
assert_eq!(expanded_left.size(), Vec2::new(7, 1));
assert_eq!(expanded_left.to_string(), "▸ <root");
let expanded_left = hit.expanded_line(7, 0);
assert_eq!(expanded_left.size(), Vec2::new(11, 1));
assert_eq!(expanded_left.to_string(), "abc ▸ <root");
let expanded_right = hit.expanded_line(0, 5);
assert_eq!(expanded_right.size(), Vec2::new(9, 1));
assert_eq!(expanded_right.to_string(), "root> efg");
} | rust_cleaned_test_functions.jsonl/69240 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 419
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67875,
18323,
45922,
2603,
21179,
62,
16,
368,
341,
286,
1077,
12418,
17649,
25,
11312,
52244,
6,
1978,
607,
29,
284,
7486,
0,
1183,
13683,
14520,
116,
366,
2888,
61125,
823,
70,
31797,
286,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_destroy_output_stream_after_unplugging_a_nondefault_output_device() {
test_unplug_a_device_on_an_active_stream(StreamType::OUTPUT, Scope::Output, false, 0);
} | rust_cleaned_test_functions.jsonl/23854 | {
"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,
18066,
7645,
12673,
19844,
4907,
500,
35268,
4306,
21637,
2258,
7645,
9204,
368,
341,
262,
1273,
4907,
47474,
4306,
9204,
4470,
12008,
12930,
12673,
52011,
929,
486,
30301,
11,
34920,
486,
5097,
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 |
#[test]
fn test_asset_config_activation() {
let mut services = TransferQuotaServiceCollection::default();
services.set_user_1_tags(L1);
// change to inactivated
services.change_asset_config(context_admin(), ChangeAssetConfigPayload {
asset_id: ASSET_ID.clone(),
asset_config: AssetConfig {
admin: ADMIN_ACCOUNT.clone(),
activated: false,
single_bill_quota: vec![
Rule {
kyc_expr: "!Huobi.level@`NULL`".to_string(),
// quota while kyc_expr returns true
quota: 1,
},
Rule {
kyc_expr: "Huobi.level@`NULL`".to_string(),
// quota while kyc_expr returns true
quota: 1,
},
],
daily_quota_rule: vec![
Rule {
kyc_expr: "!Huobi.level@`NULL`".to_string(),
// quota while kyc_expr returns true
quota: 1,
},
Rule {
kyc_expr: "Huobi.level@`NULL`".to_string(),
// quota while kyc_expr returns true
quota: 1,
},
],
monthly_quota_rule: vec![
Rule {
kyc_expr: "!Huobi.level@`NULL`".to_string(),
// quota while kyc_expr returns true
quota: 1,
},
Rule {
kyc_expr: "Huobi.level@`NULL`".to_string(),
// quota while kyc_expr returns true
quota: 1,
},
],
yearly_quota_rule: vec![
Rule {
kyc_expr: "!Huobi.level@`NULL`".to_string(),
// quota while kyc_expr returns true
quota: 1,
},
Rule {
kyc_expr: "Huobi.level@`NULL`".to_string(),
// quota while kyc_expr returns true
quota: 1,
},
],
},
});
// this exceed all quota of L1
let res = quota_transfer!(services, 100000000);
assert_eq!(res.code, 0);
} | rust_cleaned_test_functions.jsonl/68196 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1449
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42299,
5332,
52404,
368,
341,
262,
1077,
5206,
3516,
284,
23200,
2183,
6089,
1860,
6482,
486,
2258,
1428,
262,
3516,
980,
3317,
62,
16,
16333,
4957,
16,
626,
262,
442,
2297,
311,
304,
30162,
198... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ruw_arc() {
let arc = Arc::new(RwLock::new(0));
let arc2 = arc.clone();
let (tx, rx) = channel();
thread::spawn(move || {
for _ in 0..10 {
let mut lock = arc2.write();
let tmp = *lock;
*lock = -1;
thread::yield_now();
*lock = tmp + 1;
}
tx.send(()).unwrap();
});
let mut children = Vec::new();
// Upgradable readers try to catch the writer in the act and also
// try to touch the value
for _ in 0..5 {
let arc3 = arc.clone();
children.push(thread::spawn(move || {
let lock = arc3.upgradable_read();
let tmp = *lock;
assert!(tmp >= 0);
thread::yield_now();
let mut lock = RwLockUpgradableReadGuard::upgrade(lock);
assert_eq!(tmp, *lock);
*lock = -1;
thread::yield_now();
*lock = tmp + 1;
}));
}
// Readers try to catch the writers in the act
for _ in 0..5 {
let arc4 = arc.clone();
children.push(thread::spawn(move || {
let lock = arc4.read();
assert!(*lock >= 0);
}));
}
// Wait for children to pass their asserts
for r in children {
assert!(r.join().is_ok());
}
// Wait for writer to finish
rx.recv().unwrap();
let lock = arc.read();
assert_eq!(*lock, 15);
} | rust_cleaned_test_functions.jsonl/15749 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 901
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
42110,
62914,
368,
341,
286,
1077,
15580,
284,
19689,
486,
931,
2785,
86,
11989,
486,
931,
7,
15,
1106,
286,
1077,
15580,
17,
284,
15580,
15997,
543,
286,
1077,
320,
3998,
11,
19111,
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... | 8 |
#[test]
fn test_insert_overwrite() {
let mut m = HashMap::new();
assert!(m.insert(1, 2));
assert_eq!(*m.get(&1), 2);
assert!(!m.insert(1, 3));
assert_eq!(*m.get(&1), 3);
} | rust_cleaned_test_functions.jsonl/45618 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 123
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
15431,
4934,
368,
341,
286,
1077,
5206,
296,
284,
10528,
486,
931,
543,
286,
2060,
10297,
76,
7030,
7,
16,
11,
220,
17,
1106,
286,
2060,
10714,
0,
4071,
76,
670,
2099,
16,
701,
220,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rpc_verify_signature() {
let tx = system_transaction::transfer(
&Keypair::new(),
&solana_sdk::pubkey::new_rand(),
20,
hash(&[0]),
);
assert_eq!(
verify_signature(&tx.signatures[0].to_string()).unwrap(),
tx.signatures[0]
);
let bad_signature = "a1b2c3d4";
assert_eq!(
verify_signature(&bad_signature.to_string()),
Err(Error::invalid_params("Invalid param: WrongSize"))
);
} | rust_cleaned_test_functions.jsonl/3046 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 304
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60799,
35638,
39859,
368,
341,
286,
1077,
9854,
284,
1849,
28884,
486,
24188,
1006,
310,
609,
6608,
1082,
1310,
486,
931,
3148,
310,
609,
38198,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
3148,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sign_wrong_sk() {
let result = sign(
"z794853ce9e44b4c7a69c6a3b87db077f8f910f244bb6b966ba5fed83c9756f1".to_string(),
"100000000000000fffffffffffffffffff00000000000000ffffffffff000000".to_string(),
);
let (success, _): (bool, String) = serde_json::from_str(&result).unwrap();
assert!(!success);
} | rust_cleaned_test_functions.jsonl/49766 | {
"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,
11172,
75198,
33811,
368,
341,
286,
1077,
1102,
284,
1841,
1006,
310,
330,
89,
22,
24,
19,
23,
20,
18,
346,
24,
68,
19,
19,
65,
19,
66,
22,
64,
21,
24,
66,
21,
64,
18,
65,
23,
22,
1999... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_issuer_set_count_error() {
let (mut context, tx) = create_test_context(Action::Create, IssuerError::SetCountInvalid);
let tx = context.complete_tx(tx);
// run
let err = context.verify_tx(&tx, MAX_CYCLES).unwrap_err();
let script_cell_index = 0;
assert_error_eq!(
err,
ScriptError::ValidationFailure(ISSUER_SET_COUNT_ERROR)
.output_type_script(script_cell_index)
);
} | rust_cleaned_test_functions.jsonl/54747 | {
"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,
8657,
62,
66817,
2602,
3180,
4096,
368,
341,
262,
1077,
320,
6984,
2266,
11,
9854,
8,
284,
1855,
4452,
8467,
21905,
486,
4021,
11,
15935,
8801,
1454,
486,
1649,
2507,
7928,
626,
262,
1077,
9854,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_deprecated_hunk_style_is_rewritten() {
let mut opt = cli::Opt::from_iter(Vec::<OsString>::new());
opt.deprecated_hunk_style = Some("underline".to_string());
let default = "blue box";
assert_eq!(opt.hunk_header_decoration_style, default);
apply_rewrite_rules(&mut opt, &clap::ArgMatches::new());
assert_eq!(opt.deprecated_hunk_style, None);
assert_eq!(opt.hunk_header_decoration_style, "underline");
} | rust_cleaned_test_functions.jsonl/32724 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 215
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2259,
19889,
1523,
3122,
15117,
6892,
1288,
25569,
368,
341,
286,
1077,
5206,
3387,
284,
21348,
486,
21367,
486,
1499,
11723,
49923,
27638,
28867,
703,
6831,
931,
1423,
286,
3387,
2285,
19889,
1523,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_basic_multicast() {
assert!(!Address::LINK_LOCAL_ALL_ROUTERS.is_unspecified());
assert!(Address::LINK_LOCAL_ALL_ROUTERS.is_multicast());
assert!(!Address::LINK_LOCAL_ALL_ROUTERS.is_link_local());
assert!(!Address::LINK_LOCAL_ALL_ROUTERS.is_loopback());
assert!(!Address::LINK_LOCAL_ALL_NODES.is_unspecified());
assert!(Address::LINK_LOCAL_ALL_NODES.is_multicast());
assert!(!Address::LINK_LOCAL_ALL_NODES.is_link_local());
assert!(!Address::LINK_LOCAL_ALL_NODES.is_loopback());
} | rust_cleaned_test_functions.jsonl/91019 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 276
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
26290,
35446,
368,
341,
286,
2060,
0,
3471,
4286,
486,
35956,
28399,
16269,
8302,
47637,
2079,
4907,
53434,
1423,
286,
2060,
10297,
4286,
486,
35956,
28399,
16269,
8302,
47637,
2079,
26290,
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_finish_rootfs() {
let stdout_fd = std::io::stdout().as_raw_fd();
let mut spec = oci::Spec::default();
spec.linux = Some(oci::Linux::default());
spec.linux.as_mut().unwrap().masked_paths = vec!["/tmp".to_string()];
spec.linux.as_mut().unwrap().readonly_paths = vec!["/tmp".to_string()];
spec.root = Some(oci::Root {
path: "/tmp".to_string(),
readonly: true,
});
spec.mounts = vec![oci::Mount {
destination: "/dev".to_string(),
r#type: "bind".to_string(),
source: "/dev".to_string(),
options: vec!["ro".to_string(), "shared".to_string()],
}];
let ret = finish_rootfs(stdout_fd, &spec, &oci::Process::default());
assert!(ret.is_ok(), "Should pass. Got: {:?}", ret);
} | rust_cleaned_test_functions.jsonl/42579 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 415
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42980,
12993,
3848,
368,
341,
286,
1077,
20075,
17676,
284,
1460,
486,
815,
486,
36358,
1005,
300,
16067,
17676,
543,
286,
1077,
5206,
1398,
284,
93975,
486,
8327,
486,
2258,
1428,
286,
1398,
918,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compaction_filter_handle_deleting() {
let engine = TestEngineBuilder::new().build().unwrap();
let raw_engine = engine.get_rocksdb();
let value = vec![b'v'; 512];
// Delete mark and masked versions can be handled in `drop`.
must_prewrite_put(&engine, b"key", &value, b"key", 100);
must_commit(&engine, b"key", 100, 110);
must_prewrite_delete(&engine, b"key", b"key", 120);
must_commit(&engine, b"key", 120, 130);
do_gc_by_compact(&raw_engine, None, None, 200, None);
must_get_none(&engine, b"key", 110);
must_prewrite_put(&engine, b"key", &value, b"key", 100);
must_commit(&engine, b"key", 100, 110);
must_prewrite_delete(&engine, b"key", b"key", 120);
must_commit(&engine, b"key", 120, 130);
must_prewrite_put(&engine, b"key1", &value, b"key1", 120);
must_commit(&engine, b"key1", 120, 130);
do_gc_by_compact(&raw_engine, None, None, 200, None);
must_get_none(&engine, b"key", 110);
} | rust_cleaned_test_functions.jsonl/115666 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 479
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18177,
1311,
8727,
10630,
2259,
35935,
368,
341,
286,
1077,
4712,
284,
3393,
4571,
3297,
486,
931,
1005,
5834,
1005,
15454,
543,
286,
1077,
7112,
24823,
284,
4712,
670,
26608,
14553,
1999,
543,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_print_read_register_reply() {
let msg = json!({
"type": "register_reply",
"ipc_socket": "some_ipc_socket",
"rpc_endpoint": "some_rpc_endpoint",
"instance_id": 1 as InstanceID,
"version": "0.2.6"
});
let reply = read_register_reply(msg).unwrap();
let (a, b, c, d) = (
reply.ipc_socket,
reply.rpc_endpoint,
reply.instance_id,
reply.version,
);
println!("{:?},{:?},{},{:?}", a, b, c, d);
} | rust_cleaned_test_functions.jsonl/77378 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 328
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10064,
6443,
14000,
15323,
368,
341,
286,
1077,
3750,
284,
2951,
0,
2262,
310,
330,
1313,
788,
330,
6343,
15323,
756,
310,
330,
68281,
19555,
788,
330,
14689,
83806,
19555,
756,
310,
330,
29414,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_random_u64() {
let r1 = XSalsa20::random_u64([0; 32]);
let t1 = XSalsa20::random_u64([0; 32]);
let r2 = XSalsa20::random_u64([1; 32]);
let t2 = XSalsa20::random_u64([1; 32]);
assert_eq!(r1, t1);
assert_eq!(r2, t2);
} | rust_cleaned_test_functions.jsonl/68303 | {
"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,
22644,
7300,
21,
19,
368,
341,
286,
1077,
435,
16,
284,
57866,
41826,
17,
15,
486,
11463,
7300,
21,
19,
2561,
15,
26,
220,
18,
17,
2558,
286,
1077,
259,
16,
284,
57866,
41826,
17,
15,
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_apply_jql_invalid_selector() {
let json = r#"{"post code": "90210", "country": "United States", "country abbreviation": "US", "places": [{"place name": "Beverly Hills", "longitude": "-118.4065", "state": "California", "state abbreviation": "CA", "latitude": "34.0901"}]}"#;
let selectors = r#"."place"[0]."place name""#;
let value = apply_jql(json, selectors).unwrap_err().to_string();
assert_eq!("Node \"place\" not found on the parent element", value);
} | rust_cleaned_test_functions.jsonl/14757 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 183
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36551,
5374,
1470,
31433,
28890,
368,
341,
262,
1077,
2951,
284,
435,
55543,
4913,
2203,
2038,
788,
330,
24,
15,
17,
16,
15,
497,
330,
11141,
788,
330,
22372,
4180,
497,
330,
11141,
71478,
788,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mld_integration_last_send_leave() {
let (mut ctx, dev_id) = setup_simple_test_environment();
mld_join_group(&mut ctx, dev_id, MulticastAddr::new(GROUP_ADDR).unwrap());
assert_eq!(ctx.dispatcher.timer_events().count(), 1);
// The initial unsolicited report
assert_eq!(ctx.dispatcher.frames_sent().len(), 1);
assert!(testutil::trigger_next_timer(&mut ctx));
// The report after the delay
assert_eq!(ctx.dispatcher.frames_sent().len(), 2);
assert!(mld_leave_group(&mut ctx, dev_id, MulticastAddr::new(GROUP_ADDR).unwrap()).is_ok());
// Our leave message
assert_eq!(ctx.dispatcher.frames_sent().len(), 3);
// The first two messages should be reports
ensure_frame(&ctx.dispatcher().frames_sent()[0].1, 131, GROUP_ADDR, GROUP_ADDR);
ensure_frame(&ctx.dispatcher().frames_sent()[1].1, 131, GROUP_ADDR, GROUP_ADDR);
// The last one should be the done message whose destination is all routers.
ensure_frame(&ctx.dispatcher().frames_sent()[2].1, 132, IPV6_ALL_ROUTERS, GROUP_ADDR);
} | rust_cleaned_test_functions.jsonl/123218 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 478
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
507,
90250,
12195,
13565,
62666,
368,
341,
286,
1077,
320,
6984,
5635,
11,
3483,
842,
8,
284,
6505,
30015,
4452,
51774,
543,
286,
296,
507,
31017,
6288,
2099,
6984,
5635,
11,
3483,
842,
11,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_session_abnormal() {
let envelopes = capture_envelopes(|| {
sentry::start_session();
sentry::end_session_with_status(SessionStatus::Abnormal);
});
assert_eq!(envelopes.len(), 1);
let mut items = envelopes[0].items();
if let Some(EnvelopeItem::SessionUpdate(session)) = items.next() {
assert_eq!(session.status, SessionStatus::Abnormal);
assert!(session.init);
} else {
panic!("expected session");
}
assert_eq!(items.next(), None);
} | rust_cleaned_test_functions.jsonl/115611 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 273
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12316,
22885,
8252,
368,
341,
286,
1077,
86606,
284,
12322,
6205,
1813,
288,
79453,
341,
310,
3208,
884,
486,
2468,
12316,
543,
310,
3208,
884,
486,
408,
12316,
6615,
4773,
35173,
2522,
486,
5830,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_release_expired_leases_with_none_expired_releases_none() {
let mut server = new_test_server(|| 42);
server.pool.available_addrs.clear();
server.cache.insert(
[0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA],
CachedConfig {
client_addr: Ipv4Addr::new(192, 168, 1, 2),
options: vec![],
expiration: std::i64::MAX,
},
);
server
.pool
.allocated_addrs
.insert(Ipv4Addr::new(192, 168, 1, 2));
server.cache.insert(
[0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB],
CachedConfig {
client_addr: Ipv4Addr::new(192, 168, 1, 3),
options: vec![],
expiration: std::i64::MAX,
},
);
server
.pool
.allocated_addrs
.insert(Ipv4Addr::new(192, 168, 1, 3));
server.cache.insert(
[0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC],
CachedConfig {
client_addr: Ipv4Addr::new(192, 168, 1, 4),
options: vec![],
expiration: std::i64::MAX,
},
);
server
.pool
.allocated_addrs
.insert(Ipv4Addr::new(192, 168, 1, 4));
server.release_expired_leases();
assert_eq!(server.cache.len(), 3);
assert_eq!(server.pool.available_addrs.len(), 0);
assert_eq!(server.pool.allocated_addrs.len(), 3);
} | rust_cleaned_test_functions.jsonl/61734 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 908
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24577,
80221,
11751,
2264,
6615,
31488,
80221,
1288,
28299,
31488,
368,
341,
286,
1077,
5206,
3538,
284,
501,
4452,
12015,
79453,
220,
19,
17,
317,
286,
3538,
38963,
47111,
2891,
5428,
7426,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_multi_option_proposal_max_size() {
let mut proposal = create_test_multi_option_proposal();
proposal.vote_type = VoteType::MultiChoice {
max_voter_options: 3,
max_winning_options: 3,
};
let size = proposal.try_to_vec().unwrap().len();
assert_eq!(proposal.get_max_size(), Some(size));
} | rust_cleaned_test_functions.jsonl/75465 | {
"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,
25133,
9672,
21663,
32556,
6345,
2368,
368,
341,
286,
1077,
5206,
13734,
284,
1855,
4452,
25133,
9672,
21663,
32556,
543,
286,
13734,
79422,
1819,
284,
34034,
929,
486,
20358,
24728,
341,
310,
1932,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hash_epoch_to_g1() {
let epoch = test_epoch(10);
let mut pubkeys = Vec::new();
for pk in &epoch.public_keys {
pubkeys.push(PublicKey::from(pk.unwrap()));
}
// Calculate the hash from our to_bytes function
let epoch_bytes = EpochBlock::new(epoch.index.unwrap(), epoch.maximum_non_signers, pubkeys)
.encode_to_bytes()
.unwrap();
let (hash, _) = COMPOSITE_HASH_TO_G1
.hash_with_attempt(SIG_DOMAIN, &epoch_bytes, &[])
.unwrap();
// compare it with the one calculated in the circuit from its bytes
let mut cs = TestConstraintSystem::<Fr>::new();
let bits = epoch.to_bits(&mut cs.ns(|| "epoch2bits")).unwrap().0;
let ret =
EpochData::hash_bits_to_g1(&mut cs.ns(|| "hash epoch bits"), &bits, false).unwrap();
assert_eq!(ret.0.get_value().unwrap(), hash);
} | rust_cleaned_test_functions.jsonl/78213 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 455
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
20682,
2346,
1889,
16,
368,
341,
286,
1077,
16342,
284,
1273,
20682,
7,
16,
15,
317,
286,
1077,
5206,
6675,
10563,
284,
11312,
486,
931,
543,
286,
369,
22458,
304,
609,
20197,
37899,
12631... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_name_dependency_table_renamed() {
let m = indoc! {r#"
[dependencies.this2]
path = "../"
version = "0.0.1" # hello"
package = "this"
"#};
let mut v = Map::new();
v.insert("this".to_string(), "ra_this".to_string());
assert_eq!(
rename_packages(m.into(), "this", &v).unwrap(),
indoc! {r#"
[dependencies.this2]
path = "../"
version = "0.0.1" # hello"
package = "ra_this""#
}
);
} | rust_cleaned_test_functions.jsonl/120059 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 357
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1269,
62387,
5237,
1288,
30245,
368,
341,
286,
1077,
296,
284,
1257,
509,
0,
314,
81,
2,
698,
310,
508,
54274,
10889,
17,
921,
310,
1815,
284,
7005,
698,
310,
2319,
284,
330,
15,
13,
15,
13,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_waiting_unparked() {
let (tx, rx) = channel::<i32>();
let res = tx.waiting().join(::futures::lazy(move || {
let mut rx = rx;
let _ = rx.poll(); // unpark
Ok(rx)
})).and_then(|(tx, rx)| {
tx.complete(5);
rx
});
assert_eq!(res.wait().unwrap(), 5);
} | rust_cleaned_test_functions.jsonl/26366 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 223
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84683,
4907,
28736,
291,
368,
341,
286,
1077,
320,
3998,
11,
19111,
8,
284,
5496,
27638,
72,
18,
17,
10448,
286,
1077,
592,
284,
9854,
16294,
287,
1005,
5987,
38732,
69,
74606,
486,
49013,
34081... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_iter_03() {
// Initiailise Term
let t = Term::App(Expr{index:123},Expr{index:234});
for i in &t {
assert!((i == 123) || (i == 234));
}
} | rust_cleaned_test_functions.jsonl/39130 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
62,
15,
18,
368,
341,
262,
442,
31397,
604,
1064,
17519,
198,
262,
1077,
259,
284,
17519,
486,
2164,
7,
16041,
90,
1252,
25,
16,
17,
18,
2137,
16041,
90,
1252,
25,
17,
18,
19,
2960,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_remove_listener() {
let mut _lexer = SimpleLRLexer::new(InputStream::new("x y z".into()));
let token_source = CommonTokenStream::new(_lexer);
let mut parser = SimpleLRParser::new(token_source);
parser.add_parse_listener(Box::new(Listener3));
let id = parser.add_parse_listener(Box::new(Listener4 {
data: String::new(),
}));
let result = parser.s().expect("expected to parse successfully");
let mut listener = parser.remove_parse_listener(id);
assert_eq!(
&listener.data,
"terminal node x\nterminal node y\nterminal node z\n"
);
println!("--------");
listener.data.clear();
let listener = SimpleLRTreeWalker::walk(listener, &*result);
assert_eq!(
&listener.data,
"terminal node x\nterminal node y\nterminal node z\n"
);
} | rust_cleaned_test_functions.jsonl/113691 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 426
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
46493,
368,
341,
286,
1077,
5206,
716,
38815,
284,
8993,
43,
4728,
327,
261,
486,
931,
82822,
486,
931,
445,
87,
379,
1147,
3263,
18122,
7392,
286,
1077,
3950,
10347,
284,
7718,
3323,
302... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_scalar_divide() {
let x = Complex::new(3.0, 4.0);
let y_double: f64 = 2.0;
let y_complex = Complex::new_real(y_double);
assert!(x.divide(&y_complex) == x.divide_f64(y_double));
} | rust_cleaned_test_functions.jsonl/43847 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41652,
16237,
577,
368,
341,
286,
1077,
856,
284,
22096,
486,
931,
7,
18,
13,
15,
11,
220,
19,
13,
15,
317,
286,
1077,
379,
24598,
25,
282,
21,
19,
284,
220,
17,
13,
15,
280,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_uuid_creator_functions() -> Result<()> {
// TODO: move it to stateless test.
// Test {
let tests = vec![ScalarFunctionTest {
name: "zeroUUID-passed",
nullable: false,
columns: vec![],
expect: Series::new(vec!["00000000-0000-0000-0000-000000000000"]).into(),
error: "",
}];
test_scalar_functions(UUIDZeroFunction::try_create("")?, &tests)
} | rust_cleaned_test_functions.jsonl/11790 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 234
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25540,
68532,
31708,
368,
1464,
5714,
71698,
341,
262,
442,
5343,
25,
3271,
432,
311,
1584,
1717,
1273,
624,
262,
442,
3393,
341,
80719,
80719,
14808,
262,
1077,
7032,
284,
7486,
20703,
20639,
515... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_advancing() {
let mut input = FerryCellularAutomaton::parse(STARTING_STATE.iter()).unwrap();
let expected = FerryCellularAutomaton::parse(
[
"#.L#.##.L#",
"#L#####.LL",
"L.#.#..#..",
"##L#.##.##",
"#.##.#L.##",
"#.#####.#L",
"..#.#.....",
"LLL####LL#",
"#.L#####.L",
"#.L####.L#",
]
.iter(),
)
.unwrap();
for _ in 0..3 {
input.advance();
}
assert_eq!(input.state, expected.state);
} | rust_cleaned_test_functions.jsonl/59264 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 436
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35656,
8974,
368,
341,
286,
1077,
5206,
1946,
284,
78449,
3599,
1276,
41072,
23535,
486,
6400,
7,
22564,
1718,
10832,
19471,
6011,
15454,
543,
286,
1077,
3601,
284,
78449,
3599,
1276,
41072,
23535,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_set_item_does_not_update_original_object() {
Python::with_gil(|py| {
let mut v = HashMap::new();
v.insert(7, 32);
let ob = v.to_object(py);
let dict = <PyDict as PyTryFrom>::try_from(ob.as_ref(py)).unwrap();
assert!(dict.set_item(7i32, 42i32).is_ok()); // change
assert!(dict.set_item(8i32, 123i32).is_ok()); // insert
assert_eq!(32i32, v[&7i32]); // not updated!
assert_eq!(None, v.get(&8i32));
});
} | rust_cleaned_test_functions.jsonl/7723 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 294
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
5634,
96374,
7913,
8882,
39556,
5314,
368,
341,
286,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
341,
310,
1077,
5206,
348,
284,
10528,
486,
931,
543,
310,
348,
7030,
7,
22,
11,
220,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_address_eq() {
let count0 = Arc::new(AtomicUsize::new(0));
let count1 = Arc::clone(&count0);
System::new().block_on(async move {
let addr0 = MyActor(count0).start();
let addr01 = addr0.clone();
let addr02 = addr01.clone();
assert!(addr0 == addr01);
assert!(addr0 == addr02);
let addr1 = MyActor(count1).start();
assert!(addr0 != addr1);
System::current().stop();
});
} | rust_cleaned_test_functions.jsonl/82131 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 217
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6744,
10714,
368,
341,
262,
1077,
1760,
15,
284,
19689,
486,
931,
7,
65857,
52,
2141,
486,
931,
7,
15,
1106,
262,
1077,
1760,
16,
284,
19689,
486,
19982,
2099,
1830,
15,
626,
262,
739,
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_update() {
let new_name = Name::from_str("new.example.com").unwrap();
let www_name = Name::from_str("www.example.com").unwrap();
let mut authority = create_example();
let serial = authority.serial();
authority.set_allow_update(true);
let mut original_vec: Vec<Record> = vec![
Record::new()
.set_name(www_name.clone())
.set_ttl(86400)
.set_rr_type(RecordType::TXT)
.set_dns_class(DNSClass::IN)
.set_rdata(RData::TXT(TXT::new(vec!["v=spf1 -all".to_string()])))
.clone(),
Record::new()
.set_name(www_name.clone())
.set_ttl(86400)
.set_rr_type(RecordType::A)
.set_dns_class(DNSClass::IN)
.set_rdata(RData::A(Ipv4Addr::new(93, 184, 216, 34)))
.clone(),
Record::new()
.set_name(www_name.clone())
.set_ttl(86400)
.set_rr_type(RecordType::AAAA)
.set_dns_class(DNSClass::IN)
.set_rdata(RData::AAAA(Ipv6Addr::new(
0x2606, 0x2800, 0x220, 0x1, 0x248, 0x1893, 0x25c8, 0x1946,
)))
.clone(),
];
original_vec.sort();
{
// assert that the correct set of records is there.
let mut www_rrset: Vec<Record> = authority
.lookup(
&www_name.clone().into(),
RecordType::ANY,
false,
SupportedAlgorithms::new(),
)
.wait()
.unwrap()
.iter()
.cloned()
.collect();
www_rrset.sort();
assert_eq!(www_rrset, original_vec);
// assert new record doesn't exist
assert!(authority
.lookup(
&new_name.clone().into(),
RecordType::ANY,
false,
SupportedAlgorithms::new()
)
.wait()
.unwrap()
.was_empty());
}
// zone rrset rr Add to an RRset
let add_record = &[Record::new()
.set_name(new_name.clone())
.set_ttl(86400)
.set_rr_type(RecordType::A)
.set_dns_class(DNSClass::IN)
.set_rdata(RData::A(Ipv4Addr::new(93, 184, 216, 24)))
.clone()];
assert!(authority
.update_records(add_record, true,)
.expect("update failed",));
assert_eq!(
authority
.lookup(
&new_name.clone().into(),
RecordType::ANY,
false,
SupportedAlgorithms::new()
)
.wait()
.unwrap()
.iter()
.collect::<Vec<_>>(),
add_record.iter().collect::<Vec<&Record>>()
);
assert_eq!(serial + 1, authority.serial());
let add_www_record = &[Record::new()
.set_name(www_name.clone())
.set_ttl(86400)
.set_rr_type(RecordType::A)
.set_dns_class(DNSClass::IN)
.set_rdata(RData::A(Ipv4Addr::new(10, 0, 0, 1)))
.clone()];
assert!(authority
.update_records(add_www_record, true,)
.expect("update failed",));
assert_eq!(serial + 2, authority.serial());
{
let mut www_rrset: Vec<_> = authority
.lookup(
&www_name.clone().into(),
RecordType::ANY,
false,
SupportedAlgorithms::new(),
)
.wait()
.unwrap()
.iter()
.cloned()
.collect();
www_rrset.sort();
let mut plus_10 = original_vec.clone();
plus_10.push(add_www_record[0].clone());
plus_10.sort();
assert_eq!(www_rrset, plus_10);
}
// NONE rrset rr Delete an RR from an RRset
let del_record = &[Record::new()
.set_name(new_name.clone())
.set_ttl(86400)
.set_rr_type(RecordType::A)
.set_dns_class(DNSClass::NONE)
.set_rdata(RData::A(Ipv4Addr::new(93, 184, 216, 24)))
.clone()];
assert!(authority
.update_records(del_record, true,)
.expect("update failed",));
assert_eq!(serial + 3, authority.serial());
{
println!(
"after delete of specific record: {:?}",
authority.lookup(
&new_name.clone().into(),
RecordType::ANY,
false,
SupportedAlgorithms::new(),
)
);
assert!(authority
.lookup(
&new_name.into(),
RecordType::ANY,
false,
SupportedAlgorithms::new()
)
.wait()
.unwrap()
.was_empty());
}
// remove one from www
let del_record = &[Record::new()
.set_name(www_name.clone())
.set_ttl(86400)
.set_rr_type(RecordType::A)
.set_dns_class(DNSClass::NONE)
.set_rdata(RData::A(Ipv4Addr::new(10, 0, 0, 1)))
.clone()];
assert!(authority
.update_records(del_record, true,)
.expect("update failed",));
assert_eq!(serial + 4, authority.serial());
{
let mut www_rrset: Vec<_> = authority
.lookup(
&www_name.clone().into(),
RecordType::ANY,
false,
SupportedAlgorithms::new(),
)
.wait()
.unwrap()
.iter()
.cloned()
.collect();
www_rrset.sort();
assert_eq!(www_rrset, original_vec);
}
// ANY rrset empty Delete an RRset
let del_record = &[Record::new()
.set_name(www_name.clone())
.set_ttl(86400)
.set_rr_type(RecordType::A)
.set_dns_class(DNSClass::ANY)
.set_rdata(RData::NULL(NULL::new()))
.clone()];
assert!(authority
.update_records(del_record, true,)
.expect("update failed",));
assert_eq!(serial + 5, authority.serial());
let mut removed_a_vec: Vec<_> = vec![
Record::new()
.set_name(www_name.clone())
.set_ttl(86400)
.set_rr_type(RecordType::TXT)
.set_dns_class(DNSClass::IN)
.set_rdata(RData::TXT(TXT::new(vec!["v=spf1 -all".to_string()])))
.clone(),
Record::new()
.set_name(www_name.clone())
.set_ttl(86400)
.set_rr_type(RecordType::AAAA)
.set_dns_class(DNSClass::IN)
.set_rdata(RData::AAAA(Ipv6Addr::new(
0x2606, 0x2800, 0x220, 0x1, 0x248, 0x1893, 0x25c8, 0x1946,
)))
.clone(),
];
removed_a_vec.sort();
{
let mut www_rrset: Vec<Record> = authority
.lookup(
&www_name.clone().into(),
RecordType::ANY,
false,
SupportedAlgorithms::new(),
)
.wait()
.unwrap()
.iter()
.cloned()
.collect();
www_rrset.sort();
assert_eq!(www_rrset, removed_a_vec);
}
// ANY ANY empty Delete all RRsets from a name
println!("deleting all records");
let del_record = &[Record::new()
.set_name(www_name.clone())
.set_ttl(86400)
.set_rr_type(RecordType::ANY)
.set_dns_class(DNSClass::ANY)
.set_rdata(RData::NULL(NULL::new()))
.clone()];
assert!(authority
.update_records(del_record, true,)
.expect("update failed",));
assert!(authority
.lookup(
&www_name.into(),
RecordType::ANY,
false,
SupportedAlgorithms::new()
)
.wait()
.unwrap()
.was_empty());
assert_eq!(serial + 6, authority.serial());
} | rust_cleaned_test_functions.jsonl/48169 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 4494
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
368,
341,
262,
1077,
501,
1269,
284,
3988,
486,
1499,
2895,
445,
931,
7724,
905,
1827,
15454,
543,
262,
1077,
8438,
1269,
284,
3988,
486,
1499,
2895,
445,
2136,
7724,
905,
1827,
15454,
543... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_revocable_cred_def_with_payments() {
let _setup = SetupLibraryWalletPool::init();
let (schema_id, _) = ::utils::libindy::anoncreds::tests::create_and_write_test_schema(::utils::constants::DEFAULT_SCHEMA_ATTRS);
let did = settings::get_config_value(settings::CONFIG_INSTITUTION_DID).unwrap();
let revocation_details = json!({"support_revocation": true, "tails_file": get_temp_dir_path("tails.txt").to_str().unwrap(), "max_creds": 2}).to_string();
let handle = create_and_publish_credentialdef("1".to_string(),
"test_create_revocable_cred_def".to_string(),
did,
schema_id,
"tag_1".to_string(),
revocation_details).unwrap();
assert!(get_rev_reg_def(handle).unwrap().is_some());
assert!(get_rev_reg_id(handle).unwrap().is_some());
assert!(get_rev_reg_def_payment_txn(handle).unwrap().is_some());
assert!(get_rev_reg_delta_payment_txn(handle).unwrap().is_some());
let cred_id = get_cred_def_id(handle).unwrap();
::utils::libindy::anoncreds::get_cred_def_json(&cred_id).unwrap();
} | rust_cleaned_test_functions.jsonl/96766 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 737
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
38082,
509,
480,
73475,
7844,
6615,
91257,
368,
341,
286,
1077,
716,
15188,
284,
18626,
16915,
38259,
10551,
486,
2327,
1428,
286,
1077,
320,
17349,
842,
11,
27439,
284,
3504,
6031,
486,
274... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_publicationproperties_width() {
let mut publication: Publication = Publication {
publication_type: PublicationType::Pdf,
width_mm: Some(100.0),
..Default::default()
};
assert_eq!(
publication.dimension_error(),
Err(ThothError::DimensionDigitalError)
);
publication.width_mm = None;
assert_eq!(publication.dimension_error(), Ok(()));
publication.width_in = Some(39.4);
assert_eq!(
publication.dimension_error(),
Err(ThothError::DimensionDigitalError)
);
publication.publication_type = PublicationType::Paperback;
assert_eq!(
publication.dimension_error(),
Err(ThothError::WidthEmptyError)
);
publication.width_in = None;
assert_eq!(publication.dimension_error(), Ok(()));
publication.width_mm = Some(100.0);
assert_eq!(
publication.dimension_error(),
Err(ThothError::WidthEmptyError)
);
publication.width_in = Some(39.4);
assert_eq!(publication.dimension_error(), Ok(()));
} | rust_cleaned_test_functions.jsonl/46233 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 424
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27074,
367,
13193,
7927,
368,
341,
262,
1077,
5206,
16599,
25,
56894,
284,
56894,
341,
286,
16599,
1819,
25,
56894,
929,
486,
67596,
345,
286,
2374,
35599,
25,
4329,
7,
16,
15,
15,
13,
15,
132... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pub_rel() {
let mut data: &[u8] = &[0b01100010, 0b00000010, 0, 10];
match decode_slice(&mut data) {
Ok(Some(Packet::Pubrel(a))) => assert_eq!(a.get(), 10),
other => panic!("Failed decode: {:?}", other),
};
} | rust_cleaned_test_functions.jsonl/77907 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34014,
13557,
368,
341,
262,
1077,
5206,
821,
25,
44590,
84,
23,
60,
284,
44590,
15,
65,
15,
16,
16,
15,
15,
15,
16,
15,
11,
220,
15,
65,
15,
15,
15,
15,
15,
15,
16,
15,
11,
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... | 2 |
#[test]
fn test_parse_int_i8() {
assert_parses::<i8>(&[
(Ok(0i8), b"\x02\x01\x00"),
(Ok(127i8), b"\x02\x01\x7f"),
(Ok(-128i8), b"\x02\x01\x80"),
(
Err(ParseError::new(ParseErrorKind::IntegerOverflow)),
b"\x02\x02\x02\x00",
),
(
Err(ParseError::new(ParseErrorKind::InvalidValue)),
b"\x02\x00",
),
])
} | rust_cleaned_test_functions.jsonl/40825 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 323
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
4042,
5318,
23,
368,
341,
286,
2060,
77113,
288,
27638,
72,
23,
44784,
9640,
310,
320,
11578,
7,
15,
72,
23,
701,
293,
11934,
87,
15,
17,
3462,
15,
16,
3462,
15,
15,
4461,
310,
320,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_completed() {
Runtime::new()
.unwrap()
.block_on(lazy(|| {
let mut info = PipelineInfo::new(HttpRequest::default());
Completed::<(), Inner<()>>::init(&mut info)
.is_none()
.unwrap();
let req = HttpRequest::default();
let ctx = HttpContext::new(req.clone(), MyActor);
let addr = ctx.address();
let mut info = PipelineInfo::new(req);
info.context = Some(Box::new(ctx));
let mut state = Completed::<(), Inner<()>>::init(&mut info)
.completed()
.unwrap();
assert!(state.poll(&mut info).is_none());
let pp = Pipeline(info, PipelineState::Completed(state));
assert!(!pp.is_done());
let Pipeline(mut info, st) = pp;
let mut st = st.completed().unwrap();
drop(addr);
assert!(st.poll(&mut info).unwrap().is_none().unwrap());
result(Ok::<_, ()>(()))
}))
.unwrap();
} | rust_cleaned_test_functions.jsonl/116193 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 655
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49068,
368,
341,
286,
10954,
486,
931,
741,
310,
659,
15454,
741,
310,
659,
4574,
4470,
2333,
13619,
79453,
341,
394,
1077,
5206,
3546,
284,
40907,
1731,
486,
931,
12286,
1900,
486,
2258,
1423,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_switch_statement() {
expect_printed(
"switch (a) { case \"1\": {} }",
"switch (a) { case \"1\": {} }",
);
expect_printed(
"switch (a) { case \"1\": {} default: {} }",
"switch (a) { case \"1\": {} default: {} }",
);
expect_printed("switch (a) { default: {} }", "switch (a) { default: {} }");
} | rust_cleaned_test_functions.jsonl/93435 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 166
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27652,
37404,
368,
341,
262,
1720,
10064,
291,
1006,
286,
330,
17338,
320,
64,
8,
314,
1142,
7245,
16,
11693,
4687,
335,
756,
286,
330,
17338,
320,
64,
8,
314,
1142,
7245,
16,
11693,
4687,
335... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_wasm_call_evm(){
// 1. Get wasm and evm contract bin
let (wasm, wasm_code_hash) = contract_module::<Test>("erc20.wasm", true).unwrap();
let (evm, _evm_code_hash) = contract_module::<Test>("erc20_evm_bytecode.txt", false).unwrap();
ExtBuilder::default()
.existential_deposit(100)
.build()
.execute_with(|| {
let _ = Balances::deposit_creating(&ALICE, 10_000_000_000_000_000_000);
let subsistence = Contracts::subsistence_threshold();
// 2. Create wasm contract
let mut a: [u8; 4] = Default::default();
a.copy_from_slice(&BlakeTwo256::hash(b"new")[0..4]);
let new_call = ExecutionInput::new( Selector::new(a) );
let init_supply: <Test as pallet_balances::Config>::Balance = 100_000_000_000_000_000_000_000;
let new_call = new_call.push_arg(init_supply);
let creation = Contracts::instantiate_with_code(
Origin::signed(ALICE.clone()),
subsistence * 10_000_000,
GAS_LIMIT,
wasm,
new_call.encode(),
vec![],
);
assert_ok!(creation);
let wasm_addr = Contracts::contract_address(&ALICE, &wasm_code_hash, &[]);
assert!(ContractInfoOf::<Test>::contains_key(&wasm_addr));
//3. Create EVM contract and tranfer to bob token
let source = H160::from_slice(&(AsRef::<[u8; 32]>::as_ref(&ALICE)[0..20]));
let creation4evm = <Test as pallet_evm::Config>::Runner::create(
source,
evm,
U256::default(),
100_000_000_000,
Some(U256::default()),
Some(U256::from(0)),
<Test as pallet_evm::Config>::config(),
);
assert_ok!(&creation4evm);
let evm_addr: H160;
match creation4evm.unwrap() {
CreateInfo {
exit_reason: ExitReason::Succeed(_),
value: create_address,
..
} => {
evm_addr = create_address;
},
CreateInfo {
exit_reason: reason,
value: _,
..
} => {
panic!("Create EVM Contract failed!({:?})", reason);
},
}
//3.1 Alice tranfer token to Bob
let transfer_selector = &Keccak256::digest(b"transfer(address,uint256)")[0..4];
let source_bob = H160::from_slice(&(AsRef::<[u8; 32]>::as_ref(&BOB)[0..20]));
let token: u128 = 1_883_000_000_000_000_000_000;
let fun_para: [u8;20] = source_bob.into();
let transfer_input = [&transfer_selector[..], &[0u8;12], &fun_para, &[0u8;16], &token.to_be_bytes()].concat();
let call4evm = <Test as pallet_evm::Config>::Runner::call(
source,
evm_addr,
transfer_input.clone(),
U256::default(),
100_000_000,
Some(U256::default()),
Some(U256::from(1)),
<Test as pallet_evm::Config>::config(),
);
assert_ok!(&call4evm);
let transfer_result: u128;
match call4evm.unwrap() {
CallInfo {
exit_reason: ExitReason::Succeed(_),
value: return_value,
..
} => {
let mut a: [u8; 16] = Default::default();
a.copy_from_slice(&return_value[16..32]);
transfer_result = u128::from_be_bytes(a);
},
CallInfo {
exit_reason: reason,
value: _,
..
} => {
panic!("Call EVM Contract balanceOf failed!({:?})", reason);
},
};
println!("Alice transfer to Bob token:{}", transfer_result);
//4. Get BOB balance of EVM token
let balance_of_selector = &Keccak256::digest(b"balanceOf(address)")[0..4];
let source_bob = H160::from_slice(&(AsRef::<[u8; 32]>::as_ref(&BOB)[0..20]));
let fun_para: [u8;20] = source_bob.into();
let balance_of_input = [&balance_of_selector[..], &[0u8;12], &fun_para].concat();
let call4evm = <Test as pallet_evm::Config>::Runner::call(
source_bob,
evm_addr,
balance_of_input.clone(),
U256::default(),
100_000_000,
Some(U256::default()),
Some(U256::from(0)),
<Test as pallet_evm::Config>::config(),
);
assert_ok!(&call4evm);
let bob_balance_before: u128;
match call4evm.unwrap() {
CallInfo {
exit_reason: ExitReason::Succeed(_),
value: return_value,
..
} => {
let mut a: [u8; 16] = Default::default();
a.copy_from_slice(&return_value[16..32]);
bob_balance_before = u128::from_be_bytes(a);
},
CallInfo {
exit_reason: reason,
value: _,
..
} => {
panic!("Call EVM Contract balanceOf failed!({:?})", reason);
},
};
println!("bob_balance_before={}",bob_balance_before);
let mut a: [u8; 4] = Default::default();
a.copy_from_slice(&BlakeTwo256::hash(b"wasmCallEvm")[0..4]);
let call = ExecutionInput::new(Selector::new(a));
let transfer_value: u128 = 12000000000000000000;
let call = call.push_arg(format!("0x{:x}", evm_addr)).push_arg(format!("0x{:x}", source_bob)).push_arg(transfer_value);
let result = Contracts::bare_call(
ALICE,
wasm_addr,
0,
GAS_LIMIT,
Encode::encode(&call).to_vec(),
).exec_result.unwrap();
assert!(result.is_success());
println!("Alice transfer to Bob from wasm_call_evm:{}", transfer_value);
//6. Get BOB balance of EVM token
let call4evm = <Test as pallet_evm::Config>::Runner::call(
source_bob,
evm_addr,
balance_of_input,
U256::default(),
100_000_000,
Some(U256::default()),
Some(U256::from(1)),
<Test as pallet_evm::Config>::config(),
);
assert_ok!(&call4evm);
let bob_balance_after: u128;
match call4evm.unwrap() {
CallInfo {
exit_reason: ExitReason::Succeed(_),
value: return_value,
..
} => {
let mut a: [u8; 16] = Default::default();
a.copy_from_slice(&return_value[16..32]);
bob_balance_after = u128::from_be_bytes(a);
},
CallInfo {
exit_reason: reason,
value: _,
..
} => {
panic!("Call EVM Contract balanceOf failed!({:?})", reason);
},
};
println!("bob_balance_after={}",bob_balance_after);
//7. Test the balance of BOB being correct
assert_eq!(bob_balance_after, bob_balance_before + transfer_value);
});
} | rust_cleaned_test_functions.jsonl/111951 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2693
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1670,
10530,
13429,
2204,
7338,
19328,
197,
322,
220,
16,
13,
220,
2126,
98263,
323,
3637,
76,
5116,
9544,
198,
10217,
320,
86,
10530,
11,
98263,
4136,
8950,
8,
284,
5116,
10750,
27638,
2271,
13... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_healthiness_http() -> Result<()> {
let healthiness = Healthiness {
file_path: None,
http_endpoint: Some("http://localhost:123/".into()),
..Default::default()
};
assert!(!check_health_w(&healthiness));
let loopback = Ipv4Addr::new(127, 0, 0, 1);
let socket = SocketAddrV4::new(loopback, 0);
let listener = TcpListener::bind(socket)?;
let port = listener.local_addr()?.port();
let endpoint = format!("http://localhost:{}", port);
let healthiness = Healthiness {
file_path: None,
http_endpoint: Some(endpoint),
..Default::default()
};
let (sender, receiver) = mpsc::sync_channel(0);
thread::spawn(move || {
handle_request(listener).unwrap();
sender.send(()).expect("Chan closed");
});
assert!(check_health_w(&healthiness));
receiver
.recv_timeout(Duration::from_millis(2000))
.expect("Failed to received response from handle_request");
assert!(!check_health_w(&healthiness));
Ok(())
} | rust_cleaned_test_functions.jsonl/37421 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 545
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45727,
1880,
25888,
368,
1464,
5714,
71698,
341,
286,
1077,
2820,
1880,
284,
6267,
1880,
341,
310,
1034,
2638,
25,
2240,
345,
310,
1758,
36699,
25,
4329,
445,
1254,
1110,
8301,
25,
16,
17,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_add_bold_tag_1() {
assert_eq!(Solution::bold_words(lc_vec_s!["abc","123"], String::from("abcxyz123")), String::from("<b>abc</b>xyz<b>123</b>"));
} | rust_cleaned_test_functions.jsonl/73879 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 90
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
95677,
9372,
62,
16,
368,
341,
286,
2060,
10714,
10297,
36842,
486,
14824,
18981,
2333,
66,
13251,
643,
0,
1183,
13683,
2198,
16,
17,
18,
7914,
923,
486,
1499,
445,
13683,
28854,
16,
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_affine_to_projective() {
let a = G1Affine::generator();
let b = G1Affine::identity();
assert_eq!(G1Projective::from(a).is_on_curve().unwrap_u8(), 1);
assert_eq!(G1Projective::from(a).is_identity().unwrap_u8(), 0);
assert_eq!(G1Projective::from(b).is_on_curve().unwrap_u8(), 1);
assert_eq!(G1Projective::from(b).is_identity().unwrap_u8(), 1);
} | rust_cleaned_test_functions.jsonl/10314 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 210
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48914,
482,
2346,
16352,
533,
368,
341,
286,
1077,
264,
284,
479,
16,
25841,
482,
486,
35851,
543,
286,
1077,
293,
284,
479,
16,
25841,
482,
486,
16912,
1428,
286,
2060,
10714,
10297,
38,
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_merge() {
let mut config = Config::default();
config.files.insert(
"**/*.rb".to_string(),
GlobConfig {
weight: 1.0,
ignore: false,
tags: vec!["ruby".to_string()],
},
);
let mut config2 = Config::default();
config2.files.insert(
"**/*.rs".to_string(),
GlobConfig {
weight: 1.0,
ignore: false,
tags: vec!["rust".to_string()],
},
);
config.merge(config2);
assert!(config.files.keys().len() == 2);
} | rust_cleaned_test_functions.jsonl/73775 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 381
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20888,
368,
341,
286,
1077,
5206,
2193,
284,
5532,
486,
2258,
1428,
286,
2193,
20266,
7030,
1006,
310,
67961,
23540,
10681,
3263,
983,
3904,
3148,
310,
62288,
2648,
341,
394,
4680,
25,
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_a() {
let lines = [
"on x=10..12,y=10..12,z=10..12",
"on x=11..13,y=11..13,z=11..13",
"off x=9..11,y=9..11,z=9..11",
"on x=10..10,y=10..10,z=10..10",
];
assert_eq!(
execute(&parse(&lines).unwrap(), Cube::from_bounds(-50, 50)),
39
);
let lines = [
"on x=-20..26,y=-36..17,z=-47..7",
"on x=-20..33,y=-21..23,z=-26..28",
"on x=-22..28,y=-29..23,z=-38..16",
"on x=-46..7,y=-6..46,z=-50..-1",
"on x=-49..1,y=-3..46,z=-24..28",
"on x=2..47,y=-22..22,z=-23..27",
"on x=-27..23,y=-28..26,z=-21..29",
"on x=-39..5,y=-6..47,z=-3..44",
"on x=-30..21,y=-8..43,z=-13..34",
"on x=-22..26,y=-27..20,z=-29..19",
"off x=-48..-32,y=26..41,z=-47..-37",
"on x=-12..35,y=6..50,z=-50..-2",
"off x=-48..-32,y=-32..-16,z=-15..-5",
"on x=-18..26,y=-33..15,z=-7..46",
"off x=-40..-22,y=-38..-28,z=23..41",
"on x=-16..35,y=-41..10,z=-47..6",
"off x=-32..-23,y=11..30,z=-14..3",
"on x=-49..-5,y=-3..45,z=-29..18",
"off x=18..30,y=-20..-8,z=-3..13",
"on x=-41..9,y=-7..43,z=-33..15",
"on x=-54112..-39298,y=-85059..-49293,z=-27449..7877",
"on x=967..23432,y=45373..81175,z=27513..53682",
];
assert_eq!(
execute(&parse(&lines).unwrap(), Cube::from_bounds(-50, 50)),
590784
);
} | rust_cleaned_test_functions.jsonl/62193 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1060
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4306,
368,
341,
286,
1077,
5128,
284,
2278,
310,
330,
263,
856,
28,
16,
15,
496,
16,
17,
7358,
28,
16,
15,
496,
16,
17,
22669,
28,
16,
15,
496,
16,
17,
756,
310,
330,
263,
856,
28,
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_starknet_keccak() {
// Generated from `cairo-lang`
let data = b"execute";
let expected_hash = FieldElement::from_hex_be(
"0240060cdb34fcc260f41eac7474ee1d7c80b7e3607daff9ac67c7ea2ebb1c44",
)
.unwrap();
let hash = starknet_keccak(data);
assert_eq!(hash, expected_hash);
} | rust_cleaned_test_functions.jsonl/33910 | {
"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,
1261,
838,
4711,
45476,
84262,
368,
341,
286,
442,
30488,
504,
1565,
62383,
75460,
3989,
286,
1077,
821,
284,
293,
1,
10257,
876,
286,
1077,
3601,
8950,
284,
8601,
1691,
486,
1499,
32655,
21263,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_versioned_message_serialization() {
let message = v0::Message {
header: MessageHeader {
num_required_signatures: 1,
num_readonly_signed_accounts: 0,
num_readonly_unsigned_accounts: 0,
},
recent_blockhash: Hash::new_unique(),
account_keys: vec![
Pubkey::new_unique(),
],
address_table_lookups: vec![
MessageAddressTableLookup {
account_key: Pubkey::new_unique(),
writable_indexes: vec![1],
readonly_indexes: vec![0],
},
MessageAddressTableLookup {
account_key: Pubkey::new_unique(),
writable_indexes: vec![0],
readonly_indexes: vec![1],
},
],
instructions: vec![CompiledInstruction {
program_id_index: 1,
accounts: vec![0, 2, 3, 4],
data: vec![],
}],
};
let bytes = bincode::serialize(&VersionedMessage::V0(message.clone())).unwrap();
let message_from_bytes: VersionedMessage = bincode::deserialize(&bytes).unwrap();
if let VersionedMessage::V0(message_from_bytes) = message_from_bytes {
assert_eq!(message, message_from_bytes);
} else {
panic!("should deserialize to versioned message");
}
} | rust_cleaned_test_functions.jsonl/22813 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 816
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9438,
291,
6462,
25602,
2022,
368,
341,
286,
1077,
1943,
284,
348,
15,
486,
2052,
341,
310,
4247,
25,
4856,
4047,
341,
394,
1629,
18743,
11172,
2789,
25,
220,
16,
345,
394,
1629,
6443,
3243,
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_por_circuit_poseidon_base_2() {
test_por_circuit::<TestTree<PoseidonHasher, U2>>(3, 1_887);
} | rust_cleaned_test_functions.jsonl/88190 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 67
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
76628,
666,
37268,
33201,
90456,
7651,
62,
17,
368,
341,
286,
1273,
76628,
666,
37268,
27638,
2271,
6533,
21604,
960,
90456,
6370,
261,
11,
547,
17,
25526,
18,
11,
220,
16,
62,
23,
23,
22,
317... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_replay_commitment_cache() {
fn leader_vote(vote_slot: Slot, bank: &Arc<Bank>, pubkey: &Pubkey) {
let mut leader_vote_account = bank.get_account(pubkey).unwrap();
let mut vote_state = VoteState::from(&leader_vote_account).unwrap();
vote_state.process_slot_vote_unchecked(vote_slot);
let versioned = VoteStateVersions::new_current(vote_state);
VoteState::to(&versioned, &mut leader_vote_account).unwrap();
bank.store_account(pubkey, &leader_vote_account);
}
let leader_pubkey = solana_sdk::pubkey::new_rand();
let leader_lamports = 3;
let genesis_config_info =
create_genesis_config_with_leader(50, &leader_pubkey, leader_lamports);
let mut genesis_config = genesis_config_info.genesis_config;
let leader_voting_pubkey = genesis_config_info.voting_keypair.pubkey();
genesis_config.epoch_schedule.warmup = false;
genesis_config.ticks_per_slot = 4;
let bank0 = Bank::new(&genesis_config);
for _ in 0..genesis_config.ticks_per_slot {
bank0.register_tick(&Hash::default());
}
bank0.freeze();
let arc_bank0 = Arc::new(bank0);
let bank_forks = Arc::new(RwLock::new(BankForks::new_from_banks(&[arc_bank0], 0)));
let exit = Arc::new(AtomicBool::new(false));
let block_commitment_cache = Arc::new(RwLock::new(BlockCommitmentCache::default()));
let rpc_subscriptions = Arc::new(RpcSubscriptions::new_for_tests(
&exit,
bank_forks.clone(),
block_commitment_cache.clone(),
OptimisticallyConfirmedBank::locked_from_bank_forks_root(&bank_forks),
));
let (lockouts_sender, _) = AggregateCommitmentService::new(
&exit,
block_commitment_cache.clone(),
rpc_subscriptions,
);
assert!(block_commitment_cache
.read()
.unwrap()
.get_block_commitment(0)
.is_none());
assert!(block_commitment_cache
.read()
.unwrap()
.get_block_commitment(1)
.is_none());
for i in 1..=3 {
let prev_bank = bank_forks.read().unwrap().get(i - 1).unwrap().clone();
let bank = Bank::new_from_parent(&prev_bank, &Pubkey::default(), prev_bank.slot() + 1);
let _res = bank.transfer(
10,
&genesis_config_info.mint_keypair,
&solana_sdk::pubkey::new_rand(),
);
for _ in 0..genesis_config.ticks_per_slot {
bank.register_tick(&Hash::default());
}
bank_forks.write().unwrap().insert(bank);
let arc_bank = bank_forks.read().unwrap().get(i).unwrap().clone();
leader_vote(i - 1, &arc_bank, &leader_voting_pubkey);
ReplayStage::update_commitment_cache(
arc_bank.clone(),
0,
leader_lamports,
&lockouts_sender,
);
arc_bank.freeze();
}
for _ in 0..10 {
let done = {
let bcc = block_commitment_cache.read().unwrap();
bcc.get_block_commitment(0).is_some()
&& bcc.get_block_commitment(1).is_some()
&& bcc.get_block_commitment(2).is_some()
};
if done {
break;
} else {
thread::sleep(Duration::from_millis(200));
}
}
let mut expected0 = BlockCommitment::default();
expected0.increase_confirmation_stake(3, leader_lamports);
assert_eq!(
block_commitment_cache
.read()
.unwrap()
.get_block_commitment(0)
.unwrap(),
&expected0,
);
let mut expected1 = BlockCommitment::default();
expected1.increase_confirmation_stake(2, leader_lamports);
assert_eq!(
block_commitment_cache
.read()
.unwrap()
.get_block_commitment(1)
.unwrap(),
&expected1
);
let mut expected2 = BlockCommitment::default();
expected2.increase_confirmation_stake(1, leader_lamports);
assert_eq!(
block_commitment_cache
.read()
.unwrap()
.get_block_commitment(2)
.unwrap(),
&expected2
);
} | rust_cleaned_test_functions.jsonl/11053 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2417
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
1363,
36346,
478,
11529,
368,
341,
286,
5168,
7653,
54360,
3747,
1272,
27563,
25,
31316,
11,
6073,
25,
609,
36809,
27,
25828,
8066,
95116,
25,
609,
29162,
792,
8,
341,
310,
1077,
5206,
765... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_statsd_client_as_histogrammed_f64() {
let client: Box<dyn Histogrammed<f64>> = Box::new(StatsdClient::from_sink("prefix", NopMetricSink));
client.histogram("some.histogram", 4.0).unwrap();
} | rust_cleaned_test_functions.jsonl/10622 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15381,
67,
8179,
11898,
68564,
2061,
761,
21,
19,
368,
341,
286,
1077,
2943,
25,
8261,
92846,
82138,
2061,
63895,
21,
19,
2452,
284,
8261,
486,
931,
7,
16635,
67,
2959,
486,
1499,
51567,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_non_loader_key() {
let key0 = Pubkey::new_unique();
let key1 = Pubkey::new_unique();
let loader2 = Pubkey::new_unique();
let instructions = vec![CompiledInstruction::new(2, &(), vec![0, 1])];
let message = Message::new_with_compiled_instructions(
1,
0,
2,
vec![key0, key1, loader2],
Hash::default(),
instructions,
);
assert!(message.is_non_loader_key(0));
assert!(message.is_non_loader_key(1));
assert!(!message.is_non_loader_key(2));
} | rust_cleaned_test_functions.jsonl/55536 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 317
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
21637,
22139,
3097,
368,
341,
286,
1077,
1376,
15,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
1376,
16,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
16047,
17,
284,
22611,
792,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fuchsia_to_rust_ipaddr6() {
//test example IPv6 address [fe80::5054:ff:fe40:5763]
//fidl_fuchsia_net::Ipv6Address
let ipv6_addr = fidl_fuchsia_net::Ipv6Address {
addr: [
0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x54, 0x00, 0xff, 0xfe, 0x40,
0x57, 0x63,
],
};
//std::net::IpAddr
let net_addr = std::net::IpAddr::V6(std::net::Ipv6Addr::new(
0xff80, 0x0000, 0x0000, 0x0000, 0x5054, 0x00ff, 0xfe40, 0x5763,
));
assert_eq!(fuchsia_to_rust_ipaddr6(ipv6_addr), net_addr);
} | rust_cleaned_test_functions.jsonl/64631 | {
"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,
761,
73391,
2346,
1710,
590,
10385,
6214,
21,
368,
341,
286,
442,
1944,
3110,
31560,
21,
2621,
508,
1859,
23,
15,
486,
20,
15,
20,
19,
25,
542,
25,
1859,
19,
15,
25,
20,
22,
21,
18,
921,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.