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_insert() {
let mutation = insert(
"Guild",
&["GuildId", "UserId", "UpdatedAt"],
&[&"1", &"2", &CommitTimestamp::new()],
);
match mutation.operation.unwrap() {
v1::mutation::Operation::Insert(mut w) => {
assert_eq!("Guild", w.table);
assert_eq!(3, w.values.pop().unwrap().values.len());
assert_eq!("UpdatedAt", w.columns.pop().unwrap());
assert_eq!("UserId", w.columns.pop().unwrap());
assert_eq!("GuildId", w.columns.pop().unwrap());
}
_ => panic!("invalid operation"),
}
} | rust_cleaned_test_functions.jsonl/132325 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 371
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
368,
341,
286,
1077,
26374,
284,
5656,
1006,
310,
330,
72574,
756,
310,
609,
1183,
72574,
764,
497,
330,
13504,
497,
330,
72279,
8097,
310,
44590,
5,
1,
16,
497,
609,
1,
17,
497,
609,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_switch_implies_cfg_test() {
rustc_span::create_default_session_globals_then(|| {
let matches = optgroups().parse(&["--test".to_string()]).unwrap();
let (sess, cfg) = mk_session(matches);
let cfg = build_configuration(&sess, to_crate_config(cfg));
assert!(cfg.contains(&(sym::test, None)));
});
} | rust_cleaned_test_functions.jsonl/100711 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 159
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27652,
21007,
550,
18343,
4452,
368,
341,
262,
23071,
66,
37382,
486,
3182,
9993,
12316,
58775,
68367,
79453,
341,
286,
1077,
9071,
284,
3387,
16753,
1005,
6400,
2099,
1183,
313,
1944,
3263,
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... | 2 |
#[test]
fn test_header_readwrite() {
let mut bytes: Vec<u8> = vec![0; 128];
let mut buffer = IntBuffer { index: 0 };
buffer.write_u32(234, &mut bytes);
buffer.write_u16(44, &mut bytes);
buffer.write_u8(99, &mut bytes);
buffer.write_u32(1, &mut bytes);
buffer.index = 0;
assert_eq!(234, buffer.read_u32(&bytes));
assert_eq!(44, buffer.read_u16(&bytes));
assert_eq!(99, buffer.read_u8(&bytes));
assert_eq!(1, buffer.read_u32(&bytes));
return;
} | rust_cleaned_test_functions.jsonl/95497 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 273
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8757,
6443,
4934,
368,
341,
286,
1077,
5206,
5820,
25,
11312,
34837,
23,
29,
284,
7486,
20703,
15,
26,
220,
16,
17,
23,
4821,
286,
1077,
5206,
4147,
284,
1333,
4095,
314,
1922,
25,
220,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iter_empty() {
let assr = Assembler::new(16);
let segments: Vec<_> = assr.iter_data(10).collect();
assert_eq!(segments, vec![]);
} | rust_cleaned_test_functions.jsonl/52017 | {
"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,
11723,
15124,
368,
341,
286,
1077,
1071,
81,
284,
1634,
35401,
486,
931,
7,
16,
21,
317,
286,
1077,
20632,
25,
11312,
32399,
29,
284,
1071,
81,
19471,
1769,
7,
16,
15,
568,
17384,
543,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_neq() {
cmp_bool!(
neq,
&[true, false, true, false],
&[true, true, false, false],
&[false, true, true, false]
);
} | rust_cleaned_test_functions.jsonl/34263 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13925,
80,
368,
341,
286,
26089,
22159,
33673,
310,
834,
80,
345,
310,
44590,
1866,
11,
895,
11,
830,
11,
895,
1259,
310,
44590,
1866,
11,
830,
11,
895,
11,
895,
1259,
310,
44590,
3849,
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 |
#[test]
fn test_vsock_basic_metrics() {
// Save the metrics values that we need tested.
let mut tx_packets_count = METRICS.vsock.tx_packets_count.count();
let mut rx_packets_count = METRICS.vsock.rx_packets_count.count();
let tx_bytes_count = METRICS.vsock.tx_bytes_count.count();
let rx_bytes_count = METRICS.vsock.rx_bytes_count.count();
let conns_added = METRICS.vsock.conns_added.count();
let conns_removed = METRICS.vsock.conns_removed.count();
// Create a basic connection.
let mut ctx = MuxerTestContext::new("vsock_basic_metrics");
let peer_port = 1025;
let (mut stream, local_port) = ctx.local_connect(peer_port);
// not been increased.
assert_eq!(METRICS.vsock.tx_bytes_count.count(), tx_bytes_count);
// Check that one packet was sent through the handshake.
assert_eq!(METRICS.vsock.tx_packets_count.count(), tx_packets_count + 1);
tx_packets_count = METRICS.vsock.tx_packets_count.count();
// Check that one packet was received through the handshake.
assert_eq!(METRICS.vsock.rx_packets_count.count(), rx_packets_count + 1);
rx_packets_count = METRICS.vsock.rx_packets_count.count();
// Check that a new connection was added.
assert_eq!(METRICS.vsock.conns_added.count(), conns_added + 1);
// Send some data from guest to host.
let data = [1, 2, 3, 4];
ctx.init_data_pkt(local_port, peer_port, &data);
ctx.send();
// Check that tx_bytes was incremented.
assert_eq!(
METRICS.vsock.tx_bytes_count.count(),
tx_bytes_count + data.len()
);
// Check that one packet was accounted for.
assert_eq!(METRICS.vsock.tx_packets_count.count(), tx_packets_count + 1);
// Send some data from the host to the guest.
let data = [1, 2, 3, 4, 5, 6];
stream.write_all(&data).unwrap();
ctx.notify_muxer();
ctx.recv();
// Check that a packet was received.
assert_eq!(METRICS.vsock.rx_packets_count.count(), rx_packets_count + 1);
// Check that the 6 bytes have been received.
assert_eq!(
METRICS.vsock.rx_bytes_count.count(),
rx_bytes_count + data.len()
);
// Send a connection reset.
ctx.init_pkt(local_port, peer_port, uapi::VSOCK_OP_RST);
ctx.send();
// Check that the connection was removed.
assert_eq!(METRICS.vsock.conns_removed.count(), conns_removed + 1);
} | rust_cleaned_test_functions.jsonl/37608 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
13199,
34729,
37686,
368,
341,
286,
442,
10255,
279,
16734,
2750,
429,
582,
1184,
12510,
624,
286,
1077,
5206,
9854,
63569,
3180,
284,
36822,
84172,
3133,
13199,
33807,
63569,
3180,
6501,
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_rainbow_highlighting() {
check_highlighting(
r#"
fn main() {
let hello = "hello";
let x = hello.to_string();
let y = hello.to_string();
let x = "other color please!";
let y = x.to_string();
}
fn bar() {
let mut hello = "hello";
}
"#
.trim(),
expect_file!["./test_data/rainbow_highlighting.html"],
true,
);
} | rust_cleaned_test_functions.jsonl/5120 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
466,
15439,
74546,
287,
368,
341,
262,
1779,
74546,
287,
1006,
286,
435,
2,
698,
8822,
1887,
368,
341,
262,
1077,
23811,
284,
330,
14990,
876,
262,
1077,
856,
284,
23811,
2389,
3904,
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_parse_java_version_redhat() {
let java_8 = "OpenJDK 64-Bit Server VM (25.222-b10) for linux-amd64 JRE (1.8.0_222-b10), built on Jul 11 2019 20:48:53 by \"root\" with gcc 7.3.1 20180303 (Red Hat 7.3.1-5)";
let java_12 = "OpenJDK 64-Bit Server VM (12.0.2+10) for linux-amd64 JRE (12.0.2+10), built on Jul 18 2019 14:41:47 by \"jenkins\" with gcc 7.3.1 20180303 (Red Hat 7.3.1-5)";
assert_eq!(parse_java_version(java_8), Some("1.8.0".to_string()));
assert_eq!(parse_java_version(java_12), Some("12.0.2".to_string()));
} | rust_cleaned_test_functions.jsonl/36218 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 270
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
77323,
9438,
26058,
9198,
368,
341,
286,
1077,
1642,
62,
23,
284,
330,
5002,
41,
18301,
220,
21,
19,
7671,
275,
8422,
17792,
320,
17,
20,
13,
17,
17,
17,
1455,
16,
15,
8,
369,
36245,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_8XYE() {
// 0x8XYE - Store the value of register VY shifted left one bit in register VX
// Set register VF to the most significant bit prior to the shift
// VY is unchanged
let opcode = 0x89AE;
let mut vm = get_vm();
// the most-significant bit of Vx is 0
vm.v[0xA] = 0x11;
vm.execute_instruction(decode_opcode(opcode), opcode);
assert_eq!(vm.v[0xF], 0x00);
assert_eq!(vm.v[0xA], 0x11);
assert_eq!(vm.v[0x9], 0x22);
// the most-significant bit of Vx is 1
vm.v[0xA] = 0x81;
vm.execute_instruction(decode_opcode(opcode), opcode);
assert_eq!(vm.v[0xA], 0x81);
assert_eq!(vm.v[0x9], 0x02);
assert_eq!(vm.v[0xF], 0x01);
} | rust_cleaned_test_functions.jsonl/256 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 349
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
23,
16356,
36,
368,
341,
262,
442,
220,
15,
87,
23,
16356,
36,
481,
9129,
279,
897,
315,
4161,
647,
56,
28973,
2115,
825,
2699,
304,
4161,
78177,
198,
262,
442,
286,
2573,
4161,
72892,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_inner_attribute_completion() {
check(
r"#![$0]",
expect![[r#"
at allow(…)
at automatically_derived
at cfg_attr(…)
at cfg(…)
at cold
at crate_name = ""
at deny(…)
at deprecated
at derive(…)
at export_name = "…"
at doc(alias = "…")
at doc = "…"
at doc(hidden)
at feature(…)
at forbid(…)
at global_allocator
at ignore = "…"
at inline
at link
at link_name = "…"
at link_section = "…"
at macro_export
at macro_use
at must_use
at no_link
at no_implicit_prelude
at no_main
at no_mangle
at no_std
at non_exhaustive
at panic_handler
at path = "…"
at proc_macro
at proc_macro_attribute
at proc_macro_derive(…)
at recursion_limit = …
at repr(…)
at should_panic
at target_feature = "…"
at test
at track_caller
at type_length_limit = …
at used
at warn(…)
at windows_subsystem = "…"
"#]],
);
} | rust_cleaned_test_functions.jsonl/38681 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1044
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34345,
16791,
60164,
368,
341,
286,
1779,
1006,
310,
435,
1,
8010,
3442,
15,
45016,
310,
1720,
0,
15505,
81,
2,
698,
394,
518,
2138,
7,
1940,
340,
394,
518,
9463,
35345,
2221,
198,
394,
518,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_request_cookies() {
let req = TestRequest::default()
.header(header::COOKIE, "cookie1=value1")
.header(header::COOKIE, "cookie2=value2")
.finish();
{
let cookies = req.cookies().unwrap();
assert_eq!(cookies.len(), 2);
assert_eq!(cookies[0].name(), "cookie1");
assert_eq!(cookies[0].value(), "value1");
assert_eq!(cookies[1].name(), "cookie2");
assert_eq!(cookies[1].value(), "value2");
}
let cookie = req.cookie("cookie1");
assert!(cookie.is_some());
let cookie = cookie.unwrap();
assert_eq!(cookie.name(), "cookie1");
assert_eq!(cookie.value(), "value1");
let cookie = req.cookie("cookie-unknown");
assert!(cookie.is_none());
} | rust_cleaned_test_functions.jsonl/30109 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 419
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7893,
94158,
368,
341,
286,
1077,
4232,
284,
3393,
1900,
486,
2258,
741,
310,
659,
2708,
25534,
486,
44796,
11,
330,
16236,
16,
46538,
16,
1138,
310,
659,
2708,
25534,
486,
44796,
11,
330,
16236... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_papapred() {
let full_input_file = "test_assets/PaPa_rates.txt";
let papa = PaPaPred::new(full_input_file, None).unwrap();
let rates = papa.rates("ACCGCCT").unwrap();
assert_eq!(rates.a, 6.0526200e-04);
assert_eq!(rates.c, 2.3540691e-05);
assert!(rates.g.is_nan());
assert_eq!(rates.t, 3.8108174e-05);
let rates = papa.rates("AGGCGGT").unwrap();
assert_eq!(rates.a, 3.8108174e-05);
assert!(rates.c.is_nan());
assert_eq!(rates.g, 2.3540691e-05);
assert_eq!(rates.t, 6.0526200e-04);
let rates = papa.rates("AAACAAA").unwrap();
assert_eq!(rates.a, 1.94144068e-05);
assert!(rates.c.is_nan());
assert_eq!(rates.g, 1.33842095e-05);
assert_eq!(rates.t, 3.95017705e-05);
let rates = papa.rates("AAACAAA").unwrap();
assert_eq!(rates.a, 1.94144068e-05);
assert!(rates.c.is_nan());
assert_eq!(rates.g, 1.33842095e-05);
assert_eq!(rates.t, 3.95017705e-05);
let rates = papa.rates("TCATTTT").unwrap();
assert_eq!(rates.a, 5.1615812e-06);
assert_eq!(rates.c, 2.6344846e-05);
assert_eq!(rates.g, 7.5895418e-06);
assert!(rates.t.is_nan());
let rates = papa.rates("TAGCTTA").unwrap();
assert_eq!(rates.a, 1.18828875e-05);
assert!(rates.c.is_nan());
assert_eq!(rates.g, 1.92736370e-05);
assert_eq!(rates.t, 5.04661366e-05);
let rates = papa.rates("GTCGTGC").unwrap();
assert_eq!(rates.a, 6.9644750e-04);
assert_eq!(rates.c, 2.0450439e-05);
assert!(rates.g.is_nan());
assert_eq!(rates.t, 1.7836264e-05);
let rates = papa.rates("GGTACTT").unwrap();
assert!(rates.a.is_nan());
assert_eq!(rates.c, 7.8399744e-06);
assert_eq!(rates.g, 3.8916667e-05);
assert_eq!(rates.t, 6.6361449e-06);
} | rust_cleaned_test_functions.jsonl/35939 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1054
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
391,
391,
1151,
368,
341,
286,
1077,
2480,
5898,
2458,
284,
330,
1944,
53299,
16341,
64,
20291,
55373,
3909,
876,
286,
1077,
281,
18321,
284,
15681,
20291,
50925,
486,
931,
28907,
5898,
2458,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eliminate() {
let two = scalar_from_u64::<Bls12>(2);
let three = scalar_from_u64::<Bls12>(3);
let four = scalar_from_u64::<Bls12>(4);
let five = scalar_from_u64::<Bls12>(5);
let six = scalar_from_u64::<Bls12>(6);
let seven = scalar_from_u64::<Bls12>(7);
let eight = scalar_from_u64::<Bls12>(8);
let m = vec![
vec![two, three, four],
vec![four, five, six],
vec![seven, eight, eight],
];
for i in 0..rows(&m) {
let mut shadow = make_identity::<Bls12>(columns(&m));
let res = eliminate::<Bls12>(&m, i, &mut shadow);
if i > 0 {
assert!(res.is_none());
continue;
} else {
assert!(res.is_some());
}
assert_eq!(
1,
res.unwrap()
.iter()
.filter(|&row| row[i] != <Bls12 as ScalarEngine>::Fr::zero())
.count()
);
}
} | rust_cleaned_test_functions.jsonl/102231 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 673
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84655,
3277,
368,
341,
1789,
286,
1077,
1378,
284,
17274,
5673,
7300,
21,
19,
27638,
33,
4730,
16,
17,
2235,
17,
317,
286,
1077,
2326,
284,
17274,
5673,
7300,
21,
19,
27638,
33,
4730,
16,
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... | 3 |
#[test]
fn test_transpose() {
let matrix = Matrix::new(&vec![vec![1.,2.,3.,4.,5.], vec![6.,7.,8.,9.,10.]]);
assert_eq!(Matrix::new(&vec![vec![1.,6.], vec![2.,7.], vec![3.,8.], vec![4.,9.], vec![5.,10.]]), transpose(&matrix));
} | rust_cleaned_test_functions.jsonl/52103 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 135
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7965,
2900,
368,
341,
286,
1077,
6172,
284,
11631,
486,
931,
2099,
4083,
20703,
4083,
20703,
16,
2572,
17,
2572,
18,
2572,
19,
2572,
20,
13,
1125,
7486,
20703,
21,
2572,
22,
2572,
23,
2572,
24... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mkdir_parent() {
cleanup(TEST_DIR4);
let prog = Command::new(EXE).arg("-p").arg(TEST_DIR4).status();
let exit_success = prog.unwrap().success();
cleanup(TEST_DIR4);
assert_eq!(exit_success, true);
} | rust_cleaned_test_functions.jsonl/32985 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 106
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
12438,
15960,
368,
341,
262,
21290,
50320,
8291,
19,
317,
262,
1077,
29271,
284,
7348,
486,
931,
25409,
36,
568,
858,
13645,
79,
1827,
858,
50320,
8291,
19,
568,
2829,
543,
262,
1077,
4869,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ignore_if_cursor_on_param() {
check_assist_not_applicable(
replace_derive_with_manual_impl,
r#"
//- minicore: derive, fmt
#[derive$0(Debug)]
struct Foo {}
"#,
);
check_assist_not_applicable(
replace_derive_with_manual_impl,
r#"
//- minicore: derive, fmt
#[derive(Debug)$0]
struct Foo {}
"#,
)
} | rust_cleaned_test_functions.jsonl/18001 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 242
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58493,
11119,
28601,
4470,
4090,
368,
341,
286,
1779,
12083,
380,
7913,
8191,
46114,
1006,
310,
8290,
35345,
533,
6615,
75428,
21007,
345,
310,
435,
2,
698,
61463,
1308,
292,
460,
25,
42430,
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_ranges_open_high() {
let ranges = ranges(&["3:", "2:5"]);
assert_eq!(RangeCheckResult::BeforeOrBetweenRanges, ranges.check(1));
assert_eq!(RangeCheckResult::InRange, ranges.check(3));
assert_eq!(RangeCheckResult::InRange, ranges.check(5));
assert_eq!(RangeCheckResult::InRange, ranges.check(9));
} | rust_cleaned_test_functions.jsonl/35933 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58748,
11311,
22680,
368,
341,
262,
1077,
21283,
284,
21283,
2099,
1183,
18,
12147,
330,
17,
25,
20,
55919,
262,
2060,
10714,
10297,
6046,
3973,
2077,
486,
10227,
2195,
25477,
74902,
11,
21283,
90... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_node_merge_transfer_leader() {
let mut cluster = new_node_cluster(0, 3);
configure_for_merge(&mut cluster);
cluster.cfg.raft_store.store_batch_system.max_batch_size = Some(1);
cluster.cfg.raft_store.store_batch_system.pool_size = 2;
let pd_client = Arc::clone(&cluster.pd_client);
pd_client.disable_default_operator();
cluster.run();
// To ensure the region has applied to its current term so that later `split` can success
let region = pd_client.get_region(b"k1").unwrap();
let peer_1 = find_peer(®ion, 1).unwrap().to_owned();
cluster.must_transfer_leader(region.get_id(), peer_1);
let k = b"k1_for_apply_to_current_term";
cluster.must_put(k, b"value");
must_get_equal(&cluster.get_engine(1), k, b"value");
cluster.must_split(®ion, b"k2");
cluster.must_put(b"k1", b"v1");
cluster.must_put(b"k3", b"v3");
let left = pd_client.get_region(b"k1").unwrap();
let right = pd_client.get_region(b"k2").unwrap();
let left_peer_1 = find_peer(&left, 1).unwrap().to_owned();
cluster.must_transfer_leader(left.get_id(), left_peer_1.clone());
let left_peer_3 = find_peer(&left, 3).unwrap().to_owned();
assert_eq!(left_peer_3.get_id(), 1003);
let schedule_merge_fp = "on_schedule_merge";
fail::cfg(schedule_merge_fp, "return()").unwrap();
cluster.must_try_merge(left.get_id(), right.get_id());
// Prevent peer 1003 to handle ready when it's leader
let before_handle_raft_ready_1003 = "before_handle_raft_ready_1003";
fail::cfg(before_handle_raft_ready_1003, "pause").unwrap();
let epoch = cluster.get_region_epoch(left.get_id());
let mut transfer_leader_req =
new_admin_request(left.get_id(), &epoch, new_transfer_leader_cmd(left_peer_3));
transfer_leader_req.mut_header().set_peer(left_peer_1);
cluster
.sim
.rl()
.async_command_on_node(1, transfer_leader_req, Callback::None)
.unwrap();
fail::remove(schedule_merge_fp);
pd_client.check_merged_timeout(left.get_id(), Duration::from_secs(5));
fail::remove(before_handle_raft_ready_1003);
sleep_ms(100);
cluster.must_put(b"k4", b"v4");
must_get_equal(&cluster.get_engine(3), b"k4", b"v4");
} | rust_cleaned_test_functions.jsonl/56286 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 949
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5084,
20888,
35403,
79991,
368,
341,
262,
1077,
5206,
10652,
284,
501,
5084,
28441,
7,
15,
11,
220,
18,
317,
262,
14411,
5478,
20888,
2099,
6984,
10652,
317,
262,
10652,
30481,
13,
2944,
14809,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cleanup() {
let storage = TestStorageBuilder::new().build().unwrap();
let (tx, rx) = channel();
storage
.async_prewrite(
Context::new(),
vec![Mutation::Put((Key::from_raw(b"x"), b"100".to_vec()))],
b"x".to_vec(),
100,
Options::default(),
expect_ok_callback(tx.clone(), 0),
)
.unwrap();
rx.recv().unwrap();
storage
.async_cleanup(
Context::new(),
Key::from_raw(b"x"),
100,
expect_ok_callback(tx.clone(), 1),
)
.unwrap();
rx.recv().unwrap();
expect_none(
storage
.async_get(Context::new(), Key::from_raw(b"x"), 105)
.wait(),
);
} | rust_cleaned_test_functions.jsonl/22311 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 549
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42444,
368,
341,
286,
1077,
5819,
284,
3393,
5793,
3297,
486,
931,
1005,
5834,
1005,
15454,
543,
286,
1077,
320,
3998,
11,
19111,
8,
284,
5496,
543,
286,
5819,
198,
310,
659,
7692,
620,
52473,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_deserialize_newtype_struct() {
let value = toml::toml! {
foo = "bar"
};
#[derive(Deserialize)]
struct NewtypeWrapper(String);
#[derive(Deserialize)]
struct Sample {
foo: NewtypeWrapper,
}
let deserializer = ValueDeserializer::new(&value);
let result = Sample::deserialize(deserializer).unwrap();
assert_eq!(result.foo.0, "bar".to_owned());
} | rust_cleaned_test_functions.jsonl/67384 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 234
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15768,
9050,
5921,
1313,
15126,
368,
341,
286,
1077,
897,
284,
311,
1014,
486,
37401,
75,
0,
341,
310,
15229,
284,
330,
2257,
698,
286,
3634,
286,
11506,
27098,
7,
64465,
5563,
286,
2036,
1532,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_array_windows_count() {
let v: &[i32] = &[0, 1, 2, 3, 4, 5];
let c = v.array_windows::<3>();
assert_eq!(c.count(), 4);
let v2: &[i32] = &[0, 1, 2, 3, 4];
let c2 = v2.array_windows::<6>();
assert_eq!(c2.count(), 0);
let v3: &[i32] = &[];
let c3 = v3.array_windows::<2>();
assert_eq!(c3.count(), 0);
let v4: &[()] = &[(); usize::MAX];
let c4 = v4.array_windows::<1>();
assert_eq!(c4.count(), usize::MAX);
} | rust_cleaned_test_functions.jsonl/9657 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 254
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
58220,
3180,
368,
341,
262,
1077,
348,
25,
44590,
72,
18,
17,
60,
284,
44590,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
262,
1077,
272,
284,
348,
72... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_date_time_utc() {
let 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 utc = Utc.from_utc_datetime(&dt);
db.execute("INSERT INTO foo (t) VALUES (?)", &[&utc])
.unwrap();
let s: String = db
.query_row("SELECT t FROM foo", NO_PARAMS, |r| r.get(0))
.unwrap();
assert_eq!("2016-02-23T23:56:04.789+00:00", s);
let v1: DateTime<Utc> = db
.query_row("SELECT t FROM foo", NO_PARAMS, |r| r.get(0))
.unwrap();
assert_eq!(utc, v1);
let v2: DateTime<Utc> = db
.query_row("SELECT '2016-02-23 23:56:04.789'", NO_PARAMS, |r| r.get(0))
.unwrap();
assert_eq!(utc, v2);
let v3: DateTime<Utc> = db
.query_row("SELECT '2016-02-23 23:56:04'", NO_PARAMS, |r| r.get(0))
.unwrap();
assert_eq!(utc - Duration::milliseconds(789), v3);
let v4: DateTime<Utc> = db
.query_row("SELECT '2016-02-23 23:56:04.789+00:00'", NO_PARAMS, |r| {
r.get(0)
})
.unwrap();
assert_eq!(utc, v4);
} | rust_cleaned_test_functions.jsonl/15052 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 732
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4164,
3009,
84259,
368,
341,
286,
1077,
2927,
284,
10067,
19195,
10630,
543,
286,
1077,
2400,
284,
12812,
533,
1916,
486,
1499,
62,
1600,
67,
7,
17,
15,
16,
21,
11,
220,
17,
11,
220,
17,
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_non_blocking_unix_metric_sink() {
let harness = UnixServerHarness::new("test_non_blocking_unix_metric_sink");
harness.run_quiet(|path| {
let socket = UnixDatagram::unbound().unwrap();
socket.set_nonblocking(true).unwrap();
let sink = UnixMetricSink::from(path, socket);
assert_eq!(7, sink.emit("baz:1|m").unwrap());
});
} | rust_cleaned_test_functions.jsonl/25611 | {
"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,
21637,
91449,
80572,
41294,
51567,
368,
341,
286,
1077,
32408,
284,
46995,
5475,
74248,
486,
931,
445,
1944,
21637,
91449,
80572,
41294,
51567,
3071,
286,
32408,
7634,
11280,
3891,
22428,
2343,
91,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_trailing_separator() {
new_ucmd!()
.args(&["-t", "x", "-k", "1,1"])
.pipe_in("aax\naaa\n")
.succeeds()
.stdout_is("aax\naaa\n");
} | rust_cleaned_test_functions.jsonl/20530 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3547,
14277,
58204,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
12,
83,
497,
330,
87,
497,
6523,
74,
497,
330,
16,
11,
16,
14108,
286,
659,
13768,
1243,
445,
64,
706... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dynamic_width_number_display_numeric_decimal() {
fn num(n: usize) -> Number {
let mut number = Number::DynamicWidth(DynamicWidthNumber::new(10));
for _ in 0..n {
number.increment().unwrap();
}
number
}
assert_eq!(format!("{}", num(0)), "00");
assert_eq!(format!("{}", num(9)), "09");
assert_eq!(format!("{}", num(17)), "17");
assert_eq!(format!("{}", num(10 * 9 - 1)), "89");
assert_eq!(format!("{}", num(10 * 9)), "9000");
assert_eq!(format!("{}", num(10 * 9 + 1)), "9001");
assert_eq!(format!("{}", num(10 * 99 - 1)), "9899");
assert_eq!(format!("{}", num(10 * 99)), "990000");
assert_eq!(format!("{}", num(10 * 99 + 1)), "990001");
} | rust_cleaned_test_functions.jsonl/51163 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 420
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45992,
7927,
5500,
14825,
29418,
74429,
368,
341,
286,
5168,
1629,
1445,
25,
22301,
8,
1464,
5624,
341,
310,
1077,
5206,
1372,
284,
5624,
486,
21752,
3327,
5432,
5040,
3327,
2833,
486,
931,
7,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_deletes_words() {
assert!(get_blank_search().append_search_string("").delete_word().get_query().as_slice() == "");
assert!(get_blank_search().append_search_string("a").delete_word().get_query().as_slice() == "");
assert!(get_blank_search().append_search_string("a ").delete_word().get_query().as_slice() == "");
assert!(get_blank_search().append_search_string("a b").delete_word().get_query().as_slice() == "a ");
assert!(get_blank_search().append_search_string("a b ").delete_word().get_query().as_slice() == "a ");
assert!(get_blank_search().append_search_string(" a b").delete_word().get_query().as_slice() == " a ");
} | rust_cleaned_test_functions.jsonl/96109 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 275
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2259,
13881,
18981,
368,
341,
286,
2060,
10297,
455,
56103,
10716,
1005,
5090,
10716,
3904,
80821,
4542,
13533,
1005,
455,
5738,
1005,
300,
26488,
368,
621,
14498,
286,
2060,
10297,
455,
56103,
1071... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fmt_temporal() {
let s = Int32Chunked::new("Date", &[Some(1), None, Some(3)]).into_date();
assert_eq!(
r#"shape: (3,)
Series: 'Date' [date]
[
1970-01-02
null
1970-01-04
]"#,
format!("{:?}", s.into_series())
);
let s = Int64Chunked::new("", &[Some(1), None, Some(1_000_000_000_000)])
.into_datetime(TimeUnit::Nanoseconds, None);
assert_eq!(
r#"shape: (3,)
Series: '' [datetime[ns]]
[
1970-01-01 00:00:00.000000001
null
1970-01-01 00:16:40
]"#,
format!("{:?}", s.into_series())
);
} | rust_cleaned_test_functions.jsonl/4392 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 348
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38128,
11771,
9819,
368,
341,
286,
1077,
274,
284,
1333,
18,
17,
28304,
291,
486,
931,
445,
1916,
497,
44590,
8373,
7,
16,
701,
2240,
11,
4329,
7,
18,
7252,
568,
18122,
4164,
543,
286,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_for_verify_false_positive() {
// https://github.com/enarx/enarx/issues/520
let naples_cek = sev::Certificate::decode(&mut &naples::CEK[..], ()).unwrap();
let rome_ask = ca::Certificate::decode(&mut &builtin::rome::ASK[..], ()).unwrap();
assert!((&rome_ask, &naples_cek).verify().is_err());
} | rust_cleaned_test_functions.jsonl/84101 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5478,
35638,
36015,
54160,
368,
341,
262,
442,
3703,
1110,
5204,
905,
13606,
277,
87,
13606,
277,
87,
38745,
14,
20,
17,
15,
198,
262,
1077,
25859,
642,
62,
45700,
284,
511,
85,
486,
33202,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_loop_backedges_none() {
let mir_body = goto_switchint();
let basic_coverage_blocks = graph::CoverageGraph::from_mir(&mir_body);
if false {
eprintln!(
"basic_coverage_blocks = {:?}",
basic_coverage_blocks.iter_enumerated().collect::<Vec<_>>()
);
eprintln!("successors = {:?}", basic_coverage_blocks.successors);
}
let backedges = graph::find_loop_backedges(&basic_coverage_blocks);
assert_eq!(
backedges.iter_enumerated().map(|(_bcb, backedges)| backedges.len()).sum::<usize>(),
0,
"backedges: {:?}",
backedges
);
} | rust_cleaned_test_functions.jsonl/68933 | {
"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,
21814,
17198,
3895,
16900,
31488,
368,
341,
262,
1077,
8652,
14114,
284,
7986,
27652,
396,
543,
262,
1077,
6770,
73384,
25201,
284,
4771,
486,
66312,
11212,
486,
1499,
717,
404,
2099,
19936,
14114,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_estimate() {
assert_eq!(2048, estimate_bit_size(2048));
assert_eq!(2048, estimate_bit_size(2047));
} | rust_cleaned_test_functions.jsonl/43391 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 73
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
78718,
368,
341,
286,
2060,
10714,
10297,
17,
15,
19,
23,
11,
16045,
13996,
2368,
7,
17,
15,
19,
23,
1106,
286,
2060,
10714,
10297,
17,
15,
19,
23,
11,
16045,
13996,
2368,
7,
17,
15,
19,
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 |
#[test]
fn test_module_no_double_free() {
let _module = {
let context = Context::create();
context.create_module("my_mod")
};
// Context will live on in the module until here
} | rust_cleaned_test_functions.jsonl/63540 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 86
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10750,
6536,
24598,
8905,
368,
341,
262,
1077,
716,
4352,
284,
341,
286,
1077,
2266,
284,
9608,
486,
3182,
1428,
286,
2266,
2520,
10750,
445,
2408,
7480,
1138,
262,
3634,
262,
442,
9608,
686,
38... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_object_and_string_to_repo() {
let json = r#"[{"dam": ["dam1","dam2"]}, "website"]"#;
let repos: Repos = new(json).unwrap();
assert_eq!(repos, vec![
Repo{ repo_type: RepoType::Dam, sites: Some(vec!["dam1".to_string(), "dam2".to_string()]) },
Repo{ repo_type: RepoType::Website, sites: None },
]);
} | rust_cleaned_test_functions.jsonl/71247 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 192
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5314,
8378,
3904,
2346,
37784,
368,
341,
286,
1077,
2951,
284,
435,
2,
36864,
4913,
15408,
788,
4383,
15408,
16,
2198,
15408,
17,
1341,
2137,
330,
19485,
1341,
57676,
280,
286,
1077,
45774,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_typedef_to_up_in_fn_call() {
let hdr = indoc! {"
#include <string>
#include <memory>
typedef std::unique_ptr<std::string> my_string;
inline uint32_t take_str(my_string a) {
return a->size();
}
"};
let rs = quote! {
use ffi::ToCppString;
assert_eq!(ffi::take_str("hello".into_cpp()), 5);
};
run_test("", hdr, rs, &["take_str"], &[]);
} | rust_cleaned_test_functions.jsonl/9862 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 232
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42111,
4219,
2346,
8237,
1243,
15246,
13429,
368,
341,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
286,
671,
997,
366,
917,
397,
286,
671,
997,
366,
17269,
397,
286,
13501,
1460,
486,
9587,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_simple_fragment() {
let did: DID = DID::parse("did:example:123456#public-key-1").unwrap();
assert_eq!(did.method(), "example");
assert_eq!(did.method_id(), "123456");
assert_eq!(did.path(), "");
assert_eq!(did.query(), None);
assert_eq!(did.fragment(), Some("public-key-1"));
} | rust_cleaned_test_functions.jsonl/93406 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 131
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
30015,
43012,
368,
341,
220,
1077,
1521,
25,
59119,
284,
59119,
486,
6400,
445,
22920,
25,
8687,
25,
16,
17,
18,
19,
20,
21,
2,
888,
16173,
12,
16,
1827,
15454,
543,
220,
2060,
10714,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_poh_recorder_record_at_min_passes() {
let ledger_path = get_tmp_ledger_path!();
{
let blockstore = Blockstore::open(&ledger_path)
.expect("Expected to be able to open database ledger");
let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(2);
let bank0 = Arc::new(Bank::new_for_tests(&genesis_config));
let prev_hash = bank0.last_blockhash();
let (mut poh_recorder, entry_receiver, _record_receiver) = PohRecorder::new(
0,
prev_hash,
bank0.clone(),
Some((4, 4)),
bank0.ticks_per_slot(),
&Pubkey::default(),
&Arc::new(blockstore),
&Arc::new(LeaderScheduleCache::new_from_bank(&bank0)),
&Arc::new(PohConfig::default()),
Arc::new(AtomicBool::default()),
);
bank0.fill_bank_with_ticks();
let bank1 = Arc::new(Bank::new_from_parent(&bank0, &Pubkey::default(), 1));
poh_recorder.set_bank(&bank1);
// Record up to exactly min tick height
let min_tick_height = poh_recorder.working_bank.as_ref().unwrap().min_tick_height;
while poh_recorder.tick_height() < min_tick_height {
poh_recorder.tick();
}
assert_eq!(poh_recorder.tick_cache.len() as u64, min_tick_height);
// Check record succeeds on boundary condition where
assert_eq!(poh_recorder.tick_height, min_tick_height);
let tx = test_tx();
let h1 = hash(b"hello world!");
assert!(poh_recorder
.record(bank1.slot(), h1, vec![tx.into()])
.is_ok());
assert_eq!(poh_recorder.tick_cache.len(), 0);
//tick in the cache + entry
for _ in 0..min_tick_height {
let (_bank, (e, _tick_height)) = entry_receiver.recv().unwrap();
assert!(e.is_tick());
}
let (_bank, (e, _tick_height)) = entry_receiver.recv().unwrap();
assert!(!e.is_tick());
}
Blockstore::destroy(&ledger_path).unwrap();
} | rust_cleaned_test_functions.jsonl/106266 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1191
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
2267,
7080,
1358,
14192,
3752,
7260,
15464,
288,
368,
341,
286,
1077,
46933,
2638,
284,
633,
16125,
38367,
1389,
2638,
0,
543,
286,
341,
310,
1077,
2504,
4314,
284,
8362,
4314,
486,
2508,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_delete_node_fails_if_not_authorized() {
ExternalityBuilder::build().execute_with(|| {
create_twin();
create_twin_bob();
create_farm();
create_node();
assert_noop!(
TfgridModule::delete_node_farm(Origin::signed(bob()), 1),
Error::<TestRuntime>::FarmerNotAuthorized
);
});
} | rust_cleaned_test_functions.jsonl/35350 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11353,
5084,
761,
6209,
11119,
7913,
62,
19084,
368,
341,
262,
1374,
4160,
2719,
3297,
486,
5834,
1005,
10257,
6615,
79453,
341,
286,
1855,
528,
7526,
543,
286,
1855,
528,
7526,
880,
674,
543,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_assign_from_slice() {
fn check(slice: &[BigDigit], data: &[BigDigit]) {
let mut p = BigUint::from_slice(&[2627_u32, 0_u32, 9182_u32, 42_u32]);
p.assign_from_slice(slice);
assert!(p.data == data);
}
check(&[1], &[1]);
check(&[0, 0, 0], &[]);
check(&[1, 2, 0, 0], &[1, 2]);
check(&[0, 0, 1, 2], &[0, 0, 1, 2]);
check(&[0, 0, 1, 2, 0, 0], &[0, 0, 1, 2]);
check(&[-1i32 as BigDigit], &[-1i32 as BigDigit]);
} | rust_cleaned_test_functions.jsonl/106398 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 263
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20688,
5673,
26488,
368,
341,
262,
5168,
1779,
75282,
25,
44590,
15636,
36420,
1125,
821,
25,
44590,
15636,
36420,
2467,
341,
286,
1077,
5206,
281,
284,
6164,
21570,
486,
1499,
26488,
2099,
58,
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_external_word() {
let _ = pretty_env_logger::try_init();
equal_tokens!(
"cargo +nightly run" ->
b::pipeline(vec![vec![
b::bare("cargo"),
b::sp(),
b::external_word("+nightly"),
b::sp(),
b::bare("run")
]])
);
equal_tokens!(
"rm foo%bar" ->
b::pipeline(vec![vec![
b::bare("rm"), b::sp(), b::external_word("foo%bar")
]])
);
equal_tokens!(
"rm foo%bar" ->
b::pipeline(vec![vec![
b::bare("rm"), b::sp(), b::external_word("foo%bar"),
]])
);
} | rust_cleaned_test_functions.jsonl/5872 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 474
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47432,
13533,
368,
341,
286,
1077,
716,
284,
5020,
15879,
27413,
486,
1539,
6137,
1428,
286,
6144,
28838,
33673,
310,
330,
66715,
488,
9287,
398,
1598,
1,
12381,
310,
293,
486,
51258,
25592,
20703... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cp_reflink_always() {
let (at, mut ucmd) = at_and_ucmd!();
let result = ucmd
.arg("--reflink=always")
.arg(TEST_HELLO_WORLD_SOURCE)
.arg(TEST_EXISTING_FILE)
.run();
if result.succeeded() {
// Check the content of the destination file
assert_eq!(at.read(TEST_EXISTING_FILE), "Hello, World!\n");
} else {
// Older Linux versions do not support cloning.
}
} | rust_cleaned_test_functions.jsonl/21276 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 219
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39811,
7793,
2080,
8418,
2284,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
1077,
1102,
284,
575,
8710,
198,
286,
659,
858,
21549,
1097,
208... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_last_expr() {
let rules = create_rules(
r#"
macro_rules! vec {
($($item:expr),*) => {
{
let mut v = Vec::new();
$(
v.push($item);
)*
v
}
};
}
"#,
);
assert_expansion(
MacroKind::Items,
&rules,
"vec!(1,2,3);",
"{let mut v = Vec :: new () ; v . push (1) ; v . push (2) ; v . push (3) ; v}",
);
} | rust_cleaned_test_functions.jsonl/14713 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 364
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12195,
21915,
368,
341,
262,
1077,
5601,
284,
1855,
21407,
1006,
286,
435,
2,
698,
286,
18072,
21407,
0,
7486,
341,
310,
1711,
699,
1203,
96011,
701,
3764,
589,
341,
394,
341,
503,
1077,
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... | 1 |
#[test]
fn test_fixed_size_binary_offsets() {
// Test the case where offset != 0
let a = create_fixed_size_binary_array(&[
Some(b"hello"),
None,
None,
Some(b"world"),
None,
None,
]);
let b = create_fixed_size_binary_array(&[
Some(b"hello"),
None,
None,
Some(b"arrow"),
None,
None,
]);
let a_slice = a.slice(0, 3);
let b_slice = b.slice(0, 3);
test_equal(&a_slice, &b_slice, true);
let a_slice = a.slice(0, 5);
let b_slice = b.slice(0, 5);
test_equal(&a_slice, &b_slice, false);
let a_slice = a.slice(4, 1);
let b_slice = b.slice(4, 1);
test_equal(&a_slice, &b_slice, true);
let a_slice = a.slice(3, 1);
let b_slice = b.slice(3, 1);
test_equal(&a_slice, &b_slice, false);
} | rust_cleaned_test_functions.jsonl/24221 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 553
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37839,
2368,
31761,
56924,
368,
341,
286,
442,
3393,
279,
1142,
1380,
4347,
961,
220,
15,
198,
286,
1077,
264,
284,
1855,
37839,
2368,
31761,
3858,
2099,
9640,
310,
4329,
1883,
1,
14990,
4461,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_array_sum() {
let c: Result<Color, _> = [-1, 255, 255].try_into();
assert_eq!(c, Err(IntoColorError::IntConversion));
} | rust_cleaned_test_functions.jsonl/758 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 79
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
10160,
368,
341,
286,
1077,
272,
25,
5714,
88827,
11,
716,
29,
284,
10055,
16,
11,
220,
17,
20,
20,
11,
220,
17,
20,
20,
936,
1539,
45514,
543,
286,
2060,
10714,
10297,
66,
11,
15495,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_round_trip_non_ascii_password() {
let keyring = Keyring::new(TEST_SERVICE, TEST_USER);
keyring.set_password(TEST_NON_ASCII_PASSWORD).unwrap();
let stored_password = keyring.get_password().unwrap();
assert_eq!(stored_password, TEST_NON_ASCII_PASSWORD);
keyring.delete_password().unwrap();
} | rust_cleaned_test_functions.jsonl/99049 | {
"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,
29896,
63883,
21637,
50238,
10122,
368,
341,
286,
1077,
1376,
12640,
284,
5309,
12640,
486,
931,
50320,
21590,
11,
13602,
9107,
626,
286,
1376,
12640,
980,
10122,
50320,
22128,
98924,
23059,
568,
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_hash_internal_state_genesis() {
let bank0 = Bank::new(&GenesisBlock::new(10).0);
let bank1 = Bank::new(&GenesisBlock::new(20).0);
assert_ne!(bank0.hash_internal_state(), bank1.hash_internal_state());
} | rust_cleaned_test_functions.jsonl/41901 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
23472,
4387,
16322,
13774,
368,
341,
286,
1077,
6073,
15,
284,
8547,
486,
931,
2099,
84652,
4713,
486,
931,
7,
16,
15,
568,
15,
317,
286,
1077,
6073,
16,
284,
8547,
486,
931,
2099,
84652... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_generate_random_wallet_mainnet_no_entropy() {
let out_dir = std::env::var("OUT_DIR").unwrap();
let mut jscontext = JavaScript::new(format!("{}/xpring.js", out_dir))?;
let wallet = generate_random(&mut jscontext, None, false).unwrap();
assert!(!wallet.mnemonic.is_empty());
assert!(!wallet.wallet.address.unwrap().is_empty());
} | rust_cleaned_test_functions.jsonl/118734 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48851,
22644,
62308,
11027,
4711,
6536,
50374,
368,
341,
286,
1077,
700,
4334,
284,
1460,
486,
3160,
486,
947,
445,
3656,
8291,
1827,
15454,
543,
286,
1077,
5206,
6994,
2147,
284,
12914,
486,
931,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_nested_scope_with_variable_segment() {
let app = App::new()
.scope("/app", |scope| {
scope.nested("/{project_id}", |scope| {
scope.resource("/path1", |r| {
r.f(|r| {
HttpResponse::Created().body(format!(
"project: {}",
&r.match_info()["project_id"]
))
})
})
})
})
.finish();
let req = TestRequest::with_uri("/app/project_1/path1").request();
let resp = app.run(req);
assert_eq!(resp.as_msg().status(), StatusCode::CREATED);
match resp.as_msg().body() {
&Body::Binary(ref b) => {
let bytes: Bytes = b.clone().into();
assert_eq!(bytes, Bytes::from_static(b"project: project_1"));
}
_ => panic!(),
}
} | rust_cleaned_test_functions.jsonl/22453 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 627
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66279,
23199,
6615,
14635,
28061,
368,
341,
286,
1077,
906,
284,
1845,
486,
931,
741,
310,
659,
4186,
4283,
676,
497,
760,
4186,
91,
341,
394,
6891,
1253,
9980,
65871,
4987,
842,
9545,
760,
4186... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_fq2_doubling() {
use super::fq::FqRepr;
use PrimeField;
let mut a = Fq2 {
c0: Fq::from_repr(FqRepr([
0x2d0078036923ffc7,
0x11e59ea221a3b6d2,
0x8b1a52e0a90f59ed,
0xb966ce3bc2108b13,
0xccc649c4b9532bf3,
0xf8d295b2ded9dc,
])).unwrap(),
c1: Fq::from_repr(FqRepr([
0x977df6efcdaee0db,
0x946ae52d684fa7ed,
0xbe203411c66fb3a5,
0xb3f8afc0ee248cad,
0x4e464dea5bcfd41e,
0x12d1137b8a6a837,
])).unwrap(),
};
a.double();
assert_eq!(
a,
Fq2 {
c0: Fq::from_repr(FqRepr([
0x5a00f006d247ff8e,
0x23cb3d4443476da4,
0x1634a5c1521eb3da,
0x72cd9c7784211627,
0x998c938972a657e7,
0x1f1a52b65bdb3b9
])).unwrap(),
c1: Fq::from_repr(FqRepr([
0x2efbeddf9b5dc1b6,
0x28d5ca5ad09f4fdb,
0x7c4068238cdf674b,
0x67f15f81dc49195b,
0x9c8c9bd4b79fa83d,
0x25a226f714d506e
])).unwrap(),
}
);
} | rust_cleaned_test_functions.jsonl/130069 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 926
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
80,
17,
814,
283,
9695,
368,
341,
262,
990,
2256,
486,
63919,
486,
37,
80,
693,
649,
280,
262,
990,
12518,
1877,
401,
262,
1077,
5206,
264,
284,
434,
80,
17,
341,
286,
272,
15,
25,
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_cascading_in_lines() {
test(
"var XXX = 4; function f() { var YYY = XXX; bar(YYY); baz(YYY); }",
"var XXX = 4; function f() { var YYY = XXX; bar(YYY); baz(YYY); }",
);
} | rust_cleaned_test_functions.jsonl/27659 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
5061,
2228,
1243,
18323,
368,
341,
262,
1273,
1006,
286,
330,
947,
19975,
284,
220,
19,
26,
220,
729,
282,
368,
314,
762,
809,
10060,
284,
19975,
26,
3619,
7,
52309,
1215,
50247,
7,
52309... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vld1q_s8() {
unsafe {
let a: [i8; 16] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16];
let e = transmute(a);
let r = vld1q_s8(transmute(&a));
assert!(cmp_arm(r, e));
}
} | rust_cleaned_test_functions.jsonl/33015 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 174
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
507,
16,
80,
643,
23,
368,
341,
286,
19860,
341,
310,
1077,
264,
25,
508,
72,
23,
26,
220,
16,
21,
60,
284,
508,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_proof_empty_trie() {
let mut memdb = MemoryDB::new(true);
let mut trie = PatriciaTrieMut::new(&mut memdb);
trie.root().unwrap();
let proof = trie.get_proof(b"not-exist").unwrap();
assert_eq!(proof.len(), 0);
} | rust_cleaned_test_functions.jsonl/37146 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
86757,
15124,
3547,
645,
368,
341,
262,
1077,
5206,
1833,
1999,
284,
13850,
3506,
486,
931,
3715,
317,
262,
1077,
5206,
59067,
284,
53934,
51,
7231,
51440,
486,
931,
2099,
6984,
1833,
1999,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_early_return() {
let span = span::mock().named("err_early_return");
let (subscriber, handle) = collector::mock()
.new_span(span.clone())
.enter(span.clone())
.event(event::mock().at_level(Level::ERROR))
.exit(span.clone())
.drop_span(span)
.done()
.run_with_handle();
with_default(subscriber, || err_early_return().ok());
handle.assert_finished();
} | rust_cleaned_test_functions.jsonl/3564 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 202
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
22140,
12511,
368,
341,
262,
1077,
9390,
284,
9390,
486,
16712,
1005,
30245,
445,
615,
62,
22140,
12511,
797,
262,
1077,
320,
59205,
11,
3705,
8,
284,
31953,
486,
16712,
741,
286,
659,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_tag_id_downcast_mut() {
let mut tag = DummyTag::new(132, 1);
let t: &mut dyn ILTag = &mut tag;
match tag_id_downcast_mut::<DummyTag>(132, t) {
Ok(v) => {
v.set_dummy(1234);
assert_eq!(1234, v.get_dummy())
}
_ => panic!(),
}
match tag_id_downcast_mut::<DummyTag>(12, t) {
Err(ErrorKind::UnexpectedTagType) => (),
_ => panic!(),
}
} | rust_cleaned_test_functions.jsonl/25696 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 237
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9372,
842,
13998,
3829,
29523,
368,
341,
262,
1077,
5206,
4772,
284,
50567,
5668,
486,
931,
7,
16,
18,
17,
11,
220,
16,
317,
262,
1077,
259,
25,
609,
6984,
31070,
11344,
5668,
284,
609,
6984,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_capabilities() {
assert_eq!(
p2p::types::Capabilities::from_bits_truncate(0b00000000 as u32),
p2p::types::Capabilities::UNKNOWN
);
assert_eq!(
p2p::types::Capabilities::from_bits_truncate(0b10000000 as u32),
p2p::types::Capabilities::UNKNOWN
);
assert_eq!(
p2p::types::Capabilities::from_bits_truncate(0b1111 as u32),
p2p::types::Capabilities::FULL_NODE
);
assert_eq!(
p2p::types::Capabilities::from_bits_truncate(0b00001111 as u32),
p2p::types::Capabilities::FULL_NODE
);
assert_eq!(
p2p::types::Capabilities::from_bits_truncate(0b11111111 as u32),
p2p::types::Capabilities::FULL_NODE
);
assert_eq!(
p2p::types::Capabilities::from_bits_truncate(0b00101111 as u32),
p2p::types::Capabilities::FULL_NODE
);
assert!(
p2p::types::Capabilities::from_bits_truncate(0b00101111 as u32)
.contains(p2p::types::Capabilities::FULL_NODE)
);
assert!(
p2p::types::Capabilities::from_bits_truncate(0b00101111 as u32)
.contains(p2p::types::Capabilities::TX_KERNEL_HASH)
);
} | rust_cleaned_test_functions.jsonl/18873 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 466
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
92092,
368,
341,
6948,
10714,
33673,
197,
3223,
17,
79,
486,
9242,
486,
55315,
486,
1499,
20034,
3547,
26900,
7,
15,
65,
15,
15,
15,
15,
15,
15,
15,
15,
438,
575,
18,
17,
1326,
197,
3223,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decimal_as_string() {
test_none_with_ctx_and_extra(cast_any_as_string::<Decimal>);
let cs: Vec<(Decimal, Vec<u8>, String)> = vec![
(
Decimal::from(i64::MAX),
i64::MAX.to_string().into_bytes(),
i64::MAX.to_string(),
),
(
Decimal::from(i64::MIN),
i64::MIN.to_string().into_bytes(),
i64::MIN.to_string(),
),
(
Decimal::from(u64::MAX),
u64::MAX.to_string().into_bytes(),
u64::MAX.to_string(),
),
(
Decimal::from_f64(0.0).unwrap(),
0.0.to_string().into_bytes(),
0.0.to_string(),
),
(
Decimal::from_f64(i64::MAX as f64).unwrap(),
(i64::MAX as f64).to_string().into_bytes(),
(i64::MAX as f64).to_string(),
),
(
Decimal::from_f64(i64::MIN as f64).unwrap(),
(i64::MIN as f64).to_string().into_bytes(),
(i64::MIN as f64).to_string(),
),
(
Decimal::from_f64(u64::MAX as f64).unwrap(),
(u64::MAX as f64).to_string().into_bytes(),
(u64::MAX as f64).to_string(),
),
(
Decimal::from_bytes(b"999999999999999999999999")
.unwrap()
.unwrap(),
Vec::from(b"999999999999999999999999".as_ref()),
String::from("999999999999999999999999"),
),
];
let ref_cs = helper_get_cs_ref(&cs);
test_as_string_helper(
ref_cs,
cast_any_as_string::<Decimal>,
"cast_any_as_string::<Decimal>",
);
} | rust_cleaned_test_functions.jsonl/1974 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1176
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74429,
11898,
3904,
368,
341,
286,
1273,
31488,
6615,
15147,
8378,
31858,
1337,
559,
37248,
11898,
3904,
27638,
11269,
29,
626,
286,
1077,
10532,
25,
11312,
28706,
11269,
11,
11312,
34837,
23,
8066,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_option_as_deref() {
let ref_option = &Some(&42);
assert_eq!(ref_option.as_deref(), Some(&42));
let ref_option = &Some(String::from("a result"));
assert_eq!(ref_option.as_deref(), Some("a result"));
let ref_option = &Some(vec![1, 2, 3, 4, 5]);
assert_eq!(ref_option.as_deref(), Some([1, 2, 3, 4, 5].as_slice()));
let ref_option: &Option<&i32> = &None;
assert_eq!(ref_option.as_deref(), None);
} | rust_cleaned_test_functions.jsonl/20250 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 219
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9672,
11898,
814,
43970,
368,
341,
1066,
262,
1077,
2053,
9672,
284,
609,
8373,
2099,
19,
17,
317,
262,
2060,
10714,
10297,
1097,
9672,
5357,
814,
43970,
1507,
4329,
2099,
19,
17,
3237,
262,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_t116() {
init();
let result = t116(*MAIN_SIG_MAP, *SUB_SIG_MAP);
println!("{}", result.len());
println!("{:?}", result);
} | rust_cleaned_test_functions.jsonl/104729 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
16,
16,
21,
368,
341,
286,
2930,
543,
286,
1077,
1102,
284,
259,
16,
16,
21,
4071,
41815,
55687,
16306,
11,
353,
29038,
55687,
16306,
317,
286,
13751,
79878,
1102,
19406,
1423,
286,
13751,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_circuit_duplicate_members() {
let store = setup_admin_service_store();
let event_store = store.clone_boxed();
let (mesh, cm, pm, peer_connector) = setup_peer_connector(None);
let orchestrator = setup_orchestrator();
let signature_verifier = Secp256k1Context::new().new_verifier();
let table = RoutingTable::default();
let writer: Box<dyn RoutingTableWriter> = Box::new(table.clone());
let admin_shared = AdminServiceShared::new(
"node_a".into(),
Arc::new(Mutex::new(orchestrator)),
HashMap::new(),
peer_connector,
store,
signature_verifier,
Box::new(MockAdminKeyVerifier::default()),
Box::new(AllowAllKeyPermissionManager),
writer,
event_store,
vec![],
);
let mut circuit = setup_test_circuit();
let mut node_a = SplinterNode::new();
node_a.set_node_id("node_a".to_string());
node_a.set_endpoints(vec!["test://endpoint_a:0".to_string()].into());
let mut node_b = SplinterNode::new();
node_b.set_node_id("node_b".to_string());
node_b.set_endpoints(vec!["test://endpoint_b:0".to_string()].into());
let mut node_b2 = SplinterNode::new();
node_b2.set_node_id("node_b".to_string());
node_b2.set_endpoints(vec!["test://endpoint_b2:0".to_string()].into());
circuit.set_members(RepeatedField::from_vec(vec![node_a, node_b, node_b2]));
if let Ok(_) = admin_shared.validate_create_circuit(
&circuit,
PUB_KEY,
"node_a",
ADMIN_SERVICE_PROTOCOL_VERSION,
) {
panic!("Should have been invalid because there are duplicate members");
}
shutdown(mesh, cm, pm);
} | rust_cleaned_test_functions.jsonl/47873 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 900
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
666,
37268,
70434,
30397,
368,
341,
286,
1077,
3553,
284,
6505,
12207,
12267,
14809,
543,
286,
1077,
1538,
14809,
284,
3553,
15997,
10194,
291,
1428,
286,
1077,
320,
23506,
11,
9961,
11,
88... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_real_blocks() {
assert!(futures::executor::block_on(check_hash(
bitcoin::BlockHeader {
version: 536870912,
prev_blockhash: into(
"508ff5554dc9f83e3cab31b8fb89d10604ebcd963c7b8ce131fd3ef47c2a0921"
),
merkle_root: into(
"a86996c4ae298b22a4a1c971aa29f0ea9fb1d822191fa8e0755b08381a90bc19"
),
time: 1583516502,
bits: 0x1d01cc13,
nonce: 867267585,
}
)));
assert!(futures::executor::block_on(check_hash(
bitcoin::BlockHeader {
version: 536870912,
prev_blockhash: into(
"4cb8068ec9d224d5869fe57144cff796e4c88f9da5ebe81dab88cd247d93e0e2"
),
merkle_root: into(
"3d976f66323f5d79880c8c87bcd35506f43e27c9ec75468572db57aacf7c1b72"
),
time: 1583519758,
bits: 0x1d023fa9,
nonce: 2041135619,
}
)));
} | rust_cleaned_test_functions.jsonl/123330 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 775
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15266,
25201,
368,
341,
1789,
286,
2060,
10297,
69,
74606,
486,
80787,
486,
4574,
4470,
24077,
8950,
1006,
310,
17873,
486,
4713,
4047,
341,
394,
2319,
25,
220,
20,
18,
21,
23,
22,
15,
24,
16,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_string_equal() {
let a = StringArray::from(vec!["hello", "world"]);
let b = StringArray::from(vec!["hello", "world"]);
assert!(a.equals(&b));
assert!(b.equals(&a));
let b = StringArray::from(vec!["hello", "arrow"]);
assert!(!a.equals(&b));
assert!(!b.equals(&a));
// Test the case where null_count > 0
let a = StringArray::try_from(vec![
Some("hello"),
None,
None,
Some("world"),
None,
None,
])
.unwrap();
let b = StringArray::try_from(vec![
Some("hello"),
None,
None,
Some("world"),
None,
None,
])
.unwrap();
assert!(a.equals(&b));
assert!(b.equals(&a));
let b = StringArray::try_from(vec![
Some("hello"),
Some("foo"),
None,
Some("world"),
None,
None,
])
.unwrap();
assert!(!a.equals(&b));
assert!(!b.equals(&a));
let b = StringArray::try_from(vec![
Some("hello"),
None,
None,
Some("arrow"),
None,
None,
])
.unwrap();
assert!(!a.equals(&b));
assert!(!b.equals(&a));
// Test the case where offset != 0
let a_slice = a.slice(0, 3);
let b_slice = b.slice(0, 3);
assert!(a_slice.equals(&*b_slice));
assert!(b_slice.equals(&*a_slice));
let a_slice = a.slice(0, 5);
let b_slice = b.slice(0, 5);
assert!(!a_slice.equals(&*b_slice));
assert!(!b_slice.equals(&*a_slice));
let a_slice = a.slice(4, 1);
let b_slice = b.slice(4, 1);
assert!(a_slice.equals(&*b_slice));
assert!(b_slice.equals(&*a_slice));
} | rust_cleaned_test_functions.jsonl/109122 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
11478,
368,
341,
286,
1077,
264,
284,
923,
1857,
486,
1499,
25592,
0,
1183,
14990,
497,
330,
14615,
15049,
286,
1077,
293,
284,
923,
1857,
486,
1499,
25592,
0,
1183,
14990,
497,
330,
14615... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pseudo_random_send() {
const N: usize = 100;
for cap in 0..N {
let c = make::<i32>(cap);
let l = Arc::new(Mutex::new(vec![0i32; N]));
let done = make::<bool>(0);
go!(c, done, l, {
let mut l = l.lock().unwrap();
for i in 0..N {
thread::yield_now();
l[i] = c.recv().unwrap();
}
done.send(true);
});
for _ in 0..N {
select! {
send(c.tx(), 1) -> _ => {}
send(c.tx(), 0) -> _ => {}
}
}
done.recv();
let mut n0 = 0;
let mut n1 = 0;
for &i in l.lock().unwrap().iter() {
n0 += (i + 1) % 2;
n1 += i;
}
if n0 <= N as i32 / 10 || n1 <= N as i32 / 10 {
panic!(
"Want pseudorandom, got {} zeros and {} ones (chan cap {})",
n0, n1, cap,
);
}
}
} | rust_cleaned_test_functions.jsonl/2882 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 752
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
21952,
22644,
13565,
368,
341,
286,
733,
451,
25,
22301,
284,
220,
16,
15,
15,
401,
286,
369,
2062,
304,
220,
15,
496,
45,
341,
310,
1077,
272,
284,
1281,
27638,
72,
18,
17,
2235,
11346... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
#[test]
fn test_convert_details() {
let job_details = vec![
"07-02-2020 21:09:39",
"ECorp",
"Security Engineer",
"HIRED",
"My name is Elliot"
];
let style = "Fbl";
let results = vec![
Cell::new(&job_details[0]).style_spec(style),
Cell::new(&job_details[1]).style_spec(style),
Cell::new(&job_details[2]).style_spec(style),
Cell::new(&job_details[3]).style_spec(style),
Cell::new(&job_details[4]).style_spec(style),
];
assert_eq!(convert_details(&job_details, style), results);
} | rust_cleaned_test_functions.jsonl/92017 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 344
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
13260,
368,
341,
286,
1077,
2618,
13260,
284,
7486,
90515,
310,
330,
15,
22,
12,
15,
17,
12,
17,
15,
17,
15,
220,
17,
16,
25,
15,
24,
25,
18,
24,
756,
310,
330,
7498,
30115,
756,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_float_scientific_notation() {
let mut reader = Lexer::from_str("1.0e1 1.0E1 1.0e+1 1.0e-1");
assert_tok(
&mut reader,
TokenKind::LitFloat("1.0e1".into(), FloatSuffix::Double),
1,
1,
);
assert_tok(
&mut reader,
TokenKind::LitFloat("1.0E1".into(), FloatSuffix::Double),
1,
7,
);
assert_tok(
&mut reader,
TokenKind::LitFloat("1.0e+1".into(), FloatSuffix::Double),
1,
13,
);
assert_tok(
&mut reader,
TokenKind::LitFloat("1.0e-1".into(), FloatSuffix::Double),
1,
20,
);
} | rust_cleaned_test_functions.jsonl/101126 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 470
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17586,
643,
12295,
1086,
7913,
367,
368,
341,
286,
1077,
5206,
6604,
284,
85082,
486,
1499,
2895,
445,
16,
13,
15,
68,
16,
220,
16,
13,
15,
36,
16,
220,
16,
13,
15,
68,
10,
16,
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... | 1 |
#[test]
fn test_start() {
let addr = unused_addr();
let (tx, rx) = mpsc::channel();
let h = thread::spawn(move || {
let sys = scrappy_rt::System::new("test");
let srv: Server = Server::build()
.backlog(100)
.disable_signals()
.bind("test", addr, move || {
fn_service(|io: TcpStream| {
async move {
let mut f = Framed::new(io, BytesCodec);
f.send(Bytes::from_static(b"test")).await.unwrap();
Ok::<_, ()>(())
}
})
})
.unwrap()
.start();
let _ = tx.send((srv, scrappy_rt::System::current()));
let _ = sys.run();
});
let (srv, sys) = rx.recv().unwrap();
let mut buf = [1u8; 4];
let mut conn = net::TcpStream::connect(addr).unwrap();
let _ = conn.read_exact(&mut buf);
assert_eq!(buf, b"test"[..]);
// pause
let _ = srv.pause();
thread::sleep(time::Duration::from_millis(200));
let mut conn = net::TcpStream::connect(addr).unwrap();
conn.set_read_timeout(Some(time::Duration::from_millis(100)))
.unwrap();
let res = conn.read_exact(&mut buf);
assert!(res.is_err());
// resume
let _ = srv.resume();
thread::sleep(time::Duration::from_millis(100));
assert!(net::TcpStream::connect(addr).is_ok());
assert!(net::TcpStream::connect(addr).is_ok());
assert!(net::TcpStream::connect(addr).is_ok());
let mut buf = [0u8; 4];
let mut conn = net::TcpStream::connect(addr).unwrap();
let _ = conn.read_exact(&mut buf);
assert_eq!(buf, b"test"[..]);
// stop
let _ = srv.stop(false);
thread::sleep(time::Duration::from_millis(100));
assert!(net::TcpStream::connect(addr).is_err());
thread::sleep(time::Duration::from_millis(100));
let _ = sys.stop();
let _ = h.join();
} | rust_cleaned_test_functions.jsonl/5727 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 945
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4906,
368,
341,
262,
1077,
10789,
284,
20006,
7387,
543,
262,
1077,
320,
3998,
11,
19111,
8,
284,
296,
81984,
486,
10119,
1428,
262,
1077,
305,
284,
4516,
486,
46087,
34081,
1369,
341,
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... | 3 |
#[test]
fn test_vec_join() {
let t = VecJoinTemplate {
s: vec!["foo".into(), "bar".into(), "bazz".into()],
};
assert_eq!(t.render().unwrap(), "foo, bar, bazz");
} | rust_cleaned_test_functions.jsonl/8698 | {
"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,
13251,
31017,
368,
341,
262,
1077,
259,
284,
11312,
12292,
7275,
341,
286,
274,
25,
7486,
0,
1183,
7975,
3263,
18122,
1507,
330,
2257,
3263,
18122,
1507,
330,
65,
9802,
3263,
18122,
73845,
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 |
#[test]
fn test_add_assign_f64() {
let mut x = Vec3::new(1.0, 0.0, -1.0);
x += 233.0;
assert_eq!(x, Vec3::new(234.0, 233.0, 232.0))
} | rust_cleaned_test_functions.jsonl/35219 | {
"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,
2891,
20688,
761,
21,
19,
368,
341,
286,
1077,
5206,
856,
284,
11312,
18,
486,
931,
7,
16,
13,
15,
11,
220,
15,
13,
15,
11,
481,
16,
13,
15,
317,
286,
856,
1421,
220,
17,
18,
18,
13,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extract_helm_chart_version() -> io::Result<()> {
let config_name = "Chart.yaml";
let config_content = "
apiVersion: v1
name: starship
version: 0.2.0
";
let project_dir = create_project_dir()?;
fill_config(&project_dir, config_name, Some(config_content))?;
expect_output(&project_dir, Some("v0.2.0"), None);
project_dir.close()
} | rust_cleaned_test_functions.jsonl/100126 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
1523,
23162,
40961,
9438,
368,
1464,
6399,
486,
2077,
71698,
341,
286,
1077,
2193,
1269,
284,
330,
14488,
33406,
876,
286,
1077,
2193,
7495,
284,
6228,
286,
6330,
5637,
25,
348,
16,
198,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_conns_drop_on_pool_drop() {
static DROPPED: AtomicUsize = AtomicUsize::new(0);
struct Connection;
impl Drop for Connection {
fn drop(&mut self) {
DROPPED.fetch_add(1, Ordering::SeqCst);
}
}
struct Handler;
impl ManageConnection for Handler {
type Connection = Connection;
type Error = Error;
fn connect(&self) -> Box<Future<Item = Self::Connection, Error = Self::Error> + Send> {
Box::new(ok(Connection))
}
fn is_valid(
&self,
conn: Self::Connection,
) -> Box<Future<Item = Self::Connection, Error = (Self::Error, Self::Connection)> + Send>
{
Box::new(ok(conn))
}
fn has_broken(&self, _: &mut Self::Connection) -> bool {
false
}
}
let mut event_loop = Runtime::new().unwrap();
let pool = event_loop
.block_on(lazy(|| {
Pool::builder()
.max_lifetime(Some(Duration::from_secs(10)))
.max_size(10)
.min_idle(Some(10))
.build(Handler)
}))
.unwrap();
mem::drop(pool);
for _ in 0..10 {
if DROPPED.load(Ordering::SeqCst) == 10 {
return;
}
assert!(event_loop
.block_on(lazy(|| Timeout::new(
empty::<(), ()>(),
Duration::from_secs(1)
)))
.unwrap_err()
.is_elapsed());
}
panic!(
"Timed out waiting for connections to drop, {} dropped",
DROPPED.load(Ordering::SeqCst)
);
} | rust_cleaned_test_functions.jsonl/127894 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 861
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3382,
4412,
29584,
4470,
15709,
29584,
368,
341,
262,
1099,
422,
1285,
4406,
1479,
25,
30316,
52,
2141,
284,
30316,
52,
2141,
486,
931,
7,
15,
626,
262,
2036,
11032,
401,
262,
11605,
15733,
369,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reserve_exact_2() {
// This is all the same as test_reserve
let mut v = VecDeque::new();
v.reserve_exact(2);
assert!(v.capacity() >= 2);
for i in 0..16 {
v.push_back(i);
}
assert!(v.capacity() >= 16);
v.reserve_exact(16);
assert!(v.capacity() >= 32);
v.push_back(16);
v.reserve_exact(16);
assert!(v.capacity() >= 48)
} | rust_cleaned_test_functions.jsonl/73735 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 196
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
89591,
71084,
62,
17,
368,
341,
262,
442,
1096,
374,
678,
279,
1852,
438,
1273,
89591,
271,
262,
1077,
5206,
348,
284,
11312,
73891,
486,
931,
1428,
262,
348,
48520,
71084,
7,
17,
317,
262,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_missing_loader() {
let dir = create_dir_and_file("file.not-a-real-extension");
let asset_server = setup(dir.path());
let path: AssetPath = "file.not-a-real-extension".into();
let handle = asset_server.get_handle_untyped(path.get_id());
let err = futures_lite::future::block_on(asset_server.load_async(path.clone(), true))
.unwrap_err();
assert!(match err {
AssetServerError::MissingAssetLoader { extensions } => {
extensions == ["not-a-real-extension"]
}
_ => false,
});
assert_eq!(asset_server.get_load_state(handle), LoadState::Failed);
} | rust_cleaned_test_functions.jsonl/3151 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 321
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40447,
22139,
368,
341,
286,
1077,
5419,
284,
1855,
4334,
8378,
2458,
445,
1192,
11971,
7409,
74795,
80539,
797,
286,
1077,
9329,
12015,
284,
6505,
14161,
3875,
5231,
286,
1077,
1815,
25,
22605,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_module_rename_in_path() {
test_rename(
r#"
mod <|>foo {
pub fn bar() {}
}
fn main() {
foo::bar();
}"#,
"baz",
r#"
mod baz {
pub fn bar() {}
}
fn main() {
baz::bar();
}"#,
);
} | rust_cleaned_test_functions.jsonl/16223 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10750,
79399,
1243,
2638,
368,
341,
286,
1273,
79399,
1006,
310,
435,
2,
698,
262,
1463,
82639,
29,
7975,
341,
286,
6675,
5168,
3619,
368,
5613,
262,
555,
262,
5168,
1887,
368,
341,
286,
15229,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_passive_mdns() {
passive_mdns_test(
MdnsQueryType::Passive,
SocketAddr::new(*TEST_MDNS_IPV4, BASE_TEST_PORT + 3),
)
} | rust_cleaned_test_functions.jsonl/23779 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15464,
533,
32994,
4412,
368,
341,
286,
27879,
32994,
4412,
4452,
1006,
310,
386,
45226,
2859,
929,
486,
12187,
533,
345,
310,
20954,
13986,
486,
931,
4071,
10033,
46497,
2448,
58830,
19,
11,
2219... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_favicon_parsed_with_base() {
let base = favicon_parsed_with_base(
Some("favicon.ico"),
"http://example.com/page/index.html?a=b",
);
assert!(base.is_ok());
assert_eq!(base.unwrap(), "http://example.com/page/favicon.ico");
} | rust_cleaned_test_functions.jsonl/64935 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 162
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
27921,
75788,
6615,
7651,
368,
341,
286,
1077,
2331,
284,
82804,
75788,
6615,
7651,
1006,
310,
4329,
445,
54557,
39186,
4461,
310,
330,
1254,
1110,
8687,
905,
32180,
9022,
2564,
98461,
22086,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rolling_quantile_limits() {
let values = &[1.0, 2.0, 3.0, 4.0];
let interpol_options = vec![
QuantileInterpolOptions::Lower,
QuantileInterpolOptions::Higher,
QuantileInterpolOptions::Nearest,
QuantileInterpolOptions::Midpoint,
QuantileInterpolOptions::Linear,
];
for interpol in interpol_options {
let out1 = rolling_min(values, 2, 2, false, None);
let out1 = out1.as_any().downcast_ref::<PrimitiveArray<f64>>().unwrap();
let out1 = out1.into_iter().map(|v| v.copied()).collect::<Vec<_>>();
let out2 = rolling_quantile(values, 0.0, interpol, 2, 2, false, None);
let out2 = out2.as_any().downcast_ref::<PrimitiveArray<f64>>().unwrap();
let out2 = out2.into_iter().map(|v| v.copied()).collect::<Vec<_>>();
assert_eq!(out1, out2);
let out1 = rolling_max(values, 2, 2, false, None);
let out1 = out1.as_any().downcast_ref::<PrimitiveArray<f64>>().unwrap();
let out1 = out1.into_iter().map(|v| v.copied()).collect::<Vec<_>>();
let out2 = rolling_quantile(values, 1.0, interpol, 2, 2, false, None);
let out2 = out2.as_any().downcast_ref::<PrimitiveArray<f64>>().unwrap();
let out2 = out2.into_iter().map(|v| v.copied()).collect::<Vec<_>>();
assert_eq!(out1, out2);
}
} | rust_cleaned_test_functions.jsonl/8713 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 720
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
16210,
53346,
457,
31820,
368,
341,
286,
1077,
2750,
284,
44590,
16,
13,
15,
11,
220,
17,
13,
15,
11,
220,
18,
13,
15,
11,
220,
19,
13,
15,
4821,
286,
1077,
22876,
8743,
284,
7486,
905... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_target_set() {
let mut expected =
vec![BuildTarget { arch: String::from("x64"), board: String::from("workstation") }];
let mut results =
get_target_sets(Some(&String::from("x64")), Some(&String::from("workstation")));
assert_eq!(expected, results);
expected = vec![
BuildTarget { arch: String::from("x64"), board: String::from("workstation") },
BuildTarget { arch: String::from("x64"), board: String::from("core") },
BuildTarget { arch: String::from("arm64"), board: String::from("workstation") },
BuildTarget { arch: String::from("x64"), board: String::from("core") },
];
results = get_target_sets(
Some(&String::from("x64,arm64")),
Some(&String::from("workstation,core")),
);
assert_eq!(expected.sort(), results.sort());
expected = vec![];
results = get_target_sets(Some(&String::from("x64,arm64")), None);
assert_eq!(expected, results);
} | rust_cleaned_test_functions.jsonl/28545 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 454
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11123,
2602,
368,
341,
286,
1077,
5206,
3601,
4035,
310,
7486,
20703,
11066,
6397,
314,
5325,
25,
923,
486,
1499,
445,
87,
21,
19,
3975,
4479,
25,
923,
486,
1499,
445,
1778,
20155,
899,
19376,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_config_validate() {
let mut cfg = Config::new();
cfg.validate().unwrap();
assert_eq!(
cfg.raft_min_election_timeout_ticks,
cfg.raft_election_timeout_ticks
);
assert_eq!(
cfg.raft_max_election_timeout_ticks,
cfg.raft_election_timeout_ticks * 2
);
cfg.raft_heartbeat_ticks = 0;
assert!(cfg.validate().is_err());
cfg = Config::new();
cfg.raft_election_timeout_ticks = 10;
cfg.raft_heartbeat_ticks = 10;
assert!(cfg.validate().is_err());
cfg = Config::new();
cfg.raft_min_election_timeout_ticks = 5;
cfg.validate().unwrap_err();
cfg.raft_min_election_timeout_ticks = 25;
cfg.validate().unwrap_err();
cfg.raft_min_election_timeout_ticks = 10;
cfg.validate().unwrap();
cfg.raft_heartbeat_ticks = 11;
assert!(cfg.validate().is_err());
cfg = Config::new();
cfg.raft_log_gc_threshold = 0;
assert!(cfg.validate().is_err());
cfg = Config::new();
cfg.raft_log_gc_size_limit = ReadableSize(0);
assert!(cfg.validate().is_err());
cfg = Config::new();
cfg.raft_base_tick_interval = ReadableDuration::secs(1);
cfg.raft_election_timeout_ticks = 10;
cfg.raft_store_max_leader_lease = ReadableDuration::secs(20);
assert!(cfg.validate().is_err());
cfg = Config::new();
cfg.raft_log_gc_count_limit = 100;
cfg.merge_max_log_gap = 110;
assert!(cfg.validate().is_err());
cfg = Config::new();
cfg.merge_check_tick_interval = ReadableDuration::secs(0);
assert!(cfg.validate().is_err());
cfg = Config::new();
cfg.raft_base_tick_interval = ReadableDuration::secs(1);
cfg.raft_election_timeout_ticks = 10;
cfg.peer_stale_state_check_interval = ReadableDuration::secs(5);
assert!(cfg.validate().is_err());
cfg = Config::new();
cfg.peer_stale_state_check_interval = ReadableDuration::minutes(2);
cfg.abnormal_leader_missing_duration = ReadableDuration::minutes(1);
assert!(cfg.validate().is_err());
cfg = Config::new();
cfg.abnormal_leader_missing_duration = ReadableDuration::minutes(2);
cfg.max_leader_missing_duration = ReadableDuration::minutes(1);
assert!(cfg.validate().is_err());
cfg = Config::new();
cfg.local_read_batch_size = 0;
assert!(cfg.validate().is_err());
cfg = Config::new();
cfg.apply_batch_system.max_batch_size = 0;
assert!(cfg.validate().is_err());
cfg = Config::new();
cfg.apply_batch_system.pool_size = 0;
assert!(cfg.validate().is_err());
cfg = Config::new();
cfg.future_poll_size = 0;
assert!(cfg.validate().is_err());
} | rust_cleaned_test_functions.jsonl/34726 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1419
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5332,
42681,
368,
341,
286,
1077,
5206,
13286,
284,
5532,
486,
931,
543,
286,
13286,
19520,
1005,
15454,
543,
286,
2060,
10714,
33673,
310,
13286,
13,
2944,
7260,
2204,
1170,
20537,
49961,
345,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_conda_env_interpreter() {
let base = OsStr::new("base");
assert_eq!(
conda_env_interpreter(base, true),
PathBuf::from_iter(&["base", "python.exe"])
);
assert_eq!(
conda_env_interpreter(base, false),
PathBuf::from_iter(&["base", "bin", "python"])
);
} | rust_cleaned_test_functions.jsonl/13939 | {
"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,
24433,
64,
15879,
15318,
28637,
368,
341,
286,
1077,
2331,
284,
15433,
2580,
486,
931,
445,
3152,
797,
286,
2060,
10714,
33673,
310,
390,
3235,
15879,
15318,
28637,
12663,
11,
830,
1326,
310,
7933... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_to_bytes() {
assert_eq!(
Scalar::zero().to_bytes_le(),
[
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, 0
]
);
assert_eq!(
Scalar::one().to_bytes_le(),
[
1, 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
]
);
assert_eq!(
Scalar::from_repr(R2).unwrap().to_bytes_le(),
[
254, 255, 255, 255, 1, 0, 0, 0, 2, 72, 3, 0, 250, 183, 132, 88, 245, 79, 188, 236,
239, 79, 140, 153, 111, 5, 197, 172, 89, 177, 36, 24
]
);
assert_eq!(
(-&Scalar::one()).to_bytes_le(),
[
0, 0, 0, 0, 255, 255, 255, 255, 254, 91, 254, 255, 2, 164, 189, 83, 5, 216, 161, 9,
8, 216, 57, 51, 72, 125, 157, 41, 83, 167, 237, 115
]
);
} | rust_cleaned_test_functions.jsonl/56375 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 701
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
12524,
368,
341,
286,
2060,
10714,
33673,
310,
35176,
486,
14154,
1005,
983,
12524,
11751,
3148,
310,
2278,
394,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_remove_proposal_denied() {
let mut context = VMContextBuilder::new();
testing_env!(context.predecessor_account_id(accounts(1)).build());
let mut contract = Contract::new(
Config::test_config(),
VersionedPolicy::Default(vec![accounts(1).into()]),
);
let id = create_proposal(&mut context, &mut contract);
assert_eq!(contract.get_proposal(id).proposal.description, "test");
contract.act_proposal(id, Action::RemoveProposal, None);
} | rust_cleaned_test_functions.jsonl/16635 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 226
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
21663,
32556,
49522,
1122,
368,
341,
286,
1077,
5206,
2266,
284,
17792,
1972,
3297,
486,
931,
543,
286,
7497,
15879,
10297,
2147,
6225,
26911,
269,
13500,
842,
91868,
7,
16,
4579,
5834,
142... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_aggsig_multisig() {
let numkeys = 5;
let secp = Secp256k1::with_caps(ContextFlag::Full);
let mut keypairs: Vec<(SecretKey, PublicKey)> = vec![];
for _ in 0..numkeys {
keypairs.push(secp.generate_keypair(&mut thread_rng()).unwrap());
}
let pks: Vec<PublicKey> = keypairs.clone().into_iter().map(|(_, p)| p).collect();
println!(
"Creating aggsig context with {} pubkeys: {:?}",
pks.len(),
pks
);
let aggsig = AggSigContext::new(&secp, &pks);
println!("Generating nonces for each index");
for i in 0..numkeys {
let retval = aggsig.generate_nonce(i);
println!("{} returned {}", i, retval);
assert!(retval == true);
}
let mut msg = [0u8; 32];
thread_rng().fill(&mut msg);
let msg = Message::from_slice(&msg).unwrap();
let mut partial_sigs: Vec<AggSigPartialSignature> = vec![];
for i in 0..numkeys {
println!(
"Partial sign message: {:?} at index {}, SK:{:?}",
msg, i, keypairs[i].0
);
let result = aggsig.partial_sign(msg, keypairs[i].0.clone(), i);
match result {
Ok(ps) => {
println!("Partial sig: {:?}", ps);
partial_sigs.push(ps);
}
Err(e) => panic!("Partial sig failed: {}", e),
}
}
let result = aggsig.combine_signatures(&partial_sigs);
let combined_sig = match result {
Ok(cs) => {
println!("Combined sig: {:?}", cs);
cs
}
Err(e) => panic!("Combining partial sig failed: {}", e),
};
println!(
"Verifying Combined sig: {:?}, msg: {:?}, pks:{:?}",
combined_sig, msg, pks
);
let result = aggsig.verify(combined_sig, msg, &pks);
println!("Signature verification: {}", result);
} | rust_cleaned_test_functions.jsonl/15033 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 741
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20587,
5857,
343,
26290,
285,
343,
368,
341,
197,
10217,
1629,
10563,
284,
220,
20,
280,
197,
10217,
511,
4672,
284,
4520,
79,
17,
20,
21,
74,
16,
486,
4197,
52955,
14001,
12135,
486,
9432,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_get_unified_log_level() {
assert_eq!("FATAL", get_unified_log_level(Level::Critical));
assert_eq!("ERROR", get_unified_log_level(Level::Error));
assert_eq!("WARN", get_unified_log_level(Level::Warning));
assert_eq!("INFO", get_unified_log_level(Level::Info));
assert_eq!("DEBUG", get_unified_log_level(Level::Debug));
assert_eq!("TRACE", get_unified_log_level(Level::Trace));
} | rust_cleaned_test_functions.jsonl/20808 | {
"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,
3062,
4907,
1870,
5224,
8274,
368,
341,
286,
2060,
10714,
17223,
37,
30074,
497,
633,
4907,
1870,
5224,
8274,
30263,
486,
42008,
1106,
286,
2060,
10714,
17223,
3682,
497,
633,
4907,
1870,
5224,
82... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dictionary_array_from_iter() {
let test = vec!["a", "a", "b", "c"];
let array: DictionaryArray<Int8Type> = test
.iter()
.map(|&x| if x == "b" { None } else { Some(x) })
.collect();
assert_eq!(
"DictionaryArray {keys: [Some(0), Some(0), None, Some(1)] values: StringArray\n[\n \"a\",\n \"c\",\n]}\n",
format!("{:?}", array)
);
let array: DictionaryArray<Int8Type> = test.into_iter().collect();
assert_eq!(
"DictionaryArray {keys: [Some(0), Some(0), Some(1), Some(2)] values: StringArray\n[\n \"a\",\n \"b\",\n \"c\",\n]}\n",
format!("{:?}", array)
);
} | rust_cleaned_test_functions.jsonl/11642 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 381
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42605,
3858,
5673,
11723,
368,
341,
286,
1077,
1273,
284,
7486,
0,
1183,
64,
497,
330,
64,
497,
330,
65,
497,
330,
66,
6332,
286,
1077,
1334,
25,
10466,
1857,
34520,
23,
929,
29,
284,
1273,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_apply_strategy_for_type_2() {
let data = [
0, 0, 0, 2, 0, 0, 0, 10, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
];
let expected = vec![1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
let mut decoder = Decoder::new(&data);
if let StrategyDataTypes::VecInt8(actual) = decoder.apply().unwrap() {
assert_eq!(expected, actual);
} else {
panic!();
};
} | rust_cleaned_test_functions.jsonl/30702 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 247
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36551,
49308,
5478,
1819,
62,
17,
368,
341,
286,
1077,
821,
284,
2278,
310,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
17,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
16,
15,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_enum_for_tuple() {
check(
r#"
enum Foo<|>{
A(i8),
B(i8),
}
fn main() {
let f: Foo;
f = Foo::A(1);
}
"#,
expect![[r#"
Foo Enum FileId(0) 0..33 5..8 Other
FileId(0) 70..73 EnumLiteral
"#]],
);
} | rust_cleaned_test_functions.jsonl/47768 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 213
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31054,
5478,
21773,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
9018,
33428,
27,
91,
41446,
262,
362,
1956,
23,
1326,
262,
425,
1956,
23,
1326,
532,
8822,
1887,
368,
341,
262,
1077,
282,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_matcher_data_attribute_present() {
let m = Matcher::from("a[target]");
let mut attr = HashMap::new();
attr.insert("target".to_string(), AttributeSpec::Present);
assert_eq!(m.attribute, attr);
} | rust_cleaned_test_functions.jsonl/66002 | {
"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,
10708,
261,
1769,
16791,
36976,
368,
341,
286,
1077,
296,
284,
60632,
486,
1499,
445,
64,
57033,
37389,
286,
1077,
5206,
6376,
284,
10528,
486,
931,
543,
286,
6376,
7030,
445,
5657,
3263,
983,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_fill_0() {
let hw = RefCell::new(CpuHardware::new());
let g = RefCell::new(Graph::new());
let ret = Node::fill(&g, &hw, Shape::new([0]), 123.);
assert_eq!(ret.shape(), Shape::new([0]));
assert!(ptr::eq(ret.hardware(), &hw));
assert_eq!(ret.calculate().get_values_f32(), vec![]);
} | rust_cleaned_test_functions.jsonl/31063 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 146
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30728,
62,
15,
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,
1423,
262,
1077,
2112,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tuple_structs() {
common::setup();
#[derive(PolarClass)]
struct Foo(i32, i32);
impl Foo {
fn new(a: i32, b: i32) -> Self {
Self(a, b)
}
}
// we can auto generate these accessors too. For now we have to rely on the attribute for
// fields and manually doing it for tuple structs.
// Also foo.0 isn't valid polar syntax so if we wanted something like that to work in general for "tuple like objects
// that requires a bigger change.
let mut test = OsoTest::new();
test.oso
.register_class(
Foo::get_polar_class_builder()
.set_constructor(Foo::new)
.add_attribute_getter("i0", |rcv: &Foo| rcv.0)
.add_attribute_getter("i1", |rcv: &Foo| rcv.1)
.build(),
)
.unwrap();
test.qvar_one(r#"foo = new Foo(1,2) and foo.i0 + foo.i1 = x"#, "x", 3);
} | rust_cleaned_test_functions.jsonl/30390 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 453
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21773,
15126,
82,
368,
341,
262,
4185,
486,
15188,
1428,
262,
11506,
27098,
5304,
7417,
1957,
5563,
262,
2036,
33428,
1956,
18,
17,
11,
600,
18,
17,
626,
262,
11605,
33428,
341,
286,
5168,
501,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_escaping() {
assert_eq!(format!("{{"), "{");
assert_eq!(format!("}}"), "}");
assert_eq!(format!("{{}}"), "{}");
assert_eq!(format!("}}{{"), "}{");
} | rust_cleaned_test_functions.jsonl/80888 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 93
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
42480,
368,
341,
262,
2060,
10714,
10297,
2243,
17223,
2979,
3975,
13868,
797,
262,
2060,
10714,
10297,
2243,
17223,
3417,
3975,
330,
20305,
262,
2060,
10714,
10297,
2243,
17223,
2979,
3417,
397... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_config_builder_returns_new_builder() {
assert_eq!(
Config::builder(),
Builder::new(),
"Config::builder should return an unmodified new Builder"
);
} | rust_cleaned_test_functions.jsonl/91432 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5332,
28532,
58900,
5921,
28532,
368,
341,
286,
2060,
10714,
33673,
310,
5532,
486,
17850,
3148,
310,
20626,
486,
931,
3148,
310,
330,
2648,
486,
17850,
1265,
470,
458,
650,
27162,
501,
20626,
698... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_listener_startup() {
let mut config = ClusterConfig {
node_stakes: vec![100; 1],
cluster_lamports: 1_000,
num_listeners: 3,
validator_configs: make_identical_validator_configs(&ValidatorConfig::default(), 1),
..ClusterConfig::default()
};
let cluster = LocalCluster::new(&mut config, SocketAddrSpace::Unspecified);
let cluster_nodes = discover_cluster(
&cluster.entry_point_info.gossip,
4,
SocketAddrSpace::Unspecified,
)
.unwrap();
assert_eq!(cluster_nodes.len(), 4);
} | rust_cleaned_test_functions.jsonl/31760 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 256
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46493,
80858,
368,
341,
262,
1077,
5206,
2193,
284,
35380,
2648,
341,
286,
2436,
1261,
2050,
25,
7486,
20703,
16,
15,
15,
26,
220,
16,
1259,
286,
10652,
907,
309,
3394,
25,
220,
16,
62,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ops_other_number_types() -> Result<(), Box<EvalAltResult>> {
let engine = Engine::new();
let mut scope = Scope::new();
scope.push("x", 42_u16);
assert!(matches!(
*engine.eval_with_scope::<bool>(&mut scope, "x == 42").expect_err("should error"),
EvalAltResult::ErrorFunctionNotFound(f, _) if f.starts_with("== (u16,")
));
#[cfg(not(feature = "no_float"))]
assert!(matches!(
*engine.eval_with_scope::<bool>(&mut scope, "x == 42.0").expect_err("should error"),
EvalAltResult::ErrorFunctionNotFound(f, _) if f.starts_with("== (u16,")
));
assert!(!engine.eval_with_scope::<bool>(&mut scope, r#"x == "hello""#)?);
Ok(())
} | rust_cleaned_test_functions.jsonl/49952 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 311
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21959,
30456,
5500,
9763,
368,
1464,
5714,
68843,
8261,
23835,
831,
26017,
2077,
2452,
341,
262,
1077,
4712,
284,
8200,
486,
931,
1428,
262,
1077,
5206,
6891,
284,
34920,
486,
931,
1428,
262,
6891... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_target_ssh_address_priority() {
let name = Some("bubba");
let start = std::time::SystemTime::now();
use std::iter::FromIterator;
// An empty set returns nothing.
let addrs = BTreeSet::<TargetAddrEntry>::new();
assert_eq!(Target::new_with_addr_entries(name, addrs.into_iter()).ssh_address(), None);
let addrs = BTreeSet::from_iter(vec![
TargetAddrEntry::new(
("2000::1".parse().unwrap(), 0).into(),
start.into(),
TargetAddrType::Ssh,
),
TargetAddrEntry::new(
("fe80::1".parse().unwrap(), 2).into(),
start.into(),
TargetAddrType::Ssh,
),
]);
assert_eq!(
Target::new_with_addr_entries(name, addrs.into_iter()).ssh_address(),
Some("[fe80::1%2]:22".parse().unwrap())
);
let addrs = BTreeSet::from_iter(vec![
TargetAddrEntry::new(
("2000::1".parse().unwrap(), 0).into(),
start.into(),
TargetAddrType::Ssh,
),
TargetAddrEntry::new(
("fe80::1".parse().unwrap(), 2).into(),
(start - Duration::from_secs(1)).into(),
TargetAddrType::Ssh,
),
]);
assert_eq!(
Target::new_with_addr_entries(name, addrs.into_iter()).ssh_address(),
Some("[fe80::1%2]:22".parse().unwrap())
);
let addrs = BTreeSet::from_iter(vec![
TargetAddrEntry::new(
("fe80::2".parse().unwrap(), 1).into(),
start.into(),
TargetAddrType::Ssh,
),
TargetAddrEntry::new(
("fe80::1".parse().unwrap(), 2).into(),
(start - Duration::from_secs(1)).into(),
TargetAddrType::Ssh,
),
]);
assert_eq!(
Target::new_with_addr_entries(name, addrs.into_iter()).ssh_address(),
Some("[fe80::2%1]:22".parse().unwrap())
);
let addrs = BTreeSet::from_iter(vec![
TargetAddrEntry::new(
("fe80::2".parse().unwrap(), 1).into(),
start.into(),
TargetAddrType::Ssh,
),
TargetAddrEntry::new(
("2000::1".parse().unwrap(), 0).into(),
(start - Duration::from_secs(1)).into(),
TargetAddrType::Manual,
),
]);
assert_eq!(
Target::new_with_addr_entries(name, addrs.into_iter()).ssh_address(),
Some("[2000::1]:22".parse().unwrap())
);
let addrs = BTreeSet::from_iter(vec![
TargetAddrEntry::new(
("2000::1".parse().unwrap(), 0).into(),
start.into(),
TargetAddrType::Ssh,
),
TargetAddrEntry::new(
("2000::2".parse().unwrap(), 0).into(),
(start + Duration::from_secs(1)).into(),
TargetAddrType::Ssh,
),
]);
assert_eq!(
Target::new_with_addr_entries(name, addrs.into_iter()).ssh_address(),
Some("[2000::2]:22".parse().unwrap())
);
} | rust_cleaned_test_functions.jsonl/115225 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1909
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11123,
82805,
6744,
38161,
368,
341,
286,
1077,
829,
284,
4329,
445,
65,
392,
4645,
797,
286,
1077,
1191,
284,
1460,
486,
1678,
486,
2320,
1462,
486,
3328,
543,
286,
990,
1460,
486,
2015,
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_terminate() {
assert_eq!(js_parser_rs::parse("\n".chars()), Ok(vec![]));
assert_eq!(js_parser_rs::parse("\r".chars()), Ok(vec![]));
assert_eq!(js_parser_rs::parse("\n ;".chars()), Ok(vec![TokenType::Semicolon]));
} | rust_cleaned_test_functions.jsonl/61525 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 120
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
48061,
368,
341,
262,
2060,
10714,
10297,
2519,
18517,
47115,
486,
6400,
4921,
77,
3263,
19255,
11858,
7622,
25592,
0,
1294,
1106,
262,
2060,
10714,
10297,
2519,
18517,
47115,
486,
6400,
4921,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unknown_symbol() {
let writer_schema =
Schema::parse_str(r#"{"type": "enum", "name": "Test", "symbols": ["FOO", "BAR"]}"#)
.unwrap();
let reader_schema =
Schema::parse_str(r#"{"type": "enum", "name": "Test", "symbols": ["BAR", "BAZ"]}"#)
.unwrap();
let original_value = Value::Enum(0, "FOO".to_string());
let encoded = to_avro_datum(&writer_schema, original_value).unwrap();
let decoded = from_avro_datum(
&writer_schema,
&mut Cursor::new(encoded),
Some(&reader_schema),
);
assert!(decoded.is_err());
} | rust_cleaned_test_functions.jsonl/129454 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 299
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57507,
21179,
368,
341,
262,
1077,
6916,
25371,
4035,
286,
12539,
486,
6400,
2895,
2601,
55543,
4913,
1313,
788,
330,
9018,
497,
330,
606,
788,
330,
2271,
497,
330,
67426,
788,
4383,
3788,
46,
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_get_slot_id_change_granularity() {
let mut context = get_context(accounts(1));
testing_env!(context.build());
let mut contract = Contract::new();
testing_env!(context.is_view(true).build());
let slot = contract.get_slot_id(None);
assert_eq!(slot, 1624151460000000000);
testing_env!(context.is_view(false).build());
contract.update_settings(
None,
Some(30_000_000_000),
None,
None,
None,
None,
None,
None,
None,
);
testing_env!(context.is_view(true).build());
let slot = contract.get_slot_id(None);
assert_eq!(slot, 1624151490000000000);
testing_env!(context.is_view(false).build());
contract.update_settings(
None,
Some(10_000_000_000),
None,
None,
None,
None,
None,
None,
None,
);
testing_env!(context.is_view(true).build());
let slot = contract.get_slot_id(None);
assert_eq!(slot, 1624151500000000000);
} | rust_cleaned_test_functions.jsonl/43009 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 643
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
27563,
842,
15947,
15682,
276,
28979,
368,
341,
286,
1077,
5206,
2266,
284,
633,
8467,
91868,
7,
16,
1106,
286,
7497,
15879,
10297,
2147,
13239,
1423,
286,
1077,
5206,
5116,
284,
19185,
486,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_block_read_count() {
let g = GlobalIoStats::default();
g.init();
g.global_update(StatsFop::Read, 4000, true);
assert_eq!(g.block_count_read[1].load(Ordering::Relaxed), 1);
g.global_update(StatsFop::Read, 4096, true);
assert_eq!(g.block_count_read[1].load(Ordering::Relaxed), 1);
g.global_update(StatsFop::Read, 65535, true);
assert_eq!(g.block_count_read[3].load(Ordering::Relaxed), 1);
g.global_update(StatsFop::Read, 131072, true);
assert_eq!(g.block_count_read[4].load(Ordering::Relaxed), 1);
g.global_update(StatsFop::Read, 65520, true);
assert_eq!(g.block_count_read[3].load(Ordering::Relaxed), 2);
g.global_update(StatsFop::Read, 2015520, true);
assert_eq!(g.block_count_read[3].load(Ordering::Relaxed), 2);
} | rust_cleaned_test_functions.jsonl/40871 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 409
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7113,
6443,
3180,
368,
341,
286,
1077,
342,
284,
7962,
42799,
16635,
486,
2258,
543,
286,
342,
8271,
543,
286,
342,
21932,
8882,
7,
16635,
37,
453,
486,
4418,
11,
220,
19,
15,
15,
15,
11,
83... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iso8601_from_epoch_micros_test() {
let expected_iso = "2021-07-20T23:18:18Z";
let dt = iso8601_from_epoch(EpochUnit::Microseconds(1626823098000000));
assert_eq!(expected_iso, dt);
} | rust_cleaned_test_functions.jsonl/124210 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49660,
23,
21,
15,
16,
5673,
20682,
73003,
82,
4452,
368,
341,
286,
1077,
3601,
49660,
284,
330,
17,
15,
17,
16,
12,
15,
22,
12,
17,
15,
51,
17,
18,
25,
16,
23,
25,
16,
23,
57,
876,
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_turn_right() {
let mut ship = Ship::new();
assert_eq!(ship.facing, 90);
ship.turn_right(180);
assert_eq!(ship.facing, 270);
ship.turn_right(90);
assert_eq!(ship.facing, 0);
} | rust_cleaned_test_functions.jsonl/120428 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 129
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37274,
10539,
368,
341,
286,
1077,
5206,
8284,
284,
26803,
486,
931,
543,
286,
2060,
10714,
10297,
5270,
833,
4527,
11,
220,
24,
15,
317,
286,
8284,
45634,
10539,
7,
16,
23,
15,
317,
286,
2060... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_follower_commit_entry() {
let l = default_logger();
let mut tests = vec![
(vec![new_entry(1, 2, SOME_DATA)], 2),
(
vec![
new_entry(1, 2, SOME_DATA),
new_entry(1, 3, Some("somedata2")),
],
3,
),
(
vec![
new_entry(1, 2, Some("somedata2")),
new_entry(1, 3, SOME_DATA),
],
3,
),
(
vec![
new_entry(1, 2, SOME_DATA),
new_entry(1, 3, Some("somedata2")),
],
2,
),
];
for (i, (ents, commit)) in tests.drain(..).enumerate() {
let mut r = new_test_raft(1, vec![1, 2, 3], 10, 1, new_storage(), &l);
r.become_follower(1, 2);
let mut m = new_message(2, 1, MessageType::MsgAppend, 0);
m.term = 1;
m.log_term = 1;
m.index = 1;
m.commit = commit;
m.entries = ents.clone().into();
r.step(m).expect("");
if r.raft_log.committed != commit {
panic!(
"#{}: committed = {}, want {}",
i, r.raft_log.committed, commit
);
}
let wents = Some(ents[..commit as usize - 1].to_vec());
let g = r.raft_log.next_entries();
if g != wents {
panic!("#{}: next_ents = {:?}, want {:?}", i, g, wents);
}
}
} | rust_cleaned_test_functions.jsonl/62306 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 876
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
29034,
36346,
9078,
368,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
1077,
5206,
7032,
284,
7486,
90515,
286,
320,
4083,
20703,
931,
9078,
7,
16,
11,
220,
17,
11,
65555,
7896,
25035,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_qcolor() {
let blue1 = QColor::from_name("blue");
let blue2 = QColor::from_rgb_f(0., 0., 1.);
assert_eq!(blue1.get_rgba().0, 0.);
assert_eq!(blue1.get_rgba().2, 1.);
assert!(blue1 == blue2);
let red1 = QColor::from_name("red");
let red2 = QColor::from_rgb_f(1., 0., 0.);
assert_eq!(red1.get_rgba().0, 1.);
assert_eq!(red1.get_rgba().2, 0.);
assert!(red1 == red2);
assert!(blue1 != red1);
} | rust_cleaned_test_functions.jsonl/59781 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 231
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8976,
3423,
368,
341,
262,
1077,
6303,
16,
284,
55758,
486,
1499,
1269,
445,
12203,
797,
262,
1077,
6303,
17,
284,
55758,
486,
1499,
37407,
761,
7,
15,
2572,
220,
15,
2572,
220,
16,
58957,
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_non_used_facet_collector() {
let mut facet_collector = FacetCollector::for_field(Field::from_field_id(0));
facet_collector.add_facet(Facet::from("/country"));
facet_collector.add_facet(Facet::from("/countryeurope"));
} | rust_cleaned_test_functions.jsonl/10755 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 120
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21637,
27803,
41589,
295,
10211,
27669,
368,
341,
286,
1077,
5206,
44507,
10211,
27669,
284,
16945,
295,
53694,
486,
1958,
5013,
57788,
486,
1499,
5013,
842,
7,
15,
1106,
286,
44507,
10211,
27669,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.