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_neq_dyn_utf8_scalar() {
let array = StringArray::from(vec!["abc", "def", "xyz"]);
let a_eq = neq_dyn_utf8_scalar(&array, "xyz").unwrap();
assert_eq!(
a_eq,
BooleanArray::from(vec![Some(true), Some(true), Some(false)])
);
} | rust_cleaned_test_functions.jsonl/98242 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 168
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13925,
80,
69213,
39453,
23,
41652,
368,
341,
286,
1077,
1334,
284,
923,
1857,
486,
1499,
25592,
0,
1183,
13683,
497,
330,
750,
497,
330,
28854,
15049,
286,
1077,
264,
10714,
284,
834,
80,
69213... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_deref() {
let color = Color::rgb(1, 2, 3);
assert_eq!(color[0], 1);
assert_eq!(color[1], 2);
assert_eq!(color[2], 3);
assert_eq!(color[3], 0xff);
} | rust_cleaned_test_functions.jsonl/130743 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
43970,
368,
341,
262,
1077,
1894,
284,
3478,
486,
16509,
7,
16,
11,
220,
17,
11,
220,
18,
317,
262,
2060,
10714,
10297,
3423,
58,
15,
1125,
220,
16,
317,
262,
2060,
10714,
10297,
3423,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rustlang_cert() {
Context::new(
"rustlang",
"www.rust-lang.org",
&[
include_bytes!("testdata/cert-rustlang.0.der"),
include_bytes!("testdata/cert-rustlang.1.der"),
include_bytes!("testdata/cert-rustlang.2.der"),
],
)
.bench(100)
} | rust_cleaned_test_functions.jsonl/810 | {
"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,
1710,
590,
5205,
37097,
368,
341,
262,
9608,
486,
931,
1006,
286,
330,
35788,
5205,
756,
286,
330,
2136,
1746,
590,
75460,
2659,
756,
286,
609,
9640,
310,
2924,
12524,
17223,
92425,
2899,
529,
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_lint_exported() {
let modu = module(
r#"
load("test", "a")
def b(): pass
d = 1
def _e(): pass
d = 2
"#,
);
let res = modu.exported_symbols();
assert_eq!(
res.map(|(loc, name)| format!("{} {}", loc, name)),
&["X:3:5-6 b", "X:4:1-2 d"]
);
} | rust_cleaned_test_functions.jsonl/24663 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 204
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
907,
396,
27114,
291,
368,
341,
286,
1077,
1463,
84,
284,
4688,
1006,
310,
435,
2,
698,
1078,
445,
1944,
497,
330,
64,
1138,
750,
293,
4555,
1494,
198,
67,
284,
220,
16,
198,
750,
716,
68,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dispatch_table_signatures_some() {
let type_name = CString::new(FAKE_TYPE_NAME).expect("Invalid fake type name.");
let type_info = fake_type_info(&type_name, TypeGroup::FundamentalTypes, 1, 1);
let return_type = Some(&type_info);
let fn_name = CString::new(FAKE_FN_NAME).expect("Invalid fake fn name.");
let fn_prototype = fake_fn_prototype(&fn_name, &[], return_type);
let prototypes = &[fn_prototype];
let fn_ptrs = &mut [ptr::null()];
let dispatch_table = fake_dispatch_table(prototypes, fn_ptrs);
let result = dispatch_table.prototypes();
assert_eq!(result.len(), prototypes.len());
for (lhs, rhs) in result.iter().zip(prototypes.iter()) {
assert_eq!(lhs.name(), rhs.name());
assert_eq!(lhs.signature.arg_types(), rhs.signature.arg_types());
assert_eq!(lhs.signature.return_type(), rhs.signature.return_type());
}
} | rust_cleaned_test_functions.jsonl/47222 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 426
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42991,
5237,
11172,
2789,
61855,
368,
341,
286,
1077,
943,
1269,
284,
56956,
486,
931,
7,
3627,
3390,
4189,
4708,
568,
17119,
445,
7928,
12418,
943,
829,
7320,
286,
1077,
943,
3109,
284,
12418,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_float() {
let mut reader = Reader::init("1.0");
assert_eq!(
float(&mut reader).unwrap(),
Float {
value: 1.0,
encoded: "1.0".to_string()
}
);
assert_eq!(reader.state.cursor, 3);
let mut reader = Reader::init("-1.0");
assert_eq!(
float(&mut reader).unwrap(),
Float {
value: -1.0,
encoded: "-1.0".to_string()
}
);
assert_eq!(reader.state.cursor, 4);
let mut reader = Reader::init("1.1");
assert_eq!(
float(&mut reader).unwrap(),
Float {
value: 1.1,
encoded: "1.1".to_string()
}
);
assert_eq!(reader.state.cursor, 3);
let mut reader = Reader::init("1.100");
assert_eq!(
float(&mut reader).unwrap(),
Float {
value: 1.1,
encoded: "1.100".to_string()
}
);
assert_eq!(reader.state.cursor, 5);
let mut reader = Reader::init("1.01");
assert_eq!(
float(&mut reader).unwrap(),
Float {
value: 1.01,
encoded: "1.01".to_string()
}
);
assert_eq!(reader.state.cursor, 4);
let mut reader = Reader::init("1.010");
assert_eq!(
float(&mut reader).unwrap(),
Float {
value: 1.01,
encoded: "1.010".to_string()
}
);
assert_eq!(reader.state.cursor, 5);
// provide more digits than necessary
let mut reader = Reader::init("-0.3333333333333333333");
assert_eq!(
float(&mut reader).unwrap(),
Float {
value: -0.3333333333333333,
encoded: "-0.3333333333333333333".to_string()
}
);
assert_eq!(reader.state.cursor, 22);
} | rust_cleaned_test_functions.jsonl/119579 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17586,
368,
341,
286,
1077,
5206,
6604,
284,
25166,
486,
2327,
445,
16,
13,
15,
797,
286,
2060,
10714,
33673,
310,
2224,
2099,
6984,
6604,
568,
15454,
3148,
310,
13001,
341,
394,
897,
25,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_u32_event() {
let data = [0x82, 0x2d, 0x01, 0x00, 0x14, 0x00, 0x59, 0x00, 0x00, 0x00];
assert_eq!(
parse(&data[..]).unwrap().token_tape,
vec![BinaryToken::Token(0x2d82), BinaryToken::U32(89),]
);
} | rust_cleaned_test_functions.jsonl/109405 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 162
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7300,
18,
17,
6748,
368,
341,
286,
1077,
821,
284,
508,
15,
87,
23,
17,
11,
220,
15,
87,
17,
67,
11,
220,
15,
87,
15,
16,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
16,
19,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_write_be() {
let uints = [0, 1, 2, 42, 10_123, 100_123_456, ::u64::max_value];
let mut writer = MemWriter::new();
for i in uints.iter() {
writer.write_be_u64_(*i);
}
let mut reader = MemReader::new(writer.inner());
for i in uints.iter() {
assert!(reader.read_be_u64_() == *i);
}
} | rust_cleaned_test_functions.jsonl/38076 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
9165,
21263,
368,
341,
286,
1077,
2622,
82,
284,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
19,
17,
11,
220,
16,
15,
62,
16,
17,
18,
11,
220,
16,
15,
15,
62,
16,
17,
18,
62,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_request() {
use helix::*;
let req = GetBroadcasterSubscriptionsRequest::builder()
.broadcaster_id("123".to_string())
.build();
let data = br#"
{
"data": [
{
"broadcaster_id": "123",
"broadcaster_login": "test_user",
"broadcaster_name": "test_user",
"is_gift": true,
"tier": "1000",
"plan_name": "The Ninjas",
"user_id": "123",
"user_login": "snoirf",
"user_name": "snoirf"
}
],
"pagination": {
"cursor": "xxxx"
}
}
"#
.to_vec();
let http_response = http::Response::builder().body(data).unwrap();
let uri = req.get_uri().unwrap();
assert_eq!(
uri.to_string(),
"https://api.twitch.tv/helix/subscriptions?broadcaster_id=123"
);
dbg!(
GetBroadcasterSubscriptionsRequest::parse_response(Some(req), &uri, http_response).unwrap()
);
} | rust_cleaned_test_functions.jsonl/53287 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 472
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7893,
368,
341,
262,
990,
11338,
941,
56162,
262,
1077,
4232,
284,
2126,
68324,
32020,
3136,
29966,
1900,
486,
17850,
741,
286,
659,
65,
8546,
32020,
842,
445,
16,
17,
18,
3263,
983,
3904,
2398,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rotation_vector3() {
let angle = Degrees(135.0);
let rotation = Rotation2::from_angle(angle);
let expected = Vector2::new(-1_f64, 1_f64);
let vector = Vector2::new(f64::sqrt(2_f64), 0_f64);
let result = rotation.rotate_vector(&vector);
assert!(relative_eq!(result, expected, epsilon = 1e-8));
} | rust_cleaned_test_functions.jsonl/70477 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 182
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44813,
12247,
18,
368,
341,
286,
1077,
9210,
284,
92901,
7,
16,
18,
20,
13,
15,
317,
286,
1077,
12695,
284,
47528,
17,
486,
1499,
21727,
29633,
317,
286,
1077,
3601,
284,
4196,
17,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rev_split_char_iterator_no_trailing() {
let data = "\nMäry häd ä little lämb\nLittle lämb\n";
let mut split: Vec<&str> = data.split('\n').rev().collect();
split.reverse();
assert_eq!(split, ["", "Märy häd ä little lämb", "Little lämb", ""]);
let mut split: Vec<&str> = data.split_terminator('\n').rev().collect();
split.reverse();
assert_eq!(split, ["", "Märy häd ä little lämb", "Little lämb"]);
} | rust_cleaned_test_functions.jsonl/17658 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 199
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38082,
17052,
9232,
13491,
6536,
3547,
14277,
368,
341,
262,
1077,
821,
284,
2917,
77,
44,
2305,
884,
305,
30875,
12709,
2632,
30005,
3096,
1699,
38103,
30005,
3096,
1699,
3302,
262,
1077,
5206,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_timestamp_ord() {
fn test_timestamp_ord_with_initial(initial: Timestamp) {
let offsets = generate_interesting_offsets(initial);
assert!(offsets.plus_one > initial);
assert!(offsets.plus_limit > initial);
assert!(offsets.plus_wrapped < initial);
assert!(offsets.plus_wrapped_limit < initial);
assert!(offsets.plus_wrapped_full == initial);
assert!(offsets.minus_one < initial);
assert!(offsets.minus_limit < initial);
assert!(offsets.minus_wrapped > initial);
assert!(offsets.minus_wrapped_limit > initial);
assert!(offsets.minus_wrapped_full == initial);
}
for timestamp in &interesting_timestamps() {
test_timestamp_ord_with_initial(*timestamp);
}
} | rust_cleaned_test_functions.jsonl/63526 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 392
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23073,
67324,
368,
341,
286,
5168,
1273,
23073,
67324,
6615,
15809,
34331,
25,
32758,
8,
341,
310,
1077,
35046,
284,
6923,
62527,
287,
56924,
34331,
317,
310,
2060,
10297,
3176,
82,
60540,
11667,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lcs_signed_transaction() {
// generate key pair
let private_key = Ed25519PrivateKey::generate_for_testing();
let public_key = private_key.public_key();
let private_key_bytes = private_key.to_bytes();
// create transfer parameters
let sender_address = account_address::from_public_key(&public_key);
let receiver_address = AccountAddress::random();
let sequence = 0;
let amount = 100_000_000;
let gas_unit_price = 123;
let max_gas_amount = 1000;
let expiration_timestamp_secs = 0;
let metadata = vec![1, 2, 3];
let metadata_signature = [0x1; 64].to_vec();
let coin_ident = std::ffi::CString::new(COIN1_NAME).expect("Invalid ident");
let mut script_buf: *mut u8 = std::ptr::null_mut();
let script_buf_ptr = &mut script_buf;
let mut script_len: usize = 0;
let script_result = unsafe {
libra_TransactionP2PScript_from(
receiver_address.as_ref().as_ptr(),
coin_ident.as_ptr(),
amount,
metadata.as_ptr(),
metadata.len(),
metadata_signature.as_ptr(),
metadata_signature.len(),
script_buf_ptr,
&mut script_len,
)
};
assert_eq!(script_result, LibraStatus::Ok);
let script_bytes: &[u8] = unsafe { slice::from_raw_parts(script_buf, script_len) };
let _deserialized_script: Script =
from_bytes(script_bytes).expect("LCS deserialization failed for Script");
let mut buf: *mut u8 = std::ptr::null_mut();
let buf_ptr = &mut buf;
let mut len: usize = 0;
let result = unsafe {
libra_SignedTransactionBytes_from(
private_key_bytes.as_ptr(),
sequence,
max_gas_amount,
gas_unit_price,
coin_ident.as_ptr(),
expiration_timestamp_secs,
ChainId::test().id(),
script_bytes.as_ptr(),
script_len,
buf_ptr,
&mut len,
)
};
assert_eq!(result, LibraStatus::Ok);
let signed_txn_bytes_buf: &[u8] = unsafe { slice::from_raw_parts(buf, len) };
let deserialized_signed_txn: SignedTransaction =
from_bytes(signed_txn_bytes_buf).expect("LCS deserialization failed");
if let TransactionPayload::Script(program) = deserialized_signed_txn.payload() {
match program.args()[1] {
TransactionArgument::U64(val) => assert_eq!(val, amount),
_ => unreachable!(),
}
match &program.args()[2] {
TransactionArgument::U8Vector(val) => assert_eq!(val, &metadata),
_ => unreachable!(),
}
match &program.args()[3] {
TransactionArgument::U8Vector(val) => assert_eq!(val, &metadata_signature),
_ => unreachable!(),
}
}
assert_eq!(deserialized_signed_txn.sender(), sender_address);
assert_eq!(deserialized_signed_txn.sequence_number(), 0);
assert_eq!(deserialized_signed_txn.gas_unit_price(), gas_unit_price);
assert_eq!(
deserialized_signed_txn.authenticator().public_key_bytes(),
public_key.to_bytes()
);
assert!(deserialized_signed_txn.check_signature().is_ok());
// Test signature is stable
let mut buf2: *mut u8 = std::ptr::null_mut();
let buf_ptr2 = &mut buf2;
let mut len2: usize = 0;
let coin_idnet = std::ffi::CString::new(COIN1_NAME).expect("Invalid ident");
let result2 = unsafe {
libra_SignedTransactionBytes_from(
private_key_bytes.as_ptr(),
sequence,
max_gas_amount,
gas_unit_price,
coin_idnet.as_ptr(),
expiration_timestamp_secs,
ChainId::test().id(),
script_bytes.as_ptr(),
script_len,
buf_ptr2,
&mut len2,
)
};
assert_eq!(result2, LibraStatus::Ok);
assert_ne!(buf, buf2);
assert_eq!(len, len2);
unsafe {
let data2 = slice::from_raw_parts(buf2, len2);
assert_eq!(signed_txn_bytes_buf, data2);
}
// Test creating add currency to account transaction
let coin_ident_2 = std::ffi::CString::new(COIN1_NAME).expect("Invalid ident");
let mut script_buf: *mut u8 = std::ptr::null_mut();
let script_buf_ptr = &mut script_buf;
let mut script_len: usize = 0;
let script_result = unsafe {
libra_TransactionAddCurrencyScript_from(
coin_ident_2.as_ptr(),
script_buf_ptr,
&mut script_len,
)
};
assert_eq!(script_result, LibraStatus::Ok);
let script_bytes: &[u8] = unsafe { slice::from_raw_parts(script_buf, script_len) };
let _deserialized_script: Script =
from_bytes(script_bytes).expect("LCS deserialization failed for Script");
let mut buf: *mut u8 = std::ptr::null_mut();
let buf_ptr = &mut buf;
let mut len: usize = 0;
let result = unsafe {
libra_SignedTransactionBytes_from(
private_key_bytes.as_ptr(),
sequence,
max_gas_amount,
gas_unit_price,
coin_ident_2.as_ptr(),
expiration_timestamp_secs,
ChainId::test().id(),
script_bytes.as_ptr(),
script_len,
buf_ptr,
&mut len,
)
};
assert_eq!(result, LibraStatus::Ok);
let signed_txn_bytes_buf: &[u8] = unsafe { slice::from_raw_parts(buf, len) };
let deserialized_signed_txn: SignedTransaction =
from_bytes(signed_txn_bytes_buf).expect("LCS deserialization failed");
let identifier = from_currency_code_string(
coin_ident_2
.as_c_str()
.to_string_lossy()
.into_owned()
.as_str(),
)
.unwrap();
if let TransactionPayload::Script(program) = deserialized_signed_txn.payload() {
match program.ty_args()[0].clone() {
TypeTag::Struct(struct_tag) => assert_eq!(struct_tag.module, identifier),
_ => unreachable!(),
}
}
assert_eq!(deserialized_signed_txn.sender(), sender_address);
assert_eq!(deserialized_signed_txn.sequence_number(), 0);
assert_eq!(deserialized_signed_txn.gas_unit_price(), gas_unit_price);
assert_eq!(
deserialized_signed_txn.authenticator().public_key_bytes(),
public_key.to_bytes()
);
assert!(deserialized_signed_txn.check_signature().is_ok());
unsafe {
libra_free_bytes_buffer(script_buf);
libra_free_bytes_buffer(buf);
libra_free_bytes_buffer(buf2);
};
} | rust_cleaned_test_functions.jsonl/30040 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3717
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
907,
4837,
55617,
28884,
368,
341,
286,
442,
6923,
1376,
6716,
198,
286,
1077,
869,
3097,
284,
3199,
17,
20,
20,
16,
24,
75981,
486,
19366,
5478,
70962,
543,
286,
1077,
584,
3097,
284,
869,
30... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
#[test]
fn test_convert_gtf2_to_gff3() {
let mut reader = Reader::new(GTF_FILE_ONE_ATTRIB, GffType::GTF2);
let mut writer = Writer::new(vec![], GffType::GFF3);
for r in reader.records() {
writer
.write(&r.ok().expect("Error reading record"))
.ok()
.expect("Error writing record");
}
assert_eq!(writer.inner.into_inner().unwrap(), GFF_FILE_ONE_ATTRIB)
} | rust_cleaned_test_functions.jsonl/74497 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 243
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
1889,
8935,
17,
2346,
1889,
542,
18,
368,
341,
286,
1077,
5206,
6604,
284,
25166,
486,
931,
6699,
10808,
8087,
34727,
99043,
11,
479,
542,
929,
486,
38,
10808,
17,
317,
286,
1077,
5206,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_scalar_mul_scalar() {
let a: Secp256k1Scalar = ECScalar::new_random().unwrap();
let b: Secp256k1Scalar = ECScalar::new_random().unwrap();
let c1 = a.mul(&b.fe).unwrap();
let c2 = (a * b).unwrap();
assert_eq!(c1.fe, c2.fe);
} | rust_cleaned_test_functions.jsonl/60388 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 162
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41652,
24944,
41652,
368,
341,
286,
1077,
264,
25,
4520,
79,
17,
20,
21,
74,
16,
20639,
284,
20633,
20639,
486,
931,
22644,
1005,
15454,
543,
286,
1077,
293,
25,
4520,
79,
17,
20,
21,
74,
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_cast_dict_to_dict_bad_index_value_primitive() {
use DataType::*;
// test converting from an array that has indexes of a type
// that are out of bounds for a particular other kind of
// index.
let keys_builder = PrimitiveBuilder::<Int32Type>::new(10);
let values_builder = PrimitiveBuilder::<Int64Type>::new(10);
let mut builder = PrimitiveDictionaryBuilder::new(keys_builder, values_builder);
// add 200 distinct values (which can be stored by a
// with int8)
for i in 0..200 {
builder.append(i).unwrap();
}
let array: ArrayRef = Arc::new(builder.finish());
let cast_type = Dictionary(Box::new(Int8), Box::new(Utf8));
let res = cast(&array, &cast_type);
assert!(res.is_err());
let actual_error = format!("{:?}", res);
let expected_error = "Could not convert 72 dictionary indexes from Int32 to Int8";
assert!(
actual_error.contains(expected_error),
"did not find expected error '{}' in actual error '{}'",
actual_error,
expected_error
);
} | rust_cleaned_test_functions.jsonl/29631 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 515
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5303,
5243,
2346,
5243,
34199,
3560,
3142,
84087,
368,
341,
286,
990,
33172,
56162,
286,
442,
1273,
33437,
504,
458,
1334,
429,
702,
24953,
315,
264,
943,
198,
286,
442,
429,
525,
700,
315,
1426... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_nanoseconds_overflow() {
let x: u128 = 18446744073709551614599999;
x.nanos().unwrap();
} | rust_cleaned_test_functions.jsonl/40376 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 59
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73936,
75889,
79073,
368,
341,
262,
1077,
856,
25,
575,
16,
17,
23,
284,
220,
16,
23,
19,
19,
21,
22,
19,
19,
15,
22,
18,
22,
15,
24,
20,
20,
16,
21,
16,
19,
20,
24,
24,
24,
24,
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 |
#[test]
fn test_read_does_not_consume_skipped_event() {
const SKIPPED_EVENT: InternalEvent = InternalEvent::Event(Event::Resize(10, 10));
const CURSOR_EVENT: InternalEvent = InternalEvent::CursorPosition(10, 20);
let mut reader = InternalEventReader {
events: vec![SKIPPED_EVENT, CURSOR_EVENT].into(),
source: None,
};
assert_eq!(reader.read(&CursorPositionFilter).unwrap(), CURSOR_EVENT);
assert_eq!(reader.read(&InternalEventFilter).unwrap(), SKIPPED_EVENT);
} | rust_cleaned_test_functions.jsonl/101472 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 237
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
96374,
7913,
3382,
31323,
33811,
6450,
6748,
368,
341,
286,
733,
12072,
35759,
1479,
14054,
25,
15412,
1556,
284,
15412,
1556,
486,
1556,
30469,
486,
30561,
7,
16,
15,
11,
220,
16,
15,
110... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_macro() {
let mut compiler = CompilerBuilder::new()
.with_include_dir("test-spirv")
.with_macro("MY_MACRO", Some("1"))
.build()
.unwrap();
let result =
compiler.compile_from_file("test-spirv/test-macro.vert", ShaderKind::Vertex, false);
assert!(result.is_ok());
} | rust_cleaned_test_functions.jsonl/24870 | {
"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,
6615,
58810,
368,
341,
286,
1077,
5206,
19415,
284,
45631,
3297,
486,
931,
741,
310,
659,
4197,
37878,
4334,
445,
1944,
1331,
5565,
85,
1138,
310,
659,
4197,
58810,
445,
19159,
73361,
497,
4329,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pipe() {
// which was closed by the other side of the pipe. This test does not
// protect against regressions in that case; we should add one at some
// point.
new_ucmd!()
.pipe_in("one\ntwo\nfour")
.succeeds()
.stdout_is("four\none\ntwo\n")
.stderr_is("");
} | rust_cleaned_test_functions.jsonl/20525 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41862,
368,
341,
1066,
262,
442,
892,
572,
7877,
553,
279,
1008,
3108,
315,
279,
13647,
13,
1096,
1273,
1558,
537,
198,
262,
442,
6016,
2348,
69780,
908,
304,
429,
1142,
26,
582,
1265,
912,
82... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_Fp2_add() {
let mut ar : felem_as_words = [9000203289623549276, 7000342082925068282, 1000538881605221074, 10009550692327388916, 10008355200866287827, 500084205531694093];
let mut ai : felem_as_words = [9794203289623549276, 7309342082925068282, 1139538881605221074, 15659550692327388916, 16008355200866287827, 582484205531694093];
let mut br : felem_as_words = [11671922859260663127, 11050707557586042878, 284884720401305268, 17749945728364010941, 8613774818643959860, 145621051382923523];
let mut bi : felem_as_words = [10001922859260663127, 10000707557586042878, 200084720401305268, 10009945728364010941, 8000774818643959860, 100021051382923523];
let mut outr : felem_as_words = [0, 0, 0, 0, 0, 0];
let mut outi : felem_as_words = [0, 0, 0, 0, 0, 0];
Fp2_add(&mut outr, &mut outi, &mut ar, &mut ai, &mut br, &mut bi);
assert_eq!(outr, [2225382075174660787, 18051049640511111161, 1285423602006526342, 9312752346981848241, 175385945800696072, 645705256914617617]);
assert_eq!(outi, [1349382075174660787, 17310049640511111161, 1339623602006526342, 7222752346981848241, 5562385945800696072, 682505256914617617]);
} | rust_cleaned_test_functions.jsonl/91335 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 534
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1400,
79,
17,
2891,
368,
341,
262,
1077,
5206,
796,
549,
1152,
3433,
11898,
18981,
284,
508,
24,
15,
15,
15,
17,
15,
18,
17,
23,
24,
21,
17,
18,
20,
19,
24,
17,
22,
21,
11,
220,
22,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_script_returning_complex_type() {
let ctx = TestContext::new();
block_on_all(async {
let mut con = ctx.multiplexed_async_connection().await?;
redis::Script::new("return {1, ARGV[1], true}")
.arg("hello")
.invoke_async(&mut con)
.map_ok(|(i, s, b): (i32, String, bool)| {
assert_eq!(i, 1);
assert_eq!(s, "hello");
assert_eq!(b, true);
})
.await
})
.unwrap();
} | rust_cleaned_test_functions.jsonl/75337 | {
"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,
14660,
12511,
287,
41522,
1819,
368,
341,
262,
1077,
5635,
284,
3393,
1972,
486,
931,
543,
262,
2504,
4470,
5705,
18285,
341,
286,
1077,
5206,
390,
284,
5635,
744,
9845,
2571,
291,
28346,
15866,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_record_to_string_for_eof_record() {
let eof_record = Record::EndOfFile;
assert_eq!(eof_record.to_record_string(), Ok(String::from(":00000001FF")));
} | rust_cleaned_test_functions.jsonl/105907 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 78
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14192,
2346,
3904,
5478,
90792,
14192,
368,
341,
262,
1077,
76760,
14192,
284,
13583,
486,
3727,
74696,
280,
262,
2060,
10714,
10297,
77594,
14192,
2389,
14192,
3904,
1507,
7622,
2242,
486,
1499,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_inspected_operation() {
let dir = tempfile::tempdir().unwrap();
std::fs::create_dir_all(dir.path()).unwrap();
let file_path = dir.path().join("test.txt");
File::create(&file_path)
.unwrap()
.write_all(&[0; 16])
.unwrap();
let fs_inspector = Arc::new(Mutex::new(TestFileSystemInspector {
refill_bytes: 4,
..Default::default()
}));
let env = Env::with_file_system_inspected(Env::default(), fs_inspector.clone()).unwrap();
let mut f = env
.new_sequential_file(file_path.to_str().unwrap(), EnvOptions::default())
.unwrap();
f.read_exact(&mut [0; 2]).unwrap();
let e = f.read_exact(&mut [0; 8]).unwrap_err();
let msg = format!("{}", e);
assert!(msg.contains("refill bytes"), "{}", msg);
let record = fs_inspector.lock().unwrap();
assert_eq!(2, record.read_called);
} | rust_cleaned_test_functions.jsonl/37641 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 399
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34386,
4046,
32565,
368,
341,
262,
1077,
5419,
284,
54819,
486,
3888,
3741,
1005,
15454,
543,
262,
1460,
486,
3848,
486,
3182,
4334,
5705,
14161,
3875,
6011,
15454,
543,
262,
1077,
1034,
2638,
284... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_load_from_asset() {
let mut loader = FontLoader::new();
let font_family = loader.load_from_asset("");
assert!(font_family.is_none());
let font = dummy_font();
let mut eft = ExtendedFontFamily::new();
eft.add_font(font.clone());
let font_family = loader.load_from_asset(EXTRA_SYMBOL_FONT);
let result = font_family.unwrap().fonts.first().unwrap().font.full_name();
assert_eq!(&result, &eft.fonts.first().unwrap().font.full_name());
assert_eq!(
&result,
&loader
.cache
.get(&EXTRA_SYMBOL_FONT.to_string())
.unwrap()
.fonts
.first()
.unwrap()
.font
.full_name()
);
} | rust_cleaned_test_functions.jsonl/126670 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 455
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12411,
5673,
42299,
368,
341,
286,
1077,
5206,
16047,
284,
9562,
9181,
486,
931,
1428,
286,
1077,
3301,
26823,
284,
16047,
5104,
5673,
42299,
13056,
286,
2060,
10297,
4026,
26823,
2079,
31488,
5231,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_config_migration() {
let mut deps = mock_dependencies(20, &[]);
let mut legacy_config_store = config_old_store(&mut deps.storage);
legacy_config_store
.save(&LegacyConfig {
mirror_token: CanonicalAddr::default(),
owner: CanonicalAddr::default(),
quorum: Decimal::one(),
threshold: Decimal::one(),
voting_period: 100u64,
effective_delay: 100u64,
expiration_period: 100u64,
proposal_deposit: Uint128(100000u128),
})
.unwrap();
migrate_config(
&mut deps.storage,
Decimal::percent(50u64),
50u64,
200u64,
100u64,
75u64,
)
.unwrap();
let config: Config = config_read(&deps.storage).load().unwrap();
assert_eq!(
config,
Config {
mirror_token: CanonicalAddr::default(),
owner: CanonicalAddr::default(),
quorum: Decimal::one(),
threshold: Decimal::one(),
voting_period: 200u64,
effective_delay: 100u64,
expiration_period: 75u64,
proposal_deposit: Uint128(100000u128),
voter_weight: Decimal::percent(50u64),
snapshot_period: 50u64,
}
)
} | rust_cleaned_test_functions.jsonl/44520 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 819
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5332,
90373,
368,
341,
286,
1077,
5206,
48178,
284,
7860,
71841,
7,
17,
15,
11,
609,
56703,
286,
1077,
5206,
19588,
5332,
14809,
284,
2193,
21108,
14809,
2099,
6984,
48178,
22403,
317,
286,
19588,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_clock_getres() {
test_single_clock_getres(ClockId::CLOCK_REALTIME_COARSE);
test_single_clock_getres(ClockId::CLOCK_MONOTONIC_COARSE);
test_single_clock_getres(ClockId::CLOCK_REALTIME);
test_single_clock_getres(ClockId::CLOCK_MONOTONIC);
test_single_clock_getres(ClockId::CLOCK_BOOTTIME);
test_single_clock_getres(ClockId::CLOCK_MONOTONIC_RAW);
} | rust_cleaned_test_functions.jsonl/71361 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23062,
3062,
416,
368,
341,
286,
1273,
19487,
23062,
3062,
416,
3025,
1023,
764,
486,
34,
8044,
30111,
18129,
19628,
79097,
317,
286,
1273,
19487,
23062,
3062,
416,
3025,
1023,
764,
486,
34,
8044,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_send_router_solicitations() {
fn validate_params(
src_mac: Mac,
src_ip: Ipv6Addr,
message: RouterSolicitation,
code: IcmpUnusedCode,
) {
let dummy_config = get_dummy_config::<Ipv6Addr>();
assert_eq!(src_mac, dummy_config.local_mac);
assert_eq!(src_ip, dummy_config.local_mac.to_ipv6_link_local().get());
assert_eq!(message, RouterSolicitation::default());
assert_eq!(code, IcmpUnusedCode);
}
// Solicitation messages.
let dummy_config = get_dummy_config::<Ipv6Addr>();
let mut stack_builder = StackStateBuilder::default();
let mut ndp_configs = crate::device::ndp::NdpConfigurations::default();
ndp_configs.set_dup_addr_detect_transmits(None);
stack_builder.device_builder().set_default_ndp_configs(ndp_configs);
let mut ctx = Context::new(stack_builder.build(), DummyEventDispatcher::default());
assert_eq!(ctx.dispatcher().frames_sent().len(), 0);
let device_id = ctx.state.add_ethernet_device(dummy_config.local_mac, IPV6_MIN_MTU);
crate::device::initialize_device(&mut ctx, device_id);
assert_eq!(ctx.dispatcher().frames_sent().len(), 0);
let time = ctx.dispatcher().now();
assert!(trigger_next_timer(&mut ctx));
// Initial router solicitation should be a random delay between 0 and
// `MAX_RTR_SOLICITATION_DELAY`.
assert!(ctx.dispatcher().now().duration_since(time) < MAX_RTR_SOLICITATION_DELAY);
assert_eq!(ctx.dispatcher().frames_sent().len(), 1);
let (src_mac, dst_mac, src_ip, dst_ip, message, code) =
parse_icmp_packet_in_ip_packet_in_ethernet_frame::<Ipv6, _, RouterSolicitation, _>(
&ctx.dispatcher().frames_sent()[0].1,
|_| {},
)
.unwrap();
validate_params(src_mac, src_ip, message, code);
// Should get 2 more router solicitation messages
let time = ctx.dispatcher().now();
assert!(trigger_next_timer(&mut ctx));
assert_eq!(ctx.dispatcher().now().duration_since(time), RTR_SOLICITATION_INTERVAL);
let (src_mac, dst_mac, src_ip, dst_ip, message, code) =
parse_icmp_packet_in_ip_packet_in_ethernet_frame::<Ipv6, _, RouterSolicitation, _>(
&ctx.dispatcher().frames_sent()[1].1,
|_| {},
)
.unwrap();
validate_params(src_mac, src_ip, message, code);
// it will be assigned immediately. The router solicitation message will
// now use the new assigned IP as the source.
set_ip_addr_subnet(
&mut ctx,
device_id,
AddrSubnet::new(dummy_config.local_ip, 128).unwrap(),
);
let time = ctx.dispatcher().now();
assert!(trigger_next_timer(&mut ctx));
assert_eq!(ctx.dispatcher().now().duration_since(time), RTR_SOLICITATION_INTERVAL);
let (src_mac, dst_mac, src_ip, dst_ip, message, code) =
parse_icmp_packet_in_ip_packet_in_ethernet_frame::<Ipv6, _, RouterSolicitation, _>(
&ctx.dispatcher().frames_sent()[2].1,
|p| {
// We should have a source link layer option now because we have a
// source ip address set.
assert_eq!(p.body().iter().count(), 1);
if let Some(ll) = get_source_link_layer_option::<EthernetNdpDevice, _>(p.body())
{
assert_eq!(ll, dummy_config.local_mac);
} else {
panic!("Should have a source link layer option");
}
},
)
.unwrap();
assert_eq!(src_mac, dummy_config.local_mac);
assert_eq!(src_ip, dummy_config.local_ip);
assert_eq!(message, RouterSolicitation::default());
assert_eq!(code, IcmpUnusedCode);
// No more timers.
assert!(!trigger_next_timer(&mut ctx));
assert_eq!(ctx.dispatcher().frames_sent().len(), 3);
// Configure MAX_RTR_SOLICITATIONS in the stack.
let mut stack_builder = StackStateBuilder::default();
let mut ndp_configs = crate::device::ndp::NdpConfigurations::default();
ndp_configs.set_dup_addr_detect_transmits(None);
ndp_configs.set_max_router_solicitations(NonZeroU8::new(2));
stack_builder.device_builder().set_default_ndp_configs(ndp_configs);
let mut ctx = Context::new(stack_builder.build(), DummyEventDispatcher::default());
assert_eq!(ctx.dispatcher().frames_sent().len(), 0);
let device_id = ctx.state.add_ethernet_device(dummy_config.local_mac, IPV6_MIN_MTU);
crate::device::initialize_device(&mut ctx, device_id);
assert_eq!(ctx.dispatcher().frames_sent().len(), 0);
let time = ctx.dispatcher().now();
assert!(trigger_next_timer(&mut ctx));
// Initial router solicitation should be a random delay between 0 and
// `MAX_RTR_SOLICITATION_DELAY`.
assert!(ctx.dispatcher().now().duration_since(time) < MAX_RTR_SOLICITATION_DELAY);
assert_eq!(ctx.dispatcher().frames_sent().len(), 1);
// Should trigger 1 more router solicitations
let time = ctx.dispatcher().now();
assert!(trigger_next_timer(&mut ctx));
assert_eq!(ctx.dispatcher().now().duration_since(time), RTR_SOLICITATION_INTERVAL);
assert_eq!(ctx.dispatcher().frames_sent().len(), 2);
// Each packet would be the same.
for f in ctx.dispatcher().frames_sent() {
let (src_mac, dst_mac, src_ip, dst_ip, message, code) =
parse_icmp_packet_in_ip_packet_in_ethernet_frame::<Ipv6, _, RouterSolicitation, _>(
&f.1,
|_| {},
)
.unwrap();
validate_params(src_mac, src_ip, message, code);
}
// No more timers.
assert!(!trigger_next_timer(&mut ctx));
} | rust_cleaned_test_functions.jsonl/16147 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3012
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12848,
13565,
55587,
643,
7762,
30667,
368,
341,
286,
5168,
9593,
6745,
1006,
310,
2286,
22802,
25,
7401,
345,
310,
2286,
10385,
25,
358,
30168,
21,
13986,
345,
310,
1943,
25,
10554,
50,
7762,
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_query_captures_with_quoted_predicate_args() {
allocations::record(|| {
let language = get_language("javascript");
// Double-quoted strings can contain:
// * special escape sequences like \n and \r
// * escaped double quotes with \*
// * literal backslashes with \\
let query = Query::new(
language,
r#"
((call_expression (identifier) @foo)
(#set! one "\"something\ngreat\""))
((identifier)
(#set! two "\\s(\r?\n)*$"))
((function_declaration)
(#set! three "\"something\ngreat\""))
"#,
)
.unwrap();
assert_eq!(
query.property_settings(0),
&[QueryProperty::new(
"one",
Some("\"something\ngreat\""),
None
)]
);
assert_eq!(
query.property_settings(1),
&[QueryProperty::new("two", Some("\\s(\r?\n)*$"), None)]
);
assert_eq!(
query.property_settings(2),
&[QueryProperty::new(
"three",
Some("\"something\ngreat\""),
None
)]
);
});
} | rust_cleaned_test_functions.jsonl/25187 | {
"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,
5738,
666,
2689,
1413,
6615,
11280,
9253,
97474,
8384,
368,
341,
262,
69642,
486,
8548,
79453,
341,
286,
1077,
4128,
284,
633,
29021,
445,
14073,
3071,
286,
442,
7093,
12,
63725,
9069,
646,
6644,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_int_key() {
#[derive(Debug, Deserialize, PartialEq)]
struct Settings {
divisors: HashMap<u32, u32>,
}
let c = make();
let s: Settings = c.try_into().unwrap();
assert_eq!(s.divisors[&4], 3);
assert_eq!(s.divisors.len(), 4);
} | rust_cleaned_test_functions.jsonl/126792 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4042,
3097,
368,
341,
262,
11506,
27098,
42618,
11,
48440,
11,
55039,
5563,
262,
2036,
11296,
341,
286,
3429,
41214,
25,
10528,
34837,
18,
17,
11,
575,
18,
17,
12520,
262,
555,
262,
1077,
272,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_order_impl_is_case_insensitive() {
let path_1 = Path::new("AAAA");
let name_1 = Name::new(
&path_1,
FileType::File {
uid: false,
exec: false,
},
);
let path_2 = Path::new("aaaa");
let name_2 = Name::new(
&path_2,
FileType::File {
uid: false,
exec: false,
},
);
assert_eq!(Ordering::Equal, name_1.cmp(&name_2));
} | rust_cleaned_test_functions.jsonl/964 | {
"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,
7869,
21007,
6892,
19096,
34386,
18723,
368,
341,
286,
1077,
1815,
62,
16,
284,
7933,
486,
931,
445,
25699,
797,
286,
1077,
829,
62,
16,
284,
3988,
486,
931,
1006,
310,
609,
2343,
62,
16,
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_multi_row_insert() {
let expected = expected_values("INSERT INTO \"users\" (\"foo\") VALUES ($1), ($2)", vec![10, 11]);
let query = Insert::multi_into("users", vec!["foo"])
.values(vec![10])
.values(vec![11]);
let (sql, params) = Postgres::build(query).unwrap();
assert_eq!(expected.0, sql);
assert_eq!(expected.1, params);
} | rust_cleaned_test_functions.jsonl/6444 | {
"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,
25133,
8530,
17678,
368,
341,
286,
1077,
3601,
284,
3601,
9146,
445,
12698,
12496,
7245,
4218,
2105,
320,
2105,
7975,
62705,
14710,
1711,
16,
701,
1711,
17,
11583,
7486,
20703,
16,
15,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_array_into_py() {
let gil = Python::acquire_gil();
let py = gil.python();
let array: PyObject = [1, 2].into_py(py);
let list = <PyList as PyTryFrom>::try_from(array.as_ref(py)).unwrap();
assert_eq!(1, list.get_item(0).extract::<i32>().unwrap());
assert_eq!(2, list.get_item(1).extract::<i32>().unwrap());
} | rust_cleaned_test_functions.jsonl/24179 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
45514,
40291,
368,
341,
286,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
286,
1077,
4510,
284,
342,
321,
43193,
543,
286,
1077,
1334,
25,
15891,
284,
508,
16,
11,
220,
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_reverse() {
let mut v: Vec<int> = vec![10i, 20];
assert_eq!(*v.get(0), 10);
assert_eq!(*v.get(1), 20);
v.reverse();
assert_eq!(*v.get(0), 20);
assert_eq!(*v.get(1), 10);
let mut v3: Vec<int> = vec![];
v3.reverse();
assert!(v3.is_empty());
} | rust_cleaned_test_functions.jsonl/33146 | {
"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,
43277,
368,
341,
286,
1077,
5206,
348,
25,
11312,
4159,
29,
284,
7486,
20703,
16,
15,
72,
11,
220,
17,
15,
935,
286,
2060,
10714,
0,
4071,
85,
670,
7,
15,
701,
220,
16,
15,
317,
286,
2060,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_self_exe_path() {
let path = current_exe();
assert!(path.is_ok());
let path = path.unwrap();
// Hard to test this function
assert!(path.is_absolute());
} | rust_cleaned_test_functions.jsonl/61577 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25637,
76074,
2638,
368,
341,
286,
1077,
1815,
284,
1482,
76074,
543,
286,
2060,
10297,
2343,
2079,
19817,
1423,
286,
1077,
1815,
284,
1815,
55395,
1428,
286,
442,
11232,
311,
1273,
419,
729,
198,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_reverse_binary() {
let cases = vec![
(
Datum::Bytes(b"hello".to_vec()),
Datum::Bytes(b"olleh".to_vec()),
),
(Datum::Bytes(b"".to_vec()), Datum::Bytes(b"".to_vec())),
(
Datum::Bytes("中国".as_bytes().to_vec()),
Datum::Bytes(vec![0o275u8, 0o233u8, 0o345u8, 0o255u8, 0o270u8, 0o344u8]),
),
(Datum::Null, Datum::Null),
];
let mut ctx = EvalContext::default();
for (arg, exp) in cases {
let input = string_datum_expr_with_tp(
arg,
FieldTypeTp::VarString,
FieldTypeFlag::BINARY,
-1,
CHARSET_BIN.to_owned(),
Collation::Binary,
);
let op = scalar_func_expr(ScalarFuncSig::ReverseBinary, &[input]);
let op = Expression::build(&mut ctx, op).unwrap();
let got = op.eval(&mut ctx, &[]).unwrap();
assert_eq!(got, exp);
}
} | rust_cleaned_test_functions.jsonl/9092 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 652
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43277,
31761,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
2399,
394,
68459,
486,
7078,
1883,
1,
14990,
3263,
983,
13251,
14702,
394,
68459,
486,
7078,
1883,
1,
54048,
71,
3263,
983,
13251,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_reverse_lines() {
let mut state = new();
assert_eq!(
&*reverse_lines(&mut state, "hello\nbig\nworld".into()),
"world\nbig\nhello\n"
);
} | rust_cleaned_test_functions.jsonl/66067 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43277,
18323,
368,
341,
286,
1077,
5206,
1584,
284,
501,
543,
286,
2060,
10714,
33673,
310,
609,
9,
25903,
18323,
2099,
6984,
1584,
11,
330,
14990,
1699,
16154,
1699,
14615,
3263,
18122,
14702,
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 |
#[test]
fn test_positive_zero_bytes() {
new_ucmd!()
.args(&["-c", "+0"])
.pipe_in("abcde")
.succeeds()
.stdout_is("abcde");
} | rust_cleaned_test_functions.jsonl/39302 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54160,
19359,
12524,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
12,
66,
497,
6630,
15,
14108,
286,
659,
13768,
1243,
445,
13683,
450,
1138,
286,
659,
82,
29264,
82,
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 |
#[test]
fn test_scans_short_script_start_tag() {
let mut scanner = Scanner::new(
"<?xml>I shall be ignored</xml><?
$a = 1;
",
);
scanner.scan().unwrap();
assert_eq!(token_list!(scanner.tokens), "<? $a = 1 ; ");
} | rust_cleaned_test_functions.jsonl/52951 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13171,
596,
16673,
14660,
4906,
9372,
368,
341,
286,
1077,
5206,
20775,
284,
17170,
486,
931,
1006,
310,
40271,
6455,
65828,
4880,
387,
12036,
522,
6455,
7508,
198,
310,
400,
64,
284,
220,
16,
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_match() {
let realm = Realm::create();
let mut engine = Executor::new(realm);
let init = r#"
var str = new String('The Quick Brown Fox Jumps Over The Lazy Dog');
var result1 = str.match(/quick\s(brown).+?(jumps)/i);
var result2 = str.match(/[A-Z]/g);
var result3 = str.match("T");
var result4 = str.match(RegExp("B", 'g'));
"#;
forward(&mut engine, init);
assert_eq!(forward(&mut engine, "result1[0]"), "Quick Brown Fox Jumps");
assert_eq!(forward(&mut engine, "result1[1]"), "Brown");
assert_eq!(forward(&mut engine, "result1[2]"), "Jumps");
assert_eq!(forward(&mut engine, "result1.index"), "4");
assert_eq!(
forward(&mut engine, "result1.input"),
"The Quick Brown Fox Jumps Over The Lazy Dog"
);
assert_eq!(forward(&mut engine, "result2[0]"), "T");
assert_eq!(forward(&mut engine, "result2[1]"), "Q");
assert_eq!(forward(&mut engine, "result2[2]"), "B");
assert_eq!(forward(&mut engine, "result2[3]"), "F");
assert_eq!(forward(&mut engine, "result2[4]"), "J");
assert_eq!(forward(&mut engine, "result2[5]"), "O");
assert_eq!(forward(&mut engine, "result2[6]"), "T");
assert_eq!(forward(&mut engine, "result2[7]"), "L");
assert_eq!(forward(&mut engine, "result2[8]"), "D");
assert_eq!(forward(&mut engine, "result3[0]"), "T");
assert_eq!(forward(&mut engine, "result3.index"), "0");
assert_eq!(
forward(&mut engine, "result3.input"),
"The Quick Brown Fox Jumps Over The Lazy Dog"
);
assert_eq!(forward(&mut engine, "result4[0]"), "B");
} | rust_cleaned_test_functions.jsonl/8933 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 812
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10708,
368,
341,
286,
1077,
21889,
284,
41106,
486,
3182,
543,
286,
1077,
5206,
4712,
284,
56032,
486,
931,
5801,
7673,
317,
286,
1077,
2930,
284,
435,
2,
698,
286,
762,
607,
284,
501,
923,
49... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_resource_block_with_circular_shorthand_rules() {
let p = Polar::new();
p.register_constant(sym!("Repo"), term!("unimportant"))
.unwrap();
let policy = r#"resource Repo {
roles = [ "writer" ];
"writer" if "writer";
}"#;
panic!("{}", p.load_str(policy).unwrap_err());
// let policy = r#"resource Repo {
// "writer" if "reader";
// "reader" if "writer";
// let policy = r#"resource Repo {
// "admin" if "reader";
// "writer" if "admin";
// "reader" if "writer";
} | rust_cleaned_test_functions.jsonl/31745 | {
"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,
17962,
7113,
6615,
666,
21472,
3712,
61679,
21407,
368,
341,
286,
1077,
281,
284,
55896,
486,
931,
543,
286,
281,
9929,
34967,
62512,
17223,
25243,
3975,
4647,
17223,
359,
15333,
5455,
310,
659,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_no_asked() {
let (relayer, always_success_out_point) = build_chain(5);
let peer_index: PeerIndex = 100.into();
let transaction = new_transaction(&relayer, 1, &always_success_out_point);
let transactions = vec![transaction.clone()];
let content = packed::BlockProposal::new_builder()
.transactions(transactions.into_iter().map(|tx| tx.data()).pack())
.build();
let process = BlockProposalProcess::new(content.as_reader(), &relayer, peer_index);
let r = process.execute();
assert_eq!(r.ok(), Some(Status::NoAsked));
let known = relayer.shared.state().already_known_tx(&transaction.hash());
assert_eq!(known, false);
} | rust_cleaned_test_functions.jsonl/30801 | {
"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,
6536,
92269,
291,
368,
341,
262,
1077,
320,
3748,
1135,
11,
2677,
18632,
6068,
6085,
8,
284,
1936,
30583,
7,
20,
317,
262,
1077,
14397,
3560,
25,
45147,
1552,
284,
220,
16,
15,
15,
39860,
1428... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_generic_generate_constructor() {
let gen = generic_fn();
let expected: TokenStream = quote! {
pub const fn foo_fn_meta<A: M, B>() -> crate::rpn_expr::RpnFnMeta
where
B: N<A>
{
#[inline]
fn run<A: M, B>(
ctx: &mut crate::expr::EvalContext,
output_rows: usize,
args: &[crate::rpn_expr::RpnStackNode<'_>],
extra: &mut crate::rpn_expr::RpnFnCallExtra<'_>,
) -> crate::Result<crate::codec::data_type::VectorValue>
where
B: N<A>
{
use crate::rpn_expr::function::{ArgConstructor, Evaluator, Null};
<ArgConstructor<A::X, _>>::new(0usize, Foo_Evaluator::<A, B>(std::marker::PhantomData))
.eval(Null, ctx, output_rows, args, extra)
}
fn validate<A: M, B>(expr: &tipb::Expr) -> crate::Result<()>
where
B: N<A>
{
use crate::codec::data_type::Evaluable;
use crate::rpn_expr::function;
function::validate_expr_return_type(expr, B::EVAL_TYPE)?;
function::validate_expr_arguments_eq(expr, 1usize)?;
let children = expr.get_children();
function::validate_expr_return_type(&children[0usize], A::X::EVAL_TYPE)?;
Ok(())
}
crate::rpn_expr::RpnFnMeta {
name: "foo",
validator_ptr: validate::<A, B>,
fn_ptr: run::<A, B>,
}
}
};
assert_eq!(expected.to_string(), gen.generate_constructor().to_string());
} | rust_cleaned_test_functions.jsonl/25664 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41232,
48851,
66210,
368,
341,
286,
1077,
4081,
284,
13954,
15246,
543,
286,
1077,
3601,
25,
9660,
3027,
284,
12641,
0,
341,
310,
6675,
733,
5168,
15229,
15246,
13381,
30192,
25,
386,
11,
425,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_is_propagated() {
let mut progress_map = ProgressMap::default();
progress_map.insert(10, ForkProgress::new(Hash::default(), Some(9), None, 0, 0));
progress_map.insert(
9,
ForkProgress::new(
Hash::default(),
None,
Some(ValidatorStakeInfo::default()),
0,
0,
),
);
// None of these slot have parents which are confirmed
assert!(!progress_map.is_propagated(9));
assert!(!progress_map.is_propagated(10));
// Insert new ForkProgress for slot 8 with no previous leader.
// this implies the parent is rooted
progress_map.insert(8, ForkProgress::new(Hash::default(), Some(7), None, 0, 0));
assert!(progress_map.is_propagated(8));
progress_map
.get_propagated_stats_mut(9)
.unwrap()
.is_propagated = true;
assert!(progress_map.is_propagated(9));
assert!(progress_map.get(&9).unwrap().propagated_stats.is_propagated);
// is the last leader slot before 10
assert!(progress_map.is_propagated(10));
progress_map
.get_propagated_stats_mut(10)
.unwrap()
.is_leader_slot = true;
assert!(!progress_map.is_propagated(10));
} | rust_cleaned_test_functions.jsonl/103624 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 746
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
21663,
351,
657,
368,
341,
286,
1077,
5206,
5098,
5376,
284,
16033,
2227,
486,
2258,
1428,
16885,
286,
5098,
5376,
7030,
7,
16,
15,
11,
47850,
9496,
486,
931,
7,
6370,
486,
2258,
1507,
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_operator_unary() {
let mut l = Lexer::<DefaultContext>::new(b"A B::operator+()");
let p = TypeDeclaratorParser::new(&mut l);
let mut context = Context::default();
let (_, decl) = p.parse(None, None, true, &mut context).unwrap();
let decl = decl.unwrap();
assert_eq!(
decl,
Rc::new(TypeDeclarator {
typ: Type {
base: BaseType::Function(Box::new(Function {
return_type: Some(Type {
base: BaseType::UD(Box::new(UserDefined {
name: mk_id!("A"),
typ: UDType::Indirect(TypeToFix::default())
})),
cv: CVQualifier::empty(),
pointers: None,
}),
params: vec![],
cv: CVQualifier::empty(),
refq: RefQualifier::None,
except: None,
attributes: None,
trailing: None,
virt_specifier: VirtSpecifier::empty(),
status: FunStatus::None,
requires: None,
ctor_init: None,
body: RefCell::new(None)
})),
cv: CVQualifier::empty(),
pointers: None,
},
specifier: Specifier::empty(),
identifier: Identifier {
identifier: Some(Qualified {
names: vec![
Name::Identifier(names::Identifier {
val: "B".to_string()
}),
Name::Operator(Box::new(operator::Operator::Op(
expressions::Operator::Plus
))),
]
}),
attributes: None
},
init: None,
bitfield_size: None,
})
);
} | rust_cleaned_test_functions.jsonl/117541 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1432
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40594,
4907,
658,
368,
341,
286,
1077,
5206,
326,
284,
85082,
27638,
3675,
1972,
6831,
931,
1883,
29133,
425,
486,
7884,
10,
45961,
286,
1077,
281,
284,
3990,
1912,
12821,
850,
6570,
486,
931,
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_pat_() {
parse_macro(
r#"
macro_rules! foo {
($ i:pat) => { fn foo() { let $ i; } }
}
"#,
)
.assert_expand_items("foo! { (a, b) }", "fn foo () {let (a , b) ;}");
} | rust_cleaned_test_functions.jsonl/28736 | {
"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,
55824,
62,
368,
341,
262,
4715,
58810,
1006,
286,
435,
2,
698,
286,
18072,
21407,
0,
15229,
341,
310,
1711,
600,
25,
4676,
8,
589,
314,
5168,
15229,
368,
314,
1077,
400,
600,
26,
335,
456,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bad_unicode_collision() -> Result<(), Box<dyn std::error::Error>> {
use std::os::unix::ffi::OsStrExt;
// Generate a bad-Unicode collision.
let bad1 = Path::new(OsStr::from_bytes(&b"test\x99.run"[..]));
let bad2 = Path::new(OsStr::from_bytes(&b"test\xee.run"[..]));
let run1 = Run(bad1.to_string_lossy().into_owned());
let run2 = Run(bad2.to_string_lossy().into_owned());
assert_ne!(bad1, bad2);
assert_eq!(run1, run2);
let run = run1;
drop(run2);
let logdir = tempfile::tempdir()?;
for &dir_basename in &[bad1, bad2] {
let dir = logdir.path().join(dir_basename);
fs::create_dir(&dir)?;
File::create(dir.join(EVENT_FILE_BASENAME_INFIX))?;
}
let commit = Commit::new();
let mut loader = LogdirLoader::new(&commit, logdir.path().to_path_buf());
loader.reload();
assert_eq!(loader.runs.keys().collect::<Vec<_>>(), vec![&run]);
let run_state = &loader.runs[&run];
assert!(bad1 < bad2);
assert_eq!(run_state.relpath, bad1);
let mut expected_relpaths = HashSet::new();
expected_relpaths.insert(bad2.to_path_buf());
assert_eq!(run_state.collided_relpaths, expected_relpaths);
Ok(())
} | rust_cleaned_test_functions.jsonl/76038 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 652
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34199,
54662,
70375,
368,
1464,
5714,
68843,
8261,
92846,
1460,
486,
841,
486,
1454,
2452,
341,
286,
990,
1460,
486,
436,
486,
56646,
486,
53799,
486,
28867,
2580,
6756,
401,
286,
442,
19813,
264,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_tgl_tgl() {
// 2nd tgl becomes a nop
let input = "tgl 1
tgl 1
dec a";
let regs = compute(input);
assert_eq!(-1, regs.get('a'));
// 2nd tgl becomes an inc
let input2 = "tgl 1
tgl a";
let regs2 = compute(input2);
assert_eq!(1, regs2.get('a'));
} | rust_cleaned_test_functions.jsonl/21655 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 133
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
6072,
528,
6072,
368,
341,
197,
322,
220,
17,
303,
259,
6072,
9044,
264,
65026,
198,
10217,
1946,
284,
330,
45078,
220,
16,
198,
45078,
220,
16,
198,
8169,
264,
876,
10217,
44498,
284,
12... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_example_3() {
let input = "not-a-real-room-404[oarel]";
let answer: usize = solve(&input, 1);
assert_eq!(answer, 404);
} | rust_cleaned_test_functions.jsonl/49457 | {
"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,
39304,
62,
18,
368,
341,
286,
1077,
1946,
284,
330,
1921,
7409,
74795,
47740,
12,
19,
15,
19,
48243,
30431,
59757,
286,
1077,
4226,
25,
22301,
284,
11625,
2099,
1355,
11,
220,
16,
317,
286,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_bf16_to_f32() {
let f = bf16::from_f32(7.0);
assert_eq!(f.to_f32(), 7.0f32);
let f = bf16::from_f32(7.1);
let diff = (f.to_f32() - 7.1f32).abs();
assert!(diff <= 4.0 * bf16::EPSILON.to_f32());
let tiny32 = f32::from_bits(0x0001_0000u32);
assert_eq!(bf16::from_bits(0x0001).to_f32(), tiny32);
assert_eq!(bf16::from_bits(0x0005).to_f32(), 5.0 * tiny32);
assert_eq!(bf16::from_bits(0x0001), bf16::from_f32(tiny32));
assert_eq!(bf16::from_bits(0x0005), bf16::from_f32(5.0 * tiny32));
} | rust_cleaned_test_functions.jsonl/4211 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 352
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
69,
16,
21,
2346,
761,
18,
17,
368,
341,
286,
1077,
282,
284,
39093,
16,
21,
486,
1499,
761,
18,
17,
7,
22,
13,
15,
317,
286,
2060,
10714,
10297,
69,
2389,
761,
18,
17,
1507,
220,
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_ascii_to_bytes() {
assert_eq!(vec2ascii![40, 32, 59].into_bytes(), vec![40u8, 32u8, 59u8]);
} | rust_cleaned_test_functions.jsonl/4331 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 73
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
50238,
2346,
12524,
368,
341,
286,
2060,
10714,
10297,
4083,
17,
23324,
20703,
19,
15,
11,
220,
18,
17,
11,
220,
20,
24,
936,
18122,
12524,
1507,
7486,
20703,
19,
15,
84,
23,
11,
220,
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 |
#[test]
fn test_iterations_to_color_even_gradient() {
let palette: Vec<Rgb<u8>> = vec![RED, ORANGE, YELLOW, WHITE];
let width: u32 = 101;
let limit = 100;
let mut output_gradient: Vec<Rgb<u8>> = Vec::with_capacity(width as usize);
for i in 0..width {
output_gradient.push(iterations_to_color(i, limit, &palette));
}
assert_eq!(output_gradient.len(), width as usize);
// Test the three subranges' boundaries
assert_eq!(output_gradient[0], RED);
assert_eq!(output_gradient[33], ORANGE);
assert_eq!(output_gradient[66], YELLOW);
assert_eq!(output_gradient[99], WHITE);
assert_eq!(output_gradient[100], BLACK);
// Test random points in subranges
assert_eq!(output_gradient[4], Rgb([255, 15, 0]));
assert_eq!(output_gradient[16], Rgb([255, 62, 0]));
assert_eq!(output_gradient[25], Rgb([255, 96, 0]));
assert_eq!(output_gradient[40], Rgb([255, 154, 0]));
assert_eq!(output_gradient[50], Rgb([255, 193, 0]));
assert_eq!(output_gradient[61], Rgb([255, 236, 0]));
assert_eq!(output_gradient[67], Rgb([255, 255, 8]));
assert_eq!(output_gradient[75], Rgb([255, 255, 70]));
assert_eq!(output_gradient[85], Rgb([255, 255, 147]));
// Write blended gradient to file
let filename = "test_gradient_even.png";
let height: u32 = 25;
write_test_gradient(output_gradient, filename, width, height);
} | rust_cleaned_test_functions.jsonl/42573 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 585
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55607,
2346,
6714,
68347,
49482,
368,
341,
262,
1077,
26308,
25,
11312,
23370,
9511,
34837,
23,
2452,
284,
7486,
20703,
6504,
11,
2726,
11503,
11,
81276,
11,
42767,
935,
262,
1077,
2374,
25,
575,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_search() {
let parsed = parse_resolv_conf("search localnet.").expect("failed");
let mut cfg = empty_config();
cfg.add_search(Name::from_str("localnet.").unwrap());
assert_eq!(cfg.search(), parsed.0.search());
assert_eq!(ResolverOpts::default(), parsed.1);
} | rust_cleaned_test_functions.jsonl/39725 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10716,
368,
341,
286,
1077,
15676,
284,
4715,
4918,
35315,
16059,
445,
1836,
2205,
4711,
98401,
17119,
445,
16091,
797,
286,
1077,
5206,
13286,
284,
4287,
5332,
543,
286,
13286,
1364,
10716,
21182,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_set_rocksdb_options() {
let tmp_dir = tempfile::Builder::new()
.prefix("test_set_rocksdb_options")
.tempdir()
.unwrap();
let config = DBConfig {
path: tmp_dir.as_ref().to_path_buf(),
options: {
let mut opts = HashMap::new();
opts.insert("disable_auto_compactions".to_owned(), "true".to_owned());
opts
},
options_file: None,
};
RocksDB::open(&config, 2); // no panic
} | rust_cleaned_test_functions.jsonl/82339 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 307
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
26608,
14553,
1999,
8743,
368,
341,
286,
1077,
4174,
4334,
284,
54819,
486,
3297,
486,
931,
741,
310,
659,
11849,
445,
1944,
2602,
26608,
14553,
1999,
8743,
1138,
310,
659,
3888,
3741,
741,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_send_propose_and_prevote() {
let sandbox = timestamping_sandbox();
// get some tx
let tx = gen_timestamping_tx();
sandbox.recv(&tx);
// round happens
sandbox.add_time(Duration::from_millis(1000));
sandbox.add_time(Duration::from_millis(1999));
sandbox.assert_state(HEIGHT_ONE, ROUND_THREE);
let propose = Propose::new(
VALIDATOR_0,
HEIGHT_ONE,
ROUND_THREE,
&sandbox.last_hash(),
&[tx.hash()],
sandbox.s(VALIDATOR_0),
);
sandbox.broadcast(&propose);
sandbox.broadcast(&Prevote::new(
VALIDATOR_0,
HEIGHT_ONE,
ROUND_THREE,
&propose.hash(),
Round::zero(),
sandbox.s(VALIDATOR_0),
));
} | rust_cleaned_test_functions.jsonl/30015 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 368
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13565,
21663,
960,
8378,
25566,
1272,
368,
341,
262,
1077,
42754,
284,
11441,
287,
643,
31536,
1428,
262,
442,
633,
1045,
9854,
198,
262,
1077,
9854,
284,
4081,
23073,
287,
17805,
543,
262,
42754,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_patterns_paramter() {
assert!(super::match_simple(
"http://store.steampowered.com/app/203770/Crusader_Kings_II/",
"*.steampowered.com"
));
assert!(!super::match_simple(
"http://store.steampowered.com/app/203770/Crusader_Kings_II/",
"*.steamcommunity.com"
));
assert!(super::match_simple(
"https://steamcommunity.com/sharedfiles/filedetails/?id=1526918750",
"steamcommunity.com"
));
assert!(super::match_simple(
"https://steamcommunity.com/sharedfiles/filedetails/?id=1526918750&asd=kas1235",
"steamcommunity.com"
));
} | rust_cleaned_test_functions.jsonl/99430 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 359
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64923,
4090,
465,
368,
341,
286,
2060,
10297,
9522,
486,
6347,
30015,
1006,
310,
330,
1254,
1110,
4314,
1236,
68,
1121,
79213,
905,
10640,
14,
17,
15,
18,
22,
22,
15,
11295,
20341,
998,
10102,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_left_integer() {
assert_condition_false!("9 < 2.1");
assert_condition_false!("9 < 8.9");
assert_condition_false!("9 < 9.0");
assert_condition!("9 < 9.1");
assert_condition!("9 < 19.1");
assert_condition_false!("9 < 2");
assert_condition_false!("9 < 9");
assert_condition!("9 < 19");
assert_condition_err!("9 < \"hello\"", 20);
assert_condition_false!("9 < 2.1#");
assert_condition!("9 < 9.1#");
assert_condition!("9 < 19.1#");
} | rust_cleaned_test_functions.jsonl/22664 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 317
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9579,
31725,
368,
341,
310,
2060,
27656,
36015,
17223,
24,
366,
220,
17,
13,
16,
797,
310,
2060,
27656,
36015,
17223,
24,
366,
220,
23,
13,
24,
797,
310,
2060,
27656,
36015,
17223,
24,
366,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_write_keypair_file() {
let outfile = tmp_file_path("test_write_keypair_file.json");
let serialized_keypair = write_keypair_file(&Keypair::new(), &outfile).unwrap();
let keypair_vec: Vec<u8> = serde_json::from_str(&serialized_keypair).unwrap();
assert!(Path::new(&outfile).exists());
assert_eq!(
keypair_vec,
read_keypair_file(&outfile).unwrap().0.to_bytes().to_vec()
);
#[cfg(unix)]
{
use std::os::unix::fs::PermissionsExt;
assert_eq!(
File::open(&outfile)
.expect("open")
.metadata()
.expect("metadata")
.permissions()
.mode()
& 0o777,
0o600
);
}
assert_eq!(
read_keypair_file(&outfile).unwrap().pubkey().as_ref().len(),
mem::size_of::<Pubkey>()
);
fs::remove_file(&outfile).unwrap();
assert!(!Path::new(&outfile).exists());
} | rust_cleaned_test_functions.jsonl/8408 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 622
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
3097,
12670,
2458,
368,
341,
286,
1077,
33178,
284,
4174,
2458,
2638,
445,
1944,
9165,
3097,
12670,
2458,
4323,
797,
286,
1077,
32916,
3097,
12670,
284,
3270,
3097,
12670,
2458,
2099,
6608,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_long_filter() {
assert_eq!(
vec![
"1".to_string(),
"12".to_string(),
"123".to_string(),
"1234".to_string(),
"12345".to_string(),
"123456".to_string(),
"1234567".to_string(),
"12345678".to_string(),
"123456789".to_string(),
],
helper("1 12 123 1234 12345 123456 1234567 12345678 123456789 1234567890 12345678901")
);
} | rust_cleaned_test_functions.jsonl/19475 | {
"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,
18193,
17799,
8727,
368,
341,
286,
2060,
10714,
33673,
310,
7486,
90515,
394,
330,
16,
3263,
983,
3904,
3148,
394,
330,
16,
17,
3263,
983,
3904,
3148,
394,
330,
16,
17,
18,
3263,
983,
3904,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_wrap_return_type_handles_generic_functions() {
check_fix(
r#"
//- minicore: option, result
fn div<T>(x: T) -> Result<T, i32> {
if x == 0 {
return Err(7);
}
$0x
}
"#,
r#"
fn div<T>(x: T) -> Result<T, i32> {
if x == 0 {
return Err(7);
}
Ok(x)
}
"#,
);
} | rust_cleaned_test_functions.jsonl/51837 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 214
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38550,
12511,
1819,
68017,
41232,
31708,
368,
341,
286,
1779,
36060,
1006,
310,
435,
2,
698,
61463,
1308,
292,
460,
25,
2999,
11,
1102,
198,
8822,
3429,
3125,
2235,
87,
25,
350,
8,
1464,
5714,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_node_key_config_file() {
fn secret_file(net_config_dir: Option<String>) -> error::Result<()> {
NodeKeyType::variants().into_iter().try_for_each(|t| {
let node_key_type = NodeKeyType::from_str(t).unwrap();
let tmp = TempDir::new("alice")?;
let file = tmp.path().join(format!("{}_mysecret", t)).to_path_buf();
let params = NodeKeyParams {
node_key_type,
node_key: None,
node_key_file: Some(file.clone())
};
node_key_config(params, &net_config_dir).and_then(|c| match c {
NodeKeyConfig::Secp256k1(network::Secret::File(ref f))
if node_key_type == NodeKeyType::Secp256k1 && f == &file => Ok(()),
NodeKeyConfig::Ed25519(network::Secret::File(ref f))
if node_key_type == NodeKeyType::Ed25519 && f == &file => Ok(()),
_ => Err(input_err("Unexpected node key config"))
})
})
}
assert!(secret_file(None).is_ok());
assert!(secret_file(Some("x".to_string())).is_ok());
} | rust_cleaned_test_functions.jsonl/40028 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 428
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5084,
3097,
5332,
2458,
368,
341,
197,
40095,
6234,
2458,
30723,
5332,
4334,
25,
6959,
3464,
9231,
1464,
1465,
486,
2077,
71698,
341,
298,
30217,
97964,
486,
54611,
1005,
18122,
11723,
1005,
1539,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_new_from_opt_iter() {
let v = vec![None, Some(1), Some(2), None];
let mut iter = v.into_iter();
iter.next(); // move iterator and create data_array from second element
let data_array: DFInt64Array = NewDataArray::new_from_opt_iter(iter);
let mut iter = data_array.into_iter();
assert_eq!(Some(Some(&1)), iter.next());
assert_eq!(Some(Some(&2)), iter.next());
assert_eq!(Some(None), iter.next());
assert_eq!(None, iter.next());
} | rust_cleaned_test_functions.jsonl/102164 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 194
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
5673,
15032,
11723,
368,
341,
262,
1077,
348,
284,
7486,
20703,
4064,
11,
4329,
7,
16,
701,
4329,
7,
17,
701,
2240,
935,
262,
1077,
5206,
5367,
284,
348,
39860,
11723,
543,
262,
5367,
45... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pos() {
let mut r = BufReader::new(b"abc def\nghi");
assert_eq!(r.read().unwrap(), Token::DocStart(""));
let t = r.read().unwrap();
assert_eq!(t, Token::Symbol("abc"));
assert_eq!(r.pos_of(&t), 0);
assert_eq!(r.line_of(&t), 1);
let t = r.read().unwrap();
assert_eq!(r.pos_of(&t), 3);
assert_eq!(r.line_of(&t), 1);
let t = r.read().unwrap();
assert_eq!(t, Token::Symbol("def"));
assert_eq!(r.pos_of(&t), 4);
assert_eq!(r.line_of(&t), 1);
let t = r.read().unwrap();
assert_eq!(r.pos_of(&t), 7);
assert_eq!(r.line_of(&t), 1);
let t = r.read().unwrap();
assert_eq!(t, Token::Symbol("ghi"));
assert_eq!(r.pos_of(&t), 8);
assert_eq!(r.line_of(&t), 2);
assert_eq!(r.read().unwrap(), Token::DocEnd(""));
} | rust_cleaned_test_functions.jsonl/95951 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 493
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6479,
368,
341,
286,
1077,
5206,
435,
284,
69013,
5062,
486,
931,
1883,
1,
13683,
707,
1699,
75076,
797,
286,
2060,
10714,
10297,
81,
4125,
1005,
15454,
1507,
9660,
486,
9550,
3479,
89744,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_top_level_items() {
let ir = ir_from_cc(
r#"
struct ForwardDeclaredTopLevelStruct;
struct TopLevelStruct;
struct TopLevelStruct {};
// Top level comment
// Function comment
void top_level_func();
namespace top_level_namespace {
struct Nested {};
// free nested comment
// nested_func comment
void nested_func();
} // namespace top_level_namespace"#,
)
.unwrap();
let top_level_items =
ir.top_level_item_ids().map(|id| ir.find_decl(*id).unwrap()).collect_vec();
assert_items_match!(
top_level_items,
vec![
quote! {
IncompleteRecord {
... cc_name: "ForwardDeclaredTopLevelStruct" ...
}
},
quote! {
Record {
... rs_name: "TopLevelStruct" ...
}
},
quote! {
Comment {
... text: "Top level comment" ...
}
},
quote! {
Func { ... name: "top_level_func" ... }
},
quote! {
UnsupportedItem { ... name: "top_level_namespace" ... }
},
quote! {
Comment {
... text: "namespace top_level_namespace" ...
}
},
]
);
} | rust_cleaned_test_functions.jsonl/37234 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 795
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10426,
8274,
12134,
368,
341,
262,
1077,
6216,
284,
6216,
5673,
28955,
1006,
286,
435,
2,
698,
286,
2036,
22164,
59467,
5366,
4449,
9422,
280,
286,
2036,
6909,
4449,
9422,
280,
286,
2036,
6909,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_constant_integer() {
let mut u8_reader = U8Reader::new(&[0x12, 0x34, 0x56, 0x78]);
let constant_integer = ConstantInteger::new(&mut u8_reader);
assert_eq!(ConstantTag::Integer, constant_integer.tag);
assert_eq!(0x12_34_56_78, constant_integer.value);
assert_eq!(4, u8_reader.position);
} | rust_cleaned_test_functions.jsonl/118033 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 140
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34967,
31725,
368,
341,
262,
1077,
5206,
575,
23,
22306,
284,
547,
23,
5062,
486,
931,
2099,
58,
15,
87,
16,
17,
11,
220,
15,
87,
18,
19,
11,
220,
15,
87,
20,
21,
11,
220,
15,
87,
22,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bcs_not_taken() {
let code = vec![0xB0, 0x07]; // offset is +7.
let mut nes = Cpu::new();
let mut memory = new_memory(code);
nes.C = 0; // C clear so do not take the branch.
nes.next(&mut memory).unwrap();
assert_eq!(0x8002, nes.PC);
} | rust_cleaned_test_functions.jsonl/38700 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 160
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
4837,
7913,
72933,
368,
341,
286,
1077,
2038,
284,
7486,
20703,
15,
14377,
15,
11,
220,
15,
87,
15,
22,
5265,
442,
4347,
374,
488,
22,
624,
286,
1077,
5206,
308,
288,
284,
356,
5584,
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_vring_config_data() {
let mut config = VringConfigData {
queue_max_size: 0x1000,
queue_size: 0x2000,
flags: 0x0,
desc_table_addr: 0x4000,
used_ring_addr: 0x5000,
avail_ring_addr: 0x6000,
log_addr: None,
};
assert_eq!(config.is_log_addr_valid(), true);
assert_eq!(config.get_log_addr(), 0);
config.flags = 0x1;
assert_eq!(config.is_log_addr_valid(), false);
assert_eq!(config.get_log_addr(), 0);
config.log_addr = Some(0x7000);
assert_eq!(config.is_log_addr_valid(), true);
assert_eq!(config.get_log_addr(), 0x7000);
config.flags = 0x0;
assert_eq!(config.is_log_addr_valid(), true);
assert_eq!(config.get_log_addr(), 0);
} | rust_cleaned_test_functions.jsonl/98906 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 445
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
12640,
5332,
1769,
368,
341,
286,
1077,
5206,
2193,
284,
647,
12640,
2648,
1043,
341,
310,
7177,
6345,
2368,
25,
220,
15,
87,
16,
15,
15,
15,
345,
310,
7177,
2368,
25,
220,
15,
87,
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_parse_valid_sqs_list_queues() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/valid",
"sqs-list-queues.xml",
);
let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
let client = SqsClient::new_with(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = ListQueuesRequest::default();
let result = client.list_queues(request).sync();
assert!(result.is_ok(), "parse error: {:?}", result);
} | rust_cleaned_test_functions.jsonl/49938 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 243
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8337,
643,
26358,
2019,
82413,
368,
341,
286,
1077,
7860,
9655,
284,
14563,
2582,
5062,
486,
878,
9655,
1006,
310,
330,
1944,
35569,
79372,
14,
1891,
756,
310,
330,
82,
26358,
9029,
12,
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_primitives() {
let mut bvc = ByValueChecker::new();
let t: ItemStruct = parse_quote! {
struct Foo {
a: i32,
b: i64,
}
};
let t_id = ty_from_ident(&t.ident);
bvc.ingest_struct(&t, &Namespace::new());
bvc.satisfy_requests(vec![t_id.clone()]).unwrap();
assert!(bvc.is_pod(&t_id));
} | rust_cleaned_test_functions.jsonl/93408 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 241
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5294,
35209,
368,
341,
286,
1077,
5206,
293,
7362,
284,
3216,
1130,
35188,
486,
931,
543,
286,
1077,
259,
25,
5739,
9422,
284,
4715,
45236,
0,
341,
310,
2036,
33428,
341,
394,
264,
25,
600,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_merge_string() -> Result<()> {
let a0: &dyn Array = &Utf8Array::<i32>::from_slice(&["a", "c", "d", "e"]);
let a1: &dyn Array = &Utf8Array::<i32>::from_slice(&["b", "y", "z", "z"]);
let options = SortOptions::default();
let arrays = vec![a0, a1];
let pairs = vec![(arrays.as_ref(), &options)];
let comparator = build_comparator(&pairs)?;
let result =
merge_sort_slices(once(&(0, 0, 4)), once(&(1, 0, 4)), &comparator).collect::<Vec<_>>();
assert_eq!(result, vec![(0, 0, 1), (1, 0, 1), (0, 1, 3), (1, 1, 3)]);
let result =
merge_sort_slices(once(&(0, 1, 2)), once(&(1, 0, 3)), &comparator).collect::<Vec<_>>();
assert_eq!(result, vec![(1, 0, 1), (0, 1, 2), (1, 1, 2)]);
Ok(())
} | rust_cleaned_test_functions.jsonl/47141 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 500
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20888,
3904,
368,
1464,
5714,
71698,
341,
286,
1077,
264,
15,
25,
609,
43085,
2910,
284,
609,
38980,
23,
1857,
27638,
72,
18,
17,
6831,
1499,
26488,
2099,
1183,
64,
497,
330,
66,
497,
330,
67,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_try_confirm_non_existent_proposal() {
let mut testkit = testkit_with_supervisor(4);
let initiator_id = testkit.network().us().validator_id().unwrap();
let consensus_config = consensus_config_propose_first_variant(&testkit);
let config_proposal = ConfigProposeBuilder::new(CFG_CHANGE_HEIGHT)
.extend_consensus_config_propose(consensus_config.clone())
.build();
testkit
.create_block_with_transaction(sign_config_propose_transaction(
&testkit,
config_proposal,
initiator_id,
))
.transactions[0]
.status()
.expect("Transaction with change propose discarded.");
let wrong_hash = crypto::hash(&[0]);
let signed_confirm = build_confirmation_transactions(&testkit, wrong_hash, initiator_id);
let block = testkit.create_block_with_transactions(signed_confirm);
let err = block.transactions[0].status().unwrap_err();
assert_eq!(
*err,
ErrorMatch::from_fail(&ConfigurationError::ConfigProposeNotRegistered)
.for_service(SUPERVISOR_INSTANCE_ID)
);
} | rust_cleaned_test_functions.jsonl/93836 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 465
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
23800,
21637,
2702,
18128,
21663,
32556,
368,
341,
262,
1077,
5206,
1273,
8226,
284,
1273,
8226,
6615,
23723,
31396,
7,
19,
317,
262,
1077,
98040,
842,
284,
1273,
8226,
20573,
1005,
355,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_index() {
let vec = Vec2::new(1.0, -4.0);
assert_approx_eq!(vec[0], 1.0);
assert_approx_eq!(vec[1], -4.0);
} | rust_cleaned_test_functions.jsonl/77727 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3560,
368,
341,
286,
1077,
7486,
284,
11312,
17,
486,
931,
7,
16,
13,
15,
11,
481,
19,
13,
15,
626,
286,
2060,
90425,
10714,
10297,
4083,
58,
15,
1125,
220,
16,
13,
15,
317,
286,
2060,
904... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_uxtab_() {
assert_eq!(
decode_32(0xfa54f480),
Instruction::UXTAB {
params: Reg3UsizeParams {
rd: Reg::R4,
rn: Reg::R4,
rm: Reg::R0,
rotation: 0
}
}
);
} | rust_cleaned_test_functions.jsonl/64866 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 210
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
62,
2200,
6192,
62,
368,
341,
14808,
262,
2060,
10714,
33673,
286,
16895,
62,
18,
17,
7,
15,
48890,
20,
19,
69,
19,
23,
15,
1326,
286,
29051,
486,
52,
9036,
1867,
341,
310,
3628,
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_echo_repr_parse() {
let packet = Packet::new_unchecked(&ECHO_PACKET_BYTES[..]);
let repr = Repr::parse(
&MOCK_IP_ADDR_1,
&MOCK_IP_ADDR_2,
&packet,
&ChecksumCapabilities::default(),
)
.unwrap();
assert_eq!(repr, echo_packet_repr());
} | rust_cleaned_test_functions.jsonl/44725 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 203
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68628,
68535,
21039,
368,
341,
286,
1077,
10151,
284,
28889,
486,
931,
4907,
7549,
2099,
36,
30498,
40328,
40705,
95874,
2558,
286,
1077,
30636,
284,
1032,
649,
486,
6400,
1006,
310,
609,
10531,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_compact_uint() {
let cases = [
(&[1, 2, 3][..], (1, 1)),
(&[253, 2, 3][..], (770, 3)),
(&[254, 2, 3, 8, 1, 8][..], (17302274, 5)),
(&[255, 6, 0xa, 3, 8, 1, 0xb, 2, 7, 8][..], (504978207276206598, 9)),
];
for (input, expected) in cases.iter() {
assert_eq!(parse_compact_uint(input).unwrap(), *expected);
}
} | rust_cleaned_test_functions.jsonl/132187 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 249
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
18177,
531,
15807,
368,
341,
286,
1077,
5048,
284,
2278,
310,
15899,
58,
16,
11,
220,
17,
11,
220,
18,
1457,
496,
1125,
320,
16,
11,
220,
16,
6965,
310,
15899,
58,
17,
20,
18,
11,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_parse_rest() {
let segments = PathParser::new(r"/first<id>/<*rest>").parse().unwrap();
assert_eq!(
format!("{:?}", segments),
r#"[CombPart([ConstPart("first"), NamedPart("id")]), NamedPart("*rest")]"#
);
} | rust_cleaned_test_functions.jsonl/63596 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
32231,
368,
341,
286,
1077,
20632,
284,
7933,
6570,
486,
931,
2601,
3115,
3896,
27,
307,
67772,
9,
3927,
61032,
6400,
1005,
15454,
543,
286,
2060,
10714,
33673,
310,
3561,
88928,
25,
52652,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multiple_typedefs_to_same_template() -> Result<()> {
let ir = ir_from_cc(
r#" #pragma clang lifetime_elision
template <typename T>
struct MyStruct {
void MyMethod() {}
};
using MyIntAlias = MyStruct<int>;
using MyIntAlias = MyStruct<int>;
using MyIntAlias2 = MyStruct<int>;
using MyFloatAlias = MyStruct<float>;
"#,
)?;
// Verify that there is only 1 record for each specialization.
assert_eq!(1, ir.records().filter(|r| r.cc_name == "MyStruct<int>").count());
assert_eq!(1, ir.records().filter(|r| r.cc_name == "MyStruct<float>").count());
let functions = ir
.functions()
.filter(|f| f.name == UnqualifiedIdentifier::Identifier(ir_id("MyMethod")))
.collect_vec();
// Verify that there is only 1 function per instantiation.
assert_eq!(2, functions.len());
let rec_id1 = functions[0].member_func_metadata.as_ref().unwrap().record_id;
let rec_id2 = functions[1].member_func_metadata.as_ref().unwrap().record_id;
assert_ne!(rec_id1, rec_id2);
Ok(())
} | rust_cleaned_test_functions.jsonl/37173 | {
"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,
45233,
42111,
4219,
82,
2346,
33574,
8693,
368,
1464,
5714,
71698,
341,
262,
1077,
6216,
284,
6216,
5673,
28955,
1006,
286,
435,
55543,
671,
6015,
18260,
19031,
21602,
1816,
198,
310,
3811,
366,
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... | 2 |
#[test]
fn test_unconf_chan_via_funding_unconfirmed() {
do_test_unconf_chan(true, true, true, ConnectStyle::BestBlockFirstSkippingBlocks);
do_test_unconf_chan(false, true, true, ConnectStyle::BestBlockFirstSkippingBlocks);
do_test_unconf_chan(true, false, true, ConnectStyle::BestBlockFirstSkippingBlocks);
do_test_unconf_chan(false, false, true, ConnectStyle::BestBlockFirstSkippingBlocks);
do_test_unconf_chan(true, true, true, ConnectStyle::FullBlockViaListen);
do_test_unconf_chan(false, true, true, ConnectStyle::FullBlockViaListen);
do_test_unconf_chan(true, false, true, ConnectStyle::FullBlockViaListen);
do_test_unconf_chan(false, false, true, ConnectStyle::FullBlockViaListen);
} | rust_cleaned_test_functions.jsonl/97704 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 241
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
6135,
45552,
80710,
761,
37189,
4907,
41028,
368,
341,
19935,
4452,
4907,
6135,
45552,
3715,
11,
830,
11,
830,
11,
13015,
2323,
486,
14470,
4713,
5338,
85945,
29804,
317,
19935,
4452,
4907,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_inv_p_layer() {
let state = 0b1111111111111111000000000000000011111111111111110000000000000000u64;
let new_state = inv_p_layer(state);
let expected = 0b1010101010101010101010101010101010101010101010101010101010101010u64;
assert_eq!(expected, new_state);
} | rust_cleaned_test_functions.jsonl/34947 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19996,
620,
12680,
368,
341,
286,
1077,
1584,
284,
220,
15,
65,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
16,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_type() {
let test_cases = vec![
(r#"{"a": "b"}"#, JSON_TYPE_OBJECT),
(r#"["a", "b"]"#, JSON_TYPE_ARRAY),
("-5", JSON_TYPE_INTEGER),
("5", JSON_TYPE_UNSIGNED_INTEGER),
("18446744073709551615", JSON_TYPE_UNSIGNED_INTEGER),
("5.6", JSON_TYPE_DOUBLE),
(r#""hello, world""#, JSON_TYPE_STRING),
("true", JSON_TYPE_BOOLEAN),
("null", JSON_TYPE_NONE),
];
for (jstr, type_name) in test_cases {
let json: Json = jstr.parse().unwrap();
assert_eq!(json.json_type(), type_name);
}
} | rust_cleaned_test_functions.jsonl/70799 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 381
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1819,
368,
341,
286,
1077,
1273,
41427,
284,
7486,
90515,
310,
320,
81,
55543,
4913,
64,
788,
330,
65,
9207,
57676,
11,
4718,
4189,
13442,
1326,
310,
320,
81,
55543,
1183,
64,
497,
330,
65,
13... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_as_ref() {
let v: Point2<i32> = Point2::new(1, 2);
let v_ref: &[i32; 2] = v.as_ref();
assert_eq!(v_ref, &[1, 2]);
} | rust_cleaned_test_functions.jsonl/4544 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
7793,
368,
341,
286,
1077,
348,
25,
5126,
17,
21897,
18,
17,
29,
284,
5126,
17,
486,
931,
7,
16,
11,
220,
17,
317,
286,
1077,
348,
7793,
25,
44590,
72,
18,
17,
26,
220,
17,
60,
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_hover_non_ascii_space_doc() {
check(
"
/// <- `\u{3000}` here
fn foo() { }
fn bar() { fo<|>o(); }
",
expect![[r#"
*foo*
```rust
test
```
```rust
fn foo()
```
---
\<- ` ` here
"#]],
);
} | rust_cleaned_test_functions.jsonl/66130 | {
"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,
53445,
21637,
50238,
14663,
18869,
368,
341,
286,
1779,
1006,
310,
6228,
2575,
22441,
45342,
91405,
84,
90,
18,
15,
15,
15,
5541,
1588,
198,
8822,
15229,
368,
314,
555,
8822,
3619,
368,
314,
117... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_single_to_long() {
assert_less(Variant::from(1.0_f32), Variant::from(2_i64));
assert_equal(Variant::from(3.0_f32), Variant::from(3_i64));
assert_greater(Variant::from(5.0_f32), Variant::from(4_i64));
} | rust_cleaned_test_functions.jsonl/84514 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19487,
2346,
17799,
368,
341,
310,
2060,
50747,
12410,
15341,
486,
1499,
7,
16,
13,
15,
761,
18,
17,
701,
39292,
486,
1499,
7,
17,
5318,
21,
19,
1106,
310,
2060,
11478,
12410,
15341,
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_parse_length0() {
let buf = BytesMut::from(&[0b0000_0001u8, 0b0000_0000u8][..]);
let mut buf = PayloadBuffer::new(once(Ok(buf.freeze())));
let frame = extract(Frame::parse(&mut buf, false, 1024));
assert!(!frame.finished);
assert_eq!(frame.opcode, OpCode::Text);
assert!(frame.payload.is_empty());
} | rust_cleaned_test_functions.jsonl/55888 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 173
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
5118,
15,
368,
341,
286,
1077,
6607,
284,
30024,
51440,
486,
1499,
2099,
58,
15,
65,
15,
15,
15,
15,
62,
15,
15,
15,
16,
84,
23,
11,
220,
15,
65,
15,
15,
15,
15,
62,
15,
15,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_incompatible_reader_writer_pairs() {
let incompatible_schemas = vec![
// null
(Schema::Null, Schema::Int),
(Schema::Null, Schema::Long),
// boolean
(Schema::Boolean, Schema::Int),
// int
(Schema::Int, Schema::Null),
(Schema::Int, Schema::Boolean),
(Schema::Int, Schema::Long),
(Schema::Int, Schema::Float),
(Schema::Int, Schema::Double),
// long
(Schema::Long, Schema::Float),
(Schema::Long, Schema::Double),
// float
(Schema::Float, Schema::Double),
// string
(Schema::String, Schema::Boolean),
(Schema::String, Schema::Int),
// bytes
(Schema::Bytes, Schema::Null),
(Schema::Bytes, Schema::Int),
// array and maps
(int_array_schema(), long_array_schema()),
(int_map_schema(), int_array_schema()),
(int_array_schema(), int_map_schema()),
(int_map_schema(), long_map_schema()),
// enum
(enum1_ab_schema(), enum1_abc_schema()),
(enum1_bc_schema(), enum1_abc_schema()),
(enum1_ab_schema(), enum2_ab_schema()),
(Schema::Int, enum2_ab_schema()),
(enum2_ab_schema(), Schema::Int),
//union
(int_union_schema(), int_string_union_schema()),
(string_union_schema(), int_string_union_schema()),
//record
(empty_record2_schema(), empty_record1_schema()),
(a_int_record1_schema(), empty_record1_schema()),
(a_int_b_dint_record1_schema(), empty_record1_schema()),
(int_list_record_schema(), long_list_record_schema()),
(nested_record(), nested_optional_record()),
];
assert!(!incompatible_schemas
.iter()
.any(|(reader, writer)| SchemaCompatibility::can_read(writer, reader)));
} | rust_cleaned_test_functions.jsonl/21767 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
34842,
22306,
28908,
36430,
368,
341,
286,
1077,
52824,
643,
31126,
284,
7486,
90515,
310,
442,
845,
198,
310,
320,
8632,
486,
3280,
11,
12539,
486,
1072,
1326,
310,
320,
8632,
486,
3280,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dijkstra() {
use super::super::compact_star::compact_star_from_edge_vec;
let mut edges = vec![
(0,1,6.0,0.0),
(0,2,4.0,0.0),
(1,2,2.0,0.0),
(1,3,2.0,0.0),
(2,3,1.0,0.0),
(2,4,2.0,0.0),
(3,5,7.0,0.0),
(4,3,1.0,0.0),
(4,5,3.0,0.0)];
let compact_star = compact_star_from_edge_vec(6, &mut edges);
let (pred, dist) = dijkstra(&compact_star, 0, false);
assert_eq!(6, pred.len());
assert_eq!(6, dist.len());
assert_eq!(vec![6,0,0,2,2,4], pred);
assert_eq!(vec![0.0,6.0,4.0,5.0,6.0,9.0], dist);
} | rust_cleaned_test_functions.jsonl/82306 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 391
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
87177,
368,
341,
262,
990,
2256,
486,
9522,
486,
39760,
31681,
486,
39760,
31681,
5673,
17932,
13251,
280,
262,
1077,
5206,
12822,
284,
7486,
90515,
286,
320,
15,
11,
16,
11,
21,
13,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_chunked_wiki() {
async_std::task::block_on(async move {
let input = async_std::io::Cursor::new(
"4\r\n\
Wiki\r\n\
5\r\n\
pedia\r\n\
E\r\n in\r\n\
\r\n\
chunks.\r\n\
0\r\n\
\r\n"
.as_bytes(),
);
let (s, _r) = async_std::sync::channel(1);
let sender = Sender::new(s);
let mut decoder = ChunkedDecoder::new(input, sender);
let mut output = String::new();
decoder.read_to_string(&mut output).await.unwrap();
assert_eq!(
output,
"Wikipedia in\r\n\
\r\n\
chunks."
);
});
} | rust_cleaned_test_functions.jsonl/51853 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 585
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30539,
291,
1670,
7570,
368,
341,
286,
3312,
15656,
486,
8202,
486,
4574,
4470,
18285,
3271,
341,
310,
1077,
1946,
284,
3312,
15656,
486,
815,
486,
14543,
486,
931,
1006,
394,
330,
19,
12016,
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_invalid_finish_incomplete_entry() {
struct Foo;
impl Debug for Foo {
fn fmt(&self, fmt: &mut Formatter) {
fmt.debug_map().key(&"bar").finish()
}
}
debug3::pprint(Foo);
} | rust_cleaned_test_functions.jsonl/124757 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
42980,
1243,
14737,
9078,
368,
341,
286,
2036,
33428,
401,
286,
11605,
11091,
369,
33428,
341,
310,
5168,
8879,
2099,
721,
11,
8879,
25,
609,
6984,
81387,
8,
341,
394,
8879,
7883,
5376,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bpf_expanding_functions() {
// Compares the output of the BPF instruction generating functions to hardcoded
// instructions.
assert_eq!(
BPF_STMT(BPF_LD + BPF_W + BPF_ABS, 16),
sock_filter {
code: 0x20,
jt: 0,
jf: 0,
k: 16,
}
);
assert_eq!(
BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, 10, 2, 5),
sock_filter {
code: 0x15,
jt: 2,
jf: 5,
k: 10,
}
);
} | rust_cleaned_test_functions.jsonl/17479 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 411
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
15897,
14214,
25591,
31708,
368,
341,
286,
442,
13317,
5403,
279,
2550,
315,
279,
425,
19701,
7600,
23163,
5746,
311,
92959,
198,
286,
442,
11221,
624,
286,
2060,
10714,
33673,
310,
425,
1970... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_delimited_square() {
equal_tokens! {
<nodes>
"[abc]" -> b::token_list(vec![b::square(vec![b::bare("abc")])])
}
equal_tokens! {
<nodes>
"[ abc ]" -> b::token_list(vec![b::square(vec![b::ws(" "), b::bare("abc"), b::ws(" ")])])
}
equal_tokens! {
<nodes>
"[ abc def ]" -> b::token_list(vec![b::square(vec![b::ws(" "), b::bare("abc"), b::ws(" "), b::bare("def"), b::ws(" ")])])
}
equal_tokens! {
<nodes>
"[ abc def 123 456GB ]" -> b::token_list(vec![b::square(vec![
b::ws(" "), b::bare("abc"), b::ws(" "), b::bare("def"), b::ws(" "), b::int(123), b::ws(" "), b::bare("456GB"), b::ws(" ")
])])
}
} | rust_cleaned_test_functions.jsonl/7257 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 479
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18029,
31511,
39794,
368,
341,
286,
6144,
28838,
0,
341,
310,
366,
20008,
397,
310,
10545,
13683,
19177,
1464,
293,
486,
5839,
2019,
25592,
20703,
65,
486,
37476,
25592,
20703,
65,
486,
54102,
445... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_conditional_cut_with_partial() -> TestResult {
let p = Polar::new();
p.load_str(
r#"f(x) if x > 1 and (cut or x = 2) and x = 3;
g(1) if cut;
g(2);"#,
)?;
let mut q = p.new_query_from_term(term!(call!("f", [sym!("a")])), false);
assert_eq!(next_binding(&mut q)?[&sym!("a")], term!(3));
assert_query_done!(q);
let mut q = p.new_query_from_term(term!(call!("g", [sym!("a")])), false);
assert_eq!(next_binding(&mut q)?[&sym!("a")], term!(1));
assert_query_done!(q);
Ok(())
} | rust_cleaned_test_functions.jsonl/63038 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 343
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24433,
3005,
41317,
6615,
52068,
368,
1464,
3393,
2077,
341,
286,
1077,
281,
284,
55896,
486,
931,
543,
286,
281,
5104,
2895,
1006,
310,
435,
55543,
69,
2075,
8,
421,
856,
861,
220,
16,
323,
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... | 4 |
#[test]
fn test_index_record_with_invalid_line_width() {
let data = b">sq0\nACGT\nACGT \nACGT\nAC\n";
let mut indexer = Indexer::new(&data[..]);
assert!(matches!(
indexer.index_record(),
Err(IndexError::InvalidLineWidth(5, 6))
));
} | rust_cleaned_test_functions.jsonl/27393 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3560,
14192,
6615,
31433,
6528,
7927,
368,
341,
286,
1077,
821,
284,
293,
755,
28343,
15,
1699,
1706,
25388,
1699,
1706,
25388,
1124,
77,
1706,
25388,
1699,
1706,
1699,
876,
286,
1077,
5206,
87216... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_slow_lmd_ghost() {
test_yaml_vectors(
ForkChoiceAlgorithm::SlowLMDGhost,
"tests/lmd_ghost_test_vectors.yaml",
100,
);
} | rust_cleaned_test_functions.jsonl/13882 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 93
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82447,
907,
2277,
98784,
368,
341,
262,
1273,
64380,
49158,
1006,
286,
47850,
24728,
27847,
486,
58289,
43,
6076,
64686,
345,
286,
330,
23841,
13328,
2277,
98784,
4452,
49158,
33406,
756,
286,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_kamada_kawai() {
use petgraph::Graph;
let n = 10;
let mut graph = Graph::new_undirected();
let nodes = (0..n).map(|_| graph.add_node(())).collect::<Vec<_>>();
for i in 0..n {
for j in 0..i {
graph.add_edge(nodes[j], nodes[i], ());
}
}
let mut coordinates = Coordinates::initial_placement(&graph);
for &u in &nodes {
println!("{:?}", coordinates.position(u));
}
let kamada_kawai = KamadaKawai::new(&graph, &mut |_| 1.);
kamada_kawai.run(&mut coordinates);
for &u in &nodes {
println!("{:?}", coordinates.position(u));
}
} | rust_cleaned_test_functions.jsonl/90888 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 258
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4698,
309,
2584,
4698,
35969,
368,
341,
220,
990,
6753,
4439,
486,
11212,
401,
220,
1077,
308,
284,
220,
16,
15,
280,
220,
1077,
5206,
4771,
284,
12165,
486,
931,
62,
1241,
74612,
543,
220,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_jeq_opcode() {
let mut test_vm = VM::new();
test_vm.registers[1].content = 1; // dest register
test_vm.registers[2].content = 7; // bool source register
test_vm.registers[3].content = 1;
test_vm.registers[4].content = 2;
test_vm.program = vec![10, 3, 4, 0];
test_vm.run_once();
assert_eq!(test_vm.program_set_counter, 7);
test_vm.registers[1].content = 0;
test_vm.reset_program();
test_vm.run_once();
assert_eq!(test_vm.program_set_counter, 1);
} | rust_cleaned_test_functions.jsonl/60348 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 279
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
3756,
80,
71319,
368,
341,
286,
1077,
5206,
1273,
39008,
284,
17792,
486,
931,
543,
286,
1273,
39008,
7031,
9303,
58,
16,
936,
1796,
284,
220,
16,
26,
442,
3201,
4161,
198,
286,
1273,
3900... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_put_netif() {
let (mut sender, receiver) = UnixStream::pair().unwrap();
let mut connection = HttpConnection::new(receiver);
let body = "{ \
\"iface_id\": \"string\", \
\"guest_mac\": \"12:34:56:78:9a:BC\", \
\"host_dev_name\": \"string\", \
\"allow_mmds_requests\": true, \
\"rx_rate_limiter\": { \
\"bandwidth\": { \
\"size\": 0, \
\"one_time_burst\": 0, \
\"refill_time\": 0 \
}, \
\"ops\": { \
\"size\": 0, \
\"one_time_burst\": 0, \
\"refill_time\": 0 \
} \
}, \
\"tx_rate_limiter\": { \
\"bandwidth\": { \
\"size\": 0, \
\"one_time_burst\": 0, \
\"refill_time\": 0 \
}, \
\"ops\": { \
\"size\": 0, \
\"one_time_burst\": 0, \
\"refill_time\": 0 \
} \
} \
}";
sender
.write_all(http_request("PUT", "/network-interfaces/string", Some(&body)).as_bytes())
.unwrap();
assert!(connection.try_read().is_ok());
let req = connection.pop_parsed_request().unwrap();
assert!(ParsedRequest::try_from_request(&req).is_ok());
} | rust_cleaned_test_functions.jsonl/106585 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 902
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
5673,
15557,
19722,
333,
368,
341,
286,
1077,
320,
6984,
4646,
11,
13964,
8,
284,
46995,
3027,
486,
12670,
1005,
15454,
543,
286,
1077,
5206,
3633,
284,
4823,
4526,
486,
931,
78126,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_note() {
let glifxml = r#"<?xml version="1.0" encoding="UTF-8"?>
<glyph name="note" format="2">
<advance width="0" />
<unicode hex="00" />
<note>Hello world!</note>
<outline />
<!-- <MFEK></MFEK> -->
</glyph>"#;
let glif: glifparser::Glif<()> = glifparser::glif::read(glifxml).unwrap();
assert_eq!(glif.note, Some("Hello world!".to_string()));
assert_eq!(glif.unicode[0], 0 as char);
let newxml = glifparser::glif::write(&glif).unwrap();
let newglif: glifparser::Glif<()> = glifparser::glif::read(&newxml).unwrap();
assert_eq!(newglif.note, Some("Hello world!".to_string()));
assert_eq!(newglif.unicode[0], 0 as char);
} | rust_cleaned_test_functions.jsonl/50331 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 298
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27207,
368,
341,
262,
1077,
2770,
333,
6455,
284,
435,
55543,
1316,
6455,
2319,
428,
16,
13,
15,
1,
11170,
428,
8561,
12,
23,
85990,
27,
65481,
829,
428,
9974,
1,
3561,
428,
17,
881,
220,
36... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_non_option() {
let oup = exec_target(TARGET_EXE_PATH, &[""]);
assert_eq!(
oup.stderr,
concat!(
program_name!(),
": ",
"Missing option: h or t\n",
"Unexpected argument: \n",
try_help_msg!()
)
);
assert_eq!(oup.stdout, "");
assert_eq!(oup.status.success(), false);
} | rust_cleaned_test_functions.jsonl/67522 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 276
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21637,
9672,
368,
341,
286,
1077,
5908,
79,
284,
3883,
11123,
4140,
16474,
4966,
36,
7944,
11,
609,
1183,
15049,
286,
2060,
10714,
33673,
310,
5908,
79,
34742,
345,
310,
33720,
33673,
394,
2025,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_set_tokenizer_manager() {
let mut schema_builder = Schema::builder();
schema_builder.add_u64_field("num_likes", INDEXED);
schema_builder.add_text_field("body", TEXT);
let schema = schema_builder.build();
let index = IndexBuilder::new()
// set empty tokenizer manager
.tokenizers(TokenizerManager::new())
.schema(schema)
.create_in_ram()
.unwrap();
assert!(index.tokenizers().get("raw").is_none());
} | rust_cleaned_test_functions.jsonl/103669 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 247
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
6458,
3135,
12144,
368,
341,
286,
1077,
5206,
10802,
28532,
284,
12539,
486,
17850,
543,
286,
10802,
28532,
1364,
7300,
21,
19,
5013,
445,
2413,
89178,
497,
39300,
1479,
317,
286,
10802,
285... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_minimal_qualification() -> Result<(), anyhow::Error> {
struct TestCase {
input: FullName,
system_output: PartialName,
normal_output: PartialName,
}
let test_cases = vec![
TestCase {
input: FullName {
database: DatabaseSpecifier::Ambient,
schema: PG_CATALOG_SCHEMA.to_string(),
item: "numeric".to_string(),
},
system_output: PartialName {
database: None,
schema: Some(PG_CATALOG_SCHEMA.to_string()),
item: "numeric".to_string(),
},
normal_output: PartialName {
database: None,
schema: None,
item: "numeric".to_string(),
},
},
TestCase {
input: FullName {
database: DatabaseSpecifier::Ambient,
schema: MZ_CATALOG_SCHEMA.to_string(),
item: "mz_array_types".to_string(),
},
system_output: PartialName {
database: None,
schema: Some(MZ_CATALOG_SCHEMA.to_string()),
item: "mz_array_types".to_string(),
},
normal_output: PartialName {
database: None,
schema: None,
item: "mz_array_types".to_string(),
},
},
];
let catalog_file = NamedTempFile::new()?;
let catalog = Catalog::open_debug(catalog_file.path())?;
for tc in test_cases {
assert_eq!(
catalog
.for_system_session()
.minimal_qualification(&tc.input),
tc.system_output
);
assert_eq!(
catalog
.for_session(&Session::dummy())
.minimal_qualification(&tc.input),
tc.normal_output
);
}
Ok(())
} | rust_cleaned_test_functions.jsonl/23697 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1315
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7260,
2861,
64391,
2404,
368,
1464,
5714,
68843,
88964,
486,
1454,
29,
341,
286,
2036,
30573,
341,
310,
1946,
25,
97147,
345,
310,
1849,
7645,
25,
24552,
675,
345,
310,
4622,
7645,
25,
24552,
67... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.