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_interleave() {
let res = interleave(&[&b"1234"[..], b"5678", b"abcdef", b"ghijkl"]);
assert_eq!(&*res, b"15ag26bh37ci48djekfl");
} | rust_cleaned_test_functions.jsonl/35832 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 81
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15318,
21510,
368,
341,
262,
1077,
592,
284,
946,
21510,
2099,
58,
5,
65,
1,
16,
17,
18,
19,
36864,
496,
1125,
293,
1,
20,
21,
22,
23,
497,
293,
1,
41202,
497,
293,
1,
866,
59779,
15049,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_graph() {
let mut g = Graph::new(10);
g.add_edge(0, 3);
g.add_edge(0, 5);
g.add_edge(4, 5);
g.add_edge(2, 9);
g.add_edge(2, 8);
g.add_edge(3, 7);
g.add_edge(1, 6);
g.add_edge(6, 9);
g.add_edge(5, 8);
println!("got => \n{}", g.to_dot());
assert_eq!(10, g.vertices());
assert_eq!(9, g.edges());
assert_eq!(3, g.degree(5));
for w in g.adj(5) {
assert!(vec![8, 4, 0].contains(w));
}
} | rust_cleaned_test_functions.jsonl/110514 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 272
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14738,
368,
341,
262,
1077,
5206,
342,
284,
12165,
486,
931,
7,
16,
15,
317,
262,
342,
1364,
17932,
7,
15,
11,
220,
18,
317,
262,
342,
1364,
17932,
7,
15,
11,
220,
20,
317,
262,
342,
1364,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_serialize_zeroes() {
// Test that EthernetFrame::serialize properly zeroes memory before
// serializing the header.
let mut buf_0 = [0; ETHERNET_MIN_FRAME_LEN];
Buf::new(&mut buf_0[..], ETHERNET_HDR_LEN_NO_TAG..)
.encapsulate(EthernetFrameBuilder::new(
DEFAULT_SRC_MAC,
DEFAULT_DST_MAC,
EtherType::Arp,
))
.serialize_vec_outer()
.unwrap();
let mut buf_1 = [0; ETHERNET_MIN_FRAME_LEN];
(&mut buf_1[..ETHERNET_HDR_LEN_NO_TAG]).copy_from_slice(&[0xFF; ETHERNET_HDR_LEN_NO_TAG]);
Buf::new(&mut buf_1[..], ETHERNET_HDR_LEN_NO_TAG..)
.encapsulate(EthernetFrameBuilder::new(
DEFAULT_SRC_MAC,
DEFAULT_DST_MAC,
EtherType::Arp,
))
.serialize_vec_outer()
.unwrap();
assert_eq!(&buf_0[..], &buf_1[..]);
} | rust_cleaned_test_functions.jsonl/112567 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 558
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
19359,
288,
368,
341,
286,
442,
3393,
429,
45408,
4369,
486,
24166,
10277,
97443,
4938,
1573,
198,
286,
442,
6146,
4849,
279,
4247,
624,
286,
1077,
5206,
6607,
62,
15,
284,
508,
15,
26,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pretty_format_time_64_microsecond() {
let expected = vec![
"+-----------------+",
"| f |",
"+-----------------+",
"| 00:00:11.111111 |",
"| |",
"+-----------------+",
];
check_datetime!(Time64MicrosecondArray, 11111111, expected);
} | rust_cleaned_test_functions.jsonl/5249 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 215
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
21322,
8955,
3009,
62,
21,
19,
73003,
5569,
368,
341,
286,
1077,
3601,
284,
7486,
90515,
310,
6630,
771,
12,
10,
756,
310,
25203,
282,
2290,
760,
756,
310,
6630,
771,
12,
10,
756,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simple_or_join() {
let mut schemaReplicant = SchemaReplicant::default();
associate_causetId(&mut schemaReplicant, Keyword::namespaced("page", "url"), 97);
associate_causetId(&mut schemaReplicant, Keyword::namespaced("page", "title"), 98);
associate_causetId(&mut schemaReplicant, Keyword::namespaced("page", "description"), 99);
for x in 97..100 {
add_attribute(&mut schemaReplicant, x, Attribute {
value_type: MinkowskiValueType::String,
..Default::default()
});
}
let causetq = r#"[:find [?url ?description]
:where
(or-join [?page]
[?page :page/url "http://foo.com/"]
[?page :page/title "Foo"])
[?page :page/url ?url]
[?page :page/description ?description]]"#;
let SQLCausetQ { allegrosql, args } = translate(&schemaReplicant, causetq);
assert_eq!(allegrosql, "SELECT `Causets01`.v AS `?url`, `Causets02`.v AS `?description` FROM `causets` AS `Causets00`, `causets` AS `Causets01`, `causets` AS `Causets02` WHERE ((`Causets00`.a = 97 AND `Causets00`.v = $v0) OR (`Causets00`.a = 98 AND `Causets00`.v = $v1)) AND `Causets01`.a = 97 AND `Causets02`.a = 99 AND `Causets00`.e = `Causets01`.e AND `Causets00`.e = `Causets02`.e LIMIT 1");
assert_eq!(args, vec![make_arg("$v0", "http://foo.com/"), make_arg("$v1", "Foo")]);
} | rust_cleaned_test_functions.jsonl/90711 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 679
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
8734,
31017,
368,
341,
262,
1077,
5206,
10802,
18327,
35237,
284,
12539,
18327,
35237,
486,
2258,
543,
262,
21946,
666,
11855,
295,
764,
2099,
6984,
10802,
18327,
35237,
11,
48970,
486,
11400... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 9 |
#[test]
fn test_multi_cpu() {
test_block!(tb, "", {
let mut clear = ClearDiskConfig::new();
let guest = Guest::new(&mut clear);
let mut child = Command::new("target/debug/cloud-hypervisor")
.args(&["--cpus", "2"])
.args(&["--memory", "size=512M"])
.args(&["--kernel", guest.fw_path.as_str()])
.args(&[
"--disk",
guest
.disk_config
.disk(DiskType::OperatingSystem)
.unwrap()
.as_str(),
guest
.disk_config
.disk(DiskType::CloudInit)
.unwrap()
.as_str(),
])
.args(&["--net", guest.default_net_string().as_str()])
.spawn()
.unwrap();
thread::sleep(std::time::Duration::new(20, 0));
aver_eq!(tb, guest.get_cpu_count().unwrap_or_default(), 2);
guest.ssh_command("sudo reboot")?;
thread::sleep(std::time::Duration::new(10, 0));
let _ = child.kill();
let _ = child.wait();
Ok(())
});
} | rust_cleaned_test_functions.jsonl/55938 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 801
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25133,
21795,
368,
341,
286,
1273,
7113,
10297,
18387,
11,
7342,
341,
310,
1077,
5206,
2797,
284,
12023,
47583,
2648,
486,
931,
543,
310,
1077,
8640,
284,
26215,
486,
931,
2099,
6984,
2797,
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... | 2 |
#[test]
fn test_create_cred_def_without_rev_will_have_no_rev_id() {
init!("ledger");
let (_, handle) = create_cred_def_real(false);
let rev_reg_id = get_rev_reg_id(handle).unwrap();
assert!(rev_reg_id.is_none());
let (_, handle) = create_cred_def_real(true);
let rev_reg_id = get_rev_reg_id(handle).unwrap();
assert!(rev_reg_id.is_some());
} | rust_cleaned_test_functions.jsonl/64617 | {
"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,
8657,
73475,
7844,
39904,
38082,
1670,
483,
67301,
6536,
38082,
842,
368,
341,
286,
2930,
17223,
50704,
797,
286,
1077,
39464,
3705,
8,
284,
1855,
73475,
7844,
15266,
3576,
317,
286,
1077,
5772,
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_rposition() {
fn f(xy: &(isize, char)) -> bool { let (_x, y) = *xy; y == 'b' }
fn g(xy: &(isize, char)) -> bool { let (_x, y) = *xy; y == 'd' }
let v = [(0, 'a'), (1, 'b'), (2, 'c'), (3, 'b')];
assert_eq!(v.iter().rposition(f), Some(3));
assert!(v.iter().rposition(g).is_none());
} | rust_cleaned_test_functions.jsonl/25948 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 164
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
3487,
368,
341,
262,
5168,
282,
93219,
25,
22796,
285,
551,
11,
1161,
593,
1464,
1807,
314,
1077,
5453,
87,
11,
379,
8,
284,
353,
4130,
26,
379,
621,
364,
65,
6,
456,
262,
5168,
342,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dquoted_name() -> Result<()> {
let name = SqlName::new("safe_name").dquoted();
assert_eq!(&name, "\"safe_name\"");
let name = SqlName::new("safe_name").alias("sn").dquoted();
assert_eq!(&name, "\"safe_name\" AS sn");
let name = SqlName::new("safe_name").add("sub").alias("sn").dquoted();
assert_eq!(&name, "\"safe_name\".\"sub\" AS sn");
let name = dname!("safe_name");
assert_eq!(&name, "\"safe_name\"");
let name = dname!("safe_name"; "sn");
assert_eq!(&name, "\"safe_name\" AS sn");
let name = dname!("safe_name", "sub"; "sn");
assert_eq!(&name, "\"safe_name\".\"sub\" AS sn");
Ok(())
} | rust_cleaned_test_functions.jsonl/74810 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 343
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
63725,
1269,
368,
1464,
5714,
71698,
341,
286,
1077,
829,
284,
7224,
675,
486,
931,
445,
18675,
1269,
1827,
67,
63725,
543,
286,
2060,
10714,
0,
2099,
606,
11,
15898,
18675,
1269,
2105,
307... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_failed_name_server() {
let mut options = ResolverOpts::default();
options.timeout = Duration::from_millis(1);
let config = NameServerConfig {
socket_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 252)), 252),
protocol: Protocol::Udp,
tls_dns_name: None,
#[cfg(feature = "dns-over-rustls")]
tls_config: None,
};
let mut io_loop = Runtime::new().unwrap();
let runtime_handle = io_loop.handle().clone();
let name_server = future::lazy(|_| {
NameServer::<_, TokioConnectionProvider>::new(config, options, runtime_handle)
});
let name = Name::parse("www.example.com.", None).unwrap();
assert!(io_loop
.block_on(name_server.then(|mut name_server| name_server.lookup(
Query::query(name.clone(), RecordType::A),
DnsRequestOptions::default()
)))
.is_err());
} | rust_cleaned_test_functions.jsonl/90659 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 493
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35060,
1269,
12015,
368,
341,
286,
1077,
5206,
2606,
284,
81854,
43451,
486,
2258,
543,
286,
2606,
36110,
284,
21045,
486,
1499,
717,
56212,
7,
16,
1215,
715,
286,
1077,
2193,
284,
3988,
5475,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extract_mix_version() -> io::Result<()> {
let config_name = "mix.exs";
let config_content = "defmodule MyApp.MixProject do
use Mix.Project
def project do
[
app: :my_app,
version: \"1.2.3\",
elixir: \"~> 1.10\",
start_permanent: Mix.env() == :prod,
deps: deps()
]
end
# Run \"mix help compile.app\" to learn about applications.
def application do
[extra_applications: [:logger]]
end
# Run \"mix help deps\" to learn about dependencies.
defp deps do
[]
end
end";
let project_dir = create_project_dir()?;
fill_config(&project_dir, config_name, Some(&config_content))?;
expect_output(&project_dir, Some("v1.2.3"), None)?;
project_dir.close()
} | rust_cleaned_test_functions.jsonl/19248 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 339
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
67729,
9438,
368,
1464,
6399,
486,
2077,
71698,
341,
286,
1077,
2193,
1269,
284,
330,
35071,
2223,
82,
876,
286,
1077,
2193,
7495,
284,
330,
750,
4352,
54016,
1321,
941,
7849,
653,
198,
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... | 4 |
#[test]
fn test_file_with_dir() {
let (dir, name, ext) = file_path_name_ext("my/assets/123/bb/image.png");
assert_eq!(dir, Some("my/assets/123/bb"));
assert_eq!(name, "image");
assert_eq!(ext, Some("png"));
} | rust_cleaned_test_functions.jsonl/5163 | {
"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,
2458,
6615,
4334,
368,
341,
286,
1077,
320,
3741,
11,
829,
11,
1303,
8,
284,
1034,
2638,
1269,
9927,
445,
2408,
21442,
14,
16,
17,
18,
3470,
65,
23349,
3508,
797,
286,
2060,
10714,
10297,
3741... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hint_not_masked_by_doctest() {
let p = project()
.file(
"src/lib.rs",
r#"
/// ```
/// assert_eq!(1, 1);
/// ```
pub fn this_works() {}
"#,
)
.file(
"tests/integ.rs",
r#"
#[test]
fn this_fails() {
panic!();
}
"#,
)
.build();
p.cargo("test --no-fail-fast")
.with_status(101)
.with_stdout_contains("test this_fails ... FAILED")
.with_stdout_contains("[..]this_works (line [..]ok")
.with_stderr_contains(
"[ERROR] test failed, to rerun pass \
'--test integ'",
)
.run();
} | rust_cleaned_test_functions.jsonl/95377 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 486
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45825,
7913,
9999,
291,
3710,
26309,
67880,
368,
341,
262,
1077,
281,
284,
2390,
741,
286,
659,
1192,
1006,
310,
330,
3548,
8194,
25638,
756,
310,
435,
2,
698,
310,
1048,
41233,
310,
1048,
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_source_code_hash() {
assert_eq!(
"7e44de2ed9e0065da09d835b76b8d70be503d276",
source_code_hash("hello.ts", b"1+2", "0.2.11")
);
// Different source_code should result in different hash.
assert_eq!(
"57033366cf9db1ef93deca258cdbcd9ef5f4bde1",
source_code_hash("hello.ts", b"1", "0.2.11")
);
// Different filename should result in different hash.
assert_eq!(
"19657f90b5b0540f87679e2fb362e7bd62b644b0",
source_code_hash("hi.ts", b"1+2", "0.2.11")
);
// Different version should result in different hash.
assert_eq!(
"e2b4b7162975a02bf2770f16836eb21d5bcb8be1",
source_code_hash("hi.ts", b"1+2", "0.2.0")
);
} | rust_cleaned_test_functions.jsonl/83865 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 365
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10347,
4136,
8950,
368,
341,
262,
2060,
10714,
33673,
414,
330,
22,
68,
19,
19,
450,
17,
291,
24,
68,
15,
15,
21,
20,
3235,
15,
24,
67,
23,
18,
20,
65,
22,
21,
65,
23,
67,
22,
15,
1371... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ptr_subtraction() {
unsafe {
let xs = vec![0,1,2,3,4,5,6,7,8,9];
let mut idx = 9;
let ptr = xs.as_ptr();
while idx >= 0 {
assert_eq!(*(ptr.offset(idx as isize)), idx as isize);
idx = idx - 1;
}
let mut xs_mut = xs;
let m_start = xs_mut.as_mut_ptr();
let mut m_ptr = m_start.offset(9);
loop {
*m_ptr += *m_ptr;
if m_ptr == m_start {
break;
}
m_ptr = m_ptr.offset(-1);
}
assert_eq!(xs_mut, [0,2,4,6,8,10,12,14,16,18]);
}
} | rust_cleaned_test_functions.jsonl/18503 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 398
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4348,
5228,
26425,
368,
341,
262,
19860,
341,
286,
1077,
11943,
284,
7486,
20703,
15,
11,
16,
11,
17,
11,
18,
11,
19,
11,
20,
11,
21,
11,
22,
11,
23,
11,
24,
935,
286,
1077,
5206,
7187,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_choose() {
let mut r = task_rng();
assert_eq!(r.choose([1i, 1, 1]).map(|&x|x), Some(1));
let v: &[int] = &[];
assert_eq!(r.choose(v), None);
} | rust_cleaned_test_functions.jsonl/23765 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 118
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77433,
368,
341,
286,
1077,
5206,
435,
284,
3383,
66849,
543,
286,
2060,
10714,
10297,
81,
78824,
2561,
16,
72,
11,
220,
16,
11,
220,
16,
10697,
2186,
22428,
5,
87,
62827,
701,
4329,
7,
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_from_shear_x() {
let shear_x_with_y = 5;
let shear_x_with_z = 3;
let matrix = Matrix3x3::from_shear_x(shear_x_with_y, shear_x_with_z);
let expected = Vector3::new(1 + shear_x_with_y + shear_x_with_z, 1, 1);
let result = matrix * Vector3::new(1, 1, 1);
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/129041 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
643,
86060,
3212,
368,
341,
286,
1077,
64244,
3212,
6615,
4178,
284,
220,
20,
280,
286,
1077,
64244,
3212,
6615,
6415,
284,
220,
18,
280,
286,
1077,
6172,
284,
11631,
18,
87,
18,
486,
14... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fr_bytes() {
let f1_from_repr = Fr::from(BigInteger([
0xc81265fb4130fe0c,
0xb308836c14e22279,
0x699e887f96bff372,
0x84ecc7e76c11ad,
]));
let mut f1_bytes = [0u8; 32];
f1_from_repr.write(f1_bytes.as_mut()).unwrap();
let f1 = Fr::read(f1_bytes.as_ref()).unwrap();
assert_eq!(f1_from_repr, f1);
} | rust_cleaned_test_functions.jsonl/81834 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 215
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41537,
12524,
368,
341,
262,
1077,
282,
16,
5673,
68535,
284,
2869,
486,
1499,
91756,
8956,
286,
220,
15,
8148,
23,
16,
17,
21,
20,
10798,
19,
16,
18,
15,
1859,
15,
66,
345,
286,
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_add_vote_pubkey() {
let total_epoch_stake = 10;
let mut vote_stake_tracker = VoteStakeTracker::default();
for i in 0..10 {
let pubkey = safecoin_sdk::pubkey::new_rand();
let (is_confirmed_thresholds, is_new) = vote_stake_tracker.add_vote_pubkey(
pubkey,
1,
total_epoch_stake,
&[VOTE_THRESHOLD_SIZE, 0.0],
);
let stake = vote_stake_tracker.stake();
let (is_confirmed_thresholds2, is_new2) = vote_stake_tracker.add_vote_pubkey(
pubkey,
1,
total_epoch_stake,
&[VOTE_THRESHOLD_SIZE, 0.0],
);
let stake2 = vote_stake_tracker.stake();
// Stake should not change from adding same pubkey twice
assert_eq!(stake, stake2);
assert!(!is_confirmed_thresholds2[0]);
assert!(!is_confirmed_thresholds2[1]);
assert!(!is_new2);
assert_eq!(is_confirmed_thresholds.len(), 2);
assert_eq!(is_confirmed_thresholds2.len(), 2);
// the supermajority threshold
if i == 6 {
assert!(is_confirmed_thresholds[0]);
} else {
assert!(!is_confirmed_thresholds[0]);
}
if i == 0 {
assert!(is_confirmed_thresholds[1]);
} else {
assert!(!is_confirmed_thresholds[1]);
}
assert!(is_new);
}
} | rust_cleaned_test_functions.jsonl/43876 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 940
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
54360,
34014,
792,
368,
341,
286,
1077,
2790,
20682,
1261,
726,
284,
220,
16,
15,
280,
286,
1077,
5206,
6910,
1261,
726,
50264,
284,
34034,
623,
726,
31133,
486,
2258,
543,
286,
369,
600,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_unicode_str() {
let s = "知ら ない の か ? 死神 の 霊 絡 は 色 が 違う って こと 。";
let source = s.as_bytes();
assert_eq!(
unicode_str(source, 25),
Ok((&source[25..], "知ら ない の か ?"))
);
} | rust_cleaned_test_functions.jsonl/6834 | {
"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,
54662,
2895,
368,
341,
310,
1077,
274,
284,
330,
52183,
32403,
220,
123861,
96618,
220,
31049,
220,
11319,
71928,
119,
99315,
96618,
18137,
250,
232,
10236,
113,
94,
220,
15322,
8908,
231,
110,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_header_1_tb_file() {
let mut header = test_huge_header();
// reset to 1 TB size.
header[24] = 0;
header[26] = 1;
header[31] = 0;
// set cluster_bits
header[23] = 16;
with_basic_file(&header, |disk_file: RawFile| {
let mut qcow = QcowFile::from(disk_file).expect("Failed to create file.");
qcow.seek(SeekFrom::Start(0x100_0000_0000 - 8))
.expect("Failed to seek.");
let value = 0x0000_0040_3f00_ffffu64;
qcow.write_all(&value.to_le_bytes())
.expect("failed to write data");
});
} | rust_cleaned_test_functions.jsonl/96730 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 347
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8757,
62,
16,
23481,
2458,
368,
341,
286,
1077,
5206,
4247,
284,
1273,
1523,
4733,
8757,
543,
286,
442,
7585,
311,
220,
16,
30080,
1379,
624,
286,
4247,
58,
17,
19,
60,
284,
220,
15,
280,
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_vector_2() {
let secp = Secp256k1::new();
let seed = Vec::from_hex("fffcf9f6f3f0edeae7e4e1dedbd8d5d2cfccc9c6c3c0bdbab7b4b1aeaba8a5a29f9c999693908d8a8784817e7b7875726f6c696663605d5a5754514e4b484542").unwrap();
// m
test_path(&secp, Groestlcoin, &seed, "m".parse().unwrap(),
"xprv9s21ZrQH143K31xYSDQpPDxsXRTUcvj2iNHm5NUtrGiGG5e2DtALGdso3pGz6ssrdK4PFmM8NSpSBHNqPqm55Qn3LqFtT2emdEXVYuQwb61",
"xpub661MyMwAqRbcFW31YEwpkMuc5THy2PSt5bDMsktWQcFF8syAmRUapSCGu8ED9W6oDMSgv6Zz8idoc4a6mr8BDzTJY47LJhkJ8UB7WEnLmau");
// m/0
test_path(&secp, Groestlcoin, &seed, "m/0".parse().unwrap(),
"xprv9vHkqa6EV4sPZHYqZznhT2NPtPCjKuDKGY38FBWLvgaDx45zo9WQRUT3dKYnjwih2yJD9mkrocEZXo1ex8G81dwSM1fwqWpWkeS3v91JqEk",
"xpub69H7F5d8KSRgmmdJg2KhpAK8SR3DjMwAdkxj3ZuxV27CprR9LgpeyGmXUbC6wb7ERfvrnKZjXoUmmDznezpbZb7ap6r1D3tgFxHmwLQLwEp");
// m/0/2147483647h
test_path(&secp, Groestlcoin, &seed, "m/0/2147483647h".parse().unwrap(),
"xprv9wSp6B7kry3Vj9m1zSnLvN3xH8RdsPP1Mh7fAaR7aRLcQMKTR2vidYEeEg2mUCTAwCd6vnxVrcjfy2kRgVsFawNzmjuHc2YmYRmagcCNNxs",
"xpub6ASAVgeehLbnwdqV6UKMHVzgqAG8Gr6riv3Fxxpj8ksbH9ebxaEyBLZ85ySDhKiLDBrQSARLq1uNRts8RuJiHjaDMBU4Zn9h8LZNn8iVEU3");
// m/0/2147483647h/1
test_path(&secp, Groestlcoin, &seed, "m/0/2147483647h/1".parse().unwrap(),
"xprv9zFnWC6h2cLgpmSA46vutJzBcfJ8yaJGg8cX1e5StJh45BBciYTRXSd25UEPVuesF9yog62tGAQtHjXajPPdbRCHuWS6T8XA2ECKAHLYSNU",
"xpub6DF8uhdarytz3FWdA8TvFSvvAh8dP3283MY7p2V4SeE2wyWmG5mg5EwVvmdMVCQcoNJxGoWaU9DCWh89LojfZ537wTfunKau47EL2fD1q27");
// m/0/2147483647h/1/2147483646h
test_path(&secp, Groestlcoin, &seed, "m/0/2147483647h/1/2147483646h".parse().unwrap(),
"xprvA1RpRA33e1JQ7ifknakTFpgNXPmW2YvmhqLQYMmrj4xJXXWYpDPS3xz7iAxn8L39njGVyuoseXzU6rcxFLJ8HFsTjSyQbLYnMpCqE2xkRVH",
"xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZWpDjjp");
// m/0/2147483647h/1/2147483646h/2
test_path(&secp, Groestlcoin, &seed, "m/0/2147483647h/1/2147483646h/2".parse().unwrap(),
"xprvA2nrNbFZABcdryreWet9Ea4LvTJcGsqrMzxHx98MMrotbir7yrKCEXw7nadnHM8Dq38EGfSh6dqA9QWTyefMLEcBYJUuekgW4BYPJehxXBR",
"xpub6FnCn6nSzZAw5Tw7cgR9bi15UV96gLZhjDstkXXxvCLsUXBGXPdSnLFbdpq8p9HmGsApME5hQTZ3emM2rnY5agb9rXpVGyy3bdW6ECExJ4d");
} | rust_cleaned_test_functions.jsonl/2908 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1742
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12247,
62,
17,
368,
341,
286,
1077,
511,
4672,
284,
4520,
79,
17,
20,
21,
74,
16,
486,
931,
543,
286,
1077,
10320,
284,
11312,
486,
1499,
32655,
445,
542,
8316,
69,
24,
69,
21,
69,
18,
69,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_remove_dim_error_dim_dot_defined()
{
const UNDEF_DIM_NAME: &str = "undef_dim";
let mut data_set = DataSet::new();
assert_eq!(0, data_set.num_dims());
assert_eq!(false, data_set.has_unlimited_dim());
assert_eq!(false, data_set.has_dim(UNDEF_DIM_NAME));
assert_eq!(None, data_set.dim_size(UNDEF_DIM_NAME));
assert_eq!(None, data_set.dim_type(UNDEF_DIM_NAME));
// Try to remove an undefined dimension
assert_eq!(
InvalidDataSet::DimensionNotDefined(UNDEF_DIM_NAME.to_string()),
data_set.remove_dim(UNDEF_DIM_NAME).unwrap_err()
);
assert_eq!(0, data_set.num_dims());
assert_eq!(false, data_set.has_unlimited_dim());
assert_eq!(false, data_set.has_dim(UNDEF_DIM_NAME));
assert_eq!(None, data_set.dim_size(UNDEF_DIM_NAME));
assert_eq!(None, data_set.dim_type(UNDEF_DIM_NAME));
} | rust_cleaned_test_functions.jsonl/40515 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 431
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
10791,
4096,
10791,
30941,
52870,
741,
515,
262,
733,
6643,
13649,
39302,
4708,
25,
609,
495,
284,
330,
16135,
10791,
3302,
262,
1077,
5206,
821,
2602,
284,
27036,
486,
931,
1428,
262,
2060... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_set_registration_encoding() {
run_async_test(async {
ffx_config::set((CONFIG_KEY_REGISTRATIONS, ConfigLevel::User), json!({}))
.await
.unwrap();
set_registration(
"target.name",
&RepositoryTarget {
repo_name: "repo.name".into(),
target_identifier: Some("target.name".into()),
aliases: vec![],
storage_type: None,
},
)
.await
.unwrap();
set_registration(
"target%name",
&RepositoryTarget {
repo_name: "repo%name".into(),
target_identifier: Some("target%name".into()),
aliases: vec![],
storage_type: None,
},
)
.await
.unwrap();
assert_eq!(
ffx_config::get::<Value, _>(CONFIG_KEY_REGISTRATIONS).await.unwrap(),
json!({
"repo%2Ename": {
"target%2Ename": {
"repo_name": "repo.name",
"target_identifier": "target.name",
"aliases": [],
"storage_type": (),
},
},
"repo%25name": {
"target%25name": {
"repo_name": "repo%name",
"target_identifier": "target%name",
"aliases": [],
"storage_type": (),
},
}
}),
);
});
} | rust_cleaned_test_functions.jsonl/98267 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1226
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
49101,
37613,
368,
341,
286,
1598,
28346,
4452,
18285,
341,
310,
282,
8298,
5332,
486,
746,
1188,
24652,
6600,
8064,
29503,
21792,
11,
5532,
4449,
486,
1474,
701,
2951,
0,
2306,
44194,
394,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_buffer_serializer_and_inner_serializer() {
fn verify_buffer_serializer<B: BufferMut + Debug>(
buffer: B,
prefix_len: usize,
suffix_len: usize,
min_body_len: usize,
) {
let old_len = buffer.len();
let mut old_body = Vec::with_capacity(old_len);
old_body.extend_from_slice(buffer.as_ref());
let buffer = BufferSerializer::new_vec(buffer)
.serialize(SerializeConstraints { prefix_len, suffix_len, min_body_len })
.unwrap();
verify(buffer, &old_body, prefix_len, suffix_len, min_body_len);
}
fn verify_inner_serializer(
body: &[u8],
buf_len: usize,
prefix_len: usize,
suffix_len: usize,
min_body_len: usize,
) {
let buffer = InnerSerializer::new_vec(body, Buf::new(vec![0; buf_len], ..))
.serialize(SerializeConstraints { prefix_len, suffix_len, min_body_len })
.unwrap();
verify(buffer, body, prefix_len, suffix_len, min_body_len);
}
fn verify<B: Buffer>(
buffer: B,
body: &[u8],
prefix_len: usize,
suffix_len: usize,
min_body_len: usize,
) {
assert_eq!(buffer.as_ref(), body);
assert!(buffer.prefix_len() >= prefix_len);
assert!(buffer.suffix_len() >= suffix_len);
assert!(buffer.len() + buffer.suffix_len() >= (min_body_len + suffix_len));
}
for buf_len in 0..8 {
for range_start in 0..buf_len {
for range_end in range_start..buf_len {
for prefix in 0..8 {
for suffix in 0..8 {
for min_body in 0..8 {
let mut vec = vec![0; buf_len];
// the range bytes have been properly copied if
// the buffer is reallocated.
#[allow(clippy::needless_range_loop)]
for i in 0..vec.len() {
vec[i] = i as u8;
}
verify_buffer_serializer(
Buf::new(vec.as_mut_slice(), range_start..range_end),
prefix,
suffix,
min_body,
);
verify_inner_serializer(
&vec.as_slice()[range_start..range_end],
buf_len,
prefix,
suffix,
min_body,
);
}
}
}
}
}
}
} | rust_cleaned_test_functions.jsonl/83354 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2037
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7776,
67441,
8378,
34345,
67441,
368,
341,
286,
5168,
10146,
7776,
67441,
32519,
25,
10312,
51440,
488,
11091,
17055,
310,
4147,
25,
425,
345,
310,
9252,
6043,
25,
22301,
345,
310,
20525,
6043,
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_display() {
let mut expected = "id portion ('abcd') of mention is not a u64";
assert_eq!(
expected,
ParseMentionError::IdNotU64 {
found: "abcd",
source: "abcd".parse::<u64>().unwrap_err(),
}
.to_string(),
);
expected = "expected to find a leading arrow ('<') but instead found 'a'";
assert_eq!(
expected,
ParseMentionError::LeadingArrow { found: Some('a') }.to_string(),
);
expected = "expected to find a leading arrow ('<') but instead found nothing";
assert_eq!(
expected,
ParseMentionError::LeadingArrow { found: None }.to_string(),
);
expected = "expected to find a mention sigil ('@') but instead found '#'";
assert_eq!(
expected,
ParseMentionError::Sigil {
expected: &["@"],
found: Some('#')
}
.to_string(),
);
expected = "expected to find a mention sigil ('@') but instead found nothing";
assert_eq!(
expected,
ParseMentionError::Sigil {
expected: &["@"],
found: None
}
.to_string(),
);
expected = "expected to find a mention sigil ('@!', '@') but instead found '#'";
assert_eq!(
expected,
ParseMentionError::Sigil {
expected: &["@!", "@"],
found: Some('#'),
}
.to_string(),
);
expected = "expected to find a mention sigil ('@!', '@') but instead found nothing";
assert_eq!(
expected,
ParseMentionError::Sigil {
expected: &["@!", "@"],
found: None
}
.to_string(),
);
expected = "expected to find a trailing arrow ('>') but instead found 'a'";
assert_eq!(
expected,
ParseMentionError::TrailingArrow { found: Some('a') }.to_string(),
);
expected = "expected to find a trailing arrow ('>') but instead found nothing";
assert_eq!(
expected,
ParseMentionError::TrailingArrow { found: None }.to_string(),
);
} | rust_cleaned_test_functions.jsonl/35282 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1214
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14825,
368,
341,
286,
1077,
5206,
3601,
284,
330,
307,
13348,
4319,
68644,
863,
315,
6286,
374,
537,
264,
575,
21,
19,
876,
286,
2060,
10714,
33673,
310,
3601,
345,
310,
14775,
44,
2939,
1454,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_json_path_expr_contains_any_asterisk() {
let mut test_cases = vec![
("$.a[b]", false),
("$.a[*]", true),
("$.*[b]", true),
("$**.a[b]", true),
];
for (i, (path_expr, expected)) in test_cases.drain(..).enumerate() {
let r = parse_json_path_expr(path_expr);
assert!(r.is_ok(), "#{} expect parse ok but got err {:?}", i, r);
let e = r.unwrap();
let b = e.contains_any_asterisk();
assert_eq!(b, expected, "#{} expect {:?} but got {:?}", i, expected, b);
}
} | rust_cleaned_test_functions.jsonl/43062 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 341
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
9455,
2638,
21915,
63598,
37248,
62,
2300,
3187,
368,
341,
286,
1077,
5206,
1273,
41427,
284,
7486,
90515,
310,
3489,
12947,
64,
18483,
19076,
895,
1326,
310,
3489,
12947,
64,
33836,
19076,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_get_memory() -> Result<(), Box<dyn Error>> {
test_init()?;
let memory = Device::get_device(0)?.total_memory()?;
println!("{}", memory);
Ok(())
} | rust_cleaned_test_functions.jsonl/39770 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
19195,
368,
1464,
5714,
68843,
8261,
92846,
4600,
2452,
341,
286,
1273,
6137,
94136,
286,
1077,
4938,
284,
13903,
486,
455,
9204,
7,
15,
43507,
5035,
19195,
94136,
286,
13751,
79878,
4938,
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
] | 4 |
#[test]
fn test_parse_polygon() {
let poly_str = r#"<Polygon>
<outerBoundaryIs>
<LinearRing>
<tessellate>1</tessellate>
<coordinates>
-1,2,0
-1.5,3,0
-1.5,2,0
-1,2,0
</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>"#;
let mut r = KmlReader::from_string(poly_str);
let p: Kml = r.read().unwrap();
assert_eq!(
p,
Kml::Polygon(Polygon {
outer: LinearRing {
coords: vec![
Coord {
x: -1.,
y: 2.,
z: Some(0.)
},
Coord {
x: -1.5,
y: 3.,
z: Some(0.)
},
Coord {
x: -1.5,
y: 2.,
z: Some(0.)
},
Coord {
x: -1.,
y: 2.,
z: Some(0.)
},
],
tessellate: true,
..Default::default()
},
inner: vec![],
..Default::default()
})
);
} | rust_cleaned_test_functions.jsonl/94661 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
73542,
368,
341,
286,
1077,
9861,
2895,
284,
435,
2,
22476,
37619,
397,
286,
366,
2676,
57977,
3872,
397,
688,
366,
31898,
43466,
397,
310,
366,
83,
433,
613,
349,
29,
16,
522,
83,
433,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_noto_serif() {
run_test(
&TEST_DATA,
"harfbuzz/good-noto-serif.hi",
"noto/NotoSerifDevanagari-Regular.ttf",
&[JOINER_GLYPH_INDEX],
27,
);
} | rust_cleaned_test_functions.jsonl/91148 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 225
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1089,
2072,
75861,
333,
368,
341,
394,
1598,
4452,
1006,
503,
609,
10033,
7896,
345,
503,
330,
12982,
10798,
8889,
4846,
1386,
29169,
78,
27566,
860,
72,
756,
503,
330,
1921,
78,
20290,
2072,
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_transfer_non_member() {
setup_for_test();
let mut raft = new_test_raft(1, vec![2, 3, 4], 5, 1, new_storage());
raft.step(new_message(2, 1, MessageType::MsgTimeoutNow, 0))
.expect("");;
raft.step(new_message(2, 1, MessageType::MsgRequestVoteResponse, 0))
.expect("");;
raft.step(new_message(3, 1, MessageType::MsgRequestVoteResponse, 0))
.expect("");;
assert_eq!(raft.state, StateRole::Follower);
} | rust_cleaned_test_functions.jsonl/107176 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 204
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35403,
21637,
19388,
368,
341,
262,
6505,
5478,
4452,
543,
262,
1077,
5206,
52455,
284,
501,
4452,
62,
2944,
7,
16,
11,
7486,
20703,
17,
11,
220,
18,
11,
220,
19,
1125,
220,
20,
11,
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_into_alogithm_id() {
assert_eq!(
Into::<TPM2_ALG_ID>::into(MaskGenerationFunction::Mgf1),
TPM2_ALG_MGF1
);
} | rust_cleaned_test_functions.jsonl/41513 | {
"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,
45514,
8418,
538,
410,
76,
842,
368,
341,
286,
2060,
10714,
33673,
310,
31645,
27638,
4239,
44,
17,
8912,
38,
3450,
6831,
18122,
3189,
1073,
37138,
5152,
486,
44,
45124,
16,
1326,
310,
63644,
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 |
#[test]
fn test_length() {
let vec1 = Vec3::new(0.0, 1.0, 2.0);
let vec2 = Vec3::new(2.0, 1.0, 0.0);
let root5 = 5.0_f64.sqrt();
assert_eq!(vec1.length(), root5);
assert_eq!(vec2.length(), root5);
} | rust_cleaned_test_functions.jsonl/39249 | {
"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,
5118,
368,
341,
286,
1077,
7486,
16,
284,
11312,
18,
486,
931,
7,
15,
13,
15,
11,
220,
16,
13,
15,
11,
220,
17,
13,
15,
317,
286,
1077,
7486,
17,
284,
11312,
18,
486,
931,
7,
17,
13,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_no_std_default() {
assert_de_tokens(
&ContainsNoStdDefault { a: NoStdDefault(123) },
&[Token::Struct { name: "ContainsNoStdDefault", len: 1 }, Token::StructEnd],
);
assert_de_tokens(
&ContainsNoStdDefault { a: NoStdDefault(8) },
&[
Token::Struct { name: "ContainsNoStdDefault", len: 1 },
Token::Str("a"),
Token::NewtypeStruct { name: "NoStdDefault" },
Token::I8(8),
Token::StructEnd,
],
);
} | rust_cleaned_test_functions.jsonl/58607 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 272
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
15656,
9993,
368,
341,
262,
2060,
2259,
28838,
1006,
286,
609,
23805,
2753,
22748,
3675,
314,
264,
25,
2308,
22748,
3675,
7,
16,
17,
18,
8,
1153,
286,
44590,
3323,
486,
9422,
314,
829,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_idxvec() {
{
// Var
let mut values = VarVec::new();
for v in (0..10).map(Var::from_idx) {
values.push(v.val());
}
for (i, v) in (0..10).map(Var::from_idx).enumerate() {
let x = values[v];
assert_eq!(x, i as u32);
}
}
{
// Lit
let mut values = LitVec::new();
for v in (0..10).map(Var::from_idx) {
let x = Lit::from(v);
values.push(x.val());
}
for (i, lit) in (0..10).map(Var::from_idx).map(Lit::from).enumerate() {
let x = values[lit];
assert_eq!(x, i as u32);
}
assert!(values.len() == 10);
}
} | rust_cleaned_test_functions.jsonl/57149 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 524
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7258,
4083,
368,
341,
286,
341,
310,
442,
8735,
198,
310,
1077,
5206,
2750,
284,
8735,
10050,
486,
931,
543,
310,
369,
348,
304,
320,
15,
496,
16,
15,
568,
2186,
7,
3962,
486,
1499,
7258,
8,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_css_parse_1() {
use prelude::{ColorU, StyleBackgroundColor};
let parsed_css = Css::new_from_str("
div#my_id .my_class:first {
background-color: red;
}
").unwrap();
let expected_css = Css {
rules: vec![
CssRuleBlock {
path: CssPath {
selectors: vec![
CssPathSelector::Type(NodeTypePath::Div),
CssPathSelector::Id(String::from("my_id")),
CssPathSelector::Class(String::from("my_class")),
CssPathSelector::PseudoSelector(CssPathPseudoSelector::First),
],
},
declarations: vec![CssDeclaration::Static(ParsedCssProperty::BackgroundColor(StyleBackgroundColor(ColorU { r: 255, g: 0, b: 0, a: 255 })))],
}
],
needs_relayout: true,
#[cfg(debug_assertions)]
hot_reload_path: None,
#[cfg(debug_assertions)]
hot_reload_override_native: false,
};
assert_eq!(parsed_css, expected_css);
} | rust_cleaned_test_functions.jsonl/22822 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 690
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25924,
21039,
62,
16,
368,
8022,
262,
990,
855,
52538,
22964,
1636,
52,
11,
11913,
29546,
16863,
262,
1077,
15676,
25924,
284,
79214,
486,
931,
5673,
2895,
445,
319,
286,
3429,
2,
2408,
842,
659... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vcpu_config() {
let vm_resources = default_vm_resources();
let expected_vcpu_config = VcpuConfig {
vcpu_count: vm_resources.vm_config().vcpu_count,
smt: vm_resources.vm_config().smt,
cpu_template: vm_resources.vm_config().cpu_template,
};
let vcpu_config = vm_resources.vcpu_config();
assert_eq!(vcpu_config, expected_vcpu_config);
} | rust_cleaned_test_functions.jsonl/61585 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 205
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
16475,
5332,
368,
341,
286,
1077,
10995,
35569,
284,
1638,
39008,
35569,
543,
286,
1077,
3601,
2273,
16475,
5332,
284,
647,
16475,
2648,
341,
310,
348,
16475,
3180,
25,
10995,
35569,
38659,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_file_list_recursive() -> Result<()> {
let gh_token = env::github_token(&None::<String>)?;
let file_list = get_file_list_recursive(&gh_token, "suecharo", "gh-trs", ".", "main")?;
assert!(file_list.contains(&PathBuf::from("README.md")));
assert!(file_list.contains(&PathBuf::from("LICENSE")));
assert!(file_list.contains(&PathBuf::from("src/main.rs")));
Ok(())
} | rust_cleaned_test_functions.jsonl/6707 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 206
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
2458,
2019,
66242,
368,
1464,
5714,
71698,
341,
286,
1077,
36124,
6458,
284,
6105,
486,
5204,
6458,
2099,
4064,
27638,
703,
9231,
37445,
286,
1077,
1034,
2019,
284,
633,
2458,
2019,
66242,
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_limit_right_x() {
let mut pane = gen_pane!(OpenOptions::new().write(true).open("/dev/null").unwrap());
let width: u16 = 20;
let height: u16 = 0;
pane.replace_termsize_getter(Box::new(TestTerminal::new(width, height)));
let max_text_length = 10;
assert_eq!(pane.limit_right_x(0, max_text_length).unwrap(), 0);
assert_eq!(pane.limit_right_x(5, max_text_length).unwrap(), 0);
assert_eq!(pane.limit_right_x(20, max_text_length).unwrap(), 0);
let max_text_length = 50;
assert_eq!(pane.limit_right_x(0, max_text_length).unwrap(), 0);
assert_eq!(pane.limit_right_x(20, max_text_length).unwrap(), 20);
assert_eq!(
pane.limit_right_x(40, max_text_length).unwrap(),
// remain 10
max_text_length - width + Pane::MARGIN_RIGHT_WIDTH
);
} | rust_cleaned_test_functions.jsonl/1690 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 438
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14763,
10539,
3212,
368,
341,
286,
1077,
5206,
37322,
284,
4081,
620,
2145,
10297,
5002,
3798,
486,
931,
1005,
4934,
3715,
568,
2508,
4283,
3583,
19293,
1827,
15454,
1423,
286,
1077,
2374,
25,
575... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vector3() {
let data = &[0xdd; 50];
let key = &[0xaa; 20];
let expected = "125d7342b9ac11cd91a39af48aa17b4f63f175d3";
let mut hash = HmacSha::new(key, data, Sha1::default());
let buf = hash.compute_digest();
assert_eq!(hex::encode(buf), expected);
} | rust_cleaned_test_functions.jsonl/90605 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 176
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12247,
18,
368,
341,
1789,
286,
1077,
821,
284,
44590,
15,
53432,
26,
220,
20,
15,
935,
286,
1077,
1376,
284,
44590,
15,
43300,
26,
220,
17,
15,
935,
286,
1077,
3601,
284,
330,
16,
17,
20,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_repr_cycle() {
assert::eq("l = []; l.append(l); repr(l)", "'[[...]]'");
assert::eq("l = []; l.append(l); str(l)", "'[[...]]'");
} | rust_cleaned_test_functions.jsonl/25210 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 87
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68535,
39079,
368,
341,
286,
2060,
486,
11006,
445,
75,
284,
39371,
326,
2057,
2333,
1215,
30636,
2333,
11583,
7178,
15505,
1112,
5053,
28116,
286,
2060,
486,
11006,
445,
75,
284,
39371,
326,
2057... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_ruleset_add_rule() {
let ruleset = Ruleset::new();
let rule = Rule::ThreadTag(0, Tag::new("key".to_string(), "value".to_string()));
ruleset.add_rule(rule).unwrap();
assert_eq!(ruleset.rules.lock().unwrap().len(), 1);
} | rust_cleaned_test_functions.jsonl/124447 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 108
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21407,
295,
2891,
21124,
368,
341,
262,
1077,
5601,
295,
284,
22847,
295,
486,
931,
1428,
262,
1077,
5912,
284,
18100,
486,
6855,
5668,
7,
15,
11,
12353,
486,
931,
445,
792,
3263,
983,
3904,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hash_key_env_var_differs() {
let args = ovec!["a", "b", "c"];
let digest = "abcd";
const PREPROCESSED: &'static [u8] = b"hello world";
for var in CACHED_ENV_VARS.iter() {
let h1 = hash_key(digest, Language::C, &args, &[], &PREPROCESSED);
let vars = vec![(OsString::from(var), OsString::from("something"))];
let h2 = hash_key(digest, Language::C, &args, &vars, &PREPROCESSED);
let vars = vec![(OsString::from(var), OsString::from("something else"))];
let h3 = hash_key(digest, Language::C, &args, &vars, &PREPROCESSED);
assert_neq!(h1, h2);
assert_neq!(h2, h3);
}
} | rust_cleaned_test_functions.jsonl/22437 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 372
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
3097,
15879,
4612,
15850,
388,
368,
341,
286,
1077,
2827,
284,
297,
4083,
0,
1183,
64,
497,
330,
65,
497,
330,
66,
6332,
286,
1077,
20882,
284,
330,
68644,
876,
286,
733,
20952,
9117,
32... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_der_relativeoid() {
let empty = &b""[..];
let bytes = [0x0d, 0x04, 0xc2, 0x7b, 0x03, 0x02];
let expected = DerObject::from_obj(BerObjectContent::RelativeOID(
Oid::from_relative(&[8571, 3, 2]).unwrap(),
));
assert_eq!(parse_der_relative_oid(&bytes), Ok((empty, expected)));
} | rust_cleaned_test_functions.jsonl/45869 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35345,
29286,
588,
368,
341,
262,
1077,
4287,
284,
609,
65,
3014,
95874,
935,
262,
1077,
5820,
284,
508,
15,
87,
15,
67,
11,
220,
15,
87,
15,
19,
11,
220,
15,
8148,
17,
11,
220,
15,
87,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_schema_validation() -> Result<()> {
let schema1 = Arc::new(Schema::new(vec![
Field::new("a", DataType::Int32, false),
Field::new("b", DataType::Int32, false),
Field::new("c", DataType::Int32, false),
]));
let schema2 = Arc::new(Schema::new(vec![
Field::new("a", DataType::Int32, false),
Field::new("b", DataType::Float64, false),
Field::new("c", DataType::Int32, false),
]));
let batch = RecordBatch::try_new(
schema1.clone(),
vec![
Arc::new(Int32Array::from(vec![1, 2, 3])),
Arc::new(Int32Array::from(vec![4, 5, 6])),
Arc::new(Int32Array::from(vec![7, 8, 9])),
],
)?;
match MemTable::new(schema2, vec![vec![batch]]) {
Err(ExecutionError::General(e)) => assert_eq!(
"\"Mismatch between schema and batches\"",
format!("{:?}", e)
),
_ => assert!(
false,
"MemTable::new should have failed due to schema mismatch"
),
}
Ok(())
} | rust_cleaned_test_functions.jsonl/20929 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 657
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25371,
19416,
368,
1464,
5714,
71698,
341,
286,
1077,
10802,
16,
284,
19689,
486,
931,
3759,
3416,
486,
931,
25592,
90515,
310,
8601,
486,
931,
445,
64,
497,
33172,
486,
1072,
18,
17,
11,
895,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_certification_pool_handle_invalid() {
ic_test_utilities::artifact_pool_config::with_test_pool_config(|pool_config| {
let mut pool =
CertificationPoolImpl::new(pool_config, no_op_logger(), MetricsRegistry::new());
let share_msg = fake_share(10, 10);
pool.insert(share_msg.clone());
assert_eq!(
pool.unvalidated_shares_at_height(Height::from(10)).count(),
1
);
pool.apply_changes(vec![ChangeAction::HandleInvalid(
share_msg,
"Testing the removal of invalid artifacts".to_string(),
)]);
assert_eq!(
pool.unvalidated_shares_at_height(Height::from(10)).count(),
0
);
});
} | rust_cleaned_test_functions.jsonl/8477 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 435
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37097,
2404,
15709,
10630,
31433,
368,
341,
286,
17902,
4452,
94044,
486,
63722,
15709,
5332,
486,
4197,
4452,
15709,
5332,
22428,
10285,
5332,
91,
341,
310,
1077,
5206,
7314,
4035,
394,
50210,
1055... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_number_parsing() {
let source = "var x = .12; let y = 4.; var z = 12; .3 4. 'a' let u = 12.2";
let v = tokenize(source).apply(::js::clean_tokens);
assert_eq!(
&v.0,
&[
Token::Keyword(Keyword::Var),
Token::Other("x"),
Token::Operation(Operation::Equal),
Token::FloatingNumber(".12"),
Token::Char(ReservedChar::SemiColon),
Token::Keyword(Keyword::Let),
Token::Other("y"),
Token::Operation(Operation::Equal),
Token::FloatingNumber("4."),
Token::Char(ReservedChar::SemiColon),
Token::Keyword(Keyword::Var),
Token::Other("z"),
Token::Operation(Operation::Equal),
Token::Number(12),
Token::Char(ReservedChar::SemiColon),
Token::FloatingNumber(".3"),
Token::FloatingNumber("4."),
Token::String("'a'"),
Token::Keyword(Keyword::Let),
Token::Other("u"),
Token::Operation(Operation::Equal),
Token::FloatingNumber("12.2")
]
);
} | rust_cleaned_test_functions.jsonl/86882 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 593
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5500,
620,
28598,
368,
341,
262,
1077,
2530,
284,
330,
947,
856,
284,
659,
16,
17,
26,
1077,
379,
284,
220,
19,
15642,
762,
1147,
284,
220,
16,
17,
26,
659,
18,
220,
19,
13,
364,
64,
6,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_single_uninterrupted_period() {
let mut counter = LostBssCounter::start(TEST_BEACON_PERIOD, TEST_TIMEOUT_BCN_COUNT);
// about to timeout but not yet.
counter.add_beacon_interval(TEST_TIMEOUT_BCN_COUNT - 1);
assert!(!counter.should_deauthenticate());
// any more time will trigger auto deauth
counter.add_beacon_interval(1);
assert!(counter.should_deauthenticate());
} | rust_cleaned_test_functions.jsonl/51460 | {
"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,
19487,
4907,
54805,
291,
20818,
368,
341,
286,
1077,
5206,
5546,
284,
27252,
33,
778,
14099,
486,
2468,
50320,
27168,
1706,
711,
43166,
11,
13602,
23412,
1668,
28668,
14672,
317,
286,
442,
911,
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_rejects_malformed_fidl() {
let as_fidl = fidl::Rule::Literal(fidl::LiteralRule {
host_match: "example.com".to_owned(),
host_replacement: "example.com".to_owned(),
path_prefix_match: "/test/".to_owned(),
path_prefix_replacement: "/test".to_owned(),
});
assert_eq!(
Rule::try_from(as_fidl),
Err(RuleDecodeError::ParseError(RuleParseError::InconsistentPaths))
);
let as_fidl = fidl::Rule::Literal(fidl::LiteralRule {
host_match: "example.com".to_owned(),
host_replacement: "example.com".to_owned(),
path_prefix_match: "/test".to_owned(),
path_prefix_replacement: "test".to_owned(),
});
assert_eq!(
Rule::try_from(as_fidl),
Err(RuleDecodeError::ParseError(RuleParseError::InvalidPath))
);
} | rust_cleaned_test_functions.jsonl/57420 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 477
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
583,
82,
717,
278,
10155,
761,
55464,
368,
341,
286,
1077,
438,
761,
55464,
284,
32104,
75,
486,
11337,
486,
17350,
40556,
75,
486,
17350,
11337,
341,
310,
3468,
10708,
25,
330,
8687,
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... | 1 |
#[test]
fn test_kras() -> () {
let tests = vec![
("{}", KrasValue::List(("{".to_string(), vec![], "}".to_string()))),
("{a=>b}", KrasValue::List(("{".to_string(),
vec![
KrasValue::ListItem((Box::new(
KrasValue::Ident("a".to_string()),
), Some("=>".to_string()))),
KrasValue::ListItem((Box::new(
KrasValue::Ident("b".to_string()),
), None))
],
"}".to_string()))
),
(r#"b''"#, KrasValue::Str(('\'', "b".to_string(), "".to_string()))),
("{a=>b''}", KrasValue::List(("{".to_string(),
vec![
KrasValue::ListItem((Box::new(
KrasValue::Ident("a".to_string()),
), Some("=>".to_string()))),
KrasValue::ListItem((Box::new(
KrasValue::Str(('\'', "b".to_string(), "".to_string())),
), None))
],
"}".to_string()))
)
];
for (input, expected) in tests {
let input = input.chars().collect::<Vec<_>>();
let res = kras().parse(&input).unwrap();
assert_eq!(res, expected);
}
} | rust_cleaned_test_functions.jsonl/30665 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 839
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4698,
12784,
368,
1464,
1719,
341,
286,
1077,
7032,
284,
7486,
90515,
310,
3489,
42351,
730,
12784,
1130,
486,
852,
7,
13976,
3263,
983,
3904,
1507,
7486,
0,
12995,
330,
21901,
983,
3904,
10131,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_explorer_pool_transaction() {
let mut blockchain = create_blockchain();
let (pk_alice, key_alice) = crypto::gen_keypair();
let tx_alice = Message::sign_transaction(
CreateWallet::new(&pk_alice, "Alice"),
SERVICE_ID,
pk_alice,
&key_alice,
);
let tx_hash = tx_alice.hash();
{
let explorer = BlockchainExplorer::new(&blockchain);
assert!(explorer.transaction(&tx_hash).is_none());
}
let mut fork = blockchain.fork();
{
let mut schema = Schema::new(&mut fork);
schema.add_transaction_into_pool(tx_alice.clone());
}
blockchain.merge(fork.into_patch()).unwrap();
let explorer = BlockchainExplorer::new(&blockchain);
let tx_info = explorer.transaction(&tx_hash).unwrap();
assert!(tx_info.is_in_pool());
assert!(!tx_info.is_committed());
assert_eq!(tx_info.content().signed_message(), &tx_alice);
} | rust_cleaned_test_functions.jsonl/70354 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 401
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2702,
79825,
15709,
28884,
368,
341,
262,
1077,
5206,
17944,
284,
1855,
7113,
8819,
1428,
262,
1077,
320,
20819,
8418,
558,
11,
1376,
8418,
558,
8,
284,
19028,
486,
4370,
3097,
12670,
543,
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_params_call_short() {
if let Ok(r) = ParamsCallShort::from_file("src/term_strz.bin") {
assert_eq!(r.buf1.body, "foo|b");
assert_eq!(r.buf2.body, "ar|ba");
assert_eq!(r.buf2.trailer, 122);
}
} | rust_cleaned_test_functions.jsonl/121594 | {
"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,
6745,
13429,
16673,
368,
341,
262,
421,
1077,
7622,
2601,
8,
284,
34352,
7220,
12472,
486,
1499,
2458,
445,
3548,
14,
4991,
2895,
89,
29394,
899,
341,
286,
2060,
10714,
10297,
81,
44485,
16,
507... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_vector_neg() {
let v = Tuple::vector(3.0, 2.0, 1.0);
assert_eq!(-v, Tuple::vector(-3.0, -2.0, -1.0))
} | rust_cleaned_test_functions.jsonl/113509 | {
"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,
12247,
28209,
368,
341,
286,
1077,
348,
284,
24622,
486,
3215,
7,
18,
13,
15,
11,
220,
17,
13,
15,
11,
220,
16,
13,
15,
317,
286,
2060,
10714,
0,
4080,
85,
11,
24622,
486,
3215,
4080,
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 |
#[test]
fn test_client_attempts_to_use_unsupported_kx_group() {
// common to both client configs
let shared_storage = Arc::new(ClientStorage::new());
// into kx group cache.
let mut client_config_1 =
make_client_config_with_kx_groups(KeyType::RSA, &[&rustls::kx_group::X25519]);
client_config_1.session_storage = shared_storage.clone();
// contains an unusable value.
let mut client_config_2 =
make_client_config_with_kx_groups(KeyType::RSA, &[&rustls::kx_group::SECP384R1]);
client_config_2.session_storage = shared_storage.clone();
let server_config = make_server_config(KeyType::RSA);
// first handshake
let (mut client_1, mut server) = make_pair_for_configs(client_config_1, server_config.clone());
do_handshake_until_error(&mut client_1, &mut server).unwrap();
// second handshake
let (mut client_2, mut server) = make_pair_for_configs(client_config_2, server_config);
do_handshake_until_error(&mut client_2, &mut server).unwrap();
} | rust_cleaned_test_functions.jsonl/51934 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 405
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8179,
79490,
2346,
15951,
4907,
18216,
4698,
87,
6288,
368,
341,
262,
442,
4185,
311,
2176,
2943,
42309,
198,
262,
1077,
6094,
23310,
284,
19689,
486,
931,
46851,
5793,
486,
931,
5231,
1066,
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_cmyk_u8() {
test_image_sum_u8("cmyk-3c-8b.tiff", ColorType::CMYK(8), 8522658);
} | rust_cleaned_test_functions.jsonl/75186 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 63
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
2408,
74,
7300,
23,
368,
341,
262,
1273,
4954,
10160,
7300,
23,
445,
66,
2408,
74,
12,
18,
66,
12,
23,
65,
734,
3092,
497,
3478,
929,
486,
9985,
56,
42,
7,
23,
701,
220,
23,
20,
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 |
#[test]
fn test_3() {
use std::error::Error;
assert_eq!(
parse("nominate foo foo")
.unwrap_err()
.source()
.unwrap()
.downcast_ref(),
Some(&ParseError::ExpectedEnd),
);
} | rust_cleaned_test_functions.jsonl/41754 | {
"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,
62,
18,
368,
341,
262,
990,
1460,
486,
841,
486,
1454,
280,
262,
2060,
10714,
33673,
286,
4715,
445,
16687,
3277,
15229,
15229,
1138,
310,
659,
15454,
9266,
741,
310,
659,
2427,
741,
310,
659,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_ascii_vec_ng() {
assert_eq!("abCDef&?#".to_ascii().to_lower().into_string(), "abcdef&?#".to_string());
assert_eq!("abCDef&?#".to_ascii().to_upper().into_string(), "ABCDEF&?#".to_string());
assert_eq!("".to_ascii().to_lower().into_string(), "".to_string());
assert_eq!("YMCA".to_ascii().to_lower().into_string(), "ymca".to_string());
assert_eq!("abcDEFxyz:.;".to_ascii().to_upper().into_string(), "ABCDEFXYZ:.;".to_string());
} | rust_cleaned_test_functions.jsonl/4327 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 238
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
50238,
13251,
82102,
368,
341,
286,
2060,
10714,
17223,
370,
34,
2620,
5,
30,
2,
3263,
983,
50238,
1005,
983,
30425,
1005,
18122,
3904,
1507,
330,
41202,
5,
30,
2,
3263,
983,
3904,
1423,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_filter_map_try_folds() {
let mp = &|x| if 0 <= x && x < 10 { Some(x*2) } else { None };
let f = &|acc, x| i32::checked_add(2*acc, x);
assert_eq!((-9..20).filter_map(mp).try_fold(7, f), (0..10).map(|x| 2*x).try_fold(7, f));
assert_eq!((-9..20).filter_map(mp).try_rfold(7, f), (0..10).map(|x| 2*x).try_rfold(7, f));
let mut iter = (0..40).filter_map(|x| if x%2 == 1 { None } else { Some(x*2 + 10) });
assert_eq!(iter.try_fold(0, i8::checked_add), None);
assert_eq!(iter.next(), Some(38));
assert_eq!(iter.try_rfold(0, i8::checked_add), None);
assert_eq!(iter.next_back(), Some(78));
} | rust_cleaned_test_functions.jsonl/54190 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 314
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8727,
5376,
53283,
761,
18431,
368,
341,
262,
1077,
10490,
284,
609,
91,
87,
91,
421,
220,
15,
2651,
856,
1009,
856,
366,
220,
16,
15,
314,
4329,
2075,
9,
17,
8,
335,
770,
314,
2240,
2605,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_serializer_userdata_too_small() {
let mut a = Account::new(0, 1, id());
let b = BudgetProgram::default();
assert_eq!(
b.serialize(&mut a.userdata),
Err(BudgetError::UserdataTooSmall)
);
} | rust_cleaned_test_functions.jsonl/30406 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67441,
59315,
2346,
78,
31966,
368,
341,
286,
1077,
5206,
264,
284,
8615,
486,
931,
7,
15,
11,
220,
16,
11,
877,
1423,
286,
1077,
293,
284,
27269,
10690,
486,
2258,
543,
286,
2060,
10714,
3367... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_true() {
let t = Value::from(1i8);
assert_eq!(is_true(&t), true);
let t = Value::from(0u32);
assert_eq!(is_true(&t), false);
} | rust_cleaned_test_functions.jsonl/76785 | {
"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,
6892,
16082,
368,
341,
286,
1077,
259,
284,
5162,
486,
1499,
7,
16,
72,
23,
317,
286,
2060,
10714,
10297,
285,
16082,
2099,
83,
701,
830,
317,
286,
1077,
259,
284,
5162,
486,
1499,
7,
15,
84... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_zeropage_am() {
let mut cpu = setup(0x0000, true, 0x25, Some(0x35));
cpu.writ_byte(0x35, 0x10);
let result = zeropage_am(&mut cpu);
assert_eq!(
result.ok(),
Some(Fetched {
value: 0x10,
address: 0x35,
})
);
} | rust_cleaned_test_functions.jsonl/26574 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 212
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6415,
261,
453,
424,
22880,
368,
341,
286,
1077,
5206,
17319,
284,
6505,
7,
15,
87,
15,
15,
15,
15,
11,
830,
11,
220,
15,
87,
17,
20,
11,
4329,
7,
15,
87,
18,
20,
1106,
286,
17319,
78173... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_basic_variants_parsed() {
let _abc = Basic::Abc;
let _def = Basic::Def;
let _ghi = Basic::Ghi;
match Basic::Abc {
// this does not compile if there are additional unexpected variants
Basic::Abc | Basic::Def | Basic::Ghi => {}
}
} | rust_cleaned_test_functions.jsonl/29173 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
4612,
62278,
75788,
368,
341,
262,
1077,
716,
13683,
284,
14625,
486,
5830,
66,
280,
262,
1077,
716,
750,
284,
14625,
486,
2620,
280,
262,
1077,
716,
75076,
284,
14625,
486,
38,
6023,
401... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_tree_all_not_show_self() {
let tmp = tempdir();
tmp.child("one").touch().unwrap();
tmp.child("one.d").create_dir_all().unwrap();
tmp.child("one.d/two").touch().unwrap();
tmp.child("one.d/.hidden").touch().unwrap();
cmd()
.arg(tmp.path())
.arg("--tree")
.arg("--all")
.assert()
.stdout(
predicate::str::is_match("├── one\n└── one.d\n ├── .hidden\n └── two\n$")
.unwrap(),
);
} | rust_cleaned_test_functions.jsonl/644 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 265
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11663,
5705,
7913,
15267,
25637,
368,
341,
262,
1077,
4174,
284,
2730,
3741,
543,
262,
4174,
17531,
445,
603,
1827,
22020,
1005,
15454,
543,
262,
4174,
17531,
445,
603,
950,
1827,
3182,
4334,
5705... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cert() {
let (sender_name, sender_key) = get_key_pair();
let transfer = Transfer {
sender: sender_name,
recipient: Address::Primary(dbg_addr(0x20)),
amount: Amount::from(5),
sequence_number: SequenceNumber::new(),
user_data: UserData::default(),
};
let order = TransferOrder::new(transfer, &sender_key);
let mut cert = CertifiedTransferOrder {
value: order,
signatures: Vec::new(),
};
for _ in 0..3 {
let (authority_name, authority_key) = get_key_pair();
let sig = Signature::new(&cert.value, &authority_key);
cert.signatures.push((authority_name, sig));
}
let buf = serialize_cert(&cert);
let result = deserialize_message(buf.as_slice());
assert!(result.is_ok());
if let SerializedMessage::Cert(o) = result.unwrap() {
assert!(*o == cert);
} else {
panic!()
}
} | rust_cleaned_test_functions.jsonl/99648 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 399
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37097,
368,
341,
262,
1077,
320,
11644,
1269,
11,
4646,
3097,
8,
284,
633,
3097,
14445,
543,
262,
1077,
8317,
284,
23200,
341,
286,
4646,
25,
4646,
1269,
345,
286,
21713,
25,
9177,
486,
15972,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_idempotent_quickcheck_bug1() {
let ops = vec![
map::Op::Up {
dot: Dot::new(21, 5),
key: 0,
op: map::Op::Up {
dot: Dot::new(21, 1),
key: 32,
op: mvreg::Op::Put {
clock: VClock::new(),
val: 42,
},
},
},
map::Op::Rm {
clock: vec![Dot::new(21, 5)].into_iter().collect(),
keyset: vec![0].into_iter().collect(),
},
map::Op::Up {
dot: Dot::new(21, 6),
key: 1,
op: map::Op::Up {
dot: Dot::new(21, 1),
key: 0,
op: mvreg::Op::Put {
clock: VClock::new(),
val: 0,
},
},
},
];
let mut m = Map::new();
apply_ops(&mut m, &ops);
let m_snapshot = m.clone();
m.merge(m_snapshot.clone());
assert_eq!(m, m_snapshot);
} | rust_cleaned_test_functions.jsonl/61631 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 664
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
842,
3262,
63532,
82094,
2028,
73232,
16,
368,
341,
262,
1077,
27132,
284,
7486,
90515,
286,
2415,
486,
7125,
486,
2324,
341,
310,
12756,
25,
31262,
486,
931,
7,
17,
16,
11,
220,
20,
1326,
310... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_write_enum_to_chunk_by_payload_var_uint() {
let field_type = get_enum_field_type();
let src: [&[u8]; 3] = [
&[3], // 1st
&[2], // 2nd
&[1], // 3rd
];
let mut dest = Vec::new();
let res: &[u8] = &[
3, 0, 0, 0, 0, 0, 0, 0, 97, // 1st
2, 0, 0, 0, 0, 0, 0, 0, 98, // 2nd
1, 0, 0, 0, 0, 0, 0, 0, 99, // 3rd
];
for data in &src {
dest.write_enum_to_chunk_by_datum_payload_var_uint(*data, &field_type)
.expect("write_enum_to_chunk_by_payload_var_uint");
}
assert_eq!(&dest, res);
} | rust_cleaned_test_functions.jsonl/77405 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 408
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
31054,
2346,
30539,
3710,
32813,
4612,
15807,
368,
341,
286,
1077,
2070,
1819,
284,
633,
31054,
5013,
1819,
1428,
286,
1077,
2286,
25,
34336,
58,
84,
23,
5265,
220,
18,
60,
284,
2278,
310,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_new() {
let e = Element::new("foo");
assert_eq!(e.name.as_str(), "foo");
assert_eq!(e.attributes.len(), 0);
assert_eq!(e.children.len(), 0);
assert_eq!(e.text, None);
} | rust_cleaned_test_functions.jsonl/15716 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
368,
341,
262,
1077,
384,
284,
8543,
486,
931,
445,
7975,
797,
262,
2060,
10714,
10297,
68,
2644,
5357,
2895,
1507,
330,
7975,
797,
262,
2060,
10714,
10297,
68,
26140,
19406,
1507,
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_deck_create_deck_from_top_n_cards() {
let deck = Deck::from_input("9 8 5 2");
assert_eq!(deck.create_deck_from_top_n_cards(4), Deck::from_input("9 8 5 2"));
let deck = Deck::from_input("10 1 7 6");
assert_eq!(deck.create_deck_from_top_n_cards(3), Deck::from_input("10 1 7"));
} | rust_cleaned_test_functions.jsonl/25653 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 140
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
83860,
8657,
83860,
5673,
10426,
1089,
41357,
368,
341,
262,
1077,
9530,
284,
28416,
486,
1499,
5898,
445,
24,
220,
23,
220,
20,
220,
17,
797,
262,
2060,
10714,
10297,
33425,
2520,
83860,
5673,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_equal_differing_sizes() {
let v0 = BitVec::from_elem(10, false);
let v1 = BitVec::from_elem(11, false);
assert!(v0 != v1);
} | rust_cleaned_test_functions.jsonl/62082 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11478,
814,
14320,
287,
32159,
368,
341,
286,
1077,
348,
15,
284,
6495,
10050,
486,
1499,
28179,
7,
16,
15,
11,
895,
317,
286,
1077,
348,
16,
284,
6495,
10050,
486,
1499,
28179,
7,
16,
16,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_gcd_lehmer_extended_equal_inputs() {
let a = U256::from(10);
let b = U256::from(10);
let (gcd, u, v, even) = gcd_extended(a.clone(), b.clone());
assert_eq!(&a % &gcd, U256::ZERO);
assert_eq!(&b % &gcd, U256::ZERO);
assert!(!even);
assert_eq!(gcd, v * b - u * a);
} | rust_cleaned_test_functions.jsonl/13593 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 193
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1889,
4385,
11751,
71,
1174,
61678,
11478,
28557,
368,
341,
286,
1077,
264,
284,
547,
17,
20,
21,
486,
1499,
7,
16,
15,
317,
286,
1077,
293,
284,
547,
17,
20,
21,
486,
1499,
7,
16,
15,
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_clamp_point() {
let r = Rect {
x: Interval::new(0., 0.5),
y: Interval::new(0.25, 0.75),
};
test_clamp_cases(&r, &Point::new(-0.01, 0.24), &Point::new(0., 0.25));
test_clamp_cases(&r, &Point::new(-5.0, 0.48), &Point::new(0., 0.48));
test_clamp_cases(&r, &Point::new(-5.0, 2.48), &Point::new(0., 0.75));
test_clamp_cases(&r, &Point::new(0.17, 2.48), &Point::new(0.17, 0.75));
test_clamp_cases(&r, &Point::new(6.19, 2.48), &Point::new(0.5, 0.75));
test_clamp_cases(&r, &Point::new(6.19, 0.53), &Point::new(0.5, 0.53));
test_clamp_cases(&r, &Point::new(6.19, -2.53), &Point::new(0.5, 0.25));
test_clamp_cases(&r, &Point::new(0.33, 2.48), &Point::new(0.33, 0.75));
test_clamp_cases(&r, &Point::new(0.33, 0.37), &Point::new(0.33, 0.37));
} | rust_cleaned_test_functions.jsonl/94061 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 481
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6794,
1121,
6085,
368,
341,
286,
1077,
435,
284,
11920,
341,
310,
856,
25,
40584,
486,
931,
7,
15,
2572,
220,
15,
13,
20,
1326,
310,
379,
25,
40584,
486,
931,
7,
15,
13,
17,
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_aac_stream() {
let mut streams = Streams::new();
const LOCAL_ID: u8 = 1;
const TEST_SAMPLE_FREQ: u32 = 44100;
// An endpoint for testing
let s = avdtp::StreamEndpoint::new(
LOCAL_ID,
avdtp::MediaType::Audio,
avdtp::EndpointType::Sink,
vec![
avdtp::ServiceCapability::MediaTransport,
avdtp::ServiceCapability::MediaCodec {
media_type: avdtp::MediaType::Audio,
codec_type: avdtp::MediaCodecType::AUDIO_AAC,
codec_extra: vec![128, 1, 4, 4, 226, 0],
},
],
)
.expect("Failed to create endpoint");
let id = s.local_id().clone();
let information = s.information();
let encoding = AUDIO_ENCODING_AAC.to_string();
assert_matches!(streams.get_endpoint(&id), None);
let res = streams.get_mut(&id);
assert_matches!(res, Err(avdtp::ErrorCode::BadAcpSeid));
streams.insert(s, encoding.clone());
assert!(streams.get_endpoint(&id).is_some());
assert_eq!(&id, streams.get_endpoint(&id).unwrap().local_id());
assert_eq!([information], streams.information().as_slice());
streams
.get_endpoint(&id)
.unwrap()
.configure(
&id,
vec![
avdtp::ServiceCapability::MediaTransport,
avdtp::ServiceCapability::MediaCodec {
media_type: avdtp::MediaType::Audio,
codec_type: avdtp::MediaCodecType::AUDIO_AAC,
codec_extra: vec![128, 1, 4, 4, 226, 0],
},
],
)
.expect("Failed to configure endpoint");
let stream = streams.get_mut(&id).expect("stream");
let codec_extra = stream.configured_codec_extra().expect("codec extra");
assert_matches!(codec_extra, CodecExtra::Aac([128, 1, 4, 4, 226, 0]));
assert_matches!(codec_extra.sample_freq(), Some(TEST_SAMPLE_FREQ));
assert_matches!(stream.suspend_sender, None);
assert_eq!(encoding, stream.encoding);
} | rust_cleaned_test_functions.jsonl/65336 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1183
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4306,
580,
12673,
368,
341,
286,
1077,
5206,
23045,
284,
94522,
486,
931,
543,
286,
733,
42501,
3450,
25,
575,
23,
284,
220,
16,
280,
286,
733,
13602,
41439,
48602,
25,
575,
18,
17,
284,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dos_without_blockhash() {
solana_logger::setup();
let num_nodes = 1;
let cluster =
LocalCluster::new_with_equal_stakes(num_nodes, 100, 3, SocketAddrSpace::Unspecified);
assert_eq!(cluster.validators.len(), num_nodes);
let nodes = cluster.get_node_pubkeys();
let node = cluster.get_contact_info(&nodes[0]).unwrap().clone();
let nodes_slice = [node];
let client = Arc::new(ThinClient::new(
cluster.entry_point_info.rpc,
cluster.entry_point_info.tpu,
cluster.connection_cache.clone(),
));
// creates one transaction with 8 valid signatures and sends it 10 times
run_dos(
&nodes_slice,
10,
Some(client.clone()),
DosClientParameters {
entrypoint_addr: cluster.entry_point_info.gossip,
mode: Mode::Tpu,
data_size: 0, // irrelevant
data_type: DataType::Transaction,
data_input: None,
skip_gossip: false,
allow_private_addr: false,
transaction_params: TransactionParams {
num_signatures: Some(8),
valid_blockhash: false,
valid_signatures: true,
unique_transactions: false,
transaction_type: None,
num_instructions: None,
},
tpu_use_quic: false,
},
);
// creates and sends unique transactions which have invalid signatures
run_dos(
&nodes_slice,
10,
Some(client.clone()),
DosClientParameters {
entrypoint_addr: cluster.entry_point_info.gossip,
mode: Mode::Tpu,
data_size: 0, // irrelevant
data_type: DataType::Transaction,
data_input: None,
skip_gossip: false,
allow_private_addr: false,
transaction_params: TransactionParams {
num_signatures: Some(8),
valid_blockhash: false,
valid_signatures: false,
unique_transactions: true,
transaction_type: None,
num_instructions: None,
},
tpu_use_quic: false,
},
);
// creates and sends unique transactions which have valid signatures
run_dos(
&nodes_slice,
10,
Some(client),
DosClientParameters {
entrypoint_addr: cluster.entry_point_info.gossip,
mode: Mode::Tpu,
data_size: 0, // irrelevant
data_type: DataType::Transaction,
data_input: None,
skip_gossip: false,
allow_private_addr: false,
transaction_params: TransactionParams {
num_signatures: Some(8),
valid_blockhash: false,
valid_signatures: true,
unique_transactions: true,
transaction_type: None,
num_instructions: None,
},
tpu_use_quic: false,
},
);
} | rust_cleaned_test_functions.jsonl/57843 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1867
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
436,
39904,
7113,
8296,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
1629,
14896,
284,
220,
16,
280,
286,
1077,
10652,
4035,
310,
8774,
28678,
486,
931,
6615,
11478,
1261,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_trap_trace_cb() -> Result<()> {
let store = get_store(false);
let wat = r#"
(module $hello_mod
(import "" "throw" (func $throw))
(func (export "run") (call $hello))
(func $hello (call $throw))
)
"#;
let fn_type = FunctionType::new(vec![], vec![]);
let fn_func = Function::new(&store, &fn_type, |_| Err(RuntimeError::new("cb throw")));
let module = Module::new(&store, wat)?;
let instance = Instance::new(
&module,
&imports! {
"" => {
"throw" => fn_func
}
},
)?;
let run_func = instance
.exports
.get_function("run")
.expect("expected function export");
let e = run_func.call(&[]).err().expect("error calling function");
let trace = e.trace();
println!("Trace {:?}", trace);
assert_eq!(e.message(), "cb throw");
Ok(())
} | rust_cleaned_test_functions.jsonl/38856 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 479
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88536,
23575,
16450,
368,
1464,
5714,
71698,
341,
262,
1077,
3553,
284,
633,
14809,
3576,
317,
262,
1077,
29025,
284,
435,
2,
698,
286,
320,
4352,
400,
14990,
7480,
198,
310,
320,
474,
1591,
330... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_validate_known_script_too_large_args() {
let (config, key) = config_builder::test_config();
let vm_validator = TestValidator::new(&config);
let address = account_config::association_address();
let transaction = transaction_test_helpers::get_test_signed_transaction(
address,
1,
&key,
key.public_key(),
Some(Script::new(
vec![42; MAX_TRANSACTION_SIZE_IN_BYTES],
vec![],
vec![],
)), /* generate a
* program with args
* longer than the
* max size */
0,
0, /* max gas price */
LBR_NAME.to_owned(), /* gas currency code */
None,
);
let ret = vm_validator.validate_transaction(transaction).unwrap();
assert_eq!(
ret.status().unwrap().major_status,
StatusCode::EXCEEDED_MAX_TRANSACTION_SIZE
);
} | rust_cleaned_test_functions.jsonl/19606 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 452
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
71690,
14660,
2346,
78,
45228,
8384,
368,
341,
262,
1077,
320,
1676,
11,
1376,
8,
284,
2193,
28532,
486,
1944,
5332,
543,
262,
1077,
10995,
64959,
284,
3393,
14256,
486,
931,
2099,
1676,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_supplies_buy_ammo_insufficient() {
let mut supplies = Supplies::new();
let reason = supplies.buy_ammo(1000).unwrap_err().reason;
assert_eq!(BuyErrorType::InsufficientFunds, reason);
assert_eq!(700, supplies.money);
assert_eq!(0, supplies.ammo);
} | rust_cleaned_test_functions.jsonl/28664 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23723,
7202,
46348,
22880,
6355,
34386,
26683,
368,
341,
286,
1077,
5206,
16720,
284,
50252,
486,
931,
543,
286,
1077,
2874,
284,
16720,
63871,
22880,
6355,
7,
16,
15,
15,
15,
568,
15454,
9266,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_empty() {
struct Foo;
impl Debug for Foo {
fn fmt(&self, fmt: &mut Formatter) {
fmt.debug_struct("Foo").finish()
}
}
assert_eq!("Foo", debug3::pprint(Foo));
assert_eq!("Foo", debug3::pprint(Foo));
} | rust_cleaned_test_functions.jsonl/124733 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
368,
341,
286,
2036,
33428,
401,
286,
11605,
11091,
369,
33428,
341,
310,
5168,
8879,
2099,
721,
11,
8879,
25,
609,
6984,
81387,
8,
341,
394,
8879,
7883,
15126,
445,
40923,
1827,
30150,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_with() {
let addr = Address {
city: "Beijing".to_string(),
country: "China".to_string(),
};
let person = Person {
name: "Ning Sun".to_string(),
age: 27,
addr: addr,
titles: vec!["programmer".to_string(), "cartographier".to_string()],
};
let mut handlebars = Registry::new();
assert!(
handlebars
.register_template_string("t0", "{{#with addr}}{{city}}{{/with}}")
.is_ok()
);
assert!(
handlebars
.register_template_string("t1", "{{#with notfound}}hello{{else}}world{{/with}}")
.is_ok()
);
assert!(
handlebars
.register_template_string("t2", "{{#with addr/country}}{{this}}{{/with}}")
.is_ok()
);
let r0 = handlebars.render("t0", &person);
assert_eq!(r0.ok().unwrap(), "Beijing".to_string());
let r1 = handlebars.render("t1", &person);
assert_eq!(r1.ok().unwrap(), "world".to_string());
let r2 = handlebars.render("t2", &person);
assert_eq!(r2.ok().unwrap(), "China".to_string());
} | rust_cleaned_test_functions.jsonl/73423 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 659
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
368,
341,
286,
1077,
10789,
284,
9177,
341,
310,
3283,
25,
330,
3430,
23649,
3263,
983,
3904,
3148,
310,
3146,
25,
330,
22282,
3263,
983,
3904,
3148,
286,
3634,
286,
1077,
1697,
284,
7357,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pack_bits_by_bit() {
let data = [false, false, false, true, false, false, true, true];
let ret = [0x00u8, 0x01, 0x00, 0x11];
let buf = pack_bits_by_bit(&data);
assert_eq!(buf.as_slice(), ret)
} | rust_cleaned_test_functions.jsonl/62508 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 128
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32995,
20034,
3710,
13996,
368,
341,
286,
1077,
821,
284,
508,
3849,
11,
895,
11,
895,
11,
830,
11,
895,
11,
895,
11,
830,
11,
830,
935,
286,
1077,
2112,
284,
508,
15,
87,
15,
15,
84,
23,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_failing_file_does_not_halt_indexing() {
let config = Config {
input: InputConfig {
files: vec![
generate_invalid_file_missing_selector(),
generate_valid_file(),
],
..Default::default()
},
..Default::default()
};
assert_eq!(build(&config).unwrap().errors.len(), 1);
assert_eq!(build(&config).unwrap().index.entries.len(), 1);
} | rust_cleaned_test_functions.jsonl/31022 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 276
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
14277,
2458,
96374,
7913,
1523,
3145,
3560,
287,
368,
341,
286,
1077,
2193,
284,
5532,
341,
310,
1946,
25,
5571,
2648,
341,
394,
3542,
25,
7486,
90515,
503,
6923,
31433,
2458,
40447,
28890,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_puback() {
let packet = Packet::Puback(Pid::try_from(19).unwrap());
assert_decode_slice!(Packet::Puback(_), &packet, 4);
} | rust_cleaned_test_functions.jsonl/59349 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 75
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34014,
473,
368,
341,
262,
1077,
10151,
284,
28889,
486,
29162,
473,
5304,
307,
486,
1539,
5673,
7,
16,
24,
568,
15454,
1423,
1066,
262,
2060,
15227,
26488,
10297,
16679,
486,
29162,
473,
2490,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_embed_title_limit() {
let mut embed = base_embed();
embed.title.replace(str::repeat("a", 256));
assert!(super::embed(&embed).is_ok());
embed.title.replace(str::repeat("a", 257));
assert!(matches!(
super::embed(&embed).unwrap_err().kind(),
EmbedValidationErrorType::TitleTooLarge { chars: 257 }
));
} | rust_cleaned_test_functions.jsonl/4833 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 183
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24007,
6112,
14763,
368,
341,
286,
1077,
5206,
11579,
284,
2331,
24007,
543,
286,
11579,
6067,
6980,
4199,
486,
30624,
445,
64,
497,
220,
17,
20,
21,
1106,
286,
2060,
10297,
9522,
486,
12250,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_schema_is_sync() {
fn sync<S: Sync>(_s: S) {}
let schema = Schema {
named: vec![],
indices: Default::default(),
top: SchemaPiece::Null.into(),
};
sync(&schema);
sync(schema);
} | rust_cleaned_test_functions.jsonl/2992 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25371,
6892,
23008,
368,
341,
286,
5168,
12811,
18858,
25,
28937,
45609,
82,
25,
328,
8,
10086,
286,
1077,
10802,
284,
12539,
341,
310,
6941,
25,
7486,
20703,
1259,
310,
14937,
25,
7899,
486,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_cgroup_v2_mounts() {
let _ = tempdir().expect("failed to create tmpdir");
let drain = slog::Discard;
let logger = slog::Logger::root(drain, o!());
let result = get_cgroup_mounts(&logger, "", true);
assert!(result.is_ok());
let result = result.unwrap();
assert_eq!(1, result.len());
assert_eq!(result[0].fstype, "cgroup2");
assert_eq!(result[0].src, "cgroup2");
} | rust_cleaned_test_functions.jsonl/32170 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 222
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
666,
4074,
2273,
17,
57593,
82,
368,
341,
286,
1077,
716,
284,
2730,
3741,
1005,
17119,
445,
16091,
311,
1855,
4174,
3741,
797,
286,
1077,
23727,
284,
34949,
486,
23477,
567,
280,
286,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_secondly() {
let expression = "@secondly";
let schedule = Schedule::from_str(expression).expect("Failed to parse @secondly.");
let starting_date = Utc.ymd(2017, 2, 28).and_hms(23, 59, 59);
let mut events = schedule.after(&starting_date);
assert_eq!(
Utc.ymd(2017, 3, 01).and_hms(0, 0, 00),
events.next().unwrap()
);
assert_eq!(
Utc.ymd(2017, 3, 01).and_hms(00, 00, 01),
events.next().unwrap()
);
assert_eq!(
Utc.ymd(2017, 3, 01).and_hms(0, 0, 02),
events.next().unwrap()
);
let expression = "@secondly";
let schedule = Schedule::from_str(expression).expect("Failed to parse @secondly.");
let starting_date = Utc.ymd(2017, 12, 31).and_hms(23, 59, 59);
let mut events = schedule.after(&starting_date);
assert_eq!(
Utc.ymd(2018, 1, 01).and_hms(0, 0, 00),
events.next().unwrap()
);
} | rust_cleaned_test_functions.jsonl/50818 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 531
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29644,
398,
368,
341,
286,
1077,
7493,
284,
8428,
5569,
398,
876,
286,
1077,
9700,
284,
23512,
486,
1499,
2895,
48330,
568,
17119,
445,
9408,
311,
4715,
569,
5569,
398,
7320,
286,
1077,
5916,
41... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_inline_into_try_catch() {
test(
concat!(
"var a = true; ",
"try { var b = a; } ",
"catch (e) { var c = a + b; var d = true; } ",
"finally { var f = a + b + c + d; }"
),
concat!(
"try { var b = true; } ",
"catch (e) { var c = true + b; var d = true; } ",
"finally { var f = true + b + c + d; }"
),
);
} | rust_cleaned_test_functions.jsonl/27654 | {
"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,
41871,
45514,
53283,
666,
754,
368,
341,
262,
1273,
1006,
286,
33720,
33673,
310,
330,
947,
264,
284,
830,
26,
21796,
310,
330,
1539,
314,
762,
293,
284,
264,
26,
335,
21796,
310,
330,
7173,
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_parse_cie_32_ok() {
test_parse_cie(Format::Dwarf32, 1, 4);
test_parse_cie(Format::Dwarf32, 1, 8);
test_parse_cie(Format::Dwarf32, 4, 4);
test_parse_cie(Format::Dwarf32, 4, 8);
} | rust_cleaned_test_functions.jsonl/9300 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 133
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
666,
645,
62,
18,
17,
19817,
368,
341,
286,
1273,
21039,
666,
645,
7,
4061,
486,
35,
32634,
18,
17,
11,
220,
16,
11,
220,
19,
317,
286,
1273,
21039,
666,
645,
7,
4061,
486,
35,
3263... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_calculate_one_level_1() {
// This test calculates the levels for a non-null primitive array
let parent_levels = LevelInfo {
definition: vec![0; 10],
repetition: None,
array_offsets: (0..=10).collect(),
array_mask: vec![true; 10],
max_definition: 0,
is_list: false,
is_nullable: false,
};
let array_offsets: Vec<i64> = (0..=10).collect();
let array_mask = vec![true; 10];
let levels = parent_levels.calculate_child_levels(
array_offsets.clone(),
array_mask.clone(),
false,
false,
);
let expected_levels = LevelInfo {
definition: vec![1; 10],
repetition: None,
array_offsets,
array_mask,
max_definition: 1,
is_list: false,
is_nullable: false,
};
assert_eq!(&levels, &expected_levels);
} | rust_cleaned_test_functions.jsonl/77702 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 531
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24005,
11207,
11667,
8274,
62,
16,
368,
341,
286,
442,
1096,
1273,
47417,
279,
5866,
369,
264,
2477,
60341,
27594,
1334,
198,
286,
1077,
2681,
37819,
284,
9395,
1731,
341,
310,
7271,
25,
7486,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_gen_bool() {
#![allow(clippy::bool_assert_comparison)]
let mut r = rng(105);
for _ in 0..5 {
assert_eq!(r.gen_bool(0.0), false);
assert_eq!(r.gen_bool(1.0), true);
}
} | rust_cleaned_test_functions.jsonl/10501 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 147
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16322,
22159,
368,
341,
286,
671,
20703,
7183,
9849,
45749,
486,
2641,
16553,
90797,
27771,
286,
1077,
5206,
435,
284,
28422,
7,
16,
15,
20,
317,
286,
369,
716,
304,
220,
15,
496,
20,
341,
310... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_der_explicit_optional() {
let empty = &b""[..];
let bytes = [0xa0, 0x03, 0x02, 0x01, 0x02];
let header = BerObjectHeader::new(BerClass::ContextSpecific, 1, BerTag(0), 3)
.with_raw_tag(Some(&[0xa0]));
let expected = DerObject {
header: header.clone(),
content: BerObjectContent::Optional(Some(Box::new(BerObject::from_header_and_content(
header,
BerObjectContent::Tagged(
BerClass::ContextSpecific,
BerTag(0),
Box::new(DerObject::from_int_slice(b"\x02")),
),
)))),
};
assert_eq!(
parse_der_explicit_optional(&bytes, BerTag(0), parse_der_integer),
Ok((empty, expected))
);
let expected2 = DerObject::from_obj(BerObjectContent::Optional(None));
assert_eq!(
parse_der_explicit_optional(&bytes, BerTag(1), parse_der_integer),
Ok((&bytes[..], expected2))
);
} | rust_cleaned_test_functions.jsonl/45881 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 456
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35345,
14214,
6026,
74644,
368,
341,
262,
1077,
4287,
284,
609,
65,
3014,
95874,
935,
262,
1077,
5820,
284,
508,
15,
9591,
15,
11,
220,
15,
87,
15,
18,
11,
220,
15,
87,
15,
17,
11,
220,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse() {
assert_eq!(Version::parse(""), Err(GenericFailure));
assert_eq!(Version::parse(" "), Err(GenericFailure));
assert_eq!(Version::parse("1"), Err(GenericFailure));
assert_eq!(Version::parse("1.2"), Err(GenericFailure));
assert_eq!(Version::parse("1.2"), Err(GenericFailure));
assert_eq!(Version::parse("1"), Err(GenericFailure));
assert_eq!(Version::parse("1.2"), Err(GenericFailure));
assert_eq!(Version::parse("1.2.3-"), Err(GenericFailure));
assert_eq!(Version::parse("a.b.c"), Err(GenericFailure));
let version = Version {
major: 1,
minor: 2,
patch: 3,
pre: vec!(),
build: vec!(),
};
let error = Err(IncorrectParse(version, "1.2.3 abc".to_string()));
assert_eq!(Version::parse("1.2.3 abc"), error);
assert!(Version::parse("1.2.3") == Ok(Version {
major: 1,
minor: 2,
patch: 3,
pre: vec!(),
build: vec!(),
}));
assert!(Version::parse(" 1.2.3 ") == Ok(Version {
major: 1,
minor: 2,
patch: 3,
pre: vec!(),
build: vec!(),
}));
assert!(Version::parse("1.2.3-alpha1") == Ok(Version {
major: 1,
minor: 2,
patch: 3,
pre: vec!(AlphaNumeric("alpha1".to_string())),
build: vec!(),
}));
assert!(Version::parse(" 1.2.3-alpha1 ") == Ok(Version {
major: 1,
minor: 2,
patch: 3,
pre: vec!(AlphaNumeric("alpha1".to_string())),
build: vec!()
}));
assert!(Version::parse("1.2.3+build5") == Ok(Version {
major: 1,
minor: 2,
patch: 3,
pre: vec!(),
build: vec!(AlphaNumeric("build5".to_string()))
}));
assert!(Version::parse(" 1.2.3+build5 ") == Ok(Version {
major: 1,
minor: 2,
patch: 3,
pre: vec!(),
build: vec!(AlphaNumeric("build5".to_string()))
}));
assert!(Version::parse("1.2.3-alpha1+build5") == Ok(Version {
major: 1,
minor: 2,
patch: 3,
pre: vec!(AlphaNumeric("alpha1".to_string())),
build: vec!(AlphaNumeric("build5".to_string()))
}));
assert!(Version::parse(" 1.2.3-alpha1+build5 ") == Ok(Version {
major: 1,
minor: 2,
patch: 3,
pre: vec!(AlphaNumeric("alpha1".to_string())),
build: vec!(AlphaNumeric("build5".to_string()))
}));
assert!(Version::parse("1.2.3-1.alpha1.9+build5.7.3aedf ") == Ok(Version {
major: 1,
minor: 2,
patch: 3,
pre: vec!(Numeric(1),AlphaNumeric("alpha1".to_string()),Numeric(9)),
build: vec!(AlphaNumeric("build5".to_string()),
Numeric(7),
AlphaNumeric("3aedf".to_string()))
}));
assert_eq!(Version::parse("0.4.0-beta.1+0851523"), Ok(Version {
major: 0,
minor: 4,
patch: 0,
pre: vec![AlphaNumeric("beta".to_string()), Numeric(1)],
build: vec![AlphaNumeric("0851523".to_string())],
}));
} | rust_cleaned_test_functions.jsonl/101138 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1882
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
368,
341,
286,
2060,
10714,
10297,
5637,
486,
6400,
86076,
15495,
6699,
3469,
17507,
1106,
286,
2060,
10714,
10297,
5637,
486,
6400,
445,
220,
59312,
15495,
6699,
3469,
17507,
1106,
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_bound_for_like_pattern() -> Result<()> {
struct Test {
name: &'static str,
pattern: Vec<u8>,
left: Vec<u8>,
right: Vec<u8>,
}
let tests: Vec<Test> = vec![
Test {
name: "ordinary string",
pattern: vec![b'a', b'b', b'c'],
left: vec![b'a', b'b', b'c'],
right: vec![b'a', b'b', b'd'],
},
Test {
name: "contain _",
pattern: vec![b'a', b'_', b'c'],
left: vec![b'a'],
right: vec![b'b'],
},
Test {
name: "contain %",
pattern: vec![b'a', b'%', b'c'],
left: vec![b'a'],
right: vec![b'b'],
},
Test {
name: "contain \\_",
pattern: vec![b'a', b'\\', b'_', b'c'],
left: vec![b'a', b'_', b'c'],
right: vec![b'a', b'_', b'd'],
},
Test {
name: "contain \\",
pattern: vec![b'a', b'\\', b'b', b'c'],
left: vec![b'a', b'\\', b'b', b'c'],
right: vec![b'a', b'\\', b'b', b'd'],
},
Test {
name: "left is empty",
pattern: vec![b'%', b'b', b'c'],
left: vec![],
right: vec![],
},
Test {
name: "right is empty",
pattern: vec![255u8, 255, 255],
left: vec![255u8, 255, 255],
right: vec![],
},
];
for test in tests {
let left = left_bound_for_like_pattern(&test.pattern);
assert_eq!(test.left, left, "{:#?}", test.name);
let right = right_bound_for_like_pattern(left);
assert_eq!(test.right, right, "{:#?}", test.name);
}
Ok(())
} | rust_cleaned_test_functions.jsonl/5314 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1078
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19447,
5478,
25535,
21260,
368,
1464,
5714,
71698,
341,
262,
2036,
3393,
341,
286,
829,
25,
30136,
1978,
607,
345,
286,
5383,
25,
11312,
34837,
23,
12520,
286,
2115,
25,
11312,
34837,
23,
12520,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_next_excluded_excluded() {
let mut r = BoundedRange::new(LowerBound::excluded(3), UpperBound::excluded(5));
assert_eq!(r.next(), Some(4));
assert_eq!(r.next(), None);
} | rust_cleaned_test_functions.jsonl/54853 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 87
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11257,
2702,
10181,
2702,
10181,
368,
341,
262,
1077,
5206,
435,
284,
425,
13082,
6046,
486,
931,
4957,
1202,
19568,
486,
327,
10181,
7,
18,
701,
30614,
19568,
486,
327,
10181,
7,
20,
1106,
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 |
#[test]
fn test_empty_trait() {
check_assist_not_applicable(
add_missing_impl_members,
"
trait Foo;
struct S;
impl Foo for S { <|> }",
)
} | rust_cleaned_test_functions.jsonl/106823 | {
"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,
15124,
78491,
368,
341,
286,
1779,
12083,
380,
7913,
8191,
46114,
1006,
310,
912,
40447,
21007,
30397,
345,
310,
6228,
29432,
33428,
280,
1235,
328,
280,
6383,
33428,
369,
328,
314,
82639,
29,
335... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_pow_examples() {
assert_eq!(eval("1 ^ 4"), Ok(Value::Float(1.0)));
assert_eq!(eval("6 ^ 4"), Ok(Value::Float(6.0f64.powf(4.0))));
assert_eq!(eval("1 ^ 4 + 2"), Ok(Value::Float(3.0)));
assert_eq!(eval("2 ^ (4 + 2)"), Ok(Value::Float(64.0)));
} | rust_cleaned_test_functions.jsonl/105342 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56183,
45279,
368,
341,
262,
2060,
10714,
10297,
14170,
445,
16,
6306,
220,
19,
3975,
7622,
25346,
486,
5442,
7,
16,
13,
15,
4945,
262,
2060,
10714,
10297,
14170,
445,
21,
6306,
220,
19,
3975,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_wrap_no_arg() {
for wrap_param in &["-w", "--wrap"] {
let ts = TestScenario::new(util_name!());
let expected_stderr = &format!(
"error: The argument '--wrap <wrap>\' requires a value but none was \
supplied\n\nUSAGE:\n {1} {0} [OPTION]... [FILE]\n\nFor more \
information try --help",
ts.util_name,
ts.bin_path.to_string_lossy()
);
ts.ucmd()
.arg(wrap_param)
.fails()
.stderr_only(expected_stderr);
}
} | rust_cleaned_test_functions.jsonl/23693 | {
"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,
38550,
6536,
6057,
368,
341,
262,
369,
15061,
4090,
304,
609,
1183,
12,
86,
497,
14482,
10097,
1341,
341,
286,
1077,
10591,
284,
3393,
54031,
486,
931,
67811,
1269,
0,
1423,
286,
1077,
3601,
930... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_error_if_non_numeric() {
new_ucmd!()
.args(&["--header=two"])
.run()
.stderr_is("numfmt: invalid header value 'two'");
} | rust_cleaned_test_functions.jsonl/45996 | {
"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,
8757,
4096,
11119,
21637,
29418,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
313,
2708,
28,
19789,
14108,
286,
659,
6108,
741,
286,
659,
36422,
6892,
445,
2413,
12501,
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 |
#[test]
fn test_get_min_python_minor() {
// Nothing specified
let cargo_toml = CargoToml::from_path("test-crates/pyo3-pure/Cargo.toml").unwrap();
let metadata21 =
Metadata21::from_cargo_toml(&cargo_toml, &"test-crates/pyo3-pure").unwrap();
assert_eq!(get_min_python_minor(&metadata21), None);
} | rust_cleaned_test_functions.jsonl/48782 | {
"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,
3062,
7260,
55869,
70861,
368,
341,
286,
442,
12064,
5189,
198,
286,
1077,
25652,
528,
316,
75,
284,
61288,
24732,
75,
486,
1499,
2638,
445,
1944,
47589,
973,
90834,
78,
18,
2268,
552,
11295,
12... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_spirv_version() {
let (version, _) = get_spirv_version();
assert_eq!((1 << 16) + (5 << 8), version);
} | rust_cleaned_test_functions.jsonl/41076 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 74
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
643,
5565,
85,
9438,
368,
341,
286,
1077,
320,
4366,
11,
27439,
284,
633,
643,
5565,
85,
9438,
543,
286,
2060,
10714,
0,
1188,
16,
1115,
220,
16,
21,
8,
488,
320,
20,
1115,
220,
23,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_traverse_xnet_stream_header() {
use ic_replicated_state::metadata_state::Stream;
use ic_types::xnet::{StreamHeader, StreamIndex, StreamIndexedQueue};
let header = StreamHeader {
begin: StreamIndex::from(4),
end: StreamIndex::from(4),
signals_end: StreamIndex::new(11),
};
let stream = Stream::new(
StreamIndexedQueue::with_begin(StreamIndex::from(4)),
StreamIndex::new(11),
);
let tmpdir = tempfile::Builder::new().prefix("test").tempdir().unwrap();
let mut state = ReplicatedState::new_rooted_at(
subnet_test_id(1),
SubnetType::Application,
tmpdir.path().into(),
);
state.modify_streams(move |streams| {
streams.insert(subnet_test_id(5), stream);
});
let visitor = TracingVisitor::new(NoopVisitor);
assert_eq!(
vec![
E::StartSubtree,
edge("canister"),
E::StartSubtree,
E::EndSubtree, // canisters
edge("metadata"),
E::VisitBlob(encode_metadata(SystemMetadata {
id_counter: 0,
prev_state_hash: None
})),
edge("request_status"),
E::StartSubtree,
E::EndSubtree, // request_status
edge("streams"),
E::StartSubtree,
edge(subnet_test_id(5).get_ref().to_vec()),
E::StartSubtree,
edge("header"),
E::VisitBlob(encode_stream_header(
&header,
state.metadata.certification_version
)),
edge("messages"),
E::StartSubtree,
E::EndSubtree, // messages
E::EndSubtree, // stream
E::EndSubtree, // streams
edge("subnet"),
E::StartSubtree,
E::EndSubtree, // subnets
edge("time"),
leb_num(0),
E::EndSubtree, // global
],
traverse(&state, visitor).0
);
} | rust_cleaned_test_functions.jsonl/98354 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1259
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3547,
22439,
3212,
4711,
12673,
8757,
368,
341,
286,
990,
17902,
25533,
13724,
4387,
486,
17637,
4387,
486,
3027,
280,
286,
990,
17902,
9763,
486,
87,
4711,
22964,
3027,
4047,
11,
9203,
1552,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.