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_primitive_null_offset() {
let b = Primitive::<u8>::from(vec![Some(1), None, Some(3)]).to(DataType::UInt8);
let b = b.slice(1, 2);
let mut a = GrowablePrimitive::new(&[&b], false, 2);
a.extend(0, 0, 2);
let result: PrimitiveArray<u8> = a.into();
let expected = Primitive::<u8>::from(vec![None, Some(3)]).to(DataType::UInt8);
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/80111 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 216
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84087,
15162,
6917,
368,
341,
286,
1077,
293,
284,
51460,
27638,
84,
23,
6831,
1499,
25592,
20703,
8373,
7,
16,
701,
2240,
11,
4329,
7,
18,
7252,
568,
983,
63941,
486,
18777,
23,
317,
286,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invalid() {
let name = Name::from_ascii("invalid.").unwrap();
let usage = USAGE.get(&name);
assert_eq!(usage.name(), INVALID.name());
let name = Name::from_ascii("something.invalid.").unwrap();
let usage = USAGE.get(&name);
assert_eq!(usage.name(), INVALID.name());
} | rust_cleaned_test_functions.jsonl/26318 | {
"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,
31433,
368,
341,
286,
1077,
829,
284,
3988,
486,
1499,
50238,
445,
11808,
98401,
15454,
1428,
286,
1077,
10431,
284,
89740,
670,
2099,
606,
317,
286,
2060,
10714,
10297,
17698,
2644,
1507,
32269,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_branch_merge() {
let mut hdr: MapxOrdRawKeyVs<usize> = MapxOrdRawKeyVs::new();
let mvn = VersionName(b"manster0");
pnk!(hdr.version_create(mvn));
pnk!(hdr.insert(<usize as ValueEnDe>::encode(&1), 1));
let bn = BranchName(b"test");
let vn = VersionName(b"test0");
pnk!(hdr.branch_create(bn, vn, false));
let key = <usize as ValueEnDe>::encode(&2);
let value = 2;
pnk!(hdr.insert(key.clone(), value));
pnk!(hdr.branch_merge_to(bn, INITIAL_BRANCH_NAME));
pnk!(hdr.branch_set_default(INITIAL_BRANCH_NAME));
let val = pnk!(hdr.get_by_branch(&key.clone(), INITIAL_BRANCH_NAME));
assert_eq!(val, value);
} | rust_cleaned_test_functions.jsonl/53978 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 335
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28031,
20888,
368,
341,
262,
1077,
5206,
36615,
25,
5027,
87,
24621,
20015,
1592,
51737,
90244,
29,
284,
5027,
87,
24621,
20015,
1592,
51737,
486,
931,
543,
262,
1077,
23164,
77,
284,
6079,
675,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_time_32_millisecond() {
let expected = vec![
"+--------------+",
"| f |",
"+--------------+",
"| 03:05:11.111 |",
"| |",
"+--------------+",
];
check_datetime!(
i32,
DataType::Time32(TimeUnit::Millisecond),
11111111,
expected
);
} | rust_cleaned_test_functions.jsonl/39721 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 273
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
3009,
62,
18,
17,
717,
65358,
368,
341,
286,
1077,
3601,
284,
7486,
90515,
310,
6630,
42091,
10,
756,
310,
25203,
282,
310,
760,
756,
310,
6630,
42091,
10,
756,
310,
25203,
220,
15,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_error_stack() {
let mut runtime = JsRuntime::new(RuntimeOptions::default());
let result = runtime.execute(
"error_stack.js",
r#"
function assert(cond) {
if (!cond) {
throw Error("assert");
}
}
function main() {
assert(false);
}
main();
"#,
);
let expected_error = r#"Error: assert
at assert (error_stack.js:4:11)
at main (error_stack.js:9:3)
at error_stack.js:12:1"#;
assert_eq!(result.unwrap_err().to_string(), expected_error);
} | rust_cleaned_test_functions.jsonl/4866 | {
"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,
4096,
15528,
368,
341,
262,
1077,
5206,
15592,
284,
39122,
15123,
486,
931,
52610,
3798,
486,
2258,
1423,
262,
1077,
1102,
284,
15592,
7769,
1006,
414,
330,
841,
15528,
2857,
756,
414,
435,
2,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_timestamp_nanoseconds() {
assert_eq!(
parse_item::<TimestampNanosecondType>("1970-01-01T00:00:00Z").unwrap(),
0
);
let naive_datetime = NaiveDateTime::new(
NaiveDate::from_ymd(2018, 11, 13),
NaiveTime::from_hms_nano(17, 11, 10, 0),
);
assert_eq!(
parse_item::<TimestampNanosecondType>("2018-11-13T17:11:10").unwrap(),
naive_datetime_to_timestamp(&naive_datetime)
);
assert_eq!(
parse_item::<TimestampNanosecondType>("2018-11-13 17:11:10").unwrap(),
naive_datetime_to_timestamp(&naive_datetime)
);
let naive_datetime = NaiveDateTime::new(
NaiveDate::from_ymd(2018, 11, 13),
NaiveTime::from_hms_nano(17, 11, 10, 11000000),
);
assert_eq!(
parse_item::<TimestampNanosecondType>("2018-11-13T17:11:10.011").unwrap(),
naive_datetime_to_timestamp(&naive_datetime)
);
let naive_datetime = NaiveDateTime::new(
NaiveDate::from_ymd(1900, 2, 28),
NaiveTime::from_hms_nano(12, 34, 56, 0),
);
assert_eq!(
parse_item::<TimestampNanosecondType>("1900-02-28T12:34:56").unwrap(),
naive_datetime_to_timestamp(&naive_datetime)
);
} | rust_cleaned_test_functions.jsonl/16422 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 740
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
23073,
73936,
75889,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
5634,
27638,
20812,
45,
276,
960,
1297,
929,
13211,
16,
24,
22,
15,
12,
15,
16,
12,
15,
16,
51,
15,
15,
25,
15,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ground_rel() {
let schemaReplicant = prepopulated_schemaReplicant();
// Verify that we accept inline constants.
let causetq = r#"[:find ?x ?y :where [(ground [[1 "xxx"] [2 "yyy"]]) [[?x ?y]]]]"#;
let SQLCausetQ { allegrosql, args } = translate(&schemaReplicant, causetq);
assert_eq!(allegrosql, "SELECT DISTINCT `c00`.`?x` AS `?x`, `c00`.`?y` AS `?y` FROM \
(SELECT 0 AS `?x`, 0 AS `?y` WHERE 0 UNION ALL VALUES (1, $v0), (2, $v1)) AS `c00`");
assert_eq!(args, vec![make_arg("$v0", "xxx"),
make_arg("$v1", "yyy")]);
// Verify that we accept bound input constants.
let causetq = r#"[:find ?x ?y :in ?u ?v :where [(ground [[?u 1] [?v 2]]) [[?x ?y]]]]"#;
let inputs = CausetQInputs::with_value_sequence(vec![(ToUpper::from_valid_name("?u"), MinkowskiType::Long(3)),
(ToUpper::from_valid_name("?v"), MinkowskiType::Long(4)),]);
let SQLCausetQ { allegrosql, args } = translate_with_inputs(&schemaReplicant, causetq, inputs);
assert_eq!(allegrosql, "SELECT DISTINCT `c00`.`?x` AS `?x`, `c00`.`?y` AS `?y` FROM \
(SELECT 0 AS `?x`, 0 AS `?y` WHERE 0 UNION ALL VALUES (3, 1), (4, 2)) AS `c00`");
assert_eq!(args, vec![]);
} | rust_cleaned_test_functions.jsonl/90722 | {
"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,
72492,
13557,
368,
341,
262,
1077,
10802,
18327,
35237,
284,
855,
8374,
7757,
25371,
18327,
35237,
1428,
262,
442,
25429,
429,
582,
4193,
7381,
18021,
624,
262,
1077,
2162,
18187,
80,
284,
435,
55... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_newtype_struct() {
#[derive(Serialize, PartialEq, Debug)]
struct Newtype(BTreeMap<String, i32>);
let inner = Newtype(treemap!(String::from("inner") => 123));
let outer = treemap!(String::from("outer") => to_value(&inner).unwrap());
test_encode_ok(&[(inner, r#"{"inner":123}"#)]);
test_encode_ok(&[(outer, r#"{"outer":{"inner":123}}"#)]);
} | rust_cleaned_test_functions.jsonl/29825 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
5921,
1313,
15126,
368,
341,
262,
11506,
27098,
3759,
9050,
11,
55039,
11,
11091,
5563,
262,
2036,
1532,
1313,
5349,
6533,
2227,
3464,
11,
600,
18,
17,
29,
626,
262,
1077,
9179,
284,
1532,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_binary_search() {
assert_eq!(binary_search(&(0..127), "FBFBBFF", 'F', 'B'), 44);
assert_eq!(binary_search(&(0..7), "RLR", 'L', 'R'), 5);
} | rust_cleaned_test_functions.jsonl/114229 | {
"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,
31761,
10716,
368,
341,
262,
2060,
10714,
10297,
25891,
10716,
29089,
15,
496,
16,
17,
22,
701,
330,
16208,
37,
10098,
1748,
497,
364,
37,
516,
364,
33,
4567,
220,
19,
19,
317,
262,
2060,
1071... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_json_rpc_http_errors() {
let (_mock_db, _runtime, url, _) = create_db_and_runtime();
let client = reqwest::blocking::Client::new();
// check that only root path is accessible
let fake_path = format!("{}/fake_path", url);
let resp = client.get(&fake_path).send().unwrap();
assert_eq!(resp.status(), 404);
// only post method is allowed
let resp = client.get(&url).send().unwrap();
assert_eq!(resp.status(), 405, "{}", url);
// empty payload is not allowed
let resp = client.post(&url).send().unwrap();
assert_eq!(resp.status(), 400);
// For now /v1 and / are both supported
let url_v1 = format!("{}/v1", url);
let resp = client.post(&url_v1).send().unwrap();
assert_eq!(resp.status(), 400);
let resp = client.post(&url).body("non json").send().unwrap();
assert_eq!(resp.status(), 400);
let resp = client
.post(&url)
.json(&json!({ "id": gen_string(DEFAULT_CONTENT_LENGTH_LIMIT) }))
.send()
.unwrap();
assert_eq!(resp.status(), 413); // 413 is Payload Too Large
} | rust_cleaned_test_functions.jsonl/46601 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 440
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9455,
60799,
25888,
20196,
368,
341,
262,
1077,
5453,
16712,
8685,
11,
716,
22255,
11,
2515,
11,
27439,
284,
1855,
8685,
8378,
33232,
1428,
262,
1077,
2943,
284,
4232,
11039,
486,
70356,
486,
2959... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_new_to_msg_with_tag_rekey() {
let before_internal_key: [u8; 32] = [
23u8, 45u8, 143u8, 75u8, 14u8, 65u8, 110u8, 208u8, 6u8, 34u8, 38u8, 33u8, 64u8, 116u8,
179u8, 244u8, 8u8, 121u8, 32u8, 23u8, 87u8, 135u8, 147u8, 246u8, 88u8, 52u8, 219u8,
33u8, 44u8, 68u8, 91u8, 135u8,
];
let before_internal_nonce: [u8; 12] = [
1u8, 0u8, 0u8, 0u8, 97u8, 98u8, 97u8, 97u8, 98u8, 97u8, 98u8, 0u8,
];
let before_internal_counter: [u8; 4] = [1u8, 0u8, 0u8, 0u8];
let after_internal_key: [u8; 32] = [
39u8, 159u8, 44u8, 102u8, 206u8, 161u8, 116u8, 119u8, 163u8, 187u8, 45u8, 209u8, 172u8,
224u8, 237u8, 93u8, 9u8, 197u8, 138u8, 242u8, 195u8, 183u8, 253u8, 169u8, 86u8, 46u8,
161u8, 32u8, 71u8, 244u8, 51u8, 222u8,
];
let after_internal_nonce: [u8; 12] = [
1u8, 0u8, 0u8, 0u8, 161u8, 222u8, 206u8, 42u8, 195u8, 117u8, 85u8, 88u8,
];
let after_internal_counter: [u8; 4] = [1u8, 0u8, 0u8, 0u8];
let out: [u8; 68] = [
254u8, 148u8, 0u8, 209u8, 14u8, 130u8, 100u8, 227u8, 231u8, 72u8, 231u8, 21u8, 186u8,
18u8, 26u8, 148u8, 110u8, 96u8, 90u8, 46u8, 114u8, 110u8, 169u8, 51u8, 16u8, 116u8,
48u8, 34u8, 119u8, 48u8, 212u8, 203u8, 18u8, 137u8, 21u8, 223u8, 114u8, 94u8, 129u8,
255u8, 198u8, 22u8, 78u8, 206u8, 9u8, 223u8, 135u8, 107u8, 224u8, 192u8, 4u8, 94u8,
187u8, 26u8, 216u8, 136u8, 169u8, 121u8, 52u8, 215u8, 102u8, 180u8, 177u8, 255u8, 69u8,
135u8, 172u8, 22u8,
];
let mut ctx = StreamXChaCha20Poly1305::new(&SecretKey::from(KEY), &Nonce::from(NONCE));
assert_eq!(ctx.key.unprotected_as_bytes(), before_internal_key.as_ref());
assert_eq!(ctx.get_nonce(), before_internal_nonce.as_ref());
assert_eq!(ctx.counter, u32::from_le_bytes(before_internal_counter));
let mut actual = [0u8; 68];
ctx.seal_chunk(DEFAULT_MSG.as_ref(), None, &mut actual, &StreamTag::Rekey)
.unwrap();
assert_eq!(ctx.key.unprotected_as_bytes(), after_internal_key.as_ref());
assert_eq!(ctx.get_nonce(), after_internal_nonce.as_ref());
assert_eq!(ctx.counter, u32::from_le_bytes(after_internal_counter));
assert_eq!(actual.as_ref(), out.as_ref());
} | rust_cleaned_test_functions.jsonl/75573 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1398
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
2346,
6483,
6615,
9372,
1288,
792,
368,
341,
286,
1077,
1573,
23472,
3097,
25,
508,
84,
23,
26,
220,
18,
17,
60,
284,
2278,
310,
220,
17,
18,
84,
23,
11,
220,
19,
20,
84,
23,
11,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_statistics_debug() {
let stats = Statistics::int32(Some(1), Some(12), None, 12, true);
assert_eq!(
format!("{:?}", stats),
"Int32({min: Some(1), max: Some(12), distinct_count: None, null_count: 12, \
min_max_deprecated: true})"
);
let stats = Statistics::int32(None, None, None, 7, false);
assert_eq!(
format!("{:?}", stats),
"Int32({min: None, max: None, distinct_count: None, null_count: 7, \
min_max_deprecated: false})"
)
} | rust_cleaned_test_functions.jsonl/15832 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 293
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49569,
15446,
368,
341,
286,
1077,
10472,
284,
24624,
486,
396,
18,
17,
65405,
7,
16,
701,
4329,
7,
16,
17,
701,
2240,
11,
220,
16,
17,
11,
830,
317,
286,
2060,
10714,
33673,
310,
3561,
8892... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_input1() {
let content = "939
7,13,x,x,59,x,31,19";
let input = input_generator(content);
let result = solve_part1(&input);
assert_eq!(result, 295);
} | rust_cleaned_test_functions.jsonl/103593 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 88
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5898,
16,
368,
341,
262,
1077,
2213,
284,
330,
24,
18,
24,
198,
22,
11,
16,
18,
12803,
12803,
11,
20,
24,
12803,
11,
18,
16,
11,
16,
24,
876,
262,
1077,
1946,
284,
1946,
25813,
15063,
317,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sty_zero() {
let mut cpu = mock_cpu(&[0x84, 0x10]);
cpu.Y = 0xff;
let mut result = cpu.read_at(0x0010);
assert!(result == 0x00, "expected 0x00, got {:#x}", result);
cpu.step(None);
result = cpu.read_at(0x0010);
assert!(result == 0xff, "expected 0xff, got {:#x}", result);
} | rust_cleaned_test_functions.jsonl/86661 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 180
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
88,
19359,
368,
341,
286,
1077,
5206,
17319,
284,
7860,
21795,
2099,
58,
15,
87,
23,
19,
11,
220,
15,
87,
16,
15,
2558,
286,
17319,
7507,
284,
220,
15,
9020,
401,
286,
1077,
5206,
1102... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tile_restoration_write() {
let (fi, mut fs, mut fb, frame_rate) = setup(256, 256);
{
let ti = TilingInfo::from_target_tiles(
fi.sb_size_log2(),
fi.width,
fi.height,
frame_rate,
1,
1,
false,
);
let iter = ti.tile_iter_mut(&mut fs, &mut fb);
let mut tile_states = iter.map(|ctx| ctx.ts).collect::<Vec<_>>();
{
/ let units = &mut tile_states[0].restoration.planes[0].units;
units[0][1].filter =
RestorationFilter::Wiener { coeffs: [[1, 2, 3], [4, 5, 6]] };
}
{
/ let units = &mut tile_states[3].restoration.planes[1].units;
units[1][0].filter =
RestorationFilter::Sgrproj { set: 42, xqd: [10, 20] };
}
{
/ let units = &mut tile_states[2].restoration.planes[2].units;
units[1][1].filter =
RestorationFilter::Sgrproj { set: 5, xqd: [1, 2] };
}
}
// check that writes on tiles correctly affected the underlying restoration units
let units = &mut fs.restoration.planes[0].units;
assert_eq!(
units[0][1].filter,
RestorationFilter::Wiener { coeffs: [[1, 2, 3], [4, 5, 6]] }
);
let units = &mut fs.restoration.planes[1].units;
assert_eq!(
units[3][2].filter,
RestorationFilter::Sgrproj { set: 42, xqd: [10, 20] }
);
let units = &mut fs.restoration.planes[2].units;
assert_eq!(
units[3][1].filter,
RestorationFilter::Sgrproj { set: 5, xqd: [1, 2] }
);
} | rust_cleaned_test_functions.jsonl/30659 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 779
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29844,
32231,
7614,
9165,
368,
341,
262,
1077,
320,
9983,
11,
5206,
8619,
11,
5206,
25469,
11,
4034,
9246,
8,
284,
6505,
7,
17,
20,
21,
11,
220,
17,
20,
21,
626,
262,
341,
310,
1077,
8988,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_validator_vargs_fn_with_min_args() {
// Correct signature
let node = ExprDefBuilder::scalar_func(ScalarFuncSig::CastIntAsJson, FieldTypeTp::LongLong)
.push_child(ExprDefBuilder::constant_real(3.0))
.push_child(ExprDefBuilder::constant_real(5.0))
.build();
let exp = RpnExpressionBuilder::build_from_expr_tree_with_fn_mapper(node, fn_mapper, 0);
assert!(exp.is_ok());
// Insufficient arguments
let node = ExprDefBuilder::scalar_func(ScalarFuncSig::CastIntAsJson, FieldTypeTp::LongLong)
.push_child(ExprDefBuilder::constant_real(3.0))
.build();
let exp = RpnExpressionBuilder::build_from_expr_tree_with_fn_mapper(node, fn_mapper, 0);
assert!(exp.is_err());
// Incorrect return type
let node = ExprDefBuilder::scalar_func(ScalarFuncSig::CastIntAsJson, FieldTypeTp::Double)
.push_child(ExprDefBuilder::constant_real(3.0))
.push_child(ExprDefBuilder::constant_real(5.0))
.build();
let exp = RpnExpressionBuilder::build_from_expr_tree_with_fn_mapper(node, fn_mapper, 0);
assert!(exp.is_err());
// Incorrect types
let node = ExprDefBuilder::scalar_func(ScalarFuncSig::CastIntAsJson, FieldTypeTp::LongLong)
.push_child(ExprDefBuilder::constant_real(3.0))
.push_child(ExprDefBuilder::constant_real(5.0))
.push_child(ExprDefBuilder::constant_int(42))
.build();
let exp = RpnExpressionBuilder::build_from_expr_tree_with_fn_mapper(node, fn_mapper, 0);
assert!(exp.is_err());
} | rust_cleaned_test_functions.jsonl/103952 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 795
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64959,
2273,
2116,
15246,
6615,
7260,
8384,
368,
341,
286,
442,
39970,
11957,
198,
286,
1077,
2436,
284,
28819,
2620,
3297,
486,
35342,
9596,
7,
20639,
9626,
47246,
486,
18714,
1072,
2121,
5014,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_partition_template() {
use management::partition_template::part::{ColumnFormat, Part};
let protobuf = management::PartitionTemplate {
parts: vec![
management::partition_template::Part {
part: Some(Part::Time("time".to_string())),
},
management::partition_template::Part {
part: Some(Part::Table(Empty {})),
},
management::partition_template::Part {
part: Some(Part::Regex(ColumnFormat {
column: "column".to_string(),
format: "format".to_string(),
})),
},
],
};
let pt: PartitionTemplate = protobuf.clone().try_into().unwrap();
let back: management::PartitionTemplate = pt.clone().into();
assert_eq!(
pt.parts,
vec![
TemplatePart::TimeFormat("time".to_string()),
TemplatePart::Table,
TemplatePart::RegexCapture(RegexCapture {
column: "column".to_string(),
regex: "format".to_string()
})
]
);
assert_eq!(protobuf, back);
} | rust_cleaned_test_functions.jsonl/65180 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 707
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43840,
8693,
368,
341,
286,
990,
6240,
486,
40998,
8693,
486,
4480,
22964,
2933,
4061,
11,
3660,
2315,
286,
1077,
69634,
284,
6240,
486,
49978,
7275,
341,
310,
5479,
25,
7486,
90515,
394,
6240,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bad_form_submissions() {
run_test!(|client, _conn| {
let res = client.post("/todo")
.header(ContentType::Form)
.dispatch();
let mut cookies = res.headers().get("Set-Cookie");
assert_eq!(res.status(), Status::UnprocessableEntity);
assert!(!cookies.any(|value| value.contains("error")));
// Submit a form with an empty description. We look for 'error' in the
// cookies which corresponds to flash message being set as an error.
let res = client.post("/todo")
.header(ContentType::Form)
.body("description=")
.dispatch();
let mut cookies = res.headers().get("Set-Cookie");
assert!(cookies.any(|value| value.contains("error")));
let res = client.post("/todo")
.header(ContentType::Form)
.body("evil=smile")
.dispatch();
let mut cookies = res.headers().get("Set-Cookie");
assert_eq!(res.status(), Status::UnprocessableEntity);
assert!(!cookies.any(|value| value.contains("error")));
})
} | rust_cleaned_test_functions.jsonl/32835 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 512
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34199,
7915,
5228,
5176,
368,
341,
262,
1598,
4452,
10297,
91,
2972,
11,
716,
5148,
91,
341,
1789,
286,
1077,
592,
284,
2943,
6542,
4283,
17370,
1138,
310,
659,
2708,
7,
29504,
486,
1838,
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... | 1 |
#[test]
fn test_run_check_duplicate() {
let blockstore_path = get_tmp_ledger_path!();
let blockstore = Arc::new(Blockstore::open(&blockstore_path).unwrap());
let (sender, receiver) = unbounded();
let (shreds, _) = make_many_slot_entries(5, 5, 10);
blockstore
.insert_shreds(shreds.clone(), None, false)
.unwrap();
let mut duplicate_shred = shreds[1].clone();
duplicate_shred.set_slot(shreds[0].slot());
let duplicate_shred_slot = duplicate_shred.slot();
sender.send(duplicate_shred).unwrap();
assert!(!blockstore.has_duplicate_shreds_in_slot(duplicate_shred_slot));
run_check_duplicate(&blockstore, &receiver).unwrap();
assert!(blockstore.has_duplicate_shreds_in_slot(duplicate_shred_slot));
} | rust_cleaned_test_functions.jsonl/21527 | {
"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,
14007,
7200,
70434,
368,
341,
286,
1077,
2504,
4314,
2638,
284,
633,
16125,
38367,
1389,
2638,
0,
543,
286,
1077,
2504,
4314,
284,
19689,
486,
931,
55243,
4314,
486,
2508,
2099,
4574,
4314,
2638,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stats() {
let mut balloon = Balloon::new(0, true, true, 1, false).unwrap();
let mem = default_mem();
let statsq = VirtQueue::new(GuestAddress(0), &mem, 16);
balloon.set_queue(STATS_INDEX, statsq.create_queue());
balloon.activate(mem.clone()).unwrap();
let mut event_manager = EventManager::new().unwrap();
let queue_evt = EpollEvent::new(
EventSet::IN,
balloon.queue_evts[STATS_INDEX].as_raw_fd() as u64,
);
let page_addr = 0x100;
// Error case: forgot to trigger stats event queue.
{
set_request(&statsq, 0, 0x1000, SIZE_OF_STAT as u32, VIRTQ_DESC_F_NEXT);
check_metric_after_block!(
METRICS.balloon.event_fails,
1,
balloon.process(&queue_evt, &mut event_manager)
);
// Verify that nothing got processed.
assert_eq!(statsq.used.idx.get(), 0);
}
// Happy case.
{
let swap_out_stat = BalloonStat {
tag: VIRTIO_BALLOON_S_SWAP_OUT,
val: 0x1,
};
let mem_free_stat = BalloonStat {
tag: VIRTIO_BALLOON_S_MEMFREE,
val: 0x5678,
};
// Write the stats in memory.
mem.write_obj::<BalloonStat>(swap_out_stat, GuestAddress(page_addr))
.unwrap();
mem.write_obj::<BalloonStat>(
mem_free_stat,
GuestAddress(page_addr + SIZE_OF_STAT as u64),
)
.unwrap();
set_request(
&statsq,
0,
page_addr,
2 * SIZE_OF_STAT as u32,
VIRTQ_DESC_F_NEXT,
);
check_metric_after_block!(METRICS.balloon.stats_updates_count, 1, {
// Trigger the queue event.
balloon.queue_events()[STATS_INDEX].write(1).unwrap();
balloon.process(&queue_evt, &mut event_manager);
// Don't check for completion yet.
});
let stats = balloon.latest_stats();
let expected_stats = BalloonStats {
swap_out: Some(0x1),
free_memory: Some(0x5678),
..BalloonStats::default()
};
assert_eq!(stats, &expected_stats);
// we could just process the timer event and it would not
// return an error.
std::thread::sleep(Duration::from_secs(1));
check_metric_after_block!(METRICS.balloon.event_fails, 0, {
// descriptor index and signals the used queue.
assert!(balloon.stats_desc_index.is_some());
assert!(balloon.process_stats_timer_event().is_ok());
assert!(balloon.stats_desc_index.is_none());
assert_eq!(balloon.interrupt_evt().read().unwrap(), 1);
});
}
} | rust_cleaned_test_functions.jsonl/133176 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1667
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15381,
368,
341,
286,
1077,
5206,
46756,
284,
19420,
31335,
486,
931,
7,
15,
11,
830,
11,
830,
11,
220,
16,
11,
895,
568,
15454,
543,
286,
1077,
1833,
284,
1638,
12976,
543,
286,
1077,
10472,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cast_errors() {
let ns = parse_and_resolve(
"contract test {
function foo(uint bar) public {
bool is_nonzero = bar;
}
}",
Target::default_substrate(),
);
assert_eq!(
first_error(ns.diagnostics),
"conversion from uint256 to bool not possible"
);
let ns = parse_and_resolve(
"contract test {
function foobar(uint foo, int bar) public returns (bool) {
return (foo < bar);
}
}",
Target::default_substrate(),
);
assert_eq!(
first_error(ns.diagnostics),
"implicit conversion would change sign from uint256 to int256"
);
let ns = parse_and_resolve(
"contract test {
function foobar(int32 foo, uint16 bar) public returns (bool) {
foo = bar;
return false;
}
}",
Target::default_substrate(),
);
no_errors(ns.diagnostics);
let ns = parse_and_resolve(
"contract test {
function foobar(uint32 foo, int16 bar) public returns (bool) {
foo = bar;
return false;
}
}",
Target::default_substrate(),
);
assert_eq!(
first_error(ns.diagnostics),
"implicit conversion would change sign from int16 to uint32"
);
let ns = parse_and_resolve(
"contract foo {
uint bar;
function set_bar(uint32 b) public {
bar = b;
}
function get_bar() public returns (uint32) {
return uint32(bar);
}
}
contract foo2 {
enum X { Y1, Y2, Y3}
X y;
function set_x(uint32 b) public {
y = X(b);
}
function get_x() public returns (uint32) {
return uint32(y);
}
function set_enum_x(X b) public {
set_x(uint32(b));
}
}",
Target::default_substrate(),
);
no_errors(ns.diagnostics);
} | rust_cleaned_test_functions.jsonl/86986 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5303,
20196,
368,
341,
262,
1077,
12268,
284,
4715,
8378,
77291,
1006,
286,
330,
20257,
1273,
341,
310,
729,
15229,
8488,
3619,
8,
584,
341,
394,
1807,
374,
21637,
14154,
284,
3619,
280,
310,
45... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_recipient_valid() {
let expected_str: &str = r#"
{
"type": "operator",
"and": [
{
"type": "audience",
"audienceGroupId": 5614991017776
},
{
"type": "operator",
"not": {
"type": "redelivery",
"requestId": "5b59509c-c57b-11e9-aa8c-2a2ae2dbcce4"
}
}
]
}
"#;
let expected_json: Value = serde_json::from_str(expected_str).unwrap();
let redelivery: Redelivery = Redelivery {
request_id: String::from("5b59509c-c57b-11e9-aa8c-2a2ae2dbcce4"),
};
let operator_rec: Operator = Operator {
not: Some(Box::new(RecipientType::Redelivery(redelivery))),
or: None,
and: None,
};
let audience: Audience = Audience {
audience_group_id: 5614991017776,
};
let operator: Operator = Operator {
not: None,
or: None,
and: Some(vec![
RecipientType::Audience(audience),
RecipientType::Operator(operator_rec),
]),
};
let recipient: Recipient = Recipient {
r#type: RecipientType::Operator(operator),
};
assert_eq!(json!(recipient), expected_json);
} | rust_cleaned_test_functions.jsonl/78166 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 937
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7080,
14117,
8337,
368,
341,
286,
1077,
3601,
2895,
25,
609,
495,
284,
435,
2,
698,
310,
341,
394,
330,
1313,
788,
330,
7884,
756,
394,
330,
437,
788,
2278,
503,
341,
664,
330,
1313,
788,
33... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_initialization() {
const SAMPLE_SIZE: usize = 1_000_000;
let mut rng = rand::thread_rng();
let keys: Vec<u64> = (0..SAMPLE_SIZE).map(|_| rng.gen()).collect();
let filter = Fuse32::try_from(&keys).unwrap();
for key in keys {
assert!(filter.contains(&key));
}
} | rust_cleaned_test_functions.jsonl/32212 | {
"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,
15809,
2022,
368,
341,
286,
733,
62420,
4098,
25,
22301,
284,
220,
16,
62,
15,
15,
15,
62,
15,
15,
15,
280,
286,
1077,
5206,
28422,
284,
10382,
486,
4528,
66849,
543,
286,
1077,
6894,
25,
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_vote_round_trip() {
let mut rng = rand::thread_rng();
let vote = vote_state::Vote::new(
vec![1, 3, 7], // slots
safecoin_sdk::hash::new_rand(&mut rng),
);
let ix = vote_instruction::vote(
&Pubkey::new_unique(), // vote_pubkey
&Pubkey::new_unique(), // authorized_voter_pubkey
vote,
);
let tx = Transaction::new_with_payer(
&[ix], // instructions
Some(&Pubkey::new_unique()), // payer
);
let vote = Vote::new(
Pubkey::new_unique(), // from
tx,
rng.gen(), // wallclock
);
assert_eq!(vote.slot, Some(7));
let bytes = bincode::serialize(&vote).unwrap();
let other = bincode::deserialize(&bytes[..]).unwrap();
assert_eq!(vote, other);
assert_eq!(other.slot, Some(7));
let bytes = bincode::options().serialize(&vote).unwrap();
let other = bincode::options().deserialize(&bytes[..]).unwrap();
assert_eq!(vote, other);
assert_eq!(other.slot, Some(7));
} | rust_cleaned_test_functions.jsonl/14894 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 592
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54360,
29896,
63883,
368,
341,
286,
1077,
5206,
28422,
284,
10382,
486,
4528,
66849,
543,
286,
1077,
6910,
284,
6910,
4387,
486,
41412,
486,
931,
1006,
310,
7486,
20703,
16,
11,
220,
18,
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_latest_block() {
let mut light_chain = LightChain::default_with_length(1);
let first_block = light_chain.latest_block();
assert_eq!(1, first_block.height());
light_chain.advance_chain();
let second_block = light_chain.latest_block();
assert_eq!(2, second_block.height());
} | rust_cleaned_test_functions.jsonl/10099 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 150
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64880,
7113,
368,
341,
286,
1077,
5206,
3100,
30583,
284,
8658,
18837,
486,
2258,
6615,
5118,
7,
16,
317,
286,
1077,
1156,
7113,
284,
3100,
30583,
84329,
7113,
543,
286,
2060,
10714,
10297,
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_clone_shared_does_not_drop_its_contents_when_1_ref_is_dropped() {
let mock_handle = Box::into_raw(Box::new(MockGarbageCollector::default()));
let count = Arc::new(AtomicUsize::new(1));
let value = RefCounter::new(count.clone());
let shared = SharedGeneric::<RefCounter, MockGarbageCollector, MockNode<RefCounter>>::new(
mock_handle,
value,
);
let _shared2 = shared.clone();
assert_eq!(
count.load(Ordering::Relaxed),
1,
"contents were dropped but there're still refs"
);
std::mem::drop(shared);
assert_eq!(
count.load(Ordering::Relaxed),
1,
"contents were dropped but there're still refs"
);
} | rust_cleaned_test_functions.jsonl/48710 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 394
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54742,
20405,
96374,
7913,
29584,
62,
1199,
16682,
47636,
62,
16,
7793,
6892,
814,
41716,
368,
341,
286,
1077,
7860,
10630,
284,
8261,
486,
18122,
16067,
67758,
486,
931,
66436,
43930,
20652,
53694,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_file_read() {
let source = CodeSource::file("test.c");
let mut reader = SourceReader::new(source);
loop {
let c = reader.current();
println!("{:?} => {:?}", c as char, reader.span());
if c == 0 { break; }
reader.shift();
}
} | rust_cleaned_test_functions.jsonl/31198 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 169
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2458,
6443,
368,
341,
286,
1077,
2530,
284,
6119,
3608,
486,
1192,
445,
1944,
520,
3071,
286,
1077,
5206,
6604,
284,
8748,
5062,
486,
931,
12437,
626,
286,
6337,
341,
310,
1077,
272,
284,
6604,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_load_dirty_with_name_abort() {
for answer in NO_ANSWERS {
Tester::default()
.add_input_chars("modified named file\n")
.add_input_chars(answer)
.write_file("other.bas", "other file\n")
.set_program(Some("MEMORY:/named.bas"), "previous contents\n")
.run("EDIT: LOAD \"other.bas\"")
.expect_prints([
"Current program MEMORY:/named.bas has unsaved changes!",
"LOAD aborted; use SAVE to save your current changes.",
])
.expect_program(
Some("MEMORY:/named.bas"),
"previous contents\nmodified named file\n",
)
.expect_file("MEMORY:/other.bas", "other file\n")
.check();
}
} | rust_cleaned_test_functions.jsonl/112746 | {
"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,
12411,
63642,
6615,
1269,
70907,
368,
341,
286,
369,
4226,
304,
5664,
67752,
54,
4321,
341,
310,
76816,
486,
2258,
741,
394,
659,
718,
5898,
37418,
445,
27162,
6941,
1034,
1699,
1138,
394,
659,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_numeric_invalid_object() {
let mut params = Map::new();
let mut items = Map::new();
items.assign("foo", Value::U64(1)).ok();
items.assign("bar", Value::U64(2)).ok();
items.assign("baz", Value::U64(3)).ok();
params.assign("numeric", Value::Map(items.clone())).ok();
let mut rules = BTreeMap::new();
rules.insert("numeric", vec![Rule::Numeric]);
let result = validate(&rules, params);
assert!(result.is_err());
assert_eq!(*result.unwrap_err().get("numeric").unwrap(),
vec!["The numeric field must be numeric.".to_owned()]);
} | rust_cleaned_test_functions.jsonl/74445 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 247
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29418,
31433,
5314,
368,
341,
262,
1077,
5206,
3628,
284,
5027,
486,
931,
543,
262,
1077,
5206,
3589,
284,
5027,
486,
931,
543,
262,
3589,
17870,
445,
7975,
497,
5162,
486,
52,
21,
19,
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_pubkeys_sigs_of() {
let key1 = Pubkey::new_rand();
let key2 = Pubkey::new_rand();
let sig1 = Keypair::new().sign_message(&[0u8]);
let sig2 = Keypair::new().sign_message(&[1u8]);
let signer1 = format!("{}={}", key1, sig1);
let signer2 = format!("{}={}", key2, sig2);
let matches = app().clone().get_matches_from(vec![
"test",
"--multiple",
&signer1,
"--multiple",
&signer2,
]);
assert_eq!(
pubkeys_sigs_of(&matches, "multiple"),
Some(vec![(key1, sig1), (key2, sig2)])
);
} | rust_cleaned_test_functions.jsonl/43380 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 368
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34014,
10563,
643,
14462,
3575,
368,
341,
286,
1077,
1376,
16,
284,
22611,
792,
486,
931,
33864,
543,
286,
1077,
1376,
17,
284,
22611,
792,
486,
931,
33864,
543,
286,
1077,
8366,
16,
284,
6569,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_link_no_circular() {
let (at, mut ucmd) = at_and_ucmd!();
let link = "test_link_no_circular";
ucmd.args(&[link, link])
.fails()
.stderr_is("link: error: No such file or directory (os error 2)\n");
assert!(!at.file_exists(link));
} | rust_cleaned_test_functions.jsonl/64116 | {
"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,
7233,
6536,
666,
21472,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
1077,
2656,
284,
330,
1944,
7233,
6536,
666,
21472,
3302,
262,
575,
871... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_opalkelly_xem_6010_fir() {
let mut uut = OpalKellyFIRTest::new::<XEM6010>();
uut.hi.link_connect_dest();
uut.connect_all();
XEM6010::synth(uut, target_path!("xem_6010/fir"));
test_opalkelly_fir_runtime(target_path!("xem_6010/fir/top.bit")).unwrap();
} | rust_cleaned_test_functions.jsonl/32181 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 147
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10287,
1692,
11896,
3212,
336,
62,
21,
15,
16,
15,
761,
404,
368,
341,
262,
1077,
5206,
575,
332,
284,
10672,
278,
69072,
37,
2801,
2271,
486,
931,
27638,
55,
2716,
21,
15,
16,
15,
3913,
262... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sifnis() {
// should return a Vector containing:
// "foo \"a | b\" "
// " bar \"c | d\" "
// " baz \"e | f\""
let ret = split_if_not_in_string("foo \"a | b\" | bar \"c | d\" | baz \"e | f\"", '|');
assert_eq!(ret.len(), 3);
assert_eq!(ret[0], "foo \"a | b\" ");
assert_eq!(ret[1], " bar \"c | d\" ");
assert_eq!(ret[2], " baz \"e | f\"");
} | rust_cleaned_test_functions.jsonl/62385 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 202
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
333,
25151,
368,
341,
262,
442,
1265,
470,
264,
4196,
8482,
510,
262,
442,
256,
330,
7975,
7245,
64,
760,
293,
2105,
6228,
262,
442,
256,
330,
3619,
7245,
66,
760,
294,
2105,
6228,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serde_roundtrip() {
::init().unwrap();
let s = Structure::builder("test")
.field("f1", &"abc")
.field("f2", &"bcd".to_owned())
.field("f3", &123i32)
.field("fraction", &Fraction::new(1, 2))
.field("date", &Date::new_dmy(19, DateMonth::August, 2019))
.field(
"date_time",
&DateTime::new(2f32, 2019, 8, 19, 13, 34, 42f64).unwrap(),
)
.field("array", &Array::new(&[&1, &2]))
.build();
let s_ser = ron::ser::to_string(&s).unwrap();
let s_de: Structure = ron::de::from_str(s_ser.as_str()).unwrap();
assert_eq!(s_de.as_ref(), s.as_ref());
} | rust_cleaned_test_functions.jsonl/84743 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 418
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75861,
450,
29896,
32981,
368,
341,
286,
3504,
2327,
1005,
15454,
1428,
286,
1077,
274,
284,
28596,
486,
17850,
445,
1944,
1138,
310,
659,
2566,
445,
69,
16,
497,
609,
1,
13683,
1138,
310,
659,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_proposal_v1_to_v2_serialisation_roundtrip() {
// Arrange
let proposal_v1_source = ProposalV1 {
account_type: GovernanceAccountType::ProposalV1,
governance: Pubkey::new_unique(),
governing_token_mint: Pubkey::new_unique(),
state: ProposalState::Executing,
token_owner_record: Pubkey::new_unique(),
signatories_count: 5,
signatories_signed_off_count: 4,
yes_votes_count: 100,
no_votes_count: 80,
instructions_executed_count: 7,
instructions_count: 8,
instructions_next_index: 9,
draft_at: 200,
signing_off_at: Some(201),
voting_at: Some(202),
voting_at_slot: Some(203),
voting_completed_at: Some(204),
executing_at: Some(205),
closed_at: Some(206),
execution_flags: InstructionExecutionFlags::None,
max_vote_weight: Some(250),
vote_threshold_percentage: Some(VoteThresholdPercentage::YesVote(65)),
name: "proposal".to_string(),
description_link: "proposal-description".to_string(),
};
let mut account_data = vec![];
proposal_v1_source.serialize(&mut account_data).unwrap();
let program_id = Pubkey::new_unique();
let info_key = Pubkey::new_unique();
let mut lamports = 10u64;
let account_info = AccountInfo::new(
&info_key,
false,
false,
&mut lamports,
&mut account_data[..],
&program_id,
false,
Epoch::default(),
);
// Act
let proposal_v2 = get_proposal_data(&program_id, &account_info).unwrap();
proposal_v2
.serialize(&mut &mut **account_info.data.borrow_mut())
.unwrap();
// Assert
let proposal_v1_target =
get_account_data::<ProposalV1>(&program_id, &account_info).unwrap();
assert_eq!(proposal_v1_source, proposal_v1_target)
} | rust_cleaned_test_functions.jsonl/75471 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1060
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21663,
32556,
2273,
16,
2346,
2273,
17,
25602,
7923,
29896,
32981,
368,
341,
286,
442,
40580,
271,
286,
1077,
13734,
2273,
16,
10347,
284,
65890,
53,
16,
341,
310,
2692,
1819,
25,
80589,
7365,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_string_index() -> anyhow::Result<()> {
fn test_str(str: &str) -> anyhow::Result<()> {
let chars = str.chars().collect::<Vec<char>>();
let heap = Heap::new();
let val = heap.alloc(str);
let len = chars.len() as i32;
assert_eq!(val.length()?, len);
for (i, char) in chars.iter().enumerate() {
let char_str = char.to_string();
assert_eq!(
val.at(Value::new_int(i as i32), &heap)?.unpack_str(),
Some(char_str.as_str())
);
assert_eq!(
val.at(Value::new_int(-len + (i as i32)), &heap)?
.unpack_str(),
Some(char_str.as_str())
);
}
assert!(val.at(Value::new_int(len), &heap).is_err());
assert!(val.at(Value::new_int(-(len + 1)), &heap).is_err());
Ok(())
}
for x in EXAMPLES {
let mut it = x.chars();
loop {
test_str(it.as_str())?;
if it.next().is_none() {
break;
}
}
}
Ok(())
} | rust_cleaned_test_functions.jsonl/8198 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 784
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
3560,
368,
1464,
88964,
486,
2077,
71698,
341,
286,
5168,
1273,
2895,
4199,
25,
609,
495,
8,
1464,
88964,
486,
2077,
71698,
341,
310,
1077,
23000,
284,
607,
85062,
1005,
17384,
27638,
10050,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_dyn_value_from() {
assert_eq!(OwnedDynValue::from(-42i16), OwnedDynValue::new(-42i16));
let s = big_struct_2();
assert_eq!(OwnedDynValue::from(s.clone()), OwnedDynValue::new(s.clone()));
} | rust_cleaned_test_functions.jsonl/114235 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 120
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
69213,
3142,
5673,
368,
341,
286,
2060,
10714,
10297,
57641,
95709,
1130,
486,
1499,
4080,
19,
17,
72,
16,
21,
701,
85093,
95709,
1130,
486,
931,
4080,
19,
17,
72,
16,
21,
1106,
286,
1077,
274... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_crc_error() {
let (cmd, _) = Command::SelfTest.as_tuple();
let expectations = [
Transaction::write(0x58, cmd.to_be_bytes().to_vec()),
Transaction::read(0x58, vec![0xD4, 0x00, 0x00]),
];
let mock = I2cMock::new(&expectations);
let mut sensor = Sgpc3::new(mock, 0x58, DelayMock);
match sensor.self_test() {
Err(Error::Crc) => {},
Err(_) => panic!("Unexpected error in CRC test"),
Ok(_) => panic!("Unexpected success in CRC test")
}
} | rust_cleaned_test_functions.jsonl/113624 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 292
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
59084,
4096,
368,
341,
286,
1077,
320,
8710,
11,
27439,
284,
7348,
486,
12092,
2271,
5357,
21773,
543,
286,
1077,
16665,
284,
2278,
310,
17869,
486,
4934,
7,
15,
87,
20,
23,
11,
5439,
2389,
21... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_db() {
for len in 0..=DB_TEST_DATA.len() {
let mut a = CodeAssembler::new(64).unwrap();
a.db(&DB_TEST_DATA[0..len]).unwrap();
let bytes = a.assemble(0x1234_5678_9ABC_DEF0).unwrap();
assert_eq!(bytes, &DB_TEST_DATA[0..len]);
}
} | rust_cleaned_test_functions.jsonl/71815 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 130
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8685,
368,
341,
2023,
2422,
304,
220,
15,
496,
28,
3506,
11641,
7896,
19406,
368,
341,
197,
10217,
5206,
264,
284,
6119,
77858,
486,
931,
7,
21,
19,
568,
15454,
543,
197,
11323,
7076,
2099,
35... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_persist_transaction_status() {
let ledger_path = get_tmp_ledger_path_auto_delete!();
let blockstore = Blockstore::open(ledger_path.path()).unwrap();
let transaction_status_cf = &blockstore.transaction_status_cf;
let pre_balances_vec = vec![1, 2, 3];
let post_balances_vec = vec![3, 2, 1];
let inner_instructions_vec = vec![InnerInstructions {
index: 0,
instructions: vec![CompiledInstruction::new(1, &(), vec![0])],
}];
let log_messages_vec = vec![String::from("Test message\n")];
let pre_token_balances_vec = vec![];
let post_token_balances_vec = vec![];
let rewards_vec = vec![];
// result not found
assert!(transaction_status_cf
.get_protobuf_or_bincode::<StoredTransactionStatusMeta>((0, Signature::default(), 0))
.unwrap()
.is_none());
// insert value
let status = TransactionStatusMeta {
status: solana_sdk::transaction::Result::<()>::Err(TransactionError::AccountNotFound),
fee: 5u64,
pre_balances: pre_balances_vec.clone(),
post_balances: post_balances_vec.clone(),
inner_instructions: Some(inner_instructions_vec.clone()),
log_messages: Some(log_messages_vec.clone()),
pre_token_balances: Some(pre_token_balances_vec.clone()),
post_token_balances: Some(post_token_balances_vec.clone()),
rewards: Some(rewards_vec.clone()),
}
.into();
assert!(transaction_status_cf
.put_protobuf((0, Signature::default(), 0), &status,)
.is_ok());
// result found
let TransactionStatusMeta {
status,
fee,
pre_balances,
post_balances,
inner_instructions,
log_messages,
pre_token_balances,
post_token_balances,
rewards,
} = transaction_status_cf
.get_protobuf_or_bincode::<StoredTransactionStatusMeta>((0, Signature::default(), 0))
.unwrap()
.unwrap()
.try_into()
.unwrap();
assert_eq!(status, Err(TransactionError::AccountNotFound));
assert_eq!(fee, 5u64);
assert_eq!(pre_balances, pre_balances_vec);
assert_eq!(post_balances, post_balances_vec);
assert_eq!(inner_instructions.unwrap(), inner_instructions_vec);
assert_eq!(log_messages.unwrap(), log_messages_vec);
assert_eq!(pre_token_balances.unwrap(), pre_token_balances_vec);
assert_eq!(post_token_balances.unwrap(), post_token_balances_vec);
assert_eq!(rewards.unwrap(), rewards_vec);
// insert value
let status = TransactionStatusMeta {
status: solana_sdk::transaction::Result::<()>::Ok(()),
fee: 9u64,
pre_balances: pre_balances_vec.clone(),
post_balances: post_balances_vec.clone(),
inner_instructions: Some(inner_instructions_vec.clone()),
log_messages: Some(log_messages_vec.clone()),
pre_token_balances: Some(pre_token_balances_vec.clone()),
post_token_balances: Some(post_token_balances_vec.clone()),
rewards: Some(rewards_vec.clone()),
}
.into();
assert!(transaction_status_cf
.put_protobuf((0, Signature::new(&[2u8; 64]), 9), &status,)
.is_ok());
// result found
let TransactionStatusMeta {
status,
fee,
pre_balances,
post_balances,
inner_instructions,
log_messages,
pre_token_balances,
post_token_balances,
rewards,
} = transaction_status_cf
.get_protobuf_or_bincode::<StoredTransactionStatusMeta>((
0,
Signature::new(&[2u8; 64]),
9,
))
.unwrap()
.unwrap()
.try_into()
.unwrap();
// deserialize
assert_eq!(status, Ok(()));
assert_eq!(fee, 9u64);
assert_eq!(pre_balances, pre_balances_vec);
assert_eq!(post_balances, post_balances_vec);
assert_eq!(inner_instructions.unwrap(), inner_instructions_vec);
assert_eq!(log_messages.unwrap(), log_messages_vec);
assert_eq!(pre_token_balances.unwrap(), pre_token_balances_vec);
assert_eq!(post_token_balances.unwrap(), post_token_balances_vec);
assert_eq!(rewards.unwrap(), rewards_vec);
} | rust_cleaned_test_functions.jsonl/9557 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2315
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
4975,
28884,
4773,
368,
341,
286,
1077,
46933,
2638,
284,
633,
16125,
38367,
1389,
2638,
27740,
11353,
0,
543,
286,
1077,
2504,
4314,
284,
8362,
4314,
486,
2508,
7,
50704,
2638,
3875,
6011,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_logical_row_numbers() {
// NOTE: this corresponds to "A1".
let origin = HexAddress::from((0, 0));
let orig_row = origin.logical_row();
let orig_col = origin.logical_column();
assert_eq!(orig_row, 0);
assert_eq!(orig_col, 0);
let dcol = |addr: &HexAddress| addr.logical_column() - orig_col;
// alternating up/down sequence along each row.
let drow = |addr: &HexAddress, odd_column: bool| {
let dr = addr.logical_row() - orig_row;
if odd_column {
// Odd column: hexes are one row below hexes in even rows.
// row number for even columns.
dr - 1
} else {
dr
}
};
// Check that negating the column and/or row number used to construct
// accounting for the effect of the column number on the row number.
let compare_addrs =
|row: isize, col: isize, neg_row: bool, neg_col: bool| {
let row_2 = if neg_row { -row } else { row };
let col_2 = if neg_col { -col } else { col };
let addr_1 = HexAddress::from((row, col));
let addr_2 = HexAddress::from((row_2, col_2));
let odd_column = col % 2 != 0;
let dc_1 = dcol(&addr_1);
let dr_1 = drow(&addr_1, odd_column);
let dc_2 = dcol(&addr_2);
let dr_2 = drow(&addr_2, odd_column);
if neg_row {
assert_eq!(dr_1, -dr_2)
} else {
assert_eq!(dr_1, dr_2)
}
if neg_col {
assert_eq!(dc_1, -dc_2)
} else {
assert_eq!(dc_1, dc_2)
}
};
// Check hexes in the 7x7 grid centred at the origin.
let vals: Vec<isize> = vec![0, 1, 2, 3];
for &row in &vals {
for &col in &vals {
// Compare the row and column numbers of the corresponding
// HexAddress in each quadrant of this grid.
compare_addrs(row, col, false, false);
compare_addrs(row, col, true, false);
compare_addrs(row, col, false, true);
compare_addrs(row, col, true, true);
}
}
} | rust_cleaned_test_functions.jsonl/84027 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1348
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
86484,
8530,
32964,
368,
341,
286,
442,
16743,
25,
419,
33210,
311,
330,
32,
16,
22956,
286,
1077,
6238,
284,
27228,
4286,
486,
1499,
1188,
15,
11,
220,
15,
1106,
286,
1077,
2713,
8530,
284,
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... | 8 |
#[test]
fn test_sign_function() -> Result<()> {
let tests = vec![
ScalarFunctionTest {
name: "positive int",
columns: vec![Series::from_data([11_i8])],
expect: Series::from_data([1_i8]),
error: "",
},
ScalarFunctionTest {
name: "negative int",
columns: vec![Series::from_data([-11_i8])],
expect: Series::from_data([-1_i8]),
error: "",
},
ScalarFunctionTest {
name: "zero int",
columns: vec![Series::from_data([0_i8])],
expect: Series::from_data([0_i8]),
error: "",
},
ScalarFunctionTest {
name: "with null",
columns: vec![Series::from_data([Some(0_i8), None])],
expect: Series::from_data([Some(0_i8), None]),
error: "",
},
ScalarFunctionTest {
name: "int as string",
columns: vec![Series::from_data(["22"])],
expect: Series::from_data([1_i8]),
error: "Expected a numeric type, but got String",
},
ScalarFunctionTest {
name: "i16",
columns: vec![Series::from_data([11_i16])],
expect: Series::from_data([1_i8]),
error: "",
},
ScalarFunctionTest {
name: "i32",
columns: vec![Series::from_data([11_i32])],
expect: Series::from_data([1_i8]),
error: "",
},
ScalarFunctionTest {
name: "i64",
columns: vec![Series::from_data([11_i64])],
expect: Series::from_data([1_i8]),
error: "",
},
ScalarFunctionTest {
name: "u8",
columns: vec![Series::from_data([11_u8])],
expect: Series::from_data([1_i8]),
error: "",
},
ScalarFunctionTest {
name: "u16",
columns: vec![Series::from_data([11_u16])],
expect: Series::from_data([1_i8]),
error: "",
},
ScalarFunctionTest {
name: "u32",
columns: vec![Series::from_data([11_u32])],
expect: Series::from_data([1_i8]),
error: "",
},
ScalarFunctionTest {
name: "u64",
columns: vec![Series::from_data([11_u64])],
expect: Series::from_data([1_i8]),
error: "",
},
ScalarFunctionTest {
name: "f32",
columns: vec![Series::from_data([11.11_f32])],
expect: Series::from_data([1_i8]),
error: "",
},
ScalarFunctionTest {
name: "f64",
columns: vec![Series::from_data([11.11_f64])],
expect: Series::from_data([1_i8]),
error: "",
},
];
let sign_f = SignFunction::try_create("sign")?;
let sign_f = FunctionAdapter::create(sign_f, true);
test_scalar_functions(sign_f, &tests, true)
} | rust_cleaned_test_functions.jsonl/55634 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1666
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11172,
9174,
368,
1464,
5714,
71698,
341,
262,
1077,
7032,
284,
7486,
90515,
286,
35176,
5152,
2271,
341,
310,
829,
25,
330,
30487,
526,
756,
310,
8147,
25,
7486,
20703,
25544,
486,
1499,
1769,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_create_proposal_receiving_agent_does_not_exist() {
let mut transaction_context = MockTransactionContext::default();
let receiving_agent_key = "receiving_agent_key";
transaction_context.add_agent(PUBLIC_KEY);
let mut state = TrackAndTraceState::new(&mut transaction_context);
let transaction_handler = TrackAndTraceTransactionHandler::new();
match transaction_handler._create_proposal(
&create_proposal_action(Role::Owner, receiving_agent_key),
&mut state,
PUBLIC_KEY,
TIMESTAMP,
) {
Ok(()) => panic!(
"Receiving agent key is not a valid Agent, InvalidTransaction should be returned"
),
Err(ApplyError::InvalidTransaction(err)) => {
assert!(err.contains(&format!(
"Receiving agent does not exist: {}",
receiving_agent_key,
)));
}
Err(err) => panic!("Should have gotten invalid error but got {}", err),
}
} | rust_cleaned_test_functions.jsonl/32557 | {
"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,
8657,
21663,
32556,
1288,
46344,
25730,
96374,
7913,
35906,
368,
341,
286,
1077,
5206,
7745,
8467,
284,
14563,
8070,
1972,
486,
2258,
543,
286,
1077,
12308,
25730,
3097,
284,
330,
265,
46344,
25730,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_timestamp() -> Result<()> {
let tz_table = vec!["Etc/GMT+11", "Etc/GMT0", "Etc/GMT-5", "UTC", "Universal"];
let cases = vec![
("0000-00-00 00:00:00", 0),
("2010-10-10 10:11:11", 0),
("2017-01-01 00:00:00", 0),
("2004-01-01 00:00:00", UNSPECIFIED_FSP),
("2019-07-01 12:13:14.999", MAX_FSP),
("2013-01-01 00:00:00.000000", MAX_FSP),
("2019-04-01 00:00:00.123456", MAX_FSP),
("2001-01-01 00:00:00.123456", MAX_FSP),
("2007-08-01 00:00:00.999999", MAX_FSP),
];
for tz in tz_table {
for &(case, fsp) in cases.iter() {
let mut ctx = EvalContext::from(TimeEnv {
time_zone: Tz::from_tz_name(tz),
..TimeEnv::default()
});
let time = Time::parse_timestamp(&mut ctx, case, fsp, false)?;
let packed = time.to_packed_u64(&mut ctx)?;
let reverted_datetime =
Time::from_packed_u64(&mut ctx, packed, TimeType::Timestamp, fsp)?;
assert_eq!(time, reverted_datetime);
}
}
Ok(())
} | rust_cleaned_test_functions.jsonl/40465 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 718
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51084,
23073,
368,
1464,
5714,
71698,
341,
286,
1077,
42528,
5237,
284,
7486,
0,
1183,
36,
10413,
15792,
8505,
10,
16,
16,
497,
330,
36,
10413,
15792,
8505,
15,
497,
330,
36,
10413,
15792,
8505,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
#[test]
fn test_wrapper() {
let data = direct_idmap! {
ExampleWrapper(32) => "abc",
ExampleWrapper(42) => "life",
};
assert_eq!(data[ExampleWrapper(32)], "abc");
assert_eq!(data[ExampleWrapper(42)], "life");
assert_eq!(data.get(ExampleWrapper(76)), None)
} | rust_cleaned_test_functions.jsonl/38666 | {
"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,
23561,
368,
341,
262,
1077,
821,
284,
2118,
842,
2186,
0,
341,
286,
13383,
11542,
7,
18,
17,
8,
589,
330,
13683,
756,
286,
13383,
11542,
7,
19,
17,
8,
589,
330,
14450,
756,
262,
2605,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_0005_example_1() {
let s = "babad".to_string();
assert_eq!(Solution::longest_palindrome(s), "bab".to_string());
} | rust_cleaned_test_functions.jsonl/5614 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 78
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
15,
15,
15,
20,
39304,
62,
16,
368,
341,
286,
1077,
274,
284,
330,
65,
27347,
3263,
983,
3904,
1428,
286,
2060,
10714,
10297,
36842,
486,
4825,
477,
73310,
36058,
1141,
701,
330,
47722,
32... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_named_thread() {
Builder::new().name("ada lovelace".to_string()).scoped(move|| {
assert!(thread::current().name().unwrap() == "ada lovelace".to_string());
}).unwrap().join();
} | rust_cleaned_test_functions.jsonl/109001 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71834,
10814,
368,
341,
286,
20626,
486,
931,
1005,
606,
445,
2584,
775,
889,
578,
3263,
983,
3904,
6011,
78740,
34081,
8484,
341,
310,
2060,
10297,
4528,
486,
3231,
1005,
606,
1005,
15454,
368,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_post_form() {
let server = server::http(move |req| {
async move {
assert_eq!(req.method(), "POST");
assert_eq!(req.headers()["content-length"], "24");
assert_eq!(
req.headers()["content-type"],
"application/x-www-form-urlencoded"
);
let data = hyper::body::to_bytes(req.into_body()).await.unwrap();
assert_eq!(&*data, b"hello=world&sean=monstar");
http::Response::default()
}
});
let form = &[("hello", "world"), ("sean", "monstar")];
let url = format!("http://{}/form", server.addr());
let res = reqwest::blocking::Client::new()
.post(&url)
.form(form)
.send()
.expect("request send");
assert_eq!(res.url().as_str(), &url);
assert_eq!(res.status(), reqwest::StatusCode::OK);
} | rust_cleaned_test_functions.jsonl/131406 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 439
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6333,
7915,
368,
341,
262,
1077,
3538,
284,
3538,
486,
1254,
34081,
760,
2958,
91,
341,
286,
3312,
3271,
341,
310,
2060,
10714,
10297,
2958,
12908,
1507,
330,
2946,
797,
310,
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_tiledinputpart_read_tiles_success() {
let input = MultiPartInputFile::new(&*SRC_IMAGE_PATH, 0, true).unwrap();
let mut tiled_input_part = super::TiledInputPart::new(&input, 0);
let frame_buffer = FrameBuffer::new();
tiled_input_part.set_frame_buffer(&frame_buffer).unwrap();
unsafe {
tiled_input_part.read_tiles(0, 0, 0, 0, 0, 0).unwrap();
}
} | rust_cleaned_test_functions.jsonl/59315 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
2181,
1355,
4480,
6443,
60857,
18632,
368,
341,
286,
1077,
1946,
284,
17439,
5800,
2505,
1703,
486,
931,
2099,
9,
56017,
19121,
7944,
11,
220,
15,
11,
830,
568,
15454,
543,
286,
1077,
5206,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_first_empty() {
let empty = Table {
headers: HashMap::new(),
data: Vec::new(),
};
assert_eq!(Some(empty), Table::find_first(TABLE_EMPTY));
} | rust_cleaned_test_functions.jsonl/47578 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 113
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
12978,
15124,
368,
341,
286,
1077,
4287,
284,
6633,
341,
310,
7102,
25,
10528,
486,
931,
3148,
310,
821,
25,
11312,
486,
931,
3148,
286,
2605,
286,
2060,
10714,
10297,
8373,
24216,
701,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_parse_outputs() {
let res_one = outputs(to_input(b"3 -> #n:7"));
assert_full_result(
res_one,
vec![OutputMapping {
from: 3.into(),
to: Port::named_port(&"n", 7.into()),
}],
);
let res_many = outputs(to_input(b"1 -> OUT:2, 3 -> #abc:4"));
assert_full_result(
res_many,
vec![
OutputMapping {
from: 1.into(),
to: Port::new(Node::Out, 2.into()),
},
OutputMapping {
from: 3.into(),
to: Port::named_port(&"abc", 4.into()),
},
],
);
} | rust_cleaned_test_functions.jsonl/41391 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 479
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
35189,
368,
341,
286,
1077,
592,
11667,
284,
16275,
12186,
5898,
1883,
1,
18,
1464,
671,
77,
25,
22,
4010,
286,
2060,
16372,
5287,
1006,
310,
592,
11667,
345,
310,
7486,
20703,
5097,
6807... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_table_commutative() {
let groups: HashMap<u8, u8> = hashmap!{
b'F' => 0,
b'S' => 0,
b'B' => 0,
b'z' => 0,
b'U' => 1,
b'E' => 1,
b'D' => 1,
b'y' => 1,
b'L' => 2,
b'M' => 2,
b'R' => 2,
b'x' => 2,
};
for (name1, p1) in PERMUTATION_TABLE.iter() {
let group1 = groups.get(&name1[0]).unwrap();
for (name2, p2) in PERMUTATION_TABLE.iter() {
let group2 = groups.get(&name2[0]).unwrap();
if group1 == group2 {
assert!(*p1 + *p2 == *p2 + *p1);
} else {
assert!(*p1 + *p2 != *p2 + *p1);
}
}
}
} | rust_cleaned_test_functions.jsonl/31486 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 563
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5237,
2965,
6984,
1388,
368,
341,
286,
1077,
5203,
25,
10528,
34837,
23,
11,
575,
23,
29,
284,
92148,
0,
515,
310,
293,
6,
37,
6,
589,
220,
15,
345,
310,
293,
13272,
6,
589,
220,
15,
345,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_use_dense_data() {
let y = vec![0.0, 1.0, 0.0];
let x = vec![vec![1.1, 0.0, 8.4],
vec![0.9, 1.0, 9.1],
vec![1.2, 1.0, 9.0]];
let problem = dense_problem(y, x).unwrap();
let params = SvmParam::new(2);
let model = problem.train(¶ms).unwrap();
assert_eq!(model.get_num_classes(), 2);
} | rust_cleaned_test_functions.jsonl/42832 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 209
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15951,
72619,
1769,
368,
341,
1066,
262,
1077,
379,
284,
7486,
20703,
15,
13,
15,
11,
220,
16,
13,
15,
11,
220,
15,
13,
15,
935,
262,
1077,
856,
284,
7486,
20703,
4083,
20703,
16,
13,
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_DUP_duplicates_top_of_stack() {
let mut f = Context::new(333, 343);
f.eval("1 DUP".into()).unwrap();
assert_eq!(1, f.stack()[0]);
assert_eq!(1, f.stack()[1]);
} | rust_cleaned_test_functions.jsonl/62931 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 118
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1557,
3124,
75051,
10426,
3575,
15528,
368,
341,
286,
1077,
5206,
282,
284,
9608,
486,
931,
7,
18,
18,
18,
11,
220,
18,
19,
18,
317,
286,
282,
31710,
445,
16,
87524,
3263,
18122,
6011,
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_flush() {
let leaves = create_leaves(1000..1020);
let mock_store = Arc::new(MockAccumulatorStore::new());
let accumulator = MerkleAccumulator::new(
*ACCUMULATOR_PLACEHOLDER_HASH,
vec![],
0,
0,
mock_store.clone(),
);
let _root_hash = accumulator.append(&leaves).unwrap();
accumulator.flush().unwrap();
//get from storage
for node_hash in leaves {
let node = mock_store.get_node(node_hash).unwrap();
assert!(node.is_some());
}
} | rust_cleaned_test_functions.jsonl/51496 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 249
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39213,
368,
341,
262,
1077,
10901,
284,
1855,
11751,
4693,
7,
16,
15,
15,
15,
496,
16,
15,
17,
15,
317,
262,
1077,
7860,
14809,
284,
19689,
486,
931,
66436,
14603,
372,
10511,
6093,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_verify_signed() {
let b = r#"{"signatures": {"Alice": {"ed25519:zxcvb": "hvA+XXFEkHk80pLMeIYjNkWy5Ds2ZckSrvj00NvbyFJQe3H9LuJNnu8JLZ/ffIzChs3HmhwPldO0MSmyJAYpCA"}}, "my_key": "my_data"}"#;
#[derive(Debug, Deserialize, PartialEq, Eq)]
struct Test {
my_key: String,
};
let s: SignedJson<Test> = SignedJson::from_slice(b.as_bytes()).unwrap();
assert_eq!(s.as_ref(), &Test{ my_key: "my_data".into()});
let k = b"qA\xeb\xc2^+(\\~P\x91(\xa4\xf4L\x1f\xeb\x07E\xae\x8b#q(\rMq\xf2\xc9\x8f\xe1\xca";
let seed = sign::Seed::from_slice(k).unwrap();
let (pubkey, _) = sign::keypair_from_seed(&seed);
s.verify("Alice", "ed25519:zxcvb", &pubkey).unwrap();
} | rust_cleaned_test_functions.jsonl/31932 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 435
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35638,
55617,
368,
341,
286,
1077,
293,
284,
435,
55543,
4913,
7752,
2789,
788,
5212,
61686,
788,
5212,
291,
17,
20,
20,
16,
24,
25,
89,
8148,
42405,
788,
330,
81979,
32,
10,
6148,
11419,
74,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rundown_flags_set_in_progress() {
// Initialize an empty bit flags.
let mut flags = RundownFlags::empty();
assert_eq!(0, flags.get_ref());
// Turn on rundown in progress flags
flags = to_flags(flags.set_rundown_in_progress());
// Reference count should still be zero.
assert_eq!(0, flags.get_ref());
assert_eq!(true, flags.is_rundown_in_progress());
assert_eq!(false, flags.is_pre_rundown());
flags = to_flags(flags.add_ref());
assert_eq!(1, flags.get_ref());
assert_eq!(true, flags.is_rundown_in_progress());
assert_eq!(false, flags.is_pre_rundown());
} | rust_cleaned_test_functions.jsonl/52963 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 319
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
1241,
779,
14130,
2602,
1243,
27200,
368,
341,
286,
442,
9008,
458,
4287,
2699,
8042,
624,
286,
1077,
5206,
8042,
284,
431,
1241,
779,
9195,
486,
3194,
543,
286,
2060,
10714,
10297,
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_vmconfig_error_conversion() {
// Test `VmConfigError` conversion
assert_eq!(error_kind(VmConfigError::InvalidVcpuCount), ErrorKind::User);
assert_eq!(
error_kind(VmConfigError::InvalidMemorySize),
ErrorKind::User
);
assert_eq!(
error_kind(VmConfigError::UpdateNotAllowedPostBoot),
ErrorKind::User
);
} | rust_cleaned_test_functions.jsonl/93130 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 206
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39008,
1676,
4096,
64132,
368,
341,
286,
442,
3393,
1565,
88124,
2648,
1454,
63,
14409,
198,
286,
2060,
10714,
10297,
841,
33162,
12410,
76,
2648,
1454,
486,
7928,
53,
16475,
2507,
701,
4600,
1062... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_short_name_conversion() {
let common_name = Nid::COMMONNAME;
let organizational_unit_name = Nid::ORGANIZATIONALUNITNAME;
let aes256_cbc_hmac_sha1 = Nid::AES_256_CBC_HMAC_SHA1;
let id_cmc_lrapopwitness = Nid::ID_CMC_LRAPOPWITNESS;
let ms_ctl_sign = Nid::MS_CTL_SIGN;
let undefined_nid = Nid::from_raw(118);
assert_eq!(common_name.short_name().unwrap(), "CN");
assert_eq!(organizational_unit_name.short_name().unwrap(), "OU");
assert_eq!(
aes256_cbc_hmac_sha1.short_name().unwrap(),
"AES-256-CBC-HMAC-SHA1"
);
assert_eq!(
id_cmc_lrapopwitness.short_name().unwrap(),
"id-cmc-lraPOPWitness"
);
assert_eq!(ms_ctl_sign.short_name().unwrap(), "msCTLSign");
assert!(
undefined_nid.short_name().is_err(),
"undefined_nid should not return a valid value"
);
} | rust_cleaned_test_functions.jsonl/74254 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 502
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16673,
1269,
64132,
368,
341,
286,
1077,
4185,
1269,
284,
451,
307,
486,
66864,
7535,
280,
286,
1077,
40195,
14832,
1269,
284,
451,
307,
486,
44927,
1093,
2843,
39585,
23040,
7535,
280,
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_sorted_iterator() {
use ark_std::vec::Vec;
let base = vec!["1", "2", "3", "4"];
let addresses = vec![2usize, 2, 2, 1, 0, 0, 0];
let expected = vec!["4", "3", "3", "3", "3", "2", "2", "1", "1", "1", "1"];
let sorted_iterator =
SortedIterator::new(base.iter().rev(), addresses.iter().cloned(), base.len())
.cloned()
.collect::<Vec<_>>();
assert_eq!(sorted_iterator, expected);
let base = vec!["1", "2", "3", "4", "5", "6"];
let addresses = vec![4, 3, 3, 2, 1, 1, 1, 1, 0, 0];
let expected = vec![
"6", "5", "5", "4", "4", "4", "3", "3", "2", "2", "2", "2", "2", "1", "1", "1",
];
let sorted_iterator =
SortedIterator::new(base.iter().rev(), addresses.iter().cloned(), base.len())
.cloned()
.collect::<Vec<_>>();
assert_eq!(sorted_iterator, expected);
} | rust_cleaned_test_functions.jsonl/35441 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 445
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41277,
13491,
368,
341,
262,
990,
55217,
15656,
486,
4083,
486,
10050,
401,
262,
1077,
2331,
284,
7486,
0,
1183,
16,
497,
330,
17,
497,
330,
18,
497,
330,
19,
6332,
262,
1077,
14230,
284,
7486... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_when_then_schema() -> Result<()> {
let df = fruits_cars();
let schema = df
.lazy()
.select([when(col("A").gt(lit(1)))
.then(Null {}.lit())
.otherwise(col("A"))])
.schema();
assert_ne!(schema.get_index(0).unwrap().1, &DataType::Null);
Ok(())
} | rust_cleaned_test_functions.jsonl/13840 | {
"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,
47636,
68367,
25371,
368,
1464,
5714,
71698,
341,
262,
1077,
6764,
284,
25322,
666,
1561,
1428,
262,
1077,
10802,
284,
6764,
198,
286,
659,
49013,
741,
286,
659,
1742,
2561,
9309,
19611,
445,
32,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_seek_for_prev() {
let path = TempDir::new("_rust_rocksdb_seek_for_prev").expect("");
let mut opts = DBOptions::new();
opts.create_if_missing(true);
{
let db = DB::open(opts, path.path().to_str().unwrap()).unwrap();
let writeopts = WriteOptions::new();
db.put_opt(b"k1-0", b"a", &writeopts).unwrap();
db.put_opt(b"k1-1", b"b", &writeopts).unwrap();
db.put_opt(b"k1-3", b"d", &writeopts).unwrap();
let mut iter = db.iter();
iter.seek_for_prev(SeekKey::Key(b"k1-2"));
assert!(iter.valid());
assert_eq!(iter.key(), b"k1-1");
assert_eq!(iter.value(), b"b");
let mut iter = db.iter();
iter.seek_for_prev(SeekKey::Key(b"k1-3"));
assert!(iter.valid());
assert_eq!(iter.key(), b"k1-3");
assert_eq!(iter.value(), b"d");
let mut iter = db.iter();
iter.seek_for_prev(SeekKey::Start);
assert!(iter.valid());
assert_eq!(iter.key(), b"k1-0");
assert_eq!(iter.value(), b"a");
let mut iter = db.iter();
iter.seek_for_prev(SeekKey::End);
assert!(iter.valid());
assert_eq!(iter.key(), b"k1-3");
assert_eq!(iter.value(), b"d");
let mut iter = db.iter();
iter.seek_for_prev(SeekKey::Key(b"k0-0"));
assert!(!iter.valid());
let mut iter = db.iter();
iter.seek_for_prev(SeekKey::Key(b"k2-0"));
assert!(iter.valid());
assert_eq!(iter.key(), b"k1-3");
assert_eq!(iter.value(), b"d");
}
} | rust_cleaned_test_functions.jsonl/18880 | {
"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,
74473,
5478,
25566,
368,
341,
262,
1077,
1815,
284,
19944,
6184,
486,
931,
16975,
35788,
26608,
14553,
1999,
74473,
5478,
25566,
1827,
17119,
13056,
262,
1077,
5206,
12185,
284,
5952,
3798,
486,
931... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_register_histogram_vec_with_registry_trailing_comma() {
use crate::Registry;
use std::collections::HashMap;
let mut labels = HashMap::new();
labels.insert("mykey".to_string(), "myvalue".to_string());
let custom_registry = Registry::new_custom(Some("myprefix".to_string()), Some(labels)).unwrap();
let opts = histogram_opts!("test_macro_histogram_vec_1", "help",);
let histogram_vec = register_histogram_vec_with_registry!(opts, &["a", "b"], custom_registry,);
assert!(histogram_vec.is_ok());
let histogram_vec = register_histogram_vec_with_registry!(
"test_macro_histogram_vec_2",
"help",
&["a", "b"],
custom_registry,
);
assert!(histogram_vec.is_ok());
let histogram_vec = register_histogram_vec_with_registry!(
"test_macro_histogram_vec_3",
"help",
&["test_label"],
vec![0.0, 1.0, 2.0],
custom_registry,
);
assert!(histogram_vec.is_ok());
} | rust_cleaned_test_functions.jsonl/86378 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 444
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14000,
68564,
13251,
6615,
50650,
3547,
14277,
2965,
1728,
368,
341,
262,
990,
17717,
486,
15603,
280,
262,
990,
1460,
486,
51137,
486,
18497,
401,
262,
1077,
5206,
9201,
284,
10528,
486,
931,
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_simulate_shoot_with_assault_rifle_far_from_healthy_opponent() {
let world = with_my_unit_with_weapon(example_world(), WeaponType::Pistol);
let my_unit = world.get_unit(EXAMPLE_MY_UNIT_ID);
let opponent_unit = world.get_unit(EXAMPLE_OPPONENT_UNIT_ID);
let direction = (opponent_unit.center() - my_unit.center()).normalized();
let weapon = my_unit.weapon.as_ref().unwrap();
let number_of_directions = 11;
let shoot_result = simulate_shoot(EXAMPLE_MY_UNIT_ID, my_unit.center(), direction,
opponent_unit.id, opponent_unit.position(), weapon.params.min_spread, &weapon.typ,
&weapon.params.bullet, &weapon.params.explosion, &world, number_of_directions, &mut None);
assert_eq!(shoot_result, ShootResult { player_score: 20, opponent_score: 0, teammates_damage: 0, unit_damage: 0 });
} | rust_cleaned_test_functions.jsonl/125073 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 324
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18314,
6334,
3712,
1905,
6615,
12083,
945,
1710,
19092,
67513,
5673,
62,
37028,
10287,
1146,
368,
341,
262,
1077,
1879,
284,
448,
35686,
14832,
6615,
69475,
66203,
31792,
1507,
27777,
929,
486,
47,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_copy_through_dangling_symlink() {
let (at, mut ucmd) = at_and_ucmd!();
at.touch("file");
at.symlink_file("nonexistent", "target");
ucmd.arg("file")
.arg("target")
.fails()
.stderr_only("cp: not writing through dangling symlink 'target'");
} | rust_cleaned_test_functions.jsonl/123169 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16096,
87399,
814,
90104,
58530,
44243,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
518,
42129,
445,
1192,
797,
262,
518,
77577,
44243,
2458,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_byte_array_new_with_zero_initialised() -> super::PyResult<()> {
Python::with_gil(|py| -> super::PyResult<()> {
let py_bytearray = PyByteArray::new_with(py, 10, |_b: &mut [u8]| Ok(()))?;
let bytearray: &[u8] = unsafe { py_bytearray.as_bytes() };
assert_eq!(bytearray, &[0; 10]);
Ok(())
})
} | rust_cleaned_test_functions.jsonl/47847 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 206
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19737,
3858,
5921,
6615,
19359,
15809,
4056,
368,
1464,
2256,
486,
13828,
2077,
71698,
341,
286,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
1464,
2256,
486,
13828,
2077,
71698,
341,
310,
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... | 2 |
#[test]
fn test_top_collector_not_at_capacity_with_offset() {
let index = make_index();
let field = index.schema().get_field("text").unwrap();
let query_parser = QueryParser::for_index(&index, vec![field]);
let text_query = query_parser.parse_query("droopy tax").unwrap();
let score_docs: Vec<(Score, DocAddress)> = index
.reader()
.unwrap()
.searcher()
.search(&text_query, &TopDocs::with_limit(4).and_offset(2))
.unwrap();
assert_results_equals(&score_docs[..], &[(0.48527452, DocAddress(0, 0))]);
} | rust_cleaned_test_functions.jsonl/31045 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 292
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10426,
10211,
27669,
7913,
3752,
35603,
6615,
6917,
368,
341,
286,
1077,
1922,
284,
1281,
3560,
543,
286,
1077,
2070,
284,
1922,
30892,
1005,
455,
5013,
445,
1318,
1827,
15454,
543,
286,
1077,
323... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_deserialize_too_large_footer() {
let mut buf = vec![];
assert!(FooterProxy::new(&mut buf).terminate().is_ok());
let mut long_len_buf = [0u8; 10];
let num_bytes = VInt(super::FOOTER_MAX_LEN as u64 + 1u64).serialize_into(&mut long_len_buf);
buf[0..num_bytes].copy_from_slice(&long_len_buf[..num_bytes]);
let err = Footer::deserialize(&mut &buf[..]).unwrap_err();
assert_eq!(err.kind(), io::ErrorKind::InvalidData);
assert_eq!(
err.to_string(),
"Footer seems invalid as it suggests a footer len of 10001. File is corrupted, \
or the index was created with a different & old version of tantivy."
);
} | rust_cleaned_test_functions.jsonl/49582 | {
"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,
15768,
9050,
2346,
78,
45228,
25966,
368,
341,
286,
1077,
5206,
6607,
284,
7486,
0,
15078,
286,
2060,
10297,
19445,
16219,
486,
931,
2099,
6984,
6607,
568,
48061,
1005,
285,
19817,
1423,
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_remove_to() {
assert_eq!("aaa", remove_to("aaa", '.'));
assert_eq!("bbb", remove_to("aaa.bbb", '.'));
assert_eq!("ccc", remove_to("aaa.bbb.ccc", '.'));
} | rust_cleaned_test_functions.jsonl/38001 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
2346,
368,
341,
286,
2060,
10714,
17223,
32646,
497,
4057,
2346,
445,
32646,
497,
6256,
6336,
286,
2060,
10714,
17223,
53151,
497,
4057,
2346,
445,
32646,
948,
6066,
497,
6256,
6336,
286,
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 |
#[test]
fn test_parse_flags() {
let mut flags = AMQPFlags::default();
let mut names = Vec::new();
names.push("a");
flags.add_flag("a".to_string(), true);
names.push("b");
flags.add_flag("b".to_string(), false);
names.push("c");
flags.add_flag("c".to_string(), true);
names.push("d");
flags.add_flag("d".to_string(), true);
assert_eq!(
parse_flags(&[0b00001101][..], &names),
Ok((EMPTY, flags.clone()))
);
names.push("e");
flags.add_flag("e".to_string(), true);
names.push("f");
flags.add_flag("f".to_string(), false);
names.push("g");
flags.add_flag("g".to_string(), true);
names.push("h");
flags.add_flag("h".to_string(), true);
names.push("i");
flags.add_flag("i".to_string(), false);
names.push("j");
flags.add_flag("j".to_string(), true);
assert_eq!(
parse_flags(&[0b11011101, 0b00000010][..], &names),
Ok((EMPTY, flags))
);
} | rust_cleaned_test_functions.jsonl/25466 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 566
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
14130,
368,
341,
286,
1077,
5206,
8042,
284,
6769,
66520,
9195,
486,
2258,
543,
286,
1077,
5206,
5036,
284,
11312,
486,
931,
543,
286,
5036,
2552,
445,
64,
797,
286,
8042,
1364,
10933,
44... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_html() -> Result<(), strum::ParseError> {
assert_eq!("0", HTML::Plain.to_string());
assert_eq!(HTML::Plain, HTML::from_str("0")?);
assert_eq!("1", HTML::HTML.to_string());
assert_eq!(HTML::HTML, HTML::from_str("1")?);
Ok(())
} | rust_cleaned_test_functions.jsonl/92482 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 146
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9564,
368,
1464,
5714,
68843,
607,
372,
486,
14463,
1454,
29,
341,
286,
2060,
10714,
17223,
15,
497,
9308,
486,
26982,
2389,
3904,
1423,
286,
2060,
10714,
10297,
5835,
486,
26982,
11,
9308,
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... | 3 |
#[test]
fn test_parse_from_buffer() {
let context = Context::create();
let garbage_buffer = MemoryBuffer::create_from_memory_range("garbage ir data", "my_ir");
let module_result = Module::parse_bitcode_from_buffer(&garbage_buffer);
assert!(module_result.is_err());
let module = context.create_module("mod");
let void_type = context.void_type();
let fn_type = void_type.fn_type(&[], false);
let f = module.add_function("f", fn_type, None);
let basic_block = f.append_basic_block("entry");
let builder = context.create_builder();
builder.position_at_end(&basic_block);
builder.build_return(None);
assert!(module.verify().is_ok());
let buffer = module.write_bitcode_to_memory();
let module2_result = Module::parse_bitcode_from_buffer(&buffer);
assert!(module2_result.is_ok());
assert_eq!(module2_result.unwrap().get_context(), Context::get_global());
let module3_result = Module::parse_bitcode_from_buffer_in_context(&garbage_buffer, &context);
assert!(module3_result.is_err());
let buffer2 = module.write_bitcode_to_memory();
let module4_result = Module::parse_bitcode_from_buffer_in_context(&buffer2, &context);
assert!(module4_result.is_ok());
assert_eq!(*module4_result.unwrap().get_context(), context);
} | rust_cleaned_test_functions.jsonl/63542 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 474
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
5673,
7776,
368,
341,
262,
1077,
2266,
284,
9608,
486,
3182,
543,
262,
1077,
25878,
7776,
284,
13850,
4095,
486,
3182,
5673,
19195,
9698,
445,
12164,
20652,
6216,
821,
497,
330,
2408,
51433... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_envelope() {
let env = br#"ENVELOPE ("Wed, 17 Jul 1996 02:23:25 -0700 (PDT)" "IMAP4rev1 WG mtg summary and minutes" (("Terry Gray" NIL "gray" "cac.washington.edu")) (("Terry Gray" NIL "gray" "cac.washington.edu")) (("Terry Gray" NIL "gray" "cac.washington.edu")) ((NIL NIL "imap" "cac.washington.edu")) ((NIL NIL "minutes" "CNRI.Reston.VA.US") ("John Klensin" NIL "KLENSIN" "MIT.EDU")) NIL NIL "<B27397-0100000@cac.washington.edu>") "#;
match crate::parser::rfc3501::msg_att_envelope(env) {
Ok((_, AttributeValue::Envelope(_))) => {}
rsp => panic!("unexpected response {:?}", rsp),
}
} | rust_cleaned_test_functions.jsonl/8547 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 304
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6205,
18853,
368,
341,
286,
1077,
6105,
284,
1411,
55543,
953,
47782,
1740,
3489,
26503,
11,
220,
16,
22,
10057,
220,
16,
24,
24,
21,
220,
15,
17,
25,
17,
18,
25,
17,
20,
481,
15,
22,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_poly_foldl_consuming() {
trait Dummy {
fn dummy(&self) -> i32 {
1
}
}
impl<T: ?Sized> Dummy for T {}
struct Dummynator;
impl<T: Dummy, I: IntoIterator<Item = T>> Func<(i32, I)> for Dummynator {
type Output = i32;
fn call(args: (i32, I)) -> Self::Output {
let (acc, i) = args;
i.into_iter().fold(acc, |acc, x| acc + x.dummy())
}
}
let h = hlist![0..10, 0..=10, &[0, 1, 2], &['a', 'b', 'c']];
assert_eq!(
h.foldl(Poly(Dummynator), 0),
(0..10)
.map(|d| d.dummy())
.chain((0..=10).map(|d| d.dummy()))
.chain([0_i32, 1, 2].iter().map(|d| d.dummy()))
.chain(['a', 'b', 'c'].iter().map(|d| d.dummy()))
.sum()
);
} | rust_cleaned_test_functions.jsonl/41572 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 577
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36133,
61187,
75,
3382,
61117,
368,
341,
286,
17567,
50567,
341,
310,
5168,
17292,
2099,
721,
8,
1464,
600,
18,
17,
341,
394,
220,
16,
198,
310,
456,
286,
456,
286,
11605,
3125,
25,
937,
50,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_binary_search_elem() {
assert_eq!([1i,2,3,4,5].binary_search_elem(&5).found(), Some(4));
assert_eq!([1i,2,3,4,5].binary_search_elem(&4).found(), Some(3));
assert_eq!([1i,2,3,4,5].binary_search_elem(&3).found(), Some(2));
assert_eq!([1i,2,3,4,5].binary_search_elem(&2).found(), Some(1));
assert_eq!([1i,2,3,4,5].binary_search_elem(&1).found(), Some(0));
assert_eq!([2i,4,6,8,10].binary_search_elem(&1).found(), None);
assert_eq!([2i,4,6,8,10].binary_search_elem(&5).found(), None);
assert_eq!([2i,4,6,8,10].binary_search_elem(&4).found(), Some(1));
assert_eq!([2i,4,6,8,10].binary_search_elem(&10).found(), Some(4));
assert_eq!([2i,4,6,8].binary_search_elem(&1).found(), None);
assert_eq!([2i,4,6,8].binary_search_elem(&5).found(), None);
assert_eq!([2i,4,6,8].binary_search_elem(&4).found(), Some(1));
assert_eq!([2i,4,6,8].binary_search_elem(&8).found(), Some(3));
assert_eq!([2i,4,6].binary_search_elem(&1).found(), None);
assert_eq!([2i,4,6].binary_search_elem(&5).found(), None);
assert_eq!([2i,4,6].binary_search_elem(&4).found(), Some(1));
assert_eq!([2i,4,6].binary_search_elem(&6).found(), Some(2));
assert_eq!([2i,4].binary_search_elem(&1).found(), None);
assert_eq!([2i,4].binary_search_elem(&5).found(), None);
assert_eq!([2i,4].binary_search_elem(&2).found(), Some(0));
assert_eq!([2i,4].binary_search_elem(&4).found(), Some(1));
assert_eq!([2i].binary_search_elem(&1).found(), None);
assert_eq!([2i].binary_search_elem(&5).found(), None);
assert_eq!([2i].binary_search_elem(&2).found(), Some(0));
assert_eq!([].binary_search_elem(&1i).found(), None);
assert_eq!([].binary_search_elem(&5i).found(), None);
assert!([1i,1,1,1,1].binary_search_elem(&1).found() != None);
assert!([1i,1,1,1,2].binary_search_elem(&1).found() != None);
assert!([1i,1,1,2,2].binary_search_elem(&1).found() != None);
assert!([1i,1,2,2,2].binary_search_elem(&1).found() != None);
assert_eq!([1i,2,2,2,2].binary_search_elem(&1).found(), Some(0));
assert_eq!([1i,2,3,4,5].binary_search_elem(&6).found(), None);
assert_eq!([1i,2,3,4,5].binary_search_elem(&0).found(), None);
} | rust_cleaned_test_functions.jsonl/108303 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1184
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31761,
10716,
28179,
368,
341,
286,
2060,
10714,
0,
2561,
16,
72,
11,
17,
11,
18,
11,
19,
11,
20,
936,
25891,
10716,
28179,
2099,
20,
568,
15105,
1507,
4329,
7,
19,
1106,
286,
2060,
10714,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tuple_sum() {
assert_eq!(
Color::try_from((-1, 255, 255)),
Err(IntoColorError::IntConversion)
);
} | rust_cleaned_test_functions.jsonl/754 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21773,
10160,
368,
341,
286,
2060,
10714,
33673,
310,
3478,
486,
1539,
5673,
54934,
16,
11,
220,
17,
20,
20,
11,
220,
17,
20,
20,
6965,
310,
15495,
24123,
78,
1636,
1454,
486,
1072,
48237,
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 |
#[test]
fn test_name_collision_error() {
init();
let schema_str_1 = r#"{
"name": "foo.A",
"type": "record",
"fields": [
{"name": "field_one", "type": "double"}
]
}"#;
let schema_str_2 = r#"{
"name": "A",
"type": "record",
"namespace": "foo",
"fields": [
{"name": "field_two", "type": "string"}
]
}"#;
let _ = Schema::parse_list(&[schema_str_1, schema_str_2]).expect_err("Test failed");
} | rust_cleaned_test_functions.jsonl/69030 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 279
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1269,
70375,
4096,
368,
341,
262,
2930,
543,
262,
1077,
10802,
2895,
62,
16,
284,
435,
55543,
515,
286,
330,
606,
788,
330,
7975,
875,
756,
286,
330,
1313,
788,
330,
8548,
756,
286,
330,
9007,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ord() {
let n: DList<int> = list_from(&[]);
let m = list_from(&[1,2,3]);
assert!(n < m);
assert!(m > n);
assert!(n <= n);
assert!(n >= n);
} | rust_cleaned_test_functions.jsonl/56743 | {
"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,
67324,
368,
341,
286,
1077,
308,
25,
422,
852,
4159,
29,
284,
1140,
5673,
2099,
56703,
286,
1077,
296,
284,
1140,
5673,
2099,
58,
16,
11,
17,
11,
18,
2558,
286,
2060,
10297,
77,
366,
296,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sql_projection() {
let res = expression(Span::new(r"select a from t"));
assert!(res.is_ok());
assert!(matches!(res.clone().unwrap().1, Expr::Projection(e, _v) if e[0] == "a"));
} | rust_cleaned_test_functions.jsonl/32933 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18063,
72738,
368,
341,
262,
1077,
592,
284,
7493,
3759,
848,
486,
931,
2601,
1,
1742,
264,
504,
259,
14929,
262,
2060,
10297,
416,
2079,
19817,
1423,
262,
2060,
10297,
19914,
10297,
416,
15997,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_fast_indexed() {
let mut schema_builder = Schema::builder();
let name = schema_builder.add_u64_field("name", FAST | INDEXED);
let schema = schema_builder.build();
let index = Index::create_in_ram(schema);
{
let mut index_writer = index.writer_for_tests().unwrap();
index_writer.add_document(doc!(name => 1u64));
index_writer.add_document(doc!(name => 2u64));
index_writer.add_document(doc!(name => 10u64));
index_writer.add_document(doc!(name => 20u64));
index_writer.commit().unwrap();
}
let searcher = index.searcher().unwrap();
let searcher_space_usage = searcher.space_usage().unwrap();
assert!(searcher_space_usage.total() > 0);
assert_eq!(1, searcher_space_usage.segments().len());
let segment = &searcher_space_usage.segments()[0];
assert!(segment.total() > 0);
assert_eq!(4, segment.num_docs());
expect_single_field(segment.termdict(), &name, 1, 512);
expect_single_field(segment.postings(), &name, 1, 512);
assert_eq!(0, segment.positions().total());
expect_single_field(segment.fast_fields(), &name, 1, 512);
expect_single_field(segment.fieldnorms(), &name, 1, 512);
// TODO: understand why the following fails
assert_eq!(0, segment.deletes());
} | rust_cleaned_test_functions.jsonl/62188 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 640
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35743,
3560,
291,
368,
341,
286,
1077,
5206,
10802,
28532,
284,
12539,
486,
17850,
543,
286,
1077,
829,
284,
10802,
28532,
1364,
7300,
21,
19,
5013,
445,
606,
497,
50733,
760,
39300,
1479,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sized_cache() {
let last = fib1(20);
{
let cache = SIZED_FIB.lock().unwrap();
assert_eq!(3, cache.cache_size());
let items = cache.get_order().iter().collect::<Vec<_>>();
assert_eq!(3, items.len());
assert_eq!(&(20, last), items[0]);
}
} | rust_cleaned_test_functions.jsonl/13125 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 165
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
1506,
11529,
368,
341,
262,
1077,
1537,
284,
15801,
16,
7,
17,
15,
317,
262,
341,
286,
1077,
6500,
284,
328,
51538,
1400,
3256,
21003,
1005,
15454,
543,
286,
2060,
10714,
10297,
18,
11,
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_query_all_items() {
let querier = new_valid_db("query_all_items.db");
let items = querier.query_items(None, None, None);
assert_eq!(6, items.len());
} | rust_cleaned_test_functions.jsonl/107671 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5738,
5705,
12134,
368,
341,
286,
1077,
29134,
1268,
284,
501,
8337,
8685,
445,
1631,
5705,
12134,
7076,
3071,
286,
1077,
3589,
284,
29134,
1268,
4786,
12134,
26717,
11,
2240,
11,
2240,
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 |
#[test]
fn test_encode_lossless() {
let mut encoder = Encoder::default();
encoder.lossless = Some(true);
encoder.basic_info.xsize = 3;
encoder.basic_info.ysize = 3;
let encoded = encoder.encode(&RGBA_DATA).expect("Failed to encode");
let result = decode_memory(&encoded).expect("Failed to decode again");
let basic_info = &result.basic_info;
assert_eq!(basic_info.xsize, 3);
assert_eq!(basic_info.ysize, 3);
assert_eq!(result.frames[0].data[..], RGBA_DATA);
} | rust_cleaned_test_functions.jsonl/115352 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
11193,
1717,
368,
341,
262,
1077,
5206,
23668,
284,
55115,
486,
2258,
543,
262,
23668,
46043,
1717,
284,
4329,
3715,
317,
262,
23668,
33257,
3109,
1993,
2141,
284,
220,
18,
280,
262,
23668,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_proof_basic() {
let mut memdb = MemoryDB::new(true);
let mut trie = PatriciaTrieMut::new(&mut memdb);
trie.insert(b"doe", b"reindeer".to_vec()).unwrap();
trie.insert(b"dog", b"puppy".to_vec()).unwrap();
trie.insert(b"dogglesworth", b"cat".to_vec()).unwrap();
let root = trie.root().unwrap();
let r = format!("0x{}", hex::encode(trie.root().unwrap()));
assert_eq!(
r.as_str(),
"0x8aad789dff2f538bca5d8ea56e8abe10f4c7ba3a5dea95fea4cd6e7c3a1168d3"
);
// proof of key exists
let proof = trie.get_proof(b"doe").unwrap();
let expected = vec![
"e5831646f6a0db6ae1fda66890f6693f36560d36b4dca68b4d838f17016b151efe1d4c95c453",
"f83b8080808080ca20887265696e6465657280a037efd11993cb04a54048c25320e9f29c50a432d28afdf01598b2978ce1ca3068808080808080808080",
];
assert_eq!(
proof
.clone()
.into_iter()
.map(hex::encode)
.collect::<Vec<_>>(),
expected
);
let value = trie.verify_proof(root.clone(), b"doe", proof).unwrap();
assert_eq!(value, Some(b"reindeer".to_vec()));
// proof of key not exist
let proof = trie.get_proof(b"dogg").unwrap();
let expected = vec![
"e5831646f6a0db6ae1fda66890f6693f36560d36b4dca68b4d838f17016b151efe1d4c95c453",
"f83b8080808080ca20887265696e6465657280a037efd11993cb04a54048c25320e9f29c50a432d28afdf01598b2978ce1ca3068808080808080808080",
"e4808080808080ce89376c6573776f72746883636174808080808080808080857075707079",
];
assert_eq!(
proof
.clone()
.into_iter()
.map(hex::encode)
.collect::<Vec<_>>(),
expected
);
let value = trie.verify_proof(root.clone(), b"dogg", proof).unwrap();
assert_eq!(value, None);
// empty proof
let proof = vec![];
let value = trie.verify_proof(root.clone(), b"doe", proof);
assert_eq!(value.is_err(), true);
// bad proof
let proof = vec![b"aaa".to_vec(), b"ccc".to_vec()];
let value = trie.verify_proof(root.clone(), b"doe", proof);
assert_eq!(value.is_err(), true);
} | rust_cleaned_test_functions.jsonl/37144 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1118
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
86757,
34729,
368,
341,
262,
1077,
5206,
1833,
1999,
284,
13850,
3506,
486,
931,
3715,
317,
262,
1077,
5206,
59067,
284,
53934,
51,
7231,
51440,
486,
931,
2099,
6984,
1833,
1999,
317,
262,
59067,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bool_ord() {
assert!(true > false);
assert!(!(false > true));
assert!(false < true);
assert!(!(true < false));
assert!(false <= false);
assert!(false >= false);
assert!(true <= true);
assert!(true >= true);
assert!(false <= true);
assert!(!(false >= true));
assert!(true >= false);
assert!(!(true <= false));
} | rust_cleaned_test_functions.jsonl/83464 | {
"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,
22159,
67324,
368,
341,
286,
2060,
10297,
1866,
861,
895,
317,
286,
2060,
0,
33660,
3849,
861,
830,
3237,
286,
2060,
10297,
3849,
366,
830,
317,
286,
2060,
0,
33660,
1866,
366,
895,
3237,
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_attr_required() {
let xml = br#"<?xml version="1.0"?>
<x a="1" b="2"></x>"#;
with_parser(xml, |mut p| {
p.document(|p, _| {
p.element_with_name("x", |_, elem| {
assert!(elem.attr_required("a").is_ok());
assert!(elem.attr_required("b").is_ok());
assert!(elem.attr_required("c").is_err());
assert!(elem.attr_required("d").is_err());
Ok(())
})
})
})
.unwrap();
} | rust_cleaned_test_functions.jsonl/39193 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 365
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10422,
18743,
368,
341,
286,
1077,
8396,
284,
1411,
55543,
1316,
6455,
2319,
428,
16,
13,
15,
85990,
310,
366,
87,
264,
428,
16,
1,
293,
428,
17,
2000,
87,
9877,
2,
401,
286,
448,
18517,
299... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_writer_properties_panic_when_dictionary_is_enabled() {
WriterProperties::builder()
.set_dictionary_enabled(true)
.set_column_encoding(ColumnPath::from("col"), Encoding::RLE_DICTIONARY)
.build();
} | rust_cleaned_test_functions.jsonl/56726 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28908,
25158,
620,
31270,
47636,
42605,
6892,
18220,
368,
341,
286,
29404,
7903,
486,
17850,
741,
310,
659,
746,
42605,
18220,
3715,
340,
310,
659,
746,
8744,
37613,
95105,
1820,
486,
1499,
445,
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 |
#[test]
fn test_insert() {
let ddl = "\
CREATE TABLE clickhouse_test_insert (\
int8 Int8, \
int16 Int16, \
int32 Int32, \
int64 Int64, \
uint8 UInt8, \
uint16 UInt16, \
uint32 UInt32, \
uint64 UInt64, \
float32 Float32, \
float64 Float64, \
string String, \
date Date, \
datetime DateTime \
) Engine=Memory";
let block = Block::new()
.column("int8", vec![-1_i8, -2, -3, -4, -5, -6, -7])
.column("int16", vec![-1_i16, -2, -3, -4, -5, -6, -7])
.column("int32", vec![-1_i32, -2, -3, -4, -5, -6, -7])
.column("int64", vec![-1_i64, -2, -3, -4, -5, -6, -7])
.column("uint8", vec![1_u8, 2, 3, 4, 5, 6, 7])
.column("uint16", vec![1_u16, 2, 3, 4, 5, 6, 7])
.column("uint32", vec![1_u32, 2, 3, 4, 5, 6, 7])
.column("uint64", vec![1_u64, 2, 3, 4, 5, 6, 7])
.column("float32", vec![1.0_f32, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0])
.column("float64", vec![1.0_f64, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0])
.column("string", vec!["1", "2", "3", "4", "5", "6", "7"])
.column(
"date",
vec![
UTC.ymd(2016, 10, 22),
UTC.ymd(2016, 10, 22),
UTC.ymd(2016, 10, 22),
UTC.ymd(2016, 10, 22),
UTC.ymd(2016, 10, 22),
UTC.ymd(2016, 10, 22),
UTC.ymd(2016, 10, 22),
],
)
.column(
"datetime",
vec![
UTC.ymd(2016, 10, 22).and_hms(12, 0, 0),
UTC.ymd(2016, 10, 22).and_hms(12, 0, 0),
UTC.ymd(2016, 10, 22).and_hms(12, 0, 0),
UTC.ymd(2016, 10, 22).and_hms(12, 0, 0),
UTC.ymd(2016, 10, 22).and_hms(12, 0, 0),
UTC.ymd(2016, 10, 22).and_hms(12, 0, 0),
UTC.ymd(2016, 10, 22).and_hms(12, 0, 0),
],
);
let expected = block.clone();
let pool = Pool::new(database_url());
let done = pool
.get_handle()
.and_then(move |c| c.execute("DROP TABLE IF EXISTS clickhouse_test_insert"))
.and_then(move |c| c.execute(ddl))
.and_then(move |c| c.insert("clickhouse_test_insert", block))
.and_then(move |c| c.query("SELECT * FROM clickhouse_test_insert").fetch_all())
.map(move |(_, actual)| assert_eq!(expected.as_ref(), &actual));
run(done).unwrap()
} | rust_cleaned_test_functions.jsonl/30929 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1592
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
368,
341,
262,
1077,
55780,
284,
93317,
2290,
30776,
14363,
4205,
7675,
4452,
17678,
320,
5661,
2290,
526,
23,
220,
1333,
23,
11,
3044,
2290,
526,
16,
21,
1333,
16,
21,
11,
3044,
2290,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_fame_restrict_author() {
crate::grit_test::set_test_logging(LOG_LEVEL);
let td: TempDir = crate::grit_test::init_repo();
let path = td.path().to_str().unwrap();
let args = FameArgs::new(
path.to_string(),
Some("loc".to_string()),
None,
None,
None,
None,
Some(String::from("todd-bush")),
false,
None,
);
let fame = Fame::new(args);
let start = Instant::now();
let result = match fame.process() {
Ok(()) => true,
Err(_t) => false,
};
let duration = start.elapsed();
assert!(
result,
"test_process_fame_restrict_author result was {}",
result
);
println!(
"completed test_process_fame_restrict_author in {:?}",
duration
);
} | rust_cleaned_test_functions.jsonl/5823 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 527
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
761,
373,
97684,
22938,
368,
341,
286,
17717,
486,
901,
275,
4452,
486,
746,
4452,
59982,
24850,
17415,
626,
286,
1077,
17941,
25,
19944,
6184,
284,
17717,
486,
901,
275,
4452,
486,
2327,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_trait_method_completion() {
check(
r#"
struct A {}
trait Trait { fn the_method(&self); }
impl Trait for A {}
fn foo(a: A) { a.$0 }
"#,
expect![[r#"
me the_method() -> ()
"#]],
);
} | rust_cleaned_test_functions.jsonl/26252 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 160
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
78491,
9032,
60164,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
1235,
362,
5613,
29432,
68301,
314,
5168,
279,
9032,
2099,
721,
1215,
456,
6383,
68301,
369,
362,
5613,
8822,
15229,
2877,
25,
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_compile_simple() {
let creator = new_creator();
let f = TestFixture::new();
let parsed_args = ParsedArguments {
input: "foo.c".into(),
language: Language::C,
depfile: None,
outputs: vec![("obj", "foo.o".into())].into_iter().collect(),
preprocessor_args: vec!(),
common_args: vec!(),
extra_hash_files: vec!(),
msvc_show_includes: false,
profile_generate: false,
};
let compiler = &f.bins[0];
// Compiler invocation.
next_command(&creator, Ok(MockChild::new(exit_status(0), "", "")));
let mut path_transformer = dist::PathTransformer::new();
let (command, dist_command, cacheable) = generate_compile_commands(&mut path_transformer,
&compiler,
&parsed_args,
f.tempdir.path(),
&[]).unwrap();
#[cfg(feature = "dist-client")]
assert!(dist_command.is_some());
#[cfg(not(feature = "dist-client"))]
assert!(dist_command.is_none());
let _ = command.execute(&creator).wait();
assert_eq!(Cacheable::Yes, cacheable);
// Ensure that we ran all processes.
assert_eq!(0, creator.lock().unwrap().children.len());
} | rust_cleaned_test_functions.jsonl/15027 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 882
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74170,
30015,
368,
341,
286,
1077,
19919,
284,
501,
68532,
543,
286,
1077,
282,
284,
3393,
18930,
486,
931,
543,
286,
1077,
15676,
8384,
284,
393,
18112,
19139,
341,
310,
1946,
25,
330,
7975,
52... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_fop_stats() {
let aggr_test_data = {
let mut f = File::open("tests/fop_aggr_sample.json").unwrap();
let mut s = String::new();
f.read_to_string(&mut s).unwrap();
s
};
let inter_test_data = {
let mut f = File::open("tests/fop_inter_sample.json").unwrap();
let mut s = String::new();
f.read_to_string(&mut s).unwrap();
s
};
let aggr_result = gluster::fop::read_aggr_fop(&aggr_test_data, "_mnt_xvdf").unwrap();
let inter_result = gluster::fop::read_inter_fop(&inter_test_data, "_mnt_xvdf").unwrap();
println!("Aggr result: {:?}", aggr_result);
println!("Inter result: {:?}", inter_result);
} | rust_cleaned_test_functions.jsonl/103588 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 333
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
761,
453,
15381,
368,
341,
262,
1077,
933,
901,
4452,
1769,
284,
341,
286,
1077,
5206,
282,
284,
2887,
486,
2508,
445,
23841,
6663,
453,
20587,
901,
17491,
4323,
1827,
15454,
543,
286,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_chunks_within_distance_basic() {
let pos = position!(0.0, 0.0, 0.0);
let distance = vec3(16.0, 0.0, 16.0);
let chunks = chunks_within_distance(pos, distance);
dbg!(chunks.clone());
let set = chunks.into_iter().collect::<HashSet<_>>();
for x in -1..=1 {
for z in -1..=1 {
assert!(set.contains(&ChunkPosition::new(x, z)));
}
}
assert_eq!(set.len(), 9);
} | rust_cleaned_test_functions.jsonl/130414 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 259
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
65470,
72385,
19464,
34729,
368,
341,
286,
1077,
1133,
284,
2309,
10297,
15,
13,
15,
11,
220,
15,
13,
15,
11,
220,
15,
13,
15,
317,
286,
1077,
6010,
284,
7486,
18,
7,
16,
21,
13,
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... | 3 |
#[test]
fn test_to_string_succeeds() {
init!("true");
let handle = create_cred_def_fake();
let credential_string = to_string(handle).unwrap();
let credential_values: serde_json::Value = serde_json::from_str(&credential_string).unwrap();
assert_eq!(credential_values["version"].clone(), "1.0");
} | rust_cleaned_test_functions.jsonl/64627 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 151
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
3904,
643,
29264,
82,
368,
341,
286,
2930,
17223,
1866,
797,
286,
1077,
3705,
284,
1855,
73475,
7844,
56881,
543,
286,
1077,
40207,
3904,
284,
311,
3904,
26405,
568,
15454,
543,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_str() -> Result<(),Box<dyn std::error::Error>> {
let uid : UserId = "my-uid".parse()?;
assert_eq!(uid.value(), "my-uid");
Ok(())
} | rust_cleaned_test_functions.jsonl/70877 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
2895,
368,
1464,
5714,
68843,
1611,
92846,
1460,
486,
841,
486,
1454,
2452,
341,
286,
1077,
14617,
549,
40883,
284,
330,
2408,
12,
2423,
3263,
6400,
94136,
286,
2060,
10714,
10297,
2423,
282... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
#[test]
fn test_average_field_length_json() {
let mut field_num_tokens = HashMap::new();
let next_id = 100f64;
field_num_tokens.insert(100, 18);
field_num_tokens.insert(101, 123);
let json = average_field_length_json(field_num_tokens, next_id);
assert_tokens(
&json,
&[
Token::Map { len: Some(2) },
Token::Str("100"),
Token::F64(0.18),
Token::Str("101"),
Token::F64(1.23),
Token::MapEnd,
],
);
} | rust_cleaned_test_functions.jsonl/112248 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 350
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38594,
5013,
5118,
9455,
368,
341,
286,
1077,
5206,
2070,
4273,
28838,
284,
10528,
486,
931,
543,
286,
1077,
1790,
842,
284,
220,
16,
15,
15,
69,
21,
19,
280,
286,
2070,
4273,
28838,
7030,
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_encoding_struct() {
// v1
let mut dest = vec![];
let record = TestRecord {
value: 20,
value2: 10,
};
record.encode(&mut dest, 0).expect("encode");
assert_eq!(dest.len(), 1);
assert_eq!(dest[0], 20);
assert_eq!(record.write_size(0), 1);
let mut dest2 = vec![];
record.encode(&mut dest2, 2).expect("encodv2 encodee");
assert_eq!(dest2.len(), 2);
assert_eq!(dest2[1], 10);
// v2
} | rust_cleaned_test_functions.jsonl/126955 | {
"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,
37613,
15126,
368,
341,
286,
442,
348,
16,
198,
286,
1077,
5206,
3201,
284,
7486,
0,
15078,
286,
1077,
3255,
284,
3393,
6471,
341,
310,
897,
25,
220,
17,
15,
345,
310,
897,
17,
25,
220,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_net_unreachable() {
// Receive an IP packet for an unreachable destination address. Check to
// make sure that we respond with the appropriate ICMP message.
test_receive_ip_packet::<Ipv4, _, _, _, _>(
|sb| {
sb.ipv4_builder().forward(true);
},
&mut [0u8; 128],
SpecifiedAddr::new(Ipv4Addr::new([1, 2, 3, 4])).unwrap(),
64,
IpProto::Udp.into(),
&["send_icmpv4_net_unreachable", "send_icmp_error_message"],
Some((
IcmpDestUnreachable::default(),
Icmpv4DestUnreachableCode::DestNetworkUnreachable,
)),
// Ensure packet is truncated to the right length.
|packet| assert_eq!(packet.original_packet().bytes().len(), 84),
);
test_receive_ip_packet::<Ipv6, _, _, _, _>(
|sb| {
sb.ipv6_builder().forward(true);
},
&mut [0u8; 128],
SpecifiedAddr::new(Ipv6Addr::new([1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8]))
.unwrap(),
64,
IpProto::Udp.into(),
&["send_icmpv6_net_unreachable", "send_icmp_error_message"],
Some((IcmpDestUnreachable::default(), Icmpv6DestUnreachableCode::NoRoute)),
// Ensure packet is truncated to the right length.
|packet| assert_eq!(packet.original_packet().bytes().len(), 168),
);
} | rust_cleaned_test_functions.jsonl/65670 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 814
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19722,
4907,
46550,
368,
341,
286,
442,
37422,
458,
6790,
10151,
369,
458,
69322,
9106,
2621,
13,
4248,
311,
198,
286,
442,
1281,
2704,
429,
582,
5889,
448,
279,
8311,
83988,
1943,
624,
286,
127... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_subtype() {
assert_eq!(Value::Char('n').subtype(), None);
assert_eq!(Value::Int32(0).subtype(), None);
assert_eq!(Value::Float(0.0).subtype(), None);
assert_eq!(Value::String(String::from("noodles")).subtype(), None);
assert_eq!(Value::Hex(String::from("CAFE")).subtype(), None);
assert_eq!(Value::Int8Array(vec![0]).subtype(), Some(Subtype::Int8));
assert_eq!(Value::UInt8Array(vec![0]).subtype(), Some(Subtype::UInt8));
assert_eq!(Value::Int16Array(vec![0]).subtype(), Some(Subtype::Int16));
assert_eq!(Value::UInt16Array(vec![0]).subtype(), Some(Subtype::UInt16));
assert_eq!(Value::Int32Array(vec![0]).subtype(), Some(Subtype::Int32));
assert_eq!(Value::UInt32Array(vec![0]).subtype(), Some(Subtype::UInt32));
assert_eq!(Value::FloatArray(vec![0.0]).subtype(), Some(Subtype::Float));
} | rust_cleaned_test_functions.jsonl/93901 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 411
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
96228,
368,
341,
286,
2060,
10714,
10297,
1130,
486,
4768,
492,
77,
1823,
77241,
1507,
2240,
317,
286,
2060,
10714,
10297,
1130,
486,
1072,
18,
17,
7,
15,
568,
77241,
1507,
2240,
317,
286,
2060,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stereo_to_mono() {
let f2 = vec![1.0, 1.0, 2.0, 2.0, 3.0, 3.0];
let f1 = stereo_to_mono(f2);
assert_eq!(f1, vec![1.0, 2.0, 3.0]);
} | rust_cleaned_test_functions.jsonl/39989 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 120
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
64853,
2346,
60080,
368,
341,
286,
1077,
282,
17,
284,
7486,
20703,
16,
13,
15,
11,
220,
16,
13,
15,
11,
220,
17,
13,
15,
11,
220,
17,
13,
15,
11,
220,
18,
13,
15,
11,
220,
18,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.