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_struct_config_std140() {
assert_eq!(std::mem::size_of::<ConfigStd140>(), 16);
assert_eq!(std::mem::size_of::<u32>(), 4);
assert_eq!(std::mem::align_of::<u32>(), 4);
assert_eq!(memoffset::offset_of!(ConfigStd140, image_width), 0);
assert_eq!(std::mem::size_of::<u32>(), 4);
assert_eq!(std::mem::align_of::<u32>(), 4);
assert_eq!(memoffset::offset_of!(ConfigStd140, image_height), 4);
assert_eq!(std::mem::size_of::<f32>(), 4);
assert_eq!(std::mem::align_of::<f32>(), 4);
assert_eq!(memoffset::offset_of!(ConfigStd140, sharpen_amount), 8);
assert_eq!(std::mem::size_of::<[u8; 4]>(), 4);
assert_eq!(std::mem::align_of::<[u8; 4]>(), 1);
assert_eq!(memoffset::offset_of!(ConfigStd140, _padding0), 12);
} | rust_cleaned_test_functions.jsonl/13697 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 418
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15126,
5332,
15656,
16,
19,
15,
368,
341,
286,
2060,
10714,
10297,
1834,
486,
10536,
486,
2141,
3575,
27638,
2648,
22748,
16,
19,
15,
39019,
220,
16,
21,
317,
286,
2060,
10714,
10297,
1834,
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_admin_direct_message() {
let mut transport = InprocTransport::default();
let mut inproc_listener = transport.listen("internal").unwrap();
let mesh = Mesh::new(512, 128);
let mesh_sender = mesh.get_sender();
let (tx, rx) = channel();
let jh = thread::Builder::new()
.name("test_admin_direct_message".to_string())
.spawn(move || {
let connection = transport.connect("internal").unwrap();
let mut processor =
ServiceProcessor::new(connection, "admin".to_string(), 3, 3, 3).unwrap();
// Add MockService to the processor and start the processor.
let service = MockAdminService::new();
processor.add_service(Box::new(service)).unwrap();
let mut shutdown_handle = processor.start().unwrap();
let _ = rx.recv().unwrap();
shutdown_handle.signal_shutdown();
let _ = rx.recv().unwrap();
shutdown_handle
.wait_for_shutdown()
.expect("Unable to cleanly shutdown");
})
.unwrap();
// this part of the test mimics the splinter daemon sending message to the connected
// service
let connection = inproc_listener.accept().unwrap();
mesh.add(connection, "service_processor".to_string())
.unwrap();
// Receive service connect request and respond with ServiceConnectionResposne with status
// OK
let mut service_request = get_service_connect(mesh.recv().unwrap().payload().to_vec());
assert_eq!(service_request.get_service_id(), "mock_service");
assert_eq!(service_request.get_circuit(), "admin");
let service_response = create_service_connect_response(
service_request.take_correlation_id(),
"admin".to_string(),
)
.unwrap();
mesh_sender
.send("service_processor".to_string(), service_response)
.unwrap();
// request the mock service sends a message without caring about correlation id
let send_msg = create_admin_direct_msg(b"send".to_vec()).unwrap();
mesh_sender
.send("service_processor".to_string(), send_msg)
.unwrap();
let send_response = get_admin_direct_msg(mesh.recv().unwrap().payload().to_vec());
assert_eq!(send_response.get_payload(), b"send_response");
// request the mock service send_and_await a message and blocks until correlation id is
// returned
let send_and_await_msg = create_admin_direct_msg(b"send_and_await".to_vec()).unwrap();
mesh_sender
.send("service_processor".to_string(), send_and_await_msg)
.unwrap();
let mut waiting_response = get_admin_direct_msg(mesh.recv().unwrap().payload().to_vec());
assert_eq!(waiting_response.get_payload(), b"waiting for response");
// respond to send_and_await
let wait_response = create_admin_direct_msg_with_correlation_id(
b"respond to waiting".to_vec(),
waiting_response.take_correlation_id(),
)
.unwrap();
mesh_sender
.send("service_processor".to_string(), wait_response)
.unwrap();
// reply to this provided message
let reply_request = create_admin_direct_msg_with_correlation_id(
b"reply".to_vec(),
"reply_correlation_id".to_string(),
)
.unwrap();
mesh_sender
.send("service_processor".to_string(), reply_request)
.unwrap();
let reply_response = get_admin_direct_msg(mesh.recv().unwrap().payload().to_vec());
assert_eq!(reply_response.get_payload(), b"reply response");
assert_eq!(reply_response.get_correlation_id(), "reply_correlation_id");
tx.send("signal-shutdown").unwrap();
let mut disconnect_req = get_service_disconnect(mesh.recv().unwrap().payload().to_vec());
assert_eq!(disconnect_req.get_service_id(), "mock_service");
assert_eq!(disconnect_req.get_circuit(), "admin");
mesh_sender
.send(
"service_processor".to_string(),
create_service_disconnect_response(
disconnect_req.take_correlation_id(),
"admin".to_string(),
)
.unwrap(),
)
.unwrap();
tx.send("wait-for-shutdown").unwrap();
jh.join().unwrap();
} | rust_cleaned_test_functions.jsonl/127040 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12207,
32871,
6462,
368,
341,
286,
1077,
5206,
7557,
284,
758,
15782,
27560,
486,
2258,
543,
286,
1077,
5206,
304,
15782,
46493,
284,
7557,
22628,
445,
10481,
1827,
15454,
1428,
286,
1077,
11294,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_jobs_are_empty_after_runner_starts() {
let some_job = SomeJob;
let another_job = AnotherJob;
let runner = Runner::new()
.add(Box::new(some_job))
.add(Box::new(another_job))
.run();
assert_eq!(runner.jobs_to_run(), 0);
} | rust_cleaned_test_functions.jsonl/45096 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 164
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37247,
56855,
15124,
19844,
54828,
86552,
368,
341,
286,
1077,
1045,
20298,
284,
4329,
12245,
280,
286,
1077,
2441,
20298,
284,
13293,
12245,
401,
286,
1077,
22259,
284,
44946,
486,
931,
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... | 1 |
#[test]
fn test_assign_to_sysvar_with_feature() {
let mut transaction_context = TransactionContext::new(Vec::new(), 1);
let invoke_context = InvokeContext::new_mock(&mut transaction_context, &[]);
let new_owner = sysvar::id();
let from = Pubkey::new_unique();
let mut from_account = AccountSharedData::new(100, 0, &system_program::id());
assert_eq!(
assign(
&mut from_account,
&from.into(),
&new_owner,
&[from].iter().cloned().collect::<HashSet<_>>(),
&invoke_context,
),
Ok(())
);
} | rust_cleaned_test_functions.jsonl/106200 | {
"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,
20688,
2346,
20344,
947,
6615,
17069,
368,
341,
286,
1077,
5206,
7745,
8467,
284,
17869,
1972,
486,
931,
49923,
486,
931,
1507,
220,
16,
317,
286,
1077,
19873,
8467,
284,
39667,
1972,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_write_i32_vec_to_writer() {
let mut cursor = Cursor::new(vec![]);
let position = cursor.position() as usize;
DictionaryBuilder::write_i32_vec_to_writer(&mut cursor, vec![]).unwrap();
assert_eq!(0, cursor.get_ref()[position]);
DictionaryBuilder::write_i32_vec_to_writer(&mut cursor, vec![1, 2, 3]).unwrap();
assert_eq!(3, cursor.get_ref()[position + 1]);
assert_eq!(
1,
i32::from_le_bytes([
cursor.get_ref()[position + 2],
cursor.get_ref()[position + 3],
cursor.get_ref()[position + 4],
cursor.get_ref()[position + 5],
])
);
assert_eq!(
2,
i32::from_le_bytes([
cursor.get_ref()[position + 6],
cursor.get_ref()[position + 7],
cursor.get_ref()[position + 8],
cursor.get_ref()[position + 9],
])
);
assert_eq!(
3,
i32::from_le_bytes([
cursor.get_ref()[position + 10],
cursor.get_ref()[position + 11],
cursor.get_ref()[position + 12],
cursor.get_ref()[position + 13],
])
);
} | rust_cleaned_test_functions.jsonl/134080 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 524
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
5318,
18,
17,
13251,
2346,
28908,
368,
341,
262,
1077,
5206,
8128,
284,
28067,
486,
931,
25592,
0,
1294,
626,
262,
1077,
2309,
284,
8128,
6187,
368,
438,
22301,
280,
262,
10466,
3297,
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_writeln() {
let mut s = vec![];
let foo = 123;
interpol::writeln!(&mut s, "{foo}").unwrap();
assert_eq!(String::from_utf8(s).unwrap(), "123\n");
} | rust_cleaned_test_functions.jsonl/80890 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 87
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1670,
51097,
368,
341,
262,
1077,
5206,
274,
284,
7486,
0,
40901,
262,
1077,
15229,
284,
220,
16,
17,
18,
280,
262,
22876,
486,
93456,
0,
2099,
6984,
274,
11,
13868,
7975,
92,
1827,
15454,
142... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_signal_flow() {
let mut graph: RouteGraph<S, R> = RouteGraphBuilder::new().with_buffer_size(32).build();
let output = graph.add_node_with_idx(|id| {
Node::with_id(
id,
1,
Box::new(OutputRoute {
output: vec![0.; 32],
position: 0,
}),
vec![],
)
});
let a = graph.add_node_with_idx(|id| create_node(id, vec![output.clone()]));
let b = graph.add_node_with_idx(|id| create_node(id, vec![output.clone()]));
graph.add_node_with_idx(|id| {
Node::with_id(
id,
1,
Box::new(InputRoute {
input: vec![1.; 32],
}),
vec![
Connection::new(a.clone(), 0.5),
Connection::new(b.clone(), 0.5),
],
)
});
graph.topographic_sort();
assert_eq!(graph.has_cycles(), false);
let mut c = ();
deny_alloc(|| {
graph.process(32, &mut c);
});
let output = graph
.with_node_mut(output, |node| {
node.route()
.as_any()
.downcast_ref::<OutputRoute>()
.unwrap()
.output
.clone()
})
.unwrap();
assert_eq!(output, vec![1.; 32]);
} | rust_cleaned_test_functions.jsonl/72323 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 953
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21137,
27441,
368,
341,
286,
1077,
5206,
4771,
25,
9572,
11212,
18858,
11,
431,
29,
284,
9572,
11212,
3297,
486,
931,
1005,
4197,
7776,
2368,
7,
18,
17,
568,
5834,
1428,
286,
1077,
2550,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_267_regression() {
// Checks that skip_field will error appropriately when given a big stack of StartGroup
// https://github.com/danburkert/prost/issues/267
let buf = vec![b'C'; 1 << 20];
<() as Message>::decode(&buf[..]).err().unwrap();
} | rust_cleaned_test_functions.jsonl/8858 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
17,
21,
22,
91144,
368,
341,
286,
442,
24843,
429,
10706,
5013,
686,
1465,
34901,
979,
2661,
264,
2409,
5611,
315,
5145,
2808,
79133,
286,
442,
3703,
1110,
5204,
905,
3446,
276,
11240,
74,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simple_transaction() {
let mut rng: StdRng = SeedableRng::from_seed([1u8; 32]);
let sender = AccountKey::random(&mut rng);
let recipient = AccountKey::random(&mut rng);
let value = 1475 * MILLIMOB_TO_PICOMOB;
let input_credentials = get_input_credentials(&sender, value, &mut rng);
let membership_proofs = input_credentials.membership_proofs.clone();
let key_image = KeyImage::from(&input_credentials.onetime_private_key);
let mut transaction_builder = TransactionBuilder::new(MockFogResolver::default());
transaction_builder.add_input(input_credentials);
let (_txout, confirmation) = transaction_builder
.add_output(
value - MINIMUM_FEE,
&recipient.default_subaddress(),
&mut rng,
)
.unwrap();
let tx = transaction_builder.build(&mut rng).unwrap();
// The transaction should have a single input.
assert_eq!(tx.prefix.inputs.len(), 1);
assert_eq!(tx.prefix.inputs[0].proofs.len(), membership_proofs.len());
let expected_key_images = vec![key_image];
assert_eq!(tx.key_images(), expected_key_images);
// The transaction should have one output.
assert_eq!(tx.prefix.outputs.len(), 1);
let output: &TxOut = tx.prefix.outputs.get(0).unwrap();
// The output should belong to the correct recipient.
{
assert!(view_key_matches_output(
&recipient.view_key(),
&RistrettoPublic::try_from(&output.target_key).unwrap(),
&RistrettoPublic::try_from(&output.public_key).unwrap()
));
}
// The output should have the correct value and confirmation number
{
let public_key = RistrettoPublic::try_from(&output.public_key).unwrap();
assert!(confirmation.validate(&public_key, &recipient.view_private_key()));
}
// The transaction should have a valid signature.
assert!(validate_signature(&tx, &mut rng).is_ok());
} | rust_cleaned_test_functions.jsonl/32204 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 948
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
28884,
368,
341,
286,
1077,
5206,
28422,
25,
42517,
49,
968,
284,
35822,
480,
49,
968,
486,
1499,
33809,
2561,
16,
84,
23,
26,
220,
18,
17,
2558,
286,
1077,
4646,
284,
8615,
1592,
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_try_add_capabilities() {
let mut writer = create_writer();
assert_eq!(writer.capabilities.len(), 0);
writer.try_add_capabilities(&[spirv::Capability::Shader]);
assert_eq!(writer.capabilities.len(), 1);
writer.try_add_capabilities(&[spirv::Capability::Shader]);
assert_eq!(writer.capabilities.len(), 1);
} | rust_cleaned_test_functions.jsonl/61028 | {
"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,
53283,
2891,
92092,
368,
341,
286,
1077,
5206,
6916,
284,
1855,
28908,
1428,
286,
2060,
10714,
10297,
18189,
27388,
8456,
19406,
1507,
220,
15,
317,
286,
6916,
48779,
2891,
92092,
2099,
58,
49077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_writer_after_reader() {
let lock = RwLock::<usize>::default();
let shared = Arc::new(AtomicUsize::new(0));
let s = shared.clone();
let lock_thread = thread::spawn(move || {
let _r = lock.read(0);
let _w = lock.write(1);
s.store(1, Ordering::SeqCst);
});
thread::sleep(std::time::Duration::from_secs(2));
if shared.load(Ordering::SeqCst) == 0 {
panic!("This test should always panic");
}
lock_thread.join().unwrap();
} | rust_cleaned_test_functions.jsonl/77533 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 281
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28908,
19844,
22306,
368,
341,
286,
1077,
5296,
284,
55294,
11989,
27638,
51878,
6831,
2258,
543,
286,
1077,
6094,
284,
19689,
486,
931,
7,
65857,
52,
2141,
486,
931,
7,
15,
3237,
286,
1077,
274... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_strtree() {
let mut tree = STRtree::<&str>::with_capacity(10).unwrap();
let point = Geometry::new_from_wkt("POINT(5 5)").unwrap();
let line = Geometry::new_from_wkt("LINESTRING (0 0, 10 0)").unwrap();
let polygon = Geometry::new_from_wkt("POLYGON((2 2, 8 2, 8 8, 2 8, 2 2))").unwrap();
tree.insert(&point, "Point");
tree.insert(&line, "Line");
tree.insert(&polygon, "Polygon");
// Test iterate
let mut items = HashSet::<&str>::new();
tree.iterate(|item| {
items.insert(*item);
});
assert_eq!(items, vec!["Line", "Point", "Polygon"].into_iter().collect());
// Test query
items.clear();
tree.query(&point, |item| {
items.insert(*item);
});
assert_eq!(items, vec!["Point", "Polygon"].into_iter().collect());
} | rust_cleaned_test_functions.jsonl/48570 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 431
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2895,
9344,
368,
341,
286,
1077,
5206,
4916,
284,
12152,
9344,
27638,
5,
495,
6831,
4197,
35603,
7,
16,
15,
568,
15454,
1428,
286,
1077,
1459,
284,
38918,
486,
931,
5673,
1670,
5840,
445,
21531,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bits_per_entry() {
const SAMPLE_SIZE: usize = 1_000_000;
let mut rng = rand::thread_rng();
let keys: Vec<u64> = (0..SAMPLE_SIZE).map(|_| rng.gen()).collect();
let filter = Fuse32::try_from(&keys).unwrap();
let bpe = (filter.len() as f64) * 32.0 / (SAMPLE_SIZE as f64);
assert!(bpe < 36.404, "Bits per entry is {}", bpe);
} | rust_cleaned_test_functions.jsonl/32213 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 195
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20034,
5678,
9078,
368,
341,
286,
733,
62420,
4098,
25,
22301,
284,
220,
16,
62,
15,
15,
15,
62,
15,
15,
15,
280,
286,
1077,
5206,
28422,
284,
10382,
486,
4528,
66849,
543,
286,
1077,
6894,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rosetta() {
assert_eq!(sha_256("Rosetta code"),
"764faf5c61ac315f1497f9dfa542713965b785e5cc2f707d6468d7d1124cdfcf".to_string());
} | rust_cleaned_test_functions.jsonl/30466 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26608,
746,
2565,
368,
341,
262,
2060,
10714,
10297,
15247,
62,
17,
20,
21,
445,
74020,
26527,
2038,
4461,
2290,
330,
22,
21,
19,
76476,
20,
66,
21,
16,
580,
18,
16,
20,
69,
16,
19,
24,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_path_expr() {
check_assist(
inline_local_variable,
"
fn foo() {
let d = 10;
let a<|> = d;
let b = a * 10;
let c = a as usize;
}",
"
fn foo() {
let d = 10;
<|>let b = d * 10;
let c = d as usize;
}",
);
} | rust_cleaned_test_functions.jsonl/60327 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2638,
21915,
368,
341,
286,
1779,
12083,
380,
1006,
310,
7381,
13564,
14635,
345,
310,
6228,
8822,
15229,
368,
341,
262,
1077,
294,
284,
220,
16,
15,
280,
262,
1077,
264,
27,
91,
29,
284,
294,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_main_export_nonexistent() {
let wasm: Vec<u8> = vec![0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00];
let mut checker = EcicChecker::default(&wasm);
assert_eq!(
checker.checks.get_check_status("export-main"),
CheckStatus::Unknown
);
checker.fire();
assert_eq!(
checker.checks.get_check_status("export-main"),
CheckStatus::Nonexistent
);
} | rust_cleaned_test_functions.jsonl/10741 | {
"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,
11027,
27114,
21637,
64085,
368,
341,
286,
1077,
98263,
25,
11312,
34837,
23,
29,
284,
7486,
20703,
15,
87,
15,
15,
11,
220,
15,
87,
21,
16,
11,
220,
15,
87,
22,
18,
11,
220,
15,
87,
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_time_parse_unchecked() {
assert_eq!(Time::parse_unchecked(b"000000"), Time::from_hms(0, 0, 0));
assert_eq!(Time::parse_unchecked(b"012345"), Time::from_hms(1, 23, 45));
assert_eq!(Time::parse_unchecked(b"123456"), Time::from_hms(12, 34, 56));
assert_eq!(Time::parse_unchecked(b"235959"), Time::from_hms(23, 59, 59));
assert_eq!(Time::parse_unchecked(b"999999"), Time::from_hms(99, 99, 99));
} | rust_cleaned_test_functions.jsonl/81399 | {
"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,
3009,
21039,
4907,
7549,
368,
341,
286,
2060,
10714,
10297,
1462,
486,
6400,
4907,
7549,
1883,
1,
15,
15,
15,
15,
15,
15,
3975,
4120,
486,
1499,
1523,
1011,
7,
15,
11,
220,
15,
11,
220,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_highest_index() {
use super::HighestIndex as TestingMethod;
let candles = RandomCandles::default();
let src: Vec<ValueType> = candles.take(300).map(|x| x.close).collect();
(1..255).for_each(|length| {
let mut ma = TestingMethod::new(length, &src[0]).unwrap();
let length = length as usize;
src.iter().enumerate().for_each(|(i, &x)| {
let mut max_value = x;
let mut max_index = 0;
for j in 0..length {
let v = src[i.saturating_sub(j)];
if v > max_value {
max_value = v;
max_index = j;
}
}
assert_eq!(
max_index,
ma.next(&x) as usize,
"{}, {:?}, {:?}",
length,
&src[i.saturating_sub(length)..=i],
ma
);
});
});
} | rust_cleaned_test_functions.jsonl/15552 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 368
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1523,
7504,
3560,
368,
341,
197,
41819,
2256,
486,
96329,
1552,
438,
26768,
3523,
401,
197,
10217,
51205,
284,
10612,
34,
20125,
486,
2258,
1428,
197,
10217,
2286,
25,
11312,
48325,
929,
29,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_from_bool_value() {
assert_eq!(
AMQPValue::try_from(&Value::Bool(false), AMQPType::Boolean),
Some(AMQPValue::Boolean(false))
);
assert_eq!(
AMQPValue::try_from(&Value::Bool(true), AMQPType::Boolean),
Some(AMQPValue::Boolean(true))
);
} | rust_cleaned_test_functions.jsonl/115690 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 190
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
22159,
3142,
368,
341,
286,
2060,
10714,
33673,
310,
6769,
66520,
1130,
486,
1539,
5673,
2099,
1130,
486,
11233,
3576,
701,
6769,
66520,
929,
486,
6890,
1326,
310,
4329,
7,
1402,
66520,
1130... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_fuzz() {
let alphabet = make_alphabet();
let mut arena = Arena::default();
let mut rng: rand::rngs::StdRng = rand::SeedableRng::seed_from_u64(0);
let mut s = String::default();
for _ in 0..10000 {
s.clear();
let length = (rng.next_u32() % 75) as usize;
for _ in 0..length {
s.push(alphabet[(rng.next_u32() as usize) % alphabet.len()])
}
let root = arena.parse_str(&s);
let fix = root.to_rope(&arena).to_string();
assert_eq!(fix, s);
}
} | rust_cleaned_test_functions.jsonl/5623 | {
"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,
46244,
761,
8889,
368,
341,
262,
1077,
27790,
284,
1281,
8418,
18485,
543,
262,
1077,
5206,
24902,
284,
27047,
486,
2258,
1428,
262,
1077,
5206,
28422,
25,
10382,
486,
69890,
82,
486,
22748,
49,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_key_long_comment() {
let key = "options ssh-dss abcdefg comment and other text".parse::<KeyEntry>().unwrap();
assert_eq!(key.options.as_deref(), Some("options"));
assert_eq!(key.key_type, "ssh-dss");
assert_eq!(key.key, "abcdefg");
assert_eq!(key.comment.as_deref(), Some("comment and other text"));
} | rust_cleaned_test_functions.jsonl/31209 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 168
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3097,
17799,
17638,
368,
341,
286,
1077,
1376,
284,
330,
2875,
29230,
1737,
778,
39022,
750,
70,
3980,
323,
1008,
1467,
3263,
6400,
27638,
1592,
5874,
10483,
15454,
543,
286,
2060,
10714,
10297,
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_with_query() {
let c = "with my_customers as (
select distinct c_customer_sk
, c_current_addr_sk
from
( select cs_sold_date_sk sold_date_sk,
cs_bill_customer_sk customer_sk,
cs_item_sk item_sk
from catalog_sales
union all
select ws_sold_date_sk sold_date_sk,
ws_bill_customer_sk customer_sk,
ws_item_sk item_sk
from web_sales
) cs_or_ws_sales,
item,
date_dim,
customer
where sold_date_sk = d_date_sk
and item_sk = i_item_sk
and i_category = 'Women'
and i_class = 'dresses'
and c_customer_sk = cs_or_ws_sales.customer_sk
and d_moy = 1
and d_year = 1998
)";
let pairs = BqlParser::parse(Rule::with, c)
.unwrap_or_else(|e| panic!("{}", e));
println!("{}", pretty_parse_tree(pairs));
let c = "with wscs as
(select sold_date_sk
,sales_price
from (select ws_sold_date_sk sold_date_sk
,ws_ext_sales_price sales_price
from web_sales )
union all
(select cs_sold_date_sk sold_date_sk
,cs_ext_sales_price sales_price
from catalog_sales))";
let pairs = BqlParser::parse(Rule::with, c)
.unwrap_or_else(|e| panic!("{}", e));
println!("{}", pretty_parse_tree(pairs));
let c = "inv as (select case mean when 0 then null else stdev/mean end cov from foo)";
let pairs = BqlParser::parse(Rule::with_query, c)
.unwrap_or_else(|e| panic!("{}", e));
println!("{}", pretty_parse_tree(pairs));
} | rust_cleaned_test_functions.jsonl/76158 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 951
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
5738,
368,
341,
310,
1077,
272,
284,
330,
4197,
847,
15875,
388,
438,
2399,
3293,
12460,
272,
28840,
33811,
198,
286,
1154,
272,
11080,
7387,
33811,
198,
504,
5872,
286,
320,
3293,
10532,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lookups() {
fn file_pos(offset: u32) -> FilePosition {
FilePosition { file_id: 1, offset }
}
let mut regtest = Chain::new(regtest_genesis());
let mut offset = 0;
let mut limits = vec![];
let mut rows = vec![];
for hex_block in HEX_BLOCKS {
offset += 100; // "separate" blocks within the file
let block_bytes = Vec::from_hex(hex_block).unwrap();
let block: Block = deserialize(&block_bytes).unwrap();
let size = block_bytes.len() as u32;
let row = HeaderRow {
header: block.header,
hash: block.block_hash(),
pos: file_pos(offset),
size,
};
let end = offset + size;
limits.push((offset, end));
offset = end;
rows.push(row.clone());
regtest.update(vec![row]);
}
for ((offset, end), row) in limits.into_iter().zip(rows) {
assert_eq!(None, regtest.get_header_row_for(file_pos(offset - 9)));
assert_eq!(None, regtest.get_header_row_for(file_pos(offset - 4)));
assert_eq!(None, regtest.get_header_row_for(file_pos(offset - 1)));
assert_eq!(Some(&row), regtest.get_header_row_for(file_pos(offset)));
assert_eq!(Some(&row), regtest.get_header_row_for(file_pos(offset + 1)));
assert_eq!(Some(&row), regtest.get_header_row_for(file_pos(offset + 4)));
assert_eq!(Some(&row), regtest.get_header_row_for(file_pos(offset + 9)));
assert_eq!(Some(&row), regtest.get_header_row_for(file_pos(end - 9)));
assert_eq!(Some(&row), regtest.get_header_row_for(file_pos(end - 4)));
assert_eq!(Some(&row), regtest.get_header_row_for(file_pos(end - 1)));
assert_eq!(None, regtest.get_header_row_for(file_pos(end)));
assert_eq!(None, regtest.get_header_row_for(file_pos(end + 1)));
assert_eq!(None, regtest.get_header_row_for(file_pos(end + 4)));
assert_eq!(None, regtest.get_header_row_for(file_pos(end + 9)));
}
} | rust_cleaned_test_functions.jsonl/126194 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1092
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24271,
8602,
368,
341,
286,
5168,
1034,
6479,
26245,
25,
575,
18,
17,
8,
1464,
2887,
3812,
341,
310,
2887,
3812,
314,
1034,
842,
25,
220,
16,
11,
4347,
456,
286,
555,
286,
1077,
5206,
1217,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_where_typecheck() {
assert_cli::Assert::main_binary()
.with_args(&["* | where 5"])
.fails()
.and()
.stderr()
.contains("Expected boolean expression, found")
.unwrap();
} | rust_cleaned_test_functions.jsonl/15995 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 155
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36814,
1819,
2028,
368,
341,
286,
2060,
47147,
486,
8534,
486,
3817,
31761,
741,
310,
659,
4197,
8384,
2099,
1183,
9,
760,
1380,
220,
20,
14108,
310,
659,
59631,
741,
310,
659,
437,
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 |
#[test]
fn test_rent_create_account() {
let lamports = 42;
let account = create_account(lamports, &Rent::default());
let rent = Rent::from_account(&account).unwrap();
assert_eq!(rent, Rent::default());
} | rust_cleaned_test_functions.jsonl/18555 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
83127,
8657,
13500,
368,
341,
286,
1077,
31603,
3394,
284,
220,
19,
17,
280,
286,
1077,
2692,
284,
1855,
13500,
2333,
309,
3394,
11,
609,
67740,
486,
2258,
1423,
286,
1077,
8016,
284,
29737,
486... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_vdpa_kern_is_valid() {
let m = GuestMemoryMmap::<()>::from_ranges(&[(GuestAddress(0), 0x10_0000)]).unwrap();
let vdpa = unwrap_not_found!(VhostKernVdpa::new(VHOST_VDPA_PATH, &m));
let mut config = VringConfigData {
queue_max_size: 32,
queue_size: 32,
flags: 0,
desc_table_addr: 0x1000,
used_ring_addr: 0x2000,
avail_ring_addr: 0x3000,
log_addr: None,
};
assert_eq!(vdpa.is_valid(&config), true);
config.queue_size = 0;
assert_eq!(vdpa.is_valid(&config), false);
config.queue_size = 31;
assert_eq!(vdpa.is_valid(&config), false);
config.queue_size = 33;
assert_eq!(vdpa.is_valid(&config), false);
} | rust_cleaned_test_functions.jsonl/127248 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 423
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
67,
6595,
4698,
932,
6892,
8337,
368,
341,
286,
1077,
296,
284,
26215,
10642,
44,
2186,
27638,
368,
6831,
1499,
58748,
2099,
9697,
37804,
4286,
7,
15,
701,
220,
15,
87,
16,
15,
62,
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_set_item() {
Python::with_gil(|py| {
let list = PyList::new(py, &[2, 3, 5, 7]);
let val = 42i32.to_object(py);
let val2 = 42i32.to_object(py);
assert_eq!(2, list[0].extract::<i32>().unwrap());
list.set_item(0, val).unwrap();
assert_eq!(42, list[0].extract::<i32>().unwrap());
assert!(list.set_item(10, val2).is_err());
});
} | rust_cleaned_test_functions.jsonl/108622 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 257
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
5634,
368,
341,
286,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
341,
310,
1077,
1140,
284,
5355,
852,
486,
931,
46827,
11,
44590,
17,
11,
220,
18,
11,
220,
20,
11,
220,
22,
2558,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tyck_info_pool() {
let type1_id: TypeId = TypeId::of::<TestType1>();
let type2_id: TypeId = TypeId::of::<TestType2>();
let type3_id: TypeId = TypeId::of::<TestType3>();
let mut tyck_info_pool: TyckInfoPool = TyckInfoPool::new();
let tyck_info1: NonNull<TyckInfo> = tyck_info_pool.create_plain_type(type1_id);
let tyck_info2: NonNull<TyckInfo> = tyck_info_pool.create_plain_type(type2_id);
let tyck_info3: NonNull<TyckInfo> = tyck_info_pool.create_plain_type(type3_id);
let tyck_info1_1: NonNull<TyckInfo> = tyck_info_pool.create_plain_type(type1_id);
let tyck_info2_1: NonNull<TyckInfo> = tyck_info_pool.create_plain_type(type2_id);
let tyck_info3_1: NonNull<TyckInfo> = tyck_info_pool.create_plain_type(type3_id);
assert_eq!(tyck_info1, tyck_info1_1);
assert_eq!(tyck_info2, tyck_info2_1);
assert_eq!(tyck_info3, tyck_info3_1);
assert_ne!(tyck_info1, tyck_info2);
assert_ne!(tyck_info1, tyck_info3);
assert_ne!(tyck_info2, tyck_info3);
let type4_params: [NonNull<TyckInfo>; 2] = [tyck_info1, tyck_info2];
let type5_params: [NonNull<TyckInfo>; 2] = [tyck_info2, tyck_info3];
let type6_params: [NonNull<TyckInfo>; 2] = [tyck_info1, tyck_info3];
let tyck_info4: NonNull<TyckInfo> =
tyck_info_pool.create_container_type(type3_id, &type4_params);
let tyck_info5: NonNull<TyckInfo> =
tyck_info_pool.create_container_type(type3_id, &type5_params);
let tyck_info6: NonNull<TyckInfo> =
tyck_info_pool.create_container_type(type3_id, &type6_params);
let tyck_info4_1: NonNull<TyckInfo> =
tyck_info_pool.create_container_type(type3_id, &type4_params);
let tyck_info5_1: NonNull<TyckInfo> =
tyck_info_pool.create_container_type(type3_id, &type5_params);
let tyck_info6_1: NonNull<TyckInfo> =
tyck_info_pool.create_container_type(type3_id, &type6_params);
assert_eq!(tyck_info4, tyck_info4_1);
assert_eq!(tyck_info5, tyck_info5_1);
assert_eq!(tyck_info6, tyck_info6_1);
assert_ne!(tyck_info4, tyck_info5);
assert_ne!(tyck_info5, tyck_info6);
assert_ne!(tyck_info4, tyck_info6);
let type7_params: [NonNull<TyckInfo>; 3] = [tyck_info4, tyck_info5, tyck_info6];
let type9_params: [NonNull<TyckInfo>; 3] = [tyck_info6, tyck_info4, tyck_info5];
let tyck_info7: NonNull<TyckInfo> =
tyck_info_pool.create_container_type(type1_id, &type7_params);
let tyck_info8: NonNull<TyckInfo> =
tyck_info_pool.create_container_type(type2_id, &type7_params);
let tyck_info9: NonNull<TyckInfo> =
tyck_info_pool.create_container_type(type1_id, &type9_params);
let tyck_info7_1: NonNull<TyckInfo> =
tyck_info_pool.create_container_type(type1_id, &type7_params);
let tyck_info8_1: NonNull<TyckInfo> =
tyck_info_pool.create_container_type(type2_id, &type7_params);
let tyck_info9_1: NonNull<TyckInfo> =
tyck_info_pool.create_container_type(type1_id, &type9_params);
assert_eq!(tyck_info7, tyck_info7_1);
assert_eq!(tyck_info8, tyck_info8_1);
assert_eq!(tyck_info9, tyck_info9_1);
assert_ne!(tyck_info7, tyck_info8);
assert_ne!(tyck_info7, tyck_info9);
assert_ne!(tyck_info8, tyck_info9);
} | rust_cleaned_test_functions.jsonl/83197 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1787
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53171,
377,
3109,
15709,
368,
341,
286,
1077,
943,
16,
842,
25,
3990,
764,
284,
3990,
764,
486,
1055,
27638,
2271,
929,
16,
3913,
286,
1077,
943,
17,
842,
25,
3990,
764,
284,
3990,
764,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_validate_states() {
let td = Builder::new().prefix("tikv-store-test").tempdir().unwrap();
let worker = LazyWorker::new("snap-manager");
let sched = worker.scheduler();
let kv_db =
engine_test::kv::new_engine(td.path().to_str().unwrap(), None, ALL_CFS, None).unwrap();
let raft_path = td.path().join(Path::new("raft"));
let raft_db =
engine_test::raft::new_engine(raft_path.to_str().unwrap(), None, CF_DEFAULT, None)
.unwrap();
let engines = Engines::new(kv_db, raft_db);
bootstrap_store(&engines, 1, 1).unwrap();
let region = initial_region(1, 1, 1);
prepare_bootstrap_cluster(&engines, ®ion).unwrap();
let build_storage = || -> Result<PeerStorage<KvTestEngine, RaftTestEngine>> {
PeerStorage::new(engines.clone(), ®ion, sched.clone(), 0, "".to_owned())
};
let mut s = build_storage().unwrap();
let mut raft_state = RaftLocalState::default();
raft_state.set_last_index(RAFT_INIT_LOG_INDEX);
raft_state.mut_hard_state().set_term(RAFT_INIT_LOG_TERM);
raft_state.mut_hard_state().set_commit(RAFT_INIT_LOG_INDEX);
let initial_state = s.initial_state().unwrap();
assert_eq!(initial_state.hard_state, *raft_state.get_hard_state());
// last_index < commit_index is invalid.
let raft_state_key = keys::raft_state_key(1);
raft_state.set_last_index(11);
let log_key = keys::raft_log_key(1, 11);
engines
.raft
.put_msg(&log_key, &new_entry(11, RAFT_INIT_LOG_TERM))
.unwrap();
raft_state.mut_hard_state().set_commit(12);
engines.raft.put_msg(&raft_state_key, &raft_state).unwrap();
assert!(build_storage().is_err());
let log_key = keys::raft_log_key(1, 20);
engines
.raft
.put_msg(&log_key, &new_entry(20, RAFT_INIT_LOG_TERM))
.unwrap();
raft_state.set_last_index(20);
engines.raft.put_msg(&raft_state_key, &raft_state).unwrap();
s = build_storage().unwrap();
let initial_state = s.initial_state().unwrap();
assert_eq!(initial_state.hard_state, *raft_state.get_hard_state());
// Missing last log is invalid.
engines.raft.delete(&log_key).unwrap();
assert!(build_storage().is_err());
engines
.raft
.put_msg(&log_key, &new_entry(20, RAFT_INIT_LOG_TERM))
.unwrap();
// applied_index > commit_index is invalid.
let mut apply_state = RaftApplyState::default();
apply_state.set_applied_index(13);
apply_state.mut_truncated_state().set_index(13);
apply_state
.mut_truncated_state()
.set_term(RAFT_INIT_LOG_TERM);
let apply_state_key = keys::apply_state_key(1);
engines
.kv
.put_msg_cf(CF_RAFT, &apply_state_key, &apply_state)
.unwrap();
assert!(build_storage().is_err());
// It should not recover if corresponding log doesn't exist.
apply_state.set_commit_index(14);
apply_state.set_commit_term(RAFT_INIT_LOG_TERM);
engines
.kv
.put_msg_cf(CF_RAFT, &apply_state_key, &apply_state)
.unwrap();
assert!(build_storage().is_err());
let log_key = keys::raft_log_key(1, 14);
engines
.raft
.put_msg(&log_key, &new_entry(14, RAFT_INIT_LOG_TERM))
.unwrap();
raft_state.mut_hard_state().set_commit(14);
s = build_storage().unwrap();
let initial_state = s.initial_state().unwrap();
assert_eq!(initial_state.hard_state, *raft_state.get_hard_state());
// log term miss match is invalid.
engines
.raft
.put_msg(&log_key, &new_entry(14, RAFT_INIT_LOG_TERM - 1))
.unwrap();
assert!(build_storage().is_err());
// hard state term miss match is invalid.
engines
.raft
.put_msg(&log_key, &new_entry(14, RAFT_INIT_LOG_TERM))
.unwrap();
raft_state.mut_hard_state().set_term(RAFT_INIT_LOG_TERM - 1);
engines.raft.put_msg(&raft_state_key, &raft_state).unwrap();
assert!(build_storage().is_err());
// last index < recorded_commit_index is invalid.
raft_state.mut_hard_state().set_term(RAFT_INIT_LOG_TERM);
raft_state.set_last_index(13);
let log_key = keys::raft_log_key(1, 13);
engines
.raft
.put_msg(&log_key, &new_entry(13, RAFT_INIT_LOG_TERM))
.unwrap();
engines.raft.put_msg(&raft_state_key, &raft_state).unwrap();
assert!(build_storage().is_err());
} | rust_cleaned_test_functions.jsonl/12752 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2353
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
22972,
368,
341,
286,
1077,
17941,
284,
20626,
486,
931,
1005,
11849,
445,
83,
1579,
85,
33252,
16839,
1827,
3888,
3741,
1005,
15454,
543,
286,
1077,
11864,
284,
44263,
21936,
486,
931,
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... | 2 |
#[test]
fn test_instruction_get_argument_value() {
let result_1 = Instruction::get_argument_value("-99");
let result_2 = Instruction::get_argument_value("+4");
let result_3 = Instruction::get_argument_value("+0");
let expected_1 = -99;
let expected_2 = 4;
let expected_3 = 0;
assert_eq!(result_1, expected_1);
assert_eq!(result_2, expected_2);
assert_eq!(result_3, expected_3);
} | rust_cleaned_test_functions.jsonl/68840 | {
"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,
54923,
3062,
9025,
3142,
368,
341,
286,
1077,
1102,
62,
16,
284,
29051,
486,
455,
9025,
3142,
13645,
24,
24,
797,
286,
1077,
1102,
62,
17,
284,
29051,
486,
455,
9025,
3142,
34973,
19,
797,
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_does_not_panic() {
use rand::Rng;
let version = "1.0.0-littleendian";
let file_name = "generated_primitive";
let testdata = crate::test_util::arrow_test_data();
let path = format!(
"{}/arrow-ipc-stream/integration/{}/{}.arrow_file",
testdata, version, file_name
);
let original = std::fs::read(path).unwrap();
for _ in 0..1000 {
let mut data = original.clone();
let position: usize = rand::thread_rng().gen_range(0..data.len());
let new_byte: u8 = rand::thread_rng().gen_range(0..u8::MAX);
data[position] = new_byte;
let _ = read_corrupted_ipc(data);
}
} | rust_cleaned_test_functions.jsonl/128633 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 301
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
96374,
7913,
620,
31270,
368,
341,
262,
990,
10382,
486,
49,
968,
26,
4710,
262,
1077,
2319,
284,
330,
16,
13,
15,
13,
15,
2852,
2377,
408,
1103,
876,
262,
1077,
1034,
1269,
284,
330,
16187,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_arrow_reader_single_column() {
let json_values = get_json_array("parquet/generated_simple_numerics/blogs.json");
let projected_json_values = json_values
.into_iter()
.map(|value| match value {
JObject(fields) => {
json!({ "blog_id": fields.get("blog_id").unwrap_or(&JNull).clone()})
}
_ => panic!("Input should be json object array!"),
})
.collect::<Vec<_>>();
let parquet_file_reader =
get_test_reader("parquet/generated_simple_numerics/blogs.parquet");
let max_len = parquet_file_reader.metadata().file_metadata().num_rows() as usize;
let mut arrow_reader = ParquetFileArrowReader::new(parquet_file_reader);
let mut record_batch_reader = arrow_reader
.get_record_reader_by_columns(vec![2], 60)
.expect("Failed to read into array!");
// Verify that the schema was correctly parsed
let original_schema = arrow_reader.get_schema().unwrap().fields().clone();
assert_eq!(1, record_batch_reader.schema().fields().len());
assert_eq!(original_schema[1], record_batch_reader.schema().fields()[0]);
compare_batch_json(&mut record_batch_reader, projected_json_values, max_len);
} | rust_cleaned_test_functions.jsonl/115771 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 596
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46566,
22306,
19487,
8744,
368,
341,
286,
1077,
2951,
9146,
284,
633,
9455,
3858,
445,
1732,
23300,
79372,
30015,
99001,
1211,
3470,
22081,
4323,
3071,
286,
1077,
27348,
9455,
9146,
284,
2951,
9146,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_populate() {
let mut lattice = Lattice::from("ABC", 1, 2);
lattice.insert(0, 1, 1.0, 3); // A
lattice.insert(1, 1, 1.2, 4); // B
lattice.insert(2, 1, 2.5, 5); // C
lattice.insert(0, 2, 3.0, 6); // AB
lattice.insert(1, 2, 4.0, 7); // BC
lattice.insert(0, 3, 2.0, 8); // ABC
let mut probs = vec![0.0; 9];
let p1 = (1.0_f64 + 1.2 + 2.5).exp();
let p2 = (3.0_f64 + 2.5).exp();
let p3 = (1.0_f64 + 4.0).exp();
let p4 = 2.0_f64.exp();
let z = p1 + p2 + p3 + p4;
let log_z = lattice.populate_marginal(1.0, &mut probs);
assert_approx_eq!(log_z, z.ln(), 0.001);
assert_approx_eq!(probs[0], 0.0, 0.001);
assert_approx_eq!(probs[1], 0.0, 0.001);
assert_approx_eq!(probs[2], 0.0, 0.001);
assert_approx_eq!(probs[3], (p1 + p3) / z, 0.001);
assert_approx_eq!(probs[4], (p1) / z, 0.001);
assert_approx_eq!(probs[5], (p1 + p2) / z, 0.001);
assert_approx_eq!(probs[6], (p2) / z, 0.001);
assert_approx_eq!(probs[7], (p3) / z, 0.001);
assert_approx_eq!(probs[8], (p4) / z, 0.001);
} | rust_cleaned_test_functions.jsonl/39797 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 690
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17061,
6334,
368,
341,
286,
1077,
5206,
54272,
284,
444,
31791,
486,
1499,
445,
25411,
497,
220,
16,
11,
220,
17,
317,
286,
54272,
7030,
7,
15,
11,
220,
16,
11,
220,
16,
13,
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... | 1 |
#[test]
fn test_get_mut() {
let mut lock = RwLock::new(NonCopy(10));
*lock.get_mut().unwrap() = NonCopy(20);
assert_eq!(lock.into_inner().unwrap(), NonCopy(20));
} | rust_cleaned_test_functions.jsonl/134541 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 97
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
29523,
368,
341,
286,
1077,
5206,
5296,
284,
55294,
11989,
486,
931,
7,
8121,
12106,
7,
16,
15,
1106,
286,
353,
1023,
670,
29523,
1005,
15454,
368,
284,
11581,
12106,
7,
17,
15,
317,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_seconds_since_midnight() {
assert_eq!(
[0xd0u8, 0x97, 0x1, 0x0],
seconds_since_midnight(29, 0, 0).to_le_bytes()
)
} | rust_cleaned_test_functions.jsonl/13419 | {
"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,
34825,
56262,
43733,
9287,
368,
341,
286,
2060,
10714,
33673,
310,
508,
15,
9703,
15,
84,
23,
11,
220,
15,
87,
24,
22,
11,
220,
15,
87,
16,
11,
220,
15,
87,
15,
1259,
310,
6486,
56262,
437... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mismatch_program() {
let mut processor = processor_stub();
processor.json = r#"{"hello":"world"}"#.to_owned();
processor.program = ".hi".to_owned();
let context = Context::new().unwrap();
let output = processor.run(&context).unwrap();
assert!(output.is_none())
} | rust_cleaned_test_functions.jsonl/90629 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 172
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
24976,
25096,
368,
341,
310,
1077,
5206,
17654,
284,
17654,
62781,
543,
310,
17654,
4323,
284,
435,
55543,
4913,
14990,
3252,
14615,
9207,
57676,
13,
983,
51973,
543,
310,
17654,
45082,
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_t2() {
let oup = exec_target_with_in(TARGET_EXE_PATH, &["-t", "3"], super::IN_DAT_1.as_bytes());
assert_eq!(oup.stderr, "");
assert_eq!(
oup.stdout,
concat!(
"that for strange effects and extraordinary combinations we must go to life itself,\n",
"which is always far more daring than any effort of the imagination.\n",
"A proposition which I took the liberty of doubting.\n",
)
);
assert_eq!(oup.status.success(), true);
} | rust_cleaned_test_functions.jsonl/67524 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 281
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
17,
368,
341,
286,
1077,
5908,
79,
284,
3883,
11123,
6615,
1243,
4140,
16474,
4966,
36,
7944,
11,
609,
1183,
12,
83,
497,
330,
18,
7914,
2256,
486,
687,
36347,
62,
16,
5357,
12524,
1423,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_async_write_partial() {
quickcheck(test as fn(_) -> _);
fn test(encode_ops: PartialWithErrors<GenInterruptedWouldBlock>) {
use stream::decode_all;
let source = "abc".repeat(1024 * 100).into_bytes();
let writer =
PartialAsyncWrite::new(Cursor::new(Vec::new()), encode_ops);
let encoded_output =
test_async_write_worker(&source[..], writer, |w| {
w.into_inner().into_inner()
});
let decoded = decode_all(&encoded_output[..]).unwrap();
assert_eq!(source, &decoded[..]);
}
} | rust_cleaned_test_functions.jsonl/121591 | {
"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,
28346,
9165,
52068,
368,
341,
262,
3974,
2028,
8623,
438,
5168,
48139,
1464,
716,
626,
262,
5168,
1273,
7,
6180,
21959,
25,
24552,
2354,
13877,
27,
9967,
22528,
291,
27989,
4713,
9231,
341,
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_round_real() {
let test_cases = vec![
(
Some(Real::new(-3.12_f64).unwrap()),
Some(Real::new(-3f64).unwrap()),
),
(
Some(Real::new(f64::MAX).unwrap()),
Some(Real::new(f64::MAX).unwrap()),
),
(
Some(Real::new(f64::MIN).unwrap()),
Some(Real::new(f64::MIN).unwrap()),
),
(None, None),
];
for (arg, exp) in test_cases {
let got = RpnFnScalarEvaluator::new()
.push_param(arg)
.evaluate::<Real>(ScalarFuncSig::RoundReal)
.unwrap();
assert_eq!(got, exp);
}
} | rust_cleaned_test_functions.jsonl/9502 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 485
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29896,
15266,
368,
341,
286,
1077,
1273,
41427,
284,
7486,
90515,
310,
2399,
394,
4329,
7,
12768,
486,
931,
4080,
18,
13,
16,
17,
761,
21,
19,
568,
15454,
14702,
394,
4329,
7,
12768,
486,
931,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_coinbase_serialize_json() {
use crypto::random::Random;
for _ in 0..10 {
let address = Address::random().unwrap();
let distance = Random::u64_range(1, 10).unwrap();
let difficulty = Random::u64_range(1, 10).unwrap();
let coinbase_a = Coinbase::new(&address, difficulty, distance).unwrap();
let res = coinbase_a.to_json();
assert!(res.is_ok());
let json = res.unwrap();
let res = Coinbase::from_json(&json);
assert!(res.is_ok());
let coinbase_b = res.unwrap();
assert_eq!(coinbase_a, coinbase_b)
}
} | rust_cleaned_test_functions.jsonl/70437 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 278
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75718,
3152,
88686,
9455,
368,
341,
262,
990,
19028,
486,
11463,
486,
13999,
401,
262,
369,
716,
304,
220,
15,
496,
16,
15,
341,
286,
1077,
2621,
284,
9177,
486,
11463,
1005,
15454,
543,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_part1() {
let passes = fixtures::Fixture::open("day05");
let mut max_pass = 0;
for pass in passes.iter() {
let pass_id = get_seat_id(&pass);
if pass_id > max_pass {
max_pass = pass_id;
}
}
assert_eq!(max_pass, 933);
} | rust_cleaned_test_functions.jsonl/6801 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10495,
16,
368,
341,
286,
1077,
16211,
284,
37664,
486,
18930,
486,
2508,
445,
1292,
15,
20,
797,
286,
1077,
5206,
1932,
15464,
284,
220,
15,
280,
286,
369,
1494,
304,
16211,
19471,
368,
341,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_unicast()
{
let server = setup_listen_server(SockType::SockRdm);
let client = TipcConn::new(SockType::SockRdm).unwrap();
let bytes_sent = client
.unicast(
TEST_MESSAGE.as_bytes(),
server.socket_ref(),
server.node_ref(),
).unwrap();
assert_eq!(bytes_sent as usize, TEST_MESSAGE.len());
assert_message_received(&server, TEST_MESSAGE).unwrap();
} | rust_cleaned_test_functions.jsonl/29800 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 209
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
3525,
559,
741,
515,
262,
1077,
3538,
284,
6505,
79286,
12015,
3759,
1176,
929,
486,
79812,
49,
13849,
626,
262,
1077,
2943,
284,
29873,
66,
9701,
486,
931,
3759,
1176,
929,
486,
79812,
49,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_insert_characters() {
let querier = new_valid_db("insert_characters.db");
let mut characters = Vec::new();
characters.push(models::Character {
name: String::from("Test_Character_Insert_1"),
components: Some(String::from("{ \"interactable\": true }")),
});
characters.push(models::Character {
name: String::from("Test_Character_Insert_2"),
components: Some(String::from("{ \"interactable\": true }")),
});
let inserted = querier.insert_characters(characters.clone());
assert_eq!(2, inserted);
let q_characters =
querier.query_characters(Some("Test_Character_Insert"), None);
assert_eq!(characters[0], q_characters[0]);
assert_eq!(characters[1], q_characters[1]);
} | rust_cleaned_test_functions.jsonl/107696 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 363
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
79060,
368,
341,
286,
1077,
29134,
1268,
284,
501,
8337,
8685,
445,
4208,
79060,
7076,
797,
286,
1077,
5206,
5766,
284,
11312,
486,
931,
1428,
286,
5766,
2552,
20289,
486,
12404,
341,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_keywords_after_if() {
check(
r#"fn quux() { if true { () } $0 }"#,
expect![[r#"
kw unsafe
kw fn
kw const
kw type
kw impl
kw extern
kw use
kw trait
kw static
kw mod
kw match
kw while
kw while let
kw loop
kw if
kw if let
kw for
kw true
kw false
kw let
kw else
kw else if
kw return
kw self
kw super
kw crate
"#]],
);
check_edit(
"else",
r#"fn quux() { if true { () } $0 }"#,
r#"fn quux() { if true { () } else {
$0
} }"#,
);
} | rust_cleaned_test_functions.jsonl/22464 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 714
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51354,
19844,
11119,
368,
341,
286,
1779,
1006,
310,
435,
55543,
8822,
922,
2200,
368,
314,
421,
830,
314,
1719,
335,
400,
15,
335,
57676,
345,
310,
1720,
0,
15505,
81,
2,
698,
394,
29525,
198... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_selection() {
let items = string_vec_to_status(&[
"a/b",
]);
let mut res = StatusTree::default();
res.update(&items).unwrap();
assert!(res.move_selection(MoveSelection::Down));
assert_eq!(res.selection, Some(1));
assert!(res.move_selection(MoveSelection::Left));
assert_eq!(res.selection, Some(0));
} | rust_cleaned_test_functions.jsonl/34453 | {
"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,
23672,
368,
341,
286,
1077,
3589,
284,
914,
13251,
2346,
4773,
2099,
9640,
310,
330,
64,
3470,
497,
715,
286,
22712,
286,
1077,
5206,
592,
284,
8104,
6533,
486,
2258,
543,
286,
592,
5317,
2099,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rpc_get_slot_leaders() {
let rpc = RpcHandler::start();
let bank = rpc.working_bank();
// Test that slot leaders will be returned across epochs
let query_start = 0;
let query_limit = 2 * bank.epoch_schedule().slots_per_epoch;
let request =
create_test_request("getSlotLeaders", Some(json!([query_start, query_limit])));
let result: Vec<String> = parse_success_result(rpc.handle_request_sync(request));
assert_eq!(result.len(), query_limit as usize);
// Test that invalid limit returns an error
let query_start = 0;
let query_limit = 5001;
let request =
create_test_request("getSlotLeaders", Some(json!([query_start, query_limit])));
let response = parse_failure_response(rpc.handle_request_sync(request));
let expected = (
ErrorCode::InvalidParams.code(),
String::from("Invalid limit; max 5000"),
);
assert_eq!(response, expected);
// Test that invalid epoch returns an error
let query_start = 2 * bank.epoch_schedule().slots_per_epoch;
let query_limit = 10;
let request =
create_test_request("getSlotLeaders", Some(json!([query_start, query_limit])));
let response = parse_failure_response(rpc.handle_request_sync(request));
let expected = (
ErrorCode::InvalidParams.code(),
String::from("Invalid slot range: leader schedule for epoch 2 is unavailable"),
);
assert_eq!(response, expected);
} | rust_cleaned_test_functions.jsonl/6305 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 669
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60799,
3062,
27563,
11751,
6393,
368,
341,
286,
1077,
35596,
284,
79961,
3050,
486,
2468,
543,
286,
1077,
6073,
284,
35596,
18282,
287,
35733,
1428,
286,
442,
3393,
429,
9446,
6036,
686,
387,
5927... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_public_symptoms_with_inputs() {
simple_logger::setup();
let breathlessness = Breathlessness {
cause: UserInput::Some(BreathlessnessCause::HurryOrHill),
};
let cough = Cough {
cough_type: UserInput::Some(CoughType::Dry),
days: UserInput::Some(Days { value: 3 }),
status: UserInput::Some(CoughStatus::SameOrSteadilyWorse),
};
let fever = Fever {
days: UserInput::Some(Days { value: 2 }),
highest_temperature: UserInput::Some(FarenheitTemperature { value: 100.5 }),
taken_temperature_today: UserInput::Some(true),
temperature_spot: UserInput::Some(TemperatureSpot::Armpit),
};
let earliest_symptom = EarliestSymptom {
time: UserInput::Some(UnixTime { value: 1590356601 }),
};
let mut symptom_ids_set: HashSet<SymptomId> = HashSet::new();
symptom_ids_set.insert(SymptomId::Cough);
symptom_ids_set.insert(SymptomId::Fever);
symptom_ids_set.insert(SymptomId::Diarrhea);
symptom_ids_set.insert(SymptomId::Breathlessness);
let inputs: SymptomInputs = SymptomInputs {
ids: symptom_ids_set,
cough,
breathlessness,
fever,
earliest_symptom,
};
let public_symptoms = PublicSymptoms::with_inputs(inputs, UnixTime { value: 0 }).unwrap();
debug!("{:?}", public_symptoms);
info!(target: "test_events", "Logging PublicSymptoms: {:?}", public_symptoms);
assert_eq!(CoughSeverity::Dry, public_symptoms.cough_severity);
assert_eq!(FeverSeverity::Mild, public_symptoms.fever_severity);
assert_eq!(true, public_symptoms.breathlessness);
} | rust_cleaned_test_functions.jsonl/116366 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 836
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27074,
26825,
51173,
6615,
28557,
368,
341,
286,
4285,
27413,
486,
15188,
1428,
286,
1077,
11486,
31928,
284,
57192,
31928,
341,
310,
5240,
25,
2657,
2505,
486,
8373,
5349,
265,
587,
31928,
60912,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_display_encoding() {
assert_eq!(Encoding::Plain.to_string(), "PLAIN");
assert_eq!(Encoding::PlainDictionary.to_string(), "PLAIN_DICTIONARY");
assert_eq!(Encoding::Rle.to_string(), "RLE");
assert_eq!(Encoding::BitPacked.to_string(), "BIT_PACKED");
assert_eq!(
Encoding::DeltaBinaryPacked.to_string(),
"DELTA_BINARY_PACKED"
);
assert_eq!(
Encoding::DeltaLengthByteArray.to_string(),
"DELTA_LENGTH_BYTE_ARRAY"
);
assert_eq!(Encoding::DeltaByteArray.to_string(), "DELTA_BYTE_ARRAY");
assert_eq!(Encoding::RleDictionary.to_string(), "RLE_DICTIONARY");
} | rust_cleaned_test_functions.jsonl/126071 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 273
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14825,
37613,
368,
341,
197,
6948,
10714,
10297,
14690,
486,
26982,
2389,
3904,
1507,
330,
90889,
797,
197,
6948,
10714,
10297,
14690,
486,
26982,
8517,
2389,
3904,
1507,
330,
90889,
44663,
3580,
86... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ndarray_from_ca() -> Result<()> {
let ca = Float64Chunked::new("", &[1.0, 2.0, 3.0]);
let ndarr = ca.to_ndarray()?;
assert_eq!(ndarr, ArrayView1::from(&[1.0, 2.0, 3.0]));
let mut builder = ListPrimitiveChunkedBuilder::new("", 10, 10, DataType::Float64);
builder.append_slice(Some(&[1.0, 2.0, 3.0]));
builder.append_slice(Some(&[2.0, 4.0, 5.0]));
builder.append_slice(Some(&[6.0, 7.0, 8.0]));
let list = builder.finish();
let ndarr = list.to_ndarray::<Float64Type>()?;
let expected = array![[1.0, 2.0, 3.0], [2.0, 4.0, 5.0], [6.0, 7.0, 8.0]];
assert_eq!(ndarr, expected);
// test list array that is not square
let mut builder = ListPrimitiveChunkedBuilder::new("", 10, 10, DataType::Float64);
builder.append_slice(Some(&[1.0, 2.0, 3.0]));
builder.append_slice(Some(&[2.0]));
builder.append_slice(Some(&[6.0, 7.0, 8.0]));
let list = builder.finish();
assert!(list.to_ndarray::<Float64Type>().is_err());
Ok(())
} | rust_cleaned_test_functions.jsonl/104230 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 548
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43544,
1653,
5673,
49604,
368,
1464,
5714,
71698,
341,
286,
1077,
2162,
284,
13001,
21,
19,
28304,
291,
486,
931,
19814,
44590,
16,
13,
15,
11,
220,
17,
13,
15,
11,
220,
18,
13,
15,
2558,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_filter() {
::init().unwrap();
let vec = vec![1i32, 2, 3];
let mut it = Iterator::from_vec(vec).filter(|val| val % 2 == 1);
let mut vals = Vec::new();
while let Ok(Some(res)) = it.next() {
vals.push(res);
}
assert_eq!(vals, [1, 3]);
} | rust_cleaned_test_functions.jsonl/50294 | {
"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,
8727,
368,
341,
286,
3504,
2327,
1005,
15454,
1428,
286,
1077,
7486,
284,
7486,
20703,
16,
72,
18,
17,
11,
220,
17,
11,
220,
18,
935,
286,
1077,
5206,
432,
284,
23023,
486,
1499,
13251,
25592,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_join_request_dev_nonce_extraction() {
let data = phy_join_request_payload();
let phy = PhyPayload::new(&data[..]);
assert!(phy.is_ok());
if let MacPayload::JoinRequest(join_request) = phy.unwrap().mac_payload() {
assert_eq!(
join_request.dev_nonce(),
DevNonce::new(&data[17..19]).unwrap()
);
} else {
panic!("failed to parse JoinRequest mac payload");
}
} | rust_cleaned_test_functions.jsonl/81616 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 209
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31017,
7893,
10433,
48508,
94842,
368,
341,
262,
1077,
821,
284,
36455,
31017,
7893,
32813,
543,
262,
1077,
36455,
284,
92582,
29683,
486,
931,
2099,
691,
95874,
10149,
262,
2060,
10297,
12700,
2079... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_auth_float_parsing() {
let auth: Auth = "Sentry sentry_version=2.0, \
sentry_key=public"
.parse()
.unwrap();
assert_eq!(auth.version(), 2);
assert_eq!(auth.public_key(), "public");
assert_eq!(
auth.to_string(),
"Sentry sentry_key=public, \
sentry_version=2"
);
} | rust_cleaned_test_functions.jsonl/119261 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 195
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14014,
17586,
620,
28598,
368,
341,
262,
1077,
4166,
25,
7366,
284,
330,
50,
4085,
3208,
884,
9438,
28,
17,
13,
15,
11,
3044,
2549,
3208,
884,
3097,
28,
888,
698,
286,
659,
6400,
741,
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_avro_3405_writer_add_metadata_success() {
let schema = Schema::parse_str(SCHEMA).unwrap();
let mut writer = Writer::new(&schema, Vec::new());
writer
.add_user_metadata("stringKey".to_string(), String::from("stringValue"))
.unwrap();
writer
.add_user_metadata("strKey".to_string(), "strValue")
.unwrap();
writer
.add_user_metadata("bytesKey".to_string(), b"bytesValue")
.unwrap();
writer
.add_user_metadata("vecKey".to_string(), vec![1, 2, 3])
.unwrap();
let mut record = Record::new(&schema).unwrap();
record.put("a", 27i64);
record.put("b", "foo");
writer.append(record.clone()).unwrap();
writer.append(record.clone()).unwrap();
writer.flush().unwrap();
let result = writer.into_inner().unwrap();
assert_eq!(result.len(), 260);
} | rust_cleaned_test_functions.jsonl/37666 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 462
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26173,
299,
62,
18,
19,
15,
20,
28908,
2891,
22220,
18632,
368,
341,
286,
1077,
10802,
284,
12539,
486,
6400,
2895,
59461,
35839,
568,
15454,
543,
286,
1077,
5206,
6916,
284,
29404,
486,
931,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_typed_arena_drop_small_count() {
DROP_COUNTER.with(|c| c.set(0));
{
let arena: TypedArena<SmallDroppable> = TypedArena::default();
for _ in 0..100 {
// Allocate something with drop glue to make sure it doesn't leak.
arena.alloc(SmallDroppable);
}
// dropping
};
assert_eq!(DROP_COUNTER.with(|c| c.get()), 100);
} | rust_cleaned_test_functions.jsonl/41102 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
32501,
62,
30527,
29584,
31966,
3180,
368,
341,
262,
56942,
48411,
18164,
22428,
66,
91,
272,
980,
7,
15,
1106,
262,
341,
286,
1077,
24902,
25,
50554,
93937,
27,
25307,
35,
75056,
480,
29,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_v32_8() {
let mut data : &[u8] = &[0x8f, 0xff, 0xff, 0xff, 0x7f];
assert_eq!(Ok(0xffffffff), data.read_v32());
} | rust_cleaned_test_functions.jsonl/72926 | {
"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,
6443,
2273,
18,
17,
62,
23,
368,
341,
286,
1077,
5206,
821,
549,
44590,
84,
23,
60,
284,
44590,
15,
87,
23,
69,
11,
220,
15,
9020,
11,
220,
15,
9020,
11,
220,
15,
9020,
11,
220,
15,
87,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_orientation() {
let kml_str = r#"<Orientation>
<heading>45.01</heading>
<tilt>-10.02</tilt>
<roll>0.0</roll>
</Orientation>"#;
let l: Kml = kml_str.parse().unwrap();
assert_eq!(
l,
Kml::Orientation(Orientation {
roll: 0.,
tilt: -10.02,
heading: 45.01,
..Default::default()
})
);
} | rust_cleaned_test_functions.jsonl/94659 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 310
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
66269,
368,
341,
286,
1077,
595,
1014,
2895,
284,
435,
2,
22476,
22332,
397,
310,
366,
11412,
29,
19,
20,
13,
15,
16,
522,
11412,
397,
310,
366,
1646,
83,
38643,
16,
15,
13,
15,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_components() {
macro_rules! t(
(s: $path:expr, $op:ident, $exp:expr) => (
{
let path = Path::new($path);
assert!(path.$op() == ($exp).as_bytes());
}
);
(s: $path:expr, $op:ident, $exp:expr, opt) => (
{
let path = Path::new($path);
let left = path.$op().map(|x| str::from_utf8(x).unwrap());
assert!(left == $exp);
}
);
(v: $path:expr, $op:ident, $exp:expr) => (
{
let arg = $path;
let path = Path::new(arg);
assert!(path.$op() == $exp);
}
);
)
t!(v: b!("a/b/c"), filename, Some(b!("c")));
t!(v: b!("a/b/c", 0xff), filename, Some(b!("c", 0xff)));
t!(v: b!("a/b", 0xff, "/c"), filename, Some(b!("c")));
t!(s: "a/b/c", filename, Some("c"), opt);
t!(s: "/a/b/c", filename, Some("c"), opt);
t!(s: "a", filename, Some("a"), opt);
t!(s: "/a", filename, Some("a"), opt);
t!(s: ".", filename, None, opt);
t!(s: "/", filename, None, opt);
t!(s: "..", filename, None, opt);
t!(s: "../..", filename, None, opt);
t!(v: b!("a/b/c"), dirname, b!("a/b"));
t!(v: b!("a/b/c", 0xff), dirname, b!("a/b"));
t!(v: b!("a/b", 0xff, "/c"), dirname, b!("a/b", 0xff));
t!(s: "a/b/c", dirname, "a/b");
t!(s: "/a/b/c", dirname, "/a/b");
t!(s: "a", dirname, ".");
t!(s: "/a", dirname, "/");
t!(s: ".", dirname, ".");
t!(s: "/", dirname, "/");
t!(s: "..", dirname, "..");
t!(s: "../..", dirname, "../..");
t!(v: b!("hi/there.txt"), filestem, Some(b!("there")));
t!(v: b!("hi/there", 0x80, ".txt"), filestem, Some(b!("there", 0x80)));
t!(v: b!("hi/there.t", 0x80, "xt"), filestem, Some(b!("there")));
t!(s: "hi/there.txt", filestem, Some("there"), opt);
t!(s: "hi/there", filestem, Some("there"), opt);
t!(s: "there.txt", filestem, Some("there"), opt);
t!(s: "there", filestem, Some("there"), opt);
t!(s: ".", filestem, None, opt);
t!(s: "/", filestem, None, opt);
t!(s: "foo/.bar", filestem, Some(".bar"), opt);
t!(s: ".bar", filestem, Some(".bar"), opt);
t!(s: "..bar", filestem, Some("."), opt);
t!(s: "hi/there..txt", filestem, Some("there."), opt);
t!(s: "..", filestem, None, opt);
t!(s: "../..", filestem, None, opt);
t!(v: b!("hi/there.txt"), extension, Some(b!("txt")));
t!(v: b!("hi/there", 0x80, ".txt"), extension, Some(b!("txt")));
t!(v: b!("hi/there.t", 0x80, "xt"), extension, Some(b!("t", 0x80, "xt")));
t!(v: b!("hi/there"), extension, None);
t!(v: b!("hi/there", 0x80), extension, None);
t!(s: "hi/there.txt", extension, Some("txt"), opt);
t!(s: "hi/there", extension, None, opt);
t!(s: "there.txt", extension, Some("txt"), opt);
t!(s: "there", extension, None, opt);
t!(s: ".", extension, None, opt);
t!(s: "/", extension, None, opt);
t!(s: "foo/.bar", extension, None, opt);
t!(s: ".bar", extension, None, opt);
t!(s: "..bar", extension, Some("bar"), opt);
t!(s: "hi/there..txt", extension, Some("txt"), opt);
t!(s: "..", extension, None, opt);
t!(s: "../..", extension, None, opt);
} | rust_cleaned_test_functions.jsonl/105873 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2019
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23258,
368,
341,
286,
18072,
21407,
0,
259,
1006,
310,
320,
82,
25,
400,
2343,
96011,
11,
400,
453,
25,
1713,
11,
400,
4580,
96011,
8,
589,
2399,
394,
341,
503,
1077,
1815,
284,
7933,
486,
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_chi_squared_small() {
let mut chi = ChiSquared::new(0.5);
let mut rng = ::test::rng();
for _ in 0..1000 {
chi.sample(&mut rng);
chi.ind_sample(&mut rng);
}
} | rust_cleaned_test_functions.jsonl/93274 | {
"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,
98826,
54641,
31966,
368,
341,
286,
1077,
5206,
25798,
284,
33282,
88294,
486,
931,
7,
15,
13,
20,
317,
286,
1077,
5206,
28422,
284,
3504,
1944,
486,
69890,
543,
286,
369,
716,
304,
220,
15,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_content_disposition_file_name_re() {
let val = br#"form-data; name="my_field"; filename="file_name.txt""#;
let file_name = CONTENT_DISPOSITION_FILE_NAME_RE.captures(val).unwrap();
assert_eq!(file_name.get(1).unwrap().as_bytes(), b"file_name.txt");
let val = br#"form-data; name="my_field"; filename="file name.txt""#;
let file_name = CONTENT_DISPOSITION_FILE_NAME_RE.captures(val).unwrap();
assert_eq!(file_name.get(1).unwrap().as_bytes(), b"file name.txt");
let val = br#"form-data; filename="file-name.txt""#;
let file_name = CONTENT_DISPOSITION_FILE_NAME_RE.captures(val).unwrap();
assert_eq!(file_name.get(1).unwrap().as_bytes(), b"file-name.txt");
let val = "form-data; filename=\"কখগ-你好.txt\"".as_bytes();
let file_name = CONTENT_DISPOSITION_FILE_NAME_RE.captures(val).unwrap();
assert_eq!(file_name.get(1).unwrap().as_bytes(), "কখগ-你好.txt".as_bytes());
} | rust_cleaned_test_functions.jsonl/98057 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 453
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7495,
9932,
3487,
2458,
1269,
1288,
368,
341,
286,
1077,
1044,
284,
1411,
55543,
627,
13945,
26,
829,
428,
2408,
5013,
5123,
3899,
428,
1192,
1269,
3909,
3014,
2,
280,
286,
1077,
1034,
1269,
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_print_parse() {
let a = ("test", 1u8, 2u32).to_variant();
let a2 = Variant::parse(Some(a.type_()), &a.print(false)).unwrap();
assert_eq!(a, a2);
let a3: Variant = a.to_string().parse().unwrap();
assert_eq!(a, a3);
} | rust_cleaned_test_functions.jsonl/30230 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 146
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10064,
21039,
368,
341,
286,
1077,
264,
284,
3489,
1944,
497,
220,
16,
84,
23,
11,
220,
17,
84,
18,
17,
568,
983,
46112,
1428,
286,
1077,
264,
17,
284,
39292,
486,
6400,
65405,
2877,
4852,
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_insert_data_blobs_basic() {
let entries = make_tiny_test_entries(2);
let shared_blobs = entries.to_blobs();
for (i, b) in shared_blobs.iter().enumerate() {
b.write().unwrap().set_index(i as u64).unwrap();
}
let blob_locks: Vec<_> = shared_blobs.iter().map(|b| b.read().unwrap()).collect();
let blobs: Vec<&Blob> = blob_locks.iter().map(|b| &**b).collect();
let ledger_path = get_tmp_ledger_path("test_insert_data_blobs_basic");
let ledger = DbLedger::open(&ledger_path).unwrap();
let result = ledger.insert_data_blobs(vec![blobs[1]]).unwrap();
assert!(result.len() == 0);
let meta = ledger
.meta_cf
.get(&ledger.db, &MetaCf::key(DEFAULT_SLOT_HEIGHT))
.unwrap()
.expect("Expected new metadata object to be created");
assert!(meta.consumed == 0 && meta.received == 2);
let result = ledger.insert_data_blobs(vec![blobs[0]]).unwrap();
assert_eq!(result, entries);
let meta = ledger
.meta_cf
.get(&ledger.db, &MetaCf::key(DEFAULT_SLOT_HEIGHT))
.unwrap()
.expect("Expected new metadata object to exist");
assert!(meta.consumed == 2 && meta.received == 2);
// Destroying database without closing it first is undefined behavior
drop(ledger);
DbLedger::destroy(&ledger_path).expect("Expected successful database destruction");
} | rust_cleaned_test_functions.jsonl/133180 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 708
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
1769,
880,
68164,
34729,
368,
341,
286,
1077,
10695,
284,
1281,
528,
6441,
4452,
26092,
7,
17,
317,
286,
1077,
6094,
880,
68164,
284,
10695,
2389,
880,
68164,
1428,
286,
369,
320,
72,
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... | 4 |
#[test]
fn test_json_qualified_option_statement() {
let n = OptionStmt {
base: BaseNode::default(),
assignment: Assignment::Member(Box::new(MemberAssgn {
base: BaseNode::default(),
member: MemberExpr {
base: BaseNode::default(),
object: Expression::Identifier(Identifier {
base: BaseNode::default(),
name: "alert".to_string(),
}),
property: PropertyKey::Identifier(Identifier {
base: BaseNode::default(),
name: "state".to_string(),
}),
},
init: Expression::StringLit(StringLit {
base: Default::default(),
value: "Warning".to_string(),
}),
})),
};
let serialized = serde_json::to_string(&n).unwrap();
assert_eq!(
serialized,
r#"{"type":"OptionStatement","assignment":{"type":"MemberAssignment","member":{"type":"MemberExpression","object":{"type":"Identifier","name":"alert"},"property":{"type":"Identifier","name":"state"}},"init":{"type":"StringLiteral","value":"Warning"}}}"#
);
let deserialized: OptionStmt = serde_json::from_str(serialized.as_str()).unwrap();
assert_eq!(deserialized, n)
} | rust_cleaned_test_functions.jsonl/40423 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 615
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9455,
62,
36335,
9672,
37404,
368,
341,
262,
1077,
308,
284,
6959,
31063,
341,
286,
2331,
25,
5351,
1955,
486,
2258,
3148,
286,
16319,
25,
34427,
486,
9366,
67758,
486,
931,
88281,
5615,
4905,
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_message_data_offsets() {
let offsets = SecpSignatureOffsets {
message_data_offset: 99,
message_data_size: 1,
..SecpSignatureOffsets::default()
};
assert_eq!(
test_case(1, &offsets),
Err(Secp256k1Error::InvalidSignature)
);
let offsets = SecpSignatureOffsets {
message_data_offset: 100,
message_data_size: 1,
..SecpSignatureOffsets::default()
};
assert_eq!(
test_case(1, &offsets),
Err(Secp256k1Error::InvalidSignature)
);
let offsets = SecpSignatureOffsets {
message_data_offset: 100,
message_data_size: 1000,
..SecpSignatureOffsets::default()
};
assert_eq!(
test_case(1, &offsets),
Err(Secp256k1Error::InvalidSignature)
);
let offsets = SecpSignatureOffsets {
message_data_offset: std::u16::MAX,
message_data_size: std::u16::MAX,
..SecpSignatureOffsets::default()
};
assert_eq!(
test_case(1, &offsets),
Err(Secp256k1Error::InvalidSignature)
);
} | rust_cleaned_test_functions.jsonl/47858 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 669
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6462,
1769,
56924,
368,
341,
286,
1077,
35046,
284,
4520,
79,
25088,
81095,
341,
310,
1943,
1769,
6917,
25,
220,
24,
24,
345,
310,
1943,
1769,
2368,
25,
220,
16,
345,
310,
5241,
8430,
79,
2508... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cumsum_agg_as_key() -> Result<()> {
let df = df![
"depth" => &[0i32, 1, 2, 3, 4, 5, 6, 7, 8, 9],
"soil" => &["peat", "peat", "peat", "silt", "silt", "silt", "sand", "sand", "peat", "peat"]
]?;
// this checks if the grouper can work with the complex query as a key
let out = df
.lazy()
.groupby(vec![col("soil")
.neq(col("soil").shift_and_fill(1, col("soil").first()))
.cumsum(false)
.alias("key")])
.agg(vec![col("depth").max().keep_name()])
.sort("depth", false)
.collect()?;
assert_eq!(
Vec::from(out.column("key")?.u32()?),
&[Some(0), Some(1), Some(2), Some(3)]
);
assert_eq!(
Vec::from(out.column("depth")?.i32()?),
&[Some(2), Some(5), Some(7), Some(9)]
);
Ok(())
} | rust_cleaned_test_functions.jsonl/22409 | {
"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,
91328,
1242,
83534,
11898,
3097,
368,
1464,
5714,
71698,
341,
262,
1077,
6764,
284,
6764,
90515,
286,
330,
17561,
1,
589,
44590,
15,
72,
18,
17,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
#[test]
fn test_update_stake() {
// Assert that doubling a neuron's stake halves its age
let mut neuron = Neuron::default();
let now = 10;
neuron.cached_neuron_stake_e8s = Tokens::new(5, 0).unwrap().get_e8s();
neuron.aging_since_timestamp_seconds = 0;
neuron.update_stake(Tokens::new(10, 0).unwrap().get_e8s(), now);
assert_eq!(neuron.aging_since_timestamp_seconds, 5);
assert_eq!(
neuron.cached_neuron_stake_e8s,
Tokens::new(10, 0).unwrap().get_e8s()
);
// Increase the stake by a random amount
let mut neuron = Neuron::default();
let now = 10000;
neuron.cached_neuron_stake_e8s = Tokens::new(50, 0).unwrap().get_e8s();
neuron.aging_since_timestamp_seconds = 0;
neuron.update_stake(Tokens::new(58, 0).unwrap().get_e8s(), now);
let expected_aging_since_timestamp_seconds = 1380;
assert_eq!(
neuron.aging_since_timestamp_seconds,
expected_aging_since_timestamp_seconds
);
assert_eq!(
neuron.cached_neuron_stake_e8s,
Tokens::new(58, 0).unwrap().get_e8s()
);
} | rust_cleaned_test_functions.jsonl/1184 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 477
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
1261,
726,
368,
341,
262,
442,
5319,
429,
59015,
264,
48284,
594,
18279,
74112,
1181,
4231,
198,
262,
1077,
5206,
48284,
284,
4182,
36090,
486,
2258,
543,
262,
1077,
1431,
284,
220,
16,
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_encode_frame() {
let mut encoder = Encoder::default();
encoder.lossless = Some(true);
encoder.basic_info.xsize = 3;
encoder.basic_info.ysize = 3;
let frame = BitmapFrame { data: &RGBA_DATA };
let encoded = encoder.encode_frame(&frame).expect("Failed to encode");
let result = decode_memory(&encoded).expect("Failed to decode again");
let basic_info = &result.basic_info;
assert_eq!(basic_info.xsize, 3);
assert_eq!(basic_info.ysize, 3);
assert_eq!(result.frames.len(), 1);
assert_eq!(result.frames[0].data[..], RGBA_DATA);
} | rust_cleaned_test_functions.jsonl/115353 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 242
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
8929,
368,
341,
262,
1077,
5206,
23668,
284,
55115,
486,
2258,
543,
262,
23668,
46043,
1717,
284,
4329,
3715,
317,
262,
23668,
33257,
3109,
1993,
2141,
284,
220,
18,
280,
262,
23668,
33257,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_integer() {
assert!(_0.is_integer());
assert!(_1.is_integer());
assert!(_2.is_integer());
assert!(!_1_2.is_integer());
assert!(!_3_2.is_integer());
assert!(!_NEG1_2.is_integer());
} | rust_cleaned_test_functions.jsonl/830 | {
"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,
6892,
31725,
368,
341,
286,
2060,
0,
2490,
15,
2079,
31725,
1423,
286,
2060,
0,
2490,
16,
2079,
31725,
1423,
286,
2060,
0,
2490,
17,
2079,
31725,
1423,
286,
2060,
0,
67097,
16,
62,
17,
2079,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_returns_err_on_illegal_patterns() {
check_err("alf_loves_cats", WildcardPatternError::NoStars);
check_err("*alf*loves*cats*", WildcardPatternError::TooManyStars);
check_err("*alf*loves*cats", WildcardPatternError::TooManyStars);
check_err("*alf*loves_cats", WildcardPatternError::UnsupportedPattern);
check_err("**alf", WildcardPatternError::UnsupportedPattern);
} | rust_cleaned_test_functions.jsonl/80624 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58900,
9266,
4470,
26743,
6428,
64923,
368,
341,
286,
1779,
9266,
445,
3104,
5560,
2342,
77370,
497,
13630,
4951,
15760,
1454,
486,
2753,
61028,
626,
286,
1779,
9266,
29592,
3104,
9,
385,
2342,
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_assign() {
let new_owner = Pubkey::new(&[9; 32]);
let pubkey = solana_sdk::pubkey::new_rand();
let mut account = AccountSharedData::new(100, 0, &system_program::id());
assert_eq!(
assign(
&mut account,
&pubkey.into(),
&new_owner,
&HashSet::new(),
&MockInvokeContext::new(vec![]),
),
Err(InstructionError::MissingRequiredSignature)
);
assert_eq!(
assign(
&mut account,
&pubkey.into(),
&system_program::id(),
&HashSet::new(),
&MockInvokeContext::new(vec![]),
),
Ok(())
);
let account = RefCell::new(account);
assert_eq!(
process_instruction(
&Pubkey::default(),
vec![KeyedAccount::new(&pubkey, true, &account)],
&bincode::serialize(&SystemInstruction::Assign { owner: new_owner }).unwrap()
),
Ok(())
);
} | rust_cleaned_test_functions.jsonl/73048 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 658
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20688,
368,
341,
286,
1077,
501,
29027,
284,
22611,
792,
486,
931,
2099,
58,
24,
26,
220,
18,
17,
10149,
286,
1077,
95116,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
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_bool_single_column_reader_test_batch_size_divides_into_row_group_size() {
let message_type = "
message test_schema {
REQUIRED BOOLEAN leaf;
}
";
// row group boundaries (25 rows in 3 row groups --> row
let converter = FromConverter::new();
single_column_reader_test::<
BoolType,
BooleanArray,
FromConverter<Vec<Option<bool>>, BooleanArray>,
BoolType,
>(3, 25, 2, message_type, 5, 50, converter);
} | rust_cleaned_test_functions.jsonl/125239 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 286
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22159,
19487,
8744,
22306,
4452,
14534,
2368,
16237,
3341,
45514,
8530,
6288,
2368,
368,
341,
286,
1077,
1943,
1819,
284,
6228,
286,
1943,
1273,
25371,
341,
688,
66577,
59393,
15933,
280,
286,
456,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_zero_args() {
let input = quote! {
struct Zero {
pub zero: ()
}
};
let expected = quote! {
impl::zero::Zero for Zero {
fn zero() {
let __v0 = ();
__v0
}
}
};
let output = reflect::derive(input, derive);
assert_eq!(output.to_string(), expected.to_string());
} | rust_cleaned_test_functions.jsonl/83615 | {
"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,
19359,
8384,
368,
341,
262,
1077,
1946,
284,
12641,
0,
341,
286,
2036,
18306,
341,
310,
6675,
7168,
25,
12668,
286,
456,
262,
3634,
262,
1077,
3601,
284,
12641,
0,
341,
286,
11605,
486,
14154,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_wallet_import_export_with_different_wallet_key() {
let _setup = SetupDefaults::init();
let (export_path, wallet_name) = export_test_wallet();
delete_wallet(&wallet_name, None, None, None).unwrap();
let xtype = "type1";
let id = "id1";
let value = "value1";
::api::vcx::vcx_shutdown(true);
let import_config = json!({
settings::CONFIG_WALLET_NAME: wallet_name.as_str(),
settings::CONFIG_WALLET_KEY: "new key",
settings::CONFIG_EXPORTED_WALLET_PATH: export_path.path,
settings::CONFIG_WALLET_BACKUP_KEY: settings::DEFAULT_WALLET_BACKUP_KEY,
}).to_string();
import(&import_config).unwrap();
open_wallet(&wallet_name, None, None, None).unwrap();
assert_eq!(add_record(xtype, id, value, None).unwrap_err().kind(), VcxErrorKind::DuplicationWalletRecord);
delete_wallet(&wallet_name, None, None, None).unwrap();
} | rust_cleaned_test_functions.jsonl/118712 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 453
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62308,
18434,
27114,
6615,
82741,
62308,
3097,
368,
341,
286,
1077,
716,
15188,
284,
18626,
16273,
486,
2327,
1428,
286,
1077,
320,
1533,
2638,
11,
15085,
1269,
8,
284,
7485,
4452,
62308,
1428,
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_compare_names() {
for &(a, b) in &[
("hello", "world"),
("", "world"),
("123", "hello"),
("123", ""),
("123test", "123"),
("hello", ""),
("hello", "hello"),
("hello123", "hello123"),
("hello123", "hello12"),
("hello12", "hello123"),
("hello01abc", "hello01xyz"),
("hello0abc", "hello0"),
("hello0", "hello0abc"),
("01", "1"),
] {
assert_eq!(compare_names(a, b), a.cmp(b), "{:?} - {:?}", a, b);
}
assert_eq!(compare_names("u8", "u16"), Ordering::Less);
assert_eq!(compare_names("u32", "u16"), Ordering::Greater);
assert_eq!(compare_names("u8_to_f64", "u16_to_f64"), Ordering::Less);
assert_eq!(compare_names("u32_to_f64", "u16_to_f64"), Ordering::Greater);
assert_eq!(compare_names("u16_to_f64", "u16_to_f64"), Ordering::Equal);
assert_eq!(compare_names("u16_to_f32", "u16_to_f64"), Ordering::Less);
} | rust_cleaned_test_functions.jsonl/112255 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 498
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32235,
9187,
368,
341,
262,
369,
22796,
64,
11,
293,
8,
304,
609,
9640,
286,
3489,
14990,
497,
330,
14615,
4461,
286,
3489,
497,
330,
14615,
4461,
286,
3489,
16,
17,
18,
497,
330,
14990,
4461,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_expect_nothing() {
let ctx = TestContext::new();
let cmx1_path = ctx.new_include(
"some1.cmx",
json!({
"program": {
"binary": "bin/hello_world"
}
}),
);
assert_matches!(ctx.check_includes(&cmx1_path, vec![]), Ok(()));
ctx.assert_no_depfile();
let cmx2_path = ctx.new_include(
"some2.cmx",
json!({
"include": [],
"program": {
"binary": "bin/hello_world"
}
}),
);
assert_matches!(ctx.check_includes(&cmx2_path, vec![]), Ok(()));
let cmx3_path = ctx.new_include(
"some3.cmx",
json!({
"include": [ "foo.cmx" ],
"program": {
"binary": "bin/hello_world"
}
}),
);
assert_matches!(ctx.check_includes(&cmx3_path, vec![]), Ok(()));
} | rust_cleaned_test_functions.jsonl/50695 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 657
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68918,
6536,
1596,
368,
341,
286,
1077,
5635,
284,
3393,
1972,
486,
931,
543,
286,
1077,
9961,
87,
16,
2638,
284,
5635,
4618,
37878,
1006,
310,
330,
14689,
16,
520,
18085,
756,
310,
2951,
0,
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_get_cid_from_app_data_2() {
let test_app_data_hash: H256 =
"1FE7C5555B3F9C14FF7C60D90F15F1A5B11A0DA5B1E8AA043582A1B2E1058D0C"
.parse()
.unwrap();
assert_eq!(
get_cid_from_app_data(test_app_data_hash).unwrap(),
String::from("bafybeia747cvkwz7tqkp67da3ehrl4nfwena3jnr5cvainmcugzocbmnbq")
);
} | rust_cleaned_test_functions.jsonl/110889 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 265
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
68699,
5673,
8191,
1769,
62,
17,
368,
341,
286,
1077,
1273,
8191,
1769,
8950,
25,
472,
17,
20,
21,
4035,
310,
330,
16,
11419,
22,
34,
20,
20,
20,
20,
33,
18,
37,
24,
34,
16,
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... | 1 |
#[test]
fn test_personalized_push_messages() {
let mut crds = Crds::default();
let mut push = CrdsGossipPush::default();
let peer_1 = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost(
&Pubkey::new_rand(),
0,
)));
assert_eq!(crds.insert(peer_1.clone(), 0), Ok(None));
let peer_2 = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost(
&Pubkey::new_rand(),
0,
)));
assert_eq!(crds.insert(peer_2.clone(), 0), Ok(None));
let peer_3 = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost(
&Pubkey::new_rand(),
0,
)));
assert_eq!(
push.process_push_message(&mut crds, &Pubkey::default(), peer_3.clone(), 0),
Ok(None)
);
push.refresh_push_active_set(&crds, &HashMap::new(), None, &Pubkey::default(), 0, 1, 1);
// push 3's contact info to 1 and 2 and 3
let new_msg = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost(
&peer_3.pubkey(),
0,
)));
let mut expected = HashMap::new();
expected.insert(peer_1.pubkey(), vec![new_msg.clone()]);
expected.insert(peer_2.pubkey(), vec![new_msg]);
assert_eq!(push.active_set.len(), 3);
assert_eq!(push.new_push_messages(&crds, 0), expected);
} | rust_cleaned_test_functions.jsonl/79136 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 712
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
78035,
1506,
14218,
23428,
368,
341,
286,
1077,
5206,
1560,
5356,
284,
4553,
5356,
486,
2258,
543,
286,
1077,
5206,
4484,
284,
4553,
5356,
38,
41473,
16644,
486,
2258,
543,
286,
1077,
14397,
62,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_consts() {
let context = Context::create();
let bool_type = context.bool_type();
let i8_type = context.i8_type();
let i16_type = context.i16_type();
let i32_type = context.i32_type();
let i64_type = context.i64_type();
let i128_type = context.i128_type();
let f16_type = context.f16_type();
let f32_type = context.f32_type();
let f64_type = context.f64_type();
let f128_type = context.f128_type();
let ppc_f128_type = context.ppc_f128_type();
let bool_val = bool_type.const_all_ones();
let i8_val = i8_type.const_all_ones();
let i16_val = i16_type.const_all_ones();
let i32_val = i32_type.const_all_ones();
let i64_val = i64_type.const_all_ones();
let i128_val = i128_type.const_all_ones();
let f16_val = f16_type.const_float(1.2);
let f32_val = f32_type.const_float(3.4);
let f64_val = f64_type.const_float(5.6);
let f128_val = f128_type.const_float(7.8);
let ppc_f128_val = ppc_f128_type.const_float(9.0);
let vec_val = VectorType::const_vector(&[i8_val]);
let array_val = i8_type.const_array(&[i8_val]);
let arbitrary_precision_int = i64_type.const_int_arbitrary_precision(&[1, 2]);
assert!(bool_val.is_const());
assert!(i8_val.is_const());
assert!(i16_val.is_const());
assert!(i32_val.is_const());
assert!(i64_val.is_const());
assert!(i128_val.is_const());
assert!(f16_val.is_const());
assert!(f32_val.is_const());
assert!(f64_val.is_const());
assert!(f128_val.is_const());
assert!(ppc_f128_val.is_const());
assert!(vec_val.is_const());
assert!(array_val.is_const());
assert!(arbitrary_precision_int.is_const());
assert_eq!(*arbitrary_precision_int.print_to_string(), *CString::new("i64 1").unwrap());
assert!(!vec_val.is_const_string());
assert!(!vec_val.is_constant_vector());
assert!(vec_val.is_constant_data_vector());
assert_eq!(bool_val.get_zero_extended_constant(), Some(1));
assert_eq!(i8_val.get_zero_extended_constant(), Some(u8::max_value() as u64));
assert_eq!(i16_val.get_zero_extended_constant(), Some(u16::max_value() as u64));
assert_eq!(i32_val.get_zero_extended_constant(), Some(u32::max_value() as u64));
assert_eq!(i64_val.get_zero_extended_constant(), Some(u64::max_value() as u64));
assert_eq!(i128_val.get_zero_extended_constant(), None);
assert_eq!(bool_val.get_sign_extended_constant(), Some(-1));
assert_eq!(i8_val.get_sign_extended_constant(), Some(-1));
assert_eq!(i16_val.get_sign_extended_constant(), Some(-1));
assert_eq!(i32_val.get_sign_extended_constant(), Some(-1));
assert_eq!(i64_val.get_sign_extended_constant(), Some(-1));
assert_eq!(i128_val.get_sign_extended_constant(), None);
assert_eq!(f16_val.get_constant(), Some((1.2001953125, false)));
assert_eq!(f32_val.get_constant(), Some((3.4000000953674316, false)));
assert_eq!(f64_val.get_constant(), Some((5.6, false)));
assert_eq!(f128_val.get_constant(), Some((7.8, false)));
assert_eq!(ppc_f128_val.get_constant(), Some((9.0, false)));
// Non const test
let builder = context.create_builder();
let module = context.create_module("fns");
let void_type = context.void_type();
let fn_type = void_type.fn_type(&[i32_type.into(), f32_type.into()], false);
let function = module.add_function("fn", fn_type, None);
let basic_block = context.append_basic_block(&function, "entry");
builder.position_at_end(&basic_block);
let i32_param = function.get_first_param().unwrap().into_int_value();
let f32_param = function.get_nth_param(1).unwrap().into_float_value();
assert!(i32_param.get_zero_extended_constant().is_none());
assert!(f32_param.get_constant().is_none());
} | rust_cleaned_test_functions.jsonl/122314 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1635
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48530,
368,
341,
262,
1077,
2266,
284,
9608,
486,
3182,
543,
262,
1077,
1807,
1819,
284,
2266,
28791,
1819,
543,
262,
1077,
600,
23,
1819,
284,
2266,
8607,
23,
1819,
543,
262,
1077,
600,
16,
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_serialize_deserialize_invalid() {
let serialized = "bjad%%";
let deserialized = Uid::from_str(&serialized);
assert!(deserialized.is_err());
} | rust_cleaned_test_functions.jsonl/58323 | {
"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,
88686,
15768,
9050,
31433,
368,
341,
286,
1077,
32916,
284,
330,
35751,
329,
2769,
876,
286,
1077,
939,
67577,
284,
547,
307,
486,
1499,
2895,
2099,
75277,
317,
286,
2060,
10297,
5799,
67577,
2079... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_find_or_insert() {
let mut m: HashMap<int,int> = HashMap::new();
assert_eq!(*m.find_or_insert(1, 2), 2);
assert_eq!(*m.find_or_insert(1, 3), 2);
} | rust_cleaned_test_functions.jsonl/45624 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
8734,
17678,
368,
341,
286,
1077,
5206,
296,
25,
10528,
4159,
9871,
29,
284,
10528,
486,
931,
543,
286,
2060,
10714,
0,
4071,
76,
2658,
8734,
17678,
7,
16,
11,
220,
17,
701,
220,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_varlist_combine_chr20_bug_case2() {
let mut lst1: Vec<Var> = vec![];
lst1.push(generate_var2(
0,
19,
42449920,
vec!["AAAGCTT".to_string(), "A".to_string()],
));
lst1.push(generate_var2(
1,
19,
42449926,
vec!["T".to_string(), "TAA".to_string()],
));
lst1.push(generate_var2(
2,
19,
42449926,
vec!["T".to_string(), "TAA".to_string()],
));
let mut vlst1 = VarList::new(
lst1,
vec!["chr1".to_string(), "chr2".to_string(), "chr3".to_string()],
)
.unwrap();
let mut vlst2 = VarList::new(
vec![],
vec!["chr1".to_string(), "chr2".to_string(), "chr3".to_string()],
)
.unwrap();
let mut lst3: Vec<Var> = vec![];
lst3.push(generate_var2(
0,
19,
42449920,
vec![
"AAAGCTT".to_string(),
"A".to_string(),
"AAAGCTTAA".to_string(),
],
));
let exp = VarList::new(
lst3,
vec!["chr1".to_string(), "chr2".to_string(), "chr3".to_string()],
)
.unwrap();
vlst1.combine(&mut vlst2).unwrap();
assert_ne!(vlst1.lst.len(), 0);
assert_eq!(vlst1.lst[0].alleles, exp.lst[0].alleles);
assert!(varlist_pos_alleles_eq(vlst1, exp));
} | rust_cleaned_test_functions.jsonl/25122 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 977
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4612,
1607,
72374,
68993,
17,
15,
73232,
19096,
17,
368,
341,
286,
1077,
5206,
18845,
16,
25,
11312,
27,
3962,
29,
284,
7486,
0,
15078,
286,
18845,
16,
2552,
3268,
13220,
4612,
17,
1006,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_comment() {
let text = "Hello, {# foo bar baz #} there!";
let instructions = compile(text).unwrap();
assert_eq!(2, instructions.len());
assert_eq!(&Literal("Hello, "), &instructions[0]);
assert_eq!(&Literal(" there!"), &instructions[1]);
} | rust_cleaned_test_functions.jsonl/18181 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 145
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17638,
368,
972,
286,
1077,
1467,
284,
330,
9707,
11,
314,
2,
15229,
3619,
50247,
671,
92,
1052,
93397,
286,
1077,
11221,
284,
19192,
7235,
568,
15454,
1647,
286,
2060,
10714,
10297,
17,
11,
112... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_quote_spanned_impl() {
let span = Span::call_site();
let tokens = quote_spanned! {span=>
impl<'a, T: ToTokens> ToTokens for &'a T {
fn to_tokens(&self, tokens: &mut TokenStream) {
(**self).to_tokens(tokens)
}
}
};
let expected = concat!(
"impl < 'a , T : ToTokens > ToTokens for & 'a T { ",
"fn to_tokens (& self , tokens : & mut TokenStream) { ",
"(* * self) . to_tokens (tokens) ",
"} ",
"}"
);
assert_eq!(expected, tokens.to_string());
} | rust_cleaned_test_functions.jsonl/53393 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 298
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45236,
37382,
18694,
21007,
368,
341,
262,
1077,
9390,
284,
11903,
486,
6659,
24507,
543,
262,
1077,
11211,
284,
12641,
37382,
18694,
0,
314,
1480,
28,
397,
286,
11605,
18291,
64,
11,
350,
25,
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_invalid_unicode_escape() {
let well_formed = [
r"\u{FF}",
r"\u{0}",
r"\u{F}",
r"\u{10FFFF}",
r"\u{1_0__FF___FF_____}",
];
for c in &well_formed {
assert_invalid_str(c);
}
let invalid = [
r"\u",
r"\u{}",
r"\u{",
r"\u{FF",
r"\u{FFFFFF}",
r"\u{_F}",
r"\u{00FFFFF}",
r"\u{110000}",
];
for c in &invalid {
assert_invalid_str(c);
}
} | rust_cleaned_test_functions.jsonl/4167 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 429
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
54662,
21832,
368,
341,
286,
1077,
1632,
7915,
291,
284,
2278,
310,
435,
11934,
84,
90,
1748,
24375,
310,
435,
11934,
84,
90,
15,
24375,
310,
435,
11934,
84,
90,
37,
24375,
310,
435,
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... | 3 |
#[test]
fn test_simple_update_location() {
let querier = new_valid_db("simple_update_location.db");
let mut location = common_location();
location.description = Some(String::from("updated description."));
assert_eq!(
1,
querier.update_location("Test_Location", location.clone())
);
let got_location = querier.get_location("Test_Location");
assert_eq!(location.clone(), got_location);
} | rust_cleaned_test_functions.jsonl/107690 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 198
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
8882,
13126,
368,
341,
286,
1077,
29134,
1268,
284,
501,
8337,
8685,
445,
22944,
8882,
13126,
7076,
797,
286,
1077,
5206,
3728,
284,
4185,
13126,
543,
286,
3728,
13178,
284,
4329,
2242,
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_router_discovery() {
let dummy_config = Ipv6::DUMMY_CONFIG;
let mut state_builder = StackStateBuilder::default();
let mut ndp_configs = NdpConfigurations::default();
ndp_configs.set_dup_addr_detect_transmits(None);
state_builder.device_builder().set_default_ndp_configs(ndp_configs.clone());
let host = DummyEventDispatcherBuilder::default()
.build_with(state_builder, DummyEventDispatcher::default());
let mut state_builder = StackStateBuilder::default();
state_builder.ipv6_builder().forward(true);
state_builder.device_builder().set_default_ndp_configs(ndp_configs);
let router = DummyEventDispatcherBuilder::default()
.build_with(state_builder, DummyEventDispatcher::default());
let device = DeviceId::new_ethernet(0);
let mut net =
DummyNetwork::new(vec![("host", host), ("router", router)].into_iter(), |ctx, _dev| {
if *ctx == "host" {
vec![("router", device, None)]
} else {
vec![("host", device, None)]
}
});
// Create an interface that is configured to be an advertising interface.
assert_eq!(
device,
net.context("router")
.state_mut()
.add_ethernet_device(dummy_config.remote_mac, Ipv6::MINIMUM_LINK_MTU.into())
);
crate::device::initialize_device(net.context("router"), device);
set_routing_enabled::<_, Ipv6>(net.context("router"), device, true);
let mut ndp_configs = NdpConfigurations::default();
let mut ndp_rc_configs = NdpRouterConfigurations::default();
ndp_rc_configs.set_should_send_advertisements(true);
ndp_configs.set_router_configurations(ndp_rc_configs);
ndp_configs.set_max_router_solicitations(None);
ndp_configs.set_dup_addr_detect_transmits(None);
crate::device::set_ndp_configurations(net.context("router"), device, ndp_configs);
// Create an interface to be the host.
assert_eq!(
device,
net.context("host")
.state_mut()
.add_ethernet_device(dummy_config.local_mac, Ipv6::MINIMUM_LINK_MTU.into())
);
crate::device::initialize_device(net.context("host"), device);
// Host should not know about the router yet.
let router_ll = dummy_config.remote_mac.to_ipv6_link_local().addr();
assert!(!StateContext::<NdpState<EthernetLinkDevice, DummyInstant>, _>::get_state_with(
net.context("host"),
device.id().into()
)
.has_default_router(&router_ll));
// Run the network for `MAX_RA_DELAY_TIME`.
net.run_for(MAX_RA_DELAY_TIME);
// Host should now know about the router
assert!(StateContext::<NdpState<EthernetLinkDevice, DummyInstant>, _>::get_state_with(
net.context("host"),
device.id().into()
)
.has_default_router(&router_ll));
// Making the router a non-advertising interface should make host remove
// it from its default router list.
set_routing_enabled::<_, Ipv6>(net.context("router"), device, false);
// Only need to run for `MAX_INITIAL_RTR_ADVERT_INTERVAL` time since
// router is still currently sending the first
// `MAX_INITIAL_RTR_ADVERTISEMENTS` RAs so the interval between RAs will
// be set to at max `MAX_INITIAL_RTR_ADVERT_INTERVAL`. We know the
// interval will definitely be set to `MAX_INITIAL_RTR_ADVERT_INTERVAL`
// because the normally generated value would be at minimum 200s (see
net.run_for(MAX_INITIAL_RTR_ADVERT_INTERVAL);
// Host should not know about the router anymore.
let router_ll = dummy_config.remote_mac.to_ipv6_link_local().addr();
assert!(!StateContext::<NdpState<EthernetLinkDevice, DummyInstant>, _>::get_state_with(
net.context("host"),
device.id().into()
)
.has_default_router(&router_ll));
} | rust_cleaned_test_functions.jsonl/82822 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1872
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55587,
9932,
7449,
368,
341,
286,
1077,
17292,
5332,
284,
358,
30168,
21,
486,
35,
58673,
12568,
280,
286,
1077,
5206,
1584,
28532,
284,
14284,
1397,
3297,
486,
2258,
543,
286,
1077,
5206,
15581,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_day1_part1() {
let data = input_generator_day1(DATA);
let result = solve_day1_part1(&data);
assert_eq!(result, 7);
} | rust_cleaned_test_functions.jsonl/106864 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 85
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16763,
16,
10495,
16,
368,
341,
286,
1077,
821,
284,
1946,
25813,
16763,
16,
59093,
317,
286,
1077,
1102,
284,
11625,
16763,
16,
10495,
16,
2099,
691,
317,
286,
2060,
10714,
10297,
1382,
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 |
#[test]
fn test_string_array_builder_append_string() {
let mut builder = StringBuilder::new(20);
let var = "hello".to_owned();
builder.append_value(&var).unwrap();
builder.append(true).unwrap();
builder.append_value("world").unwrap();
let string_array = builder.finish();
assert_eq!(3, string_array.len());
assert_eq!(0, string_array.null_count());
assert_eq!("hello", string_array.value(0));
assert_eq!("", string_array.value(1));
assert_eq!("world", string_array.value(2));
assert_eq!(5, string_array.value_offset(2));
assert_eq!(5, string_array.value_length(2));
} | rust_cleaned_test_functions.jsonl/30994 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 302
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
3858,
28532,
26041,
3904,
368,
341,
286,
1077,
5206,
7363,
284,
11410,
486,
931,
7,
17,
15,
626,
286,
1077,
762,
284,
330,
14990,
3263,
983,
51973,
543,
286,
7363,
2057,
3142,
2099,
947,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_version_set_log_and_apply() {
let (_, opt) = make_version();
let mut vs = VersionSet::new(
"db",
opt.clone(),
share(TableCache::new("db", opt.clone(), 100)),
);
assert_eq!(2, vs.new_file_number());
// Simulate NewDB
{
let mut ve = VersionEdit::new();
ve.set_comparator_name("leveldb.BytewiseComparator");
ve.set_log_num(10);
ve.set_next_file(20);
ve.set_last_seq(30);
// Write first manifest to be recovered from.
let manifest = manifest_file_name("db", 19);
let mffile = opt.env.open_writable_file(Path::new(&manifest)).unwrap();
let mut lw = LogWriter::new(mffile);
lw.add_record(&ve.encode()).unwrap();
lw.flush().unwrap();
set_current_file(&opt.env.as_ref(), "db", 19).unwrap();
}
// Recover from new state.
{
vs.recover().unwrap();
assert_eq!(10, vs.log_num);
assert_eq!(21, vs.next_file_num);
assert_eq!(30, vs.last_seq);
assert_eq!(0, vs.current.as_ref().unwrap().borrow().files[0].len());
assert_eq!(0, vs.current.as_ref().unwrap().borrow().files[1].len());
assert_eq!(35, vs.write_snapshot().unwrap());
}
// Simulate compaction by adding a file.
{
let mut ve = VersionEdit::new();
ve.set_log_num(11);
let mut fmd = FileMetaData::default();
fmd.num = 21;
fmd.size = 123;
fmd.smallest = LookupKey::new("abc".as_bytes(), 777)
.internal_key()
.to_vec();
fmd.largest = LookupKey::new("def".as_bytes(), 700)
.internal_key()
.to_vec();
ve.add_file(1, fmd);
vs.log_and_apply(ve).unwrap();
assert!(opt.env.exists(Path::new("db/CURRENT")).unwrap());
assert!(opt.env.exists(Path::new("db/MANIFEST-000019")).unwrap());
// next_file_num and last_seq are untouched by log_and_apply
assert_eq!(21, vs.new_file_number());
assert_eq!(22, vs.next_file_num);
assert_eq!(30, vs.last_seq);
// the following fields are touched by log_and_apply.
assert_eq!(11, vs.log_num);
// The previous "compaction" should have added one file to the first level in the
// current version.
assert_eq!(0, vs.current.as_ref().unwrap().borrow().files[0].len());
assert_eq!(1, vs.current.as_ref().unwrap().borrow().files[1].len());
assert_eq!(63, vs.write_snapshot().unwrap());
}
} | rust_cleaned_test_functions.jsonl/41933 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1456
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9438,
2602,
5224,
8378,
36551,
368,
341,
286,
1077,
39464,
3387,
8,
284,
1281,
9438,
543,
286,
1077,
5206,
6165,
284,
6079,
1649,
486,
931,
1006,
310,
330,
1999,
756,
310,
3387,
15997,
3148,
310... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cant_send_to_stopped() {
let system = ActorSystem::create(ActorSystemConfig::default().thread_pool_size(2));
let aid = system.spawn().with((), simple_handler).unwrap();
system.stop_actor(&aid);
assert_eq!(false, system.is_actor_alive(&aid));
// Make sure that the actor is actually stopped and can't get more messages.
match aid.send(Message::new(42 as i32)) {
Err(AidError::ActorAlreadyStopped) => assert!(true), // all OK!
Ok(_) => panic!("Expected the actor to be shut down!"),
Err(e) => panic!("Unexpected error: {:?}", e),
}
} | rust_cleaned_test_functions.jsonl/51705 | {
"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,
666,
517,
13565,
2346,
1261,
17573,
368,
341,
286,
1077,
1849,
284,
24718,
2320,
486,
3182,
7,
18870,
2320,
2648,
486,
2258,
1005,
4528,
15709,
2368,
7,
17,
1106,
286,
1077,
12296,
284,
1849,
59... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bad_environment() {
let xd = BaseDirectories::with_env("", "", &*make_env(vec![
("HOME", "test_files/user".to_string()),
("XDG_DATA_HOME", "test_files/user/data".to_string()),
("XDG_CONFIG_HOME", "test_files/user/config".to_string()),
("XDG_CACHE_HOME", "test_files/user/cache".to_string()),
("XDG_DATA_DIRS", "test_files/user/data".to_string()),
("XDG_CONFIG_DIRS", "test_files/user/config".to_string()),
("XDG_RUNTIME_DIR", "test_files/runtime-bad".to_string())
])).unwrap();
assert_eq!(xd.find_data_file("everywhere"), None);
assert_eq!(xd.find_config_file("everywhere"), None);
assert_eq!(xd.find_cache_file("everywhere"), None);
} | rust_cleaned_test_functions.jsonl/83584 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 372
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34199,
51774,
368,
341,
262,
1077,
79052,
284,
5351,
56397,
486,
4197,
15879,
19814,
7342,
609,
9,
6927,
15879,
25592,
90515,
310,
3489,
27546,
497,
330,
1944,
10931,
11739,
3263,
983,
3904,
14702,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_async() {
delay();
let client: Public<ASync> = Public::new(SANDBOX_URL);
let time = client.get_time().and_then(|time| {
let time_str = format!("{:?}", time);
assert!(time_str.starts_with("Time {"));
assert!(time_str.contains("iso:"));
assert!(time_str.contains("epoch:"));
assert!(time_str.ends_with("}"));
future::ready(Ok(()))
});
let rt = tokio::runtime::Builder::new_current_thread()
.build()
.unwrap();
rt.block_on(time).ok();
} | rust_cleaned_test_functions.jsonl/83253 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 265
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28346,
368,
341,
262,
7626,
543,
262,
1077,
2943,
25,
3066,
27,
1911,
1721,
29,
284,
3066,
486,
931,
3759,
1093,
3506,
60155,
8000,
317,
262,
1077,
882,
284,
2943,
670,
3009,
1005,
437,
68367,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_sync_state() {
// Create a coordinator for a validator node
let mut validator_coordinator = test_utils::create_validator_coordinator();
// Get the sync state from state sync
let (callback_sender, mut callback_receiver) = oneshot::channel();
assert_ok!(validator_coordinator.get_sync_state(callback_sender));
match callback_receiver.try_recv() {
Ok(Some(sync_state)) => {
assert_eq!(sync_state.committed_version(), 0);
}
result => panic!("Expected okay but got: {:?}", result),
};
// Drop the callback receiver and verify error
let (callback_sender, _) = oneshot::channel();
let sync_state_result = validator_coordinator.get_sync_state(callback_sender);
assert_matches!(sync_state_result, Err(Error::CallbackSendFailed(_)));
} | rust_cleaned_test_functions.jsonl/84043 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 371
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
23008,
4387,
368,
341,
286,
442,
4230,
264,
30284,
369,
264,
22935,
2436,
198,
286,
1077,
5206,
22935,
11393,
17442,
284,
1273,
17309,
486,
3182,
64959,
11393,
17442,
1428,
286,
442,
2126,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_hash() {
let a = ByteArray::from_slice_unnamed(b"A");
let b = ByteArray::from_slice_unnamed(b"B");
let c = ByteArray::from_slice_unnamed(b"C");
let cat = a.concat(b).concat(c);
let hash = sha2::Sha256::digest(&cat.data);
let hashed = cat.apply_function(hash.as_ref(), Function::Sha256);
let hash_preimage = hashed.preimage.as_ref().expect("No hash_preimage");
assert_eq!(hashed.data.as_ref(), hash.as_slice());
assert_eq!(hash_preimage.len(), 1);
assert_eq!(hash_preimage[0].data.as_ref(), b"ABC");
let preimage = hash_preimage[0].preimage.as_ref().expect("No preimage");
assert_eq!(preimage[0].data.as_ref(), b"A");
assert_eq!(preimage[0].preimage, None);
assert_eq!(preimage[1].data.as_ref(), b"B");
assert_eq!(preimage[1].preimage, None);
assert_eq!(preimage[2].data.as_ref(), b"C");
assert_eq!(preimage[2].preimage, None);
} | rust_cleaned_test_functions.jsonl/86774 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 475
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
368,
341,
286,
1077,
264,
284,
32920,
486,
1499,
26488,
4907,
30245,
1883,
29133,
797,
286,
1077,
293,
284,
32920,
486,
1499,
26488,
4907,
30245,
1883,
63590,
797,
286,
1077,
272,
284,
32920... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_u64() {
let start_addr1 = GuestAddress(0x0);
let start_addr2 = GuestAddress(0x1000);
let bad_addr = GuestAddress(0x2001);
let bad_addr2 = GuestAddress(0x1ffc);
let gm = GuestMemory::new(&[(start_addr1, 0x1000), (start_addr2, 0x1000)]).unwrap();
let val1: u64 = 0xaa55_aa55_aa55_aa55;
let val2: u64 = 0x55aa_55aa_55aa_55aa;
assert_eq!(
format!("{:?}", gm.write_obj_at_addr(val1, bad_addr).err().unwrap()),
format!(
"InvalidGuestAddressRange({:?}, {:?})",
bad_addr,
std::mem::size_of::<u64>()
)
);
assert_eq!(
format!("{:?}", gm.write_obj_at_addr(val1, bad_addr2).err().unwrap()),
format!(
"InvalidGuestAddressRange({:?}, {:?})",
bad_addr2,
std::mem::size_of::<u64>()
)
);
gm.write_obj_at_addr(val1, GuestAddress(0x500)).unwrap();
gm.write_obj_at_addr(val2, GuestAddress(0x1000 + 32))
.unwrap();
let num1: u64 = gm.read_obj_from_addr(GuestAddress(0x500)).unwrap();
let num2: u64 = gm.read_obj_from_addr(GuestAddress(0x1000 + 32)).unwrap();
assert_eq!(val1, num1);
assert_eq!(val2, num2);
} | rust_cleaned_test_functions.jsonl/40958 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 747
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
7300,
21,
19,
368,
341,
286,
1077,
1191,
7387,
16,
284,
26215,
4286,
7,
15,
87,
15,
317,
286,
1077,
1191,
7387,
17,
284,
26215,
4286,
7,
15,
87,
16,
15,
15,
15,
317,
286,
1077,
3873,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_dependency() -> Result<(), Error> {
let child_a = ChildDecl {
name: "childA".to_string(),
url: "ignored:///child".to_string(),
startup: fsys::StartupMode::Lazy,
environment: None,
};
let child_b = ChildDecl {
name: "childB".to_string(),
url: "ignored:///child".to_string(),
startup: fsys::StartupMode::Lazy,
environment: None,
};
let decl = ComponentDecl {
offers: vec![
OfferDecl::Protocol(OfferProtocolDecl {
source: OfferServiceSource::Self_,
source_path: CapabilityPath::try_from("/svc/serviceParent").unwrap(),
target_path: CapabilityPath::try_from("/svc/serviceParent").unwrap(),
target: OfferTarget::Child("childA".to_string()),
dependency_type: DependencyType::Strong,
}),
OfferDecl::Protocol(OfferProtocolDecl {
source: OfferServiceSource::Child("childB".to_string()),
source_path: CapabilityPath::try_from("/svc/childBOffer").unwrap(),
target_path: CapabilityPath::try_from("/svc/serviceSibling").unwrap(),
target: OfferTarget::Child("childA".to_string()),
dependency_type: DependencyType::Strong,
}),
],
children: vec![child_a.clone(), child_b.clone()],
..default_component_decl()
};
let mut expected: Vec<(DependencyNode, Vec<DependencyNode>)> = Vec::new();
let mut v = vec![DependencyNode::Child(child_a.name.clone())];
v.sort_unstable();
expected.push((DependencyNode::Child(child_b.name.clone()), v));
expected.push((DependencyNode::Child(child_a.name.clone()), vec![]));
expected.sort_unstable();
validate_results(expected, process_component_dependencies(&decl));
Ok(())
} | rust_cleaned_test_functions.jsonl/24101 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1005
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19487,
62387,
368,
1464,
5714,
68843,
4600,
29,
341,
286,
1077,
1682,
4306,
284,
9391,
21629,
341,
310,
829,
25,
330,
3048,
32,
3263,
983,
3904,
3148,
310,
2515,
25,
330,
58471,
60896,
3048,
326... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tap_enable() {
let _tap_ip_guard = TAP_IP_LOCK.lock().unwrap();
let tap = Tap::new(1).unwrap();
let ret = tap.enable();
assert!(ret.is_ok());
} | rust_cleaned_test_functions.jsonl/55544 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
391,
18988,
368,
341,
286,
1077,
716,
30047,
10385,
36796,
284,
350,
2537,
16607,
27661,
21003,
1005,
15454,
1428,
286,
1077,
15239,
284,
36134,
486,
931,
7,
16,
568,
15454,
543,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_sub_assign() {
let mut vector = Vector3D::new(3, 4, 5);
vector -= Vector3D::new(10, 20, 30);
assert_eq!(vector, Vector3D::from([-7, -16, -25]));
} | rust_cleaned_test_functions.jsonl/21640 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 118
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5228,
20688,
368,
341,
310,
1077,
5206,
4621,
284,
4196,
18,
35,
486,
931,
7,
18,
11,
220,
19,
11,
220,
20,
317,
310,
4621,
5982,
4196,
18,
35,
486,
931,
7,
16,
15,
11,
220,
17,
15,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_into_alogithm_id() {
assert_eq!(
Into::<TPM2_ALG_ID>::into(KeyDerivationFunction::Kdf1Sp800_56a),
TPM2_ALG_KDF1_SP800_56A
);
assert_eq!(
Into::<TPM2_ALG_ID>::into(KeyDerivationFunction::Kdf2),
TPM2_ALG_KDF2
);
assert_eq!(
Into::<TPM2_ALG_ID>::into(KeyDerivationFunction::Kdf1Sp800_108),
TPM2_ALG_KDF1_SP800_108
);
assert_eq!(
Into::<TPM2_ALG_ID>::into(KeyDerivationFunction::EcMqv),
TPM2_ALG_ECMQV
);
} | rust_cleaned_test_functions.jsonl/41515 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 368
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45514,
8418,
538,
410,
76,
842,
368,
341,
286,
2060,
10714,
33673,
310,
31645,
27638,
4239,
44,
17,
8912,
38,
3450,
6831,
18122,
21358,
22171,
39127,
5152,
486,
42,
2940,
16,
6406,
23,
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_normalize_path() {
assert_eq!(normalize_path(Path::new("a/../b")), PathBuf::from("b"));
assert_eq!(normalize_path(Path::new("a/./b/")), PathBuf::from("a/b/"));
assert_eq!(
normalize_path(Path::new("a/./b/../c")),
PathBuf::from("a/c")
);
if cfg!(windows) {
assert_eq!(
normalize_path(Path::new("C:\\a\\.\\b\\..\\c")),
PathBuf::from("C:\\a\\c")
);
}
} | rust_cleaned_test_functions.jsonl/2999 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 234
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
80807,
2638,
368,
341,
262,
2060,
10714,
10297,
30590,
2638,
33030,
486,
931,
445,
64,
78380,
65,
35674,
7933,
15064,
486,
1499,
445,
65,
4010,
262,
2060,
10714,
10297,
30590,
2638,
33030,
486,
93... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_default_value_extreme() {
let d = TestExtremeDefaultValues::new();
assert_eq!(f64::INFINITY, d.get_inf_double());
assert_eq!(f64::NEG_INFINITY, d.get_neg_inf_double());
assert!(d.get_nan_double().is_nan());
assert_eq!(f32::INFINITY, d.get_inf_float());
assert_eq!(f32::NEG_INFINITY, d.get_neg_inf_float());
assert!(d.get_nan_float().is_nan());
assert_eq!(
b"\0\x01\x07\x08\x0c\n\r\t\x0b\\\'\"\xfe",
d.get_escaped_bytes()
);
assert_eq!("'", d.get_quote1());
assert_eq!("\"", d.get_quote2());
assert_eq!(b"'", d.get_bquote1());
assert_eq!(b"\"", d.get_bquote2());
} | rust_cleaned_test_functions.jsonl/63842 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 331
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9993,
3142,
9927,
9634,
368,
341,
262,
1077,
294,
284,
3393,
92518,
3675,
6227,
486,
931,
543,
262,
2060,
10714,
10297,
69,
21,
19,
486,
687,
55990,
11,
294,
670,
26051,
24598,
1423,
262,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.