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_mul() {
assert_eq!(Vec3::new(1.0, 0.0, -1.0) * Vec3::ones(), 0.0);
} | rust_cleaned_test_functions.jsonl/35224 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 65
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24944,
368,
341,
286,
2060,
10714,
10297,
10050,
18,
486,
931,
7,
16,
13,
15,
11,
220,
15,
13,
15,
11,
481,
16,
13,
15,
8,
353,
11312,
18,
486,
3154,
1507,
220,
15,
13,
15,
317,
262,
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_hidden_field() {
use serde::Serialize;
#[derive(OnlineConfig, Default, Serialize)]
#[serde(default)]
#[serde(rename_all = "kebab-case")]
pub struct TestConfig {
#[online_config(skip)]
skip_field: String,
#[online_config(hidden)]
hidden_field: u64,
#[online_config(submodule)]
submodule_field: SubConfig,
}
#[derive(OnlineConfig, Default, Serialize)]
#[serde(default)]
#[serde(rename_all = "kebab-case")]
pub struct SubConfig {
#[serde(rename = "rename_field")]
bool_field: bool,
#[online_config(hidden)]
hidden_field: usize,
}
let cfg = SubConfig::default();
assert_eq!(
toml::to_string(&cfg).unwrap(),
"rename_field = false\nhidden-field = 0\n"
);
assert_eq!(
toml::to_string(&cfg.get_encoder()).unwrap(),
"rename_field = false\n"
);
let cfg = TestConfig::default();
assert_eq!(
toml::to_string(&cfg).unwrap(),
"skip-field = \"\"\nhidden-field = 0\n\n[submodule-field]\nrename_field = false\nhidden-field = 0\n"
);
assert_eq!(
toml::to_string(&cfg.get_encoder()).unwrap(),
"skip-field = \"\"\n\n[submodule-field]\nrename_field = false\n"
);
} | rust_cleaned_test_functions.jsonl/67350 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 784
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26739,
5013,
368,
341,
286,
990,
61570,
486,
15680,
401,
286,
11506,
27098,
7,
19598,
2648,
11,
7899,
11,
39900,
5563,
286,
11506,
47024,
18978,
5563,
286,
11506,
47024,
51787,
5705,
284,
330,
440... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_alignment_Fx() {
let input: [u8; 8] = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0]; // 0xc000000000000000 -2
let expected_output = unindent(
"
0000000 -2.0000000000000000
0000 0000 0000 c000
0000010
",
);
new_ucmd!()
.arg("--endian=little")
.arg("-F")
.arg("-x")
.run_piped_stdin(&input[..])
.no_stderr()
.success()
.stdout_is(expected_output);
} | rust_cleaned_test_functions.jsonl/48815 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 294
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51006,
1400,
87,
368,
341,
262,
1077,
1946,
25,
508,
84,
23,
26,
220,
23,
60,
284,
508,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
11,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_request_tw_session_parse() {
let mut buf = BytesMut::from(REQUEST_TW_SESSION1);
let expected = get_request_tw_session();
let res = RequestTwSession::parse(&mut buf);
assert_eq!(buf.remaining(), 0);
assert!(res.is_ok());
assert_eq!(res.unwrap(), expected);
} | rust_cleaned_test_functions.jsonl/63830 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 151
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7893,
54178,
12316,
21039,
368,
341,
286,
1077,
5206,
6607,
284,
30024,
51440,
486,
1499,
7,
10794,
95747,
34361,
16,
317,
286,
1077,
3601,
284,
633,
7893,
54178,
12316,
543,
286,
1077,
592,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_issue_82291() {
use std::cell::Cell;
let mut v1 = [()];
let v2 = [()];
let called = Cell::new(0);
let mut zip = v1
.iter_mut()
.map(|r| {
called.set(called.get() + 1);
r
})
.zip(&v2);
zip.next_back();
assert_eq!(called.get(), 1);
zip.next();
assert_eq!(called.get(), 1);
} | rust_cleaned_test_functions.jsonl/8971 | {
"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,
53340,
62,
23,
17,
17,
24,
16,
368,
341,
262,
990,
1460,
486,
5873,
486,
3599,
401,
262,
1077,
5206,
348,
16,
284,
508,
33800,
262,
1077,
348,
17,
284,
508,
368,
4821,
262,
1077,
2598,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_node_named_child_with_aliases_and_extras() {
let (parser_name, parser_code) =
generate_parser_for_grammar(GRAMMAR_WITH_ALIASES_AND_EXTRAS).unwrap();
let mut parser = Parser::new();
parser
.set_language(get_test_language(&parser_name, &parser_code, None))
.unwrap();
let tree = parser.parse("b ... b ... c", None).unwrap();
let root = tree.root_node();
assert_eq!(root.to_sexp(), "(a (b) (comment) (B) (comment) (C))");
assert_eq!(root.named_child_count(), 5);
assert_eq!(root.named_child(0).unwrap().kind(), "b");
assert_eq!(root.named_child(1).unwrap().kind(), "comment");
assert_eq!(root.named_child(2).unwrap().kind(), "B");
assert_eq!(root.named_child(3).unwrap().kind(), "comment");
assert_eq!(root.named_child(4).unwrap().kind(), "C");
} | rust_cleaned_test_functions.jsonl/99267 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 358
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5084,
71834,
17268,
6615,
90233,
8378,
2702,
13503,
368,
341,
262,
1077,
320,
9657,
1269,
11,
6729,
4136,
8,
4035,
286,
6923,
18517,
5478,
62,
41094,
6699,
33905,
60661,
23929,
8912,
40,
4066,
50,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_empty_state() {
let tmpdir = tempfile::Builder::new().prefix("test").tempdir().unwrap();
let state = ReplicatedState::new_rooted_at(
subnet_test_id(1),
SubnetType::Application,
tmpdir.path().into(),
);
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,
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/98351 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 721
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3547,
22439,
15124,
4387,
368,
341,
286,
1077,
4174,
3741,
284,
54819,
486,
3297,
486,
931,
1005,
11849,
445,
1944,
1827,
3888,
3741,
1005,
15454,
543,
286,
1077,
1584,
284,
3321,
13724,
1397,
486... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extension_successful_with_complete_json_response() {
use self::colorful_extension::*;
let client = ColorfulClient::new(
ClientId::new("aaa".to_string()),
Some(ClientSecret::new("bbb".to_string())),
AuthUrl::new("https://example.com/auth".to_string()).unwrap(),
Some(TokenUrl::new("https://example.com/token".to_string()).unwrap()),
)
.set_auth_type(AuthType::RequestBody);
let token = client
.exchange_code(AuthorizationCode::new("ccc".to_string()))
.request(mock_http_client(
vec![
(ACCEPT, "application/json"),
(CONTENT_TYPE, "application/x-www-form-urlencoded"),
],
"grant_type=authorization_code&code=ccc&client_id=aaa&client_secret=bbb",
None,
HttpResponse {
status_code: StatusCode::OK,
headers: vec![(
CONTENT_TYPE,
HeaderValue::from_str("application/json").unwrap(),
)]
.into_iter()
.collect(),
body: "{\
\"access_token\": \"12/34\", \
\"token_type\": \"red\", \
\"scope\": \"read write\", \
\"expires_in\": 3600, \
\"refresh_token\": \"foobar\", \
\"shape\": \"round\", \
\"height\": 12\
}"
.to_string()
.into_bytes(),
},
))
.unwrap();
assert_eq!("12/34", token.access_token().secret());
assert_eq!(ColorfulTokenType::Red, *token.token_type());
assert_eq!(
Some(&vec![
Scope::new("read".to_string()),
Scope::new("write".to_string()),
]),
token.scopes()
);
assert_eq!(3600, token.expires_in().unwrap().as_secs());
assert_eq!("foobar", token.refresh_token().clone().unwrap().secret());
assert_eq!(Some(&"round".to_string()), token.extra_fields().shape());
assert_eq!(12, token.extra_fields().height());
// Ensure that serialization produces an equivalent JSON value.
let serialized_json = serde_json::to_string(&token).unwrap();
assert_eq!(
"{\"access_token\":\"12/34\",\"token_type\":\"red\",\"expires_in\":3600,\
\"refresh_token\":\"foobar\",\"scope\":\"read write\",\"shape\":\"round\",\"height\":12}"
.to_string(),
serialized_json
);
let deserialized_token =
serde_json::from_str::<ColorfulTokenResponse>(&serialized_json).unwrap();
assert_token_eq(&token, &deserialized_token);
} | rust_cleaned_test_functions.jsonl/18610 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1360
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31035,
92951,
6615,
27675,
9455,
9655,
368,
341,
262,
990,
656,
486,
3423,
1262,
31035,
56162,
262,
1077,
2943,
284,
3478,
1262,
2959,
486,
931,
1006,
286,
8423,
764,
486,
931,
445,
32646,
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_get_raster_size() {
let dataset = Dataset::open(fixture!("tinymarble.png")).unwrap();
let (size_x, size_y) = dataset.size();
assert_eq!(size_x, 100);
assert_eq!(size_y, 50);
} | rust_cleaned_test_functions.jsonl/83427 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
1710,
2300,
2368,
368,
341,
262,
1077,
10337,
284,
39183,
486,
2508,
94886,
17223,
55971,
1600,
277,
891,
3508,
15197,
15454,
543,
262,
1077,
320,
2141,
3212,
11,
1379,
4178,
8,
284,
10337,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_thread_list_from_parent() {
let num_of_threads = 5;
let mut child = start_child_and_wait_for_threads(num_of_threads);
let pid = child.id() as i32;
let mut dumper =
linux_ptrace_dumper::LinuxPtraceDumper::new(pid).expect("Couldn't init dumper");
assert_eq!(dumper.threads.len(), num_of_threads);
dumper.suspend_threads().expect("Could not suspend threads");
// let mut matching_threads = 0;
for (idx, curr_thread) in dumper.threads.iter().enumerate() {
println!("curr_thread: {}", curr_thread);
let info = dumper
.get_thread_info_by_index(idx)
.expect("Could not get thread info by index");
let (_stack_ptr, stack_len) = dumper
.get_stack_info(info.stack_pointer)
.expect("Could not get stack_pointer");
assert!(stack_len > 0);
}
dumper.resume_threads().expect("Failed to resume threads");
child.kill().expect("Failed to kill process");
// Reap child
let waitres = child.wait().expect("Failed to wait for child");
let status = waitres.signal().expect("Child did not die due to signal");
assert_eq!(waitres.code(), None);
assert_eq!(status, Signal::SIGKILL as i32);
// We clean up the child process before checking the final result
} | rust_cleaned_test_functions.jsonl/126012 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 579
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10814,
2019,
5673,
15960,
368,
341,
262,
1077,
1629,
3575,
29725,
284,
220,
20,
280,
262,
1077,
5206,
1682,
284,
1191,
17268,
8378,
18760,
5478,
29725,
8068,
3575,
29725,
317,
262,
1077,
14814,
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... | 2 |
#[test]
fn test_meta_item_list_name_value() {
run_test(
"#[foo(bar = 5)]",
MetaList {
ident: ident("foo").into(),
paren_token: Default::default(),
nested: punctuated![NestedMeta::Meta(
MetaNameValue {
ident: ident("bar").into(),
eq_token: Default::default(),
lit: lit(Literal::i32_unsuffixed(5)),
}.into(),
),],
},
)
} | rust_cleaned_test_functions.jsonl/63944 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 289
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13381,
5634,
2019,
1269,
3142,
368,
341,
262,
1598,
4452,
1006,
286,
5869,
58,
7975,
54630,
284,
220,
20,
7252,
756,
286,
15819,
852,
341,
310,
3524,
25,
3524,
445,
7975,
1827,
18122,
3148,
310,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simple() {
let mut m = Sha1::new();
let tests = [
("The quick brown fox jumps over the lazy dog",
"2fd4e1c67a2d28fced849ee1bb76e7391b93eb12"),
("The quick brown fox jumps over the lazy cog",
"de9f2c7fd25e1b3afad3e85a0bd17d9b100db4b3"),
("", "da39a3ee5e6b4b0d3255bfef95601890afd80709"),
("testing\n", "9801739daae44ec5293d4e1f53d3f4d2d426d91c"),
("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"025ecbd5d70f8fb3c5457cd96bab13fda305dc59"),
("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"4300320394f7ee239bcdce7d3b8bcee173a0cd5c"),
("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"cef734ba81a024479e09eb5a75b6ddae62e6abf1"),
];
for &(s, ref h) in tests.iter() {
let data = s.as_bytes();
m.reset();
m.update(data);
let hh = m.digest().to_string();
assert_eq!(hh.len(), h.len());
assert_eq!(hh, *h);
}
} | rust_cleaned_test_functions.jsonl/74477 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 626
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
368,
341,
286,
1077,
5206,
296,
284,
27970,
16,
486,
931,
1428,
286,
1077,
7032,
284,
2278,
310,
3489,
785,
3974,
13876,
38835,
34208,
916,
279,
15678,
5562,
756,
1797,
330,
17,
6902,
19,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_buffer_get_allocated() {
let mut ring = RingBuffer::new(vec![b'.'; 12]);
assert_eq!(ring.get_allocated(16, 4), b"");
assert_eq!(ring.get_allocated(0, 4), b"");
ring.enqueue_slice(b"abcd");
assert_eq!(ring.get_allocated(0, 8), b"abcd");
ring.enqueue_slice(b"efghijkl");
ring.dequeue_many(4).copy_from_slice(b"....");
assert_eq!(ring.get_allocated(4, 8), b"ijkl");
ring.enqueue_slice(b"abcd");
assert_eq!(ring.get_allocated(4, 8), b"ijkl");
} | rust_cleaned_test_functions.jsonl/37271 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 283
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7776,
3062,
82342,
368,
341,
286,
1077,
5206,
10058,
284,
21525,
4095,
486,
931,
25592,
20703,
65,
6,
3159,
26,
220,
16,
17,
10149,
286,
2060,
10714,
10297,
12640,
670,
82342,
7,
16,
21,
11,
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_213() {
assert_eq!(Solution::rob(vec![2, 3, 2]), 3);
assert_eq!(Solution::rob(vec![0]), 0);
assert_eq!(Solution::rob(vec![1, 2, 3, 1]), 4);
} | rust_cleaned_test_functions.jsonl/54519 | {
"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,
62,
17,
16,
18,
368,
341,
286,
2060,
10714,
10297,
36842,
486,
22740,
25592,
20703,
17,
11,
220,
18,
11,
220,
17,
9719,
220,
18,
317,
286,
2060,
10714,
10297,
36842,
486,
22740,
25592,
20703,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_string_builder() {
let mut builder = LargeStringBuilder::with_capacity(3, 3);
builder.append_value("foo");
builder.append_null();
builder.append_value("bar");
let out = builder.finish();
let vals = out.iter().collect::<Vec<_>>();
assert_eq!(vals, &[Some("foo"), None, Some("bar")]);
dbg!(out);
} | rust_cleaned_test_functions.jsonl/48487 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 177
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
28532,
368,
341,
286,
1077,
5206,
7363,
284,
20286,
69412,
486,
4197,
35603,
7,
18,
11,
220,
18,
317,
286,
7363,
2057,
3142,
445,
7975,
797,
286,
7363,
2057,
15162,
543,
286,
7363,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_process_push_update() {
let mut crds = Crds::default();
let mut push = CrdsGossipPush::default();
let mut ci = ContactInfo::new_localhost(&Pubkey::new_rand(), 0);
ci.wallclock = 0;
let value_old = CrdsValue::ContactInfo(ci.clone());
// push a new message
assert_eq!(
push.process_push_message(&mut crds, value_old.clone(), 0),
Ok(None)
);
// push an old version
ci.wallclock = 1;
let value = CrdsValue::ContactInfo(ci.clone());
assert_eq!(
push.process_push_message(&mut crds, value, 0)
.unwrap()
.unwrap()
.value,
value_old
);
} | rust_cleaned_test_functions.jsonl/87050 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 391
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
14218,
8882,
368,
341,
286,
1077,
5206,
1560,
5356,
284,
4553,
5356,
486,
2258,
543,
286,
1077,
5206,
4484,
284,
4553,
5356,
38,
41473,
16644,
486,
2258,
543,
286,
1077,
5206,
11825,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_ascii_lowercase() {
assert_all!(is_ascii_lowercase,
"abcdefghijklmnopqrstuvwxyz",
);
assert_none!(is_ascii_lowercase,
"ABCDEFGHIJKLMNOQPRSTUVWXYZ",
"0123456789",
"!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
" \t\n\x0c\r",
"\x00\x01\x02\x03\x04\x05\x06\x07",
"\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
"\x10\x11\x12\x13\x14\x15\x16\x17",
"\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
"\x7f",
);
} | rust_cleaned_test_functions.jsonl/35076 | {
"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,
6892,
50238,
93129,
368,
341,
286,
2060,
5705,
10297,
285,
50238,
93129,
345,
310,
330,
67512,
756,
286,
1439,
286,
2060,
31488,
10297,
285,
50238,
93129,
345,
310,
330,
71286,
70518,
8996,
48,
64... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_line() {
let err = Model::train("data/empty_line.ffm").unwrap_err();
assert_eq!(err.to_string(), "FFM error (line: 2): expected line to start with int".to_string());
} | rust_cleaned_test_functions.jsonl/25226 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 92
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
6528,
368,
341,
286,
1077,
1848,
284,
4903,
486,
10397,
445,
691,
14,
3194,
6528,
83885,
76,
1827,
15454,
9266,
543,
286,
2060,
10714,
10297,
615,
2389,
3904,
1507,
330,
1748,
44,
1465,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_fork_merge_false() {
let mut ds = DataStack::new();
let cs = TestConstraintSystem::<Bn256>::new();
let value = Scalar::new_constant_usize(42, zinc_types::ScalarType::Field);
ds.set(4, Cell::Value(value))
.expect(zinc_const::panic::TEST_DATA_VALID);
ds.fork();
assert_cell_eq(
ds.get(4).expect(zinc_const::panic::TEST_DATA_VALID),
BigInt::from(42),
);
let value2 = Scalar::new_constant_usize(13, zinc_types::ScalarType::Field);
ds.set(4, Cell::Value(value2))
.expect(zinc_const::panic::TEST_DATA_VALID);
assert_cell_eq(
ds.get(4).expect(zinc_const::panic::TEST_DATA_VALID),
BigInt::from(13),
);
let condition = Scalar::new_constant_bool(false);
ds.merge(cs, condition)
.expect(zinc_const::panic::TEST_DATA_VALID);
assert_cell_eq(
ds.get(4).expect(zinc_const::panic::TEST_DATA_VALID),
BigInt::from(42),
);
} | rust_cleaned_test_functions.jsonl/106058 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 469
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
669,
20888,
36015,
368,
341,
262,
1077,
5206,
11472,
284,
2885,
4336,
486,
931,
543,
262,
1077,
10532,
284,
3393,
17890,
2320,
27638,
33,
77,
17,
20,
21,
6831,
931,
543,
262,
1077,
897,
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_hover_infer_associated_method_exact() {
check(
r#"
mod wrapper {
pub struct Thing { x: u32 }
impl Thing {
pub fn new() -> Thing { Thing { x: 0 } }
}
}
fn main() { let foo_test = wrapper::Thing::new$0(); }
"#,
expect![[r#"
*new*
```rust
test::wrapper::Thing
```
```rust
pub fn new() -> Thing
```
"#]],
)
} | rust_cleaned_test_functions.jsonl/117607 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 291
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53445,
1243,
802,
58665,
657,
9032,
71084,
368,
341,
262,
1779,
1006,
286,
435,
2,
698,
2593,
13261,
341,
262,
6675,
2036,
37200,
314,
856,
25,
575,
18,
17,
555,
262,
11605,
37200,
341,
286,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_timestamp_other() {
assert_de_tokens_error::<UnixTimestamp>(
&[Token::Bool(true)],
"invalid type: boolean `true`, expected a non-negative timestamp or datetime string",
);
} | rust_cleaned_test_functions.jsonl/13695 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 113
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
23073,
30456,
368,
341,
286,
2060,
2259,
28838,
4096,
27638,
55832,
20812,
17055,
310,
44590,
3323,
486,
11233,
3715,
30749,
310,
330,
11808,
943,
25,
2710,
1565,
1866,
7808,
3601,
264,
2477,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_serialize_ilint() {
let mut writer = VecWriter::new();
match writer.serialize_ilint(ILINT_SAMPLE) {
Ok(()) => (),
_ => panic!(),
}
assert_eq!(writer.as_slice(), &ILINT_SAMPLE_BIN);
writer.set_read_only(true);
match writer.serialize_ilint(ILINT_SAMPLE) {
Err(ErrorKind::IOError(_)) => (),
_ => panic!(),
}
} | rust_cleaned_test_functions.jsonl/25681 | {
"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,
88686,
26743,
396,
368,
341,
262,
1077,
5206,
6916,
284,
11312,
6492,
486,
931,
1428,
262,
2432,
6916,
33969,
26743,
396,
94448,
3221,
41439,
8,
341,
286,
7622,
7,
2140,
589,
84201,
286,
716,
58... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_retention_policy_invalid() {
let actual = RetentionPolicy::from_str("y1d88a1b2c3m5").unwrap();
let expected = RetentionPolicy {
yearly: Some(1),
monthly: Some(5),
weekly: None,
daily: Some(88),
hourly: None,
};
assert_eq!(actual, expected);
} | rust_cleaned_test_functions.jsonl/48502 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 190
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21695,
2939,
22773,
31433,
368,
341,
286,
1077,
5042,
284,
10392,
78165,
486,
1499,
2895,
445,
88,
16,
67,
23,
23,
64,
16,
65,
17,
66,
18,
76,
20,
1827,
15454,
543,
286,
1077,
3601,
284,
103... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_edge_pixels() {
#[rustfmt::skip]
let im = vec![5, 6, 7, 8, 9,
4, 0, 0, 0, 0,
3, 0, 0, 0, 0,
2, 0, 0, 0, 0,
1, 0, 0, 0, 0];
let (e0, e1, e2, e3, e4, e5, e6, e7, e8) = edge_pixels(&im, 1, 1, 5);
assert_eq!(e0, 1);
assert_eq!(e1, 2);
assert_eq!(e2, 3);
assert_eq!(e3, 4);
assert_eq!(e4, 5);
assert_eq!(e5, 6);
assert_eq!(e6, 7);
assert_eq!(e7, 8);
assert_eq!(e8, 9);
} | rust_cleaned_test_functions.jsonl/44866 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 406
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17932,
49745,
368,
341,
286,
11506,
35788,
12501,
486,
20599,
921,
286,
1077,
732,
284,
7486,
20703,
20,
11,
220,
21,
11,
220,
22,
11,
220,
23,
11,
220,
24,
345,
2549,
220,
19,
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_row_as_slice_complex() {
let table = Table::find_first(TABLE_COMPLEX).unwrap();
let mut iter = table.iter();
let empty: [&str; 0] = [];
assert_eq!(&["John", "20"], iter.next().unwrap().as_slice());
assert_eq!(&["May", "30", "foo"], iter.next().unwrap().as_slice());
assert_eq!(&empty, iter.next().unwrap().as_slice());
assert_eq!(&["a", "b", "c", "d"], iter.next().unwrap().as_slice());
assert_eq!(None, iter.next());
} | rust_cleaned_test_functions.jsonl/47597 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 231
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8530,
11898,
26488,
41522,
368,
341,
286,
1077,
1965,
284,
6633,
486,
3903,
12978,
83006,
97820,
568,
15454,
543,
286,
1077,
5206,
5367,
284,
1965,
19471,
543,
286,
1077,
4287,
25,
34336,
495,
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_rwlock_downgrade() {
let x = Arc::new(RwLock::new(0));
let mut handles = Vec::new();
for _ in 0..8 {
let x = x.clone();
handles.push(thread::spawn(move || {
for _ in 0..100 {
let mut writer = x.write();
*writer += 1;
let cur_val = *writer;
let reader = RwLockWriteGuard::downgrade(writer);
assert_eq!(cur_val, *reader);
}
}));
}
for handle in handles {
handle.join().unwrap()
}
assert_eq!(*x.read(), 800);
} | rust_cleaned_test_functions.jsonl/15760 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 391
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
98850,
13998,
6937,
368,
341,
286,
1077,
856,
284,
19689,
486,
931,
2785,
86,
11989,
486,
931,
7,
15,
1106,
286,
1077,
5206,
13469,
284,
11312,
486,
931,
543,
286,
369,
716,
304,
220,
15,
496,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_groth16_bench() {
let n_average = 3; // number of times we do the benchmarking to average out results
let nb_proofs = vec![8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192];
let max = *nb_proofs.last().unwrap();
let public_inputs = 350; // roughly what a prove commit needs
let mut rng = rand_chacha::ChaChaRng::seed_from_u64(0u64);
// CRS for aggregation
let generic = setup_fake_srs(&mut rng, max);
// Create parameters for our circuit
let params = {
let c = TestCircuit::<Bls12> {
public_inputs: vec![Default::default(); public_inputs],
public_product: Default::default(),
witness_input: Default::default(),
};
generate_random_parameters(c, &mut rng).unwrap()
};
// verification key for indivdual verification of proof
let pvk = prepare_verifying_key(¶ms.vk);
let (proofs, statements): (Vec<Proof<Bls12>>, Vec<Vec<Fr>>) = (0..max)
.map(|_| generate_proof(public_inputs, ¶ms, &mut rng))
.unzip();
let mut writer = csv::Writer::from_path("aggregation.csv").expect("unable to open csv writer");
println!("Generating {} Groth16 proofs...", max);
let mut buf = Vec::new();
proofs[0].write(&mut buf).expect("buffer");
let proof_size = buf.len();
let inclusion = vec![1, 2, 3];
for i in nb_proofs {
let mut records = Vec::new();
let (pk, vk) = generic.specialize(i);
for _ in 0..n_average {
println!("Proofs {}", i);
// Aggregate proofs using inner product proofs
let start = Instant::now();
println!("\t-Aggregation...");
let aggregate_proof = aggregate_proofs::<Bls12>(&pk, &inclusion, &proofs[..i])
.expect("failed to aggregate proofs");
let prover_time = start.elapsed().as_millis();
println!("\t-Aggregate Verification ...");
let mut buffer = Vec::new();
aggregate_proof.write(&mut buffer).unwrap();
let start = Instant::now();
let deserialized =
AggregateProof::<Bls12>::read(std::io::Cursor::new(&buffer)).unwrap();
let result = verify_aggregate_proof(
&vk,
&pvk,
&mut rng,
&statements[..i],
&deserialized,
&inclusion,
);
assert!(result.unwrap());
let verifier_time = start.elapsed().as_millis();
println!("\t-Batch per 10 packets verification...");
let batches: Vec<_> = proofs
.iter()
.cloned()
.take(i)
.zip(statements.iter().cloned().take(i))
.chunks(10)
.into_iter()
.map(|s| s.collect())
.collect::<Vec<Vec<(Proof<Bls12>, Vec<Fr>)>>>();
let start = Instant::now();
batches.par_iter().for_each(|batch| {
let batch_proofs = batch.iter().by_ref().map(|(p, _)| p).collect::<Vec<_>>();
let batch_statements = batch
.iter()
.map(|(_, state)| state.clone())
.collect::<Vec<_>>();
let mut rng = rand_chacha::ChaChaRng::seed_from_u64(0u64);
assert!(
verify_proofs_batch(&pvk, &mut rng, &batch_proofs, &batch_statements).unwrap()
)
});
let batch_verifier_time = start.elapsed().as_millis();
println!("\t-Batch all-in verification...");
let proofs_serialized = proofs.iter().take(i).map(|p| {
let mut buff = Vec::new();
p.write(&mut buff).unwrap();
buff
});
let start = Instant::now();
let proofs: Vec<_> = proofs_serialized
.into_iter()
.map(|buff| Proof::<Bls12>::read(std::io::Cursor::new(&buff)).unwrap())
.collect::<Vec<_>>();
let proofs_ref: Vec<_> = proofs.iter().collect();
assert!(verify_proofs_batch(&pvk, &mut rng, &proofs_ref, &statements[..i]).unwrap());
let batch_all_time = start.elapsed().as_millis();
let agg_size = buffer.len();
records.push(Record {
nproofs: i as u32,
aggregate_create_ms: prover_time as u32,
aggregate_verify_ms: verifier_time as u32,
aggregate_size_bytes: agg_size as u32,
batch_verify_ms: batch_verifier_time as u32,
batch_size_bytes: (proof_size * i) as u32,
batch_all_ms: batch_all_time as u32,
});
}
let average = Record::average(&records);
writer
.serialize(average)
.expect("unable to write result to csv");
}
writer.flush().expect("failed to flush");
} | rust_cleaned_test_functions.jsonl/2136 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2517
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1889,
299,
339,
16,
21,
880,
19762,
368,
341,
262,
1077,
308,
38594,
284,
220,
18,
26,
442,
1372,
315,
3039,
582,
653,
279,
28431,
287,
311,
5461,
700,
3059,
198,
262,
1077,
16649,
2540,
36081... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_mac_bytes_conversion() {
let mac = 0x1234567890AB;
let serialized = bytes_of_mac(mac);
let deserialized = mac_of_bytes(serialized);
assert_eq!(mac, deserialized);
} | rust_cleaned_test_functions.jsonl/78225 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22802,
12524,
64132,
368,
341,
286,
1077,
8978,
284,
220,
15,
87,
16,
17,
18,
19,
20,
21,
22,
23,
24,
15,
1867,
401,
286,
1077,
32916,
284,
5820,
3575,
22802,
73611,
317,
286,
1077,
939,
675... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_secret_timeout() {
// Simple test of payment secret storage time outs
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
create_announced_chan_between_nodes(&nodes, 0, 1, InitFeatures::known(), InitFeatures::known()).0.contents.short_channel_id;
let (payment_hash, payment_secret_1) = nodes[1].node.create_inbound_payment(Some(100_000), 2, 0);
// block with time 7200 + CHAN_CONFIRM_DEPTH + 1.
if let Err(APIError::APIMisuseError { err }) = nodes[1].node.create_inbound_payment_for_hash(payment_hash, Some(100_000), 2, 0) {
assert_eq!(err, "Duplicate payment hash");
} else { panic!(); }
let mut block = {
let node_1_blocks = nodes[1].blocks.lock().unwrap();
Block {
header: BlockHeader {
version: 0x2000000,
prev_blockhash: node_1_blocks.last().unwrap().0.block_hash(),
merkle_root: Default::default(),
time: node_1_blocks.len() as u32 + 7200, bits: 42, nonce: 42 },
txdata: vec![],
}
};
connect_block(&nodes[1], &block);
if let Err(APIError::APIMisuseError { err }) = nodes[1].node.create_inbound_payment_for_hash(payment_hash, Some(100_000), 2, 0) {
assert_eq!(err, "Duplicate payment hash");
} else { panic!(); }
block.header.prev_blockhash = block.header.block_hash();
block.header.time += 1;
connect_block(&nodes[1], &block);
let our_payment_secret = nodes[1].node.create_inbound_payment_for_hash(payment_hash, Some(100_000), 2, 42).unwrap();
assert_ne!(payment_secret_1, our_payment_secret);
{
let logger = test_utils::TestLogger::new();
let net_graph_msg_handler = &nodes[0].net_graph_msg_handler;
let route = get_route(&nodes[0].node.get_our_node_id(), &net_graph_msg_handler.network_graph, &nodes[1].node.get_our_node_id(), Some(InvoiceFeatures::known()), None, &[], 100_000, TEST_FINAL_CLTV, &logger).unwrap();
nodes[0].node.send_payment(&route, payment_hash, &Some(our_payment_secret)).unwrap();
check_added_monitors!(nodes[0], 1);
let mut events = nodes[0].node.get_and_clear_pending_msg_events();
let mut payment_event = SendEvent::from_event(events.pop().unwrap());
nodes[1].node.handle_update_add_htlc(&nodes[0].node.get_our_node_id(), &payment_event.msgs[0]);
commitment_signed_dance!(nodes[1], nodes[0], payment_event.commitment_msg, false);
}
// Note that after leaving the above scope we have no knowledge of any arguments or return
// values from previous calls.
expect_pending_htlcs_forwardable!(nodes[1]);
let events = nodes[1].node.get_and_clear_pending_events();
assert_eq!(events.len(), 1);
match events[0] {
Event::PaymentReceived { purpose: PaymentPurpose::InvoicePayment { payment_preimage, payment_secret, user_payment_id }, .. } => {
assert!(payment_preimage.is_none());
assert_eq!(user_payment_id, 42);
assert_eq!(payment_secret, our_payment_secret);
// We don't actually have the payment preimage with which to claim this payment!
},
_ => panic!("Unexpected event"),
}
} | rust_cleaned_test_functions.jsonl/16954 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1190
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21962,
20537,
368,
341,
197,
322,
8993,
1273,
315,
8160,
6234,
5819,
882,
22806,
198,
10217,
26023,
1645,
18343,
82,
284,
1855,
45552,
1645,
18343,
82,
7,
17,
317,
10217,
2436,
18343,
82,
284,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_array_literal() {
fold("(![])", "false");
fold("(![1])", "false");
fold("(![a])", "false");
fold_same("foo(), false;");
} | rust_cleaned_test_functions.jsonl/122223 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 79
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
34100,
368,
341,
262,
11555,
445,
3471,
1294,
11583,
330,
3849,
797,
262,
11555,
445,
3471,
58,
16,
2467,
497,
330,
3849,
797,
262,
11555,
445,
3471,
58,
64,
2467,
497,
330,
3849,
797,
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 |
#[test]
fn test_lazy_ternary_and_predicates() {
let df = get_df();
// really need to check the root column
let ldf = df
.clone()
.lazy()
.with_column(lit(3).alias("foo"))
.filter(col("foo").is_not_null());
let _new = ldf.collect().unwrap();
let ldf = df
.lazy()
.with_column(
when(col("sepal.length").lt(lit(5.0)))
.then(
lit(3), // is another type on purpose to check type coercion
)
.otherwise(col("sepal.width"))
.alias("foo"),
)
.filter(col("foo").gt(lit(3.0)));
let new = ldf.collect().unwrap();
dbg!(new);
} | rust_cleaned_test_functions.jsonl/114 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 385
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49646,
62,
4160,
658,
8378,
12830,
24821,
368,
341,
262,
1077,
6764,
284,
633,
10894,
543,
1066,
262,
442,
2167,
1184,
311,
1779,
279,
3704,
3250,
198,
262,
1077,
326,
2940,
284,
6764,
198,
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_g1_addition_correctness() {
let mut p = G1Projective::new(
Fq::from_repr(BigInteger768([
0xdfc2b7cbc7c68dd3,
0xda35f108daf8530a,
0xed1046ac66215fc2,
0x456d3bec410beaa6,
0x83c63b83fe368eb7,
0x7f3cf1cdbb8d1853,
0x3e750f1448b7d6d1,
0x73c851e84a248dd4,
0x54c871325cf89d71,
0xb12d77db967730e8,
0x6c13fdb8114e2ee5,
0x178dc471842c9,
])),
Fq::from_repr(BigInteger768([
0xd4d304c070359df4,
0x5adaedd2f9769957,
0x9de60988567a0d8c,
0x1597b5a2f48619ed,
0xf12ac0e35580012b,
0xec8d60978bf1abf3,
0xfef31c938dc5e3ec,
0x92afc1446830abca,
0xbf2f83c9f917e43b,
0x989cd6d6e7be1543,
0xa0f2fcb4e8bbdaf0,
0xf93208b6420f,
])),
Fq::from_repr(BigInteger768([
0xda8eb0b8eef48fac,
0x87b1d0180184f6c0,
0xe6a04246ed619d42,
0x501ee89d33c211de,
0xcfe58f6f87258b40,
0x742345656f9fd427,
0xe8f4d82210ea7d4e,
0xa51004b4f76e2fc2,
0xc87d9dae17bfc00c,
0x9e38fcd739c6212d,
0x7c5aa6a69ea22272,
0x134d799c12c4e,
])),
);
p.add_assign(&G1Projective::new(
Fq::from_repr(BigInteger768([
0xd8b796054c3c07aa,
0x7a2d262560ad2558,
0xe9fb791faa62f5e4,
0x5efb0ed78efd43c4,
0xe7b524c5b6e01e61,
0x526a03896c7f0c9f,
0x5a9f513428a2d469,
0xe27368abe47ec9e6,
0xc1b7389ed619aac1,
0x549f36555acde762,
0xf7a4799366140f73,
0xb530c14e43de,
])),
Fq::from_repr(BigInteger768([
0xcab7d6b352fa4d19,
0xe9f3586d0007f1a6,
0xdd1eb2c0c9af5d0,
0x1361a6325decd10a,
0x6e4f39f933bc89d5,
0xe601021834b48b43,
0x6f34ae367a105a4d,
0xf1d34502f2a97dae,
0x9c21874f2ddb6af9,
0xf6cafeb3010bb13f,
0x53566dd8c94a881,
0x1d645de11625,
])),
Fq::from_repr(BigInteger768([
0xfb60f671d178d6e7,
0xb785b67ab21fea76,
0xfcb57401fe0ffe84,
0xa12d2ea0964e19a5,
0x2fab37c250e2a2fa,
0x868711fb5eaad3f,
0xb1868139f022ff77,
0xa1b225670e5bdcdd,
0x6dcdf5cfbcec9f85,
0xbbcf4300efa53b07,
0x695973d4beef9e99,
0x6d46f5bcabde,
])),
));
let p = G1Affine::from(p);
assert_eq!(
p,
G1Affine::new(
Fq::from_repr(BigInteger768([
0x4c0019d20f21bf0a,
0x2412bb7c69103f8c,
0xd837c81e51c23d86,
0x25863118bf7cfccd,
0xe33772d47fca8100,
0xce263b8a45563538,
0xd6d598765ee2b934,
0x34e9e3c25ccc604f,
0x4e3fdafc45d53a68,
0xc92e2e4e5131ab8e,
0x6da3e8856ccf21c3,
0x89821510d8c7,
])),
Fq::from_repr(BigInteger768([
0x717e3ffa2193697,
0x411a81406abf8fc7,
0x6c3f0710357570d0,
0x9d999acc5cf81a11,
0x81b6bf821df14a35,
0x31135663344492a8,
0x6da16e1624afd3a0,
0x1c9a4d2e8eda6ba8,
0xabe3b7346ad95eee,
0xe39afac6814ca651,
0xe0da6a8c4eb633d9,
0xeed8b99aecdc,
])),
false,
)
);
} | rust_cleaned_test_functions.jsonl/52500 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2863
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1889,
16,
2891,
680,
31550,
2090,
368,
341,
262,
1077,
5206,
281,
284,
479,
16,
7849,
533,
486,
931,
1006,
286,
434,
80,
486,
1499,
68535,
91756,
22,
21,
23,
8956,
310,
220,
15,
53833,
66,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_helper_unquote() -> Result<(), Box<dyn Error>> {
assert_renders![
(r##"{{ unquote "''" }}"##, r##""##),
(r##"{{ unquote "'f'" }}"##, r##"f"##),
(r##"{{ unquote "foo" }}"##, r##"foo"##),
(r##"{{ unquote "'foo'" }}"##, r##"foo"##),
(r##"{{ unquote "\"foo\"" }}"##, r##"foo"##),
(r##"{{ unquote "foo'" }}"##, r##"foo'"##),
(r##"{{ unquote "'foo" }}"##, r##"'foo"##),
]
} | rust_cleaned_test_functions.jsonl/35005 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 290
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10418,
4907,
2949,
368,
1464,
5714,
68843,
8261,
92846,
4600,
2452,
341,
286,
2060,
1288,
303,
388,
90515,
310,
320,
81,
565,
1,
2979,
650,
2949,
330,
4605,
1,
14483,
565,
11,
435,
565,
3014,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_sysvar_invalid_id_with_feature() {
let mut transaction_context = TransactionContext::new(Vec::new(), 1);
let invoke_context = InvokeContext::new_mock(&mut transaction_context, &[]);
// Attempt to create system account in account already owned by another program
let from = Pubkey::new_unique();
let from_account = RefCell::new(AccountSharedData::new(100, 0, &system_program::id()));
let to = Pubkey::new_unique();
let to_account = RefCell::new(AccountSharedData::new(0, 0, &system_program::id()));
let signers = [from, to].iter().cloned().collect::<HashSet<_>>();
let to_address = to.into();
let result = create_account(
&KeyedAccount::new(&from, true, &from_account),
&KeyedAccount::new(&to, false, &to_account),
&to_address,
50,
2,
&sysvar::id(),
&signers,
&invoke_context,
);
assert_eq!(result, Ok(()));
} | rust_cleaned_test_functions.jsonl/106195 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 473
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
20344,
947,
31433,
842,
6615,
17069,
368,
341,
286,
1077,
5206,
7745,
8467,
284,
17869,
1972,
486,
931,
49923,
486,
931,
1507,
220,
16,
317,
286,
1077,
19873,
8467,
284,
39667,
1972,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_merge_nulls_constant() {
#[rpn_fn]
fn foo(v: &Real) -> Result<Option<Real>> {
Ok(Some(*v * 2.5))
}
let exp = RpnExpressionBuilder::new_for_test()
.push_constant_for_test(ScalarValue::Real(Real::new(10.0).ok()))
.push_fn_call_for_test(foo_fn_meta(), 1, FieldTypeTp::Double)
.build_for_test();
let mut ctx = EvalContext::default();
let mut columns = LazyBatchColumnVec::empty();
let val = exp.eval(&mut ctx, &[], &mut columns, &[], 10).unwrap();
assert!(val.is_vector());
assert_eq!(
val.vector_value().unwrap().as_ref().to_real_vec(),
(0..10)
.map(|_| Real::new(25.0).ok())
.collect::<Vec<Option<Real>>>()
);
} | rust_cleaned_test_functions.jsonl/92678 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 448
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20888,
15162,
82,
34967,
368,
341,
394,
11506,
81,
19958,
15246,
921,
286,
5168,
15229,
3747,
25,
609,
12768,
8,
1464,
5714,
94150,
64829,
2452,
341,
310,
7622,
65405,
4071,
85,
353,
220,
17,
13... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_schema_id_parts_for_id_as_unqualified() {
let (did, _, _) = _schema_id_unqualified().parts().unwrap();
assert_eq!(_did(), did);
} | rust_cleaned_test_functions.jsonl/130824 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25371,
842,
33217,
5478,
842,
11898,
4907,
36335,
368,
341,
310,
1077,
320,
22920,
11,
8358,
27439,
284,
716,
17349,
842,
4907,
36335,
1005,
18252,
1005,
15454,
543,
310,
2060,
10714,
0,
2490,
229... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_vec3_align() {
use std::mem;
if cfg!(any(feature = "packed-vec3", feature = "scalar-math")) {
assert_eq!(12, mem::size_of::<Vec3>());
assert_eq!(4, mem::align_of::<Vec3>());
assert_eq!(12, mem::size_of::<Vec3Mask>());
assert_eq!(4, mem::align_of::<Vec3Mask>());
} else {
assert_eq!(16, mem::size_of::<Vec3>());
assert_eq!(16, mem::align_of::<Vec3>());
assert_eq!(16, mem::size_of::<Vec3Mask>());
assert_eq!(16, mem::align_of::<Vec3Mask>());
}
} | rust_cleaned_test_functions.jsonl/84426 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 292
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
18,
37015,
368,
341,
262,
990,
1460,
486,
10536,
280,
262,
421,
13286,
10297,
3767,
27062,
284,
330,
50321,
12,
4083,
18,
497,
4565,
284,
330,
35342,
1448,
587,
2761,
341,
286,
2060,
1071... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_u64_into_boolean_vec_le() {
let mut cs = TestConstraintSystem::<Scalar>::new();
let bits = u64_into_boolean_vec_le(&mut cs, Some(17234652694787248421)).unwrap();
assert!(cs.is_satisfied());
assert_eq!(bits.len(), 64);
assert_eq!(bits[63 - 0].get_value().unwrap(), true);
assert_eq!(bits[63 - 1].get_value().unwrap(), true);
assert_eq!(bits[63 - 2].get_value().unwrap(), true);
assert_eq!(bits[63 - 3].get_value().unwrap(), false);
assert_eq!(bits[63 - 4].get_value().unwrap(), true);
assert_eq!(bits[63 - 5].get_value().unwrap(), true);
assert_eq!(bits[63 - 20].get_value().unwrap(), true);
assert_eq!(bits[63 - 21].get_value().unwrap(), false);
assert_eq!(bits[63 - 22].get_value().unwrap(), false);
} | rust_cleaned_test_functions.jsonl/13770 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 389
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7300,
21,
19,
45514,
46642,
13251,
11751,
368,
341,
286,
1077,
5206,
10532,
284,
3393,
17890,
2320,
27638,
20639,
6831,
931,
1428,
286,
1077,
9472,
284,
575,
21,
19,
45514,
46642,
13251,
11751,
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_summary() {
let client = MockClient::default();
let mut cfg = Config::default();
cfg.receiver_address = "127.0.0.1:12345".to_owned();
cfg.report_receiver_interval = ReadableDuration::millis(REPORT_INTERVAL_MS);
let (rh, crh, tf) = RecorderBuilder::default()
.enable(cfg.enabled)
.precision_ms(Arc::new(AtomicU64::new(PRECISION_MS)))
.add_sub_recorder(Box::new(SummaryRecorder::new(cfg.enabled)))
.spawn()
.expect("failed to create resource metering thread");
let mut worker = LazyWorker::new("test-worker");
worker.start_with_timer(Reporter::new(
client.clone(),
cfg.clone(),
crh,
worker.scheduler(),
));
let address = Arc::new(ArcSwap::new(Arc::new(cfg.receiver_address.clone())));
let mut cfg_manager =
resource_metering::ConfigManager::new(cfg, worker.scheduler(), rh, address);
/* At this point we are ready for everything except turning on the switch. */
// expect no data
{
let tf = tf.clone();
let client = client.clone();
thread::spawn(move || {
{
let mut ctx = Context::default();
ctx.set_resource_group_tag(b"TAG-1".to_vec());
let tag = tf.new_tag(&ctx);
let _g = tag.attach();
resource_metering::record_read_keys(123);
resource_metering::record_write_keys(456);
}
thread::sleep(Duration::from_millis(REPORT_INTERVAL_MS + 500)); // wait report
assert!(client.get(&b"TAG-1".to_vec()).is_none());
client.clear();
})
.join()
.unwrap();
}
// turn on
let mut change = ConfigChange::new();
change.insert("enabled".to_owned(), ConfigValue::Bool(true));
cfg_manager.dispatch(change).unwrap();
// expect can get data
{
let tf = tf.clone();
let client = client.clone();
thread::spawn(move || {
{
let mut ctx = Context::default();
ctx.set_resource_group_tag(b"TAG-1".to_vec());
let tag = tf.new_tag(&ctx);
let _g = tag.attach();
thread::sleep(Duration::from_millis(PRECISION_MS * 2)); // wait config apply
resource_metering::record_read_keys(123);
resource_metering::record_write_keys(456);
}
thread::sleep(Duration::from_millis(REPORT_INTERVAL_MS + 500)); // wait report
let r = client.get(&b"TAG-1".to_vec()).unwrap();
assert_eq!(r.get_record_list_read_keys().iter().sum::<u32>(), 123);
assert_eq!(r.get_record_list_write_keys().iter().sum::<u32>(), 456);
client.clear();
})
.join()
.unwrap();
}
// turn off
let mut change = ConfigChange::new();
change.insert("enabled".to_owned(), ConfigValue::Bool(false));
cfg_manager.dispatch(change).unwrap();
// expect no data
thread::spawn(move || {
{
let mut ctx = Context::default();
ctx.set_resource_group_tag(b"TAG-1".to_vec());
let tag = tf.new_tag(&ctx);
let _g = tag.attach();
thread::sleep(Duration::from_millis(PRECISION_MS * 2)); // wait config apply
resource_metering::record_read_keys(123);
resource_metering::record_write_keys(456);
}
thread::sleep(Duration::from_millis(REPORT_INTERVAL_MS + 500)); // wait report
assert!(client.get(&b"TAG-1".to_vec()).is_none());
client.clear();
})
.join()
.unwrap();
// stop worker
worker.stop();
} | rust_cleaned_test_functions.jsonl/80908 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1735
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27251,
368,
341,
262,
1077,
2943,
284,
14563,
2959,
486,
2258,
1428,
262,
1077,
5206,
13286,
284,
5532,
486,
2258,
543,
262,
13286,
80618,
6744,
284,
330,
16,
17,
22,
13,
15,
13,
15,
13,
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... | 4 |
#[test]
fn test_oob_callx_high() {
let prog = &mut [
0xb7, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, // r0 = 0
0x67, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
0x47, 0x08, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
0x8D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // callx r0
0x95, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // exit
];
let mut vm = EbpfVm::new(None).unwrap();
vm.set_program(prog).unwrap();
assert_eq!(42, vm.execute_program(&[], &[], &[]).unwrap());
} | rust_cleaned_test_functions.jsonl/15545 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 312
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14179,
674,
13429,
87,
22680,
368,
341,
262,
1077,
29271,
284,
609,
6984,
2278,
286,
220,
15,
7929,
22,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
11,
220... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_construct_mappings() {
let mappings = make_mappings(graph_factory());
let mappings = mappings.borrow();
assert_eq!(mappings.len(), 4);
assert!(mappings.get_namespace("xsd").is_some());
assert!(mappings.get_namespace("rdf").is_some());
assert!(mappings.get_namespace("rdfs").is_some());
assert!(mappings.get_namespace(DEFAULT_PREFIX).is_some());
} | rust_cleaned_test_functions.jsonl/63200 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 162
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64803,
84153,
368,
341,
262,
1077,
44817,
284,
1281,
84153,
24312,
24269,
1423,
262,
1077,
44817,
284,
44817,
83640,
1428,
262,
2060,
10714,
10297,
76,
23036,
19406,
1507,
220,
19,
626,
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_rev_iter() {
let m = generate_test();
for (i, elt) in m.iter().rev().enumerate() {
assert_eq!((6 - i) as int, *elt);
}
let mut n = DList::new();
assert_eq!(n.iter().rev().next(), None);
n.push_front(4);
let mut it = n.iter().rev();
assert_eq!(it.size_hint(), (1, Some(1)));
assert_eq!(it.next().unwrap(), &4);
assert_eq!(it.size_hint(), (0, Some(0)));
assert_eq!(it.next(), None);
} | rust_cleaned_test_functions.jsonl/56735 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 274
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38082,
11723,
368,
341,
286,
1077,
296,
284,
6923,
4452,
543,
286,
369,
320,
72,
11,
54139,
8,
304,
296,
19471,
1005,
7282,
1005,
76569,
368,
341,
310,
2060,
10714,
0,
1188,
21,
481,
600,
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... | 2 |
#[test]
fn test_interp_col() {
use super::{NONE, NONE5};
use approx::assert_abs_diff_eq;
use nalgebra::dvector;
let dfrom = Domain::new(0, 2, NONE5);
let dto = Domain::new(0, 10, NONE);
let min = dvector![0.0, 5.0, 10.0];
let m = lin_interp_mat_col(&dfrom, &dto, 1, min);
assert_abs_diff_eq!(
m,
DMatrix::<f64>::from_vec(
11,
1,
vec![0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0]
)
);
} | rust_cleaned_test_functions.jsonl/82195 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 303
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68711,
10211,
368,
341,
262,
990,
2256,
22964,
45425,
11,
42869,
20,
2440,
262,
990,
9848,
486,
2207,
31170,
15850,
10714,
280,
262,
990,
84533,
26083,
486,
67,
3215,
401,
262,
1077,
294,
1499,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_validate_max_gas_price_above_bounds() {
let vm_validator = TestValidator::new();
let address = account_config::aptos_root_address();
let transaction = transaction_test_helpers::get_test_signed_transaction(
address,
1,
&vm_genesis::GENESIS_KEYPAIR.0,
vm_genesis::GENESIS_KEYPAIR.1.clone(),
None,
0,
u64::MAX, /* max gas price */
XUS_NAME.to_owned(), /* gas currency code */
None,
);
let ret = vm_validator.validate_transaction(transaction).unwrap();
assert_eq!(
ret.status().unwrap(),
StatusCode::GAS_UNIT_PRICE_ABOVE_MAX_BOUND
);
} | rust_cleaned_test_functions.jsonl/35405 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 324
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
6345,
82116,
9040,
77315,
36878,
368,
341,
262,
1077,
10995,
64959,
284,
3393,
14256,
486,
931,
1428,
262,
1077,
2621,
284,
2692,
5332,
486,
2689,
436,
12993,
6744,
543,
262,
1077,
7745,
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_empty_primitive() {
let array = new_empty_array(&DataType::Int32);
let a = array.as_any().downcast_ref::<Int32Array>().unwrap();
assert_eq!(a.len(), 0);
let expected: &[i32] = &[];
assert_eq!(a.values(), expected);
} | rust_cleaned_test_functions.jsonl/7985 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 137
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
84087,
368,
341,
286,
1077,
1334,
284,
501,
15124,
3858,
2099,
22653,
486,
1072,
18,
17,
317,
286,
1077,
264,
284,
1334,
5357,
37248,
1005,
2923,
3829,
7793,
27638,
1072,
18,
17,
1857,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_select_transactions_per_cost() {
solana_logger::setup();
let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(10);
let bank = Arc::new(Bank::new_for_tests(&genesis_config));
let cost_model = Arc::new(RwLock::new(CostModel::default()));
let keypair = Keypair::new();
let transfer_tx = SanitizedTransaction::from_transaction_for_tests(
system_transaction::transfer(&keypair, &keypair.pubkey(), 1, Hash::default()),
);
let vote_tx = SanitizedTransaction::from_transaction_for_tests(
vote_transaction::new_vote_transaction(
vec![42],
Hash::default(),
Hash::default(),
&keypair,
&keypair,
&keypair,
None,
),
);
let transfer_tx_cost = cost_model
.read()
.unwrap()
.calculate_cost(&transfer_tx, false)
.sum();
// make a vec of txs
let txs = vec![transfer_tx.clone(), vote_tx.clone(), transfer_tx, vote_tx];
let qos_service = QosService::new(cost_model);
let txs_costs = qos_service.compute_transaction_costs(txs.iter(), false);
let cost_limit = transfer_tx_cost;
bank.write_cost_tracker()
.unwrap()
.set_limits(cost_limit, cost_limit);
let results = qos_service.select_transactions_per_cost(txs.iter(), txs_costs.iter(), &bank);
// verify that first transfer tx and all votes are allowed
assert_eq!(results.len(), txs.len());
assert!(results[0].is_ok());
assert!(results[1].is_ok());
assert!(results[2].is_err());
assert!(results[3].is_ok());
} | rust_cleaned_test_functions.jsonl/116533 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 873
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13051,
68182,
5678,
15890,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
40788,
2648,
1731,
314,
59366,
5332,
11,
5241,
335,
284,
1855,
16322,
13774,
5332,
7,
16,
15,
317,
286,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serde() {
let s = SmolStr::new("Hello, World");
let s = serde_json::to_string(&s).unwrap();
assert_eq!(s, "\"Hello, World\"");
let s: SmolStr = serde_json::from_str(&s).unwrap();
assert_eq!(s, "Hello, World");
} | rust_cleaned_test_functions.jsonl/106849 | {
"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,
75861,
450,
368,
341,
286,
1077,
274,
284,
4388,
337,
2580,
486,
931,
445,
9707,
11,
4337,
797,
286,
1077,
274,
284,
61570,
9455,
486,
983,
3904,
2099,
82,
568,
15454,
543,
286,
2060,
10714,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_valid_url_failure() -> Result<()> {
let bad_url = "https://example space com".to_string();
match validate_url(bad_url) {
Ok(u) => anyhow::bail!("got: {}, want: error", u),
Err(e) => {
assert!(
e.is::<url::ParseError>(),
"got: {:#?}, want: {}",
e,
url::ParseError::InvalidDomainCharacter
);
Ok(())
}
}
} | rust_cleaned_test_functions.jsonl/125244 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 317
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8337,
2903,
43618,
368,
1464,
5714,
71698,
341,
286,
1077,
3873,
2903,
284,
330,
2428,
1110,
8687,
3550,
469,
3263,
983,
3904,
543,
286,
2432,
9593,
2903,
1883,
329,
2903,
8,
341,
310,
7622,
815... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_iter() {
let a = Series::new("age", [23, 71, 9].as_ref());
let _b = a
.i32()
.unwrap()
.into_iter()
.map(|opt_v| opt_v.map(|v| v * 2));
} | rust_cleaned_test_functions.jsonl/6820 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 145
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
368,
341,
286,
1077,
264,
284,
11131,
486,
931,
445,
424,
497,
508,
17,
18,
11,
220,
22,
16,
11,
220,
24,
936,
300,
7793,
1423,
286,
1077,
716,
65,
284,
264,
198,
310,
659,
72,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_boolean_array_gt_scalar() {
let a: BooleanArray = vec![Some(true), Some(false), None].into();
let res1: Vec<Option<bool>> = gt_bool_scalar(&a, false).unwrap().iter().collect();
assert_eq!(res1, vec![Some(true), Some(false), None]);
let res2: Vec<Option<bool>> = gt_bool_scalar(&a, true).unwrap().iter().collect();
assert_eq!(res2, vec![Some(false), Some(false), None]);
} | rust_cleaned_test_functions.jsonl/45802 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 196
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46642,
3858,
37479,
41652,
368,
341,
286,
1077,
264,
25,
6992,
1857,
284,
7486,
20703,
8373,
3715,
701,
4329,
3576,
701,
2240,
936,
18122,
1428,
286,
1077,
592,
16,
25,
11312,
94150,
17028,
2452,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_min_abbreviation_1() {
assert_eq!(
Solution::min_abbreviation(String::from("apple"), vec![String::from("blade")]),
String::from("a4")
);
} | rust_cleaned_test_functions.jsonl/120828 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7260,
62,
76857,
62,
16,
368,
341,
286,
2060,
10714,
33673,
310,
12478,
486,
1065,
62,
76857,
2242,
486,
1499,
445,
22377,
3975,
7486,
20703,
703,
486,
1499,
445,
62727,
899,
17036,
310,
923,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_get_protection_wep() {
let dev_info = test_utils::fake_device_info(CLIENT_ADDR);
let client_config = ClientConfig::from_config(SmeConfig::default().with_wep(), false);
let hasher = WlanHasher::new(DUMMY_HASH_KEY);
// WEP-40 with credentials:
let credential = fidl_sme::Credential::Password(b"wep40".to_vec());
let bss = fake_bss_description!(Wep);
let protection = get_protection(&dev_info, &client_config, &credential, &bss, &hasher);
assert_variant!(protection, Ok(Protection::Wep(_)));
// WEP-104 with credentials:
let credential = fidl_sme::Credential::Password(b"superinsecure".to_vec());
let bss = fake_bss_description!(Wep);
let protection = get_protection(&dev_info, &client_config, &credential, &bss, &hasher);
assert_variant!(protection, Ok(Protection::Wep(_)));
// WEP without credentials:
let credential = fidl_sme::Credential::None(fidl_sme::Empty);
let bss = fake_bss_description!(Wep);
get_protection(&dev_info, &client_config, &credential, &bss, &hasher)
.expect_err("WEP network not supported");
// WEP with invalid credentials:
let credential = fidl_sme::Credential::Password(b"wep".to_vec());
let bss = fake_bss_description!(Wep);
get_protection(&dev_info, &client_config, &credential, &bss, &hasher)
.expect_err("expected error for invalid WEP credentials");
} | rust_cleaned_test_functions.jsonl/101627 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 644
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
2540,
39141,
1670,
747,
368,
341,
286,
1077,
3483,
3109,
284,
1273,
17309,
486,
30570,
9204,
3109,
52991,
10757,
16058,
317,
286,
1077,
2943,
5332,
284,
8423,
2648,
486,
1499,
5332,
3759,
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_deserialization_of_null() -> serde_json::Result<()> {
let payload = r#"{"query":"query","variables":null}"#;
let payload: StartPayload<DefaultScalarValue> = serde_json::from_str(payload)?;
let expected = StartPayload {
query: "query".into(),
variables: Variables::default(),
operation_name: None,
};
assert_eq!(expected, payload);
Ok(())
} | rust_cleaned_test_functions.jsonl/27162 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 207
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15768,
50563,
3575,
15162,
368,
1464,
61570,
9455,
486,
2077,
71698,
341,
286,
1077,
7729,
284,
435,
55543,
4913,
1631,
3252,
1631,
2198,
18616,
788,
2921,
9863,
2,
280,
286,
1077,
7729,
25,
5145,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_dollar_plus_dollar() {
let bank = Bank::new();
let expression = dollar(6.0).plus(dollar(4.0));
let reduced = bank.reduce(&expression, "USD");
assert_eq!(dollar(6.0 + 4.0), reduced);
} | rust_cleaned_test_functions.jsonl/133364 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
21295,
28043,
814,
21295,
368,
341,
286,
1077,
6073,
284,
8547,
486,
931,
543,
286,
1077,
7493,
284,
17692,
7,
21,
13,
15,
568,
7138,
1500,
21295,
7,
19,
13,
15,
1106,
286,
1077,
11046,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_type_name() {
assert_eq!(
CursorShape::from_type_name("block"),
Some(CursorShape::Block)
);
assert_eq!(
CursorShape::from_type_name("horizontal"),
Some(CursorShape::Horizontal)
);
assert_eq!(
CursorShape::from_type_name("vertical"),
Some(CursorShape::Vertical)
);
} | rust_cleaned_test_functions.jsonl/94970 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 228
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
1819,
1269,
368,
341,
286,
2060,
10714,
33673,
310,
28067,
12301,
486,
1499,
1819,
1269,
445,
4574,
4461,
310,
4329,
3025,
3823,
12301,
486,
4713,
340,
286,
1439,
286,
2060,
10714,
33673,
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_has_duplicates() {
let a = vec![1, 2, 3, 4, 5];
assert_eq!(a.iter().has_duplicates(), false);
let a = vec![1, 2, 1, 4, 5];
assert_eq!(a.iter().has_duplicates(), true);
} | rust_cleaned_test_functions.jsonl/91326 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21778,
75051,
368,
341,
286,
1077,
264,
284,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
286,
2060,
10714,
10297,
64,
19471,
1005,
4648,
75051,
1507,
895,
626,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_router_detect10() {
let router = Router::new().push(Router::with_path(r"users/<*sub:/(images|css)/.+/>").handle(fake_handler));
let mut req: Request = hyper::Request::builder()
.uri("http://local.host/users/12/m.jpg")
.body(hyper::Body::empty())
.unwrap()
.into();
let mut path_state = PathState::new(req.uri().path());
let matched = router.detect(&mut req, &mut path_state);
assert!(matched.is_none());
let mut req: Request = hyper::Request::builder()
.uri("http://local.host/users/css/abc/m.jpg")
.body(hyper::Body::empty())
.unwrap()
.into();
let mut path_state = PathState::new(req.uri().path());
let matched = router.detect(&mut req, &mut path_state);
assert!(matched.is_some());
} | rust_cleaned_test_functions.jsonl/3302 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 412
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55587,
56457,
16,
15,
368,
341,
286,
1077,
9273,
284,
10554,
486,
931,
1005,
9077,
2785,
2676,
486,
4197,
2638,
2601,
1,
4218,
23012,
9,
1966,
25,
11884,
3642,
91,
5143,
5620,
59152,
9685,
1827,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_log_connect_stats_success() {
let mut exec = fasync::TestExecutor::new().expect("Failed to create an executor");
let (mut cobalt_sender, mut cobalt_receiver) = fake_cobalt_sender();
let (mut cobalt_1dot1_proxy, mut cobalt_1dot1_stream) =
create_proxy_and_stream::<fidl_fuchsia_metrics::MetricEventLoggerMarker>()
.expect("failed to create Cobalt 1.1 proxy and stream");
let (inspect_tree, _persistence_stream) = fake_inspect_tree();
let connect_stats = fake_connect_stats();
let fut = log_connect_stats(
&mut cobalt_sender,
&mut cobalt_1dot1_proxy,
inspect_tree.clone(),
&connect_stats,
);
pin_mut!(fut);
let cobalt_1dot1_events =
drain_cobalt_events(&mut exec, &mut fut, &mut cobalt_1dot1_stream);
let mut expected_metrics = hashset! {
metrics::CONNECTION_ATTEMPTS_METRIC_ID,
metrics::CONNECTION_SUCCESS_WITH_ATTEMPTS_BREAKDOWN_METRIC_ID,
metrics::CONNECTION_RESULT_METRIC_ID,
metrics::CONNECTION_RESULT_POST_NETWORK_SELECTION_METRIC_ID,
metrics::CONNECTION_RESULT_PER_RSSI_METRIC_ID,
metrics::CONNECTION_RESULT_PER_SNR_METRIC_ID,
metrics::CONNECTION_SETUP_TIME_METRIC_ID,
metrics::CONNECTION_SETUP_TIME_PER_RESULT_METRIC_ID,
metrics::AUTHENTICATION_TIME_METRIC_ID,
metrics::AUTHENTICATION_TIME_PER_RSSI_METRIC_ID,
metrics::ASSOCIATION_TIME_METRIC_ID,
metrics::ASSOCIATION_TIME_PER_RSSI_METRIC_ID,
metrics::ESTABLISH_RSNA_TIME_METRIC_ID,
metrics::ESTABLISH_RSNA_TIME_PER_RSSI_METRIC_ID,
metrics::CONNECTION_GAP_TIME_METRIC_ID,
metrics::CONNECTION_GAP_TIME_BREAKDOWN_METRIC_ID,
};
while let Ok(Some(event)) = cobalt_receiver.try_next() {
assert!(expected_metrics.contains(&event.metric_id), "unexpected event: {:?}", event);
expected_metrics.remove(&event.metric_id);
}
assert!(expected_metrics.is_empty(), "some metrics not logged: {:?}", expected_metrics);
let expected_cobalt_1dot1_metrics = hashset! {
metrics::CONNECTION_RESULT_MIGRATED_METRIC_ID,
};
assert_eq!(
cobalt_1dot1_events.into_iter().map(|e| e.0).collect::<HashSet<_>>(),
expected_cobalt_1dot1_metrics
);
} | rust_cleaned_test_functions.jsonl/50924 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1236
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5224,
15720,
15381,
18632,
368,
341,
286,
1077,
5206,
3883,
284,
282,
7692,
486,
2271,
25255,
486,
931,
1005,
17119,
445,
9408,
311,
1855,
458,
31558,
797,
286,
1077,
320,
6984,
33828,
3145,
54356... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_add_border_constraint() {
let points = random_points_with_seed::<f64>(1000, b" ddpoo2jjb8ynbv2");
let mut cdt = CDT::new();
let mut max_y = -::std::f64::MAX;
for point in points {
max_y = max_y.max(point.y);
cdt.insert(point);
}
let v0 = cdt.insert(Point2::new(-20., max_y + 10.));
let v1 = cdt.insert(Point2::new(20., max_y + 10.));
cdt.add_constraint(v0, v1);
assert_eq!(cdt.num_constraints(), 1);
cdt.cdt_sanity_check();
} | rust_cleaned_test_functions.jsonl/70755 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 303
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
31940,
46973,
368,
341,
286,
1077,
3501,
284,
4194,
12928,
6615,
33809,
27638,
69,
21,
19,
2235,
16,
15,
15,
15,
11,
293,
1,
294,
9796,
2624,
17,
38811,
65,
23,
1872,
54929,
17,
797,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_replay_confidence_cache() {
fn leader_vote(bank: &Arc<Bank>, pubkey: &Pubkey) {
let mut leader_vote_account = bank.get_account(&pubkey).unwrap();
let mut vote_state = VoteState::from(&leader_vote_account).unwrap();
vote_state.process_slot_vote_unchecked(bank.slot());
vote_state.to(&mut leader_vote_account).unwrap();
bank.store_account(&pubkey, &leader_vote_account);
}
let fork_confidence_cache = Arc::new(RwLock::new(ForkConfidenceCache::default()));
let (lockouts_sender, _) = aggregate_stake_lockouts(
&Arc::new(AtomicBool::new(false)),
fork_confidence_cache.clone(),
);
let leader_pubkey = Pubkey::new_rand();
let leader_lamports = 3;
let genesis_block_info =
create_genesis_block_with_leader(50, &leader_pubkey, leader_lamports);
let mut genesis_block = genesis_block_info.genesis_block;
let leader_voting_pubkey = genesis_block_info.voting_keypair.pubkey();
genesis_block.epoch_warmup = false;
genesis_block.ticks_per_slot = 4;
let bank0 = Bank::new(&genesis_block);
for _ in 1..genesis_block.ticks_per_slot {
bank0.register_tick(&Hash::default());
}
bank0.freeze();
let arc_bank0 = Arc::new(bank0);
let bank_forks = Arc::new(RwLock::new(BankForks::new_from_banks(
&[arc_bank0.clone()],
vec![0],
)));
let pubkey = Pubkey::new_rand();
let mut tower = Tower::new(&pubkey, &Pubkey::new_rand(), &bank_forks.read().unwrap());
let mut progress = HashMap::new();
leader_vote(&arc_bank0, &leader_voting_pubkey);
let ancestors = Arc::new(bank_forks.read().unwrap().ancestors());
let votable =
ReplayStage::generate_votable_banks(&ancestors, &bank_forks, &tower, &mut progress);
if let Some((_, _, lockouts, total_staked)) = votable.into_iter().last() {
ReplayStage::update_confidence_cache(
&ancestors,
&tower,
lockouts,
total_staked,
&lockouts_sender,
);
}
thread::sleep(Duration::from_millis(200));
assert_eq!(
fork_confidence_cache
.read()
.unwrap()
.get_fork_confidence(0)
.unwrap(),
&Confidence::new(0, 3, 2)
);
assert!(fork_confidence_cache
.read()
.unwrap()
.get_fork_confidence(1)
.is_none());
tower.record_vote(arc_bank0.slot(), arc_bank0.hash());
let bank1 = Bank::new_from_parent(&arc_bank0, &Pubkey::default(), arc_bank0.slot() + 1);
let _res = bank1.transfer(10, &genesis_block_info.mint_keypair, &Pubkey::new_rand());
for _ in 0..genesis_block.ticks_per_slot {
bank1.register_tick(&Hash::default());
}
bank1.freeze();
bank_forks.write().unwrap().insert(bank1);
let arc_bank1 = bank_forks.read().unwrap().get(1).unwrap().clone();
leader_vote(&arc_bank1, &leader_voting_pubkey);
let ancestors = Arc::new(bank_forks.read().unwrap().ancestors());
let votable =
ReplayStage::generate_votable_banks(&ancestors, &bank_forks, &tower, &mut progress);
if let Some((_, _, lockouts, total_staked)) = votable.into_iter().last() {
ReplayStage::update_confidence_cache(
&ancestors,
&tower,
lockouts,
total_staked,
&lockouts_sender,
);
}
tower.record_vote(arc_bank1.slot(), arc_bank1.hash());
let bank2 = Bank::new_from_parent(&arc_bank1, &Pubkey::default(), arc_bank1.slot() + 1);
let _res = bank2.transfer(10, &genesis_block_info.mint_keypair, &Pubkey::new_rand());
for _ in 0..genesis_block.ticks_per_slot {
bank2.register_tick(&Hash::default());
}
bank2.freeze();
bank_forks.write().unwrap().insert(bank2);
let arc_bank2 = bank_forks.read().unwrap().get(2).unwrap().clone();
leader_vote(&arc_bank2, &leader_voting_pubkey);
let ancestors = Arc::new(bank_forks.read().unwrap().ancestors());
let votable =
ReplayStage::generate_votable_banks(&ancestors, &bank_forks, &tower, &mut progress);
if let Some((_, _, lockouts, total_staked)) = votable.into_iter().last() {
ReplayStage::update_confidence_cache(
&ancestors,
&tower,
lockouts,
total_staked,
&lockouts_sender,
);
}
thread::sleep(Duration::from_millis(200));
assert_eq!(
fork_confidence_cache
.read()
.unwrap()
.get_fork_confidence(0)
.unwrap(),
&Confidence::new_with_stake_weighted(3, 3, 14, 60)
);
assert_eq!(
fork_confidence_cache
.read()
.unwrap()
.get_fork_confidence(1)
.unwrap(),
&Confidence::new_with_stake_weighted(3, 3, 6, 18)
);
assert_eq!(
fork_confidence_cache
.read()
.unwrap()
.get_fork_confidence(2)
.unwrap(),
&Confidence::new_with_stake_weighted(0, 3, 2, 0)
);
} | rust_cleaned_test_functions.jsonl/43056 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2869
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
1363,
16059,
7087,
11529,
368,
341,
286,
5168,
7653,
54360,
1883,
1180,
25,
609,
36809,
27,
25828,
8066,
95116,
25,
609,
29162,
792,
8,
341,
310,
1077,
5206,
7653,
54360,
13500,
284,
6073,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mvcc_checker() {
let (mut default, mut lock, mut write) = (vec![], vec![], vec![]);
enum Expect {
Keep,
Remove,
};
// test check CF_LOCK.
default.extend(vec![
(b"k4", 100, Expect::Keep),
(b"k5", 100, Expect::Keep),
]);
lock.extend(vec![
(b"k1", 100, LockType::Put, false, Expect::Remove), // k1: remove orphan lock.
(b"k2", 100, LockType::Delete, false, Expect::Keep), // k2: Delete doesn't need default.
(b"k3", 100, LockType::Put, true, Expect::Keep), // k3: short value doesn't need default.
(b"k4", 100, LockType::Put, false, Expect::Keep), // k4: corresponding default exists.
(b"k5", 100, LockType::Put, false, Expect::Remove), // k5: duplicated lock and write.
]);
write.extend(vec![
(b"k5", 100, 101, WriteType::Put, false, Expect::Keep),
]);
// test match CF_DEFAULT and CF_WRITE.
default.extend(vec![
(b"k6", 96, Expect::Remove), // extra default.
(b"k6", 94, Expect::Keep), // ok.
(b"k6", 90, Expect::Remove), // Delete should not have default.
(b"k6", 88, Expect::Remove), // Default is redundant if write has short value.
]);
write.extend(vec![
(b"k6", 100, 101, WriteType::Put, true, Expect::Keep), // short value doesn't need default.
(b"k6", 99, 99, WriteType::Rollback, false, Expect::Keep), // rollback doesn't need default.
(b"k6", 97, 98, WriteType::Delete, false, Expect::Keep), // delete doesn't need default.
(b"k6", 94, 94, WriteType::Put, false, Expect::Keep), // ok.
(b"k6", 92, 93, WriteType::Put, false, Expect::Remove), // extra write.
(b"k6", 90, 91, WriteType::Delete, false, Expect::Keep),
(b"k6", 88, 89, WriteType::Put, true, Expect::Keep),
]);
// Combine problems together.
default.extend(vec![
(b"k7", 98, Expect::Remove), // default without lock or write.
(b"k7", 90, Expect::Remove), // orphan default.
]);
lock.extend(vec![
(b"k7", 100, LockType::Put, false, Expect::Remove), // duplicated lock and write.
]);
write.extend(vec![
(b"k7", 99, 100, WriteType::Put, false, Expect::Remove), // write without default.
(b"k7", 96, 97, WriteType::Put, true, Expect::Keep),
]);
// Out of range.
default.extend(vec![
(b"k8", 100, Expect::Keep),
]);
lock.extend(vec![
(b"k8", 101, LockType::Put, false, Expect::Keep),
]);
write.extend(vec![
(b"k8", 102, 103, WriteType::Put, false, Expect::Keep),
]);
let mut kv = vec![];
for (key, ts, expect) in default {
kv.push((
CF_DEFAULT,
Key::from_raw(key).append_ts(ts.into()),
b"v".to_vec(),
expect,
));
}
for (key, ts, tp, short_value, expect) in lock {
let v = if short_value {
Some(b"v".to_vec())
} else {
None
};
let lock = Lock::new(
tp,
vec![],
ts.into(),
0,
v,
TimeStamp::zero(),
0,
TimeStamp::zero(),
);
kv.push((CF_LOCK, Key::from_raw(key), lock.to_bytes(), expect));
}
for (key, start_ts, commit_ts, tp, short_value, expect) in write {
let v = if short_value {
Some(b"v".to_vec())
} else {
None
};
let write = Write::new(tp, start_ts.into(), v);
kv.push((
CF_WRITE,
Key::from_raw(key).append_ts(commit_ts.into()),
write.as_ref().to_bytes(),
expect,
));
}
let path = Builder::new()
.prefix("test_mvcc_checker")
.tempdir()
.unwrap();
let path_str = path.path().to_str().unwrap();
let cfs_opts = ALL_CFS
.iter()
.map(|cf| CFOptions::new(cf, ColumnFamilyOptions::new()))
.collect();
let db = Arc::new(new_engine_opt(path_str, DBOptions::new(), cfs_opts).unwrap());
// Write initial KVs.
let wb = WriteBatch::default();
for &(cf, ref k, ref v, _) in &kv {
wb.put_cf(
get_cf_handle(&db, cf).unwrap(),
&keys::data_key(k.as_encoded()),
v,
)
.unwrap();
}
db.write(&wb).unwrap();
// Fix problems.
let mut checker = MvccChecker::new(Arc::clone(&db), b"k", b"k8").unwrap();
let wb = WriteBatch::default();
checker.check_mvcc(&wb, None).unwrap();
db.write(&wb).unwrap();
// Check result.
for (cf, k, _, expect) in kv {
let data = db
.get_cf(
get_cf_handle(&db, cf).unwrap(),
&keys::data_key(k.as_encoded()),
)
.unwrap();
match expect {
Expect::Keep => assert!(data.is_some()),
Expect::Remove => assert!(data.is_none()),
}
}
} | rust_cleaned_test_functions.jsonl/60242 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3150
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73187,
638,
62715,
368,
341,
286,
1077,
320,
6984,
1638,
11,
5206,
5296,
11,
5206,
3270,
8,
284,
320,
4083,
0,
12995,
7486,
0,
12995,
7486,
0,
56703,
286,
7618,
32085,
341,
310,
13655,
345,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 9 |
#[test]
fn test_banking_stage_entries_only() {
analog_logger::setup();
let GenesisConfigInfo {
genesis_config,
mint_keypair,
..
} = create_slow_genesis_config(10);
let bank = Arc::new(Bank::new_no_wallclock_throttle_for_tests(&genesis_config));
let start_hash = bank.last_blockhash();
let (verified_sender, verified_receiver) = unbounded();
let (tpu_vote_sender, tpu_vote_receiver) = unbounded();
let (gossip_verified_vote_sender, gossip_verified_vote_receiver) = unbounded();
let ledger_path = get_tmp_ledger_path!();
{
let blockstore = Arc::new(
Blockstore::open(&ledger_path)
.expect("Expected to be able to open database ledger"),
);
let poh_config = PohConfig {
// limit tick count to avoid clearing working_bank at PohRecord then
target_tick_count: Some(bank.max_tick_height() - 1),
..PohConfig::default()
};
let (exit, poh_recorder, poh_service, entry_receiver) =
create_test_recorder(&bank, &blockstore, Some(poh_config));
let cluster_info = new_test_cluster_info(Node::new_localhost().info);
let cluster_info = Arc::new(cluster_info);
let (gossip_vote_sender, _gossip_vote_receiver) = unbounded();
let banking_stage = BankingStage::new(
&cluster_info,
&poh_recorder,
verified_receiver,
tpu_vote_receiver,
gossip_verified_vote_receiver,
None,
gossip_vote_sender,
Arc::new(RwLock::new(CostModel::default())),
);
// fund another account so we can send 2 good transactions in a single batch.
let keypair = Keypair::new();
let fund_tx =
system_transaction::transfer(&mint_keypair, &keypair.pubkey(), 2, start_hash);
bank.process_transaction(&fund_tx).unwrap();
// good tx
let to = analog_sdk::pubkey::new_rand();
let tx = system_transaction::transfer(&mint_keypair, &to, 1, start_hash);
let to2 = analog_sdk::pubkey::new_rand();
let tx_no_ver = system_transaction::transfer(&keypair, &to2, 2, start_hash);
let keypair = Keypair::new();
let to3 = analog_sdk::pubkey::new_rand();
let tx_anf = system_transaction::transfer(&keypair, &to3, 1, start_hash);
// send 'em over
let packets = to_packets_chunked(&[tx_no_ver, tx_anf, tx], 3);
// glad they all fit
assert_eq!(packets.len(), 1);
let packets = packets
.into_iter()
.map(|packets| (packets, vec![0u8, 1u8, 1u8]))
.collect();
let packets = convert_from_old_verified(packets);
verified_sender
.send(packets)
.unwrap();
drop(verified_sender);
drop(tpu_vote_sender);
drop(gossip_verified_vote_sender);
// wait until banking_stage to finish up all packets
banking_stage.join().unwrap();
exit.store(true, Ordering::Relaxed);
poh_service.join().unwrap();
drop(poh_recorder);
let mut blockhash = start_hash;
let bank = Arc::new(Bank::new_no_wallclock_throttle_for_tests(&genesis_config));
bank.process_transaction(&fund_tx).unwrap();
//receive entries + ticks
loop {
let entries: Vec<Entry> = entry_receiver
.iter()
.map(|(_bank, (entry, _tick_height))| entry)
.collect();
assert!(entries.verify(&blockhash));
if !entries.is_empty() {
blockhash = entries.last().unwrap().hash;
for entry in entries {
bank.process_entry_transactions(entry.transactions)
.iter()
.for_each(|x| assert_eq!(*x, Ok(())));
}
}
if bank.get_balance(&to) == 1 {
break;
}
sleep(Duration::from_millis(200));
}
assert_eq!(bank.get_balance(&to), 1);
assert_eq!(bank.get_balance(&to2), 0);
drop(entry_receiver);
}
Blockstore::destroy(&ledger_path).unwrap();
} | rust_cleaned_test_functions.jsonl/4983 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2478
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
32334,
35238,
26092,
18410,
368,
341,
286,
23400,
27413,
486,
15188,
543,
286,
1077,
40788,
2648,
1731,
341,
310,
59366,
5332,
345,
310,
28337,
3097,
12670,
345,
310,
54538,
286,
335,
284,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_9() {
let string = r#"[ab] "#;
let tokenizer = Tokenizer::new(string);
let tokens: Vec<Token> = tokenizer.iter().collect();
assert_eq!(
tokens,
vec![
Token::Quoted("[ab]".to_string()),
Token::Space(" ".to_string()),
]
);
assert_eq!(
string,
tokens.iter().map(|x| x.to_string()).collect::<String>()
);
} | rust_cleaned_test_functions.jsonl/75873 | {
"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,
62,
24,
368,
341,
286,
1077,
914,
284,
435,
2,
36864,
370,
60,
5869,
280,
286,
1077,
45958,
284,
9660,
3135,
486,
931,
3609,
317,
286,
1077,
11211,
25,
11312,
83416,
29,
284,
45958,
19471,
100... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_merge_overwriting_with_list() {
let mut upper = Env::new();
let mut lower = Env::new();
lower.insert(
"mykey".to_string(),
EnvKey::Single("lower_value".to_string()),
);
upper.insert(
"mykey".to_string(),
EnvKey::List(vector![
"upper_value_1".to_string(),
"upper_value_2".to_string(),
]),
);
let merged = merge(lower, upper);
assert_eq!(
merged.get("mykey").unwrap(),
&EnvKey::List(vector![
"upper_value_1".to_string(),
"upper_value_2".to_string(),
]),
);
} | rust_cleaned_test_functions.jsonl/131135 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 413
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20888,
15431,
25304,
6615,
2019,
368,
341,
286,
1077,
5206,
8416,
284,
37039,
486,
931,
543,
286,
1077,
5206,
4722,
284,
37039,
486,
931,
543,
286,
4722,
7030,
1006,
310,
330,
2408,
792,
3263,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_qualified_address_invalid_length_verkey() {
let vk_bytes = rand_bytes(VERKEY_LEN+1);
let address = vk_bytes.into_base58_check();
let result = validate_address(&address);
let error = result.unwrap_err();
assert_eq!(ErrorCode::CommonInvalidStructure, error);
} | rust_cleaned_test_functions.jsonl/72542 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
36335,
6744,
31433,
5118,
26042,
792,
368,
341,
286,
1077,
34283,
12524,
284,
10382,
12524,
7,
3763,
4784,
15536,
10,
16,
317,
286,
1077,
2621,
284,
34283,
12524,
39860,
7651,
20,
23,
7200,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_biguint_to_bits_le() {
let value = BigUint::from(1u8);
assert_eq!(biguint_to_bits_le(&BigUint::from(1u8), 4), vec![1, 0, 0, 0]);
assert_eq!(
biguint_to_bits_le(&BigUint::from(1u8), 8),
vec![1, 0, 0, 0, 0, 0, 0, 0]
);
assert_eq!(
biguint_to_bits_le(&BigUint::from(43690u16), 16),
vec![0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]
);
} | rust_cleaned_test_functions.jsonl/64238 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 284
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36386,
2496,
2346,
20034,
11751,
368,
341,
286,
1077,
897,
284,
6164,
21570,
486,
1499,
7,
16,
84,
23,
626,
286,
2060,
10714,
10297,
16154,
2496,
2346,
20034,
11751,
2099,
15636,
21570,
486,
1499,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_gmm_fit() {
let mut rng = Isaac64Rng::seed_from_u64(42);
let weights = array![0.5, 0.5];
let means = array![[0., 0.], [5., 5.]];
let covars = array![[[1., 0.8], [0.8, 1.]], [[1.0, -0.6], [-0.6, 1.0]]];
let mvn1 =
MultivariateNormal::new(&means.slice(s![0, ..]), &covars.slice(s![0, .., ..])).unwrap();
let mvn2 =
MultivariateNormal::new(&means.slice(s![1, ..]), &covars.slice(s![1, .., ..])).unwrap();
let n = 500;
let mut observations = Array2::zeros((2 * n, means.ncols()));
for (i, mut row) in observations.genrows_mut().into_iter().enumerate() {
let sample = if i < n {
mvn1.sample(&mut rng)
} else {
mvn2.sample(&mut rng)
};
row.assign(&sample);
}
let dataset = DatasetBase::from(observations);
let gmm = GaussianMixtureModel::params(2)
.with_rng(rng)
.fit(&dataset)
.expect("GMM fitting");
// check weights
let w = gmm.weights();
assert_abs_diff_eq!(w, &weights, epsilon = 1e-1);
let m = gmm.means();
assert!(
abs_diff_eq!(means, &m, epsilon = 1e-1)
|| abs_diff_eq!(means, m.slice(s![..;-1, ..]), epsilon = 1e-1)
);
// check covariances
let c = gmm.covariances();
assert!(
abs_diff_eq!(covars, &c, epsilon = 1e-1)
|| abs_diff_eq!(covars, c.slice(s![..;-1, .., ..]), epsilon = 1e-1)
);
} | rust_cleaned_test_functions.jsonl/10368 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 913
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1889,
3821,
32416,
368,
341,
286,
1077,
5206,
28422,
284,
41508,
21,
19,
49,
968,
486,
22602,
5673,
7300,
21,
19,
7,
19,
17,
317,
286,
1077,
14324,
284,
1334,
20703,
15,
13,
20,
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... | 5 |
#[test]
fn test_reserve_exact() {
let mut d = RingBuf::new();
d.push(0u64);
d.reserve_exact(50);
assert_eq!(d.elts.capacity(), 50);
let mut d = RingBuf::new();
d.push(0u32);
d.reserve_exact(50);
assert_eq!(d.elts.capacity(), 50);
} | rust_cleaned_test_functions.jsonl/49518 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 174
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
89591,
71084,
368,
341,
286,
1077,
5206,
294,
284,
21525,
15064,
486,
931,
543,
286,
294,
2552,
7,
15,
84,
21,
19,
317,
286,
294,
48520,
71084,
7,
20,
15,
317,
286,
2060,
10714,
10297,
67,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multi_timing_task() {
let pool = MultiTaskRuntimeBuilder::default();
let rt = pool.build();
match rt.spawn_timing(rt.alloc(), async move {
println!("!!!!!!run timing task ok, index: {}", index);
}, 5000) {
Err(e) => {
println!("!!!> spawn task failed, index: {:?}, reason: {:?}", index, e);
},
Ok(handle) => {
if index % 2 != 0 {
// rt.cancel_timing(handle);
}
}
}
thread::sleep(Duration::from_millis(6000));
//测试派发定时任务的性能
let mut handles = Vec::wit = Instant::now();
for index in 0..10000000 {
match rt.spawn_timing(rt.alloc(), async move {
println!("!!!!!!run timing task ok, index: {}", index);
}, 10000) {
Err(e) => {
println!("!!!> spawn task failed, reason: {:?}", e);
},
Ok(handle) => {
handles.push(handle);
},
}
}
println!("!!!!!!spawn multi timing task ok, time: {:?}", Instant::now() - start);
//测试取消定时任务的性能
let start = Instant::now();
for handle in handles {
// rt.cancel_timing(handle);
}
println!("!!!!!!cancel multi timing task ok, titart);
thread::sleep(Duration::from_millis(100000000));
} | rust_cleaned_test_functions.jsonl/62458 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 783
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25133,
70973,
12184,
368,
972,
262,
1077,
7314,
284,
17439,
6262,
15123,
3297,
486,
2258,
1647,
262,
1077,
16677,
284,
7314,
13239,
7317,
688,
2432,
16677,
59296,
70973,
56154,
78224,
1507,
3312,
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... | 6 |
#[test]
fn test_sanitize_with_instruction() {
assert!(Message {
header: MessageHeader {
num_required_signatures: 1,
..MessageHeader::default()
},
account_keys: vec![Pubkey::new_unique(), Pubkey::new_unique()],
instructions: vec![CompiledInstruction {
program_id_index: 1,
accounts: vec![0],
data: vec![]
}],
..Message::default()
}
.sanitize()
.is_ok());
} | rust_cleaned_test_functions.jsonl/94108 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 309
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
58652,
6615,
54923,
368,
341,
286,
2060,
10297,
2052,
341,
310,
4247,
25,
4856,
4047,
341,
394,
1629,
18743,
11172,
2789,
25,
220,
16,
345,
394,
5241,
2052,
4047,
486,
2258,
741,
310,
1153,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ignore_unknown_features() {
let output = cargo_hack()
.args(&[
"hack",
"check",
"--ignore-unknown-features",
"--no-default-features",
"--features",
"f",
])
.current_dir(test_dir("tests/fixtures/virtual"))
.output()
.unwrap();
output
.assert_success()
.assert_stderr_contains("skipped applying unknown `f` feature to member1")
.assert_stderr_contains("running `cargo check --no-default-features` on member1")
.assert_stderr_not_contains("skipped applying unknown `f` feature to member2")
.assert_stderr_contains(
"running `cargo check --no-default-features --features f` on member2",
);
} | rust_cleaned_test_functions.jsonl/25306 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 376
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58493,
57507,
14965,
368,
341,
262,
1077,
2550,
284,
25652,
1523,
473,
741,
286,
659,
2116,
2099,
9640,
310,
330,
65972,
756,
310,
330,
2028,
756,
310,
14482,
13130,
12,
16088,
12,
20304,
756,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_message_descriptor() {
assert_eq!("TestDescriptor", TestDescriptor::descriptor_static().name());
let d = reflect::MessageDescriptor::for_type::<TestDescriptor>();
assert_eq!("TestDescriptor", d.name());
assert_eq!("basic.TestDescriptor", d.full_name());
let mut t = TestDescriptor::new();
t.set_stuff(55);
let field = d.field_by_name("stuff").unwrap();
assert_eq!(
55,
field.get_singular_field_or_default(&t).to_i32().unwrap()
);
} | rust_cleaned_test_functions.jsonl/2716 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 217
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6462,
33774,
368,
341,
262,
2060,
10714,
17223,
2271,
11709,
497,
3393,
11709,
486,
53132,
25360,
1005,
606,
5231,
262,
1077,
294,
284,
8708,
486,
2052,
11709,
486,
1958,
1819,
27638,
2271,
11709,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_clobs() {
// parse tests for short clob
parse_equals("{{\"hello\"}}\n", "hello");
parse_equals("{{\"a\\\"'\\n\"}}\n", "a\"\'\n");
parse_equals("{{\"\\xe2\\x9d\\xa4\\xef\\xb8\\x8f\"}}\n", "❤️");
// parse tests for long clob
parse_equals("{{'''Hello''' '''world'''}}", "Helloworld");
parse_equals("{{'''Hello world'''}}", "Hello world");
parse_equals("{{'''\\xe2\\x9d\\xa4\\xef\\xb8\\x8f\'''}}", "❤️");
} | rust_cleaned_test_functions.jsonl/111153 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 260
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
666,
68164,
368,
341,
286,
442,
4715,
7032,
369,
2805,
272,
1684,
198,
286,
4715,
61664,
445,
2979,
2105,
14990,
2105,
3417,
59,
77,
497,
330,
14990,
797,
286,
4715,
61664,
445,
2979,
210... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_check_is_mmapped_for_unmapped_next_to_mapped() {
serial_test(|| {
with_cleanup(
|| {
// map 1 page from START
assert!(dzmmap_noreplace(START, BYTES_IN_PAGE).is_ok());
// check if the next page is mapped - which should panic
panic_if_unmapped(START + BYTES_IN_PAGE, BYTES_IN_PAGE);
},
|| {
assert!(munmap(START, BYTES_IN_PAGE * 2).is_ok());
},
)
})
} | rust_cleaned_test_functions.jsonl/107215 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 362
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
6892,
35599,
5677,
5478,
4907,
65371,
11257,
2346,
91933,
368,
341,
286,
6146,
4452,
79453,
341,
310,
448,
42444,
1006,
394,
1369,
341,
503,
442,
2415,
220,
16,
2150,
504,
20998,
198,
503,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_similarity_limit() {
let f = File::open("testdata/similarity.bin").unwrap();
let mut reader = BufReader::new(f);
let embeddings = Embeddings::read_word2vec_binary(&mut reader).unwrap();
let result = embeddings.word_similarity("Stuttgart", 10);
assert!(result.is_some());
let result = result.unwrap();
assert_eq!(10, result.len());
println!("{:?}", result);
for (idx, word_similarity) in result.iter().enumerate() {
assert_eq!(SIMILARITY_ORDER_STUTTGART_10[idx], word_similarity.word)
}
} | rust_cleaned_test_functions.jsonl/22003 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 277
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
76236,
14763,
368,
341,
286,
1077,
282,
284,
2887,
486,
2508,
445,
92425,
2687,
318,
48225,
29394,
1827,
15454,
543,
286,
1077,
5206,
6604,
284,
69013,
5062,
486,
931,
955,
317,
286,
1077,
70547,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_resource_prefix() {
let tree = Tree::new(&ResourceDef::prefix("/"), 1);
assert_eq!(tree.find(&mut Path::new("/")), Some(1));
assert_eq!(tree.find(&mut Path::new("/a")), Some(1));
assert_eq!(tree.find(&mut Path::new("/a/test/test")), Some(1));
let tree = Tree::new(&ResourceDef::prefix("/name"), 1);
assert_eq!(tree.find(&mut Path::new("/name")), Some(1));
assert_eq!(tree.find(&mut Path::new("/name/")), Some(1));
assert_eq!(tree.find(&mut Path::new("/name/test/test")), Some(1));
assert_eq!(tree.find(&mut Path::new("/name1")), None);
assert_eq!(tree.find(&mut Path::new("/name~")), None);
let mut resource = Path::new("/name/subpath1/subpath2/index.html");
assert_eq!(tree.find(&mut resource), Some(1));
assert_eq!(resource.path(), "/subpath1/subpath2/index.html");
let tree = Tree::new(&ResourceDef::prefix("/name/"), 1);
assert_eq!(tree.find(&mut Path::new("/name/")), Some(1));
assert_eq!(tree.find(&mut Path::new("/name/test/test")), Some(1));
assert_eq!(tree.find(&mut Path::new("/name")), None);
assert_eq!(tree.find(&mut Path::new("/name1")), None);
let tree = Tree::new(&ResourceDef::prefix(vec!["/name/", "/name2/"]), 1);
assert_eq!(tree.find(&mut Path::new("/name/")), Some(1));
assert_eq!(tree.find(&mut Path::new("/name/test/test")), Some(1));
assert_eq!(tree.find(&mut Path::new("/name2/")), Some(1));
assert_eq!(tree.find(&mut Path::new("/name2/test/test")), Some(1));
assert_eq!(tree.find(&mut Path::new("/name")), None);
assert_eq!(tree.find(&mut Path::new("/name1")), None);
let tree = Tree::new(&ResourceDef::root_prefix("name/"), 1);
assert_eq!(tree.find(&mut Path::new("/name/")), Some(1));
assert_eq!(tree.find(&mut Path::new("/name/test/test")), Some(1));
assert_eq!(tree.find(&mut Path::new("/name")), None);
assert_eq!(tree.find(&mut Path::new("/name1")), None);
let tree = Tree::new(&ResourceDef::root_prefix(vec!["name/", "name2/"]), 1);
assert_eq!(tree.find(&mut Path::new("/name/")), Some(1));
assert_eq!(tree.find(&mut Path::new("/name/test/test")), Some(1));
assert_eq!(tree.find(&mut Path::new("/name2/")), Some(1));
assert_eq!(tree.find(&mut Path::new("/name2/test/test")), Some(1));
assert_eq!(tree.find(&mut Path::new("/name")), None);
assert_eq!(tree.find(&mut Path::new("/name1")), None);
let mut resource = Path::new("/name/subpath1/subpath2/index.html");
assert_eq!(tree.find(&mut resource), Some(1));
assert_eq!(resource.path(), "/subpath1/subpath2/index.html");
} | rust_cleaned_test_functions.jsonl/2254 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1235
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17962,
13974,
368,
341,
286,
1077,
4916,
284,
8942,
486,
931,
2099,
4783,
2620,
486,
11849,
4283,
3975,
220,
16,
317,
286,
2060,
10714,
10297,
9344,
2658,
2099,
6984,
7933,
486,
931,
4283,
35674,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_shortcut_functions() {
let mut context = HashMapContext::new();
context
.set_value("string".into(), Value::from("a string"))
.unwrap();
assert_eq!(
eval_string_with_context("string", &context),
Ok("a string".to_string())
);
assert_eq!(eval_float("3.3"), Ok(3.3));
assert_eq!(eval_float_with_context("3.3", &context), Ok(3.3));
assert_eq!(eval_int("3"), Ok(3));
assert_eq!(eval_int_with_context("3", &context), Ok(3));
assert_eq!(eval_number("3"), Ok(3.0));
assert_eq!(eval_number_with_context("3", &context), Ok(3.0));
assert_eq!(eval_boolean("true"), Ok(true));
assert_eq!(eval_boolean_with_context("true", &context), Ok(true));
assert_eq!(eval_tuple("3,3"), Ok(vec![Value::Int(3), Value::Int(3)]));
assert_eq!(
eval_tuple_with_context("3,3", &context),
Ok(vec![Value::Int(3), Value::Int(3)])
);
assert_eq!(eval_empty(""), Ok(EMPTY_VALUE));
assert_eq!(eval_empty_with_context("", &context), Ok(EMPTY_VALUE));
assert_eq!(
build_operator_tree("string")
.unwrap()
.eval_string_with_context(&context),
Ok("a string".to_string())
);
assert_eq!(build_operator_tree("3.3").unwrap().eval_float(), Ok(3.3));
assert_eq!(
build_operator_tree("3.3")
.unwrap()
.eval_float_with_context(&context),
Ok(3.3)
);
assert_eq!(build_operator_tree("3").unwrap().eval_int(), Ok(3));
assert_eq!(
build_operator_tree("3")
.unwrap()
.eval_int_with_context(&context),
Ok(3)
);
assert_eq!(build_operator_tree("3").unwrap().eval_number(), Ok(3.0));
assert_eq!(
build_operator_tree("3")
.unwrap()
.eval_number_with_context(&context),
Ok(3.0)
);
assert_eq!(
build_operator_tree("true").unwrap().eval_boolean(),
Ok(true)
);
assert_eq!(
build_operator_tree("true")
.unwrap()
.eval_boolean_with_context(&context),
Ok(true)
);
assert_eq!(
build_operator_tree("3,3").unwrap().eval_tuple(),
Ok(vec![Value::Int(3), Value::Int(3)])
);
assert_eq!(
build_operator_tree("3,3")
.unwrap()
.eval_tuple_with_context(&context),
Ok(vec![Value::Int(3), Value::Int(3)])
);
assert_eq!(
build_operator_tree("")
.unwrap()
.eval_empty_with_context(&context),
Ok(EMPTY_VALUE)
);
assert_eq!(
eval_string_with_context_mut("string", &mut context),
Ok("a string".to_string())
);
assert_eq!(eval_float_with_context_mut("3.3", &mut context), Ok(3.3));
assert_eq!(eval_int_with_context_mut("3", &mut context), Ok(3));
assert_eq!(eval_number_with_context_mut("3", &mut context), Ok(3.0));
assert_eq!(
eval_boolean_with_context_mut("true", &mut context),
Ok(true)
);
assert_eq!(
eval_tuple_with_context_mut("3,3", &mut context),
Ok(vec![Value::Int(3), Value::Int(3)])
);
assert_eq!(
eval_empty_with_context_mut("", &mut context),
Ok(EMPTY_VALUE)
);
assert_eq!(
build_operator_tree("string")
.unwrap()
.eval_string_with_context_mut(&mut context),
Ok("a string".to_string())
);
;
assert_eq!(
build_operator_tree("3.3")
.unwrap()
.eval_float_with_context_mut(&mut context),
Ok(3.3)
);
assert_eq!(
build_operator_tree("3")
.unwrap()
.eval_int_with_context_mut(&mut context),
Ok(3)
);
assert_eq!(
build_operator_tree("3")
.unwrap()
.eval_number_with_context_mut(&mut context),
Ok(3.0)
);
assert_eq!(
build_operator_tree("true")
.unwrap()
.eval_boolean_with_context_mut(&mut context),
Ok(true)
);
assert_eq!(
build_operator_tree("3,3")
.unwrap()
.eval_tuple_with_context_mut(&mut context),
Ok(vec![Value::Int(3), Value::Int(3)])
);
assert_eq!(
build_operator_tree("")
.unwrap()
.eval_empty_with_context_mut(&mut context),
Ok(EMPTY_VALUE)
);
} | rust_cleaned_test_functions.jsonl/105351 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2230
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16673,
10242,
31708,
368,
341,
262,
1077,
5206,
2266,
284,
10528,
1972,
486,
931,
543,
262,
2266,
198,
286,
659,
746,
3142,
445,
917,
3263,
18122,
1507,
5162,
486,
1499,
445,
64,
914,
5455,
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_is_same_subnet() {
// valid test
vec![
("202.194.128.9", "202.194.128.14", "255.255.255.0"),
("220.230.1.1", "220.255.230.1", "255.192.0.0"),
("100.0.0.1", "100.0.0.100", "255.255.255.128"),
("100.200.2.100", "100.200.14.230", "255.255.240.0"),
("10.50.100.100", "10.50.200.70", "255.255.0.0"),
]
.into_iter()
.map(|(a, b, c)| (a.parse().unwrap(), b.parse().unwrap(), c.parse().unwrap()))
.for_each(|(a, b, c)| assert!(in_same_subnet(a, b, c)));
// invalid test
vec![
("202.194.128.9", "202.193.128.14", "255.255.255.0"),
("220.230.1.1", "220.0.230.1", "255.192.0.0"),
("100.0.0.1", "100.200.0.100", "255.255.255.128"),
("100.200.2.100", "100.100.14.230", "255.255.240.0"),
("10.50.100.100", "10.0.0.70", "255.255.0.0"),
]
.into_iter()
.map(|(a, b, c)| (a.parse().unwrap(), b.parse().unwrap(), c.parse().unwrap()))
.for_each(|(a, b, c)| assert!(!in_same_subnet(a, b, c)));
} | rust_cleaned_test_functions.jsonl/104541 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 666
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
33574,
95681,
368,
341,
286,
442,
2697,
1273,
198,
286,
7486,
90515,
310,
3489,
17,
15,
17,
13,
16,
24,
19,
13,
16,
17,
23,
13,
24,
497,
330,
17,
15,
17,
13,
16,
24,
19,
13,
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_read_until() {
let inner = MemReader::new(vec!(0, 1, 2, 1, 0));
let mut reader = BufferedReader::with_capacity(2, inner);
assert_eq!(reader.read_until(0), Ok(vec!(0)));
assert_eq!(reader.read_until(2), Ok(vec!(1, 2)));
assert_eq!(reader.read_until(1), Ok(vec!(1)));
assert_eq!(reader.read_until(8), Ok(vec!(0)));
assert!(reader.read_until(9).is_err());
} | rust_cleaned_test_functions.jsonl/52989 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 218
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
44352,
368,
341,
286,
1077,
9179,
284,
13550,
5062,
486,
931,
25592,
10297,
15,
11,
220,
16,
11,
220,
17,
11,
220,
16,
11,
220,
15,
1106,
286,
1077,
5206,
6604,
284,
25568,
486,
4197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_chunk_out_of_range() {
let index: u64 = 4;
let chunk: u64 = 10;
let max: u64 = 25;
// test
let result = get_chunk(index, chunk, max);
assert_eq!(result.is_none(), true);
} | rust_cleaned_test_functions.jsonl/95325 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 132
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
30539,
6068,
3575,
9698,
368,
341,
286,
1077,
1922,
25,
575,
21,
19,
284,
220,
19,
280,
286,
1077,
11879,
25,
575,
21,
19,
284,
220,
16,
15,
280,
286,
1077,
1932,
25,
575,
21,
19,
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_block_hash() {
let runner = test_utils::AuroraRunner::default();
let chain_id = {
let number = crate::prelude::U256::from(runner.chain_id);
crate::types::u256_to_arr(&number)
};
let account_id = runner.aurora_account_id;
let block_hash = crate::engine::Engine::compute_block_hash(chain_id, 10, account_id.as_bytes());
assert_eq!(
hex::encode(block_hash.0).as_str(),
"c4a46f076b64877cbd8c5dbfd7bfbbea21a5653b79e3b6d06b6dfb5c88f1c384",
);
} | rust_cleaned_test_functions.jsonl/131050 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 249
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7113,
8950,
368,
341,
262,
1077,
22259,
284,
1273,
17309,
486,
32,
324,
6215,
19486,
486,
2258,
543,
262,
1077,
8781,
842,
284,
341,
286,
1077,
1372,
284,
17717,
486,
1726,
52538,
486,
52,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_push_vote() {
let tree = HashMap::new();
let bmap = HashMap::new();
let b0 = Fork { id: 0, base: 0 };
let mut tower = Tower::new(32, 7, 0);
let vote = Vote::new(b0.clone(), 0);
assert!(tower.push_vote(vote, &tree, &bmap));
assert_eq!(tower.votes.len(), 1);
let vote = Vote::new(b0.clone(), 1);
assert!(tower.push_vote(vote, &tree, &bmap));
assert_eq!(tower.votes.len(), 2);
let vote = Vote::new(b0.clone(), 2);
assert!(tower.push_vote(vote, &tree, &bmap));
assert_eq!(tower.votes.len(), 3);
let vote = Vote::new(b0.clone(), 3);
assert!(tower.push_vote(vote, &tree, &bmap));
assert_eq!(tower.votes.len(), 4);
assert_eq!(tower.votes[0].lockout, 2);
assert_eq!(tower.votes[1].lockout, 4);
assert_eq!(tower.votes[2].lockout, 8);
assert_eq!(tower.votes[3].lockout, 16);
assert_eq!(tower.votes[1].lock_height(), 6);
assert_eq!(tower.votes[2].lock_height(), 9);
let vote = Vote::new(b0.clone(), 7);
assert!(tower.push_vote(vote, &tree, &bmap));
assert_eq!(tower.votes[0].lockout, 2);
let b1 = Fork { id: 1, base: 1 };
let vote = Vote::new(b1, 8);
assert!(!tower.push_vote(vote, &tree, &bmap));
let vote = Vote::new(b0.clone(), 8);
assert!(tower.push_vote(vote, &tree, &bmap));
assert_eq!(tower.votes.len(), 4);
assert_eq!(tower.votes[0].lockout, 2);
assert_eq!(tower.votes[1].lockout, 4);
assert_eq!(tower.votes[2].lockout, 8);
assert_eq!(tower.votes[3].lockout, 16);
let vote = Vote::new(b0, 10);
assert!(tower.push_vote(vote, &tree, &bmap));
assert_eq!(tower.votes.len(), 2);
assert_eq!(tower.votes[0].lockout, 2);
assert_eq!(tower.votes[1].lockout, 16);
} | rust_cleaned_test_functions.jsonl/80075 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 781
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14218,
54360,
368,
341,
262,
1077,
4916,
284,
10528,
486,
931,
543,
262,
1077,
293,
2186,
284,
10528,
486,
931,
543,
262,
1077,
293,
15,
284,
47850,
314,
877,
25,
220,
15,
11,
2331,
25,
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_add_selection_above() {
let mut editor = Editor::new(Rc::new(RefCell::new(Buffer::new(1))));
editor.buffer.borrow_mut().splice(0..0, "\
abcdefghijk\n\
lmnop\n\
\n\
\n\
qrstuvwxyz\n\
");
// Multi-line selections
editor.move_down();
editor.move_right();
editor.move_right();
editor.select_down();
editor.select_down();
editor.select_down();
editor.select_right();
editor.select_right();
editor.add_selection_above();
assert_eq!(render_selections(&editor), vec![selection((1, 2), (4, 4))]);
// Single-line selections
editor.move_up();
editor.move_left();
editor.move_left();
editor.add_selection(Point::new(2, 0), Point::new(2, 0));
editor.add_selection(Point::new(4, 1), Point::new(4, 3));
editor.add_selection(Point::new(4, 6), Point::new(4, 6));
editor.add_selection(Point::new(4, 7), Point::new(4, 9));
editor.add_selection_above();
assert_eq!(
render_selections(&editor),
vec![
selection((0, 0), (0, 0)),
selection((0, 7), (0, 9)),
selection((1, 0), (1, 0)),
selection((1, 1), (1, 3)),
selection((1, 5), (1, 5)),
selection((2, 0), (2, 0)),
selection((4, 1), (4, 3)),
selection((4, 6), (4, 6)),
selection((4, 7), (4, 9))
]
);
editor.add_selection_above();
assert_eq!(
render_selections(&editor),
vec![
selection((0, 0), (0, 0)),
selection((0, 1), (0, 3)),
selection((0, 6), (0, 6)),
selection((0, 7), (0, 9)),
selection((1, 0), (1, 0)),
selection((1, 1), (1, 3)),
selection((1, 5), (1, 5)),
selection((2, 0), (2, 0)),
selection((4, 1), (4, 3)),
selection((4, 6), (4, 6)),
selection((4, 7), (4, 9))
]
);
} | rust_cleaned_test_functions.jsonl/123914 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1245
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
23672,
77315,
368,
341,
286,
1077,
5206,
6440,
284,
12580,
486,
931,
2785,
66,
486,
931,
7,
3945,
3599,
486,
931,
55574,
486,
931,
7,
16,
38776,
286,
6440,
24465,
83640,
29523,
1005,
94960... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_2() {
let password = "Correct Horse Battery Staple";
let opslimit = OpsLimit(1);
let memlimit = MemLimit(5000000);
let result = pwhash(password.as_bytes(), opslimit, memlimit);
assert!(result.is_ok(), "failed to verify password with hash");
} | rust_cleaned_test_functions.jsonl/134479 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 129
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
62,
17,
368,
341,
286,
1077,
3552,
284,
330,
33092,
33292,
33612,
62506,
273,
876,
286,
1077,
1179,
3226,
2353,
284,
55158,
16527,
7,
16,
317,
286,
1077,
1833,
9506,
284,
13550,
16527,
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_primitive_array_alignment() {
let ptr = memory::allocate_aligned(8).unwrap();
let buf = Buffer::from_raw_parts(ptr, 8);
let buf2 = buf.slice(1);
let array_data = ArrayData::builder(DataType::Int32).add_buffer(buf2).build();
Int32Array::from(array_data);
} | rust_cleaned_test_functions.jsonl/19361 | {
"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,
84087,
3858,
51006,
368,
341,
286,
1077,
10087,
284,
4938,
486,
31191,
66385,
7,
23,
568,
15454,
543,
286,
1077,
6607,
284,
10312,
486,
1499,
16067,
33217,
23866,
11,
220,
23,
317,
286,
1077,
66... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_atomic_lsn() {
let lsn = AtomicLsn::new(0);
assert_eq!(lsn.fetch_add(1234), Lsn(0));
assert_eq!(lsn.load(), Lsn(1234));
lsn.store(Lsn(5678));
assert_eq!(lsn.load(), Lsn(5678));
assert_eq!(lsn.fetch_max(Lsn(6000)), Lsn(5678));
assert_eq!(lsn.fetch_max(Lsn(5000)), Lsn(6000));
} | rust_cleaned_test_functions.jsonl/75381 | {
"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,
51367,
907,
9613,
368,
341,
286,
1077,
326,
9613,
284,
30316,
43,
9613,
486,
931,
7,
15,
317,
286,
2060,
10714,
10297,
4730,
77,
16121,
2891,
7,
16,
17,
18,
19,
701,
444,
9613,
7,
15,
1106,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_use_loc() {
check_location(r"use f$0", ImmediateLocation::Use);
check_location(r"use f$0;", ImmediateLocation::Use);
check_location(r"use f::{f$0}", ImmediateLocation::UseTree);
check_location(r"use {f$0}", ImmediateLocation::UseTree);
} | rust_cleaned_test_functions.jsonl/55224 | {
"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,
15951,
13400,
368,
341,
286,
1779,
13126,
2601,
25372,
282,
3,
15,
497,
80310,
4707,
486,
10253,
317,
286,
1779,
13126,
2601,
25372,
282,
3,
15,
32503,
80310,
4707,
486,
10253,
317,
286,
1779,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tiledinputpart_level_rounding_mode_success() {
let input = MultiPartInputFile::new(&*SRC_IMAGE_PATH, 0, true).unwrap();
let tiled_input_part = super::TiledInputPart::new(&input, 0);
let level_rounding_mode = tiled_input_part.level_rounding_mode();
assert_eq!(level_rounding_mode, LevelRoundingMode::RoundDown);
} | rust_cleaned_test_functions.jsonl/59295 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 155
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
2181,
1355,
4480,
8274,
29896,
287,
7302,
18632,
368,
341,
286,
1077,
1946,
284,
17439,
5800,
2505,
1703,
486,
931,
2099,
9,
56017,
19121,
7944,
11,
220,
15,
11,
830,
568,
15454,
543,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_filter_vouched() {
let uuid = Uuid::parse_str(UUID).unwrap_or_default();
let profile = some_profile();
let vouched = UsersVouched::from(&profile);
assert_eq!(vouched.user_uuid, uuid);
assert_eq!(vouched.first_name, None);
assert_eq!(vouched.last_name, None);
assert_eq!(vouched.username, USERNAME);
assert_eq!(vouched.email, Some(EMAIL.to_owned()));
} | rust_cleaned_test_functions.jsonl/62146 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 207
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8727,
2273,
33070,
368,
341,
286,
1077,
16040,
284,
547,
2423,
486,
6400,
2895,
65664,
568,
15454,
8734,
9993,
543,
286,
1077,
5526,
284,
1045,
13789,
543,
286,
1077,
348,
33070,
284,
14627,
53,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_zst() {
let mut m = BTreeMap::new();
assert_eq!(m.len(), 0);
assert_eq!(m.insert((), ()), None);
assert_eq!(m.len(), 1);
assert_eq!(m.insert((), ()), Some(()));
assert_eq!(m.len(), 1);
assert_eq!(m.iter().count(), 1);
m.clear();
assert_eq!(m.len(), 0);
for _ in 0..100 {
m.insert((), ());
}
assert_eq!(m.len(), 1);
assert_eq!(m.iter().count(), 1);
} | rust_cleaned_test_functions.jsonl/49397 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 219
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6415,
267,
368,
341,
262,
1077,
5206,
296,
284,
425,
6533,
2227,
486,
931,
543,
262,
2060,
10714,
10297,
76,
19406,
1507,
220,
15,
626,
262,
2060,
10714,
10297,
76,
7030,
7,
1507,
320,
5731,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_parse_command() {
let test_commands = get_clap_app("test", "desc", "version");
let default_keypair = Keypair::new();
let (default_keypair_file, mut tmp_file) = make_tmp_file();
write_keypair(&default_keypair, tmp_file.as_file_mut()).unwrap();
let default_signer = DefaultSigner::new("", &default_keypair_file);
let test_cluster_version = test_commands
.clone()
.get_matches_from(vec!["test", "cluster-date"]);
assert_eq!(
parse_command(&test_cluster_version, &default_signer, &mut None).unwrap(),
CliCommandInfo {
command: CliCommand::ClusterDate,
signers: vec![],
}
);
let test_cluster_version = test_commands
.clone()
.get_matches_from(vec!["test", "cluster-version"]);
assert_eq!(
parse_command(&test_cluster_version, &default_signer, &mut None).unwrap(),
CliCommandInfo {
command: CliCommand::ClusterVersion,
signers: vec![],
}
);
let test_fees = test_commands.clone().get_matches_from(vec!["test", "fees"]);
assert_eq!(
parse_command(&test_fees, &default_signer, &mut None).unwrap(),
CliCommandInfo {
command: CliCommand::Fees { blockhash: None },
signers: vec![],
}
);
let blockhash = Hash::new_unique();
let test_fees = test_commands.clone().get_matches_from(vec![
"test",
"fees",
"--blockhash",
&blockhash.to_string(),
]);
assert_eq!(
parse_command(&test_fees, &default_signer, &mut None).unwrap(),
CliCommandInfo {
command: CliCommand::Fees {
blockhash: Some(blockhash)
},
signers: vec![],
}
);
let slot = 100;
let test_get_block_time =
test_commands
.clone()
.get_matches_from(vec!["test", "block-time", &slot.to_string()]);
assert_eq!(
parse_command(&test_get_block_time, &default_signer, &mut None).unwrap(),
CliCommandInfo {
command: CliCommand::GetBlockTime { slot: Some(slot) },
signers: vec![],
}
);
let test_get_epoch = test_commands
.clone()
.get_matches_from(vec!["test", "epoch"]);
assert_eq!(
parse_command(&test_get_epoch, &default_signer, &mut None).unwrap(),
CliCommandInfo {
command: CliCommand::GetEpoch,
signers: vec![],
}
);
let test_get_epoch_info = test_commands
.clone()
.get_matches_from(vec!["test", "epoch-info"]);
assert_eq!(
parse_command(&test_get_epoch_info, &default_signer, &mut None).unwrap(),
CliCommandInfo {
command: CliCommand::GetEpochInfo,
signers: vec![],
}
);
let test_get_genesis_hash = test_commands
.clone()
.get_matches_from(vec!["test", "genesis-hash"]);
assert_eq!(
parse_command(&test_get_genesis_hash, &default_signer, &mut None).unwrap(),
CliCommandInfo {
command: CliCommand::GetGenesisHash,
signers: vec![],
}
);
let test_get_slot = test_commands.clone().get_matches_from(vec!["test", "slot"]);
assert_eq!(
parse_command(&test_get_slot, &default_signer, &mut None).unwrap(),
CliCommandInfo {
command: CliCommand::GetSlot,
signers: vec![],
}
);
let test_total_supply = test_commands
.clone()
.get_matches_from(vec!["test", "total-supply"]);
assert_eq!(
parse_command(&test_total_supply, &default_signer, &mut None).unwrap(),
CliCommandInfo {
command: CliCommand::TotalSupply,
signers: vec![],
}
);
let test_transaction_count = test_commands
.clone()
.get_matches_from(vec!["test", "transaction-count"]);
assert_eq!(
parse_command(&test_transaction_count, &default_signer, &mut None).unwrap(),
CliCommandInfo {
command: CliCommand::GetTransactionCount,
signers: vec![],
}
);
let test_ping = test_commands.clone().get_matches_from(vec![
"test",
"ping",
"-i",
"1",
"-c",
"2",
"-t",
"3",
"-D",
"--blockhash",
"4CCNp28j6AhGq7PkjPDP4wbQWBS8LLbQin2xV5n8frKX",
]);
assert_eq!(
parse_command(&test_ping, &default_signer, &mut None).unwrap(),
CliCommandInfo {
command: CliCommand::Ping {
lamports: 1,
interval: Duration::from_secs(1),
count: Some(2),
timeout: Duration::from_secs(3),
blockhash: Some(
Hash::from_str("4CCNp28j6AhGq7PkjPDP4wbQWBS8LLbQin2xV5n8frKX").unwrap()
),
print_timestamp: true,
},
signers: vec![default_keypair.into()],
}
);
} | rust_cleaned_test_functions.jsonl/870 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
10811,
368,
341,
286,
1077,
1273,
44151,
284,
633,
6794,
391,
8191,
445,
1944,
497,
330,
8614,
497,
330,
4366,
797,
286,
1077,
1638,
3097,
12670,
284,
6569,
1082,
1310,
486,
931,
543,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_convert_i64() {
fn check(b1: BigUint, i: i64) {
let b2: BigUint = FromPrimitive::from_i64(i).unwrap();
assert!(b1 == b2);
assert!(b1.to_i64().unwrap() == i);
}
check(Zero::zero(), 0);
check(One::one(), 1);
check(i64::MAX.to_biguint().unwrap(), i64::MAX);
check(BigUint::new(vec!( )), 0);
check(BigUint::new(vec!( 1 )), (1 << (0*BigDigit::bits)));
check(BigUint::new(vec!(-1 )), (1 << (1*BigDigit::bits)) - 1);
check(BigUint::new(vec!( 0, 1 )), (1 << (1*BigDigit::bits)));
check(BigUint::new(vec!(-1, -1 >> 1)), i64::MAX);
assert_eq!(i64::MIN.to_biguint(), None);
assert_eq!(BigUint::new(vec!(-1, -1 )).to_i64(), None);
assert_eq!(BigUint::new(vec!( 0, 0, 1)).to_i64(), None);
assert_eq!(BigUint::new(vec!(-1, -1, -1)).to_i64(), None);
} | rust_cleaned_test_functions.jsonl/96895 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 534
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
5318,
21,
19,
368,
341,
286,
5168,
1779,
1883,
16,
25,
6164,
21570,
11,
600,
25,
600,
21,
19,
8,
341,
310,
1077,
293,
17,
25,
6164,
21570,
284,
5542,
33313,
486,
1499,
5318,
21,
19,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_basic_kg() {
let base_kg = BaseUnit::new("kilogram".into());
let mut hashmap = HashMap::new();
hashmap.insert(base_kg, 1.into());
let kg = NamedUnit::new("k".into(), "g".into(), "g".into(), hashmap, 1);
let one_kg = Value::new(1, vec![UnitExponent::new(kg.clone(), 1)]);
let two_kg = Value::new(2, vec![UnitExponent::new(kg, 1)]);
let sum = one_kg.add(two_kg, &Never::default()).unwrap();
assert_eq!(to_string(&sum), "3 kg");
} | rust_cleaned_test_functions.jsonl/73911 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 242
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
4698,
70,
368,
341,
286,
1077,
2331,
4698,
70,
284,
5351,
4562,
486,
931,
445,
85526,
12958,
3263,
18122,
1423,
286,
1077,
5206,
92148,
284,
10528,
486,
931,
543,
286,
92148,
7030,
12663,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_syn_state_hwy() {
let context = Context::new(
String::from("us"),
Some(String::from("PA")),
Tokens::new(HashMap::new(), HashMap::new(), HashMap::new()),
);
assert_eq!(
syn_state_hwy(&Name::new(String::from(""), 0, None, &context), &context),
vec![]
);
// original name priority == 0
let results = vec![
Name::new(
String::from("Pennsylvania Highway 123"),
1,
Some(Source::Generated),
&context,
),
Name::new(
String::from("PA 123 Highway"),
-2,
Some(Source::Generated),
&context,
),
Name::new(
String::from("PA 123"),
-1,
Some(Source::Generated),
&context,
),
Name::new(
String::from("Highway 123"),
-2,
Some(Source::Generated),
&context,
),
Name::new(
String::from("SR 123"),
-1,
Some(Source::Generated),
&context,
),
Name::new(
String::from("State Highway 123"),
-1,
Some(Source::Generated),
&context,
),
Name::new(
String::from("State Route 123"),
-1,
Some(Source::Generated),
&context,
),
];
assert_eq!(
syn_state_hwy(
&Name::new(String::from("St Hwy 123"), 0, None, &context),
&context
),
results
);
assert_eq!(
syn_state_hwy(
&Name::new(String::from("St Rte 123"), 0, None, &context),
&context
),
results
);
assert_eq!(
syn_state_hwy(
&Name::new(String::from("State Highway 123"), 0, None, &context),
&context
),
results
);
assert_eq!(
syn_state_hwy(
&Name::new(String::from("Highway 123"), 0, None, &context),
&context
),
results
);
assert_eq!(
syn_state_hwy(
&Name::new(String::from("Hwy 123"), 0, None, &context),
&context
),
results
);
assert_eq!(
syn_state_hwy(
&Name::new(String::from("Pennsylvania Highway 123"), 0, None, &context),
&context
),
results
);
assert_eq!(
syn_state_hwy(
&Name::new(String::from("Pennsylvania Route 123"), 0, None, &context),
&context
),
results
);
assert_eq!(
syn_state_hwy(
&Name::new(String::from("PA 123"), 0, None, &context),
&context
),
results
);
assert_eq!(
syn_state_hwy(
&Name::new(String::from("PA-123"), 0, None, &context),
&context
),
results
);
assert_eq!(
syn_state_hwy(
&Name::new(String::from("US-PA-123"), 0, None, &context),
&context
),
results
);
// original name priority < 0
let results = vec![
Name::new(
String::from("Pennsylvania Highway 123"),
-1,
Some(Source::Generated),
&context,
),
Name::new(
String::from("PA 123 Highway"),
-3,
Some(Source::Generated),
&context,
),
Name::new(
String::from("PA 123"),
-2,
Some(Source::Generated),
&context,
),
Name::new(
String::from("Highway 123"),
-3,
Some(Source::Generated),
&context,
),
Name::new(
String::from("SR 123"),
-2,
Some(Source::Generated),
&context,
),
Name::new(
String::from("State Highway 123"),
-2,
Some(Source::Generated),
&context,
),
Name::new(
String::from("State Route 123"),
-2,
Some(Source::Generated),
&context,
),
];
assert_eq!(
syn_state_hwy(
&Name::new(String::from("Pennsylvania Highway 123"), -1, None, &context),
&context
),
results
);
// original name priority > 0
let results = vec![
Name::new(
String::from("Pennsylvania Highway 123"),
2,
Some(Source::Generated),
&context,
),
Name::new(
String::from("PA 123 Highway"),
-2,
Some(Source::Generated),
&context,
),
Name::new(
String::from("PA 123"),
-1,
Some(Source::Generated),
&context,
),
Name::new(
String::from("Highway 123"),
-2,
Some(Source::Generated),
&context,
),
Name::new(
String::from("SR 123"),
-1,
Some(Source::Generated),
&context,
),
Name::new(
String::from("State Highway 123"),
-1,
Some(Source::Generated),
&context,
),
Name::new(
String::from("State Route 123"),
-1,
Some(Source::Generated),
&context,
),
];
assert_eq!(
syn_state_hwy(
&Name::new(String::from("Pennsylvania Highway 123"), 1, None, &context),
&context
),
results
);
} | rust_cleaned_test_functions.jsonl/25031 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 4157
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51393,
4387,
1523,
22545,
368,
341,
286,
1077,
2266,
284,
9608,
486,
931,
1006,
310,
923,
486,
1499,
445,
355,
4461,
310,
4329,
2242,
486,
1499,
445,
8041,
30154,
310,
58166,
486,
931,
7,
18497,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eval_binary_function_vector_vector() {
#[derive(Debug, Clone, Copy, RpnFunction)]
#[rpn_function(args = 2)]
struct FnFoo;
impl FnFoo {
fn call(
_ctx: &mut EvalContext,
_payload: RpnFnCallPayload<'_>,
v1: &Option<f64>,
v2: &Option<i64>,
) -> Result<Option<i64>> {
Ok(Some(
(v1.unwrap() * 2.5 - (v2.unwrap() as f64) * 3.5) as i64,
))
}
}
let mut columns = LazyBatchColumnVec::from(vec![
{
let mut col = LazyBatchColumn::decoded_with_capacity_and_tp(3, EvalType::Int);
col.mut_decoded().push_int(Some(1));
col.mut_decoded().push_int(Some(5));
col.mut_decoded().push_int(Some(-4));
col
},
{
let mut col = LazyBatchColumn::decoded_with_capacity_and_tp(3, EvalType::Real);
col.mut_decoded().push_real(Some(0.5));
col.mut_decoded().push_real(Some(-0.1));
col.mut_decoded().push_real(Some(3.5));
col
},
]);
let schema = &[FieldTypeTp::LongLong.into(), FieldTypeTp::Double.into()];
let exp = RpnExpressionBuilder::new()
.push_column_ref(1)
.push_column_ref(0)
.push_fn_call(FnFoo, FieldTypeTp::LongLong)
.build();
let mut ctx = EvalContext::default();
let result = exp.eval(&mut ctx, 3, schema, &mut columns);
let val = result.unwrap();
assert!(val.is_vector());
assert_eq!(
val.vector_value().unwrap().as_int_slice(),
[Some(-2), Some(-17), Some(22)]
);
assert_eq!(val.field_type().tp(), FieldTypeTp::LongLong);
} | rust_cleaned_test_functions.jsonl/111588 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1091
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21296,
31761,
9174,
12247,
12247,
368,
341,
394,
11506,
27098,
42618,
11,
27913,
11,
14540,
11,
431,
19958,
5152,
5563,
286,
11506,
81,
19958,
9174,
7356,
284,
220,
17,
5563,
286,
2036,
50182,
409... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_new_from_file_crafted_data_len() {
let file = get_append_vec_path("test_new_from_file_crafted_data_len");
let path = &file.path;
let mut av = AppendVec::new(path, true, 1024 * 1024);
av.set_no_remove_on_drop();
let crafted_data_len = 1;
av.append_account_test(&create_test_account(10)).unwrap();
let accounts = av.accounts(0);
let account = accounts.first().unwrap();
account.set_data_len_unsafe(crafted_data_len);
assert_eq!(account.meta.data_len, crafted_data_len);
// Reload accounts and observe crafted_data_len
let accounts = av.accounts(0);
let account = accounts.first().unwrap();
assert_eq!(account.meta.data_len, crafted_data_len);
av.flush().unwrap();
let accounts_len = av.len();
drop(av);
let result = AppendVec::new_from_file(path, accounts_len);
assert_matches!(result, Err(ref message) if message.to_string() == *"incorrect layout/length/data");
} | rust_cleaned_test_functions.jsonl/5421 | {
"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,
5921,
5673,
2458,
666,
60769,
1769,
6043,
368,
341,
286,
1077,
1034,
284,
633,
26041,
13251,
2638,
445,
1944,
5921,
5673,
2458,
666,
60769,
1769,
6043,
797,
286,
1077,
1815,
284,
609,
1192,
3875,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bit_xor() {
let mut ctx = EvalContext::default();
let function = AggrFnBitOp::<BitXor>(std::marker::PhantomData);
let mut state = function.create_state();
let mut result = [VectorValue::with_capacity(0, EvalType::Int)];
state.push_result(&mut ctx, &mut result).unwrap();
assert_eq!(result[0].as_int_slice(), &[Some(0)]);
state.update(&mut ctx, &Option::<Int>::None).unwrap();
result[0].clear();
state.push_result(&mut ctx, &mut result).unwrap();
assert_eq!(result[0].as_int_slice(), &[Some(0)]);
state.update(&mut ctx, &Some(1i64)).unwrap();
result[0].clear();
state.push_result(&mut ctx, &mut result).unwrap();
assert_eq!(result[0].as_int_slice(), &[Some(1)]);
state.update(&mut ctx, &Some(5i64)).unwrap();
result[0].clear();
state.push_result(&mut ctx, &mut result).unwrap();
assert_eq!(result[0].as_int_slice(), &[Some(4)]);
state.update_repeat(&mut ctx, &Some(8), 9).unwrap();
state
.update_repeat(&mut ctx, &Option::<Int>::None, 7)
.unwrap();
result[0].clear();
state.push_result(&mut ctx, &mut result).unwrap();
assert_eq!(result[0].as_int_slice(), &[Some(12)]);
// Will not change due to xor even times
state.update_repeat(&mut ctx, &Some(9), 10).unwrap();
result[0].clear();
state.push_result(&mut ctx, &mut result).unwrap();
assert_eq!(result[0].as_int_slice(), &[Some(12)]);
state.update(&mut ctx, &Some(2i64)).unwrap();
state
.update_vector(&mut ctx, &[Some(2i64), None, Some(1i64)], &[0, 1, 2])
.unwrap();
result[0].clear();
state.push_result(&mut ctx, &mut result).unwrap();
assert_eq!(result[0].as_int_slice(), &[Some(13)]);
state.update(&mut ctx, &Some(2i64)).unwrap();
result[0].clear();
state.push_result(&mut ctx, &mut result).unwrap();
assert_eq!(result[0].as_int_slice(), &[Some(15)]);
state.update(&mut ctx, &Some(2i64)).unwrap();
state.update(&mut ctx, &Some(-1i64)).unwrap();
result[0].clear();
state.push_result(&mut ctx, &mut result).unwrap();
assert_eq!(
result[0].as_int_slice(),
&[Some(18446744073709551602u64 as i64)]
);
} | rust_cleaned_test_functions.jsonl/16698 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1204
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13996,
76462,
368,
341,
286,
1077,
5206,
5635,
284,
58239,
1972,
486,
2258,
543,
286,
1077,
729,
284,
4598,
901,
24911,
8344,
7125,
27638,
8344,
55,
269,
2235,
1834,
486,
27742,
486,
3357,
30002,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_string_corruption() {
assert::fail("'U4V6'[93]", "out of bound");
assert::fail("''[2]", "out of bound");
} | rust_cleaned_test_functions.jsonl/8189 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 73
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
14734,
14123,
368,
341,
286,
2060,
486,
18403,
45456,
52,
19,
53,
21,
66895,
24,
18,
19076,
330,
411,
315,
6822,
797,
286,
2060,
486,
18403,
445,
4605,
58,
17,
19076,
330,
411,
315,
6822... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_deserialize_bool() {
let value = Value::Boolean(true);
let deserializer = ValueDeserializer::new(&value);
let result: bool = bool::deserialize(deserializer).unwrap();
assert!(result);
} | rust_cleaned_test_functions.jsonl/67376 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15768,
9050,
22159,
368,
341,
286,
1077,
897,
284,
5162,
486,
6890,
3715,
317,
286,
1077,
939,
41939,
284,
5162,
80097,
486,
931,
2099,
957,
317,
286,
1077,
1102,
25,
1807,
284,
1807,
486,
66777... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_variant_typing() {
let out: bool = rune!(pub fn main() { Err(0) is Result });
assert_eq!(out, true);
let out: bool = rune!(pub fn main() { Ok(0) is Result });
assert_eq!(out, true);
let out: bool = rune!(pub fn main() { Some(0) is Option });
assert_eq!(out, true);
let out: bool = rune!(pub fn main() { None is Option });
assert_eq!(out, true);
let out: bool = rune! {
enum Custom { A, B(a) }
pub fn main() { Custom::A is Custom }
};
assert_eq!(out, true);
let out: bool = rune! {
enum Custom { A, B(a) }
pub fn main() { Custom::B(42) is Custom }
};
assert_eq!(out, true);
let out: bool = rune! {
enum Custom { A, B(a) }
pub fn main() { Custom::A is Option }
};
assert_eq!(out, false);
let out: bool = rune! {
enum Custom { A, B(a) }
pub fn main() { Custom::A is not Option }
};
assert_eq!(out, true);
} | rust_cleaned_test_functions.jsonl/103098 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 440
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46112,
42111,
287,
368,
341,
262,
1077,
700,
25,
1807,
284,
63499,
10297,
9585,
5168,
1887,
368,
314,
15495,
7,
15,
8,
374,
5714,
1625,
262,
2060,
10714,
10297,
411,
11,
830,
626,
262,
1077,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.