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_matches_did() {
let did: IotaDID = IotaDID::new(b"").unwrap();
assert!(Network::matches_did(Network::Mainnet, &did));
assert!(!Network::matches_did(Network::Devnet, &did));
let did: IotaDID = IotaDID::new_with_network(b"", "main").unwrap();
assert!(Network::matches_did(Network::Mainnet, &did));
assert!(!Network::matches_did(Network::Devnet, &did));
let did: IotaDID = IotaDID::new_with_network(b"", "dev").unwrap();
assert!(Network::matches_did(Network::Devnet, &did));
assert!(!Network::matches_did(Network::Mainnet, &did));
} | rust_cleaned_test_functions.jsonl/64591 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 247
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38344,
814,
307,
368,
341,
262,
1077,
1521,
25,
358,
6089,
35,
915,
284,
358,
6089,
35,
915,
486,
931,
1883,
1,
1827,
15454,
543,
262,
2060,
10297,
12320,
486,
19914,
814,
307,
77623,
486,
620... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stream_fin_after_headers_and_a_empty_data_frame() {
let (mut hconn, mut peer_conn, request_stream_id) = connect_and_send_request();
// Send some good data wo fin
let data = &[
// headers
0x01, 0x06, 0x00, 0x00, 0xd9, 0x54, 0x01, 0x33, // data
0x00, 0x00,
];
let _ = peer_conn.conn.stream_send(request_stream_id, data);
// ok NOW send fin
peer_conn.conn.stream_close_send(request_stream_id).unwrap();
let out = peer_conn.conn.process(None, now());
hconn.process(out.dgram(), now());
// Recv HeaderReady with fin.
let http_events = hconn.events();
for e in http_events {
match e {
Http3Event::HeaderReady { stream_id } => {
assert_eq!(stream_id, request_stream_id);
let h = hconn.read_response_headers(stream_id);
assert_eq!(
h,
Ok((
vec![
(String::from(":status"), String::from("200")),
(String::from("content-length"), String::from("3"))
],
true
))
);
}
Http3Event::DataReadable { .. } => {
panic!("We should not receive a DataGeadable event!");
}
_ => {}
};
}
// Stream should now be closed and gone
let mut buf = [0u8; 100];
assert_eq!(
hconn.read_response_data(now(), 0, &mut buf),
Err(Error::InvalidStreamId)
);
} | rust_cleaned_test_functions.jsonl/10945 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1019
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12673,
39737,
19844,
26719,
8378,
4306,
15124,
1769,
8929,
368,
341,
286,
1077,
320,
6984,
305,
5148,
11,
5206,
14397,
17241,
11,
1681,
12673,
842,
8,
284,
4564,
8378,
13565,
7893,
543,
286,
442,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_longest_increasing_path() {
assert_eq!(
Solution::longest_increasing_path(vec![vec![9, 9, 4], vec![6, 6, 8], vec![2, 1, 1]]),
4
);
assert_eq!(
Solution::longest_increasing_path(vec![vec![3, 4, 5], vec![3, 2, 6], vec![2, 2, 1]]),
4
);
assert_eq!(Solution::longest_increasing_path(vec![vec![1]]), 1);
} | rust_cleaned_test_functions.jsonl/131002 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 234
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17799,
477,
1243,
75462,
2638,
368,
341,
286,
2060,
10714,
33673,
310,
12478,
486,
4825,
477,
1243,
75462,
2638,
25592,
20703,
4083,
20703,
24,
11,
220,
24,
11,
220,
19,
1125,
7486,
20703,
21,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_head() -> Result<()> {
let (_td, repo) = repo_init()?;
let root = repo.path().parent().unwrap();
let repo_path = root.as_os_str().to_str().unwrap();
assert_eq!(get_head(repo_path).is_ok(), true);
Ok(())
} | rust_cleaned_test_functions.jsonl/36670 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 135
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13138,
368,
1464,
5714,
71698,
341,
286,
1077,
5453,
1296,
11,
15867,
8,
284,
15867,
6137,
94136,
286,
1077,
3704,
284,
15867,
3875,
1005,
3765,
1005,
15454,
543,
286,
1077,
15867,
2638,
284,
3704... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_nal_iter() {
let sps_pps_idr = [
0x00, 0x00, 0x00, 0x01, 0x67, 0x4d, 0x00, 0x28, 0xf4, 0x03, 0xc0, 0x11, 0x3f, 0x2a,
0x00, 0x00, 0x00, 0x01, 0x68, 0xee, 0x38, 0x80, 0x00, 0x00, 0x00, 0x01, 0x65, 0x88,
0x84, 0x01,
];
let iter = H264NalIter { data: &sps_pps_idr, pos: 0 };
let result: Vec<H264Nal<'_>> = iter.collect();
assert_eq!(result[0].kind, H264NalKind::SPS);
assert_eq!(result[1].kind, H264NalKind::PPS);
assert_eq!(result[2].kind, H264NalKind::IDR);
} | rust_cleaned_test_functions.jsonl/37441 | {
"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,
1089,
278,
11723,
368,
341,
286,
1077,
978,
82,
31600,
82,
842,
81,
284,
2278,
310,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
16,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fr() {
let mut rng = ark_std::test_rng();
for _ in 0..ITERATIONS {
let a: Fr = UniformRand::rand(&mut rng);
let b: Fr = UniformRand::rand(&mut rng);
field_test(a, b);
primefield_test::<Fr>();
sqrt_field_test(b);
}
} | rust_cleaned_test_functions.jsonl/65015 | {
"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,
41537,
368,
341,
262,
1077,
5206,
28422,
284,
55217,
15656,
486,
1944,
66849,
543,
262,
369,
716,
304,
220,
15,
496,
24733,
21792,
341,
286,
1077,
264,
25,
2869,
284,
47889,
56124,
486,
11335,
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_single_tuple_encode() {
// derived from python impl
assert_eq!(&(1,).to_vec(), &1.to_vec());
assert_eq!(&(1, (1,)).to_vec(), &[21, 1, 5, 21, 1, 0]);
assert_eq!(&(1, (1, (1,))).to_vec(), &[21, 1, 5, 21, 1, 5, 21, 1, 0, 0]);
assert_eq!(
&(1, (1,), (1,)).to_vec(),
&[21, 1, 5, 21, 1, 0, 5, 21, 1, 0]
);
} | rust_cleaned_test_functions.jsonl/127225 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 295
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19487,
21773,
11224,
368,
341,
286,
442,
14257,
504,
10135,
11605,
198,
286,
2060,
10714,
0,
29089,
16,
11,
568,
983,
13251,
1507,
609,
16,
2389,
13251,
5231,
16885,
286,
2060,
10714,
0,
29089,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_modules() {
let options = CommonOptions::from_iter_safe(vec!["foo", "--wasi-modules=default"]).unwrap();
assert_eq!(
options.wasi_modules.unwrap(),
WasiModules {
wasi_common: true,
wasi_nn: false,
wasi_crypto: false
}
);
} | rust_cleaned_test_functions.jsonl/73302 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 205
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9993,
15848,
368,
341,
286,
1077,
2606,
284,
7718,
3798,
486,
1499,
11723,
34067,
25592,
0,
1183,
7975,
497,
14482,
86,
10215,
61079,
92628,
45014,
15454,
543,
286,
2060,
10714,
33673,
310,
2606,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sparse_i32() {
let mut builder = UnionBuilder::new_sparse(7);
builder.append::<Int32Type>("a", 1).unwrap();
builder.append::<Int32Type>("b", 2).unwrap();
builder.append::<Int32Type>("c", 3).unwrap();
builder.append::<Int32Type>("a", 4).unwrap();
builder.append::<Int32Type>("c", 5).unwrap();
builder.append::<Int32Type>("a", 6).unwrap();
builder.append::<Int32Type>("b", 7).unwrap();
let union = builder.build().unwrap();
let expected_type_ids = vec![0_i8, 1, 2, 0, 2, 0, 1];
let expected_array_values = [1_i32, 2, 3, 4, 5, 6, 7];
// Check type ids
assert_eq!(
Buffer::from_slice_ref(&expected_type_ids),
union.data().buffers()[0]
);
for (i, id) in expected_type_ids.iter().enumerate() {
assert_eq!(id, &union.type_id(i));
}
assert_eq!(union.data().buffers().len(), 1);
// Check data
assert_eq!(
union.data().child_data()[0].buffers()[0],
Buffer::from_slice_ref(&[1_i32, 0, 0, 4, 0, 6, 0]),
);
assert_eq!(
Buffer::from_slice_ref(&[0_i32, 2_i32, 0, 0, 0, 0, 7]),
union.data().child_data()[1].buffers()[0]
);
assert_eq!(
Buffer::from_slice_ref(&[0_i32, 0, 3_i32, 0, 5, 0, 0]),
union.data().child_data()[2].buffers()[0]
);
assert_eq!(expected_array_values.len(), union.len());
for (i, expected_value) in expected_array_values.iter().enumerate() {
assert_eq!(false, union.is_null(i));
let slot = union.value(i);
let slot = slot.as_any().downcast_ref::<Int32Array>().unwrap();
assert_eq!(slot.len(), 1);
let value = slot.value(0);
assert_eq!(expected_value, &value);
}
} | rust_cleaned_test_functions.jsonl/25635 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 989
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71123,
5318,
18,
17,
368,
341,
286,
1077,
5206,
7363,
284,
9145,
3297,
486,
931,
71123,
7,
22,
317,
286,
7363,
2057,
27638,
1072,
18,
17,
929,
13211,
64,
497,
220,
16,
568,
15454,
543,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_update_many() {
// Use a length of inputs that will exercise all of the power-of-two loops.
const LEN: usize = 2 * guts::MAX_DEGREE - 1;
// different spot each time.
let mut input = [0; LEN * BLOCKBYTES];
paint_test_input(&mut input);
for start_offset in 0..LEN {
let mut inputs: [&[u8]; LEN] = [&[]; LEN];
for i in 0..LEN {
let chunks = (i + start_offset) % LEN;
inputs[i] = &input[..chunks * BLOCKBYTES];
}
let mut params: ArrayVec<Params, LEN> = ArrayVec::new();
for i in 0..LEN {
let mut p = Params::new();
p.node_offset(i as u64);
if i % 2 == 1 {
p.last_node(true);
p.key(b"foo");
}
params.push(p);
}
let mut states: ArrayVec<State, LEN> = ArrayVec::new();
for i in 0..LEN {
states.push(params[i].to_state());
}
update_many(states.iter_mut().zip(inputs.iter()));
update_many(states.iter_mut().zip(inputs.iter()));
// Check the outputs.
for i in 0..LEN {
let mut reference_state = params[i].to_state();
reference_state.update(inputs[i]);
reference_state.update(inputs[i]);
assert_eq!(reference_state.finalize(), states[i].finalize());
assert_eq!(2 * inputs[i].len() as Count, states[i].count());
}
}
} | rust_cleaned_test_functions.jsonl/41746 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 923
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
22101,
368,
341,
286,
442,
5443,
264,
3084,
315,
11127,
429,
686,
10158,
678,
315,
279,
2355,
8668,
37402,
29753,
624,
286,
733,
83099,
25,
22301,
284,
220,
17,
353,
64873,
486,
10586,
288... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_neg() {
let a = Polynomial::new(coefficients![1f32, 3.0, 3.0, 0.0]);
let expected = coefficients![-1f32, -3.0, -3.0, 0.0];
let b = -&a;
assert_eq!(b.coeffs(), expected);
// -Polynomial
let b = -a;
assert_eq!(b.coeffs(), expected);
} | rust_cleaned_test_functions.jsonl/106881 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28209,
368,
972,
197,
10217,
264,
284,
75153,
486,
931,
67018,
28142,
20703,
16,
69,
18,
17,
11,
220,
18,
13,
15,
11,
220,
18,
13,
15,
11,
220,
15,
13,
15,
12006,
197,
10217,
3601,
284,
36... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lzma() {
let tdir = TmpDir::new();
tdir.test_rw("test.lzma", [CompressType::Lzma, CompressType::Lzma], false);
} | rust_cleaned_test_functions.jsonl/95084 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 70
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
907,
89,
1728,
368,
341,
197,
10217,
259,
3741,
284,
350,
1307,
6184,
486,
931,
543,
197,
76373,
404,
5958,
49566,
445,
1944,
918,
89,
1728,
497,
508,
1092,
1873,
929,
486,
43,
89,
1728,
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 |
#[test]
fn test_or() -> Result<(), TestingError> {
VMTestRunner::new()
.add(PushConst::new(0.into(), ScalarType::Boolean))
.add(PushConst::new(0.into(), ScalarType::Boolean))
.add(Or)
.add(PushConst::new(0.into(), ScalarType::Boolean))
.add(PushConst::new(1.into(), ScalarType::Boolean))
.add(Or)
.add(PushConst::new(1.into(), ScalarType::Boolean))
.add(PushConst::new(0.into(), ScalarType::Boolean))
.add(Or)
.add(PushConst::new(1.into(), ScalarType::Boolean))
.add(PushConst::new(1.into(), ScalarType::Boolean))
.add(Or)
.test(&[1, 1, 1, 0])
} | rust_cleaned_test_functions.jsonl/20941 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 384
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8734,
368,
1464,
5714,
68843,
26768,
1454,
29,
341,
286,
17792,
2271,
19486,
486,
931,
741,
310,
659,
718,
5304,
1116,
19167,
486,
931,
7,
15,
39860,
1507,
35176,
929,
486,
6890,
1171,
310,
659,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_guild_vanity_url() {
let route = Route::GetGuildVanityUrl { guild_id: GUILD_ID };
assert_eq!(
route.to_string(),
format!("guilds/{guild_id}/vanity-url", guild_id = GUILD_ID)
);
} | rust_cleaned_test_functions.jsonl/119937 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
1889,
1498,
2273,
38270,
2903,
368,
341,
286,
1077,
6021,
284,
9572,
486,
1949,
72574,
53,
38270,
2864,
314,
26411,
842,
25,
479,
18023,
3450,
2605,
286,
2060,
10714,
33673,
310,
6021,
2389,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_update_member() {
let route = Route::UpdateMember {
guild_id: GUILD_ID,
user_id: USER_ID,
};
assert_eq!(
route.to_string(),
format!(
"guilds/{guild_id}/members/{user_id}",
guild_id = GUILD_ID,
user_id = USER_ID
)
);
} | rust_cleaned_test_functions.jsonl/119836 | {
"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,
8882,
19388,
368,
341,
286,
1077,
6021,
284,
9572,
486,
4289,
9366,
341,
310,
26411,
842,
25,
479,
18023,
3450,
345,
310,
1196,
842,
25,
13872,
3450,
345,
286,
2605,
286,
2060,
10714,
33673,
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_231() {
assert_eq!(Solution::is_power_of_two(-1), false);
assert_eq!(Solution::is_power_of_two(1), true);
assert_eq!(Solution::is_power_of_two(1024), true);
} | rust_cleaned_test_functions.jsonl/45220 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 103
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
17,
18,
16,
368,
341,
286,
2060,
10714,
10297,
36842,
486,
285,
20421,
3575,
23241,
4080,
16,
701,
895,
317,
286,
2060,
10714,
10297,
36842,
486,
285,
20421,
3575,
23241,
7,
16,
701,
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 |
#[test]
fn test_initialize() -> anyhow::Result<()> {
let eng = Engine::<u64>::default;
let log_id0 = LogId {
leader_id: LeaderId::new(0, 0),
index: 0,
};
let vote0 = Vote::new(0, 0);
let m12 = || Membership::<u64>::new(vec![btreeset! {1,2}], None);
let payload = EntryPayload::<Config>::Membership(m12());
let mut entries = [EntryRef::new(&payload)];
tracing::info!("--- ok: init empty node 1 with membership(1,2)");
tracing::info!("--- expect OK result, check output commands and state changes");
{
let mut eng = eng();
eng.id = 1;
eng.initialize(&mut entries)?;
assert_eq!(Some(log_id0), eng.state.get_log_id(0));
assert_eq!(None, eng.state.get_log_id(1));
assert_eq!(Some(log_id0), eng.state.last_log_id);
assert_eq!(ServerState::Candidate, eng.state.server_state);
assert_eq!(
MetricsChangeFlags {
leader: false,
other_metrics: true
},
eng.metrics_flags
);
assert_eq!(m12(), eng.state.membership_state.effective.membership);
assert_eq!(
vec![
Command::AppendInputEntries { range: 0..1 },
Command::UpdateMembership { membership: m12() },
Command::MoveInputCursorBy { n: 1 },
Command::UpdateServerState {
server_state: ServerState::Candidate
}
],
eng.commands
);
}
tracing::info!("--- not allowed because of last_log_id");
{
let mut eng = eng();
eng.state.last_log_id = Some(log_id0);
assert_eq!(
Err(InitializeError::NotAllowed(NotAllowed {
last_log_id: Some(log_id0),
vote: vote0,
})),
eng.initialize(&mut entries)
);
}
tracing::info!("--- not allowed because of vote");
{
let mut eng = eng();
eng.state.vote = Vote::new(0, 1);
assert_eq!(
Err(InitializeError::NotAllowed(NotAllowed {
last_log_id: None,
vote: Vote::new(0, 1),
})),
eng.initialize(&mut entries)
);
}
tracing::info!("--- node id 0 is not in membership");
{
let mut eng = eng();
assert_eq!(
Err(InitializeError::NotInMembers(NotInMembers {
node_id: 0,
membership: m12()
})),
eng.initialize(&mut entries)
);
}
tracing::info!("--- log entry is not a membership entry");
{
let mut eng = eng();
let payload = EntryPayload::<Config>::Blank;
let mut entries = [EntryRef::new(&payload)];
assert_eq!(
Err(InitializeError::NotAMembershipEntry(NotAMembershipEntry {})),
eng.initialize(&mut entries)
);
}
Ok(())
} | rust_cleaned_test_functions.jsonl/41779 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1491
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40889,
368,
1464,
88964,
486,
2077,
71698,
341,
262,
1077,
2922,
284,
8200,
27638,
84,
21,
19,
6831,
2258,
401,
262,
1077,
1487,
842,
15,
284,
2835,
764,
341,
286,
7653,
842,
25,
23030,
764,
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... | 3 |
#[test]
fn test_consistent_messages_hash() {
let test_ent_id =
PublicKey::from("4ea5328f943ef6f66daaed74cb0e99c3b1c45f76307b425003dbc7cb3638ed35");
let q = quantity::Quantity::from(1000u32);
let mut st = BTreeMap::new();
st.insert(staking::ThresholdKind::KindNodeCompute, q.clone());
st.insert(staking::ThresholdKind::KindNodeStorage, q.clone());
let mut wlc = BTreeMap::new();
wlc.insert(registry::RolesMask::RoleComputeWorker, 2);
wlc.insert(registry::RolesMask::RoleStorageWorker, 4);
let mut wl = BTreeMap::new();
wl.insert(
test_ent_id,
registry::EntityWhitelistConfig {
max_nodes: Some(wlc),
},
);
let rt = registry::Runtime {
v: 2,
id: Namespace::default(),
entity_id: test_ent_id,
genesis: registry::RuntimeGenesis {
state_root: Hash::empty_hash(),
state: None,
storage_receipts: None,
round: 0,
},
kind: registry::RuntimeKind::KindCompute,
tee_hardware: registry::TEEHardware::TEEHardwareInvalid,
versions: registry::VersionInfo::default(),
key_manager: None,
executor: registry::ExecutorParameters {
group_size: 3,
group_backup_size: 5,
allowed_stragglers: 1,
round_timeout: 10,
max_messages: 32,
},
txn_scheduler: registry::TxnSchedulerParameters {
algorithm: "simple".to_string(),
batch_flush_timeout: 20000000000, // 20 seconds.
max_batch_size: 1,
max_batch_size_bytes: 1024,
propose_batch_timeout: 5,
},
storage: registry::StorageParameters {
group_size: 3,
min_write_replication: 3,
max_apply_write_log_entries: 100000,
max_apply_ops: 2,
checkpoint_interval: 0,
checkpoint_num_kept: 0,
checkpoint_chunk_size: 0,
},
admission_policy: registry::RuntimeAdmissionPolicy::EntityWhitelist(
registry::EntityWhitelistRuntimeAdmissionPolicy { entities: Some(wl) },
),
constraints: {
let mut cs = BTreeMap::new();
cs.insert(scheduler::CommitteeKind::ComputeExecutor, {
let mut ce = BTreeMap::new();
ce.insert(
scheduler::Role::Worker,
registry::SchedulingConstraints {
min_pool_size: Some(registry::MinPoolSizeConstraint { limit: 1 }),
validator_set: Some(registry::ValidatorSetConstraint {}),
..Default::default()
},
);
ce.insert(
scheduler::Role::BackupWorker,
registry::SchedulingConstraints {
min_pool_size: Some(registry::MinPoolSizeConstraint { limit: 2 }),
..Default::default()
},
);
ce
});
cs.insert(scheduler::CommitteeKind::Storage, {
let mut st = BTreeMap::new();
st.insert(
scheduler::Role::Worker,
registry::SchedulingConstraints {
min_pool_size: Some(registry::MinPoolSizeConstraint { limit: 9 }),
max_nodes: Some(registry::MaxNodesConstraint { limit: 1 }),
..Default::default()
},
);
st
});
Some(cs)
},
staking: registry::RuntimeStakingParameters {
thresholds: Some(st),
},
governance_model: registry::RuntimeGovernanceModel::GovernanceEntity,
};
let tcs = vec![
(
vec![],
"c672b8d1ef56ed28ab87c3622c5114069bdd3ad7b8f9737498d0c01ecef0967a",
),
(
vec![Message::Staking(Versioned::new(
0,
StakingMessage::Transfer(staking::Transfer::default()),
))],
"a6b91f974b34a9192efd12025659a768520d2f04e1dae9839677456412cdb2be",
),
(
vec![Message::Staking(Versioned::new(
0,
StakingMessage::Withdraw(staking::Withdraw::default()),
))],
"069b0fda76d804e3fd65d4bbd875c646f15798fb573ac613100df67f5ba4c3fd",
),
(
vec![Message::Staking(Versioned::new(
0,
StakingMessage::AddEscrow(staking::Escrow::default()),
))],
"65049870b9dae657390e44065df0c78176816876e67b96dac7791ee6a1aa42e2",
),
(
vec![Message::Staking(Versioned::new(
0,
StakingMessage::ReclaimEscrow(staking::ReclaimEscrow::default()),
))],
"c78547eae2f104268e49827cbe624cf2b350ee59e8d693dec0673a70a4664a2e",
),
(
vec![Message::Registry(Versioned::new(
0,
RegistryMessage::UpdateRuntime(registry::Runtime::default()),
))],
"bc26afcca2efa9ba8138d2339a38389482466163b5bda0e1dac735b03c879905",
),
(
vec![Message::Registry(Versioned::new(
0,
RegistryMessage::UpdateRuntime(rt),
))],
"37a855783495d6699d3d229146b70f31b3da72a2a752e4cb4ded6dfe2d774382",
),
];
for (msgs, expected_hash) in tcs {
assert_eq!(Message::messages_hash(&msgs), Hash::from(expected_hash));
}
} | rust_cleaned_test_functions.jsonl/90823 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3706
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31971,
18128,
23428,
8950,
368,
341,
1789,
286,
1077,
1273,
27425,
842,
4035,
310,
70280,
486,
1499,
445,
19,
12508,
20,
18,
17,
23,
69,
24,
19,
18,
823,
21,
69,
21,
21,
3235,
61454,
22,
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... | 2 |
#[test]
fn test_no_relative_index_when_empty() {
let vas = VirtualAddressSpace::default();
let res = vas.relative_base(0, 0);
assert_eq!(res, Err(Error::BadRelativeIndex(0)));
} | rust_cleaned_test_functions.jsonl/17701 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
29286,
3560,
47636,
15124,
368,
341,
286,
1077,
43396,
284,
20721,
4286,
9914,
486,
2258,
543,
286,
1077,
592,
284,
43396,
74314,
7651,
7,
15,
11,
220,
15,
317,
286,
2060,
10714,
10297,
41... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_transfers_in_single_block() {
let mut testkit = init_testkit();
let (alice_pubkey, alice_key) = crypto::gen_keypair();
let (bob_pubkey, bob_key) = crypto::gen_keypair();
testkit.create_block_with_transactions(txvec![
TxCreateWallet::sign(ALICE_NAME, &alice_pubkey, &alice_key),
TxCreateWallet::sign(BOB_NAME, &bob_pubkey, &bob_key),
]);
let tx_a_to_b = TxTransfer::sign(
&bob_pubkey,
90, // amount
0, // seed
&alice_pubkey,
&alice_key,
);
let tx_b_to_a = TxTransfer::sign(
&alice_pubkey,
120, // amount
0, // seed
&bob_pubkey,
&bob_key,
);
{
// See what happens if transactions are applied in an "incorrect" order.
let snapshot = testkit.probe_all(txvec![tx_b_to_a.clone(), tx_a_to_b.clone()]);
let schema = CurrencySchema::new(&snapshot);
assert_eq!(schema.wallet(&alice_pubkey).map(|w| w.balance), Some(10));
assert_eq!(schema.wallet(&bob_pubkey).map(|w| w.balance), Some(190));
}
testkit.create_block_with_transactions(txvec![tx_a_to_b, tx_b_to_a]);
let alice_wallet = get_wallet(&testkit, &alice_pubkey);
assert_eq!(alice_wallet.balance, 130);
let bob_wallet = get_wallet(&testkit, &bob_pubkey);
assert_eq!(bob_wallet.balance, 70);
} | rust_cleaned_test_functions.jsonl/25289 | {
"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,
7965,
49793,
1243,
19487,
7113,
368,
341,
262,
1077,
5206,
1273,
8226,
284,
2930,
4452,
8226,
543,
262,
1077,
320,
63195,
34014,
792,
11,
70433,
3097,
8,
284,
19028,
486,
4370,
3097,
12670,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_schema_attrs_success() {
let _setup = SetupMocks::init();
let (handle, schema_json) = get_schema_attrs("Check For Success".to_string(), SCHEMA_ID.to_string()).unwrap();
check_schema(handle, &schema_json, SCHEMA_ID, r#"["name","age","height","sex"]"#);
} | rust_cleaned_test_functions.jsonl/33231 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 135
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
25371,
39578,
18632,
368,
341,
286,
1077,
716,
15188,
284,
18626,
72577,
486,
2327,
1428,
286,
1077,
320,
8192,
11,
10802,
9455,
8,
284,
633,
25371,
39578,
445,
3973,
1752,
13047,
3263,
983,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_asinh() {
assert_eq!(0.0f32.asinh(), 0.0f32);
assert_eq!((-0.0f32).asinh(), -0.0f32);
assert_eq!(Float::infinity::<f32>().asinh(), Float::infinity::<f32>());
assert_eq!(Float::neg_infinity::<f32>().asinh(), Float::neg_infinity::<f32>());
assert!(Float::NaN::<f32>().asinh().is_NaN());
assert_approx_eq!(2.0f32.asinh(), 1.443635475178810342493276740273105f32);
assert_approx_eq!((-2.0f32).asinh(), -1.443635475178810342493276740273105f32);
} | rust_cleaned_test_functions.jsonl/101558 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 278
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
20868,
368,
341,
286,
2060,
10714,
10297,
15,
13,
15,
69,
18,
17,
5357,
20868,
1507,
220,
15,
13,
15,
69,
18,
17,
317,
286,
2060,
10714,
0,
54934,
15,
13,
15,
69,
18,
17,
568,
300,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_evenly_split_e8s_over_12_months() {
let e8s = ICPTs::from_icpts(1000).unwrap().get_e8s();
let e8s1 = 8_333_333_333;
let e8s2 = 8_333_333_337;
let expected_stakes = vec![
e8s1, e8s1, e8s1, e8s1, e8s1, e8s1, e8s1, e8s1, e8s1, e8s1, e8s1, e8s2,
];
assert_eq!(evenly_split_e8s(e8s, 12), expected_stakes);
} | rust_cleaned_test_functions.jsonl/97862 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 242
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68347,
398,
17052,
2204,
23,
82,
15431,
62,
16,
17,
88462,
368,
341,
286,
1077,
384,
23,
82,
284,
19288,
2828,
82,
486,
1499,
32747,
12754,
7,
16,
15,
15,
15,
568,
15454,
1005,
455,
2204,
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_option_collector_some() -> crate::Result<()> {
let searcher = make_test_searcher()?;
let counts = searcher.search(&AllQuery, &Some(Count))?;
assert_eq!(counts, Some(2));
Ok(())
} | rust_cleaned_test_functions.jsonl/130047 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9672,
10211,
27669,
61855,
368,
1464,
17717,
486,
2077,
71698,
341,
262,
1077,
94674,
284,
1281,
4452,
10716,
261,
94136,
262,
1077,
14579,
284,
94674,
9288,
2099,
2403,
2859,
11,
609,
8373,
7,
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
] | 3 |
#[test]
fn test_dim_after_variable_assignment_duplicate_definition() {
let program = r#"
A = 42
DIM A AS INTEGER
"#;
assert_linter_err!(program, QError::DuplicateDefinition, 3, 17);
} | rust_cleaned_test_functions.jsonl/122456 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10791,
19844,
14635,
51891,
70434,
31698,
368,
341,
262,
1077,
2025,
284,
435,
2,
698,
310,
362,
284,
220,
19,
17,
198,
310,
50859,
362,
5752,
30381,
198,
310,
5869,
280,
262,
2060,
907,
2245,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_macros() {
let empty_includes: [PathBuf; 0] = [];
let defines = vec![("NAME1", ""), ("NAME2", "58")];
let no_defines: [(String, String); 0] = [];
let need_defines = "
#version 450
#if defined(NAME1) && NAME2 > 29
void main() {}
#endif
";
let compile_no_defines = compile(
None,
&Path::new(""),
need_defines,
ShaderKind::Vertex,
&empty_includes,
&no_defines,
None,
None,
);
assert!(compile_no_defines.is_err());
let compile_defines = compile(
None,
&Path::new(""),
need_defines,
ShaderKind::Vertex,
&empty_includes,
&defines,
None,
None,
);
compile_defines.expect("Setting shader macros did not work");
} | rust_cleaned_test_functions.jsonl/3150 | {
"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,
85904,
368,
341,
286,
1077,
4287,
1243,
7396,
25,
508,
1820,
15064,
26,
220,
15,
60,
284,
5907,
286,
1077,
18653,
284,
7486,
20703,
445,
7535,
16,
497,
77130,
3489,
7535,
17,
497,
330,
20,
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_deserialize_envelope_empty_newline() {
// With terminating newline after header
let bytes = Bytes::from("{\"event_id\":\"9ec79c33ec9942ab8353589fcb2e04dc\",\"dsn\":\"https://e12d836b15bb49d7bbf99e64295d995b:@sentry.io/42\"}\n");
let envelope = Envelope::parse_bytes(bytes).unwrap();
assert_eq!(envelope.len(), 0);
} | rust_cleaned_test_functions.jsonl/103610 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 175
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15768,
9050,
6205,
18853,
15124,
5921,
1056,
368,
341,
286,
442,
3085,
70581,
39027,
1283,
4247,
198,
286,
1077,
5820,
284,
30024,
486,
1499,
99141,
3087,
842,
23488,
24,
757,
22,
24,
66,
18,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fold_assign() {
test("x=x", "");
test_same("x=xy");
test_same("x=x + 1");
test_same("x.a=x.a");
test("var y=(x=x)", "var y=x");
test("y=1 + (x=x)", "y=1 + x");
} | rust_cleaned_test_functions.jsonl/467 | {
"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,
61187,
20688,
368,
341,
262,
1273,
445,
87,
25387,
497,
14498,
262,
1273,
33574,
445,
87,
28,
4130,
797,
262,
1273,
33574,
445,
87,
25387,
488,
220,
16,
797,
262,
1273,
33574,
445,
87,
5849,
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_whitespace() {
use Token::*;
let (tokens, maybe_error) =
tokenize_string(" add \n\t \t\tsubtract\nend\tfrom # loop loop\tend\ntimes ");
assert_eq!(tokens, vec![Add, Subtract, End, From, Times]);
assert!(maybe_error.is_none());
} | rust_cleaned_test_functions.jsonl/78237 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 159
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
86175,
368,
341,
286,
990,
9660,
56162,
286,
1077,
320,
30566,
11,
7196,
4096,
8,
4035,
310,
77651,
3904,
445,
220,
912,
256,
1124,
77,
4955,
256,
1124,
83,
4955,
59442,
1699,
408,
4955,
1499,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_var_eof() {
let mut buf = vec![0x80; 9];
buf.push(0x2);
check_error!(buf.as_slice().decode_var_u64(), ErrorKind::InvalidData);
check_error!(buf.as_slice().decode_var_i64(), ErrorKind::InvalidData);
buf = vec![0x80; 3];
check_error!(buf.as_slice().decode_var_u64(), ErrorKind::UnexpectedEof);
buf.push(0);
assert_eq!(0, buf.as_slice().decode_var_u64().unwrap());
} | rust_cleaned_test_functions.jsonl/39060 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 228
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4612,
90792,
368,
341,
286,
1077,
5206,
6607,
284,
7486,
20703,
15,
87,
23,
15,
26,
220,
24,
935,
286,
6607,
2552,
7,
15,
87,
17,
317,
286,
1779,
4096,
10297,
5909,
5357,
26488,
1005,
18196,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_prefix_punctuation() {
check_word_count(
"!%%#testing, 1, 2 testing",
vec![("testing", 2),
("1", 1),
("2", 1)]);
} | rust_cleaned_test_functions.jsonl/109973 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13974,
620,
72299,
368,
341,
262,
1779,
13533,
3180,
1006,
286,
53074,
2769,
2,
8840,
11,
220,
16,
11,
220,
17,
7497,
756,
286,
7486,
20703,
445,
8840,
497,
220,
17,
1326,
1797,
3489,
16,
497,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_validate_circuit_empty_endpoint() {
let store = setup_admin_service_store();
let event_store = store.clone_boxed();
let (mesh, cm, pm, peer_connector) = setup_peer_connector(None);
let orchestrator = setup_orchestrator();
let signature_verifier = Secp256k1Context::new().new_verifier();
let table = RoutingTable::default();
let writer: Box<dyn RoutingTableWriter> = Box::new(table.clone());
let admin_shared = AdminServiceShared::new(
"node_a".into(),
Arc::new(Mutex::new(orchestrator)),
HashMap::new(),
peer_connector,
store,
signature_verifier,
Box::new(MockAdminKeyVerifier::default()),
Box::new(AllowAllKeyPermissionManager),
writer,
event_store,
vec![],
);
let mut circuit = setup_test_circuit();
let mut node_a = SplinterNode::new();
node_a.set_node_id("node_a".to_string());
node_a.set_endpoints(vec!["test://endpoint_a:0".to_string()].into());
let mut node_b = SplinterNode::new();
node_b.set_node_id("node_b".to_string());
node_b.set_endpoints(vec!["".to_string()].into());
circuit.set_members(RepeatedField::from_vec(vec![node_a, node_b]));
if let Ok(_) = admin_shared.validate_create_circuit(
&circuit,
PUB_KEY,
"node_a",
ADMIN_SERVICE_PROTOCOL_VERSION,
) {
panic!("Should have been invalid because a member has an empty endpoint");
}
shutdown(mesh, cm, pm);
} | rust_cleaned_test_functions.jsonl/47877 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 802
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
666,
37268,
15124,
36699,
368,
341,
286,
1077,
3553,
284,
6505,
12207,
12267,
14809,
543,
286,
1077,
1538,
14809,
284,
3553,
15997,
10194,
291,
1428,
286,
1077,
320,
23506,
11,
9961,
11,
88... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_edge_present_directed() {
let mut net: Network<&str, usize> = Network::new(true);
net.add_edge("A", "B", 1);
assert!(
net.edge_data("A", "B").is_some(),
"There should be an edge between A and B"
);
assert!(
net.edge_data("B", "A").is_none(),
"There should not be an edge between A and B"
);
} | rust_cleaned_test_functions.jsonl/127180 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 172
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17932,
36976,
32871,
291,
368,
341,
262,
1077,
5206,
4179,
25,
8141,
52244,
495,
11,
22301,
29,
284,
8141,
486,
931,
3715,
626,
262,
4179,
1364,
17932,
445,
32,
497,
330,
33,
497,
220,
16,
626... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_variant() {
#[allow(dead_code)]
#[derive(Debug, CandidType)]
enum E {
Foo,
Bar(bool, i32),
Baz { a: i32, b: u32 },
Newtype(bool),
}
let v = E::Bar(true, 42);
assert_eq!(
get_type(&v),
Type::Variant(vec![
field(
"Bar",
Type::Record(vec![
unnamed_field(0, Type::Bool),
unnamed_field(1, Type::Int32)
])
),
field(
"Baz",
Type::Record(vec![field("a", Type::Int32), field("b", Type::Nat32)])
),
field("Foo", Type::Null),
field("Newtype", Type::Bool),
])
);
} | rust_cleaned_test_functions.jsonl/103096 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 465
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46112,
368,
341,
262,
11506,
7183,
83207,
4136,
5563,
262,
11506,
27098,
42618,
11,
93816,
929,
5563,
262,
7618,
468,
341,
286,
33428,
345,
286,
4716,
9764,
11,
600,
18,
17,
1326,
286,
91711,
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_byte_array() {
ByteArrayType::test(Encoding::PLAIN, TEST_SET_SIZE, -1);
ByteArrayType::test(Encoding::PLAIN_DICTIONARY, TEST_SET_SIZE, -1);
ByteArrayType::test(Encoding::DELTA_LENGTH_BYTE_ARRAY, TEST_SET_SIZE, -1);
ByteArrayType::test(Encoding::DELTA_BYTE_ARRAY, TEST_SET_SIZE, -1);
} | rust_cleaned_test_functions.jsonl/45126 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19737,
3858,
368,
341,
262,
32920,
929,
486,
1944,
85177,
486,
90889,
11,
13602,
8481,
4098,
11,
481,
16,
317,
262,
32920,
929,
486,
1944,
85177,
486,
90889,
44663,
3580,
8642,
11,
13602,
8481,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_type_executable() {
use std::os::unix::fs::OpenOptionsExt;
let te = TestEnv::new(DEFAULT_DIRS, DEFAULT_FILES);
fs::OpenOptions::new()
.create(true)
.write(true)
.mode(0o777)
.open(te.test_root().join("executable-file.sh"))
.unwrap();
te.assert_output(&["--type", "executable"], "executable-file.sh");
te.assert_output(
&["--type", "executable", "--type", "directory"],
"executable-file.sh
one
one/two
one/two/three
one/two/three/directory_foo",
);
} | rust_cleaned_test_functions.jsonl/10881 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 286
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1819,
18430,
5922,
368,
341,
262,
990,
1460,
486,
436,
486,
56646,
486,
3848,
486,
5002,
3798,
6756,
401,
262,
1077,
1013,
284,
3393,
14359,
486,
931,
43175,
90560,
11,
11955,
48010,
626,
262,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_byte_get_value_of_bits() {
fn run(byte: u8, range: RangeInclusive<u8>) -> u8 {
let out = Byte::new(byte);
out.get_value_of_bits(range)
}
assert_eq!(run(0x00, 0..=7), 0x00);
assert_eq!(run(0xFF, 0..=7), 0xFF);
assert_eq!(run(0b0000_1111, 0..=3), 0x0F);
assert_eq!(run(0b1111_0000, 4..=7), 0x0F);
assert_eq!(run(0b1001_1010, 2..=4), 6);
} | rust_cleaned_test_functions.jsonl/126283 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 260
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19737,
3062,
3142,
3575,
20034,
368,
341,
286,
5168,
1598,
19738,
25,
575,
23,
11,
2088,
25,
16437,
641,
8336,
34837,
23,
9231,
1464,
575,
23,
341,
310,
1077,
700,
284,
10906,
486,
931,
19738,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_duration() {
let cases = vec![("11:30:45.123456"), ("-35:30:46")];
let tz = Tz::utc();
for s in cases {
let d = MyDuration::parse(s.as_bytes(), MAX_FSP).unwrap();
let get = Time::from_duration(&tz, TimeType::DateTime, d).unwrap();
let get_today = get
.time
.checked_sub_signed(Duration::nanoseconds(d.to_nanos()))
.unwrap();
let now = Utc::now();
assert_eq!(get_today.year(), now.year());
assert_eq!(get_today.month(), now.month());
assert_eq!(get_today.day(), now.day());
assert_eq!(get_today.hour(), 0);
assert_eq!(get_today.minute(), 0);
assert_eq!(get_today.second(), 0);
}
} | rust_cleaned_test_functions.jsonl/93961 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 435
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
25454,
368,
341,
286,
1077,
5048,
284,
7486,
20703,
445,
16,
16,
25,
18,
15,
25,
19,
20,
13,
16,
17,
18,
19,
20,
21,
3975,
98670,
18,
20,
25,
18,
15,
25,
19,
21,
899,
935,
286,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_new_containing_spread_2() {
// be preserved.
test("new Date(foo(), ...c, bar())", "(foo(), [...c], bar())");
} | rust_cleaned_test_functions.jsonl/464 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 65
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
10260,
2056,
10123,
878,
62,
17,
368,
341,
1066,
262,
442,
387,
33583,
624,
262,
1273,
445,
931,
2631,
71880,
1507,
2503,
66,
11,
3619,
2140,
497,
11993,
7975,
1507,
16303,
66,
1125,
3619,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_drain_filter_drop_panic_leak() {
static PREDS: AtomicU32 = AtomicU32::new(0);
static DROPS: AtomicU32 = AtomicU32::new(0);
#[derive(PartialEq, Eq, PartialOrd, Ord)]
struct D(i32);
impl Drop for D {
fn drop(&mut self) {
if DROPS.fetch_add(1, SeqCst) == 1 {
panic!("panic in `drop`");
}
}
}
let mut set = BTreeSet::new();
set.insert(D(0));
set.insert(D(4));
set.insert(D(8));
catch_unwind(move || {
drop(set.drain_filter(|d| {
PREDS.fetch_add(1u32 << d.0, SeqCst);
true
}))
})
.ok();
assert_eq!(PREDS.load(SeqCst), 0x011);
assert_eq!(DROPS.load(SeqCst), 3);
} | rust_cleaned_test_functions.jsonl/12216 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 406
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26680,
466,
8727,
29584,
620,
31270,
11751,
585,
368,
341,
262,
1099,
20952,
5936,
25,
30316,
52,
18,
17,
284,
30316,
52,
18,
17,
486,
931,
7,
15,
317,
262,
1099,
422,
1285,
5012,
25,
30316,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_env_assign_to_keyword() {
let mut env = Environment::new();
let value = Value::Scalar(YololNumber::zero().into());
env.let_value("sum", value.clone()).unwrap();
} | rust_cleaned_test_functions.jsonl/131946 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 81
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15879,
20688,
2346,
45824,
368,
341,
262,
1077,
5206,
6105,
284,
11586,
486,
931,
543,
262,
1077,
897,
284,
5162,
486,
20639,
20206,
337,
337,
2833,
486,
14154,
1005,
18122,
1423,
262,
6105,
13,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_for_loop() {
test! {
let it = AST::SimpleIdentifier(SimpleIdentifier::new_wrapped("i".to_string()));
let vec = AST::SimpleIdentifier(SimpleIdentifier::new_wrapped("vec".to_string()));
let sym = AST::SimpleIdentifier(SimpleIdentifier::new_wrapped("a".to_string()));
let assign = AST::Assignment(Assignment::new_wrapped(sym, it.clone()));
let for_loop = AST::ForLoop(ForLoop::new_wrapped(it, vec, vec![assign]));
let r_node = for_loop.to_r_ast_node(0);
assert_eq!(r_node, eval_string(
"call('for', rlang::sym('i'), rlang::sym('vec'), call('{', list(call('<-', rlang::sym('a'), rlang::sym('i')))))"
).unwrap());
}
} | rust_cleaned_test_functions.jsonl/75443 | {
"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,
5478,
17198,
368,
341,
286,
1273,
0,
341,
310,
1077,
432,
284,
22465,
486,
16374,
8714,
3759,
6456,
8714,
486,
931,
44074,
5677,
445,
72,
3263,
983,
3904,
7392,
310,
1077,
7486,
284,
22465,
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_display_traffic_model() {
assert_eq!("best_guess", TrafficModel::BestGuess.to_string());
assert_eq!("optimistic", TrafficModel::Optimistic.to_string());
assert_eq!("pessimistic", TrafficModel::Pessimistic.to_string());
} | rust_cleaned_test_functions.jsonl/75494 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 111
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14825,
90012,
5047,
368,
341,
286,
2060,
10714,
17223,
15862,
54737,
497,
36981,
1712,
486,
14470,
45730,
2389,
3904,
1423,
286,
2060,
10714,
17223,
19133,
4532,
497,
36981,
1712,
486,
21367,
318,
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 |
#[test]
fn test_verifies_input_files() {
new_ucmd!()
.args(&["/dev/random", "nonexistent_file"])
.fails()
.status_code(2)
.stderr_is("sort: cannot read: nonexistent_file: No such file or directory");
} | rust_cleaned_test_functions.jsonl/20543 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26042,
9606,
5898,
10931,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
14,
3583,
79442,
497,
330,
6280,
64085,
2458,
14108,
286,
659,
59631,
741,
286,
659,
2829,
4136,
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_associated_function() {
check_highlighting(
r#"
fn not_static() {}
struct foo {}
impl foo {
pub fn is_static() {}
pub fn is_not_static(&self) {}
}
trait t {
fn t_is_static() {}
fn t_is_not_static(&self) {}
}
impl t for foo {
pub fn is_static() {}
pub fn is_not_static(&self) {}
}
"#,
expect_file!["./test_data/highlight_assoc_functions.html"],
false,
)
} | rust_cleaned_test_functions.jsonl/5127 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 212
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58665,
657,
9174,
368,
341,
262,
1779,
74546,
287,
1006,
286,
435,
2,
698,
8822,
537,
25360,
368,
10086,
1235,
15229,
10086,
6383,
15229,
341,
262,
6675,
5168,
374,
25360,
368,
5613,
262,
6675,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_p2p_magic_number_fmt() {
assert_eq!(format!("{}", P2pNetworkId::Mainnet), "mainnet");
assert_eq!(format!("{}", P2pNetworkId::Testnet), "testnet");
assert_eq!(format!("{}", P2pNetworkId::Regtest), "regtest");
assert_eq!(format!("{}", P2pNetworkId::Signet), "signet");
assert_eq!(format!("{}", P2pNetworkId::Other(0x01)), "unknown");
assert_eq!(
format!("{:?}", P2pNetworkId::Mainnet),
format!("mainnet({:#x?})", P2P_MAGIC_MAINNET)
);
assert_eq!(
format!("{:?}", P2pNetworkId::Testnet),
format!("testnet({:#x?})", P2P_MAGIC_TESTNET)
);
assert_eq!(
format!("{:?}", P2pNetworkId::Regtest),
format!("regtest({:#x?})", P2P_MAGIC_REGTEST)
);
assert_eq!(
format!("{:?}", P2pNetworkId::Signet),
format!("signet({:#x?})", P2P_MAGIC_SIGNET)
);
assert_eq!(
format!("{:?}", P2pNetworkId::Other(0x01u32)),
format!("unknown({:#x?})", 0x01u32)
);
} | rust_cleaned_test_functions.jsonl/115616 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 617
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
17,
79,
54612,
5500,
38128,
368,
341,
286,
2060,
10714,
10297,
2243,
79878,
393,
17,
79,
12320,
764,
486,
6202,
4711,
701,
330,
3817,
4711,
797,
286,
2060,
10714,
10297,
2243,
79878,
393,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_write_read_multiple_registers() {
let (_s, cfg) = start_dummy_server_with_cfg();
let mut trans = Transport::new_with_cfg("127.0.0.1", cfg).unwrap();
assert!(trans.write_multiple_registers(0, &[23]).is_ok());
assert_eq!(trans.read_holding_registers(0, 1).unwrap(), &[23]);
assert!(trans.write_multiple_registers(0, &[1, 2, 3]).is_ok());
assert_eq!(trans.read_holding_registers(0, 1).unwrap(), &[1]);
assert_eq!(trans.read_holding_registers(1, 1).unwrap(), &[2]);
assert_eq!(trans.read_holding_registers(2, 1).unwrap(), &[3]);
assert_eq!(trans.read_holding_registers(0, 3).unwrap(), &[1, 2, 3]);
} | rust_cleaned_test_functions.jsonl/46843 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 332
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
6443,
45233,
78360,
368,
341,
286,
1077,
5453,
82,
11,
13286,
8,
284,
1191,
60321,
12015,
6615,
18343,
543,
286,
1077,
5206,
1356,
284,
16742,
486,
931,
6615,
18343,
445,
16,
17,
22,
13,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_arc_string() {
let b = Arc::new("test".to_owned());
assert_eq!(Binary::from(b.clone()).len(), 4);
assert_eq!(Binary::from(b.clone()).as_ref(), b"test");
assert_eq!(Binary::from(&b).len(), 4);
assert_eq!(Binary::from(&b).as_ref(), b"test");
} | rust_cleaned_test_functions.jsonl/89000 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 155
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62914,
3904,
368,
341,
286,
1077,
293,
284,
19689,
486,
931,
445,
1944,
3263,
983,
51973,
1423,
286,
2060,
10714,
10297,
21338,
486,
1499,
1883,
15997,
6011,
2892,
1507,
220,
19,
317,
286,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_against_prim() {
for _ in 0..NRANDOM {
let m = random::<u8>() | 1;
let e = random::<u8>();
let (a, b) = (random::<u8>(), random::<u8>());
let am = MontgomeryInt::new(a, m);
let bm = am.convert(b);
assert_eq!((am + bm).residue(), a.addm(b, &m));
assert_eq!((am - bm).residue(), a.subm(b, &m));
assert_eq!((am * bm).residue(), a.mulm(b, &m));
assert_eq!((-am).residue(), a.negm(&m));
assert_eq!(am.pow(e).residue(), a.powm(e, &m));
assert_eq!(am.double().residue(), a.dblm(&m));
assert_eq!(am.square().residue(), a.sqm(&m));
let m = random::<u16>() | 1;
let e = e as u16;
let (a, b) = (random::<u16>(), random::<u16>());
let am = MontgomeryInt::new(a, m);
let bm = am.convert(b);
assert_eq!((am + bm).residue(), a.addm(b, &m));
assert_eq!((am - bm).residue(), a.subm(b, &m));
assert_eq!((am * bm).residue(), a.mulm(b, &m));
assert_eq!((-am).residue(), a.negm(&m));
assert_eq!(am.pow(e).residue(), a.powm(e, &m));
assert_eq!(am.double().residue(), a.dblm(&m));
assert_eq!(am.square().residue(), a.sqm(&m));
let m = random::<u32>() | 1;
let e = e as u32;
let (a, b) = (random::<u32>(), random::<u32>());
let am = MontgomeryInt::new(a, m);
let bm = am.convert(b);
assert_eq!((am + bm).residue(), a.addm(b, &m));
assert_eq!((am - bm).residue(), a.subm(b, &m));
assert_eq!((am * bm).residue(), a.mulm(b, &m));
assert_eq!((-am).residue(), a.negm(&m));
assert_eq!(am.pow(e).residue(), a.powm(e, &m));
assert_eq!(am.double().residue(), a.dblm(&m));
assert_eq!(am.square().residue(), a.sqm(&m));
let m = random::<u64>() | 1;
let e = e as u64;
let (a, b) = (random::<u64>(), random::<u64>());
let am = MontgomeryInt::new(a, m);
let bm = am.convert(b);
assert_eq!((am + bm).residue(), a.addm(b, &m));
assert_eq!((am - bm).residue(), a.subm(b, &m));
assert_eq!((am * bm).residue(), a.mulm(b, &m));
assert_eq!((-am).residue(), a.negm(&m));
assert_eq!(am.pow(e).residue(), a.powm(e, &m));
assert_eq!(am.double().residue(), a.dblm(&m));
assert_eq!(am.square().residue(), a.sqm(&m));
let m = random::<u128>() | 1;
let e = e as u128;
let (a, b) = (random::<u128>(), random::<u128>());
let am = MontgomeryInt::new(a, m);
let bm = am.convert(b);
assert_eq!((am + bm).residue(), a.addm(b, &m));
assert_eq!((am - bm).residue(), a.subm(b, &m));
assert_eq!((am * bm).residue(), a.mulm(b, &m));
assert_eq!((-am).residue(), a.negm(&m));
assert_eq!(am.pow(e).residue(), a.powm(e, &m));
assert_eq!(am.double().residue(), a.dblm(&m));
assert_eq!(am.square().residue(), a.sqm(&m));
}
} | rust_cleaned_test_functions.jsonl/17998 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1902
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62427,
267,
87419,
368,
341,
286,
369,
716,
304,
220,
15,
496,
26319,
36415,
341,
310,
1077,
296,
284,
4194,
27638,
84,
23,
13555,
760,
220,
16,
280,
310,
1077,
384,
284,
4194,
27638,
84,
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... | 2 |
#[test]
fn test_run_and_sum() {
let full_program: Vec<Program> = vec![
Program {
mask: "000000000000000000000000000000X1001X".to_owned(),
mem: vec![(42, 100)],
},
Program {
mask: "00000000000000000000000000000000X0XX".to_owned(),
mem: vec![(26, 1)],
},
];
assert_eq!(Some(208), run_and_sum(&full_program));
let full_program: Vec<Program> = vec![
Program {
mask: "00000000000000000000000000000000XX10".to_owned(),
mem: vec![(2, 5), (5, 2)],
},
Program {
mask: "000000000000000000000000000000001X0X".to_owned(),
mem: vec![(3, 1), (1, 3)],
},
];
assert_eq!(Some(30), run_and_sum(&full_program));
} | rust_cleaned_test_functions.jsonl/89717 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 483
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14007,
8378,
10160,
368,
341,
286,
1077,
2480,
25096,
25,
11312,
27,
10690,
29,
284,
7486,
90515,
310,
6687,
341,
394,
6911,
25,
330,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_write_visiblestring() {
assert_writes::<VisibleString>(&[
(
VisibleString::new("Test User 1").unwrap(),
b"\x1a\x0bTest User 1",
),
(
VisibleString::new("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx").unwrap(),
b"\x1a\x81\x80xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
),
]);
} | rust_cleaned_test_functions.jsonl/129890 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 255
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
34371,
917,
368,
341,
286,
2060,
1670,
23262,
27638,
5715,
703,
44784,
9640,
310,
2399,
394,
70296,
703,
486,
931,
445,
2271,
2657,
220,
16,
1827,
15454,
3148,
394,
293,
11934,
87,
16,
64,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_ldrh_reg_w() {
assert_eq!(
decode_32(0xf838301a),
Instruction::LDRH_reg {
params: Reg3FullParams {
rt: Reg::R3,
rn: Reg::R8,
rm: Reg::R10,
shift_t: SRType::LSL,
shift_n: 1,
index: true,
add: true,
wback: false,
},
thumb32: true,
}
);
} | rust_cleaned_test_functions.jsonl/64847 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 320
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
50573,
40096,
4920,
1670,
368,
341,
14808,
262,
2060,
10714,
33673,
286,
16895,
62,
18,
17,
7,
15,
5848,
23,
18,
23,
18,
15,
16,
64,
1326,
286,
29051,
486,
43,
7687,
39,
4920,
341,
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_csdv1b() {
const EXAMPLE: CsdV1 = CsdV1 {
data: hex!("00 26 00 32 5F 59 83 C8 AD DB CF FF D2 40 40 A5"),
};
// CSD Structure: describes version of CSD structure
// 0b00 [Interpreted: Version 1.0]
assert_eq!(EXAMPLE.csd_ver(), 0x00);
// Data Read Access Time 1: defines Asynchronous part of the read
// access time 0x26 [Interpreted: 1.5 x 1ms]
assert_eq!(EXAMPLE.data_read_access_time1(), 0x26);
// Data Read Access Time 2: worst case clock dependent factor for data
// access time 0x00 [Decimal: 0 x 100 Clocks]
assert_eq!(EXAMPLE.data_read_access_time2(), 0x00);
// Max Data Transfer Rate: sometimes stated as Mhz
// 0x32 [Interpreted: 2.5 x 10Mbit/s]
assert_eq!(EXAMPLE.max_data_transfer_rate(), 0x32);
// Card Command Classes: 0x5f5 [Interpreted: Class 0: Yes. Class 1:
// 11: No. ]
assert_eq!(EXAMPLE.card_command_classes(), 0x5f5);
// Max Read Data Block Length:
// 0x9 [Interpreted: 512 Bytes]
assert_eq!(EXAMPLE.read_block_length(), 0x09);
// Partial Blocks for Read Allowed:
// 0b1 [Interpreted: Yes]
assert_eq!(EXAMPLE.read_partial_blocks(), true);
// Write Block Misalignment:
// 0b0 [Interpreted: No]
assert_eq!(EXAMPLE.write_block_misalignment(), false);
// Read Block Misalignment:
// 0b0 [Interpreted: No]
assert_eq!(EXAMPLE.read_block_misalignment(), false);
// DSR Implemented: indicates configurable driver stage integrated on
// card 0b0 [Interpreted: No]
assert_eq!(EXAMPLE.dsr_implemented(), false);
// Device Size: to calculate the card capacity excl. security area
// length) bytes 0xf22 [Decimal: 3874]
assert_eq!(EXAMPLE.device_size(), 3874);
// 0x5 [Interpreted: 35mA]
assert_eq!(EXAMPLE.max_read_current_vdd_min(), 5);
// 0x5 [Interpreted: 80mA]
assert_eq!(EXAMPLE.max_read_current_vdd_max(), 5);
// 0x6 [Interpreted: 60mA]
assert_eq!(EXAMPLE.max_write_current_vdd_min(), 6);
// 0x6 [Interpreted: 200mA]
assert_eq!(EXAMPLE.max_write_current_vdd_max(), 6);
// Device Size Multiplier:
// 0x7 [Interpreted: x512]
assert_eq!(EXAMPLE.device_size_multiplier(), 7);
// Erase Single Block Enabled:
// 0x1 [Interpreted: Yes]
assert_eq!(EXAMPLE.erase_single_block_enabled(), true);
// Erase Sector Size: size of erasable sector in write blocks
// 0x1f [Interpreted: 32 blocks]
assert_eq!(EXAMPLE.erase_sector_size(), 0x1F);
// Write Protect Group Size:
// 0x7f [Interpreted: 128 sectors]
assert_eq!(EXAMPLE.write_protect_group_size(), 0x7f);
// Write Protect Group Enable:
// 0x1 [Interpreted: Yes]
assert_eq!(EXAMPLE.write_protect_group_enable(), true);
// Write Speed Factor: block program time as multiple of read access time
// 0x4 [Interpreted: x16]
assert_eq!(EXAMPLE.write_speed_factor(), 0x4);
// Max Write Data Block Length:
// 0x9 [Interpreted: 512 Bytes]
assert_eq!(EXAMPLE.max_write_data_length(), 0x9);
// Partial Blocks for Write Allowed:
// 0x0 [Interpreted: No]
assert_eq!(EXAMPLE.write_partial_blocks(), false);
// File Format Group:
// 0b0 [Interpreted: is either Hard Disk with Partition Table/DOS FAT without Partition Table/Universal File Format/Other/Unknown]
assert_eq!(EXAMPLE.file_format_group_set(), false);
// Copy Flag:
// 0b1 [Interpreted: Non-Original]
assert_eq!(EXAMPLE.copy_flag_set(), true);
// Permanent Write Protection:
// 0b0 [Interpreted: No]
assert_eq!(EXAMPLE.permanent_write_protection(), false);
// Temporary Write Protection:
// 0b0 [Interpreted: No]
assert_eq!(EXAMPLE.temporary_write_protection(), false);
// File Format:
// 0x0 [Interpreted: Hard Disk with Partition Table]
assert_eq!(EXAMPLE.file_format(), 0x00);
// CRC7 Checksum + always 1 in LSB:
// 0xa5
assert_eq!(EXAMPLE.crc(), 0xa5);
assert_eq!(EXAMPLE.card_capacity_bytes(), 1_015_808_000);
assert_eq!(EXAMPLE.card_capacity_blocks(), 1_984_000);
} | rust_cleaned_test_functions.jsonl/130555 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2057
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
13446,
85,
16,
65,
368,
341,
286,
733,
66246,
25,
356,
13446,
53,
16,
284,
356,
13446,
53,
16,
341,
310,
821,
25,
12371,
17223,
15,
15,
220,
17,
21,
220,
15,
15,
220,
18,
17,
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_report() {
let subcommand = Subcommand::Report {
filter: Default::default(),
report_name: "myreport".to_owned(),
};
assert_eq!(
Subcommand::parse(argv!["myreport"]).unwrap(),
(&EMPTY[..], subcommand)
);
} | rust_cleaned_test_functions.jsonl/84283 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14813,
368,
341,
286,
1077,
1186,
5631,
284,
3719,
5631,
486,
10361,
341,
310,
4051,
25,
7899,
486,
2258,
3148,
310,
1895,
1269,
25,
330,
2408,
11736,
3263,
983,
51973,
3148,
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_same_key_type() {
static key1: Key<int> = &Key;
static key2: Key<int> = &Key;
static key3: Key<int> = &Key;
static key4: Key<int> = &Key;
static key5: Key<int> = &Key;
key1.replace(Some(1));
key2.replace(Some(2));
key3.replace(Some(3));
key4.replace(Some(4));
key5.replace(Some(5));
assert_eq!(*key1.get().unwrap(), 1);
assert_eq!(*key2.get().unwrap(), 2);
assert_eq!(*key3.get().unwrap(), 3);
assert_eq!(*key4.get().unwrap(), 4);
assert_eq!(*key5.get().unwrap(), 5);
} | rust_cleaned_test_functions.jsonl/73201 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 326
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33574,
3097,
1819,
368,
341,
286,
1099,
1376,
16,
25,
5309,
4159,
29,
284,
609,
1592,
280,
286,
1099,
1376,
17,
25,
5309,
4159,
29,
284,
609,
1592,
280,
286,
1099,
1376,
18,
25,
5309,
4159,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mp_reach_nlri_path_attribute() {
let mp_reach_bytes: &[u8] = &[
0x00, 0x02, // IPv6
0x01, // Unicast
0x10, // Length of IPv6 nexthop
0x20, 0x01, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00, // nh addr part one
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, // nh addr part two
0x00, // Reserved
0x20, 0x20, 0x01, 0x0d, 0xb8, // NLRI 1
0x10, 0xfe, 0x80, // NLRI 2
];
let ctx = &ParserContext::new().four_octet_asn(true).nlri_mode(Ipv6);
let result: (&[u8], MPReachNLRIPathAttribute) =
MPReachNLRIPathAttribute::from_wire(ctx, mp_reach_bytes).unwrap();
assert_eq!(result.1.afi, Ipv6);
assert_eq!(result.1.safi, Unicast);
assert_eq!(
result.1.nexthop,
vec![
0x20, 0x01, 0x0d, 0xb8, 0x00, 0x00, 0x00, 0x00, // nh addr part one
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, // nh addr part two
]
);
assert_eq!(result.1.nlris.len(), 2);
assert_eq!(format!("{}", result.1.nlris[0]), "2001:db8::/32");
assert_eq!(format!("{}", result.1.nlris[1]), "fe80::/16");
assert_eq!(result.0.len(), 0);
let wire: Vec<u8> = result.1.to_wire(ctx).unwrap();
assert_eq!(wire.as_slice(), mp_reach_bytes);
assert_eq!(result.1.wire_len(ctx).unwrap() as usize, wire.len());
} | rust_cleaned_test_functions.jsonl/49694 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 842
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39898,
1288,
610,
81052,
461,
2638,
16791,
368,
341,
286,
1077,
10490,
1288,
610,
12524,
25,
44590,
84,
23,
60,
284,
609,
9640,
310,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
17,
11,
442,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_index() {
let mut map = VecDequeMap::new();
map.insert(1, 2);
map.insert(2, 1);
map.insert(3, 4);
assert_eq!(map[3], 4);
} | rust_cleaned_test_functions.jsonl/51626 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 132
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3560,
368,
341,
310,
1077,
5206,
2415,
284,
11312,
73891,
2227,
486,
931,
1428,
310,
2415,
7030,
7,
16,
11,
220,
17,
317,
310,
2415,
7030,
7,
17,
11,
220,
16,
317,
310,
2415,
7030,
7,
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 |
#[test]
fn test_remove_nonleaf_table() {
given(r#"
title = "not relevant"
# comment 1
[a.b.c] # comment 1.1
key1 = 1 # comment 1.2
# comment 2
[b] # comment 2.1
key2 = 2 # comment 2.2
# comment 3
[a] # comment 3.1
key3 = 3 # comment 3.2
[[a.'array']]
b = 1
[[a.b.c.trololololololo]] # ohohohohoho
c = 2
key3 = 42
# comment on some other table
[some.other.table]
# comment 4
[a.b] # comment 4.1
key4 = 4 # comment 4.2
key41 = 41 # comment 4.3
"#).running(|root| {
assert!(root.remove("a").is_some());
}).produces(r#"
title = "not relevant"
# comment 2
[b] # comment 2.1
key2 = 2 # comment 2.2
# comment on some other table
[some.other.table]
"#);
} | rust_cleaned_test_functions.jsonl/36879 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 506
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
21637,
24153,
5237,
368,
341,
262,
2661,
2601,
2,
698,
286,
2265,
284,
330,
1921,
9760,
1837,
286,
671,
3980,
220,
16,
198,
286,
508,
64,
948,
520,
60,
671,
3980,
220,
16,
13,
16,
198... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eval_nhwc_3() {
setup_test_logger();
let op = Conv::default().nhwc().hwio().padding(PaddingSpec::SameUpper);
let i = rctensor4(&[[[[0.0f32, 1.0], [2.0, 3.0]], [[10.0, 11.0], [12.0, 13.0]]]]);
let k = rctensor4(&[[[[1.0f32, 0.0], [0.0, 1.0]]]]);
let res = op.eval(tvec!(i.clone(), k)).unwrap();
assert_eq!(res, tvec!(i));
} | rust_cleaned_test_functions.jsonl/51978 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 221
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21296,
93934,
24028,
62,
18,
368,
341,
286,
6505,
4452,
27413,
543,
286,
1077,
1179,
284,
28988,
486,
2258,
1005,
16719,
24028,
1005,
27827,
815,
1005,
9571,
5304,
2998,
8327,
486,
19198,
14251,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mount_to_container() {
let tmp_dir = create_temp_dir("test_mount_to_container").unwrap();
{
let m = Mount::new();
let mount = &SpecMountBuilder::default()
.destination(PathBuf::from("/dev/pts"))
.typ("devpts")
.source(PathBuf::from("devpts"))
.options(vec![
"nosuid".to_string(),
"noexec".to_string(),
"newinstance".to_string(),
"ptmxmode=0666".to_string(),
"mode=0620".to_string(),
"gid=5".to_string(),
])
.build()
.unwrap();
let (flags, data) = parse_mount(mount);
assert!(m
.mount_into_container(mount, tmp_dir.path(), flags, &data, Some("defaults"))
.is_ok());
let want = vec![MountArgs {
source: Some(PathBuf::from("devpts")),
target: tmp_dir.path().join("dev/pts"),
fstype: Some("devpts".to_string()),
flags: MsFlags::MS_NOSUID | MsFlags::MS_NOEXEC,
data: Some(
"newinstance,ptmxmode=0666,mode=0620,gid=5,context=\"defaults\"".to_string(),
),
}];
let got = &m
.syscall
.as_any()
.downcast_ref::<TestHelperSyscall>()
.unwrap()
.get_mount_args();
assert_eq!(want, *got);
assert_eq!(got.len(), 1);
}
{
let m = Mount::new();
let mount = &SpecMountBuilder::default()
.destination(PathBuf::from("/dev/null"))
.typ("bind")
.source(tmp_dir.path().join("null"))
.options(vec!["ro".to_string()])
.build()
.unwrap();
let (flags, data) = parse_mount(mount);
OpenOptions::new()
.create(true)
.write(true)
.open(tmp_dir.path().join("null"))
.unwrap();
assert!(m
.mount_into_container(mount, tmp_dir.path(), flags, &data, None)
.is_ok());
let want = vec![
MountArgs {
source: Some(tmp_dir.path().join("null")),
target: tmp_dir.path().join("dev/null"),
fstype: Some("bind".to_string()),
flags: MsFlags::MS_RDONLY,
data: Some("".to_string()),
},
// remount one
MountArgs {
source: Some(tmp_dir.path().join("dev/null")),
target: tmp_dir.path().join("dev/null"),
fstype: None,
flags: MsFlags::MS_RDONLY | MsFlags::MS_REMOUNT,
data: None,
},
];
let got = &m
.syscall
.as_any()
.downcast_ref::<TestHelperSyscall>()
.unwrap()
.get_mount_args();
assert_eq!(want, *got);
assert_eq!(got.len(), 2);
}
} | rust_cleaned_test_functions.jsonl/2894 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2018
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57593,
2346,
15847,
368,
341,
286,
1077,
4174,
4334,
284,
1855,
11771,
4334,
445,
1944,
57593,
2346,
15847,
1827,
15454,
543,
286,
341,
310,
1077,
296,
284,
10423,
486,
931,
543,
310,
1077,
6470,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_valid_paths_small_sample() {
let inputs = read_lines("data/day_12_sample.txt");
let (_, cave_edges) = parse_cave_system(&inputs);
let paths = all_paths(&cave_edges, 1);
assert_eq!(paths.len(), 10);
let paths = all_paths(&cave_edges, 2);
assert_eq!(paths.len(), 36);
} | rust_cleaned_test_functions.jsonl/42447 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5705,
8337,
24152,
31966,
17491,
368,
341,
262,
1077,
11127,
284,
1349,
18323,
445,
691,
44739,
62,
16,
17,
17491,
3909,
797,
262,
1077,
39464,
25385,
28026,
8,
284,
4715,
666,
523,
17687,
2099,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_maturities_are_invariant_by_stake_scaling() {
assert_eq!(compute_maturities(vec![1], vec!["P"]), vec![100]);
assert_eq!(compute_maturities(vec![2], vec!["P"],), vec![100]);
assert_eq!(compute_maturities(vec![43_330], vec!["P"]), vec![100]);
} | rust_cleaned_test_functions.jsonl/1131 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 133
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
2628,
1361,
56855,
1243,
15969,
3710,
1261,
726,
79216,
368,
341,
262,
2060,
10714,
10297,
27706,
717,
2628,
1361,
25592,
20703,
16,
1125,
7486,
0,
1183,
47,
63624,
7486,
20703,
16,
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_is_code_block_start() {
#[derive(Debug)]
struct TestCase {
it: String,
input: String,
expected: bool,
}
let test_cases = [
TestCase {
it: String::from("should return true when input is ```"),
input: String::from("```"),
expected: true,
},
TestCase {
it: String::from("should return true when input is ```<langname>"),
input: String::from("```html"),
expected: true,
},
TestCase {
it: String::from("should return true when input is ``"),
input: String::from("``"),
expected: false,
},
TestCase {
it: String::from("should return true when input is `"),
input: String::from("``"),
expected: false,
},
];
for test_case in test_cases.iter() {
let output = is_code_block_start(&test_case.input);
assert_eq!(output, test_case.expected, "Failed: {}\n", test_case.it);
}
} | rust_cleaned_test_functions.jsonl/957 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 781
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
4136,
7113,
4906,
368,
341,
310,
11506,
27098,
42618,
5563,
310,
2036,
30573,
341,
394,
432,
25,
923,
345,
394,
1946,
25,
923,
345,
394,
3601,
25,
1807,
345,
310,
456,
310,
1077,
1273,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_subs_to_float() {
let subs = vec!["a", "b", "c", "c", "b", "d", "a"];
assert_eq!(vec![0f32, 1f32, 2f32, 2f32, 1f32, 3f32, 0f32],
subs_to_float(&subs[..]))
} | rust_cleaned_test_functions.jsonl/787 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 137
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82767,
2346,
17586,
368,
341,
286,
1077,
5147,
284,
7486,
0,
1183,
64,
497,
330,
65,
497,
330,
66,
497,
330,
66,
497,
330,
65,
497,
330,
67,
497,
330,
64,
6332,
286,
2060,
10714,
10297,
4083... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_date() {
let mut c = Config::with_none();
c.date = Some("date".into());
assert_eq!(Some(DateFlag::Date), DateFlag::from_config(&c));
} | rust_cleaned_test_functions.jsonl/1306 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
5332,
4164,
368,
341,
286,
1077,
5206,
272,
284,
5532,
486,
4197,
31488,
543,
286,
272,
9907,
284,
4329,
445,
1028,
3263,
18122,
5231,
286,
2060,
10714,
10297,
8373,
19987,
12135,
486,
1916,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_pycrypto_xsalsa20() {
let key = "a6a7251c1e72916d11c2cb214d3c252539121d8e234e652d651fa4c8cff88030"
.from_hex()
.expect("Failed to decode hex string.");
let iv = "9e645a74e9e0a60d8243acd9177ab51a1beb8d5a2f5d700c"
.from_hex()
.expect("Failed to decode hex string.");
let plaintext = "093c5e5585579625337bd3ab619d615760d8c5b224a85b1d0efe0eb8a7ee163abb0376529fcc09bab506c618e13ce777d82c3ae9d1a6f972d4160287cbfe60bf2130fc0a6ff6049d0a5c8a82f429231f008082e845d7e189d37f9ed2b464e6b919e6523a8c1210bd52a02a4c3fe406d3085f5068d1909eeeca6369abc981a42e87fe665583f0ab85ae71f6f84f528e6b397af86f6917d9754b7320dbdc2fea81496f2732f532ac78c4e9c6cfb18f8e9bdf74622eb126141416776971a84f94d156beaf67aecbf2ad412e76e66e8fad7633f5b6d7f3d64b5c6c69ce29003c6024465ae3b89be78e915d88b4b5621d"
.from_hex()
.expect("Failed to decode hex string.");
let ciphertext = "b2af688e7d8fc4b508c05cc39dd583d6714322c64d7f3e63147aede2d9534934b04ff6f337b031815cd094bdbc6d7a92077dce709412286822ef0737ee47f6b7ffa22f9d53f11dd2b0a3bb9fc01d9a88f9d53c26e9365c2c3c063bc4840bfc812e4b80463e69d179530b25c158f543191cff993106511aa036043bbc75866ab7e34afc57e2cce4934a5faae6eabe4f221770183dd060467827c27a354159a081275a291f69d946d6fe28ed0b9ce08206cf484925a51b9498dbde178ddd3ae91a8581b91682d860f840782f6eea49dbb9bd721501d2c67122dea3b7283848c5f13e0c0de876bd227a856e4de593a3"
.from_hex()
.expect("Failed to decode hex string.");
let mut k0: [u8; 16] = [0; 16];
let mut k1: [u8; 16] = [0; 16];
let mut v: [u8; 24] = [0; 24];
for i in 0..16 {
k0[i] = key[i];
k1[i] = key[i+16];
}
for i in 0..24 {
v[i] = iv[i];
}
let rs = XSalsa20::xsalsa20_20_256(k0, k1, v, plaintext.clone());
assert_eq!(rs.to_vec().eq(&ciphertext), true);
} | rust_cleaned_test_functions.jsonl/68302 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
3337,
9444,
80646,
41826,
17,
15,
368,
341,
286,
1077,
1376,
284,
330,
64,
21,
64,
22,
17,
20,
16,
66,
16,
68,
22,
17,
24,
16,
21,
67,
16,
16,
66,
17,
7221,
17,
16,
19,
67,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_required_unless_valid_not_match() {
let mut params = Map::new();
params.assign("required", Value::String("".to_owned())).ok();
params.assign("other", Value::Boolean(true)).ok();
let mut rules = BTreeMap::new();
rules.insert("required",
vec![Rule::RequiredUnless("other", Value::Boolean(true))]);
let result = validate(&rules, params);
assert!(result.is_ok());
assert_eq!(result.unwrap().find(&["required"]).unwrap(),
&Value::String("".to_owned()));
} | rust_cleaned_test_functions.jsonl/108927 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 216
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18743,
4907,
1717,
8337,
7913,
10708,
368,
341,
262,
1077,
5206,
3628,
284,
5027,
486,
931,
543,
262,
3628,
17870,
445,
6279,
497,
5162,
486,
703,
445,
3263,
983,
51973,
34670,
562,
543,
262,
36... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_filter_run_union_array_dense() {
let mut builder = UnionBuilder::new_dense(3);
builder.append::<Int32Type>("A", 1).unwrap();
builder.append::<Int32Type>("A", 3).unwrap();
builder.append::<Int32Type>("A", 34).unwrap();
let array = builder.build().unwrap();
let filter_array = BooleanArray::from(vec![true, true, false]);
let c = filter(&array, &filter_array).unwrap();
let filtered = c.as_any().downcast_ref::<UnionArray>().unwrap();
let mut builder = UnionBuilder::new_dense(3);
builder.append::<Int32Type>("A", 1).unwrap();
builder.append::<Int32Type>("A", 3).unwrap();
let expected = builder.build().unwrap();
assert_eq!(filtered.data(), expected.data());
} | rust_cleaned_test_functions.jsonl/75316 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 338
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8727,
14007,
51621,
3858,
72619,
368,
341,
286,
1077,
5206,
7363,
284,
9145,
3297,
486,
931,
72619,
7,
18,
317,
286,
7363,
2057,
27638,
1072,
18,
17,
929,
13211,
32,
497,
220,
16,
568,
15454,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rdr_rule_with_to_v4_address_port_to_v4_address_port() {
assert_eq!(
parse_str_to_rdr_rules("rdr to 1.2.3.4 port 10000 -> to 192.168.1.1 port 20000;"),
Ok(vec![filter::Rdr {
proto: filter::SocketProtocol::Any,
dst_addr: net::IpAddress::Ipv4(net::Ipv4Address { addr: [1, 2, 3, 4] }),
dst_port_range: filter::PortRange { start: 10000, end: 10000 },
new_dst_addr: net::IpAddress::Ipv4(net::Ipv4Address { addr: [192, 168, 1, 1] }),
new_dst_port_range: filter::PortRange { start: 20000, end: 20000 },
nic: 0,
}])
);
} | rust_cleaned_test_functions.jsonl/29492 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 380
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
3612,
21124,
6615,
2346,
2273,
19,
6744,
8716,
2346,
2273,
19,
6744,
8716,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
2895,
2346,
1710,
3612,
21407,
445,
81,
3612,
311,
220,
16,
13,
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_poisson_10() {
let poisson = Poisson::new(10.0).unwrap();
let mut rng = crate::test::rng(123);
let mut sum_u64 = 0;
let mut sum_f64 = 0.;
for _ in 0..1000 {
let s_u64: u64 = poisson.sample(&mut rng);
let s_f64: f64 = poisson.sample(&mut rng);
sum_u64 += s_u64;
sum_f64 += s_f64;
}
let avg_u64 = (sum_u64 as f64) / 1000.0;
let avg_f64 = sum_f64 / 1000.0;
println!("Poisson averages: {} (u64) {} (f64)", avg_u64, avg_f64);
for &avg in &[avg_u64, avg_f64] {
assert!((avg - 10.0).abs() < 0.5);
}
} | rust_cleaned_test_functions.jsonl/118283 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 386
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
29048,
930,
62,
16,
15,
368,
341,
286,
1077,
3193,
48263,
284,
13808,
48263,
486,
931,
7,
16,
15,
13,
15,
568,
15454,
543,
286,
1077,
5206,
28422,
284,
17717,
486,
1944,
486,
69890,
7,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_debug() {
assert_eq!(
format!(
"{:?}",
Fp([0x5360bb5978678032, 0x7dd275ae799e128e, 0x5c5b5071ce4f4dcf, 0xcdb21f93078dbb3e, 0xc32365c5e73f474a, 0x115a2a5489babe5b])
),
"0x104bf052ad3bc99bcb176c24a06a6c3aad4eaf2308fc4d282e106c84a757d061052630515305e59bdddf8111bfdeb704"
);
} | rust_cleaned_test_functions.jsonl/70425 | {
"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,
15446,
368,
341,
262,
2060,
10714,
33673,
286,
3561,
33673,
310,
13868,
76475,
24375,
310,
434,
79,
2561,
15,
87,
20,
18,
21,
15,
6066,
20,
24,
22,
23,
21,
22,
23,
15,
18,
17,
11,
220,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_inner_doc_comment_of_items() {
let file = SourceFile::parse(
r#"
//! doc
// non-doc
mod foo {}
"#,
)
.ok()
.unwrap();
let module = file.syntax().descendants().find_map(Module::cast).unwrap();
assert!(module.doc_comments().doc_comment_text().is_none());
} | rust_cleaned_test_functions.jsonl/60277 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 163
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34345,
18869,
17638,
3575,
12134,
368,
341,
262,
1077,
1034,
284,
8748,
1703,
486,
6400,
1006,
286,
435,
2,
698,
286,
17664,
4629,
198,
286,
442,
2477,
11527,
198,
286,
1463,
15229,
5613,
286,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_summarization_t5() -> anyhow::Result<()> {
// Set-up translation model
let summarization_config = SummarizationConfig {
model_type: ModelType::T5,
model_resource: Box::new(RemoteResource::from_pretrained(T5ModelResources::T5_SMALL)),
config_resource: Box::new(RemoteResource::from_pretrained(T5ConfigResources::T5_SMALL)),
vocab_resource: Box::new(RemoteResource::from_pretrained(T5VocabResources::T5_SMALL)),
merges_resource: Box::new(RemoteResource::from_pretrained(T5VocabResources::T5_SMALL)),
min_length: 30,
max_length: 200,
early_stopping: true,
num_beams: 4,
length_penalty: 2.0,
..Default::default()
};
let model = SummarizationModel::new(summarization_config)?;
let input = ["In findings published Tuesday in Cornell University's arXiv by a team of scientists \
from the University of Montreal and a separate report published Wednesday in Nature Astronomy by a team \
from University College London (UCL), the presence of water vapour was confirmed in the atmosphere of K2-18b, \
a planet circling a star in the constellation Leo. This is the first such discovery in a planet in its star's \
habitable zone — not too hot and not too cold for liquid water to exist. The Montreal team, led by Björn Benneke, \
used data from the NASA's Hubble telescope to assess changes in the light coming from K2-18b's star as the planet \
passed between it and Earth. They found that certain wavelengths of light, which are usually absorbed by water, \
weakened when the planet was in the way, indicating not only does K2-18b have an atmosphere, but the atmosphere \
contains water in vapour form. The team from UCL then analyzed the Montreal team's data using their own software \
and confirmed their conclusion. This was not the first time scientists have found signs of water on an exoplanet, \
but previous discoveries were made on planets with high temperatures or other pronounced differences from Earth. \
\"This is the first potentially habitable planet where the temperature is right and where we now know there is water,\" \
said UCL astronomer Angelos Tsiaras. \"It's the best candidate for habitability right now.\" \"It's a good sign\", \
said Ryan Cloutier of the Harvard–Smithsonian Center for Astrophysics, who was not one of either study's authors. \
\"Overall,\" he continued, \"the presence of water in its atmosphere certainly improves the prospect of K2-18b being \
a potentially habitable planet, but further observations will be required to say for sure. \" \
K2-18b was first identified in 2015 by the Kepler space telescope. It is about 110 light-years from Earth and larger \
but less dense. Its star, a red dwarf, is cooler than the Sun, but the planet's orbit is much closer, such that a year \
on K2-18b lasts 33 Earth days. According to The Guardian, astronomers were optimistic that NASA's James Webb space \
telescope — scheduled for launch in 2021 — and the European Space Agency's 2028 ARIEL program, could reveal more \
about exoplanets like K2-18b."];
let output = model.summarize(&input);
assert_eq! (
output[0],
" the presence of water vapour was confirmed in the atmosphere of K2-18b. \
this is the first such discovery in a planet in its star's habitable zone. \
previous discoveries were made on planets with high temperatures or other pronounced differences from Earth."
);
Ok(())
} | rust_cleaned_test_functions.jsonl/48975 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 990
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10160,
5612,
2022,
528,
20,
368,
1464,
88964,
486,
2077,
71698,
341,
262,
442,
262,
2573,
5239,
14468,
1614,
198,
262,
1077,
28285,
2022,
5332,
284,
8116,
5612,
2022,
2648,
341,
286,
1614,
1819,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_xor() {
assert_eq!(false, xor(false, false));
assert_eq!(true, xor(false, true));
assert_eq!(true, xor(true, false));
assert_eq!(false, xor(true, true));
} | rust_cleaned_test_functions.jsonl/90316 | {
"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,
76462,
368,
341,
220,
2060,
10714,
10297,
3849,
11,
53941,
3576,
11,
895,
1106,
220,
2060,
10714,
10297,
1866,
11,
53941,
3576,
11,
830,
1106,
220,
2060,
10714,
10297,
1866,
11,
53941,
3715,
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 |
#[test]
fn test_validators_in_whitelist() {
let regular = make_keys(REGULAR_PEERS, 4);
let validators = make_keys(VALIDATORS[0], 2);
let mut connect_list = ConnectList::default();
check_in_connect_list(&connect_list, ®ular, &[], &[0, 1, 2, 3]);
check_in_connect_list(&connect_list, &validators, &[], &[0, 1]);
assert_eq!(connect_list.peers.len(), 0);
add_to_connect_list(&mut connect_list, &validators);
assert_eq!(connect_list.peers.len(), 2);
check_in_connect_list(&connect_list, ®ular, &[], &[0, 1, 2, 3]);
check_in_connect_list(&connect_list, &validators, &[0, 1], &[]);
} | rust_cleaned_test_functions.jsonl/28573 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 307
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8337,
2973,
1243,
36225,
57645,
368,
341,
286,
1077,
5792,
284,
1281,
12631,
61211,
7081,
45784,
4321,
11,
220,
19,
317,
286,
1077,
38588,
284,
1281,
12631,
7,
10044,
60345,
58,
15,
1125,
220,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_builder() {
let child_arr_data = ArrayData::new(
DataType::Int32,
5,
Some(0),
None,
0,
vec![Buffer::from_slice_ref(&[1i32, 2, 3, 4, 5])],
vec![],
);
let v = vec![0, 1, 2, 3];
let b1 = Buffer::from(&v[..]);
let arr_data = ArrayData::builder(DataType::Int32)
.len(20)
.offset(5)
.add_buffer(b1)
.null_bit_buffer(Buffer::from(vec![
0b01011111, 0b10110101, 0b01100011, 0b00011110,
]))
.add_child_data(child_arr_data.clone())
.build();
assert_eq!(20, arr_data.len());
assert_eq!(10, arr_data.null_count());
assert_eq!(5, arr_data.offset());
assert_eq!(1, arr_data.buffers().len());
assert_eq!(&[0, 1, 2, 3], arr_data.buffers()[0].as_slice());
assert_eq!(1, arr_data.child_data().len());
assert_eq!(child_arr_data, arr_data.child_data()[0]);
} | rust_cleaned_test_functions.jsonl/133938 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 602
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28532,
368,
341,
286,
1077,
1682,
11210,
1769,
284,
2910,
1043,
486,
931,
1006,
310,
33172,
486,
1072,
18,
17,
345,
310,
220,
20,
345,
310,
4329,
7,
15,
1326,
310,
2240,
345,
310,
220,
15,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_externs_tracking_hash_different_construction_order() {
let mut v1 = Options::default();
let mut v2 = Options::default();
let mut v3 = Options::default();
v1.externs = Externs::new(mk_map(vec![
(String::from("a"), new_public_extern_entry(vec!["b", "c"])),
(String::from("d"), new_public_extern_entry(vec!["e", "f"])),
]));
v2.externs = Externs::new(mk_map(vec![
(String::from("d"), new_public_extern_entry(vec!["e", "f"])),
(String::from("a"), new_public_extern_entry(vec!["b", "c"])),
]));
v3.externs = Externs::new(mk_map(vec![
(String::from("a"), new_public_extern_entry(vec!["b", "c"])),
(String::from("d"), new_public_extern_entry(vec!["f", "e"])),
]));
assert_same_hash(&v1, &v2);
assert_same_hash(&v1, &v3);
assert_same_hash(&v2, &v3);
} | rust_cleaned_test_functions.jsonl/100716 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 410
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
4301,
82,
66105,
8950,
82741,
3382,
3024,
7869,
368,
341,
262,
1077,
5206,
348,
16,
284,
14566,
486,
2258,
543,
262,
1077,
5206,
348,
17,
284,
14566,
486,
2258,
543,
262,
1077,
5206,
348,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_filter_array_slice() {
let a_slice = Int32Array::from(vec![5, 6, 7, 8, 9]).slice(1, 4);
let a = a_slice.as_ref();
let b = BooleanArray::from(vec![true, false, false, true]);
// filtering with sliced filter array is not currently supported
let c = filter(a, &b).unwrap();
let d = c.as_ref().as_any().downcast_ref::<Int32Array>().unwrap();
assert_eq!(2, d.len());
assert_eq!(6, d.value(0));
assert_eq!(9, d.value(1));
} | rust_cleaned_test_functions.jsonl/18779 | {
"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,
8727,
3858,
26488,
368,
341,
286,
1077,
264,
26488,
284,
1333,
18,
17,
1857,
486,
1499,
25592,
20703,
20,
11,
220,
21,
11,
220,
22,
11,
220,
23,
11,
220,
24,
10697,
24963,
7,
16,
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_c_str_len_panic() {
// expect panic because there is no terminating null
let _ = c_str_len_ptr("hallo".repeat(100000).as_ptr());
} | rust_cleaned_test_functions.jsonl/117736 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 76
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
2895,
6043,
620,
31270,
368,
341,
286,
442,
1720,
21975,
1576,
1052,
374,
902,
70581,
845,
198,
286,
1077,
716,
284,
272,
2895,
6043,
4348,
445,
11866,
385,
3263,
30624,
7,
16,
15,
15,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_clone() {
use std::sync::{
atomic::{AtomicUsize, Ordering},
Arc,
};
let count = Arc::new(AtomicUsize::new(0));
let value = Value::new(Foo(count.clone()));
assert_eq!(0, count.load(Ordering::SeqCst));
drop(value.clone());
assert_eq!(1, count.load(Ordering::SeqCst));
drop(value);
assert_eq!(2, count.load(Ordering::SeqCst));
#[derive(Clone)]
struct Foo(Arc<AtomicUsize>);
impl Drop for Foo {
fn drop(&mut self) {
self.0.fetch_add(1, Ordering::SeqCst);
}
}
} | rust_cleaned_test_functions.jsonl/51065 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 360
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54742,
368,
341,
286,
990,
1460,
486,
12996,
74843,
310,
24510,
22964,
65857,
52,
2141,
11,
68621,
1583,
310,
19689,
345,
286,
3634,
286,
1077,
1760,
284,
19689,
486,
931,
7,
65857,
52,
2141,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_response_json() {
let server = server::http(move |_req| async { http::Response::new("\"Hello\"".into()) });
let url = format!("http://{}/json", server.addr());
let res = reqwest::blocking::get(&url).unwrap();
assert_eq!(res.url().as_str(), &url);
assert_eq!(res.status(), reqwest::StatusCode::OK);
assert_eq!(res.content_length(), Some(7));
let body = res.json::<String>().unwrap();
assert_eq!("Hello", body);
} | rust_cleaned_test_functions.jsonl/131402 | {
"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,
9655,
9455,
368,
341,
262,
1077,
3538,
284,
3538,
486,
1254,
34081,
70886,
2958,
91,
3312,
314,
1758,
486,
2582,
486,
931,
38915,
9707,
2105,
3263,
18122,
2140,
3011,
262,
1077,
2515,
284,
3561,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_qr_code_url() {
let qr_code_url = authenticator::create_qr_code_url("foobar", "DGF3J5CSIU2JN6WEHECHIUUCLYHCNYAW");
println!("{}", qr_code_url)
} | rust_cleaned_test_functions.jsonl/89602 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8976,
81,
4136,
2903,
368,
341,
286,
1077,
49290,
4136,
2903,
284,
13210,
850,
486,
3182,
8976,
81,
4136,
2903,
445,
50267,
497,
330,
35,
36332,
18,
41,
20,
48407,
52,
17,
41,
45,
21,
12457,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_unity_android_api_version() {
let description = "Android OS 11 / API-30 (RP1A.201005.001/2107031736)";
assert_eq_dbg!(Some("30"), get_android_api_version(description));
} | rust_cleaned_test_functions.jsonl/68968 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 82
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
2439,
56665,
11697,
9438,
368,
341,
262,
1077,
4008,
284,
330,
21831,
10085,
220,
16,
16,
608,
5333,
12,
18,
15,
320,
21657,
16,
32,
13,
17,
15,
16,
15,
15,
20,
13,
15,
15,
16,
14,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extract_enum_not_applicable_for_element_with_no_fields() {
check_assist_not_applicable(extract_struct_from_enum_variant, r#"enum A { $0One }"#);
} | rust_cleaned_test_functions.jsonl/36313 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 85
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
31054,
7913,
8191,
46114,
5478,
7894,
6615,
6536,
12132,
368,
341,
286,
1779,
12083,
380,
7913,
8191,
46114,
5463,
2144,
15126,
5673,
31054,
46112,
11,
435,
55543,
9018,
362,
314,
400,
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 |
#[test]
fn test_ctoption() {
let a = CtOption::new(10, Choice::from(1));
let b = CtOption::new(9, Choice::from(1));
let c = CtOption::new(10, Choice::from(0));
let d = CtOption::new(9, Choice::from(0));
// Test is_some / is_none
assert!(bool::from(a.is_some()));
assert!(bool::from(!a.is_none()));
assert!(bool::from(b.is_some()));
assert!(bool::from(!b.is_none()));
assert!(bool::from(!c.is_some()));
assert!(bool::from(c.is_none()));
assert!(bool::from(!d.is_some()));
assert!(bool::from(d.is_none()));
// Test unwrap for Some
assert_eq!(a.unwrap(), 10);
assert_eq!(b.unwrap(), 9);
// Test equality
assert!(bool::from(a.ct_eq(&a)));
assert!(bool::from(!a.ct_eq(&b)));
assert!(bool::from(!a.ct_eq(&c)));
assert!(bool::from(!a.ct_eq(&d)));
// Test equality of None with different
// dummy value
assert!(bool::from(c.ct_eq(&d)));
// Test unwrap_or
assert_eq!(CtOption::new(1, Choice::from(1)).unwrap_or(2), 1);
assert_eq!(CtOption::new(1, Choice::from(0)).unwrap_or(2), 2);
// Test unwrap_or_else
assert_eq!(CtOption::new(1, Choice::from(1)).unwrap_or_else(|| 2), 1);
assert_eq!(CtOption::new(1, Choice::from(0)).unwrap_or_else(|| 2), 2);
// Test map
assert_eq!(
CtOption::new(1, Choice::from(1))
.map(|v| {
assert_eq!(v, 1);
2
})
.unwrap(),
2
);
assert_eq!(
CtOption::new(1, Choice::from(0))
.map(|_| 2)
.is_none()
.unwrap_u8(),
1
);
// Test and_then
assert_eq!(
CtOption::new(1, Choice::from(1))
.and_then(|v| {
assert_eq!(v, 1);
CtOption::new(2, Choice::from(0))
})
.is_none()
.unwrap_u8(),
1
);
assert_eq!(
CtOption::new(1, Choice::from(1))
.and_then(|v| {
assert_eq!(v, 1);
CtOption::new(2, Choice::from(1))
})
.unwrap(),
2
);
assert_eq!(
CtOption::new(1, Choice::from(0))
.and_then(|_| CtOption::new(2, Choice::from(0)))
.is_none()
.unwrap_u8(),
1
);
assert_eq!(
CtOption::new(1, Choice::from(0))
.and_then(|_| CtOption::new(2, Choice::from(1)))
.is_none()
.unwrap_u8(),
1
);
// Test or_else
assert_eq!(
CtOption::new(1, Choice::from(0))
.or_else(|| CtOption::new(2, Choice::from(1)))
.unwrap(),
2
);
assert_eq!(
CtOption::new(1, Choice::from(1))
.or_else(|| CtOption::new(2, Choice::from(0)))
.unwrap(),
1
);
assert_eq!(
CtOption::new(1, Choice::from(1))
.or_else(|| CtOption::new(2, Choice::from(1)))
.unwrap(),
1
);
assert!(bool::from(
CtOption::new(1, Choice::from(0))
.or_else(|| CtOption::new(2, Choice::from(0)))
.is_none()
));
assert!(
CtOption::new(1, Choice::from(0))
.ct_eq(&CtOption::new(1, Choice::from(1)))
.unwrap_u8()
== 0
);
assert!(
CtOption::new(1, Choice::from(1))
.ct_eq(&CtOption::new(1, Choice::from(0)))
.unwrap_u8()
== 0
);
assert!(
CtOption::new(1, Choice::from(0))
.ct_eq(&CtOption::new(2, Choice::from(1)))
.unwrap_u8()
== 0
);
assert!(
CtOption::new(1, Choice::from(1))
.ct_eq(&CtOption::new(2, Choice::from(0)))
.unwrap_u8()
== 0
);
assert!(
CtOption::new(1, Choice::from(0))
.ct_eq(&CtOption::new(1, Choice::from(0)))
.unwrap_u8()
== 1
);
assert!(
CtOption::new(1, Choice::from(0))
.ct_eq(&CtOption::new(2, Choice::from(0)))
.unwrap_u8()
== 1
);
assert!(
CtOption::new(1, Choice::from(1))
.ct_eq(&CtOption::new(2, Choice::from(1)))
.unwrap_u8()
== 0
);
assert!(
CtOption::new(1, Choice::from(1))
.ct_eq(&CtOption::new(2, Choice::from(1)))
.unwrap_u8()
== 0
);
assert!(
CtOption::new(1, Choice::from(1))
.ct_eq(&CtOption::new(1, Choice::from(1)))
.unwrap_u8()
== 1
);
assert!(
CtOption::new(1, Choice::from(1))
.ct_eq(&CtOption::new(1, Choice::from(1)))
.unwrap_u8()
== 1
);
} | rust_cleaned_test_functions.jsonl/106392 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2707
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26134,
2047,
368,
341,
262,
1077,
264,
284,
62279,
5341,
486,
931,
7,
16,
15,
11,
27107,
486,
1499,
7,
16,
1106,
262,
1077,
293,
284,
62279,
5341,
486,
931,
7,
24,
11,
27107,
486,
1499,
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... | 7 |
#[test]
fn test_account_one() {
let paths = get_tmp_accounts_path!();
let accounts = AccountsDB::new(&paths.paths);
let mut pubkeys: Vec<Pubkey> = vec![];
create_account(&accounts, &mut pubkeys, 0, 1, 0, 0);
let ancestors = vec![(0, 0)].into_iter().collect();
let account = accounts.load_slow(&ancestors, &pubkeys[0]).unwrap();
let mut default_account = Account::default();
default_account.difs = 1;
assert_eq!((default_account, 0), account);
} | rust_cleaned_test_functions.jsonl/49129 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 230
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13500,
11667,
368,
341,
286,
1077,
12716,
284,
633,
16125,
55665,
2638,
0,
543,
286,
1077,
9618,
284,
40655,
3506,
486,
931,
2099,
21623,
65345,
317,
286,
1077,
5206,
6675,
10563,
25,
11312,
21604... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bit_reader_get_value_boundary() {
let buffer = vec![10, 0, 0, 0, 20, 0, 30, 0, 0, 0, 40, 0];
let mut bit_reader = BitReader::from(buffer);
assert_eq!(bit_reader.get_value::<i64>(32), Some(10));
assert_eq!(bit_reader.get_value::<i64>(16), Some(20));
assert_eq!(bit_reader.get_value::<i64>(32), Some(30));
assert_eq!(bit_reader.get_value::<i64>(16), Some(40));
} | rust_cleaned_test_functions.jsonl/115729 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 214
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13996,
22306,
3062,
3142,
54004,
368,
341,
286,
1077,
4147,
284,
7486,
20703,
16,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
17,
15,
11,
220,
15,
11,
220,
18,
15,
11,
220,
15,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_info_string() {
macro_rules! assert_get_info_string {
($markdown:expr, $start:expr, $expected_range: expr) => {{
let bytes = $markdown.as_bytes();
let slice = get_info_string(bytes, $start);
if let Some((s, e)) = $expected_range {
assert!(slice.is_some());
assert_eq!(&$markdown[s..e], slice.unwrap());
} else {
assert!(slice.is_none());
}
}};
};
assert_get_info_string!("", 0, None);
assert_get_info_string!(" ", 0, None);
assert_get_info_string!("\n", 0, None);
assert_get_info_string!("foobar", 0, Some((0, 6)));
assert_get_info_string!("foobar\n", 0, Some((0, 6)));
assert_get_info_string!("foobar\r\n", 0, Some((0, 6)));
assert_get_info_string!("foobar ", 0, Some((0, 6)));
assert_get_info_string!("foobar baz", 0, Some((0, 6)));
assert_get_info_string!(" foobar \n", 0, Some((2, 8)));
assert_get_info_string!(" foobar baz \n", 0, Some((2, 8)));
assert_get_info_string!("some```foobar", 7, Some((7, 13)));
} | rust_cleaned_test_functions.jsonl/21608 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 641
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
3109,
3904,
368,
341,
286,
18072,
21407,
0,
2060,
3062,
3109,
3904,
341,
310,
1711,
60073,
96011,
11,
400,
2468,
96011,
11,
400,
7325,
9698,
25,
15169,
8,
589,
80505,
394,
1077,
5820,
284,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_wait_one_connection() {
let path_to_socket = "/tmp/test_socket_http_server1.sock";
fs::remove_file(path_to_socket).unwrap_or_default();
let mut server = HttpServer::new(path_to_socket.to_string()).unwrap();
server.start_server().unwrap();
// Test one incoming connection.
let mut socket = UnixStream::connect(path_to_socket).unwrap();
assert!(server.requests().unwrap().is_empty());
socket
.write_all(
b"PATCH /machine-config HTTP/1.1\r\n\
Content-Length: 13\r\n\
Content-Type: application/json\r\n\r\nwhatever body",
)
.unwrap();
let mut req_vec = server.requests().unwrap();
let server_request = req_vec.remove(0);
server
.respond(server_request.process(|_request| {
let mut response = Response::new(Version::Http11, StatusCode::OK);
let response_body = b"response body";
response.set_body(Body::new(response_body.to_vec()));
response
}))
.unwrap();
assert!(server.requests().unwrap().is_empty());
let mut buf: [u8; 1024] = [0; 1024];
assert!(socket.read(&mut buf[..]).unwrap() > 0);
fs::remove_file(path_to_socket).unwrap();
} | rust_cleaned_test_functions.jsonl/2920 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 678
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18760,
11667,
15866,
368,
341,
286,
1077,
1815,
2346,
19555,
284,
3521,
5173,
12697,
19555,
25888,
12015,
16,
68171,
876,
286,
8619,
486,
5399,
2458,
5581,
2346,
19555,
568,
15454,
8734,
9993,
1428,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_current_channel() {
let dir = tempfile::tempdir().unwrap();
fs::write(
dir.path().join("current_channel.json"),
r#"{"version":"1","content":{"legacy_amber_source_name":"stable"}}"#,
)
.unwrap();
assert_matches!(read_current_channel(dir.path()), Ok(ref channel) if channel == "stable");
} | rust_cleaned_test_functions.jsonl/110840 | {
"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,
6443,
11080,
14571,
368,
341,
286,
1077,
5419,
284,
54819,
486,
3888,
3741,
1005,
15454,
1428,
286,
8619,
486,
4934,
1006,
310,
5419,
3875,
1005,
5987,
445,
3231,
14571,
4323,
4461,
310,
435,
5554... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_multiple() {
let mut map = MultiMap::<char, u8>::new();
map.insert('x', 1);
map.insert('x', 3);
map.insert('x', 1);
map.insert('x', 5);
assert_tokens(
&map,
&[
Token::Map { len: Some(1) },
Token::Char('x'),
Token::Seq { len: Some(4) },
Token::U8(1),
Token::U8(3),
Token::U8(1),
Token::U8(5),
Token::SeqEnd,
Token::MapEnd,
],
);
} | rust_cleaned_test_functions.jsonl/28210 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 387
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45233,
368,
341,
286,
1077,
5206,
2415,
284,
17439,
2227,
27638,
1762,
11,
575,
23,
6831,
931,
543,
286,
2415,
7030,
492,
87,
516,
220,
16,
317,
286,
2415,
7030,
492,
87,
516,
220,
18,
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_instance_of_prom() {
log::info!("> test_instance_of_prom");
let rt = init_test_rt();
let io = rt.exe_rt_task_in_event_loop(|q_js_rt| {
let q_ctx = q_js_rt.get_main_context();
let res = q_ctx.eval(Script::new(
"test_instance_of_prom.es",
"(new Promise((res, rej) => {}));",
));
match res {
Ok(v) => {
log::info!("checking if instance_of prom");
is_promise_q(q_ctx, &v)
&& is_promise_q(q_ctx, &v)
&& is_promise_q(q_ctx, &v)
&& is_promise_q(q_ctx, &v)
&& is_promise_q(q_ctx, &v)
}
Err(e) => {
log::error!("err testing instance_of prom: {}", e);
false
}
}
});
assert!(io);
log::info!("< test_instance_of_prom");
std::thread::sleep(Duration::from_secs(1));
} | rust_cleaned_test_functions.jsonl/6887 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 675
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11904,
3575,
47877,
368,
341,
286,
1487,
486,
2733,
17223,
29,
1273,
11904,
3575,
47877,
3071,
286,
1077,
16677,
284,
2930,
4452,
40169,
543,
286,
1077,
6399,
284,
16677,
19399,
40169,
12184,
1243,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_devices() -> Result<(), Box<dyn Error>> {
test_init()?;
let num_devices = Device::num_devices()?;
let all_devices: CudaResult<Vec<_>> = Device::devices()?.collect();
let all_devices = all_devices?;
assert_eq!(num_devices as usize, all_devices.len());
Ok(())
} | rust_cleaned_test_functions.jsonl/39768 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41334,
368,
1464,
5714,
68843,
8261,
92846,
4600,
2452,
341,
286,
1273,
6137,
94136,
286,
1077,
1629,
41334,
284,
13903,
486,
2413,
41334,
94136,
286,
1077,
678,
41334,
25,
356,
8053,
2077,
50439,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_pointer_types() {
test_file! {
#[diplomat::bridge]
mod ffi {
#[diplomat::opaque]
struct MyOpaqueStruct(UnknownType);
struct MyStruct {
a: Box<MyOpaqueStruct>,
b: u8,
}
impl MyStruct {
pub fn new(foo: &MyStruct, bar: &mut MyStruct) -> MyStruct {
unimplemented!()
}
}
}
}
} | rust_cleaned_test_functions.jsonl/61351 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 366
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21425,
9763,
368,
341,
286,
1273,
2458,
0,
341,
310,
11506,
8579,
500,
80768,
486,
13709,
921,
310,
1463,
76956,
341,
394,
11506,
8579,
500,
80768,
486,
95480,
921,
394,
2036,
3017,
69398,
9422,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_list_get_item_unchecked_sanity() {
Python::with_gil(|py| {
let list = PyList::new(py, &[2, 3, 5, 7]);
let obj = unsafe { list.get_item_unchecked(0) };
assert_eq!(obj.extract::<i32>().unwrap(), 2);
});
} | rust_cleaned_test_functions.jsonl/108637 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 152
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2019,
3062,
5634,
4907,
7549,
643,
38270,
368,
341,
286,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
341,
310,
1077,
1140,
284,
5355,
852,
486,
931,
46827,
11,
44590,
17,
11,
220,
18,
11,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_load() {
let mut file = File::open("tests/elfs/noop.so").expect("file open failed");
let mut elf_bytes = Vec::new();
file.read_to_end(&mut elf_bytes)
.expect("failed to read elf file");
ElfExecutable::load(Config::default(), &elf_bytes).expect("validation failed");
} | rust_cleaned_test_functions.jsonl/55862 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 146
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12411,
368,
341,
286,
1077,
5206,
1034,
284,
2887,
486,
2508,
445,
23841,
14,
490,
82,
33100,
453,
26476,
1827,
17119,
445,
1192,
1787,
4641,
797,
286,
1077,
5206,
40745,
12524,
284,
11312,
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_should_preserve_empty_lines() {
new_ucmd!().pipe_in("\n").succeeds().stdout_is("\n");
new_ucmd!()
.arg("-w1")
.pipe_in("0\n1\n\n2\n\n\n")
.succeeds()
.stdout_is("0\n1\n\n2\n\n\n");
} | rust_cleaned_test_functions.jsonl/23267 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43378,
32116,
5852,
15124,
18323,
368,
341,
262,
501,
68887,
2277,
0,
1005,
13768,
1243,
4921,
77,
1827,
82,
29264,
82,
1005,
36358,
6892,
4921,
77,
3071,
262,
501,
68887,
2277,
0,
741,
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_step_three_cells_rotate() {
let mut world = World::new(10);
world.set(2, 1, true);
world.set(2, 2, true);
world.set(2, 3, true);
world = world.step();
assert_eq!(world.is_alive(1, 2), true);
assert_eq!(world.is_alive(2, 2), true);
assert_eq!(world.is_alive(3, 2), true);
assert_eq!(world.is_alive(2, 1), false);
assert_eq!(world.is_alive(2, 3), false);
} | rust_cleaned_test_functions.jsonl/23844 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 245
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11946,
50016,
37796,
60834,
368,
341,
286,
1077,
5206,
1879,
284,
4337,
486,
931,
7,
16,
15,
317,
286,
1879,
980,
7,
17,
11,
220,
16,
11,
830,
317,
286,
1879,
980,
7,
17,
11,
220,
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_checked_id() {
assert!(checked_id("dummy").is_ok());
assert!(checked_id("dummy_1").is_ok());
assert_eq!(
format!("{}", checked_id("").unwrap_err()),
"The ID cannot be empty."
);
assert_eq!(
format!("{}", checked_id("dummy!!").unwrap_err()),
"API Resource IDs can only contain alphanumeric characters and underscores."
);
} | rust_cleaned_test_functions.jsonl/106564 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 220
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56456,
842,
368,
341,
286,
2060,
10297,
7549,
842,
445,
31390,
1827,
285,
19817,
1423,
286,
2060,
10297,
7549,
842,
445,
31390,
62,
16,
1827,
285,
19817,
5231,
286,
2060,
10714,
33673,
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,
1... | 1 |
#[test]
fn test_one_lq_zero() {
let text = " {% if 1 > 0 %} true {% else %} false {% endif %} ";
assert_template_result!(" true ", text);
} | rust_cleaned_test_functions.jsonl/28124 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 71
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11667,
907,
80,
19359,
368,
341,
262,
1077,
1467,
284,
330,
52261,
421,
220,
16,
861,
220,
15,
1018,
92,
830,
52261,
770,
1018,
92,
895,
52261,
12330,
1018,
92,
7620,
262,
2060,
8693,
5287,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.