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_extend_no_overlap() {
let mut my_tera = Tera::default();
my_tera
.add_raw_templates(vec![
("one", "{% block hey %}1{% endblock hey %}"),
("two", "{% block hey %}2{% endblock hey %}"),
("three", "{% block hey %}3{% endblock hey %}"),
])
.unwrap();
let mut framework_tera = Tera::default();
framework_tera.add_raw_templates(vec![("four", "Framework X")]).unwrap();
my_tera.extend(&framework_tera).unwrap();
assert_eq!(my_tera.templates.len(), 4);
let result = my_tera.render("four", &Context::default()).unwrap();
assert_eq!(result, "Framework X");
} | rust_cleaned_test_functions.jsonl/87552 | {
"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,
70265,
6536,
65794,
368,
341,
286,
1077,
5206,
847,
62,
50037,
284,
350,
2416,
486,
2258,
543,
286,
847,
62,
50037,
198,
310,
659,
718,
16067,
49526,
25592,
90515,
394,
3489,
603,
497,
13868,
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_serialize_fail_header_too_short() {
let mut buf = [0u8; 7];
let mut buf = [&mut buf[..]];
let buf = FragmentedBytesMut::new(&mut buf[..]);
let (head, body, foot) = buf.try_split_contiguous(..).unwrap();
let mut buffer = SerializeBuffer::new(head, body, foot);
let builder =
UdpPacketBuilder::new(TEST_SRC_IPV4, TEST_DST_IPV4, None, NonZeroU16::new(1).unwrap());
builder.serialize(&mut buffer);
} | rust_cleaned_test_functions.jsonl/112491 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 227
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
22121,
8757,
2346,
78,
16673,
368,
341,
286,
1077,
5206,
6607,
284,
508,
15,
84,
23,
26,
220,
22,
935,
286,
1077,
5206,
6607,
284,
34336,
6984,
6607,
95874,
13204,
286,
1077,
6607,
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_from_into_public_key_credential_descriptor() {
let cbor_credential_descriptor = cbor_map! {
"type" => "public-key",
"id" => vec![0x2D, 0x2D, 0x2D, 0x2D],
"transports" => cbor_array!["usb"],
};
let credential_descriptor =
PublicKeyCredentialDescriptor::try_from(cbor_credential_descriptor.clone());
let expected_credential_descriptor = PublicKeyCredentialDescriptor {
key_type: PublicKeyCredentialType::PublicKey,
key_id: vec![0x2D, 0x2D, 0x2D, 0x2D],
transports: Some(vec![AuthenticatorTransport::Usb]),
};
assert_eq!(credential_descriptor, Ok(expected_credential_descriptor));
let created_cbor: cbor::Value = credential_descriptor.unwrap().into();
assert_eq!(created_cbor, cbor_credential_descriptor);
} | rust_cleaned_test_functions.jsonl/49007 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 430
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
45514,
27074,
3097,
666,
30320,
33774,
368,
341,
286,
1077,
272,
9368,
666,
30320,
33774,
284,
272,
9368,
5376,
0,
341,
310,
330,
1313,
1,
589,
330,
888,
16173,
756,
310,
330,
307,
1,
58... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ac_matching() {
let dict = vec!["banana", "benefit", "banapple", "ban", "fit"];
let text = "banana bans, apple benefits.";
let matcher = MultiMatcher::new(dict.iter().map(|s| s.bytes()));
let match_nodes = matcher.ac_match(text.bytes());
let end_pos_and_id = matcher.get_end_pos_and_pat_id(&match_nodes);
assert_eq!(
end_pos_and_id,
vec![(3, 3), (6, 0), (10, 3), (26, 1), (26, 4)]
);
} | rust_cleaned_test_functions.jsonl/115512 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14718,
70763,
368,
341,
286,
1077,
6451,
284,
7486,
0,
1183,
87747,
497,
330,
67144,
275,
497,
330,
6850,
22377,
497,
330,
6850,
497,
330,
6276,
6332,
286,
1077,
1467,
284,
330,
87747,
47509,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extract_session_metrics_errored() {
let update1 = SessionUpdate::parse(
r#"{
"init": true,
"started": "2021-04-26T08:00:00+0100",
"attrs": {
"release": "1.0.0"
},
"did": "user123",
"status": "errored"
}"#
.as_bytes(),
)
.unwrap();
let mut update2 = update1.clone();
update2.init = false;
let mut update3 = update2.clone();
update3.status = SessionStatus::Ok;
update3.errors = 123;
for (update, expected_metrics) in vec![
(update1, 4),
(update2, 2),
(update3, 2),
] {
let mut metrics = vec![];
extract_session_metrics(&update, &mut metrics);
assert_eq!(metrics.len(), expected_metrics);
let session_metric = &metrics[expected_metrics - 2];
assert_eq!(session_metric.name, "session.error");
assert!(matches!(session_metric.value, MetricValue::Set(_)));
assert_eq!(session_metric.tags.len(), 1); // Only the release tag
let user_metric = &metrics[expected_metrics - 1];
assert_eq!(user_metric.name, "user");
assert!(matches!(user_metric.value, MetricValue::Set(_)));
assert_eq!(user_metric.tags["session.status"], "errored");
assert_eq!(user_metric.tags["release"], "1.0.0");
}
} | rust_cleaned_test_functions.jsonl/82043 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 818
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
12316,
37686,
62,
40296,
1151,
368,
341,
286,
1077,
2647,
16,
284,
9164,
4289,
486,
6400,
1006,
310,
435,
55543,
515,
394,
330,
2327,
788,
830,
345,
394,
330,
46723,
788,
330,
17,
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... | 2 |
#[test]
fn test_time_to_sec() {
let cases: Vec<(&str, i8, i64)> = vec![
("31 11:30:45", 0, 2719845),
("11:30:45.123345", 3, 41445),
("-11:30:45.1233456", 0, -41445),
("272:59:59.14", 0, 982799),
];
for (arg, fsp, s) in cases {
let duration = Some(Duration::parse(&mut EvalContext::default(), arg, fsp).unwrap());
let output = RpnFnScalarEvaluator::new()
.push_param(duration)
.evaluate::<Int>(ScalarFuncSig::TimeToSec)
.unwrap();
assert_eq!(output, Some(s));
}
// test NULL case
let output = RpnFnScalarEvaluator::new()
.push_param(None::<Duration>)
.evaluate::<Int>(ScalarFuncSig::TimeToSec)
.unwrap();
assert_eq!(output, None);
} | rust_cleaned_test_functions.jsonl/36253 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 488
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3009,
2346,
17242,
368,
341,
286,
1077,
5048,
25,
11312,
27,
2099,
495,
11,
600,
23,
11,
600,
21,
19,
16018,
284,
7486,
90515,
310,
3489,
18,
16,
220,
16,
16,
25,
18,
15,
25,
19,
20,
497,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_parse_css_color_1() {
assert_eq!(parse_css_color("#F0F8FF"), Ok(ColorU { r: 240, g: 248, b: 255, a: 255 }));
} | rust_cleaned_test_functions.jsonl/37096 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 76
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
25924,
6714,
62,
16,
368,
341,
286,
2060,
10714,
10297,
6400,
25924,
6714,
3584,
37,
15,
37,
23,
1748,
3975,
7622,
15028,
52,
314,
435,
25,
220,
17,
19,
15,
11,
342,
25,
220,
17,
19,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_insert_no_ancestors() {
let key = Keypair::new();
let index = AccountsIndex::<bool>::default_for_tests();
let mut gc = Vec::new();
index.upsert(
0,
&key.pubkey(),
&Pubkey::default(),
&[],
&AccountSecondaryIndexes::default(),
true,
&mut gc,
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
);
assert!(gc.is_empty());
let ancestors = Ancestors::default();
assert!(index.get(&key.pubkey(), Some(&ancestors), None).is_none());
assert!(index.get(&key.pubkey(), None, None).is_none());
let mut num = 0;
index.unchecked_scan_accounts(
"",
&ancestors,
|_pubkey, _index| num += 1,
COLLECT_ALL_UNSORTED_FALSE,
);
assert_eq!(num, 0);
} | rust_cleaned_test_functions.jsonl/99716 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 490
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
6536,
62,
681,
267,
1087,
368,
341,
286,
1077,
1376,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
1922,
284,
40655,
1552,
27638,
2641,
6831,
2258,
5478,
32509,
543,
286,
1077,
5206,
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_extra_headers() {
let mut bytes = BytesMut::with_capacity(2048);
let mut head = RequestHead::default();
head.headers.insert(AUTHORIZATION, HeaderValue::from_static("some authorization"));
let mut extra_headers = HeaderMap::new();
extra_headers.insert(AUTHORIZATION,HeaderValue::from_static("another authorization"));
extra_headers.insert(DATE, HeaderValue::from_static("date"));
let mut head = RequestHeadType::Rc(Rc::new(head), Some(extra_headers));
let _ = head.encode_headers(
&mut bytes,
Version::HTTP_11,
BodySize::Empty,
ConnectionType::Close,
&ServiceConfig::default(),
);
assert_eq!(
bytes.take().freeze(),
Bytes::from_static(b"\r\ncontent-length: 0\r\nconnection: close\r\nauthorization: another authorization\r\ndate: date\r\n\r\n")
);
} | rust_cleaned_test_functions.jsonl/88090 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 420
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31858,
26719,
368,
341,
286,
1077,
5206,
5820,
284,
30024,
51440,
486,
4197,
35603,
7,
17,
15,
19,
23,
626,
286,
1077,
5206,
1968,
284,
6145,
12346,
486,
2258,
543,
286,
1968,
18022,
7030,
4346,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_encode_tokens() -> Result<(), io::Error> {
// Given
let mut vocab_file = tempfile::NamedTempFile::new()?;
write!(vocab_file, "{{\"hello\": 1,\n \"world\": 0,\n \"<unk>\": 2,\n \"!\": 3\n}}")?;
let path = vocab_file.into_temp_path();
let openai_gpt_vocab = OpenAiGptVocab::from_file(path.to_path_buf().to_str().unwrap());
assert_eq!(openai_gpt_vocab.token_to_id("hello"), 1);
assert_eq!(openai_gpt_vocab.token_to_id("world"), 0);
assert_eq!(openai_gpt_vocab.token_to_id("!"), 3);
assert_eq!(openai_gpt_vocab.token_to_id("<unk>"), 2);
assert_eq!(openai_gpt_vocab.token_to_id("oov_value"), 2);
drop(path);
Ok(())
} | rust_cleaned_test_functions.jsonl/25061 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 380
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
28838,
368,
1464,
5714,
68843,
6399,
486,
1454,
29,
341,
322,
286,
16246,
198,
286,
1077,
5206,
23820,
2458,
284,
54819,
486,
15810,
12151,
1703,
486,
931,
94136,
286,
3270,
10297,
86847,
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... | 3 |
#[test]
fn test_tap_name() {
// Sanity check that the assumed max iface name length is correct.
assert_eq!(
IFACE_NAME_MAX_LEN,
net_gen::ifreq__bindgen_ty_1::default()
.bindgen_union_field
.len()
);
// Empty name - The tap should be named "tap0" by default
let tap = Tap::open_named("").unwrap();
assert_eq!(b"tap0\0\0\0\0\0\0\0\0\0\0\0\0", &tap.if_name);
assert_eq!("tap0", tap.if_name_as_str());
// 16 characters - too long.
let name = "a123456789abcdef";
match Tap::open_named(name) {
Err(Error::InvalidIfname) => (),
_ => panic!("Expected Error::InvalidIfname"),
};
// 15 characters - OK.
let name = "a123456789abcde";
let tap = Tap::open_named(name).unwrap();
assert_eq!(&format!("{}\0", name).as_bytes(), &tap.if_name);
assert_eq!(name, tap.if_name_as_str());
} | rust_cleaned_test_functions.jsonl/8899 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 503
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
391,
1269,
368,
341,
286,
442,
96302,
1779,
429,
279,
19110,
1932,
49313,
829,
3084,
374,
4396,
624,
286,
2060,
10714,
33673,
310,
11551,
5576,
4708,
6806,
15536,
345,
310,
4179,
16322,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_raft_nodes() {
let l = default_logger();
let mut tests = vec![
(vec![1, 2, 3], vec![1, 2, 3]),
(vec![3, 2, 1], vec![1, 2, 3]),
];
for (i, (ids, wids)) in tests.drain(..).enumerate() {
let r = new_test_raft(1, ids, 10, 1, new_storage(), &l);
let voter_ids = r.prs().voter_ids();
let wids = wids.into_iter().collect::<HashSet<_>>();
if voter_ids != wids {
panic!("#{}: nodes = {:?}, want {:?}", i, voter_ids, wids);
}
}
} | rust_cleaned_test_functions.jsonl/30312 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 282
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
2944,
14896,
368,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
1077,
5206,
7032,
284,
7486,
90515,
286,
320,
4083,
20703,
16,
11,
220,
17,
11,
220,
18,
1125,
7486,
20703,
16,
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... | 3 |
#[test]
fn test_ptr_chains() {
let mut variable_pointers = vk::PhysicalDeviceVariablePointerFeatures::builder();
let mut corner = vk::PhysicalDeviceCornerSampledImageFeaturesNV::builder();
let chain = vec![
&variable_pointers as *const _ as usize,
&corner as *const _ as usize,
];
let mut device_create_info = vk::DeviceCreateInfo::builder()
.push_next(&mut corner)
.push_next(&mut variable_pointers);
let chain2: Vec<usize> = unsafe {
vk::ptr_chain_iter(&mut device_create_info)
.skip(1)
.map(|ptr| ptr as usize)
.collect()
};
assert_eq!(chain, chain2);
} | rust_cleaned_test_functions.jsonl/132845 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 356
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4348,
4138,
1735,
368,
341,
286,
1077,
5206,
3890,
6085,
388,
284,
34283,
486,
39253,
6985,
7827,
9084,
21336,
486,
17850,
543,
286,
1077,
5206,
9131,
284,
34283,
486,
39253,
6985,
50352,
17571,
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_print_custom_type() -> Result<(), Box<EvalAltResult>> {
let mut engine = Engine::new();
engine
.register_type_with_name::<MyStruct>("MyStruct")
.register_fn("to_debug", |x: &mut MyStruct| x.to_string())
.register_fn("debug", |x: &mut MyStruct| x.to_string())
.register_fn("new_ts", || MyStruct { field: 42 });
engine.consume("let x = new_ts(); debug(x);")?;
#[cfg(not(feature = "no_index"))]
assert_eq!(
engine.eval::<String>(
r#"
let x = [ 123, true, null, "world", new_ts() ];
x.to_string()
"#
)?,
r#"[123, true, null, "world", hello: 42]"#
);
assert!(engine
.eval::<String>(
r#"
let x = #{ a:123, b:true, c:null, d:"world", e:new_ts() };
x.to_string()
"#
)?
.contains(r#""e": hello: 42"#));
Ok(())
} | rust_cleaned_test_functions.jsonl/94250 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 506
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10064,
15875,
1819,
368,
1464,
5714,
68843,
8261,
23835,
831,
26017,
2077,
2452,
341,
262,
1077,
5206,
4712,
284,
8200,
486,
931,
1428,
262,
4712,
198,
286,
659,
6343,
1819,
6615,
1269,
27638,
505... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_builder_dupe_field_and_timestamp() {
let res = SchemaBuilder::new().tag("time").timestamp().build();
assert_eq!(
res.unwrap_err().to_string(),
"Error validating schema: Error: Duplicate column name found in schema: 'time'"
);
} | rust_cleaned_test_functions.jsonl/12639 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28532,
814,
85477,
5013,
8378,
23073,
368,
341,
286,
1077,
592,
284,
12539,
3297,
486,
931,
1005,
4578,
445,
1678,
1827,
13035,
1005,
5834,
1428,
286,
2060,
10714,
33673,
310,
592,
55395,
9266,
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_request_method() {
let builder = PlainNotificationBuilder::new("test");
let payload = builder.build("a_test_id", Default::default());
let client = Client::new(AlpnConnector::new(), None, Endpoint::Production);
let request = client.build_request(payload);
assert_eq!(&Method::POST, request.method());
} | rust_cleaned_test_functions.jsonl/109644 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7893,
9032,
368,
341,
286,
1077,
7363,
284,
43199,
11196,
3297,
486,
931,
445,
1944,
797,
286,
1077,
7729,
284,
7363,
13239,
445,
64,
4452,
842,
497,
7899,
486,
2258,
1423,
286,
1077,
2943,
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_net_is_connected() {
let mut net = Network::<usize>::new();
// Insert n nodes:
for v in 0 .. 5 {
net.add_node(v);
}
net.igraph.add_edge(0,1,1);
net.igraph.add_edge(1,2,2);
net.igraph.add_edge(2,4,3);
assert!(!net.is_connected());
net.igraph.add_edge(2,3,1);
assert!(net.is_connected());
} | rust_cleaned_test_functions.jsonl/47200 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 227
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19722,
6892,
43276,
368,
341,
286,
1077,
5206,
4179,
284,
8141,
27638,
51878,
6831,
931,
1428,
286,
442,
17101,
308,
7798,
510,
286,
369,
348,
304,
220,
15,
5241,
220,
20,
341,
310,
4179,
1364,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_from_hex() {
assert_eq!(from_hex("00000000".to_string()).unwrap(), vec![0, 0, 0, 0]);
assert_eq!(
from_hex("0a0b0c0d".to_string()).unwrap(),
vec![10, 11, 12, 13]
);
assert_eq!(
from_hex("000000ff".to_string()).unwrap(),
vec![0, 0, 0, 255]
);
} | rust_cleaned_test_functions.jsonl/5827 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
32655,
368,
341,
197,
6948,
10714,
10297,
1499,
32655,
445,
15,
15,
15,
15,
15,
15,
15,
15,
3263,
983,
3904,
6011,
15454,
1507,
7486,
20703,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_complete_to_cef() {
let v1 = Top::V1(
"ClassId234".to_owned(),
NameInheritorStruct {
name_struct: NameStruct {
name: "Test2".to_owned(),
},
name_struct2: Some(NameStruct {
name: "Test1".to_owned(),
}),
address: Some("Address".to_owned()),
age: 87,
},
24,
OffsetDateTime::from_unix_timestamp_nanos(735027350723000000),
);
assert_eq!(
v1.to_cef().unwrap(),
"CEF:1|polyverse|zerotect|V1|ClassId234|NameInheritorStruct::NameStruct::Test2|24|EnumV1Field=fixedExtensionsValue TopEnumField=fixedExtensionsValue TopStructField=fixedExtensionsValue address=Address name2=NameStruct::Test2 newname=Test1 person_age=87 rt=735027350723 top_name=ClassId234"
);
let v2 = Top::V2 {
event_class: "ClassId234",
name_impl: NameInheritorStruct {
name_struct: NameStruct {
name: "Test2".to_owned(),
},
name_struct2: Some(NameStruct {
name: "Test1".to_owned(),
}),
address: Some("Address2".to_owned()),
age: 78,
},
severity: 85,
unused: 20,
timestamp: OffsetDateTime::from_unix_timestamp_nanos(326262362000000),
};
assert_eq!(
v2.to_cef().unwrap(),
"CEF:1|polyverse|zerotect|V2|ClassId234|Test2|85|EnumV2Field=fixedExtensionsValue EventClassNewName=ClassId234 TopEnumField=fixedExtensionsValue TopStructField=fixedExtensionsValue address=Address2 name2=NameStruct::Test2 newname=Test1 person_age=78 rt=326262362 severity=85"
);
let v2 = Top::V2 {
event_class: "ClassId234",
name_impl: NameInheritorStruct {
name_struct: NameStruct {
name: "Test2".to_owned(),
},
name_struct2: Some(NameStruct {
name: "Test1".to_owned(),
}),
address: None,
age: 78,
},
severity: 85,
unused: 20,
timestamp: OffsetDateTime::from_unix_timestamp_nanos(9893486324000000),
};
assert_eq!(
v2.to_cef().unwrap(),
"CEF:1|polyverse|zerotect|V2|ClassId234|Test2|85|EnumV2Field=fixedExtensionsValue EventClassNewName=ClassId234 TopEnumField=fixedExtensionsValue TopStructField=fixedExtensionsValue name2=NameStruct::Test2 newname=Test1 person_age=78 rt=9893486324 severity=85"
);
} | rust_cleaned_test_functions.jsonl/3455 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1235
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27675,
2346,
50727,
69,
368,
341,
262,
1077,
348,
16,
284,
6909,
486,
53,
16,
1006,
286,
330,
1957,
764,
17,
18,
19,
3263,
983,
51973,
3148,
286,
3988,
641,
1923,
1919,
9422,
341,
310,
829,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sending_router_advertisement() {
// Test that valid router advertisements are sent based on the device's
let mut stack_builder = StackStateBuilder::default();
let mut ndp_configs = NdpConfigurations::default();
ndp_configs.set_dup_addr_detect_transmits(None);
ndp_configs.set_max_router_solicitations(None);
stack_builder.device_builder().set_default_ndp_configs(ndp_configs);
stack_builder.ipv6_builder().forward(true);
let mut ctx = Context::new(stack_builder.build(), DummyEventDispatcher::default());
let device =
ctx.state_mut().add_ethernet_device(TEST_LOCAL_MAC, Ipv6::MINIMUM_LINK_MTU.into());
crate::device::initialize_device(&mut ctx, device);
// Make `device` a router (netstack is configured to forward packets
crate::device::set_routing_enabled::<_, Ipv6>(&mut ctx, device, true);
// Enable and send router advertisements.
StateContext::<NdpState<EthernetLinkDevice, DummyInstant>, _>::get_state_mut_with(
&mut ctx,
device.id().into(),
)
.configs
.router_configurations
.set_should_send_advertisements(true);
send_router_advertisement::<EthernetLinkDevice, _>(
&mut ctx,
device.id().into(),
Ipv6::ALL_NODES_LINK_LOCAL_MULTICAST_ADDRESS.into_specified(),
);
assert_eq!(ctx.dispatcher().frames_sent().len(), 1);
let (_, _, src_ip, dst_ip, _, message, code) =
parse_icmp_packet_in_ip_packet_in_ethernet_frame::<Ipv6, _, RouterAdvertisement, _>(
&ctx.dispatcher().frames_sent()[0].1,
|p| {
assert_eq!(p.body().iter().count(), 1);
assert!(p
.body()
.iter()
.any(|x| x == NdpOption::SourceLinkLayerAddress(&TEST_LOCAL_MAC.bytes())));
},
)
.unwrap();
assert_eq!(src_ip, TEST_LOCAL_MAC.to_ipv6_link_local().addr().get());
assert_eq!(dst_ip, Ipv6::ALL_NODES_LINK_LOCAL_MULTICAST_ADDRESS.get());
assert_eq!(code, IcmpUnusedCode);
assert_eq!(message, RouterAdvertisement::new(64, false, false, 1800, 0, 0));
// Set new values for a new router advertisement.
let router_configs =
&mut StateContext::<NdpState<EthernetLinkDevice, DummyInstant>, _>::get_state_mut_with(
&mut ctx,
device.id().into(),
)
.configs
.router_configurations;
router_configs.set_advertised_managed_flag(true);
router_configs.set_advertised_link_mtu(NonZeroU32::new(1500));
router_configs.set_advertised_reachable_time(50);
router_configs.set_advertised_retransmit_timer(200);
router_configs.set_advertised_current_hop_limit(75);
router_configs.set_advertised_default_lifetime(NonZeroU16::new(2000));
let prefix1 = PrefixInformation::new(
64,
true,
false,
500,
400,
Ipv6Addr::new([51, 52, 53, 54, 55, 56, 57, 58, 0, 0, 0, 0, 0, 0, 0, 0]),
);
let prefix2 = PrefixInformation::new(
70,
false,
true,
501,
401,
Ipv6Addr::new([51, 52, 53, 54, 55, 56, 57, 59, 0, 0, 0, 0, 0, 0, 0, 0]),
);
router_configs.set_advertised_prefix_list(vec![prefix1.clone(), prefix2.clone()]);
send_router_advertisement::<EthernetLinkDevice, _>(
&mut ctx,
device.id().into(),
Ipv6::ALL_NODES_LINK_LOCAL_MULTICAST_ADDRESS.into_specified(),
);
assert_eq!(ctx.dispatcher().frames_sent().len(), 2);
let (_, _, src_ip, dst_ip, _, message, code) =
parse_icmp_packet_in_ip_packet_in_ethernet_frame::<Ipv6, _, RouterAdvertisement, _>(
&ctx.dispatcher().frames_sent()[1].1,
|p| {
assert_eq!(p.body().iter().count(), 4);
let mtu = 1500;
assert!(p.body().iter().any(|x| x == NdpOption::Mtu(mtu)));
assert!(p.body().iter().any(|x| x == NdpOption::PrefixInformation(&prefix1)));
assert!(p.body().iter().any(|x| x == NdpOption::PrefixInformation(&prefix2)));
assert!(p
.body()
.iter()
.any(|x| x == NdpOption::SourceLinkLayerAddress(&TEST_LOCAL_MAC.bytes())));
},
)
.unwrap();
assert_eq!(src_ip, TEST_LOCAL_MAC.to_ipv6_link_local().addr().get());
assert_eq!(dst_ip, Ipv6::ALL_NODES_LINK_LOCAL_MULTICAST_ADDRESS.get());
assert_eq!(code, IcmpUnusedCode);
assert_eq!(message, RouterAdvertisement::new(75, true, false, 2000, 50, 200));
} | rust_cleaned_test_functions.jsonl/82817 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2601
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
2459,
55587,
10027,
44424,
368,
341,
286,
442,
3393,
429,
2697,
9273,
42649,
525,
3208,
3118,
389,
279,
3671,
594,
198,
23459,
286,
1077,
5206,
5611,
28532,
284,
14284,
1397,
3297,
486,
2258,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_key_manager_key_dict_missing() {
// create initial dictionaries.
let _guard = LOCK_FOR_GAUGE.lock().unwrap();
let tmp_dir = tempfile::TempDir::new().unwrap();
let manager = new_key_manager_def(&tmp_dir, None).unwrap();
manager.new_file("foo").unwrap();
drop(manager);
remove_file(tmp_dir.path().join(KEY_DICT_NAME)).unwrap();
let manager = new_key_manager_def(&tmp_dir, None);
assert!(manager.is_err());
} | rust_cleaned_test_functions.jsonl/22015 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3097,
12144,
3097,
5243,
40447,
368,
341,
286,
442,
1855,
2856,
57514,
624,
286,
1077,
716,
26098,
284,
49463,
14516,
2646,
32,
47644,
21003,
1005,
15454,
543,
286,
1077,
4174,
4334,
284,
54819,
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_hash_blake2b() {
let hasher = Hash::Blake2b;
let result = hasher.hash_bytes(&vec![1, 2, 3]);
let expected = concat!(
"cf94f6d605657e90c543b0c919070cdaaf7209c5e1ea58acb8f3568fa2114268",
"dc9ac3bafe12af277d286fce7dc59b7c0c348973c4e9dacbe79485e56ac2a702"
);
assert_eq!(result.len(), 64);
assert_eq!(hex::encode(&result), expected);
} | rust_cleaned_test_functions.jsonl/101707 | {
"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,
8950,
13141,
726,
17,
65,
368,
341,
286,
1077,
90819,
284,
6531,
486,
91038,
17,
65,
280,
286,
1077,
1102,
284,
90819,
15101,
12524,
2099,
4083,
20703,
16,
11,
220,
17,
11,
220,
18,
2558,
286,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_regex_subcapturespos() {
let regex = Regex::new("e(l+)").unwrap();
let captures = regex.captures("hello").unwrap();
let caps = captures.iter_pos().collect::<Vec<_>>();
assert_eq!(caps[0], Some((1, 4)));
assert_eq!(caps[1], Some((2, 4)));
assert_eq!(caps.len(), 2);
} | rust_cleaned_test_functions.jsonl/123804 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 166
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41832,
5228,
66326,
966,
368,
341,
286,
1077,
20180,
284,
26146,
486,
931,
445,
68,
2333,
36197,
1827,
15454,
543,
286,
1077,
40155,
284,
20180,
520,
2689,
1413,
445,
14990,
1827,
15454,
543,
286,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_custom_charset_id_for_glyph_format0() {
let glyph_sids = ReadArrayCow::Owned(vec![1, 2, 3]);
let charset = CustomCharset::Format0 { glyphs: glyph_sids };
// glpyh id 0 is .notdef and is implicitly encoded
assert_eq!(charset.id_for_glyph(0), Some(0));
assert_eq!(charset.id_for_glyph(1), Some(1));
assert_eq!(charset.id_for_glyph(4), None);
} | rust_cleaned_test_functions.jsonl/85346 | {
"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,
15875,
65883,
842,
5478,
88703,
8955,
15,
368,
341,
286,
1077,
32150,
643,
3365,
284,
4457,
1857,
89915,
486,
57641,
25592,
20703,
16,
11,
220,
17,
11,
220,
18,
2558,
286,
1077,
11617,
284,
8406... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_attribute_stack_map_table() {
let stack_map_class: &[u8] = include_bytes!("../java-assets/compiled-classes/Factorial.class");
let res = class_parser(ParseData::new(stack_map_class));
match res {
Result::Ok((_, c)) => {
use classfile_parser::attribute_info::code_attribute_parser;
use classfile_parser::attribute_info::stack_map_table_attribute_parser;
assert_eq!(c.methods.len(), 2);
assert_eq!(c.methods.len(), c.methods_count as usize);
let method = &c.methods[1];
assert_eq!(method.attributes.len(), 1);
assert_eq!(method.attributes.len(), method.attributes_count as usize);
let code = match code_attribute_parser(ParseData::from_range(
stack_map_class,
method.attributes[0].info.clone(),
)) {
Result::Ok((_, c)) => c,
_ => panic!("Could not get code attribute"),
};
assert_eq!(code.attributes_count, 1);
let p = stack_map_table_attribute_parser(ParseData::from_range(
stack_map_class,
code.attributes[0].info.clone(),
));
match p {
Result::Ok((data, a)) => {
assert!(data.is_empty());
assert_eq!(a.entries.len(), a.number_of_entries as usize);
assert_eq!(a.entries.len(), 2);
use classfile_parser::attribute_info::StackMapFrame::*;
match a.entries[0] {
SameFrame { .. } => {}
_ => panic!("unexpected frame type for frame 0"),
};
match a.entries[1] {
SameLocals1StackItemFrame { .. } => {}
_ => panic!("unexpected frame type for frame 1: {:?}", &a.entries[1]),
};
}
_ => panic!("failed to parse StackMapTable"),
};
}
_ => panic!("not a class file"),
};
} | rust_cleaned_test_functions.jsonl/17580 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1121
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16791,
15528,
5376,
5237,
368,
341,
262,
1077,
5611,
5376,
4790,
25,
44590,
84,
23,
60,
284,
2924,
12524,
17223,
1244,
10042,
75158,
14,
50845,
12,
8855,
12318,
5621,
530,
3074,
797,
262,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_basic_try_catch() {
fn exception_value(msg: &str, data: &Value) -> Value {
Value::Exception(exception(msg, data))
}
let exc = exception_value(
"test",
&map_with_values(vec![(
Keyword("cause".to_string(), None),
String("no memory".to_string()),
)]),
);
let test_cases = vec![
// TODO: map to evaluation error test cases
(
"(try* (throw '(1 2 3)) (catch* e e))",
exception_value("", &list_with_values(vec![Number(1), Number(2), Number(3)])),
),
("(try* 22)", Number(22)),
("(try* (prn 222) 22)", Number(22)),
(
"(try* (ex-info \"test\" {:cause \"no memory\"}))",
exc.clone(),
),
("(try* 123 (catch* e 0))", Number(123)),
(
"(try* (ex-info \"test\" {:cause \"no memory\"}) (catch* e 0))",
exc,
),
(
"(try* (throw (ex-info \"test\" {:cause \"no memory\"})) (catch* e (str e)))",
String("test, {:cause \"no memory\"}".to_string()),
),
(
"(try* (throw (ex-info \"test\" {:cause \"no memory\"})) (catch* e 999))",
Number(999),
),
(
// must throw exception to change control flow
"(try* (ex-info \"first\" {}) (ex-info \"test\" {:cause \"no memory\"}) 22 (catch* e e))",
Number(22),
),
(
// must throw exception to change control flow
"(try* (ex-info \"first\" {}) (ex-info \"test\" {:cause \"no memory\"}) (catch* e 22))",
exception_value(
"test",
&map_with_values(
[(
Keyword("cause".to_string(), None),
String("no memory".to_string()),
)]
.iter()
.cloned(),
),
),
),
(
"(try* (throw (ex-info \"first\" {})) (ex-info \"test\" {:cause \"no memory\"}) (catch* e e))",
exception_value(
"first",
&Map(PersistentMap::new()),
),
),
(
"(try* (throw (ex-info \"first\" {})) (ex-info \"test\" {:cause \"no memory\"}) (catch* e (prn e) 22))",
Number(22),
),
(
"(def! f (fn* [] (try* (throw (ex-info \"test\" {:cause 22})) (catch* e (prn e) 22)))) (f)",
Number(22),
),
(
"(def! f (fn* [] (try* (throw (ex-info \"test\" {:cause 'foo})) (catch* e (prn e) 22)))) (f)",
Number(22),
),
(
"(try* (do 1 2 (try* (do 3 4 (throw :e1)) (catch* e (throw (ex-info \"foo\" :bar))))) (catch* e :outer))",
Keyword("outer".to_string(), None),
),
(
"(try* (do (try* \"t1\" (catch* e \"c1\")) (throw \"e1\")) (catch* e \"c2\"))",
String("c2".to_string()),
),
(
"(try* (try* (throw \"e1\") (catch* e (throw \"e2\"))) (catch* e \"c2\"))",
String("c2".to_string()),
),
(
"(def! f (fn* [a] ((fn* [] (try* (throw (ex-info \"test\" {:cause 22})) (catch* e (prn e) a)))))) (f 2222)",
Number(2222),
),
(
"(((fn* [a] (fn* [] (try* (throw (ex-info \"\" {:foo 2})) (catch* e (prn e) a)))) 2222))",
Number(2222),
),
(
"(try* abc (catch* exc (prn exc) 2222))",
Number(2222),
),
(
"(try* (abc 1 2) (catch* exc (prn exc)))",
Nil,
),
(
"(try* (nth () 1) (catch* exc (prn exc)))",
Nil,
),
(
"(try* (try* (nth () 1) (catch* exc (prn exc) (throw exc))) (catch* exc (prn exc) 33))",
Number(33),
),
];
run_eval_test(&test_cases);
} | rust_cleaned_test_functions.jsonl/114218 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2726
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
53283,
666,
754,
368,
341,
286,
5168,
4683,
3142,
8119,
25,
609,
495,
11,
821,
25,
609,
1130,
8,
1464,
5162,
341,
310,
5162,
486,
1354,
38564,
8119,
11,
821,
1171,
286,
555,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_indexed_reader_read_read_fails() {
let bad_reader = ReaderMock {
seek_fails: false,
read_fails: true,
};
let mut reader = IndexedReader::new(bad_reader, FAI_FILE).unwrap();
let mut seq = Vec::new();
reader.fetch("id", 0, 10).unwrap();
assert!(reader.read(&mut seq).is_err());
} | rust_cleaned_test_functions.jsonl/62846 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 186
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3560,
291,
22306,
6443,
6443,
761,
6209,
368,
341,
286,
1077,
3873,
22306,
284,
25166,
11571,
341,
310,
5931,
761,
6209,
25,
895,
345,
310,
1349,
761,
6209,
25,
830,
345,
286,
2605,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_nonce_invalid() {
let lst = [
"",
"rdo9x8gS4K/mZg==",
"rdo9x8gS4K/mZg",
"rdo9x8gS4K+mZg",
"৬",
"京",
];
for n in lst.iter() {
assert!(!is_nonce(n));
}
} | rust_cleaned_test_functions.jsonl/19262 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 226
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48508,
31433,
368,
341,
286,
1077,
18845,
284,
2278,
310,
8324,
310,
330,
81,
2982,
24,
87,
23,
70,
50,
19,
42,
3183,
57,
70,
418,
756,
310,
330,
81,
2982,
24,
87,
23,
70,
50,
19,
42,
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... | 2 |
#[test]
fn test_hook_body_funcs() {
// test defaults
{
let body = HookBody::new();
assert_eq!("", body.ref_name());
assert_eq!("", body.after());
assert_eq!("", body.before());
assert_eq!(false, body.forced());
assert_eq!(false, body.created());
assert_eq!(false, body.deleted());
}
// test values
{
let mut body = HookBody::new();
body.ref_name = Some("the-ref".to_string());
body.after = Some("after".to_string());
body.before = Some("before".to_string());
assert_eq!("the-ref", body.ref_name());
assert_eq!("after", body.after());
assert_eq!("before", body.before());
}
// test bools one by one
{
let mut body = HookBody::new();
body.forced = Some(true);
assert_eq!(true, body.forced());
}
{
let mut body = HookBody::new();
body.created = Some(true);
assert_eq!(true, body.created());
}
{
let mut body = HookBody::new();
body.deleted = Some(true);
assert_eq!(true, body.deleted());
}
} | rust_cleaned_test_functions.jsonl/8023 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 676
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32005,
14114,
64124,
368,
341,
286,
442,
1273,
16674,
198,
286,
341,
310,
1077,
2487,
284,
28171,
5444,
486,
931,
543,
310,
2060,
10714,
17223,
497,
2487,
11053,
1269,
1423,
310,
2060,
10714,
1722... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_scan_rle_char() {
let builder = PlainCharBlockBuilder::new(120, 40);
let mut rle_builder = RleBlockBuilder::<Utf8Array, PlainCharBlockBuilder>::new(builder);
let width_40_char = ["2"].iter().cycle().take(40).join("");
for item in [Some("233")].iter().cycle().cloned().take(3) {
rle_builder.append(item);
}
for item in [Some("2333")].iter().cycle().cloned().take(3) {
rle_builder.append(item);
}
for item in [Some(&width_40_char[..])].iter().cycle().cloned().take(3) {
rle_builder.append(item);
}
let data = rle_builder.finish();
let (rle_num, rle_data, block_data) = decode_rle_block(Bytes::from(data));
let block_iter = PlainCharBlockIterator::new(block_data, rle_num, 40);
let mut scanner = RleBlockIterator::<Utf8Array, PlainCharBlockIterator>::new(
block_iter, rle_data, rle_num,
);
let mut builder = Utf8ArrayBuilder::new();
scanner.skip(3);
assert_eq!(scanner.remaining_items(), 6);
assert_eq!(scanner.next_batch(Some(2), &mut builder), 2);
assert_eq!(
builder.finish().to_vec(),
vec![Some("2333".to_string()), Some("2333".to_string())]
);
let mut builder = Utf8ArrayBuilder::new();
assert_eq!(scanner.next_batch(Some(2), &mut builder), 2);
assert_eq!(
builder.finish().to_vec(),
vec![Some("2333".to_string()), Some(width_40_char.clone())]
);
let mut builder = Utf8ArrayBuilder::new();
assert_eq!(scanner.next_batch(Some(3), &mut builder), 2);
assert_eq!(
builder.finish().to_vec(),
vec![Some(width_40_char.clone()), Some(width_40_char.clone())]
);
let mut builder = Utf8ArrayBuilder::new();
assert_eq!(scanner.next_batch(None, &mut builder), 0);
} | rust_cleaned_test_functions.jsonl/38169 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 925
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28857,
1710,
273,
9232,
368,
341,
286,
1077,
7363,
284,
43199,
4768,
4713,
3297,
486,
931,
7,
16,
17,
15,
11,
220,
19,
15,
317,
286,
1077,
5206,
435,
273,
28532,
284,
431,
273,
4713,
3297,
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... | 4 |
#[test]
fn test_get_file_as_byte_vec() {
let data: Vec<u8> = vec![
0x7F, 0x45, 0x4C, 0x46, 0x01, 0x01, 0x01, 0x03, 0x00, 0x10, 0x20, 0x31, 0x32, 0x33,
0x20, 0x11,
];
let path = std::path::PathBuf::from(r"./samples/handcrafted_ident");
let val = get_file_as_byte_vec(&path).unwrap();
assert_eq!(data, val);
} | rust_cleaned_test_functions.jsonl/73544 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
2458,
11898,
19737,
13251,
368,
341,
286,
1077,
821,
25,
11312,
34837,
23,
29,
284,
7486,
90515,
310,
220,
15,
87,
22,
37,
11,
220,
15,
87,
19,
20,
11,
220,
15,
87,
19,
34,
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_primitive_offset() {
let b = UInt8Array::from(vec![Some(1), Some(2), Some(3)]);
let b = b.slice(1, 2).data();
let arrays = vec![b.as_ref()];
let mut a = MutableArrayData::new(arrays, false, 2);
a.extend(0, 0, 2);
let result = a.freeze();
let array = UInt8Array::from(Arc::new(result));
let expected = UInt8Array::from(vec![Some(2), Some(3)]);
assert_eq!(array, expected);
} | rust_cleaned_test_functions.jsonl/102335 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 233
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84087,
6917,
368,
341,
286,
1077,
293,
284,
22275,
23,
1857,
486,
1499,
25592,
20703,
8373,
7,
16,
701,
4329,
7,
17,
701,
4329,
7,
18,
41958,
286,
1077,
293,
284,
293,
14530,
7,
16,
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_trim_leading_zero_bytes() {
let cs: Vec<(Vec<u8>, Vec<u8>)> = vec![
(vec![], vec![]),
(vec![0x0], vec![0x0]),
(vec![0x1], vec![0x1]),
(vec![0x1, 0x0], vec![0x1, 0x0]),
(vec![0x0, 0x1], vec![0x1]),
(vec![0x0, 0x0, 0x0], vec![0x0]),
(vec![0x1, 0x0, 0x0], vec![0x1, 0x0, 0x0]),
(
vec![0x0, 0x1, 0x0, 0x0, 0x1, 0x0, 0x0],
vec![0x1, 0x0, 0x0, 0x1, 0x0, 0x0],
),
(
vec![0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x1, 0x0, 0x0],
vec![0x1, 0x0, 0x0, 0x1, 0x0, 0x0],
),
];
for (input, expected) in cs {
let result = trim_leading_zero_bytes(input.as_slice());
assert_eq!(result, expected.as_slice())
}
} | rust_cleaned_test_functions.jsonl/12344 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 615
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70025,
11751,
2228,
19359,
12524,
368,
341,
286,
1077,
10532,
25,
11312,
28706,
10050,
34837,
23,
8066,
11312,
34837,
23,
9231,
29,
284,
7486,
90515,
310,
320,
4083,
0,
12995,
7486,
0,
1294,
1326,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_implicit_select() {
let system = new_kompact_system();
let receivers: Vec<Arc<Component<ReceiverComponent>>> = (0..GROUP_SIZE)
.map(|_i| system.create(ReceiverComponent::default))
.collect();
let group_ref: ActorPath = system
.system_path()
.into_named_with_string("routing-group/?")
.expect("actor path")
.into();
let receiver_refs: Vec<ActorPath> = receivers
.iter()
.enumerate()
.map(|(i, c)| system.register_by_alias(c, &format!("routing-group/receiver{}", i)))
.map(|f| f.wait_expect(SLEEP_TIME, "Could not register component"))
.collect();
receivers.iter().for_each(|c| system.start(c));
group_ref.tell(CountMe, &system);
std::thread::sleep(SLEEP_TIME);
assert_eq!(1, total_count(&receivers));
group_ref.tell(CountMe, &system);
group_ref.tell(CountMe, &system);
std::thread::sleep(SLEEP_TIME);
assert_eq!(3, total_count(&receivers));
let counts = individual_count(&receivers);
assert!(counts.iter().any(|&v| v == 3));
let other_source_ref: ActorPath = system
.system_path()
.into_named_with_string("other_source")
.expect("actor path")
.into();
group_ref.tell(CountMe, &other_source_ref.using_dispatcher(&system));
std::thread::sleep(SLEEP_TIME);
assert_eq!(4, total_count(&receivers));
let counts = individual_count(&receivers);
// they could end up in the same bucket
assert!(
(counts.iter().any(|&v| v == 3) && counts.iter().any(|&v| v == 1))
|| counts.iter().any(|&v| v == 4)
);
for _i in 0..NUM_MESSAGES {
group_ref.tell(CountMe, &other_source_ref.using_dispatcher(&system));
}
std::thread::sleep(SLEEP_TIME);
assert_eq!(NUM_MESSAGES + 4, total_count(&receivers));
let counts = individual_count(&receivers);
// they could technically end up in the same bucket
assert!(
(counts.iter().any(|&v| v == 3) && counts.iter().any(|&v| v == NUM_MESSAGES + 1))
|| counts.iter().any(|&v| v == NUM_MESSAGES + 4)
);
drop(receiver_refs);
system.shutdown().expect("shutdown");
} | rust_cleaned_test_functions.jsonl/32534 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1178
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
30940,
13051,
368,
341,
286,
1077,
1849,
284,
501,
4698,
14435,
531,
17687,
1428,
286,
1077,
39906,
25,
11312,
30192,
1287,
96689,
27,
25436,
2189,
20154,
284,
320,
15,
496,
41480,
4098,
340,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_switch_implies_cfg_test() {
rustc_span::with_default_session_globals(|| {
let matches = optgroups().parse(&["--test".to_string()]).unwrap();
let (sess, cfg) = mk_session(matches);
let cfg = build_configuration(&sess, to_crate_config(cfg));
assert!(cfg.contains(&(sym::test, None)));
});
} | rust_cleaned_test_functions.jsonl/114838 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 157
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27652,
21007,
550,
18343,
4452,
368,
341,
262,
23071,
66,
37382,
486,
4197,
9993,
12316,
58775,
79453,
341,
286,
1077,
9071,
284,
3387,
16753,
1005,
6400,
2099,
1183,
313,
1944,
3263,
983,
3904,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_codec() {
let mut codec = SrvCodec::new();
let mut inner = net::NetErr::default();
inner.code = net::ErrCode::NotFound as i32;
inner.msg = "this".to_string();
let msg = SrvMessage::from(inner);
let mut buf = BytesMut::new();
codec.encode(msg.clone(), &mut buf).unwrap();
let decoded = codec.decode(&mut buf).unwrap().unwrap();
assert_eq!(decoded.header(), msg.header());
assert_eq!(decoded.message_id(), msg.message_id());
assert_eq!(decoded.transaction(), msg.transaction());
assert_eq!(decoded.body(), msg.body());
} | rust_cleaned_test_functions.jsonl/100372 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 286
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51084,
368,
341,
286,
1077,
5206,
34647,
284,
328,
10553,
36913,
486,
931,
543,
286,
1077,
5206,
9179,
284,
4179,
486,
6954,
7747,
486,
2258,
543,
286,
9179,
10210,
284,
4179,
486,
7747,
2078,
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_write_info_field_value_with_character_value() -> io::Result<()> {
use vcf::record::info::field;
let mut buf = Vec::new();
let value = field::Value::Character('n');
write_info_field_value(&mut buf, Some(&value))?;
let expected = [0x17, 0x6e];
assert_eq!(buf, expected);
Ok(())
} | rust_cleaned_test_functions.jsonl/6248 | {
"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,
9165,
3109,
5013,
3142,
6615,
40988,
3142,
368,
1464,
6399,
486,
2077,
71698,
341,
286,
990,
348,
9792,
486,
8548,
486,
2733,
486,
2566,
401,
286,
1077,
5206,
6607,
284,
11312,
486,
931,
543,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_cfg_kafka() {
let env = convert_args!(hashmap!(
"MODE" => "kafka",
"BOOTSTRAP_SERVERS" => "bootstrap:9091",
"TOPIC" => "topic",
"PROPERTIES__FOO_BAR" => "baz",
"K_SINK" => "http://localhost",
));
let cfg = Config::from_env_source(env).unwrap();
assert_eq!(
cfg.mode,
Mode::Kafka(KafkaConfig {
topic: "topic".to_string(),
bootstrap_servers: "bootstrap:9091".into(),
properties: convert_args!(hashmap!(
"foo_bar" => "baz",
))
})
);
} | rust_cleaned_test_functions.jsonl/22790 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 408
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18343,
4698,
21883,
368,
341,
286,
1077,
6105,
284,
5508,
8384,
10297,
8296,
2186,
33673,
310,
330,
22808,
1,
589,
330,
74,
21883,
756,
310,
330,
67076,
6666,
2537,
20012,
50,
1,
589,
330,
6281,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_phys_reg_to_dynasm_reg() {
use super::super::machine::register::*;
assert_eq!(phys_reg_to_dynasm_reg(GR32::EAX.as_phys_reg()), 0);
assert_eq!(phys_reg_to_dynasm_reg(GR64::RAX.as_phys_reg()), 0);
assert_eq!(phys_reg_to_dynasm_reg(GR32::R15D.as_phys_reg()), 15);
assert_eq!(phys_reg_to_dynasm_reg(GR64::R15.as_phys_reg()), 15);
} | rust_cleaned_test_functions.jsonl/15221 | {
"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,
69319,
4920,
2346,
69213,
10530,
4920,
368,
341,
262,
990,
2256,
486,
9522,
486,
32056,
486,
6343,
56162,
262,
2060,
10714,
10297,
41205,
4920,
2346,
69213,
10530,
4920,
6699,
49,
18,
17,
486,
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_update_push_request_build_no_flags() {
let req = UpdatePushRequest::new("some-id");
let form = req.build();
assert_eq!(
form,
update_data::Form {
id: "some-id".to_string(),
data: update_data::Data {
alerts: None,
},
}
);
} | rust_cleaned_test_functions.jsonl/116584 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 227
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
14218,
7893,
20801,
6536,
14130,
368,
341,
286,
1077,
4232,
284,
5549,
16644,
1900,
486,
931,
445,
14689,
12897,
797,
286,
1077,
1352,
284,
4232,
13239,
543,
286,
2060,
10714,
33673,
310,
13... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_encrypt_length() {
let key = b"supersecret";
let length_zero = b"";
let length_one_block = b"hello";
let one_full_block = b"0123456789abcdef";
let multiple_blocks = b"0123456789abcdefghijkl";
let length_zero_enc: Vec<u8> = encrypt(length_zero, key, CiphertextVersion::Latest)
.unwrap()
.into();
let length_one_block_enc: Vec<u8> = encrypt(length_one_block, key, CiphertextVersion::Latest)
.unwrap()
.into();
let one_full_block_enc: Vec<u8> = encrypt(one_full_block, key, CiphertextVersion::Latest)
.unwrap()
.into();
let multiple_blocks_enc: Vec<u8> = encrypt(multiple_blocks, key, CiphertextVersion::Latest)
.unwrap()
.into();
assert_eq!(
length_zero_enc.len() as i64,
EncryptSize(length_zero.len(), 0)
);
assert_eq!(
length_one_block_enc.len() as i64,
EncryptSize(length_one_block.len(), 0)
);
assert_eq!(
one_full_block_enc.len() as i64,
EncryptSize(one_full_block.len(), 0)
);
assert_eq!(
multiple_blocks_enc.len() as i64,
EncryptSize(multiple_blocks.len(), 0)
);
} | rust_cleaned_test_functions.jsonl/50060 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 552
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66593,
5118,
368,
341,
262,
1077,
1376,
284,
293,
1,
9522,
20474,
876,
262,
1077,
3084,
19359,
284,
293,
1,
876,
262,
1077,
3084,
11667,
7113,
284,
293,
1,
14990,
876,
262,
1077,
825,
16372,
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_strings() -> Result<()> {
let query: Query = parse(
r###"
derive [
x = "two households'",
y = 'two households"',
z = f"a {x} b' {y} c",
v = f'a {x} b" {y} c',
]
"###,
)?;
assert_display_snapshot!((resolve_and_translate(query)?), @r###"
SELECT
'two households''' AS x,
'two households"' AS y,
CONCAT(
'a ',
'two households''',
' b'' ',
'two households"',
' c'
) AS z,
CONCAT(
'a ',
'two households''',
' b" ',
'two households"',
' c'
) AS v
"###);
Ok(())
} | rust_cleaned_test_functions.jsonl/62570 | {
"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,
33500,
368,
1464,
5714,
71698,
341,
286,
1077,
3239,
25,
11361,
284,
4715,
1006,
310,
435,
14374,
698,
286,
42430,
2278,
310,
856,
284,
330,
19789,
28839,
38330,
310,
379,
284,
364,
19789,
28839,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_validate_pool_name() {
assert_eq!(validate_pool_name("pool1"), Ok(error::SUCCESS.code_num));
assert_eq!(validate_pool_name("**pool_name**"), Err(error::INVALID_POOL_NAME.code_num));
} | rust_cleaned_test_functions.jsonl/115826 | {
"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,
42681,
15709,
1269,
368,
341,
286,
2060,
10714,
10297,
7067,
15709,
1269,
445,
10285,
16,
3975,
7622,
6390,
486,
39308,
10210,
4273,
3237,
286,
2060,
10714,
10297,
7067,
15709,
1269,
91389,
10285,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_dpcc() {
assert_eq!(
&dpcc(Direction::Right, CodelChooser::Left).collect::<Vec<_>>(),
&[
(Direction::Right, CodelChooser::Left),
(Direction::Right, CodelChooser::Right),
(Direction::Down, CodelChooser::Right),
(Direction::Down, CodelChooser::Left),
(Direction::Left, CodelChooser::Left),
(Direction::Left, CodelChooser::Right),
(Direction::Up, CodelChooser::Right),
(Direction::Up, CodelChooser::Left),
]
);
assert_eq!(
&dpcc(Direction::Right, CodelChooser::Right).collect::<Vec<_>>(),
&[
(Direction::Right, CodelChooser::Right),
(Direction::Right, CodelChooser::Left),
(Direction::Down, CodelChooser::Left),
(Direction::Down, CodelChooser::Right),
(Direction::Left, CodelChooser::Right),
(Direction::Left, CodelChooser::Left),
(Direction::Up, CodelChooser::Left),
(Direction::Up, CodelChooser::Right),
]
);
} | rust_cleaned_test_functions.jsonl/74598 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 659
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53872,
638,
368,
341,
286,
2060,
10714,
33673,
310,
609,
9796,
638,
81740,
486,
5979,
11,
356,
720,
36557,
486,
5415,
568,
17384,
27638,
10050,
32399,
2452,
3148,
310,
609,
9640,
394,
320,
9268,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_to_password() {
let key = Rsa::generate(2048).unwrap();
let pem = key.private_key_to_pem_passphrase(Cipher::aes_128_cbc(), b"foobar").unwrap();
Rsa::private_key_from_pem_passphrase(&pem, b"foobar").unwrap();
assert!(Rsa::private_key_from_pem_passphrase(&pem, b"fizzbuzz").is_err());
} | rust_cleaned_test_functions.jsonl/6926 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 166
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
10122,
368,
341,
286,
1077,
1376,
284,
431,
9081,
486,
19366,
7,
17,
15,
19,
23,
568,
15454,
543,
286,
1077,
54184,
284,
1376,
61603,
3097,
2346,
620,
336,
15464,
27710,
3025,
10558,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_gen_mac_cbc_nopads() {
let res = generate_mac(&MacAlgo::CbcMac, &PaddingType::Type1,
&Vec::from(hex!("0102030405060708")), &Vec::from(hex!("e0f4543f3e2a2c5ffc7e5e5a222e3e4d")));
match res {
Ok(m) => {
println!("mac = {}", hex::encode(m.as_slice()));
assert_eq!("7d34c3071da931b9", hex::encode(m));
}
Err(e) => {
assert!(false, e.msg)
}
}
} | rust_cleaned_test_functions.jsonl/23722 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 331
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16322,
22802,
666,
8904,
1089,
453,
7664,
368,
341,
286,
1077,
592,
284,
6923,
22802,
2099,
19552,
2101,
3346,
486,
34,
8904,
19552,
11,
609,
21616,
929,
486,
929,
16,
345,
7561,
609,
10050,
486... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_bool_to_compact_string() {
let c = true.to_compact_string();
let s = true.to_string();
assert_eq!("true", c);
assert_eq!(c, s);
assert!(!c.is_heap_allocated());
let c = false.to_compact_string();
let s = false.to_string();
assert_eq!("false", c);
assert_eq!(c, s);
assert!(!c.is_heap_allocated());
} | rust_cleaned_test_functions.jsonl/2802 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 172
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22159,
2346,
18177,
531,
3904,
368,
341,
262,
1077,
272,
284,
830,
2389,
18177,
531,
3904,
543,
262,
1077,
274,
284,
830,
2389,
3904,
1428,
262,
2060,
10714,
17223,
1866,
497,
272,
317,
262,
206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vuint_at() {
let data = &[
0x80,
0xff,
0x40, 0x00,
0x7f, 0xff,
0x20, 0x00, 0x00,
0x3f, 0xff, 0xff,
0x10, 0x00, 0x00, 0x00,
0x1f, 0xff, 0xff, 0xff
];
let mut res: reader::Res;
// Class A
res = reader::vuint_at(data, 0).unwrap();
assert_eq!(res.val, 0);
assert_eq!(res.next, 1);
res = reader::vuint_at(data, res.next).unwrap();
assert_eq!(res.val, (1 << 7) - 1);
assert_eq!(res.next, 2);
// Class B
res = reader::vuint_at(data, res.next).unwrap();
assert_eq!(res.val, 0);
assert_eq!(res.next, 4);
res = reader::vuint_at(data, res.next).unwrap();
assert_eq!(res.val, (1 << 14) - 1);
assert_eq!(res.next, 6);
// Class C
res = reader::vuint_at(data, res.next).unwrap();
assert_eq!(res.val, 0);
assert_eq!(res.next, 9);
res = reader::vuint_at(data, res.next).unwrap();
assert_eq!(res.val, (1 << 21) - 1);
assert_eq!(res.next, 12);
// Class D
res = reader::vuint_at(data, res.next).unwrap();
assert_eq!(res.val, 0);
assert_eq!(res.next, 16);
res = reader::vuint_at(data, res.next).unwrap();
assert_eq!(res.val, (1 << 28) - 1);
assert_eq!(res.next, 20);
} | rust_cleaned_test_functions.jsonl/5041 | {
"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,
2273,
2496,
3752,
368,
341,
286,
1077,
821,
284,
609,
9640,
310,
220,
15,
87,
23,
15,
345,
310,
220,
15,
9020,
345,
310,
220,
15,
87,
19,
15,
11,
220,
15,
87,
15,
15,
345,
310,
220,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_range_step_inclusive() {
assert!(super::range_step_inclusive(0, 20, 5).collect::<Vec<isize>>() ==
vec![0, 5, 10, 15, 20]);
assert!(super::range_step_inclusive(20, 0, -5).collect::<Vec<isize>>() ==
vec![20, 15, 10, 5, 0]);
assert!(super::range_step_inclusive(20, 0, -6).collect::<Vec<isize>>() ==
vec![20, 14, 8, 2]);
assert!(super::range_step_inclusive(200u8, 255, 50).collect::<Vec<u8>>() ==
vec![200u8, 250]);
assert!(super::range_step_inclusive(200, -5, 1).collect::<Vec<isize>>() ==
vec![]);
assert!(super::range_step_inclusive(200, 200, 1).collect::<Vec<isize>>() ==
vec![200]);
} | rust_cleaned_test_functions.jsonl/59090 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 405
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9698,
11946,
1243,
8336,
368,
341,
286,
2060,
10297,
9522,
486,
9669,
11946,
1243,
8336,
7,
15,
11,
220,
17,
15,
11,
220,
20,
568,
17384,
27638,
10050,
27,
285,
551,
61586,
47761,
394,
7486,
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_age_broad() {
solana_logger::setup();
let bins = 4;
let test = BucketMapHolder::<u64>::new(bins, &Some(AccountsIndexConfig::default()), 1);
assert_eq!(test.current_age(), 0);
for _ in 0..bins {
assert!(!test.all_buckets_flushed_at_current_age());
test.bucket_flushed_at_current_age(true);
}
std::thread::sleep(std::time::Duration::from_millis(AGE_MS * 2));
test.maybe_advance_age();
assert_eq!(test.current_age(), 1);
assert!(!test.all_buckets_flushed_at_current_age());
} | rust_cleaned_test_functions.jsonl/5429 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 295
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32053,
880,
8546,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
28518,
284,
220,
19,
280,
286,
1077,
1273,
284,
47768,
2227,
8589,
27638,
84,
21,
19,
6831,
931,
1883,
1330,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_from_key_file_returns_correct_instance() {
let array = [94, 136, 72, 152, 218, 40, 4, 113, 81, 208, 229, 111, 141, 198, 41, 39, 115,
96, 61, 13, 106, 171, 189, 214, 42, 17, 239, 114, 29, 21, 66, 216];
let key = KeyFile {
key: SecStr::new(vec![0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64]),
file_type: KeyFileType::Xml,
};
let expected = CompositeKey::secure(array);
let actual = CompositeKey::from_key_file(key);
assert_eq!(actual, expected);
} | rust_cleaned_test_functions.jsonl/23602 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 288
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
3097,
2458,
58900,
31550,
11904,
368,
341,
286,
1077,
1334,
284,
508,
24,
19,
11,
220,
16,
18,
21,
11,
220,
22,
17,
11,
220,
16,
20,
17,
11,
220,
17,
16,
23,
11,
220,
19,
15,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_equal() {
let a = Address::from_str("8b45e4bd1c6acb88bebf6407d16205f567e62a3e").unwrap();
let b = Address::from_str("8b45e4bd1c6acb88bebf6407d16205f567e62a3e").unwrap();
assert_eq!(a, b);
} | rust_cleaned_test_functions.jsonl/6516 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 135
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11478,
368,
341,
286,
1077,
264,
284,
9177,
486,
1499,
2895,
445,
23,
65,
19,
20,
68,
19,
8940,
16,
66,
21,
97471,
23,
23,
1371,
13233,
21,
19,
15,
22,
67,
16,
21,
17,
15,
20,
69,
20,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unsuccessful_env_var_parse() {
parse_env_var("FOO").expect_err("Missing '=' should fail");
parse_env_var("=bar").expect_err("Missing key should fail");
} | rust_cleaned_test_functions.jsonl/75745 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 84
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
30950,
15879,
4612,
21039,
368,
341,
286,
4715,
15879,
4612,
445,
3788,
46,
1827,
17119,
9266,
445,
25080,
40554,
1265,
3690,
3071,
286,
4715,
15879,
4612,
445,
28,
2257,
1827,
17119,
9266,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_stop_ap_succeeds() {
let mut test_values = test_setup();
// Stop an AP
let stop_fut =
test_values.iface_manager.stop_ap("foo".as_bytes().to_vec(), "bar".as_bytes().to_vec());
pin_mut!(stop_fut);
assert_variant!(test_values.exec.run_until_stalled(&mut stop_fut), Poll::Pending);
// Verify the service sees the request
let next_message = test_values.receiver.next();
pin_mut!(next_message);
assert_variant!(
test_values.exec.run_until_stalled(&mut next_message),
Poll::Ready(Some(IfaceManagerRequest::StopAp(StopApRequest{
ssid, password, responder
}))) => {
assert_eq!(ssid, "foo".as_bytes().to_vec());
assert_eq!(password, "bar".as_bytes().to_vec());
responder.send(Ok(())).expect("failed to send stop AP response");
}
);
// Verify that the client gets the response
assert_variant!(test_values.exec.run_until_stalled(&mut stop_fut), Poll::Ready(Ok(_)));
} | rust_cleaned_test_functions.jsonl/59193 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 525
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19039,
21093,
643,
29264,
82,
368,
341,
286,
1077,
5206,
1273,
9146,
284,
1273,
21363,
1428,
286,
442,
14215,
458,
10106,
198,
286,
1077,
2936,
761,
332,
4035,
310,
1273,
9146,
35431,
578,
12144,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_ufo_path_unique_extension_unique_dirname() {
let op = get_ufo_outpath(
&Path::new("one/two/three.ufo"),
&Some("-new".to_string()),
&Some("fmt".to_string()),
);
assert_eq!(op, PathBuf::from("one/two/three-new.fmt"));
} | rust_cleaned_test_functions.jsonl/21548 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 170
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
7300,
824,
2638,
21218,
31035,
21218,
4334,
606,
368,
341,
286,
1077,
1179,
284,
633,
7300,
824,
6068,
2343,
1006,
310,
609,
1820,
486,
931,
445,
603,
5523,
1126,
20439,
765,
11634,
824,
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_rem() {
fn test(a: Rational, b: Rational, c: Rational) {
assert_eq!(a % b, c);
assert_eq!(
{
let mut x = a;
x %= b;
x
},
c
);
assert_eq!(to_big(a) % to_big(b), to_big(c))
}
fn test_assign(a: Rational, b: isize, c: Rational) {
assert_eq!(a % b, c);
assert_eq!(
{
let mut x = a;
x %= b;
x
},
c
);
}
test(_3_2, _1, _1_2);
test(_3_2, _1_2, _0);
test(_5_2, _3_2, _1);
test(_2, _NEG1_2, _0);
test(_1_2, _2, _1_2);
test_assign(_3_2, 1, _1_2);
} | rust_cleaned_test_functions.jsonl/856 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 734
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19194,
368,
341,
310,
5168,
1273,
2877,
25,
54525,
11,
293,
25,
54525,
11,
272,
25,
54525,
8,
341,
394,
2060,
10714,
10297,
64,
1018,
293,
11,
272,
317,
394,
2060,
10714,
33673,
503,
341,
664,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_user_permissions() {
let query = SubspacesQuery::UserPermissions {
subspace_id: Uint64::new(1),
user: Addr::unchecked("cosmos1qzskhrcjnkdz2ln4yeafzsdwht8ch08j4wed69"),
};
let response = mock_subspaces_query_response(&query);
let expected = to_binary(&QueryUserPermissionsResponse {
permissions: Default::default(),
details: vec![MockSubspacesQueries::get_mock_permission_detail()],
});
assert_eq!(response.into_result().ok(), expected.ok());
} | rust_cleaned_test_functions.jsonl/109488 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 263
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5738,
3317,
44767,
368,
341,
286,
1077,
3239,
284,
3719,
44285,
2859,
486,
1474,
23851,
341,
310,
5147,
1306,
842,
25,
27883,
21,
19,
486,
931,
7,
16,
1326,
310,
1196,
25,
72585,
486,
31684,
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_fill2() {
use ndshape::ConstShape2u32;
let dst_shape = ConstShape2u32::<11, 12>;
const DST_SIZE: usize = 11 * 12;
let mut dst = [0; DST_SIZE];
fill2([2, 3], 1, &mut dst, &dst_shape, [4, 5]);
for y in 5..5 + 3 {
for x in 4..4 + 2 {
let i = dst_shape.linearize([x, y]) as usize;
assert_eq!(1, dst[i]);
dst[i] = 0;
}
}
for i in 0..DST_SIZE {
assert_eq!(dst[i], 0);
}
} | rust_cleaned_test_functions.jsonl/85380 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 272
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30728,
17,
368,
341,
262,
990,
15581,
12231,
486,
19167,
12301,
17,
84,
18,
17,
401,
262,
1077,
10648,
13597,
284,
24522,
12301,
17,
84,
18,
17,
27638,
16,
16,
11,
220,
16,
17,
10133,
262,
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... | 4 |
#[test]
fn test_required_dice_launches() {
assert_eq!(required_dice_launches(6, &BigUint::from(5u32)), 0);
assert_eq!(required_dice_launches(6, &BigUint::from(6u32)), 1);
assert_eq!(required_dice_launches(6, &BigUint::from(7u32)), 1);
assert_eq!(required_dice_launches(6, &BigUint::from(35u32)), 1);
assert_eq!(required_dice_launches(6, &BigUint::from(36u32)), 2);
assert_eq!(required_dice_launches(6, &BigUint::from(37u32)), 2);
assert_eq!(required_dice_launches(256, &BigUint::from(7u32)), 0);
let n: BigUint = Bits::_256.into();
assert_eq!(required_dice_launches(256, &n), 32);
assert_eq!(required_dice_launches(8, &n), 85);
assert_eq!(required_dice_launches(6, &n), 99);
let n: BigUint = Bits::_128.into();
assert_eq!(required_dice_launches(256, &n), 16);
let n: BigUint = Bits::_192.into();
assert_eq!(required_dice_launches(256, &n), 24);
} | rust_cleaned_test_functions.jsonl/39502 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 486
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18743,
97196,
51617,
288,
368,
341,
286,
2060,
10714,
10297,
6279,
97196,
51617,
288,
7,
21,
11,
609,
15636,
21570,
486,
1499,
7,
20,
84,
18,
17,
5731,
220,
15,
317,
286,
2060,
10714,
10297,
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_alpha() {
let mut sealed_sector_a: StagedSectorMetadata = Default::default();
sealed_sector_a.pieces.push(PieceMetadata {
piece_key: String::from("x"),
num_bytes: UnpaddedBytesAmount(508),
comm_p: None,
piece_inclusion_proof: None,
});
sealed_sector_a.pieces.push(PieceMetadata {
piece_key: String::from("x"),
num_bytes: UnpaddedBytesAmount(254),
comm_p: None,
piece_inclusion_proof: None,
});
let mut sealed_sector_b: StagedSectorMetadata = Default::default();
sealed_sector_b.pieces.push(PieceMetadata {
piece_key: String::from("x"),
num_bytes: UnpaddedBytesAmount(508),
comm_p: None,
piece_inclusion_proof: None,
});
let staged_sectors = vec![sealed_sector_a.clone(), sealed_sector_b.clone()];
// piece takes up all remaining space in first sector
match compute_destination_sector_id(
&staged_sectors,
UnpaddedBytesAmount(1016),
UnpaddedBytesAmount(254),
) {
Ok(Some(destination_sector_id)) => {
assert_eq!(destination_sector_id, sealed_sector_a.sector_id)
}
_ => panic!("got no destination sector"),
}
match compute_destination_sector_id(
&staged_sectors,
UnpaddedBytesAmount(1016),
UnpaddedBytesAmount(508),
) {
Ok(Some(destination_sector_id)) => {
assert_eq!(destination_sector_id, sealed_sector_b.sector_id)
}
_ => panic!("got no destination sector"),
}
// piece doesn't fit into any in the list
match compute_destination_sector_id(
&staged_sectors,
UnpaddedBytesAmount(1016),
UnpaddedBytesAmount(1016),
) {
Ok(None) => (),
_ => panic!("got no destination sector"),
}
// piece is over max
match compute_destination_sector_id(
&staged_sectors,
UnpaddedBytesAmount(1016),
UnpaddedBytesAmount(1024),
) {
Err(_) => (),
_ => panic!("got no destination sector"),
}
} | rust_cleaned_test_functions.jsonl/19383 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1179
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26633,
368,
341,
286,
1077,
5206,
19046,
62651,
4306,
25,
794,
3279,
68188,
14610,
284,
7899,
486,
2258,
1428,
286,
19046,
62651,
4306,
556,
29765,
2552,
5304,
9108,
14610,
341,
310,
6573,
3097,
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... | 5 |
#[test]
fn test_display() {
let id = ClientId::Domain("localhost".to_string());
let email = Address::from_str("test@example.com").unwrap();
let mail_parameter = MailParameter::Other {
keyword: "TEST".to_string(),
value: Some("value".to_string()),
};
let rcpt_parameter = RcptParameter::Other {
keyword: "TEST".to_string(),
value: Some("value".to_string()),
};
assert_eq!(format!("{}", Ehlo::new(id)), "EHLO localhost\r\n");
assert_eq!(
format!("{}", Mail::new(Some(email.clone()), vec![])),
"MAIL FROM:<test@example.com>\r\n"
);
assert_eq!(format!("{}", Mail::new(None, vec![])), "MAIL FROM:<>\r\n");
assert_eq!(
format!(
"{}",
Mail::new(Some(email.clone()), vec![MailParameter::Size(42)])
),
"MAIL FROM:<test@example.com> SIZE=42\r\n"
);
assert_eq!(
format!(
"{}",
Mail::new(
Some(email.clone()),
vec![
MailParameter::Size(42),
MailParameter::Body(MailBodyParameter::EightBitMime),
mail_parameter,
],
)
),
"MAIL FROM:<test@example.com> SIZE=42 BODY=8BITMIME TEST=value\r\n"
);
assert_eq!(
format!("{}", Rcpt::new(email.clone(), vec![])),
"RCPT TO:<test@example.com>\r\n"
);
assert_eq!(
format!("{}", Rcpt::new(email.clone(), vec![rcpt_parameter])),
"RCPT TO:<test@example.com> TEST=value\r\n"
);
assert_eq!(format!("{}", Quit), "QUIT\r\n");
assert_eq!(format!("{}", Data), "DATA\r\n");
assert_eq!(format!("{}", Noop), "NOOP\r\n");
assert_eq!(format!("{}", Help::new(None)), "HELP\r\n");
assert_eq!(
format!("{}", Help::new(Some("test".to_string()))),
"HELP test\r\n"
);
assert_eq!(
format!("{}", Vrfy::new("test".to_string())),
"VRFY test\r\n"
);
assert_eq!(
format!("{}", Expn::new("test".to_string())),
"EXPN test\r\n"
);
assert_eq!(format!("{}", Rset), "RSET\r\n");
let credentials = Credentials::new("user".to_string(), "password".to_string());
assert_eq!(
format!(
"{}",
Auth::new(Mechanism::Plain, credentials.clone(), None).unwrap()
),
"AUTH PLAIN AHVzZXIAcGFzc3dvcmQ=\r\n"
);
assert_eq!(
format!(
"{}",
Auth::new(Mechanism::Login, credentials.clone(), None).unwrap()
),
"AUTH LOGIN\r\n"
);
} | rust_cleaned_test_functions.jsonl/300 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1687
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14825,
368,
341,
286,
1077,
877,
284,
8423,
764,
486,
13636,
445,
8301,
3263,
983,
3904,
1423,
286,
1077,
2551,
284,
9177,
486,
1499,
2895,
445,
1944,
35487,
905,
1827,
15454,
543,
286,
1077,
80... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_poh_recorder_tick_height_is_last_tick() {
let prev_hash = Hash::default();
let ledger_path = get_tmp_ledger_path!();
{
let blocktree =
Blocktree::open(&ledger_path).expect("Expected to be able to open database ledger");
let (mut poh_recorder, _entry_receiver) = PohRecorder::new(
0,
prev_hash,
0,
Some((4, 4)),
DEFAULT_TICKS_PER_SLOT,
&Pubkey::default(),
&Arc::new(blocktree),
&Arc::new(LeaderScheduleCache::default()),
&Arc::new(PohConfig::default()),
);
poh_recorder.tick();
poh_recorder.tick();
assert_eq!(poh_recorder.tick_cache.len(), 2);
assert_eq!(poh_recorder.tick_cache[1].1, 2);
assert_eq!(poh_recorder.tick_height, 2);
}
Blocktree::destroy(&ledger_path).unwrap();
} | rust_cleaned_test_functions.jsonl/31716 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 560
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
2267,
7080,
1358,
43612,
9561,
6892,
12195,
43612,
368,
341,
286,
1077,
7872,
8950,
284,
6531,
486,
2258,
543,
286,
1077,
46933,
2638,
284,
633,
16125,
38367,
1389,
2638,
0,
543,
286,
341,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_string_reference() {
test_file! {
#[diplomat::bridge]
mod ffi {
struct MyStruct {
a: u8,
b: u8,
}
impl MyStruct {
pub fn new(v: &str) -> MyStruct {
unimplemented!()
}
}
}
}
} | rust_cleaned_test_functions.jsonl/61354 | {
"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,
3904,
25433,
368,
341,
286,
1273,
2458,
0,
341,
310,
11506,
8579,
500,
80768,
486,
13709,
921,
310,
1463,
76956,
341,
394,
2036,
3017,
9422,
341,
503,
264,
25,
575,
23,
345,
503,
293,
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... | 1 |
#[test]
fn test_div() -> Result<(), TestingError> {
VMTestRunner::new()
.add(PushConst::new((9).into(), IntegerType::I8.into()))
.add(PushConst::new((4).into(), IntegerType::I8.into()))
.add(Div)
.add(PushConst::new((9).into(), IntegerType::I8.into()))
.add(PushConst::new((-4).into(), IntegerType::I8.into()))
.add(Div)
.add(PushConst::new((-9).into(), IntegerType::I8.into()))
.add(PushConst::new((4).into(), IntegerType::I8.into()))
.add(Div)
.add(PushConst::new((-9).into(), IntegerType::I8.into()))
.add(PushConst::new((-4).into(), IntegerType::I8.into()))
.add(Div)
.test(&[3, -3, -2, 2])
} | rust_cleaned_test_functions.jsonl/82724 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 406
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16237,
368,
1464,
5714,
68843,
26768,
1454,
29,
341,
286,
17792,
2271,
19486,
486,
931,
741,
310,
659,
718,
5304,
1116,
19167,
486,
931,
1188,
24,
568,
18122,
1507,
4440,
929,
486,
40,
23,
39860... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_double_same_feature() {
// this is a tricky test - what happens on collision
let mut mi = model_instance::ModelInstance::new_empty().unwrap();
mi.learning_rate = 0.1;
mi.power_t = 0.0;
let mut re = Regressor::<optimizer::OptimizerAdagradLUT>::new(&mi);
let vec_in = &lr_vec(vec![HashAndValue{hash: 1, value: 1.0}, HashAndValue{hash: 1, value: 2.0}]);
assert_eq!(re.learn(vec_in, true, 0), 0.5);
assert_eq!(re.learn(vec_in, true, 0), 0.38936076);
assert_eq!(re.learn(vec_in, true, 0), 0.30993468);
} | rust_cleaned_test_functions.jsonl/124044 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 310
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24598,
33574,
17069,
368,
341,
286,
442,
419,
374,
264,
33453,
1273,
481,
1128,
8573,
389,
18752,
79133,
286,
1077,
5206,
9497,
284,
1614,
11904,
486,
1712,
2523,
486,
931,
15124,
1005,
15454,
543... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cycle() {
errors(
"open class A: B open class B: A",
&[
(pos(1, 6), Msg::CycleInHierarchy),
(pos(1, 22), Msg::CycleInHierarchy),
],
);
} | rust_cleaned_test_functions.jsonl/75947 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 158
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39079,
368,
341,
286,
5975,
1006,
310,
330,
2508,
536,
362,
25,
425,
1787,
536,
425,
25,
362,
756,
310,
609,
9640,
394,
320,
966,
7,
16,
11,
220,
21,
701,
24205,
486,
44820,
641,
85264,
1326... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_index_doc_missing_field() {
let mut schema_builder = schema::Schema::builder();
let idfield = schema_builder.add_text_field("id", STRING);
schema_builder.add_text_field("optfield", STRING);
let index = Index::create_in_ram(schema_builder.build());
let mut index_writer = index.writer_for_tests().unwrap();
index_writer.add_document(doc!(idfield=>"myid"));
let commit = index_writer.commit();
assert!(commit.is_ok());
} | rust_cleaned_test_functions.jsonl/125995 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 212
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3560,
18869,
40447,
5013,
368,
341,
286,
1077,
5206,
10802,
28532,
284,
10802,
486,
8632,
486,
17850,
543,
286,
1077,
877,
2566,
284,
10802,
28532,
1364,
4326,
5013,
445,
307,
497,
35255,
317,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_process_initialize_ix_ok() {
let nonce_address = Pubkey::new_unique();
let nonce_account = nonce_account::create_account(1_000_000).into_inner();
#[allow(deprecated)]
let blockhash_id = sysvar::recent_blockhashes::id();
process_instruction(
&serialize(&SystemInstruction::InitializeNonceAccount(nonce_address)).unwrap(),
vec![
(nonce_address, nonce_account),
(blockhash_id, create_default_recent_blockhashes_account()),
(sysvar::rent::id(), create_default_rent_account()),
],
vec![
AccountMeta {
pubkey: nonce_address,
is_signer: true,
is_writable: true,
},
AccountMeta {
pubkey: blockhash_id,
is_signer: false,
is_writable: false,
},
AccountMeta {
pubkey: sysvar::rent::id(),
is_signer: false,
is_writable: false,
},
],
Ok(()),
super::process_instruction,
);
} | rust_cleaned_test_functions.jsonl/95901 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 721
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
40889,
62686,
19817,
368,
341,
286,
1077,
39676,
6744,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
39676,
13500,
284,
39676,
13500,
486,
3182,
13500,
7,
16,
62,
15,
15,
15,
62,
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_start_clients_fails() {
let mut exec = fuchsia_async::Executor::new().expect("failed to create an executor");
// Create a configured ClientIfaceContainer.
let test_values = test_setup(&mut exec);
let (mut iface_manager, _) = create_iface_manager_with_client(&test_values, true);
iface_manager.phy_manager = Arc::new(Mutex::new(FakePhyManager {
create_iface_ok: false,
destroy_iface_ok: true,
wpa3_iface: None,
set_country_ok: true,
country_code: None,
client_connections_enabled: true,
}));
{
let start_fut = iface_manager.start_client_connections();
pin_mut!(start_fut);
assert_variant!(exec.run_until_stalled(&mut start_fut), Poll::Ready(Err(_)));
}
assert!(iface_manager.clients_enabled_time.is_none());
} | rust_cleaned_test_functions.jsonl/71934 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 437
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4906,
56899,
761,
6209,
368,
341,
286,
1077,
5206,
3883,
284,
282,
73391,
28346,
486,
25255,
486,
931,
1005,
17119,
445,
16091,
311,
1855,
458,
31558,
3071,
286,
442,
4230,
264,
19755,
8423,
40,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mark_as_committed_1_2() {
let mut block_tree = create_block_tree();
block_tree.mark_as_committed(id(1), ()).unwrap();
for i in 1..=11 {
let block = block_tree.get_block(id(i)).unwrap();
match i {
1 => assert!(block.is_committed()),
_ => assert!(!block.is_committed()),
}
}
block_tree.mark_as_committed(id(2), ()).unwrap();
for i in 1..=11 {
let block = block_tree.get_block(id(i)).unwrap();
match i {
1 | 2 => assert!(block.is_committed()),
_ => assert!(!block.is_committed()),
}
}
} | rust_cleaned_test_functions.jsonl/87719 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 322
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18924,
11898,
2965,
5483,
62,
16,
62,
17,
368,
341,
262,
1077,
5206,
2504,
11663,
284,
1855,
7113,
11663,
1428,
262,
2504,
11663,
18406,
11898,
2965,
5483,
3724,
7,
16,
701,
1719,
568,
15454,
54... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_trivial_circuit_with_gate_agnostic_cs() {
use crate::pairing::bn256::{Bn256, Fr};
use crate::worker::Worker;
let mut assembly = TrivialAssembly::<Bn256, PlonkCsWidth4WithNextStepParams, Width4MainGateWithDNext>::new();
let circuit = TestCircuit4::<Bn256> {
_marker: PhantomData
};
circuit.synthesize(&mut assembly).expect("must work");
assert!(assembly.gates.len() == 1);
println!("Assembly contains {} gates", assembly.n());
assembly.finalize();
assert!(assembly.is_satisfied());
assembly.finalize();
let worker = Worker::new();
let (_storage, _permutation_polys) = assembly.perform_setup(&worker).unwrap();
} | rust_cleaned_test_functions.jsonl/78083 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 345
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3547,
26658,
666,
37268,
6615,
54798,
62,
11953,
35372,
368,
341,
286,
990,
17717,
486,
12670,
287,
486,
11081,
17,
20,
21,
22964,
33,
77,
17,
20,
21,
11,
2869,
2440,
286,
990,
17717,
486,
214... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_plain_decode_fixed_len_byte_array() {
let data = vec![
ByteArray::new(ByteBufferPtr::new(String::from("bird").into_bytes())),
ByteArray::new(ByteBufferPtr::new(String::from("come").into_bytes())),
ByteArray::new(ByteBufferPtr::new(String::from("flow").into_bytes())),
];
let data_bytes = FixedLenByteArrayType::to_byte_array(&data[..]);
let mut buffer = vec![ByteArray::default(); 3];
test_plain_decode::<FixedLenByteArrayType>(
ByteBufferPtr::new(data_bytes),
3,
4,
&mut buffer[..],
&data[..],
);
} | rust_cleaned_test_functions.jsonl/113128 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 229
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41015,
15227,
37839,
6043,
19737,
3858,
368,
341,
197,
10217,
821,
284,
7486,
90515,
298,
197,
18394,
486,
931,
55823,
4095,
5348,
486,
931,
2242,
486,
1499,
445,
22592,
1827,
18122,
12524,
73727,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_output_success_default() {
let program = parse_str(
r#".infer mortal(string).
.output(mortal, "file-name")."#,
)
.unwrap()
.into_parsed();
let relation = program
.intensional()
.get(&program.predicates().fetch("mortal").unwrap())
.unwrap();
assert!(relation.has_file_pragma());
let pragma = relation.file_pragma().unwrap();
assert_eq!(pragma.file_name(), &PathBuf::from("file-name"));
assert_eq!(
pragma.file_format(),
&Format::DelimitedLines(Default::default())
)
} | rust_cleaned_test_functions.jsonl/52305 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 262
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7645,
18632,
9993,
368,
341,
262,
1077,
2025,
284,
4715,
2895,
1006,
286,
435,
2,
3263,
89559,
48872,
3609,
4292,
13413,
1255,
33372,
11,
330,
1192,
11494,
1827,
57676,
345,
262,
1727,
262,
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 |
#[test]
fn test_process_blockstore_with_incomplete_slot() {
solana_logger::setup();
let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(10_000);
let ticks_per_slot = genesis_config.ticks_per_slot;
// Create a new ledger with slot 0 full of ticks
let (ledger_path, mut blockhash) = create_new_tmp_ledger_auto_delete!(&genesis_config);
debug!("ledger_path: {:?}", ledger_path);
let blockstore = Blockstore::open(ledger_path.path()).unwrap();
// Write slot 1
{
let parent_slot = 0;
let slot = 1;
let mut entries = create_ticks(ticks_per_slot, 0, blockhash);
blockhash = entries.last().unwrap().hash;
// throw away last one
entries.pop();
assert_matches!(
blockstore.write_entries(
slot,
0,
0,
ticks_per_slot,
Some(parent_slot),
false,
&Arc::new(Keypair::new()),
entries,
0,
),
Ok(_)
);
}
fill_blockstore_slot_with_ticks(&blockstore, ticks_per_slot, 2, 1, blockhash);
let opts = ProcessOptions {
poh_verify: true,
accounts_db_test_hash_calculation: true,
..ProcessOptions::default()
};
let (bank_forks, ..) = test_process_blockstore(&genesis_config, &blockstore, opts);
assert_eq!(frozen_bank_slots(&bank_forks), vec![0]);
let opts = ProcessOptions {
poh_verify: true,
accounts_db_test_hash_calculation: true,
..ProcessOptions::default()
};
fill_blockstore_slot_with_ticks(&blockstore, ticks_per_slot, 3, 0, blockhash);
// Slot 0 should not show up in the ending bank_forks_info
let (bank_forks, ..) = test_process_blockstore(&genesis_config, &blockstore, opts);
assert_eq!(frozen_bank_slots(&bank_forks), vec![0, 3]);
} | rust_cleaned_test_functions.jsonl/46793 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1131
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
7113,
4314,
6615,
1243,
14737,
27563,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
1428,
286,
1077,
40788,
2648,
1731,
314,
59366,
5332,
11,
5241,
335,
284,
1855,
16322,
13774,
5332,
7,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_legal_moves_banmen_with_kaku_nari_7_squares_and_contiguous_gote() {
let blank_banmen = Banmen([[Blank; 9]; 9]);
const OFFSETS:[(i32,i32); 4] = [
(-1,0),
(0,-1),
(0,1),
(1,0)
];
for y in 0..9 {
for o in &OFFSETS {
let mut banmen = blank_banmen.clone();
banmen.0[y][6] = GKakuN;
if y as i32 + o.1 < 0 || y as i32 + o.1 > 8 {
continue;
}
banmen.0[(y as i32+o.1) as usize][(6+o.0) as usize] = GFu;
assert_eq!(legal_moves_from_banmen(&Teban::Gote,&banmen),
Rule::legal_moves_from_banmen(Teban::Gote,&State::new(banmen.clone())).into_iter().map(|m| {
LegalMove::from(m)
}).collect::<Vec<LegalMove>>()
);
}
}
} | rust_cleaned_test_functions.jsonl/81181 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 402
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82324,
45390,
880,
276,
5676,
6615,
4698,
23557,
1089,
2780,
62,
22,
643,
40856,
8378,
10260,
27029,
1889,
1272,
368,
972,
10217,
10113,
880,
276,
5676,
284,
22730,
5676,
27119,
22770,
26,
220,
24... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_map_insert_panic() {
let mut a = SgMap::<_, _, 3>::new();
assert!(a.try_insert(1, "1").is_ok());
assert!(a.try_insert(2, "2").is_ok());
assert!(a.try_insert(3, "3").is_ok());
assert_eq!(a.try_insert(4, "4"), Err(SgError::StackCapacityExceeded));
a.insert(4, "4"); // panic
} | rust_cleaned_test_functions.jsonl/18654 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 159
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5376,
17678,
620,
31270,
368,
341,
262,
1077,
5206,
264,
284,
328,
70,
2227,
27638,
6878,
8358,
220,
18,
6831,
931,
1428,
262,
2060,
10297,
64,
48779,
17678,
7,
16,
11,
330,
16,
1827,
285,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_test_util_basic() {
let v = vec![
("abc".as_bytes(), "def".as_bytes()),
("abd".as_bytes(), "deg".as_bytes()),
];
let mut iter = TestSSIter::new(v);
assert_eq!(
iter.next(),
Some((Vec::from("abc".as_bytes()), Vec::from("def".as_bytes())))
);
} | rust_cleaned_test_functions.jsonl/61680 | {
"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,
4452,
18974,
34729,
368,
341,
286,
1077,
348,
284,
7486,
90515,
310,
3489,
13683,
3263,
300,
12524,
1507,
330,
750,
3263,
300,
12524,
14702,
310,
3489,
85920,
3263,
300,
12524,
1507,
330,
16508,
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_matches_valid_two_valid_options() {
let opts = crate::parsers::parse_options();
let argv = [
"hl".to_string(),
"-l".to_string(),
"-s".to_string(),
"txt".to_string(),
];
let matches = crate::parsers::parse_matches(&argv, opts);
assert!(matches.is_ok());
} | rust_cleaned_test_functions.jsonl/132815 | {
"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,
21039,
38344,
8337,
23241,
8337,
8743,
368,
341,
286,
1077,
12185,
284,
17717,
486,
88564,
486,
6400,
8743,
543,
286,
1077,
10213,
284,
2278,
310,
330,
17958,
3263,
983,
3904,
3148,
310,
6523,
75,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rpc_get_leader_schedule() {
let rpc = RpcHandler::start();
for params in [
None,
Some(json!([0u64])),
Some(json!([null, {"identity": rpc.leader_pubkey().to_string()}])),
Some(json!([{"identity": rpc.leader_pubkey().to_string()}])),
] {
let request = create_test_request("getLeaderSchedule", params);
let result: Option<RpcLeaderSchedule> =
parse_success_result(rpc.handle_request_sync(request));
let expected = Some(HashMap::from_iter(std::iter::once((
rpc.leader_pubkey().to_string(),
Vec::from_iter(0..=128),
))));
assert_eq!(result, expected);
}
let request = create_test_request("getLeaderSchedule", Some(json!([42424242])));
let result: Option<RpcLeaderSchedule> =
parse_success_result(rpc.handle_request_sync(request));
let expected: Option<RpcLeaderSchedule> = None;
assert_eq!(result, expected);
let request = create_test_request(
"getLeaderSchedule",
Some(json!([{"identity": Pubkey::new_unique().to_string() }])),
);
let result: Option<RpcLeaderSchedule> =
parse_success_result(rpc.handle_request_sync(request));
let expected = Some(HashMap::default());
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/6304 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 678
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60799,
3062,
79991,
34530,
368,
341,
286,
1077,
35596,
284,
79961,
3050,
486,
2468,
1428,
286,
369,
3628,
304,
2278,
310,
2240,
345,
310,
4329,
9304,
0,
2561,
15,
84,
21,
19,
87619,
310,
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... | 2 |
#[test]
fn test_comp_min() {
assert_eq!(Vector2::new(1i, 2i).comp_min(), 1i);
assert_eq!(Vector3::new(1i, 2i, 3i).comp_min(), 1i);
assert_eq!(Vector4::new(1i, 2i, 3i, 4i).comp_min(), 1i);
assert_eq!(Vector2::new(3.0f64, 4.0f64).comp_min(), 3.0f64);
assert_eq!(Vector3::new(4.0f64, 5.0f64, 6.0f64).comp_min(), 4.0f64);
assert_eq!(Vector4::new(5.0f64, 6.0f64, 7.0f64, 8.0f64).comp_min(), 5.0f64);
} | rust_cleaned_test_functions.jsonl/5667 | {
"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,
18177,
7260,
368,
341,
262,
2060,
10714,
10297,
3781,
17,
486,
931,
7,
16,
72,
11,
220,
17,
72,
568,
5689,
7260,
1507,
220,
16,
72,
317,
262,
2060,
10714,
10297,
3781,
18,
486,
931,
7,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_meta_manifest() {
let path = [
env!("CARGO_MANIFEST_DIR"),
"/../../resources/channel_manifests/manifests.txt",
]
.join("");
let meta_file = Document::LocalPath(path.into());
let buffer = meta_file.load().unwrap();
let meta_manifest = MetaManifest::try_from_str(String::from_utf8(buffer).unwrap());
assert!(meta_manifest.is_ok());
} | rust_cleaned_test_functions.jsonl/13866 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 211
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
13381,
74269,
368,
341,
286,
1077,
1815,
284,
2278,
310,
6105,
17223,
34,
7581,
46,
25143,
91120,
8291,
4461,
310,
3521,
2748,
12745,
73121,
74269,
82,
14,
42315,
82,
3909,
756,
286,
5133,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_arithmetic_plus_minus() -> Result<()> {
let test_suite = vec![
Test {
name: "f(x) = x + 12",
expr: Expression::create_binary_expression("+", vec![col("x"), lit(12i32)]),
column: "x",
left: None,
right: None,
expect_mono: Monotonicity {
is_monotonic: true,
is_positive: true,
is_constant: false,
left: None,
right: None,
},
error: "",
},
Test {
name: "f(x) = -x + 12",
expr: Expression::create_binary_expression("+", vec![
Expression::create_unary_expression("negate", vec![col("x")]),
lit(12i32),
]),
column: "x",
left: None,
right: None,
expect_mono: Monotonicity {
is_monotonic: true,
is_positive: false,
is_constant: false,
left: None,
right: None,
},
error: "",
},
Test {
name: "f(x,y) = x + y",
expr: Expression::create_binary_expression("+", vec![col("x"), col("y")]),
column: "",
left: None,
right: None,
expect_mono: Monotonicity {
is_monotonic: false,
is_positive: true,
is_constant: false,
left: None,
right: None,
},
error: "Code: 6, displayText = Multi-column expressions are not currently supported.",
},
Test {
name: "f(x) = (-x + 12) - x + (1 - x)",
expr: Expression::create_binary_expression("+", vec![
Expression::create_binary_expression("-", vec![
// -x + 12
Expression::create_binary_expression("+", vec![
Expression::create_unary_expression("negate", vec![col("x")]),
lit(12i32),
]),
col("x"),
]),
// 1 - x
Expression::create_unary_expression("negate", vec![lit(1i64), col("x")]),
]),
column: "x",
left: None,
right: None,
expect_mono: Monotonicity {
is_monotonic: true,
is_positive: false,
is_constant: false,
left: None,
right: None,
},
error: "",
},
Test {
name: "f(x) = (x + 12) - x + (1 - x)",
expr: Expression::create_binary_expression("+", vec![
Expression::create_binary_expression("-", vec![
// x + 12
Expression::create_binary_expression("+", vec![col("x"), lit(12i32)]),
col("x"),
]),
// 1 - x
Expression::create_unary_expression("negate", vec![lit(1i64), col("x")]),
]),
column: "x",
left: None,
right: None,
expect_mono: Monotonicity {
is_monotonic: false,
is_positive: false,
is_constant: false,
left: None,
right: None,
},
error: "",
},
];
for t in test_suite.into_iter() {
verify_test(t)?;
}
Ok(())
} | rust_cleaned_test_functions.jsonl/7321 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25842,
25922,
28043,
38457,
368,
1464,
5714,
71698,
341,
262,
1077,
1273,
57239,
284,
7486,
90515,
286,
3393,
341,
310,
829,
25,
330,
69,
2075,
8,
284,
856,
488,
220,
16,
17,
756,
310,
15169,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_var_decl() {
let tokens = vec![
token(Identifier, "x"),
token(Equals, ""),
token(Literal, "1"),
token(Plus, ""),
token(Literal, "2"),
token(EOF, ""),
];
assert_eq!(
parse(tokens).unwrap(),
Stmt::VarDecl(
Identifier::from_full_name("x"),
binary(literal(1f64), Plus, literal(2f64))
)
);
} | rust_cleaned_test_functions.jsonl/120436 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 299
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4612,
35814,
368,
341,
286,
1077,
11211,
284,
7486,
90515,
310,
3950,
7,
8714,
11,
330,
87,
4461,
310,
3950,
7,
4315,
11,
72712,
310,
3950,
4957,
9953,
11,
330,
16,
4461,
310,
3950,
7,
21807,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_ldrsh_imm_w() {
assert_eq!(
decode_32(0xf9bd0010),
Instruction::LDRSH_imm {
params: Reg2FullParams {
rt: Reg::R0,
rn: Reg::SP,
imm32: 0x10,
index: true,
add: true,
wback: false,
},
thumb32: true,
}
);
} | rust_cleaned_test_functions.jsonl/64804 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 271
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
50573,
81,
927,
71370,
1670,
368,
341,
1066,
262,
2060,
10714,
33673,
286,
16895,
62,
18,
17,
7,
15,
5848,
24,
8940,
15,
15,
16,
15,
1326,
286,
29051,
486,
43,
7687,
8590,
71370,
341,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_install_twice_dir() {
let dir = "dir";
let scene = TestScenario::new(util_name!());
scene.ucmd().arg("-d").arg(dir).succeeds();
scene.ucmd().arg("-d").arg(dir).succeeds();
let at = &scene.fixtures;
assert!(at.dir_exists(dir));
} | rust_cleaned_test_functions.jsonl/47013 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34245,
54178,
558,
4334,
368,
341,
262,
1077,
5419,
284,
330,
3741,
876,
262,
1077,
6109,
284,
3393,
54031,
486,
931,
67811,
1269,
0,
5231,
262,
6109,
56334,
2277,
1005,
858,
13645,
67,
1827,
85... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_string_from_gstring() {
let cstr = CString::new("foo").unwrap();
let gstring = GString::from(cstr);
assert_eq!(gstring.as_str(), "foo");
let s = String::from(gstring);
assert_eq!(s, "foo");
} | rust_cleaned_test_functions.jsonl/58210 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 128
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
5673,
1889,
917,
368,
341,
286,
1077,
272,
495,
284,
56956,
486,
931,
445,
7975,
1827,
15454,
543,
286,
1077,
342,
917,
284,
479,
703,
486,
1499,
1337,
495,
317,
286,
2060,
10714,
10297,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unexpected_last_type() {
let mut log = new_record_test();
log.write("foo");
log.set_byte(6, Last as u8);
log.fix_checksum(0, 3);
assert_eq!(EOF, log.read());
assert_eq!(3, log.dropped_bytes());
assert!(log.match_error("missing start"));
} | rust_cleaned_test_functions.jsonl/46695 | {
"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,
4907,
7325,
12195,
1819,
368,
341,
286,
1077,
5206,
1487,
284,
501,
14192,
4452,
543,
286,
1487,
3836,
445,
7975,
797,
286,
1487,
980,
19737,
7,
21,
11,
7996,
438,
575,
23,
317,
286,
1487,
677... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cap_numerical_overshoot_panic() {
let over_top = LogProb(0.00000005);
over_top.cap_numerical_overshoot(0.00000001);
} | rust_cleaned_test_functions.jsonl/59943 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 81
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16388,
99001,
938,
62,
8969,
90321,
620,
31270,
368,
341,
286,
1077,
916,
10426,
284,
2835,
36980,
7,
15,
13,
15,
15,
15,
15,
15,
15,
15,
20,
317,
286,
916,
10426,
27388,
99001,
938,
62,
896... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_2_0001_html() {
let definitions = dmntk_model::parse(dmntk_examples::DMN_2_0001).expect("parsing model 2_0001.dmn failed");
let html = crate::generate(&definitions);
assert_eq!("<!DOCTYPE html>", &html[0..15]);
fs::create_dir_all(TARGET_DIR).expect("creating target directories failed");
let mut file = File::create(format!("{}/2_0001.html", TARGET_DIR)).expect("creating file 2_0001.html failed");
file.write_all(html.as_bytes()).expect("saving file 2_0001.html failed");
} | rust_cleaned_test_functions.jsonl/34901 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 193
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
17,
62,
15,
15,
15,
16,
9564,
368,
341,
220,
1077,
17473,
284,
28676,
406,
74,
5047,
486,
6400,
1500,
40882,
74,
45279,
486,
8395,
45,
62,
17,
62,
15,
15,
15,
16,
568,
17119,
445,
79,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eq_after_rotation() {
// test that two deques are equal even if elements are laid out differently
let len = 28;
let mut ring: VecDeque<i32> = (0..len as i32).collect();
let mut shifted = ring.clone();
for _ in 0..10 {
ring.pop_front();
for elt in &mut ring {
*elt -= 1;
}
ring.push_back(len - 1);
}
// try every shift
for _ in 0..shifted.capacity() {
shifted.pop_front();
for elt in &mut shifted {
*elt -= 1;
}
shifted.push_back(len - 1);
assert_eq!(shifted, ring);
assert_eq!(ring, shifted);
}
} | rust_cleaned_test_functions.jsonl/73715 | {
"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,
10714,
19844,
44813,
368,
341,
262,
442,
1273,
429,
1378,
409,
13968,
525,
6144,
1496,
421,
5424,
525,
17113,
700,
21303,
198,
262,
1077,
2422,
284,
220,
17,
23,
280,
262,
1077,
5206,
10058,
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... | 5 |
#[test]
fn test_psi() {
let generator = G2Projective::generator();
let z = Fp2 {
c0: Fp::from_raw_unchecked([
0x0ef2ddffab187c0a,
0x2424522b7d5ecbfc,
0xc6f341a3398054f4,
0x5523ddf409502df0,
0xd55c0b5a88e0dd97,
0x066428d704923e52,
]),
c1: Fp::from_raw_unchecked([
0x538bbe0c95b4878d,
0xad04a50379522881,
0x6d5c05bf5c12fb64,
0x4ce4a069a2d34787,
0x59ea6c8d0dffaeaf,
0x0d42a083a75bd6f3,
]),
};
// `point` is a random point in the curve
let point = G2Projective {
x: Fp2 {
c0: Fp::from_raw_unchecked([
0xee4c8cb7c047eaf2,
0x44ca22eee036b604,
0x33b3affb2aefe101,
0x15d3e45bbafaeb02,
0x7bfc2154cd7419a4,
0x0a2d0c2b756e5edc,
]),
c1: Fp::from_raw_unchecked([
0xfc224361029a8777,
0x4cbf2baab8740924,
0xc5008c6ec6592c89,
0xecc2c57b472a9c2d,
0x8613eafd9d81ffb1,
0x10fe54daa2d3d495,
]),
} * z,
y: Fp2 {
c0: Fp::from_raw_unchecked([
0x7de7edc43953b75c,
0x58be1d2de35e87dc,
0x5731d30b0e337b40,
0xbe93b60cfeaae4c9,
0x8b22c203764bedca,
0x01616c8d1033b771,
]),
c1: Fp::from_raw_unchecked([
0xea126fe476b5733b,
0x85cee68b5dae1652,
0x98247779f7272b04,
0xa649c8b468c6e808,
0xb5b9a62dff0c4e45,
0x1555b67fc7bbe73d,
]),
},
z: z.square() * z,
};
assert!(bool::from(point.is_on_curve()));
assert_eq!(generator.psi2(), generator.psi().psi());
assert_eq!(point.psi2(), point.psi().psi());
assert_eq!(generator.double().psi(), generator.psi().double());
assert_eq!(point.psi() + generator.psi(), (point + generator).psi());
let mut normalized_point = [G2Affine::identity()];
G2Projective::batch_normalize(&[point], &mut normalized_point);
let normalized_point = G2Projective::from(normalized_point[0]);
assert_eq!(point.psi(), normalized_point.psi());
assert_eq!(point.psi2(), normalized_point.psi2());
} | rust_cleaned_test_functions.jsonl/47812 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1603
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
6321,
368,
341,
262,
1077,
13823,
284,
479,
17,
7849,
533,
486,
35851,
1428,
262,
1077,
1147,
284,
434,
79,
17,
341,
286,
272,
15,
25,
434,
79,
486,
1499,
16067,
4907,
7549,
8956,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_cluster_slots() {
let combos = [
(b"cluster", b"slots"),
(b"CLUSTER", b"SLOTS"),
(b"cluster", b"SLOTS"),
(b"CLUSTER", b"slots"),
];
for combo in combos {
let frame = Frame::Redis(RedisFrame::Array(vec![
RedisFrame::BulkString(Bytes::from_static(combo.0)),
RedisFrame::BulkString(Bytes::from_static(combo.1)),
]));
assert!(is_cluster_slots(&frame));
}
let frame = Frame::Redis(RedisFrame::Array(vec![
RedisFrame::BulkString(Bytes::from_static(b"GET")),
RedisFrame::BulkString(Bytes::from_static(b"key1")),
]));
assert!(!is_cluster_slots(&frame));
} | rust_cleaned_test_functions.jsonl/119984 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 423
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
28441,
54161,
368,
341,
286,
1077,
70133,
284,
2278,
310,
320,
65,
1,
18855,
497,
293,
1,
49767,
4461,
310,
320,
65,
1,
3140,
46009,
497,
293,
66310,
74602,
4461,
310,
320,
65,
1,
18855,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_resolve_files() {
let regex = Regex::new(r#"tests/demo\.log(\.(?P<rotation>\d)(\.gz)?)?"#).unwrap();
let result = FileSource::resolve_files(®ex, 0).unwrap();
assert_eq!(result.len(), 3);
assert_eq!(result.get(0), Some(&"tests/demo.log.2.gz".to_string()));
assert_eq!(result.get(1), Some(&"tests/demo.log.1".to_string()));
assert_eq!(result.get(2), Some(&"tests/demo.log".to_string()));
} | rust_cleaned_test_functions.jsonl/84670 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 225
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77291,
10931,
368,
341,
286,
1077,
20180,
284,
26146,
486,
931,
2601,
55543,
23841,
55160,
18831,
839,
11520,
12832,
30,
47,
27,
13538,
8449,
67,
2376,
18831,
46589,
8,
10170,
7521,
2,
568,
15454,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unnamed_struct() {
let test_data: Vec<u8> = [
0xFF,
0b1001_0110,
0xAA,
0xBB,
0xCC,
0xDD,
0b1001_0110,
0xCC,
0xDD,
0x02,
0xBE,
0xEF,
]
.to_vec();
// Read
let ret_read = samples::UnNamedDeku::try_from(test_data.as_ref()).unwrap();
assert_eq!(
samples::UnNamedDeku(
0xFF,
0b0000_0010,
0b0001_0110,
0xBBAA,
0xCCDD,
samples::NestedDeku {
nest_a: 0b00_100101,
nest_b: 0b10,
inner: samples::DoubleNestedDeku { data: 0xDDCC }
},
0x02,
vec![0xBE, 0xEF],
),
ret_read
);
// Write
let ret_write: Vec<u8> = ret_read.try_into().unwrap();
assert_eq!(test_data, ret_write);
} | rust_cleaned_test_functions.jsonl/123223 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 586
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
30245,
15126,
368,
341,
262,
1077,
1273,
1769,
25,
11312,
34837,
23,
29,
284,
2278,
286,
220,
15,
9264,
345,
286,
220,
15,
65,
16,
15,
15,
16,
62,
15,
16,
16,
15,
345,
286,
220,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_i2c_mock_multiple_transaction_err() {
let expectations = [
Transaction::write(0xaa, vec![10, 12]),
Transaction::write(0xaa, vec![10, 12]),
];
let mut i2c = Mock::new(&expectations);
i2c.write(0xaa, &vec![10, 12]).unwrap();
i2c.done();
} | rust_cleaned_test_functions.jsonl/49259 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 174
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5318,
17,
66,
34134,
45233,
28884,
9266,
368,
341,
286,
1077,
16665,
284,
2278,
310,
17869,
486,
4934,
7,
15,
43300,
11,
7486,
20703,
16,
15,
11,
220,
16,
17,
17036,
310,
17869,
486,
4934,
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_slice_dyninput_array_fixed() {
let mut arr = Array3::<f64>::zeros((5, 2, 5)).into_dyn();
let info = s![1.., 1, NewAxis, ..;2];
arr.slice(info);
arr.slice_mut(info);
arr.view().slice_move(info);
let info2 = s![1.., 1, ..;2];
arr.view().slice_collapse(info2);
} | rust_cleaned_test_functions.jsonl/92599 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 152
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26488,
69213,
1355,
3858,
37839,
368,
341,
262,
1077,
5206,
2890,
284,
2910,
18,
27638,
69,
21,
19,
6831,
35716,
1188,
20,
11,
220,
17,
11,
220,
20,
4579,
18122,
69213,
543,
262,
1077,
3546,
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_cleanup_first() {
let mut index = AccountsIndex::<bool>::default();
index.add_root(0);
index.add_root(1);
index.cleanup_dead_slot(0);
assert!(index.is_root(1));
assert!(!index.is_root(0));
} | rust_cleaned_test_functions.jsonl/20401 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42444,
12978,
368,
341,
286,
1077,
5206,
1922,
284,
40655,
1552,
27638,
2641,
6831,
2258,
543,
286,
1922,
1364,
12993,
7,
15,
317,
286,
1922,
1364,
12993,
7,
16,
317,
286,
1922,
87689,
53427,
27... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hashset_insert_remove() {
let mut m: HashSet<Vec<char>> = HashSet::new();
//let num: u32 = 4096;
let seed: [u8; 16] = [
130, 220, 246, 217, 111, 124, 221, 189, 190, 234, 121, 93, 67, 95, 100, 43,
];
let mut rng: XorShiftRng = SeedableRng::from_seed(seed);
let tx: Vec<Vec<char>> = (0..4096)
.map(|_| (rng.sample_iter(&Alphanumeric).take(32).collect()))
.collect();
for _ in 0..32 {
for i in 0..4096 {
assert_eq!(m.contains(&tx[i].clone()), false);
assert_eq!(m.insert(tx[i].clone()), true);
}
for i in 0..4096 {
println!("removing {} {:?}", i, tx[i]);
assert_eq!(m.remove(&tx[i]), true);
}
}
} | rust_cleaned_test_functions.jsonl/44417 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 402
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
746,
17678,
18193,
368,
341,
262,
1077,
5206,
296,
25,
18931,
50439,
21919,
2452,
284,
18931,
486,
931,
543,
262,
442,
1149,
1629,
25,
575,
18,
17,
284,
220,
19,
15,
24,
21,
280,
1066,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_checked_sub() {
assert_eq!(5u.checked_sub(&0), Some(5));
assert_eq!(5u.checked_sub(&1), Some(4));
assert_eq!(5u.checked_sub(&2), Some(3));
assert_eq!(5u.checked_sub(&3), Some(2));
assert_eq!(5u.checked_sub(&4), Some(1));
assert_eq!(5u.checked_sub(&5), Some(0));
assert_eq!(5u.checked_sub(&6), None);
assert_eq!(5u.checked_sub(&7), None);
} | rust_cleaned_test_functions.jsonl/12470 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 228
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56456,
5228,
368,
341,
286,
2060,
10714,
10297,
20,
84,
29101,
5228,
2099,
15,
701,
4329,
7,
20,
1106,
286,
2060,
10714,
10297,
20,
84,
29101,
5228,
2099,
16,
701,
4329,
7,
19,
1106,
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_array_index_expr() {
let tests = vec![
("[1, 2, 3][0]", Some(Object::Int(1))),
("[1, 2, 3][1]", Some(Object::Int(2))),
("let i = 0; [1][i]", Some(Object::Int(1))),
("[1, 2, 3][1 + 1];", Some(Object::Int(3))),
("let myArray = [1, 2, 3]; myArray[2];", Some(Object::Int(3))),
(
"let myArray = [1, 2, 3]; myArray[0] + myArray[1] + myArray[2];",
Some(Object::Int(6)),
),
(
"let myArray = [1, 2, 3]; let i = myArray[0]; myArray[i];",
Some(Object::Int(2)),
),
("[1, 2, 3][3]", Some(Object::Null)),
("[1, 2, 3][-1]", Some(Object::Null)),
];
for (input, expect) in tests {
assert_eq!(expect, eval(input));
}
} | rust_cleaned_test_functions.jsonl/12292 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 516
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
3560,
21915,
368,
341,
286,
1077,
7032,
284,
7486,
90515,
310,
3489,
58,
16,
11,
220,
17,
11,
220,
18,
1457,
15,
19076,
4329,
12526,
486,
1072,
7,
16,
41749,
310,
3489,
58,
16,
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... | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.