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_safe_checkout_update_to_deleted_blob() -> BitResult<()> {
BitRepo::with_minimal_repo(|repo| {
let target = commit! {
foo < "updated content"
};
rm!(repo: "foo");
let conflicts =
bit_checkout!(repo: &rev!(target)).unwrap_err().try_into_checkout_conflict()?;
assert_eq!(conflicts.len(), 1);
Ok(())
})
} | rust_cleaned_test_functions.jsonl/62957 | {
"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,
34067,
68186,
8882,
2346,
39418,
45908,
368,
1464,
6495,
2077,
71698,
341,
262,
6495,
25243,
486,
4197,
7260,
2861,
37784,
22428,
23476,
91,
341,
286,
1077,
2169,
284,
5266,
0,
341,
1843,
15229,
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... | 2 |
#[test]
fn test_operator() {
let x = hex2binary("38006F45291200").unwrap();
let (_, p) = parse_packet(&x).unwrap();
assert_eq!(
p,
Packet::OperatorPacket {
version: 1,
type_id: 6,
subpackets: vec![
Packet::LiteralPacket {
version: 6,
type_id: 4,
num: 10,
},
Packet::LiteralPacket {
version: 2,
type_id: 4,
num: 20
}
]
}
)
} | rust_cleaned_test_functions.jsonl/6776 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 493
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40594,
368,
341,
286,
1077,
856,
284,
12371,
17,
25891,
445,
18,
23,
15,
15,
21,
37,
19,
20,
17,
24,
16,
17,
15,
15,
1827,
15454,
543,
286,
1077,
39464,
281,
8,
284,
4715,
21078,
2099,
87,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_minimize_constant_infinite_bound() {
let quad = BoundedQuadratic::new(f64::NEG_INFINITY, f64::INFINITY, 0., 0., 1.);
assert_eq!(quad.minimize(), (0., 1.));
} | rust_cleaned_test_functions.jsonl/19887 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7260,
11853,
34967,
1243,
25722,
19447,
368,
341,
286,
1077,
27082,
284,
425,
13082,
2183,
88678,
486,
931,
955,
21,
19,
486,
97127,
91110,
11,
282,
21,
19,
486,
687,
55990,
11,
220,
15,
2572,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extract_markdown_links() {
let input = "This is [a test](https://endler.dev). This is a relative link test [Relative Link Test](relative_link)";
let links: HashSet<Uri> = extract_links(
&InputContent::from_string(input, FileType::Markdown),
Some(Url::parse("https://github.com/hello-rust/lychee/").unwrap()),
)
.into_iter()
.map(|r| r.uri)
.collect();
assert_eq!(
links,
[
website("https://endler.dev"),
website("https://github.com/hello-rust/lychee/relative_link"),
]
.iter()
.cloned()
.collect()
)
} | rust_cleaned_test_functions.jsonl/93886 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 377
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
18924,
2923,
25258,
368,
341,
286,
1077,
1946,
284,
330,
1986,
374,
508,
64,
1273,
9533,
2428,
1110,
408,
1536,
21523,
568,
1096,
374,
264,
8674,
2656,
1273,
508,
28442,
5948,
3393,
9533,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mime_override() {
fn all_attachment(_: &mime::Name) -> DispositionType {
DispositionType::Attachment
}
let mut srv = test::init_service(
App::new().service(
Files::new("/", ".")
.mime_override(all_attachment)
.index_file("Cargo.toml"),
),
);
let request = TestRequest::get().uri("/").to_request();
let response = test::call_service(&mut srv, request);
assert_eq!(response.status(), StatusCode::OK);
let content_disposition = response
.headers()
.get(header::CONTENT_DISPOSITION)
.expect("To have CONTENT_DISPOSITION");
let content_disposition = content_disposition
.to_str()
.expect("Convert CONTENT_DISPOSITION to str");
assert_eq!(content_disposition, "attachment; filename=\"Cargo.toml\"");
} | rust_cleaned_test_functions.jsonl/35490 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 466
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
83624,
48576,
368,
341,
286,
5168,
678,
40868,
73834,
609,
49588,
486,
675,
8,
1464,
4093,
3487,
929,
341,
310,
4093,
3487,
929,
486,
33569,
198,
286,
555,
286,
1077,
5206,
43578,
284,
1273,
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_calculate_thumb_x_from_val() {
assert_eq!(
0.0,
calculate_thumb_x_from_val(0.0, 0.0, 100.0, 100.0, 32.0)
);
assert_eq!(
34.0,
calculate_thumb_x_from_val(50.0, 0.0, 100.0, 100.0, 32.0)
);
assert_eq!(
68.0,
calculate_thumb_x_from_val(100.0, 0.0, 100.0, 100.0, 32.0)
);
} | rust_cleaned_test_functions.jsonl/80585 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 276
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24005,
11207,
46352,
3212,
5673,
6189,
368,
341,
286,
2060,
10714,
33673,
310,
220,
15,
13,
15,
345,
310,
11047,
46352,
3212,
5673,
6189,
7,
15,
13,
15,
11,
220,
15,
13,
15,
11,
220,
16,
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_serialize_envelope_attachments() {
let event_id = EventId("9ec79c33ec9942ab8353589fcb2e04dc".parse().unwrap());
let mut envelope = Envelope::from_request(Some(event_id), request_meta());
let mut item = Item::new(ItemType::Event);
item.set_payload(
ContentType::Json,
"{\"message\":\"hello world\",\"level\":\"error\"}",
);
envelope.add_item(item);
let mut item = Item::new(ItemType::Attachment);
item.set_payload(ContentType::Text, &b"Hello\r\n"[..]);
item.set_filename("application.log");
envelope.add_item(item);
let mut buffer = Vec::new();
envelope.serialize(&mut buffer).unwrap();
let stringified = String::from_utf8_lossy(&buffer);
insta::assert_snapshot!(stringified, @r###"
{"event_id":"9ec79c33ec9942ab8353589fcb2e04dc","dsn":"https://e12d836b15bb49d7bbf99e64295d995b:@sentry.io/42","client":"sentry/client","version":7,"origin":"http://origin/","remote_addr":"192.168.0.1","user_agent":"sentry/agent"}
{"type":"event","length":41,"content_type":"application/json"}
{"message":"hello world","level":"error"}
{"type":"attachment","length":7,"content_type":"text/plain","filename":"application.log"}
Hello
"###);
} | rust_cleaned_test_functions.jsonl/103620 | {
"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,
88686,
6205,
18853,
98581,
368,
341,
286,
1077,
1538,
842,
284,
3665,
764,
445,
24,
757,
22,
24,
66,
18,
18,
757,
24,
24,
19,
17,
370,
23,
18,
20,
18,
20,
23,
24,
69,
7221,
17,
68,
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_server_stale_meta() {
let count = 3;
let mut cluster = new_server_cluster(0, count);
let pd_client = Arc::clone(&cluster.pd_client);
// Disable default max peer number check.
pd_client.disable_default_operator();
cluster.run();
cluster.add_send_filter(IsolationFilterFactory::new(3));
pd_client.must_remove_peer(1, new_peer(3, 3));
pd_client.must_add_peer(1, new_peer(3, 4));
cluster.shutdown();
let engine_3 = cluster.get_engine(3);
let mut state: RegionLocalState = engine_3
.get_msg_cf(CF_RAFT, &keys::region_state_key(1))
.unwrap()
.unwrap();
state.set_state(PeerState::Tombstone);
let handle = get_cf_handle(&engine_3, CF_RAFT).unwrap();
engine_3
.put_msg_cf(handle, &keys::region_state_key(1), &state)
.unwrap();
cluster.clear_send_filters();
// avoid TIMEWAIT
sleep_ms(500);
cluster.start().unwrap();
cluster.must_put(b"k1", b"v1");
must_get_equal(&engine_3, b"k1", b"v1");
} | rust_cleaned_test_functions.jsonl/119799 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 454
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12015,
1261,
1574,
13381,
368,
341,
262,
1077,
1760,
284,
220,
18,
280,
262,
1077,
5206,
10652,
284,
501,
12015,
28441,
7,
15,
11,
1760,
317,
262,
1077,
7744,
8179,
284,
19689,
486,
19982,
2099,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_process_store_ok() {
solana_logger::setup();
let keys = vec![];
let (config_keypair, config_account) = create_config_account(keys.clone());
let config_pubkey = config_keypair.pubkey();
let my_config = MyConfig::new(42);
let instruction = config_instruction::store(&config_pubkey, true, keys, &my_config);
let keyed_accounts = [(true, false, config_pubkey, config_account.clone())];
assert_eq!(
process_instruction(&instruction.data, &keyed_accounts),
Ok(())
);
assert_eq!(
Some(my_config),
deserialize(get_config_data(config_account.borrow().data()).unwrap()).ok()
);
} | rust_cleaned_test_functions.jsonl/36692 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 337
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
14809,
19817,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
6894,
284,
7486,
0,
15078,
286,
1077,
320,
1676,
3097,
12670,
11,
2193,
13500,
8,
284,
1855,
5332,
13500,
36131,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_calculate_monitoring_station_position_large_example() {
let map = string_to_asteroid_map(
".#..##.###...#######\n\
##.############..##.\n\
.#.######.########.#\n\
.###.#######.####.#.\n\
#####.##.#.##.###.##\n\
..#####..#.#########\n\
####################\n\
#.####....###.#.#.##\n\
##.#################\n\
#####.##.###..####..\n\
..######..##.#######\n\
####.##.####...##..#\n\
.#####..#.######.###\n\
##...#.##########...\n\
#.##########.#######\n\
.####.#.###.###.#.##\n\
....##.##.###..#####\n\
.#.#.###########.###\n\
#.#.#.#####.####.###\n\
###.##.####.##.#..##",
);
assert_eq!(
(AsteroidLocation::new(11, 13), 210),
calculate_monitoring_station_position(&map)
);
} | rust_cleaned_test_functions.jsonl/69386 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 616
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24005,
11207,
40112,
287,
44798,
9661,
45228,
39304,
368,
341,
286,
1077,
2415,
284,
914,
2346,
62,
2300,
588,
5376,
1006,
310,
5933,
2,
496,
565,
13,
14374,
1112,
97864,
59,
77,
5661,
1797,
770... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_erb_inout() {
let sr = 24000;
let n_fft = 192;
let n_freqs = n_fft / 2 + 1;
let hop = n_fft / 2;
let nb_bands = 24;
let state = DFState::new(sr, n_fft, hop, nb_bands, 1);
let d = Uniform::new(-1., 1.);
let mut input = Vec::with_capacity(n_freqs);
let mut rng = rand::thread_rng();
for _ in 0..(n_freqs) {
input.push(Complex32::new(d.sample(&mut rng), d.sample(&mut rng)))
}
let mut mask = vec![1.; nb_bands];
mask[3] = 0.3;
mask[nb_bands - 1] = 0.5;
let mut output = input.clone();
apply_band_gain(&mut output, mask.as_slice(), &state.erb);
let mut cumsum = 0;
for (erb_idx, erb_w) in state.erb.iter().enumerate() {
for i in cumsum..cumsum + erb_w {
assert_eq!(input[i] * mask[erb_idx], output[i])
}
cumsum += erb_w;
}
} | rust_cleaned_test_functions.jsonl/104358 | {
"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,
62,
40499,
1243,
411,
368,
341,
286,
1077,
18962,
284,
220,
17,
19,
15,
15,
15,
280,
286,
1077,
308,
67059,
284,
220,
16,
24,
17,
280,
286,
1077,
308,
21790,
82,
284,
308,
67059,
608,
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... | 4 |
#[test]
fn test_create_program_spec_success() {
let mut context_builder = ContextBuilder::new();
context_builder.log_in(&[RoleType::SpecCreator]);
let conn = context_builder.db_conn();
let hw_spec = HardwareSpecFactory::default().name("HW 1").insert(conn);
let values_list: InputValue = InputValue::list(
[1, 2, 3].iter().map(|v| InputValue::scalar(*v)).collect(),
);
let runner = QueryRunner::new(context_builder);
assert_eq!(
runner.query(
QUERY,
hashmap! {
"hardwareSpecId" => InputValue::scalar(hw_spec.id.to_string()),
"name" => InputValue::scalar("Program 2"),
"description" => InputValue::scalar("description!"),
"input" => values_list.clone(),
"expectedOutput" => values_list,
}
),
(
json!({
"createProgramSpec": {
"programSpecEdge": {
"node": {
"name": "Program 2",
"slug": "program-2",
"description": "description!",
"input": [1, 2, 3],
"expectedOutput": [1, 2, 3],
}
}
}
}),
vec![]
)
);
} | rust_cleaned_test_functions.jsonl/90805 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 787
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
25096,
13594,
18632,
368,
341,
262,
1077,
5206,
2266,
28532,
284,
9608,
3297,
486,
931,
543,
262,
2266,
28532,
1665,
1243,
2099,
58,
9030,
929,
486,
8327,
31865,
2558,
262,
1077,
4534,
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_binds() -> Result<(), Box<dyn Error + Send + Sync>> {
assert_eq!("10f20o30o10", &"?f?o?o?".binds(&[&10, &20, &30]));
assert_eq!(
"'abc'f'def'o'ghi'o'abc'",
&"?f?o?o?".binds(&[&"abc", &"def", &"ghi"])
);
assert_eq!(
"10f20o30o10",
&String::from("?f?o?o?").binds(&[&10, &20, &30])
);
assert_eq!(
"10f'AAA'oTRUEo10",
&String::from("?f?o?o?").binds(&[&10, &"AAA", &true])
);
assert_eq!(
"10f'AAA'o$oTRUE",
&String::from("$1f$02o$$o$3$4").bind_nums(&[&10, &"AAA", &true])
);
assert_eq!(
"1f1.5o0.0000001o1",
&"?f?o?o?".binds(&[&1.0, &1.5, &0.0000001])
);
Ok(())
} | rust_cleaned_test_functions.jsonl/4401 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 526
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
8673,
368,
1464,
5714,
68843,
8261,
92846,
4600,
488,
11000,
488,
28937,
2452,
341,
286,
2060,
10714,
17223,
16,
15,
69,
17,
15,
78,
18,
15,
78,
16,
15,
497,
609,
43869,
69,
30,
78,
30,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_escaped_char() {
assert_eq!(escaped_char(r"\u012345"), Ok(("45", '\u{0123}')));
assert_eq!(escaped_char(r"\U00012345"), Ok(("", '\u{012345}')));
} | rust_cleaned_test_functions.jsonl/21709 | {
"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,
62,
65826,
9232,
368,
341,
286,
2060,
10714,
10297,
65826,
9232,
2601,
11934,
84,
15,
16,
17,
18,
19,
20,
3975,
7622,
30873,
19,
20,
497,
5196,
84,
90,
15,
16,
17,
18,
92,
43284,
286,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_uuid_params() {
test_type(
"UUID",
&[
(
Some(Uuid::parse_str("a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11").unwrap()),
"'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'",
),
(None, "NULL"),
],
)
} | rust_cleaned_test_functions.jsonl/83314 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 211
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25540,
6745,
368,
341,
262,
1273,
1819,
1006,
286,
330,
24754,
756,
286,
609,
9640,
310,
2399,
394,
4329,
12317,
2423,
486,
6400,
2895,
445,
64,
15,
2127,
8904,
24,
24,
12,
24,
66,
15,
65,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_func_undefined_local() {
Function::new(
"function",
&vec!["a".to_string()],
&YolkExpr::Ident("b".to_string()),
)
.unwrap();
} | rust_cleaned_test_functions.jsonl/131956 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9596,
62,
9614,
13564,
368,
341,
262,
5712,
486,
931,
1006,
286,
330,
1688,
756,
286,
609,
4083,
0,
1183,
64,
3263,
983,
3904,
73845,
286,
609,
56,
22604,
16041,
486,
28301,
445,
65,
3263,
983... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_where_clause() {
let queries = ["where name = 'jon'",
"where id = 5",
"where name = 'bill' and age > 35"];
for q in queries.into_iter() {
where_clause(q).expect(q);
}
} | rust_cleaned_test_functions.jsonl/114454 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 130
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36814,
57530,
368,
341,
286,
1077,
19556,
284,
4383,
2870,
829,
284,
364,
34165,
38330,
286,
330,
2870,
877,
284,
220,
20,
756,
286,
330,
2870,
829,
284,
364,
29642,
6,
323,
4231,
861,
220,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_ram_consumption() {
// Regular debouncers
assert_eq!(
std::mem::size_of_val(&SmallPinDebouncer::new(2, PinState::Low)),
4
);
assert_eq!(
std::mem::size_of_val(&SmallPinDebouncer::new(8, PinState::Low)),
4
);
assert_eq!(
std::mem::size_of_val(&SmallPinDebouncer::new(9, PinState::Low)),
4
);
assert_eq!(
std::mem::size_of_val(&SmallPinDebouncer::new(16, PinState::Low)),
4
);
} | rust_cleaned_test_functions.jsonl/2182 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 326
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62124,
69870,
560,
368,
341,
286,
442,
28800,
4222,
2981,
388,
198,
286,
2060,
10714,
33673,
310,
1460,
486,
10536,
486,
2141,
3575,
6189,
2099,
25307,
19861,
1912,
65,
79745,
486,
931,
7,
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... | 1 |
#[test]
fn test_make_look_up_key() {
let k = LookUpKey::new(b"da", 1);
assert_eq!(k.internal_key(), &[100, 97, 1, 1, 0, 0, 0, 0, 0, 0]);
assert_eq!(k.user_key(), &[100, 97]);
assert_eq!(
k.memtable_key().as_slice(),
&[10, 100, 97, 1, 1, 0, 0, 0, 0, 0, 0]
);
} | rust_cleaned_test_functions.jsonl/124312 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 198
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28230,
24271,
8237,
3097,
368,
341,
286,
1077,
595,
284,
9192,
2324,
1592,
486,
931,
1883,
1,
3235,
497,
220,
16,
317,
286,
2060,
10714,
10297,
74,
18264,
3097,
1507,
44590,
16,
15,
15,
11,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dive_depth() {
let dive_commands = get_commands();
let dive = Dive::new(dive_commands);
assert_eq!(dive.depth(), 60);
} | rust_cleaned_test_functions.jsonl/110103 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 85
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
533,
19061,
368,
341,
286,
1077,
29863,
44151,
284,
633,
44151,
543,
286,
1077,
29863,
284,
88517,
486,
931,
1500,
533,
44151,
317,
286,
2060,
10714,
10297,
67,
533,
40974,
1507,
220,
21,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_manager_serialize_deserialize_inconsistent_monitor() {
// Test deserializing a ChannelManager with an out-of-date ChannelMonitor
let chanmon_cfgs = create_chanmon_cfgs(4);
let node_cfgs = create_node_cfgs(4, &chanmon_cfgs);
let node_chanmgrs = create_node_chanmgrs(4, &node_cfgs, &[None, None, None, None]);
let logger: test_utils::TestLogger;
let fee_estimator: test_utils::TestFeeEstimator;
let persister: test_utils::TestPersister;
let new_chain_monitor: test_utils::TestChainMonitor;
let nodes_0_deserialized: ChannelManager<EnforcingSigner, &test_utils::TestChainMonitor, &test_utils::TestBroadcaster, &test_utils::TestKeysInterface, &test_utils::TestFeeEstimator, &test_utils::TestLogger>;
let mut nodes = create_network(4, &node_cfgs, &node_chanmgrs);
create_announced_chan_between_nodes(&nodes, 0, 1, InitFeatures::known(), InitFeatures::known());
create_announced_chan_between_nodes(&nodes, 2, 0, InitFeatures::known(), InitFeatures::known());
let (_, _, channel_id, funding_tx) = create_announced_chan_between_nodes(&nodes, 0, 3, InitFeatures::known(), InitFeatures::known());
let mut node_0_stale_monitors_serialized = Vec::new();
for monitor in nodes[0].chain_monitor.chain_monitor.monitors.read().unwrap().iter() {
let mut writer = test_utils::TestVecWriter(Vec::new());
monitor.1.write(&mut writer).unwrap();
node_0_stale_monitors_serialized.push(writer.0);
}
let (our_payment_preimage, _, _) = route_payment(&nodes[2], &[&nodes[0], &nodes[1]], 1000000);
let nodes_0_serialized = nodes[0].node.encode();
route_payment(&nodes[0], &[&nodes[3]], 1000000);
nodes[1].node.peer_disconnected(&nodes[0].node.get_our_node_id(), false);
nodes[2].node.peer_disconnected(&nodes[0].node.get_our_node_id(), false);
nodes[3].node.peer_disconnected(&nodes[0].node.get_our_node_id(), false);
// Now the ChannelMonitor (which is now out-of-sync with ChannelManager for channel w/
// nodes[3])
let mut node_0_monitors_serialized = Vec::new();
for monitor in nodes[0].chain_monitor.chain_monitor.monitors.read().unwrap().iter() {
let mut writer = test_utils::TestVecWriter(Vec::new());
monitor.1.write(&mut writer).unwrap();
node_0_monitors_serialized.push(writer.0);
}
logger = test_utils::TestLogger::new();
fee_estimator = test_utils::TestFeeEstimator { sat_per_kw: Mutex::new(253) };
persister = test_utils::TestPersister::new();
let keys_manager = &chanmon_cfgs[0].keys_manager;
new_chain_monitor = test_utils::TestChainMonitor::new(Some(nodes[0].chain_source), nodes[0].tx_broadcaster.clone(), &logger, &fee_estimator, &persister, keys_manager);
nodes[0].chain_monitor = &new_chain_monitor;
let mut node_0_stale_monitors = Vec::new();
for serialized in node_0_stale_monitors_serialized.iter() {
let mut read = &serialized[..];
let (_, monitor) = <(BlockHash, ChannelMonitor<EnforcingSigner>)>::read(&mut read, keys_manager).unwrap();
assert!(read.is_empty());
node_0_stale_monitors.push(monitor);
}
let mut node_0_monitors = Vec::new();
for serialized in node_0_monitors_serialized.iter() {
let mut read = &serialized[..];
let (_, monitor) = <(BlockHash, ChannelMonitor<EnforcingSigner>)>::read(&mut read, keys_manager).unwrap();
assert!(read.is_empty());
node_0_monitors.push(monitor);
}
let mut nodes_0_read = &nodes_0_serialized[..];
if let Err(msgs::DecodeError::InvalidValue) =
<(BlockHash, ChannelManager<EnforcingSigner, &test_utils::TestChainMonitor, &test_utils::TestBroadcaster, &test_utils::TestKeysInterface, &test_utils::TestFeeEstimator, &test_utils::TestLogger>)>::read(&mut nodes_0_read, ChannelManagerReadArgs {
default_config: UserConfig::default(),
keys_manager,
fee_estimator: &fee_estimator,
chain_monitor: nodes[0].chain_monitor,
tx_broadcaster: nodes[0].tx_broadcaster.clone(),
logger: &logger,
channel_monitors: node_0_stale_monitors.iter_mut().map(|monitor| { (monitor.get_funding_txo().0, monitor) }).collect(),
}) { } else {
panic!("If the monitor(s) are stale, this indicates a bug and we should get an Err return");
};
let mut nodes_0_read = &nodes_0_serialized[..];
let (_, nodes_0_deserialized_tmp) =
<(BlockHash, ChannelManager<EnforcingSigner, &test_utils::TestChainMonitor, &test_utils::TestBroadcaster, &test_utils::TestKeysInterface, &test_utils::TestFeeEstimator, &test_utils::TestLogger>)>::read(&mut nodes_0_read, ChannelManagerReadArgs {
default_config: UserConfig::default(),
keys_manager,
fee_estimator: &fee_estimator,
chain_monitor: nodes[0].chain_monitor,
tx_broadcaster: nodes[0].tx_broadcaster.clone(),
logger: &logger,
channel_monitors: node_0_monitors.iter_mut().map(|monitor| { (monitor.get_funding_txo().0, monitor) }).collect(),
}).unwrap();
nodes_0_deserialized = nodes_0_deserialized_tmp;
assert!(nodes_0_read.is_empty());
{ // Channel close should result in a commitment tx
let txn = nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap();
assert_eq!(txn.len(), 1);
check_spends!(txn[0], funding_tx);
assert_eq!(txn[0].input[0].previous_output.txid, funding_tx.txid());
}
for monitor in node_0_monitors.drain(..) {
assert!(nodes[0].chain_monitor.watch_channel(monitor.get_funding_txo().0, monitor).is_ok());
check_added_monitors!(nodes[0], 1);
}
nodes[0].node = &nodes_0_deserialized;
check_closed_event!(nodes[0], 1, ClosureReason::OutdatedChannelManager);
reconnect_nodes(&nodes[0], &nodes[1], (false, false), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (false, false));
reconnect_nodes(&nodes[0], &nodes[2], (false, false), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (false, false));
claim_payment(&nodes[2], &[&nodes[0], &nodes[1]], our_payment_preimage);
nodes[3].node.peer_connected(&nodes[0].node.get_our_node_id(), &msgs::Init { features: InitFeatures::empty() });
let reestablish = get_event_msg!(nodes[3], MessageSendEvent::SendChannelReestablish, nodes[0].node.get_our_node_id());
nodes[0].node.peer_connected(&nodes[3].node.get_our_node_id(), &msgs::Init { features: InitFeatures::empty() });
nodes[0].node.handle_channel_reestablish(&nodes[3].node.get_our_node_id(), &reestablish);
let msg_events = nodes[0].node.get_and_clear_pending_msg_events();
assert_eq!(msg_events.len(), 1);
if let MessageSendEvent::HandleError { ref action, .. } = msg_events[0] {
match action {
&ErrorAction::SendErrorMessage { ref msg } => {
assert_eq!(msg.channel_id, channel_id);
},
_ => panic!("Unexpected event!"),
}
}
} | rust_cleaned_test_functions.jsonl/16898 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2441
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12144,
88686,
15768,
9050,
1243,
78399,
40112,
368,
341,
197,
322,
3393,
939,
2848,
4849,
264,
13434,
2043,
448,
458,
700,
8668,
18413,
13434,
30098,
198,
10217,
26023,
1645,
18343,
82,
284,
1855,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_load_ephemeral_account_fails() {
request_stream_test(
AccountLifetime::Ephemeral,
Arc::new(Inspector::new()),
|proxy, ahc_client_end| {
async move {
let expected_id = TEST_ACCOUNT_ID.clone();
assert_eq!(
proxy.load_account(ahc_client_end, expected_id.into()).await?,
Err(ApiError::Internal)
);
Ok(())
}
},
);
} | rust_cleaned_test_functions.jsonl/36822 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 352
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12411,
12476,
29032,
3253,
13500,
761,
6209,
368,
341,
286,
1681,
12673,
4452,
1006,
310,
8615,
74579,
486,
36,
59941,
3253,
345,
310,
19689,
486,
931,
7,
46230,
486,
931,
14702,
310,
760,
22803,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_my_queue() {
let mut q = MyQueue::new();
q.push(1);
q.push(2);
assert_eq!(q.peek(), 1);
assert_eq!(q.pop(), 1);
assert!(!q.empty());
} | rust_cleaned_test_functions.jsonl/50352 | {
"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,
35686,
10841,
368,
341,
286,
1077,
5206,
2804,
284,
3017,
7554,
486,
931,
543,
286,
2804,
2552,
7,
16,
317,
286,
2804,
2552,
7,
17,
317,
286,
2060,
10714,
10297,
80,
41249,
1507,
220,
16,
317,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_ascii_5_gibi_to_file() {
let tname = "ascii-5G";
let tmp_fn = format!("TESTFILE-{}.tmp", &tname);
let (fix, mut ucmd) = at_and_ucmd!();
ucmd.args(&[
"status=none",
"count=5G",
"iflag=count_bytes",
"if=/dev/zero",
of!(tmp_fn),
])
.run()
.no_stderr()
.no_stdout()
.success();
assert_eq!(5 * 1024 * 1024 * 1024, fix.metadata(&tmp_fn).len());
} | rust_cleaned_test_functions.jsonl/59401 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 241
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
50238,
62,
20,
1889,
39393,
2346,
2458,
368,
341,
262,
1077,
259,
606,
284,
330,
23324,
12,
20,
38,
876,
262,
1077,
4174,
15246,
284,
3561,
17223,
10033,
6041,
12,
46391,
5173,
497,
609,
83,
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_pointer_encoding_ok() {
use crate::endianity::NativeEndian;
let expected =
constants::DwEhPe(constants::DW_EH_PE_uleb128.0 | constants::DW_EH_PE_pcrel.0);
let input = [expected.0, 1, 2, 3, 4];
let input = &mut EndianSlice::new(&input, NativeEndian);
assert_eq!(parse_pointer_encoding(input), Ok(expected));
assert_eq!(*input, EndianSlice::new(&[1, 2, 3, 4], NativeEndian));
} | rust_cleaned_test_functions.jsonl/9400 | {
"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,
21039,
21425,
37613,
19817,
368,
341,
286,
990,
17717,
486,
408,
1103,
487,
486,
20800,
43231,
280,
286,
1077,
3601,
4035,
310,
18021,
486,
35,
86,
36,
71,
10197,
80368,
486,
54219,
2089,
39,
45... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_flip_normal_create() {
let yzrect = Rect::new(
-1.0,
1.0,
-1.0,
1.0,
0.0,
&MaterialType::DiffuseLight(DiffuseLight::new(TextureType::ConstantTexture(
ConstantTexture::new(&vect!(4, 4, 4)),
))),
Axis::X,
);
let r = Ray::new(&vect!(1, 0, 0), &vect!(-1, 0, 0), None);
let mut hr_ans = HitRecord::new(
vect!(0, 0, 0),
1.0,
MaterialType::DiffuseLight(DiffuseLight::new(TextureType::ConstantTexture(
ConstantTexture::new(&vect!(4, 4, 4)),
))),
);
hr_ans.normal = vect!(1, 0, 0);
hr_ans.texture_coord = Some(TextureCoord { u: 0.5, v: 0.5 });
let hr = yzrect.hit(&r, 0.0, 1.0);
let flipnorm = FlipNormal::new(&yzrect);
let flipped_hr = flipnorm.hit(&r, 0.0, 1.0);
assert_eq!(hr.unwrap().normal, flipped_hr.unwrap().normal * -1.);
} | rust_cleaned_test_functions.jsonl/126592 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 576
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56012,
13973,
8657,
368,
341,
286,
1077,
379,
89,
2851,
284,
11920,
486,
931,
1006,
310,
481,
16,
13,
15,
345,
310,
220,
16,
13,
15,
345,
310,
481,
16,
13,
15,
345,
310,
220,
16,
13,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_it() {
async fn do_test() {
let (r, _w) = sys_util::pipe(true).unwrap();
let done = Box::pin(async { 5usize });
let pending = Box::pin(TestFut::new(r));
match futures::future::select(pending, done).await {
Either::Right((5, pending)) => std::mem::drop(pending),
_ => panic!("unexpected select result"),
}
// test that dropping the incomplete future removed the waker.
assert_eq!(0, pending_ops());
}
let fut = do_test();
crate::run_one_poll(Box::pin(fut)).unwrap();
// Example of starting the framework and running a future:
async fn my_async(x: Rc<RefCell<u64>>) {
x.replace(4);
}
let x = Rc::new(RefCell::new(0));
crate::run_one_poll(Box::pin(my_async(x.clone()))).unwrap();
assert_eq!(*x.borrow(), 4);
} | rust_cleaned_test_functions.jsonl/29665 | {
"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,
14631,
368,
341,
286,
3312,
5168,
653,
4452,
368,
341,
310,
1077,
320,
81,
11,
716,
86,
8,
284,
5708,
18974,
486,
13768,
3715,
568,
15454,
543,
310,
1077,
2814,
284,
8261,
486,
13273,
18285,
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... | 2 |
#[test]
fn test_degrees() {
let tests_cases = vec![
(None, None),
(Some(f64::NAN), None),
(Some(0f64), Some(Real::new(0f64).unwrap())),
(Some(1f64), Some(Real::new(57.29577951308232_f64).unwrap())),
(
Some(std::f64::consts::PI),
Some(Real::new(180.0_f64).unwrap()),
),
(
Some(-std::f64::consts::PI / 2.0_f64),
Some(Real::new(-90.0_f64).unwrap()),
),
];
for (input, expect) in tests_cases {
let output = RpnFnScalarEvaluator::new()
.push_param(input)
.evaluate(ScalarFuncSig::Degrees)
.unwrap();
assert_eq!(expect, output, "{:?}", input);
}
} | rust_cleaned_test_functions.jsonl/9489 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 503
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46057,
7858,
368,
341,
286,
1077,
7032,
41427,
284,
7486,
90515,
310,
320,
4064,
11,
2240,
1326,
310,
320,
8373,
955,
21,
19,
486,
45,
1093,
701,
2240,
1326,
310,
320,
8373,
7,
15,
69,
21,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_parse() {
let tests = vec![
T("", 0, vec![]),
T("", 1000, vec![]),
T("foo", 0, vec![]),
T("bytes=", 0, vec![]),
T("bytes=7", 10, vec![]),
T("bytes= 7 ", 10, vec![]),
T("bytes=1-", 0, vec![]),
T("bytes=5-4", 10, vec![]),
T("bytes=0-2,5-4", 10, vec![]),
T("bytes=2-5,4-3", 10, vec![]),
T("bytes=--5,4--3", 10, vec![]),
T("bytes=A-", 10, vec![]),
T("bytes=A- ", 10, vec![]),
T("bytes=A-Z", 10, vec![]),
T("bytes= -Z", 10, vec![]),
T("bytes=5-Z", 10, vec![]),
T("bytes=Ran-dom, garbage", 10, vec![]),
T("bytes=0x01-0x02", 10, vec![]),
T("bytes= ", 10, vec![]),
T("bytes= , , , ", 10, vec![]),
T(
"bytes=0-9",
10,
vec![HttpRange {
start: 0,
length: 10,
}],
),
T(
"bytes=0-",
10,
vec![HttpRange {
start: 0,
length: 10,
}],
),
T(
"bytes=5-",
10,
vec![HttpRange {
start: 5,
length: 5,
}],
),
T(
"bytes=0-20",
10,
vec![HttpRange {
start: 0,
length: 10,
}],
),
T(
"bytes=15-,0-5",
10,
vec![HttpRange {
start: 0,
length: 6,
}],
),
T(
"bytes=1-2,5-",
10,
vec![
HttpRange {
start: 1,
length: 2,
},
HttpRange {
start: 5,
length: 5,
},
],
),
T(
"bytes=-2 , 7-",
11,
vec![
HttpRange {
start: 9,
length: 2,
},
HttpRange {
start: 7,
length: 4,
},
],
),
T(
"bytes=0-0 ,2-2, 7-",
11,
vec![
HttpRange {
start: 0,
length: 1,
},
HttpRange {
start: 2,
length: 1,
},
HttpRange {
start: 7,
length: 4,
},
],
),
T(
"bytes=-5",
10,
vec![HttpRange {
start: 5,
length: 5,
}],
),
T(
"bytes=-15",
10,
vec![HttpRange {
start: 0,
length: 10,
}],
),
T(
"bytes=0-499",
10000,
vec![HttpRange {
start: 0,
length: 500,
}],
),
T(
"bytes=500-999",
10000,
vec![HttpRange {
start: 500,
length: 500,
}],
),
T(
"bytes=-500",
10000,
vec![HttpRange {
start: 9500,
length: 500,
}],
),
T(
"bytes=9500-",
10000,
vec![HttpRange {
start: 9500,
length: 500,
}],
),
T(
"bytes=0-0,-1",
10000,
vec![
HttpRange {
start: 0,
length: 1,
},
HttpRange {
start: 9999,
length: 1,
},
],
),
T(
"bytes=500-600,601-999",
10000,
vec![
HttpRange {
start: 500,
length: 101,
},
HttpRange {
start: 601,
length: 399,
},
],
),
T(
"bytes=500-700,601-999",
10000,
vec![
HttpRange {
start: 500,
length: 201,
},
HttpRange {
start: 601,
length: 399,
},
],
),
// Match Apache laxity:
T(
"bytes= 1 -2 , 4- 5, 7 - 8 , ,,",
11,
vec![
HttpRange {
start: 1,
length: 2,
},
HttpRange {
start: 4,
length: 2,
},
HttpRange {
start: 7,
length: 2,
},
],
),
];
for t in tests {
let header = t.0;
let size = t.1;
let expected = t.2;
let res = HttpRange::parse(header, size);
if res.is_err() {
if expected.is_empty() {
continue;
} else {
assert!(
false,
"parse({}, {}) returned error {:?}",
header,
size,
res.unwrap_err()
);
}
}
let got = res.unwrap();
if got.len() != expected.len() {
assert!(
false,
"len(parseRange({}, {})) = {}, want {}",
header,
size,
got.len(),
expected.len()
);
continue;
}
for i in 0..expected.len() {
if got[i].start != expected[i].start {
assert!(
false,
"parseRange({}, {})[{}].start = {}, want {}",
header, size, i, got[i].start, expected[i].start
)
}
if got[i].length != expected[i].length {
assert!(
false,
"parseRange({}, {})[{}].length = {}, want {}",
header, size, i, got[i].length, expected[i].length
)
}
}
}
} | rust_cleaned_test_functions.jsonl/40537 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 5775
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
368,
341,
286,
1077,
7032,
284,
7486,
90515,
310,
350,
19814,
220,
15,
11,
7486,
0,
1294,
1326,
310,
350,
19814,
220,
16,
15,
15,
15,
11,
7486,
0,
1294,
1326,
310,
350,
445,
7975,
497... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
#[test]
fn test_parse_quoted_max_age() {
let h = Header::parse_header(&[b"max-age=\"31536000\"".to_vec()][..]);
assert_eq!(h.ok(), Some(StrictTransportSecurity { include_subdomains: false, max_age: 31536000u64 }));
} | rust_cleaned_test_functions.jsonl/37331 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
11280,
9253,
6345,
32053,
368,
341,
286,
1077,
305,
284,
12104,
486,
6400,
8757,
2099,
58,
65,
1,
2810,
42941,
4070,
18,
16,
20,
18,
21,
15,
15,
15,
2105,
3263,
983,
13251,
75453,
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... | 1 |
#[test]
fn test_weight_iterators() {
let mut gr = Graph::<_, _>::new();
let a = gr.add_node("A");
let b = gr.add_node("B");
let c = gr.add_node("C");
let d = gr.add_node("D");
let e = gr.add_node("E");
let f = gr.add_node("F");
let g = gr.add_node("G");
gr.add_edge(a, b, 7.0);
gr.add_edge(a, d, 5.);
gr.add_edge(d, b, 9.);
gr.add_edge(b, c, 8.);
gr.add_edge(b, e, 7.);
gr.add_edge(c, e, 5.);
gr.add_edge(d, e, 15.);
gr.add_edge(d, f, 6.);
gr.add_edge(f, e, 8.);
gr.add_edge(f, g, 11.);
gr.add_edge(e, g, 9.);
assert_eq!(gr.node_weights_mut().count(), gr.node_count());
assert_eq!(gr.edge_weights_mut().count(), gr.edge_count());
// add a disjoint part
let h = gr.add_node("H");
let i = gr.add_node("I");
let j = gr.add_node("J");
gr.add_edge(h, i, 1.);
gr.add_edge(h, j, 3.);
gr.add_edge(i, j, 1.);
assert_eq!(gr.node_weights_mut().count(), gr.node_count());
assert_eq!(gr.edge_weights_mut().count(), gr.edge_count());
for nw in gr.node_weights_mut() {
*nw = "x";
}
for node in gr.raw_nodes() {
assert_eq!(node.weight, "x");
}
let old = gr.clone();
for (index, ew) in gr.edge_weights_mut().enumerate() {
assert_eq!(old[EdgeIndex::new(index)], *ew);
*ew = -*ew;
}
for (index, edge) in gr.raw_edges().iter().enumerate() {
assert_eq!(edge.weight, -1. * old[EdgeIndex::new(index)]);
}
} | rust_cleaned_test_functions.jsonl/46750 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 759
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15876,
11723,
2973,
368,
341,
262,
1077,
5206,
1081,
284,
12165,
27638,
6878,
716,
6831,
931,
543,
262,
1077,
264,
284,
1081,
1364,
5084,
445,
32,
797,
262,
1077,
293,
284,
1081,
1364,
5084,
445... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_encode_2bytes() {
let mut bytes = vec![];
encode_u64(&mut bytes, 256).expect("encode failed");
assert_eq!(bytes.len(), 2);
let (decode_int, _) = decode_u64(&bytes).expect("decode err");
assert_eq!(decode_int, 256);
} | rust_cleaned_test_functions.jsonl/68978 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
62,
17,
9651,
368,
341,
286,
1077,
5206,
5820,
284,
7486,
0,
40901,
286,
16164,
7300,
21,
19,
2099,
6984,
5820,
11,
220,
17,
20,
21,
568,
17119,
445,
6180,
4641,
3071,
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 |
#[test]
fn test_ntype() -> Result<()> {
test_opt(DhcpOption::NetBiosNodeType(NodeType::M), vec![46, 1, 4])?;
Ok(())
} | rust_cleaned_test_functions.jsonl/41169 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 78
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38945,
499,
368,
1464,
5714,
71698,
341,
286,
1273,
15032,
5432,
62169,
5341,
486,
6954,
33,
3530,
66137,
22078,
929,
486,
44,
701,
7486,
20703,
19,
21,
11,
220,
16,
11,
220,
19,
2467,
69493,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_example2() {
assert_eq!(
false,
Solution::can_finish(2, vec![vec![1, 0], vec![0, 1]]),
);
} | rust_cleaned_test_functions.jsonl/45827 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39304,
17,
368,
341,
286,
2060,
10714,
33673,
310,
895,
345,
310,
12478,
486,
4814,
42980,
7,
17,
11,
7486,
20703,
4083,
20703,
16,
11,
220,
15,
1125,
7486,
20703,
15,
11,
220,
16,
5053,
1326,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_scan_black_sword() {
let result = Sequence::scan(Black, Sword, 0b0001110, 0b0110000, 7, 0);
let expected = [Sequence::new(1, 5, Some(4), Some(5))];
assert_eq!(result, expected);
let result = Sequence::scan(Black, Sword, 0b0010110, 0b0101000, 7, 0);
let expected = [Sequence::new(1, 5, Some(3), Some(5))];
assert_eq!(result, expected);
let result = Sequence::scan(Black, Sword, 0b0011010, 0b0100100, 7, 0);
let expected = [Sequence::new(1, 5, Some(2), Some(5))];
assert_eq!(result, expected);
let result = Sequence::scan(Black, Sword, 0b0011100, 0b0100010, 7, 0);
let expected = [Sequence::new(1, 5, Some(1), Some(5))];
assert_eq!(result, expected);
let result = Sequence::scan(Black, Sword, 0b0100110, 0b0011000, 7, 0);
let expected = [Sequence::new(1, 5, Some(3), Some(4))];
assert_eq!(result, expected);
let result = Sequence::scan(Black, Sword, 0b0101010, 0b0010100, 7, 0);
let expected = [Sequence::new(1, 5, Some(2), Some(4))];
assert_eq!(result, expected);
let result = Sequence::scan(Black, Sword, 0b0101100, 0b0010010, 7, 0);
let expected = [Sequence::new(1, 5, Some(1), Some(4))];
assert_eq!(result, expected);
let result = Sequence::scan(Black, Sword, 0b0110010, 0b0001100, 7, 0);
let expected = [Sequence::new(1, 5, Some(2), Some(3))];
assert_eq!(result, expected);
let result = Sequence::scan(Black, Sword, 0b0110100, 0b0001010, 7, 0);
let expected = [Sequence::new(1, 5, Some(1), Some(3))];
assert_eq!(result, expected);
let result = Sequence::scan(Black, Sword, 0b0111000, 0b0000110, 7, 0);
let expected = [Sequence::new(1, 5, Some(1), Some(2))];
assert_eq!(result, expected);
// multiple
let result = Sequence::scan(Black, Sword, 0b00011100, 0b11100011, 8, 0);
let expected = [
Sequence::new(1, 5, Some(1), Some(5)),
Sequence::new(2, 6, Some(5), Some(6)),
];
assert_eq!(result, expected);
// maybe overline
let result = Sequence::scan(Black, Sword, 0b1001110, 0b0110001, 7, 0);
let expected = [];
assert_eq!(result, expected);
// not overline
let result = Sequence::scan(Black, Sword, 0b10011100, 0b01100010, 8, 0);
let expected = [Sequence::new(1, 5, Some(1), Some(5))];
assert_eq!(result, expected);
// multiple
let result = Sequence::scan(Black, Sword, 0b0010110100, 0b1101001011, 10, 0);
let expected = [
Sequence::new(1, 5, Some(1), Some(3)),
Sequence::new(4, 8, Some(6), Some(8)),
];
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/56138 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1288
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28857,
40272,
643,
1158,
368,
341,
286,
1077,
1102,
284,
28871,
486,
16405,
7,
14417,
11,
35651,
11,
220,
15,
65,
15,
15,
15,
16,
16,
16,
15,
11,
220,
15,
65,
15,
16,
16,
15,
15,
15,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_valid_ses_verify_domain_identity() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/valid",
"ses-verify-domain-identity.xml",
);
let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
let client = SesClient::new(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = VerifyDomainIdentityRequest::default();
let result = client.verify_domain_identity(request).sync();
assert!(result.is_ok(), "parse error: {:?}", result);
} | rust_cleaned_test_functions.jsonl/21982 | {
"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,
21039,
8337,
643,
288,
35638,
20111,
46244,
368,
341,
286,
1077,
7860,
9655,
284,
14563,
2582,
5062,
486,
878,
9655,
1006,
310,
330,
1944,
35569,
79372,
14,
1891,
756,
310,
330,
9275,
12,
12446,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_one_step() {
let inp = "11111
19991
19191
19991
11111";
let mut parsed = input_generator(inp);
let mut total: usize = 0;
one_step(&mut parsed, &mut total);
assert_eq!(total, 9);
} | rust_cleaned_test_functions.jsonl/131635 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11667,
11946,
368,
341,
286,
1077,
32344,
284,
330,
16,
16,
16,
16,
16,
198,
16,
24,
24,
24,
16,
198,
16,
24,
16,
24,
16,
198,
16,
24,
24,
24,
16,
198,
16,
16,
16,
16,
16,
876,
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_extract_private_package_version_with_default_config() -> io::Result<()> {
let config_name = "package.json";
let config_content = json::json!({
"name": "starship",
"version": "0.1.0",
"private": true
})
.to_string();
let project_dir = create_project_dir()?;
fill_config(&project_dir, config_name, Some(&config_content))?;
expect_output(&project_dir, None, None)?;
project_dir.close()
} | rust_cleaned_test_functions.jsonl/19240 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 241
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
26249,
26328,
9438,
6615,
9993,
5332,
368,
1464,
6399,
486,
2077,
71698,
341,
286,
1077,
2193,
1269,
284,
330,
1722,
4323,
876,
286,
1077,
2193,
7495,
284,
2951,
486,
2236,
0,
2262,
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... | 4 |
#[test]
fn test_valid_vm_config_serial_console() {
vec![
(
vec!["cloud-hypervisor", "--kernel", "/path/to/kernel"],
r#"{
"kernel": {"path": "/path/to/kernel"},
"serial": {"mode": "Null"},
"console": {"mode": "Tty"}
}"#,
true,
),
(
vec![
"cloud-hypervisor",
"--kernel",
"/path/to/kernel",
"--serial",
"null",
"--console",
"tty",
],
r#"{
"kernel": {"path": "/path/to/kernel"}
}"#,
true,
),
(
vec![
"cloud-hypervisor",
"--kernel",
"/path/to/kernel",
"--serial",
"tty",
"--console",
"off",
],
r#"{
"kernel": {"path": "/path/to/kernel"},
"serial": {"mode": "Tty"},
"console": {"mode": "Off"}
}"#,
true,
),
]
.iter()
.for_each(|(cli, openapi, equal)| {
compare_vm_config_cli_vs_json(cli, openapi, *equal);
});
} | rust_cleaned_test_functions.jsonl/4729 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1043
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8337,
39008,
5332,
25602,
51724,
368,
341,
286,
7486,
90515,
310,
2399,
394,
7486,
0,
1183,
12361,
2832,
1082,
31396,
497,
14482,
23248,
497,
3521,
2343,
32429,
58343,
8097,
394,
435,
55543,
515,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cycles() {
struct Tests;
#[service]
impl Tests {
#[cycles(100)]
fn test_cycles(&self, ctx: ServiceContext) -> ServiceResponse<()> {
ServiceResponse::<()>::from_succeed(())
}
#[cycles(500)]
fn test_cycles2(&self, ctx: ServiceContext) -> ServiceResponse<()> {
ServiceResponse::<()>::from_succeed(())
}
}
#[cycles(200)]
fn test_sub_cycles_fn1(ctx: ServiceContext) -> ServiceResponse<()> {
ServiceResponse::<()>::from_succeed(())
}
#[cycles(200)]
fn test_sub_cycles_fn2(_foo: u64, ctx: ServiceContext) -> ServiceResponse<()> {
ServiceResponse::<()>::from_succeed(())
}
let t = Tests {};
let context = get_context(1000, "", "", "");
t.test_cycles(context.clone());
assert_eq!(context.get_cycles_used(), 100);
t.test_cycles2(context.clone());
assert_eq!(context.get_cycles_used(), 600);
test_sub_cycles_fn1(context.clone());
assert_eq!(context.get_cycles_used(), 800);
test_sub_cycles_fn2(1, context.clone());
assert_eq!(context.get_cycles_used(), 1000);
} | rust_cleaned_test_functions.jsonl/11474 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 503
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68970,
368,
341,
262,
2036,
20150,
401,
262,
11506,
7936,
921,
262,
11605,
20150,
341,
286,
11506,
48421,
7,
16,
15,
15,
5563,
286,
5168,
1273,
68970,
2099,
721,
11,
5635,
25,
5362,
1972,
8,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_em_to_px() {
let doc_text = br#" <html> <p>cool</p> </html> "#;
let css_text = br#"
* {
color: inherit;
}
html {
color: black;
margin: 1em;
}
p {
color: black;
margin: 1em;
}
"#;
let (doc,sss,stree,lbox, rbox) = standard_test_run(doc_text, css_text).unwrap();
let snode = stree.root.borrow();
println!("doc={:#?} snode={:#?}",doc,snode);
//check html element
assert_eq!(snode.specified_values.get("margin-left").unwrap(), &Length(1.0,Unit::Em));
} | rust_cleaned_test_functions.jsonl/101339 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 332
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22504,
2346,
67162,
368,
341,
262,
1077,
4629,
4326,
284,
1411,
55543,
366,
1551,
29,
366,
79,
29,
42196,
522,
79,
29,
690,
1551,
29,
5869,
280,
262,
1077,
15877,
4326,
284,
1411,
2,
698,
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_pss_padding_verify() {
test::run(
test_file!("rsa_pss_padding_tests.txt"),
|section, test_case| {
assert_eq!(section, "");
let digest_name = test_case.consume_string("Digest");
let alg = match digest_name.as_ref() {
"SHA256" => &RSA_PSS_SHA256,
"SHA384" => &RSA_PSS_SHA384,
"SHA512" => &RSA_PSS_SHA512,
_ => panic!("Unsupported digest: {}", digest_name),
};
let msg = test_case.consume_bytes("Msg");
let msg = untrusted::Input::from(&msg);
let m_hash = digest::digest(alg.digest_alg(), msg.as_slice_less_safe());
let encoded = test_case.consume_bytes("EM");
let encoded = untrusted::Input::from(&encoded);
// Salt is recomputed in verification algorithm.
let _ = test_case.consume_bytes("Salt");
let bit_len = test_case.consume_usize_bits("Len");
let is_valid = test_case.consume_string("Result") == "P";
let actual_result =
encoded.read_all(error::Unspecified, |m| alg.verify(&m_hash, m, bit_len));
assert_eq!(actual_result.is_ok(), is_valid);
Ok(())
},
);
} | rust_cleaned_test_functions.jsonl/954 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 768
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
778,
40726,
35638,
368,
341,
286,
1273,
486,
6108,
1006,
310,
1273,
2458,
17223,
60869,
620,
778,
40726,
32509,
3909,
4461,
310,
760,
2809,
11,
1273,
19096,
91,
341,
394,
2060,
10714,
10297,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_qualify_path_associated_item() {
check_assist(
add_missing_impl_members,
r#"
mod foo {
pub struct Bar<T>;
impl Bar<T> { type Assoc = u32; }
trait Foo { fn foo(&self, bar: Bar<u32>::Assoc); }
}
struct S;
impl foo::Foo for S { <|> }"#,
r#"
mod foo {
pub struct Bar<T>;
impl Bar<T> { type Assoc = u32; }
trait Foo { fn foo(&self, bar: Bar<u32>::Assoc); }
}
struct S;
impl foo::Foo for S {
fn foo(&self, bar: foo::Bar<u32>::Assoc) {
${0:todo!()}
}
}"#,
);
} | rust_cleaned_test_functions.jsonl/110447 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 300
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64391,
1437,
2638,
58665,
657,
5634,
368,
341,
286,
1779,
12083,
380,
1006,
310,
912,
40447,
21007,
30397,
345,
310,
435,
2,
698,
2593,
15229,
341,
262,
6675,
2036,
4716,
3125,
10133,
262,
11605,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_files_dont_match() {
let files_to_test = vec![
(("foo.rs", 1, 10), ("foo1.rs", 5, 12)),
(("bar.rs", 1, 10), ("baz.rs", 5, 12)),
(("bar.rs", 1, 10), ("bar.js", 5, 12)),
(("foo/bar/baz.rs", 1, 10), ("/foo/bar/baz.rs", 5, 12)),
(("foo\\\\bar\\baz.rs", 1, 10), ("foo/bar/baz.rs", 9, 12)),
(("foo/1.rs", 1, 10), ("foo/2.rs", 5, 12)),
];
assert_no_files_match(files_to_test);
} | rust_cleaned_test_functions.jsonl/28049 | {
"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,
10931,
814,
544,
10708,
368,
341,
286,
1077,
3542,
2346,
4452,
284,
7486,
90515,
310,
89101,
7975,
25638,
497,
220,
16,
11,
220,
16,
15,
701,
3489,
7975,
16,
25638,
497,
220,
20,
11,
220,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_inspect_log_nested() {
let (inspector, mut node) = inspector_and_list_node();
inspect_log!(node, {
k1: {
sub1: "subval1",
sub2: {
subsub1: "subsubval1",
},
sub3: 3u64,
},
k2: if true { 10u64 } else { 20 }
});
assert_data_tree!(inspector, root: {
list_node: {
"0": {
"@time": AnyProperty,
k1: {
sub1: "subval1",
sub2: {
subsub1: "subsubval1",
},
sub3: 3u64,
},
k2: 10u64
}
}
});
} | rust_cleaned_test_functions.jsonl/96857 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 597
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34386,
987,
5224,
66279,
368,
341,
286,
1077,
320,
1330,
18997,
11,
5206,
2436,
8,
284,
44725,
8378,
2019,
5084,
543,
286,
24085,
5224,
10297,
3509,
11,
341,
310,
595,
16,
25,
341,
394,
1186,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_inv_mod_xn() {
type F = GoldilocksField;
let mut rng = thread_rng();
let a_deg = rng.gen_range(0..1_000);
let n = rng.gen_range(1..1_000);
let mut a = PolynomialCoeffs::new(F::rand_vec(a_deg + 1));
if a.coeffs[0].is_zero() {
a.coeffs[0] = F::ONE; // First coefficient needs to be nonzero.
}
let b = a.inv_mod_xn(n);
let mut m = &a * &b;
m.coeffs.truncate(n);
m.trim();
assert_eq!(
m,
PolynomialCoeffs::new(vec![F::ONE]),
"a: {:#?}, b:{:#?}, n:{:#?}, m:{:#?}",
a,
b,
n,
m
);
} | rust_cleaned_test_functions.jsonl/15042 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 438
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19996,
7480,
3212,
77,
368,
341,
286,
943,
434,
284,
7421,
321,
25183,
1877,
280,
286,
1077,
5206,
28422,
284,
4516,
66849,
543,
286,
1077,
264,
46057,
284,
28422,
22822,
9698,
7,
15,
496,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_position_read_after_skip() -> crate::Result<()> {
let position_deltas: Vec<u32> = (0..1_000).collect();
let positions_data = create_positions_data(&position_deltas[..])?;
assert_eq!(positions_data.len(), 1224);
let mut position_reader = PositionReader::open(positions_data)?;
let mut buf = [0u32; 7];
let mut c = 0;
let mut offset = 0;
for _ in 0..100 {
position_reader.read(offset, &mut buf);
position_reader.read(offset, &mut buf);
offset += 7;
for &el in &buf {
assert_eq!(c, el);
c += 1;
}
}
Ok(())
} | rust_cleaned_test_functions.jsonl/110173 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 366
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9661,
6443,
19844,
44830,
368,
1464,
17717,
486,
2077,
71698,
341,
286,
1077,
2309,
814,
71906,
25,
11312,
34837,
18,
17,
29,
284,
320,
15,
496,
16,
62,
15,
15,
15,
568,
17384,
543,
286,
1077,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_new_verify() {
let request = new("ns.example.com", 512).expect("error converting to http");
assert!(verify("ns.example.com", &request).is_ok());
} | rust_cleaned_test_functions.jsonl/29286 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 81
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
35638,
368,
341,
286,
1077,
1681,
284,
501,
445,
4412,
7724,
905,
497,
220,
20,
16,
17,
568,
17119,
445,
841,
33437,
311,
1758,
797,
286,
2060,
10297,
12446,
445,
4412,
7724,
905,
497,
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 |
#[test]
fn test_cursor_left_on_selection() {
let (mut ime, statechan, _actionchan) = set_up("abcdefghi", 1, 5);
simulate_keypress(&mut ime, HID_USAGE_KEY_RIGHT, true, true); // right with shift
let state = statechan.try_recv().unwrap();
assert_eq!(2, state.revision);
assert_eq!(1, state.selection.base);
assert_eq!(6, state.selection.extent);
simulate_keypress(&mut ime, HID_USAGE_KEY_LEFT, true, false);
let state = statechan.try_recv().unwrap();
assert_eq!(3, state.revision);
assert_eq!(1, state.selection.base);
assert_eq!(1, state.selection.extent);
simulate_keypress(&mut ime, HID_USAGE_KEY_LEFT, true, false);
let state = statechan.try_recv().unwrap();
assert_eq!(4, state.revision);
assert_eq!(0, state.selection.base);
assert_eq!(0, state.selection.extent);
simulate_keypress(&mut ime, HID_USAGE_KEY_LEFT, true, false);
let state = statechan.try_recv().unwrap();
assert_eq!(5, state.revision);
assert_eq!(0, state.selection.base);
assert_eq!(0, state.selection.extent);
} | rust_cleaned_test_functions.jsonl/54276 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 536
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28601,
9579,
4470,
23672,
368,
341,
286,
1077,
320,
6984,
74434,
11,
1584,
5658,
11,
716,
1311,
5658,
8,
284,
738,
8237,
445,
56747,
72,
497,
220,
16,
11,
220,
20,
626,
286,
37453,
3097,
1873,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_force_transfer() {
new_test_ext().execute_with(|| {
Pallet::<Test>::force_transfer(
Origin::root(),
ASSET_ID,
FROM_ACCOUNT,
TO_ACCOUNT,
TRANSFER_AMOUNT,
true,
)
.expect("force_transfer should work");
assert_eq!(
Pallet::<Test>::total_balance(ASSET_ID, &FROM_ACCOUNT),
INIT_AMOUNT - TRANSFER_AMOUNT
);
assert_eq!(
Pallet::<Test>::total_balance(ASSET_ID, &TO_ACCOUNT),
INIT_AMOUNT + TRANSFER_AMOUNT
);
});
} | rust_cleaned_test_functions.jsonl/9168 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 229
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40739,
35403,
368,
341,
8638,
4452,
9927,
1005,
10257,
6615,
79453,
341,
197,
10025,
7464,
27638,
2271,
6831,
8833,
35403,
1006,
298,
197,
13298,
486,
2888,
3148,
298,
197,
1911,
5884,
3450,
345,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_wildcard_precedence() {
assert!(rune! { bool =>
mod a { pub struct Foo; }
mod b { pub struct Foo; }
use {a::*, b::*};
use b::Foo;
pub fn main() { Foo is b::Foo }
});
assert!(rune! { bool =>
mod a { pub struct Foo; }
mod b { pub struct Foo; }
use {b::*, a::*};
use a::Foo;
pub fn main() { Foo is a::Foo }
});
assert!(rune! { bool =>
mod a { pub struct Foo; }
mod b { pub struct Foo; }
use a::*;
use b::*;
use a::Foo;
pub fn main() { Foo is a::Foo }
});
assert!(rune! { bool =>
mod a { pub struct Foo; }
mod b { pub struct Foo; }
use a::Foo;
use a::*;
use b::*;
pub fn main() { Foo is a::Foo }
});
} | rust_cleaned_test_functions.jsonl/54727 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 446
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1670,
695,
4951,
10442,
1998,
763,
368,
341,
262,
2060,
10297,
81,
2886,
0,
314,
1807,
6274,
286,
1463,
264,
314,
6675,
2036,
33428,
26,
456,
286,
1463,
293,
314,
6675,
2036,
33428,
26,
456,
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_block_qc() {
// Verify that it's impossible to create a block with QC that doesn't point to a parent.
let signer = ValidatorSigner::random(None);
// Test genesis and the next block
let genesis_block = Block::make_genesis_block();
let genesis_qc = QuorumCert::certificate_for_genesis();
let payload = 42;
let a1 = Block::make_block(
&genesis_block,
payload,
1,
get_current_timestamp().as_micros() as u64,
genesis_qc.clone(),
&signer,
);
let a1_qc = placeholder_certificate_for_block(
vec![&signer],
a1.id(),
a1.round(),
a1.quorum_cert().certified_block_id(),
a1.quorum_cert().certified_block_round(),
a1.quorum_cert().certified_parent_block_id(),
a1.quorum_cert().certified_parent_block_round(),
);
let result = panic::catch_unwind(|| {
// should panic because qc does not point to parent
Block::make_block(
&a1,
payload,
2,
get_current_timestamp().as_micros() as u64,
genesis_qc.clone(),
&signer,
);
});
assert!(result.is_err());
let a2 = Block::make_block(
&a1,
payload,
2,
get_current_timestamp().as_micros() as u64,
a1_qc.clone(),
&signer,
);
assert_eq!(a2.height(), 2);
} | rust_cleaned_test_functions.jsonl/544 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 696
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7113,
8976,
66,
368,
341,
262,
442,
25429,
429,
432,
594,
11997,
311,
1855,
264,
2504,
448,
42607,
429,
3171,
944,
1459,
311,
264,
2681,
624,
262,
1077,
70039,
284,
32566,
7264,
261,
486,
11463,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_extract_struct_only_copies_needed_generics() {
check_assist(
extract_struct_from_enum_variant,
r#"
enum X<'a, 'b, 'x> {
$0A { a: &'a &'x mut () },
B { b: &'b () },
C { c: () },
}
"#,
r#"
struct A<'a, 'x>{ a: &'a &'x mut () }
enum X<'a, 'b, 'x> {
A(A<'a, 'x>),
B { b: &'b () },
C { c: () },
}
"#,
);
} | rust_cleaned_test_functions.jsonl/36318 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 253
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
15126,
18410,
666,
75541,
57426,
71963,
1211,
368,
341,
286,
1779,
12083,
380,
1006,
310,
8649,
15126,
5673,
31054,
46112,
345,
310,
435,
2,
698,
9018,
1599,
18291,
64,
11,
364,
65,
11,
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_set_wait() {
let (input, modification) = Modification::parse(argv!["wait:2d"]).unwrap();
assert_eq!(input.len(), 0);
assert_eq!(
modification,
Modification {
wait: Some(Some(*NOW + chrono::Duration::days(2))),
..Default::default()
}
);
} | rust_cleaned_test_functions.jsonl/28812 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 195
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
18760,
368,
341,
286,
1077,
320,
1355,
11,
17030,
8,
284,
73855,
486,
6400,
15329,
0,
1183,
11489,
25,
17,
67,
45014,
15454,
543,
286,
2060,
10714,
10297,
1355,
19406,
1507,
220,
15,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_storage_class_parse() {
let cases: [(&str, StorageClass, &str); 6] = [
("EC:3", StorageClass { parity: 3 }, ""),
("EC:4", StorageClass { parity: 4 }, ""),
(
"AB:4",
StorageClass { parity: 4 },
"supported scheme is 'EC', but not 'AB'",
),
(
"EC:4:5",
StorageClass { parity: 4 },
"too many sections in 'EC:4:5'",
),
("EC:A", StorageClass { parity: 4 }, "invalid parity 'A'"),
("AB", StorageClass { parity: 4 }, "too few sections in 'AB'"),
];
for (storage_class_env, want_sc, expected_error) in cases.iter() {
let result = parse_storage_class(storage_class_env);
match result {
Ok(result) => {
assert_eq!(result.parity, want_sc.parity);
assert_eq!("", *expected_error);
}
Err(err) => assert_eq!(err.to_string(), *expected_error),
}
}
} | rust_cleaned_test_functions.jsonl/44021 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 613
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23310,
4790,
21039,
368,
341,
286,
1077,
5048,
25,
508,
2099,
495,
11,
14693,
1957,
11,
609,
495,
1215,
220,
21,
60,
284,
2278,
310,
3489,
7498,
25,
18,
497,
14693,
1957,
314,
49615,
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... | 3 |
#[test]
fn test_ivar() {
let cls = test_utils::custom_class();
let ivar = cls.instance_variable("_foo").unwrap();
assert_eq!(ivar.name(), "_foo");
assert!(<u32>::ENCODING.equivalent_to_str(ivar.type_encoding()));
assert!(ivar.offset() > 0);
#[cfg(feature = "malloc")]
assert!(cls.instance_variables().len() > 0);
} | rust_cleaned_test_functions.jsonl/7122 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 187
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51411,
277,
368,
341,
286,
1077,
12790,
284,
1273,
17309,
486,
9163,
4790,
543,
286,
1077,
17509,
277,
284,
12790,
13066,
14635,
16975,
7975,
1827,
15454,
543,
286,
2060,
10714,
10297,
56398,
2644,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_expression_eval() {
let mut ctx = EvalContext::new(Arc::new(EvalConfig::default_for_test()));
let cases = vec![
(
ScalarFuncSig::CastStringAsReal,
vec![Datum::Bytes(b"123".to_vec())],
Datum::F64(123f64),
),
(
ScalarFuncSig::CastStringAsDecimal,
vec![Datum::Bytes(b"123".to_vec())],
Datum::Dec(Decimal::from(123)),
),
(
ScalarFuncSig::CastStringAsDuration,
vec![Datum::Bytes(b"12:02:03".to_vec())],
Datum::Dur(Duration::parse(b"12:02:03", 0).unwrap()),
),
(
ScalarFuncSig::CastStringAsTime,
vec![Datum::Bytes(b"2012-12-12 14:00:05".to_vec())],
Datum::Time(Time::parse_utc_datetime("2012-12-12 14:00:05", 0).unwrap()),
),
(
ScalarFuncSig::CastStringAsString,
vec![Datum::Bytes(b"134".to_vec())],
Datum::Bytes(b"134".to_vec()),
),
(
ScalarFuncSig::CastIntAsJson,
vec![Datum::I64(12)],
Datum::Json(Json::I64(12)),
),
];
for (sig, cols, exp) in cases {
let mut col_expr = col_expr(0);
col_expr
.mut_field_type()
.set_charset(charset::CHARSET_UTF8.to_owned());
let mut ex = scalar_func_expr(sig, &[col_expr]);
ex.mut_field_type()
.set_decimal(convert::UNSPECIFIED_LENGTH as i32);
ex.mut_field_type()
.set_flen(convert::UNSPECIFIED_LENGTH as i32);
let e = Expression::build(&mut ctx, ex).unwrap();
let res = e.eval(&mut ctx, &cols).unwrap();
if let Datum::F64(_) = exp {
assert_eq!(format!("{}", res), format!("{}", exp));
} else {
assert_eq!(res, exp);
}
}
// cases for integer
let cases = vec![
(
Some(types::UNSIGNED_FLAG),
vec![Datum::U64(u64::MAX)],
Datum::U64(u64::MAX),
),
(None, vec![Datum::I64(i64::MIN)], Datum::I64(i64::MIN)),
(None, vec![Datum::Null], Datum::Null),
];
for (flag, cols, exp) in cases {
let col_expr = col_expr(0);
let mut ex = scalar_func_expr(ScalarFuncSig::CastIntAsInt, &[col_expr]);
if flag.is_some() {
ex.mut_field_type().set_flag(flag.unwrap() as u32);
}
let e = Expression::build(&mut ctx, ex).unwrap();
let res = e.eval(&mut ctx, &cols).unwrap();
assert_eq!(res, exp);
}
} | rust_cleaned_test_functions.jsonl/6054 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1714
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28068,
21296,
368,
341,
286,
1077,
5206,
5635,
284,
58239,
1972,
486,
931,
4346,
1287,
486,
931,
10722,
831,
2648,
486,
2258,
5478,
4452,
7392,
286,
1077,
5048,
284,
7486,
90515,
310,
2399,
394,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_empty_password() {
let value = HeaderValue::from_static("Basic QWxhZGRpbjo=");
let scheme = Basic::parse(&value);
assert!(scheme.is_ok());
let scheme = scheme.unwrap();
assert_eq!(scheme.username, "Aladdin");
assert_eq!(scheme.password, None);
} | rust_cleaned_test_functions.jsonl/75151 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 146
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
10122,
368,
341,
286,
1077,
897,
284,
12104,
1130,
486,
1499,
25360,
445,
15944,
1207,
54,
87,
71,
57,
8626,
16650,
7305,
45219,
286,
1077,
12859,
284,
14625,
486,
6400,
2099,
957,
626,
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_var_key_syntax() {
let some_key = "foo".to_string();
let another_key = "bar".to_string();
let result = hierarchy! {
var some_key: {
var another_key: "baz",
}
};
assert_data_tree!(result, foo: {
bar: "baz",
});
} | rust_cleaned_test_functions.jsonl/45834 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 193
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4612,
3097,
78894,
368,
341,
286,
1077,
1045,
3097,
284,
330,
7975,
3263,
983,
3904,
543,
286,
1077,
2441,
3097,
284,
330,
2257,
3263,
983,
3904,
543,
286,
1077,
1102,
284,
28922,
0,
341,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_many_targets() {
let p = project()
.file(
"src/bin/a.rs",
r#"
fn main() {}
#[test] fn bin_a() {}
"#,
)
.file(
"src/bin/b.rs",
r#"
fn main() {}
#[test] fn bin_b() {}
"#,
)
.file(
"src/bin/c.rs",
r#"
fn main() {}
#[test] fn bin_c() { panic!(); }
"#,
)
.file(
"examples/a.rs",
r#"
fn main() {}
#[test] fn example_a() {}
"#,
)
.file(
"examples/b.rs",
r#"
fn main() {}
#[test] fn example_b() {}
"#,
)
.file("examples/c.rs", "#[test] fn example_c() { panic!(); }")
.file("tests/a.rs", "#[test] fn test_a() {}")
.file("tests/b.rs", "#[test] fn test_b() {}")
.file("tests/c.rs", "does not compile")
.build();
p.cargo("test --verbose --bin a --bin b --example a --example b --test a --test b")
.with_stdout_contains("test bin_a ... ok")
.with_stdout_contains("test bin_b ... ok")
.with_stdout_contains("test test_a ... ok")
.with_stdout_contains("test test_b ... ok")
.with_stderr_contains("[RUNNING] `rustc --crate-name a examples/a.rs [..]`")
.with_stderr_contains("[RUNNING] `rustc --crate-name b examples/b.rs [..]`")
.run();
} | rust_cleaned_test_functions.jsonl/95375 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 899
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22101,
41997,
368,
341,
262,
1077,
281,
284,
2390,
741,
286,
659,
1192,
1006,
310,
330,
3548,
8749,
14186,
25638,
756,
310,
435,
2,
698,
310,
5168,
1887,
368,
5613,
310,
11506,
1944,
60,
5168,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tag_no_case() {
init();
let input = "AbC".chars().collect::<Vec<char>>();
let p = tag_no_case("abc");
let r = p.parse_as_result(&input).unwrap();
assert_eq!(r, "abc");
} | rust_cleaned_test_functions.jsonl/16794 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9372,
6536,
19096,
368,
341,
262,
2930,
543,
262,
1077,
1946,
284,
330,
5830,
34,
3263,
19255,
1005,
17384,
27638,
10050,
21919,
37038,
262,
1077,
281,
284,
4772,
6536,
19096,
445,
13683,
3071,
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_projective_to_affine() {
let a = G2Projective::generator();
let b = G2Projective::identity();
assert!(bool::from(G2Affine::from(a).is_on_curve()));
assert!(!bool::from(G2Affine::from(a).is_identity()));
assert!(bool::from(G2Affine::from(b).is_on_curve()));
assert!(bool::from(G2Affine::from(b).is_identity()));
let z = Fp2 {
c0: Fp::from_raw_unchecked([
0xba7a_fa1f_9a6f_e250,
0xfa0f_5b59_5eaf_e731,
0x3bdc_4776_94c3_06e7,
0x2149_be4b_3949_fa24,
0x64aa_6e06_49b2_078c,
0x12b1_08ac_3364_3c3e,
]),
c1: Fp::from_raw_unchecked([
0x1253_25df_3d35_b5a8,
0xdc46_9ef5_555d_7fe3,
0x02d7_16d2_4431_06a9,
0x05a1_db59_a6ff_37d0,
0x7cf7_784e_5300_bb8f,
0x16a8_8922_c7a5_e844,
]),
};
let c = G2Projective {
x: a.x * z,
y: a.y * z,
z,
};
assert_eq!(G2Affine::from(c), G2Affine::generator());
} | rust_cleaned_test_functions.jsonl/47801 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 674
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16352,
533,
2346,
48914,
482,
368,
341,
262,
1077,
264,
284,
479,
17,
7849,
533,
486,
35851,
543,
262,
1077,
293,
284,
479,
17,
7849,
533,
486,
16912,
1428,
262,
2060,
10297,
2641,
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_byte_stream() {
use serde_bytes;
let small: [u8; 16] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
assert_eq!(
to_string(&small).unwrap(),
"(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15)"
);
let large = vec![255u8; 64];
let large = serde_bytes::Bytes::new(&large);
assert_eq!(
to_string(&large).unwrap(),
concat!(
"\"/////////////////////////////////////////",
"////////////////////////////////////////////w==\""
)
);
} | rust_cleaned_test_functions.jsonl/2826 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 337
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19737,
12673,
368,
341,
286,
990,
61570,
12524,
401,
286,
1077,
2613,
25,
508,
84,
23,
26,
220,
16,
21,
60,
284,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
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_gridspace_from_char() {
assert_eq!(GridSpace::from('.'), GridSpace::Open);
assert_eq!(GridSpace::from('#'), GridSpace::Tree);
} | rust_cleaned_test_functions.jsonl/59364 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 78
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15682,
3365,
1306,
5673,
9232,
368,
341,
286,
2060,
10714,
10297,
3543,
9914,
486,
1499,
87433,
701,
10587,
9914,
486,
5002,
317,
286,
2060,
10714,
10297,
3543,
9914,
486,
1499,
3515,
4567,
10587,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_partial_parses() {
// parsing a part of the buffer should always result in errors and
// nothing panics.
for buff in ALL_BUFFERS.iter() {
for i in 0..buff.len() {
let partial_buff = &mut &buff[0..i];
let packet = partial_buff.parse_with::<_, IgmpPacket<_>>(());
assert_eq!(packet.is_err(), true)
}
}
} | rust_cleaned_test_functions.jsonl/11285 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 223
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
52068,
77113,
288,
368,
341,
286,
442,
22314,
264,
949,
315,
279,
4147,
1265,
2677,
1102,
304,
5975,
323,
198,
286,
442,
4302,
7215,
1211,
624,
286,
369,
11522,
304,
13097,
62128,
4321,
19471,
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... | 3 |
#[test]
fn test_map_iter_mut() {
let key_val_tuples = vec![
("h", 8),
("d", 4),
("b", 2),
("e", 5),
("f", 6),
("a", 1),
("g", 7),
("c", 3),
];
let mut sgm = SgMap::<_, _, 8>::from_iter(key_val_tuples.into_iter());
assert_eq!(sgm.len(), 8);
assert_eq!(sgm.first_key_value(), Some((&"a", &1)));
assert_eq!(sgm.last_key_value(), Some((&"h", &8)));
for (key, val) in sgm.iter_mut() {
if (key != &"a") && (key != &"f") {
*val += 10;
}
}
assert_eq!(sgm.len(), 8);
assert_eq!(sgm.first_key_value(), Some((&"a", &1)));
assert_eq!(sgm.last_key_value(), Some((&"h", &18)));
assert_eq!(
sgm.into_iter().collect::<Vec<(&str, usize)>>(),
vec![
("a", 1),
("b", 12),
("c", 13),
("d", 14),
("e", 15),
("f", 6),
("g", 17),
("h", 18),
],
);
} | rust_cleaned_test_functions.jsonl/18649 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 601
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5376,
11723,
29523,
368,
341,
262,
1077,
1376,
6189,
89269,
284,
7486,
90515,
286,
3489,
71,
497,
220,
23,
1326,
286,
3489,
67,
497,
220,
19,
1326,
286,
3489,
65,
497,
220,
17,
1326,
286,
3489... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_add_or_update_edges_add_nodes_error() {
// test edge addition with MissingNodeStrategy::Error
let graph = get_basic_graph(None);
let new_edges = vec![Edge::with_weight("n4", "n5", &4.4)];
let graph = graph.add_or_update_edges(new_edges);
assert!(graph.is_err());
} | rust_cleaned_test_functions.jsonl/100464 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
8734,
8882,
28026,
2891,
14896,
4096,
368,
341,
286,
442,
1273,
6821,
5256,
448,
35264,
1955,
19816,
486,
1454,
198,
286,
1077,
4771,
284,
633,
34729,
14738,
26717,
626,
286,
1077,
501,
2802... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_recovery() {
use std::cmp::Ordering;
#[derive(Debug)]
struct Foo(&'static str, i32);
impl PartialEq for Foo {
fn eq(&self, other: &Self) -> bool {
self.0 == other.0
}
}
impl Eq for Foo {}
impl PartialOrd for Foo {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
self.0.partial_cmp(&other.0)
}
}
impl Ord for Foo {
fn cmp(&self, other: &Self) -> Ordering {
self.0.cmp(&other.0)
}
}
let mut s = BTreeSet::new();
assert_eq!(s.replace(Foo("a", 1)), None);
assert_eq!(s.len(), 1);
assert_eq!(s.replace(Foo("a", 2)), Some(Foo("a", 1)));
assert_eq!(s.len(), 1);
{
let mut it = s.iter();
assert_eq!(it.next(), Some(&Foo("a", 2)));
assert_eq!(it.next(), None);
}
assert_eq!(s.get(&Foo("a", 1)), Some(&Foo("a", 2)));
assert_eq!(s.take(&Foo("a", 1)), Some(Foo("a", 2)));
assert_eq!(s.len(), 0);
assert_eq!(s.get(&Foo("a", 1)), None);
assert_eq!(s.take(&Foo("a", 1)), None);
assert_eq!(s.iter().next(), None);
} | rust_cleaned_test_functions.jsonl/4418 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 580
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
91475,
368,
341,
262,
990,
1460,
486,
7293,
486,
4431,
287,
401,
262,
11506,
27098,
42618,
5563,
262,
2036,
33428,
2099,
6,
1978,
607,
11,
600,
18,
17,
626,
262,
11605,
55039,
369,
33428,
341,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_notify() {
let authority = create_example();
let mut catalog = Catalog::new();
catalog.upsert(authority.origin().clone(), Box::new(authority));
let mut io_loop = Runtime::new().unwrap();
let (stream, sender) = TestClientStream::new(Arc::new(Mutex::new(catalog)));
let (bg, mut client) = ClientFuture::new(stream, Box::new(sender), None);
io_loop.spawn(bg);
let name = Name::from_str("ping.example.com").unwrap();
let message = io_loop.block_on(client.notify(
name.clone(),
DNSClass::IN,
RecordType::A,
None::<RecordSet>,
));
assert!(message.is_ok());
let message = message.unwrap();
assert_eq!(
message.response_code(),
ResponseCode::NotImp,
"the catalog must support Notify now, update this"
);
} | rust_cleaned_test_functions.jsonl/33935 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 339
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36654,
368,
341,
262,
1077,
11198,
284,
1855,
39304,
543,
262,
1077,
5206,
16403,
284,
31221,
486,
931,
543,
262,
16403,
17652,
6047,
48269,
487,
20248,
1005,
19982,
1507,
8261,
486,
931,
48269,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bytewise_should_preserve_final_newline_when_line_longer_than_fold() {
new_ucmd!()
.args(&["-w2", "-b"])
.pipe_in("1234\n")
.succeeds()
.stdout_is("12\n34\n");
} | rust_cleaned_test_functions.jsonl/23306 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3710,
83,
24350,
43378,
32116,
5852,
20676,
5921,
1056,
47636,
6528,
17799,
261,
51613,
61187,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
12,
86,
17,
497,
6523,
65,
141... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rejoins_then_rejects_giant_certs() {
let mut hj = HandshakeJoiner::new();
let msg = Message {
typ: ContentType::Handshake,
version: ProtocolVersion::TLSv1_2,
payload: MessagePayload::new_opaque(b"\x0b\x01\x00\x04\x01\x00\x01\x00\xff\xfe".to_vec()),
};
assert_eq!(hj.want_message(&msg), true);
assert_eq!(hj.take_message(msg), Some(0));
assert_eq!(hj.is_empty(), false);
for _i in 0..8191 {
let msg = Message {
typ: ContentType::Handshake,
version: ProtocolVersion::TLSv1_2,
payload: MessagePayload::new_opaque(b"\x01\x02\x03\x04\x05\x06\x07\x08".to_vec()),
};
assert_eq!(hj.want_message(&msg), true);
assert_eq!(hj.take_message(msg), Some(0));
assert_eq!(hj.is_empty(), false);
}
// final 6 bytes
let msg = Message {
typ: ContentType::Handshake,
version: ProtocolVersion::TLSv1_2,
payload: MessagePayload::new_opaque(b"\x01\x02\x03\x04\x05\x06".to_vec()),
};
assert_eq!(hj.want_message(&msg), true);
assert_eq!(hj.take_message(msg), None);
} | rust_cleaned_test_functions.jsonl/130167 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 681
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
7305,
1330,
68367,
1288,
583,
82,
1889,
5372,
666,
15546,
368,
341,
286,
1077,
5206,
35588,
284,
8536,
29661,
12292,
261,
486,
931,
543,
286,
1077,
3750,
284,
4856,
341,
310,
3582,
25,
704... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_local_affine_ins2() {
let x = b"ACGTATCATAGATAGATAGGGTTGTGTAGATGATCCACAG";
let y = b"CGTATCATAGATAGATGTAGATGATCCACAGT";
let score = |a: u8, b: u8| if a == b { 1i32 } else { -1i32 };
let mut aligner = banded::Aligner::with_capacity(x.len(), y.len(), -5, -1, &score, 10, 10);
let alignment = aligner.local(x, y);
assert_eq!(alignment.xstart, 1);
assert_eq!(alignment.ystart, 0);
} | rust_cleaned_test_functions.jsonl/126744 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 240
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13564,
48914,
482,
34386,
17,
368,
341,
286,
1077,
856,
284,
293,
1,
1706,
25388,
828,
28196,
1890,
828,
1890,
828,
1890,
22254,
14903,
25388,
25388,
1890,
828,
38,
828,
3706,
1706,
1890,
876,
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_doc_passthru() {
let hdr = indoc! {"
#include <cstdint>
/// Elephants!
struct A {
uint32_t a;
};
/// Giraffes!
struct B {
uint32_t a;
};
/// Rhinos!
inline uint32_t get_a() { return 3; }
"};
let rs = quote! {};
run_test_ex(
"",
hdr,
rs,
directives_from_lists(&["A", "get_a"], &["B"], None),
None,
Some(make_string_finder(
["Giraffes", "Elephants", "Rhinos"].to_vec(),
)),
None,
);
} | rust_cleaned_test_functions.jsonl/9907 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 355
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18869,
79578,
30077,
2672,
368,
341,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
286,
671,
997,
366,
96975,
397,
286,
1048,
25949,
52567,
4894,
286,
2036,
362,
341,
310,
2622,
18,
17,
528,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_error() {
assert_eq!(
CellErrorType::from_str("#DIV/0!").unwrap(),
CellErrorType::Div0
);
assert_eq!(CellErrorType::from_str("#N/A").unwrap(), CellErrorType::NA);
assert_eq!(
CellErrorType::from_str("#NAME?").unwrap(),
CellErrorType::Name
);
assert_eq!(
CellErrorType::from_str("#NULL!").unwrap(),
CellErrorType::Null
);
assert_eq!(
CellErrorType::from_str("#NUM!").unwrap(),
CellErrorType::Num
);
assert_eq!(
CellErrorType::from_str("#REF!").unwrap(),
CellErrorType::Ref
);
assert_eq!(
CellErrorType::from_str("#VALUE!").unwrap(),
CellErrorType::Value
);
} | rust_cleaned_test_functions.jsonl/71171 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 355
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
4096,
368,
341,
262,
2060,
10714,
33673,
286,
13972,
1454,
929,
486,
1499,
2895,
3584,
38827,
14,
15,
0,
1827,
15454,
3148,
286,
13972,
1454,
929,
486,
12509,
15,
198,
262,
1439,
262,
206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rfind() {
assert_eq!("hello".rfind('l'), Some(3u));
assert_eq!("hello".rfind(|&: c:char| c == 'o'), Some(4u));
assert!("hello".rfind('x').is_none());
assert!("hello".rfind(|&: c:char| c == 'x').is_none());
assert_eq!("ประเทศไทย中华Việt Nam".rfind('华'), Some(30u));
assert_eq!("ประเทศไทย中华Việt Nam".rfind(|&: c: char| c == '华'), Some(30u));
} | rust_cleaned_test_functions.jsonl/2420 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 251
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
3903,
368,
341,
286,
2060,
10714,
17223,
14990,
3263,
81,
3903,
492,
75,
4567,
4329,
7,
18,
84,
1106,
286,
2060,
10714,
17223,
14990,
3263,
81,
3903,
22428,
5,
25,
272,
25,
1762,
91,
272... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_creating_transaction_is_not_validator() {
let mut testkit = create_testkit_with_validators(1);
let (pub_key, sec_key) = gen_keypair();
let tx = TxTime { time: Utc::now() }.sign(INSTANCE_ID, pub_key, &sec_key);
let block = testkit.create_block_with_transaction(tx);
assert_eq!(
*block[0].status().unwrap_err(),
ErrorMatch::from_fail(&Error::UnknownSender).for_service(INSTANCE_ID)
);
let snapshot = testkit.snapshot();
let schema = get_schema(&snapshot);
assert!(schema.time.get().is_none());
assert!(schema.validators_times.get(&pub_key).is_none());
} | rust_cleaned_test_functions.jsonl/127516 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 263
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
72810,
28884,
6892,
7913,
64959,
368,
341,
262,
1077,
5206,
1273,
8226,
284,
1855,
4452,
8226,
6615,
8337,
2973,
7,
16,
626,
262,
1077,
320,
9585,
3097,
11,
5701,
3097,
8,
284,
4081,
3097,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_listen_syn_reject_ack() {
let s = socket_listen();
let tcp_repr = TcpRepr {
control: TcpControl::Syn,
seq_number: REMOTE_SEQ,
ack_number: Some(LOCAL_SEQ),
..SEND_TEMPL
};
assert!(!s.accepts(&SEND_IP_TEMPL, &tcp_repr));
assert_eq!(s.state, State::Listen);
} | rust_cleaned_test_functions.jsonl/1702 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 214
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
79286,
51393,
1288,
583,
48447,
368,
341,
286,
1077,
274,
284,
7575,
79286,
1428,
286,
1077,
28051,
68535,
284,
64876,
693,
649,
341,
310,
2524,
25,
64876,
3273,
486,
37134,
345,
310,
12981,
5500,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lookup_density_income() {
use super::geoip2::DensityIncome;
let _ = env_logger::try_init();
let filename = "test-data/test-data/GeoIP2-DensityIncome-Test.mmdb";
let reader = Reader::open_readfile(filename).unwrap();
let ip: IpAddr = FromStr::from_str("5.83.124.123").unwrap();
let density_income: DensityIncome = reader.lookup(ip).unwrap();
assert_eq!(density_income.average_income, Some(32323));
assert_eq!(density_income.population_density, Some(1232))
} | rust_cleaned_test_functions.jsonl/42015 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 205
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27464,
53349,
67377,
368,
341,
262,
990,
2256,
486,
13052,
573,
17,
486,
66719,
58898,
280,
262,
1077,
716,
284,
6105,
27413,
486,
1539,
6137,
1428,
262,
1077,
3899,
284,
330,
1944,
13945,
12697,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_df_udf_udt() {
let mut ctx = create_context();
ctx.register_scalar_function(Rc::new(STPointFunc {}));
let schema = Schema::new(vec![
Field::new("city", DataType::Utf8, false),
Field::new("lat", DataType::Float64, false),
Field::new("lng", DataType::Float64, false),
]);
let df = ctx
.load_csv("test/data/uk_cities.csv", &schema, false, None)
.unwrap();
// invoke custom code as a scalar UDF
let func_expr = ctx.udf(
"ST_Point",
vec![df.col("lat").unwrap(), df.col("lng").unwrap()],
DataType::Struct(vec![
Field::new("lat", DataType::Float64, false),
Field::new("lng", DataType::Float64, false),
]),
);
let df2 = df.select(vec![func_expr]).unwrap();
ctx.write_csv(df2, "./target/test_df_udf_udt.csv").unwrap();
let expected_result = read_file("test/data/expected/test_df_udf_udt.csv");
assert_eq!(expected_result, read_file("./target/test_df_udf_udt.csv"));
} | rust_cleaned_test_functions.jsonl/2509 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 578
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10894,
71939,
69,
71939,
83,
368,
341,
286,
1077,
5206,
5635,
284,
1855,
8467,
1428,
286,
5635,
9929,
41652,
9174,
2785,
66,
486,
931,
40650,
2609,
9626,
4687,
3237,
286,
1077,
10802,
284,
12539,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ldabsh() {
test_interpreter_and_jit_asm!(
"
ldabsh 0x3
exit",
[
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff,
],
(),
{ |_vm, res: Result| { res.unwrap() == 0x4433 } },
2
);
} | rust_cleaned_test_functions.jsonl/58970 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 232
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
50573,
370,
927,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
6228,
286,
26129,
370,
927,
220,
15,
87,
18,
198,
286,
4869,
756,
286,
2278,
310,
220,
15,
87,
15,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sources_get_script_version() {
let (sources, _) = setup();
let c = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap());
let tests = c.join("tests");
let specifier =
resolve_path(&tests.join("001_hello.js").to_string_lossy()).unwrap();
let actual = sources.get_script_version(&specifier);
assert!(actual.is_some());
} | rust_cleaned_test_functions.jsonl/14292 | {
"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,
52896,
3062,
14660,
9438,
368,
341,
262,
1077,
320,
39651,
11,
27439,
284,
6505,
543,
262,
1077,
272,
284,
7933,
15064,
486,
1499,
16978,
486,
947,
29387,
445,
34,
7581,
46,
25143,
91120,
8291,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_literal() {
assert_eq!(parse_literal("302 bacon"), Ok((" bacon", 302)));
assert_eq!(parse_literal("-32 fwef"), Ok((" fwef", -32)));
// overflow errors
assert!(parse_literal("10000000000 ohno").is_err());
assert_eq!(parse_literal("2897bacon"), Ok(("bacon", 2897)));
// nothing to parse
assert!(parse_literal("something 123 oh no").is_err());
// sign shenanigans are an error
assert!(parse_literal("+-123").is_err());
assert!(parse_literal("++123").is_err());
assert!(parse_literal("--123").is_err());
} | rust_cleaned_test_functions.jsonl/985 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 278
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34100,
368,
341,
286,
2060,
10714,
10297,
6400,
34100,
445,
18,
15,
17,
40352,
3975,
7622,
30873,
40352,
497,
220,
18,
15,
17,
4945,
286,
2060,
10714,
10297,
6400,
34100,
13645,
18,
17,
33886,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_key_derivation() {
// Test vectors from BOLT 3 Appendix E:
let secp_ctx = Secp256k1::new();
let base_secret = SecretKey::from_slice(&hex::decode("000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f").unwrap()[..]).unwrap();
let per_commitment_secret = SecretKey::from_slice(&hex::decode("1f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100").unwrap()[..]).unwrap();
let base_point = PublicKey::from_secret_key(&secp_ctx, &base_secret);
assert_eq!(base_point.serialize()[..], hex::decode("036d6caac248af96f6afa7f904f550253a0f3ef3f5aa2fe6838a95b216691468e2").unwrap()[..]);
let per_commitment_point = PublicKey::from_secret_key(&secp_ctx, &per_commitment_secret);
assert_eq!(per_commitment_point.serialize()[..], hex::decode("025f7117a78150fe2ef97db7cfc83bd57b2e2c0d0dd25eaf467a4a1c2a45ce1486").unwrap()[..]);
assert_eq!(chan_utils::derive_public_key(&secp_ctx, &per_commitment_point, &base_point).unwrap().serialize()[..],
hex::decode("0235f2dbfaa89b57ec7b055afe29849ef7ddfeb1cefdb9ebdc43f5494984db29e5").unwrap()[..]);
assert_eq!(chan_utils::derive_private_key(&secp_ctx, &per_commitment_point, &base_secret).unwrap(),
SecretKey::from_slice(&hex::decode("cbced912d3b21bf196a766651e436aff192362621ce317704ea2f75d87e7be0f").unwrap()[..]).unwrap());
assert_eq!(chan_utils::derive_public_revocation_key(&secp_ctx, &per_commitment_point, &base_point).unwrap().serialize()[..],
hex::decode("02916e326636d19c33f13e8c0c3a03dd157f332f3e99c317c141dd865eb01f8ff0").unwrap()[..]);
assert_eq!(chan_utils::derive_private_revocation_key(&secp_ctx, &per_commitment_secret, &base_secret).unwrap(),
SecretKey::from_slice(&hex::decode("d09ffff62ddb2297ab000cc85bcb4283fdeb6aa052affbc9dddcf33b61078110").unwrap()[..]).unwrap());
} | rust_cleaned_test_functions.jsonl/15104 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 816
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3097,
35345,
39127,
368,
341,
197,
197,
322,
3393,
22879,
504,
425,
35320,
220,
18,
64714,
468,
510,
197,
10217,
511,
4672,
15147,
284,
4520,
79,
17,
20,
21,
74,
16,
486,
931,
1428,
197,
10217... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_map_multithread() {
let result: Vec<usize> = Executor::multi_thread(3, "search-test")
.map(|i| Ok(i * 2), 0..10)
.unwrap();
assert_eq!(result.len(), 10);
for i in 0..10 {
assert_eq!(result[i], i * 2);
}
} | rust_cleaned_test_functions.jsonl/113305 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 169
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5376,
26290,
410,
878,
368,
341,
286,
1077,
1102,
25,
11312,
90244,
29,
284,
56032,
486,
26268,
10814,
7,
18,
11,
330,
1836,
16839,
1138,
310,
659,
2186,
22428,
72,
91,
7622,
1956,
353,
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... | 2 |
#[test]
fn test_boundary() {
::init_log();
debug!("Testing boundary (no split)");
let src = &mut TEST_VAL.as_bytes();
let mut reader = BoundaryReader::from_reader(src, BOUNDARY);
let mut buf = String::new();
test_boundary_reader(&mut reader, &mut buf);
} | rust_cleaned_test_functions.jsonl/80587 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54004,
368,
341,
286,
3504,
2327,
5224,
1428,
286,
7390,
17223,
16451,
18732,
320,
2152,
6718,
66371,
286,
1077,
2286,
284,
609,
6984,
13602,
6096,
5357,
12524,
543,
286,
1077,
5206,
6604,
284,
76... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_double_map_err() {
parse(
"double_map_err",
r#"
mod swig_foreign_types_map {}
mod swig_foreign_types_map {}
"#,
64,
FxHashMap::default(),
)
.unwrap_err();
} | rust_cleaned_test_functions.jsonl/54589 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 152
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24598,
5376,
9266,
368,
341,
286,
4715,
1006,
310,
330,
4331,
5376,
9266,
756,
310,
435,
2,
698,
2593,
2021,
343,
78983,
9763,
5376,
5613,
2593,
2021,
343,
78983,
9763,
5376,
5613,
57676,
345,
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 |
#[test]
fn test_api_guidelines_c_good_err() {
use apllodb_shared_components::ApllodbError;
use std::error::Error;
use std::fmt::Display;
fn assert_error<T: Error + Send + Sync + 'static>() {}
assert_error::<ApllodbError>();
fn assert_display<T: Display>() {}
assert_display::<ApllodbError>();
} | rust_cleaned_test_functions.jsonl/79201 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11697,
43756,
10999,
666,
44781,
9266,
368,
341,
262,
990,
52920,
75,
16853,
20405,
23258,
486,
32,
80438,
16853,
1454,
280,
262,
990,
1460,
486,
841,
486,
1454,
280,
262,
990,
1460,
486,
12501,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_flatten_internally_tagged() {
#[derive(Serialize, Deserialize, PartialEq, Debug)]
struct S {
#[serde(flatten)]
x: X,
#[serde(flatten)]
y: Y,
}
#[derive(Serialize, Deserialize, PartialEq, Debug)]
#[serde(tag = "typeX")]
enum X {
A { a: i32 },
B { b: i32 },
}
#[derive(Serialize, Deserialize, PartialEq, Debug)]
#[serde(tag = "typeY")]
enum Y {
C { c: i32 },
D { d: i32 },
}
let s = S {
x: X::B { b: 1 },
y: Y::D { d: 2 },
};
assert_tokens(
&s,
&[
Token::Map { len: None },
Token::Str("typeX"),
Token::Str("B"),
Token::Str("b"),
Token::I32(1),
Token::Str("typeY"),
Token::Str("D"),
Token::Str("d"),
Token::I32(2),
Token::MapEnd,
],
);
} | rust_cleaned_test_functions.jsonl/59168 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 556
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5081,
14456,
4042,
932,
745,
9372,
3556,
368,
341,
262,
11506,
27098,
3759,
9050,
11,
48440,
11,
55039,
11,
11091,
5563,
262,
2036,
328,
341,
286,
11506,
47024,
49747,
14456,
5563,
286,
856,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_init_no_config_path() {
init!("true");
let cb = return_types_u32::Return_U32::new().unwrap();
assert_eq!(vcx_init(cb.command_handle,
ptr::null(),
Some(cb.get_callback())),
error::INVALID_CONFIGURATION.code_num);
} | rust_cleaned_test_functions.jsonl/127540 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 221
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6137,
6536,
5332,
2638,
368,
341,
286,
2930,
17223,
1866,
797,
286,
1077,
9858,
284,
470,
9763,
7300,
18,
17,
486,
5598,
6665,
18,
17,
486,
931,
1005,
15454,
543,
286,
2060,
10714,
10297,
7362,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_order_from_str_bid() {
assert_eq!(
order_from_str("8 1 2 0 0"),
Ok(Order {
side: Side::Bid,
amount: 1,
price: 2,
timestamp: 0,
strategy: Strategy::Limit
})
);
} | rust_cleaned_test_functions.jsonl/64709 | {
"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,
7869,
5673,
2895,
62509,
368,
341,
286,
2060,
10714,
33673,
310,
1973,
5673,
2895,
445,
23,
220,
16,
220,
17,
220,
15,
220,
15,
4461,
310,
7622,
39692,
341,
394,
3108,
25,
16659,
486,
65452,
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_demangle_lines() {
let demangled_lines = demangle_lines(MANGLED_INPUT.lines(), None);
for (expected, actual) in DEMANGLED_OUTPUT.lines().zip(demangled_lines) {
assert_eq!(expected, actual);
}
} | rust_cleaned_test_functions.jsonl/25468 | {
"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,
69403,
4044,
18323,
368,
341,
262,
1077,
2429,
38940,
18323,
284,
2429,
4044,
18323,
3189,
5218,
13639,
21022,
44061,
1507,
2240,
317,
262,
369,
320,
7325,
11,
5042,
8,
304,
50814,
5218,
13639,
23... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
#[test]
fn test_execute_batch() {
let db = checked_memory_handle();
let sql = "BEGIN;
CREATE TABLE foo(x INTEGER);
INSERT INTO foo VALUES(1);
INSERT INTO foo VALUES(2);
INSERT INTO foo VALUES(3);
INSERT INTO foo VALUES(4);
END;";
db.execute_batch(sql).unwrap();
db.execute_batch("UPDATE foo SET x = 3 WHERE x < 3")
.unwrap();
assert!(db.execute_batch("INVALID SQL").is_err());
} | rust_cleaned_test_functions.jsonl/25503 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 305
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44329,
14534,
368,
341,
286,
1077,
2927,
284,
10067,
19195,
10630,
543,
286,
1077,
5704,
284,
330,
37588,
280,
4293,
30776,
14363,
15229,
2075,
30381,
317,
4293,
39518,
12496,
15229,
14710,
7,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_path_word_element() {
let (_, element) = path_element("a").unwrap();
assert_eq!(element, PathElement::Partial("a".to_string()));
let (_, element) = path_element("abc").unwrap();
assert_eq!(element, PathElement::Partial("abc".to_string()));
assert!(path_element("").is_err());
} | rust_cleaned_test_functions.jsonl/130545 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2638,
13533,
7894,
368,
341,
286,
1077,
39464,
2392,
8,
284,
1815,
7894,
445,
64,
1827,
15454,
543,
286,
2060,
10714,
10297,
6101,
11,
7933,
1691,
486,
37314,
445,
64,
3263,
983,
3904,
25138,
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_partial_equals_part_info() -> Result<()> {
let info_a: Box<dyn PartInfo> = Box::new(TestPartInfoA {
field_a: 123,
field_b: String::from("456"),
});
let info_b: Box<dyn PartInfo> = Box::new(TestPartInfoB {
field_a: String::from("123"),
field_b: 456,
});
assert_ne!(&info_a, &info_b);
assert_eq!(&info_a, &info_a);
assert_eq!(&info_b, &info_b);
Ok(())
} | rust_cleaned_test_functions.jsonl/79497 | {
"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,
52068,
61664,
10495,
3109,
368,
1464,
5714,
71698,
341,
262,
1077,
3546,
4306,
25,
8261,
92846,
3660,
1731,
29,
284,
8261,
486,
931,
31159,
5800,
1731,
32,
341,
286,
2070,
4306,
25,
220,
16,
17,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_io_handler_1dot0() {
let mut io = IoHandler::with_compatibility(Compatibility::Both);
io.add_method("say_hello", |_| Ok(Value::String("hello".to_string())));
let request = r#"{"method": "say_hello", "params": [42, 23], "id": 1}"#;
let response = r#"{"result":"hello","id":1}"#;
assert_eq!(io.handle_request_sync(request), Some(response.to_string()));
} | rust_cleaned_test_functions.jsonl/95529 | {
"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,
16939,
10183,
62,
16,
16119,
15,
368,
341,
197,
10217,
5206,
6399,
284,
29655,
3050,
486,
4197,
2965,
53053,
7,
85880,
486,
20629,
626,
197,
53112,
1364,
9032,
445,
36790,
96724,
497,
66091,
7622,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_cpuid() {
let num_entries = 5;
let mut cpuid = CpuId::new(num_entries).unwrap();
let vm_spec = VmSpec::new(0, 1, false);
cpuid.as_mut_slice()[0].function = PROCESSED_FN;
assert!(MockCpuidTransformer {}
.process_cpuid(&mut cpuid, &vm_spec.unwrap())
.is_ok());
assert!(cpuid.as_mut_slice().len() == num_entries);
for entry in cpuid.as_mut_slice().iter() {
match entry.function {
PROCESSED_FN => {
assert_eq!(entry.index, EXPECTED_INDEX);
}
_ => {
assert_ne!(entry.index, EXPECTED_INDEX);
}
}
}
} | rust_cleaned_test_functions.jsonl/124872 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 425
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
39811,
2423,
368,
341,
286,
1077,
1629,
26092,
284,
220,
20,
401,
286,
1077,
5206,
12490,
2423,
284,
356,
5584,
764,
486,
931,
8068,
26092,
568,
15454,
543,
286,
1077,
10995,
13594,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_cache_key() {
let db = Connection::open_in_memory().unwrap();
let cache = &db.cache;
assert_eq!(0, cache.len());
//let sql = " PRAGMA schema_version; -- comment";
let sql = "PRAGMA schema_version; ";
{
let mut stmt = db.prepare_cached(sql).unwrap();
assert_eq!(0, cache.len());
assert_eq!(0, stmt.query_row(&[], |r| r.get::<i32, i64>(0)).unwrap());
}
assert_eq!(1, cache.len());
{
let mut stmt = db.prepare_cached(sql).unwrap();
assert_eq!(0, cache.len());
assert_eq!(0, stmt.query_row(&[], |r| r.get::<i32, i64>(0)).unwrap());
}
assert_eq!(1, cache.len());
} | rust_cleaned_test_functions.jsonl/54427 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 399
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11529,
3097,
368,
341,
286,
1077,
2927,
284,
11032,
486,
2508,
1243,
19195,
1005,
15454,
543,
286,
1077,
6500,
284,
609,
1999,
20087,
280,
286,
2060,
10714,
10297,
15,
11,
6500,
19406,
5231,
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_first() {
let board = parse(RAW_INPUT);
assert_eq!(first_star(&board, &Slope { right: 3, down: 1 }), 7);
} | rust_cleaned_test_functions.jsonl/118644 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 74
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12978,
368,
341,
286,
1077,
4479,
284,
4715,
2785,
14419,
21022,
317,
286,
2060,
10714,
10297,
3896,
31681,
2099,
2482,
11,
609,
50,
35327,
314,
1290,
25,
220,
18,
11,
1495,
25,
220,
16,
31706,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_ecdsa_send_dealings() {
ic_test_utilities::artifact_pool_config::with_test_pool_config(|pool_config| {
with_test_replica_logger(|logger| {
let (mut ecdsa_pool, pre_signer) =
create_pre_signer_dependencies(pool_config, logger);
let (id_1, id_2, id_3, id_4, id_5) = (
create_transcript_id(1),
create_transcript_id(2),
create_transcript_id(3),
create_transcript_id(4),
create_transcript_id(5),
);
// Only dealing for transcript 1 is issued by us.
let dealing_1 = create_dealing(id_1, NODE_1);
let dealing_2 = create_dealing(id_2, NODE_2);
let dealing_3 = create_dealing(id_3, NODE_3);
let change_set = vec![
EcdsaChangeAction::AddToValidated(EcdsaMessage::EcdsaSignedDealing(dealing_1)),
EcdsaChangeAction::AddToValidated(EcdsaMessage::EcdsaSignedDealing(dealing_2)),
EcdsaChangeAction::AddToValidated(EcdsaMessage::EcdsaSignedDealing(dealing_3)),
];
ecdsa_pool.apply_changes(change_set);
// Set up the transcript creation request
let t1 = create_transcript_param(id_1, &[NODE_1], &[NODE_2]);
let t2 = create_transcript_param(id_4, &[NODE_1], &[NODE_3]);
let t3 = create_transcript_param(id_5, &[NODE_1], &[NODE_4]);
let block_reader =
TestEcdsaBlockReader::for_pre_signer_test(Height::from(100), vec![t1, t2, t3]);
let transcript_loader: TestEcdsaTranscriptLoader = Default::default();
let change_set =
pre_signer.send_dealings(&ecdsa_pool, &transcript_loader, &block_reader);
assert_eq!(change_set.len(), 2);
assert!(is_dealing_added_to_validated(
&change_set,
&id_4,
block_reader.tip_height()
));
assert!(is_dealing_added_to_validated(
&change_set,
&id_5,
block_reader.tip_height()
));
})
})
} | rust_cleaned_test_functions.jsonl/86710 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1416
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36844,
96780,
13565,
2259,
278,
819,
368,
341,
286,
17902,
4452,
94044,
486,
63722,
15709,
5332,
486,
4197,
4452,
15709,
5332,
22428,
10285,
5332,
91,
341,
310,
448,
4452,
25533,
15317,
27413,
22428... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cubic_self_intersections() {
do_test(
&CubicBezierSegment {
from: point(-10.0, -13.636363636363636),
ctrl1: point(15.0, 11.363636363636363),
ctrl2: point(-15.0, 11.363636363636363),
to: point(10.0, -13.636363636363636),
},
&CubicBezierSegment {
from: point(13.636363636363636, -10.0),
ctrl1: point(-11.363636363636363, 15.0),
ctrl2: point(-11.363636363636363, -15.0),
to: point(13.636363636363636, 10.0),
},
4,
);
} | rust_cleaned_test_functions.jsonl/14571 | {
"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,
666,
41181,
25637,
15318,
24661,
368,
341,
1066,
262,
653,
4452,
1006,
286,
609,
34,
41181,
95050,
21086,
341,
310,
504,
25,
1459,
4080,
16,
15,
13,
15,
11,
481,
16,
18,
13,
21,
18,
21,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.