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_replace_2b() {
let data = "ประเทศไทย中华";
let repl = "دولة الكويت";
let b = "ะเ";
let b2 = "ปรدولة الكويتทศไทย中华";
assert_eq!(data.replace(b, repl), b2);
} | rust_cleaned_test_functions.jsonl/2434 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 164
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10633,
62,
17,
65,
368,
341,
286,
1077,
821,
284,
330,
130391,
100849,
876,
286,
1077,
5791,
284,
330,
130360,
134385,
3302,
286,
1077,
293,
284,
330,
72267,
27891,
876,
286,
1077,
293,
17,
284,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_directory_files() {
let dir = std::env::current_dir().unwrap();
let path = format!("{}/test", dir.as_path().to_str().unwrap());
let files = read_directory_files(path.as_ref()).unwrap();
assert_eq!(12, files.len())
} | rust_cleaned_test_functions.jsonl/16984 | {
"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,
6443,
14846,
10931,
368,
341,
286,
1077,
5419,
284,
1460,
486,
3160,
486,
3231,
4334,
1005,
15454,
543,
286,
1077,
1815,
284,
3561,
88928,
4472,
1944,
497,
5419,
5357,
2638,
1005,
983,
2895,
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_option_deconstruct() {
// one octet of padding
let opt = Ipv6Option::new_unchecked(&IPV6OPTION_BYTES_PAD1);
assert_eq!(opt.option_type(), Type::Pad1);
// two octets of padding
let bytes: [u8; 2] = [0x1, 0x0];
let opt = Ipv6Option::new_unchecked(&bytes);
assert_eq!(opt.option_type(), Type::PadN);
assert_eq!(opt.data_len(), 0);
// three octets of padding
let opt = Ipv6Option::new_unchecked(&IPV6OPTION_BYTES_PADN);
assert_eq!(opt.option_type(), Type::PadN);
assert_eq!(opt.data_len(), 1);
assert_eq!(opt.data(), &[0]);
// extra bytes in buffer
let bytes: [u8; 10] = [0x1, 0x7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff];
let opt = Ipv6Option::new_unchecked(&bytes);
assert_eq!(opt.option_type(), Type::PadN);
assert_eq!(opt.data_len(), 7);
assert_eq!(opt.data(), &[0, 0, 0, 0, 0, 0, 0]);
// unrecognized option
let bytes: [u8; 1] = [0xff];
let opt = Ipv6Option::new_unchecked(&bytes);
assert_eq!(opt.option_type(), Type::Unknown(255));
// unrecognized option without length and data
assert_eq!(Ipv6Option::new_checked(&bytes), Err(Error::Truncated));
} | rust_cleaned_test_functions.jsonl/130720 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 634
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9672,
2259,
7596,
368,
341,
286,
442,
825,
18491,
295,
315,
5300,
198,
286,
1077,
3387,
284,
358,
30168,
21,
5341,
486,
931,
4907,
7549,
2099,
3298,
53,
21,
34057,
40705,
36451,
16,
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_stone() {
assert_query!("14lb to st", 1, st);
assert_query!("(1qr / 2) to st", 1, st);
} | rust_cleaned_test_functions.jsonl/36186 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 60
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
603,
368,
341,
262,
2060,
5738,
17223,
16,
19,
21123,
311,
357,
497,
220,
16,
11,
357,
317,
262,
2060,
5738,
17223,
7,
16,
23004,
608,
220,
17,
8,
311,
357,
497,
220,
16,
11,
357,
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 |
#[test]
fn test_mul() {
let a = "1".to_owned() + &repeat('0').take(60).collect::<String>();
let b = "1".to_owned() + &repeat("0").take(60).collect::<String>();
let cases = vec![
("12", "10", Res::Ok("120")),
("0", "-1.1", Res::Ok("0")),
("-123.456", "98765.4321", Res::Ok("-12193185.1853376")),
(
"-123456000000",
"98765432100000",
Res::Ok("-12193185185337600000000000"),
),
("123456", "987654321", Res::Ok("121931851853376")),
("123456", "9876543210", Res::Ok("1219318518533760")),
("123", "0.01", Res::Ok("1.23")),
("123", "0", Res::Ok("0")),
(&a, &b, Res::Overflow("0")),
(
"0.00000000000000",
"0.000000000000000000000000000000000000000000000000000000000000000",
Res::Truncated("0.0000000000000000000000000000000"),
),
];
for (lhs_str, rhs_str, exp_str) in cases {
let lhs: Decimal = lhs_str.parse().unwrap();
let rhs: Decimal = rhs_str.parse().unwrap();
let exp = exp_str.map(|s| s.to_owned());
let res = (&lhs * &rhs).map(|d| d.to_string());
assert_eq!(res, exp);
let res = (&rhs * &lhs).map(|d| d.to_string());
assert_eq!(res, exp);
}
} | rust_cleaned_test_functions.jsonl/13666 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 788
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24944,
368,
341,
286,
1077,
264,
284,
330,
16,
3263,
983,
51973,
368,
488,
609,
30624,
492,
15,
1823,
22769,
7,
21,
15,
568,
17384,
27638,
703,
3913,
286,
1077,
293,
284,
330,
16,
3263,
983,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_isometry_inverse() {
let axis = Unit::from_value(Vector3::unit_z());
let angle = Degrees(72_f64);
let distance = Vector3::new(-567_f64, 23_f64, 201_f64);
let isometry = Isometry3::from_axis_angle_translation(&axis, angle, &distance);
let isometry_inv = isometry.inverse();
let point = Point3::new(34_f64, 139_f64, 91_f64);
let expected = point;
let result = isometry_inv * (isometry * point);
assert_relative_eq!(result, expected, epsilon = 1e-8);
let result = isometry * (isometry_inv * point);
assert_relative_eq!(result, expected, epsilon = 1e-8);
} | rust_cleaned_test_functions.jsonl/77229 | {
"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,
6892,
6988,
63333,
368,
341,
286,
1077,
8024,
284,
7954,
486,
1499,
3142,
20258,
18,
486,
3843,
6415,
1423,
286,
1077,
9210,
284,
92901,
7,
22,
17,
761,
21,
19,
317,
286,
1077,
6010,
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 |
#[test]
fn test_stakes_not_delegate() {
let stakes_cache = StakesCache::new(Stakes {
epoch: 4,
..Stakes::default()
});
let ((vote_pubkey, vote_account), (stake_pubkey, stake_account)) =
create_staked_node_accounts(10);
stakes_cache.check_and_store(&vote_pubkey, &vote_account);
stakes_cache.check_and_store(&stake_pubkey, &stake_account);
{
let stakes = stakes_cache.stakes();
let vote_accounts = stakes.vote_accounts();
assert!(vote_accounts.get(&vote_pubkey).is_some());
assert_eq!(vote_accounts.get(&vote_pubkey).unwrap().0, 10);
}
stakes_cache.check_and_store(
&stake_pubkey,
&AccountSharedData::new(1, 0, &stake::program::id()),
);
{
let stakes = stakes_cache.stakes();
let vote_accounts = stakes.vote_accounts();
assert!(vote_accounts.get(&vote_pubkey).is_some());
assert_eq!(vote_accounts.get(&vote_pubkey).unwrap().0, 0);
}
} | rust_cleaned_test_functions.jsonl/22041 | {
"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,
1261,
2050,
7913,
55312,
368,
341,
286,
1077,
44425,
11529,
284,
794,
2050,
8233,
486,
931,
7,
623,
2050,
341,
310,
16342,
25,
220,
19,
345,
310,
5241,
623,
2050,
486,
2258,
741,
286,
3011,
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_pdf() {
let pdf = |arg: DVector<f64>| move |x: MultivariateNormal| x.pdf(&arg);
test_case(vec![0., 0.], vec![1., 0., 0., 1.], 0.05854983152431917, pdf(dvec![1., 1.]));
test_almost(vec![0., 0.], vec![1., 0., 0., 1.], 0.013064233284684921, 1e-15, pdf(dvec![1., 2.]));
test_almost(vec![0., 0.], vec![1., 0., 0., 1.], 1.8618676045881531e-23, 1e-35, pdf(dvec![1., 10.]));
test_almost(vec![0., 0.], vec![1., 0., 0., 1.], 5.920684802611216e-45, 1e-58, pdf(dvec![10., 10.]));
test_almost(vec![0., 0.], vec![1., 0.9, 0.9, 1.], 1.6576716577547003e-05, 1e-18, pdf(dvec![1., -1.]));
test_almost(vec![0., 0.], vec![1., 0.99, 0.99, 1.], 4.1970621773477824e-44, 1e-54, pdf(dvec![1., -1.]));
test_almost(vec![0.5, -0.2], vec![2.0, 0.3, 0.3, 0.5], 0.0013075203140666656, 1e-15, pdf(dvec![2., 2.]));
test_case(vec![0., 0.], vec![f64::INFINITY, 0., 0., f64::INFINITY], 0.0, pdf(dvec![10., 10.]));
test_case(vec![0., 0.], vec![f64::INFINITY, 0., 0., f64::INFINITY], 0.0, pdf(dvec![100., 100.]));
} | rust_cleaned_test_functions.jsonl/106557 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 605
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39948,
368,
341,
286,
1077,
12782,
284,
760,
858,
25,
422,
3781,
63895,
21,
19,
69844,
3271,
760,
87,
25,
22162,
55422,
12206,
91,
856,
15995,
2099,
858,
317,
286,
1273,
19096,
25592,
20703,
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_sub_str() {
let s = "0123456789abc";
assert_eq!(sub_str(s, 0, 0), "");
assert_eq!(sub_str(s, 1, 3), "12");
assert_eq!(sub_str(s, 10, 13), "abc");
assert_eq!(sub_str(s, 10, 100), "abc");
} | rust_cleaned_test_functions.jsonl/115397 | {
"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,
5228,
2895,
368,
341,
262,
1077,
274,
284,
330,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
13683,
876,
262,
2060,
10714,
10297,
1966,
2895,
1141,
11,
220,
15,
11,
220,
15,
701,
14498,
262,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_packed_decoder() {
let mut rng = thread_rng();
let len: usize = rng.gen_range(512..1024);
let mut expected = BooleanBufferBuilder::new(len);
let mut encoder = RleEncoder::new(1, 1024);
for _ in 0..len {
let bool = rng.gen_bool(0.8);
assert!(encoder.put(bool as u64).unwrap());
expected.append(bool);
}
assert_eq!(expected.len(), len);
let encoded = encoder.consume().unwrap();
let mut decoder = PackedDecoder::new(Encoding::RLE, ByteBufferPtr::new(encoded));
// Decode data in random length intervals
let mut decoded = BooleanBufferBuilder::new(len);
loop {
let remaining = len - decoded.len();
if remaining == 0 {
break;
}
let to_read = rng.gen_range(1..=remaining);
decoder.read(&mut decoded, to_read).unwrap();
}
assert_eq!(decoded.len(), len);
assert_eq!(decoded.as_slice(), expected.as_slice());
} | rust_cleaned_test_functions.jsonl/50832 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 512
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
11191,
49843,
368,
341,
286,
1077,
5206,
28422,
284,
4516,
66849,
543,
286,
1077,
2422,
25,
22301,
284,
28422,
22822,
9698,
7,
20,
16,
17,
496,
16,
15,
17,
19,
626,
286,
1077,
5206,
3601,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_sort_non_finite_numbers() {
let v = to_value(vec![
::std::f64::NEG_INFINITY, // NaN and friends get deserialized as Null by serde.
::std::f64::NAN,
])
.unwrap();
let args = HashMap::new();
let result = sort(&v, &args);
assert!(result.is_err());
assert_eq!(result.unwrap_err().to_string(), "Null is not a sortable value");
} | rust_cleaned_test_functions.jsonl/62054 | {
"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,
18435,
21637,
761,
15856,
32964,
368,
341,
286,
1077,
348,
284,
311,
3142,
25592,
90515,
310,
3504,
1834,
486,
69,
21,
19,
486,
97127,
91110,
11,
442,
32178,
323,
4780,
633,
939,
67577,
438,
180... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bytewise_should_preserve_final_newline_when_line_less_than_fold() {
new_ucmd!()
.arg("-b")
.pipe_in("1234\n")
.succeeds()
.stdout_is("1234\n");
} | rust_cleaned_test_functions.jsonl/23305 | {
"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,
3710,
83,
24350,
43378,
32116,
5852,
20676,
5921,
1056,
47636,
6528,
50747,
51613,
61187,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
858,
13645,
65,
1138,
286,
659,
13768,
1243,
445,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_quotes() {
assert_eq!(eval(r#""1><2" + "3<>4""#), Ok(to_value("1><23<>4")));
assert_eq!(eval(r#""1==2" + "3--4""#), Ok(to_value("1==23--4")));
assert_eq!(eval(r#""1!=2" + "3>>4""#), Ok(to_value("1!=23>>4")));
assert_eq!(eval(r#""><1!=2" + "3>>4""#), Ok(to_value("><1!=23>>4")));
} | rust_cleaned_test_functions.jsonl/28416 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 203
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75637,
368,
341,
286,
2060,
10714,
10297,
14170,
2601,
2,
3014,
16,
1784,
17,
1,
488,
330,
18,
21122,
19,
3014,
2,
701,
7622,
12186,
3142,
445,
16,
1784,
17,
18,
21122,
19,
17621,
286,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_list_null() {
let a =
create_list_array(&[Some(&[1, 2]), None, None, Some(&[3, 4]), None, None]);
let b =
create_list_array(&[Some(&[1, 2]), None, None, Some(&[3, 4]), None, None]);
test_equal(a.as_ref(), b.as_ref(), true);
let b = create_list_array(&[
Some(&[1, 2]),
None,
Some(&[5, 6]),
Some(&[3, 4]),
None,
None,
]);
test_equal(a.as_ref(), b.as_ref(), false);
let b =
create_list_array(&[Some(&[1, 2]), None, None, Some(&[3, 5]), None, None]);
test_equal(a.as_ref(), b.as_ref(), false);
} | rust_cleaned_test_functions.jsonl/106082 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 385
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2019,
15162,
368,
341,
286,
1077,
264,
4035,
310,
1855,
2019,
3858,
2099,
58,
8373,
2099,
58,
16,
11,
220,
17,
9719,
2240,
11,
2240,
11,
4329,
2099,
58,
18,
11,
220,
19,
9719,
2240,
11,
2240... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_attrs_iter() {
let encoding = Encoding {
format: Format::Dwarf32,
version: 4,
address_size: 4,
};
let unit = UnitHeader::new(
encoding,
7,
DebugAbbrevOffset(0x0807_0605),
EndianSlice::new(&[], LittleEndian),
);
let abbrev = Abbreviation::new(
42,
constants::DW_TAG_subprogram,
constants::DW_CHILDREN_yes,
vec![
AttributeSpecification::new(constants::DW_AT_name, constants::DW_FORM_string, None),
AttributeSpecification::new(constants::DW_AT_low_pc, constants::DW_FORM_addr, None),
AttributeSpecification::new(
constants::DW_AT_high_pc,
constants::DW_FORM_addr,
None,
),
]
.into(),
);
let buf = [
0x66, 0x6f, 0x6f, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x39, 0x05, 0x00, 0x00, 0xaa, 0xaa,
0xaa, 0xaa,
];
let entry = DebuggingInformationEntry {
offset: UnitOffset(0),
attrs_slice: EndianSlice::new(&buf, LittleEndian),
attrs_len: Cell::new(None),
abbrev: &abbrev,
unit: &unit,
};
let mut attrs = AttrsIter {
input: EndianSlice::new(&buf, LittleEndian),
attributes: abbrev.attributes(),
entry: &entry,
};
match attrs.next() {
Ok(Some(attr)) => {
assert_eq!(
attr,
Attribute {
name: constants::DW_AT_name,
value: AttributeValue::String(EndianSlice::new(b"foo", LittleEndian)),
}
);
}
otherwise => {
assert!(false, "Unexpected parse result = {:#?}", otherwise);
}
}
assert!(entry.attrs_len.get().is_none());
match attrs.next() {
Ok(Some(attr)) => {
assert_eq!(
attr,
Attribute {
name: constants::DW_AT_low_pc,
value: AttributeValue::Addr(0x2a),
}
);
}
otherwise => {
assert!(false, "Unexpected parse result = {:#?}", otherwise);
}
}
assert!(entry.attrs_len.get().is_none());
match attrs.next() {
Ok(Some(attr)) => {
assert_eq!(
attr,
Attribute {
name: constants::DW_AT_high_pc,
value: AttributeValue::Addr(0x539),
}
);
}
otherwise => {
assert!(false, "Unexpected parse result = {:#?}", otherwise);
}
}
assert!(entry.attrs_len.get().is_none());
assert!(attrs.next().expect("should parse next").is_none());
assert!(entry.attrs_len.get().is_some());
assert_eq!(
entry.attrs_len.get().expect("should have entry.attrs_len"),
buf.len() - 4
)
} | rust_cleaned_test_functions.jsonl/102063 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1983
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39578,
11723,
368,
341,
286,
1077,
11170,
284,
29330,
341,
310,
3561,
25,
15042,
486,
35,
32634,
18,
17,
345,
310,
2319,
25,
220,
19,
345,
310,
2621,
2368,
25,
220,
19,
345,
286,
2605,
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... | 4 |
#[test]
fn test_field_range() {
let mut cmd = assert_cmd::Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap();
cmd.args(&["-d", ",", "-f", "2-4", "sed", "s/./_/"])
.write_stdin("AAA,BBB,CCC,DDD\nEEE,FFF,GGG,HHH\n")
.assert()
.stdout("AAA,_BB,_CC,_DD\nEEE,_FF,_GG,_HH\n");
} | rust_cleaned_test_functions.jsonl/7922 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 197
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5013,
9698,
368,
341,
286,
1077,
5206,
5439,
284,
2060,
11684,
486,
4062,
486,
66715,
21816,
16978,
17223,
34,
7581,
46,
94126,
4708,
15197,
15454,
543,
286,
5439,
16365,
2099,
1183,
12,
67,
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_recognize_utf8_boundary_half_debt_one() {
let buf: &[u8] = &[0x61, 0x61, 0xC9, 0x92, 0x0d, 0x0a, 0x0d, 0x0a];
let mut full = buffer_from(buf);
let result = block_on(async { recognize(&mut full).await });
assert_eq!(result.unwrap().find_header("Complex"), Some("aaɒ".to_string()));
} | rust_cleaned_test_functions.jsonl/48189 | {
"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,
7080,
3934,
551,
39453,
23,
54004,
40626,
2259,
12755,
11667,
368,
341,
220,
1077,
6607,
25,
44590,
84,
23,
60,
284,
44590,
15,
87,
21,
16,
11,
220,
15,
87,
21,
16,
11,
220,
15,
12125,
24,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_does_not_detect_a_differently_cased_word_as_its_own_anagram() {
let inputs = ["bAnana"];
let outputs: Vec<&str> = vec![];
assert_eq!(anagram::anagrams_for("banana", &inputs), outputs);
} | rust_cleaned_test_functions.jsonl/65514 | {
"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,
96374,
7913,
56457,
4306,
814,
14320,
4402,
666,
1475,
13533,
11898,
62,
1199,
82100,
12008,
5745,
368,
341,
262,
1077,
11127,
284,
4383,
65,
2082,
3362,
6332,
262,
1077,
16275,
25,
11312,
52244,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_parent_dir_if_missing() {
let root_path = Builder::new()
.prefix("test_create_parent_dir_if_missing")
.tempdir()
.unwrap();
let path = root_path.path().join("not_exist_dir");
let mut tikv_cfg = TiKvConfig::default();
tikv_cfg.storage.data_dir = path.as_path().to_str().unwrap().to_owned();
assert!(persist_config(&tikv_cfg).is_ok());
} | rust_cleaned_test_functions.jsonl/2148 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 217
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
15960,
4334,
11119,
40447,
368,
341,
286,
1077,
3704,
2638,
284,
20626,
486,
931,
741,
310,
659,
11849,
445,
1944,
8657,
15960,
4334,
11119,
40447,
1138,
310,
659,
3888,
3741,
741,
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_basic_kg_and_g() {
let int = &Never::default();
let base_kg = BaseUnit::new("kilogram".into());
let mut hashmap = HashMap::new();
hashmap.insert(base_kg, 1.into());
let kg = NamedUnit::new("k".into(), "g".into(), "g".into(), hashmap.clone(), 1);
let g = NamedUnit::new(
Cow::Borrowed(""),
Cow::Borrowed("g"),
Cow::Borrowed("g"),
hashmap,
Exact::new(Complex::from(1), true)
.div(Exact::new(1000.into(), true), int)
.unwrap()
.value,
);
let one_kg = Value::new(1, vec![UnitExponent::new(kg, 1)]);
let twelve_g = Value::new(12, vec![UnitExponent::new(g, 1)]);
assert_eq!(
to_string(&one_kg.clone().add(twelve_g.clone(), int).unwrap()),
"1.012 kg"
);
assert_eq!(to_string(&twelve_g.add(one_kg, int).unwrap()), "1012 g");
} | rust_cleaned_test_functions.jsonl/73912 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 521
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
4698,
70,
8378,
1889,
368,
341,
286,
1077,
526,
284,
609,
26155,
486,
2258,
543,
286,
1077,
2331,
4698,
70,
284,
5351,
4562,
486,
931,
445,
85526,
12958,
3263,
18122,
1423,
286,
1077,
520... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_created_time() {
let fs = FileSystem::default();
let file = fs
.new_open_options()
.write(true)
.create_new(true)
.open(path!("/foo.txt"))
.expect("failed to create a new file");
let created_time = file.created_time();
assert!(created_time > 0, "created time is not zero");
let file = fs
.new_open_options()
.read(true)
.open(path!("/foo.txt"))
.expect("failed to create a new file");
let next_created_time = file.created_time();
assert_eq!(
next_created_time, created_time,
"created time stays constant"
);
} | rust_cleaned_test_functions.jsonl/52776 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 373
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27288,
3009,
368,
341,
286,
1077,
8619,
284,
53461,
486,
2258,
1428,
286,
1077,
1034,
284,
8619,
198,
310,
659,
931,
11311,
8743,
741,
310,
659,
4934,
3715,
340,
310,
659,
3182,
5921,
3715,
340,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ecdsa_send_dealings_with_complaints() {
ic_test_utilities::artifact_pool_config::with_test_pool_config(|pool_config| {
with_test_replica_logger(|logger| {
let (ecdsa_pool, pre_signer) = create_pre_signer_dependencies(pool_config, logger);
let (id_1, id_2, id_3) = (
create_transcript_id(1),
create_transcript_id(2),
create_transcript_id(3),
);
// Set up the transcript creation request
let t1 = create_transcript_param(id_1, &[NODE_1], &[NODE_2]);
let t2 = create_transcript_param(id_2, &[NODE_1], &[NODE_3]);
let t3 = create_transcript_param(id_3, &[NODE_1], &[NODE_4]);
let block_reader =
TestEcdsaBlockReader::for_pre_signer_test(Height::from(100), vec![t1, t2, t3]);
let transcript_loader =
TestEcdsaTranscriptLoader::new(TestTranscriptLoadStatus::Complaints);
let change_set =
pre_signer.send_dealings(&ecdsa_pool, &transcript_loader, &block_reader);
let complaints = transcript_loader.returned_complaints();
assert_eq!(change_set.len(), complaints.len());
assert_eq!(change_set.len(), 3);
for complaint in complaints {
assert!(is_complaint_added_to_validated(
&change_set,
&complaint.content.idkg_complaint.transcript_id,
&NODE_1,
&NODE_1,
));
}
})
})
} | rust_cleaned_test_functions.jsonl/86712 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 992
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36844,
96780,
13565,
2259,
278,
819,
6615,
2965,
31297,
82,
368,
341,
286,
17902,
4452,
94044,
486,
63722,
15709,
5332,
486,
4197,
4452,
15709,
5332,
22428,
10285,
5332,
91,
341,
310,
448,
4452,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_nil() {
let text = " {% if var == nil %} true {% else %} false {% endif %} ";
assert_template_result!(" true ", text, v!({ "var": nil }));
let text = " {% if var == null %} true {% else %} false {% endif %} ";
assert_template_result!(" true ", text, v!({ "var": nil }));
} | rust_cleaned_test_functions.jsonl/28137 | {
"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,
36175,
368,
341,
262,
1077,
1467,
284,
330,
52261,
421,
762,
621,
2092,
1018,
92,
830,
52261,
770,
1018,
92,
895,
52261,
12330,
1018,
92,
7620,
262,
2060,
8693,
5287,
17223,
220,
830,
220,
3670,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mutex_arc_access_in_unwind() {
let arc = Arc::new(Mutex::new(1));
let arc2 = arc.clone();
let _ = thread::spawn(move || -> () {
struct Unwinder {
i: Arc<Mutex<i32>>,
}
impl Drop for Unwinder {
fn drop(&mut self) {
*self.i.lock().unwrap() += 1;
}
}
let _u = Unwinder { i: arc2 };
panic!();
})
.join();
let lock = arc.lock().unwrap();
assert_eq!(*lock, 2);
} | rust_cleaned_test_functions.jsonl/8921 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 347
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14204,
62914,
12759,
1243,
4907,
19154,
368,
341,
286,
1077,
15580,
284,
19689,
486,
931,
3189,
9371,
486,
931,
7,
16,
1106,
286,
1077,
15580,
17,
284,
15580,
15997,
543,
286,
1077,
716,
284,
45... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_login_ok() {
let client = Client::new(rocket()).expect("valid src instance");
let response = client.post("/user/login").body(r#"{ "username": "tester_static", "password": "G00DP4SSW0RD" }"#).dispatch();
assert_eq!(response.status(), Status::Ok);
} | rust_cleaned_test_functions.jsonl/101441 | {
"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,
13681,
19817,
368,
341,
286,
1077,
2943,
284,
8423,
486,
931,
7,
46790,
6011,
17119,
445,
1891,
2286,
2867,
797,
286,
1077,
2033,
284,
2943,
6542,
4283,
872,
16543,
1827,
2599,
2601,
2,
14129,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_socket_address() {
assert_eq!(
parse_socket_address("216.10.234.56", 12345),
"216.10.234.56:12345"
);
assert_eq!(parse_socket_address("0.0.0.0", 12345), "localhost:12345");
assert_eq!(parse_socket_address("::", 12345), "localhost:12345");
assert_eq!(
parse_socket_address("face:booc::0", 12345),
"face:booc::0:12345"
);
assert_eq!(
parse_socket_address("2401:dbff:121f:a2f1:face:d:6c:0", 12345),
"2401:dbff:121f:a2f1:face:d:6c:0:12345"
);
assert_eq!(parse_socket_address("localhost", 12345), "localhost:12345");
assert_eq!(
parse_socket_address("www.facebook.com", 12345),
"www.facebook.com:12345"
);
} | rust_cleaned_test_functions.jsonl/2954 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 447
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
19555,
6744,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
19555,
6744,
445,
17,
16,
21,
13,
16,
15,
13,
17,
18,
19,
13,
20,
21,
497,
220,
16,
17,
18,
19,
20,
1326,
310,
330,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_b_minor_scale() {
assert_eq!(
minor_scale(Note::B),
["B", "C#", "D", "E", "F#", "G", "A"]
);
} | rust_cleaned_test_functions.jsonl/38488 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
70861,
16727,
368,
341,
286,
2060,
10714,
33673,
310,
8922,
16727,
89389,
486,
33,
1326,
310,
4383,
33,
497,
330,
34,
75915,
330,
35,
497,
330,
36,
497,
330,
37,
75915,
330,
38,
497,
330,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_entity_vertex_manager() {
let application = init_application();
let entity_type_manager = application.get_entity_type_manager();
let entity_vertex_manager = application.get_entity_vertex_manager();
let graph_database = application.get_graph_database();
let transaction = graph_database.get_transaction().unwrap();
let type_name = r_string();
let property_name = r_string();
let property_value = json!(r_string());
assert_eq!(0, transaction.get_vertex_count().unwrap());
// Create entity type
let entity_type = EntityTypeBuilder::new(type_name.clone())
.component(String::from("positionable"))
.string_property(property_name.clone())
.build();
entity_type_manager.register(entity_type.clone());
let mut properties = HashMap::new();
properties.insert(property_name.clone(), property_value.clone());
let result = entity_vertex_manager.create(type_name.clone(), properties);
assert!(result.is_ok());
assert_eq!(1, transaction.get_vertex_count().unwrap());
// Check if entity vertex with the given uuid exists
let uuid = result.unwrap();
assert!(entity_vertex_manager.has(uuid));
let vertex = entity_vertex_manager.get(uuid);
assert!(vertex.is_some());
assert_eq!(uuid, vertex.unwrap().id);
let properties = entity_vertex_manager.get_properties(uuid);
assert!(properties.is_some());
let properties = properties.unwrap();
assert_eq!(uuid, properties.vertex.id);
assert_eq!(type_name.clone(), properties.vertex.t.0);
assert_eq!(1, properties.props.len());
let property = properties.props.get(0);
assert!(property.is_some());
let property = property.unwrap();
assert_eq!(property_name.clone(), property.name);
assert_eq!(property_value.clone(), property.value);
// Delete vertex
entity_vertex_manager.delete(uuid);
// Check if vertex is gone
assert!(!entity_vertex_manager.has(uuid));
let vertex = entity_vertex_manager.get(uuid);
assert!(!vertex.is_some());
let properties = entity_vertex_manager.get_properties(uuid);
assert!(!properties.is_some());
} | rust_cleaned_test_functions.jsonl/112047 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 775
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19169,
26611,
12144,
368,
341,
262,
1077,
3766,
284,
2930,
38721,
543,
262,
1077,
5387,
1819,
12144,
284,
3766,
670,
19169,
1819,
12144,
543,
262,
1077,
5387,
26611,
12144,
284,
3766,
670,
19169,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_to_large_data() {
assert_eq!(
SensitiveBuffer::try_from(vec![0xffu8; SENSITIVE_BUFFER_MAX_SIZE + 1])
.expect_err("Converting a buffer that is to large did not produce an error"),
Error::WrapperError(WrapperErrorKind::WrongParamSize),
"Wrong kind of error when converting a buffer with size {} to SensitiveBuffer",
SENSITIVE_BUFFER_MAX_SIZE + 1
);
} | rust_cleaned_test_functions.jsonl/90736 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 178
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
45228,
1769,
368,
341,
262,
2060,
10714,
33673,
286,
328,
18723,
4095,
486,
1539,
5673,
25592,
20703,
15,
9020,
84,
23,
26,
328,
20359,
44350,
14394,
6806,
4098,
488,
220,
16,
2546,
310,
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_receipt_round_trip() {
let sapling = &*sapling_bls12::SAPLING;
let spender_key: SaplingKey<Bls12> = SaplingKey::generate_key(sapling.clone());
let note = Note::new(
sapling.clone(),
spender_key.generate_public_address(),
42,
Memo([0; 32]),
);
let receipt = ReceiptParams::new(sapling.clone(), &spender_key, ¬e)
.expect("should be able to create receipt proof");
let proof = receipt
.post()
.expect("Should be able to post receipt proof");
proof
.verify_proof(&sapling)
.expect("proof should check out");
// test serialization
let mut serialized_proof = vec![];
proof
.write(&mut serialized_proof)
.expect("Should be able to serialize proof");
let read_back_proof: ReceiptProof<Bls12> =
ReceiptProof::read(sapling.clone(), &mut serialized_proof[..].as_ref())
.expect("Should be able to deserialize valid proof");
assert_eq!(proof.proof.a, read_back_proof.proof.a);
assert_eq!(proof.proof.b, read_back_proof.proof.b);
assert_eq!(proof.proof.c, read_back_proof.proof.c);
assert_eq!(
proof.merkle_note.value_commitment.to_xy(),
read_back_proof.merkle_note.value_commitment.to_xy()
);
assert_eq!(
proof.merkle_note.note_commitment.to_repr(),
read_back_proof.merkle_note.note_commitment.to_repr()
);
assert_eq!(
proof.merkle_note.ephemeral_public_key.to_xy(),
read_back_proof.merkle_note.ephemeral_public_key.to_xy()
);
assert_eq!(
proof.merkle_note.encrypted_note[..],
read_back_proof.merkle_note.encrypted_note[..]
);
assert_eq!(
proof.merkle_note.note_encryption_keys[..],
read_back_proof.merkle_note.note_encryption_keys[..]
);
let mut serialized_again = vec![];
read_back_proof
.write(&mut serialized_again)
.expect("should be able to serialize proof again");
assert_eq!(serialized_proof, serialized_again);
} | rust_cleaned_test_functions.jsonl/10712 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1132
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77974,
29896,
63883,
368,
341,
286,
1077,
34635,
2718,
284,
609,
9,
64613,
2718,
880,
4730,
16,
17,
486,
50,
2537,
74115,
280,
286,
1077,
83888,
3097,
25,
80175,
2718,
1592,
32519,
4730,
16,
17,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_error_other() {
assert_eq!(
Message::parse(&Bytes::from("4 48 46 I'm a teapot!")),
Some(Message::Response(Response {
message_id: 48,
request_message_id: 46,
data: Err(ErrorKind::Other(Bytes::from("I'm a teapot!"))),
}))
);
} | rust_cleaned_test_functions.jsonl/1090 | {
"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,
30456,
368,
341,
262,
2060,
10714,
33673,
286,
4856,
486,
6400,
2099,
7078,
486,
1499,
445,
19,
220,
19,
23,
220,
19,
21,
358,
2776,
264,
1013,
89901,
0,
30154,
286,
4329,
29359,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_security() {
let causet = SecurityConfig::default();
// default is disable secure connection.
causet.validate().unwrap();
let mgr = SecurityManager::new(&causet).unwrap();
assert!(mgr.causet.ca_path.is_empty());
assert!(mgr.causet.cert_path.is_empty());
assert!(mgr.causet.key_path.is_empty());
let assert_causet = |c: fn(&mut SecurityConfig), valid: bool| {
let mut invalid_causet = causet.clone();
c(&mut invalid_causet);
assert_eq!(invalid_causet.validate().is_ok(), valid);
};
// invalid path should be rejected.
assert_causet(
|c| {
c.ca_path = "invalid ca path".to_owned();
c.cert_path = "invalid cert path".to_owned();
c.key_path = "invalid key path".to_owned();
},
false,
);
let temp = Builder::new().prefix("test_cred").temfidelir().unwrap();
let example_ca = temp.path().join("ca");
let example_cert = temp.path().join("cert");
let example_key = temp.path().join("key");
for (id, f) in (&[&example_ca, &example_cert, &example_key])
.iter()
.enumerate()
{
fs::write(f, &[id as u8]).unwrap();
}
let mut c = causet.clone();
c.cert_path = format!("{}", example_cert.display());
c.key_path = format!("{}", example_key.display());
// incomplete configuration.
c.validate().unwrap_err();
// data should be loaded from file after validating.
c.ca_path = format!("{}", example_ca.display());
c.validate().unwrap();
let (ca, cert, key) = c.load_certs().unwrap_or_default();
assert_eq!(ca, vec![0]);
assert_eq!(cert, vec![1]);
assert_eq!(key, vec![2]);
} | rust_cleaned_test_functions.jsonl/66519 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 921
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48726,
368,
341,
286,
1077,
2162,
18187,
284,
8234,
2648,
486,
2258,
543,
286,
442,
1638,
374,
11156,
9767,
3633,
624,
286,
2162,
18187,
19520,
1005,
15454,
543,
286,
1077,
57897,
284,
8234,
2043,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_syntax_error_message() {
let result = serde_json::from_str::<cm::Name>("foo").map_err(Error::from);
assert_matches!(result, Err(Error::Parse(_)));
} | rust_cleaned_test_functions.jsonl/62647 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 88
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
78894,
4096,
6462,
368,
341,
286,
1077,
1102,
284,
61570,
9455,
486,
1499,
2895,
27638,
6226,
486,
675,
13211,
7975,
1827,
2186,
9266,
37396,
486,
1499,
317,
286,
2060,
38344,
10297,
1382,
11,
154... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_with_prefix() {
let separator = [0x00, 0x00];
let mut data = io::Cursor::new(vec![
0xAA, 0xAB, // Prefix
0x00, 0x00, 0x01, 0x02, 0x03, // FullMatch
0x00, 0x00, 0x04, 0x05, 0x06, // FullMatch
0x00, 0x00, 0x07, 0x08 // Suffix
]);
let mut splitter = ByteStreamSplitter::new(&mut data, &separator);
let prefix = splitter.next().unwrap().unwrap();
let match1 = splitter.next().unwrap().unwrap();
let match2 = splitter.next().unwrap().unwrap();
let suffix = splitter.next().unwrap().unwrap();
assert_eq!(prefix, vec![0xAA, 0xAB]);
assert_eq!(match1, vec![0x01, 0x02, 0x03]);
assert_eq!(match2, vec![0x04, 0x05, 0x06]);
assert_eq!(suffix, vec![0x07, 0x08]);
} | rust_cleaned_test_functions.jsonl/28677 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 402
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
13974,
368,
341,
262,
1077,
24792,
284,
508,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
935,
262,
1077,
5206,
821,
284,
6399,
486,
14543,
486,
931,
25592,
90515,
286,
220,
15,
60051,
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_vote_serialization() {
let dt = "2017-12-25T03:00:01.234Z".parse::<DateTime<Utc>>().unwrap();
let t = TimeMsg {
seconds: dt.timestamp(),
nanos: dt.timestamp_subsec_nanos() as i32,
};
let vote = Vote {
vote_type: SignedMsgType::PreVote.to_u32(),
height: 12345,
round: 2,
timestamp: Some(t),
block_id: Some(BlockId {
hash: b"hash".to_vec(),
parts_header: Some(PartsSetHeader {
total: 1_000_000,
hash: b"parts_hash".to_vec(),
}),
}),
validator_address: vec![
0xa3, 0xb2, 0xcc, 0xdd, 0x71, 0x86, 0xf1, 0x68, 0x5f, 0x21, 0xf2, 0x48, 0x2a, 0xf4,
0xfb, 0x34, 0x46, 0xa8, 0x4b, 0x35,
],
validator_index: 56789,
signature: vec![],
};
let sign_vote_msg = SignVoteRequest { vote: Some(vote) };
let mut got = vec![];
let _have = sign_vote_msg.encode(&mut got);
// the following vector is generated via:
// BlockID: types.BlockID{
// PartsHeader: types.PartSetHeader{
let want = vec![
78, 243, 244, 18, 4, 10, 72, 8, 1, 16, 185, 96, 24, 2, 34, 24, 10, 4, 104, 97, 115,
104, 18, 16, 8, 192, 132, 61, 18, 10, 112, 97, 114, 116, 115, 95, 104, 97, 115, 104,
42, 11, 8, 177, 211, 129, 210, 5, 16, 128, 157, 202, 111, 50, 20, 163, 178, 204, 221,
113, 134, 241, 104, 95, 33, 242, 72, 42, 244, 251, 52, 70, 168, 75, 53, 56, 213, 187,
3,
];
let svr = SignVoteRequest::decode(got.as_ref()).unwrap();
println!("got back: {:?}", svr);
assert_eq!(got, want);
} | rust_cleaned_test_functions.jsonl/71172 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1205
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54360,
25602,
2022,
368,
341,
286,
1077,
7594,
284,
330,
17,
15,
16,
22,
12,
16,
17,
12,
17,
20,
51,
15,
18,
25,
15,
15,
25,
15,
16,
13,
17,
18,
19,
57,
3263,
6400,
27638,
7689,
36397,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_filter_log() {
let time_now = time::now();
let time_before = time_now - time::Duration::minutes(10);
let time_before = time_before.to_local();
let time_after = time_now + time::Duration::minutes(10);
let time_after = time_after.to_local();
let no_filter = FilterLog::None;
let filter_now = FilterLog::Last(time_now);
assert!(no_filter.check(&time_before));
assert!(format!("{}", no_filter) == "None");
assert!(!filter_now.check(&time_before));
assert!(filter_now.check(&time_after));
assert!(format!("{}", filter_now) == format!("Last({})", time_now.strftime(super::TIME_FORMAT).unwrap()));
} | rust_cleaned_test_functions.jsonl/33848 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 319
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8727,
5224,
368,
341,
286,
1077,
882,
20813,
262,
284,
882,
486,
3328,
543,
286,
1077,
882,
23708,
284,
882,
20813,
481,
882,
486,
12945,
486,
37037,
7,
16,
15,
317,
286,
1077,
882,
23708,
284... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_example2() {
let input = vec![0, 2, 2, 2, 1, 1, 2, 2, 2, 2, 1, 2, 0, 0, 0, 0];
let layers = parse_space_image_format(&input, 2, 2);
let mut image = Vec::new();
for p in 0..4 {
let color = layers
.iter()
.find(|layer| layer[p] != 2 /* transparent */)
.unwrap();
image.push(color[p]);
}
assert_eq!(image, vec![0, 1, 1, 0]);
} | rust_cleaned_test_functions.jsonl/10793 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 267
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39304,
17,
368,
341,
286,
1077,
1946,
284,
7486,
20703,
15,
11,
220,
17,
11,
220,
17,
11,
220,
17,
11,
220,
16,
11,
220,
16,
11,
220,
17,
11,
220,
17,
11,
220,
17,
11,
220,
17,
11,
220... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_type_required_string() {
let schemaReplicant = SchemaReplicant::default();
let causetq = r#"[:find ?x :where [?x _ ?e] [(type ?e :edb.type/string)]]"#;
let SQLCausetQ { allegrosql, args } = translate(&schemaReplicant, causetq);
// Note: strings should use `all_Causets` and not `causets`.
assert_eq!(allegrosql, "SELECT DISTINCT `all_Causets00`.e AS `?x` \
FROM `all_Causets` AS `all_Causets00` \
WHERE (`all_Causets00`.value_type_tag = 10)");
assert_eq!(args, vec![]);
} | rust_cleaned_test_functions.jsonl/90704 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 265
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1819,
18743,
3904,
368,
341,
262,
1077,
10802,
18327,
35237,
284,
12539,
18327,
35237,
486,
2258,
1428,
262,
1077,
2162,
18187,
80,
284,
435,
55543,
3447,
3903,
937,
87,
549,
2870,
508,
30,
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_create_fdt_with_initrd() {
let regions = arch_memory_regions(layout::FDT_MAX_SIZE + 0x1000);
let mem = GuestMemoryMmap::new(®ions).expect("Cannot initialize memory");
let kvm = Kvm::new().unwrap();
let vm = kvm.create_vm().unwrap();
let gic = create_gic(&vm, 1).unwrap();
let initrd = InitrdConfig {
address: GuestAddress(0x10000000),
size: 0x1000,
};
let mut dtb = create_fdt(
&mem,
vec![0],
&CString::new("console=tty0").unwrap(),
None::<&std::collections::HashMap<(DeviceType, std::string::String), MMIODeviceInfo>>,
&gic,
&Some(initrd),
)
.unwrap();
let bytes = include_bytes!("output_with_initrd.dtb");
let pos = 4;
let val = layout::FDT_MAX_SIZE;
let mut buf = vec![];
buf.extend_from_slice(bytes);
set_size(&mut buf, pos, val);
set_size(&mut dtb, pos, val);
let original_fdt = device_tree::DeviceTree::load(&buf).unwrap();
let generated_fdt = device_tree::DeviceTree::load(&dtb).unwrap();
assert!(format!("{:?}", original_fdt) == format!("{:?}", generated_fdt));
} | rust_cleaned_test_functions.jsonl/90777 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 632
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
761,
8047,
6615,
6137,
6498,
368,
341,
286,
1077,
13604,
284,
5325,
19195,
58035,
19930,
486,
37,
10599,
6806,
4098,
488,
220,
15,
87,
16,
15,
15,
15,
317,
286,
1077,
1833,
284,
26215,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_or_with_one_in_to_string() {
let name1 = _random_vector(10);
let value1 = _random_string(10);
let query = Operator::Or(
vec![
Operator::In(
TagName::PlainTagName(name1.clone()),
vec![TargetValue::Unencrypted(value1.clone())]
)
]
);
let json = query.to_string();
let expected = format!(r#"{{"$or":[{{"~{}":{{"$in":["{}"]}}}}]}}"#, base64::encode(&name1), value1);
assert_eq!(json, expected);
} | rust_cleaned_test_functions.jsonl/11915 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 317
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8734,
6615,
11667,
1243,
2346,
3904,
368,
341,
286,
1077,
829,
16,
284,
716,
11463,
12247,
7,
16,
15,
317,
286,
1077,
897,
16,
284,
716,
11463,
3904,
7,
16,
15,
626,
286,
1077,
3239,
284,
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_vec_list_pop_back() {
let mut list = VecList::new();
assert_eq!(list.pop_back(), None);
list.push_back(0);
assert_eq!(list.pop_back(), Some(0));
} | rust_cleaned_test_functions.jsonl/11544 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
2019,
17061,
3895,
368,
341,
286,
1077,
5206,
1140,
284,
11312,
852,
486,
931,
543,
286,
2060,
10714,
10297,
1607,
8288,
3895,
1507,
2240,
626,
286,
1140,
2552,
3895,
7,
15,
317,
286,
206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_find_all_at_start() {
let text = b"dhjalkjwqnnnannanaflkjdklfj";
let pattern = b"dhjalk";
let kmp = KMP::new(pattern);
assert_eq!(kmp.find_all(text).collect_vec(), [0]);
} | rust_cleaned_test_functions.jsonl/12992 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 123
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
5705,
3752,
4906,
368,
341,
286,
1077,
1467,
284,
293,
1,
30621,
73,
1692,
73,
86,
80,
7370,
77,
1020,
3362,
1489,
74,
88851,
11008,
73,
876,
286,
1077,
5383,
284,
293,
1,
30621,
73,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serversessionmemorycache_overwrites_put() {
let c = ServerSessionMemoryCache::new(4);
assert_eq!(c.put(vec![0x01], vec![0x02]), true);
assert_eq!(c.put(vec![0x01], vec![0x04]), true);
assert_eq!(c.get(&[0x01]), Some(vec![0x04]));
} | rust_cleaned_test_functions.jsonl/8734 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 150
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67507,
1338,
17269,
9360,
15431,
59079,
15557,
368,
341,
286,
1077,
272,
284,
8422,
5283,
10642,
8233,
486,
931,
7,
19,
317,
286,
2060,
10714,
10297,
66,
3597,
25592,
20703,
15,
87,
15,
16,
1125... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stdin_default() {
new_ucmd!()
.pipe_in_fixture(FOOBAR_TXT)
.run()
.stdout_is_fixture("foobar_stdin_default.expected");
} | rust_cleaned_test_functions.jsonl/31118 | {
"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,
15656,
258,
9993,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
13768,
1243,
74409,
7,
3788,
20608,
934,
84411,
340,
286,
659,
6108,
741,
286,
659,
36358,
6892,
74409,
445,
50267,
15656,
25... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_atanh() {
assert_eq!(0.0f32.atanh(), 0.0f32);
assert_eq!((-0.0f32).atanh(), -0.0f32);
let inf32: f32 = Float::infinity();
let neg_inf32: f32 = Float::neg_infinity();
assert_eq!(1.0f32.atanh(), inf32);
assert_eq!((-1.0f32).atanh(), neg_inf32);
assert!(2f64.atanh().atanh().is_NaN());
assert!((-2f64).atanh().atanh().is_NaN());
let inf64: f32 = Float::infinity();
let neg_inf64: f32 = Float::neg_infinity();
let nan32: f32 = Float::NaN();
assert!(inf64.atanh().is_NaN());
assert!(neg_inf64.atanh().is_NaN());
assert!(nan32.atanh().is_NaN());
assert_approx_eq!(0.5f32.atanh(), 0.54930614433405484569762261846126285f32);
assert_approx_eq!((-0.5f32).atanh(), -0.54930614433405484569762261846126285f32);
} | rust_cleaned_test_functions.jsonl/33110 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 453
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3752,
27924,
368,
341,
286,
2060,
10714,
10297,
15,
13,
15,
69,
18,
17,
6847,
27924,
1507,
220,
15,
13,
15,
69,
18,
17,
317,
286,
2060,
10714,
0,
54934,
15,
13,
15,
69,
18,
17,
568,
16225,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_execute_input() {
let mut machine = Machine::new(vec![3,5,3,6,99,0,0]);
machine.input = vec![10, 11];
machine.execute().unwrap();
assert_eq!(machine.mem, vec![3,5,3,6,99,10,11]);
} | rust_cleaned_test_functions.jsonl/43083 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44329,
5898,
368,
341,
10217,
5206,
5662,
284,
12960,
486,
931,
25592,
20703,
18,
11,
20,
11,
18,
11,
21,
11,
24,
24,
11,
15,
11,
15,
2558,
2109,
3814,
10046,
284,
7486,
20703,
16,
15,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_frozen_account_from_snapshot() {
solana_logger::setup_with_default(RUST_LOG_FILTER);
let validator_identity =
Arc::new(solana_sdk::signature::keypair_from_seed(&[0u8; 32]).unwrap());
let mut snapshot_test_config = setup_snapshot_validator_config(5, 1);
// Freeze the validator identity account
snapshot_test_config.validator_config.frozen_accounts = vec![validator_identity.pubkey()];
let mut config = ClusterConfig {
validator_keys: Some(vec![(validator_identity.clone(), true)]),
node_stakes: vec![100; 1],
cluster_lamports: 1_000,
validator_configs: make_identical_validator_configs(
&snapshot_test_config.validator_config,
1,
),
..ClusterConfig::default()
};
let mut cluster = LocalCluster::new(&mut config, SocketAddrSpace::Unspecified);
let snapshot_package_output_path = &snapshot_test_config
.validator_config
.snapshot_config
.as_ref()
.unwrap()
.snapshot_package_output_path;
trace!("Waiting for snapshot at {:?}", snapshot_package_output_path);
let (archive_filename, _archive_snapshot_hash) =
wait_for_next_snapshot(&cluster, snapshot_package_output_path);
trace!("Found snapshot: {:?}", archive_filename);
// Restart the validator from a snapshot
let validator_info = cluster.exit_node(&validator_identity.pubkey());
cluster.restart_node(
&validator_identity.pubkey(),
validator_info,
SocketAddrSpace::Unspecified,
);
generate_frozen_account_panic(cluster, validator_identity);
} | rust_cleaned_test_functions.jsonl/31905 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 667
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
42240,
13500,
5673,
53265,
368,
341,
262,
2048,
3362,
27413,
486,
15188,
6615,
9993,
2785,
8553,
8419,
23728,
317,
262,
1077,
22935,
46244,
4035,
286,
19689,
486,
931,
80608,
3362,
61783,
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_invalid() {
assert_eq!("--129".parse::<i8>().ok(), None);
assert_eq!("++129".parse::<i8>().ok(), None);
assert_eq!("Съешь".parse::<u8>().ok(), None);
} | rust_cleaned_test_functions.jsonl/108504 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
368,
341,
262,
2060,
10714,
17223,
313,
16,
17,
24,
3263,
6400,
27638,
72,
23,
10483,
562,
1507,
2240,
317,
262,
2060,
10714,
17223,
1027,
16,
17,
24,
3263,
6400,
27638,
72,
23,
10483,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_generate_key() {
let (salt, encryption_key) = EncryptedKeyStore::derive_key(PASSPHRASE, None).unwrap();
let (second_salt, second_key) =
EncryptedKeyStore::derive_key(PASSPHRASE, Some(salt.as_ref().to_vec())).unwrap();
assert_eq!(
encryption_key, second_key,
"Derived key must be deterministic"
);
assert_eq!(salt, second_salt, "Salts must match");
} | rust_cleaned_test_functions.jsonl/37717 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 219
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48851,
3097,
368,
341,
286,
1077,
320,
42226,
11,
25463,
3097,
8,
284,
10751,
14026,
1592,
6093,
486,
27098,
3097,
5304,
4939,
10842,
49,
4066,
11,
2240,
568,
15454,
543,
286,
1077,
320,
5569,
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_motherboard_daughterboard() {
assert_eq!(
LastError {
motherboard: ErrorCode::COMMAND_DATA_INCORRECT,
daughterboard: Some(ErrorCode::CHANNEL_INACTIVE),
},
parse(&vec![0x00, 0x02, 0x00, 0x04]).unwrap()
);
} | rust_cleaned_test_functions.jsonl/8383 | {
"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,
21039,
717,
1575,
2482,
47070,
7340,
2482,
368,
341,
286,
2060,
10714,
33673,
310,
7996,
1454,
341,
394,
64243,
25,
60084,
486,
60541,
7896,
39901,
868,
44840,
345,
394,
9803,
2482,
25,
4329,
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_decode_strw_imm() {
assert_eq!(
decode_32(0xf8434b04),
Instruction::STR_imm {
params: Reg2FullParams {
rt: Reg::R4,
rn: Reg::R3,
imm32: 4,
index: false,
add: true,
wback: true,
},
thumb32: true,
}
);
} | rust_cleaned_test_functions.jsonl/64791 | {
"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,
15227,
2895,
86,
71370,
368,
341,
1066,
262,
2060,
10714,
33673,
286,
16895,
62,
18,
17,
7,
15,
5848,
23,
19,
18,
19,
65,
15,
19,
1326,
286,
29051,
486,
6666,
71370,
341,
310,
3628,
25,
3184... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stacked_porep_extract_all_poseidon_sub_8_2() {
test_extract_all::<DiskTree<PoseidonHasher, U8, U2, U0>>();
} | rust_cleaned_test_functions.jsonl/56520 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 69
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
11191,
620,
460,
79,
39123,
5705,
33201,
90456,
5228,
62,
23,
62,
17,
368,
341,
262,
1273,
39123,
5705,
27638,
47583,
6533,
21604,
960,
90456,
6370,
261,
11,
547,
23,
11,
547,
17,
11,
54... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_serde() {
let value = AuditLog {
entries: Vec::new(),
integrations: Vec::new(),
threads: Vec::new(),
users: Vec::new(),
webhooks: Vec::new(),
};
serde_test::assert_tokens(
&value,
&[
Token::Struct {
name: "AuditLog",
len: 5,
},
Token::Str("audit_log_entries"),
Token::Seq { len: Some(0) },
Token::SeqEnd,
Token::Str("integrations"),
Token::Seq { len: Some(0) },
Token::SeqEnd,
Token::Str("threads"),
Token::Seq { len: Some(0) },
Token::SeqEnd,
Token::Str("users"),
Token::Seq { len: Some(0) },
Token::SeqEnd,
Token::Str("webhooks"),
Token::Seq { len: Some(0) },
Token::SeqEnd,
Token::StructEnd,
],
)
} | rust_cleaned_test_functions.jsonl/34662 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 688
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75861,
450,
368,
341,
286,
1077,
897,
284,
47646,
2201,
341,
310,
10695,
25,
11312,
486,
931,
3148,
310,
8761,
804,
25,
11312,
486,
931,
3148,
310,
14564,
25,
11312,
486,
931,
3148,
310,
3847,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_island_backward() {
let info = EmitInfo::new(settings::Flags::new(settings::builder()));
let mut buf = MachBuffer::new();
let mut state = Default::default();
buf.reserve_labels_for_blocks(4);
buf.bind_label(label(0));
let inst = Inst::Nop4;
inst.emit(&mut buf, &info, &mut state);
buf.bind_label(label(1));
let inst = Inst::Nop4;
inst.emit(&mut buf, &info, &mut state);
buf.bind_label(label(2));
while buf.cur_offset() < 2000000 {
let inst = Inst::Nop4;
inst.emit(&mut buf, &info, &mut state);
}
buf.bind_label(label(3));
let inst = Inst::CondBr {
kind: CondBrKind::NotZero(xreg(0)),
taken: target(0),
not_taken: target(1),
};
inst.emit(&mut buf, &info, &mut state);
let buf = buf.finish();
assert_eq!(2000000 + 12, buf.total_size());
let mut buf2 = MachBuffer::new();
let mut state = Default::default();
let inst = Inst::CondBr {
kind: CondBrKind::NotZero(xreg(0)),
taken: BranchTarget::ResolvedOffset(8),
not_taken: BranchTarget::ResolvedOffset(4 - (2000000 + 4)),
};
inst.emit(&mut buf2, &info, &mut state);
let inst = Inst::Jump {
dest: BranchTarget::ResolvedOffset(-(2000000 + 8)),
};
inst.emit(&mut buf2, &info, &mut state);
let buf2 = buf2.finish();
assert_eq!(&buf.data[2000000..], &buf2.data[..]);
} | rust_cleaned_test_functions.jsonl/17889 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 776
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
1933,
70477,
368,
341,
286,
1077,
3546,
284,
61537,
1731,
486,
931,
23369,
486,
9195,
486,
931,
23369,
486,
17850,
7392,
286,
1077,
5206,
6607,
284,
18294,
4095,
486,
931,
543,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_explorer_add_invalid_transaction() {
let (_testkit, api) = init_testkit();
// Send valid transaction.
let keypair = KeyPair::random();
let tx = keypair.reset(SERVICE_ID, ());
let data = hex::encode(tx.to_bytes());
let response = api
.public(ApiKind::Explorer)
.query(&json!({ "tx_body": data }))
.post::<TransactionResponse>("v1/transactions")
.expect("Failed to send valid transaction.");
assert_eq!(response.tx_hash, tx.object_hash());
// Send invalid transaction.
let tx = keypair.reset(SERVICE_ID + 1, ());
let data = hex::encode(tx.to_bytes());
let response = api
.public(ApiKind::Explorer)
.query(&json!({ "tx_body": data }))
.post::<TransactionResponse>("v1/transactions")
.expect_err("Expected transaction send to finish with error.");
assert_eq!(response.http_code, api::HttpStatusCode::BAD_REQUEST);
assert_eq!(
response.body.title,
"Failed to add transaction to memory pool"
);
assert!(response
.body
.detail
.starts_with("Execution error with code"));
assert_eq!(response.body.source, "2:explorer");
} | rust_cleaned_test_functions.jsonl/55303 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 499
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2702,
79825,
2891,
31433,
28884,
368,
341,
262,
1077,
5453,
1944,
8226,
11,
6330,
8,
284,
2930,
4452,
8226,
1428,
262,
442,
11000,
2697,
7745,
624,
262,
1077,
1376,
12670,
284,
5309,
12443,
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_distributions_iter() {
use crate::distributions::Open01;
let mut rng = crate::test::rng(210);
let distr = Open01;
let mut iter = Distribution::<f32>::sample_iter(distr, &mut rng);
let mut sum: f32 = 0.;
for _ in 0..100 {
sum += iter.next().unwrap();
}
assert!(0. < sum && sum < 100.);
} | rust_cleaned_test_functions.jsonl/23055 | {
"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,
814,
17994,
11723,
368,
341,
286,
990,
17717,
486,
67,
17994,
486,
5002,
15,
16,
280,
286,
1077,
5206,
28422,
284,
17717,
486,
1944,
486,
69890,
7,
17,
16,
15,
317,
286,
1077,
7905,
284,
5264,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_meta() {
parse_macro(
r#"
macro_rules! foo {
($ i:meta) => (
#[$ i]
fn bar() {}
)
}
"#,
)
.assert_expand_items(
r#"foo! { cfg(target_os = "windows") }"#,
r#"# [cfg (target_os = "windows")] fn bar () {}"#,
);
} | rust_cleaned_test_functions.jsonl/32683 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 219
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13381,
368,
341,
262,
4715,
58810,
1006,
286,
435,
2,
698,
286,
18072,
21407,
0,
15229,
341,
310,
1711,
600,
25,
5490,
8,
589,
2399,
394,
671,
3442,
600,
921,
394,
5168,
3619,
368,
5613,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eq() {
let first = important_cities();
let second = important_cities().into_iter().rev().collect::<DirectIdMap<_, _>>();
assert_eq!(first, second);
} | rust_cleaned_test_functions.jsonl/38658 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 74
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10714,
368,
341,
262,
1077,
1156,
284,
2989,
666,
1361,
543,
262,
1077,
2086,
284,
2989,
666,
1361,
1005,
18122,
11723,
1005,
7282,
1005,
17384,
27638,
16027,
764,
2227,
27,
6878,
716,
79279,
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 |
#[test]
fn test_deletable_not_readonly() {
with_object(0, |activation, object| {
object.as_script_object().unwrap().define_value(
activation.context.gc_context,
"test",
"initial".into(),
Attribute::DONT_DELETE,
);
assert!(!object.delete(activation, "test"));
assert_eq!(object.get("test", activation).unwrap(), "initial".into());
object
.as_script_object()
.unwrap()
.set("test", "replaced".into(), activation)
.unwrap();
assert!(!object.delete(activation, "test"));
assert_eq!(object.get("test", activation).unwrap(), "replaced".into());
})
} | rust_cleaned_test_functions.jsonl/19715 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 412
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2259,
1149,
480,
7913,
6443,
3243,
368,
341,
286,
448,
5314,
7,
15,
11,
760,
23002,
11,
1633,
91,
341,
310,
1633,
5357,
14660,
5314,
1005,
15454,
1005,
1289,
3142,
1006,
394,
15099,
8681,
65554,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_accounts_trait_for_vec() {
let program_id = Pubkey::default();
let key = Pubkey::default();
let mut lamports1 = 0;
let mut data1 = vec![0; 10];
let owner = Pubkey::default();
let account1 = AccountInfo::new(
&key,
true,
true,
&mut lamports1,
&mut data1,
&owner,
false,
Epoch::default(),
);
let mut lamports2 = 0;
let mut data2 = vec![0; 10];
let account2 = AccountInfo::new(
&key,
true,
true,
&mut lamports2,
&mut data2,
&owner,
false,
Epoch::default(),
);
let mut bumps = std::collections::BTreeMap::new();
let mut accounts = &[account1, account2][..];
let parsed_accounts =
Vec::<Test>::try_accounts(&program_id, &mut accounts, &[], &mut bumps).unwrap();
assert_eq!(accounts.len(), parsed_accounts.len());
} | rust_cleaned_test_functions.jsonl/74418 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 577
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55665,
78491,
5478,
13251,
368,
341,
286,
1077,
2025,
842,
284,
22611,
792,
486,
2258,
1428,
286,
1077,
1376,
284,
22611,
792,
486,
2258,
543,
286,
1077,
5206,
31603,
3394,
16,
284,
220,
15,
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... | 1 |
#[test]
fn test_verse_1() {
assert_eq!(beer::verse(1), "1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.\n");
} | rust_cleaned_test_functions.jsonl/32422 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 72
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
4450,
62,
16,
368,
341,
262,
2060,
10714,
10297,
47795,
486,
4450,
7,
16,
701,
330,
16,
16486,
315,
12883,
389,
279,
7002,
11,
220,
16,
16486,
315,
12883,
7110,
77,
17814,
432,
1495,
323,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_new_jwt() {
let signing_key = CoreRsaPrivateSigningKey::from_pem(
TEST_RSA_PRIV_KEY,
Some(JsonWebKeyId::new(
"bilbo.baggins@hobbiton.example".to_string(),
)),
)
.unwrap();
let new_jwt = JsonWebToken::<
CoreJweContentEncryptionAlgorithm,
_,
_,
_,
JsonWebTokenStringPayloadSerde,
>::new(
TEST_JWT_PAYLOAD.to_owned(),
&signing_key,
&CoreJwsSigningAlgorithm::RsaSsaPkcs1V15Sha256,
)
.unwrap();
assert_eq!(
serde_json::to_value(&new_jwt).expect("failed to serialize"),
serde_json::Value::String(TEST_JWT.to_string())
);
} | rust_cleaned_test_functions.jsonl/66761 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 468
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
95576,
368,
341,
286,
1077,
15971,
3097,
284,
9518,
49,
9081,
16787,
93358,
1592,
486,
1499,
620,
336,
1006,
310,
13602,
76994,
70625,
6600,
345,
310,
4329,
39341,
5981,
81343,
486,
931,
100... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_report_denied_by_policy() {
block_on(async {
let response = json!({"response":{
"server": "prod",
"protocol": "3.0",
"app": [{
"appid": "{00000000-0000-0000-0000-000000000001}",
"status": "ok",
"updatecheck": {
"status": "ok"
}
}],
}});
let response = serde_json::to_vec(&response).unwrap();
let http = MockHttpRequest::new(HttpResponse::new(response));
let policy_engine = MockPolicyEngine {
update_decision: UpdateDecision::DeniedByPolicy,
..MockPolicyEngine::default()
};
let mut state_machine = StateMachineBuilder::new_stub()
.policy_engine(policy_engine)
.http(http)
.build()
.await;
let (response, install_result) = state_machine.oneshot().await.unwrap();
assert_eq!(Action::DeniedByPolicy, response.app_responses[0].result);
assert_eq!(None, install_result);
let request_params = RequestParams::default();
let mut request_builder = RequestBuilder::new(&state_machine.config, &request_params);
let event = Event {
previous_version: Some("1.2.3.4".to_string()),
..Event::error(EventErrorCode::DeniedByPolicy)
};
let apps = state_machine.app_set.to_vec().await;
request_builder = request_builder
.add_event(&apps[0], &event)
.session_id(GUID::from_u128(0))
.request_id(GUID::from_u128(2));
assert_request(state_machine.http, request_builder).await;
});
} | rust_cleaned_test_functions.jsonl/59673 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 954
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14813,
49522,
1122,
3710,
22773,
368,
341,
286,
2504,
4470,
18285,
341,
310,
1077,
2033,
284,
2951,
0,
16864,
2322,
12602,
1060,
330,
4030,
788,
330,
19748,
756,
1060,
330,
17014,
788,
330,
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_del() {
test(b"\x7f", "\u{fffd}\n");
test(
b"\x7fhello\x7fworld\x7f",
"\u{fffd}hello\u{fffd}world\u{fffd}\n",
);
} | rust_cleaned_test_functions.jsonl/36861 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 106
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18029,
368,
341,
262,
1273,
1883,
11934,
87,
22,
69,
497,
2917,
84,
90,
542,
6902,
11035,
77,
797,
262,
1273,
1006,
286,
293,
11934,
87,
22,
69,
14990,
3462,
22,
69,
14615,
3462,
22,
69,
756... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_str_truncate_invalid_len() {
let mut s = String::from("12345");
s.truncate(6);
assert_eq!(s, "12345");
} | rust_cleaned_test_functions.jsonl/3174 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 70
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2895,
3547,
26900,
31433,
6043,
368,
341,
262,
1077,
5206,
274,
284,
923,
486,
1499,
445,
16,
17,
18,
19,
20,
797,
262,
274,
5427,
26900,
7,
21,
317,
262,
2060,
10714,
10297,
82,
11,
330,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_create_tx_input_hd_keypaths() {
use bitcoin::util::bip32::{DerivationPath, Fingerprint};
use std::str::FromStr;
let (wallet, _, _) = get_funded_wallet("wpkh([d34db33f/44'/0'/0']tpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/0/*)");
let addr = wallet.get_new_address().unwrap();
let (psbt, _) = wallet
.create_tx(
TxBuilder::new()
.set_single_recipient(addr.script_pubkey())
.drain_wallet(),
)
.unwrap();
assert_eq!(psbt.inputs[0].hd_keypaths.len(), 1);
assert_eq!(
psbt.inputs[0].hd_keypaths.values().nth(0).unwrap(),
&(
Fingerprint::from_str("d34db33f").unwrap(),
DerivationPath::from_str("m/44'/0'/0'/0/0").unwrap()
)
);
} | rust_cleaned_test_functions.jsonl/11337 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 553
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
17805,
5898,
60111,
3097,
21623,
368,
341,
286,
990,
17873,
486,
1314,
486,
65,
573,
18,
17,
22964,
22171,
39127,
1820,
11,
434,
47918,
2440,
286,
990,
1460,
486,
495,
486,
3830,
2580,
401... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sign_hash() {
let pk = PrivateKey { sk: Scalar::from_bytes(&[10, 145, 220, 128, 41, 236, 187, 134, 47, 34, 61, 132, 196, 20, 201, 239, 33, 80, 184, 182, 49, 79, 15, 212, 4, 73, 201, 248, 74, 226, 158, 12]).unwrap() };
let hash = [1, 95, 34, 213, 221, 202, 70, 0, 221, 118, 193, 93, 225, 200, 19, 73, 208, 8, 176, 53, 150, 73, 22, 154, 1, 71, 181, 38, 9, 102, 191, 35, 227, 112, 10, 208, 171, 43, 191, 43, 110, 164, 130, 8, 57, 101, 243, 19, 1, 47, 253, 198, 50, 95, 79, 61, 237, 164, 140, 88, 176, 124, 187, 181, 163, 22, 62, 109, 184, 189, 146, 112, 115, 9, 160, 33, 102, 163, 4, 181, 208, 41, 88, 149, 177, 103, 137, 99, 174, 49, 132, 6, 227, 20, 225, 203];
let sig = Signature { sig: G1Projective::from(G1Affine::from_uncompressed(&[0, 197, 168, 175, 148, 226, 242, 59, 146, 38, 132, 5, 184, 97, 42, 143, 165, 173, 21, 4, 175, 57, 168, 90, 6, 88, 106, 216, 57, 126, 148, 208, 236, 146, 120, 249, 251, 21, 170, 84, 108, 46, 219, 72, 123, 118, 141, 23, 0, 137, 235, 28, 241, 199, 129, 202, 64, 124, 156, 28, 68, 75, 151, 18, 63, 110, 16, 210, 132, 222, 210, 134, 75, 135, 25, 6, 230, 9, 243, 11, 153, 183, 8, 154, 242, 128, 46, 134, 60, 59, 123, 187, 193, 124, 30, 238]).unwrap()) };
let sig_result = pk.sign_hash(&hash).unwrap();
assert_eq!(G1Affine::from(sig.sig), G1Affine::from(sig_result.sig));
} | rust_cleaned_test_functions.jsonl/131748 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 594
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11172,
8950,
368,
341,
262,
1077,
22458,
284,
9679,
1592,
314,
1901,
25,
35176,
486,
1499,
12524,
2099,
58,
16,
15,
11,
220,
16,
19,
20,
11,
220,
17,
17,
15,
11,
220,
16,
17,
23,
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_change_host() {
let host = StringNonEmpty::static_str("http://localhost:4443");
assert_eq!(
&change_host(&host, &format!("{}/storage/v1/foo", GOOGLE_APIS)).unwrap(),
"http://localhost:4443/storage/v1/foo"
);
let h1 = url::Url::parse(HARDCODED_ENDPOINTS[0]).unwrap();
let h2 = url::Url::parse(HARDCODED_ENDPOINTS[1]).unwrap();
let endpoint = StringNonEmpty::static_str("http://example.com");
assert_eq!(
&change_host(&endpoint, h1.as_str()).unwrap(),
"http://example.com/upload/storage/v1"
);
assert_eq!(
&change_host(&endpoint, h2.as_str()).unwrap(),
"http://example.com/storage/v1"
);
assert_eq!(
&change_host(&endpoint, &format!("{}/foo", h2)).unwrap(),
"http://example.com/storage/v1/foo"
);
assert_matches!(&change_host(&endpoint, "foo"), None);
// if we get the endpoint with suffix "/storage/v1/"
let endpoint = StringNonEmpty::static_str("http://example.com/storage/v1/");
assert_eq!(
&change_host(&endpoint, &format!("{}/foo", h2)).unwrap(),
"http://example.com/storage/v1/foo"
);
let endpoint = StringNonEmpty::static_str("http://example.com/upload/storage/v1/");
assert_eq!(
&change_host(&endpoint, &format!("{}/foo", h2)).unwrap(),
"http://example.com/storage/v1/foo"
);
} | rust_cleaned_test_functions.jsonl/30683 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 755
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15947,
12848,
368,
341,
286,
1077,
3468,
284,
923,
8121,
3522,
486,
1978,
2895,
445,
1254,
1110,
8301,
25,
19,
19,
19,
18,
797,
286,
2060,
10714,
33673,
310,
609,
3373,
12848,
2099,
3790,
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_display() {
let a = BigInt::parse_bytes(b"A", 16).unwrap();
let hello = BigInt::parse_bytes("-22405534230753963835153736737".as_bytes(), 10).unwrap();
assert_eq!(format!("{}", a), "10");
assert_eq!(format!("{}", hello), "-22405534230753963835153736737");
assert_eq!(format!("{:♥>+#8}", a), "♥♥♥♥♥+10");
} | rust_cleaned_test_functions.jsonl/56645 | {
"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,
14825,
368,
341,
262,
1077,
264,
284,
62608,
486,
6400,
12524,
1883,
29133,
497,
220,
16,
21,
568,
15454,
543,
262,
1077,
23811,
284,
62608,
486,
6400,
12524,
13645,
17,
17,
19,
15,
20,
20,
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_encode_flight_data() {
let options = arrow::ipc::writer::IpcWriteOptions::default();
let c1 = UInt32Array::from(vec![1, 2, 3, 4, 5, 6]);
let batch = RecordBatch::try_from_iter(vec![("a", Arc::new(c1) as ArrayRef)])
.expect("cannot create record batch");
let schema = batch.schema();
let (_, baseline_flight_batch) =
arrow_flight::utils::flight_data_from_arrow_batch(&batch, &options);
let big_batch = truncate_batch(&batch, batch.num_rows() - 1);
let optimized_big_batch =
optimize_record_batch(&big_batch, Arc::clone(&schema)).expect("failed to optimize");
let (_, optimized_big_flight_batch) =
arrow_flight::utils::flight_data_from_arrow_batch(&optimized_big_batch, &options);
assert_eq!(
baseline_flight_batch.data_body.len(),
optimized_big_flight_batch.data_body.len()
);
let small_batch = truncate_batch(&batch, 1);
let optimized_small_batch =
optimize_record_batch(&small_batch, Arc::clone(&schema)).expect("failed to optimize");
let (_, optimized_small_flight_batch) =
arrow_flight::utils::flight_data_from_arrow_batch(&optimized_small_batch, &options);
assert!(
baseline_flight_batch.data_body.len() > optimized_small_flight_batch.data_body.len()
);
} | rust_cleaned_test_functions.jsonl/30627 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 614
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
90370,
1769,
368,
341,
286,
1077,
2606,
284,
17921,
486,
68281,
486,
18189,
486,
40,
3992,
7985,
3798,
486,
2258,
543,
286,
1077,
272,
16,
284,
22275,
18,
17,
1857,
486,
1499,
25592,
2070... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_smoke() {
let mut comp = TextInputComponent::new(
SharedTheme::default(),
SharedKeyConfig::default(),
"",
"",
false,
);
comp.set_text(String::from("a\nb"));
assert_eq!(comp.cursor_position, 0);
comp.incr_cursor();
assert_eq!(comp.cursor_position, 1);
comp.decr_cursor();
assert_eq!(comp.cursor_position, 0);
} | rust_cleaned_test_functions.jsonl/771 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 248
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15874,
4740,
368,
341,
286,
1077,
5206,
1367,
284,
42232,
2189,
486,
931,
1006,
310,
16990,
12594,
486,
2258,
3148,
310,
16990,
1592,
2648,
486,
2258,
3148,
310,
8324,
310,
8324,
310,
895,
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_sequence_number_cache() {
// checks potential race where StateDB is lagging
let mut pool = setup_mempool().0;
// callback from consensus should set current sequence number for account
pool.remove_transaction(&TestTransaction::get_address(1), 5, false);
// try to add transaction with sequence number 6 to pool(while last known executed transaction
// for AC is 0)
add_txns_to_mempool(&mut pool, vec![TestTransaction::new(1, 6, 1)]);
// verify that we can execute transaction 6
assert_eq!(pool.get_block(1, HashSet::new()).len(), 1);
} | rust_cleaned_test_functions.jsonl/1802 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 193
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23735,
5500,
11529,
368,
341,
262,
442,
12341,
4650,
6957,
1380,
3234,
3506,
374,
21454,
3173,
198,
262,
1077,
5206,
7314,
284,
6505,
717,
3262,
1749,
1005,
15,
280,
262,
442,
4822,
504,
23869,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_send() {
let mut transport = create_test_transport();
transport.send("127.0.0.1:3000".parse().unwrap(), test_payload());
let packet = &transport.messages[0];
assert_eq!(transport.messages.len(), 1);
assert_eq!(packet.payload, test_payload());
} | rust_cleaned_test_functions.jsonl/62665 | {
"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,
13565,
368,
341,
286,
1077,
5206,
7557,
284,
1855,
4452,
46398,
1428,
286,
7557,
5219,
445,
16,
17,
22,
13,
15,
13,
15,
13,
16,
25,
18,
15,
15,
15,
3263,
6400,
1005,
15454,
1507,
1273,
32813... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_validate_optional_config_val() {
let closure = Url::parse;
let mut config: HashMap<String, String> = HashMap::new();
config.insert("valid".to_string(), DEFAULT_URL.to_string());
config.insert("invalid".to_string(), "invalid_url".to_string());
//Success
assert_eq!(validate_optional_config_val(config.get("valid"), error::INVALID_URL.code_num, closure),
Ok(error::SUCCESS.code_num));
// Success with No config
assert_eq!(validate_optional_config_val(config.get("unknown"), error::INVALID_URL.code_num, closure),
Ok(error::SUCCESS.code_num));
// Fail with failed fn call
assert_eq!(validate_optional_config_val(config.get("invalid"),
error::INVALID_URL.code_num,
closure), Err(error::INVALID_URL.code_num));
} | rust_cleaned_test_functions.jsonl/115825 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 462
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
74644,
5332,
6189,
368,
341,
286,
1077,
21955,
284,
22840,
486,
6400,
280,
286,
1077,
5206,
2193,
25,
10528,
3464,
11,
923,
29,
284,
10528,
486,
931,
543,
286,
2193,
7030,
445,
1891,
3263... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ref_str() {
let a = "a";
let b = "b";
let selections = &[a, b];
assert_eq!(
Select::new().default(0).items(&selections[..]).items,
selections
);
} | rust_cleaned_test_functions.jsonl/17348 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 133
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7793,
2895,
368,
341,
286,
1077,
264,
284,
330,
64,
876,
286,
1077,
293,
284,
330,
65,
3302,
286,
1077,
37399,
284,
44590,
64,
11,
293,
4821,
286,
2060,
10714,
33673,
310,
8427,
486,
931,
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 |
#[test]
fn test_emit_and_read_query() {
let mut message = Message::new();
message
.set_id(10)
.set_message_type(MessageType::Response)
.set_op_code(OpCode::Update)
.set_authoritative(true)
.set_truncated(true)
.set_recursion_desired(true)
.set_recursion_available(true)
.set_response_code(ResponseCode::ServFail)
.add_query(Query::new())
.update_counts();
test_emit_and_read(message);
} | rust_cleaned_test_functions.jsonl/23869 | {
"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,
69082,
8378,
6443,
5738,
368,
341,
262,
1077,
5206,
1943,
284,
4856,
486,
931,
543,
262,
1943,
198,
286,
659,
746,
842,
7,
16,
15,
340,
286,
659,
746,
6462,
1819,
29359,
929,
486,
2582,
340,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_public_key() {
let multiplier = Big::new_int(5);
let mut point = GroupG1::generator();
point = point.mul(&multiplier);
let public_key = PublicKey {
point: point.clone(),
};
let aggregate_public_key = AggregatePublicKey::from_public_key(&public_key);
assert_eq!(public_key.point, aggregate_public_key.point);
} | rust_cleaned_test_functions.jsonl/112223 | {
"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,
5673,
27074,
3097,
368,
341,
286,
1077,
30559,
284,
6164,
486,
931,
4042,
7,
20,
317,
286,
1077,
5206,
1459,
284,
5737,
38,
16,
486,
35851,
543,
286,
1459,
284,
1459,
53141,
2099,
26268,
7875,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_remove_suffix() {
new_ucmd!()
.args(&["/usr/local/bin/reallylongexecutable.exe", ".exe"])
.succeeds()
.stdout_only("reallylongexecutable\n");
} | rust_cleaned_test_functions.jsonl/82221 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
37151,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
14,
7063,
22270,
8749,
10758,
745,
4825,
95924,
19399,
497,
5933,
46184,
14108,
286,
659,
82,
29264,
82,
741,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_bn128_sign_g1_one() {
let sk = FromHex::from_hex(
"0f6b8785374476a3b3e4bde2c64dfb12964c81c7930d32367c8e318609387872"
).unwrap();
let mut public_key = [0u8; 128];
let expected = FromHex::from_hex(
"\
1bab5671c5107de67fe06007dde240a84674c8ff13eeac6d64bad0caf2cfe53e\
270567a05b56b02e813281d554f46ce0c1b742b622652ef5a41d69afb6eb8338\
02b54a5deaaf86dc7f03d080c8373d62f03b3be06dac42b2d9426a8ebd0caf4a\
0142f4e04fc1402e17ae7e624fd9bd15f1eae0a1d8eda4e26ab70fd4cd793338",
).unwrap();
bn128_derive_pk(&sk, &mut public_key).expect("Builtin should not fail");
assert_eq!(public_key.to_vec(), expected);
let fr = read_fr(&sk).unwrap();
let mut sign_bytes = [0u8; 64];
if let Some(mul) = bn::AffineG1::from_jacobian(bn::G1::one() * fr) {
// point not at infinity
mul.x()
.to_big_endian(&mut sign_bytes[0..32])
.expect("Cannot fail since 0..32 is 32-byte length");
mul.y()
.to_big_endian(&mut sign_bytes[32..64])
.expect("Cannot fail since 32..64 is 32-byte length");
}
// G1 into bytes
let mut g1_bytes = [0u8; 64];
if let Some(g1) = bn::AffineG1::from_jacobian(bn::G1::one()) {
// point not at infinity
g1.x()
.to_big_endian(&mut g1_bytes[0..32])
.expect("Cannot fail since 0..32 is 32-byte length");
g1.y()
.to_big_endian(&mut g1_bytes[32..64])
.expect("Cannot fail since 32..64 is 32-byte length");
}
// G2 into bytes
let mut g2_bytes = [0u8; 128];
if let Some(g2) = bn::AffineG2::from_jacobian(bn::G2::one()) {
// point not at infinity
g2.x().imaginary()
.to_big_endian(&mut g2_bytes[0..32])
.expect("Cannot fail since 0..32 is 32-byte length");
g2.x().real()
.to_big_endian(&mut g2_bytes[32..64])
.expect("Cannot fail since 32..64 is 32-byte length");
g2.y().imaginary()
.to_big_endian(&mut g2_bytes[64..96])
.expect("Cannot fail since 0..32 is 32-byte length");
g2.y().real()
.to_big_endian(&mut g2_bytes[96..128])
.expect("Cannot fail since 32..64 is 32-byte length");
}
// Verify BLS concatenating BLS pairing inputs
let mut pairing_input = vec![];
pairing_input.extend_from_slice(&g1_bytes);
pairing_input.extend_from_slice(&public_key);
assert_eq!(pairing_input.len(), 192);
pairing_input.extend_from_slice(&sign_bytes);
pairing_input.extend_from_slice(&g2_bytes);
assert_eq!(pairing_input.len(), 192*2);
let mut output = [0u8; 32];
let mut output_expected = [0u8; 32];
output_expected[31] = 1u8;
bn128_pairing(&pairing_input, &mut output).expect("pairing check failed");
// assert_eq!(
// "pairing check did not evaluate to 1"
let secret_key_scalar = read_fr(&sk).unwrap();
let public_key_point = bn::G2::one() * secret_key_scalar;
let pairing1 = bn::pairing(bn::G1::one(), public_key_point);
let signature_point = bn::G1::one() * secret_key_scalar;
let pairing2 = bn::pairing(signature_point, bn::G2::one());
println!("------------ verification 1: {:?}", pairing1 == pairing2);
assert!(pairing1 == pairing2);
let batch = pairing_batch(&[
(bn::G1::one(), public_key_point),
(-signature_point, bn::G2::one())
]);
println!("------------ verification 2: {:?}", batch == bn::Gt::one());
// TODO: uncomment
assert!(batch == bn::Gt::one());
} | rust_cleaned_test_functions.jsonl/103164 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58112,
16,
17,
23,
11172,
1889,
16,
11667,
368,
341,
286,
1077,
1901,
284,
5542,
20335,
486,
1499,
32655,
1006,
310,
330,
15,
69,
21,
65,
23,
22,
23,
20,
18,
22,
19,
19,
22,
21,
64,
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... | 4 |
#[test]
fn test_merge_single_paths() {
let items = vec![
Path::new("a/b/c"),
Path::new("a/b/d"),
];
//0 a/b/
//1 c
//2 d
let tree =
FileTreeItems::new(&items, &BTreeSet::new()).unwrap();
let mut it = tree
.iterate(0, 10)
.map(|(_, item)| item.info().full_path_str());
assert_eq!(it.next().unwrap(), "a/b");
assert_eq!(it.next().unwrap(), "a/b/c");
assert_eq!(it.next().unwrap(), "a/b/d");
assert_eq!(it.next(), None);
} | rust_cleaned_test_functions.jsonl/129804 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 243
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20888,
19487,
24152,
368,
341,
197,
10217,
3589,
284,
7486,
90515,
298,
69640,
486,
931,
445,
64,
3470,
2899,
3975,
715,
298,
69640,
486,
931,
445,
64,
3470,
3446,
3975,
715,
197,
197,
4821,
197... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cstr_mut_write_too_much() {
let mut buf = vec![0; 9];
let mut cstr_mut = unsafe { CStrMut::new(buf.as_mut_ptr(), buf.len()) };
use std::fmt::Write;
let _ = write!(&mut cstr_mut, "test foo ");
} | rust_cleaned_test_functions.jsonl/42138 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
495,
29523,
9165,
2346,
78,
717,
1387,
368,
341,
286,
1077,
5206,
6607,
284,
7486,
20703,
15,
26,
220,
24,
935,
286,
1077,
5206,
272,
495,
29523,
284,
19860,
314,
356,
2580,
51440,
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_reader_rng_fill_bytes() {
let v = [1u8, 2, 3, 4, 5, 6, 7, 8];
let mut w = [0u8, .. 8];
let mut rng = ReaderRng::new(MemReader::new(Vec::from_slice(v)));
rng.fill_bytes(w);
assert!(v == w);
} | rust_cleaned_test_functions.jsonl/37244 | {
"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,
22306,
66849,
30728,
12524,
368,
341,
286,
1077,
348,
284,
508,
16,
84,
23,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,
11,
220,
22,
11,
220,
23,
935,
286,
1077,
520... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_json_as_real() {
let cs: Vec<(Json, f64, Option<i32>)> = vec![
(Json::from_object(BTreeMap::default()).unwrap(), 0f64, None),
(Json::from_array(vec![]).unwrap(), 0f64, None),
(Json::from_i64(10).unwrap(), 10f64, None),
(Json::from_i64(i64::MAX).unwrap(), i64::MAX as f64, None),
(Json::from_i64(i64::MIN).unwrap(), i64::MIN as f64, None),
(Json::from_u64(0).unwrap(), 0f64, None),
(Json::from_u64(u64::MAX).unwrap(), u64::MAX as f64, None),
(Json::from_f64(f64::MAX).unwrap(), f64::MAX, None),
(Json::from_f64(f64::MIN).unwrap(), f64::MIN, None),
(Json::from_string(String::from("10.0")).unwrap(), 10.0, None),
(
Json::from_string(String::from("-10.0")).unwrap(),
-10.0,
None,
),
(Json::from_bool(true).unwrap(), 1f64, None),
(Json::from_bool(false).unwrap(), 0f64, None),
(Json::none().unwrap(), 0f64, None),
(
Json::from_string((0..500).map(|_| '9').collect::<String>()).unwrap(),
f64::MAX,
Some(ERR_TRUNCATE_WRONG_VALUE),
),
(
Json::from_string(
(0..500)
.map(|x| if x == 0 { '-' } else { '9' })
.collect::<String>(),
)
.unwrap(),
f64::MIN,
Some(ERR_TRUNCATE_WRONG_VALUE),
),
];
for (input, expect, err_code) in cs {
let mut ctx = CtxConfig {
truncate_as_warning: true,
..CtxConfig::default()
}
.into();
let r = cast_json_as_any::<Real>(&mut ctx, Some(input.as_ref()));
let r = r.map(|x| x.map(|x| x.into_inner()));
let log = make_log(&input, &expect, &r);
check_result(Some(&expect), &r, log.as_str());
check_warning(&ctx, err_code, log.as_str());
}
} | rust_cleaned_test_functions.jsonl/1967 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1278
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9455,
11898,
15266,
368,
341,
286,
1077,
10532,
25,
11312,
28706,
5014,
11,
282,
21,
19,
11,
6959,
21897,
18,
17,
9231,
29,
284,
7486,
90515,
3374,
310,
320,
5014,
486,
1499,
5314,
5349,
6533,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_token_disk_parsing() {
let from_disk = Config {
vault: VaultConfig {
namespace: None,
server: "127.0.0.1:8200".to_string(),
ca_certificate: None,
token: Token::FromDisk(TokenFromDisk {
path: PathBuf::from("/token"),
}),
},
};
let text_from_disk = "
[vault]
server = \"127.0.0.1:8200\"
[vault.token]
type = \"from_disk\"
path = \"/token\"
";
let de_from_disk: Config = toml::from_str(text_from_disk).unwrap();
assert_eq!(de_from_disk, from_disk);
toml::to_string(&from_disk).unwrap();
} | rust_cleaned_test_functions.jsonl/134636 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 391
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6458,
41687,
620,
28598,
368,
341,
286,
1077,
504,
41687,
284,
5532,
341,
310,
34584,
25,
41397,
2648,
341,
394,
4473,
25,
2240,
345,
394,
3538,
25,
330,
16,
17,
22,
13,
15,
13,
15,
13,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_six() {
// Negative dimension
let box1 = &[10, 15, 50, 40];
let box2 = &[12, 16, -30, -20];
assert_eq!(overlaps(&box1, &box2), false);
} | rust_cleaned_test_functions.jsonl/71432 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
941,
368,
341,
286,
442,
50857,
12871,
198,
286,
1077,
3745,
16,
284,
44590,
16,
15,
11,
220,
16,
20,
11,
220,
20,
15,
11,
220,
19,
15,
935,
286,
1077,
3745,
17,
284,
44590,
16,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_fuel_load_req() {
assert_eq!(get_fuel_load_req(12), 2);
assert_eq!(get_fuel_load_req(14), 2);
assert_eq!(get_fuel_load_req(1969), 966);
assert_eq!(get_fuel_load_req(100756), 50346);
} | rust_cleaned_test_functions.jsonl/13580 | {
"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,
3062,
761,
4000,
12411,
17644,
368,
341,
286,
2060,
10714,
10297,
455,
761,
4000,
12411,
17644,
7,
16,
17,
701,
220,
17,
317,
286,
2060,
10714,
10297,
455,
761,
4000,
12411,
17644,
7,
16,
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_invalid() {
assert_eq!(lex(""), (Token::Invalid, 0));
assert_eq!(lex("$"), (Token::Invalid, 1));
assert_eq!(lex("$$"), (Token::Invalid, 2));
assert_eq!(lex("$0"), (Token::Invalid, 1));
} | rust_cleaned_test_functions.jsonl/80512 | {
"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,
31433,
368,
341,
286,
2060,
10714,
10297,
2571,
86076,
320,
3323,
486,
7928,
11,
220,
15,
1106,
286,
2060,
10714,
10297,
2571,
20912,
3975,
320,
3323,
486,
7928,
11,
220,
16,
1106,
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_block_string_value() {
assert_eq!(block_string_value(""), "");
assert_eq!(block_string_value("\r\n"), "");
assert_eq!(block_string_value("\r\r\r\r\n\n\r\n\r\r"), "");
assert_eq!(block_string_value("abc"), "abc");
assert_eq!(
block_string_value("line 1\r\n line 2\n line 3\r line 4"),
"line 1\nline 2\n line 3\n line 4"
);
assert_eq!(
block_string_value("\r\r some text\r\n \n \n "),
"some text"
);
assert_eq!(
block_string_value(
r#"
a
b
c
"#
),
"a\nb\n\nc"
);
} | rust_cleaned_test_functions.jsonl/587 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 344
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7113,
3904,
3142,
368,
341,
262,
2060,
10714,
10297,
4574,
3904,
3142,
86076,
14498,
262,
2060,
10714,
10297,
4574,
3904,
3142,
4921,
81,
1699,
3975,
14498,
262,
2060,
10714,
10297,
4574,
3904,
3142... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_empty() {
let res = Query::Single("".into()).exec().unwrap();
assert!(
!res.is_any_target(),
"empty query should return non-empty result"
);
} | rust_cleaned_test_functions.jsonl/12671 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
368,
341,
286,
1077,
592,
284,
11361,
486,
10888,
445,
3263,
18122,
6011,
11748,
1005,
15454,
543,
286,
2060,
33673,
310,
753,
416,
2079,
37248,
11123,
3148,
310,
330,
3194,
3239,
1265,
470... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_outbound_peers_if_min_is_not_satisfied() {
let config: GossipsubConfig = GossipsubConfig::default();
// Fill full mesh with inbound peers
let (mut gs, peers, topics) = inject_nodes1()
.peer_no(config.mesh_n_high())
.topics(vec!["test".into()])
.to_subscribe(true)
.create_network();
// graft all the peers
for peer in peers {
gs.handle_graft(&peer, topics.clone());
}
for _ in 0..config.mesh_outbound_min() {
add_peer(&mut gs, &topics, true, false);
}
// Nothing changed in the mesh yet
assert_eq!(gs.mesh[&topics[0]].len(), config.mesh_n_high());
// run a heartbeat
gs.heartbeat();
// The outbound peers got additionally added
assert_eq!(
gs.mesh[&topics[0]].len(),
config.mesh_n_high() + config.mesh_outbound_min()
);
} | rust_cleaned_test_functions.jsonl/66907 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 498
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
6068,
10891,
36367,
388,
11119,
7260,
6892,
7913,
643,
46265,
368,
341,
286,
1077,
2193,
25,
479,
41473,
1966,
2648,
284,
479,
41473,
1966,
2648,
486,
2258,
1428,
286,
442,
21979,
2480,
1129... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_css_border_2() {
assert_eq!(
parse_style_border("double"),
Ok(StyleBorderSide {
border_width: PixelValue::px(3.0),
border_style: BorderStyle::Double,
border_color: ColorU {
r: 0,
g: 0,
b: 0,
a: 255
},
})
);
} | rust_cleaned_test_functions.jsonl/114001 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 290
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
25924,
31940,
62,
17,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
15117,
31940,
445,
4331,
4461,
310,
7622,
7,
2323,
10691,
16384,
341,
394,
3886,
7927,
25,
27469,
1130,
486,
1767,
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... | 1 |
#[test]
fn test_eval_nhwc_2() {
setup_test_logger();
let op = Conv::default().nhwc().hwio().padding(PaddingSpec::SameUpper);
let i = rctensor4(&[[[[0.0f32, 0.0], [1.0, 0.0]]]]);
let k = rctensor4(&[[[[0.0f32], [0.0]], [[1.0], [0.0]]]]);
let e = rctensor4(&[[[[1.0f32], [0.0]]]]);
let res = op.eval(tvec!(i, k)).unwrap();
assert_eq!(res, tvec!(e.into()));
} | rust_cleaned_test_functions.jsonl/51977 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 237
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21296,
93934,
24028,
62,
17,
368,
341,
286,
6505,
4452,
27413,
543,
286,
1077,
1179,
284,
28988,
486,
2258,
1005,
16719,
24028,
1005,
27827,
815,
1005,
9571,
5304,
2998,
8327,
486,
19198,
14251,
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_peekable() {
let path = TempDir::new("test-raftstore").unwrap();
let engines = new_temp_engine(&path);
let mut r = Region::new();
r.set_id(10);
r.set_start_key(b"key0".to_vec());
r.set_end_key(b"key4".to_vec());
let store = new_peer_storage(engines.clone(), &r);
let (key1, value1) = (b"key1", 2u64);
engines.kv.put_u64(&data_key(key1), value1).expect("");
let (key2, value2) = (b"key2", 2i64);
engines.kv.put_i64(&data_key(key2), value2).expect("");
let key3 = b"key3";
engines.kv.put_msg(&data_key(key3), &r).expect("");
let snap = RegionSnapshot::new(&store);
let v1 = snap.get_u64(key1).expect("");
assert_eq!(v1, Some(value1));
let v2 = snap.get_i64(key2).expect("");
assert_eq!(v2, Some(value2));
let v3 = snap.get_msg(key3).expect("");
assert_eq!(v3, Some(r));
let v0 = snap.get_value(b"key0").expect("");
assert!(v0.is_none());
let v4 = snap.get_value(b"key5");
assert!(v4.is_err());
} | rust_cleaned_test_functions.jsonl/7196 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 584
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
29107,
480,
368,
341,
286,
1077,
1815,
284,
19944,
6184,
486,
931,
445,
1944,
12,
2944,
4314,
1827,
15454,
543,
286,
1077,
21106,
284,
501,
11771,
24823,
2099,
2343,
317,
286,
1077,
5206,
43... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serialize_info_depth() {
let attributes: Vec<UciInfoAttribute> = vec![
UciInfoAttribute::Depth(24)
];
let m = UciMessage::Info(attributes);
assert_eq!(m.serialize(), "info depth 24");
} | rust_cleaned_test_functions.jsonl/19055 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
3109,
19061,
368,
341,
286,
1077,
8201,
25,
11312,
36397,
5855,
1731,
3907,
29,
284,
7486,
90515,
310,
547,
5855,
1731,
3907,
486,
19776,
7,
17,
19,
340,
286,
15424,
286,
1077,
296,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_public_key_credential_rp_entity() {
let cbor_rp_entity = cbor_map! {
"id" => "example.com",
"name" => "Example",
"icon" => "example.com/icon.png",
};
let rp_entity = PublicKeyCredentialRpEntity::try_from(cbor_rp_entity);
let expected_rp_entity = PublicKeyCredentialRpEntity {
rp_id: "example.com".to_string(),
rp_name: Some("Example".to_string()),
rp_icon: Some("example.com/icon.png".to_string()),
};
assert_eq!(rp_entity, Ok(expected_rp_entity));
} | rust_cleaned_test_functions.jsonl/48999 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 312
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
27074,
3097,
666,
30320,
83440,
19169,
368,
341,
286,
1077,
272,
9368,
83440,
19169,
284,
272,
9368,
5376,
0,
341,
310,
330,
307,
1,
589,
330,
8687,
905,
756,
310,
330,
606,
1,
589,
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_write() {
const INITIAL: &[u8] = b"abcdef123456";
let wbuf = "CDEF".to_string().into_bytes();
let mut rbuf = Vec::new();
const EXPECT: &[u8] = b"abCDEF123456";
let mut f = tempfile().unwrap();
f.write_all(INITIAL).unwrap();
let mut aiocb = AioCb::from_slice( f.as_raw_fd(),
2, //offset
&wbuf,
0, //priority
SigevNotify::SigevNone,
LioOpcode::LIO_NOP);
aiocb.write().unwrap();
let err = poll_aio(&mut aiocb);
assert_eq!(err, Ok(()));
assert_eq!(aiocb.aio_return().unwrap() as usize, wbuf.len());
f.seek(SeekFrom::Start(0)).unwrap();
let len = f.read_to_end(&mut rbuf).unwrap();
assert_eq!(len, EXPECT.len());
assert_eq!(rbuf, EXPECT);
} | rust_cleaned_test_functions.jsonl/90414 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 476
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
368,
341,
262,
733,
56854,
25,
44590,
84,
23,
60,
284,
293,
1,
41202,
16,
17,
18,
19,
20,
21,
876,
262,
1077,
289,
5909,
284,
330,
34,
13649,
3263,
983,
3904,
1005,
18122,
12524,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_issue_2() {
// See: https://github.com/sile/libflate/issues/2
assert_encode_decode!([
163, 181, 167, 40, 62, 239, 41, 125, 189, 217, 61, 122, 20, 136, 160, 178, 119, 217,
217, 41, 125, 189, 97, 195, 101, 47, 170,
]);
assert_encode_decode!([
162, 58, 99, 211, 7, 64, 96, 36, 57, 155, 53, 166, 76, 14, 238, 66, 66, 148, 154, 124,
162, 58, 99, 188, 138, 131, 171, 189, 54, 229, 192, 38, 29, 240, 122, 28,
]);
assert_encode_decode!([
239, 238, 212, 42, 5, 46, 186, 67, 122, 247, 30, 61, 219, 62, 228, 202, 164, 205, 139,
109, 99, 181, 99, 181, 99, 122, 30, 12, 62, 46, 27, 145, 241, 183, 137,
]);
assert_encode_decode!([
88, 202, 64, 12, 125, 108, 153, 49, 164, 250, 71, 19, 4, 108, 111, 108, 237, 205, 208,
77, 217, 100, 118, 49, 10, 64, 12, 125, 51, 202, 69, 67, 181, 146, 86,
]);
} | rust_cleaned_test_functions.jsonl/37991 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 521
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53340,
62,
17,
368,
341,
286,
442,
3496,
25,
3703,
1110,
5204,
905,
2687,
457,
8194,
16716,
38745,
14,
17,
198,
286,
2060,
11224,
15227,
0,
8956,
310,
220,
16,
21,
18,
11,
220,
16,
23,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_array2() {
// 5x3 image
let image = [00, 01, 02, 03, 04, 10, 11, 12, 13, 14, 20, 21, 22, 23, 24];
let image_array = ArrayView2::from_shape((3, 5), &image).unwrap();
assert_eq!(image_array[(0, 0)], 00);
assert_eq!(image_array[(0, 2)], 02);
assert_eq!(image_array[(2, 3)], 23);
} | rust_cleaned_test_functions.jsonl/28789 | {
"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,
3858,
17,
368,
341,
262,
442,
220,
20,
87,
18,
2168,
198,
262,
1077,
2168,
284,
508,
15,
15,
11,
220,
15,
16,
11,
220,
15,
17,
11,
220,
15,
18,
11,
220,
15,
19,
11,
220,
16,
15,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_not_clean() {
let (c, coprocessor_host) = new_test_collector();
start_collecting(&c, 1).unwrap();
// The value is not a valid lock.
let (k, v) = (Key::from_raw(b"k1").into_encoded(), b"v1".to_vec());
let req = make_apply_request(k.clone(), v.clone(), CF_LOCK, CmdType::Put);
coprocessor_host.post_apply(&Region::default(), &make_raft_cmd(vec![req]));
assert_eq!(get_collected_locks(&c, 1).unwrap(), (vec![], false));
// `is_clean` should be reset after invoking `start_collecting`.
start_collecting(&c, 2).unwrap();
assert_eq!(get_collected_locks(&c, 2).unwrap(), (vec![], true));
coprocessor_host.post_apply_plain_kvs_from_snapshot(
&Region::default(),
CF_LOCK,
&[(keys::data_key(&k), v)],
);
assert_eq!(get_collected_locks(&c, 2).unwrap(), (vec![], false));
start_collecting(&c, 3).unwrap();
assert_eq!(get_collected_locks(&c, 3).unwrap(), (vec![], true));
let mut lock = LockInfo::default();
lock.set_key(b"k2".to_vec());
lock.set_primary_lock(b"k2".to_vec());
lock.set_lock_type(Op::Put);
lock.set_lock_version(1);
let batch_generate_locks = |count| {
let (k, v) = lock_info_to_kv(lock.clone());
let req = make_apply_request(k, v, CF_LOCK, CmdType::Put);
let raft_cmd = make_raft_cmd(vec![req; count]);
coprocessor_host.post_apply(&Region::default(), &raft_cmd);
};
batch_generate_locks(MAX_COLLECT_SIZE - 1);
let (locks, is_clean) = get_collected_locks(&c, 3).unwrap();
assert_eq!(locks.len(), MAX_COLLECT_SIZE - 1);
assert!(is_clean);
batch_generate_locks(1);
let (locks, is_clean) = get_collected_locks(&c, 3).unwrap();
assert_eq!(locks.len(), MAX_COLLECT_SIZE);
assert!(!is_clean);
batch_generate_locks(1);
let (locks, is_clean) = get_collected_locks(&c, 3).unwrap();
assert_eq!(locks.len(), MAX_COLLECT_SIZE);
assert!(!is_clean);
start_collecting(&c, 4).unwrap();
assert_eq!(get_collected_locks(&c, 4).unwrap(), (vec![], true));
batch_generate_locks(MAX_COLLECT_SIZE - 5);
let (locks, is_clean) = get_collected_locks(&c, 4).unwrap();
assert_eq!(locks.len(), MAX_COLLECT_SIZE - 5);
assert!(is_clean);
batch_generate_locks(10);
let (locks, is_clean) = get_collected_locks(&c, 4).unwrap();
assert_eq!(locks.len(), MAX_COLLECT_SIZE);
assert!(!is_clean);
} | rust_cleaned_test_functions.jsonl/15211 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1296
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7913,
19573,
368,
341,
286,
1077,
320,
66,
11,
6162,
40848,
269,
12848,
8,
284,
501,
4452,
10211,
27669,
543,
286,
1191,
68140,
287,
2099,
66,
11,
220,
16,
568,
15454,
543,
1789,
286,
442,
576... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_status() {
let k = "key123";
assert_done(move || {
let bucket_name = "bucket".to_owned();
let request = Request::new(Method::Status, Some(bucket_name.clone()), Some(k.to_owned()));
let timer = MockTimeGenerator::new(vec![0, 3]);
let now = timer.now().to_timespec().sec;
let database = MockDatabase::default();
database.put(bucket_name.as_bytes(), k.as_bytes(), format!("{{\"content\":0,\"lastDrip\":{}}}", now * 1000).as_bytes());
let mut buckets = Buckets::default();
let bucket = Bucket::new("bucket".to_owned(), 1000, 1, 10);
buckets.add(bucket);
let data = HandlerData::new_t(database, buckets, timer);
let response = Response::default();
assert!(!response.pong_response);
handle(&request, response, Arc::new(data)).map(|r| {
r.status_response
})
}, Ok(Some(vec![(k.to_owned(), 3, 1234567900, 10)])));
} | rust_cleaned_test_functions.jsonl/50364 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 490
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4773,
368,
341,
286,
1077,
595,
284,
330,
792,
16,
17,
18,
3302,
286,
2060,
24390,
34081,
1369,
341,
310,
1077,
15621,
1269,
284,
330,
30410,
3263,
983,
51973,
543,
310,
1077,
1681,
284,
6145,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.