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_lifetime() {
fn get_u16s<'a>(_: &'a u8) -> [&'a u16; 2] {
[
getconst!(LT<'a>),
getconst!(LT_COMMA<'a>),
]
}
// Putting LT_COMMA_BOUND in the return type so that its implied bounds make `'a == 'static`
fn get_u16s_static<'a>(_: &'a u8) -> ([&'a u16; 2], LT_BOUND_BOUND<'a>) {
(
[
getconst!(LT_BOUND_BOUND<'a>),
getconst!(LT_TWO_BOUNDS<'a, '_>),
],
LT_BOUND_BOUND::NEW,
)
}
let local = 0;
assert_eq!(get_u16s(&local), [&1337, &8337]);
{
let arr: [&'static u16; 2] = get_u16s(&0);
assert_eq!(arr, [&1337, &8337]);
}
{
let arr: [&u16; 2] = get_u16s_static(&0).0;
assert_eq!(arr, [&8000, &8007]);
}
} | rust_cleaned_test_functions.jsonl/46565 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 493
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
98827,
368,
341,
262,
5168,
633,
7300,
16,
21,
82,
18291,
64,
2235,
23211,
30136,
64,
575,
23,
8,
1464,
34336,
6,
64,
575,
16,
21,
26,
220,
17,
60,
341,
286,
2278,
310,
633,
1024,
10297,
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_passthrough_decoder_invalid_key() {
let body: &[u8] = &[16u8, 0x00]; // 16 is not a valid key command
let result = Command::decode_passthrough_command(body);
assert_matches!(result, Err(DecodeError::PassthroughInvalidPanelKey))
} | rust_cleaned_test_functions.jsonl/27512 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 121
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
79578,
86901,
49843,
31433,
3097,
368,
341,
286,
1077,
2487,
25,
44590,
84,
23,
60,
284,
44590,
16,
21,
84,
23,
11,
220,
15,
87,
15,
15,
5265,
442,
220,
16,
21,
374,
537,
264,
2697,
1376,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_in_union() {
use super::*;
// empty implicit arguments
assert!(!in_union(&[]));
// single implicit arguments
assert!(!in_union(&[Datum::I64(0)]));
assert!(in_union(&[Datum::I64(1)]));
// multiple implicit arguments
assert!(!in_union(&[Datum::I64(0), Datum::I64(1)]));
assert!(in_union(&[Datum::I64(1), Datum::I64(0)]));
} | rust_cleaned_test_functions.jsonl/12068 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 214
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
51621,
368,
341,
286,
990,
2256,
79304,
286,
442,
4287,
17995,
5977,
198,
286,
2060,
0,
3471,
258,
51621,
2099,
1294,
3237,
286,
442,
3175,
17995,
5977,
198,
286,
2060,
0,
3471,
258,
51621... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_a_single_constraint_with_pub_inputs() {
let constraint = Constraint {
a: 1,
b: 2,
c: 3,
qm: Scalar::zero(),
ql: Scalar::one(),
qr: Scalar::one(),
qo: -Scalar::one(),
qc: Scalar::zero(),
};
let constraint_system = ConstraintSystem {
var_num: 4,
public_inputs: vec![1, 2],
logic_constraints: vec![],
range_constraints: vec![],
sha256_constraints: vec![],
merkle_membership_constraints: vec![],
schnorr_constraints: vec![],
blake2s_constraints: vec![],
pedersen_constraints: vec![],
hash_to_field_constraints: vec![],
constraints: vec![constraint],
ecdsa_secp256k1_constraints: vec![],
fixed_base_scalar_mul_constraints: vec![],
};
// but none are supplied in public_inputs. So the verifier will not
// supply anything.
let case_1 = WitnessResult {
witness: Assignments(vec![(-1).into(), 2.into(), 1.into()]),
public_inputs: None,
result: false,
};
let case_2 = WitnessResult {
witness: Assignments(vec![Scalar::zero(), Scalar::zero(), Scalar::zero()]),
public_inputs: Some(Assignments(vec![Scalar::zero(), Scalar::zero()])),
result: true,
};
let case_3 = WitnessResult {
witness: Assignments(vec![Scalar::one(), 2.into(), 6.into()]),
public_inputs: Some(Assignments(vec![Scalar::one(), 3.into()])),
result: false,
};
// Not enough public inputs
let case_4 = WitnessResult {
witness: Assignments(vec![Scalar::one(), Scalar::from(2), Scalar::from(6)]),
public_inputs: Some(Assignments(vec![Scalar::one()])),
result: false,
};
let case_5 = WitnessResult {
witness: Assignments(vec![Scalar::one(), 2.into(), 3.into()]),
public_inputs: Some(Assignments(vec![Scalar::one(), 2.into()])),
result: true,
};
let case_6 = WitnessResult {
witness: Assignments(vec![Scalar::one(), 2.into(), 3.into()]),
public_inputs: Some(Assignments(vec![Scalar::one(), 3.into()])),
result: false,
};
test_circuit(
constraint_system,
vec![case_1, case_2, case_3, case_4, case_5, case_6],
);
} | rust_cleaned_test_functions.jsonl/28102 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1364
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4306,
19487,
46973,
6615,
34014,
28557,
368,
341,
286,
1077,
21568,
284,
44264,
341,
310,
264,
25,
220,
16,
345,
310,
293,
25,
220,
17,
345,
310,
272,
25,
220,
18,
345,
310,
2804,
76,
25,
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... | 1 |
#[test]
fn test_paths() {
let tmp_dir = tempdir().unwrap();
// Test if passing paths to GLib and getting them back
// gives us useful results
let dir_1 = tmp_dir.path().join("abcd");
fs::create_dir(&dir_1).unwrap();
assert_eq!(::path_get_basename(&dir_1), Some("abcd".into()));
assert_eq!(
::path_get_basename(dir_1.canonicalize().unwrap()),
Some("abcd".into())
);
assert_eq!(
::path_get_dirname(dir_1.canonicalize().unwrap()),
Some(tmp_dir.path().into())
);
assert!(::file_test(&dir_1, ::FileTest::EXISTS | ::FileTest::IS_DIR));
assert!(::file_test(
&dir_1.canonicalize().unwrap(),
::FileTest::EXISTS | ::FileTest::IS_DIR
));
// And test with some non-ASCII characters
let dir_2 = tmp_dir.as_ref().join("øäöü");
fs::create_dir(&dir_2).unwrap();
assert_eq!(::path_get_basename(&dir_2), Some("øäöü".into()));
assert_eq!(
::path_get_basename(dir_2.canonicalize().unwrap()),
Some("øäöü".into())
);
assert_eq!(
::path_get_dirname(dir_2.canonicalize().unwrap()),
Some(tmp_dir.path().into())
);
assert!(::file_test(&dir_2, ::FileTest::EXISTS | ::FileTest::IS_DIR));
assert!(::file_test(
&dir_2.canonicalize().unwrap(),
::FileTest::EXISTS | ::FileTest::IS_DIR
));
} | rust_cleaned_test_functions.jsonl/57263 | {
"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,
24152,
368,
341,
286,
1077,
4174,
4334,
284,
2730,
3741,
1005,
15454,
1428,
286,
442,
3393,
421,
12299,
12716,
311,
5588,
579,
323,
3709,
1105,
1182,
198,
286,
442,
6696,
601,
5390,
3059,
198,
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_default_val() {
let mut data = vec![
(1, Some("name:0"), 2),
(2, Some("name:3"), 3),
(4, Some("name:0"), 1),
(5, Some("name:5"), 4),
(6, Some("name:5"), 4),
(7, None, 4),
];
let product = ProductTable::new();
let added = ColumnBuilder::new()
.col_type(TYPE_LONG)
.default(Datum::I64(3))
.build();
let mut tbl = TableBuilder::new()
.add_col(product.id.clone())
.add_col(product.name.clone())
.add_col(product.count.clone())
.add_col(added.clone())
.build();
tbl.id = product.table.id;
let (_, endpoint) = init_with_data(&product, &data);
let expect: Vec<_> = data.drain(..5).collect();
let req = DAGSelect::from(&tbl).limit(5).build();
let mut resp = handle_select(&endpoint, req);
let mut row_count = 0;
let spliter = DAGChunkSpliter::new(resp.take_chunks().into_vec(), 4);
for (row, (id, name, cnt)) in spliter.zip(expect) {
let name_datum = name.map(|s| s.as_bytes()).into();
let expected_encoded =
datum::encode_value(&[id.into(), name_datum, cnt.into(), Datum::I64(3)]).unwrap();
let result_encoded = datum::encode_value(&row).unwrap();
assert_eq!(&*result_encoded, &*expected_encoded);
row_count += 1;
}
assert_eq!(row_count, 5);
} | rust_cleaned_test_functions.jsonl/34870 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 660
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9993,
6189,
368,
341,
262,
1077,
5206,
821,
284,
7486,
90515,
286,
320,
16,
11,
4329,
445,
606,
25,
15,
3975,
220,
17,
1326,
286,
320,
17,
11,
4329,
445,
606,
25,
18,
3975,
220,
18,
1326,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_options_de_untyped_global_value_no_crash() {
let res: Result<Options, String> = Options::from_configs(
// try parsing an HHVM option whose layout is none of the
&[r#"{
"hhvm.semr_thread_overrides": {
"global_value": {
"17":160,
"14":300,
"0":320
},
"local_value": { "4":300 },
"access":4
}
}"#],
&EMPTY_STRS,
);
assert_eq!(res.err(), None);
} | rust_cleaned_test_functions.jsonl/18290 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 369
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8743,
2259,
4907,
44181,
19296,
3142,
6536,
32331,
988,
368,
341,
286,
1077,
592,
25,
5714,
27,
3798,
11,
923,
29,
284,
14566,
486,
1499,
59150,
1006,
310,
442,
1430,
22314,
458,
24756,
11187,
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_expect_at_least() {
let mock = mock("GET", "/hello").expect_at_least(3).create();
request("GET /hello", "");
request("GET /hello", "");
request("GET /hello", "");
mock.assert();
} | rust_cleaned_test_functions.jsonl/82431 | {
"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,
68918,
3752,
88716,
368,
341,
262,
1077,
7860,
284,
7860,
445,
3806,
497,
3521,
14990,
1827,
17119,
3752,
88716,
7,
18,
568,
3182,
1428,
262,
1681,
445,
3806,
608,
14990,
497,
14498,
262,
1681,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_client_request_encode_orig_case() {
use crate::proto::BodyLength;
use http::header::{HeaderValue, CONTENT_LENGTH};
let mut head = MessageHead::default();
head.headers
.insert("content-length", HeaderValue::from_static("10"));
head.headers
.insert("content-type", HeaderValue::from_static("application/json"));
let mut orig_headers = HeaderCaseMap::default();
orig_headers.insert(CONTENT_LENGTH, "CONTENT-LENGTH".into());
head.extensions.insert(orig_headers);
let mut vec = Vec::new();
Client::encode(
Encode {
head: &mut head,
body: Some(BodyLength::Known(10)),
keep_alive: true,
req_method: &mut None,
title_case_headers: false,
},
&mut vec,
)
.unwrap();
assert_eq!(
&*vec,
b"GET / HTTP/1.1\r\nCONTENT-LENGTH: 10\r\ncontent-type: application/json\r\n\r\n"
.as_ref(),
);
} | rust_cleaned_test_functions.jsonl/7668 | {
"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,
8179,
7893,
11224,
35328,
19096,
368,
341,
286,
990,
17717,
486,
15110,
486,
5444,
4373,
280,
286,
990,
1758,
486,
2708,
22964,
97721,
11,
35768,
15023,
2315,
286,
1077,
5206,
1968,
284,
4856,
123... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_orthonormalize() {
let matrix: Array2<f64> = generate::random((10, 10)) * 10.0;
let (n, l) = orthonormalize(matrix.clone()).unwrap();
// check for orthogonality
let identity = n.dot(&n.t());
close_l2(&identity, &Array2::eye(10), 1e-2);
// compare returned factorization with QR decomposition
let (_, r) = matrix.qr().unwrap();
close_l2(&r.mapv(|x| x.abs()), &l.t().mapv(|x| x.abs()), 1e-2);
} | rust_cleaned_test_functions.jsonl/61616 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 234
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
2364,
263,
2492,
551,
368,
341,
286,
1077,
6172,
25,
2910,
17,
63895,
21,
19,
29,
284,
6923,
486,
11463,
1188,
16,
15,
11,
220,
16,
15,
593,
353,
220,
16,
15,
13,
15,
401,
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_clone_with_unclonable() {
// thinks it needs to clone the T type and required manual cloning. If not fixed this
// test wouldn't compile.
struct Unclonable {}
let (sender, receiver) = create::<Unclonable>(5, 10);
let _s_clone = sender.clone();
let _r_clone = receiver.clone();
} | rust_cleaned_test_functions.jsonl/83269 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54742,
6615,
4907,
564,
263,
480,
368,
341,
1789,
286,
442,
15482,
432,
3880,
311,
14715,
279,
350,
943,
323,
2567,
11376,
77866,
13,
1416,
537,
8356,
419,
198,
286,
442,
1273,
8270,
944,
19192,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ambiguous_option() {
let err = OptParseError::ambiguous_option("--abc", "abcd, abce");
let thing = format!("{}", err);
let expect = "Ambiguous option: --abc: abcd, abce";
assert_eq!(thing, expect);
} | rust_cleaned_test_functions.jsonl/8280 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
90213,
9672,
368,
341,
286,
1077,
1848,
284,
16554,
14463,
1454,
486,
90213,
9672,
21549,
13683,
497,
330,
68644,
11,
668,
346,
797,
286,
1077,
3166,
284,
3561,
79878,
1848,
317,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parsed_module_analyze_dependencies() {
let specifier = resolve_url_or_path("https://deno.land/x/mod.js").unwrap();
let source = r#"import * as bar from "./test.ts";
const foo = await import("./foo.ts");
"#;
let parsed_module =
parse(specifier.as_str(), source, &MediaType::JavaScript)
.expect("could not parse module");
let actual = parsed_module.analyze_dependencies();
assert_eq!(
actual,
vec![
DependencyDescriptor {
kind: DependencyKind::Import,
is_dynamic: false,
leading_comments: Vec::new(),
col: 0,
line: 1,
specifier: "./test.ts".into(),
specifier_col: 21,
specifier_line: 1,
import_assertions: HashMap::default(),
},
DependencyDescriptor {
kind: DependencyKind::Import,
is_dynamic: true,
leading_comments: Vec::new(),
col: 22,
line: 2,
specifier: "./foo.ts".into(),
specifier_col: 29,
specifier_line: 2,
import_assertions: HashMap::default(),
}
]
);
} | rust_cleaned_test_functions.jsonl/2737 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 568
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75788,
10750,
12008,
55856,
71841,
368,
341,
262,
1077,
97616,
284,
8830,
2903,
8734,
2638,
445,
2428,
1110,
5183,
78,
87627,
10776,
38479,
2857,
1827,
15454,
543,
262,
1077,
2530,
284,
435,
55543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_last_mut() {
let mut a = vec![];
assert_eq!(a.as_mut_slice().last_mut(), None);
a = vec![11i];
assert_eq!(*a.as_mut_slice().last_mut().unwrap(), 11);
a = vec![11i, 12];
assert_eq!(*a.as_mut_slice().last_mut().unwrap(), 12);
} | rust_cleaned_test_functions.jsonl/108290 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12195,
29523,
368,
341,
286,
1077,
5206,
264,
284,
7486,
0,
15078,
286,
2060,
10714,
10297,
64,
5357,
29523,
26488,
1005,
4259,
29523,
1507,
2240,
317,
286,
264,
284,
7486,
20703,
16,
16,
72,
93... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_primitive() {
for (buf, res) in vec![
("void", Primitive::Void),
("char", Primitive::Char),
("signed char", Primitive::SignedChar),
("unsigned char", Primitive::UnsignedChar),
("short", Primitive::Short),
("short int", Primitive::Short),
("signed short", Primitive::Short),
("signed short int", Primitive::Short),
("unsigned short", Primitive::UnsignedShort),
("unsigned short int", Primitive::UnsignedShort),
("signed", Primitive::Int),
("signed int", Primitive::Int),
("int", Primitive::Int),
("unsigned", Primitive::UnsignedInt),
("unsigned int", Primitive::UnsignedInt),
("float", Primitive::Float),
("double", Primitive::Double),
("long double", Primitive::LongDouble),
("bool", Primitive::Bool),
("wchar_t", Primitive::WcharT),
("char8_t", Primitive::Char8T),
("char16_t", Primitive::Char16T),
("char32_t", Primitive::Char32T),
("float _Complex", Primitive::FloatComplex),
("double _Complex", Primitive::DoubleComplex),
("long double _Complex", Primitive::LongDoubleComplex),
("float _Imaginary", Primitive::FloatImaginary),
("double _Imaginary", Primitive::DoubleImaginary),
("long double _Imaginary", Primitive::LongDoubleImaginary),
] {
let mut l = Lexer::<DefaultContext>::new(buf.as_bytes());
let p = DeclSpecifierParser::new(&mut l);
let mut context = Context::default();
let (_, (_, ty, _, _)) = p.parse(None, None, &mut context).unwrap();
let ty = match ty.as_ref().unwrap().base() {
BaseType::Primitive(ty) => ty,
_ => unreachable!(),
};
assert_eq!(*ty, res, "{}", buf);
}
} | rust_cleaned_test_functions.jsonl/117513 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 958
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84087,
368,
341,
286,
369,
320,
5909,
11,
592,
8,
304,
7486,
90515,
310,
3489,
1004,
497,
51460,
486,
35882,
1326,
310,
3489,
1762,
497,
51460,
486,
4768,
1326,
310,
3489,
2215,
1161,
497,
51460... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_component_spawn_off() -> () {
let system = KompactConfig::default().build().expect("System");
let comp = system.create(BlockingComponent::new);
system
.start_notify(&comp)
.wait_timeout(TIMEOUT)
.expect("Component didn't start");
comp.actor_ref()
.tell(BlockMe::SpawnOff("gotcha".to_string()));
thread::sleep(TIMEOUT);
system
.kill_notify(comp.clone())
.wait_timeout(TIMEOUT)
.expect("Component didn't die");
comp.on_definition(|cd| {
assert_eq!(cd.test_string, "gotcha");
});
system.shutdown().expect("shutdown");
} | rust_cleaned_test_functions.jsonl/107762 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 347
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23406,
76026,
13651,
368,
1464,
1719,
341,
286,
1077,
1849,
284,
730,
14435,
531,
2648,
486,
2258,
1005,
5834,
1005,
17119,
445,
2320,
797,
286,
1077,
1367,
284,
1849,
2520,
7,
48266,
2189,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cohort_update_from_omaha() {
let mut cohort = Cohort::from_hint("hint");
let omaha_cohort = Cohort::new("my_cohort");
cohort.update_from_omaha(omaha_cohort);
assert_eq!(Some("my_cohort".to_string()), cohort.id);
assert_eq!(Some("hint".to_string()), cohort.hint);
assert_eq!(None, cohort.name);
} | rust_cleaned_test_functions.jsonl/23771 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 182
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
2267,
371,
8882,
5673,
62,
316,
13546,
368,
341,
286,
1077,
5206,
40844,
284,
83575,
371,
486,
1499,
45825,
445,
46125,
797,
286,
1077,
7861,
13546,
666,
2267,
371,
284,
83575,
371,
486,
93... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_keep_name() -> Result<()> {
let df = df![
"a" => [1, 2, 3],
"b" => [1, 2, 3]
]?;
let out = df
.lazy()
.select([
col("a").alias("bar").keep_name(),
col("b").alias("bar").keep_name(),
])
.collect()?;
assert_eq!(out.get_column_names(), &["a", "b"]);
Ok(())
} | rust_cleaned_test_functions.jsonl/157 | {
"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,
50293,
1269,
368,
1464,
5714,
71698,
341,
262,
1077,
6764,
284,
6764,
90515,
262,
330,
64,
1,
589,
508,
16,
11,
220,
17,
11,
220,
18,
1259,
262,
330,
65,
1,
589,
508,
16,
11,
220,
17,
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_neg_vector() {
let vector = Vector {
x: 1.0,
y: 1.5,
z: 2.0,
};
let expected_result = Vector {
x: -1.0,
y: -1.5,
z: -2.0,
};
assert_eq!(-vector, expected_result);
assert_eq!(-&vector, expected_result);
} | rust_cleaned_test_functions.jsonl/134054 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 220
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28209,
12247,
368,
341,
286,
1077,
4621,
284,
4196,
341,
310,
856,
25,
220,
16,
13,
15,
345,
310,
379,
25,
220,
16,
13,
20,
345,
310,
1147,
25,
220,
17,
13,
15,
345,
286,
3634,
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_opkind_try_from_usize() {
for value in OpKind::values() {
let converted = <OpKind as TryFrom<usize>>::try_from(value as usize).unwrap();
assert_eq!(converted, value);
}
assert!(<OpKind as TryFrom<usize>>::try_from(IcedConstants::OP_KIND_ENUM_COUNT).is_err());
assert!(<OpKind as TryFrom<usize>>::try_from(core::usize::MAX).is_err());
} | rust_cleaned_test_functions.jsonl/5960 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10287,
15314,
53283,
5673,
11306,
551,
368,
341,
2023,
897,
304,
10672,
10629,
486,
3661,
368,
341,
197,
10217,
16099,
284,
366,
7125,
10629,
438,
9735,
3830,
90244,
77595,
1539,
5673,
3679,
438,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_vec3_fmt() {
let a = Vec3::new(1.0, 2.0, 3.0);
#[cfg(all(target_feature = "sse2", not(feature = "scalar-math")))]
assert_eq!(format!("{:?}", a), "Vec3(__m128(1.0, 2.0, 3.0, 3.0))");
#[cfg(any(not(target_feature = "sse2"), feature = "scalar-math"))]
assert_eq!(format!("{:?}", a), "Vec3(1.0, 2.0, 3.0)");
assert_eq!(format!("{}", a), "[1, 2, 3]");
} | rust_cleaned_test_functions.jsonl/48581 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 221
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
18,
38128,
368,
341,
262,
1077,
264,
284,
11312,
18,
486,
931,
7,
16,
13,
15,
11,
220,
17,
13,
15,
11,
220,
18,
13,
15,
317,
262,
11506,
14072,
20388,
8637,
17069,
284,
330,
64513,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mvcc_delete_skip_filtered() {
let mut cfg = DbConfig::default();
cfg.writecf.disable_auto_compactions = true;
let dir = tempfile::TempDir::new().unwrap();
let builder = TestEngineBuilder::new().path(dir.path());
let engine = builder.build_with_cfg(&cfg).unwrap();
let raw_engine = engine.get_rocksdb();
let mut gc_runner = TestGCRunner {
ratio_threshold: Some(0.9),
..Default::default()
};
// So the construction of SST files will be:
must_prewrite_put(&engine, b"zkey", b"zvalue1", b"zkey", 101);
must_commit(&engine, b"zkey", 101, 102);
must_prewrite_put(&engine, b"zkey", b"zvalue2", b"zkey", 103);
must_commit(&engine, b"zkey", 103, 104);
must_prewrite_put(&engine, b"zkey", b"zvalue3", b"zkey", 105);
must_commit(&engine, b"zkey", 105, 106);
gc_runner.target_level = Some(6);
gc_runner.safe_point(50).gc(&raw_engine);
assert_eq!(rocksdb_level_file_counts(&raw_engine, CF_WRITE)[6], 1);
// So the construction of SST files will be:
must_prewrite_put(&engine, b"zkey", b"zvalue4", b"zkey", 111);
must_commit(&engine, b"zkey", 111, 112);
must_prewrite_put(&engine, b"zkey1", b"zvalue4", b"zkey1", 111);
must_commit(&engine, b"zkey1", 111, 112);
raw_engine.flush_cf(CF_WRITE, true).unwrap();
assert_eq!(rocksdb_level_file_counts(&raw_engine, CF_WRITE)[0], 1);
let level_files = rocksdb_level_files(&raw_engine, CF_WRITE);
let f = dir.path().join(&level_files[0][0]);
let f = f.to_str().unwrap().to_owned();
gc_runner.target_level = Some(5);
gc_runner.safe_point(50).gc_on_files(&raw_engine, &[f]);
assert_eq!(rocksdb_level_file_counts(&raw_engine, CF_WRITE)[5], 1);
assert_eq!(rocksdb_level_file_counts(&raw_engine, CF_WRITE)[6], 1);
// So the construction of SST files will be:
must_prewrite_delete(&engine, b"zkey", b"zkey", 121);
must_commit(&engine, b"zkey", 121, 122);
must_prewrite_delete(&engine, b"zkey1", b"zkey1", 121);
must_commit(&engine, b"zkey1", 121, 122);
raw_engine.flush_cf(CF_WRITE, true).unwrap();
assert_eq!(rocksdb_level_file_counts(&raw_engine, CF_WRITE)[0], 1);
let key_104 = Key::from_raw(b"zkey").append_ts(104.into()).into_encoded();
let key_112 = Key::from_raw(b"zkey").append_ts(112.into()).into_encoded();
let value_112 = raw_engine
.get_value_cf(CF_WRITE, &key_112)
.unwrap()
.unwrap();
// So the construction of SST files will be:
let level_files = rocksdb_level_files(&raw_engine, CF_WRITE);
let f = dir.path().join(&level_files[0][0]);
let f = f.to_str().unwrap().to_owned();
gc_runner.target_level = Some(5);
gc_runner.safe_point(130).gc_on_files(&raw_engine, &[f]);
assert_eq!(rocksdb_level_file_counts(&raw_engine, CF_WRITE)[0], 0);
assert_eq!(rocksdb_level_file_counts(&raw_engine, CF_WRITE)[5], 1);
assert_eq!(rocksdb_level_file_counts(&raw_engine, CF_WRITE)[6], 1);
// key_112 must be cleared by the compaction.
must_get(&engine, b"zkey", 120, b"zvalue3");
// Put `k_112` back to simulate it hasn't been compacted.
raw_engine.put_cf(CF_WRITE, &key_112, &value_112).unwrap();
// Delete `k_104` to simulate it has been cleared by traditional GC.
raw_engine.delete_cf(CF_WRITE, &key_104).unwrap();
// Do the last compaction:
// [key_112] will be deleted.
let level_files = rocksdb_level_files(&raw_engine, CF_WRITE);
let mut files = Vec::with_capacity(2);
for &level in &[5, 6] {
let f = dir.path().join(&level_files[level][0]);
files.push(f.to_str().unwrap().to_owned());
}
gc_runner.target_level = Some(6);
gc_runner
.callbacks_on_drop
.push(Arc::new(|filter: &WriteCompactionFilter| {
assert_eq!(filter.total_filtered, 5);
assert_eq!(filter.total_deleted, 1);
assert_eq!(filter.mvcc_delete_skip_older, 2);
}));
gc_runner.safe_point(130).gc_on_files(&raw_engine, &files);
// key_112 must be cleared by the compaction.
must_get_none(&engine, b"zkey", 120)
} | rust_cleaned_test_functions.jsonl/101621 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2210
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73187,
638,
11353,
44830,
51429,
368,
341,
286,
1077,
5206,
13286,
284,
11988,
2648,
486,
2258,
543,
286,
13286,
3836,
9792,
42628,
27740,
18177,
4020,
284,
830,
280,
286,
1077,
5419,
284,
54819,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_from() {
let mask: usize = 0b100010;
let bm = Bitmask::from(mask);
assert_eq!(bm, Bitmask::Flag2 | Bitmask::Flag6);
let value: usize = bm.into();
assert_eq!(value, mask);
} | rust_cleaned_test_functions.jsonl/52487 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 123
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
368,
341,
286,
1077,
6911,
25,
22301,
284,
220,
15,
65,
16,
15,
15,
15,
16,
15,
280,
286,
1077,
34868,
284,
6495,
11258,
486,
1499,
35306,
626,
286,
2060,
10714,
10297,
29307,
11,
6495,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_string() {
let av = AttrValue::from("str");
assert_eq!(av.into_string(), "str");
let av = AttrValue::from("String".to_string());
assert_eq!(av.into_string(), "String");
let av = AttrValue::from(Cow::from("BorrowedCow"));
assert_eq!(av.into_string(), "BorrowedCow");
} | rust_cleaned_test_functions.jsonl/20866 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 162
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
3904,
368,
341,
286,
1077,
1822,
284,
50943,
1130,
486,
1499,
445,
495,
797,
286,
2060,
10714,
10297,
402,
39860,
3904,
1507,
330,
495,
3071,
286,
1077,
1822,
284,
50943,
1130,
486,
1499,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_endpoint_bad_context_receiver() {
let (_, errors) = do_endpoint(
quote! {
method = GET,
path = "/a/b/c",
},
quote! {
async fn handler_xyz(&self) {}
},
)
.unwrap();
assert!(!errors.is_empty());
assert_eq!(
errors.get(1).map(ToString::to_string),
Some("Expected a non-receiver argument".to_string())
);
} | rust_cleaned_test_functions.jsonl/39860 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 291
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36699,
34199,
8467,
65691,
368,
341,
286,
1077,
39464,
5975,
8,
284,
653,
36699,
1006,
310,
12641,
0,
341,
394,
1714,
284,
7890,
345,
394,
1815,
284,
3521,
64,
3470,
2899,
756,
310,
1153,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_convert_lb() {
let grams_dollars = (Measure::from_str("1 gram"), Measure::from_str("1 dollar"));
assert_eq!(
Measure::from_str("2 dollars"),
convert(
Measure::from_str("2 grams"),
MeasureKind::Money,
vec![grams_dollars.clone()]
)
.unwrap()
);
assert_eq!(
Measure::from_str("56.699 dollars"),
convert(
Measure::from_str("2 oz"),
MeasureKind::Money,
vec![grams_dollars.clone()]
)
.unwrap()
);
assert_eq!(
Measure::from_str("226.796 dollars"),
convert(
Measure::from_str(".5 lb"),
MeasureKind::Money,
vec![grams_dollars.clone()]
)
.unwrap()
);
assert_eq!(
Measure::from_str("453.592 dollars"),
convert(
Measure::from_str("1 lb"),
MeasureKind::Money,
vec![grams_dollars.clone()]
)
.unwrap()
);
} | rust_cleaned_test_functions.jsonl/38587 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 711
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
63601,
368,
341,
286,
1077,
33319,
814,
965,
1561,
284,
320,
32236,
486,
1499,
2895,
445,
16,
23018,
3975,
34104,
486,
1499,
2895,
445,
16,
17692,
4010,
286,
2060,
10714,
33673,
310,
34104,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_baquoted_name() -> Result<()> {
let name = SqlName::new("safe_name").baquoted();
assert_eq!(&name, "`safe_name`");
let name = SqlName::new("safe_name").alias("sn").baquoted();
assert_eq!(&name, "`safe_name` AS sn");
let name = SqlName::new("safe_name").add("sub").alias("sn").baquoted();
assert_eq!(&name, "`safe_name`.`sub` AS sn");
let name = baname!("safe_name");
assert_eq!(&name, "`safe_name`");
let name = baname!("safe_name"; "sn");
assert_eq!(&name, "`safe_name` AS sn");
let name = baname!("safe_name", "sub"; "sn");
assert_eq!(&name, "`safe_name`.`sub` AS sn");
Ok(())
} | rust_cleaned_test_functions.jsonl/74808 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 341
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
64,
63725,
1269,
368,
1464,
5714,
71698,
341,
286,
1077,
829,
284,
7224,
675,
486,
931,
445,
18675,
1269,
1827,
4645,
63725,
543,
286,
2060,
10714,
0,
2099,
606,
11,
35973,
18675,
1269,
63,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_loose() {
let (mut tx, rx) = super::loose_bounded(10);
tx.try_send(1).unwrap();
for i in 2..11 {
tx.clone().try_send(i).unwrap();
}
for i in 1..super::CHECK_INTERVAL {
tx.force_send(i).unwrap();
}
assert_eq!(tx.try_send(4), Err(TrySendError::Full(4)));
tx.force_send(5).unwrap();
assert_eq!(tx.try_send(6), Err(TrySendError::Full(6)));
assert_eq!(rx.try_recv(), Ok(1));
for i in 2..11 {
assert_eq!(rx.recv(), Ok(i));
}
for i in 1..super::CHECK_INTERVAL {
assert_eq!(rx.try_recv(), Ok(i));
}
assert_eq!(rx.try_recv(), Ok(5));
assert_eq!(rx.try_recv(), Err(TryRecvError::Empty));
let timer = Instant::now();
assert_eq!(
rx.recv_timeout(Duration::from_millis(100)),
Err(RecvTimeoutError::Timeout)
);
assert!((i64::from(timer.elapsed().subsec_nanos()) - 100_000_000).abs() < 1_000_000);
tx.force_send(1).unwrap();
drop(rx);
assert_eq!(tx.force_send(2), Err(SendError(2)));
assert_eq!(tx.try_send(2), Err(TrySendError::Disconnected(2)));
for _ in 0..super::CHECK_INTERVAL {
assert_eq!(tx.try_send(2), Err(TrySendError::Disconnected(2)));
}
let (mut tx, rx) = super::loose_bounded(10);
tx.try_send(2).unwrap();
drop(tx);
assert_eq!(rx.recv(), Ok(2));
assert_eq!(rx.recv(), Err(RecvError));
assert_eq!(rx.try_recv(), Err(TryRecvError::Disconnected));
assert_eq!(
rx.recv_timeout(Duration::from_millis(100)),
Err(RecvTimeoutError::Disconnected)
);
let (mut tx, rx) = super::loose_bounded(10);
thread::spawn(move || {
thread::sleep(Duration::from_millis(100));
tx.try_send(10).unwrap();
});
let timer = Instant::now();
assert_eq!(rx.recv(), Ok(10));
assert!((i64::from(timer.elapsed().subsec_nanos()) - 100_000_000).abs() < 1_000_000);
} | rust_cleaned_test_functions.jsonl/43346 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5560,
960,
368,
341,
286,
1077,
320,
6984,
9854,
11,
19111,
8,
284,
2256,
486,
385,
960,
880,
13082,
7,
16,
15,
317,
286,
9854,
48779,
13565,
7,
16,
568,
15454,
543,
286,
369,
600,
304,
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... | 7 |
#[test]
fn test_display_hunks() {
// Simulate diffing:
// Old:
// foo
// New:
// bar
let lhs_mps = [MatchedPos {
kind: MatchKind::Novel {
highlight: TokenKind::Atom(AtomKind::Normal),
},
pos: SingleLineSpan {
line: 0.into(),
start_col: 0,
end_col: 3,
},
}];
let rhs_mps = [MatchedPos {
kind: MatchKind::Novel {
highlight: TokenKind::Atom(AtomKind::Normal),
},
pos: SingleLineSpan {
line: 0.into(),
start_col: 0,
end_col: 3,
},
}];
let mut novel_lhs = HashSet::new();
novel_lhs.insert(0.into());
let mut novel_rhs = HashSet::new();
novel_rhs.insert(0.into());
let hunks = [Hunk {
novel_lhs,
novel_rhs,
lines: vec![(Some(0.into()), Some(0.into()))],
}];
// Simple smoke test.
print(
&hunks,
80,
BackgroundColor::Dark,
"foo.el",
"Emacs Lisp",
"foo",
"bar",
&lhs_mps,
&rhs_mps,
);
} | rust_cleaned_test_functions.jsonl/79745 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 833
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14825,
1523,
15296,
368,
341,
286,
442,
4467,
6334,
3638,
287,
510,
1789,
286,
442,
10621,
510,
286,
442,
15229,
8945,
286,
442,
1532,
510,
286,
442,
3619,
198,
286,
1077,
22505,
717,
1690,
284,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_documented_conversions() {
let unspec: u8 = CtrlCmd::Unspec.into();
assert_eq!(unspec, libc::CTRL_CMD_UNSPEC as u8);
let unspec_variant = CtrlCmd::from(libc::CTRL_CMD_UNSPEC as u8);
assert_eq!(unspec_variant, CtrlCmd::Unspec);
} | rust_cleaned_test_functions.jsonl/101444 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26231,
291,
3382,
28290,
368,
341,
286,
1077,
6975,
992,
25,
575,
23,
284,
37014,
15613,
486,
1806,
9535,
39860,
543,
286,
2060,
10714,
10297,
359,
9535,
11,
42142,
486,
34440,
16344,
33399,
10943... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_build_upload_policy_with_file_size_exclusive_limit() -> Result<(), Box<dyn Error>> {
let policy = UploadPolicyBuilder::new_policy_for_bucket("test_bucket", &Config::default())
.file_size_limitation(15..20)
.build();
assert_eq!(policy.file_size_limitation(), (Some(15), Some(19)));
let v: Value = serde_json::from_str(policy.as_json().as_str())?;
assert_eq!(v["fsizeMin"], 15);
assert_eq!(v["fsizeLimit"], 19);
Ok(())
} | rust_cleaned_test_functions.jsonl/2362 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 238
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20801,
21691,
22773,
6615,
2458,
2368,
2702,
8336,
14763,
368,
1464,
5714,
68843,
8261,
92846,
4600,
2452,
341,
286,
1077,
4842,
284,
24996,
13825,
3297,
486,
931,
22773,
5478,
38749,
445,
1944,
387... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_zero_param() {
for zero_param in vec!["-z", "--zero"] {
let path = "/foo/bar/baz";
new_ucmd!()
.args(&[zero_param, "-a", path, path])
.succeeds()
.stdout_only("baz\0baz\0");
}
} | rust_cleaned_test_functions.jsonl/82225 | {
"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,
19359,
4090,
368,
341,
262,
369,
7168,
4090,
304,
7486,
0,
1183,
12,
89,
497,
14482,
14154,
1341,
341,
286,
1077,
1815,
284,
3521,
7975,
49513,
3470,
1370,
876,
286,
501,
68887,
2277,
0,
741,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_min() {
assert_eq!(1f32.min(&2f32), 1f32);
assert_eq!(2f32.min(&1f32), 1f32);
} | rust_cleaned_test_functions.jsonl/33100 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 76
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7260,
368,
341,
286,
2060,
10714,
10297,
16,
69,
18,
17,
4358,
2099,
17,
69,
18,
17,
701,
220,
16,
69,
18,
17,
317,
286,
2060,
10714,
10297,
17,
69,
18,
17,
4358,
2099,
16,
69,
18,
17,
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 |
#[test]
fn test_str_multistring_parsing() {
unsafe {
let input = b"zero\0one\0\0";
let ptr = input.as_ptr();
let expected = ["zero", "one"];
let mut it = expected.iter();
let result = from_c_multistring(ptr as *const libc::c_char, None, |c| {
let cbytes = c.as_bytes_no_nul();
assert_eq!(cbytes, it.next().unwrap().as_bytes());
});
assert_eq!(result, 2);
assert!(it.next().is_none());
}
} | rust_cleaned_test_functions.jsonl/76014 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 301
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2895,
26290,
73756,
620,
28598,
368,
341,
286,
19860,
341,
310,
1077,
1946,
284,
293,
1,
14154,
59,
15,
603,
59,
15,
59,
15,
876,
310,
1077,
10087,
284,
1946,
5357,
4348,
543,
310,
1077,
3601,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_contains_straight_flush() {
let mut cards = vec![];
cards.push(Card {
rank: Rank::Ace,
suit: Suit::Diamonds,
});
cards.push(Card {
rank: Rank::King,
suit: Suit::Diamonds,
});
cards.push(Card {
rank: Rank::Queen,
suit: Suit::Diamonds,
});
cards.push(Card {
rank: Rank::Jack,
suit: Suit::Diamonds,
});
cards.push(Card {
rank: Rank::Ten,
suit: Suit::Diamonds,
});
cards.push(Card {
rank: Rank::Nine,
suit: Suit::Spades,
});
cards.push(Card {
rank: Rank::Queen,
suit: Suit::Clubs,
});
let hand = Hand { cards: cards };
assert!(hand.contains_handvalue(&HandValue::StraightFlush(
BPStraightFlush { rank: Rank::Ace },
)));
assert!(!hand.contains_handvalue(&HandValue::StraightFlush(
BPStraightFlush { rank: Rank::King },
)));
} | rust_cleaned_test_functions.jsonl/80731 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 605
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
63598,
2895,
7386,
39213,
368,
341,
286,
1077,
5206,
7411,
284,
7486,
0,
15078,
286,
7411,
2552,
58645,
341,
310,
7077,
25,
19298,
486,
78695,
345,
310,
7781,
25,
32611,
486,
76510,
82,
345,
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_parse_get_id() {
let mem = &create_anon_guest_memory(&[(GuestAddress(0), 0x10000)], false).unwrap();
let mut queue = RequestVirtQueue::new(GuestAddress(0), &mem);
let request_header = RequestHeader::new(VIRTIO_BLK_T_GET_ID, 15);
queue.set_hdr_desc(0x1000, 0x1000, VIRTQ_DESC_F_NEXT, request_header);
// Read only data descriptor for GetDeviceId.
queue.set_data_desc(0x2000, 0x1000, VIRTQ_DESC_F_NEXT);
queue.check_parse_err(Error::UnexpectedReadOnlyDescriptor);
// data_len is < VIRTIO_BLK_ID_BYTES for GetDeviceID.
queue
.mut_data_desc()
.flags
.set(VIRTQ_DESC_F_NEXT | VIRTQ_DESC_F_WRITE);
queue.mut_data_desc().len.set(VIRTIO_BLK_ID_BYTES - 1);
queue.check_parse_err(Error::InvalidDataLength);
queue.mut_data_desc().len.set(VIRTIO_BLK_ID_BYTES);
queue.set_status_desc(0x3000, 0x1000, VIRTQ_DESC_F_WRITE);
queue.check_parse(true);
} | rust_cleaned_test_functions.jsonl/84870 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 499
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
3062,
842,
368,
341,
286,
1077,
1833,
284,
609,
3182,
12008,
263,
62739,
19195,
2099,
9697,
37804,
4286,
7,
15,
701,
220,
15,
87,
16,
15,
15,
15,
15,
25035,
895,
568,
15454,
543,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_getbits() {
assert_eq!(Scalar::from(1u32).get_bits(), vec![true]);
assert_eq!(Scalar::from(2u32).get_bits(), vec![false, true]);
assert_eq!(Scalar::from(5u32).get_bits(), vec![true, false, true]);
assert_eq!(
Scalar::from_u64_raw(127).get_bits(),
vec![true, true, true, true, true, true, true]
);
} | rust_cleaned_test_functions.jsonl/1923 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 204
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
11516,
368,
341,
286,
2060,
10714,
10297,
20639,
486,
1499,
7,
16,
84,
18,
17,
568,
455,
20034,
1507,
7486,
20703,
1866,
2558,
286,
2060,
10714,
10297,
20639,
486,
1499,
7,
17,
84,
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 |
#[test]
fn test_project_the() {
let schemaReplicant = prepopulated_typed_schemaReplicant(MinkowskiValueType::Long);
let causetq = r#"[:find (the ?e) (max ?t)
:where
[?e :foo/bar ?t]]"#;
let SQLCausetQ { allegrosql, args } = translate(&schemaReplicant, causetq);
assert_eq!(allegrosql, "SELECT * \
FROM \
(SELECT `?e` AS `?e`, max(`?t`) AS `(max ?t)` \
FROM \
(SELECT DISTINCT \
`Causets00`.e AS `?e`, \
`Causets00`.v AS `?t` \
FROM `causets` AS `Causets00` \
WHERE `Causets00`.a = 99)) \
WHERE `(max ?t)` IS NOT NULL");
assert_eq!(args, vec![]);
} | rust_cleaned_test_functions.jsonl/90731 | {
"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,
16352,
16068,
368,
341,
262,
1077,
10802,
18327,
35237,
284,
855,
8374,
7757,
528,
32501,
25371,
18327,
35237,
3189,
766,
28284,
60897,
486,
6583,
317,
262,
1077,
2162,
18187,
80,
284,
435,
55543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_accountsdb_compare_two_hash_entries() {
solana_logger::setup();
let key = Pubkey::new_unique();
let hash = Hash::new_unique();
let val = CalculateHashIntermediate::new(1, hash, 1, 1, key);
let hash2 = Hash::new_unique();
let val2 = CalculateHashIntermediate::new(0, hash2, 4, 1, key);
assert_eq!(
std::cmp::Ordering::Less,
AccountsHash::compare_two_hash_entries(&val, &val2)
);
let list = vec![val.clone(), val2.clone()];
let mut list_bkup = list.clone();
list_bkup.sort_by(AccountsHash::compare_two_hash_entries);
let list = AccountsHash::sort_hash_intermediate(vec![list], &mut HashStats::default());
assert_eq!(list, vec![list_bkup]);
let list = vec![val2, val.clone()]; // reverse args
let mut list_bkup = list.clone();
list_bkup.sort_by(AccountsHash::compare_two_hash_entries);
let list = AccountsHash::sort_hash_intermediate(vec![list], &mut HashStats::default());
assert_eq!(list, vec![list_bkup]);
let hash3 = Hash::new_unique();
let val3 = CalculateHashIntermediate::new(1, hash3, 2, 1, key);
assert_eq!(
std::cmp::Ordering::Equal,
AccountsHash::compare_two_hash_entries(&val, &val3)
);
let hash4 = Hash::new_unique();
let val4 = CalculateHashIntermediate::new(2, hash4, 6, 1, key);
assert_eq!(
std::cmp::Ordering::Greater,
AccountsHash::compare_two_hash_entries(&val, &val4)
);
let hash5 = Hash::new_unique();
let val5 = CalculateHashIntermediate::new(0, hash5, 8, 2, key);
assert_eq!(
std::cmp::Ordering::Greater,
AccountsHash::compare_two_hash_entries(&val, &val5)
);
} | rust_cleaned_test_functions.jsonl/17804 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 912
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55665,
1999,
32235,
23241,
8950,
26092,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
1376,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
5175,
284,
6531,
486,
931,
21218,
543,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mul() {
let mut rng = rand::thread_rng();
for _ in 0..1000 {
let p1: Permutation = rng.gen();
let k = rng.gen_range(0, 30);
let p2 = k * p1;
let mut p3 = I;
for _ in 0..k {
p3 = p3 + p1;
}
assert_eq!(p2, p3);
}
} | rust_cleaned_test_functions.jsonl/31490 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 238
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24944,
368,
341,
286,
1077,
5206,
28422,
284,
10382,
486,
4528,
66849,
543,
286,
369,
716,
304,
220,
15,
496,
16,
15,
15,
15,
341,
310,
1077,
281,
16,
25,
3616,
30971,
284,
28422,
22822,
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... | 3 |
#[test]
fn test_stxb_chain() {
test_interpreter_and_jit_asm!(
"
mov r0, r1
ldxb r9, [r0+0]
stxb [r0+1], r9
ldxb r8, [r0+1]
stxb [r0+2], r8
ldxb r7, [r0+2]
stxb [r0+3], r7
ldxb r6, [r0+3]
stxb [r0+4], r6
ldxb r5, [r0+4]
stxb [r0+5], r5
ldxb r4, [r0+5]
stxb [r0+6], r4
ldxb r3, [r0+6]
stxb [r0+7], r3
ldxb r2, [r0+7]
stxb [r0+8], r2
ldxb r1, [r0+8]
stxb [r0+9], r1
ldxb r0, [r0+9]
exit",
[
0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00,
],
(),
{ |_vm, res: Result| { res.unwrap() == 0x2a } },
21
);
} | rust_cleaned_test_functions.jsonl/59003 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 572
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
7929,
30583,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
6228,
286,
1974,
435,
15,
11,
435,
16,
198,
286,
26129,
7929,
435,
24,
11,
508,
81,
15,
10,
15,
921,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dataframe_plan() {
let mut ctx = create_context();
let df = ctx.sql(&"SELECT city, lat, lng FROM uk_cities").unwrap();
let plan = df.plan();
assert_eq!(
"Projection: #0, #1, #2\
\n TableScan: uk_cities projection=None",
format!("{:?}", plan)
);
} | rust_cleaned_test_functions.jsonl/2503 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77570,
26564,
368,
341,
286,
1077,
5206,
5635,
284,
1855,
8467,
543,
286,
1077,
6764,
284,
5635,
10045,
2099,
1,
4858,
3283,
11,
6844,
11,
24820,
4295,
14670,
666,
1361,
1827,
15454,
543,
286,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dim_array_extended_user_defined() {
let input = r#"
TYPE Card
Value AS INTEGER
END TYPE
DIM A(2) AS Card
"#;
assert_eq!(
linter_ok(input),
vec![TopLevelToken::Statement(Statement::Dim(
DimNameBuilder::new()
.bare_name("A")
.dim_type(DimType::Array(
vec![ArrayDimension {
lbound: None,
ubound: Expression::IntegerLiteral(2).at_rc(5, 11)
}],
Box::new(DimType::UserDefined(BareName::from("Card").at_rc(5, 17)))
))
.build_list_rc(5, 9)
))
.at_rc(5, 5)]
);
} | rust_cleaned_test_functions.jsonl/122476 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 437
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10791,
3858,
61678,
3317,
52870,
368,
341,
262,
1077,
1946,
284,
435,
2,
698,
262,
12454,
6795,
198,
286,
5162,
5752,
30381,
198,
262,
11176,
12454,
198,
262,
50859,
362,
7,
17,
8,
5752,
6795,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
let mut reader = Lexer::from_str("\"abc\"");
assert_tok(&mut reader, TokenKind::StringTail("abc".into()), 1, 1);
assert_end(&mut reader, 1, 6);
} | rust_cleaned_test_functions.jsonl/101135 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
368,
341,
286,
1077,
5206,
6604,
284,
85082,
486,
1499,
2895,
38915,
13683,
88385,
286,
2060,
76162,
2099,
6984,
6604,
11,
9660,
10629,
486,
703,
44795,
445,
13683,
3263,
18122,
11858,
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 |
#[test]
fn test_permissions_request_hrtime() {
let guard = PERMISSION_PROMPT_GUARD.lock().unwrap();
let mut perms0 = DenoPermissions::from_flags(&Flags {
..Default::default()
});
set_prompt_result(true);
assert_eq!(perms0.request_hrtime(), PermissionState::Allow);
let mut perms1 = DenoPermissions::from_flags(&Flags {
..Default::default()
});
set_prompt_result(false);
assert_eq!(perms1.request_hrtime(), PermissionState::Deny);
drop(guard);
} | rust_cleaned_test_functions.jsonl/78064 | {
"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,
44767,
7893,
70138,
1678,
368,
341,
262,
1077,
7616,
284,
96540,
71346,
2828,
84513,
7376,
21003,
1005,
15454,
543,
262,
1077,
5206,
82282,
15,
284,
9774,
78,
23851,
486,
1499,
14130,
2099,
9195,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_previous_status() {
let dir = tempdir().unwrap();
let repo = init_repo_with_tasks(
dir.path(),
&[
Task::new(TaskStatus::ToDo, "Bar"),
Task::new(TaskStatus::Done, "Bar"),
Task::new(TaskStatus::Done, "Baz"),
],
);
// Create a new devlog file with only the "todo" task
let p = repo.latest().unwrap().unwrap();
let next = p.next().unwrap();
write_tasks_to_file(&next.path(), &[Task::new(TaskStatus::ToDo, "Bar")]);
// check before the first logfile
check_status(&repo, 2, DisplayMode::ShowAll, "");
// check the first logfile
check_status(
&repo,
1,
DisplayMode::ShowAll,
"To Do:\n* Bar\n\nDone:\n+ Bar\n+ Baz\n",
);
// check the latest logfile
check_status(&repo, 0, DisplayMode::ShowAll, "To Do:\n* Bar\n");
} | rust_cleaned_test_functions.jsonl/36289 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 505
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
52552,
4773,
368,
341,
286,
1077,
5419,
284,
2730,
3741,
1005,
15454,
543,
286,
1077,
15867,
284,
2930,
37784,
6615,
32823,
1006,
310,
5419,
3875,
3148,
310,
609,
9640,
394,
5430,
486,
931,
47531,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_part1() {
let input_string = crate::util::read_file_to_string("./input/2018/day3.txt");
let input = generator(&input_string);
let result = part1(&input);
assert_eq!(result, 107_043);
} | rust_cleaned_test_functions.jsonl/41663 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 92
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10495,
16,
368,
341,
262,
1077,
1946,
3904,
284,
17717,
486,
1314,
486,
878,
2458,
2346,
3904,
13988,
1355,
14,
17,
15,
16,
23,
44739,
18,
3909,
797,
262,
1077,
1946,
284,
13823,
2099,
1355,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simple() {
::init().unwrap();
// Message without arguments
let seqnum = Seqnum::next();
let eos_msg = Message::new_eos().seqnum(seqnum).build();
match eos_msg.view() {
MessageView::Eos(eos_msg) => {
assert_eq!(eos_msg.get_seqnum(), seqnum);
assert!(eos_msg.get_structure().is_none());
}
_ => panic!("eos_msg.view() is not a MessageView::Eos(_)"),
}
// Message with arguments
let buffering_msg = Message::new_buffering(42).build();
match buffering_msg.view() {
MessageView::Buffering(buffering_msg) => {
assert_eq!(buffering_msg.get_percent(), 42);
}
_ => panic!("buffering_msg.view() is not a MessageView::Buffering(_)"),
}
} | rust_cleaned_test_functions.jsonl/90517 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 429
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
368,
341,
286,
3504,
2327,
1005,
15454,
1428,
286,
442,
4856,
2041,
5977,
198,
286,
1077,
12981,
2413,
284,
23744,
2413,
486,
3600,
543,
286,
1077,
61794,
6483,
284,
4856,
486,
931,
2204,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_create_already_in_use() {
let new_owner = Pubkey::new(&[9; 32]);
let from = Pubkey::new_unique();
let from_account = AccountSharedData::new(100, 0, &system_program::id());
let owned_key = Pubkey::new_unique();
// Attempt to create system account in account already owned by another program
let original_program_owner = Pubkey::new(&[5; 32]);
let owned_account = AccountSharedData::new(0, 0, &original_program_owner);
let unchanged_account = owned_account.clone();
let accounts = process_instruction(
&bincode::serialize(&SystemInstruction::CreateAccount {
lamports: 50,
space: 2,
owner: new_owner,
})
.unwrap(),
vec![(from, from_account.clone()), (owned_key, owned_account)],
vec![
AccountMeta {
pubkey: from,
is_signer: true,
is_writable: false,
},
AccountMeta {
pubkey: owned_key,
is_signer: true,
is_writable: false,
},
],
Err(SystemError::AccountAlreadyInUse.into()),
super::process_instruction,
);
assert_eq!(accounts[0].lamports(), 100);
assert_eq!(accounts[1], unchanged_account);
// Attempt to create system account in account that already has data
let owned_account = AccountSharedData::new(0, 1, &Pubkey::default());
let unchanged_account = owned_account.clone();
let accounts = process_instruction(
&bincode::serialize(&SystemInstruction::CreateAccount {
lamports: 50,
space: 2,
owner: new_owner,
})
.unwrap(),
vec![(from, from_account.clone()), (owned_key, owned_account)],
vec![
AccountMeta {
pubkey: from,
is_signer: true,
is_writable: false,
},
AccountMeta {
pubkey: owned_key,
is_signer: true,
is_writable: false,
},
],
Err(SystemError::AccountAlreadyInUse.into()),
super::process_instruction,
);
assert_eq!(accounts[0].lamports(), 100);
assert_eq!(accounts[1], unchanged_account);
// Attempt to create an account that already has lamports
let owned_account = AccountSharedData::new(1, 0, &Pubkey::default());
let unchanged_account = owned_account.clone();
let accounts = process_instruction(
&bincode::serialize(&SystemInstruction::CreateAccount {
lamports: 50,
space: 2,
owner: new_owner,
})
.unwrap(),
vec![(from, from_account), (owned_key, owned_account)],
vec![
AccountMeta {
pubkey: from,
is_signer: true,
is_writable: false,
},
AccountMeta {
pubkey: owned_key,
is_signer: true,
is_writable: false,
},
],
Err(SystemError::AccountAlreadyInUse.into()),
super::process_instruction,
);
assert_eq!(accounts[0].lamports(), 100);
assert_eq!(accounts[1], unchanged_account);
} | rust_cleaned_test_functions.jsonl/95876 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1935
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
80772,
1243,
15951,
368,
341,
286,
1077,
501,
29027,
284,
22611,
792,
486,
931,
2099,
58,
24,
26,
220,
18,
17,
2558,
286,
1077,
504,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
504... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_range_step_inclusive() {
assert!(range_step_inclusive(0i, 20, 5).collect::<Vec<int>>() ==
vec![0, 5, 10, 15, 20]);
assert!(range_step_inclusive(20i, 0, -5).collect::<Vec<int>>() ==
vec![20, 15, 10, 5, 0]);
assert!(range_step_inclusive(20i, 0, -6).collect::<Vec<int>>() ==
vec![20, 14, 8, 2]);
assert!(range_step_inclusive(200u8, 255, 50).collect::<Vec<u8>>() ==
vec![200u8, 250]);
assert!(range_step_inclusive(200i, -5, 1).collect::<Vec<int>>() ==
vec![]);
assert!(range_step_inclusive(200i, 200, 1).collect::<Vec<int>>() ==
vec![200]);
} | rust_cleaned_test_functions.jsonl/7956 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 342
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9698,
11946,
1243,
8336,
368,
341,
262,
2060,
10297,
9669,
11946,
1243,
8336,
7,
15,
72,
11,
220,
17,
15,
11,
220,
20,
568,
17384,
27638,
10050,
4159,
61586,
47761,
310,
7486,
20703,
15,
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_integer() {
assert_eq!(
Variant::VDouble(5.1).divide(Variant::VInteger(2)).unwrap(),
Variant::VDouble(2.55)
);
} | rust_cleaned_test_functions.jsonl/84614 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 140
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31725,
368,
341,
394,
2060,
10714,
33673,
503,
39292,
486,
53,
7378,
7,
20,
13,
16,
568,
59394,
12410,
15341,
486,
53,
3486,
7,
17,
4579,
15454,
3148,
503,
39292,
486,
53,
7378,
7,
17,
13,
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 |
#[test]
fn test_values_v2() {
let client = graph_serializer(GraphSON::V2);
let vertex = create_vertex(&client, "Traversal");
let g = traversal().with_remote(client);
let results = g.v(vertex.id()).values(()).to_list().unwrap();
assert_eq!(1, results.len());
let value = &results[0];
assert_eq!("Traversal", value.get::<String>().unwrap());
let results = g.v(vertex.id()).values("name").to_list().unwrap();
assert_eq!(1, results.len());
let value = &results[0];
assert_eq!("Traversal", value.get::<String>().unwrap());
let results = g.v(vertex.id()).values("fake").to_list().unwrap();
assert_eq!(0, results.len());
} | rust_cleaned_test_functions.jsonl/26285 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 276
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9146,
2273,
17,
368,
341,
262,
1077,
2943,
284,
4771,
67441,
63779,
2703,
486,
53,
17,
626,
262,
1077,
11936,
284,
1855,
26611,
2099,
2972,
11,
330,
76276,
3071,
262,
1077,
342,
284,
56302,
1005... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_misc_nock() {
// Operator 7: Compose
produces("[[42 44] [7 [4 0 3] [3 0 1]]]", "1");
produces("[42 [7 [4 0 1] [4 0 1]]]", "44");
// Operator 8: Push
produces("[42 [8 [4 0 1] [0 1]]]", "[43 42]");
produces("[42 [8 [4 0 1] [4 0 3]]]", "43");
// Operator 9: Call
// Operator 10: Hint
produces("[[1 2] [10 [3 [0 1]] [0 1]]]", "[1 [1 2]]");
produces("[[1 2 3 4] [10 [6 [1 [123 456]]] [0 1]]]", "[ 1 [[ 123 456 ][ 3 4 ]]]");
// Operator 11
produces("[[132 19] [11 37 [4 0 3]]]", "20");
produces("[[132 19] [11 [1 1 1] [4 0 3]]]", "20");
produces("[10 8 [1 1 1] 8 [1 0] 8 [1 6 [5 [0 15] 4 0 6] [0 28] 9 2 \
[0 2] [4 0 6] [[0 29] 7 [0 14] 8 [1 0] 8 [1 6 [5 [0 14] 0 \
6] [0 15] 9 2 [0 2] [4 0 6] [0 14] 4 0 15] 9 2 0 1] 0 15] \
9 2 0 1]",
"55");
} | rust_cleaned_test_functions.jsonl/29739 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 562
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
69350,
1089,
1176,
368,
341,
286,
442,
28498,
220,
22,
25,
1198,
2900,
198,
286,
18644,
10937,
58,
19,
17,
220,
19,
19,
60,
508,
22,
508,
19,
220,
15,
220,
18,
60,
508,
18,
220,
15,
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_dynamic_spendable_outputs_local_htlc_timeout_tx() {
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
// Create some initial channels
let chan_1 = create_announced_chan_between_nodes(&nodes, 0, 1, InitFeatures::known(), InitFeatures::known());
let (_, our_payment_hash, _) = route_payment(&nodes[0], &vec!(&nodes[1])[..], 9000000);
let local_txn = get_local_commitment_txn!(nodes[0], chan_1.2);
assert_eq!(local_txn[0].input.len(), 1);
check_spends!(local_txn[0], chan_1.3);
// Timeout HTLC on A's chain and so it can generate a HTLC-Timeout tx
mine_transaction(&nodes[0], &local_txn[0]);
check_closed_broadcast!(nodes[0], true);
check_added_monitors!(nodes[0], 1);
check_closed_event!(nodes[0], 1, ClosureReason::CommitmentTxConfirmed);
connect_blocks(&nodes[0], TEST_FINAL_CLTV - 1); // Confirm blocks until the HTLC expires
let htlc_timeout = {
let node_txn = nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap();
assert_eq!(node_txn.len(), 2);
check_spends!(node_txn[0], chan_1.3);
assert_eq!(node_txn[1].input.len(), 1);
assert_eq!(node_txn[1].input[0].witness.last().unwrap().len(), OFFERED_HTLC_SCRIPT_WEIGHT);
check_spends!(node_txn[1], local_txn[0]);
node_txn[1].clone()
};
mine_transaction(&nodes[0], &htlc_timeout);
connect_blocks(&nodes[0], BREAKDOWN_TIMEOUT as u32 - 1);
expect_payment_failed!(nodes[0], our_payment_hash, true);
// Verify that A is able to spend its own HTLC-Timeout tx thanks to spendable output event given back by its ChannelMonitor
let spend_txn = check_spendable_outputs!(nodes[0], node_cfgs[0].keys_manager);
assert_eq!(spend_txn.len(), 3);
check_spends!(spend_txn[0], local_txn[0]);
assert_eq!(spend_txn[1].input.len(), 1);
check_spends!(spend_txn[1], htlc_timeout);
assert_eq!(spend_txn[1].input[0].sequence, BREAKDOWN_TIMEOUT as u32);
assert_eq!(spend_txn[2].input.len(), 2);
check_spends!(spend_txn[2], local_txn[0], htlc_timeout);
assert!(spend_txn[2].input[0].sequence == BREAKDOWN_TIMEOUT as u32 ||
spend_txn[2].input[1].sequence == BREAKDOWN_TIMEOUT as u32);
} | rust_cleaned_test_functions.jsonl/16913 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 958
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45992,
643,
3740,
480,
35189,
13564,
49086,
17257,
20537,
17805,
368,
341,
10217,
26023,
1645,
18343,
82,
284,
1855,
45552,
1645,
18343,
82,
7,
17,
317,
10217,
2436,
18343,
82,
284,
1855,
5084,
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... | 2 |
#[test]
fn test_initable_with_init() {
let test = InitableTestType::new_uninit();
assert_ne!(0x123456789abcdef, test.value());
let result = unsafe { test.init(Option::<&Cancellable>::None) };
assert!(result.is_ok());
assert_eq!(0x123456789abcdef, test.value());
} | rust_cleaned_test_functions.jsonl/599 | {
"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,
6137,
480,
6615,
6137,
368,
341,
286,
1077,
1273,
284,
758,
15368,
2271,
929,
486,
931,
4907,
2327,
1428,
286,
2060,
13925,
10297,
15,
87,
16,
17,
18,
19,
20,
21,
22,
23,
24,
41202,
11,
1273... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cat_string() {
let api = IpfsApi::new("127.0.0.1", 5001);
let bytes = api.cat("QmWATWQ7fVPP2EFGu71UkfnqhYXDYH566qy47CnJDgvs8u").unwrap();
let string = String::from_utf8(bytes.collect()).unwrap();
assert_eq!("Hello World\n", &string);
} | rust_cleaned_test_functions.jsonl/83362 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 155
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20825,
3904,
368,
341,
286,
1077,
6330,
284,
35033,
3848,
6563,
486,
931,
445,
16,
17,
22,
13,
15,
13,
15,
13,
16,
497,
220,
20,
15,
15,
16,
626,
286,
1077,
5820,
284,
6330,
32632,
445,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_error_route_53_get_hosted_zone() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/error",
"route53-get-hosted-zone.xml",
);
let mock = MockRequestDispatcher::with_status(400).with_body(&mock_response);
let client = Route53Client::new(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = GetHostedZoneRequest::default();
let result = client.get_hosted_zone(request).sync();
assert!(!result.is_ok(), "parse error: {:?}", result);
} | rust_cleaned_test_functions.jsonl/45401 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 250
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
4096,
28109,
62,
20,
18,
3062,
12848,
291,
28692,
368,
341,
286,
1077,
7860,
9655,
284,
14563,
2582,
5062,
486,
878,
9655,
1006,
310,
330,
1944,
35569,
79372,
41737,
756,
310,
330,
8966,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_load_last_update_time() {
block_on(async {
let config = config_generator();
let mut storage = MemStorage::new();
let last_update_time = clock::now() - Duration::from_secs(999);
storage.set_int(LAST_UPDATE_TIME, time_to_i64(last_update_time)).await.unwrap();
let state_machine = StateMachine::new(
StubPolicyEngine,
StubHttpRequest,
StubInstaller::default(),
&config,
StubTimer,
StubMetricsReporter,
Rc::new(Mutex::new(storage)),
make_test_app_set(),
)
.await;
assert_eq!(
time_to_i64(last_update_time),
time_to_i64(state_machine.context.schedule.last_update_time)
);
});
} | rust_cleaned_test_functions.jsonl/94232 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 492
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12411,
12195,
8882,
3009,
368,
341,
286,
2504,
4470,
18285,
341,
310,
1077,
2193,
284,
2193,
25813,
543,
310,
1077,
5206,
5819,
284,
13550,
5793,
486,
931,
543,
310,
1077,
1537,
8882,
3009,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_version_generation_ord() {
assert!(Version::Stable(2).generation() > Version::Stable(1).generation());
assert!(Version::Stable(1).generation() > Version::Beta(1, None).generation());
assert!(Version::Stable(1).generation() < Version::Beta(2, None).generation());
assert!(Version::Stable(2).generation() > Version::Alpha(1, Some(2)).generation());
assert!(Version::Stable(1).generation() < Version::Alpha(2, Some(2)).generation());
assert!(Version::Beta(1, None).generation() > Version::Nonconformant("ver3".into()).generation());
assert!(Version::Stable(2).generation() > Version::Stable(1).generation());
assert!(Version::Stable(1).generation() < Version::Beta(2, None).generation());
assert!(Version::Stable(1).generation() < Version::Beta(2, Some(2)).generation());
assert!(Version::Stable(1).generation() < Version::Alpha(2, None).generation());
assert!(Version::Stable(1).generation() < Version::Alpha(2, Some(3)).generation());
assert!(Version::Stable(1).generation() > Version::Nonconformant("foo".to_string()).generation());
assert!(Version::Beta(1, Some(1)).generation() > Version::Beta(1, None).generation());
assert!(Version::Beta(1, Some(2)).generation() > Version::Beta(1, Some(1)).generation());
assert!(Version::Beta(1, None).generation() > Version::Alpha(1, None).generation());
assert!(Version::Beta(1, None).generation() > Version::Alpha(1, Some(3)).generation());
assert!(Version::Beta(1, None).generation() > Version::Nonconformant("foo".to_string()).generation());
assert!(
Version::Beta(1, Some(2)).generation() > Version::Nonconformant("foo".to_string()).generation()
);
assert!(Version::Alpha(1, Some(1)).generation() > Version::Alpha(1, None).generation());
assert!(Version::Alpha(1, Some(2)).generation() > Version::Alpha(1, Some(1)).generation());
assert!(
Version::Alpha(1, None).generation() > Version::Nonconformant("foo".to_string()).generation()
);
assert!(
Version::Alpha(1, Some(2)).generation() > Version::Nonconformant("foo".to_string()).generation()
);
assert!(
Version::Nonconformant("bar".to_string()).generation()
> Version::Nonconformant("foo".to_string()).generation()
);
assert!(
Version::Nonconformant("foo1".to_string()).generation()
> Version::Nonconformant("foo10".to_string()).generation()
);
// sort orders by default is ascending
// sorting with std::cmp::Reverse on generation gives you the latest generation versions first
let mut vers = vec![
Version::Beta(2, Some(2)),
Version::Stable(1),
Version::Nonconformant("hi".into()),
Version::Alpha(3, Some(2)),
Version::Stable(2),
Version::Beta(2, Some(3)),
];
vers.sort_by_cached_key(|x| Reverse(x.generation()));
assert_eq!(vers, vec![
Version::Alpha(3, Some(2)),
Version::Stable(2),
Version::Beta(2, Some(3)),
Version::Beta(2, Some(2)),
Version::Stable(1),
Version::Nonconformant("hi".into()),
]);
} | rust_cleaned_test_functions.jsonl/116492 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1384
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9438,
64191,
67324,
368,
341,
286,
2060,
10297,
5637,
486,
623,
480,
7,
17,
568,
80057,
368,
861,
6079,
486,
623,
480,
7,
16,
568,
80057,
1423,
286,
2060,
10297,
5637,
486,
623,
480,
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_equality() {
fn is_equal(a: &Fp6, b: &Fp6) -> bool {
let eq = a == b;
let ct_eq = a.ct_eq(b);
assert_eq!(eq, bool::from(ct_eq));
eq
}
assert!(is_equal(
&Fp6 {
c0: Fp::one(),
c1: Fp::new(2),
c2: Fp::new(3),
c3: Fp::new(4),
c4: Fp::new(5),
c5: Fp::new(6),
},
&Fp6 {
c0: Fp::one(),
c1: Fp::new(2),
c2: Fp::new(3),
c3: Fp::new(4),
c4: Fp::new(5),
c5: Fp::new(6),
}
));
assert!(!is_equal(
&Fp6 {
c0: Fp::new(2),
c1: Fp::new(2),
c2: Fp::new(3),
c3: Fp::new(4),
c4: Fp::new(5),
c5: Fp::new(6),
},
&Fp6 {
c0: Fp::one(),
c1: Fp::new(2),
c2: Fp::new(3),
c3: Fp::new(4),
c4: Fp::new(5),
c5: Fp::new(6),
}
));
assert!(!is_equal(
&Fp6 {
c0: Fp::one(),
c1: Fp::new(3),
c2: Fp::new(3),
c3: Fp::new(4),
c4: Fp::new(5),
c5: Fp::new(6),
},
&Fp6 {
c0: Fp::one(),
c1: Fp::new(2),
c2: Fp::new(3),
c3: Fp::new(4),
c4: Fp::new(5),
c5: Fp::new(6),
}
));
assert!(!is_equal(
&Fp6 {
c0: Fp::one(),
c1: Fp::new(2),
c2: Fp::new(4),
c3: Fp::new(4),
c4: Fp::new(5),
c5: Fp::new(6),
},
&Fp6 {
c0: Fp::one(),
c1: Fp::new(2),
c2: Fp::new(3),
c3: Fp::new(4),
c4: Fp::new(5),
c5: Fp::new(6),
}
));
assert!(!is_equal(
&Fp6 {
c0: Fp::one(),
c1: Fp::new(2),
c2: Fp::new(3),
c3: Fp::new(5),
c4: Fp::new(5),
c5: Fp::new(6),
},
&Fp6 {
c0: Fp::one(),
c1: Fp::new(2),
c2: Fp::new(3),
c3: Fp::new(4),
c4: Fp::new(5),
c5: Fp::new(6),
}
));
assert!(!is_equal(
&Fp6 {
c0: Fp::one(),
c1: Fp::new(2),
c2: Fp::new(3),
c3: Fp::new(4),
c4: Fp::new(6),
c5: Fp::new(6),
},
&Fp6 {
c0: Fp::one(),
c1: Fp::new(2),
c2: Fp::new(3),
c3: Fp::new(4),
c4: Fp::new(5),
c5: Fp::new(6),
}
));
assert!(!is_equal(
&Fp6 {
c0: Fp::one(),
c1: Fp::new(2),
c2: Fp::new(3),
c3: Fp::new(4),
c4: Fp::new(5),
c5: Fp::new(7),
},
&Fp6 {
c0: Fp::one(),
c1: Fp::new(2),
c2: Fp::new(3),
c3: Fp::new(4),
c4: Fp::new(5),
c5: Fp::new(6),
}
));
assert!(bool::from(Fp6::default().is_zero()));
assert!(!bool::from(Fp6::zero().ct_eq(&Fp6::one())));
assert_eq!(Fp6::zero(), Fp6::new([0, 0, 0, 0, 0, 0]));
assert_eq!(Fp6::one(), Fp6::new([1, 0, 0, 0, 0, 0]));
} | rust_cleaned_test_functions.jsonl/132381 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3034
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2204,
10473,
368,
341,
286,
5168,
374,
11478,
2877,
25,
609,
37,
79,
21,
11,
293,
25,
609,
37,
79,
21,
8,
1464,
1807,
341,
310,
1077,
8939,
284,
264,
621,
293,
280,
310,
1077,
20251,
10714,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_as_c_str() {
let subject = String::new("things are cool").unwrap();
let cstring = CString::new("things are cool").unwrap();
assert_eq!(subject.as_c_str(), cstring.as_c_str());
} | rust_cleaned_test_functions.jsonl/101283 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
666,
2895,
368,
341,
286,
1077,
3832,
284,
923,
486,
931,
445,
57074,
525,
7010,
1827,
15454,
543,
286,
1077,
272,
917,
284,
56956,
486,
931,
445,
57074,
525,
7010,
1827,
15454,
543,
286,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_dynamic() -> Result<()> {
let db = checked_memory_handle();
let sql = "BEGIN;
CREATE TABLE foo(x INTEGER, y TEXT);
INSERT INTO foo VALUES(4, 'hello');
END;";
db.execute_batch(sql)?;
db.query_row("SELECT * FROM foo", [], |r| {
assert_eq!(2, r.as_ref().column_count());
Ok(())
})
} | rust_cleaned_test_functions.jsonl/113062 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45992,
368,
1464,
5714,
71698,
341,
286,
1077,
2927,
284,
10067,
19195,
10630,
543,
286,
1077,
5704,
284,
330,
37588,
280,
5180,
30776,
14363,
15229,
2075,
30381,
11,
379,
15762,
317,
5180,
39518,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_ident() {
let foo = Ident::new("Foo", Span::call_site());
let bar = Ident::new(&format!("Bar{}", 7), Span::call_site());
let tokens = quote!(struct #foo; enum #bar {});
let expected = "struct Foo ; enum Bar7 { }";
assert_eq!(expected, tokens.to_string());
} | rust_cleaned_test_functions.jsonl/53402 | {
"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,
38399,
368,
341,
262,
1077,
15229,
284,
22507,
486,
931,
445,
40923,
497,
11903,
486,
6659,
24507,
1423,
262,
1077,
3619,
284,
22507,
486,
931,
2099,
2243,
17223,
3428,
42351,
220,
22,
701,
11903,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extra_mode() {
test_extra_mode_helper(
Arch::ARM,
Mode::Arm,
&[ExtraMode::V8],
&[("str", b"\x04\xe0\x2d\xe5")],
&[("vcvtt.f64.f16", b"\xe0\x3b\xb2\xee")],
);
} | rust_cleaned_test_functions.jsonl/127423 | {
"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,
31858,
7302,
368,
341,
262,
1273,
31858,
7302,
10418,
1006,
286,
9494,
486,
17911,
345,
286,
14562,
486,
32913,
345,
286,
44590,
11612,
3636,
486,
53,
23,
1259,
286,
44590,
445,
495,
497,
293,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_connect_new_point() {
let num_points = 10;
let m = 6;
let ef_construct = 32;
// See illustration in docs
let points: Vec<Vec<VectorElementType>> = vec![
vec![21.79, 7.18], // Target
vec![20.58, 5.46], // 1 B - yes
vec![21.19, 4.51], // 2 C
vec![24.73, 8.24], // 3 D - yes
vec![24.55, 9.98], // 4 E
vec![26.11, 6.85], // 5 F
vec![17.64, 11.14], // 6 G - yes
vec![14.97, 11.52], // 7 I
vec![14.97, 9.60], // 8 J
vec![16.23, 14.32], // 9 H
vec![12.69, 19.13], // 10 K
];
let scorer = |a: PointOffsetType, b: PointOffsetType| {
-((points[a as usize][0] - points[b as usize][0]).powi(2)
+ (points[a as usize][1] - points[b as usize][1]).powi(2))
.sqrt()
};
let mut insert_ids = (1..points.len() as PointOffsetType).collect_vec();
let mut candidates = FixedLengthPriorityQueue::new(insert_ids.len());
for &id in &insert_ids {
candidates.push(ScoredPointOffset {
idx: id,
score: scorer(0, id),
});
}
let res = GraphLayers::select_candidates_with_heuristic(candidates, m, scorer);
assert_eq!(&res, &vec![1, 3, 6]);
let mut rng = StdRng::seed_from_u64(42);
let mut graph_layers = GraphLayers::new(num_points, m, m, ef_construct, 1, true);
insert_ids.shuffle(&mut rng);
for &id in &insert_ids {
let level_m = graph_layers.get_m(0);
GraphLayers::connect_new_point(
&mut graph_layers.links_layers[0][0],
id,
0,
level_m,
scorer,
)
}
assert_eq!(graph_layers.links(0, 0), &vec![1, 2, 3, 4, 5, 6]);
} | rust_cleaned_test_functions.jsonl/59123 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1092
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15720,
5921,
6085,
368,
341,
286,
1077,
1629,
12928,
284,
220,
16,
15,
280,
286,
1077,
296,
284,
220,
21,
280,
286,
1077,
30369,
64803,
284,
220,
18,
17,
401,
286,
442,
3496,
39034,
304,
26340... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_macro() {
let _result = log::set_logger(PROXY_LOGGER.log_interface());
let udp_logger = udp_logger_rs::UdpLogger::default();
PROXY_LOGGER.set_logger(udp_logger);
let socket = std::net::UdpSocket::bind("127.0.0.1:4010").expect("unable to bind");
socket
.set_nonblocking(true)
.expect("unable to set nonblocking");
let mut kvs: std::collections::HashMap<String, String> = std::collections::HashMap::new();
kvs.insert("key1".into(), "Value1".into());
kvs.insert("Key2".into(), "Value2".into());
log!(kvs: &kvs, Level::Info, "logging Info w/ kv as HashMap");
let mut buf = [0; 4096];
std::thread::sleep(std::time::Duration::from_millis(20));
let (byte_count, _src_addr) = socket.recv_from(&mut buf).expect("udp datagram");
assert!(byte_count > 0);
let filled_buf = &mut buf[..byte_count];
let str = std::str::from_utf8(&filled_buf).unwrap();
let (time, ctx) = str.split_at(23);
// 2021-08-09 18:41:50.336 INFO [test] logging Info w/ kv as HashMap key1=Value1 Key2=Value2
let _dt = chrono::NaiveDateTime::parse_from_str(time, "%Y-%m-%d %H:%M:%S%.3f").unwrap();
let same = ctx == " INFO [test] logging Info w/ kv as HashMap key1=Value1 Key2=Value2"
|| ctx == " INFO [test] logging Info w/ kv as HashMap Key2=Value2 key1=Value1";
if !same {
println!("{}", ctx);
}
assert!(same);
let kvs: std::vec::Vec<(String, String)> = vec![
("key1".into(), "Value1".into()),
("Key2".into(), "Value2".into()),
];
log!(kvs: &kvs, Level::Info, "logging Info w/ kv as Vec");
assert!(UdpClient::pkt_eq(
&socket,
"127.0.0.1:4000",
" INFO [test] logging Info w/ kv as Vec key1=Value1 Key2=Value2"
));
} | rust_cleaned_test_functions.jsonl/10264 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 800
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58810,
368,
341,
262,
1077,
716,
1382,
284,
1487,
486,
746,
27413,
55681,
16356,
87673,
1665,
20546,
1423,
262,
1077,
49219,
27413,
284,
49219,
27413,
47115,
486,
52,
9796,
7395,
486,
2258,
543,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_eq_receivers() {
use borrow::Cow;
let borrowed: &Path = Path::new("foo/bar");
let mut owned: PathBuf = PathBuf::new();
owned.push("foo");
owned.push("bar");
let borrowed_cow: Cow<Path> = borrowed.into();
let owned_cow: Cow<Path> = owned.clone().into();
macro_rules! t {
($($current:expr),+) => {
$(
assert_eq!($current, borrowed);
assert_eq!($current, owned);
assert_eq!($current, borrowed_cow);
assert_eq!($current, owned_cow);
)+
}
}
t!(borrowed, owned, borrowed_cow, owned_cow);
} | rust_cleaned_test_functions.jsonl/19658 | {
"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,
10714,
1288,
346,
1945,
368,
341,
286,
990,
17193,
486,
89915,
401,
286,
1077,
45564,
25,
609,
1820,
284,
7933,
486,
931,
445,
7975,
49513,
797,
286,
1077,
5206,
12938,
25,
7933,
15064,
284,
793... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_h1_response_http_error_handling() {
let mut srv = TestServer::new(|| {
HttpService::build().h1(new_service_cfg(|_: &ServerConfig| {
Ok::<_, ()>(|_| {
let broken_header = Bytes::from_static(b"\0\0\0");
ok::<_, ()>(
Response::Ok()
.header(http::header::CONTENT_TYPE, broken_header)
.body(STR),
)
})
}))
});
let response = srv.block_on(srv.get("/").send()).unwrap();
assert_eq!(response.status(), http::StatusCode::INTERNAL_SERVER_ERROR);
// read response
let bytes = srv.load_body(response).unwrap();
assert_eq!(bytes, Bytes::from_static(b"failed to parse header value"));
} | rust_cleaned_test_functions.jsonl/102561 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 404
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1523,
16,
9655,
25888,
4096,
75642,
368,
341,
262,
1077,
5206,
43578,
284,
3393,
5475,
486,
931,
79453,
341,
286,
4823,
1860,
486,
5834,
1005,
71,
16,
1755,
12267,
18343,
22428,
23211,
609,
5475,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_hunk_header_style_box_file() {
_do_test_hunk_header_style_box_file(&[
"--hunk-header-style",
"file",
"--hunk-header-decoration-style",
"white box",
]);
} | rust_cleaned_test_functions.jsonl/70099 | {
"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,
1523,
3122,
8757,
15117,
10194,
2458,
368,
341,
286,
716,
2982,
4452,
1523,
3122,
8757,
15117,
10194,
2458,
2099,
9640,
310,
14482,
71,
3122,
9351,
11297,
756,
310,
330,
1192,
756,
310,
14482,
71,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_txn_store_cleanup_commit() {
let store = AssertionStorage::default();
store.put_ok(b"secondary", b"s-0", 1, 2);
store.prewrite_ok(
vec![
Mutation::Put((Key::from_raw(b"primary"), b"p-5".to_vec())),
Mutation::Put((Key::from_raw(b"secondary"), b"s-5".to_vec())),
],
b"primary",
5,
);
store.get_err(b"secondary", 8);
store.get_err(b"secondary", 12);
store.commit_ok(vec![b"primary"], 5, 10, 10);
store.cleanup_err(b"primary", 5, 0);
store.rollback_err(vec![b"primary"], 5);
} | rust_cleaned_test_functions.jsonl/63390 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 294
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
92299,
14809,
42444,
36346,
368,
341,
262,
1077,
3553,
284,
46730,
5793,
486,
2258,
543,
262,
3553,
3597,
19817,
1883,
1,
18699,
497,
293,
40787,
12,
15,
497,
220,
16,
11,
220,
17,
317,
262,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vendor_status_command_decode_fail() {
// generic vendor status command
let packet = &[
0x20, // GetElementAttributes pdu id
0x00, // single packet
0x00, 0x05,
0x00, 0x00, 0x00, 0x00, 0x00, // partial identifier
];
let result = VendorSpecificCommand::decode_command(
packet,
AvcPacketType::Command(AvcCommandType::Status),
);
assert_matches!(
result,
Err(DecodeError::VendorPacketDecodeError(
AvcCommandType::Status,
PduId::GetElementAttributes,
PacketError::InvalidMessageLength
))
);
} | rust_cleaned_test_functions.jsonl/27514 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 381
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58320,
4773,
10811,
15227,
22121,
368,
341,
286,
442,
13954,
20728,
2639,
3210,
198,
286,
1077,
10151,
284,
609,
9640,
310,
220,
15,
87,
17,
15,
11,
442,
2126,
1691,
10516,
96969,
877,
198,
310,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cdf() {
test_case(1.0, 0.1, 0.0, |x| x.cdf(0.0));
test_case(1.0, 0.1, 0.99995460007023751514846440848443944938976208191113, |x| x.cdf(1.0));
test_case(1.0, 0.1, 0.99999999999999999999999999999999999999999996279924, |x| x.cdf(10.0));
test_case(1.0, 1.0, 0.0, |x| x.cdf(0.0));
test_case(1.0, 1.0, 0.63212055882855767840447622983853913255418886896823, |x| x.cdf(1.0));
test_case(1.0, 1.0, 0.99995460007023751514846440848443944938976208191113, |x| x.cdf(10.0));
test_case(10.0, 10.0, 0.0, |x| x.cdf(0.0));
test_almost(10.0, 10.0, 9.9999999995000000000166666666662500000000083333333e-11, 1e-25, |x| x.cdf(1.0));
test_case(10.0, 10.0, 0.63212055882855767840447622983853913255418886896823, |x| x.cdf(10.0));
test_case(10.0, 1.0, 0.0, |x| x.cdf(0.0));
test_case(10.0, 1.0, 0.63212055882855767840447622983853913255418886896823, |x| x.cdf(1.0));
test_case(10.0, 1.0, 1.0, |x| x.cdf(10.0));
} | rust_cleaned_test_functions.jsonl/84313 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 595
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
2940,
368,
341,
286,
1273,
19096,
7,
16,
13,
15,
11,
220,
15,
13,
16,
11,
220,
15,
13,
15,
11,
760,
87,
91,
856,
520,
2940,
7,
15,
13,
15,
1106,
286,
1273,
19096,
7,
16,
13,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bytes_to_f64_invalid_utf8() {
let tests: Vec<(&'static [u8], Option<f64>)> = vec![
// 'a' + invalid_char
(&[0x61, 0xf7], Some(0.0)),
(&[0xf7, 0x61], Some(0.0)),
(&[0x30, 0x31], Some(1.0)),
// '0' '1' 'a'
(&[0x30, 0x31, 0x61], Some(1.0)),
];
let mut ctx = EvalContext::new(Arc::new(EvalConfig::from_flag(Flag::TRUNCATE_AS_WARNING)));
for (i, (v, expect)) in tests.iter().enumerate() {
let ff: Result<f64> = v.convert(&mut ctx);
match expect {
Some(val) => {
assert_eq!(ff.unwrap(), *val);
}
None => {
assert!(
ff.is_err(),
"index: {}, {:?} should not be converted, but got: {:?}",
i,
v,
ff
);
}
}
}
} | rust_cleaned_test_functions.jsonl/48543 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 682
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12524,
2346,
761,
21,
19,
31433,
39453,
23,
368,
341,
286,
1077,
7032,
25,
11312,
27,
2099,
6,
1978,
508,
84,
23,
1125,
6959,
63895,
21,
19,
9231,
29,
284,
7486,
90515,
310,
442,
364,
64,
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... | 3 |
#[test]
fn test_same_char_covers_all_utf8() {
let important_headers = &[
String::from_utf8(TE.to_vec()).expect("ASCII -> UTF8 is infallible"),
String::from_utf8(CL.to_vec()).expect("ASCII -> UTF8 is infallible"),
];
let mut chars_matched = 0;
let mut chars_checked = 0;
// iterate over all UTF8
for d in 0x80..=0xFF {
for c in 0x80..=0xFF {
let (matched, checked) = check_utf8_character(important_headers, &[c, d]);
chars_checked += checked;
chars_matched += matched;
for b in 0x80..=0xFF {
let (matched, checked) = check_utf8_character(important_headers, &[b, c, d]);
chars_checked += checked;
chars_matched += matched;
for a in 0xF0..=0xFF {
let (matched, checked) =
check_utf8_character(important_headers, &[a, b, c, d]);
chars_checked += checked;
chars_matched += matched;
}
}
}
}
assert_eq!(
chars_checked, 3,
"We know there are three such characters, that convert from UTF8 to ASCII"
);
assert_eq!(
chars_matched, 2,
"We know there are two of them that should match TE/CL headers"
);
} | rust_cleaned_test_functions.jsonl/88817 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 812
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33574,
9232,
666,
8969,
5705,
39453,
23,
368,
341,
1789,
286,
1077,
2989,
26719,
284,
609,
9640,
310,
923,
486,
1499,
39453,
23,
7,
2446,
2389,
13251,
6011,
17119,
445,
56450,
1464,
20076,
23,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_append_to_empty() {
let mut a = BinaryHeap::new();
let mut b = BinaryHeap::from(vec![-20, 5, 43]);
a.append(&mut b);
assert_eq!(a.into_sorted_vec(), [-20, 5, 43]);
assert!(b.is_empty());
} | rust_cleaned_test_functions.jsonl/62371 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26041,
2346,
15124,
368,
341,
262,
1077,
5206,
264,
284,
17718,
27909,
486,
931,
543,
262,
1077,
5206,
293,
284,
17718,
27909,
486,
1499,
25592,
0,
7609,
17,
15,
11,
220,
20,
11,
220,
19,
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_plain_notification_with_custom_data() {
#[derive(Serialize, Debug)]
struct SubData {
nothing: &'static str,
}
#[derive(Serialize, Debug)]
struct TestData {
key_str: &'static str,
key_num: u32,
key_bool: bool,
key_struct: SubData,
}
let test_data = TestData {
key_str: "foo",
key_num: 42,
key_bool: false,
key_struct: SubData { nothing: "here" },
};
let mut payload =
LocalizedNotificationBuilder::new("the title", "the body").build("device-token", Default::default());
payload.add_custom_data("custom", &test_data).unwrap();
let expected_payload = json!({
"custom": {
"key_str": "foo",
"key_num": 42,
"key_bool": false,
"key_struct": {
"nothing": "here"
}
},
"aps": {
"alert": {
"title": "the title",
"body": "the body",
},
"mutable-content": 0
},
})
.to_string();
assert_eq!(expected_payload, payload.to_json_string().unwrap());
} | rust_cleaned_test_functions.jsonl/76564 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 760
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41015,
34296,
6615,
15875,
1769,
368,
341,
286,
11506,
27098,
3759,
9050,
11,
11091,
5563,
286,
2036,
3719,
1043,
341,
310,
4302,
25,
30136,
1978,
607,
345,
286,
555,
286,
11506,
27098,
3759,
9050... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_skip_bug() {
let separator = [0x00, 0x00];
let mut data = io::Cursor::new(vec![
0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x00, 0x00, 0x00, 0x04, 0x05, 0x06,
0x00, 0x00, 0x07, 0x08
]);
let mut splitter = ByteStreamSplitter::new(&mut data, &separator);
let prefix = splitter.next().unwrap().unwrap();
println!("p{:?}", prefix);
let match1 = splitter.next().unwrap().unwrap();
println!("1m{:?}", match1);
let match2 = splitter.next().unwrap().unwrap();
println!("1m{:?}", match2);
let suffix = splitter.next().unwrap().unwrap();
println!("s{:?}", suffix);
assert_eq!(prefix, vec![]);
assert_eq!(match1, vec![0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07]);
assert_eq!(match2, vec![0x00, 0x04, 0x05, 0x06]);
assert_eq!(suffix, vec![0x07, 0x08]);
} | rust_cleaned_test_functions.jsonl/28679 | {
"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,
44830,
73232,
368,
341,
262,
1077,
24792,
284,
508,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
935,
262,
1077,
5206,
821,
284,
6399,
486,
14543,
486,
931,
25592,
90515,
286,
220,
15,
87,
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_article_comments() {
let mut things: Vec<Thing> = deser_from_file!("article-comments", Vec<Thing>);
let listing: Listing = Thing::try_into(things.remove(1)).unwrap();
let mut comments: Vec<Comment> = Listing::try_into(listing).unwrap();
let comment: Comment = comments.remove(0);
let replies: Thing = *comment.replies.unwrap();
let replies2: Listing = Thing::try_into(replies).unwrap();
let replies3: Vec<Comment> = Listing::try_into(replies2).unwrap();
assert_eq!(replies3.len(), 1)
} | rust_cleaned_test_functions.jsonl/96468 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 204
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37321,
30359,
368,
341,
262,
1077,
5206,
2513,
25,
11312,
27,
52940,
29,
284,
96955,
5673,
2458,
17223,
7058,
77154,
497,
11312,
27,
52940,
42013,
262,
1077,
14838,
25,
38764,
284,
37200,
486,
153... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_user_playlist_recorder_tracks() {
let mut oauth = SpotifyOAuth::default()
.scope("playlist-modify-private playlist-modify-public")
.build();
match get_token(&mut oauth) {
Some(token_info) => {
let client_credential = SpotifyClientCredentials::default()
.token_info(token_info)
.build();
let spotify = Spotify::default()
.client_credentials_manager(client_credential)
.build();
let user_id = "2257tjys2e2u2ygfke42niy2q";
let playlist_id = "5jAOgWXCBKuinsGiZxjDQ5";
let range_start = 0;
let insert_before = 1;
let range_length = 1;
let result = spotify.user_playlist_recorder_tracks(user_id,
playlist_id,
range_start,
range_length,
insert_before,
None);
assert!(result.is_ok());
}
None => assert!(false),
};
} | rust_cleaned_test_functions.jsonl/79290 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 794
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3317,
69267,
7080,
1358,
66953,
368,
341,
262,
1077,
5206,
46415,
284,
40537,
57850,
486,
2258,
741,
286,
659,
4186,
445,
34233,
17078,
1437,
65277,
26791,
17078,
1437,
56471,
1138,
286,
659,
5834,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_out_of_order() {
let mut s = socket_established();
send!(s, TcpRepr {
seq_number: REMOTE_SEQ + 1 + 3,
ack_number: Some(LOCAL_SEQ + 1),
payload: &b"def"[..],
..SEND_TEMPL
}, Ok(Some(TcpRepr {
seq_number: LOCAL_SEQ + 1,
ack_number: Some(REMOTE_SEQ + 1),
..RECV_TEMPL
})));
s.recv(|buffer| {
assert_eq!(buffer, b"");
(buffer.len(), ())
}).unwrap();
send!(s, TcpRepr {
seq_number: REMOTE_SEQ + 1,
ack_number: Some(LOCAL_SEQ + 1),
payload: &b"abcdef"[..],
..SEND_TEMPL
}, Ok(Some(TcpRepr {
seq_number: LOCAL_SEQ + 1,
ack_number: Some(REMOTE_SEQ + 1 + 6),
window_len: 58,
..RECV_TEMPL
})));
s.recv(|buffer| {
assert_eq!(buffer, b"abcdef");
(buffer.len(), ())
}).unwrap();
} | rust_cleaned_test_functions.jsonl/1788 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 629
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6068,
3575,
7869,
368,
341,
286,
1077,
5206,
274,
284,
7575,
18583,
5102,
291,
543,
286,
3624,
10297,
82,
11,
64876,
693,
649,
341,
310,
12981,
5500,
25,
25587,
19158,
50045,
488,
220,
16,
488,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_info_event_candidate_network_multiple_bss() {
let exec = fuchsia_async::TestExecutor::new().unwrap();
let (mut sme, _mlme_stream, mut info_stream, _time_stream) = create_sme(&exec);
let credential = fidl_sme::Credential::None(fidl_sme::Empty);
let bss_description =
fake_fidl_bss_description!(Open, ssid: Ssid::try_from("bssname").unwrap());
let req = connect_req(Ssid::try_from("bssname").unwrap(), bss_description, credential);
let _connect_fut = sme.on_connect_command(req);
// Stop connecting attempt early since we just want to get ConnectStats
sme.on_mlme_event(create_join_conf(fidl_ieee80211::StatusCode::JoinFailure));
assert_variant!(info_stream.try_next(), Ok(Some(InfoEvent::ConnectStats(stats))) => {
assert_variant!(stats.candidate_network, Some(candidate_network) => {
assert!(candidate_network.multiple_bss_candidates);
});
});
} | rust_cleaned_test_functions.jsonl/101631 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 434
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3109,
6748,
62360,
20966,
45233,
880,
778,
368,
341,
286,
1077,
3883,
284,
282,
73391,
28346,
486,
2271,
25255,
486,
931,
1005,
15454,
543,
286,
1077,
320,
6984,
90467,
11,
716,
1014,
2660,
12673,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_part_two_test_string2() {
let rules: Rules = "shiny gold bags contain 2 dark red bags.
dark red bags contain 2 dark orange bags.
dark orange bags contain 2 dark yellow bags.
dark yellow bags contain 2 dark green bags.
dark green bags contain 2 dark blue bags.
dark blue bags contain 2 dark violet bags.
dark violet bags contain no other bags."
.parse()
.expect("parsing should not fail");
assert_eq!(part2(rules), 126);
} | rust_cleaned_test_functions.jsonl/57739 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 170
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10495,
23241,
4452,
3904,
17,
368,
341,
286,
1077,
5601,
25,
22847,
284,
330,
927,
6441,
6623,
17899,
6644,
220,
17,
6319,
2518,
17899,
624,
22624,
2518,
17899,
6644,
220,
17,
6319,
18575,
17899,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pow_overflow() {
let tests = vec![(Datum::F64(2.0), Datum::F64(300000000.0))];
for (arg0, arg1) in tests {
let got = eval_func(ScalarFuncSig::Pow, &[arg0, arg1]).unwrap_err();
assert!(check_overflow(got).is_ok());
}
} | rust_cleaned_test_functions.jsonl/13182 | {
"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,
56183,
79073,
368,
341,
286,
1077,
7032,
284,
7486,
0,
9697,
68036,
486,
37,
21,
19,
7,
17,
13,
15,
701,
68459,
486,
37,
21,
19,
7,
18,
15,
15,
15,
15,
15,
15,
15,
15,
13,
15,
81956,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_skip_bytes_error() {
let input = "12345";
new_ucmd!()
.arg("--skip-bytes=10")
.run_piped_stdin(input.as_bytes())
.failure();
} | rust_cleaned_test_functions.jsonl/48822 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 97
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44830,
12524,
4096,
368,
341,
262,
1077,
1946,
284,
330,
16,
17,
18,
19,
20,
876,
262,
501,
68887,
2277,
0,
741,
286,
659,
858,
21549,
20599,
14319,
2338,
28,
16,
15,
1138,
286,
659,
6108,
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 |
#[test]
fn test_output_io_error() {
// and thus this test to fail
let cmd = process::Command::new("abazazzle");
match output(cmd) {
Err(OutputError::Io(_)) => {}
result => panic!("expected io output error but got: {:?}", result),
}
} | rust_cleaned_test_functions.jsonl/74398 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7645,
16939,
4096,
368,
341,
30779,
220,
442,
323,
8450,
419,
1273,
311,
3690,
198,
220,
1077,
5439,
284,
1882,
486,
4062,
486,
931,
445,
370,
1370,
9802,
273,
797,
220,
2432,
2550,
14160,
8,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_parsing_solvable_orders() {
let exemplary_api_body = serde_json::to_string(&json!([{"creationDate":"2021-10-18T07:35:06.355093Z","owner":"0x95f14b1cbdf15dd537c866c14c0cceeeff7ba29a","uid":"0x9afed8c5f3e8a83404bf8e389734ca6273d51c366d43fe80ff327ae836531cae95f14b1cbdf15dd537c866c14c0cceeeff7ba29a616d2aad","availableBalance":"1159894420","executedBuyAmount":"0","executedSellAmount":"0","executedSellAmountBeforeFees":"0","executedFeeAmount":"0","invalidated":false,"status":"open","settlementContract":"0x9008d19f58aabd9ed0d60971565aa8510560ab41","fullFeeAmount":"28902602","sellToken":"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48","buyToken":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","receiver":"0x95f14b1cbdf15dd537c866c14c0cceeeff7ba29a","sellAmount":"1136771901","buyAmount":"291855261988800830","validTo":1634544301,"appData":"0x487b02c558d729abaf3ecf17881a4181e5bc2446429a0995142297e897b6eb37","feeAmount":"23122519","kind":"sell","partiallyFillable":false,"signingScheme":"eip712","signature":"0x45c19d4a37df315d8fe9f7deeb72a7b490cc273ae0117f55d82af6ce38bbd0796d073569cdbf847a4e17cfcbbe4eec6cd54e2f2018c3b4d86253bd981da902ec1b","sellTokenBalance":"erc20","buyTokenBalance":"erc20"},{"creationDate":"2021-10-18T07:35:38.201070Z","owner":"0xe63a13eedd01b624958acfe32145298788a7a7ba","uid":"0x7e8da7757ab696f5389f92ef20500064825edb649ace597501a4748b79a9d09de63a13eedd01b624958acfe32145298788a7a7ba616d2442","availableBalance":"100825350880578944614107","executedBuyAmount":"0","executedSellAmount":"0","executedSellAmountBeforeFees":"0","executedFeeAmount":"0","invalidated":false,"status":"open","settlementContract":"0x9008d19f58aabd9ed0d60971565aa8510560ab41","fullFeeAmount":"28923369173382934528","sellToken":"0x6b175474e89094c44da98b954eedeac495271d0f","buyToken":"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48","receiver":"0xe63a13eedd01b624958acfe32145298788a7a7ba","sellAmount":"24953271843779723527073","buyAmount":"24966098317","validTo":1634542658,"appData":"0x00000000000000000000000055662e225a3376759c24331a9aed764f8f0c9fbb","feeAmount":"7834252255287246848","kind":"buy","partiallyFillable":false,"signingScheme":"ethsign","signature":"0xa887ae70e8754d44cdccdac3b4246d0e620f42e372b15bf5ded889f973451f484f61742c5ead9c1318c1593ca75a51526a1a8c253b3ceb9340b645eb7fde78f01c","sellTokenBalance":"erc20","buyTokenBalance":"erc20"}])).unwrap();
let expected_app_data = vec![
"0x487b02c558d729abaf3ecf17881a4181e5bc2446429a0995142297e897b6eb37"
.parse()
.unwrap(),
"0x00000000000000000000000055662e225a3376759c24331a9aed764f8f0c9fbb"
.parse()
.unwrap(),
];
assert_eq!(
parse_app_data_from_api_body(&exemplary_api_body).unwrap(),
expected_app_data
);
} | rust_cleaned_test_functions.jsonl/110887 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1337
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
28598,
53668,
23760,
37129,
368,
341,
286,
1077,
76281,
11697,
14114,
284,
61570,
9455,
486,
983,
3904,
2099,
2236,
0,
2561,
4913,
37375,
1916,
3252,
17,
15,
17,
16,
12,
16,
15,
12,
16,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serde() {
use serde_json;
let old_witness_format = vec![vec![0u8], vec![2]];
let new_witness_format = Witness::from_vec(old_witness_format.clone());
let old = serde_json::to_string(&old_witness_format).unwrap();
let new = serde_json::to_string(&new_witness_format).unwrap();
assert_eq!(old, new);
let back = serde_json::from_str(&new).unwrap();
assert_eq!(new_witness_format, back);
} | rust_cleaned_test_functions.jsonl/100566 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75861,
450,
368,
341,
286,
990,
61570,
9455,
401,
286,
1077,
2310,
1670,
8091,
8955,
284,
7486,
20703,
4083,
20703,
15,
84,
23,
1125,
7486,
20703,
17,
13204,
286,
1077,
501,
1670,
8091,
8955,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_args_cutoff() {
let mut args = Args::new();
assert_eq!(0, args.cutoff());
args.set_cutoff(5);
assert_eq!(5, args.cutoff());
} | rust_cleaned_test_functions.jsonl/118631 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8384,
74382,
368,
341,
286,
1077,
5206,
2827,
284,
17693,
486,
931,
543,
286,
2060,
10714,
10297,
15,
11,
2827,
520,
27440,
5231,
286,
2827,
980,
74382,
7,
20,
317,
286,
2060,
10714,
10297,
20,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_query_matches_with_indefinite_step_containing_no_captures() {
allocations::record(|| {
// This pattern depends on the field declarations within the
// prematurely failing if the first field does not match.
// https://github.com/tree-sitter/tree-sitter/issues/937
let language = get_language("c");
let query = Query::new(
language,
"(struct_specifier
name: (type_identifier) @name
body: (field_declaration_list
(field_declaration
type: (union_specifier))))",
)
.unwrap();
assert_query_matches(
language,
&query,
"
struct LacksUnionField {
int a;
struct {
B c;
} d;
G *h;
};
struct HasUnionField {
int a;
struct {
B c;
} d;
union {
bool e;
float f;
} g;
G *h;
};
",
&[(0, vec![("name", "HasUnionField")])],
);
});
} | rust_cleaned_test_functions.jsonl/77458 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 798
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5738,
38344,
6615,
1243,
750,
15856,
11946,
10260,
2056,
6536,
666,
2689,
1413,
368,
341,
262,
69642,
486,
8548,
79453,
341,
286,
442,
1096,
5383,
13798,
389,
279,
2070,
15693,
2878,
279,
8945,
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... | 2 |
#[test]
fn test_decode() {
let mut output = [0; 16];
let constant = Subframe {
data: subframe::Data::Constant(4),
wasted_bits: 0,
};
let verbatim = Subframe {
data: subframe::Data::Verbatim(vec![16, -3, 55, 49, -32, 6, 40, -90, 1
,0, 77, -12, 84, 10, -112, 136]),
wasted_bits: 0,
};
let fixed = Subframe {
data: subframe::Data::Fixed(Fixed {
entropy_coding_method: EntropyCodingMethod {
method_type: CodingMethod::PartitionedRice,
data: PartitionedRice {
order: 0,
contents: PartitionedRiceContents {
capacity: 0,
data: Vec::new(),
},
},
},
order: 3,
warmup: [-729, -722, -667, 0],
residual: vec![-19, -16, 17, -23, -7, 16, -16, -5, 3 , -8, -13, -15
,-1],
}),
wasted_bits: 0,
};
let lpc = Subframe {
data: subframe::Data::LPC(LPC {
entropy_coding_method: EntropyCodingMethod {
method_type: CodingMethod::PartitionedRice,
data: PartitionedRice {
order: 0,
contents: PartitionedRiceContents {
capacity: 0,
data: Vec::new(),
},
},
},
order: 7,
qlp_coeff_precision: 0,
quantization_level: 9,
qlp_coefficients: [1042, -399, -75, -269, 121, 166, -75, 0, 0, 0, 0
,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
,0, 0, 0, 0],
warmup: [-796, -547, -285, -32, 199, 443, 670, 0, 0, 0, 0, 0, 0, 0, 0
,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
residual: vec![-2, -23, 14, 6, 3, -4, 12, -2, 10],
}),
wasted_bits: 0,
};
decode(&constant, 16, &mut output);
assert_eq!(&output, &[4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]);
decode(&verbatim, 16, &mut output);
assert_eq!(&output, &[16, -3, 55, 49, -32, 6, 40 , -90, 1, 0, 77, -12, 84
,10 , -112, 136]);
{
let residual = [-19, -16, 17, -23, -7, 16, -16, -5, 3 , -8, -13, -15
,-1];
for i in 0..residual.len() {
output[i + 3] = residual[i];
}
decode(&fixed, 16, &mut output);
assert_eq!(&output, &[-729, -722, -667, -583, -486, -359, -225, -91, 59
,209, 354, 497, 630, 740, 812, 845]);
}
{
let residual = [-2, -23, 14, 6, 3, -4, 12, -2, 10];
for i in 0..residual.len() {
output[i + 7] = residual[i];
}
decode(&lpc, 16, &mut output);
assert_eq!(&output, &[-796, -547, -285, -32, 199, 443, 670, 875, 1046
,1208, 1343, 1454, 1541, 1616, 1663, 1701]);
}
} | rust_cleaned_test_functions.jsonl/61778 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1638
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
368,
341,
262,
1077,
5206,
2550,
284,
508,
15,
26,
220,
16,
21,
4821,
262,
1077,
6783,
284,
3719,
6763,
341,
414,
821,
25,
1186,
6763,
486,
1043,
486,
15472,
7,
19,
1326,
414,
38828,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_new_with_flags() -> Result<(), Box<dyn Error>> {
let _context = quick_init()?;
let _event = Event::new(EventFlags::BLOCKING_SYNC | EventFlags::DISABLE_TIMING)?;
Ok(())
} | rust_cleaned_test_functions.jsonl/56676 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
6615,
14130,
368,
1464,
5714,
68843,
8261,
92846,
4600,
2452,
341,
286,
1077,
716,
2147,
284,
3974,
6137,
94136,
286,
1077,
716,
3087,
284,
3665,
486,
931,
30469,
9195,
486,
39964,
1718,
391... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_scc_check_empty_graph() {
let graph = petgraph_impl::new::<i32, i32>();
debug_assert!(is_strongly_connected(&graph));
} | rust_cleaned_test_functions.jsonl/115475 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 77
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
638,
7200,
15124,
14738,
368,
341,
286,
1077,
4771,
284,
6753,
4439,
21007,
486,
931,
27638,
72,
18,
17,
11,
600,
18,
17,
3913,
286,
7390,
16553,
10297,
285,
2895,
644,
398,
43276,
2099,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_derive_cbw_ht() {
{
let want = fidl_common::Cbw::Cbw20;
let got = derive_cbw_ht(
&fake_ht_cap_chanwidth(ChanWidthSet::TWENTY_FORTY),
&fake_ht_op_sec_offset(SecChanOffset::SECONDARY_NONE),
);
assert_eq!(want, got);
}
{
let want = fidl_common::Cbw::Cbw20;
let got = derive_cbw_ht(
&fake_ht_cap_chanwidth(ChanWidthSet::TWENTY_ONLY),
&fake_ht_op_sec_offset(SecChanOffset::SECONDARY_ABOVE),
);
assert_eq!(want, got);
}
{
let want = fidl_common::Cbw::Cbw40;
let got = derive_cbw_ht(
&fake_ht_cap_chanwidth(ChanWidthSet::TWENTY_FORTY),
&fake_ht_op_sec_offset(SecChanOffset::SECONDARY_ABOVE),
);
assert_eq!(want, got);
}
{
let want = fidl_common::Cbw::Cbw40Below;
let got = derive_cbw_ht(
&fake_ht_cap_chanwidth(ChanWidthSet::TWENTY_FORTY),
&fake_ht_op_sec_offset(SecChanOffset::SECONDARY_BELOW),
);
assert_eq!(want, got);
}
} | rust_cleaned_test_functions.jsonl/12086 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 747
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35345,
533,
16450,
86,
49086,
368,
341,
286,
341,
310,
1077,
1366,
284,
32104,
75,
21107,
486,
34,
39824,
486,
34,
39824,
17,
15,
280,
310,
1077,
2684,
284,
42430,
16450,
86,
49086,
1006,
394,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extend() {
let mut v = Vec::new();
let mut w = Vec::new();
v.extend(w.clone());
assert_eq!(v, &[]);
v.extend(0..3);
for i in 0..3 {
w.push(i)
}
assert_eq!(v, w);
v.extend(3..10);
for i in 3..10 {
w.push(i)
}
assert_eq!(v, w);
v.extend(w.clone()); // specializes to `append`
assert!(v.iter().eq(w.iter().chain(w.iter())));
// Zero sized types
#[derive(PartialEq, Debug)]
struct Foo;
let mut a = Vec::new();
let b = vec![Foo, Foo];
a.extend(b);
assert_eq!(a, &[Foo, Foo]);
// Double drop
let mut count_x = 0;
{
let mut x = Vec::new();
let y = vec![DropCounter { count: &mut count_x }];
x.extend(y);
}
assert_eq!(count_x, 1);
} | rust_cleaned_test_functions.jsonl/24392 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 415
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70265,
368,
341,
262,
1077,
5206,
348,
284,
11312,
486,
931,
543,
262,
1077,
5206,
289,
284,
11312,
486,
931,
1428,
262,
348,
15831,
3622,
15997,
1423,
262,
2060,
10714,
10297,
85,
11,
609,
1294... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bitv_masking() {
let b = Bitv::from_elem(140, true);
let mut bs = BitvSet::from_bitv(b);
assert!(bs.contains(&139));
assert!(!bs.contains(&140));
assert!(bs.insert(150));
assert!(!bs.contains(&140));
assert!(!bs.contains(&149));
assert!(bs.contains(&150));
assert!(!bs.contains(&151));
} | rust_cleaned_test_functions.jsonl/119305 | {
"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,
13996,
85,
9999,
287,
368,
341,
286,
1077,
293,
284,
6495,
85,
486,
1499,
28179,
7,
16,
19,
15,
11,
830,
317,
286,
1077,
5206,
17065,
284,
6495,
85,
1649,
486,
1499,
13996,
85,
1883,
317,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_atan2_valid() {
with_avm(19, |activation, _root| -> Result<(), Error> {
let math = create(
activation.context.gc_context,
Some(activation.context.avm1.prototypes().object),
activation.context.avm1.prototypes().function,
);
assert_eq!(
atan2(activation, math, &[10.0.into()]).unwrap(),
std::f64::consts::FRAC_PI_2.into()
);
assert_eq!(
atan2(activation, math, &[1.0.into(), 2.0.into()]).unwrap(),
f64::atan2(1.0, 2.0).into()
);
Ok(())
});
} | rust_cleaned_test_functions.jsonl/81043 | {
"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,
3752,
276,
17,
8337,
368,
341,
286,
448,
26173,
76,
7,
16,
24,
11,
760,
23002,
11,
716,
2888,
91,
1464,
5714,
68843,
4600,
29,
341,
310,
1077,
6888,
284,
1855,
1006,
394,
15099,
8681,
65554,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_str_components() {
macro_rules! t(
(v: [$($arg:expr),+], $exp:expr) => (
{
let path = Path::new(b!($($arg),+));
let comps = path.str_components().to_owned_vec();
let exp: &[Option<&str>] = $exp;
assert!(comps.as_slice() == exp,
"str_components: Expected {:?}, found {:?}",
comps.as_slice(), exp);
let comps = path.rev_str_components().to_owned_vec();
let exp = exp.rev_iter().map(|&x|x).to_owned_vec();
assert!(comps.as_slice() == exp,
"rev_str_components: Expected {:?}, found {:?}",
comps.as_slice(), exp);
}
)
)
t!(v: ["a/b/c"], [Some("a"), Some("b"), Some("c")]);
t!(v: ["/", 0xff, "/a/", 0x80], [None, Some("a"), None]);
t!(v: ["../../foo", 0xcd, "bar"], [Some(".."), Some(".."), None]);
// the full set of tests
} | rust_cleaned_test_functions.jsonl/120982 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 673
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2895,
23258,
368,
341,
286,
18072,
21407,
0,
259,
1006,
310,
320,
85,
25,
24264,
699,
858,
96011,
701,
10,
1125,
400,
4580,
96011,
8,
589,
2399,
394,
341,
503,
1077,
1815,
284,
7933,
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_parse_function_call_2() {
let input = vec![Token::Ident("f".to_string()), Token::LParen, Token::Integer(1), Token::RParen];
let stmt = parse(&input).unwrap();
assert_eq!(stmt,
Stmt::Eval(Expr::FunCall("f".to_string(), Box::new(vec![integer_expr(1)]))));
} | rust_cleaned_test_functions.jsonl/55682 | {
"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,
21039,
9174,
13429,
62,
17,
368,
341,
1789,
286,
1077,
1946,
284,
7486,
20703,
3323,
486,
28301,
445,
69,
3263,
983,
3904,
11858,
9660,
486,
12567,
9151,
11,
9660,
486,
3486,
7,
16,
701,
9660,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_uri_parse() {
assert!(TrackId::from_uri(URI).is_ok());
assert!(TrackId::from_uri(URI_SLASHES).is_ok());
assert_eq!(TrackId::from_uri(ID), Err(IdError::InvalidPrefix));
assert_eq!(TrackId::from_uri(URI_SHORT), Err(IdError::InvalidPrefix));
assert_eq!(TrackId::from_uri(URI_EMPTY), Err(IdError::InvalidType));
assert_eq!(TrackId::from_uri(URI_WRONGTYPE1), Err(IdError::InvalidType));
assert_eq!(TrackId::from_uri(URI_MIXED1), Err(IdError::InvalidFormat));
assert_eq!(TrackId::from_uri(URI_MIXED2), Err(IdError::InvalidFormat));
} | rust_cleaned_test_functions.jsonl/69260 | {
"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,
15572,
21039,
368,
341,
286,
2060,
10297,
15667,
764,
486,
1499,
15572,
7,
10301,
568,
285,
19817,
1423,
286,
2060,
10297,
15667,
764,
486,
1499,
15572,
7,
10301,
25622,
9537,
1570,
568,
285,
1981... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_diverged() {
let base = StrVectorClock::new();
let c1 = base.incr_clone("A");
let c2 = base.incr_clone("B");
assert!(!(c1 == c2));
assert_eq!(
c1.temporal_relation(&c2),
TemporalRelation::ConcurrentSmaller
);
assert_eq!(
c2.temporal_relation(&c1),
TemporalRelation::ConcurrentGreater
);
} | rust_cleaned_test_functions.jsonl/60186 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 234
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16237,
51525,
368,
341,
286,
1077,
2331,
284,
4509,
3781,
26104,
486,
931,
543,
286,
1077,
272,
16,
284,
2331,
1858,
5082,
54742,
445,
32,
797,
286,
1077,
272,
17,
284,
2331,
1858,
5082,
54742,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.