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_type() {
assert_eq!(
crate::rsass(
"@use \"sass:meta\";\
\n$a: meta.module-functions(1);\
\n"
)
.unwrap_err(),
"Error: $module: 1 is not a string.\
\n ,\
\n2 | $a: meta.module-functions(1);\
\n | ^^^^^^^^^^^^^^^^^^^^^^^^\
\n \'\
\n input.scss 2:5 root stylesheet",
);
} | rust_cleaned_test_functions.jsonl/19719 | {
"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,
1819,
368,
341,
286,
2060,
10714,
33673,
310,
17717,
486,
5428,
395,
1006,
394,
8428,
810,
7245,
60326,
25,
5490,
2105,
55783,
1797,
1124,
77,
39562,
25,
8823,
10076,
77430,
7,
16,
61968,
1797,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_scope() {
assert!(CleanupScope::All.is_included_in(&[CleanupScope::All]));
assert!(CleanupScope::Example.is_included_in(&[CleanupScope::Example]));
assert!(CleanupScope::Example.is_included_in(&[CleanupScope::All]));
assert!(CleanupScope::Item.is_included_in(&[CleanupScope::All, CleanupScope::Item]));
assert!(CleanupScope::ItemSource.is_included_in(&[CleanupScope::Item]));
assert!(CleanupScope::ItemIcon.is_included_in(&[CleanupScope::Item]));
assert!(!CleanupScope::Item.is_included_in(&[CleanupScope::ItemSource]));
} | rust_cleaned_test_functions.jsonl/79953 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 256
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23199,
368,
341,
286,
2060,
10297,
67335,
10803,
486,
2403,
2079,
1243,
10181,
1243,
2099,
58,
67335,
10803,
486,
2403,
14382,
286,
2060,
10297,
67335,
10803,
486,
13314,
2079,
1243,
10181,
1243,
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_clear_slot_signatures() {
let sig = Signature::default();
let mut status_cache = BankStatusCache::default();
let blockhash = hash(Hash::default().as_ref());
let blockhash2 = hash(blockhash.as_ref());
status_cache.insert(&blockhash, &sig, 0, ());
status_cache.insert(&blockhash, &sig, 1, ());
status_cache.insert(&blockhash2, &sig, 1, ());
let mut ancestors0 = HashMap::new();
ancestors0.insert(0, 0);
let mut ancestors1 = HashMap::new();
ancestors1.insert(1, 0);
// Clear slot 0 related data
assert!(status_cache
.get_signature_status(&sig, &blockhash, &ancestors0)
.is_some());
status_cache.clear_slot_signatures(0);
assert!(status_cache
.get_signature_status(&sig, &blockhash, &ancestors0)
.is_none());
assert!(status_cache
.get_signature_status(&sig, &blockhash, &ancestors1)
.is_some());
assert!(status_cache
.get_signature_status(&sig, &blockhash2, &ancestors1)
.is_some());
// exists
assert!(status_cache.slot_deltas.get(&0).is_none());
assert!(status_cache.slot_deltas.get(&1).is_some());
// Clear slot 1 related data
status_cache.clear_slot_signatures(1);
assert!(status_cache.slot_deltas.is_empty());
assert!(status_cache
.get_signature_status(&sig, &blockhash, &ancestors1)
.is_none());
assert!(status_cache
.get_signature_status(&sig, &blockhash2, &ancestors1)
.is_none());
assert!(status_cache.cache.is_empty());
} | rust_cleaned_test_functions.jsonl/23950 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 828
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21811,
27563,
11172,
2789,
368,
341,
286,
1077,
8366,
284,
32232,
486,
2258,
543,
286,
1077,
5206,
2639,
11529,
284,
8547,
2522,
8233,
486,
2258,
543,
286,
1077,
2504,
8296,
284,
5175,
7,
6370,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lz4_compress_decompress_16_bytes() {
let buf = [
0x1u8, 0x2u8, 0x3u8, 0x4u8, 0x1u8, 0x2u8, 0x3u8, 0x4u8, 0x1u8, 0x2u8, 0x3u8, 0x4u8,
0x1u8, 0x2u8, 0x3u8, 0x4u8,
];
let compressed = lz4_compress(&buf).unwrap();
let mut decompressed = vec![0; buf.len()];
let sz = decompress(
&compressed,
None,
decompressed.as_mut_slice(),
Algorithm::LZ4Block,
)
.unwrap();
assert_eq!(sz, 16);
assert_eq!(&buf, decompressed.as_slice());
} | rust_cleaned_test_functions.jsonl/106793 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 369
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
907,
89,
19,
87845,
2259,
38360,
62,
16,
21,
12524,
368,
341,
286,
1077,
6607,
284,
2278,
310,
220,
15,
87,
16,
84,
23,
11,
220,
15,
87,
17,
84,
23,
11,
220,
15,
87,
18,
84,
23,
11,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_keywords()
{
let mut cursor = Cursor::new("import match");
let mut lexer = Lexer::new("");
let tokens: Vec<Token> = lexer
.read(&mut cursor)
.expect("Lexing failed")
.collect();
assert_eq!(tokens, vec![
tok(TokenKind::Indent(0), 1, 1, 1, 1),
tok(TokenKind::Import, 1, 1, 1, 6),
tok(TokenKind::Match, 1, 8, 1, 12),
tok(TokenKind::EOF, 2, 1, 2, 1),
]);
} | rust_cleaned_test_functions.jsonl/117354 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 283
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51354,
741,
262,
341,
286,
1077,
5206,
8128,
284,
28067,
486,
931,
445,
474,
2432,
797,
286,
1077,
5206,
53259,
284,
85082,
486,
931,
13056,
286,
1077,
11211,
25,
11312,
83416,
29,
284,
53259,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_select_no_relation() {
let mut ctx = ExecutionContext::local();
let df = ctx.sql("SELECT 1+1").unwrap();
let s = ctx.write_string(df).unwrap();
assert_eq!("2\n", &s);
} | rust_cleaned_test_functions.jsonl/2517 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 111
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13051,
6536,
46984,
368,
341,
286,
1077,
5206,
5635,
284,
85451,
486,
2438,
543,
286,
1077,
6764,
284,
5635,
10045,
445,
4858,
220,
16,
10,
16,
1827,
15454,
543,
286,
1077,
274,
284,
5635,
3836,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_true_lq_true() {
let text = " {% if 0 > 0 %} true {% else %} false {% endif %} ";
assert_template_result!(" false ", text);
} | rust_cleaned_test_functions.jsonl/28123 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 71
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16082,
907,
80,
16082,
368,
341,
262,
1077,
1467,
284,
330,
52261,
421,
220,
15,
861,
220,
15,
1018,
92,
830,
52261,
770,
1018,
92,
895,
52261,
12330,
1018,
92,
7620,
262,
2060,
8693,
5287,
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 |
#[test]
fn test_sub() {
let vals = vec![
("12.34", "1.234", "11.106"),
("12.34", "-1.234", "13.574"),
("1234e6", "1234e-6", "1233999999.998766"),
];
for &(x, y, z) in vals.iter() {
let mut a = BigDecimal::from_str(x).unwrap();
let b = BigDecimal::from_str(y).unwrap();
let c = BigDecimal::from_str(z).unwrap();
let d = a.clone() - b.clone();
assert_eq!(d, c);
a -= b;
assert_eq!(a, c);
}
} | rust_cleaned_test_functions.jsonl/75812 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 335
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5228,
368,
341,
286,
1077,
28356,
284,
7486,
90515,
310,
3489,
16,
17,
13,
18,
19,
497,
330,
16,
13,
17,
18,
19,
497,
330,
16,
16,
13,
16,
15,
21,
4461,
310,
3489,
16,
17,
13,
18,
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... | 2 |
#[test]
fn test_single_hand_always_wins() {
test(&["4S 5S 7H 8D JC"], &["4S 5S 7H 8D JC"])
} | rust_cleaned_test_functions.jsonl/49893 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 56
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19487,
23194,
8418,
2284,
1670,
1330,
368,
341,
262,
1273,
2099,
1183,
19,
50,
220,
20,
50,
220,
22,
39,
220,
23,
35,
60583,
7914,
609,
1183,
19,
50,
220,
20,
50,
220,
22,
39,
220,
23,
35,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_pathconf_limited() {
let path_max = pathconf("/", PathconfVar::PATH_MAX);
assert!(path_max.expect("pathconf failed").expect("PATH_MAX is unlimited") > 0);
} | rust_cleaned_test_functions.jsonl/9000 | {
"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,
2638,
6135,
907,
31511,
368,
341,
1066,
262,
1077,
1815,
6345,
284,
1815,
6135,
35460,
7933,
6135,
3962,
486,
13593,
6806,
317,
262,
2060,
10297,
2343,
6345,
25952,
445,
2343,
6135,
4641,
1827,
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 |
#[test]
fn test_regex_line() {
let mut cmd = assert_cmd::Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap();
cmd.args(&["-g", "[AB]", "sed", "s/./@/"])
.write_stdin("ABC\nDFE\nBCC\nCCA\n")
.assert()
.stdout("@BC\nDFE\n@CC\n@CA\n");
} | rust_cleaned_test_functions.jsonl/7886 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 176
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41832,
6528,
368,
341,
286,
1077,
5206,
5439,
284,
2060,
11684,
486,
4062,
486,
66715,
21816,
16978,
17223,
34,
7581,
46,
94126,
4708,
15197,
15454,
543,
286,
5439,
16365,
2099,
1183,
12,
70,
497,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_no_constructor_pod_make_unique() {
let hdr = indoc! {"
#include <stdint.h>
struct A {
uint32_t a;
};
"};
let rs = quote! {
ffi::A::make_unique();
};
run_test("", hdr, rs, &[], &["A"]);
} | rust_cleaned_test_functions.jsonl/9963 | {
"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,
6536,
66210,
85337,
28230,
21218,
368,
341,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
262,
671,
997,
366,
31435,
860,
397,
262,
2036,
362,
341,
286,
2622,
18,
17,
528,
264,
280,
262,
2605... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_remove_dbg_keep_semicolon() {
// https://github.com/rust-analyzer/rust-analyzer/issues/5129#issuecomment-651399779
// not quite though
// adding a comment at the end of the line makes
// the ast::MacroCall to include the semicolon at the end
check_assist(
remove_dbg,
r#"let res = $0dbg!(1 * 20); // needless comment"#,
r#"let res = 1 * 20; // needless comment"#,
);
} | rust_cleaned_test_functions.jsonl/13609 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
44124,
50293,
3453,
21220,
72269,
368,
341,
286,
442,
3703,
1110,
5204,
905,
7382,
590,
18883,
27165,
7382,
590,
18883,
27165,
38745,
14,
20,
16,
17,
24,
2,
11159,
6182,
12,
21,
20,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_no_documentation() {
let schema =
Schema::parse_str(r#"{"type": "enum", "name": "Coin", "symbols": ["heads", "tails"]}"#)
.unwrap();
let doc = match schema {
Schema::Enum { doc, .. } => doc,
_ => return,
};
assert!(doc.is_none());
} | rust_cleaned_test_functions.jsonl/26534 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
26231,
367,
368,
341,
286,
1077,
10802,
4035,
310,
12539,
486,
6400,
2895,
2601,
55543,
4913,
1313,
788,
330,
9018,
497,
330,
606,
788,
330,
41180,
497,
330,
67426,
788,
4383,
35810,
497,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_datetime_addassignment() {
let ymdhms = |y, m, d, h, n, s| NaiveDate::from_ymd(y, m, d).and_hms(h, n, s);
let mut date = ymdhms(2016, 10, 1, 10, 10, 10);
date += Duration::minutes(10_000_000);
assert_eq!(date, ymdhms(2035, 10, 6, 20, 50, 10));
date += Duration::days(10);
assert_eq!(date, ymdhms(2035, 10, 16, 20, 50, 10));
} | rust_cleaned_test_functions.jsonl/76822 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 212
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28943,
2891,
29951,
368,
341,
286,
1077,
379,
2277,
71,
1011,
284,
760,
88,
11,
296,
11,
294,
11,
305,
11,
308,
11,
274,
91,
12812,
533,
1916,
486,
1499,
62,
1600,
67,
7021,
11,
296,
11,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_enable_statistics() {
let mut opts = Options::default();
opts.enable_statistics();
opts.set_stats_dump_period_sec(60);
assert!(opts.get_statistics().is_some());
let opts = Options::default();
assert!(opts.get_statistics().is_none());
} | rust_cleaned_test_functions.jsonl/35262 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18988,
49569,
368,
341,
286,
1077,
5206,
12185,
284,
14566,
486,
2258,
543,
286,
12185,
28697,
49569,
543,
286,
12185,
980,
15381,
18296,
20818,
17242,
7,
21,
15,
317,
286,
2060,
10297,
10518,
670... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_elf_debug() -> Result<(), Error> {
let view = ByteView::open(fixture("linux/crash.debug"))?;
let object = Object::parse(&view)?;
insta::assert_debug_snapshot!(object, @r###"
⋮Elf(
⋮ ElfObject {
⋮ code_id: Some(
⋮ CodeId(f1c3bcc0279865fe3058404b2831d9e64135386c),
⋮ ),
⋮ debug_id: DebugId {
⋮ uuid: "c0bcc3f1-9827-fe65-3058-404b2831d9e6",
⋮ appendix: 0,
⋮ },
⋮ arch: Amd64,
⋮ kind: Debug,
⋮ load_address: 0x400000,
⋮ has_symbols: true,
⋮ has_debug_info: true,
⋮ has_unwind_info: false,
⋮ },
⋮)
"###);
Ok(())
} | rust_cleaned_test_functions.jsonl/82873 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 438
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
490,
15446,
368,
1464,
5714,
68843,
4600,
29,
341,
262,
1077,
1651,
284,
10906,
851,
486,
2508,
94886,
445,
14210,
2899,
81,
988,
7883,
2761,
37445,
262,
1077,
1633,
284,
3002,
486,
6400,
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... | 3 |
#[test]
fn test_need_to_skip_space() {
// appender can create a file inside
let dir = tempdir().unwrap();
let mut path = dir.path().to_path_buf();
path.push("appender_skip_space");
let appender = MmapedAppendOnlyFile::new(path).unwrap();
for _ in 0..(MAP_PAGE_SIZE - 1) / MAX_BLOB_SIZE as u64 {
let buf = vec![0u8; MAX_BLOB_SIZE];
appender.append(&buf).unwrap();
}
let buf = vec![0u8; MAX_BLOB_SIZE];
let pos = appender.append(&buf[..]).unwrap();
assert_eq!(pos.0, MAP_PAGE_SIZE)
} | rust_cleaned_test_functions.jsonl/114149 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 313
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71506,
2346,
44830,
14663,
368,
341,
16885,
286,
442,
906,
1659,
646,
1855,
264,
1034,
4766,
198,
286,
1077,
5419,
284,
2730,
3741,
1005,
15454,
543,
286,
1077,
5206,
1815,
284,
5419,
3875,
1005,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_set_symmetric_difference() {
let a = SgSet::from_iter([1, 2, 3, 4, 5]);
let b = SgSet::<_, 5>::from_iter([4, 5, 6, 7, 8]);
assert_eq!(
a.symmetric_difference(&b).copied().collect::<Vec<usize>>(),
vec![1, 2, 3, 6, 7, 8]
);
} | rust_cleaned_test_functions.jsonl/68246 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 151
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
26825,
15903,
47525,
368,
341,
262,
1077,
264,
284,
328,
70,
1649,
486,
1499,
11723,
2561,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
2558,
262,
1077,
293,
284,
328,
70,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_level() {
test_one("10.0.1.1:1234", "10.0.2.1", &[], "10.0.1.1");
test_one("10.0.1.1:1234", "10.0.2.1", &["10.0.2.1"], "10.0.1.1");
test_one("10.0.1.1:1234", "10.0.2.1", &["10.0.2.1/24"], "10.0.1.1");
test_one("10.0.1.1:1234", "10.0.2.1", &["10.0.1.1"], "10.0.2.1");
test_one("10.0.1.1:1234", "10.0.2.1", &["10.0.1.1/32"], "10.0.2.1");
test_one("10.0.1.1:1234", "10.0.2.1", &["10.0.1.1/24"], "10.0.2.1");
test_one("10.0.1.1:1234", "10.0.2.1", &["0.0.0.0/0"], "10.0.2.1");
} | rust_cleaned_test_functions.jsonl/18401 | {
"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,
19487,
8274,
368,
341,
286,
1273,
11667,
445,
16,
15,
13,
15,
13,
16,
13,
16,
25,
16,
17,
18,
19,
497,
330,
16,
15,
13,
15,
13,
17,
13,
16,
497,
609,
12995,
330,
16,
15,
13,
15,
13,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_readme_example_1() {
let ref a = LpInteger::new("a");
let ref b = LpInteger::new("b");
let ref c = LpInteger::new("c");
let mut problem = LpProblem::new("One Problem", LpObjective::Maximize);
problem += 10.0 * a + 20.0 * b;
problem += (500 * a + 1200 * b + 1500 * c).le(10000);
problem += (a).le(b);
let solver = CbcSolver::new();
match solver.run(&problem) {
Ok((status, res)) => {
println!("Status {:?}", status);
for (name, value) in res.iter() {
println!("value of {} = {}", name, value);
}
}
Err(msg) => println!("{}", msg),
}
let output1 = "\\ One Problem
Maximize
obj: 10 a + 20 b
Subject To
c1: 500 a + 1200 b + 1500 c <= 10000
c2: a - b <= 0
"
.to_string();
let output2 = problem.to_lp_file_format();
let output2 = output2.split("Generals").collect::<Vec<&str>>();
let output2 = output2[0];
assert_eq!(output1, output2);
} | rust_cleaned_test_functions.jsonl/19663 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 460
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
2660,
39304,
62,
16,
368,
341,
262,
1077,
2053,
264,
284,
444,
79,
3486,
486,
931,
445,
64,
797,
262,
1077,
2053,
293,
284,
444,
79,
3486,
486,
931,
445,
65,
797,
262,
1077,
2053,
272,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_provide_snap() {
let l = default_logger();
// restore the state machine from a snapshot so it has a compacted log and a snapshot
let s = new_snapshot(11, 11, vec![1, 2]); // magic number
let mut sm = new_test_raft(1, vec![1], 10, 1, new_storage(), &l);
sm.restore(s);
sm.become_candidate();
sm.become_leader();
sm.mut_prs().get_mut(2).unwrap().next_idx = sm.raft_log.first_index();
let mut m = new_message(2, 1, MessageType::MsgAppendResponse, 0);
m.index = sm.prs().get(2).unwrap().next_idx - 1;
m.reject = true;
sm.step(m).expect("");
let msgs = sm.read_messages();
assert_eq!(msgs.len(), 1);
assert_eq!(msgs[0].get_msg_type(), MessageType::MsgSnapshot);
} | rust_cleaned_test_functions.jsonl/19141 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 324
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2540,
19448,
74175,
368,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
442,
14952,
279,
1584,
5662,
504,
264,
16295,
773,
432,
702,
264,
16830,
291,
1487,
323,
264,
16295,
198,
262,
1077,
274... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rollback_hook() -> Result<()> {
let db = Connection::open_in_memory()?;
let mut called = false;
db.rollback_hook(Some(|| {
called = true;
}));
db.execute_batch("BEGIN; CREATE TABLE foo (t TEXT); ROLLBACK;")?;
assert!(called);
Ok(())
} | rust_cleaned_test_functions.jsonl/34785 | {
"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,
62,
33559,
32005,
368,
1464,
5714,
71698,
341,
286,
1077,
2927,
284,
11032,
486,
2508,
1243,
19195,
368,
69493,
286,
1077,
5206,
2598,
284,
895,
280,
286,
2927,
58011,
32005,
65405,
79453,
341,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_call_site() {
let context = Context::create();
let module = context.create_module("testing");
let builder = context.create_builder();
let void_type = context.void_type();
let fn_type = void_type.fn_type(&[], false);
let function = module.add_function("do_nothing", fn_type, None);
let call_site = builder.build_call(function, &[], "to_infinity_and_beyond");
#[cfg(not(any(feature = "llvm3-6", feature = "llvm3-7", feature = "llvm3-8")))]
assert_eq!(call_site.count_arguments(), 0);
assert!(!call_site.is_tail_call());
call_site.set_tail_call(true);
assert!(call_site.is_tail_call());
call_site.set_tail_call(false);
assert!(!call_site.is_tail_call());
assert_eq!(call_site.get_call_convention(), 0);
call_site.set_call_convention(2);
assert_eq!(call_site.get_call_convention(), 2);
call_site.set_alignment_attribute(AttributeLoc::Return, 16);
} | rust_cleaned_test_functions.jsonl/122299 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 378
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13429,
24507,
368,
341,
262,
1077,
2266,
284,
9608,
486,
3182,
543,
262,
1077,
4688,
284,
2266,
2520,
10750,
445,
8840,
797,
262,
1077,
7363,
284,
2266,
2520,
28532,
1428,
262,
1077,
737,
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_compile_vertex_shader_into_spirv() {
let mut c = Compiler::new().unwrap();
let result = c
.compile_into_spirv(VOID_MAIN, ShaderKind::Vertex, "shader.glsl", "main", None)
.unwrap();
assert!(result.len() > 20);
assert!(result.as_binary().first() == Some(&0x0723_0203));
let function_end_word: u32 = (1 << 16) | 56;
assert!(result.as_binary().last() == Some(&function_end_word));
} | rust_cleaned_test_functions.jsonl/41043 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 230
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74170,
26611,
35485,
45514,
643,
5565,
85,
368,
341,
286,
1077,
5206,
272,
284,
45631,
486,
931,
1005,
15454,
543,
286,
1077,
1102,
284,
272,
198,
310,
659,
20433,
45514,
643,
5565,
85,
7,
24053... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_synchsafe() {
assert_eq!(681570, util::synchsafe(176994));
assert_eq!(176994, util::unsynchsafe(681570));
} | rust_cleaned_test_functions.jsonl/59876 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 77
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51393,
331,
18675,
368,
341,
286,
2060,
10714,
10297,
21,
23,
16,
20,
22,
15,
11,
4094,
486,
20339,
331,
18675,
7,
16,
22,
21,
24,
24,
19,
1106,
286,
2060,
10714,
10297,
16,
22,
21,
24,
24... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_resolve_url_or_path_error() {
use url::ParseError::*;
use ModuleResolutionError::*;
let mut tests = vec![
("https://eggplant:b/c", InvalidUrl(InvalidPort)),
("https://:8080/a/b/c", InvalidUrl(EmptyHost)),
];
if cfg!(target_os = "windows") {
let p = r"\\.\c:/stuff/deno/script.ts";
tests.push((p, InvalidPath(PathBuf::from(p))));
}
for (specifier, expected_err) in tests {
let err = ModuleSpecifier::resolve_url_or_path(specifier).unwrap_err();
assert_eq!(err, expected_err);
}
} | rust_cleaned_test_functions.jsonl/59603 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 256
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77291,
2903,
8734,
2638,
4096,
368,
341,
262,
990,
2515,
486,
14463,
1454,
56162,
262,
990,
13711,
38106,
1454,
79304,
262,
1077,
5206,
7032,
284,
7486,
90515,
414,
3489,
2428,
1110,
28368,
20827,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_display_request_error() {
assert_eq!(
format!("{}", RequestError::InvalidHttpMethod("test")),
"Invalid HTTP Method: test"
);
assert_eq!(
format!("{}", RequestError::InvalidUri("test")),
"Invalid URI: test"
);
assert_eq!(
format!("{}", RequestError::InvalidHttpVersion("test")),
"Invalid HTTP Version: test"
);
assert_eq!(
format!("{}", RequestError::InvalidHeader),
"Invalid header."
);
assert_eq!(
format!("{}", RequestError::UnsupportedHeader),
"Unsupported header."
);
assert_eq!(
format!("{}", RequestError::InvalidRequest),
"Invalid request."
);
} | rust_cleaned_test_functions.jsonl/80999 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 420
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14825,
7893,
4096,
368,
341,
286,
2060,
10714,
33673,
310,
3561,
79878,
6145,
1454,
486,
7928,
2905,
3523,
445,
1944,
30154,
310,
330,
7928,
10130,
6730,
25,
1273,
698,
286,
1439,
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_not_in_invalid_string() {
let mut params = Map::new();
params.assign("in", Value::String("2".to_owned())).ok();
let mut rules = BTreeMap::new();
rules.insert("in",
vec![Rule::NotIn(vec![Value::String("2".into()), Value::U64(1)])]);
let result = validate(&rules, params);
assert!(result.is_err());
assert_eq!(*result.unwrap_err().get("in").unwrap(),
vec!["The in field must not be among the options: [\"2\", 1].".to_owned()]);
} | rust_cleaned_test_functions.jsonl/104856 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 221
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7913,
1243,
31433,
3904,
368,
341,
262,
1077,
5206,
3628,
284,
5027,
486,
931,
543,
262,
3628,
17870,
445,
258,
497,
5162,
486,
703,
445,
17,
3263,
983,
51973,
34670,
562,
1428,
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_account_data_set_data() {
let key = Pubkey::new_unique();
let (_, mut account) = make_two_accounts(&key);
assert_eq!(account.data(), &vec![0, 0]);
account.set_data(vec![1, 2]);
assert_eq!(account.data(), &vec![1, 2]);
account.set_data(vec![]);
assert_eq!(account.data().len(), 0);
} | rust_cleaned_test_functions.jsonl/48198 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 180
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13500,
1769,
2602,
1769,
368,
341,
286,
1077,
1376,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
39464,
5206,
2692,
8,
284,
1281,
23241,
55665,
2099,
792,
317,
286,
2060,
10714,
10297,
4608,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_account_ids_after_program_ids() {
solana_logger::setup();
let (genesis_config, mint_keypair) = create_genesis_config(500);
let mut bank = Bank::new(&genesis_config);
let from_pubkey = solana_sdk::pubkey::new_rand();
let to_pubkey = solana_sdk::pubkey::new_rand();
let account_metas = vec![
AccountMeta::new(from_pubkey, false),
AccountMeta::new(to_pubkey, false),
];
let instruction =
Instruction::new_with_bincode(solana_vote_program::id(), &10, account_metas);
let mut tx = Transaction::new_signed_with_payer(
&[instruction],
Some(&mint_keypair.pubkey()),
&[&mint_keypair],
bank.last_blockhash(),
);
tx.message.account_keys.push(solana_sdk::pubkey::new_rand());
bank.add_builtin(
"mock_vote",
solana_vote_program::id(),
mock_ok_vote_processor,
);
let result = bank.process_transaction(&tx);
assert_eq!(result, Ok(()));
let account = bank.get_account(&solana_vote_program::id()).unwrap();
info!("account: {:?}", account);
assert!(account.executable());
} | rust_cleaned_test_functions.jsonl/2630 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 603
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13500,
8077,
19844,
25096,
8077,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
320,
77894,
5332,
11,
28337,
3097,
12670,
8,
284,
1855,
16322,
13774,
5332,
7,
20,
15,
15,
317,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_asr_imm() {
match decode_16(0x1212) {
Instruction::ASR_imm { params, thumb32 } => {
assert!(params.rd == Reg::R2);
assert!(params.rm == Reg::R2);
assert!(params.shift_n == 8);
assert!(params.setflags == SetFlags::NotInITBlock);
assert!(!thumb32);
}
_ => {
assert!(false);
}
}
} | rust_cleaned_test_functions.jsonl/64766 | {
"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,
15227,
11898,
81,
71370,
368,
341,
1066,
262,
2432,
16895,
62,
16,
21,
7,
15,
87,
16,
17,
16,
17,
8,
341,
286,
29051,
486,
1911,
49,
71370,
314,
3628,
11,
24050,
18,
17,
335,
589,
341,
310... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_highest_card_of_all_hands_wins() {
test(
&["4D 5S 6S 8D 3C", "2S 4C 7S 9H 10H", "3S 4S 5D 6H JH"],
&["3S 4S 5D 6H JH"],
)
} | rust_cleaned_test_functions.jsonl/49895 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1523,
7504,
16888,
3575,
5705,
1523,
2844,
1670,
1330,
368,
341,
262,
1273,
1006,
286,
609,
1183,
19,
35,
220,
20,
50,
220,
21,
50,
220,
23,
35,
220,
18,
34,
497,
330,
17,
50,
220,
19,
34,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_csharp_bincode_runtime_on_simple_data() {
let (dir, _tmp) = create_test_dir("test_csharp_bincode_runtime_on_simple_data");
test_csharp_runtime_on_simple_data(dir, Runtime::Bincode);
} | rust_cleaned_test_functions.jsonl/6523 | {
"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,
666,
52917,
21816,
1851,
33232,
4470,
30015,
1769,
368,
341,
262,
1077,
320,
3741,
11,
716,
5173,
8,
284,
1855,
4452,
4334,
445,
1944,
666,
52917,
21816,
1851,
33232,
4470,
30015,
1769,
797,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_clone() {
let mut m = HashMap::new();
assert_eq!(m.len(), 0);
assert!(m.insert(1, 2).is_none());
assert_eq!(m.len(), 1);
assert!(m.insert(2, 4).is_none());
assert_eq!(m.len(), 2);
let m2 = m.clone();
assert_eq!(*m2.get(&1).unwrap(), 2);
assert_eq!(*m2.get(&2).unwrap(), 4);
assert_eq!(m2.len(), 2);
} | rust_cleaned_test_functions.jsonl/8496 | {
"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,
54742,
368,
341,
286,
1077,
5206,
296,
284,
10528,
486,
931,
543,
286,
2060,
10714,
10297,
76,
19406,
1507,
220,
15,
317,
286,
2060,
10297,
76,
7030,
7,
16,
11,
220,
17,
568,
285,
31488,
1423,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tuple_struct() -> Result<(), Error> {
combined_keys_gen!(sender_combined_key, receiver_combined_key);
let shared_key = SharedKey::generate();
#[derive(PartialEq, Debug, Serialize, Deserialize)]
struct Tuple(i16, i32, i64);
impl SerdeEncryptPublicKey for Tuple {
type S = BincodeSerializer<Self>;
}
impl SerdeEncryptSharedKey for Tuple {
type S = BincodeSerializer<Self>;
}
let msg = Tuple(42, 4242, 424242);
public_key_enc_dec_assert_eq(&msg, &sender_combined_key, &receiver_combined_key)?;
shared_key_enc_dec_assert_eq(&msg, &shared_key)?;
Ok(())
} | rust_cleaned_test_functions.jsonl/31577 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 276
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21773,
15126,
368,
1464,
5714,
68843,
4600,
29,
341,
262,
10856,
12631,
16322,
10297,
11644,
89945,
3097,
11,
13964,
89945,
3097,
317,
262,
1077,
6094,
3097,
284,
16990,
1592,
486,
19366,
1428,
262,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_ml_literal_string() {
let p = Parser::new();
assert_eq!(p.ml_literal_string(r#"'''
Abc ÑŸ
'''"#).1,
Done("", r#"
Abc ÑŸ
"#));
} | rust_cleaned_test_functions.jsonl/27410 | {
"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,
76567,
34100,
3904,
368,
341,
262,
1077,
281,
284,
21102,
486,
931,
543,
262,
2060,
10714,
10297,
79,
57409,
34100,
3904,
2601,
55543,
14687,
1920,
3680,
66,
1683,
239,
144316,
198,
1920,
11456,
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 |
#[test]
fn test_date_parser() {
setup();
let str = "2020-11-30T11:33:37.437915952Z";
let date = DateTime::parse_from_rfc3339(str);
assert!(date.is_ok());
} | rust_cleaned_test_functions.jsonl/129416 | {
"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,
4164,
18517,
368,
341,
286,
6505,
1428,
286,
1077,
607,
284,
330,
17,
15,
17,
15,
12,
16,
16,
12,
18,
15,
51,
16,
16,
25,
18,
18,
25,
18,
22,
13,
19,
18,
22,
24,
16,
20,
24,
20,
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_upgrade_enum() {
let src_code = quote! {
#[doc = "GPS fix Type"]
#[ubx_extend]
#[ubx(from, rest_reserved)]
#[repr(u8)]
#[derive(Debug, Copy, Clone)]
enum GpsFix {
NoFix = 0,
DeadReckoningOnly = 1,
Fix2D = 2,
Fix3D = 3,
GPSPlusDeadReckoning = 4,
TimeOnlyFix = 5,
}
};
let src_code = src_code.to_string();
let code: syn::ItemEnum = syn::parse_str(&src_code)
.unwrap_or_else(|err| panic_on_parse_error("test_upgrade_enum", &src_code, &err));
let tokens = extend_enum(code.ident, code.attrs, code.variants)
.unwrap_or_else(|err| panic_on_parse_error("test_upgrade_enum", &src_code, &err));
let mut reserved_fields = Vec::with_capacity(256);
let mut rev_reserved_fields = Vec::with_capacity(256);
for i in 6..=255 {
let val = i as u8;
let ident = quote::format_ident!("Reserved{}", val);
reserved_fields.push(quote! { #ident = #val });
rev_reserved_fields.push(quote! { #val => GpsFix::#ident });
}
run_compare_test(
tokens,
quote! {
#[doc = "GPS fix Type"]
#[repr(u8)]
#[derive(Debug, Copy, Clone)]
pub enum GpsFix {
NoFix = 0u8,
DeadReckoningOnly = 1u8,
Fix2D = 2u8,
Fix3D = 3u8,
GPSPlusDeadReckoning = 4u8,
TimeOnlyFix = 5u8,
#(#reserved_fields),*
}
impl GpsFix {
fn from(x: u8) -> Self {
match x {
0u8 => GpsFix::NoFix,
1u8 => GpsFix::DeadReckoningOnly,
2u8 => GpsFix::Fix2D,
3u8 => GpsFix::Fix3D,
4u8 => GpsFix::GPSPlusDeadReckoning,
5u8 => GpsFix::TimeOnlyFix,
#(#rev_reserved_fields),*
}
}
}
},
);
} | rust_cleaned_test_functions.jsonl/16495 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1250
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67794,
31054,
368,
341,
262,
1077,
2286,
4136,
284,
12641,
0,
341,
286,
11506,
5236,
284,
330,
63176,
5046,
3990,
7026,
286,
11506,
392,
87,
70265,
921,
286,
11506,
392,
87,
17016,
11,
2732,
749... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_fq2_mul_nonresidue() {
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
let nqr = Fq2 {
c0: Fq::one(),
c1: Fq::one(),
};
for _ in 0..1000 {
let mut a = Fq2::rand(&mut rng);
let mut b = a;
a.mul_by_nonresidue();
b.mul_assign(&nqr);
assert_eq!(a, b);
}
} | rust_cleaned_test_functions.jsonl/130073 | {
"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,
761,
80,
17,
24944,
21637,
416,
60607,
368,
341,
262,
1077,
5206,
28422,
284,
1599,
269,
24841,
49,
968,
486,
1499,
33809,
2561,
15,
87,
20,
83406,
21,
17,
20,
24,
11,
220,
15,
87,
23,
67,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_grades_for_several_students_are_sorted() {
let mut s = school::School::new();
s.add(2, "Aimee");
s.add(7, "Logan");
s.add(4, "Blair");
assert_eq!(s.grades(), vec!(2, 4, 7));
} | rust_cleaned_test_functions.jsonl/127488 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 111
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15682,
3452,
5478,
3453,
17539,
71644,
56855,
41277,
368,
341,
262,
1077,
5206,
274,
284,
2906,
486,
32749,
486,
931,
543,
262,
274,
1364,
7,
17,
11,
330,
32,
545,
68,
797,
262,
274,
1364,
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_time_from_json_nanoseconds() {
let schema = Schema::new(vec![Field::new(
"a",
DataType::Time64(TimeUnit::Nanosecond),
true,
)]);
let builder = ReaderBuilder::new()
.with_schema(Arc::new(schema))
.with_batch_size(64);
let mut reader: Reader<File> = builder
.build::<File>(File::open("test/data/basic_nulls.json").unwrap())
.unwrap();
let batch = reader.next().unwrap().unwrap();
assert_eq!(1, batch.num_columns());
assert_eq!(12, batch.num_rows());
let schema = reader.schema();
let batch_schema = batch.schema();
assert_eq!(schema, batch_schema);
let a = schema.column_with_name("a").unwrap();
assert_eq!(&DataType::Time64(TimeUnit::Nanosecond), a.1.data_type());
let aa = batch
.column(a.0)
.as_any()
.downcast_ref::<Time64NanosecondArray>()
.unwrap();
assert_eq!(true, aa.is_valid(0));
assert_eq!(false, aa.is_valid(1));
assert_eq!(false, aa.is_valid(2));
assert_eq!(1, aa.value(0));
assert_eq!(1, aa.value(3));
assert_eq!(5, aa.value(7));
} | rust_cleaned_test_functions.jsonl/29468 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 661
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3009,
5673,
9455,
73936,
75889,
368,
341,
286,
1077,
10802,
284,
12539,
486,
931,
25592,
20703,
1877,
486,
931,
1006,
310,
330,
64,
756,
310,
33172,
486,
1462,
21,
19,
36968,
4562,
486,
45,
276,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compress_pairs_1() {
let src = [HASH_ELEMENT; 2];
let expect = hash_2n_to_n_ret(&HASH_ELEMENT, &HASH_ELEMENT);
let mut dst = [Default::default(); 1];
hash_compress_pairs(&mut dst, &src, 1);
assert_eq!(dst, [expect]);
} | rust_cleaned_test_functions.jsonl/127334 | {
"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,
87845,
36430,
62,
16,
368,
341,
286,
1077,
2286,
284,
508,
70707,
27156,
26,
220,
17,
935,
286,
1077,
1720,
284,
5175,
62,
17,
77,
2346,
1089,
21695,
2099,
70707,
27156,
11,
609,
70707,
27156,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fail_holding_cell_htlc_upon_free_multihop() {
let chanmon_cfgs = create_chanmon_cfgs(3);
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
let mut config = test_default_channel_config();
config.channel_options.forwarding_fee_base_msat = 196;
let node_chanmgrs = create_node_chanmgrs(3, &node_cfgs, &[Some(config.clone()), Some(config.clone()), Some(config.clone())]);
let mut nodes = create_network(3, &node_cfgs, &node_chanmgrs);
let chan_0_1 = create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 100000, 95000000, InitFeatures::known(), InitFeatures::known());
let chan_1_2 = create_announced_chan_between_nodes_with_value(&nodes, 1, 2, 100000, 95000000, InitFeatures::known(), InitFeatures::known());
let logger = test_utils::TestLogger::new();
// pending_update_fee.
{
let mut feerate_lock = chanmon_cfgs[1].fee_estimator.sat_per_kw.lock().unwrap();
*feerate_lock += 20;
}
nodes[1].node.timer_tick_occurred();
check_added_monitors!(nodes[1], 1);
let events = nodes[1].node.get_and_clear_pending_msg_events();
assert_eq!(events.len(), 1);
let (update_msg, commitment_signed) = match events[0] {
MessageSendEvent::UpdateHTLCs { updates: msgs::CommitmentUpdate { ref update_fee, ref commitment_signed, .. }, .. } => {
(update_fee.as_ref(), commitment_signed)
},
_ => panic!("Unexpected event"),
};
nodes[2].node.handle_update_fee(&nodes[1].node.get_our_node_id(), update_msg.unwrap());
let mut chan_stat = get_channel_value_stat!(nodes[0], chan_0_1.2);
let channel_reserve = chan_stat.channel_reserve_msat;
let feerate = get_feerate!(nodes[0], chan_0_1.2);
// Send a payment which passes reserve checks but gets stuck in the holding cell.
let feemsat = 239;
let total_routing_fee_msat = (nodes.len() - 2) as u64 * feemsat;
let (_, our_payment_hash, our_payment_secret) = get_payment_preimage_hash!(nodes[2]);
let max_can_send = 5000000 - channel_reserve - 2*commit_tx_fee_msat(feerate, 1 + 1) - total_routing_fee_msat;
let payment_event = {
let net_graph_msg_handler = &nodes[0].net_graph_msg_handler;
let route = get_route(&nodes[0].node.get_our_node_id(), &net_graph_msg_handler.network_graph, &nodes[2].node.get_our_node_id(), Some(InvoiceFeatures::known()), None, &[], max_can_send, TEST_FINAL_CLTV, &logger).unwrap();
nodes[0].node.send_payment(&route, our_payment_hash, &Some(our_payment_secret)).unwrap();
check_added_monitors!(nodes[0], 1);
let mut events = nodes[0].node.get_and_clear_pending_msg_events();
assert_eq!(events.len(), 1);
SendEvent::from_event(events.remove(0))
};
nodes[1].node.handle_update_add_htlc(&nodes[0].node.get_our_node_id(), &payment_event.msgs[0]);
check_added_monitors!(nodes[1], 0);
commitment_signed_dance!(nodes[1], nodes[0], payment_event.commitment_msg, false);
expect_pending_htlcs_forwardable!(nodes[1]);
chan_stat = get_channel_value_stat!(nodes[1], chan_1_2.2);
assert_eq!(chan_stat.holding_cell_outbound_amount_msat, max_can_send);
// Flush the pending fee update.
nodes[2].node.handle_commitment_signed(&nodes[1].node.get_our_node_id(), commitment_signed);
let (raa, commitment_signed) = get_revoke_commit_msgs!(nodes[2], nodes[1].node.get_our_node_id());
check_added_monitors!(nodes[2], 1);
nodes[1].node.handle_revoke_and_ack(&nodes[2].node.get_our_node_id(), &raa);
nodes[1].node.handle_commitment_signed(&nodes[2].node.get_our_node_id(), &commitment_signed);
check_added_monitors!(nodes[1], 2);
// A final RAA message is generated to finalize the fee update.
let events = nodes[1].node.get_and_clear_pending_msg_events();
assert_eq!(events.len(), 1);
let raa_msg = match &events[0] {
&MessageSendEvent::SendRevokeAndACK { ref msg, .. } => {
msg.clone()
},
_ => panic!("Unexpected event"),
};
nodes[2].node.handle_revoke_and_ack(&nodes[1].node.get_our_node_id(), &raa_msg);
check_added_monitors!(nodes[2], 1);
assert!(nodes[2].node.get_and_clear_pending_msg_events().is_empty());
// nodes[1]'s ChannelManager will now signal that we have HTLC forwards to process.
let process_htlc_forwards_event = nodes[1].node.get_and_clear_pending_events();
assert_eq!(process_htlc_forwards_event.len(), 1);
match &process_htlc_forwards_event[0] {
&Event::PendingHTLCsForwardable { .. } => {},
_ => panic!("Unexpected event"),
}
nodes[1].node.process_pending_htlc_forwards();
check_added_monitors!(nodes[1], 1);
// This causes the HTLC to be failed backwards.
let fail_event = nodes[1].node.get_and_clear_pending_msg_events();
assert_eq!(fail_event.len(), 1);
let (fail_msg, commitment_signed) = match &fail_event[0] {
&MessageSendEvent::UpdateHTLCs { ref updates, .. } => {
assert_eq!(updates.update_add_htlcs.len(), 0);
assert_eq!(updates.update_fulfill_htlcs.len(), 0);
assert_eq!(updates.update_fail_malformed_htlcs.len(), 0);
assert_eq!(updates.update_fail_htlcs.len(), 1);
(updates.update_fail_htlcs[0].clone(), updates.commitment_signed.clone())
},
_ => panic!("Unexpected event"),
};
// Pass the failure messages back to nodes[0].
nodes[0].node.handle_update_fail_htlc(&nodes[1].node.get_our_node_id(), &fail_msg);
nodes[0].node.handle_commitment_signed(&nodes[1].node.get_our_node_id(), &commitment_signed);
// Complete the HTLC failure+removal process.
let (raa, commitment_signed) = get_revoke_commit_msgs!(nodes[0], nodes[1].node.get_our_node_id());
check_added_monitors!(nodes[0], 1);
nodes[1].node.handle_revoke_and_ack(&nodes[0].node.get_our_node_id(), &raa);
nodes[1].node.handle_commitment_signed(&nodes[0].node.get_our_node_id(), &commitment_signed);
check_added_monitors!(nodes[1], 2);
let final_raa_event = nodes[1].node.get_and_clear_pending_msg_events();
assert_eq!(final_raa_event.len(), 1);
let raa = match &final_raa_event[0] {
&MessageSendEvent::SendRevokeAndACK { ref msg, .. } => msg.clone(),
_ => panic!("Unexpected event"),
};
nodes[0].node.handle_revoke_and_ack(&nodes[1].node.get_our_node_id(), &raa);
expect_payment_failed_with_update!(nodes[0], our_payment_hash, false, chan_1_2.0.contents.short_channel_id, false);
check_added_monitors!(nodes[0], 1);
} | rust_cleaned_test_functions.jsonl/16918 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2447
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22121,
1523,
14995,
16648,
49086,
17257,
8237,
263,
8905,
26290,
6996,
453,
368,
341,
10217,
26023,
1645,
18343,
82,
284,
1855,
45552,
1645,
18343,
82,
7,
18,
317,
10217,
2436,
18343,
82,
284,
185... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_simple_operator_empty_or_to_string() {
let query = Operator::Or(vec![]);
let json = query.to_string();
let expected = "{}";
assert_eq!(json, expected);
} | rust_cleaned_test_functions.jsonl/11874 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
40594,
15124,
8734,
2346,
3904,
368,
341,
286,
1077,
3239,
284,
28498,
486,
2195,
25592,
0,
1294,
626,
286,
1077,
2951,
284,
3239,
2389,
3904,
1428,
286,
1077,
3601,
284,
35503,
3302,
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 |
#[test]
fn test_from_str() {
let _file = r#"
<file name="blupp.dat" uuid="1502fdd0-c24e-4acc-984a-7d1e05059ccd" time="2019-01-20-T10:03:54Z" host="Backup2-backup2-get-oldgluster-dp1-2">
<path xml:space="preserve">/oleidinger/Jotta/Sync/test</path>
<abspath xml:space="preserve">/oleidinger/Jotta/Sync/test</abspath>
<currentRevision>
<number>3</number>
<state>COMPLETED</state>
<created>2019-01-20-T10:01:03Z</created>
<modified>2019-01-20-T10:01:03Z</modified>
<mime>application/octet-stream</mime>
<size>10</size>
<md5>5c372a32c9ae748a4c040ebadc51a829</md5>
<updated>2019-01-20-T10:01:03Z</updated>
</currentRevision>
<revisions>
<revision>
<number>2</number>
<state>COMPLETED</state>
<created>2019-01-20-T07:47:19Z</created>
<modified>2019-01-20-T07:47:19Z</modified>
<mime>application/octet-stream</mime>
<size>10</size>
<md5>5c372a32c9ae748a4c040ebadc51a829</md5>
<updated>2019-01-20-T07:47:19Z</updated>
</revision>
<revision>
<number>1</number>
<state>COMPLETED</state>
<created>2019-01-20-T07:19:52Z</created>
<modified>2019-01-20-T07:19:52Z</modified>
<mime>application/octet-stream</mime>
<size>10</size>
<md5>5c372a32c9ae748a4c040ebadc51a829</md5>
<updated>2019-01-20-T07:19:52Z</updated>
</revision>
</revisions>
</file>
"#.parse::<File>().unwrap();
} | rust_cleaned_test_functions.jsonl/51533 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 729
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
2895,
368,
341,
262,
1077,
716,
1192,
284,
435,
2,
698,
27,
1192,
829,
428,
2024,
31832,
9915,
1,
16040,
428,
16,
20,
15,
17,
69,
631,
15,
1786,
17,
19,
68,
12,
19,
4475,
12,
24,
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_eq_same() {
// Given:
let a = Counter::from(vec![1, 2, 3]);
let b = Counter::from(vec![1, 2, 3]);
// Then:
assert_eq!(a, b);
} | rust_cleaned_test_functions.jsonl/79515 | {
"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,
10714,
33574,
368,
341,
310,
442,
16246,
510,
310,
1077,
264,
284,
19735,
486,
1499,
25592,
20703,
16,
11,
220,
17,
11,
220,
18,
2558,
310,
1077,
293,
284,
19735,
486,
1499,
25592,
20703,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_register() {
assert_ne!(crate::Type::INVALID, MySharedArc::static_type());
assert_ne!(crate::Type::INVALID, MySharedRc::static_type());
} | rust_cleaned_test_functions.jsonl/105010 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 85
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14000,
368,
341,
286,
2060,
13925,
10297,
61711,
486,
929,
486,
46859,
11,
3017,
16997,
36809,
486,
1978,
1819,
1423,
286,
2060,
13925,
10297,
61711,
486,
929,
486,
46859,
11,
3017,
16997,
49,
66,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_engine() {
// Create the mock engine with this vec so we can refer to it later. Once we put the engine
let calls = Arc::new(Mutex::new(Vec::new()));
// We are going to run two threads to simulate the validator and the driver
let mut mock_engine = MockEngine::with(calls.clone());
let (sender, receiver) = channel();
sender
.send(Update::PeerConnected(Default::default()))
.unwrap();
sender
.send(Update::PeerDisconnected(Default::default()))
.unwrap();
sender
.send(Update::PeerMessage(Default::default(), Default::default()))
.unwrap();
sender.send(Update::BlockNew(Default::default())).unwrap();
sender.send(Update::BlockValid(Default::default())).unwrap();
sender
.send(Update::BlockInvalid(Default::default()))
.unwrap();
sender
.send(Update::BlockCommit(Default::default()))
.unwrap();
let handle = thread::spawn(move || {
let svc = Box::new(MockService {});
mock_engine
.start(receiver, svc, Default::default())
.unwrap();
});
sender.send(Update::Shutdown).unwrap();
handle.join().unwrap();
assert!(contains(&calls, "start"));
assert!(contains(&calls, "PeerConnected"));
assert!(contains(&calls, "PeerDisconnected"));
assert!(contains(&calls, "PeerMessage"));
assert!(contains(&calls, "BlockNew"));
assert!(contains(&calls, "BlockValid"));
assert!(contains(&calls, "BlockInvalid"));
assert!(contains(&calls, "BlockCommit"));
} | rust_cleaned_test_functions.jsonl/73636 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 794
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24823,
368,
341,
286,
442,
4230,
279,
7860,
4712,
448,
419,
7486,
773,
582,
646,
8300,
311,
432,
2937,
13,
9646,
582,
2182,
279,
4712,
8945,
286,
1077,
6738,
284,
19689,
486,
931,
3189,
9371,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_compile_shift_right_wrap_e() {
let compiled = bitwise::compile_shift_right_wrap("E".to_string());
assert_eq!(compiled.len(), 1);
assert_eq!(compiled[0], 0b10010111);
} | rust_cleaned_test_functions.jsonl/100624 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 89
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74170,
22230,
10539,
38550,
2204,
368,
341,
262,
1077,
19697,
284,
97970,
486,
20433,
22230,
10539,
38550,
445,
36,
3263,
983,
3904,
5231,
262,
2060,
10714,
10297,
50845,
19406,
1507,
220,
16,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_network_interface_error_conversion() {
// Test `NetworkInterfaceError` conversion
assert_eq!(
error_kind(NetworkInterfaceError::GuestMacAddressInUse(String::new())),
ErrorKind::User
);
assert_eq!(
error_kind(NetworkInterfaceError::EpollHandlerNotFound(
Error::DeviceEventHandlerNotFound
)),
ErrorKind::Internal
);
assert_eq!(
error_kind(NetworkInterfaceError::HostDeviceNameInUse(String::new())),
ErrorKind::User
);
assert_eq!(
error_kind(NetworkInterfaceError::DeviceIdNotFound),
ErrorKind::User
);
// NetworkInterfaceError::OpenTap can be of multiple kinds.
{
assert_eq!(
error_kind(NetworkInterfaceError::OpenTap(TapError::OpenTun(
io::Error::from_raw_os_error(0)
))),
ErrorKind::User
);
assert_eq!(
error_kind(NetworkInterfaceError::OpenTap(TapError::CreateTap(
io::Error::from_raw_os_error(0)
))),
ErrorKind::User
);
assert_eq!(
error_kind(NetworkInterfaceError::OpenTap(TapError::IoctlError(
io::Error::from_raw_os_error(0)
))),
ErrorKind::Internal
);
assert_eq!(
error_kind(NetworkInterfaceError::OpenTap(TapError::NetUtil(
net_util::Error::CreateSocket(io::Error::from_raw_os_error(0))
))),
ErrorKind::Internal
);
assert_eq!(
error_kind(NetworkInterfaceError::OpenTap(TapError::InvalidIfname)),
ErrorKind::User
);
}
assert_eq!(
error_kind(NetworkInterfaceError::RateLimiterUpdateFailed(
devices::Error::FailedReadTap
)),
ErrorKind::Internal
);
assert_eq!(
error_kind(NetworkInterfaceError::UpdateNotAllowedPostBoot),
ErrorKind::User
);
} | rust_cleaned_test_functions.jsonl/93131 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1191
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20966,
20546,
4096,
64132,
368,
341,
286,
442,
3393,
1565,
12320,
5051,
1454,
63,
14409,
198,
286,
2060,
10714,
33673,
310,
1465,
33162,
77623,
5051,
1454,
486,
37804,
19552,
4286,
641,
10253,
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_mimc_small_params() {
assert!(
Path::new("./phase1radix2m10").exists(),
"the phase1 file `phase1radix2m10` must be in the crate's top level directory"
);
let constants = (0..MIMC_ROUNDS)
.map(|_| Fr::random(&mut thread_rng()))
.collect::<Vec<_>>();
let circuit = MiMCDemo::<Bls12> {
xl: None,
xr: None,
constants: &constants,
};
let mut rng_large = ChaChaRng::from_seed([0u8; 32]);
let mut rng_small = ChaChaRng::from_seed([0u8; 32]);
// Create the initial params.
let initial_large = MPCParameters::new(circuit).unwrap();
let initial_small = initial_large.copy_small();
let mut large_added = initial_large.copy();
// Make the first contributions.
let (first_large, first_large_contrib) = {
let mut params = initial_large.copy();
let contrib = params.contribute(&mut rng_large);
(params, contrib)
};
let (first_small, first_small_contrib) = {
let mut params = initial_small.clone();
let contrib = params.contribute(&mut rng_small);
(params, contrib)
};
// Verify the first contributions.
assert_eq!(
&first_small_contrib[..],
&first_large_contrib[..],
"first small and large contributions are not equal"
);
let verified_large = verify_contribution(&initial_large, &first_large)
.expect("first large verify_contribution() failed");
assert_eq!(
&first_large_contrib[..],
&verified_large[..],
"first large contribution does not match verified contribution"
);
let verified_small = verify_contribution_small(&initial_small, &first_small)
.expect("first small verify_contribution_small() failed");
assert_eq!(
&first_small_contrib[..],
&verified_small[..],
"first small contribution does not match verified contribution"
);
// Verify that the first large and small params are consistent.
assert!(first_large.has_last_contrib(&first_small));
large_added.add_contrib(first_small.clone());
assert_eq!(large_added, first_large);
// Make the second contributions.
let (second_large, second_large_contrib) = {
let mut params = first_large.copy();
let contrib = params.contribute(&mut rng_large);
(params, contrib)
};
let (second_small, second_small_contrib) = {
let mut params = first_small.clone();
let contrib = params.contribute(&mut rng_small);
(params, contrib)
};
// Verify the second contributions.
assert_eq!(
&second_small_contrib[..],
&second_large_contrib[..],
"second small and large contributions are not equal"
);
let verified_large = verify_contribution(&first_large, &second_large)
.expect("second large verify_contribution() failed");
assert_eq!(
&second_large_contrib[..],
&verified_large[..],
"second large contribution does not match verified contribution"
);
let verified_small = verify_contribution_small(&first_small, &second_small)
.expect("second small verify_contribution_small() failed");
assert_eq!(
&second_small_contrib[..],
&verified_small[..],
"second small contribution does not match verified contribution"
);
// Verify that the second large and small params are consistent.
assert!(second_large.has_last_contrib(&second_small));
large_added.add_contrib(second_small.clone());
assert_eq!(large_added, second_large);
// Verify large params against circuit.
let all_contributions = large_added
.verify(MiMCDemo::<Bls12> {
xl: None,
xr: None,
constants: &constants,
})
.unwrap();
assert_eq!(all_contributions.len(), 2);
assert_eq!(&all_contributions[0][..], &first_large_contrib[..]);
assert_eq!(&all_contributions[1][..], &second_large_contrib[..]);
// Verify the generated params against the circuit.
let groth_params = large_added.get_params();
let pvk = prepare_verifying_key(&groth_params.vk);
// Generate a random preimage and compute the image.
let xl = Fr::random(&mut thread_rng());
let xr = Fr::random(&mut thread_rng());
let image = mimc_hash::<Bls12>(xl, xr, &constants);
let circuit = MiMCDemo {
xl: Some(xl),
xr: Some(xr),
constants: &constants,
};
// Create a groth16 proof using the generated parameters.
let proof = create_random_proof(circuit, groth_params, &mut thread_rng())
.expect("failed to create Groth16 proof using MPC params");
assert!(verify_proof(&pvk, &proof, &[image]).unwrap());
} | rust_cleaned_test_functions.jsonl/124276 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1915
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
318,
66,
31966,
6745,
368,
341,
262,
2060,
33673,
286,
7933,
486,
931,
13988,
25141,
16,
13281,
941,
17,
76,
16,
15,
1827,
16304,
3148,
286,
330,
1782,
10262,
16,
1034,
1565,
25141,
16,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_array_literal() {
test("([])", "");
test("([1])", "");
test("([a])", "");
test("([foo()])", "foo()");
} | rust_cleaned_test_functions.jsonl/470 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 72
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
34100,
368,
341,
262,
1273,
445,
10556,
11583,
14498,
262,
1273,
445,
2561,
16,
2467,
497,
14498,
262,
1273,
445,
2561,
64,
2467,
497,
14498,
262,
1273,
445,
2561,
7975,
368,
2467,
497,
33... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_aes_siv_primitive() {
tink_daead::init();
let km = tink::registry::get_key_manager(tink_testutil::AES_SIV_TYPE_URL)
.expect("cannot obtain AESSIV key manager");
let serialized_key = km.new_key(&[]).unwrap();
let p = km.primitive(&serialized_key).unwrap();
assert!(validate_aes_siv_primitive(p).is_ok());
} | rust_cleaned_test_functions.jsonl/64374 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 158
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
90958,
643,
344,
84087,
368,
341,
262,
90584,
47070,
3149,
486,
2327,
543,
262,
1077,
13136,
284,
90584,
486,
29172,
486,
455,
3097,
12144,
1155,
766,
4452,
1314,
486,
69168,
1098,
3090,
4189,
800... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_inference() {
let sim_specs = sim_specs_with_units("parsec");
let units_ctx = Context::new_with_builtins(&[], &sim_specs).unwrap();
// test cases where we should be able to infer all units
let test_cases: &[&[(crate::datamodel::Variable, &'static str)]] = &[
&[
(x_aux("input", "6", Some("widget")), "widget"),
(x_flow("delay", "3", Some("parsec")), "parsec"),
// testing the 2-input version of smth1
(x_aux("seen", "SMTH1(input, delay)", None), "widget"),
(x_aux("seen_dep", "seen + 1", None), "widget"),
],
&[
(
x_stock("stock_1", "1", &["inflow"], &[], Some("usd")),
"usd",
),
(x_aux("window", "6", Some("parsec")), "parsec"),
(x_flow("inflow", "seen/window", None), "usd/parsec"),
(x_aux("seen", "sin(seen_dep) mod 3", None), "usd"),
(x_aux("seen_dep", "1 + 3 * stock_1", None), "usd"),
],
&[
(x_aux("initial", "70", Some("widget")), "widget"),
(x_aux("input", "6", Some("widget")), "widget"),
(x_flow("delay", "3", Some("parsec")), "parsec"),
// testing the 3-input version of smth1
(
x_aux("seen", "DELAY1(input, delay, initial)", None),
"widget",
),
(x_aux("seen_dep", "seen + 1", None), "widget"),
],
];
for test_case in test_cases.into_iter() {
let expected = test_case
.iter()
.map(|(var, units)| (var.get_ident(), *units))
.collect::<HashMap<&str, &str>>();
let vars = test_case
.iter()
.map(|(var, _unit)| var)
.cloned()
.collect::<Vec<_>>();
let model = x_model("main", vars);
let project_datamodel = x_project(sim_specs.clone(), &[model]);
// there is non-determinism in inference; do it a few times to
// shake out heisenbugs
for _ in 0..64 {
let mut results: Result<HashMap<Ident, UnitMap>> =
model_err!(UnitMismatch, "".to_owned());
let _project = crate::project::Project::base_from(
project_datamodel.clone(),
|models, units_ctx, model| {
results = infer(models, units_ctx, model);
},
);
let results = results.unwrap();
for (ident, expected_units) in expected.iter() {
let expected_units: UnitMap =
crate::units::parse_units(&units_ctx, Some(expected_units))
.unwrap()
.unwrap();
if let Some(computed_units) = results.get(*ident) {
assert_eq!(expected_units, *computed_units);
} else {
panic!("inference results don't contain variable '{}'", ident);
}
}
}
}
} | rust_cleaned_test_functions.jsonl/18980 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1613
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
2202,
368,
341,
262,
1077,
1643,
71200,
284,
1643,
71200,
6615,
28345,
445,
1732,
5024,
797,
262,
1077,
8153,
15147,
284,
9608,
486,
931,
6615,
880,
11227,
1330,
2099,
12995,
609,
14781,
712... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_version_set_merge_iters() {
let v1 = vec![2, 4, 6, 8, 10];
let v2 = vec![1, 3, 5, 7];
assert_eq!(
vec![1, 2, 3, 4, 5, 6, 7, 8, 10],
merge_iters(v1.into_iter(), v2.into_iter(), |a, b| a.cmp(&b))
);
} | rust_cleaned_test_functions.jsonl/41929 | {
"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,
9438,
2602,
20888,
72866,
368,
341,
286,
1077,
348,
16,
284,
7486,
20703,
17,
11,
220,
19,
11,
220,
21,
11,
220,
23,
11,
220,
16,
15,
935,
286,
1077,
348,
17,
284,
7486,
20703,
16,
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_write_hmtx_table() {
let hmtx_data = include_bytes!("../tests/fonts/opentype/hmtx.bin");
let num_glyphs = 1264;
let num_h_metrics = 1264;
let hmtx = ReadScope::new(hmtx_data)
.read_dep::<HmtxTable<'_>>((num_glyphs, num_h_metrics))
.unwrap();
let mut ctxt = WriteBuffer::new();
HmtxTable::write(&mut ctxt, &hmtx).unwrap();
assert_eq!(ctxt.bytes(), &hmtx_data[..]);
} | rust_cleaned_test_functions.jsonl/76063 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 262
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
1523,
90310,
5237,
368,
341,
1789,
286,
1077,
305,
90310,
1769,
284,
2924,
12524,
17223,
1244,
23841,
60667,
52000,
306,
499,
7530,
90310,
29394,
797,
286,
1077,
1629,
88703,
82,
284,
220,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_inverse_vector() {
let v = Vector3::new(1.0f64, 2.0, 3.0);
let t = Decomposed {
scale: 1.5f64,
rot: Quaternion::new(0.5f64, 0.5, 0.5, 0.5),
disp: Vector3::new(6.0f64, -7.0, 8.0),
};
let vt = t
.inverse_transform_vector(v)
.expect("Expected successful inversion");
assert_ulps_eq!(v, t.transform_vector(vt));
} | rust_cleaned_test_functions.jsonl/86460 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 211
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
63333,
12247,
368,
341,
262,
1077,
348,
284,
4196,
18,
486,
931,
7,
16,
13,
15,
69,
21,
19,
11,
220,
17,
13,
15,
11,
220,
18,
13,
15,
317,
262,
1077,
259,
284,
96378,
3865,
341,
286,
545... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_async_ooo_offchain_updates() {
// Test that if we have multiple offchain updates being persisted and they complete
// ChannelManager.
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
create_announced_chan_between_nodes(
&nodes,
0,
1,
InitFeatures::known(),
InitFeatures::known(),
);
// Route two payments to be claimed at the same time.
let payment_preimage_1 = route_payment(&nodes[0], &[&nodes[1]], 1_000_000).0;
let payment_preimage_2 = route_payment(&nodes[0], &[&nodes[1]], 1_000_000).0;
chanmon_cfgs[1].persister.offchain_monitor_updates.lock().unwrap().clear();
chanmon_cfgs[1].persister.set_update_ret(Err(ChannelMonitorUpdateErr::TemporaryFailure));
nodes[1].node.claim_funds(payment_preimage_1);
check_added_monitors!(nodes[1], 1);
nodes[1].node.claim_funds(payment_preimage_2);
check_added_monitors!(nodes[1], 1);
chanmon_cfgs[1].persister.set_update_ret(Ok(()));
let persistences =
chanmon_cfgs[1].persister.offchain_monitor_updates.lock().unwrap().clone();
assert_eq!(persistences.len(), 1);
let (funding_txo, updates) = persistences.iter().next().unwrap();
assert_eq!(updates.len(), 2);
// Note that updates is a HashMap so the ordering here is actually random. This shouldn't
// fail either way but if it fails intermittently it's depending on the ordering of updates.
let mut update_iter = updates.iter();
nodes[1]
.chain_monitor
.chain_monitor
.channel_monitor_updated(*funding_txo, update_iter.next().unwrap().clone())
.unwrap();
assert!(nodes[1].chain_monitor.release_pending_monitor_events().is_empty());
assert!(nodes[1].node.get_and_clear_pending_msg_events().is_empty());
nodes[1]
.chain_monitor
.chain_monitor
.channel_monitor_updated(*funding_txo, update_iter.next().unwrap().clone())
.unwrap();
// Now manually walk the commitment signed dance - because we claimed two payments
// back-to-back it doesn't fit into the neat walk commitment_signed_dance does.
let updates = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
nodes[0].node.handle_update_fulfill_htlc(
&nodes[1].node.get_our_node_id(),
&updates.update_fulfill_htlcs[0],
);
expect_payment_sent_without_paths!(nodes[0], payment_preimage_1);
nodes[0]
.node
.handle_commitment_signed(&nodes[1].node.get_our_node_id(), &updates.commitment_signed);
check_added_monitors!(nodes[0], 1);
let (as_first_raa, as_first_update) =
get_revoke_commit_msgs!(nodes[0], nodes[1].node.get_our_node_id());
nodes[1].node.handle_revoke_and_ack(&nodes[0].node.get_our_node_id(), &as_first_raa);
check_added_monitors!(nodes[1], 1);
let bs_second_updates = get_htlc_update_msgs!(nodes[1], nodes[0].node.get_our_node_id());
nodes[1].node.handle_commitment_signed(&nodes[0].node.get_our_node_id(), &as_first_update);
check_added_monitors!(nodes[1], 1);
let bs_first_raa = get_event_msg!(
nodes[1],
MessageSendEvent::SendRevokeAndACK,
nodes[0].node.get_our_node_id()
);
nodes[0].node.handle_update_fulfill_htlc(
&nodes[1].node.get_our_node_id(),
&bs_second_updates.update_fulfill_htlcs[0],
);
expect_payment_sent_without_paths!(nodes[0], payment_preimage_2);
nodes[0].node.handle_commitment_signed(
&nodes[1].node.get_our_node_id(),
&bs_second_updates.commitment_signed,
);
check_added_monitors!(nodes[0], 1);
nodes[0].node.handle_revoke_and_ack(&nodes[1].node.get_our_node_id(), &bs_first_raa);
expect_payment_path_successful!(nodes[0]);
check_added_monitors!(nodes[0], 1);
let (as_second_raa, as_second_update) =
get_revoke_commit_msgs!(nodes[0], nodes[1].node.get_our_node_id());
nodes[1].node.handle_revoke_and_ack(&nodes[0].node.get_our_node_id(), &as_second_raa);
check_added_monitors!(nodes[1], 1);
nodes[1].node.handle_commitment_signed(&nodes[0].node.get_our_node_id(), &as_second_update);
check_added_monitors!(nodes[1], 1);
let bs_second_raa = get_event_msg!(
nodes[1],
MessageSendEvent::SendRevokeAndACK,
nodes[0].node.get_our_node_id()
);
nodes[0].node.handle_revoke_and_ack(&nodes[1].node.get_our_node_id(), &bs_second_raa);
expect_payment_path_successful!(nodes[0]);
check_added_monitors!(nodes[0], 1);
} | rust_cleaned_test_functions.jsonl/43159 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1874
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28346,
62,
38621,
13651,
8819,
57829,
368,
341,
197,
197,
322,
3393,
429,
421,
582,
614,
5248,
1007,
8819,
8837,
1660,
52995,
323,
807,
4583,
24520,
197,
197,
322,
13434,
2043,
624,
197,
10217,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_clean_symbol() {
let symbol = "google::protobuf::RepeatedPtrField<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::TypeHandler*::Type google::protobuf::internal::RepeatedPtrFieldBase::Add<google::protobuf::RepeatedPtrField<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::TypeHandler>()";
assert_eq!(
clean_symbol( symbol.into() ),
"google::protobuf::RepeatedPtrField<std::string::TypeHandler*::Type google::protobuf::internal::RepeatedPtrFieldBase::Add<google::protobuf::RepeatedPtrField<std::string::TypeHandler>()"
);
} | rust_cleaned_test_functions.jsonl/25407 | {
"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,
19573,
21179,
368,
341,
262,
1077,
7735,
284,
330,
17485,
486,
32921,
486,
90989,
5348,
1877,
8050,
18606,
89073,
16,
16,
486,
22342,
3904,
21919,
11,
1460,
486,
1762,
39693,
21919,
8066,
1460,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_train() {
let word_counts: HashMap<String, u32> = [
("the".into(), 25),
("roses".into(), 22),
("are".into(), 24),
("red".into(), 12),
("voilets".into(), 10),
("blue".into(), 16),
]
.iter()
.cloned()
.collect();
let mut trainer = WordLevelTrainer {
vocab_size: 5,
..Default::default()
};
let mut model = WordLevel::default();
trainer.do_train(&word_counts, &mut model).unwrap();
let expected_vocab: HashMap<String, u32> = [
("the".into(), 0),
("are".into(), 1),
("roses".into(), 2),
("blue".into(), 3),
("red".into(), 4),
]
.iter()
.cloned()
.collect();
assert_eq!(model.vocab, expected_vocab);
// If we specify a min_frequency
trainer.min_frequency = 15;
let mut model = WordLevel::default();
trainer.do_train(&word_counts, &mut model).unwrap();
let expected_vocab: HashMap<String, u32> = [
("the".into(), 0),
("are".into(), 1),
("roses".into(), 2),
("blue".into(), 3),
]
.iter()
.cloned()
.collect();
assert_eq!(model.vocab, expected_vocab);
} | rust_cleaned_test_functions.jsonl/91372 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 739
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7591,
368,
341,
286,
1077,
3409,
25977,
25,
10528,
3464,
11,
575,
18,
17,
29,
284,
2278,
310,
3489,
1782,
3263,
18122,
1507,
220,
17,
20,
1326,
310,
3489,
3630,
288,
3263,
18122,
1507,
220,
17... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lookup_no_size() -> Result<(), Error> {
let buffer = ByteView::open(fixture("libgallium_dri.sym"))?;
let object = Object::parse(&buffer)?;
let mut buffer = Vec::new();
SymCacheWriter::write_object(&object, Cursor::new(&mut buffer))?;
let symcache = SymCache::parse(&buffer)?;
let symbols = symcache.lookup(0x1489adf)?.collect::<Vec<_>>()?;
assert_eq!(symbols.len(), 1);
let name = symbols[0].function_name();
assert_eq!(name, "nouveau_drm_screen_create");
Ok(())
} | rust_cleaned_test_functions.jsonl/84094 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 215
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27464,
6536,
2368,
368,
1464,
5714,
68843,
4600,
29,
341,
262,
1077,
4147,
284,
10906,
851,
486,
2508,
94886,
445,
2740,
70,
541,
2356,
814,
461,
50901,
2761,
37445,
262,
1077,
1633,
284,
3002,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_empty_doc() {
let s: String = "".to_owned();
YamlLoader::load_from_str(&s).unwrap();
let s: String = "---".to_owned();
assert_eq!(YamlLoader::load_from_str(&s).unwrap()[0], Yaml::Null);
} | rust_cleaned_test_functions.jsonl/1201 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
18869,
368,
341,
286,
1077,
274,
25,
923,
284,
44907,
983,
51973,
543,
286,
809,
9467,
9181,
486,
1078,
5673,
2895,
2099,
82,
568,
15454,
543,
286,
1077,
274,
25,
923,
284,
75894,
3263,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_schema_is_send() {
fn send<S: Send>(_s: S) {}
let schema = Schema {
named: vec![],
indices: Default::default(),
top: SchemaPiece::Null.into(),
};
send(schema);
} | rust_cleaned_test_functions.jsonl/2991 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25371,
6892,
13565,
368,
341,
286,
5168,
3624,
18858,
25,
11000,
45609,
82,
25,
328,
8,
10086,
286,
1077,
10802,
284,
12539,
341,
310,
6941,
25,
7486,
20703,
1259,
310,
14937,
25,
7899,
486,
225... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_grep_n_match_file_name_with_dashes_and_no_extension() {
// git grep -n
// This fails: we can't parse it currently.
let fake_parent_grep_command =
"/usr/local/bin/git --doesnt-matter grep --nor-this nor_this -- nor_this";
let _args = FakeParentArgs::once(fake_parent_grep_command);
assert_eq!(
parse_grep_line("etc/examples/119-within-line-edits:4:repo=$(mktemp -d)"),
Some(GrepLine {
path: "etc/examples/119-within-line-edits".into(),
line_number: Some(4),
line_type: LineType::Match,
code: "repo=$(mktemp -d)".into(),
submatches: None,
})
);
} | rust_cleaned_test_functions.jsonl/43041 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 395
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
1889,
9995,
1089,
10708,
2458,
1269,
6615,
814,
14051,
8378,
6536,
31035,
368,
341,
286,
442,
16345,
20675,
481,
77,
198,
286,
442,
1096,
14525,
25,
582,
646,
944,
4715,
432,
5023,
624,
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_oid_params() {
test_type(
"OID",
&[
(Some(2_147_483_548u32), "2147483548"),
(Some(4_000_000_000), "4000000000"),
(None, "NULL"),
],
);
} | rust_cleaned_test_functions.jsonl/127906 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
59633,
6745,
368,
341,
262,
1273,
1819,
1006,
286,
330,
29805,
756,
286,
609,
9640,
310,
320,
8373,
7,
17,
62,
16,
19,
22,
62,
19,
23,
18,
62,
20,
19,
23,
84,
18,
17,
701,
330,
17,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_transaction_with_duplicate_accounts_in_instruction() {
let (genesis_config, mint_keypair) = create_genesis_config(500);
let mut bank = Bank::new(&genesis_config);
fn mock_process_instruction(
_program_id: &Pubkey,
keyed_accounts: &[KeyedAccount],
data: &[u8],
_invoke_context: &mut dyn InvokeContext,
) -> result::Result<(), InstructionError> {
let lamports = data[0] as u64;
{
let mut to_account = keyed_accounts[1].try_account_ref_mut()?;
let mut dup_account = keyed_accounts[2].try_account_ref_mut()?;
dup_account.lamports -= lamports;
to_account.lamports += lamports;
}
keyed_accounts[0].try_account_ref_mut()?.lamports -= lamports;
keyed_accounts[1].try_account_ref_mut()?.lamports += lamports;
Ok(())
}
let mock_program_id = Pubkey::new(&[2u8; 32]);
bank.add_builtin("mock_program", mock_program_id, mock_process_instruction);
let from_pubkey = solana_sdk::pubkey::new_rand();
let to_pubkey = solana_sdk::pubkey::new_rand();
let dup_pubkey = from_pubkey;
let from_account = Account::new(100, 1, &mock_program_id);
let to_account = Account::new(0, 1, &mock_program_id);
bank.store_account(&from_pubkey, &from_account);
bank.store_account(&to_pubkey, &to_account);
let account_metas = vec![
AccountMeta::new(from_pubkey, false),
AccountMeta::new(to_pubkey, false),
AccountMeta::new(dup_pubkey, false),
];
let instruction = Instruction::new(mock_program_id, &10, account_metas);
let tx = Transaction::new_signed_with_payer(
&[instruction],
Some(&mint_keypair.pubkey()),
&[&mint_keypair],
bank.last_blockhash(),
);
let result = bank.process_transaction(&tx);
assert_eq!(result, Ok(()));
assert_eq!(bank.get_balance(&from_pubkey), 80);
assert_eq!(bank.get_balance(&to_pubkey), 20);
} | rust_cleaned_test_functions.jsonl/63778 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1057
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28884,
6615,
70434,
55665,
1243,
54923,
368,
341,
286,
1077,
320,
77894,
5332,
11,
28337,
3097,
12670,
8,
284,
1855,
16322,
13774,
5332,
7,
20,
15,
15,
317,
286,
1077,
5206,
6073,
284,
8547,
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_maps() {
test_map(b"\xa0", 0, |_| {}, false);
test_map(
b"\xa2\x01\x02\x03\x04",
2,
|val| {
let (key, value) = val.get(0).unwrap();
assert_pos_number(key, 1);
assert_pos_number(value, 2);
let (key, value) = val.get(1).unwrap();
assert_pos_number(key, 3);
assert_pos_number(value, 4);
},
false,
);
test_map(
b"\xa2\x61\x61\x01\x61\x62\x82\x02\x03",
2,
|val| {
let (key, value) = val.get(0).unwrap();
assert_text(key, "a");
assert_pos_number(value, 1);
let (key, value) = val.get(1).unwrap();
assert_text(key, "b");
match value {
Value::Array(elements) => {
assert_eq!(2, elements.len());
assert_pos_number(elements.get(0).unwrap(), 2);
assert_pos_number(elements.get(1).unwrap(), 3);
}
_ => panic!("expected array"),
}
},
false,
);
test_map(
b"\xa5\x61\x61\x61\x41\x61\x62\x61\x42\x61\x63\x61\x43\x61\x64\x61\x44\x61\x65\x61\x45",
5,
|val| {
let (key, value) = val.get(0).unwrap();
assert_text(key, "a");
assert_text(value, "A");
let (key, value) = val.get(1).unwrap();
assert_text(key, "b");
assert_text(value, "B");
let (key, value) = val.get(4).unwrap();
assert_text(key, "e");
assert_text(value, "E");
},
false,
);
test_map(
b"\xbf\x61\x61\x01\x61\x62\x9f\x02\x03\xff\xff",
2,
|val| {
let (key, value) = val.get(0).unwrap();
assert_text(key, "a");
assert_pos_number(value, 1);
let (key, value) = val.get(1).unwrap();
assert_text(key, "b");
match value {
Value::Array(elements) => {
assert_pos_number(elements.get(0).unwrap(), 2);
assert_pos_number(elements.get(1).unwrap(), 3);
}
_ => panic!("expected array"),
}
},
true,
);
test_map(
b"\xbf\x63\x46\x75\x6e\xf5\x63\x41\x6d\x74\x21\xff",
2,
|val| {
let (key, value) = val.get(0).unwrap();
assert_text(key, "Fun");
match value {
Value::Bool(val) => assert!(val),
_ => panic!("expected boolean"),
};
let (key, value) = val.get(1).unwrap();
assert_text(key, "Amt");
assert_neg_number(value, -2);
},
true,
);
} | rust_cleaned_test_functions.jsonl/62591 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1709
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46512,
368,
341,
262,
1273,
5376,
1883,
11934,
9591,
15,
497,
220,
15,
11,
66091,
16452,
895,
317,
262,
1273,
5376,
1006,
286,
293,
11934,
9591,
17,
3462,
15,
16,
3462,
15,
17,
3462,
15,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_bad_kernel_endian() {
// Only little endian is supported.
let gm = create_guest_mem();
let mut bad_image = make_test_bin();
bad_image[0x5] = 2;
assert_eq!(
Err(Error::BigEndianElfOnLittle),
load_kernel(&gm, &mut Cursor::new(&bad_image), 0)
);
} | rust_cleaned_test_functions.jsonl/88247 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 177
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34199,
26876,
87193,
368,
341,
286,
442,
8278,
2632,
64688,
374,
7248,
624,
286,
1077,
37879,
284,
1855,
62739,
12976,
543,
286,
1077,
5206,
3873,
4954,
284,
1281,
4452,
21816,
543,
286,
3873,
495... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_keywords_after_if() {
check(
r#"fn quux() { if true { () } <|> }"#,
expect![[r#"
kw fn
kw use
kw impl
kw trait
kw match
kw while
kw loop
kw if
kw if let
kw let
kw else
kw else if
kw mod
kw const
kw type
kw static
kw extern
kw unsafe
kw return
"#]],
);
check_edit(
"else",
r#"fn quux() { if true { () } <|> }"#,
r#"fn quux() { if true { () } else {$0} }"#,
);
} | rust_cleaned_test_functions.jsonl/126829 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 577
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51354,
19844,
11119,
368,
341,
286,
1779,
1006,
310,
435,
55543,
8822,
922,
2200,
368,
314,
421,
830,
314,
1719,
335,
82639,
29,
335,
57676,
345,
310,
1720,
0,
15505,
81,
2,
698,
394,
29525,
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_fail_construction() {
const SAMPLE_SIZE: usize = 1_000;
let mut rng = rand::thread_rng();
let keys: Vec<u64> = (0..SAMPLE_SIZE).map(|_| rng.gen()).collect();
let filter = Fuse32::try_from(&keys);
assert!(filter.expect_err("") == "Failed to construct fuse filter.");
} | rust_cleaned_test_functions.jsonl/32214 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22121,
3382,
3024,
368,
341,
286,
733,
62420,
4098,
25,
22301,
284,
220,
16,
62,
15,
15,
15,
280,
286,
1077,
5206,
28422,
284,
10382,
486,
4528,
66849,
543,
286,
1077,
6894,
25,
11312,
34837,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_nan() {
let vec = to_vec(&::std::f32::NAN).unwrap();
assert_eq!(vec, b"\xf9\x7e\x00");
} | rust_cleaned_test_functions.jsonl/110269 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 66
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73936,
368,
341,
262,
1077,
7486,
284,
311,
13251,
2099,
486,
1834,
486,
69,
18,
17,
486,
45,
1093,
568,
15454,
543,
262,
2060,
10714,
10297,
4083,
11,
293,
11934,
5848,
24,
3462,
22,
68,
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 |
#[test]
fn test_indicators() -> Result<(), DbError> {
let db = Db::download(false)?;
test_indicator(&db, "Dryad Arbor", ColorSet::green());
test_indicator(&db, "Nicol Bolas, the Arisen", ColorSet::grixis());
test_indicator(&db, "Transguild Courier", ColorSet::rainbow());
Ok(())
} | rust_cleaned_test_functions.jsonl/118259 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 146
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9122,
42052,
368,
1464,
5714,
68843,
11988,
1454,
29,
341,
286,
1077,
2927,
284,
11988,
486,
12885,
3576,
40007,
286,
1273,
58070,
2099,
1999,
11,
330,
85215,
329,
64539,
497,
3478,
1649,
486,
132... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_pathops_concat_cur() {
let actual = Path::new("foo/././..").as_os_str();
let expected = ffi::OsStr::new("foo/././..");
assert_eq!(actual, expected);
let actual = PathBuf::from("././foo/././..")
.concat("../bar")
.expect("Could not create relative path with concat");
let expected = PathBuf::from(r"../bar");
assert_eq!(actual, expected);
} | rust_cleaned_test_functions.jsonl/14053 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 255
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2638,
3721,
57478,
18956,
368,
341,
3374,
310,
1077,
5042,
284,
7933,
486,
931,
445,
7975,
14,
1725,
1725,
496,
1827,
300,
29387,
2895,
543,
310,
1077,
3601,
284,
76956,
486,
28867,
2580,
486,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bitpacker() {
test_bitpacker_util(10, 3);
test_bitpacker_util(10, 0);
test_bitpacker_util(10, 1);
test_bitpacker_util(6, 14);
test_bitpacker_util(1000, 14);
} | rust_cleaned_test_functions.jsonl/103584 | {
"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,
13996,
4748,
261,
368,
341,
286,
1273,
13996,
4748,
261,
18974,
7,
16,
15,
11,
220,
18,
317,
286,
1273,
13996,
4748,
261,
18974,
7,
16,
15,
11,
220,
15,
317,
286,
1273,
13996,
4748,
261,
189... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_consis_sharding() {
let servers = vec![
"10.73.63.195:15010",
"10.13.192.12:15010",
"10.73.63.190:15010",
"10.73.63.188:15010",
"10.73.63.187:15010",
];
let servers = servers.iter().map(|s| s.to_string()).collect();
let shard = sharding::Sharding::from("bkdr", "ketama", servers);
let tuples = vec![
("4675657416578300.sdt", 1),
("4675358995775696.sdt", 3),
("4675216938370991.sdt", 3),
("4675342185268044.sdt", 2),
("4676725675655615.sdt", 0),
];
for t in tuples {
assert_eq!(shard.sharding(t.0.as_bytes()), t.1);
}
} | rust_cleaned_test_functions.jsonl/88872 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 442
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3382,
14406,
3712,
28410,
368,
341,
286,
1077,
16293,
284,
7486,
90515,
310,
330,
16,
15,
13,
22,
18,
13,
21,
18,
13,
16,
24,
20,
25,
16,
20,
15,
16,
15,
756,
310,
330,
16,
15,
13,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_create_credential_invalid_price() {
init!("true");
settings::set_config_value(settings::CONFIG_INSTITUTION_DID, DEFAULT_DID);
let cb = return_types_u32::Return_U32_U32::new().unwrap();
assert_eq!(vcx_issuer_create_credential(cb.command_handle,
CString::new(DEFAULT_CREDENTIAL_NAME).unwrap().into_raw(),
::credential_def::tests::create_cred_def_fake(),
CString::new(DEFAULT_DID).unwrap().into_raw(),
CString::new(DEFAULT_ATTR).unwrap().into_raw(),
CString::new(DEFAULT_CREDENTIAL_NAME).unwrap().into_raw(),
CString::new("-1").unwrap().into_raw(),
Some(cb.get_callback())),
error::INVALID_OPTION.code_num);
} | rust_cleaned_test_functions.jsonl/66777 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 631
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
666,
30320,
31433,
9040,
368,
341,
286,
2930,
17223,
1866,
797,
286,
5003,
486,
746,
5332,
3142,
23369,
486,
24652,
2158,
25765,
28617,
1557,
915,
11,
11955,
1557,
915,
317,
286,
1077,
9858,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_enum_with_funcs() {
let cxx = indoc! {"
Bob give_bob() {
return Bob::BOB_VALUE_2;
}
"};
let hdr = indoc! {"
#include <cstdint>
enum Bob {
BOB_VALUE_1,
BOB_VALUE_2,
};
Bob give_bob();
"};
let rs = quote! {
let a = ffi::Bob::BOB_VALUE_2;
let b = ffi::give_bob();
assert!(a == b);
};
run_test(cxx, hdr, rs, &["Bob", "give_bob"], &[]);
} | rust_cleaned_test_functions.jsonl/9753 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 294
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31054,
6615,
64124,
368,
341,
262,
1077,
272,
4146,
284,
1257,
509,
0,
314,
698,
286,
14261,
2968,
880,
674,
368,
341,
310,
470,
14261,
486,
4677,
33,
7476,
62,
17,
280,
286,
456,
262,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_f64() {
assert_eq!(
Vec3::new(1.0, 0.0, -1.0) + 233.0,
Vec3::new(234.0, 233.0, 232.0)
)
} | rust_cleaned_test_functions.jsonl/35218 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 111
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
761,
21,
19,
368,
341,
286,
2060,
10714,
33673,
310,
11312,
18,
486,
931,
7,
16,
13,
15,
11,
220,
15,
13,
15,
11,
481,
16,
13,
15,
8,
488,
220,
17,
18,
18,
13,
15,
345,
310,
1131... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_shrink_to_fit() {
let mut builder = Utf8ChunkedBuilder::new("foo", 2048, 100 * 2048);
builder.append_value("foo");
let mut arr = builder.finish();
let before = arr
.chunks()
.iter()
.map(|arr| arrow::compute::aggregate::estimated_bytes_size(arr.as_ref()))
.sum::<usize>();
arr.shrink_to_fit();
let after = arr
.chunks()
.iter()
.map(|arr| arrow::compute::aggregate::estimated_bytes_size(arr.as_ref()))
.sum::<usize>();
assert!(before > after);
} | rust_cleaned_test_functions.jsonl/15559 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 328
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3712,
34365,
2346,
32416,
368,
341,
286,
1077,
5206,
7363,
284,
43432,
23,
28304,
291,
3297,
486,
931,
445,
7975,
497,
220,
17,
15,
19,
23,
11,
220,
16,
15,
15,
353,
220,
17,
15,
19,
23,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_katakana_rev() {
let full = "アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワン";
let half = "アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワン";
for (f, h) in full.chars().zip(half.chars()) {
assert_eq!(to_halfwidth(f).unwrap(), h);
}
} | rust_cleaned_test_functions.jsonl/101417 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 279
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4698,
68728,
3362,
38082,
368,
341,
262,
1077,
2480,
284,
330,
127000,
64199,
75639,
89862,
70393,
61803,
28120,
124539,
46160,
59768,
56107,
21660,
63710,
124867,
46207,
77359,
124788,
56833,
19674,
95... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_solution() {
assert_eq!(Solution::odd_even_jumps(vec![10, 13, 12, 14, 15]), 2);
assert_eq!(Solution::odd_even_jumps(vec![2, 3, 1, 1, 4]), 3);
assert_eq!(Solution::odd_even_jumps(vec![5, 1, 3, 4, 2]), 3);
assert_eq!(Solution::odd_even_jumps(vec![1, 2, 3, 2, 1, 4, 4, 5]), 6);
} | rust_cleaned_test_functions.jsonl/92223 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 177
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
50274,
368,
341,
286,
2060,
10714,
10297,
36842,
486,
14556,
68347,
5374,
11793,
25592,
20703,
16,
15,
11,
220,
16,
18,
11,
220,
16,
17,
11,
220,
16,
19,
11,
220,
16,
20,
9719,
220,
17,
317,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bgra16() {
// Test encoding an RGBA 16-bit image.
let mut encoded = Vec::new();
let max = std::u16::MAX;
let image: ImageBuffer<Bgra<u16>, _> = ImageBuffer::from_raw(
1, 1, vec![0, max / 2, max, max]).unwrap();
let mut encoder = JpegEncoder::new_with_quality(&mut encoded, 100);
encoder.encode_image(&image).unwrap();
let decoded = decode(&encoded);
assert!(decoded[0] > 200, "bad red channel in {:?}", &decoded);
assert!(100 < decoded[1] && decoded[1] < 150, "bad green channel in {:?}", &decoded);
assert!(decoded[2] < 50, "bad blue channel in {:?}", &decoded);
} | rust_cleaned_test_functions.jsonl/4288 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 319
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
31950,
16,
21,
368,
341,
286,
442,
3393,
11170,
458,
79954,
220,
16,
21,
15257,
2168,
624,
1789,
286,
1077,
5206,
20498,
284,
11312,
486,
931,
543,
286,
1077,
1932,
284,
1460,
486,
84,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_box_direct() {
let s: Box<str> = "Hello world!".into();
let _s: &[&dyn ToSql] = crate::params![s];
let r = ToSql::to_sql(&s);
assert!(r.is_ok());
} | rust_cleaned_test_functions.jsonl/124017 | {
"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,
10194,
32871,
368,
341,
286,
1077,
274,
25,
8261,
27,
495,
29,
284,
330,
9707,
1879,
92993,
18122,
543,
286,
1077,
716,
82,
25,
44590,
5,
43085,
2014,
8269,
60,
284,
17717,
486,
3519,
20703,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_skip_error() {
use serde_with::VecSkipError;
#[serde_as]
#[derive(Debug, PartialEq, Deserialize, Serialize)]
struct S {
tag: String,
#[serde_as(as = "VecSkipError<_>")]
values: Vec<u8>,
}
check_deserialization(
S {
tag: "type".into(),
values: vec![0, 1],
},
r#"{"tag":"type","values":[0, "str", 1, [10, 11], -2, {}, 300]}"#,
);
is_equal(
S {
tag: "round-trip".into(),
values: vec![0, 255],
},
expect![[r#"
{
"tag": "round-trip",
"values": [
0,
255
]
}"#]],
);
} | rust_cleaned_test_functions.jsonl/117223 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 430
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
44830,
4096,
368,
341,
262,
990,
61570,
6615,
486,
10050,
35134,
1454,
401,
262,
11506,
47024,
11898,
921,
262,
11506,
27098,
42618,
11,
55039,
11,
48440,
11,
39900,
5563,
262,
2036,
328,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_purge_transaction_status() {
let blockstore_path = get_tmp_ledger_path!();
{
let blockstore = Blockstore::open(&blockstore_path).unwrap();
let transaction_status_index_cf = blockstore.db.column::<cf::TransactionStatusIndex>();
let slot = 10;
for _ in 0..5 {
let random_bytes: Vec<u8> = (0..64).map(|_| rand::random::<u8>()).collect();
blockstore
.write_transaction_status(
slot,
Signature::new(&random_bytes),
vec![&Pubkey::new(&random_bytes[0..32])],
vec![&Pubkey::new(&random_bytes[32..])],
TransactionStatusMeta::default(),
)
.unwrap();
}
// Purge to freeze index 0
blockstore.run_purge(0, 1, PurgeType::PrimaryIndex).unwrap();
let mut status_entry_iterator = blockstore
.db
.iter::<cf::TransactionStatus>(IteratorMode::From(
cf::TransactionStatus::as_index(0),
IteratorDirection::Forward,
))
.unwrap();
for _ in 0..5 {
let entry = status_entry_iterator.next().unwrap().0;
assert_eq!(entry.0, 0);
assert_eq!(entry.2, slot);
}
let mut address_transactions_iterator = blockstore
.db
.iter::<cf::AddressSignatures>(IteratorMode::From(
(0, Pubkey::default(), 0, Signature::default()),
IteratorDirection::Forward,
))
.unwrap();
for _ in 0..10 {
let entry = address_transactions_iterator.next().unwrap().0;
assert_eq!(entry.0, 0);
assert_eq!(entry.2, slot);
}
assert_eq!(
transaction_status_index_cf.get(0).unwrap().unwrap(),
TransactionStatusIndexMeta {
max_slot: 10,
frozen: true,
}
);
// Low purge should not affect state
blockstore.run_purge(0, 5, PurgeType::PrimaryIndex).unwrap();
let mut status_entry_iterator = blockstore
.db
.iter::<cf::TransactionStatus>(IteratorMode::From(
cf::TransactionStatus::as_index(0),
IteratorDirection::Forward,
))
.unwrap();
for _ in 0..5 {
let entry = status_entry_iterator.next().unwrap().0;
assert_eq!(entry.0, 0);
assert_eq!(entry.2, slot);
}
let mut address_transactions_iterator = blockstore
.db
.iter::<cf::AddressSignatures>(IteratorMode::From(
cf::AddressSignatures::as_index(0),
IteratorDirection::Forward,
))
.unwrap();
for _ in 0..10 {
let entry = address_transactions_iterator.next().unwrap().0;
assert_eq!(entry.0, 0);
assert_eq!(entry.2, slot);
}
assert_eq!(
transaction_status_index_cf.get(0).unwrap().unwrap(),
TransactionStatusIndexMeta {
max_slot: 10,
frozen: true,
}
);
// Test boundary conditions: < slot should not purge statuses; <= slot should
blockstore.run_purge(0, 9, PurgeType::PrimaryIndex).unwrap();
let mut status_entry_iterator = blockstore
.db
.iter::<cf::TransactionStatus>(IteratorMode::From(
cf::TransactionStatus::as_index(0),
IteratorDirection::Forward,
))
.unwrap();
for _ in 0..5 {
let entry = status_entry_iterator.next().unwrap().0;
assert_eq!(entry.0, 0);
assert_eq!(entry.2, slot);
}
let mut address_transactions_iterator = blockstore
.db
.iter::<cf::AddressSignatures>(IteratorMode::From(
cf::AddressSignatures::as_index(0),
IteratorDirection::Forward,
))
.unwrap();
for _ in 0..10 {
let entry = address_transactions_iterator.next().unwrap().0;
assert_eq!(entry.0, 0);
assert_eq!(entry.2, slot);
}
assert_eq!(
transaction_status_index_cf.get(0).unwrap().unwrap(),
TransactionStatusIndexMeta {
max_slot: 10,
frozen: true,
}
);
blockstore
.run_purge(0, 10, PurgeType::PrimaryIndex)
.unwrap();
let mut status_entry_iterator = blockstore
.db
.iter::<cf::TransactionStatus>(IteratorMode::From(
cf::TransactionStatus::as_index(0),
IteratorDirection::Forward,
))
.unwrap();
let padding_entry = status_entry_iterator.next().unwrap().0;
assert_eq!(padding_entry.0, 2);
assert_eq!(padding_entry.2, 0);
assert!(status_entry_iterator.next().is_none());
let mut address_transactions_iterator = blockstore
.db
.iter::<cf::AddressSignatures>(IteratorMode::From(
cf::AddressSignatures::as_index(0),
IteratorDirection::Forward,
))
.unwrap();
let padding_entry = address_transactions_iterator.next().unwrap().0;
assert_eq!(padding_entry.0, 2);
assert_eq!(padding_entry.2, 0);
assert!(address_transactions_iterator.next().is_none());
assert_eq!(
transaction_status_index_cf.get(0).unwrap().unwrap(),
TransactionStatusIndexMeta {
max_slot: 0,
frozen: false,
}
);
assert_eq!(
transaction_status_index_cf.get(1).unwrap().unwrap(),
TransactionStatusIndexMeta {
max_slot: 0,
frozen: true,
}
);
}
Blockstore::destroy(&blockstore_path).expect("Expected successful database destruction");
} | rust_cleaned_test_functions.jsonl/38763 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3779
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
39823,
28884,
4773,
368,
341,
286,
1077,
2504,
4314,
2638,
284,
633,
16125,
38367,
1389,
2638,
0,
543,
286,
341,
310,
1077,
2504,
4314,
284,
8362,
4314,
486,
2508,
2099,
4574,
4314,
2638,
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... | 8 |
#[test]
fn test_construct_coord() {
assert!(Coord::new(90.0, 180.0).is_ok());
assert!(Coord::new(91.0, 180.0).is_err());
assert!(Coord::new(90.0, 181.0).is_err());
assert!(Coord::new(91.0, 181.0).is_err());
} | rust_cleaned_test_functions.jsonl/75482 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64803,
30096,
368,
341,
286,
2060,
10297,
19437,
486,
931,
7,
24,
15,
13,
15,
11,
220,
16,
23,
15,
13,
15,
568,
285,
19817,
1423,
286,
2060,
10297,
19437,
486,
931,
7,
24,
16,
13,
15,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eval_restore_havent_saved_initial_context() {
let cie = make_test_cie();
let ctx = UnwindContext::new();
let expected = ctx.clone();
let instructions = [(
Err(Error::CfiInstructionInInvalidContext),
CallFrameInstruction::Restore {
register: Register(0),
},
)];
assert_eval(ctx, expected, cie, None, instructions);
} | rust_cleaned_test_functions.jsonl/9363 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 213
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21296,
62677,
1523,
402,
306,
53709,
15809,
8467,
368,
341,
286,
1077,
272,
645,
284,
1281,
4452,
666,
645,
543,
286,
1077,
5635,
284,
1230,
19154,
1972,
486,
931,
543,
286,
1077,
3601,
284,
563... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fold_useless_for() {
test("for(;false;) { foo() }", "");
test("for(;void 0;) { foo() }", "");
test("for(;undefined;) { foo() }", "");
test("for(;true;) foo() ", "for(;;) foo() ");
test_same("for(;;) foo()");
test("for(;false;) { var a = 0; }", "var a");
test("for(;false;) { const a = 0; }", "");
test("for(;false;) { let a = 0; }", "");
// Make sure it plays nice with minimizing
test("for(;false;) { foo(); continue }", "");
} | rust_cleaned_test_functions.jsonl/377 | {
"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,
61187,
15951,
1717,
5478,
368,
341,
262,
1273,
445,
1958,
54924,
3849,
36174,
314,
15229,
368,
335,
497,
14498,
262,
1273,
445,
1958,
54924,
1004,
220,
15,
36174,
314,
15229,
368,
335,
497,
14498,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_node_update_localreader_after_removed() {
let mut cluster = new_node_cluster(0, 6);
let pd_client = cluster.pd_client.clone();
// Disable default max peer number check.
pd_client.disable_default_operator();
let r1 = cluster.run_conf_change();
// Add 4 peers.
for i in 2..6 {
pd_client.must_add_peer(r1, new_peer(i, i));
}
// Make sure peer 1 leads the region.
cluster.must_transfer_leader(r1, new_peer(1, 1));
let (key, value) = (b"k1", b"v1");
cluster.must_put(key, value);
assert_eq!(cluster.get(key), Some(value.to_vec()));
// Make sure peer 2 is initialized.
let engine_2 = cluster.get_engine(2);
must_get_equal(&engine_2, key, value);
// Pause peer 2 apply worker if it executes AddNode.
let add_node_fp = "apply_on_add_node_1_2";
fail::cfg(add_node_fp, "pause").unwrap();
// Add peer 6.
pd_client.must_add_peer(r1, new_peer(6, 6));
// Isolate peer 2 from rest of the cluster.
cluster.add_send_filter(IsolationFilterFactory::new(2));
// after max_leader_missing_duration timeout.
pd_client.must_remove_peer(r1, new_peer(2, 2));
thread::sleep(cluster.cfg.raft_store.max_leader_missing_duration.0 * 2);
// update region to its read delegate.
fail::remove(add_node_fp);
// Make sure peer 2 is removed in node 2.
cluster.must_region_not_exist(r1, 2);
} | rust_cleaned_test_functions.jsonl/39364 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 580
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5084,
8882,
13564,
11149,
19844,
68248,
368,
341,
262,
1077,
5206,
10652,
284,
501,
5084,
28441,
7,
15,
11,
220,
21,
317,
262,
1077,
7744,
8179,
284,
10652,
556,
67,
8179,
15997,
543,
262,
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_shift() {
let ca = Int32Chunked::new_from_slice("", &[1, 2, 3]);
let shifted = ca.shift(1, &Some(0)).unwrap();
assert_eq!(shifted.cont_slice().unwrap(), &[0, 1, 2]);
let shifted = ca.shift(1, &None).unwrap();
assert_eq!(Vec::from(&shifted), &[None, Some(1), Some(2)]);
let shifted = ca.shift(-1, &None).unwrap();
assert_eq!(Vec::from(&shifted), &[Some(1), Some(2), None]);
assert!(ca.shift(3, &None).is_err());
} | rust_cleaned_test_functions.jsonl/104926 | {
"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,
22230,
368,
341,
286,
1077,
2162,
284,
1333,
18,
17,
28304,
291,
486,
931,
5673,
26488,
19814,
44590,
16,
11,
220,
17,
11,
220,
18,
2558,
286,
1077,
28973,
284,
2162,
29154,
7,
16,
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... | 1 |
#[test]
fn test_changed_truncation_symbol() -> io::Result<()> {
test_truncate_length_with_config(
"1337_hello_world",
15,
"1337_hello_worl",
"%",
"truncation_symbol = \"%\"",
)
} | rust_cleaned_test_functions.jsonl/106748 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 128
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25213,
3547,
1347,
367,
21179,
368,
1464,
6399,
486,
2077,
71698,
341,
262,
1273,
3547,
26900,
5118,
6615,
5332,
1006,
286,
330,
16,
18,
18,
22,
96724,
31792,
756,
286,
220,
16,
20,
345,
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_create_vcpus() {
let vcpu_count = 2;
let guest_memory = create_guest_memory(128).unwrap();
#[allow(unused_mut)]
let mut vm = setup_kvm_vm(&guest_memory, false).unwrap();
let evfd = EventFd::new(libc::EFD_NONBLOCK).unwrap();
#[cfg(target_arch = "x86_64")]
setup_interrupt_controller(&mut vm).unwrap();
let vcpu_vec = create_vcpus(&vm, vcpu_count, &evfd).unwrap();
assert_eq!(vcpu_vec.len(), vcpu_count as usize);
} | rust_cleaned_test_functions.jsonl/117081 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 251
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
2273,
4672,
355,
368,
341,
286,
1077,
348,
16475,
3180,
284,
220,
17,
280,
286,
1077,
8640,
19195,
284,
1855,
62739,
19195,
7,
16,
17,
23,
568,
15454,
1428,
286,
11506,
7183,
18364,
2591,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_build() {
let alphabet = Builder::new()
.with_digits()
.with_uc_letters()
.with_lc_letters()
.with_uc_umlauts()
.with_lc_umlauts()
.with_common_special_chars()
.with_all_other_special_chars()
.build();
let alphabet_2 = Builder::new().full().build();
assert_eq!(
alphabet.len(),
DIGITS.len()
+ LC_LETTERS.len()
+ UC_LETTERS.len()
+ LC_UMLAUTS.len()
+ UC_UMLAUTS.len()
+ ALL_OTHER_SPECIAL_CHARS.len()
+ COMMON_SPECIAL_CHARS.len()
);
assert_eq!(alphabet.len(), alphabet_2.len());
} | rust_cleaned_test_functions.jsonl/25968 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 456
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20801,
368,
341,
286,
1077,
27790,
284,
20626,
486,
931,
741,
310,
659,
4197,
41432,
741,
310,
659,
4197,
68887,
67330,
741,
310,
659,
4197,
93057,
67330,
741,
310,
659,
4197,
68887,
62,
42231,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_dot_lookup() -> TestResult {
let p = Polar::new();
p.load_str(
r#"f(x, y) if x = y.a.b.c;
f(x, y) if x > y.a.b.c and x < y.a.b and y.a.b.c > x;
f(x, y) if x = y.a;
f(x, y) if x = y.a.b;
f(x, y) if x = y.a.b.c.d;
f(x, y) if x = y.a.b.c.d.e;
f(x, y) if x = y.a.b.c.d.e.f;"#,
)?;
let mut q = p.new_query_from_term(term!(call!("f", [1, sym!("y")])), false);
assert_partial_expression!(next_binding(&mut q)?, "y", "1 = _this.a.b.c");
assert_partial_expression!(
next_binding(&mut q)?,
"y",
"1 > _this.a.b.c and 1 < _this.a.b and _this.a.b.c > 1"
);
assert_partial_expression!(next_binding(&mut q)?, "y", "1 = _this.a");
assert_partial_expression!(next_binding(&mut q)?, "y", "1 = _this.a.b");
assert_partial_expression!(next_binding(&mut q)?, "y", "1 = _this.a.b.c.d");
assert_partial_expression!(next_binding(&mut q)?, "y", "1 = _this.a.b.c.d.e");
assert_partial_expression!(next_binding(&mut q)?, "y", "1 = _this.a.b.c.d.e.f");
assert_query_done!(q);
Ok(())
} | rust_cleaned_test_functions.jsonl/63041 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 728
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66279,
30941,
27464,
368,
1464,
3393,
2077,
341,
286,
1077,
281,
284,
55896,
486,
931,
543,
286,
281,
5104,
2895,
1006,
310,
435,
55543,
69,
2075,
11,
379,
8,
421,
856,
284,
379,
5849,
948,
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... | 9 |
#[test]
fn test_err_swap_no_memory() {
let tmp =
create_temp_dir("test_err_swap_no_memory_v2").expect("create temp directory for test");
set_fixture(&tmp, CGROUP_MEMORY_MAX, "0").expect("set fixture for memory limit");
set_fixture(&tmp, CGROUP_MEMORY_LOW, "0").expect("set fixture for memory reservation");
set_fixture(&tmp, CGROUP_MEMORY_SWAP, "0").expect("set fixture for swap limit");
let memory_limits = &LinuxMemory {
limit: None,
swap: Some(512),
reservation: None,
kernel: None,
kernel_tcp: None,
swappiness: None,
};
let result = Memory::apply(&tmp, memory_limits);
assert!(result.is_err());
} | rust_cleaned_test_functions.jsonl/79408 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 357
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9266,
40991,
6536,
19195,
368,
341,
286,
1077,
4174,
4035,
310,
1855,
11771,
4334,
445,
1944,
9266,
40991,
6536,
19195,
2273,
17,
1827,
17119,
445,
3182,
2730,
6220,
369,
1273,
797,
286,
738,
7440... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_update_from_defaults() {
let null = Config::default();
let defaulted = Config::from_defaults();
let mut actual = null;
actual.update(&defaulted);
assert_eq!(actual, defaulted);
} | rust_cleaned_test_functions.jsonl/4426 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 108
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
5673,
42290,
368,
341,
286,
1077,
845,
284,
5532,
486,
2258,
543,
286,
1077,
92989,
284,
5532,
486,
1499,
42290,
1428,
286,
1077,
5206,
5042,
284,
845,
280,
286,
5042,
5317,
2099,
2258,
29... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_sources_1() {
let err = ParentError::Nested(ChildError::Error1);
let result = err.into_call_result();
match result {
CallResult::Failed {
module,
code,
message: _,
} => {
assert_eq!(module, "test1");
assert_eq!(code, 1);
}
_ => panic!("expected failed result, got: {:?}", result),
}
let err = ParentError::Nested(ChildError::Error2);
let result = err.into_call_result();
match result {
CallResult::Failed {
module,
code,
message: _,
} => {
assert_eq!(module, "test1");
assert_eq!(code, 2);
}
_ => panic!("expected failed result, got: {:?}", result),
}
} | rust_cleaned_test_functions.jsonl/44656 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 517
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4096,
52896,
62,
16,
368,
341,
286,
1077,
1848,
284,
17022,
1454,
486,
71986,
7,
3652,
1454,
486,
1454,
16,
317,
286,
1077,
1102,
284,
1848,
39860,
13429,
5287,
1428,
286,
2432,
1102,
341,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_legal_moves_banmen_with_kei_nari_7_squares_gote() {
test_legal_moves_banmen_with_kin_7_squares_gote_impl(GKeiN)
} | rust_cleaned_test_functions.jsonl/81289 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 74
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82324,
45390,
880,
276,
5676,
6615,
45476,
72,
1089,
2780,
62,
22,
643,
40856,
1889,
1272,
368,
972,
18185,
82324,
45390,
880,
276,
5676,
6615,
4698,
258,
62,
22,
643,
40856,
1889,
1272,
21007,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_preferred() {
assert_preference!("text/*", "text/*");
assert_preference!("text/*, text/html", "text/html");
assert_preference!("text/*; q=0.1, text/html", "text/html");
assert_preference!("text/*; q=1, text/html", "text/html");
assert_preference!("text/html, text/*", "text/html");
assert_preference!("text/*, text/html", "text/html");
assert_preference!("text/html, text/*; q=1", "text/html");
assert_preference!("text/html; q=1, text/html", "text/html");
assert_preference!("text/html, text/*; q=0.1", "text/html");
assert_preference!("text/html, application/json", "text/html");
assert_preference!("text/html, application/json; q=1", "text/html");
assert_preference!("application/json; q=1, text/html", "text/html");
assert_preference!("text/*, application/json", "application/json");
assert_preference!("*/*, text/*", "text/*");
assert_preference!("*/*, text/*, text/plain", "text/plain");
assert_preference!("a/b; q=0.1, a/b; q=0.2", "a/b; q=0.2");
assert_preference!("a/b; q=0.1, b/c; q=0.2", "b/c; q=0.2");
assert_preference!("a/b; q=0.5, b/c; q=0.2", "a/b; q=0.5");
assert_preference!("a/b; q=0.5, b/c; q=0.2, c/d", "c/d");
assert_preference!("a/b; q=0.5; v=1, a/b", "a/b");
assert_preference!("a/b; v=1, a/b; v=1; c=2", "a/b; v=1; c=2");
assert_preference!("a/b; v=1; c=2, a/b; v=1", "a/b; v=1; c=2");
assert_preference!("a/b; q=0.5; v=1, a/b; q=0.5; v=1; c=2",
"a/b; q=0.5; v=1; c=2");
assert_preference!("a/b; q=0.6; v=1, a/b; q=0.5; v=1; c=2",
"a/b; q=0.6; v=1");
} | rust_cleaned_test_functions.jsonl/19938 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 904
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10442,
5554,
368,
341,
286,
2060,
92718,
17223,
1318,
1057,
497,
330,
1318,
1057,
797,
286,
2060,
92718,
17223,
1318,
1057,
11,
1467,
13739,
497,
330,
1318,
13739,
797,
286,
2060,
92718,
17223,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.