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_hello() {
let test: Vec<u8> = vec![72, 101, 108, 108, 111];
let convert = string_to_cp437("Hello");
assert_eq!(test, convert);
} | rust_cleaned_test_functions.jsonl/1073 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 89
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
96724,
368,
341,
286,
1077,
1273,
25,
11312,
34837,
23,
29,
284,
7486,
20703,
22,
17,
11,
220,
16,
15,
16,
11,
220,
16,
15,
23,
11,
220,
16,
15,
23,
11,
220,
16,
16,
16,
935,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_convert_key2() {
let secret: [u8; 32] = [
0x4d,0x5d,0xb4,0x10,0x7d,0x23,0x7d,0xf6,0xa3,0xd5,0x8e,0xe5,0xf7,
0x0a,0xe6,0x3d,0x73,0xd7,0x65,0x8d,0x40,0x26,0xf2,0xee,0xfd,0x2f,
0x20,0x4c,0x81,0x68,0x2c,0xb7
];
let expected: &[u8] = &[
0x04,0x3f,0xa8,0xc0,0x8c,0x65,0xa8,0x3f,0x6b,0x4e,0xa3,0xe0,0x4e,
0x1c,0xc7,0x0c,0xbe,0x3c,0xd3,0x91,0x49,0x9e,0x3e,0x05,0xab,0x7d,
0xed,0xf2,0x8a,0xff,0x9a,0xfc,0x53,0x82,0x00,0xff,0x93,0xe3,0xf2,
0xb2,0xcb,0x50,0x29,0xf0,0x3c,0x7e,0xbe,0xe8,0x20,0xd6,0x3a,0x4c,
0x5a,0x95,0x41,0xc8,0x3a,0xce,0xbe,0x29,0x3f,0x54,0xca,0xcf,0x0e
];
let seckey = SecretKey::parse(&secret).unwrap();
let pubkey = PublicKey::from_secret_key(&seckey);
assert_eq!(expected, &pubkey.serialize()[..]);
let pubkey_compressed = PublicKey::parse_compressed(&pubkey.serialize_compressed()).unwrap();
assert_eq!(expected, &pubkey_compressed.serialize()[..]);
} | rust_cleaned_test_functions.jsonl/129812 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 639
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
3097,
17,
368,
341,
262,
1077,
6234,
25,
508,
84,
23,
26,
220,
18,
17,
60,
284,
2278,
286,
220,
15,
87,
19,
67,
11,
15,
87,
20,
67,
11,
15,
7929,
19,
11,
15,
87,
16,
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... | 1 |
#[test]
fn test_listen_syn_win_scale_buffers() {
for (buffer_size, shift_amt) in &[
(64, 0),
(128, 0),
(1024, 0),
(65535, 0),
(65536, 1),
(65537, 1),
(131071, 1),
(131072, 2),
(524287, 3),
(524288, 4),
(655350, 4),
(1048576, 5),
] {
let mut s = socket_with_buffer_sizes(64, *buffer_size);
s.state = State::Listen;
s.local_endpoint = IpEndpoint::new(IpAddress::default(), LOCAL_PORT);
assert_eq!(s.remote_win_shift, *shift_amt);
send!(s, TcpRepr {
control: TcpControl::Syn,
seq_number: REMOTE_SEQ,
ack_number: None,
window_scale: Some(0),
..SEND_TEMPL
});
assert_eq!(s.remote_win_shift, *shift_amt);
recv!(s, [TcpRepr {
control: TcpControl::Syn,
seq_number: LOCAL_SEQ,
ack_number: Some(REMOTE_SEQ + 1),
max_seg_size: Some(BASE_MSS),
window_scale: Some(*shift_amt),
window_len: cmp::min(*buffer_size >> *shift_amt, 65535) as u16,
..RECV_TEMPL
}]);
}
} | rust_cleaned_test_functions.jsonl/91808 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 841
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
79286,
51393,
25672,
16727,
54591,
368,
341,
286,
369,
320,
7573,
2368,
11,
6407,
54605,
8,
304,
609,
9640,
310,
320,
21,
19,
11,
220,
15,
1326,
310,
320,
16,
17,
23,
11,
220,
15,
1326,
310,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_branch_create_by_base_branch() {
let hdr: VecxVs<String> = VecxVs::new();
pnk!(hdr.version_create(VersionName(b"manster0")));
let bn1 = BranchName(b"test1");
let vn11 = VersionName(b"testversion11");
pnk!(hdr.branch_create(bn1, vn11, false));
let value1 = String::from("testvalue1");
hdr.push(value1);
let bn2 = BranchName(b"test2");
let vn21 = VersionName(b"testversion21");
pnk!(hdr.branch_create_by_base_branch(bn2, vn21, ParentBranchName(b"test1"), false));
let value2 = String::from("testvalue2");
hdr.push(value2);
} | rust_cleaned_test_functions.jsonl/92138 | {
"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,
28031,
8657,
3710,
7651,
28031,
368,
341,
262,
1077,
36615,
25,
11312,
87,
51737,
3464,
29,
284,
11312,
87,
51737,
486,
931,
543,
262,
43050,
74,
10297,
28785,
19484,
8657,
7,
5637,
675,
1883,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_no_init() {
let dir = tempfile::tempdir().unwrap();
assert!(!dir.path().join(".protovend.yml").exists());
let status = command(&dir)
.arg("add")
.arg("https://github.com/Skyscanner/protovend-test-protos.git")
.status()
.unwrap();
assert!(!status.success());
assert!(!dir.path().join(".protovend.yml").exists());
} | rust_cleaned_test_functions.jsonl/79894 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
6536,
6137,
368,
341,
262,
1077,
5419,
284,
54819,
486,
3888,
3741,
1005,
15454,
543,
262,
2060,
0,
3471,
3741,
3875,
1005,
5987,
5680,
4391,
859,
408,
33936,
1827,
16304,
5231,
262,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_slice_collapse_with_newaxis() {
let mut arr = Array2::<u8>::zeros((2, 3));
arr.slice_collapse(s![0, 0, NewAxis]);
} | rust_cleaned_test_functions.jsonl/92606 | {
"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,
26488,
666,
10786,
6615,
5921,
7184,
368,
341,
262,
1077,
5206,
2890,
284,
2910,
17,
27638,
84,
23,
6831,
35716,
1188,
17,
11,
220,
18,
1106,
262,
2890,
14530,
666,
10786,
1141,
20703,
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 |
#[test]
fn test_to_string() {
let v_1_0_0 = "1.0.0".parse::<Version>().unwrap();
let v_1_32_1 = "1.32.1".parse::<Version>().unwrap();
assert_eq!(v_1_0_0.to_string(), "1.0.0");
assert_eq!(v_1_32_1.to_string(), "1.32.1");
assert_eq!(format!("{:<8}", v_1_32_1), "1.32.1 ");
assert_eq!(format!("{:>8}", v_1_32_1), " 1.32.1");
} | rust_cleaned_test_functions.jsonl/36551 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 231
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
3904,
368,
341,
286,
1077,
348,
62,
16,
62,
15,
62,
15,
284,
330,
16,
13,
15,
13,
15,
3263,
6400,
27638,
5637,
10483,
15454,
543,
286,
1077,
348,
62,
16,
62,
18,
17,
62,
16,
284,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_non_empty() {
let a = Bump::new();
assert_eq!(set![&a; 5, 3, 9, 4], Set::<i32>::from(&a, vec![3, 4, 5, 9]));
} | rust_cleaned_test_functions.jsonl/40781 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 90
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21637,
15124,
368,
341,
286,
1077,
264,
284,
425,
1510,
486,
931,
543,
286,
2060,
10714,
10297,
746,
20703,
5,
64,
26,
220,
20,
11,
220,
18,
11,
220,
24,
11,
220,
19,
1125,
2573,
27638,
72,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_and_remove_hot_key() {
let p: PathBuf = ["tests", "neurons.csv"].iter().collect();
let mut builder = GovernanceCanisterInitPayloadBuilder::new();
let init_neurons = &mut builder.add_all_neurons_from_csv_file(&p).proto.neurons;
let (_, mut gov) =
governance_with_neurons(&init_neurons.values().cloned().collect::<Vec<Neuron>>());
let neuron = init_neurons[&25].clone();
let new_controller = init_neurons[&42].controller.unwrap();
assert!(!gov
.principal_to_neuron_ids_index
.get(&new_controller)
.unwrap()
.contains(&neuron.id.as_ref().unwrap().id));
// Add a hot key to the neuron and make sure that gets reflected in the
// principal to neuron ids index.
let result = gov
.manage_neuron(
neuron.controller.as_ref().unwrap(),
&ManageNeuron {
id: None,
neuron_id_or_subaccount: Some(NeuronIdOrSubaccount::NeuronId(
neuron.id.as_ref().unwrap().clone(),
)),
command: Some(manage_neuron::Command::Configure(
manage_neuron::Configure {
operation: Some(manage_neuron::configure::Operation::AddHotKey(
manage_neuron::AddHotKey {
new_hot_key: Some(new_controller),
},
)),
},
)),
},
)
.now_or_never()
.unwrap();
assert!(result.is_ok());
assert!(gov
.principal_to_neuron_ids_index
.get(&new_controller)
.unwrap()
.contains(&neuron.id.as_ref().unwrap().id));
// Remove a hot key from that neuron and make sure that gets reflected in
// the principal to neuron ids index.
let result = gov
.manage_neuron(
neuron.controller.as_ref().unwrap(),
&ManageNeuron {
id: None,
neuron_id_or_subaccount: Some(NeuronIdOrSubaccount::NeuronId(
neuron.id.as_ref().unwrap().clone(),
)),
command: Some(manage_neuron::Command::Configure(
manage_neuron::Configure {
operation: Some(manage_neuron::configure::Operation::RemoveHotKey(
manage_neuron::RemoveHotKey {
hot_key_to_remove: Some(new_controller),
},
)),
},
)),
},
)
.now_or_never()
.unwrap();
assert!(result.is_ok());
assert!(!gov
.principal_to_neuron_ids_index
.get(&new_controller)
.unwrap()
.contains(&neuron.id.as_ref().unwrap().id));
} | rust_cleaned_test_functions.jsonl/1166 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1540
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
8378,
18193,
33433,
3097,
368,
341,
262,
1077,
281,
25,
7933,
15064,
284,
4383,
23841,
497,
330,
811,
53669,
11219,
5521,
2015,
1005,
17384,
543,
262,
1077,
5206,
7363,
284,
80589,
6713,
157... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_driver_write_wrapping() {
// Test the index can be wrapped around when the iteration count exceeds 16bits.
let queue_size = 256;
let iteration = u32::from(u16::MAX) + 20;
drv_to_dev(queue_size, iteration);
} | rust_cleaned_test_functions.jsonl/115916 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 111
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20602,
9165,
44074,
3629,
368,
341,
286,
442,
3393,
279,
1922,
646,
387,
19472,
2163,
979,
279,
19569,
1760,
35275,
220,
16,
21,
11516,
624,
286,
1077,
7177,
2368,
284,
220,
17,
20,
21,
401,
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_0297_example_1() {
let root = tree![1, 2, 3, null, null, 4, 5];
let codec = Codec::new();
let data = codec.serialize(root.clone());
let result = codec.deserialize(data);
assert_eq!(root, result);
} | rust_cleaned_test_functions.jsonl/114938 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
15,
17,
24,
22,
39304,
62,
16,
368,
341,
286,
1077,
3704,
284,
4916,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
845,
11,
845,
11,
220,
19,
11,
220,
20,
935,
286,
1077,
34647,
284,
6707... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sync_channel_rendezvous() {
let c = MainContext::new();
let l = MainLoop::new(Some(&c), false);
c.acquire();
let (sender, receiver) = MainContext::sync_channel(Priority::default(), 0);
let (wait_sender, wait_receiver) = mpsc::channel();
let thread = thread::spawn(move || {
wait_sender.send(()).unwrap();
sender.send(1).unwrap();
wait_sender.send(()).unwrap();
sender.send(2).unwrap();
wait_sender.send(()).unwrap();
sender.send(3).unwrap();
wait_sender.send(()).unwrap();
});
// during that time it must not have proceeded yet to send the
// second item because we did not yet receive the first item.
assert!(wait_receiver.recv().is_ok());
assert_eq!(
wait_receiver.recv_timeout(time::Duration::from_millis(50)),
Err(mpsc::RecvTimeoutError::Timeout)
);
let sum = Rc::new(RefCell::new(0));
let sum_clone = sum.clone();
let l_clone = l.clone();
receiver.attach(Some(&c), move |item| {
// We consumed one item so there should be one item on
// the other receiver now.
assert!(wait_receiver.recv().is_ok());
*sum_clone.borrow_mut() += item;
if *sum_clone.borrow() == 6 {
// other item available yet
assert_eq!(
wait_receiver.recv_timeout(time::Duration::from_millis(50)),
Err(mpsc::RecvTimeoutError::Disconnected)
);
l_clone.quit();
Continue(false)
} else {
// other item available yet
assert_eq!(
wait_receiver.recv_timeout(time::Duration::from_millis(50)),
Err(mpsc::RecvTimeoutError::Timeout)
);
Continue(true)
}
});
l.run();
thread.join().unwrap();
assert_eq!(*sum.borrow(), 6);
} | rust_cleaned_test_functions.jsonl/5026 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23008,
14571,
1288,
303,
10125,
57445,
368,
341,
286,
1077,
272,
284,
4697,
1972,
486,
931,
543,
286,
1077,
326,
284,
4697,
14620,
486,
931,
65405,
2099,
66,
701,
895,
626,
286,
272,
69627,
1428... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_program_bpf_loader_deprecated() {
solana_logger::setup();
let mut programs = Vec::new();
#[cfg(feature = "bpf_c")]
{
programs.extend_from_slice(&[("deprecated_loader")]);
}
#[cfg(feature = "bpf_rust")]
{
programs.extend_from_slice(&[("solana_bpf_rust_deprecated_loader")]);
}
for program in programs.iter() {
println!("Test program: {:?}", program);
let GenesisConfigInfo {
genesis_config,
mint_keypair,
..
} = create_genesis_config(50);
let mut bank = Bank::new_for_tests(&genesis_config);
let (name, id, entrypoint) = solana_bpf_loader_deprecated_program!();
bank.add_builtin(&name, &id, entrypoint);
let bank_client = BankClient::new(bank);
let program_id = load_bpf_program(
&bank_client,
&bpf_loader_deprecated::id(),
&mint_keypair,
program,
);
let account_metas = vec![AccountMeta::new(mint_keypair.pubkey(), true)];
let instruction = Instruction::new_with_bytes(program_id, &[1], account_metas);
let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction);
assert!(result.is_ok());
}
} | rust_cleaned_test_functions.jsonl/5737 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 593
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25096,
880,
15897,
22139,
2259,
19889,
368,
341,
262,
2048,
3362,
27413,
486,
15188,
1428,
262,
1077,
5206,
7468,
284,
11312,
486,
931,
543,
262,
11506,
14072,
27062,
284,
330,
65,
15897,
666,
542... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_two_255() {
let two_254 = Z25519 {
value: U256 {
limbs: [0, 0, 0, 0x4000000000000000],
},
};
assert_eq!(two_254 * Z25519::from(2), 19.into());
} | rust_cleaned_test_functions.jsonl/64950 | {
"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,
23241,
62,
17,
20,
20,
368,
341,
286,
1077,
1378,
62,
17,
20,
19,
284,
1863,
17,
20,
20,
16,
24,
341,
310,
897,
25,
547,
17,
20,
21,
341,
394,
48595,
25,
508,
15,
11,
220,
15,
11,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_escline() {
assert_eq!(escline("\\\nfoo"), Ok(("foo", ())));
assert_eq!(escline("\\\n foo"), Ok((" foo", ())));
assert_eq!(escline("\\ \t \nfoo"), Ok(("foo", ())));
assert_eq!(escline("\\ // test \nfoo"), Ok(("foo", ())));
assert_eq!(escline("\\ // test \n foo"), Ok((" foo", ())));
} | rust_cleaned_test_functions.jsonl/116079 | {
"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,
33741,
87934,
368,
341,
286,
2060,
10714,
10297,
288,
87934,
29710,
59,
77,
7975,
3975,
7622,
30873,
7975,
497,
320,
38776,
286,
2060,
10714,
10297,
288,
87934,
29710,
59,
77,
220,
15229,
3975,
76... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_retrieve_credentials() {
let _setup = SetupLibraryWalletPoolZeroFees::init();
libindy::utils::anoncreds::tests::create_and_store_credential(utils::constants::DEFAULT_SCHEMA_ATTRS, false);
let (_, _, req, _) = libindy::utils::anoncreds::tests::create_proof();
let pres_req_data: PresentationRequestData = serde_json::from_str(&req).unwrap();
let proof_req = PresentationRequest::create().set_request_presentations_attach(&pres_req_data).unwrap();
let proof: Prover = Prover::create("1", proof_req).unwrap();
let retrieved_creds = proof.retrieve_credentials().unwrap();
assert!(retrieved_creds.len() > 500);
} | rust_cleaned_test_functions.jsonl/29150 | {
"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,
1288,
34216,
47396,
368,
341,
286,
1077,
716,
15188,
284,
18626,
16915,
38259,
10551,
17999,
37,
5516,
486,
2327,
1428,
286,
3051,
48990,
486,
6031,
486,
58910,
85734,
486,
23841,
486,
3182,
8378,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_without_parent() {
let item = SearchIndexItem {
index: vec!["accounttype".to_string()],
name: "AccountType".to_string(),
kind: "enum".to_string(),
parent_name: None,
parent_kind: None,
};
let value = serde_json::to_value(&item).unwrap();
assert_eq!(value, json!([["accounttype"], "AccountType", "enum"]));
} | rust_cleaned_test_functions.jsonl/95219 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 210
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
39904,
15960,
368,
341,
286,
1077,
1509,
284,
7542,
1552,
1234,
341,
310,
1922,
25,
7486,
0,
1183,
4608,
1313,
3263,
983,
3904,
73845,
310,
829,
25,
330,
7365,
929,
3263,
983,
3904,
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_rgb_num_parsing() {
// test integers
assert_eq!(104u8, parse_rgb_num("104").unwrap());
assert_eq!(255u8, parse_rgb_num("234923").unwrap());
// test floats
assert_eq!(123u8, parse_rgb_num(".48235").unwrap());
assert_eq!(255u8, parse_rgb_num("1.04").unwrap());
// test percents
assert_eq!(122u8, parse_rgb_num("48%").unwrap());
assert_eq!(255u8, parse_rgb_num("115%").unwrap());
// test errors
assert_eq!(
Err(CSSParseError::InvalidNumericCharacters),
parse_rgb_num("abc")
);
assert_eq!(
Err(CSSParseError::InvalidNumericSyntax),
parse_rgb_num("123%%")
);
} | rust_cleaned_test_functions.jsonl/134570 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 393
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37407,
4273,
620,
28598,
368,
341,
286,
442,
1273,
25780,
198,
286,
2060,
10714,
10297,
16,
15,
19,
84,
23,
11,
4715,
37407,
4273,
445,
16,
15,
19,
1827,
15454,
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_des_ecb() {
let pt = "54686973206973206120746573742e";
let ct = "0050ab8aecec758843fe157b4dde938c";
let key = "7cb66337f3d3c0fe";
let iv = "0001020304050607";
cipher_test(super::Cipher::des_ecb(), pt, ct, key, iv);
} | rust_cleaned_test_functions.jsonl/110554 | {
"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,
15768,
36844,
65,
368,
341,
286,
1077,
10817,
284,
330,
20,
19,
21,
23,
21,
24,
22,
18,
17,
15,
21,
24,
22,
18,
17,
15,
21,
16,
17,
15,
22,
19,
21,
20,
22,
18,
22,
19,
17,
68,
876,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_frames_header_blocked() {
let (mut client, mut server, request_stream_id) = connect_and_send_request(true);
setup_server_side_encoder(&mut client, &mut server);
let headers = vec![
Header::new(":status", "200"),
Header::new("my-header", "my-header"),
Header::new("content-length", "3"),
];
let encoded_headers = server
.encoder
.borrow_mut()
.encode_header_block(&mut server.conn, &headers, request_stream_id)
.unwrap();
let hframe = HFrame::Headers {
header_block: encoded_headers.to_vec(),
};
let encoder_inst_pkt = server.conn.process(None, now());
// Send response
let mut d = Encoder::default();
hframe.encode(&mut d);
let d_frame = HFrame::Data { len: 3 };
d_frame.encode(&mut d);
d.encode(&[0x61, 0x62, 0x63]);
server_send_response_and_exchange_packet(
&mut client,
&mut server,
request_stream_id,
&d,
true,
);
let header_ready_event = |e| matches!(e, Http3ClientEvent::HeaderReady { .. });
assert!(!client.events().any(header_ready_event));
// Let client receive the encoder instructions.
mem::drop(client.process(encoder_inst_pkt.dgram(), now()));
let out = server.conn.process(None, now());
mem::drop(client.process(out.dgram(), now()));
mem::drop(client.process(None, now()));
let mut recv_header = false;
let mut recv_data = false;
// Now the stream is unblocked and both headers and data will be consumed.
while let Some(e) = client.next_event() {
match e {
Http3ClientEvent::HeaderReady { stream_id, .. } => {
assert_eq!(stream_id, request_stream_id);
recv_header = true;
}
Http3ClientEvent::DataReadable { stream_id } => {
recv_data = true;
assert_eq!(stream_id, request_stream_id);
}
x => {
panic!("event {:?}", x);
}
}
}
assert!(recv_header && recv_data);
} | rust_cleaned_test_functions.jsonl/101920 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1183
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
29319,
8757,
89223,
368,
341,
286,
1077,
320,
6984,
2943,
11,
5206,
3538,
11,
1681,
12673,
842,
8,
284,
4564,
8378,
13565,
7893,
3715,
626,
286,
6505,
12015,
30862,
39068,
2099,
6984,
2943,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bad_functions() -> TestResult {
let mut p = Polar::new();
p.load_str(
r#"f(2);
f(1);
g(1);
g(2);
h(2);
k(x) if f(x) and h(x) and g(x);"#,
)?;
qvar(&mut p, "k(a)", "a", values![2]);
Ok(())
} | rust_cleaned_test_functions.jsonl/97610 | {
"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,
34199,
31708,
368,
1464,
3393,
2077,
341,
262,
1077,
5206,
281,
284,
55896,
486,
931,
543,
262,
281,
5104,
2895,
1006,
286,
435,
55543,
69,
7,
17,
317,
1843,
282,
7,
16,
317,
1843,
342,
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... | 2 |
#[test]
fn test_data_frame_on_control_stream() {
test_wrong_frame_on_control_stream(Client, &[0x0, 0x2, 0x1, 0x2]);
test_wrong_frame_on_control_stream(Server, &[0x0, 0x2, 0x1, 0x2]);
} | rust_cleaned_test_functions.jsonl/10919 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1769,
8929,
4470,
13436,
12673,
368,
341,
286,
1273,
75198,
8929,
4470,
13436,
12673,
46851,
11,
44590,
15,
87,
15,
11,
220,
15,
87,
17,
11,
220,
15,
87,
16,
11,
220,
15,
87,
17,
2558,
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_can_print_warnings() {
{
let matches = getopts(&[
"-Awarnings".to_string()
], &optgroups()).unwrap();
let registry = diagnostics::registry::Registry::new(&[]);
let sessopts = build_session_options(&matches);
let sess = build_session(sessopts, None, registry);
assert!(!sess.can_print_warnings);
}
{
let matches = getopts(&[
"-Awarnings".to_string(),
"-Dwarnings".to_string()
], &optgroups()).unwrap();
let registry = diagnostics::registry::Registry::new(&[]);
let sessopts = build_session_options(&matches);
let sess = build_session(sessopts, None, registry);
assert!(sess.can_print_warnings);
}
{
let matches = getopts(&[
"-Adead_code".to_string()
], &optgroups()).unwrap();
let registry = diagnostics::registry::Registry::new(&[]);
let sessopts = build_session_options(&matches);
let sess = build_session(sessopts, None, registry);
assert!(sess.can_print_warnings);
}
} | rust_cleaned_test_functions.jsonl/1676 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 633
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27421,
10064,
87658,
368,
341,
286,
341,
310,
1077,
9071,
284,
633,
10518,
2099,
9640,
394,
6523,
22600,
14857,
3263,
983,
3904,
741,
310,
10654,
609,
2912,
16753,
6011,
15454,
543,
310,
1077,
194... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_xoshiro() {
let mut prng = XoShiRo256StarStar::new();
for _ in 0..6 {
println!("{}", prng.next_long());
}
assert_ne!(prng.next_long(), prng.next_long());
} | rust_cleaned_test_functions.jsonl/54525 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3212,
31845,
299,
368,
341,
286,
1077,
5206,
548,
968,
284,
1599,
78,
2016,
72,
38872,
17,
20,
21,
12699,
12699,
486,
931,
543,
286,
369,
716,
304,
220,
15,
496,
21,
341,
310,
13751,
79878,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_module_parse() {
use crate::variable::ModuleInput;
let inputs: Vec<ModuleInput> = vec![
ModuleInput {
src: "area".to_string(),
dst: "area".to_string(),
},
ModuleInput {
src: "lynxes·lynxes_stock".to_string(),
dst: "lynxes".to_string(),
},
];
let expected = Variable::Module {
model_name: "hares".to_string(),
ident: "hares".to_string(),
units: None,
inputs,
errors: vec![],
unit_errors: vec![],
};
let lynxes_model = x_model(
"lynxes",
vec![
x_aux("init", "5", None),
x_stock("lynxes_stock", "100 * init", &["inflow"], &[], None),
x_flow("inflow", "1", None),
],
);
let hares_model = x_model(
"hares",
vec![
x_aux("lynxes", "0", None),
x_stock("hares_stock", "100", &[], &["outflow"], None),
x_flow("outflow", ".1 * hares_stock", None),
],
);
let main_model = x_model(
"main",
vec![
x_aux("area", "time", None),
x_module("lynxes", &[], None),
x_module(
"hares",
&[
("area", "hares.area"),
("lynxes.lynxes_stock", "hares.lynxes"),
],
None,
),
],
);
let mut implicit_vars: Vec<datamodel::Variable> = Vec::new();
let units_ctx = crate::units::Context::new(&[], &Default::default()).unwrap();
let models: HashMap<Ident, ModelStage0> = vec![
("main".to_string(), &main_model),
("lynxes".to_string(), &lynxes_model),
("hares".to_string(), &hares_model),
]
.into_iter()
.map(|(name, m)| (name, ModelStage0::new(m, &[], &units_ctx, false)))
.collect();
let hares_var = &main_model.variables[2];
assert_eq!("hares", hares_var.get_ident());
let actual = parse_var(&[], hares_var, &mut implicit_vars, &units_ctx, |mi| {
resolve_module_input(&models, "main", hares_var.get_ident(), &mi.src, &mi.dst)
});
assert!(actual.equation_errors().is_none());
assert!(implicit_vars.is_empty());
assert_eq!(expected, actual);
} | rust_cleaned_test_functions.jsonl/18111 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10750,
21039,
368,
341,
262,
990,
17717,
486,
9813,
486,
3332,
2505,
280,
262,
1077,
11127,
25,
11312,
27,
3332,
2505,
29,
284,
7486,
90515,
286,
13711,
2505,
341,
310,
2286,
25,
330,
4798,
3263... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_option_from_buffer_with_invalid_code_returns_none() {
let buf = vec![72, 2, 1, 2];
let mut buf = OptionBuffer { buf: &buf };
let result = buf.next();
match result {
Some(_) => assert!(false), // test failure
None => assert!(true), // test success
}
} | rust_cleaned_test_functions.jsonl/93678 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 165
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9672,
5673,
7776,
6615,
31433,
4136,
58900,
31488,
368,
341,
286,
1077,
6607,
284,
7486,
20703,
22,
17,
11,
220,
17,
11,
220,
16,
11,
220,
17,
935,
286,
1077,
5206,
6607,
284,
6959,
4095,
314,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_minimal() {
let json = br#"
{"response":{
"server":"prod",
"protocol":"3.0",
"app":[
{
"appid":"{00000000-0000-0000-0000-000000000001}",
"status":"ok"
}
]
}}"#;
let result = parse_json_response(json);
assert!(result.is_ok());
let response = result.unwrap();
let expected = Response {
protocol_version: "3.0".to_string(),
server: "prod".to_string(),
daystart: None,
apps: vec![App {
id: "{00000000-0000-0000-0000-000000000001}".to_string(),
..App::default()
}],
};
assert_eq!(response, expected);
} | rust_cleaned_test_functions.jsonl/14133 | {
"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,
7260,
2861,
368,
341,
262,
1077,
2951,
284,
1411,
2,
698,
4913,
2322,
12602,
330,
4030,
3252,
19748,
756,
330,
17014,
3252,
18,
13,
15,
756,
330,
676,
8899,
198,
220,
341,
256,
330,
58342,
325... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_output_error() {
let Output { status, stdout, stderr } = if cfg!(target_os = "windows") {
Command::new("cmd").args(&["/C", "mkdir ."]).output().unwrap()
} else {
Command::new("mkdir").arg("./").output().unwrap()
};
assert!(status.code() == Some(1));
assert_eq!(stdout, Vec::new());
assert!(!stderr.is_empty());
} | rust_cleaned_test_functions.jsonl/5482 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 203
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
7645,
4096,
368,
341,
286,
1077,
9258,
314,
2639,
11,
20075,
11,
26436,
335,
284,
421,
13286,
10297,
5657,
29387,
284,
330,
27077,
899,
341,
310,
7348,
486,
931,
445,
8710,
1827,
2116,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_read_write() -> Result<()> {
// simple test of using the triple buffer
let (reader, writer) = TripleBuffer::<u32>::new();
// create an update thread
let t: JoinHandle<Result<()>> = std::thread::spawn(move || {
let mut state = 0;
loop {
let mut write = writer.get_write()?;
let write = write.state_mut()?;
if state > 50_000 {
break;
}
state += 1;
*write = state;
std::thread::sleep(Duration::from_nanos(0));
}
Ok(())
});
let mut last_read;
// loop through reading the state
loop {
let read = reader.get_read()?;
let read = *read.state()?;
last_read = read;
if read >= 50_000 {
break;
}
std::thread::sleep(Duration::from_nanos(0));
}
t.join().expect("Unable to join thread")?;
// read should only have broken out of the loop if this is true
// most bugs in the buffer would be likely to cause this test to
// infinite loop
assert_eq!(last_read, 50_000);
Ok(())
} | rust_cleaned_test_functions.jsonl/14942 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 684
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
9165,
368,
1464,
5714,
71698,
341,
286,
442,
4285,
1273,
315,
1667,
279,
23725,
4147,
198,
286,
1077,
320,
11149,
11,
6916,
8,
284,
36649,
4095,
27638,
84,
18,
17,
6831,
931,
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... | 9 |
#[test]
fn test_sign_message() {
let message = "test message".to_owned();
let expected_signature = "304402204146402099809E1F021421569F72BA34DCAFCC832741AB6310F887F60734D9F002203E813AD6A59D67D8EE06C8EA05BCC1BA8F690B631E6F243E8BE60633D27BE05D";
let out_dir = std::env::var("OUT_DIR").unwrap();
let mut jscontext = JavaScript::new(format!("{}/xpring.js", out_dir))?;
let signed_message = sign(
&mut jscontext,
message,
"000974B4CFE004A2E6C4364CBF3510A36A352796728D0861F6B555ED7E54A70389".to_owned(),
)
.unwrap();
assert_eq!(expected_signature, signed_message);
} | rust_cleaned_test_functions.jsonl/118747 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 348
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11172,
6462,
368,
341,
286,
1077,
1943,
284,
330,
1944,
1943,
3263,
983,
51973,
543,
286,
1077,
3601,
39859,
284,
330,
18,
15,
19,
19,
15,
17,
17,
15,
19,
16,
19,
21,
19,
15,
17,
15,
24,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_nonnull_array_is_not_null() {
let a = Primitive::from_slice(vec![1, 2, 3, 4]).to(DataType::Int32);
let res = is_not_null(&a);
let expected = BooleanArray::from_slice(vec![true, true, true, true]);
assert_eq!(expected, res);
} | rust_cleaned_test_functions.jsonl/80391 | {
"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,
21637,
2921,
3858,
6892,
7913,
15162,
368,
341,
286,
1077,
264,
284,
51460,
486,
1499,
26488,
25592,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
10697,
983,
63941,
486,
1072,
18,
17,
626... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_advance() {
let v = TestMessage::ChaosMonkey {
counter: 0,
max: 1,
mutation: ChaosMonkeyMutation::Increment,
};
let v = v.advance();
if let TestMessage::ChaosMonkey { counter, max, mutation } = v {
assert_eq!(counter, 1);
assert_eq!(max, 1);
assert_eq!(mutation, ChaosMonkeyMutation::Increment);
} else {
assert_eq!(true, false)
}
assert_eq!(true, v.can_advance());
} | rust_cleaned_test_functions.jsonl/43171 | {
"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,
98093,
368,
341,
286,
1077,
348,
284,
3393,
2052,
486,
1143,
64866,
96838,
341,
310,
5546,
25,
220,
15,
345,
310,
1932,
25,
220,
16,
345,
310,
26374,
25,
43105,
96838,
53998,
486,
38311,
345,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_introduce_var_in_match_arm_no_block() {
check_assist_range(
introduce_variable,
"
fn main() {
let x = true;
let tuple = match x {
true => (<|>2 + 2<|>, true)
_ => (0, false)
};
}
",
"
fn main() {
let x = true;
let tuple = match x {
true => { let <|>var_name = 2 + 2; (var_name, true) }
_ => (0, false)
};
}
",
);
} | rust_cleaned_test_functions.jsonl/5712 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 249
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4042,
47845,
4612,
1243,
10708,
34680,
6536,
7113,
368,
341,
286,
1779,
12083,
380,
9698,
1006,
310,
19131,
14635,
345,
310,
6228,
8822,
1887,
368,
341,
262,
1077,
856,
284,
830,
280,
262,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pivot() {
let s0 = Series::new("foo", ["A", "A", "B", "B", "C"].as_ref());
let s1 = Series::new("N", [1, 2, 2, 4, 2].as_ref());
let s2 = Series::new("bar", ["k", "l", "m", "m", "l"].as_ref());
let df = DataFrame::new(vec![s0, s1, s2]).unwrap();
let pvt = df.groupby("foo").unwrap().pivot("bar", "N").sum().unwrap();
assert_eq!(pvt.get_column_names(), &["foo", "k", "l", "m"]);
assert_eq!(
Vec::from(&pvt.column("m").unwrap().i32().unwrap().sort(false)),
&[None, None, Some(6)]
);
let pvt = df.groupby("foo").unwrap().pivot("bar", "N").min().unwrap();
assert_eq!(
Vec::from(&pvt.column("m").unwrap().i32().unwrap().sort(false)),
&[None, None, Some(2)]
);
let pvt = df.groupby("foo").unwrap().pivot("bar", "N").max().unwrap();
assert_eq!(
Vec::from(&pvt.column("m").unwrap().i32().unwrap().sort(false)),
&[None, None, Some(4)]
);
let pvt = df.groupby("foo").unwrap().pivot("bar", "N").mean().unwrap();
assert_eq!(
Vec::from(&pvt.column("m").unwrap().i32().unwrap().sort(false)),
&[None, None, Some(3)]
);
let pvt = df
.groupby("foo")
.unwrap()
.pivot("bar", "N")
.count()
.unwrap();
assert_eq!(
Vec::from(&pvt.column("m").unwrap().u32().unwrap().sort(false)),
&[Some(0), Some(0), Some(2)]
);
} | rust_cleaned_test_functions.jsonl/10684 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 842
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
16084,
368,
341,
286,
1077,
274,
15,
284,
11131,
486,
931,
445,
7975,
497,
4383,
32,
497,
330,
32,
497,
330,
33,
497,
330,
33,
497,
330,
34,
5521,
300,
7793,
1423,
286,
1077,
274,
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_agg_float() {
let ca1 = Float32Chunked::new_from_slice("a", &[1.0, f32::NAN]);
let ca2 = Float32Chunked::new_from_slice("b", &[f32::NAN, 1.0]);
assert_eq!(ca1.min(), ca2.min());
let ca1 = Float64Chunked::new_from_slice("a", &[1.0, f64::NAN]);
let ca2 = Float64Chunked::new_from_slice("b", &[f64::NAN, 1.0]);
assert_eq!(ca1.min(), ca2.min());
println!("{:?}", (ca1.min(), ca2.min()))
} | rust_cleaned_test_functions.jsonl/80126 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 250
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
83534,
17586,
368,
341,
286,
1077,
2162,
16,
284,
13001,
18,
17,
28304,
291,
486,
931,
5673,
26488,
445,
64,
497,
44590,
16,
13,
15,
11,
282,
18,
17,
486,
45,
1093,
2558,
286,
1077,
2162,
17... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dsym_parent() {
let crash_path = fixture("macos/crash.dSYM/Contents/Resources/DWARF/crash");
let dsym_path = crash_path.dsym_parent().unwrap();
assert!(dsym_path.exists());
assert!(dsym_path.ends_with("macos/crash.dSYM"));
let other_path = fixture("macos/crash.dSYM/Contents/Resources/DWARF/invalid");
assert_eq!(other_path.dsym_parent(), None);
} | rust_cleaned_test_functions.jsonl/46977 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 197
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
23802,
15960,
368,
341,
286,
1077,
9920,
2638,
284,
12507,
445,
11948,
436,
2899,
81,
988,
950,
79234,
14,
14803,
76099,
14953,
45458,
37,
2899,
81,
988,
797,
286,
1077,
11472,
1600,
2638,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_single_identifier() {
let selector_str = " identifier";
let expected = vec![SelectorRaw {
node_selectors: vec![NodeSelectorRaw {
node_kind: "identifier".into(),
nth_child: None,
}],
}];
assert_eq!(Ok(("", expected)), selectors(selector_str));
} | rust_cleaned_test_functions.jsonl/56562 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19487,
33176,
368,
341,
286,
1077,
9367,
2895,
284,
330,
414,
12816,
876,
286,
1077,
3601,
284,
7486,
20703,
5877,
20015,
341,
310,
2436,
13051,
1087,
25,
7486,
20703,
1955,
5877,
20015,
341,
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_fx1e_increment_idx() {
let mut machine = Machine::new(TestContext::new());
machine.idx = 0xBCD;
machine.register_set(0xA, 4);
machine.test_opcode(0xFA1E);
// Should increment the index pointer by the value set at VX
assert_eq!(machine.idx, 0xBCD + 4);
// Should not touch VX
assert_eq!(machine.register_get(0xA), 4);
// Should increment program counter by two
assert_eq!(machine.pc, PC_BEGIN + 2);
} | rust_cleaned_test_functions.jsonl/127974 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 191
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62691,
16,
68,
51482,
7258,
368,
341,
262,
1077,
5206,
5662,
284,
12960,
486,
931,
31159,
1972,
486,
931,
1423,
262,
5662,
51806,
284,
220,
15,
80979,
35,
280,
262,
5662,
9929,
2602,
7,
15,
14... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_set_mems() {
// arrange
let (tmp, mems) = setup("test_set_mems", CGROUP_CPUSET_MEMS);
let cpuset = LinuxCpuBuilder::new().with_mems("1-3".to_owned()).build();
// act
CpuSet::apply(&tmp, &cpuset).expect("apply cpuset");
// assert
let content = fs::read_to_string(&mems)
.unwrap_or_else(|_| panic!("read {} file content", CGROUP_CPUSET_MEMS));
assert_eq!(content, "1-3");
} | rust_cleaned_test_functions.jsonl/122287 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 238
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
717,
11852,
368,
341,
286,
442,
30893,
198,
286,
1077,
320,
5173,
11,
1833,
82,
8,
284,
6505,
445,
1944,
2602,
717,
11852,
497,
6159,
11838,
29741,
5884,
13209,
50,
317,
286,
1077,
12490,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_adaptive() {
let a = PrimitiveArray::from([Some(11_1111i128)]).to(DataType::Decimal(6, 4));
let b = PrimitiveArray::from([Some(11111_11i128)]).to(DataType::Decimal(7, 2));
let result = adaptive_add(&a, &b).unwrap();
let expected = PrimitiveArray::from([Some(11122_2211i128)]).to(DataType::Decimal(9, 4));
assert_eq!(result, expected);
assert_eq!(result.data_type(), &DataType::Decimal(9, 4));
let a = PrimitiveArray::from([Some(1111i128)]).to(DataType::Decimal(5, 4));
let b = PrimitiveArray::from([Some(11111_0i128)]).to(DataType::Decimal(6, 1));
let result = adaptive_add(&a, &b).unwrap();
let expected = PrimitiveArray::from([Some(11111_1111i128)]).to(DataType::Decimal(9, 4));
assert_eq!(result, expected);
assert_eq!(result.data_type(), &DataType::Decimal(9, 4));
let a = PrimitiveArray::from([Some(11111_11i128)]).to(DataType::Decimal(7, 2));
let b = PrimitiveArray::from([Some(11111_111i128)]).to(DataType::Decimal(8, 3));
let result = adaptive_add(&a, &b).unwrap();
let expected = PrimitiveArray::from([Some(22222_221i128)]).to(DataType::Decimal(8, 3));
assert_eq!(result, expected);
assert_eq!(result.data_type(), &DataType::Decimal(8, 3));
let a = PrimitiveArray::from([Some(99_9999i128)]).to(DataType::Decimal(6, 4));
let b = PrimitiveArray::from([Some(00_0001i128)]).to(DataType::Decimal(6, 4));
let result = adaptive_add(&a, &b).unwrap();
let expected = PrimitiveArray::from([Some(100_0000i128)]).to(DataType::Decimal(7, 4));
assert_eq!(result, expected);
assert_eq!(result.data_type(), &DataType::Decimal(7, 4));
} | rust_cleaned_test_functions.jsonl/6880 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 911
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
10027,
27781,
368,
341,
16885,
16885,
286,
1077,
264,
284,
51460,
1857,
486,
1499,
2561,
8373,
7,
16,
16,
62,
16,
16,
16,
16,
72,
16,
17,
23,
7252,
568,
983,
63941,
486,
11269,
7,
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_from_slice() {
let array = ["1", "2", "3", "4"];
let mut list = SimpleLinkedList::from(array.as_ref());
assert_eq!(list.pop(), Some("4"));
assert_eq!(list.pop(), Some("3"));
assert_eq!(list.pop(), Some("2"));
assert_eq!(list.pop(), Some("1"));
} | rust_cleaned_test_functions.jsonl/78174 | {
"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,
5673,
26488,
368,
341,
262,
1077,
1334,
284,
4383,
16,
497,
330,
17,
497,
330,
18,
497,
330,
19,
6332,
262,
1077,
5206,
1140,
284,
8993,
33915,
486,
1499,
6110,
5357,
7793,
1423,
262,
2060,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_write_airline_theme() {
let mut table = HashMap::new();
table.insert(
"color1",
Color {
gui: ColorCode::Normal("#123456"),
cterm: ColorCode::Normal(123),
},
);
table.insert(
"color2",
Color {
gui: ColorCode::Contrast("#000000", "#ffffff"),
cterm: ColorCode::Contrast(1, 2),
},
);
// Userd for accents
table.insert(
"red",
Color {
gui: ColorCode::Normal("#ff0000"),
cterm: ColorCode::Normal(123),
},
);
let airline_theme = AirlineThemeColors {
mode: {
let mut m = HashMap::new();
m.insert(
"normal",
ThemeModeColor {
label: ("color1", "color2"),
info: ("color2", "color1"),
main: ("color2", "color2"),
modified: Some("color1"),
modified_main: Some("color1"),
},
);
m.insert(
"insert",
ThemeModeColor {
label: ("color2", "color1"),
info: ("color1", "color2"),
main: ("color1", "color1"),
modified: Some("color1"),
modified_main: None,
},
);
m.insert(
"visual",
ThemeModeColor {
label: ("color1", "color1"),
info: ("color2", "color2"),
main: ("color1", "color1"),
modified: None,
modified_main: None,
},
);
m.insert(
"replace",
ThemeModeColor {
label: ("color1", "color1"),
info: ("color2", "color2"),
main: ("color1", "color1"),
modified: Some("color1"),
modified_main: None,
},
);
m.insert(
"inactive",
ThemeModeColor {
label: ("color1", "color1"),
info: ("color2", "color2"),
main: ("color1", "color1"),
modified: Some("color2"),
modified_main: Some("color2"),
},
);
m
},
paste: "color1",
info_mod: "color2",
error: ("color1", "color2"),
warning: ("color2", "color1"),
};
let mut w = Writer {
table,
highlights: &[],
term_colors: DUMMY_TERM_COLORS,
airline_theme,
out: Vec::new(),
};
w.write_airline_theme().unwrap();
let rendered = str::from_utf8(&w.out).unwrap();
let re_var = Regex::new(r"^let g:airline#themes#spring_night#palette\.(\w+) =").unwrap();
let re_palette =
Regex::new(r"^\\\s+'(red|airline_(a|b|c|x|y|z|error|warning))': \[('(#[[:xdigit:]]{6})?',\s*){2}((\d{1,3}|''),\s*){2}''\]").unwrap();
for line in rendered.lines() {
if line.starts_with("let g:") {
match re_var.captures(line) {
Some(found) => {
let mode = &found[1];
assert!(
w.airline_theme.mode.keys().any(|m| *m == mode
|| format!("{}_modified", m) == mode
|| format!("{}_paste", m) == mode
|| "accents" == mode),
"Unknown mode: {}",
mode
);
}
None => assert!(
line == "let g:airline#themes#spring_night#palette = {}",
"Invalid variable definition: {}",
line
),
}
} else if line.starts_with("\\ ") {
assert!(re_palette.is_match(line), "Invalid color palette: {}", line);
}
}
} | rust_cleaned_test_functions.jsonl/76930 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2466
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
50827,
1056,
19864,
368,
341,
262,
1077,
5206,
1965,
284,
10528,
486,
931,
543,
262,
1965,
7030,
1006,
286,
330,
3423,
16,
756,
286,
3478,
341,
310,
19229,
25,
3478,
2078,
486,
12206,
3584... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_simple_operator_in_plaintexts_to_string() {
let name1 = _random_vector(10);
let value1 = _random_string(10);
let value2 = _random_string(10);
let value3 = _random_string(10);
let query = Operator::In(
TagName::PlainTagName(name1.clone()),
vec![
TargetValue::Unencrypted(value1.clone()),
TargetValue::Unencrypted(value2.clone()),
TargetValue::Unencrypted(value3.clone()),
]
);
let json = query.to_string();
let expected = format!(r#"{{"~{}":{{"$in":["{}","{}","{}"]}}}}"#, base64::encode(&name1), value1, value2, value3);
assert_eq!(json, expected);
} | rust_cleaned_test_functions.jsonl/11886 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 366
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
40594,
1243,
6317,
1641,
427,
82,
2346,
3904,
368,
341,
286,
1077,
829,
16,
284,
716,
11463,
12247,
7,
16,
15,
317,
286,
1077,
897,
16,
284,
716,
11463,
3904,
7,
16,
15,
317,
286,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dispatch_with_discover_expired_client_binding_returns_available_old_addr() {
let disc = new_test_discover();
let mut server = new_test_server(|| 42);
let mut client_config = CachedConfig::default();
client_config.client_addr = Ipv4Addr::new(192, 168, 1, 42);
client_config.expiration = 0;
server.cache.insert(disc.chaddr, client_config);
server
.pool
.available_addrs
.insert(Ipv4Addr::new(192, 168, 1, 42));
let got = server.dispatch(disc).unwrap();
let mut want = new_test_offer();
want.yiaddr = Ipv4Addr::new(192, 168, 1, 42);
assert_eq!(got, want);
} | rust_cleaned_test_functions.jsonl/61715 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 334
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42991,
6615,
9932,
3688,
80221,
8179,
60815,
58900,
26962,
21108,
7387,
368,
341,
286,
1077,
2560,
284,
501,
4452,
9932,
3688,
543,
286,
1077,
5206,
3538,
284,
501,
4452,
12015,
79453,
220,
19,
17... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_gtk_len() {
let gtk_kde = Gtk { info: GtkInfo(0), gtk: vec![] };
assert_eq!(gtk_kde.len(), 2);
let gtk_kde = Gtk { info: GtkInfo(0), gtk: vec![0; 16] };
assert_eq!(gtk_kde.len(), 18);
let gtk_kde = Gtk { info: GtkInfo(0), gtk: vec![0; 8] };
assert_eq!(gtk_kde.len(), 10);
let gtk_kde = Gtk { info: GtkInfo(0), gtk: vec![0; 4] };
assert_eq!(gtk_kde.len(), 6);
let gtk_kde = Gtk { info: GtkInfo(0), gtk: vec![0; 32] };
assert_eq!(gtk_kde.len(), 34);
} | rust_cleaned_test_functions.jsonl/52437 | {
"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,
1889,
6242,
6043,
368,
341,
286,
1077,
18692,
4698,
450,
284,
27296,
314,
3546,
25,
27296,
1731,
7,
15,
701,
18692,
25,
7486,
0,
1294,
2605,
286,
2060,
10714,
10297,
40749,
4698,
450,
19406,
150... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_format_python_version_anaconda() {
assert_eq!(
format_python_version(
"Python 3.6.10 :: Anaconda, Inc.",
"v${major}.${minor}.${patch}"
),
Some("v3.6.10".to_string())
);
} | rust_cleaned_test_functions.jsonl/99459 | {
"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,
8955,
55869,
9438,
62,
3362,
63753,
368,
341,
286,
2060,
10714,
33673,
310,
3561,
55869,
9438,
1006,
394,
330,
30280,
220,
18,
13,
21,
13,
16,
15,
3504,
32138,
63753,
11,
4848,
10346,
394,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_header_ident() {
// Valid ident header
let test_arr = &[0x01, 0x76, 0x6f, 0x72,
0x62, 0x69, 0x73, 0x00, 0x00, 0x00, 0x00, 0x02,
0x44, 0xac, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x80, 0xb5, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0xb8, 0x01];
let hdr = read_header_ident(test_arr).unwrap();
assert_eq!(hdr.audio_channels, 2);
assert_eq!(hdr.audio_sample_rate, 0x0000ac44);
assert_eq!(hdr.bitrate_maximum, 0);
assert_eq!(hdr.bitrate_nominal, 0x0001b580);
assert_eq!(hdr.bitrate_minimum, 0);
assert_eq!(hdr.blocksize_0, 8);
assert_eq!(hdr.blocksize_1, 11);
} | rust_cleaned_test_functions.jsonl/8406 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 315
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
8757,
38399,
368,
341,
197,
322,
7818,
3524,
4247,
198,
10217,
1273,
11210,
284,
44590,
15,
87,
15,
16,
11,
220,
15,
87,
22,
21,
11,
220,
15,
87,
21,
69,
11,
220,
15,
87,
22,
17,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_node_stale_peer() {
let mut cluster = new_node_cluster(0, 4);
// To avoid stale peers know they are stale from PD.
cluster.cfg.raft_store.max_leader_missing_duration = ReadableDuration::hours(2);
test_stale_peer(&mut cluster);
} | rust_cleaned_test_functions.jsonl/107623 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5084,
1261,
1574,
45159,
368,
341,
262,
1077,
5206,
10652,
284,
501,
5084,
28441,
7,
15,
11,
220,
19,
317,
262,
442,
2014,
5648,
50351,
25029,
1414,
807,
525,
50351,
504,
26474,
624,
262,
10652,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_application() {
let result = parse_application(&mut Lexer::new("x y z"));
let expected = Ok(ApplicationExpression::new(vec![
Expression::from(VariableExpression::new(Identifier::new("x"))),
Expression::from(VariableExpression::new(Identifier::new("y"))),
Expression::from(VariableExpression::new(Identifier::new("z"))),
]));
assert_eq!(expected, result);
} | rust_cleaned_test_functions.jsonl/19436 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
38721,
368,
341,
286,
1077,
1102,
284,
4715,
38721,
2099,
6984,
85082,
486,
931,
445,
87,
379,
1147,
4010,
286,
1077,
3601,
284,
7622,
41236,
9595,
486,
931,
25592,
90515,
310,
16378,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_empty_bundle() {
let timetag = OscTime::from((4, 2));
let content = vec![];
let packet = encoder::encode(&OscPacket::Bundle(OscBundle { timetag, content })).unwrap();
let osc_packet: Result<rosc::OscPacket, rosc::OscError> = decoder::decode(&packet);
match osc_packet {
Ok(rosc::OscPacket::Bundle(bundle)) => {
assert_eq!(timetag, bundle.timetag);
assert!(bundle.content.is_empty());
}
Ok(_) => panic!("Expected an OscBundle!"),
Err(e) => panic!(e),
}
} | rust_cleaned_test_functions.jsonl/59721 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 267
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
15124,
60986,
368,
341,
262,
1077,
6792,
80465,
284,
55636,
1462,
486,
1499,
1188,
19,
11,
220,
17,
1106,
262,
1077,
2213,
284,
7486,
0,
15078,
262,
1077,
10151,
284,
23668,
486,
6180,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_upper_utf8() {
let cases = vec![
(Some(b"hello".to_vec()), Some(b"HELLO".to_vec())),
(Some(b"123".to_vec()), Some(b"123".to_vec())),
(
Some("café".as_bytes().to_vec()),
Some("CAFÉ".as_bytes().to_vec()),
),
(
Some("数据库".as_bytes().to_vec()),
Some("数据库".as_bytes().to_vec()),
),
(
Some("ночь на окраине москвы".as_bytes().to_vec()),
Some("НОЧЬ НА ОКРАИНЕ МОСКВЫ".as_bytes().to_vec()),
),
(
Some("قاعدة البيانات".as_bytes().to_vec()),
Some("قاعدة البيانات".as_bytes().to_vec()),
),
(None, None),
];
for (arg, exp) in cases {
let output = RpnFnScalarEvaluator::new()
.push_param(arg.clone())
.evaluate(ScalarFuncSig::UpperUtf8)
.unwrap();
assert_eq!(output, exp);
}
} | rust_cleaned_test_functions.jsonl/10170 | {
"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,
34445,
39453,
23,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
320,
8373,
1883,
1,
14990,
3263,
983,
13251,
11858,
4329,
1883,
1,
50712,
1593,
3263,
983,
13251,
73727,
310,
320,
8373,
1883,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_rolling_hash() {
let n = 30;
let mut rng = rand::thread_rng();
for _ in 0..100 {
let mut s = String::new();
for _ in 0..n {
let c = (rng.sample(Uniform::from(0..26)) as u8 + 'a' as u8) as char;
s.push(c);
}
let t = String::new() + s.as_str() + s.as_str();
let n = t.len();
let rolling_hash = rolling_hash::RollingHash::new(&t.as_bytes(), BASE);
for i in 0..n {
for j in i..n {
for k in (j + 1)..n {
let same = t[i..k] == t[j..k];
let same_hash = rolling_hash.get_hash(i, k) == rolling_hash.get_hash(j, k);
assert_eq!(
same,
same_hash,
"{:?} {:?} {} {}",
&t[i..k],
&t[j..k],
rolling_hash.get_hash(i, k),
rolling_hash.get_hash(j, k)
);
}
}
}
}
} | rust_cleaned_test_functions.jsonl/119606 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 812
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
16210,
8950,
368,
341,
286,
1077,
308,
284,
220,
18,
15,
280,
286,
1077,
5206,
28422,
284,
10382,
486,
4528,
66849,
1428,
286,
369,
716,
304,
220,
15,
496,
16,
15,
15,
341,
310,
1077,
52... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_ecdsa_get_new_signing_requests() {
let pseudo_random_id = [0; 32];
let mut state = ReplicatedStateBuilder::default().build();
state
.metadata
.subnet_call_context_manager
.sign_with_ecdsa_contexts
.insert(
CallbackId::from(1),
SignWithEcdsaContext {
request: RequestBuilder::new().build(),
pseudo_random_id,
message_hash: vec![],
derivation_path: vec![],
batch_time: mock_time(),
},
);
let state = Arc::new(state);
let mut state_manager = MockStateManager::new();
let height = Height::new(10);
state_manager.expect_get_state_at().returning(move |h| {
if h == height {
Ok(ic_interfaces::state_manager::Labeled::new(h, state.clone()))
} else {
Err(StateManagerError::StateNotCommittedYet(h))
}
});
// Success case
let mut requests = BTreeSet::new();
let sig_inputs = create_sig_inputs(10);
let quadruple_ref = &sig_inputs.sig_inputs_ref.presig_quadruple_ref;
let ecdsa_transcript_ref = &sig_inputs.sig_inputs_ref.key_transcript_ref;
let mut available_quadruples = BTreeMap::new();
available_quadruples.insert(ecdsa::QuadrupleId(0), quadruple_ref.clone());
let result = get_new_signing_requests(
&state_manager,
&requests,
&mut available_quadruples,
ecdsa_transcript_ref,
height,
);
assert!(result.is_ok());
let new_requests = result.unwrap();
assert_eq!(new_requests.len(), 1);
// Duplicate is ignored
let request_id = ecdsa::RequestId::from(pseudo_random_id.to_vec());
requests.insert(&request_id);
let result = get_new_signing_requests(
&state_manager,
&requests,
&mut available_quadruples,
ecdsa_transcript_ref,
height,
);
assert!(result.is_ok());
let new_requests = result.unwrap();
assert_eq!(new_requests.len(), 0);
// Failure case
let result = get_new_signing_requests(
&state_manager,
&requests,
&mut available_quadruples,
ecdsa_transcript_ref,
height.increment(),
);
assert_matches!(
result,
Err(EcdsaPayloadError::StateManagerError(
StateManagerError::StateNotCommittedYet(_)
))
);
} | rust_cleaned_test_functions.jsonl/113082 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1416
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36844,
96780,
3062,
5921,
11172,
287,
37216,
368,
341,
286,
1077,
34750,
22644,
842,
284,
508,
15,
26,
220,
18,
17,
935,
286,
1077,
5206,
1584,
284,
3321,
13724,
1397,
3297,
486,
2258,
1005,
583... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_dirty_tracking() {
// the rest of the unit tests above.
let m = crate::MmapRegion::<AtomicBitmap>::new(0x1_0000).unwrap();
crate::bitmap::tests::test_volatile_memory(&m);
} | rust_cleaned_test_functions.jsonl/103809 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
63642,
66105,
368,
341,
1789,
286,
442,
279,
2732,
315,
279,
4982,
7032,
3403,
624,
286,
1077,
296,
284,
17717,
486,
44,
2186,
14091,
27638,
65857,
16773,
6831,
931,
7,
15,
87,
16,
62,
15,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_btf_type_struct() {
let endianness = Endianness::default();
let data: &[u8] = &[
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00, 0x00, 0x47, 0x02,
0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
];
match unsafe { BtfType::read(data, endianness) } {
Ok(BtfType::Struct(_, _)) => {}
Ok(t) => panic!("expected struct type, got {:#?}", t),
Err(_) => panic!("unexpected error"),
}
} | rust_cleaned_test_functions.jsonl/98489 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 310
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
880,
8935,
1819,
15126,
368,
341,
286,
1077,
835,
72,
82033,
284,
3972,
72,
82033,
486,
2258,
543,
286,
1077,
821,
25,
44590,
84,
23,
60,
284,
609,
9640,
310,
220,
15,
87,
15,
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... | 2 |
#[test]
fn test_derivation_path_debug() {
let path = DerivationPath::default();
assert_eq!(format!("{:?}", path), "m/44'/19165'".to_string());
let path = DerivationPath::new_bip44(Some(1), None);
assert_eq!(format!("{:?}", path), "m/44'/19165'/1'".to_string());
let path = DerivationPath::new_bip44(Some(1), Some(2));
assert_eq!(format!("{:?}", path), "m/44'/19165'/1'/2'".to_string());
} | rust_cleaned_test_functions.jsonl/132682 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 214
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35345,
39127,
2638,
15446,
368,
341,
286,
1077,
1815,
284,
12741,
39127,
1820,
486,
2258,
543,
286,
2060,
10714,
10297,
2243,
88928,
25,
52652,
1815,
701,
330,
76,
14,
19,
19,
20177,
16,
24,
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_content_transfer_parse() {
let tests = vec![
("base64", Some(MimeContentTransferEncoding::Base64)),
(
"quoted-printable",
Some(MimeContentTransferEncoding::QuotedPrintable),
),
("7bit", Some(MimeContentTransferEncoding::Identity)),
("8bit", Some(MimeContentTransferEncoding::Identity)),
("binary", Some(MimeContentTransferEncoding::Identity)),
// Check for case insensitivity
("BASE64", Some(MimeContentTransferEncoding::Base64)),
// Check for fail case
("lkasjdl", None),
];
for (test, expected) in tests.into_iter() {
let header = Header::new("Content-Transfer-Encoding".to_string(), test.to_string());
let parsed: Option<MimeContentTransferEncoding> = header.get_value().ok();
assert_eq!(parsed, expected);
}
} | rust_cleaned_test_functions.jsonl/77551 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 446
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7495,
35403,
21039,
368,
341,
286,
1077,
7032,
284,
7486,
90515,
310,
3489,
3152,
21,
19,
497,
4329,
3189,
545,
2762,
21970,
14690,
486,
3978,
21,
19,
6965,
310,
2399,
394,
330,
63725,
42145,
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_encode_contract_tz2() -> Result<(), failure::Error> {
let decoded = HashType::ContractTz2Hash
.hash_to_b58check(&hex::decode("2fcb1d9307f0b1f94c048ff586c09f46614c7e90")?);
let expected = "tz2Cfwk4ortcaqAGcVJKSxLiAdcFxXBLBoyY";
assert_eq!(expected, decoded);
Ok(())
} | rust_cleaned_test_functions.jsonl/104553 | {
"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,
11224,
51499,
528,
89,
17,
368,
1464,
5714,
68843,
7901,
486,
1454,
29,
341,
286,
1077,
29213,
284,
6531,
929,
486,
14067,
51,
89,
17,
6370,
198,
310,
659,
8296,
2346,
880,
20,
23,
2028,
2099,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_line_numbers() {
let mut chunk = Chunk::new("no_file", 1);
chunk.encode2(MOV, 1, 2, 1).unwrap();
chunk.encode2(MOV, 1, 2, 2).unwrap();
chunk.encode2(MOV, 1, 2, 3).unwrap();
chunk.encode2(MOV, 1, 2, 4).unwrap();
chunk.encode2(MOV, 1, 2, 4).unwrap();
chunk.encode2(MOV, 1, 2, 30).unwrap();
chunk.encode2(MOV, 1, 2, 200).unwrap();
assert!(chunk.offset_to_line(0).unwrap() == 1);
assert!(chunk.offset_to_line(1).unwrap() == 1);
assert!(chunk.offset_to_line(2).unwrap() == 1);
assert!(chunk.offset_to_line(3).unwrap() == 2);
assert!(chunk.offset_to_line(4).unwrap() == 2);
assert!(chunk.offset_to_line(5).unwrap() == 2);
assert!(chunk.offset_to_line(6).unwrap() == 3);
assert!(chunk.offset_to_line(7).unwrap() == 3);
assert!(chunk.offset_to_line(8).unwrap() == 3);
assert!(chunk.offset_to_line(9).unwrap() == 4);
assert!(chunk.offset_to_line(10).unwrap() == 4);
assert!(chunk.offset_to_line(11).unwrap() == 4);
assert!(chunk.offset_to_line(12).unwrap() == 4);
assert!(chunk.offset_to_line(13).unwrap() == 4);
assert!(chunk.offset_to_line(14).unwrap() == 4);
assert!(chunk.offset_to_line(15).unwrap() == 30);
assert!(chunk.offset_to_line(16).unwrap() == 30);
assert!(chunk.offset_to_line(17).unwrap() == 30);
assert!(chunk.offset_to_line(18).unwrap() == 200);
assert!(chunk.offset_to_line(19).unwrap() == 200);
assert!(chunk.offset_to_line(20).unwrap() == 200);
assert!(chunk.line_to_offset(1).unwrap() == 0);
assert!(chunk.line_to_offset(2).unwrap() == 3);
assert!(chunk.line_to_offset(3).unwrap() == 6);
assert!(chunk.line_to_offset(4).unwrap() == 9);
assert!(chunk.line_to_offset(30).unwrap() == 15);
assert!(chunk.line_to_offset(200).unwrap() == 18);
assert!(chunk.line_to_offset(15).is_none());
assert!(chunk.line_to_offset(0).is_none());
assert!(chunk.line_to_offset(201).is_none());
assert!(chunk.line_to_offset(101).is_none());
assert!(chunk.encode0(RET, 1).is_err());
} | rust_cleaned_test_functions.jsonl/101217 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6528,
32964,
368,
341,
286,
1077,
5206,
11879,
284,
45513,
486,
931,
445,
2152,
2458,
497,
220,
16,
317,
286,
11879,
17313,
17,
3189,
38957,
11,
220,
16,
11,
220,
17,
11,
220,
16,
568,
15454,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_complex() {
let in_out = vec![
((0f64, 0f64), (0f64, 0f64), (0f64, 0f64)),
((2f64, 0f64), (3f64, 4f64), (5f64, 4f64)),
((0f64, 2f64), (3f64, 4f64), (3f64, 6f64)),
((3f64, -2f64), (-3f64, 4f64), (0f64, 2f64)),
];
for (a, b, expected_result) in in_out {
let actual_result =
KalkNum::new_with_imaginary(KalkNum::from(a.0).value, "", KalkNum::from(a.1).value)
.add_without_unit(KalkNum::new_with_imaginary(
KalkNum::from(b.0).value,
"",
KalkNum::from(b.1).value,
));
assert_eq!(actual_result.to_f64(), expected_result.0);
assert_eq!(actual_result.imaginary_to_f64(), expected_result.1);
}
} | rust_cleaned_test_functions.jsonl/132407 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 532
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
41522,
368,
341,
286,
1077,
304,
6068,
284,
7486,
90515,
310,
1781,
15,
69,
21,
19,
11,
220,
15,
69,
21,
19,
701,
320,
15,
69,
21,
19,
11,
220,
15,
69,
21,
19,
701,
320,
15,
69,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_dim() {
let (mm, nn) = (5, 5);
for m in 0..mm {
for n in 0..nn {
let a = Array::random((m, n), Uniform::new(0., 2.));
assert_eq!(a.shape(), &[m, n]);
assert!(a.iter().all(|x| *x < 2.));
assert!(a.iter().all(|x| *x >= 0.));
assert!(a.is_standard_layout());
}
}
} | rust_cleaned_test_functions.jsonl/3398 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 218
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10791,
368,
341,
262,
1077,
320,
3821,
11,
10883,
8,
284,
320,
20,
11,
220,
20,
317,
262,
369,
296,
304,
220,
15,
496,
3821,
341,
286,
369,
308,
304,
220,
15,
496,
7370,
341,
310,
1077,
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... | 3 |
#[test]
fn test_field_range_invert() {
let mut cmd = assert_cmd::Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap();
cmd.args(&["-v", "-d", ",", "-f", "2-4", "sed", "s/./_/"])
.write_stdin("AAA,BBB,CCC,DDD\nEEE,FFF,GGG,HHH\n")
.assert()
.stdout("_AA,BBB,CCC,DDD\n_EE,FFF,GGG,HHH\n");
} | rust_cleaned_test_functions.jsonl/7923 | {
"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,
5013,
9698,
1243,
1621,
368,
341,
286,
1077,
5206,
5439,
284,
2060,
11684,
486,
4062,
486,
66715,
21816,
16978,
17223,
34,
7581,
46,
94126,
4708,
15197,
15454,
543,
286,
5439,
16365,
2099,
1183,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_clock_gettime() {
test_single_clock_gettime(ClockId::CLOCK_REALTIME_COARSE, COARSE_MAX_DIFF_NANOS);
test_single_clock_gettime(ClockId::CLOCK_MONOTONIC_COARSE, COARSE_MAX_DIFF_NANOS);
test_single_clock_gettime(ClockId::CLOCK_REALTIME, HRES_MAX_DIFF_NANOS);
test_single_clock_gettime(ClockId::CLOCK_MONOTONIC, HRES_MAX_DIFF_NANOS);
test_single_clock_gettime(ClockId::CLOCK_BOOTTIME, HRES_MAX_DIFF_NANOS);
test_single_clock_gettime(ClockId::CLOCK_MONOTONIC_RAW, HRES_MAX_DIFF_NANOS);
} | rust_cleaned_test_functions.jsonl/71360 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 274
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23062,
98221,
368,
341,
286,
1273,
19487,
23062,
98221,
3025,
1023,
764,
486,
34,
8044,
30111,
18129,
19628,
79097,
11,
7284,
79097,
6806,
53984,
1604,
1093,
3126,
317,
286,
1273,
19487,
23062,
9822... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_map_schema() {
let schema = Schema::parse_str(r#"{"type": "map", "values": "double"}"#).unwrap();
assert_eq!(Schema::Map(Box::new(Schema::Double)), schema);
} | rust_cleaned_test_functions.jsonl/26527 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 93
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5376,
25371,
368,
341,
286,
1077,
10802,
284,
12539,
486,
6400,
2895,
2601,
55543,
4913,
1313,
788,
330,
2186,
497,
330,
3661,
788,
330,
4331,
9207,
57676,
568,
15454,
543,
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 |
#[test]
fn test_authorize_url_with_extension_response_type() {
let client = new_client();
let url = client.authorize_url_extension(
&ResponseType::new("code token".to_string()),
&vec![("foo", "bar")],
);
assert_eq!(
Url::parse("http://example.com/auth?response_type=code+token&client_id=aaa&foo=bar")
.unwrap(),
url
);
} | rust_cleaned_test_functions.jsonl/12764 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 183
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22938,
551,
2903,
6615,
31035,
9655,
1819,
368,
341,
262,
1077,
2943,
284,
501,
8179,
1428,
262,
1077,
2515,
284,
2943,
16314,
551,
2903,
31035,
1006,
286,
609,
53388,
486,
931,
445,
1851,
3950,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fail_via_result() {
let mut runner = TestRunner::new(Config {
failure_persistence: None,
.. Config::default()
});
let result = runner.run(
&(0u32..10u32), |v| {
if v < 5 {
Ok(())
} else {
Err(TestCaseError::fail("not less than 5"))
}
});
assert_eq!(Err(TestError::Fail("not less than 5".into(), 5)), result);
} | rust_cleaned_test_functions.jsonl/38550 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 289
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22121,
80710,
5287,
368,
341,
286,
1077,
5206,
22259,
284,
3393,
19486,
486,
931,
33687,
341,
310,
7901,
620,
8026,
25,
2240,
345,
310,
5241,
5532,
486,
2258,
741,
286,
1625,
286,
1077,
1102,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_delete_all_in_range_by_writer() {
let path = Builder::new()
.prefix("test_delete_all_in_range_by_writer")
.tempdir()
.unwrap();
let path_str = path.path();
let sst_path = path_str.join("tmp_file").to_str().unwrap().to_owned();
let mut data = vec![];
for i in 1000..5000 {
data.push(i.to_string().as_bytes().to_vec());
}
test_delete_all_in_range(
DeleteStrategy::DeleteByWriter { sst_path },
&data,
&[
Range::new(&data[2], &data[499]),
Range::new(&data[502], &data[999]),
Range::new(&data[1002], &data[1999]),
Range::new(&data[1499], &data[2499]),
Range::new(&data[2502], &data[3999]),
Range::new(&data[3002], &data[3499]),
],
);
} | rust_cleaned_test_functions.jsonl/711 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 505
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11353,
5705,
1243,
9698,
3710,
28908,
368,
341,
286,
1077,
1815,
284,
20626,
486,
931,
741,
310,
659,
11849,
445,
1944,
11353,
5705,
1243,
9698,
3710,
28908,
1138,
310,
659,
3888,
3741,
741,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_filter_multi_3() {
let filter = Filter::new()
.appid(240)
.nand()
.map("de_dust2")
.gametype(&vec!["friendlyfire", "alltalk"])
.end();
assert_eq!(
filter.as_string(),
"\\appid\\240\\nand\\2\\map\\de_dust2\\gametype\\friendlyfire,alltalk"
);
} | rust_cleaned_test_functions.jsonl/4947 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 176
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8727,
25133,
62,
18,
368,
341,
262,
1077,
4051,
284,
12339,
486,
931,
741,
286,
659,
58342,
7,
17,
19,
15,
340,
286,
659,
77,
437,
741,
286,
659,
2186,
445,
450,
814,
590,
17,
1138,
286,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_load_single_dynamic_rule() {
let rules = vec![rule!("fuchsia.com" => "fuchsia.com", "/rolldice" => "/rolldice")];
let dynamic_config = make_rule_config(rules.clone());
let manager = RewriteManagerBuilder::new(Some(&dynamic_config)).unwrap().build();
assert_eq!(manager.list_static().cloned().collect::<Vec<_>>(), vec![]);
assert_eq!(manager.list().cloned().collect::<Vec<_>>(), rules);
} | rust_cleaned_test_functions.jsonl/46494 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 191
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12411,
19487,
45992,
21124,
368,
341,
286,
1077,
5601,
284,
7486,
20703,
12937,
17223,
69,
73391,
905,
1,
589,
330,
69,
73391,
905,
497,
3521,
1080,
507,
558,
1,
589,
3521,
1080,
507,
558,
899,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_file_only_env_nonexistent() -> Result<()> {
setcwd()?;
std::env::set_var("GLOBAL_VALUE", "global test value");
let args = Args {
all_env: false,
vars: None,
file: PathBuf::from_str("all_env.txt")?,
};
let mut output = Vec::new();
let result = run(args, &mut output);
assert_matches!(result,
Err(e) => {
let msg = e.to_string();
assert!(msg.contains(r##"Variable "GLOBAL_VALUE" not found"##), "Saw error: {}", msg);
}
);
Ok(())
} | rust_cleaned_test_functions.jsonl/131297 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 339
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2458,
18410,
15879,
21637,
64085,
368,
1464,
5714,
71698,
341,
286,
738,
32165,
368,
69493,
286,
1460,
486,
3160,
486,
746,
4612,
445,
16492,
7476,
497,
330,
9752,
1273,
897,
797,
286,
1077,
2827,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_save_unnamed_error() {
Tester::default()
.add_input_chars("modified file\n")
.run("EDIT: SAVE")
.expect_program(None as Option<&str>, "modified file\n")
.expect_err("Unnamed program; please provide a filename")
.check();
} | rust_cleaned_test_functions.jsonl/112762 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 158
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15376,
4907,
30245,
4096,
368,
341,
286,
76816,
486,
2258,
741,
310,
659,
718,
5898,
37418,
445,
27162,
1034,
1699,
1138,
310,
659,
6108,
445,
16949,
25,
50622,
1138,
310,
659,
17119,
25096,
26717... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_codesize_values() {
let mut iter = CodeSize::values();
assert_eq!(iter.size_hint(), (IcedConstants::CODE_SIZE_ENUM_COUNT, Some(IcedConstants::CODE_SIZE_ENUM_COUNT)));
assert_eq!(iter.len(), IcedConstants::CODE_SIZE_ENUM_COUNT);
assert!(iter.next().is_some());
assert_eq!(iter.size_hint(), (IcedConstants::CODE_SIZE_ENUM_COUNT - 1, Some(IcedConstants::CODE_SIZE_ENUM_COUNT - 1)));
assert_eq!(iter.len(), IcedConstants::CODE_SIZE_ENUM_COUNT - 1);
let values: Vec<CodeSize> = CodeSize::values().collect();
assert_eq!(values.len(), IcedConstants::CODE_SIZE_ENUM_COUNT);
for (i, value) in values.into_iter().enumerate() {
assert_eq!(i, value as usize);
}
} | rust_cleaned_test_functions.jsonl/5955 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 289
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38482,
551,
9146,
368,
341,
10217,
5206,
5367,
284,
6119,
1695,
486,
3661,
543,
6948,
10714,
10297,
2015,
2486,
45825,
1507,
320,
40,
1998,
9386,
486,
14866,
4098,
31894,
14672,
11,
4329,
8972,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_purge_empty_accounts() {
solana_logger::setup();
let (genesis_config, mint_keypair) = create_genesis_config(500_000);
let parent = Arc::new(Bank::new(&genesis_config));
let mut bank = parent;
for _ in 0..10 {
let blockhash = bank.last_blockhash();
let pubkey = solana_sdk::pubkey::new_rand();
let tx = system_transaction::transfer(&mint_keypair, &pubkey, 0, blockhash);
bank.process_transaction(&tx).unwrap();
bank.freeze();
bank.squash();
bank = Arc::new(new_from_parent(&bank));
}
bank.freeze();
bank.squash();
bank.force_flush_accounts_cache();
let hash = bank.update_accounts_hash();
bank.clean_accounts(false, false);
assert_eq!(bank.update_accounts_hash(), hash);
let bank0 = Arc::new(new_from_parent(&bank));
let blockhash = bank.last_blockhash();
let keypair = Keypair::new();
let tx = system_transaction::transfer(&mint_keypair, &keypair.pubkey(), 10, blockhash);
bank0.process_transaction(&tx).unwrap();
let bank1 = Arc::new(new_from_parent(&bank0));
let pubkey = solana_sdk::pubkey::new_rand();
let blockhash = bank.last_blockhash();
let tx = system_transaction::transfer(&keypair, &pubkey, 10, blockhash);
bank1.process_transaction(&tx).unwrap();
assert_eq!(bank0.get_account(&keypair.pubkey()).unwrap().lamports(), 10);
assert_eq!(bank1.get_account(&keypair.pubkey()), None);
info!("bank0 purge");
let hash = bank0.update_accounts_hash();
bank0.clean_accounts(false, false);
assert_eq!(bank0.update_accounts_hash(), hash);
assert_eq!(bank0.get_account(&keypair.pubkey()).unwrap().lamports(), 10);
assert_eq!(bank1.get_account(&keypair.pubkey()), None);
info!("bank1 purge");
bank1.clean_accounts(false, false);
assert_eq!(bank0.get_account(&keypair.pubkey()).unwrap().lamports(), 10);
assert_eq!(bank1.get_account(&keypair.pubkey()), None);
assert!(bank0.verify_bank_hash(true));
// Squash and then verify hash_internal value
bank0.freeze();
bank0.squash();
assert!(bank0.verify_bank_hash(true));
bank1.freeze();
bank1.squash();
bank1.update_accounts_hash();
assert!(bank1.verify_bank_hash(true));
// keypair should have 0 tokens on both forks
assert_eq!(bank0.get_account(&keypair.pubkey()), None);
assert_eq!(bank1.get_account(&keypair.pubkey()), None);
bank1.force_flush_accounts_cache();
bank1.clean_accounts(false, false);
assert!(bank1.verify_bank_hash(true));
} | rust_cleaned_test_functions.jsonl/2554 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1262
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
39823,
15124,
55665,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
320,
77894,
5332,
11,
28337,
3097,
12670,
8,
284,
1855,
16322,
13774,
5332,
7,
20,
15,
15,
62,
15,
15,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_bank_unix_timestamp_from_genesis() {
let (genesis_config, _mint_keypair) = create_genesis_config(1);
let mut bank = Arc::new(Bank::new(&genesis_config));
assert_eq!(
genesis_config.creation_time,
bank.unix_timestamp_from_genesis()
);
let slots_per_sec = 1.0
/ (duration_as_s(&genesis_config.poh_config.target_tick_duration)
* genesis_config.ticks_per_slot as f32);
for _i in 0..slots_per_sec as usize + 1 {
bank = Arc::new(new_from_parent(&bank));
}
assert!(bank.unix_timestamp_from_genesis() - genesis_config.creation_time >= 1);
} | rust_cleaned_test_functions.jsonl/2522 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 337
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35733,
80572,
23073,
5673,
16322,
13774,
368,
341,
286,
1077,
320,
77894,
5332,
11,
716,
67791,
3097,
12670,
8,
284,
1855,
16322,
13774,
5332,
7,
16,
317,
286,
1077,
5206,
6073,
284,
19689,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_find_all_refs_field_name() {
check(
r#"
//- /lib.rs
struct Foo {
pub spam<|>: u32,
}
fn main(s: Foo) {
let f = s.spam;
}
"#,
expect![[r#"
spam Field FileId(0) 17..30 21..25 Other
FileId(0) 67..71 Other Read
"#]],
);
} | rust_cleaned_test_functions.jsonl/47772 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 207
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
5705,
60638,
5013,
1269,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
61463,
608,
2740,
25638,
198,
1235,
33428,
341,
262,
6675,
25328,
27,
91,
26818,
575,
18,
17,
345,
630,
8822,
1887,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decrement_1() {
let mut h = Histogram::configure()
.max_value(20_000)
.precision(3)
.build()
.unwrap();
let v = h.properties.linear_max + 2;
let m = 1_000_000;
for _ in 0..m {
h.increment(v).unwrap();
}
for op in 1..m {
h.decrement(v).unwrap();
assert_eq!(h.entries(), m - op);
}
} | rust_cleaned_test_functions.jsonl/82145 | {
"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,
2259,
13477,
62,
16,
368,
341,
286,
1077,
5206,
305,
284,
82138,
486,
21002,
741,
310,
659,
2810,
3142,
7,
17,
15,
62,
15,
15,
15,
340,
310,
659,
27182,
7,
18,
340,
310,
659,
5834,
741,
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... | 3 |
#[test]
fn test_location() {
unsafe {
let ctx = mlirContextCreate();
mlirRegisterAllDialects(ctx);
let loc = mlirLocationUnknownGet(ctx);
let c_to_print = CString::new("newmod").expect("CString::new failed");
let r = mlirStringRefCreateFromCString(c_to_print.as_ptr());
let _opstate = mlirOperationStateGet(r, loc);
}
} | rust_cleaned_test_functions.jsonl/40528 | {
"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,
13126,
368,
341,
286,
19860,
341,
310,
1077,
5635,
284,
15739,
404,
1972,
4021,
543,
310,
15739,
404,
8690,
2403,
35,
55056,
82,
7502,
317,
310,
1077,
1329,
284,
15739,
404,
4707,
13790,
1949,
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_optflag_long_arg() {
let args = vec!("--test=20".to_string());
let opts = vec!(optflag("t", "test", "testing"));
let rs = getopts(&args, &opts);
match rs {
Err(UnexpectedArgument(_)) => {},
_ => panic!()
}
} | rust_cleaned_test_functions.jsonl/63992 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15032,
9903,
17799,
6057,
368,
341,
286,
1077,
2827,
284,
7486,
17223,
313,
1944,
28,
17,
15,
3263,
983,
3904,
1423,
286,
1077,
12185,
284,
7486,
10297,
2912,
9903,
445,
83,
497,
330,
1944,
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... | 2 |
#[test]
fn test_accounts_db_purge_keep_live() {
solana_logger::setup();
let some_lamport = 223;
let zero_lamport = 0;
let no_data = 0;
let owner = Account::default().owner;
let account = Account::new(some_lamport, no_data, &owner);
let pubkey = Pubkey::new_rand();
let account2 = Account::new(some_lamport, no_data, &owner);
let pubkey2 = Pubkey::new_rand();
let zero_lamport_account = Account::new(zero_lamport, no_data, &owner);
let accounts = AccountsDB::new_single();
accounts.add_root(0);
let mut current_slot = 1;
accounts.store(current_slot, &[(&pubkey, &account)]);
// Store another live account to slot 1 which will prevent any purge
// since the store count will not be zero
accounts.store(current_slot, &[(&pubkey2, &account2)]);
accounts.add_root(current_slot);
current_slot += 1;
accounts.store(current_slot, &[(&pubkey, &zero_lamport_account)]);
accounts.add_root(current_slot);
assert_load_account(&accounts, current_slot, pubkey, zero_lamport);
current_slot += 1;
accounts.add_root(current_slot);
print_accounts("pre_purge", &accounts);
accounts.clean_accounts();
print_accounts("post_purge", &accounts);
// Make sure the index is not touched
assert_eq!(
accounts
.accounts_index
.read()
.unwrap()
.account_maps
.get(&pubkey)
.unwrap()
.read()
.unwrap()
.len(),
2
);
check_storage(&accounts, 1, 2);
check_storage(&accounts, 2, 1);
} | rust_cleaned_test_functions.jsonl/33681 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 872
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55665,
8685,
620,
39823,
50293,
55203,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
1045,
907,
309,
403,
284,
220,
17,
17,
18,
280,
286,
1077,
7168,
907,
309,
403,
284,
220,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_identity_exhaustive_very_short() {
let alphabet = " \r\n\t*a饭\u{000b}\u{0085}\u{00a0}\u{1680}\u{2001}\u{200a}\u{2028}\u{2029}\u{202f}\u{205f}\u{3000}";
let mut arena = Arena::default();
for length in 0..5 {
for s in (0..length)
.map(|_| alphabet.chars())
.multi_cartesian_product()
{
let s: String = s.into_iter().collect();
let root = arena.parse_str(&s);
assert_eq!(root.to_rope(&arena).to_string(), s);
}
}
} | rust_cleaned_test_functions.jsonl/5622 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 289
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46244,
2702,
15074,
533,
62,
1204,
16673,
368,
341,
262,
1077,
27790,
284,
330,
1124,
81,
1699,
4955,
33742,
99938,
3770,
90,
15,
15,
15,
65,
11035,
84,
90,
15,
15,
23,
20,
11035,
84,
90,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_signature() {
let keypair = Keypair::new();
let fake_keypair = Keypair::new();
let leader = LeaderId::new(keypair.pubkey(), Pubkey::default(), timestamp());
let mut v = CrdsValue::LeaderId(leader);
v.sign(&keypair);
assert!(v.verify());
v.sign(&fake_keypair);
assert!(!v.verify());
} | rust_cleaned_test_functions.jsonl/80561 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 174
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39859,
368,
341,
286,
1077,
1376,
12670,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
12418,
3097,
12670,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
7653,
284,
23030,
764,
486,
931,
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_read_byte_string() {
assert_eq!(
read_byte_string(&cbor_int!(123)),
Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE)
);
assert_eq!(
read_byte_string(&cbor_bool!(true)),
Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE)
);
assert_eq!(
read_byte_string(&cbor_text!("foo")),
Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE)
);
assert_eq!(read_byte_string(&cbor_bytes_lit!(b"")), Ok(Vec::new()));
assert_eq!(
read_byte_string(&cbor_bytes_lit!(b"bar")),
Ok(b"bar".to_vec())
);
assert_eq!(
read_byte_string(&cbor_array![]),
Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE)
);
assert_eq!(
read_byte_string(&cbor_map! {}),
Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE)
);
} | rust_cleaned_test_functions.jsonl/51437 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 534
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
19737,
3904,
368,
341,
286,
2060,
10714,
33673,
310,
1349,
19737,
3904,
2099,
7221,
269,
4042,
10297,
16,
17,
18,
6965,
310,
15495,
7,
1162,
2537,
17,
9875,
48933,
868,
6735,
80002,
4189,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_raw_call_gctask() {
let engine = TestEngineBuilder::new()
.api_version(ApiVersion::V2)
.build()
.unwrap();
let raw_engine = engine.get_rocksdb();
let mut gc_runner = TestGCRunner::new(0);
let mut gc_and_check = |expect_tasks: bool, prefix: &[u8]| {
gc_runner.safe_point(500).gc_raw(&raw_engine);
if let Ok(Some(task)) = gc_runner.gc_receiver.recv_timeout(Duration::new(1, 0)) {
assert!(expect_tasks, "a GC task is expected");
match task {
GcTask::RawGcKeys { keys, .. } => {
assert_eq!(keys.len(), 1);
let got = keys[0].as_encoded();
let expect = Key::from_encoded_slice(prefix);
assert_eq!(got, &expect.as_encoded()[1..]);
}
_ => unreachable!(),
}
return;
}
assert!(!expect_tasks, "no GC task is expected");
};
let user_key_del = b"r\0aaaaaaaaaaa";
let user_key_not_del = b"r\0zzzzzzzzzzz";
let test_raws = vec![
(user_key_not_del, 630, false),
(user_key_not_del, 620, false),
(user_key_not_del, 610, false),
(user_key_not_del, 430, false),
(user_key_not_del, 420, false),
(user_key_not_del, 410, false),
(user_key_del, 9, true),
(user_key_del, 5, false),
(user_key_del, 1, false),
];
let modifies = test_raws
.into_iter()
.map(|(key, ts, is_delete)| {
(
make_key(key, ts),
ApiV2::encode_raw_value(RawValue {
user_value: &[0; 10][..],
expire_ts: Some(TimeStamp::max().into_inner()),
is_delete,
}),
)
})
.map(|(k, v)| Modify::Put(CF_DEFAULT, Key::from_encoded_slice(k.as_slice()), v))
.collect();
let ctx = Context {
api_version: ApiVersion::V2,
..Default::default()
};
let batch = WriteData::from_modifies(modifies);
engine.write(&ctx, batch).unwrap();
let check_key_del = make_key(user_key_del, 1);
let (prefix_del, _commit_ts) = ApiV2::split_ts(check_key_del.as_slice()).unwrap();
gc_and_check(true, prefix_del);
let range_start_key =
keys::data_key(ApiV2::encode_raw_key(user_key_del, None).as_encoded());
let range_end_key = keys::data_key(
ApiV2::encode_raw_key(user_key_not_del, Some(TimeStamp::new(1))).as_encoded(),
);
raw_engine
.delete_ranges_cf(
CF_DEFAULT,
DeleteStrategy::DeleteByKey,
&[Range::new(
range_start_key.as_slice(),
range_end_key.as_slice(),
)],
)
.unwrap();
let user_key_expire = b"r\0bbbbbbbbbbb";
let test_expired_raws = vec![
(user_key_expire, 9, false),
(user_key_expire, 5, false),
(user_key_expire, 1, false),
];
let modifies: Vec<Modify> = test_expired_raws
.into_iter()
.map(|(key, ts, is_delete)| {
(
make_key(key, ts),
ApiV2::encode_raw_value(RawValue {
user_value: &[0; 10][..],
expire_ts: Some(10),
is_delete,
}),
)
})
.map(|(k, v)| Modify::Put(CF_DEFAULT, Key::from_encoded_slice(k.as_slice()), v))
.collect();
let batch = WriteData::from_modifies(modifies);
engine.write(&ctx, batch).unwrap();
let check_key_expire = make_key(user_key_expire, 1);
let (prefix_expired, _commit_ts) = ApiV2::split_ts(check_key_expire.as_slice()).unwrap();
gc_and_check(true, prefix_expired);
} | rust_cleaned_test_functions.jsonl/94368 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2489
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16067,
13429,
1889,
302,
1073,
368,
341,
286,
1077,
4712,
284,
3393,
4571,
3297,
486,
931,
741,
310,
659,
2068,
9438,
65830,
5637,
486,
53,
17,
340,
310,
659,
5834,
741,
310,
659,
15454,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_set_is_superset() {
let a = SgSet::from_iter([1, 3, 5]);
let b = SgSet::from_iter([5, 1]);
let c = SgSet::<_, 4>::from_iter([1, 3, 4, 5]);
assert!(a.is_superset(&b));
assert!(!b.is_superset(&a));
assert!(!a.is_superset(&c));
} | rust_cleaned_test_functions.jsonl/68248 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 147
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
6892,
23723,
44146,
368,
341,
262,
1077,
264,
284,
328,
70,
1649,
486,
1499,
11723,
2561,
16,
11,
220,
18,
11,
220,
20,
2558,
262,
1077,
293,
284,
328,
70,
1649,
486,
1499,
11723,
2561,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_increment_ip() {
crate::init().unwrap();
assert_eq!(Some(ip!("10.0.0.1")), increment_ip(ip!("10.0.0.0")));
assert_eq!(Some(ip!("10.10.10.11")), increment_ip(ip!("10.10.10.10")));
assert_eq!(Some(ip!("10.0.1.0")), increment_ip(ip!("10.0.0.255")));
assert_eq!(None, increment_ip(ip!("255.255.255.255")));
} | rust_cleaned_test_functions.jsonl/49219 | {
"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,
51482,
10385,
368,
341,
262,
17717,
486,
2327,
1005,
15454,
1428,
262,
2060,
10714,
10297,
8373,
23443,
17223,
16,
15,
13,
15,
13,
15,
13,
16,
35674,
16252,
10385,
23443,
17223,
16,
15,
13,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vec() {
#[derive(Debug)]
struct S{
pub x : i32,
}
impl Drop for S{
fn drop(&mut self) {
println!("drop {:?}", self);
}
}
let mut a = [S{x:1}, S{x:2}];
//let a0 = a[0];
a[1] = S{x:3};
println!("{:?}", a);
let mut b = S{x:4};
swap(&mut a[0], &mut b);
println!("{:?}", a);
let mut v = Vec::<S>::with_capacity(10);
println!("{:?}", v);
dumpRef("v", &v);
for i in 0..10 {
v.push(S{x: i as i32});
}
dumpRef("v5", &v[5]);
v[5] = S{x:50};
dumpRef("v5", &v[5]);
} | rust_cleaned_test_functions.jsonl/52302 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 454
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
368,
341,
286,
11506,
27098,
42618,
5563,
286,
2036,
328,
515,
310,
6675,
856,
549,
600,
18,
17,
345,
286,
456,
286,
11605,
15733,
369,
328,
515,
310,
5168,
5943,
2099,
6984,
656,
8,
34... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_with_capacity() {
let list: VecList<i32> = VecList::with_capacity(10);
assert_eq!(list.capacity(), 10);
} | rust_cleaned_test_functions.jsonl/11555 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 74
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
2019,
6615,
35603,
368,
341,
286,
1077,
1140,
25,
11312,
852,
21897,
18,
17,
29,
284,
11312,
852,
486,
4197,
35603,
7,
16,
15,
317,
286,
2060,
10714,
10297,
1607,
59168,
1507,
220,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_sinle_node_pre_candidate() {
setup_for_test();
let mut tt = Network::new_with_config(vec![None], true);
tt.send(vec![new_message(1, 1, MessageType::MsgHup, 0)]);
assert_eq!(tt.peers[&1].state, StateRole::Leader);
} | rust_cleaned_test_functions.jsonl/107108 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
78710,
273,
5084,
10442,
62360,
368,
341,
262,
6505,
5478,
4452,
543,
262,
1077,
5206,
17853,
284,
8141,
486,
931,
6615,
5332,
25592,
20703,
4064,
1125,
830,
317,
262,
17853,
5219,
25592,
20703,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iterate_samples() {
let tables = make_small_table_collection();
let treeseq = tables.tree_sequence(TreeSequenceFlags::default()).unwrap();
let mut tree_iter = treeseq.tree_iterator(TreeFlags::SAMPLE_LISTS).unwrap();
if let Some(tree) = tree_iter.next() {
assert!(!tree.flags.contains(TreeFlags::NO_SAMPLE_COUNTS));
assert!(tree.flags.contains(TreeFlags::SAMPLE_LISTS));
let mut s = vec![];
for i in tree.samples(0.into()).unwrap() {
s.push(i);
}
assert_eq!(s.len(), 2);
assert_eq!(
s.len(),
tree.num_tracked_samples(0.into()).unwrap() as usize
);
assert_eq!(s[0], 1);
assert_eq!(s[1], 2);
for u in 1..3 {
let mut s = vec![];
for i in tree.samples(u.into()).unwrap() {
s.push(i);
}
assert_eq!(s.len(), 1);
assert_eq!(s[0], u);
assert_eq!(
s.len(),
tree.num_tracked_samples(u.into()).unwrap() as usize
);
}
} else {
panic!("Expected a tree");
}
} | rust_cleaned_test_functions.jsonl/23029 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 768
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
349,
18297,
368,
341,
286,
1077,
12632,
284,
1281,
31966,
5237,
25019,
543,
286,
1077,
4258,
2367,
80,
284,
12632,
25728,
23735,
80181,
14076,
9195,
486,
2258,
6011,
15454,
1428,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_software_add_to_regression() -> Result<()> {
let mut m = Message {
raw: vec![0u8; 2048],
..Default::default()
};
let s = TextAttribute {
attr: ATTR_SOFTWARE,
text: String::from_utf8(vec![0; 100]).unwrap(),
};
s.add_to(&mut m)?;
Ok(())
} | rust_cleaned_test_functions.jsonl/57156 | {
"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,
39833,
2110,
2891,
2346,
91144,
368,
1464,
5714,
71698,
341,
1066,
262,
1077,
5206,
296,
284,
4856,
341,
286,
7112,
25,
7486,
20703,
15,
84,
23,
26,
220,
17,
15,
19,
23,
1259,
286,
5241,
3675,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_0655_example_2() {
let root = tree![1, 2, 3, null, 4];
let result = vec![
vec_string!["", "", "", "1", "", "", ""],
vec_string!["", "2", "", "", "", "3", ""],
vec_string!["", "", "4", "", "", "", ""],
];
assert_eq!(Solution::print_tree(root), result);
} | rust_cleaned_test_functions.jsonl/59267 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 191
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
15,
21,
20,
20,
39304,
62,
17,
368,
341,
286,
1077,
3704,
284,
4916,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
845,
11,
220,
19,
935,
286,
1077,
1102,
284,
7486,
90515,
310,
7486,
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_overload() {
let test = unsafe { bindings::Test::new1(5.0) };
assert_eq!(test.m_int, 0);
assert_eq!(test.m_double, 5.0);
} | rust_cleaned_test_functions.jsonl/27996 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 77
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15431,
1078,
368,
341,
262,
1077,
1273,
284,
19860,
314,
35700,
486,
2271,
486,
931,
16,
7,
20,
13,
15,
8,
2605,
262,
2060,
10714,
10297,
1944,
744,
4042,
11,
220,
15,
317,
262,
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 |
#[test]
fn test_assert_remove_all() {
let tmpdir = assert_setup!();
let file = tmpdir.mash("foo");
sys::touch(&file).unwrap();
assert_file!(&file);
assert_remove!(&file);
assert_no_file!(&file);
assert_dir!(&tmpdir);
assert_remove_all!(&tmpdir);
assert_no_dir!(&tmpdir);
} | rust_cleaned_test_functions.jsonl/92825 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 178
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16553,
18193,
5705,
368,
341,
286,
1077,
4174,
3741,
284,
2060,
21363,
0,
1428,
286,
1077,
1034,
284,
4174,
3741,
744,
988,
445,
7975,
797,
286,
5708,
486,
22020,
2099,
1192,
568,
15454,
543,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_old_value_check_gc_fence() {
let engine = TestEngineBuilder::new().build().unwrap();
prepare_test_data_for_check_gc_fence(&engine);
let snapshot = engine.snapshot(Default::default()).unwrap();
let mut scanner = ScannerBuilder::new(snapshot, TimeStamp::max(), false)
.range(None, None)
.build_delta_scanner(40.into(), ExtraOp::ReadOldValue)
.unwrap();
let entries: Vec<_> = std::iter::from_fn(|| scanner.next_entry().unwrap()).collect();
let expected_entries_1 = vec![
EntryBuilder::default()
.key(b"k1")
.value(b"v1x")
.primary(b"k1")
.start_ts(49.into())
.commit_ts(50.into())
.old_value(b"v1")
.build_commit(WriteType::Put, true),
EntryBuilder::default()
.key(b"k6")
.value(b"v6x")
.primary(b"k6")
.start_ts(49.into())
.commit_ts(50.into())
.old_value(b"v6")
.build_commit(WriteType::Put, true),
];
assert_eq!(entries, expected_entries_1);
// Lock all the keys at 55 and check again.
for i in b'1'..=b'8' {
let key = &[b'k', i];
let value = &[b'v', i, b'x', b'x'];
must_prewrite_put(&engine, key, value, b"k1", 55);
}
let snapshot = engine.snapshot(Default::default()).unwrap();
let mut scanner = ScannerBuilder::new(snapshot, TimeStamp::max(), false)
.range(None, None)
.build_delta_scanner(40.into(), ExtraOp::ReadOldValue)
.unwrap();
let entries: Vec<_> = std::iter::from_fn(|| scanner.next_entry().unwrap()).collect();
// Shortcut for generating the expected result at current time.
let build_entry = |k, v, old_value| {
let mut b = EntryBuilder::default();
b.key(k).value(v).primary(b"k1").start_ts(55.into());
if let Some(ov) = old_value {
b.old_value(ov);
}
b.build_prewrite(LockType::Put, true)
};
let expected_entries_2 = vec![
build_entry(b"k1", b"v1xx", Some(b"v1x")),
expected_entries_1[0].clone(),
build_entry(b"k2", b"v2xx", None),
build_entry(b"k3", b"v3xx", None),
build_entry(b"k4", b"v4xx", None),
build_entry(b"k5", b"v5xx", None),
build_entry(b"k6", b"v6xx", Some(b"v6x")),
expected_entries_1[1].clone(),
build_entry(b"k7", b"v7xx", None),
build_entry(b"k8", b"v8xx", Some(b"v8")),
];
assert_eq!(entries, expected_entries_2);
// Commit all the locks and check again.
for i in b'1'..=b'8' {
let key = &[b'k', i];
must_commit(&engine, key, 55, 56);
}
let snapshot = engine.snapshot(Default::default()).unwrap();
let mut scanner = ScannerBuilder::new(snapshot, TimeStamp::max(), false)
.range(None, None)
.build_delta_scanner(40.into(), ExtraOp::ReadOldValue)
.unwrap();
let entries: Vec<_> = std::iter::from_fn(|| scanner.next_entry().unwrap()).collect();
// Shortcut for generating the expected result at current time.
let build_entry = |k, v, old_value| {
let mut b = EntryBuilder::default();
b.key(k)
.value(v)
.primary(b"k1")
.start_ts(55.into())
.commit_ts(56.into());
if let Some(ov) = old_value {
b.old_value(ov);
}
b.build_commit(WriteType::Put, true)
};
let expected_entries_2 = vec![
build_entry(b"k1", b"v1xx", Some(b"v1x")),
expected_entries_1[0].clone(),
build_entry(b"k2", b"v2xx", None),
build_entry(b"k3", b"v3xx", None),
build_entry(b"k4", b"v4xx", None),
build_entry(b"k5", b"v5xx", None),
build_entry(b"k6", b"v6xx", Some(b"v6x")),
expected_entries_1[1].clone(),
build_entry(b"k7", b"v7xx", None),
build_entry(b"k8", b"v8xx", Some(b"v8")),
];
assert_eq!(entries, expected_entries_2);
} | rust_cleaned_test_functions.jsonl/88848 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2384
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21108,
3142,
7200,
49423,
81073,
368,
341,
286,
1077,
4712,
284,
3393,
4571,
3297,
486,
931,
1005,
5834,
1005,
15454,
543,
286,
10549,
4452,
1769,
5478,
7200,
49423,
81073,
2099,
8512,
626,
286,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
#[test]
fn test_vsock_device_config() {
const CID: u32 = 52;
let cfg = VsockDeviceConfig {
vsock_id: String::from("vsock"),
guest_cid: CID,
uds_path: String::from("/tmp/vsock.sock"),
};
let mut cfg_list = VsockDeviceConfigs::new();
cfg_list.add(cfg.clone()).unwrap();
assert!(cfg_list.contains_cid(CID));
assert_eq!(
format!("{}", cfg_list.add(cfg.clone()).err().unwrap()),
format!("The guest CID {} is already in use.", CID),
);
let mut cfg2 = cfg.clone();
cfg2.guest_cid = CID + 1;
assert!(cfg_list.add(cfg2).is_ok());
} | rust_cleaned_test_functions.jsonl/74944 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 366
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
13199,
9204,
5332,
368,
341,
286,
733,
68212,
25,
575,
18,
17,
284,
220,
20,
17,
280,
286,
1077,
13286,
284,
647,
13199,
6985,
2648,
341,
310,
348,
13199,
842,
25,
923,
486,
1499,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_settings() {
use crate::window::{Context, Window};
use std::thread;
let window = Window::new((32, 32), "test", Default::default(), &Default::default());
let win_settings = window.settings();
thread::spawn(move || {
let context = Context::new();
assert_eq!(context.settings(), win_settings);
})
.join()
.unwrap();
} | rust_cleaned_test_functions.jsonl/24116 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10853,
368,
341,
262,
990,
17717,
486,
5507,
22964,
1972,
11,
13642,
2440,
262,
990,
1460,
486,
4528,
401,
262,
1077,
3241,
284,
13642,
486,
931,
1188,
18,
17,
11,
220,
18,
17,
701,
330,
1944,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_fuzz_transfers() {
use rand::{seq::SliceRandom, Rng};
use std::collections::BTreeSet;
use std::iter::FromIterator;
const BLOCKS: usize = 50; // number of blocks to create
const MAX_TRANSACTIONS: usize = 20; // maximum number of transactions in a block
let mut rng = rand::thread_rng();
let mut testkit = init_testkit();
let alice_keys = crypto::gen_keypair();
let bob_keys = crypto::gen_keypair();
let keys = &[alice_keys.clone(), bob_keys.clone()];
testkit.create_block_with_transactions(txvec![
TxCreateWallet::sign(ALICE_NAME, &alice_keys.0, &alice_keys.1),
TxCreateWallet::sign(BOB_NAME, &bob_keys.0, &bob_keys.1),
]);
for _ in 0..BLOCKS {
let n_txs = rng.gen_range(0, MAX_TRANSACTIONS); // number of transactions in the block
let txs: Vec<Signed<RawTransaction>> = (0..n_txs)
.map(|_| {
let (sender, receiver) = (
keys.choose(&mut rng).unwrap(),
keys.choose(&mut rng).unwrap(),
);
let amount = rng.gen_range(0, 250);
TxTransfer::sign(&receiver.0, amount, rng.gen::<u64>(), &sender.0, &sender.1)
})
.collect();
testkit.create_block_with_transactions(txs);
// Test invariants that should be maintained during fuzz testing.
let schema = CurrencySchema::new(testkit.snapshot());
let wallets = schema.wallets();
let wallets: Vec<_> = wallets.values().collect();
// There must be 2 wallets in the storage.
assert_eq!(wallets.len(), 2);
// These wallets should belong to Alice and Bob.
assert_eq!(
BTreeSet::from_iter(wallets.iter().map(|w| &w.pub_key)),
BTreeSet::from_iter(vec![&alice_keys.0, &bob_keys.0])
);
assert_eq!(wallets.iter().map(|w| w.balance).sum::<u64>(), 200);
}
} | rust_cleaned_test_functions.jsonl/25290 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 916
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
8889,
7965,
49793,
368,
341,
262,
990,
10382,
22964,
13262,
486,
33236,
13999,
11,
431,
968,
2440,
262,
990,
1460,
486,
51137,
486,
33,
6533,
1649,
280,
262,
990,
1460,
486,
2015,
486,
3830... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bounding_solve() {
let v = vec![5, 6, 3];
let w = vec![4, 5, 2];
let k = 9;
let problem = crate::build_problem(v, w, k);
let solved = bounding_solve(problem);
dbg!(&solved);
assert_eq!(solved.contained, vec![true, true, false]);
assert_eq!(solved.value, 11);
} | rust_cleaned_test_functions.jsonl/69082 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 219
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
13586,
86246,
368,
341,
310,
1077,
348,
284,
7486,
20703,
20,
11,
220,
21,
11,
220,
18,
935,
310,
1077,
289,
284,
7486,
20703,
19,
11,
220,
20,
11,
220,
17,
935,
310,
1077,
595,
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_from_rust_option() {
let option = Some(99u64);
let c_option: COption<u64> = option.into();
assert_eq!(c_option, COption::Some(99u64));
let expected = c_option.into();
assert_eq!(option, expected);
let option = None;
let c_option: COption<u64> = option.into();
assert_eq!(c_option, COption::None);
let expected = c_option.into();
assert_eq!(option, expected);
} | rust_cleaned_test_functions.jsonl/26758 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 220
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
1710,
590,
9672,
368,
341,
286,
1077,
2999,
284,
4329,
7,
24,
24,
84,
21,
19,
317,
286,
1077,
272,
9672,
25,
356,
5341,
34837,
21,
19,
29,
284,
2999,
39860,
543,
286,
2060,
10714,
1029... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_sub_ibig() {
let test_cases = [
(ibig!(3), ibig!(4), ibig!(7)),
(ibig!(3), ibig!(-4), ibig!(-1)),
(ibig!(-3), ibig!(4), ibig!(1)),
(ibig!(-3), ibig!(-4), ibig!(-7)),
(
ibig!(0x10000000000000000),
ibig!(-4),
ibig!(0xfffffffffffffffc),
),
(
ibig!(0x10000000000000000),
ibig!(_0x200000000000000000000000000000000),
ibig!(_0x200000000000000010000000000000000),
),
(
ibig!(-_0x200000000000000010000000000000000),
ibig!(_0x200000000000000000000000000000000),
ibig!(-0x10000000000000000),
),
(
ibig!(_0x200000000000000010000000000000000),
ibig!(-_0x200000000000000000000000000000000),
ibig!(0x10000000000000000),
),
];
for (a, b, c) in &test_cases {
test_add_sub(a, b, c);
test_add_sub(b, a, c);
}
} | rust_cleaned_test_functions.jsonl/30124 | {
"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,
2891,
5228,
66470,
343,
368,
341,
262,
1077,
1273,
41427,
284,
2278,
286,
320,
579,
343,
10297,
18,
701,
18668,
343,
10297,
19,
701,
18668,
343,
10297,
22,
6965,
286,
320,
579,
343,
10297,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.