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_encode_empty_contents() {
let pem = Pem {
tag: String::from("FOO"),
contents: vec![],
};
let encoded = encode(&pem);
assert!(encoded != "");
let pem_out = parse(&encoded).unwrap();
assert_eq!(&pem, &pem_out);
} | rust_cleaned_test_functions.jsonl/56534 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
15124,
16682,
368,
341,
286,
1077,
54184,
284,
393,
336,
341,
310,
4772,
25,
923,
486,
1499,
445,
3788,
46,
4461,
310,
8794,
25,
7486,
20703,
1259,
286,
2605,
286,
1077,
20498,
284,
16164... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stat_hierarchy_enabled() {
let tmp = create_temp_dir("test_stat_hierarchy_enabled").expect("create test directory");
set_fixture(&tmp, MEMORY_USE_HIERARCHY, "1").unwrap();
let enabled = Memory::hierarchy_enabled(&tmp).expect("get cgroup stats");
assert!(enabled)
} | rust_cleaned_test_functions.jsonl/51332 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 135
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16271,
95043,
18220,
368,
341,
286,
1077,
4174,
284,
1855,
11771,
4334,
445,
1944,
16271,
95043,
18220,
1827,
17119,
445,
3182,
1273,
6220,
797,
286,
738,
74409,
2099,
5173,
11,
80962,
22295,
2039,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_interpret_simple() {
let stmt = Stmt::Eval(integer_expr(1));
let mut ctx = ctx();
let res = interpret(&stmt, &mut *ctx).unwrap();
assert_eq!(res, RuntimeItem::Value(Value::Integer(1)));
} | rust_cleaned_test_functions.jsonl/108372 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 129
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15318,
8043,
30015,
368,
972,
1789,
286,
1077,
20020,
284,
97023,
486,
54469,
87414,
21915,
7,
16,
4860,
286,
1077,
5206,
5635,
284,
5635,
1647,
286,
1077,
592,
284,
14198,
2099,
9215,
11,
609,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_send_message_response() {
init!("true");
let result = SendMessageBuilder::create().parse_response(SEND_MESSAGE_RESPONSE.to_vec()).unwrap();
let expected = SendResponse {
uid: None,
uids: vec!["ntc2ytb".to_string()],
};
assert_eq!(expected, result);
} | rust_cleaned_test_functions.jsonl/75276 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 169
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
13565,
6462,
9655,
368,
341,
286,
2930,
17223,
1866,
797,
286,
1077,
1102,
284,
62292,
3297,
486,
3182,
1005,
6400,
9655,
51048,
8065,
14641,
35901,
2389,
13251,
6011,
15454,
543,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_raw_text() {
let (sql, params) = Sqlite::build(Select::default().value("foo".raw())).unwrap();
assert_eq!("SELECT 'foo'", sql);
assert!(params.is_empty());
} | rust_cleaned_test_functions.jsonl/52925 | {
"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,
16067,
4326,
368,
341,
286,
1077,
320,
3544,
11,
3628,
8,
284,
7224,
632,
486,
5834,
7,
3379,
486,
2258,
1005,
957,
445,
7975,
3263,
1041,
34670,
15454,
543,
286,
2060,
10714,
17223,
4858,
364,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_hexdigit_to_keycode() {
for c in "ABCDEFHIJKLMOJPQRSTUVWYXYZabcdefghijklmnopqrstuvwxyz".chars() {
let escaped = c.escape_unicode();
for out_c in escaped.skip(3).take_while(|x| *x != '}') {
println!("{}", out_c);
}
}
} | rust_cleaned_test_functions.jsonl/60195 | {
"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,
32655,
34934,
2346,
3097,
1851,
368,
341,
286,
369,
272,
304,
330,
25411,
13649,
23913,
34070,
43,
10531,
27188,
71860,
54,
56,
32196,
67512,
3263,
19255,
368,
341,
310,
1077,
27783,
284,
272,
570... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_to_bits() {
let result = to_bits("1F3\n").unwrap();
assert_eq!(result, [L, L, L, H, H, H, H, H, L, L, H, H]);
} | rust_cleaned_test_functions.jsonl/129856 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 88
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
20034,
368,
341,
286,
1077,
1102,
284,
311,
20034,
445,
16,
37,
18,
1699,
1827,
15454,
543,
286,
2060,
10714,
10297,
1382,
11,
508,
43,
11,
444,
11,
444,
11,
472,
11,
472,
11,
472,
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 |
#[test]
fn test_yields_the_value_of_the_flag() {
let mut tested = NodeFlags::new_exact();
assert_eq!(true, tested.test(NodeFlags::F_EXACT));
assert_eq!(false, tested.test(NodeFlags::F_RELAXED));
assert_eq!(false, tested.test(NodeFlags::F_FEASIBLE));
tested.set_relaxed(true);
assert_eq!(true, tested.test(NodeFlags::F_EXACT));
assert_eq!(true, tested.test(NodeFlags::F_RELAXED));
assert_eq!(false, tested.test(NodeFlags::F_FEASIBLE));
tested.set_feasible(true);
assert_eq!(true, tested.test(NodeFlags::F_EXACT));
assert_eq!(true, tested.test(NodeFlags::F_RELAXED));
assert_eq!(true, tested.test(NodeFlags::F_FEASIBLE));
tested.set_exact(false);
assert_eq!(false, tested.test(NodeFlags::F_EXACT));
assert_eq!(true, tested.test(NodeFlags::F_RELAXED));
assert_eq!(true, tested.test(NodeFlags::F_FEASIBLE));
tested.set_relaxed(false);
assert_eq!(false, tested.test(NodeFlags::F_EXACT));
assert_eq!(false, tested.test(NodeFlags::F_RELAXED));
assert_eq!(true, tested.test(NodeFlags::F_FEASIBLE));
tested.set_feasible(false);
assert_eq!(false, tested.test(NodeFlags::F_EXACT));
assert_eq!(false, tested.test(NodeFlags::F_RELAXED));
assert_eq!(false, tested.test(NodeFlags::F_FEASIBLE));
} | rust_cleaned_test_functions.jsonl/58511 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 656
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4178,
6907,
16068,
3142,
3575,
16068,
10933,
368,
341,
286,
1077,
5206,
12510,
284,
6018,
9195,
486,
931,
71084,
543,
286,
2060,
10714,
10297,
1866,
11,
220,
12510,
5958,
22078,
9195,
486,
37,
496... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_doc_lex() {
let j_inter = "/**
* The sample description
*
* @param args Arguments
* @param str A string
* @return The value
*
*/";
let tokens = lex_contents(&j_inter.to_string());
assert_eq!(Token::LineNumber(String::from("1")), tokens[0]);
assert_eq!(Token::Symbol(String::from("/**")), tokens[1]);
assert_eq!(Token::LineNumber(String::from("2")), tokens[2]);
assert_eq!(Token::Symbol(String::from("*")), tokens[3]);
assert_eq!(Token::Symbol(String::from("The")), tokens[4]);
assert_eq!(Token::Symbol(String::from("sample")), tokens[5]);
assert_eq!(Token::Symbol(String::from("description")), tokens[6]);
assert_eq!(Token::LineNumber(String::from("3")), tokens[7]);
assert_eq!(Token::Symbol(String::from("*")), tokens[8]);
assert_eq!(Token::LineNumber(String::from("4")), tokens[9]);
assert_eq!(Token::Symbol(String::from("*")), tokens[10]);
assert_eq!(Token::Keyword(String::from("@param")), tokens[11]);
assert_eq!(Token::Symbol(String::from("args")), tokens[12]);
assert_eq!(Token::Symbol(String::from("Arguments")), tokens[13]);
assert_eq!(Token::LineNumber(String::from("5")), tokens[14]);
assert_eq!(Token::Symbol(String::from("*")), tokens[15]);
assert_eq!(Token::Keyword(String::from("@param")), tokens[16]);
assert_eq!(Token::Symbol(String::from("str")), tokens[17]);
assert_eq!(Token::Symbol(String::from("A")), tokens[18]);
assert_eq!(Token::Symbol(String::from("string")), tokens[19]);
assert_eq!(Token::LineNumber(String::from("6")), tokens[20]);
assert_eq!(Token::Symbol(String::from("*")), tokens[21]);
assert_eq!(Token::Keyword(String::from("@return")), tokens[22]);
assert_eq!(Token::Symbol(String::from("The")), tokens[23]);
assert_eq!(Token::Symbol(String::from("value")), tokens[24]);
} | rust_cleaned_test_functions.jsonl/62783 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 846
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18869,
74547,
368,
341,
262,
1077,
502,
15318,
284,
330,
1747,
503,
353,
576,
6077,
4008,
198,
503,
1213,
503,
353,
569,
903,
2827,
27702,
198,
503,
353,
569,
903,
607,
362,
914,
198,
503,
353... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_0057_example_1() {
let intervals = vec![vec![1, 3], vec![6, 9]];
let new_interval = vec![2, 5];
let result = vec![vec![1, 5], vec![6, 9]];
assert_eq!(Solution::insert(intervals, new_interval), result);
} | rust_cleaned_test_functions.jsonl/57631 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 133
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
15,
15,
20,
22,
39304,
62,
16,
368,
341,
286,
1077,
26992,
284,
7486,
20703,
4083,
20703,
16,
11,
220,
18,
1125,
7486,
20703,
21,
11,
220,
24,
13204,
286,
1077,
501,
20541,
284,
7486,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_aggregate_type() {
let mut c = Context::new();
let voidt = c.type_void();
{
let t = c.get_type(voidt);
assert!(!t.is_aggregate_type());
}
let i32t = c.type_int(32, 1);
{
let t = c.get_type(i32t);
assert!(!t.is_aggregate_type());
}
let f64t = c.type_float(64);
{
let t = c.get_type(f64t);
assert!(!t.is_aggregate_type());
}
let boolt = c.type_bool();
{
let t = c.get_type(boolt);
assert!(!t.is_aggregate_type());
}
let structt = c.type_struct(&vec![i32t, i32t, i32t]);
{
let t = c.get_type(structt);
assert!(t.is_aggregate_type());
}
let arrt = c.type_array(i32t, ConstantToken::new(16));
{
let t = c.get_type(arrt);
assert!(t.is_aggregate_type());
}
let rtarrt = c.type_runtime_array(i32t);
{
let t = c.get_type(rtarrt);
assert!(t.is_aggregate_type());
}
let v4i32t = c.type_vector(i32t, 4);
{
let t = c.get_type(v4i32t);
assert!(!t.is_aggregate_type());
}
let matt = c.type_matrix(v4i32t, 4);
{
let t = c.get_type(matt);
assert!(!t.is_aggregate_type());
}
} | rust_cleaned_test_functions.jsonl/125846 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 870
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
20587,
14240,
1819,
368,
341,
286,
1077,
5206,
272,
284,
9608,
486,
931,
543,
286,
1077,
737,
83,
284,
272,
4852,
37775,
543,
286,
341,
310,
1077,
259,
284,
272,
670,
1819,
4333,
83,
317... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_timestamp_with_timezone_serialization() {
let time_stamp_with_timezone = TimestampWithTimeZone::new(
PrimitiveDateTime::new(time::date!(2022 - 2 - 02), time::time!(16:57:11)),
UtcOffset::parse("+0200", "%z").unwrap(),
);
let json = json!({ "time stamp with timezone test": time_stamp_with_timezone });
assert_eq!(14, time_stamp_with_timezone.hour());
// but we serialize timestamps at UTC
assert_eq!(
json!({"time stamp with timezone test":"2022-02-02T14:57:11-00"}),
json
);
} | rust_cleaned_test_functions.jsonl/47265 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 296
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23073,
6615,
53193,
25602,
2022,
368,
341,
286,
1077,
882,
52978,
6615,
53193,
284,
32758,
2354,
77786,
486,
931,
1006,
310,
51460,
7689,
486,
931,
9730,
486,
1028,
10297,
17,
15,
17,
17,
481,
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_eq() {
struct AssertEq<T: Eq>(pub T);
let _: AssertEq<Cursor<Vec<u8>>> = AssertEq(Cursor::new(Vec::new()));
} | rust_cleaned_test_functions.jsonl/78196 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 86
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10714,
368,
341,
286,
2036,
5319,
27312,
3125,
25,
33122,
2235,
9585,
350,
626,
286,
1077,
58536,
5319,
27312,
27,
14543,
50439,
34837,
23,
20154,
284,
5319,
27312,
3025,
3823,
486,
931,
49923,
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 |
#[test]
fn test_first_example() {
let square = Square::from(vec![8, 1, 6, 3, 5, 7, 4, 9, 2]);
assert!(square.is_magic());
} | rust_cleaned_test_functions.jsonl/13901 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 67
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12978,
39304,
368,
341,
262,
1077,
9334,
284,
15619,
486,
1499,
25592,
20703,
23,
11,
220,
16,
11,
220,
21,
11,
220,
18,
11,
220,
20,
11,
220,
22,
11,
220,
19,
11,
220,
24,
11,
220,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_next_random_socket() {
use crate::tests::next_random_socket_test;
let io_loop = Runtime::new().expect("failed to create tokio runtime");
next_random_socket_test::<TokioUdpSocket, Runtime>(io_loop)
} | rust_cleaned_test_functions.jsonl/30361 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11257,
22644,
19555,
368,
341,
286,
990,
17717,
486,
23841,
486,
3600,
22644,
19555,
4452,
280,
286,
1077,
6399,
17198,
284,
10954,
486,
931,
1005,
17119,
445,
16091,
311,
1855,
9628,
815,
15592,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_setup_console_socket_empty() {
let init = setup("test_setup_console_socket_empty");
assert!(init.is_ok());
let (_testdir, rundir_path, socket_path) = init.unwrap();
let fd = setup_console_socket(&rundir_path, &socket_path, CONSOLE_SOCKET);
assert!(fd.is_ok());
assert_eq!(fd.unwrap().as_raw_fd(), -1);
} | rust_cleaned_test_functions.jsonl/69946 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 178
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21363,
51724,
19555,
15124,
368,
341,
286,
1077,
2930,
284,
6505,
445,
1944,
21363,
51724,
19555,
15124,
797,
286,
2060,
10297,
2327,
2079,
19817,
1423,
286,
1077,
5453,
1944,
3741,
11,
40897,
404,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_drop_with_pop() {
static mut DROPS: i32 = 0;
struct Elem;
impl Drop for Elem {
fn drop(&mut self) {
unsafe {
DROPS += 1;
}
}
}
let mut ring = VecDeque::new();
ring.push_back(Elem);
ring.push_front(Elem);
ring.push_back(Elem);
ring.push_front(Elem);
drop(ring.pop_back());
drop(ring.pop_front());
assert_eq!(unsafe { DROPS }, 2);
drop(ring);
assert_eq!(unsafe { DROPS }, 4);
} | rust_cleaned_test_functions.jsonl/73719 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 264
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29584,
6615,
17061,
368,
341,
262,
1099,
5206,
422,
1285,
5012,
25,
600,
18,
17,
284,
220,
15,
280,
262,
2036,
78768,
280,
262,
11605,
15733,
369,
78768,
341,
286,
5168,
5943,
2099,
6984,
656,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_http_request_chunked_payload() {
let mut buf = BytesMut::from(
"GET /test HTTP/1.1\r\n\
transfer-encoding: chunked\r\n\r\n",
);
let settings = WorkerSettings::<HttpApplication>::new(Vec::new(), KeepAlive::Os);
let mut reader = H1Decoder::new();
let msg = reader.decode(&mut buf, &settings).unwrap().unwrap();
assert!(msg.is_payload());
let req = HttpRequest::from_message(msg.message());
assert!(req.chunked().unwrap());
buf.extend(b"4\r\ndata\r\n4\r\nline\r\n0\r\n\r\n");
assert_eq!(
reader
.decode(&mut buf, &settings)
.unwrap()
.unwrap()
.chunk()
.as_ref(),
b"data"
);
assert_eq!(
reader
.decode(&mut buf, &settings)
.unwrap()
.unwrap()
.chunk()
.as_ref(),
b"line"
);
assert!(reader.decode(&mut buf, &settings).unwrap().unwrap().eof());
} | rust_cleaned_test_functions.jsonl/110408 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 645
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25888,
7893,
30539,
291,
32813,
368,
341,
286,
1077,
5206,
6607,
284,
30024,
51440,
486,
1499,
1006,
310,
330,
3806,
608,
1944,
10130,
14,
16,
13,
16,
12016,
1699,
5661,
1797,
8317,
12,
17159,
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_calc_scan_result_size() {
for len in 0..3 {
assert_eq!(
Accounts::calc_scan_result_size(&AccountSharedData::new(
0,
len,
&Pubkey::default()
)),
zero_len_account_size() + len
);
}
} | rust_cleaned_test_functions.jsonl/13233 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 231
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38241,
28857,
5287,
2368,
368,
341,
286,
369,
2422,
304,
220,
15,
496,
18,
341,
310,
2060,
10714,
33673,
394,
40655,
486,
26586,
28857,
5287,
2368,
2099,
7365,
16997,
1043,
486,
931,
1006,
503,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_checks_presence_of_env_vars() {
setup();
env::set_var("DB_HOST", "localhost");
let err = Config::init().err().unwrap();
let expected_err = Error::EnvVarMissing { name: "DB_PORT" };
assert_eq!(err, expected_err);
} | rust_cleaned_test_functions.jsonl/66852 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 108
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75797,
56403,
3575,
15879,
11168,
368,
341,
262,
6505,
1428,
262,
6105,
486,
746,
4612,
445,
3506,
17213,
497,
330,
8301,
3071,
262,
1077,
1848,
284,
5532,
486,
2327,
1005,
615,
1005,
15454,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_coordinator_default_peers() {
let (update_tx, update_rx) = channel();
let (consensus_msg_tx, consensus_msg_rx) = channel();
let manager = MockProposalManager::new(update_tx.clone());
let network = MockConsensusNetworkSender::new();
let startup_state = StartupState {
id: vec![0].into(),
peer_ids: vec![vec![1].into(), vec![2].into()],
last_proposal: None,
};
let mut engine = TwoPhaseEngine::default();
let network_clone = network.clone();
let manager_clone = manager.clone();
let thread = std::thread::spawn(move || {
engine
.run(
consensus_msg_rx,
update_rx,
Box::new(network_clone),
Box::new(manager_clone),
startup_state,
)
.expect("engine failed")
});
// Check that verification request is sent for the first proposal
loop {
if let Some(msg) = network.broadcast_messages().get(0) {
let msg: TwoPhaseMessage =
protobuf::parse_from_bytes(msg).expect("failed to parse message");
assert_eq!(
msg.get_message_type(),
TwoPhaseMessage_Type::PROPOSAL_VERIFICATION_REQUEST
);
assert_eq!(msg.get_proposal_id(), vec![1].as_slice());
break;
}
}
// Receive the verification responses
let mut response = TwoPhaseMessage::new();
response.set_message_type(TwoPhaseMessage_Type::PROPOSAL_VERIFICATION_RESPONSE);
response.set_proposal_id(vec![1]);
response.set_proposal_verification_response(
TwoPhaseMessage_ProposalVerificationResponse::VERIFIED,
);
let message_bytes = response
.write_to_bytes()
.expect("failed to write failed response to bytes");
consensus_msg_tx
.send(ConsensusMessage::new(message_bytes.clone(), vec![1].into()))
.expect("failed to send 1st response");
consensus_msg_tx
.send(ConsensusMessage::new(message_bytes, vec![2].into()))
.expect("failed to send 2nd response");
// Verify the Apply message is sent for the proposal
loop {
if let Some(msg) = network.broadcast_messages().get(1) {
let msg: TwoPhaseMessage =
protobuf::parse_from_bytes(msg).expect("failed to parse message");
assert_eq!(
msg.get_message_type(),
TwoPhaseMessage_Type::PROPOSAL_RESULT
);
assert_eq!(
msg.get_proposal_result(),
TwoPhaseMessage_ProposalResult::APPLY
);
assert_eq!(msg.get_proposal_id(), vec![1].as_slice());
break;
}
}
// Verify the proposal was accepted
loop {
if let Some((id, _)) = manager.accepted_proposals().get(0) {
assert_eq!(id, &vec![1].into());
break;
}
}
// Check that verification request is sent for the second proposal
loop {
if let Some(msg) = network.broadcast_messages().get(2) {
let msg: TwoPhaseMessage =
protobuf::parse_from_bytes(msg).expect("failed to parse message");
assert_eq!(
msg.get_message_type(),
TwoPhaseMessage_Type::PROPOSAL_VERIFICATION_REQUEST
);
assert_eq!(msg.get_proposal_id(), vec![2].as_slice());
break;
}
}
// Receive the verification responses
let mut response = TwoPhaseMessage::new();
response.set_message_type(TwoPhaseMessage_Type::PROPOSAL_VERIFICATION_RESPONSE);
response.set_proposal_id(vec![2]);
response.set_proposal_verification_response(
TwoPhaseMessage_ProposalVerificationResponse::VERIFIED,
);
let message_bytes = response
.write_to_bytes()
.expect("failed to write failed response to bytes");
consensus_msg_tx
.send(ConsensusMessage::new(message_bytes, vec![1].into()))
.expect("failed to send 1st response");
let mut response = TwoPhaseMessage::new();
response.set_message_type(TwoPhaseMessage_Type::PROPOSAL_VERIFICATION_RESPONSE);
response.set_proposal_id(vec![2]);
response.set_proposal_verification_response(
TwoPhaseMessage_ProposalVerificationResponse::FAILED,
);
let message_bytes = response
.write_to_bytes()
.expect("failed to write failed response to bytes");
consensus_msg_tx
.send(ConsensusMessage::new(message_bytes, vec![2].into()))
.expect("failed to send 2nd response");
// Verify the Reject message is sent for the proposal
loop {
if let Some(msg) = network.broadcast_messages().get(3) {
let msg: TwoPhaseMessage =
protobuf::parse_from_bytes(msg).expect("failed to parse message");
assert_eq!(
msg.get_message_type(),
TwoPhaseMessage_Type::PROPOSAL_RESULT
);
assert_eq!(
msg.get_proposal_result(),
TwoPhaseMessage_ProposalResult::REJECT
);
assert_eq!(msg.get_proposal_id(), vec![2].as_slice());
break;
}
}
// Verify the proposal was rejected
loop {
if let Some(id) = manager.rejected_proposals().get(0) {
assert_eq!(id, &vec![2].into());
break;
}
}
update_tx
.send(ProposalUpdate::Shutdown)
.expect("failed to send shutdown");
thread.join().expect("failed to join engine thread");
} | rust_cleaned_test_functions.jsonl/130669 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11393,
17442,
9993,
36367,
388,
368,
341,
286,
1077,
320,
2386,
17805,
11,
2647,
24330,
8,
284,
5496,
543,
286,
1077,
320,
6254,
13626,
6483,
17805,
11,
23869,
6483,
24330,
8,
284,
5496,
1428,
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... | 8 |
#[test]
fn test_text_encoder_histogram() {
let opts = HistogramOpts::new("test_histogram", "test help").const_label("a", "1");
let histogram = Histogram::with_opts(opts).unwrap();
histogram.observe(0.25);
let mf = histogram.collect();
let mut writer = Vec::<u8>::new();
let encoder = TextEncoder::new();
let res = encoder.encode(&mf, &mut writer);
assert!(res.is_ok());
let ans = r##"# HELP test_histogram test help
# TYPE test_histogram histogram
test_histogram_bucket{a="1",le="0.005"} 0
test_histogram_bucket{a="1",le="0.01"} 0
test_histogram_bucket{a="1",le="0.025"} 0
test_histogram_bucket{a="1",le="0.05"} 0
test_histogram_bucket{a="1",le="0.1"} 0
test_histogram_bucket{a="1",le="0.25"} 1
test_histogram_bucket{a="1",le="0.5"} 1
test_histogram_bucket{a="1",le="1"} 1
test_histogram_bucket{a="1",le="2.5"} 1
test_histogram_bucket{a="1",le="5"} 1
test_histogram_bucket{a="1",le="10"} 1
test_histogram_bucket{a="1",le="+Inf"} 1
test_histogram_sum{a="1"} 0.25
test_histogram_count{a="1"} 1
"##;
assert_eq!(ans.as_bytes(), writer.as_slice());
} | rust_cleaned_test_functions.jsonl/52443 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 528
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4326,
39068,
68564,
368,
341,
286,
1077,
12185,
284,
82138,
43451,
486,
931,
445,
1944,
68564,
497,
330,
1944,
1492,
1827,
1024,
6106,
445,
64,
497,
330,
16,
797,
286,
1077,
30281,
284,
82138,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_receive_pty_master() {
let runc_id = format!("{}", Uuid::new_v4());
let runc_path = env::temp_dir().join(&runc_id).join("runc.amd64");
let runc_root =
PathBuf::from(env::var_os("XDG_RUNTIME_DIR").expect("expected temporary path"))
.join("rust-runc")
.join(&runc_id);
fs::create_dir_all(&runc_root).expect("unable to create runc root");
extract_tarball(
&PathBuf::from("test_fixture/runc_v1.0.0-rc10.tar.gz"),
&env::temp_dir().join(&runc_id),
)
.expect("unable to extract runc");
let mut config: RuncConfiguration = Default::default();
config.command = Some(runc_path);
config.root = Some(runc_root);
let runc = Runc::new(config).expect("Unable to create runc instance");
let task = async move {
let id = format!("{}", Uuid::new_v4());
let (fd_sender, fd_receiver) = futures::channel::oneshot::channel::<tokio::fs::File>();
let console_socket = env::temp_dir().join(&id).with_extension("console");
let receive_pty_master = ReceivePtyMaster::new(&console_socket)?;
tokio::spawn(async move {
match receive_pty_master.receive().await {
Ok(pty_master) => {
fd_sender.send(pty_master).unwrap();
}
Err(err) => {
error!("Receive PTY master error: {}", err);
}
}
});
let bundle = env::temp_dir().join(&id);
extract_tarball(&PathBuf::from("test_fixture/busybox.tar.gz"), &bundle)
.context(BundleExtractError {})?;
runc.run(
&id,
&bundle,
Some(&CreateOpts {
pid_file: None,
console_socket: Some(console_socket),
no_pivot: false,
no_new_keyring: false,
detach: true,
}),
)
.await?;
Ok::<_, Error>(fd_receiver.await.unwrap())
};
let mut runtime = Runtime::new().expect("unable to create runtime");
let mut pty_master = runtime.block_on(task).expect("test failed");
let task = async move {
let mut response = [0u8; 160];
pty_master.read(&mut response).await?;
pty_master.write(b"uname -a && exit\n").await?;
delay_for(Duration::from_millis(500)).await;
let len = pty_master.read(&mut response).await?;
Ok::<_, io::Error>(String::from_utf8(Vec::from(&response[..len])).unwrap())
};
let mut runtime = Runtime::new().expect("unable to create runtime");
let response = runtime.block_on(task).expect("test failed");
let response = match response
.split('\n')
.find(|line| line.contains("Linux runc"))
{
Some(response) => response,
None => panic!("did not find response to command"),
};
assert!(response.starts_with("Linux runc"));
} | rust_cleaned_test_functions.jsonl/24479 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1673
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38557,
62,
1595,
24582,
368,
341,
286,
1077,
435,
1347,
842,
284,
3561,
79878,
547,
2423,
486,
931,
2273,
19,
1423,
286,
1077,
435,
1347,
2638,
284,
6105,
486,
3888,
4334,
1005,
5987,
2099,
81,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 9 |
#[test]
fn test_nonce_payer() {
solana_logger::setup();
let nonce_starting_balance = 250_000;
let mut feature_set = FeatureSet::all_enabled();
feature_set.deactivate(&tx_wide_compute_cap::id());
let (mut bank, _mint_keypair, custodian_keypair, nonce_keypair) = setup_nonce_with_bank(
10_000_000,
|_| {},
5_000_000,
nonce_starting_balance,
None,
feature_set,
)
.unwrap();
let alice_keypair = Keypair::new();
let alice_pubkey = alice_keypair.pubkey();
let custodian_pubkey = custodian_keypair.pubkey();
let nonce_pubkey = nonce_keypair.pubkey();
debug!("alice: {}", alice_pubkey);
debug!("custodian: {}", custodian_pubkey);
debug!("nonce: {}", nonce_pubkey);
debug!("nonce account: {:?}", bank.get_account(&nonce_pubkey));
debug!("cust: {:?}", bank.get_account(&custodian_pubkey));
let nonce_hash = get_nonce_blockhash(&bank, &nonce_pubkey).unwrap();
for _ in 0..MAX_RECENT_BLOCKHASHES + 1 {
goto_end_of_slot(Arc::get_mut(&mut bank).unwrap());
bank = Arc::new(new_from_parent(&bank));
}
let nonce_tx = Transaction::new_signed_with_payer(
&[
system_instruction::advance_nonce_account(&nonce_pubkey, &nonce_pubkey),
system_instruction::transfer(&custodian_pubkey, &alice_pubkey, 100_000_000),
],
Some(&nonce_pubkey),
&[&custodian_keypair, &nonce_keypair],
nonce_hash,
);
debug!("{:?}", nonce_tx);
assert_eq!(
bank.process_transaction(&nonce_tx),
Err(TransactionError::InstructionError(
1,
system_instruction::SystemError::ResultWithNegativeLamports.into(),
))
);
/* Check fee charged and nonce has advanced */
let mut recent_message = nonce_tx.message;
recent_message.recent_blockhash = bank.last_blockhash();
assert_eq!(
bank.get_balance(&nonce_pubkey),
nonce_starting_balance
- bank
.get_fee_for_message(&recent_message.try_into().unwrap())
.unwrap()
);
assert_ne!(
nonce_hash,
get_nonce_blockhash(&bank, &nonce_pubkey).unwrap()
);
} | rust_cleaned_test_functions.jsonl/28929 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1268
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48508,
620,
1135,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
39676,
4906,
287,
29396,
284,
220,
17,
20,
15,
62,
15,
15,
15,
280,
286,
1077,
5206,
4565,
2602,
284,
19998,
164... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_link_struct() {
assert_eq!(
GiDocgen::from_str("[struct@Gtk.TextIter]"),
Ok(GiDocgen::Struct {
namespace: Some("Gtk".to_string()),
type_: "TextIter".to_string()
})
);
} | rust_cleaned_test_functions.jsonl/78473 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 164
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7233,
15126,
368,
341,
286,
2060,
10714,
33673,
310,
15392,
9550,
4370,
486,
1499,
2895,
10937,
1235,
31,
45103,
1979,
8537,
60,
4461,
310,
7622,
6699,
72,
9550,
4370,
486,
9422,
341,
394,
4473,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mutation() {
unsafe {
let string = NSString::alloc(nil).init_str("this is a test string");
let separator = NSString::alloc(nil).init_str(" ");
let components: id = msg_send![string, componentsSeparatedByString: separator];
let mut_components: id = msg_send![components, mutableCopy];
let mut iter = mut_components.iter();
iter.next();
msg_send![mut_components, removeObjectAtIndex:1];
iter.next();
}
} | rust_cleaned_test_functions.jsonl/78768 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 297
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
22705,
368,
341,
310,
19860,
341,
394,
1077,
914,
284,
9335,
486,
4742,
27907,
568,
2327,
2895,
445,
574,
374,
264,
1273,
914,
797,
394,
1077,
24792,
284,
9335,
486,
4742,
27907,
568,
2327,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_endo() {
let g = Ec1::one();
let (x, y) = g.get_xy().unwrap();
let x = x * Ec1::BETA_BASE;
assert_eq!(g * Ec1::BETA_SCALAR, Ec1::from_xy_unchecked(x, y));
} | rust_cleaned_test_functions.jsonl/4619 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6213,
78,
368,
341,
262,
1077,
342,
284,
36111,
16,
486,
603,
543,
262,
1077,
320,
87,
11,
379,
8,
284,
342,
670,
40920,
1005,
15454,
543,
262,
1077,
856,
284,
856,
353,
36111,
16,
486,
33,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_input() {
assert_eq!(day20_1(&to_vec(TEST_INPUT)), 35);
assert_eq!(day20_2(&to_vec(TEST_INPUT)), 3351)
} | rust_cleaned_test_functions.jsonl/3903 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 83
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5898,
368,
341,
286,
2060,
10714,
10297,
1292,
17,
15,
62,
16,
2099,
983,
13251,
50320,
21022,
5731,
220,
18,
20,
317,
286,
2060,
10714,
10297,
1292,
17,
15,
62,
17,
2099,
983,
13251,
50320,
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 |
#[test]
fn test_read_doc_spec_block() {
crate::tests::test_read_doc_spec_block(
TEST_BLOCK_I16_BZIP2.as_ref(),
CompressionType::Bzip2(Bzip2Compression::default()));
} | rust_cleaned_test_functions.jsonl/14075 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 108
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
18869,
13594,
7113,
368,
341,
286,
17717,
486,
23841,
486,
1944,
6443,
18869,
13594,
7113,
1006,
310,
13602,
18756,
7959,
16,
21,
1668,
61585,
17,
5357,
7793,
3148,
310,
66161,
929,
486,
33,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_display_sort_order() {
assert_eq!(SortOrder::Signed.to_string(), "SIGNED");
assert_eq!(SortOrder::Unsigned.to_string(), "UNSIGNED");
assert_eq!(SortOrder::Undefined.to_string(), "UNDEFINED");
} | rust_cleaned_test_functions.jsonl/126080 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 93
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14825,
18435,
7869,
368,
341,
197,
6948,
10714,
10297,
10231,
4431,
486,
49312,
2389,
3904,
1507,
330,
50,
25015,
797,
197,
6948,
10714,
10297,
10231,
4431,
486,
56421,
2389,
3904,
1507,
330,
88673,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_flags_from_vec_2() {
let (flags, subcommand, argv) =
flags_from_vec(svec!["deno", "-r", "-D", "run", "script.ts"]);
assert_eq!(
flags,
DenoFlags {
log_debug: true,
reload: true,
..DenoFlags::default()
}
);
assert_eq!(subcommand, DenoSubcommand::Run);
assert_eq!(argv, svec!["deno", "script.ts"]);
} | rust_cleaned_test_functions.jsonl/115778 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 199
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14130,
5673,
13251,
62,
17,
368,
341,
262,
1077,
320,
11161,
11,
1186,
5631,
11,
10213,
8,
4035,
414,
8042,
5673,
13251,
1141,
4083,
0,
1183,
5183,
78,
497,
6523,
81,
497,
6523,
35,
497,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_initial_msg() {
let tbl = vec![
(MessageType::MsgRequestVote, INVALID_INDEX, true),
(MessageType::MsgRequestPreVote, INVALID_INDEX, true),
(MessageType::MsgHeartbeat, INVALID_INDEX, true),
(MessageType::MsgHeartbeat, 100, false),
(MessageType::MsgAppend, 100, false),
];
for (msg_type, commit, can_create) in tbl {
let mut msg = Message::default();
msg.set_msg_type(msg_type);
msg.set_commit(commit);
assert_eq!(is_initial_msg(&msg), can_create);
}
} | rust_cleaned_test_functions.jsonl/6852 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 312
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
15809,
6483,
368,
341,
286,
1077,
21173,
284,
7486,
90515,
310,
320,
82107,
486,
6611,
1900,
41412,
11,
32269,
14515,
11,
830,
1326,
310,
320,
82107,
486,
6611,
1900,
4703,
41412,
11,
32269,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_formatter() {
let template = compile("{ nested.value | my_formatter }");
let context = context();
let template_registry = other_templates();
let formatter_registry = formatters();
let string = template
.render(&context, &template_registry, &formatter_registry)
.unwrap();
assert_eq!("{10}", &string);
} | rust_cleaned_test_functions.jsonl/2389 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 184
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73965,
368,
972,
286,
1077,
3811,
284,
19192,
13976,
24034,
2824,
760,
847,
73965,
335,
2815,
286,
1077,
2266,
284,
2266,
1647,
286,
1077,
3811,
50650,
284,
1008,
49526,
1647,
286,
1077,
24814,
50... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_patch_drive_request() {
assert!(parse_patch_drive(&Body::new("invalid_payload"), None).is_err());
assert!(parse_patch_drive(&Body::new("invalid_payload"), Some(&"id")).is_err());
// PATCH with invalid fields.
let body = r#"{
"drive_id": "bar",
"is_read_only": false
}"#;
assert!(parse_patch_drive(&Body::new(body), Some(&"2")).is_err());
let body = r#"{
"drive_id": 1000,
"path_on_host": "dummy"
}"#;
let res = parse_patch_drive(&Body::new(body), Some(&"1000"));
assert!(res.is_err());
let body = r#"{
"drive_id": 1000,
"path_on_host": true
}"#;
let res = parse_patch_drive(&Body::new(body), Some(&"1000"));
assert!(res.is_err());
// PATCH with missing path_on_host field.
let body = r#"{
"drive_id": "dummy_id"
}"#;
let res = parse_patch_drive(&Body::new(body), Some(&"dummy_id"));
assert!(res.is_err());
// PATCH with missing drive_id field.
let body = r#"{
"path_on_host": true
}"#;
let res = parse_patch_drive(&Body::new(body), Some(&"1000"));
assert!(res.is_err());
// PATCH that tries to update something else other than path_on_host.
let body = r#"{
"drive_id": "dummy_id",
"path_on_host": "dummy_host",
"is_read_only": false
}"#;
let res = parse_patch_drive(&Body::new(body), Some(&"1234"));
assert!(res.is_err());
// PATCH with payload that is not a json.
let body = r#"{
"fields": "dummy_field"
}"#;
assert!(parse_patch_drive(&Body::new(body), Some(&"1234")).is_err());
let body = r#"{
"drive_id": "foo",
"path_on_host": "dummy"
}"#;
#[allow(clippy::match_wild_err_arm)]
match vmm_action_from_request(parse_patch_drive(&Body::new(body), Some(&"foo")).unwrap()) {
VmmAction::UpdateBlockDevice(cfg) => {
assert_eq!(cfg.drive_id, "foo".to_string());
assert_eq!(cfg.path_on_host.unwrap(), "dummy".to_string());
}
_ => panic!("Test failed: Invalid parameters"),
};
let body = r#"{
"drive_id": "foo",
"path_on_host": "dummy"
}"#;
assert!(parse_patch_drive(&Body::new(body), Some(&"bar")).is_err());
let body = r#"{
"drive_id": "foo",
"rate_limiter": {
"bandwidth": {
"size": 5000,
"refill_time": 100
},
"ops": {
"size": 500,
"refill_time": 100
}
}
}"#;
// Validate that updating just the ratelimiter works.
assert!(parse_patch_drive(&Body::new(body), Some(&"foo")).is_ok());
let body = r#"{
"drive_id": "foo",
"path_on_host": "/there",
"rate_limiter": {
"bandwidth": {
"size": 5000,
"refill_time": 100
},
"ops": {
"size": 500,
"refill_time": 100
}
}
}"#;
// Validate that updating both path and rate limiter succeds.
assert!(parse_patch_drive(&Body::new(body), Some(&"foo")).is_ok());
let body = r#"{
"drive_id": "foo",
"path_on_host": "/there",
"rate_limiter": {
"ops": {
"size": 100
}
}
}"#;
// Validate that parse_patch_drive fails for invalid rate limiter cfg.
assert!(parse_patch_drive(&Body::new(body), Some(&"foo")).is_err());
} | rust_cleaned_test_functions.jsonl/71896 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2315
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
39643,
67151,
7893,
368,
341,
286,
2060,
10297,
6400,
39643,
67151,
2099,
5444,
486,
931,
445,
11808,
32813,
3975,
2240,
568,
285,
9266,
1423,
286,
2060,
10297,
6400,
39643,
67151,
2099,
5444... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_classify() {
let nan: f32 = Float::NaN();
let inf: f32 = Float::infinity();
let neg_inf: f32 = Float::neg_infinity();
let zero: f32 = Zero::zero();
let neg_zero: f32 = Float::neg_zero();
assert_eq!(nan.classify(), FPNaN);
assert_eq!(inf.classify(), FPInfinite);
assert_eq!(neg_inf.classify(), FPInfinite);
assert_eq!(zero.classify(), FPZero);
assert_eq!(neg_zero.classify(), FPZero);
assert_eq!(1f32.classify(), FPNormal);
assert_eq!(1e-37f32.classify(), FPNormal);
assert_eq!(1e-38f32.classify(), FPSubnormal);
} | rust_cleaned_test_functions.jsonl/33119 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 315
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4790,
1437,
368,
341,
286,
1077,
20021,
25,
282,
18,
17,
284,
13001,
486,
22831,
543,
286,
1077,
4132,
25,
282,
18,
17,
284,
13001,
486,
80016,
543,
286,
1077,
4184,
26051,
25,
282,
18,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_jeq() {
disasm!(
"entrypoint:
jeq r1, 4, lbb_1
lbb_1:
exit
"
);
disasm!(
"entrypoint:
jeq r1, r3, lbb_1
lbb_1:
exit
"
);
} | rust_cleaned_test_functions.jsonl/68753 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
3756,
80,
368,
341,
262,
827,
10530,
33673,
286,
330,
4085,
2768,
510,
262,
4759,
80,
435,
16,
11,
220,
19,
11,
326,
6066,
62,
16,
198,
75,
6066,
62,
16,
510,
262,
4869,
198,
698,
262,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_array_windows_nth() {
let v: &[i32] = &[0, 1, 2, 3, 4, 5];
let snd = v.array_windows::<4>().nth(1);
assert_eq!(snd, Some(&[1, 2, 3, 4]));
let mut arr_windows = v.array_windows::<2>();
assert_ne!(arr_windows.nth(0), arr_windows.nth(0));
let last = v.array_windows::<3>().last();
assert_eq!(last, Some(&[3, 4, 5]));
} | rust_cleaned_test_functions.jsonl/9658 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
58220,
78342,
368,
341,
262,
1077,
348,
25,
44590,
72,
18,
17,
60,
284,
44590,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
262,
1077,
28612,
284,
348,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_boring_error() {
CStackWrapper::cbs_with_temp_buffer(&[], |cbs| {
should_fail(
CHeapWrapper::evp_parse_public_key(cbs),
"boringssl::EVP_parse_public_key",
"public key routines:OPENSSL_internal:DECODE_ERROR",
);
});
} | rust_cleaned_test_functions.jsonl/26378 | {
"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,
880,
5503,
4096,
368,
341,
286,
356,
4336,
11542,
486,
66,
1279,
6615,
11771,
7776,
2099,
12995,
760,
66,
1279,
91,
341,
310,
1265,
22121,
1006,
394,
356,
27909,
11542,
486,
5120,
79,
21039,
270... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_url_encoding() -> Result<(), Box<dyn std::error::Error>> {
let bucket = crate::read_test_bucket_sync();
let complicated_names = [
"asdf",
"asdf+1",
"asdf&&+1?=3,,-_()*&^%$#@!`~{}[]\\|:;\"'<>,.?/äöüëß",
"https://www.google.com",
"परिक्षण फाईल",
"测试很重要",
];
for name in &complicated_names {
let _obj = Object::create_sync(&bucket.name, vec![0, 1], name, "text/plain")?;
let obj = Object::read_sync(&bucket.name, &name).unwrap();
let url = obj.download_url(100)?;
let client = reqwest::blocking::Client::new();
let download = client.head(&url).send()?;
assert_eq!(download.status().as_u16(), 200);
}
Ok(())
} | rust_cleaned_test_functions.jsonl/63248 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 541
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2903,
37613,
368,
1464,
5714,
68843,
8261,
92846,
1460,
486,
841,
486,
1454,
2452,
341,
310,
1077,
15621,
284,
17717,
486,
878,
4452,
38749,
23008,
543,
310,
1077,
16965,
9187,
284,
2278,
394,
330... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_deserialization2() {
let insert_points = CollectionUpdateOperations::PointOperation(
vec![
PointStruct {
id: 0.into(),
vector: vec![1.0, 0.0, 1.0, 1.0],
payload: None,
},
PointStruct {
id: 1.into(),
vector: vec![1.0, 0.0, 1.0, 0.0],
payload: None,
},
]
.into(),
);
let json_str = serde_json::to_string_pretty(&insert_points).unwrap();
let _read_obj: CollectionUpdateOperations = serde_json::from_str(&json_str).unwrap();
let raw_bytes = rmp_serde::to_vec(&insert_points).unwrap();
let _read_obj2: CollectionUpdateOperations = rmp_serde::from_slice(&raw_bytes).unwrap();
} | rust_cleaned_test_functions.jsonl/124233 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 406
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15768,
50563,
17,
368,
341,
262,
1077,
5656,
12928,
284,
11101,
4289,
35120,
486,
2609,
8432,
1006,
286,
7486,
90515,
310,
5126,
9422,
341,
394,
877,
25,
220,
15,
39860,
3148,
394,
4621,
25,
748... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_of_line_at_position_a() {
let code: Vec<char> = "text\ntext".to_string().chars().collect();
assert_eq!(range_of_line_at_position(&code, 0), 0..5);
let code: Vec<char> = "text\ntext".to_string().chars().collect();
assert_eq!(range_of_line_at_position(&code, 2), 0..5);
let code: Vec<char> = "text\ntext".to_string().chars().collect();
assert_eq!(range_of_line_at_position(&code, 4), 0..5);
} | rust_cleaned_test_functions.jsonl/126883 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 218
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9698,
3575,
6528,
3752,
9661,
4306,
368,
341,
286,
1077,
2038,
25,
11312,
21919,
29,
284,
330,
1318,
59,
406,
427,
3263,
983,
3904,
1005,
19255,
1005,
17384,
543,
286,
2060,
10714,
10297,
9669,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_str_fail() {
fn test(s: &str) {
let complex: Result<Complex64, _> = FromStr::from_str(s);
assert!(
complex.is_err(),
"complex {:?} -> {:?} should be an error",
s,
complex
);
}
test("foo");
test("6E");
test("0 + 2.718");
test("1 - -2i");
test("314e-2ij");
test("4.3j - i");
test("1i - 2i");
test("+ 1 - 3.0i");
} | rust_cleaned_test_functions.jsonl/105671 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 324
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
2895,
22121,
368,
341,
286,
5168,
1273,
1141,
25,
609,
495,
8,
341,
310,
1077,
6351,
25,
5714,
27,
31137,
21,
19,
11,
716,
29,
284,
5542,
2580,
486,
1499,
2895,
1141,
317,
310,
2060,
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_set_rocksdb_options_empty() {
let tmp_dir = tempfile::Builder::new()
.prefix("test_set_rocksdb_options_empty")
.tempdir()
.unwrap();
let config = DBConfig {
path: tmp_dir.as_ref().to_path_buf(),
options: HashMap::new(),
options_file: None,
};
RocksDB::open(&config, 2); // no panic
} | rust_cleaned_test_functions.jsonl/82340 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 219
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
26608,
14553,
1999,
8743,
15124,
368,
341,
286,
1077,
4174,
4334,
284,
54819,
486,
3297,
486,
931,
741,
310,
659,
11849,
445,
1944,
2602,
26608,
14553,
1999,
8743,
15124,
1138,
310,
659,
388... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mismatch() {
let (mut a, my_env) = test_env();
let syntax = new_lambda("x",
new_apply(
new_apply(new_identifier("pair"),
new_apply(new_identifier("x"), new_identifier("3"))),
new_apply(new_identifier("x"), new_identifier("true"))));
let _ = analyse(&mut a, &syntax, &my_env, &hashset![]);
} | rust_cleaned_test_functions.jsonl/127651 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 183
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
24976,
368,
341,
262,
1077,
320,
6984,
264,
11,
847,
15879,
8,
284,
1273,
15879,
1428,
1066,
262,
1077,
19482,
284,
501,
51884,
445,
87,
756,
981,
501,
36551,
1006,
1843,
501,
36551,
1755,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_select_and() {
let expected_sql = "SELECT `naukio`.* FROM `naukio` WHERE (`word` = ? AND `age` < ? AND `paw` = ?)";
let expected_params = vec![Value::text("meow"), Value::integer(10), Value::text("warm")];
let conditions = "word".equals("meow").and("age".less_than(10)).and("paw".equals("warm"));
let query = Select::from_table("naukio").so_that(conditions);
let (sql, params) = Sqlite::build(query).unwrap();
assert_eq!(expected_sql, sql);
assert_eq!(default_params(expected_params), params);
} | rust_cleaned_test_functions.jsonl/52912 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 248
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13051,
8378,
368,
341,
286,
1077,
3601,
18063,
284,
330,
4858,
1565,
77,
2863,
74,
815,
63,
4908,
4295,
1565,
77,
2863,
74,
815,
63,
5288,
28654,
1158,
63,
284,
937,
3567,
1565,
424,
63,
366,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_left_shift() -> Result<(), Box<EvalAltResult>> {
let engine = Engine::new();
assert_eq!(engine.eval::<INT>("4 << 2")?, 16);
Ok(())
} | rust_cleaned_test_functions.jsonl/112270 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 74
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9579,
22230,
368,
1464,
5714,
68843,
8261,
23835,
831,
26017,
2077,
2452,
341,
262,
1077,
4712,
284,
8200,
486,
931,
543,
262,
2060,
10714,
10297,
8512,
31710,
27638,
3221,
13211,
19,
1115,
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
] | 2 |
#[test]
fn test_lui_parse() {
let insts = parse_and_lex_concr::<Rv32>("lui a0, 0xD_EADC");
assert_eq!(insts.len(), 1);
assert_eq!(insts[0], Lui::new(A0, DataLword::from(0xD_EADC)));
} | rust_cleaned_test_functions.jsonl/91963 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
907,
1963,
21039,
368,
341,
286,
1077,
1761,
82,
284,
4715,
8378,
74547,
3382,
5082,
27638,
49,
85,
18,
17,
13211,
75,
1963,
264,
15,
11,
220,
15,
15764,
2089,
31956,
797,
286,
2060,
10714,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_replace_succeeding() {
let mut output = String::new();
let method = StringMethod {
method: "replace",
variable: "$FOO",
pattern: "[\"FOO\" \"BAR\"]",
selection: Select::All,
};
method.handle(&mut output, &VariableExpander);
assert_eq!(output, "BARBAR");
} | rust_cleaned_test_functions.jsonl/85281 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 190
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10633,
643,
29264,
287,
368,
341,
286,
1077,
5206,
2550,
284,
923,
486,
931,
543,
286,
1077,
1714,
284,
923,
3523,
341,
310,
1714,
25,
262,
330,
8156,
756,
310,
3890,
25,
220,
5201,
3788,
46,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sign_request_v2() -> Result<(), Box<dyn Error>> {
let credential = get_credential();
let empty_headers = {
let mut headers = Headers::new();
headers.insert("X-Qbox-Meta".into(), "value".into());
headers
};
let json_headers = {
let mut headers = Headers::new();
headers.insert("Content-Type".into(), mime::JSON_MIME.into());
headers.insert("X-Qbox-Meta".into(), "value".into());
headers.insert("X-Qiniu-Cxxxx".into(), "valuec".into());
headers.insert("X-Qiniu-Bxxxx".into(), "valueb".into());
headers.insert("X-Qiniu-axxxx".into(), "valuea".into());
headers.insert("X-Qiniu-e".into(), "value".into());
headers.insert("X-Qiniu-".into(), "value".into());
headers.insert("X-Qiniu".into(), "value".into());
headers
};
let form_headers = {
let mut headers = Headers::new();
headers.insert("Content-Type".into(), mime::FORM_MIME.into());
headers.insert("X-Qbox-Meta".into(), "value".into());
headers.insert("X-Qiniu-Cxxxx".into(), "valuec".into());
headers.insert("X-Qiniu-Bxxxx".into(), "valueb".into());
headers.insert("X-Qiniu-axxxx".into(), "valuea".into());
headers.insert("X-Qiniu-e".into(), "value".into());
headers.insert("X-Qiniu-".into(), "value".into());
headers.insert("X-Qiniu".into(), "value".into());
headers
};
assert_eq!(
credential.sign_request_v2(
Method::GET,
"http://upload.qiniup.com/",
&json_headers,
b"{\"name\":\"test\"}"
)?,
credential.sign(
concat!(
"GET /\n",
"Host: upload.qiniup.com\n",
"Content-Type: application/json\n",
"X-Qiniu-Axxxx: valuea\n",
"X-Qiniu-Bxxxx: valueb\n",
"X-Qiniu-Cxxxx: valuec\n",
"X-Qiniu-E: value\n\n",
"{\"name\":\"test\"}"
)
.as_bytes()
)
);
assert_eq!(
credential.sign_request_v2(
Method::GET,
"http://upload.qiniup.com/",
&empty_headers,
b"{\"name\":\"test\"}"
)?,
credential.sign(concat!("GET /\n", "Host: upload.qiniup.com\n\n").as_bytes())
);
assert_eq!(
credential.sign_request_v2(
Method::POST,
"http://upload.qiniup.com/",
&json_headers,
b"{\"name\":\"test\"}"
)?,
credential.sign(
concat!(
"POST /\n",
"Host: upload.qiniup.com\n",
"Content-Type: application/json\n",
"X-Qiniu-Axxxx: valuea\n",
"X-Qiniu-Bxxxx: valueb\n",
"X-Qiniu-Cxxxx: valuec\n",
"X-Qiniu-E: value\n\n",
"{\"name\":\"test\"}"
)
.as_bytes()
)
);
assert_eq!(
credential.sign_request_v2(
Method::GET,
"http://upload.qiniup.com/",
&form_headers,
b"name=test&language=go"
)?,
credential.sign(
concat!(
"GET /\n",
"Host: upload.qiniup.com\n",
"Content-Type: application/x-www-form-urlencoded\n",
"X-Qiniu-Axxxx: valuea\n",
"X-Qiniu-Bxxxx: valueb\n",
"X-Qiniu-Cxxxx: valuec\n",
"X-Qiniu-E: value\n\n",
"name=test&language=go"
)
.as_bytes()
)
);
assert_eq!(
credential.sign_request_v2(
Method::GET,
"http://upload.qiniup.com/?v=2",
&form_headers,
b"name=test&language=go"
)?,
credential.sign(
concat!(
"GET /?v=2\n",
"Host: upload.qiniup.com\n",
"Content-Type: application/x-www-form-urlencoded\n",
"X-Qiniu-Axxxx: valuea\n",
"X-Qiniu-Bxxxx: valueb\n",
"X-Qiniu-Cxxxx: valuec\n",
"X-Qiniu-E: value\n\n",
"name=test&language=go"
)
.as_bytes()
)
);
assert_eq!(
credential.sign_request_v2(
Method::GET,
"http://upload.qiniup.com/find/sdk?v=2",
&form_headers,
b"name=test&language=go"
)?,
credential.sign(
concat!(
"GET /find/sdk?v=2\n",
"Host: upload.qiniup.com\n",
"Content-Type: application/x-www-form-urlencoded\n",
"X-Qiniu-Axxxx: valuea\n",
"X-Qiniu-Bxxxx: valueb\n",
"X-Qiniu-Cxxxx: valuec\n",
"X-Qiniu-E: value\n\n",
"name=test&language=go"
)
.as_bytes()
)
);
Ok(())
} | rust_cleaned_test_functions.jsonl/84486 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3499
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11172,
7893,
2273,
17,
368,
1464,
5714,
68843,
8261,
92846,
4600,
2452,
341,
286,
1077,
40207,
284,
633,
666,
30320,
543,
286,
1077,
4287,
26719,
284,
341,
310,
1077,
5206,
7102,
284,
21426,
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... | 7 |
#[test]
fn test_accommodates_integer() {
assert!(!ValueType::Instant.accommodates_integer(1493399581314));
assert!(!ValueType::Instant.accommodates_integer(1493399581314000));
assert!(ValueType::Boolean.accommodates_integer(1));
assert!(!ValueType::Boolean.accommodates_integer(-1));
assert!(!ValueType::Boolean.accommodates_integer(10));
assert!(!ValueType::String.accommodates_integer(10));
} | rust_cleaned_test_functions.jsonl/92079 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 196
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14718,
874,
2593,
973,
31725,
368,
341,
286,
2060,
0,
3471,
60897,
486,
30340,
15399,
874,
2593,
973,
31725,
7,
16,
19,
24,
18,
18,
24,
24,
20,
23,
16,
18,
16,
19,
1106,
286,
2060,
0,
3471... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_large_alignment() {
#[repr(align(64))]
#[derive(Debug)]
struct LargeAlignedError(&'static str);
impl Display for LargeAlignedError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str(self.0)
}
}
impl StdError for LargeAlignedError {}
let error = Error::new(LargeAlignedError("oh no!"));
assert_eq!(
"oh no!",
error.downcast_ref::<LargeAlignedError>().unwrap().0
);
} | rust_cleaned_test_functions.jsonl/69159 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 222
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45228,
51006,
368,
341,
262,
11506,
30837,
7,
6612,
7,
21,
19,
22297,
262,
11506,
27098,
42618,
5563,
262,
2036,
20286,
93305,
1454,
2099,
6,
1978,
607,
626,
262,
11605,
10623,
369,
20286,
93305,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_push() {
let mut v = vec![];
v.push(1);
assert_eq!(v.len(), 1);
assert_eq!(v[0], 1);
v.push(2);
assert_eq!(v.len(), 2);
assert_eq!(v[0], 1);
assert_eq!(v[1], 2);
} | rust_cleaned_test_functions.jsonl/12862 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14218,
368,
341,
1066,
262,
1077,
5206,
348,
284,
7486,
0,
15078,
262,
348,
2552,
7,
16,
317,
262,
2060,
10714,
10297,
85,
19406,
1507,
220,
16,
317,
262,
2060,
10714,
10297,
85,
58,
15,
1125,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_throttle_tx_per_second_nok() {
let millis = Duration::from_millis;
let mut ledger = Ledger {
transaction_window: millis(2000),
max_transactions_in_window: 2,
..Ledger::default()
};
let op = Operation::Mint {
to: PrincipalId::new_user_test_id(1).into(),
amount: Tokens::from_e8s(1000),
};
let now: TimeStamp = dfn_core::api::now().into();
assert_eq!(apply_at(&mut ledger, &op, now + millis(1)), 0);
assert_eq!(apply_at(&mut ledger, &op, now + millis(1002)), 1);
// expecting panic here
apply_at(&mut ledger, &op, now + millis(1003));
} | rust_cleaned_test_functions.jsonl/102186 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 344
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5854,
27535,
17805,
5678,
29644,
1089,
562,
368,
341,
286,
1077,
57092,
284,
21045,
486,
1499,
717,
56212,
401,
286,
1077,
5206,
46933,
284,
70306,
341,
310,
7745,
12571,
25,
57092,
7,
17,
15,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unwrap_or_else() {
let x: Option<int> = Some(1);
assert_eq!(x.unwrap_or_else(|| 2), 1);
let x: Option<int> = None;
assert_eq!(x.unwrap_or_else(|| 2), 2);
} | rust_cleaned_test_functions.jsonl/101725 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
10097,
8734,
62628,
368,
341,
262,
1077,
856,
25,
6959,
4159,
29,
284,
4329,
7,
16,
317,
262,
2060,
10714,
10297,
87,
55395,
8734,
62628,
79453,
220,
17,
701,
220,
16,
626,
262,
1077,
85... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_capture_with_subquery() {
let mut reader = Reader::init("token: header \"Location\" regex \"token=(.*)\"");
let capture0 = capture(&mut reader).unwrap();
assert_eq!(
capture0.query,
Query {
source_info: SourceInfo::init(1, 8, 1, 25),
value: QueryValue::Header {
space0: Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(1, 14, 1, 15),
},
name: Template {
quotes: true,
elements: vec![TemplateElement::String {
value: "Location".to_string(),
encoded: "Location".to_string(),
}],
source_info: SourceInfo::init(1, 15, 1, 25),
},
},
subquery: Some((
Whitespace {
value: " ".to_string(),
source_info: SourceInfo::init(1, 25, 1, 26),
},
Subquery {
source_info: SourceInfo::init(1, 26, 1, 44),
value: SubqueryValue::Regex {
space0: Whitespace {
value: " ".to_string(),
source_info: SourceInfo::init(1, 31, 1, 32),
},
expr: Template {
quotes: true,
elements: vec![TemplateElement::String {
value: "token=(.*)".to_string(),
encoded: "token=(.*)".to_string(),
}],
source_info: SourceInfo::init(1, 32, 1, 44),
},
},
}
)),
}
);
assert_eq!(reader.state.cursor, 43);
} | rust_cleaned_test_functions.jsonl/17073 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1376
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55148,
6615,
5228,
1631,
368,
341,
286,
1077,
5206,
6604,
284,
25166,
486,
2327,
445,
5839,
25,
4247,
7245,
4707,
2105,
20180,
7245,
5839,
4539,
96494,
88385,
286,
1077,
12322,
15,
284,
12322,
209... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multiple_params_from_route() {
let mut request = Request::new().with_route("/test/route/query1?query2?arg1=1&arg2=2".to_string());
let params: HashMap<String, String> = [("arg1".to_string(), "1".to_string()),
("arg2".to_string(), "2".to_string())]
.iter().cloned().collect();
request = request.query_params_from_route();
assert_eq!(request.get_query_params() , params)
} | rust_cleaned_test_functions.jsonl/60432 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 244
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45233,
6745,
5673,
28109,
368,
341,
262,
1077,
5206,
1681,
284,
6145,
486,
931,
1005,
4197,
28109,
4283,
1944,
7382,
2133,
66762,
16,
30,
1631,
17,
30,
858,
16,
28,
16,
5,
858,
17,
28,
17,
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_tt_composite() {
parse_macro(
r#"
macro_rules! foo {
($i:tt) => { 0 }
}
"#,
)
.assert_expand_items(r#"foo! { => }"#, r#"0"#);
} | rust_cleaned_test_functions.jsonl/28746 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66740,
2965,
13607,
368,
341,
262,
4715,
58810,
1006,
286,
435,
2,
698,
310,
18072,
21407,
0,
15229,
341,
338,
1711,
72,
25,
5566,
8,
589,
314,
220,
15,
456,
310,
456,
262,
5869,
345,
262,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_constant_happy_path() {
use super::CaptureSink;
use std::collections::HashSet;
let constant = Plan::constant().expect("ok");
let sink = CaptureSink::new(constant.result().into());
let writer = sink.writer();
timely::execute::example(move |scope| {
let sources = FactMap::new();
let captures =
lower_matching_plan(scope, &mut default_injector, &constant, &sources).expect("ok");
writer.attach(&captures).expect("ok");
});
assert_eq!(
sink.values::<HashSet<_>>(),
[[].into()].iter().cloned().collect()
);
} | rust_cleaned_test_functions.jsonl/31137 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 258
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34967,
1523,
11144,
2638,
368,
341,
262,
990,
2256,
486,
27429,
45094,
280,
262,
990,
1460,
486,
51137,
486,
44601,
401,
262,
1077,
6783,
284,
9680,
486,
18077,
1005,
17119,
445,
562,
3071,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_decimal_value() {
assert_eq!(
parse_decimal_value(&[0, 0, 0, 0, 0][..]),
Ok((EMPTY, DecimalValue { scale: 0, value: 0 }))
);
assert_eq!(
parse_decimal_value(&[255, 255, 255, 255, 255][..]),
Ok((
EMPTY,
DecimalValue {
scale: 255,
value: 4294967295
}
))
);
} | rust_cleaned_test_functions.jsonl/25459 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 298
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
74429,
3142,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
74429,
3142,
2099,
58,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
1457,
496,
17036,
310,
7622,
1188,
32858,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_validate_non_json_body() {
let expected = r#"asdf"#;
let actual = r#"asdf "#;
validate_body(&actual, expected, MediaType::from("something/else"))
.expect_err("bodies do not match");
validate_body(&expected, expected, MediaType::from("something/else"))
.expect("inputs matched exactly")
} | rust_cleaned_test_functions.jsonl/12139 | {
"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,
42681,
21637,
9455,
14114,
368,
341,
286,
1077,
3601,
284,
435,
55543,
76615,
57676,
280,
286,
1077,
5042,
284,
435,
55543,
76615,
5869,
280,
286,
9593,
14114,
2099,
11944,
11,
3601,
11,
50423,
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_div() {
let x = Number128::from(10_u64);
let y = Number128::from(5_u64);
let r = x.try_div(y).unwrap();
assert_eq!(r, Number128::from(2_u64));
let x = Number128::from(11_u64);
let y = Number128::from(5_u64);
let r = x.try_div(y).unwrap();
assert_eq!(r, Number128::from_decimal(22_u64, -1_i32));
let x = Number128::from(14_u64);
let y = Number128::from(5_u64);
let r = x.try_div(y).unwrap();
assert_eq!(r, Number128::from_decimal(28_u64, -1_i32));
//.5 case
let x = Number128::from(5_u64);
let y = Number128::from(2_u64);
let r = x.try_div(y).unwrap();
assert_eq!(r, Number128::from_decimal(25_u64, -1_i32));
} | rust_cleaned_test_functions.jsonl/53695 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 444
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16237,
368,
341,
1789,
286,
1077,
856,
284,
5624,
16,
17,
23,
486,
1499,
7,
16,
15,
7300,
21,
19,
317,
286,
1077,
379,
284,
5624,
16,
17,
23,
486,
1499,
7,
20,
7300,
21,
19,
317,
286,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_optimizer_settings_basic() {
figment::Jail::expect_with(|jail| {
jail.create_file(
"foundry.toml",
r#"
[default]
optimizer = true
[default.optimizer_details]
yul = false
[default.optimizer_details.yulDetails]
stackAllocation = true
"#,
)?;
let loaded = Config::load();
assert_eq!(
loaded.optimizer_details,
Some(OptimizerDetails {
yul: Some(false),
yul_details: Some(YulDetails {
stack_allocation: Some(true),
..Default::default()
}),
..Default::default()
})
);
let s = loaded.to_string_pretty().unwrap();
jail.create_file("foundry.toml", &s)?;
let reloaded = Config::load();
assert_eq!(loaded, reloaded);
Ok(())
});
} | rust_cleaned_test_functions.jsonl/42704 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 671
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68168,
10853,
34729,
368,
341,
286,
4144,
478,
486,
41,
604,
486,
17119,
6615,
22428,
73,
604,
91,
341,
310,
17540,
2520,
2458,
1006,
394,
330,
15105,
884,
73494,
75,
756,
394,
435,
2,
698,
39... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_cp_numbered_if_existing_backup_nil() {
let (at, mut ucmd) = at_and_ucmd!();
let existing_backup = &*format!("{}.~1~", TEST_HOW_ARE_YOU_SOURCE);
at.touch(existing_backup);
ucmd.arg("--backup=nil")
.arg(TEST_HELLO_WORLD_SOURCE)
.arg(TEST_HOW_ARE_YOU_SOURCE)
.succeeds()
.no_stderr();
assert!(at.file_exists(TEST_HOW_ARE_YOU_SOURCE));
assert!(at.file_exists(existing_backup));
assert_eq!(
at.read(&*format!("{}.~2~", TEST_HOW_ARE_YOU_SOURCE)),
"How are you?\n"
);
} | rust_cleaned_test_functions.jsonl/21257 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 290
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39811,
5500,
291,
11119,
62630,
44710,
36175,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
1077,
6350,
44710,
284,
609,
9,
2243,
17223,
46391,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_benchmarks_submit_decrypted_shares() {
let (mut t, _, _) = ExternalityBuilder::build();
t.execute_with(|| {
assert_ok!(test_benchmark_verify_submit_decrypted_shares_100::<
TestRuntime,
>());
});
} | rust_cleaned_test_functions.jsonl/24795 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 150
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
19762,
15544,
31674,
13783,
14026,
3712,
5403,
368,
341,
286,
1077,
320,
6984,
259,
11,
8358,
27439,
284,
1374,
4160,
2719,
3297,
486,
5834,
543,
286,
259,
7769,
6615,
79453,
341,
310,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_virtio_fs_multi_segment_hotplug() {
test_virtio_fs(
true,
Some(0x4000_0000),
"none",
&prepare_virtiofsd,
true,
Some(15),
)
} | rust_cleaned_test_functions.jsonl/26140 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 157
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
2106,
815,
34470,
25133,
28061,
33433,
47474,
368,
341,
286,
1273,
2273,
2106,
815,
34470,
1006,
310,
830,
345,
310,
4329,
7,
15,
87,
19,
15,
15,
15,
62,
15,
15,
15,
15,
1326,
310,
330... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_next_hop_path_attribute() {
let nh_bytes: &[u8] = &[192, 168, 1, 1];
let ctx = &ParserContext::new().four_octet_asn(true).nlri_mode(Ipv6);
let result = NextHopPathAttribute::from_wire(ctx, nh_bytes).unwrap();
assert_eq!(result.1 .0, "192.168.1.1".parse::<Ipv4Addr>().unwrap());
let wire = result.1.to_wire(ctx).unwrap();
assert_eq!(wire, nh_bytes);
assert_eq!(result.1.wire_len(ctx).unwrap(), wire.len() as u16);
} | rust_cleaned_test_functions.jsonl/49689 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 246
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11257,
98193,
2638,
16791,
368,
341,
286,
1077,
20303,
12524,
25,
44590,
84,
23,
60,
284,
44590,
16,
24,
17,
11,
220,
16,
21,
23,
11,
220,
16,
11,
220,
16,
935,
286,
1077,
5635,
284,
609,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serial_scratch() {
let mut serial = Serial::new_sink(EventFd::new(libc::EFD_NONBLOCK).unwrap());
serial.write(u64::from(SCR), &[0x12 as u8]);
let mut data = [0u8];
serial.read(u64::from(SCR), &mut data[..]);
assert_eq!(data[0], 0x12 as u8);
} | rust_cleaned_test_functions.jsonl/37138 | {
"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,
25602,
59728,
754,
368,
341,
286,
1077,
5206,
6146,
284,
11215,
486,
931,
51567,
30469,
74476,
486,
931,
44828,
66,
486,
36,
14596,
22128,
39964,
568,
15454,
5231,
286,
6146,
3836,
8154,
21,
19,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_min_max_result() {
let r: MinMaxResult<isize> = NoElements;
assert_eq!(r.into_option(), None);
let r = OneElement(1);
assert_eq!(r.into_option(), Some((1,1)));
let r = MinMax(1,2);
assert_eq!(r.into_option(), Some((1,2)));
} | rust_cleaned_test_functions.jsonl/37054 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 129
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7260,
6345,
5287,
368,
341,
262,
1077,
435,
25,
3386,
5974,
2077,
27,
285,
551,
29,
284,
2308,
11868,
280,
262,
2060,
10714,
10297,
81,
39860,
9672,
1507,
2240,
626,
262,
1077,
435,
284,
3776,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_counter_words() {
let counter: u64 = (1 << 32) + 2;
assert_eq!(crate::counter_low(counter), 2);
assert_eq!(crate::counter_high(counter), 1);
} | rust_cleaned_test_functions.jsonl/39144 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 79
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15730,
18981,
368,
341,
262,
1077,
5546,
25,
575,
21,
19,
284,
320,
16,
1115,
220,
18,
17,
8,
488,
220,
17,
280,
262,
2060,
10714,
10297,
61711,
486,
8292,
23767,
41320,
701,
220,
17,
317,
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 |
#[test]
fn test_plane_downsample() {
#[rustfmt::skip]
let plane = Plane::<u8> {
data: PlaneData::from_slice(&[
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, 0, 1, 2, 3, 4, 0, 0,
0, 0, 8, 7, 6, 5, 0, 0,
0, 0, 9, 8, 7, 6, 0, 0,
0, 0, 2, 3, 4, 5, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
]),
cfg: PlaneConfig {
stride: 8,
alloc_height: 9,
width: 4,
height: 4,
xdec: 0,
ydec: 0,
xpad: 0,
ypad: 0,
xorigin: 2,
yorigin: 3,
},
};
let downsampled = plane.downsampled(4, 4);
#[rustfmt::skip]
assert_eq!(
&[
5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5,
6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6,
][..],
&downsampled.data[..]
);
} | rust_cleaned_test_functions.jsonl/76899 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 710
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46023,
13998,
13611,
368,
341,
262,
11506,
35788,
12501,
486,
20599,
921,
262,
1077,
11031,
284,
43044,
27638,
84,
23,
29,
341,
414,
821,
25,
43044,
1043,
486,
1499,
26488,
2099,
9640,
286,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_delete_one_auth() {
let api = api();
let req = Request::new(Method::Delete)
.with_path_segs(&["foo"])
.with_query("index=0")
.with_header(Authorization(Bearer { token: "PASSWORD".to_owned() }));
let _ = test_ok(&api, req);
// The comment should be removed.
let req = Request::new(Method::Get)
.with_path_segs(&["foo"])
.with_query("index=0");
let err = test_err(&api, req);
assert_eq!(err.status(), StatusCode::NotFound);
} | rust_cleaned_test_functions.jsonl/125376 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 228
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11353,
11667,
14014,
368,
341,
262,
1077,
6330,
284,
6330,
543,
262,
1077,
4232,
284,
6145,
486,
931,
35419,
486,
6435,
340,
286,
659,
4197,
2638,
3453,
5857,
2099,
1183,
7975,
14108,
286,
659,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_account_state_with_proof() {
let (mock_db, client, mut runtime) = create_database_client_and_runtime();
let account = get_first_account_from_mock_db(&mock_db);
let mut batch = JsonRpcBatch::default();
batch.add_get_account_state_with_proof_request(account, Some(0), Some(0));
let result = execute_batch_and_get_first_response(&client, &mut runtime, batch);
let received_proof = AccountStateWithProofView::from_response(result).unwrap();
let expected_proof = get_first_state_proof_from_mock_db(&mock_db);
let expected_blob = expected_proof.blob.as_ref().unwrap();
let expected_sm_proof = expected_proof.proof.transaction_info_to_account_proof();
let expected_txn_info_with_proof = expected_proof.proof.transaction_info_with_proof();
//version
assert_eq!(received_proof.version, expected_proof.version);
// blob
let account_blob: AccountStateBlob =
lcs::from_bytes(&received_proof.blob.unwrap().into_bytes().unwrap()).unwrap();
assert_eq!(account_blob, *expected_blob);
// proof
let sm_proof: SparseMerkleProof = lcs::from_bytes(
&received_proof
.proof
.transaction_info_to_account_proof
.into_bytes()
.unwrap(),
)
.unwrap();
assert_eq!(sm_proof, *expected_sm_proof);
let txn_info: TransactionInfo =
lcs::from_bytes(&received_proof.proof.transaction_info.into_bytes().unwrap()).unwrap();
let li_proof: TransactionAccumulatorProof = lcs::from_bytes(
&received_proof
.proof
.ledger_info_to_transaction_info_proof
.into_bytes()
.unwrap(),
)
.unwrap();
let txn_info_with_proof = TransactionInfoWithProof::new(li_proof, txn_info);
assert_eq!(txn_info_with_proof, *expected_txn_info_with_proof);
} | rust_cleaned_test_functions.jsonl/4634 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 767
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
13500,
4387,
6615,
86757,
368,
341,
262,
1077,
320,
16712,
8685,
11,
2943,
11,
5206,
15592,
8,
284,
1855,
27341,
8179,
8378,
33232,
1428,
262,
1077,
2692,
284,
633,
12978,
13500,
5673,
34134... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_binary_slice_mask_iter_with_false() {
let mask = BooleanArray::from(vec![false, false]);
let out = BinaryMaskedSliceIterator::new(&mask)
.into_iter()
.collect::<Vec<_>>();
assert_eq!(out, &[(0, 2, false)]);
} | rust_cleaned_test_functions.jsonl/98403 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31761,
26488,
9999,
11723,
6615,
36015,
368,
341,
286,
1077,
6911,
284,
6992,
1857,
486,
1499,
25592,
20703,
3849,
11,
895,
2558,
286,
1077,
700,
284,
17718,
12686,
291,
33236,
11951,
486,
931,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sort_stakes_basic() {
let pubkey0 = paychains_sdk::pubkey::new_rand();
let pubkey1 = paychains_sdk::pubkey::new_rand();
let mut stakes = vec![(pubkey0, 1), (pubkey1, 2)];
sort_stakes(&mut stakes);
assert_eq!(stakes, vec![(pubkey1, 2), (pubkey0, 1)]);
} | rust_cleaned_test_functions.jsonl/61005 | {
"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,
18435,
1261,
2050,
34729,
368,
341,
286,
1077,
95116,
15,
284,
2291,
58358,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
95116,
16,
284,
2291,
58358,
61783,
486,
9585,
792,
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_exact_with_different_subject() {
assert!(!claim_exact_str(&Claim::new("read", ""), "read:blah"));
assert!(!claim_exact_str(
&Claim::new("read", "something"),
"read:blah"
));
assert!(!claim_exact_str(
&Claim::new("read", "something"),
"read:something.blah"
));
} | rust_cleaned_test_functions.jsonl/49511 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 201
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71084,
6615,
82741,
28834,
368,
341,
286,
2060,
0,
3471,
7859,
71084,
2895,
2099,
45544,
486,
931,
445,
878,
497,
77130,
330,
878,
25,
70614,
4010,
286,
2060,
0,
3471,
7859,
71084,
2895,
1006,
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_timestamps_with_same_ym_at_unknown_offset_are_equal() -> IonResult<()> {
let builder = Timestamp::with_year(2021).with_month(2);
let timestamp1 = builder.clone().build()?;
let timestamp2 = builder.clone().build()?;
assert_eq!(timestamp1, timestamp2);
Ok(())
} | rust_cleaned_test_functions.jsonl/13950 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23073,
82,
6615,
33574,
62,
1600,
3752,
57507,
6917,
56855,
11478,
368,
1464,
44805,
2077,
71698,
341,
286,
1077,
7363,
284,
32758,
486,
4197,
14645,
7,
17,
15,
17,
16,
568,
4197,
18933,
7,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_tree_insertion_with_duplicate_keys() {
let sample = |_| "a";
let sample_vec: Vec<i32> = (0..20).collect();
let sample_vec: Vec<&str> = sample_vec.iter().map(sample).collect();
let mut rb_tree = RBTree::new();
for key in sample_vec {
rb_tree.insert(key, key);
}
assert_eq!(rb_tree.len(), 1);
let root_node = rb_tree.root.as_ref().unwrap();
assert_eq!(root_node.borrow().key, "a");
assert_eq!(root_node.borrow().value.as_ref().unwrap(), "a");
} | rust_cleaned_test_functions.jsonl/61998 | {
"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,
11663,
17678,
290,
6615,
70434,
12631,
368,
341,
286,
1077,
6077,
284,
66091,
330,
64,
876,
286,
1077,
6077,
13251,
25,
11312,
21897,
18,
17,
29,
284,
320,
15,
496,
17,
15,
568,
17384,
543,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_transaction_status_index() {
let ledger_path = get_tmp_ledger_path_auto_delete!();
let blockstore = Blockstore::open(ledger_path.path()).unwrap();
let transaction_status_index_cf = &blockstore.transaction_status_index_cf;
let slot0 = 10;
// Primary index column is initialized on Blockstore::open
assert!(transaction_status_index_cf.get(0).unwrap().is_some());
assert!(transaction_status_index_cf.get(1).unwrap().is_some());
for _ in 0..5 {
let random_bytes: Vec<u8> = (0..64).map(|_| rand::random::<u8>()).collect();
blockstore
.write_transaction_status(
slot0,
Signature::new(&random_bytes),
vec![&Pubkey::new(&random_bytes[0..32])],
vec![&Pubkey::new(&random_bytes[32..])],
TransactionStatusMeta::default(),
)
.unwrap();
}
// New statuses bump index 0 max_slot
assert_eq!(
transaction_status_index_cf.get(0).unwrap().unwrap(),
TransactionStatusIndexMeta {
max_slot: slot0,
frozen: false,
}
);
assert_eq!(
transaction_status_index_cf.get(1).unwrap().unwrap(),
TransactionStatusIndexMeta::default()
);
let first_status_entry = blockstore
.db
.iter::<cf::TransactionStatus>(IteratorMode::From(
cf::TransactionStatus::as_index(0),
IteratorDirection::Forward,
))
.unwrap()
.next()
.unwrap()
.0;
assert_eq!(first_status_entry.0, 0);
assert_eq!(first_status_entry.2, slot0);
let first_address_entry = blockstore
.db
.iter::<cf::AddressSignatures>(IteratorMode::From(
cf::AddressSignatures::as_index(0),
IteratorDirection::Forward,
))
.unwrap()
.next()
.unwrap()
.0;
assert_eq!(first_address_entry.0, 0);
assert_eq!(first_address_entry.2, slot0);
blockstore.run_purge(0, 8, PurgeType::PrimaryIndex).unwrap();
// First successful prune freezes index 0
assert_eq!(
transaction_status_index_cf.get(0).unwrap().unwrap(),
TransactionStatusIndexMeta {
max_slot: slot0,
frozen: true,
}
);
assert_eq!(
transaction_status_index_cf.get(1).unwrap().unwrap(),
TransactionStatusIndexMeta::default()
);
let slot1 = 20;
for _ in 0..5 {
let random_bytes: Vec<u8> = (0..64).map(|_| rand::random::<u8>()).collect();
blockstore
.write_transaction_status(
slot1,
Signature::new(&random_bytes),
vec![&Pubkey::new(&random_bytes[0..32])],
vec![&Pubkey::new(&random_bytes[32..])],
TransactionStatusMeta::default(),
)
.unwrap();
}
assert_eq!(
transaction_status_index_cf.get(0).unwrap().unwrap(),
TransactionStatusIndexMeta {
max_slot: slot0,
frozen: true,
}
);
assert_eq!(
transaction_status_index_cf.get(1).unwrap().unwrap(),
TransactionStatusIndexMeta {
max_slot: slot1,
frozen: false,
}
);
// Index 0 statuses and address records still exist
let first_status_entry = blockstore
.db
.iter::<cf::TransactionStatus>(IteratorMode::From(
cf::TransactionStatus::as_index(0),
IteratorDirection::Forward,
))
.unwrap()
.next()
.unwrap()
.0;
assert_eq!(first_status_entry.0, 0);
assert_eq!(first_status_entry.2, 10);
let first_address_entry = blockstore
.db
.iter::<cf::AddressSignatures>(IteratorMode::From(
cf::AddressSignatures::as_index(0),
IteratorDirection::Forward,
))
.unwrap()
.next()
.unwrap()
.0;
assert_eq!(first_address_entry.0, 0);
assert_eq!(first_address_entry.2, slot0);
// New statuses and address records are stored in index 1
let index1_first_status_entry = blockstore
.db
.iter::<cf::TransactionStatus>(IteratorMode::From(
cf::TransactionStatus::as_index(1),
IteratorDirection::Forward,
))
.unwrap()
.next()
.unwrap()
.0;
assert_eq!(index1_first_status_entry.0, 1);
assert_eq!(index1_first_status_entry.2, slot1);
let index1_first_address_entry = blockstore
.db
.iter::<cf::AddressSignatures>(IteratorMode::From(
cf::AddressSignatures::as_index(1),
IteratorDirection::Forward,
))
.unwrap()
.next()
.unwrap()
.0;
assert_eq!(index1_first_address_entry.0, 1);
assert_eq!(index1_first_address_entry.2, slot1);
blockstore
.run_purge(0, 18, PurgeType::PrimaryIndex)
.unwrap();
// Successful prune toggles TransactionStatusIndex
assert_eq!(
transaction_status_index_cf.get(0).unwrap().unwrap(),
TransactionStatusIndexMeta {
max_slot: 0,
frozen: false,
}
);
assert_eq!(
transaction_status_index_cf.get(1).unwrap().unwrap(),
TransactionStatusIndexMeta {
max_slot: slot1,
frozen: true,
}
);
let first_status_entry = blockstore
.db
.iter::<cf::TransactionStatus>(IteratorMode::From(
cf::TransactionStatus::as_index(0),
IteratorDirection::Forward,
))
.unwrap()
.next()
.unwrap()
.0;
assert_eq!(first_status_entry.0, 1);
assert_eq!(first_status_entry.2, slot1);
let first_address_entry = blockstore
.db
.iter::<cf::AddressSignatures>(IteratorMode::From(
cf::AddressSignatures::as_index(0),
IteratorDirection::Forward,
))
.unwrap()
.next()
.unwrap()
.0;
assert_eq!(first_address_entry.0, 1);
assert_eq!(first_address_entry.2, slot1);
} | rust_cleaned_test_functions.jsonl/9558 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3754
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28884,
4773,
3560,
368,
341,
286,
1077,
46933,
2638,
284,
633,
16125,
38367,
1389,
2638,
27740,
11353,
0,
543,
286,
1077,
2504,
4314,
284,
8362,
4314,
486,
2508,
7,
50704,
2638,
3875,
6011,
15454,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_list_of_scores() {
let expected = [30, 50, 20, 70];
let high_scores = HighScores::new(&expected);
assert_eq!(high_scores.scores(), &expected);
} | rust_cleaned_test_functions.jsonl/78247 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 78
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2019,
3575,
27198,
368,
341,
262,
1077,
3601,
284,
508,
18,
15,
11,
220,
20,
15,
11,
220,
17,
15,
11,
220,
22,
15,
935,
262,
1077,
1550,
27198,
284,
5124,
55936,
486,
931,
2099,
7325,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_version_less_mismatched_parts() {
assert!(Version::parse("1.0.0.0.0").unwrap() == Version::parse("1.0.0.0").unwrap());
assert!(Version::parse("1.0.0.0.5").unwrap() > Version::parse("1.0.0.0").unwrap());
assert!(Version::parse("1.0.0.0.0").unwrap() < Version::parse("1.0.0.0.5").unwrap());
assert!(Version::parse("1.0.0.0.0.5").unwrap() > Version::parse("1.0.0.0").unwrap());
} | rust_cleaned_test_functions.jsonl/6352 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 210
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9438,
50747,
717,
24976,
291,
33217,
368,
341,
286,
2060,
10297,
5637,
486,
6400,
445,
16,
13,
15,
13,
15,
13,
15,
13,
15,
1827,
15454,
368,
621,
6079,
486,
6400,
445,
16,
13,
15,
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_p2_example_input() {
let result = get_number_of_orbit_transfers(String::from("./input/day_06/test/test_02.txt"), String::from("YOU"), String::from("SAN"));
assert_eq!(4, result);
} | rust_cleaned_test_functions.jsonl/69431 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
17,
39304,
5898,
368,
341,
286,
1077,
1102,
284,
633,
5500,
3575,
8734,
4489,
7965,
49793,
2242,
486,
1499,
13988,
1355,
44739,
62,
15,
21,
12697,
12697,
62,
15,
17,
3909,
3975,
923,
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 |
#[test]
fn test_strip_whitespace() {
assert_eq!(b"foobar".to_vec(), decode_block(" Zm9vYmFy\n").unwrap());
assert_eq!(b"foob".to_vec(), decode_block(" Zm9vYg==\n").unwrap());
} | rust_cleaned_test_functions.jsonl/51045 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66130,
86175,
368,
341,
286,
2060,
10714,
10297,
65,
1,
50267,
3263,
983,
13251,
1507,
16895,
7113,
445,
1863,
76,
24,
85,
56,
76,
37,
88,
1699,
1827,
15454,
1423,
286,
2060,
10714,
10297,
65,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fake_block() {
use std::convert::TryFrom;
let block = Block::new(
CryptoHashOf::from(CryptoHash(Vec::new())),
Payload::new(
ic_crypto::crypto_hash,
(
batch::BatchPayload::default(),
ic_types::consensus::dkg::Dealings::new_empty(Height::from(1)),
None,
)
.into(),
),
Height::from(123),
Rank(456),
ValidationContext {
registry_version: RegistryVersion::from(99),
certified_height: Height::from(42),
time: crate::util::mock_time(),
},
);
// fake block is binary compatible
let bytes1 = bincode::serialize(&block).unwrap();
let fake_block = bincode::deserialize::<FakeBlock>(&bytes1).unwrap();
let bytes2 = bincode::serialize(&fake_block).unwrap();
assert_eq!(bytes1, bytes2);
// fake version works as expected
let new_version = ReplicaVersion::try_from(format!("{}.1234", block.version())).unwrap();
let block2 = block.fake_version(new_version.clone());
assert_eq!(block2.version(), &new_version);
} | rust_cleaned_test_functions.jsonl/35338 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 537
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56881,
7113,
368,
341,
262,
990,
1460,
486,
14166,
486,
21453,
3830,
280,
262,
1077,
2504,
284,
8362,
486,
931,
1006,
286,
32886,
6370,
2124,
486,
1499,
3025,
9444,
6370,
49923,
486,
931,
73727,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_4() {
let ss = b"abcABdefgCDEF";
let sq = b"gfCecbDdAaEBF";
assert_eq!(parse_stack(ss), parse_queue(sq));
} | rust_cleaned_test_functions.jsonl/28494 | {
"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,
62,
19,
368,
341,
286,
1077,
10870,
284,
293,
1,
13683,
1867,
750,
70,
34,
13649,
876,
286,
1077,
18031,
284,
293,
1,
45124,
34,
757,
65,
35,
67,
32,
64,
8264,
37,
876,
286,
2060,
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 |
#[test]
fn test_insert_greater() {
let mut root = tree!();
for content in ['A', 'B', 'C', 'D', 'E', 'F', 'G'].iter() {
assert!(root.insert(*content));
}
let expected = tree!('D' => [3, ('B' => [2, 'A', 'C']), ('F' => [2, 'E', 'G'])]);
assert_eq!(root, expected);
} | rust_cleaned_test_functions.jsonl/9211 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 137
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
97994,
368,
341,
197,
10217,
5206,
3704,
284,
4916,
0,
543,
197,
2023,
2213,
304,
2509,
32,
516,
364,
33,
516,
364,
34,
516,
364,
35,
516,
364,
36,
516,
364,
37,
516,
364,
38,
7204,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_once_per_second() {
let rate_limiter = UltraLightRateLimiter::new(1., get_ticker(vec![0, 500, 1000]));
assert!(rate_limiter.try_acquire(), "Must grant a permit");
assert!(!rate_limiter.try_acquire(), "Must not grant a permit");
assert!(rate_limiter.try_acquire(), "Must grant a permit");
} | rust_cleaned_test_functions.jsonl/107266 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7630,
5678,
29644,
368,
341,
286,
1077,
4379,
907,
17700,
284,
28213,
13911,
11564,
43,
17700,
486,
931,
7,
16,
2572,
633,
528,
5215,
25592,
20703,
15,
11,
220,
20,
15,
15,
11,
220,
16,
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_h256() {
let mut bytes: [u8; 32] = [0; 32];
bytes[0] = 5;
bytes[1] = 10;
let content = H256Le::from_bytes_le(&bytes);
assert_eq!(content.to_bytes_le(), bytes);
let bytes_be = content.to_bytes_be();
assert_eq!(bytes_be[31], 5);
assert_eq!(bytes_be[30], 10);
let content_be = H256Le::from_bytes_be(&bytes);
assert_eq!(content_be.to_bytes_be(), bytes);
} | rust_cleaned_test_functions.jsonl/90669 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 236
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1523,
17,
20,
21,
368,
341,
286,
1077,
5206,
5820,
25,
508,
84,
23,
26,
220,
18,
17,
60,
284,
508,
15,
26,
220,
18,
17,
935,
286,
5820,
58,
15,
60,
284,
220,
20,
280,
286,
5820,
58,
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_push_data_rxpk() {
let recv = [
0x2, 0x5E, 0x52, 0x0, 0xAA, 0x55, 0x5A, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7B, 0x22, 0x72, 0x78,
0x70, 0x6B, 0x22, 0x3A, 0x5B, 0x7B, 0x22, 0x74, 0x6D, 0x73, 0x74, 0x22, 0x3A, 0x31, 0x34,
0x37, 0x32, 0x32, 0x34, 0x32, 0x32, 0x35, 0x32, 0x2C, 0x22, 0x63, 0x68, 0x61, 0x6E, 0x22,
0x3A, 0x38, 0x2C, 0x22, 0x72, 0x66, 0x63, 0x68, 0x22, 0x3A, 0x30, 0x2C, 0x22, 0x66, 0x72,
0x65, 0x71, 0x22, 0x3A, 0x39, 0x31, 0x32, 0x2E, 0x36, 0x30, 0x30, 0x30, 0x30, 0x30, 0x2C,
0x22, 0x73, 0x74, 0x61, 0x74, 0x22, 0x3A, 0x31, 0x2C, 0x22, 0x6D, 0x6F, 0x64, 0x75, 0x22,
0x3A, 0x22, 0x4C, 0x4F, 0x52, 0x41, 0x22, 0x2C, 0x22, 0x64, 0x61, 0x74, 0x72, 0x22, 0x3A,
0x22, 0x53, 0x46, 0x38, 0x42, 0x57, 0x35, 0x30, 0x30, 0x22, 0x2C, 0x22, 0x63, 0x6F, 0x64,
0x72, 0x22, 0x3A, 0x22, 0x34, 0x2F, 0x35, 0x22, 0x2C, 0x22, 0x6C, 0x73, 0x6E, 0x72, 0x22,
0x3A, 0x31, 0x30, 0x2E, 0x38, 0x2C, 0x22, 0x72, 0x73, 0x73, 0x69, 0x22, 0x3A, 0x2D, 0x35,
0x38, 0x2C, 0x22, 0x73, 0x69, 0x7A, 0x65, 0x22, 0x3A, 0x32, 0x33, 0x2C, 0x22, 0x64, 0x61,
0x74, 0x61, 0x22, 0x3A, 0x22, 0x41, 0x4C, 0x51, 0x41, 0x41, 0x41, 0x41, 0x42, 0x41, 0x41,
0x41, 0x41, 0x53, 0x47, 0x56, 0x73, 0x61, 0x58, 0x56, 0x74, 0x49, 0x43, 0x41, 0x30, 0x4C,
0x44, 0x59, 0x43, 0x4E, 0x72, 0x41, 0x3D, 0x22, 0x7D, 0x5D, 0x7D,
];
let packet = Packet::parse(&recv).unwrap();
if let Packet::Up(Up::PushData(packet)) = packet {
let mut buffer = [0; 512];
let written = packet.serialize(&mut buffer).unwrap();
let _packet = Packet::parse(&buffer[..written as usize]).unwrap();
} else {
assert!(false);
}
} | rust_cleaned_test_functions.jsonl/62769 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1163
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14218,
1769,
24330,
20819,
368,
341,
262,
1077,
27006,
284,
2278,
286,
220,
15,
87,
17,
11,
220,
15,
87,
20,
36,
11,
220,
15,
87,
20,
17,
11,
220,
15,
87,
15,
11,
220,
15,
60051,
11,
220... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_repeat() {
init();
let p = elm_ref(b'a').repeat(..=3).collect();
let r = p.parse_as_result(b"");
assert!(r.is_ok());
let r = p.parse_as_result(b"a").unwrap();
assert_eq!(r, vec![b'a']);
let r = p.parse_as_result(b"aa").unwrap();
assert_eq!(r, vec![b'a', b'a']);
let r = p.parse_as_result(b"aaa").unwrap();
assert_eq!(r, vec![b'a', b'a', b'a']);
} | rust_cleaned_test_functions.jsonl/16787 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 216
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41975,
368,
341,
262,
2930,
543,
262,
1077,
281,
284,
42205,
7793,
1883,
25184,
1823,
30624,
56422,
28,
18,
568,
17384,
1428,
262,
1077,
435,
284,
281,
4632,
11898,
5287,
1883,
1,
797,
262,
2060... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ec_encode_decode_pkcs8() {
let algorithm = Algorithm::ECDSAP256SHA256;
encode_decode_with_format(KeyFormat::Pkcs8, algorithm, true, true);
} | rust_cleaned_test_functions.jsonl/36901 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 85
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36844,
11224,
15227,
33321,
4837,
23,
368,
341,
286,
1077,
12111,
284,
40325,
486,
7498,
5936,
2537,
17,
20,
21,
33145,
17,
20,
21,
280,
286,
16164,
15227,
6615,
8955,
21358,
4061,
486,
58415,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_leading_zero() {
let n = 10;
let rand_poly = DensePolynomial::rand(n, &mut test_rng());
let coefficients = rand_poly.coeffs.clone();
let leading_coefficient: Fr = coefficients[n];
let negative_leading_coefficient = -leading_coefficient;
let inverse_leading_coefficient = leading_coefficient.inverse().unwrap();
let mut inverse_coefficients = coefficients.clone();
inverse_coefficients[n] = inverse_leading_coefficient;
let mut negative_coefficients = coefficients;
negative_coefficients[n] = negative_leading_coefficient;
let negative_poly = DensePolynomial::from_coefficients_vec(negative_coefficients);
let inverse_poly = DensePolynomial::from_coefficients_vec(inverse_coefficients);
let x = &inverse_poly * &rand_poly;
assert_eq!(x.degree(), 2 * n);
assert!(!x.coeffs.last().unwrap().is_zero());
let y = &negative_poly + &rand_poly;
assert_eq!(y.degree(), n - 1);
assert!(!y.coeffs.last().unwrap().is_zero());
} | rust_cleaned_test_functions.jsonl/63061 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 441
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11751,
2228,
19359,
368,
341,
286,
1077,
308,
284,
220,
16,
15,
280,
286,
1077,
10382,
36133,
284,
42522,
14658,
25358,
486,
11335,
1445,
11,
609,
6984,
1273,
66849,
1423,
286,
1077,
36829,
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_cursed_function_declarator() {
let decl = parser("f(())")
.declarator(false)
.unwrap()
.unwrap()
.data
.parse_declarator();
assert_eq!(decl.id, Some("f".into()));
match decl.decl {
DeclaratorType::Function(FunctionDeclarator {
return_type,
params,
varargs,
}) => {
assert_eq!(*return_type, DeclaratorType::End);
assert_eq!(varargs, false);
assert_eq!(params.len(), 1);
let cursed = DeclaratorType::Function(FunctionDeclarator {
params: vec![],
varargs: false,
return_type: Box::new(DeclaratorType::End),
});
assert_eq!(params[0].declarator.decl, cursed);
}
_ => panic!("wrong declarator parsed"),
}
} | rust_cleaned_test_functions.jsonl/80715 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 560
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
51732,
9174,
2259,
12821,
850,
368,
341,
286,
1077,
3963,
284,
6729,
445,
69,
7,
2140,
1138,
310,
659,
56305,
850,
3576,
340,
310,
659,
15454,
741,
310,
659,
15454,
741,
310,
659,
691,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_parse_stake_checked_instructions() {
let mut keys: Vec<Pubkey> = vec![];
for _ in 0..6 {
keys.push(Pubkey::new_unique());
}
let authorized = Authorized {
staker: keys[3],
withdrawer: keys[0],
};
let lamports = 55;
let instructions =
instruction::create_account_checked(&keys[0], &keys[1], &authorized, lamports);
let message = Message::new(&instructions, None);
assert_eq!(
parse_stake(&message.instructions[1], &keys[0..4]).unwrap(),
ParsedInstructionEnum {
instruction_type: "initializeChecked".to_string(),
info: json!({
"stakeAccount": keys[1].to_string(),
"rentSysvar": keys[2].to_string(),
"staker": keys[3].to_string(),
"withdrawer": keys[0].to_string(),
}),
}
);
assert!(parse_stake(&message.instructions[1], &keys[0..3]).is_err());
let instruction = instruction::authorize_checked(
&keys[2],
&keys[0],
&keys[1],
StakeAuthorize::Staker,
None,
);
let message = Message::new(&[instruction], None);
assert_eq!(
parse_stake(&message.instructions[0], &keys[0..4]).unwrap(),
ParsedInstructionEnum {
instruction_type: "authorizeChecked".to_string(),
info: json!({
"stakeAccount": keys[2].to_string(),
"clockSysvar": keys[3].to_string(),
"authority": keys[0].to_string(),
"newAuthority": keys[1].to_string(),
"authorityType": StakeAuthorize::Staker,
}),
}
);
assert!(parse_stake(&message.instructions[0], &keys[0..3]).is_err());
let instruction = instruction::authorize_checked(
&keys[3],
&keys[0],
&keys[1],
StakeAuthorize::Withdrawer,
Some(&keys[2]),
);
let message = Message::new(&[instruction], None);
assert_eq!(
parse_stake(&message.instructions[0], &keys[0..5]).unwrap(),
ParsedInstructionEnum {
instruction_type: "authorizeChecked".to_string(),
info: json!({
"stakeAccount": keys[3].to_string(),
"clockSysvar": keys[4].to_string(),
"authority": keys[0].to_string(),
"newAuthority": keys[1].to_string(),
"authorityType": StakeAuthorize::Withdrawer,
"custodian": keys[2].to_string(),
}),
}
);
assert!(parse_stake(&message.instructions[0], &keys[0..4]).is_err());
let seed = "test_seed";
let instruction = instruction::authorize_checked_with_seed(
&keys[2],
&keys[0],
seed.to_string(),
&keys[0],
&keys[1],
StakeAuthorize::Staker,
None,
);
let message = Message::new(&[instruction], None);
assert_eq!(
parse_stake(&message.instructions[0], &keys[0..4]).unwrap(),
ParsedInstructionEnum {
instruction_type: "authorizeCheckedWithSeed".to_string(),
info: json!({
"stakeAccount": keys[2].to_string(),
"authorityOwner": keys[0].to_string(),
"newAuthorized": keys[1].to_string(),
"authorityBase": keys[0].to_string(),
"authoritySeed": seed,
"authorityType": StakeAuthorize::Staker,
"clockSysvar": keys[3].to_string(),
}),
}
);
assert!(parse_stake(&message.instructions[0], &keys[0..3]).is_err());
let instruction = instruction::authorize_checked_with_seed(
&keys[3],
&keys[0],
seed.to_string(),
&keys[0],
&keys[1],
StakeAuthorize::Withdrawer,
Some(&keys[2]),
);
let message = Message::new(&[instruction], None);
assert_eq!(
parse_stake(&message.instructions[0], &keys[0..5]).unwrap(),
ParsedInstructionEnum {
instruction_type: "authorizeCheckedWithSeed".to_string(),
info: json!({
"stakeAccount": keys[3].to_string(),
"authorityOwner": keys[0].to_string(),
"newAuthorized": keys[1].to_string(),
"authorityBase": keys[0].to_string(),
"authoritySeed": seed,
"authorityType": StakeAuthorize::Withdrawer,
"clockSysvar": keys[4].to_string(),
"custodian": keys[2].to_string(),
}),
}
);
assert!(parse_stake(&message.instructions[0], &keys[0..4]).is_err());
} | rust_cleaned_test_functions.jsonl/16470 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2830
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
1261,
726,
56456,
82427,
368,
341,
286,
1077,
5206,
6894,
25,
11312,
21604,
392,
792,
29,
284,
7486,
0,
15078,
286,
369,
716,
304,
220,
15,
496,
21,
341,
310,
6894,
2552,
5304,
392,
792... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_h1_head_binary2() {
let mut srv = TestServer::new(|| {
HttpService::build().h1(|_| ok::<_, ()>(Response::Ok().body(STR)))
});
let response = srv.block_on(srv.head("/").send()).unwrap();
assert!(response.status().is_success());
{
let len = response
.headers()
.get(http::header::CONTENT_LENGTH)
.unwrap();
assert_eq!(format!("{}", STR.len()), len.to_str().unwrap());
}
} | rust_cleaned_test_functions.jsonl/102554 | {
"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,
1523,
16,
13138,
31761,
17,
368,
341,
262,
1077,
5206,
43578,
284,
3393,
5475,
486,
931,
79453,
341,
286,
4823,
1860,
486,
5834,
1005,
71,
16,
22428,
35395,
5394,
27638,
6878,
1719,
2235,
2582,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_wmm_status_failed() {
let exec = fuchsia_async::TestExecutor::new().unwrap();
let (mut sme, mut mlme_stream, _time_stream) = create_sme(&exec);
let mut receiver = sme.wmm_status();
assert_variant!(mlme_stream.try_next(), Ok(Some(MlmeRequest::WmmStatusReq)));
sme.on_mlme_event(create_on_wmm_status_resp(zx::sys::ZX_ERR_IO));
assert_eq!(receiver.try_recv(), Ok(Some(Err(zx::sys::ZX_ERR_IO))));
} | rust_cleaned_test_functions.jsonl/33066 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 226
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1670,
3821,
4773,
35060,
368,
341,
286,
1077,
3883,
284,
282,
73391,
28346,
486,
2271,
25255,
486,
931,
1005,
15454,
543,
286,
1077,
320,
6984,
90467,
11,
5206,
15739,
2660,
12673,
11,
716,
1678,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_nth_value_return_type() -> Result<()> {
let fun = WindowFunction::from_str("nth_value")?;
let observed = return_type(&fun, &[DataType::Utf8, DataType::UInt64])?;
assert_eq!(DataType::Utf8, observed);
let observed = return_type(&fun, &[DataType::Float64, DataType::UInt64])?;
assert_eq!(DataType::Float64, observed);
Ok(())
} | rust_cleaned_test_functions.jsonl/119623 | {
"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,
78342,
3142,
12511,
1819,
368,
1464,
5714,
71698,
341,
286,
1077,
2464,
284,
13642,
5152,
486,
1499,
2895,
445,
51738,
3142,
899,
37445,
286,
1077,
13166,
284,
470,
1819,
2099,
11894,
11,
44590,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_zip_easy() {
let h1 = hlist![9000, "joe", 41f32];
let h2 = hlist!["joe", 9001, 42f32];
let zipped = h1.zip(h2);
assert_eq!(
zipped,
hlist![(9000, "joe"), ("joe", 9001), (41f32, 42f32),]
);
} | rust_cleaned_test_functions.jsonl/41579 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 175
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42131,
59091,
368,
341,
286,
1077,
305,
16,
284,
305,
1607,
20703,
24,
15,
15,
15,
11,
330,
73,
4644,
497,
220,
19,
16,
69,
18,
17,
935,
286,
1077,
305,
17,
284,
305,
1607,
0,
1183,
73,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_select_utxos_for_value_errors_if_insufficient_funds() {
let utxos = generate_utxos(10);
// fail.
match TransactionsManager::<ThickClient<HardcodedCredentialsProvider>, MockFogPubkeyResolver>::select_utxos_for_value(
Mob::ID, &utxos, 50, 100,
) {
Err(Error::InsufficientFunds) => {
// Expected.
}
_ => panic!("Did not get expected error"),
};
} | rust_cleaned_test_functions.jsonl/525 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 247
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13051,
60363,
87,
436,
5478,
3142,
20196,
11119,
34386,
26683,
761,
42950,
368,
341,
286,
1077,
8621,
87,
436,
284,
6923,
60363,
87,
436,
7,
16,
15,
317,
1789,
286,
442,
3690,
624,
286,
2432,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_var_and_long_string_are_equal_backwards() {
let text = r#" {% if "hello there!" == var %} true {% else %} false {% endif %} "#;
assert_template_result!(" true ", text, v!({"var": "hello there!"}));
} | rust_cleaned_test_functions.jsonl/28134 | {
"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,
4612,
8378,
17799,
3904,
56855,
11478,
3895,
4014,
368,
341,
262,
1077,
1467,
284,
435,
55543,
52261,
421,
330,
14990,
1052,
8958,
621,
762,
1018,
92,
830,
52261,
770,
1018,
92,
895,
52261,
12330,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create() {
let chain = Chain::new();
assert_eq!(
chain.block_count(),
1,
"Newly created blockchains should only contain the genesis block"
);
} | rust_cleaned_test_functions.jsonl/102215 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
368,
341,
286,
1077,
8781,
284,
28525,
486,
931,
543,
286,
2060,
10714,
33673,
310,
8781,
15697,
3180,
3148,
310,
220,
16,
345,
310,
330,
3564,
398,
3465,
2504,
58358,
1265,
1172,
6644,
27... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.