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_restore() {
let l = default_logger();
// magic number
let s = new_snapshot(11, 11, vec![1, 2, 3]);
let mut sm = new_test_raft(1, vec![1, 2], 10, 1, new_storage(), &l);
assert!(sm.restore(s.clone()));
assert_eq!(sm.raft_log.last_index(), s.get_metadata().index);
assert_eq!(
sm.raft_log.term(s.get_metadata().index).unwrap(),
s.get_metadata().term
);
assert_iter_eq!(
o sm.prs().conf().voters().ids(),
s.get_metadata()
.get_conf_state()
.voters
);
assert!(!sm.restore(s));
} | rust_cleaned_test_functions.jsonl/19139 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 298
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62677,
368,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
442,
10963,
1372,
198,
262,
1077,
274,
284,
501,
53265,
7,
16,
16,
11,
220,
16,
16,
11,
7486,
20703,
16,
11,
220,
17,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_empty() {
let input = ParseBlock::from(&[][..]);
let expected = PloopBlock::from(&[][..]);
let actual = PloopBlock::from(&input);
assert_eq!(expected, actual);
} | rust_cleaned_test_functions.jsonl/119134 | {
"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,
15124,
368,
341,
286,
1077,
1946,
284,
14775,
4713,
486,
1499,
2099,
63449,
496,
2558,
286,
1077,
3601,
284,
393,
10498,
4713,
486,
1499,
2099,
63449,
496,
2558,
286,
1077,
5042,
284,
393,
10498,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_dec() {
let source = "-";
let instructions = Parser::parse_instructions(&Parser::parse_string(source));
assert_eq!(instructions, vec![Instruction::DEC(1)]);
} | rust_cleaned_test_functions.jsonl/56683 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 78
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
13783,
368,
341,
262,
1077,
2530,
284,
88120,
262,
1077,
11221,
284,
21102,
486,
6400,
82427,
2099,
6570,
486,
6400,
3904,
12437,
1106,
262,
2060,
10714,
10297,
62295,
11,
7486,
20703,
16664,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_sort() {
let mut rng = thread_rng();
for len in (2..25).chain(500..510) {
for &modulus in &[5, 10, 100, 1000] {
for _ in 0..10 {
let orig: Vec<_> = rng.sample_iter::<i32, _>(&Standard)
.map(|x| x % modulus)
.take(len)
.collect();
// Sort in default order.
let mut v = orig.clone();
v.sort();
assert!(v.windows(2).all(|w| w[0] <= w[1]));
// Sort in ascending order.
let mut v = orig.clone();
v.sort_by(|a, b| a.cmp(b));
assert!(v.windows(2).all(|w| w[0] <= w[1]));
// Sort in descending order.
let mut v = orig.clone();
v.sort_by(|a, b| b.cmp(a));
assert!(v.windows(2).all(|w| w[0] >= w[1]));
// Sort in lexicographic order.
let mut v1 = orig.clone();
let mut v2 = orig.clone();
v1.sort_by_key(|x| x.to_string());
v2.sort_by_cached_key(|x| x.to_string());
assert!(v1.windows(2).all(|w| w[0].to_string() <= w[1].to_string()));
assert!(v1 == v2);
// Sort with many pre-sorted runs.
let mut v = orig.clone();
v.sort();
v.reverse();
for _ in 0..5 {
let a = rng.gen::<usize>() % len;
let b = rng.gen::<usize>() % len;
if a < b {
v[a..b].reverse();
} else {
v.swap(a, b);
}
}
v.sort();
assert!(v.windows(2).all(|w| w[0] <= w[1]));
}
}
}
// Sort using a completely random comparison function.
let mut v = [0; 500];
for i in 0..v.len() {
v[i] = i as i32;
}
v.sort_by(|_, _| *[Less, Equal, Greater].choose(&mut rng).unwrap());
v.sort();
for i in 0..v.len() {
assert_eq!(v[i], i as i32);
}
// Should not panic.
[0i32; 0].sort();
[(); 10].sort();
[(); 100].sort();
let mut v = [0xDEADBEEFu64];
v.sort();
assert!(v == [0xDEADBEEF]);
} | rust_cleaned_test_functions.jsonl/12868 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1435
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18435,
368,
341,
262,
1077,
5206,
28422,
284,
4516,
66849,
1428,
262,
369,
2422,
304,
320,
17,
496,
17,
20,
568,
8819,
7,
20,
15,
15,
496,
20,
16,
15,
8,
341,
286,
369,
609,
2593,
19425,
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... | 8 |
#[test]
fn test_quorum() {
assert_eq!(equal_configuration(1).quorum_threshold(), 1);
assert_eq!(equal_configuration(2).quorum_threshold(), 2);
assert_eq!(equal_configuration(3).quorum_threshold(), 3);
assert_eq!(equal_configuration(4).quorum_threshold(), 3);
assert_eq!(equal_configuration(5).quorum_threshold(), 4);
assert_eq!(equal_configuration(6).quorum_threshold(), 5);
} | rust_cleaned_test_functions.jsonl/115168 | {
"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,
11280,
33006,
368,
341,
262,
2060,
10714,
10297,
25795,
35726,
7,
16,
568,
446,
33006,
21858,
1507,
220,
16,
317,
262,
2060,
10714,
10297,
25795,
35726,
7,
17,
568,
446,
33006,
21858,
1507,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_i8_bigendian() {
let mut storage = vec![0; 1024];
type Field1 = PrimitiveField<i8, BigEndian, 5>;
type Field2 = PrimitiveField<i8, BigEndian, 20>;
Field1::write(&mut storage, 50);
Field2::write(&mut storage, -20);
assert_eq!(50, Field1::read(&storage));
assert_eq!(-20, Field2::read(&storage));
assert_eq!(50, i8::from_be_bytes((&storage[5..6]).try_into().unwrap()));
assert_eq!(
-20,
i8::from_be_bytes((&storage[20..21]).try_into().unwrap())
);
assert_eq!(Some(1), PrimitiveField::<i8, BigEndian, 5>::SIZE);
assert_eq!(Some(1), PrimitiveField::<i8, BigEndian, 5>::SIZE);
} | rust_cleaned_test_functions.jsonl/35718 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 358
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5318,
23,
36386,
408,
1103,
368,
341,
286,
1077,
5206,
5819,
284,
7486,
20703,
15,
26,
220,
16,
15,
17,
19,
4821,
286,
943,
8601,
16,
284,
51460,
1877,
21897,
23,
11,
6164,
43231,
11,
220,
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_multiline_comment() {
let text = r#"
<!--
multiline
comment
-->
"#;
let result = remove_comments(text);
assert!(result.trim().is_empty());
} | rust_cleaned_test_functions.jsonl/121691 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26290,
26560,
17638,
368,
341,
286,
1077,
1467,
284,
435,
2,
698,
89650,
92760,
198,
6182,
198,
9992,
286,
5869,
280,
286,
1077,
1102,
284,
4057,
30359,
7235,
317,
286,
2060,
10297,
1382,
16419,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_supported_types() {
let input = "true,1,2,3,4,-1,-2,-3,-4,1.0,-1.0,foobar";
let output: Test2 = from_str(input, TEST2_PATTERN).unwrap();
assert_eq!(output, Test2 {
f_bool: true,
f_u8: 1,
f_u16: 2,
f_u32: 3,
f_u64: 4,
f_i8: -1,
f_i16: -2,
f_i32: -3,
f_i64: -4,
f_f32: 1.0,
f_f64: -1.0,
f_str: "foobar".to_owned(),
});
} | rust_cleaned_test_functions.jsonl/133419 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 363
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57885,
9763,
368,
341,
286,
1077,
1946,
284,
330,
1866,
11,
16,
11,
17,
11,
18,
11,
19,
4999,
16,
4999,
17,
4999,
18,
4999,
19,
11,
16,
13,
15,
4999,
16,
13,
15,
11,
50267,
876,
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_peer_start_stream_success() {
let mut exec = fasync::Executor::new().expect("executor should build");
let (proxy, mut prof_stream) =
create_proxy_and_stream::<ProfileMarker>().expect("Profile proxy should be created");
let (cobalt_sender, _) = fake_cobalt_sender();
let id = PeerId(1);
let (avdtp, remote) = setup_avdtp_peer();
let inspect = inspect::Inspector::new();
let inspect = inspect.root().create_child(format!("peer {}", id));
let streams = create_streams();
let peer = Peer::create(id, avdtp, streams, proxy, inspect, cobalt_sender);
// This needs to match the local SBC_SEID
let local_seid = SBC_SEID.try_into().unwrap();
let remote_seid = 2_u8.try_into().unwrap();
let codec_params = ServiceCapability::MediaCodec {
media_type: avdtp::MediaType::Audio,
codec_type: avdtp::MediaCodecType::AUDIO_SBC,
codec_extra: vec![0x29, 0xF5, 2, 250],
};
let start_future = peer.start_stream(local_seid, remote_seid, codec_params);
pin_mut!(start_future);
assert!(exec.run_until_stalled(&mut start_future).is_pending());
receive_simple_accept(&remote, 0x03); // Set Configuration
assert!(exec.run_until_stalled(&mut start_future).is_pending());
receive_simple_accept(&remote, 0x06); // Open
match exec.run_until_stalled(&mut start_future) {
Poll::Pending => {}
Poll::Ready(Err(e)) => panic!("Expected to be pending but error: {:?}", e),
Poll::Ready(Ok(_)) => panic!("Expected to be pending but finished!"),
};
// Should connect the media socket after open.
let (_, transport) =
zx::Socket::create(zx::SocketOpts::DATAGRAM).expect("socket creation fail");
let request = exec.run_until_stalled(&mut prof_stream.next());
match request {
Poll::Ready(Some(Ok(ProfileRequest::ConnectL2cap { peer_id, responder, .. }))) => {
assert_eq!(PeerId(1), peer_id.parse().expect("peer_id parses"));
responder
.send(
&mut Status { error: None },
Channel { socket: Some(transport), ..Channel::new_empty() },
)
.expect("responder sends");
}
x => panic!("Should have sent a open l2cap request, but got {:?}", x),
};
match exec.run_until_stalled(&mut start_future) {
Poll::Pending => {}
Poll::Ready(Err(e)) => panic!("Expected to be pending but error: {:?}", e),
Poll::Ready(Ok(_)) => panic!("Expected to be pending but finished!"),
};
receive_simple_accept(&remote, 0x07); // Start
let res = exec.run_until_stalled(&mut start_future);
match res {
Poll::Pending => panic!("Should be ready after start succeeds"),
Poll::Ready(Err(e)) => panic!("Shouldn't be an error but returned {:?}", e),
// TODO: confirm the stream is usable
Poll::Ready(Ok(_stream)) => {}
}
} | rust_cleaned_test_functions.jsonl/125260 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1544
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45159,
4906,
12673,
18632,
368,
341,
286,
1077,
5206,
3883,
284,
282,
7692,
486,
25255,
486,
931,
1005,
17119,
445,
80787,
1265,
1936,
797,
286,
1077,
320,
22803,
11,
5206,
2778,
12673,
8,
4035,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_decode_aperiodicity() {
let fs = 44100_i32;
let f0_length = 2_i32;
let fft_size = 2048_i32;
let mut aperiodicity = vec![vec![0.0; (fft_size/2+1) as usize]; f0_length as usize];
let mut aperiodicity_ptr = aperiodicity.iter_mut().map(|inner| inner.as_mut_ptr()).collect::<Vec<_>>();
let aperiodicity_ptr = aperiodicity_ptr.as_mut_ptr();
let n_aperiodicity;
unsafe {
n_aperiodicity = GetNumberOfAperiodicities(fs);
}
let coded_aperiodicity = vec![vec![-0.0000000000086856974912498; n_aperiodicity as usize]; f0_length as usize];
let coded_aperiodicity_ptr = coded_aperiodicity.iter().map(|inner| inner.as_ptr()).collect::<Vec<_>>();
let coded_aperiodicity_ptr = coded_aperiodicity_ptr.as_ptr();
unsafe {
DecodeAperiodicity(coded_aperiodicity_ptr, f0_length, fs, fft_size, aperiodicity_ptr);
}
assert_eq!(aperiodicity.len(), f0_length as usize);
assert_eq!(aperiodicity[0].len(), (fft_size/2+1) as usize);
assert_eq!(aperiodicity[0][0], 0.999999999999);
} | rust_cleaned_test_functions.jsonl/20838 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 532
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
62,
3191,
3127,
61691,
368,
341,
10217,
8619,
5108,
284,
220,
19,
19,
16,
15,
15,
5318,
18,
17,
280,
10217,
282,
15,
5118,
1698,
284,
220,
17,
5318,
18,
17,
280,
10217,
43700,
2368,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_loaded_model() {
// load the model
let modelfile = "tests/data/heart_scale.model";
let model = load_model(&modelfile).unwrap();
// make sure the model is correct
assert_eq!(model.get_num_classes(), 2); // check: num_classes
assert_eq!(model.get_num_sv(), 91); // check: num sv
assert_eq!(model.get_svr_probability(), 0.0);
assert_eq!(model.get_svm_type(), SvmType::CSVC); // check: SvmType
assert_eq!(model.get_num_sv(), 91); // check: number of support vectors
assert_eq!(model.get_sv_indices().len(), 91); // check: support vector indices
let labels = model.get_labels(); // check: get_labels
assert_eq!(labels.len(), 2);
assert!(labels.contains(&1));
assert!(labels.contains(&-1));
// predict some test instances
let test_vec = vec![(1,0.708333), (2,1.0), (3,1.0), (4,-0.320755), (5,-0.105023), (6,-1.0),
(7,1.0), (8,-0.419847), (9,-1.0), (10,-0.225806), (12,1.0), (13,-1.0)];
assert!([1.0, -1.0].contains(&model.sparse_predict(&test_vec)));
// save and reload the model
let new_modelfile = "tests/data/heart_scale_2.model";
assert!(model.save(&new_modelfile).is_ok());
assert!(load_model(&new_modelfile).is_ok());
// clean up
fs::remove_file(&new_modelfile).unwrap();
} | rust_cleaned_test_functions.jsonl/42834 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 575
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49205,
5047,
368,
341,
262,
442,
2795,
279,
1614,
198,
262,
1077,
1463,
490,
457,
284,
330,
23841,
13167,
14,
17735,
16727,
3192,
876,
262,
1077,
1614,
284,
2795,
5047,
2099,
2593,
490,
457,
568... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_wrap_return_type_handles_type_aliases() {
let before = r#"
//- /main.rs
use std::{string::String, result::Result::{self, Ok, Err}};
type MyResult<T> = Result<T, String>;
fn div(x: i32, y: i32) -> MyResult<i32> {
if y == 0 {
return Err("div by zero".into());
}
x <|>/ y
}
//- /std/lib.rs
pub mod string {
pub struct String { }
}
pub mod result {
pub enum Result<T, E> { Ok(T), Err(E) }
}
"#;
let after = r#"
use std::{string::String, result::Result::{self, Ok, Err}};
type MyResult<T> = Result<T, String>;
fn div(x: i32, y: i32) -> MyResult<i32> {
if y == 0 {
return Err("div by zero".into());
}
Ok(x / y)
}
"#;
check_apply_diagnostic_fix_from_position(before, after);
} | rust_cleaned_test_functions.jsonl/71649 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 644
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38550,
12511,
1819,
68017,
1819,
90233,
368,
341,
286,
1077,
1573,
284,
435,
2,
698,
310,
78406,
608,
3817,
25638,
198,
310,
990,
1460,
22964,
917,
486,
703,
11,
1102,
486,
2077,
22964,
721,
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_live() {
{
let x = Cc::new(5);
let y = x.downgrade();
assert!(y.upgrade().is_some());
}
collect_cycles();
} | rust_cleaned_test_functions.jsonl/110848 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 118
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55203,
368,
341,
286,
341,
310,
1077,
856,
284,
356,
66,
486,
931,
7,
20,
317,
310,
1077,
379,
284,
856,
18148,
6937,
543,
310,
2060,
10297,
88,
17652,
6937,
1005,
285,
61855,
1423,
286,
456,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_config_extension() {
let yaml_string = "sorting:\n column: extension";
let yaml = YamlLoader::load_from_str(yaml_string).unwrap()[0].clone();
assert_eq!(
Some(SortColumn::Extension),
SortColumn::from_config(&Config::with_yaml(yaml))
);
} | rust_cleaned_test_functions.jsonl/54299 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 157
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
5332,
31035,
368,
341,
286,
1077,
32246,
3904,
284,
330,
67039,
7190,
77,
220,
3250,
25,
8894,
876,
286,
1077,
32246,
284,
809,
9467,
9181,
486,
1078,
5673,
2895,
7021,
9467,
3904,
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_metadata_serialization_minimal() {
let json_response = "{\"redirect_uris\": [\"https://example.com/redirect-1\"]}";
let client_metadata: CoreClientMetadata = serde_json::from_str(json_response).unwrap();
assert_eq!(
*client_metadata.redirect_uris(),
vec![RedirectUrl::new("https://example.com/redirect-1".to_string()).unwrap(),]
);
assert_eq!(client_metadata.response_types(), None);
assert_eq!(client_metadata.grant_types(), None);
assert_eq!(client_metadata.application_type(), None);
assert_eq!(client_metadata.contacts(), None);
assert_eq!(client_metadata.client_name(), None);
assert_eq!(client_metadata.logo_uri(), None);
assert_eq!(client_metadata.client_uri(), None);
assert_eq!(client_metadata.policy_uri(), None);
assert_eq!(client_metadata.tos_uri(), None);
assert_eq!(client_metadata.jwks_uri(), None);
assert_eq!(client_metadata.jwks(), None);
assert_eq!(client_metadata.sector_identifier_uri(), None);
assert_eq!(client_metadata.subject_type(), None);
assert_eq!(client_metadata.id_token_signed_response_alg(), None);
assert_eq!(client_metadata.id_token_encrypted_response_alg(), None);
assert_eq!(client_metadata.id_token_encrypted_response_enc(), None);
assert_eq!(client_metadata.userinfo_signed_response_alg(), None);
assert_eq!(client_metadata.userinfo_encrypted_response_alg(), None);
assert_eq!(client_metadata.userinfo_encrypted_response_enc(), None);
assert_eq!(client_metadata.request_object_signing_alg(), None);
assert_eq!(client_metadata.request_object_encryption_alg(), None);
assert_eq!(client_metadata.request_object_encryption_enc(), None);
assert_eq!(client_metadata.token_endpoint_auth_method(), None);
assert_eq!(client_metadata.token_endpoint_auth_signing_alg(), None);
assert_eq!(client_metadata.default_max_age(), None);
assert_eq!(client_metadata.require_auth_time(), None);
assert_eq!(client_metadata.default_acr_values(), None);
assert_eq!(client_metadata.sector_identifier_uri(), None);
assert_eq!(client_metadata.request_uris(), None);
let serialized_json = serde_json::to_string(&client_metadata).unwrap();
assert_eq!(
client_metadata,
serde_json::from_str(&serialized_json).unwrap()
);
} | rust_cleaned_test_functions.jsonl/69416 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1027
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22220,
25602,
2022,
7260,
2861,
368,
341,
286,
1077,
2951,
9655,
284,
54734,
8117,
64879,
285,
11693,
508,
2105,
2428,
1110,
8687,
905,
14,
8117,
12,
16,
75104,
71612,
286,
1077,
2943,
22220,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_all_settings() {
let (_td, cd, cp) = test_prolog();
let conf = load_config!(
cp,
"[cache]\n\
enabled = true\n\
directory = {cache_dir}\n\
worker-event-queue-size = '16'\n\
baseline-compression-level = 3\n\
optimized-compression-level = 20\n\
optimized-compression-usage-counter-threshold = '256'\n\
cleanup-interval = '1h'\n\
optimizing-compression-task-timeout = '30m'\n\
allowed-clock-drift-for-files-from-future = '1d'\n\
file-count-soft-limit = '65536'\n\
files-total-size-soft-limit = '512Mi'\n\
file-count-limit-percent-if-deleting = '70%'\n\
files-total-size-limit-percent-if-deleting = '70%'",
cd
);
check_conf(&conf, &cd);
let conf = load_config!(
cp,
// added some white spaces
"[cache]\n\
enabled = true\n\
directory = {cache_dir}\n\
worker-event-queue-size = ' 16\t'\n\
baseline-compression-level = 3\n\
optimized-compression-level =\t 20\n\
optimized-compression-usage-counter-threshold = '256'\n\
cleanup-interval = ' 1h'\n\
optimizing-compression-task-timeout = '30 m'\n\
allowed-clock-drift-for-files-from-future = '1\td'\n\
file-count-soft-limit = '\t \t65536\t'\n\
files-total-size-soft-limit = '512\t\t Mi '\n\
file-count-limit-percent-if-deleting = '70\t%'\n\
files-total-size-limit-percent-if-deleting = ' 70 %'",
cd
);
check_conf(&conf, &cd);
fn check_conf(conf: &CacheConfig, cd: &PathBuf) {
eprintln!("errors: {:#?}", conf.errors);
assert!(conf.enabled());
assert!(conf.errors.is_empty());
assert_eq!(
conf.directory(),
&fs::canonicalize(cd).expect("canonicalize failed")
);
assert_eq!(conf.worker_event_queue_size(), 0x10);
assert_eq!(conf.baseline_compression_level(), 3);
assert_eq!(conf.optimized_compression_level(), 20);
assert_eq!(conf.optimized_compression_usage_counter_threshold(), 0x100);
assert_eq!(conf.cleanup_interval(), Duration::from_secs(60 * 60));
assert_eq!(
conf.optimizing_compression_task_timeout(),
Duration::from_secs(30 * 60)
);
assert_eq!(
conf.allowed_clock_drift_for_files_from_future(),
Duration::from_secs(60 * 60 * 24)
);
assert_eq!(conf.file_count_soft_limit(), 0x10_000);
assert_eq!(conf.files_total_size_soft_limit(), 512 * (1u64 << 20));
assert_eq!(conf.file_count_limit_percent_if_deleting(), 70);
assert_eq!(conf.files_total_size_limit_percent_if_deleting(), 70);
}
} | rust_cleaned_test_functions.jsonl/48294 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1382
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5705,
10853,
368,
341,
262,
1077,
5453,
1296,
11,
15307,
11,
12490,
8,
284,
1273,
2540,
839,
543,
262,
1077,
2335,
284,
2795,
5332,
33673,
286,
12490,
345,
286,
10545,
9360,
17960,
77,
5661,
260... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_named_file_allowed_method() {
let req = TestRequest::default().method(Method::GET).to_http_request();
let file = NamedFile::open("Cargo.toml").unwrap();
let resp = file.respond_to(&req).unwrap();
assert_eq!(resp.status(), StatusCode::OK);
} | rust_cleaned_test_functions.jsonl/35500 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71834,
2458,
42155,
9032,
368,
341,
286,
1077,
4232,
284,
3393,
1900,
486,
2258,
1005,
4393,
35419,
486,
3806,
568,
983,
25888,
7893,
543,
286,
1077,
1034,
284,
40459,
1703,
486,
2508,
445,
98228,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_guild_commands() {
let route = Route::GetGuildCommands {
application_id: APPLICATION_ID,
guild_id: GUILD_ID,
};
assert_eq!(
route.to_string(),
format!(
"applications/{application_id}/guilds/{guild_id}/commands",
application_id = APPLICATION_ID,
guild_id = GUILD_ID
)
);
} | rust_cleaned_test_functions.jsonl/119852 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 256
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
1889,
1498,
44151,
368,
341,
286,
1077,
6021,
284,
9572,
486,
1949,
72574,
30479,
341,
310,
3766,
842,
25,
59237,
3450,
345,
310,
26411,
842,
25,
479,
18023,
3450,
345,
286,
2605,
286,
206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_rgba() {
assert_eq!(
parse_rgba("rgba(20,30,100,0.1)").unwrap(),
Color::from(20, 30, 100, 25)
);
assert_eq!(
parse_rgba("rgba(120,255,0,0.5)").unwrap(),
Color::from(120, 255, 0, 127)
);
} | rust_cleaned_test_functions.jsonl/100525 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 150
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
95229,
368,
341,
262,
2060,
10714,
33673,
286,
4715,
95229,
445,
20400,
7,
17,
15,
11,
18,
15,
11,
16,
15,
15,
11,
15,
13,
16,
63554,
15454,
3148,
286,
3478,
486,
1499,
7,
17,
15,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_resolve() {
let cases = vec![
vec![Event::Lock(1, Key::from_raw(b"a")), Event::Resolve(2, 1)],
vec![
Event::Lock(1, Key::from_raw(b"a")),
Event::Unlock(Key::from_raw(b"a")),
Event::Resolve(2, 2),
],
vec![
Event::Lock(3, Key::from_raw(b"a")),
Event::Unlock(Key::from_raw(b"a")),
Event::Resolve(2, 2),
],
vec![
Event::Lock(1, Key::from_raw(b"a")),
Event::Unlock(Key::from_raw(b"a")),
Event::Lock(1, Key::from_raw(b"b")),
Event::Resolve(2, 1),
],
vec![
Event::Lock(2, Key::from_raw(b"a")),
Event::Unlock(Key::from_raw(b"a")),
Event::Resolve(2, 2),
// Pessimistic txn may write a smaller start_ts.
Event::Lock(1, Key::from_raw(b"a")),
Event::Resolve(2, 2),
Event::Unlock(Key::from_raw(b"a")),
Event::Resolve(3, 3),
],
vec![
Event::Unlock(Key::from_raw(b"a")),
Event::Lock(2, Key::from_raw(b"a")),
Event::Unlock(Key::from_raw(b"a")),
Event::Unlock(Key::from_raw(b"a")),
Event::Resolve(3, 3),
],
vec![
Event::Lock(2, Key::from_raw(b"a")),
Event::Resolve(4, 2),
Event::Unlock(Key::from_raw(b"a")),
Event::Resolve(5, 5),
],
// Rollback may contain a key that is not locked.
vec![
Event::Lock(1, Key::from_raw(b"a")),
Event::Unlock(Key::from_raw(b"b")),
Event::Unlock(Key::from_raw(b"a")),
],
];
for (i, case) in cases.into_iter().enumerate() {
let mut resolver = Resolver::new(1);
for e in case.clone() {
match e {
Event::Lock(start_ts, key) => {
resolver.track_lock(start_ts.into(), key.into_raw().unwrap())
}
Event::Unlock(key) => resolver.untrack_lock(&key.into_raw().unwrap()),
Event::Resolve(min_ts, expect) => {
assert_eq!(resolver.resolve(min_ts.into()), expect.into(), "case {}", i)
}
}
}
}
} | rust_cleaned_test_functions.jsonl/2899 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1591
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77291,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
7486,
20703,
1556,
486,
11989,
7,
16,
11,
5309,
486,
1499,
16067,
1883,
56693,
35674,
3665,
486,
56808,
7,
17,
11,
220,
16,
30749,
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... | 6 |
#[test]
fn test_action_return_associated_types() {
let mut callbacks = associated_types_lib::TestParseCallbacks;
assert_eq!(
associated_types::TermParser::new().parse(&mut callbacks, "(((((42)))))"),
Ok(associated_types_lib::TestTerm(
associated_types_lib::TestNum(42)
))
);
} | rust_cleaned_test_functions.jsonl/27437 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7931,
12511,
58665,
657,
9763,
368,
341,
262,
1077,
5206,
26679,
284,
5815,
9763,
16142,
486,
2271,
14463,
44461,
280,
262,
2060,
10714,
33673,
286,
5815,
9763,
486,
17249,
6570,
486,
931,
1005,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_force_leader_on_hibernated_leader() {
let mut cluster = new_node_cluster(0, 5);
cluster.pd_client.disable_default_operator();
cluster.run();
cluster.must_put(b"k1", b"v1");
let region = cluster.get_region(b"k1");
cluster.must_split(®ion, b"k9");
let region = cluster.get_region(b"k2");
let peer_on_store1 = find_peer(®ion, 1).unwrap();
cluster.must_transfer_leader(region.get_id(), peer_on_store1.clone());
// wait a while to hibernate
std::thread::sleep(Duration::from_millis(
cluster.cfg.raft_store.raft_election_timeout_ticks as u64
* cluster.cfg.raft_store.raft_base_tick_interval.as_millis()
* 3,
));
cluster.stop_node(3);
cluster.stop_node(4);
cluster.stop_node(5);
cluster.must_enter_force_leader(region.get_id(), 1, vec![3, 4, 5]);
// remove the peers on failed nodes
cluster
.pd_client
.must_remove_peer(region.get_id(), find_peer(®ion, 3).unwrap().clone());
cluster
.pd_client
.must_remove_peer(region.get_id(), find_peer(®ion, 4).unwrap().clone());
cluster
.pd_client
.must_remove_peer(region.get_id(), find_peer(®ion, 5).unwrap().clone());
cluster.exit_force_leader(region.get_id(), 1);
cluster.must_put(b"k4", b"v4");
assert_eq!(cluster.must_get(b"k2"), None);
assert_eq!(cluster.must_get(b"k3"), None);
assert_eq!(cluster.must_get(b"k4"), Some(b"v4".to_vec()));
} | rust_cleaned_test_functions.jsonl/6004 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 662
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40739,
79991,
4470,
1523,
17660,
657,
79991,
368,
341,
262,
1077,
5206,
10652,
284,
501,
5084,
28441,
7,
15,
11,
220,
20,
317,
262,
10652,
556,
67,
8179,
42628,
9993,
40594,
1428,
262,
10652,
76... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_word_ranges_many_words() {
assert_eq!(
find_word_ranges(b"fn find_words(text: &[u8])"),
vec![0..2, 3..13, 14..18, 22..24]
);
} | rust_cleaned_test_functions.jsonl/89248 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 118
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
13533,
58748,
22101,
18981,
368,
341,
286,
2060,
10714,
33673,
310,
1477,
13533,
58748,
1883,
1,
8822,
1477,
18981,
7235,
25,
44590,
84,
23,
2467,
4461,
310,
7486,
20703,
15,
496,
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_lagging_upstream_long_poll() {
let mut env = SynchronizerEnv::new(4);
env.start_next_synchronizer(
SynchronizerEnv::default_handler(),
RoleType::Validator,
Waypoint::default(),
true,
None,
);
env.setup_next_synchronizer(
SynchronizerEnv::default_handler(),
RoleType::FullNode,
Waypoint::default(),
10_000,
1_000_000,
true,
Some(vec![NetworkId::vfn_network(), NetworkId::Public]),
);
env.start_next_synchronizer(
SynchronizerEnv::default_handler(),
RoleType::FullNode,
Waypoint::default(),
true,
Some(vec![NetworkId::vfn_network()]),
);
// we treat this a standalone node whose local state we use as the baseline
// to clone state to the other nodes
env.start_next_synchronizer(
SynchronizerEnv::default_handler(),
RoleType::Validator,
Waypoint::default(),
true,
None,
);
// network handles for each node
let validator = (0, 0);
let full_node_vfn_network = (1, 0);
let full_node_failover_network = (1, 2);
let failover_fn_vfn_network = (2, 0);
let failover_fn = (2, 2);
env.commit(0, 400);
// validator discovers FN
env.send_peer_event(full_node_vfn_network, validator, true, Inbound);
// fn discovers validator
env.send_peer_event(validator, full_node_vfn_network, true, Outbound);
// FN discovers failover upstream
env.send_peer_event(full_node_failover_network, failover_fn, true, Inbound);
env.send_peer_event(failover_fn, full_node_failover_network, true, Outbound);
let (_, msg) = env.deliver_msg(full_node_vfn_network);
let req: StateSynchronizerMsg =
lcs::from_bytes(&msg.mdata).expect("failed lcs deserialization");
check_chunk_request(req, 0, None);
let (_, msg) = env.deliver_msg(validator);
let resp: StateSynchronizerMsg =
lcs::from_bytes(&msg.mdata).expect("failed lcs deserialization");
check_chunk_response(resp, 400, 1, 250);
env.wait_for_version(1, 250, None);
// validator loses FN
env.send_peer_event(full_node_vfn_network, validator, false, Inbound);
// fn loses validator
env.send_peer_event(validator, full_node_vfn_network, false, Outbound);
// full_node sends chunk request to failover upstream for known_version 250 and target LI 400
let (_, msg) = env.deliver_msg(full_node_failover_network);
let msg: StateSynchronizerMsg =
lcs::from_bytes(&msg.mdata).expect("failed lcs deserialization");
check_chunk_request(msg, 250, Some(400));
// update failover VFN from lagging state to updated state
// so it can deliver full_node's long-poll subscription
env.commit(0, 500);
// we directly sync up the storage of the failover upstream with this validator's for ease of testing
env.clone_storage(0, 2);
env.wait_for_version(2, 500, Some(500));
// connect the validator and the failover vfn so FN can sync to validator
// validator discovers FN
env.send_peer_event(failover_fn_vfn_network, validator, true, Inbound);
// fn discovers validator
env.send_peer_event(validator, failover_fn_vfn_network, true, Outbound);
// trigger another commit so that the failover fn's commit will trigger subscription delivery
env.commit(0, 600);
// failover fn sends chunk request to validator
let (_, msg) = env.deliver_msg(failover_fn_vfn_network);
let msg: StateSynchronizerMsg =
lcs::from_bytes(&msg.mdata).expect("failed lcs deserialization");
check_chunk_request(msg, 500, None);
let (_, msg) = env.deliver_msg(validator);
let resp: StateSynchronizerMsg =
lcs::from_bytes(&msg.mdata).expect("failed lcs deserialization");
check_chunk_response(resp, 600, 501, 100);
// failover sends long-poll subscription to fullnode
let (_, msg) = env.deliver_msg(failover_fn);
let resp: StateSynchronizerMsg =
lcs::from_bytes(&msg.mdata).expect("failed lcs deserialization");
check_chunk_response(resp, 600, 251, 250);
// full_node sends chunk request to failover upstream for known_version 250 and target LI 400
let (_, msg) = env.deliver_msg(full_node_failover_network);
let msg: StateSynchronizerMsg =
lcs::from_bytes(&msg.mdata).expect("failed lcs deserialization");
// here we check that the next requested version is not the older target LI 400 - that should be
// pruned out from PendingLedgerInfos since it becomes outdated after the known_version advances to 500
check_chunk_request(msg, 500, None);
// check that fullnode successfully finishes sync to 600
let (_, msg) = env.deliver_msg(failover_fn);
let resp: StateSynchronizerMsg =
lcs::from_bytes(&msg.mdata).expect("failed lcs deserialization");
check_chunk_response(resp, 600, 501, 100);
env.wait_for_version(1, 600, Some(600));
} | rust_cleaned_test_functions.jsonl/32155 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1899
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
907,
351,
3173,
8237,
4027,
17799,
40002,
368,
341,
262,
1077,
5206,
6105,
284,
328,
14113,
3135,
14359,
486,
931,
7,
19,
317,
262,
6105,
4962,
11257,
643,
14113,
3135,
1006,
286,
328,
14113,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_convert_from_big_decimal() {
let big_decimal: BigDecimal = BigDecimal::new((-24601).into(), 3);
let actual: Decimal = big_decimal.into();
let expected = Decimal::new(-24601, -3);
assert_eq!(actual, expected);
} | rust_cleaned_test_functions.jsonl/41981 | {
"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,
34910,
5673,
36386,
74429,
368,
341,
286,
1077,
2409,
74429,
25,
20618,
284,
20618,
486,
931,
54934,
17,
19,
21,
15,
16,
568,
18122,
1507,
220,
18,
317,
286,
1077,
5042,
25,
26728,
284,
2409,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_keyword_expr() {
use parser::expression;
assert_eq!(
expression("__func__", &mut Env::new()),
Ok(ident("__func__"))
);
assert_eq!(
expression("__FUNCTION__", &mut Env::new()),
Ok(ident("__FUNCTION__"))
);
assert_eq!(
expression("__PRETTY_FUNCTION__", &mut Env::new()),
Ok(ident("__PRETTY_FUNCTION__"))
);
} | rust_cleaned_test_functions.jsonl/107581 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 203
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45824,
21915,
368,
341,
262,
990,
6729,
486,
28099,
401,
262,
2060,
10714,
33673,
286,
7493,
58406,
2830,
563,
497,
609,
6984,
37039,
486,
931,
14702,
286,
7622,
95270,
58406,
2830,
563,
5455,
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_repeated_prewrite_non_pessimistic_lock() {
let engine = TestEngineBuilder::new().build().unwrap();
let cm = ConcurrencyManager::new(1.into());
let mut statistics = Statistics::default();
let cm = &cm;
let mut prewrite_with_retry_flag =
|key: &[u8],
value: &[u8],
pk: &[u8],
secondary_keys,
ts: u64,
is_pessimistic_lock,
is_retry_request| {
let mutation = Mutation::make_put(Key::from_raw(key), value.to_vec());
let mut ctx = Context::default();
ctx.set_is_retry_request(is_retry_request);
let cmd = PrewritePessimistic::new(
vec![(mutation, is_pessimistic_lock)],
pk.to_vec(),
ts.into(),
100,
ts.into(),
1,
(ts + 1).into(),
0.into(),
secondary_keys,
false,
AssertionLevel::Off,
ctx,
);
prewrite_command(&engine, cm.clone(), &mut statistics, cmd)
};
must_acquire_pessimistic_lock(&engine, b"k1", b"k1", 10, 10);
must_pessimistic_prewrite_put_async_commit(
&engine,
b"k1",
b"v1",
b"k1",
&Some(vec![b"k2".to_vec()]),
10,
10,
true,
15,
);
must_pessimistic_prewrite_put_async_commit(
&engine,
b"k2",
b"v2",
b"k1",
&Some(vec![]),
10,
10,
false,
15,
);
// The transaction may be committed by another reader.
must_commit(&engine, b"k1", 10, 20);
must_commit(&engine, b"k2", 10, 20);
// This is a re-sent prewrite.
prewrite_with_retry_flag(b"k2", b"v2", b"k1", Some(vec![]), 10, false, true).unwrap();
must_commit(&engine, b"k1", 10, 25);
must_commit(&engine, b"k2", 10, 25);
must_seek_write(&engine, b"k1", 30, 10, 20, WriteType::Put);
must_seek_write(&engine, b"k2", 30, 10, 20, WriteType::Put);
// Write another version to the keys.
must_prewrite_put(&engine, b"k1", b"v11", b"k1", 35);
must_prewrite_put(&engine, b"k2", b"v22", b"k1", 35);
must_commit(&engine, b"k1", 35, 40);
must_commit(&engine, b"k2", 35, 40);
// A retrying non-pessimistic-lock prewrite request should not skip constraint checks.
prewrite_with_retry_flag(b"k2", b"v2", b"k1", Some(vec![]), 10, false, true).unwrap();
must_unlocked(&engine, b"k2");
prewrite_with_retry_flag(b"k2", b"v2", b"k1", None, 10, false, true).unwrap();
must_unlocked(&engine, b"k2");
// Committing still does nothing.
must_commit(&engine, b"k2", 10, 25);
// It should report a PessimisticLockNotFound.
let err = prewrite_with_retry_flag(b"k2", b"v2", b"k1", None, 11, false, true).unwrap_err();
assert!(matches!(
err,
Error(box ErrorInner::Mvcc(MvccError(
box MvccErrorInner::PessimisticLockNotFound { .. }
)))
));
must_unlocked(&engine, b"k2");
// However conflict still won't be checked if there's a non-retry request arriving.
prewrite_with_retry_flag(b"k2", b"v2", b"k1", None, 10, false, false).unwrap();
must_locked(&engine, b"k2", 10);
} | rust_cleaned_test_functions.jsonl/31433 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2061
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
41954,
620,
52473,
21637,
620,
66733,
4532,
9818,
368,
341,
286,
1077,
4712,
284,
3393,
4571,
3297,
486,
931,
1005,
5834,
1005,
15454,
543,
286,
1077,
9961,
284,
1200,
15973,
2043,
486,
931,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vm_memory_init() {
let mut kvm_context = KvmContext::new().unwrap();
let mut vm = Vm::new(kvm_context.fd()).expect("Cannot create new vm");
// Create valid memory region and test that the initialization is successful.
let gm = GuestMemory::new(&[(GuestAddress(0), 0x1000)]).unwrap();
assert!(vm.memory_init(gm, &kvm_context).is_ok());
// Set the maximum number of memory slots to 1 in KvmContext to check the error
kvm_context.max_memslots = 1;
let gm = GuestMemory::new(&[(GuestAddress(0x0), 0x1000), (GuestAddress(0x1001), 0x2000)])
.unwrap();
assert!(vm.memory_init(gm, &kvm_context).is_err());
} | rust_cleaned_test_functions.jsonl/1914 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 311
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39008,
19195,
6137,
368,
341,
286,
1077,
5206,
94748,
8467,
284,
730,
7338,
1972,
486,
931,
1005,
15454,
543,
286,
1077,
5206,
10995,
284,
647,
76,
486,
931,
5969,
7338,
8467,
58339,
6011,
17119,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_check() {
let mut bf: BloomFilter = BloomFilter::new(100, 0.05);
for i in 1..100 {
bf.insert(&i.to_string());
}
for j in 1..100 {
assert!(bf.check(&j.to_string()));
}
let mut false_positives: u64 = 0;
for k in 101..200 {
if bf.check(&k.to_string()) {
false_positives += 1;
}
}
assert!(false_positives < 6);
} | rust_cleaned_test_functions.jsonl/89168 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 270
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
368,
341,
286,
1077,
5206,
39093,
25,
24503,
5632,
284,
24503,
5632,
486,
931,
7,
16,
15,
15,
11,
220,
15,
13,
15,
20,
317,
286,
369,
600,
304,
220,
16,
496,
16,
15,
15,
341,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_parse_pointer_encoding_bad_encoding() {
use crate::endianity::NativeEndian;
let expected =
constants::DwEhPe((constants::DW_EH_PE_sdata8.0 + 1) | constants::DW_EH_PE_pcrel.0);
let input = [expected.0, 1, 2, 3, 4];
let input = &mut EndianSlice::new(&input, NativeEndian);
assert_eq!(
Err(Error::UnknownPointerEncoding),
parse_pointer_encoding(input)
);
} | rust_cleaned_test_functions.jsonl/9401 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 227
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
21425,
37613,
34199,
37613,
368,
341,
286,
990,
17717,
486,
408,
1103,
487,
486,
20800,
43231,
280,
286,
1077,
3601,
4035,
310,
18021,
486,
35,
86,
36,
71,
10197,
1188,
15763,
486,
54219,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_seq_index_trait_range_panic_start() {
Python::with_gil(|py| {
let v: Vec<i32> = vec![1, 1, 2];
let ob = v.to_object(py);
let seq = ob.cast_as::<PySequence>(py).unwrap();
seq[5..10].extract::<Vec<i32>>().unwrap();
})
} | rust_cleaned_test_functions.jsonl/70310 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 176
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14486,
3560,
78491,
9698,
620,
31270,
4906,
368,
341,
286,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
341,
310,
1077,
348,
25,
11312,
21897,
18,
17,
29,
284,
7486,
20703,
16,
11,
220,
16,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ubx_packet_send() {
let src_code = quote! {
#[ubx_packet_send]
#[ubx(class = 1, id = 2, fixed_payload_len = 9, flags = "default_for_builder")]
#[doc = "Some comment"]
struct Test {
itow: u32,
#[doc = "this is lat"]
#[ubx(map_type = f64, scale = 1e-7, alias = lat_degrees)]
lat: i32,
#[doc = "this is a"]
a: u8,
}
};
let src_code = src_code.to_string();
let code: syn::ItemStruct = syn::parse_str(&src_code)
.unwrap_or_else(|err| panic_on_parse_error("test_ubx_packet_send", &src_code, &err));
let tokens = generate_code_for_send_packet(code.ident, code.attrs, code.fields)
.unwrap_or_else(|err| panic_on_parse_error("test_ubx_packet_send", &src_code, &err));
run_compare_test(
tokens,
quote! {
#[doc = "Some comment"]
pub struct Test;
impl UbxPacketMeta for Test {
const CLASS: u8 = 1u8;
const ID: u8 = 2u8;
const FIXED_PAYLOAD_LEN: Option<u16> = Some(9u16);
const MAX_PAYLOAD_LEN: u16 = 9u16;
}
#[doc = "Some comment"]
#[doc = "Struct that is used to construct packets, see the crate-level documentation for more information"]
#[derive(Default)]
pub struct TestBuilder {
#[doc = ""]
pub itow: u32,
#[doc = "this is lat"]
pub lat_degrees: f64,
#[doc = "this is a"]
pub a: u8,
}
impl TestBuilder {
pub const PACKET_LEN: usize = 17usize;
#[inline]
pub fn into_packet_bytes(self) -> [u8; Self::PACKET_LEN] {
let mut ret = [0u8; Self::PACKET_LEN];
ret[0] = SYNC_CHAR_1;
ret[1] = SYNC_CHAR_2;
ret[2] = Test::CLASS;
ret[3] = Test::ID;
let pack_len_bytes = 9u16.to_le_bytes();
ret[4] = pack_len_bytes[0];
ret[5] = pack_len_bytes[1];
let bytes = self.itow.to_le_bytes();
ret[6usize] = bytes[0usize];
ret[7usize] = bytes[1usize];
ret[8usize] = bytes[2usize];
ret[9usize] = bytes[3usize];
let bytes = ScaleBack::<f64>(1. / 1e-7)
.as_i32(self.lat_degrees)
.to_le_bytes();
ret[10usize] = bytes[0usize];
ret[11usize] = bytes[1usize];
ret[12usize] = bytes[2usize];
ret[13usize] = bytes[3usize];
let bytes = self.a.to_le_bytes();
ret[14usize] = bytes[0usize];
let (ck_a, ck_b) = ubx_checksum(&ret[2..17usize - 2]);
ret[17usize - 2] = ck_a;
ret[17usize - 1] = ck_b;
ret
}
}
impl From<TestBuilder> for [u8; 17usize] {
fn from(x: TestBuilder) -> Self {
x.into_packet_bytes()
}
}
impl UbxPacketCreator for TestBuilder {
#[inline]
fn create_packet<T: MemWriter>(self, out: &mut T) -> Result<(), MemWriterError<T::Error>> {
out.reserve_allocate(17usize)?;
let len_bytes = 9u16.to_le_bytes();
let header = [
SYNC_CHAR_1,
SYNC_CHAR_2,
Test::CLASS,
Test::ID,
len_bytes[0],
len_bytes[1],
];
out.write(&header)?;
let mut checksum_calc = UbxChecksumCalc::default();
checksum_calc.update(&header[2..]);
let bytes = self.itow.to_le_bytes();
out.write(&bytes)?;
checksum_calc.update(&bytes);
let bytes = ScaleBack::<f64>(1. / 1e-7)
.as_i32(self.lat_degrees)
.to_le_bytes();
out.write(&bytes)?;
checksum_calc.update(&bytes);
let bytes = self.a.to_le_bytes();
out.write(&bytes)?;
checksum_calc.update(&bytes);
let (ck_a, ck_b) = checksum_calc.result();
out.write(&[ck_a, ck_b])?;
Ok(())
}
}
},
);
} | rust_cleaned_test_functions.jsonl/16494 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2990
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66794,
87,
21078,
13565,
368,
341,
262,
1077,
2286,
4136,
284,
12641,
0,
341,
286,
11506,
392,
87,
21078,
13565,
921,
286,
11506,
392,
87,
21956,
284,
220,
16,
11,
877,
284,
220,
17,
11,
8356,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_detect_script() {
assert_eq!(detect_script("1234567890-,;!"), None);
// One script
assert_eq!(detect_script("Hello!"), Some(Script::Latin));
assert_eq!(
detect_script("Привет всем!"),
Some(Script::Cyrillic)
);
assert_eq!(
detect_script("ქართული ენა მსოფლიო "),
Some(Script::Georgian)
);
assert_eq!(
detect_script("県見夜上温国阪題富販"),
Some(Script::Mandarin)
);
assert_eq!(
detect_script(" ككل حوالي 1.6، ومعظم الناس "),
Some(Script::Arabic)
);
assert_eq!(
detect_script(
"हिमालयी वन चिड़िया (जूथेरा सालिमअली) चिड़िया की एक प्रजाति है"
),
Some(Script::Devanagari)
);
assert_eq!(
detect_script("היסטוריה והתפתחות של האלפבית העברי"),
Some(Script::Hebrew)
);
assert_eq!(
detect_script(
"የኢትዮጵያ ፌዴራላዊ ዴሞክራሲያዊሪፐብሊክ"
),
Some(Script::Ethiopic)
);
// Mixed scripts
assert_eq!(
detect_script("Привет! Текст на русском with some English."),
Some(Script::Cyrillic)
);
assert_eq!(
detect_script("Russian word любовь means love."),
Some(Script::Latin)
);
} | rust_cleaned_test_functions.jsonl/123595 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1051
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56457,
14660,
368,
341,
286,
2060,
10714,
10297,
61243,
14660,
445,
16,
17,
18,
19,
20,
21,
22,
23,
24,
15,
36519,
98473,
3975,
2240,
626,
286,
442,
3776,
5316,
198,
286,
2060,
10714,
10297,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_try_from_patch_machine_config() {
let (mut sender, receiver) = UnixStream::pair().unwrap();
let mut connection = HttpConnection::new(receiver);
let body = "{ \
\"vcpu_count\": 0, \
\"mem_size_mib\": 0, \
\"ht_enabled\": true \
}";
sender
.write_all(http_request("PATCH", "/machine-config", Some(&body)).as_bytes())
.unwrap();
assert!(connection.try_read().is_ok());
let req = connection.pop_parsed_request().unwrap();
assert!(ParsedRequest::try_from_request(&req).is_ok());
let body = "{ \
\"vcpu_count\": 0, \
\"mem_size_mib\": 0, \
\"ht_enabled\": true, \
\"cpu_template\": \"C3\" \
}";
sender
.write_all(http_request("PATCH", "/machine-config", Some(&body)).as_bytes())
.unwrap();
assert!(connection.try_read().is_ok());
let req = connection.pop_parsed_request().unwrap();
#[cfg(target_arch = "x86_64")]
assert!(ParsedRequest::try_from_request(&req).is_ok());
#[cfg(target_arch = "aarch64")]
assert!(ParsedRequest::try_from_request(&req).is_err());
} | rust_cleaned_test_functions.jsonl/106592 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 613
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
5673,
39643,
38695,
5332,
368,
341,
286,
1077,
320,
6984,
4646,
11,
13964,
8,
284,
46995,
3027,
486,
12670,
1005,
15454,
543,
286,
1077,
5206,
3633,
284,
4823,
4526,
486,
931,
78126,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_exhaust_retries_arp_request() {
// we give up and don't install another retry timer.
let mut ctx = DummyContext::default();
lookup(&mut ctx, (), TEST_LOCAL_MAC, TEST_REMOTE_IPV4);
// already sent one request during the call to `lookup`.
for i in 1..DEFAULT_ARP_REQUEST_MAX_TRIES {
// We should have sent i requests total. We have already validated
validate_last_arp_packet(
&ctx,
i,
Mac::BROADCAST,
ArpOp::Request,
TEST_LOCAL_IPV4,
TEST_REMOTE_IPV4,
TEST_LOCAL_MAC,
Mac::BROADCAST,
);
// Check the number of remaining tries.
assert_eq!(
ctx.get_ref().arp_state.table.get_remaining_tries(TEST_REMOTE_IPV4).unwrap(),
DEFAULT_ARP_REQUEST_MAX_TRIES - i
);
// There should be a single ARP request retry timer installed.
validate_single_retry_timer(
&ctx,
// Duration only implements Mul<u32>
DEFAULT_ARP_REQUEST_PERIOD * (i as u32),
TEST_REMOTE_IPV4,
);
// Trigger the ARP request retry timer.
assert!(ctx.trigger_next_timer());
}
// We should have sent DEFAULT_ARP_REQUEST_MAX_TRIES requests total. We
// one.
validate_last_arp_packet(
&ctx,
DEFAULT_ARP_REQUEST_MAX_TRIES,
Mac::BROADCAST,
ArpOp::Request,
TEST_LOCAL_IPV4,
TEST_REMOTE_IPV4,
TEST_LOCAL_MAC,
Mac::BROADCAST,
);
// There shouldn't be any timers installed.
assert_eq!(ctx.timers().len(), 0);
// The table entry should have been completely removed.
assert!(ctx.get_ref().arp_state.table.table.get(&TEST_REMOTE_IPV4).is_none());
// We should have notified the device layer of the failure.
assert_eq!(ctx.get_ref().addr_resolution_failed.as_slice(), [TEST_REMOTE_IPV4]);
} | rust_cleaned_test_functions.jsonl/16994 | {
"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,
2702,
15074,
1288,
4543,
62,
7876,
7893,
368,
341,
1789,
286,
442,
582,
2968,
705,
323,
1513,
944,
4582,
2441,
22683,
9021,
382,
286,
1077,
5206,
5635,
284,
50567,
1972,
486,
2258,
1428,
286,
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... | 2 |
#[test]
fn test_subtract() {
assert_eq!(
parse("- 3 days").unwrap().1,
PeriodOp::Subtract(Period::Day(3))
);
assert_eq!(
parse(" - 3 days").unwrap().1,
PeriodOp::Subtract(Period::Day(3))
);
} | rust_cleaned_test_functions.jsonl/120254 | {
"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,
5228,
2144,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
13645,
220,
18,
2849,
1827,
15454,
1005,
16,
345,
310,
25492,
7125,
486,
3136,
2144,
7,
23750,
486,
10159,
7,
18,
1171,
286,
3475,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hashmap_from_unit() {
assert_de_tokens_error::<HashMap<isize, isize>>(
&[Token::Unit],
"invalid type: unit value, expected a map",
);
} | rust_cleaned_test_functions.jsonl/129542 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 88
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
2186,
5673,
14832,
368,
341,
262,
2060,
2259,
28838,
4096,
27638,
18497,
27,
285,
551,
11,
91373,
97238,
286,
44590,
3323,
486,
4562,
1259,
286,
330,
11808,
943,
25,
4982,
897,
11,
3601,
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 |
#[test]
fn test_dirs_in_deep() {
let gitignore = get_gitignore();
let m = |path: &str, is_dir: bool| {
gitignore.matched_path_or_any_parents(Path::new(path), is_dir)
};
assert!(m("ROOT/parent_dir/dir_deep_00", true).is_ignore());
assert!(m("ROOT/parent_dir/dir_deep_00/file", false).is_ignore());
assert!(m("ROOT/parent_dir/dir_deep_00/child_dir", true).is_ignore());
assert!(
m("ROOT/parent_dir/dir_deep_00/child_dir/file", false).is_ignore()
);
assert!(m("ROOT/parent_dir/dir_deep_01", true).is_ignore());
assert!(m("ROOT/parent_dir/dir_deep_01/file", false).is_ignore());
assert!(m("ROOT/parent_dir/dir_deep_01/child_dir", true).is_ignore());
assert!(
m("ROOT/parent_dir/dir_deep_01/child_dir/file", false).is_ignore()
);
assert!(m("ROOT/parent_dir/dir_deep_02", true).is_none());
assert!(m("ROOT/parent_dir/dir_deep_02/file", false).is_none());
assert!(m("ROOT/parent_dir/dir_deep_02/child_dir", true).is_none());
assert!(m("ROOT/parent_dir/dir_deep_02/child_dir/file", false).is_none());
assert!(m("ROOT/parent_dir/dir_deep_03", true).is_none());
assert!(m("ROOT/parent_dir/dir_deep_03/file", false).is_none());
assert!(m("ROOT/parent_dir/dir_deep_03/child_dir", true).is_none());
assert!(m("ROOT/parent_dir/dir_deep_03/child_dir/file", false).is_none());
assert!(m("ROOT/parent_dir/dir_deep_10", true).is_none());
assert!(m("ROOT/parent_dir/dir_deep_10/file", false).is_none());
assert!(m("ROOT/parent_dir/dir_deep_10/child_dir", true).is_none());
assert!(m("ROOT/parent_dir/dir_deep_10/child_dir/file", false).is_none());
assert!(m("ROOT/parent_dir/dir_deep_11", true).is_none());
assert!(m("ROOT/parent_dir/dir_deep_11/file", false).is_none());
assert!(m("ROOT/parent_dir/dir_deep_11/child_dir", true).is_none());
assert!(m("ROOT/parent_dir/dir_deep_11/child_dir/file", false).is_none());
assert!(m("ROOT/parent_dir/dir_deep_12", true).is_none());
assert!(m("ROOT/parent_dir/dir_deep_12/file", false).is_none());
assert!(m("ROOT/parent_dir/dir_deep_12/child_dir", true).is_none());
assert!(m("ROOT/parent_dir/dir_deep_12/child_dir/file", false).is_none());
assert!(m("ROOT/parent_dir/dir_deep_13", true).is_none());
assert!(m("ROOT/parent_dir/dir_deep_13/file", false).is_none());
assert!(m("ROOT/parent_dir/dir_deep_13/child_dir", true).is_none());
assert!(m("ROOT/parent_dir/dir_deep_13/child_dir/file", false).is_none());
assert!(m("ROOT/parent_dir/dir_deep_20", true).is_ignore());
assert!(m("ROOT/parent_dir/dir_deep_20/file", false).is_ignore());
assert!(m("ROOT/parent_dir/dir_deep_20/child_dir", true).is_ignore());
assert!(
m("ROOT/parent_dir/dir_deep_20/child_dir/file", false).is_ignore()
);
assert!(m("ROOT/parent_dir/dir_deep_21", true).is_ignore());
assert!(m("ROOT/parent_dir/dir_deep_21/file", false).is_ignore());
assert!(m("ROOT/parent_dir/dir_deep_21/child_dir", true).is_ignore());
assert!(
m("ROOT/parent_dir/dir_deep_21/child_dir/file", false).is_ignore()
);
// dir itself doesn't match
assert!(m("ROOT/parent_dir/dir_deep_22", true).is_none());
assert!(m("ROOT/parent_dir/dir_deep_22/file", false).is_ignore());
assert!(m("ROOT/parent_dir/dir_deep_22/child_dir", true).is_ignore());
assert!(
m("ROOT/parent_dir/dir_deep_22/child_dir/file", false).is_ignore()
);
// dir itself doesn't match
assert!(m("ROOT/parent_dir/dir_deep_23", true).is_none());
assert!(m("ROOT/parent_dir/dir_deep_23/file", false).is_ignore());
assert!(m("ROOT/parent_dir/dir_deep_23/child_dir", true).is_ignore());
assert!(
m("ROOT/parent_dir/dir_deep_23/child_dir/file", false).is_ignore()
);
assert!(m("ROOT/parent_dir/dir_deep_30", true).is_ignore());
assert!(m("ROOT/parent_dir/dir_deep_30/file", false).is_ignore());
assert!(m("ROOT/parent_dir/dir_deep_30/child_dir", true).is_ignore());
assert!(
m("ROOT/parent_dir/dir_deep_30/child_dir/file", false).is_ignore()
);
assert!(m("ROOT/parent_dir/dir_deep_31", true).is_ignore());
assert!(m("ROOT/parent_dir/dir_deep_31/file", false).is_ignore());
assert!(m("ROOT/parent_dir/dir_deep_31/child_dir", true).is_ignore());
assert!(
m("ROOT/parent_dir/dir_deep_31/child_dir/file", false).is_ignore()
);
// dir itself doesn't match
assert!(m("ROOT/parent_dir/dir_deep_32", true).is_none());
assert!(m("ROOT/parent_dir/dir_deep_32/file", false).is_ignore());
assert!(m("ROOT/parent_dir/dir_deep_32/child_dir", true).is_ignore());
assert!(
m("ROOT/parent_dir/dir_deep_32/child_dir/file", false).is_ignore()
);
// dir itself doesn't match
assert!(m("ROOT/parent_dir/dir_deep_33", true).is_none());
assert!(m("ROOT/parent_dir/dir_deep_33/file", false).is_ignore());
assert!(m("ROOT/parent_dir/dir_deep_33/child_dir", true).is_ignore());
assert!(
m("ROOT/parent_dir/dir_deep_33/child_dir/file", false).is_ignore()
);
} | rust_cleaned_test_functions.jsonl/117512 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2327
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44869,
1243,
87044,
368,
341,
262,
1077,
16345,
13130,
284,
633,
68801,
13130,
543,
262,
1077,
296,
284,
760,
2343,
25,
609,
495,
11,
374,
4334,
25,
1807,
91,
341,
286,
16345,
13130,
11072,
291,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cli_parse_deploy() {
let test_commands = app("test", "desc", "version");
let default_keypair = Keypair::new();
let keypair_file = make_tmp_path("keypair_file");
write_keypair_file(&default_keypair, &keypair_file).unwrap();
let default_signer = DefaultSigner::new("", &keypair_file);
let test_command = test_commands.clone().get_matches_from(vec![
"test",
"program",
"deploy",
"/Users/test/program.so",
]);
assert_eq!(
parse_command(&test_command, &default_signer, &mut None).unwrap(),
CliCommandInfo {
command: CliCommand::Program(ProgramCliCommand::Deploy {
program_location: Some("/Users/test/program.so".to_string()),
buffer_signer_index: None,
buffer_pubkey: None,
program_signer_index: None,
program_pubkey: None,
upgrade_authority_signer_index: 0,
is_final: false,
max_len: None,
allow_excessive_balance: false,
}),
signers: vec![read_keypair_file(&keypair_file).unwrap().into()],
}
);
let test_command = test_commands.clone().get_matches_from(vec![
"test",
"program",
"deploy",
"/Users/test/program.so",
"--max-len",
"42",
]);
assert_eq!(
parse_command(&test_command, &default_signer, &mut None).unwrap(),
CliCommandInfo {
command: CliCommand::Program(ProgramCliCommand::Deploy {
program_location: Some("/Users/test/program.so".to_string()),
buffer_signer_index: None,
buffer_pubkey: None,
program_signer_index: None,
program_pubkey: None,
upgrade_authority_signer_index: 0,
is_final: false,
max_len: Some(42),
allow_excessive_balance: false,
}),
signers: vec![read_keypair_file(&keypair_file).unwrap().into()],
}
);
let buffer_keypair = Keypair::new();
let buffer_keypair_file = make_tmp_path("buffer_keypair_file");
write_keypair_file(&buffer_keypair, &buffer_keypair_file).unwrap();
let test_command = test_commands.clone().get_matches_from(vec![
"test",
"program",
"deploy",
"--buffer",
&buffer_keypair_file,
]);
assert_eq!(
parse_command(&test_command, &default_signer, &mut None).unwrap(),
CliCommandInfo {
command: CliCommand::Program(ProgramCliCommand::Deploy {
program_location: None,
buffer_signer_index: Some(1),
buffer_pubkey: Some(buffer_keypair.pubkey()),
program_signer_index: None,
program_pubkey: None,
upgrade_authority_signer_index: 0,
is_final: false,
max_len: None,
allow_excessive_balance: false,
}),
signers: vec![
read_keypair_file(&keypair_file).unwrap().into(),
read_keypair_file(&buffer_keypair_file).unwrap().into(),
],
}
);
let program_pubkey = Pubkey::new_unique();
let test = test_commands.clone().get_matches_from(vec![
"test",
"program",
"deploy",
"/Users/test/program.so",
"--program-id",
&program_pubkey.to_string(),
]);
assert_eq!(
parse_command(&test, &default_signer, &mut None).unwrap(),
CliCommandInfo {
command: CliCommand::Program(ProgramCliCommand::Deploy {
program_location: Some("/Users/test/program.so".to_string()),
buffer_signer_index: None,
buffer_pubkey: None,
program_signer_index: None,
program_pubkey: Some(program_pubkey),
upgrade_authority_signer_index: 0,
is_final: false,
max_len: None,
allow_excessive_balance: false,
}),
signers: vec![read_keypair_file(&keypair_file).unwrap().into()],
}
);
let program_keypair = Keypair::new();
let program_keypair_file = make_tmp_path("program_keypair_file");
write_keypair_file(&program_keypair, &program_keypair_file).unwrap();
let test = test_commands.clone().get_matches_from(vec![
"test",
"program",
"deploy",
"/Users/test/program.so",
"--program-id",
&program_keypair_file,
]);
assert_eq!(
parse_command(&test, &default_signer, &mut None).unwrap(),
CliCommandInfo {
command: CliCommand::Program(ProgramCliCommand::Deploy {
program_location: Some("/Users/test/program.so".to_string()),
buffer_signer_index: None,
buffer_pubkey: None,
program_signer_index: Some(1),
program_pubkey: Some(program_keypair.pubkey()),
upgrade_authority_signer_index: 0,
is_final: false,
max_len: None,
allow_excessive_balance: false,
}),
signers: vec![
read_keypair_file(&keypair_file).unwrap().into(),
read_keypair_file(&program_keypair_file).unwrap().into(),
],
}
);
let authority_keypair = Keypair::new();
let authority_keypair_file = make_tmp_path("authority_keypair_file");
write_keypair_file(&authority_keypair, &authority_keypair_file).unwrap();
let test_command = test_commands.clone().get_matches_from(vec![
"test",
"program",
"deploy",
"/Users/test/program.so",
"--upgrade-authority",
&authority_keypair_file,
]);
assert_eq!(
parse_command(&test_command, &default_signer, &mut None).unwrap(),
CliCommandInfo {
command: CliCommand::Program(ProgramCliCommand::Deploy {
program_location: Some("/Users/test/program.so".to_string()),
buffer_signer_index: None,
buffer_pubkey: None,
program_signer_index: None,
program_pubkey: None,
upgrade_authority_signer_index: 1,
is_final: false,
max_len: None,
allow_excessive_balance: false,
}),
signers: vec![
read_keypair_file(&keypair_file).unwrap().into(),
read_keypair_file(&authority_keypair_file).unwrap().into(),
],
}
);
let test_command = test_commands.clone().get_matches_from(vec![
"test",
"program",
"deploy",
"/Users/test/program.so",
"--final",
]);
assert_eq!(
parse_command(&test_command, &default_signer, &mut None).unwrap(),
CliCommandInfo {
command: CliCommand::Program(ProgramCliCommand::Deploy {
program_location: Some("/Users/test/program.so".to_string()),
buffer_signer_index: None,
buffer_pubkey: None,
program_signer_index: None,
program_pubkey: None,
upgrade_authority_signer_index: 0,
is_final: true,
max_len: None,
allow_excessive_balance: false,
}),
signers: vec![read_keypair_file(&keypair_file).unwrap().into()],
}
);
} | rust_cleaned_test_functions.jsonl/22243 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 4650
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47147,
21039,
91890,
368,
341,
286,
1077,
1273,
44151,
284,
906,
445,
1944,
497,
330,
8614,
497,
330,
4366,
3071,
286,
1077,
1638,
3097,
12670,
284,
6569,
1082,
1310,
486,
931,
543,
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... | 1 |
#[test]
fn test_see() {
let mut game = Game::new();
game.create_piece(0, 5, 0);
game.create_piece(1, 5, 2);
game.create_piece(1, 0, 55);
game.create_piece(0, 3, 46);
game.create_piece(0, 0, 37);
game.set_moves();
assert!(
(crate::see(
&mut game,
&PieceMove {
start: 55,
end: 46,
special: SpecialMove::None,
}
) - -4.0)
.abs()
< 0.5
);
} | rust_cleaned_test_functions.jsonl/120653 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 382
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3453,
68,
368,
341,
286,
1077,
5206,
1809,
284,
4050,
486,
931,
543,
286,
1809,
2520,
48470,
7,
15,
11,
220,
20,
11,
220,
15,
317,
286,
1809,
2520,
48470,
7,
16,
11,
220,
20,
11,
220,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_channel_webhooks() {
let route = Route::GetChannelWebhooks {
channel_id: CHANNEL_ID,
};
assert_eq!(
route.to_string(),
format!("channels/{channel_id}/webhooks", channel_id = CHANNEL_ID)
);
} | rust_cleaned_test_functions.jsonl/119877 | {
"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,
3062,
14571,
25960,
38560,
368,
341,
286,
1077,
6021,
284,
9572,
486,
1949,
9629,
5981,
38560,
341,
310,
5496,
842,
25,
58756,
3450,
345,
286,
2605,
286,
2060,
10714,
33673,
310,
6021,
2389,
3904,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_renaming_of_store_instruction() {
let mut instruction =
Instruction::store(variable("x").into(), variable("y").into()).unwrap();
let mut versioning = VariableVersioning::new();
versioning.start_new_scope();
versioning.new_version(&variable("x")).unwrap();
versioning.new_version(&variable("y")).unwrap();
versioning.new_version(&Memory::variable()).unwrap();
instruction.rename_variables(&mut versioning).unwrap();
assert_eq!(
instruction.operation(),
&Operation::Store {
memory_in: memory_ssa(1),
memory_out: memory_ssa(2),
address: variable_ssa("x", 1).into(),
expr: variable_ssa("y", 1).into(),
}
);
} | rust_cleaned_test_functions.jsonl/13496 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 400
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
77,
6469,
3575,
14809,
54923,
368,
341,
1789,
286,
1077,
5206,
7600,
4035,
310,
29051,
486,
4314,
45029,
445,
87,
1827,
18122,
1507,
3890,
445,
88,
1827,
18122,
6011,
15454,
1428,
286,
1077,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_schema_type_thrift_conversion() {
let message_type = "
message conversions {
REQUIRED INT64 id;
OPTIONAL group int_array_Array (LIST) {
REPEATED group list {
OPTIONAL group element (LIST) {
REPEATED group list {
OPTIONAL INT32 element;
}
}
}
}
OPTIONAL group int_map (MAP) {
REPEATED group map (MAP_KEY_VALUE) {
REQUIRED BYTE_ARRAY key (UTF8);
OPTIONAL INT32 value;
}
}
OPTIONAL group int_Map_Array (LIST) {
REPEATED group list {
OPTIONAL group g (MAP) {
REPEATED group map (MAP_KEY_VALUE) {
REQUIRED BYTE_ARRAY key (UTF8);
OPTIONAL group value {
OPTIONAL group H {
OPTIONAL group i (LIST) {
REPEATED group list {
OPTIONAL DOUBLE element;
}
}
}
}
}
}
}
}
OPTIONAL group nested_struct {
OPTIONAL INT32 A;
OPTIONAL group b (LIST) {
REPEATED group list {
REQUIRED FIXED_LEN_BYTE_ARRAY (16) element;
}
}
}
}
";
let expected_schema = parse_message_type(message_type).unwrap();
let thrift_schema = to_thrift(&expected_schema).unwrap();
let result_schema = from_thrift(&thrift_schema).unwrap();
assert_eq!(result_schema, Arc::new(expected_schema));
} | rust_cleaned_test_functions.jsonl/16692 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 872
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25371,
1819,
5854,
41380,
64132,
368,
341,
286,
1077,
1943,
1819,
284,
6228,
262,
1943,
48722,
341,
414,
66577,
9221,
21,
19,
877,
280,
414,
76232,
1874,
526,
3858,
47229,
320,
22852,
8,
341,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_float_32_unpack() {
// Values were printed out from what stb_vorbis
// calculated for this function from a test file.
assert_eq!(float32_unpack(1611661312), 1.000000);
assert_eq!(float32_unpack(1616117760), 5.000000);
assert_eq!(float32_unpack(1618345984), 11.000000);
assert_eq!(float32_unpack(1620115456), 17.000000);
assert_eq!(float32_unpack(1627381760), 255.000000);
assert_eq!(float32_unpack(3759144960), -1.000000);
assert_eq!(float32_unpack(3761242112), -2.000000);
assert_eq!(float32_unpack(3763339264), -4.000000);
assert_eq!(float32_unpack(3763601408), -5.000000);
assert_eq!(float32_unpack(3765436416), -8.000000);
assert_eq!(float32_unpack(3765829632), -11.000000);
assert_eq!(float32_unpack(3768451072), -30.000000);
assert_eq!(float32_unpack(3772628992), -119.000000);
assert_eq!(float32_unpack(3780634624), -1530.000000);
} | rust_cleaned_test_functions.jsonl/33429 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 425
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17586,
62,
18,
17,
54889,
368,
341,
197,
322,
24979,
1033,
16709,
700,
504,
1128,
357,
65,
2273,
29886,
285,
198,
197,
322,
16588,
369,
419,
729,
504,
264,
1273,
1034,
624,
6948,
10714,
10297,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_equality_from_proto_uuid() {
for _ in 0..1000 {
// start with a protobuf Uuid
let pu0 = graplinc_common::Uuid::new();
// Convert it into a uuid::Uuid
let u: uuid::Uuid = pu0.clone().into();
// Then back to a protobuf Uuid
let pu1: graplinc_common::Uuid = u.into();
// Hopefully it hasn't changed
assert_eq!(pu0, pu1);
}
} | rust_cleaned_test_functions.jsonl/88457 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 244
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2204,
10473,
5673,
37689,
25540,
368,
341,
286,
369,
716,
304,
220,
15,
496,
16,
15,
15,
15,
341,
310,
442,
1191,
448,
264,
69634,
547,
2423,
198,
310,
1077,
18256,
15,
284,
67983,
75,
2840,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_announce() -> Result<(), failure::Error> {
let mut m = Metainfo::from_file("data/test.torrent")?;
m.announce = mockito::server_url() + "/announce";
let _mck = mock("GET", Matcher::Any)
.with_status(200)
.with_header("content-type", "text/plain")
.with_body_from_file("data/test_response")
.create();
let r = Client::new();
let mut h = HTTP::new(Arc::new(m), Arc::new(String::from("test")), 1000, &r);
let v = h.get_peers(
&TorrentState {
downloaded: 0,
uploaded: 0,
left: 1000,
},
Some(2),
)?;
let mut it = v.iter();
assert_eq!(v.len(), 2);
assert_eq!(
it.next(),
Some(&PeerInfo {
addr: SocketAddrV4::new(Ipv4Addr::from_str("91.64.137.190").unwrap(), 51413)
})
);
assert_eq!(
it.next(),
Some(&PeerInfo {
addr: SocketAddrV4::new(Ipv4Addr::from_str("92.62.63.75").unwrap(), 6881)
})
);
Ok(())
} | rust_cleaned_test_functions.jsonl/126246 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 669
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51870,
9734,
368,
1464,
5714,
68843,
7901,
486,
1454,
29,
341,
286,
1077,
5206,
296,
284,
6212,
466,
824,
486,
1499,
2458,
445,
691,
12697,
734,
48709,
899,
37445,
286,
296,
13,
65512,
284,
7860... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_if_descendant() {
let path = ActorPath::from("/acme/building/room/sensor");
let parent = path.parent();
assert!(path.is_descendant_of(&parent));
assert!(!path.is_descendant_of(&path));
} | rust_cleaned_test_functions.jsonl/32094 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11119,
10986,
20372,
368,
341,
286,
1077,
1815,
284,
24718,
1820,
486,
1499,
4283,
580,
2660,
30593,
287,
14,
2966,
2687,
3805,
797,
286,
1077,
2681,
284,
1815,
8659,
543,
286,
2060,
10297,
2343,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_flags() {
let table_create = TableCreateCommand::new("Test".to_string())
.flags(vec![(TableFlagType::PatKey), (TableFlagType::KeyWithSIS)]);
let mut arg: HashMap<String, String> = HashMap::new();
arg.insert("flags".to_string(),
"TABLE_PAT_KEY|KEY_WITH_SIS".to_string());
let expected = TableCreateCommand {
command: TableCreate,
name: "Test".to_string(),
arguments: arg,
};
assert_eq!(expected, table_create);
} | rust_cleaned_test_functions.jsonl/74220 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 263
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14130,
368,
341,
286,
1077,
1965,
8657,
284,
6633,
4021,
4062,
486,
931,
445,
2271,
3263,
983,
3904,
2398,
310,
659,
11161,
25592,
0,
9697,
2556,
12135,
929,
486,
27106,
1592,
701,
320,
2556,
12... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_resource_request_error() {
check_parse_error(
p_resource_request,
"",
r#"Parse error
expected Resource identifier at the end of input
expected alphanumeric character at the end of input"#,
);
check_parse_error(
p_resource_request,
"a",
r#"Parse error
expected "=" at the end of input"#,
);
check_parse_error(
p_resource_request,
"a=x",
r#"Parse error
expected Resource amount at character 2: "x"
expected integer at character 2: "x""#,
);
} | rust_cleaned_test_functions.jsonl/107803 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 310
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
17962,
7893,
4096,
368,
341,
286,
1779,
21039,
4096,
1006,
310,
281,
17962,
7893,
345,
310,
8324,
310,
435,
55543,
14463,
1465,
198,
7325,
11765,
12816,
518,
279,
835,
315,
1946,
198,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_primitive_array_lt() {
cmp_i64!(
lt,
lt_dyn,
vec![8, 8, 8, 8, 8, 8, 8, 8, 8, 8],
vec![6, 7, 8, 9, 10, 6, 7, 8, 9, 10],
vec![false, false, false, true, true, false, false, false, true, true]
);
cmp_vec!(
lt,
lt_dyn,
TimestampMillisecondArray,
vec![8, 8, 8, 8, 8, 8, 8, 8, 8, 8],
vec![6, 7, 8, 9, 10, 6, 7, 8, 9, 10],
vec![false, false, false, true, true, false, false, false, true, true]
);
} | rust_cleaned_test_functions.jsonl/98184 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 369
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84087,
3858,
39164,
368,
341,
286,
26089,
5318,
21,
19,
33673,
310,
25175,
345,
310,
25175,
69213,
345,
310,
7486,
20703,
23,
11,
220,
23,
11,
220,
23,
11,
220,
23,
11,
220,
23,
11,
220,
23,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_custom_message_into_policy() {
let message = Message { id: 0, alias: String::from("alias") };
let policy = message.clone().into_policy();
match policy {
CachePolicy::Cacheable(value) => assert_eq!(value, message),
CachePolicy::NonCacheable(_) => assert!(false),
};
} | rust_cleaned_test_functions.jsonl/86728 | {
"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,
15875,
6462,
45514,
22773,
368,
341,
262,
1077,
1943,
284,
4856,
314,
877,
25,
220,
15,
11,
15534,
25,
923,
486,
1499,
445,
14956,
899,
2605,
262,
1077,
4842,
284,
1943,
15997,
1005,
18122,
2277... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_accessors() {
let my_struct = MyTestStruct::new(String::from("Reid"), 25);
assert_eq!(my_struct.name(), "Reid");
assert_eq!(my_struct.age(), &25);
assert_eq!(my_struct.weight(), &None);
assert_eq!(my_struct.married(), &None);
} | rust_cleaned_test_functions.jsonl/117668 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12759,
1087,
368,
341,
262,
1077,
847,
15126,
284,
3017,
2271,
9422,
486,
931,
2242,
486,
1499,
445,
693,
307,
3975,
220,
17,
20,
317,
262,
2060,
10714,
10297,
2408,
15126,
2644,
1507,
330,
693,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_source_data() {
let data: Vec<u8> = Vec::new();
let a = AssetSource::Data(data);
assert_eq!(a.debug_source(), None);
} | rust_cleaned_test_functions.jsonl/12396 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 86
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15446,
10347,
1769,
368,
341,
286,
1077,
821,
25,
11312,
34837,
23,
29,
284,
11312,
486,
931,
543,
286,
1077,
264,
284,
22605,
3608,
486,
1043,
2592,
626,
286,
2060,
10714,
10297,
64,
7883,
1034... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_bf16_consts_from_f32() {
let one = bf16::from_f32(1.0);
let zero = bf16::from_f32(0.0);
let neg_zero = bf16::from_f32(-0.0);
let neg_one = bf16::from_f32(-1.0);
let inf = bf16::from_f32(core::f32::INFINITY);
let neg_inf = bf16::from_f32(core::f32::NEG_INFINITY);
let nan = bf16::from_f32(core::f32::NAN);
assert_eq!(bf16::ONE, one);
assert_eq!(bf16::ZERO, zero);
assert!(zero.is_sign_positive());
assert_eq!(bf16::NEG_ZERO, neg_zero);
assert!(neg_zero.is_sign_negative());
assert_eq!(bf16::NEG_ONE, neg_one);
assert!(neg_one.is_sign_negative());
assert_eq!(bf16::INFINITY, inf);
assert_eq!(bf16::NEG_INFINITY, neg_inf);
assert!(nan.is_nan());
assert!(bf16::NAN.is_nan());
let e = bf16::from_f32(core::f32::consts::E);
let pi = bf16::from_f32(core::f32::consts::PI);
let frac_1_pi = bf16::from_f32(core::f32::consts::FRAC_1_PI);
let frac_1_sqrt_2 = bf16::from_f32(core::f32::consts::FRAC_1_SQRT_2);
let frac_2_pi = bf16::from_f32(core::f32::consts::FRAC_2_PI);
let frac_2_sqrt_pi = bf16::from_f32(core::f32::consts::FRAC_2_SQRT_PI);
let frac_pi_2 = bf16::from_f32(core::f32::consts::FRAC_PI_2);
let frac_pi_3 = bf16::from_f32(core::f32::consts::FRAC_PI_3);
let frac_pi_4 = bf16::from_f32(core::f32::consts::FRAC_PI_4);
let frac_pi_6 = bf16::from_f32(core::f32::consts::FRAC_PI_6);
let frac_pi_8 = bf16::from_f32(core::f32::consts::FRAC_PI_8);
let ln_10 = bf16::from_f32(core::f32::consts::LN_10);
let ln_2 = bf16::from_f32(core::f32::consts::LN_2);
let log10_e = bf16::from_f32(core::f32::consts::LOG10_E);
let log10_2 = bf16::from_f32(2f32.log10());
let log2_e = bf16::from_f32(core::f32::consts::LOG2_E);
let log2_10 = bf16::from_f32(10f32.log2());
let sqrt_2 = bf16::from_f32(core::f32::consts::SQRT_2);
assert_eq!(bf16::E, e);
assert_eq!(bf16::PI, pi);
assert_eq!(bf16::FRAC_1_PI, frac_1_pi);
assert_eq!(bf16::FRAC_1_SQRT_2, frac_1_sqrt_2);
assert_eq!(bf16::FRAC_2_PI, frac_2_pi);
assert_eq!(bf16::FRAC_2_SQRT_PI, frac_2_sqrt_pi);
assert_eq!(bf16::FRAC_PI_2, frac_pi_2);
assert_eq!(bf16::FRAC_PI_3, frac_pi_3);
assert_eq!(bf16::FRAC_PI_4, frac_pi_4);
assert_eq!(bf16::FRAC_PI_6, frac_pi_6);
assert_eq!(bf16::FRAC_PI_8, frac_pi_8);
assert_eq!(bf16::LN_10, ln_10);
assert_eq!(bf16::LN_2, ln_2);
assert_eq!(bf16::LOG10_E, log10_e);
assert_eq!(bf16::LOG10_2, log10_2);
assert_eq!(bf16::LOG2_E, log2_e);
assert_eq!(bf16::LOG2_10, log2_10);
assert_eq!(bf16::SQRT_2, sqrt_2);
} | rust_cleaned_test_functions.jsonl/4207 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1662
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
69,
16,
21,
48530,
5673,
761,
18,
17,
368,
341,
286,
1077,
825,
284,
39093,
16,
21,
486,
1499,
761,
18,
17,
7,
16,
13,
15,
317,
286,
1077,
7168,
284,
39093,
16,
21,
486,
1499,
761,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_option_rule() {
let rule: BinProtRule = serde_json::from_str(OPTION_RULE).unwrap();
let example_none = vec![0x00]; // None
let mut de =
Deserializer::from_reader(Cursor::new(example_none.as_slice())).with_layout(&rule);
let result: Value = Deserialize::deserialize(&mut de).expect("Failed to deserialize");
println!("{:?}", result);
assert_eq!(result, Value::Option(None));
test_reserialize(&result, &example_none);
let example_some = vec![0x01, 0x07];
let mut de =
Deserializer::from_reader(Cursor::new(example_some.as_slice())).with_layout(&rule);
let result: Value = Deserialize::deserialize(&mut de).expect("Failed to deserialize");
assert_eq!(result, Value::Option(Some(Box::new(Value::Int(0x07)))));
test_reserialize(&result, &example_some);
} | rust_cleaned_test_functions.jsonl/134755 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 391
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9672,
21124,
368,
341,
286,
1077,
5912,
25,
29344,
12423,
11337,
284,
61570,
9455,
486,
1499,
2895,
19238,
6578,
50495,
568,
15454,
1428,
286,
1077,
3110,
31488,
284,
7486,
20703,
15,
87,
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_split_num_prefixed_chunks_by_bytes() {
let (at, mut ucmd) = testing(UTIL_NAME);
let name = "split_num_prefixed_chunks_by_bytes";
let glob = Glob::new(&at, ".", r"a\d\d$");
RandomFile::new(&at, name).add_bytes(10000);
assert!(ucmd.args(&["-d", "-b", "1000", name, "a"]).run().success);
assert_eq!(glob.count(), 10);
assert_eq!(glob.collate(), at.read(name).into_bytes());
} | rust_cleaned_test_functions.jsonl/25135 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
4273,
43331,
3286,
65470,
3710,
12524,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
7497,
7,
36969,
4708,
317,
262,
1077,
829,
284,
330,
6960,
4273,
43331,
3286,
65470,
371... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_array_alignment() {
let ptr = alloc::allocate_aligned::<u8>(8);
let buf = unsafe { Buffer::from_raw_parts(ptr, 8, 8) };
let buf2 = buf.slice(1);
let array_data = ArrayData::builder(DataType::Int32).add_buffer(buf2).build();
Int32Array::from(array_data);
} | rust_cleaned_test_functions.jsonl/3851 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84087,
3858,
51006,
368,
341,
286,
1077,
10087,
284,
5574,
486,
31191,
66385,
27638,
84,
23,
2235,
23,
317,
286,
1077,
6607,
284,
19860,
314,
10312,
486,
1499,
16067,
33217,
23866,
11,
220,
23,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pairing_result_against_relic() {
assert_eq!(Bls12::pairing(G1::one(), G2::one()), Fq12 {
c0: Fq6 {
c0: Fq2 {
c0: Fq::from_str("2819105605953691245277803056322684086884703000473961065716485506033588504203831029066448642358042597501014294104502").unwrap(),
c1: Fq::from_str("1323968232986996742571315206151405965104242542339680722164220900812303524334628370163366153839984196298685227734799").unwrap()
},
c1: Fq2 {
c0: Fq::from_str("2987335049721312504428602988447616328830341722376962214011674875969052835043875658579425548512925634040144704192135").unwrap(),
c1: Fq::from_str("3879723582452552452538684314479081967502111497413076598816163759028842927668327542875108457755966417881797966271311").unwrap()
},
c2: Fq2 {
c0: Fq::from_str("261508182517997003171385743374653339186059518494239543139839025878870012614975302676296704930880982238308326681253").unwrap(),
c1: Fq::from_str("231488992246460459663813598342448669854473942105054381511346786719005883340876032043606739070883099647773793170614").unwrap()
}
},
c1: Fq6 {
c0: Fq2 {
c0: Fq::from_str("3993582095516422658773669068931361134188738159766715576187490305611759126554796569868053818105850661142222948198557").unwrap(),
c1: Fq::from_str("1074773511698422344502264006159859710502164045911412750831641680783012525555872467108249271286757399121183508900634").unwrap()
},
c1: Fq2 {
c0: Fq::from_str("2727588299083545686739024317998512740561167011046940249988557419323068809019137624943703910267790601287073339193943").unwrap(),
c1: Fq::from_str("493643299814437640914745677854369670041080344349607504656543355799077485536288866009245028091988146107059514546594").unwrap()
},
c2: Fq2 {
c0: Fq::from_str("734401332196641441839439105942623141234148957972407782257355060229193854324927417865401895596108124443575283868655").unwrap(),
c1: Fq::from_str("2348330098288556420918672502923664952620152483128593484301759394583320358354186482723629999370241674973832318248497").unwrap()
}
}
});
} | rust_cleaned_test_functions.jsonl/39354 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1262
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14445,
287,
5287,
62427,
267,
1288,
415,
368,
341,
14808,
262,
2060,
10714,
10297,
33,
4730,
16,
17,
486,
12670,
287,
6699,
16,
486,
603,
1507,
479,
17,
486,
603,
11858,
434,
80,
16,
17,
341,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_level_filter_de_error() {
let msg = "unknown variant `errorx`, expected one of \
`OFF`, `FATAL`, `ERROR`, `WARN`, `INFO`, `DEBUG`, `TRACE`";
assert_de_tokens_error::<LevelFilter>(&[level_filter_token("errorx")], msg);
} | rust_cleaned_test_functions.jsonl/91802 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 130
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8274,
8727,
2259,
4096,
368,
341,
286,
1077,
3750,
284,
330,
16088,
11424,
1565,
841,
87,
7808,
3601,
825,
315,
3044,
4293,
1565,
27068,
7808,
1565,
37,
30074,
7808,
1565,
3682,
7808,
1565,
74858,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_table() -> Result<()> {
let connection = "postgres://postgres:password@localhost:5432/postgres";
let schema = Schema::new(vec![
Field::new("c1", DataType::Boolean, true),
Field::new("c2", DataType::Boolean, false),
Field::new("c5", DataType::Int16, true),
Field::new("c6", DataType::Int16, false),
Field::new("c7", DataType::Int32, true),
Field::new("c8", DataType::Int32, false),
Field::new("c9", DataType::Int64, true),
Field::new("c10", DataType::Int64, false),
Field::new("c11", DataType::Float32, true),
Field::new("c12", DataType::Float32, false),
Field::new("c13", DataType::Float64, true),
Field::new("c14", DataType::Float64, false),
Field::new("c15", DataType::Binary, true),
Field::new("c16", DataType::Binary, false),
Field::new("c17", DataType::Utf8, true),
Field::new("c18", DataType::Utf8, false),
]);
Postgres::create_table(connection, "t1", &Arc::new(schema.clone()))?;
let read_schema = Postgres::get_table_schema(connection, "t1")?;
assert_eq!(schema, read_schema);
Ok(())
} | rust_cleaned_test_functions.jsonl/46439 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 644
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
5237,
368,
1464,
5714,
71698,
341,
286,
1077,
3633,
284,
330,
43070,
1110,
43070,
25,
3833,
31,
8301,
25,
20,
19,
18,
17,
29996,
17818,
876,
286,
1077,
10802,
284,
12539,
486,
931,
25592,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_object() {
let j = r#"{"key": "value",
"key2": "value2",
"object1": {"object_key1": "object_value1"},
"key3": "value3"}"#
.as_bytes();
assert_eq!(Parser::from_reader(j).collect::<Result<Vec<_>>>().unwrap(),
vec![Event::Start(Block::Object),
Event::Key("key".to_string()),
Event::String("value".to_string()),
Event::Key("key2".to_string()),
Event::String("value2".to_string()),
Event::Key("object1".to_string()),
Event::Start(Block::Object),
Event::Key("object_key1".to_string()),
Event::String("object_value1".to_string()),
Event::End(Block::Object),
Event::Key("key3".to_string()),
Event::String("value3".to_string()),
Event::End(Block::Object)])
} | rust_cleaned_test_functions.jsonl/12580 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 562
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5314,
368,
341,
262,
1077,
502,
284,
435,
55543,
4913,
792,
788,
330,
957,
756,
394,
330,
792,
17,
788,
330,
957,
17,
756,
394,
330,
1700,
16,
788,
5212,
1700,
3097,
16,
788,
330,
1700,
3142... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_fn_mul_args() {
let code = String::from("fn: main21(arg: int, noarg: int) ~ int {}");
let mut lexer = Token::lexer(code.as_str());
let parser = Parser::new(code.clone());
let decl_res = parser.parse_fn_decl(&mut lexer);
assert!(decl_res.is_ok());
if let Declaration::Function(fn_decl) = decl_res.unwrap() {
assert_eq!(fn_decl.name, String::from("main21"));
assert_eq!(fn_decl.arguments.len(), 2);
assert!(fn_decl.code_block.is_some());
}
} | rust_cleaned_test_functions.jsonl/43200 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 229
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
15246,
24944,
8384,
368,
341,
262,
1077,
2038,
284,
923,
486,
1499,
445,
8822,
25,
1887,
17,
16,
9404,
25,
526,
11,
902,
858,
25,
526,
8,
3968,
526,
4687,
797,
262,
1077,
5206,
53259,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_number_from_string() {
assert_de_tokens_error::<isize>(
&[Token::Str("1")],
"invalid type: string \"1\", expected isize",
);
} | rust_cleaned_test_functions.jsonl/129545 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 84
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5500,
5673,
3904,
368,
341,
262,
2060,
2259,
28838,
4096,
27638,
285,
551,
17055,
286,
44590,
3323,
486,
2580,
445,
16,
899,
1259,
286,
330,
11808,
943,
25,
914,
7245,
16,
16215,
3601,
91373,
75... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_checked() {
let a = Int32Array::from(&[None, Some(6), None, Some(6)]);
let b = Int32Array::from(&[Some(5), None, None, Some(6)]);
let result = checked_sub(&a, &b).unwrap();
let expected = Int32Array::from(&[None, None, None, Some(0)]);
assert_eq!(result, expected);
let a = Int8Array::from(&[Some(100i8), Some(-100i8), Some(100i8)]);
let b = Int8Array::from(&[Some(1i8), Some(100i8), Some(0i8)]);
let result = checked_sub(&a, &b).unwrap();
let expected = Int8Array::from(&[Some(99i8), None, Some(100i8)]);
assert_eq!(result, expected);
// Trait testing
let result = a.checked_sub(&b).unwrap();
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/23355 | {
"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,
5228,
56456,
368,
341,
286,
1077,
264,
284,
1333,
18,
17,
1857,
486,
1499,
2099,
58,
4064,
11,
4329,
7,
21,
701,
2240,
11,
4329,
7,
21,
41958,
286,
1077,
293,
284,
1333,
18,
17,
1857,
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_validate_checksum() {
ensure_env_logger_initialized();
let evtx_file = include_bytes!("../samples/security.evtx");
let chunk_data =
evtx_file[EVTX_FILE_HEADER_SIZE..EVTX_FILE_HEADER_SIZE + EVTX_CHUNK_SIZE].to_vec();
let chunk = EvtxChunkData::new(chunk_data, false).unwrap();
assert!(chunk.validate_checksum());
} | rust_cleaned_test_functions.jsonl/93705 | {
"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,
42681,
64038,
368,
341,
286,
5978,
15879,
27413,
62421,
543,
286,
1077,
3637,
3998,
2458,
284,
2924,
12524,
17223,
1244,
41118,
71422,
77343,
3998,
797,
286,
1077,
11879,
1769,
4035,
310,
3637,
3998... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_error() {
const INITIAL: &[u8] = b"abcdef123456";
let mut rbuf = vec![0; 4];
let mut f = tempfile().unwrap();
f.write_all(INITIAL).unwrap();
let mut aiocb = AioCb::from_mut_slice( f.as_raw_fd(),
-1, //an invalid offset
&mut rbuf,
0, //priority
SigevNotify::SigevNone,
LioOpcode::LIO_NOP);
assert!(aiocb.read().is_err());
} | rust_cleaned_test_functions.jsonl/90411 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 313
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
4096,
368,
341,
262,
733,
56854,
25,
44590,
84,
23,
60,
284,
293,
1,
41202,
16,
17,
18,
19,
20,
21,
876,
262,
1077,
5206,
435,
5909,
284,
7486,
20703,
15,
26,
220,
19,
935,
262,
1077... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_error_streaming_response() {
let engine = TestEngineBuilder::new().build().unwrap();
let read_pool = build_read_pool_for_test(engine.clone());
let cop = Endpoint::<RocksEngine>::new(&Config::default(), read_pool);
// Fail immediately
let handler_builder = Box::new(|_, _: &_| {
Ok(StreamFixture::new(vec![Err(Error::Other(box_err!("foo")))]).into_boxed())
});
let resp_vec = cop
.handle_stream_request(ReqContext::default_for_test(), handler_builder)
.unwrap()
.collect()
.wait()
.unwrap();
assert_eq!(resp_vec.len(), 1);
assert_eq!(resp_vec[0].get_data().len(), 0);
assert!(!resp_vec[0].get_other_error().is_empty());
// Fail after some success responses
let mut responses = Vec::new();
for i in 0..5 {
let mut resp = coppb::Response::default();
resp.set_data(vec![1, 2, i]);
responses.push(Ok(resp));
}
responses.push(Err(Error::Other(box_err!("foo"))));
let handler_builder = Box::new(|_, _: &_| Ok(StreamFixture::new(responses).into_boxed()));
let resp_vec = cop
.handle_stream_request(ReqContext::default_for_test(), handler_builder)
.unwrap()
.collect()
.wait()
.unwrap();
assert_eq!(resp_vec.len(), 6);
for i in 0..5 {
assert_eq!(resp_vec[i].get_data(), [1, 2, i as u8]);
}
assert_eq!(resp_vec[5].get_data().len(), 0);
assert!(!resp_vec[5].get_other_error().is_empty());
} | rust_cleaned_test_functions.jsonl/40861 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 821
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4096,
12673,
287,
9655,
368,
341,
286,
1077,
4712,
284,
3393,
4571,
3297,
486,
931,
1005,
5834,
1005,
15454,
543,
286,
1077,
1349,
15709,
284,
1936,
6443,
15709,
5478,
4452,
48974,
15997,
1423,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_parser() {
let data =
r#"
{
"comment_rule": true,
"fullstop_rule": true,
"indentation_rule": true,
"blank_lines_rule": true,
"blank_lines_amount": 5
}
"#;
let test_settings: Settings = serde_json::from_str(data).expect("json string was wrongkly formatted!");
assert_eq!(test_settings.comment_rule, true);
assert_eq!(test_settings.fullstop_rule, true);
assert_eq!(test_settings.indentation_rule, true);
assert_eq!(test_settings.blank_lines_rule, true);
assert_eq!(test_settings.blank_lines_amount, 5);
} | rust_cleaned_test_functions.jsonl/59770 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 340
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18517,
368,
972,
286,
1077,
821,
32203,
286,
435,
2,
5031,
286,
972,
688,
330,
6182,
21124,
788,
830,
1871,
688,
330,
8878,
9495,
21124,
788,
830,
1871,
688,
330,
32840,
367,
21124,
788,
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_resolve_all_refs() -> Result<()> {
let doc_file = VMWARE_SPEC;
let spec = &Spec::read_files(&[&doc_file])?;
for (doc_file, api) in spec.docs() {
let refs = spec::openapi::get_references(doc_file, api);
for rs in refs {
match rs {
TypedReference::PathItem(_) => {}
TypedReference::Example(_) => {}
TypedReference::Parameter(reference) => {
spec.resolve_parameter_ref(&doc_file, reference)?;
}
TypedReference::Schema(reference) => {
spec.resolve_schema_ref(&doc_file, reference)?;
}
}
}
}
Ok(())
} | rust_cleaned_test_functions.jsonl/45100 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 388
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77291,
5705,
60638,
368,
1464,
5714,
71698,
341,
262,
1077,
4629,
2458,
284,
17792,
7663,
36436,
280,
262,
1077,
1398,
284,
609,
8327,
486,
878,
10931,
2099,
58,
5,
5236,
2458,
2467,
37445,
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... | 7 |
#[test]
fn test_read_options() {
let path = tempdir_with_prefix("_rust_rocksdb_write_options");
let db = DB::open_default(path.path().to_str().unwrap()).unwrap();
let mut read_opts = ReadOptions::new();
read_opts.set_verify_checksums(true);
read_opts.fill_cache(true);
read_opts.set_tailing(true);
read_opts.set_pin_data(true);
read_opts.set_background_purge_on_iterator_cleanup(true);
read_opts.set_ignore_range_deletions(true);
read_opts.set_max_skippable_internal_keys(0);
read_opts.set_readahead_size(0);
read_opts.set_read_tier(0);
db.put(b"k1", b"a").unwrap();
db.put(b"k2", b"b").unwrap();
db.put(b"k3", b"c").unwrap();
let keys = vec![b"k1", b"k2", b"k3"];
let mut iter = db.iter_opt(read_opts);
iter.seek(SeekKey::Key(b"k1")).unwrap();
let mut key_count = 0;
while iter.valid().unwrap() {
assert_eq!(keys[key_count], iter.key());
key_count = key_count + 1;
iter.next().unwrap();
}
assert!(key_count == 3);
} | rust_cleaned_test_functions.jsonl/34127 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 488
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
8743,
368,
341,
262,
1077,
1815,
284,
2730,
3741,
6615,
13974,
16975,
35788,
26608,
14553,
1999,
9165,
8743,
797,
262,
1077,
2927,
284,
5952,
486,
2508,
9993,
5581,
3875,
1005,
983,
2895,
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... | 2 |
#[test]
fn test_verify_invalid_message() {
let mut stark_key =
hex!("077a4b314db07c45076d11f62b6f9e748a39790441823307743cf00d6597ea43");
let mut msg_hash = hex!("0397e76d1667c4454bfb83514e120583af836f8e32a516765497823eabe16a3f");
let mut r_bytes = hex!("0173fd03d8b008ee7432977ac27d1e9d1a1f6c98b1a2f05fa84a21c84c44e882");
let mut s_bytes = hex!("01f2c44a7798f55192f153b4c48ea5c1241fbb69e6132cc8a0da9c5b62a4286e");
// Little endian
stark_key.reverse();
msg_hash.reverse();
r_bytes.reverse();
s_bytes.reverse();
assert_eq!(verify(&stark_key, &msg_hash, &r_bytes, &s_bytes), false);
} | rust_cleaned_test_functions.jsonl/73604 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 379
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35638,
31433,
6462,
368,
341,
286,
1077,
5206,
37146,
3097,
4035,
310,
12371,
17223,
15,
22,
22,
64,
19,
65,
18,
16,
19,
1999,
15,
22,
66,
19,
20,
15,
22,
21,
67,
16,
16,
69,
21,
17,
65,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_process_push_update() {
let mut contact_info_table = ContactInfoTable::default();
let mut push = NodeTbleGspPush::default();
let mut ci = ContactInfo::new_localhost(&BvmAddr::new_rand(), 0);
ci.wallclock = 0;
let value_old = ContInfTblValue::ContactInfo(ci.clone());
// push a new message
assert_eq!(
push.process_push_message(&mut contact_info_table, value_old.clone(), 0),
Ok(None)
);
// push an old version
ci.wallclock = 1;
let value = ContInfTblValue::ContactInfo(ci.clone());
assert_eq!(
push.process_push_message(&mut contact_info_table, value, 0)
.unwrap()
.unwrap()
.value,
value_old
);
} | rust_cleaned_test_functions.jsonl/120871 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 408
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
14218,
8882,
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,
520... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_transport_type_tcp() {
unsafe {
let mut error = 0;
let error_ptr = &mut error as *mut c_int;
let address_listener = CString::new("/ip4/127.0.0.1/tcp/0").unwrap();
let address_listener_str: *const c_char = CString::into_raw(address_listener) as *const c_char;
let _transport = transport_tcp_create(address_listener_str, error_ptr);
assert_eq!(error, 0);
}
} | rust_cleaned_test_functions.jsonl/66625 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 236
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46398,
1819,
45562,
368,
341,
286,
19860,
341,
310,
1077,
5206,
1465,
284,
220,
15,
280,
310,
1077,
1465,
4348,
284,
609,
6984,
1465,
438,
353,
6984,
272,
4042,
280,
310,
1077,
2621,
46493,
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_request() {
use helix::*;
let req = GetGamesRequest::builder()
.id(vec!["493057".to_string()])
.build();
// From twitch docs
let data = br#"
{
"data": [
{
"box_art_url": "https://static-cdn.jtvnw.net/ttv-boxart/Fortnite-52x72.jpg",
"id": "33214",
"name": "Fortnite"
},
{
"box_art_url": "https://static-cdn.jtvnw.net/ttv-boxart/Fortnite-52x72.jpg",
"id": "33214",
"name": "Fortnite"
}
],
"pagination": {
"cursor": "eyJiIjpudWxsLCJhIjp7IkN"
}
}
"#
.to_vec();
let http_response = http::Response::builder().body(data).unwrap();
let uri = req.get_uri().unwrap();
assert_eq!(
uri.to_string(),
"https://api.twitch.tv/helix/games?id=493057"
);
dbg!(GetGamesRequest::parse_response(Some(req), &uri, http_response).unwrap());
} | rust_cleaned_test_functions.jsonl/56455 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 499
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7893,
368,
341,
262,
990,
11338,
941,
56162,
262,
1077,
4232,
284,
2126,
35807,
1900,
486,
17850,
741,
286,
659,
307,
25592,
0,
1183,
19,
24,
18,
15,
20,
22,
3263,
983,
3904,
56024,
286,
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_operand_display() {
assert_eq!(
format!(
"{}",
dr::Operand::FunctionControl(spirv::FunctionControl::INLINE)
),
"INLINE",
);
assert_eq!(format!("{}", dr::Operand::IdRef(3)), "%3");
assert_eq!(format!("{}", dr::Operand::LiteralInt32(3)), "3");
} | rust_cleaned_test_functions.jsonl/49207 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 210
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
69259,
14825,
368,
341,
286,
2060,
10714,
33673,
310,
3561,
33673,
394,
35503,
756,
394,
1353,
486,
29940,
486,
5152,
3273,
1141,
5565,
85,
486,
5152,
3273,
486,
55737,
340,
310,
2837,
310,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sse_interpolator_64() {
let mut rng = rand::thread_rng();
let mut wave = Vec::new();
for _ in 0..2048 {
wave.push(rng.gen::<f64>());
}
let sinc_len = 256;
let f_cutoff = 0.9473371669037001;
let oversampling_factor = 256;
let window = WindowFunction::BlackmanHarris2;
let sincs = make_sincs::<f64>(sinc_len, oversampling_factor, f_cutoff, window);
let interpolator =
SseInterpolator::<f64>::new(sinc_len, oversampling_factor, f_cutoff, window).unwrap();
let value = interpolator.get_sinc_interpolated(&wave, 333, 123);
let check = get_sinc_interpolated(&wave, 333, &sincs[123]);
assert!((value - check).abs() < 1.0e-9);
} | rust_cleaned_test_functions.jsonl/131814 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 376
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
325,
15318,
57736,
62,
21,
19,
368,
341,
286,
1077,
5206,
28422,
284,
10382,
486,
4528,
66849,
543,
286,
1077,
5206,
12060,
284,
11312,
486,
931,
543,
286,
369,
716,
304,
220,
15,
496,
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... | 2 |
#[test]
fn test_json5_parse_number() {
let json: Value = cm_json::from_json5_str("1").expect("couldn't parse");
if let Value::Number(n) = json {
assert!(n.is_i64());
} else {
panic!("{:?} is not a number", json);
}
} | rust_cleaned_test_functions.jsonl/2891 | {
"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,
9455,
20,
21039,
5500,
368,
341,
286,
1077,
2951,
25,
5162,
284,
9961,
9455,
486,
1499,
9455,
20,
2895,
445,
16,
1827,
17119,
445,
90962,
944,
4715,
797,
286,
421,
1077,
5162,
486,
2833,
1445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_js() {
run_in_task(|mut cx| {
let (mut isolate, _dispatch_count) = setup(Mode::Async);
js_check(
isolate.execute(
"shared_queue_test.js",
include_str!("shared_queue_test.js"),
),
);
if let Poll::Ready(Err(_)) = isolate.poll_unpin(&mut cx) {
unreachable!();
}
});
} | rust_cleaned_test_functions.jsonl/972 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 191
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26250,
368,
341,
262,
1598,
1243,
12184,
22428,
6984,
20716,
91,
341,
414,
1077,
320,
6984,
42123,
11,
716,
18274,
3180,
8,
284,
6505,
3189,
534,
486,
6525,
317,
414,
6994,
7200,
1006,
286,
4212... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_aggregate_commitment_for_vote_account_1() {
let ancestors = vec![3, 4, 5, 7, 9, 11];
let mut commitment = HashMap::new();
let lamports = 5;
let mut vote_state = VoteState::default();
let root = ancestors.last().unwrap();
vote_state.root_slot = Some(*root);
AggregateCommitmentService::aggregate_commitment_for_vote_account(
&mut commitment,
&vote_state,
&ancestors,
lamports,
);
for a in ancestors {
let mut expected = BlockCommitment::default();
expected.increase_confirmation_stake(MAX_LOCKOUT_HISTORY, lamports);
assert_eq!(*commitment.get(&a).unwrap(), expected);
}
} | rust_cleaned_test_functions.jsonl/65258 | {
"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,
20587,
14240,
36346,
478,
5478,
54360,
13500,
62,
16,
368,
341,
286,
1077,
37518,
284,
7486,
20703,
18,
11,
220,
19,
11,
220,
20,
11,
220,
22,
11,
220,
24,
11,
220,
16,
16,
935,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_verify_secp256k1_sha256_tai_bad_message() {
let mut vrf = ECVRF::from_suite(CipherSuite::SECP256K1_SHA256_TAI).unwrap();
let y = hex::decode("032c8c31fc9f990c6b55e3865a184a4ce50e09481f2eaeb3e60ec1cea13a6ae645")
.unwrap();
// VRF proof
let pi = hex::decode("031f4dbca087a1972d04a07a779b7df1caa99e0f5db2aa21f3aecc4f9e10e85d0800851b42ee92f76d98c1f19e4a1e855526b20afe0dd6eb232a493adc107eb2b0f1").unwrap();
// Verify the proof with a different message will fail
// The original message was "sample"
let alpha2 = b"notsample".to_vec();
assert!(vrf.verify(&y, &pi, &alpha2).is_err());
} | rust_cleaned_test_functions.jsonl/112470 | {
"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,
35638,
3453,
4672,
17,
20,
21,
74,
16,
48836,
17,
20,
21,
528,
2143,
34199,
6462,
368,
341,
286,
1077,
5206,
348,
8052,
284,
468,
19589,
17612,
486,
1499,
57239,
3025,
10558,
28000,
486,
925,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_guild_integration() {
let route = Route::CreateGuildIntegration { guild_id: GUILD_ID };
assert_eq!(
route.to_string(),
format!("guilds/{guild_id}/integrations", guild_id = GUILD_ID)
);
} | rust_cleaned_test_functions.jsonl/119856 | {
"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,
1889,
1498,
90250,
368,
341,
286,
1077,
6021,
284,
9572,
486,
4021,
72574,
52464,
314,
26411,
842,
25,
479,
18023,
3450,
2605,
286,
2060,
10714,
33673,
310,
6021,
2389,
3904,
3148,
310,
3561... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_args_model() {
let mut args = Args::new();
assert_eq!(ModelName::SG, args.model());
args.set_model(ModelName::CBOW);
assert_eq!(ModelName::CBOW, args.model());
} | rust_cleaned_test_functions.jsonl/118609 | {
"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,
8384,
5047,
368,
341,
286,
1077,
5206,
2827,
284,
17693,
486,
931,
543,
286,
2060,
10714,
10297,
1712,
675,
486,
7783,
11,
2827,
3192,
5231,
286,
2827,
980,
5047,
26442,
675,
486,
12979,
3307,
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 |
#[test]
fn test_modified_added() -> Result<()> {
// Given
let entry = given_entry("file.txt");
// When
let stats = Stats {
added: vec![&entry],
removed: vec![],
updated: vec![],
updated_bitrot: vec![],
moved: Default::default(),
unchanged: vec![],
total: 1,
};
// Then
assert_eq!(stats.modified(), true);
Ok(())
} | rust_cleaned_test_functions.jsonl/4099 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 259
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37749,
37653,
368,
1464,
5714,
71698,
341,
286,
442,
16246,
198,
286,
1077,
4343,
284,
2661,
9078,
445,
1192,
3909,
3071,
286,
442,
3197,
198,
286,
1077,
10472,
284,
29927,
341,
310,
3694,
25,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_check_latency_async_block_on() {
delay();
let mut runtime = tokio::runtime::Runtime::new().unwrap();
let client: Public<ASync> = Public::new(SANDBOX_URL);
let _ = runtime.block_on(client.get_time()).unwrap();
let time = Instant::now();
let _ = runtime.block_on(client.get_time()).unwrap();
let time = time.elapsed().subsec_millis();
dbg!(time);
if time > 150 {
panic!("{} > 100", time);
}
} | rust_cleaned_test_functions.jsonl/50639 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 196
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
74832,
28346,
7113,
4470,
368,
341,
262,
7626,
543,
262,
1077,
5206,
15592,
284,
9628,
815,
486,
22255,
486,
15123,
486,
931,
1005,
15454,
543,
262,
1077,
2943,
25,
3066,
27,
1911,
1721,
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... | 2 |
#[test]
fn test_urdf_viz_web_client_config_accessor() {
let mut config = UrdfVizWebClientConfig {
name: "test".to_owned(),
joint_names: vec!["j1".to_owned(), "j2".to_owned()],
wrap_with_joint_velocity_limiter: true,
joint_velocity_limits: vec![1.0, 2.0],
};
assert_eq!(config.name, "test");
assert_eq!(config.joint_names[0], "j1");
assert_eq!(config.joint_names[1], "j2");
assert_eq!(config.wrap_with_joint_velocity_limiter, true);
assert_approx_eq!(config.joint_velocity_limits[0], 1.0);
assert_approx_eq!(config.joint_velocity_limits[1], 2.0);
config.name = "arm".to_owned();
config.joint_names = vec!["shoulder_pan_joint".to_owned(), "elbow_joint".to_owned()];
config.wrap_with_joint_velocity_limiter = false;
config.joint_velocity_limits = vec![0.0, 0.0];
assert_eq!(config.name, "arm");
assert_eq!(config.joint_names[0], "shoulder_pan_joint");
assert_eq!(config.joint_names[1], "elbow_joint");
assert_eq!(config.wrap_with_joint_velocity_limiter, false);
assert_approx_eq!(config.joint_velocity_limits[0], 0.0);
assert_approx_eq!(config.joint_velocity_limits[1], 0.0);
} | rust_cleaned_test_functions.jsonl/119541 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 542
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64879,
2940,
2273,
449,
25960,
8179,
5332,
33901,
368,
341,
262,
1077,
5206,
2193,
284,
16809,
2940,
53,
449,
5981,
2959,
2648,
341,
286,
829,
25,
330,
1944,
3263,
983,
51973,
3148,
286,
10284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lexicographic_largest() {
assert!(!bool::from(Fp::zero().lexicographically_largest()));
assert!(!bool::from(Fp::one().lexicographically_largest()));
assert!(!bool::from(
Fp::from_raw_unchecked([
0xa1fa_ffff_fffe_5557,
0x995b_fff9_76a3_fffe,
0x03f4_1d24_d174_ceb4,
0xf654_7998_c199_5dbd,
0x778a_468f_507a_6034,
0x0205_5993_1f7f_8103
])
.lexicographically_largest()
));
assert!(bool::from(
Fp::from_raw_unchecked([
0x1804_0000_0001_5554,
0x8550_0005_3ab0_0001,
0x633c_b57c_253c_276f,
0x6e22_d1ec_31eb_b502,
0xd391_6126_f2d1_4ca2,
0x17fb_b857_1a00_6596,
])
.lexicographically_largest()
));
assert!(bool::from(
Fp::from_raw_unchecked([
0x43f5_ffff_fffc_aaae,
0x32b7_fff2_ed47_fffd,
0x07e8_3a49_a2e9_9d69,
0xeca8_f331_8332_bb7a,
0xef14_8d1e_a0f4_c069,
0x040a_b326_3eff_0206,
])
.lexicographically_largest()
));
} | rust_cleaned_test_functions.jsonl/23237 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 736
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74547,
292,
12679,
907,
32381,
368,
341,
262,
2060,
0,
3471,
2641,
486,
1499,
7832,
79,
486,
14154,
1005,
2571,
292,
63931,
907,
32381,
7392,
262,
2060,
0,
3471,
2641,
486,
1499,
7832,
79,
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_connector() {
let mut connector: Connector = Connector::new(50.0);
assert_eq!(connector.status(), ConnectorStatus::WaitingOnInput);
let mut items = Table::new();
let item = items.insert(ItemKindBuilder::new().with_name(LocalString::from_str("item")).build(), "item".to_string());
let stack = ItemStack { item, quantity: 1 };
let stack_insert_result = connector.insert_stack(stack);
assert!(matches!(stack_insert_result, InsertItemStackResult::StackConsumed));
for _ in 0..10 {
// This assertion is before the tick because we want to check its state
// before moving.
assert_eq!(connector.status(), ConnectorStatus::Traveling);
connector.tick();
}
assert_eq!(connector.status(), ConnectorStatus::WaitingOnOutput);
let _ = connector.take_stack();
for _ in 0..10 {
assert_eq!(connector.status(), ConnectorStatus::Traveling);
connector.tick();
}
// And to complete the trip!
assert_eq!(connector.status(), ConnectorStatus::WaitingOnInput);
} | rust_cleaned_test_functions.jsonl/106950 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 495
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
76393,
368,
341,
286,
1077,
5206,
26989,
25,
54814,
284,
54814,
486,
931,
7,
20,
15,
13,
15,
626,
286,
2060,
10714,
10297,
53700,
4299,
1507,
54814,
2522,
486,
42104,
1925,
2505,
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... | 3 |
#[test]
fn test_holder_vs_counterparty_dust_limit() {
// dust limits are used.
let feeest = TestFeeEstimator{fee_est: 15000};
let secp_ctx = Secp256k1::new();
let seed = [42; 32];
let network = Network::Testnet;
let keys_provider = test_utils::TestKeysInterface::new(&seed, network);
let logger = test_utils::TestLogger::new();
// they have different dust limits.
// Create Node A's channel pointing to Node B's pubkey
let node_b_node_id = PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[42; 32]).unwrap());
let config = UserConfig::default();
let mut node_a_chan = Channel::<EnforcingSigner>::new_outbound(&&feeest, &&keys_provider, node_b_node_id, &InitFeatures::known(), 10000000, 100000, 42, &config, 0).unwrap();
// Create Node B's channel by receiving Node A's open_channel message
// Make sure A's dust limit is as we expect.
let open_channel_msg = node_a_chan.get_open_channel(genesis_block(network).header.block_hash());
let node_b_node_id = PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[7; 32]).unwrap());
let node_b_chan = Channel::<EnforcingSigner>::new_from_req(&&feeest, &&keys_provider, node_b_node_id, &InitFeatures::known(), &open_channel_msg, 7, &config, 0, &&logger).unwrap();
let mut accept_channel_msg = node_b_chan.get_accept_channel();
accept_channel_msg.dust_limit_satoshis = 546;
node_a_chan.accept_channel(&accept_channel_msg, &config, &InitFeatures::known()).unwrap();
node_a_chan.holder_dust_limit_satoshis = 1560;
// Put some inbound and outbound HTLCs in A's channel.
let htlc_amount_msat = 11_092_000; // put an amount below A's effective dust limit but above B's.
node_a_chan.pending_inbound_htlcs.push(InboundHTLCOutput {
htlc_id: 0,
amount_msat: htlc_amount_msat,
payment_hash: PaymentHash(Sha256::hash(&[42; 32]).into_inner()),
cltv_expiry: 300000000,
state: InboundHTLCState::Committed,
});
node_a_chan.pending_outbound_htlcs.push(OutboundHTLCOutput {
htlc_id: 1,
amount_msat: htlc_amount_msat, // put an amount below A's dust amount but above B's.
payment_hash: PaymentHash(Sha256::hash(&[43; 32]).into_inner()),
cltv_expiry: 200000000,
state: OutboundHTLCState::Committed,
source: HTLCSource::OutboundRoute {
path: Vec::new(),
session_priv: SecretKey::from_slice(&hex::decode("0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").unwrap()[..]).unwrap(),
first_hop_htlc_msat: 548,
payment_id: PaymentId([42; 32]),
payment_secret: None,
payee: None,
}
});
// the dust limit check.
let htlc_candidate = HTLCCandidate::new(htlc_amount_msat, HTLCInitiator::LocalOffered);
let local_commit_tx_fee = node_a_chan.next_local_commit_tx_fee_msat(htlc_candidate, None);
let local_commit_fee_0_htlcs = Channel::<EnforcingSigner>::commit_tx_fee_msat(node_a_chan.feerate_per_kw, 0, node_a_chan.opt_anchors());
assert_eq!(local_commit_tx_fee, local_commit_fee_0_htlcs);
// of the HTLCs are seen to be above the dust limit.
node_a_chan.channel_transaction_parameters.is_outbound_from_holder = false;
let remote_commit_fee_3_htlcs = Channel::<EnforcingSigner>::commit_tx_fee_msat(node_a_chan.feerate_per_kw, 3, node_a_chan.opt_anchors());
let htlc_candidate = HTLCCandidate::new(htlc_amount_msat, HTLCInitiator::LocalOffered);
let remote_commit_tx_fee = node_a_chan.next_remote_commit_tx_fee_msat(htlc_candidate, None);
assert_eq!(remote_commit_tx_fee, remote_commit_fee_3_htlcs);
} | rust_cleaned_test_functions.jsonl/15101 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1389
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
50788,
42434,
15730,
32957,
814,
590,
14763,
368,
341,
2394,
197,
197,
322,
15797,
13388,
525,
1483,
624,
197,
10217,
11060,
477,
284,
3393,
41941,
13782,
13689,
90,
30017,
18583,
25,
220,
16,
20,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_get_file_extension_from_file_meta_line() {
assert_eq!(
get_file_extension_from_file_meta_line_file_path("a/src/parse.rs"),
Some("rs")
);
assert_eq!(
get_file_extension_from_file_meta_line_file_path("b/src/pa rse.rs"),
Some("rs")
);
assert_eq!(
get_file_extension_from_file_meta_line_file_path("src/pa rse.rs"),
Some("rs")
);
assert_eq!(
get_file_extension_from_file_meta_line_file_path("wat hello.rs"),
Some("rs")
);
assert_eq!(
get_file_extension_from_file_meta_line_file_path("/dev/null"),
None
);
assert_eq!(
get_file_extension_from_file_meta_line_file_path("Dockerfile"),
Some("Dockerfile")
);
assert_eq!(
get_file_extension_from_file_meta_line_file_path("Makefile"),
Some("Makefile")
);
assert_eq!(
get_file_extension_from_file_meta_line_file_path("a/src/Makefile"),
Some("Makefile")
);
assert_eq!(
get_file_extension_from_file_meta_line_file_path("src/Makefile"),
Some("Makefile")
);
} | rust_cleaned_test_functions.jsonl/108154 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 713
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
2458,
31035,
5673,
2458,
13381,
6528,
368,
341,
286,
2060,
10714,
33673,
310,
633,
2458,
31035,
5673,
2458,
13381,
6528,
2458,
2638,
445,
64,
13437,
14,
6400,
25638,
4461,
310,
4329,
445,
54... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sql_compare_example() -> Result<()> {
let v_integer = SqlValue::NotNull(NnSqlValue::Integer(42));
let v_smallint = SqlValue::NotNull(NnSqlValue::SmallInt(42));
let v_bigint = SqlValue::NotNull(NnSqlValue::BigInt(42));
let v_integer_minus = SqlValue::NotNull(NnSqlValue::Integer(-42));
let v_text = SqlValue::NotNull(NnSqlValue::Text("abc".to_string()));
let v_null = SqlValue::Null;
assert!(matches!(
v_integer.sql_compare(&v_integer)?,
SqlCompareResult::Eq
));
assert!(matches!(
v_smallint.sql_compare(&v_bigint)?,
SqlCompareResult::Eq
));
assert!(matches!(
v_integer.sql_compare(&v_integer_minus)?,
SqlCompareResult::GreaterThan
));
assert!(matches!(
v_integer_minus.sql_compare(&v_integer)?,
SqlCompareResult::LessThan
));
assert!(matches!(
v_null.sql_compare(&v_integer)?,
SqlCompareResult::Null
));
assert!(matches!(
v_integer.sql_compare(&v_null)?,
SqlCompareResult::Null
));
assert!(matches!(
v_null.sql_compare(&v_null)?,
SqlCompareResult::Null
));
assert!(matches!(
v_integer
.sql_compare(&v_text)
.expect_err("comparing totally different types"),
SpringError::Sql(_),
));
Ok(())
} | rust_cleaned_test_functions.jsonl/40002 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 824
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18063,
32235,
39304,
368,
1464,
5714,
71698,
341,
286,
1077,
348,
31725,
284,
7224,
1130,
486,
11005,
8204,
77,
8269,
1130,
486,
3486,
7,
19,
17,
1106,
286,
1077,
348,
31966,
396,
284,
7224,
113... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
#[test]
fn test_categorize() {
let config = Config::from_string_for_test(
r#"
{
"sources": {
"src/js": "public",
"src/js/internal": "internal",
"src/vendor": "public",
"src/custom": "with_custom_generated_dir"
},
"projects": {
"public": {
"schema": "graphql/public.graphql"
},
"internal": {
"schema": "graphql/__generated__/internal.graphql"
},
"with_custom_generated_dir": {
"schema": "graphql/__generated__/custom.graphql",
"output": "graphql/custom-generated"
}
}
}
"#,
)
.unwrap();
let categorizer = FileCategorizer::from_config(&config);
assert_eq!(
categorizer.categorize(&"src/js/a.js".into()),
FileGroup::Source {
source_set: SourceSet::SourceSetName("public".intern()),
},
);
assert_eq!(
categorizer.categorize(&"src/js/nested/b.js".into()),
FileGroup::Source {
source_set: SourceSet::SourceSetName("public".intern()),
},
);
assert_eq!(
categorizer.categorize(&"src/js/internal/nested/c.js".into()),
FileGroup::Source {
source_set: SourceSet::SourceSetName("internal".intern()),
},
);
assert_eq!(
// even if it has same dirname in path as custom output folder.
// Path is only categorized as generated if it matches the absolute path
// of the provided custom output.
categorizer.categorize(&"src/custom/custom-generated/c.js".into()),
FileGroup::Source {
source_set: SourceSet::SourceSetName("with_custom_generated_dir".intern()),
},
);
assert_eq!(
categorizer.categorize(&"src/js/internal/nested/__generated__/c.js".into()),
FileGroup::Generated {
project_name: "internal".intern()
},
);
assert_eq!(
categorizer.categorize(&"graphql/custom-generated/c.js".into()),
FileGroup::Generated {
project_name: "with_custom_generated_dir".intern()
},
);
assert_eq!(
categorizer.categorize(&"graphql/public.graphql".into()),
FileGroup::Schema {
project_set: ProjectSet::ProjectName("public".intern())
},
);
assert_eq!(
categorizer.categorize(&"graphql/__generated__/internal.graphql".into()),
FileGroup::Schema {
project_set: ProjectSet::ProjectName("internal".intern())
},
);
} | rust_cleaned_test_functions.jsonl/18363 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1745
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
7593,
551,
368,
341,
286,
1077,
2193,
284,
5532,
486,
1499,
3904,
5478,
4452,
1006,
310,
435,
2,
698,
394,
341,
503,
330,
39651,
788,
341,
664,
330,
3548,
9113,
788,
330,
888,
756,
664,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sharder() {
let shards: Vec<_> = (1000..1000000).collect();
let shard_config = ShardConfig {
specific_targets: vec![MatcherToShard {
matcher: Matcher {
table_name_regex: Some(Regex::new("pu$").unwrap()),
predicate: None,
},
shard: 1,
}],
hash_ring: Some(HashRing {
table_name: true,
columns: vec!["t1", "t2", "f1", "f2"]
.into_iter()
.map(|i| i.to_string())
.collect(),
shards: ConsistentHasher::new(&shards),
}),
..Default::default()
};
// hit the specific targets
let line = parse_line("cpu,t1=1,t2=2,t3=3 f1=1,f2=2,f3=3 10");
let sharded_line = shard_config.shard(&line).expect("cannot shard a line");
assert_eq!(sharded_line, 1);
let line = parse_line("cpu,t1=10,t2=20,t3=30 f1=10,f2=20,f3=30 10");
let sharded_line = shard_config.shard(&line).expect("cannot shard a line");
assert_eq!(sharded_line, 1);
// hit the hash ring
let line = parse_line("mem,t1=1,t2=2,t3=3 f1=1,f2=2,f3=3 10");
let sharded_line = shard_config.shard(&line).expect("cannot shard a line");
assert_eq!(sharded_line, 710570);
// change a column that is not part of the hashring columns
let line = parse_line("mem,t1=1,t2=2,t3=30 f1=1,f2=2,f3=3 10");
let sharded_line = shard_config.shard(&line).expect("cannot shard a line");
assert_eq!(sharded_line, 710570);
// change a column that is part of the hashring
let line = parse_line("mem,t1=10,t2=2,t3=3 f1=1,f2=2,f3=3 10");
let sharded_line = shard_config.shard(&line).expect("cannot shard a line");
assert_eq!(sharded_line, 342220);
// ensure columns can be optional and yet cannot be mixed up
let line = parse_line("mem,t1=10,t3=3 f1=1,f2=2,f3=3 10");
let sharded_line = shard_config.shard(&line).expect("cannot shard a line");
assert_eq!(sharded_line, 494892);
let line = parse_line("mem,t2=10,t3=3 f1=1,f2=2,f3=3 10");
let sharded_line = shard_config.shard(&line).expect("cannot shard a line");
assert_eq!(sharded_line, 32813);
// same thing for "fields" columns:
// change a column that is not part of the hashring columns
let line = parse_line("mem,t1=1,t2=2,t3=3 f1=1,f2=2,f3=30 10");
let sharded_line = shard_config.shard(&line).expect("cannot shard a line");
assert_eq!(sharded_line, 710570);
// change a column that is part of the hashring
let line = parse_line("mem,t1=10,t2=2,t3=3 f1=1,f2=2,f3=3 10");
let sharded_line = shard_config.shard(&line).expect("cannot shard a line");
assert_eq!(sharded_line, 342220);
// ensure columns can be optional and yet cannot be mixed up
let line = parse_line("mem,t1=1,t3=3 f1=10,f2=2,f3=3 10");
let sharded_line = shard_config.shard(&line).expect("cannot shard a line");
assert_eq!(sharded_line, 49366);
let line = parse_line("mem,t2=1,t3=3 f1=10,f2=2,f3=3 10");
let sharded_line = shard_config.shard(&line).expect("cannot shard a line");
assert_eq!(sharded_line, 637504);
} | rust_cleaned_test_functions.jsonl/1249 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1727
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3712,
567,
261,
368,
341,
286,
1077,
74110,
25,
11312,
32399,
29,
284,
320,
16,
15,
15,
15,
496,
16,
15,
15,
15,
15,
15,
15,
568,
17384,
543,
286,
1077,
52069,
5332,
284,
95366,
2648,
341,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_no_minutes() {
let clock = Clock::new(6, 41).add_minutes(0);
assert_eq!(clock.to_string(), "06:41");
} | rust_cleaned_test_functions.jsonl/5362 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 66
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
6536,
67655,
368,
341,
262,
1077,
8866,
284,
26142,
486,
931,
7,
21,
11,
220,
19,
16,
568,
718,
67655,
7,
15,
317,
262,
2060,
10714,
10297,
20666,
2389,
3904,
1507,
330,
15,
21,
25,
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 |
#[test]
fn test_default() {
let dm: DashMap<u32, u32> = DashMap::default();
dm.insert(0, 0);
assert_eq!(dm.get(&0).unwrap().value(), &0);
} | rust_cleaned_test_functions.jsonl/1512 | {
"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,
9993,
368,
341,
286,
1077,
28676,
25,
36670,
2227,
34837,
18,
17,
11,
575,
18,
17,
29,
284,
36670,
2227,
486,
2258,
1428,
286,
28676,
7030,
7,
15,
11,
220,
15,
626,
286,
2060,
10714,
10297,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_empty_settings_frame() {
let frame = SettingsFrame::default();
let mut b = Vec::new();
b.write_frame(frame.clone()).unwrap();
assert_eq!(b, [0, 0, 0, 4, 0, 0, 0, 0, 0]);
let mut sl = &b[..];
let res = match sl.read_frame().unwrap() {
FrameKind::Settings(frame) => frame,
_ => panic!("Wrong frame type"),
};
assert_eq!(frame, res);
} | rust_cleaned_test_functions.jsonl/93804 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 223
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
10853,
8929,
368,
341,
286,
1077,
4034,
284,
11296,
4369,
486,
2258,
543,
286,
1077,
5206,
293,
284,
11312,
486,
931,
543,
286,
293,
3836,
8929,
15046,
15997,
6011,
15454,
543,
286,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_shift_jis_decode_all() {
let input = include_bytes!("test_data/shift_jis_in.txt");
let expectation = include_str!("test_data/shift_jis_in_ref.txt");
let (cow, had_errors) = SHIFT_JIS.decode_without_bom_handling(input);
assert!(had_errors, "Should have had errors.");
assert_eq!(&cow[..], expectation);
} | rust_cleaned_test_functions.jsonl/74968 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22230,
5374,
285,
15227,
5705,
368,
341,
286,
1077,
1946,
284,
2924,
12524,
17223,
1944,
1769,
14,
13418,
5374,
285,
1243,
3909,
797,
286,
1077,
30193,
284,
2924,
2895,
17223,
1944,
1769,
14,
1341... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_entry_either() {
// check that trying to build an EntryEither with mismatching IpAddr
let subnet_v4 = Subnet::new(Ipv4Addr::new([192, 168, 0, 0]), 24).unwrap().into();
let subnet_v6 =
Subnet::new(Ipv6Addr::new([1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0]), 64)
.unwrap()
.into();
let entry_v4: EntryDest<_, ()> = EntryDest::Remote {
next_hop: SpecifiedAddr::new(Ipv4Addr::new([192, 168, 0, 1])).unwrap(),
}
.into_ip_addr();
let entry_v6: EntryDest<_, ()> = EntryDest::Remote {
next_hop: SpecifiedAddr::new(Ipv6Addr::new([
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
]))
.unwrap(),
}
.into_ip_addr();
assert!(EntryEither::new(subnet_v4, entry_v6).is_none());
assert!(EntryEither::new(subnet_v6, entry_v4).is_none());
let valid_v4 = EntryEither::new(subnet_v4, entry_v4).unwrap();
let valid_v6 = EntryEither::new(subnet_v6, entry_v6).unwrap();
// check that the split produces results requal to the generating parts:
assert_eq!((subnet_v4, entry_v4), valid_v4.into_subnet_dest());
assert_eq!((subnet_v6, entry_v6), valid_v6.into_subnet_dest());
} | rust_cleaned_test_functions.jsonl/117338 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 693
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9078,
2204,
2485,
368,
341,
286,
442,
1779,
429,
4460,
311,
1936,
458,
15788,
49244,
448,
35301,
287,
35033,
13986,
8945,
286,
1077,
51457,
2273,
19,
284,
3719,
4711,
486,
931,
8972,
30168,
19,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_connection_state_machine_connected() {
let state = connected_state(ConnectionRole::Server);
let expected = vec![
(ConnectionState::Listening, true),
(connecting_state(), false),
(connected_state(ConnectionRole::Server), false),
(connected_state(ConnectionRole::Client), false),
];
verify_state_transitions(state, expected);
let state = connected_state(ConnectionRole::Client);
let expected = vec![
(ConnectionState::Listening, false),
(connecting_state(), true),
(connected_state(ConnectionRole::Server), false),
(connected_state(ConnectionRole::Client), false),
];
verify_state_transitions(state, expected);
} | rust_cleaned_test_functions.jsonl/134575 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 330
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15866,
4387,
38695,
43276,
368,
341,
286,
1077,
1584,
284,
8433,
4387,
47218,
9030,
486,
5475,
317,
286,
1077,
3601,
284,
7486,
90515,
310,
320,
4526,
1397,
486,
54931,
11,
830,
1326,
310,
320,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_word() {
{
let code = r#"hallo"#;
let tokenization_result = tokenize(code);
let tokens = tokenization_result.unwrap();
assert_eq_code_and_tokens_length(code, &tokens);
assert!(tokens.len() == 1);
let token = &tokens[0];
assert!(token.id == TokenId::Word);
assert!(token.index == 0);
assert!(token.length == 5);
}
} | rust_cleaned_test_functions.jsonl/116442 | {
"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,
13533,
368,
341,
286,
341,
310,
1077,
2038,
284,
435,
55543,
11866,
385,
57676,
401,
310,
1077,
3950,
2022,
5287,
284,
77651,
15842,
317,
310,
1077,
11211,
284,
3950,
2022,
5287,
55395,
1428,
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_grounded_negated_dot_comparison() -> TestResult {
let p = Polar::new();
let mut q = p.new_query("x in _ and not x.a = q and x = {}", false)?;
assert_query_done!(q);
let mut q = p.new_query("x in _ and not q = x.a and x = {}", false)?;
assert_query_done!(q);
let mut q = p.new_query("x in _ and not q = x.a and x = {a: q}", false)?;
let bindings = next_binding(&mut q)?;
let expd = term!(Value::Dictionary(dict!(
btreemap! { sym!("a") => var!("q") }
)));
assert_eq!(bindings.get(&sym!("x")).unwrap(), &expd);
let mut q = p.new_query("x in _ and not x.a = q and x = {a: q}", false)?;
let bindings = next_binding(&mut q)?;
let expd = term!(Value::Dictionary(dict!(
btreemap! { sym!("a") => var!("q") }
)));
assert_eq!(bindings.get(&sym!("x")).unwrap(), &expd);
Ok(())
} | rust_cleaned_test_functions.jsonl/63056 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 473
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1889,
43991,
28209,
657,
30941,
90797,
368,
1464,
3393,
2077,
341,
286,
1077,
281,
284,
55896,
486,
931,
1428,
286,
1077,
5206,
2804,
284,
281,
4618,
5738,
445,
87,
304,
716,
323,
537,
856,
5849... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.