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_can_issue_not_existing_getinfo() {
let mut c = run_testing_tor_instance(
&[
"--DisableNetwork", "1",
"--ControlPort", &TOR_TESTING_PORT.to_string(),
]);
block_on_with_env(async move {
let mut s = TcpStream::connect(&format!("127.0.0.1:{}", TOR_TESTING_PORT)).await.unwrap();
let mut utc = UnauthenticatedConn::new(s);
let proto_info = utc.load_protocol_info().await.unwrap();
assert!(proto_info.auth_methods.contains(&TorAuthMethod::Null));
utc.authenticate(&TorAuthData::Null).await.unwrap();
let mut ac = utc.into_authenticated().await;
ac.set_async_event_handler(Some(|_| {
async move { Ok(()) }
}));
ac.get_info_unquote("blah/blah/blah").await.unwrap_err();
ac.get_info("blah/blah/blah").await.unwrap_err();
});
} | rust_cleaned_test_functions.jsonl/58489 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 504
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27421,
53340,
7913,
62630,
3062,
2733,
368,
341,
286,
1077,
5206,
272,
284,
1598,
70962,
528,
269,
11904,
1006,
310,
609,
9640,
394,
14482,
25479,
12320,
497,
330,
16,
756,
394,
14482,
3273,
7084,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_root() {
assert_eq!(Facet::root(), Facet::from("/"));
assert_eq!(format!("{}", Facet::root()), "/");
assert!(Facet::root().is_root());
} | rust_cleaned_test_functions.jsonl/117272 | {
"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,
12993,
368,
341,
286,
2060,
10714,
10297,
28702,
295,
486,
2888,
1507,
16945,
295,
486,
1499,
4283,
4010,
286,
2060,
10714,
10297,
2243,
79878,
16945,
295,
486,
2888,
11858,
97539,
286,
2060,
10297,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_extend_zst() {
let mut range = 0..10;
#[derive(Copy, Clone, PartialEq, Debug)]
struct Z; // Zero sized type
let mut array: ArrayVec<[_; 5]> = range.by_ref().map(|_| Z).collect();
assert_eq!(&array[..], &[Z; 5]);
assert_eq!(range.next(), Some(5));
array.extend(range.by_ref().map(|_| Z));
assert_eq!(range.next(), Some(6));
let mut array: ArrayVec<[_; 10]> = (0..3).map(|_| Z).collect();
assert_eq!(&array[..], &[Z; 3]);
array.extend((3..5).map(|_| Z));
assert_eq!(&array[..], &[Z; 5]);
assert_eq!(array.len(), 5);
} | rust_cleaned_test_functions.jsonl/36796 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 278
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70265,
6415,
267,
368,
341,
262,
1077,
5206,
2088,
284,
220,
15,
496,
16,
15,
280,
262,
11506,
27098,
3025,
1266,
11,
27913,
11,
55039,
11,
11091,
5563,
262,
2036,
1863,
26,
442,
18306,
29287,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lottery_mean() {
let result = get_actual_result("test_csvs/Lottery.csv", "mean");
assert_abs_diff_eq!(result, 518.958715596330, epsilon = mean_epsilon());
} | rust_cleaned_test_functions.jsonl/80546 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 83
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
91849,
17615,
16933,
368,
341,
262,
1077,
1102,
284,
633,
40149,
5287,
445,
1944,
14020,
82,
7434,
354,
17615,
11219,
497,
330,
14287,
797,
262,
2060,
31170,
15850,
10714,
10297,
1382,
11,
220,
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 |
#[test]
fn test_parse_arguments_color() {
let h = parses!(
"--emit",
"link",
"foo.rs",
"--out-dir",
"out",
"--crate-name",
"foo",
"--crate-type",
"lib"
);
assert_eq!(h.color_mode, ColorMode::Auto);
let h = parses!(
"--emit",
"link",
"foo.rs",
"--out-dir",
"out",
"--crate-name",
"foo",
"--crate-type",
"lib",
"--color=always"
);
assert_eq!(h.color_mode, ColorMode::On);
let h = parses!(
"--emit",
"link",
"foo.rs",
"--out-dir",
"out",
"--crate-name",
"foo",
"--crate-type",
"lib",
"--color=never"
);
assert_eq!(h.color_mode, ColorMode::Off);
let h = parses!(
"--emit",
"link",
"foo.rs",
"--out-dir",
"out",
"--crate-name",
"foo",
"--crate-type",
"lib",
"--color=auto"
);
assert_eq!(h.color_mode, ColorMode::Auto);
} | rust_cleaned_test_functions.jsonl/8162 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 873
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
43433,
6714,
368,
341,
286,
1077,
305,
284,
70835,
33673,
310,
14482,
18712,
756,
310,
330,
2080,
756,
310,
330,
7975,
25638,
756,
310,
14482,
411,
45283,
756,
310,
330,
411,
756,
310,
14... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_writer() {
let mut reader = Reader::new(BED_FILE);
let mut writer = Writer::new(vec![]);
for r in reader.records() {
writer
.write(&r.expect("Error reading record"))
.expect("Error writing record");
}
assert_eq!(writer.inner.into_inner().unwrap(), BED_FILE);
} | rust_cleaned_test_functions.jsonl/3948 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 183
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28908,
368,
341,
286,
1077,
5206,
6604,
284,
25166,
486,
931,
5349,
1479,
8087,
317,
286,
1077,
5206,
6916,
284,
29404,
486,
931,
25592,
0,
56703,
286,
369,
435,
304,
6604,
64516,
368,
341,
310,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_blockorder_diamond() {
let func = build_test_func(4, &[(0, 1), (0, 2), (1, 3), (2, 3)]);
let order = BlockLoweringOrder::new(&func);
assert_eq!(order.lowered_order.len(), 6);
assert!(order.lowered_order[0].orig_block().unwrap().as_u32() == 0);
assert!(order.lowered_order[0].in_edge().is_none());
assert!(order.lowered_order[0].out_edge().is_none());
assert!(order.lowered_order[1].orig_block().unwrap().as_u32() == 1);
assert!(order.lowered_order[1].in_edge().unwrap().0.as_u32() == 0);
assert!(order.lowered_order[1].in_edge().unwrap().2.as_u32() == 1);
assert!(order.lowered_order[2].orig_block().is_none());
assert!(order.lowered_order[2].in_edge().is_none());
assert!(order.lowered_order[2].out_edge().unwrap().0.as_u32() == 1);
assert!(order.lowered_order[2].out_edge().unwrap().2.as_u32() == 3);
assert!(order.lowered_order[3].orig_block().unwrap().as_u32() == 2);
assert!(order.lowered_order[3].in_edge().unwrap().0.as_u32() == 0);
assert!(order.lowered_order[3].in_edge().unwrap().2.as_u32() == 2);
assert!(order.lowered_order[3].out_edge().is_none());
assert!(order.lowered_order[4].orig_block().is_none());
assert!(order.lowered_order[4].in_edge().is_none());
assert!(order.lowered_order[4].out_edge().unwrap().0.as_u32() == 2);
assert!(order.lowered_order[4].out_edge().unwrap().2.as_u32() == 3);
assert!(order.lowered_order[5].orig_block().unwrap().as_u32() == 3);
assert!(order.lowered_order[5].in_edge().is_none());
assert!(order.lowered_order[5].out_edge().is_none());
} | rust_cleaned_test_functions.jsonl/21790 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 800
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7113,
1358,
814,
18479,
368,
341,
286,
1077,
2915,
284,
1936,
4452,
9596,
7,
19,
11,
609,
9697,
15,
11,
220,
16,
701,
320,
15,
11,
220,
17,
701,
320,
16,
11,
220,
18,
701,
320,
17,
11,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_kernel_ser_deser() {
let keychain = ExtKeychain::from_random_seed().unwrap();
let key_id = ExtKeychain::derive_key_id(1, 1, 0, 0, 0);
let commit = keychain.commit(5, &key_id).unwrap();
// just some bytes for testing ser/deser
let sig = secp::Signature::from_raw_data(&[0; 64]).unwrap();
let kernel = TxKernel {
features: KernelFeatures::DEFAULT_KERNEL,
lock_height: 0,
excess: commit,
excess_sig: sig.clone(),
fee: 10,
};
let mut vec = vec![];
ser::serialize(&mut vec, &kernel).expect("serialized failed");
let kernel2: TxKernel = ser::deserialize(&mut &vec[..]).unwrap();
assert_eq!(kernel2.features, KernelFeatures::DEFAULT_KERNEL);
assert_eq!(kernel2.lock_height, 0);
assert_eq!(kernel2.excess, commit);
assert_eq!(kernel2.excess_sig, sig.clone());
assert_eq!(kernel2.fee, 10);
// now check a kernel with lock_height serialize/deserialize correctly
let kernel = TxKernel {
features: KernelFeatures::DEFAULT_KERNEL,
lock_height: 100,
excess: commit,
excess_sig: sig.clone(),
fee: 10,
};
let mut vec = vec![];
ser::serialize(&mut vec, &kernel).expect("serialized failed");
let kernel2: TxKernel = ser::deserialize(&mut &vec[..]).unwrap();
assert_eq!(kernel2.features, KernelFeatures::DEFAULT_KERNEL);
assert_eq!(kernel2.lock_height, 100);
assert_eq!(kernel2.excess, commit);
assert_eq!(kernel2.excess_sig, sig.clone());
assert_eq!(kernel2.fee, 10);
} | rust_cleaned_test_functions.jsonl/23422 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 599
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26876,
75861,
15768,
261,
368,
341,
197,
10217,
1376,
8819,
284,
9447,
1592,
8819,
486,
1499,
22644,
33809,
1005,
15454,
543,
197,
10217,
1376,
842,
284,
9447,
1592,
8819,
486,
27098,
3097,
842,
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_asinh() {
assert_eq!(0.0f64.asinh(), 0.0f64);
assert_eq!((-0.0f64).asinh(), -0.0f64);
let inf: f64 = INFINITY;
let neg_inf: f64 = NEG_INFINITY;
let nan: f64 = NAN;
assert_eq!(inf.asinh(), inf);
assert_eq!(neg_inf.asinh(), neg_inf);
assert!(nan.asinh().is_nan());
assert_approx_eq!(2.0f64.asinh(), 1.443635475178810342493276740273105f64);
assert_approx_eq!((-2.0f64).asinh(), -1.443635475178810342493276740273105f64);
} | rust_cleaned_test_functions.jsonl/7847 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 295
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
20868,
368,
341,
286,
2060,
10714,
10297,
15,
13,
15,
69,
21,
19,
5357,
20868,
1507,
220,
15,
13,
15,
69,
21,
19,
317,
286,
2060,
10714,
0,
54934,
15,
13,
15,
69,
21,
19,
568,
300,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_transaction_signature_err_modified_output() {
let mut rng: StdRng = SeedableRng::from_seed([1u8; 32]);
let (mut tx, _ledger) = create_test_tx();
// Add an output.
let output = tx.prefix.outputs.get(0).unwrap().clone();
tx.prefix.outputs.push(output);
match validate_signature(&tx, &mut rng) {
Err(TransactionValidationError::InvalidTransactionSignature(_e)) => {} // Expected.
Err(e) => {
panic!(alloc::format!("Unexpected error {}", e));
}
Ok(()) => panic!(),
}
} | rust_cleaned_test_functions.jsonl/78564 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 292
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28884,
39859,
9266,
37749,
7645,
368,
341,
286,
1077,
5206,
28422,
25,
42517,
49,
968,
284,
35822,
480,
49,
968,
486,
1499,
33809,
2561,
16,
84,
23,
26,
220,
18,
17,
2558,
286,
1077,
320,
6984... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_get_property_page_none() {
let mut transaction_context = MockTransactionContext::default();
let state = TrackAndTraceState::new(&mut transaction_context);
let result = state
.get_property_page("record_id", "property_name", 1)
.unwrap();
assert!(result.is_none())
} | rust_cleaned_test_functions.jsonl/116994 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 147
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
16638,
6129,
31488,
368,
341,
286,
1077,
5206,
7745,
8467,
284,
14563,
8070,
1972,
486,
2258,
543,
286,
1077,
1584,
284,
19785,
3036,
6550,
1397,
486,
931,
2099,
6984,
7745,
8467,
626,
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_not_inline_mut_variable() {
cov_mark::check!(test_not_inline_mut_variable);
check_assist_not_applicable(
inline_local_variable,
r"
fn foo() {
let mut a$0 = 1 + 1;
a + 1;
}",
);
} | rust_cleaned_test_functions.jsonl/3227 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7913,
41871,
29523,
14635,
368,
341,
286,
21836,
18924,
486,
2028,
10297,
1944,
7913,
41871,
29523,
14635,
317,
286,
1779,
12083,
380,
7913,
8191,
46114,
1006,
310,
7381,
13564,
14635,
345,
310,
435... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_position_at_distance() {
let zero_dist = Vector3::zeros();
let home_pos = get_test_reference_position();
let planet = PlanetEarth::new(&home_pos);
let offset_pos1 = planet.position_at_distance(&zero_dist);
println!("offset_pos1 {:?} ", offset_pos1);
assert_eq!(offset_pos1.alt_wgs84, home_pos.alt_wgs84);
assert_approx_eq!(offset_pos1.lat, home_pos.lat, 1.0e-6);
assert_approx_eq!(offset_pos1.lon, home_pos.lon, 1.0e-6);
let known_dist = Vector3::new(1000.0, 1000.0, 1000.0 );
let offset_pos2 = planet.position_at_distance(&known_dist);
println!("offset_pos2 {:?} ", offset_pos2);
//WGS84 distance is meters above ellipsoid: local distance is in NED
assert_approx_eq!(offset_pos2.alt_wgs84, home_pos.alt_wgs84 - known_dist[2]);
assert_approx_eq!(offset_pos2.lat, 37.8805831528412, 1.0e-6);
assert_approx_eq!(offset_pos2.lon, -122.26132011145224, 1.0e-6);
} | rust_cleaned_test_functions.jsonl/18366 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 470
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9661,
3752,
19464,
368,
341,
286,
1077,
7168,
16031,
284,
4196,
18,
486,
35716,
543,
286,
1077,
2114,
6479,
284,
633,
4452,
25433,
9661,
1428,
286,
1077,
11580,
284,
28835,
43824,
486,
931,
2099,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_chunksator() {
let v = &[1, 2, 3, 4, 5];
assert_eq!(v.chunks(2).len(), 3);
let chunks: &[&[_]] = &[&[1, 2], &[3, 4], &[5]];
assert_eq!(v.chunks(2).collect::<Vec<_>>(), chunks);
let chunks: &[&[_]] = &[&[1, 2, 3], &[4, 5]];
assert_eq!(v.chunks(3).collect::<Vec<_>>(), chunks);
let chunks: &[&[_]] = &[&[1, 2, 3, 4, 5]];
assert_eq!(v.chunks(6).collect::<Vec<_>>(), chunks);
let chunks: &[&[_]] = &[&[5], &[3, 4], &[1, 2]];
assert_eq!(v.chunks(2).rev().collect::<Vec<_>>(), chunks);
} | rust_cleaned_test_functions.jsonl/12901 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 292
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
65470,
850,
368,
341,
262,
1077,
348,
284,
44590,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
4821,
262,
2060,
10714,
10297,
85,
5329,
15296,
7,
17,
568,
2892,
1507,
220,
18,
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_empty_comments() {
parse_macro(
r#"
macro_rules! one_arg_macro { ($fmt:expr) => (); }
"#,
)
.assert_expand_err(
r#"one_arg_macro!(/**/)"#,
&ExpandError::BindingError("expected Expr".into()),
);
} | rust_cleaned_test_functions.jsonl/28779 | {
"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,
15124,
30359,
368,
341,
262,
4715,
58810,
1006,
286,
435,
2,
698,
286,
18072,
21407,
0,
825,
6057,
58810,
314,
1711,
12501,
96011,
8,
589,
39147,
456,
262,
5869,
345,
262,
1727,
262,
659,
2207,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_storage_compact() {
let ents = vec![new_entry(3, 3), new_entry(4, 4), new_entry(5, 5)];
let mut tests = vec![
(2, Err(RaftError::Store(StorageError::Compacted))),
(3, Err(RaftError::Store(StorageError::Compacted))),
(4, Ok(())),
(5, Ok(())),
];
for (i, (idx, werr)) in tests.drain(..).enumerate() {
let td = Builder::new().prefix("tikv-store-test").tempdir().unwrap();
let worker = Worker::new("snap-manager").lazy_build("snap-manager");
let sched = worker.scheduler();
let store = new_storage_from_ents(sched, &td, &ents);
let mut ctx = InvokeContext::new(&store);
let res = store
.term(idx)
.map_err(From::from)
.and_then(|term| compact_raft_log(&store.tag, &mut ctx.apply_state, idx, term));
// TODO check exact error type after refactoring error.
if res.is_err() ^ werr.is_err() {
panic!("#{}: want {:?}, got {:?}", i, werr, res);
}
if res.is_ok() {
let mut kv_wb = store.engines.kv.write_batch();
ctx.save_apply_state_to(&mut kv_wb).unwrap();
kv_wb.write().unwrap();
}
}
} | rust_cleaned_test_functions.jsonl/78130 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 718
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23310,
18177,
531,
368,
341,
286,
1077,
36852,
284,
7486,
20703,
931,
9078,
7,
18,
11,
220,
18,
701,
501,
9078,
7,
19,
11,
220,
19,
701,
501,
9078,
7,
20,
11,
220,
20,
12587,
286,
1077,
52... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_lox_funcs() {
check_output_default(
"fun sayHi(first, last) {\n\
return \"Hi, \" + first + \" \" + last + \"!\";\n\
}\n\
\n\
print sayHi(\"Dear\", \"Reader\");\n\
\n\
fun add(x,y,z) {\n\
return x + y + z;\n\
}\n\
\n\
print add(1,2,3);",
"'Hi, Dear Reader!'\n6",
)
} | rust_cleaned_test_functions.jsonl/111840 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 314
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5560,
87,
64124,
368,
341,
286,
1779,
7645,
9993,
1006,
310,
330,
11894,
1977,
13048,
17981,
11,
1537,
8,
28152,
77,
5661,
2290,
470,
7245,
13048,
11,
7245,
488,
1156,
488,
7245,
7245,
488,
1537... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_week_with_mode() {
let cases = vec![
("2008-02-20 00:00:00", Some(1), Some(8i64)),
("2008-12-31 00:00:00", Some(1), Some(53i64)),
("2000-01-01", Some(0), Some(0i64)),
("2008-02-20", Some(0), Some(7i64)),
("2017-01-01", Some(0), Some(1i64)),
("2017-01-01", Some(1), Some(0i64)),
("2017-01-01", Some(2), Some(1i64)),
("2017-01-01", Some(3), Some(52i64)),
("2017-01-01", Some(4), Some(1i64)),
("2017-01-01", Some(5), Some(0i64)),
("2017-01-01", Some(6), Some(1i64)),
("2017-01-01", Some(7), Some(52i64)),
("2017-12-31", Some(0), Some(53i64)),
("2017-12-31", Some(1), Some(52i64)),
("2017-12-31", Some(2), Some(53i64)),
("2017-12-31", Some(3), Some(52i64)),
("2017-12-31", Some(4), Some(53i64)),
("2017-12-31", Some(5), Some(52i64)),
("2017-12-31", Some(6), Some(1i64)),
("2017-12-31", Some(7), Some(52i64)),
("2017-12-31", Some(14), Some(1i64)),
("2017-12-31", None::<Int>, None),
("0000-00-00", Some(0), None),
("2018-12-00", Some(0), None),
("2018-00-03", Some(0), None),
];
let mut ctx = EvalContext::default();
for (arg1, arg2, exp) in cases {
let datetime = Some(DateTime::parse_datetime(&mut ctx, arg1, 6, true).unwrap());
let output = RpnFnScalarEvaluator::new()
.push_param(datetime)
.push_param(arg2)
.evaluate(ScalarFuncSig::WeekWithMode)
.unwrap();
assert_eq!(output, exp);
}
let output = RpnFnScalarEvaluator::new()
.push_param(None::<DateTime>)
.push_param(Some(0))
.evaluate::<Int>(ScalarFuncSig::WeekWithMode)
.unwrap();
assert_eq!(output, None);
} | rust_cleaned_test_functions.jsonl/36231 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31277,
6615,
7302,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
3489,
17,
15,
15,
23,
12,
15,
17,
12,
17,
15,
220,
15,
15,
25,
15,
15,
25,
15,
15,
497,
4329,
7,
16,
701,
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... | 2 |
#[test]
fn test_with_builders() {
let time = DecomposedTime::default().with_years(5).with_days(10);
assert_eq!(time,
(FloatDuration::years(5.0) + FloatDuration::days(10.0))
.decompose()
.unwrap());
assert_eq!(DecomposedTime::zero(),
FloatDuration::zero().decompose().unwrap());
assert_eq!(DecomposedTime::default().with_days(10).with_minutes(30),
(FloatDuration::days(10.0) + FloatDuration::minutes(30.0))
.decompose()
.unwrap());
assert_eq!(DecomposedTime::default()
.with_seconds(30)
.with_fractional_seconds(0.5),
(FloatDuration::seconds(30.5)).decompose().unwrap());
assert_eq!(DecomposedTime::default()
.with_fractional_seconds(0.2)
.milliseconds(),
200);
assert_eq!(DecomposedTime::default()
.with_fractional_seconds(0.00005)
.microseconds(),
50);
assert_eq!(DecomposedTime::default()
.with_fractional_seconds(0.00000005)
.nanoseconds(),
50);
} | rust_cleaned_test_functions.jsonl/26667 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 781
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
20801,
388,
368,
341,
286,
1077,
882,
284,
96378,
3865,
1462,
486,
2258,
1005,
4197,
74490,
7,
20,
568,
4197,
28353,
7,
16,
15,
317,
286,
2060,
10714,
10297,
1678,
345,
4293,
320,
5442,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_map() {
gst::init().unwrap();
let mut buffer = gst::Buffer::new_rtp_with_sizes(16, 4, 0).unwrap();
let mut rtp_buffer = RTPBuffer::from_buffer_writable(&mut buffer).unwrap();
rtp_buffer.set_seq(42);
assert_eq!(rtp_buffer.get_seq(), 42);
rtp_buffer.set_payload_type(43);
assert_eq!(rtp_buffer.get_payload_type(), 43);
rtp_buffer.set_timestamp(44);
assert_eq!(rtp_buffer.get_timestamp(), 44);
} | rust_cleaned_test_functions.jsonl/23347 | {
"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,
5376,
368,
341,
286,
43769,
486,
2327,
1005,
15454,
1428,
286,
1077,
5206,
4147,
284,
43769,
486,
4095,
486,
931,
1710,
790,
6615,
32159,
7,
16,
21,
11,
220,
19,
11,
220,
15,
568,
15454,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dynamic_honey_badger_first_delivery_silent() {
let new_adversary = |_: usize, _: usize, _| SilentAdversary::new(MessageScheduler::First);
test_dynamic_honey_badger_different_sizes(new_adversary, 10);
} | rust_cleaned_test_functions.jsonl/66066 | {
"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,
45992,
1523,
2534,
34199,
1389,
12978,
50562,
643,
68414,
368,
341,
262,
1077,
501,
10027,
3004,
658,
284,
760,
23211,
22301,
11,
58536,
22301,
11,
85137,
59455,
2589,
3004,
658,
486,
931,
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 |
#[test]
fn test_readme_md() {
use std::fs::File;
use std::path::Path;
let path = Path::new("sample_mp3s/constant_stereo_128.mp3");
let file = File::open(&path).unwrap();
let file2 = File::open(&path).unwrap();
let decoder = Decoder::decode(file).unwrap();
for decoding_result in decoder {
match decoding_result {
Err(e) => println!("Error: {:?}", e),
Ok(frame) => {
println!("Frame sample rate: {}", frame.sample_rate);
println!(
"First audio sample (left channel): {:?}",
frame.samples[0][0]
);
println!(
"First audio sample (right channel): {:?}",
frame.samples[1][0]
);
}
}
}
let partial_decoder =
Decoder::decode_interval(file2, Duration::from_secs(30), Duration::from_secs(60))
.unwrap();
} | rust_cleaned_test_functions.jsonl/88775 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 612
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
2660,
32994,
368,
341,
286,
990,
1460,
486,
3848,
486,
1703,
280,
286,
990,
1460,
486,
2343,
486,
1820,
401,
286,
1077,
1815,
284,
7933,
486,
931,
445,
13611,
39898,
18,
82,
14,
18077,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_basis() {
let envelope = DummyEnvelope {}.seal();
assert!(envelope.is::<DummyEnvelope>());
let envelope = Envelope::new(0f32).seal();
assert!(!envelope.is::<DummyEnvelope>());
assert!(envelope.is::<Envelope<f32>>());
} | rust_cleaned_test_functions.jsonl/105921 | {
"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,
62696,
368,
341,
286,
1077,
34398,
284,
50567,
62712,
84412,
325,
278,
543,
286,
2060,
10297,
268,
18853,
2079,
27638,
43344,
62712,
32872,
286,
1077,
34398,
284,
2925,
18853,
486,
931,
7,
15,
69,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_traverse_canister_with_execution_state() {
let canister_id = canister_test_id(2);
let controller = user_test_id(24);
let controllers_cbor = {
let mut cbor = vec![217, 217, 247, 129, 74];
cbor.extend(controller.get().to_vec());
cbor
};
let mut canister_state = new_canister_state(
canister_id,
controller.get(),
INITIAL_CYCLES,
NumSeconds::from(100_000),
);
let tmpdir = tempfile::Builder::new().prefix("test").tempdir().unwrap();
let wasm_binary = WasmBinary::new(BinaryEncodedWasm::new(vec![]));
let wasm_binary_hash = wasm_binary.binary.hash_sha256();
let wasm_memory = Memory {
page_map: PageMap::default(),
size: NumWasmPages::from(2),
};
let execution_state = ExecutionState {
canister_root: "NOT_USED".into(),
session_nonce: None,
wasm_binary,
wasm_memory,
stable_memory: Memory::default(),
exported_globals: vec![Global::I32(1)],
exports: ExportedFunctions::new(BTreeSet::new()),
last_executed_round: ExecutionRound::from(0),
cow_mem_mgr: Arc::new(CowMemoryManagerImpl::open_readwrite(tmpdir.path().into())),
mapped_state: None,
};
canister_state.execution_state = Some(execution_state);
let mut state = ReplicatedState::new_rooted_at(
subnet_test_id(1),
SubnetType::Application,
tmpdir.path().into(),
);
state.put_canister_state(canister_state);
let visitor = TracingVisitor::new(NoopVisitor);
assert_eq!(
vec![
E::StartSubtree,
edge("canister"),
E::StartSubtree,
E::EnterEdge(canister_id.get().into_vec()),
E::StartSubtree,
edge("certified_data"),
E::VisitBlob(vec![]),
E::EndSubtree, // canister
E::EndSubtree, // canisters
edge("metadata"),
E::VisitBlob(encode_metadata(SystemMetadata {
id_counter: 0,
prev_state_hash: None
})),
edge("request_status"),
E::StartSubtree,
E::EndSubtree, // request_status
edge("streams"),
E::StartSubtree,
E::EndSubtree, // streams
edge("subnet"),
E::StartSubtree,
E::EndSubtree, // subnets
edge("time"),
leb_num(0),
E::EndSubtree, //global
],
traverse(&state, visitor).0
);
// Test new certification version.
state.metadata.certification_version = 2;
let visitor = TracingVisitor::new(NoopVisitor);
assert_eq!(
vec![
E::StartSubtree,
edge("canister"),
E::StartSubtree,
E::EnterEdge(canister_id.get().into_vec()),
E::StartSubtree,
edge("certified_data"),
E::VisitBlob(vec![]),
edge("controller"),
E::VisitBlob(controller.get().to_vec()),
edge("controllers"),
E::VisitBlob(controllers_cbor),
edge("module_hash"),
E::VisitBlob(wasm_binary_hash.to_vec()),
E::EndSubtree, // canister
E::EndSubtree, // canisters
edge("metadata"),
E::VisitBlob(encode_metadata(SystemMetadata {
id_counter: 0,
prev_state_hash: None
})),
edge("request_status"),
E::StartSubtree,
E::EndSubtree, // request_status
edge("streams"),
E::StartSubtree,
E::EndSubtree, // streams
edge("subnet"),
E::StartSubtree,
E::EndSubtree, // subnets
edge("time"),
leb_num(0),
E::EndSubtree, //global
],
traverse(&state, visitor).0
);
} | rust_cleaned_test_functions.jsonl/98353 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2438
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3547,
22439,
27421,
1571,
6615,
60948,
4387,
368,
341,
286,
1077,
646,
1571,
842,
284,
646,
1571,
4452,
842,
7,
17,
317,
286,
1077,
6461,
284,
1196,
4452,
842,
7,
17,
19,
317,
286,
1077,
26225... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_int_lit_neg_exp() {
let d = Decimal::<5>::from_str("17e-5").unwrap();
assert_eq!(d.coeff, 17);
} | rust_cleaned_test_functions.jsonl/12019 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 80
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
4042,
98399,
28209,
14214,
368,
341,
286,
1077,
294,
284,
26728,
27638,
20,
6831,
1499,
2895,
445,
16,
22,
68,
12,
20,
1827,
15454,
543,
286,
2060,
10714,
10297,
67,
86462,
11,
220,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_rng_32_rand_seeded() {
let s = ::test::rng().gen_iter::<u32>().take(256).collect::<Vec<u32>>();
let mut ra: IsaacRng = SeedableRng::from_seed(&s[..]);
let mut rb: IsaacRng = SeedableRng::from_seed(&s[..]);
assert!(order::equals(ra.gen_ascii_chars().take(100),
rb.gen_ascii_chars().take(100)));
} | rust_cleaned_test_functions.jsonl/94701 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 207
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66849,
62,
18,
17,
33864,
3453,
29935,
368,
341,
286,
1077,
274,
284,
3504,
1944,
486,
69890,
1005,
4370,
11723,
27638,
84,
18,
17,
10483,
22769,
7,
17,
20,
21,
568,
17384,
27638,
10050,
34837,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_large_rewrite_batch() {
let dir = tempfile::Builder::new()
.prefix("test_large_rewrite_batch")
.tempdir()
.unwrap();
let cfg = Config {
dir: dir.path().to_str().unwrap().to_owned(),
target_file_size: ReadableSize(1),
..Default::default()
};
let engine = RaftLogEngine::open(cfg).unwrap();
let data = vec![b'x'; 2 * 1024 * 1024];
for rid in 1..=3 {
engine.append(rid, 1, 11, Some(&data));
}
let old_active_file = engine.file_span(LogQueue::Append).1;
engine.purge_manager.must_rewrite_append_queue(None, None);
assert_eq!(engine.file_span(LogQueue::Append).0, old_active_file + 1);
let old_active_file = engine.file_span(LogQueue::Rewrite).1;
engine.purge_manager.must_rewrite_rewrite_queue();
assert_eq!(engine.file_span(LogQueue::Rewrite).0, old_active_file + 1);
let engine = engine.reopen();
for rid in 1..=3 {
engine.scan(rid, 1, 11, |_, _, d| {
assert_eq!(d, &data);
});
}
} | rust_cleaned_test_functions.jsonl/91530 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 583
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45228,
74052,
14534,
368,
341,
286,
1077,
5419,
284,
54819,
486,
3297,
486,
931,
741,
310,
659,
11849,
445,
1944,
45228,
74052,
14534,
1138,
310,
659,
3888,
3741,
741,
310,
659,
15454,
543,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_total_order_seek() {
let path = TempDir::new("_rust_rocksdb_total_order_seek").expect("");
let mut bbto = BlockBasedOptions::new();
bbto.set_bloom_filter(10, false);
bbto.set_whole_key_filtering(false);
let mut cf_opts = ColumnFamilyOptions::new();
let mut opts = DBOptions::new();
opts.create_if_missing(true);
cf_opts.set_block_based_table_factory(&bbto);
cf_opts
.set_prefix_extractor(
"FixedPrefixTransform",
Box::new(FixedPrefixTransform { prefix_len: 2 }),
)
.unwrap();
// also create prefix bloom for memtable
cf_opts.set_memtable_prefix_bloom_size_ratio(0.1 as f64);
let keys = vec![
b"k1-1", b"k1-2", b"k1-3", b"k2-1", b"k2-2", b"k2-3", b"k3-1", b"k3-2", b"k3-3",
];
let db = DB::open_cf(
opts,
path.path().to_str().unwrap(),
vec![("default", cf_opts)],
)
.unwrap();
let wopts = WriteOptions::new();
// sst1
db.put_opt(b"k1-1", b"a", &wopts).unwrap();
db.put_opt(b"k1-2", b"b", &wopts).unwrap();
db.put_opt(b"k1-3", b"c", &wopts).unwrap();
db.put_opt(b"k2-1", b"a", &wopts).unwrap();
db.flush(true /* sync */).unwrap(); // flush memtable to sst file.
// sst2
db.put_opt(b"k2-2", b"b", &wopts).unwrap();
db.put_opt(b"k2-3", b"c", &wopts).unwrap();
db.flush(true /* sync */).unwrap(); // flush memtable to sst file.
// memtable
db.put_opt(b"k3-1", b"a", &wopts).unwrap();
db.put_opt(b"k3-2", b"b", &wopts).unwrap();
db.put_opt(b"k3-3", b"c", &wopts).unwrap();
let mut ropts = ReadOptions::new();
ropts.set_prefix_same_as_start(true);
let mut iter = db.iter_opt(ropts);
// only iterate sst files and memtables that contain keys with the same prefix as b"k1"
// and the keys is iterated as valid when prefixed as b"k1"
iter.seek(SeekKey::Key(b"k1-0"));
let mut key_count = 0;
while iter.valid() {
assert_eq!(keys[key_count], iter.key());
key_count = key_count + 1;
iter.next();
}
assert!(key_count == 3);
let mut iter = db.iter();
// only iterate sst files and memtables that contain keys with the same prefix as b"k1"
// but it still can next/prev to the keys which is not prefixed as b"k1" with
// prefix_same_as_start
iter.seek(SeekKey::Key(b"k1-0"));
let mut key_count = 0;
while iter.valid() {
assert_eq!(keys[key_count], iter.key());
key_count = key_count + 1;
iter.next();
}
assert!(key_count == 4);
let mut ropts = ReadOptions::new();
ropts.set_total_order_seek(true);
let mut iter = db.iter_opt(ropts);
iter.seek(SeekKey::Key(b"k1-0"));
let mut key_count = 0;
while iter.valid() {
// iterator all sst files and memtables
assert_eq!(keys[key_count], iter.key());
key_count = key_count + 1;
iter.next();
}
assert!(key_count == 9);
} | rust_cleaned_test_functions.jsonl/18881 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1417
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10784,
7869,
74473,
368,
341,
262,
1077,
1815,
284,
19944,
6184,
486,
931,
16975,
35788,
26608,
14553,
1999,
10784,
7869,
74473,
1827,
17119,
13056,
262,
1077,
5206,
16520,
983,
284,
8362,
28715,
37... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_one_cpu() {
let mut file = new_file("10");
let set = parse_cpus_from_sysfile(&mut file).expect("Failed to file");
assert_eq!(set, [10,].iter().map(|x| *x).collect());
} | rust_cleaned_test_functions.jsonl/109208 | {
"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,
11667,
21795,
368,
341,
286,
1077,
5206,
1034,
284,
501,
2458,
445,
16,
15,
797,
286,
1077,
738,
284,
4715,
90673,
5673,
20344,
1192,
2099,
6984,
1034,
568,
17119,
445,
9408,
311,
1034,
797,
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_used_in_break_expr() {
check_assist(
inline_local_variable,
r"
fn foo() {
let a$0 = 1 + 1;
loop {
break a;
}
}",
r"
fn foo() {
loop {
break 1 + 1;
}
}",
);
} | rust_cleaned_test_functions.jsonl/3243 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27803,
1243,
39494,
21915,
368,
341,
286,
1779,
12083,
380,
1006,
310,
7381,
13564,
14635,
345,
310,
435,
698,
8822,
15229,
368,
341,
262,
1077,
264,
3,
15,
284,
220,
16,
488,
220,
16,
280,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_relative_direction() {
let center = Pos(0, 0);
let left = Pos(-1, 0);
let right = Pos(1, 0);
let top = Pos(0, -1);
let bottom = Pos(0, 1);
assert_eq!(relative_direction(¢er, &right), Direction::East);
assert_eq!(relative_direction(¢er, &left), Direction::West);
assert_eq!(relative_direction(¢er, &top), Direction::North);
assert_eq!(relative_direction(¢er, &bottom), Direction::South);
let left_top = Pos(-1, -1);
assert_eq!(relative_direction(¢er, &left_top), Direction::NorthWest);
let right_top = Pos(1, -1);
assert_eq!(
relative_direction(¢er, &right_top),
Direction::NorthEast
);
let left_bottom = Pos(-1, 1);
assert_eq!(
relative_direction(¢er, &left_bottom),
Direction::SouthWest
);
let right_bottom = Pos(1, 1);
assert_eq!(
relative_direction(¢er, &right_bottom),
Direction::SouthEast
);
} | rust_cleaned_test_functions.jsonl/54484 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 504
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29286,
25438,
368,
341,
286,
1077,
4126,
284,
18876,
7,
15,
11,
220,
15,
317,
286,
1077,
2115,
284,
18876,
4080,
16,
11,
220,
15,
317,
286,
1077,
1290,
284,
18876,
7,
16,
11,
220,
15,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hash_sha3_384() {
let hasher = Hash::Sha3_384;
let result = hasher.hash_bytes(&vec![1, 2, 3]);
let expected = concat!(
"854ec9031d7e34de34973dd41c3dd156a2cde981fff0153281b87d72b481d98c",
"dfc0a9791d522d719e607656d7655b1a"
);
assert_eq!(result.len(), 48);
assert_eq!(hex::encode(&result), expected);
} | rust_cleaned_test_functions.jsonl/101704 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 226
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
48836,
18,
62,
18,
23,
19,
368,
341,
286,
1077,
90819,
284,
6531,
486,
62316,
18,
62,
18,
23,
19,
280,
286,
1077,
1102,
284,
90819,
15101,
12524,
2099,
4083,
20703,
16,
11,
220,
17,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_request_snapshot_matched_change() {
let (mut nt, _) = prepare_request_snapshot();
// Let matched be greater than the committed.
nt.peers.get_mut(&2).unwrap().raft_log.committed -= 1;
// Request the latest snapshot.
let request_idx = nt.peers[&2].raft_log.committed;
nt.peers
.get_mut(&2)
.unwrap()
.request_snapshot(request_idx)
.unwrap();
let req_snap = nt.peers.get_mut(&2).unwrap().msgs.pop().unwrap();
// The request snapshot is ignored because it is considered as out of order.
nt.peers.get_mut(&1).unwrap().step(req_snap).unwrap();
assert_eq!(
nt.peers[&1].prs().get(2).unwrap().state,
ProgressState::Replicate
);
// Heartbeat is responsed with a request snapshot message.
for _ in 0..nt.peers[&1].heartbeat_timeout() {
nt.peers.get_mut(&1).unwrap().tick();
}
let msg_hb = nt
.peers
.get_mut(&1)
.unwrap()
.msgs
.iter()
.filter(|m| m.to == 2)
.collect::<Vec<_>>()[0]
.clone();
nt.peers.get_mut(&2).unwrap().step(msg_hb).unwrap();
let req_snap = nt.peers.get_mut(&2).unwrap().msgs.pop().unwrap();
nt.peers.get_mut(&1).unwrap().step(req_snap).unwrap();
assert_eq!(
nt.peers[&1].prs().get(2).unwrap().state,
ProgressState::Snapshot
);
} | rust_cleaned_test_functions.jsonl/19195 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 663
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7893,
53265,
93900,
15947,
368,
341,
262,
1077,
320,
6984,
31412,
11,
27439,
284,
10549,
7893,
53265,
543,
262,
442,
6771,
18054,
387,
7046,
1091,
279,
11163,
624,
262,
31412,
52724,
388,
670,
295... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_field_validations_take_priority_over_nested_validations() {
let instance = ParentWithVectorOfChildren { child: Vec::new() };
let res = instance.validate();
assert!(res.is_err());
let err = res.unwrap_err();
let errs = err.errors();
assert_eq!(errs.len(), 1);
assert!(errs.contains_key("child"));
if let ValidationErrorsKind::Field(ref errs) = errs["child"] {
assert_eq!(errs.len(), 1);
assert_eq!(errs[0].code, "length");
} else {
panic!("Expected field validation errors");
}
} | rust_cleaned_test_functions.jsonl/784 | {
"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,
5013,
8337,
804,
73261,
38161,
15431,
66279,
8337,
804,
368,
341,
262,
1077,
2867,
284,
17022,
2354,
3781,
2124,
11539,
314,
1682,
25,
11312,
486,
931,
368,
3634,
262,
1077,
592,
284,
2867,
19520,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_biguint() {
let vi = (25_i64).to_bigint().unwrap();
let vu = (25_i64).to_biguint().unwrap();
assert_eq!(BigUint::from_record(&Record::Int(vi)), Ok(vu));
let vi = (-25_i64).to_bigint().unwrap();
assert_eq!(
BigUint::from_record(&Record::Int(vi)),
Err("cannot convert -25 to BigUint".to_string())
);
} | rust_cleaned_test_functions.jsonl/8011 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36386,
2496,
368,
341,
262,
1077,
3275,
284,
320,
17,
20,
5318,
21,
19,
568,
983,
36386,
396,
1005,
15454,
543,
262,
1077,
32514,
284,
320,
17,
20,
5318,
21,
19,
568,
983,
36386,
2496,
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_index_of_hit() {
let cache = mock_cache();
assert_eq!(cache.index_of(AssetId(1)), Some(0));
assert_eq!(cache.index_of(AssetId(2)), Some(1));
} | rust_cleaned_test_functions.jsonl/56052 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 97
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3560,
3575,
37697,
368,
341,
286,
1077,
6500,
284,
7860,
11529,
543,
286,
2060,
10714,
10297,
9360,
5154,
3575,
7,
16604,
764,
7,
16,
5731,
4329,
7,
15,
1106,
286,
2060,
10714,
10297,
9360,
5154... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_hint() {
let config = KeyConfig::default();
let h = config.get_hint(KeyEvent {
code: KeyCode::Char('c'),
modifiers: KeyModifiers::CONTROL,
});
assert_eq!(h, "^c");
} | rust_cleaned_test_functions.jsonl/103392 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
45825,
368,
341,
197,
10217,
2193,
284,
5309,
2648,
486,
2258,
543,
197,
10217,
305,
284,
2193,
670,
45825,
67108,
341,
298,
43343,
25,
65152,
486,
4768,
492,
66,
3299,
298,
42228,
11836,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_var_resolver() -> Result<(), Box<EvalAltResult>> {
let mut engine = Engine::new();
let mut scope = Scope::new();
scope.push("innocent", 1 as INT);
scope.push("chameleon", 123 as INT);
scope.push("DO_NOT_USE", 999 as INT);
engine.on_var(|name, _, context| {
match name {
"MYSTIC_NUMBER" => Ok(Some((42 as INT).into())),
// Override a variable - make it not found even if it exists!
"DO_NOT_USE" => {
Err(EvalAltResult::ErrorVariableNotFound(name.to_string(), Position::NONE).into())
}
// Silently maps 'chameleon' into 'innocent'.
"chameleon" => context
.scope()
.get_value("innocent")
.map(Some)
.ok_or_else(|| {
EvalAltResult::ErrorVariableNotFound(name.to_string(), Position::NONE).into()
}),
_ => Ok(None),
}
});
assert_eq!(
engine.eval_with_scope::<INT>(&mut scope, "MYSTIC_NUMBER")?,
42
);
assert_eq!(engine.eval_with_scope::<INT>(&mut scope, "chameleon")?, 1);
assert!(
matches!(*engine.eval_with_scope::<INT>(&mut scope, "DO_NOT_USE").expect_err("should error"),
EvalAltResult::ErrorVariableNotFound(n, _) if n == "DO_NOT_USE")
);
Ok(())
} | rust_cleaned_test_functions.jsonl/25277 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 686
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4612,
91578,
368,
1464,
5714,
68843,
8261,
23835,
831,
26017,
2077,
2452,
341,
262,
1077,
5206,
4712,
284,
8200,
486,
931,
1428,
262,
1077,
5206,
6891,
284,
34920,
486,
931,
543,
262,
6891,
2552,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_invalid_cohort_name_chars() {
assert!(!Cohort::validate_name("some\u{09}channel"));
assert!(!Cohort::validate_name("some\u{07f}channel"));
assert!(!Cohort::validate_name("some\u{080}channel"));
} | rust_cleaned_test_functions.jsonl/23774 | {
"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,
31433,
666,
2267,
371,
1269,
37418,
368,
341,
286,
2060,
0,
3471,
34,
2267,
371,
486,
7067,
1269,
445,
14689,
3770,
90,
15,
24,
92,
10119,
4010,
286,
2060,
0,
3471,
34,
2267,
371,
486,
7067,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_path() {
let template = compile("The number of the day is { nested.value }.");
let context = context();
let template_registry = other_templates();
let formatter_registry = formatters();
let string = template
.render(&context, &template_registry, &formatter_registry)
.unwrap();
assert_eq!("The number of the day is 10.", &string);
} | rust_cleaned_test_functions.jsonl/2372 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2638,
368,
972,
286,
1077,
3811,
284,
19192,
445,
785,
1372,
315,
279,
1899,
374,
314,
24034,
2824,
335,
27007,
286,
1077,
2266,
284,
2266,
1647,
286,
1077,
3811,
50650,
284,
1008,
49526,
1647,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_chunked_big() {
async_std::task::block_on(async move {
let mut input: Vec<u8> = b"800\r\n".to_vec();
input.extend(vec![b'X'; 2048]);
input.extend(b"\r\n1800\r\n");
input.extend(vec![b'Y'; 6144]);
input.extend(b"\r\n800\r\n");
input.extend(vec![b'Z'; 2048]);
input.extend(b"\r\n0\r\n\r\n");
let (s, _r) = async_std::sync::channel(1);
let sender = Sender::new(s);
let mut decoder = ChunkedDecoder::new(async_std::io::Cursor::new(input), sender);
let mut output = String::new();
decoder.read_to_string(&mut output).await.unwrap();
let mut expected = vec![b'X'; 2048];
expected.extend(vec![b'Y'; 6144]);
expected.extend(vec![b'Z'; 2048]);
assert_eq!(output.len(), 10240);
assert_eq!(output.as_bytes(), expected.as_slice());
});
} | rust_cleaned_test_functions.jsonl/51854 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 535
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30539,
291,
36386,
368,
341,
286,
3312,
15656,
486,
8202,
486,
4574,
4470,
18285,
3271,
341,
310,
1077,
5206,
1946,
25,
11312,
34837,
23,
29,
284,
293,
1,
23,
15,
15,
12016,
1699,
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,
1... | 1 |
#[test]
fn test_load_function() {
common::setup();
let mut test = OsoTest::new();
test.load_file(file!(), "test_file.polar").unwrap();
test.load_file(file!(), "test_file.polar").unwrap();
assert_eq!(
test.query("f(x)"),
vec![
hashmap! { "x" => 1, },
hashmap! { "x" => 2, },
hashmap! { "x" => 3, },
]
);
assert_eq!(test.qvar::<u32>("f(x)", "x"), [1, 2, 3]);
assert!(matches!(test.oso.clear_rules(), Ok(())));
test.load_file(file!(), "test_file.polar").unwrap();
test.load_file(file!(), "test_file_gx.polar").unwrap();
assert_eq!(
test.query("f(x)"),
vec![
hashmap! { "x" => 1, },
hashmap! { "x" => 2, },
hashmap! { "x" => 3, },
]
);
assert_eq!(
test.query("g(x)"),
vec![
hashmap! { "x" => 1, },
hashmap! { "x" => 2, },
hashmap! { "x" => 3, },
]
);
} | rust_cleaned_test_functions.jsonl/30385 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 559
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12411,
9174,
368,
341,
262,
4185,
486,
15188,
1428,
262,
1077,
5206,
1273,
284,
506,
704,
2271,
486,
931,
543,
262,
1273,
5104,
2458,
4866,
0,
1507,
330,
1944,
2458,
556,
7417,
1827,
15454,
543,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_anonymization_config_conflicting_options() {
assert_eq!(
get_anonymization_config(
Some(vec!["Foo=Bar", "Baz=qux"]),
Some(vec!["Qux", "Quuz"]),
Some(true),
Some("/tmp/foo.yml")
)
.unwrap_err(),
CliError::new("Command error", Some("Conflicting options"), None)
)
} | rust_cleaned_test_functions.jsonl/76503 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 246
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
12008,
7831,
2022,
5332,
16059,
78208,
8743,
368,
341,
286,
2060,
10714,
33673,
310,
633,
12008,
7831,
2022,
5332,
1006,
394,
4329,
25592,
0,
1183,
40923,
28,
3428,
497,
330,
33,
1370,
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_chunked_encode_sync() {
let mut dst = Buf::new();
let mut encoder = Encoder::chunked();
encoder.encode(&mut dst, b"foo bar").unwrap();
encoder.encode(&mut dst, b"baz quux herp").unwrap();
encoder.encode(&mut dst, b"").unwrap();
assert_eq!(&dst[..], &b"7\r\nfoo bar\r\nD\r\nbaz quux herp\r\n0\r\n\r\n"[..]);
} | rust_cleaned_test_functions.jsonl/121360 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 201
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30539,
291,
11224,
23008,
368,
341,
286,
1077,
5206,
10648,
284,
69013,
486,
931,
543,
286,
1077,
5206,
23668,
284,
55115,
486,
25979,
291,
1428,
286,
23668,
17313,
2099,
6984,
10648,
11,
293,
1,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ldxb() {
test_interpreter_and_jit_asm!(
"
ldxb r0, [r1+2]
exit",
[0xaa, 0xbb, 0x11, 0xcc, 0xdd],
(),
{ |_vm, res: Result| { res.unwrap() == 0x11 } },
2
);
} | rust_cleaned_test_functions.jsonl/58981 | {
"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,
50573,
7929,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
6228,
286,
26129,
7929,
435,
15,
11,
508,
81,
16,
10,
17,
921,
286,
4869,
756,
286,
508,
15,
43300,
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_load_toml() {
let mappings: MemoryMapFile = ::toml::from_str(
"
[[range]]
base=0x1000
length=0x1000
[[range]]
base=0x2000
length=0x1000
real_base=0x3000",
)
.unwrap();
assert_eq!(mappings.ranges.len(), 2);
assert_eq!(mappings.ranges[0].real_base, None);
assert_eq!(mappings.ranges[1].real_base, Some(0x3000));
} | rust_cleaned_test_functions.jsonl/70015 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 206
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12411,
528,
316,
75,
368,
341,
286,
1077,
44817,
25,
13850,
2227,
1703,
284,
3504,
37401,
75,
486,
1499,
2895,
1006,
310,
6228,
15505,
9669,
14288,
3152,
28,
15,
87,
16,
15,
15,
15,
198,
4129,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_alpn_server_select_none() {
let listener = TcpListener::bind("127.0.0.1:0").unwrap();
let localhost = listener.local_addr().unwrap();
let listener_ctx = {
let mut ctx = SslContext::builder(SslMethod::tls()).unwrap();
ctx.set_verify(SSL_VERIFY_PEER);
ctx.set_alpn_protocols(&[b"http/1.1", b"spdy/3.1"]).unwrap();
assert!(
ctx.set_certificate_file(&Path::new("test/cert.pem"), X509_FILETYPE_PEM)
.is_ok()
);
ctx.set_private_key_file(&Path::new("test/key.pem"), X509_FILETYPE_PEM)
.unwrap();
ctx.build()
};
// Have the listener wait on the connection in a different thread.
thread::spawn(move || {
let (stream, _) = listener.accept().unwrap();
Ssl::new(&listener_ctx).unwrap().accept(stream).unwrap();
});
let mut ctx = SslContext::builder(SslMethod::tls()).unwrap();
ctx.set_verify(SSL_VERIFY_PEER);
ctx.set_alpn_protocols(&[b"http/2"]).unwrap();
ctx.set_ca_file(&Path::new("test/root-ca.pem")).unwrap();
let stream = TcpStream::connect(localhost).unwrap();
let stream = Ssl::new(&ctx.build()).unwrap().connect(stream).unwrap();
assert_eq!(None, stream.ssl().selected_alpn_protocol());
} | rust_cleaned_test_functions.jsonl/35529 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 602
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8418,
19958,
12015,
13051,
31488,
368,
341,
262,
1077,
11446,
284,
64876,
2743,
486,
7666,
445,
16,
17,
22,
13,
15,
13,
15,
13,
16,
25,
15,
1827,
15454,
543,
262,
1077,
47422,
284,
11446,
1103... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_str_item_not_substring() {
let string = "Test String";
UnicodeBuffer::new().add_str_item(&string[0..5], &string[4..6]);
} | rust_cleaned_test_functions.jsonl/63450 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 76
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2895,
5634,
7913,
5228,
917,
368,
341,
286,
1077,
914,
284,
330,
2271,
923,
876,
286,
35897,
4095,
486,
931,
1005,
718,
2895,
5634,
2099,
917,
58,
15,
496,
20,
1125,
609,
917,
58,
19,
496,
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 |
#[test]
fn test_mul_vector() {
assert_eq!(A * V, Vector3::new(14.0f64, 32.0f64, 50.0f64));
} | rust_cleaned_test_functions.jsonl/30151 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 65
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24944,
12247,
368,
341,
286,
2060,
10714,
10297,
32,
353,
647,
11,
4196,
18,
486,
931,
7,
16,
19,
13,
15,
69,
21,
19,
11,
220,
18,
17,
13,
15,
69,
21,
19,
11,
220,
20,
15,
13,
15,
69,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_unknown_specializer_suggestions() -> TestResult {
let p = Polar::new();
p.load_str("f(s: string) if s;")?;
let msg = p.next_message().unwrap();
assert!(matches!(&msg.kind, MessageKind::Warning));
assert_eq!(
&msg.msg,
"Unknown specializer string, did you mean String?\n001: f(s: string) if s;\n ^"
);
Ok(())
} | rust_cleaned_test_functions.jsonl/97646 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 176
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57507,
41629,
3135,
643,
37882,
368,
1464,
3393,
2077,
341,
262,
1077,
281,
284,
55896,
486,
931,
543,
262,
281,
5104,
2895,
445,
69,
1141,
25,
914,
8,
421,
274,
26,
899,
37445,
262,
1077,
375... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_cli_get_partial_config_json() {
let json = r#"
{
"http_request_timeout_secs": 20,
"incoming_source": "Systemd",
"logger": {
"dc_id": 200,
"format": "text_full",
"debug_overrides": [],
"block_on_overflow": false
}
}
"#;
let mut tmpfile = NamedTempFile::new().expect("Failed to create tmp file");
writeln!(tmpfile, "{}", json).expect("Failed to write to tmp file");
// should use the default values
let cli = Cli {
config: tmpfile.path().to_owned(),
verbose: true,
};
let result = cli.get_config();
let config = result.unwrap();
let expected_config = Config {
http_request_timeout_secs: 20,
incoming_source: IncomingSource::Systemd,
logger: ic_config::logger::Config {
dc_id: 200,
format: ic_config::logger::LogFormat::TextFull,
debug_overrides: Vec::new(),
block_on_overflow: false,
..Default::default()
},
..Default::default()
};
assert_eq!(config, expected_config);
} | rust_cleaned_test_functions.jsonl/115808 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 699
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47147,
3062,
52068,
5332,
9455,
368,
341,
286,
1077,
2951,
284,
435,
2,
698,
286,
341,
310,
330,
1254,
7893,
20537,
68718,
788,
220,
17,
15,
345,
310,
330,
79677,
10347,
788,
330,
2320,
67,
75... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_error_uses_negative_max_ttl() {
let now = Instant::now();
let name = Query::query(Name::from_str("www.example.com.").unwrap(), RecordType::A);
// configure the cache with a maximum TTL of 60 seconds.
let ttls = TtlConfig {
negative_max_ttl: Some(Duration::from_secs(60)),
..Default::default()
};
let lru = DnsLru::new(1, ttls);
// neg response should have TTL of 62 seconds.
let err = ResolveErrorKind::NoRecordsFound {
query: name.clone(),
soa: None,
negative_ttl: Some(62),
response_code: ResponseCode::NoError,
trusted: false,
};
let nx_error = lru.negative(name.clone(), err.into(), now);
match nx_error.kind() {
&ResolveErrorKind::NoRecordsFound { negative_ttl, .. } => {
let negative_ttl = negative_ttl.expect("resolve error should have a deadline");
// the error's `valid_until` field should have been limited to 60 seconds.
assert_eq!(negative_ttl, 60);
}
other => panic!("expected ResolveErrorKind::NoRecordsFound, got {:?}", other),
}
// neg response should have TTL of 59 seconds.
let err = ResolveErrorKind::NoRecordsFound {
query: name.clone(),
soa: None,
negative_ttl: Some(59),
response_code: ResponseCode::NoError,
trusted: false,
};
let nx_error = lru.negative(name, err.into(), now);
match nx_error.kind() {
&ResolveErrorKind::NoRecordsFound { negative_ttl, .. } => {
let negative_ttl = negative_ttl.expect("resolve error should have a deadline");
// under the max TTL.
assert_eq!(negative_ttl, 59);
}
other => panic!("expected ResolveErrorKind::NoRecordsFound, got {:?}", other),
}
} | rust_cleaned_test_functions.jsonl/2130 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 957
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4096,
62,
4776,
53865,
6345,
87157,
368,
341,
286,
1077,
1431,
284,
18058,
486,
3328,
1428,
286,
1077,
829,
284,
11361,
486,
1631,
21182,
486,
1499,
2895,
445,
2136,
7724,
905,
98401,
15454,
1507,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_zero_cpus() {
check_parse_error(
p_cpu_request,
"0",
r#"Parse error
"Requesting zero cpus is not allowed" at character 0: "0""#,
);
} | rust_cleaned_test_functions.jsonl/107801 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 121
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
19359,
90673,
368,
341,
286,
1779,
21039,
4096,
1006,
310,
281,
21795,
7893,
345,
310,
330,
15,
756,
310,
435,
55543,
14463,
1465,
198,
1,
1900,
287,
7168,
12490,
355,
374,
537,
5420,
1,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_level_as_str() {
let tests = &[
(Level::Error, "ERROR"),
(Level::Warn, "WARN"),
(Level::Info, "INFO"),
(Level::Debug, "DEBUG"),
(Level::Trace, "TRACE"),
];
for (input, expected) in tests {
assert_eq!(*expected, input.as_str());
}
} | rust_cleaned_test_functions.jsonl/71728 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 202
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8274,
11898,
2895,
368,
341,
286,
1077,
7032,
284,
609,
9640,
310,
320,
4449,
486,
1454,
11,
330,
3682,
4461,
310,
320,
4449,
486,
38244,
11,
330,
74858,
4461,
310,
320,
4449,
486,
1731,
11,
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... | 2 |
#[test]
fn test_remove_emoji_string() {
let str = "<:butter:872873394570424340>";
let result = remove_emoji_string(str);
assert_eq!("butter", result);
} | rust_cleaned_test_functions.jsonl/71856 | {
"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,
18193,
62,
37523,
3904,
368,
341,
310,
1077,
607,
284,
4055,
25,
65,
6207,
25,
23,
22,
17,
23,
22,
18,
18,
24,
19,
20,
22,
15,
19,
17,
19,
18,
19,
15,
6734,
310,
1077,
1102,
284,
4057,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_align_to_zst() {
let bytes = [1, 2, 3, 4, 5, 6, 7];
let (prefix, aligned, suffix) = unsafe { bytes.align_to::<()>() };
assert_eq!(aligned.len(), 0);
assert!(prefix == [1, 2, 3, 4, 5, 6, 7] || suffix == [1, 2, 3, 4, 5, 6, 7]);
} | rust_cleaned_test_functions.jsonl/8469 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 129
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37015,
2346,
6415,
267,
368,
341,
262,
1077,
5820,
284,
508,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,
11,
220,
22,
935,
262,
1077,
320,
11849,
11,
26118,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_extract_var_for_break_not_applicable() {
check_assist_not_applicable(extract_variable, "fn main() { loop { $0break$0; }; }");
} | rust_cleaned_test_functions.jsonl/132844 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 75
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
4612,
5478,
39494,
7913,
8191,
46114,
368,
341,
286,
1779,
12083,
380,
7913,
8191,
46114,
5463,
2144,
14635,
11,
330,
8822,
1887,
368,
314,
6337,
314,
400,
15,
8960,
3,
15,
26,
20066,
335... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_agent() {
env_logger::init().unwrap_or(());
let dir = tempdir::TempDir::new("thrussh").unwrap();
let agent_path = dir.path().join("agent");
debug!("agent_path = {:?}", agent_path);
let mut core = tokio_core::reactor::Core::new().unwrap();
use agent;
let h = core.handle();
let listener = tokio_uds::UnixListener::bind(&agent_path, &h).unwrap().incoming();
h.spawn(
agent::server::AgentServer::new(listener, core.handle(), ())
.map_err(|e| error!("{:?}", e))
);
let key = decode_secret_key(PKCS8_ENCRYPTED, Some(b"blabla")).unwrap();
let public = key.clone_public_key();
let h = core.handle();
let stream = tokio_uds::UnixStream::connect(&agent_path, &h).unwrap();
core.run(
agent::client::AgentClient::connect(stream)
.add_identity(&key, &[agent::Constraint::KeyLifetime { seconds: 60 }]).and_then(|(client, _)| {
client.request_identities().and_then(|(client, id)| {
debug!("id = {:?}", id);
client.sign_request(&public, b"blabla").and_then(|(_, sig)| {
let sig = sig.unwrap();
debug!("sig = {:?}", &sig[..]);
futures::finished(())
})
})
})
).unwrap();
} | rust_cleaned_test_functions.jsonl/76374 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 789
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25730,
368,
341,
286,
6105,
27413,
486,
2327,
1005,
15454,
8734,
7,
1423,
286,
1077,
5419,
284,
2730,
3741,
486,
12151,
6184,
486,
931,
445,
339,
20341,
927,
1827,
15454,
543,
286,
1077,
8315,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dev_full() {
let mut buf = [0; 2048];
let mut proc = new_ucmd!().args(&["/dev/full"]).run_no_wait();
let mut proc_stdout = proc.stdout.take().unwrap();
let expected = [0; 2048];
proc_stdout.read_exact(&mut buf).unwrap();
assert_eq!(&buf[..], &expected[..]);
proc.kill().unwrap();
} | rust_cleaned_test_functions.jsonl/90943 | {
"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,
10433,
16372,
368,
341,
262,
1077,
5206,
6607,
284,
508,
15,
26,
220,
17,
15,
19,
23,
935,
262,
1077,
5206,
13674,
284,
501,
68887,
2277,
0,
1005,
2116,
2099,
1183,
14,
3583,
62975,
45014,
610... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_repeat() {
assert_eq!("".repeat(3), "");
assert_eq!("abc".repeat(0), "");
assert_eq!("α".repeat(3), "ααα");
} | rust_cleaned_test_functions.jsonl/17663 | {
"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,
41975,
368,
341,
262,
2060,
10714,
17223,
3263,
30624,
7,
18,
701,
14498,
262,
2060,
10714,
17223,
13683,
3263,
30624,
7,
15,
701,
14498,
262,
2060,
10714,
17223,
18945,
3263,
30624,
7,
18,
701,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_histogram_local() {
let buckets = vec![1.0, 2.0, 3.0];
let opts = HistogramOpts::new("test_histogram_local", "test histogram local help")
.buckets(buckets.clone());
let histogram = Histogram::with_opts(opts).unwrap();
let local = histogram.local();
let check = |count, sum| {
let m = histogram.metric();
let proto_histogram = m.get_histogram();
assert_eq!(proto_histogram.get_sample_count(), count);
assert!((proto_histogram.get_sample_sum() - sum) < EPSILON);
};
local.observe(1.0);
local.observe(4.0);
check(0, 0.0);
local.flush();
check(2, 5.0);
local.observe(2.0);
local.clear();
check(2, 5.0);
local.observe(2.0);
drop(local);
check(3, 7.0);
} | rust_cleaned_test_functions.jsonl/4647 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 457
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68564,
13564,
368,
341,
286,
1077,
42112,
284,
7486,
20703,
16,
13,
15,
11,
220,
17,
13,
15,
11,
220,
18,
13,
15,
935,
286,
1077,
12185,
284,
82138,
43451,
486,
931,
445,
1944,
68564,
13564,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_buffered_writer_seek() {
let mut w = BufWriter::with_capacity(3, io::Cursor::new(Vec::new()));
w.write_all(&[0, 1, 2, 3, 4, 5]).unwrap();
w.write_all(&[6, 7]).unwrap();
assert_eq!(w.seek(SeekFrom::Current(0)).ok(), Some(8));
assert_eq!(&w.get_ref().get_ref()[..], &[0, 1, 2, 3, 4, 5, 6, 7][..]);
assert_eq!(w.seek(SeekFrom::Start(2)).ok(), Some(2));
w.write_all(&[8, 9]).unwrap();
assert_eq!(&w.into_inner().unwrap().into_inner()[..], &[0, 1, 8, 9, 4, 5, 6, 7]);
} | rust_cleaned_test_functions.jsonl/12408 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 291
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7776,
291,
28908,
74473,
368,
341,
286,
1077,
5206,
289,
284,
69013,
6492,
486,
4197,
35603,
7,
18,
11,
6399,
486,
14543,
486,
931,
49923,
486,
931,
7392,
286,
289,
3836,
5705,
2099,
58,
15,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_new() {
let mut protocol = Protocol::new(get_default_fl_settings());
let counters = protocol.counters();
let expected = Counters {
..Default::default()
};
assert_eq!(counters, expected);
assert!(protocol.next_event().is_none());
} | rust_cleaned_test_functions.jsonl/97761 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
368,
341,
286,
1077,
5206,
11507,
284,
24572,
486,
931,
5433,
9993,
5081,
10853,
5231,
286,
1077,
31532,
284,
11507,
6501,
388,
543,
286,
1077,
3601,
284,
4504,
388,
341,
310,
5241,
3675,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_statuscache_serialize() {
let sig = Signature::default();
let mut status_cache = BankStatusCache::default();
let blockhash0 = hash(Hash::new(&vec![0; 32]).as_ref());
status_cache.add_root(0);
status_cache.clear_signatures();
status_cache.insert(&blockhash0, &sig, 0, ());
test_serialize(&mut status_cache, vec![blockhash0], &sig);
status_cache.insert(&blockhash0, &sig, 1, ());
test_serialize(&mut status_cache, vec![blockhash0], &sig);
let blockhash1 = hash(Hash::new(&vec![1; 32]).as_ref());
status_cache.insert(&blockhash1, &sig, 1, ());
test_serialize(&mut status_cache, vec![blockhash0, blockhash1], &sig);
let blockhash2 = hash(Hash::new(&vec![2; 32]).as_ref());
let ancestors = vec![(0, 1), (1, 1)].into_iter().collect();
assert!(status_cache
.get_signature_status(&sig, &blockhash2, &ancestors)
.is_none());
} | rust_cleaned_test_functions.jsonl/82716 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 446
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4773,
9360,
88686,
368,
341,
286,
1077,
8366,
284,
32232,
486,
2258,
543,
286,
1077,
5206,
2639,
11529,
284,
8547,
2522,
8233,
486,
2258,
543,
286,
1077,
2504,
8296,
15,
284,
5175,
7,
6370,
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_edge_inserted_undirected() {
let mut net: Network<usize, f64> = Network::new(false);
net.add_node(0);
net.add_node(1);
net.add_edge(0, 1, 10.0);
check_network(
net,
2,
1,
vec![0, 1],
vec![(0, 1, vec![&10.0]), (1, 0, vec![&10.0])],
);
} | rust_cleaned_test_functions.jsonl/127176 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 187
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17932,
17678,
291,
62,
1241,
74612,
368,
341,
262,
1077,
5206,
4179,
25,
8141,
90244,
11,
282,
21,
19,
29,
284,
8141,
486,
931,
3576,
626,
262,
4179,
1364,
5084,
7,
15,
317,
262,
4179,
1364,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_random_net() {
let seed: &[_] = &[1,2,3,4];
let mut rng: StdRng = rand::SeedableRng::from_seed(seed);
let net = random_net(100,5,&mut rng);
assert!(net.igraph.node_count() == 100);
} | rust_cleaned_test_functions.jsonl/47196 | {
"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,
22644,
19722,
368,
341,
286,
1077,
10320,
25,
609,
13496,
60,
284,
44590,
16,
11,
17,
11,
18,
11,
19,
935,
286,
1077,
5206,
28422,
25,
42517,
49,
968,
284,
10382,
486,
41471,
480,
49,
968,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_query_nonet() {
let authority = create_example();
let mut catalog = Catalog::new();
catalog.upsert(authority.origin().clone(), authority);
let client = SyncClient::new(TestClientConnection::new(catalog));
test_query(client);
} | rust_cleaned_test_functions.jsonl/17406 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5738,
21637,
295,
368,
341,
262,
1077,
11198,
284,
1855,
39304,
543,
262,
1077,
5206,
16403,
284,
31221,
486,
931,
543,
262,
16403,
17652,
6047,
48269,
487,
20248,
1005,
19982,
1507,
11198,
626,
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 |
#[test]
fn test_offset_start() {
let mut data: &[u8] = &[
1, 2, 3, 0b00110000, 10, 0x00, 0x03, 'a' as u8, '/' as u8, 'b' as u8, 'h' as u8, 'e' as u8,
'l' as u8, 'l' as u8, 'o' as u8,
0b00111000, 10, 0x00, 0x03, 'a' as u8, '/' as u8, 'b' as u8, 'h' as u8, 'e' as u8,
'l' as u8, 'l' as u8, 'o' as u8,
0b00111101, 12, 0x00, 0x03, 'a' as u8, '/' as u8, 'b' as u8, 0, 10, 'h' as u8, 'e' as u8,
'l' as u8, 'l' as u8, 'o' as u8,
];
let packet_buf = &mut [0u8; 64];
assert_eq!(clone_packet(&mut data, &mut packet_buf[..]).unwrap(), 12);
assert_eq!(data.len(), 29);
match decode_slice(packet_buf) {
Ok(Some(Packet::Publish(p))) => {
assert_eq!(p.dup, false);
assert_eq!(p.retain, false);
assert_eq!(p.qospid, QosPid::AtMostOnce);
assert_eq!(p.topic_name, "a/b");
assert_eq!(core::str::from_utf8(p.payload).unwrap(), "hello");
}
other => panic!("Failed decode: {:?}", other),
}
} | rust_cleaned_test_functions.jsonl/77903 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 597
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6917,
4906,
368,
341,
262,
1077,
5206,
821,
25,
44590,
84,
23,
60,
284,
609,
9640,
286,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
15,
65,
15,
15,
16,
16,
15,
15,
15,
15,
11,
220,
16,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_handle_and_sign_ping_pong() {
ProtocolTester::apply(|mut pt| {
let mut buf = vec![];
PingRequest {}.encode(&mut buf).unwrap();
pt.write_all(&buf).unwrap();
// receive response:
let mut resp_buf = vec![0u8; 1024];
pt.read(&mut resp_buf).unwrap();
let actual_len = extract_actual_len(&resp_buf).unwrap();
let mut resp = vec![0u8; actual_len as usize];
resp.copy_from_slice(&resp_buf[..actual_len as usize]);
PingResponse::decode(&resp).expect("decoding ping response failed");
send_poison_pill(&mut pt);
});
} | rust_cleaned_test_functions.jsonl/100207 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 282
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10630,
8378,
11172,
71661,
62,
59102,
368,
341,
262,
24572,
58699,
486,
10280,
22428,
6984,
10817,
91,
341,
286,
1077,
5206,
6607,
284,
7486,
0,
15078,
286,
48657,
1900,
84412,
6180,
2099,
6984,
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_edit_raster() {
let raster_path = env::temp_dir().join("rust-gdal-edit-test.tif");
{
let driver = Driver::get("GTiff").unwrap();
let dataset = driver.create_with_band_type::<u8>(&raster_path.to_string_lossy(), 20, 10, 1).unwrap();
}
{
let dataset = Dataset::edit(&raster_path).unwrap();
// create a 2x1 raster
let raster = ByteBuffer {
size: (2, 1),
data: vec![50u8, 20u8],
};
let res = dataset.write_raster(1, (0, 0), (20, 10), &raster);
assert!(res.is_ok());
let left = dataset.read_raster(1, (5, 5), (1, 1), (1, 1)).unwrap();
assert_eq!(left.data[0], 50u8);
// read a pixel from the right side
let right = dataset.read_raster(1, (15, 5), (1, 1), (1, 1)).unwrap();
assert_eq!(right.data[0], 20u8);
}
fs::remove_file(raster_path).unwrap();
} | rust_cleaned_test_functions.jsonl/83432 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 464
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13156,
1710,
2300,
368,
341,
262,
1077,
47208,
2638,
284,
6105,
486,
3888,
4334,
1005,
5987,
445,
35788,
2371,
51547,
22142,
16839,
78918,
3071,
262,
341,
286,
1077,
5579,
284,
14577,
486,
455,
44... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sub_2() {
let (h, l) = sub_2(Limb(4), Limb(2), Limb(3), Limb(1));
assert_eq!((h.0, l.0), (1, 1));
} | rust_cleaned_test_functions.jsonl/67885 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 78
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5228,
62,
17,
368,
341,
262,
1077,
320,
71,
11,
326,
8,
284,
1186,
62,
17,
4957,
20828,
7,
19,
701,
13589,
65,
7,
17,
701,
13589,
65,
7,
18,
701,
13589,
65,
7,
16,
1106,
262,
2060,
10714... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_basic() {
use std::thread;
let val = Sticky::new(true);
assert_eq!(val.to_string(), "true");
assert_eq!(val.get(), &true);
assert!(val.try_get().is_ok());
thread::spawn(move || {
assert!(val.try_get().is_err());
})
.join()
.unwrap();
} | rust_cleaned_test_functions.jsonl/13455 | {
"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,
34729,
368,
341,
262,
990,
1460,
486,
4528,
280,
262,
1077,
1044,
284,
92643,
486,
931,
3715,
317,
262,
2060,
10714,
10297,
831,
2389,
3904,
1507,
330,
1866,
797,
262,
2060,
10714,
10297,
831,
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... | 2 |
#[test]
fn test_write_raster() {
let driver = Driver::get("MEM").unwrap();
let dataset = driver.create("", 20, 10, 1).unwrap();
// create a 2x1 raster
let raster = ByteBuffer {
size: (2, 1),
data: vec![50u8, 20u8],
};
let res = dataset.write_raster(1, (0, 0), (20, 10), &raster);
assert!(res.is_ok());
// read a pixel from the left side
let left = dataset.read_raster(1, (5, 5), (1, 1), (1, 1)).unwrap();
assert_eq!(left.data[0], 50u8);
// read a pixel from the right side
let right = dataset.read_raster(1, (15, 5), (1, 1), (1, 1)).unwrap();
assert_eq!(right.data[0], 20u8);
} | rust_cleaned_test_functions.jsonl/83433 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 302
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
1710,
2300,
368,
341,
262,
1077,
5579,
284,
14577,
486,
455,
445,
31970,
1827,
15454,
543,
262,
1077,
10337,
284,
5579,
2520,
19814,
220,
17,
15,
11,
220,
16,
15,
11,
220,
16,
568,
15454... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_canonicalize_resource_3() {
let url = url::Url::parse("https://myaccount-secondary.blob.core.windows.\
net/mycontainer/myblob")
.unwrap();
assert_eq!(super::canonicalized_resource(&url),
"/myaccount-secondary/mycontainer/myblob");
} | rust_cleaned_test_functions.jsonl/100674 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27421,
22391,
551,
17962,
62,
18,
368,
341,
286,
1077,
2515,
284,
2515,
486,
2864,
486,
6400,
445,
2428,
1110,
2408,
4608,
29383,
96281,
4871,
68113,
13,
5661,
9699,
4179,
34198,
3586,
34198,
3511... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ordering() -> Result<(), Error> {
let kp = SampiKeyPair::new();
let mut sampis: Vec<_> = vec![5, 4, 3, 2, 1]
.into_iter()
.map(|i| kp.new_sampi().with_unix_time(i).build(vec![]).unwrap())
.collect();
assert_eq!(sampis[0].unix_time(), 5);
sampis.sort();
assert_eq!(
sampis.iter().map(|s| s.unix_time()).collect::<Vec<_>>(),
(1..=5).collect::<Vec<_>>()
);
Ok(())
} | rust_cleaned_test_functions.jsonl/67871 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 245
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7869,
287,
368,
1464,
5714,
68843,
4600,
29,
341,
262,
1077,
60319,
284,
90174,
72,
1592,
12443,
486,
931,
543,
262,
1077,
5206,
61481,
285,
25,
11312,
32399,
29,
284,
7486,
20703,
20,
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_read_default() {
let c = Config::from_yaml(config_file::DEFAULT_CONFIG).unwrap();
assert_eq!(
Config {
classic: Some(false),
blocks: Some(
vec![
"permission".into(),
"user".into(),
"group".into(),
"size".into(),
"date".into(),
"name".into(),
]
.into()
),
color: Some(config_file::Color {
when: ColorOption::Auto,
}),
date: None,
dereference: Some(false),
display: None,
icons: Some(config_file::Icons {
when: Some(IconOption::Auto),
theme: Some(IconTheme::Fancy),
separator: Some(" ".to_string()),
}),
ignore_globs: None,
indicators: Some(false),
layout: Some(Layout::Grid),
recursion: Some(config_file::Recursion {
enabled: Some(false),
depth: None,
}),
size: Some(SizeFlag::Default),
sorting: Some(config_file::Sorting {
column: Some(SortColumn::Name),
reverse: Some(false),
dir_grouping: Some(DirGrouping::None),
}),
no_symlink: Some(false),
total_size: Some(false),
symlink_arrow: Some("⇒".into()),
},
c
);
} | rust_cleaned_test_functions.jsonl/118383 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1091
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
9993,
368,
341,
286,
1077,
272,
284,
5532,
486,
1499,
64380,
8754,
2458,
486,
17285,
12568,
568,
15454,
543,
286,
2060,
10714,
33673,
310,
5532,
341,
394,
11416,
25,
4329,
3576,
1326,
394,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fmt() {
let op = Op::new(Kind::Match, 5);
assert_eq!(op.to_string(), "5M");
let op = Op::new(Kind::SoftClip, 13);
assert_eq!(op.to_string(), "13S");
} | rust_cleaned_test_functions.jsonl/52113 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 113
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38128,
368,
341,
286,
1077,
1179,
284,
10672,
486,
931,
7,
10629,
486,
8331,
11,
220,
20,
317,
286,
2060,
10714,
10297,
453,
2389,
3904,
1507,
330,
20,
44,
3071,
286,
1077,
1179,
284,
10672,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_ref() {
let mut ref_map = RefMap::new();
let ref_count = ref_map.add_ref("test_id".to_string());
assert_eq!(ref_count, 1);
let ref_count = ref_map.add_ref("test_id".to_string());
assert_eq!(ref_count, 2);
let ref_count = ref_map.add_ref("test_id_2".to_string());
assert_eq!(ref_count, 1);
} | rust_cleaned_test_functions.jsonl/504 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
7793,
368,
341,
286,
1077,
5206,
2053,
5376,
284,
8550,
2227,
486,
931,
543,
286,
1077,
2053,
3180,
284,
2053,
5376,
1364,
7793,
445,
1944,
842,
3263,
983,
3904,
1423,
286,
2060,
10714,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_column_convert() {
let a: Matrix<i64> = matrix![1, 2, 3, 4;
5, 6, 7, 8;
9, 10, 11, 12];
let row = a.col(1);
let v: Vector<i64> = row.into();
assert_eq!(v, vector![2, 6, 10]);
let row = a.col(2);
let v = Vector::from(row);
assert_eq!(v, vector![3, 7, 11]);
} | rust_cleaned_test_functions.jsonl/43652 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 263
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8744,
34910,
368,
341,
286,
1077,
264,
25,
11631,
21897,
21,
19,
29,
284,
6172,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
280,
10589,
220,
20,
11,
220,
21,
11,
220,
22,
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_styled_variable_as_text() {
const FORMAT_STR: &str = "[$var](red bold)";
let var_style = Some(Color::Red.bold());
let formatter = StringFormatter::new(FORMAT_STR)
.unwrap()
.map(|variable| match variable {
"var" => Some(Ok("text".to_owned())),
_ => None,
});
let result = formatter.parse(None).unwrap();
let mut result_iter = result.iter();
match_next!(result_iter, "text", var_style);
} | rust_cleaned_test_functions.jsonl/71883 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 262
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
7601,
14635,
11898,
4326,
368,
341,
286,
733,
52225,
7159,
25,
609,
495,
284,
330,
3442,
947,
9533,
1151,
13939,
24023,
286,
1077,
762,
15117,
284,
4329,
15028,
486,
6033,
31675,
5231,
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... | 2 |
#[test]
fn test_module_from_str() {
let cases = vec![
("readpool", Module::Readpool),
("server", Module::Server),
("metric", Module::Metric),
("raft_store", Module::Raftstore),
("coprocessor", Module::Coprocessor),
("pd", Module::Pd),
("split", Module::Split),
("rocksdb", Module::Rocksdb),
("raft_engine", Module::RaftEngine),
("storage", Module::Storage),
("security", Module::Security),
("import", Module::Import),
("backup", Module::Backup),
("pessimistic_txn", Module::PessimisticTxn),
("gc", Module::Gc),
("cdc", Module::CDC),
("resolved_ts", Module::ResolvedTs),
("resource_metering", Module::ResourceMetering),
("unknown", Module::Unknown("unknown".to_string())),
];
for (name, module) in cases {
assert_eq!(Module::from(name), module);
}
} | rust_cleaned_test_functions.jsonl/2175 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 514
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10750,
5673,
2895,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
3489,
878,
10285,
497,
13711,
486,
4418,
10285,
1326,
310,
3489,
4030,
497,
13711,
486,
5475,
1326,
310,
3489,
15903,
497,
1371... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_iterator_step_by() {
// Identity
let mut it = (0..).step_by(1).take(3);
assert_eq!(it.next(), Some(0));
assert_eq!(it.next(), Some(1));
assert_eq!(it.next(), Some(2));
assert_eq!(it.next(), None);
let mut it = (0..).step_by(3).take(4);
assert_eq!(it.next(), Some(0));
assert_eq!(it.next(), Some(3));
assert_eq!(it.next(), Some(6));
assert_eq!(it.next(), Some(9));
assert_eq!(it.next(), None);
} | rust_cleaned_test_functions.jsonl/54068 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 222
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13491,
11946,
3710,
368,
341,
262,
442,
26540,
198,
262,
1077,
5206,
432,
284,
320,
15,
496,
568,
9520,
3710,
7,
16,
568,
22769,
7,
18,
317,
262,
2060,
10714,
10297,
275,
4529,
1507,
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_put_update() {
let mut cache: LruCache<String, Vec<u8>> = LruCache::new(1);
cache.put("1".to_string(), vec![10, 10]);
cache.put("1".to_string(), vec![10, 19]);
assert_opt_eq(cache.get(&"1".to_string()), vec![10, 19]);
assert_eq!(cache.len(), 1);
} | rust_cleaned_test_functions.jsonl/30779 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 158
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15557,
8882,
368,
341,
286,
1077,
5206,
6500,
25,
444,
2672,
8233,
3464,
11,
11312,
34837,
23,
2452,
284,
444,
2672,
8233,
486,
931,
7,
16,
317,
286,
6500,
3597,
445,
16,
3263,
983,
3904,
1507... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_autoscaler_defaults() {
let autoscaler = Autoscaler {
name: "release".into(),
instance_name: "instance".into(),
component_name: "component".into(),
cpu: None,
memory: None,
minimum: None,
maximum: None,
owner_ref: None,
};
let kauto = autoscaler.to_horizontal_pod_autoscaler();
assert_eq!(
Some("instance-trait-autoscaler".to_string()),
kauto.metadata.expect("metadata").name
);
let spec = kauto.spec.expect("spec");
assert_eq!(10, spec.max_replicas);
} | rust_cleaned_test_functions.jsonl/50204 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 272
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32808,
436,
63084,
42290,
368,
341,
262,
1077,
46872,
63084,
284,
91552,
63084,
341,
286,
829,
25,
330,
22998,
3263,
18122,
3148,
286,
2867,
1269,
25,
330,
4851,
3263,
18122,
3148,
286,
3692,
1269... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bit_xor() {
let cases = vec![
(Some(123), Some(321), Some(314)),
(Some(-123), Some(321), Some(-316)),
(None, Some(1), None),
(Some(1), None, None),
(None, None, None),
];
for (lhs, rhs, expected) in cases {
let output = RpnFnScalarEvaluator::new()
.push_param(lhs)
.push_param(rhs)
.evaluate(ScalarFuncSig::BitXorSig)
.unwrap();
assert_eq!(output, expected);
}
} | rust_cleaned_test_functions.jsonl/29755 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 340
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13996,
76462,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
320,
8373,
7,
16,
17,
18,
701,
4329,
7,
18,
17,
16,
701,
4329,
7,
18,
16,
19,
6965,
310,
320,
8373,
4080,
16,
17,
18,
701,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_safe_checkout_local_tree_to_blob() -> BitResult<()> {
BitRepo::with_sample_repo(|repo| {
rmdir!(repo: "dir");
touch!(repo: "dir" < "hi");
bit_checkout!(repo: "master")?;
assert_eq!(cat!(repo: "dir"), "hi");
Ok(())
})
} | rust_cleaned_test_functions.jsonl/62992 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 160
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34067,
68186,
13564,
11663,
2346,
45908,
368,
1464,
6495,
2077,
71698,
341,
262,
6495,
25243,
486,
4197,
17491,
37784,
22428,
23476,
91,
341,
286,
435,
69695,
10297,
23476,
25,
330,
3741,
797,
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... | 2 |
#[test]
fn test_args_override() {
#[cross_check(yes, args(_a(fixed = 0x1234), _b(none)))]
fn abcd(_a: u8, _b: u64) {}
abcd(0x7fu8, 1u64);
expect_xcheck(FUNCTION_ENTRY_TAG, 0x7c93ee4f_u64);
expect_xcheck(FUNCTION_ARG_TAG, 0x1234_u64);
expect_xcheck(FUNCTION_EXIT_TAG, 0x7c93ee4f_u64);
expect_no_xchecks();
} | rust_cleaned_test_functions.jsonl/41194 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 216
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8384,
48576,
368,
341,
286,
11506,
28842,
7200,
7021,
288,
11,
2827,
2490,
64,
955,
3286,
284,
220,
15,
87,
16,
17,
18,
19,
701,
716,
65,
1445,
603,
593,
5563,
286,
5168,
668,
4385,
2490,
64... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_single_srv_query_response() {
let cache = DnsLru::new(1, dns_lru::TtlConfig::default());
let mut message = srv_message().unwrap();
message.add_answer(Record::from_rdata(
Name::from_str("www.example.com.").unwrap(),
86400,
RData::CNAME(Name::from_str("actual.example.com.").unwrap()),
));
message.insert_additionals(vec![
Record::from_rdata(
Name::from_str("actual.example.com.").unwrap(),
86400,
RData::A(Ipv4Addr::new(127, 0, 0, 1)),
),
Record::from_rdata(
Name::from_str("actual.example.com.").unwrap(),
86400,
RData::AAAA(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1)),
),
]);
let client = mock(vec![error(), Ok(message)]);
let client = CachingClient::with_cache(cache, client, false);
let ips = block_on(CachingClient::inner_lookup(
Query::query(
Name::from_str("_443._tcp.www.example.com.").unwrap(),
RecordType::SRV,
),
DnsRequestOptions::default(),
client,
vec![],
))
.expect("lookup failed");
assert_eq!(
ips.iter().cloned().collect::<Vec<_>>(),
vec![
RData::SRV(SRV::new(
1,
2,
443,
Name::from_str("www.example.com.").unwrap(),
)),
RData::A(Ipv4Addr::new(127, 0, 0, 1)),
RData::AAAA(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1)),
]
);
} | rust_cleaned_test_functions.jsonl/39912 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1017
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19487,
63921,
5738,
9655,
368,
341,
286,
1077,
6500,
284,
422,
4412,
43,
2672,
486,
931,
7,
16,
11,
44077,
907,
2672,
486,
51,
11544,
2648,
486,
2258,
5231,
286,
1077,
5206,
1943,
284,
43578,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_current_term() {
let mut store = MemLog::new();
assert_eq!(Term(0), store.current_term().unwrap());
store.set_voted_for(ServerId::from(0)).unwrap();
store.set_current_term(Term(42)).unwrap();
assert_eq!(None, store.voted_for().unwrap());
assert_eq!(Term(42), store.current_term().unwrap());
store.inc_current_term().unwrap();
assert_eq!(Term(43), store.current_term().unwrap());
} | rust_cleaned_test_functions.jsonl/5430 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 213
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11080,
17464,
368,
341,
286,
1077,
5206,
3553,
284,
13550,
2201,
486,
931,
543,
286,
2060,
10714,
10297,
17249,
7,
15,
701,
3553,
4952,
17464,
1005,
15454,
1423,
286,
3553,
980,
2273,
9253,
5478,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
let s = "+28.700";
let res = s.parse::<Decimal<3>>();
assert!(!res.is_err());
let dec = res.unwrap();
assert_eq!(dec.coeff, 28700);
} | rust_cleaned_test_functions.jsonl/12030 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
368,
341,
286,
1077,
274,
284,
6630,
17,
23,
13,
22,
15,
15,
876,
286,
1077,
592,
284,
274,
4632,
27638,
11269,
27,
18,
37038,
286,
2060,
0,
3471,
416,
2079,
9266,
1423,
286,
1077,
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_no_inline_aliases4b() {
test_same(
"var x = this.foo(); this.bar(); function f() { var y; y = x; y = 3; this.baz(y); }",
);
} | rust_cleaned_test_functions.jsonl/27684 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 84
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
41871,
90233,
19,
65,
368,
341,
262,
1273,
33574,
1006,
286,
330,
947,
856,
284,
419,
58432,
2129,
419,
22001,
2129,
220,
729,
282,
368,
314,
762,
379,
26,
379,
284,
856,
26,
379,
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 |
#[test]
fn test_auto_orient() {
START.call_once(|| {
magick_wand_genesis();
});
let wand = MagickWand::new();
assert!(wand.read_image("tests/data/IMG_5745_rotl.JPG").is_ok());
assert_eq!(true, wand.requires_orientation());
assert!(wand.auto_orient());
assert_eq!(false, wand.requires_orientation());
} | rust_cleaned_test_functions.jsonl/57699 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27740,
53493,
368,
341,
262,
20998,
8524,
7630,
79453,
341,
286,
4878,
865,
1670,
437,
16322,
13774,
543,
262,
1625,
262,
1077,
28710,
284,
87154,
54,
437,
486,
931,
543,
262,
2060,
10297,
79810,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_ping_resp() {
let mut data = bm(&[0b11010000, 0b00000000]);
assert_eq!(Ok(Some(Packet::Pingresp)), decode(&mut data));
} | rust_cleaned_test_functions.jsonl/95616 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 67
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71661,
35160,
368,
341,
262,
1077,
5206,
821,
284,
34868,
2099,
58,
15,
65,
16,
16,
15,
16,
15,
15,
15,
15,
11,
220,
15,
65,
15,
15,
15,
15,
15,
15,
15,
15,
2558,
262,
2060,
10714,
10297... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_parse_cie_32_bad_version() {
let mut cie = CommonInformationEntry {
offset: 0,
length: 0,
format: Format::Dwarf32,
version: 99,
augmentation: None,
address_size: 4,
segment_size: 0,
code_alignment_factor: 1,
data_alignment_factor: 2,
return_address_register: Register(3),
initial_instructions: EndianSlice::new(&[], LittleEndian),
};
let kind = debug_frame_le();
let section = Section::with_endian(kind.endian()).cie(kind, None, &mut cie);
assert_parse_cie(kind, section, 4, Err(Error::UnknownVersion(99)));
} | rust_cleaned_test_functions.jsonl/9298 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 358
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
666,
645,
62,
18,
17,
34199,
9438,
368,
341,
286,
1077,
5206,
272,
645,
284,
7718,
14873,
5874,
341,
310,
4347,
25,
220,
15,
345,
310,
3084,
25,
220,
15,
345,
310,
3561,
25,
15042,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_primitive_array_divide_by_zero() {
let a = Int32Array::from(vec![15]);
let b = Int32Array::from(vec![0]);
assert_eq!(
ArrowError::DivideByZero,
divide(&a, &b).err().expect("divide by zero should fail")
);
} | rust_cleaned_test_functions.jsonl/70658 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84087,
3858,
16237,
577,
3710,
19359,
368,
341,
286,
1077,
264,
284,
1333,
18,
17,
1857,
486,
1499,
25592,
20703,
16,
20,
2558,
286,
1077,
293,
284,
1333,
18,
17,
1857,
486,
1499,
25592,
20703,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_register_histogram_trailing_comma() {
let opts = histogram_opts!("test_macro_histogram", "help",);
let res1 = register_histogram!(opts,);
assert!(res1.is_ok());
let res2 = register_histogram!("test_macro_histogram_2", "help",);
assert!(res2.is_ok());
let res3 = register_histogram!("test_macro_histogram_4", "help", vec![1.0, 2.0],);
assert!(res3.is_ok());
} | rust_cleaned_test_functions.jsonl/86375 | {
"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,
14000,
68564,
3547,
14277,
2965,
1728,
368,
341,
262,
1077,
12185,
284,
30281,
32354,
17223,
1944,
58810,
68564,
497,
330,
8653,
497,
317,
262,
1077,
592,
16,
284,
4161,
68564,
10297,
10518,
11,
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_isaac64_serde() {
use bincode;
use std::io::{BufWriter, BufReader};
let seed = [1,0,0,0, 23,0,0,0, 200,1,0,0, 210,30,0,0,
57,48,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0];
let mut rng = Isaac64Rng::from_seed(seed);
let buf: Vec<u8> = Vec::new();
let mut buf = BufWriter::new(buf);
bincode::serialize_into(&mut buf, &rng).expect("Could not serialize");
let buf = buf.into_inner().unwrap();
let mut read = BufReader::new(&buf[..]);
let mut deserialized: Isaac64Rng = bincode::deserialize_from(&mut read).expect("Could not deserialize");
for _ in 0..300 { // more than the 256 buffered results
assert_eq!(rng.next_u64(), deserialized.next_u64());
}
} | rust_cleaned_test_functions.jsonl/5540 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 405
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
64705,
21,
19,
75861,
450,
368,
341,
286,
990,
9544,
1851,
280,
286,
990,
1460,
486,
815,
22964,
15064,
6492,
11,
69013,
5062,
2315,
286,
1077,
10320,
284,
508,
16,
11,
15,
11,
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... | 2 |
#[test]
fn test_deref_index() {
let mut a = Dummy::from(vec![1, 2, 3]);
assert_eq!(a.len(), 3);
a.push(4);
assert_eq!(&**a, &[1, 2, 3, 4][..]);
assert_eq!(a[1], 2);
a[2] = 5;
assert_eq!(a[2], 5);
} | rust_cleaned_test_functions.jsonl/124284 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 135
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
43970,
3560,
368,
341,
262,
1077,
5206,
264,
284,
50567,
486,
1499,
25592,
20703,
16,
11,
220,
17,
11,
220,
18,
10149,
262,
2060,
10714,
10297,
64,
19406,
1507,
220,
18,
317,
262,
264,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_starts_with() {
assert!(("".starts_with("")));
assert!(("abc".starts_with("")));
assert!(("abc".starts_with("a")));
assert!((!"a".starts_with("abc")));
assert!((!"".starts_with("abc")));
assert!((!"ödd".starts_with("-")));
assert!(("ödd".starts_with("öd")));
} | rust_cleaned_test_functions.jsonl/2429 | {
"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,
86552,
6615,
368,
341,
286,
2060,
10297,
445,
3263,
65876,
6615,
445,
17621,
286,
2060,
10297,
445,
13683,
3263,
65876,
6615,
445,
17621,
286,
2060,
10297,
445,
13683,
3263,
65876,
6615,
445,
64,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pending_delete_ranges() {
let mut pending_delete_ranges = PendingDeleteRanges::default();
let id = 0;
let timeout1 = 10;
insert_range(&mut pending_delete_ranges, id, "a", "c", timeout1);
insert_range(&mut pending_delete_ranges, id, "m", "n", timeout1);
insert_range(&mut pending_delete_ranges, id, "x", "z", timeout1);
insert_range(&mut pending_delete_ranges, id + 1, "f", "i", timeout1);
insert_range(&mut pending_delete_ranges, id + 1, "p", "t", timeout1);
assert_eq!(pending_delete_ranges.len(), 5);
// a____c f____i m____n p____t x____z
// g___________________q
let timeout2 = 12;
let overlap_ranges =
pending_delete_ranges.drain_overlap_ranges(&b"g".to_vec(), &b"q".to_vec());
assert_eq!(
overlap_ranges,
[
(id + 1, b"f".to_vec(), b"i".to_vec(), timeout1),
(id, b"m".to_vec(), b"n".to_vec(), timeout1),
(id + 1, b"p".to_vec(), b"t".to_vec(), timeout1),
]
);
assert_eq!(pending_delete_ranges.len(), 2);
insert_range(&mut pending_delete_ranges, id + 2, "g", "q", timeout2);
assert_eq!(pending_delete_ranges.len(), 3);
{
let now = 11;
let ranges: Vec<_> = pending_delete_ranges.stale_ranges(now).collect();
assert_eq!(
ranges,
[
(id, "a".as_bytes(), "c".as_bytes()),
(id, "x".as_bytes(), "z".as_bytes()),
]
);
for start_key in ranges
.into_iter()
.map(|(_, start, _)| start.to_vec())
.collect::<Vec<Vec<u8>>>()
{
pending_delete_ranges.remove(&start_key);
}
assert_eq!(pending_delete_ranges.len(), 1);
}
{
let now = 14;
let ranges: Vec<_> = pending_delete_ranges.stale_ranges(now).collect();
assert_eq!(ranges, [(id + 2, "g".as_bytes(), "q".as_bytes())]);
for start_key in ranges
.into_iter()
.map(|(_, start, _)| start.to_vec())
.collect::<Vec<Vec<u8>>>()
{
pending_delete_ranges.remove(&start_key);
}
assert_eq!(pending_delete_ranges.len(), 0);
}
} | rust_cleaned_test_functions.jsonl/59214 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1413
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37861,
11353,
58748,
368,
341,
286,
1077,
5206,
15280,
11353,
58748,
284,
41840,
6435,
74902,
486,
2258,
543,
286,
1077,
877,
284,
220,
15,
401,
286,
1077,
9632,
16,
284,
220,
16,
15,
280,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.