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_tokenize() {
assert_eq!(
tokenize("{{hello 'world'}}").unwrap(),
vec![Element::Expression(
vec![
Token::Identifier("hello".to_owned()),
Token::StringLiteral("world".to_owned()),
],
"{{hello 'world'}}".to_owned(),
)]
);
assert_eq!(
tokenize("{{hello.world}}").unwrap(),
vec![Element::Expression(
vec![Token::Identifier("hello.world".to_owned())],
"{{hello.world}}".to_owned(),
)]
);
assert_eq!(
tokenize("{{ hello 'world' }}").unwrap(),
vec![Element::Expression(
vec![
Token::Identifier("hello".to_owned()),
Token::StringLiteral("world".to_owned()),
],
"{{ hello 'world' }}".to_owned(),
)]
);
assert_eq!(
tokenize("{{ hello 'world' }}").unwrap(),
vec![Element::Expression(
vec![
Token::Identifier("hello".to_owned()),
Token::StringLiteral("world".to_owned()),
],
"{{ hello 'world' }}".to_owned(),
)]
);
assert_eq!(
tokenize("wat\n{{hello 'world'}} test").unwrap(),
vec![
Element::Raw("wat\n".to_owned()),
Element::Expression(
vec![
Token::Identifier("hello".to_owned()),
Token::StringLiteral("world".to_owned()),
],
"{{hello 'world'}}".to_owned(),
),
Element::Raw(" test".to_owned()),
]
);
assert_eq!(
tokenize("wat \n {{-hello 'world'-}} test").unwrap(),
vec![
Element::Raw("wat".to_owned()),
Element::Expression(
vec![
Token::Identifier("hello".to_owned()),
Token::StringLiteral("world".to_owned()),
],
" \n {{-hello 'world'-}} ".to_owned(),
),
Element::Raw("test".to_owned()),
]
);
} | rust_cleaned_test_functions.jsonl/65646 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1454
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
86508,
368,
341,
286,
2060,
10714,
33673,
310,
77651,
445,
2979,
14990,
364,
14615,
22892,
1827,
15454,
3148,
310,
7486,
20703,
1691,
486,
9595,
1006,
394,
7486,
90515,
503,
9660,
486,
8714,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eq_ord() {
run_test(|| {
let (val1, val2, val3) = unsafe {
let mut alloc = BumpAlloc::from_raw_parts(Key([0x0; 32]));
let mut val1: Value<i32> = Value::allocate_using(&mut alloc);
let mut val2: Value<i32> = Value::allocate_using(&mut alloc);
let mut val3: Value<i32> = Value::allocate_using(&mut alloc);
val1.initialize(42);
val2.initialize(42);
val3.initialize(1337);
(val1, val2, val3)
};
assert!(val1 == val2);
assert!(val2 != val3);
// Less-Than
assert!(!(val1 < val2));
assert!(val2 < val3);
assert!(val1 < val3);
// Less-Than or Eq
assert!(val1 <= val2);
assert!(val2 <= val3);
assert!(val1 <= val3);
})
} | rust_cleaned_test_functions.jsonl/2205 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 556
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10714,
67324,
368,
341,
286,
1598,
4452,
79453,
341,
310,
1077,
320,
831,
16,
11,
1044,
17,
11,
1044,
18,
8,
284,
19860,
341,
394,
1077,
5206,
5574,
284,
425,
1510,
25154,
486,
1499,
16067,
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... | 2 |
#[test]
fn test_invalid_addresses() {
let addresses = [
"0a", // Too few digits
"0a1b2c3d4e5f6", // Too many digits
"0a1b2c3d4e5g", // Invalid digit
"-0a-1b-2c-3d-4e-5f", // Leading hyphen
"0a-1b-2c-3d-4e-5f-", // Trailing hyphen
"0a-1b-2c-3d-4e5f", // Missing hyphen
":0a:1b:2c:3d:4e:5f", // Leading colon
"0a:1b:2c:3d:4e:5f:", // Trailing colon
"0a:1b:2c:3d:4e5f", // Missing colon
".0a1b.2c3d.4e5f", // Leading dot
"0a1b.2c3d.4e5f.", // Trailing dot
"0a1b.2c3d4e5f", // Missing dot
];
for element in addresses.into_iter() {
let digits = element.to_string();
MediaAccessControlAddress::new(&digits).unwrap();
}
} | rust_cleaned_test_functions.jsonl/9039 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 545
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
59471,
368,
341,
286,
1077,
14230,
284,
2278,
310,
330,
15,
64,
497,
338,
442,
24599,
2421,
18509,
198,
310,
330,
15,
64,
16,
65,
17,
66,
18,
67,
19,
68,
20,
69,
21,
497,
414,
442,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_two_funcs() {
let cxx = indoc! {"
void do_nothing1() {
}
void do_nothing2() {
}
"};
let hdr = indoc! {"
void do_nothing1();
void do_nothing2();
"};
let rs = quote! {
ffi::do_nothing1();
ffi::do_nothing2();
};
run_test(cxx, hdr, rs, &["do_nothing1", "do_nothing2"], &[]);
} | rust_cleaned_test_functions.jsonl/9718 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 213
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23241,
64124,
368,
341,
262,
1077,
272,
4146,
284,
1257,
509,
0,
314,
698,
286,
737,
653,
6536,
1596,
16,
368,
341,
286,
456,
286,
737,
653,
6536,
1596,
17,
368,
341,
286,
456,
262,
330,
244... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fill_struct_fields_new() {
check_fix(
r#"
struct TestWithNew(usize);
impl TestWithNew {
pub fn new() -> Self {
Self(0)
}
}
struct TestStruct { one: i32, two: TestWithNew }
fn test_fn() {
let s = TestStruct{ $0 };
}
"#,
r"
struct TestWithNew(usize);
impl TestWithNew {
pub fn new() -> Self {
Self(0)
}
}
struct TestStruct { one: i32, two: TestWithNew }
fn test_fn() {
let s = TestStruct{ one: 0, two: TestWithNew::new() };
}
",
);
} | rust_cleaned_test_functions.jsonl/127192 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 263
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30728,
15126,
12132,
5921,
368,
341,
286,
1779,
36060,
1006,
310,
435,
2,
698,
1235,
3393,
2354,
3564,
7,
51878,
317,
6383,
3393,
2354,
3564,
341,
262,
6675,
5168,
501,
368,
1464,
10115,
341,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_recaptcha() {
let givens = vec!["1212", "1221", "123425", "123123", "12131415"];
let expected = vec![6, 0, 4, 12, 4];
let actuals: Vec<u32> = givens.iter().map(|g| recaptcha(&g)).collect();
assert_eq!(expected, actuals);
} | rust_cleaned_test_functions.jsonl/94741 | {
"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,
7080,
25431,
368,
341,
286,
1077,
342,
344,
724,
284,
7486,
0,
1183,
16,
17,
16,
17,
497,
330,
16,
17,
17,
16,
497,
330,
16,
17,
18,
19,
17,
20,
497,
330,
16,
17,
18,
16,
17,
18,
497,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_publickey_smallorder() {
let torsion_point_with_threshold_1: [u8; 33] = [
1, 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, 0, 0, 0,
0, 0, 1,
];
let torsion_key = MultiEd25519PublicKey::try_from(&torsion_point_with_threshold_1[..]);
assert!(torsion_key.is_err());
assert_eq!(
torsion_key.err().unwrap(),
CryptoMaterialError::SmallSubgroupError
);
} | rust_cleaned_test_functions.jsonl/26225 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 249
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27074,
792,
31966,
1358,
368,
341,
9401,
262,
1077,
94460,
290,
6085,
6615,
21858,
62,
16,
25,
508,
84,
23,
26,
220,
18,
18,
60,
284,
2278,
286,
220,
16,
11,
220,
15,
11,
220,
15,
11,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cast_int_as_time() {
let should_pass = vec![
("0000-00-00 00:00:00", 0),
("2000-01-01 00:00:00", 101),
("2045-00-00 00:00:00", 450_000),
("2059-12-31 00:00:00", 591_231),
("1970-01-01 00:00:00", 700_101),
("1999-12-31 00:00:00", 991_231),
("1000-01-00 00:00:00", 10_000_100),
("2000-01-01 00:00:00", 101_000_000),
("2069-12-31 23:59:59", 691_231_235_959),
("1970-01-01 00:00:00", 700_101_000_000),
("1999-12-31 23:59:59", 991_231_235_959),
("0100-00-00 00:00:00", 1_000_000_000_000),
("1000-01-01 00:00:00", 10_000_101_000_000),
("1999-01-01 00:00:00", 19_990_101_000_000),
];
for (expected, input) in should_pass {
let actual: Time = RpnFnScalarEvaluator::new()
.push_param(input)
.return_field_type(FieldTypeBuilder::new().tp(FieldTypeTp::DateTime).build())
.evaluate(ScalarFuncSig::CastIntAsTime)
// `Result<Option<_>>`
.unwrap()
.unwrap();
assert_eq!(actual.to_string(), expected);
}
let should_fail = vec![
-11111,
1,
100,
700_100,
100_000_000,
100_000_101_000_000,
73,
];
for case in should_fail {
let actual = RpnFnScalarEvaluator::new()
.push_param(case)
.return_field_type(FieldTypeBuilder::new().tp(FieldTypeTp::Date).build())
.evaluate::<Time>(ScalarFuncSig::CastIntAsTime)
.unwrap();
assert!(actual.is_none());
}
} | rust_cleaned_test_functions.jsonl/1947 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1060
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5303,
4042,
11898,
3009,
368,
341,
286,
1077,
1265,
15464,
284,
7486,
90515,
310,
3489,
15,
15,
15,
15,
12,
15,
15,
12,
15,
15,
220,
15,
15,
25,
15,
15,
25,
15,
15,
497,
220,
15,
1326,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_parses_package_def() {
parses_to! {
parser: AwsGoEventsParser,
input: "package foo",
rule: Rule::package_def,
tokens: [
package_def(0, 11, [
ident(8, 11),
]),
]
};
} | rust_cleaned_test_functions.jsonl/8182 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 250
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77113,
288,
26328,
7844,
368,
341,
310,
70835,
2346,
0,
341,
394,
6729,
25,
40083,
10850,
7900,
6570,
345,
394,
1946,
25,
330,
1722,
15229,
756,
394,
5912,
25,
18100,
486,
1722,
7844,
345,
394,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_generic_trait_bounds() {
ok("trait Foo {}
class X
impl Foo for X {}
class A<T: Foo>
fun f() -> A<X> { return nil; }");
err(
"trait Foo {}
class X
class A<T: Foo>
fun f() -> A<X> { return nil; }",
pos(1, 1),
Msg::TraitBoundNotSatisfied("X".into(), "Foo".into()),
);
err(
"trait Foo {}
fun f<T: Foo>() {}
fun t() { f::<int>(); }",
pos(3, 23),
Msg::TraitBoundNotSatisfied("int".into(), "Foo".into()),
);
} | rust_cleaned_test_functions.jsonl/106637 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 398
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41232,
78491,
36878,
368,
341,
286,
5394,
445,
29432,
33428,
5613,
310,
536,
1599,
198,
310,
11605,
33428,
369,
1599,
5613,
310,
536,
362,
3125,
25,
33428,
397,
310,
2464,
282,
368,
1464,
362,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_argument_into_iter() {
assert_eq!(Vec::from_iter(arg!(Raw("value"))), ovec!["value"]);
assert_eq!(Vec::from_iter(arg!(UnknownFlag("-foo"))), ovec!["-foo"]);
assert_eq!(Vec::from_iter(arg!(Flag("-foo"))), ovec!["-foo"]);
let arg = arg!(WithValue("-foo", String("bar"), Concatenated));
assert_eq!(Vec::from_iter(arg), ovec!["-foobar"]);
let arg = arg!(WithValue("-foo", String("bar"), Concatenated('=')));
assert_eq!(Vec::from_iter(arg), ovec!["-foo=bar"]);
let arg = arg!(WithValue("-foo", String("bar"), CanBeSeparated));
assert_eq!(Vec::from_iter(arg), ovec!["-foobar"]);
let arg = arg!(WithValue("-foo", String("bar"), CanBeSeparated('=')));
assert_eq!(Vec::from_iter(arg), ovec!["-foo=bar"]);
let arg = arg!(WithValue("-foo", String("bar"), CanBeConcatenated));
assert_eq!(Vec::from_iter(arg), ovec!["-foo", "bar"]);
let arg = arg!(WithValue("-foo", String("bar"), CanBeConcatenated('=')));
assert_eq!(Vec::from_iter(arg), ovec!["-foo", "bar"]);
let arg = arg!(WithValue("-foo", String("bar"), Separated));
assert_eq!(Vec::from_iter(arg), ovec!["-foo", "bar"]);
} | rust_cleaned_test_functions.jsonl/108774 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 578
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9025,
45514,
11723,
368,
341,
286,
2060,
10714,
10297,
10050,
486,
1499,
11723,
9404,
10297,
20015,
445,
957,
2761,
701,
297,
4083,
0,
1183,
957,
15049,
286,
2060,
10714,
10297,
10050,
486,
1499,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_rights() -> Result<(), Error> {
assert_eq!(
parse_rights(&vec!["r*".to_owned()])?,
cm::Rights(vec![
cm::Right::Connect,
cm::Right::Enumerate,
cm::Right::Traverse,
cm::Right::ReadBytes,
cm::Right::GetAttributes,
])
);
assert_eq!(
parse_rights(&vec!["w*".to_owned()])?,
cm::Rights(vec![
cm::Right::Connect,
cm::Right::Enumerate,
cm::Right::Traverse,
cm::Right::WriteBytes,
cm::Right::ModifyDirectory,
cm::Right::UpdateAttributes,
])
);
assert_eq!(
parse_rights(&vec!["x*".to_owned()])?,
cm::Rights(vec![
cm::Right::Connect,
cm::Right::Enumerate,
cm::Right::Traverse,
cm::Right::Execute,
])
);
assert_eq!(
parse_rights(&vec!["rw*".to_owned()])?,
cm::Rights(vec![
cm::Right::Connect,
cm::Right::Enumerate,
cm::Right::Traverse,
cm::Right::ReadBytes,
cm::Right::WriteBytes,
cm::Right::ModifyDirectory,
cm::Right::GetAttributes,
cm::Right::UpdateAttributes,
])
);
assert_eq!(
parse_rights(&vec!["rx*".to_owned()])?,
cm::Rights(vec![
cm::Right::Connect,
cm::Right::Enumerate,
cm::Right::Traverse,
cm::Right::ReadBytes,
cm::Right::GetAttributes,
cm::Right::Execute,
])
);
assert_eq!(
parse_rights(&vec!["rw*".to_owned(), "execute".to_owned()])?,
cm::Rights(vec![
cm::Right::Connect,
cm::Right::Enumerate,
cm::Right::Traverse,
cm::Right::ReadBytes,
cm::Right::WriteBytes,
cm::Right::ModifyDirectory,
cm::Right::GetAttributes,
cm::Right::UpdateAttributes,
cm::Right::Execute,
])
);
assert_eq!(
parse_rights(&vec!["connect".to_owned()])?,
cm::Rights(vec![cm::Right::Connect])
);
assert_eq!(
parse_rights(&vec!["connect".to_owned(), "read_bytes".to_owned()])?,
cm::Rights(vec![cm::Right::Connect, cm::Right::ReadBytes])
);
assert_matches!(parse_rights(&vec![]), Err(cm::RightsValidationError::EmptyRight));
assert_matches!(
parse_rights(&vec!["connec".to_owned()]),
Err(cm::RightsValidationError::UnknownRight)
);
assert_matches!(
parse_rights(&vec!["connect".to_owned(), "connect".to_owned()]),
Err(cm::RightsValidationError::DuplicateRight)
);
assert_matches!(
parse_rights(&vec!["rw*".to_owned(), "connect".to_owned()]),
Err(cm::RightsValidationError::DuplicateRight)
);
Ok(())
} | rust_cleaned_test_functions.jsonl/16474 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1866
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
98053,
368,
1464,
5714,
68843,
4600,
29,
341,
286,
2060,
10714,
33673,
310,
4715,
98053,
2099,
4083,
0,
1183,
81,
9,
3263,
983,
51973,
368,
2467,
36474,
310,
9961,
486,
81875,
25592,
90515,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_move_iter_size_hint() {
let data = vec!(5i, 9);
let pq = BinaryHeap::from_vec(data);
let mut it = pq.into_iter();
assert_eq!(it.size_hint(), (2, Some(2)));
assert_eq!(it.next(), Some(9i));
assert_eq!(it.size_hint(), (1, Some(1)));
assert_eq!(it.next(), Some(5i));
assert_eq!(it.size_hint(), (0, Some(0)));
assert_eq!(it.next(), None);
} | rust_cleaned_test_functions.jsonl/1578 | {
"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,
17134,
11723,
2368,
45825,
368,
341,
286,
1077,
821,
284,
7486,
10297,
20,
72,
11,
220,
24,
317,
286,
1077,
39639,
284,
17718,
27909,
486,
1499,
13251,
2592,
626,
286,
1077,
5206,
432,
284,
3963... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_available_allocation_strategy() {
let strat = PoolingAllocationStrategy::NextAvailable;
assert_eq!(strat.next(10), 9);
assert_eq!(strat.next(5), 4);
assert_eq!(strat.next(1), 0);
} | rust_cleaned_test_functions.jsonl/48871 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11257,
26962,
81267,
49308,
368,
341,
286,
1077,
43297,
284,
22728,
287,
78316,
19816,
486,
5847,
16485,
280,
286,
2060,
10714,
10297,
495,
266,
4529,
7,
16,
15,
701,
220,
24,
317,
286,
2060,
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_second_above_current_second() {
let context = build_context(Moment(Paris.ymd(2017, 04, 25).and_hms(9, 10, 11)));
let day = Second(30);
let walker = day.to_walker(&context.reference, &context);
assert_eq!(Some(Interval::starting_at(Moment(Paris.ymd(2017, 04, 25).and_hms(9, 10, 30)),
Grain::Second)),
walker.forward.clone().next());
assert_eq!(Some(Interval::starting_at(Moment(Paris.ymd(2017, 04, 25).and_hms(9, 11, 30)),
Grain::Second)),
walker.forward.clone().skip(1).next());
assert_eq!(Some(Interval::starting_at(Moment(Paris.ymd(2017, 04, 25).and_hms(9, 9, 30)),
Grain::Second)),
walker.backward.clone().next());
assert_eq!(Some(Interval::starting_at(Moment(Paris.ymd(2017, 04, 25).and_hms(9, 8, 30)),
Grain::Second)),
walker.backward.clone().skip(1).next());
} | rust_cleaned_test_functions.jsonl/114676 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 619
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29644,
77315,
11080,
29644,
368,
341,
286,
1077,
2266,
284,
1936,
8467,
3189,
12913,
7,
59604,
13,
1600,
67,
7,
17,
15,
16,
22,
11,
220,
15,
19,
11,
220,
17,
20,
568,
437,
1523,
1011,
7,
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_parser_renderer_many_to_many_via_dml() {
let dml = datamodel::parse_datamodel(MANY_TO_MANY_DATAMODEL).unwrap();
let rendered = datamodel::render_datamodel_to_string(&dml).unwrap();
print!("{}", rendered);
assert_eq!(rendered, MANY_TO_MANY_DATAMODEL);
} | rust_cleaned_test_functions.jsonl/32021 | {
"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,
18517,
52345,
22101,
2346,
22101,
80710,
814,
1014,
368,
341,
262,
1077,
294,
1014,
284,
3258,
40259,
486,
6400,
15353,
40259,
3189,
17293,
8650,
97374,
36347,
1402,
2880,
43,
568,
15454,
543,
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_new_from_file_crafted_executable() {
let file = get_append_vec_path("test_new_from_crafted_executable");
let path = &file.path;
let mut av = AppendVec::new(path, true, 1024 * 1024);
av.set_no_remove_on_drop();
av.append_account_test(&create_test_account(10)).unwrap();
{
let mut executable_account = create_test_account(10);
executable_account.1.set_executable(true);
av.append_account_test(&executable_account).unwrap();
}
// reload accounts
let accounts = av.accounts(0);
// ensure false is 0u8 and true is 1u8 actually
assert_eq!(*accounts[0].ref_executable_byte(), 0);
assert_eq!(*accounts[1].ref_executable_byte(), 1);
let account = &accounts[0];
let crafted_executable = u8::max_value() - 1;
account.set_executable_as_byte(crafted_executable);
// reload crafted accounts
let accounts = av.accounts(0);
let account = accounts.first().unwrap();
// we can observe crafted value by ref
{
let executable_bool: &bool = &account.account_meta.executable;
assert!(!*executable_bool);
const FALSE: bool = false; // keep clippy happy
if *executable_bool == FALSE {
panic!("This didn't occur if this test passed.");
}
assert_eq!(*account.ref_executable_byte(), crafted_executable);
}
// we can NOT observe crafted value by value
{
let executable_bool: bool = account.account_meta.executable;
assert!(!executable_bool);
assert_eq!(account.get_executable_byte(), 0);
}
av.flush().unwrap();
let accounts_len = av.len();
drop(av);
let result = AppendVec::new_from_file(path, accounts_len);
assert_matches!(result, Err(ref message) if message.to_string() == *"incorrect layout/length/data");
} | rust_cleaned_test_functions.jsonl/5423 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 920
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
5673,
2458,
666,
60769,
18430,
5922,
368,
341,
286,
1077,
1034,
284,
633,
26041,
13251,
2638,
445,
1944,
5921,
5673,
666,
60769,
18430,
5922,
797,
286,
1077,
1815,
284,
609,
1192,
3875,
280,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_match_upper_case() {
assert!(new_match("iT", &make_choice("iTunes")).is_some());
assert!(new_match("it", &make_choice("iTunes")).is_some());
assert!(new_match("It", &make_choice("iTunes")).is_none());
} | rust_cleaned_test_functions.jsonl/107071 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 120
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10708,
34445,
19096,
368,
341,
286,
2060,
10297,
931,
10708,
445,
83589,
497,
609,
6927,
31936,
445,
83589,
8531,
15197,
285,
61855,
1423,
286,
2060,
10297,
931,
10708,
445,
275,
497,
609,
6927,
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_poly_mod_2() {
let res = create_error_correction_code(b" [\x0bx\xd1r\xdcMC@\xec\x11\xec", 13);
assert_eq!(&*res, b"\xa8H\x16R\xd96\x9c\x00.\x0f\xb4z\x10");
} | rust_cleaned_test_functions.jsonl/35834 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36133,
7480,
62,
17,
368,
341,
286,
1077,
592,
284,
1855,
4096,
82474,
4136,
1883,
1,
93815,
87,
15,
21861,
52512,
16,
81,
3462,
7628,
11604,
66339,
52350,
3462,
16,
16,
3462,
757,
497,
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... | 1 |
#[test]
fn test_incomplete_rectangles() {
#[rustfmt::skip]
let lines = &[
" +-+",
" |",
"+-+-+",
"| | -",
"+-+-+",
];
assert_eq!(1, count(lines))
} | rust_cleaned_test_functions.jsonl/40144 | {
"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,
1243,
14737,
16979,
17248,
368,
341,
262,
11506,
35788,
12501,
486,
20599,
921,
262,
1077,
5128,
284,
609,
9640,
286,
330,
220,
77545,
10,
756,
286,
330,
262,
760,
756,
286,
6630,
12,
21473,
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_withdraw_stake_invalid_state() {
let stake_pubkey = paychains_sdk::pubkey::new_rand();
let total_lamports = 100;
let stake_account = AccountSharedData::new_ref_data_with_space(
total_lamports,
&StakeState::RewardsPool,
std::mem::size_of::<StakeState>(),
&id(),
)
.expect("stake_account");
let to = paychains_sdk::pubkey::new_rand();
let to_account = AccountSharedData::new_ref(1, 0, &system_program::id());
let to_keyed_account = KeyedAccount::new(&to, false, &to_account);
let stake_keyed_account = KeyedAccount::new(&stake_pubkey, true, &stake_account);
assert_eq!(
stake_keyed_account.withdraw(
total_lamports,
&to_keyed_account,
&Clock::default(),
&StakeHistory::default(),
&stake_keyed_account,
None,
true,
),
Err(InstructionError::InvalidAccountData)
);
} | rust_cleaned_test_functions.jsonl/51776 | {
"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,
6615,
7633,
1261,
726,
31433,
4387,
368,
341,
286,
1077,
18279,
34014,
792,
284,
2291,
58358,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
2790,
907,
309,
3394,
284,
220,
16,
15,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reinit_output_stream_by_unplugging_a_nondefault_output_device() {
test_unplug_a_device_on_an_active_stream(StreamType::OUTPUT, Scope::Output, false, 500);
} | rust_cleaned_test_functions.jsonl/23862 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 77
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
2327,
7645,
12673,
3710,
4907,
500,
35268,
4306,
21637,
2258,
7645,
9204,
368,
341,
262,
1273,
4907,
47474,
4306,
9204,
4470,
12008,
12930,
12673,
52011,
929,
486,
30301,
11,
34920,
486,
5097,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_intersection() {
let a = BooleanBitfield::from_bytes(&[0b1100, 0b0001]);
let b = BooleanBitfield::from_bytes(&[0b1011, 0b1001]);
let c = BooleanBitfield::from_bytes(&[0b1000, 0b0001]);
assert_eq!(a.intersection(&b), c);
assert_eq!(b.intersection(&a), c);
assert_eq!(a.intersection(&c), c);
assert_eq!(b.intersection(&c), c);
assert_eq!(a.intersection(&a), a);
assert_eq!(b.intersection(&b), b);
assert_eq!(c.intersection(&c), c);
} | rust_cleaned_test_functions.jsonl/30484 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 262
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82558,
368,
341,
286,
1077,
264,
284,
6992,
8344,
2566,
486,
1499,
12524,
2099,
58,
15,
65,
16,
16,
15,
15,
11,
220,
15,
65,
15,
15,
15,
16,
2558,
286,
1077,
293,
284,
6992,
8344,
2566,
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_output_counts() {
let data = vec![
(1, Some("name:0"), 2),
(2, Some("name:4"), 3),
(4, Some("name:3"), 1),
(5, Some("name:1"), 4),
];
let product = ProductTable::new();
let (_, endpoint) = init_with_data(&product, &data);
let req = DAGSelect::from(&product.table).build();
let resp = handle_select(&endpoint, req);
assert_eq!(resp.get_output_counts(), [data.len() as i64]);
} | rust_cleaned_test_functions.jsonl/34874 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7645,
25977,
368,
341,
262,
1077,
821,
284,
7486,
90515,
286,
320,
16,
11,
4329,
445,
606,
25,
15,
3975,
220,
17,
1326,
286,
320,
17,
11,
4329,
445,
606,
25,
19,
3975,
220,
18,
1326,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_try_from_record_for_header_with_invalid_record() {
let record = Record::new(
record::Kind::Comment,
record::Value::String(String::from("noodles-sam")),
);
assert_eq!(
Header::try_from(record),
Err(TryFromRecordError::InvalidRecord)
);
} | rust_cleaned_test_functions.jsonl/14304 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 172
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
5673,
14192,
5478,
8757,
6615,
31433,
14192,
368,
341,
286,
1077,
3255,
284,
13583,
486,
931,
1006,
310,
3255,
486,
10629,
486,
10677,
345,
310,
3255,
486,
1130,
486,
703,
2242,
486,
1499,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_root_node() {
let mut tree = Tree::new();
// Should be none because no root key has been set yet
assert!(tree.root_node().is_none());
// Should be None still as the node does not exist in the map
unsafe { tree.set_root_key_unchecked("root") }
assert!(tree.root_node().is_none());
let root_node = Node::new("root", "A node.");
tree.nodes.insert("root".to_owned(), root_node);
assert!(tree.root_node().is_some());
} | rust_cleaned_test_functions.jsonl/110231 | {
"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,
12993,
5084,
368,
341,
262,
1077,
5206,
4916,
284,
8942,
486,
931,
1428,
262,
442,
12260,
387,
6857,
1576,
902,
3704,
1376,
702,
1012,
738,
3602,
198,
262,
2060,
10297,
9344,
12576,
5084,
1005,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_wrong_address_1() {
assert!(::run_server("tcpd:0.0.0.0:12345".into(), 1).is_err());
} | rust_cleaned_test_functions.jsonl/124671 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 58
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75198,
6744,
62,
16,
368,
341,
262,
2060,
10297,
486,
6108,
12015,
445,
27161,
67,
25,
15,
13,
15,
13,
15,
13,
15,
25,
16,
17,
18,
19,
20,
3263,
18122,
1507,
220,
16,
568,
285,
9266,
1423,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_tags() {
let template = DocumentTemplate::with_partials(&[
Partial::StringLiteral("<S1>".to_string()),
Partial::Tag("T1".to_string()),
Partial::StringLiteral("<S2>".to_string()),
Partial::Tag("T2".to_string()),
Partial::Tag("T1".to_string()),
Partial::Tag("T3".to_string()),
]);
let filled_document = template
.saturate(&[
TagPair {
key: "T1".to_string(),
value: "T1V".to_string(),
},
TagPair {
key: "T2".to_string(),
value: "T2V".to_string(),
},
TagPair {
key: "T3".to_string(),
value: "T3V".to_string(),
},
])
.unwrap();
let expected_string = "<S1>T1V<S2>T2VT1VT3V".to_string();
assert_eq!(expected_string, filled_document.document());
} | rust_cleaned_test_functions.jsonl/48655 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 622
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45233,
16333,
368,
341,
286,
1077,
3811,
284,
11789,
7275,
486,
4197,
10495,
10309,
2099,
9640,
310,
24552,
486,
703,
17350,
9639,
50,
16,
52946,
983,
3904,
14702,
310,
24552,
486,
5668,
445,
51,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_trailing_characters_streaming() {
assert_eq!(last_event("nulla"), Error(SyntaxError(TrailingCharacters, 1, 5)));
assert_eq!(last_event("truea"), Error(SyntaxError(TrailingCharacters, 1, 5)));
assert_eq!(last_event("falsea"), Error(SyntaxError(TrailingCharacters, 1, 6)));
assert_eq!(last_event("1a"), Error(SyntaxError(TrailingCharacters, 1, 2)));
assert_eq!(last_event("[]a"), Error(SyntaxError(TrailingCharacters, 1, 3)));
assert_eq!(last_event("{}a"), Error(SyntaxError(TrailingCharacters, 1, 3)));
} | rust_cleaned_test_functions.jsonl/6586 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3547,
14277,
79060,
12673,
287,
368,
341,
286,
2060,
10714,
10297,
4259,
6748,
445,
2921,
64,
3975,
220,
4600,
93549,
1454,
7,
1282,
14277,
37489,
11,
220,
16,
11,
220,
20,
4945,
286,
2060,
1071... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_barrett() {
let b = Barrett::new(7);
assert_eq!(b.umod(), 7);
assert_eq!(b.mul(2, 3), 6);
assert_eq!(b.mul(4, 6), 3);
assert_eq!(b.mul(5, 0), 0);
let b = Barrett::new(998244353);
assert_eq!(b.umod(), 998244353);
assert_eq!(b.mul(2, 3), 6);
assert_eq!(b.mul(3141592, 653589), 919583920);
assert_eq!(b.mul(323846264, 338327950), 568012980);
let b = Barrett::new(2147483647);
assert_eq!(b.umod(), 2147483647);
assert_eq!(b.mul(1073741824, 2147483645), 2147483646);
} | rust_cleaned_test_functions.jsonl/36586 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 426
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14388,
17261,
368,
341,
310,
1077,
293,
284,
55759,
486,
931,
7,
22,
317,
310,
2060,
10714,
10297,
65,
77251,
347,
1507,
220,
22,
317,
310,
2060,
10714,
10297,
65,
53141,
7,
17,
11,
220,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eval_fail_1() {
#[derive(Debug, Clone, Copy, RpnFunction)]
#[rpn_function(args = 1)]
struct FnFoo;
impl FnFoo {
fn call(
_ctx: &mut EvalContext,
_payload: RpnFnCallPayload<'_>,
_v: &Option<i64>,
) -> Result<Option<i64>> {
unreachable!()
}
}
let exp = RpnExpressionBuilder::new()
.push_fn_call(FnFoo, FieldTypeTp::LongLong)
.build();
let mut ctx = EvalContext::default();
let mut columns = LazyBatchColumnVec::empty();
let hooked_eval = ::panic_hook::recover_safe(|| {
let _ = exp.eval(&mut ctx, 3, &[], &mut columns);
});
assert!(hooked_eval.is_err());
} | rust_cleaned_test_functions.jsonl/111592 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 445
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21296,
22121,
62,
16,
368,
341,
286,
11506,
27098,
42618,
11,
27913,
11,
14540,
11,
431,
19958,
5152,
5563,
286,
11506,
81,
19958,
9174,
7356,
284,
220,
16,
5563,
286,
2036,
50182,
40923,
401,
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_stop_modify() {
let subcommand = Subcommand::Modify {
filter: Filter {
conditions: vec![Condition::IdList(vec![TaskId::WorkingSetId(123)])],
},
modification: Modification {
description: DescriptionMod::Set(s!("mod")),
active: Some(false),
..Default::default()
},
};
assert_eq!(
Subcommand::parse(argv!["123", "stop", "mod"]).unwrap(),
(&EMPTY[..], subcommand)
);
} | rust_cleaned_test_functions.jsonl/84282 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 299
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19039,
57725,
368,
341,
286,
1077,
1186,
5631,
284,
3719,
5631,
486,
44427,
341,
310,
4051,
25,
12339,
341,
394,
4682,
25,
7486,
20703,
10547,
486,
764,
852,
25592,
20703,
6262,
764,
486,
33978,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_message_activity() {
let value = MessageActivity {
kind: MessageActivityType::Join,
party_id: None,
};
serde_test::assert_tokens(
&value,
&[
Token::Struct {
name: "MessageActivity",
len: 1,
},
Token::Str("type"),
Token::U8(1),
Token::StructEnd,
],
);
} | rust_cleaned_test_functions.jsonl/21336 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 308
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6462,
30026,
368,
341,
286,
1077,
897,
284,
4856,
4052,
341,
310,
3093,
25,
4856,
4052,
929,
486,
12292,
345,
310,
4614,
842,
25,
2240,
345,
286,
3634,
286,
61570,
4452,
486,
2207,
28838,
1006,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_number_value() {
assert_eq!(
AMQPValue::try_from(&Value::Number(Number::from(42)), AMQPType::LongLongUInt),
Some(AMQPValue::LongLongInt(42))
);
assert_eq!(
AMQPValue::try_from(&Value::Number(Number::from(-42)), AMQPType::LongLongInt),
Some(AMQPValue::LongLongInt(-42))
);
assert_eq!(
AMQPValue::try_from(
&Value::Number(Number::from_f64(42.42).unwrap()),
AMQPType::Double
),
Some(AMQPValue::Double(42.42))
);
} | rust_cleaned_test_functions.jsonl/115691 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 340
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
5500,
3142,
368,
341,
286,
2060,
10714,
33673,
310,
6769,
66520,
1130,
486,
1539,
5673,
2099,
1130,
486,
2833,
42999,
486,
1499,
7,
19,
17,
5731,
6769,
66520,
929,
486,
6583,
6583,
18777,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reset_xdg_config_returns_to_old_values() {
let expected = xdg::get_config();
clear_xdg_config();
reset_xdg_config(&expected);
let result = xdg::get_config();
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/20955 | {
"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,
18983,
3212,
35138,
5332,
58900,
2346,
21108,
9146,
368,
341,
262,
1077,
3601,
284,
856,
35138,
486,
455,
5332,
543,
262,
2797,
3212,
35138,
5332,
543,
262,
7585,
3212,
35138,
5332,
2099,
7325,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_extended_get_version() {
let expected = vec![0, 3, 0, 0, 0, 0, 0];
let mut bb = ByteBuffer::new();
ExtendedEncoder::encode(&mut bb, CommandAPDU::new(U2fCommand::Version, 0, 0, vec![], Some(65536))).unwrap();
assert_eq!(bb.to_bytes(), expected);
} | rust_cleaned_test_functions.jsonl/124402 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
61678,
3062,
9438,
368,
341,
286,
1077,
3601,
284,
7486,
20703,
15,
11,
220,
18,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
935,
286,
1077,
5206,
16520,
284,
50299,
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_get_broker_pod_owner_kind_instance() {
let owner_references: Vec<OwnerReference> = vec![OwnerReference {
kind: "Instance".to_string(),
controller: Some(true),
..Default::default()
}];
assert_eq!(
get_broker_pod_owner_kind(&make_pod_with_owner_references(owner_references)),
BrokerPodOwnerKind::Instance
);
} | rust_cleaned_test_functions.jsonl/55235 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 205
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
880,
45985,
85337,
29027,
33162,
11904,
368,
341,
286,
1077,
6372,
92702,
25,
11312,
27,
13801,
8856,
29,
284,
7486,
20703,
13801,
8856,
341,
310,
3093,
25,
330,
2523,
3263,
983,
3904,
3148,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lda() {
let mut state = State8080::empty_state();
state.memory = vec![0x3a, 0x03, 0x00, 0x09];
state.a = 0x00;
state.set_program_counter(0);
emulate_8080_op(&mut state);
assert_eq!(state.a, 0x09);
assert_eq!(state.program_counter(), 0x03);
} | rust_cleaned_test_functions.jsonl/7770 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 170
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
50573,
64,
368,
341,
286,
1077,
5206,
1584,
284,
3234,
23,
15,
23,
15,
486,
3194,
4387,
543,
286,
1584,
36611,
284,
7486,
20703,
15,
87,
18,
64,
11,
220,
15,
87,
15,
18,
11,
220,
15,
87,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hex_string_conversion() {
let pk = PublicKey::from(G1::one() + G1::one());
let pk_string = pk.get_point_hex_string().unwrap();
assert_eq!(pk_string.0, "0x030644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd3");
assert_eq!(pk_string.1, "0x15ed738c0e0a7c92e7845f96b2ae9c0a68a6a449e3538fc7ff3ebf7a5a18a2c4");
} | rust_cleaned_test_functions.jsonl/767 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 214
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32655,
3904,
64132,
368,
341,
286,
1077,
22458,
284,
70280,
486,
1499,
6699,
16,
486,
603,
368,
488,
479,
16,
486,
603,
1423,
286,
1077,
22458,
3904,
284,
22458,
670,
6085,
32655,
3904,
1005,
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_invalid_enum_variant() {
let bytes = vec![123];
assert_eq!(
A::try_from_slice(&bytes).unwrap_err().to_string(),
"Unexpected variant index: 123"
);
} | rust_cleaned_test_functions.jsonl/103711 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
31054,
46112,
368,
341,
262,
1077,
5820,
284,
7486,
20703,
16,
17,
18,
935,
262,
2060,
10714,
33673,
286,
362,
486,
1539,
5673,
26488,
2099,
9651,
568,
15454,
9266,
1005,
983,
3904,
3148,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_put_with_format() -> Result<()> {
use crate::test_utility::*;
let temp_dir = tempdir::TempDir::new(&format!(
"temp_rand_index_{}",
uuid::Uuid::new_v4().to_string()
))?;
fn rand_post_with_format() -> Post {
let now = Utc::now();
let tags = rand_tags(3);
let matter = FrontMatter::new(
uuid::Uuid::new_v4(),
rand_japanase(TITLE_LENGTH),
rand_japanase(DESCRIPTION_LENGTH),
rand_japanase(TAG_CATEGORIES_LENGTH),
rand_lang(),
tags,
Some(DateTimeWithFormat::new(
now,
DateTimeFormat::Custom("YY/MM/DD".to_string()),
)),
Some(DateTimeWithFormat::new(
now,
DateTimeFormat::Custom("YY-MM-DD".to_string()),
)),
);
Post::new(rand_alpahbet(10), matter, rand_japanase(BODY_LENGHT))
}
let schema = build_schema();
let index = read_or_build_index(schema, temp_dir.path(), true)?;
let mut index_writer = index.writer(100_000_000)?;
fn test_put(post: &mut Post, index: &Index, index_writer: &mut IndexWriter) -> Result<()> {
let doc = put(&post, &index, index_writer, false)?;
assert!(doc.is_some());
let prev_post = Post::from_doc(&doc.unwrap(), &index.schema())?;
let body = post.body_mut();
*body = rand_japanase(BODY_LENGHT - 10);
let doc = put(&post, &index, index_writer, false)?;
assert!(doc.is_some());
let updated_post = Post::from_doc(&doc.unwrap(), &index.schema())?;
assert_ne!(prev_post.updated_at(), updated_post.updated_at());
assert_eq!(
prev_post.updated_at().unwrap().format(),
updated_post.updated_at().unwrap().format()
);
Ok(())
}
let mut post_with_format = rand_post_with_format();
test_put(&mut post_with_format, &index, &mut index_writer)?;
let mut post = rand_post();
test_put(&mut post, &index, &mut index_writer)?;
Ok(())
} | rust_cleaned_test_functions.jsonl/67720 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1218
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15557,
6615,
8955,
368,
1464,
5714,
71698,
341,
286,
990,
17717,
486,
1944,
18974,
487,
56162,
286,
1077,
2730,
4334,
284,
2730,
3741,
486,
12151,
6184,
486,
931,
2099,
2243,
33673,
310,
330,
3888... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bin_incorrect_file() {
let args = [
String::from("command"),
String::from("-w"),
String::from("query"),
String::from("../test-data/does-not-exist.txt"),
];
let config = parse_config(&args);
assert!(config.is_err());
} | rust_cleaned_test_functions.jsonl/19381 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 131
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21816,
1243,
19928,
2458,
368,
341,
262,
1077,
2827,
284,
2278,
286,
923,
486,
1499,
445,
5631,
4461,
286,
923,
486,
1499,
13645,
86,
4461,
286,
923,
486,
1499,
445,
1631,
4461,
286,
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,
1... | 1 |
#[test]
fn test_all_follow_proposer() {
let driver = fake::FakeDriver::default();
let mut gov = Governance::new(
fixture_for_following(),
driver.get_fake_env(),
driver.get_fake_ledger(),
);
// Add following for 5 and 6 for 1.
gov.manage_neuron(
// Must match neuron 5's serialized_id.
&principal(5),
&ManageNeuron {
id: None,
neuron_id_or_subaccount: Some(NeuronIdOrSubaccount::NeuronId(NeuronId { id: 5 })),
command: Some(manage_neuron::Command::Follow(manage_neuron::Follow {
topic: Topic::Unspecified as i32,
followees: [NeuronId { id: 1 }].to_vec(),
})),
},
)
.now_or_never()
.unwrap()
.expect("Manage neuron failed");
gov.manage_neuron(
// Must match neuron 6's serialized_id.
&principal(6),
&ManageNeuron {
id: None,
neuron_id_or_subaccount: Some(NeuronIdOrSubaccount::NeuronId(NeuronId { id: 6 })),
command: Some(manage_neuron::Command::Follow(manage_neuron::Follow {
topic: Topic::Unspecified as i32,
followees: [NeuronId { id: 1 }].to_vec(),
})),
},
)
.now_or_never()
.unwrap()
.expect("Manage neuron failed");
gov.make_proposal(
&NeuronId { id: 1 },
// Must match neuron 1's serialized_id.
&principal(1),
&Proposal {
summary: "test".to_string(),
action: Some(proposal::Action::Motion(Motion {
motion_text: "dummy text".to_string(),
})),
..Default::default()
},
)
.unwrap();
// The proposal should now be accepted and executed.
assert_eq!(
ProposalStatus::Executed,
gov.get_proposal_data(ProposalId { id: 1 })
.unwrap()
.status()
);
} | rust_cleaned_test_functions.jsonl/1121 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 969
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5705,
43490,
21663,
23438,
368,
341,
262,
1077,
5579,
284,
12418,
486,
52317,
11349,
486,
2258,
543,
262,
1077,
5206,
47625,
284,
80589,
486,
931,
1006,
286,
12507,
5478,
43490,
287,
3148,
286,
55... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_device_compatible_custom_migration() {
// Create an initial struct based on the first version.
let initial = test_device_compatible_migration::V1::default_value();
// Serialize.
let initial_serialized = initial.serialize_to();
// Deserialize using the second version.
let current =
test_device_compatible_migration::Current::deserialize_from(&initial_serialized);
// Assert values carried over from first version and defaults are used for rest.
assert_eq!(current.value, test_device_compatible_migration::DEFAULT_V1_VALUE);
assert_eq!(current.value_2, test_device_compatible_migration::DEFAULT_CURRENT_VALUE_2);
} | rust_cleaned_test_functions.jsonl/15094 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 266
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9204,
2965,
37079,
15875,
90373,
368,
341,
286,
442,
4230,
458,
2856,
2036,
3118,
389,
279,
1156,
2319,
624,
286,
1077,
2856,
284,
1273,
9204,
2965,
37079,
90373,
486,
53,
16,
486,
2258,
3142,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_walks_all_indexes() {
let sphere = Sphere::new(Vec3::new(10.0, 0.0, 0.0), 1.0);
let ray = Ray::new(Vec3::ZERO, Vec3::X);
let option = sphere.intersect(&ray);
assert_eq!(option, Some(Ray::new(Vec3::new(9.0, 0.0, 0.0), -Vec3::X)));
} | rust_cleaned_test_functions.jsonl/113591 | {
"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,
56131,
82,
5705,
50161,
368,
341,
286,
1077,
25366,
284,
54499,
486,
931,
49923,
18,
486,
931,
7,
16,
15,
13,
15,
11,
220,
15,
13,
15,
11,
220,
15,
13,
15,
701,
220,
16,
13,
15,
317,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_array_correct() {
let c: Result<Color, _> = [183, 65, 14].try_into();
assert!(c.is_ok());
assert_eq!(
c.unwrap(),
Color {
red: 183,
green: 65,
blue: 14
}
);
} | rust_cleaned_test_functions.jsonl/759 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 195
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
31550,
368,
341,
286,
1077,
272,
25,
5714,
88827,
11,
716,
29,
284,
508,
16,
23,
18,
11,
220,
21,
20,
11,
220,
16,
19,
936,
1539,
45514,
543,
286,
2060,
10297,
66,
2079,
19817,
1423,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_genesis_accounts() {
let mut genesis_config = GenesisConfig::default();
let issued_lamports = add_genesis_accounts(&mut genesis_config);
let lamports = genesis_config
.accounts
.iter()
.map(|(_, account)| account.lamports)
.sum::<u64>();
assert_eq!(issued_lamports, lamports);
} | rust_cleaned_test_functions.jsonl/59840 | {
"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,
2891,
16322,
13774,
55665,
368,
341,
286,
1077,
5206,
59366,
5332,
284,
40788,
2648,
486,
2258,
1428,
286,
1077,
10897,
907,
309,
3394,
284,
912,
16322,
13774,
55665,
2099,
6984,
59366,
5332,
626,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_arp_entry_expiration() {
// appropriate amount of time.
let mut ctx = DummyContext::default();
insert_dynamic(&mut ctx, (), TEST_REMOTE_IPV4, TEST_REMOTE_MAC);
// We should have the address in cache.
assert_eq!(
ctx.get_ref().arp_state.table.lookup(TEST_REMOTE_IPV4).unwrap(),
&TEST_REMOTE_MAC
);
// We should have an ARP entry expiration timer set.
validate_single_entry_timer(&ctx, DEFAULT_ARP_ENTRY_EXPIRATION_PERIOD, TEST_REMOTE_IPV4);
// Trigger the entry expiration timer.
assert!(ctx.trigger_next_timer());
// The right amount of time should have elapsed.
assert_eq!(ctx.now(), DummyInstant::from(DEFAULT_ARP_ENTRY_EXPIRATION_PERIOD));
// The entry should have been removed.
assert!(ctx.get_ref().arp_state.table.table.get(&TEST_REMOTE_IPV4).is_none());
// The timer should have been canceled.
assert_eq!(ctx.timers().len(), 0);
// The device layer should have been notified.
assert_eq!(ctx.get_ref().addr_resolution_expired, [TEST_REMOTE_IPV4]);
} | rust_cleaned_test_functions.jsonl/17006 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 506
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
7876,
9078,
2702,
28479,
368,
341,
1789,
286,
442,
8311,
3311,
315,
882,
382,
286,
1077,
5206,
5635,
284,
50567,
1972,
486,
2258,
1428,
286,
5656,
45992,
2099,
6984,
5635,
11,
38104,
13602,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_struct() {
#[derive(Serialize, Deserialize, PartialEq, Debug)]
struct S {
c: char,
n: i32,
b: bool,
m: u64,
s: String,
}
check(
S {
c: 'x',
n: -7,
b: true,
m: 17,
s: "hello".to_string(),
},
Some(34),
);
} | rust_cleaned_test_functions.jsonl/79683 | {
"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,
15126,
368,
341,
262,
11506,
27098,
3759,
9050,
11,
48440,
11,
55039,
11,
11091,
5563,
262,
2036,
328,
341,
286,
272,
25,
1161,
345,
286,
308,
25,
600,
18,
17,
345,
286,
293,
25,
1807,
345,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_workload_settings_deserialize() {
let data = Component::from_str(
r#"{
"workloadSettings": [
{
"name": "setting1",
"description": "a workload setting",
"type": "string",
"required": true,
"default": "things fall apart, the center cannot hold"
},
{
"name": "setting2",
"type": "boolean",
"fromParam": "param1"
}
]
}"#,
);
assert!(data.is_ok(), "Not okay: {}", data.unwrap_err());
let settings = data.unwrap().workload_settings;
assert_eq!(2, settings.len());
let s1 = settings.get(0).unwrap();
let s2 = settings.get(1).unwrap();
assert_eq!("setting1", s1.name);
assert_eq!(Some("a workload setting".into()), s1.description);
assert_eq!(ParameterType::String, s1.parameter_type);
assert!(s1.required);
assert_eq!(
Some("things fall apart, the center cannot hold".into()),
s1.default
);
assert_eq!("setting2", s2.name);
assert_eq!(None, s2.description);
assert_eq!(ParameterType::Boolean, s2.parameter_type);
assert!(!s2.required);
assert_eq!(None, s2.default);
assert_eq!(Some("param1".into()), s2.from_param);
} | rust_cleaned_test_functions.jsonl/98685 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 711
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11498,
1078,
10853,
15768,
9050,
368,
341,
262,
1077,
821,
284,
5578,
486,
1499,
2895,
1006,
286,
435,
55543,
515,
310,
330,
1778,
1078,
6086,
788,
2278,
394,
341,
503,
330,
606,
788,
330,
15320... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_check_zero_terminated_success() {
new_ucmd!()
.arg("-z")
.arg("-c")
.arg("zero-terminated.expected")
.succeeds();
} | rust_cleaned_test_functions.jsonl/20461 | {
"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,
7200,
19359,
62,
68659,
18632,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
858,
13645,
89,
1138,
286,
659,
858,
13645,
66,
1138,
286,
659,
858,
445,
14154,
12,
68659,
56835,
1138,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_order_by() {
let supported_orders = vec![
// test_order_alias_for_dimension_default
(
"SELECT taxful_total_price as total_price FROM KibanaSampleDataEcommerce ORDER BY total_price".to_string(),
V1LoadRequestQuery {
measures: Some(vec![]),
segments: Some(vec![]),
dimensions: Some(vec![
"KibanaSampleDataEcommerce.taxful_total_price".to_string(),
]),
time_dimensions: None,
order: Some(vec![vec![
"KibanaSampleDataEcommerce.taxful_total_price".to_string(),
"asc".to_string(),
]]),
limit: None,
offset: None,
filters: None
}
),
// test_order_indentifier_default
(
"SELECT taxful_total_price FROM KibanaSampleDataEcommerce ORDER BY taxful_total_price".to_string(),
V1LoadRequestQuery {
measures: Some(vec![]),
segments: Some(vec![]),
dimensions: Some(vec![
"KibanaSampleDataEcommerce.taxful_total_price".to_string(),
]),
time_dimensions: None,
order: Some(vec![vec![
"KibanaSampleDataEcommerce.taxful_total_price".to_string(),
"asc".to_string(),
]]),
limit: None,
offset: None,
filters: None
}
),
// test_order_compound_identifier_default
(
"SELECT taxful_total_price FROM `KibanaSampleDataEcommerce` ORDER BY `KibanaSampleDataEcommerce`.`taxful_total_price`".to_string(),
V1LoadRequestQuery {
measures: Some(vec![]),
segments: Some(vec![]),
dimensions: Some(vec![
"KibanaSampleDataEcommerce.taxful_total_price".to_string(),
]),
time_dimensions: None,
order: Some(vec![vec![
"KibanaSampleDataEcommerce.taxful_total_price".to_string(),
"asc".to_string(),
]]),
limit: None,
offset: None,
filters: None
}
),
// test_order_indentifier_asc
(
"SELECT taxful_total_price FROM KibanaSampleDataEcommerce ORDER BY taxful_total_price ASC".to_string(),
V1LoadRequestQuery {
measures: Some(vec![]),
segments: Some(vec![]),
dimensions: Some(vec![
"KibanaSampleDataEcommerce.taxful_total_price".to_string(),
]),
time_dimensions: None,
order: Some(vec![vec![
"KibanaSampleDataEcommerce.taxful_total_price".to_string(),
"asc".to_string(),
]]),
limit: None,
offset: None,
filters: None
}
),
// test_order_indentifier_desc
(
"SELECT taxful_total_price FROM KibanaSampleDataEcommerce ORDER BY taxful_total_price DESC".to_string(),
V1LoadRequestQuery {
measures: Some(vec![]),
segments: Some(vec![]),
dimensions: Some(vec![
"KibanaSampleDataEcommerce.taxful_total_price".to_string(),
]),
time_dimensions: None,
order: Some(vec![vec![
"KibanaSampleDataEcommerce.taxful_total_price".to_string(),
"desc".to_string(),
]]),
limit: None,
offset: None,
filters: None
}
),
// test_order_identifer_alias_ident_no_escape
(
"SELECT taxful_total_price as alias1 FROM KibanaSampleDataEcommerce ORDER BY alias1 DESC".to_string(),
V1LoadRequestQuery {
measures: Some(vec![]),
segments: Some(vec![]),
dimensions: Some(vec![
"KibanaSampleDataEcommerce.taxful_total_price".to_string(),
]),
time_dimensions: None,
order: Some(vec![vec![
"KibanaSampleDataEcommerce.taxful_total_price".to_string(),
"desc".to_string(),
]]),
limit: None,
offset: None,
filters: None
}
),
// test_order_identifer_alias_ident_escape
(
"SELECT taxful_total_price as `alias1` FROM KibanaSampleDataEcommerce ORDER BY `alias1` DESC".to_string(),
V1LoadRequestQuery {
measures: Some(vec![]),
segments: Some(vec![]),
dimensions: Some(vec![
"KibanaSampleDataEcommerce.taxful_total_price".to_string(),
]),
time_dimensions: None,
order: Some(vec![vec![
"KibanaSampleDataEcommerce.taxful_total_price".to_string(),
"desc".to_string(),
]]),
limit: None,
offset: None,
filters: None
}
),
];
for (sql, expected_request) in supported_orders.iter() {
let query_plan = convert_select_to_query_plan(sql.to_string(), DatabaseProtocol::MySQL);
assert_eq!(
&query_plan.as_logical_plan().find_cube_scan().request,
expected_request
)
}
} | rust_cleaned_test_functions.jsonl/59243 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3784
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7869,
3710,
368,
341,
286,
1077,
7248,
37129,
284,
7486,
90515,
310,
442,
1273,
7869,
35947,
5478,
49619,
9993,
198,
310,
2399,
394,
330,
4858,
3742,
1262,
10784,
9040,
438,
2790,
9040,
4295,
730,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_from_affine_nonuniform_scale() {
let matrix = Matrix3x3::from_affine_nonuniform_scale(7, 11);
let expected = Vector3::new(7, 11, 1);
let result = matrix * Vector3::new(1, 1, 1);
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/129039 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
48914,
482,
21637,
38351,
16727,
368,
341,
286,
1077,
6172,
284,
11631,
18,
87,
18,
486,
1499,
48914,
482,
21637,
38351,
16727,
7,
22,
11,
220,
16,
16,
317,
286,
1077,
3601,
284,
4196,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_wrap_nopad_24_byte_key_24_byte_data() {
let pt = hex!("00112233445566778899AABBCCDDEEFF0001020304050607").to_vec();
let key = hex!("000102030405060708090A0B0C0D0E0F1011121314151617").to_vec();
let ct = aes_wrap_with_nopadding(&pt, &key);
assert!(ct.is_ok(), "Test unexpectantly failed: {:?}", ct);
assert_eq!(
ct.unwrap(),
hex!("031D33264E15D33268F24EC260743EDCE1C6C7DDEE725A936BA814915C6762D2").to_vec()
);
} | rust_cleaned_test_functions.jsonl/15909 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 280
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38550,
1089,
453,
329,
62,
17,
19,
19737,
3097,
62,
17,
19,
19737,
1769,
368,
341,
286,
1077,
10817,
284,
12371,
17223,
15,
15,
16,
16,
17,
17,
18,
18,
19,
19,
20,
20,
21,
21,
22,
22,
23... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cdc_stale_epoch_after_region_ready() {
let mut suite = TestSuite::new(3);
let mut req = ChangeDataRequest::default();
req.region_id = 1;
req.set_region_epoch(suite.get_context(1).take_region_epoch());
let (req_tx, event_feed_wrap, receive_event) = new_event_feed(suite.get_region_cdc_client(1));
let _req_tx = req_tx.send((req, WriteFlags::default())).wait().unwrap();
// Make sure region 1 is registered.
let mut events = receive_event(false);
assert_eq!(events.len(), 1);
match events.pop().unwrap().event.unwrap() {
// it should always outputs an Initialized event.
Event_oneof_event::Entries(es) => {
assert!(es.entries.len() == 1, "{:?}", es);
let e = &es.entries[0];
assert_eq!(e.get_type(), EventLogType::Initialized, "{:?}", es);
}
_ => panic!("unknown event"),
}
let mut req = ChangeDataRequest::default();
req.region_id = 1;
req.set_region_epoch(Default::default()); // zero epoch is always stale.
let (req_tx, resp_rx) = suite.get_region_cdc_client(1).event_feed().unwrap();
let _resp_rx = event_feed_wrap.as_ref().replace(Some(resp_rx));
let req_tx = req_tx
.send((req.clone(), WriteFlags::default()))
.wait()
.unwrap();
// Must receive epoch not match error.
let mut events = receive_event(false);
assert_eq!(events.len(), 1);
match events.pop().unwrap().event.unwrap() {
Event_oneof_event::Error(err) => {
assert!(err.has_epoch_not_match(), "{:?}", err);
}
_ => panic!("unknown event"),
}
req.set_region_epoch(suite.get_context(1).take_region_epoch());
let _req_tx = req_tx.send((req, WriteFlags::default())).wait().unwrap();
// Must receive epoch not match error.
let mut events = receive_event(false);
assert_eq!(events.len(), 1);
match events.pop().unwrap().event.unwrap() {
// it should always outputs an Initialized event.
Event_oneof_event::Entries(es) => {
assert!(es.entries.len() == 1, "{:?}", es);
let e = &es.entries[0];
assert_eq!(e.get_type(), EventLogType::Initialized, "{:?}", es);
}
Event_oneof_event::Error(err) => {
assert!(err.has_epoch_not_match(), "{:?}", err);
}
_ => panic!("unknown event"),
}
// Cancel event feed before finishing test.
event_feed_wrap.as_ref().replace(None);
suite.stop();
} | rust_cleaned_test_functions.jsonl/23561 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
7628,
1261,
1574,
20682,
19844,
20627,
35456,
368,
341,
262,
1077,
5206,
16182,
284,
3393,
28000,
486,
931,
7,
18,
626,
262,
1077,
5206,
4232,
284,
10388,
1043,
1900,
486,
2258,
543,
262,
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... | 4 |
#[test]
fn test_lookup_connection_type() {
use super::geoip2::ConnectionType;
let _ = env_logger::try_init();
let filename = "test-data/test-data/GeoIP2-Connection-Type-Test.mmdb";
let reader = Reader::open_readfile(filename).unwrap();
let ip: IpAddr = FromStr::from_str("96.1.20.112").unwrap();
let connection_type: ConnectionType = reader.lookup(ip).unwrap();
assert_eq!(connection_type.connection_type, Some("Cable/DSL"));
} | rust_cleaned_test_functions.jsonl/42013 | {
"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,
27464,
15866,
1819,
368,
341,
262,
990,
2256,
486,
13052,
573,
17,
486,
4526,
929,
280,
262,
1077,
716,
284,
6105,
27413,
486,
1539,
6137,
1428,
262,
1077,
3899,
284,
330,
1944,
13945,
12697,
13... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_full_path() {
let te = TestEnv::new(DEFAULT_DIRS, DEFAULT_FILES);
let root = te.system_root();
let prefix = escape(&root.to_string_lossy());
te.assert_output(
&[
"--full-path",
&format!("^{prefix}.*three.*foo$", prefix = prefix),
],
"one/two/three/d.foo
one/two/three/directory_foo",
);
} | rust_cleaned_test_functions.jsonl/10861 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 194
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16372,
2638,
368,
341,
262,
1077,
1013,
284,
3393,
14359,
486,
931,
43175,
90560,
11,
11955,
48010,
626,
262,
1077,
3704,
284,
1013,
15936,
12993,
543,
262,
1077,
9252,
284,
12449,
2099,
2888,
238... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tera_manager() -> anyhow::Result<()> {
let mut env = HashMap::<String, String>::new();
env.insert(String::from("name"), String::from("WORLD"));
let result = TeraManager::new(env).apply("hello", "SELECT {{ name }} FROM DUAL;")?;
println!("Result: {}", &result);
assert_eq!("SELECT WORLD FROM DUAL;", result.as_str());
Ok(())
} | rust_cleaned_test_functions.jsonl/36979 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
50037,
12144,
368,
1464,
88964,
486,
2077,
71698,
341,
286,
1077,
5206,
6105,
284,
10528,
27638,
703,
11,
923,
6831,
931,
543,
286,
6105,
7030,
2242,
486,
1499,
445,
606,
3975,
923,
486,
149... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_set_root() {
use test_capnp::test_big_struct;
let mut message1 = message::Builder::new_default();
let mut message2 = message::Builder::new_default();
let mut struct1 = message1.init_root::<test_big_struct::Builder>();
struct1.set_uint8_field(3);
message2.set_root(struct1.into_reader()).unwrap();
let struct2 = message2.get_root::<test_big_struct::Builder>().unwrap();
assert_eq!(struct2.get_uint8_field(), 3u8);
} | rust_cleaned_test_functions.jsonl/55859 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 221
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
12993,
368,
341,
286,
990,
1273,
16388,
6199,
486,
1944,
36386,
15126,
401,
286,
1077,
5206,
1943,
16,
284,
1943,
486,
3297,
486,
931,
9993,
543,
286,
1077,
5206,
1943,
17,
284,
1943,
486,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_natural_error() {
let mut reader = Reader::init("");
let error = natural(&mut reader).err().unwrap();
assert_eq!(error.pos, Pos { line: 1, column: 1 });
assert_eq!(
error.inner,
ParseError::Expecting {
value: String::from("natural")
}
);
assert!(error.recoverable);
let mut reader = Reader::init("01");
let error = natural(&mut reader).err().unwrap();
assert_eq!(error.pos, Pos { line: 1, column: 2 });
assert_eq!(
error.inner,
ParseError::Expecting {
value: String::from("natural")
}
);
assert!(!error.recoverable);
let mut reader = Reader::init("x");
let error = natural(&mut reader).err().unwrap();
assert_eq!(error.pos, Pos { line: 1, column: 1 });
assert_eq!(
error.inner,
ParseError::Expecting {
value: String::from("natural")
}
);
assert!(error.recoverable);
} | rust_cleaned_test_functions.jsonl/119578 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 555
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1089,
4585,
4096,
368,
341,
286,
1077,
5206,
6604,
284,
25166,
486,
2327,
13056,
286,
1077,
1465,
284,
5810,
2099,
6984,
6604,
568,
615,
1005,
15454,
543,
286,
2060,
10714,
10297,
841,
13006,
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_first_invalid_value() {
let available_bytes = (core::mem::size_of::<usize>() - 1) as u32;
let first_invalid = 2usize.pow(available_bytes * 8) - 1;
#[cfg(target_pointer_width = "64")]
assert_eq!(first_invalid, 72057594037927935);
#[cfg(target_pointer_width = "32")]
assert_eq!(first_invalid, 16777215);
assert!(Capacity::new(first_invalid).is_err());
} | rust_cleaned_test_functions.jsonl/86252 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 209
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12978,
31433,
3142,
368,
341,
286,
1077,
2500,
12524,
284,
320,
2153,
486,
10536,
486,
2141,
3575,
27638,
51878,
13555,
481,
220,
16,
8,
438,
575,
18,
17,
280,
286,
1077,
1156,
31433,
284,
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_strip_whitespace_followed_by_another_tag() {
let text = "{value -}{value} Hello";
let instructions = compile(text).unwrap();
assert_eq!(3, instructions.len());
assert_eq!(&Value(vec![PathStep::Name("value")]), &instructions[0]);
assert_eq!(&Value(vec![PathStep::Name("value")]), &instructions[1]);
assert_eq!(&Literal(" Hello"), &instructions[2]);
} | rust_cleaned_test_functions.jsonl/18184 | {
"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,
66130,
86175,
43490,
291,
3710,
12008,
1575,
9372,
368,
972,
286,
1077,
1467,
284,
13868,
957,
481,
15170,
957,
92,
21927,
3534,
286,
1077,
11221,
284,
19192,
7235,
568,
15454,
1647,
286,
2060,
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_der_seq_dn_defined() {
let empty = &b""[..];
let bytes = [
0x30, 0x45, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x46, 0x52,
0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0c, 0x0a, 0x53, 0x6f, 0x6d, 0x65,
0x2d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0a,
0x0c, 0x18, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, 0x67,
0x69, 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, 0x20, 0x4c, 0x74, 0x64,
];
let expected = DerObject::from_seq(vec![
DerObject::from_set(vec![DerObject::from_seq(vec![
DerObject::from_obj(BerObjectContent::OID(Oid::from(&[2, 5, 4, 6]).unwrap())), // countryName
DerObject::from_obj(BerObjectContent::PrintableString("FR")),
])]),
DerObject::from_set(vec![DerObject::from_seq(vec![
DerObject::from_obj(BerObjectContent::OID(Oid::from(&[2, 5, 4, 8]).unwrap())), // stateOrProvinceName
DerObject::from_obj(BerObjectContent::UTF8String("Some-State")),
])]),
DerObject::from_set(vec![DerObject::from_seq(vec![
DerObject::from_obj(BerObjectContent::OID(Oid::from(&[2, 5, 4, 10]).unwrap())), // organizationName
DerObject::from_obj(BerObjectContent::UTF8String("Internet Widgits Pty Ltd")),
])]),
]);
#[inline]
fn parse_directory_string(i: &[u8]) -> DerResult {
alt((
parse_der_utf8string,
parse_der_printablestring,
parse_der_ia5string,
))(i)
}
#[inline]
fn parse_attr_type_and_value(i: &[u8]) -> DerResult {
parse_der_sequence_defined(
// to a list
map(tuple((parse_der_oid, parse_directory_string)), |(a, b)| {
vec![a, b]
}),
)(i)
}
#[inline]
fn parse_rdn(i: &[u8]) -> DerResult {
parse_der_set_of(parse_attr_type_and_value)(i)
}
#[inline]
fn parse_name(i: &[u8]) -> DerResult {
parse_der_sequence_of(parse_rdn)(i)
}
assert_eq!(parse_name(&bytes), Ok((empty, expected)));
} | rust_cleaned_test_functions.jsonl/45886 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1196
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35345,
14486,
69799,
52870,
368,
341,
262,
1077,
4287,
284,
609,
65,
3014,
95874,
935,
262,
1077,
5820,
284,
2278,
286,
220,
15,
87,
18,
15,
11,
220,
15,
87,
19,
20,
11,
220,
15,
87,
18,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_update_hook() {
let db = Connection::open_in_memory().unwrap();
lazy_static! {
static ref CALLED: AtomicBool = AtomicBool::new(false);
}
db.update_hook(Some(|action, db: &str, tbl: &str, row_id| {
assert_eq!(Action::SQLITE_INSERT, action);
assert_eq!("main", db);
assert_eq!("foo", tbl);
assert_eq!(1, row_id);
CALLED.store(true, Ordering::Relaxed);
}));
db.execute_batch("CREATE TABLE foo (t TEXT)").unwrap();
db.execute_batch("INSERT INTO foo VALUES ('lisa')").unwrap();
assert!(CALLED.load(Ordering::Relaxed));
} | rust_cleaned_test_functions.jsonl/43031 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 339
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
32005,
368,
341,
286,
1077,
2927,
284,
11032,
486,
2508,
1243,
19195,
1005,
15454,
1428,
286,
15678,
25360,
0,
341,
310,
1099,
2053,
32907,
13639,
25,
30316,
11233,
284,
30316,
11233,
486,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_valid_redshift_reboot_cluster() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/valid",
"redshift-reboot-cluster.xml",
);
let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
let client = RedshiftClient::new(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = RebootClusterMessage::default();
let result = client.reboot_cluster(request).sync();
assert!(result.is_ok(), "parse error: {:?}", result);
} | rust_cleaned_test_functions.jsonl/12123 | {
"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,
21039,
8337,
26058,
13418,
1288,
4619,
28441,
368,
341,
286,
1077,
7860,
9655,
284,
14563,
2582,
5062,
486,
878,
9655,
1006,
310,
330,
1944,
35569,
79372,
14,
1891,
756,
310,
330,
1151,
13418,
550... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_dlab() {
let mut serial = Serial::new_sink(EventFd::new(libc::EFD_NONBLOCK).unwrap());
serial.write(u64::from(LCR), &[LCR_DLAB_BIT as u8]);
serial.write(u64::from(DLAB_LOW), &[0x12 as u8]);
serial.write(u64::from(DLAB_HIGH), &[0x34 as u8]);
let mut data = [0u8];
serial.read(u64::from(LCR), &mut data[..]);
assert_eq!(data[0], LCR_DLAB_BIT as u8);
serial.read(u64::from(DLAB_LOW), &mut data[..]);
assert_eq!(data[0], 0x12);
serial.read(u64::from(DLAB_HIGH), &mut data[..]);
assert_eq!(data[0], 0x34);
} | rust_cleaned_test_functions.jsonl/37136 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 332
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25602,
814,
14380,
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_unsupported_version() {
let tx = TxSimple::new_with_signature(&PublicKey::zero(), "My little pony", &Signature::zero());
let mut vec = tx.as_ref().as_ref().to_vec();
vec[1] = 128;
let _msg = TxSimple::from_raw(RawMessage::from_vec(vec)).unwrap();
} | rust_cleaned_test_functions.jsonl/90746 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
18216,
9438,
368,
341,
262,
1077,
9854,
284,
39850,
16374,
486,
931,
6615,
39859,
2099,
61822,
486,
14154,
1507,
330,
5050,
2632,
52636,
497,
609,
25088,
486,
14154,
1423,
262,
1077,
5206,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fold() {
let sc = CONTEXT.clone();
let rdd = sc.make_rdd((-1000..1000).collect::<Vec<_>>(), 10);
let f = Fn!(|c, x| c + x);
let sum = rdd.fold(0, f).unwrap();
assert_eq!(sum, -1000)
} | rust_cleaned_test_functions.jsonl/27938 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 119
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
61187,
368,
341,
262,
1077,
1136,
284,
87336,
15997,
543,
262,
1077,
435,
631,
284,
1136,
10117,
1710,
631,
54934,
16,
15,
15,
15,
496,
16,
15,
15,
15,
568,
17384,
27638,
10050,
32399,
2452,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find() {
let mut m = TypedHandleMap::new();
let mut v = alloc::vec![];
for i in 0..10usize {
v.push(m.insert(i));
}
for (i, h) in v.iter().enumerate() {
assert_eq!(m.find_handle(&i), Some(*h));
assert!(m.contains_key(*h));
}
m.clear();
assert!(m.is_empty());
for (i, h) in v.iter().enumerate() {
assert_eq!(m.find_handle(&i), None);
assert!(!m.contains_key(*h));
}
} | rust_cleaned_test_functions.jsonl/15927 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 307
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
368,
341,
286,
1077,
5206,
296,
284,
50554,
6999,
2227,
486,
931,
543,
286,
1077,
5206,
348,
284,
5574,
486,
4083,
0,
15078,
286,
369,
600,
304,
220,
15,
496,
16,
15,
51878,
341,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_read_fare_attributes() {
let iter: GTFSIterator<_, FareAttribute> =
GTFSIterator::from_path("./examples/good_feed/fare_attributes.txt").unwrap();
for result in iter {
assert!(result.is_ok(), format!("{}", result.err().unwrap()));
}
} | rust_cleaned_test_functions.jsonl/7507 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 121
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
761,
546,
18240,
368,
341,
262,
1077,
5367,
25,
11911,
8485,
11951,
27,
6878,
66471,
3907,
29,
4035,
286,
11911,
8485,
11951,
486,
1499,
2638,
13988,
51668,
4846,
1386,
42390,
6663,
546,
182... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_request_message_side_effects_2() {
let canister_id = canister_test_id(42);
let mut system_state = SystemStateBuilder::default()
.canister_id(canister_id)
.build();
system_state.freeze_threshold = NumSeconds::from(0);
inject_request(&mut system_state);
test_outgoing_messages(
system_state,
CALL_SIMPLE_AND_REPLY_WAT,
|mut execute_message_result| {
assert_eq!(
execute_message_result
.canister
.system_state
.queues()
.output_queues_len(),
2
);
assert_eq!(
execute_message_result
.canister
.system_state
.queues()
.output_message_count(),
2
);
assert_correct_request(&mut execute_message_result.canister.system_state);
let dst = canister_test_id(55);
let (_, message) = execute_message_result
.canister
.system_state
.queues_mut()
.pop_canister_output(&dst)
.unwrap();
if let RequestOrResponse::Response(msg) = message {
assert_eq!(msg.originator, dst);
assert_eq!(msg.respondent, canister_id);
assert_eq!(msg.response_payload, Payload::Data(b"MONOLORD".to_vec()));
} else {
panic!("unexpected message popped: {:?}", message);
}
},
);
} | rust_cleaned_test_functions.jsonl/17019 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 910
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7893,
6462,
30862,
83171,
62,
17,
368,
341,
262,
1077,
646,
1571,
842,
284,
646,
1571,
4452,
842,
7,
19,
17,
317,
262,
1077,
5206,
1849,
4387,
284,
739,
1397,
3297,
486,
2258,
741,
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... | 2 |
#[test]
fn test_gives_error_for_unexpected_key() {
let query = parse(&serde_json::from_str("
{
\"query\": {
\"term\": {
\"the\": \"query\"
}
},
\"filter\": {
\"term\": {
\"the\": \"filter\"
}
},
\"foo\": \"bar\"
}
").unwrap());
assert_eq!(query.err(), Some(QueryParseError::UnrecognisedKey("foo".to_string())));
} | rust_cleaned_test_functions.jsonl/121950 | {
"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,
1889,
1886,
4096,
5478,
4907,
7325,
3097,
368,
341,
286,
1077,
3239,
284,
4715,
2099,
47024,
9455,
486,
1499,
2895,
70576,
286,
341,
310,
7245,
1631,
11693,
341,
394,
7245,
4991,
11693,
341,
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... | 1 |
#[test]
fn test_minus_int() {
let test_cases = vec![
(None, false, Some(1), false, None, false),
(Some(1), false, None, false, None, false),
(Some(12), false, Some(1), false, Some(11), false),
(
Some(0),
true,
Some(i64::MIN),
false,
Some((i64::MAX as u64 + 1) as i64),
false,
),
(Some(i64::MIN), false, Some(i64::MAX), false, None, true),
(Some(i64::MAX), false, Some(i64::MIN), false, None, true),
(Some(-1), false, Some(2), true, None, true),
(Some(1), true, Some(2), false, None, true),
];
for (lhs, lhs_is_unsigned, rhs, rhs_is_unsigned, expected, is_err) in test_cases {
let lhs_field_type = FieldTypeBuilder::new()
.tp(FieldTypeTp::LongLong)
.flag(if lhs_is_unsigned {
FieldTypeFlag::UNSIGNED
} else {
FieldTypeFlag::empty()
})
.build();
let rhs_field_type = FieldTypeBuilder::new()
.tp(FieldTypeTp::LongLong)
.flag(if rhs_is_unsigned {
FieldTypeFlag::UNSIGNED
} else {
FieldTypeFlag::empty()
})
.build();
let output = RpnFnScalarEvaluator::new()
.push_param_with_field_type(lhs, lhs_field_type)
.push_param_with_field_type(rhs, rhs_field_type)
.evaluate(ScalarFuncSig::MinusInt);
if is_err {
assert!(output.is_err())
} else {
let output = output.unwrap();
assert_eq!(output, expected, "lhs={:?}, rhs={:?}", lhs, rhs);
}
}
} | rust_cleaned_test_functions.jsonl/78963 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38457,
4042,
368,
341,
286,
1077,
1273,
41427,
284,
7486,
90515,
310,
320,
4064,
11,
895,
11,
4329,
7,
16,
701,
895,
11,
2240,
11,
895,
1326,
310,
320,
8373,
7,
16,
701,
895,
11,
2240,
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... | 5 |
#[test]
fn test_part_b() {
let graph = read_input(InputType::Sample, true);
assert_eq!(50 * 50, graph.nodes.len());
assert_eq!(315, part_a(&graph, false));
} | rust_cleaned_test_functions.jsonl/99616 | {
"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,
10495,
880,
368,
341,
286,
1077,
4771,
284,
1349,
5898,
29773,
929,
486,
17571,
11,
830,
317,
286,
2060,
10714,
10297,
20,
15,
353,
220,
20,
15,
11,
4771,
21697,
19406,
5231,
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_api_withdraw_handler_failure() {
let denom: Denomination = Denomination::from_str("TEST").unwrap();
let mut mock = mock::Mock::default();
let mut ctx = mock.create_ctx();
let mut meta = Metadata {
..Default::default()
};
Accounts::init_or_migrate(
&mut ctx,
&mut meta,
AccountsGenesis {
balances: {
let mut balances = BTreeMap::new();
// Alice.
balances.insert(keys::alice::address(), {
let mut denominations = BTreeMap::new();
denominations.insert(denom.clone(), 1_000_000);
denominations
});
balances
},
total_supplies: {
let mut total_supplies = BTreeMap::new();
total_supplies.insert(denom.clone(), 1_000_000);
total_supplies
},
..Default::default()
},
);
Module::<Accounts, Consensus>::init_or_migrate(&mut ctx, &mut meta, Default::default());
let nonce = 123;
let tx = transaction::Transaction {
version: 1,
call: transaction::Call {
format: transaction::CallFormat::Plain,
method: "consensus.Withdraw".to_owned(),
body: cbor::to_value(Withdraw {
// separate `to` account to make sure everything is hooked up to the right places.
to: keys::bob::address().into(),
amount: BaseUnits::new(1_000_000, denom.clone()),
}),
},
auth_info: transaction::AuthInfo {
signer_info: vec![transaction::SignerInfo::new_sigspec(
keys::alice::sigspec(),
nonce,
)],
fee: transaction::Fee {
amount: Default::default(),
gas: 1000,
consensus_messages: 1,
},
},
};
let hook = ctx.with_tx(0, tx, |mut tx_ctx, call| {
Module::<Accounts, Consensus>::tx_withdraw(
&mut tx_ctx,
cbor::from_value(call.body).unwrap(),
)
.expect("withdraw tx should succeed");
let (_, mut msgs) = tx_ctx.commit();
assert_eq!(1, msgs.len(), "one message should be emitted");
let (msg, hook) = msgs.pop().unwrap();
assert_eq!(
Message::Staking(Versioned::new(
0,
StakingMessage::Transfer(staking::Transfer {
to: keys::bob::address().into(),
amount: 1_000_000u128.into(),
})
)),
msg,
"emitted message should match"
);
assert_eq!(
CONSENSUS_TRANSFER_HANDLER.to_string(),
hook.hook_name,
"emitted hook should match"
);
hook
});
// Make sure that withdrawn balance is in the module's pending withdrawal account.
let balance =
Accounts::get_balance(ctx.runtime_state(), keys::alice::address(), denom.clone()).unwrap();
assert_eq!(balance, 0u128, "withdrawn balance should be locked");
let balance = Accounts::get_balance(
ctx.runtime_state(),
*ADDRESS_PENDING_WITHDRAWAL,
denom.clone(),
)
.unwrap();
assert_eq!(balance, 1_000_000u128, "withdrawn balance should be locked");
// Simulate the message failing and make sure withdrawal amount is refunded.
let me = MessageEvent {
module: "staking".to_string(),
code: 1, // Any non-zero code is treated as an error.
index: 0,
};
Module::<Accounts, Consensus>::message_result_transfer(
&mut ctx,
me,
cbor::from_value(hook.payload).unwrap(),
);
// Ensure amount is refunded.
let balance = Accounts::get_balance(
ctx.runtime_state(),
*ADDRESS_PENDING_WITHDRAWAL,
denom.clone(),
)
.unwrap();
assert_eq!(balance, 0u128, "withdrawn balance should be refunded");
let balance =
Accounts::get_balance(ctx.runtime_state(), keys::alice::address(), denom.clone()).unwrap();
assert_eq!(
balance, 1_000_000u128,
"withdrawn balance should be refunded"
);
let total_supplies = Accounts::get_total_supplies(ctx.runtime_state()).unwrap();
assert_eq!(total_supplies.len(), 1);
assert_eq!(
total_supplies[&denom], 1_000_000u128,
"withdrawn balance should be refunded"
);
// Make sure events were emitted.
let (etags, _) = ctx.commit();
let tags = etags.into_tags();
assert_eq!(
tags.len(),
2,
"withdraw and transfer events should be emitted"
);
assert_eq!(tags[0].key, b"accounts\x00\x00\x00\x01");
assert_eq!(tags[1].key, b"consensus_accounts\x00\x00\x00\x02");
// Decode withdraw event.
#[derive(Debug, cbor::Decode)]
struct WithdrawEvent {
from: Address,
nonce: u64,
to: Address,
amount: token::BaseUnits,
#[cbor(optional)]
error: Option<types::ConsensusError>,
}
let mut events: Vec<WithdrawEvent> = cbor::from_slice(&tags[1].value).unwrap();
assert_eq!(events.len(), 1);
let event = events.pop().unwrap();
assert_eq!(event.from, keys::alice::address());
assert_eq!(event.nonce, nonce);
assert_eq!(event.to, keys::bob::address());
assert_eq!(event.amount.amount(), 1_000_000);
assert_eq!(event.amount.denomination(), &denom);
assert_eq!(
event.error,
Some(types::ConsensusError {
module: "staking".to_string(),
code: 1,
})
);
} | rust_cleaned_test_functions.jsonl/52601 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2735
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11697,
6615,
7633,
10183,
43618,
368,
341,
262,
1077,
49744,
25,
9774,
80380,
284,
9774,
80380,
486,
1499,
2895,
445,
10033,
1827,
15454,
543,
262,
1077,
5206,
7860,
284,
7860,
486,
11571,
486,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_assign_neg_overflow() {
let mut x = Decimal::new_raw(i128::MIN + 99, 2);
x += Decimal::NEG_ONE;
} | rust_cleaned_test_functions.jsonl/29269 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 76
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
20688,
28209,
79073,
368,
341,
286,
1077,
5206,
856,
284,
26728,
486,
931,
16067,
1956,
16,
17,
23,
486,
16413,
488,
220,
24,
24,
11,
220,
17,
317,
286,
856,
1421,
26728,
486,
97127,
347... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_letter_digit() {
let lexer = Lexer::new("main12");
let actual: Vec<TokType> = lexer.map(|t| t.0).collect();
let expected = vec![
TokType::Iden("main12".to_string()),
];
assert_eq!(actual, expected)
} | rust_cleaned_test_functions.jsonl/24695 | {
"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,
46117,
48403,
368,
341,
286,
1077,
53259,
284,
85082,
486,
931,
445,
3817,
16,
17,
797,
286,
1077,
5042,
25,
11312,
3125,
562,
929,
29,
284,
53259,
4770,
22428,
83,
91,
259,
13,
15,
568,
17384... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_numbers() {
let v: f64 = super::decode("3").unwrap();
assert_eq!(v, 3.0);
let v: f64 = super::decode("3.1").unwrap();
assert_eq!(v, 3.1);
let v: f64 = super::decode("-1.2").unwrap();
assert_eq!(v, -1.2);
let v: f64 = super::decode("0.4").unwrap();
assert_eq!(v, 0.4);
let v: f64 = super::decode("0.4e5").unwrap();
assert_eq!(v, 0.4e5);
let v: f64 = super::decode("0.4e15").unwrap();
assert_eq!(v, 0.4e15);
let v: f64 = super::decode("0.4e-01").unwrap();
assert_eq!(v, 0.4e-01);
let v: u64 = super::decode("0").unwrap();
assert_eq!(v, 0);
let v: u64 = super::decode("18446744073709551615").unwrap();
assert_eq!(v, u64::MAX);
let v: i64 = super::decode("-9223372036854775808").unwrap();
assert_eq!(v, i64::MIN);
let v: i64 = super::decode("9223372036854775807").unwrap();
assert_eq!(v, i64::MAX);
let res: DecodeResult<i64> = super::decode("765.25252");
assert_eq!(res, Err(ExpectedError("Integer".to_string(), "765.25252".to_string())));
} | rust_cleaned_test_functions.jsonl/41697 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 621
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
32964,
368,
341,
286,
1077,
348,
25,
282,
21,
19,
284,
2256,
486,
18196,
445,
18,
1827,
15454,
543,
286,
2060,
10714,
10297,
85,
11,
220,
18,
13,
15,
626,
286,
1077,
348,
25,
282,
21,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_matrix()
{
let z = crate::cmatrix::COMPLEX_ZERO;
let s = crate::cmatrix::COMPLEX_HSQRT2;
let h = 0.5 * crate::cmatrix::COMPLEX_ONE;
let ih = Kron::new(I::new(), H::new());
assert_complex_matrix_eq!(ih.matrix(), array![
[s, s, z, z],
[s, -s, z, z],
[z, z, s, s],
[z, z, s, -s]
]);
let hh = Kron::new(H::new(), H::new());
assert_complex_matrix_eq!(hh.matrix(), array![
[h, h, h, h],
[h, -h, h, -h],
[h, h, -h, -h],
[h, -h, -h, h]
]);
let hih = Kron::new(H::new(), Kron::new(I::new(), H::new()));
assert_complex_matrix_eq!(hih.matrix(), array![
[h, h, z, z, h, h, z, z],
[h, -h, z, z, h, -h, z, z],
[z, z, h, h, z, z, h, h],
[z, z, h, -h, z, z, h, -h],
[h, h, z, z, -h, -h, z, z],
[h, -h, z, z, -h, h, z, z],
[z, z, h, h, z, z, -h, -h],
[z, z, h, -h, z, z, -h, h]
]);
} | rust_cleaned_test_functions.jsonl/34666 | {
"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,
10193,
741,
262,
341,
286,
1077,
1147,
284,
17717,
486,
6226,
2555,
486,
8696,
42136,
39370,
280,
286,
1077,
274,
284,
17717,
486,
6226,
2555,
486,
8696,
42136,
2039,
64308,
5350,
17,
280,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_integer128() {
let signed = &[i128::min_value(), -1, 0, 1, i128::max_value()];
let unsigned = &[0, 1, u128::max_value()];
for integer128 in signed {
let expected = integer128.to_string();
assert_eq!(to_string(integer128).unwrap(), expected);
assert_eq!(from_str::<i128>(&expected).unwrap(), *integer128);
}
for integer128 in unsigned {
let expected = integer128.to_string();
assert_eq!(to_string(integer128).unwrap(), expected);
assert_eq!(from_str::<u128>(&expected).unwrap(), *integer128);
}
test_parse_err::<i128>(&[
(
"-170141183460469231731687303715884105729",
"number out of range at line 1 column 40",
),
(
"170141183460469231731687303715884105728",
"number out of range at line 1 column 39",
),
]);
test_parse_err::<u128>(&[
("-1", "number out of range at line 1 column 1"),
(
"340282366920938463463374607431768211456",
"number out of range at line 1 column 39",
),
]);
} | rust_cleaned_test_functions.jsonl/29870 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 532
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31725,
16,
17,
23,
368,
341,
262,
1077,
8499,
284,
44590,
72,
16,
17,
23,
486,
1065,
3142,
1507,
481,
16,
11,
220,
15,
11,
220,
16,
11,
600,
16,
17,
23,
486,
2810,
3142,
33800,
262,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_obs_cornercase() {
let mut reader = Reader::from_path("test/obs-cornercase.vcf").unwrap();
let first_record = reader
.records()
.next()
.unwrap()
.expect("Fail to read record");
assert_eq!(
*first_record.info(b"EVENT").string().unwrap().unwrap(),
[b"gridss33fb_1085"]
);
assert_eq!(
*first_record.info(b"MATEID").string().unwrap().unwrap(),
[b"gridss33fb_1085h"]
);
} | rust_cleaned_test_functions.jsonl/8785 | {
"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,
30405,
66884,
5638,
368,
341,
286,
1077,
5206,
6604,
284,
25166,
486,
1499,
2638,
445,
1944,
14,
5481,
87595,
5638,
3133,
9792,
1827,
15454,
543,
286,
1077,
1156,
14192,
284,
6604,
198,
310,
659,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_load_tower_wrong_identity() {
let identity_keypair = Arc::new(Keypair::new());
let tower = Tower::new_with_key(&Pubkey::default());
assert_matches!(
tower.save(&identity_keypair),
Err(TowerError::WrongTower(_))
)
} | rust_cleaned_test_functions.jsonl/77052 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 145
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12411,
528,
1202,
75198,
46244,
368,
341,
286,
1077,
9569,
3097,
12670,
284,
19689,
486,
931,
7,
6608,
1082,
1310,
486,
931,
1423,
286,
1077,
21271,
284,
21938,
486,
931,
6615,
3097,
2099,
29162,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_checked_add() {
for elm in sum_triples.iter() {
let (aVec, bVec, cVec) = *elm;
let a = BigUint::from_slice(aVec);
let b = BigUint::from_slice(bVec);
let c = BigUint::from_slice(cVec);
assert!(a.checked_add(&b).unwrap() == c);
assert!(b.checked_add(&a).unwrap() == c);
}
} | rust_cleaned_test_functions.jsonl/96903 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 223
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56456,
2891,
368,
341,
286,
369,
42205,
304,
2629,
3547,
37458,
19471,
368,
341,
310,
1077,
320,
64,
10050,
11,
293,
10050,
11,
272,
10050,
8,
284,
353,
23162,
280,
310,
1077,
264,
284,
6164,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_rc4() {
let pt = "0000000000000000000000000000000000000000000000000000000000000000000000000000";
let ct = "A68686B04D686AA107BD8D4CAB191A3EEC0A6294BC78B60F65C25CB47BD7BB3A48EFC4D26BE4";
let key = "97CD440324DA5FD1F7955C1C13B6B466";
let iv = "";
cipher_test(super::Cipher::rc4(), pt, ct, key, iv);
} | rust_cleaned_test_functions.jsonl/110533 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 177
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30299,
19,
368,
341,
286,
1077,
10817,
284,
330,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_zone_visitor_1() {
let p = PatchSpec::for_full_shape(DataFormat::NCHW, &[1, 1, 2, 2])
.with_kernel_shape(tvec![2, 1])
.with_padding(PaddingSpec::SameLower)
.with_strides(tvec![1, 2])
.into_patch();
let output_shape = DataFormat::NCHW.from_n_c_hw(1, 1, &*p.output_shape);
let mut output = ndarray::ArrayD::<i32>::zeros(&*output_shape.shape);
let mut count = 0;
p.visit_output(|w| {
output.as_slice_mut().unwrap()[w.output_offset as usize] = 1;
count += 1;
});
assert!(output.iter().all(|&x| x == 1));
} | rust_cleaned_test_functions.jsonl/86660 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 351
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28692,
81364,
62,
16,
368,
341,
286,
1077,
281,
284,
30412,
8327,
486,
1958,
16372,
13597,
18959,
4061,
486,
45,
2149,
54,
11,
44590,
16,
11,
220,
16,
11,
220,
17,
11,
220,
17,
2546,
310,
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_desired_port() {
let mut allocator = PortAllocator::new(vec![3000, 3001].into_iter());
assert_eq!(allocator.allocate(Some(3001)), Some(3001));
assert_eq!(allocator.allocate(Some(4000)), Some(3000));
assert_eq!(allocator.allocate(None), None);
} | rust_cleaned_test_functions.jsonl/82086 | {
"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,
15768,
2690,
8716,
368,
341,
286,
1077,
5206,
43655,
284,
5776,
42730,
486,
931,
25592,
20703,
18,
15,
15,
15,
11,
220,
18,
15,
15,
16,
936,
18122,
11723,
1423,
286,
2060,
10714,
10297,
57631,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_encode_i32_valid() {
assert_eq!(encode_i32(0).ok(), Some(vec![0, 0, 0, 0]));
assert_eq!(encode_i32(1).ok(), Some(vec![0, 0, 0, 1]));
assert_eq!(encode_i32(16777216).ok(), Some(vec![1, 0, 0, 0]));
assert_eq!(encode_i32(16777217).ok(), Some(vec![1, 0, 0, 1]));
} | rust_cleaned_test_functions.jsonl/103877 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 163
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
5318,
18,
17,
8337,
368,
341,
262,
2060,
10714,
10297,
6180,
5318,
18,
17,
7,
15,
568,
562,
1507,
4329,
25592,
20703,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
14382,
262,
2060,
1071... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_state_forever() {
let mut state = State::new(true);
state.increase();
state.increase();
assert_eq!(state, State::Forever);
state.decrease();
state.decrease();
assert_eq!(state, State::Forever);
state.increase();
state.increase();
state.increase();
state.increase();
state.pre_shutdown();
assert_eq!(state, State::PreShutdown);
} | rust_cleaned_test_functions.jsonl/72666 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 225
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4387,
35563,
423,
368,
341,
286,
1077,
5206,
1584,
284,
3234,
486,
931,
3715,
317,
286,
1584,
1858,
19947,
543,
286,
1584,
1858,
19947,
543,
286,
2060,
10714,
10297,
2454,
11,
3234,
486,
90561,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compress_0_0() {
let cv = 0;
let to_test = vec![0; 8];
assert_eq!(compress(cv, to_test), 0x0);
} | rust_cleaned_test_functions.jsonl/54030 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 87
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
87845,
62,
15,
62,
15,
368,
341,
286,
1077,
5544,
284,
220,
15,
280,
286,
1077,
311,
4452,
284,
7486,
20703,
15,
26,
220,
23,
935,
286,
2060,
10714,
10297,
38360,
38210,
11,
311,
4452,
701,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_and_with_one_lt_parse() {
let name1 = _random_string(10);
let value1 = _random_string(10);
let json = format!(r#"{{"$and":[{{"~{}":{{"$lt":"{}"}}}}]}}"#, name1, value1);
let query = parse_from_json(&json).unwrap();
let expected = Operator::And(
vec![
Operator::Lt(
TagName::PlainTagName(name1.to_vec()),
TargetValue::Unencrypted(value1.clone())
)
]
);
assert_eq!(query, expected);
} | rust_cleaned_test_functions.jsonl/11829 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 311
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8378,
6615,
11667,
39164,
21039,
368,
341,
286,
1077,
829,
16,
284,
716,
11463,
3904,
7,
16,
15,
317,
286,
1077,
897,
16,
284,
716,
11463,
3904,
7,
16,
15,
626,
286,
1077,
2951,
284,
3561,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_uniform_ubig() {
let mut rng = StdRng::seed_from_u64(1);
let distr = Uniform::from(ubig!(3)..ubig!(7));
let x = (&mut rng).sample_iter(&distr).take(1000).min().unwrap();
assert_eq!(x, ubig!(3));
let x = (&mut rng).sample_iter(&distr).take(1000).max().unwrap();
assert_eq!(x, ubig!(6));
let distr = Uniform::from(ubig!(3)..=ubig!(7));
let x = (&mut rng).sample_iter(&distr).take(1000).min().unwrap();
assert_eq!(x, ubig!(3));
let x = (&mut rng).sample_iter(&distr).take(1000).max().unwrap();
assert_eq!(x, ubig!(7));
let distr = Uniform::from(ubig!(0b100) << 128..ubig!(0b1000) << 128);
let x = (&mut rng).sample_iter(&distr).take(1000).min().unwrap();
assert!(x >= ubig!(0b100) << 128 && x < ubig!(0b101) << 128);
let x = (&mut rng).sample_iter(&distr).take(1000).max().unwrap();
assert!(x >= ubig!(0b111) << 128 && x < ubig!(0b1000) << 128);
} | rust_cleaned_test_functions.jsonl/61294 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 433
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45066,
66794,
343,
368,
341,
262,
1077,
5206,
28422,
284,
42517,
49,
968,
486,
22602,
5673,
7300,
21,
19,
7,
16,
626,
262,
1077,
7905,
284,
47889,
486,
1499,
7,
392,
343,
10297,
18,
88512,
392... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_parse_error() {
let source = "{{#ifequals name compare=\"hello\"}}\nhello\n\t{{else}}\ngood";
let terr = Template::compile(source).unwrap_err();
assert!(matches!(terr.reason, TemplateErrorReason::InvalidSyntax));
assert_eq!(terr.line_no.unwrap(), 4);
assert_eq!(terr.column_no.unwrap(), 5);
} | rust_cleaned_test_functions.jsonl/110783 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 162
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
4096,
368,
341,
286,
1077,
2530,
284,
47219,
2,
1612,
2366,
829,
9429,
4070,
14990,
2105,
3417,
59,
77,
14990,
1699,
4955,
2979,
1503,
3417,
59,
968,
1386,
3302,
286,
1077,
7170,
284,
143... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_categorical_utf8() {
let schema = Schema::new(vec![Field::new("fruits", DataType::Categorical)]);
let expr = col("fruits").eq(lit("somestr"));
let out = optimize_expr(expr.clone(), schema.clone());
// we test that the fruits column is not casted to utf8 for the comparison
assert_eq!(out, expr);
let expr = col("fruits") + (lit("somestr"));
let out = optimize_expr(expr.clone(), schema);
let expected = col("fruits").cast(DataType::Utf8) + lit("somestr");
assert_eq!(out, expected);
} | rust_cleaned_test_functions.jsonl/87829 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 250
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
87455,
39453,
23,
368,
341,
286,
1077,
10802,
284,
12539,
486,
931,
25592,
20703,
1877,
486,
931,
445,
1626,
11797,
497,
33172,
486,
34,
46047,
7252,
626,
286,
1077,
15169,
284,
1375,
445,
1626,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ending_with() {
assert!(ending_with(Some(&to_value("helloworld").unwrap()), &[to_value("world").unwrap()],).unwrap());
assert!(!ending_with(Some(&to_value("hello").unwrap()), &[to_value("hi").unwrap()],).unwrap());
} | rust_cleaned_test_functions.jsonl/125454 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 113
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
2459,
6615,
368,
341,
286,
2060,
10297,
2459,
6615,
65405,
2099,
983,
3142,
445,
71,
95292,
1827,
15454,
11858,
44590,
983,
3142,
445,
14615,
1827,
15454,
79558,
568,
15454,
1423,
286,
2060,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_variant_tuple_before_paren() {
check(
r#"
enum Foo {
A$0(i32),
B,
}
fn main() {
let f: Foo;
f = Foo::B;
f = Foo::A(92);
}
"#,
expect![[r#"
A Variant FileId(0) 15..21 15..16
FileId(0) 89..90
"#]],
);
} | rust_cleaned_test_functions.jsonl/60637 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 215
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46112,
21773,
23708,
620,
9151,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
9018,
33428,
341,
262,
362,
3,
15,
1956,
18,
17,
1326,
262,
425,
345,
532,
8822,
1887,
368,
341,
262,
1077,
282,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_ascii_alphanumeric() {
assert_all!(is_ascii_alphanumeric,
"",
"abcdefghijklmnopqrstuvwxyz",
"ABCDEFGHIJKLMNOQPRSTUVWXYZ",
"0123456789",
);
assert_none!(is_ascii_alphanumeric,
"!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
" \t\n\x0c\r",
"\x00\x01\x02\x03\x04\x05\x06\x07",
"\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
"\x10\x11\x12\x13\x14\x15\x16\x17",
"\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
"\x7f",
);
} | rust_cleaned_test_functions.jsonl/35077 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 425
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
50238,
8418,
65788,
368,
341,
286,
2060,
5705,
10297,
285,
50238,
8418,
65788,
345,
310,
8324,
310,
330,
67512,
756,
310,
330,
71286,
70518,
8996,
48,
6480,
784,
22246,
70226,
756,
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_valid() {
let w = SendWrapper::new(Rc::new(42));
assert!(w.valid());
thread::spawn(move || {
assert!(!w.valid());
});
} | rust_cleaned_test_functions.jsonl/30490 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 75
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8337,
368,
341,
197,
10217,
289,
284,
11000,
11542,
486,
931,
2785,
66,
486,
931,
7,
19,
17,
1106,
197,
6948,
10297,
86,
20586,
1423,
197,
68214,
486,
46087,
34081,
1369,
341,
298,
6948,
0,
34... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bits(){
assert_eq!(Flags::empty().bits(), 0x00000000);
assert_eq!(FlagA.bits(), 0x00000001);
assert_eq!(FlagABC.bits(), 0x00000111);
} | rust_cleaned_test_functions.jsonl/83093 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20034,
3032,
286,
2060,
10714,
10297,
9195,
486,
3194,
1005,
11516,
1507,
220,
15,
87,
15,
15,
15,
15,
15,
15,
15,
15,
317,
286,
2060,
10714,
10297,
12135,
32,
38440,
1507,
220,
15,
87,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_move_to_back() {
let mut cache = mock_cache();
let front_id = cache.cache.front().unwrap().id;
let moved = cache.move_to_back(0).unwrap();
assert_eq!(moved.id, front_id);
assert_ne!(cache.cache.front().unwrap().id, front_id);
} | rust_cleaned_test_functions.jsonl/56054 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 140
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17134,
2346,
3895,
368,
341,
286,
1077,
5206,
6500,
284,
7860,
11529,
543,
286,
1077,
4065,
842,
284,
6500,
20087,
23445,
1005,
15454,
1005,
307,
280,
286,
1077,
7726,
284,
6500,
13635,
2346,
3895... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_column_writer_write_only_one_dictionary_page() {
let page_writer = get_test_page_writer();
let props = Rc::new(WriterProperties::builder().build());
let mut writer = get_test_column_writer::<Int32Type>(page_writer, 0, 0, props);
writer.write_batch(&[1, 2, 3, 4], None, None).unwrap();
// First page should be correctly written.
let res = writer.write_dictionary_page();
assert!(res.is_ok());
writer.write_dictionary_page().unwrap();
} | rust_cleaned_test_functions.jsonl/30520 | {
"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,
8744,
28908,
9165,
18410,
11667,
42605,
6129,
368,
341,
286,
1077,
2150,
28908,
284,
633,
4452,
6129,
28908,
543,
286,
1077,
6914,
284,
81463,
486,
931,
7,
6492,
7903,
486,
17850,
1005,
5834,
1423... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.