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_string_trimming() {
use crate::processor::MaxChars;
use crate::types::{Annotated, Meta, Remark, RemarkType};
let value = Annotated::new("This is my long string I want to have trimmed down!".to_string());
let new_value = value.trim_string(MaxChars::Hard(20));
assert_eq_dbg!(
new_value,
Annotated(
Some("This is my long s...".into()),
Meta {
remarks: vec![Remark {
ty: RemarkType::Substituted,
rule_id: "!limit".to_string(),
range: Some((17, 20)),
}].into(),
original_length: Some(51),
..Default::default()
}
)
);
} | rust_cleaned_test_functions.jsonl/885 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 392
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
3547,
40033,
368,
341,
262,
990,
17717,
486,
29474,
486,
5974,
32516,
280,
262,
990,
17717,
486,
9242,
22964,
2082,
87029,
11,
15819,
11,
82733,
11,
82733,
929,
2315,
262,
1077,
897,
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_smoke() {
let (_td, repo) = repo_init().unwrap();
let root = repo.path().parent().unwrap();
let repo_path = root.as_os_str().to_str().unwrap();
create_branch(repo_path, "test").unwrap();
let res = branch_compare_upstream(repo_path, "test");
assert_eq!(res.is_err(), true);
} | rust_cleaned_test_functions.jsonl/96502 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 165
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15874,
4740,
368,
341,
286,
1077,
5453,
1296,
11,
15867,
8,
284,
15867,
6137,
1005,
15454,
543,
286,
1077,
3704,
284,
15867,
3875,
1005,
3765,
1005,
15454,
543,
286,
1077,
15867,
2638,
284,
3704,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_recip() {
let nan: f64 = Float::nan();
let inf: f64 = Float::infinity();
let neg_inf: f64 = Float::neg_infinity();
assert_eq!(1.0f64.recip(), 1.0);
assert_eq!(2.0f64.recip(), 0.5);
assert_eq!((-0.4f64).recip(), -2.5);
assert_eq!(0.0f64.recip(), inf);
assert!(nan.recip().is_nan());
assert_eq!(inf.recip(), 0.0);
assert_eq!(neg_inf.recip(), 0.0);
} | rust_cleaned_test_functions.jsonl/7442 | {
"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,
7080,
573,
368,
341,
286,
1077,
20021,
25,
282,
21,
19,
284,
13001,
486,
18759,
543,
286,
1077,
4132,
25,
282,
21,
19,
284,
13001,
486,
80016,
543,
286,
1077,
4184,
26051,
25,
282,
21,
19,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_write_header_simple() {
let header = DataFrameHeader {
flags: DataFrameFlags::FIN,
opcode: 1,
mask: None,
len: 43,
};
let expected = [0x81, 0x2B];
let mut obtained = Vec::with_capacity(2);
write_header(&mut obtained, header).unwrap();
assert_eq!(&obtained[..], &expected[..]);
} | rust_cleaned_test_functions.jsonl/31067 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
8757,
30015,
368,
341,
197,
10217,
4247,
284,
45786,
4047,
341,
298,
59516,
25,
45786,
9195,
486,
16750,
345,
298,
39703,
1851,
25,
220,
16,
345,
298,
74912,
25,
2240,
345,
298,
33111,
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_rtrim() {
let cases = vec![
(" bar ", " bar"),
("bar", "bar"),
("ba r", "ba r"),
(" ", ""),
(" bar\t ", " bar\t"),
(" bar \t", " bar \t"),
("bar \r", "bar \r"),
("bar \n", "bar \n"),
("", ""),
(" 你好 ", " 你好"),
(" 你 好 ", " 你 好"),
(" 분산 데이터베이스 ", " 분산 데이터베이스"),
(" あなたのことが好きです ", " あなたのことが好きです"),
];
let mut ctx = EvalContext::default();
for (input_str, exp) in cases {
let input = datum_expr(Datum::Bytes(input_str.as_bytes().to_vec()));
let op = scalar_func_expr(ScalarFuncSig::RTrim, &[input]);
let op = Expression::build(&mut ctx, op).unwrap();
let got = op.eval(&mut ctx, &[]).unwrap();
let exp = Datum::Bytes(exp.as_bytes().to_vec());
assert_eq!(got, exp, "rtrim('{:?}')", input_str);
}
// test NULL case
let input = datum_expr(Datum::Null);
let op = scalar_func_expr(ScalarFuncSig::RTrim, &[input]);
let op = Expression::build(&mut ctx, op).unwrap();
let got = op.eval(&mut ctx, &[]).unwrap();
let exp = Datum::Null;
assert_eq!(got, exp, "rtrim(NULL)");
} | rust_cleaned_test_functions.jsonl/9090 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 826
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
10666,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
3489,
256,
3619,
256,
3670,
330,
256,
3619,
4461,
310,
3489,
2257,
497,
330,
2257,
4461,
310,
3489,
4645,
220,
435,
497,
330,
4645,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_send_transaction() {
let rpc_client = RpcClient::new_mock("succeeds".to_string());
let key = Keypair::new();
let to = solana_sdk::pubkey::new_rand();
let blockhash = Hash::default();
let tx = system_transaction::transfer(&key, &to, 50, blockhash);
let signature = rpc_client.send_transaction(&tx);
assert_eq!(signature.unwrap(), tx.signatures[0]);
let rpc_client = RpcClient::new_mock("fails".to_string());
let signature = rpc_client.send_transaction(&tx);
assert!(signature.is_err());
// Test bad signature returned from rpc node
let rpc_client = RpcClient::new_mock("malicious".to_string());
let signature = rpc_client.send_transaction(&tx);
assert!(signature.is_err());
} | rust_cleaned_test_functions.jsonl/2731 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 349
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13565,
28884,
368,
341,
286,
1077,
35596,
8179,
284,
79961,
2959,
486,
931,
34134,
445,
82,
29264,
82,
3263,
983,
3904,
5231,
286,
1077,
1376,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_no_allergies_means_not_allergic() {
let allergies = Allergies(0);
assert_eq!(false, allergies.is_allergic_to(&Allergen::Peanuts));
assert_eq!(false, allergies.is_allergic_to(&Allergen::Cats));
assert_eq!(false, allergies.is_allergic_to(&Allergen::Strawberries));
} | rust_cleaned_test_functions.jsonl/82465 | {
"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,
6536,
5705,
2375,
550,
80866,
7913,
5705,
74339,
368,
341,
262,
1077,
57642,
284,
2009,
2375,
550,
7,
15,
317,
262,
2060,
10714,
10297,
3849,
11,
57642,
2079,
5705,
74339,
2346,
2099,
2403,
2375,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bpf_upgradeable_loader_create_buffer_ix() {
let max_data_len = 54321;
let payer_address = Pubkey::new_unique();
let buffer_address = Pubkey::new_unique();
let authority_address = Pubkey::new_unique();
let instructions = bpf_loader_upgradeable::create_buffer(
&payer_address,
&buffer_address,
&authority_address,
55,
max_data_len,
)
.unwrap();
let mut message = Message::new(&instructions, None);
assert_eq!(
parse_bpf_upgradeable_loader(
&message.instructions[1],
&AccountKeys::new(&message.account_keys, None)
)
.unwrap(),
ParsedInstructionEnum {
instruction_type: "initializeBuffer".to_string(),
info: json!({
"account": buffer_address.to_string(),
"authority": authority_address.to_string(),
}),
}
);
assert!(parse_bpf_upgradeable_loader(
&message.instructions[1],
&AccountKeys::new(&message.account_keys[0..2], None)
)
.is_err());
let keys = message.account_keys.clone();
message.instructions[1].accounts.pop();
message.instructions[1].accounts.pop();
assert!(parse_bpf_upgradeable_loader(
&message.instructions[1],
&AccountKeys::new(&keys, None)
)
.is_err());
} | rust_cleaned_test_functions.jsonl/23415 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 804
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
880,
15897,
67794,
480,
22139,
8657,
7776,
62686,
368,
341,
286,
1077,
1932,
1769,
6043,
284,
220,
20,
19,
18,
17,
16,
401,
286,
1077,
69275,
6744,
284,
22611,
792,
486,
931,
21218,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_brquoted_name() -> Result<()> {
let name = SqlName::new("safe_name").brquoted();
assert_eq!(&name, "[safe_name]");
let name = SqlName::new("safe_name").alias("sn").brquoted();
assert_eq!(&name, "[safe_name] AS sn");
let name = SqlName::new("safe_name").add("sub").alias("sn").brquoted();
assert_eq!(&name, "[safe_name].[sub] AS sn");
let name = brname!("safe_name");
assert_eq!(&name, "[safe_name]");
let name = brname!("safe_name"; "sn");
assert_eq!(&name, "[safe_name] AS sn");
let name = brname!("safe_name", "sub"; "sn");
assert_eq!(&name, "[safe_name].[sub] AS sn");
Ok(())
} | rust_cleaned_test_functions.jsonl/74809 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 335
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17682,
63725,
1269,
368,
1464,
5714,
71698,
341,
286,
1077,
829,
284,
7224,
675,
486,
931,
445,
18675,
1269,
1827,
1323,
63725,
543,
286,
2060,
10714,
0,
2099,
606,
11,
10545,
18675,
1269,
60,
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_tuple_faulty() {
let spec = "output out: (Int8, Bool) := (14, 3)";
assert_eq!(1, num_type_errors(spec));
} | rust_cleaned_test_functions.jsonl/110684 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 79
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21773,
70097,
88,
368,
341,
286,
1077,
1398,
284,
330,
3006,
700,
25,
320,
1072,
23,
11,
12608,
8,
1669,
320,
16,
19,
11,
220,
18,
24023,
286,
2060,
10714,
10297,
16,
11,
1629,
1819,
20196,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_tags_stripping() {
use crate::protocol::{Event, TagEntry, Tags};
use crate::types::Annotated;
use std::iter::repeat;
let mut processor = TrimmingProcessor::new();
let mut event = Annotated::new(Event {
tags: Annotated::new(Tags(
vec![Annotated::new(TagEntry(
Annotated::new(repeat("x").take(200).collect()),
Annotated::new(repeat("x").take(300).collect()),
))]
.into(),
)),
..Default::default()
});
process_value(&mut event, &mut processor, ProcessingState::root()).unwrap();
let json = event
.value()
.unwrap()
.tags
.payload_to_json_pretty()
.unwrap();
assert_eq_str!(
json,
r#"[
[
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxx...",
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx..."
]
]"#
);
} | rust_cleaned_test_functions.jsonl/112690 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 445
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16333,
1261,
461,
10732,
368,
341,
262,
990,
17717,
486,
17014,
22964,
1556,
11,
12353,
5874,
11,
27683,
2440,
262,
990,
17717,
486,
9242,
486,
2082,
87029,
280,
262,
990,
1460,
486,
2015,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_trivial_drain() {
let mut s = HashSet::<i32>::new();
for _ in s.drain() {}
assert!(s.is_empty());
drop(s);
let mut s = HashSet::<i32>::new();
drop(s.drain());
assert!(s.is_empty());
} | rust_cleaned_test_functions.jsonl/5406 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3547,
26658,
26680,
466,
368,
341,
286,
1077,
5206,
274,
284,
18931,
27638,
72,
18,
17,
6831,
931,
543,
286,
369,
716,
304,
274,
950,
29093,
368,
5613,
286,
2060,
10297,
82,
2079,
15124,
1423,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_string_evaluation() {
let mut variables = RawVariables::default();
variables.add(
"key1",
ValueKind::String("key1 value \"{{ parent_scope_var }}\"".to_owned()),
);
variables.add(
"key2",
ValueKind::String("key2 value \"{{ key1 }}\"".to_owned()),
);
let mut scope = Scope::default();
scope.insert_var("parent_scope_var", "parent_scope_var_value");
assert_eq!(variables.evaluate(&scope).unwrap(), {
let mut control = Variables::default();
control.insert(
"key1".to_owned(),
"key1 value \"parent_scope_var_value\"".to_owned(),
);
control.insert(
"key2".to_owned(),
"key2 value \"key1 value \"parent_scope_var_value\"\"".to_owned(),
);
control
});
} | rust_cleaned_test_functions.jsonl/134594 | {
"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,
3904,
86505,
368,
341,
286,
1077,
5206,
7332,
284,
23022,
22678,
486,
2258,
1428,
286,
7332,
1364,
1006,
310,
330,
792,
16,
756,
310,
5162,
10629,
486,
703,
445,
792,
16,
897,
7245,
2979,
2681,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read() {
let data = hex::decode(TEST_DATA).unwrap();
let mut reader = io::BufReader::new(&data[..]);
let mut f = PZip::reader(&mut reader, b"pzip").expect("failed to read header");
let mut buf = vec![0u8; 4];
f.read_exact(&mut buf)
.expect("failed to read first 4 bytes");
assert_eq!(buf, b"Hell");
f.read_exact(&mut buf).expect("failed to read next 3 bytes");
assert_eq!(buf, b"o, w");
buf.resize(20, 0);
let amt = f.read(&mut buf).expect("failed to read last 4 bytes");
assert_eq!(amt, 5);
assert_eq!(&buf[..amt], b"orld!");
} | rust_cleaned_test_functions.jsonl/130756 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 321
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
368,
341,
286,
1077,
821,
284,
12371,
486,
18196,
50320,
7896,
568,
15454,
543,
286,
1077,
5206,
6604,
284,
6399,
486,
15064,
5062,
486,
931,
2099,
691,
95874,
2558,
286,
1077,
5206,
282,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vtable_index_and_len() {
ok_with_test("class A {}", |vm| {
let cls_id = vm.cls_by_name("A");
let cls = vm.classes.idx(cls_id);
let cls = cls.read();
assert_eq!(cls.virtual_fcts.len(), 0);
});
ok_with_test("@open class A { @open fun f() {} }", |vm| {
let cls_id = vm.cls_by_name("A");
let cls = vm.classes.idx(cls_id);
let cls = cls.read();
assert_eq!(cls.virtual_fcts.len(), 1);
});
ok_with_test(
"@open class A { @open fun f() {} }
@open class B extends A { @override fun f() {}
@open fun g() {} }",
|vm| {
let cls_id = vm.cls_by_name("A");
let cls = vm.classes.idx(cls_id);
let cls = cls.read();
assert_eq!(cls.virtual_fcts.len(), 1);
let cls_id = vm.cls_by_name("B");
let cls = vm.classes.idx(cls_id);
let cls = cls.read();
assert_eq!(cls.virtual_fcts.len(), 2);
},
);
} | rust_cleaned_test_functions.jsonl/128704 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 724
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
2005,
3560,
8378,
6043,
368,
341,
286,
5394,
6615,
4452,
445,
1040,
362,
24689,
760,
7338,
91,
341,
310,
1077,
12790,
842,
284,
10995,
89052,
3710,
1269,
445,
32,
797,
310,
1077,
12790,
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_verifying_key_cid() {
for rsp in ®ISTERED_SEAL_PROOFS {
rsp.verifying_key_cid()
.expect("failed to get verifying key cid");
}
} | rust_cleaned_test_functions.jsonl/88715 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26042,
7766,
3097,
68699,
368,
341,
286,
369,
42160,
304,
609,
46302,
1479,
3620,
969,
5756,
46,
8485,
341,
310,
42160,
67667,
7766,
3097,
68699,
741,
394,
659,
17119,
445,
16091,
311,
633,
68863,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_fetch_att() {
let tests = [
(FetchAttribute::Envelope, "ENVELOPE???"),
(FetchAttribute::Flags, "FLAGS???"),
(FetchAttribute::InternalDate, "INTERNALDATE???"),
(FetchAttribute::Rfc822, "RFC822???"),
(FetchAttribute::Rfc822Header, "RFC822.HEADER???"),
(FetchAttribute::Rfc822Size, "RFC822.SIZE???"),
(FetchAttribute::Rfc822Text, "RFC822.TEXT???"),
(FetchAttribute::Body, "BODY???"),
(FetchAttribute::BodyStructure, "BODYSTRUCTURE???"),
(FetchAttribute::Uid, "UID???"),
(
FetchAttribute::BodyExt {
partial: None,
peek: false,
section: None,
},
"BODY[]???",
),
(
FetchAttribute::BodyExt {
partial: None,
peek: true,
section: None,
},
"BODY.PEEK[]???",
),
(
FetchAttribute::BodyExt {
partial: None,
peek: true,
section: Some(Section::Text(None)),
},
"BODY.PEEK[TEXT]???",
),
(
FetchAttribute::BodyExt {
partial: Some((42, NonZeroU32::try_from(1337).unwrap())),
peek: true,
section: Some(Section::Text(None)),
},
"BODY.PEEK[TEXT]<42.1337>???",
),
];
let expected_remainder = "???".as_bytes();
for (expected, test) in tests {
let (got_remainder, got) = fetch_att(test.as_bytes()).unwrap();
assert_eq!(expected, got);
assert_eq!(expected_remainder, got_remainder);
}
} | rust_cleaned_test_functions.jsonl/125410 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11803,
13356,
368,
341,
286,
1077,
7032,
284,
2278,
310,
320,
20714,
3907,
486,
62712,
11,
330,
953,
47782,
1740,
33015,
4461,
310,
320,
20714,
3907,
486,
9195,
11,
330,
32748,
33015,
4461,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_immediate_am() {
let mut cpu = setup(0x0000, true, 0xA9, Some(0x10));
cpu.writ_byte(0xFA, 0x10);
let result = immediate_am(&mut cpu);
assert_eq!(result.ok(), Some(ValueOnly(0x10)));
assert_eq!(cpu.pc(), 0x0000);
} | rust_cleaned_test_functions.jsonl/26573 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17895,
14636,
22880,
368,
341,
286,
1077,
5206,
17319,
284,
6505,
7,
15,
87,
15,
15,
15,
15,
11,
830,
11,
220,
15,
14673,
24,
11,
4329,
7,
15,
87,
16,
15,
1106,
286,
17319,
78173,
19737,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_quote_derive_copy_hack() {
// Assume the given struct is:
// struct Foo {
let struct_name = mk_ident("Foo");
let fields = [mk_ident("name"), mk_ident("id")];
let fields = fields.iter().map(|it| quote!(#it: self.#it.clone(), ).token_trees).flatten();
let list = tt::Subtree {
delimiter: Some(tt::Delimiter {
kind: tt::DelimiterKind::Brace,
id: tt::TokenId::unspecified(),
}),
token_trees: fields.collect(),
};
let quoted = quote! {
impl Clone for #struct_name {
fn clone(&self) -> Self {
Self #list
}
}
};
assert_eq!(quoted.to_string(), "impl Clone for Foo {fn clone (& self) -> Self {Self {name : self . name . clone () , id : self . id . clone () ,}}}");
} | rust_cleaned_test_functions.jsonl/29278 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 486
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45236,
35345,
533,
16096,
1523,
473,
368,
341,
286,
442,
62197,
279,
2661,
2036,
374,
510,
286,
442,
2036,
33428,
341,
73363,
286,
1077,
2036,
1269,
284,
23789,
38399,
445,
40923,
797,
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... | 1 |
#[test]
fn test_bench_tps_fund_keys() {
let (genesis_config, id) = create_genesis_config(10_000);
let bank = Bank::new_for_tests(&genesis_config);
let client = Arc::new(BankClient::new(bank));
let keypair_count = 20;
let carats = 20;
let keypairs =
generate_and_fund_keypairs(client.clone(), None, &id, keypair_count, carats).unwrap();
for kp in &keypairs {
assert_eq!(
client
.get_balance_with_commitment(&kp.pubkey(), CommitmentConfig::processed())
.unwrap(),
carats
);
}
} | rust_cleaned_test_functions.jsonl/10466 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 347
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
19762,
528,
1690,
761,
1241,
12631,
368,
341,
286,
1077,
320,
77894,
5332,
11,
877,
8,
284,
1855,
16322,
13774,
5332,
7,
16,
15,
62,
15,
15,
15,
317,
286,
1077,
6073,
284,
8547,
486,
93... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_generate_short_url_path() {
let fake_service = FakeService{};
let generator = ShortenerGenerator::new(fake_service);
let url = String::from("https://google.com");
let expected = "gVKJn";
assert_eq!(expected, generator.generate_short_url_path(url));
} | rust_cleaned_test_functions.jsonl/97025 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48851,
16673,
2903,
2638,
368,
341,
286,
1077,
12418,
12267,
284,
36965,
1860,
45982,
286,
1077,
13823,
284,
10698,
798,
12561,
486,
931,
74138,
12267,
317,
286,
1077,
2515,
284,
923,
486,
1499,
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_inet6_aton() {
let cases = vec![
(
Datum::Bytes(b"0.0.0.0".to_vec()),
Datum::Bytes(vec![0x00, 0x00, 0x00, 0x00]),
),
(
Datum::Bytes(b"10.0.5.9".to_vec()),
Datum::Bytes(vec![0x0A, 0x00, 0x05, 0x09]),
),
(
Datum::Bytes(b"::1.2.3.4".to_vec()),
Datum::Bytes(vec![
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x02, 0x03, 0x04,
]),
),
(
Datum::Bytes(b"::FFFF:1.2.3.4".to_vec()),
Datum::Bytes(vec![
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x01,
0x02, 0x03, 0x04,
]),
),
(
Datum::Bytes(b"::fdfe:5a55:caff:fefa:9089".to_vec()),
Datum::Bytes(vec![
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFD, 0xFE, 0x5A, 0x55, 0xCA, 0xFF, 0xFE,
0xFA, 0x90, 0x89,
]),
),
(
Datum::Bytes(b"fdfe::5a55:caff:fefa:9089".to_vec()),
Datum::Bytes(vec![
0xFD, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5A, 0x55, 0xCA, 0xFF, 0xFE,
0xFA, 0x90, 0x89,
]),
),
(
Datum::Bytes(b"2001:0db8:85a3:0000:0000:8a2e:0370:7334".to_vec()),
Datum::Bytes(vec![
0x20, 0x01, 0x0d, 0xb8, 0x85, 0xa3, 0x00, 0x00, 0x00, 0x00, 0x8a, 0x2e, 0x03,
0x70, 0x73, 0x34,
]),
),
(Datum::Bytes(b"".to_vec()), Datum::Null),
(Datum::Null, Datum::Null),
];
let mut ctx = EvalContext::default();
for (input, exp) in cases {
let input = datum_expr(input);
let op = scalar_func_expr(ScalarFuncSig::Inet6Aton, &[input]);
let op = Expression::build(&mut ctx, op).unwrap();
let got = op.eval(&mut ctx, &[]).unwrap();
assert_eq!(got, exp);
}
} | rust_cleaned_test_functions.jsonl/75118 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1576
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
295,
21,
3752,
263,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
2399,
394,
68459,
486,
7078,
1883,
1,
15,
13,
15,
13,
15,
13,
15,
3263,
983,
13251,
14702,
394,
68459,
486,
7078,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_len() {
assert_eq!("".len(), 0u);
assert_eq!("hello world".len(), 11u);
assert_eq!("\x63".len(), 1u);
assert_eq!("\xa2".len(), 2u);
assert_eq!("\u03c0".len(), 2u);
assert_eq!("\u2620".len(), 3u);
assert_eq!("\U0001d11e".len(), 4u);
assert_eq!("".char_len(), 0u);
assert_eq!("hello world".char_len(), 11u);
assert_eq!("\x63".char_len(), 1u);
assert_eq!("\xa2".char_len(), 1u);
assert_eq!("\u03c0".char_len(), 1u);
assert_eq!("\u2620".char_len(), 1u);
assert_eq!("\U0001d11e".char_len(), 1u);
assert_eq!("ประเทศไทย中华Việt Nam".char_len(), 19u);
assert_eq!("hello".width(false), 10u);
assert_eq!("hello".width(true), 10u);
assert_eq!("\0\0\0\0\0".width(false), 0u);
assert_eq!("\0\0\0\0\0".width(true), 0u);
assert_eq!("".width(false), 0u);
assert_eq!("".width(true), 0u);
assert_eq!("\u2081\u2082\u2083\u2084".width(false), 4u);
assert_eq!("\u2081\u2082\u2083\u2084".width(true), 8u);
} | rust_cleaned_test_functions.jsonl/56791 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 646
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6043,
368,
341,
286,
2060,
10714,
17223,
3263,
2892,
1507,
220,
15,
84,
317,
286,
2060,
10714,
17223,
14990,
1879,
3263,
2892,
1507,
220,
16,
16,
84,
317,
286,
2060,
10714,
0,
4921,
87,
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 |
#[test]
fn test_set_led() {
let mock = mock("PUT", "/low/led/1")
.with_status(200)
.with_header("content-type", "application/json")
.with_body("null")
.match_body("true")
.create();
let address = server_address();
let client = Client::from_ip_and_port(address.ip(), address.port());
client.set_led(1, true).unwrap();
mock.assert();
} | rust_cleaned_test_functions.jsonl/63059 | {
"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,
2602,
38367,
368,
341,
286,
1077,
7860,
284,
7860,
445,
6221,
497,
3521,
10303,
14,
832,
14,
16,
1138,
310,
659,
4197,
4773,
7,
17,
15,
15,
340,
310,
659,
4197,
8757,
445,
1796,
10604,
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... | 1 |
#[test]
fn test_u32_to_enum() {
#[derive(Deserialize, Debug, PartialEq)]
enum E {
A,
B,
}
let deserializer = IntoDeserializer::<value::Error>::into_deserializer(1u32);
let e: E = E::deserialize(deserializer).unwrap();
assert_eq!(E::B, e);
} | rust_cleaned_test_functions.jsonl/125404 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7300,
18,
17,
2346,
31054,
368,
341,
262,
11506,
27098,
7,
64465,
11,
11091,
11,
55039,
5563,
262,
7618,
468,
341,
286,
362,
345,
286,
425,
345,
262,
555,
262,
1077,
939,
41939,
284,
31645,
80... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_generate_combinations() {
let components = Component::parse(
"0/2
2/2
2/3
3/4
3/5
0/1
10/1
9/10");
let mut expected = HashSet::new();
expected.insert(Component::parse("0/1"));
expected.insert(Component::parse("0/1\n10/1"));
expected.insert(Component::parse("0/1\n10/1\n9/10"));
expected.insert(Component::parse("0/2"));
expected.insert(Component::parse("0/2\n2/3"));
expected.insert(Component::parse("0/2\n2/3\n3/4"));
expected.insert(Component::parse("0/2\n2/3\n3/5"));
expected.insert(Component::parse("0/2\n2/2"));
expected.insert(Component::parse("0/2\n2/2\n2/3"));
expected.insert(Component::parse("0/2\n2/2\n2/3\n3/4"));
expected.insert(Component::parse("0/2\n2/2\n2/3\n3/5"));
let actual = generate_combinations(components);
assert_eq!(actual, expected);
} | rust_cleaned_test_functions.jsonl/39396 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 351
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48851,
34454,
12634,
368,
341,
10217,
6813,
284,
5578,
486,
6400,
1006,
1,
15,
14,
17,
198,
17,
14,
17,
198,
17,
14,
18,
198,
18,
14,
19,
198,
18,
14,
20,
198,
15,
14,
16,
198,
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_buckets() {
let orig_text = b"GCCTTAACATTATTACGCCTA$";
let alphabet = Alphabet::new(orig_text);
let text: Vec<u8> = transform_text(orig_text, &alphabet, 1);
let n = text.len();
let mut sais = SAIS::new(n);
sais.init_bucket_start(&text);
assert_eq!(sais.bucket_start, vec![0, 1, 7, 13, 15]);
sais.init_bucket_end(&text);
assert_eq!(sais.bucket_end, vec![0, 6, 12, 14, 21]);
} | rust_cleaned_test_functions.jsonl/71440 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 244
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84156,
368,
341,
286,
1077,
2713,
4326,
284,
293,
1,
22863,
1162,
15204,
1706,
21614,
21614,
1706,
22863,
1162,
32,
3,
876,
286,
1077,
27790,
284,
62797,
486,
931,
54837,
4326,
317,
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,
1... | 1 |
#[test]
fn test_identifier_expression() {
let exp = statement_expression("foobar;");
match exp {
Expression::Identifier(ident) => {
assert_eq!("foobar", ident.value);
assert_eq!("foobar", ident.token_literal());
}
_ => panic!("Expected identifier"),
}
} | rust_cleaned_test_functions.jsonl/64068 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 178
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33176,
28068,
368,
341,
286,
1077,
1343,
284,
5114,
28068,
445,
50267,
26,
3071,
286,
2432,
1343,
341,
310,
16378,
486,
8714,
95270,
8,
589,
341,
394,
2060,
10714,
17223,
50267,
497,
3524,
2824,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_insert_ttl() {
let now = Instant::now();
let name = Query::query(Name::from_str("www.example.com.").unwrap(), RecordType::A);
// TTL should be 1
let ips_ttl = vec![
(RData::A(Ipv4Addr::new(127, 0, 0, 1)), 1),
(RData::A(Ipv4Addr::new(127, 0, 0, 2)), 2),
];
let ips = vec![
RData::A(Ipv4Addr::new(127, 0, 0, 1)),
RData::A(Ipv4Addr::new(127, 0, 0, 2)),
];
let mut lru = DnsLru::new(1);
lru.insert(name.clone(), ips_ttl, now);
// still valid
let rc_ips = lru.get(&name, now + Duration::from_secs(1)).unwrap();
assert_eq!(*rc_ips.iter().next().unwrap(), ips[0]);
// 2 should be one too far
let rc_ips = lru.get(&name, now + Duration::from_secs(2));
assert!(rc_ips.is_none());
} | rust_cleaned_test_functions.jsonl/89627 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 468
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
87157,
368,
341,
286,
1077,
1431,
284,
18058,
486,
3328,
543,
286,
1077,
829,
284,
11361,
486,
1631,
21182,
486,
1499,
2895,
445,
2136,
7724,
905,
98401,
15454,
1507,
13583,
929,
486,
32,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_numbered() {
let context = Context::new(
String::from("us"),
Some(String::from("PA")),
Tokens::new(HashMap::new(), HashMap::new(), HashMap::new()),
);
assert_eq!(
is_numbered(&Name::new(String::from("main st"), 0, None, &context)),
None
);
assert_eq!(
is_numbered(&Name::new(String::from("1st st"), 0, None, &context)),
Some(String::from("1st"))
);
assert_eq!(
is_numbered(&Name::new(String::from("2nd st"), 0, None, &context)),
Some(String::from("2nd"))
);
assert_eq!(
is_numbered(&Name::new(String::from("west 2nd st"), 0, None, &context)),
Some(String::from("2nd"))
);
assert_eq!(
is_numbered(&Name::new(String::from("3rd st"), 0, None, &context)),
Some(String::from("3rd"))
);
assert_eq!(
is_numbered(&Name::new(String::from("4th st"), 0, None, &context)),
Some(String::from("4th"))
);
assert_eq!(
is_numbered(&Name::new(String::from("11th ave"), 0, None, &context)),
Some(String::from("11th"))
);
assert_eq!(
is_numbered(&Name::new(String::from("12th ave"), 0, None, &context)),
Some(String::from("12th"))
);
assert_eq!(
is_numbered(&Name::new(String::from("21st av"), 0, None, &context)),
Some(String::from("21st"))
);
assert_eq!(
is_numbered(&Name::new(String::from("32nd av"), 0, None, &context)),
Some(String::from("32nd"))
);
assert_eq!(
is_numbered(&Name::new(String::from("45th av"), 0, None, &context)),
Some(String::from("45th"))
);
assert_eq!(
is_numbered(&Name::new(String::from("351235th av"), 0, None, &context)),
Some(String::from("351235th"))
);
} | rust_cleaned_test_functions.jsonl/25035 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1053
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
5500,
291,
368,
341,
286,
1077,
2266,
284,
9608,
486,
931,
1006,
310,
923,
486,
1499,
445,
355,
4461,
310,
4329,
2242,
486,
1499,
445,
8041,
30154,
310,
58166,
486,
931,
7,
18497,
486,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cast_from_int64() {
let i64_values: Vec<i64> = vec![
std::i64::MIN,
std::i32::MIN as i64,
std::i16::MIN as i64,
std::i8::MIN as i64,
0,
std::i8::MAX as i64,
std::i16::MAX as i64,
std::i32::MAX as i64,
std::i64::MAX,
];
let i64_array: ArrayRef = Arc::new(Int64Array::from(i64_values));
let f64_expected = vec![
"-9223372036854776000.0",
"-2147483648.0",
"-32768.0",
"-128.0",
"0.0",
"127.0",
"32767.0",
"2147483647.0",
"9223372036854776000.0",
];
assert_eq!(
f64_expected,
get_cast_values::<Float64Type>(&i64_array, &DataType::Float64)
);
let f32_expected = vec![
"-9223372000000000000.0",
"-2147483600.0",
"-32768.0",
"-128.0",
"0.0",
"127.0",
"32767.0",
"2147483600.0",
"9223372000000000000.0",
];
assert_eq!(
f32_expected,
get_cast_values::<Float32Type>(&i64_array, &DataType::Float32)
);
let i64_expected = vec![
"-9223372036854775808",
"-2147483648",
"-32768",
"-128",
"0",
"127",
"32767",
"2147483647",
"9223372036854775807",
];
assert_eq!(
i64_expected,
get_cast_values::<Int64Type>(&i64_array, &DataType::Int64)
);
let i32_expected = vec![
"null",
"-2147483648",
"-32768",
"-128",
"0",
"127",
"32767",
"2147483647",
"null",
];
assert_eq!(
i32_expected,
get_cast_values::<Int32Type>(&i64_array, &DataType::Int32)
);
let i16_expected = vec![
"null", "null", "-32768", "-128", "0", "127", "32767", "null", "null",
];
assert_eq!(
i16_expected,
get_cast_values::<Int16Type>(&i64_array, &DataType::Int16)
);
let i8_expected = vec![
"null", "null", "null", "-128", "0", "127", "null", "null", "null",
];
assert_eq!(
i8_expected,
get_cast_values::<Int8Type>(&i64_array, &DataType::Int8)
);
let u64_expected = vec![
"null",
"null",
"null",
"null",
"0",
"127",
"32767",
"2147483647",
"9223372036854775807",
];
assert_eq!(
u64_expected,
get_cast_values::<UInt64Type>(&i64_array, &DataType::UInt64)
);
let u32_expected = vec![
"null",
"null",
"null",
"null",
"0",
"127",
"32767",
"2147483647",
"null",
];
assert_eq!(
u32_expected,
get_cast_values::<UInt32Type>(&i64_array, &DataType::UInt32)
);
let u16_expected = vec![
"null", "null", "null", "null", "0", "127", "32767", "null", "null",
];
assert_eq!(
u16_expected,
get_cast_values::<UInt16Type>(&i64_array, &DataType::UInt16)
);
let u8_expected = vec![
"null", "null", "null", "null", "0", "127", "null", "null", "null",
];
assert_eq!(
u8_expected,
get_cast_values::<UInt8Type>(&i64_array, &DataType::UInt8)
);
} | rust_cleaned_test_functions.jsonl/29626 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2398
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5303,
5673,
4042,
21,
19,
368,
341,
286,
1077,
600,
21,
19,
9146,
25,
11312,
21897,
21,
19,
29,
284,
7486,
90515,
310,
1460,
486,
72,
21,
19,
486,
16413,
345,
310,
1460,
486,
72,
18,
17,
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_set_vm_config() {
let mut vm_resources = default_vm_resources();
let mut aux_vm_config = VmConfig {
vcpu_count: Some(32),
mem_size_mib: Some(512),
ht_enabled: Some(true),
cpu_template: Some(CpuFeaturesTemplate::T2),
track_dirty_pages: false,
};
assert_ne!(vm_resources.vm_config, aux_vm_config);
vm_resources.set_vm_config(&aux_vm_config).unwrap();
assert_eq!(vm_resources.vm_config, aux_vm_config);
// Invalid vcpu count.
aux_vm_config.vcpu_count = Some(0);
assert_eq!(
vm_resources.set_vm_config(&aux_vm_config),
Err(VmConfigError::InvalidVcpuCount)
);
aux_vm_config.vcpu_count = Some(33);
assert_eq!(
vm_resources.set_vm_config(&aux_vm_config),
Err(VmConfigError::InvalidVcpuCount)
);
aux_vm_config.vcpu_count = Some(32);
// Invalid mem_size_mib.
aux_vm_config.mem_size_mib = Some(0);
assert_eq!(
vm_resources.set_vm_config(&aux_vm_config),
Err(VmConfigError::InvalidMemorySize)
);
// Incompatible mem_size_mib with balloon size.
vm_resources.vm_config.mem_size_mib = Some(128);
vm_resources
.set_balloon_device(BalloonDeviceConfig {
amount_mb: 100,
deflate_on_oom: false,
stats_polling_interval_s: 0,
})
.unwrap();
aux_vm_config.mem_size_mib = Some(90);
assert_eq!(
vm_resources.set_vm_config(&aux_vm_config),
Err(VmConfigError::IncompatibleBalloonSize)
);
// mem_size_mib compatible with balloon size.
aux_vm_config.mem_size_mib = Some(256);
assert!(vm_resources.set_vm_config(&aux_vm_config).is_ok());
} | rust_cleaned_test_functions.jsonl/18862 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 977
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
39008,
5332,
368,
341,
286,
1077,
5206,
10995,
35569,
284,
1638,
39008,
35569,
543,
286,
1077,
5206,
10047,
39008,
5332,
284,
647,
76,
2648,
341,
310,
348,
16475,
3180,
25,
4329,
7,
18,
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_dictionary_array_fmt_debug() {
let key_builder = PrimitiveBuilder::<UInt8Type>::new(3);
let value_builder = PrimitiveBuilder::<UInt32Type>::new(2);
let mut builder = PrimitiveDictionaryBuilder::new(key_builder, value_builder);
builder.append(12345678).unwrap();
builder.append_null().unwrap();
builder.append(22345678).unwrap();
let array = builder.finish();
assert_eq!(
"DictionaryArray {keys: [Some(0), None, Some(1)] values: PrimitiveArray<UInt32>\n[\n 12345678,\n 22345678,\n]}\n",
format!("{:?}", array)
);
let key_builder = PrimitiveBuilder::<UInt8Type>::new(20);
let value_builder = PrimitiveBuilder::<UInt32Type>::new(2);
let mut builder = PrimitiveDictionaryBuilder::new(key_builder, value_builder);
for _ in 0..20 {
builder.append(1).unwrap();
}
let array = builder.finish();
assert_eq!(
"DictionaryArray {keys: [Some(0), Some(0), Some(0), Some(0), Some(0), Some(0), Some(0), Some(0), Some(0), Some(0)]... values: PrimitiveArray<UInt32>\n[\n 1,\n]}\n",
format!("{:?}", array)
);
} | rust_cleaned_test_functions.jsonl/11641 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 566
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42605,
3858,
38128,
15446,
368,
341,
286,
1077,
1376,
28532,
284,
51460,
3297,
27638,
18777,
23,
929,
6831,
931,
7,
18,
317,
286,
1077,
897,
28532,
284,
51460,
3297,
27638,
18777,
18,
17,
929,
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... | 2 |
#[test]
fn test_simultaneous_peer_connections() -> Result<(), Error> {
let mut exec = fasync::Executor::new_with_fake_time().expect("executor should build");
exec.set_fake_time(fasync::Time::from_nanos(5_000000000));
let id = PeerId(123);
let (peer_handle, _target_delegate, mut profile_requests) = setup_remote_peer(id)?;
// Set the descriptor to simulate service found for peer.
peer_handle.set_target_descriptor(AvrcpService::Target {
features: AvcrpTargetFeatures::CATEGORY1,
psm: PSM_AVCTP,
protocol_version: AvrcpProtocolVersion(1, 6),
});
assert!(!peer_handle.is_connected());
let next_request_fut = profile_requests.next();
pin_mut!(next_request_fut);
assert!(exec.run_until_stalled(&mut next_request_fut).is_pending());
// Advance time by the maximum amount of time it would take to establish a connection.
exec.set_fake_time(MAX_CONNECTION_EST_TIME.after_now());
exec.wake_expired_timers();
// We expect to initiate an outbound connection through the profile server.
let (remote, channel) = Channel::create();
match exec.run_until_stalled(&mut next_request_fut) {
Poll::Ready(Some(Ok(ProfileRequest::Connect { responder, .. }))) => {
responder.send(&mut Ok(channel.into())).expect("FIDL response should work");
}
x => panic!("Expected Profile connection request to be ready, got {:?} instead.", x),
};
let _ = exec.run_until_stalled(&mut futures::future::pending::<()>());
assert!(peer_handle.is_connected());
// Should be able to send data over the channel.
match remote.as_ref().write(&[0; 1]) {
Ok(1) => {}
x => panic!("Expected data write but got {:?} instead", x),
}
// Advance time by LESS than the CONNECTION_THRESHOLD amount.
let advance_time = CONNECTION_THRESHOLD.into_nanos() - 100;
exec.set_fake_time(advance_time.nanos().after_now());
exec.wake_expired_timers();
// Simulate inbound connection.
let (remote2, channel2) = Channel::create();
let reconnect_peer = AvcPeer::new(channel2);
peer_handle.set_control_connection(reconnect_peer);
// Run to update watcher state.
let _ = exec.run_until_stalled(&mut futures::future::pending::<()>());
// Both the inbound and outbound-initiated channels should be dropped.
// Sending data should not work.
match remote.as_ref().write(&[0; 1]) {
Err(zx::Status::PEER_CLOSED) => {}
x => panic!("Expected PEER_CLOSED but got {:?}", x),
}
match remote2.as_ref().write(&[0; 1]) {
Err(zx::Status::PEER_CLOSED) => {}
x => panic!("Expected PEER_CLOSED but got {:?}", x),
}
// We expect to attempt to reconnect.
// Advance time by the maximum amount of time it would take to establish
// a connection.
exec.set_fake_time(MAX_CONNECTION_EST_TIME.after_now());
exec.wake_expired_timers();
let (remote3, channel3) = Channel::create();
match exec.run_until_stalled(&mut next_request_fut) {
Poll::Ready(Some(Ok(ProfileRequest::Connect { responder, .. }))) => {
responder.send(&mut Ok(channel3.into())).expect("FIDL response should work");
}
x => panic!("Expected Profile connection request to be ready, got {:?} instead.", x),
};
// Run to update watcher state.
let _ = exec.run_until_stalled(&mut futures::future::pending::<()>());
assert!(peer_handle.is_connected());
// New channel should be good to go.
match remote3.as_ref().write(&[0; 1]) {
Ok(1) => {}
x => panic!("Expected successful write but got {:?}", x),
}
Ok(())
} | rust_cleaned_test_functions.jsonl/2687 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1711
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18314,
494,
17666,
45159,
56402,
368,
1464,
5714,
68843,
4600,
29,
341,
286,
1077,
5206,
3883,
284,
282,
7692,
486,
25255,
486,
931,
6615,
56881,
3009,
1005,
17119,
445,
80787,
1265,
1936,
797,
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... | 8 |
#[test]
fn test_dot_prod() {
let vec_a = Vec2::new(1.0, -4.0);
let vec_b = Vec2::new(5.0, -7.0);
let ans = vec_a * vec_b;
assert_approx_eq!(ans, 5.0 + 28.0);
} | rust_cleaned_test_functions.jsonl/77725 | {
"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,
30941,
34984,
368,
341,
286,
1077,
7486,
4306,
284,
11312,
17,
486,
931,
7,
16,
13,
15,
11,
481,
19,
13,
15,
317,
286,
1077,
7486,
880,
284,
11312,
17,
486,
931,
7,
20,
13,
15,
11,
481,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_and_reg_value() {
let compiled = compile("SET B 255\nAND B 345");
let out_cpu = test_program(compiled);
assert_eq!(out_cpu.a.value, 0);
assert_eq!(out_cpu.b.value, 89);
assert_eq!(out_cpu.c.value, 0);
assert_eq!(out_cpu.f.value, 0);
} | rust_cleaned_test_functions.jsonl/63162 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 133
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8378,
4920,
3142,
368,
341,
262,
1077,
19697,
284,
19192,
445,
5884,
425,
220,
17,
20,
20,
1699,
3976,
425,
220,
18,
19,
20,
797,
262,
1077,
700,
21795,
284,
1273,
25096,
30008,
2181,
626,
262... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_zero_rand_range() {
task_rng().gen_bigint_range(&FromPrimitive::from_int(54).unwrap(),
&FromPrimitive::from_int(54).unwrap());
} | rust_cleaned_test_functions.jsonl/96940 | {
"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,
19359,
33864,
9698,
368,
341,
286,
3383,
66849,
1005,
4370,
36386,
396,
9698,
2099,
3830,
33313,
486,
1499,
4042,
7,
20,
19,
568,
15454,
3148,
1920,
609,
3830,
33313,
486,
1499,
4042,
7,
20,
19,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_that_golang_code_compiles_with_bincode() {
let config =
CodeGeneratorConfig::new("main".to_string()).with_encodings(vec![Encoding::Bincode]);
test_that_golang_code_compiles_with_config(&config);
} | rust_cleaned_test_functions.jsonl/88347 | {
"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,
70197,
1889,
37287,
4136,
18177,
3658,
6615,
21816,
1851,
368,
341,
262,
1077,
2193,
4035,
286,
6119,
12561,
2648,
486,
931,
445,
3817,
3263,
983,
3904,
6011,
4197,
13781,
58335,
25592,
20703,
14690... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_insert_at_length() {
let mut v = ArrayVec::<[_; 8]>::new();
let result1 = v.try_insert(0, "a");
let result2 = v.try_insert(1, "b");
assert!(result1.is_ok() && result2.is_ok());
assert_eq!(&v[..], &["a", "b"]);
} | rust_cleaned_test_functions.jsonl/36788 | {
"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,
17678,
3752,
5118,
368,
341,
262,
1077,
5206,
348,
284,
2910,
10050,
27638,
13496,
26,
220,
23,
60,
6831,
931,
543,
262,
1077,
1102,
16,
284,
348,
48779,
17678,
7,
15,
11,
330,
64,
797,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_parse_invalid_fstring() {
assert_eq!(parse_fstring("{"), Err(UnclosedLbrace));
assert_eq!(parse_fstring("}"), Err(UnopenedRbrace));
// TODO: check for InvalidExpression enum?
assert!(parse_fstring("{class}").is_err());
} | rust_cleaned_test_functions.jsonl/38365 | {
"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,
21039,
31433,
761,
917,
368,
341,
286,
2060,
10714,
10297,
6400,
761,
917,
13976,
3975,
15495,
12317,
1016,
9259,
43,
31237,
1106,
286,
2060,
10714,
10297,
6400,
761,
917,
445,
92,
3975,
15495,
49... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invoke_context() {
const MAX_DEPTH: usize = 10;
let mut invoke_stack = vec![];
let mut accounts = vec![];
let mut metas = vec![];
for i in 0..MAX_DEPTH {
invoke_stack.push(solana_sdk::pubkey::new_rand());
accounts.push((
solana_sdk::pubkey::new_rand(),
Rc::new(RefCell::new(AccountSharedData::new(
i as u64,
1,
&invoke_stack[i],
))),
));
metas.push(AccountMeta::new(accounts[i].0, false));
}
for program_id in invoke_stack.iter() {
accounts.push((
*program_id,
Rc::new(RefCell::new(AccountSharedData::new(
1,
1,
&solana_sdk::pubkey::Pubkey::default(),
))),
));
metas.push(AccountMeta::new(*program_id, false));
}
let account_indices = (0..accounts.len()).collect::<Vec<usize>>();
let message = Message::new(
&[Instruction::new_with_bytes(invoke_stack[0], &[0], metas)],
None,
);
let mut invoke_context = ThisInvokeContext::new_mock(&accounts, &[]);
// Check call depth increases and has a limit
let mut depth_reached = 0;
for _ in 0..invoke_stack.len() {
if Err(InstructionError::CallDepth)
== invoke_context.push(
&message,
&message.instructions[0],
&[MAX_DEPTH + depth_reached],
None,
)
{
break;
}
depth_reached += 1;
}
assert_ne!(depth_reached, 0);
assert!(depth_reached < MAX_DEPTH);
// Mock each invocation
for owned_index in (1..depth_reached).rev() {
let not_owned_index = owned_index - 1;
let metas = vec![
AccountMeta::new(accounts[not_owned_index].0, false),
AccountMeta::new(accounts[owned_index].0, false),
];
let message = Message::new(
&[Instruction::new_with_bytes(
invoke_stack[owned_index],
&[0],
metas,
)],
None,
);
let write_privileges: Vec<bool> = (0..message.account_keys.len())
.map(|i| message.is_writable(i, /*demote_program_write_locks=*/ true))
.collect();
// modify account owned by the program
accounts[owned_index].1.borrow_mut().data_as_mut_slice()[0] =
(MAX_DEPTH + owned_index) as u8;
invoke_context
.verify_and_update(
&message.instructions[0],
&account_indices[not_owned_index..owned_index + 1],
&write_privileges,
)
.unwrap();
assert_eq!(
invoke_context.pre_accounts[owned_index].data()[0],
(MAX_DEPTH + owned_index) as u8
);
// modify account not owned by the program
let data = accounts[not_owned_index].1.borrow_mut().data()[0];
accounts[not_owned_index].1.borrow_mut().data_as_mut_slice()[0] =
(MAX_DEPTH + not_owned_index) as u8;
assert_eq!(
invoke_context.verify_and_update(
&message.instructions[0],
&account_indices[not_owned_index..owned_index + 1],
&write_privileges,
),
Err(InstructionError::ExternalAccountDataModified)
);
assert_eq!(invoke_context.pre_accounts[not_owned_index].data()[0], data);
accounts[not_owned_index].1.borrow_mut().data_as_mut_slice()[0] = data;
invoke_context.pop();
}
} | rust_cleaned_test_functions.jsonl/6709 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2281
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
79779,
8467,
368,
341,
286,
733,
8334,
32644,
25,
22301,
284,
220,
16,
15,
280,
286,
1077,
5206,
19873,
15528,
284,
7486,
0,
15078,
286,
1077,
5206,
9618,
284,
7486,
0,
15078,
286,
1077,
5206,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_find_all_refs_enum_var_pat() {
check(
r#"
enum En {
Variant {
field$0: u8,
}
}
fn f(e: En) {
match e {
En::Variant { field } => {}
}
}
"#,
expect![[r#"
field Field FileId(0) 32..41 32..37
FileId(0) 102..107 Read
"#]],
);
} | rust_cleaned_test_functions.jsonl/60661 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 231
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
5705,
60638,
31054,
4612,
55824,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
9018,
2925,
341,
262,
39292,
341,
286,
2070,
3,
15,
25,
575,
23,
345,
262,
456,
630,
8822,
282,
2026,
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_priority() -> Result<(), strum::ParseError> {
assert_eq!("-2", Priority::Lowest.to_string());
assert_eq!(Priority::Lowest, Priority::from_str("-2")?);
assert_eq!("-1", Priority::Low.to_string());
assert_eq!(Priority::Low, Priority::from_str("-1")?);
assert_eq!("0", Priority::Normal.to_string());
assert_eq!(Priority::Normal, Priority::from_str("0")?);
assert_eq!("1", Priority::High.to_string());
assert_eq!(Priority::High, Priority::from_str("1")?);
assert_eq!("2", Priority::Emergency.to_string());
assert_eq!(Priority::Emergency, Priority::from_str("2")?);
Ok(())
} | rust_cleaned_test_functions.jsonl/92484 | {
"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,
38161,
368,
1464,
5714,
68843,
607,
372,
486,
14463,
1454,
29,
341,
286,
2060,
10714,
0,
13645,
17,
497,
31920,
486,
24187,
477,
2389,
3904,
1423,
286,
2060,
10714,
10297,
20555,
486,
24187,
477,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_find_requires_of_elf() {
let requires = find_requires_of_elf(Path::new("/bin/sh")).unwrap().unwrap();
assert!(requires
.iter()
.all(|v| v.contains(".so") || v == "rtld(GNU_HASH)"));
assert!(matches!(find_requires_of_elf(Path::new(file!())), Ok(None)));
} | rust_cleaned_test_functions.jsonl/81803 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
54949,
3575,
62,
490,
368,
341,
262,
1077,
7460,
284,
1477,
54949,
3575,
62,
490,
33030,
486,
931,
4283,
6863,
14688,
15197,
15454,
1005,
15454,
543,
262,
2060,
10297,
41375,
198,
286,
659,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_successors() {
let graph = create_test_graph();
assert_eq!(graph.successors(2).unwrap(), vec![&3, &4, &6]);
let empty_vertex_list: Vec<&usize> = vec![];
assert_eq!(graph.successors(6).unwrap(), empty_vertex_list);
// vertex 7 does not exist
assert!(graph.successors(7).is_err());
} | rust_cleaned_test_functions.jsonl/1474 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 168
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18632,
1087,
368,
341,
286,
1077,
4771,
284,
1855,
4452,
14738,
1428,
286,
2060,
10714,
10297,
4439,
15426,
1087,
7,
17,
568,
15454,
1507,
7486,
20703,
5,
18,
11,
609,
19,
11,
609,
21,
10149,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_squaring() {
let a = Fp([
0xd215_d276_8e83_191b,
0x5085_d80f_8fb2_8261,
0xce9a_032d_df39_3a56,
0x3e9c_4fff_2ca0_c4bb,
0x6436_b6f7_f4d9_5dfb,
0x1060_6628_ad4a_4d90,
]);
let b = Fp([
0x33d9_c42a_3cb3_e235,
0xdad1_1a09_4c4c_d455,
0xa2f1_44bd_729a_aeba,
0xd415_0932_be9f_feac,
0xe27b_c7c4_7d44_ee50,
0x14b6_a78d_3ec7_a560,
]);
assert_eq!(a.square(), b);
} | rust_cleaned_test_functions.jsonl/23228 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 360
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
446,
3249,
368,
341,
262,
1077,
264,
284,
434,
79,
8956,
286,
220,
15,
9703,
17,
16,
20,
814,
17,
22,
21,
62,
23,
68,
23,
18,
62,
16,
24,
16,
65,
345,
286,
220,
15,
87,
20,
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_verify_slice1() {
solana_logger::setup();
let zero = Hash::default();
let one = hash(&zero.as_ref());
assert_eq!(vec![][..].verify(&zero), true); // base case
assert_eq!(vec![Entry::new_tick(0, &zero)][..].verify(&zero), true); // singleton case 1
assert_eq!(vec![Entry::new_tick(0, &zero)][..].verify(&one), false);
assert_eq!(
vec![next_entry(&zero, 0, vec![]); 2][..].verify(&zero),
true
); // inductive step
let mut bad_ticks = vec![next_entry(&zero, 0, vec![]); 2];
bad_ticks[1].hash = one;
assert_eq!(bad_ticks.verify(&zero), false);
} | rust_cleaned_test_functions.jsonl/36333 | {
"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,
35638,
26488,
16,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
7168,
284,
6531,
486,
2258,
543,
286,
1077,
825,
284,
5175,
2099,
14154,
5357,
7793,
1423,
286,
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... | 1 |
#[test]
fn test_simple_write_bits() {
let mut val: u32 = 0;
// Test a couple of successive ranges
assert!(
val.write_bits_in_range(
&BitRange {
msb_index: 3,
lsb_index: 2
},
0b00
) == &0b0000
);
assert!(
val.write_bits_in_range(
&BitRange {
msb_index: 4,
lsb_index: 2
},
0b100
) == &0b10000
);
assert!(
val.write_bits_in_range(
&BitRange {
msb_index: 5,
lsb_index: 2
},
0b0100
) == &0b01_0000
);
assert!(
val.write_bits_in_range(
&BitRange {
msb_index: 6,
lsb_index: 2
},
0b0_0100
) == &0b001_0000
);
assert!(
val.write_bits_in_range(
&BitRange {
msb_index: 7,
lsb_index: 2
},
0b00_0100
) == &0b0001_0000
);
assert!(
val.write_bits_in_range(
&BitRange {
msb_index: 8,
lsb_index: 2
},
0b100_0100
) == &0b1_0001_0000
);
assert!(
val.write_bits_in_range(
&BitRange {
msb_index: 9,
lsb_index: 2
},
0b0100_0100
) == &0b01_0001_0000
);
assert!(
val.write_bits_in_range(
&BitRange {
msb_index: 10,
lsb_index: 2
},
0b1_0100_0100
) == &0b101_0001_0000
);
assert!(
val.write_bits_in_range(
&BitRange {
msb_index: 11,
lsb_index: 2
},
0b01_0100_0100
) == &0b0101_0001_0000
);
assert!(
val.write_bits_in_range(
&BitRange {
msb_index: 12,
lsb_index: 2
},
0b101_0100_0100
) == &0b1_0101_0001_0000
);
assert!(
val.write_bits_in_range(
&BitRange {
msb_index: 13,
lsb_index: 2
},
0b1101_0100_0100
) == &0b11_0101_0001_0000
);
// Test max left and max right
val = 0;
assert!(
val.write_bits_in_range(
&BitRange {
msb_index: 31,
lsb_index: 15
},
0b1_0000_0000_0000_0000
) == &0b1000_0000_0000_0000_0000_0000_0000_0000
);
assert!(
val.write_bits_in_range(
&BitRange {
msb_index: 14,
lsb_index: 0
},
0b011_0101_0001_0000
) == &0b1000_0000_0000_0000_0011_0101_0001_0000
);
assert!(
val.write_bits_in_range(
&BitRange {
msb_index: 31,
lsb_index: 0
},
0b1000_0000_0000_0000_0011_0101_0001_0000
) == &0b1000_0000_0000_0000_0011_0101_0001_0000
);
} | rust_cleaned_test_functions.jsonl/4123 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2590
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
9165,
20034,
368,
341,
286,
1077,
5206,
1044,
25,
575,
18,
17,
284,
220,
15,
401,
286,
442,
3393,
264,
5625,
315,
48924,
21283,
198,
286,
2060,
33673,
310,
1044,
3836,
20034,
1243,
9698,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_range_step_by() {
let mut args = HashMap::new();
args.insert("end".to_string(), to_value(10).unwrap());
args.insert("step_by".to_string(), to_value(2).unwrap());
let res = make_range_fn()(args).unwrap();
assert_eq!(res, to_value(vec![0,2,4,6,8]).unwrap());
} | rust_cleaned_test_functions.jsonl/307 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 157
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9698,
11946,
3710,
368,
341,
286,
1077,
5206,
2827,
284,
10528,
486,
931,
543,
286,
2827,
7030,
445,
408,
3263,
983,
3904,
1507,
311,
3142,
7,
16,
15,
568,
15454,
1423,
286,
2827,
7030,
445,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_proof() {
let mut vrf = ECVRF::from_suite(CipherSuite::P256_SHA256_TAI).unwrap();
let pi_hex = hex::decode("029bdca4cc39e57d97e2f42f88bcf0ecb1120fb67eb408a856050dbfbcbf57c524347fc46ccd87843ec0a9fdc090a407c6fbae8ac1480e240c58854897eabbc3a7bb61b201059f89186e7175af796d65e7")
.unwrap();
let (derived_gamma, derived_c, _) = vrf.decode_proof(&pi_hex).unwrap();
// Expected values
let mut gamma_hex = pi_hex.clone();
let c_s_hex = gamma_hex.split_off(33);
let mut c_hex = c_s_hex.clone();
c_hex.split_off(16);
let expected_gamma = EcPoint::from_bytes(&vrf.group, &gamma_hex, &mut vrf.bn_ctx).unwrap();
let expected_c = BigNum::from_slice(c_hex.as_slice()).unwrap();
assert!(derived_c.eq(&expected_c));
assert!(expected_gamma
.eq(&vrf.group, &derived_gamma, &mut vrf.bn_ctx)
.unwrap());
} | rust_cleaned_test_functions.jsonl/112467 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 489
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
86757,
368,
341,
286,
1077,
5206,
348,
8052,
284,
468,
19589,
17612,
486,
1499,
57239,
3025,
10558,
28000,
486,
47,
17,
20,
21,
38096,
17,
20,
21,
1139,
15469,
568,
15454,
1428,
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... | 1 |
#[test]
fn test_only_non_exhaustive() {
struct Foo;
impl Debug for Foo {
fn fmt(&self, fmt: &mut Formatter) {
fmt.debug_struct("Foo").finish_non_exhaustive()
}
}
assert_eq!("Foo { .. }", debug3::pprint(Foo));
assert_eq!("Foo { .. }", debug3::pprint(Foo));
} | rust_cleaned_test_functions.jsonl/124737 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18410,
21637,
2702,
15074,
533,
368,
341,
286,
2036,
33428,
401,
286,
11605,
11091,
369,
33428,
341,
310,
5168,
8879,
2099,
721,
11,
8879,
25,
609,
6984,
81387,
8,
341,
394,
8879,
7883,
15126,
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_230() {
assert_eq!(
Solution::kth_smallest(to_tree(vec![Some(3), Some(1), Some(4), None, Some(2)]), 1),
1
);
assert_eq!(
Solution::kth_smallest(to_tree(vec![
Some(5),
Some(3),
Some(6),
Some(2),
Some(4),
None,
None,
Some(1)
]), 3),
3
);
} | rust_cleaned_test_functions.jsonl/121811 | {
"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,
62,
17,
18,
15,
368,
341,
286,
2060,
10714,
33673,
310,
12478,
486,
74,
339,
15874,
19236,
12186,
11663,
25592,
20703,
8373,
7,
18,
701,
4329,
7,
16,
701,
4329,
7,
19,
701,
2240,
11,
4329,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ikkagetsu() {
let mut tokenizer = Tokenizer::new().unwrap();
let tokens: Vec<&str> = tokenizer.tokenize_str("ーヶ月").unwrap();
assert_eq!(tokens, vec!["ーヶ", "月"]);
} | rust_cleaned_test_functions.jsonl/61440 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 106
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
29887,
351,
1415,
84,
368,
341,
286,
1077,
5206,
45958,
284,
9660,
3135,
486,
931,
1005,
15454,
543,
286,
1077,
11211,
25,
11312,
52244,
495,
29,
284,
45958,
96790,
2895,
445,
24041,
114,
97... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_ecrecover() {
let input = hex::decode("47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad000000000000000000000000000000000000000000000000000000000000001b650acf9d3f5f0a2c799776a1254355d5f4061762a237396a99a0e0e3fc2bcd6729514a0dacb2e623ac4abd157cb18163ff942280db4d5caad66ddf941ba12e03").unwrap();
let expected =
hex::decode("000000000000000000000000c08b5542d177ac6686946920409741463a15dddb")
.unwrap();
let res = ECRecover::run(&input, 3_000, &new_context(), false)
.unwrap()
.output;
assert_eq!(res, expected);
// out of gas
let input = hex::decode("47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad000000000000000000000000000000000000000000000000000000000000001b650acf9d3f5f0a2c799776a1254355d5f4061762a237396a99a0e0e3fc2bcd6729514a0dacb2e623ac4abd157cb18163ff942280db4d5caad66ddf941ba12e03").unwrap();
let res = ECRecover::run(&input, 2_999, &new_context(), false);
assert!(matches!(res, Err(ExitError::OutOfGas)));
// bad inputs
let input = hex::decode("47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad000000000000000000000000000000000000000000000000000000000000001a650acf9d3f5f0a2c799776a1254355d5f4061762a237396a99a0e0e3fc2bcd6729514a0dacb2e623ac4abd157cb18163ff942280db4d5caad66ddf941ba12e03").unwrap();
let expected =
hex::decode("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")
.unwrap();
let res = ECRecover::run(&input, 3_000, &new_context(), false)
.unwrap()
.output;
assert_eq!(res, expected);
let input = hex::decode("47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad000000000000000000000000000000000000000000000000000000000000001b000000000000000000000000000000000000000000000000000000000000001b0000000000000000000000000000000000000000000000000000000000000000").unwrap();
let expected =
hex::decode("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")
.unwrap();
let res = ECRecover::run(&input, 3_000, &new_context(), false)
.unwrap()
.output;
assert_eq!(res, expected);
let input = hex::decode("47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad000000000000000000000000000000000000000000000000000000000000001b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b").unwrap();
let expected =
hex::decode("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")
.unwrap();
let res = ECRecover::run(&input, 3_000, &new_context(), false)
.unwrap()
.output;
assert_eq!(res, expected);
let input = hex::decode("47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad000000000000000000000000000000000000000000000000000000000000001bffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000000000000000000000000000000000000000000000000000001b").unwrap();
let expected =
hex::decode("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")
.unwrap();
let res = ECRecover::run(&input, 3_000, &new_context(), false)
.unwrap()
.output;
assert_eq!(res, expected);
// Why is this test returning an address???
} | rust_cleaned_test_functions.jsonl/46390 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1544
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36844,
74283,
368,
341,
286,
1077,
1946,
284,
12371,
486,
18196,
445,
19,
22,
16,
22,
18,
17,
23,
20,
64,
23,
67,
22,
18,
19,
16,
68,
20,
68,
24,
22,
17,
8316,
21,
22,
22,
17,
23,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_keepalive_check() {
let mut tikv_cfg = TiKvConfig::default();
tikv_cfg.pd.endpoints = vec!["".to_owned()];
let dur = tikv_cfg.raft_store.raft_heartbeat_interval();
tikv_cfg.server.grpc_keepalive_time = ReadableDuration(dur);
assert!(tikv_cfg.validate().is_err());
tikv_cfg.server.grpc_keepalive_time = ReadableDuration(dur * 2);
tikv_cfg.validate().unwrap();
} | rust_cleaned_test_functions.jsonl/2149 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 216
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
50293,
50961,
7200,
368,
341,
286,
1077,
5206,
86172,
85,
18343,
284,
22325,
42,
85,
2648,
486,
2258,
543,
286,
86172,
85,
18343,
556,
67,
5073,
7706,
284,
7486,
0,
1183,
3263,
983,
51973,
33800... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_quota_price() {
let executor = init_executor();
let price_management = PriceManagement::new(&executor);
let price = price_management
.quota_price(BlockTag::Tag(Tag::Pending))
.unwrap();
assert_eq!(price, U256::from(100_0000));
} | rust_cleaned_test_functions.jsonl/98779 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 145
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
97093,
9040,
368,
341,
286,
1077,
31558,
284,
2930,
81207,
543,
286,
1077,
3349,
45363,
284,
8483,
22237,
486,
931,
2099,
80787,
317,
286,
1077,
3349,
284,
3349,
45363,
198,
310,
659,
92604,
9040,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_config_version() {
let yaml_string = "sorting:\n column: version";
let yaml = YamlLoader::load_from_str(yaml_string).unwrap()[0].clone();
assert_eq!(
Some(SortColumn::Version),
SortColumn::from_config(&Config::with_yaml(yaml))
);
} | rust_cleaned_test_functions.jsonl/54303 | {
"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,
5673,
5332,
9438,
368,
341,
286,
1077,
32246,
3904,
284,
330,
67039,
7190,
77,
220,
3250,
25,
2319,
876,
286,
1077,
32246,
284,
809,
9467,
9181,
486,
1078,
5673,
2895,
7021,
9467,
3904,
568,
154... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_broadcast()
{
let mut server1 = TipcConn::new(SockType::SockRdm).unwrap();
server1
.join(SERVER_ADDR, SERVER_INST, SERVER_SCOPE)
.unwrap();
let mut server2 = TipcConn::new(SockType::SockRdm).unwrap();
server2
.join(SERVER_ADDR, SERVER_INST + 1, SERVER_SCOPE)
.unwrap();
// Both servers receive a message for each other's join
assert_message_received(&server1, "").unwrap();
assert_message_received(&server2, "").unwrap();
let mut client = TipcConn::new(SockType::SockRdm).unwrap();
client.join(CLIENT_ADDR, CLIENT_INST, CLIENT_SCOPE).unwrap();
// Servers receive message for client joining
assert_message_received(&server1, "").unwrap();
assert_message_received(&server2, "").unwrap();
let bytes_sent = client.broadcast(TEST_MESSAGE.as_bytes()).unwrap();
assert_eq!(bytes_sent as usize, TEST_MESSAGE.len());
assert_message_received(&server1, TEST_MESSAGE).unwrap();
assert_message_received(&server2, TEST_MESSAGE).unwrap();
} | rust_cleaned_test_functions.jsonl/29798 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 421
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74923,
741,
515,
262,
1077,
5206,
3538,
16,
284,
29873,
66,
9701,
486,
931,
3759,
1176,
929,
486,
79812,
49,
13849,
568,
15454,
543,
262,
3538,
16,
198,
286,
659,
5987,
3759,
8417,
16058,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ref_store_u64() {
let start_addr1 = GuestAddress(0x0);
let start_addr2 = GuestAddress(0x1000);
let gm = GuestMemory::new(&[(start_addr1, 0x1000), (start_addr2, 0x1000)]).unwrap();
let val1: u64 = 0xaa55aa55aa55aa55;
let val2: u64 = 0x55aa55aa55aa55aa;
gm.get_ref_at_addr(GuestAddress(0x500)).unwrap().store(val1);
gm.get_ref_at_addr(GuestAddress(0x1000 + 32))
.unwrap()
.store(val2);
let num1: u64 = gm.read_obj_from_addr(GuestAddress(0x500)).unwrap();
let num2: u64 = gm.read_obj_from_addr(GuestAddress(0x1000 + 32)).unwrap();
assert_eq!(val1, num1);
assert_eq!(val2, num2);
} | rust_cleaned_test_functions.jsonl/67403 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 371
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7793,
14809,
7300,
21,
19,
368,
341,
286,
1077,
1191,
7387,
16,
284,
26215,
4286,
7,
15,
87,
15,
317,
286,
1077,
1191,
7387,
17,
284,
26215,
4286,
7,
15,
87,
16,
15,
15,
15,
317,
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... | 1 |
#[test]
fn test_usable_for_version() {
fn ok_tls13(scs: &SupportedCipherSuite) {
assert!(!scs.usable_for_version(ProtocolVersion::TLSv1_0));
assert!(!scs.usable_for_version(ProtocolVersion::TLSv1_2));
assert!(scs.usable_for_version(ProtocolVersion::TLSv1_3));
}
fn ok_tls12(scs: &SupportedCipherSuite) {
assert!(!scs.usable_for_version(ProtocolVersion::TLSv1_0));
assert!(scs.usable_for_version(ProtocolVersion::TLSv1_2));
assert!(!scs.usable_for_version(ProtocolVersion::TLSv1_3));
}
ok_tls13(&TLS13_CHACHA20_POLY1305_SHA256);
ok_tls13(&TLS13_AES_256_GCM_SHA384);
ok_tls13(&TLS13_AES_128_GCM_SHA256);
ok_tls12(&TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256);
ok_tls12(&TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256);
ok_tls12(&TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384);
ok_tls12(&TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256);
ok_tls12(&TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384);
} | rust_cleaned_test_functions.jsonl/3963 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 588
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11306,
480,
5478,
9438,
368,
341,
286,
5168,
5394,
71262,
16,
18,
1141,
4837,
25,
609,
34636,
79460,
28000,
8,
341,
310,
2060,
0,
3471,
2388,
82,
21916,
480,
5478,
9438,
7,
20689,
5637,
486,
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_extended2() {
let cmd = RelayCmd::EXTENDED2;
assert_eq!(Into::<u8>::into(cmd), 15_u8);
let body = "0040 0026619058EB2661834D54C2624828728F28915587CDAD1AD3373B85F33A480EEA9D3B2CEF8D39C1DBD2FA519E75296B96960690C79A28D6A0D9454F8E9634BD";
let handshake = hex::decode("0026619058EB2661834D54C2624828728F28915587CDAD1AD3373B85F33A480EEA9D3B2CEF8D39C1DBD2FA519E75296B96960690C79A28D6A0D9454F8E9634BD").unwrap();
msg(cmd, body, &msg::Extended2::new(handshake).into());
} | rust_cleaned_test_functions.jsonl/66345 | {
"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,
61678,
17,
368,
341,
262,
1077,
5439,
284,
46172,
15613,
486,
5722,
44162,
17,
280,
262,
2060,
10714,
10297,
26591,
27638,
84,
23,
6831,
18122,
14160,
701,
220,
16,
20,
7300,
23,
626,
262,
1077,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iterate_string_vec() {
let words = vec!["hello", "world"];
let capitalized_words: Vec<String> =
words.into_iter().map(|x| capitalize_first(x)).collect();
assert_eq!(capitalized_words, ["Hello", "World"]);
} | rust_cleaned_test_functions.jsonl/3706 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
349,
3904,
13251,
368,
341,
286,
1077,
4244,
284,
7486,
0,
1183,
14990,
497,
330,
14615,
6332,
286,
1077,
97321,
18981,
25,
11312,
3464,
29,
4035,
310,
4244,
39860,
11723,
1005,
2186,
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_run_hello_cpu() {
run_cpu_only("../roms/other/hello.nes".to_string(), 175, |cpu, _sys| {
// 170step以降はJMPで無限ループしているはず
assert_eq!(0x804e, cpu.pc);
assert_eq!(0x01ff, cpu.sp);
assert_eq!(0x1e, cpu.a);
assert_eq!(0x0d, cpu.x);
assert_eq!(0x00, cpu.y);
assert_eq!(0x34, cpu.p);
})
} | rust_cleaned_test_functions.jsonl/66833 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 265
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14007,
96724,
21795,
368,
341,
286,
1598,
21795,
18410,
17409,
441,
82,
14,
1575,
7530,
4791,
1253,
288,
3263,
983,
3904,
1507,
220,
16,
22,
20,
11,
760,
16475,
11,
716,
7791,
91,
341,
310,
44... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_10minutely() -> Result<()> {
assert_eq!("_10minutely".to_camel_case_id(), "N10minutely");
Ok(())
} | rust_cleaned_test_functions.jsonl/2029 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 73
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
16,
15,
1065,
97366,
368,
1464,
5714,
71698,
341,
286,
2060,
10714,
0,
16975,
16,
15,
1065,
97366,
3263,
983,
666,
35562,
19096,
842,
1507,
330,
45,
16,
15,
1065,
97366,
797,
286,
7622,
50... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_legal_moves_banmen_with_kei_jump_over_wall_self_sente() {
let mut answer:Vec<Vec<((u32,u32),(u32,u32,bool),Option<ObtainKind>)>> = Vec::new();
answer.push((0..18).into_iter().map(|x| {
((x / 2,2),(x / 2,1,(x % 2 == 0)),None)
}).collect::<Vec<((u32,u32),(u32,u32,bool),Option<ObtainKind>)>>());
answer[0].push(((1,3),(0,1,true),None));
answer[0].push(((1,3),(2,1,true),None));
answer.push((0..18).into_iter().map(|x| {
((x / 2,2),(x / 2,1,(x % 2 == 0)),None)
}).collect::<Vec<((u32,u32),(u32,u32,bool),Option<ObtainKind>)>>());
answer[1].push(((7,3),(6,1,true),None));
answer[1].push(((7,3),(8,1,true),None));
const POSITIONS:[(usize,usize); 2] = [
(1,3),(7,3)
];
let answer = answer.into_iter().map(|mvs| {
mvs.into_iter().map(|m| {
match m {
((sx,sy),(dx,dy,nari),o) => {
LegalMove::from(((sx,sy),(dx,dy,nari),o))
}
}
}).collect::<Vec<LegalMove>>()
}).collect::<Vec<Vec<LegalMove>>>();
let blank_banmen = Banmen([[Blank; 9]; 9]);
for (a,p) in answer.iter().zip(&POSITIONS) {
let mut banmen = blank_banmen.clone();
banmen.0[p.1][p.0] = SKei;
for x in 0..9 {
banmen.0[2][x] = SFu;
}
assert_eq!(
a,
&Rule::legal_moves_from_banmen(Teban::Sente,&State::new(banmen.clone())).into_iter().map(|m| {
LegalMove::from(m)
}).collect::<Vec<LegalMove>>()
)
}
} | rust_cleaned_test_functions.jsonl/81209 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 757
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82324,
45390,
880,
276,
5676,
6615,
45476,
72,
65436,
15431,
50731,
25637,
643,
6817,
368,
972,
10217,
5206,
4226,
25,
10050,
50439,
27,
1188,
84,
18,
17,
36883,
18,
17,
23547,
84,
18,
17,
36883... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_reset_clear_bank() {
let ledger_path = get_tmp_ledger_path!();
{
let blocktree =
Blocktree::open(&ledger_path).expect("Expected to be able to open database ledger");
let GenesisBlockInfo { genesis_block, .. } = create_genesis_block(2);
let bank = Arc::new(Bank::new(&genesis_block));
let (mut poh_recorder, _entry_receiver) = PohRecorder::new(
0,
Hash::default(),
0,
Some((4, 4)),
bank.ticks_per_slot(),
&Pubkey::default(),
&Arc::new(blocktree),
&Arc::new(LeaderScheduleCache::new_from_bank(&bank)),
&Arc::new(PohConfig::default()),
);
let working_bank = WorkingBank {
bank,
min_tick_height: 2,
max_tick_height: 3,
};
poh_recorder.set_working_bank(working_bank);
poh_recorder.reset(hash(b"hello"), 0, Some((4, 4)));
assert!(poh_recorder.working_bank.is_none());
}
Blocktree::destroy(&ledger_path).unwrap();
} | rust_cleaned_test_functions.jsonl/31729 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 654
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18983,
21811,
35733,
368,
341,
286,
1077,
46933,
2638,
284,
633,
16125,
38367,
1389,
2638,
0,
543,
286,
341,
310,
1077,
2504,
9344,
4035,
394,
8362,
9344,
486,
2508,
2099,
50704,
2638,
568,
17119,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_normal_string() {
let input = "ab";
let ansistring = ANSIParser::default().parse_ansi(input);
assert_eq!(false, ansistring.has_attrs());
let mut it = ansistring.iter();
assert_eq!(Some(('a', Attr::default())), it.next());
assert_eq!(Some(('b', Attr::default())), it.next());
assert_eq!(None, it.next());
assert_eq!(ansistring.stripped(), "ab");
} | rust_cleaned_test_functions.jsonl/92163 | {
"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,
13973,
3904,
368,
341,
286,
1077,
1946,
284,
330,
370,
876,
286,
1077,
8099,
73756,
284,
2100,
50,
3298,
10425,
486,
2258,
1005,
6400,
62,
52067,
5384,
626,
286,
2060,
10714,
10297,
3849,
11,
80... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_isolation_multi_inc() {
const THREAD_NUM: usize = 4;
const KEY_NUM: usize = 4;
const INC_PER_THREAD: usize = 100;
let store = AssertionStorage::default();
let oracle = Arc::new(Oracle::new());
let mut threads = vec![];
for _ in 0..THREAD_NUM {
let (store, oracle) = (store.clone(), Arc::clone(&oracle));
threads.push(thread::spawn(move || {
for _ in 0..INC_PER_THREAD {
assert!(inc_multi(&store.store, &oracle, KEY_NUM));
}
}));
}
for t in threads {
t.join().unwrap();
}
for n in 0..KEY_NUM {
assert_eq!(
inc(&store.store, &oracle, &format_key(n)).unwrap() as usize,
THREAD_NUM * INC_PER_THREAD
);
}
} | rust_cleaned_test_functions.jsonl/37895 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 388
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
34962,
25133,
31285,
368,
341,
262,
733,
56515,
9631,
25,
22301,
284,
220,
19,
280,
262,
733,
12013,
9631,
25,
22301,
284,
220,
19,
280,
262,
733,
18118,
10617,
27087,
25,
22301,
284,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_unit_or_does_flatten() {
let schema = prepopulated_schema();
let known = Known::for_schema(&schema);
let or_query = r#"[:find ?x
:where [?x :foo/knows ?y]
(or [?x :foo/parent ?y])]"#;
let flat_query = r#"[:find ?x
:where [?x :foo/knows ?y]
[?x :foo/parent ?y]]"#;
compare_ccs(alg(known, or_query),
alg(known, flat_query));
} | rust_cleaned_test_functions.jsonl/44230 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 344
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14832,
8734,
96374,
5081,
14456,
368,
341,
286,
1077,
10802,
284,
855,
8374,
7757,
25371,
543,
286,
1077,
3881,
284,
48286,
486,
1958,
25371,
2099,
17349,
317,
286,
1077,
476,
5738,
284,
256,
435,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_send() {
let (sender, receiver) = channel();
thread::spawn(move || {
let rpc_addr = "0.0.0.0:0".parse().unwrap();
let mut io = IoHandler::default();
// Successful request
io.add_method("getBalance", |_params: Params| {
Ok(Value::Number(Number::from(50)))
});
// Failed request
io.add_method("getRecentBlockhash", |params: Params| {
if params != Params::None {
Err(Error::invalid_request())
} else {
Ok(Value::String(
"deadbeefXjn8o3yroDHxUtKsZZgoy4GPkPPXfouKNHhx".to_string(),
))
}
});
let server = ServerBuilder::new(io)
.threads(1)
.cors(DomainsValidation::AllowOnly(vec![
AccessControlAllowOrigin::Any,
]))
.start_http(&rpc_addr)
.expect("Unable to start RPC server");
sender.send(*server.address()).unwrap();
server.wait();
});
let rpc_addr = receiver.recv().unwrap();
let rpc_client = RpcClient::new_socket(rpc_addr);
let balance: u64 = rpc_client
.send(
RpcRequest::GetBalance,
json!(["deadbeefXjn8o3yroDHxUtKsZZgoy4GPkPPXfouKNHhx"]),
)
.unwrap();
assert_eq!(balance, 50);
let blockhash: String = rpc_client
.send(RpcRequest::GetRecentBlockhash, Value::Null)
.unwrap();
assert_eq!(blockhash, "deadbeefXjn8o3yroDHxUtKsZZgoy4GPkPPXfouKNHhx");
// Send erroneous parameter
let blockhash: ClientResult<String> =
rpc_client.send(RpcRequest::GetRecentBlockhash, json!(["parameter"]));
assert_eq!(blockhash.is_err(), true);
} | rust_cleaned_test_functions.jsonl/10441 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1073
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13565,
368,
341,
286,
1077,
320,
11644,
11,
13964,
8,
284,
5496,
543,
286,
4516,
486,
46087,
34081,
1369,
341,
310,
1077,
35596,
7387,
284,
330,
15,
13,
15,
13,
15,
13,
15,
25,
15,
3263,
640... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_uuid_06() -> Result<(), Box<dyn std::error::Error>> {
use uuid_06::Uuid;
let mut test = OsoTest::new();
test.oso.register_class(Uuid::get_polar_class())?;
test.load_str("f(x: Uuid, y: Uuid) if x = y;");
let (x, y) = (Uuid::nil(), Uuid::nil());
test.oso.query_rule("f", (x, y))?.next().unwrap()?;
Ok(())
} | rust_cleaned_test_functions.jsonl/30401 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 172
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25540,
62,
15,
21,
368,
1464,
5714,
68843,
8261,
92846,
1460,
486,
841,
486,
1454,
2452,
341,
262,
990,
16040,
62,
15,
21,
486,
38431,
280,
262,
1077,
5206,
1273,
284,
506,
704,
2271,
486,
931... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_scanner() {
let scanner = Duration::default();
let mut cache = Cache::create_with_scanner(scanner);
let key: &'static str = "key";
cache.insert(key, 1, None);
let scanner = cache.get_scan_freq();
assert!(scanner.is_some())
} | rust_cleaned_test_functions.jsonl/76887 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13171,
4887,
368,
341,
262,
1077,
20775,
284,
21045,
486,
2258,
543,
262,
1077,
5206,
6500,
284,
19479,
486,
3182,
6615,
13171,
4887,
85991,
317,
262,
1077,
1376,
25,
30136,
1978,
607,
284,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_join_issue_80335() {
use core::{borrow::Borrow, cell::Cell};
struct WeirdBorrow {
state: Cell<bool>,
}
impl Default for WeirdBorrow {
fn default() -> Self {
WeirdBorrow { state: Cell::new(false) }
}
}
impl Borrow<str> for WeirdBorrow {
fn borrow(&self) -> &str {
let state = self.state.get();
if state {
"0"
} else {
self.state.set(true);
"123456"
}
}
}
let arr: [WeirdBorrow; 3] = Default::default();
test_join!("0-0-0", arr, "-");
} | rust_cleaned_test_functions.jsonl/119375 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 346
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31017,
53340,
62,
23,
15,
18,
18,
20,
368,
341,
262,
990,
6200,
22964,
71141,
486,
33,
7768,
11,
2779,
486,
3599,
2315,
262,
2036,
76153,
33,
7768,
341,
286,
1584,
25,
13972,
17028,
12520,
262... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mavro_std() {
let result = get_actual_result("test_csvs/Mavro.csv", "stddev");
assert_abs_diff_eq!(result, 0.000429123454003053, epsilon = stddev_epsilon());
} | rust_cleaned_test_functions.jsonl/80539 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 89
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
402,
299,
15656,
368,
341,
262,
1077,
1102,
284,
633,
40149,
5287,
445,
1944,
14020,
82,
10270,
402,
299,
11219,
497,
330,
1834,
3583,
797,
262,
2060,
31170,
15850,
10714,
10297,
1382,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_version_get_simple() {
let v = make_version().0;
let cases: &[(&[u8], u64, Result<Option<Vec<u8>>>)] = &[
("aaa".as_bytes(), 1, Ok(None)),
("aaa".as_bytes(), 100, Ok(Some("val1".as_bytes().to_vec()))),
("aaa".as_bytes(), 21, Ok(Some("val0".as_bytes().to_vec()))),
("aab".as_bytes(), 0, Ok(None)),
("aab".as_bytes(), 100, Ok(Some("val2".as_bytes().to_vec()))),
("aac".as_bytes(), 100, Ok(None)),
("aac".as_bytes(), 25, Ok(Some("val3".as_bytes().to_vec()))),
("aba".as_bytes(), 100, Ok(Some("val3".as_bytes().to_vec()))),
("aba".as_bytes(), 25, Ok(Some("val4".as_bytes().to_vec()))),
("daa".as_bytes(), 100, Ok(Some("val1".as_bytes().to_vec()))),
("dab".as_bytes(), 1, Ok(None)),
("dac".as_bytes(), 100, Ok(None)),
("gba".as_bytes(), 100, Ok(Some("val3".as_bytes().to_vec()))),
// deleted key
("gca".as_bytes(), 100, Ok(None)),
("gbb".as_bytes(), 100, Ok(None)),
];
for ref c in cases {
match v.get(LookupKey::new(c.0, c.1).internal_key()) {
Ok(Some((val, _))) => assert_eq!(c.2.as_ref().unwrap().as_ref().unwrap(), &val),
Ok(None) => assert!(c.2.as_ref().unwrap().as_ref().is_none()),
Err(_) => assert!(c.2.is_err()),
}
}
} | rust_cleaned_test_functions.jsonl/32969 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 790
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9438,
3062,
30015,
368,
341,
286,
1077,
348,
284,
1281,
9438,
1005,
15,
280,
286,
1077,
5048,
25,
44590,
2099,
58,
84,
23,
1125,
575,
21,
19,
11,
5714,
94150,
50439,
34837,
23,
20154,
7252,
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... | 3 |
#[test]
fn test_in_memory_trie_store() {
// Create some leaves
let leaf_1 = Trie::Leaf {
key: Bytes::from(vec![0u8, 0, 0]),
value: Bytes::from(b"val_1".to_vec()),
};
let leaf_2 = Trie::Leaf {
key: Bytes::from(vec![1u8, 0, 0]),
value: Bytes::from(b"val_2".to_vec()),
};
// Get their hashes
let leaf_1_hash = Digest::hash(&leaf_1.to_bytes().unwrap());
let leaf_2_hash = Digest::hash(&leaf_2.to_bytes().unwrap());
// Create a node
let node: Trie<Bytes, Bytes> = {
let mut pointer_block = PointerBlock::new();
pointer_block[0] = Some(Pointer::LeafPointer(leaf_1_hash));
pointer_block[1] = Some(Pointer::LeafPointer(leaf_2_hash));
let pointer_block = Box::new(pointer_block);
Trie::Node { pointer_block }
};
// Get its hash
let node_hash = Digest::hash(&node.to_bytes().unwrap());
// Create the environment and the store. For both the in-memory and
// transactions.
let env = InMemoryEnvironment::new();
let store = InMemoryTrieStore::new(&env, None);
// forget to commit the transaction.
{
// Create a read-write transaction
let mut txn = env.create_read_write_txn().unwrap();
// Put the values in the store
store.put(&mut txn, &leaf_1_hash, &leaf_1).unwrap();
store.put(&mut txn, &leaf_2_hash, &leaf_2).unwrap();
store.put(&mut txn, &node_hash, &node).unwrap();
// Here we forget to commit the transaction before it goes out of scope
}
// Now let's check to see if the values were stored
{
// Create a read transaction
let txn = env.create_read_txn().unwrap();
// Observe that nothing has been persisted to the store
for hash in vec![&leaf_1_hash, &leaf_2_hash, &node_hash].iter() {
// We need to use a type annotation here to help the compiler choose
// a suitable FromBytes instance
let maybe_trie: Option<Trie<Bytes, Bytes>> = store.get(&txn, hash).unwrap();
assert!(maybe_trie.is_none());
}
txn.commit().unwrap();
}
{
// Create a read-write transaction
let mut txn = env.create_read_write_txn().unwrap();
// Put the values in the store
store.put(&mut txn, &leaf_1_hash, &leaf_1).unwrap();
store.put(&mut txn, &leaf_2_hash, &leaf_2).unwrap();
store.put(&mut txn, &node_hash, &node).unwrap();
// Commit the transaction.
txn.commit().unwrap();
}
// Now let's check to see if the values were stored again
{
// Create a read transaction
let txn = env.create_read_txn().unwrap();
// Get the values in the store
assert_eq!(Some(leaf_1), store.get(&txn, &leaf_1_hash).unwrap());
assert_eq!(Some(leaf_2), store.get(&txn, &leaf_2_hash).unwrap());
assert_eq!(Some(node), store.get(&txn, &node_hash).unwrap());
// Commit the read transaction.
txn.commit().unwrap();
}
} | rust_cleaned_test_functions.jsonl/113731 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1638
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
19195,
3547,
645,
14809,
368,
341,
286,
442,
4230,
1045,
10901,
198,
286,
1077,
15933,
62,
16,
284,
62783,
486,
31461,
341,
310,
1376,
25,
30024,
486,
1499,
25592,
20703,
15,
84,
23,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_types() {
unpacks_to!("", Static(..));
unpacks_to!("id", Static(..));
unpacks_to!("body", Static(..));
unpacks_to!("c", Inline(..)); // "z" is a static atom
unpacks_to!("zz", Inline(..));
unpacks_to!("zzz", Inline(..));
unpacks_to!("zzzz", Inline(..));
unpacks_to!("zzzzz", Inline(..));
unpacks_to!("zzzzzz", Inline(..));
unpacks_to!("zzzzzzz", Inline(..));
unpacks_to!("zzzzzzzz", Dynamic(..));
unpacks_to!("zzzzzzzzzzzzz", Dynamic(..));
} | rust_cleaned_test_functions.jsonl/80897 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 294
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9763,
368,
341,
286,
31065,
82,
2346,
17223,
497,
23105,
56422,
1106,
286,
31065,
82,
2346,
17223,
307,
497,
23105,
56422,
1106,
286,
31065,
82,
2346,
17223,
2599,
497,
23105,
56422,
1106,
286,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_deps() {
let (input, modification) = Modification::parse(argv!["depends:13,e72b73d1-9e88"]).unwrap();
assert_eq!(input.len(), 0);
let mut deps = HashSet::new();
deps.insert(TaskId::WorkingSetId(13));
deps.insert(TaskId::PartialUuid("e72b73d1-9e88".into()));
assert_eq!(
modification,
Modification {
add_dependencies: deps,
..Default::default()
}
);
} | rust_cleaned_test_functions.jsonl/80211 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 272
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
76489,
368,
341,
286,
1077,
320,
1355,
11,
17030,
8,
284,
73855,
486,
6400,
15329,
0,
1183,
57947,
25,
16,
18,
22563,
22,
17,
65,
22,
18,
67,
16,
12,
24,
68,
23,
23,
45014,
15454,
54... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_version_info() {
let vi = InternalVersionInfo::from_str("1.2.3").unwrap();
assert_eq!(
vi,
InternalVersionInfo {
major: 1,
minor: 2,
patch: 3
}
);
} | rust_cleaned_test_functions.jsonl/118238 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 176
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9438,
3109,
368,
341,
286,
1077,
3275,
284,
15412,
5637,
1731,
486,
1499,
2895,
445,
16,
13,
17,
13,
18,
1827,
15454,
543,
286,
2060,
10714,
33673,
310,
3275,
345,
310,
15412,
5637,
1731,
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_split_to_larger_account() {
let stake_pubkey = analog_sdk::pubkey::new_rand();
let rent = Rent::default();
let rent_exempt_reserve = rent.minimum_balance(std::mem::size_of::<StakeState>());
let split_stake_pubkey = analog_sdk::pubkey::new_rand();
let signers = vec![stake_pubkey].into_iter().collect();
let meta = Meta {
authorized: Authorized::auto(&stake_pubkey),
rent_exempt_reserve,
..Meta::default()
};
let expected_rent_exempt_reserve = calculate_split_rent_exempt_reserve(
meta.rent_exempt_reserve,
std::mem::size_of::<StakeState>() as u64,
std::mem::size_of::<StakeState>() as u64 + 100,
);
let stake_lamports = expected_rent_exempt_reserve + 1;
let split_amount = stake_lamports - (rent_exempt_reserve + 1); // Enough so that split stake is > 0
let state = StakeState::Stake(meta, just_stake(stake_lamports - rent_exempt_reserve));
let split_lamport_balances = vec![
0,
1,
expected_rent_exempt_reserve,
expected_rent_exempt_reserve + 1,
];
for initial_balance in split_lamport_balances {
let split_stake_account = AccountSharedData::new_ref_data_with_space(
initial_balance,
&StakeState::Uninitialized,
std::mem::size_of::<StakeState>() + 100,
&id(),
)
.expect("stake_account");
let split_stake_keyed_account =
KeyedAccount::new(&split_stake_pubkey, true, &split_stake_account);
let stake_account = AccountSharedData::new_ref_data_with_space(
stake_lamports,
&state,
std::mem::size_of::<StakeState>(),
&id(),
)
.expect("stake_account");
let stake_keyed_account = KeyedAccount::new(&stake_pubkey, true, &stake_account);
// should always return error when splitting to larger account
let split_result =
stake_keyed_account.split(split_amount, &split_stake_keyed_account, &signers);
assert_eq!(split_result, Err(InstructionError::InvalidAccountData));
let split_result =
stake_keyed_account.split(stake_lamports, &split_stake_keyed_account, &signers);
assert_eq!(split_result, Err(InstructionError::InvalidAccountData));
}
} | rust_cleaned_test_functions.jsonl/15318 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1241
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
2346,
907,
41776,
13500,
368,
341,
286,
1077,
18279,
34014,
792,
284,
23400,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
8016,
284,
29737,
486,
2258,
543,
286,
1077,
8016,
95736... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_float_statistics_nan_start() {
let stats = statistics_roundtrip::<FloatType>(&[f32::NAN, 1.0, 2.0]);
assert!(stats.has_min_max_set());
if let Statistics::Float(stats) = stats {
assert_eq!(stats.min(), &1.0);
assert_eq!(stats.max(), &2.0);
} else {
panic!("expecting Statistics::Float");
}
} | rust_cleaned_test_functions.jsonl/54370 | {
"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,
17586,
49569,
73936,
4906,
368,
341,
286,
1077,
10472,
284,
13142,
29896,
32981,
27638,
5442,
929,
44784,
58,
69,
18,
17,
486,
45,
1093,
11,
220,
16,
13,
15,
11,
220,
17,
13,
15,
2558,
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... | 2 |
#[test]
fn test_ptrace() {
require_capability!(CAP_SYS_PTRACE);
let err = ptrace::attach(getpid()).unwrap_err();
assert!(err == Error::Sys(Errno::EPERM) || err == Error::Sys(Errno::EINVAL) ||
err == Error::Sys(Errno::ENOSYS));
} | rust_cleaned_test_functions.jsonl/92532 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 133
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4348,
578,
368,
341,
9401,
262,
1373,
89686,
10297,
31400,
26783,
20657,
5576,
317,
262,
1077,
1848,
284,
10087,
578,
486,
16330,
5433,
10412,
6011,
15454,
9266,
543,
262,
2060,
10297,
615,
621,
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... | 3 |
#[test]
fn test_error_format() {
assert_eq!(
"[line 3] Error: unterminated string",
format!("{}", Error::UnterminatedStringError { line: 3 })
);
assert_eq!(
"[line 4] Error: unexpected character '%'",
format!("{}", Error::UnexpectedCharacterError { line: 4, c: '%' })
);
} | rust_cleaned_test_functions.jsonl/92098 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 180
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4096,
8955,
368,
341,
286,
2060,
10714,
33673,
310,
10545,
1056,
220,
18,
60,
4600,
25,
21506,
51199,
914,
756,
310,
3561,
79878,
4600,
486,
20250,
261,
51199,
703,
1454,
314,
1555,
25,
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... | 1 |
#[test]
fn test_cost_tracker_ok_add_one() {
let (mint_keypair, start_hash) = test_setup();
let (_tx, tx_cost) = build_simple_transaction(&mint_keypair, &start_hash);
let cost = tx_cost.sum();
// build testee to have capacity for one simple transaction
let mut testee = CostTracker::new(cost, cost, cost, None);
assert!(testee.would_fit(&tx_cost).is_ok());
testee.add_transaction_cost(&tx_cost);
assert_eq!(cost, testee.block_cost);
assert_eq!(0, testee.vote_cost);
let (_costliest_account, costliest_account_cost) = testee.find_costliest_account();
assert_eq!(cost, costliest_account_cost);
} | rust_cleaned_test_functions.jsonl/23068 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 298
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15890,
50264,
19817,
2891,
11667,
368,
341,
286,
1077,
320,
67791,
3097,
12670,
11,
1191,
8950,
8,
284,
1273,
21363,
543,
286,
1077,
5453,
3998,
11,
9854,
15890,
8,
284,
1936,
30015,
28884,
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_epoch_slots_fill_compressed_random_range() {
use rand::Rng;
for _ in 0..10 {
let mut range: Vec<Slot> = vec![];
for _ in 0..5000 {
let last = *range.last().unwrap_or(&0);
range.push(last + rand::thread_rng().gen_range(1, 5));
}
let sz = EpochSlots::default().max_compressed_slot_size();
let mut slots = Uncompressed::new(sz as usize);
let sz = slots.add(&range);
let mut slots = CompressedSlots::Uncompressed(slots);
slots.deflate().unwrap();
let slots = slots.to_slots(0).unwrap();
assert_eq!(slots.len(), sz);
assert_eq!(slots[..], range[..sz]);
}
} | rust_cleaned_test_functions.jsonl/116105 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 408
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20682,
54161,
30728,
2965,
14318,
22644,
9698,
368,
341,
286,
990,
10382,
486,
49,
968,
280,
286,
369,
716,
304,
220,
15,
496,
16,
15,
341,
310,
1077,
5206,
2088,
25,
11312,
27,
19877,
29,
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_newline_processor() {
let src = "b\\\r\n";
assert_eq!(4, src.len());
let nlh = NewlineHandler::new(src.chars());
let x: Vec<char> = nlh.collect();
assert_eq!(vec!['b', '\\', '\n'], x);
} | rust_cleaned_test_functions.jsonl/53197 | {
"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,
5921,
1056,
50127,
368,
341,
1789,
286,
1077,
2286,
284,
330,
65,
81351,
81,
1699,
876,
286,
2060,
10714,
10297,
19,
11,
2286,
19406,
1423,
286,
1077,
20216,
71,
284,
1532,
1056,
3050,
486,
931,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_inverse_transform_point() {
let axis = Unit::from_value(Vector3::unit_z());
let angle = Degrees(72_f64);
let cos_neg_angle = (-angle).cos();
let sin_neg_angle = (-angle).sin();
let distance = Vector3::new(-567_f64, 23_f64, 201_f64);
let isometry = Isometry3::from_axis_angle_translation(&axis, angle, &distance);
let point = Point3::new(1_f64, 2_f64, 3_f64);
let diff: Point3<f64> = point - distance;
let expected = Point3::new(
cos_neg_angle * diff.x - sin_neg_angle * diff.y,
sin_neg_angle * diff.x + cos_neg_angle * diff.y,
diff.z
);
let result = isometry.inverse_transform_point(&point);
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/77230 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 383
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
63333,
18449,
6085,
368,
341,
286,
1077,
8024,
284,
7954,
486,
1499,
3142,
20258,
18,
486,
3843,
6415,
1423,
286,
1077,
9210,
284,
92901,
7,
22,
17,
761,
21,
19,
317,
286,
1077,
7960,
28209,
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_take_instrs() {
let mut a = CodeAssembler::new(64).unwrap();
let instrs = a.take_instructions();
assert_eq!(instrs, &[]);
a.rdtsc().unwrap();
a.xor(ecx, 0x1234_5678).unwrap();
let instrs = a.take_instructions();
assert_eq!(instrs, &[Instruction::with(Code::Rdtsc), Instruction::with2(Code::Xor_rm32_imm32, Register::ECX, 0x1234_5678).unwrap()]);
assert!(a.instructions().is_empty());
} | rust_cleaned_test_functions.jsonl/71804 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73261,
62574,
82,
368,
341,
10217,
5206,
264,
284,
6119,
77858,
486,
931,
7,
21,
19,
568,
15454,
543,
10217,
9491,
82,
284,
264,
40161,
82427,
543,
6948,
10714,
10297,
60511,
82,
11,
609,
56703,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_build_pb_buf() -> anyhow::Result<()> {
// DatabaseInfo
{
let db_info = new_db_info();
let p = db_info.to_pb()?;
let mut buf = vec![];
common_protos::prost::Message::encode(&p, &mut buf)?;
println!("{:?}", buf);
}
// TableInfo
{
let tbl = new_table_info();
let p = tbl.to_pb()?;
let mut buf = vec![];
common_protos::prost::Message::encode(&p, &mut buf)?;
println!("{:?}", buf);
}
Ok(())
} | rust_cleaned_test_functions.jsonl/21370 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 279
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20801,
31409,
10363,
368,
1464,
88964,
486,
2077,
71698,
341,
14808,
262,
442,
9994,
1731,
198,
262,
341,
286,
1077,
2927,
3109,
284,
501,
8685,
3109,
543,
286,
1077,
281,
284,
2927,
3109,
2389,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_store_scan_consistency_unrooted() {
for accounts_db_caching_enabled in &[false, true] {
let (pruned_banks_sender, pruned_banks_receiver) = unbounded();
let abs_request_handler = AbsRequestHandler {
snapshot_request_handler: None,
pruned_banks_receiver,
};
test_store_scan_consistency(
*accounts_db_caching_enabled,
move |bank0,
bank_to_scan_sender,
_scan_finished_receiver,
pubkeys_to_modify,
program_id,
starting_lamports| {
let mut current_major_fork_bank = bank0;
loop {
let mut current_minor_fork_bank = current_major_fork_bank.clone();
let num_new_banks = 2;
let lamports = current_minor_fork_bank.slot() + starting_lamports + 1;
// Modify banks on the two banks on the minor fork
for pubkeys_to_modify in &pubkeys_to_modify
.iter()
.chunks(pubkeys_to_modify.len() / num_new_banks)
{
current_minor_fork_bank = Arc::new(Bank::new_from_parent(
¤t_minor_fork_bank,
&solana_sdk::pubkey::new_rand(),
current_minor_fork_bank.slot() + 2,
));
let account = AccountSharedData::new(lamports, 0, &program_id);
// Write partial updates to each of the banks in the minor fork so if any of them
for key in pubkeys_to_modify {
current_minor_fork_bank.store_account(key, &account);
}
current_minor_fork_bank.freeze();
}
// All the parent banks made in this iteration of the loop
// been squashed
assert_eq!(
current_minor_fork_bank.clone().parents_inclusive().len(),
num_new_banks + 1,
);
// `next_major_bank` needs to be sandwiched between the minor fork banks
// *partial* clean of the banks < `next_major_bank`.
current_major_fork_bank = Arc::new(Bank::new_from_parent(
¤t_major_fork_bank,
&solana_sdk::pubkey::new_rand(),
current_minor_fork_bank.slot() - 1,
));
let lamports = current_major_fork_bank.slot() + starting_lamports + 1;
let account = AccountSharedData::new(lamports, 0, &program_id);
for key in pubkeys_to_modify.iter() {
// Store rooted updates to these pubkeys such that the minor
// fork updates to the same keys will be deleted by clean
current_major_fork_bank.store_account(key, &account);
}
// Send the last new bank to the scan thread to perform the scan.
// Meanwhile this thread will continually set roots on a separate fork
/*
bank 0
/ \
minor bank 1 \
/ current_major_fork_bank
minor bank 2
*/
// The capacity of the channel is 1 so that this thread will wait for the scan to finish before starting
// such that every scan will see this interruption.
if bank_to_scan_sender.send(current_minor_fork_bank).is_err() {
return;
}
current_major_fork_bank.freeze();
current_major_fork_bank.squash();
// Try to get cache flush/clean to overlap with the scan
current_major_fork_bank.force_flush_accounts_cache();
current_major_fork_bank.clean_accounts(false, false);
// with clean. Simulates the call from AccountsBackgroundService
let is_abs_service = true;
abs_request_handler
.handle_pruned_banks(¤t_major_fork_bank, is_abs_service);
}
},
Some(Box::new(SendDroppedBankCallback::new(
pruned_banks_sender.clone(),
))),
AcceptableScanResults::NoFailure,
)
}
} | rust_cleaned_test_functions.jsonl/2666 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14809,
28857,
31971,
47094,
4907,
2888,
291,
368,
341,
286,
369,
9618,
8685,
666,
11829,
18220,
304,
44590,
3849,
11,
830,
60,
341,
310,
1077,
320,
649,
48883,
880,
4039,
54356,
11,
548,
48883,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_node_key_config_input() {
fn secret_input(net_config_dir: &PathBuf) -> error::Result<()> {
NodeKeyType::variants().iter().try_for_each(|t| {
let node_key_type = NodeKeyType::from_str(t).unwrap();
let sk = match node_key_type {
NodeKeyType::Ed25519 => ed25519::SecretKey::generate().as_ref().to_vec(),
};
let params = NodeKeyParams {
node_key_type,
node_key: Some(format!("{:x}", H256::from_slice(sk.as_ref()))),
node_key_file: None,
};
params.node_key(net_config_dir).and_then(|c| match c {
NodeKeyConfig::Ed25519(sc_network::config::Secret::Input(ref ski))
if node_key_type == NodeKeyType::Ed25519 && &sk[..] == ski.as_ref() =>
{
Ok(())
}
_ => Err(error::Error::Input("Unexpected node key config".into())),
})
})
}
assert!(secret_input(&PathBuf::from_str("x").unwrap()).is_ok());
} | rust_cleaned_test_functions.jsonl/52678 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 415
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5084,
3097,
5332,
5898,
368,
341,
197,
40095,
6234,
5898,
30723,
5332,
4334,
25,
609,
1820,
15064,
8,
1464,
1465,
486,
2077,
71698,
341,
298,
30217,
97964,
486,
54611,
1005,
2015,
1005,
1539,
5478... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_decode() {
assert_eq!(vec![1, 0, 2, 1], Solution::decode(vec![1, 2, 3], 1));
assert_eq!(vec![4, 2, 0, 7, 4], Solution::decode(vec![6, 2, 7, 3], 4));
} | rust_cleaned_test_functions.jsonl/72913 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
368,
341,
262,
2060,
10714,
10297,
4083,
20703,
16,
11,
220,
15,
11,
220,
17,
11,
220,
16,
1125,
12478,
486,
18196,
25592,
20703,
16,
11,
220,
17,
11,
220,
18,
1125,
220,
16,
1106,
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_copy_bytes() {
let original = [10_u8, 20, 30, 40, 50, 70, 80];
let bytes = to_byteobject(&original);
let copied = copy_bytes(&bytes.base, &LocalProcess).unwrap();
assert_eq!(copied, original);
} | rust_cleaned_test_functions.jsonl/49472 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16096,
12524,
368,
341,
286,
1077,
4024,
284,
508,
16,
15,
7300,
23,
11,
220,
17,
15,
11,
220,
18,
15,
11,
220,
19,
15,
11,
220,
20,
15,
11,
220,
22,
15,
11,
220,
23,
15,
935,
286,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_different_reads() {
let headers = Headers::from_raw(&mut mem("Content-Length: 10\r\nContent-Type: text/plain\r\n\r\n")).unwrap();
let ContentLength(_) = *headers.get::<ContentLength>().unwrap();
let ContentType(_) = *headers.get::<ContentType>().unwrap();
} | rust_cleaned_test_functions.jsonl/18242 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 128
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82741,
66628,
368,
341,
286,
1077,
7102,
284,
21426,
486,
1499,
16067,
2099,
6984,
1833,
445,
2762,
52493,
25,
220,
16,
15,
12016,
1699,
2762,
10804,
25,
1467,
36971,
12016,
1699,
12016,
1699,
151... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_to_level() {
assert_eq!(Some(Level::Error), LevelFilter::Error.to_level());
assert_eq!(None, LevelFilter::Off.to_level());
assert_eq!(Some(Level::Debug), LevelFilter::Debug.to_level());
} | rust_cleaned_test_functions.jsonl/71733 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
8274,
368,
341,
286,
2060,
10714,
10297,
8373,
30263,
486,
1454,
701,
9395,
5632,
486,
1454,
2389,
8274,
1423,
286,
2060,
10714,
10297,
4064,
11,
9395,
5632,
486,
4596,
2389,
8274,
1423,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_time_metadata_format() {
let node = finspect::ObjectTreeNode::new_root();
let timestamp = zx::Time::from_nanos(123_456700000);
node.lock().set_time_at(timestamp);
let object = node.lock().evaluate();
test_utils::assert_str_prop(&object, "@time", "123.456");
} | rust_cleaned_test_functions.jsonl/45589 | {
"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,
3009,
22220,
8955,
368,
341,
286,
1077,
2436,
284,
64979,
987,
486,
1190,
26597,
486,
931,
12993,
543,
286,
1077,
11441,
284,
71322,
486,
1462,
486,
1499,
1089,
43605,
7,
16,
17,
18,
62,
19,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compile_errors() {
let t = trybuild::TestCases::new();
t.compile_fail("tests/ui/invalid_macro_args.rs");
t.compile_fail("tests/ui/invalid_property_args.rs");
t.compile_fail("tests/ui/invalid_pyclass_args.rs");
t.compile_fail("tests/ui/invalid_pymethod_names.rs");
t.compile_fail("tests/ui/missing_clone.rs");
t.compile_fail("tests/ui/reject_generics.rs");
} | rust_cleaned_test_functions.jsonl/83677 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74170,
20196,
368,
341,
262,
1077,
259,
284,
1430,
5834,
486,
2271,
37302,
486,
931,
543,
262,
259,
18922,
22121,
445,
23841,
22444,
14,
11808,
58810,
8384,
25638,
797,
262,
259,
18922,
22121,
445... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unknown_longer_tag() {
let bytes = hex!("9f a2 22 01 00");
let res = parse_ber(&bytes).expect("parsing failed");
assert!(res.0.is_empty());
assert_eq!(
res.1,
BerObject {
header: Header::new(Class::ContextSpecific, false, Tag(0x1122), 1)
.with_raw_tag(Some(&[0x9f, 0xa2, 0x22])),
content: BerObjectContent::Unknown(Class::ContextSpecific, Tag(0x1122), &bytes[4..]),
}
);
} | rust_cleaned_test_functions.jsonl/67467 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 236
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57507,
17799,
261,
9372,
368,
341,
262,
1077,
5820,
284,
12371,
17223,
24,
69,
264,
17,
220,
17,
17,
220,
15,
16,
220,
15,
15,
797,
262,
1077,
592,
284,
4715,
88165,
2099,
9651,
568,
17119,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_delete_playlist() {
let db = db::_get_test_db("delete_playlist.sqlite");
let playlist_content = Vec::new();
save_playlist("chill_and_grill", "test_user", &playlist_content, &db).unwrap();
save_playlist("mellow_bungalow", "test_user", &playlist_content, &db).unwrap();
let found_playlists = list_playlists("test_user", &db).unwrap();
assert_eq!(found_playlists.len(), 2);
delete_playlist("chill_and_grill", "test_user", &db).unwrap();
let found_playlists = list_playlists("test_user", &db).unwrap();
assert_eq!(found_playlists.len(), 1);
assert_eq!(found_playlists[0], "mellow_bungalow");
let delete_result = delete_playlist("mellow_bungalow", "someone_else", &db);
assert!(delete_result.is_err());
} | rust_cleaned_test_functions.jsonl/60429 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 287
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11353,
69267,
368,
341,
10217,
2927,
284,
2927,
13541,
455,
4452,
8685,
445,
4542,
69267,
42167,
797,
10217,
26791,
7495,
284,
11312,
486,
931,
1428,
49230,
69267,
445,
331,
483,
8378,
15682,
483,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_line_number_format_regex_1() {
assert_eq!(
parse_line_number_format("{nm}"),
vec![LineNumberPlaceholderData {
prefix: "",
placeholder: Some("nm"),
alignment_spec: None,
width: None,
suffix: "",
}]
)
} | rust_cleaned_test_functions.jsonl/54571 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 216
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6528,
5500,
8955,
41832,
62,
16,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
6528,
5500,
8955,
13976,
19638,
92,
4461,
310,
7486,
20703,
73685,
48305,
1043,
341,
394,
9252,
25,
8324,
394,
5878,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.