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_banks_client_new() {
let (client_transport, _server_transport) = transport::channel::unbounded();
BanksClient::new(client::Config::default(), client_transport);
} | rust_cleaned_test_functions.jsonl/10533 | {
"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,
880,
4039,
8179,
5921,
368,
341,
286,
1077,
320,
2972,
46398,
11,
716,
4030,
46398,
8,
284,
7557,
486,
10119,
486,
359,
65686,
543,
286,
37766,
2959,
486,
931,
12805,
486,
2648,
486,
2258,
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 |
#[test]
fn test_hello_world() {
runner::run("hello-world", |run| {
run.build(SandboxBuilder::new().enable_networking(false), |build| {
let storage = rustwide::logging::LogStorage::new(LevelFilter::Info);
rustwide::logging::capture(&storage, || -> Result<_, Error> {
build.cargo().args(&["run"]).run()?;
Ok(())
})?;
assert!(storage.to_string().contains("[stdout] Hello, world!\n"));
Ok(())
})?;
Ok(())
});
} | rust_cleaned_test_functions.jsonl/74697 | {
"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,
96724,
31792,
368,
341,
262,
22259,
486,
6108,
445,
14990,
30084,
497,
760,
6108,
91,
341,
286,
1598,
13239,
3759,
31536,
3297,
486,
931,
1005,
12552,
20966,
287,
3576,
701,
760,
5834,
91,
341,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_set_raw() {
let mut headers = Headers::new();
headers.set(ContentLength(10));
headers.set_raw("content-LENGTH", vec![b"20".to_vec()]);
assert_eq!(headers.get_raw("Content-length").unwrap(), &[b"20".to_vec()][]);
assert_eq!(headers.get(), Some(&ContentLength(20)));
} | rust_cleaned_test_functions.jsonl/18246 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 152
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
16067,
368,
341,
286,
1077,
5206,
7102,
284,
21426,
486,
931,
543,
286,
7102,
980,
79352,
4373,
7,
16,
15,
1106,
286,
7102,
980,
16067,
445,
1796,
12,
65981,
497,
7486,
20703,
65,
1,
17,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_float() {
let expected = 1f64;
let mut actual = 1f64;
let precision = 0.1f64;
actual = actual + precision / 2f64;
assert!((expected - actual).abs() < precision);
} | rust_cleaned_test_functions.jsonl/13120 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 81
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17586,
368,
341,
197,
10217,
3601,
284,
220,
16,
69,
21,
19,
280,
197,
10217,
5206,
5042,
284,
220,
16,
69,
21,
19,
280,
197,
10217,
16052,
284,
220,
15,
13,
16,
69,
21,
19,
280,
197,
8881... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_builtin_functions() {
assert_eq!(eval("min(4.0, 3)"), Ok(Value::Int(3)));
assert_eq!(eval("max(4.0, 3)"), Ok(Value::Float(4.0)));
assert_eq!(eval("len(\"foobar\")"), Ok(Value::Int(6)));
assert_eq!(
eval("str::to_lowercase(\"FOOBAR\")"),
Ok(Value::from("foobar"))
);
assert_eq!(
eval("str::to_uppercase(\"foobar\")"),
Ok(Value::from("FOOBAR"))
);
assert_eq!(
eval("str::trim(\" foo bar \")"),
Ok(Value::from("foo bar"))
);
} | rust_cleaned_test_functions.jsonl/105347 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 277
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73829,
31708,
368,
341,
262,
2060,
10714,
10297,
14170,
445,
1065,
7,
19,
13,
15,
11,
220,
18,
8,
3975,
7622,
25346,
486,
1072,
7,
18,
4945,
262,
2060,
10714,
10297,
14170,
445,
2810,
7,
19,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_set_group() {
setup();
let p = Path::new("/tmp/nexus-fixer/batman");
assert!(touch(p).is_ok());
assert!(set_owner(p).is_ok());
check_group(
p,
get_gid().expect("failed to read GID"),
);
assert!(fs::remove_file(p).is_ok());
} | rust_cleaned_test_functions.jsonl/26860 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 184
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
6288,
368,
341,
286,
6505,
543,
286,
1077,
281,
284,
7933,
486,
931,
4283,
5173,
9612,
23666,
2220,
39014,
3470,
266,
1515,
797,
286,
2060,
10297,
22020,
1295,
568,
285,
19817,
1423,
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_zip_map_rev_sideffectful() {
let mut xs = [0; 6];
let mut ys = [0; 4];
{
let mut it = xs.iter_mut().map(|x| *x += 1).zip(ys.iter_mut().map(|y| *y += 1));
it.next_back();
}
assert_eq!(&xs, &[0, 0, 0, 1, 1, 1]);
assert_eq!(&ys, &[0, 0, 0, 1]);
let mut xs = [0; 6];
let mut ys = [0; 4];
{
let mut it = xs.iter_mut().map(|x| *x += 1).zip(ys.iter_mut().map(|y| *y += 1));
(&mut it).take(5).count();
it.next_back();
}
assert_eq!(&xs, &[1, 1, 1, 1, 1, 1]);
assert_eq!(&ys, &[1, 1, 1, 1]);
} | rust_cleaned_test_functions.jsonl/8965 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 335
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42131,
5376,
38082,
30862,
1705,
1262,
368,
341,
262,
1077,
5206,
11943,
284,
508,
15,
26,
220,
21,
935,
262,
1077,
5206,
31810,
284,
508,
15,
26,
220,
19,
4821,
262,
341,
286,
1077,
5206,
432... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_calc_coefficient() {
// unsigned simple
assert_almost_eq!(calc_coefficient(0x00, 0b1000, 12, 3, 0), 1.0);
// signed simple
assert_almost_eq!(calc_coefficient(0xFF, 0xF8, 12, 3, 0), -1.0);
assert_almost_eq!(calc_coefficient(0x80, 0x00, 15, 0, 0), -32_768_f32);
assert_almost_eq!(calc_coefficient(0x00, 0x01, 15, 0, 10), 0.000_000_000_1);
} | rust_cleaned_test_functions.jsonl/128466 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 306
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38241,
31990,
5385,
368,
341,
394,
442,
3774,
4285,
198,
394,
2060,
94418,
10714,
10297,
26586,
31990,
5385,
7,
15,
87,
15,
15,
11,
220,
15,
65,
16,
15,
15,
15,
11,
220,
16,
17,
11,
220,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_fees_to_request_valid_from_libindy() {
let (wallet, input_address) = init_wallet_with_address();
let did = "Th7MpTaRZVRYnPiabds81Y";
let fake_request = json!({
"operation": {
"type": "3"
}
});
let txo = TXO { address: input_address, seq_no: 1 };
let inputs = json!([txo.to_libindy_string().unwrap()]);
let outputs = json!([{
"recipient": "pay:sov:dctKSXBbv2My3TGGUgTFjkxu1A9JM3Sscd5FydY4dkxnfwA7q",
"amount": 20,
}]);
let expected_fees_request = json!({
"fees": [
[
{
"address": "iTQzpdRdugkJ2gLD5vW5c159dncSL9jbAtu3WfPcb8qWD9bUd",
"seqNo": 1
}
],
[
{
"address": "dctKSXBbv2My3TGGUgTFjkxu1A9JM3Sscd5FydY4dkxnfwA7q",
"amount": 20
}
],
["64wPLDPMjGxgqTdrNTZFa9CK4NtvBx7eLJkgnjW3JchRGyMUr29tjkAiHCTnhLtkdW81k5BtBiiqM2tkaMB2eouv"]
],
"operation": {
"type": "3"
}
});
let (sender, receiver) = channel();
let cb = move |ec, req, method| {
sender.send((ec, req, method)).unwrap();
};
let return_error = indy::payments::Payment::add_request_fees_async(
wallet.handle,
Some(did),
&fake_request.to_string(),
&inputs.to_string(),
&outputs.to_string(),
None,
cb
);
let (req, method) = ResultHandler::two_timeout(return_error, receiver, Duration::from_secs(15)).unwrap();
assert_eq!("sov", method);
assert_eq!(expected_fees_request.to_string(), req);
} | rust_cleaned_test_functions.jsonl/90661 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 988
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
761,
5516,
2346,
7893,
8337,
5673,
16142,
48990,
368,
341,
262,
1077,
320,
35735,
11,
1946,
6744,
8,
284,
2930,
62308,
6615,
6744,
543,
262,
1077,
1521,
284,
330,
1001,
22,
72150,
55999,
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_echo() {
let mut cmd = new_ucmd!();
cmd.arg("echo").arg("FOO-bar");
println!("cmd={:?}", cmd);
let result = cmd.run();
println!("success={:?}", result.success);
println!("stdout={:?}", result.stdout);
println!("stderr={:?}", result.stderr);
assert!(result.success);
let out = result.stdout.trim_end();
assert_eq!(out, "FOO-bar");
} | rust_cleaned_test_functions.jsonl/1539 | {
"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,
68628,
368,
341,
1066,
262,
1077,
5206,
5439,
284,
501,
68887,
2277,
0,
543,
262,
5439,
21186,
445,
3047,
1827,
858,
445,
3788,
46,
15773,
797,
262,
13751,
17223,
8710,
1165,
25,
52652,
5439,
62... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_append() {
let mut a: VecDeque<_> = vec![1, 2, 3].into_iter().collect();
let mut b: VecDeque<_> = vec![4, 5, 6].into_iter().collect();
// normal append
a.append(&mut b);
assert_eq!(a.iter().cloned().collect::<Vec<_>>(), [1, 2, 3, 4, 5, 6]);
assert_eq!(b.iter().cloned().collect::<Vec<_>>(), []);
// append nothing to something
a.append(&mut b);
assert_eq!(a.iter().cloned().collect::<Vec<_>>(), [1, 2, 3, 4, 5, 6]);
assert_eq!(b.iter().cloned().collect::<Vec<_>>(), []);
// append something to nothing
b.append(&mut a);
assert_eq!(b.iter().cloned().collect::<Vec<_>>(), [1, 2, 3, 4, 5, 6]);
assert_eq!(a.iter().cloned().collect::<Vec<_>>(), []);
} | rust_cleaned_test_functions.jsonl/73728 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 330
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26041,
368,
341,
262,
1077,
5206,
264,
25,
11312,
73891,
32399,
29,
284,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
936,
18122,
11723,
1005,
17384,
543,
262,
1077,
5206,
293,
25,
11312,
73891,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_slot_from_cadence_ts_check() {
let rem = BLOCK_START_TS.clone() % 1_000_000;
let secs = ((BLOCK_START_TS.clone() - rem) / 1_000_000_000) + 1;
let start_ts = Utc.timestamp(secs as i64, 0).naive_utc().timestamp_nanos() as u64;
let context = get_context(accounts(1));
testing_env!(context.build());
let current_block_ts = env::block_timestamp();
// Seconds
let schedule1 = Schedule::from_str(&"*/5 * * * * *".to_string()).unwrap();
let next_ts1 = schedule1.next_after(¤t_block_ts).unwrap();
println!("TS 1: {} {}", next_ts1, human_readable_time(next_ts1));
let denom1 = 5 * NANO;
let rem1 = start_ts.clone() % denom1;
assert_eq!(next_ts1, (start_ts.clone() - rem1) + denom1);
// Minutes
let schedule2 = Schedule::from_str(&"* */5 * * * *".to_string()).unwrap();
let next_ts2 = schedule2.next_after(¤t_block_ts).unwrap();
println!("TS 2: {} {}", next_ts2, human_readable_time(next_ts2));
let denom2 = 5 * 60 * NANO;
let rem2 = start_ts.clone() % denom2;
assert_eq!(next_ts2, (start_ts.clone() - rem2) + denom2);
// Hours
let schedule3 = Schedule::from_str(&"* * */5 * * *".to_string()).unwrap();
let next_ts3 = schedule3.next_after(¤t_block_ts).unwrap();
println!("TS 3: {} {}", next_ts3, human_readable_time(next_ts3));
assert_eq!(next_ts3, 1624165200000000000);
// Days
let schedule4 = Schedule::from_str(&"* * * 10 * *".to_string()).unwrap();
let next_ts4 = schedule4.next_after(¤t_block_ts).unwrap();
println!("TS 4: {} {}", next_ts4, human_readable_time(next_ts4));
assert_eq!(next_ts4, 1625875200000000000);
// Month
let schedule5 = Schedule::from_str(&"* * * * 10 *".to_string()).unwrap();
let next_ts5 = schedule5.next_after(¤t_block_ts).unwrap();
println!("TS 5: {} {}", next_ts5, human_readable_time(next_ts5));
assert_eq!(next_ts5, 1633046400000000000);
// Year
let schedule6 = Schedule::from_str(&"* * * * * * 2025".to_string()).unwrap();
let next_ts6 = schedule6.next_after(¤t_block_ts).unwrap();
println!("TS 6: {} {}", next_ts6, human_readable_time(next_ts6));
assert_eq!(next_ts6, 1750381904000000000);
} | rust_cleaned_test_functions.jsonl/43010 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
27563,
5673,
666,
329,
763,
25023,
7200,
368,
341,
286,
1077,
1299,
284,
28677,
13044,
61793,
15997,
368,
1018,
220,
16,
62,
15,
15,
15,
62,
15,
15,
15,
280,
286,
1077,
49749,
284,
1781,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_do_while_statement() {
expect_printed("do {} while (true)", "do {} while (true);\n");
expect_printed("do {} while (1 < 10)", "do {} while (1 < 10);\n");
expect_printed(
"do { return 3; } while (1 < 10)",
"do { return 3;\n } while (1 < 10);\n",
);
} | rust_cleaned_test_functions.jsonl/93434 | {
"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,
26309,
86069,
37404,
368,
341,
262,
1720,
10064,
291,
445,
2982,
4687,
1393,
320,
1866,
11583,
330,
2982,
4687,
1393,
320,
1866,
44388,
77,
797,
262,
1720,
10064,
291,
445,
2982,
4687,
1393,
320,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_backup_stack() {
let db = CheckpointDb::new(MemoryDB::new());
let handler = db.handler();
assert_eq!(stack_len(&db), 0);
handler.checkpoint();
assert_eq!(stack_len(&db), 1);
handler.rollback();
assert_eq!(stack_len(&db), 0);
handler.checkpoint();
handler.checkpoint();
assert_eq!(stack_len(&db), 2);
handler.rollback();
assert_eq!(stack_len(&db), 1);
} | rust_cleaned_test_functions.jsonl/69288 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 232
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44710,
15528,
368,
341,
286,
1077,
2927,
284,
4248,
2768,
7994,
486,
931,
3189,
4731,
3506,
486,
931,
1423,
286,
1077,
7013,
284,
2927,
31171,
1428,
286,
2060,
10714,
10297,
7693,
6043,
2099,
1999... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parses_struct_def() {
parses_to! {
parser: AwsGoEventsParser,
input: "type MyFoo struct {}",
rule: Rule::struct_def,
tokens: [
struct_def(0, 20, [
struct_preamble(0, 17, [
struct_name(5, 10, [
ident(5, 10),
]),
]),
]),
]
};
parses_to! {
parser: AwsGoEventsParser,
input: "type MyFoo struct { foo string }",
rule: Rule::struct_def,
tokens: [
struct_def(0, 32, [
struct_preamble(0, 17, [
struct_name(5, 10, [
ident(5, 10),
]),
]),
struct_fields(20, 31, [
struct_field(20, 31, [
ident(20, 23),
struct_field_type(24, 30, [
primitive(24, 30, [
string(24, 30)
]),
]),
]),
]),
]),
]
};
parses_to! {
parser: AwsGoEventsParser,
input: r#"type MyFoo struct {
foo string
bar int
}"#,
rule: Rule::struct_def,
tokens: [
struct_def(0, 92, [
struct_preamble(0, 17, [
struct_name(5, 10, [
ident(5, 10),
]),
]),
struct_fields(38, 74, [
struct_field(38, 48, [
ident(38, 41),
struct_field_type(42, 48, [
primitive(42, 48, [
string(42, 48)
]),
]),
]),
struct_field(67, 74, [
ident(67, 70),
struct_field_type(71, 74, [
primitive(71, 74, [
int(71, 74)
]),
]),
]),
]),
]),
]
};
} | rust_cleaned_test_functions.jsonl/8183 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2215
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77113,
288,
15126,
7844,
368,
341,
310,
70835,
2346,
0,
341,
394,
6729,
25,
40083,
10850,
7900,
6570,
345,
394,
1946,
25,
330,
1313,
3017,
40923,
2036,
4687,
756,
394,
5912,
25,
18100,
486,
1235... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_after_rotation() {
// test that two deques hash equal even if elements are laid out differently
let len = 28;
let mut ring: VecDeque<i32> = (0..len as i32).collect();
let orig = ring.clone();
for _ in 0..ring.capacity() {
ring.pop_front();
for elt in &mut ring {
*elt -= 1;
}
ring.push_back(len - 1);
assert_eq!(hash(&orig), hash(&ring));
assert_eq!(orig, ring);
assert_eq!(ring, orig);
}
} | rust_cleaned_test_functions.jsonl/73714 | {
"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,
8950,
19844,
44813,
368,
341,
262,
442,
1273,
429,
1378,
409,
13968,
5175,
6144,
1496,
421,
5424,
525,
17113,
700,
21303,
198,
262,
1077,
2422,
284,
220,
17,
23,
280,
262,
1077,
5206,
10058,
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... | 3 |
#[test]
fn test_skiplist_insert() {
let mut list = SkipList::new();
list.insert(2, 2);
list.insert(3, 3);
list.insert(1, 1);
list.insert(4, 4);
list.insert(5, 5);
list.insert(7, 7);
list.insert(8, 8);
list.insert(6, 6);
assert_eq!(list.size, 8);
} | rust_cleaned_test_functions.jsonl/65967 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 190
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
6642,
39934,
17678,
368,
341,
286,
1077,
5206,
1140,
284,
25784,
852,
486,
931,
543,
286,
1140,
7030,
7,
17,
11,
220,
17,
317,
286,
1140,
7030,
7,
18,
11,
220,
18,
317,
286,
1140,
7030,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_validate_invalid_signature() {
let (config, keypair) = get_test_config();
let vm_validator = TestValidator::new(&config);
let (other_private_key, _) = ::crypto::signing::generate_keypair();
// Submit with an account using an different private/public keypair
let other_keypair = KeyPair::new(other_private_key);
let address = account_config::association_address();
let program = encode_transfer_program(&address, 100);
let signed_txn = transaction_test_helpers::get_test_unchecked_txn(
address,
0,
other_keypair.private_key().clone(),
keypair.public_key(),
Some(program),
);
let ret = vm_validator
.validate_transaction(signed_txn)
.wait()
.unwrap();
assert_eq!(
ret,
Some(VMStatus::Validation(VMValidationStatus::InvalidSignature))
);
} | rust_cleaned_test_functions.jsonl/90958 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 363
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
31433,
39859,
368,
341,
262,
1077,
320,
1676,
11,
1376,
12670,
8,
284,
633,
4452,
5332,
543,
262,
1077,
10995,
64959,
284,
3393,
14256,
486,
931,
2099,
1676,
626,
262,
1077,
320,
1575,
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_elided_lifetimes() {
let ir = ir_from_cc(
r#"#pragma clang lifetime_elision
struct S {
int& f(int& i);
};"#,
)
.unwrap();
let func = retrieve_func(&ir, "f");
let lifetime_params = &func.lifetime_params;
assert_eq!(lifetime_params.iter().map(|p| &p.name).collect_vec(), vec!["a", "b"]);
let a_id = lifetime_params[0].id;
let b_id = lifetime_params[1].id;
assert_eq!(func.return_type.rs_type.lifetime_args, vec![a_id]);
assert_eq!(func.params[0].identifier, ir_id("__this"));
assert_eq!(func.params[0].type_.rs_type.name, Some("&mut".to_string()));
assert_eq!(func.params[0].type_.rs_type.lifetime_args, vec![a_id]);
assert_eq!(func.params[1].identifier, ir_id("i"));
assert_eq!(func.params[1].type_.rs_type.name, Some("&mut".to_string()));
assert_eq!(func.params[1].type_.rs_type.lifetime_args, vec![b_id]);
} | rust_cleaned_test_functions.jsonl/37223 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 431
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21602,
4490,
907,
333,
6889,
368,
341,
262,
1077,
6216,
284,
6216,
5673,
28955,
1006,
286,
435,
55543,
2,
6015,
18260,
19031,
21602,
1816,
198,
286,
2036,
328,
341,
688,
526,
5,
282,
1548,
5,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mq_egress() {
let mut storage = Contract::new_storage();
let code_hash = storage
.upload_code(
ALICE.clone(),
include_bytes!("./fixtures/mqproxy/mqproxy.wasm").to_vec(),
)
.unwrap();
let (contract, effects) = Contract::new_with_selector(
&mut storage,
ALICE.clone(),
code_hash,
hex!("ed4b9d1b"), // init_value
(),
vec![],
vec![],
1,
0,
)
.unwrap();
insta::assert_debug_snapshot!(effects);
let (_, effects): ((), _) = contract
.call_with_selector(
&mut storage,
ALICE.clone(),
hex!("6495da7f"), // push_message
(b"\x42\x42".to_vec(), b"\x24\x24".to_vec()),
false,
1,
0,
)
.unwrap();
insta::assert_debug_snapshot!(effects);
let (_, effects): ((), _) = contract
.call_with_selector(
&mut storage,
ALICE.clone(),
hex!("d09d68e0"), // push_osp_message
(b"\x42\x42".to_vec(), b"\x24\x24".to_vec(), Some([0u8; 32])),
false,
1,
0,
)
.unwrap();
insta::assert_debug_snapshot!(effects);
} | rust_cleaned_test_functions.jsonl/122569 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 727
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
80,
90209,
673,
368,
341,
262,
1077,
5206,
5819,
284,
19185,
486,
931,
23310,
543,
262,
1077,
2038,
8950,
284,
5819,
198,
286,
659,
6120,
4136,
1006,
310,
8753,
5487,
15997,
3148,
310,
2924... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_purge_by_compaction() {
run_persistent_pool_test("test_purge_by_compaction", |mut config, log| {
// set a small purge interval
config.persistent_pool_validated_purge_interval = Height::from(8);
let mut pool = PersistentHeightIndexedPool::new_consensus_pool(config, log);
// insert a few things
let rb_ops = random_beacon_ops();
pool.mutate(rb_ops.clone());
// check if read is ok after insertion
let iter = pool.random_beacon().get_all();
let msgs_from_pool: Vec<RandomBeacon> = iter.collect();
assert_eq!(msgs_from_pool.len(), rb_ops.ops.len());
let min_height = msgs_from_pool.iter().map(|x| x.height()).min().unwrap();
// purge below height 5
let mut purge_ops = PoolSectionOps::new();
purge_ops.purge_below(Height::from(5));
pool.mutate(purge_ops);
let mut iter = pool.random_beacon().get_all();
assert!(iter.all(|x| x.height() >= Height::from(5)));
assert_eq!(
pool.random_beacon().height_range().map(|r| r.min),
Some(Height::from(5))
);
// But real min height is unchanged because compaction didn't happen
assert_eq!(
pool.get_first_height(&RANDOM_BEACON_CF_INFO, SeekPos::Start),
Some(min_height)
);
// trigger compaction by purging again at height 10
let mut purge_ops = PoolSectionOps::new();
purge_ops.purge_below(Height::from(10));
pool.mutate(purge_ops);
assert_eq!(
pool.random_beacon().height_range().map(|r| r.min),
Some(Height::from(10))
);
// min height becomes 10 after compaction
for _ in 0..50 {
std::thread::sleep(std::time::Duration::from_millis(100));
if pool.get_first_height(&RANDOM_BEACON_CF_INFO, SeekPos::Start)
== Some(Height::from(10))
{
return;
}
}
panic!("compaction did not purge")
});
} | rust_cleaned_test_functions.jsonl/24997 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
39823,
3710,
18177,
1311,
368,
341,
286,
1598,
620,
13931,
15709,
4452,
445,
1944,
620,
39823,
3710,
18177,
1311,
497,
760,
6984,
2193,
11,
1487,
91,
341,
310,
442,
738,
264,
2613,
54100,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_accountsdb_cumulative_find_empty() {
let input = CumulativeOffsets {
cumulative_offsets: vec![],
total_count: 0,
};
input.find(0);
} | rust_cleaned_test_functions.jsonl/94724 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55665,
1999,
91328,
22160,
21814,
15124,
368,
341,
286,
1077,
1946,
284,
31578,
22160,
81095,
341,
310,
39844,
56924,
25,
7486,
20703,
1259,
310,
2790,
3180,
25,
220,
15,
345,
286,
2605,
286,
1946... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_update_agent_info() {
init!("true");
let json_string = r#"{"id":"123","value":"value"}"#;
let c_json = CString::new(json_string).unwrap().into_raw();
let cb = return_types_u32::Return_U32::new().unwrap();
let result = vcx_agent_update_info(cb.command_handle, c_json, Some(cb.get_callback()));
cb.receive(Some(Duration::from_secs(10))).unwrap();
} | rust_cleaned_test_functions.jsonl/19370 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 194
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
25730,
3109,
368,
341,
286,
2930,
17223,
1866,
3071,
286,
1077,
2951,
3904,
284,
435,
55543,
4913,
307,
3252,
16,
17,
18,
2198,
957,
3252,
957,
9207,
57676,
280,
286,
1077,
272,
9455,
284,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fix_type() {
assert_eq!(FixType::from('A'), FixType::Invalid);
assert_eq!(FixType::from('0'), FixType::Invalid);
assert_eq!(FixType::from('1'), FixType::Gps);
assert_eq!(FixType::from('2'), FixType::DGps);
assert_eq!(FixType::from('3'), FixType::Pps);
assert_eq!(FixType::from('4'), FixType::Rtk);
assert_eq!(FixType::from('5'), FixType::FloatRtk);
assert_eq!(FixType::from('6'), FixType::Estimated);
assert_eq!(FixType::from('7'), FixType::Manual);
assert_eq!(FixType::from('8'), FixType::Simulation);
} | rust_cleaned_test_functions.jsonl/65848 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 284
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36060,
1819,
368,
341,
286,
2060,
10714,
10297,
25958,
929,
486,
1499,
492,
32,
4567,
19716,
929,
486,
7928,
317,
286,
2060,
10714,
10297,
25958,
929,
486,
1499,
492,
15,
4567,
19716,
929,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invalid_api_key() {
let client = shadertoy::Client::new("incorrect");
let shader = client.get_shader("4d2BDy");
assert!(shader.is_err());
println!("error: {}", shader.err().unwrap());
} | rust_cleaned_test_functions.jsonl/117277 | {
"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,
31433,
11697,
3097,
368,
341,
262,
1077,
2943,
284,
557,
329,
529,
2253,
486,
2959,
486,
931,
445,
61954,
3071,
1066,
262,
1077,
21013,
284,
2943,
670,
35485,
445,
19,
67,
17,
9548,
88,
797,
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 |
#[test]
fn test_fct_with_type_params() {
err(
"fun f() {} fun g() { f::<int>(); }",
pos(1, 22),
Msg::WrongNumberTypeParams(0, 1),
);
err(
"fun f<T>() {} fun g() { f(); }",
pos(1, 25),
Msg::WrongNumberTypeParams(1, 0),
);
ok("fun f<T>() {} fun g() { f::<int>(); }");
ok("fun f<T1, T2>() {} fun g() { f::<int, Str>(); }");
} | rust_cleaned_test_functions.jsonl/106631 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 276
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
302,
6615,
1819,
6745,
368,
341,
286,
1848,
1006,
310,
330,
11894,
282,
368,
4687,
2464,
342,
368,
314,
282,
27638,
396,
48281,
335,
756,
310,
1133,
7,
16,
11,
220,
17,
17,
1326,
310,
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_fifo_compaction_options() {
let path = tempdir_with_prefix("_rust_rocksdb_fifo_compaction_options");
let path_str = path.path().to_str().unwrap();
let mut opts = DBOptions::new();
opts.create_if_missing(true);
let mut cf_opts = ColumnFamilyOptions::new();
let mut fifo_opts = FifoCompactionOptions::new();
fifo_opts.set_allow_compaction(true);
fifo_opts.set_max_table_files_size(100000);
cf_opts.set_fifo_compaction_options(fifo_opts);
DB::open_cf(opts, path_str, vec![("default", cf_opts)]).unwrap();
} | rust_cleaned_test_functions.jsonl/34130 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 240
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56590,
18177,
1311,
8743,
368,
341,
262,
1077,
1815,
284,
2730,
3741,
6615,
13974,
16975,
35788,
26608,
14553,
1999,
56590,
18177,
1311,
8743,
797,
262,
1077,
1815,
2895,
284,
1815,
3875,
1005,
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 |
#[test]
fn test_two_intersections() {
let sphere = Sphere {
center: Point3(0.0, 0.0, 2.0),
radius: 1.0,
};
let ray = Ray::new(Point3::zero(), Vect3(0.0, 0.0, 1.0));
let expected = vec![
Intersection::new(Point3(0.0, 0.0, 1.0), Vect3(0.0, 0.0, -1.0)),
Intersection::new(Point3(0.0, 0.0, 3.0), Vect3(0.0, 0.0, 1.0)),
];
assert_eq!(sphere.intersected_by(&ray, 0.0..f32::INFINITY), expected);
} | rust_cleaned_test_functions.jsonl/102910 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 287
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23241,
15318,
24661,
368,
341,
286,
1077,
25366,
284,
54499,
341,
310,
4126,
25,
5126,
18,
7,
15,
13,
15,
11,
220,
15,
13,
15,
11,
220,
17,
13,
15,
1326,
310,
10578,
25,
220,
16,
13,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_various_types() {
let d1 = Rect::from_points(&[Point::new(0.1, 0.), Point::new(0.25, 0.1)]);
assert!(
Rect::from_center_size(&Point::new(0.3, 0.5), &Point::new(0.2, 0.4)).approx_eq(
&Rect::from_points(&[Point::new(0.2, 0.3), Point::new(0.4, 0.7)])
)
);
assert!(
Rect::from_center_size(&Point::new(1., 0.1), &Point::new(0., 2.)).approx_eq(
&Rect::from_points(&[Point::new(1., -0.9), Point::new(1., 1.1)])
)
);
assert!(d1.approx_eq(&Rect { x: d1.x, y: d1.y }));
assert!(
Rect::from_points(&[Point::new(0.15, 0.3), Point::new(0.35, 0.9)]).approx_eq(
&Rect::from_points(&[Point::new(0.15, 0.9), Point::new(0.35, 0.3)])
)
);
assert!(
Rect::from_points(&[Point::new(0.12, 0.), Point::new(0.83, 0.5)]).approx_eq(
&Rect::from_points(&[Point::new(0.83, 0.), Point::new(0.12, 0.5)])
)
);
} | rust_cleaned_test_functions.jsonl/94054 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 619
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
4612,
1223,
9763,
368,
341,
286,
1077,
294,
16,
284,
11920,
486,
1499,
12928,
2099,
58,
2609,
486,
931,
7,
15,
13,
16,
11,
220,
15,
24389,
5126,
486,
931,
7,
15,
13,
17,
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_echo_packet_not_destined() {
let amount = 1;
let expires_at = SystemTime::now() + Duration::from_secs(30);
let fulfillment = &get_random_fulfillment();
let execution_condition = &get_hash_of(fulfillment);
let destination = Address::from_str("example.recipient").unwrap();
let data = b"ECHOECHOECHOECHO\x00\x11example.initiator";
let node_address = Address::from_str("example.node").unwrap();
let source_address = Address::from_str("example.initiator").unwrap();
// setup service
let handler = incoming_service_fn(|request| {
assert_eq!(request.prepare.amount(), amount);
assert_eq!(request.prepare.expires_at(), expires_at);
assert_eq!(request.prepare.execution_condition(), execution_condition);
assert_eq!(request.prepare.destination(), destination);
assert_eq!(request.prepare.data(), &data[..]);
Ok(FulfillBuilder {
fulfillment: &fulfillment,
data,
}
.build())
});
let mut echo_service = EchoService::new(node_address, handler);
// setup request
let prepare = EchoRequestBuilder {
amount,
expires_at,
execution_condition,
destination: &destination,
source_address: &source_address,
}
.build();
let from = TestAccount(1);
// test
let result = echo_service
.handle_request(IncomingRequest { prepare, from })
.wait();
assert!(result.is_ok());
} | rust_cleaned_test_functions.jsonl/37906 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 753
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68628,
21078,
7913,
25264,
1589,
368,
341,
286,
1077,
3311,
284,
220,
16,
280,
286,
1077,
27902,
3752,
284,
739,
1462,
486,
3328,
368,
488,
21045,
486,
1499,
68718,
7,
18,
15,
317,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_input_controller_axis() {
let e: Event = ControllerAxisArgs::new(0, 1, 0.9).into();
let a: Option<Event> =
ControllerAxisEvent::from_controller_axis_args(ControllerAxisArgs::new(0, 1, 0.9), &e);
let b: Option<Event> = a.clone()
.unwrap()
.controller_axis(|cnt| {
ControllerAxisEvent::from_controller_axis_args(
ControllerAxisArgs::new(cnt.id, cnt.axis, cnt.position),
a.as_ref().unwrap())
})
.unwrap();
assert_eq!(a, b);
} | rust_cleaned_test_functions.jsonl/74924 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 311
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5898,
21600,
23567,
368,
341,
286,
1077,
384,
25,
3665,
284,
9771,
8143,
4117,
486,
931,
7,
15,
11,
220,
16,
11,
220,
15,
13,
24,
568,
18122,
543,
286,
1077,
264,
25,
6959,
51357,
29,
4035,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vcpu_cpuid_restore() {
let (_vm, vcpu, _) = setup_vcpu(0x1000);
let mut state = vcpu.save_state().unwrap();
// Mutate the cpuid.
state.cpuid.as_mut_slice()[0].eax = 0x1234_5678;
assert!(vcpu.restore_state(&state).is_ok());
unsafe { libc::close(vcpu.fd.as_raw_fd()) };
let (_vm, vcpu, _) = setup_vcpu(0x1000);
assert!(vcpu.restore_state(&state).is_ok());
// Validate the mutated cpuid is saved.
assert!(vcpu.save_state().unwrap().cpuid.as_slice()[0].eax == 0x1234_5678);
} | rust_cleaned_test_functions.jsonl/3464 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 290
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
16475,
39811,
2423,
62677,
368,
341,
286,
1077,
5453,
7338,
11,
348,
16475,
11,
27439,
284,
6505,
2273,
16475,
7,
15,
87,
16,
15,
15,
15,
317,
286,
1077,
5206,
1584,
284,
348,
16475,
568... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_int_from_bytes_be() {
use de::parse_int_be;
assert_eq!(parse_int_be::<u32, u8>(&[1, 2, 3, 4], 256), Some(16909060));
assert_eq!(parse_int_be::<u32, u8>(&[1, 3], 32), Some(35));
assert_eq!(parse_int_be::<u32, u8>(&[255, 255, 255, 255], 256), Some(4294967295));
assert_eq!(parse_int_be::<u32, u8>(&[1, 0, 0, 0, 0], 256), None);
} | rust_cleaned_test_functions.jsonl/123243 | {
"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,
21039,
4042,
5673,
12524,
21263,
368,
341,
197,
41819,
409,
486,
6400,
4042,
21263,
401,
197,
6948,
10714,
10297,
6400,
4042,
21263,
27638,
84,
18,
17,
11,
575,
23,
44784,
58,
16,
11,
220,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_to_packets_pinning() {
let recycler = PacketBatchRecycler::default();
for i in 0..2 {
let _first_packets =
PacketBatch::new_with_recycler(recycler.clone(), i + 1, "first one");
}
} | rust_cleaned_test_functions.jsonl/131347 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
63569,
620,
19770,
368,
341,
286,
1077,
1395,
10760,
284,
28889,
21074,
3820,
10760,
486,
2258,
543,
286,
369,
600,
304,
220,
15,
496,
17,
341,
310,
1077,
716,
3896,
63569,
4035,
394,
2888... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_cp_multiple_files() {
let (at, mut ucmd) = at_and_ucmd!();
ucmd.arg(TEST_HELLO_WORLD_SOURCE)
.arg(TEST_HOW_ARE_YOU_SOURCE)
.arg(TEST_COPY_TO_FOLDER)
.succeeds();
assert_eq!(at.read(TEST_COPY_TO_FOLDER_FILE), "Hello, World!\n");
assert_eq!(at.read(TEST_HOW_ARE_YOU_DEST), "How are you?\n");
} | rust_cleaned_test_functions.jsonl/21236 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 194
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39811,
45233,
10931,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
575,
8710,
21186,
50320,
69235,
1593,
38913,
25430,
340,
286,
659,
858,
5032... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_append_u64_nonulls() {
// Make sure the fixed sect stats above can still fit in total headers
assert!(std::mem::size_of::<FixedSectStats>() + BINARYVECT_HEADER_SIZE <= NUM_HEADER_BYTES_TOTAL);
let num_values: usize = 500;
let data: Vec<u64> = (0..num_values as u64).collect();
let mut appender = VectorU64Appender::try_new(1024).unwrap();
{
let reader = appender.reader();
assert_eq!(reader.num_elements(), 0);
assert_eq!(reader.sect_iter().count(), 0);
// Note: due to Rust borrowing rules we can only have reader as long as we are not appending.
}
// Now append the data
data.iter().for_each(|&e| appender.append(e).unwrap());
let reader = appender.reader();
assert_eq!(reader.num_elements(), 256);
assert_eq!(reader.sect_iter().count(), 1);
let finished_vec = appender.finish(num_values).unwrap();
let reader = VectorReader::try_new(&finished_vec[..]).unwrap();
assert_eq!(reader.num_elements(), num_values);
assert_eq!(reader.sect_iter().count(), 2);
assert_eq!(reader.num_null_sections().unwrap(), 0);
let elems: Vec<u64> = reader.iterate().collect();
assert_eq!(elems, data);
} | rust_cleaned_test_functions.jsonl/25236 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 588
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26041,
7300,
21,
19,
21637,
70423,
368,
341,
286,
442,
7405,
2704,
279,
8356,
30137,
10472,
3403,
646,
2058,
4946,
304,
2790,
7102,
198,
286,
2060,
10297,
1834,
486,
10536,
486,
2141,
3575,
27638,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bad_float() {
let yaml = indoc! {"
---
!!float str
"};
let expected = "invalid value: string \"str\", expected a float at line 2 column 9";
test_error::<f64>(yaml, expected);
} | rust_cleaned_test_functions.jsonl/45573 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34199,
17586,
368,
341,
262,
1077,
32246,
284,
1257,
509,
0,
314,
698,
286,
53923,
286,
11015,
3649,
607,
198,
262,
330,
2440,
262,
1077,
3601,
284,
330,
11808,
897,
25,
914,
7245,
495,
16215,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_timeout_expired_remove() {
let repair_type = ShredRepairType::Orphan(9);
let mut outstanding_requests = OutstandingRequests::default();
let nonce = outstanding_requests.add_request(repair_type, timestamp());
let shred = Shred::new_from_data(0, 0, 0, &[], false, false, 0, 0, 0);
let expire_timestamp = outstanding_requests
.requests
.get(&nonce)
.unwrap()
.expire_timestamp;
assert!(outstanding_requests
.register_response(nonce, &shred, expire_timestamp + 1, |_| ())
.is_none());
assert!(outstanding_requests.requests.get(&nonce).is_none());
} | rust_cleaned_test_functions.jsonl/50413 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 322
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20537,
80221,
18193,
368,
341,
286,
1077,
12733,
1819,
284,
1417,
1151,
98386,
929,
486,
2195,
9943,
7,
24,
317,
286,
1077,
5206,
18781,
37216,
284,
75341,
35295,
486,
2258,
543,
286,
1077,
39676,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_list_with_cross_deps_and_namespaces_error() {
init();
let schema_str_1 = r#"{
"name": "A",
"type": "record",
"namespace": "namespace",
"fields": [
{"name": "field_one", "type": "float"}
]
}"#;
let schema_str_2 = r#"{
"name": "B",
"type": "record",
"fields": [
{"name": "field_one", "type": "A"}
]
}"#;
let schema_strs_first = [schema_str_1, schema_str_2];
let schema_strs_second = [schema_str_2, schema_str_1];
let _ = Schema::parse_list(&schema_strs_first).expect_err("Test failed");
let _ = Schema::parse_list(&schema_strs_second).expect_err("Test failed");
} | rust_cleaned_test_functions.jsonl/69029 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 365
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
2019,
6615,
35284,
76489,
8378,
9187,
27338,
4096,
368,
341,
262,
2930,
543,
262,
1077,
10802,
2895,
62,
16,
284,
435,
55543,
515,
286,
330,
606,
788,
330,
32,
756,
286,
330,
1313,
788,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_59() {
assert_eq!(Solution::generate_matrix(1), vec![vec![1]]);
assert_eq!(Solution::generate_matrix(2), vec![vec![1, 2], vec![4, 3]]);
assert_eq!(
Solution::generate_matrix(3),
vec![vec![1, 2, 3], vec![8, 9, 4], vec![7, 6, 5],]
);
} | rust_cleaned_test_functions.jsonl/51392 | {
"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,
62,
20,
24,
368,
341,
286,
2060,
10714,
10297,
36842,
486,
19366,
10193,
7,
16,
701,
7486,
20703,
4083,
20703,
16,
49854,
286,
2060,
10714,
10297,
36842,
486,
19366,
10193,
7,
17,
701,
7486,
207... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_adjust_maximum() {
assert_eq!(100.0, adjust_maximum(0.0, 100.0));
assert_eq!(100.0, adjust_maximum(100.0, 5.0));
assert_eq!(100.0, adjust_maximum(0.0, 100.0));
} | rust_cleaned_test_functions.jsonl/7468 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 111
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44153,
93581,
368,
341,
286,
2060,
10714,
10297,
16,
15,
15,
13,
15,
11,
7500,
93581,
7,
15,
13,
15,
11,
220,
16,
15,
15,
13,
15,
1106,
286,
2060,
10714,
10297,
16,
15,
15,
13,
15,
11,
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_block_store_create_block() {
let block_store = build_empty_tree();
let genesis = block_store.root();
let a1 = block_store.create_block(&genesis, vec![1], 1, 1);
assert_eq!(a1.parent_id(), genesis.id());
assert_eq!(a1.round(), 1);
assert_eq!(a1.height(), 1);
assert_eq!(a1.quorum_cert().certified_block_id(), genesis.id());
let a1_ref = block_on(block_store.execute_and_insert_block(a1)).unwrap();
// certify a1
let vote_msg = VoteMsg::new(
VoteData::new(
a1_ref.id(),
block_store
.get_compute_result(a1_ref.id())
.unwrap()
.executed_state
.state_id,
a1_ref.round(),
a1_ref.quorum_cert().parent_block_id(),
a1_ref.quorum_cert().parent_block_round(),
a1_ref.quorum_cert().grandparent_block_id(),
a1_ref.quorum_cert().grandparent_block_round(),
),
block_store.signer().author(),
placeholder_ledger_info(),
block_store.signer(),
);
block_store.insert_vote_and_qc(vote_msg, 1);
let b1 = block_store.create_block(&a1_ref, vec![2], 2, 2);
assert_eq!(b1.parent_id(), a1_ref.id());
assert_eq!(b1.round(), 2);
assert_eq!(b1.height(), 2);
assert_eq!(b1.quorum_cert().certified_block_id(), a1_ref.id());
} | rust_cleaned_test_functions.jsonl/85834 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 688
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7113,
14809,
8657,
7113,
368,
341,
262,
1077,
2504,
14809,
284,
1936,
15124,
11663,
543,
262,
1077,
59366,
284,
2504,
14809,
12576,
543,
262,
1077,
264,
16,
284,
2504,
14809,
2520,
7113,
2099,
778... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_block_body_after_inserting() {
let builder = SharedBuilder::default();
let (shared, table) = builder.consensus(Consensus::default()).build().unwrap();
let mut chain_service = ChainService::new(shared.clone(), table);
let genesis = shared
.store()
.get_block_header(&shared.store().get_block_hash(0).unwrap())
.unwrap();
let parent = genesis;
let mock_store = MockStore::new(&parent, shared.store());
let mut fork1 = MockChain::new(parent.clone(), shared.consensus());
let mut fork2 = MockChain::new(parent, shared.consensus());
for _ in 0..4 {
fork1.gen_empty_block_with_diff(100u64, &mock_store);
fork2.gen_empty_block_with_diff(90u64, &mock_store);
}
for blk in fork1.blocks() {
chain_service
.process_block(Arc::new(blk.clone()), Switch::DISABLE_ALL)
.unwrap();
let len = shared.snapshot().get_block_body(&blk.hash()).len();
assert_eq!(len, 1, "[fork1] snapshot.get_block_body({})", blk.hash(),);
}
for blk in fork2.blocks() {
chain_service
.process_block(Arc::new(blk.clone()), Switch::DISABLE_ALL)
.unwrap();
let snapshot = shared.snapshot();
assert!(snapshot.get_block_header(&blk.hash()).is_some());
assert!(snapshot.get_block_uncles(&blk.hash()).is_some());
assert!(snapshot.get_block_proposal_txs_ids(&blk.hash()).is_some());
let len = snapshot.get_block_body(&blk.hash()).len();
assert_eq!(len, 1, "[fork2] snapshot.get_block_body({})", blk.hash(),);
}
} | rust_cleaned_test_functions.jsonl/44004 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 704
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
7113,
14114,
19844,
17678,
287,
368,
341,
262,
1077,
7363,
284,
16990,
3297,
486,
2258,
543,
262,
1077,
320,
6100,
11,
1965,
8,
284,
7363,
63201,
13626,
7,
15220,
13626,
486,
2258,
6011,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_address_bson() {
let address = Address::from(bee::Address::Ed25519(bee_test::rand::address::rand_ed25519_address()));
let bson = to_bson(&address).unwrap();
assert_eq!(Bson::from(address), bson);
assert_eq!(address, from_bson::<Address>(bson).unwrap());
let address = Address::from(bee::Address::Alias(bee_test::rand::address::rand_alias_address()));
let bson = to_bson(&address).unwrap();
assert_eq!(Bson::from(address), bson);
assert_eq!(address, from_bson::<Address>(bson).unwrap());
let address = Address::from(bee::Address::Nft(bee_test::rand::address::rand_nft_address()));
let bson = to_bson(&address).unwrap();
assert_eq!(Bson::from(address), bson);
assert_eq!(address, from_bson::<Address>(bson).unwrap());
} | rust_cleaned_test_functions.jsonl/50528 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 361
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6744,
880,
930,
368,
341,
286,
1077,
2621,
284,
9177,
486,
1499,
7,
32031,
486,
4286,
486,
2715,
17,
20,
20,
16,
24,
7,
32031,
4452,
486,
11335,
486,
4995,
486,
11335,
32370,
17,
20,
20,
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_raw_identifiers() {
#[pyclass]
#[pyo3(text_signature = "($self)")]
struct r#MyClass {}
#[pymethods]
impl MyClass {
#[new]
fn new() -> MyClass {
MyClass {}
}
#[pyo3(text_signature = "($self)")]
fn r#method(&self) {}
}
let gil = Python::acquire_gil();
let py = gil.python();
let typeobj = py.get_type::<MyClass>();
py_assert!(py, typeobj, "typeobj.__text_signature__ == '($self)'");
py_assert!(
py,
typeobj,
"typeobj.method.__text_signature__ == '($self)'"
);
} | rust_cleaned_test_functions.jsonl/32990 | {
"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,
16067,
38399,
11836,
368,
341,
262,
11506,
3288,
1040,
921,
262,
11506,
3288,
78,
18,
7235,
39859,
284,
330,
699,
721,
8,
5422,
262,
2036,
435,
2,
5050,
1957,
10086,
262,
11506,
79,
1600,
1068,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_date_from_str() {
// valid cases
let valid = [
"0:0:0",
"0:0:0.0000000",
"0:0:0.0000003",
" 4 : 3 : 2.1 ",
" 09:08:07 ",
" 9:8:07 ",
"23:59:60.373929310237",
];
for &s in &valid {
let d = match s.parse::<NaiveTime>() {
Ok(d) => d,
Err(e) => panic!("parsing `{}` has failed: {}", s, e)
};
let s_ = format!("{:?}", d);
let d_ = match s_.parse::<NaiveTime>() {
Ok(d) => d,
Err(e) => panic!("`{}` is parsed into `{:?}`, but reparsing that has failed: {}",
s, d, e)
};
assert!(d == d_, "`{}` is parsed into `{:?}`, but reparsed result \
`{:?}` does not match", s, d, d_);
}
// some invalid cases
assert!("".parse::<NaiveTime>().is_err());
assert!("x".parse::<NaiveTime>().is_err());
assert!("15".parse::<NaiveTime>().is_err());
assert!("15:8".parse::<NaiveTime>().is_err());
assert!("15:8:x".parse::<NaiveTime>().is_err());
assert!("15:8:9x".parse::<NaiveTime>().is_err());
assert!("23:59:61".parse::<NaiveTime>().is_err());
assert!("12:34:56.x".parse::<NaiveTime>().is_err());
assert!("12:34:56. 0".parse::<NaiveTime>().is_err());
} | rust_cleaned_test_functions.jsonl/32335 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 879
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4164,
5673,
2895,
368,
341,
286,
442,
2697,
5048,
198,
286,
1077,
2697,
284,
2278,
310,
330,
15,
25,
15,
25,
15,
756,
310,
330,
15,
25,
15,
25,
15,
13,
15,
15,
15,
15,
15,
15,
15,
756,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_check_proc_mount() {
let mount = oci::Mount {
destination: "/proc".to_string(),
r#type: "bind".to_string(),
source: "/test".to_string(),
options: vec!["shared".to_string()],
};
assert!(check_proc_mount(&mount).is_err());
let mount = oci::Mount {
destination: "/proc/cpuinfo".to_string(),
r#type: "bind".to_string(),
source: "/test".to_string(),
options: vec!["shared".to_string()],
};
assert!(check_proc_mount(&mount).is_ok());
let mount = oci::Mount {
destination: "/proc/test".to_string(),
r#type: "bind".to_string(),
source: "/test".to_string(),
options: vec!["shared".to_string()],
};
assert!(check_proc_mount(&mount).is_err());
} | rust_cleaned_test_functions.jsonl/42582 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 442
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
24436,
57593,
368,
341,
286,
1077,
6470,
284,
93975,
486,
16284,
341,
310,
9106,
25,
3521,
15782,
3263,
983,
3904,
3148,
310,
435,
2,
1313,
25,
330,
7666,
3263,
983,
3904,
3148,
310,
2530,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_job_finished() {
fn fn_ok(_: String, _: Vec<String>) -> Result<String, Box<Error>> {
sleep(Duration::from_millis(1000));
Ok("ok".to_string())
}
let queue = Queue::new("redis://localhost/", "test-finished");
queue.drop().unwrap();
let uuid = queue.enqueue(vec![], 10).unwrap();
queue.work(fn_ok,
Some(1),
Some(5),
Some(1),
Some(5),
Some(false),
Some(false))
.unwrap();
let status = queue.status(&uuid).unwrap();
assert!(status == Status::FINISHED);
} | rust_cleaned_test_functions.jsonl/124822 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 309
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20298,
56423,
368,
341,
262,
5168,
5168,
19817,
73834,
923,
11,
58536,
11312,
3464,
9231,
1464,
5714,
3464,
11,
8261,
27,
1454,
2452,
341,
286,
6084,
64114,
486,
1499,
717,
56212,
7,
16,
15,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iter_all() {
let mut world = World::default();
world.insert(ImplementorA(3));
world.insert(ImplementorB(1));
let mut table = MetaTable::<dyn Object>::new();
table.register(&ImplementorA(125));
table.register(&ImplementorB(111_111));
{
let mut iter = table.iter(&world);
assert_eq!(iter.next().unwrap().method1(), 3);
assert_eq!(iter.next().unwrap().method1(), 1);
}
{
let mut iter_mut = table.iter_mut(&world);
let obj = iter_mut.next().unwrap();
obj.method2(3);
assert_eq!(obj.method1(), 6);
let obj = iter_mut.next().unwrap();
obj.method2(4);
assert_eq!(obj.method1(), 4);
}
} | rust_cleaned_test_functions.jsonl/1290 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 417
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
5705,
368,
341,
286,
1077,
5206,
1879,
284,
4337,
486,
2258,
543,
286,
1879,
7030,
7,
62980,
269,
32,
7,
18,
1106,
286,
1879,
7030,
7,
62980,
269,
33,
7,
16,
3237,
286,
1077,
5206,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stxb() {
test_interpreter_and_jit_asm!(
"
mov32 r2, 0x11
stxb [r1+2], r2
ldxb r0, [r1+2]
exit",
[
0xaa, 0xbb, 0xff, 0xcc, 0xdd,
],
(),
{ |_vm, res: Result| { res.unwrap() == 0x11 } },
4
);
} | rust_cleaned_test_functions.jsonl/58997 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 212
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
7929,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
6228,
286,
1974,
18,
17,
435,
17,
11,
220,
15,
87,
16,
16,
198,
286,
357,
7929,
508,
81,
16,
10,
17,
1125,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_project_find_dir_ancestor() {
let base_dir = fixture_path(&["basic", "subdir"]);
let project_dir = Project::find_dir(&base_dir).expect("Failed to find project directory");
assert_eq!(project_dir, fixture_path(&["basic"]));
} | rust_cleaned_test_functions.jsonl/104570 | {
"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,
16352,
21814,
4334,
62,
66878,
368,
341,
286,
1077,
2331,
4334,
284,
12507,
2638,
2099,
1183,
22342,
497,
330,
1966,
3741,
15049,
286,
1077,
2390,
4334,
284,
5787,
486,
3903,
4334,
2099,
3152,
433... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_seed_at_offset() {
let seed = 0x973bb011937bc1a8;
assert_eq!(Rng::get_seed_at_offset(seed, 0), seed);
assert_eq!(
Rng::get_seed_at_offset(seed, 1),
(w(seed) + w(MAGIC_SEED)).0
);
assert_eq!(
Rng::get_seed_at_offset(seed, 10_000_000),
0x9a1b9a62448a4128
);
} | rust_cleaned_test_functions.jsonl/92312 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 237
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
33809,
3752,
6917,
368,
341,
286,
1077,
10320,
284,
220,
15,
87,
24,
22,
18,
6066,
15,
16,
16,
24,
18,
22,
8904,
16,
64,
23,
280,
286,
2060,
10714,
10297,
49,
968,
486,
455,
33809,
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_dec() {
use crate::impls::RijndaelCbc;
use crate::paddings::ZeroPadding;
let key = "osu!-scoreburgr---------20210520".as_bytes().into();
let iv = vec![
240, 124, 26, 154, 27, 186, 98, 170, 95, 190, 213, 103, 13, 128, 39, 59, 217, 84, 68, 144,
173, 93, 117, 132, 33, 213, 96, 154, 228, 231, 197, 162,
];
let cipher = vec![
185, 209, 243, 33, 128, 187, 132, 199, 140, 189, 1, 129, 139, 66, 200, 37, 126, 34, 238,
100, 93, 124, 192, 252, 31, 121, 2, 130, 138, 123, 69, 66, 122, 208, 169, 15, 120, 22, 148,
19, 87, 203, 229, 139, 179, 89, 138, 56, 160, 239, 238, 254, 34, 119, 136, 225, 209, 226,
69, 117, 97, 49, 225, 198, 91, 192, 196, 12, 32, 235, 103, 141, 142, 168, 29, 102, 252, 65,
191, 137, 136, 170, 72, 165, 127, 49, 83, 201, 115, 26, 79, 200, 119, 28, 238, 34, 76, 25,
185, 164, 182, 254, 66, 148, 18, 36, 27, 36, 59, 165, 220, 95, 164, 115, 128, 12, 5, 161,
18, 236, 221, 167, 247, 104, 25, 29, 146, 225, 104, 140, 249, 175, 131, 158, 93, 143, 106,
146, 114, 220, 128, 33, 114, 191, 232, 103, 94, 169, 90, 105, 8, 85, 33, 140, 198, 71, 40,
65, 215, 29,
];
let r = RijndaelCbc::<ZeroPadding>::new(key, 32).unwrap();
let result = r.decrypt(iv, cipher);
assert_eq!(
result,
Ok(vec![
99, 53, 49, 97, 101, 101, 53, 54, 98, 98, 53, 49, 57, 53, 50, 52, 52, 50, 53, 50, 100,
49, 57, 48, 98, 97, 97, 53, 52, 98, 52, 57, 58, 80, 117, 114, 101, 80, 101, 97, 99,
101, 32, 58, 56, 49, 53, 55, 55, 50, 54, 50, 53, 97, 100, 97, 100, 54, 51, 57, 55, 51,
53, 97, 48, 52, 52, 101, 56, 97, 98, 97, 57, 51, 54, 48, 58, 52, 52, 58, 49, 56, 58,
54, 58, 52, 58, 54, 58, 50, 48, 58, 51, 56, 54, 52, 53, 58, 50, 54, 58, 70, 97, 108,
115, 101, 58, 70, 58, 54, 52, 58, 70, 97, 108, 115, 101, 58, 48, 58, 50, 49, 48, 54,
49, 53, 48, 54, 52, 52, 51, 49, 58, 50, 48, 50, 49, 48, 53, 50, 48, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19
])
)
} | rust_cleaned_test_functions.jsonl/82901 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1085
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13783,
368,
341,
262,
990,
17717,
486,
6383,
82,
486,
49,
3172,
303,
5891,
34,
8904,
280,
262,
990,
17717,
486,
79,
718,
819,
486,
17999,
21616,
401,
262,
1077,
1376,
284,
330,
436,
84,
0,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_round_int_str() {
let cases = vec![
("123", '1', "123"),
("123", '4', "123"),
("123", '5', "124"),
("123", '6', "124"),
("999", '6', "1000"),
("998", '6', "999"),
("989", '6', "990"),
("989898979", '6', "989898980"),
("989898999", '6', "989899000"),
("+989898999", '6', "+989899000"),
("-989898999", '6', "-989899000"),
];
for (s, n, expect) in cases {
let got = round_int_str(n, s);
assert_eq!(
got, expect,
"round int str: {}, {}, expect: {}, got: {}",
s, n, expect, got
)
}
} | rust_cleaned_test_functions.jsonl/48545 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 465
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29896,
4042,
2895,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
3489,
16,
17,
18,
497,
364,
16,
516,
330,
16,
17,
18,
4461,
310,
3489,
16,
17,
18,
497,
364,
19,
516,
330,
16,
17,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_pick_author() {
let rights = vec![("0", 1), ("1", 2), ("2", 5)];
let config = EpochConfiguration::new(rights);
let mut hits = HashMap::new();
for seed in 20..(20 + config.total_votes) {
let author = config.pick_author(seed as u64);
*hits.entry(author).or_insert(0) += 1;
}
let mut results = hits.iter().map(|x| *x.1).collect::<Vec<_>>();
results.sort_unstable();
assert_eq!(vec![1, 2, 5], results);
} | rust_cleaned_test_functions.jsonl/115167 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58168,
22938,
368,
341,
262,
1077,
3188,
284,
7486,
20703,
445,
15,
497,
220,
16,
701,
3489,
16,
497,
220,
17,
701,
3489,
17,
497,
220,
20,
12587,
262,
1077,
2193,
284,
87379,
7688,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_tokenize_message_type() {
let schema = "
message schema {
required int32 a;
optional binary c (UTF8);
required group d {
required int32 a;
optional binary c (UTF8);
}
required group e (LIST) {
repeated group list {
required int32 element;
}
}
}
";
let iter = Tokenizer::from_str(schema);
let mut res = Vec::new();
for token in iter {
res.push(token);
}
assert_eq!(
res,
vec![
"message", "schema", "{", "required", "int32", "a", ";", "optional", "binary", "c",
"(", "UTF8", ")", ";", "required", "group", "d", "{", "required", "int32", "a",
";", "optional", "binary", "c", "(", "UTF8", ")", ";", "}", "required", "group",
"e", "(", "LIST", ")", "{", "repeated", "group", "list", "{", "required", "int32",
"element", ";", "}", "}", "}"
]
);
} | rust_cleaned_test_functions.jsonl/37567 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 543
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
86508,
6462,
1819,
368,
341,
286,
1077,
10802,
284,
6228,
262,
1943,
10802,
341,
414,
2567,
526,
18,
17,
264,
280,
414,
10101,
7868,
272,
320,
8561,
23,
317,
414,
2567,
1874,
294,
341,
286,
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... | 2 |
#[test]
fn test_is_valid_move() {
let mut game = Game::new(n!("player1").into(), n!("player2").into());
assert_eq!(game.is_valid_move(0, 0), true);
assert_eq!(game.is_valid_move(1, 1), true);
assert_eq!(game.is_valid_move(2, 2), true);
assert_eq!(game.is_valid_move(3, 3), false);
game.make_move(0, 0);
assert_eq!(game.is_valid_move(0, 0), false);
} | rust_cleaned_test_functions.jsonl/43530 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 211
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
8337,
17134,
368,
341,
286,
1077,
5206,
1809,
284,
4050,
486,
931,
1445,
17223,
3434,
16,
1827,
18122,
1507,
308,
17223,
3434,
17,
1827,
18122,
1423,
286,
2060,
10714,
10297,
5804,
2079,
833... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iterator_flat_map() {
let xs = [0, 3, 6];
let ys = [0, 1, 2, 3, 4, 5, 6, 7, 8];
let it = xs.iter().flat_map(|&x| count(x, 1).take(3));
let mut i = 0;
for x in it {
assert_eq!(x, ys[i]);
i += 1;
}
assert_eq!(i, ys.len());
} | rust_cleaned_test_functions.jsonl/61230 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13491,
49556,
5376,
368,
341,
262,
1077,
11943,
284,
508,
15,
11,
220,
18,
11,
220,
21,
935,
262,
1077,
31810,
284,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_max_buffer() {
let batch_msg = Track {
user: User::UserId {
user_id: String::from_utf8(vec![b'a'; 1024 * 30]).unwrap(),
},
..Default::default()
};
let mut batcher = Batcher::new(None);
batcher.without_auto_timestamp();
let mut result = Ok(None);
for _i in 0..20 {
result = batcher.push(batch_msg.clone());
dbg!(&result);
if result.is_ok() && result.as_ref().ok().unwrap().is_some() {
break;
}
}
let msg = result.ok().unwrap();
assert_eq!(BatchMessage::from(batch_msg), msg.unwrap());
} | rust_cleaned_test_functions.jsonl/35281 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 373
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6345,
7776,
368,
341,
286,
1077,
7162,
6483,
284,
19785,
341,
310,
1196,
25,
2657,
486,
13504,
341,
394,
1196,
842,
25,
923,
486,
1499,
39453,
23,
25592,
20703,
65,
25184,
6967,
220,
16,
15,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_sub() {
for elm in SUM_TRIPLES.iter() {
let (a_vec, b_vec, c_vec) = *elm;
let a = BigInt::from_slice(Plus, a_vec);
let b = BigInt::from_slice(Plus, b_vec);
let c = BigInt::from_slice(Plus, c_vec);
let (na, nb, nc) = (-&a, -&b, -&c);
assert_op!(c - a == b);
assert_op!(c - b == a);
assert_op!(nb - a == nc);
assert_op!(na - b == nc);
assert_op!(b - na == c);
assert_op!(a - nb == c);
assert_op!(nc - na == nb);
assert_op!(a - a == Zero::zero());
}
} | rust_cleaned_test_functions.jsonl/90167 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 392
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5228,
368,
341,
286,
369,
42205,
304,
30735,
6410,
3298,
14017,
19471,
368,
341,
310,
1077,
320,
64,
13251,
11,
293,
13251,
11,
272,
13251,
8,
284,
353,
23162,
280,
310,
1077,
264,
284,
62608,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_transactional_single_window() -> Result<()> {
let mut op = select_stmt_from_query(
r#"
define tumbling window w2
with
size = 2
end;
select aggr::stats::count() from in[w2] into out;
"#,
)?;
let mut state = Value::null();
let event1 = test_event_tx(0, false, 0);
let id1 = event1.id.clone();
let res = op.on_event(0, "in", &mut state, event1)?;
assert!(res.events.is_empty());
let event2 = test_event_tx(1, true, 0);
let id2 = event2.id.clone();
let mut res = op.on_event(0, "in", &mut state, event2)?;
assert_eq!(1, res.events.len());
let (_, event) = res.events.pop().unwrap();
assert_eq!(true, event.transactional);
assert_eq!(true, event.id.is_tracking(&id1));
assert_eq!(true, event.id.is_tracking(&id2));
let event3 = test_event_tx(2, false, 0);
let id3 = event3.id.clone();
let res = op.on_event(0, "in", &mut state, event3)?;
assert!(res.events.is_empty());
let event4 = test_event_tx(3, false, 0);
let id4 = event4.id.clone();
let mut res = op.on_event(0, "in", &mut state, event4)?;
assert_eq!(1, res.events.len());
let (_, event) = res.events.pop().unwrap();
assert_eq!(false, event.transactional);
assert_eq!(true, event.id.is_tracking(&id3));
assert_eq!(true, event.id.is_tracking(&id4));
Ok(())
} | rust_cleaned_test_functions.jsonl/81925 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 774
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28884,
278,
19487,
12571,
368,
1464,
5714,
71698,
341,
286,
1077,
5206,
1179,
284,
3293,
21824,
5673,
5738,
1006,
310,
435,
2,
698,
310,
6979,
15394,
9695,
3241,
289,
17,
198,
310,
448,
198,
106... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_returns_err_when_invalid_line() {
let tp = TokenParser::new("1 2 3");
assert!(tp.token::<u8>(1, 1).is_err());
} | rust_cleaned_test_functions.jsonl/96294 | {
"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,
58900,
9266,
47636,
31433,
6528,
368,
341,
286,
1077,
18101,
284,
9660,
6570,
486,
931,
445,
16,
220,
17,
220,
18,
3071,
286,
2060,
10297,
790,
14416,
27638,
84,
23,
2235,
16,
11,
220,
16,
568... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_merge_unreal_logs() {
let logs = br##"Log file open, 10/29/18 17:56:37
[2018.10.29-16.56.38:332][ 0]LogGameplayTags: Display: UGameplayTagsManager::DoneAddingNativeTags. DelegateIsBound: 0
[2018.10.29-16.56.39:332][ 0]LogStats: UGameplayTagsManager::ConstructGameplayTagTree: ImportINI prefixes - 0.000 s
[2018.10.29-16.56.40:332][ 0]LogStats: UGameplayTagsManager::ConstructGameplayTagTree: Construct from data asset - 0.000 s
[2018.10.29-16.56.41:332][ 0]LogStats: UGameplayTagsManager::ConstructGameplayTagTree: ImportINI - 0.000 s"##;
let mut event = Event::default();
merge_unreal_logs(&mut event, logs).ok();
let breadcrumbs = event.breadcrumbs.value().unwrap().values.value().unwrap();
assert_eq!(breadcrumbs.len(), 4);
let first_message = breadcrumbs[0].value().unwrap();
let timestamp_str = format!("{}", first_message.timestamp.value().unwrap());
assert_eq!(timestamp_str, "2018-10-29 16:56:38 UTC");
let category = first_message.category.value().unwrap().as_str();
assert_eq!(category, "LogGameplayTags");
let message = first_message.message.value().unwrap().as_str();
assert_eq!(
message,
"Display: UGameplayTagsManager::DoneAddingNativeTags. DelegateIsBound: 0"
);
} | rust_cleaned_test_functions.jsonl/107425 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 544
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20888,
4907,
7951,
42899,
368,
341,
286,
1077,
18422,
284,
1411,
565,
1,
2201,
1034,
1787,
11,
220,
16,
15,
14,
17,
24,
14,
16,
23,
220,
16,
22,
25,
20,
21,
25,
18,
22,
198,
58,
17,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_validate_transaction() {
let (config, keypair) = get_test_config();
let vm_validator = TestValidator::new(&config);
let address = account_config::association_address();
let program = encode_transfer_program(&address, 100);
let signed_txn = transaction_test_helpers::get_test_signed_txn(
address,
0,
keypair.private_key().clone(),
keypair.public_key(),
Some(program),
);
let ret = vm_validator
.validate_transaction(SignedTransaction::from_proto(signed_txn).unwrap())
.wait()
.unwrap();
assert_eq!(ret, None);
} | rust_cleaned_test_functions.jsonl/90957 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 266
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
28884,
368,
341,
262,
1077,
320,
1676,
11,
1376,
12670,
8,
284,
633,
4452,
5332,
543,
262,
1077,
10995,
64959,
284,
3393,
14256,
486,
931,
2099,
1676,
626,
262,
1077,
2621,
284,
2692,
533... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extract_query_params() {
let url = url::Url::parse("http://is24.de/test?a=a&b=c").unwrap();
let query_params = extract_query_params(&url);
assert_eq!(vec![("a".to_string(), "a".to_string()), ("b".to_string(), "c".to_string())],
query_params)
} | rust_cleaned_test_functions.jsonl/114226 | {
"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,
39123,
5738,
6745,
368,
341,
220,
1077,
2515,
284,
2515,
486,
2864,
486,
6400,
445,
1254,
1110,
285,
17,
19,
2285,
12697,
98461,
24239,
5,
65,
19535,
1827,
15454,
543,
220,
1077,
3239,
6745,
284... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_node_name() {
assert_eq!(div().node_name(), "DIV");
assert_eq!(text("x").node_name(), "#text");
assert_eq!(document_fragment().node_name(), "#document-fragment");
assert_eq!(doc_type().node_name(), "svg:svg");
assert_eq!(processing_instruction("foo", "bar").node_name(), "foo");
} | rust_cleaned_test_functions.jsonl/33759 | {
"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,
5084,
1269,
368,
341,
286,
2060,
10714,
10297,
611,
1005,
3509,
1269,
1507,
330,
38827,
797,
286,
2060,
10714,
10297,
1318,
445,
87,
1827,
3509,
1269,
1507,
5869,
1318,
797,
286,
2060,
10714,
1029... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unsecure_inverses_secure() {
let array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32];
let expected = array.clone();
let actual = CompositeKey::unsecure(&CompositeKey::secure(array));
assert_eq!(actual, expected);
} | rust_cleaned_test_functions.jsonl/23604 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 184
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
25132,
1243,
3004,
288,
73088,
368,
341,
286,
1077,
1334,
284,
508,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,
11,
220,
22,
11,
220,
23,
11,
220,
24,
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_cofactor() {
let mut rng = XorShiftRng::from_seed([
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06,
0xbc, 0xe5,
]);
let a = G2::random(&mut rng);
assert!(bool::from(a.is_torsion_free()));
let mut a = <G2 as group::Group>::random(&mut rng);
assert!(!bool::from(a.is_torsion_free()));
a = a.clear_cofactor();
assert!(bool::from(a.is_torsion_free()));
} | rust_cleaned_test_functions.jsonl/42355 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 290
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
1055,
5621,
368,
341,
286,
1077,
5206,
28422,
284,
1599,
269,
24841,
49,
968,
486,
1499,
33809,
8956,
310,
220,
15,
87,
20,
24,
11,
220,
15,
87,
21,
17,
11,
220,
15,
42459,
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... | 1 |
#[test]
fn test_escaped() {
use escaped as e;
assert_eq!(e(""), "");
assert_eq!(e("a"), "a");
assert_eq!(e("\n"), "\\n");
assert_eq!(e("\t"), "\\t");
assert_eq!(e("\r"), "\\r");
assert_eq!(e("'"), "'");
assert_eq!(e("\""), "\\\"");
assert_eq!(e("\\"), "\\\\");
assert_eq!(e(String::from_utf8(vec![127]).unwrap().as_str()), "\\127");
assert_eq!(e(String::from_utf8(vec![8]).unwrap().as_str()), "\\b");
assert_eq!(
e(unsafe { String::from_utf8_unchecked(vec![255]) }.as_str()),
"\\255"
);
} | rust_cleaned_test_functions.jsonl/118683 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 355
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
65826,
368,
341,
286,
990,
27783,
438,
384,
280,
286,
2060,
10714,
10297,
68,
86076,
14498,
286,
2060,
10714,
10297,
68,
445,
64,
3975,
330,
64,
797,
286,
2060,
10714,
10297,
68,
4921,
77,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_step_ratio() {
let transform_rk = arr2(
&[[0., 0., 1., -2.],
[0., 1., 0., 2.],
[-1., 0., 0., 7.],
[0., 0., 0., 1.]]
);
let key_depth = 2.0;
let x_key = arr1(&[2.0, 2.0]);
let ref_depth = 3.0;
approx::assert_abs_diff_eq!(
step_ratio(&transform_rk, &x_key, key_depth.inv()).unwrap(),
(1. / key_depth) / (1. / ref_depth),
epsilon = 1e-10
);
let key_depth = 4.0;
let x_key = arr1(&[2.0, 2.0]);
assert_eq!(
step_ratio(&transform_rk, &x_key, key_depth.inv()).unwrap_err(),
Flag::NegativeRefDepth
);
} | rust_cleaned_test_functions.jsonl/73551 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 459
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11946,
19917,
368,
341,
286,
1077,
5165,
1710,
74,
284,
2890,
17,
1006,
310,
609,
15505,
15,
2572,
220,
15,
2572,
220,
16,
2572,
481,
17,
13,
1259,
1060,
508,
15,
2572,
220,
16,
2572,
220,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_buffered_reader_seek() {
let inner: &[u8] = &[5, 6, 7, 0, 1, 2, 3, 4];
let mut reader = BufReader::with_capacity(2, io::Cursor::new(inner));
assert_eq!(reader.seek(SeekFrom::Start(3)).ok(), Some(3));
assert_eq!(reader.fill_buf().ok(), Some(&[0, 1][..]));
assert_eq!(reader.seek(SeekFrom::Current(0)).ok(), Some(3));
assert_eq!(reader.fill_buf().ok(), Some(&[0, 1][..]));
assert_eq!(reader.seek(SeekFrom::Current(1)).ok(), Some(4));
assert_eq!(reader.fill_buf().ok(), Some(&[1, 2][..]));
reader.consume(1);
assert_eq!(reader.seek(SeekFrom::Current(-2)).ok(), Some(3));
} | rust_cleaned_test_functions.jsonl/12404 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 325
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7776,
291,
22306,
74473,
368,
341,
286,
1077,
9179,
25,
44590,
84,
23,
60,
284,
44590,
20,
11,
220,
21,
11,
220,
22,
11,
220,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
935,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_straight_flush_beats_four_of_a_kind() {
test(
&vec!["4S 5H 5S 5D 5C", "7S 8S 9S 6S 10S"],
&vec!["7S 8S 9S 6S 10S"],
)
} | rust_cleaned_test_functions.jsonl/121284 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2895,
7386,
39213,
21263,
1862,
56142,
3575,
4306,
33162,
368,
341,
262,
1273,
1006,
286,
609,
4083,
0,
1183,
19,
50,
220,
20,
39,
220,
20,
50,
220,
20,
35,
220,
20,
34,
497,
330,
22,
50,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_numbers() {
let mut decoder = Decoder::new(from_str("3").unwrap());
let v: f64 = Decodable::decode(&mut decoder).unwrap();
assert_eq!(v, 3.0);
let mut decoder = Decoder::new(from_str("3.1").unwrap());
let v: f64 = Decodable::decode(&mut decoder).unwrap();
assert_eq!(v, 3.1);
let mut decoder = Decoder::new(from_str("-1.2").unwrap());
let v: f64 = Decodable::decode(&mut decoder).unwrap();
assert_eq!(v, -1.2);
let mut decoder = Decoder::new(from_str("0.4").unwrap());
let v: f64 = Decodable::decode(&mut decoder).unwrap();
assert_eq!(v, 0.4);
let mut decoder = Decoder::new(from_str("0.4e5").unwrap());
let v: f64 = Decodable::decode(&mut decoder).unwrap();
assert_eq!(v, 0.4e5);
let mut decoder = Decoder::new(from_str("0.4e15").unwrap());
let v: f64 = Decodable::decode(&mut decoder).unwrap();
assert_eq!(v, 0.4e15);
let mut decoder = Decoder::new(from_str("0.4e-01").unwrap());
let v: f64 = Decodable::decode(&mut decoder).unwrap();
assert_eq!(v, 0.4e-01);
} | rust_cleaned_test_functions.jsonl/111029 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 565
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
32964,
368,
341,
286,
1077,
5206,
24551,
284,
50472,
486,
931,
17016,
2895,
445,
18,
1827,
15454,
1423,
286,
1077,
348,
25,
282,
21,
19,
284,
3714,
69129,
486,
18196,
2099,
6984,
24551,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iter() {
let mut grid = Grid::new(Line(5), Column(5), 0, 0);
for i in 0..5 {
for j in 0..5 {
grid[Line(i)][Column(j)] = i * 5 + j;
}
}
let mut iter = grid.iter_from(Point { line: 4, col: Column(0) });
assert_eq!(None, iter.prev());
assert_eq!(Some(&1), iter.next());
assert_eq!(Column(1), iter.point().col);
assert_eq!(4, iter.point().line);
assert_eq!(Some(&2), iter.next());
assert_eq!(Some(&3), iter.next());
assert_eq!(Some(&4), iter.next());
// test linewrapping
assert_eq!(Some(&5), iter.next());
assert_eq!(Column(0), iter.point().col);
assert_eq!(3, iter.point().line);
assert_eq!(Some(&4), iter.prev());
assert_eq!(Column(4), iter.point().col);
assert_eq!(4, iter.point().line);
assert_eq!(&4, iter.cell());
// test that iter ends at end of grid
let mut final_iter = grid.iter_from(Point { line: 0, col: Column(4) });
assert_eq!(None, final_iter.next());
assert_eq!(Some(&23), final_iter.prev());
} | rust_cleaned_test_functions.jsonl/43119 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 473
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
368,
341,
262,
1077,
5206,
5827,
284,
10587,
486,
931,
84462,
7,
20,
701,
9332,
7,
20,
701,
220,
15,
11,
220,
15,
317,
262,
369,
600,
304,
220,
15,
496,
20,
341,
286,
369,
502,
304,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_get_rev_reg_def_json() {
init!("ledger");
let attrs = r#"["address1","address2","city","state","zip"]"#;
let (_, _, _, _, _, rev_reg_id) =
::utils::libindy::anoncreds::tests::create_and_store_credential_def(attrs, true);
let rev_reg_id = rev_reg_id.unwrap();
let (id, json) = get_rev_reg_def_json(&rev_reg_id).unwrap();
assert_eq!(id, rev_reg_id);
} | rust_cleaned_test_functions.jsonl/76656 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 223
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
38082,
4920,
7844,
9455,
368,
341,
286,
2930,
17223,
50704,
797,
286,
1077,
16204,
284,
435,
55543,
1183,
4995,
16,
2198,
4995,
17,
2198,
8926,
2198,
2454,
2198,
9964,
1341,
57676,
280,
286,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vector_close_to_zero() {
let threshold = 3_f64 * f64::EPSILON;
let vector = Vector3::new(f64::EPSILON, 0.0, 0.0);
let expected = None;
let result = Unit::try_from_value(vector, threshold);
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/21686 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12247,
12704,
2346,
19359,
368,
341,
262,
1077,
12171,
284,
220,
18,
761,
21,
19,
353,
282,
21,
19,
486,
45177,
55016,
280,
262,
1077,
4621,
284,
4196,
18,
486,
931,
955,
21,
19,
486,
45177,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_panic_if_environment_undefined() {
let result = catch_unwind(|| {
get_mandatory_env_string("NON_EXISTENCE_ENV_VAR");
});
assert!(result.is_err());
} | rust_cleaned_test_functions.jsonl/49949 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
31270,
11119,
51774,
62,
9614,
368,
341,
286,
1077,
1102,
284,
2287,
4907,
19154,
79453,
341,
310,
633,
717,
62088,
15879,
3904,
445,
29563,
49049,
10150,
22027,
25750,
797,
286,
1625,
286,
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
] | 2 |
#[test]
fn test_log_exec_multiple() {
let l = Log::<Operation>::default();
let o = [Operation::Read, Operation::Write(119)];
let mut s = 0;
let mut f = |op: Operation, _i: usize| match op {
Operation::Read => s += 121,
Operation::Write(v) => s += v,
Operation::Invalid => assert!(false),
};
l.append(&o, 1, |_o: Operation, _i: usize| {});
l.exec(1, &mut f);
assert_eq!(s, 240);
assert_eq!(
l.tail.load(Ordering::Relaxed),
l.ctail.load(Ordering::Relaxed)
);
assert_eq!(
l.tail.load(Ordering::Relaxed),
l.ltails[0].load(Ordering::Relaxed)
);
} | rust_cleaned_test_functions.jsonl/101057 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 394
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5224,
18430,
45233,
368,
341,
286,
1077,
326,
284,
2835,
27638,
8432,
6831,
2258,
543,
286,
1077,
297,
284,
508,
8432,
486,
4418,
11,
16730,
486,
7985,
7,
16,
16,
24,
12587,
286,
1077,
5206,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_memory() {
let region_size = 0x400;
let regions = vec![
(GuestAddress(0x0), region_size),
(GuestAddress(0x1000), region_size),
];
let mut iterated_regions = Vec::new();
let gm = Arc::new(GuestMemoryMmap::from_ranges(®ions).unwrap());
let mem = gm.memory();
let res: guest_memory::Result<()> = mem.with_regions(|_, region| {
assert_eq!(region.len(), region_size as GuestUsize);
Ok(())
});
assert!(res.is_ok());
let res: guest_memory::Result<()> = mem.with_regions_mut(|_, region| {
iterated_regions.push((region.start_addr(), region.len() as usize));
Ok(())
});
assert!(res.is_ok());
assert_eq!(regions, iterated_regions);
assert!(regions
.iter()
.map(|x| (x.0, x.1))
.eq(iterated_regions.iter().map(|x| *x)));
assert_eq!(gm.clone().regions[0].guest_base, regions[0].0);
assert_eq!(gm.clone().regions[1].guest_base, regions[1].0);
} | rust_cleaned_test_functions.jsonl/125221 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 566
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19195,
368,
341,
286,
1077,
5537,
2368,
284,
220,
15,
87,
19,
15,
15,
280,
286,
1077,
13604,
284,
7486,
90515,
310,
320,
37804,
4286,
7,
15,
87,
15,
701,
5537,
2368,
1326,
310,
320,
37804,
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_custom_error_decode() {
use num_traits::FromPrimitive;
fn pretty_err<T>(err: InstructionError) -> String
where
T: 'static + std::error::Error + DecodeError<T> + FromPrimitive,
{
if let InstructionError::CustomError(code) = err {
let specific_error: T = T::decode_custom_error_to_enum(code).unwrap();
format!(
"{:?}: {}::{:?} - {}",
err,
T::type_of(),
specific_error,
specific_error,
)
} else {
"".to_string()
}
}
assert_eq!(
"CustomError(0): VoteError::VoteTooOld - vote already recorded or not in slot hashes history",
pretty_err::<VoteError>(VoteError::VoteTooOld.into())
)
} | rust_cleaned_test_functions.jsonl/74412 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 495
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15875,
4096,
15227,
368,
341,
286,
990,
1629,
39693,
486,
3830,
33313,
280,
286,
5168,
5020,
9266,
3125,
2235,
615,
25,
29051,
1454,
8,
1464,
923,
198,
286,
1380,
198,
310,
350,
25,
364,
1978,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_replace() {
let mut data = HashMap::new();
data.insert("name","lyf".to_string());
data.insert("id","123".to_string());
assert_eq!(replace_named("/path1/{name}/hello/{id}/res", &data), "/path1/lyf/hello/123/res");
assert_eq!(replace_named("/{name}/{id}", &data), "/lyf/123");
assert_eq!(replace_named("/{name}/{id}/", &data), "/lyf/123/");
assert_eq!(replace_named("{name}/{id}/", &data), "lyf/123/");
assert_eq!(replace_named("{name2}/{id}/", &data), "{name2}/123/");
assert_eq!(replace_named("/path/res", &data), "/path/res");
} | rust_cleaned_test_functions.jsonl/37692 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 266
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10633,
368,
341,
262,
1077,
5206,
821,
284,
10528,
486,
931,
543,
262,
821,
7030,
445,
606,
2198,
398,
69,
3263,
983,
3904,
1423,
262,
821,
7030,
445,
307,
2198,
16,
17,
18,
3263,
983,
3904,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_oleaut32() {
test_file(
&format!("{}/oleaut32.dll/BCDE805BC4000/oleaut32.dll", MS),
TestFlags::NO_MULTIPLICITY,
);
} | rust_cleaned_test_functions.jsonl/127349 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 108
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
1263,
2717,
18,
17,
368,
341,
286,
1273,
2458,
1006,
310,
609,
2243,
88928,
4472,
1263,
2717,
18,
17,
22200,
14,
4897,
1150,
23,
15,
20,
4897,
19,
15,
15,
15,
14,
1263,
2717,
18,
17,
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 |
#[test]
fn test_refresh_stake() {
let (mut driver, mut gov, neuron) = create_mature_neuron();
let nid = neuron.id.unwrap();
let neuron = gov.get_neuron_mut(&nid).unwrap();
let account = neuron.account.clone();
// 'now'.
neuron
.configure(
&*TEST_NEURON_1_OWNER_PRINCIPAL,
driver.now(),
&Configure {
operation: Some(Operation::IncreaseDissolveDelay(IncreaseDissolveDelay {
additional_dissolve_delay_seconds: 6
* ic_nns_governance::governance::ONE_MONTH_SECONDS as u32,
})),
},
)
.unwrap();
// some age.
driver.advance_time_by(6 * ic_nns_governance::governance::ONE_MONTH_SECONDS);
assert_eq!(
neuron.aging_since_timestamp_seconds,
driver.now() - 6 * ic_nns_governance::governance::ONE_MONTH_SECONDS - 1,
);
let block_height = 543212234;
// Note that the nonce must match the nonce chosen in the original
// transfer.
let nonce = 1234u64;
// Double the stake of the existing neuron.
let nid_result = gov
.create_or_refresh_neuron(NeuronStakeTransfer {
transfer_timestamp: driver.now(),
from: Some(*TEST_NEURON_1_OWNER_PRINCIPAL),
from_subaccount: Vec::new(),
to_subaccount: account,
neuron_stake_e8s: 100_000_000,
block_height,
memo: nonce,
})
.now_or_never()
.unwrap()
.unwrap();
assert_eq!(nid_result, nid);
let neuron = gov.get_neuron_mut(&nid).unwrap();
assert_eq!(neuron.cached_neuron_stake_e8s, 200_000_000);
assert_eq!(
neuron.aging_since_timestamp_seconds,
driver.now() - 3 * ic_nns_governance::governance::ONE_MONTH_SECONDS - 1
);
} | rust_cleaned_test_functions.jsonl/42503 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 921
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42076,
1261,
726,
368,
341,
262,
1077,
320,
6984,
5579,
11,
5206,
47625,
11,
48284,
8,
284,
1855,
717,
1568,
13925,
36090,
543,
262,
1077,
70939,
284,
48284,
1764,
55395,
543,
262,
1077,
48284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lookup_derefs() -> TestResult {
let p = polar();
p.load_str(
r#"f(x) if x = y and g(y);
g(y) if new Foo().get(y) = y;"#,
)?;
let q = p.new_query("f(1)", false)?;
let mut foo_lookups = vec![term!(1)];
let mock_foo = |_, _, _, args: Option<Vec<Term>>, _| {
// check the argument is bound to an integer
assert!(matches!(args.unwrap()[0].value(), Value::Number(_)));
foo_lookups.pop()
};
let results = query_results!(q, mock_foo);
assert!(foo_lookups.is_empty());
assert_eq!(results.len(), 1);
let mut foo_lookups = vec![term!(1)];
let mock_foo = |_, _, _, args: Option<Vec<Term>>, _| {
assert!(matches!(args.unwrap()[0].value(), Value::Number(_)));
foo_lookups.pop()
};
let q = p.new_query("f(2)", false)?;
let results = query_results!(q, mock_foo);
assert!(results.is_empty());
Ok(())
} | rust_cleaned_test_functions.jsonl/68116 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 449
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27464,
814,
485,
3848,
368,
1464,
3393,
2077,
341,
262,
1077,
281,
284,
24660,
543,
262,
281,
5104,
2895,
1006,
286,
435,
55543,
69,
2075,
8,
421,
856,
284,
379,
323,
342,
7021,
317,
1843,
342... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_rod_cutting_recursive() {
assert_eq!(
8,
rod_cutting_recursive(&mut vec![1, 2, 3, 4, 5, 6, 7, 8], 8)
);
assert_eq!(
22,
rod_cutting_recursive(&mut vec![1, 5, 8, 9, 10, 17, 17, 20], 8)
);
assert_eq!(13, rod_cutting_recursive(&mut vec![1, 5, 8, 9, 10], 5));
} | rust_cleaned_test_functions.jsonl/56982 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 219
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
23505,
41317,
1280,
66242,
368,
341,
286,
2060,
10714,
33673,
310,
220,
23,
345,
310,
20589,
41317,
1280,
66242,
2099,
6984,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
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_request_with_an_apns_expiration() {
let builder = PlainNotificationBuilder::new("test");
let payload = builder.build(
"a_test_id",
NotificationOptions {
apns_expiration: Some(420),
..Default::default()
},
);
let client = Client::new(AlpnConnector::new(), None, Endpoint::Production);
let request = client.build_request(payload);
let apns_expiration = request.headers().get("apns-expiration").unwrap();
assert_eq!("420", apns_expiration);
} | rust_cleaned_test_functions.jsonl/109655 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 269
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7893,
6615,
12008,
21093,
4412,
2702,
28479,
368,
341,
286,
1077,
7363,
284,
43199,
11196,
3297,
486,
931,
445,
1944,
3071,
286,
1077,
7729,
284,
7363,
13239,
1006,
310,
330,
64,
4452,
842,
756,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_network_address_parse_success() {
use super::Protocol::*;
let pubkey_str = "080e287879c918794170e258bfaddd75acac5b3e350419044655e4983a487120";
let pubkey = x25519::PublicKey::from_encoded_string(pubkey_str).unwrap();
let noise_addr_str = format!(
"/dns/example.com/tcp/1234/ln-noise-ik/{}/ln-handshake/5",
pubkey_str
);
let test_cases = [
(
"/memory/1234/ln-handshake/0",
vec![Memory(1234), Handshake(0)],
),
(
"/ip4/12.34.56.78/tcp/1234/ln-handshake/123",
vec![
Ip4(Ipv4Addr::new(12, 34, 56, 78)),
Tcp(1234),
Handshake(123),
],
),
(
"/ip6/::1/tcp/0",
vec![Ip6(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1)), Tcp(0)],
),
(
"/ip6/dead:beef::c0de/tcp/8080",
vec![
Ip6(Ipv6Addr::new(0xdead, 0xbeef, 0, 0, 0, 0, 0, 0xc0de)),
Tcp(8080),
],
),
(
"/dns/example.com/tcp/80",
vec![Dns(DnsName("example.com".to_owned())), Tcp(80)],
),
(
&noise_addr_str,
vec![
Dns(DnsName("example.com".to_owned())),
Tcp(1234),
NoiseIK(pubkey),
Handshake(5),
],
),
];
for (addr_str, expected_address) in &test_cases {
let actual_address = NetworkAddress::from_str(addr_str)
.map_err(|err| format_err!("failed to parse: input: '{}', err: {}", addr_str, err))
.unwrap();
let expected_address = NetworkAddress::new(expected_address.clone());
assert_eq!(actual_address, expected_address);
}
} | rust_cleaned_test_functions.jsonl/4278 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1282
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20966,
6744,
21039,
18632,
368,
341,
286,
990,
2256,
486,
20689,
79304,
286,
1077,
95116,
2895,
284,
330,
15,
23,
15,
68,
17,
23,
22,
23,
22,
24,
66,
24,
16,
23,
22,
24,
19,
16,
22,
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... | 2 |
#[test]
fn test_ease_point_in_expo() {
let start = Point { x: 0.0, y: 0.0 };
let end = Point { x: 1.0, y: 1.0 };
assert_eq!(ease_point(ease_in_expo, start, end, 1.0), end);
assert_eq!(ease_point(ease_in_expo, start, end, 0.0), start);
} | rust_cleaned_test_functions.jsonl/40076 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 152
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2204,
519,
6085,
1243,
2702,
5368,
368,
341,
286,
1077,
1191,
284,
5126,
314,
856,
25,
220,
15,
13,
15,
11,
379,
25,
220,
15,
13,
15,
2605,
286,
1077,
835,
284,
5126,
314,
856,
25,
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... | 1 |
#[test]
fn test_first() {
let sc = CONTEXT.clone();
let col1 = vec![1, 2, 3, 4];
let col1_rdd = sc.clone().parallelize(col1, 4);
let taken_1 = col1_rdd.first();
assert!(taken_1.is_ok());
let col2: Vec<i32> = vec![];
let col2_rdd = sc.parallelize(col2, 4);
let taken_0 = col2_rdd.first();
assert!(taken_0.is_err());
} | rust_cleaned_test_functions.jsonl/27942 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 180
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12978,
368,
341,
262,
1077,
1136,
284,
87336,
15997,
543,
262,
1077,
1375,
16,
284,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
935,
262,
1077,
1375,
16,
1710,
631,
284,
1136,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_update_fee_that_funder_cannot_afford() {
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let channel_value = 1888;
let chan = create_announced_chan_between_nodes_with_value(&nodes, 0, 1, channel_value, 700000, InitFeatures::supported(), InitFeatures::supported());
let channel_id = chan.2;
let feerate = 260;
nodes[0].node.update_fee(channel_id, feerate).unwrap();
check_added_monitors!(nodes[0], 1);
let update_msg = get_htlc_update_msgs!(nodes[0], nodes[1].node.get_our_node_id());
nodes[1].node.handle_update_fee(&nodes[0].node.get_our_node_id(), &update_msg.update_fee.unwrap());
commitment_signed_dance!(nodes[1], nodes[0], update_msg.commitment_signed, false);
//Confirm that the new fee based on the last local commitment txn is what we expected based on the feerate of 260 set above.
{
let mut chan_lock = nodes[1].node.channel_state.lock().unwrap();
let chan = chan_lock.by_id.get_mut(&channel_id).unwrap();
//We made sure neither party's funds are below the dust limit so -2 non-HTLC txns from number of outputs
let num_htlcs = chan.channel_monitor().get_latest_local_commitment_txn()[0].output.len() - 2;
let total_fee: u64 = feerate * (COMMITMENT_TX_BASE_WEIGHT + (num_htlcs as u64) * COMMITMENT_TX_WEIGHT_PER_HTLC) / 1000;
let mut actual_fee = chan.channel_monitor().get_latest_local_commitment_txn()[0].output.iter().fold(0, |acc, output| acc + output.value);
actual_fee = channel_value - actual_fee;
assert_eq!(total_fee, actual_fee);
} //drop the mutex
//Add 2 to the previous fee rate to the final fee increases by 1 (with no HTLCs the fee is essentially
nodes[0].node.update_fee(channel_id, feerate+2).unwrap();
check_added_monitors!(nodes[0], 1);
let update2_msg = get_htlc_update_msgs!(nodes[0], nodes[1].node.get_our_node_id());
nodes[1].node.handle_update_fee(&nodes[0].node.get_our_node_id(), &update2_msg.update_fee.unwrap());
//While producing the commitment_signed response after handling a received update_fee request the
//Should produce and error.
nodes[1].node.handle_commitment_signed(&nodes[0].node.get_our_node_id(), &update2_msg.commitment_signed);
nodes[1].logger.assert_log("lightning::ln::channelmanager".to_string(), "Funding remote cannot afford proposed new fee".to_string(), 1);
//clear the message we could not handle
nodes[1].node.get_and_clear_pending_msg_events();
} | rust_cleaned_test_functions.jsonl/28283 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 955
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
34305,
70197,
761,
7995,
666,
3401,
48914,
539,
368,
341,
10217,
26023,
1645,
18343,
82,
284,
1855,
45552,
1645,
18343,
82,
7,
17,
317,
10217,
2436,
18343,
82,
284,
1855,
5084,
18343,
82,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_min_idle() {
let mut event_loop = Runtime::new().unwrap();
let pool = event_loop
.block_on(lazy(|| {
Pool::builder()
.max_size(5)
.min_idle(Some(2))
.build(OkManager::<FakeConnection>::new())
}))
.unwrap();
let state = pool.state();
assert_eq!(2, state.idle_connections);
assert_eq!(2, state.connections);
let mut rx = Vec::with_capacity(3);
let mut tx = Vec::with_capacity(3);
for _ in 0..3 {
let (tx1, rx1) = oneshot::channel();
let (tx2, rx2) = oneshot::channel();
event_loop.spawn(
pool.run(|conn| {
tx1.send(()).unwrap();
rx2.then(|r| match r {
Ok(v) => Ok((v, conn)),
Err(_) => Err((Error, conn)),
})
})
.map_err(|_| ()),
);
rx.push(rx1);
tx.push(tx2);
}
event_loop
.block_on(FuturesUnordered::from_iter(rx).collect())
.unwrap();
let state = pool.state();
assert_eq!(2, state.idle_connections);
assert_eq!(5, state.connections);
for tx in tx.into_iter() {
tx.send(()).unwrap();
}
// And wait for the connections to return.
assert!(event_loop
.block_on(lazy(|| Timeout::new(
empty::<(), ()>(),
Duration::from_secs(1)
)))
.unwrap_err()
.is_elapsed());
let state = pool.state();
assert_eq!(5, state.idle_connections);
assert_eq!(5, state.connections);
} | rust_cleaned_test_functions.jsonl/127893 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 861
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7260,
47810,
368,
341,
262,
1077,
5206,
1538,
17198,
284,
10954,
486,
931,
1005,
15454,
543,
262,
1077,
7314,
284,
1538,
17198,
198,
286,
659,
4574,
4470,
2333,
13619,
79453,
341,
310,
22728,
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... | 6 |
#[test]
fn test_analyze_object_with_implicit_keys() {
let b = ast::BaseNode::default();
let pkg = ast::Package {
base: b.clone(),
path: "path".to_string(),
package: "main".to_string(),
files: vec![ast::File {
base: b.clone(),
name: "foo.flux".to_string(),
package: None,
imports: Vec::new(),
body: vec![ast::Statement::Expr(ast::ExprStmt {
base: b.clone(),
expression: ast::Expression::Object(Box::new(ast::ObjectExpr {
base: b.clone(),
with: None,
properties: vec![
ast::Property {
base: b.clone(),
key: ast::PropertyKey::Identifier(ast::Identifier {
base: b.clone(),
name: "a".to_string(),
}),
value: None,
},
ast::Property {
base: b.clone(),
key: ast::PropertyKey::Identifier(ast::Identifier {
base: b.clone(),
name: "b".to_string(),
}),
value: None,
},
],
})),
})],
}],
};
let want = Package {
loc: b.location.clone(),
package: "main".to_string(),
files: vec![File {
loc: b.location.clone(),
package: None,
imports: Vec::new(),
body: vec![Statement::Expr(ExprStmt {
loc: b.location.clone(),
expression: Expression::Object(Box::new(ObjectExpr {
loc: b.location.clone(),
typ: type_info(),
with: None,
properties: vec![
Property {
loc: b.location.clone(),
key: Identifier {
loc: b.location.clone(),
name: "a".to_string(),
},
value: Expression::Identifier(IdentifierExpr {
loc: b.location.clone(),
typ: type_info(),
name: "a".to_string(),
}),
},
Property {
loc: b.location.clone(),
key: Identifier {
loc: b.location.clone(),
name: "b".to_string(),
},
value: Expression::Identifier(IdentifierExpr {
loc: b.location.clone(),
typ: type_info(),
name: "b".to_string(),
}),
},
],
})),
})],
}],
};
let got = test_analyze(pkg).unwrap();
assert_eq!(want, got);
} | rust_cleaned_test_functions.jsonl/61559 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2531
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12008,
55856,
5314,
6615,
62,
30940,
12631,
368,
341,
286,
1077,
293,
284,
11763,
486,
3978,
1955,
486,
2258,
543,
286,
1077,
24793,
284,
11763,
486,
13100,
341,
310,
2331,
25,
293,
15997,
3148,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_date32_fmt_debug() {
let arr: PrimitiveArray<Date32Type> = vec![12356, 13548, -365].into();
assert_eq!(
"PrimitiveArray<Date32>\n[\n 2003-10-31,\n 2007-02-04,\n 1969-01-01,\n]",
format!("{:?}", arr)
);
} | rust_cleaned_test_functions.jsonl/27288 | {
"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,
4164,
18,
17,
38128,
15446,
368,
341,
286,
1077,
2890,
25,
51460,
1857,
98879,
18,
17,
929,
29,
284,
7486,
20703,
16,
17,
18,
20,
21,
11,
220,
16,
18,
20,
19,
23,
11,
481,
18,
21,
20,
93... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fixed_size_binary_array_from_incorrect_list_array() {
let values: [u32; 12] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
let values_data = ArrayData::builder(DataType::UInt32)
.len(12)
.add_buffer(Buffer::from(values[..].to_byte_slice()))
.add_child_data(ArrayData::builder(DataType::Boolean).build())
.build();
let array_data =
ArrayData::builder(DataType::FixedSizeList(Box::new(DataType::Binary), 4))
.len(3)
.add_child_data(values_data)
.build();
let list_array = FixedSizeListArray::from(array_data);
FixedSizeBinaryArray::from(list_array);
} | rust_cleaned_test_functions.jsonl/11626 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 361
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37839,
2368,
31761,
3858,
5673,
1243,
19928,
2019,
3858,
368,
341,
286,
1077,
2750,
25,
508,
84,
18,
17,
26,
220,
16,
17,
60,
284,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
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_use_cache() {
test_with_wasm(
include_bytes!("./fixtures/use_cache/use_cache.wasm"),
hex!("ed4b9d1b"),
hex!("928b2036"),
);
} | rust_cleaned_test_functions.jsonl/122572 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15951,
11529,
368,
341,
262,
1273,
6615,
1670,
10530,
1006,
286,
2924,
12524,
0,
13988,
45247,
62272,
11529,
62272,
11529,
1418,
10530,
4461,
286,
12371,
17223,
291,
19,
65,
24,
67,
16,
65,
4461,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_part2_ex8() {
let actual = part2(&parse("9C0141080250320F1802104A08"));
assert_eq!(actual, 1);
} | rust_cleaned_test_functions.jsonl/21398 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 73
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10495,
17,
2702,
23,
368,
341,
286,
1077,
5042,
284,
949,
17,
2099,
6400,
445,
24,
34,
15,
16,
19,
16,
15,
23,
15,
17,
20,
15,
18,
17,
15,
37,
16,
23,
15,
17,
16,
15,
19,
32,
15,
23,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_from_rotation() {
let axis = Unit::from_value(Vector3::unit_z());
let angle = Degrees(90_f64);
let isometry = Isometry3::from_axis_angle(&axis, angle);
let vector = Vector3::unit_x();
let expected = Vector3::unit_y();
let result = isometry.transform_vector(&vector);
assert_relative_eq!(result, expected, epsilon = 1e-8);
} | rust_cleaned_test_functions.jsonl/77223 | {
"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,
5673,
44813,
368,
341,
286,
1077,
8024,
284,
7954,
486,
1499,
3142,
20258,
18,
486,
3843,
6415,
1423,
286,
1077,
9210,
284,
92901,
7,
24,
15,
761,
21,
19,
317,
286,
1077,
374,
6988,
284,
2160,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_rtl() {
assert_eq!(Level(0).is_rtl(), false);
assert_eq!(Level(1).is_rtl(), true);
assert_eq!(Level(10).is_rtl(), false);
assert_eq!(Level(11).is_rtl(), true);
assert_eq!(Level(124).is_rtl(), false);
assert_eq!(Level(125).is_rtl(), true);
} | rust_cleaned_test_functions.jsonl/31773 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 169
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
1710,
11544,
368,
341,
286,
2060,
10714,
10297,
4449,
7,
15,
568,
285,
1710,
11544,
1507,
895,
317,
286,
2060,
10714,
10297,
4449,
7,
16,
568,
285,
1710,
11544,
1507,
830,
317,
286,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_embed_field_value_limit() {
let mut embed = base_embed();
embed.fields.push(EmbedField {
inline: true,
name: "a".to_owned(),
value: str::repeat("a", 1024),
});
assert!(super::embed(&embed).is_ok());
embed.fields.push(EmbedField {
inline: true,
name: "a".to_owned(),
value: str::repeat("a", 1025),
});
assert!(matches!(
super::embed(&embed).unwrap_err().kind(),
EmbedValidationErrorType::FieldValueTooLarge { chars: 1025 }
));
} | rust_cleaned_test_functions.jsonl/4831 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 316
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24007,
5013,
3142,
14763,
368,
341,
286,
1077,
5206,
11579,
284,
2331,
24007,
543,
286,
11579,
12920,
2552,
7,
25486,
1877,
341,
310,
7381,
25,
830,
345,
310,
829,
25,
330,
64,
3263,
983,
51973,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_subst_template_type_parm_type_vs_const_when_non_const_template_param() -> Result<()> {
// This test (and
// `test_subst_template_type_parm_type_vs_const_when_const_template_param`)
// verifies that `importer.cc` preserves `const` qualifier attached *both* to
// QualType associated with:
let ir = ir_from_cc(
r#" #pragma clang lifetime_elision
template <typename T>
struct MyTemplate {
const T& GetConstRef() const { return value; }
T& GetRef() { return value; }
T value;
};
// Just like the other test_subst_template_type_parm_type_vs_const...
// test, but using non-*const* int template parameter.
using MyAlias = MyTemplate<int>; "#,
)?;
assert_ir_matches!(
ir,
quote! {
Func {
name: "GetConstRef", ...
return_type: MappedType {
rs_type: RsType {
name: Some("&"), ...
type_args: [RsType { name: Some("i32"), ... }], ...
},
cc_type: CcType {
name: Some("&"),
is_const: false,
type_args: [CcType {
name: Some("int"),
is_const: true, ...
}], ...
},
}, ...
}
}
);
assert_ir_matches!(
ir,
quote! {
Func {
name: "GetRef", ...
return_type: MappedType {
rs_type: RsType {
name: Some("&mut"), ...
type_args: [RsType { name: Some("i32"), ... }], ...
},
cc_type: CcType {
name: Some("&"),
is_const: false,
type_args: [CcType {
name: Some("int"),
is_const: false, ...
}], ...
},
}, ...
}
}
);
Ok(())
} | rust_cleaned_test_functions.jsonl/37180 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1368
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5228,
267,
8693,
1819,
97705,
1819,
42434,
13610,
47636,
21637,
13610,
8693,
4090,
368,
1464,
5714,
71698,
341,
262,
442,
1096,
1273,
320,
437,
198,
262,
442,
1565,
1944,
5228,
267,
8693,
1819,
97... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.