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_jpg() {
let info = Infer::new();
assert_eq!(infer::Type {
mime: String::from("image/jpeg"),
ext: String::from("jpg"),
},
info.get(&fs::read("testdata/sample.jpg").unwrap()).unwrap());
} | rust_cleaned_test_functions.jsonl/110129 | {
"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,
5374,
3517,
368,
341,
262,
1077,
3546,
284,
62658,
486,
931,
1428,
262,
2060,
10714,
10297,
89559,
486,
929,
314,
715,
286,
45270,
25,
923,
486,
1499,
445,
1805,
51818,
3975,
715,
286,
1303,
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_primitive_array_divide_scalar_with_nulls() {
let a = Int32Array::from(vec![Some(15), None, Some(8), Some(1), Some(9), None]);
let b = 3;
let c = divide_scalar(&a, b).unwrap();
let expected =
Int32Array::from(vec![Some(5), None, Some(2), Some(0), Some(3), None]);
assert_eq!(c, expected);
} | rust_cleaned_test_functions.jsonl/120276 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 183
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84087,
3858,
16237,
577,
41652,
6615,
15162,
82,
368,
341,
286,
1077,
264,
284,
1333,
18,
17,
1857,
486,
1499,
25592,
20703,
8373,
7,
16,
20,
701,
2240,
11,
4329,
7,
23,
701,
4329,
7,
16,
70... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_more_than_one_batch() {
// Construct column schema
let message_type = "
message test_schema {
REPEATED INT32 leaf;
}
";
let desc = parse_message_type(message_type)
.map(|t| SchemaDescriptor::new(Arc::new(t)))
.map(|s| s.column(0))
.unwrap();
// Construct record reader
let mut record_reader = RecordReader::<Int32Type>::new(desc.clone());
{
let values = [100; 5000];
let def_levels = [1i16; 5000];
let mut rep_levels = [1i16; 5000];
for idx in 0..1000 {
rep_levels[idx * 5] = 0i16;
}
let mut pb = DataPageBuilderImpl::new(desc, 5000, true);
pb.add_rep_levels(1, &rep_levels);
pb.add_def_levels(1, &def_levels);
pb.add_values::<Int32Type>(Encoding::PLAIN, &values);
let page = pb.consume();
let page_reader = Box::new(TestPageReader::new(vec![page]));
record_reader.set_page_reader(page_reader).unwrap();
assert_eq!(1000, record_reader.read_records(1000).unwrap());
assert_eq!(1000, record_reader.num_records());
assert_eq!(5000, record_reader.num_values());
}
} | rust_cleaned_test_functions.jsonl/52890 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 681
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
36664,
51613,
11667,
14534,
368,
341,
286,
442,
18678,
3250,
10802,
198,
286,
1077,
1943,
1819,
284,
6228,
286,
1943,
1273,
25371,
341,
688,
3596,
1740,
9005,
220,
9221,
18,
17,
15933,
280,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_get_device_instance_name() {
let instance_name1: String = "/dev/video0".to_string();
let instance_name2: String = "10.1.2.3".to_string();
assert_eq!(
"usb-camera--dev-video0",
get_device_instance_name(&instance_name1, &"usb-camera".to_string())
);
assert_eq!(
"ip-camera-10-1-2-3".to_string(),
get_device_instance_name(&instance_name2, &"ip-camera".to_string())
);
} | rust_cleaned_test_functions.jsonl/2726 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 248
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
9204,
11904,
1269,
368,
341,
286,
1077,
2867,
1269,
16,
25,
923,
284,
3521,
3583,
41303,
15,
3263,
983,
3904,
543,
286,
1077,
2867,
1269,
17,
25,
923,
284,
330,
16,
15,
13,
16,
13,
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_path_join() -> Result<(), Error> {
let a = "../../../azure-rest-api-specs/specification/vmware/resource-manager/Microsoft.AVS/stable/2020-03-20/vmware.json";
let b = "../../../../../common-types/resource-management/v1/types.json";
let c = join(a, b)?;
assert_eq!(
c,
PathBuf::from("../../../azure-rest-api-specs/specification/common-types/resource-management/v1/types.json")
);
Ok(())
} | rust_cleaned_test_functions.jsonl/75557 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 229
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2638,
31017,
368,
1464,
5714,
68843,
4600,
29,
341,
286,
1077,
264,
284,
30630,
39495,
76233,
23904,
57794,
82,
45389,
2404,
5457,
76,
1664,
53100,
44896,
10270,
3929,
875,
26050,
14272,
480,
14,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_t108() {
init();
let result = t108(IMEI.as_bytes());
println!("{}", result.len());
println!("{:?}", result);
} | rust_cleaned_test_functions.jsonl/104727 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 90
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
16,
15,
23,
368,
341,
286,
2930,
543,
286,
1077,
1102,
284,
259,
16,
15,
23,
7,
5660,
40,
5357,
12524,
1423,
286,
13751,
79878,
1102,
19406,
1423,
286,
13751,
88928,
25,
52652,
1102,
317,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_action() {
compare(
r#"
grammar;
extern { enum Tok { "+" => .., "foo" => .. } }
X = {
Y,
<l:X> "+" <r:Y> => l + r
};
Y: i32 = "foo" => 22;
"#,
vec![("X", "i32"), ("Y", "i32")],
)
} | rust_cleaned_test_functions.jsonl/50473 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 158
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7931,
368,
341,
262,
9429,
1006,
286,
435,
2,
698,
41094,
280,
262,
15637,
314,
7618,
21447,
314,
59498,
589,
5241,
11,
330,
7975,
1,
589,
5241,
335,
555,
262,
1599,
284,
341,
286,
809,
345,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_user_ip_from_client_ip_without_auto() {
let mut event = Annotated::new(Event {
platform: Annotated::new("javascript".to_owned()),
..Default::default()
});
let mut config = StoreConfig::default();
config.client_ip = Some(IpAddr::parse("2.125.160.216").unwrap());
let mut processor = NormalizeProcessor::new(Arc::new(config), None);
process_value(&mut event, &mut processor, ProcessingState::root()).unwrap();
let user = event
.value()
.unwrap()
.user
.value()
.expect("user was not created");
let ip_addr = user.ip_address.value().expect("ip address was not created");
assert_eq_dbg!(ip_addr, &IpAddr("2.125.160.216".to_string()));
} | rust_cleaned_test_functions.jsonl/14084 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 308
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3317,
10385,
5673,
8179,
10385,
39904,
27740,
368,
341,
262,
1077,
5206,
1538,
284,
1527,
87029,
486,
931,
30469,
341,
286,
5339,
25,
1527,
87029,
486,
931,
445,
14073,
3263,
983,
51973,
14702,
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_search_paths_tracking_hash_different_order() {
let mut v1 = Options::default();
let mut v2 = Options::default();
let mut v3 = Options::default();
let mut v4 = Options::default();
// Reference
v1.search_paths
.push(SearchPath::from_cli_opt("native=abc", super::ErrorOutputType::Json(false)));
v1.search_paths
.push(SearchPath::from_cli_opt("crate=def", super::ErrorOutputType::Json(false)));
v1.search_paths
.push(SearchPath::from_cli_opt("dependency=ghi", super::ErrorOutputType::Json(false)));
v1.search_paths
.push(SearchPath::from_cli_opt("framework=jkl", super::ErrorOutputType::Json(false)));
v1.search_paths
.push(SearchPath::from_cli_opt("all=mno", super::ErrorOutputType::Json(false)));
v2.search_paths
.push(SearchPath::from_cli_opt("native=abc", super::ErrorOutputType::Json(false)));
v2.search_paths
.push(SearchPath::from_cli_opt("dependency=ghi", super::ErrorOutputType::Json(false)));
v2.search_paths
.push(SearchPath::from_cli_opt("crate=def", super::ErrorOutputType::Json(false)));
v2.search_paths
.push(SearchPath::from_cli_opt("framework=jkl", super::ErrorOutputType::Json(false)));
v2.search_paths
.push(SearchPath::from_cli_opt("all=mno", super::ErrorOutputType::Json(false)));
v3.search_paths
.push(SearchPath::from_cli_opt("crate=def", super::ErrorOutputType::Json(false)));
v3.search_paths
.push(SearchPath::from_cli_opt("framework=jkl", super::ErrorOutputType::Json(false)));
v3.search_paths
.push(SearchPath::from_cli_opt("native=abc", super::ErrorOutputType::Json(false)));
v3.search_paths
.push(SearchPath::from_cli_opt("dependency=ghi", super::ErrorOutputType::Json(false)));
v3.search_paths
.push(SearchPath::from_cli_opt("all=mno", super::ErrorOutputType::Json(false)));
v4.search_paths
.push(SearchPath::from_cli_opt("all=mno", super::ErrorOutputType::Json(false)));
v4.search_paths
.push(SearchPath::from_cli_opt("native=abc", super::ErrorOutputType::Json(false)));
v4.search_paths
.push(SearchPath::from_cli_opt("crate=def", super::ErrorOutputType::Json(false)));
v4.search_paths
.push(SearchPath::from_cli_opt("dependency=ghi", super::ErrorOutputType::Json(false)));
v4.search_paths
.push(SearchPath::from_cli_opt("framework=jkl", super::ErrorOutputType::Json(false)));
assert!(v1.dep_tracking_hash() == v2.dep_tracking_hash());
assert!(v1.dep_tracking_hash() == v3.dep_tracking_hash());
assert!(v1.dep_tracking_hash() == v4.dep_tracking_hash());
// Check clone
assert_eq!(v1.dep_tracking_hash(), v1.clone().dep_tracking_hash());
assert_eq!(v2.dep_tracking_hash(), v2.clone().dep_tracking_hash());
assert_eq!(v3.dep_tracking_hash(), v3.clone().dep_tracking_hash());
assert_eq!(v4.dep_tracking_hash(), v4.clone().dep_tracking_hash());
} | rust_cleaned_test_functions.jsonl/44823 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1464
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10716,
24152,
66105,
8950,
82741,
7869,
368,
341,
286,
1077,
5206,
348,
16,
284,
14566,
486,
2258,
543,
286,
1077,
5206,
348,
17,
284,
14566,
486,
2258,
543,
286,
1077,
5206,
348,
18,
284,
14566... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_with_realm_into_header_value() {
let challenge = Basic {
realm: Some("Restricted area".into()),
};
let value = challenge.try_into();
assert!(value.is_ok());
let value = value.unwrap();
assert_eq!(value, "Basic realm=\"Restricted area\"");
} | rust_cleaned_test_functions.jsonl/52033 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 150
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
1288,
7673,
45514,
8757,
3142,
368,
341,
286,
1077,
8645,
284,
14625,
341,
310,
21889,
25,
4329,
445,
86405,
3082,
3263,
18122,
14702,
286,
3634,
286,
1077,
897,
284,
8645,
48779,
45514,
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_explorer_block_iter() {
let mut blockchain = create_blockchain();
let mut tx_gen = tx_generator();
let txs = tx_gen.by_ref();
create_block(&mut blockchain, vec![]);
create_block(&mut blockchain, txs.take(2).collect());
create_block(&mut blockchain, vec![]);
create_block(&mut blockchain, txs.take(2).collect());
create_block(&mut blockchain, txs.take(3).collect());
create_block(&mut blockchain, vec![]);
create_block(&mut blockchain, vec![]);
create_block(&mut blockchain, vec![]);
create_block(&mut blockchain, txs.take(5).collect());
assert_eq!(blockchain.last_block().height(), Height(9));
let explorer = BlockchainExplorer::new(&blockchain);
let mut count = 0;
for (i, block) in explorer.blocks(..).enumerate() {
assert_eq!(block.height(), Height(i as u64));
count += 1;
}
assert_eq!(count, 10);
let tx_count: usize = explorer.blocks(..Height(1_000)).map(|bl| bl.len()).sum();
assert_eq!(tx_count, 12);
let count = explorer.blocks(..).filter(BlockInfo::is_empty).count();
assert_eq!(count, 6);
let transaction_hashes: Vec<Hash> = explorer
.blocks(..)
.flat_map(|info| info.transaction_hashes().to_vec())
.collect();
assert_eq!(transaction_hashes.len(), 12);
let block = explorer.block(Height(4)).unwrap();
assert_eq!(transaction_hashes[3], block.transaction_hashes()[1]);
let transactions: Vec<CommittedTransaction> = explorer
.blocks(..)
.flat_map(|info| info.with_transactions().transactions)
.collect();
assert_eq!(transactions.len(), 12);
assert!(
transactions
.iter()
.all(|tx| tx.location().block_height() < Height(10))
);
let heights: Vec<_> = explorer
.blocks(..)
.rev()
.filter(|bl| !bl.is_empty())
.map(|bl| bl.height())
.collect();
assert_eq!(heights, vec![Height(9), Height(5), Height(4), Height(2)]);
let block = explorer
.blocks(..)
.filter(|bl| !bl.is_empty())
.nth(2)
.unwrap();
assert_eq!(block.height(), Height(5));
let mut iter = explorer.blocks(..).filter(|bl| !bl.is_empty()).rev();
let _ = iter.by_ref().nth(1);
let heights: Vec<_> = iter.by_ref().map(|bl| bl.height()).collect();
assert_eq!(heights, vec![Height(4), Height(2)]);
assert!(iter.next().is_none());
let heights: Vec<_> = explorer
.blocks(..Height(9))
.filter(|bl| !bl.is_empty())
.rev()
.map(|bl| bl.height())
.collect();
assert_eq!(heights, vec![Height(5), Height(4), Height(2)]);
let heights: Vec<_> = explorer
.blocks(..Height(5))
.filter(|bl| !bl.is_empty())
.map(|bl| bl.height())
.collect();
assert_eq!(heights, vec![Height(2), Height(4)]);
let heights: Vec<_> = explorer
.blocks(Height(0)..Height(2))
.filter(|bl| !bl.is_empty())
.map(|bl| bl.height())
.collect();
assert_eq!(heights, vec![]);
let heights: Vec<_> = explorer.blocks(..Height(2)).map(|bl| bl.height()).collect();
assert_eq!(heights, vec![Height(0), Height(1)]);
let heights: Vec<_> = explorer.blocks(..Height(1)).map(|bl| bl.height()).collect();
assert_eq!(heights, vec![Height(0)]);
let heights: Vec<_> = explorer.blocks(..Height(0)).map(|bl| bl.height()).collect();
assert_eq!(heights, vec![]);
let heights: Vec<_> = explorer
.blocks(Height(0)..Height(1))
.map(|bl| bl.height())
.collect();
assert_eq!(heights, vec![Height(0)]);
let mut iter = explorer.blocks(..);
assert_eq!(iter.by_ref().nth(3).unwrap().height(), Height(3));
assert_eq!(iter.nth(2).unwrap().height(), Height(6));
} | rust_cleaned_test_functions.jsonl/70355 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1664
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2702,
79825,
7113,
11723,
368,
341,
262,
1077,
5206,
17944,
284,
1855,
7113,
8819,
543,
262,
1077,
5206,
9854,
16322,
284,
9854,
25813,
543,
262,
1077,
9854,
82,
284,
9854,
16322,
19007,
7793,
142... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_enforce_limit_sessions() {
let mut envelope = envelope![Session, Session, Event];
let mut mock = MockLimiter::default().deny(DataCategory::Session);
let (_, limits) = EnvelopeLimiter::new(|s, q| mock.check(s, q))
.enforce(&mut envelope, &scoping())
.unwrap();
assert!(limits.is_limited());
assert_eq!(envelope.len(), 1);
mock.assert_call(DataCategory::Error, Some(1));
mock.assert_call(DataCategory::Attachment, None);
mock.assert_call(DataCategory::Session, Some(2));
} | rust_cleaned_test_functions.jsonl/101168 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 264
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6205,
8833,
14763,
71385,
368,
341,
286,
1077,
5206,
34398,
284,
34398,
20703,
5283,
11,
9164,
11,
3665,
4821,
286,
1077,
5206,
7860,
284,
14563,
43,
17700,
486,
2258,
1005,
89963,
18959,
6746,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_filter_params_self_without_view_as() -> Result<(), FieldError> {
let scope_and_user = ScopeAndUser {
user_id: String::from("user1"),
scope: String::from("staff"),
};
let params = get_profile_params(None, &scope_and_user, None)?;
assert!(match params.by {
GetBy::UserId => true,
_ => false,
});
assert_eq!(params.id, "user1");
assert_eq!(params.filter, Display::Private);
Ok(())
} | rust_cleaned_test_functions.jsonl/33802 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 255
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
8727,
6745,
25637,
39904,
7122,
11898,
368,
1464,
5714,
68843,
8601,
1454,
29,
341,
286,
1077,
6891,
8378,
3317,
284,
34920,
3036,
1474,
341,
310,
1196,
842,
25,
923,
486,
1499,
445,
872,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_direction_vector() {
assert_eq!(
get_direction_vector(point![0, 0], point![-2, 2]),
vector![-1, 1]
);
assert_eq!(
get_direction_vector(point![0, 0], point![-2, 0]),
vector![-1, 0]
);
assert_eq!(
get_direction_vector(point![0, 0], point![-2, -2]),
vector![-1, -1]
);
assert_eq!(
get_direction_vector(point![0, 0], point![0, 2]),
vector![0, 1]
);
assert_eq!(
get_direction_vector(point![0, 0], point![0, 0]),
vector![0, 0]
);
assert_eq!(
get_direction_vector(point![0, 0], point![0, -2]),
vector![0, -1]
);
assert_eq!(
get_direction_vector(point![0, 0], point![2, 2]),
vector![1, 1]
);
assert_eq!(
get_direction_vector(point![0, 0], point![2, 0]),
vector![1, 0]
);
assert_eq!(
get_direction_vector(point![0, 0], point![2, -2]),
vector![1, -1]
);
} | rust_cleaned_test_functions.jsonl/82524 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 693
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25438,
12247,
368,
341,
286,
2060,
10714,
33673,
310,
633,
25438,
12247,
20235,
20703,
15,
11,
220,
15,
1125,
1459,
0,
7609,
17,
11,
220,
17,
17036,
310,
4621,
0,
7609,
16,
11,
220,
16,
921,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_paths() {
let empty: &[u8] = [];
t!(v: Path::new(empty), b!("."));
t!(v: Path::new(b!("\\")), b!("\\"));
t!(v: Path::new(b!("a\\b\\c")), b!("a\\b\\c"));
t!(s: Path::new(""), ".");
t!(s: Path::new("\\"), "\\");
t!(s: Path::new("hi"), "hi");
t!(s: Path::new("hi\\"), "hi");
t!(s: Path::new("\\lib"), "\\lib");
t!(s: Path::new("\\lib\\"), "\\lib");
t!(s: Path::new("hi\\there"), "hi\\there");
t!(s: Path::new("hi\\there.txt"), "hi\\there.txt");
t!(s: Path::new("/"), "\\");
t!(s: Path::new("hi/"), "hi");
t!(s: Path::new("/lib"), "\\lib");
t!(s: Path::new("/lib/"), "\\lib");
t!(s: Path::new("hi/there"), "hi\\there");
t!(s: Path::new("hi\\there\\"), "hi\\there");
t!(s: Path::new("hi\\..\\there"), "there");
t!(s: Path::new("hi/../there"), "there");
t!(s: Path::new("..\\hi\\there"), "..\\hi\\there");
t!(s: Path::new("\\..\\hi\\there"), "\\hi\\there");
t!(s: Path::new("/../hi/there"), "\\hi\\there");
t!(s: Path::new("foo\\.."), ".");
t!(s: Path::new("\\foo\\.."), "\\");
t!(s: Path::new("\\foo\\..\\.."), "\\");
t!(s: Path::new("\\foo\\..\\..\\bar"), "\\bar");
t!(s: Path::new("\\.\\hi\\.\\there\\."), "\\hi\\there");
t!(s: Path::new("\\.\\hi\\.\\there\\.\\.."), "\\hi");
t!(s: Path::new("foo\\..\\.."), "..");
t!(s: Path::new("foo\\..\\..\\.."), "..\\..");
t!(s: Path::new("foo\\..\\..\\bar"), "..\\bar");
assert_eq!(Path::new(b!("foo\\bar")).into_vec(), b!("foo\\bar").to_owned());
assert_eq!(Path::new(b!("\\foo\\..\\..\\bar")).into_vec(),
b!("\\bar").to_owned());
t!(s: Path::new("\\\\a"), "\\a");
t!(s: Path::new("\\\\a\\"), "\\a");
t!(s: Path::new("\\\\a\\b"), "\\\\a\\b");
t!(s: Path::new("\\\\a\\b\\"), "\\\\a\\b");
t!(s: Path::new("\\\\a\\b/"), "\\\\a\\b");
t!(s: Path::new("\\\\\\b"), "\\b");
t!(s: Path::new("\\\\a\\\\b"), "\\a\\b");
t!(s: Path::new("\\\\a\\b\\c"), "\\\\a\\b\\c");
t!(s: Path::new("\\\\server\\share/path"), "\\\\server\\share\\path");
t!(s: Path::new("\\\\server/share/path"), "\\\\server\\share\\path");
t!(s: Path::new("C:a\\b.txt"), "C:a\\b.txt");
t!(s: Path::new("C:a/b.txt"), "C:a\\b.txt");
t!(s: Path::new("z:\\a\\b.txt"), "Z:\\a\\b.txt");
t!(s: Path::new("z:/a/b.txt"), "Z:\\a\\b.txt");
t!(s: Path::new("ab:/a/b.txt"), "ab:\\a\\b.txt");
t!(s: Path::new("C:\\"), "C:\\");
t!(s: Path::new("C:"), "C:");
t!(s: Path::new("q:"), "Q:");
t!(s: Path::new("C:/"), "C:\\");
t!(s: Path::new("C:\\foo\\.."), "C:\\");
t!(s: Path::new("C:foo\\.."), "C:");
t!(s: Path::new("C:\\a\\"), "C:\\a");
t!(s: Path::new("C:\\a/"), "C:\\a");
t!(s: Path::new("C:\\a\\b\\"), "C:\\a\\b");
t!(s: Path::new("C:\\a\\b/"), "C:\\a\\b");
t!(s: Path::new("C:a\\"), "C:a");
t!(s: Path::new("C:a/"), "C:a");
t!(s: Path::new("C:a\\b\\"), "C:a\\b");
t!(s: Path::new("C:a\\b/"), "C:a\\b");
t!(s: Path::new("\\\\?\\z:\\a\\b.txt"), "\\\\?\\z:\\a\\b.txt");
t!(s: Path::new("\\\\?\\C:/a/b.txt"), "\\\\?\\C:/a/b.txt");
t!(s: Path::new("\\\\?\\C:\\a/b.txt"), "\\\\?\\C:\\a/b.txt");
t!(s: Path::new("\\\\?\\test\\a\\b.txt"), "\\\\?\\test\\a\\b.txt");
t!(s: Path::new("\\\\?\\foo\\bar\\"), "\\\\?\\foo\\bar\\");
t!(s: Path::new("\\\\.\\foo\\bar"), "\\\\.\\foo\\bar");
t!(s: Path::new("\\\\.\\"), "\\\\.\\");
t!(s: Path::new("\\\\?\\UNC\\server\\share\\foo"), "\\\\?\\UNC\\server\\share\\foo");
t!(s: Path::new("\\\\?\\UNC\\server/share"), "\\\\?\\UNC\\server/share\\");
t!(s: Path::new("\\\\?\\UNC\\server"), "\\\\?\\UNC\\server\\");
t!(s: Path::new("\\\\?\\UNC\\"), "\\\\?\\UNC\\\\");
t!(s: Path::new("\\\\?\\UNC"), "\\\\?\\UNC");
// as information is sparse and this isn't really googleable.
t!(s: Path::new("\\\\.\\foo/bar"), "\\\\.\\foo/bar");
t!(s: Path::new("\\\\.\\foo\\bar"), "\\\\.\\foo\\bar");
} | rust_cleaned_test_functions.jsonl/54447 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2364
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24152,
368,
341,
286,
1077,
4287,
25,
44590,
84,
23,
60,
284,
5907,
286,
259,
10297,
85,
25,
7933,
486,
931,
24216,
701,
293,
0,
5680,
4010,
286,
259,
10297,
85,
25,
7933,
486,
931,
1883,
0,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_day03() {
let lines = vec![
"00100".to_string(),
"11110".to_string(),
"10110".to_string(),
"10111".to_string(),
"10101".to_string(),
"01111".to_string(),
"00111".to_string(),
"11100".to_string(),
"10000".to_string(),
"11001".to_string(),
"00010".to_string(),
"01010".to_string(),
];
assert_eq!(part1(&lines), 198);
} | rust_cleaned_test_functions.jsonl/5225 | {
"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,
16763,
15,
18,
368,
341,
286,
1077,
5128,
284,
7486,
90515,
310,
330,
15,
15,
16,
15,
15,
3263,
983,
3904,
3148,
310,
330,
16,
16,
16,
16,
15,
3263,
983,
3904,
3148,
310,
330,
16,
15,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_or_with_one_gt_to_string() {
let name1 = _random_vector(10);
let value1 = _random_string(10);
let query = Operator::Or(
vec![
Operator::Gt(
TagName::PlainTagName(name1.clone()),
TargetValue::Unencrypted(value1.clone())
)
]
);
let json = query.to_string();
let expected = format!(r#"{{"$or":[{{"~{}":{{"$gt":"{}"}}}}]}}"#, base64::encode(&name1), value1);
assert_eq!(json, expected);
} | rust_cleaned_test_functions.jsonl/11910 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 313
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8734,
6615,
11667,
37479,
2346,
3904,
368,
341,
286,
1077,
829,
16,
284,
716,
11463,
12247,
7,
16,
15,
317,
286,
1077,
897,
16,
284,
716,
11463,
3904,
7,
16,
15,
626,
286,
1077,
3239,
284,
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_parse_dependency_exists() {
let input = r#"exists -> rule , contains"#.chars().collect::<Vec<_>>();
let r = dependency_exists().parse(&input).unwrap();
assert_eq!(r, DependencyCheck::Exists("rule".into()))
} | rust_cleaned_test_functions.jsonl/49993 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 121
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
62387,
9766,
368,
341,
286,
1077,
1946,
284,
435,
55543,
16304,
257,
1464,
256,
5912,
256,
1154,
5610,
57676,
13,
19255,
1005,
17384,
27638,
10050,
32399,
37038,
286,
1077,
435,
284,
24036,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_status_cache_ancestors() {
solana_logger::setup();
let (genesis_config, _mint_keypair) = create_genesis_config(500);
let parent = Arc::new(Bank::new(&genesis_config));
let bank1 = Arc::new(new_from_parent(&parent));
let mut bank = bank1;
for _ in 0..MAX_CACHE_ENTRIES * 2 {
bank = Arc::new(new_from_parent(&bank));
bank.squash();
}
let bank = new_from_parent(&bank);
assert_eq!(
bank.status_cache_ancestors(),
(bank.slot() - MAX_CACHE_ENTRIES as u64..=bank.slot()).collect::<Vec<_>>()
);
} | rust_cleaned_test_functions.jsonl/2607 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 324
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4773,
11529,
62,
681,
267,
1087,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
320,
77894,
5332,
11,
716,
67791,
3097,
12670,
8,
284,
1855,
16322,
13774,
5332,
7,
20,
15,
15,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_enrich_rank_0_tensors_corrupted_with_long_data() {
let tensors = vec![
pb::TensorProto {
dtype: pb::DataType::DtFloat.into(),
tensor_shape: Some(tensor_shape(&[])),
float_val: vec![0.125, 9.99],
..Default::default()
},
pb::TensorProto {
dtype: pb::DataType::DtFloat.into(),
tensor_shape: Some(tensor_shape(&[])),
tensor_content: to_le_bytes![0.125, 9.99f32],
..Default::default()
},
];
for tensor in tensors {
let v = EventValue::Summary(SummaryValue(Box::new(Value::Tensor(tensor.clone()))));
let expected = Err(DataLoss);
let actual = v.into_scalar();
assert_eq!(
actual, expected,
"into_scalar for {:?}: got {:?}, expected {:?}",
&tensor, actual, expected
)
}
} | rust_cleaned_test_functions.jsonl/6196 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 680
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6205,
13851,
20417,
62,
15,
91067,
14734,
85954,
6615,
17799,
1769,
368,
341,
310,
1077,
77087,
284,
7486,
90515,
394,
17310,
486,
25336,
31549,
341,
503,
13231,
25,
17310,
486,
22653,
486,
69079,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_parsing_proper_set_statement() {
let statement = get_statement!("SET MY_KEY MY_VALUE");
assert_eq!(
statement,
Statement {
stype: StatementType::Set,
key: Some("MY_KEY".to_owned()),
value: Some("MY_VALUE".to_owned())
}
);
} | rust_cleaned_test_functions.jsonl/104589 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 239
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
28598,
2540,
712,
2602,
37404,
368,
341,
310,
1077,
5114,
284,
633,
37404,
17223,
5884,
18224,
6600,
18224,
7476,
797,
310,
2060,
10714,
33673,
394,
5114,
345,
394,
21756,
341,
503,
357,
499,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_content_type_json() {
assert_eq!(
HeaderValue::from_static(CONTENT_TYPE_JSON_STR)
.to_str()
.unwrap(),
CONTENT_TYPE_JSON_STR
);
} | rust_cleaned_test_functions.jsonl/59747 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 137
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7495,
1819,
9455,
368,
341,
286,
2060,
10714,
33673,
310,
12104,
1130,
486,
1499,
25360,
98747,
1825,
4189,
25356,
7159,
340,
394,
659,
983,
2895,
741,
394,
659,
15454,
3148,
310,
35768,
4189,
253... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_short_unicode() {
let strs = vec![
("🦀", false),
("🌧☀️", false),
// str is "咬𓅈ꁈ:_", false),
];
for (s, is_heap) in strs {
let compact = CompactString::new(s);
assert_eq!(compact, s);
assert_eq!(s, compact);
assert_eq!(compact.is_heap_allocated(), is_heap);
}
} | rust_cleaned_test_functions.jsonl/2781 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 202
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16673,
54662,
368,
341,
262,
1077,
57584,
284,
7486,
90515,
286,
3489,
147579,
497,
895,
1326,
286,
3489,
147919,
144668,
30543,
497,
895,
1326,
286,
442,
607,
374,
330,
105118,
150195,
230,
166,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_enum() {
#[derive(Clone, Copy, PeekCopy, Poke)]
enum TestEnum {
NoArg,
OneArg(usize),
Args(usize, usize),
AnotherNoArg,
StructLike { x: usize, y: f32 },
}
assert_eq!(
TestEnum::max_size(),
<u8>::max_size() + 2 * <usize>::max_size()
);
} | rust_cleaned_test_functions.jsonl/24560 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 187
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31054,
368,
341,
262,
11506,
27098,
65297,
11,
14540,
11,
96587,
12106,
11,
97626,
5563,
262,
7618,
3393,
10766,
341,
286,
2308,
2735,
345,
286,
3776,
2735,
7,
51878,
1326,
286,
17693,
7,
51878,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_should_fail_good_message() {
fn f() { panic!("an error message"); }
let desc = TestDescAndFn {
desc: TestDesc {
name: StaticTestName("whatever"),
ignore: false,
should_fail: ShouldFail::Yes(Some("error message"))
},
testfn: DynTestFn(Thunk::new(move|| f())),
};
let (tx, rx) = channel();
run_test(&TestOpts::new(), false, desc, tx);
let (_, res, _) = rx.recv().unwrap();
assert!(res == TrOk);
} | rust_cleaned_test_functions.jsonl/7111 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 291
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43378,
22121,
44781,
6462,
368,
341,
286,
5168,
282,
368,
314,
21975,
17223,
276,
1465,
1943,
5038,
456,
286,
1077,
6560,
284,
3393,
11065,
3036,
24911,
341,
310,
6560,
25,
3393,
11065,
341,
394,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_query_matches_with_multiple_repetition_patterns_that_intersect_other_pattern() {
allocations::record(|| {
let language = get_language("javascript");
// matches: up to two for each pattern that begins with a comment.
let query = Query::new(
language,
r#"
(call_expression
function: (member_expression
property: (property_identifier) @name)) @ref.method
((comment)* @doc (function_declaration))
((comment)* @doc (generator_function_declaration))
((comment)* @doc (class_declaration))
((comment)* @doc (lexical_declaration))
((comment)* @doc (variable_declaration))
((comment)* @doc (method_definition))
(comment) @comment
"#,
)
.unwrap();
// pattern. To avoid exceeding the storage limits and discarding that outer
let source = format!(
"theObject\n{}\n.theMethod()",
" // the comment\n".repeat(64)
);
assert_query_matches(
language,
&query,
&source,
&vec![(7, vec![("comment", "// the comment")]); 64]
.into_iter()
.chain(vec![(
0,
vec![("ref.method", source.as_str()), ("name", "theMethod")],
)])
.collect::<Vec<_>>(),
);
});
} | rust_cleaned_test_functions.jsonl/25162 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 782
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5738,
38344,
6615,
45233,
1288,
55767,
64923,
70197,
72747,
30456,
21260,
368,
341,
262,
69642,
486,
8548,
79453,
341,
286,
1077,
4128,
284,
633,
29021,
445,
14073,
3071,
1789,
286,
442,
9071,
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... | 2 |
#[test]
fn test_match_body_with_partial_json() {
let _m = mock("POST", "/")
.match_body(Matcher::PartialJson(json!({"hello":"world"})))
.create();
let (status, _, _) = request_with_body("POST /", "", r#"{"hello":"world", "foo": "bar"}"#);
assert_eq!("HTTP/1.1 200 OK\r\n", status);
} | rust_cleaned_test_functions.jsonl/82392 | {
"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,
10708,
14114,
6615,
52068,
9455,
368,
341,
262,
1077,
716,
76,
284,
7860,
445,
2946,
497,
3521,
1138,
286,
659,
6347,
14114,
3189,
28058,
486,
37314,
5014,
9304,
0,
16864,
14990,
3252,
14615,
9207... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_set_buffer_authority_ix() {
let buffer_address = Pubkey::new_unique();
let current_authority_address = Pubkey::new_unique();
let new_authority_address = Pubkey::new_unique();
let instruction = bpf_loader_upgradeable::set_buffer_authority(
&buffer_address,
¤t_authority_address,
&new_authority_address,
);
let mut message = Message::new(&[instruction], None);
assert_eq!(
parse_bpf_upgradeable_loader(
&message.instructions[0],
&AccountKeys::new(&message.account_keys, None)
)
.unwrap(),
ParsedInstructionEnum {
instruction_type: "setAuthority".to_string(),
info: json!({
"account": buffer_address.to_string(),
"authority": current_authority_address.to_string(),
"newAuthority": new_authority_address.to_string(),
}),
}
);
assert!(parse_bpf_upgradeable_loader(
&message.instructions[0],
&AccountKeys::new(&message.account_keys[0..1], None)
)
.is_err());
let keys = message.account_keys.clone();
message.instructions[0].accounts.pop();
message.instructions[0].accounts.pop();
assert!(parse_bpf_upgradeable_loader(
&message.instructions[0],
&AccountKeys::new(&keys, None)
)
.is_err());
} | rust_cleaned_test_functions.jsonl/23419 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 796
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
880,
15897,
67794,
480,
22139,
2602,
7776,
22938,
487,
62686,
368,
341,
286,
1077,
4147,
6744,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
1482,
22938,
487,
6744,
284,
22611,
792,
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_eof_after_as() {
let res = parse_sql_statements("SELECT foo AS");
assert_eq!(
ParserError::ParserError("Expected an identifier after AS, found: EOF".to_string()),
res.unwrap_err()
);
let res = parse_sql_statements("SELECT 1 FROM foo AS");
assert_eq!(
ParserError::ParserError("Expected an identifier after AS, found: EOF".to_string()),
res.unwrap_err()
);
} | rust_cleaned_test_functions.jsonl/18294 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 184
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
90792,
19844,
11898,
368,
341,
262,
1077,
592,
284,
4715,
18063,
16271,
3723,
445,
4858,
15229,
5752,
797,
262,
2060,
10714,
33673,
286,
21102,
1454,
486,
6570,
1454,
445,
18896,
458,
12816,
1283,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_rooted_transaction() {
let slot = 2;
let entries = make_slot_entries_with_transactions(5);
let shreds = entries_to_test_shreds(entries.clone(), slot, slot - 1, true, 0);
let ledger_path = get_tmp_ledger_path_auto_delete!();
let blockstore = Blockstore::open(ledger_path.path()).unwrap();
blockstore.insert_shreds(shreds, None, false).unwrap();
blockstore.set_roots(vec![slot - 1, slot].iter()).unwrap();
let expected_transactions: Vec<TransactionWithStatusMeta> = entries
.iter()
.cloned()
.filter(|entry| !entry.is_tick())
.flat_map(|entry| entry.transactions)
.map(|tx| {
tx.into_legacy_transaction()
.expect("versioned transactions not supported")
})
.map(|transaction| {
let mut pre_balances: Vec<u64> = vec![];
let mut post_balances: Vec<u64> = vec![];
for (i, _account_key) in transaction.message.account_keys.iter().enumerate() {
pre_balances.push(i as u64 * 10);
post_balances.push(i as u64 * 11);
}
let inner_instructions = Some(vec![InnerInstructions {
index: 0,
instructions: vec![CompiledInstruction::new(1, &(), vec![0])],
}]);
let log_messages = Some(vec![String::from("Test message\n")]);
let pre_token_balances = Some(vec![]);
let post_token_balances = Some(vec![]);
let rewards = Some(vec![]);
let signature = transaction.signatures[0];
let status = TransactionStatusMeta {
status: Ok(()),
fee: 42,
pre_balances: pre_balances.clone(),
post_balances: post_balances.clone(),
inner_instructions: inner_instructions.clone(),
log_messages: log_messages.clone(),
pre_token_balances: pre_token_balances.clone(),
post_token_balances: post_token_balances.clone(),
rewards: rewards.clone(),
}
.into();
blockstore
.transaction_status_cf
.put_protobuf((0, signature, slot), &status)
.unwrap();
TransactionWithStatusMeta {
transaction,
meta: Some(TransactionStatusMeta {
status: Ok(()),
fee: 42,
pre_balances,
post_balances,
inner_instructions,
log_messages,
pre_token_balances,
post_token_balances,
rewards,
}),
}
})
.collect();
for transaction in expected_transactions.clone() {
let signature = transaction.transaction.signatures[0];
assert_eq!(
blockstore.get_rooted_transaction(signature).unwrap(),
Some(ConfirmedTransaction {
slot,
transaction: transaction.clone(),
block_time: None
})
);
assert_eq!(
blockstore
.get_complete_transaction(signature, slot + 1)
.unwrap(),
Some(ConfirmedTransaction {
slot,
transaction,
block_time: None
})
);
}
blockstore.run_purge(0, 2, PurgeType::PrimaryIndex).unwrap();
*blockstore.lowest_cleanup_slot.write().unwrap() = slot;
for TransactionWithStatusMeta { transaction, .. } in expected_transactions {
let signature = transaction.signatures[0];
assert_eq!(blockstore.get_rooted_transaction(signature).unwrap(), None,);
assert_eq!(
blockstore
.get_complete_transaction(signature, slot + 1)
.unwrap(),
None,
);
}
} | rust_cleaned_test_functions.jsonl/9564 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2446
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
12993,
291,
28884,
368,
341,
286,
1077,
9446,
284,
220,
17,
280,
286,
1077,
10695,
284,
1281,
27563,
26092,
6615,
68182,
7,
20,
317,
286,
1077,
557,
53369,
284,
10695,
2346,
4452,
3712,
53... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_unary_minus_decimal() {
let test_cases = vec![
(None, None),
(Some(Decimal::zero()), Some(Decimal::zero())),
(
"0.123".parse::<Decimal>().ok(),
"-0.123".parse::<Decimal>().ok(),
),
(
"-0.123".parse::<Decimal>().ok(),
"0.123".parse::<Decimal>().ok(),
),
];
for (arg, expect_output) in test_cases {
let output = RpnFnScalarEvaluator::new()
.push_param(arg.clone())
.evaluate::<Decimal>(ScalarFuncSig::UnaryMinusDecimal)
.unwrap();
assert_eq!(output, expect_output, "{:?}", arg);
}
} | rust_cleaned_test_functions.jsonl/29751 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 443
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
658,
38457,
74429,
368,
341,
286,
1077,
1273,
41427,
284,
7486,
90515,
310,
320,
4064,
11,
2240,
1326,
310,
320,
8373,
7,
11269,
486,
14154,
11858,
4329,
7,
11269,
486,
14154,
73727,
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_enrich_invalid_empty_tensor() {
let v = EventValue::Summary(SummaryValue(Box::new(Value::Tensor(pb::TensorProto {
dtype: pb::DataType::DtString.into(),
tensor_shape: Some(tensor_shape(&[0, 3])), // bad rank
string_val: vec![],
..Default::default()
}))));
assert_eq!(
v.into_blob_sequence(&blank("myblobs", pb::DataClass::BlobSequence)),
Err(DataLoss)
);
} | rust_cleaned_test_functions.jsonl/6220 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 296
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6205,
13851,
31433,
15124,
23188,
368,
341,
310,
1077,
348,
284,
3665,
1130,
486,
19237,
3759,
372,
1534,
1130,
67758,
486,
931,
25346,
486,
25336,
76878,
486,
25336,
31549,
341,
394,
13231,
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... | 1 |
#[test]
fn test_connect_wpa3_no_wpa3_iface() {
let mut exec = fuchsia_async::Executor::new().expect("failed to create an executor");
let test_values = test_setup(&mut exec);
// By default IfaceManager has an iface but not one with WPA3.
let (mut iface_manager, mut _sme_stream) =
create_iface_manager_with_client(&test_values, false);
// Call connect on the IfaceManager
let network = ap_types::NetworkIdentifier {
ssid: b"some_ssid".to_vec(),
type_: fidl_fuchsia_wlan_policy::SecurityType::Wpa3,
};
let credential = Credential::Password(b"some_password".to_vec());
let config = client_types::ConnectRequest {
target: client_types::ConnectionCandidate {
network,
credential,
observed_in_passive_scan: Some(true),
bss: generate_random_bss_desc(),
multiple_bss_candidates: None,
},
reason: client_types::ConnectReason::FidlConnectRequest,
};
let connect_fut = iface_manager.connect(config);
// Verify that the request to connect results in an error.
pin_mut!(connect_fut);
assert_variant!(exec.run_until_stalled(&mut connect_fut), Poll::Ready(Err(_)));
} | rust_cleaned_test_functions.jsonl/71912 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 606
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15720,
1670,
6595,
18,
6536,
1670,
6595,
18,
67666,
368,
341,
286,
1077,
5206,
3883,
284,
282,
73391,
28346,
486,
25255,
486,
931,
1005,
17119,
445,
16091,
311,
1855,
458,
31558,
3071,
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_generate_scope() {
let expected = "20150830/us-east-1/iam/aws4_request\n";
let scope = SigningScope {
time: parse_date_time("20150830T123600Z").unwrap(),
region: "us-east-1",
service: "iam",
};
assert_eq!(format!("{}\n", scope.to_string()), expected);
} | rust_cleaned_test_functions.jsonl/83739 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 179
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48851,
23199,
368,
341,
286,
1077,
3601,
284,
330,
17,
15,
16,
20,
15,
23,
18,
15,
62431,
39507,
12,
16,
14,
4932,
41273,
19,
7893,
1699,
876,
286,
1077,
6891,
284,
87424,
10803,
341,
310,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_ror_imm_w() {
assert_eq!(
decode_32(0xea4f74f4),
Instruction::ROR_imm {
params: Reg2ShiftNParams {
rd: Reg::R4,
rm: Reg::R4,
shift_n: 31,
setflags: SetFlags::False
}
}
);
} | rust_cleaned_test_functions.jsonl/64858 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 215
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
1710,
269,
71370,
1670,
368,
341,
14808,
262,
2060,
10714,
33673,
286,
16895,
62,
18,
17,
7,
15,
56570,
19,
69,
22,
19,
69,
19,
1326,
286,
29051,
486,
49,
868,
71370,
341,
310,
3628,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_non_loader_key() {
let key0 = Pubkey::new_unique();
let key1 = Pubkey::new_unique();
let loader_key = Pubkey::new_unique();
let instructions = vec![
CompiledInstruction::new(1, &(), vec![0]),
CompiledInstruction::new(2, &(), vec![0, 1]),
];
let message = SanitizedMessage::try_from(LegacyMessage::new_with_compiled_instructions(
1,
0,
2,
vec![key0, key1, loader_key],
Hash::default(),
instructions,
))
.unwrap();
assert!(message.is_non_loader_key(0));
assert!(message.is_non_loader_key(1));
assert!(!message.is_non_loader_key(2));
} | rust_cleaned_test_functions.jsonl/119822 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 389
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
21637,
22139,
3097,
368,
341,
286,
1077,
1376,
15,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
1376,
16,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
16047,
3097,
284,
22611,
79... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pass_input_method_parse() {
let correct_cases = vec![
("", <PassInputMethod as Default>::default()),
("stdin", PassInputMethod::Terminal),
("env", PassInputMethod::EnvVariable(None)),
(
"env:VAR",
PassInputMethod::EnvVariable(Some("VAR".to_owned())),
),
(
"pass",
PassInputMethod::CmdLineParameter(ZeroizeOnDrop("".to_owned())),
),
(
"pass:PASS",
PassInputMethod::CmdLineParameter(ZeroizeOnDrop("PASS".to_owned())),
),
];
for (inp, out) in correct_cases {
let method = <PassInputMethod as FromStr>::from_str(inp);
assert!(method.is_ok());
assert_eq!(method.unwrap(), out)
}
} | rust_cleaned_test_functions.jsonl/69154 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 476
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15464,
5898,
9032,
21039,
368,
341,
286,
1077,
4396,
41427,
284,
7486,
90515,
310,
3489,
497,
366,
12187,
2505,
3523,
438,
7899,
6831,
2258,
14702,
310,
3489,
51602,
497,
9970,
2505,
3523,
486,
47... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_runnables_with_features() {
check(
r#"
//- /lib.rs crate:foo cfg:feature=foo,feature=bar
$0
#[test]
#[cfg(all(feature = "foo", feature = "bar"))]
fn test_foo1() {}
"#,
&[&TEST],
expect![[r#"
[
Runnable {
nav: NavigationTarget {
file_id: FileId(
0,
),
full_range: 1..72,
focus_range: 58..67,
name: "test_foo1",
kind: Function,
},
kind: Test {
test_id: Path(
"test_foo1",
),
attr: TestAttr {
ignore: false,
},
},
cfg: Some(
All(
[
Atom(
KeyValue {
key: "feature",
value: "foo",
},
),
Atom(
KeyValue {
key: "feature",
value: "bar",
},
),
],
),
),
},
]
"#]],
);
} | rust_cleaned_test_functions.jsonl/2493 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1489
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14007,
77,
4788,
6615,
14965,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
61463,
608,
2740,
25638,
17717,
25,
7975,
13286,
25,
12753,
28,
7975,
11,
12753,
28,
2257,
198,
3,
15,
198,
13353,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_woff2_transformed_glyf_table() {
let glyph = Glyph {
number_of_contours: 1,
bounding_box: BoundingBox {
x_min: 1761,
y_min: 565,
x_max: 2007,
y_max: 1032,
},
data: GlyphData::Simple(SimpleGlyph {
end_pts_of_contours: vec![2],
instructions: vec![],
flags: vec![
SimpleGlyphFlag::from_bits_truncate(1),
SimpleGlyphFlag::from_bits_truncate(1),
SimpleGlyphFlag::from_bits_truncate(1),
],
coordinates: vec![Point(1761, 565), Point(2007, 565), Point(1884, 1032)],
}),
};
let expected = GlyfTable {
records: vec![
GlyfRecord::Empty,
GlyfRecord::Empty,
GlyfRecord::Parsed(glyph),
],
};
with_woff2_glyf_table("tests/fonts/woff2/test-font.woff2", |glyf| {
assert_eq!(glyf, expected)
});
} | rust_cleaned_test_functions.jsonl/40128 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 562
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
68585,
17,
18449,
291,
1889,
398,
69,
5237,
368,
341,
262,
1077,
32150,
284,
87413,
341,
286,
1372,
3575,
10260,
2471,
25,
220,
16,
345,
286,
30618,
10194,
25,
425,
57504,
341,
310,
856,
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_byte_array_new_with_error() {
use crate::exceptions::PyValueError;
let gil = Python::acquire_gil();
let py = gil.python();
let py_bytearray_result = PyByteArray::new_with(py, 10, |_b: &mut [u8]| {
Err(PyValueError::new_err("Hello Crustaceans!"))
});
assert!(py_bytearray_result.is_err());
assert!(py_bytearray_result
.err()
.unwrap()
.is_instance::<PyValueError>(py));
} | rust_cleaned_test_functions.jsonl/60122 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 261
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19737,
3858,
5921,
6615,
4096,
368,
341,
286,
990,
17717,
486,
61752,
486,
13828,
1130,
1454,
280,
286,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
286,
1077,
4510,
284,
342,
321,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_process_pull_response() {
let mut node_crds = Crds::default();
let mut node = CrdsGossipPull::default();
let peer_pubkey = solana_sdk::pubkey::new_rand();
let peer_entry = CrdsValue::new_unsigned(CrdsData::ContactInfo(
ContactInfo::new_localhost(&peer_pubkey, 0),
));
let mut timeouts = HashMap::new();
timeouts.insert(Pubkey::default(), node.crds_timeout);
timeouts.insert(peer_pubkey, node.msg_timeout + 1);
// inserting a fresh value should be fine.
assert_eq!(
node.process_pull_response(
&mut node_crds,
&peer_pubkey,
&timeouts,
vec![peer_entry.clone()],
1,
)
.0,
0
);
let mut node_crds = Crds::default();
let unstaked_peer_entry = CrdsValue::new_unsigned(CrdsData::ContactInfo(
ContactInfo::new_localhost(&peer_pubkey, 0),
));
assert_eq!(
node.process_pull_response(
&mut node_crds,
&peer_pubkey,
&timeouts,
vec![peer_entry.clone(), unstaked_peer_entry],
node.msg_timeout + 100,
)
.0,
2
);
let mut node_crds = Crds::default();
// check that old contact infos can still land as long as they have a "timeouts" entry
assert_eq!(
node.process_pull_response(
&mut node_crds,
&peer_pubkey,
&timeouts,
vec![peer_entry],
node.msg_timeout + 1,
)
.0,
0
);
// construct something that's not a contact info
let peer_vote =
CrdsValue::new_unsigned(CrdsData::Vote(0, Vote::new(&peer_pubkey, test_tx(), 0)));
assert_eq!(
node.process_pull_response(
&mut node_crds,
&peer_pubkey,
&timeouts,
vec![peer_vote.clone()],
node.msg_timeout + 1,
)
.0,
0
);
let mut node_crds = Crds::default();
assert_eq!(
node.process_pull_response(
&mut node_crds,
&peer_pubkey,
&timeouts,
vec![peer_vote],
node.msg_timeout + 1,
)
.0,
1
);
} | rust_cleaned_test_functions.jsonl/82285 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1504
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
65693,
9655,
368,
341,
286,
1077,
5206,
2436,
32331,
5356,
284,
4553,
5356,
486,
2258,
543,
286,
1077,
5206,
2436,
284,
4553,
5356,
38,
41473,
36068,
486,
2258,
1428,
286,
1077,
14397,
3401... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_zeroed() {
const ZEROS_LEN: usize = 1024;
let mut buf = [0; ZEROS_LEN];
assert!(PreAccount::is_zeroed(&buf));
buf[0] = 1;
assert!(!PreAccount::is_zeroed(&buf));
let mut buf = [0; ZEROS_LEN - 1];
assert!(PreAccount::is_zeroed(&buf));
buf[0] = 1;
assert!(!PreAccount::is_zeroed(&buf));
let mut buf = [0; ZEROS_LEN + 1];
assert!(PreAccount::is_zeroed(&buf));
buf[0] = 1;
assert!(!PreAccount::is_zeroed(&buf));
let buf = vec![];
assert!(PreAccount::is_zeroed(&buf));
} | rust_cleaned_test_functions.jsonl/15690 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 326
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
19359,
291,
368,
341,
286,
733,
1863,
640,
3126,
15536,
25,
22301,
284,
220,
16,
15,
17,
19,
280,
286,
1077,
5206,
6607,
284,
508,
15,
26,
1863,
640,
3126,
15536,
935,
286,
2060,
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_index_rw_lock() {
let dbname = "target/tests/testindexrwlock";
let _ = Index::drop(dbname);
let index = Index::open(dbname, Some(OpenOptions::Create)).unwrap();
let index = Arc::new(MvccRwLock::new(index));
let index_write = index.clone();
let (sender_w, receiver_r) = channel();
let (sender_r, receiver_w) = channel();
// Spawn off a writer
thread::spawn(move || {
let mut index = index_write.write().unwrap();
let mut batch = Batch::new();
// wait until the main thread has read access
assert_eq!(1, receiver_w.recv().unwrap());
println!("reader sent success 1");
index
.add(r#"{"_id":"1","foo":"bar"}"#, &mut batch)
.unwrap();
index.flush(batch).unwrap();
println!("sending to reader");
sender_w.send(2).unwrap();
// wait until the main thread has successfully performed a query
assert_eq!(3, receiver_w.recv().unwrap());
println!("reader sent success 3");
});
let index = index.read();
sender_r.send(1).unwrap();
// wait until the writer thread has written something
assert_eq!(2, receiver_r.recv().unwrap());
println!("writer sent success 2");
let mut iter = index.query(r#"find {foo: == "bar"}"#, None).unwrap();
assert_eq!(JsonValue::String("1".to_string()), iter.next().unwrap());
sender_r.send(3).unwrap();
} | rust_cleaned_test_functions.jsonl/15065 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 721
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3560,
49566,
9818,
368,
341,
286,
1077,
83492,
284,
330,
5657,
62468,
12697,
1252,
31768,
1023,
876,
286,
1077,
716,
284,
8008,
486,
6719,
9791,
606,
626,
286,
1077,
1922,
284,
8008,
486,
2508,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_commit_style_raw_no_decoration() {
let config = integration_test_utils::make_config_from_args(&[
"--commit-style",
"raw",
"--commit-decoration-style",
"omit",
]);
let output = integration_test_utils::run_delta(GIT_DIFF_SINGLE_HUNK, &config);
ansi_test_utils::assert_line_has_no_color(
&output,
0,
"commit 94907c0f136f46dc46ffae2dc92dca9af7eb7c2e",
);
assert!(output.contains(
"\
commit 94907c0f136f46dc46ffae2dc92dca9af7eb7c2e
"
));
} | rust_cleaned_test_functions.jsonl/70054 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 348
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36346,
15117,
16067,
6536,
2259,
26452,
368,
341,
286,
1077,
2193,
284,
17590,
4452,
17309,
486,
6927,
5332,
5673,
8384,
2099,
9640,
310,
14482,
17413,
11297,
756,
310,
330,
1041,
756,
310,
14482,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_socket_addr() {
// V4.
let want_ext = SocketAddress(std::net::SocketAddr::V4(std::net::SocketAddrV4::new(
std::net::Ipv4Addr::new(1, 2, 3, 4),
5,
)));
let want_fidl = fidl::SocketAddress::Ipv4(fidl::Ipv4SocketAddress {
address: fidl::Ipv4Address { addr: [1, 2, 3, 4] },
port: 5,
});
let got_fidl: fidl::SocketAddress = want_ext.into();
let got_ext = SocketAddress::from(want_fidl);
assert_eq!(want_ext, got_ext);
assert_eq!(want_fidl, got_fidl);
// V6.
let want_ext = SocketAddress(std::net::SocketAddr::V6(std::net::SocketAddrV6::new(
std::net::Ipv6Addr::new(0x0102, 0x0304, 0x0506, 0x0708, 0x090A, 0x0B0C, 0x0D0E, 0x0F10),
17,
0,
18,
)));
let want_fidl = fidl::SocketAddress::Ipv6(fidl::Ipv6SocketAddress {
address: fidl::Ipv6Address {
addr: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],
},
port: 17,
zone_index: 18,
});
let got_fidl: fidl::SocketAddress = want_ext.into();
let got_ext = SocketAddress::from(got_fidl);
assert_eq!(want_ext, got_ext);
assert_eq!(want_fidl, want_fidl);
} | rust_cleaned_test_functions.jsonl/56510 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 763
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19555,
7387,
368,
341,
286,
442,
647,
19,
624,
286,
1077,
1366,
9927,
284,
20954,
4286,
5194,
486,
4711,
486,
10286,
13986,
486,
53,
19,
5194,
486,
4711,
486,
10286,
13986,
53,
19,
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... | 1 |
#[test]
fn test_value_arc() {
assert_ne!(crate::Type::INVALID, MySharedArc::static_type());
let b = MySharedArc::from_refcounted(std::sync::Arc::new(MySharedInner {
foo: String::from("abc"),
}));
let v = b.to_value();
let b2 = v.get::<MySharedArc>().unwrap();
assert!(std::sync::Arc::ptr_eq(&b.0, &b2.0));
} | rust_cleaned_test_functions.jsonl/105011 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 195
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3142,
62914,
368,
341,
286,
2060,
13925,
10297,
61711,
486,
929,
486,
46859,
11,
3017,
16997,
36809,
486,
1978,
1819,
5231,
286,
1077,
293,
284,
3017,
16997,
36809,
486,
1499,
7793,
1830,
291,
519... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_case_5() {
let key = "dea398b2d764bca68dfc023a9821939d389e38a072cf1b413bb1517c3fe83abe";
let nonce = "bb1cdf3a218abb1b0c01da64c24f59ee";
let expected_output =
"65a20993e8e69de41d38e94c0796cb7baccd6d80a6e4084e65d0d574fbcb7311";
hchacha_test_runner(key, nonce, expected_output);
} | rust_cleaned_test_functions.jsonl/44667 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 225
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19096,
62,
20,
368,
341,
310,
1077,
1376,
284,
330,
55088,
18,
24,
23,
65,
17,
67,
22,
21,
19,
65,
924,
21,
23,
2940,
66,
15,
17,
18,
64,
24,
23,
17,
16,
24,
18,
24,
67,
18,
23,
24,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_string_1() {
let src_data = b"(test) a \"abc\"";
let expected_document = yass_document!(("test") "a": "\"abc\"");
let expected_positions = pos_array![(0, 7), (0, 9)];
let (result_doc, pos_map) = yass_parser::parse(yass_parser::ParserLimits::unlimited(), src_data).unwrap();
assert_eq!(result_doc, expected_document);
assert_eq!(result_doc.gather_positions_to_vec(&pos_map), expected_positions);
} | rust_cleaned_test_functions.jsonl/126488 | {
"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,
3904,
62,
16,
368,
341,
262,
1077,
2286,
1769,
284,
293,
29209,
1944,
8,
264,
7245,
13683,
95349,
262,
1077,
3601,
26231,
284,
379,
395,
26231,
10297,
445,
1944,
899,
330,
64,
788,
15898,
13683,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_handle_msg_append() {
setup_for_test();
let nm = |term, log_term, index, commit, ents: Option<Vec<(u64, u64)>>| {
let mut m = Message::new();
m.set_msg_type(MessageType::MsgAppend);
m.set_term(term);
m.set_log_term(log_term);
m.set_index(index);
m.set_commit(commit);
if let Some(ets) = ents {
m.set_entries(RepeatedField::from_vec(
ets.iter().map(|&(i, t)| empty_entry(t, i)).collect(),
));
}
m
};
let mut tests = vec![
// Ensure 1
(nm(2, 3, 2, 3, None), 2, 0, true), // previous log mismatch
(nm(2, 3, 3, 3, None), 2, 0, true), // previous log non-exist
// Ensure 2
(nm(2, 1, 1, 1, None), 2, 1, false),
(nm(2, 0, 0, 1, Some(vec![(1, 2)])), 1, 1, false),
(nm(2, 2, 2, 3, Some(vec![(3, 2), (4, 2)])), 4, 3, false),
(nm(2, 2, 2, 4, Some(vec![(3, 2)])), 3, 3, false),
(nm(2, 1, 1, 4, Some(vec![(2, 2)])), 2, 2, false),
// Ensure 3
(nm(1, 1, 1, 3, None), 2, 1, false),
(nm(1, 1, 1, 3, Some(vec![(2, 2)])), 2, 2, false),
// entry 2
(nm(2, 2, 2, 3, None), 2, 2, false),
(nm(2, 2, 2, 4, None), 2, 2, false),
];
for (j, (m, w_index, w_commit, w_reject)) in tests.drain(..).enumerate() {
let store = new_storage();
store
.wl()
.append(&[empty_entry(1, 1), empty_entry(2, 2)])
.expect("");
let mut sm = new_test_raft(1, vec![1], 10, 1, store);
sm.become_follower(2, INVALID_ID);
sm.handle_append_entries(&m);
if sm.raft_log.last_index() != w_index {
panic!(
"#{}: last_index = {}, want {}",
j,
sm.raft_log.last_index(),
w_index
);
}
if sm.raft_log.committed != w_commit {
panic!(
"#{}: committed = {}, want {}",
j, sm.raft_log.committed, w_commit
);
}
let m = sm.read_messages();
if m.len() != 1 {
panic!("#{}: msg count = {}, want 1", j, m.len());
}
if m[0].get_reject() != w_reject {
panic!("#{}: reject = {}, want {}", j, m[0].get_reject(), w_reject);
}
}
} | rust_cleaned_test_functions.jsonl/107114 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1344
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10630,
6483,
26041,
368,
341,
262,
6505,
5478,
4452,
543,
262,
1077,
25723,
284,
760,
4991,
11,
1487,
17464,
11,
1922,
11,
5266,
11,
36852,
25,
6959,
50439,
28706,
84,
21,
19,
11,
575,
21,
19,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
#[test]
fn test_with_mixed_wave_signal() -> anyhow::Result<()> {
let mut detector = HannedFftDetector::default();
assert_hinted_detector_sine_waves(&mut detector, NoteName::A, vec![440., 523.25])?;
Ok(())
} | rust_cleaned_test_functions.jsonl/63238 | {
"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,
6615,
717,
3286,
60063,
21137,
368,
1464,
88964,
486,
2077,
71698,
341,
286,
1077,
5206,
31214,
284,
472,
7295,
37,
723,
31606,
486,
2258,
543,
286,
2060,
45825,
291,
71540,
643,
482,
1670,
4693,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_invalid_to_tpml_digest_conversion() {
let pcr_selection_list_1 = PcrSelectionListBuilder::new()
.with_selection(
HashingAlgorithm::Sha256,
&[
PcrSlot::Slot0,
PcrSlot::Slot1,
PcrSlot::Slot2,
PcrSlot::Slot3,
PcrSlot::Slot4,
PcrSlot::Slot5,
PcrSlot::Slot6,
PcrSlot::Slot7,
],
)
.build()
.expect("Failed to create PcrSelectionList 1");
let mut pcr_digest_list_1 = DigestList::new();
for i in 0u8..7u8 {
let value: [u8; 1] = [i];
pcr_digest_list_1
.add(Digest::try_from(&value[..]).expect("Failed to create digest value"))
.expect("Failed to add value to digest");
}
let mut pcr_data = PcrData::new();
let pcr_data_add_result = pcr_data.add(&pcr_selection_list_1, &pcr_digest_list_1);
assert_eq!(
Err(Error::WrapperError(WrapperErrorKind::InconsistentParams)),
pcr_data_add_result,
"Did not receive expected error"
);
} | rust_cleaned_test_functions.jsonl/16366 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 612
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
2346,
55191,
1014,
52994,
64132,
368,
341,
262,
1077,
281,
5082,
23672,
2019,
62,
16,
284,
393,
5082,
11177,
852,
3297,
486,
931,
741,
286,
659,
4197,
23672,
1006,
310,
6531,
287,
27847,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_case() {
let doc = paste! {
get_doc!(#[doc = "HTTP " get:upper "!"])
};
let expected = "HTTP GET!";
assert_eq!(doc, expected);
} | rust_cleaned_test_functions.jsonl/36573 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 85
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19096,
368,
341,
262,
1077,
4629,
284,
24937,
0,
341,
286,
633,
18869,
10297,
13353,
5236,
284,
330,
9230,
330,
633,
25,
13574,
53074,
14108,
262,
3634,
262,
1077,
3601,
284,
330,
9230,
7890,
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 |
#[test]
fn test_preboot_set_balloon_dev() {
let req = VmmAction::SetBalloonDevice(BalloonDeviceConfig::default());
check_preboot_request(req, |result, vm_res| {
assert_eq!(result, Ok(VmmData::Empty));
assert!(vm_res.balloon_set)
});
let req = VmmAction::SetBalloonDevice(BalloonDeviceConfig::default());
check_preboot_request_err(
req,
VmmActionError::BalloonConfig(BalloonConfigError::DeviceNotFound),
);
} | rust_cleaned_test_functions.jsonl/44530 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 239
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10442,
4619,
2602,
56441,
31335,
10433,
368,
341,
286,
1077,
4232,
284,
647,
3821,
2512,
486,
1649,
37889,
31335,
6985,
5349,
278,
31335,
6985,
2648,
486,
2258,
1423,
286,
1779,
10442,
4619,
7893,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_strip_qualifier() {
let address = gen_random_base58_address();
let valid_fq_address = format!("{}{}", PAYMENT_ADDRESS_QUALIFIER, address);
assert_eq!(strip_qualifier_from_address(&valid_fq_address), address);
} | rust_cleaned_test_functions.jsonl/72543 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 113
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66130,
64391,
3049,
368,
341,
286,
1077,
2621,
284,
4081,
22644,
7651,
20,
23,
6744,
543,
286,
1077,
2697,
761,
80,
6744,
284,
3561,
17223,
6257,
42351,
49377,
5328,
20135,
69942,
26965,
11,
2621,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_sanitize_process() {
let n = 100;
let tmp_dir_path = "/tmp/jailer/tests/sanitize_process";
assert!(fs::create_dir_all(tmp_dir_path).is_ok());
let mut fds = Vec::new();
for i in 0..n {
let maybe_file = File::create(format!("{}/{}", tmp_dir_path, i));
assert!(maybe_file.is_ok());
fds.push(maybe_file.unwrap().as_raw_fd());
}
sanitize_process();
for fd in fds {
let is_fd_opened = unsafe { libc::fcntl(fd, libc::F_GETFD) } == 0;
assert_eq!(is_fd_opened, false);
}
assert!(fs::remove_dir_all(tmp_dir_path).is_ok());
} | rust_cleaned_test_functions.jsonl/49794 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 364
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
58652,
11305,
368,
341,
286,
1077,
308,
284,
220,
16,
15,
15,
401,
286,
1077,
4174,
4334,
2638,
284,
3521,
5173,
4437,
38782,
62468,
2687,
58652,
11305,
876,
286,
2060,
10297,
3848,
486,
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... | 3 |
#[test]
fn test_input_stream_read_raw_varint_pos() {
test_read_partial("95 01 98", |reader| {
assert_eq!(149, reader.read_raw_varint32().unwrap());
assert_eq!(2, reader.pos());
});
} | rust_cleaned_test_functions.jsonl/104501 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 119
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5898,
12673,
6443,
16067,
4612,
396,
6479,
368,
341,
286,
1273,
6443,
52068,
445,
24,
20,
220,
15,
16,
220,
24,
23,
497,
760,
11149,
91,
341,
310,
2060,
10714,
10297,
16,
19,
24,
11,
6604,
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_gitlab_error_detection_unknown() {
let endpoint = ExpectedUrl::builder()
.endpoint("dummy")
.status(StatusCode::NOT_FOUND)
.build()
.unwrap();
let err_obj = json!({
"bogus": "dummy error message",
});
let client = SingleTestClient::new_json(endpoint, &err_obj);
let res: Result<DummyResult, _> = Dummy.query(&client);
let err = res.unwrap_err();
if let ApiError::GitlabUnrecognized {
obj,
} = err
{
assert_eq!(obj, err_obj);
} else {
panic!("unexpected error: {}", err);
}
} | rust_cleaned_test_functions.jsonl/4926 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 361
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68801,
14380,
4096,
57505,
57507,
368,
341,
286,
1077,
14887,
284,
31021,
2864,
486,
17850,
741,
310,
659,
32540,
445,
31390,
1138,
310,
659,
2829,
7,
15872,
486,
14065,
24687,
340,
310,
659,
5834... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_boolean_array_lt_scalar() {
let a: BooleanArray = vec![Some(true), Some(false), None].into();
let res1: Vec<Option<bool>> = lt_bool_scalar(&a, false).unwrap().iter().collect();
assert_eq!(res1, vec![Some(false), Some(false), None]);
let res2: Vec<Option<bool>> = lt_bool_scalar(&a, true).unwrap().iter().collect();
assert_eq!(res2, vec![Some(false), Some(true), None]);
} | rust_cleaned_test_functions.jsonl/45800 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 196
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46642,
3858,
39164,
41652,
368,
341,
286,
1077,
264,
25,
6992,
1857,
284,
7486,
20703,
8373,
3715,
701,
4329,
3576,
701,
2240,
936,
18122,
1428,
286,
1077,
592,
16,
25,
11312,
94150,
17028,
2452,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_with_json_and_bad_content_type() {
let (req, mut pl) = TestRequest::with_header(
header::CONTENT_TYPE,
header::HeaderValue::from_static("text/plain"),
)
.header(
header::CONTENT_LENGTH,
header::HeaderValue::from_static("16"),
)
.set_payload(Bytes::from_static(b"{\"name\": \"test\"}"))
.data(JsonConfig::default().limit(4096))
.to_http_parts();
let s = block_on(Json::<MyObject>::from_request(&req, &mut pl));
assert!(s.is_err())
} | rust_cleaned_test_functions.jsonl/37462 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 289
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
9455,
8378,
34199,
7495,
1819,
368,
341,
286,
1077,
320,
2958,
11,
5206,
625,
8,
284,
3393,
1900,
486,
4197,
8757,
1006,
310,
4247,
486,
67872,
4189,
345,
310,
4247,
486,
97721,
486,
1499,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iseq_random() {
let mut taken = HashSet::new();
let mut seq = Seq::new();
for i in 0..100 {
let ac = random_action();
if taken.insert(ac.clone()) {
seq.handle(FreeGroup::one(ac));
seq.check_invariants();
}
}
for i in 0..100 {
let _: u32 = i;
if i % 2 == 0 {
let ac = random_action();
if taken.insert(ac.clone()) {
seq.handle(FreeGroup::one(ac));
}
} else {
let ac = taken.drain().next().unwrap();
seq.handle(FreeGroup::not(FreeGroup::one(ac)));
}
seq.check_invariants();
}
for ac in taken.drain() {
seq.handle(FreeGroup::not(FreeGroup::one(ac)));
seq.check_invariants();
}
} | rust_cleaned_test_functions.jsonl/112648 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 641
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
1064,
80,
22644,
368,
341,
310,
1077,
5206,
4429,
284,
18931,
486,
931,
1428,
310,
1077,
5206,
12981,
284,
23744,
486,
931,
1428,
310,
369,
600,
304,
220,
15,
496,
16,
15,
15,
341,
394,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
#[test]
fn test_long_to_short() {
let mut short = Opt {
name: Long("banana".to_string()),
hasarg: Yes,
occur: Req,
aliases: Vec::new(),
};
short.aliases = vec!(Opt { name: Short('b'),
hasarg: Yes,
occur: Req,
aliases: Vec::new() });
let verbose = reqopt("b", "banana", "some bananas", "VAL");
assert!(verbose.long_to_short() == short);
} | rust_cleaned_test_functions.jsonl/13335 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 313
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17799,
2346,
16673,
368,
341,
286,
1077,
5206,
2805,
284,
16554,
341,
310,
829,
25,
5724,
445,
87747,
3263,
983,
3904,
14702,
310,
702,
858,
25,
7414,
345,
310,
12170,
25,
82458,
345,
310,
40386... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_type() {
Python::with_gil(|py| {
let obj = py.eval("42", None, None).unwrap();
assert_eq!(obj.get_type().as_type_ptr(), obj.get_type_ptr());
});
} | rust_cleaned_test_functions.jsonl/93717 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1819,
368,
341,
286,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
341,
310,
1077,
2839,
284,
4510,
31710,
445,
19,
17,
497,
2240,
11,
2240,
568,
15454,
543,
310,
2060,
10714,
10297,
2295,
670,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_query_captures_with_matches_removed_before_they_finish() {
allocations::record(|| {
let language = get_language("javascript");
// even though it hasn't matched the entire pattern yet. A
let query = Query::new(
language,
r#"
(namespace_import
"*" @star
"as" @as
(identifier) @identifier)
"#,
)
.unwrap();
let source = "
import * as name from 'module-name';
";
let mut parser = Parser::new();
parser.set_language(language).unwrap();
let tree = parser.parse(&source, None).unwrap();
let mut cursor = QueryCursor::new();
let mut captured_strings = Vec::new();
for (m, i) in cursor.captures(&query, tree.root_node(), source.as_bytes()) {
let capture = m.captures[i];
let text = capture.node.utf8_text(source.as_bytes()).unwrap();
if text == "as" {
m.remove();
continue;
}
captured_strings.push(text);
}
// capture from the match should prevent "name" from matching:
assert_eq!(captured_strings, &["*",]);
});
} | rust_cleaned_test_functions.jsonl/77470 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 670
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5738,
666,
2689,
1413,
6615,
38344,
68248,
23708,
5854,
1195,
42980,
368,
341,
262,
69642,
486,
8548,
79453,
341,
286,
1077,
4128,
284,
633,
29021,
445,
14073,
797,
16885,
286,
442,
1496,
3498,
43... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_expected_result() {
let ts = TestScenario::new("id");
match expected_result(&ts, &[]) {
Ok(r) => assert!(r.succeeded()),
Err(s) => assert!(s.starts_with("uutils-tests-warning")),
}
let ts = TestScenario::new("no test name");
assert!(expected_result(&ts, &[]).is_err());
} | rust_cleaned_test_functions.jsonl/12804 | {
"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,
32190,
5287,
368,
341,
286,
1077,
10591,
284,
3393,
54031,
486,
931,
445,
307,
797,
1789,
286,
2432,
3601,
5287,
2099,
2576,
11,
609,
15793,
341,
310,
7622,
2601,
8,
589,
2060,
10297,
81,
514,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_try_getcontext() {
unsafe {
let ctx = mlirContextCreate();
let llvm = mlirGetDialectHandle__llvm__();
mlirDialectHandleRegisterDialect(llvm, ctx);
mlirDialectHandleLoadDialect(llvm, ctx);
let num_dialects = mlirContextGetNumRegisteredDialects(ctx);
mlirContextDestroy(ctx);
}
} | rust_cleaned_test_functions.jsonl/40531 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 196
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
3062,
2147,
368,
341,
286,
19860,
341,
310,
1077,
5635,
284,
15739,
404,
1972,
4021,
543,
310,
1077,
34664,
284,
15739,
404,
1949,
35,
55056,
6999,
563,
29042,
563,
543,
310,
15739,
404,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reflect_slanted_surface() {
let v = Tuple::vector(0.0, -1.0, 0.0);
let val = 2f32.sqrt() / 2.0;
let n = Tuple::vector(val, val, 0.0);
let expected_reflection = Tuple::vector(1.0, 0.0, 0.0);
assert_eq!(v.reflect(&n), expected_reflection);
} | rust_cleaned_test_functions.jsonl/113529 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 158
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7793,
767,
11886,
7566,
31030,
368,
341,
286,
1077,
348,
284,
24622,
486,
3215,
7,
15,
13,
15,
11,
481,
16,
13,
15,
11,
220,
15,
13,
15,
317,
286,
1077,
1044,
284,
220,
17,
69,
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... | 1 |
#[test]
fn test_device_parsing() -> Result<()> {
// Device must have a path provided
assert!(DeviceConfig::parse("").is_err());
assert_eq!(
DeviceConfig::parse("path=/path/to/device")?,
DeviceConfig {
path: PathBuf::from("/path/to/device"),
id: None,
iommu: false
}
);
assert_eq!(
DeviceConfig::parse("path=/path/to/device,iommu=on")?,
DeviceConfig {
path: PathBuf::from("/path/to/device"),
id: None,
iommu: true
}
);
assert_eq!(
DeviceConfig::parse("path=/path/to/device,iommu=on,id=mydevice0")?,
DeviceConfig {
path: PathBuf::from("/path/to/device"),
id: Some("mydevice0".to_owned()),
iommu: true
}
);
Ok(())
} | rust_cleaned_test_functions.jsonl/61752 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 549
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9204,
620,
28598,
368,
1464,
5714,
71698,
341,
286,
442,
13903,
1969,
614,
264,
1815,
3897,
198,
286,
2060,
10297,
6985,
2648,
486,
6400,
80821,
285,
9266,
1423,
286,
2060,
10714,
33673,
310,
1390... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_borrow_mut_with() {
let mut lazycell = LazyCell::new();
{
let value = lazycell.borrow_mut_with(|| 1);
assert_eq!(&mut 1, value);
*value = 2;
}
assert_eq!(&2, lazycell.borrow().unwrap());
} | rust_cleaned_test_functions.jsonl/5796 | {
"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,
880,
7768,
29523,
6615,
368,
341,
286,
1077,
5206,
64436,
3337,
613,
284,
44263,
3599,
486,
931,
1428,
286,
341,
310,
1077,
897,
284,
64436,
3337,
613,
83640,
29523,
6615,
79453,
220,
16,
317,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_large_delta_time() -> Result<(), Box<dyn std::error::Error>> {
Command::new(get_os_binary_loc())
.arg("-d")
.arg("18446744073709551616")
.assert()
.failure()
.stderr(predicate::str::contains(
"Please set your time delta to be at most",
));
Ok(())
} | rust_cleaned_test_functions.jsonl/65680 | {
"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,
45228,
26710,
3009,
368,
1464,
5714,
68843,
8261,
92846,
1460,
486,
841,
486,
1454,
2452,
341,
262,
7348,
486,
931,
5433,
29387,
31761,
13400,
2398,
286,
659,
858,
13645,
67,
1138,
286,
659,
858,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_padded_multiple_unaligned() {
// Use 127 for this test because it unpads to 128 – a multiple of 32.
// Otherwise the last chunk will be too short and cannot be converted to Fr.
for i in 1..126 {
let mut data = vec![255u8; 127];
let buf = Vec::new();
let mut cursor = Cursor::new(buf);
let mut written = write_padded(&mut data[0..i].as_ref(), &mut cursor).unwrap();
written += write_padded(&mut data[i..].as_ref(), &mut cursor).unwrap();
let padded = cursor.into_inner();
validate_fr32(&padded);
assert_eq!(written, 127);
assert_eq!(
padded.len(),
FR32_PADDING_MAP.transform_byte_offset(127, true)
);
// Check bytes in the boundary between calls: `i` and `i-1`.
for offset in [i - 1, i].iter() {
if *offset % 32 == 31 {
// Byte with padding.
assert_eq!(padded[*offset], 0b0011_1111);
} else {
assert_eq!(padded[*offset], 255u8);
}
}
assert_eq!(padded.into_boxed_slice(), bit_vec_padding(data));
}
} | rust_cleaned_test_functions.jsonl/32998 | {
"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,
9165,
620,
16828,
45233,
4907,
47142,
368,
341,
286,
442,
5443,
220,
16,
17,
22,
369,
419,
1273,
1576,
432,
21624,
7664,
311,
220,
16,
17,
23,
1365,
264,
5248,
315,
220,
18,
17,
624,
286,
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... | 4 |
#[test]
fn test_insert_key_with_different_key_version() {
let mut map: HashMap<Key, Value> = HashMap::new();
let key1 = Key {
key: "a".to_owned(),
key_version: 0,
};
let data = serialize(&"value".to_owned()).expect("serialize");
let value1 = Value {
type_id: "String".to_owned(),
data,
};
let key2 = Key {
key: "a".to_owned(),
key_version: 1,
};
let data = serialize(&1).expect("serialize");
let value2 = Value {
type_id: "i32".into(),
data,
};
let result = map.insert(key1.clone(), value1);
assert!(result.is_none());
let result = map.insert(key2.clone(), value2);
assert!(result.is_some());
assert_eq!(map.len(), 1);
} | rust_cleaned_test_functions.jsonl/90781 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 449
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
3097,
6615,
82741,
3097,
9438,
368,
341,
286,
1077,
5206,
2415,
25,
10528,
42003,
11,
5162,
29,
284,
10528,
486,
931,
543,
286,
1077,
1376,
16,
284,
5309,
341,
310,
1376,
25,
330,
64,
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_inspect_log_connect_stats() {
let mut exec = fasync::TestExecutor::new().expect("Failed to create an executor");
let (mut cobalt_sender, _cobalt_receiver) = fake_cobalt_sender();
let (mut cobalt_1dot1_proxy, mut cobalt_1dot1_stream) =
create_proxy_and_stream::<fidl_fuchsia_metrics::MetricEventLoggerMarker>()
.expect("failed to create Cobalt 1.1 proxy and stream");
let (inspect_tree, _persistence_stream) = fake_inspect_tree();
let connect_stats = fake_connect_stats();
let fut = log_connect_stats(
&mut cobalt_sender,
&mut cobalt_1dot1_proxy,
inspect_tree.clone(),
&connect_stats,
);
pin_mut!(fut);
// This is to execute and complete the Future
let _cobalt_1dot1_events =
drain_cobalt_events(&mut exec, &mut fut, &mut cobalt_1dot1_stream);
assert_data_tree!(inspect_tree.inspector, root: contains {
client_stats: contains {
connect: {
"0": {
"@time": AnyProperty,
attempts: 1u64,
reconnect_info: {
gap_time: DURATION_SINCE_LAST_DISCONNECT.into_nanos(),
same_ssid: true,
},
}
}
}
});
} | rust_cleaned_test_functions.jsonl/50933 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 794
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34386,
987,
5224,
15720,
15381,
368,
341,
286,
1077,
5206,
3883,
284,
282,
7692,
486,
2271,
25255,
486,
931,
1005,
17119,
445,
9408,
311,
1855,
458,
31558,
797,
286,
1077,
320,
6984,
33828,
3145,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_m128() {
#[cfg(target_arch = "x86")]
use core::arch::x86::*;
#[cfg(target_arch = "x86_64")]
use core::arch::x86_64::*;
#[repr(C, align(16))]
struct F32x3_A16([f32; 3]);
let v0 = Vec3A::new(1.0, 2.0, 3.0);
let m0: __m128 = v0.into();
let mut a0 = F32x3_A16([0.0, 0.0, 0.0]);
unsafe {
_mm_store_ps(a0.0.as_mut_ptr(), m0);
}
assert_eq!([1.0, 2.0, 3.0], a0.0);
let v1 = Vec3A::from(m0);
assert_eq!(v0, v1);
#[repr(C, align(16))]
struct U32x3_A16([u32; 3]);
let v0 = BVec3A::new(true, false, true);
let m0: __m128 = v0.into();
let mut a0 = U32x3_A16([1, 2, 3]);
unsafe {
_mm_store_ps(a0.0.as_mut_ptr() as *mut f32, m0);
}
assert_eq!([0xffffffff, 0, 0xffffffff], a0.0);
} | rust_cleaned_test_functions.jsonl/23407 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 557
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
16,
17,
23,
368,
341,
286,
11506,
14072,
8637,
34330,
284,
330,
87,
23,
21,
5422,
286,
990,
6200,
486,
1113,
486,
87,
23,
21,
56162,
286,
11506,
14072,
8637,
34330,
284,
330,
87,
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_poll_indexer_migration() {
let mut deps = mock_dependencies(20, &[]);
poll_indexer_old_store(&mut deps.storage, &PollStatus::InProgress)
.save(&1u64.to_be_bytes(), &true)
.unwrap();
poll_indexer_old_store(&mut deps.storage, &PollStatus::Executed)
.save(&2u64.to_be_bytes(), &true)
.unwrap();
migrate_poll_indexer(&mut deps.storage, &PollStatus::InProgress).unwrap();
migrate_poll_indexer(&mut deps.storage, &PollStatus::Executed).unwrap();
migrate_poll_indexer(&mut deps.storage, &PollStatus::Passed).unwrap();
assert_eq!(
poll_indexer_store(&mut deps.storage, &PollStatus::InProgress)
.load(&1u64.to_be_bytes())
.unwrap(),
true
);
assert_eq!(
poll_indexer_store(&mut deps.storage, &PollStatus::Executed)
.load(&2u64.to_be_bytes())
.unwrap(),
true
);
} | rust_cleaned_test_functions.jsonl/44518 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 524
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40002,
3560,
261,
90373,
368,
341,
286,
1077,
5206,
48178,
284,
7860,
71841,
7,
17,
15,
11,
609,
56703,
286,
7085,
3560,
261,
21108,
14809,
2099,
6984,
48178,
22403,
11,
609,
49207,
2522,
486,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_write_fidelio_to_file() {
let (mut causet, tmp_dir) = EINSTEINDBConfig::with_tmp().unwrap();
causet.causet_path = tmp_dir.path().join("causet_file").to_str().unwrap().to_owned();
{
let c = r#"
## comment should be reserve
[violetabftstore]
# config that comment out by one `#` should be fidelio in place
## fidel-heartbeat-tick-interval = "30s"
# fidel-heartbeat-tick-interval = "30s"
[lmdb.defaultcauset]
## config should be fidelio in place
block-cache-size = "10GB"
[lmdb.lockcauset]
## this config will not fidelio even it has the same last
## name as `lmdb.defaultcauset.block-cache-size`
block-cache-size = "512MB"
[interlock]
## the fidelio to `interlock.brane-split-tuplespaceInstanton`, which do not show up
## as key-value pair after [interlock], will be written at the lightlike of [interlock]
[gc]
## config should be fidelio in place
max-write-bytes-per-sec = "1KB"
[lmdb.defaultcauset.titan]
blob-run-mode = "normal"
"#;
let mut f = File::create(&causet.causet_path).unwrap();
f.write_all(c.as_bytes()).unwrap();
f.sync_all().unwrap();
}
let causet_controller = ConfigController::new(causet);
let change = {
let mut change = HashMap::new();
change.insert(
"violetabftstore.fidel-heartbeat-tick-interval".to_owned(),
"1h".to_owned(),
);
change.insert(
"interlock.brane-split-tuplespaceInstanton".to_owned(),
"10000".to_owned(),
);
change.insert("gc.max-write-bytes-per-sec".to_owned(), "100MB".to_owned());
change.insert(
"lmdb.defaultcauset.block-cache-size".to_owned(),
"1GB".to_owned(),
);
change.insert(
"lmdb.defaultcauset.titan.blob-run-mode".to_owned(),
"read-only".to_owned(),
);
change
};
causet_controller.fidelio(change).unwrap();
let res = {
let mut buf = Vec::new();
let mut f = File::open(&causet_controller.get_current().causet_path).unwrap();
f.read_to_lightlike(&mut buf).unwrap();
buf
};
let expect = r#"
## comment should be reserve
[violetabftstore]
# config that comment out by one `#` should be fidelio in place
## fidel-heartbeat-tick-interval = "30s"
fidel-heartbeat-tick-interval = "1h"
[lmdb.defaultcauset]
## config should be fidelio in place
block-cache-size = "1GB"
[lmdb.lockcauset]
## this config will not fidelio even it has the same last
## name as `lmdb.defaultcauset.block-cache-size`
block-cache-size = "512MB"
[interlock]
## the fidelio to `interlock.brane-split-tuplespaceInstanton`, which do not show up
## as key-value pair after [interlock], will be written at the lightlike of [interlock]
brane-split-tuplespaceInstanton = 10000
[gc]
## config should be fidelio in place
max-write-bytes-per-sec = "100MB"
[lmdb.defaultcauset.titan]
blob-run-mode = "read-only"
"#;
assert_eq!(expect.as_bytes(), res.as_slice());
} | rust_cleaned_test_functions.jsonl/7499 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1292
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
761,
26802,
815,
2346,
2458,
368,
341,
262,
1077,
320,
6984,
2162,
18187,
11,
4174,
4334,
8,
284,
468,
687,
58684,
687,
3506,
2648,
486,
4197,
16125,
1005,
15454,
543,
262,
2162,
18187,
52... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_host_localhost_new() {
let host: Localhost = Localhost::new(PathBuf::from("C:\\users")).ok().unwrap();
assert_eq!(host.wrkdir, PathBuf::from("C:\\users"));
// Scan dir
let entries = std::fs::read_dir(PathBuf::from("C:\\users").as_path()).unwrap();
let mut counter: usize = 0;
for _ in entries {
counter = counter + 1;
}
assert_eq!(host.files.len(), counter);
} | rust_cleaned_test_functions.jsonl/53620 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 220
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12848,
62,
8301,
5921,
368,
341,
286,
1077,
3468,
25,
8774,
3790,
284,
8774,
3790,
486,
931,
33030,
15064,
486,
1499,
445,
34,
23817,
4218,
15197,
562,
1005,
15454,
543,
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... | 2 |
#[test]
fn test_composite_file() {
let path = Path::new("test_path");
let mut directory = RAMDirectory::create();
{
let w = directory.open_write(path).unwrap();
let mut composite_write = CompositeWrite::wrap(w);
{
let mut write_0 = composite_write.for_field(Field(0u32));
VInt(32431123u64).serialize(&mut write_0).unwrap();
write_0.flush().unwrap();
}
{
let mut write_4 = composite_write.for_field(Field(4u32));
VInt(2).serialize(&mut write_4).unwrap();
write_4.flush().unwrap();
}
composite_write.close().unwrap();
}
{
let r = directory.open_read(path).unwrap();
let composite_file = CompositeFile::open(&r).unwrap();
{
let file0 = composite_file.open_read(Field(0u32)).unwrap();
let mut file0_buf = file0.as_slice();
let payload_0 = VInt::deserialize(&mut file0_buf).unwrap().0;
assert_eq!(file0_buf.len(), 0);
assert_eq!(payload_0, 32431123u64);
}
{
let file4 = composite_file.open_read(Field(4u32)).unwrap();
let mut file4_buf = file4.as_slice();
let payload_4 = VInt::deserialize(&mut file4_buf).unwrap().0;
assert_eq!(file4_buf.len(), 0);
assert_eq!(payload_4, 2u64);
}
}
} | rust_cleaned_test_functions.jsonl/77311 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 851
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2965,
13607,
2458,
368,
341,
286,
1077,
1815,
284,
7933,
486,
931,
445,
1944,
2638,
797,
286,
1077,
5206,
6220,
284,
22038,
9310,
486,
3182,
543,
286,
341,
310,
1077,
289,
284,
6220,
5826,
9165,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_can_manage_on_private_dex_should_pass() {
let mut ext = ExtBuilder {
initial_dex_list: vec![(
DEX_A_ID,
DEXInfo {
base_asset_id: XOR,
is_public: false,
},
)],
initial_permission_owners: vec![(MANAGE_DEX, Scope::Limited(hash(&DEX_A_ID)), vec![ALICE])],
initial_permissions: vec![(ALICE, Scope::Limited(hash(&DEX_A_ID)), vec![MANAGE_DEX])],
..Default::default()
}
.build();
ext.execute_with(|| {
// owner has full access
let result =
DEXModule::ensure_can_manage(&DEX_A_ID, Origin::signed(ALICE), ManagementMode::Private);
assert_ok!(result);
let result =
DEXModule::ensure_can_manage(&DEX_A_ID, Origin::signed(ALICE), ManagementMode::Public);
assert_ok!(result);
// another account has no access
let result =
DEXModule::ensure_can_manage(&DEX_A_ID, Origin::signed(BOB), ManagementMode::Private);
assert_noop!(result, permissions::Error::<Runtime>::Forbidden);
let result =
DEXModule::ensure_can_manage(&DEX_A_ID, Origin::signed(BOB), ManagementMode::Public);
assert_noop!(result, permissions::Error::<Runtime>::Forbidden);
// sudo account is not handled
let result =
DEXModule::ensure_can_manage(&DEX_A_ID, Origin::root(), ManagementMode::Private);
assert_noop!(result, Error::<Runtime>::InvalidAccountId);
let result =
DEXModule::ensure_can_manage(&DEX_A_ID, Origin::root(), ManagementMode::Public);
assert_noop!(result, Error::<Runtime>::InvalidAccountId);
})
} | rust_cleaned_test_functions.jsonl/110304 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 794
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27421,
56473,
4470,
26249,
814,
327,
43378,
15464,
368,
341,
262,
1077,
5206,
1303,
284,
9447,
3297,
341,
286,
2856,
814,
327,
2019,
25,
7486,
20703,
1006,
310,
422,
3257,
1566,
3450,
345,
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_extract_policy_for_wsh_mixed_timelocks() {
let secp = Secp256k1::new();
let (prvkey0, _pubkey0, _fingerprint0) = setup_keys(TPRV0_STR, PATH, &secp);
let locktime_threshold = 500000000;
let locktime_blocks = 100;
let locktime_seconds = locktime_blocks + locktime_threshold;
let desc = descriptor!(sh(and_v(
v: pk(prvkey0),
and_v(v: after(locktime_seconds), after(locktime_blocks))
)))
.unwrap();
let (wallet_desc, keymap) = desc
.into_wallet_descriptor(&secp, Network::Testnet)
.unwrap();
let signers_container = Arc::new(SignersContainer::build(keymap, &wallet_desc, &secp));
let policy = wallet_desc
.extract_policy(&signers_container, BuildSatisfaction::None, &secp)
.unwrap()
.unwrap();
println!("desc policy = {:?}", policy); // TODO remove
// TODO how should this fail with mixed timelocks?
} | rust_cleaned_test_functions.jsonl/77144 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 520
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
22773,
5478,
1670,
927,
717,
3286,
29087,
301,
25183,
368,
341,
286,
1077,
511,
4672,
284,
4520,
79,
17,
20,
21,
74,
16,
486,
931,
543,
286,
1077,
320,
649,
85,
792,
15,
11,
716,
9585... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_check_net() {
let perms = DenoPermissions::from_flags(&DenoFlags {
net_whitelist: svec![
"localhost",
"deno.land",
"github.com:3000",
"127.0.0.1",
"172.16.0.2:8000"
],
..Default::default()
});
let domain_tests = vec![
("localhost", 1234, true),
("deno.land", 0, true),
("deno.land", 3000, true),
("deno.lands", 0, false),
("deno.lands", 3000, false),
("github.com", 3000, true),
("github.com", 0, false),
("github.com", 2000, false),
("github.net", 3000, false),
("127.0.0.1", 0, true),
("127.0.0.1", 3000, true),
("127.0.0.2", 0, false),
("127.0.0.2", 3000, false),
("172.16.0.2", 8000, true),
("172.16.0.2", 0, false),
("172.16.0.2", 6000, false),
("172.16.0.1", 8000, false),
// Just some random hosts that should err
("somedomain", 0, false),
("192.168.0.1", 0, false),
];
let url_tests = vec![
("http://localhost", true),
("https://localhost", true),
("https://localhost:4443", true),
("tcp://localhost:5000", true),
("udp://localhost:6000", true),
// Correct domain + any port and protocol should be ok incorrect shouldn't
("https://deno.land/std/example/welcome.ts", true),
("https://deno.land:3000/std/example/welcome.ts", true),
("https://deno.lands/std/example/welcome.ts", false),
("https://deno.lands:3000/std/example/welcome.ts", false),
// Correct domain + port should be ok all other combinations should err
("https://github.com:3000/denoland/deno", true),
("https://github.com/denoland/deno", false),
("https://github.com:2000/denoland/deno", false),
("https://github.net:3000/denoland/deno", false),
// Correct ipv4 address + any port should be ok others should err
("tcp://127.0.0.1", true),
("https://127.0.0.1", true),
("tcp://127.0.0.1:3000", true),
("https://127.0.0.1:3000", true),
("tcp://127.0.0.2", false),
("https://127.0.0.2", false),
("tcp://127.0.0.2:3000", false),
("https://127.0.0.2:3000", false),
// Correct address + port should be ok all other combinations should err
("tcp://172.16.0.2:8000", true),
("https://172.16.0.2:8000", true),
("tcp://172.16.0.2", false),
("https://172.16.0.2", false),
("tcp://172.16.0.2:6000", false),
("https://172.16.0.2:6000", false),
("tcp://172.16.0.1:8000", false),
("https://172.16.0.1:8000", false),
];
for (url_str, is_ok) in url_tests.iter() {
let u = url::Url::parse(url_str).unwrap();
assert_eq!(*is_ok, perms.check_net_url(&u).is_ok());
}
for (host, port, is_ok) in domain_tests.iter() {
assert_eq!(*is_ok, perms.check_net(host, *port).is_ok());
}
} | rust_cleaned_test_functions.jsonl/71511 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1354
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
19722,
368,
341,
262,
1077,
82282,
284,
9774,
78,
23851,
486,
1499,
14130,
2099,
35,
11790,
9195,
341,
414,
4179,
36225,
57645,
25,
274,
4083,
90515,
286,
330,
8301,
756,
286,
330,
5183,
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... | 3 |
#[test]
fn test_state_var()
{
test_parse("state s{}");
test_parse("state s{ var x; }");
test_parse("state s{ var x=1; }");
test_parse("state s{ var x@(y)=1; }");
test_parse("state s{ var x:Int=1; }");
test_parse("state s{ var x=1@{-desc-}; }");
test_parse("state s{ var x@(y):Int=1@{-desc-}; }");
} | rust_cleaned_test_functions.jsonl/91404 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 147
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4387,
4612,
741,
515,
18185,
21039,
445,
2454,
274,
6257,
797,
18185,
21039,
445,
2454,
274,
90,
762,
856,
26,
335,
797,
18185,
21039,
445,
2454,
274,
90,
762,
856,
28,
16,
26,
335,
797,
18185... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_wallet_from_mnemonic_mainnet_no_derivation_path() {
let expected = XWallet {
public_key: "031D68BC1A142E6766B2BDFB006CCFE135EF2E0E2E94ABB5CF5C9AB6104776FBAE"
.to_owned(),
private_key: "0090802A50AA84EFB6CDB225F17C27616EA94048C179142FECF03F4712A07EA7A4"
.to_owned(),
test: false,
address: Some("XVMFQQBMhdouRqhPMuawgBMN1AVFTofPAdRsXG5RkPtUPNQ".to_owned()),
};
let out_dir = std::env::var("OUT_DIR").unwrap();
let mut jscontext = JavaScript::new(format!("{}/xpring.js", out_dir))?;
let wallet = from_mnemonic(&mut jscontext, "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about".to_owned(), None, false).unwrap();
assert_eq!(wallet, expected);
} | rust_cleaned_test_functions.jsonl/118739 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 414
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48851,
62308,
5673,
717,
70775,
11027,
4711,
6536,
35345,
39127,
2638,
368,
341,
286,
1077,
3601,
284,
1599,
38259,
341,
310,
584,
3097,
25,
330,
15,
18,
16,
35,
21,
23,
4897,
16,
32,
16,
19,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_extract_config_data_with_apps_and_services() {
let mock_reader = Box::new(MockPackageReader::new());
// We will need 2 service package definitions that map different services
mock_reader.append_service_pkg_def(create_svc_pkg_def(
vec![(
String::from("fuchsia.test.foo.service1"),
String::from("fuchsia-pkg://fuchsia.com/foo#meta/served1.cmx"),
)],
vec![String::from("fuchsia-pkg://fuchsia.com/foo#meta/foo-app.cmx")],
));
mock_reader.append_service_pkg_def(create_svc_pkg_def(
vec![(
String::from("fuchsia.test.foo.service2"),
String::from("fuchsia-pkg://fuchsia.com/foo#meta/served2.cmx"),
)],
vec![String::from("fuchsia-pkg://fuchsia.com/bar#meta/bar-app.cmx")],
));
let collector = PackageDataCollector::default();
let mut meta = HashMap::new();
meta.insert(String::from("data/sysmgr/service1.config"), String::from("test_merkle"));
meta.insert(String::from("data/sysmgr/service2.config"), String::from("test_merkle_2"));
let pkg = create_test_package_with_meta(String::from(CONFIG_DATA_PKG_URL), meta);
let served = vec![pkg];
let package_reader: Box<dyn PackageReader> = mock_reader;
let result = collector.extract_config_data(&package_reader, &served).unwrap();
assert_eq!(2, result.apps.len());
assert!(result.apps.contains("fuchsia-pkg://fuchsia.com/bar#meta/bar-app.cmx"));
assert!(result.apps.contains("fuchsia-pkg://fuchsia.com/foo#meta/foo-app.cmx"));
assert_eq!(2, result.services.len());
assert!(result.services.contains_key("fuchsia.test.foo.service2"));
assert_eq!(
"fuchsia-pkg://fuchsia.com/foo#meta/served2.cmx",
result.services.get("fuchsia.test.foo.service2").unwrap()
);
assert!(result.services.contains_key("fuchsia.test.foo.service1"));
assert_eq!(
"fuchsia-pkg://fuchsia.com/foo#meta/served1.cmx",
result.services.get("fuchsia.test.foo.service1").unwrap()
);
} | rust_cleaned_test_functions.jsonl/19470 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1037
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
5332,
1769,
6615,
69899,
8378,
39846,
368,
341,
286,
1077,
7860,
22306,
284,
8261,
486,
931,
66436,
13100,
5062,
486,
931,
1423,
286,
442,
1205,
686,
1184,
220,
17,
2473,
6328,
17473,
429,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_assemble() {
let mut writer = MemWriter::new();
{
let vec: Vec<IoResult<ir::Instruction>> = vec!(
Ok(ir::StackPush(1)),
Ok(ir::StackDuplicate),
Ok(ir::StackCopy(2)),
Ok(ir::StackSwap),
Ok(ir::StackDiscard),
Ok(ir::StackSlide(3)),
Ok(ir::Addition),
Ok(ir::Subtraction),
Ok(ir::Multiplication),
Ok(ir::Division),
Ok(ir::Modulo),
Ok(ir::HeapStore),
Ok(ir::HeapRetrieve),
Ok(ir::Mark(4)),
Ok(ir::Call(5)),
Ok(ir::Jump(6)),
Ok(ir::JumpIfZero(7)),
Ok(ir::JumpIfNegative(8)),
Ok(ir::Return),
Ok(ir::Exit),
Ok(ir::PutCharactor),
Ok(ir::PutNumber),
Ok(ir::GetCharactor),
Ok(ir::GetNumber),
);
let mut it = vec.move_iter();
writer.assemble(&mut it).unwrap();
}
let mut reader = MemReader::new(writer.unwrap());
assert_eq!(reader.read_inst(), Ok((super::CMD_PUSH, 1)));
assert_eq!(reader.read_inst(), Ok((super::CMD_DUP, 0)));
assert_eq!(reader.read_inst(), Ok((super::CMD_COPY, 2)));
assert_eq!(reader.read_inst(), Ok((super::CMD_SWAP, 0)));
assert_eq!(reader.read_inst(), Ok((super::CMD_DISCARD, 0)));
assert_eq!(reader.read_inst(), Ok((super::CMD_SLIDE, 3)));
assert_eq!(reader.read_inst(), Ok((super::CMD_ADD, 0)));
assert_eq!(reader.read_inst(), Ok((super::CMD_SUB, 0)));
assert_eq!(reader.read_inst(), Ok((super::CMD_MUL, 0)));
assert_eq!(reader.read_inst(), Ok((super::CMD_DIV, 0)));
assert_eq!(reader.read_inst(), Ok((super::CMD_MOD, 0)));
assert_eq!(reader.read_inst(), Ok((super::CMD_STORE, 0)));
assert_eq!(reader.read_inst(), Ok((super::CMD_RETRIEVE, 0)));
assert_eq!(reader.read_inst(), Ok((super::CMD_MARK, 4)));
assert_eq!(reader.read_inst(), Ok((super::CMD_CALL, 5)));
assert_eq!(reader.read_inst(), Ok((super::CMD_JUMP, 6)));
assert_eq!(reader.read_inst(), Ok((super::CMD_JUMPZ, 7)));
assert_eq!(reader.read_inst(), Ok((super::CMD_JUMPN, 8)));
assert_eq!(reader.read_inst(), Ok((super::CMD_RETURN, 0)));
assert_eq!(reader.read_inst(), Ok((super::CMD_EXIT, 0)));
assert_eq!(reader.read_inst(), Ok((super::CMD_PUTC, 0)));
assert_eq!(reader.read_inst(), Ok((super::CMD_PUTN, 0)));
assert_eq!(reader.read_inst(), Ok((super::CMD_GETC, 0)));
assert_eq!(reader.read_inst(), Ok((super::CMD_GETN, 0)));
} | rust_cleaned_test_functions.jsonl/127879 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1521
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
15790,
368,
341,
286,
1077,
5206,
6916,
284,
13550,
6492,
486,
931,
543,
286,
341,
310,
1077,
7486,
25,
11312,
13332,
78,
2077,
27,
404,
486,
16664,
2452,
284,
7486,
33673,
394,
7622,
765... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_json_serialize() {
use serde_json;
let addr = Address::from_str("132F25rTsvBdp9JzLLBHP5mvGY66i1xdiM").unwrap();
let json = serde_json::to_value(&addr).unwrap();
assert_eq!(
json,
serde_json::Value::String("132F25rTsvBdp9JzLLBHP5mvGY66i1xdiM".to_owned())
);
let into: Address = serde_json::from_value(json).unwrap();
assert_eq!(addr.to_string(), into.to_string());
assert_eq!(
into.script_pubkey(),
hex_script!("76a914162c5ea71c0b23f5b9022ef047c4a86470a5b07088ac")
);
let addr = Address::from_str("33iFwdLuRpW1uK1RTRqsoi8rR4NpDzk66k").unwrap();
let json = serde_json::to_value(&addr).unwrap();
assert_eq!(
json,
serde_json::Value::String("33iFwdLuRpW1uK1RTRqsoi8rR4NpDzk66k".to_owned())
);
let into: Address = serde_json::from_value(json).unwrap();
assert_eq!(addr.to_string(), into.to_string());
assert_eq!(
into.script_pubkey(),
hex_script!("a914162c5ea71c0b23f5b9022ef047c4a86470a5b07087")
);
let addr =
Address::from_str("tb1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3q0sl5k7")
.unwrap();
let json = serde_json::to_value(&addr).unwrap();
assert_eq!(
json,
serde_json::Value::String(
"tb1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3q0sl5k7".to_owned()
)
);
let into: Address = serde_json::from_value(json).unwrap();
assert_eq!(addr.to_string(), into.to_string());
assert_eq!(
into.script_pubkey(),
hex_script!("00201863143c14c5166804bd19203356da136c985678cd4d27a1b8c6329604903262")
);
let addr = Address::from_str("bcrt1q2nfxmhd4n3c8834pj72xagvyr9gl57n5r94fsl").unwrap();
let json = serde_json::to_value(&addr).unwrap();
assert_eq!(
json,
serde_json::Value::String("bcrt1q2nfxmhd4n3c8834pj72xagvyr9gl57n5r94fsl".to_owned())
);
let into: Address = serde_json::from_value(json).unwrap();
assert_eq!(addr.to_string(), into.to_string());
assert_eq!(
into.script_pubkey(),
hex_script!("001454d26dddb59c7073c6a197946ea1841951fa7a74")
);
} | rust_cleaned_test_functions.jsonl/59122 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1351
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9455,
88686,
368,
341,
286,
990,
61570,
9455,
401,
286,
1077,
10789,
284,
9177,
486,
1499,
2895,
445,
16,
18,
17,
37,
17,
20,
81,
51,
3492,
33,
9796,
24,
41,
89,
4086,
33,
6610,
20,
26002,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_list_u8_zero_capacity() {
let mut b: ListBuilder<u8> = ListBuilder::with_capacity(0);
b.push("Hello, ".as_bytes());
b.push("World!".as_bytes());
let buffer = b.finish();
assert_eq!(2, buffer.len());
assert_eq!("Hello, ".as_bytes(), buffer.slice(0));
assert_eq!("World!".as_bytes(), buffer.slice(1));
} | rust_cleaned_test_functions.jsonl/99083 | {
"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,
2019,
7300,
23,
19359,
35603,
368,
341,
286,
1077,
5206,
293,
25,
1759,
3297,
34837,
23,
29,
284,
1759,
3297,
486,
4197,
35603,
7,
15,
317,
286,
293,
2552,
445,
9707,
11,
5933,
300,
12524,
142... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_volatile_primitive() {
for (buf, res) in vec![
("volatile short", Primitive::Short),
("short volatile", Primitive::Short),
("short volatile int", Primitive::Short),
("signed short volatile", Primitive::Short),
("signed short volatile int", Primitive::Short),
] {
let mut l = Lexer::<DefaultContext>::new(buf.as_bytes());
let p = DeclSpecifierParser::new(&mut l);
let mut context = Context::default();
let (_, (_, ty, _, _)) = p.parse(None, None, &mut context).unwrap();
let ty = &ty.as_ref().unwrap();
assert!(ty.is_volatile(), "{}", buf);
let ty = match ty.base() {
BaseType::Primitive(ty) => ty,
_ => unreachable!(),
};
assert_eq!(*ty, res, "{}", buf);
}
} | rust_cleaned_test_functions.jsonl/117515 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 449
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
25517,
84087,
368,
341,
286,
369,
320,
5909,
11,
592,
8,
304,
7486,
90515,
310,
3489,
27307,
2805,
497,
51460,
486,
12472,
1326,
310,
3489,
8676,
17072,
497,
51460,
486,
12472,
1326,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_new_behavior_previously_slow() {
// any stake accounts activated and deactivated at the same epoch
do_test(
OldDeactivationBehavior::Slow,
&[
(0, 0, 0),
(0, 0, 0),
(0, 0, 0),
(0, 0, 0),
(0, 0, 0),
(0, 0, 0),
(0, 0, 0),
],
);
} | rust_cleaned_test_functions.jsonl/104323 | {
"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,
5921,
74540,
10442,
18281,
82447,
368,
341,
310,
442,
894,
18279,
9618,
21985,
323,
83616,
518,
279,
1852,
16342,
198,
39865,
310,
653,
4452,
1006,
394,
10621,
1912,
23002,
22753,
486,
58289,
345,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_many_depends() {
let mut t: Turbine<TestSlot> = Turbine::new(1024);
let e1 = t.ep_new().unwrap();
let e2 = t.ep_new().unwrap();
let e3 = t.ep_new().unwrap();
let e4 = t.ep_new().unwrap();
let e5 = t.ep_new().unwrap();
let e6 = t.ep_new().unwrap();
/*
Graph layout:
e6 --> e1 <-- e2
^ ^
| |
+---- e3 <-- e4 <-- e5
*/
let _ = t.ep_depends(e2, e1);
let _ = t.ep_depends(e5, e4);
let _ = t.ep_depends(e3, e1);
let _ = t.ep_depends(e4, e3);
let _ = t.ep_depends(e3, e2);
t.ep_finalize(e1);
t.ep_finalize(e2);
t.ep_finalize(e3);
t.ep_finalize(e4);
t.ep_finalize(e5);
t.ep_finalize(e6);
} | rust_cleaned_test_functions.jsonl/65708 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 559
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22101,
49258,
1412,
368,
341,
286,
1077,
5206,
259,
25,
8705,
46561,
71273,
19877,
29,
284,
8705,
46561,
486,
931,
7,
16,
15,
17,
19,
317,
286,
1077,
384,
16,
284,
259,
33376,
5921,
1005,
1545... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_with_block_param() {
let addr = Address {
city: "Beijing".to_string(),
country: "China".to_string(),
};
let person = Person {
name: "Ning Sun".to_string(),
age: 27,
addr: addr,
titles: vec!["programmer".to_string(), "cartographier".to_string()],
};
let mut handlebars = Registry::new();
assert!(
handlebars
.register_template_string("t0", "{{#with addr as |a|}}{{a.city}}{{/with}}")
.is_ok()
);
assert!(
handlebars
.register_template_string(
"t1",
"{{#with notfound as |c|}}hello{{else}}world{{/with}}"
)
.is_ok()
);
assert!(
handlebars
.register_template_string("t2", "{{#with addr/country as |t|}}{{t}}{{/with}}")
.is_ok()
);
let r0 = handlebars.render("t0", &person);
assert_eq!(r0.ok().unwrap(), "Beijing".to_string());
let r1 = handlebars.render("t1", &person);
assert_eq!(r1.ok().unwrap(), "world".to_string());
let r2 = handlebars.render("t2", &person);
assert_eq!(r2.ok().unwrap(), "China".to_string());
} | rust_cleaned_test_functions.jsonl/73424 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 735
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
7113,
4090,
368,
341,
286,
1077,
10789,
284,
9177,
341,
310,
3283,
25,
330,
3430,
23649,
3263,
983,
3904,
3148,
310,
3146,
25,
330,
22282,
3263,
983,
3904,
3148,
286,
3634,
286,
1077,
1697... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sub() {
for elm in sum_triples.iter() {
let (a_vec, b_vec, c_vec) = *elm;
let a = BigUint::from_slice(a_vec);
let b = BigUint::from_slice(b_vec);
let c = BigUint::from_slice(c_vec);
assert!(c - a == b);
assert!(c - b == a);
}
} | rust_cleaned_test_functions.jsonl/96899 | {
"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,
5228,
368,
341,
286,
369,
42205,
304,
2629,
3547,
37458,
19471,
368,
341,
310,
1077,
320,
64,
13251,
11,
293,
13251,
11,
272,
13251,
8,
284,
353,
23162,
280,
310,
1077,
264,
284,
6164,
21570,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_rent_eager_with_warmup_epochs_under_multi_epoch_cycle() {
let leader_pubkey = solana_sdk::pubkey::new_rand();
let leader_lamports = 3;
let mut genesis_config =
create_genesis_config_with_leader(5, &leader_pubkey, leader_lamports).genesis_config;
genesis_config.cluster_type = ClusterType::MainnetBeta;
const SLOTS_PER_EPOCH: u64 = MINIMUM_SLOTS_PER_EPOCH as u64 * 8;
const LEADER_SCHEDULE_SLOT_OFFSET: u64 = SLOTS_PER_EPOCH * 3 - 3;
genesis_config.epoch_schedule =
EpochSchedule::custom(SLOTS_PER_EPOCH, LEADER_SCHEDULE_SLOT_OFFSET, true);
let mut bank = Arc::new(Bank::new(&genesis_config));
assert_eq!(DEFAULT_SLOTS_PER_EPOCH, 432_000);
assert_eq!(bank.get_slots_in_epoch(bank.epoch()), 32);
assert_eq!(bank.first_normal_epoch(), 3);
assert_eq!(bank.get_epoch_and_slot_index(bank.slot()), (0, 0));
assert_eq!(bank.rent_collection_partitions(), vec![(0, 0, 32)]);
bank = Arc::new(Bank::new_from_parent(&bank, &Pubkey::default(), 222));
bank = Arc::new(new_from_parent(&bank));
assert_eq!(bank.get_slots_in_epoch(bank.epoch()), 128);
assert_eq!(bank.get_epoch_and_slot_index(bank.slot()), (2, 127));
assert_eq!(bank.rent_collection_partitions(), vec![(126, 127, 128)]);
bank = Arc::new(new_from_parent(&bank));
assert_eq!(bank.get_slots_in_epoch(bank.epoch()), 256);
assert_eq!(bank.get_epoch_and_slot_index(bank.slot()), (3, 0));
assert_eq!(bank.rent_collection_partitions(), vec![(0, 0, 431_872)]);
assert_eq!(431_872 % bank.get_slots_in_epoch(bank.epoch()), 0);
bank = Arc::new(new_from_parent(&bank));
assert_eq!(bank.get_slots_in_epoch(bank.epoch()), 256);
assert_eq!(bank.get_epoch_and_slot_index(bank.slot()), (3, 1));
assert_eq!(bank.rent_collection_partitions(), vec![(0, 1, 431_872)]);
bank = Arc::new(Bank::new_from_parent(
&bank,
&Pubkey::default(),
431_872 + 223 - 1,
));
bank = Arc::new(new_from_parent(&bank));
assert_eq!(bank.get_slots_in_epoch(bank.epoch()), 256);
assert_eq!(bank.get_epoch_and_slot_index(bank.slot()), (1689, 255));
assert_eq!(
bank.rent_collection_partitions(),
vec![(431_870, 431_871, 431_872)]
);
bank = Arc::new(new_from_parent(&bank));
assert_eq!(bank.get_slots_in_epoch(bank.epoch()), 256);
assert_eq!(bank.get_epoch_and_slot_index(bank.slot()), (1690, 0));
assert_eq!(bank.rent_collection_partitions(), vec![(0, 0, 431_872)]);
} | rust_cleaned_test_functions.jsonl/2541 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1319
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
83127,
2204,
1409,
6615,
1670,
2178,
454,
44127,
58228,
25133,
20682,
39079,
368,
341,
286,
1077,
7653,
34014,
792,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
7653,
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_create_show_table_study() {
let study = Study {
id: "foo".to_string(),
is_stable: true,
last_update: NaiveDate::from_ymd(2020, 8, 30).and_hms(19, 11, 09),
main_dicom_tags: hashmap! {
"AccessionNumber".to_string() => "foo_an".to_string(),
"StudyInstanceUID".to_string() => "foo_suid".to_string(),
"StudyDescription".to_string() => "foo_sd".to_string(),
},
parent_patient: "patient_foo".to_string(),
patient_main_dicom_tags: hashmap! {
"PatientName".to_string() => "Rick Sanchez".to_string(),
},
series: ["foo_series_1".to_string(), "foo_series_2".to_string()].to_vec(),
entity: EntityKind::Study,
anonymized_from: None,
};
assert_eq!(
format_table(create_show_table(study, &STUDY_DICOM_TAGS)),
include_str!("../tests/data/unit/show_study").trim_end()
);
} | rust_cleaned_test_functions.jsonl/76487 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 541
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
15267,
5237,
85581,
368,
341,
286,
1077,
3920,
284,
19173,
341,
310,
877,
25,
330,
7975,
3263,
983,
3904,
3148,
310,
374,
1261,
480,
25,
830,
345,
310,
1537,
8882,
25,
12812,
533,
1916,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_keywords_in_impl_def() {
check(
r"impl My { $0 }",
expect![[r#"
kw pub(crate)
kw pub
kw unsafe
kw fn
kw const
kw type
"#]],
);
} | rust_cleaned_test_functions.jsonl/72505 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 220
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51354,
1243,
21007,
7844,
368,
341,
286,
1779,
1006,
310,
435,
1,
6383,
3017,
314,
400,
15,
335,
756,
310,
1720,
0,
15505,
81,
2,
698,
394,
29525,
6675,
54907,
340,
394,
29525,
6675,
198,
394,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_try_from_quality_scores_for_sam_record_quality_scores(
) -> Result<(), sam::record::quality_scores::score::TryFromUByteError> {
let quality_scores = QualityScores::from(vec![45, 35, 43, 50]); // NDLS
let actual = sam::record::QualityScores::try_from(&quality_scores)?;
let expected = sam::record::QualityScores::from(vec![
Score::try_from(45)?,
Score::try_from(35)?,
Score::try_from(43)?,
Score::try_from(50)?,
]);
assert_eq!(actual, expected);
Ok(())
} | rust_cleaned_test_functions.jsonl/58915 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 275
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
5673,
55074,
27198,
5478,
643,
309,
14192,
55074,
27198,
1006,
262,
873,
1464,
5714,
68843,
9962,
486,
8548,
486,
10473,
27198,
486,
12338,
486,
21453,
3830,
52,
7153,
1454,
29,
341,
286,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_rainbow_highlighting() {
let (analysis, file_id) = single_file(
r#"
fn main() {
let hello = "hello";
let x = hello.to_string();
let y = hello.to_string();
let x = "other color please!";
let y = x.to_string();
}
fn bar() {
let mut hello = "hello";
}
"#
.trim(),
);
let dst_file =
project_dir().join("crates/ra_ide_api/src/snapshots/rainbow_highlighting.html");
let actual_html = &analysis.highlight_as_html(file_id, true).unwrap();
let expected_html = &read_text(&dst_file);
std::fs::write(dst_file, &actual_html).unwrap();
assert_eq_text!(expected_html, actual_html);
} | rust_cleaned_test_functions.jsonl/49525 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 336
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
466,
15439,
74546,
287,
368,
341,
286,
1077,
320,
34484,
11,
1034,
842,
8,
284,
3175,
2458,
1006,
310,
435,
2,
698,
8822,
1887,
368,
341,
262,
1077,
23811,
284,
330,
14990,
876,
262,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lowercase_drive_letter_with_drive() {
let url = url_from_abs_path(Path::new("C:\\Test"));
assert_eq!(url.to_string(), "file:///c:/Test");
} | rust_cleaned_test_functions.jsonl/70339 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 87
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
93129,
67151,
46117,
6615,
67151,
368,
341,
286,
1077,
2515,
284,
2515,
5673,
31170,
2638,
33030,
486,
931,
445,
34,
23817,
2271,
4010,
286,
2060,
10714,
10297,
1085,
2389,
3904,
1507,
330,
1192,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_multi_args() {
assert_eq!(
Opt {
x: 0,
level: "1".to_string(),
files: vec!["file".to_string()],
values: vec![],
},
Opt::try_parse_from(&["test", "-l", "1", "file"]).unwrap()
);
assert_eq!(
Opt {
x: 0,
level: "1".to_string(),
files: vec!["FILE".to_string()],
values: vec![1],
},
Opt::try_parse_from(&["test", "-l", "1", "--values", "1", "--", "FILE"]).unwrap()
);
} | rust_cleaned_test_functions.jsonl/18740 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 320
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25133,
8384,
368,
341,
262,
2060,
10714,
33673,
286,
16554,
341,
310,
856,
25,
220,
15,
345,
310,
2188,
25,
330,
16,
3263,
983,
3904,
3148,
310,
3542,
25,
7486,
0,
1183,
1192,
3263,
983,
3904,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_remove_value() {
given(r#"
name = "hello"
# delete this
version = "1.0.0" # please
documentation = "https://docs.rs/hello""#
).running(|root| {
let value = root.remove("version");
assert!(value.is_some());
let value = value.unwrap();
assert!(value.is_value());
let value = value.as_value().unwrap();
assert!(value.is_str());
let value = value.as_str().unwrap();
assert_eq!(value, "1.0.0");
}).produces(r#"
name = "hello"
documentation = "https://docs.rs/hello"
"#
);
} | rust_cleaned_test_functions.jsonl/36882 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 302
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
3142,
368,
341,
262,
2661,
2601,
2,
698,
286,
829,
284,
330,
14990,
698,
286,
671,
3698,
419,
198,
286,
2319,
284,
330,
16,
13,
15,
13,
15,
1,
671,
4486,
198,
286,
9705,
284,
330,
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_check_no_allow_rule_no_allow() {
let mut kb = KnowledgeBase::new();
kb.add_rule(rule!("f", [sym!("x")]));
kb.add_rule(rule!("g", [sym!("x")]));
assert!(check_no_allow_rule(&kb).is_some());
} | rust_cleaned_test_functions.jsonl/102132 | {
"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,
7200,
6536,
55731,
21124,
6536,
55731,
368,
341,
286,
1077,
5206,
38653,
284,
31925,
3978,
486,
931,
543,
286,
38653,
1364,
21124,
34944,
17223,
69,
497,
508,
23802,
17223,
87,
899,
14382,
286,
38... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.