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_as_vectype() {
let vector = Acceleration::new(1.0, 2.0, 3.0);
let answer = Velocity::new(1.0, 2.0, 3.0);
let result = vector.as_vectype::<Velocity<f64>>();
let snd_result = result.as_vectype::<Acceleration<f64>>();
assert_eq!(answer, result);
assert_eq!(vector, snd_result);
} | rust_cleaned_test_functions.jsonl/40026 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
59402,
499,
368,
341,
262,
1077,
4621,
284,
46905,
367,
486,
931,
7,
16,
13,
15,
11,
220,
17,
13,
15,
11,
220,
18,
13,
15,
317,
262,
1077,
4226,
284,
54434,
486,
931,
7,
16,
13,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_ids() {
assert!(SMethod::from_ids(TYPE_CODE, MAP_METHOD_ID).map(|e| e.name()) == Ok("map"));
assert!(SMethod::from_ids(TYPE_CODE, FILTER_METHOD_ID).map(|e| e.name()) == Ok("filter"));
} | rust_cleaned_test_functions.jsonl/84388 | {
"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,
5673,
8077,
368,
341,
286,
2060,
10297,
50,
3523,
486,
1499,
8077,
69227,
10020,
11,
27223,
14058,
3450,
568,
2186,
22428,
68,
91,
384,
2644,
2140,
621,
7622,
445,
2186,
4010,
286,
2060,
10297,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_config_template_no_superfluous_keys() {
let template_config = std::include_str!("../etc/config-template.toml")
.lines()
.map(|l| l.strip_prefix('#').unwrap_or(l))
.join("\n");
let mut deserializer = toml::Deserializer::new(&template_config);
let mut unrecognized_keys = Vec::new();
let _: TiKvConfig = serde_ignored::deserialize(&mut deserializer, |key| {
unrecognized_keys.push(key.to_string())
})
.unwrap();
assert_eq!(unrecognized_keys, Vec::<String>::new());
} | rust_cleaned_test_functions.jsonl/2171 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 291
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5332,
8693,
6536,
38886,
1489,
9193,
12631,
368,
341,
286,
1077,
3811,
5332,
284,
1460,
486,
997,
2895,
17223,
1244,
12107,
14730,
33409,
73494,
75,
1138,
310,
659,
7969,
741,
310,
659,
2186,
2242... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pct_encoded() -> Result<()> {
init();
let mut counter = 0;
let prop = prop::for_all(
|| pct_encoded_str_gen(),
move |s| {
counter += 1;
log::debug!("{:>03}, value = {}", counter, s);
let (_, r) = pct_encoded(Elms::new(s.as_bytes())).ok().unwrap();
r == s
},
);
prop::test_with_prop(prop, 5, TEST_COUNT, RNG::new())
} | rust_cleaned_test_functions.jsonl/43682 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 210
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71512,
73069,
368,
1464,
5714,
71698,
341,
262,
2930,
543,
262,
1077,
5206,
5546,
284,
220,
15,
280,
262,
1077,
2004,
284,
2004,
486,
1958,
5705,
1006,
414,
1369,
81847,
73069,
2895,
16322,
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... | 2 |
#[test]
fn test_unbalanced_brackets() {
let inputs = ["[[]", "[]]", "(()", "())", "{{}", "{}}"];
for input in &inputs {
assert!(tokenize(input).is_err());
}
} | rust_cleaned_test_functions.jsonl/51084 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 106
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
58402,
17682,
18382,
368,
341,
286,
1077,
11127,
284,
4383,
58,
1294,
497,
330,
1294,
19076,
330,
5065,
497,
330,
2140,
497,
47219,
9545,
13868,
3417,
6332,
286,
369,
1946,
304,
609,
24941,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_seek_bytes() {
// results in a prefix of eight null bytes.
new_ucmd!()
.args(&["seek=8", "oflag=seek_bytes"])
.pipe_in("abcdefghijklm\n")
.succeeds()
.stdout_is("\0\0\0\0\0\0\0\0abcdefghijklm\n");
} | rust_cleaned_test_functions.jsonl/99838 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 150
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74473,
12524,
368,
341,
1066,
262,
442,
3059,
304,
264,
9252,
315,
8063,
845,
5820,
624,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
25713,
28,
23,
497,
330,
1055,
13363,
28,
25... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_send_propose_and_prevote() {
let sandbox = timestamping_sandbox();
// get some tx
let tx = gen_timestamping_tx();
sandbox.recv(&tx);
// round happens
sandbox.add_time(Duration::from_millis(1000));
sandbox.add_time(Duration::from_millis(1999));
sandbox.assert_state(Height(1), Round(3));
let propose = sandbox.create_propose(
ValidatorId(0),
Height(1),
Round(3),
sandbox.last_hash(),
vec![tx.object_hash()],
sandbox.secret_key(ValidatorId(0)),
);
sandbox.broadcast(&propose);
sandbox.broadcast(&sandbox.create_prevote(
ValidatorId(0),
Height(1),
Round(3),
propose.object_hash(),
NOT_LOCKED,
sandbox.secret_key(ValidatorId(0)),
));
} | rust_cleaned_test_functions.jsonl/16571 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 370
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13565,
21663,
960,
8378,
25566,
1272,
368,
341,
262,
1077,
42754,
284,
11441,
287,
643,
31536,
1428,
262,
442,
633,
1045,
9854,
198,
262,
1077,
9854,
284,
4081,
23073,
287,
17805,
543,
262,
42754,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_empty() {
let mut bv = BitVec::new(0);
assert!(bv.is_empty());
bv.push(true);
assert!(!bv.is_empty());
} | rust_cleaned_test_functions.jsonl/128605 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 97
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
15124,
368,
341,
286,
1077,
5206,
56937,
284,
6495,
10050,
486,
931,
7,
15,
626,
286,
2060,
10297,
54929,
2079,
15124,
5231,
286,
56937,
2552,
3715,
317,
286,
2060,
0,
3471,
54929,
2079,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_pipelines() {
assert_display_snapshot!((resolve_and_translate(parse(r###"
from employees
group dept (take 1)
"###,
).unwrap()).unwrap()), @r###"
SELECT
DISTINCT employees.*
FROM
employees
"###);
} | rust_cleaned_test_functions.jsonl/62576 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 166
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
93997,
368,
341,
286,
2060,
14825,
53265,
0,
1188,
17325,
8378,
66381,
27762,
2601,
14374,
698,
286,
504,
8256,
198,
286,
1874,
44593,
320,
22769,
220,
16,
340,
286,
330,
14374,
345,
286,
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_increase_file_size() {
let expected = 5 * 1024;
let (at, mut ucmd) = at_and_ucmd!();
let mut file = at.make_file(TFILE1);
ucmd.args(&["-s", "+5K", TFILE1]).succeeds();
file.seek(SeekFrom::End(0)).unwrap();
let actual = file.seek(SeekFrom::Current(0)).unwrap();
assert!(
expected == actual,
"expected '{}' got '{}'",
expected,
actual
);
} | rust_cleaned_test_functions.jsonl/50490 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 204
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73807,
2458,
2368,
368,
341,
262,
1077,
3601,
284,
220,
20,
353,
220,
16,
15,
17,
19,
280,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
1077,
5206,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sig_verify() {
let msg = "uncle".as_bytes();
let mut pk = [0u8; PUBLIC_KEY_LENGTH];
pk.copy_from_slice(
"4KxUVD9NtyRJjU3BCvPgJSttoJX7cb3DMdDTNucLN121"
.from_base58()
.unwrap()
.as_slice(),
);
let mut sig = [0u8; SIGNATURE_LENGTH];
sig.copy_from_slice(
"B4ViRpS6wZ73hhTtP4hhrfV46rR3uoUn7jgsH5yfkKMpbJUxMmu48jf3QSdibRkQBN7Tkx9jReKDq1Rmp9acxPG"
.from_base58().unwrap().as_slice());
assert!(sig_verify(msg, &pk, &sig));
} | rust_cleaned_test_functions.jsonl/18198 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 382
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29252,
35638,
368,
341,
286,
1077,
3750,
284,
330,
1347,
273,
3263,
300,
12524,
543,
286,
1077,
5206,
22458,
284,
508,
15,
84,
23,
26,
31416,
6600,
15023,
935,
286,
22458,
12232,
5673,
26488,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_election_with_priority_log() {
let tests = vec![
(true, false, false, 3, 1, 1, 1, StateRole::Leader),
(true, false, false, 2, 2, 2, 1, StateRole::Leader),
(true, false, false, 1, 3, 3, 1, StateRole::Leader),
(true, true, true, 3, 1, 1, 1, StateRole::Leader),
(true, true, true, 2, 2, 2, 1, StateRole::Leader),
(true, true, true, 1, 3, 3, 1, StateRole::Follower),
(false, true, true, 3, 1, 1, 1, StateRole::Follower),
(false, true, true, 2, 2, 2, 1, StateRole::Follower),
(false, true, true, 1, 3, 3, 1, StateRole::Follower),
(false, false, true, 1, 3, 1, 1, StateRole::Follower),
(false, false, true, 1, 1, 3, 1, StateRole::Leader),
];
for (_i, &(l1, l2, l3, p1, p2, p3, id, state)) in tests.iter().enumerate() {
let l = default_logger();
let mut n1 = new_test_raft(1, vec![1, 2, 3], 10, 1, new_storage(), &l);
let mut n2 = new_test_raft(2, vec![1, 2, 3], 10, 1, new_storage(), &l);
let mut n3 = new_test_raft(3, vec![1, 2, 3], 10, 1, new_storage(), &l);
n1.set_priority(p1);
n2.set_priority(p2);
n3.set_priority(p3);
let entries = vec![new_entry(1, 1, SOME_DATA), new_entry(1, 1, SOME_DATA)];
if l1 {
n1.raft_log.append(&entries);
}
if l2 {
n2.raft_log.append(&entries);
}
if l3 {
n3.raft_log.append(&entries);
}
let mut network = Network::new(vec![Some(n1), Some(n2), Some(n3)], &l);
network.send(vec![new_message(id, id, MessageType::MsgHup, 0)]);
assert_eq!(network.peers[&id].state, state);
}
} | rust_cleaned_test_functions.jsonl/19201 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 872
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2204,
1170,
6615,
38161,
5224,
368,
341,
262,
1077,
7032,
284,
7486,
90515,
1789,
286,
320,
1866,
11,
895,
11,
895,
11,
220,
18,
11,
220,
16,
11,
220,
16,
11,
220,
16,
11,
3234,
9030,
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... | 5 |
#[test]
fn test_file_storage() {
let a: i64 = 6;
let mut counter: i64 = 0;
let mut s = FileStorage::new("file_test").unwrap();
s.flush().unwrap();
assert_eq!(a * 10, test_func_1(a, &mut counter));
assert_eq!(counter, 1);
assert_eq!(a * 10, cache!(s, test_func_1(a, &mut counter)));
assert_eq!(counter, 2);
let mut counter: i64 = 1;
assert_eq!(a * 10, cache!(s, test_func_1(a, &mut counter)));
assert_eq!(counter, 1);
s.flush().unwrap();
} | rust_cleaned_test_functions.jsonl/123186 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 278
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2458,
23310,
368,
341,
286,
1077,
264,
25,
600,
21,
19,
284,
220,
21,
280,
286,
1077,
5206,
5546,
25,
600,
21,
19,
284,
220,
15,
280,
286,
1077,
5206,
274,
284,
2887,
5793,
486,
931,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_boolean_evaluation() {
let test_cases = [
("0|0|1", true, 2),
("1^0|0|1", false, 2),
("0&0&0&1^1|0", true, 10),
];
for case in test_cases {
assert_eq!(boolean_evaluation(case.0, case.1), case.2);
}
} | rust_cleaned_test_functions.jsonl/74234 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 150
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46642,
86505,
368,
341,
262,
1077,
1273,
41427,
284,
2278,
286,
3489,
15,
91,
15,
91,
16,
497,
830,
11,
220,
17,
1326,
286,
3489,
16,
61,
15,
91,
15,
91,
16,
497,
895,
11,
220,
17,
1326,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_sparse_divisors() {
for i in 0..64 {
for j in i..64 {
let d = (1u64 << i) | (1u64 << j);
check(d);
check(!d);
}
}
} | rust_cleaned_test_functions.jsonl/65994 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 175
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71123,
16237,
41214,
368,
341,
286,
369,
600,
304,
220,
15,
496,
21,
19,
341,
310,
369,
502,
304,
600,
496,
21,
19,
341,
394,
1077,
294,
284,
320,
16,
84,
21,
19,
1115,
600,
8,
760,
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... | 3 |
#[test]
fn test_scrape_normal() {
let mut file = File::open("test_resources/contests_normal").unwrap();
let mut contents = String::new();
file.read_to_string(&mut contents).unwrap();
let contests = scrape_normal(&contents).unwrap();
assert_eq!(contests.len(), 50);
} | rust_cleaned_test_functions.jsonl/25789 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 132
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13171,
19842,
13973,
368,
341,
286,
1077,
5206,
1034,
284,
2887,
486,
2508,
445,
1944,
35569,
14,
772,
17966,
13973,
1827,
15454,
543,
286,
1077,
5206,
8794,
284,
923,
486,
931,
543,
286,
1034,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_valid_sqs_send_message_batch() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/valid",
"sqs-send-message-batch.xml",
);
let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
let client = SqsClient::new_with(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = SendMessageBatchRequest::default();
let result = client.send_message_batch(request).sync();
assert!(result.is_ok(), "parse error: {:?}", result);
} | rust_cleaned_test_functions.jsonl/49940 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 247
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8337,
643,
26358,
13565,
6462,
14534,
368,
341,
286,
1077,
7860,
9655,
284,
14563,
2582,
5062,
486,
878,
9655,
1006,
310,
330,
1944,
35569,
79372,
14,
1891,
756,
310,
330,
82,
26358,
74118,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_path_clean_long() {
let mut test_paths: Vec<(String, String)> = Vec::new();
for i in 1..1234 {
let ss = "a".repeat(i);
let correct_path = format!("{}{}", "/", ss);
test_paths.push((correct_path.clone(), correct_path.clone()));
test_paths.push((ss.clone(), correct_path.clone()));
test_paths.push((format!("{}{}", "//", ss), correct_path.clone()));
test_paths.push((format!("{}{}{}", "//", ss, "/b/.."), correct_path.clone()));
}
for test in test_paths {
let s = clean(&test.0);
assert_eq!(test.1, s);
let s = clean(&test.1);
assert_eq!(test.1, s);
}
} | rust_cleaned_test_functions.jsonl/3001 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 386
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2638,
19573,
17799,
368,
341,
286,
1077,
5206,
1273,
24152,
25,
11312,
28706,
703,
11,
923,
16018,
284,
11312,
486,
931,
543,
286,
369,
600,
304,
220,
16,
496,
16,
17,
18,
19,
341,
310,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_split() {
let mut s = ByteString::from_static("helloworld");
let s1 = s.split_off(5);
assert_eq!(s, "hello");
assert_eq!(s1, "world");
let mut s = ByteString::from_static("helloworld");
let s1 = s.split_to(5);
assert_eq!(s, "world");
assert_eq!(s1, "hello");
} | rust_cleaned_test_functions.jsonl/65281 | {
"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,
17052,
368,
341,
286,
1077,
5206,
274,
284,
95302,
486,
1499,
25360,
445,
71,
95292,
797,
286,
1077,
274,
16,
284,
274,
5289,
13651,
7,
20,
317,
286,
2060,
10714,
10297,
82,
11,
330,
14990,
79... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_nested_textgroup() {
const FORMAT_STR: &str = "outer [middle [inner](blue)](red bold)";
let outer_style = Some(Color::Green.normal());
let middle_style = Some(Color::Red.bold());
let inner_style = Some(Color::Blue.normal());
let formatter = StringFormatter::new(FORMAT_STR).unwrap().map(empty_mapper);
let result = formatter.parse(outer_style).unwrap();
let mut result_iter = result.iter();
match_next!(result_iter, "outer ", outer_style);
match_next!(result_iter, "middle ", middle_style);
match_next!(result_iter, "inner", inner_style);
} | rust_cleaned_test_functions.jsonl/71882 | {
"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,
66279,
4326,
4074,
368,
341,
286,
733,
52225,
7159,
25,
609,
495,
284,
330,
2676,
508,
19656,
508,
4382,
9533,
12203,
7252,
7,
1151,
13939,
24023,
286,
1077,
15955,
15117,
284,
4329,
15028,
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_ticks() -> Result<()> {
let input = "L.LL.LL.LL
LLLLLLL.LL
L.L.L..L..
LLLL.LL.LL
L.LL.LL.LL
L.LLLLL.LL
..L.L.....
LLLLLLLLLL
L.LLLLLL.L
L.LLLLL.LL";
let mut world = input_generator(input)?;
world.step();
let new_world = World::from_str(
"#.##.##.##
#######.##
#.#.#..#..
####.##.##
#.##.##.##
#.#####.##
..#.#.....
##########
#.######.#
#.#####.##",
)?;
assert_eq!(world, new_world);
world.step();
let new_world = World::from_str(
"#.LL.L#.##
#LLLLLL.L#
L.L.L..L..
#LLL.LL.L#
#.LL.LL.LL
#.LLLL#.##
..L.L.....
#LLLLLLLL#
#.LLLLLL.L
#.#LLLL.##",
)?;
assert_eq!(world, new_world);
world.step();
let new_world = World::from_str(
"#.##.L#.##
#L###LL.L#
L.#.#..#..
#L##.##.L#
#.##.LL.LL
#.###L#.##
..#.#.....
#L######L#
#.LL###L.L
#.#L###.##",
)?;
assert_eq!(world, new_world);
world.step();
let new_world = World::from_str(
"#.#L.L#.##
#LLL#LL.L#
L.L.L..#..
#LLL.##.L#
#.LL.LL.LL
#.LL#L#.##
..L.L.....
#L#LLLL#L#
#.LLLLLL.L
#.#L#L#.##",
)?;
assert_eq!(world, new_world);
world.step();
let new_world = World::from_str(
"#.#L.L#.##
#LLL#LL.L#
L.#.L..#..
#L##.##.L#
#.#L.LL.LL
#.#L#L#.##
..L.L.....
#L#L##L#L#
#.LLLLLL.L
#.#L#L#.##",
)?;
assert_eq!(world, new_world);
Ok(())
} | rust_cleaned_test_functions.jsonl/127659 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 898
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49961,
368,
1464,
5714,
71698,
341,
286,
1077,
1946,
284,
330,
43,
1214,
43,
1214,
43,
1214,
43,
198,
49356,
86708,
1214,
43,
198,
43,
1214,
1214,
496,
43,
33947,
49356,
1214,
43,
1214,
43,
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... | 7 |
#[test]
fn test_slice() {
let v = create_values(10);
let view: ArrayView<_> = (&v).into();
assert_eq!(view.len(), 10);
assert_eq!(view.slice(2..).len(), 8);
assert_eq!(view.slice(2..).iter().next().unwrap().value(), 2);
assert_eq!(view.slice(..8).len(), 8);
assert_eq!(view.slice(..8).iter().next().unwrap().value(), 0);
assert_eq!(view.slice(2..8).len(), 6);
assert_eq!(view.slice(2..8).iter().next().unwrap().value(), 2);
} | rust_cleaned_test_functions.jsonl/94462 | {
"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,
26488,
368,
341,
286,
1077,
348,
284,
1855,
9146,
7,
16,
15,
317,
286,
1077,
1651,
25,
2910,
851,
32399,
29,
284,
15899,
85,
568,
18122,
1428,
286,
2060,
10714,
10297,
1050,
19406,
1507,
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_program_bpf_c_dup() {
solana_logger::setup();
let GenesisConfigInfo {
genesis_config,
mint_keypair,
..
} = create_genesis_config(50);
let mut bank = Bank::new_for_tests(&genesis_config);
let (name, id, entrypoint) = solana_bpf_loader_program!();
bank.add_builtin(&name, &id, entrypoint);
let account_address = Pubkey::new_unique();
let account = AccountSharedData::new_data(42, &[1_u8, 2, 3], &system_program::id()).unwrap();
bank.store_account(&account_address, &account);
let bank_client = BankClient::new(bank);
let program_id = load_bpf_program(&bank_client, &bpf_loader::id(), &mint_keypair, "ser");
let account_metas = vec![
AccountMeta::new_readonly(account_address, false),
AccountMeta::new_readonly(account_address, false),
];
let instruction = Instruction::new_with_bytes(program_id, &[4, 5, 6, 7], account_metas);
bank_client
.send_and_confirm_instruction(&mint_keypair, instruction)
.unwrap();
} | rust_cleaned_test_functions.jsonl/5754 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 429
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25096,
880,
15897,
666,
51932,
368,
341,
262,
2048,
3362,
27413,
486,
15188,
1428,
262,
1077,
40788,
2648,
1731,
341,
286,
59366,
5332,
345,
286,
28337,
3097,
12670,
345,
286,
54538,
262,
335,
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_tpm_properties() {
let mut context = create_ctx_without_session();
let (_capabs, _more) = context
.get_capability(CapabilityType::TPMProperties, 0, 80)
.unwrap();
} | rust_cleaned_test_functions.jsonl/49684 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
5187,
25158,
368,
341,
286,
1077,
5206,
2266,
284,
1855,
15147,
39904,
12316,
1428,
286,
1077,
5453,
11346,
3435,
11,
716,
6384,
8,
284,
2266,
198,
310,
659,
455,
89686,
3025,
391,
2897,
92... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_group_the_people() {
assert_eq!(
Solution::group_the_people(vec![3, 3, 3, 3, 3, 1, 3]),
vec![vec![0, 1, 2], vec![3, 4, 6], vec![5]]
);
assert_eq!(
Solution::group_the_people(vec![2, 1, 3, 3, 3, 2]),
vec![vec![0, 5], vec![1], vec![2, 3, 4]]
);
} | rust_cleaned_test_functions.jsonl/106981 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 216
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6288,
16068,
62717,
368,
341,
286,
2060,
10714,
33673,
310,
12478,
486,
4074,
16068,
62717,
25592,
20703,
18,
11,
220,
18,
11,
220,
18,
11,
220,
18,
11,
220,
18,
11,
220,
16,
11,
220,
18,
17... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_slerp_quarter() {
let q = Quaternion::from([-0.5, 0.5, 0.5, 0.5]);
let r = Quaternion::from([0.5, 0.5, 0.5, 0.5]);
let expected = Quaternion::from([
-0.2588190451025208,
0.5576775358252053,
0.5576775358252053,
0.5576775358252053,
]);
assert_ulps_eq!(expected, q.slerp(r, 0.25));
} | rust_cleaned_test_functions.jsonl/15359 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 239
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
1536,
79,
11280,
5295,
368,
341,
286,
1077,
2804,
284,
24801,
486,
1499,
41197,
15,
13,
20,
11,
220,
15,
13,
20,
11,
220,
15,
13,
20,
11,
220,
15,
13,
20,
2558,
286,
1077,
435,
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_push_and_get() {
let mut list = List::<f64>::new();
let mut vs = vec![0.0_f64; 100];
for (count, _) in (0..100).enumerate() {
assert_eq!(list.len(), count);
for (i, v) in vs.iter().take(count).enumerate() {
assert!((list.at(i) - *v).abs() < EPSILON);
}
let k = random();
list.push(k);
vs[count] = k;
}
} | rust_cleaned_test_functions.jsonl/35055 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 263
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14218,
8378,
3062,
368,
341,
286,
1077,
5206,
1140,
284,
1759,
27638,
69,
21,
19,
6831,
931,
543,
286,
1077,
5206,
6165,
284,
7486,
20703,
15,
13,
15,
761,
21,
19,
26,
220,
16,
15,
15,
4821,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_reverse() {
let mut v = vec![10, 20];
assert_eq!(v[0], 10);
assert_eq!(v[1], 20);
v.reverse();
assert_eq!(v[0], 20);
assert_eq!(v[1], 10);
let mut v3 = Vec::<i32>::new();
v3.reverse();
assert!(v3.is_empty());
} | rust_cleaned_test_functions.jsonl/111403 | {
"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,
43277,
368,
341,
286,
1077,
5206,
348,
284,
7486,
20703,
16,
15,
11,
220,
17,
15,
935,
286,
2060,
10714,
10297,
85,
58,
15,
1125,
220,
16,
15,
317,
286,
2060,
10714,
10297,
85,
58,
16,
1125,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_object_get_property_names() {
let _setup_guard = setup();
let isolate = &mut v8::Isolate::new(Default::default());
let scope = &mut v8::HandleScope::new(isolate);
let context = v8::Context::new(scope);
let scope = &mut v8::ContextScope::new(scope, context);
let js_test_str: v8::Local<v8::Value> =
v8::String::new(scope, "test").unwrap().into();
let js_proto_test_str: v8::Local<v8::Value> =
v8::String::new(scope, "proto_test").unwrap().into();
let js_test_symbol: v8::Local<v8::Value> =
eval(scope, "Symbol('test_symbol')").unwrap();
let js_null: v8::Local<v8::Value> = v8::null(scope).into();
let js_sort_fn: v8::Local<v8::Function> = eval(scope, "Array.prototype.sort")
.unwrap()
.try_into()
.unwrap();
{
let obj = v8::Object::new(scope);
obj.set(scope, js_test_str, js_null);
let proto_obj = v8::Object::new(scope);
proto_obj.set(scope, js_proto_test_str, js_null);
obj.set_prototype(scope, proto_obj.into());
let own_props = obj.get_own_property_names(scope).unwrap();
assert_eq!(own_props.length(), 1);
assert!(own_props.get_index(scope, 0).unwrap() == js_test_str);
let proto_props = proto_obj.get_own_property_names(scope).unwrap();
assert_eq!(proto_props.length(), 1);
assert!(proto_props.get_index(scope, 0).unwrap() == js_proto_test_str);
let all_props = obj.get_property_names(scope).unwrap();
js_sort_fn.call(scope, all_props.into(), &[]).unwrap();
assert_eq!(all_props.length(), 2);
assert!(all_props.get_index(scope, 0).unwrap() == js_proto_test_str);
assert!(all_props.get_index(scope, 1).unwrap() == js_test_str);
}
{
let obj = v8::Object::new(scope);
obj.set(scope, js_test_str, js_null);
obj.set(scope, js_test_symbol, js_null);
let own_props = obj.get_own_property_names(scope).unwrap();
assert_eq!(own_props.length(), 1);
assert!(own_props.get_index(scope, 0).unwrap() == js_test_str);
}
} | rust_cleaned_test_functions.jsonl/1222 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 841
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5314,
3062,
16638,
9187,
368,
341,
220,
1077,
716,
15188,
36796,
284,
6505,
543,
220,
1077,
42123,
284,
609,
6984,
348,
23,
486,
3872,
33066,
486,
931,
87874,
486,
2258,
5231,
220,
1077,
6891,
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_validate_internal_consistency() {
let (tx, _, _) = create_tx(5000.into(), 15.into(), 1, 2, 1, 4);
let factories = CryptoFactories::default();
assert!(tx.validate_internal_consistency(&factories, None).is_ok());
} | rust_cleaned_test_functions.jsonl/56569 | {
"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,
42681,
23472,
31971,
47094,
368,
341,
286,
1077,
320,
3998,
11,
8358,
27439,
284,
1855,
17805,
7,
20,
15,
15,
15,
39860,
1507,
220,
16,
20,
39860,
1507,
220,
16,
11,
220,
17,
11,
220,
16,
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_from_param() {
let uuid_str = "c1aa1e3b-9614-4895-9ebd-705255fa5bc2";
let uuid_wrapper = Uuid::from_param(uuid_str.into()).unwrap();
assert_eq!(uuid_str, uuid_wrapper.to_string())
} | rust_cleaned_test_functions.jsonl/60745 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 123
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
4090,
368,
341,
286,
1077,
16040,
2895,
284,
330,
66,
16,
5305,
16,
68,
18,
65,
12,
24,
21,
16,
19,
12,
19,
23,
24,
20,
12,
24,
3065,
67,
12,
22,
15,
20,
17,
20,
20,
3632,
20,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bad_length_at_end_is_ignored() {
let mut log = new_record_test();
log.write("foo");
log.shrink_size(1);
assert_eq!(EOF, log.read());
assert_eq!(0, log.dropped_bytes());
assert_eq!("", log.reported_msg());
} | rust_cleaned_test_functions.jsonl/46692 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34199,
5118,
3752,
6213,
6892,
62,
58471,
368,
341,
286,
1077,
5206,
1487,
284,
501,
14192,
4452,
543,
286,
1487,
3836,
445,
7975,
797,
286,
1487,
2395,
34365,
2368,
7,
16,
317,
286,
2060,
10714... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_should_panic() {
fn f() {
panic!();
}
let desc = TestDescAndFn {
desc: TestDesc {
name: StaticTestName("whatever"),
ignore: false,
should_panic: ShouldPanic::Yes,
allow_fail: false,
},
testfn: DynTestFn(Box::new(f)),
};
let (tx, rx) = channel();
run_test(&TestOpts::new(), false, desc, tx);
let (_, res, _) = rx.recv().unwrap();
assert!(res == TrOk);
} | rust_cleaned_test_functions.jsonl/3484 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 317
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43378,
620,
31270,
368,
341,
286,
5168,
282,
368,
341,
310,
21975,
0,
543,
286,
456,
286,
1077,
6560,
284,
3393,
11065,
3036,
24911,
341,
310,
6560,
25,
3393,
11065,
341,
394,
829,
25,
23105,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lore_seeker_db() -> Result<(), DbError> {
let db = Db::from_sets_dir("/opt/git/github.com/fenhl/lore-seeker/master/data/sets")?;
test_indicator(&db, "Ancient Elemental", ColorSet::rainbow());
test_indicator(&db, "Awaken the Nameless", ColorSet::blue());
Ok(())
} | rust_cleaned_test_functions.jsonl/118260 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5560,
265,
3453,
51216,
8685,
368,
1464,
5714,
68843,
11988,
1454,
29,
341,
286,
1077,
2927,
284,
11988,
486,
1499,
21289,
4334,
4283,
2912,
60590,
71120,
905,
6663,
268,
17958,
14,
20156,
7806,
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... | 2 |
#[test]
fn test_timeout_expired() {
Runtime::builder()
.build()
.expect("build runtime failed")
.block_on(async {
let err = timeout(
Duration::from_secs(1),
futures_util::future::pending::<()>(),
)
.await
.unwrap_err();
assert_eq!(err.kind(), ErrorKind::TimedOut)
})
} | rust_cleaned_test_functions.jsonl/16035 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 278
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20537,
80221,
368,
341,
286,
10954,
486,
17850,
741,
310,
659,
5834,
741,
310,
659,
17119,
445,
5834,
15592,
4641,
1138,
310,
659,
4574,
4470,
18285,
341,
394,
1077,
1848,
284,
9632,
1006,
503,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_insert_slots() {
test_insert_data_shreds_slots("test_insert_data_shreds_slots_single", false);
test_insert_data_shreds_slots("test_insert_data_shreds_slots_bulk", true);
} | rust_cleaned_test_functions.jsonl/7599 | {
"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,
17678,
54161,
368,
341,
286,
1273,
17678,
1769,
3712,
53369,
54161,
445,
1944,
17678,
1769,
3712,
53369,
54161,
19487,
497,
895,
317,
286,
1273,
17678,
1769,
3712,
53369,
54161,
445,
1944,
17678,
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 |
#[test]
fn test_point_mul_by_node_index() -> ThresholdEcdsaResult<()> {
for curve in EccCurveType::all() {
let g = EccPoint::generator_g(curve)?;
for node_index in 0..300 {
let g_ni = g.mul_by_node_index(node_index)?;
let scalar = EccScalar::from_node_index(curve, node_index);
let g_s = g.scalar_mul(&scalar)?;
assert_eq!(g_s, g_ni);
}
}
Ok(())
} | rust_cleaned_test_functions.jsonl/39321 | {
"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,
6085,
24944,
3710,
5084,
3560,
368,
1464,
58079,
36,
4385,
9081,
2077,
71698,
341,
262,
369,
15655,
304,
80660,
31325,
929,
486,
541,
368,
341,
286,
1077,
342,
284,
80660,
2609,
486,
35851,
1889,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_decimal2str() {
let d = Decimal::of(0.00001, 5);
let actual = decimal2str(&d);
assert_eq!(actual, "0.00001".to_string());
} | rust_cleaned_test_functions.jsonl/120425 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 75
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74429,
17,
495,
368,
341,
262,
1077,
294,
284,
26728,
486,
1055,
7,
15,
13,
15,
15,
15,
15,
16,
11,
220,
20,
317,
262,
1077,
5042,
284,
12122,
17,
495,
2099,
67,
317,
262,
2060,
10714,
102... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_expand_bug() {
let items = string_vec_to_status(&[
"a/b/c",
"a/b2/d",
]);
//0 a/
//1 b/
//2 c
//3 b2/
//4 d
let mut res = StatusTree::default();
res.update(&items).unwrap();
res.collapse(&String::from("b"), 1);
res.collapse(&String::from("a"), 0);
assert_eq!(
get_visibles(&res),
vec![
true,
false,
false,
false,
false,
]
);
res.expand(&String::from("a"), 0);
assert_eq!(
get_visibles(&res),
vec![
true,
true,
false,
true,
true,
]
);
} | rust_cleaned_test_functions.jsonl/34459 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 595
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67875,
73232,
368,
341,
286,
1077,
3589,
284,
914,
13251,
2346,
4773,
2099,
9640,
310,
330,
64,
3470,
2899,
497,
2303,
310,
330,
64,
3470,
17,
3446,
497,
715,
286,
22712,
286,
442,
15,
264,
58... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vec_list_pack_to_empty() {
let mut list: VecList<i32> = VecList::with_capacity(5);
list.pack_to(0);
assert_eq!(list.capacity(), 0);
} | rust_cleaned_test_functions.jsonl/11552 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 93
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
2019,
32995,
2346,
15124,
368,
341,
286,
1077,
5206,
1140,
25,
11312,
852,
21897,
18,
17,
29,
284,
11312,
852,
486,
4197,
35603,
7,
20,
317,
286,
1140,
20807,
2346,
7,
15,
317,
286,
206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_foldr_non_consuming() {
let h = hlist![1, false, 42f32];
let folder = hlist![
|acc, &i| i + acc,
|acc, &_| if acc > 42f32 { 9000 } else { 0 },
|acc, &f| f + acc
];
let folded = h.to_ref().foldr(folder, 1f32);
assert_eq!(folded, 9001)
} | rust_cleaned_test_functions.jsonl/41568 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 193
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
61187,
81,
21637,
3382,
61117,
368,
341,
286,
1077,
305,
284,
305,
1607,
20703,
16,
11,
895,
11,
220,
19,
17,
69,
18,
17,
935,
286,
1077,
8527,
284,
305,
1607,
90515,
310,
760,
4475,
11,
609... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_vars_in_scope() {
let mut ss = ScopeStack::new();
// No vars initially
assert_eq!(ss.vars_in_scope().len(), 0);
// Add two vars to current scope
ss.set("a", Value::from("1"));
ss.set("b", Value::from("2"));
assert_eq!(ss.vars_in_scope().len(), 2);
assert!(ss.vars_in_scope().contains(&Value::from("a")));
assert!(ss.vars_in_scope().contains(&Value::from("b")));
// Push a scope; no vars initially
ss.push();
assert_eq!(ss.vars_in_scope().len(), 0);
// Add a var
ss.set("c", Value::from("3"));
assert_eq!(ss.vars_in_scope().len(), 1);
assert!(ss.vars_in_scope().contains(&Value::from("c")));
// Upvar a var
ss.upvar(0, "a");
assert_eq!(ss.vars_in_scope().len(), 2);
assert!(ss.vars_in_scope().contains(&Value::from("a")));
// Pop a scope
ss.pop();
assert_eq!(ss.vars_in_scope().len(), 2);
assert!(!ss.vars_in_scope().contains(&Value::from("c")));
// Unset a var
ss.unset("b");
assert_eq!(ss.vars_in_scope().len(), 1);
assert!(!ss.vars_in_scope().contains(&Value::from("b")));
} | rust_cleaned_test_functions.jsonl/80373 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 624
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11168,
1243,
23199,
368,
341,
286,
1077,
5206,
10870,
284,
34920,
4336,
486,
931,
543,
286,
442,
2308,
19942,
15102,
198,
286,
2060,
10714,
10297,
778,
59628,
1243,
23199,
1005,
2892,
1507,
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_recognize_four() {
let tail: &[u8] = &[0x61, 0xF0, 0x90, 0x86, 0x92, 0x0d, 0x0a, 0x0d, 0x0a];
let mut full = AsyncBuffer::new(format!("GET /first HTTP/1.1\r\n{}", std::str::from_utf8(tail).unwrap()));
let result = block_on(async { recognize(&mut full).await });
assert!(result.is_ok())
} | rust_cleaned_test_functions.jsonl/48185 | {
"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,
7080,
3934,
551,
56142,
368,
341,
220,
1077,
9787,
25,
44590,
84,
23,
60,
284,
44590,
15,
87,
21,
16,
11,
220,
15,
9770,
15,
11,
220,
15,
87,
24,
15,
11,
220,
15,
87,
23,
21,
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_message_type() {
let eh = ExtensionHeader::new();
assert_eq!(eh.extension_header_type() as u8, ExtensionHeaderType::SuspendReq as u8)
} | rust_cleaned_test_functions.jsonl/127870 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 79
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6462,
1819,
368,
341,
286,
1077,
35246,
284,
26473,
4047,
486,
931,
543,
286,
2060,
10714,
10297,
2636,
40475,
8757,
1819,
368,
438,
575,
23,
11,
26473,
4047,
929,
486,
50,
12758,
27234,
438,
57... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_dns_header() -> Result<(), String> {
let query = &Vec::from(BASIC_QUERY);
let dns_header = DnsHeader::parse(query)?;
assert_eq!(dns_header.id, 0x24B1);
assert!(!dns_header.qr);
assert_eq!(dns_header.opcode, DNS_OPCODE_QUERY);
assert!(!dns_header.aa);
assert!(!dns_header.tc);
assert!(dns_header.rd);
assert!(dns_header.ra);
assert_eq!(dns_header.z, 0);
assert_eq!(dns_header.rcode, DNS_RCODE_NO_ERROR);
assert_eq!(dns_header.qdcount, 1);
assert_eq!(dns_header.ancount, 0);
assert_eq!(dns_header.nscount, 0);
assert_eq!(dns_header.arcount, 0);
Ok(())
} | rust_cleaned_test_functions.jsonl/120288 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 387
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
71125,
8757,
368,
1464,
5714,
68843,
923,
29,
341,
286,
1077,
3239,
284,
609,
10050,
486,
1499,
5349,
44659,
31585,
317,
286,
1077,
44077,
8757,
284,
422,
4412,
4047,
486,
6400,
10741,
8972... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_stage_channels() {
let cache = InMemoryCache::new();
let stage_instance = StageInstance {
channel_id: ChannelId(1),
discoverable_disabled: true,
guild_id: GuildId(2),
id: StageId(3),
privacy_level: PrivacyLevel::GuildOnly,
topic: "topic".into(),
};
cache.update(&StageInstanceCreate(stage_instance.clone()));
{
let cached_instances = cache
.guild_stage_instances(stage_instance.guild_id)
.unwrap();
assert_eq!(1, cached_instances.len());
}
{
let cached_instance = cache.stage_instance(stage_instance.id).unwrap();
assert_eq!(stage_instance.topic, cached_instance.topic);
}
let new_stage_instance = StageInstance {
topic: "a new topic".into(),
..stage_instance
};
cache.update(&StageInstanceUpdate(new_stage_instance.clone()));
{
let cached_instance = cache.stage_instance(stage_instance.id).unwrap();
assert_ne!(stage_instance.topic, cached_instance.topic);
assert_eq!(new_stage_instance.topic, "a new topic");
}
cache.update(&StageInstanceDelete(new_stage_instance));
{
let cached_instances = cache
.guild_stage_instances(stage_instance.guild_id)
.unwrap();
assert_eq!(0, cached_instances.len());
}
{
let cached_instance = cache.stage_instance(stage_instance.id);
assert_eq!(cached_instance, None);
}
} | rust_cleaned_test_functions.jsonl/112086 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 816
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35238,
19291,
368,
341,
286,
1077,
6500,
284,
758,
10642,
8233,
486,
931,
1428,
286,
1077,
6430,
11904,
284,
22112,
2523,
341,
310,
5496,
842,
25,
13434,
764,
7,
16,
1326,
310,
6997,
480,
51401,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_controller_client() {
let rt = Runtime::new().unwrap();
rt.spawn(run_server());
let config = ClientConfigBuilder::default()
.connection_type(ConnectionType::Mock(MockType::Happy))
.controller_uri(PravegaNodeUri::from("127.0.0.2:9091".to_string()))
.build()
.unwrap();
let controller = ControllerClientImpl::new(config.clone(), &rt.handle());
let scope = Scope {
name: "scope".to_string(),
};
// test create scope
let res = rt
.block_on(controller.create_scope(&scope))
.expect("create scope");
assert!(res);
// test create stream
let scoped_stream = ScopedStream {
scope: scope.clone(),
stream: Stream {
name: "stream".to_string(),
},
};
let stream_config = StreamConfiguration {
scoped_stream: scoped_stream.clone(),
scaling: Scaling {
scale_type: ScaleType::FixedNumSegments,
target_rate: 0,
scale_factor: 0,
min_num_segments: 0,
},
retention: Retention {
retention_type: RetentionType::None,
retention_param: 0,
},
tags: None,
};
let res = rt
.block_on(controller.create_stream(&stream_config))
.expect("create stream");
assert!(res);
// test update stream
let res = rt
.block_on(controller.update_stream(&stream_config))
.expect("update stream");
assert!(res);
// test truncate stream
let cut = StreamCut {
scoped_stream: scoped_stream.clone(),
segment_offset_map: HashMap::new(),
};
let res = rt
.block_on(controller.truncate_stream(&cut))
.expect("truncate stream");
assert!(res);
// test seal stream
let res = rt
.block_on(controller.seal_stream(&scoped_stream))
.expect("seal stream");
assert!(res);
// test delete stream
let res = rt
.block_on(controller.delete_stream(&scoped_stream))
.expect("delete stream");
assert!(res);
// test get current segments
let res = rt
.block_on(controller.get_current_segments(&scoped_stream))
.expect("get current segments");
assert!(res.key_segment_map.is_empty());
// test get epoch segments
let scoped_segment = ScopedSegment {
scope: scope.clone(),
stream: Stream {
name: "stream".to_string(),
},
segment: Segment {
number: 0,
tx_id: None,
},
};
let res = rt
.block_on(controller.get_endpoint_for_segment(&scoped_segment))
.expect("get epoch segments");
assert_eq!(
res,
PravegaNodeUri {
0: "127.0.0.1:9090".to_string()
}
);
// test get head segments
let res = rt
.block_on(controller.get_head_segments(&scoped_stream))
.expect("get head segments");
assert!(res.is_empty());
// test get successors
let res = rt
.block_on(controller.get_successors(&scoped_segment))
.expect("get successors segments");
assert!(res.segment_with_predecessors.is_empty());
// test scale
let segments = vec![];
let ranges = vec![];
rt.block_on(controller.scale_stream(&scoped_stream, &segments, &ranges))
.expect("scale");
// test check scale
let res = rt
.block_on(controller.check_scale(&scoped_stream, 0))
.expect("check scale");
assert!(res);
// test get endpoint
let uri = rt
.block_on(controller.get_endpoint_for_segment(&scoped_segment))
.expect("get node uri");
assert_eq!(
uri,
PravegaNodeUri {
0: "127.0.0.1:9090".to_string()
}
);
// test create transaction
let res = rt
.block_on(controller.create_transaction(&scoped_stream, Duration::from_secs(1)))
.expect("create transaction");
assert!(res.stream_segments.key_segment_map.is_empty());
// test commit transaction
rt.block_on(controller.commit_transaction(
&scoped_stream,
TxId { 0: 0 },
WriterId { 0: 0 },
Timestamp { 0: 0 },
))
.expect("commit transaction");
// test abort transaction
rt.block_on(controller.abort_transaction(&scoped_stream, TxId { 0: 0 }))
.expect("abort transaction");
// test ping transaction
let res = rt
.block_on(controller.ping_transaction(&scoped_stream, TxId { 0: 0 }, Duration::from_secs(1)))
.expect("ping transaction");
assert_eq!(res, PingStatus::Ok);
// test check transaction status
let res = rt
.block_on(controller.check_transaction_status(&scoped_stream, TxId { 0: 0 }))
.expect("check transaction status");
assert_eq!(res, TransactionStatus::Open);
// test create scope
let res = rt
.block_on(controller.create_scope(&scope))
.expect("create scope");
assert!(res);
// test delete scope
let res = rt
.block_on(controller.delete_scope(&scope))
.expect("delete scope");
assert!(res);
// test get delegation token
let res = rt
.block_on(controller.get_or_refresh_delegation_token_for(scoped_stream))
.expect("get delegation token");
assert_eq!(res, "123".to_string());
// test list streams
let res = rt
.block_on(controller.list_streams(&scope, &CToken::empty()))
.expect("list streams");
let expected_stream = ScopedStream {
scope,
stream: Stream {
name: String::from("s1"),
},
};
assert_eq!(res, Some((vec![expected_stream], CToken::from("123"))))
} | rust_cleaned_test_functions.jsonl/123995 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3217
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21600,
8179,
368,
341,
286,
1077,
16677,
284,
10954,
486,
931,
1005,
15454,
543,
286,
16677,
59296,
38772,
12015,
5231,
286,
1077,
2193,
284,
8423,
2648,
3297,
486,
2258,
741,
310,
659,
7742,
1819... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_node_read_index() {
setup_for_test();
let wrequest_ctx = b"somedata".to_vec();
let wrs = vec![ReadState {
index: 2u64,
request_ctx: wrequest_ctx.clone(),
}];
let s = new_storage();
let mut raw_node = new_raw_node(1, vec![], 10, 1, s.clone(), vec![new_peer(1)]);
let rd = raw_node.ready();
s.wl().append(rd.entries()).expect("");
raw_node.advance(rd);
raw_node.campaign().expect("");
loop {
let rd = raw_node.ready();
s.wl().append(rd.entries()).expect("");
if rd.ss().map_or(false, |ss| ss.leader_id == raw_node.raft.id) {
raw_node.advance(rd);
raw_node.read_index(wrequest_ctx.clone());
break;
}
raw_node.advance(rd);
}
// ensure the read_states can be read out
assert!(!raw_node.raft.read_states.is_empty());
assert!(raw_node.has_ready());
let rd = raw_node.ready();
assert_eq!(rd.read_states(), wrs.as_slice());
s.wl().append(&rd.entries()).expect("");
raw_node.advance(rd);
// ensure raft.read_states is reset after advance
assert!(!raw_node.has_ready());
assert!(raw_node.raft.read_states.is_empty());
} | rust_cleaned_test_functions.jsonl/2059 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 584
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16067,
5084,
6443,
3560,
368,
341,
262,
6505,
5478,
4452,
543,
262,
1077,
289,
2035,
15147,
284,
293,
40787,
24139,
459,
3263,
983,
13251,
543,
262,
1077,
3112,
82,
284,
7486,
20703,
4418,
1397,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_parsing_after_editing_beginning_of_code() {
let mut parser = Parser::new();
parser.set_language(get_language("javascript")).unwrap();
let mut code = b"123 + 456 * (10 + x);".to_vec();
let mut tree = parser.parse(&code, None).unwrap();
assert_eq!(
tree.root_node().to_sexp(),
concat!(
"(program (expression_statement (binary_expression ",
"left: (number) ",
"right: (binary_expression left: (number) right: (parenthesized_expression ",
"(binary_expression left: (number) right: (identifier)))))))",
)
);
perform_edit(
&mut tree,
&mut code,
&Edit {
position: 3,
deleted_length: 0,
inserted_text: b" || 5".to_vec(),
},
);
let mut recorder = ReadRecorder::new(&code);
let tree = parser
.parse_with(&mut |i, _| recorder.read(i), Some(&tree))
.unwrap();
assert_eq!(
tree.root_node().to_sexp(),
concat!(
"(program (expression_statement (binary_expression ",
"left: (number) ",
"right: (binary_expression ",
"left: (number) ",
"right: (binary_expression ",
"left: (number) ",
"right: (parenthesized_expression (binary_expression left: (number) right: (identifier))))))))",
)
);
assert_eq!(recorder.strings_read(), vec!["123 || 5 "]);
} | rust_cleaned_test_functions.jsonl/15866 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 685
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
28598,
19844,
13156,
287,
23338,
1229,
3575,
4136,
368,
341,
262,
1077,
5206,
6729,
284,
21102,
486,
931,
543,
262,
6729,
980,
29021,
5433,
29021,
445,
14073,
15197,
15454,
1428,
262,
1077,
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_parsing_with_a_timeout_and_implicit_reset() {
allocations::record(|| {
let mut parser = Parser::new();
parser.set_language(get_language("javascript")).unwrap();
parser.set_timeout_micros(5);
let tree = parser.parse(
"[\"ok\", 1, 2, 3, 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]",
None,
);
assert!(tree.is_none());
// the previous partial parse.
parser.set_language(get_language("json")).unwrap();
parser.set_timeout_micros(0);
let tree = parser.parse(
"[null, 1, 2, 3, 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]",
None,
).unwrap();
assert_eq!(
tree.root_node()
.named_child(0)
.unwrap()
.named_child(0)
.unwrap()
.kind(),
"null"
);
});
} | rust_cleaned_test_functions.jsonl/15872 | {
"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,
620,
28598,
6615,
4306,
20537,
8378,
62,
30940,
18983,
368,
341,
262,
69642,
486,
8548,
79453,
341,
286,
1077,
5206,
6729,
284,
21102,
486,
931,
543,
286,
6729,
980,
29021,
5433,
29021,
445,
14073... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_monkey() {
assert_decompressed_input_matches_output(include_bytes!("../../testdata/monkey.compressed"),
include_bytes!("../../testdata/monkey"),
65536,
65536);
} | rust_cleaned_test_functions.jsonl/26452 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 196
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20737,
792,
368,
341,
220,
2060,
2259,
45703,
5898,
38344,
7645,
77863,
12524,
17223,
2748,
92425,
14,
96016,
905,
14318,
4461,
14265,
2924,
12524,
17223,
2748,
92425,
14,
96016,
4461,
14265,
220,
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 |
#[test]
fn test_real_consts() {
let pi: f32 = Float::pi();
let two_pi: f32 = Float::two_pi();
let frac_pi_2: f32 = Float::frac_pi_2();
let frac_pi_3: f32 = Float::frac_pi_3();
let frac_pi_4: f32 = Float::frac_pi_4();
let frac_pi_6: f32 = Float::frac_pi_6();
let frac_pi_8: f32 = Float::frac_pi_8();
let frac_1_pi: f32 = Float::frac_1_pi();
let frac_2_pi: f32 = Float::frac_2_pi();
let frac_2_sqrtpi: f32 = Float::frac_2_sqrtpi();
let sqrt2: f32 = Float::sqrt2();
let frac_1_sqrt2: f32 = Float::frac_1_sqrt2();
let e: f32 = Float::e();
let log2_e: f32 = Float::log2_e();
let log10_e: f32 = Float::log10_e();
let ln_2: f32 = Float::ln_2();
let ln_10: f32 = Float::ln_10();
assert_approx_eq!(two_pi, 2f32 * pi);
assert_approx_eq!(frac_pi_2, pi / 2f32);
assert_approx_eq!(frac_pi_3, pi / 3f32);
assert_approx_eq!(frac_pi_4, pi / 4f32);
assert_approx_eq!(frac_pi_6, pi / 6f32);
assert_approx_eq!(frac_pi_8, pi / 8f32);
assert_approx_eq!(frac_1_pi, 1f32 / pi);
assert_approx_eq!(frac_2_pi, 2f32 / pi);
assert_approx_eq!(frac_2_sqrtpi, 2f32 / pi.sqrt());
assert_approx_eq!(sqrt2, 2f32.sqrt());
assert_approx_eq!(frac_1_sqrt2, 1f32 / 2f32.sqrt());
assert_approx_eq!(log2_e, e.log2());
assert_approx_eq!(log10_e, e.log10());
assert_approx_eq!(ln_2, 2f32.ln());
assert_approx_eq!(ln_10, 10f32.ln());
} | rust_cleaned_test_functions.jsonl/124476 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 871
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15266,
48530,
368,
341,
286,
1077,
8938,
25,
282,
18,
17,
284,
13001,
486,
2493,
543,
286,
1077,
1378,
47771,
25,
282,
18,
17,
284,
13001,
486,
19789,
47771,
543,
286,
1077,
53676,
47771,
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_single_quote() {
assert_eq!(eval(r#"'1><2' + '3<>4'"#), Ok(to_value("1><23<>4")));
assert_eq!(eval(r#"'1==2' + '3--4'"#), Ok(to_value("1==23--4")));
assert_eq!(eval(r#"'1!=2' + '3>>4'"#), Ok(to_value("1!=23>>4")));
assert_eq!(eval(r#"'!=1<>2' + '3>>4'"#), Ok(to_value("!=1<>23>>4")));
} | rust_cleaned_test_functions.jsonl/28417 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 206
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19487,
45236,
368,
341,
286,
2060,
10714,
10297,
14170,
2601,
2,
20584,
16,
1784,
17,
6,
488,
364,
18,
21122,
19,
14913,
2,
701,
7622,
12186,
3142,
445,
16,
1784,
17,
18,
21122,
19,
17621,
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_suppress_non_maximum_matches_reference_implementation() {
fn prop(image: GrayTestImage) -> TestResult {
let expected = suppress_non_maximum_reference(&image.0, 3);
let actual = suppress_non_maximum(&image.0, 3);
match pixel_diff_summary(&actual, &expected) {
None => TestResult::passed(),
Some(err) => TestResult::error(err),
}
}
quickcheck(prop as fn(GrayTestImage) -> TestResult);
} | rust_cleaned_test_functions.jsonl/47925 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 234
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23723,
1873,
21637,
93581,
38344,
25433,
62,
14369,
368,
341,
286,
5168,
2004,
10075,
25,
23366,
2271,
1906,
8,
1464,
3393,
2077,
341,
310,
1077,
3601,
284,
27222,
21637,
93581,
25433,
2099,
1805,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_check_jira_refs_checks_all_commits() {
let git = MockGithub::new();
let pr = new_pr("Do stuff");
let commits = vec![
new_commit("Do stuff"),
new_commit("Fix [CLIENT-123] whoops, add jira ref"),
];
let projects = vec!["SERVER".into(), "CLIENT".into()];
expect_pass(&git, &pr);
jira::check_jira_refs(&pr, &commits, &projects, &git);
} | rust_cleaned_test_functions.jsonl/35649 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 178
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
5374,
8832,
60638,
75797,
5705,
25149,
1199,
368,
341,
262,
1077,
16345,
284,
14563,
78717,
486,
931,
1428,
262,
1077,
548,
284,
501,
5294,
445,
5404,
6259,
797,
262,
1077,
41535,
284,
7486,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_description_multi() {
let subcommand = Subcommand::Add {
modification: Modification {
description: DescriptionMod::Set(s!("foo bar")),
..Default::default()
},
};
assert_eq!(
Subcommand::parse(argv!["add", "foo", "bar"]).unwrap(),
(&EMPTY[..], subcommand)
);
} | rust_cleaned_test_functions.jsonl/84273 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 209
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
11448,
25133,
368,
341,
286,
1077,
1186,
5631,
284,
3719,
5631,
486,
2212,
341,
310,
17030,
25,
73855,
341,
394,
4008,
25,
7662,
4459,
486,
1649,
1141,
17223,
7975,
3619,
30154,
394,
5241,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_try_from_record_for_header_with_no_version(
) -> Result<(), record::value::TryFromIteratorError> {
let record = Record::new(
record::Kind::Header,
record::Value::try_from_iter([("SO", "coordinate")])?,
);
assert_eq!(
Header::try_from(record),
Err(TryFromRecordError::MissingRequiredTag(Tag::Version))
);
Ok(())
} | rust_cleaned_test_functions.jsonl/14305 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 207
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
5673,
14192,
5478,
8757,
6615,
6536,
9438,
1006,
262,
873,
1464,
5714,
68843,
3255,
486,
957,
486,
21453,
3830,
11951,
1454,
29,
341,
286,
1077,
3255,
284,
13583,
486,
931,
1006,
310,
3255,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_parse_log_level() {
#[derive(Serialize, Deserialize, Debug)]
struct LevelHolder {
#[serde(with = "log_level_serde")]
v: Level,
}
let legal_cases = vec![
("critical", Level::Critical),
("error", Level::Error),
("warning", Level::Warning),
("debug", Level::Debug),
("trace", Level::Trace),
("info", Level::Info),
];
for (serialized, deserialized) in legal_cases {
let holder = LevelHolder { v: deserialized };
let res_string = toml::to_string(&holder).unwrap();
let exp_string = format!("v = \"{}\"\n", serialized);
assert_eq!(res_string, exp_string);
let res_value: LevelHolder = toml::from_str(&exp_string).unwrap();
assert_eq!(res_value.v, deserialized);
}
let compatibility_cases = vec![("warn", Level::Warning)];
for (serialized, deserialized) in compatibility_cases {
let variant_string = format!("v = \"{}\"\n", serialized);
let res_value: LevelHolder = toml::from_str(&variant_string).unwrap();
assert_eq!(res_value.v, deserialized);
}
let illegal_cases = vec!["foobar", ""];
for case in illegal_cases {
let string = format!("v = \"{}\"\n", case);
toml::from_str::<LevelHolder>(&string).unwrap_err();
}
} | rust_cleaned_test_functions.jsonl/16566 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 715
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
5224,
8274,
368,
341,
286,
11506,
27098,
3759,
9050,
11,
48440,
11,
11091,
5563,
286,
2036,
9395,
8589,
341,
310,
11506,
47024,
16980,
284,
330,
839,
8274,
75861,
450,
5422,
310,
348,
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... | 6 |
#[test]
fn test_report_installation_error() {
block_on(async {
let config = config_generator();
let response = json!({"response":{
"server": "prod",
"protocol": "3.0",
"app": [{
"appid": "{00000000-0000-0000-0000-000000000001}",
"status": "ok",
"updatecheck": {
"status": "ok"
}
}],
}});
let response = serde_json::to_vec(&response).unwrap();
let http = MockHttpRequest::new(hyper::Response::new(response.into()));
let mut state_machine = StateMachine::new(
StubPolicyEngine,
http,
StubInstaller { should_fail: true },
&config,
StubTimer,
StubMetricsReporter,
Rc::new(Mutex::new(MemStorage::new())),
make_test_app_set(),
)
.await;
let response = do_update_check(&mut state_machine).await.unwrap();
assert_eq!(Action::InstallPlanExecutionError, response.app_responses[0].result);
let request_params = RequestParams::default();
let mut request_builder = RequestBuilder::new(&config, &request_params);
let event = Event {
event_type: EventType::UpdateComplete,
errorcode: Some(EventErrorCode::Installation),
..Event::default()
};
let apps = state_machine.app_set.to_vec().await;
request_builder = request_builder.add_event(&apps[0], &event);
assert_request(state_machine.http, request_builder).await;
});
} | rust_cleaned_test_functions.jsonl/94215 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 911
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14813,
34245,
367,
4096,
368,
341,
286,
2504,
4470,
18285,
341,
310,
1077,
2193,
284,
2193,
25813,
543,
310,
1077,
2033,
284,
2951,
0,
16864,
2322,
12602,
1060,
330,
4030,
788,
330,
19748,
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_array_literal_containing_spread() {
test("([...c])", "[...c]");
test("([4, ...c, a])", "[...c]");
test("([foo(), ...c, bar()])", "[foo(), ...c, bar()]");
test("([...a, b, ...c])", "[...a, ...c]");
test("([...b, ...c])", "[...b, ...c]");
} | rust_cleaned_test_functions.jsonl/471 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
34100,
10260,
2056,
10123,
878,
368,
341,
262,
1273,
445,
82466,
66,
2467,
497,
10545,
1112,
66,
37389,
262,
1273,
445,
2561,
19,
11,
2503,
66,
11,
264,
2467,
497,
10545,
1112,
66,
37389,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_interfaces() {
assert_to_bytes!(
Interfaces {
types: vec![Type {
inputs: vec![InterfaceType::S8],
outputs: vec![InterfaceType::S16],
}],
imports: vec![Import {
namespace: "ab",
name: "c",
signature_type: 0,
}],
adapters: vec![Adapter {
function_type: 0,
instructions: vec![Instruction::ArgumentGet { index: 1 }],
}],
exports: vec![Export {
name: "ab",
function_type: 1,
}],
implementations: vec![Implementation {
core_function_type: 2,
adapter_function_type: 3,
}],
},
&[
0x00, // type section
0x01, // 1 type
0x01, // list of 1 item
0x00, // S8
0x01, // list of 1 item
0x01, // S16
0x01, // import section
0x01, // 1 import
0x02, // string of 2 bytes
0x61, 0x62,
0x01, // string of 1 byte
0x63, // "c"
0x00, // signature type
0x02, // adapter section
0x01, // 1 adapter
0x00, // function type
0x01, // list of 1 item
0x00, 0x01, // ArgumentGet { index: 1 }
0x03, // export section
0x01, // 1 export
0x02, // string of 2 bytes
0x61, 0x62,
0x01, // function type
0x04, // implementation section
0x01, // 1 implementation
0x02, // core function type
0x03, // adapter function type
]
);
} | rust_cleaned_test_functions.jsonl/132567 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1333
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
72960,
368,
341,
286,
2060,
2346,
12524,
33673,
310,
79857,
341,
394,
4494,
25,
7486,
20703,
929,
341,
503,
11127,
25,
7486,
20703,
5051,
929,
486,
50,
23,
1259,
503,
16275,
25,
7486,
20703,
505... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_url_for_external() {
let req = HttpRequest::default();
let mut resource = ResourceHandler::<()>::default();
resource.name("index");
let routes = vec![(
Resource::external("youtube", "https://youtube.com/watch/{video_id}"),
None,
)];
let (router, _) = Router::new::<()>("", ServerSettings::default(), routes);
assert!(!router.has_route("https://youtube.com/watch/unknown"));
let req = req.with_state(Rc::new(()), router);
let url = req.url_for("youtube", &["oHg5SJYRHA0"]);
assert_eq!(
url.ok().unwrap().as_str(),
"https://youtube.com/watch/oHg5SJYRHA0"
);
} | rust_cleaned_test_functions.jsonl/50139 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 346
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2903,
5478,
47432,
368,
341,
286,
1077,
4232,
284,
44049,
486,
2258,
1428,
286,
1077,
5206,
5101,
284,
11765,
3050,
27638,
368,
6831,
2258,
543,
286,
5101,
2644,
445,
1252,
797,
286,
1077,
11291,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_chrono_datetime_from_timestamp_seconds() {
let datetime_from_timestamp: DateTime<Utc> = Timestamp::Seconds(2).into();
assert_eq!(
Utc.timestamp_nanos(
(2 * MILLIS_PER_SECOND * NANOS_PER_MILLI)
.try_into()
.unwrap()
),
datetime_from_timestamp
)
} | rust_cleaned_test_functions.jsonl/105315 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 228
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4138,
2248,
78,
28943,
5673,
23073,
34825,
368,
341,
286,
1077,
8874,
5673,
23073,
25,
6520,
36397,
10413,
29,
284,
32758,
486,
15343,
7,
17,
568,
18122,
543,
286,
2060,
10714,
33673,
310,
547,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_no_newline_output() {
fn run(args: &[&str]) -> Assert {
bin().with_args(&["--no-newline"]).with_args(args)
}
// No args
run(&[])
.stdout()
.is("")
.stdout()
.doesnt_contain("\n")
.unwrap();
// One arg
run(&["Hello"])
.stdout()
.is("Hello")
.stdout()
.doesnt_contain("Hello\n")
.unwrap();
// Two args
run(&["Hello", "World"])
.stdout()
.is("Hello World")
.stdout()
.doesnt_contain("Hello World\n")
.unwrap();
} | rust_cleaned_test_functions.jsonl/89787 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 331
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
5921,
1056,
7645,
368,
341,
262,
5168,
1598,
7356,
25,
44590,
5,
495,
2467,
1464,
5319,
341,
286,
9544,
1005,
4197,
8384,
2099,
1183,
313,
2152,
22269,
1056,
45014,
4197,
8384,
7356,
340,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_front() {
let mut ring = VecDeque::new();
ring.push_back(10);
ring.push_back(20);
assert_eq!(ring.front(), Some(&10));
ring.pop_front();
assert_eq!(ring.front(), Some(&20));
ring.pop_front();
assert_eq!(ring.front(), None);
} | rust_cleaned_test_functions.jsonl/73725 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22926,
368,
341,
262,
1077,
5206,
10058,
284,
11312,
73891,
486,
931,
543,
262,
10058,
2552,
3895,
7,
16,
15,
317,
262,
10058,
2552,
3895,
7,
17,
15,
317,
262,
2060,
10714,
10297,
12640,
23445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_instruction_packing() {
let mint_address = Pubkey::new_unique();
let destination_token_address = Pubkey::new_unique();
let original_create = VestingInstruction::Create {
seeds: [50u8; 32],
schedules: vec![Schedule {
amount: 42,
release_time: 250,
}],
mint_address: mint_address.clone(),
destination_token_address,
};
let packed_create = original_create.pack();
let unpacked_create = VestingInstruction::unpack(&packed_create).unwrap();
assert_eq!(original_create, unpacked_create);
let original_unlock = VestingInstruction::Unlock { seeds: [50u8; 32] };
assert_eq!(
original_unlock,
VestingInstruction::unpack(&original_unlock.pack()).unwrap()
);
let original_init = VestingInstruction::Init {
number_of_schedules: 42,
seeds: [50u8; 32],
};
assert_eq!(
original_init,
VestingInstruction::unpack(&original_init.pack()).unwrap()
);
let original_change = VestingInstruction::ChangeDestination { seeds: [50u8; 32] };
assert_eq!(
original_change,
VestingInstruction::unpack(&original_change.pack()).unwrap()
);
} | rust_cleaned_test_functions.jsonl/25479 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 645
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54923,
620,
8985,
368,
341,
286,
1077,
28337,
6744,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
9106,
6458,
6744,
284,
22611,
792,
486,
931,
21218,
1428,
286,
1077,
4024,
8657,
284,
55888,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sugiyama_layout() {
let mut graph = Graph::new();
let a1 = graph.add_node("a1");
let a2 = graph.add_node("a2");
let a3 = graph.add_node("a3");
let b1 = graph.add_node("b1");
let b2 = graph.add_node("b2");
let b3 = graph.add_node("b3");
let c1 = graph.add_node("c1");
let c2 = graph.add_node("c2");
let c3 = graph.add_node("c3");
let d1 = graph.add_node("d1");
let d2 = graph.add_node("d2");
let d3 = graph.add_node("d3");
graph.add_edge(a1, b2, "");
graph.add_edge(a2, b1, "");
graph.add_edge(a3, b1, "");
graph.add_edge(b1, c1, "");
graph.add_edge(b2, c1, "");
graph.add_edge(b2, c2, "");
graph.add_edge(b2, c3, "");
graph.add_edge(b3, c2, "");
graph.add_edge(c1, d3, "");
graph.add_edge(c2, d1, "");
graph.add_edge(c2, d2, "");
let sugiyama_layout = SugiyamaLayout::new();
let result = sugiyama_layout.call(&graph);
for u in result.node_indices() {
println!("{} {}", result[u].x, result[u].y);
}
} | rust_cleaned_test_functions.jsonl/87837 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 641
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
768,
16220,
3029,
14466,
368,
341,
286,
1077,
5206,
4771,
284,
12165,
486,
931,
543,
286,
1077,
264,
16,
284,
4771,
1364,
5084,
445,
64,
16,
797,
286,
1077,
264,
17,
284,
4771,
1364,
5084... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_read_file() {
// Debug-Ausgabe:
let currentWD = env::current_dir().unwrap();
println!("Current Directory: {}", currentWD.display());
let mut content:String = String::new();
let mut filename:String;
filename = currentWD.display().to_string();
filename.push_str("/doc/language_reference.txt");
filehandler::read_file(&filename, &mut content);
assert!(content.starts_with("=== "));
} | rust_cleaned_test_functions.jsonl/61935 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
2458,
368,
341,
220,
442,
11091,
6691,
355,
61229,
510,
220,
1077,
1482,
17563,
284,
6105,
486,
3231,
4334,
1005,
15454,
543,
220,
13751,
17223,
5405,
18033,
25,
24689,
1482,
17563,
8181,
52... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_backspace_should_not_decrease_column_count_past_zero() {
new_ucmd!()
.arg("-w2")
.pipe_in("1\x08\x083456")
.succeeds()
.stdout_is("1\x08\x0834\n56");
} | rust_cleaned_test_functions.jsonl/23292 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3895,
8746,
43378,
7913,
2259,
19947,
8744,
3180,
93019,
19359,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
858,
13645,
86,
17,
1138,
286,
659,
13768,
1243,
445,
16,
3462,
15,
23,
3462,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_minutely() {
let expression = "@minutely";
let schedule = Schedule::from_str(expression).expect("Failed to parse @minutely.");
let starting_date = Utc.ymd(2017, 2, 25).and_hms(23, 59, 36);
let mut events = schedule.after(&starting_date);
events.next().unwrap();
assert_eq!(
Utc.ymd(2017, 2, 26).and_hms(00, 01, 00),
events.next().unwrap()
);
assert_eq!(
Utc.ymd(2017, 2, 26).and_hms(0, 02, 00),
events.next().unwrap()
);
assert_eq!(
Utc.ymd(2017, 2, 26).and_hms(0, 03, 00),
events.next().unwrap()
);
} | rust_cleaned_test_functions.jsonl/50817 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 368
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7260,
97366,
368,
341,
286,
1077,
7493,
284,
8428,
1065,
97366,
876,
286,
1077,
9700,
284,
23512,
486,
1499,
2895,
48330,
568,
17119,
445,
9408,
311,
4715,
569,
1065,
97366,
7320,
286,
1077,
5916,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_double_drop() {
struct TwoVec<T> {
x: Soa2<T, T>,
y: Soa2<T, T>,
}
let (mut c0, mut c1, mut c2, mut c3) = (0, 0, 0, 0);
{
let mut tv =
TwoVec {
x: Soa2::new(),
y: Soa2::new(),
};
tv.x.push(
(DropCounter { count: &mut c0 },
DropCounter { count: &mut c1 }));
tv.y.push(
(DropCounter { count: &mut c2 },
DropCounter { count: &mut c3 }));
drop(tv.x);
}
assert_eq!(c0, 1);
assert_eq!(c1, 1);
assert_eq!(c2, 1);
assert_eq!(c3, 1);
} | rust_cleaned_test_functions.jsonl/121397 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 397
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24598,
29584,
368,
341,
262,
2036,
9043,
10050,
3125,
29,
341,
286,
856,
25,
2055,
64,
17,
3125,
11,
350,
12520,
286,
379,
25,
2055,
64,
17,
3125,
11,
350,
12520,
262,
555,
262,
1077,
320,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cast_decimal_to_decimal() -> Result<()> {
let array = vec![1234, 2222, 3, 4000, 5000];
let decimal_array = array
.iter()
.map(|v| Some(*v))
.collect::<DecimalArray>()
.with_precision_and_scale(10, 3)?;
generic_decimal_to_other_test_cast!(
decimal_array,
DataType::Decimal(10, 3),
DecimalArray,
DataType::Decimal(20, 6),
vec![
Some(1_234_000_i128),
Some(2_222_000_i128),
Some(3_000_i128),
Some(4_000_000_i128),
Some(5_000_000_i128),
None,
],
DEFAULT_DATAFUSION_CAST_OPTIONS
);
let decimal_array = array
.iter()
.map(|v| Some(*v))
.collect::<DecimalArray>()
.with_precision_and_scale(10, 3)?;
generic_decimal_to_other_test_cast!(
decimal_array,
DataType::Decimal(10, 3),
DecimalArray,
DataType::Decimal(10, 2),
vec![
Some(123_i128),
Some(222_i128),
Some(0_i128),
Some(400_i128),
Some(500_i128),
None,
],
DEFAULT_DATAFUSION_CAST_OPTIONS
);
Ok(())
} | rust_cleaned_test_functions.jsonl/57551 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 876
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5303,
74429,
2346,
74429,
368,
1464,
5714,
71698,
341,
286,
1077,
1334,
284,
7486,
20703,
16,
17,
18,
19,
11,
220,
17,
17,
17,
17,
11,
220,
18,
11,
220,
19,
15,
15,
15,
11,
220,
20,
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... | 3 |
#[test]
fn test_fx18_set_sound() {
let mut machine = Machine::new(TestContext::new());
machine.register_set(0xA, 4);
machine.test_opcode(0xFA18);
// Should set the sound timer value in VX
assert_eq!(machine.sound_timer, 4);
// Should increment program counter by two
assert_eq!(machine.pc, PC_BEGIN + 2);
} | rust_cleaned_test_functions.jsonl/127973 | {
"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,
62691,
16,
23,
2602,
37676,
368,
341,
262,
1077,
5206,
5662,
284,
12960,
486,
931,
31159,
1972,
486,
931,
1423,
262,
5662,
9929,
2602,
7,
15,
14673,
11,
220,
19,
317,
262,
5662,
5958,
71319,
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_run_fonts_ascii_build() {
let c = RunFonts::new().ascii("Arial");
let b = c.build();
assert_eq!(
str::from_utf8(&b).unwrap(),
r#"<w:rFonts w:ascii="Arial" />"#
);
} | rust_cleaned_test_functions.jsonl/117549 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14007,
71502,
50238,
20801,
368,
341,
286,
1077,
272,
284,
6452,
55369,
486,
931,
1005,
23324,
445,
24555,
797,
286,
1077,
293,
284,
272,
13239,
543,
286,
2060,
10714,
33673,
310,
607,
486,
1499,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fn_signature_two_args_second() {
let info = call_info(
r#"fn foo(x: u32, y: u32) -> u32 {x + y}
fn bar() { foo(3, <|>); }"#,
);
assert_eq!(info.parameters(), ["x: u32", "y: u32"]);
assert_eq!(info.active_parameter, Some(1));
} | rust_cleaned_test_functions.jsonl/55347 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 163
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15246,
39859,
23241,
8384,
29644,
368,
341,
286,
1077,
3546,
284,
1618,
3109,
1006,
310,
435,
55543,
8822,
15229,
2075,
25,
575,
18,
17,
11,
379,
25,
575,
18,
17,
8,
1464,
575,
18,
17,
314,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_error_response_new_json_serialization() -> Result<()> {
let response = ErrorResponse::new(501, "The endpoint is not implemented");
let json = serde_json::to_string(&response)?;
let deserialized: Response = serde_json::from_str(&json)?;
assert_eq!(deserialized.status_code, 501);
assert_eq!(deserialized.message, "The endpoint is not implemented");
Ok(())
} | rust_cleaned_test_functions.jsonl/5304 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4096,
9655,
5921,
9455,
25602,
2022,
368,
1464,
5714,
71698,
341,
286,
1077,
2033,
284,
95724,
486,
931,
7,
20,
15,
16,
11,
330,
785,
14887,
374,
537,
11537,
797,
286,
1077,
2951,
284,
61570,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_ror_mem() {
let code = vec![0x66, 0x02];
let mut nes = Cpu::new();
let mut memory = new_memory(code);
memory.set(0x02, 0x4B);
nes.C = 1;
nes.next(&mut memory).unwrap();
assert_eq!(0xa5, memory.get(0x02));
assert_eq!(1, nes.N);
assert_eq!(0, nes.Z);
assert_eq!(1, nes.C);
} | rust_cleaned_test_functions.jsonl/38696 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 222
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
269,
12976,
368,
341,
286,
1077,
2038,
284,
7486,
20703,
15,
87,
21,
21,
11,
220,
15,
87,
15,
17,
935,
286,
1077,
5206,
308,
288,
284,
356,
5584,
486,
931,
543,
286,
1077,
5206,
4938,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cond_1() {
// cond in BFS is same as conde
let query = proto_vulcan_query!(|q| {
cond {
member(q, [1, 2, 3]),
member(q, [4, 5, 6]),
member(q, [7, 8, 9]),
}
});
let mut iter = query.run();
assert_eq!(iter.next().unwrap().q, 1);
assert_eq!(iter.next().unwrap().q, 4);
assert_eq!(iter.next().unwrap().q, 2);
assert_eq!(iter.next().unwrap().q, 7);
assert_eq!(iter.next().unwrap().q, 3);
assert_eq!(iter.next().unwrap().q, 5);
assert_eq!(iter.next().unwrap().q, 8);
assert_eq!(iter.next().unwrap().q, 6);
assert_eq!(iter.next().unwrap().q, 9);
assert!(iter.next().is_none());
} | rust_cleaned_test_functions.jsonl/32313 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 434
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24433,
62,
16,
368,
341,
286,
442,
9756,
304,
90351,
374,
1852,
438,
390,
450,
198,
286,
1077,
3239,
284,
18433,
2273,
360,
4814,
5738,
10297,
91,
80,
91,
341,
310,
9756,
341,
394,
4462,
10583... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_os_str_len() {
let mut os_string = OsString::new();
assert_eq!(0, os_string.len());
os_string.push("abc");
assert_eq!(3, os_string.len());
os_string.clear();
assert_eq!(0, os_string.len());
} | rust_cleaned_test_functions.jsonl/105025 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29387,
2895,
6043,
368,
341,
286,
1077,
5206,
2643,
3904,
284,
15433,
703,
486,
931,
543,
286,
2060,
10714,
10297,
15,
11,
2643,
3904,
19406,
5231,
286,
2643,
3904,
2552,
445,
13683,
797,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decls() {
assert_eq!(declaration(&b"void "[..]), Done(&b" "[..], Decl::Void));
assert_eq!(declaration(&b"int foo;"[..]), Done(&b";"[..], Decl::named("foo", Type::Int)));
assert_eq!(declaration(&b"int foo[123] "[..]),
Done(&b" "[..], Decl::named("foo",
Type::Array(Box::new(Type::Int), Value::Const(123)))));
assert_eq!(declaration(&b"int foo<123> "[..]),
Done(&b" "[..], Decl::named("foo",
Type::Flex(Box::new(Type::Int), Some(Value::Const(123))))));
assert_eq!(declaration(&b"int foo<> "[..]),
Done(&b" "[..], Decl::named("foo",
Type::Flex(Box::new(Type::Int), None))));
assert_eq!(declaration(&b"int *foo "[..]),
Done(&b" "[..], Decl::named("foo",
Type::Option(Box::new(Type::Int)))));
assert_eq!(declaration(&b"opaque foo[123] "[..]),
Done(&b" "[..], Decl::named("foo",
Type::Array(Box::new(Type::Opaque), Value::Const(123)))));
assert_eq!(declaration(&b"opaque foo<123> "[..]),
Done(&b" "[..], Decl::named("foo",
Type::Flex(Box::new(Type::Opaque), Some(Value::Const(123))))));
assert_eq!(declaration(&b"opaque foo<> "[..]),
Done(&b" "[..], Decl::named("foo",
Type::Flex(Box::new(Type::Opaque), None))));
assert_eq!(declaration(&b"string foo<123> "[..]),
Done(&b" "[..], Decl::named("foo",
Type::Flex(Box::new(Type::String), Some(Value::Const(123))))));
assert_eq!(declaration(&b"string foo<> "[..]),
Done(&b" "[..], Decl::named("foo",
Type::Flex(Box::new(Type::String), None))));
} | rust_cleaned_test_functions.jsonl/11385 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1094
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2259,
18074,
368,
341,
262,
2060,
10714,
10297,
80383,
2099,
65,
1,
1004,
10545,
496,
9719,
27357,
2099,
65,
1,
10545,
496,
1125,
31625,
486,
35882,
3237,
262,
2060,
10714,
10297,
80383,
2099,
65,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_grep_line() {
let source = into_source(
vec![" bin/node/cli/src/command.rs:127:1: let PartialComponents { client, task_manager, ..}"]
);
let query = "PartialComponents";
run_test(source, query, Some(2), 64);
} | rust_cleaned_test_functions.jsonl/81789 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 155
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1889,
9995,
6528,
368,
341,
286,
1077,
2530,
284,
1119,
10347,
1006,
286,
7486,
0,
1183,
170,
252,
101,
9544,
37211,
82604,
13437,
83205,
25638,
25,
16,
17,
22,
25,
16,
25,
3502,
1077,
24552,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cast() {
assert_ulps_eq!(Matrix2::new(0.2f64, 1.5, 4.7, 2.3).cast().unwrap(), Matrix2::new(0.2f32, 1.5, 4.7, 2.3));
assert_ulps_eq!(Matrix3::new(
0.2f64, 1.5, 4.7,
2.3, 5.7, 2.1,
4.6, 5.2, 6.6,
).cast().unwrap(), Matrix3::new(
0.2f32, 1.5, 4.7,
2.3, 5.7, 2.1,
4.6, 5.2, 6.6,
));
assert_ulps_eq!(Matrix4::new(
0.2f64, 1.5, 4.7, 2.5,
2.3, 5.7, 2.1, 1.1,
4.6, 5.2, 6.6, 0.2,
3.2, 1.8, 0.4, 2.9,
).cast().unwrap(), Matrix4::new(
0.2f32, 1.5, 4.7, 2.5,
2.3, 5.7, 2.1, 1.1,
4.6, 5.2, 6.6, 0.2,
3.2, 1.8, 0.4, 2.9,
));
} | rust_cleaned_test_functions.jsonl/105471 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 593
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5303,
368,
341,
286,
2060,
61039,
1690,
10714,
10297,
6689,
17,
486,
931,
7,
15,
13,
17,
69,
21,
19,
11,
220,
16,
13,
20,
11,
220,
19,
13,
22,
11,
220,
17,
13,
18,
568,
3829,
1005,
15454... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_country_fails() {
// Setup environment
let mut exec = fasync::TestExecutor::new().expect("Failed to create an executor");
let test_values = test_setup();
let (phy, mut phy_stream) = fake_phy();
let phy_id = 10u16;
test_values.phys.insert(phy_id, phy);
// Initiate a QueryPhy request. The returned future should not be able
// to produce a result immediately
let req_fut = super::get_country(&test_values.phys, phy_id);
pin_mut!(req_fut);
assert_eq!(Poll::Pending, exec.run_until_stalled(&mut req_fut));
assert_variant!(exec.run_until_stalled(&mut phy_stream.next()),
Poll::Ready(Some(Ok(fidl_dev::PhyRequest::GetCountry { responder }))) => {
// Pretend to be a WLAN PHY to return the result.
responder.send(&mut Err(zx::Status::NOT_SUPPORTED.into_raw()))
.expect("failed to send the response to GetCountry");
}
);
assert_variant!(exec.run_until_stalled(&mut req_fut), Poll::Ready(Err(_)));
} | rust_cleaned_test_functions.jsonl/20597 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 532
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
28106,
761,
6209,
368,
341,
286,
442,
18626,
4573,
198,
286,
1077,
5206,
3883,
284,
282,
7692,
486,
2271,
25255,
486,
931,
1005,
17119,
445,
9408,
311,
1855,
458,
31558,
797,
286,
1077,
12... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_meta_doc_comments_non_latin() {
parse_macro(
r#"
macro_rules! foo {
($(#[$ i:meta])+) => (
$(#[$ i])+
fn bar() {}
)
}
"#,
).
assert_expand_items(
r#"foo! {
/// 錦瑟無端五十弦,一弦一柱思華年。
/**
莊生曉夢迷蝴蝶,望帝春心託杜鵑。
*/
}"#,
"# [doc = \" 錦瑟無端五十弦,一弦一柱思華年。\"] # [doc = \"\\\\n 莊生曉夢迷蝴蝶,望帝春心託杜鵑。\\\\n \"] fn bar () {}",
);
} | rust_cleaned_test_functions.jsonl/28743 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 454
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13381,
18869,
30359,
21637,
907,
14768,
368,
341,
262,
4715,
58810,
1006,
286,
435,
2,
698,
286,
18072,
21407,
0,
15229,
341,
310,
1711,
32735,
3442,
600,
25,
5490,
2467,
36197,
589,
2399,
394,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_empty_pubkey_msg() {
// test-vector generated via the following go code:
//package main
//import (
// "fmt"
// "github.com/tendermint/go-amino"
// "github.com/tendermint/tendermint/crypto"
// "github.com/tendermint/tendermint/privval"
// Output:
let want = vec![0x4, 0xcb, 0x94, 0xd6, 0x20];
let msg = PubKeyRequest {};
let mut got = vec![];
let _have = msg.encode(&mut got);
assert_eq!(got, want);
match PubKeyRequest::decode(want.as_ref()) {
Ok(have) => assert_eq!(have, msg),
Err(err) => panic!(err.to_string()),
}
} | rust_cleaned_test_functions.jsonl/22291 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 546
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
34014,
792,
6483,
368,
341,
286,
442,
1273,
65192,
7907,
4566,
279,
2701,
728,
2038,
510,
16885,
286,
442,
1722,
1887,
8945,
286,
442,
474,
2399,
286,
442,
197,
21871,
698,
1789,
286,
442... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_groupby_on_lists() -> Result<()> {
let s0 = Series::new("", [1i32, 2, 3]);
let s1 = Series::new("groups", [4i32, 5]);
let mut builder = ListPrimitiveChunkedBuilder::<i32>::new("arrays", 10, 10, DataType::Int32);
builder.append_series(&s0);
builder.append_series(&s1);
let s2 = builder.finish().into_series();
let df = DataFrame::new(vec![s1, s2])?;
let out = df
.clone()
.lazy()
.groupby([col("groups")])
.agg([col("arrays").first()])
.collect()?;
assert_eq!(
out.column("arrays")?.dtype(),
&DataType::List(Box::new(DataType::Int32))
);
let out = df
.clone()
.lazy()
.groupby([col("groups")])
.agg([col("arrays").list()])
.collect()?;
assert_eq!(
out.column("arrays")?.dtype(),
&DataType::List(Box::new(DataType::List(Box::new(DataType::Int32))))
);
Ok(())
} | rust_cleaned_test_functions.jsonl/179 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 466
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6288,
1694,
4470,
37288,
368,
1464,
5714,
71698,
341,
262,
1077,
274,
15,
284,
11131,
486,
931,
19814,
508,
16,
72,
18,
17,
11,
220,
17,
11,
220,
18,
2558,
262,
1077,
274,
16,
284,
11131,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_aead() -> Fallible<()> {
for &algo in ALL_AEAD_ALGORITHMS {
let cryptosys = LibSodiumCryptoSystem::new(algo)?;
assert!(cryptosys.aead_max_message_size() > 1024 * 1024 * 1024);
let plaintext = b"Secret payload";
let additional_data = b"some data";
let secret_key = &*cryptosys.aead_keygen();
let nonce = b"rypt\0\0\0\0\0\0\0\0";
let different_secret_key = &*cryptosys.aead_keygen();
let different_nonce = b"rypt\0\0\0\0\0\0\0\x01";
let mut mac = AEADMac::default();
let mut message = vec![0u8; plaintext.len()];
message.copy_from_slice(plaintext);
cryptosys.aead_encrypt(&mut message, additional_data, &secret_key, &nonce, &mut mac);
assert_ne!(mac, AEADMac::default());
assert_ne!(message, plaintext);
let ciphertext = message.clone();
// Check successful decryption works
cryptosys.aead_decrypt(&mut message, additional_data, &secret_key, &nonce, &mac)?;
assert_eq!(message, plaintext);
message.copy_from_slice(&ciphertext);
let res = cryptosys.aead_decrypt(
&mut message,
additional_data,
&different_secret_key,
&nonce,
&mac,
);
assert_eq!(res, Err(CryptoError::InvalidCiphertext));
// Check decryption fails when Nonce does not match
message.copy_from_slice(&ciphertext);
let res = cryptosys.aead_decrypt(
&mut message,
additional_data,
&secret_key,
&different_nonce,
&mac,
);
assert_eq!(res, Err(CryptoError::InvalidCiphertext));
// Check decryption fails when Mac is invalid
message.copy_from_slice(&ciphertext);
let mut different_mac = mac;
different_mac[0] ^= 1;
let res = cryptosys.aead_decrypt(
&mut message,
additional_data,
&secret_key,
&nonce,
&different_mac,
);
assert_eq!(res, Err(CryptoError::InvalidCiphertext));
// Check decryption fails when authenticated data is different
message.copy_from_slice(&ciphertext);
let different_additional_data = b"different data";
let res = cryptosys.aead_decrypt(
&mut message,
different_additional_data,
&secret_key,
&nonce,
&mac,
);
assert_eq!(res, Err(CryptoError::InvalidCiphertext));
}
Ok(())
} | rust_cleaned_test_functions.jsonl/49528 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1530
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4306,
3149,
368,
1464,
14785,
1238,
71698,
341,
286,
369,
609,
72464,
304,
13097,
1566,
36,
1808,
8912,
66889,
4826,
341,
310,
1077,
14436,
436,
1047,
284,
5688,
50,
46776,
58288,
2320,
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... | 4 |
#[test]
fn test_convert_object_with_implicit_keys() {
let b = ast::BaseNode::default();
let pkg = parse_package("{ a, b }");
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: Symbol::from("a"),
},
value: Expression::Identifier(IdentifierExpr {
loc: b.location.clone(),
typ: type_info(),
name: Symbol::from("a"),
}),
},
Property {
loc: b.location.clone(),
key: Identifier {
loc: b.location.clone(),
name: Symbol::from("b"),
},
value: Expression::Identifier(IdentifierExpr {
loc: b.location.clone(),
typ: type_info(),
name: Symbol::from("b"),
}),
},
],
})),
})],
}],
};
let got = test_convert(pkg).unwrap();
assert_eq!(want, got);
} | rust_cleaned_test_functions.jsonl/132517 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1479
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
5314,
6615,
62,
30940,
12631,
368,
341,
286,
1077,
293,
284,
11763,
486,
3978,
1955,
486,
2258,
543,
286,
1077,
24793,
284,
4715,
26328,
13976,
264,
11,
293,
335,
797,
286,
1077,
1366,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_split_region() {
let (mut cluster, client, ctx) = must_new_cluster_and_kv_client();
// Split region commands
let key = b"b";
let mut req = SplitRegionRequest::default();
req.set_context(ctx);
req.set_split_key(key.to_vec());
let resp = client.split_region(&req).unwrap();
assert_eq!(
Key::from_encoded(resp.get_left().get_end_key().to_vec())
.into_raw()
.unwrap()
.as_slice(),
key
);
assert_eq!(
resp.get_left().get_end_key(),
resp.get_right().get_start_key()
);
// Batch split region
let region_id = resp.get_right().get_id();
let leader = cluster.leader_of_region(region_id).unwrap();
let mut ctx = Context::default();
ctx.set_region_id(region_id);
ctx.set_peer(leader);
ctx.set_region_epoch(resp.get_right().get_region_epoch().to_owned());
let mut req = SplitRegionRequest::default();
req.set_context(ctx);
let split_keys = vec![b"e".to_vec(), b"c".to_vec(), b"d".to_vec()];
req.set_split_keys(split_keys.into());
let resp = client.split_region(&req).unwrap();
let result_split_keys: Vec<_> = resp
.get_regions()
.iter()
.map(|x| {
Key::from_encoded(x.get_start_key().to_vec())
.into_raw()
.unwrap()
})
.collect();
assert_eq!(
result_split_keys,
vec![b"b".to_vec(), b"c".to_vec(), b"d".to_vec(), b"e".to_vec()]
);
} | rust_cleaned_test_functions.jsonl/61688 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 732
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
20627,
368,
341,
262,
1077,
320,
6984,
10652,
11,
2943,
11,
5635,
8,
284,
1969,
5921,
28441,
8378,
97066,
8179,
1428,
262,
442,
27810,
5537,
11293,
198,
262,
1077,
1376,
284,
293,
1,
65,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_signature_to_asn1_der_short_encodings() {
let r_bytes = [
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01,
];
let r = NonZeroExponentP256::from_int_checked(Int256::from_bin(&r_bytes)).unwrap();
let s_bytes = [
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xFF,
];
let s = NonZeroExponentP256::from_int_checked(Int256::from_bin(&s_bytes)).unwrap();
let signature = Signature { r, s };
let expected_encoding = vec![0x30, 0x07, 0x02, 0x01, 0x01, 0x02, 0x02, 0x00, 0xFF];
assert_eq!(signature.to_asn1_der(), expected_encoding);
} | rust_cleaned_test_functions.jsonl/81732 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 586
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39859,
2346,
11898,
77,
16,
35345,
16673,
13781,
58335,
368,
341,
286,
1077,
435,
12524,
284,
2278,
310,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
11,
220,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sub() {
let two: ModInt = ModInt::from_value_modulus(BigInt::from(2), BigInt::zero());
let one: ModInt = ModInt::one();
let one2 = two - one;
assert_eq!(BigInt::from(1), one2.value);
assert_eq!(BigInt::zero(), one2.modulus);
let one3: ModInt = ModInt::one();
let one4: ModInt = ModInt::one();
let zero: ModInt = one3 - one4;
assert_eq!(BigInt::zero(), zero.value);
assert_eq!(BigInt::zero(), zero.modulus);
} | rust_cleaned_test_functions.jsonl/126147 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 247
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5228,
368,
341,
286,
1077,
1378,
25,
5650,
1072,
284,
5650,
1072,
486,
1499,
3142,
7480,
19425,
5349,
343,
1072,
486,
1499,
7,
17,
701,
62608,
486,
14154,
1423,
286,
1077,
825,
25,
5650,
1072,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_allocate_mixed() {
let a = BlockArena::new();
let mut allocated = vec![];
let mut allocated_size = 0;
let n = 10000;
let mut r = rand::thread_rng();
for i in 0..n {
let size = if i % (n / 10) == 0 {
if i == 0 {
continue;
}
i
} else {
if i == 1 {
1
} else {
r.gen_range(1, i)
}
};
let ptr = if i % 2 == 0 {
a.allocate_aligned(size)
} else {
a.allocate(size)
};
unsafe {
for j in 0..size {
let np = ptr.add(j);
(*np) = (j % 256) as u8;
}
}
allocated_size += size;
allocated.push((ptr, size));
assert!(
a.memory_used() >= allocated_size,
"the memory used {} should be greater or equal to expecting allocated {}",
a.memory_used(),
allocated_size
);
}
for (ptr, size) in allocated.iter() {
unsafe {
for i in 0..*size {
let p = ptr.add(i);
assert_eq!(*p, (i % 256) as u8);
}
}
}
} | rust_cleaned_test_functions.jsonl/14862 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 924
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77078,
717,
3286,
368,
341,
286,
1077,
264,
284,
8362,
93937,
486,
931,
543,
286,
1077,
5206,
20204,
284,
7486,
0,
15078,
286,
1077,
5206,
20204,
2368,
284,
220,
15,
280,
286,
1077,
308,
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... | 9 |
#[test]
fn test_all() {
struct TestClassification {
num: u64,
result: perfect_numbers::Classification
}
let test_table: Vec<TestClassification> = vec![
TestClassification { num: 6, result: Classification::Perfect },
TestClassification { num: 28, result: Classification::Perfect },
TestClassification { num: 33550336, result: Classification::Perfect },
TestClassification { num: 12, result: Classification::Abundant },
TestClassification { num: 30, result: Classification::Abundant },
TestClassification { num: 33550335, result: Classification::Abundant },
TestClassification { num: 2, result: Classification::Deficient },
TestClassification { num: 4, result: Classification::Deficient },
TestClassification { num: 32, result: Classification::Deficient },
TestClassification { num: 33550337, result: Classification::Deficient },
TestClassification { num: 1, result: Classification::Deficient },
];
for t in test_table {
assert_eq!(classify(t.num), Ok(t.result));
}
} | rust_cleaned_test_functions.jsonl/30403 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 388
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5705,
368,
341,
262,
2036,
3393,
85040,
341,
286,
1629,
25,
575,
21,
19,
345,
286,
1102,
25,
4727,
32964,
486,
85040,
198,
262,
456,
262,
1077,
1273,
5237,
25,
11312,
27,
60100,
2404,
29,
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... | 2 |
#[test]
fn test_get_by_url_local() {
let sut = ObjectStoreRegistry::default();
let url = ListingTableUrl::parse("../").unwrap();
sut.get_by_url(&url).unwrap();
} | rust_cleaned_test_functions.jsonl/96530 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 92
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
3710,
2903,
13564,
368,
341,
286,
1077,
34212,
284,
3002,
6093,
15603,
486,
2258,
543,
286,
1077,
2515,
284,
38764,
2556,
2864,
486,
6400,
17409,
1827,
15454,
543,
286,
34212,
670,
3710,
290... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_yearly() {
let expression = "@yearly";
let schedule = Schedule::from_str(expression).expect("Failed to parse @yearly.");
let starting_date = Utc.ymd(2017, 6, 15).and_hms(14, 29, 36);
let mut events = schedule.after(&starting_date);
assert_eq!(Utc.ymd(2018, 1, 1).and_hms(0, 0, 0), events.next().unwrap());
assert_eq!(Utc.ymd(2019, 1, 1).and_hms(0, 0, 0), events.next().unwrap());
assert_eq!(Utc.ymd(2020, 1, 1).and_hms(0, 0, 0), events.next().unwrap());
} | rust_cleaned_test_functions.jsonl/50812 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 254
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14645,
398,
368,
341,
286,
1077,
7493,
284,
8428,
3157,
398,
876,
286,
1077,
9700,
284,
23512,
486,
1499,
2895,
48330,
568,
17119,
445,
9408,
311,
4715,
569,
3157,
398,
7320,
286,
1077,
5916,
41... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_zero_lamport_with_clean() {
with_create_zero_lamport(|bank| {
bank.freeze();
bank.squash();
bank.force_flush_accounts_cache();
// do clean and assert that it actually did its job
assert_eq!(3, bank.get_snapshot_storages(None).len());
bank.clean_accounts(false, false, None);
assert_eq!(2, bank.get_snapshot_storages(None).len());
});
} | rust_cleaned_test_functions.jsonl/95887 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 234
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
19359,
907,
309,
403,
6615,
19573,
368,
341,
286,
448,
8657,
19359,
907,
309,
403,
22428,
17033,
91,
341,
310,
6073,
76685,
543,
310,
6073,
514,
446,
988,
543,
310,
6073,
48194,
39213,
556... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_send_message() {
// Test Messages
let instantiate_msg = InstantiateMsg {
version: "1.0.0".to_string(),
};
let send_msg = ExecuteMsg::SendMessage {
nonce: 0,
nick: "Bob".to_string(),
text: "Hello Alice".to_string(),
};
// Instantiate Contract
let mut deps = mock_dependencies(&[]);
let env = mock_env();
let info = mock_info("addr0000", &[]);
instantiate(deps.as_mut(), env, info, instantiate_msg).unwrap();
// Send a Message
let info = mock_info("addr0000", &[]);
let result = execute(deps.as_mut(), mock_env(), info, send_msg).unwrap();
// Contract should have emitted a Msg targetting the wormhole contract.
assert_eq!(
result.messages,
vec![SubMsg::new(CosmosMsg::Wasm(WasmMsg::Execute {
contract_addr: wormhole_sdk::id().to_string(),
funds: vec![],
msg: Binary::from(&[
123, 34, 112, 111, 115, 116, 95, 109, 101, 115, 115, 97, 103, 101, 34, 58, 123,
34, 109, 101, 115, 115, 97, 103, 101, 34, 58, 34, 65, 119, 65, 65, 65, 69,
74, 118, 89, 103, 115, 65, 65, 65, 66, 73, 90, 87, 120, 115, 98, 121, 66, 66, 98,
71, 108, 106, 90, 81, 61, 61, 34, 44, 34, 110, 111, 110, 99, 101, 34, 58, 48, 125, 125
]),
}))]
);
} | rust_cleaned_test_functions.jsonl/69944 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 791
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13565,
6462,
368,
341,
286,
442,
3393,
26729,
198,
286,
1077,
40902,
6483,
284,
32288,
6611,
341,
310,
2319,
25,
330,
16,
13,
15,
13,
15,
3263,
983,
3904,
3148,
286,
3634,
286,
1077,
3624,
648... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_suback() {
let mut data: &[u8] = &[0b10010000, 3, 0, 10, 0b00000010];
match decode_slice(&mut data) {
Ok(Some(Packet::Suback(s))) => {
assert_eq!(s.pid.get(), 10);
assert_eq!(
s.return_codes.get(0),
Some(&SubscribeReturnCodes::Success(QoS::ExactlyOnce))
);
}
other => panic!("Failed decode: {:?}", other),
}
} | rust_cleaned_test_functions.jsonl/77910 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 236
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5228,
473,
368,
341,
262,
1077,
5206,
821,
25,
44590,
84,
23,
60,
284,
44590,
15,
65,
16,
15,
15,
16,
15,
15,
15,
15,
11,
220,
18,
11,
220,
15,
11,
220,
16,
15,
11,
220,
15,
65,
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_deserializer_constructor() {
let input = r#"{
"d": {
"guild_id": "1",
"role_id": "2"
},
"op": 0,
"s": 7,
"t": "GUILD_ROLE_DELETE"
}"#;
let deserializer = GatewayEventDeserializer::from_json(input).unwrap();
let mut json_deserializer = Deserializer::from_str(input);
let event = deserializer.deserialize(&mut json_deserializer).unwrap();
assert!(matches!(event, GatewayEvent::Dispatch(7, _)));
} | rust_cleaned_test_functions.jsonl/78644 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 302
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15768,
41939,
66210,
368,
341,
286,
1077,
1946,
284,
435,
55543,
515,
310,
330,
67,
788,
341,
394,
330,
57877,
842,
788,
330,
16,
756,
394,
330,
5778,
842,
788,
330,
17,
698,
310,
1153,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_benchmarks() {
ExtBuilder::default().has_stakers(false).build().execute_with(|| {
assert_ok!(test_benchmark_bond::<Test>());
assert_ok!(test_benchmark_bond_extra::<Test>());
assert_ok!(test_benchmark_unbond::<Test>());
assert_ok!(test_benchmark_withdraw_unbonded_update::<Test>());
assert_ok!(test_benchmark_withdraw_unbonded_kill::<Test>());
assert_ok!(test_benchmark_validate::<Test>());
assert_ok!(test_benchmark_nominate::<Test>());
assert_ok!(test_benchmark_chill::<Test>());
assert_ok!(test_benchmark_set_payee::<Test>());
assert_ok!(test_benchmark_set_controller::<Test>());
assert_ok!(test_benchmark_set_validator_count::<Test>());
assert_ok!(test_benchmark_force_no_eras::<Test>());
assert_ok!(test_benchmark_force_new_era::<Test>());
assert_ok!(test_benchmark_force_new_era_always::<Test>());
assert_ok!(test_benchmark_set_invulnerables::<Test>());
assert_ok!(test_benchmark_force_unstake::<Test>());
assert_ok!(test_benchmark_cancel_deferred_slash::<Test>());
assert_ok!(test_benchmark_payout_stakers_dead_controller::<Test>());
assert_ok!(test_benchmark_payout_stakers_alive_staked::<Test>());
assert_ok!(test_benchmark_rebond::<Test>());
assert_ok!(test_benchmark_set_history_depth::<Test>());
assert_ok!(test_benchmark_reap_stash::<Test>());
assert_ok!(test_benchmark_new_era::<Test>());
assert_ok!(test_benchmark_do_slash::<Test>());
assert_ok!(test_benchmark_payout_all::<Test>());
assert_ok!(test_benchmark_submit_solution_initial::<Test>());
});
} | rust_cleaned_test_functions.jsonl/120492 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 677
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
19762,
15544,
368,
341,
197,
76605,
3297,
486,
2258,
1005,
4648,
1261,
8312,
3576,
568,
5834,
1005,
10257,
6615,
79453,
341,
298,
6948,
19817,
10297,
1944,
880,
39381,
880,
2111,
27638,
2271,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.