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_contig_window_prioritized() {
let mut buffer = buffer();
assert!(buffer.enqueue(4, ()).is_ok());
assert!(buffer.dequeue().is_ok());
assert!(buffer.enqueue(5, ()).is_ok());
} | rust_cleaned_test_functions.jsonl/101983 | {
"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,
10260,
343,
12571,
58782,
83443,
368,
341,
286,
1077,
5206,
4147,
284,
4147,
543,
286,
2060,
10297,
7573,
47468,
7,
19,
11,
1719,
568,
285,
19817,
1423,
286,
2060,
10297,
7573,
93789,
1005,
285,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_eval_function() -> Result<(), Box<EvalAltResult>> {
let engine = Engine::new();
let mut scope = Scope::new();
assert_eq!(
engine.eval_with_scope::<INT>(
&mut scope,
r#"
let x = 10;
fn foo(x) { x += 12; x }
let script = "let y = x;"; // build a script
script += "y += foo(y);";
script += "x + y";
eval(script) + x + y
"#
)?,
84
);
assert_eq!(
scope
.get_value::<INT>("x")
.expect("variable x should exist"),
10
);
assert_eq!(
scope
.get_value::<INT>("y")
.expect("variable y should exist"),
32
);
assert!(scope.contains("script"));
assert_eq!(scope.len(), 3);
Ok(())
} | rust_cleaned_test_functions.jsonl/114782 | {
"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,
21296,
9174,
368,
1464,
5714,
68843,
8261,
23835,
831,
26017,
2077,
2452,
341,
262,
1077,
4712,
284,
8200,
486,
931,
543,
262,
1077,
5206,
6891,
284,
34920,
486,
931,
1428,
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... | 2 |
#[test]
fn test_into_char_array() {
let values = vec!["eenie", "meenie", "minie", "moe"];
let c_array = CStringVec::new(&values).expect("success");
assert_eq!(c_array.len(), 4);
} | rust_cleaned_test_functions.jsonl/61938 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45514,
9232,
3858,
368,
341,
286,
1077,
2750,
284,
7486,
0,
1183,
14911,
645,
497,
330,
2660,
61558,
497,
330,
1065,
645,
497,
330,
76,
4644,
6332,
286,
1077,
272,
3858,
284,
56956,
10050,
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 |
#[test]
fn test_filetransfer_params() {
let params: FileTransferParams =
FileTransferParams::new(FileTransferProtocol::Scp, ProtocolParams::default())
.entry_directory(Some(&Path::new("/tmp")));
assert_eq!(
params.params.generic_params().unwrap().address.as_str(),
"localhost"
);
assert_eq!(params.protocol, FileTransferProtocol::Scp);
assert_eq!(
params.entry_directory.as_deref().unwrap(),
Path::new("/tmp")
);
} | rust_cleaned_test_functions.jsonl/89006 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 265
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2458,
24188,
6745,
368,
341,
286,
1077,
3628,
25,
2887,
21970,
4870,
4035,
310,
2887,
21970,
4870,
486,
931,
19821,
21970,
20689,
486,
3326,
79,
11,
24572,
4870,
486,
2258,
2398,
394,
659,
4085,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_event_listener_basic() {
let path = TempDir::new("_rust_rocksdb_event_listener_flush").expect("");
let path_str = path.path().to_str().unwrap();
let mut opts = DBOptions::new();
let counter = EventCounter::default();
opts.add_event_listener(counter.clone());
opts.create_if_missing(true);
let db = DB::open(opts, path_str).unwrap();
for i in 1..8000 {
db.put(
format!("{:04}", i).as_bytes(),
format!("{:04}", i).as_bytes(),
)
.unwrap();
}
db.flush(true).unwrap();
assert_ne!(counter.flush.load(Ordering::SeqCst), 0);
for i in 1..8000 {
db.put(
format!("{:04}", i).as_bytes(),
format!("{:04}", i).as_bytes(),
)
.unwrap();
}
db.flush(true).unwrap();
let flush_cnt = counter.flush.load(Ordering::SeqCst);
assert_ne!(flush_cnt, 0);
assert_eq!(counter.compaction.load(Ordering::SeqCst), 0);
db.compact_range(None, None);
assert_eq!(counter.flush.load(Ordering::SeqCst), flush_cnt);
assert_ne!(counter.compaction.load(Ordering::SeqCst), 0);
drop(db);
assert_eq!(counter.drop_count.load(Ordering::SeqCst), 1);
assert!(
counter.input_records.load(Ordering::SeqCst)
> counter.output_records.load(Ordering::SeqCst)
);
assert!(
counter.input_bytes.load(Ordering::SeqCst) > counter.output_bytes.load(Ordering::SeqCst)
);
assert_eq!(counter.manual_compaction.load(Ordering::SeqCst), 1);
} | rust_cleaned_test_functions.jsonl/86608 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 727
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6748,
46493,
34729,
368,
341,
262,
1077,
1815,
284,
19944,
6184,
486,
931,
16975,
35788,
26608,
14553,
1999,
6748,
46493,
39213,
1827,
17119,
13056,
262,
1077,
1815,
2895,
284,
1815,
3875,
1005,
983... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_transparent_tuple_struct() {
Python::with_gil(|py| {
let tup: PyObject = 1.into_py(py);
let tup = TransparentTuple::extract(tup.as_ref(py));
assert!(tup.is_err());
let test = "test".into_py(py);
let tup = TransparentTuple::extract(test.as_ref(py))
.expect("Failed to extract TransparentTuple from PyTuple");
assert_eq!(tup.0, "test");
});
} | rust_cleaned_test_functions.jsonl/59471 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 212
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7965,
3765,
21773,
15126,
368,
341,
262,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
341,
286,
1077,
57385,
25,
15891,
284,
220,
16,
39860,
40291,
46827,
317,
286,
1077,
57385,
284,
89868,
28681... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_date_time_local() -> Result<()> {
let mut db = checked_memory_handle()?;
let date = NaiveDate::from_ymd(2016, 2, 23);
let time = NaiveTime::from_hms_milli(23, 56, 4, 789);
let dt = NaiveDateTime::new(date, time);
let local = Local.from_local_datetime(&dt).single().unwrap();
db.execute("INSERT INTO foo (b) VALUES (?)", [local])?;
let s: String = db.query_row("SELECT b FROM foo", [], |r| r.get(0))?;
assert_eq!(DateTime::<Utc>::from(local).format("%F %T%.f").to_string(), s);
let v: DateTime<Local> = db.query_row("SELECT b FROM foo", [], |r| r.get(0))?;
assert_eq!(local, v);
Ok(())
} | rust_cleaned_test_functions.jsonl/76839 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 334
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4164,
3009,
13564,
368,
1464,
5714,
71698,
341,
286,
1077,
5206,
2927,
284,
10067,
19195,
10630,
94136,
286,
1077,
2400,
284,
12812,
533,
1916,
486,
1499,
62,
1600,
67,
7,
17,
15,
16,
21,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_arno_custom_charset_ranges() {
// These ranges are from the ArnoPro-Regular font and are in the same order they are in the
// font.
#[rustfmt::skip]
let ranges = ReadArrayCow::Owned(vec![
Range { first: 1, n_left: 107, },
Range { first: 111, n_left: 38, },
Range { first: 151, n_left: 12, },
Range { first: 165, n_left: 3, },
Range { first: 170, n_left: 58, },
Range { first: 237, n_left: 1, },
Range { first: 391, n_left: 0, },
Range { first: 393, n_left: 0, },
Range { first: 300, n_left: 0, },
Range { first: 392, n_left: 0, },
Range { first: 314, n_left: 0, },
Range { first: 324, n_left: 1, },
Range { first: 320, n_left: 3, },
Range { first: 394, n_left: 2577, },
Range { first: 109, n_left: 1, },
Range { first: 2972, n_left: 28, },
Range { first: 2846, n_left: 768, },
]);
let charset = CustomCharset::Format2 { ranges };
// glpyh id 0 is .notdef and is implicitly encoded
assert_eq!(charset.id_for_glyph(134), Some(136));
assert_eq!(charset.id_for_glyph(265), Some(422));
assert_eq!(charset.id_for_glyph(279), Some(436));
} | rust_cleaned_test_functions.jsonl/85349 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 685
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
1885,
78,
15875,
65883,
58748,
368,
341,
286,
442,
4220,
21283,
525,
504,
279,
1644,
2152,
1336,
87591,
3301,
323,
525,
304,
279,
1852,
1973,
807,
525,
304,
279,
198,
286,
442,
3301,
624,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_tx_version_0() {
let (wallet, _, _) = get_funded_wallet(get_test_wpkh());
let addr = wallet.get_new_address().unwrap();
wallet
.create_tx(TxBuilder::with_recipients(vec![(addr.script_pubkey(), 25_000)]).version(0))
.unwrap();
} | rust_cleaned_test_functions.jsonl/11309 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 151
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
17805,
9438,
62,
15,
368,
341,
286,
1077,
320,
35735,
11,
8358,
27439,
284,
633,
761,
36053,
62308,
5433,
4452,
1670,
20819,
71,
1423,
286,
1077,
10789,
284,
15085,
670,
5921,
6744,
1005,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_exclude_link_local() {
let filter = Filter {
exclude_link_local_ips: true,
..Filter::default()
};
assert!(filter.is_excluded(&website(V4_LINK_LOCAL_1)));
assert!(filter.is_excluded(&website(V4_LINK_LOCAL_2)));
} | rust_cleaned_test_functions.jsonl/65571 | {
"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,
88668,
7233,
13564,
368,
341,
286,
1077,
4051,
284,
12339,
341,
310,
21687,
7233,
13564,
71074,
25,
830,
345,
310,
5241,
5632,
486,
2258,
741,
286,
3634,
286,
2060,
10297,
5315,
2079,
2702,
10181,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_client_iface_recovery_fails() {
let mut exec = fuchsia_async::Executor::new().expect("failed to create an executor");
// Create an IfaceManager with a client and an AP.
let mut test_values = test_setup(&mut exec);
let (mut iface_manager, _next_sme_req) =
create_iface_manager_with_client(&test_values, true);
let removed_iface_id = 123;
iface_manager.clients[0].iface_id = removed_iface_id;
let ap_iface = ApIfaceContainer {
iface_id: TEST_AP_IFACE_ID,
config: None,
ap_state_machine: Box::new(FakeAp {
start_succeeds: true,
stop_succeeds: true,
exit_succeeds: true,
}),
enabled_time: None,
};
iface_manager.aps.push(ap_iface);
// Notify the IfaceManager that the client interface has been removed.
{
let fut = iface_manager.handle_removed_iface(removed_iface_id);
pin_mut!(fut);
// Expect a DeviceService request an SME proxy.
assert_variant!(exec.run_until_stalled(&mut fut), Poll::Pending);
assert_variant!(
exec.run_until_stalled(&mut test_values.device_service_stream.next()),
Poll::Ready(Some(Ok(fidl_fuchsia_wlan_device_service::DeviceServiceRequest::GetClientSme {
iface_id: TEST_CLIENT_IFACE_ID, sme: _, responder
}))) => {
responder
.send(fuchsia_zircon::sys::ZX_ERR_NOT_FOUND)
.expect("failed to send AP SME response.");
}
);
assert_variant!(exec.run_until_stalled(&mut fut), Poll::Ready(()));
}
assert!(!iface_manager.aps.is_empty());
// Verify that a new client interface was created.
assert!(iface_manager.clients.is_empty());
} | rust_cleaned_test_functions.jsonl/71949 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 992
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8179,
67666,
91475,
761,
6209,
368,
341,
286,
1077,
5206,
3883,
284,
282,
73391,
28346,
486,
25255,
486,
931,
1005,
17119,
445,
16091,
311,
1855,
458,
31558,
3071,
286,
442,
4230,
458,
1416,
578,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_empty_can_finalize() {
let default = StrategyPeriodic::default();
let mut runtime = rt::Runtime::new().unwrap();
let steady = runtime.block_on(default.can_finalize()).unwrap();
assert_eq!(steady, false);
} | rust_cleaned_test_functions.jsonl/37967 | {
"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,
15124,
27421,
70616,
368,
341,
286,
1077,
1638,
284,
27745,
23750,
292,
486,
2258,
543,
286,
1077,
5206,
15592,
284,
16677,
486,
15123,
486,
931,
1005,
15454,
543,
286,
1077,
24020,
284,
15592,
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 |
#[test]
fn test_respond_to_test_request_immediately_after_logon() {
//Special processing is required to adjust which messages are acceptable after Logon is
//received. But the IO processing is level based so the event loop might not be notified of
//TestRequest that would cause the remaining data to be read.
define_dictionary!(Logon, Heartbeat, TestRequest,);
//Connect to server.
let (mut test_server, mut client, connection) =
TestStream::setup_test_server(build_dictionary());
//Have client send Logon.
client.send_message_box(connection, Box::new(new_logon_message()));
let message = test_server.recv_message::<Logon>();
assert_eq!(message.msg_seq_num, 1);
let mut logon_message = new_fixt_message!(Logon);
logon_message.msg_seq_num = 1;
logon_message.encrypt_method = message.encrypt_method;
logon_message.heart_bt_int = message.heart_bt_int;
logon_message.default_appl_ver_id = message.default_appl_ver_id;
let mut test_request_message = new_fixt_message!(TestRequest);
test_request_message.msg_seq_num = 2;
test_request_message.test_req_id = b"test".to_vec();
let mut bytes = Vec::new();
serialize_and_append_message(
&logon_message,
FIXVersion::FIXT_1_1,
MessageVersion::FIX50SP2,
&mut bytes,
);
serialize_and_append_message(
&test_request_message,
FIXVersion::FIXT_1_1,
MessageVersion::FIX50SP2,
&mut bytes,
);
assert!(bytes.len() < 1400); //Make sure the serialized body is reasonably likely to fit within the MTU.
let bytes_written = test_server.stream.write(&bytes).unwrap();
assert_eq!(bytes_written, bytes.len());
//Make sure client acknowledges both as normal.
engine_poll_event!(client,EngineEvent::SessionEstablished(_) => {});
let message = engine_poll_message!(client, connection, Logon);
assert_eq!(message.msg_seq_num, 1);
let message = engine_poll_message!(client, connection, TestRequest);
assert_eq!(message.msg_seq_num, 2);
let message = test_server.recv_message::<Heartbeat>();
assert_eq!(message.msg_seq_num, 2);
} | rust_cleaned_test_functions.jsonl/31 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 825
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4918,
3511,
2346,
4452,
7893,
17895,
43187,
19844,
5224,
263,
368,
341,
262,
442,
20366,
8692,
374,
2567,
311,
7500,
892,
6605,
525,
21555,
1283,
2835,
263,
374,
198,
262,
442,
41823,
13,
1988,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_system_account_kind_nonce_ok() {
let nonce_account = AccountSharedData::new_data(
42,
&nonce::state::Versions::new_current(nonce::State::Initialized(
nonce::state::Data::default(),
)),
&system_program::id(),
)
.unwrap();
assert_eq!(
get_system_account_kind(&nonce_account),
Some(SystemAccountKind::Nonce)
);
} | rust_cleaned_test_functions.jsonl/73078 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 248
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
17687,
13500,
33162,
48508,
19817,
368,
341,
286,
1077,
39676,
13500,
284,
8615,
16997,
1043,
486,
931,
1769,
1006,
310,
220,
19,
17,
345,
310,
609,
39593,
486,
2454,
486,
69015,
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_integration_3() {
use tidb_query_expr::impl_arithmetic::{arithmetic_fn_meta, IntIntPlus};
use tidb_query_expr::impl_op::is_null_fn_meta;
// | col0 | col1 | col2 |
// | -10 | NULL | -5 |
// | -1 | NULL | NULL |
// | NULL | 1 | 4 |
let src_exec = make_src_executor();
let mut exec = BatchTopNExecutor::new_for_test(
src_exec,
vec![
RpnExpressionBuilder::new_for_test()
.push_column_ref_for_test(0)
.push_fn_call_for_test(is_null_fn_meta::<Int>(), 1, FieldTypeTp::LongLong)
.build_for_test(),
RpnExpressionBuilder::new_for_test()
.push_column_ref_for_test(0)
.build_for_test(),
RpnExpressionBuilder::new_for_test()
.push_column_ref_for_test(1)
.push_constant_for_test(1)
.push_fn_call_for_test(
arithmetic_fn_meta::<IntIntPlus>(),
2,
FieldTypeTp::LongLong,
)
.build_for_test(),
],
vec![false, false, true],
5,
);
let r = exec.next_batch(1);
assert!(r.logical_rows.is_empty());
assert_eq!(r.physical_columns.rows_len(), 0);
assert!(!r.is_drained.unwrap());
let r = exec.next_batch(1);
assert!(r.logical_rows.is_empty());
assert_eq!(r.physical_columns.rows_len(), 0);
assert!(!r.is_drained.unwrap());
let r = exec.next_batch(1);
assert_eq!(&r.logical_rows, &[0, 1, 2, 3, 4]);
assert_eq!(r.physical_columns.rows_len(), 5);
assert_eq!(r.physical_columns.columns_len(), 3);
assert_eq!(
r.physical_columns[0].decoded().to_int_vec(),
&[Some(-10), Some(-10), Some(-10), Some(-1), None]
);
assert_eq!(
r.physical_columns[1].decoded().to_int_vec(),
&[Some(10), Some(-10), None, None, Some(1)]
);
assert_eq!(
r.physical_columns[2].decoded().to_real_vec(),
&[
Real::new(3.0).ok(),
Real::new(0.0).ok(),
Real::new(-5.0).ok(),
None,
Real::new(4.0).ok()
]
);
assert!(r.is_drained.unwrap());
} | rust_cleaned_test_functions.jsonl/34171 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1537
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
90250,
62,
18,
368,
341,
286,
990,
13112,
65,
5738,
21915,
486,
6383,
25842,
25922,
22964,
277,
25922,
15246,
13381,
11,
1333,
1072,
21807,
2440,
286,
990,
13112,
65,
5738,
21915,
486,
6383,
10287... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_der_seq_of() {
let empty = &b""[..];
let bytes = [
0x30, 0x0a, 0x02, 0x03, 0x01, 0x00, 0x01, 0x02, 0x03, 0x01, 0x00, 0x00,
];
let expected = DerObject::from_seq(vec![
DerObject::from_int_slice(b"\x01\x00\x01"),
DerObject::from_int_slice(b"\x01\x00\x00"),
]);
fn parser(i: &[u8]) -> DerResult {
parse_der_sequence_of(parse_der_integer)(i)
}
assert_eq!(parser(&bytes), Ok((empty, expected.clone())));
fn parser2(i: &[u8]) -> BerResult {
parse_ber_sequence_of(parse_der_integer)(i)
}
assert_eq!(parser2(&bytes), Ok((empty, expected)));
} | rust_cleaned_test_functions.jsonl/45874 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 331
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35345,
14486,
3575,
368,
341,
262,
1077,
4287,
284,
609,
65,
3014,
95874,
935,
262,
1077,
5820,
284,
2278,
286,
220,
15,
87,
18,
15,
11,
220,
15,
87,
15,
64,
11,
220,
15,
87,
15,
17,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sum_int() {
let mut sum = Sum { res: None };
let mut ctx = EvalContext::default();
let v1 = Datum::I64(i64::MAX);
let v2 = Datum::I64(12);
let res = Decimal::from(i64::MAX).add(&Decimal::from(12)).unwrap();
sum.uFIDelate(&mut ctx, &mut vec![v1]).unwrap();
sum.uFIDelate(&mut ctx, &mut vec![v2]).unwrap();
let v = sum.res.take().unwrap();
assert_eq!(v, Datum::Dec(res));
} | rust_cleaned_test_functions.jsonl/31875 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 240
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10160,
4042,
368,
341,
286,
1077,
5206,
2629,
284,
8116,
314,
592,
25,
2240,
2605,
286,
1077,
5206,
5635,
284,
58239,
1972,
486,
2258,
543,
286,
1077,
348,
16,
284,
68459,
486,
40,
21,
19,
195... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_same_block_multiple_times() {
let parent_block_id = *GENESIS_BLOCK_ID;
let block_id = gen_block_id(1);
let version = 100;
let txns: Vec<_> = (0..version)
.map(|i| wrap_user_txn(encode_mint_transaction(gen_address(i), 100)))
.collect();
{
let executor = TestExecutor::new();
let mut responses = vec![];
for _i in 0..100 {
let execute_block_future = executor.execute_block(
txns.clone(),
executor.committed_trees(),
parent_block_id,
block_id,
);
let (_output, state_compute_result) = block_on(execute_block_future).unwrap().unwrap();
responses.push(state_compute_result);
}
responses.dedup();
assert_eq!(responses.len(), 1);
}
{
let executor = TestExecutor::new();
let mut futures = vec![];
for _i in 0..100 {
let execute_block_future = executor.execute_block(
txns.clone(),
executor.committed_trees(),
parent_block_id,
block_id,
);
futures.push(execute_block_future);
}
let mut responses: Vec<_> = futures
.into_iter()
.map(|fut| block_on(fut).unwrap().unwrap().1)
.collect();
responses.dedup();
assert_eq!(responses.len(), 1);
}
} | rust_cleaned_test_functions.jsonl/73896 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 768
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
81207,
44329,
33574,
7113,
45233,
22353,
368,
341,
262,
1077,
2681,
7113,
842,
284,
353,
11085,
83366,
18756,
3450,
280,
262,
1077,
2504,
842,
284,
4081,
7113,
842,
7,
16,
317,
262,
1077,
2319,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_keep_current_working_dir() {
use os;
let prog = pwd_cmd().spawn().unwrap();
let output = String::from_utf8(prog.wait_with_output().unwrap().stdout).unwrap();
let parent_dir = os::getcwd().unwrap();
let child_dir = old_path::Path::new(output.trim());
let parent_stat = parent_dir.stat().unwrap();
let child_stat = child_dir.stat().unwrap();
assert_eq!(parent_stat.unstable.device, child_stat.unstable.device);
assert_eq!(parent_stat.unstable.inode, child_stat.unstable.inode);
} | rust_cleaned_test_functions.jsonl/5986 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
50293,
11080,
81101,
4334,
368,
341,
286,
990,
2643,
280,
286,
1077,
29271,
284,
32706,
11684,
1005,
46087,
1005,
15454,
1428,
286,
1077,
2550,
284,
923,
486,
1499,
39453,
23,
80078,
16294,
6615,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_move_c_e() {
let mut cpu: CPU = CPU::new();
cpu = cpu.set_c(Register { value: 0 });
cpu = cpu.set_e(Register { value: 10 });
cpu = execute_move(cpu, 0b010, 0b100);
assert_eq!(cpu.pc.value, 0);
assert_eq!(cpu.f.value, 0);
assert_eq!(cpu.c.value, 10);
} | rust_cleaned_test_functions.jsonl/123573 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 175
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17134,
666,
2204,
368,
341,
286,
1077,
5206,
17319,
25,
13940,
284,
13940,
486,
931,
1428,
286,
17319,
284,
17319,
980,
666,
79203,
314,
897,
25,
220,
15,
1625,
286,
17319,
284,
17319,
980,
2204... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_drive_1() {
let input = String::from("[a, b]");
let mut output = String::new();
let expected =
r#"<'[',LBrack>
<'a',Name>
<',',Comma>
<'b',Name>
<']',RBrack>
<'<EOF>',<EOF>>"#;
output = drive(input, output);
assert_eq!(expected, output.as_str());
} | rust_cleaned_test_functions.jsonl/131308 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67151,
62,
16,
368,
341,
262,
1077,
1946,
284,
923,
486,
1499,
10937,
64,
11,
293,
37389,
262,
1077,
5206,
2550,
284,
923,
486,
931,
543,
262,
1077,
3601,
4035,
81,
55543,
18291,
58,
516,
43,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hour_minute_24_clock_under_12() {
let context = build_context(Moment(Paris.ymd(2017, 04, 25).and_hms(9, 10, 11)));
let constraint = HourMinute::clock_24(11, 24);
let walker = constraint.unwrap().to_walker(&context.reference, &context);
assert_eq!(Some(Interval::starting_at(Moment(Paris.ymd(2017, 04, 25).and_hms(11, 24, 0)),
Grain::Minute)),
walker.forward.clone().next());
assert_eq!(Some(Interval::starting_at(Moment(Paris.ymd(2017, 04, 26).and_hms(11, 24, 0)),
Grain::Minute)),
walker.forward.clone().skip(1).next());
assert_eq!(Some(Interval::starting_at(Moment(Paris.ymd(2017, 04, 24).and_hms(11, 24, 0)),
Grain::Minute)),
walker.backward.clone().next());
assert_eq!(Some(Interval::starting_at(Moment(Paris.ymd(2017, 04, 23).and_hms(11, 24, 0)),
Grain::Minute)),
walker.backward.clone().skip(1).next());
} | rust_cleaned_test_functions.jsonl/114666 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 638
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32292,
76944,
62,
17,
19,
23062,
58228,
62,
16,
17,
368,
341,
286,
1077,
2266,
284,
1936,
8467,
3189,
12913,
7,
59604,
13,
1600,
67,
7,
17,
15,
16,
22,
11,
220,
15,
19,
11,
220,
17,
20,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_load_accounts_unknown_program_id() {
let mut accounts: Vec<(Pubkey, Account)> = Vec::new();
let mut error_counters = ErrorCounters::default();
let keypair = Keypair::new();
let key0 = keypair.pubkey();
let key1 = Pubkey::new(&[5u8; 32]);
let account = Account::new(1, 1, &Pubkey::default());
accounts.push((key0, account));
let account = Account::new(2, 1, &Pubkey::default());
accounts.push((key1, account));
let instructions = vec![CompiledInstruction::new(1, &(), vec![0])];
let tx = Transaction::new_with_compiled_instructions(
&[&keypair],
&[],
Hash::default(),
vec![Pubkey::default()],
instructions,
);
let loaded_accounts = load_accounts(tx, &accounts, &mut error_counters);
assert_eq!(error_counters.account_not_found, 1);
assert_eq!(loaded_accounts.len(), 1);
assert_eq!(
loaded_accounts[0],
(
Err(TransactionError::ProgramAccountNotFound),
Some(HashAgeKind::Extant)
)
);
} | rust_cleaned_test_functions.jsonl/50609 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 567
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12411,
55665,
57507,
25096,
842,
368,
341,
286,
1077,
5206,
9618,
25,
11312,
28706,
29162,
792,
11,
8615,
16018,
284,
11312,
486,
931,
543,
286,
1077,
5206,
1465,
85632,
284,
4600,
2507,
388,
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_intopy_roundtrip() {
Python::with_gil(|py| {
fn test_roundtrip<T: IntoPy<PyObject> + AsRef<Path> + Debug + Clone>(
py: Python,
obj: T,
) {
let pyobject = obj.clone().into_py(py);
let pystring: &PyString = pyobject.extract(py).unwrap();
assert_eq!(pystring.to_string_lossy(), obj.as_ref().to_string_lossy());
let roundtripped_obj: PathBuf = pystring.extract().unwrap();
assert_eq!(obj.as_ref(), roundtripped_obj.as_path());
}
let path = Path::new("Hello\0\n🐍");
test_roundtrip::<&Path>(py, path);
test_roundtrip::<PathBuf>(py, path.to_path_buf());
test_roundtrip::<&PathBuf>(py, &path.to_path_buf());
})
} | rust_cleaned_test_functions.jsonl/59948 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 458
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4042,
1266,
29896,
32981,
368,
341,
286,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
341,
310,
5168,
1273,
29896,
32981,
3125,
25,
31645,
13828,
27,
53376,
29,
488,
1634,
3945,
82883,
29,
488,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decoder_decode_header_name_empty() {
let buffer = "RTSP/2.0 200 OK\r\n\
: 1\r\n\
\r\n";
let mut decoder = Decoder::new();
let (result, bytes_decoded) = decoder.decode(buffer);
assert_ne!(bytes_decoded, buffer.len());
assert_eq!(
result,
DecodeResult::Error(DecodeError::HeaderName(HeaderNameError::Empty))
);
} | rust_cleaned_test_functions.jsonl/123055 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 245
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49843,
15227,
8757,
1269,
15124,
368,
341,
286,
1077,
4147,
284,
330,
5350,
4592,
14,
17,
13,
15,
220,
17,
15,
15,
10402,
12016,
1699,
5661,
2549,
549,
220,
16,
12016,
1699,
5661,
2549,
1124,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_secp256k1_signature() {
// Create a secp256k1 identity from a PEM file.
let identity = Secp256k1Identity::from_pem(IDENTITY_FILE.as_bytes())
.expect("Cannot create secp256k1 identity from PEM file.");
// Create a secp256k1 signature on the message "Hello World".
let message = b"Hello World";
let signature = identity
.sign(message)
.expect("Cannot create secp256k1 signature.")
.signature
.expect("Cannot find secp256k1 signature bytes.");
// Import the secp256k1 signature into OpenSSL.
let r = BigNum::from_slice(&signature[0..32])
.expect("Cannot extract r component from secp256k1 signature bytes.");
let s = BigNum::from_slice(&signature[32..])
.expect("Cannot extract s component from secp256k1 signature bytes.");
let ecdsa_sig = EcdsaSig::from_private_components(r, s)
.expect("Cannot create secp256k1 signature from r and s components.");
// Assert the secp256k1 signature is valid.
let digest = sha256(message);
let public_key = identity.public_key;
let success = ecdsa_sig
.verify(&digest, &public_key)
.expect("Cannot verify secp256k1 signature.");
assert!(success);
} | rust_cleaned_test_functions.jsonl/81519 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 589
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3453,
4672,
17,
20,
21,
74,
16,
39859,
368,
341,
286,
442,
4230,
264,
511,
4672,
17,
20,
21,
74,
16,
9569,
504,
264,
96734,
1034,
624,
286,
1077,
9569,
284,
4520,
79,
17,
20,
21,
74,
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_try_from_ascii() {
// long vowels
let og = Orthographia::try_from_ascii("i'nfa'ns").unwrap();
assert_eq!("\u{012b}nf\u{0101}ns", &og.s);
let og = Orthographia::try_from_ascii("Ju'ppiter").unwrap();
assert_eq!("J\u{016b}ppiter", &og.s);
// semivowel v and vowel u
let og = Orthographia::try_from_ascii("ve'r|um").unwrap();
assert_eq!("v\u{0113}r|um", &og.s);
// compound word
let og = Orthographia::try_from_ascii("duo-decim").unwrap();
assert_eq!("duo-decim", &og.s);
// suffix
let og = Orthographia::try_from_ascii("-que").unwrap();
assert_eq!("-que", &og.s);
// stem and ending separation
let og = Orthographia::try_from_ascii("leg|is").unwrap();
assert_eq!("leg|is", &og.s);
// stem and ending separation with additional vertical bar
let og = Orthographia::try_from_ascii("le'g|era'|mus").unwrap();
assert_eq!("l\u{0113}g|er\u{0101}|mus", &og.s);
// stem
let og = Orthographia::try_from_ascii("magn|").unwrap();
assert_eq!("magn|", &og.s);
// word ending
let og = Orthographia::try_from_ascii("|us").unwrap();
assert_eq!("|us", &og.s);
// word ending with additional separator
let og = Orthographia::try_from_ascii("|eri|mus").unwrap();
assert_eq!("|eri|mus", &og.s);
// errors
// empty
let og = Orthographia::try_from_ascii("");
assert!(matches!(og, Err(Irritus)));
let og = Orthographia::try_from_ascii("'cauda");
assert!(matches!(og, Err(Irritus)));
let og = Orthographia::try_from_ascii("s'ol");
assert!(matches!(og, Err(Irritus)));
// double hyphen
let og = Orthographia::try_from_ascii("ex--it");
assert!(matches!(og, Err(Irritus)));
// double vertical line
let og = Orthographia::try_from_ascii("can||it");
assert!(matches!(og, Err(Irritus)));
// non-initial capital letter
let og = Orthographia::try_from_ascii("ITA");
assert!(matches!(og, Err(Irritus)));
let og = Orthographia::try_from_ascii("wind");
assert!(matches!(og, Err(Irritus)));
let og = Orthographia::try_from_ascii("\u{012b}nsula");
assert!(matches!(og, Err(Irritus)));
// punctuation
let og = Orthographia::try_from_ascii("S.P.Q.R.");
assert!(matches!(og, Err(Irritus)));
} | rust_cleaned_test_functions.jsonl/102149 | {
"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,
53283,
5673,
50238,
368,
341,
262,
442,
1293,
78456,
198,
262,
1077,
7350,
284,
31110,
3178,
685,
486,
1539,
5673,
50238,
445,
72,
43786,
3632,
6,
4412,
1827,
15454,
543,
262,
2060,
10714,
0,
49... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_method_call_expr() {
check_assist(
inline_local_variable,
"
fn foo() {
let bar = vec![1];
let a<|> = bar.len();
let b = a * 10;
let c = a as usize;
}",
"
fn foo() {
let bar = vec![1];
<|>let b = bar.len() * 10;
let c = bar.len() as usize;
}",
);
} | rust_cleaned_test_functions.jsonl/60320 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 201
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9032,
13429,
21915,
368,
341,
286,
1779,
12083,
380,
1006,
310,
7381,
13564,
14635,
345,
310,
6228,
8822,
15229,
368,
341,
262,
1077,
3619,
284,
7486,
20703,
16,
935,
262,
1077,
264,
27,
91,
29,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_call_hierarchy_outgoing() {
check_hierarchy(
r#"
//- /lib.rs
fn callee() {}
fn call$0er() {
callee();
callee();
}
"#,
expect![["caller Function FileId(0) 15..58 18..24"]],
expect![[]],
expect![["callee Function FileId(0) 0..14 3..9 : [33..39, 47..53]"]],
);
} | rust_cleaned_test_functions.jsonl/38290 | {
"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,
13429,
95043,
6068,
9546,
368,
341,
286,
1779,
95043,
1006,
310,
435,
2,
698,
61463,
608,
2740,
25638,
198,
8822,
94800,
368,
5613,
8822,
1618,
3,
15,
261,
368,
341,
262,
94800,
543,
262,
94800,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_convert_object_with_implicit_keys() {
let b = ast::BaseNode::default();
let pkg = ast::Package {
base: b.clone(),
path: "path".to_string(),
package: "main".to_string(),
files: vec![ast::File {
base: b.clone(),
name: "foo.flux".to_string(),
metadata: String::new(),
package: None,
imports: Vec::new(),
body: vec![ast::Statement::Expr(Box::new(ast::ExprStmt {
base: b.clone(),
expression: ast::Expression::Object(Box::new(ast::ObjectExpr {
base: b.clone(),
lbrace: None,
with: None,
properties: vec![
ast::Property {
base: b.clone(),
key: ast::PropertyKey::Identifier(ast::Identifier {
base: b.clone(),
name: "a".to_string(),
}),
separator: None,
value: None,
comma: None,
},
ast::Property {
base: b.clone(),
key: ast::PropertyKey::Identifier(ast::Identifier {
base: b.clone(),
name: "b".to_string(),
}),
separator: None,
value: None,
comma: None,
},
],
rbrace: None,
})),
}))],
eof: None,
}],
};
let want = Package {
loc: b.location.clone(),
package: "main".to_string(),
files: vec![File {
loc: b.location.clone(),
package: None,
imports: Vec::new(),
body: vec![Statement::Expr(ExprStmt {
loc: b.location.clone(),
expression: Expression::Object(Box::new(ObjectExpr {
loc: b.location.clone(),
typ: type_info(),
with: None,
properties: vec![
Property {
loc: b.location.clone(),
key: Identifier {
loc: b.location.clone(),
name: "a".to_string(),
},
value: Expression::Identifier(IdentifierExpr {
loc: b.location.clone(),
typ: type_info(),
name: "a".to_string(),
}),
},
Property {
loc: b.location.clone(),
key: Identifier {
loc: b.location.clone(),
name: "b".to_string(),
},
value: Expression::Identifier(IdentifierExpr {
loc: b.location.clone(),
typ: type_info(),
name: "b".to_string(),
}),
},
],
})),
})],
}],
};
let got = test_convert(pkg).unwrap();
assert_eq!(want, got);
} | rust_cleaned_test_functions.jsonl/30443 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2783
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
5314,
6615,
62,
30940,
12631,
368,
341,
286,
1077,
293,
284,
11763,
486,
3978,
1955,
486,
2258,
543,
286,
1077,
24793,
284,
11763,
486,
13100,
341,
310,
2331,
25,
293,
15997,
3148,
310,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_chunks_next() {
let v = [0, 1, 2, 3, 4, 5];
let mut c = v.chunks(2);
assert_eq!(c.next().unwrap(), &[0, 1]);
assert_eq!(c.next().unwrap(), &[2, 3]);
assert_eq!(c.next().unwrap(), &[4, 5]);
assert_eq!(c.next(), None);
let v = [0, 1, 2, 3, 4, 5, 6, 7];
let mut c = v.chunks(3);
assert_eq!(c.next().unwrap(), &[0, 1, 2]);
assert_eq!(c.next().unwrap(), &[3, 4, 5]);
assert_eq!(c.next().unwrap(), &[6, 7]);
assert_eq!(c.next(), None);
} | rust_cleaned_test_functions.jsonl/9620 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 262
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
65470,
11257,
368,
341,
262,
1077,
348,
284,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
262,
1077,
5206,
272,
284,
348,
5329,
15296,
7,
17,
317,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_trim_arch_os() {
let data = vec![
("name-linux-amd64", "name"),
("name-Linux-aarch64", "name"),
("name-linux-Arm64", "name"),
("name_Linux-64bit", "name"),
("name.Linux-64bit", "name"),
("name_macOS-64bit", "name"),
("name-v1.0.0_macOS-64bit", "name"),
("name_v1.0.0_macOS-64bit", "name"),
("name-v1.0.0-x86_64", "name"),
("name-x86_64", "name"),
("name-x86_64.exe", "name.exe"),
];
for x in data {
if cfg!(target_os = "windows") {
assert_eq!(trim_os_arch(x.0), "name.exe");
} else {
assert_eq!(trim_os_arch(x.0), x.1);
}
}
} | rust_cleaned_test_functions.jsonl/78569 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 480
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70025,
34330,
29387,
368,
341,
286,
1077,
821,
284,
7486,
90515,
310,
3489,
606,
46375,
32217,
67,
21,
19,
497,
330,
606,
4461,
310,
3489,
606,
8125,
19559,
7409,
1113,
21,
19,
497,
330,
606,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_point_addition_defined() {
fn _curve<E: Curve>() {
assert_operator_defined_for! {
assert_fn = assert_point_addition_defined,
lhs = {Point<E>, &Point<E>, Generator<E>},
rhs = {Point<E>, &Point<E>, Generator<E>},
}
}
} | rust_cleaned_test_functions.jsonl/101947 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 186
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6085,
2891,
680,
52870,
368,
341,
286,
5168,
716,
50051,
23835,
25,
53677,
13555,
341,
310,
2060,
40594,
52870,
5478,
0,
341,
394,
2060,
15246,
284,
2060,
6085,
2891,
680,
52870,
345,
394,
22505,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_role_change_notifier() {
let mut host = CoprocessorHost::default();
let (mut worker, scheduler) = start_deadlock_detector(&mut host);
let mut region = new_region(1, b"", b"", true);
let invalid = new_region(2, b"", b"", false);
let other = new_region(3, b"0", b"", true);
let follower_roles = [
StateRole::Follower,
StateRole::PreCandidate,
StateRole::Candidate,
];
let events = [
RegionChangeEvent::Create,
RegionChangeEvent::Update,
RegionChangeEvent::Destroy,
];
let check_role = |role| {
let (tx, f) = paired_future_callback();
scheduler.get_role(tx);
assert_eq!(f.wait().unwrap(), role);
};
// Region changed
for &event in &events[..2] {
for &follower_role in &follower_roles {
host.on_region_changed(®ion, event, follower_role);
check_role(Role::Follower);
host.on_region_changed(&invalid, event, StateRole::Leader);
check_role(Role::Follower);
host.on_region_changed(&other, event, StateRole::Leader);
check_role(Role::Follower);
host.on_region_changed(®ion, event, StateRole::Leader);
check_role(Role::Leader);
host.on_region_changed(&invalid, event, follower_role);
check_role(Role::Leader);
host.on_region_changed(&other, event, follower_role);
check_role(Role::Leader);
host.on_region_changed(®ion, event, follower_role);
check_role(Role::Follower);
}
}
host.on_region_changed(®ion, RegionChangeEvent::Create, StateRole::Leader);
host.on_region_changed(&invalid, RegionChangeEvent::Destroy, StateRole::Leader);
host.on_region_changed(&other, RegionChangeEvent::Destroy, StateRole::Leader);
check_role(Role::Leader);
host.on_region_changed(®ion, RegionChangeEvent::Destroy, StateRole::Leader);
check_role(Role::Follower);
// Leader region id is changed.
region.set_id(2);
host.on_region_changed(®ion, RegionChangeEvent::Update, StateRole::Leader);
// Destroy the previous leader region.
region.set_id(1);
host.on_region_changed(®ion, RegionChangeEvent::Destroy, StateRole::Leader);
check_role(Role::Leader);
// Role changed
let region = new_region(1, b"", b"", true);
host.on_region_changed(®ion, RegionChangeEvent::Create, StateRole::Follower);
check_role(Role::Follower);
for &follower_role in &follower_roles {
host.on_role_change(®ion, follower_role);
check_role(Role::Follower);
host.on_role_change(&invalid, StateRole::Leader);
check_role(Role::Follower);
host.on_role_change(&other, StateRole::Leader);
check_role(Role::Follower);
host.on_role_change(®ion, StateRole::Leader);
check_role(Role::Leader);
host.on_role_change(&invalid, follower_role);
check_role(Role::Leader);
host.on_role_change(&other, follower_role);
check_role(Role::Leader);
host.on_role_change(®ion, follower_role);
check_role(Role::Follower);
}
worker.stop();
} | rust_cleaned_test_functions.jsonl/53356 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1626
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19792,
15947,
86179,
368,
341,
286,
1077,
5206,
3468,
284,
24946,
40848,
269,
9296,
486,
2258,
543,
286,
1077,
320,
6984,
11864,
11,
28809,
8,
284,
1191,
53427,
1023,
71540,
2099,
6984,
3468,
626,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_append_block_with_invalid_version() {
let mut rng: StdRng = SeedableRng::from_seed([1u8; 32]);
let mut ledger_db = create_db();
let account_key = AccountKey::random(&mut rng);
let (mut block, block_contents) = get_origin_block_and_contents(&account_key);
let wrong_version = 1337;
block.version = wrong_version;
// Recompute the block ID to reflect the modified version.
block.id = compute_block_id(
block.version,
&block.parent_id,
block.index,
block.cumulative_txo_count,
&block.root_element,
&block.contents_hash,
);
assert_eq!(
ledger_db.append_block(&block, &block_contents, None),
Err(Error::InvalidBlock)
);
} | rust_cleaned_test_functions.jsonl/89698 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 401
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26041,
7113,
6615,
31433,
9438,
368,
341,
286,
1077,
5206,
28422,
25,
42517,
49,
968,
284,
35822,
480,
49,
968,
486,
1499,
33809,
2561,
16,
84,
23,
26,
220,
18,
17,
2558,
286,
1077,
5206,
4693... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reading_from_file() {
let mut tmp_file = env::temp_dir();
tmp_file.push("liner_test_file456.txt");
{
let mut f = fs::OpenOptions::new()
.read(true)
.write(true)
.create(true)
.open(tmp_file.clone())
.unwrap();
f.write_all(TEXT.as_bytes()).unwrap();
}
let mut h = History::new();
h.set_file_name_and_load_history(tmp_file).unwrap();
assert_eq!(String::from(h.buffers[0].clone()), "a".to_string());
assert_eq!(String::from(h.buffers[1].clone()), "b".to_string());
assert_eq!(String::from(h.buffers[2].clone()), "c".to_string());
assert_eq!(String::from(h.buffers[3].clone()), "d".to_string());
} | rust_cleaned_test_functions.jsonl/29130 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 356
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
81859,
5673,
2458,
368,
341,
262,
1077,
5206,
4174,
2458,
284,
6105,
486,
3888,
4334,
543,
262,
4174,
2458,
2552,
445,
61798,
4452,
2458,
19,
20,
21,
3909,
797,
262,
341,
286,
1077,
5206,
282,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_validate_unknown_script() {
let (config, key) = config_builder::test_config();
let vm_validator = TestValidator::new(&config);
let address = account_config::association_address();
let transaction = transaction_test_helpers::get_test_signed_txn(
address,
1,
&key,
key.public_key(),
Some(Script::new(vec![], vec![], vec![])),
);
let ret = vm_validator.validate_transaction(transaction).unwrap();
assert_eq!(
ret.status().unwrap().major_status,
StatusCode::UNKNOWN_SCRIPT
);
} | rust_cleaned_test_functions.jsonl/19611 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 250
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
57507,
14660,
368,
341,
262,
1077,
320,
1676,
11,
1376,
8,
284,
2193,
28532,
486,
1944,
5332,
543,
262,
1077,
10995,
64959,
284,
3393,
14256,
486,
931,
2099,
1676,
626,
262,
1077,
2621,
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_env_var_is_not_unicode() {
init();
let mut inner = KeyLogFileInner::new(Err(env::VarError::NotUnicode(
"/tmp/keylogfileinnertest".into(),
)));
assert!(inner
.try_write("label", b"random", b"secret")
.is_ok());
} | rust_cleaned_test_functions.jsonl/6060 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 164
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15879,
4612,
6892,
7913,
54662,
368,
341,
286,
2930,
543,
286,
1077,
5206,
9179,
284,
5309,
98857,
31597,
486,
931,
7,
7747,
16978,
486,
3962,
1454,
486,
2623,
33920,
1006,
310,
3521,
5173,
68864,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_string_format() -> Result<(), Box<EvalAltResult>> {
#[derive(Debug, Clone)]
struct TestStruct {
field: i64,
}
let mut engine = Engine::new();
engine
.register_type_with_name::<TestStruct>("TestStruct")
.register_fn("new_ts", || TestStruct { field: 42 })
.register_fn("to_string", |ts: TestStruct| format!("TS={}", ts.field))
.register_fn("to_debug", |ts: TestStruct| {
format!("!!!TS={}!!!", ts.field)
});
assert_eq!(
engine.eval::<String>(r#"let x = new_ts(); "foo" + x"#)?,
"fooTS=42"
);
assert_eq!(
engine.eval::<String>(r#"let x = new_ts(); x + "foo""#)?,
"TS=42foo"
);
#[cfg(not(feature = "no_index"))]
assert_eq!(
engine.eval::<String>(r#"let x = [new_ts()]; "foo" + x"#)?,
"foo[!!!TS=42!!!]"
);
Ok(())
} | rust_cleaned_test_functions.jsonl/69067 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 445
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
8955,
368,
1464,
5714,
68843,
8261,
23835,
831,
26017,
2077,
2452,
341,
262,
11506,
27098,
42618,
11,
27913,
5563,
262,
2036,
3393,
9422,
341,
286,
2070,
25,
600,
21,
19,
345,
262,
555,
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... | 2 |
#[test]
fn test_arithmetic_operators() {
assert::all_true(
r#"
+1.0 == 1.0
-1.0 == 0. - 1.
1.0 + 2.0 == 3.0
1.0 - 2.0 == -1.0
2.0 * 3.0 == 6.0
5.0 / 2.0 == 2.5
5.0 % 3.0 == 2.0
5.0 // 2.0 == 2.0
"#,
);
} | rust_cleaned_test_functions.jsonl/114097 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25842,
25922,
25634,
2973,
368,
341,
286,
2060,
486,
541,
16082,
1006,
310,
435,
2,
698,
10,
16,
13,
15,
621,
220,
16,
13,
15,
198,
12,
16,
13,
15,
621,
220,
15,
13,
481,
220,
16,
624,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_full_simple_gate() {
let gate: GateOperation = PauliX::new(0).into();
let preparation_gates: Vec<SingleQubitGateOperation> = vec![
PauliX::new(0).into(),
PauliY::new(0).into(),
PauliZ::new(0).into(),
];
let basis_rotation_gates: Vec<SingleQubitGateOperation> = vec![
PauliX::new(0).into(),
RotateX::new(0, std::f64::consts::FRAC_PI_2.into()).into(),
RotateZ::new(0, std::f64::consts::FRAC_PI_2.into()).into(),
];
let (measurement, exp_vals) =
prepare_monte_carlo_gate_test(gate, preparation_gates, basis_rotation_gates, None, 5, 200);
let backend = Backend::new(1);
let measured_exp_vals = backend.run_measurement(&measurement).unwrap().unwrap();
for (key, val) in exp_vals.iter() {
assert!((val - measured_exp_vals.get(key).unwrap()).abs() <= 2.0);
}
} | rust_cleaned_test_functions.jsonl/13553 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 402
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16372,
30015,
54798,
368,
341,
262,
1077,
18126,
25,
29243,
8432,
284,
6898,
72,
55,
486,
931,
7,
15,
568,
18122,
543,
262,
1077,
17975,
1889,
973,
25,
11312,
27,
10888,
48,
59220,
42318,
8432,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_parse_include_c() {
let code: Vec<char> = " #include \"asdf\"".to_string().chars().collect();
let result = try_parse_include(&code, 5);
assert_eq!(
result,
Some(ParseIncludeResult {
end_position: code.len(),
include_type: IncludeType::Relative,
path: "asdf".into()
})
);
} | rust_cleaned_test_functions.jsonl/126908 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 227
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
37878,
666,
368,
341,
286,
1077,
2038,
25,
11312,
21919,
29,
284,
330,
257,
671,
997,
7245,
76615,
2105,
3263,
983,
3904,
1005,
19255,
1005,
17384,
543,
286,
1077,
1102,
284,
1430,
21039,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_verify_far_contents_with_fixed_inputs() {
let creation_manifest = CreationManifest::from_external_and_far_contents(
btreemap! {
"lib/mylib.so".to_string() => "host/mylib.so".to_string()
},
btreemap! {
"meta/my_component.cmx".to_string() => "host/my_component.cmx".to_string()
},
)
.unwrap();
let meta_package =
MetaPackage::from_name_and_variant("my-package-name", "my-package-variant").unwrap();
let mut meta_far_writer = Vec::new();
let component_manifest_contents = "my_component.cmx contents";
let file_system = FakeFileSystem {
content_map: hashmap! {
"host/mylib.so".to_string() => "mylib.so contents".as_bytes().to_vec(),
"host/my_component.cmx".to_string() => component_manifest_contents.as_bytes().to_vec()
},
};
build_with_file_system(
&creation_manifest,
&meta_package,
&mut meta_far_writer,
&file_system,
)
.unwrap();
let mut cursor = io::Cursor::new(meta_far_writer);
let mut reader = fuchsia_archive::Reader::new(&mut cursor).unwrap();
let actual_meta_package_bytes = reader.read_file("meta/package").unwrap();
let expected_meta_package_bytes =
br#"{"name":"my-package-name","version":"my-package-variant"}"#;
assert_eq!(actual_meta_package_bytes.as_slice(), &expected_meta_package_bytes[..]);
let actual_meta_contents_bytes = reader.read_file("meta/contents").unwrap();
let expected_meta_contents_bytes =
b"lib/mylib.so=4a886105646222c10428e5793868b13f536752d4b87e6497cdf9caed37e67410\n";
assert_eq!(actual_meta_contents_bytes.as_slice(), &expected_meta_contents_bytes[..]);
let actual_meta_component_bytes = reader.read_file("meta/my_component.cmx").unwrap();
assert_eq!(actual_meta_component_bytes.as_slice(), component_manifest_contents.as_bytes());
} | rust_cleaned_test_functions.jsonl/51484 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 982
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35638,
67513,
16682,
6615,
37839,
28557,
368,
341,
286,
1077,
9688,
74269,
284,
34286,
38495,
486,
1499,
47432,
8378,
67513,
16682,
1006,
310,
293,
10157,
42040,
0,
341,
394,
330,
2740,
34198,
2740,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_occupied_entry_replace_entry_with() {
let mut a = HashMap::new();
let key = "a key";
let value = "an initial value";
let new_value = "a new value";
let entry = a
.raw_entry_mut()
.from_key(&key)
.insert(key, value)
.replace_entry_with(|k, v| {
assert_eq!(k, &key);
assert_eq!(v, value);
Some(new_value)
});
match entry {
RawEntryMut::Occupied(e) => {
assert_eq!(e.key(), &key);
assert_eq!(e.get(), &new_value);
}
RawEntryMut::Vacant(_) => panic!(),
}
assert_eq!(a[key], new_value);
assert_eq!(a.len(), 1);
let entry = match a.raw_entry_mut().from_key(&key) {
RawEntryMut::Occupied(e) => e.replace_entry_with(|k, v| {
assert_eq!(k, &key);
assert_eq!(v, new_value);
None
}),
RawEntryMut::Vacant(_) => panic!(),
};
match entry {
RawEntryMut::Vacant(_) => {}
RawEntryMut::Occupied(_) => panic!(),
}
assert!(!a.contains_key(key));
assert_eq!(a.len(), 0);
} | rust_cleaned_test_functions.jsonl/26983 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 745
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16067,
62,
40356,
9078,
10633,
9078,
6615,
368,
341,
286,
1077,
5206,
264,
284,
10528,
486,
931,
1428,
286,
1077,
1376,
284,
330,
64,
1376,
876,
286,
1077,
897,
284,
330,
276,
2856,
897,
876,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_xor_keystream_err_empty_input() {
let mut ctx =
ChaCha20::new(&[0u8; CHACHA_KEYSIZE], &[0u8; IETF_CHACHA_NONCESIZE], true).unwrap();
let mut tmp = [0u8; CHACHA_BLOCKSIZE];
let mut out = [0u8; 0];
assert!(xor_keystream(&mut ctx, 0, &mut tmp, &mut out).is_err());
} | rust_cleaned_test_functions.jsonl/44713 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 203
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
76462,
45476,
597,
1237,
9266,
15124,
5898,
368,
341,
310,
1077,
5206,
5635,
4035,
394,
27721,
95971,
17,
15,
486,
931,
2099,
58,
15,
84,
23,
26,
6826,
11873,
32,
6600,
20494,
1125,
44590,
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_truncate_custom_end() {
let mut args = HashMap::new();
args.insert("length".to_string(), to_value(&2).unwrap());
args.insert("end".to_string(), to_value(&"").unwrap());
let result = truncate(to_value("日本語").unwrap(), args);
assert!(result.is_ok());
assert_eq!(result.unwrap(), to_value("日本").unwrap());
} | rust_cleaned_test_functions.jsonl/49413 | {
"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,
3547,
26900,
15875,
6213,
368,
341,
286,
1077,
5206,
2827,
284,
10528,
486,
931,
543,
286,
2827,
7030,
445,
4129,
3263,
983,
3904,
1507,
311,
3142,
2099,
17,
568,
15454,
1423,
286,
2827,
7030,
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_decoder_valid() {
let mut d = UTF_16BE.decoder();
assert_feed_ok!(d, [0x00, 0x00,
0x00, 0x01, 0x00, 0x02, 0x00, 0x04, 0x00, 0x08,
0x00, 0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x80,
0x01, 0x00, 0x02, 0x00, 0x04, 0x00, 0x08, 0x00,
0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x80, 0x00,
0xff, 0xff], [],
"\u0000\
\u0001\u0002\u0004\u0008\
\u0010\u0020\u0040\u0080\
\u0100\u0200\u0400\u0800\
\u1000\u2000\u4000\u8000\
\uffff");
assert_feed_ok!(d, [0xd8, 0x00, 0xdc, 0x00,
0xd8, 0x00, 0xdc, 0x01, 0xd8, 0x00, 0xdc, 0x02,
0xd8, 0x00, 0xdc, 0x04, 0xd8, 0x00, 0xdc, 0x08,
0xd8, 0x00, 0xdc, 0x10, 0xd8, 0x00, 0xdc, 0x20,
0xd8, 0x00, 0xdc, 0x40, 0xd8, 0x00, 0xdc, 0x80,
0xd8, 0x00, 0xdd, 0x00, 0xd8, 0x00, 0xde, 0x00,
0xd8, 0x01, 0xdc, 0x00, 0xd8, 0x02, 0xdc, 0x00,
0xd8, 0x04, 0xdc, 0x00, 0xd8, 0x08, 0xdc, 0x00,
0xd8, 0x10, 0xdc, 0x00, 0xd8, 0x20, 0xdc, 0x00,
0xd8, 0x40, 0xdc, 0x00, 0xd8, 0x80, 0xdc, 0x00,
0xd9, 0x00, 0xdc, 0x00, 0xda, 0x00, 0xdc, 0x00,
0xdb, 0xff, 0xdf, 0xff], [],
"\U00010000\
\U00010001\U00010002\
\U00010004\U00010008\
\U00010010\U00010020\
\U00010040\U00010080\
\U00010100\U00010200\
\U00010400\U00010800\
\U00011000\U00012000\
\U00014000\U00018000\
\U00020000\U00030000\
\U00050000\U00090000\
\U0010FFFF");
assert_finish_ok!(d, "");
} | rust_cleaned_test_functions.jsonl/15676 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1671
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49843,
8337,
368,
341,
286,
1077,
5206,
294,
284,
20076,
62,
16,
21,
11594,
74047,
543,
286,
2060,
42390,
19817,
10297,
67,
11,
508,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
345,
999,
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_validate_signature_jwt_hs256() {
let secret = "secret123".to_string();
let jwt = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJrZXkxMSI6InZhbDEiLCJrZXkyMiI6InZhbDIifQ.jrcoVcRsmQqDEzSW9qOhG1HIrzV_n3nMhykNPnGvp9c".to_string();
let maybe_res = validate_signature(&jwt, &secret, Algorithm::HS256);
assert!(maybe_res.unwrap());
} | rust_cleaned_test_functions.jsonl/45838 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 209
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
39859,
95576,
85956,
17,
20,
21,
368,
341,
286,
1077,
6234,
284,
330,
20474,
16,
17,
18,
3263,
983,
3904,
543,
286,
1077,
24589,
284,
330,
84609,
49039,
38,
5855,
81096,
45064,
52,
89,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_peer_collect_capabilities_success() {
let mut exec = fasync::TestExecutor::new().expect("failed to create an executor");
let (remote, _, mut cobalt_receiver, peer) = setup_peer_test();
let p: ProfileDescriptor = ProfileDescriptor {
profile_id: ServiceClassProfileIdentifier::AdvancedAudioDistribution,
major_version: 1,
minor_version: 2,
};
peer.set_descriptor(p);
let collect_future = peer.collect_capabilities();
pin_mut!(collect_future);
assert!(exec.run_until_stalled(&mut collect_future).is_pending());
// Expect a discover command.
let received = recv_remote(&remote).unwrap();
assert_eq!(0x00, received[0] & 0xF);
assert_eq!(0x01, received[1]); // 0x01 = Discover
let txlabel_raw = received[0] & 0xF0;
// Respond with a set of streams.
let response: &[u8] = &[
txlabel_raw << 4 | 0x0 << 2 | 0x2,
0x01, // Discover
0x3E << 2 | 0x0 << 1,
0x00 << 4 | 0x1 << 3,
0x01 << 2 | 0x1 << 1,
0x00 << 4 | 0x1 << 3,
];
assert!(remote.as_ref().write(response).is_ok());
assert!(exec.run_until_stalled(&mut collect_future).is_pending());
// Expect a get capabilities and respond.
#[rustfmt::skip]
let capabilities_rsp = &[
0x01, 0x00,
0x07, 0x06, 0x00, 0x40, 0xF0, 0x9F, 0x92, 0x96
];
expect_get_capabilities_and_respond(&remote, 0x3E, capabilities_rsp);
assert!(exec.run_until_stalled(&mut collect_future).is_pending());
// Expect a get capabilities and respond.
#[rustfmt::skip]
let capabilities_rsp = &[
0x01, 0x00,
0x07, 0x04, 0x00, 0x00, 0xC0, 0xDE
];
expect_get_capabilities_and_respond(&remote, 0x01, capabilities_rsp);
// Should finish!
match exec.run_until_stalled(&mut collect_future) {
Poll::Pending => panic!("collect capabilities should be complete"),
Poll::Ready(Err(e)) => panic!("collect capabilities should have succeeded: {}", e),
Poll::Ready(Ok(endpoints)) => {
let first_seid: StreamEndpointId = 0x3E_u8.try_into().unwrap();
let second_seid: StreamEndpointId = 0x01_u8.try_into().unwrap();
for stream in endpoints {
if stream.local_id() == &first_seid {
let expected_caps = vec![
ServiceCapability::MediaTransport,
ServiceCapability::MediaCodec {
media_type: avdtp::MediaType::Audio,
codec_type: avdtp::MediaCodecType::new(0x40),
codec_extra: vec![0xF0, 0x9F, 0x92, 0x96],
},
];
assert_eq!(&expected_caps, stream.capabilities());
} else if stream.local_id() == &second_seid {
let expected_codec_type = avdtp::MediaCodecType::new(0x00);
assert_eq!(Some(&expected_codec_type), stream.codec_type());
} else {
panic!("Unexpected endpoint in the streams collected");
}
}
}
}
let event = cobalt_receiver.try_next().expect("Should get a CobaltEvent").unwrap();
assert_eq!(metrics::A2DP_CODEC_AVAILABILITY_METRIC_ID, event.metric_id);
let event = cobalt_receiver.try_next().expect("Should get a second CobaltEvent").unwrap();
assert_eq!(metrics::A2DP_CODEC_AVAILABILITY_METRIC_ID, event.metric_id);
let collect_future = peer.collect_capabilities();
pin_mut!(collect_future);
match exec.run_until_stalled(&mut collect_future) {
Poll::Ready(Ok(endpoints)) => assert_eq!(2, endpoints.len()),
x => panic!("Expected get remote capabilities to be done, got {:?}", x),
};
// Shouldn't report any more to cobalt since we already did so.
assert!(cobalt_receiver.try_next().is_err());
} | rust_cleaned_test_functions.jsonl/91776 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2308
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45159,
68140,
92092,
18632,
368,
341,
286,
1077,
5206,
3883,
284,
282,
7692,
486,
2271,
25255,
486,
931,
1005,
17119,
445,
16091,
311,
1855,
458,
31558,
3071,
286,
1077,
320,
18147,
11,
8358,
5206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_equal_normalized() {
let one: ModInt = ModInt::from_value_modulus(
BigInt::from(21),
BigInt::from(4),
);
let other_one: ModInt = ModInt::from_value_modulus(
BigInt::from(1),
BigInt::from(4),
);
assert_eq!(true, one == other_one);
} | rust_cleaned_test_functions.jsonl/126139 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 190
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11478,
80006,
368,
341,
286,
1077,
825,
25,
5650,
1072,
284,
5650,
1072,
486,
1499,
3142,
7480,
19425,
1006,
310,
62608,
486,
1499,
7,
17,
16,
1326,
310,
62608,
486,
1499,
7,
19,
1326,
286,
34... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hot_keys_cant_change_followees_of_manage_neuron_topic() {
let p: PathBuf = ["tests", "neurons.csv"].iter().collect();
let mut builder = GovernanceCanisterInitPayloadBuilder::new();
let init_neurons = &mut builder.add_all_neurons_from_csv_file(&p).proto.neurons;
let second_neuron = init_neurons[&42].clone();
// Add the controller of the second neuron as a hot key of the first one.
init_neurons
.get_mut(&25)
.unwrap()
.hot_keys
.push(*second_neuron.controller.as_ref().unwrap());
let (_, mut gov) =
governance_with_neurons(&init_neurons.values().cloned().collect::<Vec<Neuron>>());
let first_neuron = init_neurons[&25].clone();
// The controller of the second neuron should now be able
// change the followees of most topics.
let result = gov
.manage_neuron(
second_neuron.controller.as_ref().unwrap(),
&ManageNeuron {
id: None,
neuron_id_or_subaccount: Some(NeuronIdOrSubaccount::NeuronId(
first_neuron.id.as_ref().unwrap().clone(),
)),
command: Some(manage_neuron::Command::Follow(manage_neuron::Follow {
topic: Topic::Governance as i32,
followees: vec![second_neuron.id.as_ref().unwrap().clone()],
})),
},
)
.now_or_never()
.unwrap();
assert!(result.is_ok());
// topic.
let result = gov
.manage_neuron(
second_neuron.controller.as_ref().unwrap(),
&ManageNeuron {
id: None,
neuron_id_or_subaccount: Some(NeuronIdOrSubaccount::NeuronId(
first_neuron.id.as_ref().unwrap().clone(),
)),
command: Some(manage_neuron::Command::Follow(manage_neuron::Follow {
topic: Topic::NeuronManagement as i32,
followees: vec![second_neuron.id.as_ref().unwrap().clone()],
})),
},
)
.now_or_never()
.unwrap();
assert!(result.is_err());
assert_eq!(
result.clone().err().unwrap().error_type(),
ErrorType::NotAuthorized
);
assert_eq!(
result.err().unwrap().error_message,
"Caller is not authorized to manage following of neuron for the ManageNeuron topic."
);
} | rust_cleaned_test_functions.jsonl/1165 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1199
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33433,
12631,
666,
517,
15947,
43490,
5516,
3575,
56473,
13925,
36090,
31414,
368,
341,
262,
1077,
281,
25,
7933,
15064,
284,
4383,
23841,
497,
330,
811,
53669,
11219,
5521,
2015,
1005,
17384,
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_closures() {
let input = r#"
let newAdder = fn(x) {
fn(y) { x + y };
}
let addTwo = newAdder(2);
addTwo(2);
"#;
assert_eq!(Some(Object::Int(4)), eval(input));
} | rust_cleaned_test_functions.jsonl/12303 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
41206,
368,
341,
286,
1077,
1946,
284,
435,
2,
698,
1149,
501,
2212,
261,
284,
5168,
2075,
8,
341,
220,
5168,
7021,
8,
314,
856,
488,
379,
2605,
630,
1149,
912,
11613,
284,
501,
2212,
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_jis0208_decode_all() {
let input = include_bytes!("test_data/jis0208_in.txt");
let expectation = include_str!("test_data/jis0208_in_ref.txt");
let (cow, had_errors) = EUC_JP.decode_without_bom_handling(input);
assert!(had_errors, "Should have had errors.");
assert_eq!(&cow[..], expectation);
} | rust_cleaned_test_functions.jsonl/15057 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 166
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5374,
285,
15,
17,
15,
23,
15227,
5705,
368,
341,
286,
1077,
1946,
284,
2924,
12524,
17223,
1944,
1769,
4437,
285,
15,
17,
15,
23,
1243,
3909,
797,
286,
1077,
30193,
284,
2924,
2895,
17223,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_write_multiple_frames() {
let frames: Vec<HttpFrame> = vec![
HttpFrame::HeadersFrame(HeadersFrame::new(vec![], 1)),
HttpFrame::DataFrame(DataFrame::new(1)),
HttpFrame::DataFrame(DataFrame::new(3)),
HttpFrame::HeadersFrame(HeadersFrame::new(vec![], 3)),
];
let expected = frames.clone();
let mut conn = build_mock_http_conn();
let mut sender = MockSendFrame::new();
for frame in frames.into_iter() {
send_frame(&mut sender, &mut conn, frame).unwrap();
}
expect_frame_list(expected, sender.sent);
} | rust_cleaned_test_functions.jsonl/131334 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 300
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
45233,
29319,
368,
341,
286,
1077,
14087,
25,
11312,
27,
2905,
4369,
29,
284,
7486,
90515,
310,
4823,
4369,
486,
10574,
4369,
7,
10574,
4369,
486,
931,
25592,
0,
12995,
220,
16,
6965,
310,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_numeric_valid_u64() {
let mut params = Map::new();
params.assign("numeric", Value::U64(3)).ok();
let mut rules = BTreeMap::new();
rules.insert("numeric", vec![Rule::Numeric]);
let result = validate(&rules, params);
assert!(result.is_ok());
assert_eq!(result.unwrap().find(&["numeric"]).unwrap(), &Value::U64(3));
} | rust_cleaned_test_functions.jsonl/74441 | {
"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,
29418,
8337,
7300,
21,
19,
368,
341,
262,
1077,
5206,
3628,
284,
5027,
486,
931,
543,
262,
3628,
17870,
445,
19600,
497,
5162,
486,
52,
21,
19,
7,
18,
4579,
562,
1428,
262,
1077,
5206,
5601,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vote_balance_and_staked_normal() {
let mut stakes = Stakes::default();
impl Stakes {
pub fn vote_balance_and_warmed_staked(&self) -> u64 {
self.vote_accounts
.iter()
.map(|(_pubkey, (staked, account))| staked + account.lamports())
.sum()
}
}
let genesis_epoch = 0;
let ((vote_pubkey, vote_account), (stake_pubkey, stake_account)) =
create_warming_staked_node_accounts(10, genesis_epoch);
stakes.store(&vote_pubkey, &vote_account, true);
stakes.store(&stake_pubkey, &stake_account, true);
assert_eq!(stakes.vote_balance_and_staked(), 11);
assert_eq!(stakes.vote_balance_and_warmed_staked(), 1);
for (epoch, expected_warmed_stake) in ((genesis_epoch + 1)..=3).zip(&[2, 3, 4]) {
stakes = stakes.clone_with_epoch(epoch, true);
assert_eq!(stakes.vote_balance_and_staked(), 11);
assert_eq!(
stakes.vote_balance_and_warmed_staked(),
*expected_warmed_stake
);
}
} | rust_cleaned_test_functions.jsonl/77861 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 630
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54360,
29396,
8378,
1261,
7741,
13973,
368,
341,
286,
1077,
5206,
44425,
284,
794,
2050,
486,
2258,
543,
286,
11605,
794,
2050,
341,
310,
6675,
5168,
6910,
29396,
8378,
1670,
30272,
1261,
7741,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_zero_copy_parse() {
#[derive(Serialize, Deserialize, Eq, PartialEq, Debug)]
struct Foo<'a> {
borrowed_str: &'a str,
borrowed_bytes: &'a [u8],
}
let f = Foo {
borrowed_str: "hi",
borrowed_bytes: &[0, 1, 2, 3],
};
{
let encoded = serialize(&f).unwrap();
let out: Foo = deserialize(&encoded[..]).unwrap();
assert_eq!(out, f);
}
} | rust_cleaned_test_functions.jsonl/6275 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 222
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19359,
16096,
21039,
368,
341,
262,
11506,
27098,
3759,
9050,
11,
48440,
11,
33122,
11,
55039,
11,
11091,
5563,
262,
2036,
33428,
18291,
64,
29,
341,
286,
45564,
2895,
25,
30136,
64,
607,
345,
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_package_timer() {
let txid = Txid::from_hex("c2d4449afa8d26140898dd54d3390b057ba2a5afcf03ba29d7dc0d8b9ffe966e").unwrap();
let secp_ctx = Secp256k1::new();
let revk_outp = dumb_revk_output!(secp_ctx);
let mut package = PackageTemplate::build_package(txid, 0, revk_outp, 1000, true, 100);
let timer_none = package.timer();
assert!(timer_none.is_none());
package.set_timer(Some(100));
if let Some(timer_some) = package.timer() {
assert_eq!(timer_some, 100);
} else { panic!() }
} | rust_cleaned_test_functions.jsonl/35572 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 233
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26328,
16255,
368,
341,
197,
10217,
9854,
307,
284,
39850,
307,
486,
1499,
32655,
445,
66,
17,
67,
19,
19,
19,
24,
35834,
23,
67,
17,
21,
16,
19,
15,
23,
24,
23,
631,
20,
19,
67,
18,
18,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_char_column_rle_builder() {
let distinct_item_each_block = (128 - 16) / 8;
let mut builder = CharColumnBuilder::new(
false,
Some(8),
ColumnBuilderOptions::default_for_rle_block_test(),
);
for num in 0..(distinct_item_each_block + 1) {
builder.append(&Utf8Array::from_iter(
[Some(num.to_string().as_str())]
.iter()
.cycle()
.cloned()
.take(23),
));
}
let (index, _) = builder.finish();
assert_eq!(index.len(), 2);
assert_eq!(index[0].first_rowid as usize, 0);
// not `distinct_item_each_block * 23` because the `should_finish` of `RleBlockBuilder`
assert_eq!(
index[1].first_rowid as usize,
(distinct_item_each_block - 1) * 23 + 1
);
assert_eq!(index[1].row_count as usize, 22 + 23);
} | rust_cleaned_test_functions.jsonl/14127 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 550
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9232,
8744,
1710,
273,
28532,
368,
341,
286,
1077,
12460,
5634,
32046,
7113,
284,
320,
16,
17,
23,
481,
220,
16,
21,
8,
608,
220,
23,
280,
286,
1077,
5206,
7363,
284,
4864,
2933,
3297,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_debug_region_info() {
let (cluster, debug_client, store_id) = must_new_cluster_and_debug_client();
let raft_engine = cluster.get_raft_engine(store_id);
let kv_engine = cluster.get_engine(store_id);
let raft_cf = kv_engine.cf_handle(CF_RAFT).unwrap();
let region_id = 100;
let raft_state_key = keys::raft_state_key(region_id);
let mut raft_state = raft_serverpb::RaftLocalState::new();
raft_state.set_last_index(42);
raft_engine.put_msg(&raft_state_key, &raft_state).unwrap();
assert_eq!(
raft_engine
.get_msg::<raft_serverpb::RaftLocalState>(&raft_state_key)
.unwrap()
.unwrap(),
raft_state
);
let apply_state_key = keys::apply_state_key(region_id);
let mut apply_state = raft_serverpb::RaftApplyState::new();
apply_state.set_applied_index(42);
kv_engine
.put_msg_cf(raft_cf, &apply_state_key, &apply_state)
.unwrap();
assert_eq!(
kv_engine
.get_msg_cf::<raft_serverpb::RaftApplyState>(CF_RAFT, &apply_state_key)
.unwrap()
.unwrap(),
apply_state
);
let region_state_key = keys::region_state_key(region_id);
let mut region_state = raft_serverpb::RegionLocalState::new();
region_state.set_state(raft_serverpb::PeerState::Tombstone);
kv_engine
.put_msg_cf(raft_cf, ®ion_state_key, ®ion_state)
.unwrap();
assert_eq!(
kv_engine
.get_msg_cf::<raft_serverpb::RegionLocalState>(CF_RAFT, ®ion_state_key)
.unwrap()
.unwrap(),
region_state
);
// Debug region_info
let mut req = debugpb::RegionInfoRequest::new();
req.set_region_id(region_id);
let mut resp = debug_client.region_info(&req.clone()).unwrap();
assert_eq!(resp.take_raft_local_state(), raft_state);
assert_eq!(resp.take_raft_apply_state(), apply_state);
assert_eq!(resp.take_region_local_state(), region_state);
req.set_region_id(region_id + 1);
match debug_client.region_info(&req).unwrap_err() {
Error::RpcFailure(status) => {
assert_eq!(status.status, RpcStatusCode::NotFound);
}
_ => panic!("expect NotFound"),
}
} | rust_cleaned_test_functions.jsonl/8803 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1026
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15446,
20627,
3109,
368,
341,
262,
1077,
320,
18855,
11,
7390,
8179,
11,
3553,
842,
8,
284,
1969,
5921,
28441,
8378,
15446,
8179,
1428,
262,
1077,
52455,
24823,
284,
10652,
670,
62,
2944,
24823,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_multiple_computation() {
let hw = RefCell::new(CpuHardware::new());
let g = RefCell::new(Graph::new());
let a = 1f32.into_node(&g, &hw);
let b = 2f32.into_node(&g, &hw);
let c = 3f32.into_node(&g, &hw);
let y = a + -b * c;
let gx = grad(y, &[a, b, c]);
assert_eq!(gx.len(), 3);
assert_eq!(gx[0].shape(), Shape::new([]));
assert_eq!(gx[1].shape(), Shape::new([]));
assert_eq!(gx[2].shape(), Shape::new([]));
assert!(ptr::eq(gx[0].hardware(), &hw));
assert!(ptr::eq(gx[1].hardware(), &hw));
assert!(ptr::eq(gx[2].hardware(), &hw));
// dy/da == 1
assert_eq!(f32::try_from(gx[0]), Ok(1.));
// dy/db == -c
assert_eq!(f32::try_from(gx[1]), Ok(-3.));
// dy/dc = -b
assert_eq!(f32::try_from(gx[2]), Ok(-2.));
} | rust_cleaned_test_functions.jsonl/83561 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 410
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45233,
2965,
13320,
368,
341,
262,
1077,
31256,
284,
8550,
3599,
486,
931,
3025,
5584,
66862,
486,
931,
1423,
262,
1077,
342,
284,
8550,
3599,
486,
931,
63779,
486,
931,
5231,
262,
1077,
264,
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_rules() {
assert_eq!(
rules("& a < b"),
Ok((
"",
vec![
Rule::SetContext {
before: None,
sequence: "a".into(),
},
Rule::Increment {
level: 1,
prefix: None,
extension: None,
sequence: "b".into(),
},
]
))
);
assert_eq!(
rules("& a < b\n<< c\n\t\t\t\t<<<\nd <<<< e = f"),
Ok((
"",
vec![
Rule::SetContext {
before: None,
sequence: "a".into(),
},
Rule::Increment {
level: 1,
prefix: None,
extension: None,
sequence: "b".into(),
},
Rule::Increment {
level: 2,
prefix: None,
extension: None,
sequence: "c".into(),
},
Rule::Increment {
level: 3,
prefix: None,
extension: None,
sequence: "d".into(),
},
Rule::Increment {
level: 4,
prefix: None,
extension: None,
sequence: "e".into(),
},
Rule::Equal {
sequence: "f".into(),
}
]
))
);
} | rust_cleaned_test_functions.jsonl/21713 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1381
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21407,
368,
341,
286,
2060,
10714,
33673,
310,
5601,
34866,
264,
366,
293,
4461,
310,
7622,
94702,
394,
8324,
394,
7486,
90515,
503,
18100,
486,
1649,
1972,
341,
664,
1573,
25,
2240,
345,
664,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_version() {
// version 0 record
let data = [0x08];
let record = TestRequest::decode_from(&mut Cursor::new(&data), 0).expect("decode");
assert_eq!(record.value, 8);
assert_eq!(record.value2, 0); // default
let data = [0x08];
assert!(
TestRequest::decode_from(&mut Cursor::new(&data), 1).is_err(),
"version 1 needs 3 bytes"
);
let data = [0x08, 0x01, 0x05];
let record = TestRequest::decode_from(&mut Cursor::new(&data), 1).expect("decode");
assert_eq!(record.value, 8);
assert_eq!(record.value2, 1);
assert_eq!(record.value3, 5);
let data = [0x08, 0x01, 0x05];
let record = TestRequest::decode_from(&mut Cursor::new(&data), 3).expect("decode");
assert_eq!(record.value, 8);
assert_eq!(record.value2, 0);
assert_eq!(record.value3, 1);
} | rust_cleaned_test_functions.jsonl/60576 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 372
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
9438,
368,
341,
262,
442,
2319,
220,
15,
3255,
198,
262,
1077,
821,
284,
508,
15,
87,
15,
23,
935,
262,
1077,
3255,
284,
3393,
1900,
486,
18196,
5673,
2099,
6984,
28067,
486,
931,
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_set_ops() {
let ctx = TestContext::new();
let mut con = ctx.connection();
redis::cmd("SADD").arg("foo").arg(1).execute(&mut con);
redis::cmd("SADD").arg("foo").arg(2).execute(&mut con);
redis::cmd("SADD").arg("foo").arg(3).execute(&mut con);
let mut s: Vec<i32> = redis::cmd("SMEMBERS").arg("foo").query(&mut con).unwrap();
s.sort();
assert_eq!(s.len(), 3);
assert_eq!(&s, &[1, 2, 3]);
let set: HashSet<i32> = redis::cmd("SMEMBERS").arg("foo").query(&mut con).unwrap();
assert_eq!(set.len(), 3);
assert!(set.contains(&1i32));
assert!(set.contains(&2i32));
assert!(set.contains(&3i32));
let set: BTreeSet<i32> = redis::cmd("SMEMBERS").arg("foo").query(&mut con).unwrap();
assert_eq!(set.len(), 3);
assert!(set.contains(&1i32));
assert!(set.contains(&2i32));
assert!(set.contains(&3i32));
} | rust_cleaned_test_functions.jsonl/108946 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 399
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
21959,
368,
341,
262,
1077,
5635,
284,
3393,
1972,
486,
931,
543,
262,
1077,
5206,
390,
284,
5635,
20310,
1428,
262,
20870,
486,
8710,
445,
50,
15665,
1827,
858,
445,
7975,
1827,
858,
7,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_index_nonexistent() {
let mut map = TrieMap::new();
map.insert(1, 2);
map.insert(2, 1);
map.insert(3, 4);
map[4];
} | rust_cleaned_test_functions.jsonl/88436 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3560,
21637,
64085,
368,
341,
286,
1077,
5206,
2415,
284,
62783,
2227,
486,
931,
1428,
286,
2415,
7030,
7,
16,
11,
220,
17,
317,
286,
2415,
7030,
7,
17,
11,
220,
16,
317,
286,
2415,
7030,
7,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_create_port_and_stub_and_write_and_read() {
let (mut pelcoport, mut stubdev) = new_stub_port_and_device();
pelcoport.write_all(b"hello").unwrap();
assert_eq!(b"hello".to_vec(), stubdev.received());
let mut buf = [0u8; 32];
stubdev
.write_all(b"bye")
.expect("Error when sending data through stub");
assert_eq!(3, pelcoport.read(&mut buf).unwrap());
assert_eq!(b"bye", &buf[..3]);
} | rust_cleaned_test_functions.jsonl/53591 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 201
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
8716,
8378,
62781,
8378,
9165,
8378,
6443,
368,
341,
262,
1077,
320,
6984,
11814,
1015,
403,
11,
5206,
13633,
3583,
8,
284,
501,
62781,
8716,
8378,
9204,
1428,
262,
11814,
1015,
403,
3836,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multi_byte_359() {
// https://github.com/lotabout/skim/issues/359
let highlight = Attr::default().effect(Effect::BOLD);
let ansistring = AnsiString::new_str("ああa", vec![(highlight, (2, 3))]);
let mut it = ansistring.iter();
assert_eq!(Some(('あ', Attr::default())), it.next());
assert_eq!(Some(('あ', Attr::default())), it.next());
assert_eq!(Some(('a', highlight)), it.next());
assert_eq!(None, it.next());
} | rust_cleaned_test_functions.jsonl/92168 | {
"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,
25133,
19737,
62,
18,
20,
24,
368,
341,
286,
442,
3703,
1110,
5204,
905,
14,
9184,
9096,
2687,
57893,
38745,
14,
18,
20,
24,
198,
286,
1077,
11167,
284,
50943,
486,
2258,
1005,
26061,
7,
7738,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_range() {
let mut runtime = Runtime::new().unwrap();
let handshake = connect("user=postgres");
let (mut client, connection) = runtime.block_on(handshake).unwrap();
let connection = connection.map_err(|e| panic!("{}", e));
runtime.spawn(connection);
let prepare = client.prepare("SELECT $1::INT8RANGE");
let stmt = runtime.block_on(prepare).unwrap();
let query = client.query(&stmt, &[&&[&1i64][..]]).collect();
let err = runtime.block_on(query).err().unwrap();
match err.source() {
Some(e) if e.is::<WrongType>() => {}
_ => panic!("Unexpected error {:?}", err),
};
} | rust_cleaned_test_functions.jsonl/127924 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 259
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26488,
9698,
368,
341,
262,
1077,
5206,
15592,
284,
10954,
486,
931,
1005,
15454,
1428,
262,
1077,
57020,
284,
4564,
445,
872,
28,
43070,
797,
262,
1077,
320,
6984,
2943,
11,
3633,
8,
284,
15592... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_update_config() {
let mut deps = mock_dependencies(&[]);
let msg = InstantiateMsg {
astroport_factory: ("astroportfactory".to_string()),
distribution_contract: ("gov0000".to_string()),
nebula_token: ("nebula0000".to_string()),
owner: ("owner0000".to_string()),
base_denom: "uusd".to_string(),
};
let info = mock_info("addr0000", &[]);
let _res = instantiate(deps.as_mut(), mock_env(), info.clone(), msg).unwrap();
// update owner
let msg = ExecuteMsg::UpdateConfig {
astroport_factory: Some("astroportfactory1".to_string()),
distribution_contract: Some("gov0001".to_string()),
nebula_token: Some("nebula0001".to_string()),
base_denom: Some("uusd1".to_string()),
owner: Some("owner0001".to_string()),
};
let info = mock_info("owner0000", &[]);
let _res = execute(deps.as_mut(), mock_env(), info, msg).unwrap();
let config: ConfigResponse = query_config(deps.as_ref()).unwrap();
assert_eq!("astroportfactory1", config.astroport_factory.as_str());
assert_eq!("gov0001", config.distribution_contract.as_str());
assert_eq!("nebula0001", config.nebula_token.as_str());
assert_eq!("uusd1", config.base_denom.as_str());
assert_eq!("owner0001", config.owner.as_str());
// failed unauthorized
let msg = ExecuteMsg::UpdateConfig {
owner: None,
astroport_factory: Some("astroportfactory1".to_string()),
distribution_contract: Some("gov0001".to_string()),
nebula_token: Some("nebula0001".to_string()),
base_denom: Some("uusd1".to_string()),
};
let info = mock_info("owner0000", &[]);
let res = execute(deps.as_mut(), mock_env(), info, msg).unwrap_err();
assert_eq!(res, ContractError::Unauthorized {})
} | rust_cleaned_test_functions.jsonl/32202 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 759
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
5332,
368,
341,
262,
1077,
5206,
48178,
284,
7860,
71841,
2099,
1294,
626,
262,
1077,
3750,
284,
32288,
6611,
341,
286,
46704,
403,
24269,
25,
3489,
22975,
403,
21618,
3263,
983,
3904,
14702... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_next_leader_slot_blocktree() {
let pubkey = Pubkey::new_rand();
let mut genesis_config = create_genesis_config_with_leader(
BOOTSTRAP_LEADER_LAMPORTS,
&pubkey,
BOOTSTRAP_LEADER_LAMPORTS,
)
.genesis_config;
genesis_config.epoch_schedule.warmup = false;
let bank = Bank::new(&genesis_config);
let cache = Arc::new(LeaderScheduleCache::new_from_bank(&bank));
let ledger_path = get_tmp_ledger_path!();
{
let blocktree = Arc::new(
Blocktree::open(&ledger_path).expect("Expected to be able to open database ledger"),
);
assert_eq!(
cache.slot_leader_at(bank.slot(), Some(&bank)).unwrap(),
pubkey
);
// Check that the next leader slot after 0 is slot 1
assert_eq!(
cache
.next_leader_slot(&pubkey, 0, &bank, Some(&blocktree))
.unwrap()
.0,
1
);
// but slot 1 is empty so should not be skipped
let (shreds, _) = make_slot_entries(2, 1, 1);
blocktree.insert_shreds(shreds, None, false).unwrap();
assert_eq!(
cache
.next_leader_slot(&pubkey, 0, &bank, Some(&blocktree))
.unwrap()
.0,
1
);
// Write a shred into slot 1
let (shreds, _) = make_slot_entries(1, 0, 1);
// Check that slot 1 and 2 are skipped
blocktree.insert_shreds(shreds, None, false).unwrap();
assert_eq!(
cache
.next_leader_slot(&pubkey, 0, &bank, Some(&blocktree))
.unwrap()
.0,
3
);
// Integrity checks
assert_eq!(
cache.next_leader_slot(
&pubkey,
2 * genesis_config.epoch_schedule.slots_per_epoch - 1, // no schedule generated for epoch 2
&bank,
Some(&blocktree)
),
None
);
assert_eq!(
cache.next_leader_slot(
&Pubkey::new_rand(), // not in leader_schedule
0,
&bank,
Some(&blocktree)
),
None
);
}
Blocktree::destroy(&ledger_path).unwrap();
} | rust_cleaned_test_functions.jsonl/49173 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1552
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11257,
79991,
27563,
7113,
9344,
368,
341,
286,
1077,
95116,
284,
22611,
792,
486,
931,
33864,
543,
286,
1077,
5206,
59366,
5332,
284,
1855,
16322,
13774,
5332,
6615,
79991,
1006,
310,
83676,
6666,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_set_threshold() {
let cycles_limit = 1024 * 1024 * 1024;
let caller = Address::from_hex("0x755cdba6ae4f479f7164792b318b2a06c759833b").unwrap();
let context = mock_context(cycles_limit, caller);
let tx_hash = context.get_tx_hash().unwrap();
let mut service = new_multi_signature_service();
let owner = gen_one_keypair();
let owner_address = Address::from_pubkey_bytes(owner.1.clone()).unwrap();
let keypairs = gen_keypairs(4);
let account_pubkeys = keypairs
.iter()
.map(|pair| to_multi_sig_account(pair.1.clone()))
.collect::<Vec<_>>();
let multi_sig_address = service
.generate_account(context.clone(), GenerateMultiSigAccountPayload {
owner: owner_address,
addr_with_weight: account_pubkeys,
threshold: 3,
memo: String::new(),
})
.succeed_data
.address;
// test new threshold above sum of the weights
let res = service.set_threshold(context.clone(), SetThresholdPayload {
witness: gen_single_witness(&owner.0, &tx_hash),
multi_sig_address: multi_sig_address.clone(),
new_threshold: 5,
});
assert_eq!(
res.error_message,
"new threshold larger the sum of the weights".to_owned()
);
// test set new threshold success
let res = service.set_threshold(context, SetThresholdPayload {
witness: gen_single_witness(&owner.0, &tx_hash),
multi_sig_address,
new_threshold: 2,
});
assert_eq!(res.error_message, "".to_owned());
} | rust_cleaned_test_functions.jsonl/130833 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 730
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
21858,
368,
341,
262,
1077,
24484,
14763,
284,
220,
16,
15,
17,
19,
353,
220,
16,
15,
17,
19,
353,
220,
16,
15,
17,
19,
26,
715,
262,
1077,
19865,
284,
9177,
486,
1499,
32655,
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... | 1 |
#[test]
fn test_inner_as_trait() {
assert_eq!(Value::U32(42).as_size_of().size_of(), 4);
assert_eq!(Value::U64(24).as_size_of().size_of(), 8);
assert_eq!(&*format!("{}", Value::U32(42).as_display()), "42");
assert_eq!(&*format!("{}", Value::U64(24).as_display()), "24");
{
let mut v = Value::U32(42);
v.as_replace().replace(1701);
assert_eq!(v, Value::U32(1701));
}
{
let mut v = Value::U64(24);
v.as_replace().replace(81);
assert_eq!(v, Value::U64(81));
}
} | rust_cleaned_test_functions.jsonl/50941 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 282
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34345,
11898,
78491,
368,
341,
262,
2060,
10714,
10297,
1130,
486,
52,
18,
17,
7,
19,
17,
568,
300,
2368,
3575,
1005,
2141,
3575,
1507,
220,
19,
317,
262,
2060,
10714,
10297,
1130,
486,
52,
21... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_drop_iter() {
let counter = Cell::new(0);
{
let arena = TypedArena::default();
let mut vec = Vec::with_capacity(100);
for _ in 0..100 {
vec.push(DropCounter { counter: &counter });
}
arena.alloc_iter(vec);
assert_eq!(counter.get(), 0);
}
assert_eq!(counter.get(), 100);
} | rust_cleaned_test_functions.jsonl/12326 | {
"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,
29584,
11723,
368,
341,
262,
1077,
5546,
284,
13972,
486,
931,
7,
15,
317,
262,
341,
414,
1077,
24902,
284,
50554,
93937,
486,
2258,
543,
414,
1077,
5206,
7486,
284,
11312,
486,
4197,
35603,
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_long_format_x_default() {
assert_eq!(
parse_format_flags_str(&vec!["od", "--format=x"]).unwrap(),
vec![FORMAT_ITEM_HEX32]
);
} | rust_cleaned_test_functions.jsonl/112178 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17799,
8955,
3212,
9993,
368,
341,
262,
2060,
10714,
33673,
286,
4715,
8955,
14130,
2895,
2099,
4083,
0,
1183,
347,
497,
14482,
2243,
25387,
45014,
15454,
3148,
286,
7486,
20703,
46559,
16461,
86502... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_tx_two_out_atomic_pass() {
let (genesis_config, mint_keypair) = create_genesis_config(2);
let key1 = Pubkey::new_rand();
let key2 = Pubkey::new_rand();
let bank = Bank::new(&genesis_config);
let instructions =
system_instruction::transfer_many(&mint_keypair.pubkey(), &[(key1, 1), (key2, 1)]);
let tx = Transaction::new_signed_instructions(
&[&mint_keypair],
instructions,
genesis_config.hash(),
);
bank.process_transaction(&tx).unwrap();
assert_eq!(bank.get_balance(&mint_keypair.pubkey()), 0);
assert_eq!(bank.get_balance(&key1), 1);
assert_eq!(bank.get_balance(&key2), 1);
} | rust_cleaned_test_functions.jsonl/42378 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 355
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11667,
17805,
23241,
6068,
51367,
15464,
368,
341,
286,
1077,
320,
77894,
5332,
11,
28337,
3097,
12670,
8,
284,
1855,
16322,
13774,
5332,
7,
17,
317,
286,
1077,
1376,
16,
284,
22611,
792,
486,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hash_exact_block_size_values() {
hash_exact_block_size_values(Sha256::new(), INPUT_BLOCK_SIZE_SHA256);
hash_exact_block_size_values(Sha384::new(), INPUT_BLOCK_SIZE_SHA384);
hash_exact_block_size_values(Sha512::new(), INPUT_BLOCK_SIZE_SHA512);
} | rust_cleaned_test_functions.jsonl/23445 | {
"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,
8950,
71084,
7113,
2368,
9146,
368,
341,
286,
5175,
71084,
7113,
2368,
9146,
7,
62316,
17,
20,
21,
486,
931,
1507,
26149,
18756,
4098,
38096,
17,
20,
21,
317,
286,
5175,
71084,
7113,
2368,
9146,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bash_escape() {
let test = "$(echo a)";
assert_eq!(
wrap_colorseq_for_shell(test.to_owned(), Shell::Bash),
r"\$(echo a)"
);
assert_eq!(
wrap_colorseq_for_shell(test.to_owned(), Shell::PowerShell),
test
);
let test = r"\$(echo a)";
assert_eq!(
wrap_colorseq_for_shell(test.to_owned(), Shell::Bash),
r"\\\$(echo a)"
);
assert_eq!(
wrap_colorseq_for_shell(test.to_owned(), Shell::PowerShell),
test
);
let test = r"`echo a`";
assert_eq!(
wrap_colorseq_for_shell(test.to_owned(), Shell::Bash),
r"\`echo a\`"
);
assert_eq!(
wrap_colorseq_for_shell(test.to_owned(), Shell::PowerShell),
test
);
} | rust_cleaned_test_functions.jsonl/56267 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 510
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
988,
21832,
368,
341,
286,
1077,
1273,
284,
41553,
3047,
264,
24023,
286,
2060,
10714,
33673,
310,
15061,
6714,
13262,
5478,
48945,
8623,
2389,
51973,
1507,
29402,
486,
33,
988,
1326,
310,
43... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_write_object() {
assert_eq!(mk_object(&[]).to_string(), "{}");
assert_eq!(mk_object(&[]).to_pretty_str(), "{}");
assert_eq!(
mk_object(&[
("a".into_string(), Boolean(true))
]).to_string(),
"{\"a\":true}"
);
assert_eq!(
mk_object(&[("a".into_string(), Boolean(true))]).to_pretty_str(),
"\
{\n \
\"a\": true\n\
}"
);
let complex_obj = mk_object(&[
("b".into_string(), Array(vec![
mk_object(&[("c".into_string(), String("\x0c\r".into_string()))]),
mk_object(&[("d".into_string(), String("".into_string()))])
]))
]);
assert_eq!(
complex_obj.to_string(),
"{\
\"b\":[\
{\"c\":\"\\f\\r\"},\
{\"d\":\"\"}\
]\
}"
);
assert_eq!(
complex_obj.to_pretty_str(),
"\
{\n \
\"b\": [\n \
{\n \
\"c\": \"\\f\\r\"\n \
},\n \
{\n \
\"d\": \"\"\n \
}\n \
]\n\
}"
);
let a = mk_object(&[
("a".into_string(), Boolean(true)),
("b".into_string(), Array(vec![
mk_object(&[("c".into_string(), String("\x0c\r".into_string()))]),
mk_object(&[("d".into_string(), String("".into_string()))])
]))
]);
// We can't compare the strings directly because the object fields be
// printed in a different order.
assert_eq!(a.clone(), from_str(a.to_string().as_slice()).unwrap());
assert_eq!(a.clone(),
from_str(a.to_pretty_str().as_slice()).unwrap());
} | rust_cleaned_test_functions.jsonl/6536 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1246
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
5314,
368,
341,
286,
2060,
10714,
10297,
24452,
5314,
2099,
1294,
568,
983,
3904,
1507,
35503,
797,
286,
2060,
10714,
10297,
24452,
5314,
2099,
1294,
568,
983,
620,
21322,
2895,
1507,
35503,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tokenize_message_type() {
let schema = "
message schema {
required int32 a;
optional binary c (UTF8);
required group d {
required int32 a;
optional binary c (UTF8);
}
required group e (LIST) {
repeated group list {
required int32 element;
}
}
}
";
let mut iter = Tokenizer::from_str(schema);
let mut res = Vec::new();
while let Some(token) = iter.next() {
res.push(token);
}
assert_eq!(
res,
vec![
"message", "schema", "{", "required", "int32", "a", ";", "optional", "binary", "c",
"(", "UTF8", ")", ";", "required", "group", "d", "{", "required", "int32", "a",
";", "optional", "binary", "c", "(", "UTF8", ")", ";", "}", "required", "group",
"e", "(", "LIST", ")", "{", "repeated", "group", "list", "{", "required", "int32",
"element", ";", "}", "}", "}"
]
);
} | rust_cleaned_test_functions.jsonl/115900 | {
"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,
86508,
6462,
1819,
368,
341,
286,
1077,
10802,
284,
6228,
262,
1943,
10802,
341,
414,
2567,
526,
18,
17,
264,
280,
414,
10101,
7868,
272,
320,
8561,
23,
317,
414,
2567,
1874,
294,
341,
286,
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_iter() {
// One.
let one: OneOrSet<MockKeyU8> = OneOrSet::new_one(MockKeyU8(1));
let mut one_iter = one.iter();
assert_eq!(one_iter.next(), Some(&MockKeyU8(1)));
assert_eq!(one_iter.next(), None);
assert_eq!(one_iter.next(), None);
// Set.
let set: OneOrSet<MockKeyU8> = OneOrSet::new_set((1..=3).map(MockKeyU8).collect()).unwrap();
let mut set_iter = set.iter();
assert_eq!(set_iter.next(), Some(&MockKeyU8(1)));
assert_eq!(set_iter.next(), Some(&MockKeyU8(2)));
assert_eq!(set_iter.next(), Some(&MockKeyU8(3)));
assert_eq!(set_iter.next(), None);
} | rust_cleaned_test_functions.jsonl/5925 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 296
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
368,
341,
262,
442,
3776,
624,
262,
1077,
825,
25,
3776,
2195,
1649,
27,
11571,
1592,
52,
23,
29,
284,
3776,
2195,
1649,
486,
931,
11667,
66436,
1592,
52,
23,
7,
16,
1106,
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_split_on_special_tokens() {
// Given
let vocab = generate_test_vocab();
let test_tuples = [
(
"Sentence with [MASK] token.",
vec!["Sentence with", "[MASK]", " token."],
),
(
"[CLS]Sentence with [MASK] token.",
vec!["[CLS]", "Sentence with", "[MASK]", " token."],
),
("[CLS]", vec!["[CLS]"]),
("[CLS] [PAD]", vec!["[CLS]", "[PAD]"]),
("[CLS] [PAD]", vec!["[CLS]", "[PAD]"]),
("asdf[CLS]", vec!["asdf", "[CLS]"]),
(
"No special token in sentence",
vec!["No special token in sentence"],
),
("", vec![]),
(
"[UNK]中华人民共和国 [PAD] asdf",
vec!["[UNK]", "中华人民共和国", "[PAD]", " asdf"],
),
];
// When & Then
xpected_tokens) in test_tuples.iter() {
let offsets =
(0..source_text.chars().count() as OffsetSize).collect::<Vec<OffsetSize>>();
let tokens: Vec<&str> =
split_on_special_tokens(TokenRef::new(source_text, offsets.as_slice()), &vocab)
.into_iter()
.map(|t| t.text)
.collect();
assert_eq!(tokens, *expected_tokens);
}
} | rust_cleaned_test_functions.jsonl/13625 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 891
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
4470,
41629,
28838,
368,
341,
286,
442,
286,
16246,
198,
286,
1077,
23820,
284,
6923,
4452,
52823,
543,
286,
1077,
1273,
89269,
284,
2278,
310,
2399,
394,
330,
84564,
448,
508,
49863,
60,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_args_qnorm() {
let mut args = Args::new();
assert_eq!(false, args.qnorm());
args.set_qnorm(true);
assert_eq!(true, args.qnorm());
} | rust_cleaned_test_functions.jsonl/118630 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8384,
8976,
20011,
368,
341,
286,
1077,
5206,
2827,
284,
17693,
486,
931,
543,
286,
2060,
10714,
10297,
3849,
11,
2827,
11354,
20011,
5231,
286,
2827,
980,
8976,
20011,
3715,
317,
286,
2060,
10714... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_payout_all() {
ExtBuilder::default().has_stakers(true).build_and_execute(|| {
let v = 10;
let n = 100;
let selected_benchmark = SelectedBenchmark::payout_all;
let c = vec![(frame_benchmarking::BenchmarkParameter::v, v), (frame_benchmarking::BenchmarkParameter::n, n)];
let closure_to_benchmark =
<SelectedBenchmark as frame_benchmarking::BenchmarkingSetup<Test>>::instance(
&selected_benchmark,
&c,
true
).unwrap();
assert_ok!(closure_to_benchmark());
});
} | rust_cleaned_test_functions.jsonl/21667 | {
"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,
1407,
5705,
368,
341,
197,
76605,
3297,
486,
2258,
1005,
4648,
1261,
8312,
3715,
568,
5834,
8378,
44329,
79453,
341,
298,
10217,
348,
284,
220,
16,
15,
280,
298,
10217,
308,
284,
220,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_get_process() {
let mut sys = System::new();
sys.refresh_processes();
let p = sys
.get_process(utils::get_current_pid().expect("failed to get current pid"))
.expect("didn't find process");
assert!(p.memory() > 0);
} | rust_cleaned_test_functions.jsonl/53562 | {
"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,
3062,
11305,
368,
341,
286,
1077,
5206,
5708,
284,
739,
486,
931,
543,
286,
5708,
26031,
80143,
543,
286,
1077,
281,
284,
5708,
198,
310,
659,
455,
11305,
64166,
486,
455,
11080,
30065,
1005,
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_cell_add_p() {
let b = TableCell::new()
.add_paragraph(Paragraph::new().add_run(Run::new().add_text("Hello")))
.build();
assert_eq!(
str::from_utf8(&b).unwrap(),
r#"<w:tc><w:tcPr /><w:p w14:paraId="12345678"><w:pPr><w:rPr /></w:pPr><w:r><w:rPr /><w:t xml:space="preserve">Hello</w:t></w:r></w:p></w:tc>"#
);
} | rust_cleaned_test_functions.jsonl/95181 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 235
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16648,
2891,
620,
368,
341,
286,
1077,
293,
284,
84370,
486,
931,
741,
310,
659,
718,
96713,
7,
42165,
486,
931,
1005,
718,
14007,
2785,
359,
486,
931,
1005,
718,
4326,
445,
9707,
29836,
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_mul32_reg() {
test_interpreter_and_jit_asm!(
"
mov r0, 3
mov r1, 4
mul32 r0, r1
exit",
[],
(),
{ |_vm, res: Result| { res.unwrap() == 0xc } },
4
);
} | rust_cleaned_test_functions.jsonl/58953 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24944,
18,
17,
4920,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
6228,
286,
1974,
435,
15,
11,
220,
18,
198,
286,
1974,
435,
16,
11,
220,
19,
198,
286,
15602,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_translate_slice() {
// zero len
let good_data = vec![1u8, 2, 3, 4, 5];
let data: Vec<u8> = vec![];
assert_eq!(0x1 as *const u8, data.as_ptr());
let addr = good_data.as_ptr() as *const _ as u64;
let memory_mapping = MemoryMapping::new::<UserError>(
vec![MemoryRegion {
host_addr: addr,
vm_addr: 100,
len: good_data.len() as u64,
vm_gap_shift: 63,
is_writable: false,
}],
&DEFAULT_CONFIG,
)
.unwrap();
let translated_data = translate_slice::<u8>(
&memory_mapping,
data.as_ptr() as u64,
0,
&bpf_loader::id(),
true,
)
.unwrap();
assert_eq!(data, translated_data);
assert_eq!(0, translated_data.len());
// u8
let mut data = vec![1u8, 2, 3, 4, 5];
let addr = data.as_ptr() as *const _ as u64;
let memory_mapping = MemoryMapping::new::<UserError>(
vec![MemoryRegion {
host_addr: addr,
vm_addr: 100,
len: data.len() as u64,
vm_gap_shift: 63,
is_writable: false,
}],
&DEFAULT_CONFIG,
)
.unwrap();
let translated_data = translate_slice::<u8>(
&memory_mapping,
100,
data.len() as u64,
&bpf_loader::id(),
true,
)
.unwrap();
assert_eq!(data, translated_data);
data[0] = 10;
assert_eq!(data, translated_data);
assert!(translate_slice::<u8>(
&memory_mapping,
data.as_ptr() as u64,
u64::MAX,
&bpf_loader::id(),
true,
)
.is_err());
assert!(translate_slice::<u8>(
&memory_mapping,
100 - 1,
data.len() as u64,
&bpf_loader::id(),
true,
)
.is_err());
// u64
let mut data = vec![1u64, 2, 3, 4, 5];
let addr = data.as_ptr() as *const _ as u64;
let memory_mapping = MemoryMapping::new::<UserError>(
vec![MemoryRegion {
host_addr: addr,
vm_addr: 96,
len: (data.len() * size_of::<u64>()) as u64,
vm_gap_shift: 63,
is_writable: false,
}],
&DEFAULT_CONFIG,
)
.unwrap();
let translated_data = translate_slice::<u64>(
&memory_mapping,
96,
data.len() as u64,
&bpf_loader::id(),
true,
)
.unwrap();
assert_eq!(data, translated_data);
data[0] = 10;
assert_eq!(data, translated_data);
assert!(
translate_slice::<u64>(&memory_mapping, 96, u64::MAX, &bpf_loader::id(), true,)
.is_err()
);
// Pubkeys
let mut data = vec![solana_sdk::pubkey::new_rand(); 5];
let addr = data.as_ptr() as *const _ as u64;
let memory_mapping = MemoryMapping::new::<UserError>(
vec![MemoryRegion {
host_addr: addr,
vm_addr: 100,
len: (data.len() * std::mem::size_of::<Pubkey>()) as u64,
vm_gap_shift: 63,
is_writable: false,
}],
&DEFAULT_CONFIG,
)
.unwrap();
let translated_data = translate_slice::<Pubkey>(
&memory_mapping,
100,
data.len() as u64,
&bpf_loader::id(),
true,
)
.unwrap();
assert_eq!(data, translated_data);
data[0] = solana_sdk::pubkey::new_rand(); // Both should point to same place
assert_eq!(data, translated_data);
} | rust_cleaned_test_functions.jsonl/16348 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2290
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66381,
26488,
368,
341,
286,
442,
7168,
2422,
198,
286,
1077,
1661,
1769,
284,
7486,
20703,
16,
84,
23,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
286,
1077,
821,
25,
11312,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bytes() {
let mut schema_builder = Schema::builder();
let field = schema_builder.add_bytes_field("bytesfield");
let schema = schema_builder.build();
let index = Index::create_in_ram(schema);
let mut index_writer = index.writer_with_num_threads(1, 3_000_000).unwrap();
index_writer.add_document(doc!(field=>vec![0u8, 1, 2, 3]));
index_writer.add_document(doc!(field=>vec![]));
index_writer.add_document(doc!(field=>vec![255u8]));
index_writer.add_document(doc!(field=>vec![1u8, 3, 5, 7, 9]));
index_writer.add_document(doc!(field=>vec![0u8; 1000]));
assert!(index_writer.commit().is_ok());
index.load_searchers().unwrap();
let searcher = index.searcher();
let reader = searcher.segment_reader(0);
let bytes_reader = reader.bytes_fast_field_reader(field).unwrap();
assert_eq!(bytes_reader.get_val(0), &[0u8, 1, 2, 3]);
assert!(bytes_reader.get_val(1).is_empty());
assert_eq!(bytes_reader.get_val(2), &[255u8]);
assert_eq!(bytes_reader.get_val(3), &[1u8, 3, 5, 7, 9]);
let long = vec![0u8; 1000];
assert_eq!(bytes_reader.get_val(4), long.as_slice());
} | rust_cleaned_test_functions.jsonl/71865 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 580
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12524,
368,
341,
286,
1077,
5206,
10802,
28532,
284,
12539,
486,
17850,
543,
286,
1077,
2070,
284,
10802,
28532,
1364,
12524,
5013,
445,
9651,
2566,
797,
286,
1077,
10802,
284,
10802,
28532,
13239,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_on_block_end() {
let contract_key = sp_core::Pair::from_seed(&Default::default());
let mut contracts = ContractsKeeper::default();
let mut keeper = ClusterKeeper::default();
let wasm_bin = pink::load_test_wasm("hooks_test");
let cluster_id = phala_mq::ContractClusterId(Default::default());
let effects = keeper
.instantiate_contract(
cluster_id,
Default::default(),
wasm_bin,
vec![0xed, 0x4b, 0x9d, 0x1b],
Default::default(),
&contract_key,
1,
1,
)
.unwrap();
insta::assert_debug_snapshot!(effects);
let cluster = keeper.get_cluster_mut(&cluster_id).unwrap();
let mut builder = BlockInfo::builder().block_number(1).now_ms(1);
let signer = sr25519::Pair::from_seed(&Default::default());
let egress = builder
.send_mq
.channel(MessageOrigin::Worker(Default::default()), signer.into());
let mut block_info = builder.build();
apply_pink_side_effects(
effects,
&cluster_id,
&mut contracts,
cluster,
&mut block_info,
&egress,
);
insta::assert_display_snapshot!(contracts.len());
let mut env = ExecuteEnv {
block: &mut block_info,
contract_clusters: &mut &mut keeper,
};
for contract in contracts.values_mut() {
let effects = contract.on_block_end(&mut env).unwrap();
insta::assert_debug_snapshot!(effects);
}
let messages: Vec<_> = builder
.send_mq
.all_messages()
.into_iter()
.map(|msg| (msg.sequence, msg.message))
.collect();
insta::assert_debug_snapshot!(messages);
} | rust_cleaned_test_functions.jsonl/117145 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 994
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4470,
7113,
6213,
368,
341,
286,
1077,
5116,
3097,
284,
978,
15467,
486,
12443,
486,
1499,
33809,
2099,
3675,
486,
2258,
1423,
286,
1077,
5206,
17080,
284,
70559,
77233,
486,
2258,
543,
286,
1077,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_bench_tps_fund_keys() {
let (genesis_config, id) = create_genesis_config(10_000);
let bank = Bank::new(&genesis_config);
let client = Arc::new(BankClient::new(bank));
let keypair_count = 20;
let lamports = 20;
let keypairs =
generate_and_fund_keypairs(client.clone(), None, &id, keypair_count, lamports).unwrap();
for kp in &keypairs {
assert_eq!(
client
.get_balance_with_commitment(&kp.pubkey(), CommitmentConfig::processed())
.unwrap(),
lamports
);
}
} | rust_cleaned_test_functions.jsonl/26222 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 343
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
19762,
528,
1690,
761,
1241,
12631,
368,
341,
286,
1077,
320,
77894,
5332,
11,
877,
8,
284,
1855,
16322,
13774,
5332,
7,
16,
15,
62,
15,
15,
15,
317,
286,
1077,
6073,
284,
8547,
486,
93... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_into_ascii_upper() {
assert_eq!(("url()URL()uRl()ürl".to_string()).into_ascii_upper(),
"URL()URL()URL()üRL".to_string());
assert_eq!(("hıKß".to_string()).into_ascii_upper(), "HıKß".to_string());
let mut i = 0;
while i <= 500 {
let upper = if 'a' as u32 <= i && i <= 'z' as u32 { i + 'A' as u32 - 'a' as u32 }
else { i };
assert_eq!((from_u32(i).unwrap()).to_string().into_ascii_upper(),
(from_u32(upper).unwrap()).to_string())
i += 1;
}
} | rust_cleaned_test_functions.jsonl/4339 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 354
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45514,
50238,
34445,
368,
341,
286,
2060,
10714,
10297,
445,
1085,
368,
3144,
368,
84,
49,
75,
368,
2391,
2381,
3263,
983,
3904,
6011,
18122,
50238,
34445,
3148,
4293,
330,
3144,
368,
3144,
368,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_accept() {
let text_plain = qitem(Mime(Text, Plain, vec![]));
let application_vendor = "application/vnd.github.v3.full+json; q=0.5".parse().unwrap();
let accept = Header::parse_header(&b"text/plain".as_ref().into());
assert_eq!(accept.ok(), Some(Accept(vec![text_plain.clone()])));
let bytevec = b"application/vnd.github.v3.full+json; q=0.5, text/plain".as_ref().into();
let accept = Header::parse_header(&bytevec);
assert_eq!(accept.ok(), Some(Accept(vec![application_vendor, text_plain])));
} | rust_cleaned_test_functions.jsonl/108094 | {
"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,
35728,
368,
341,
286,
1077,
1467,
41015,
284,
2804,
1203,
3189,
545,
34082,
11,
43199,
11,
7486,
0,
1294,
1106,
286,
1077,
3766,
58320,
284,
330,
5132,
42701,
11021,
3133,
18,
21534,
10,
2236,
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_from_polyline_open() {
let points = &[
point(1.0, 1.0),
point(3.0, 1.0),
point(4.0, 5.0),
point(5.0, 2.0),
];
let mut evts = FromPolyline::open(points.iter().cloned());
assert_eq!(
evts.next(),
Some(PathEvent::Begin {
at: point(1.0, 1.0)
})
);
assert_eq!(
evts.next(),
Some(PathEvent::Line {
from: point(1.0, 1.0),
to: point(3.0, 1.0)
})
);
assert_eq!(
evts.next(),
Some(PathEvent::Line {
from: point(3.0, 1.0),
to: point(4.0, 5.0)
})
);
assert_eq!(
evts.next(),
Some(PathEvent::Line {
from: point(4.0, 5.0),
to: point(5.0, 2.0)
})
);
assert_eq!(
evts.next(),
Some(PathEvent::End {
last: point(5.0, 2.0),
first: point(1.0, 1.0),
close: false
})
);
assert_eq!(evts.next(), None);
} | rust_cleaned_test_functions.jsonl/76329 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 634
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
36133,
1056,
11311,
368,
341,
262,
1077,
3501,
284,
609,
9640,
286,
1459,
7,
16,
13,
15,
11,
220,
16,
13,
15,
1326,
286,
1459,
7,
18,
13,
15,
11,
220,
16,
13,
15,
1326,
286,
1459,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_legacy_decorator() {
crate::test_parser(
"@foo
export default class Foo {
bar() {
class Baz {}
}
}",
Syntax::Es(EsConfig {
decorators: true,
decorators_before_export: true,
..Default::default()
}),
|p| p.parse_module(),
);
} | rust_cleaned_test_functions.jsonl/4187 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 210
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
97555,
87252,
368,
341,
286,
17717,
486,
1944,
18517,
1006,
310,
8428,
7975,
198,
1533,
1638,
536,
33428,
341,
220,
3619,
368,
341,
262,
536,
91711,
5613,
220,
456,
24375,
310,
32117,
486,
17360,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simplestorage() {
let mut state = BTreeMap::new();
state.insert(
H160::from_str("0xf000000000000000000000000000000000000000").unwrap(),
MemoryAccount {
nonce: U256::one(),
balance: U256::max_value(),
storage: BTreeMap::new(),
code: Vec::new(),
},
);
let vicinity = gen_vicinity();
let mut backend = MemoryBackend::new(&vicinity, state);
let executor = EvmExecutor::new();
// contract SimpleStorage {
// uint storedData;
// storedData = x;
// return storedData;
// simplestorage_create_code created from above solidity
let simplestorage_create_code = "608060405234801561001057600080fd5b5060df8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806360fe47b114604e5780636d4ce63c146078575b600080fd5b348015605957600080fd5b5060766004803603810190808035906020019092919050505060a0565b005b348015608357600080fd5b50608a60aa565b6040518082815260200191505060405180910390f35b8060008190555050565b600080549050905600a165627a7a7230582099c66a25d59f0aa78f7ebc40748fa1d1fbc335d8d780f284841b30e0365acd960029";
let mut tx = gen_tx(
H160::from_str("0xf000000000000000000000000000000000000000").unwrap(),
H160::from_str("0x1000000000000000000000000000000000000000").unwrap(),
0,
hex_decode(simplestorage_create_code).unwrap(),
);
tx.transaction.unsigned.action = TransactionAction::Create;
let r = executor.inner_exec(&mut backend, tx);
assert_eq!(r.exit_reason, ExitReason::Succeed(ExitSucceed::Returned));
assert!(r.ret.is_empty());
assert_eq!(r.remain_gas, 18446744073709450374);
// Thr created contract's address is
let tx = gen_tx(
H160::from_str("0xf000000000000000000000000000000000000000").unwrap(),
H160::from_str("0xc15d2ba57d126e6603240e89437efd419ce329d2").unwrap(),
0,
hex_decode("60fe47b1000000000000000000000000000000000000000000000000000000000000002a")
.unwrap(),
);
let r = executor.inner_exec(&mut backend, tx);
assert_eq!(r.exit_reason, ExitReason::Succeed(ExitSucceed::Stopped));
assert!(r.ret.is_empty());
assert_eq!(r.remain_gas, 18446744073709508106);
let tx = gen_tx(
H160::from_str("0xf000000000000000000000000000000000000000").unwrap(),
H160::from_str("0xc15d2ba57d126e6603240e89437efd419ce329d2").unwrap(),
0,
hex_decode("6d4ce63c").unwrap(),
);
let r = executor.inner_exec(&mut backend, tx);
assert_eq!(r.exit_reason, ExitReason::Succeed(ExitSucceed::Returned));
assert_eq!(r.ret, vec![
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 42
]);
assert_eq!(r.remain_gas, 18446744073709528227);
let executor = AxonExecutor::new();
let r = executor.call(
&mut backend,
H160::from_str("0xc15d2ba57d126e6603240e89437efd419ce329d2").unwrap(),
hex_decode("6d4ce63c").unwrap(),
);
assert_eq!(r.exit_reason, ExitReason::Succeed(ExitSucceed::Returned));
assert_eq!(r.ret, vec![
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 42
]);
} | rust_cleaned_test_functions.jsonl/935 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1582
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
16172,
368,
341,
262,
1077,
5206,
1584,
284,
425,
6533,
2227,
486,
931,
543,
262,
1584,
7030,
1006,
286,
472,
16,
21,
15,
486,
1499,
2895,
445,
15,
5848,
15,
15,
15,
15,
15,
15,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_gic() {
let hv = hypervisor::new().unwrap();
let vm = hv.create_vm().unwrap();
assert!(create_gic(&vm, 1).is_ok());
} | rust_cleaned_test_functions.jsonl/86069 | {
"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,
22747,
284,
9751,
31396,
486,
931,
1005,
15454,
543,
286,
1077,
10995,
284,
22747,
2520,
39008,
1005,
15454,
1428,
286,
2060,
10297,
3182,
1889,
292,
2099,
73... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_pull_request_response() {
let mut node_crds = Crds::default();
let entry = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost(
&Pubkey::new_rand(),
1,
)));
let node_pubkey = entry.label().pubkey();
let mut node = CrdsGossipPull::default();
node_crds.insert(entry, 0).unwrap();
let new = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost(
&Pubkey::new_rand(),
1,
)));
node_crds.insert(new, 0).unwrap();
let mut dest = CrdsGossipPull::default();
let mut dest_crds = Crds::default();
let new_id = Pubkey::new_rand();
let new = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost(
&new_id, 1,
)));
dest_crds.insert(new.clone(), 0).unwrap();
let same_key = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost(
&new_id, 0,
)));
assert_eq!(same_key.label(), new.label());
assert!(same_key.wallclock() < new.wallclock());
node_crds.insert(same_key.clone(), 0).unwrap();
assert_eq!(
node_crds
.lookup_versioned(&same_key.label())
.unwrap()
.local_timestamp,
0
);
let mut done = false;
for _ in 0..30 {
// there is a chance of a false positive with bloom filters
let req = node.new_pull_request(
&node_crds,
&node_pubkey,
0,
0,
&HashMap::new(),
PACKET_DATA_SIZE,
);
let (_, filters, caller) = req.unwrap();
let filters: Vec<_> = filters.into_iter().map(|f| (caller.clone(), f)).collect();
let mut rsp = dest.generate_pull_responses(&dest_crds, &filters, 0);
dest.process_pull_requests(&mut dest_crds, filters, 0);
// if there is a false positive this is empty
// prob should be around 0.1 per iteration
if rsp.is_empty() {
continue;
}
if rsp.is_empty() {
continue;
}
assert_eq!(rsp.len(), 1);
let failed = node
.process_pull_response(
&mut node_crds,
&node_pubkey,
&node.make_timeouts_def(&node_pubkey, &HashMap::new(), 0, 1),
rsp.pop().unwrap(),
1,
)
.0;
assert_eq!(failed, 0);
assert_eq!(
node_crds
.lookup_versioned(&new.label())
.unwrap()
.local_timestamp,
1
);
// verify that the whole record was updated for dest since this is a response from dest
assert_eq!(
node_crds
.lookup_versioned(&same_key.label())
.unwrap()
.local_timestamp,
1
);
done = true;
break;
}
assert!(done);
} | rust_cleaned_test_functions.jsonl/45201 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1861
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
65693,
7893,
9655,
368,
341,
286,
1077,
5206,
2436,
32331,
5356,
284,
4553,
5356,
486,
2258,
543,
286,
1077,
4343,
284,
4553,
5356,
1130,
486,
931,
67830,
3025,
81,
5356,
1043,
486,
8732,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_start_with_won() {
let mut trie = RadixTrie::<usize>::new();
let words = ["Won", "Wonder", "Wonderful", "World", "Axes"];
for word in &words {
trie.insert(word, word.len())
}
let res = trie.start_with("Won");
let expected: Vec<(String, &usize)> = vec![
("Won".into(), &3),
("Wonder".into(), &6),
("Wonderful".into(), &9),
];
assert_eq!(res, expected)
} | rust_cleaned_test_functions.jsonl/41232 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 261
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4906,
6615,
1670,
263,
368,
341,
286,
1077,
5206,
59067,
284,
20605,
941,
51,
7231,
27638,
51878,
6831,
931,
543,
286,
1077,
4244,
284,
4383,
75836,
497,
330,
61272,
497,
330,
61272,
1262,
497,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_path_buf() {
assert_eq!(
PathBufWrap::from_str("/test/.tt").map(|t| t.0),
Err(UriSegmentError::BadStart('.'))
);
assert_eq!(
PathBufWrap::from_str("/test/*tt").map(|t| t.0),
Err(UriSegmentError::BadStart('*'))
);
assert_eq!(
PathBufWrap::from_str("/test/tt:").map(|t| t.0),
Err(UriSegmentError::BadEnd(':'))
);
assert_eq!(
PathBufWrap::from_str("/test/tt<").map(|t| t.0),
Err(UriSegmentError::BadEnd('<'))
);
assert_eq!(
PathBufWrap::from_str("/test/tt>").map(|t| t.0),
Err(UriSegmentError::BadEnd('>'))
);
assert_eq!(
PathBufWrap::from_str("/seg1/seg2/").unwrap().0,
PathBuf::from_iter(vec!["seg1", "seg2"])
);
assert_eq!(
PathBufWrap::from_str("/seg1/../seg2/").unwrap().0,
PathBuf::from_iter(vec!["seg2"])
);
} | rust_cleaned_test_functions.jsonl/5777 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 626
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2638,
10363,
368,
341,
286,
2060,
10714,
33673,
310,
7933,
15064,
26787,
486,
1499,
2895,
4283,
1944,
11930,
5566,
1827,
2186,
22428,
83,
91,
259,
13,
15,
1326,
310,
15495,
52252,
21086,
1454,
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_suggestion_small_lexical_distance() {
assert_eq!(
suggestion_list("greenish".intern(), &["green".intern()], 5),
vec!["green".intern()]
);
assert_eq!(
suggestion_list("green".intern(), &["greenish".intern()], 5),
vec!["greenish".intern()]
);
} | rust_cleaned_test_functions.jsonl/83027 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 175
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
42116,
31966,
74547,
938,
19464,
368,
341,
286,
2060,
10714,
33673,
310,
23776,
2019,
445,
13250,
812,
3263,
55444,
1507,
609,
1183,
13250,
3263,
55444,
79558,
220,
20,
1326,
310,
7486,
0,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.