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_parse_dreadnaut_input() -> Result<(), Error> {
let test_file = "At
-a
-m
n=4 g
0:1 2 ;
2:3;
3:0.
f=[0|1, 2] x o
";
let test_buf = BufReader::new(test_file.as_bytes());
let mut expected_graph = Graph::new_ordered(4);
expected_graph.add_edge(0, 1)?;
expected_graph.add_edge(0, 2)?;
expected_graph.add_edge(2, 3)?;
expected_graph.add_edge(3, 0)?;
expected_graph.set_colours(&vec![1, 2, 2, DEFAULT_COLOR])?;
expected_graph.update_max_color(3);
let (parsed_graph, has_header) = parse_dreadnaut_input(test_buf)?;
assert_eq!(expected_graph, parsed_graph);
assert!(has_header);
Ok(())
} | rust_cleaned_test_functions.jsonl/46230 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 367
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
814,
878,
77,
2717,
5898,
368,
1464,
5714,
68843,
4600,
29,
341,
286,
1077,
1273,
2458,
284,
330,
1655,
271,
7409,
198,
1448,
198,
77,
28,
19,
342,
198,
15,
25,
16,
220,
17,
4386,
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... | 7 |
#[test]
fn test_count_chars_with_example_input() {
let test_input = example_input();
let num_chars = count_chars(&test_input);
assert_eq!(num_chars, 23);
} | rust_cleaned_test_functions.jsonl/1885 | {
"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,
3180,
37418,
6615,
39304,
5898,
368,
341,
286,
1077,
1273,
5898,
284,
3110,
5898,
543,
286,
1077,
1629,
37418,
284,
1760,
37418,
2099,
1944,
5898,
626,
286,
2060,
10714,
10297,
2413,
37418,
11,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_sub_1() {
let m1 = Matrix::new(vec![vec![1, 0], vec![0, 1]]);
let m2 = Matrix::new(vec![vec![1, 1], vec![1, 1]]);
assert_eq!(
&m1 - &m2,
Matrix::create_from_data(vec![0, -1, -1, 0], 2, 2)
);
} | rust_cleaned_test_functions.jsonl/118230 | {
"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,
5228,
62,
16,
368,
341,
262,
1077,
296,
16,
284,
11631,
486,
931,
25592,
20703,
4083,
20703,
16,
11,
220,
15,
1125,
7486,
20703,
15,
11,
220,
16,
49854,
262,
1077,
296,
17,
284,
11631,
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_str_eq() {
assert_eq!(Level::vec(&[0, 1, 4, 125]), vec!["0", "1", "x", "125"]);
assert_ne!(Level::vec(&[0, 1, 4, 125]), vec!["0", "1", "5", "125"]);
} | rust_cleaned_test_functions.jsonl/31780 | {
"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,
2895,
10714,
368,
341,
286,
2060,
10714,
10297,
4449,
486,
4083,
2099,
58,
15,
11,
220,
16,
11,
220,
19,
11,
220,
16,
17,
20,
9719,
7486,
0,
1183,
15,
497,
330,
16,
497,
330,
87,
497,
330,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_line() -> io::Result<()> {
let mut buf = String::new();
let data = b"noodles\n";
let mut reader = &data[..];
buf.clear();
read_line(&mut reader, &mut buf)?;
assert_eq!(buf, "noodles");
let data = b"noodles\r\n";
let mut reader = &data[..];
buf.clear();
read_line(&mut reader, &mut buf)?;
assert_eq!(buf, "noodles");
let data = b"noodles";
let mut reader = &data[..];
buf.clear();
read_line(&mut reader, &mut buf)?;
assert_eq!(buf, "noodles");
Ok(())
} | rust_cleaned_test_functions.jsonl/133588 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 322
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
6528,
368,
1464,
6399,
486,
2077,
71698,
341,
286,
1077,
5206,
6607,
284,
923,
486,
931,
1428,
286,
1077,
821,
284,
293,
1,
77,
97121,
1699,
876,
286,
1077,
5206,
6604,
284,
609,
691,
95... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bytes_buffer() {
let gil = Python::acquire_gil();
let py = gil.python();
let bytes = py.eval("b'abcde'", None, None).unwrap();
let buffer = PyBuffer::get(&bytes).unwrap();
assert_eq!(buffer.dimensions(), 1);
assert_eq!(buffer.item_count(), 5);
assert_eq!(buffer.format().to_str().unwrap(), "B");
assert_eq!(buffer.shape(), [5]);
// single-dimensional buffer is always contiguous
assert!(buffer.is_c_contiguous());
assert!(buffer.is_fortran_contiguous());
let slice = buffer.as_slice(py).unwrap();
assert_eq!(slice.len(), 5);
assert_eq!(slice[0].get(), b'a');
assert_eq!(slice[2].get(), b'c');
assert!(buffer.copy_to_slice(py, &mut [0u8]).is_err());
let mut arr = [0; 5];
buffer.copy_to_slice(py, &mut arr).unwrap();
assert_eq!(arr, b"abcde" as &[u8]);
assert!(buffer.copy_from_slice(py, &[0u8; 5]).is_err());
assert_eq!(buffer.to_vec(py).unwrap(), b"abcde");
} | rust_cleaned_test_functions.jsonl/48792 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 502
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12524,
7776,
368,
341,
286,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
286,
1077,
4510,
284,
342,
321,
43193,
543,
286,
1077,
5820,
284,
4510,
31710,
445,
65,
6,
13683,
450,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_filtered_raw_query() {
let rocket = rocket::ignite().mount("/", routes![filtered_raw_query]);
let client = Client::debug(rocket).unwrap();
#[track_caller]
fn run(client: &Client, birds: &[&str], colors: &[&str], cats: &[&str]) -> (Status, String) {
let join = |slice: &[&str], name: &str| slice.iter()
.map(|v| format!("{}={}", name, v))
.collect::<Vec<_>>()
.join("&");
let q = format!("{}&{}&{}",
join(birds, "bird"),
join(colors, "color"),
join(cats, "cat"));
let response = client.get(format!("/?{}", q)).dispatch();
let status = response.status();
let body = response.into_string().unwrap();
(status, body)
}
let birds = &["2", "3"];
let colors = &["red", "blue", "green"];
let cats = &["bob", "bob"];
assert_eq!(run(&client, birds, colors, cats).0, Status::NotFound);
let birds = &["2", "1", "3"];
let colors = &["red", "green"];
let cats = &["bob", "bob"];
assert_eq!(run(&client, birds, colors, cats).0, Status::NotFound);
let birds = &["2", "1", "3"];
let colors = &["red", "blue", "green"];
let cats = &[];
assert_eq!(run(&client, birds, colors, cats).0, Status::NotFound);
let birds = &["2", "1", "3"];
let colors = &["red", "blue", "green"];
let cats = &["bob", "bob"];
assert_eq!(run(&client, birds, colors, cats).1, "2 - red");
let birds = &["1", "2", "1", "3"];
let colors = &["blue", "red", "blue", "green"];
let cats = &["bob"];
assert_eq!(run(&client, birds, colors, cats).1, "2 - red");
let birds = &["5", "1"];
let colors = &["blue", "orange", "red", "blue", "green"];
let cats = &["bob"];
assert_eq!(run(&client, birds, colors, cats).1, "5 - orange");
} | rust_cleaned_test_functions.jsonl/46562 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 838
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51429,
16067,
5738,
368,
341,
262,
1077,
24306,
284,
24306,
486,
95408,
1005,
16557,
35460,
11291,
20703,
41131,
16067,
5738,
2558,
262,
1077,
2943,
284,
8423,
486,
8349,
7,
46790,
568,
15454,
1428,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_backup_meta() {
let mut suite = TestSuite::new(3, 144 * 1024 * 1024);
// 3 version for each key.
let key_count = 60;
suite.must_kv_put(key_count, 3);
let backup_ts = suite.alloc_ts();
let (admin_checksum, admin_total_kvs, admin_total_bytes) =
suite.admin_checksum(backup_ts, "a".to_owned(), "z".to_owned());
// Push down backup request.
let tmp = Builder::new().tempdir().unwrap();
let storage_path = make_unique_dir(tmp.path());
let rx = suite.backup(
vec![], // start
vec![], // end
0.into(), // begin_ts
backup_ts,
&storage_path,
);
let resps1 = block_on(rx.collect::<Vec<_>>());
// Only leader can handle backup.
assert_eq!(resps1.len(), 1);
let files: Vec<_> = resps1[0].files.clone().into_iter().collect();
assert!(!files.is_empty());
let mut checksum = 0;
let mut total_kvs = 0;
let mut total_bytes = 0;
for f in files {
checksum ^= f.get_crc64xor();
total_kvs += f.get_total_kvs();
total_bytes += f.get_total_bytes();
}
assert_eq!(total_kvs, key_count as u64);
assert_eq!(total_kvs, admin_total_kvs);
assert_eq!(total_bytes, admin_total_bytes);
assert_eq!(checksum, admin_checksum);
suite.stop();
} | rust_cleaned_test_functions.jsonl/92421 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 599
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44710,
13381,
368,
341,
262,
1077,
5206,
16182,
284,
3393,
28000,
486,
931,
7,
18,
11,
220,
16,
19,
19,
353,
220,
16,
15,
17,
19,
353,
220,
16,
15,
17,
19,
317,
262,
442,
220,
18,
2319,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_tuple_vec() {
with_graph(|graph| {
graph.mutate("CREATE (n1 { num: 1, word: 'foo' }), (n2 { num: 2, word: 'bar' }), (n3 { num: 3, word: 'baz' })").unwrap();
let tuple_vec: Vec<(i64, String)> = graph
.query("MATCH (n) RETURN n.num, n.word ORDER BY n.num")
.unwrap();
assert_eq!(tuple_vec[0], (1, "foo".to_string()));
assert_eq!(tuple_vec[1], (2, "bar".to_string()));
assert_eq!(tuple_vec[2], (3, "baz".to_string()));
});
} | rust_cleaned_test_functions.jsonl/94392 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 272
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21773,
13251,
368,
341,
262,
448,
14738,
22428,
4439,
91,
341,
286,
4771,
744,
332,
349,
445,
22599,
320,
77,
16,
314,
1629,
25,
220,
16,
11,
3409,
25,
364,
7975,
6,
31706,
320,
77,
17,
314,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_validates_keys() {
let dict_type =
ArrowType::Dictionary(Box::new(ArrowType::Int32), Box::new(ArrowType::Utf8));
let mut buffer = DictionaryBuffer::<i32, i32>::default();
let d = Arc::new(StringArray::from(vec!["", "f"])) as ArrayRef;
buffer.as_keys(&d).unwrap().extend_from_slice(&[0, 2, 0]);
let err = buffer.into_array(None, &dict_type).unwrap_err().to_string();
assert!(
err.contains("dictionary key beyond bounds of dictionary: 0..2"),
"{}",
err
);
let mut buffer = DictionaryBuffer::<i32, i32>::default();
let d = Arc::new(StringArray::from(vec![""])) as ArrayRef;
buffer.as_keys(&d).unwrap().extend_from_slice(&[0, 1, 0]);
let err = buffer.spill_values().unwrap_err().to_string();
assert!(
err.contains("dictionary key beyond bounds of dictionary: 0..1"),
"{}",
err
);
} | rust_cleaned_test_functions.jsonl/22431 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 470
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8337,
973,
12631,
368,
341,
286,
1077,
6451,
1819,
4035,
310,
33712,
929,
486,
8517,
67758,
486,
931,
4346,
81,
651,
929,
486,
1072,
18,
17,
701,
8261,
486,
931,
4346,
81,
651,
929,
486,
38980... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_param() {
let now = Instant::now();
new_cmd!()
.args(&[SLEEP_TIME.to_string()])
.assert()
.success();
validate_duration(now.elapsed(), SLEEP_TIME);
} | rust_cleaned_test_functions.jsonl/4296 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11667,
4090,
368,
341,
262,
1077,
1431,
284,
18058,
486,
3328,
1428,
262,
501,
11684,
0,
741,
286,
659,
2116,
2099,
58,
50,
43290,
10051,
2389,
3904,
56024,
286,
659,
2207,
741,
286,
659,
5630,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_tokens_sync_threadsafe() {
let rate_limiter = SyncLeakyBucket::builder()
.max(5.0)
.tokens(5.0)
.refill_amount(1.0)
.refill_interval(Duration::from_millis(100))
.build();
assert_eq!(rate_limiter.tokens(), 5.0);
for i in 0..5 {
assert_eq!(rate_limiter.tokens().round(), 5.0 - i as f64);
rate_limiter.acquire_one();
}
assert_eq!(rate_limiter.tokens().round(), 0.0);
rate_limiter.acquire_one();
assert_eq!(rate_limiter.tokens().round(), 0.0);
} | rust_cleaned_test_functions.jsonl/52883 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 280
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28838,
23008,
10814,
18675,
368,
341,
262,
1077,
4379,
907,
17700,
284,
28937,
2304,
28100,
36018,
486,
17850,
741,
286,
659,
2810,
7,
20,
13,
15,
340,
286,
659,
30566,
7,
20,
13,
15,
340,
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... | 2 |
#[test]
fn test_allocates_for_non_zst() {
let _context = crate::quick_init().unwrap();
let x = UnifiedBox::new(5u64).unwrap();
let ptr = UnifiedBox::into_unified(x);
assert!(!ptr.is_null());
let _ = unsafe { UnifiedBox::from_unified(ptr) };
} | rust_cleaned_test_functions.jsonl/47355 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 137
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14802,
973,
5478,
21637,
6415,
267,
368,
341,
286,
1077,
716,
2147,
284,
17717,
486,
27763,
6137,
1005,
15454,
543,
286,
1077,
856,
284,
72434,
1611,
486,
931,
7,
20,
84,
21,
19,
568,
15454,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_push_path2() {
let mut items = Vec::new();
let mut paths: HashMap<&Path, usize> = HashMap::new();
FileTreeItems::push_dirs(
Path::new("a/b/c"),
&mut items,
&mut paths,
&BTreeSet::new(),
)
.unwrap();
assert_eq!(*paths.get(&Path::new("a")).unwrap(), 1);
assert_eq!(*paths.get(&Path::new("a/b")).unwrap(), 1);
FileTreeItems::push_dirs(
Path::new("a/b/d"),
&mut items,
&mut paths,
&BTreeSet::new(),
)
.unwrap();
assert_eq!(*paths.get(&Path::new("a")).unwrap(), 1);
assert_eq!(*paths.get(&Path::new("a/b")).unwrap(), 2);
} | rust_cleaned_test_functions.jsonl/129786 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 288
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14218,
2638,
17,
368,
341,
197,
10217,
5206,
3589,
284,
11312,
486,
931,
543,
197,
10217,
5206,
12716,
25,
10528,
52244,
1820,
11,
22301,
29,
284,
10528,
486,
931,
1428,
197,
24848,
6533,
4353,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_duplicate_directives() {
let r: Raw = "max-age=100; max-age=5; max-age=0".into();
assert!(StrictTransportSecurity::parse_header(&r).is_err());
} | rust_cleaned_test_functions.jsonl/58567 | {
"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,
21039,
70434,
32871,
1886,
368,
341,
286,
1077,
435,
25,
23022,
284,
330,
2810,
42941,
28,
16,
15,
15,
26,
1932,
42941,
28,
20,
26,
1932,
42941,
28,
15,
3263,
18122,
543,
286,
2060,
10297,
418... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_goodbye_rpc() {
// set up the logging. The level and enabled logging or not
let log_level = Level::Trace;
let enable_logging = false;
let log = common::build_log(log_level, enable_logging);
// get sender/receiver
let (mut sender, mut receiver) = common::build_node_pair(&log, 10520);
// Goodbye Request
let rpc_request = RPCRequest::Goodbye(GoodbyeReason::ClientShutdown);
let sender_request = rpc_request.clone();
let sender_log = log.clone();
// build the sender future
let sender_future = future::poll_fn(move || -> Poll<bool, ()> {
loop {
match sender.poll().unwrap() {
Async::Ready(Some(Libp2pEvent::PeerDialed(peer_id))) => {
// Send a Goodbye request
warn!(sender_log, "Sender sending RPC request");
sender
.swarm
.send_rpc(peer_id, RPCEvent::Request(1, sender_request.clone()));
}
Async::Ready(Some(_)) => {}
Async::Ready(None) | Async::NotReady => return Ok(Async::NotReady),
};
}
});
// build the receiver future
let receiver_future = future::poll_fn(move || -> Poll<bool, ()> {
loop {
match receiver.poll().unwrap() {
Async::Ready(Some(Libp2pEvent::RPC(_, event))) => match event {
// Should receive the sent RPC request
RPCEvent::Request(id, request) => {
assert_eq!(id, 0);
assert_eq!(rpc_request.clone(), request);
// receives the goodbye. Nothing left to do
return Ok(Async::Ready(true));
}
_ => panic!("Received invalid RPC message"),
},
Async::Ready(Some(_)) => (),
Async::Ready(None) | Async::NotReady => return Ok(Async::NotReady),
}
}
});
// execute the futures and check the result
let test_result = Arc::new(Mutex::new(false));
let error_result = test_result.clone();
let thread_result = test_result.clone();
tokio::run(
sender_future
.select(receiver_future)
.timeout(Duration::from_millis(1000))
.map_err(move |_| *error_result.lock().unwrap() = false)
.map(move |result| {
*thread_result.lock().unwrap() = result.0;
()
}),
);
assert!(*test_result.lock().unwrap());
} | rust_cleaned_test_functions.jsonl/57324 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1278
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44781,
28374,
60799,
368,
341,
262,
442,
738,
705,
279,
8392,
13,
576,
2188,
323,
8970,
8392,
476,
537,
198,
262,
1077,
1487,
8274,
284,
9395,
486,
6550,
280,
262,
1077,
7283,
59982,
284,
895,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_expansion() {
let mut vars = HashMap::new();
vars.insert("FOO_BAR".to_string(), "foo bar baz / blah".to_string());
assert_eq!(
expand_xcodevars("A$(FOO_BAR:rfc1034identifier)B", &vars),
"Afoo-bar-baz-blahB"
);
assert_eq!(
expand_xcodevars("A$(FOO_BAR:identifier)B", &vars),
"Afoo_bar_baz_blahB"
);
assert_eq!(
expand_xcodevars("A${FOO_BAR:identifier}B", &vars),
"Afoo_bar_baz_blahB"
);
} | rust_cleaned_test_functions.jsonl/106603 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 272
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14214,
10501,
368,
341,
262,
1077,
5206,
19942,
284,
10528,
486,
931,
543,
262,
19942,
7030,
445,
3788,
46,
47405,
3263,
983,
3904,
1507,
330,
7975,
3619,
50247,
608,
52561,
3263,
983,
3904,
5231,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_backup_mode_long_with_args() {
let _dummy = TEST_MUTEX.lock().unwrap();
let matches = make_app().get_matches_from(vec!["app", "--backup=simple"]);
let result = determine_backup_mode(&matches).unwrap();
assert_eq!(result, BackupMode::SimpleBackup);
} | rust_cleaned_test_functions.jsonl/98143 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44710,
7302,
17799,
6615,
8384,
368,
341,
286,
1077,
716,
31390,
284,
13602,
66994,
21003,
1005,
15454,
543,
286,
1077,
9071,
284,
1281,
8191,
1005,
455,
38344,
5673,
25592,
0,
1183,
676,
497,
144... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_duration_div() {
assert_eq!(Duration::zero() / i32::MAX, Duration::zero());
assert_eq!(Duration::zero() / i32::MIN, Duration::zero());
assert_eq!(Duration::nanoseconds(123_456_789) / 1, Duration::nanoseconds(123_456_789));
assert_eq!(Duration::nanoseconds(123_456_789) / -1, -Duration::nanoseconds(123_456_789));
assert_eq!(-Duration::nanoseconds(123_456_789) / -1, Duration::nanoseconds(123_456_789));
assert_eq!(-Duration::nanoseconds(123_456_789) / 1, -Duration::nanoseconds(123_456_789));
assert_eq!(Duration::seconds(1) / 3, Duration::nanoseconds(333_333_333));
assert_eq!(Duration::seconds(4) / 3, Duration::nanoseconds(1_333_333_333));
assert_eq!(Duration::seconds(-1) / 2, Duration::milliseconds(-500));
assert_eq!(Duration::seconds(1) / -2, Duration::milliseconds(-500));
assert_eq!(Duration::seconds(-1) / -2, Duration::milliseconds(500));
assert_eq!(Duration::seconds(-4) / 3, Duration::nanoseconds(-1_333_333_333));
assert_eq!(Duration::seconds(-4) / -3, Duration::nanoseconds(1_333_333_333));
} | rust_cleaned_test_functions.jsonl/981 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 489
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25454,
16237,
368,
341,
286,
2060,
10714,
10297,
12945,
486,
14154,
368,
608,
600,
18,
17,
486,
10586,
11,
21045,
486,
14154,
1423,
286,
2060,
10714,
10297,
12945,
486,
14154,
368,
608,
600,
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_reference_vector_ILL2_dynx22() {
let test_vector = include_bytes!("../vectors/ILL2_dynx22.bit");
test_vs_minimp3(test_vector);
} | rust_cleaned_test_functions.jsonl/69793 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 73
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25433,
12247,
62,
9228,
17,
69213,
87,
17,
17,
368,
341,
262,
1077,
1273,
12247,
284,
2924,
12524,
17223,
1244,
85,
10605,
14,
9228,
17,
69213,
87,
17,
17,
30099,
797,
262,
1273,
42434,
7260,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_report_attempts_to_successful_check() {
block_on(async {
let storage = Rc::new(Mutex::new(MemStorage::new()));
let mut state_machine = StateMachineBuilder::new_stub()
.installer(StubInstaller { should_fail: true })
.metrics_reporter(MockMetricsReporter::new())
.storage(Rc::clone(&storage))
.build()
.await;
state_machine.report_attempts_to_successful_check(true).await;
// but we should record an attempt in metrics
assert_eq!(state_machine.context.state.consecutive_failed_update_checks, 0);
assert_eq!(
state_machine.metrics_reporter.metrics,
vec![Metrics::AttemptsToSuccessfulCheck(1)]
);
state_machine.report_attempts_to_successful_check(false).await;
assert_eq!(state_machine.context.state.consecutive_failed_update_checks, 1);
state_machine.report_attempts_to_successful_check(false).await;
assert_eq!(state_machine.context.state.consecutive_failed_update_checks, 2);
// consecutive_failed_update_attempts should be reset to zero on success
state_machine.report_attempts_to_successful_check(true).await;
assert_eq!(state_machine.context.state.consecutive_failed_update_checks, 0);
assert_eq!(
state_machine.metrics_reporter.metrics,
vec![Metrics::AttemptsToSuccessfulCheck(1), Metrics::AttemptsToSuccessfulCheck(3)]
);
});
} | rust_cleaned_test_functions.jsonl/59705 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 787
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14813,
79490,
2346,
92951,
7200,
368,
341,
286,
2504,
4470,
18285,
341,
310,
1077,
5819,
284,
81463,
486,
931,
3189,
9371,
486,
931,
3189,
336,
5793,
486,
931,
7392,
310,
1077,
5206,
1584,
38695,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mut_rchunks() {
let mut v = [0, 1, 2, 3, 4, 5, 6];
assert_eq!(v.rchunks_mut(3).len(), 3);
for (i, chunk) in v.rchunks_mut(3).enumerate() {
for x in chunk {
*x = i as u8;
}
}
let result = [2, 1, 1, 1, 0, 0, 0];
assert_eq!(v, result);
} | rust_cleaned_test_functions.jsonl/12928 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 177
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29523,
1710,
84263,
368,
341,
262,
1077,
5206,
348,
284,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,
935,
262,
2060,
10714,
10297,
85,
1746,
8426... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_expected_dur_like_tokens() {
use DateTimeField::*;
use TimeStrToken::*;
assert_eq!(
expected_sql_standard_interval_tokens(Hour),
vec![Num(0, 1), Colon, Num(0, 1), Colon, Num(0, 1), Dot, Nanos(0)]
);
assert_eq!(
expected_sql_standard_interval_tokens(Minute),
vec![Num(0, 1), Colon, Num(0, 1), Dot, Nanos(0)]
);
assert_eq!(
expected_sql_standard_interval_tokens(Second),
vec![Num(0, 1), Dot, Nanos(0)]
);
} | rust_cleaned_test_functions.jsonl/100319 | {
"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,
32190,
82289,
25535,
28838,
368,
341,
286,
990,
6520,
1877,
56162,
286,
990,
4120,
2580,
3323,
56162,
286,
2060,
10714,
33673,
310,
3601,
18063,
48688,
20541,
28838,
10896,
413,
1326,
310,
7486,
207... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_form_urlencoded() {
let pairs: &[(Cow<'_, str>, Cow<'_, str>)] =
&[("foo".into(), "é&".into()), ("bar".into(), "".into()), ("foo".into(), "#".into())];
let encoded = form_urlencoded::Serializer::new(String::new()).extend_pairs(pairs).finish();
assert_eq!(encoded, "foo=%C3%A9%26&bar=&foo=%23");
assert_eq!(form_urlencoded::parse(encoded.as_bytes()).collect::<Vec<_>>(), pairs.to_vec());
} | rust_cleaned_test_functions.jsonl/52242 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 198
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7915,
2903,
19329,
368,
341,
262,
1077,
13530,
25,
609,
9697,
89915,
18291,
6878,
607,
8066,
21851,
18291,
6878,
607,
29,
7252,
4035,
286,
44590,
445,
7975,
3263,
18122,
1507,
330,
963,
5,
3263,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_measure_text_width() {
assert_eq!(measure_text_width("src/ansi/mod.rs"), 15);
assert_eq!(measure_text_width("バー"), 4);
assert_eq!(measure_text_width("src/ansi/modバー.rs"), 19);
assert_eq!(measure_text_width("\x1b[31mバー\x1b[0m"), 4);
assert_eq!(measure_text_width("a\nb\n"), 2);
} | rust_cleaned_test_functions.jsonl/49543 | {
"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,
48938,
4326,
7927,
368,
341,
286,
2060,
10714,
10297,
47799,
4326,
7927,
445,
3548,
14,
52067,
38479,
25638,
3975,
220,
16,
20,
317,
286,
2060,
10714,
10297,
47799,
4326,
7927,
445,
126408,
3975,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_expired_inflight_proposals() {
let (relayer, always_success_out_point) = build_chain(13);
let transaction = new_transaction(&relayer, 1, &always_success_out_point);
let transactions = vec![transaction];
let proposals: Vec<ProposalShortId> = transactions
.iter()
.map(|tx| tx.proposal_short_id())
.collect();
{
relayer
.shared
.state()
.insert_inflight_proposals(proposals, 2);
}
let content = packed::BlockProposal::new_builder()
.transactions(transactions.into_iter().map(|tx| tx.data()).pack())
.build();
let process = BlockProposalProcess::new(content.as_reader(), &relayer);
assert_eq!(process.execute(), Status::ignored());
} | rust_cleaned_test_functions.jsonl/40505 | {
"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,
21811,
80221,
1243,
38390,
21663,
85975,
368,
341,
1066,
262,
1077,
320,
3748,
1135,
11,
2677,
18632,
6068,
6085,
8,
284,
1936,
30583,
7,
16,
18,
317,
262,
1077,
7745,
284,
501,
28884,
2099,
374... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_clamp() {
assert_eq!(1f32.clamp(&2f32, &4f32), 2f32);
assert_eq!(8f32.clamp(&2f32, &4f32), 4f32);
assert_eq!(3f32.clamp(&2f32, &4f32), 3f32);
assert!(3f32.clamp(&Float::NaN::<f32>(), &4f32).is_NaN());
assert!(3f32.clamp(&2f32, &Float::NaN::<f32>()).is_NaN());
assert!(Float::NaN::<f32>().clamp(&2f32, &4f32).is_NaN());
} | rust_cleaned_test_functions.jsonl/101552 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 237
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6794,
1121,
368,
341,
286,
2060,
10714,
10297,
16,
69,
18,
17,
6751,
1121,
2099,
17,
69,
18,
17,
11,
609,
19,
69,
18,
17,
701,
220,
17,
69,
18,
17,
317,
286,
2060,
10714,
10297,
23,
69,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_quote_escape_bytes() {
assert_eq!("b\"\"", quote_escape_bytes(b""));
assert_eq!("b\"xyZW\"", quote_escape_bytes(b"xyZW"));
assert_eq!("b\"aa\\\"bb\"", quote_escape_bytes(b"aa\"bb"));
assert_eq!("b\"aa\\r\\n\\tbb\"", quote_escape_bytes(b"aa\r\n\tbb"));
assert_eq!(
"b\"\\x00\\x01\\x12\\xfe\\xff\"",
quote_escape_bytes(b"\x00\x01\x12\xfe\xff")
);
} | rust_cleaned_test_functions.jsonl/6509 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 251
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45236,
21832,
12524,
368,
341,
286,
2060,
10714,
17223,
65,
2105,
55853,
12641,
21832,
12524,
1883,
1,
4010,
286,
2060,
10714,
17223,
65,
2105,
4130,
81756,
55853,
12641,
21832,
12524,
1883,
1,
4130... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_type_convert_from_str() {
let _type = Type::from_str("album");
assert_eq!(_type.unwrap(), Type::Album);
let empty_type = Type::from_str("not_exist_type");
assert_eq!(empty_type.is_err(), true);
} | rust_cleaned_test_functions.jsonl/87164 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1819,
34910,
5673,
2895,
368,
341,
262,
1077,
716,
1313,
284,
3990,
486,
1499,
2895,
445,
21011,
797,
262,
2060,
10714,
0,
2490,
1313,
55395,
1507,
3990,
486,
32378,
626,
262,
1077,
4287,
1819,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_restores_scope_after_function_decl() {
use parser::translation_unit;
let env = &mut Env::new();
assert!(translation_unit(
r"
typedef int a;
int foo(a a) {}
int bar(int a);
_Atomic (a) b;
",
env
)
.is_ok());
} | rust_cleaned_test_functions.jsonl/107577 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 184
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32231,
4589,
23199,
19844,
9174,
35814,
368,
341,
262,
990,
6729,
486,
3053,
14832,
280,
262,
1077,
6105,
284,
609,
6984,
37039,
486,
931,
543,
262,
2060,
10297,
3053,
14832,
1006,
286,
435,
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... | 1 |
#[test]
fn test_quaternary_point_select() -> Result<(), PlonkError> {
test_quaternary_point_select_helper::<FqEd354, Param254>()?;
test_quaternary_point_select_helper::<FqEd377, Param377>()?;
test_quaternary_point_select_helper::<FqEd381, Param381>()?;
test_quaternary_point_select_helper::<FqEd381b, Param381b>()?;
test_quaternary_point_select_helper::<Fq377, Param761>()
} | rust_cleaned_test_functions.jsonl/33781 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 202
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11280,
13375,
658,
6085,
13051,
368,
1464,
5714,
68843,
1818,
263,
74,
1454,
29,
341,
286,
1273,
11280,
13375,
658,
6085,
13051,
10418,
27638,
37,
80,
2715,
18,
20,
19,
11,
6991,
17,
20,
19,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_backup_mode_long_with_env_var_ambiguous() {
let _dummy = TEST_MUTEX.lock().unwrap();
env::set_var(ENV_VERSION_CONTROL, "n");
let matches = make_app().get_matches_from(vec!["app", "--backup"]);
let result = determine_backup_mode(&matches);
assert!(result.is_err());
let text = format!("{}", result.unwrap_err());
assert!(text.contains("ambiguous argument 'n' for '$VERSION_CONTROL'"));
env::remove_var(ENV_VERSION_CONTROL);
} | rust_cleaned_test_functions.jsonl/98150 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 237
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44710,
7302,
17799,
6615,
15879,
4612,
62,
90213,
368,
341,
286,
1077,
716,
31390,
284,
13602,
66994,
21003,
1005,
15454,
543,
286,
6105,
486,
746,
4612,
7,
30360,
10678,
23680,
11,
330,
77,
797,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_primitive_schema() {
assert_eq!(Schema::Null, Schema::parse_str("\"null\"").unwrap());
assert_eq!(Schema::Int, Schema::parse_str("\"int\"").unwrap());
assert_eq!(Schema::Double, Schema::parse_str("\"double\"").unwrap());
} | rust_cleaned_test_functions.jsonl/26525 | {
"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,
84087,
25371,
368,
341,
286,
2060,
10714,
10297,
8632,
486,
3280,
11,
12539,
486,
6400,
2895,
38915,
2921,
2105,
1827,
15454,
1423,
286,
2060,
10714,
10297,
8632,
486,
1072,
11,
12539,
486,
6400,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_credential_def_by_send_request_fails() {
settings::clear_config();
settings::set_defaults();
settings::set_config_value(settings::CONFIG_ENABLE_TEST_MODE, "false");
assert!(::utils::libindy::anoncreds::get_cred_def_json(CRED_DEF_ID).is_err());
} | rust_cleaned_test_functions.jsonl/64619 | {
"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,
3062,
666,
30320,
7844,
3710,
13565,
7893,
761,
6209,
368,
341,
286,
5003,
486,
7422,
5332,
543,
286,
5003,
486,
746,
42290,
543,
286,
5003,
486,
746,
5332,
3142,
23369,
486,
24652,
14379,
11641,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_orient2d() {
let from = Point2::new(-1f64, -1.0);
let to = Point2::new(1f64, 1.0);
let p1 = Point2::new(::std::f64::MIN_POSITIVE, ::std::f64::MIN_POSITIVE);
let p2 = Point2::new(-::std::f64::MIN_POSITIVE, -::std::f64::MIN_POSITIVE);
let p3 = Point2::new(-::std::f64::MIN_POSITIVE, ::std::f64::MIN_POSITIVE);
let p4 = Point2::new(::std::f64::MIN_POSITIVE, -::std::f64::MIN_POSITIVE);
for &(p, sign) in &[(p1, 0.0), (p2, 0.0), (p3, 1.0), (p4, -1.0)] {
let det = orient2d(&from, &to, &p);
assert!(det == sign || det.signum() == sign.signum());
}
} | rust_cleaned_test_functions.jsonl/15943 | {
"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,
53493,
17,
67,
368,
341,
286,
1077,
504,
284,
5126,
17,
486,
931,
4080,
16,
69,
21,
19,
11,
481,
16,
13,
15,
317,
286,
1077,
311,
284,
5126,
17,
486,
931,
7,
16,
69,
21,
19,
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... | 3 |
#[test]
fn test_process_type_with_special_chars() {
assert!(ProcessType::from_str("java_jar").is_ok());
assert!(ProcessType::from_str("java-jar").is_ok());
assert!(ProcessType::from_str("java.jar").is_ok());
assert!(ProcessType::from_str("java~jar").is_err());
} | rust_cleaned_test_functions.jsonl/120408 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 135
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
1819,
6615,
41629,
37418,
368,
341,
286,
2060,
10297,
7423,
929,
486,
1499,
2895,
445,
10042,
5374,
277,
1827,
285,
19817,
1423,
286,
2060,
10297,
7423,
929,
486,
1499,
2895,
445,
10042,
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_data_from_helpers() {
let mut nonce_account = nonce_account::create_account(1).into_inner();
let state = state_from_account(&nonce_account).unwrap();
assert_eq!(
data_from_state(&state),
Err(Error::InvalidStateForOperation)
);
assert_eq!(
data_from_account(&nonce_account),
Err(Error::InvalidStateForOperation)
);
let data = nonce::state::Data::new(Pubkey::new(&[1u8; 32]), Hash::new(&[42u8; 32]), 42);
nonce_account
.set_state(&Versions::new_current(State::Initialized(data.clone())))
.unwrap();
let state = state_from_account(&nonce_account).unwrap();
assert_eq!(data_from_state(&state), Ok(&data));
assert_eq!(data_from_account(&nonce_account), Ok(data));
} | rust_cleaned_test_functions.jsonl/106250 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 394
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1769,
5673,
54473,
368,
341,
286,
1077,
5206,
39676,
13500,
284,
39676,
13500,
486,
3182,
13500,
7,
16,
568,
18122,
34345,
543,
286,
1077,
1584,
284,
1584,
5673,
13500,
2099,
39593,
13500,
568,
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_set_tag() {
let temp_fn = "fixtures/temp.mp3";
fs::copy(TEST_MP3, temp_fn).unwrap();
let file = File::new(temp_fn).unwrap();
let mut tag = file.tag().unwrap();
tag.set_artist("Not Artist");
assert_eq!(tag.artist().unwrap(), "Not Artist");
file.save();
let file = File::new(temp_fn).unwrap();
let tag = file.tag().unwrap();
assert_eq!(tag.artist().unwrap(), "Not Artist");
fs::remove_file(temp_fn).unwrap();
} | rust_cleaned_test_functions.jsonl/79494 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 250
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
9372,
368,
341,
286,
1077,
2730,
15246,
284,
330,
45247,
70445,
16870,
18,
876,
286,
8619,
486,
8560,
50320,
53052,
18,
11,
2730,
15246,
568,
15454,
543,
286,
1077,
1034,
284,
2887,
486,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stakes_vote_account_disappear_reappear() {
let mut stakes = Stakes {
epoch: 4,
..Stakes::default()
};
let ((vote_pubkey, mut vote_account), (stake_pubkey, stake_account)) =
create_staked_node_accounts(10);
stakes.store(&vote_pubkey, &vote_account, true);
stakes.store(&stake_pubkey, &stake_account, true);
{
let vote_accounts = stakes.vote_accounts();
assert!(vote_accounts.get(&vote_pubkey).is_some());
assert_eq!(vote_accounts.get(&vote_pubkey).unwrap().0, 10);
}
vote_account.set_lamports(0);
stakes.store(&vote_pubkey, &vote_account, true);
{
let vote_accounts = stakes.vote_accounts();
assert!(vote_accounts.get(&vote_pubkey).is_none());
}
vote_account.set_lamports(1);
stakes.store(&vote_pubkey, &vote_account, true);
{
let vote_accounts = stakes.vote_accounts();
assert!(vote_accounts.get(&vote_pubkey).is_some());
assert_eq!(vote_accounts.get(&vote_pubkey).unwrap().0, 10);
}
// Vote account too big
let cache_data = vote_account.data().to_vec();
let mut pushed = vote_account.data().to_vec();
pushed.push(0);
vote_account.set_data(pushed);
stakes.store(&vote_pubkey, &vote_account, true);
{
let vote_accounts = stakes.vote_accounts();
assert!(vote_accounts.get(&vote_pubkey).is_none());
}
// Vote account uninitialized
let default_vote_state = VoteState::default();
let versioned = VoteStateVersions::new_current(default_vote_state);
VoteState::to(&versioned, &mut vote_account).unwrap();
stakes.store(&vote_pubkey, &vote_account, true);
{
let vote_accounts = stakes.vote_accounts();
assert!(vote_accounts.get(&vote_pubkey).is_none());
}
vote_account.set_data(cache_data);
stakes.store(&vote_pubkey, &vote_account, true);
{
let vote_accounts = stakes.vote_accounts();
assert!(vote_accounts.get(&vote_pubkey).is_some());
assert_eq!(vote_accounts.get(&vote_pubkey).unwrap().0, 10);
}
} | rust_cleaned_test_functions.jsonl/94744 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1103
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
2050,
54360,
13500,
9932,
40766,
1288,
40766,
368,
341,
286,
1077,
5206,
44425,
284,
794,
2050,
341,
310,
16342,
25,
220,
19,
345,
310,
5241,
623,
2050,
486,
2258,
741,
286,
3634,
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_read_f32() {
//big-endian floating-point 8.1250
let buf = vec![0x41, 0x02, 0x00, 0x00];
let mut writer = MemWriter::new();
writer.write(buf.as_slice()).unwrap();
let mut reader = MemReader::new(writer.unwrap());
let f = reader.read_be_f32().unwrap();
assert!(f == 8.1250);
} | rust_cleaned_test_functions.jsonl/22930 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 177
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
761,
18,
17,
368,
341,
286,
442,
16154,
13068,
1103,
19057,
16574,
220,
23,
13,
16,
17,
20,
15,
198,
286,
1077,
6607,
284,
7486,
20703,
15,
87,
19,
16,
11,
220,
15,
87,
15,
17,
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_inspect_log_disconnect_stats_disconnect_source_user() {
let mut exec = fasync::TestExecutor::new().expect("Failed to create an executor");
let (mut cobalt_sender, _cobalt_receiver) = fake_cobalt_sender();
let (mut cobalt_1dot1_proxy, mut cobalt_1dot1_stream) =
create_proxy_and_stream::<fidl_fuchsia_metrics::MetricEventLoggerMarker>()
.expect("failed to create Cobalt 1.1 proxy and stream");
let (inspect_tree, _persistence_stream) = fake_inspect_tree();
let disconnect_source =
DisconnectSource::User(fidl_sme::UserDisconnectReason::FailedToConnect);
let disconnect_info = DisconnectInfo {
connected_duration: 30.seconds(),
bssid: Bssid([1u8; 6]),
ssid: Ssid::try_from("foo").unwrap(),
wsc: Some(fake_probe_resp_wsc_ie()),
protection: BssProtection::Open,
channel: Channel { primary: 1, cbw: Cbw::Cbw20 },
last_rssi: -90,
last_snr: 1,
disconnect_source,
time_since_channel_switch: Some(zx::Duration::from_nanos(1337i64)),
};
let fut = log_disconnect(
&mut cobalt_sender,
&mut cobalt_1dot1_proxy,
inspect_tree.clone(),
&disconnect_info,
);
pin_mut!(fut);
// This is to execute and complete the Future
let _cobalt_1dot1_events =
drain_cobalt_events(&mut exec, &mut fut, &mut cobalt_1dot1_stream);
assert_data_tree!(inspect_tree.inspector, root: contains {
client_stats: contains {
disconnect: {
"0": {
"@time": AnyProperty,
connected_duration: 30.seconds().into_nanos(),
bssid: "01:01:01:01:01:01",
bssid_hash: AnyProperty,
ssid: "<ssid-666f6f>",
ssid_hash: AnyProperty,
wsc: {
device_name: "ASUS Router",
manufacturer: "ASUSTek Computer Inc.",
model_name: "RT-AC58U",
model_number: "123",
},
protection: "Open",
channel: {
primary: 1u64,
cbw: "Cbw20",
secondary80: 0u64,
},
last_rssi: -90i64,
last_snr: 1i64,
locally_initiated: true,
reason_code: (1u64 << 16) + 1u64,
disconnect_source: "source: user, reason: FailedToConnect",
time_since_channel_switch: 1337i64,
}
}
}
});
} | rust_cleaned_test_functions.jsonl/50934 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1718
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34386,
987,
5224,
67972,
15381,
67972,
10347,
3317,
368,
341,
286,
1077,
5206,
3883,
284,
282,
7692,
486,
2271,
25255,
486,
931,
1005,
17119,
445,
9408,
311,
1855,
458,
31558,
797,
286,
1077,
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_bufreader() {
let child = Command::new("perl").arg("-e").arg(SCRIPT).spawn().unwrap();
let mut reader = BufReader::new(ProcReader::from_stdout(child.id()));
thread::sleep(Duration::from_secs(4));
let mut line = String::new();
let _ = reader.read_to_string(&mut line);
assert_eq!("aaa\nbbb\nccc\n", line);
} | rust_cleaned_test_functions.jsonl/127259 | {
"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,
10363,
11149,
368,
341,
286,
1077,
1682,
284,
7348,
486,
931,
445,
64936,
1827,
858,
13645,
68,
1827,
858,
7,
24787,
568,
46087,
1005,
15454,
543,
286,
1077,
5206,
6604,
284,
69013,
5062,
486,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_filter_incoming_too_many_subscriptions_per_request() {
let t1 = TopicHash::from_raw("t1");
let mut filter = MaxCountSubscriptionFilter {
filter: AllowAllSubscriptionFilter {},
max_subscribed_topics: 100,
max_subscriptions_per_request: 2,
};
let old = Default::default();
let subscriptions = vec![
GossipsubSubscription {
action: Subscribe,
topic_hash: t1.clone(),
},
GossipsubSubscription {
action: Unsubscribe,
topic_hash: t1.clone(),
},
GossipsubSubscription {
action: Subscribe,
topic_hash: t1,
},
];
let result = filter.filter_incoming_subscriptions(&subscriptions, &old);
assert_eq!(result, Err("too many subscriptions per request".into()));
} | rust_cleaned_test_functions.jsonl/121432 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 477
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8727,
1243,
4959,
2346,
78,
22101,
5228,
29966,
5678,
7893,
368,
341,
286,
1077,
259,
16,
284,
32911,
6370,
486,
1499,
16067,
445,
83,
16,
3071,
286,
1077,
5206,
4051,
284,
7487,
2507,
33402,
56... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simplity_optimized_plan_eq_expr() {
let table_scan = test_table_scan();
let plan = LogicalPlanBuilder::from(table_scan)
.filter(col("b").eq(lit(true)))
.unwrap()
.filter(col("c").eq(lit(false)))
.unwrap()
.project(vec![col("a")])
.unwrap()
.build()
.unwrap();
let expected = "\
Projection: #test.a\
\n Filter: NOT #test.c AS test.c = Boolean(false)\
\n Filter: #test.b AS test.b = Boolean(true)\
\n TableScan: test projection=None";
assert_optimized_plan_eq(&plan, expected);
} | rust_cleaned_test_functions.jsonl/19695 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 353
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
6383,
487,
15032,
45706,
26564,
10714,
21915,
368,
341,
286,
1077,
1965,
28857,
284,
1273,
5237,
28857,
543,
286,
1077,
3119,
284,
62069,
20485,
3297,
486,
1499,
15761,
28857,
340,
310,
659,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_det_matrix_matrix() {
let a: Matrix<isize> = Matrix::identity(2, 2);
assert_eq!(a.determinant(), 1);
let b: Matrix<isize> = Matrix::identity(3, 3);
assert_eq!(b.determinant(), 1);
} | rust_cleaned_test_functions.jsonl/60182 | {
"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,
24409,
10193,
10193,
368,
341,
286,
1077,
264,
25,
11631,
27,
285,
551,
29,
284,
11631,
486,
16912,
7,
17,
11,
220,
17,
317,
286,
2060,
10714,
10297,
64,
950,
16483,
517,
1507,
220,
16,
626,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_big_primes() {
let mut instring = String::new();
let mut outstring = String::new();
for prime in PRIMES64 {
instring.push_str(&(format!("{} ", prime))[..]);
outstring.push_str(&(format!("{0}: {0}\n", prime))[..]);
}
run(instring.as_bytes(), outstring.as_bytes());
} | rust_cleaned_test_functions.jsonl/85355 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36386,
5294,
1733,
368,
341,
262,
1077,
5206,
304,
917,
284,
923,
486,
931,
543,
262,
1077,
5206,
700,
917,
284,
923,
486,
931,
543,
262,
369,
10250,
304,
8575,
1791,
1570,
21,
19,
341,
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... | 2 |
#[test]
fn test_aes_ecb () {
let key = b"YELLOW SUBMARINE";
let file_contents: &'static str = include_str!("7.txt");
let raw_bytes: Vec<u8> = base64_from_str(file_contents);
let res = aes_ecb_decrypt(key, &raw_bytes);
assert_eq!(
hex::decode(
"24df84533fc2778495577c844bcf3fe1d4d17c68d8c5cbc5a308286db58c69b6"
).unwrap(),
sha::sha256(&res)
);
} | rust_cleaned_test_functions.jsonl/72314 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 275
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
90958,
36844,
65,
1719,
341,
286,
1077,
1376,
284,
293,
1,
97029,
16140,
60661,
3981,
3302,
1789,
286,
1077,
1034,
16682,
25,
30136,
1978,
607,
284,
2924,
2895,
17223,
22,
3909,
797,
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_simple_non_opaque_struct() {
test_file! {
#[diplomat::bridge]
mod ffi {
struct MyStruct {
a: u8,
b: u8,
}
impl MyStruct {
pub fn new(a: u8, b: u8) -> MyStruct {
unimplemented!()
}
pub fn get_a(&self) -> u8 {
unimplemented!()
}
pub fn set_b(&mut self, b: u8) {
unimplemented!()
}
}
}
}
} | rust_cleaned_test_functions.jsonl/42849 | {
"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,
30015,
21637,
10287,
19659,
15126,
368,
341,
286,
1273,
2458,
0,
341,
310,
11506,
8579,
500,
80768,
486,
13709,
921,
310,
1463,
76956,
341,
394,
2036,
3017,
9422,
341,
503,
264,
25,
575,
23,
345... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_storage_first_index() {
setup_for_test();
let ents = vec![new_entry(3, 3), new_entry(4, 4), new_entry(5, 5)];
let storage = MemStorage::new();
storage.wl().entries = ents;
let wresult = Ok(4);
let result = storage.first_index();
if result != wresult {
panic!("want {:?}, got {:?}", wresult, result);
}
storage.wl().compact(4).expect("compact failed");
let wresult = Ok(5);
let result = storage.first_index();
if result != wresult {
panic!("want {:?}, got {:?}", wresult, result);
}
} | rust_cleaned_test_functions.jsonl/50260 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 308
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23310,
12978,
3560,
368,
341,
286,
6505,
5478,
4452,
543,
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,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_rwlock_debug() {
let x = RwLock::new(vec![0u8, 10]);
assert_eq!(format!("{:?}", x), "RwLock { data: [0, 10] }");
let _lock = x.write();
assert_eq!(format!("{:?}", x), "RwLock { data: <locked> }");
} | rust_cleaned_test_functions.jsonl/15762 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
98850,
15446,
368,
341,
286,
1077,
856,
284,
55294,
11989,
486,
931,
25592,
20703,
15,
84,
23,
11,
220,
16,
15,
10149,
286,
2060,
10714,
10297,
2243,
88928,
25,
52652,
856,
701,
330,
49,
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... | 1 |
#[test]
fn test_nth_child() {
let doc: Document = r#"<!DOCTYPE html>
<html lang="en">
<head></head>
<body>
<div id="bggrad"></div>
<div class="container container-header"></div>
<div class="container container-main">
<nav class="navbar navbar-default navbar-static-top"></nav>
<div class="row">
<div class="col-xs-12"></div>
<div class="col-xs-12"></div>
<div class="col-md-10">
<a href="\#">foo</a>
</div>
</div>
</div>
</body>
</html>"#
.into();
let a = doc
.select("body > div.container.container-main > div.row:nth-child(2) > div.col-md-10 > a");
assert!(a.length() == 1);
} | rust_cleaned_test_functions.jsonl/132800 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 485
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
78342,
17268,
368,
341,
262,
1077,
4629,
25,
11789,
284,
435,
55543,
13543,
15458,
5272,
397,
262,
366,
1551,
8688,
428,
268,
881,
286,
366,
1983,
1472,
1983,
397,
1066,
286,
366,
2599,
397,
310... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_state_sync_multichunk_epoch() {
let mut swarm = new_local_swarm(4);
for validator in swarm.validators_mut() {
let mut config = validator.config().clone();
config.state_sync.chunk_limit = 5;
config.save(validator.config_path()).unwrap();
validator.restart().unwrap();
}
swarm.launch().unwrap(); // Make sure all nodes are healthy and live
let validator_peer_ids = swarm.validators().map(|v| v.peer_id()).collect::<Vec<_>>();
let client_0 = swarm
.validator(validator_peer_ids[0])
.unwrap()
.rest_client();
let transaction_factory = swarm.chain_info().transaction_factory();
let runtime = Runtime::new().unwrap();
runtime
.block_on(enable_open_publishing(
&client_0,
&transaction_factory,
swarm.chain_info().root_account,
))
.unwrap();
let mut account_0 = runtime.block_on(create_and_fund_account(&mut swarm, 100));
let account_1 = runtime.block_on(create_and_fund_account(&mut swarm, 10));
runtime.block_on(async {
assert_balance(&client_0, &account_0, 100).await;
assert_balance(&client_0, &account_1, 10).await;
});
// and each epoch spanning multiple chunks
let node_to_restart = validator_peer_ids[3];
swarm.validator_mut(node_to_restart).unwrap().stop();
runtime.block_on(async {
for _ in 0..7 {
transfer_coins(
&client_0,
&transaction_factory,
&mut account_0,
&account_1,
10,
)
.await;
}
});
let script_path = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
.join("../..")
.join("testsuite/smoke-test/src/dev_modules/test_script.move")
.canonicalize()
.unwrap();
let move_stdlib_dir = move_stdlib::move_stdlib_modules_full_path();
let diem_core_framework_dir = diem_framework::diem_core_modules_full_path();
let diem_payment_framework_dir = diem_framework::diem_payment_modules_full_path();
let dependencies = &[
move_stdlib_dir.as_str(),
diem_core_framework_dir.as_str(),
diem_payment_framework_dir.as_str(),
];
let compiled_script = compile_program(script_path.to_str().unwrap(), dependencies).unwrap();
let txn = account_0.sign_with_transaction_builder(transaction_factory.payload(
TransactionPayload::Script(Script::new(
compiled_script,
vec![],
vec![
TransactionArgument::U64(10),
TransactionArgument::Address(AccountAddress::from_hex_literal("0x0").unwrap()),
],
)),
));
runtime.block_on(async {
client_0.submit_and_wait(&txn).await.unwrap();
// Bump epoch by trigger a reconfig for multiple epochs
for curr_epoch in 2u64..=3 {
// bumps epoch from curr_epoch -> curr_epoch + 1
enable_open_publishing(
&client_0,
&transaction_factory,
swarm.chain_info().root_account,
)
.await
.unwrap();
let next_block_epoch = *client_0
.get_epoch_configuration()
.await
.unwrap()
.into_inner()
.next_block_epoch
.inner();
assert_eq!(next_block_epoch, curr_epoch + 1);
}
});
let json_rpc_client_0 = swarm
.validator(validator_peer_ids[0])
.unwrap()
.json_rpc_client();
// bring back dead validator with waypoint
let epoch_change_proof: EpochChangeProof = bcs::from_bytes(
json_rpc_client_0
.get_state_proof(0)
.unwrap()
.into_inner()
.epoch_change_proof
.inner(),
)
.unwrap();
let waypoint_epoch_2 = Waypoint::new_epoch_boundary(
epoch_change_proof
.ledger_info_with_sigs
.last()
.unwrap()
.ledger_info(),
)
.unwrap();
let node_config_path = swarm.validator(node_to_restart).unwrap().config_path();
let mut node_config = swarm.validator(node_to_restart).unwrap().config().clone();
node_config.execution.genesis = None;
node_config.execution.genesis_file_location = PathBuf::from("");
insert_waypoint(&mut node_config, waypoint_epoch_2);
node_config.save(node_config_path).unwrap();
// Restart killed node and wait for all nodes to catchup
swarm
.validator_mut(node_to_restart)
.unwrap()
.start()
.unwrap();
swarm
.validator_mut(node_to_restart)
.unwrap()
.wait_until_healthy(Instant::now() + Duration::from_secs(10))
.unwrap();
swarm
.wait_for_all_nodes_to_catchup(Instant::now() + Duration::from_secs(60))
.unwrap();
} | rust_cleaned_test_functions.jsonl/29248 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2396
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4387,
23008,
26290,
713,
3122,
20682,
368,
341,
262,
1077,
5206,
60841,
284,
501,
13564,
32581,
2178,
7,
19,
317,
262,
369,
22935,
304,
60841,
82728,
29523,
368,
341,
286,
1077,
5206,
2193,
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... | 4 |
#[test]
fn test_commutative_diffie_hellman() {
let alice = Keypair::generate();
let bob = Keypair::generate();
let shared_secret1 = alice.secret.diffie_hellman(&bob.public);
let shared_secret2 = bob.secret.diffie_hellman(&alice.public);
assert_eq!(shared_secret1.as_bytes(), shared_secret2.as_bytes())
} | rust_cleaned_test_functions.jsonl/17465 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 155
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2965,
6984,
1388,
15850,
645,
1523,
613,
1515,
368,
341,
286,
1077,
70433,
284,
6569,
1082,
1310,
486,
19366,
543,
286,
1077,
35192,
284,
6569,
1082,
1310,
486,
19366,
1428,
286,
1077,
6094,
21962... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_debug() {
let g = ArgGroup::with_name("test")
.arg("a1")
.arg("a4")
.args(&["a2", "a3"])
.required(true)
.conflicts_with("c1")
.conflicts_with_all(&["c2", "c3"])
.conflicts_with("c4")
.requires("r1")
.requires_all(&["r2", "r3"])
.requires("r4");
let args = vec!["a1", "a4", "a2", "a3"];
let reqs = vec!["r1", "r2", "r3", "r4"];
let confs = vec!["c1", "c2", "c3", "c4"];
let debug_str = format!("{{\n\
\tname: \"test\",\n\
\targs: {:?},\n\
\trequired: {:?},\n\
\trequires: {:?},\n\
\tconflicts: {:?},\n\
}}",
args,
true,
Some(reqs),
Some(confs));
assert_eq!(&*format!("{:?}", g), &*debug_str);
} | rust_cleaned_test_functions.jsonl/83359 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 699
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15446,
368,
341,
286,
1077,
342,
284,
7638,
2808,
486,
4197,
1269,
445,
1944,
1138,
310,
659,
858,
445,
64,
16,
1138,
310,
659,
858,
445,
64,
19,
1138,
310,
659,
2116,
2099,
1183,
64,
17,
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... | 1 |
#[test]
fn test_create_list_table_patient_columns_no_header() {
test_list_table_patient(
&["PatientID", "Number of Studies"],
&["PatientID"],
true,
include_str!("../tests/data/unit/list_patients_columns_no_header").trim_end(),
);
} | rust_cleaned_test_functions.jsonl/76476 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
2019,
5237,
70310,
22590,
6536,
8757,
368,
341,
286,
1273,
2019,
5237,
70310,
1006,
310,
609,
1183,
36592,
915,
497,
330,
2833,
315,
18720,
8097,
310,
609,
1183,
36592,
915,
8097,
310,
830,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_shas() {
let db = Database::temp().unwrap();
let results = DatabaseDB::new(&db);
let config = Config::default();
::crates::lists::setup_test_lists(&db, &config).unwrap();
// Create a dummy experiment to attach the results to
CreateExperiment::dummy("dummy")
.apply(&db, &config)
.unwrap();
let ex = Experiment::get(&db, "dummy").unwrap().unwrap();
// Define some dummy GitHub repositories
let repo1 = GitHubRepo {
org: "foo".to_string(),
name: "bar".to_string(),
};
let repo2 = GitHubRepo {
org: "foo".to_string(),
name: "baz".to_string(),
};
// Store some SHAs for those repos
results
.record_sha(&ex, &repo1, "0000000000000000000000000000000000000000")
.unwrap();
results
.record_sha(&ex, &repo2, "ffffffffffffffffffffffffffffffffffffffff")
.unwrap();
// Ensure all the SHAs were recorded correctly
let shas = results.load_all_shas(&ex).unwrap();
assert_eq!(shas.len(), 2);
assert_eq!(
shas.get(&repo1).unwrap(),
"0000000000000000000000000000000000000000"
);
assert_eq!(
shas.get(&repo2).unwrap(),
"ffffffffffffffffffffffffffffffffffffffff"
);
// Ensure results are cleanly overridden when recording the same repo again
results
.record_sha(&ex, &repo1, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
.unwrap();
let shas = results.load_all_shas(&ex).unwrap();
assert_eq!(shas.len(), 2);
assert_eq!(
shas.get(&repo1).unwrap(),
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
);
assert_eq!(
shas.get(&repo2).unwrap(),
"ffffffffffffffffffffffffffffffffffffffff"
);
} | rust_cleaned_test_functions.jsonl/25621 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 948
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3712,
300,
368,
341,
286,
1077,
2927,
284,
9994,
486,
3888,
1005,
15454,
543,
286,
1077,
3059,
284,
9994,
3506,
486,
931,
2099,
1999,
317,
286,
1077,
2193,
284,
5532,
486,
2258,
1428,
286,
3504,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_boot_config() {
let vm_resources = default_vm_resources();
let expected_boot_cfg = vm_resources.boot_config.as_ref().unwrap();
let actual_boot_cfg = vm_resources.boot_source().unwrap();
assert_eq!(actual_boot_cfg, expected_boot_cfg);
} | rust_cleaned_test_functions.jsonl/5455 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
52062,
5332,
368,
341,
286,
1077,
10995,
35569,
284,
1638,
39008,
35569,
543,
286,
1077,
3601,
52062,
18343,
284,
10995,
35569,
20881,
5332,
5357,
7793,
1005,
15454,
543,
286,
1077,
5042,
52062,
183... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_space() {
let test_cases = vec![
(None, None),
(Some(0), Some(b"".to_vec())),
(Some(0), Some(b"".to_vec())),
(Some(3), Some(b" ".to_vec())),
(Some(-1), Some(b"".to_vec())),
(Some(i64::max_value()), None),
(
Some(i64::from(tidb_query_datatype::MAX_BLOB_WIDTH) + 1),
None,
),
(
Some(i64::from(tidb_query_datatype::MAX_BLOB_WIDTH)),
Some(vec![
super::SPACE;
tidb_query_datatype::MAX_BLOB_WIDTH as usize
]),
),
];
for (len, exp) in test_cases {
let output = RpnFnScalarEvaluator::new()
.push_param(len)
.evaluate(ScalarFuncSig::Space)
.unwrap();
assert_eq!(output, exp);
}
} | rust_cleaned_test_functions.jsonl/10179 | {
"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,
14663,
368,
341,
286,
1077,
1273,
41427,
284,
7486,
90515,
310,
320,
4064,
11,
2240,
1326,
310,
320,
8373,
7,
15,
701,
4329,
1883,
69355,
983,
13251,
73727,
310,
320,
8373,
7,
15,
701,
4329,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_tuple() {
#[derive(Deserialize, PartialEq, Debug)]
struct Rgb(u8, u8, u8);
let lua = Lua::new();
lua.context(|lua| {
let expected = Rgb(1, 2, 3);
let value = lua.load(
r#"
a = {1, 2, 3}
return a
"#).eval().unwrap();
let got = from_value(value).unwrap();
assert_eq!(expected, got);
let expected = (1, 2, 3);
let value = lua.load(
r#"
a = {1, 2, 3}
return a
"#).eval().unwrap();
let got = from_value(value).unwrap();
assert_eq!(expected, got);
});
} | rust_cleaned_test_functions.jsonl/15899 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 447
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21773,
368,
341,
286,
11506,
27098,
7,
64465,
11,
55039,
11,
11091,
5563,
286,
2036,
431,
9511,
8154,
23,
11,
575,
23,
11,
575,
23,
626,
286,
1077,
20357,
284,
37662,
486,
931,
543,
286,
20357... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dynamic_spendable_outputs_local_htlc_success_tx() {
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
// Create some initial channels
let chan_1 = create_announced_chan_between_nodes(&nodes, 0, 1, InitFeatures::supported(), InitFeatures::supported());
let payment_preimage = route_payment(&nodes[0], &vec!(&nodes[1])[..], 9000000).0;
let local_txn = nodes[1].node.channel_state.lock().unwrap().by_id.get_mut(&chan_1.2).unwrap().channel_monitor().get_latest_local_commitment_txn();
assert_eq!(local_txn[0].input.len(), 1);
check_spends!(local_txn[0], chan_1.3.clone());
// Give B knowledge of preimage to be able to generate a local HTLC-Success Tx
nodes[1].node.claim_funds(payment_preimage, 9_000_000);
check_added_monitors!(nodes[1], 1);
let header = BlockHeader { version: 0x20000000, prev_blockhash: Default::default(), merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 };
nodes[1].block_notifier.block_connected(&Block { header, txdata: vec![local_txn[0].clone()] }, 1);
let events = nodes[1].node.get_and_clear_pending_msg_events();
match events[0] {
MessageSendEvent::UpdateHTLCs { .. } => {},
_ => panic!("Unexpected event"),
}
match events[1] {
MessageSendEvent::BroadcastChannelUpdate { .. } => {},
_ => panic!("Unexepected event"),
}
let node_txn = nodes[1].tx_broadcaster.txn_broadcasted.lock().unwrap();
assert_eq!(node_txn[0].input.len(), 1);
assert_eq!(node_txn[0].input[0].witness.last().unwrap().len(), ACCEPTED_HTLC_SCRIPT_WEIGHT);
check_spends!(node_txn[0], local_txn[0].clone());
// Verify that B is able to spend its own HTLC-Success tx thanks to spendable output event given back by its ChannelMonitor
let spend_txn = check_spendable_outputs!(nodes[1], 1);
assert_eq!(spend_txn.len(), 2);
check_spends!(spend_txn[0], node_txn[0].clone());
check_spends!(spend_txn[1], node_txn[2].clone());
} | rust_cleaned_test_functions.jsonl/28315 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 806
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45992,
643,
3740,
480,
35189,
13564,
49086,
17257,
18632,
17805,
368,
341,
10217,
26023,
1645,
18343,
82,
284,
1855,
45552,
1645,
18343,
82,
7,
17,
317,
10217,
2436,
18343,
82,
284,
1855,
5084,
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... | 3 |
#[test]
fn test_utf16_hex_input() {
fn run(args: &[&str]) -> Assert {
bin().with_args(&["--input", "utf16-hex"]).with_args(args)
}
// Non-ASCII
run(&[
"0633 0x0644 0627,0645", ])
.stdout()
.is("سلام")
.stdout()
.contains("سلام\n")
.unwrap();
} | rust_cleaned_test_functions.jsonl/89790 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 168
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39453,
16,
21,
32655,
5898,
368,
341,
262,
5168,
1598,
7356,
25,
44590,
5,
495,
2467,
1464,
5319,
341,
286,
9544,
1005,
4197,
8384,
2099,
1183,
313,
1355,
497,
330,
4762,
16,
21,
2832,
327,
45... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_datetime_zulu_from_str() {
assert_eq!(Value::DateTime(DateTime::new(Date::new_str("2012", "01", "03"), Some(Time::new_str(
"03", "30", "30", None, Some(TimeOffset::Zulu)
)))), Value::datetime_zulu_from_str("2012", "01", "03", "03", "30", "30").unwrap());
} | rust_cleaned_test_functions.jsonl/86223 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
28943,
6415,
24411,
5673,
2895,
368,
341,
262,
2060,
10714,
10297,
1130,
486,
7689,
32083,
486,
931,
19987,
486,
931,
2895,
445,
17,
15,
16,
17,
497,
330,
15,
16,
497,
330,
15,
18,
3975,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bitxor() {
assert!(Seals::all() ^ (Seal::Seal | Seal::Write) == (Seal::Shrink | Seal::Grow | Seal::FutureWrite));
} | rust_cleaned_test_functions.jsonl/34333 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 64
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13996,
71311,
368,
341,
197,
6948,
10297,
1514,
1127,
486,
541,
368,
6306,
320,
1514,
278,
486,
1514,
278,
760,
52525,
486,
7985,
8,
621,
320,
1514,
278,
486,
2016,
34365,
760,
52525,
486,
56788... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_api_error_deser() {
let expected = GeneralApiError {
code: ErrorCode::UnknownAccount,
message: "Unknown account".to_owned(),
};
serde_test::assert_tokens(
&expected,
&[
Token::Struct {
name: "GeneralApiError",
len: 2,
},
Token::Str("code"),
Token::U64(10001),
Token::Str("message"),
Token::Str("Unknown account"),
Token::StructEnd,
],
);
} | rust_cleaned_test_functions.jsonl/14458 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 365
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11697,
4096,
15768,
261,
368,
341,
286,
1077,
3601,
284,
3251,
6563,
1454,
341,
310,
2038,
25,
60084,
486,
13790,
7365,
345,
310,
1943,
25,
330,
13790,
2692,
3263,
983,
51973,
3148,
286,
3634,
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_system_transaction_data_layout() {
use crate::packet::PACKET_DATA_SIZE;
let mut tx0 = test_tx();
tx0.message.instructions[0].data = vec![1, 2, 3];
let message0a = tx0.message_data();
let tx_bytes = serialize(&tx0).unwrap();
assert!(tx_bytes.len() <= PACKET_DATA_SIZE);
assert_eq!(
memfind(&tx_bytes, tx0.signatures[0].as_ref()),
Some(SIG_OFFSET)
);
let tx1 = deserialize(&tx_bytes).unwrap();
assert_eq!(tx0, tx1);
assert_eq!(tx1.message().instructions[0].data, vec![1, 2, 3]);
tx0.message.instructions[0].data = vec![1, 2, 4];
let message0b = tx0.message_data();
assert_ne!(message0a, message0b);
} | rust_cleaned_test_functions.jsonl/22082 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 387
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17687,
28884,
1769,
14466,
368,
341,
286,
990,
17717,
486,
24829,
486,
17279,
1348,
7896,
4098,
280,
286,
1077,
5206,
9854,
15,
284,
1273,
17805,
543,
286,
9854,
15,
6698,
80599,
58,
15,
936,
69... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_decoration_backwards() {
assert_eq!(Some(Colour::Blue.italic()),
LsColors::parse_style("34;03"));
assert_eq!(Some(Colour::Cyan.bold()),
LsColors::parse_style("36;01"));
assert_eq!(Some(Colour::Red.normal()),
LsColors::parse_style("31;00"));
} | rust_cleaned_test_functions.jsonl/90575 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
2259,
26452,
3895,
4014,
368,
341,
262,
2060,
10714,
10297,
8373,
3025,
337,
413,
486,
10331,
13,
34406,
14702,
2290,
444,
82,
13108,
486,
6400,
15117,
445,
18,
19,
26,
15,
18,
14929,
262... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_spj_0_with_tle() {
let task = generate_judge_task(SOURCE_TLE, PROBLEM);
let judge = Judge::new();
for report in judge.judge(task) {
match report {
Report::TimeLimitExceeded => {}
res => panic!("Wrong judge result: {}", res),
}
}
} | rust_cleaned_test_functions.jsonl/52123 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10123,
73,
62,
15,
6615,
528,
273,
368,
341,
262,
1077,
3383,
284,
6923,
5374,
19561,
12184,
3759,
13077,
1139,
867,
11,
5308,
69292,
317,
262,
1077,
11651,
284,
20207,
486,
931,
543,
262,
369,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_cli_arg_ok() {
Command::new("cargo")
.args(&["run", "acc", "test@example.com"])
.unwrap()
.assert()
.success();
} | rust_cleaned_test_functions.jsonl/13717 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 93
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47147,
6057,
19817,
368,
341,
262,
7348,
486,
931,
445,
66715,
1138,
286,
659,
2116,
2099,
1183,
6108,
497,
330,
4475,
497,
330,
1944,
35487,
905,
14108,
286,
659,
15454,
741,
286,
659,
2207,
74... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_empty_ends_with() {
macro_rules! test {
( $result:expr , $string:expr , $substring:expr ) => {
#[allow(clippy::bool_assert_comparison)]
{
assert_eq!(
$result,
RawOsStr::from_str($string)
.ends_with_os(RawOsStr::from_str($substring)),
);
}
};
}
test!(true, "", "");
test!(false, "", "r");
test!(false, "", "ar");
} | rust_cleaned_test_functions.jsonl/55745 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 301
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
90729,
6615,
368,
341,
262,
18072,
21407,
0,
1273,
341,
286,
320,
400,
1382,
96011,
1154,
400,
917,
96011,
1154,
400,
33874,
96011,
873,
589,
341,
310,
11506,
7183,
9849,
45749,
486,
2641,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_ascii() {
let input = "Rámon".to_string();
let mut buffer = String::new();
to_ascii(&input, &mut buffer);
assert_eq!("Ramon", buffer);
} | rust_cleaned_test_functions.jsonl/75892 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
50238,
368,
341,
286,
1077,
1946,
284,
330,
49,
1953,
1645,
3263,
983,
3904,
543,
286,
1077,
5206,
4147,
284,
923,
486,
931,
543,
286,
311,
50238,
2099,
1355,
11,
609,
6984,
4147,
317,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_edge_distance() {
let e = SimpleEdge::new(Point2::new(0f32, 0.), Point2::new(1., 1.));
relative_eq!(e.distance2(&Point2::new(1.0, 0.0)), 0.5);
relative_eq!(e.distance2(&Point2::new(0.0, 1.)), 0.5);
relative_eq!(e.distance2(&Point2::new(-1.0, -1.0)), 2.0);
relative_eq!(e.distance2(&Point2::new(2.0, 2.0)), 2.0);
} | rust_cleaned_test_functions.jsonl/80232 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 201
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17932,
19464,
368,
341,
286,
1077,
384,
284,
8993,
11656,
486,
931,
32737,
17,
486,
931,
7,
15,
69,
18,
17,
11,
220,
15,
24389,
5126,
17,
486,
931,
7,
16,
2572,
220,
16,
13,
1106,
286,
867... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_transform_role_to_config_overrides() {
let role_group = "role_group";
let file_name = "foo.bar";
let role = Role {
config: build_common_config(
build_test_config(ROLE_CONFIG, ROLE_ENV, ROLE_CLI),
// should override
build_config_override(file_name, "file"),
None,
// should override
build_cli_override("cli"),
),
role_groups: collection! {role_group.to_string() => RoleGroup {
replicas: Some(1),
config: build_common_config(
build_test_config(GROUP_CONFIG, GROUP_ENV, GROUP_CLI),
// should override
build_config_override(file_name, "file"),
build_env_override(GROUP_ENV_OVERRIDE),
None),
selector: None,
}},
};
let expected = collection! {
role_group.to_string() =>
collection!{
PropertyNameKind::File(file_name.to_string()) =>
collection!(
"file".to_string() => Some("file".to_string())
),
PropertyNameKind::Env =>
collection!(
"env".to_string() => Some(GROUP_ENV.to_string()),
GROUP_ENV_OVERRIDE.to_string() => Some(GROUP_ENV_OVERRIDE.to_string())
),
PropertyNameKind::Cli =>
collection!(
"cli".to_string() => Some(GROUP_CLI.to_string()),
),
}
};
let property_kinds = vec![
PropertyNameKind::File(file_name.to_string()),
PropertyNameKind::Env,
PropertyNameKind::Cli,
];
let config = transform_role_to_config(&String::new(), ROLE_GROUP, &role, &property_kinds);
assert_eq!(config, expected);
} | rust_cleaned_test_functions.jsonl/90570 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18449,
19792,
2346,
5332,
15431,
18245,
368,
341,
286,
1077,
3476,
6288,
284,
330,
5778,
6288,
876,
286,
1077,
1034,
1269,
284,
330,
7975,
22001,
876,
286,
1077,
3476,
284,
15404,
341,
310,
2193,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dot_lookups() {
let exp = parse_term("a.b");
assert_eq!(exp, term!(op!(Dot, term!(sym!("a")), term!("b"))));
} | rust_cleaned_test_functions.jsonl/12186 | {
"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,
30941,
24271,
8602,
368,
341,
286,
1077,
1343,
284,
4715,
17464,
445,
64,
948,
797,
286,
2060,
10714,
10297,
4580,
11,
4647,
10297,
453,
10297,
34207,
11,
4647,
10297,
23802,
17223,
64,
35674,
464... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_tx_ids() {
let pk = PublicKeyAccount([1u8; 32]);
let asset = Asset::new([2u8; 32]);
let lease = TransactionId::new([3u8; 32]);
let recipient = Address::from_string("3MzGEv9wnaqrYFYujAXSH5RQfHaVKNQvx3D");
let fee = 100000;
let ts: u64 = 1536000000000;
fn check_hash(tx: &Transaction, hash: &str) -> () {
assert_eq!(tx.id().0, hash.from_base58().unwrap().as_slice());
}
check_hash(
&Transaction::new_issue(
&pk, "coin", "coin", 100000000, 8, false, TESTNET, 100000, ts, None,
),
"GHqHz8xot1Yo7fivjPBYiqgtJNW3jR6bvpNh2WH66tEM",
);
check_hash(
&Transaction::new_transfer(
&pk,
&recipient,
Some(&asset),
10,
None,
fee,
Some("atta ch me"),
ts,
),
"E4Jc1vMh4TqryNzajU7onTHLLFkDmjNzo7aSedX4Rpad",
);
check_hash(
&Transaction::new_reissue(&pk, &asset, 100000000, false, TESTNET, fee, ts),
"83WaG6AAzxF3NFormpqrJr9Bi8eSdwyp3DEB67N7avvM",
);
check_hash(
&Transaction::new_burn(&pk, &asset, 100000000, TESTNET, fee, ts),
"CfsAEtEAwe4NFKjezeCssaUPevTX56rBsuMeMKRERd6Y",
);
check_hash(
&Transaction::new_lease(&pk, &recipient, 10, TESTNET, fee, ts),
"HHs5qfpDN88WTGszpfjVedhMPHeHynDtWPobm2rkpfH4",
);
check_hash(
&Transaction::new_lease_cancel(&pk, &lease, TESTNET, fee, ts),
"9BQLzTCHi9H9jqKeC5rvN7x9m8xfHQh1iApqmAPFTFEU",
);
let alias = Transaction::new_alias(&pk, "lilias", TESTNET, fee, ts);
check_hash(&alias, "GPyHWQSCT6znfZmjfZfsS6TXPV3zueVZKFUWG7duku1Z");
let transfers = vec![(&recipient, 10), (&recipient, 10)];
check_hash(
&Transaction::new_mass_transfer(
&pk,
Some(&asset),
transfers,
Some("mass trans"),
fee,
ts,
),
"HwWmpBbbYPShKsFAgVA3eH86LkrZgX1xYSoH5YarnwPE",
);
let arr = vec![4u8; 32];
let bin_entry = DataEntry::Binary("bin", &arr);
let data = vec![
&DataEntry::Integer("int", 1),
&DataEntry::Boolean("bool", true),
&bin_entry,
&DataEntry::String("str", "str"),
];
check_hash(
&Transaction::new_data(&pk, data, fee, ts),
"6fGLB7yxzkWPBb4fv32Fs7d5si6xifenj69Da9yHvwgx",
);
let script = vec![1, 6, 183, 111, 203, 71];
check_hash(
&Transaction::new_script(&pk, Some(script.as_slice()), TESTNET, fee, ts),
"HASXvcgoikizpWnCLd2cXNeCN5DxdKojCfcn8f7T3KjK",
);
check_hash(
&Transaction::new_script(&pk, None, TESTNET, fee, ts),
"1gwS1qkKKShwk5scB7M7N9t6L3eX2Hpkp9hF5RG8HJD",
);
check_hash(
&Transaction::new_sponsor(&pk, &asset, Some(100), fee, ts),
"9zmHx3fyXz7pW6bRazPP28PGjnM8XjoHuyjzXCMHE2PY",
);
check_hash(
&Transaction::new_set_asset_script(&pk, &asset, None, TESTNET, fee, ts),
"FiZJwFqVbYiYeRN1oADFuqCmKHQJpDJonD5a9ekqXFuY",
);
} | rust_cleaned_test_functions.jsonl/82843 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2072
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17805,
8077,
368,
341,
286,
1077,
22458,
284,
70280,
7365,
2561,
16,
84,
23,
26,
220,
18,
17,
2558,
286,
1077,
9329,
284,
22605,
486,
931,
2561,
17,
84,
23,
26,
220,
18,
17,
2558,
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_array_literal() {
let exp = statement_expression("[1, \"fo, o\", fn(x) { x }]");
let mut values = match exp {
Expression::ArrayLiteral { values, .. } => values,
other => panic!("Not an array: {:?}", other),
};
assert_eq!(3, values.len());
verify_int_literal(1, "1", &values.remove(0));
verify_string_literal("fo, o", &values.remove(0));
match values.remove(0) {
Expression::FunctionLiteral { .. } => {}
_ => panic!("Expected function literal"),
}
} | rust_cleaned_test_functions.jsonl/64072 | {
"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,
3858,
34100,
368,
341,
286,
1077,
1343,
284,
5114,
28068,
10937,
16,
11,
7245,
824,
11,
297,
16215,
5168,
2075,
8,
314,
856,
58592,
3071,
286,
1077,
5206,
2750,
284,
2432,
1343,
341,
310,
16378,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_add_lifetime_type() {
let input = quote! { JsonRef };
let x = parse2::<RpnFnRefEvaluableType>(input).unwrap();
let parsed_type = x.get_type_with_lifetime(quote! { 'arg_ });
let expected = quote! { JsonRef <'arg_> };
assert_eq!(expected.to_string(), parsed_type.to_string());
} | rust_cleaned_test_functions.jsonl/17096 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 155
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
98827,
1819,
368,
341,
286,
1077,
1946,
284,
12641,
0,
314,
8308,
3945,
2605,
286,
1077,
856,
284,
4715,
17,
27638,
49,
19958,
24911,
3945,
54469,
13128,
929,
2235,
1355,
568,
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_from_vec_duplicates() {
let v = vec![1, 2, 4, 6, 8, 10];
let v_t = vec![1, 4, 2, 4, 6, 8, 8, 10];
let span = Span::from_vec(v_t).unwrap();
for (target, test) in span.into_iter().zip(v) {
assert_eq!(target, test)
}
} | rust_cleaned_test_functions.jsonl/4977 | {
"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,
5673,
13251,
75051,
368,
341,
286,
1077,
348,
284,
7486,
20703,
16,
11,
220,
17,
11,
220,
19,
11,
220,
21,
11,
220,
23,
11,
220,
16,
15,
935,
286,
1077,
348,
528,
284,
7486,
20703,
16,
11,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_initialize_no_panic() {
let (bank, alice_keypair) = create_bank(1);
let bank_client = BankClient::new(bank);
let alice_pubkey = alice_keypair.pubkey();
let budget_keypair = Keypair::new();
let budget_pubkey = budget_keypair.pubkey();
let bob_pubkey = Pubkey::new_rand();
let mut instructions =
budget_instruction::payment(&alice_pubkey, &bob_pubkey, &budget_pubkey, 1);
instructions[1].accounts = vec![]; // <!-- Attack! Prevent accounts from being passed into processor.
let message = Message::new(instructions);
assert_eq!(
bank_client
.send_message(&[&alice_keypair, &budget_keypair], message)
.unwrap_err()
.unwrap(),
TransactionError::InstructionError(1, InstructionError::NotEnoughAccountKeys)
);
} | rust_cleaned_test_functions.jsonl/10111 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 405
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40889,
6536,
620,
31270,
368,
341,
286,
1077,
320,
17033,
11,
70433,
3097,
12670,
8,
284,
1855,
35733,
7,
16,
317,
286,
1077,
6073,
8179,
284,
8547,
2959,
486,
931,
1883,
1180,
626,
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_digit_instruction_1() {
init();
let input = "*".chars().collect::<Vec<_>>();
let result = (digit_instruction!(min_digit()) - end())
.parse(&input)
.to_result()
.unwrap();
assert_eq!(result, AnyValueExpr);
} | rust_cleaned_test_functions.jsonl/106884 | {
"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,
48403,
54923,
62,
16,
368,
341,
262,
2930,
543,
262,
1077,
1946,
284,
15630,
3263,
19255,
1005,
17384,
27638,
10050,
32399,
37038,
262,
1077,
1102,
284,
320,
34934,
54923,
10297,
1065,
48403,
2140,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bond() {
let mut stakes = new_stakes(&[(KEY2, 100)]);
assert_eq!(
Ok(()),
stakes.validate_bonding(&PublicKey::new(KEY1), U512::from(5))
);
stakes.bond(&PublicKey::new(KEY1), U512::from(5));
assert_eq!(new_stakes(&[(KEY1, 5), (KEY2, 100)]), stakes);
} | rust_cleaned_test_functions.jsonl/22339 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
2111,
368,
341,
286,
1077,
5206,
44425,
284,
501,
1261,
2050,
2099,
9697,
4784,
17,
11,
220,
16,
15,
15,
41958,
286,
2060,
10714,
33673,
310,
7622,
5065,
1326,
310,
44425,
19520,
880,
2111,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_known_addresses() {
let mut addrmgr =
AddressManager::new(Config::default(), fastrand::Rng::new(), HashMap::new(), ());
let time = LocalTime::now();
let source = Source::Dns;
let services = ServiceFlags::NETWORK;
addrmgr.initialize(time);
addrmgr.insert(
[
(
time.block_time(),
Address::new(&([33, 33, 33, 33], 8333).into(), services),
),
(
time.block_time(),
Address::new(&([44, 44, 44, 44], 8333).into(), services),
),
],
source,
);
let addr: &net::SocketAddr = &([33, 33, 33, 33], 8333).into();
let ka = addrmgr.peers.get(&addr.ip()).unwrap();
assert!(ka.last_success.is_none());
assert!(ka.last_attempt.is_none());
assert!(ka.last_active.is_some());
assert!(ka.last_sampled.is_none());
assert_eq!(
ka.last_active,
Some(LocalTime::from_block_time(time.block_time()))
);
addrmgr.peer_attempted(addr, LocalTime::now());
let ka = addrmgr.peers.get(&addr.ip()).unwrap();
assert!(ka.last_success.is_none());
assert!(ka.last_attempt.is_some());
assert!(ka.last_active.is_some());
assert!(ka.last_sampled.is_none());
addrmgr.peer_connected(addr, LocalTime::now());
let ka = addrmgr.peers.get(&addr.ip()).unwrap();
assert!(ka.last_success.is_none());
assert!(ka.last_attempt.is_some());
assert!(ka.last_active.is_some());
assert!(ka.last_sampled.is_none());
// Only when it is negotiated is it a "success".
addrmgr.peer_negotiated(addr, services, Link::Outbound, LocalTime::now());
let ka = addrmgr.peers.get(&addr.ip()).unwrap();
assert!(ka.last_success.is_some());
assert!(ka.last_attempt.is_some());
assert!(ka.last_active.is_some());
assert!(ka.last_sampled.is_none());
assert_eq!(ka.last_active, ka.last_success);
let (sampled, _) = addrmgr.sample(services).unwrap();
assert_eq!(
sampled.socket_addr().ok(),
Some(([44, 44, 44, 44], 8333).into())
);
let ka = addrmgr.peers.get(&[44, 44, 44, 44].into()).unwrap();
assert!(ka.last_success.is_none());
assert!(ka.last_attempt.is_none());
assert!(ka.last_active.is_some());
assert!(ka.last_sampled.is_some());
} | rust_cleaned_test_functions.jsonl/79207 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1314
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71690,
59471,
368,
341,
286,
1077,
5206,
912,
8719,
901,
4035,
310,
9177,
2043,
486,
931,
33687,
486,
2258,
1507,
2218,
85881,
486,
49,
968,
486,
931,
1507,
10528,
486,
931,
1507,
49323,
286,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_single_key() {
for mut test in new_test_suits().drain(..) {
test.add(b"abc", b"v");
test.do_test();
}
} | rust_cleaned_test_functions.jsonl/22548 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19487,
3097,
368,
341,
286,
369,
5206,
1273,
304,
501,
4452,
643,
11797,
1005,
3612,
466,
56422,
8,
341,
310,
1273,
1364,
1883,
1,
13683,
497,
293,
1,
85,
797,
310,
1273,
16521,
4452,
543,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
#[test]
fn test_micro_libra_conversion() {
assert!(ClientProxy::convert_to_scaled_representation("", 1_000_000, 1_000_000).is_err());
assert!(
ClientProxy::convert_to_scaled_representation("-11", 1_000_000, 1_000_000).is_err()
);
assert!(
ClientProxy::convert_to_scaled_representation("abc", 1_000_000, 1_000_000).is_err()
);
assert!(ClientProxy::convert_to_scaled_representation(
"11111112312321312321321321",
1_000_000,
1_000_000
)
.is_err());
assert!(ClientProxy::convert_to_scaled_representation("100000.0", 1, 1).is_err());
assert!(ClientProxy::convert_to_scaled_representation("0", 1_000_000, 1_000_000).is_ok());
assert!(ClientProxy::convert_to_scaled_representation("0", 1_000_000, 1_000_000).is_ok());
assert!(ClientProxy::convert_to_scaled_representation("1", 1_000_000, 1_000_000).is_ok());
assert!(ClientProxy::convert_to_scaled_representation("0.1", 1_000_000, 1_000_000).is_ok());
assert!(ClientProxy::convert_to_scaled_representation("1.1", 1_000_000, 1_000_000).is_ok());
assert!(ClientProxy::convert_to_scaled_representation(
"18446744073709.551615",
1_000_000,
1_000_000
)
.is_ok());
assert!(ClientProxy::convert_to_scaled_representation(
"184467440737095.51615",
1_000_000,
1_000_000
)
.is_err());
assert!(ClientProxy::convert_to_scaled_representation(
"18446744073709.551616",
1_000_000,
1_000_000
)
.is_err());
} | rust_cleaned_test_functions.jsonl/43121 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 890
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73003,
16142,
956,
64132,
368,
341,
286,
2060,
10297,
2959,
16219,
486,
14166,
2346,
61715,
94263,
19814,
220,
16,
62,
15,
15,
15,
62,
15,
15,
15,
11,
220,
16,
62,
15,
15,
15,
62,
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_node_named_child() {
let tree = parse_json_example();
let array_node = tree.root_node().child(0).unwrap();
let number_node = array_node.named_child(0).unwrap();
let false_node = array_node.named_child(1).unwrap();
let object_node = array_node.named_child(2).unwrap();
assert_eq!(number_node.kind(), "number");
assert_eq!(number_node.start_byte(), JSON_EXAMPLE.find("123").unwrap());
assert_eq!(
number_node.end_byte(),
JSON_EXAMPLE.find("123").unwrap() + 3
);
assert_eq!(number_node.start_position(), Point::new(3, 2));
assert_eq!(number_node.end_position(), Point::new(3, 5));
assert_eq!(false_node.kind(), "false");
assert_eq!(false_node.start_byte(), JSON_EXAMPLE.find("false").unwrap());
assert_eq!(
false_node.end_byte(),
JSON_EXAMPLE.find("false").unwrap() + 5
);
assert_eq!(false_node.start_position(), Point::new(4, 2));
assert_eq!(false_node.end_position(), Point::new(4, 7));
assert_eq!(object_node.kind(), "object");
assert_eq!(object_node.start_byte(), JSON_EXAMPLE.find("{").unwrap());
assert_eq!(object_node.start_position(), Point::new(5, 2));
assert_eq!(object_node.end_position(), Point::new(7, 3));
assert_eq!(object_node.named_child_count(), 1);
let pair_node = object_node.named_child(0).unwrap();
assert_eq!(pair_node.kind(), "pair");
assert_eq!(pair_node.start_byte(), JSON_EXAMPLE.find("\"x\"").unwrap());
assert_eq!(pair_node.end_byte(), JSON_EXAMPLE.find("null").unwrap() + 4);
assert_eq!(pair_node.start_position(), Point::new(6, 4));
assert_eq!(pair_node.end_position(), Point::new(6, 13));
let string_node = pair_node.named_child(0).unwrap();
let null_node = pair_node.named_child(1).unwrap();
assert_eq!(string_node.kind(), "string");
assert_eq!(null_node.kind(), "null");
assert_eq!(
string_node.start_byte(),
JSON_EXAMPLE.find("\"x\"").unwrap()
);
assert_eq!(
string_node.end_byte(),
JSON_EXAMPLE.find("\"x\"").unwrap() + 3
);
assert_eq!(string_node.start_position(), Point::new(6, 4));
assert_eq!(string_node.end_position(), Point::new(6, 7));
assert_eq!(null_node.start_byte(), JSON_EXAMPLE.find("null").unwrap());
assert_eq!(null_node.end_byte(), JSON_EXAMPLE.find("null").unwrap() + 4);
assert_eq!(null_node.start_position(), Point::new(6, 9));
assert_eq!(null_node.end_position(), Point::new(6, 13));
assert_eq!(string_node.parent().unwrap(), pair_node);
assert_eq!(null_node.parent().unwrap(), pair_node);
assert_eq!(pair_node.parent().unwrap(), object_node);
assert_eq!(number_node.parent().unwrap(), array_node);
assert_eq!(false_node.parent().unwrap(), array_node);
assert_eq!(object_node.parent().unwrap(), array_node);
assert_eq!(array_node.parent().unwrap(), tree.root_node());
assert_eq!(tree.root_node().parent(), None);
} | rust_cleaned_test_functions.jsonl/99266 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1226
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5084,
71834,
17268,
368,
341,
262,
1077,
4916,
284,
4715,
9455,
39304,
543,
262,
1077,
1334,
5084,
284,
4916,
12576,
5084,
1005,
3048,
7,
15,
568,
15454,
1428,
262,
1077,
1372,
5084,
284,
1334,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_process_prune() {
let mut contact_info_table = ContactInfoTable::default();
let mut push = NodeTbleGspPush::default();
let peer = ContInfTblValue::ContactInfo(ContactInfo::new_localhost(&BvmAddr::new_rand(), 0));
assert_eq!(contact_info_table.insert(peer.clone(), 0), Ok(None));
push.refresh_push_active_set(&contact_info_table, &HashMap::new(), &BvmAddr::default(), 1, 1);
let new_msg = ContInfTblValue::ContactInfo(ContactInfo::new_localhost(&BvmAddr::new_rand(), 0));
assert_eq!(
push.process_push_message(&mut contact_info_table, new_msg.clone(), 0),
Ok(None)
);
push.process_prune_msg(&peer.label().address(), &[new_msg.label().address()]);
assert_eq!(
push.new_push_messages(&contact_info_table, 0),
(vec![peer.label().address()], vec![])
);
} | rust_cleaned_test_functions.jsonl/120876 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 405
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
5294,
2886,
368,
341,
286,
1077,
5206,
3645,
3109,
5237,
284,
9180,
1731,
2556,
486,
2258,
543,
286,
1077,
5206,
4484,
284,
6018,
51,
891,
38,
2154,
16644,
486,
2258,
543,
286,
1077,
1439... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_check_is_mmapped_for_unmapped() {
serial_test(|| {
with_cleanup(
|| {
// We expect this call to panic
panic_if_unmapped(START, BYTES_IN_PAGE);
},
|| {
assert!(munmap(START, BYTES_IN_PAGE).is_ok());
},
)
})
} | rust_cleaned_test_functions.jsonl/107213 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 265
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
6892,
35599,
5677,
5478,
4907,
65371,
368,
341,
286,
6146,
4452,
79453,
341,
310,
448,
42444,
1006,
394,
1369,
341,
503,
442,
1205,
1720,
419,
1618,
311,
21975,
198,
503,
21975,
11119,
4907,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_global_id_hashes_unique() {
let location = TempLocation::new();
request_stream_test(
location.to_persistent_lifetime(),
create_clean_pre_auth_manager(),
None,
Arc::new(Inspector::new()),
|proxy| {
async move {
proxy.create_account(None).await??;
// Different given different salts
let mut salt_1 = [0u8; 32];
let hash_1 = proxy.get_global_id_hash(&mut salt_1).await??;
let mut salt_2 = [37u8; 32];
let hash_2 = proxy.get_global_id_hash(&mut salt_2).await??;
assert_ne!(hash_1[..], hash_2[..]);
Ok(())
}
},
);
} | rust_cleaned_test_functions.jsonl/105842 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 485
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19296,
842,
91616,
21218,
368,
341,
286,
1077,
3728,
284,
19944,
4707,
486,
931,
543,
286,
1681,
12673,
4452,
1006,
310,
3728,
2389,
620,
13931,
98827,
3148,
310,
1855,
19573,
10442,
14014,
12144,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
#[test]
fn test_disconnected_ban_consistency() {
let mut pdb = get_db();
let random_peer = PeerId::random();
let random_peer1 = PeerId::random();
let random_peer2 = PeerId::random();
let random_peer3 = PeerId::random();
pdb.connect_ingoing(&random_peer, "/ip4/0.0.0.0".parse().unwrap());
pdb.connect_ingoing(&random_peer1, "/ip4/0.0.0.0".parse().unwrap());
pdb.connect_ingoing(&random_peer2, "/ip4/0.0.0.0".parse().unwrap());
pdb.connect_ingoing(&random_peer3, "/ip4/0.0.0.0".parse().unwrap());
assert_eq!(pdb.disconnected_peers, pdb.disconnected_peers().count());
assert_eq!(
pdb.banned_peers_count.banned_peers(),
pdb.banned_peers().count()
);
pdb.connect_ingoing(&random_peer, "/ip4/0.0.0.0".parse().unwrap());
pdb.disconnect(&random_peer1);
pdb.ban(&random_peer2);
pdb.connect_ingoing(&random_peer3, "/ip4/0.0.0.0".parse().unwrap());
assert_eq!(pdb.disconnected_peers, pdb.disconnected_peers().count());
assert_eq!(
pdb.banned_peers_count.banned_peers(),
pdb.banned_peers().count()
);
pdb.ban(&random_peer1);
assert_eq!(pdb.disconnected_peers, pdb.disconnected_peers().count());
assert_eq!(
pdb.banned_peers_count.banned_peers(),
pdb.banned_peers().count()
);
pdb.connect_outgoing(&random_peer2, "/ip4/0.0.0.0".parse().unwrap());
assert_eq!(pdb.disconnected_peers, pdb.disconnected_peers().count());
assert_eq!(
pdb.banned_peers_count.banned_peers(),
pdb.banned_peers().count()
);
pdb.ban(&random_peer3);
assert_eq!(pdb.disconnected_peers, pdb.disconnected_peers().count());
assert_eq!(
pdb.banned_peers_count.banned_peers(),
pdb.banned_peers().count()
);
pdb.ban(&random_peer3);
pdb.connect_ingoing(&random_peer1, "/ip4/0.0.0.0".parse().unwrap());
pdb.disconnect(&random_peer2);
pdb.ban(&random_peer3);
pdb.connect_ingoing(&random_peer, "/ip4/0.0.0.0".parse().unwrap());
assert_eq!(pdb.disconnected_peers, pdb.disconnected_peers().count());
assert_eq!(
pdb.banned_peers_count.banned_peers(),
pdb.banned_peers().count()
);
pdb.disconnect(&random_peer);
assert_eq!(pdb.disconnected_peers, pdb.disconnected_peers().count());
assert_eq!(
pdb.banned_peers_count.banned_peers(),
pdb.banned_peers().count()
);
pdb.disconnect(&random_peer);
assert_eq!(pdb.disconnected_peers, pdb.disconnected_peers().count());
assert_eq!(
pdb.banned_peers_count.banned_peers(),
pdb.banned_peers().count()
);
pdb.ban(&random_peer);
assert_eq!(pdb.disconnected_peers, pdb.disconnected_peers().count());
} | rust_cleaned_test_functions.jsonl/126545 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1530
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9932,
15288,
880,
276,
31971,
47094,
368,
341,
286,
1077,
5206,
47984,
284,
633,
8685,
1428,
286,
1077,
4194,
45159,
284,
45147,
764,
486,
11463,
543,
286,
1077,
4194,
45159,
16,
284,
45147,
764,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_window_post_single_partition_smaller_2kib_base_8() -> Result<()> {
let sector_size = SECTOR_SIZE_2_KIB;
let sector_count = *WINDOW_POST_SECTOR_COUNT
.read()
.unwrap()
.get(§or_size)
.unwrap();
window_post::<SectorShape2KiB>(sector_size, sector_count / 2, sector_count)
} | rust_cleaned_test_functions.jsonl/6767 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 164
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12571,
6333,
19487,
43840,
15874,
13956,
62,
17,
74,
579,
7651,
62,
23,
368,
1464,
5714,
71698,
341,
262,
1077,
10486,
2368,
284,
5052,
26275,
4098,
62,
17,
10102,
3256,
280,
262,
1077,
10486,
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_to_integer_float() {
let val: ScalarCow<'_> = 42f64.into();
assert_eq!(val.to_integer(), None);
let val: ScalarCow<'_> = 42.34.into();
assert_eq!(val.to_integer(), None);
} | rust_cleaned_test_functions.jsonl/108129 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
31725,
17586,
368,
341,
286,
1077,
1044,
25,
35176,
89915,
18291,
98377,
284,
220,
19,
17,
69,
21,
19,
39860,
543,
286,
2060,
10714,
10297,
831,
2389,
31725,
1507,
2240,
626,
286,
1077,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_convert_uint_into_int() {
assert!(convert_uint_to_int(u64::MAX, i64::MAX, types::LONG_LONG).is_err());
let v = convert_uint_to_int(u64::MIN, i64::MAX, types::LONG_LONG).unwrap();
assert_eq!(v, u64::MIN as i64);
} | rust_cleaned_test_functions.jsonl/78152 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
15807,
45514,
4042,
368,
341,
286,
2060,
10297,
14166,
15807,
2346,
4042,
8154,
21,
19,
486,
10586,
11,
600,
21,
19,
486,
10586,
11,
4494,
486,
51306,
19903,
568,
285,
9266,
1423,
286,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_choose_tenpai() {
assert_bot(
&[
M2, M3, M5, M6, M7, M7, M8, M9, M9, P1, P3, P5, P6, P6, P7, P8, S1, S2, S2, S3, S4,
S6, S7, S7, S8, X1, X2, X2, X4, X4, X4, X5, X6, X7,
],
X4,
X3,
);
assert_bot(
&[
M2, M3, M4, M4, M5, M8, P1, P2, P2, P3, P5, P6, P7, P7, P7, P8, P8, P9, P9, S1, S2,
S3, S4, S5, S6, S8, S9, S9, X1, X2, X2, X5, X5, X5,
],
X4,
X1,
);
assert_bot(
&[
M2, M3, M3, M4, M5, M6, M6, M7, M8, M9, M9, P1, P2, P2, P5, P6, P9, S3, S5, S7, S7,
S8, S8, S9, X3, X3, X4, X5, X5, X6, X7, X7, X7,
],
M3,
X3,
);
} | rust_cleaned_test_functions.jsonl/77928 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 659
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77433,
75827,
84959,
368,
341,
286,
2060,
38883,
1006,
310,
609,
9640,
394,
386,
17,
11,
386,
18,
11,
386,
20,
11,
386,
21,
11,
386,
22,
11,
386,
22,
11,
386,
23,
11,
386,
24,
11,
386,
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_insert_self() {
let d = ContactInfo::new_localhost(&Pubkey::new_rand(), timestamp());
let mut cluster_info = ClusterInfo::new_with_invalid_keypair(d.clone());
let entry_label = CrdsValueLabel::ContactInfo(cluster_info.id());
assert!(cluster_info.gossip.crds.lookup(&entry_label).is_some());
// inserting something else shouldn't work
let d = ContactInfo::new_localhost(&Pubkey::new_rand(), timestamp());
cluster_info.insert_self(d.clone());
let label = CrdsValueLabel::ContactInfo(d.id);
assert!(cluster_info.gossip.crds.lookup(&label).is_none());
} | rust_cleaned_test_functions.jsonl/12811 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 261
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
25637,
368,
341,
286,
1077,
294,
284,
9180,
1731,
486,
931,
62,
8301,
2099,
29162,
792,
486,
931,
33864,
1507,
11441,
1423,
286,
1077,
5206,
10652,
3109,
284,
35380,
1731,
486,
931,
6615,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_channel_send_sync() {
fn is_send<T: Send>(_: &T) {}
fn is_sync<T: Sync>(_: &T) {}
let c = Channel::get_private(BusType::Session).unwrap();
is_send(&c);
is_sync(&c);
} | rust_cleaned_test_functions.jsonl/70375 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14571,
13565,
23008,
368,
341,
262,
5168,
374,
13565,
3125,
25,
11000,
2235,
23211,
609,
51,
8,
5613,
262,
5168,
374,
23008,
3125,
25,
28937,
2235,
23211,
609,
51,
8,
5613,
262,
1077,
272,
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_actor_returns_stop() {
init_test_log();
let system = ActorSystem::create(ActorSystemConfig::default().thread_pool_size(2));
let tracker = AssertCollect::new();
let t = tracker.clone();
let aid = system
.spawn()
.with(
t,
|t: AssertCollect, _: Context, message: Message| async move {
if let Some(_msg) = message.content_as::<i32>() {
Ok(Status::stop(t))
} else if let Some(msg) = message.content_as::<SystemMsg>() {
match &*msg {
SystemMsg::Start => Ok(Status::done(t)),
m => t.panic(format!("unexpected message: {:?}", m)),
}
} else {
t.panic("Unknown Message received")
}
},
)
.unwrap();
// Send a message to the actor.
assert_eq!(true, system.is_actor_alive(&aid));
aid.send_new(11 as i32).unwrap();
await_received(&aid, 2, 1000).unwrap(); // Remember they always get `Start` as well!
let max = Duration::from_millis(200);
let start = Instant::now();
loop {
if !system.is_actor_alive(&aid) {
break;
} else if max < Instant::elapsed(&start) {
panic!("Timed out waiting for actor to stop!");
}
sleep(1);
}
system.trigger_and_await_shutdown(None);
tracker.collect();
} | rust_cleaned_test_functions.jsonl/51706 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 884
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54818,
58900,
19039,
368,
341,
286,
2930,
4452,
5224,
543,
286,
1077,
1849,
284,
24718,
2320,
486,
3182,
7,
18870,
2320,
2648,
486,
2258,
1005,
4528,
15709,
2368,
7,
17,
1106,
286,
1077,
28331,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_no_equal_object() {
let data = [
0xf1, 0x36, 0x03, 0x00, 0xe1, 0x00, 0x01, 0x00, 0xbe, 0x28, 0x04, 0x00,
];
assert_eq!(
parse(&data[..]).unwrap().token_tape,
vec![
BinaryToken::Token(0x36f1),
BinaryToken::Object(4),
BinaryToken::Token(0x00e1),
BinaryToken::Token(0x28be),
BinaryToken::End(1),
]
);
} | rust_cleaned_test_functions.jsonl/109417 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 309
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
11478,
5314,
368,
341,
286,
1077,
821,
284,
2278,
310,
220,
15,
5848,
16,
11,
220,
15,
87,
18,
21,
11,
220,
15,
87,
15,
18,
11,
220,
15,
87,
15,
15,
11,
220,
15,
8371,
16,
11,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_type_expression_int() {
let mut p = Parser::new(r#"int"#);
let parsed = p.parse_type_expression();
let loc = Locator::new(&p.source[..]);
assert_eq!(
parsed,
TypeExpression {
base: BaseNode {
location: loc.get(1, 1, 1, 4),
..BaseNode::default()
},
monotype: MonoType::Basic(NamedType {
base: BaseNode {
location: loc.get(1, 1, 1, 4),
..BaseNode::default()
},
name: Identifier {
base: BaseNode {
location: loc.get(1, 1, 1, 4),
..BaseNode::default()
},
name: "int".to_string(),
}
}),
constraints: vec![],
},
)
} | rust_cleaned_test_functions.jsonl/67815 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 540
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
1819,
28068,
4042,
368,
341,
262,
1077,
5206,
281,
284,
21102,
486,
931,
2601,
55543,
396,
57676,
317,
262,
1077,
15676,
284,
281,
4632,
1819,
28068,
543,
262,
1077,
1329,
284,
98653,
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_process_create_ok() {
solana_logger::setup();
let (bank, mint_keypair) = create_bank(10_000);
let (bank_client, config_keypair) = create_config_account(bank, &mint_keypair);
let config_account_data = bank_client
.get_account_data(&config_keypair.pubkey())
.unwrap()
.unwrap();
assert_eq!(
MyConfig::default(),
MyConfig::deserialize(&config_account_data).unwrap()
);
} | rust_cleaned_test_functions.jsonl/23613 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 246
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
8657,
19817,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
320,
17033,
11,
28337,
3097,
12670,
8,
284,
1855,
35733,
7,
16,
15,
62,
15,
15,
15,
317,
286,
1077,
320,
17033... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_prf_know_plaintext_serde() {
let mut rng = rand::thread_rng();
let x = Scalar::random(&mut rng);
let pk = PublicKey::new(GENERATOR.scaled(&x));
let m = CurveElem::random(&mut rng);
let r = Scalar::random(&mut rng);
let enc = pk.encrypt(&m, &r);
let proof = PrfKnowPlaintext::new(&mut rng, enc, r);
let ser = proof.to_string();
let de = PrfKnowPlaintext::try_from(ser.as_str()).unwrap();
assert_eq!(proof, de);
} | rust_cleaned_test_functions.jsonl/84418 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 254
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5294,
69,
4698,
3328,
6317,
1641,
427,
75861,
450,
368,
341,
286,
1077,
5206,
28422,
284,
10382,
486,
4528,
66849,
1428,
286,
1077,
856,
284,
35176,
486,
11463,
2099,
6984,
28422,
317,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_it_works_unit() {
/// The returned data is the sum of the length of all accepted bytes datums.
#[derive(Debug, AggrFunction)]
#[aggr_function(state = AggrFnFooState::new())]
struct AggrFnFoo;
#[derive(Debug)]
struct AggrFnFooState {
len: usize,
}
impl AggrFnFooState {
pub fn new() -> Self {
Self { len: 0 }
}
}
impl ConcreteAggrFunctionState for AggrFnFooState {
type ParameterType = Bytes;
fn update_concrete(
&mut self,
_ctx: &mut EvalContext,
value: &Option<Self::ParameterType>,
) -> Result<()> {
if let Some(value) = value {
self.len += value.len();
}
Ok(())
}
fn push_result(
&self,
_ctx: &mut EvalContext,
target: &mut [VectorValue],
) -> Result<()> {
target[0].push_int(Some(self.len as i64));
Ok(())
}
}
/// `Foo` returns a Int datum.
fn push_foo_output_schema(output: &mut Vec<FieldType>) {
output.push(FieldTypeTp::LongLong.into());
}
#[derive(Debug, AggrFunction)]
#[aggr_function(state = AggrFnBarState::new())]
struct AggrFnBar;
#[derive(Debug)]
struct AggrFnBarState {
rows_with_null: usize,
rows_without_null: usize,
sum: Real,
}
impl AggrFnBarState {
pub fn new() -> Self {
Self {
rows_with_null: 0,
rows_without_null: 0,
sum: Real::from(0.0),
}
}
}
impl ConcreteAggrFunctionState for AggrFnBarState {
type ParameterType = Real;
fn update_concrete(
&mut self,
_ctx: &mut EvalContext,
value: &Option<Self::ParameterType>,
) -> Result<()> {
self.rows_with_null += 1;
if let Some(value) = value {
self.rows_without_null += 1;
self.sum += *value;
}
Ok(())
}
fn push_result(
&self,
_ctx: &mut EvalContext,
target: &mut [VectorValue],
) -> Result<()> {
target[0].push_int(Some(self.rows_with_null as i64));
target[1].push_int(Some(self.rows_without_null as i64));
target[2].push_real(Some(self.sum));
Ok(())
}
}
fn push_bar_output_schema(output: &mut Vec<FieldType>) {
output.push(FieldTypeTp::LongLong.into());
output.push(FieldTypeTp::Long.into());
output.push(FieldTypeTp::Double.into());
}
// This test creates a simple aggregation executor with the following aggregate functions:
let src_exec = make_src_executor_1();
// involved.
let aggr_definitions: Vec<_> = (0..6)
.map(|index| {
let mut exp = Expr::default();
exp.mut_val().push(index as u8);
exp
})
.collect();
struct MyParser;
impl AggrDefinitionParser for MyParser {
fn check_supported(&self, _aggr_def: &Expr) -> Result<()> {
unreachable!()
}
fn parse(
&self,
aggr_def: Expr,
_time_zone: &Tz,
_src_schema: &[FieldType],
out_schema: &mut Vec<FieldType>,
out_exp: &mut Vec<RpnExpression>,
) -> Result<Box<dyn AggrFunction>> {
match aggr_def.get_val()[0] {
0 => {
push_foo_output_schema(out_schema);
out_exp.push(
RpnExpressionBuilder::new()
.push_constant(b"abc".to_vec())
.build(),
);
Ok(Box::new(AggrFnFoo))
}
1 => {
push_foo_output_schema(out_schema);
out_exp.push(
RpnExpressionBuilder::new()
.push_constant(ScalarValue::Bytes(None))
.build(),
);
Ok(Box::new(AggrFnFoo))
}
2 => {
push_bar_output_schema(out_schema);
out_exp.push(RpnExpressionBuilder::new().push_constant(42.5f64).build());
Ok(Box::new(AggrFnBar))
}
3 => {
push_bar_output_schema(out_schema);
out_exp.push(
RpnExpressionBuilder::new()
.push_constant(ScalarValue::Real(None))
.build(),
);
Ok(Box::new(AggrFnBar))
}
4 => {
push_foo_output_schema(out_schema);
out_exp.push(RpnExpressionBuilder::new().push_column_ref(2).build());
Ok(Box::new(AggrFnFoo))
}
5 => {
push_bar_output_schema(out_schema);
out_exp.push(RpnExpressionBuilder::new().push_column_ref(1).build());
Ok(Box::new(AggrFnBar))
}
_ => unreachable!(),
}
}
}
let mut exec =
BatchSimpleAggregationExecutor::new_for_test(src_exec, aggr_definitions, MyParser);
let r = exec.next_batch(1);
assert!(r.logical_rows.is_empty());
assert!(!r.is_drained.unwrap());
let r = exec.next_batch(1);
assert!(r.logical_rows.is_empty());
assert!(!r.is_drained.unwrap());
let r = exec.next_batch(1);
assert_eq!(&r.logical_rows, &[0]);
assert_eq!(r.physical_columns.rows_len(), 1);
assert_eq!(r.physical_columns.columns_len(), 12);
assert_eq!(r.physical_columns[0].decoded().as_int_slice(), &[Some(15)]);
assert_eq!(r.physical_columns[1].decoded().as_int_slice(), &[Some(0)]);
assert_eq!(r.physical_columns[2].decoded().as_int_slice(), &[Some(5)]);
assert_eq!(r.physical_columns[3].decoded().as_int_slice(), &[Some(5)]);
assert_eq!(
r.physical_columns[4].decoded().as_real_slice(),
&[Real::new(212.5).ok()]
);
assert_eq!(r.physical_columns[5].decoded().as_int_slice(), &[Some(5)]);
assert_eq!(r.physical_columns[6].decoded().as_int_slice(), &[Some(0)]);
assert_eq!(
r.physical_columns[7].decoded().as_real_slice(),
&[Real::new(0.0).ok()]
);
assert_eq!(r.physical_columns[8].decoded().as_int_slice(), &[Some(18)]);
assert_eq!(r.physical_columns[9].decoded().as_int_slice(), &[Some(5)]);
assert_eq!(r.physical_columns[10].decoded().as_int_slice(), &[Some(4)]);
assert_eq!(
r.physical_columns[11].decoded().as_real_slice(),
&[Real::new(12.0).ok()]
);
assert!(r.is_drained.unwrap());
} | rust_cleaned_test_functions.jsonl/7861 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 4926
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14631,
11498,
82,
14832,
368,
341,
664,
1048,
576,
5927,
821,
374,
279,
2629,
315,
279,
3084,
315,
678,
11666,
5820,
3258,
6237,
624,
286,
11506,
27098,
42618,
11,
4598,
901,
5152,
5563,
286,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.