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_nested_function_declaration() {
assert_json_snapshot!(
parse_function_declaration(
r#"function a() {
function b() {
a();
}
}"#
.into()
)
.unwrap()
.1
);
} | rust_cleaned_test_functions.jsonl/13285 | {
"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,
66279,
9174,
77926,
368,
341,
286,
2060,
9455,
53265,
33673,
310,
4715,
9174,
77926,
1006,
394,
435,
55543,
1688,
264,
368,
341,
503,
729,
293,
368,
341,
664,
264,
543,
503,
456,
394,
335,
1,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_enrich_short_tensors() {
let tensors = vec![
pb::TensorProto {
dtype: pb::DataType::DtFloat.into(),
tensor_shape: Some(tensor_shape(&[])),
float_val: vec![],
..Default::default()
},
pb::TensorProto {
dtype: pb::DataType::DtFloat.into(),
tensor_shape: Some(tensor_shape(&[])),
tensor_content: f32::to_le_bytes(0.125)[..2].to_vec(),
..Default::default()
},
];
for tensor in tensors {
let v = EventValue::Summary(SummaryValue(Box::new(Value::Tensor(tensor.clone()))));
let expected = Err(DataLoss);
let actual = v.into_scalar();
assert_eq!(
actual, expected,
"into_scalar for {:?}: got {:?}, expected {:?}",
&tensor, actual, expected
)
}
} | rust_cleaned_test_functions.jsonl/105065 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 665
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6205,
13851,
16673,
91067,
368,
341,
310,
1077,
77087,
284,
7486,
90515,
394,
17310,
486,
25336,
31549,
341,
503,
13231,
25,
17310,
486,
22653,
486,
69079,
5442,
39860,
3148,
503,
15626,
13597,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_atomic() {
let atomic = AtomicBool::new(false);
let start = Instant::now();
for _ in 0..100000000 {
atomic.compare_exchange(false, true, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(true, false, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(false, true, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(true, false, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(false, true, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(true, false, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(false, true, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(true, false, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(false, true, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(true, false, Ordering::Acquire, Ordering::Relaxed);
}
println!("!!!!!!atomic bool time: {:?}", Instant::now() - start);
let atomic = AtomicU8::new(0);
let start = Instant::now();
for _ in 0..100000000 {
atomic.compare_exchange(0, 1, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(1, 2, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(2, 3, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(3, 4, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(4, 5, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(5, 6, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(6, 7, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(7, 8, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(8, 9, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(9, 0, Ordering::Acquire, Ordering::Relaxed);
}
println!("!!!!!!atomic u8 time: {:?}", Instant::now() - start);
let atomic = AtomicU16::new(0);
let start = Instant::now();
for _ in 0..100000000 {
atomic.compare_exchange(0, 1000, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(1000, 2000, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(2000, 3000, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(3000, 4000, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(4000, 5000, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(5000, 6000, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(6000, 7000, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(7000, 8000, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(8000, 9000, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(9000, 0, Ordering::Acquire, Ordering::Relaxed);
}
println!("!!!!!!atomic u16 time: {:?}", Instant::now() - start);
let atomic = AtomicU32::new(0);
let start = Instant::now();
for _ in 0..100000000 {
atomic.compare_exchange(0, 100000, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(100000, 200000, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(200000, 300000, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(300000, 400000, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(400000, 500000, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(500000, 600000, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(600000, 700000, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(700000, 800000, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(800000, 900000, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(900000, 0, Ordering::Acquire, Ordering::Relaxed);
}
println!("!!!!!!atomic u32 time: {:?}", Instant::now() - start);
let atomic = AtomicU64::new(0);
let start = Instant::now();
for _ in 0..100000000 {
atomic.compare_exchange(0, 10000000000, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(10000000000, 20000000000, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(20000000000, 30000000000, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(30000000000, 40000000000, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(40000000000, 50000000000, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(50000000000, 60000000000, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(60000000000, 70000000000, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(70000000000, 80000000000, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(80000000000, 90000000000, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(90000000000, 0, Ordering::Acquire, Ordering::Relaxed);
}
println!("!!!!!!atomic u64 time: {:?}", Instant::now() - start);
let atomic = AtomicUsize::new(0);
let start = Instant::now();
for _ in 0..100000000 {
atomic.compare_exchange(0, 10000000000, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(10000000000, 20000000000, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(20000000000, 30000000000, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(30000000000, 40000000000, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(40000000000, 50000000000, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(50000000000, 60000000000, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(60000000000, 70000000000, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(70000000000, 80000000000, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(80000000000, 90000000000, Ordering::Acquire, Ordering::Relaxed);
atomic.compare_exchange(90000000000, 0, Ordering::Acquire, Ordering::Relaxed);
}
println!("!!!!!!atomic usize time: {:?}", Instant::now() - start);
} | rust_cleaned_test_functions.jsonl/62444 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2592
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51367,
368,
972,
262,
1077,
24510,
284,
30316,
11233,
486,
931,
3576,
736,
262,
1077,
1191,
284,
18058,
486,
3328,
1647,
262,
369,
716,
304,
220,
15,
496,
16,
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... | 7 |
#[test]
fn test_typescript_replace_keywords() {
let yamlpath = "./tests/keyworded_registry.yaml";
let yaml_content = std::fs::read_to_string(yamlpath).unwrap();
let mut registry = serde_yaml::from_str::<Registry>(yaml_content.as_str()).unwrap();
buildgen::typescript::replace_keywords(&mut registry);
let actual_content = serde_yaml::to_string(®istry).unwrap();
let expected_content =
std::fs::read_to_string("./tests/keyworded_registry.goldenfile.yaml").unwrap();
let mut linecount = 1;
for (expected_line, line) in expected_content.lines().zip(actual_content.lines()) {
assert_eq!(expected_line, line, "error on line {}", linecount);
linecount += 1;
}
} | rust_cleaned_test_functions.jsonl/15222 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 288
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9763,
1228,
10633,
51354,
368,
341,
262,
1077,
32246,
2343,
284,
5924,
23841,
14,
19863,
291,
50650,
33406,
876,
262,
1077,
32246,
7495,
284,
1460,
486,
3848,
486,
878,
2346,
3904,
7021,
9467,
234... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_write_rtp() -> Result<()> {
let tests = vec![
(
"When given an empty payload; it should return nil",
vec![],
false,
vec![],
false,
),
(
"When no keyframe is defined; it should discard the packet",
vec![0x25, 0x90, 0x90],
false,
vec![],
false,
),
(
"When a valid Single NAL Unit packet is given; it should unpack it without error",
vec![0x27, 0x90, 0x90],
true,
vec![0x00, 0x00, 0x00, 0x01, 0x27, 0x90, 0x90],
false,
),
(
"When a valid STAP-A packet is given; it should unpack it without error",
vec![
0x38, 0x00, 0x03, 0x27, 0x90, 0x90, 0x00, 0x05, 0x28, 0x90, 0x90, 0x90, 0x90,
],
true,
vec![
0x00, 0x00, 0x00, 0x01, 0x27, 0x90, 0x90, 0x00, 0x00, 0x00, 0x01, 0x28, 0x90, 0x90,
0x90, 0x90,
],
false,
),
];
for (_name, payload, has_key_frame, want_bytes, _reuse) in tests {
let mut writer = vec![];
{
let w = Cursor::new(&mut writer);
let mut h264writer = H264Writer::new(w);
h264writer.has_key_frame = has_key_frame;
let packet = rtp::packet::Packet {
payload: Bytes::from(payload),
..Default::default()
};
h264writer.write_rtp(&packet)?;
h264writer.close()?;
}
assert_eq!(want_bytes, writer);
}
Ok(())
} | rust_cleaned_test_functions.jsonl/93658 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1003
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
1710,
790,
368,
1464,
5714,
71698,
341,
262,
1077,
7032,
284,
7486,
90515,
286,
2399,
310,
330,
4498,
2661,
458,
4287,
7729,
26,
432,
1265,
470,
2092,
756,
310,
7486,
20703,
1259,
310,
895... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_temporal_array_date64_year() {
let a: PrimitiveArray<Date64Type> =
vec![Some(1514764800000), None, Some(1550636625000)].into();
let b = year(&a).unwrap();
assert_eq!(2018, b.value(0));
assert!(!b.is_valid(1));
assert_eq!(2019, b.value(2));
} | rust_cleaned_test_functions.jsonl/128630 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 165
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11771,
9819,
3858,
4164,
21,
19,
14645,
368,
341,
286,
1077,
264,
25,
51460,
1857,
98879,
21,
19,
929,
29,
4035,
310,
7486,
20703,
8373,
7,
16,
20,
16,
19,
22,
21,
19,
23,
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_scale_mat() {
let scale_vec = Vec3::new(1.0, 0.0, 2.0);
let transform = Transform::new_from_scale(scale_vec);
let vertex = Vec3::new(1.0, 1.0, 1.0);
let transform_mat = transform.make_mat4();
let transformed_vertex = mat4_mul_vec3(&transform_mat, &vertex);
println!("Matrix: {:?}", transform_mat);
println!("Vertex: {:?}", transformed_vertex);
assert_abs_diff_eq!(transformed_vertex[0], scale_vec[0], epsilon = 0.0001);
assert_abs_diff_eq!(transformed_vertex[1], scale_vec[1], epsilon = 0.0001);
assert_abs_diff_eq!(transformed_vertex[2], scale_vec[2], epsilon = 0.0001);
} | rust_cleaned_test_functions.jsonl/21593 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 274
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16727,
16610,
368,
341,
262,
1077,
5452,
13251,
284,
11312,
18,
486,
931,
7,
16,
13,
15,
11,
220,
15,
13,
15,
11,
220,
17,
13,
15,
317,
262,
1077,
5165,
284,
15226,
486,
931,
5673,
16727,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
let mut stack = Stack::new();
assert_eq!(stack.get(0), None);
let _ = stack.push(U256::MAX);
assert_eq!(stack.get(0), Some(&U256::MAX));
} | rust_cleaned_test_functions.jsonl/90842 | {
"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,
3062,
368,
341,
286,
1077,
5206,
5611,
284,
14284,
486,
931,
1428,
286,
2060,
10714,
10297,
7693,
670,
7,
15,
701,
2240,
626,
286,
1077,
716,
284,
5611,
2552,
12317,
17,
20,
21,
486,
10586,
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 |
#[test]
fn test_negotiate_outbound_select() -> Result<()> {
let (a, mut b) = MemorySocket::new_pair();
let test_protocol = b"/hello/1.0.0";
let hello_request = b"Hello World!";
let outbound = async move {
let mut stream = negotiate_outbound_select(a, test_protocol).await?;
write_u16frame(&mut stream, hello_request).await?;
stream.flush().await?;
// Force return type of the async block
let result: Result<()> = Ok(());
result
};
let inbound = async move {
let mut buf = BytesMut::new();
read_u16frame(&mut b, &mut buf).await?;
assert_eq!(buf.as_ref(), PROTOCOL_SELECT);
read_u16frame(&mut b, &mut buf).await?;
assert_eq!(buf.as_ref(), test_protocol);
read_u16frame(&mut b, &mut buf).await?;
assert_eq!(buf.as_ref(), hello_request);
// Force return type of the async block
let result: Result<()> = Ok(());
result
};
let (result_outbound, result_inbound) = block_on(join(outbound, inbound));
assert!(result_outbound.is_ok());
assert!(result_inbound.is_ok());
Ok(())
} | rust_cleaned_test_functions.jsonl/37611 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 621
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28209,
354,
6493,
6068,
10891,
13051,
368,
1464,
5714,
71698,
341,
286,
1077,
320,
64,
11,
5206,
293,
8,
284,
13850,
10286,
486,
931,
14445,
543,
286,
1077,
1273,
34880,
284,
293,
3115,
14990,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_unit_variant() {
#[derive(Debug, PartialEq, Valuable, Serialize)]
enum E {
V,
}
assert_ser_tokens(
&Serializable::new(E::V),
&[
Token::TupleVariant {
name: "E",
variant: "V",
len: 0,
},
Token::TupleVariantEnd,
],
);
assert_ser_tokens(
&E::V,
&[Token::UnitVariant {
name: "E",
variant: "V",
}],
);
} | rust_cleaned_test_functions.jsonl/44211 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 323
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14832,
46112,
368,
341,
262,
11506,
27098,
42618,
11,
55039,
11,
4104,
13128,
11,
39900,
5563,
262,
7618,
468,
341,
286,
647,
345,
262,
555,
262,
2060,
75861,
28838,
1006,
286,
609,
29268,
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_discard_errored_service_config_change() {
let mut testkit = testkit_with_supervisor_and_service(4);
let new_consensus_config = consensus_config_propose_first_variant(&testkit);
let propose = ConfigProposeBuilder::new(CFG_CHANGE_HEIGHT)
.extend_service_config_propose("error".to_string())
.extend_consensus_config_propose(new_consensus_config)
.build();
let signed_proposal = sign_config_propose_transaction(&testkit, propose, ValidatorId(0));
let block = testkit.create_block_with_transaction(signed_proposal);
let err = block.transactions[0].status().unwrap_err();
assert!(err
.description()
.contains("IncService: Configure error request"));
assert_eq!(config_propose_entry(&testkit), None);
} | rust_cleaned_test_functions.jsonl/93838 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 302
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37745,
567,
62,
40296,
1151,
12267,
5332,
15947,
368,
341,
262,
1077,
5206,
1273,
8226,
284,
1273,
8226,
6615,
23723,
31396,
8378,
12267,
7,
19,
317,
262,
1077,
501,
31971,
13626,
5332,
284,
23869... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_logic_not_function() -> Result<()> {
let tests = vec![
ScalarFunction2Test {
name: "not",
columns: vec![Series::from_data(vec![true, false])],
expect: Series::from_data(vec![false, true]),
error: "",
},
ScalarFunction2Test {
name: "not-null",
columns: vec![Series::from_data(vec![None, Some(true), Some(false)])],
expect: Series::from_data(vec![None, Some(false), Some(true)]),
error: "",
},
ScalarFunction2Test {
name: "not-null",
columns: vec![Arc::new(NullColumn::new(4))],
expect: Arc::new(NullColumn::new(4)),
error: "",
},
];
test_scalar_functions2(LogicNotFunction::try_create("not")?, &tests)
} | rust_cleaned_test_functions.jsonl/38914 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 429
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54335,
7913,
9174,
368,
1464,
5714,
71698,
341,
262,
1077,
7032,
284,
7486,
90515,
286,
35176,
5152,
17,
2271,
341,
310,
829,
25,
330,
1921,
756,
310,
8147,
25,
7486,
20703,
25544,
486,
1499,
17... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_fpathconf_limited() {
let f = tempfile().unwrap();
let path_max = fpathconf(f.as_raw_fd(), PathconfVar::PATH_MAX);
assert!(path_max.expect("fpathconf failed").expect("PATH_MAX is unlimited") > 0);
} | rust_cleaned_test_functions.jsonl/8997 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
2343,
6135,
907,
31511,
368,
341,
262,
1077,
282,
284,
54819,
1005,
15454,
543,
1066,
262,
1077,
1815,
6345,
284,
282,
2343,
6135,
955,
5357,
16067,
17676,
1507,
7933,
6135,
3962,
486,
13593,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_normal_and_anon_label_error() {
let mut a = CodeAssembler::new(64).unwrap();
let mut label = a.create_label();
a.nop().unwrap();
let anon = a.fwd().unwrap();
a.je(anon).unwrap();
a.set_label(&mut label).unwrap();
a.anonymous_label().unwrap();
assert!(a.nop().is_err());
} | rust_cleaned_test_functions.jsonl/71814 | {
"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,
13973,
8378,
12008,
263,
6106,
4096,
368,
341,
10217,
5206,
264,
284,
6119,
77858,
486,
931,
7,
21,
19,
568,
15454,
543,
10217,
5206,
2383,
284,
264,
2520,
6106,
543,
11323,
1253,
453,
1005,
154... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_float() {
FloatType::test(Encoding::PLAIN, TEST_SET_SIZE, -1);
FloatType::test(Encoding::PLAIN_DICTIONARY, TEST_SET_SIZE, -1);
} | rust_cleaned_test_functions.jsonl/45124 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 73
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17586,
368,
341,
262,
13001,
929,
486,
1944,
85177,
486,
90889,
11,
13602,
8481,
4098,
11,
481,
16,
317,
262,
13001,
929,
486,
1944,
85177,
486,
90889,
44663,
3580,
8642,
11,
13602,
8481,
4098,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_raw_returns_default_value_when_no_data_from_webcam() -> Result<(), Box<dyn Error>> {
let (als, _) = setup();
assert_eq!(DEFAULT_LUX, als.get_raw()?);
Ok(())
} | rust_cleaned_test_functions.jsonl/25974 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 108
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
16067,
58900,
9993,
3142,
47636,
6536,
1769,
5673,
25960,
11599,
368,
1464,
5714,
68843,
8261,
92846,
4600,
2452,
341,
286,
1077,
320,
1127,
11,
27439,
284,
6505,
1428,
286,
2060,
10714,
10297... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
#[test]
fn test_fq_root_of_unity() {
assert_eq!(FqParameters::TWO_ADICITY, 46);
assert_eq!(
Fq::multiplicative_generator().pow([
0x7510c00000021423,
0x88bee82520005c2d,
0x67cc03d44e3c7bcd,
0x1701b28524ec688b,
0xe9185f1443ab18ec,
0x6b8
]),
Fq::two_adic_root_of_unity()
);
assert_eq!(
Fq::two_adic_root_of_unity().pow([1 << FqParameters::TWO_ADICITY]),
Fq::one()
);
assert!(Fq::multiplicative_generator().sqrt().is_none());
} | rust_cleaned_test_functions.jsonl/41218 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 333
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
80,
12993,
3575,
62,
2439,
368,
341,
262,
2060,
10714,
10297,
37,
80,
9706,
486,
51,
22681,
22510,
1317,
3333,
11,
220,
19,
21,
317,
262,
2060,
10714,
33673,
286,
434,
80,
486,
77976,
652... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_primitive_array_sum() {
let a = Primitive::from_slice(&[1, 2, 3, 4, 5]).to(DataType::Int32);
assert_eq!(15, sum(&a).unwrap());
} | rust_cleaned_test_functions.jsonl/101312 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 86
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84087,
3858,
10160,
368,
341,
286,
1077,
264,
284,
51460,
486,
1499,
26488,
2099,
58,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
10697,
983,
63941,
486,
1072,
18,
17,
317,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_ceil_real() {
let cases = vec![
(4.0, 3.5),
(4.0, 3.45),
(4.0, 3.1),
(-3.0, -3.45),
(0.0, -0.1),
(std::f64::MAX, std::f64::MAX),
(std::f64::MIN, std::f64::MIN),
];
for (expected, input) in cases {
let arg = Real::from(input);
let expected = Real::new(expected).ok();
let output = RpnFnScalarEvaluator::new()
.push_param(arg)
.evaluate::<Real>(ScalarFuncSig::CeilReal)
.unwrap();
assert_eq!(expected, output);
}
} | rust_cleaned_test_functions.jsonl/37480 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 407
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
22058,
15266,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
320,
19,
13,
15,
11,
220,
18,
13,
20,
1326,
310,
320,
19,
13,
15,
11,
220,
18,
13,
19,
20,
1326,
310,
320,
19,
13,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_internally_tagged_bytes() {
#[derive(Debug, PartialEq, Deserialize)]
#[serde(tag = "type")]
enum InternallyTagged {
String {
string: String,
},
Bytes {
#[serde(with = "bytes")]
bytes: Vec<u8>,
},
}
assert_de_tokens(
&InternallyTagged::String {
string: "\0".to_owned(),
},
&[
Token::Struct {
name: "String",
len: 2,
},
Token::Str("type"),
Token::Str("String"),
Token::Str("string"),
Token::Str("\0"),
Token::StructEnd,
],
);
assert_de_tokens(
&InternallyTagged::String {
string: "\0".to_owned(),
},
&[
Token::Struct {
name: "String",
len: 2,
},
Token::Str("type"),
Token::Str("String"),
Token::Str("string"),
Token::String("\0"),
Token::StructEnd,
],
);
assert_de_tokens(
&InternallyTagged::String {
string: "\0".to_owned(),
},
&[
Token::Struct {
name: "String",
len: 2,
},
Token::Str("type"),
Token::Str("String"),
Token::Str("string"),
Token::Bytes(b"\0"),
Token::StructEnd,
],
);
assert_de_tokens(
&InternallyTagged::String {
string: "\0".to_owned(),
},
&[
Token::Struct {
name: "String",
len: 2,
},
Token::Str("type"),
Token::Str("String"),
Token::Str("string"),
Token::ByteBuf(b"\0"),
Token::StructEnd,
],
);
assert_de_tokens(
&InternallyTagged::Bytes { bytes: vec![0] },
&[
Token::Struct {
name: "Bytes",
len: 2,
},
Token::Str("type"),
Token::Str("Bytes"),
Token::Str("bytes"),
Token::Str("\0"),
Token::StructEnd,
],
);
assert_de_tokens(
&InternallyTagged::Bytes { bytes: vec![0] },
&[
Token::Struct {
name: "Bytes",
len: 2,
},
Token::Str("type"),
Token::Str("Bytes"),
Token::Str("bytes"),
Token::String("\0"),
Token::StructEnd,
],
);
assert_de_tokens(
&InternallyTagged::Bytes { bytes: vec![0] },
&[
Token::Struct {
name: "Bytes",
len: 2,
},
Token::Str("type"),
Token::Str("Bytes"),
Token::Str("bytes"),
Token::Bytes(b"\0"),
Token::StructEnd,
],
);
assert_de_tokens(
&InternallyTagged::Bytes { bytes: vec![0] },
&[
Token::Struct {
name: "Bytes",
len: 2,
},
Token::Str("type"),
Token::Str("Bytes"),
Token::Str("bytes"),
Token::ByteBuf(b"\0"),
Token::StructEnd,
],
);
assert_de_tokens(
&InternallyTagged::Bytes { bytes: vec![0] },
&[
Token::Struct {
name: "Bytes",
len: 2,
},
Token::Str("type"),
Token::Str("Bytes"),
Token::Str("bytes"),
Token::Seq { len: Some(1) },
Token::U8(0),
Token::SeqEnd,
Token::StructEnd,
],
);
} | rust_cleaned_test_functions.jsonl/56437 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2293
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4042,
932,
745,
9372,
3556,
12524,
368,
341,
262,
11506,
27098,
42618,
11,
55039,
11,
48440,
5563,
262,
11506,
47024,
19343,
284,
330,
1313,
5422,
262,
7618,
4414,
745,
5668,
3556,
341,
286,
923,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_client_timeout() {
let server_port = utils::get_available_port();
let server_addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), server_port);
let mut server = NetworkServer::new("test", server_addr, TIMEOUT);
let mut client = NetworkClient::new("test", server_addr, TIMEOUT);
let data1 = vec![0, 1, 2, 3];
let data2 = vec![4, 5, 6, 7];
// First server success
client.write(&data1).unwrap();
let result1 = server.read().unwrap();
assert_eq!(data1, result1);
client.read().unwrap_err();
// be the one the client now connects to.
server.listener = None;
let mut server2 = NetworkServer::new("test", server_addr, TIMEOUT);
client.write(&data2).unwrap();
let result2 = server2.read().unwrap();
assert_eq!(data2, result2);
} | rust_cleaned_test_functions.jsonl/6083 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 416
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8179,
20537,
368,
341,
286,
1077,
3538,
8716,
284,
12439,
486,
455,
26962,
8716,
543,
286,
1077,
3538,
7387,
284,
20954,
13986,
486,
931,
8972,
79,
13986,
486,
53,
19,
8972,
30168,
19,
13986,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eq_3() {
with_globals(|| {
let test_res = string_to_ts("");
let test_eqs = string_to_ts("");
assert_eq!(test_res, test_eqs)
})
} | rust_cleaned_test_functions.jsonl/71394 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10714,
62,
18,
368,
341,
286,
448,
58775,
79453,
341,
310,
1077,
1273,
4918,
284,
914,
2346,
25023,
13056,
310,
1077,
1273,
10714,
82,
284,
914,
2346,
25023,
13056,
310,
2060,
10714,
10297,
1944,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_page_check_history_length() {
let check = read_single_check("checks/tests/test1.json").unwrap();
let history = MultiChecker::check_pages(&[check]);
assert_eq!(history.len(), 12);
for element in history {
assert!(!element.timestamp.is_empty());
assert!(element.success.is_some());
assert!(element.minor.is_none());
assert!(element.error.is_none());
}
} | rust_cleaned_test_functions.jsonl/80329 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 215
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6129,
7200,
19802,
5118,
368,
341,
286,
1077,
1779,
284,
1349,
19487,
7200,
445,
49383,
62468,
12697,
16,
4323,
1827,
15454,
543,
286,
1077,
3840,
284,
17439,
35188,
486,
2028,
21655,
2099,
58,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_errorful_json_inspect_formatting() {
let json_schema = Data::for_inspect(
"a/b/c/d",
None,
123456u64,
TEST_URL,
"test_file_plz_ignore.inspect",
vec![Error { message: "too much fun being had.".to_string() }],
);
let result_json =
serde_json::to_value(&json_schema).expect("serialization should succeed.");
let expected_json = json!({
"moniker": "a/b/c/d",
"version": 1,
"data_source": "Inspect",
"payload": null,
"metadata": {
"component_url": TEST_URL,
"errors": ["too much fun being had."],
"filename": "test_file_plz_ignore.inspect",
"timestamp": 123456,
}
});
pretty_assertions::assert_eq!(result_json, expected_json, "golden diff failed.");
} | rust_cleaned_test_functions.jsonl/71448 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 482
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4096,
1262,
9455,
34386,
987,
8955,
1280,
368,
341,
286,
1077,
2951,
25371,
284,
2885,
486,
1958,
34386,
987,
1006,
310,
330,
64,
3470,
2899,
3446,
756,
310,
2240,
345,
310,
220,
16,
17,
18,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_daunpenh() {
run_test(
&TEST_DATA,
"harfbuzz/good-daunpenh",
"khmer/daunpenh.ttf",
&[3],
422,
);
} | rust_cleaned_test_functions.jsonl/103196 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 174
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47070,
359,
2752,
71,
368,
341,
310,
1598,
4452,
1006,
394,
609,
10033,
7896,
345,
394,
330,
12982,
10798,
8889,
4846,
1386,
65897,
359,
2752,
71,
756,
394,
330,
30664,
1174,
14,
3235,
359,
2752... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_encode_public_key_hash() -> Result<(), failure::Error> {
let pk = PublicKey::from_hex(
"2cc1b580f4b8b1f6dbd0aa1d9cde2655c2081c07d7e61249aad8b11d954fb01a",
)?;
let pk_hash = pk.public_key_hash();
let decoded = HashType::CryptoboxPublicKeyHash.hash_to_b58check(pk_hash.as_ref());
let expected = "idsg2wkkDDv2cbEMK4zH49fjgyn7XT";
assert_eq!(expected, decoded);
Ok(())
} | rust_cleaned_test_functions.jsonl/104551 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 249
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
27074,
3097,
8950,
368,
1464,
5714,
68843,
7901,
486,
1454,
29,
341,
286,
1077,
22458,
284,
70280,
486,
1499,
32655,
1006,
310,
330,
17,
638,
16,
65,
20,
23,
15,
69,
19,
65,
23,
65,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_match_on_nonzero_option() {
let a = Some(unsafe {
NonZero::new(42)
});
match a {
Some(val) => assert_eq!(*val, 42),
None => panic!("unexpected None while matching on Some(NonZero(_))")
}
match unsafe { Some(NonZero::new(43)) } {
Some(val) => assert_eq!(*val, 43),
None => panic!("unexpected None while matching on Some(NonZero(_))")
}
} | rust_cleaned_test_functions.jsonl/132901 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10708,
4470,
21637,
14154,
9672,
368,
341,
262,
1077,
264,
284,
4329,
7,
38157,
341,
286,
11581,
17999,
486,
931,
7,
19,
17,
340,
262,
1625,
262,
2432,
264,
341,
286,
4329,
9098,
8,
589,
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... | 3 |
#[test]
fn test_vcx_proof_get_state() {
let _setup = SetupMocks::init();
let handle = _vcx_disclosed_proof_create_with_request_c_closure(::utils::constants::PROOF_REQUEST_JSON).unwrap();
let cb = return_types_u32::Return_U32_U32::new().unwrap();
assert_eq!(vcx_disclosed_proof_get_state(cb.command_handle, handle, Some(cb.get_callback())), error::SUCCESS.code_num);
let state = cb.receive(TimeoutUtils::some_medium()).unwrap();
assert_eq!(state, VcxStateType::VcxStateRequestReceived as u32);
} | rust_cleaned_test_functions.jsonl/104432 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 240
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
25844,
86757,
3062,
4387,
368,
341,
286,
1077,
716,
15188,
284,
18626,
72577,
486,
2327,
1428,
286,
1077,
3705,
284,
716,
7362,
87,
37745,
9259,
86757,
8657,
6615,
7893,
666,
72823,
38732,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_replay_first_message() {
let mut supplicant = test_util::get_wpa2_supplicant();
supplicant.start().expect("Failed starting Supplicant");
// Send first message of handshake.
let (result, updates) = send_fourway_msg1(&mut supplicant, |msg1| {
msg1.key_frame_fields.key_replay_counter.set_from_native(1);
});
assert!(result.is_ok());
let first_msg2 = expect_eapol_resp(&updates[..]);
let first_fields = first_msg2.keyframe().key_frame_fields;
// Replay first message which should restart the entire handshake.
// Verify the second message of the handshake was received.
let (result, updates) = send_fourway_msg1(&mut supplicant, |msg1| {
msg1.key_frame_fields.key_replay_counter.set_from_native(3);
});
assert!(result.is_ok());
let second_msg2 = expect_eapol_resp(&updates[..]);
let second_fields = second_msg2.keyframe().key_frame_fields;
// Verify Supplicant responded to the replayed first message and didn't change SNonce.
assert_eq!(second_fields.key_replay_counter.to_native(), 3);
assert_eq!(first_fields.key_nonce, second_fields.key_nonce);
} | rust_cleaned_test_functions.jsonl/21794 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 518
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
1363,
12978,
6462,
368,
341,
286,
1077,
5206,
90035,
35237,
284,
1273,
18974,
486,
455,
1670,
6595,
17,
91480,
35237,
543,
286,
90035,
35237,
4962,
1005,
17119,
445,
9408,
5916,
6299,
79,
35... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_request_snapshot_on_role_change() {
let (mut nt, _) = prepare_request_snapshot();
let request_idx = nt.peers[&2].raft_log.committed;
nt.peers
.get_mut(&2)
.unwrap()
.request_snapshot(request_idx)
.unwrap();
// Becoming follower does not reset pending_request_snapshot.
let (term, id) = (nt.peers[&1].term, nt.peers[&1].id);
nt.peers.get_mut(&2).unwrap().become_follower(term, id);
assert!(
nt.peers[&2].pending_request_snapshot != INVALID_INDEX,
"{}",
nt.peers[&2].pending_request_snapshot
);
// Becoming candidate resets pending_request_snapshot.
nt.peers.get_mut(&2).unwrap().become_candidate();
assert!(
nt.peers[&2].pending_request_snapshot == INVALID_INDEX,
"{}",
nt.peers[&2].pending_request_snapshot
);
} | rust_cleaned_test_functions.jsonl/19198 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 421
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7893,
53265,
4470,
19792,
15947,
368,
341,
262,
1077,
320,
6984,
31412,
11,
27439,
284,
10549,
7893,
53265,
1428,
262,
1077,
1681,
7258,
284,
31412,
52724,
388,
58,
5,
17,
936,
2944,
5224,
905,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_double_ended() {
let array = Int32Array::from(vec![Some(0), None, Some(2), None, Some(4)]);
let mut a = array.iter();
assert_eq!(a.next(), Some(Some(0)));
assert_eq!(a.next(), Some(None));
assert_eq!(a.next_back(), Some(Some(4)));
assert_eq!(a.next_back(), Some(None));
assert_eq!(a.next_back(), Some(Some(2)));
// the two sides have met: None is returned by both
assert_eq!(a.next_back(), None);
assert_eq!(a.next(), None);
} | rust_cleaned_test_functions.jsonl/19272 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 257
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24598,
62,
2883,
368,
341,
286,
1077,
1334,
284,
1333,
18,
17,
1857,
486,
1499,
25592,
20703,
8373,
7,
15,
701,
2240,
11,
4329,
7,
17,
701,
2240,
11,
4329,
7,
19,
41958,
286,
1077,
5206,
264... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iterator_i32() {
let b: Buffer<i32> = Buffer::from(vec![1, 2, 3, 4, 5]);
let it = b.iter();
let v: Vec<i32> = it.map(|n| n + 1).collect();
assert_eq!(vec![2, 3, 4, 5, 6], v);
} | rust_cleaned_test_functions.jsonl/37694 | {
"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,
13491,
5318,
18,
17,
368,
341,
286,
1077,
293,
25,
10312,
21897,
18,
17,
29,
284,
10312,
486,
1499,
25592,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
2558,
286,
1077,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_insert_device() {
let mut device = Device::new("test", 1, false);
let repo = Repo::new("test.db");
repo.assure_created().unwrap();
let inserted = repo.add_device(&mut device);
assert!(inserted.is_ok());
assert!(device.id != 0);
assert!(device.name == "test");
assert!(device.group_id == 1);
let get_result = repo.get_device(device.id);
assert!(get_result.is_ok());
let inserted_device = get_result.unwrap();
assert!(inserted_device.is_some());
let get_group = repo.get_group(device.group_id);
assert!(get_group.is_ok());
let group = get_group.unwrap();
assert!(1 == group.len());
std::fs::remove_file("test.db").unwrap();
} | rust_cleaned_test_functions.jsonl/48629 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 289
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
9204,
368,
341,
262,
1077,
5206,
3671,
284,
13903,
486,
931,
445,
1944,
497,
220,
16,
11,
895,
626,
262,
1077,
15867,
284,
71509,
486,
931,
445,
1944,
7076,
797,
262,
15867,
13,
395,
55... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bool_false() -> IonResult<()> {
let mut cursor = ion_cursor_for(&[0x10]);
assert_eq!(cursor.next()?, Some(Value(IonType::Boolean, false)));
assert_eq!(cursor.read_bool()?, Some(false));
Ok(())
} | rust_cleaned_test_functions.jsonl/82731 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
22159,
36015,
368,
1464,
44805,
2077,
71698,
341,
286,
1077,
5206,
8128,
284,
27672,
28601,
5478,
2099,
58,
15,
87,
16,
15,
2558,
286,
2060,
10714,
10297,
17437,
4529,
368,
12622,
4329,
2534... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_regex_literal_flags() {
// flags
assert_parse_success!(
regex_literal,
"/a/f",
RegExpLiteral {
pattern: "a".to_string(),
flags: "f".to_string(),
}
);
assert_parse_success!(
regex_literal,
"/a/fi",
RegExpLiteral {
pattern: "a".to_string(),
flags: "fi".to_string(),
}
);
assert_parse_failure!(regex_literal, "/a/\\u1234");
} | rust_cleaned_test_functions.jsonl/66462 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 271
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41832,
34100,
14130,
368,
341,
262,
442,
8042,
198,
262,
2060,
21039,
18632,
33673,
286,
20180,
34100,
345,
286,
3521,
64,
6663,
756,
286,
28487,
17350,
341,
310,
5383,
25,
330,
64,
3263,
983,
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_duplicate_account_key() {
solana_logger::setup();
let (genesis_config, mint_keypair) = create_genesis_config(500);
let mut bank = Bank::new(&genesis_config);
let from_pubkey = solana_sdk::pubkey::new_rand();
let to_pubkey = solana_sdk::pubkey::new_rand();
let account_metas = vec![
AccountMeta::new(from_pubkey, false),
AccountMeta::new(to_pubkey, false),
];
bank.add_builtin(
"mock_vote",
solana_vote_program::id(),
mock_ok_vote_processor,
);
let instruction =
Instruction::new_with_bincode(solana_vote_program::id(), &10, account_metas);
let mut tx = Transaction::new_signed_with_payer(
&[instruction],
Some(&mint_keypair.pubkey()),
&[&mint_keypair],
bank.last_blockhash(),
);
tx.message.account_keys.push(from_pubkey);
let result = bank.process_transaction(&tx);
assert_eq!(result, Err(TransactionError::AccountLoadedTwice));
} | rust_cleaned_test_functions.jsonl/2632 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 535
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70434,
13500,
3097,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
320,
77894,
5332,
11,
28337,
3097,
12670,
8,
284,
1855,
16322,
13774,
5332,
7,
20,
15,
15,
317,
286,
1077,
5206,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_euc_kr_encode_all() {
let input = include_str!("test_data/euc_kr_out.txt");
let expectation = include_bytes!("test_data/euc_kr_out_ref.txt");
let (cow, encoding, had_errors) = EUC_KR.encode(input);
assert!(!had_errors, "Should not have had errors.");
assert_eq!(encoding, EUC_KR);
assert_eq!(&cow[..], &expectation[..]);
} | rust_cleaned_test_functions.jsonl/122975 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2204,
1754,
4698,
81,
11224,
5705,
368,
341,
286,
1077,
1946,
284,
2924,
2895,
17223,
1944,
1769,
16546,
1754,
4698,
81,
6068,
3909,
797,
286,
1077,
30193,
284,
2924,
12524,
17223,
1944,
1769,
165... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_print_and_parse_nested() {
let f1 = Type::primitive_type_builder("f1", PhysicalType::INT32)
.with_repetition(Repetition::REQUIRED)
.with_logical_type(LogicalType::INT_32)
.build()
.unwrap();
let f2 = Type::primitive_type_builder("f2", PhysicalType::BYTE_ARRAY)
.with_repetition(Repetition::OPTIONAL)
.with_logical_type(LogicalType::UTF8)
.build()
.unwrap();
let foo = Type::group_type_builder("foo")
.with_repetition(Repetition::OPTIONAL)
.with_fields(&mut vec![Rc::new(f1), Rc::new(f2)])
.build()
.unwrap();
let f3 = Type::primitive_type_builder("f3", PhysicalType::FIXED_LEN_BYTE_ARRAY)
.with_repetition(Repetition::REPEATED)
.with_logical_type(LogicalType::INTERVAL)
.with_length(12)
.build()
.unwrap();
let message = Type::group_type_builder("schema")
.with_fields(&mut vec![Rc::new(foo), Rc::new(f3)])
.build()
.unwrap();
assert_print_parse_message(message);
} | rust_cleaned_test_functions.jsonl/31616 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 627
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10064,
8378,
21039,
66279,
368,
341,
286,
1077,
282,
16,
284,
3990,
486,
73448,
1819,
28532,
445,
69,
16,
497,
27379,
929,
486,
3221,
18,
17,
340,
310,
659,
4197,
1288,
55767,
7,
693,
55767,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stake_rewrite_stake() {
let right_data_len = std::mem::size_of::<StakeState>() as u64;
let rent = Rent::default();
let rent_exempt_reserve = rent.minimum_balance(right_data_len as usize);
let expected_stake = 1000;
let account_balance = rent_exempt_reserve + expected_stake;
let test_cases = [
(9999, Some((9999, expected_stake))), // large stake
(1000, None), // correct
(42, Some((42, expected_stake))), // small stake
];
for (staked_amount, expected_rewrite) in &test_cases {
let mut delegation = Delegation {
stake: *staked_amount,
..Delegation::default()
};
let actual_rewrite = delegation.rewrite_stake(account_balance, rent_exempt_reserve);
assert_eq!(actual_rewrite, *expected_rewrite);
assert_eq!(delegation.stake, expected_stake);
}
} | rust_cleaned_test_functions.jsonl/65834 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 484
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
726,
74052,
1261,
726,
368,
341,
286,
1077,
1290,
1769,
6043,
284,
1460,
486,
10536,
486,
2141,
3575,
27638,
623,
726,
1397,
13555,
438,
575,
21,
19,
280,
286,
1077,
8016,
284,
29737,
486,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_binary_xor() {
let f1 = FlagVec::from_str("---+--+--+++-").unwrap();
let f2 = FlagVec::from_str("-+++-+---+-++--+").unwrap();
assert_eq!(
f1.clone() ^ f2.clone(),
FlagVec::from_str("-++--++---+-+--+").unwrap()
);
} | rust_cleaned_test_functions.jsonl/24809 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 164
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31761,
76462,
368,
341,
286,
1077,
282,
16,
284,
22666,
10050,
486,
1499,
2895,
74083,
10,
85894,
313,
1027,
21473,
1827,
15454,
543,
286,
1077,
282,
17,
284,
22666,
10050,
486,
1499,
2895,
13645,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_entry_into_mut() {
let mut map = TrieMap::new();
map.insert(3, 6);
let value_ref = match map.entry(3) {
Occupied(e) => e.into_mut(),
Vacant(_) => panic!("Entry not found.")
};
assert_eq!(*value_ref, 6);
} | rust_cleaned_test_functions.jsonl/88439 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 157
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9078,
45514,
29523,
368,
341,
286,
1077,
5206,
2415,
284,
62783,
2227,
486,
931,
543,
286,
2415,
7030,
7,
18,
11,
220,
21,
626,
286,
1077,
897,
7793,
284,
2432,
2415,
24116,
7,
18,
8,
341,
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... | 2 |
#[test]
fn test_reallocate() {
let memory_pool = LibcMemoryPool {};
for _ in 0..10 {
let p1 = memory_pool.allocate(1024).unwrap();
let p2 = memory_pool.reallocate(1024, 2048, p1).unwrap();
// make sure this is 64-byte aligned
assert_eq!(0, (p1 as usize) % ALIGNMENT);
assert_eq!(0, (p2 as usize) % ALIGNMENT);
memory_pool.free(p2);
}
} | rust_cleaned_test_functions.jsonl/100096 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 233
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
31191,
368,
341,
286,
1077,
4938,
15709,
284,
5688,
66,
10642,
10551,
20375,
286,
369,
716,
304,
220,
15,
496,
16,
15,
341,
310,
1077,
281,
16,
284,
4938,
15709,
68726,
7,
16,
15,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_matrix_size() {
let constants = crate::Arena::new();
assert_eq!(
crate::TypeInner::Matrix {
columns: crate::VectorSize::Tri,
rows: crate::VectorSize::Tri,
width: 4
}
.span(&constants),
48
);
} | rust_cleaned_test_functions.jsonl/6590 | {
"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,
10193,
2368,
368,
341,
262,
1077,
18021,
284,
17717,
486,
93937,
486,
931,
543,
262,
2060,
10714,
33673,
286,
17717,
486,
929,
31597,
486,
6689,
341,
310,
8147,
25,
17717,
486,
3781,
1695,
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_c_callback() {
let x = [5u8; 32];
let y = [7u8; 32];
let mut output = [0u8; 64];
let res = unsafe { super::c_callback(output.as_mut_ptr(), x.as_ptr(), y.as_ptr(), ::ptr::null_mut()) };
assert_eq!(res, 1);
let mut new_x = [0u8; 32];
let mut new_y = [0u8; 32];
new_x.copy_from_slice(&output[..32]);
new_y.copy_from_slice(&output[32..]);
assert_eq!(x, new_x);
assert_eq!(y, new_y);
} | rust_cleaned_test_functions.jsonl/77974 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 269
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
12519,
368,
341,
286,
1077,
856,
284,
508,
20,
84,
23,
26,
220,
18,
17,
935,
286,
1077,
379,
284,
508,
22,
84,
23,
26,
220,
18,
17,
935,
286,
1077,
5206,
2550,
284,
508,
15,
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... | 1 |
#[test]
fn test_maybe_last_index() {
let tests = vec![
(Some(new_entry(5, 1)), 5, None, true, 5),
(Some(new_entry(5, 1)), 5, Some(new_snapshot(4, 1)), true, 5),
// last in snapshot
(None, 5, Some(new_snapshot(4, 1)), true, 4),
// empty unstable
(None, 0, None, false, 0),
];
for (entries, offset, snapshot, wok, windex) in tests {
let u = Unstable {
entries: entries.map_or(vec![], |entry| vec![entry]),
offset,
snapshot,
logger: crate::default_logger(),
};
let index = u.maybe_last_index();
match index {
None => assert!(!wok),
Some(index) => assert_eq!(index, windex),
}
}
} | rust_cleaned_test_functions.jsonl/80452 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 485
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
49791,
12195,
3560,
368,
341,
1789,
286,
1077,
7032,
284,
7486,
90515,
310,
320,
8373,
1755,
9078,
7,
20,
11,
220,
16,
5731,
220,
20,
11,
2240,
11,
830,
11,
220,
20,
1326,
310,
320,
837... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_get_validated_scheme() {
let fixtures = vec![
("https://deno.land/x/mod.ts", true, "https"),
("http://deno.land/x/mod.ts", true, "http"),
("file:///a/b/c.ts", true, "file"),
("file:///C:/a/b/c.ts", true, "file"),
("data:,some%20text", true, "data"),
("ftp://a/b/c.ts", false, ""),
("mailto:dino@deno.land", false, ""),
];
for (specifier, is_ok, expected) in fixtures {
let specifier = resolve_url_or_path(specifier).unwrap();
let actual = get_validated_scheme(&specifier);
assert_eq!(actual.is_ok(), is_ok);
if is_ok {
assert_eq!(actual.unwrap(), expected);
}
}
} | rust_cleaned_test_functions.jsonl/32455 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 328
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
8337,
657,
53293,
368,
341,
262,
1077,
37664,
284,
7486,
90515,
414,
3489,
2428,
1110,
5183,
78,
87627,
10776,
38479,
21288,
497,
830,
11,
330,
2428,
4461,
414,
3489,
1254,
1110,
5183,
78,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_authorized_authorize() {
let staker = solana_sdk::pubkey::new_rand();
let mut authorized = Authorized::auto(&staker);
let mut signers = HashSet::new();
assert_eq!(
authorized.authorize(&signers, &staker, StakeAuthorize::Staker, None),
Err(InstructionError::MissingRequiredSignature)
);
signers.insert(staker);
assert_eq!(
authorized.authorize(&signers, &staker, StakeAuthorize::Staker, None),
Ok(())
);
} | rust_cleaned_test_functions.jsonl/65785 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 254
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
19084,
22938,
551,
368,
341,
286,
1077,
357,
4407,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
5206,
18630,
284,
90569,
486,
3902,
2099,
267,
4407,
317,
286,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_include_e() {
let code: Vec<char> = "#include \"asdf".to_string().chars().collect();
let result = try_parse_include(&code, 5);
assert_eq!(result, None);
} | rust_cleaned_test_functions.jsonl/126910 | {
"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,
21039,
37878,
2204,
368,
341,
286,
1077,
2038,
25,
11312,
21919,
29,
284,
5869,
997,
7245,
76615,
3263,
983,
3904,
1005,
19255,
1005,
17384,
543,
286,
1077,
1102,
284,
1430,
21039,
37878,
2099,
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 |
#[test]
fn test_validate_account_doesnt_exist() {
let (config, keypair) = get_test_config();
let vm_validator = TestValidator::new(&config);
let address = account_config::association_address();
let random_account_addr = account_address::AccountAddress::random();
let program = encode_transfer_program(&address, 100);
let signed_txn = transaction_test_helpers::get_test_signed_transaction(
random_account_addr,
0,
keypair.private_key().clone(),
keypair.public_key(),
Some(program),
0,
1, /* max gas price */
None,
);
let ret = vm_validator
.validate_transaction(SignedTransaction::from_proto(signed_txn).unwrap())
.wait()
.unwrap();
assert_matches!(
ret.unwrap(),
VMStatus::Validation(VMValidationStatus::SendingAccountDoesNotExist(_))
);
} | rust_cleaned_test_functions.jsonl/90968 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 372
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
13500,
96374,
406,
35906,
368,
341,
262,
1077,
320,
1676,
11,
1376,
12670,
8,
284,
633,
4452,
5332,
543,
262,
1077,
10995,
64959,
284,
3393,
14256,
486,
931,
2099,
1676,
626,
262,
1077,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_new_leaf_duplicate() {
let (
mut heaviest_subtree_fork_choice,
duplicate_leaves_descended_from_4,
duplicate_leaves_descended_from_5,
) = setup_duplicate_forks();
// Add a child to one of the duplicates
let duplicate_parent = duplicate_leaves_descended_from_4[0];
let child = (11, Hash::new_unique());
heaviest_subtree_fork_choice.add_new_leaf_slot(child, Some(duplicate_parent));
assert_eq!(
heaviest_subtree_fork_choice
.children(&duplicate_parent)
.unwrap(),
&[child]
);
assert_eq!(heaviest_subtree_fork_choice.best_overall_slot(), child);
// All the other duplicates should have no children
for duplicate_leaf in duplicate_leaves_descended_from_5
.iter()
.chain(std::iter::once(&duplicate_leaves_descended_from_4[1]))
{
assert!(heaviest_subtree_fork_choice
.children(duplicate_leaf)
.unwrap()
.is_empty(),);
}
// Re-adding same duplicate slot should not overwrite existing one
heaviest_subtree_fork_choice
.add_new_leaf_slot(duplicate_parent, Some((4, Hash::default())));
assert_eq!(
heaviest_subtree_fork_choice
.children(&duplicate_parent)
.unwrap(),
&[child]
);
assert_eq!(heaviest_subtree_fork_choice.best_overall_slot(), child);
} | rust_cleaned_test_functions.jsonl/70810 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 779
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
5921,
38909,
70434,
368,
341,
286,
1077,
2399,
310,
5206,
566,
98362,
5228,
9344,
761,
669,
31936,
345,
310,
22513,
11751,
4693,
10986,
2883,
5673,
62,
19,
345,
310,
22513,
11751,
4693,
1098... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_increment_2_to_the_power_of_256_checked() {
let value: Uint256 = "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
.parse()
.unwrap();
assert_eq!(value.bits(), 256);
assert!(value.checked_add(&Uint256::from(1u32)).is_none());
} | rust_cleaned_test_functions.jsonl/118549 | {
"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,
51482,
62,
17,
2346,
16068,
20421,
3575,
62,
17,
20,
21,
56456,
368,
341,
1066,
262,
1077,
897,
25,
27883,
17,
20,
21,
284,
330,
15,
41798,
53697,
53697,
53697,
53697,
53697,
53697,
53697,
698,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse() {
macro_rules! assert_pns_eq_sub {
($in_:expr, $kind:ident($arg:expr)) => {
assert_eq!(pns(concat!($in_, "!")), Some((S::$kind($arg.into()), "!")))
};
}
assert_pns_eq_sub!("$0", Ordinal(0));
assert_pns_eq_sub!("$1", Ordinal(1));
assert_pns_eq_sub!("$9", Ordinal(9));
assert_pns_eq_sub!("$N", Name("N"));
assert_pns_eq_sub!("$NAME", Name("NAME"));
} | rust_cleaned_test_functions.jsonl/22164 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 317
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
368,
341,
310,
18072,
21407,
0,
2060,
620,
4412,
10714,
5228,
341,
394,
1711,
258,
23211,
9413,
11,
400,
15314,
25,
1713,
699,
858,
96011,
593,
589,
341,
503,
2060,
10714,
10297,
79,
4412... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_seek_to_last() {
let db = TestDB::new();
let mut iter = db.iter();
iter.seek_to_last();
assert_eq!(collect_values(iter), [202]);
} | rust_cleaned_test_functions.jsonl/3510 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 77
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74473,
2346,
12195,
368,
341,
262,
1077,
2927,
284,
3393,
3506,
486,
931,
543,
262,
1077,
5206,
5367,
284,
2927,
19471,
543,
262,
5367,
38179,
2346,
12195,
543,
262,
2060,
10714,
10297,
17384,
914... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_add_remove_module() {
let context = Context::create();
let module = context.create_module("test");
let ee = module.create_jit_execution_engine(OptimizationLevel::default()).unwrap();
assert!(ee.add_module(&module).is_err());
let module2 = context.create_module("mod2");
assert!(ee.remove_module(&module2).is_err());
assert!(ee.add_module(&module2).is_ok());
assert!(ee.remove_module(&module).is_ok());
assert!(ee.remove_module(&module2).is_ok());
} | rust_cleaned_test_functions.jsonl/33655 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 194
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
18193,
10750,
368,
341,
262,
1077,
2266,
284,
9608,
486,
3182,
543,
262,
1077,
4688,
284,
2266,
2520,
10750,
445,
1944,
797,
262,
1077,
36343,
284,
4688,
2520,
5374,
275,
60948,
24823,
19238... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_highest_exit() {
let map = MiniMap {};
let exits_map = DijkstraMap::new(3, 1, &[0], &map, 10.);
let target = DijkstraMap::find_highest_exit(&exits_map, 0, &map);
assert_eq!(target, Some(1));
let target = DijkstraMap::find_highest_exit(&exits_map, 1, &map);
assert_eq!(target, Some(2));
} | rust_cleaned_test_functions.jsonl/15573 | {
"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,
1523,
7504,
16880,
368,
341,
286,
1077,
2415,
284,
19643,
2227,
9321,
286,
1077,
42086,
5376,
284,
422,
87177,
2227,
486,
931,
7,
18,
11,
220,
16,
11,
44590,
15,
1125,
609,
2186,
11,
220,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_function_arguments_regression() {
let spec = "input a: Int32\ntrigger a > 50";
let type_table = type_check(spec);
// expression `a > 50` has NodeId = 3
let exp_a_gt_50_id = NodeId::new(5);
assert_eq!(type_table.get_value_type(exp_a_gt_50_id), &ValueTy::Bool);
assert_eq!(type_table.get_func_arg_types(exp_a_gt_50_id), &vec![ValueTy::Int(IntTy::I32)]);
} | rust_cleaned_test_functions.jsonl/110716 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 209
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9174,
43433,
91144,
368,
341,
286,
1077,
1398,
284,
330,
1355,
264,
25,
1333,
18,
17,
1699,
18468,
264,
861,
220,
20,
15,
876,
286,
1077,
943,
5237,
284,
943,
7200,
38209,
317,
286,
442,
7493,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_storage_class_is_valid_kind() {
let cases: [(&str, bool); 7] = [
("STANDARD", true),
("REDUCED_REDUNDANCY", true),
("", false),
("INVALID", false),
("123", false),
("HULK_STORAGE_CLASS_RRS", false),
("HULK_STORAGE_CLASS_STANDARD", false),
];
for (sc, want) in cases.iter() {
let result = is_valid(sc);
assert_eq!(result, *want);
}
} | rust_cleaned_test_functions.jsonl/44024 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 285
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23310,
4790,
6892,
8337,
33162,
368,
341,
286,
1077,
5048,
25,
508,
2099,
495,
11,
1807,
1215,
220,
22,
60,
284,
2278,
310,
3489,
784,
38635,
497,
830,
1326,
310,
3489,
6504,
5459,
1479,
33737,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_printf_depth() {
let file_info_1 = get_dir_entry_for("test_data/depth/1", "f1");
let file_info_2 = get_dir_entry_for("test_data/depth/1", "2/f2");
let deps = FakeDependencies::new();
let matcher = Printf::new("%d.").unwrap();
assert!(matcher.matches(&file_info_1, &mut deps.new_matcher_io()));
assert!(matcher.matches(&file_info_2, &mut deps.new_matcher_io()));
assert_eq!("1.2.", deps.get_output_as_string());
} | rust_cleaned_test_functions.jsonl/69249 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 239
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21823,
19061,
368,
341,
286,
1077,
1034,
3109,
62,
16,
284,
633,
4334,
9078,
5478,
445,
1944,
1769,
14,
17561,
14,
16,
497,
330,
69,
16,
797,
286,
1077,
1034,
3109,
62,
17,
284,
633,
4334,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_isometry_inverse() {
let angle = Degrees(72_f64);
let distance = Vector2::new(-567_f64, 23_f64);
let isometry = Isometry2::from_angle_translation(angle, &distance);
let isometry_inv = isometry.inverse();
let point = Point2::new(34_f64, 139_f64);
let expected = point;
let result = isometry_inv * (isometry * point);
assert_relative_eq!(result, expected, epsilon = 1e-8);
let result = isometry * (isometry_inv * point);
assert_relative_eq!(result, expected, epsilon = 1e-8);
} | rust_cleaned_test_functions.jsonl/77217 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 258
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
6988,
63333,
368,
341,
286,
1077,
9210,
284,
92901,
7,
22,
17,
761,
21,
19,
317,
286,
1077,
6010,
284,
4196,
17,
486,
931,
4080,
20,
21,
22,
761,
21,
19,
11,
220,
17,
18,
761,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hashset_gazetteer() {
// Given
let gazetteer: &[u8] = r#"
dog
cat
bear
crocodile"#
.as_ref();
// When
let gazetteer = HashSetGazetteer::from_reader(gazetteer);
// Then
assert!(gazetteer.is_ok());
let gazetteer = gazetteer.unwrap();
assert!(gazetteer.contains("dog"));
assert!(gazetteer.contains("crocodile"));
assert!(!gazetteer.contains("bird"));
} | rust_cleaned_test_functions.jsonl/120537 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 253
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
746,
1889,
1370,
6535,
261,
368,
341,
286,
442,
16246,
198,
286,
1077,
54986,
6535,
261,
25,
44590,
84,
23,
60,
284,
435,
2,
698,
18457,
198,
4616,
198,
67660,
198,
37884,
82674,
1,
4956... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_state_fails() {
let _setup = SetupEmpty::init();
let state = get_state(1);
assert_eq!(state, VcxStateType::VcxStateNone as u32);
} | rust_cleaned_test_functions.jsonl/20875 | {
"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,
3062,
4387,
761,
6209,
368,
341,
286,
1077,
716,
15188,
284,
18626,
3522,
486,
2327,
1428,
286,
1077,
1584,
284,
633,
4387,
7,
16,
317,
286,
2060,
10714,
10297,
2454,
11,
647,
25844,
1397,
929,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_present_plus() {
assert_eq!(is_present_plus("present+"), true);
assert_eq!(is_present_plus("Present+"), true);
assert_eq!(is_present_plus("prESeNT+"), true);
assert_eq!(is_present_plus("present+dbaron"), false);
assert_eq!(is_present_plus("say present+"), false);
assert_eq!(is_present_plus("preSEnt+ dbaron"), true);
} | rust_cleaned_test_functions.jsonl/31455 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 180
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36976,
28043,
368,
341,
286,
2060,
10714,
10297,
285,
36976,
28043,
445,
28744,
10,
3975,
830,
317,
286,
2060,
10714,
10297,
285,
36976,
28043,
445,
21195,
10,
3975,
830,
317,
286,
2060,
10714,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_err_bad_limit() {
let tmp = create_temp_dir("test_err_bad_limit_v2").expect("create temp directory for test");
set_fixture(&tmp, CGROUP_MEMORY_MAX, "0").expect("set fixture for memory limit");
set_fixture(&tmp, CGROUP_MEMORY_LOW, "0").expect("set fixture for memory reservation");
set_fixture(&tmp, CGROUP_MEMORY_SWAP, "0").expect("set fixture for swap limit");
let memory_limits = &LinuxMemory {
limit: Some(-2),
swap: None,
reservation: None,
kernel: None,
kernel_tcp: None,
swappiness: None,
};
let result = Memory::apply(&tmp, memory_limits);
assert!(result.is_err());
} | rust_cleaned_test_functions.jsonl/79409 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 339
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9266,
34199,
14763,
368,
341,
286,
1077,
4174,
284,
1855,
11771,
4334,
445,
1944,
9266,
34199,
14763,
2273,
17,
1827,
17119,
445,
3182,
2730,
6220,
369,
1273,
797,
286,
738,
74409,
2099,
5173,
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_devnet_testnet_filter_all_active_pass() {
let mut cluster_vec = Vec::<String>::new();
cluster_vec.push(SCFS_DEVNET.to_string());
cluster_vec.push(SCFS_TESTNET.to_string());
let mut my_matrix = ScfsMatrix::new(Some(ScfsCriteria {
clusters: Some(cluster_vec),
..Default::default()
}))
.unwrap();
assert!(my_matrix.run().is_ok());
let inactives = my_matrix
.get_features(Some(&ScfsMatrix::all_active))
.unwrap();
assert_ne!(inactives.len(), 0);
for res_row in inactives {
println!("{:?}", res_row)
}
} | rust_cleaned_test_functions.jsonl/38837 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 346
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10433,
4711,
4452,
4711,
8727,
5705,
12930,
15464,
368,
341,
286,
1077,
5206,
10652,
13251,
284,
11312,
27638,
703,
6831,
931,
543,
286,
10652,
13251,
2552,
59461,
8485,
26419,
15373,
2389,
3904,
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... | 2 |
#[test]
fn test_message_interior_null() {
let log = OsLog::new("com.example.oslog", "category");
log.with_level(Level::Debug, "Hi\0test");
} | rust_cleaned_test_functions.jsonl/102886 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 77
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6462,
15318,
2462,
15162,
368,
341,
286,
1077,
1487,
284,
15433,
2201,
486,
931,
445,
874,
7724,
9291,
839,
497,
330,
5471,
797,
286,
1487,
18164,
8274,
30263,
486,
7939,
11,
330,
13048,
59,
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_encode() {
assert_eq!(HTML, "PGgxPkhlbGxvLCBXb3JsZCE8L2gxPg%3D%3D");
} | rust_cleaned_test_functions.jsonl/125443 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 62
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
368,
341,
262,
2060,
10714,
10297,
5835,
11,
330,
11383,
59957,
58415,
17958,
65,
38,
87,
85,
8556,
53878,
65,
18,
30480,
57,
2104,
23,
43,
17,
59957,
82540,
4,
18,
35,
4,
18,
35,
797... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_collect_uncleaned_slots_up_to_slot() {
solana_logger::setup();
let db = AccountsDb::new(Vec::new(), &ClusterType::Development);
let slot1 = 11;
let slot2 = 222;
let slot3 = 3333;
let pubkey1 = Pubkey::new_unique();
let pubkey2 = Pubkey::new_unique();
let pubkey3 = Pubkey::new_unique();
db.uncleaned_pubkeys.insert(slot1, vec![pubkey1]);
db.uncleaned_pubkeys.insert(slot2, vec![pubkey2]);
db.uncleaned_pubkeys.insert(slot3, vec![pubkey3]);
let mut uncleaned_slots1 = db.collect_uncleaned_slots_up_to_slot(slot1);
let mut uncleaned_slots2 = db.collect_uncleaned_slots_up_to_slot(slot2);
let mut uncleaned_slots3 = db.collect_uncleaned_slots_up_to_slot(slot3);
uncleaned_slots1.sort_unstable();
uncleaned_slots2.sort_unstable();
uncleaned_slots3.sort_unstable();
assert_eq!(uncleaned_slots1, [slot1]);
assert_eq!(uncleaned_slots2, [slot1, slot2]);
assert_eq!(uncleaned_slots3, [slot1, slot2, slot3]);
} | rust_cleaned_test_functions.jsonl/1435 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 514
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68140,
76576,
2675,
291,
54161,
8237,
2346,
27563,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
2927,
284,
40655,
7994,
486,
931,
49923,
486,
931,
1507,
609,
28678,
929,
486,
3941... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_usb_255() {
let topo_usb =
String::from("@/dev/sys/pci/00:14.0/xhci/usb/004/004/ifc-000/ax88179/ethernet");
// test cases for 256 usb interfaces
let mut config = Config { names: vec![] };
for n in 0u8..255u8 {
let octets = [n, 0x01, 0x01, 0x01, 0x01, 00];
let persistent_id = config.generate_identifier(&topo_usb, MacAddress { octets });
if let Some(index) = config.lookup_by_identifier(&persistent_id) {
assert_eq!(config.names[index].1, format!("{}{:x}", "wlanx", n));
} else {
let name = config
.generate_name(&persistent_id, true)
.expect("failed to generate the name");
assert_eq!(name, format!("{}{:x}", "wlanx", n));
config.names.push((persistent_id, name));
}
}
let octets = [0x00, 0x00, 0x01, 0x01, 0x01, 00];
let persistent_id = config.generate_identifier(&topo_usb, MacAddress { octets });
assert!(config.generate_name(&persistent_id, true).is_err());
} | rust_cleaned_test_functions.jsonl/49773 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 585
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
50863,
62,
17,
20,
20,
368,
341,
286,
1077,
72519,
50863,
4035,
310,
923,
486,
1499,
10662,
14,
3583,
41836,
14,
55387,
14,
15,
15,
25,
16,
19,
13,
15,
10776,
73810,
14,
24343,
14,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_matrix_with_nonzero_determinant_is_invertible() {
let matrix = Matrix4x4::new(
1_f64, 2_f64, 3_f64, 4_f64,
5_f64, 60_f64, 7_f64, 8_f64,
9_f64, 10_f64, 11_f64, 12_f64,
13_f64, 14_f64, 150_f64, 16_f64
);
assert!(matrix.is_invertible());
} | rust_cleaned_test_functions.jsonl/129095 | {
"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,
10193,
6615,
21637,
14154,
814,
16483,
517,
6892,
1243,
1621,
1238,
368,
341,
286,
1077,
6172,
284,
11631,
19,
87,
19,
486,
931,
1006,
310,
220,
16,
761,
21,
19,
11,
220,
220,
17,
761,
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_range_sodium() {
let h = hash(&[]);
let sub_range = &h[10..20];
assert_eq!(
&[244u8, 200, 153, 111, 185, 36, 39, 174, 65, 228],
sub_range
);
} | rust_cleaned_test_functions.jsonl/5654 | {
"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,
9698,
643,
46776,
368,
341,
286,
1077,
305,
284,
5175,
2099,
56703,
286,
1077,
1186,
9698,
284,
609,
71,
58,
16,
15,
496,
17,
15,
935,
286,
2060,
10714,
33673,
310,
44590,
17,
19,
19,
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... | 1 |
#[test]
fn test_key_rotation() {
let (mut connected_peer, _remote_peer) = setup_peers();
let message = Vec::<u8>::from_hex("68656c6c6f").unwrap();
let mut encrypted_messages: Vec<Vec<u8>> = Vec::new();
for _ in 0..1002 {
let encrypted_message =
connected_peer.encrypt_buf(&message).unwrap();
encrypted_messages.push(encrypted_message);
}
assert_eq!(encrypted_messages[500], Vec::<u8>::from_hex("178cb9d7387190fa34db9c2d50027d21793c9bc2d40b1e14dcf30ebeeeb220f48364f7a4c68bf8").unwrap());
assert_eq!(encrypted_messages[501], Vec::<u8>::from_hex("1b186c57d44eb6de4c057c49940d79bb838a145cb528d6e8fd26dbe50a60ca2c104b56b60e45bd").unwrap());
assert_eq!(encrypted_messages[1000], Vec::<u8>::from_hex("4a2f3cc3b5e78ddb83dcb426d9863d9d9a723b0337c89dd0b005d89f8d3c05c52b76b29b740f09").unwrap());
assert_eq!(encrypted_messages[1001], Vec::<u8>::from_hex("2ecd8c8a5629d0d02ab457a0fdd0f7b90a192cd46be5ecb6ca570bfc5e268338b1a16cf4ef2d36").unwrap());
} | rust_cleaned_test_functions.jsonl/39156 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 546
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3097,
44813,
368,
341,
286,
1077,
320,
6984,
8433,
45159,
11,
716,
18147,
45159,
8,
284,
6505,
36367,
388,
1428,
286,
1077,
1943,
284,
11312,
27638,
84,
23,
6831,
1499,
32655,
445,
21,
23,
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... | 2 |
#[test]
fn test_empty_all_the_things() -> Result<()> {
test_parse_and_merge(TestSet {
manifest_yml: "{}".into(),
env_yml: "{}".into(),
default_channel: "CDEFTEAM8".into(),
crd_expected: "---\n{}".into(),
})
} | rust_cleaned_test_functions.jsonl/37579 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 157
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
5705,
16068,
5854,
819,
368,
1464,
5714,
71698,
341,
286,
1273,
21039,
8378,
20888,
31159,
1649,
341,
310,
14455,
4178,
1014,
25,
35503,
3263,
18122,
3148,
310,
6105,
4178,
1014,
25,
35503,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_const_from_raw_parts() {
const SLICE: &[u8] = &[1, 2, 3, 4];
const FROM_RAW: &[u8] = unsafe { &*slice_from_raw_parts(SLICE.as_ptr(), SLICE.len()) };
assert_eq!(SLICE, FROM_RAW);
let slice = &[1, 2, 3, 4, 5];
let from_raw = unsafe { &*slice_from_raw_parts(slice.as_ptr(), 2) };
assert_eq!(&slice[..2], from_raw);
} | rust_cleaned_test_functions.jsonl/18506 | {
"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,
13610,
5673,
16067,
33217,
368,
341,
262,
733,
16797,
5487,
25,
44590,
84,
23,
60,
284,
44590,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
935,
262,
733,
4295,
39922,
25,
44590,
84,
23,
60,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_heap_03() {
let x = "x".to_string();
// Initiailise heap
let mut heap = SyntacticHeap::<Term>::new();
let e1 = Expr::new(&mut heap,Term::Var(x.clone()));
let r2 = heap.push(Term::Fun(x.clone(),e1));
assert_eq!(r2.raw_index(),1);
} | rust_cleaned_test_functions.jsonl/39127 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 145
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33059,
62,
15,
18,
368,
341,
262,
1077,
856,
284,
330,
87,
3263,
983,
3904,
2129,
1066,
262,
442,
31397,
604,
1064,
17364,
198,
262,
1077,
5206,
17364,
284,
5718,
406,
23170,
27909,
27638,
17249... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_record_type() {
let want = RecordType {
base: BaseNode::default(),
tvar: None,
properties: vec![
PropertyType {
base: BaseNode::default(),
name: Identifier {
base: BaseNode::default(),
name: "a".to_string(),
},
monotype: MonoType::Basic(NamedType {
base: BaseNode::default(),
name: Identifier {
base: BaseNode::default(),
name: "int".to_string(),
},
}),
},
PropertyType {
base: BaseNode::default(),
name: Identifier {
base: BaseNode::default(),
name: "b".to_string(),
},
monotype: MonoType::Basic(NamedType {
base: BaseNode::default(),
name: Identifier {
base: BaseNode::default(),
name: "string".to_string(),
},
}),
},
],
};
let mut builder = flatbuffers::FlatBufferBuilder::new();
assert_eq!(
want,
flatbuffers::get_root::<fb::RecordType>(serialize(
&mut builder,
want.clone(),
build_record_type,
))
.into()
);
} | rust_cleaned_test_functions.jsonl/112509 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1059
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14192,
1819,
368,
341,
286,
1077,
1366,
284,
13583,
929,
341,
310,
2331,
25,
5351,
1955,
486,
2258,
3148,
310,
259,
947,
25,
2240,
345,
310,
5888,
25,
7486,
90515,
394,
8655,
929,
341,
503,
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_bvs() {
let mut r = Register::new();
r.set_status_overflow(true);
bvs(0x10, &mut r);
assert_eq!(r.get_PC(), 0x10);
r.set_status_overflow(false);
bvs(0x20, &mut r);
assert_ne!(r.get_PC(), 0x20);
} | rust_cleaned_test_functions.jsonl/14240 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 131
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
11562,
368,
341,
262,
1077,
5206,
435,
284,
8451,
486,
931,
543,
262,
435,
980,
4773,
79073,
3715,
317,
262,
293,
11562,
7,
15,
87,
16,
15,
11,
609,
6984,
435,
317,
262,
2060,
10714,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sample_sorted() {
let s = Series::new("a", [1, 2, 3]).sort(false);
matches!(s.is_sorted(),IsSorted::Ascending);
let out = s.sample_frac(1.5, true, false, None).unwrap();
matches!(s.is_sorted(),IsSorted::Not);
} | rust_cleaned_test_functions.jsonl/46598 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17491,
41277,
368,
220,
341,
262,
1077,
274,
284,
11131,
486,
931,
445,
64,
497,
508,
16,
11,
220,
17,
11,
220,
18,
10697,
6860,
3576,
317,
262,
9071,
10297,
82,
2079,
41277,
1507,
3872,
51051... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_asan_stack_line() -> Result<()> {
let test_cases = vec![
(
r"#0 0x1 (/path/to/bin+0x2)",
vec![StackEntry {
line: r"#0 0x1 (/path/to/bin+0x2)".to_string(),
address: Some(1),
module_path: Some("/path/to/bin".to_string()),
module_offset: Some(2),
..Default::default()
}],
),
(
r"#42 0xf (C:\WINDOWS\SYSTEM32\ntdll.dll+0x18004cec0)",
vec![StackEntry {
line: r"#42 0xf (C:\WINDOWS\SYSTEM32\ntdll.dll+0x18004cec0)".to_string(),
address: Some(15),
module_path: Some(r"C:\WINDOWS\SYSTEM32\ntdll.dll".to_string()),
module_offset: Some(6442766016),
..Default::default()
}],
),
(
r"#10 0xee in module::func(fuzzer::Fuzzer*, char const*, unsigned long) (/path/to/bin+0x123)",
vec![StackEntry {
line: r"#10 0xee in module::func(fuzzer::Fuzzer*, char const*, unsigned long) (/path/to/bin+0x123)".to_string(),
address: Some(238),
function_name: Some("module::func(fuzzer::Fuzzer*, char const*, unsigned long)".to_string()),
module_path: Some(r"/path/to/bin".to_string()),
module_offset: Some(291),
..Default::default()
}],
),
(
r"#8 0x123 in from_file /path/to/source.c:67:12",
vec![StackEntry {
line: r"#8 0x123 in from_file /path/to/source.c:67:12".to_string(),
address: Some(291),
function_name: Some("from_file".to_string()),
function_offset: Some(12),
source_file_path: Some("/path/to/source.c".to_string()),
source_file_name: Some("source.c".to_string()),
source_file_line: Some(67),
..Default::default()
}],
),
(
r"#0 0x3 in libc.so.6",
vec![StackEntry {
line: r"#0 0x3 in libc.so.6".to_string(),
address: Some(3),
module_path: Some("libc.so.6".to_string()),
..Default::default()
}],
),
(
r"#10 0x55 (/usr/lib/libc++abi.dylib:x86_64+0x10)",
vec![StackEntry {
line: r"#10 0x55 (/usr/lib/libc++abi.dylib:x86_64+0x10)".to_string(),
address: Some(0x55),
module_path: Some("/usr/lib/libc++abi.dylib:x86_64".to_string()),
module_offset: Some(0x10),
..Default::default()
}],
)
];
for (data, expected) in test_cases {
let parsed = parse_asan_call_stack(data.clone())
.with_context(|| format!("parsing asan stack failed {}", data))?;
assert_eq!(expected, parsed);
}
Ok(())
} | rust_cleaned_test_functions.jsonl/50894 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1998
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
276,
15528,
6528,
368,
1464,
5714,
71698,
341,
286,
1077,
1273,
41427,
284,
7486,
90515,
310,
2399,
394,
435,
57676,
15,
220,
15,
87,
16,
220,
46225,
2343,
32429,
8749,
10,
15,
87,
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... | 4 |
#[test]
fn test_protocol() {
let proto = Protocol {
version: ProtocolVersion {
major: "1".to_string(),
minor: "3".to_string(),
},
domains: Default::default(),
};
let prog = render(&proto);
let expect = quote! {
mod g {
#![allow(deprecated)]
#![allow(clippy::many_single_char_names)]
#![allow(clippy::new_without_default)]
#![allow(clippy::wrong_self_convention)]
#![warn(rustdoc::bare_urls)]
use std::iter::{IntoIterator, FromIterator};
use std::ops::Deref;
use serde::{Serialize, Deserialize};
use serde_json::Value as JsonValue;
#[doc = "Session id."]
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct SessionId(String);
impl From<&str> for SessionId {
fn from(v: &str) -> Self {
Self(v.into())
}
}
impl From<String> for SessionId {
fn from(v: String) -> Self {
Self(v)
}
}
#[doc = "Message from client."]
#[derive(Debug, Clone, Serialize)]
pub struct Request<T>
where
T: Command,
{
#[serde(rename = "sessionId", skip_serializing_if = "Option::is_none")]
session_id: Option<SessionId>,
id: u32,
method: &'static str,
params: T,
}
#[doc(hidden)]
#[derive(Debug, Clone, Deserialize)]
#[serde(untagged)]
pub enum RawResponse {
Event {
#[serde(rename = "sessionId")]
session_id: Option<SessionId>,
#[serde(flatten)]
event: Event,
},
UnknownEvent {
#[serde(rename = "sessionId")]
session_id: Option<SessionId>,
method: String,
params: JsonValue,
},
Return {
#[serde(rename = "sessionId")]
session_id: Option<SessionId>,
id: u32,
result: JsonValue,
},
Error {
#[serde(rename = "sessionId")]
session_id: Option<SessionId>,
id: u32,
error: JsonValue,
},
}
impl From<RawResponse> for Response {
fn from(v: RawResponse) -> Self {
match v {
RawResponse::Event { session_id, event } => Self::Event(session_id, event),
RawResponse::UnknownEvent {
session_id,
method,
params,
} => Self::Event(session_id, Event::Unknown(method, params)),
RawResponse::Return {
session_id,
id,
result
} => Self::Return(session_id, id, result),
RawResponse::Error {
session_id,
id,
error,
} => Self::Error(session_id, id, error),
}
}
}
#[doc = "Message structure from Chrome."]
#[derive(Debug, Clone, Deserialize)]
#[serde(from = "RawResponse")]
pub enum Response {
#[doc = "Event message."]
Event(Option<SessionId>, Event),
#[doc = "Command success message."]
Return(Option<SessionId>, u32, JsonValue),
#[doc = "Command failure message."]
Error(Option<SessionId>, u32, JsonValue),
}
#[doc = "Chrome DevTools Protocol Command."]
pub trait Command: Serialize {
#[doc = "Return type."]
type Return: for<'a> Deserialize<'a>;
#[doc = "Command method name."]
const METHOD: &'static str;
#[doc = "Into command request."]
fn into_request(self, session_id: Option<SessionId>, id: u32) -> Request<Self>
where
Self: Sized,
{
Request {
session_id,
id,
method: Self::METHOD,
params: self,
}
}
}
#[doc = "Generating Chrome DevTools protocol version."]
pub const VERSION: &str = "1.3";
#[doc = "Chrome DevTools Protocol event."]
#[derive(Debug, Clone, Deserialize)]
#[serde(tag = "method", content = "params")]
pub enum Event {
#[doc = "Unknown event."]
#[serde(skip)]
Unknown(String, JsonValue),
}
}
pub use g::*;
};
assert_eq(&prog, &expect);
} | rust_cleaned_test_functions.jsonl/26897 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3275
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34880,
368,
341,
262,
1077,
18433,
284,
24572,
341,
286,
2319,
25,
24572,
5637,
341,
310,
3598,
25,
330,
16,
3263,
983,
3904,
3148,
310,
8922,
25,
330,
18,
3263,
983,
3904,
3148,
286,
1153,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reserved_types_validation() {
let reserved_types = [
// Built-in scalars
"Boolean",
"ID",
"Int",
"BigDecimal",
"String",
"Bytes",
"BigInt",
// Reserved keywords
"Query",
"Subscription",
];
let dummy_hash = DeploymentHash::new("dummy").unwrap();
for reserved_type in reserved_types {
let schema = format!("type {} @entity {{ _: Boolean }}\n", reserved_type);
let schema = Schema::parse(&schema, dummy_hash.clone()).unwrap();
let errors = schema.validate(&HashMap::new()).unwrap_err();
for error in errors {
assert!(matches!(
error,
SchemaValidationError::UsageOfReservedTypes(_)
))
}
}
} | rust_cleaned_test_functions.jsonl/10140 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 395
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74913,
9763,
19416,
368,
341,
262,
1077,
4591,
9763,
284,
2278,
286,
442,
33054,
3419,
24004,
1561,
198,
286,
330,
6890,
756,
286,
330,
915,
756,
286,
330,
1072,
756,
286,
330,
76422,
756,
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_multiple_explode() -> Result<()> {
let df = df![
"a" => [0, 1, 2, 0, 2],
"b" => [5, 4, 3, 2, 1],
"c" => [2, 3, 4, 1, 5]
]?;
let out = df
.lazy()
.groupby([col("a")])
.agg([
col("b").list().alias("b_list"),
col("c").list().alias("c_list"),
])
.explode([col("c_list"), col("b_list")])
.collect()?;
assert_eq!(out.shape(), (5, 3));
Ok(())
} | rust_cleaned_test_functions.jsonl/149 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 281
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45233,
2702,
70744,
368,
1464,
5714,
71698,
341,
262,
1077,
6764,
284,
6764,
90515,
286,
330,
64,
1,
589,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
15,
11,
220,
17,
1259,
286,
330,
65,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_try_from_put_metrics() {
let (mut sender, receiver) = UnixStream::pair().unwrap();
let mut connection = HttpConnection::new(receiver);
let req_as_bytes = b"PUT /metrics HTTP/1.1\r\n\
Content-Type: application/json\r\n\
Content-Length: 28\r\n\r\n{ \
\"metrics_path\": \"string\" \
}";
sender.write_all(req_as_bytes).unwrap();
assert!(connection.try_read().is_ok());
let req = connection.pop_parsed_request().unwrap();
assert!(ParsedRequest::try_from_request(&req).is_ok());
} | rust_cleaned_test_functions.jsonl/43148 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 300
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
5673,
15557,
37686,
368,
341,
286,
1077,
320,
6984,
4646,
11,
13964,
8,
284,
46995,
3027,
486,
12670,
1005,
15454,
543,
286,
1077,
5206,
3633,
284,
4823,
4526,
486,
931,
78126,
626,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multiple_vote() {
let leader_keypair = Keypair::new();
let leader_id = leader_keypair.pubkey();
let active_window_length = 1000;
let mint = Mint::new_with_leader(10000, leader_id, 500);
let bank = Bank::new(&mint);
let leader_scheduler_config =
LeaderSchedulerConfig::new(Some(100), Some(100), Some(100), Some(active_window_length));
let mut leader_scheduler = LeaderScheduler::new(&leader_scheduler_config);
leader_scheduler.bootstrap_leader = leader_id;
// Check that a node that votes twice in a row will get included in the active
// window
let initial_vote_height = 1;
// Create a vote account
let new_vote_account =
create_vote_account(&leader_keypair, &bank, 1, mint.last_id()).unwrap();
// Vote twice
push_vote(
&new_vote_account,
&bank,
initial_vote_height,
mint.last_id(),
);
push_vote(
&new_vote_account,
&bank,
initial_vote_height + 1,
mint.last_id(),
);
let result =
leader_scheduler.get_active_set(initial_vote_height + active_window_length, &bank);
assert_eq!(result, to_hashset_owned(&vec![leader_id]));
let result =
leader_scheduler.get_active_set(initial_vote_height + active_window_length + 1, &bank);
assert!(result.is_empty());
} | rust_cleaned_test_functions.jsonl/18354 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 698
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45233,
54360,
368,
341,
286,
1077,
7653,
3097,
12670,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
7653,
842,
284,
7653,
3097,
12670,
47773,
792,
543,
286,
1077,
4541,
12571,
5118,
284,
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_start_activity() {
let clock = ChronoClock {};
let test_dir = tempdir().expect("error while creating tempdir");
let mut service = build_json_service(&test_dir);
assert!(service
.stop_ongoing_activity(clock.get_time(), 0, true)
.is_ok());
let start = service.start_activity(
OngoingActivity {
start_time: clock.get_time(),
tags: vec![String::from("a")],
description: None,
},
true,
);
start.unwrap();
let current = service.get_ongoing_activities();
assert!(current.is_ok());
assert!(!current.unwrap().is_empty());
} | rust_cleaned_test_functions.jsonl/116409 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 361
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4906,
30026,
368,
341,
286,
1077,
8866,
284,
25481,
78,
26104,
9321,
286,
1077,
1273,
4334,
284,
2730,
3741,
1005,
17119,
445,
841,
1393,
6825,
2730,
3741,
797,
286,
1077,
5206,
2473,
284,
1936,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vec_list_pack_to() {
let mut list = VecList::new();
let index_1 = list.push_back(0);
let index_2 = list.push_back(1);
let index_3 = list.push_back(2);
assert!(list.capacity() >= 3);
list.remove(index_1);
assert!(list.capacity() >= 3);
let indices = list.indices();
assert_eq!(indices.map(|index| index.index).collect::<Vec<_>>(), [1, 2]);
let map = list.pack_to(5);
assert_eq!(list.capacity(), 5);
let indices = list.indices();
assert_eq!(indices.map(|index| index.index).collect::<Vec<_>>(), [0, 1]);
assert_eq!(map.len(), 2);
assert_eq!(map.get(&index_2).unwrap().index, 0);
assert_eq!(map.get(&index_3).unwrap().index, 1);
} | rust_cleaned_test_functions.jsonl/11551 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 383
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
2019,
32995,
2346,
368,
341,
286,
1077,
5206,
1140,
284,
11312,
852,
486,
931,
543,
286,
1077,
1922,
62,
16,
284,
1140,
2552,
3895,
7,
15,
317,
286,
1077,
1922,
62,
17,
284,
1140,
2552,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_timeout_query_udp() {
let addr: SocketAddr = ("203.0.113.0", 53)
.to_socket_addrs()
.unwrap()
.next()
.unwrap();
// TODO: need to add timeout length to SyncClient
let client = SyncClient::new(UdpClientConnection::new(addr).unwrap());
test_timeout_query(client);
} | rust_cleaned_test_functions.jsonl/17408 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20537,
5738,
69432,
368,
341,
262,
1077,
10789,
25,
20954,
13986,
284,
3489,
17,
15,
18,
13,
15,
13,
16,
16,
18,
13,
15,
497,
220,
20,
18,
340,
286,
659,
983,
19555,
2891,
5428,
741,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tee_reader() {
let mut r = TeeReader::new(MemReader::new(vec!(0, 1, 2)),
MemWriter::new());
assert_eq!(vec!(0, 1, 2), r.read_to_end().unwrap());
let (_, w) = r.unwrap();
assert_eq!(vec!(0, 1, 2), w.unwrap());
} | rust_cleaned_test_functions.jsonl/119361 | {
"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,
528,
2127,
22306,
368,
341,
286,
1077,
5206,
435,
284,
66999,
5062,
486,
931,
3189,
336,
5062,
486,
931,
25592,
10297,
15,
11,
220,
16,
11,
220,
17,
6965,
9699,
13550,
6492,
486,
931,
1423,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_op_equal() {
let mut script = Script::new(32);
script.i8(1);
script.i16(1);
script.op(OP_EQUAL);
let mut exector = Exector::new();
exector.exec(&script, &TestEnv {}).unwrap();
assert_eq!(exector.len(), 1);
let b: bool = exector.top(-1).try_into().unwrap();
assert_eq!(b, true);
let mut script = Script::new(32);
script.op(OP_01);
script.i16(1);
script.op(OP_EQUAL);
let mut exector = Exector::new();
exector.exec(&script, &TestEnv {}).unwrap();
assert_eq!(exector.len(), 1);
let b: bool = exector.top(-1).try_into().unwrap();
assert_eq!(b, true);
let mut script = Script::new(32);
script.string(&String::from("111"));
script.string(&String::from("222"));
script.op(OP_EQUAL);
let mut exector = Exector::new();
exector.exec(&script, &TestEnv {}).unwrap();
assert_eq!(exector.len(), 1);
let b: bool = exector.top(-1).try_into().unwrap();
assert_eq!(b, false);
let mut script = Script::new(32);
script.string(&String::from("111"));
script.string(&String::from("222"));
script.op(OP_EQUAL);
script.bool(false);
script.op(OP_EQUAL);
let mut exector = Exector::new();
exector.exec(&script, &TestEnv {}).unwrap();
assert_eq!(exector.len(), 1);
let b: bool = exector.top(-1).try_into().unwrap();
assert_eq!(b, true);
} | rust_cleaned_test_functions.jsonl/78506 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 606
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10287,
11478,
368,
341,
262,
1077,
5206,
5316,
284,
13710,
486,
931,
7,
18,
17,
317,
262,
5316,
8607,
23,
7,
16,
317,
262,
5316,
8607,
16,
21,
7,
16,
317,
262,
5316,
12029,
85167,
18182,
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_kernel_instance() {
let mut kernel = setup_dummy_kernel();
let sender = kernel.own_channel.1.clone();
std::thread::spawn(move || {
std::thread::sleep(std::time::Duration::from_millis(300));
// STOP parser component to finish testing
for _ in 0..20 {
let _r = sender.send(SiemMessage::Command(
SiemCommandHeader{ comp_id : 0, comm_id : 0, user : String::from("kernel")},
SiemCommandCall::GET_RULE(String::from("no_exists_rule")),
));
}
std::thread::sleep(std::time::Duration::from_millis(300));
let _r = sender.send(SiemMessage::Command(
SiemCommandHeader{ comp_id : 0, comm_id : 0, user : String::from("kernel")},
SiemCommandCall::STOP_COMPONENT("KERNEL".to_string()),
));
});
kernel.run();
let mut metrics = BTreeMap::new();
kernel.get_metrics().iter().for_each(|v| { metrics.insert(v.name.to_string(), v.metric.clone());});
// Test metrics are working
if let SiemMetric::Counter(val) = metrics.get("total_messages_processed").unwrap() {
assert_eq!(20.0 as i64, val.load(Ordering::Relaxed));
}else{ panic!("")}
} | rust_cleaned_test_functions.jsonl/35263 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 654
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26876,
11904,
368,
341,
286,
1077,
5206,
10001,
284,
6505,
60321,
26876,
543,
286,
1077,
4646,
284,
10001,
13,
779,
14571,
13,
16,
15997,
543,
286,
1460,
486,
4528,
486,
46087,
34081,
1369,
341,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_ip_addr() {
assert_eq_dbg!(
IpAddr("{{auto}}".into()),
Annotated::<IpAddr>::from_json("\"{{auto}}\"")
.unwrap()
.0
.unwrap()
);
assert_eq_dbg!(
IpAddr("127.0.0.1".into()),
Annotated::<IpAddr>::from_json("\"127.0.0.1\"")
.unwrap()
.0
.unwrap()
);
assert_eq_dbg!(
IpAddr("::1".into()),
Annotated::<IpAddr>::from_json("\"::1\"")
.unwrap()
.0
.unwrap()
);
assert_eq_dbg!(
Annotated::from_error(
Error::expected("an ip address"),
Some(Value::String("clearly invalid value".into()))
),
Annotated::<IpAddr>::from_json("\"clearly invalid value\"").unwrap()
);
} | rust_cleaned_test_functions.jsonl/57489 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 485
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10385,
7387,
368,
341,
262,
2060,
10714,
44124,
33673,
286,
35033,
13986,
445,
2979,
3902,
3417,
3263,
18122,
14702,
286,
1527,
87029,
27638,
23378,
13986,
6831,
1499,
9455,
38915,
2979,
3902,
3417,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_replica_default_version() {
assert_eq!(
ReplicaVersion::default().as_ref(),
env!("CARGO_PKG_VERSION")
);
let version = ReplicaVersion::try_from("1.2.1").unwrap();
assert!(ReplicaVersion::set_default_version(version).is_err());
} | rust_cleaned_test_functions.jsonl/55879 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25533,
15317,
9993,
9438,
368,
341,
286,
2060,
10714,
33673,
310,
94036,
5637,
486,
2258,
1005,
300,
7793,
3148,
310,
6105,
17223,
34,
7581,
46,
94126,
10678,
1138,
286,
1439,
286,
1077,
2319,
284... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vm_memory_init() {
let kvm_context = KvmContext::new().unwrap();
let mut vm = Vm::new(kvm_context.fd()).expect("Cannot create new vm");
// Create valid memory region and test that the initialization is successful.
let gm =
vm_memory::test_utils::create_anon_guest_memory(&[(GuestAddress(0), 0x1000)], false)
.unwrap();
assert!(vm
.memory_init(&gm, kvm_context.max_memslots(), true)
.is_ok());
} | rust_cleaned_test_functions.jsonl/64717 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 241
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39008,
19195,
6137,
368,
341,
286,
1077,
94748,
8467,
284,
730,
7338,
1972,
486,
931,
1005,
15454,
543,
286,
1077,
5206,
10995,
284,
647,
76,
486,
931,
5969,
7338,
8467,
58339,
6011,
17119,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_verify_1() {
let password = "";
let out = "$argon2id$v=19$m=4096,t=0,p=1$X1NhbHQAAAAAAAAAAAAAAA$bWh++MKN1OiFHKgIWTLvIi1iHicmHH7+Fv3K88ifFfI";
let hashed = to_hashed_password(out);
assert!(
!pwhash_verify(&hashed, password.as_bytes()),
"should have failed to verify"
);
} | rust_cleaned_test_functions.jsonl/134472 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 206
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35638,
62,
16,
368,
341,
286,
1077,
3552,
284,
5438,
286,
1077,
700,
284,
5201,
70821,
17,
307,
65020,
28,
16,
24,
53516,
28,
19,
15,
24,
21,
13960,
28,
15,
7237,
28,
16,
3,
55,
16,
45,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_guild_invites() {
let route = Route::GetGuildInvites { guild_id: GUILD_ID };
assert_eq!(
route.to_string(),
format!("guilds/{guild_id}/invites", guild_id = GUILD_ID)
);
} | rust_cleaned_test_functions.jsonl/119932 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
1889,
1498,
19996,
3611,
368,
341,
286,
1077,
6021,
284,
9572,
486,
1949,
72574,
15174,
3611,
314,
26411,
842,
25,
479,
18023,
3450,
2605,
286,
2060,
10714,
33673,
310,
6021,
2389,
3904,
314... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unpack_word2bit() {
let src = SLMPDeviceData::<u16> {
dev: SLMPDevice {
d_code: SLMPDeviceCode::X,
addr: 0x20,
},
value: 0x4849,
};
let ret = unpack_word2bit(&src);
let buf = [
true, false, false, true, false, false, true, false, false, false, false, true, false,
false, true, false,
];
for i in 0..16 {
assert_eq!(ret[i].dev.addr, src.dev.addr + i as u32);
assert_eq!(ret[i].dev.d_code, src.dev.d_code);
assert_eq!(ret[i].value, buf[i]);
}
} | rust_cleaned_test_functions.jsonl/62518 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 381
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54889,
13533,
17,
4489,
368,
341,
286,
1077,
2286,
284,
16797,
5781,
6985,
1043,
27638,
84,
16,
21,
29,
341,
310,
3483,
25,
16797,
5781,
6985,
341,
394,
294,
4136,
25,
16797,
5781,
6985,
2078,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_get_working_directory() {
let current_directory = path::PathBuf::from("/host/workingdir/");
let floki_root = path::PathBuf::from("/host");
let mount = path::PathBuf::from("/guest");
assert!(
get_working_directory(¤t_directory, &floki_root, &mount)
== path::PathBuf::from("/guest/workingdir/")
)
} | rust_cleaned_test_functions.jsonl/60135 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 186
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
81101,
14846,
368,
341,
286,
1077,
1482,
14846,
284,
1815,
486,
1820,
15064,
486,
1499,
4283,
3790,
14,
21152,
3741,
49897,
286,
1077,
9744,
6642,
12993,
284,
1815,
486,
1820,
15064,
486,
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 |
#[test]
fn test_cross_contract_call() {
let (mut runtime, signer, _) = init_runtime(None);
assert!(matches!(
runtime.resolve_tx(SignedTransaction::create_contract(
1,
signer.account_id.clone(),
"status".into(),
include_bytes!("../../examples/status-message/res/status_message.wasm")
.as_ref()
.into(),
to_yocto("35"),
signer.public_key(),
&signer,
CryptoHash::default(),
)),
Ok(ExecutionOutcome { status: ExecutionStatus::SuccessValue(_), .. })
));
let res = runtime.resolve_tx(SignedTransaction::create_contract(
2,
signer.account_id.clone(),
"caller".into(),
include_bytes!(
"../../examples/cross-contract-high-level/res/cross_contract_high_level.wasm"
)
.as_ref()
.into(),
to_yocto("35"),
signer.public_key(),
&signer,
CryptoHash::default(),
));
assert!(matches!(
res,
Ok(ExecutionOutcome { status: ExecutionStatus::SuccessValue(_), .. })
));
let res = runtime.resolve_tx(SignedTransaction::call(
3,
signer.account_id.clone(),
"caller".into(),
&signer,
0,
"simple_call".into(),
"{\"account_id\": \"status\", \"message\": \"caller status is ok!\"}"
.as_bytes()
.to_vec(),
300_000_000_000_000,
CryptoHash::default(),
));
let res = res.unwrap();
runtime.process_all().unwrap();
assert!(matches!(
res,
ExecutionOutcome { status: ExecutionStatus::SuccessValue(_), .. }
));
let res = runtime.view_method_call(
&"status",
"get_status",
"{\"account_id\": \"root\"}".as_bytes(),
);
let caller_status = String::from_utf8(res.unwrap()).unwrap();
assert_eq!("\"caller status is ok!\"", caller_status);
} | rust_cleaned_test_functions.jsonl/74538 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35284,
51499,
13429,
368,
341,
286,
1077,
320,
6984,
15592,
11,
70039,
11,
27439,
284,
2930,
33232,
26717,
626,
286,
2060,
10297,
19914,
33673,
310,
15592,
14691,
17805,
3759,
1542,
8070,
486,
3182,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_slice_from() {
let vec = &[1, 2, 3, 4];
assert_eq!(vec.slice_from(0), vec);
assert_eq!(vec.slice_from(2), &[3, 4]);
assert_eq!(vec.slice_from(4), &[]);
} | rust_cleaned_test_functions.jsonl/75597 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 119
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26488,
5673,
368,
341,
286,
1077,
7486,
284,
44590,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
935,
286,
2060,
10714,
10297,
4083,
14530,
5673,
7,
15,
701,
7486,
317,
286,
2060,
10714,
10297,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_btree_map_range_panic_2() {
let mut map: BTreeMap<usize, usize> = BTreeMap::new();
map.insert(3, 3);
map.insert(5, 5);
map.insert(8, 8);
let _bad_range = map.range((Excluded(&5), Excluded(&5)));
} | rust_cleaned_test_functions.jsonl/18659 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
9344,
5376,
9698,
620,
31270,
62,
17,
368,
341,
262,
1077,
5206,
2415,
25,
425,
6533,
2227,
90244,
11,
22301,
29,
284,
425,
6533,
2227,
486,
931,
543,
262,
2415,
7030,
7,
18,
11,
220,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_router_detect_utf8() {
let router =
Router::new().push(Router::with_path("用户").push(Router::with_path(r"<id:/\d+/>").push(
Router::new().push(
Router::with_path("facebook/insights").push(Router::with_path("<*rest>").handle(fake_handler)),
),
)));
let mut req: Request = hyper::Request::builder()
.uri("http://local.host/%E7%94%A8%E6%88%B7/12/facebook/insights")
.body(hyper::Body::empty())
.unwrap()
.into();
let mut path_state = PathState::new(req.uri().path());
let matched = router.detect(&mut req, &mut path_state);
assert!(matched.is_none());
let mut req: Request = hyper::Request::builder()
.uri("http://local.host/%E7%94%A8%E6%88%B7/12/facebook/insights/23")
.body(hyper::Body::empty())
.unwrap()
.into();
let mut path_state = PathState::new(req.uri().path());
let matched = router.detect(&mut req, &mut path_state);
assert!(matched.is_some());
} | rust_cleaned_test_functions.jsonl/3300 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 565
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55587,
56457,
39453,
23,
368,
341,
286,
1077,
9273,
4035,
310,
10554,
486,
931,
1005,
9077,
2785,
2676,
486,
4197,
2638,
445,
20002,
1827,
9077,
2785,
2676,
486,
4197,
2638,
2601,
22476,
307,
1437... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.