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_parse() {
assert_eq!(SrtVersion::parse(0x01_01_01), SrtVersion::new(1, 1, 1));
assert_eq!(SrtVersion::parse(0x00_00_00), SrtVersion::new(0, 0, 0));
} | rust_cleaned_test_functions.jsonl/38037 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
368,
341,
286,
2060,
10714,
10297,
50,
3342,
5637,
486,
6400,
7,
15,
87,
15,
16,
62,
15,
16,
62,
15,
16,
701,
328,
3342,
5637,
486,
931,
7,
16,
11,
220,
16,
11,
220,
16,
1106,
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_process_sync_request() {
// Create a read-only coordinator
let mut read_only_coordinator = test_utils::create_read_only_coordinator();
// Verify that read-only coordinators can't process sync requests
let (sync_request, _) = create_sync_notification_at_version(0);
let process_result = block_on(read_only_coordinator.process_sync_request(sync_request));
assert_matches!(process_result, Err(Error::ReadOnlyMode(_)));
// Create a coordinator for a full node
let mut full_node_coordinator = test_utils::create_full_node_coordinator();
// Verify that fullnodes can't process sync requests
let (sync_request, _) = create_sync_notification_at_version(0);
let process_result = block_on(full_node_coordinator.process_sync_request(sync_request));
assert_matches!(process_result, Err(Error::FullNodeSyncRequest));
// Create a coordinator for a validator node
let mut validator_coordinator = test_utils::create_validator_coordinator();
// Perform sync request for version that matches initial waypoint version
let (sync_request, mut callback_receiver) = create_sync_notification_at_version(0);
assert_ok!(block_on(
validator_coordinator.process_sync_request(sync_request)
));
match callback_receiver.try_recv() {
Ok(Some(notification_result)) => assert_ok!(notification_result.result),
result => panic!("Expected okay but got: {:?}", result),
};
// Create validator coordinator with waypoint higher than 0
let waypoint_version = 10;
let waypoint_ledger_info = create_ledger_info_at_version(waypoint_version);
let waypoint = Waypoint::new_any(waypoint_ledger_info.ledger_info());
let mut validator_coordinator =
create_coordinator_with_config_and_waypoint(NodeConfig::default(), waypoint);
// Verify coordinator won't process sync requests as it's not yet initialized
let (sync_request, mut callback_receiver) = create_sync_notification_at_version(10);
let process_result = block_on(validator_coordinator.process_sync_request(sync_request));
assert_matches!(process_result, Err(Error::UninitializedError(_)));
let callback_result = callback_receiver.try_recv();
assert_err!(callback_result);
// modifications in unit tests.
} | rust_cleaned_test_functions.jsonl/104211 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 915
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
23008,
7893,
368,
341,
286,
442,
4230,
264,
1349,
15382,
30284,
198,
286,
1077,
5206,
1349,
18410,
11393,
17442,
284,
1273,
17309,
486,
3182,
6443,
18410,
11393,
17442,
1428,
286,
442,
25429,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_primitive_array_divide_with_nulls() {
let a = Int32Array::from(vec![Some(15), None, Some(8), Some(1), Some(9), None]);
let b = Int32Array::from(vec![Some(5), Some(6), Some(8), Some(9), None, None]);
let c = divide(&a, &b).unwrap();
assert_eq!(3, c.value(0));
assert_eq!(true, c.is_null(1));
assert_eq!(1, c.value(2));
assert_eq!(0, c.value(3));
assert_eq!(true, c.is_null(4));
assert_eq!(true, c.is_null(5));
} | rust_cleaned_test_functions.jsonl/17856 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 266
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84087,
3858,
16237,
577,
6615,
15162,
82,
368,
341,
286,
1077,
264,
284,
1333,
18,
17,
1857,
486,
1499,
25592,
20703,
8373,
7,
16,
20,
701,
2240,
11,
4329,
7,
23,
701,
4329,
7,
16,
701,
4329... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_issue_28() {
let root = sysfs_test_suite!(
"charge_full_design" => 3600000,
"serial_number" => "41167",
"technology" => "Li-ion",
"charge_now" => 725000,
"present" => 1,
"manufacturer" => "Hewlett-Packard",
"type" => "Battery",
"charge_full" => 3424000,
"capacity" => 21,
"cycle_count" => 0,
"voltage_now" => 10663000,
"status" => "Discharging",
"alarm" => 340000,
"model_name" => "PABAS0241231",
"voltage_min_design" => 11400000,
"capacity_level" => "Normal"
);
let path = root.into_path();
let device = SysFsDevice::try_from(path.clone());
assert!(device.is_ok());
fs::remove_dir_all(path).unwrap();
} | rust_cleaned_test_functions.jsonl/34327 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 386
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53340,
62,
17,
23,
368,
341,
262,
1077,
3704,
284,
5708,
3848,
4452,
57239,
33673,
286,
330,
13891,
16372,
49803,
1,
589,
220,
18,
21,
15,
15,
15,
15,
15,
345,
286,
330,
10182,
5500,
1,
589,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_api_can_not_add_same_content_hash() {
let (mut testkit, _) = init_testkit();
let api = testkit.api();
let keypair = gen_keypair();
let content_hash = hash(&[1]);
let timestamp1 = Timestamp::new(&content_hash, "metadata");
let timestamp2 = Timestamp::new(&content_hash, "other metadata");
let tx_ok = TxTimestamp::sign(&keypair.0, timestamp1.clone(), &keypair.1);
let tx_err = TxTimestamp::sign(&keypair.0, timestamp2.clone(), &keypair.1);
testkit.create_block_with_transaction(tx_ok.clone());
assert_status(&api, &tx_ok, &json!({ "type": "success" }));
testkit.create_block_with_transaction(tx_err.clone());
assert_status(
&api,
&tx_err,
&json!({ "type": "error", "code": 0, "description": "Content hash already exists" }),
);
} | rust_cleaned_test_functions.jsonl/32319 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 335
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11697,
27421,
7913,
2891,
33574,
7495,
8950,
368,
341,
262,
1077,
320,
6984,
1273,
8226,
11,
27439,
284,
2930,
4452,
8226,
543,
262,
1077,
6330,
284,
1273,
8226,
6183,
1428,
262,
1077,
1376,
12670... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_predecessors() {
let graph = create_test_graph();
let empty_vertex_list: Vec<&usize> = vec![];
assert_eq!(graph.predecessors(1).unwrap(), empty_vertex_list);
assert_eq!(graph.predecessors(2).unwrap(), vec![&1, &5]);
// vertex 7 does not exist
assert!(graph.successors(7).is_err());
} | rust_cleaned_test_functions.jsonl/1475 | {
"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,
10442,
26911,
1087,
368,
341,
286,
1077,
4771,
284,
1855,
4452,
14738,
1428,
286,
1077,
4287,
26611,
2019,
25,
11312,
52244,
51878,
29,
284,
7486,
0,
15078,
286,
2060,
10714,
10297,
4439,
6225,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_device_id() {
let f = TempFile::new().unwrap().into_file();
f.set_len(0x1000).unwrap();
let mem = GuestMemoryMmap::from_ranges(&[(GuestAddress(0), 0x1000_0000)]).unwrap();
let dev_id = [
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x00A, 0x0B, 0x0C, 0x0D, 0x0E,
0x0F, 0x10, 0x11, 0x12, 0x13, 0x14,
];
let mut req_exec = StdIoBackend::new(f, 0).unwrap();
let get_id_req = Request::new(
RequestType::GetDeviceID,
vec![(GuestAddress(0x100), VIRTIO_BLK_ID_BYTES as u32)],
1,
GuestAddress(0x200),
);
assert_eq!(
req_exec.execute(&mem, &get_id_req).unwrap_err(),
Error::Unsupported(VIRTIO_BLK_T_GET_ID)
);
req_exec = req_exec.with_device_id(dev_id);
let get_id_req = Request::new(
RequestType::GetDeviceID,
vec![(GuestAddress(0x100), VIRTIO_BLK_ID_BYTES as u32 - 1)],
1,
GuestAddress(0x200),
);
assert_eq!(
req_exec.execute(&mem, &get_id_req).unwrap_err(),
Error::InvalidDataLength
);
let get_id_req = Request::new(
RequestType::GetDeviceID,
vec![(GuestAddress(0x100), VIRTIO_BLK_ID_BYTES as u32)],
1,
GuestAddress(0x200),
);
// VIRTIO_BLK_ID_BYTES bytes should've been written in memory.
assert_eq!(
req_exec.execute(&mem, &get_id_req).unwrap(),
VIRTIO_BLK_ID_BYTES as u32
);
let mut buf = [0x00; VIRTIO_BLK_ID_BYTES];
mem.read_slice(&mut buf, GuestAddress(0x100)).unwrap();
assert_eq!(buf, dev_id);
let get_id_req = Request::new(
RequestType::GetDeviceID,
vec![(GuestAddress(0x100), 0x08), (GuestAddress(0x200), 0x0C)],
1,
GuestAddress(0x200),
);
mem.write_slice(&[0; 20], GuestAddress(0x100)).unwrap();
// VIRTIO_BLK_ID_BYTES bytes should've been written in memory.
assert_eq!(
req_exec.execute(&mem, &get_id_req).unwrap(),
VIRTIO_BLK_ID_BYTES as u32
);
let mut buf = [0x00; 8];
mem.read_slice(&mut buf, GuestAddress(0x100)).unwrap();
assert_eq!(buf, dev_id[0..8]);
let mut buf = [0x00; 12];
mem.read_slice(&mut buf, GuestAddress(0x200)).unwrap();
assert_eq!(buf, dev_id[8..VIRTIO_BLK_ID_BYTES]);
} | rust_cleaned_test_functions.jsonl/60811 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1423
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
9204,
842,
368,
341,
286,
1077,
282,
284,
19944,
1703,
486,
931,
1005,
15454,
1005,
18122,
2458,
543,
286,
282,
980,
6043,
7,
15,
87,
16,
15,
15,
15,
568,
15454,
1428,
286,
1077,
1833,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_array_chunks_mut_remainder() {
let v: &mut [i32] = &mut [0, 1, 2, 3, 4];
let c = v.array_chunks_mut::<2>();
assert_eq!(c.into_remainder(), &[4]);
} | rust_cleaned_test_functions.jsonl/9654 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
65470,
29523,
86607,
1107,
368,
341,
262,
1077,
348,
25,
609,
6984,
508,
72,
18,
17,
60,
284,
609,
6984,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
935,
262,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_receive_concurrent_send() {
init_test_log();
// Tests that triggering send and receive as close to at the same time as possible does
// not cause any race conditions.
let (sender, receiver) = create::<u32>(5, 20);
let receiver2 = receiver.clone();
let pair = Arc::new((Mutex::new((false, false)), Condvar::new()));
let rx_pair = pair.clone();
let tx_pair = pair.clone();
let rx = thread::spawn(move || {
let mut guard = rx_pair.0.lock().unwrap();
guard.0 = true;
let c_guard = rx_pair.1.wait(guard).unwrap();
drop(c_guard);
match receiver2.receive_await_timeout(20) {
Ok(_) => assert!(true),
e => assert!(false, "Error {:?} when receive.", e),
};
});
let tx = thread::spawn(move || {
let mut guard = tx_pair.0.lock().unwrap();
guard.1 = true;
let c_guard = tx_pair.1.wait(guard).unwrap();
drop(c_guard);
match sender.send_await_timeout(1 as u32, 20) {
Ok(_) => assert!(true),
e => assert!(false, "Error {:?} when receive.", e),
};
});
// Wait until both threads are ready and waiting.
loop {
let guard = pair.0.lock().unwrap();
if guard.0 && guard.1 {
break;
}
}
let guard = pair.0.lock().unwrap();
pair.1.notify_all();
drop(guard);
tx.join().unwrap();
rx.join().unwrap();
assert_eq!(1, receiver.sent());
assert_eq!(1, receiver.received());
assert_eq!(0, receiver.pending());
assert_eq!(0, receiver.receivable());
} | rust_cleaned_test_functions.jsonl/83273 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 902
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38557,
3382,
3231,
13565,
368,
341,
286,
2930,
4452,
5224,
1428,
286,
442,
20150,
429,
51505,
3624,
323,
5258,
438,
3265,
311,
518,
279,
1852,
882,
438,
3204,
1558,
198,
286,
442,
537,
5240,
894... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_enrich_valid_empty_tensor() {
let v = EventValue::Summary(SummaryValue(Box::new(Value::Tensor(pb::TensorProto {
dtype: pb::DataType::DtString.into(),
tensor_shape: Some(tensor_shape(&[0])),
string_val: vec![],
..Default::default()
}))));
let expected = BlobSequenceValue(vec![]);
assert_eq!(
v.into_blob_sequence(&blank("myblobs", pb::DataClass::BlobSequence)),
Ok(expected)
);
} | rust_cleaned_test_functions.jsonl/6219 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 313
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6205,
13851,
8337,
15124,
23188,
368,
341,
310,
1077,
348,
284,
3665,
1130,
486,
19237,
3759,
372,
1534,
1130,
67758,
486,
931,
25346,
486,
25336,
76878,
486,
25336,
31549,
341,
394,
13231,
25,
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_add() {
let rows = 2;
let symbol_size = 1316;
let mut data: Vec<Symbol> = Vec::with_capacity(rows);
for _i in 0..rows {
let mut symbol_data: Vec<u8> = vec![0; symbol_size];
for j in 0..symbol_size {
symbol_data[j] = rand::thread_rng().gen();
}
let symbol = Symbol::new(symbol_data);
data.push(symbol);
}
let mut data0: Vec<u8> = vec![0; symbol_size];
let mut data1: Vec<u8> = vec![0; symbol_size];
let mut result: Vec<u8> = vec![0; symbol_size];
for i in 0..symbol_size {
data0[i] = data[0].as_bytes()[i];
data1[i] = data[1].as_bytes()[i];
result[i] = data0[i] ^ data1[i];
}
let mut symbol0 = Symbol::new(data0);
let symbol1 = Symbol::new(data1);
symbol0 += &symbol1;
perform_op(&SymbolOps::AddAssign { dest: 0, src: 1 }, &mut data);
assert_eq!(result, data[0].as_bytes());
} | rust_cleaned_test_functions.jsonl/51883 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 551
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
368,
341,
286,
1077,
6978,
284,
220,
17,
280,
286,
1077,
7735,
2368,
284,
220,
16,
18,
16,
21,
280,
286,
1077,
5206,
821,
25,
11312,
27,
15090,
29,
284,
11312,
486,
4197,
35603,
31911,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_instruction_details() {
use arch::x86::X86Reg;
use arch::x86::X86Reg::*;
let expected_insns: &[(
&str,
&[u8],
&[cs_group_type::Type],
&[X86Reg::Type],
&[X86Reg::Type],
)] = &[
("nop", b"\x90", &[], &[], &[]),
("je", b"\x74\x05", &[JUMP], &[X86_REG_EFLAGS], &[]),
(
"call",
b"\xe8\x28\x07\x00\x00",
&[CALL],
&[X86_REG_RIP, X86_REG_RSP],
&[X86_REG_RSP],
),
("ret", b"\xc3", &[RET], &[X86_REG_RSP], &[X86_REG_RSP]),
("syscall", b"\x0f\x05", &[INT], &[], &[]),
("iretd", b"\xcf", &[IRET], &[], &[]),
("sub", b"\x48\x83\xec\x08", &[], &[], &[X86_REG_EFLAGS]),
("test", b"\x48\x85\xc0", &[], &[], &[X86_REG_EFLAGS]),
("mov", b"\x48\x8b\x05\x95\x4a\x4d\x00", &[], &[], &[]),
("mov", b"\xb9\x04\x02\x00\x00", &[], &[], &[]),
];
let mut cs = Capstone::new()
.x86()
.mode(x86::ArchMode::Mode64)
.build()
.unwrap();
instructions_match_group(&mut cs, expected_insns, true);
} | rust_cleaned_test_functions.jsonl/127422 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 709
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54923,
13260,
368,
341,
262,
990,
5325,
486,
87,
23,
21,
486,
55,
23,
21,
3477,
280,
262,
990,
5325,
486,
87,
23,
21,
486,
55,
23,
21,
3477,
79304,
262,
1077,
3601,
34386,
4412,
25,
44590,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_namespaced_constant() {
let hdr = indoc! {"
namespace A {
const int kConstant = 3;
}
"};
let rs = quote! {
assert_eq!(ffi::A::kConstant, 3);
};
run_test("", hdr, rs, &["A::kConstant"], &[]);
} | rust_cleaned_test_functions.jsonl/9920 | {
"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,
9187,
68552,
34967,
368,
341,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
286,
4473,
362,
341,
310,
733,
526,
595,
15472,
284,
220,
18,
280,
286,
456,
262,
330,
2440,
262,
1077,
10036,
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_bigint() {
use num_bigint::{BigInt, BigUint};
// int
test_serde(BigInt::from(0i64), &[INTZERO]);
test_serde(BigUint::from(0u64), &[INTZERO]);
test_serde(BigInt::from(1i64), &[0x15, 1]);
test_serde(BigUint::from(1u64), &[0x15, 1]);
test_serde(BigInt::from(-1i64), &[0x13, 254]);
test_serde(BigInt::from(100i64), &[0x15, 100]);
test_serde(BigUint::from(100u64), &[0x15, 100]);
test_serde(BigInt::from(10000i32), &[0x16, 39, 16]);
test_serde(BigUint::from(10000u32), &[0x16, 39, 16]);
test_serde(BigInt::from(-100i16), &[19, 155]);
test_serde(BigInt::from(-10000i64), &[18, 216, 239]);
test_serde(BigInt::from(-1000000i64), &[17, 240, 189, 191]);
// boundary condition
test_serde(BigInt::from(255u16), &[0x15, 255]);
test_serde(BigUint::from(255u16), &[0x15, 255]);
test_serde(BigInt::from(256i32), &[0x16, 1, 0]);
test_serde(BigInt::from(-255i16), &[0x13, 0]);
test_serde(BigInt::from(-256i64), &[0x12, 254, 255]);
test_serde(BigInt::from(0), b"\x14");
test_serde(BigUint::from(0u64), b"\x14");
test_serde(BigInt::from(1), b"\x15\x01");
test_serde(BigUint::from(1u64), b"\x15\x01");
test_serde(BigInt::from(-1), b"\x13\xfe");
test_serde(BigInt::from(255), b"\x15\xff");
test_serde(BigUint::from(255u64), b"\x15\xff");
test_serde(BigInt::from(-255), b"\x13\x00");
test_serde(BigInt::from(256), b"\x16\x01\x00");
test_serde(BigUint::from(256u64), b"\x16\x01\x00");
test_serde(BigInt::from(-256), b"\x12\xfe\xff");
test_serde(BigInt::from(65536), b"\x17\x01\x00\x00");
test_serde(BigUint::from(65536u64), b"\x17\x01\x00\x00");
test_serde(BigInt::from(-65536), b"\x11\xfe\xff\xff");
test_serde(
BigInt::from(i64::max_value()),
b"\x1C\x7f\xff\xff\xff\xff\xff\xff\xff",
);
test_serde(
BigUint::from(i64::max_value() as u64),
b"\x1C\x7f\xff\xff\xff\xff\xff\xff\xff",
);
test_serde(
BigInt::from(i64::max_value() as u64 + 1),
b"\x1C\x80\x00\x00\x00\x00\x00\x00\x00",
);
test_serde(
BigUint::from(i64::max_value() as u64 + 1),
b"\x1C\x80\x00\x00\x00\x00\x00\x00\x00",
);
test_serde(
BigInt::from(u64::max_value()),
b"\x1C\xff\xff\xff\xff\xff\xff\xff\xff",
);
test_serde(
BigUint::from(u64::max_value()),
b"\x1C\xff\xff\xff\xff\xff\xff\xff\xff",
);
test_serde(
BigInt::from(u128::max_value()),
b"\x1D\x10\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff",
);
test_serde(
BigUint::from(u128::max_value()),
b"\x1D\x10\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff",
);
test_serde(
BigInt::from(u64::max_value() as u128 + 1),
b"\x1D\x09\x01\x00\x00\x00\x00\x00\x00\x00\x00",
);
test_serde(
BigUint::from(u64::max_value() as u128 + 1),
b"\x1D\x09\x01\x00\x00\x00\x00\x00\x00\x00\x00",
);
test_serde(
BigInt::from(u64::max_value() as i128 + 1),
b"\x1D\x09\x01\x00\x00\x00\x00\x00\x00\x00\x00",
);
test_serde(
BigUint::from(u64::max_value() as u128 + 1),
b"\x1D\x09\x01\x00\x00\x00\x00\x00\x00\x00\x00",
);
test_serde(
BigInt::from(i64::min_value() as i128 + 1),
b"\x0C\x80\x00\x00\x00\x00\x00\x00\x00",
);
test_serde(
BigInt::from(i64::min_value() as i128 - 1),
b"\x0C\x7f\xff\xff\xff\xff\xff\xff\xfe",
);
test_serde(
BigInt::from(-(u64::max_value() as i128)),
b"\x0C\x00\x00\x00\x00\x00\x00\x00\x00",
);
test_serde(
BigInt::from(-(u64::max_value() as i128) - 1),
b"\x0b\xf6\xfe\xff\xff\xff\xff\xff\xff\xff\xff",
);
test_serde(
BigInt::from(-(u64::max_value() as i128) - 2),
b"\x0b\xf6\xfe\xff\xff\xff\xff\xff\xff\xff\xfe",
);
test_serde(
BigInt::from((u64::max_value() as i128) * -2),
b"\x0b\xf6\xfe\x00\x00\x00\x00\x00\x00\x00\x01",
);
test_serde(
BigInt::from((u64::max_value() as i128) * 2),
b"\x1d\x09\x01\xff\xff\xff\xff\xff\xff\xff\xfe",
);
test_serde(BigInt::from(-4294967295i64), b"\x10\x00\x00\x00\x00");
test_serde(
BigInt::from(i64::min_value() + 2),
b"\x0C\x80\x00\x00\x00\x00\x00\x00\x01",
);
test_serde(
BigInt::from(i64::min_value() + 1),
b"\x0C\x80\x00\x00\x00\x00\x00\x00\x00",
);
test_serde(
BigInt::from(i64::min_value()),
b"\x0C\x7f\xff\xff\xff\xff\xff\xff\xff",
);
} | rust_cleaned_test_functions.jsonl/33092 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36386,
396,
368,
341,
286,
990,
1629,
36386,
396,
22964,
87474,
11,
6164,
21570,
2440,
286,
442,
526,
198,
286,
1273,
75861,
450,
5349,
343,
1072,
486,
1499,
7,
15,
72,
21,
19,
701,
44590,
322... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lifetime_split() {
parse_macro(
r#"
macro_rules! foo {
($($t:tt)*) => { $($t)*}
}
"#,
)
.assert_expand(
r#"foo!(static bar: &'static str = "hello";);"#,
r#"
SUBTREE $
IDENT static 17
IDENT bar 18
PUNCH : [alone] 19
PUNCH & [alone] 20
PUNCH ' [joint] 21
IDENT static 22
IDENT str 23
PUNCH = [alone] 24
LITERAL "hello" 25
PUNCH ; [joint] 26
"#,
);
} | rust_cleaned_test_functions.jsonl/28705 | {
"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,
98827,
17052,
368,
341,
262,
4715,
58810,
1006,
286,
435,
2,
698,
32606,
21407,
0,
15229,
341,
262,
1711,
699,
83,
25,
5566,
8,
3764,
589,
314,
93977,
83,
4806,
532,
532,
57676,
345,
262,
1727... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_resolve_bid_action() {
let g = test_helpers::create_test_bid_phase();
let mut phase = GamePhase::Auction(g);
fn get_game(phase: &GamePhase) -> &GameData {
if let GamePhase::Auction(g) = phase {
g
} else {
panic!("Expected a GamePhase::Auction");
}
}
let agent = test_helpers::create_test_agent();
assert!(resolve_bid_action(&mut phase, &*agent, Bid::Query).is_ok());
assert_eq!(get_game(&phase).auction.bids(Bidder::First)[0].bid, Bid::Query);
assert_eq!(
get_game(&phase).auction.bids(Bidder::First)[0].responses,
vec![
BidResponse::HandEvaluation(HandRating::Poor, None),
BidResponse::LongestSuit(Suit::Hearts)
]
);
assert_eq!(get_game(&phase).auction.bids(Bidder::Second)[0].bid, Bid::Pass);
assert_eq!(
get_game(&phase).auction.bids(Bidder::Second)[0].responses,
vec![BidResponse::Pass]
);
assert!(resolve_bid_action(&mut phase, &*agent, Bid::Pass).is_ok());
if let GamePhase::Playing(data) = phase {
assert_eq!(
data.contract,
Contract { trump: None, tricks: 7, declarer: Position::User }
);
assert_eq!(data.trick, Trick::new(Position::User))
} else {
panic!("Expected GamePhase::Playing");
}
} | rust_cleaned_test_functions.jsonl/83230 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 767
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77291,
62509,
7931,
368,
341,
286,
1077,
342,
284,
1273,
54473,
486,
3182,
4452,
62509,
37593,
543,
286,
1077,
5206,
10262,
284,
4050,
30733,
486,
32,
2654,
3268,
317,
286,
5168,
633,
18547,
97085... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_start_dissolving_panics() {
let fake_driver = fake::FakeDriver::default();
let id: u64 = 1;
let fixture: GovernanceProto = fixture_for_dissolving_neuron_tests(
id,
DissolveState::WhenDissolvedTimestampSeconds(DEFAULT_TEST_START_TIMESTAMP_SECONDS),
);
let mut gov = Governance::new(
fixture,
fake_driver.get_fake_env(),
fake_driver.get_fake_ledger(),
);
assert_eq!(
gov.get_neuron(&NeuronId { id }).unwrap().dissolve_state,
Some(DissolveState::DissolveDelaySeconds(
MIN_DISSOLVE_DELAY_FOR_VOTE_ELIGIBILITY_SECONDS
))
);
gov.manage_neuron(
&principal(id),
&ManageNeuron {
id: None,
neuron_id_or_subaccount: Some(NeuronIdOrSubaccount::NeuronId(NeuronId { id })),
command: Some(manage_neuron::Command::Configure(
manage_neuron::Configure {
operation: Some(manage_neuron::configure::Operation::StartDissolving(
manage_neuron::StartDissolving {},
)),
},
)),
},
)
.now_or_never()
.unwrap()
.expect("Manage neuron failed");
} | rust_cleaned_test_functions.jsonl/1187 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 637
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4906,
814,
1038,
19648,
71099,
1211,
368,
341,
262,
1077,
12418,
20602,
284,
12418,
486,
52317,
11349,
486,
2258,
543,
262,
1077,
877,
25,
575,
21,
19,
284,
220,
16,
280,
262,
1077,
12507,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_field_to_from_bytes()
{
let id = "Hello";
let value = "World";
let field = Field::new(id, Type::S(Some(S::new(value))));
assert_eq!(Field::from_bytes(&field.to_bytes().unwrap()).unwrap(), field);
} | rust_cleaned_test_functions.jsonl/41986 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5013,
2346,
5673,
12524,
741,
262,
341,
286,
1077,
877,
284,
330,
9707,
876,
286,
1077,
897,
284,
330,
10134,
876,
286,
1077,
2070,
284,
8601,
486,
931,
3724,
11,
3990,
486,
50,
65405,
3759,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_punycode_prefix_with_length_check() {
let config = idna::Config::default()
.verify_dns_length(true)
.check_hyphens(true)
.use_std3_ascii_rules(true);
assert!(config.to_ascii("xn--").is_err());
assert!(config.to_ascii("xn---").is_err());
assert!(config.to_ascii("xn-----").is_err());
assert!(config.to_ascii("xn--.").is_err());
assert!(config.to_ascii("xn--...").is_err());
assert!(config.to_ascii(".xn--").is_err());
assert!(config.to_ascii("...xn--").is_err());
assert!(config.to_ascii("xn--.xn--").is_err());
assert!(config.to_ascii("xn--.example.org").is_err());
} | rust_cleaned_test_functions.jsonl/13893 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 319
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
359,
88,
1851,
13974,
6615,
5118,
7200,
368,
341,
262,
1077,
2193,
284,
877,
3376,
486,
2648,
486,
2258,
741,
286,
659,
12446,
71125,
5118,
3715,
340,
286,
659,
2028,
1523,
88,
759,
724,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compile_error_expand() {
let expanded = expand_builtin_macro(
r#"
#[rustc_builtin_macro]
macro_rules! compile_error {
($msg:expr) => ({ /* compiler built-in */ });
($msg:expr,) => ({ /* compiler built-in */ })
}
compile_error!("error!");
"#,
);
assert_eq!(expanded, r#"loop{"error!"}"#);
} | rust_cleaned_test_functions.jsonl/124333 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 247
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74170,
4096,
67875,
368,
341,
286,
1077,
17183,
284,
9225,
73829,
58810,
1006,
310,
435,
2,
698,
310,
11506,
35788,
66,
73829,
58810,
921,
310,
18072,
21407,
0,
19192,
4096,
341,
394,
1711,
3236,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_arrow_multi_right() {
let text = "-> And they sang of their lightnings and shapeful disgrace";
let text: Vec<_> = text.split_whitespace().collect();
let (a, b) = parse_arrow(&text).unwrap();
assert!(a.is_empty());
assert_eq!(b, &text[1..]);
} | rust_cleaned_test_functions.jsonl/65978 | {
"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,
21039,
46566,
25133,
10539,
368,
341,
286,
1077,
1467,
284,
88720,
1597,
807,
28240,
315,
862,
3100,
38469,
323,
6083,
1262,
63835,
876,
286,
1077,
1467,
25,
11312,
32399,
29,
284,
1467,
5289,
861... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vcx_init_called_twice_passes_after_shutdown() {
init!("ledger");
wallet::close_wallet().unwrap();
pool::close().unwrap();
let content = format!(r#"{{"wallet_name":"{}"}}"#, settings::DEFAULT_WALLET_NAME);
let cb = return_types_u32::Return_U32::new().unwrap();
assert_eq!(vcx_init_with_config(cb.command_handle,
CString::new(content.clone()).unwrap().into_raw(),
Some(cb.get_callback())),
error::SUCCESS.code_num);
cb.receive(Some(Duration::from_secs(10))).unwrap();
//Assert config values were set correctly
assert_eq!(settings::get_config_value("wallet_name").unwrap(), settings::DEFAULT_WALLET_NAME);
//Verify shutdown was successful
vcx_shutdown(true);
assert_eq!(settings::get_config_value("wallet_name"), Err(error::INVALID_CONFIGURATION.code_num));
// Init for the second time works
::utils::devsetup::tests::setup_ledger_env();
wallet::close_wallet().unwrap();
pool::close().unwrap();
let cb = return_types_u32::Return_U32::new().unwrap();
assert_eq!(vcx_init_with_config(cb.command_handle,
CString::new(content).unwrap().into_raw(),
Some(cb.get_callback())),
error::SUCCESS.code_num);
cb.receive(Some(Duration::from_secs(10))).unwrap();
vcx_shutdown(true);
} | rust_cleaned_test_functions.jsonl/127534 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 778
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
25844,
6137,
27859,
54178,
558,
15464,
288,
19844,
54804,
368,
341,
286,
2930,
17223,
50704,
797,
286,
15085,
486,
5552,
62308,
1005,
15454,
543,
286,
7314,
486,
5552,
1005,
15454,
1428,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_session_same_connection_transient() {
let mut broker = BrokerBuilder::default().with_authorizer(AllowAll).build();
let id = "id1".to_string();
let client_id = ClientId::from(id.clone());
let connect1 = transient_connect(id.clone());
let connect2 = transient_connect(id);
let id = Uuid::new_v4();
let (tx1, _rx1) = mpsc::unbounded_channel();
let handle1 = ConnectionHandle::new(id, tx1.clone());
let handle2 = ConnectionHandle::new(id, tx1);
let req1 = ConnReq::new(
client_id.clone(),
peer_addr(),
connect1,
Auth::Identity(AuthId::Anonymous),
handle1,
);
let req2 = ConnReq::new(
client_id,
peer_addr(),
connect2,
Auth::Identity(AuthId::Anonymous),
handle2,
);
let auth_id = AuthId::Anonymous;
broker.open_session(auth_id.clone(), req1).unwrap();
assert_eq!(1, broker.sessions.len());
let result = broker.open_session(auth_id, req2);
assert_matches!(result, Ok(OpenSession::ProtocolViolation(_)));
assert_eq!(0, broker.sessions.len());
} | rust_cleaned_test_functions.jsonl/105411 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 594
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
12316,
33574,
15866,
97758,
368,
341,
286,
1077,
5206,
22316,
284,
52701,
3297,
486,
2258,
1005,
4197,
22938,
3135,
7,
18605,
2403,
568,
5834,
1428,
286,
1077,
877,
284,
330,
307,
16,
3263,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_embed_combined_limit() {
let mut embed = base_embed();
embed.description.replace(str::repeat("a", 2048));
embed.title.replace(str::repeat("a", 256));
for _ in 0..5 {
embed.fields.push(EmbedField {
inline: true,
name: str::repeat("a", 100),
value: str::repeat("a", 500),
});
}
// we're at 5304 characters now
assert!(super::embed(&embed).is_ok());
embed.footer.replace(EmbedFooter {
icon_url: None,
proxy_icon_url: None,
text: str::repeat("a", 1000),
});
assert!(matches!(
super::embed(&embed).unwrap_err().kind(),
EmbedValidationErrorType::EmbedTooLarge { chars: 6304 }
));
} | rust_cleaned_test_functions.jsonl/4834 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 422
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24007,
89945,
14763,
368,
341,
286,
1077,
5206,
11579,
284,
2331,
24007,
543,
286,
11579,
13178,
6980,
4199,
486,
30624,
445,
64,
497,
220,
17,
15,
19,
23,
1106,
286,
11579,
6067,
6980,
4199,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_rlp_2bytes_data_length_check() {
let mut data: Vec<u8> = vec![0xb9, 2, 255];
for _ in 0..700 {
data.push(b'c');
}
let rlp = Rlp::new(&data);
let as_val: Result<String, DecoderError> = rlp.as_val();
assert_eq!(Err(DecoderError::RlpInconsistentLengthAndData), as_val);
} | rust_cleaned_test_functions.jsonl/96995 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
13545,
62,
17,
9651,
1769,
5118,
7200,
368,
341,
10217,
5206,
821,
25,
11312,
34837,
23,
29,
284,
7486,
20703,
15,
7929,
24,
11,
220,
17,
11,
220,
17,
20,
20,
5265,
715,
2023,
716,
304... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_simulation_batch() {
let (bank, txs) = setup();
// Prepare batch without locks
let batch = bank.prepare_simulation_batch(&txs);
assert!(batch.lock_results().iter().all(|x| x.is_ok()));
// Grab locks
let batch2 = bank.prepare_batch(&txs, None);
assert!(batch2.lock_results().iter().all(|x| x.is_ok()));
// Prepare another batch without locks
let batch3 = bank.prepare_simulation_batch(&txs);
assert!(batch3.lock_results().iter().all(|x| x.is_ok()));
} | rust_cleaned_test_functions.jsonl/28699 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 249
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82487,
14534,
368,
341,
286,
1077,
320,
17033,
11,
9854,
82,
8,
284,
6505,
1428,
286,
442,
31166,
7162,
2041,
31676,
198,
286,
1077,
7162,
284,
6073,
21934,
82487,
14534,
2099,
3998,
82,
317,
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_register() {
let mut world = World::default();
assert!(!world.is_registered(&TypeId::of::<A>()));
assert!(!world.is_registered(&TypeId::of::<B>()));
world.register::<A>();
world.register::<B>();
assert!(world.is_registered(&TypeId::of::<A>()));
assert!(world.is_registered(&TypeId::of::<B>()));
} | rust_cleaned_test_functions.jsonl/32642 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14000,
368,
341,
262,
1077,
5206,
1879,
284,
4337,
486,
2258,
1428,
262,
2060,
0,
3471,
14615,
2079,
72683,
2099,
31934,
486,
1055,
27638,
32,
29,
7392,
262,
2060,
0,
3471,
14615,
2079,
72683,
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_create_gic() {
let kvm = Kvm::new().unwrap();
let vm = kvm.create_vm().unwrap();
assert!(create_gic(&vm, 1).is_ok());
} | rust_cleaned_test_functions.jsonl/13048 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 90
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
1889,
292,
368,
341,
286,
1077,
94748,
284,
730,
7338,
486,
931,
1005,
15454,
543,
286,
1077,
10995,
284,
94748,
2520,
39008,
1005,
15454,
543,
286,
2060,
10297,
3182,
1889,
292,
2099,
7338,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_exchange_device_code_and_token() {
let details = new_device_auth_details(3600);
assert_eq!("12345", details.device_code().secret());
assert_eq!("https://verify/here", details.verification_uri().as_str());
assert_eq!("abcde", details.user_code().secret().as_str());
assert_eq!(
"https://verify/here?abcde",
details
.verification_uri_complete()
.unwrap()
.secret()
.as_str()
);
assert_eq!(Duration::from_secs(3600), details.expires_in());
assert_eq!(Duration::from_secs(1), details.interval());
let token = new_client()
.exchange_device_access_token(&details)
.set_time_fn(mock_time_fn())
.request(mock_http_client(
vec![
(ACCEPT, "application/json"),
(CONTENT_TYPE, "application/x-www-form-urlencoded"),
(AUTHORIZATION, "Basic YWFhOmJiYg=="),
],
"grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Adevice_code&device_code=12345",
None,
HttpResponse {
status_code: StatusCode::OK,
headers: vec![(
CONTENT_TYPE,
HeaderValue::from_str("application/json").unwrap(),
)]
.into_iter()
.collect(),
body: "{\
\"access_token\": \"12/34\", \
\"token_type\": \"bearer\", \
\"scope\": \"openid\"\
}"
.to_string()
.into_bytes(),
},
),
mock_sleep_fn,
None)
.unwrap();
assert_eq!("12/34", token.access_token().secret());
assert_eq!(BasicTokenType::Bearer, *token.token_type());
assert_eq!(
Some(&vec![Scope::new("openid".to_string()),]),
token.scopes()
);
assert_eq!(None, token.expires_in());
assert!(token.refresh_token().is_none());
} | rust_cleaned_test_functions.jsonl/18629 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1083
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
59212,
9204,
4136,
8378,
6458,
368,
341,
262,
1077,
3565,
284,
501,
9204,
14014,
13260,
7,
18,
21,
15,
15,
317,
262,
2060,
10714,
17223,
16,
17,
18,
19,
20,
497,
3565,
18355,
4136,
1005,
20474... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_json_pipe_expression() {
let n = PipeExpr {
base: BaseNode::default(),
argument: Expression::Identifier(Identifier {
base: BaseNode::default(),
name: "a".to_string(),
}),
call: CallExpr {
base: BaseNode::default(),
callee: Expression::Identifier(Identifier {
base: BaseNode::default(),
name: "a".to_string(),
}),
arguments: vec![Expression::StringLit(StringLit {
base: BaseNode::default(),
value: "hello".to_string(),
})],
},
};
let serialized = serde_json::to_string(&n).unwrap();
assert_eq!(
serialized,
r#"{"type":"PipeExpression","argument":{"type":"Identifier","name":"a"},"call":{"type":"CallExpression","callee":{"type":"Identifier","name":"a"},"arguments":[{"type":"StringLiteral","value":"hello"}]}}"#
);
let deserialized: PipeExpr = serde_json::from_str(serialized.as_str()).unwrap();
assert_eq!(deserialized, n)
} | rust_cleaned_test_functions.jsonl/40426 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 503
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9455,
41862,
28068,
368,
341,
262,
1077,
308,
284,
27805,
16041,
341,
286,
2331,
25,
5351,
1955,
486,
2258,
3148,
286,
5693,
25,
16378,
486,
8714,
7,
8714,
341,
310,
2331,
25,
5351,
1955,
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_hover_struct_doc_comment() {
check(
r#"
/// This is an example
/// multiline doc
///
/// # Example
///
/// ```
/// let five = 5;
///
/// assert_eq!(6, my_crate::add_one(5));
/// ```
struct Bar;
fn foo() { let bar = Ba$0r; }
"#,
expect![[r##"
*Bar*
```rust
test
```
```rust
struct Bar
```
---
This is an example
multiline doc
# Example
```
let five = 5;
assert_eq!(6, my_crate::add_one(5));
```
"##]],
);
} | rust_cleaned_test_functions.jsonl/66655 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 470
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53445,
15126,
18869,
17638,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
2575,
1096,
374,
458,
3110,
198,
2575,
85218,
4629,
198,
15374,
2575,
671,
13383,
198,
15374,
2575,
41233,
2575,
1077,
4236... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_raise() {
let mut level = Level::ltr();
assert_eq!(level.number(), 0);
assert!(level.raise(100).is_ok());
assert_eq!(level.number(), 100);
assert!(level.raise(26).is_ok());
assert_eq!(level.number(), 126);
assert!(level.raise(1).is_err()); // invalid!
assert!(level.raise(250).is_err()); // overflow!
assert_eq!(level.number(), 126);
} | rust_cleaned_test_functions.jsonl/31774 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 205
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55383,
368,
341,
286,
1077,
5206,
2188,
284,
9395,
486,
67375,
543,
286,
2060,
10714,
10297,
3294,
14341,
1507,
220,
15,
317,
286,
2060,
10297,
3294,
67834,
7,
16,
15,
15,
568,
285,
19817,
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_id() {
let key = Key::new([b'C', b'O'], Type::String);
assert_eq!(key.id(), 4411226);
let key = Key::new([b'N', b'H'], Type::Int32);
assert_eq!(key.id(), 5130345);
} | rust_cleaned_test_functions.jsonl/31624 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
842,
368,
341,
286,
1077,
1376,
284,
5309,
486,
931,
2561,
65,
76661,
516,
293,
87666,
4089,
3990,
486,
703,
317,
286,
2060,
10714,
10297,
792,
1764,
1507,
220,
19,
19,
16,
16,
17,
17,
21,
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_find_str() {
// byte positions
assert_eq!("".find_str(""), Some(0));
assert!("banana".find_str("apple pie").is_none());
let data = "abcabc";
assert_eq!(data[0..6].find_str("ab"), Some(0));
assert_eq!(data[2..6].find_str("ab"), Some(3 - 2));
assert!(data[2..4].find_str("ab").is_none());
let string = "ประเทศไทย中华Việt Nam";
let mut data = String::from_str(string);
data.push_str(string);
assert!(data.find_str("ไท华").is_none());
assert_eq!(data[0..43].find_str(""), Some(0));
assert_eq!(data[6..43].find_str(""), Some(6 - 6));
assert_eq!(data[0..43].find_str("ประ"), Some( 0));
assert_eq!(data[0..43].find_str("ทศไ"), Some(12));
assert_eq!(data[0..43].find_str("ย中"), Some(24));
assert_eq!(data[0..43].find_str("iệt"), Some(34));
assert_eq!(data[0..43].find_str("Nam"), Some(40));
assert_eq!(data[43..86].find_str("ประ"), Some(43 - 43));
assert_eq!(data[43..86].find_str("ทศไ"), Some(55 - 43));
assert_eq!(data[43..86].find_str("ย中"), Some(67 - 43));
assert_eq!(data[43..86].find_str("iệt"), Some(77 - 43));
assert_eq!(data[43..86].find_str("Nam"), Some(83 - 43));
} | rust_cleaned_test_functions.jsonl/11078 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 586
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
2895,
368,
341,
262,
442,
4922,
9892,
198,
262,
2060,
10714,
17223,
3263,
3903,
2895,
86076,
4329,
7,
15,
1106,
262,
2060,
17223,
87747,
3263,
3903,
2895,
445,
22377,
4349,
1827,
285,
31488... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pyerr_send_sync() {
fn is_send<T: Send>() {}
fn is_sync<T: Sync>() {}
is_send::<PyErr>();
is_sync::<PyErr>();
is_send::<PyErrState>();
is_sync::<PyErrState>();
} | rust_cleaned_test_functions.jsonl/56598 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40291,
615,
13565,
23008,
368,
341,
286,
5168,
374,
13565,
3125,
25,
11000,
13555,
5613,
286,
5168,
374,
23008,
3125,
25,
28937,
13555,
10086,
286,
374,
13565,
27638,
13828,
7747,
3913,
286,
374,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_ignore_separate_parameters() {
assert_eq!(
parse_format_flags_str(&vec!["od", "-I", "-A", "x"]).unwrap(),
vec![FORMAT_ITEM_DEC64S]
);
} | rust_cleaned_test_functions.jsonl/112169 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58493,
3453,
67598,
18263,
368,
341,
262,
2060,
10714,
33673,
286,
4715,
8955,
14130,
2895,
2099,
4083,
0,
1183,
347,
497,
6523,
40,
497,
6523,
32,
497,
330,
87,
45014,
15454,
3148,
286,
7486,
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 |
#[test]
fn test_sponge_gadget_poseidon() {
const STATE_WIDTH: usize = 3;
const RATE: usize = 2;
let rng = &mut init_rng();
let cs = &mut init_cs::<Bn256>();
let params = PoseidonParams::default();
test_sponge_gadget::<_, _, _, _, STATE_WIDTH, RATE>(cs, rng, ¶ms);
} | rust_cleaned_test_functions.jsonl/47365 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
36254,
1889,
50931,
33201,
90456,
368,
341,
262,
733,
22425,
13947,
25,
22301,
284,
220,
18,
280,
262,
733,
92470,
25,
22301,
284,
220,
17,
280,
262,
1077,
28422,
284,
609,
6984,
2930,
6684... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_to_lower_case() {
let tokens = token_stream_helper("Tree");
assert_eq!(tokens.len(), 1);
assert_token(&tokens[0], 0, "tree", 0, 4);
let tokens = token_stream_helper("Русский текст");
assert_eq!(tokens.len(), 2);
assert_token(&tokens[0], 0, "русский", 0, 14);
assert_token(&tokens[1], 1, "текст", 15, 25);
} | rust_cleaned_test_functions.jsonl/46274 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 214
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
30425,
19096,
368,
341,
286,
1077,
11211,
284,
3950,
12673,
10418,
445,
6533,
797,
286,
2060,
10714,
10297,
30566,
19406,
1507,
220,
16,
317,
286,
2060,
6458,
2099,
30566,
58,
15,
1125,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_raw_socket_no_reply() {
use crate::socket::{RawSocket, RawSocketBuffer, RawPacketMetadata};
use crate::wire::{IpVersion, Ipv4Packet, UdpPacket, UdpRepr};
let (mut iface, mut socket_set) = create_loopback();
let packets = 1;
let rx_buffer = RawSocketBuffer::new(vec![RawPacketMetadata::EMPTY; packets], vec![0; 48 * 1]);
let tx_buffer = RawSocketBuffer::new(vec![RawPacketMetadata::EMPTY; packets], vec![0; 48 * packets]);
let raw_socket = RawSocket::new(IpVersion::Ipv4, IpProtocol::Udp, rx_buffer, tx_buffer);
socket_set.add(raw_socket);
let src_addr = Ipv4Address([127, 0, 0, 2]);
let dst_addr = Ipv4Address([127, 0, 0, 1]);
let udp_repr = UdpRepr {
src_port: 67,
dst_port: 68,
payload: &[0x2a; 10]
};
let mut bytes = vec![0xff; udp_repr.buffer_len()];
let mut packet = UdpPacket::new_unchecked(&mut bytes[..]);
udp_repr.emit(&mut packet, &src_addr.into(), &dst_addr.into(), &ChecksumCapabilities::default());
let ipv4_repr = Ipv4Repr {
src_addr: src_addr,
dst_addr: dst_addr,
protocol: IpProtocol::Udp,
hop_limit: 64,
payload_len: udp_repr.buffer_len()
};
// Emit to frame
let mut bytes = vec![0u8;
ipv4_repr.buffer_len() + udp_repr.buffer_len()
];
let frame = {
ipv4_repr.emit(
&mut Ipv4Packet::new_unchecked(&mut bytes),
&ChecksumCapabilities::default());
udp_repr.emit(
&mut UdpPacket::new_unchecked(
&mut bytes[ipv4_repr.buffer_len()..]),
&src_addr.into(),
&dst_addr.into(),
&ChecksumCapabilities::default());
Ipv4Packet::new_unchecked(&bytes)
};
assert_eq!(iface.inner.process_ipv4(&mut socket_set, Instant::from_millis(0), &frame),
Ok(None));
} | rust_cleaned_test_functions.jsonl/100751 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1079
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16067,
19555,
6536,
15323,
368,
341,
286,
990,
17717,
486,
9556,
22964,
20015,
10286,
11,
23022,
10286,
4095,
11,
23022,
16679,
14610,
2440,
286,
990,
17717,
486,
35531,
22964,
23378,
5637,
11,
358,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parsing_bogus_validators_with_result() {
read_single_check_result("checks/tests/test10.json")
.map(|_check| assert!(false))
.unwrap_or_else(|err| {
assert!(
err.to_string()
.contains("unknown variant `ValidMoonFlower`")
);
});
} | rust_cleaned_test_functions.jsonl/80337 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 220
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
28598,
880,
538,
355,
8337,
2973,
6615,
5287,
368,
341,
286,
1349,
19487,
7200,
5287,
445,
49383,
62468,
12697,
16,
15,
4323,
1138,
310,
659,
2186,
22428,
62,
2028,
91,
2060,
10297,
3849,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_declaration5() {
use self::int::dec;
use ast::ArraySize::VariableExpression;
use ast::DeclaratorKind::Abstract;
use ast::DerivedDeclarator::Pointer;
use ast::TypeQualifier::Const;
use ast::TypeSpecifier::{Char, Int, TypedefName};
use parser::declaration;
let env = &mut Env::new();
env.add_typename("FILE");
env.add_typename("size_t");
assert_eq!(
declaration(
"char *fparseln(FILE *, size_t *, size_t *, const char[3], int);",
env
),
Ok(Declaration {
specifiers: vec![Char.into()],
declarators: vec![InitDeclarator {
declarator: Declarator {
kind: ident("fparseln"),
derived: vec![
Pointer(vec![]).into(),
FunctionDeclarator {
parameters: vec![
ParameterDeclaration {
specifiers: vec![TypedefName(ident("FILE")).into()],
declarator: Some(
Declarator {
kind: Abstract.into(),
derived: vec![Pointer(vec![]).into()],
extensions: vec![],
}
.into(),
),
extensions: vec![],
}
.into(),
ParameterDeclaration {
specifiers: vec![TypedefName(ident("size_t")).into()],
declarator: Some(
Declarator {
kind: Abstract.into(),
derived: vec![Pointer(vec![]).into()],
extensions: vec![],
}
.into(),
),
extensions: vec![],
}
.into(),
ParameterDeclaration {
specifiers: vec![TypedefName(ident("size_t")).into()],
declarator: Some(
Declarator {
kind: Abstract.into(),
derived: vec![Pointer(vec![]).into()],
extensions: vec![],
}
.into(),
),
extensions: vec![],
}
.into(),
ParameterDeclaration {
specifiers: vec![Const.into(), Char.into()],
declarator: Some(
Declarator {
kind: Abstract.into(),
derived: vec![ArrayDeclarator {
qualifiers: vec![],
size: VariableExpression(dec("3")),
}
.into()],
extensions: vec![],
}
.into(),
),
extensions: vec![],
}
.into(),
ParameterDeclaration {
specifiers: vec![Int.into()],
declarator: None,
extensions: vec![],
}
.into(),
],
ellipsis: Ellipsis::None,
}
.into(),
],
extensions: vec![],
}
.into(),
initializer: None,
}
.into()],
}
.into())
);
} | rust_cleaned_test_functions.jsonl/107552 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3465
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77926,
20,
368,
341,
262,
990,
656,
486,
396,
486,
8169,
280,
262,
990,
11763,
486,
1857,
1695,
486,
7827,
9595,
280,
262,
990,
11763,
486,
1912,
12821,
850,
10629,
486,
15949,
280,
262,
990,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_affine_shear_y_does_not_change_last_coordinate() {
let shear_y_with_x = 3;
let matrix = Matrix3x3::from_affine_shear_y(shear_y_with_x);
let unit_z = Vector3::unit_z();
let expected = unit_z;
let result = matrix * unit_z;
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/129047 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 165
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
48914,
482,
643,
86060,
4178,
96374,
7913,
15947,
12195,
68649,
368,
341,
286,
1077,
64244,
4178,
6615,
3212,
284,
220,
18,
280,
286,
1077,
6172,
284,
11631,
18,
87,
18,
486,
1499,
48914,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_function_xor() {
let formatter = Formatter::new();
// tests with functions
{
let test_metadata = {
let mut dict = HashMap::new();
dict.insert("title", "Flood");
dict.insert("artist", "Boris");
test::MetadataProvider::new(dict)
};
{
let expression = formatter
.parser()
.parse("$if($xor(test, test2, test3), ok, not)")
.unwrap();
let s = expression.apply(&test_metadata);
assert_eq!("not", s.to_string().as_str());
}
{
let expression = formatter
.parser()
.parse("$if($xor(%title%, test2, test3), ok, not)")
.unwrap();
let s = expression.apply(&test_metadata);
assert_eq!("ok", s.to_string().as_str());
}
{
let expression = formatter
.parser()
.parse("$if($xor(%title%, %artist%, test3), ok, not)")
.unwrap();
let s = expression.apply(&test_metadata);
assert_eq!("not", s.to_string().as_str());
}
{
let expression = formatter
.parser()
.parse("$if($xor(%title%, %artist%, %title%. test), ok, not)")
.unwrap();
let s = expression.apply(&test_metadata);
assert_eq!("ok", s.to_string().as_str());
}
{
let expression = formatter
.parser()
.parse("$if($xor(%title%, %album%, test3), ok, not)")
.unwrap();
let s = expression.apply(&test_metadata);
assert_eq!("ok", s.to_string().as_str());
}
}
} | rust_cleaned_test_functions.jsonl/47680 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 989
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9174,
76462,
368,
341,
262,
1077,
24814,
284,
81387,
486,
931,
543,
262,
442,
7032,
448,
5746,
198,
262,
341,
286,
1077,
1273,
22220,
284,
341,
310,
1077,
5206,
6451,
284,
10528,
486,
931,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_accountsdb_root_one_slot() {
solana_logger::setup();
let db = AccountsDb::new(Vec::new(), &ClusterType::Development);
let key = Pubkey::default();
let account0 = AccountSharedData::new(1, 0, &key);
db.store_uncached(0, &[(&key, &account0)]);
// now we have:
// root0 -> key.lamports==1
// key.lamports==0 <- slot1 \
// slot2 -> key.lamports==1
// store value 0 in one child
let account1 = AccountSharedData::new(0, 0, &key);
db.store_uncached(1, &[(&key, &account1)]);
// at the Accounts level)
let ancestors = vec![(0, 0), (1, 1)].into_iter().collect();
assert_eq!(
&db.load_without_fixed_root(&ancestors, &key).unwrap().0,
&account1
);
// we should see 1 token in slot 2
let ancestors = vec![(0, 0), (2, 2)].into_iter().collect();
assert_eq!(
&db.load_without_fixed_root(&ancestors, &key).unwrap().0,
&account0
);
db.add_root(0);
let ancestors = vec![(1, 1)].into_iter().collect();
assert_eq!(
db.load_without_fixed_root(&ancestors, &key),
Some((account1, 1))
);
let ancestors = vec![(2, 2)].into_iter().collect();
assert_eq!(
db.load_without_fixed_root(&ancestors, &key),
Some((account0, 0))
); // original value
} | rust_cleaned_test_functions.jsonl/1337 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 840
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55665,
1999,
12993,
11667,
27563,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
2927,
284,
40655,
7994,
486,
931,
49923,
486,
931,
1507,
609,
28678,
929,
486,
39419,
626,
286,
1077... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mvcc_properties() {
let mut cfg = DbConfig::default();
cfg.writecf.disable_auto_compactions = true;
cfg.writecf.dynamic_level_bytes = false;
let dir = tempfile::TempDir::new().unwrap();
let builder = TestEngineBuilder::new().path(dir.path());
let engine = builder.build_with_cfg(&cfg).unwrap();
let raw_engine = engine.get_rocksdb();
let value = vec![b'v'; 512];
let mut gc_runner = TestGCRunner::default();
for start_ts in &[100, 110, 120, 130] {
must_prewrite_put(&engine, b"zkey", &value, b"zkey", *start_ts);
must_commit(&engine, b"zkey", *start_ts, *start_ts + 5);
}
must_prewrite_delete(&engine, b"zkey", b"zkey", 140);
must_commit(&engine, b"zkey", 140, 145);
// Can't perform GC because the min timestamp is greater than safe point.
gc_runner
.callbacks_on_drop
.push(Arc::new(|_: &WriteCompactionFilter| {
unreachable!();
}));
gc_runner.target_level = Some(6);
gc_runner.safe_point(100).gc(&raw_engine);
// Can perform GC at the bottommost level even if the threshold can't be reached.
gc_runner.ratio_threshold = Some(10.0);
gc_runner.target_level = Some(6);
gc_runner.safe_point(140).gc(&raw_engine);
for commit_ts in &[105, 115, 125] {
must_get_none(&engine, b"zkey", commit_ts);
}
// Put an extra key to make the memtable overlap with the bottommost one.
must_prewrite_put(&engine, b"zkey1", &value, b"zkey1", 200);
must_commit(&engine, b"zkey1", 200, 205);
for start_ts in &[200, 210, 220, 230] {
must_prewrite_put(&engine, b"zkey", &value, b"zkey", *start_ts);
must_commit(&engine, b"zkey", *start_ts, *start_ts + 5);
}
must_prewrite_delete(&engine, b"zkey", b"zkey", 240);
must_commit(&engine, b"zkey", 240, 245);
raw_engine.flush_cf(CF_WRITE, true).unwrap();
// At internal levels can't perform GC because the threshold is not reached.
let level_files = rocksdb_level_files(&raw_engine, CF_WRITE);
let l0_file = dir.path().join(&level_files[0][0]);
let files = &[l0_file.to_str().unwrap().to_owned()];
gc_runner.target_level = Some(5);
gc_runner.ratio_threshold = Some(10.0);
gc_runner.safe_point(300).gc_on_files(&raw_engine, files);
for commit_ts in &[205, 215, 225, 235] {
must_get(&engine, b"zkey", commit_ts, &value);
}
} | rust_cleaned_test_functions.jsonl/101618 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1226
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73187,
638,
25158,
368,
341,
286,
1077,
5206,
13286,
284,
11988,
2648,
486,
2258,
543,
286,
13286,
3836,
9792,
42628,
27740,
18177,
4020,
284,
830,
280,
286,
13286,
3836,
9792,
59044,
8274,
12524,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_explicit_source() {
let io = io::Error::new(io::ErrorKind::Other, "oh no!");
let error = ExplicitSource {
source: String::new(),
io,
};
error.source().unwrap().downcast_ref::<io::Error>().unwrap();
} | rust_cleaned_test_functions.jsonl/42664 | {
"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,
14214,
6026,
10347,
368,
341,
262,
1077,
6399,
284,
6399,
486,
1454,
486,
931,
37258,
486,
1454,
10629,
486,
11409,
11,
330,
2267,
902,
11142,
262,
1077,
1465,
284,
31330,
3608,
341,
286,
2530,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_f32x4_only_first_any() {
let x1 = f32x4::new(1.0, 2.0, 2.0, 2.0);
let x2 = f32x4::splat(1.0);
assert!((x1.eq(x2)).any());
} | rust_cleaned_test_functions.jsonl/43323 | {
"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,
761,
18,
17,
87,
19,
18410,
12978,
37248,
368,
341,
286,
1077,
856,
16,
284,
282,
18,
17,
87,
19,
486,
931,
7,
16,
13,
15,
11,
220,
17,
13,
15,
11,
220,
17,
13,
15,
11,
220,
17,
13,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_executor_execute_and_commit_chunk_restart() {
let first_batch_size = 30;
let second_batch_size = 40;
let (chunks, ledger_info) = {
let first_batch_start = 1;
let second_batch_start = first_batch_start + first_batch_size;
create_transaction_chunks(vec![
first_batch_start..first_batch_start + first_batch_size,
second_batch_start..second_batch_start + second_batch_size,
])
};
let (config, _) = build_test_config();
let db = create_storage(&config);
// First we simulate syncing the first chunk of transactions.
{
let mut executor = Executor::<MockVM>::new(db.clone());
executor
.execute_and_commit_chunk(chunks[0].clone(), ledger_info.clone(), None)
.unwrap();
let li = db.reader.get_latest_ledger_info().unwrap();
assert_eq!(li.ledger_info().version(), 0);
assert_eq!(li.ledger_info().consensus_block_id(), HashValue::zero());
}
// Then we restart executor and resume to the next chunk.
{
let mut executor = Executor::<MockVM>::new(db.clone());
executor
.execute_and_commit_chunk(chunks[1].clone(), ledger_info.clone(), None)
.unwrap();
let li = db.reader.get_latest_ledger_info().unwrap();
assert_eq!(li, ledger_info);
}
} | rust_cleaned_test_functions.jsonl/36533 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 604
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
81207,
44329,
8378,
36346,
30539,
69392,
368,
341,
262,
1077,
1156,
14534,
2368,
284,
220,
18,
15,
280,
262,
1077,
2086,
14534,
2368,
284,
220,
19,
15,
401,
262,
1077,
320,
84263,
11,
46933,
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_process_cross_program() {
let caller_program_id = solana_sdk::pubkey::new_rand();
let callee_program_id = solana_sdk::pubkey::new_rand();
let builtin_programs = &[BuiltinProgram {
program_id: callee_program_id,
process_instruction: mock_process_instruction,
}];
let owned_account = AccountSharedData::new(42, 1, &callee_program_id);
let not_owned_account = AccountSharedData::new(84, 1, &solana_sdk::pubkey::new_rand());
let readonly_account = AccountSharedData::new(168, 1, &solana_sdk::pubkey::new_rand());
let loader_account = AccountSharedData::new(0, 0, &native_loader::id());
let mut program_account = AccountSharedData::new(1, 0, &native_loader::id());
program_account.set_executable(true);
let accounts = vec![
(solana_sdk::pubkey::new_rand(), owned_account),
(solana_sdk::pubkey::new_rand(), not_owned_account),
(solana_sdk::pubkey::new_rand(), readonly_account),
(caller_program_id, loader_account),
(callee_program_id, program_account),
];
let program_indices = [3, 4];
let metas = vec![
AccountMeta::new(accounts[0].0, false),
AccountMeta::new(accounts[1].0, false),
AccountMeta::new_readonly(accounts[2].0, false),
];
let instruction_accounts = metas
.iter()
.enumerate()
.map(|(index_in_transaction, account_meta)| InstructionAccount {
index_in_transaction,
index_in_caller: program_indices.len() + index_in_transaction,
is_signer: account_meta.is_signer,
is_writable: account_meta.is_writable,
})
.collect::<Vec<_>>();
let instruction = Instruction::new_with_bincode(
callee_program_id,
&MockInstruction::NoopSuccess,
metas.clone(),
);
let transaction_context = TransactionContext::new(accounts, 1);
let mut invoke_context = InvokeContext::new_mock(&transaction_context, builtin_programs);
invoke_context
.push(&instruction_accounts, &program_indices[..1])
.unwrap();
transaction_context
.get_account_at_index(1)
.borrow_mut()
.data_as_mut_slice()[0] = 1;
assert_eq!(
invoke_context
.process_instruction(
&instruction.data,
&instruction_accounts,
None,
&program_indices[1..],
)
.result,
Err(InstructionError::ExternalAccountDataModified)
);
transaction_context
.get_account_at_index(1)
.borrow_mut()
.data_as_mut_slice()[0] = 0;
// readonly account modified by the invoker
transaction_context
.get_account_at_index(2)
.borrow_mut()
.data_as_mut_slice()[0] = 1;
assert_eq!(
invoke_context
.process_instruction(
&instruction.data,
&instruction_accounts,
None,
&program_indices[1..],
)
.result,
Err(InstructionError::ReadonlyDataModified)
);
transaction_context
.get_account_at_index(2)
.borrow_mut()
.data_as_mut_slice()[0] = 0;
invoke_context.pop();
let cases = vec![
(
MockInstruction::NoopSuccess,
ProcessInstructionResult {
result: Ok(()),
compute_units_consumed: 0,
},
),
(
MockInstruction::NoopFail,
ProcessInstructionResult {
result: Err(InstructionError::GenericError),
compute_units_consumed: 0,
},
),
(
MockInstruction::ModifyOwned,
ProcessInstructionResult {
result: Ok(()),
compute_units_consumed: 0,
},
),
(
MockInstruction::ModifyNotOwned,
ProcessInstructionResult {
result: Err(InstructionError::ExternalAccountDataModified),
compute_units_consumed: 0,
},
),
];
for case in cases {
let instruction =
Instruction::new_with_bincode(callee_program_id, &case.0, metas.clone());
invoke_context
.push(&instruction_accounts, &program_indices[..1])
.unwrap();
assert_eq!(
invoke_context.process_instruction(
&instruction.data,
&instruction_accounts,
None,
&program_indices[1..],
),
case.1
);
invoke_context.pop();
}
} | rust_cleaned_test_functions.jsonl/132070 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2857
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
35284,
25096,
368,
341,
286,
1077,
19865,
25096,
842,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
94800,
25096,
842,
284,
2048,
3362,
61783,
486,
9585,
792,
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... | 5 |
#[test]
fn test_n_triples_literal_node_with_datatype_formatting() {
let formatter = NTriplesFormatter::new();
let node = Node::LiteralNode {
literal: "literal".to_string(),
data_type: Some(Uri::new("http://example.org/show/localName".to_string())),
language: None,
};
assert_eq!(
formatter.format_node(&node),
"\"literal\"^^<http://example.org/show/localName>".to_string()
);
} | rust_cleaned_test_functions.jsonl/64042 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 241
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1089,
3547,
37458,
34100,
5084,
6615,
15353,
20157,
8955,
1280,
368,
341,
286,
1077,
24814,
284,
17658,
4561,
642,
14183,
486,
931,
543,
286,
1077,
2436,
284,
6018,
486,
17350,
1955,
341,
310,
231... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_expression() {
assert!("a..b".parse::<PathExpression>().is_err());
assert_eq!(
"a.b.c".parse::<PathExpression>().unwrap(),
PathExpression(vec![
PathWord(vec![PathElement::Partial("a".to_string()),]),
PathWord(vec![PathElement::Partial("b".to_string()),]),
PathWord(vec![PathElement::Partial("c".to_string()),]),
])
);
assert_eq!(
parse!(path_expression, "a.b.c").to_string().as_str(),
"a.b.c"
);
assert_eq!(
parse!(path_expression, "a.b.[0-9]").to_string().as_str(),
"a.b.[0123456789]"
);
assert_eq!(
parse!(path_expression, "a.b.[0-9_A-F-]")
.to_string()
.as_str(),
"a.b.[-0123456789ABCDEF_]"
);
assert_eq!(
parse!(path_expression, "a.[cat]").to_string().as_str(),
"a.[act]"
);
assert_eq!(
parse!(path_expression, "hosts.$hostname.cpu")
.to_string()
.as_str(),
"hosts.$hostname.cpu"
);
assert_eq!(
"hosts.$hostname.cpu".parse::<PathExpression>().unwrap(),
PathExpression(vec![
PathWord(vec![PathElement::Partial("hosts".to_string()),]),
PathWord(vec![PathElement::Variable("hostname".to_string()),]),
PathWord(vec![PathElement::Partial("cpu".to_string()),]),
])
);
assert_eq!(
parse!(path_expression, "alpha.beta.gamma")
.to_string()
.as_str(),
"alpha.beta.gamma"
);
assert_eq!(
parse!(path_expression, "alpha.*.gamma")
.to_string()
.as_str(),
"alpha.*.gamma"
);
assert_eq!(
parse!(path_expression, "alpha.*.gamma"),
PathExpression(vec![
PathWord(vec![PathElement::Partial("alpha".to_string()),]),
PathWord(vec![PathElement::Asterisk,]),
PathWord(vec![PathElement::Partial("gamma".to_string()),]),
])
);
assert_eq!(
parse!(path_expression, "emea.events.clicks{2018,2019}")
.to_string()
.as_str(),
"emea.events.clicks{2018,2019}"
);
assert_eq!(
parse!(path_expression, r"emea.events\[\]\{\}.clicks{2018,2019}.05")
.to_string()
.as_str(),
"emea.events[]{}.clicks{2018,2019}.05"
);
} | rust_cleaned_test_functions.jsonl/130547 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1564
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2638,
28068,
368,
341,
286,
2060,
17223,
64,
496,
65,
3263,
6400,
27638,
1820,
9595,
10483,
285,
9266,
1423,
286,
2060,
10714,
33673,
310,
330,
64,
948,
520,
3263,
6400,
27638,
1820,
9595,
10483,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_distribution() {
solana_logger::setup();
let bootstrap_validator_pubkey = solana_sdk::pubkey::new_rand();
let bootstrap_validator_stake_lamports = 30;
let mut genesis_config = create_genesis_config_with_leader(
10,
&bootstrap_validator_pubkey,
bootstrap_validator_stake_lamports,
)
.genesis_config;
genesis_config.epoch_schedule = EpochSchedule::custom(
MINIMUM_SLOTS_PER_EPOCH,
genesis_config.epoch_schedule.leader_schedule_slot_offset,
false,
);
genesis_config.rent = Rent {
lamports_per_byte_year: 1,
exemption_threshold: 2.0,
burn_percent: 10,
};
let rent = Rent::free();
let validator_1_pubkey = solana_sdk::pubkey::new_rand();
let validator_1_stake_lamports = 20;
let validator_1_staking_keypair = Keypair::new();
let validator_1_voting_keypair = Keypair::new();
let validator_1_vote_account = vote_state::create_account(
&validator_1_voting_keypair.pubkey(),
&validator_1_pubkey,
0,
validator_1_stake_lamports,
);
let validator_1_stake_account = stake_state::create_account(
&validator_1_staking_keypair.pubkey(),
&validator_1_voting_keypair.pubkey(),
&validator_1_vote_account,
&rent,
validator_1_stake_lamports,
);
genesis_config.accounts.insert(
validator_1_pubkey,
Account::new(42, 0, &system_program::id()),
);
genesis_config.accounts.insert(
validator_1_staking_keypair.pubkey(),
Account::from(validator_1_stake_account),
);
genesis_config.accounts.insert(
validator_1_voting_keypair.pubkey(),
Account::from(validator_1_vote_account),
);
let validator_2_pubkey = solana_sdk::pubkey::new_rand();
let validator_2_stake_lamports = 20;
let validator_2_staking_keypair = Keypair::new();
let validator_2_voting_keypair = Keypair::new();
let validator_2_vote_account = vote_state::create_account(
&validator_2_voting_keypair.pubkey(),
&validator_2_pubkey,
0,
validator_2_stake_lamports,
);
let validator_2_stake_account = stake_state::create_account(
&validator_2_staking_keypair.pubkey(),
&validator_2_voting_keypair.pubkey(),
&validator_2_vote_account,
&rent,
validator_2_stake_lamports,
);
genesis_config.accounts.insert(
validator_2_pubkey,
Account::new(42, 0, &system_program::id()),
);
genesis_config.accounts.insert(
validator_2_staking_keypair.pubkey(),
Account::from(validator_2_stake_account),
);
genesis_config.accounts.insert(
validator_2_voting_keypair.pubkey(),
Account::from(validator_2_vote_account),
);
let validator_3_pubkey = solana_sdk::pubkey::new_rand();
let validator_3_stake_lamports = 30;
let validator_3_staking_keypair = Keypair::new();
let validator_3_voting_keypair = Keypair::new();
let validator_3_vote_account = vote_state::create_account(
&validator_3_voting_keypair.pubkey(),
&validator_3_pubkey,
0,
validator_3_stake_lamports,
);
let validator_3_stake_account = stake_state::create_account(
&validator_3_staking_keypair.pubkey(),
&validator_3_voting_keypair.pubkey(),
&validator_3_vote_account,
&rent,
validator_3_stake_lamports,
);
genesis_config.accounts.insert(
validator_3_pubkey,
Account::new(42, 0, &system_program::id()),
);
genesis_config.accounts.insert(
validator_3_staking_keypair.pubkey(),
Account::from(validator_3_stake_account),
);
genesis_config.accounts.insert(
validator_3_voting_keypair.pubkey(),
Account::from(validator_3_vote_account),
);
genesis_config.rent = Rent {
lamports_per_byte_year: 1,
exemption_threshold: 10.0,
burn_percent: 10,
};
let mut bank = Bank::new(&genesis_config);
// Enable rent collection
bank.rent_collector.epoch = 5;
bank.rent_collector.slots_per_year = 192.0;
let payer = Keypair::new();
let payer_account = AccountSharedData::new(400, 0, &system_program::id());
bank.store_account_and_update_capitalization(&payer.pubkey(), &payer_account);
let payee = Keypair::new();
let payee_account = AccountSharedData::new(70, 1, &system_program::id());
bank.store_account_and_update_capitalization(&payee.pubkey(), &payee_account);
let bootstrap_validator_initial_balance = bank.get_balance(&bootstrap_validator_pubkey);
let tx = system_transaction::transfer(&payer, &payee.pubkey(), 180, genesis_config.hash());
let result = bank.process_transaction(&tx);
assert_eq!(result, Ok(()));
let mut total_rent_deducted = 0;
assert_eq!(bank.get_balance(&payer.pubkey()), 92);
total_rent_deducted += 128;
assert_eq!(bank.get_balance(&payee.pubkey()), 159);
total_rent_deducted += 70 + 21;
let previous_capitalization = bank.capitalization.load(Relaxed);
bank.freeze();
assert_eq!(bank.collected_rent.load(Relaxed), total_rent_deducted);
let burned_portion =
total_rent_deducted * u64::from(bank.rent_collector.rent.burn_percent) / 100;
let rent_to_be_distributed = total_rent_deducted - burned_portion;
let bootstrap_validator_portion =
((bootstrap_validator_stake_lamports * rent_to_be_distributed) as f64 / 100.0) as u64
+ 1; // Leftover lamport
assert_eq!(
bank.get_balance(&bootstrap_validator_pubkey),
bootstrap_validator_portion + bootstrap_validator_initial_balance
);
// between their pubkey.
let tweak_1 = if validator_1_pubkey > validator_2_pubkey {
1
} else {
0
};
let validator_1_portion =
((validator_1_stake_lamports * rent_to_be_distributed) as f64 / 100.0) as u64 + tweak_1;
assert_eq!(
bank.get_balance(&validator_1_pubkey),
validator_1_portion + 42 - tweak_1,
);
// between their pubkey.
let tweak_2 = if validator_2_pubkey > validator_1_pubkey {
1
} else {
0
};
let validator_2_portion =
((validator_2_stake_lamports * rent_to_be_distributed) as f64 / 100.0) as u64 + tweak_2;
assert_eq!(
bank.get_balance(&validator_2_pubkey),
validator_2_portion + 42 - tweak_2,
);
let validator_3_portion =
((validator_3_stake_lamports * rent_to_be_distributed) as f64 / 100.0) as u64 + 1;
assert_eq!(
bank.get_balance(&validator_3_pubkey),
validator_3_portion + 42
);
let current_capitalization = bank.capitalization.load(Relaxed);
let sysvar_and_native_proram_delta = 1;
assert_eq!(
previous_capitalization - current_capitalization + sysvar_and_native_proram_delta,
burned_portion
);
assert!(bank.calculate_and_verify_capitalization());
assert_eq!(
rent_to_be_distributed,
bank.rewards
.read()
.unwrap()
.iter()
.map(|(address, reward)| {
assert_eq!(reward.reward_type, RewardType::Rent);
if *address == validator_2_pubkey {
assert_eq!(reward.post_balance, validator_2_portion + 42 - tweak_2);
} else if *address == validator_3_pubkey {
assert_eq!(reward.post_balance, validator_3_portion + 42);
}
reward.lamports as u64
})
.sum::<u64>()
);
} | rust_cleaned_test_functions.jsonl/31234 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 4274
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
83127,
41465,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
1428,
286,
1077,
26925,
64959,
34014,
792,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
26925,
64959,
1261,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_hash_procedure() {
let url = Gravatar::new(" EMaiL@exAMplE.cOm ").image_url();
assert_eq!(
url.as_str(),
"https://secure.gravatar.com/avatar/5658ffccee7f0ebfda2b226238b1eb6e"
);
} | rust_cleaned_test_functions.jsonl/61376 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
2540,
13196,
368,
341,
262,
1077,
2515,
284,
2825,
11962,
486,
931,
445,
220,
16902,
2143,
43,
31,
327,
1402,
500,
36,
520,
63488,
27510,
1805,
2903,
543,
262,
2060,
10714,
33673,
286,
251... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_part1() {
let data = fs::read_to_string("inputs/input01.test.txt").expect("Unable to read file");
let input = prepare_input(data);
assert_eq!(part1(&input), 7);
} | rust_cleaned_test_functions.jsonl/9030 | {
"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,
10495,
16,
368,
341,
286,
1077,
821,
284,
8619,
486,
878,
2346,
3904,
445,
24941,
39990,
15,
16,
5958,
3909,
1827,
17119,
445,
17075,
311,
1349,
1034,
797,
286,
1077,
1946,
284,
10549,
5898,
259... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_config_expand_price_variants_2() {
let product = Product {
id: "test".to_string(),
price: 2.0,
locales: Default::default(),
consumable: false,
price_variants: vec![2.0, 3.0],
image_path: "".to_string(),
};
let mut config = Config {
price_variant_multiplier: true,
products: vec![product],
android: Default::default(),
ios: Default::default(),
};
config.expand_price_variants();
assert_eq!(config.products[0].id, "test");
assert_eq!(config.products[1].id, "test_1");
assert_eq!(config.products[2].id, "test_2");
assert!((config.products[0].price - 2.0).abs() < 0.01);
assert!((config.products[1].price - 4.0).abs() < 0.01);
assert!((config.products[2].price - 6.0).abs() < 0.01);
} | rust_cleaned_test_functions.jsonl/33243 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 464
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5332,
67875,
9040,
4612,
62278,
62,
17,
368,
341,
286,
1077,
1985,
284,
5643,
341,
310,
877,
25,
330,
1944,
3263,
983,
3904,
3148,
310,
3349,
25,
220,
17,
13,
15,
345,
310,
52297,
25,
7899,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_join_sep() {
let mut args = HashMap::new();
args.insert("sep".to_owned(), to_value(&"==").unwrap());
let result = join(&to_value(&vec!["Cats", "Dogs"]).unwrap(), &args);
assert!(result.is_ok());
assert_eq!(result.unwrap(), to_value(&"Cats==Dogs").unwrap());
} | rust_cleaned_test_functions.jsonl/62046 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31017,
54775,
368,
341,
286,
1077,
5206,
2827,
284,
10528,
486,
931,
543,
286,
2827,
7030,
445,
28036,
3263,
983,
51973,
1507,
311,
3142,
2099,
1,
418,
1827,
15454,
5231,
286,
1077,
1102,
284,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_proof_cycle() {
init!("true");
let connection_h = connection::tests::build_test_connection();
let requests = get_proof_request_messages(connection_h, None).unwrap();
let requests: Value = serde_json::from_str(&requests).unwrap();
let requests = serde_json::to_string(&requests[0]).unwrap();
let handle = create_proof("TEST_CREDENTIAL", &requests).unwrap();
assert_eq!(VcxStateType::VcxStateRequestReceived as u32, get_state(handle).unwrap());
send_proof(handle, connection_h).unwrap();
assert_eq!(VcxStateType::VcxStateAccepted as u32, get_state(handle).unwrap());
} | rust_cleaned_test_functions.jsonl/106014 | {
"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,
86757,
39079,
368,
341,
286,
2930,
17223,
1866,
3071,
286,
1077,
3633,
1523,
284,
3633,
486,
23841,
486,
5834,
4452,
15866,
1428,
286,
1077,
7388,
284,
633,
86757,
7893,
23428,
24147,
1523,
11,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_diff_stat_line_regex_1() {
let caps = DIFF_STAT_LINE_REGEX.captures(" src/delta.rs | 14 ++++++++++----");
assert!(caps.is_some());
let caps = caps.unwrap();
assert_eq!(caps.get(1).unwrap().as_str(), "src/delta.rs");
assert_eq!(caps.get(2).unwrap().as_str(), "| 14 ++++++++++----");
} | rust_cleaned_test_functions.jsonl/108166 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 170
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15850,
16271,
6528,
41832,
62,
16,
368,
341,
286,
1077,
18568,
284,
68549,
16113,
15657,
56196,
520,
2689,
1413,
445,
2286,
3446,
5964,
25638,
220,
760,
220,
16,
19,
488,
25393,
10,
381,
797,
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_legal_moves_from_mochigoma_with_kei_sente() {
let mut banmen = rule::BANMEN_START_POS.clone();
banmen.0[2][8] = Blank;
banmen.0[3][8] = GFu;
banmen.0[8][7] = Blank;
let mut ms:HashMap<MochigomaKind,u32> = HashMap::new();
ms.insert(MochigomaKind::Kei, 1);
let mc:MochigomaCollections = MochigomaCollections::Pair(ms,HashMap::new());
assert_eq!(legal_moves_from_mochigoma(&Teban::Sente,&mc,&banmen),
Rule::legal_moves_from_mochigoma(Teban::Sente,&mc,&State::new(banmen.clone())).into_iter().map(|m| {
LegalMove::from(m)
}).collect::<Vec<LegalMove>>()
);
} | rust_cleaned_test_functions.jsonl/81333 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 303
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82324,
45390,
5673,
717,
4953,
343,
7786,
6615,
45476,
72,
643,
6817,
368,
972,
10217,
5206,
8943,
5676,
284,
5912,
486,
33,
1093,
44,
953,
13044,
18313,
15997,
7317,
2233,
276,
5676,
13,
15,
58... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_good_password() {
let input = vec![
"111211".to_string().chars().collect(),
"11111".to_string().chars().collect(),
"111110".to_string().chars().collect(),
"112221".to_string().chars().collect(),
"123456".to_string().chars().collect(),
"122234".to_string().chars().collect(),
];
for password in &input {
assert_eq!(good_password(password), false);
}
} | rust_cleaned_test_functions.jsonl/132780 | {
"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,
44781,
10122,
368,
341,
262,
1077,
1946,
284,
7486,
90515,
286,
330,
16,
16,
16,
17,
16,
16,
3263,
983,
3904,
1005,
19255,
1005,
17384,
3148,
286,
330,
16,
16,
16,
16,
16,
3263,
983,
3904,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_log_level_spec() {
let test_cases = vec![
("", LogLevelSpec::default()),
(
"info",
LogLevelSpec {
global_level: Some(LevelFilter::Info),
module_levels: vec![],
},
),
(
"debug,common=info,network=warn",
LogLevelSpec {
global_level: Some(LevelFilter::Debug),
module_levels: vec![
("common".to_string(), LevelFilter::Info),
("network".to_string(), LevelFilter::Warn),
],
},
),
];
for (spec_str, expected) in test_cases {
let actual = super::parse_spec(spec_str);
assert_eq!(actual, expected);
}
} | rust_cleaned_test_functions.jsonl/49018 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 531
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5224,
8274,
13594,
368,
341,
286,
1077,
1273,
41427,
284,
7486,
90515,
310,
3489,
497,
63321,
8327,
486,
2258,
14702,
310,
2399,
394,
330,
2733,
756,
394,
63321,
8327,
341,
503,
3644,
8274,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_normalize() {
let segment = Segment {
point: (1., 1.),
vector: Vector2D { x: 11., y: 11. },
};
let normalized_segment = segment.normalize();
assert_float(normalized_segment.length(), 1.);
} | rust_cleaned_test_functions.jsonl/110310 | {
"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,
80807,
368,
341,
286,
1077,
10238,
284,
37103,
341,
310,
1459,
25,
320,
16,
2572,
220,
16,
13,
1326,
310,
4621,
25,
4196,
17,
35,
314,
856,
25,
220,
16,
16,
2572,
379,
25,
220,
16,
16,
13,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_radix4() {
for pow in 0..8 {
let len = 1 << pow;
test_radix4_with_length(len, false);
test_radix4_with_length(len, true);
}
} | rust_cleaned_test_functions.jsonl/103152 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 119
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39764,
941,
19,
368,
341,
286,
369,
6875,
304,
220,
15,
496,
23,
341,
310,
1077,
2422,
284,
220,
16,
1115,
6875,
280,
310,
1273,
39764,
941,
19,
6615,
5118,
6901,
11,
895,
317,
310,
1273,
39... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_trim_multiline_single_line() {
assert_eq!("", trim_multiline("".into(), false, None));
assert_eq!("...", trim_multiline("...".into(), false, None));
assert_eq!("...", trim_multiline(" ...".into(), false, None));
assert_eq!("...", trim_multiline("\t...".into(), false, None));
assert_eq!("...", trim_multiline("\t\t...".into(), false, None));
} | rust_cleaned_test_functions.jsonl/4234 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 183
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70025,
26290,
26560,
19487,
6528,
368,
341,
286,
2060,
10714,
17223,
497,
11013,
26290,
26560,
445,
3263,
18122,
1507,
895,
11,
2240,
1106,
286,
2060,
10714,
17223,
46844,
11013,
26290,
26560,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_closures_external() -> Result<(), Box<EvalAltResult>> {
let engine = Engine::new();
let mut ast = engine.compile(
r#"
let test = "hello";
|x| test + x
"#,
)?;
// Save the function pointer together with captured variables
let fn_ptr = engine.eval_ast::<FnPtr>(&ast)?;
ast.retain_functions(|_, _, _, _| true);
// Create function namespace from the 'AST'
let lib = [ast.as_ref()];
// Create native call context
let context = NativeCallContext::new(&engine, &lib);
let f = move |x: INT| fn_ptr.call_dynamic(context, None, [x.into()]);
assert_eq!(f(42)?.as_str(), Ok("hello42"));
Ok(())
} | rust_cleaned_test_functions.jsonl/100517 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 305
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
41206,
47432,
368,
1464,
5714,
68843,
8261,
23835,
831,
26017,
2077,
2452,
341,
262,
1077,
4712,
284,
8200,
486,
931,
1428,
262,
1077,
5206,
11763,
284,
4712,
18922,
1006,
286,
435,
2,
698,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_errors() {
assert_eq!(
eval("-true"),
Err(EvalexprError::expected_number(Value::Boolean(true)))
);
assert_eq!(
eval("1-true"),
Err(EvalexprError::expected_number(Value::Boolean(true)))
);
assert_eq!(
eval("true-"),
Err(EvalexprError::WrongOperatorArgumentAmount {
actual: 1,
expected: 2
})
);
assert_eq!(eval("!(()true)"), Err(EvalexprError::AppendedToLeafNode));
} | rust_cleaned_test_functions.jsonl/105349 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 251
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20196,
368,
341,
262,
2060,
10714,
33673,
286,
5603,
13645,
1866,
4461,
286,
15495,
10722,
85,
55875,
649,
1454,
486,
7325,
5500,
25346,
486,
6890,
3715,
5929,
262,
1439,
262,
2060,
10714,
33673,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lew_std() {
let result = get_actual_result("test_csvs/Lew.csv", "stddev");
assert_abs_diff_eq!(result, 277.332168044316, epsilon = stddev_epsilon());
} | rust_cleaned_test_functions.jsonl/80537 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 84
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11751,
86,
15656,
368,
341,
262,
1077,
1102,
284,
633,
40149,
5287,
445,
1944,
14020,
82,
7434,
365,
11219,
497,
330,
1834,
3583,
797,
262,
2060,
31170,
15850,
10714,
10297,
1382,
11,
220,
17,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_smaps() {
let me = Process::myself().unwrap();
let smaps = match me.smaps() {
Ok(x) => x,
Err(ProcError::NotFound(_)) => {
// ignored because not all kernerls have smaps
return;
}
Err(e) => panic!("{}", e),
};
println!("{:#?}", smaps);
} | rust_cleaned_test_functions.jsonl/17537 | {
"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,
643,
17640,
368,
341,
262,
1077,
752,
284,
8603,
486,
2408,
721,
1005,
15454,
543,
262,
1077,
1525,
2625,
284,
2432,
752,
514,
17640,
368,
341,
286,
7622,
2075,
8,
589,
856,
345,
286,
15495,
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... | 2 |
#[test]
fn test_create_genesis_account() {
solana_logger::setup();
let amount = 10_000_000;
let mut unallocated = LibraAccount::create_unallocated();
let mut keyed_accounts = vec![KeyedAccount::new(
&unallocated.key,
false,
&mut unallocated.account,
)];
MoveProcessor::do_invoke_main(
&mut keyed_accounts,
&bincode::serialize(&InvokeCommand::CreateGenesis(amount)).unwrap(),
)
.unwrap();
assert_eq!(
bincode::deserialize::<LibraAccountState>(
&LibraAccount::create_genesis(amount).account.data
)
.unwrap(),
bincode::deserialize::<LibraAccountState>(&keyed_accounts[0].account.data).unwrap()
);
} | rust_cleaned_test_functions.jsonl/66802 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 414
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
16322,
13774,
13500,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
1428,
286,
1077,
3311,
284,
220,
16,
15,
62,
15,
15,
15,
62,
15,
15,
15,
280,
286,
1077,
5206,
650,
57372,
284,
5688,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vector_7() {
let address = "DdzFFzCqrhsy2zYMDQRCF4Nw34C3P7aT5B7JwHFQ6gLAeoHgVXurCLPCm3AeV1nTa1Nd46uDoNt16cnsPFkb4fpLi1J17AmvphCtGFz2".parse().unwrap();
let public_key = XPub::from_bytes([
0x0c, 0xd2, 0x15, 0x54, 0xa0, 0xf9, 0xb8, 0x25, 0x9c, 0x46, 0x88, 0xdd, 0x00, 0xfc,
0x01, 0x88, 0x43, 0x50, 0x79, 0x76, 0x4f, 0xa5, 0x50, 0xfb, 0x57, 0x38, 0x2b, 0xff,
0x43, 0xe2, 0xd8, 0xd8, 0x27, 0x27, 0x4e, 0x2a, 0x12, 0x9f, 0x86, 0xc3, 0x80, 0x88,
0x34, 0x37, 0x4d, 0xfe, 0x3f, 0xda, 0xa6, 0x28, 0x48, 0x30, 0xb8, 0xf6, 0xe4, 0x0d,
0x29, 0x93, 0xde, 0xa2, 0xfb, 0x0a, 0xbe, 0x82,
]);
assert_same_address(address, public_key)
} | rust_cleaned_test_functions.jsonl/1899 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 497
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12247,
62,
22,
368,
341,
286,
1077,
2621,
284,
330,
35,
37877,
1748,
89,
34,
23004,
4997,
88,
17,
89,
56,
6076,
48,
7380,
37,
19,
45,
86,
18,
19,
34,
18,
47,
22,
64,
51,
20,
33,
22,
41... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_session_bus_path() {
let path = "unix:path=/tmp/dbus-test-not-exist";
let addr = parse_dbus_addr_str(path);
assert!(addr.is_err());
} | rust_cleaned_test_functions.jsonl/23532 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
12316,
25418,
2638,
368,
341,
286,
1077,
1815,
284,
330,
56646,
71796,
23286,
5173,
29357,
355,
16839,
29169,
10187,
380,
3302,
286,
1077,
10789,
284,
4715,
8685,
355,
7387,
2895,
5581,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_one() {
let one_bigint = BigInteger::from(1u64);
let fp1 = FpCurv::from_repr(one_bigint);
let fp2 = FpCurv::one();
assert_eq!(fp1, fp2);
} | rust_cleaned_test_functions.jsonl/50446 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 113
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11667,
368,
341,
286,
1077,
825,
36386,
396,
284,
34042,
486,
1499,
7,
16,
84,
21,
19,
317,
286,
1077,
12007,
16,
284,
434,
79,
16704,
85,
486,
1499,
68535,
51067,
36386,
396,
317,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_heterogenous_list() {
let data = [
0x6f, 0x34, 0x01, 0x00, 0x03, 0x00, 0x0c, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x0c, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x14, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0c, 0x00,
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x14, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00,
0xaa, 0xaa, 0x01, 0x00, 0x03, 0x00, 0xbb, 0xbb, 0x01, 0x00, 0xcc, 0xcc, 0x04, 0x00,
];
assert_eq!(
parse(&data[..]).unwrap().token_tape,
vec![
BinaryToken::Token(0x346f),
BinaryToken::Array(9),
BinaryToken::I32(10),
BinaryToken::HiddenObject(8),
BinaryToken::I32(0),
BinaryToken::U32(2),
BinaryToken::I32(1),
BinaryToken::U32(2),
BinaryToken::End(3),
BinaryToken::End(1),
BinaryToken::Token(0xaaaa),
BinaryToken::Object(14),
BinaryToken::Token(0xbbbb),
BinaryToken::Token(0xcccc),
BinaryToken::End(11),
]
);
} | rust_cleaned_test_functions.jsonl/109426 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 761
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1523,
1404,
52495,
2019,
368,
341,
286,
1077,
821,
284,
2278,
310,
220,
15,
87,
21,
69,
11,
220,
15,
87,
18,
19,
11,
220,
15,
87,
15,
16,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
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_quote_unquote() {
let text1 = "亀井 裕";
let text2 = "亀井 裕 in Tokyo";
let text3 = "/a/b/c/亀井 ページ";
let quoted_text1 = quote(text1, b"").ok().unwrap();
let unquoted_text1 = unquote("ed_text1).ok().unwrap();
let quoted_text2 = quote_plus(text2, b"").ok().unwrap();
let unquoted_text2 = unquote_plus("ed_text2).ok().unwrap();
let quoted_text3 = quote_plus(text3, b"/").ok().unwrap();
let unquoted_text3 = unquote_plus("ed_text3).ok().unwrap();
assert_eq!(text1, unquoted_text1);
assert_eq!(text2, unquoted_text2);
assert_eq!(text3, unquoted_text3);
} | rust_cleaned_test_functions.jsonl/21624 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 295
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45236,
4907,
2949,
368,
341,
262,
1077,
1467,
16,
284,
330,
6684,
222,
104097,
8908,
96,
243,
876,
262,
1077,
1467,
17,
284,
330,
6684,
222,
104097,
8908,
96,
243,
304,
26194,
876,
262,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dispute_refund() {
new_test_ext().execute_with(|| {
let payment_amount = 20;
let expected_incentive_amount = payment_amount / INCENTIVE_PERCENTAGE as u128;
let expected_cancel_block = CANCEL_BLOCK_BUFFER + 1;
assert_ok!(Payment::pay(
Origin::signed(PAYMENT_CREATOR),
PAYMENT_RECIPENT,
CURRENCY_ID,
payment_amount,
None
));
// cannot dispute if refund is not requested
assert_noop!(
Payment::dispute_refund(Origin::signed(PAYMENT_RECIPENT), PAYMENT_CREATOR),
Error::InvalidAction
);
// creator requests a refund
assert_ok!(Payment::request_refund(
Origin::signed(PAYMENT_CREATOR),
PAYMENT_RECIPENT
));
// ensure the request is added to the refund queue
let scheduled_tasks_list = ScheduledTasks::<Test>::get();
assert_eq!(
scheduled_tasks_list.get(&(PAYMENT_CREATOR, PAYMENT_RECIPENT)).unwrap(),
&ScheduledTask {
task: Task::Cancel,
when: expected_cancel_block
}
);
// recipient disputes the refund request
assert_ok!(Payment::dispute_refund(
Origin::signed(PAYMENT_RECIPENT),
PAYMENT_CREATOR
));
assert_eq!(
PaymentStore::<Test>::get(PAYMENT_CREATOR, PAYMENT_RECIPENT),
Some(PaymentDetail {
asset: CURRENCY_ID,
amount: payment_amount,
incentive_amount: expected_incentive_amount,
state: PaymentState::NeedsReview,
resolver_account: RESOLVER_ACCOUNT,
fee_detail: Some((FEE_RECIPIENT_ACCOUNT, 0)),
})
);
assert_eq!(
last_event(),
crate::Event::<Test>::PaymentRefundDisputed {
from: PAYMENT_CREATOR,
to: PAYMENT_RECIPENT,
}
.into()
);
// ensure the request is removed from the refund queue
let scheduled_tasks_list = ScheduledTasks::<Test>::get();
assert_eq!(scheduled_tasks_list.get(&(PAYMENT_CREATOR, PAYMENT_RECIPENT)), None);
});
} | rust_cleaned_test_functions.jsonl/111991 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 764
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9932,
8492,
7793,
1241,
368,
341,
8638,
4452,
9927,
1005,
10257,
6615,
79453,
341,
197,
10217,
8160,
13471,
284,
220,
17,
15,
280,
197,
10217,
3601,
1243,
1168,
533,
13471,
284,
8160,
13471,
608,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_max() {
let uid = Uid::max();
assert!(uid.position == big(0b1_11111111111111111111));
assert!(uid.site_id == 4294967295);
assert!(uid.counter == 4294967295);
} | rust_cleaned_test_functions.jsonl/58312 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 108
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6345,
368,
341,
286,
1077,
14617,
284,
547,
307,
486,
2810,
543,
286,
2060,
10297,
2423,
6187,
621,
2409,
7,
15,
65,
16,
62,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_function_return_value_anon_lifetime_param() {
check_assist(
introduce_named_lifetime,
r#"fn my_fun() -> X<'_<|>>"#,
r#"fn my_fun<'a>() -> X<'a>"#,
);
} | rust_cleaned_test_functions.jsonl/109556 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 137
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9174,
12511,
3142,
12008,
263,
98827,
4090,
368,
341,
286,
1779,
12083,
380,
1006,
310,
19131,
71834,
98827,
345,
310,
435,
55543,
8822,
847,
28315,
368,
1464,
1599,
18291,
41743,
91,
2452,
57676,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_describe_data_plane() {
// no nodes
assert_eq!(num_layers(0, 200, 200, false), 0);
// 1 node
assert_eq!(num_layers(1, 200, 200, false), 1);
// 10 nodes with fanout of 2 and hood size of 2
assert_eq!(num_layers(10, 2, 2, false), 5);
// fanout + 1 nodes with fanout of 2 and hood size of 2
assert_eq!(num_layers(3, 2, 2, false), 2);
// 10 nodes with fanout of 4 and hood size of 2 while growing
assert_eq!(num_layers(10, 4, 2, true), 3);
// A little more realistic
assert_eq!(num_layers(100, 10, 10, false), 3);
// A little more realistic with odd numbers
assert_eq!(num_layers(103, 13, 13, false), 3);
// larger
let (layer_cnt, layer_indices) = ClusterInfo::describe_data_plane(10_000, 10, 10, false);
assert_eq!(layer_cnt, 201);
// distances between index values should be the same since we aren't growing.
let capacity = 10 / 2 * 10;
assert_eq!(layer_indices[1], 10);
layer_indices[1..layer_indices.len()]
.chunks(2)
.for_each(|x| {
if x.len() == 2 {
assert_eq!(x[1] - x[0], capacity);
}
});
// massive
let (layer_cnt, layer_indices) = ClusterInfo::describe_data_plane(500_000, 200, 200, false);
let capacity = 200 / 2 * 200;
let cnt = 500_000 / capacity + 1;
assert_eq!(layer_cnt, cnt);
// distances between index values should be the same since we aren't growing.
assert_eq!(layer_indices[1], 200);
layer_indices[1..layer_indices.len()]
.chunks(2)
.for_each(|x| {
if x.len() == 2 {
assert_eq!(x[1] - x[0], capacity);
}
});
let total_capacity: usize = *layer_indices.last().unwrap();
assert!(total_capacity >= 500_000);
// massive with growth
assert_eq!(num_layers(500_000, 200, 200, true), 3);
} | rust_cleaned_test_functions.jsonl/105863 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1021
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15768,
3114,
1769,
46023,
368,
341,
286,
442,
902,
7798,
198,
286,
2060,
10714,
10297,
2413,
26091,
7,
15,
11,
220,
17,
15,
15,
11,
220,
17,
15,
15,
11,
895,
701,
220,
15,
626,
286,
442,
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... | 3 |
#[test]
fn test_merge_tree_to_blob_into_modified_tree() -> BitResult<()> {
BitRepo::with_minimal_repo_with_dir(|repo| {
let ours = commit! {
dir {
bar < "modified bar contents"
}
};
let theirs = commit! {
dir < "dir is now a file"
};
let conflicts = repo.three_way_merge(ours, theirs)?.into_conflicts();
let mut conflicts = conflicts.into_iter();
assert_eq!(
conflicts.next().unwrap(),
Conflict::new_with_type(p!("dir"), ConflictType::AddedByThem)
);
assert_eq!(
conflicts.next().unwrap(),
Conflict::new_with_type(p!("dir/bar"), ConflictType::ModifyDelete)
);
assert_eq!(cat!(repo: "dir~theirs"), "dir is now a file");
assert_eq!(cat!(repo: "dir/bar"), "modified bar contents");
Ok(())
})
} | rust_cleaned_test_functions.jsonl/94169 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 455
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20888,
11663,
2346,
45908,
45514,
37749,
11663,
368,
1464,
6495,
2077,
71698,
341,
262,
6495,
25243,
486,
4197,
7260,
2861,
37784,
6615,
4334,
22428,
23476,
91,
341,
286,
1077,
11350,
284,
5266,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_to_pretty_dec() {
assert_eq!(to_pretty_dec(0), "0");
assert_eq!(to_pretty_dec(12), "12");
assert_eq!(to_pretty_dec(123), "123");
assert_eq!(to_pretty_dec(1234), "1_234");
assert_eq!(to_pretty_dec(12345), "12_345");
assert_eq!(to_pretty_dec(123456), "123_456");
assert_eq!(to_pretty_dec(1234567), "1_234_567");
} | rust_cleaned_test_functions.jsonl/17921 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 231
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
620,
21322,
13783,
368,
341,
286,
2060,
10714,
10297,
983,
620,
21322,
13783,
7,
15,
701,
981,
330,
15,
797,
286,
2060,
10714,
10297,
983,
620,
21322,
13783,
7,
16,
17,
701,
414,
330,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_non_existent_segwit_version() {
let version = 13;
// 40-byte program
let program = hex!(
"654f6ea368e0acdfd92976b7c2103a1b26313f430654f6ea368e0acdfd92976b7c2103a1b26313f4"
);
let addr = Address {
payload: Payload::WitnessProgram {
version: bech32::u5::try_from_u8(version).expect("0<32"),
program: program,
},
network: Network::Bitcoin,
};
roundtrips(&addr);
} | rust_cleaned_test_functions.jsonl/59120 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 291
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21637,
2702,
18128,
35325,
88519,
9438,
368,
341,
286,
1077,
2319,
284,
220,
16,
18,
280,
286,
442,
220,
19,
15,
53952,
2025,
198,
286,
1077,
2025,
284,
12371,
33673,
310,
330,
21,
20,
19,
69,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_slice_correct() {
let v = vec![183, 65, 14];
let c: Result<Color, String> = Color::try_from(&v[..]);
assert_eq!(
c,
Ok(Color {
red: 183,
green: 65,
blue: 14
})
);
} | rust_cleaned_test_functions.jsonl/11981 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 196
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26488,
31550,
368,
341,
286,
1077,
348,
284,
7486,
20703,
16,
23,
18,
11,
220,
21,
20,
11,
220,
16,
19,
935,
286,
1077,
272,
25,
5714,
88827,
11,
923,
29,
284,
3478,
486,
1539,
5673,
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_tail_num_with_undocumented_sign_bytes() {
const ALPHABET: &str = "abcdefghijklmnopqrstuvwxyz";
new_ucmd!()
.args(&["-c", "5"])
.pipe_in(ALPHABET)
.succeeds()
.stdout_is("vwxyz");
new_ucmd!()
.args(&["-c", "-5"])
.pipe_in(ALPHABET)
.succeeds()
.stdout_is("vwxyz");
new_ucmd!()
.args(&["-c", "+5"])
.pipe_in(ALPHABET)
.succeeds()
.stdout_is("efghijklmnopqrstuvwxyz");
} | rust_cleaned_test_functions.jsonl/39309 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 318
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35471,
4273,
6615,
62,
1241,
36684,
11172,
12524,
368,
341,
9401,
262,
733,
8753,
10842,
1867,
1348,
25,
609,
495,
284,
330,
67512,
876,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_basic_assign() {
let mut assigned_addresses = HashMap::new();
let res: Ipv4Addr = assign_client_address(
&mut assigned_addresses,
get_random_id(),
"192.168.1.0".parse().unwrap(),
24,
)
.expect("Failed to assign ip");
assert_eq!("192.168.1.0".parse::<Ipv4Addr>().unwrap(), res);
let res: Ipv4Addr = assign_client_address(
&mut assigned_addresses,
get_random_id(),
"192.168.1.0".parse().unwrap(),
24,
)
.expect("Failed to assign ip");
assert_eq!("192.168.1.1".parse::<Ipv4Addr>().unwrap(), res);
let res: Ipv4Addr = assign_client_address(
&mut assigned_addresses,
get_random_id(),
"192.168.1.0".parse().unwrap(),
24,
)
.expect("Failed to assign ip");
assert_eq!("192.168.1.2".parse::<Ipv4Addr>().unwrap(), res);
} | rust_cleaned_test_functions.jsonl/87694 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 540
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
20688,
368,
341,
286,
1077,
5206,
12607,
59471,
284,
10528,
486,
931,
543,
286,
1077,
592,
25,
358,
30168,
19,
13986,
284,
9793,
8179,
6744,
1006,
310,
609,
6984,
12607,
59471,
345,
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_vec() {
with_graph(|graph| {
graph
.mutate("CREATE (n1 { prop: 1 }), (n2 { prop: 2 }), (n3 { prop: 3 })")
.unwrap();
let vec: Vec<i64> = graph
.query("MATCH (n) RETURN n.prop ORDER BY n.prop")
.unwrap();
assert_eq!(vec[0], 1);
assert_eq!(vec[1], 2);
assert_eq!(vec[2], 3);
});
} | rust_cleaned_test_functions.jsonl/94391 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 228
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
368,
341,
262,
448,
14738,
22428,
4439,
91,
341,
286,
4771,
198,
310,
659,
6984,
349,
445,
22599,
320,
77,
16,
314,
2004,
25,
220,
16,
31706,
320,
77,
17,
314,
2004,
25,
220,
17,
3170... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_discovery_scan_result_wrong_txn_id() {
let mut sched = create_sched();
let (_inspector, sme_inspect) = sme_inspect();
let mlme_req = sched
.enqueue_scan_to_discover(passive_discovery_scan(10))
.expect("expected a ScanRequest");
let txn_id = mlme_req.txn_id;
// Report scan result with wrong txn id
assert_variant!(
sched.on_mlme_scan_result(
fidl_mlme::ScanResult {
txn_id: txn_id + 1,
timestamp_nanos: zx::Time::get_monotonic().into_nanos(),
bss: fidl_internal::BssDescription {
bssid: [1; 6],
..fake_fidl_bss_description!(Open, ssid: Ssid::try_from("foo").unwrap())
},
},
&sme_inspect,
),
Err(Error::ScanResultWrongTxnId)
);
} | rust_cleaned_test_functions.jsonl/8144 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 558
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9932,
7449,
28857,
5287,
75198,
92299,
842,
368,
341,
286,
1077,
5206,
5575,
284,
1855,
67394,
543,
286,
1077,
5453,
1330,
18997,
11,
90467,
34386,
987,
8,
284,
90467,
34386,
987,
1428,
1789,
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_number_type_num_chunks() {
assert_eq!(NumberType::from("123").unwrap().num_chunks(), 123);
assert_eq!(NumberType::from("l/123").unwrap().num_chunks(), 123);
assert_eq!(NumberType::from("l/123/456").unwrap().num_chunks(), 456);
assert_eq!(NumberType::from("r/123").unwrap().num_chunks(), 123);
assert_eq!(NumberType::from("r/123/456").unwrap().num_chunks(), 456);
} | rust_cleaned_test_functions.jsonl/16014 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 193
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5500,
1819,
4273,
65470,
368,
341,
286,
2060,
10714,
10297,
2833,
929,
486,
1499,
445,
16,
17,
18,
1827,
15454,
1005,
2413,
65470,
1507,
220,
16,
17,
18,
317,
286,
2060,
10714,
10297,
2833,
929,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_deserialize() {
let notification_str = include_str!("../tests/data/notification.json");
let notification: Result<Notification, _> = serde_json::from_str(notification_str);
assert!(notification.is_ok());
let notification = notification.unwrap();
assert_eq!(notification.operation, Operation::Update);
} | rust_cleaned_test_functions.jsonl/71646 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15768,
9050,
368,
341,
286,
1077,
11540,
2895,
284,
2924,
2895,
17223,
1244,
23841,
13167,
96542,
4323,
797,
286,
1077,
11540,
25,
5714,
27,
11196,
11,
716,
29,
284,
61570,
9455,
486,
1499,
2895,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fn_signature_for_impl() {
let info = call_info(
r#"struct F; impl F { pub fn new() { F{}} }
fn bar() {let _ : F = F::new(<|>);}"#,
);
assert!(info.parameters().is_empty());
assert_eq!(info.active_parameter, None);
} | rust_cleaned_test_functions.jsonl/55351 | {
"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,
15246,
39859,
5478,
21007,
368,
341,
286,
1077,
3546,
284,
1618,
3109,
1006,
310,
435,
55543,
1235,
434,
26,
11605,
434,
314,
6675,
5168,
501,
368,
314,
434,
90,
3417,
456,
8822,
3619,
368,
314,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_delta_bit_packed_int32_multiple_blocks() {
// Test multiple 'put' calls on the same encoder
let data = vec![
Int32Type::gen_vec(-1, 64),
Int32Type::gen_vec(-1, 128),
Int32Type::gen_vec(-1, 64),
];
test_delta_bit_packed_decode::<Int32Type>(data);
} | rust_cleaned_test_functions.jsonl/38523 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 176
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26710,
13996,
620,
11191,
4042,
18,
17,
45233,
25201,
368,
341,
286,
442,
3393,
5248,
364,
628,
6,
6738,
389,
279,
1852,
23668,
198,
286,
1077,
821,
284,
7486,
90515,
310,
1333,
18,
17,
929,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_ip_addr_subnet_link_local() {
// Test that `add_ip_addr_subnet` allows link-local addresses.
let config = Ipv6::DUMMY_CONFIG;
let mut ctx = DummyEventDispatcherBuilder::default().build::<DummyEventDispatcher>();
let device =
ctx.state_mut().add_ethernet_device(config.local_mac, Ipv6::MINIMUM_LINK_MTU.into());
assert_eq!(device.id, 0);
let device = EthernetDeviceId(0);
initialize_device(&mut ctx, device);
// Verify that there is a single assigned address.
assert_eq!(ctx.state().device.ethernet.get(0).unwrap().device.ip.ipv6_addr_sub.len(), 1);
add_ip_addr_subnet(
&mut ctx,
device,
AddrSubnet::new(Ipv6::LINK_LOCAL_UNICAST_SUBNET.network(), 128).unwrap(),
)
.unwrap();
// Assert that the new address got added.
let addr_sub = &ctx.state().device.ethernet.get(0).unwrap().device.ip.ipv6_addr_sub;
assert_eq!(addr_sub.len(), 2);
assert_eq!(addr_sub[1].addr_sub().addr().get(), Ipv6::LINK_LOCAL_UNICAST_SUBNET.network());
} | rust_cleaned_test_functions.jsonl/114205 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 558
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
10385,
7387,
95681,
7233,
13564,
368,
341,
1789,
286,
442,
3393,
429,
1565,
718,
10385,
7387,
95681,
63,
6147,
2656,
40060,
14230,
624,
23459,
286,
1077,
2193,
284,
358,
30168,
21,
486,
35,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lef1() -> LayoutResult<()> {
use crate::utils::{Ptr, PtrList};
let layers = crate::tests::layers()?;
let a = Abstract {
name: "to_lef1".into(),
outline: Element {
net: None,
layer: layers.keyname("boundary").unwrap(),
purpose: LayerPurpose::Outline,
inner: Shape::Rect {
p0: Point::new(0, 0),
p1: Point::new(11, 11),
},
},
ports: vec![AbstractPort {
net: "port1".into(),
shapes: vec![(
layers.keyname("met1").unwrap(),
vec![Shape::Rect {
p0: Point::new(1, 1),
p1: Point::new(2, 2),
}],
)]
.into_iter()
.collect(),
}],
blockages: vec![(
layers.keyname("met1").unwrap(),
vec![Shape::Rect {
p0: Point::new(0, 0),
p1: Point::new(10, 10),
}],
)]
.into_iter()
.collect(),
};
let cells = PtrList::from_owned(vec![a.into()]);
let lib = Library {
name: "to_lef_lib1".into(),
layers: Ptr::new(layers),
cells,
..Default::default()
};
let leflib = LefExporter::export(&lib)?;
assert_eq!(leflib.macros.len(), 1);
let lefmac = &leflib.macros[0];
assert_eq!(lefmac.name, "to_lef1");
assert_eq!(lefmac.pins.len(), 1);
let lefpin = &lefmac.pins[0];
assert_eq!(lefpin.name, "port1");
assert_eq!(lefpin.ports.len(), 1);
let lefport = &lefpin.ports[0];
assert_eq!(lefport.layers.len(), 1);
Ok(())
} | rust_cleaned_test_functions.jsonl/53494 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1204
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11751,
69,
16,
368,
1464,
13821,
2077,
71698,
341,
286,
990,
17717,
486,
6031,
22964,
5348,
11,
46409,
852,
2440,
286,
1077,
13617,
284,
17717,
486,
23841,
486,
44198,
94136,
286,
1077,
264,
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_create_from_account_is_nonce_fail() {
let nonce = solana_sdk::pubkey::new_rand();
let nonce_account = AccountSharedData::new_ref_data(
42,
&nonce::state::Versions::new_current(nonce::State::Initialized(
nonce::state::Data::default(),
)),
&system_program::id(),
)
.unwrap();
let from = KeyedAccount::new(&nonce, true, &nonce_account);
let new = solana_sdk::pubkey::new_rand();
let new_account = AccountSharedData::new_ref(0, 0, &system_program::id());
let signers = [nonce, new].iter().cloned().collect::<HashSet<_>>();
let new_address = new.into();
let new_keyed_account = KeyedAccount::new(&new, false, &new_account);
assert_eq!(
create_account(
&from,
&new_keyed_account,
&new_address,
42,
0,
&solana_sdk::pubkey::new_rand(),
&signers,
&MockInvokeContext::new(vec![]),
),
Err(InstructionError::InvalidArgument),
);
} | rust_cleaned_test_functions.jsonl/73047 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 624
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
5673,
13500,
6892,
48508,
22121,
368,
341,
286,
1077,
39676,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
39676,
13500,
284,
8615,
16997,
1043,
486,
931,
7793,
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_snapped() {
let s = Spring::new(1.0, 400.0, 10.0);
assert_eq!(s.x(0.0), 0.0);
assert_eq!(s.dx(0.0), 0.0);
assert!(s.is_done(0.0));
} | rust_cleaned_test_functions.jsonl/10066 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28022,
5677,
368,
341,
262,
1077,
274,
284,
12252,
486,
931,
7,
16,
13,
15,
11,
220,
19,
15,
15,
13,
15,
11,
220,
16,
15,
13,
15,
317,
262,
2060,
10714,
10297,
82,
1993,
7,
15,
13,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_children_on_mixed_tables() {
let _ = env_logger::init();
let parser = TOMLParser::new();
let (parser, _) = parser.parse(TT::get());
// test getting bare key
assert_eq!(&Children::Count(Cell::new(0)), parser.get_children("fish").unwrap());
// test table key lookup
assert_eq!(&Children::Count(Cell::new(0)), parser.get_children("foo.\"δïáϱñôƨïƨ\"").unwrap());
// test array table key lookup
assert_eq!(&Children::Count(Cell::new(3)), parser.get_children("foo.\"bar\"").unwrap());
assert_eq!(&Children::Keys(RefCell::new(vec!["baz".to_string(), "qux".to_string()])), parser.get_children("foo.\"bar\"[0]").unwrap());
assert_eq!(&Children::Keys(RefCell::new(vec!["baz".to_string(), "qux".to_string()])), parser.get_children("foo.\"bar\"[1]").unwrap());
assert_eq!(&Children::Count(Cell::new(2)), parser.get_children("foo.quality").unwrap());
assert_eq!(&Children::Keys(RefCell::new(vec!["furniture".to_string(), "machine".to_string(), "labor".to_string()])), parser.get_children("foo.quality[0]").unwrap());
assert_eq!(&Children::Keys(RefCell::new(vec!["\"ƥèřïôδ\"".to_string(), "\"inline table\"".to_string()])), parser.get_children("foo.quality[0].machine.parts.service").unwrap());
assert_eq!(&Children::Keys(RefCell::new(vec!["drink".to_string(), "meal".to_string(), "dessert".to_string()])), parser.get_children("foo.quality[0].machine.parts.service.\"inline table\"").unwrap());
assert_eq!(&Children::Count(Cell::new(2)), parser.get_children("foo.quality[0].machine.parts.service.\"inline table\".meal").unwrap());
assert_eq!(&Children::Keys(RefCell::new(vec!["start".to_string(), "end".to_string()])), parser.get_children("foo.quality[0].machine.parts.service.\"inline table\".meal[1]").unwrap());
assert_eq!(&Children::Count(Cell::new(2)), parser.get_children("foo.quality[0].labor").unwrap());
assert_eq!(&Children::Keys(RefCell::new(vec!["Name".to_string()])), parser.get_children("foo.quality[0].labor[0]").unwrap());
assert_eq!(&Children::Keys(RefCell::new(vec!["Name".to_string()])), parser.get_children("foo.quality[0].labor[1]").unwrap());
assert_eq!(&Children::Keys(RefCell::new(vec!["money".to_string()])), parser.get_children("foo.quality[1]").unwrap());
assert_eq!(&Children::Keys(RefCell::new(vec!["baz".to_string(), "qux".to_string(), "array".to_string()])), parser.get_children("foo.\"bar\"[2]").unwrap());
assert_eq!(&Children::Count(Cell::new(4)), parser.get_children("foo.\"bar\"[2].array").unwrap());
assert_eq!(&Children::Keys(RefCell::new(vec!["one".to_string()])), parser.get_children("foo.\"bar\"[2].array[0]").unwrap());
assert_eq!(&Children::Keys(RefCell::new(vec!["two".to_string()])), parser.get_children("foo.\"bar\"[2].array[1]").unwrap());
assert_eq!(&Children::Keys(RefCell::new(vec!["you".to_string(), "fire".to_string()])), parser.get_children("foo.\"bar\"[2].array[2]").unwrap());
assert_eq!(&Children::Count(Cell::new(2)), parser.get_children("foo.\"bar\"[2].array[2].you").unwrap());
assert_eq!(&Children::Keys(RefCell::new(vec!["three".to_string()])), parser.get_children("foo.\"bar\"[2].array[3]").unwrap());
assert_eq!(&Children::Keys(RefCell::new(vec!["\"bar\"".to_string(), "quality".to_string(), "\"δïáϱñôƨïƨ\"".to_string(), "\"ƥřôϱñôƨïƨ\"".to_string(), "hypnosis".to_string()])), parser.get_children("foo").unwrap());
} | rust_cleaned_test_functions.jsonl/122802 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
31206,
4470,
717,
3286,
35632,
368,
341,
220,
1077,
716,
284,
6105,
27413,
486,
2327,
1428,
220,
1077,
6729,
284,
82465,
43,
6570,
486,
931,
543,
220,
1077,
320,
9657,
11,
27439,
284,
6729... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_json_infer_schema_struct_in_list() {
let schema = Schema::new(vec![
Field::new(
"c1",
DataType::List(Box::new(Field::new(
"item",
DataType::Struct(vec![
Field::new("a", DataType::Utf8, true),
Field::new("b", DataType::Int64, true),
Field::new("c", DataType::Boolean, true),
]),
true,
))),
true,
),
Field::new("c2", DataType::Float64, true),
Field::new(
"c3",
// empty json array's inner types are inferred as null
DataType::List(Box::new(Field::new("item", DataType::Null, true))),
true,
),
]);
let inferred_schema = infer_json_schema_from_iterator(
vec![
Ok(serde_json::json!({
"c1": [{"a": "foo", "b": 100}], "c2": 1, "c3": [],
})),
Ok(serde_json::json!({
"c1": [{"a": "bar", "b": 2}, {"a": "foo", "c": true}], "c2": 0, "c3": [],
})),
Ok(serde_json::json!({"c1": [], "c2": 0.5, "c3": []})),
]
.into_iter(),
)
.unwrap();
assert_eq!(inferred_schema, schema);
} | rust_cleaned_test_functions.jsonl/22612 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 903
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9455,
1243,
802,
25371,
15126,
1243,
2019,
368,
341,
286,
1077,
10802,
284,
12539,
486,
931,
25592,
90515,
310,
8601,
486,
931,
1006,
394,
330,
66,
16,
756,
394,
33172,
486,
852,
67758,
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_parser_renderer_model_with_comments_via_dml() {
let dml = datamodel::parse_datamodel(DATAMODEL_STRING_WITH_COMMENTS).unwrap();
let rendered = datamodel::render_datamodel_to_string(&dml).unwrap();
print!("{}", rendered);
assert_eq!(rendered, DATAMODEL_STRING_WITH_COMMENTS);
} | rust_cleaned_test_functions.jsonl/32022 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18517,
52345,
5047,
6615,
30359,
80710,
814,
1014,
368,
341,
262,
1077,
294,
1014,
284,
3258,
40259,
486,
6400,
15353,
40259,
5432,
828,
1402,
2880,
43,
12283,
23929,
6877,
28763,
568,
15454,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tokenize_delimiters() {
let input = "(){}[],;:";
let mut tokens = Lexer::new(input);
let expected = vec![
Token::LParen,
Token::RParen,
Token::LBrace,
Token::RBrace,
Token::LBracket,
Token::RBracket,
Token::Comma,
Token::Semicolon,
Token::Colon,
Token::EOF,
];
for token_expected in expected.iter() {
let token = tokens.next_token();
assert_eq!(&token, token_expected);
}
} | rust_cleaned_test_functions.jsonl/80423 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 335
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
86508,
18029,
67645,
368,
341,
286,
1077,
1946,
284,
67411,
6257,
12995,
26,
28669,
286,
1077,
5206,
11211,
284,
85082,
486,
931,
5384,
626,
286,
1077,
3601,
284,
7486,
90515,
310,
9660,
486,
1256... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_is() {
let doc = doc();
let sel = doc.select(".footer p:nth-child(1)");
print!("{}", sel.length());
assert!(sel.is("p"), "Expected .footer p:nth-child(1) to be a p.");
} | rust_cleaned_test_functions.jsonl/116369 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
368,
341,
262,
1077,
4629,
284,
4629,
543,
262,
1077,
11806,
284,
4629,
9712,
5680,
6956,
281,
37964,
23484,
7,
16,
20996,
262,
1173,
79878,
11806,
1954,
1423,
262,
2060,
10297,
9507,
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 |
#[test]
fn test_column_chunk_metadata_thrift_conversion() {
let column_descr = get_test_schema_descr().column(0);
let col_metadata = ColumnChunkMetaData::builder(column_descr.clone())
.set_encodings(vec![Encoding::PLAIN, Encoding::RLE])
.set_file_path("file_path".to_owned())
.set_file_offset(100)
.set_num_values(1000)
.set_compression(Compression::SNAPPY)
.set_total_compressed_size(2000)
.set_total_uncompressed_size(3000)
.set_data_page_offset(4000)
.set_dictionary_page_offset(Some(5000))
.build()
.unwrap();
let col_chunk_exp = col_metadata.to_thrift();
let col_chunk_res =
ColumnChunkMetaData::from_thrift(column_descr.clone(), col_chunk_exp.clone())
.unwrap()
.to_thrift();
assert_eq!(col_chunk_res, col_chunk_exp);
} | rust_cleaned_test_functions.jsonl/106313 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 495
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8744,
30539,
22220,
5854,
41380,
64132,
368,
341,
286,
1077,
3250,
64622,
284,
633,
4452,
25371,
64622,
1005,
6229,
7,
15,
626,
286,
1077,
1375,
22220,
284,
9332,
28304,
37307,
486,
17850,
17277,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.