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_convex_hull_trick() {
let lines = [(0, -3), (-1, 0), (1, -8), (-2, 1), (1, -4)];
let xs = [0, 1, 2, 3, 4, 5];
// results[i] consists of the expected y-coordinates after processing
// the first i+1 lines.
let results = [
[-3, -3, -3, -3, -3, -3],
[0, -1, -2, -3, -3, -3],
[0, -1, -2, -3, -3, -3],
[1, -1, -2, -3, -3, -3],
[1, -1, -2, -1, 0, 1],
];
let mut func = PiecewiseLinearConvexFn::default();
assert_eq!(func.evaluate(0.0), -1e18);
for (&(slope, intercept), expected) in lines.iter().zip(results.iter()) {
func.max_with(slope as f64, intercept as f64);
let ys: Vec<i64> = xs.iter().map(|&x| func.evaluate(x as f64) as i64).collect();
assert_eq!(expected, &ys[..]);
}
} | rust_cleaned_test_functions.jsonl/133819 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 493
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22716,
327,
1523,
617,
3547,
865,
368,
341,
286,
1077,
5128,
284,
17826,
15,
11,
481,
18,
701,
10293,
16,
11,
220,
15,
701,
320,
16,
11,
481,
23,
701,
10293,
17,
11,
220,
16,
701,
320,
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... | 2 |
#[test]
fn test_boolean_array_neq_scalar() {
let a: BooleanArray = vec![Some(true), Some(false), None].into();
let res1: Vec<Option<bool>> =
neq_bool_scalar(&a, false).unwrap().iter().collect();
assert_eq!(res1, vec![Some(true), Some(false), None]);
let res2: Vec<Option<bool>> = neq_bool_scalar(&a, true).unwrap().iter().collect();
assert_eq!(res2, vec![Some(false), Some(true), None]);
} | rust_cleaned_test_functions.jsonl/45799 | {
"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,
46642,
3858,
13925,
80,
41652,
368,
341,
286,
1077,
264,
25,
6992,
1857,
284,
7486,
20703,
8373,
3715,
701,
4329,
3576,
701,
2240,
936,
18122,
1428,
286,
1077,
592,
16,
25,
11312,
94150,
17028,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_new_extract() {
let mut span = Span::default();
span.new_column();
span.new_line();
let span1 = span.extract();
assert_eq!(1, span1.start_line);
assert_eq!(2, span1.end_line);
assert_eq!(0, span1.start_col);
assert_eq!(0, span1.end_col);
assert_eq!(2, span.start_line);
assert_eq!(2, span.end_line);
assert_eq!(0, span.start_col);
assert_eq!(0, span.end_col);
} | rust_cleaned_test_functions.jsonl/44736 | {
"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,
5921,
39123,
368,
341,
286,
1077,
5206,
9390,
284,
11903,
486,
2258,
543,
286,
9390,
4618,
8744,
543,
286,
9390,
4618,
6528,
1428,
286,
1077,
9390,
16,
284,
9390,
37358,
1428,
286,
2060,
10714,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_flaky_mod_2() {
// Use this undocumented environment variable to figure out how many times this test has been
// run so far.
let nextest_attempt = nextest_attempt();
if nextest_attempt % 2 != 0 {
panic!("Failed because attempt {} % 2 != 0", nextest_attempt)
}
} | rust_cleaned_test_functions.jsonl/77289 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5081,
28100,
7480,
62,
17,
368,
341,
262,
442,
5443,
419,
46657,
4573,
3890,
311,
7071,
700,
1246,
1657,
3039,
419,
1273,
702,
1012,
198,
262,
442,
1598,
773,
3041,
624,
262,
1077,
1790,
477,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_macos_os_version() {
let mut os = OsContext {
raw_description: "Unix 17.5.0.0".to_string().into(),
..OsContext::default()
};
normalize_os_context(&mut os);
assert_eq_dbg!(Some("Unix"), os.name.as_str());
assert_eq_dbg!(Some("17.5.0"), os.kernel_version.as_str());
} | rust_cleaned_test_functions.jsonl/68955 | {
"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,
22802,
436,
29387,
9438,
368,
341,
1066,
262,
1077,
5206,
2643,
284,
15433,
1972,
341,
286,
7112,
11448,
25,
330,
55832,
220,
16,
22,
13,
20,
13,
15,
13,
15,
3263,
983,
3904,
1005,
18122,
3148... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_grows_with_false() {
let input_all_set: &[u8] = &[0b1111_1111, 0b1111_1111];
let mut field = BooleanBitfield::from_bytes(input_all_set);
let a = field.len();
let b = a + 1;
// Ensure `a` is out-of-bounds for test integrity.
assert!(field.get(a).is_err());
assert!(field.set(b, true).is_none());
// Ensure that `a` wasn't also set to `true` during the grow.
assert_eq!(field.get(a), Ok(false));
assert_eq!(field.get(b), Ok(true));
} | rust_cleaned_test_functions.jsonl/30476 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 276
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1889,
1811,
6615,
36015,
368,
341,
286,
1077,
1946,
5705,
2602,
25,
44590,
84,
23,
60,
284,
44590,
15,
65,
16,
16,
16,
16,
62,
16,
16,
16,
16,
11,
220,
15,
65,
16,
16,
16,
16,
62,
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_invalid_icmpv6_in_ipv4() {
let ip_config = Ipv4::DUMMY_CONFIG;
let mut ctx = DummyEventDispatcherBuilder::from_config(ip_config.clone())
.build::<DummyEventDispatcher>();
// First possible device id.
let device = DeviceId::new_ethernet(0);
let frame_dst = FrameDestination::Unicast;
let ic_config = Ipv6::DUMMY_CONFIG;
let icmp_builder = IcmpPacketBuilder::<Ipv6, &[u8], _>::new(
ic_config.remote_ip,
ic_config.local_ip,
IcmpUnusedCode,
IcmpEchoRequest::new(0, 0),
);
let ip_builder = Ipv4PacketBuilder::new(
ip_config.remote_ip,
ip_config.local_ip,
64,
Ipv4Proto::Other(Ipv6Proto::Icmpv6.into()),
);
let buf = Buf::new(Vec::new(), ..)
.encapsulate(icmp_builder)
.encapsulate(ip_builder)
.serialize_vec_outer()
.unwrap();
receive_ipv4_packet(&mut ctx, device, frame_dst, buf);
// Should have dispatched the packet but resulted in an ICMP error.
assert_eq!(get_counter_val(&mut ctx, "dispatch_receive_ipv4_packet"), 1);
assert_eq!(get_counter_val(&mut ctx, "send_icmpv4_dest_unreachable"), 1);
assert_eq!(ctx.dispatcher.frames_sent().len(), 1);
let buf = &ctx.dispatcher.frames_sent()[0].1[..];
let (_, _, _, _, _, _, code) =
parse_icmp_packet_in_ip_packet_in_ethernet_frame::<Ipv4, _, IcmpDestUnreachable, _>(
buf,
|_| {},
)
.unwrap();
assert_eq!(code, Icmpv4DestUnreachableCode::DestProtocolUnreachable);
} | rust_cleaned_test_functions.jsonl/122986 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 910
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
32747,
1307,
85,
21,
1243,
49378,
19,
368,
341,
286,
1077,
5997,
5332,
284,
358,
30168,
19,
486,
35,
58673,
12568,
280,
286,
1077,
5206,
5635,
284,
50567,
1556,
21839,
3297,
486,
1499,
53... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_queue_is_valid() {
let m = &GuestMemoryMmap::<()>::from_ranges(&[(GuestAddress(0), 0x10000)]).unwrap();
let vq = MockSplitQueue::new(m, 16);
let mut q = vq.create_queue(m);
// q is currently valid
assert!(q.is_valid());
// shouldn't be valid when not marked as ready
q.set_ready(false);
assert!(!q.ready());
assert!(!q.is_valid());
q.set_ready(true);
// shouldn't be allowed to set a size > max_size
q.set_size(q.max_size() << 1);
assert_eq!(q.state.size, q.max_size());
// or set the size to 0
q.set_size(0);
assert_eq!(q.state.size, q.max_size());
// or set a size which is not a power of 2
q.set_size(11);
assert_eq!(q.state.size, q.max_size());
// but should be allowed to set a size if 0 < size <= max_size and size is a power of two
q.set_size(4);
assert_eq!(q.state.size, 4);
q.state.size = q.max_size();
// shouldn't be allowed to set an address that breaks the alignment constraint
q.set_desc_table_address(Some(0xf), None);
assert_eq!(q.state.desc_table.0, vq.desc_table_addr().0);
// should be allowed to set an aligned out of bounds address
q.set_desc_table_address(Some(0xffff_fff0), None);
assert_eq!(q.state.desc_table.0, 0xffff_fff0);
// but shouldn't be valid
assert!(!q.is_valid());
// but should be allowed to set a valid description table address
q.set_desc_table_address(Some(0x10), None);
assert_eq!(q.state.desc_table.0, 0x10);
assert!(q.is_valid());
let addr = vq.desc_table_addr().0;
q.set_desc_table_address(Some(addr as u32), Some((addr >> 32) as u32));
// shouldn't be allowed to set an address that breaks the alignment constraint
q.set_avail_ring_address(Some(0x1), None);
assert_eq!(q.state.avail_ring.0, vq.avail_addr().0);
// should be allowed to set an aligned out of bounds address
q.set_avail_ring_address(Some(0xffff_fffe), None);
assert_eq!(q.state.avail_ring.0, 0xffff_fffe);
// but shouldn't be valid
assert!(!q.is_valid());
// but should be allowed to set a valid available ring address
q.set_avail_ring_address(Some(0x2), None);
assert_eq!(q.state.avail_ring.0, 0x2);
assert!(q.is_valid());
let addr = vq.avail_addr().0;
q.set_avail_ring_address(Some(addr as u32), Some((addr >> 32) as u32));
// shouldn't be allowed to set an address that breaks the alignment constraint
q.set_used_ring_address(Some(0x3), None);
assert_eq!(q.state.used_ring.0, vq.used_addr().0);
// should be allowed to set an aligned out of bounds address
q.set_used_ring_address(Some(0xffff_fffc), None);
assert_eq!(q.state.used_ring.0, 0xffff_fffc);
// but shouldn't be valid
assert!(!q.is_valid());
// but should be allowed to set a valid used ring address
q.set_used_ring_address(Some(0x4), None);
assert_eq!(q.state.used_ring.0, 0x4);
let addr = vq.used_addr().0;
q.set_used_ring_address(Some(addr as u32), Some((addr >> 32) as u32));
assert!(q.is_valid());
} | rust_cleaned_test_functions.jsonl/94694 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1519
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10841,
6892,
8337,
368,
341,
286,
1077,
296,
284,
609,
37804,
10642,
44,
2186,
27638,
368,
6831,
1499,
58748,
2099,
9697,
37804,
4286,
7,
15,
701,
220,
15,
87,
16,
15,
15,
15,
15,
7252,
568,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tail() {
let dir = tempdir().unwrap();
let expected = create_files(dir.path(), 3).unwrap();
let repo = LogRepository::new(dir.path());
for i in 0..=3 {
let paths = repo.tail(i).unwrap();
assert_eq!(paths, &expected[0..i]);
}
} | rust_cleaned_test_functions.jsonl/101107 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 160
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35471,
368,
341,
286,
1077,
5419,
284,
2730,
3741,
1005,
15454,
543,
286,
1077,
3601,
284,
1855,
10931,
14161,
3875,
1507,
220,
18,
568,
15454,
543,
286,
1077,
15867,
284,
2835,
4624,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_heartbeat_done_participant() {
let mut protocol = Protocol::new(get_default_fl_settings());
let client_id = ClientId::new();
let resp = protocol.heartbeat(client_id, ClientState::Done);
assert_eq!(HeartBeatResponse::StandBy, resp);
assert_eq!(
protocol.next_event().unwrap(),
Event::ResetHeartBeat(client_id)
);
assert!(protocol.next_event().is_none());
} | rust_cleaned_test_functions.jsonl/97777 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 205
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
72471,
24390,
10495,
21757,
368,
341,
286,
1077,
5206,
11507,
284,
24572,
486,
931,
5433,
9993,
5081,
10853,
1423,
286,
1077,
2943,
842,
284,
8423,
764,
486,
931,
1428,
286,
1077,
9039,
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_array_windows_nth_back() {
let v: &[i32] = &[0, 1, 2, 3, 4, 5];
let snd = v.array_windows::<4>().nth_back(1);
assert_eq!(snd, Some(&[1, 2, 3, 4]));
let mut arr_windows = v.array_windows::<2>();
assert_ne!(arr_windows.nth_back(0), arr_windows.nth_back(0));
} | rust_cleaned_test_functions.jsonl/9659 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
58220,
78342,
3895,
368,
341,
262,
1077,
348,
25,
44590,
72,
18,
17,
60,
284,
44590,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
262,
1077,
28612,
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_adsr() {
let mut a = ADSR::new(
Duration::from_secs_f64(0.03125),
Duration::from_secs_f64(0.125),
linear_to_db(0.5),
Duration::from_secs_f64(0.5)
);
let mut g = Sine::new(440.0);
let mut t = bae_rs::SampleTrackT::new();
for i in 0..bae_rs::SAMPLE_RATE {
if i == bae_rs::SAMPLE_RATE/2 {
a.release();
}
t.push(a.process(g.process()));
}
let f = ".junk/modifiers/adsr.wav";
write_wav(vec![t], 24, &mut File::create(f).unwrap(), false).unwrap();
} | rust_cleaned_test_functions.jsonl/67269 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 371
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
72275,
81,
368,
341,
286,
1077,
5206,
264,
284,
64235,
49,
486,
931,
1006,
310,
21045,
486,
1499,
68718,
761,
21,
19,
7,
15,
13,
15,
18,
16,
17,
20,
1326,
310,
21045,
486,
1499,
68718,
761,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_invalid_pubkey_len() {
let tx = test_tx();
let mut packet = sigverify::make_packet_from_transaction(tx);
let res = sigverify::do_get_packet_offsets(&packet, 0);
// make pubkey len huge
packet.data[res.unwrap().pubkey_start as usize - 1] = 0x7f;
let res = sigverify::do_get_packet_offsets(&packet, 0);
assert_eq!(res, Err(PacketError::InvalidPubkeyLen));
} | rust_cleaned_test_functions.jsonl/22078 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 204
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
34014,
792,
6043,
368,
341,
286,
1077,
9854,
284,
1273,
17805,
543,
286,
1077,
5206,
10151,
284,
8366,
12446,
486,
6927,
21078,
5673,
28884,
27301,
626,
286,
1077,
592,
284,
8366,
12446,
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_private_encrypt() {
let k0 = super::Rsa::generate(512).unwrap();
let k0pkey = k0.public_key_to_pem().unwrap();
let k1 = super::Rsa::public_key_from_pem(&k0pkey).unwrap();
let msg = vec![0xdeu8, 0xadu8, 0xd0u8, 0x0du8];
let mut emesg = vec![0; k0.size() as usize];
k0.private_encrypt(&msg, &mut emesg, Padding::PKCS1)
.unwrap();
let mut dmesg = vec![0; k1.size() as usize];
let len = k1
.public_decrypt(&emesg, &mut dmesg, Padding::PKCS1)
.unwrap();
assert_eq!(msg, &dmesg[..len]);
} | rust_cleaned_test_functions.jsonl/28561 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 341
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26249,
66593,
368,
341,
286,
1077,
595,
15,
284,
2256,
486,
49,
9081,
486,
19366,
7,
20,
16,
17,
568,
15454,
543,
286,
1077,
595,
15,
79,
792,
284,
595,
15,
37899,
3097,
2346,
620,
336,
1005... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_concat() {
assert_eq!(map_to_solidity_type::<(u8,)>(), "uint8");
assert_eq!(map_to_solidity_type::<(u8, String)>(), "uint8,string");
assert_eq!(
map_to_solidity_type::<(Vec<u8>, String)>(),
"uint8[],string"
);
assert_eq!(
map_to_solidity_type::<(Vec<u8>, [Address; 1024])>(),
"uint8[],address[1024]"
)
} | rust_cleaned_test_functions.jsonl/4194 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 246
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57478,
368,
341,
286,
2060,
10714,
10297,
2186,
2346,
643,
5192,
487,
1819,
27638,
7,
84,
23,
11,
16018,
1507,
330,
2496,
23,
797,
286,
2060,
10714,
10297,
2186,
2346,
643,
5192,
487,
1819,
2763... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_watch() {
let r = flags_from_vec(svec!["deno", "test", "--watch"]);
assert_eq!(
r.unwrap(),
Flags {
subcommand: DenoSubcommand::Test(TestFlags {
no_run: false,
doc: false,
fail_fast: None,
filter: None,
allow_none: false,
shuffle: None,
include: None,
ignore: vec![],
concurrent_jobs: NonZeroUsize::new(1).unwrap(),
trace_ops: false,
}),
no_prompt: true,
watch: Some(vec![]),
..Flags::default()
}
);
} | rust_cleaned_test_functions.jsonl/24374 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 325
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58562,
368,
341,
262,
1077,
435,
284,
8042,
5673,
13251,
1141,
4083,
0,
1183,
5183,
78,
497,
330,
1944,
497,
14482,
14321,
15049,
262,
2060,
10714,
33673,
414,
435,
55395,
3148,
414,
33205,
341,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tricky_full_house() {
let cards = parse_cards("8h 8s 8c Ah As 9c Ac");
let result = hand(cards);
assert_eq!(result.hand_type, FullHouse);
assert_eq!(result.cards.to_vec(), parse_cards("Ah As Ac 8h 8s"));
} | rust_cleaned_test_functions.jsonl/3096 | {
"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,
3547,
18964,
16372,
64270,
368,
341,
286,
1077,
7411,
284,
4715,
41357,
445,
23,
71,
220,
23,
82,
220,
23,
66,
16366,
1634,
220,
24,
66,
6381,
797,
286,
1077,
1102,
284,
1424,
73863,
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,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_join_empty() {
let v: Vec<Value> = Vec::new();
let mut args = HashMap::new();
args.insert("sep".to_owned(), to_value(&"==").unwrap());
let result = join(&to_value(&v).unwrap(), &args);
assert!(result.is_ok());
assert_eq!(result.unwrap(), to_value(&"").unwrap());
} | rust_cleaned_test_functions.jsonl/62048 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 159
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31017,
15124,
368,
341,
286,
1077,
348,
25,
11312,
48325,
29,
284,
11312,
486,
931,
543,
286,
1077,
5206,
2827,
284,
10528,
486,
931,
543,
286,
2827,
7030,
445,
28036,
3263,
983,
51973,
1507,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_2_of_3_multisig() {
let alice = crypto::gen_keypair();
let bob = crypto::gen_keypair();
let carol = crypto::gen_keypair();
let mut testkit = create_testkit_with_multisig(vec![alice.0, bob.0, carol.0], 2);
let ms_address = Caller::Service {
instance_id: MULTISIG_ID,
}
.address();
let action = TxStub.create_wallet(SERVICE_ID, CreateWallet::new("Alice + Bob"));
let alice_tx = alice.propose_action(MULTISIG_ID, action);
let action_hash = alice_tx.object_hash();
let bob_tx = bob.support_action(MULTISIG_ID, action_hash);
let block = testkit.create_block_with_transactions(vec![alice_tx, bob_tx]);
block[0].status().unwrap();
block[1].status().unwrap();
// Check that the wallet has been created.
let snapshot = testkit.snapshot();
let schema: Schema<_> = snapshot.service_schema(SERVICE_ID).unwrap();
let ms_wallet = schema.wallets.get(&ms_address).unwrap();
assert_eq!(ms_wallet.balance, 100);
let action = TxStub.transfer(
SERVICE_ID,
Transfer {
to: CallerAddress::from_key(carol.0),
amount: 10,
seed: 0,
},
);
let create_wallet_tx = carol.create_wallet(SERVICE_ID, CreateWallet::new("Carol"));
let alice_tx = alice.propose_action(MULTISIG_ID, action);
let action_hash = alice_tx.object_hash();
let carol_tx = carol.support_action(MULTISIG_ID, action_hash);
let block = testkit.create_block_with_transactions(vec![create_wallet_tx, alice_tx, carol_tx]);
block[0].status().unwrap();
block[1].status().unwrap();
// Check the change in the multisig wallet balance.
let snapshot = testkit.snapshot();
let schema: Schema<_> = snapshot.service_schema(SERVICE_ID).unwrap();
let ms_wallet = schema.wallets.get(&ms_address).unwrap();
assert_eq!(ms_wallet.balance, 90);
} | rust_cleaned_test_functions.jsonl/72165 | {
"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,
62,
17,
3575,
62,
18,
26290,
285,
343,
368,
341,
262,
1077,
70433,
284,
19028,
486,
4370,
3097,
12670,
543,
262,
1077,
35192,
284,
19028,
486,
4370,
3097,
12670,
543,
262,
1077,
1803,
337,
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_depool_2() -> Result<(), Box<dyn std::error::Error>> {
let depool_abi = "tests/samples/fakeDepool.abi.json";
let seed_phrase = "blanket time net universe ketchup maid way poem scatter blur limit drill";
let config = get_config().unwrap();
let depool_addr = config["addr"].as_str().unwrap();
let mut cmd = Command::cargo_bin(BIN_NAME)?;
cmd.arg("config")
.arg("--depool_fee")
.arg("0.7")
.assert()
.success();
let mut cmd = Command::cargo_bin(BIN_NAME)?;
cmd.arg("depool")
.arg("withdraw")
.arg("off")
.arg("--sign")
.arg(seed_phrase)
.arg("--wait-answer");
cmd.assert()
.success()
.stdout(predicate::str::contains(r#"Answer status: SUCCESS"#));
sleep(Duration::new(2, 0));
let mut cmd = Command::cargo_bin(BIN_NAME)?;
cmd.arg("run")
.arg("--abi")
.arg(depool_abi)
.arg(&depool_addr)
.arg("getData")
.arg("{}");
cmd.assert()
.success()
.stdout(predicate::str::contains(r#"reinvest": true"#))
.stdout(predicate::str::contains(r#"value": "700000000"#));
let mut cmd = Command::cargo_bin(BIN_NAME)?;
cmd.arg("config")
.arg("--depool_fee")
.arg("0.8")
.assert()
.success();
let mut cmd = Command::cargo_bin(BIN_NAME)?;
cmd.arg("depool")
.arg("withdraw")
.arg("on")
.arg("--sign")
.arg(seed_phrase)
.arg("-a");
cmd.assert()
.success()
.stdout(predicate::str::contains(r#"Answer status: SUCCESS"#));
sleep(Duration::new(2, 0));
let mut cmd = Command::cargo_bin(BIN_NAME)?;
cmd.arg("run")
.arg("--abi")
.arg(depool_abi)
.arg(&depool_addr)
.arg("getData")
.arg("{}");
cmd.assert()
.success()
.stdout(predicate::str::contains(r#"reinvest": false"#))
.stdout(predicate::str::contains(r#"value": "800000000"#));
Ok(())
} | rust_cleaned_test_functions.jsonl/118335 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1004
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2259,
10285,
62,
17,
368,
1464,
5714,
68843,
8261,
92846,
1460,
486,
841,
486,
1454,
2452,
341,
262,
1077,
2170,
1749,
22885,
72,
284,
330,
23841,
2687,
4023,
6663,
726,
7839,
1749,
22048,
72,
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... | 4 |
#[test]
fn test_set_readonly() {
with_object(0, |activation, object| {
object.as_script_object().unwrap().define_value(
activation.context.gc_context,
"normal",
"initial".into(),
Attribute::empty(),
);
object.as_script_object().unwrap().define_value(
activation.context.gc_context,
"readonly",
"initial".into(),
Attribute::READ_ONLY,
);
object.set("normal", "replaced".into(), activation).unwrap();
object
.set("readonly", "replaced".into(), activation)
.unwrap();
assert_eq!(object.get("normal", activation).unwrap(), "replaced".into());
assert_eq!(
object.get("readonly", activation).unwrap(),
"initial".into()
);
})
} | rust_cleaned_test_functions.jsonl/19714 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 513
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
6443,
3243,
368,
341,
286,
448,
5314,
7,
15,
11,
760,
23002,
11,
1633,
91,
341,
310,
1633,
5357,
14660,
5314,
1005,
15454,
1005,
1289,
3142,
1006,
394,
15099,
8681,
65554,
8467,
345,
394,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_check_revocation_signatures() {
let revaultds = [
dummy_revaultd(test_datadir(), UserRole::Manager),
dummy_revaultd(test_datadir(), UserRole::ManagerStakeholder),
dummy_revaultd(test_datadir(), UserRole::Stakeholder),
];
let ctx = secp256k1::Secp256k1::new();
let (private_key, public_key) =
create_keys(&ctx, &[1; secp256k1::constants::SECRET_KEY_SIZE]);
// Let's create a valid signature
let tx = UnvaultEmergencyTransaction::from_psbt_str("cHNidP8BAF4CAAAAAbmw9RR44LLNO5aKs0SOdUDW4aJgM9indHt2KSEVkRNBAAAAAAD9////AaQvhEcAAAAAIgAgy7Co1PHzwoce0hHQR5RHMS72lSZudTF3bYrNgqLbkDYAAAAAAAEBK9BxhEcAAAAAIgAgMJBZ5AwbSGM9P3Q44qxIeXv5J4UXLnhwdfblfBLn2voBAwSBAAAAAQWoIQL5vFDdmMV/P4SpzIWhDMbHKHMGlMwntZxaWtwUXd9KvKxRh2R2qRTtnZLjf14tI1q08+ZyoIEpuuMqWYisa3apFJKFWLx/I+YKyIXcNmwC0yw69uN9iKxsk1KHZ1IhAw9kuSKu4v1ZfxBLxss7Zw8cosbEmxBxoabAEFddlP5aIQKr5HWxmew9YvpXb67hajNP24b/sm3Odb7Ouq7fMorD/lKvU7JoAAA=").unwrap();
let psbt = tx.psbt();
let mut cache = SigHashCache::new(&psbt.global.unsigned_tx);
let prev_value = psbt.inputs[0].witness_utxo.as_ref().unwrap().value;
let script_code = psbt.inputs[0].witness_script.as_ref().unwrap();
let sighash = cache.signature_hash(
0,
&script_code,
prev_value,
SigHashType::AllPlusAnyoneCanPay,
);
let sighash = secp256k1::Message::from_slice(&sighash).unwrap();
let mut sig = ctx
.sign(&sighash, &private_key.key)
.serialize_der()
.to_vec();
sig.push(SigHashType::AllPlusAnyoneCanPay as u8);
let mut sigs = BTreeMap::new();
sigs.insert(public_key, sig.clone());
// Happy path: everything works :)
for revaultd in &revaultds {
check_revocation_signatures(&revaultd.secp_ctx, &tx, &sigs).unwrap();
}
// Signature is empty? Wtf?
let mut wrong_sigs = BTreeMap::new();
wrong_sigs.insert(public_key, vec![]);
for revaultd in &revaultds {
assert!(
check_revocation_signatures(&revaultd.secp_ctx, &tx, &wrong_sigs)
.unwrap_err()
.to_string()
.contains(&SigError::InvalidLength.to_string())
);
}
// Signature is not a valid der-encoded string
let mut wrong_sig = vec![1, 2, 3];
wrong_sig.push(SigHashType::All as u8);
let mut wrong_sigs = BTreeMap::new();
wrong_sigs.insert(public_key, wrong_sig);
for revaultd in &revaultds {
assert!(
check_revocation_signatures(&revaultd.secp_ctx, &tx, &wrong_sigs)
.unwrap_err()
.to_string()
.contains(&SigError::InvalidSighash.to_string())
);
}
// I signed with the right sighash_type but pushed the wrong one
let mut wrong_sig = ctx
.sign(&sighash, &private_key.key)
.serialize_der()
.to_vec();
wrong_sig.push(SigHashType::All as u8);
let mut wrong_sigs = BTreeMap::new();
wrong_sigs.insert(public_key, wrong_sig);
for revaultd in &revaultds {
assert!(
check_revocation_signatures(&revaultd.secp_ctx, &tx, &wrong_sigs)
.unwrap_err()
.to_string()
.contains(&SigError::InvalidSighash.to_string())
);
}
// I signed with the wrong sighash_type but pushed the right one
let wrong_sighash = cache.signature_hash(0, &script_code, prev_value, SigHashType::All);
let wrong_sighash = secp256k1::Message::from_slice(&wrong_sighash).unwrap();
let mut wrong_sig = ctx
.sign(&wrong_sighash, &private_key.key)
.serialize_der()
.to_vec();
wrong_sig.push(SigHashType::AllPlusAnyoneCanPay as u8);
let mut wrong_sigs = BTreeMap::new();
wrong_sigs.insert(public_key, wrong_sig);
for revaultd in &revaultds {
assert!(
check_revocation_signatures(&revaultd.secp_ctx, &tx, &wrong_sigs)
.unwrap_err()
.to_string()
.contains("Signature verification error")
);
}
let (_, another_public_key) =
create_keys(&ctx, &[3; secp256k1::constants::SECRET_KEY_SIZE]);
let mut wrong_sigs = BTreeMap::new();
wrong_sigs.insert(another_public_key, sig.clone());
for revaultd in &revaultds {
assert!(
check_revocation_signatures(&revaultd.secp_ctx, &tx, &wrong_sigs)
.unwrap_err()
.to_string()
.contains("Signature verification error")
);
}
let wrong_msg = secp256k1::Message::from_slice(&[1; 32]).unwrap();
let mut wrong_sig = ctx
.sign(&wrong_msg, &private_key.key)
.serialize_der()
.to_vec();
wrong_sig.push(SigHashType::AllPlusAnyoneCanPay as u8);
let mut wrong_sigs = BTreeMap::new();
wrong_sigs.insert(public_key, wrong_sig);
for revaultd in &revaultds {
assert!(
check_revocation_signatures(&revaultd.secp_ctx, &tx, &wrong_sigs)
.unwrap_err()
.to_string()
.contains("Signature verification error")
);
}
} | rust_cleaned_test_functions.jsonl/31172 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3055
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
38082,
2276,
11172,
2789,
368,
341,
286,
1077,
5772,
945,
5356,
284,
2278,
310,
17292,
38082,
945,
67,
8623,
15353,
41173,
1507,
95019,
486,
2043,
1326,
310,
17292,
38082,
945,
67,
8623,
153... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
#[test]
fn test_genesis_account_struct_compatibility() {
let yaml_string_pubkey = "---
98frSc8R8toHoS3tQ1xWSvHCvGEADRM9hAm5qmUKjSDX:
balance: 4
owner: Gw6S9CPzR8jHku1QQMdiqcmUKjC2dhJ3gzagWduA6PGw
data:
executable: true
88frSc8R8toHoS3tQ1xWSvHCvGEADRM9hAm5qmUKjSDX:
balance: 3
owner: Gw7S9CPzR8jHku1QQMdiqcmUKjC2dhJ3gzagWduA6PGw
data: ~
executable: true
6s36rsNPDfRSvzwek7Ly3mQu9jUMwgqBhjePZMV6Acp4:
balance: 2
owner: DBC5d45LUHTCrq42ZmCdzc8A8ufwTaiYsL9pZY7KU6TR
data: aGVsbG8=
executable: false
8Y98svZv5sPHhQiPqZvqA5Z5djQ8hieodscvb61RskMJ:
balance: 1
owner: DSknYr8cPucRbx2VyssZ7Yx3iiRqNGD38VqVahkUvgV1
data: aGVsbG8gd29ybGQ=
executable: true";
let tmpfile = tempfile::NamedTempFile::new().unwrap();
let path = tmpfile.path();
let mut file = File::create(path).unwrap();
file.write_all(yaml_string_pubkey.as_bytes()).unwrap();
let mut genesis_config = GenesisConfig::default();
load_genesis_accounts(path.to_str().unwrap(), &mut genesis_config).expect("genesis");
remove_file(path).unwrap();
assert_eq!(genesis_config.accounts.len(), 4);
let yaml_string_keypair = "---
\"[17,12,234,59,35,246,168,6,64,36,169,164,219,96,253,79,238,202,164,160,195,89,9,96,179,117,255,239,32,64,124,66,233,130,19,107,172,54,86,32,119,148,4,39,199,40,122,230,249,47,150,168,163,159,83,233,97,18,25,238,103,25,253,108]\":
balance: 20
owner: 9ZfsP6Um1KU8d5gNzTsEbSJxanKYp5EPF36qUu4FJqgp
data: Y2F0IGRvZw==
executable: true
\"[36,246,244,43,37,214,110,50,134,148,148,8,205,82,233,67,223,245,122,5,149,232,213,125,244,182,26,29,56,224,70,45,42,163,71,62,222,33,229,54,73,136,53,174,128,103,247,235,222,27,219,129,180,77,225,174,220,74,201,123,97,155,159,234]\":
balance: 15
owner: F9dmtjJPi8vfLu1EJN4KkyoGdXGmVfSAhxz35Qo9RDCJ
data: bW9ua2V5IGVsZXBoYW50
executable: false
\"[103,27,132,107,42,149,72,113,24,138,225,109,209,31,158,6,26,11,8,76,24,128,131,215,156,80,251,114,103,220,111,235,56,22,87,5,209,56,53,12,224,170,10,66,82,42,11,138,51,76,120,27,166,200,237,16,200,31,23,5,57,22,131,221]\":
balance: 30
owner: AwAR5mAbNPbvQ4CvMeBxwWE8caigQoMC2chkWAbh2b9V
data: Y29tYSBtb2Nh
executable: true";
let tmpfile = tempfile::NamedTempFile::new().unwrap();
let path = tmpfile.path();
let mut file = File::create(path).unwrap();
file.write_all(yaml_string_keypair.as_bytes()).unwrap();
let mut genesis_config = GenesisConfig::default();
load_genesis_accounts(path.to_str().unwrap(), &mut genesis_config).expect("genesis");
remove_file(path).unwrap();
assert_eq!(genesis_config.accounts.len(), 3);
} | rust_cleaned_test_functions.jsonl/32750 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1406
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16322,
13774,
13500,
15126,
2965,
53053,
368,
341,
286,
1077,
32246,
3904,
34014,
792,
284,
330,
10952,
24,
23,
1626,
3326,
23,
49,
23,
983,
47978,
50,
18,
83,
48,
16,
87,
7433,
85,
22455,
85,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_message() {
let msg = r#"message ReferenceData
{
repeated ScenarioInfo scenarioSet = 1;
repeated CalculatedObjectInfo calculatedObjectSet = 2;
repeated RiskFactorList riskFactorListSet = 3;
repeated RiskMaturityInfo riskMaturitySet = 4;
repeated IndicatorInfo indicatorSet = 5;
repeated RiskStrikeInfo riskStrikeSet = 6;
repeated FreeProjectionList freeProjectionListSet = 7;
repeated ValidationProperty ValidationSet = 8;
repeated CalcProperties calcPropertiesSet = 9;
repeated MaturityInfo maturitySet = 10;
}"#;
let mess = parse_opt(msg, |p| p.next_message_opt());
assert_eq!(10, mess.fields.len());
} | rust_cleaned_test_functions.jsonl/70450 | {
"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,
6462,
368,
341,
286,
1077,
3750,
284,
435,
55543,
1994,
17207,
1043,
198,
262,
341,
286,
11504,
58663,
1731,
220,
15048,
1649,
284,
220,
16,
280,
286,
11504,
31359,
657,
1190,
1731,
16588,
1190,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_union_default() {
let got = parse!(
r#"
union LOCKU4res switch (nfsstat4 status) {
case NFS4_OK:
stateid4 lock_stateid;
default:
type_name field_name;
};"#
);
assert_eq!(got.name, "LOCKU4res");
assert_eq!(got.cases.len(), 1);
assert_eq!(&got.cases[0].case_values, &["NFS4_OK"]);
assert_eq!(got.cases[0].field_name, "lock_stateid");
assert_eq!(
got.cases[0].field_value,
ArrayType::None(BasicType::Ident("stateid4".to_string()))
);
assert_eq!(got.void_cases.len(), 0);
let default = &got.default.unwrap();
assert_eq!(default.case_values, &["default"]);
assert_eq!(default.field_name, "field_name");
assert_eq!(
default.field_value,
ArrayType::None(BasicType::Ident("type_name".to_string()))
);
assert_eq!(got.switch.var_name, "status");
assert_eq!(
got.switch.var_type,
BasicType::Ident("nfsstat4".to_string())
);
} | rust_cleaned_test_functions.jsonl/7409 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 569
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51621,
9993,
368,
341,
286,
1077,
2684,
284,
4715,
33673,
310,
435,
2,
698,
197,
73924,
49463,
52,
19,
416,
3398,
320,
77,
3848,
9878,
19,
2639,
8,
341,
298,
2722,
87815,
19,
8375,
510,
464,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_snapshot_max_total_size() {
let regions: Vec<u64> = (0..20).collect();
let kv_path = Builder::new()
.prefix("test-snapshot-max-total-size-db")
.tempdir()
.unwrap();
let engine = get_test_db_for_regions(&kv_path, None, None, None, None, ®ions).unwrap();
let snapfiles_path = Builder::new()
.prefix("test-snapshot-max-total-size-snapshots")
.tempdir()
.unwrap();
let max_total_size = 10240;
let snap_mgr = SnapManagerBuilder::default()
.max_total_size(max_total_size)
.build::<_>(snapfiles_path.path().to_str().unwrap(), None);
let snapshot = RocksSnapshot::new(engine.kv);
// Add an oldest snapshot for receiving.
let recv_key = SnapKey::new(100, 100, 100);
let recv_head = {
let mut stat = SnapshotStatistics::new();
let mut snap_data = RaftSnapshotData::default();
let mut s = snap_mgr
.get_snapshot_for_building::<RocksEngine>(&recv_key)
.unwrap();
s.build(
&snapshot,
&gen_test_region(100, 1, 1),
&mut snap_data,
&mut stat,
Box::new(snap_mgr.clone()),
)
.unwrap();
snap_data.write_to_bytes().unwrap()
};
let recv_remain = {
let mut data = Vec::with_capacity(1024);
let mut s = snap_mgr.get_snapshot_for_sending(&recv_key).unwrap();
s.read_to_end(&mut data).unwrap();
assert!(snap_mgr.delete_snapshot(&recv_key, s.as_ref(), true));
data
};
let mut s = snap_mgr
.get_snapshot_for_receiving(&recv_key, &recv_head)
.unwrap();
s.write_all(&recv_remain).unwrap();
s.save().unwrap();
for (i, region_id) in regions.into_iter().enumerate() {
let key = SnapKey::new(region_id, 1, 1);
let region = gen_test_region(region_id, 1, 1);
let mut s = snap_mgr
.get_snapshot_for_building::<RocksEngine>(&key)
.unwrap();
let mut snap_data = RaftSnapshotData::default();
let mut stat = SnapshotStatistics::new();
s.build(
&snapshot,
®ion,
&mut snap_data,
&mut stat,
Box::new(snap_mgr.clone()),
)
.unwrap();
// TODO: this size may change in different RocksDB version.
let snap_size = 1658;
let max_snap_count = (max_total_size + snap_size - 1) / snap_size;
// The first snap_size is for region 100.
// That snapshot won't be deleted because it's not for generating.
assert_eq!(
snap_mgr.get_total_snap_size(),
snap_size * cmp::min(max_snap_count, (i + 2) as u64)
);
}
} | rust_cleaned_test_functions.jsonl/41926 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1621
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53265,
6345,
10784,
2368,
368,
341,
286,
1077,
13604,
25,
11312,
34837,
21,
19,
29,
284,
320,
15,
496,
17,
15,
568,
17384,
543,
286,
1077,
16178,
2638,
284,
20626,
486,
931,
741,
310,
659,
118... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_filter_by_tid() {
timeout_ms(
|| {
let mut p = setup_default_packet();
p.metadata.pid = 0;
let mut p2 = p.clone();
p2.metadata.tid = 0;
let lm = LogMessage {
pid: p.metadata.pid,
tid: p.metadata.tid,
time: p.metadata.time,
dropped_logs: p.metadata.dropped_logs,
severity: p.metadata.severity,
msg: String::from("BBBBB"),
tags: vec![String::from("AAAAA")],
};
let options = &mut LogFilterOptions {
filter_by_pid: false,
pid: 1,
filter_by_tid: true,
tid: 1,
min_severity: LogLevelFilter::None,
verbosity: 0,
tags: vec![],
};
filter_test_helper(vec![lm], vec![p, p2], Some(options), "test_filter_by_tid");
},
TEST_TIMEOUT,
);
} | rust_cleaned_test_functions.jsonl/76995 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 726
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8727,
3710,
73719,
368,
341,
286,
9632,
21416,
1006,
310,
1369,
341,
394,
1077,
5206,
281,
284,
6505,
9993,
21078,
543,
394,
281,
27544,
40939,
284,
220,
15,
280,
394,
1077,
5206,
281,
17,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_make_bounded_mean_hamming() {
let transformation = make_sized_bounded_mean(5, (0., 10.)).unwrap_test();
let arg = vec![1., 2., 3., 4., 5.];
let ret = transformation.invoke(&arg).unwrap_test();
let expected = 3.;
assert_eq!(ret, expected);
assert!(transformation.check(&1, &2.).unwrap_test())
} | rust_cleaned_test_functions.jsonl/81927 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 166
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28230,
880,
13082,
16933,
1523,
309,
5311,
368,
341,
286,
1077,
17991,
284,
1281,
643,
1506,
880,
13082,
16933,
7,
20,
11,
320,
15,
2572,
220,
16,
15,
13,
4579,
15454,
4452,
543,
286,
1077,
13... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_4() {
let string = r#""a\"bc""#;
let tokenizer = Tokenizer::new(string);
let tokens: Vec<Token> = tokenizer.iter().collect();
assert_eq!(tokens, vec![Token::Quoted("\"a\\\"bc\"".to_string()),]);
assert_eq!(
string,
tokens.iter().map(|x| x.to_string()).collect::<String>()
);
} | rust_cleaned_test_functions.jsonl/75868 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 192
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
19,
368,
341,
286,
1077,
914,
284,
435,
2,
3014,
64,
2105,
8904,
3014,
2,
280,
286,
1077,
45958,
284,
9660,
3135,
486,
931,
3609,
317,
286,
1077,
11211,
25,
11312,
83416,
29,
284,
45958,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_blake2s_constant_constraints() {
let cs = ConstraintSystem::<Fr>::new_ref();
let mut rng = XorShiftRng::seed_from_u64(1231275789u64);
let input_bits: Vec<_> = (0..512)
.map(|_| Boolean::<Fr>::constant(rng.gen()))
.collect();
evaluate_blake2s(&input_bits).unwrap();
assert_eq!(cs.num_constraints(), 0);
} | rust_cleaned_test_functions.jsonl/101938 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 204
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13141,
726,
17,
82,
34967,
60267,
368,
341,
286,
1077,
10532,
284,
44264,
2320,
27638,
22560,
6831,
931,
7793,
543,
286,
1077,
5206,
28422,
284,
1599,
269,
24841,
49,
968,
486,
22602,
5673,
7300,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_avro_3452_parsing_name_without_namespace() {
init();
let name: Name = serde_json::from_str(r#"{"name": "a.b.c.d"}"#).unwrap();
assert_eq!(&name.name, "d");
assert_eq!(name.namespace, Some("a.b.c".to_owned()));
let fullname = name.fullname(None);
assert_eq!("a.b.c.d", fullname);
} | rust_cleaned_test_functions.jsonl/69036 | {
"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,
26173,
299,
62,
18,
19,
20,
17,
620,
28598,
1269,
39904,
41571,
368,
341,
262,
2930,
543,
262,
1077,
829,
25,
3988,
284,
61570,
9455,
486,
1499,
2895,
2601,
55543,
4913,
606,
788,
330,
64,
948... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_update_settings() {
let mut context = get_context(accounts(1));
testing_env!(context.build());
let mut contract = Contract::new();
testing_env!(context.is_view(true).build());
assert_eq!(contract.slot_granularity, SLOT_GRANULARITY);
testing_env!(context.is_view(false).build());
contract.update_settings(
None,
Some(10),
Some(true),
None,
None,
None,
None,
None,
None,
);
testing_env!(context.is_view(true).build());
assert_eq!(contract.slot_granularity, 10);
assert_eq!(contract.paused, true);
} | rust_cleaned_test_functions.jsonl/74938 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 370
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
10853,
368,
341,
286,
1077,
5206,
2266,
284,
633,
8467,
91868,
7,
16,
1106,
286,
7497,
15879,
10297,
2147,
13239,
1423,
286,
1077,
5206,
5116,
284,
19185,
486,
931,
543,
286,
7497,
15879,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hash_commutative() {
let data_a = b"test data A";
let data_b = b"test data B";
let mut hash1 = RistrettoHash::<Sha512>::default();
let mut hash2 = hash1.clone();
hash1.add(data_a, 1);
hash1.add(data_b, 1);
hash2.add(data_b, 1);
hash2.add(data_a, 1);
let output1 = hash1.finalize();
let output2 = hash2.finalize();
assert_eq!(output1, output2)
} | rust_cleaned_test_functions.jsonl/30200 | {
"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,
8950,
2965,
6984,
1388,
368,
341,
286,
1077,
821,
4306,
284,
293,
1,
1944,
821,
362,
876,
286,
1077,
821,
880,
284,
293,
1,
1944,
821,
425,
3302,
286,
1077,
5206,
5175,
16,
284,
431,
380,
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_simplify() {
fn get_w_expression(lines: &[&str]) -> Expr {
let mut state = State::start();
for line in lines {
let instruction = line.parse().unwrap();
state = state.after(&instruction);
}
state.registers[0].clone()
}
// Register starts at 0
assert_eq!(Expr::constant(0), get_w_expression(&[]));
// Math with constants evaluates the expression
assert_eq!(
get_w_expression(&["add w 10"]),
get_w_expression(&["add w 5", "add x 5", "add w x"])
);
// Adding 0 is identity in both directions
assert_eq!(
get_w_expression(&["inp w"]),
get_w_expression(&["inp x", "add w x"])
);
assert_eq!(
get_w_expression(&["inp w"]),
get_w_expression(&["inp w", "add w x"])
);
// Multiplying by 1 is identity in both directions
assert_eq!(
get_w_expression(&["inp w"]),
get_w_expression(&["inp x", "add w 1", "mul w x"])
);
assert_eq!(
get_w_expression(&["inp w"]),
get_w_expression(&["inp w", "add x 1", "mul w x"])
);
// Dividing by 1 is identity
assert_eq!(
get_w_expression(&["inp w"]),
get_w_expression(&["inp w", "add x 1", "div w x"])
);
// Comparing an input with something out of range is always 0
assert_eq!(
get_w_expression(&[]),
get_w_expression(&["inp w", "add x 14", "eql w x"])
);
assert_eq!(
get_w_expression(&[]),
get_w_expression(&["inp w", "mul w 100", "mod w 20", "add x 25", "eql w x"])
);
// Multiplying a polynomial times a constant
assert_eq!(
// a * 5 + 5
get_w_expression(&["inp w", "mul w 5", "add w 5"]),
get_w_expression(&["inp w", "add w 1", "mul w 5"])
);
// Modding a polynomial with a constant
assert_eq!(
get_w_expression(&["add w 3"]),
get_w_expression(&["inp w", "mul w 5", "add w 8", "mod w 5"]),
);
// The mod of a sum of terms can drop terms that multiply by the modulus.
assert_eq!(
get_w_expression(&["add w 3"]),
get_w_expression(&["inp w", "eql w 2", "mul w 5", "add w 8", "mod w 5"]),
);
// Constants go on the left
assert_eq!(
get_w_expression(&["add w 25", "inp x", "div x 26", "mul w x"]),
get_w_expression(&["inp w", "div w 26", "add x 25", "mul w x"])
);
assert_eq!(
get_w_expression(&["inp x", "inp y", "add w x", "eql w y"]),
get_w_expression(&["inp x", "inp y", "add w x", "eql w y", "mod w 5"])
);
// Dividing a polynomial by a scalar can divide through if we know the remainders
// can't add up to more than the scalar.
assert_eq!(
// [a + 7]
get_w_expression(&["inp w", "add x 7", "add w x"]),
// [26a + b + 185] / 26
get_w_expression(&[
"inp w",
"mul w 26",
"inp x",
"add w x",
"add w 185",
"div w 26"
]),
);
// Distributive multiplication
// assert_eq!(
// // a * b + a * c
} | rust_cleaned_test_functions.jsonl/132167 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1625
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
70206,
368,
341,
262,
5168,
633,
1670,
28068,
33152,
25,
44590,
5,
495,
2467,
1464,
28819,
341,
286,
1077,
5206,
1584,
284,
3234,
486,
2468,
543,
286,
369,
1555,
304,
5128,
341,
310,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_resolve_vars_out_of_order() {
let d = Dockerfile::parse(indoc!(r#"
FROM $image
ARG image="alpine:3.12"
"#)).unwrap();
let from: &FromInstruction = d.instructions
.get(0).unwrap()
.try_into().unwrap();
assert_eq!(
from.image_parsed.resolve_vars(&d),
None
);
} | rust_cleaned_test_functions.jsonl/17938 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 177
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77291,
11168,
6068,
3575,
7869,
368,
341,
1066,
262,
1077,
294,
284,
40549,
1192,
486,
6400,
23884,
509,
10297,
81,
2,
698,
414,
4295,
400,
1805,
198,
414,
32746,
2168,
428,
278,
38038,
25,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ext_sort_zero_terminated() {
new_ucmd!()
.arg("-z")
.arg("-S")
.arg("10K")
.arg("zero-terminated.txt")
.succeeds()
.stdout_is_fixture("zero-terminated.expected");
} | rust_cleaned_test_functions.jsonl/20452 | {
"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,
9927,
18435,
19359,
62,
68659,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
858,
13645,
89,
1138,
286,
659,
858,
13645,
50,
1138,
286,
659,
858,
445,
16,
15,
42,
1138,
286,
659,
858,
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_unlock_uninitialized_account() {
let location = TempLocation::new();
let pre_auth_manager =
Arc::new(pre_auth::InMemoryManager::create(TEST_PRE_AUTH_SINGLE.clone()));
request_stream_test(
location.to_persistent_lifetime(),
pre_auth_manager,
None,
Arc::new(Inspector::new()),
|proxy| async move {
assert_eq!(proxy.unlock_account().await?, Err(ApiError::FailedPrecondition));
Ok(())
},
);
} | rust_cleaned_test_functions.jsonl/105837 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 292
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19465,
4907,
36161,
13500,
368,
341,
286,
1077,
3728,
284,
19944,
4707,
486,
931,
543,
286,
1077,
855,
14014,
12144,
4035,
310,
19689,
486,
931,
27659,
14014,
486,
641,
10642,
2043,
486,
3182,
503... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_pluralize_multiple_custom_suffix() {
let mut args = HashMap::new();
args.insert("suffix".to_string(), to_value("es"));
let result = pluralize(to_value(2), args);
assert!(result.is_ok());
assert_eq!(result.unwrap(), to_value("es"));
} | rust_cleaned_test_functions.jsonl/62618 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57427,
551,
45233,
15875,
37151,
368,
341,
286,
1077,
5206,
2827,
284,
10528,
486,
931,
543,
286,
2827,
7030,
445,
26786,
3263,
983,
3904,
1507,
311,
3142,
445,
288,
4010,
286,
1077,
1102,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hover_generic_struct_has_goto_type_actions() {
check_actions(
r#"
struct Arg(u32);
struct S<T>{ f1: T }
fn main() { let s$0t = S{ f1:Arg(0) }; }
"#,
expect![[r#"
[
GoToType(
[
HoverGotoTypeData {
mod_path: "test::S",
nav: NavigationTarget {
file_id: FileId(
0,
),
full_range: 17..37,
focus_range: 24..25,
name: "S",
kind: Struct,
description: "struct S<T>",
},
},
HoverGotoTypeData {
mod_path: "test::Arg",
nav: NavigationTarget {
file_id: FileId(
0,
),
full_range: 0..16,
focus_range: 7..10,
name: "Arg",
kind: Struct,
description: "struct Arg",
},
},
],
),
]
"#]],
);
} | rust_cleaned_test_functions.jsonl/66671 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1296
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53445,
41232,
15126,
21778,
97732,
1819,
25368,
368,
341,
286,
1779,
25368,
1006,
310,
435,
2,
698,
1235,
7638,
8154,
18,
17,
317,
1235,
328,
3125,
7309,
282,
16,
25,
350,
555,
8822,
1887,
368,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dot() {
let v1 = Vec3::new(1.0f64, 2.0f64, 3.0f64);
let v2 = Vec3::new(1.0f64, 2.0f64, 3.0f64);
let dot = v1.e[0] * v2.e[0] + v1.e[1] * v2.e[1] + v1.e[2] * v2.e[2];
assert_eq!(v1.dot(v2), dot);
} | rust_cleaned_test_functions.jsonl/120479 | {
"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,
30941,
368,
972,
286,
1077,
348,
16,
284,
11312,
18,
486,
931,
7,
16,
13,
15,
69,
21,
19,
11,
220,
17,
13,
15,
69,
21,
19,
11,
220,
18,
13,
15,
69,
21,
19,
736,
286,
1077,
348,
17,
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_sandbox_unexpected_message_when_drop() {
let sandbox = timestamping_sandbox();
// See comments to `test_sandbox_recv_and_send`.
let consensus_keys = KeyPair::random();
let service_key = KeyPair::random().public_key();
let validator_keys = ValidatorKeys::new(consensus_keys.public_key(), service_key);
sandbox.add_peer_to_connect_list(gen_primitive_socket_addr(1), validator_keys);
sandbox.recv(&Sandbox::create_connect(
&consensus_keys.public_key(),
sandbox.address(ValidatorId(2)),
sandbox.time().into(),
&user_agent(),
consensus_keys.secret_key(),
));
} | rust_cleaned_test_functions.jsonl/77269 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 313
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
31536,
4907,
7325,
6462,
47636,
29584,
368,
341,
286,
1077,
42754,
284,
11441,
287,
643,
31536,
543,
286,
442,
3496,
6042,
311,
1565,
1944,
643,
31536,
36118,
8378,
13565,
18639,
286,
1077,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_uint_as_string() {
test_none_with_ctx_and_extra(cast_uint_as_string);
let cs: Vec<(u64, Vec<u8>, String)> = vec![
(
i64::MAX as u64,
(i64::MAX as u64).to_string().into_bytes(),
(i64::MAX as u64).to_string(),
),
(
i64::MIN as u64,
(i64::MIN as u64).to_string().into_bytes(),
(i64::MIN as u64).to_string(),
),
(
u64::MAX,
u64::MAX.to_string().into_bytes(),
u64::MAX.to_string(),
),
(0u64, 0u64.to_string().into_bytes(), 0u64.to_string()),
];
test_as_string_helper(
cs,
|ctx, extra, val| {
let val = val.map(|x| x as i64);
cast_uint_as_string(ctx, extra, &val)
},
"cast_uint_as_string",
);
} | rust_cleaned_test_functions.jsonl/101786 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 611
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15807,
11898,
3904,
368,
341,
286,
1273,
31488,
6615,
15147,
8378,
31858,
1337,
559,
15807,
11898,
3904,
626,
286,
1077,
10532,
25,
11312,
28706,
84,
21,
19,
11,
11312,
34837,
23,
8066,
923,
16018... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_process_plantuml_code() {
macro_rules! assert_plantuml_injection {
($markdown:expr, $expected_code_block:expr, $rendered_output:expr) => {{
let processor = PlantUMLCodeProcessor::new($markdown);
let renderer = FakeRenderer {
code_block: RefCell::new(String::new()),
};
let result = processor.process(&renderer, &String::from(""));
assert_eq!($expected_code_block, *renderer.code_block.borrow());
assert_eq!($rendered_output, result);
}};
}
assert_plantuml_injection!("```plantuml\nfoo\n```", "foo\n", "rendered");
assert_plantuml_injection!(
"abc\n```plantuml\nfoo\n```\ndef",
"foo\n",
"abc\nrendered\ndef"
);
assert_plantuml_injection!("abc\n```plantuml\nfoo", "foo", "abc\nrendered");
assert_plantuml_injection!(
"abc\n```plantuml\nfoo\n```\ndef\n```plantuml\nbar\n```\ngeh",
"bar\n",
"abc\nrendered\ndef\nrendered\ngeh"
);
assert_plantuml_injection!(
"abc\n```plantuml\nfoo\n```\ndef\n```plantuml\nbar",
"bar",
"abc\nrendered\ndef\nrendered"
);
assert_plantuml_injection!(
"abc\n```\nfoo\n```\ndef\n```plantuml\nbar",
"bar",
"abc\n```\nfoo\n```\ndef\nrendered"
);
} | rust_cleaned_test_functions.jsonl/21609 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 831
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
6317,
517,
42231,
4136,
368,
341,
286,
18072,
21407,
0,
2060,
6317,
517,
42231,
1243,
7606,
341,
310,
1711,
60073,
96011,
11,
400,
7325,
4136,
7113,
96011,
11,
400,
7322,
291,
7645,
96011,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vec3a_angle_between() {
let angle = Vec3A::new(1.0, 0.0, 1.0).angle_between(Vec3A::new(1.0, 1.0, 0.0));
assert_approx_eq!(f32::consts::FRAC_PI_3, angle, 1e-6);
let angle = Vec3A::new(10.0, 0.0, 10.0).angle_between(Vec3A::new(5.0, 5.0, 0.0));
assert_approx_eq!(f32::consts::FRAC_PI_3, angle, 1e-6);
let angle = Vec3A::new(-1.0, 0.0, -1.0).angle_between(Vec3A::new(1.0, -1.0, 0.0));
assert_approx_eq!(2.0 * f32::consts::FRAC_PI_3, angle, 1e-6);
} | rust_cleaned_test_functions.jsonl/23511 | {
"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,
13251,
18,
64,
21727,
48302,
368,
341,
262,
1077,
9210,
284,
11312,
18,
32,
486,
931,
7,
16,
13,
15,
11,
220,
15,
13,
15,
11,
220,
16,
13,
15,
568,
4044,
48302,
49923,
18,
32,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_total_ord() {
[1, 2, 3, 4].cmp(& &[1, 2, 3]) == Greater;
[1, 2, 3].cmp(& &[1, 2, 3, 4]) == Less;
[1, 2, 3, 4].cmp(& &[1, 2, 3, 4]) == Equal;
[1, 2, 3, 4, 5, 5, 5, 5].cmp(& &[1, 2, 3, 4, 5, 6]) == Less;
[2, 2].cmp(& &[1, 2, 3, 4]) == Greater;
} | rust_cleaned_test_functions.jsonl/75620 | {
"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,
10784,
67324,
368,
341,
286,
508,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
936,
7293,
2099,
44590,
16,
11,
220,
17,
11,
220,
18,
2467,
621,
32281,
280,
286,
508,
16,
11,
220,
17,
11,
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_prefix() {
let in_values: Vec<u8> = vec![2, 20];
let mut dna_string = DnaString::new();
dna_string.push_bytes(&in_values, 8);
let pref_dna_string = dna_string.prefix(0).to_owned();
assert_eq!(pref_dna_string.len(), 0);
let pref_dna_string = dna_string.prefix(8).to_owned();
assert_eq!(pref_dna_string, dna_string);
let pref_dna_string = dna_string.prefix(4).to_owned();
let values: Vec<u8> = pref_dna_string.iter().collect();
assert_eq!(values, [2, 0, 0, 0]);
let pref_dna_string = dna_string.prefix(6).to_owned();
let values: Vec<u8> = pref_dna_string.iter().collect();
assert_eq!(values, [2, 0, 0, 0, 0, 1]);
dna_string.push_bytes(&in_values, 8);
dna_string.push_bytes(&in_values, 8);
let pref_dna_string = dna_string.prefix(17).to_owned();
let values: Vec<u8> = pref_dna_string.iter().collect();
assert_eq!(values, [2, 0, 0, 0, 0, 1, 1, 0, 2, 0, 0, 0, 0, 1, 1, 0, 2]);
} | rust_cleaned_test_functions.jsonl/95213 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 529
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13974,
368,
341,
286,
1077,
304,
9146,
25,
11312,
34837,
23,
29,
284,
7486,
20703,
17,
11,
220,
17,
15,
935,
286,
1077,
5206,
75334,
3904,
284,
422,
3376,
703,
486,
931,
543,
286,
75334,
3904,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_process_entries_2_entries_par() {
let GenesisConfigInfo {
genesis_config,
mint_keypair,
..
} = create_genesis_config(1000);
let bank = Arc::new(Bank::new(&genesis_config));
let keypair1 = Keypair::new();
let keypair2 = Keypair::new();
let keypair3 = Keypair::new();
let keypair4 = Keypair::new();
//load accounts
let tx = system_transaction::transfer(
&mint_keypair,
&keypair1.pubkey(),
1,
bank.last_blockhash(),
);
assert_eq!(bank.process_transaction(&tx), Ok(()));
let tx = system_transaction::transfer(
&mint_keypair,
&keypair2.pubkey(),
1,
bank.last_blockhash(),
);
assert_eq!(bank.process_transaction(&tx), Ok(()));
// ensure bank can process 2 entries that do not have a common account and no tick is registered
let blockhash = bank.last_blockhash();
let tx =
system_transaction::transfer(&keypair1, &keypair3.pubkey(), 1, bank.last_blockhash());
let entry_1 = next_entry(&blockhash, 1, vec![tx]);
let tx =
system_transaction::transfer(&keypair2, &keypair4.pubkey(), 1, bank.last_blockhash());
let entry_2 = next_entry(&entry_1.hash, 1, vec![tx]);
assert_eq!(
process_entries(&bank, &mut [entry_1, entry_2], true, None, None),
Ok(())
);
assert_eq!(bank.get_balance(&keypair3.pubkey()), 1);
assert_eq!(bank.get_balance(&keypair4.pubkey()), 1);
assert_eq!(bank.last_blockhash(), blockhash);
} | rust_cleaned_test_functions.jsonl/47537 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 824
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
26092,
62,
17,
26092,
22654,
368,
341,
286,
1077,
40788,
2648,
1731,
341,
310,
59366,
5332,
345,
310,
28337,
3097,
12670,
345,
310,
54538,
286,
335,
284,
1855,
16322,
13774,
5332,
7,
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_unicode_codepoints() {
let invalid = ["Ƒ", "バ", "メ", "﷽"];
for c in &invalid {
assert_invalid_str(c);
}
} | rust_cleaned_test_functions.jsonl/4161 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54662,
4136,
7706,
368,
341,
286,
1077,
8318,
284,
4383,
149965,
497,
330,
65853,
497,
330,
38750,
497,
330,
149861,
6332,
286,
369,
272,
304,
609,
11808,
341,
310,
2060,
31433,
2895,
1337,
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
] | 2 |
#[test]
fn test_delete_followup_message() -> Result<(), Box<dyn Error>> {
let application_id = Id::new(1);
let token = "foo".to_owned();
let client = Client::new(String::new());
let req = client
.interaction(application_id)
.delete_response(&token)
.try_into_request()?;
assert!(!req.use_authorization_token());
assert_eq!(
&Path::WebhooksIdTokenMessagesId(application_id.get(), token),
req.ratelimit_path()
);
Ok(())
} | rust_cleaned_test_functions.jsonl/96788 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 270
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11353,
43490,
454,
6462,
368,
1464,
5714,
68843,
8261,
92846,
4600,
2452,
341,
286,
1077,
3766,
842,
284,
5223,
486,
931,
7,
16,
317,
286,
1077,
3950,
284,
330,
7975,
3263,
983,
51973,
1428,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_length() {
let ie = InformationElement::new(
CauseCode::RequestAccepted,
CauseSource::LocalNode,
false,
false,
None,
0).unwrap();
assert_eq!(ie.length(), 2+4);
} | rust_cleaned_test_functions.jsonl/614 | {
"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,
5118,
368,
341,
286,
1077,
29858,
284,
8085,
1691,
486,
931,
1006,
310,
44346,
2078,
486,
1900,
65906,
345,
310,
44346,
3608,
486,
7319,
1955,
345,
310,
895,
345,
310,
895,
345,
310,
2240,
345,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_schema_descriptor() {
let result = test_schema_descriptor_helper();
assert!(
result.is_ok(),
"Expected result to be OK but got err:\n {}",
result.unwrap_err()
);
} | rust_cleaned_test_functions.jsonl/16684 | {
"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,
25371,
33774,
368,
341,
286,
1077,
1102,
284,
1273,
25371,
33774,
10418,
543,
286,
2060,
33673,
310,
1102,
2079,
19817,
3148,
310,
330,
18896,
1102,
311,
387,
10402,
714,
2684,
1848,
7190,
77,
468... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_state_merkle_node_schema() {
assert_encode_decode::<StateMerkleNodeSchema>(
&HashValue::random(),
&Node::new_leaf(HashValue::random(), HashValue::random()),
);
} | rust_cleaned_test_functions.jsonl/88854 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4387,
717,
16754,
273,
5084,
25371,
368,
341,
262,
2060,
11224,
15227,
27638,
1397,
44,
16754,
273,
1955,
8632,
17055,
286,
609,
6370,
1130,
486,
11463,
3148,
286,
609,
1955,
486,
931,
38909,
7,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_stable() {
assert_eq!(Version::parse("v1"), Version::Stable(1));
assert_eq!(Version::parse("v3"), Version::Stable(3));
assert_eq!(Version::parse("v10"), Version::Stable(10));
} | rust_cleaned_test_functions.jsonl/116487 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 103
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
480,
368,
341,
286,
2060,
10714,
10297,
5637,
486,
6400,
445,
85,
16,
3975,
6079,
486,
623,
480,
7,
16,
1106,
286,
2060,
10714,
10297,
5637,
486,
6400,
445,
85,
18,
3975,
6079,
486,
623,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eval() {
let upt = upt::init();
check_eval!(upt, (Install, "vim", false), "upt install vim");
check_eval!(upt, (Install, "vim jq", true), "upt install -y vim jq");
check_eval!(upt, (Remove, "vim jq", false), "upt remove vim jq");
check_eval!(upt, (Upgrade, "vim", true), "upt upgrade -y vim");
check_eval!(upt, (Search, pkg = "vim"), "upt search vim");
check_eval!(upt, (Show, pkg = "vim"), "upt show vim");
check_eval!(upt, UpdateIndex, "upt update");
check_eval!(upt, (UpgradeAll, yes = false), "upt upgrade");
check_eval!(upt, ListInstalled, "upt list -i");
check_eval!(upt, ListUpgradable, "upt list -u");
} | rust_cleaned_test_functions.jsonl/37067 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 319
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21296,
368,
341,
286,
1077,
34335,
284,
34335,
486,
2327,
543,
286,
1779,
21296,
10297,
7564,
11,
320,
24690,
11,
330,
41194,
497,
895,
701,
330,
7564,
4582,
36157,
797,
286,
1779,
21296,
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_resume_asm_2_interpreter() {
resume_asm_2_interpreter(VERSION1, 8126917);
resume_asm_2_interpreter(VERSION0, 8126917);
} | rust_cleaned_test_functions.jsonl/82893 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 72
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58132,
67529,
62,
17,
15318,
28637,
368,
341,
262,
15688,
67529,
62,
17,
15318,
28637,
7,
17636,
16,
11,
220,
23,
16,
17,
21,
24,
16,
22,
317,
262,
15688,
67529,
62,
17,
15318,
28637,
7,
176... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_y_0() {
test_add(
TimeGranularity::Years,
0,
"2000-01-01T00:00:00.000",
"2000-01-01T00:00:00.000",
);
} | rust_cleaned_test_functions.jsonl/134021 | {
"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,
2891,
4178,
62,
15,
368,
341,
286,
1273,
2891,
1006,
310,
4120,
90723,
28979,
486,
54419,
345,
310,
220,
15,
345,
310,
330,
17,
15,
15,
15,
12,
15,
16,
12,
15,
16,
51,
15,
15,
25,
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_intraday_dealts_400_failed() {
let it = crawler::IntradayBuilder::default().build();
assert_err!(it.dealts("").call(), Err(FugleError::General(_)));
} | rust_cleaned_test_functions.jsonl/49448 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 75
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
47026,
352,
2259,
278,
2576,
62,
19,
15,
15,
35060,
368,
341,
262,
1077,
432,
284,
73094,
486,
641,
47026,
352,
3297,
486,
2258,
1005,
5834,
543,
262,
2060,
9266,
10297,
275,
2285,
278,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_node_not_in_tree() {
let tests = [(3u32, 2u32), (13, 7)];
for test in tests.iter() {
assert_eq!(
node_in_tree(test.0.into(), test.1.into()),
Err(TreeMathError::NodeNotInTree)
);
}
} | rust_cleaned_test_functions.jsonl/98697 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 140
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5084,
7913,
1243,
11663,
368,
341,
262,
1077,
7032,
284,
17826,
18,
84,
18,
17,
11,
220,
17,
84,
18,
17,
701,
320,
16,
18,
11,
220,
22,
12587,
262,
369,
1273,
304,
7032,
19471,
368,
341,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_system_path() {
std::env::set_var(
"PATH",
format!(
"{}:/usr/bin:/bin",
shim_dir().to_string_lossy()
),
);
let expected_path = String::from("/usr/bin:/bin");
assert_eq!(System::path().unwrap().into_string().unwrap(), expected_path);
} | rust_cleaned_test_functions.jsonl/132773 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17687,
2638,
368,
341,
286,
1460,
486,
3160,
486,
746,
4612,
1006,
310,
330,
13593,
756,
310,
3561,
33673,
394,
35503,
14375,
7063,
8749,
14375,
6863,
756,
394,
62132,
4334,
1005,
983,
3904,
11193... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_subscribers() {
let era: EraIndex = 100;
let epoch: EpochIndex = 20;
// Define Subscribers
let mut subscribers = Subscribers::with_era_and_epoch(era, epoch);
assert_eq!(subscribers.current_era(), 100);
assert_eq!(subscribers.current_epoch(), 20);
// Subscribe
let account =
AccountId32::from_str("DSov56qpKEc32ZjhCN1qTPmTYW3tM65wmsXVkrrtXV3ywpV").unwrap();
subscribers.subscribe(account, "@subscriber:matrix.org".to_string());
assert_eq!(subscribers.get(None).is_some(), true);
assert_eq!(subscribers.get(Some(EpochKey(era, epoch))).is_some(), true);
assert_eq!(subscribers.get(Some(EpochKey(era, 30))).is_none(), true);
assert_eq!(
subscribers.get(Some(EpochKey(era, epoch))),
Some(&vec![(
AccountId32::from_str("DSov56qpKEc32ZjhCN1qTPmTYW3tM65wmsXVkrrtXV3ywpV").unwrap(),
"@subscriber:matrix.org".to_string()
)])
);
subscribers.start_new_epoch(era, epoch + 1);
assert_eq!(subscribers.current_era(), 100);
assert_eq!(subscribers.current_epoch(), 21);
} | rust_cleaned_test_functions.jsonl/54287 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 597
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5228,
46361,
368,
341,
286,
1077,
11385,
25,
47588,
1552,
284,
220,
16,
15,
15,
280,
286,
1077,
16342,
25,
87379,
1552,
284,
220,
17,
15,
401,
286,
442,
18614,
3719,
46361,
198,
286,
1077,
520... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rpc_estimate_fee_get_height() {
let bitcoind = create_bitcoind(vec![]);
let rpc = create_rpc(&bitcoind, DESCRIPTOR_PUB, Network::Regtest).unwrap();
let result = rpc.estimate_fee(2);
assert!(result.is_err());
let address = generate(&bitcoind, 100);
// create enough tx so that core give some fee estimation
for _ in 0..15 {
let _ = bitcoind.client.generate_to_address(1, &address).unwrap();
for _ in 0..2 {
send_to_address(&bitcoind, &address, 100_000);
}
}
let result = rpc.estimate_fee(2);
assert!(result.is_ok());
assert_eq!(rpc.get_height().unwrap(), 115);
} | rust_cleaned_test_functions.jsonl/108190 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 355
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60799,
78718,
34305,
3062,
9561,
368,
341,
286,
1077,
2699,
1015,
484,
284,
1855,
13996,
1015,
484,
25592,
0,
56703,
286,
1077,
35596,
284,
1855,
60799,
2099,
4489,
1015,
484,
11,
16089,
27210,
86... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_parse_complex_junk() {
let html = Html::parse_fragment(HTML_COMPLEX_JUNK_WITH_TABLES);
let div_id = "main_page";
let selector_str = format!("div#{}", div_id);
let selector = Selector::parse(&selector_str).unwrap();
let sub_tree = html.select(&selector).next().unwrap();
let table = Table::find_first_from_elem(&sub_tree).unwrap();
let mut table_iter = table.iter();
let row = table_iter.next().unwrap();
let mut iter = row.iter();
assert_eq!(Some("Cable Modem : DOCSIS 3.0 Compliant"), iter.next().map(String::as_str));
let row = table_iter.next().unwrap();
let mut iter = row.iter();
assert_eq!(Some("MAC Address : 40:B8:9A:DD:BF:D0"), iter.next().map(String::as_str));
let row = table_iter.next().unwrap();
let mut iter = row.iter();
assert_eq!(Some("Serial Number : BFD001A123456789"), iter.next().map(String::as_str));
} | rust_cleaned_test_functions.jsonl/47600 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 444
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
41522,
5374,
3122,
368,
341,
286,
1077,
5272,
284,
19200,
486,
6400,
43012,
7,
5835,
97820,
10598,
31883,
23929,
16039,
50,
626,
286,
1077,
3429,
842,
284,
330,
3817,
6129,
876,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_import_stalled_dataflow() {
// Runs the first dataflow to completion before constructing the subscriber.
timely::execute(timely::Configuration::Thread, move |worker| {
let mut input = InputSession::new();
let (mut trace, probe1) = worker.dataflow(|scope| {
let arranged =
input
.to_collection(scope)
.arrange_by_self();
(arranged.trace, arranged.stream.probe())
});
input.insert("Hello".to_owned());
input.advance_to(1);
input.flush();
worker.step_while(|| probe1.less_than(input.time()));
input.advance_to(2);
input.flush();
worker.step_while(|| probe1.less_than(input.time()));
let probe2 = worker.dataflow(|scope| {
trace.import(scope).stream.probe()
});
worker.step();
worker.step();
worker.step();
worker.step();
assert!(!probe2.less_than(input.time()));
}).expect("Timely computation failed");
} | rust_cleaned_test_functions.jsonl/130261 | {
"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,
18434,
1261,
4736,
1769,
4965,
368,
341,
262,
442,
49990,
279,
1156,
821,
4965,
311,
9755,
1573,
49353,
279,
32115,
624,
262,
31000,
486,
10257,
1155,
318,
974,
486,
7688,
486,
6855,
11,
3271,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_packet_resize() {
analog_logger::setup();
let recv_socket = UdpSocket::bind("127.0.0.1:0").expect("bind");
let addr = recv_socket.local_addr().unwrap();
let send_socket = UdpSocket::bind("127.0.0.1:0").expect("bind");
let mut p = Packets::default();
p.packets.resize(PACKETS_PER_BATCH, Packet::default());
// Should only get PACKETS_PER_BATCH packets per iteration even
for _ in 0..2 * PACKETS_PER_BATCH {
let mut p = Packets::default();
p.packets.resize(1, Packet::default());
for m in p.packets.iter_mut() {
m.meta.set_addr(&addr);
m.meta.size = 1;
}
send_to(&p, &send_socket, &SocketAddrSpace::Unspecified).unwrap();
}
let recvd = recv_from(&mut p, &recv_socket, 100).unwrap();
// Check we only got PACKETS_PER_BATCH packets
assert_eq!(recvd, PACKETS_PER_BATCH);
assert_eq!(p.packets.capacity(), PACKETS_PER_BATCH);
} | rust_cleaned_test_functions.jsonl/88890 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 519
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21078,
53370,
368,
341,
286,
23400,
27413,
486,
15188,
543,
286,
1077,
27006,
19555,
284,
547,
9796,
10286,
486,
7666,
445,
16,
17,
22,
13,
15,
13,
15,
13,
16,
25,
15,
1827,
17119,
445,
7666,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_simplify_null_and_false() {
let expr = binary_expr(lit_null(), Operator::And, lit(false));
let expr_eq = lit(false);
assert_eq!(simplify(&expr), expr_eq);
} | rust_cleaned_test_functions.jsonl/19686 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 97
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
70206,
15162,
8378,
36015,
368,
341,
286,
1077,
15169,
284,
7868,
21915,
2333,
275,
15162,
1507,
28498,
486,
3036,
11,
13020,
3576,
1106,
286,
1077,
15169,
10714,
284,
13020,
3576,
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 |
#[test]
fn test_chacha_true_values_a() {
// Test vectors 1 and 2 from
let seed = [0u8; 32];
let mut rng = ChaChaRng::from_seed(seed);
let mut results = [0u32; 16];
for i in results.iter_mut() { *i = rng.next_u32(); }
let expected = [0xade0b876, 0x903df1a0, 0xe56a5d40, 0x28bd8653,
0xb819d2bd, 0x1aed8da0, 0xccef36a8, 0xc70d778b,
0x7c5941da, 0x8d485751, 0x3fe02477, 0x374ad8b8,
0xf4b8436a, 0x1ca11815, 0x69b687c3, 0x8665eeb2];
assert_eq!(results, expected);
for i in results.iter_mut() { *i = rng.next_u32(); }
let expected = [0xbee7079f, 0x7a385155, 0x7c97ba98, 0x0d082d73,
0xa0290fcb, 0x6965e348, 0x3e53c612, 0xed7aee32,
0x7621b729, 0x434ee69c, 0xb03371d5, 0xd539d874,
0x281fed31, 0x45fb0a51, 0x1f0ae1ac, 0x6f4d794b];
assert_eq!(results, expected);
} | rust_cleaned_test_functions.jsonl/112999 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 623
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4138,
51576,
16082,
9146,
4306,
368,
341,
286,
442,
3393,
22879,
220,
16,
323,
220,
17,
504,
8945,
286,
1077,
10320,
284,
508,
15,
84,
23,
26,
220,
18,
17,
935,
286,
1077,
5206,
28422,
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... | 3 |
#[test]
fn test_bit_set_show() {
let mut s = BitSet::new();
s.insert(1);
s.insert(10);
s.insert(50);
s.insert(2);
assert_eq!("BitSet {1, 2, 10, 50}", format!("{:?}", s));
} | rust_cleaned_test_functions.jsonl/76220 | {
"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,
13996,
2602,
15267,
368,
341,
286,
1077,
5206,
274,
284,
57227,
486,
931,
543,
286,
274,
7030,
7,
16,
317,
286,
274,
7030,
7,
16,
15,
317,
286,
274,
7030,
7,
20,
15,
317,
286,
274,
7030,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serialize_overflow() {
let pubkey = Pubkey::new_rand();
let mut keyed_accounts = Vec::new();
let mut user_account = Account::default();
keyed_accounts.push(KeyedAccount::new(&pubkey, true, &mut user_account));
let ix = storage_instruction::advertise_recent_blockhash(
&pubkey,
Hash::default(),
ENTRIES_PER_SEGMENT,
);
assert_eq!(
process_instruction(&id(), &mut keyed_accounts, &ix.data, 42),
Err(InstructionError::InvalidAccountData)
);
} | rust_cleaned_test_functions.jsonl/127031 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 282
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
79073,
368,
341,
286,
1077,
95116,
284,
22611,
792,
486,
931,
33864,
543,
286,
1077,
5206,
90529,
55665,
284,
11312,
486,
931,
543,
286,
1077,
5206,
1196,
13500,
284,
8615,
486,
2258,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_batch_size_edge_limit() {
let msg_count = Arc::new(AtomicUsize::new(0));
let batch_msg_count = Arc::new(AtomicUsize::new(0));
let service = MockKvForRaft::new(Arc::clone(&msg_count), Arc::clone(&batch_msg_count), true);
let (mock_server, port) = create_mock_server(service, 60200, 60300).unwrap();
let mut raft_client = get_raft_client_by_port(port);
// Put them in buffer so sibling messages will be likely be batched during sending.
let mut msgs = Vec::with_capacity(5);
for _ in 0..5 {
let mut raft_m = RaftMessage::default();
// indexes and terms.
for _ in 0..38000 {
let mut e = Entry::default();
e.set_term(1);
e.set_index(256);
e.set_data(vec![b'a'; 130].into());
raft_m.mut_message().mut_entries().push(e);
}
msgs.push(raft_m);
}
for m in msgs {
raft_client.send(m).unwrap();
}
raft_client.flush();
check_msg_count(10000, &msg_count, 5);
// The final received message count should be 5 exactly.
drop(raft_client);
drop(mock_server);
assert_eq!(msg_count.load(Ordering::SeqCst), 5);
} | rust_cleaned_test_functions.jsonl/37842 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 551
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14534,
2368,
17932,
14763,
368,
341,
262,
1077,
3750,
3180,
284,
19689,
486,
931,
7,
65857,
52,
2141,
486,
931,
7,
15,
1106,
262,
1077,
7162,
6483,
3180,
284,
19689,
486,
931,
7,
65857,
52,
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... | 4 |
#[test]
fn test_serde_os2_panose() {
let p1 = OS2Panose {
family_type: 1,
serif_style: 2,
weight: 3,
proportion: 4,
contrast: 5,
stroke_variation: 6,
arm_style: 7,
letterform: 8,
midline: 9,
x_height: 10,
};
assert_tokens(
&p1,
&[
Token::Seq { len: Some(10) },
Token::U32(1),
Token::U32(2),
Token::U32(3),
Token::U32(4),
Token::U32(5),
Token::U32(6),
Token::U32(7),
Token::U32(8),
Token::U32(9),
Token::U32(10),
Token::SeqEnd,
],
);
} | rust_cleaned_test_functions.jsonl/126998 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 575
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75861,
450,
29387,
17,
71099,
960,
368,
341,
286,
1077,
281,
16,
284,
10085,
17,
35693,
960,
341,
310,
2997,
1819,
25,
220,
16,
345,
310,
89748,
15117,
25,
220,
17,
345,
310,
4680,
25,
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_8() {
assert_eq!(
parse_column_type(&mut Parser::new("decimal(18,4) unsigned zerofill")),
ColumnType::Decimal(NumericAttr {
maximum: Some(18),
decimal: Some(4),
unsigned: Some(true),
zero_fill: Some(true),
})
);
} | rust_cleaned_test_functions.jsonl/73837 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
23,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
8744,
1819,
2099,
6984,
21102,
486,
931,
445,
23289,
7,
16,
23,
11,
19,
8,
3774,
76178,
1055,
483,
30154,
310,
9332,
929,
486,
11269,
8204... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_jne_imm() {
test_interpreter_and_jit_asm!(
"
mov32 r0, 0
mov32 r1, 0xb
jne r1, 0xb, +4
mov32 r0, 1
mov32 r1, 0xa
jne r1, 0xb, +1
mov32 r0, 2
exit",
[],
(),
{ |_vm, res: Result| { res.unwrap() == 0x1 } },
7
);
} | rust_cleaned_test_functions.jsonl/59018 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 228
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5374,
811,
71370,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
6228,
286,
1974,
18,
17,
435,
15,
11,
220,
15,
198,
286,
1974,
18,
17,
435,
16,
11,
220,
15,
7929,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_begin_application_on_empty_storage_with_first_blocks() {
init_test_runtime();
// init empty context for test
let (chain_id, genesis_block_header, ..) =
init_test_protocol_context("test_begin_application_on_empty_storage_with_first_block");
// begin application for first block - level 1
let result = client::begin_application(BeginApplicationRequest {
chain_id: chain_id.clone(),
pred_header: genesis_block_header.clone(),
block_header: BlockHeader::from_bytes(
hex::decode(test_data::BLOCK_HEADER_LEVEL_1).unwrap(),
)
.unwrap(),
});
assert!(result.is_ok());
let result = client::begin_application(BeginApplicationRequest {
chain_id: chain_id.clone(),
pred_header: genesis_block_header.clone(),
block_header: BlockHeader::from_bytes(
hex::decode(test_data::BLOCK_HEADER_LEVEL_2).unwrap(),
)
.unwrap(),
});
assert!(result.is_err());
// apply second block - level 1 ok
let apply_block_result = client::apply_block(ApplyBlockRequest {
chain_id: chain_id.clone(),
block_header: BlockHeader::from_bytes(
hex::decode(test_data::BLOCK_HEADER_LEVEL_1).unwrap(),
)
.unwrap(),
pred_header: genesis_block_header,
operations: ApplyBlockRequest::convert_operations(test_data::block_operations_from_hex(
test_data::BLOCK_HEADER_HASH_LEVEL_1,
test_data::block_header_level1_operations(),
)),
max_operations_ttl: 0,
predecessor_block_metadata_hash: None,
predecessor_ops_metadata_hash: None,
});
assert!(apply_block_result.is_ok());
// begin application for second block - level 2 - now it should work on first level
let result = client::begin_application(BeginApplicationRequest {
chain_id,
pred_header: BlockHeader::from_bytes(hex::decode(test_data::BLOCK_HEADER_LEVEL_1).unwrap())
.unwrap(),
block_header: BlockHeader::from_bytes(
hex::decode(test_data::BLOCK_HEADER_LEVEL_2).unwrap(),
)
.unwrap(),
});
assert!(result.is_ok());
} | rust_cleaned_test_functions.jsonl/21216 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 941
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23338,
38721,
4470,
15124,
23310,
6615,
12978,
25201,
368,
341,
262,
2930,
4452,
33232,
1428,
262,
442,
2930,
4287,
2266,
369,
1273,
198,
262,
1077,
320,
8819,
842,
11,
59366,
7113,
8757,
11,
5241... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_div_rem_gaussian() {
// These would overflow with `norm_sqr` division.
let max = Complex::new(255u8, 255u8);
assert_eq!(max / 200, Complex::new(1, 1));
assert_eq!(max % 200, Complex::new(55, 55));
} | rust_cleaned_test_functions.jsonl/105720 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16237,
19194,
1889,
46972,
368,
341,
310,
442,
4220,
1035,
16484,
448,
1565,
20011,
643,
23004,
63,
12804,
624,
310,
1077,
1932,
284,
22096,
486,
931,
7,
17,
20,
20,
84,
23,
11,
220,
17,
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... | 1 |
#[test]
fn test_parse_css_border_2() {
assert_eq!(
parse_css_border("double"),
Ok(StyleBorderSide {
border_width: PixelValue::px(3.0),
border_style: BorderStyle::Double,
border_color: ColorU { r: 0, g: 0, b: 0, a: 255 },
})
);
} | rust_cleaned_test_functions.jsonl/37088 | {
"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,
21039,
25924,
31940,
62,
17,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
25924,
31940,
445,
4331,
4461,
310,
7622,
7,
2323,
10691,
16384,
341,
394,
3886,
7927,
25,
27469,
1130,
486,
1767,
7,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_linear_gradient_11() {
// wacky whitespace on purpose
assert_eq!(
parse_style_background_content(
"linear-gradient(to bottom,rgb(255,0, 0)0%, rgb( 0 , 255 , 0 ) 10% ,blue 100% )"
),
Ok(StyleBackgroundContent::LinearGradient(LinearGradient {
direction: Direction::FromTo(DirectionCorner::Top, DirectionCorner::Bottom),
extend_mode: ExtendMode::Clamp,
stops: vec![
GradientStopPre {
offset: Some(PercentageValue::new(0.0)),
color: ColorU {
r: 255,
g: 0,
b: 0,
a: 255
},
},
GradientStopPre {
offset: Some(PercentageValue::new(10.0)),
color: ColorU {
r: 0,
g: 255,
b: 0,
a: 255
},
},
GradientStopPre {
offset: Some(PercentageValue::new(100.0)),
color: ColorU {
r: 0,
g: 0,
b: 255,
a: 255
},
}
],
}))
);
} | rust_cleaned_test_functions.jsonl/114013 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1089
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
40674,
49482,
62,
16,
16,
368,
341,
286,
442,
289,
79957,
36372,
389,
7428,
198,
286,
2060,
10714,
33673,
310,
4715,
15117,
24103,
7495,
1006,
394,
330,
22763,
42738,
12186,
5622,
11,
16509... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rwlock_kill_downgrader() {
rwlock_kill_helper(Downgrade, Read);
rwlock_kill_helper(Read, Downgrade);
rwlock_kill_helper(Downgrade, Write);
rwlock_kill_helper(Write, Downgrade);
rwlock_kill_helper(DowngradeRead, Read);
rwlock_kill_helper(Read, DowngradeRead);
rwlock_kill_helper(DowngradeRead, Write);
rwlock_kill_helper(Write, DowngradeRead);
rwlock_kill_helper(DowngradeRead, Downgrade);
rwlock_kill_helper(DowngradeRead, Downgrade);
rwlock_kill_helper(Downgrade, DowngradeRead);
rwlock_kill_helper(Downgrade, DowngradeRead);
} | rust_cleaned_test_functions.jsonl/20120 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 305
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
98850,
73327,
13998,
901,
998,
368,
341,
286,
25991,
1023,
73327,
10418,
7,
4454,
6937,
11,
4457,
317,
286,
25991,
1023,
73327,
10418,
7,
4418,
11,
6285,
6937,
317,
286,
25991,
1023,
73327,
10418,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_valid_block_invalid_blockhash_for_member() {
let block = Some(Block::new(hex::decode(BLOCK).unwrap()));
let state = Member::for_test().candidate_block(block.clone()).build();
let blockhash = SHA256Hash::from_slice(&hex::decode(INVALID_HASH).unwrap()[..]).unwrap();
assert!(get_valid_block(&state, blockhash).is_err());
} | rust_cleaned_test_functions.jsonl/75391 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
8337,
7113,
31433,
7113,
8296,
5478,
19388,
368,
341,
286,
1077,
2504,
284,
4329,
55243,
486,
931,
44660,
486,
18196,
5349,
8044,
568,
15454,
7392,
286,
1077,
1584,
284,
12039,
486,
1958,
44... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_fields() {
let (at, mut ucmd) = testing(UTIL_NAME);
let result = ucmd.args(&["-d", ":", "-f", "1,3", INPUT]).run();
assert_eq!(result.stdout, at.read("lists_multiple_fields.expected"));
} | rust_cleaned_test_functions.jsonl/77649 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45233,
12132,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
7497,
7,
36969,
4708,
317,
262,
1077,
1102,
284,
575,
8710,
16365,
2099,
1183,
12,
67,
497,
330,
12147,
6523,
69,
497,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_set_net_device() {
let mut vm_resources = default_vm_resources();
// Clone the existing net config in order to obtain a new one.
let mut new_net_device_cfg = default_net_cfg();
new_net_device_cfg.iface_id = "new_net_if".to_string();
new_net_device_cfg.guest_mac = Some(MacAddr::parse_str("01:23:45:67:89:0c").unwrap());
new_net_device_cfg.host_dev_name = "dummy_path2".to_string();
assert_eq!(vm_resources.net_builder.len(), 1);
vm_resources.build_net_device(new_net_device_cfg).unwrap();
assert_eq!(vm_resources.net_builder.len(), 2);
} | rust_cleaned_test_functions.jsonl/5459 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 283
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
19722,
9204,
368,
341,
286,
1077,
5206,
10995,
35569,
284,
1638,
39008,
35569,
1428,
286,
442,
27913,
279,
6350,
4179,
2193,
304,
1973,
311,
6851,
264,
501,
825,
624,
286,
1077,
5206,
501,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mld_parse_and_serialize_done() {
use crate::icmp::mld::MulticastListenerDone;
use crate::testdata::mld_router_done::*;
test_parse_and_serialize::<MulticastListenerDone, _, _>(
SRC_IP,
DST_IP,
DONE,
|ip| {
check_ip(ip, SRC_IP, DST_IP);
},
|icmp| {
check_icmp(icmp, 0, HOST_GROUP_ADDRESS);
},
);
} | rust_cleaned_test_functions.jsonl/82323 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 291
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
507,
21039,
8378,
88686,
24390,
368,
341,
286,
990,
17717,
486,
50774,
486,
76,
507,
486,
40404,
35446,
2743,
17453,
280,
286,
990,
17717,
486,
92425,
486,
76,
507,
55587,
24390,
56162,
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_null_json_equal() {
// Test equaled array
let arrow_array = NullArray::new(4);
let json_array: Value = serde_json::from_str(
r#"
[
null, null, null, null
]
"#,
)
.unwrap();
assert!(arrow_array.eq(&json_array));
assert!(json_array.eq(&arrow_array));
// Test unequaled array
let arrow_array = NullArray::new(2);
let json_array: Value = serde_json::from_str(
r#"
[
null, null, null
]
"#,
)
.unwrap();
assert!(arrow_array.ne(&json_array));
assert!(json_array.ne(&arrow_array));
} | rust_cleaned_test_functions.jsonl/901 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 412
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15162,
9455,
11478,
368,
341,
286,
442,
3393,
3232,
5838,
1334,
198,
286,
1077,
17921,
3858,
284,
18084,
1857,
486,
931,
7,
19,
317,
286,
1077,
2951,
3858,
25,
5162,
284,
61570,
9455,
486,
1499,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_regex_literal_continue_character_class() {
// character class as second char
assert_parse_success!(
regex_literal,
"/a[ab]/",
RegExpLiteral {
pattern: "a[ab]".to_string(),
flags: String::new(),
}
);
} | rust_cleaned_test_functions.jsonl/66460 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41832,
34100,
75297,
40988,
4790,
368,
341,
262,
442,
3668,
536,
438,
2086,
1161,
198,
262,
2060,
21039,
18632,
33673,
286,
20180,
34100,
345,
286,
3521,
64,
58,
370,
9769,
756,
286,
28487,
17350,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_flac_reader_tags_skips_empty_vorbis_comments() {
// This file has been prepared to contain one empty Vorbis comment; a string
let flac_reader = claxon::FlacReader::open("testsamples/empty_vorbis_comment.flac").unwrap();
// length prefix to make the final tag `X=Y`.
let mut tags = flac_reader.tags();
assert_eq!(tags.next(), Some(("FOO", "bar")));
assert_eq!(tags.next(), Some(("X", "Y")));
assert_eq!(tags.next(), None);
} | rust_cleaned_test_functions.jsonl/39105 | {
"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,
5081,
580,
22306,
16333,
33811,
3077,
15124,
2273,
29886,
285,
30359,
368,
341,
262,
442,
1096,
1034,
702,
1012,
10030,
311,
6644,
825,
4287,
647,
29886,
285,
3980,
26,
264,
914,
7213,
80719,
4169... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_circle_inter() {
let c = Circle {
center: [15.0, 15.0].into(),
radius: 6.0,
};
let mut g: DenseShapeGrid<(), Circle> = DenseShapeGrid::new(10);
let a = g.insert(c, ());
assert_eq!(
g.query(Circle {
center: [5.0, 5.0].into(),
radius: 6.0,
})
.count(),
0
);
assert_eq!(
g.query(Circle {
center: [5.0, 5.0].into(),
radius: 10.0,
})
.next()
.map(|x| x.0),
Some(a)
);
} | rust_cleaned_test_functions.jsonl/32134 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 456
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42222,
15318,
368,
972,
286,
1077,
272,
284,
21224,
972,
310,
4126,
25,
508,
16,
20,
13,
15,
11,
220,
16,
20,
13,
15,
936,
18122,
24853,
310,
10578,
25,
220,
21,
13,
15,
1871,
286,
16511,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_build_parsed_datetime_time() {
run_test_build_parsed_datetime_time(
"3:4:5.6",
ParsedDateTime {
hour: Some(DateTimeFieldValue::new(3, 0)),
minute: Some(DateTimeFieldValue::new(4, 0)),
second: Some(DateTimeFieldValue::new(5, 600_000_000)),
..Default::default()
},
);
run_test_build_parsed_datetime_time(
"3:4",
ParsedDateTime {
hour: Some(DateTimeFieldValue::new(3, 0)),
minute: Some(DateTimeFieldValue::new(4, 0)),
..Default::default()
},
);
run_test_build_parsed_datetime_time(
"3:4.5",
ParsedDateTime {
minute: Some(DateTimeFieldValue::new(3, 0)),
second: Some(DateTimeFieldValue::new(4, 500_000_000)),
..Default::default()
},
);
run_test_build_parsed_datetime_time(
"0::4.5",
ParsedDateTime {
hour: Some(DateTimeFieldValue::new(0, 0)),
second: Some(DateTimeFieldValue::new(4, 500_000_000)),
..Default::default()
},
);
run_test_build_parsed_datetime_time(
"0::.5",
ParsedDateTime {
hour: Some(DateTimeFieldValue::new(0, 0)),
second: Some(DateTimeFieldValue::new(0, 500_000_000)),
..Default::default()
},
);
fn run_test_build_parsed_datetime_time(test: &str, res: ParsedDateTime) {
assert_eq!(
ParsedDateTime::build_parsed_datetime_time(test).unwrap(),
res
);
}
} | rust_cleaned_test_functions.jsonl/100331 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1027
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20801,
75788,
28943,
3009,
368,
341,
286,
1598,
4452,
20801,
75788,
28943,
3009,
1006,
310,
330,
18,
25,
19,
25,
20,
13,
21,
756,
310,
393,
18112,
7689,
341,
394,
6460,
25,
4329,
32083,
52112,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pop_head() {
let mut ll = LinkedList::<u8>::new();
let node = ll.push_head(11);
assert_node!(ll, node, ONLY, 11, 1);
//now pop the head
assert_eq!(ll.pop_head(), Some(11));
assert_empty!(ll);
//now push two nodes
let node = ll.push_head(11);
ll.push_head(12);
//now pop the head
assert_eq!(ll.len(), 2);
assert_eq!(ll.pop_head(), Some(12));
assert_node!(ll, node, ONLY, 11, 1);
//now pop the head again
assert_eq!(ll.pop_head(), Some(11));
assert_empty!(ll);
//now push 3 nodes node
let node = ll.push_head(11);
let second = ll.push_head(12);
ll.push_head(13);
assert_eq!(ll.len(), 3);
//pop the head
assert_eq!(ll.pop_head(), Some(13));
assert_node!(ll, node, LAST, 11, 2);
assert_node!(ll, second, FIRST, 12, 2);
//pop the head again
assert_eq!(ll.pop_head(), Some(12));
assert_node!(ll, node, ONLY, 11, 1);
//pop the head for the last time
assert_eq!(ll.pop_head(), Some(11));
assert_empty!(ll);
} | rust_cleaned_test_functions.jsonl/59884 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 599
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17061,
13138,
368,
341,
286,
1077,
5206,
9323,
284,
22917,
27638,
84,
23,
6831,
931,
543,
286,
1077,
2436,
284,
9323,
2552,
13138,
7,
16,
16,
317,
286,
2060,
5084,
10297,
654,
11,
2436,
11,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_part_two() {
let mut crab_cups = CrabCups::from_str(&INPUT, 1_000_000);
crab_cups.make_moves(10_000_000);
assert_eq!(
149245887792,
crab_cups.get_cup_product_two_clockwise_of_one(),
);
} | rust_cleaned_test_functions.jsonl/73801 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 152
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10495,
23241,
368,
341,
286,
1077,
5206,
59412,
666,
8602,
284,
74104,
34,
8602,
486,
1499,
2895,
2099,
29421,
11,
220,
16,
62,
15,
15,
15,
62,
15,
15,
15,
626,
286,
59412,
666,
8602,
10117,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_negative_active_destory() {
run_e2e_client_test(4, |mut client| {
let resp = client
.create_symmetric_key(CryptographicAlgorithm::AES, 128)
.unwrap();
let get = client.get(&resp.unique_identifier).unwrap();
assert_eq! {get.object_type, ObjectTypeEnum::SymmetricKey};
let _activate = client.activate(&resp.unique_identifier).unwrap();
let destroy = client.destroy(&resp.unique_identifier);
assert!(destroy.is_err());
});
} | rust_cleaned_test_functions.jsonl/56506 | {
"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,
53865,
12930,
25264,
679,
368,
341,
286,
1598,
2204,
17,
68,
8179,
4452,
7,
19,
11,
760,
6984,
2943,
91,
341,
310,
1077,
9039,
284,
2943,
198,
394,
659,
3182,
26825,
15903,
3097,
3025,
3571,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_colinear_4() {
// The path goes back and forth along a line.
let mut builder = Path::builder();
builder.begin(point(0.0, 2.0));
builder.line_to(point(0.0, 1.0));
builder.line_to(point(0.0, 3.0));
builder.line_to(point(0.0, 0.0));
builder.end(true);
let path = builder.build();
test_path(path.as_slice());
} | rust_cleaned_test_functions.jsonl/102421 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 163
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10211,
88921,
62,
19,
368,
341,
262,
442,
576,
1815,
5780,
1182,
323,
13241,
3156,
264,
1555,
624,
262,
1077,
5206,
7363,
284,
7933,
486,
17850,
543,
262,
7363,
6848,
20235,
7,
15,
13,
15,
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_export() {
let name = "sgx_data_test";
let reference = r#"
{
"mrEnclave" : ["123"],
"mrSigner" : ["123"],
"productId" : 1,
"svn" : 2
}
"#;
set_reference(name, reference)
.map_err(|e| {
error!("set_reference error: {}", e);
assert_eq!(true, false);
}).unwrap();
let result = export(name).unwrap();
let expected = r#"
{
"mrEnclave" : ["123"],
"mrSigner" : ["123"],
"productId" : 1,
"svn" : 2
}
"#;
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/84004 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 430
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27114,
368,
341,
286,
1077,
829,
284,
330,
1991,
87,
1769,
4452,
876,
286,
1077,
5785,
284,
435,
2,
698,
286,
341,
310,
330,
20946,
1702,
40533,
1,
549,
4383,
16,
17,
18,
8097,
310,
330,
209... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_var_uint_two_bytes_max_value() {
let var_uint =
VarUInt::read(&mut Cursor::new(&[0b0111_1111, 0b1111_1111])).expect(ERROR_MESSAGE);
assert_eq!(var_uint.size_in_bytes(), 2);
assert_eq!(var_uint.value(), 16_383);
} | rust_cleaned_test_functions.jsonl/116130 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
4612,
15807,
23241,
12524,
6345,
3142,
368,
341,
286,
1077,
762,
15807,
4035,
310,
8735,
18777,
486,
878,
2099,
6984,
28067,
486,
931,
2099,
58,
15,
65,
15,
16,
16,
16,
62,
16,
16,
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_transitive() {
check(
r#"
//- /level3.rs new_source_root:local crate:level3
pub struct Fo$0o;
//- /level2.rs new_source_root:local crate:level2 deps:level3
pub use level3::Foo;
//- /level1.rs new_source_root:local crate:level1 deps:level2
pub use level2::Foo;
//- /level0.rs new_source_root:local crate:level0 deps:level1
pub use level1::Foo;
"#,
expect![[r#"
Foo Struct FileId(0) 0..15 11..14
FileId(1) 16..19
FileId(2) 16..19
FileId(3) 16..19
"#]],
);
} | rust_cleaned_test_functions.jsonl/60679 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 321
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7965,
3404,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
61463,
608,
3294,
18,
25638,
501,
10347,
12993,
25,
2438,
17717,
25,
3294,
18,
198,
9585,
2036,
31657,
3,
15,
78,
280,
61463,
608,
3294... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_write_implicit() {
#[cfg(feature = "const-generics")]
assert_writes::<Implicit<bool, 2>>(&[
(Implicit::new(true), b"\x82\x01\xff"),
(Implicit::new(false), b"\x82\x01\x00"),
]);
assert_eq!(
write(|w| { w.write_optional_implicit_element(&Some(true), 2) }),
b"\x82\x01\xff"
);
assert_eq!(
write(|w| { w.write_optional_explicit_element::<u8>(&None, 2) }),
b""
);
assert_eq!(
write(|w| {
w.write_optional_implicit_element(&Some(SequenceWriter::new(&|_w| {})), 2)
}),
b"\xa2\x00"
);
assert_eq!(
write(|w| { w.write_optional_explicit_element::<SequenceWriter>(&None, 2) }),
b""
);
} | rust_cleaned_test_functions.jsonl/129902 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 495
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
62,
30940,
368,
341,
286,
11506,
14072,
27062,
284,
330,
1024,
2371,
798,
1211,
5422,
286,
2060,
1670,
23262,
27638,
59558,
17028,
11,
220,
17,
2452,
2099,
9640,
310,
320,
59558,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rsa_encrypt() {
let big_a = BigUint::parse_bytes(b"188394207298085200331335318886080117835", 10).unwrap();
let big_b = BigUint::parse_bytes(b"65537", 10).unwrap();
let big_c = BigUint::parse_bytes(b"313451135729381938245427493117266465994", 10).unwrap();
let res = rsa_encrypt(&big_a, &big_b, &big_c);
assert_eq!(BigUint::parse_bytes(b"140863285186154755267136119549725662143", 10).unwrap(),
res);
} | rust_cleaned_test_functions.jsonl/43389 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 244
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82522,
66593,
368,
341,
286,
1077,
2409,
4306,
284,
6164,
21570,
486,
6400,
12524,
1883,
1,
16,
23,
23,
18,
24,
19,
17,
15,
22,
17,
24,
23,
15,
23,
20,
17,
15,
15,
18,
18,
16,
18,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vote_double_lockout_after_expiration() {
let voter_pubkey = solana_sdk::pubkey::new_rand();
let mut vote_state = VoteState::new_for_test(&voter_pubkey);
for i in 0..3 {
vote_state.process_slot_vote_unchecked(i as u64);
}
check_lockouts(&vote_state);
// doubled in lockout
vote_state.process_slot_vote_unchecked((2 + INITIAL_LOCKOUT + 1) as u64);
check_lockouts(&vote_state);
// double for everybody
vote_state.process_slot_vote_unchecked((2 + INITIAL_LOCKOUT + 2) as u64);
check_lockouts(&vote_state);
// double for everybody
vote_state.process_slot_vote_unchecked((2 + INITIAL_LOCKOUT + 3) as u64);
check_lockouts(&vote_state);
} | rust_cleaned_test_functions.jsonl/6087 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 390
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54360,
24598,
9818,
411,
19844,
2702,
28479,
368,
341,
286,
1077,
25323,
34014,
792,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
5206,
6910,
4387,
284,
34034,
1397,
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... | 2 |
#[test]
fn test_00() {
let foo = Just(2);
match foo {
Just(i) => assert_eq!(i, 2),
Nothing => {}
}
} | rust_cleaned_test_functions.jsonl/115368 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
15,
15,
368,
341,
286,
1077,
15229,
284,
4599,
7,
17,
317,
286,
2432,
15229,
341,
310,
4599,
1956,
8,
589,
2060,
10714,
10297,
72,
11,
220,
17,
1326,
310,
12064,
589,
5613,
286,
456,
262... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
#[test]
fn test_neverproducestickets_does_nothing() {
let npt = NeverProducesTickets {};
assert_eq!(false, npt.enabled());
assert_eq!(0, npt.get_lifetime());
assert_eq!(None, npt.encrypt(&[]));
assert_eq!(None, npt.decrypt(&[]));
} | rust_cleaned_test_functions.jsonl/8736 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13925,
423,
8555,
15184,
17480,
96374,
6536,
1596,
368,
341,
286,
1077,
308,
417,
284,
14695,
49112,
55321,
9321,
286,
2060,
10714,
10297,
3849,
11,
308,
417,
22141,
1423,
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_vec_list_push_front() {
let mut list = VecList::new();
list.push_front(0);
assert_eq!(list.front(), Some(&0));
list.push_front(1);
assert_eq!(list.front(), Some(&1));
list.push_front(2);
assert_eq!(list.front(), Some(&2));
} | rust_cleaned_test_functions.jsonl/11547 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
2019,
14218,
22926,
368,
341,
286,
1077,
5206,
1140,
284,
11312,
852,
486,
931,
543,
286,
1140,
2552,
22926,
7,
15,
317,
286,
2060,
10714,
10297,
1607,
23445,
1507,
4329,
2099,
15,
1106,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pass_rust_str() {
// passing by value is the only legal option
let cxx = indoc! {"
uint32_t measure_string(rust::Str z) {
return std::string(z).length();
}
"};
let hdr = indoc! {"
#include <cstdint>
#include <cxx.h>
uint32_t measure_string(rust::Str z);
"};
let rs = quote! {
let c = ffi::measure_string("hello");
assert_eq!(c, 5);
};
run_test(cxx, hdr, rs, &["measure_string"], &[]);
} | rust_cleaned_test_functions.jsonl/9782 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 255
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15464,
1710,
590,
2895,
368,
341,
262,
442,
12299,
553,
897,
374,
279,
1172,
5777,
2999,
198,
262,
1077,
272,
4146,
284,
1257,
509,
0,
314,
698,
286,
2622,
18,
17,
528,
6629,
3904,
2601,
590,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.