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_stack_trace_display() {
let mut frames = Vec::new();
frames.push(StackFrame::new(
Some("module".to_string()),
Some("name".to_string()),
Some("filename".to_string()),
Some("relative_path".to_string()),
Some("absolute_path".to_string()),
Some(1),
));
frames.push(StackFrame::new(
Some("module".to_string()),
Some("name".to_string()),
Some("filename".to_string()),
Some("relative_path".to_string()),
Some("absolute_path".to_string()),
Some(2),
));
let stack_trace = StackTrace::new(None, None, None, frames);
assert_eq!(
format!("{}", stack_trace),
"filename:2 - name;filename:1 - name"
);
} | rust_cleaned_test_functions.jsonl/124440 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 349
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15528,
23575,
14825,
368,
341,
262,
1077,
5206,
14087,
284,
11312,
486,
931,
543,
262,
14087,
2552,
94125,
4369,
486,
931,
1006,
286,
4329,
445,
4352,
3263,
983,
3904,
14702,
286,
4329,
445,
606,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_conn_initial_windows() {
let conn = HttpConnection::new(HttpScheme::Http);
assert_eq!(conn.in_window_size(), 65_535);
assert_eq!(conn.out_window_size(), 65_535);
} | rust_cleaned_test_functions.jsonl/131342 | {
"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,
17241,
15809,
58220,
368,
341,
286,
1077,
4534,
284,
4823,
4526,
486,
931,
12286,
28906,
486,
2905,
317,
286,
2060,
10714,
10297,
5148,
1858,
12571,
2368,
1507,
220,
21,
20,
62,
20,
18,
20,
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_fold_at_word_boundary_only_whitespace() {
new_ucmd!()
.args(&["-w2", "-s"])
.pipe_in(" ")
.succeeds()
.stdout_is(" \n ");
} | rust_cleaned_test_functions.jsonl/23287 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
61187,
3752,
13533,
54004,
18410,
86175,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
12,
86,
17,
497,
6523,
82,
14108,
286,
659,
13768,
1243,
445,
262,
14167,
286,
659,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_unicode_escapes() {
assert_eq!("\u{35}", decode_unicode_escapes(r"\u{35}"));
assert_eq!("5", decode_unicode_escapes(r"\u{35}"));
assert_eq!("\u{5}", decode_unicode_escapes(r"\u{5}"));
assert_eq!("\"", decode_unicode_escapes(r"\u{22}"));
} | rust_cleaned_test_functions.jsonl/131812 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 162
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54662,
92196,
9337,
368,
341,
286,
2060,
10714,
0,
4921,
84,
90,
18,
20,
9545,
16895,
54662,
92196,
9337,
2601,
11934,
84,
90,
18,
20,
92,
4010,
286,
2060,
10714,
17223,
20,
497,
16895,
54662,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_assembler_unsigned_ops() {
test_case(&["ADD [X], [Y]"], &[0x3162]);
test_case(&["SUB [0], Z"], &[0x17c3]);
test_case(&["MUL [1234], 3"], &[0x93c4, 0x04d2]);
test_case(&["DIV A, J"], &[0x1c06]);
test_case(&["MOD [B], 10"], &[0xad28]);
} | rust_cleaned_test_functions.jsonl/44757 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 147
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
35401,
67830,
21959,
368,
341,
262,
1273,
19096,
2099,
1183,
15665,
508,
55,
1125,
508,
56,
60,
7914,
44590,
15,
87,
18,
16,
21,
17,
2558,
262,
1273,
19096,
2099,
1183,
29038,
508,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fasttext_tokenize() {
let fasttext = FastText::default();
let tokens = fasttext.tokenize("I love banana").unwrap();
assert_eq!(tokens, ["I", "love", "banana"]);
let tokens = fasttext.tokenize("不支持中文").unwrap();
assert_eq!(tokens, ["不支持中文"]);
} | rust_cleaned_test_functions.jsonl/118638 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35743,
1318,
86508,
368,
341,
286,
1077,
4937,
1318,
284,
17288,
1178,
486,
2258,
543,
286,
1077,
11211,
284,
4937,
1318,
96790,
445,
40,
2948,
43096,
1827,
15454,
543,
286,
2060,
10714,
10297,
30... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_format() {
let tests = vec![
(
"2010-01-07 23:12:34.12345",
"%b %M %m %c %D %d %e %j %k %h %i %p %r %T %s %f %U %u
%V %v %a %W %w %X %x %Y %y %%",
"Jan January 01 1 7th 07 7 007 23 11 12 PM 11:12:34 PM 23:12:34 34 123450 01 01
01 01 Thu Thursday 4 2010 2010 2010 10 %",
),
(
"2012-12-21 23:12:34.123456",
"%b %M %m %c %D %d %e %j %k %h %i %p %r %T %s %f %U
%u %V %v %a %W %w %X %x %Y %y %%",
"Dec December 12 12 21st 21 21 356 23 11 12 PM 11:12:34 PM 23:12:34 34 123456 51
51 51 51 Fri Friday 5 2012 2012 2012 12 %",
),
(
"0000-01-01 00:00:00.123456",
"%b %M %m %c %D %d %e %j %k %h %i %p %r %T %s %f %v
%x %Y %y %%",
"Jan January 01 1 1st 01 1 001 0 12 00 AM 12:00:00 AM 00:00:00 00 123456 52
4294967295 0000 00 %",
),
(
"2016-09-3 00:59:59.123456",
"abc%b %M %m %c %D %d %e %j %k %h %i %p %r %T %s %f %U
%u %V %v %a %W %w %X %x %Y %y!123 %%xyz %z",
"abcSep September 09 9 3rd 03 3 247 0 12 59 AM 12:59:59 AM 00:59:59 59 123456 35
35 35 35 Sat Saturday 6 2016 2016 2016 16!123 %xyz z",
),
(
"2012-10-01 00:00:00",
"%b %M %m %c %D %d %e %j %k %H %i %p %r %T %s %f %v
%x %Y %y %%",
"Oct October 10 10 1st 01 1 275 0 00 00 AM 12:00:00 AM 00:00:00 00 000000 40
2012 2012 12 %",
),
];
let mut ctx = EvalContext::default();
for (arg1, arg2, exp) in tests {
let arg1 = datum_expr(Datum::Time(Time::parse_utc_datetime(arg1, 6).unwrap()));
let arg2 = datum_expr(Datum::Bytes(arg2.to_string().into_bytes()));
let f = fncall_expr(ScalarFuncSig::DateFormatSig, &[arg1, arg2]);
let op = Expression::build(&mut ctx, f).unwrap();
let got = op.eval(&mut ctx, &[]).unwrap();
assert_eq!(got, Datum::Bytes(exp.to_string().into_bytes()));
}
} | rust_cleaned_test_functions.jsonl/33098 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1410
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4164,
8955,
368,
341,
286,
1077,
7032,
284,
7486,
90515,
310,
2399,
394,
330,
17,
15,
16,
15,
12,
15,
16,
12,
15,
22,
220,
17,
18,
25,
16,
17,
25,
18,
19,
13,
16,
17,
18,
19,
20,
756,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_value_slice_no_bounds_check() {
let arr = Int32Array::from(vec![2, 3, 4]);
let _slice = arr.value_slice(0, 4);
} | rust_cleaned_test_functions.jsonl/11590 | {
"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,
3142,
26488,
6536,
36878,
7200,
368,
341,
286,
1077,
2890,
284,
1333,
18,
17,
1857,
486,
1499,
25592,
20703,
17,
11,
220,
18,
11,
220,
19,
2558,
286,
1077,
716,
24963,
284,
2890,
2824,
26488,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_generate_file_hash() {
let tmp_dir = TempDir::new("test_generate_file_hash").unwrap();
let mut tmp_dir_path = tmp_dir.path().to_owned();
tmp_dir_path.push(".env");
let mut tmp_file = fs::File::create(&tmp_dir_path).unwrap();
tmp_file.write_all(b"ENV=test").unwrap();
assert_eq!(generate_file_hash(&tmp_dir_path).is_ok(), true);
} | rust_cleaned_test_functions.jsonl/38367 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48851,
2458,
8950,
368,
341,
286,
1077,
4174,
4334,
284,
19944,
6184,
486,
931,
445,
1944,
48851,
2458,
8950,
1827,
15454,
543,
286,
1077,
5206,
4174,
4334,
2638,
284,
4174,
4334,
3875,
1005,
983,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_solid_regex_only() {
let mut cmd = assert_cmd::Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap();
cmd.args(&["-s", "-og", "2", "sed", "s/./A/"])
.write_stdin("118\n119\n120\n121\n")
.assert()
.stdout("118\n119\n1A0\n1A1\n");
} | rust_cleaned_test_functions.jsonl/7894 | {
"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,
643,
5192,
41832,
18410,
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,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_symlink() -> Result<(), Box<dyn std::error::Error>> {
let logdir = tempfile::tempdir()?;
let train_dir = logdir.path().join("train");
let test_dir = logdir.path().join("test");
fs::create_dir(&train_dir)?;
std::os::unix::fs::symlink(&train_dir, &test_dir)?;
File::create(train_dir.join(EVENT_FILE_BASENAME_INFIX))?;
let commit = Commit::new();
let mut loader = LogdirLoader::new(&commit, logdir.path().to_path_buf());
loader.reload();
assert_eq!(
loader.runs.keys().collect::<HashSet<_>>(),
vec![&Run("test".to_string()), &Run("train".to_string())]
.into_iter()
.collect::<HashSet<_>>(),
);
Ok(())
} | rust_cleaned_test_functions.jsonl/76039 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 386
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58530,
44243,
368,
1464,
5714,
68843,
8261,
92846,
1460,
486,
841,
486,
1454,
2452,
341,
286,
1077,
1487,
3741,
284,
54819,
486,
3888,
3741,
94136,
286,
1077,
5426,
4334,
284,
1487,
3741,
3875,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_subset_and_superset() {
let mut a = HashSet::new();
assert!(a.insert(0));
assert!(a.insert(5));
assert!(a.insert(11));
assert!(a.insert(7));
let mut b = HashSet::new();
assert!(b.insert(0));
assert!(b.insert(7));
assert!(b.insert(19));
assert!(b.insert(250));
assert!(b.insert(11));
assert!(b.insert(200));
assert!(!a.is_subset(&b));
assert!(!a.is_superset(&b));
assert!(!b.is_subset(&a));
assert!(!b.is_superset(&a));
assert!(b.insert(5));
assert!(a.is_subset(&b));
assert!(!a.is_superset(&b));
assert!(!b.is_subset(&a));
assert!(b.is_superset(&a));
} | rust_cleaned_test_functions.jsonl/5396 | {
"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,
47532,
8378,
23723,
44146,
368,
341,
286,
1077,
5206,
264,
284,
18931,
486,
931,
543,
286,
2060,
10297,
64,
7030,
7,
15,
1106,
286,
2060,
10297,
64,
7030,
7,
20,
1106,
286,
2060,
10297,
64,
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_read_text_no_case() {
let mut reader = ParserInput::new("This is a text");
let result = read_text_no_case("tHIS")(&mut reader);
assert_eq!(result, Ok("This"));
let result = read_text_no_case(" iS ")(&mut reader);
assert_eq!(result, Ok(" is "));
let result = read_text_no_case(" And")(&mut reader);
assert_eq!(result, Err(ParserResultError::NotFound));
} | rust_cleaned_test_functions.jsonl/10085 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 194
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
4326,
6536,
19096,
368,
341,
286,
1077,
5206,
6604,
284,
21102,
2505,
486,
931,
445,
1986,
374,
264,
1467,
3071,
286,
1077,
1102,
284,
1349,
4326,
6536,
19096,
445,
83,
39,
1637,
899,
2099... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_check_len() {
let bytes = [0x0b, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00];
assert_eq!(Packet::new_checked(&[]), Err(Error::Truncated));
assert_eq!(Packet::new_checked(&bytes[..4]), Err(Error::Truncated));
assert!(Packet::new_checked(&bytes[..]).is_ok());
} | rust_cleaned_test_functions.jsonl/70650 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 179
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
6043,
368,
341,
286,
1077,
5820,
284,
508,
15,
87,
15,
65,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
345,
3824,
220,
15,
87,
15,
15,
11,
220,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_inspect_log_var_key_syntax() {
let (inspector, mut node) = inspector_and_list_node();
let key = "@@@";
inspect_log!(node, var key: "!!!");
assert_inspect_tree!(inspector, root: {
list_node: {
"0": {
"@time": AnyProperty,
"@@@": "!!!"
}
}
});
} | rust_cleaned_test_functions.jsonl/90891 | {
"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,
34386,
987,
5224,
4612,
3097,
78894,
368,
341,
286,
1077,
320,
1330,
18997,
11,
5206,
2436,
8,
284,
44725,
8378,
2019,
5084,
543,
286,
1077,
1376,
284,
8428,
19191,
876,
286,
24085,
5224,
10297,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_set_foreground() {
let mut color = TextModeColor::new(Color16::Yellow, Color16::Black);
color.set_foreground(Color16::Red);
assert_eq!(color.0 & 0x0F, Color16::Red as u8);
} | rust_cleaned_test_functions.jsonl/4898 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 103
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
35563,
1951,
368,
341,
286,
1077,
5206,
1894,
284,
2918,
3636,
1636,
486,
931,
15028,
16,
21,
486,
47699,
11,
3478,
16,
21,
486,
14417,
317,
286,
1894,
980,
35563,
1951,
15028,
16,
21,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serial_null() {
let focal = UbuntuDiskConfig::new(FOCAL_IMAGE_NAME.to_string());
let guest = Guest::new(Box::new(focal));
let mut cmd = GuestCommand::new(&guest);
#[cfg(target_arch = "x86_64")]
let console_str: &str = "console=ttyS0";
#[cfg(target_arch = "aarch64")]
let console_str: &str = "console=ttyAMA0";
cmd.args(&["--cpus", "boot=1"])
.args(&["--memory", "size=512M"])
.args(&["--kernel", direct_kernel_boot_path().to_str().unwrap()])
.args(&[
"--cmdline",
DIRECT_KERNEL_BOOT_CMDLINE
.replace("console=hvc0 ", console_str)
.as_str(),
])
.default_disks()
.default_net()
.args(&["--serial", "null"])
.args(&["--console", "off"])
.capture_output();
let mut child = cmd.spawn().unwrap();
let r = std::panic::catch_unwind(|| {
guest.wait_vm_boot(None).unwrap();
// Test that there is a ttyS0
assert_eq!(
guest
.ssh_command(GREP_SERIAL_IRQ_CMD)
.unwrap()
.trim()
.parse::<u32>()
.unwrap_or_default(),
1
);
});
let _ = child.kill();
let output = child.wait_with_output().unwrap();
handle_child_output(r, &output);
let r = std::panic::catch_unwind(|| {
assert!(!String::from_utf8_lossy(&output.stdout).contains(CONSOLE_TEST_STRING));
});
handle_child_output(r, &output);
} | rust_cleaned_test_functions.jsonl/26149 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 958
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25602,
15162,
368,
341,
286,
1077,
41099,
284,
34960,
47583,
2648,
486,
931,
7,
3788,
49533,
19121,
4708,
2389,
3904,
1423,
286,
1077,
8640,
284,
26215,
486,
931,
67758,
486,
931,
955,
3683,
1106,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_debug() {
let list: ImmutSList<i32> = range(0, 10).rev().collect();
assert_eq!(format!("{:?}", list), "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]");
let list: ImmutSList<&str> = vec!["just", "one", "test", "more"].iter()
.rev()
.map(|&s| s)
.collect();
assert_eq!(format!("{:?}", list), r#"["just", "one", "test", "more"]"#);
} | rust_cleaned_test_functions.jsonl/64468 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 391
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15446,
368,
341,
286,
1077,
1140,
25,
2362,
6984,
50,
852,
21897,
18,
17,
29,
284,
2088,
7,
15,
11,
220,
16,
15,
568,
7282,
1005,
17384,
543,
286,
2060,
10714,
10297,
2243,
88928,
25,
52652,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_js_doc_tag_typed() {
assert_eq!(
serde_json::to_value(JsDoc::from(
"@enum {string} more doc\n\nnew paragraph".to_string()
))
.unwrap(),
json!({
"tags": [{
"kind": "enum",
"type": "string",
"doc": "more doc\n\nnew paragraph"
}]
})
);
assert_eq!(
serde_json::to_value(JsDoc::from(
"@extends {string} more doc\n\nnew paragraph".to_string()
))
.unwrap(),
json!({
"tags": [{
"kind": "extends",
"type": "string",
"doc": "more doc\n\nnew paragraph"
}]
})
);
assert_eq!(
serde_json::to_value(JsDoc::from(
"@augments {string} more doc\n\nnew paragraph".to_string()
))
.unwrap(),
json!({
"tags": [{
"kind": "extends",
"type": "string",
"doc": "more doc\n\nnew paragraph"
}]
})
);
assert_eq!(
serde_json::to_value(JsDoc::from(
"@this {string} more doc\n\nnew paragraph".to_string()
))
.unwrap(),
json!({
"tags": [{
"kind": "this",
"type": "string",
"doc": "more doc\n\nnew paragraph"
}]
})
);
assert_eq!(
serde_json::to_value(JsDoc::from(
"@type {string} more doc\n\nnew paragraph".to_string()
))
.unwrap(),
json!({
"tags": [{
"kind": "type",
"type": "string",
"doc": "more doc\n\nnew paragraph"
}]
})
);
} | rust_cleaned_test_functions.jsonl/119527 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 886
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26250,
18869,
9372,
528,
32501,
368,
341,
262,
2060,
10714,
33673,
414,
61570,
9455,
486,
983,
3142,
16368,
82,
9550,
486,
1499,
1006,
286,
8428,
9018,
314,
917,
92,
803,
4629,
1699,
1699,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simple_operator_neq_encrypted_to_string() {
let name1 = _random_vector(10);
let value1 = _random_vector(10);
let query = Operator::Neq(
TagName::EncryptedTagName(name1.clone()),
TargetValue::Encrypted(value1.clone())
);
let json = query.to_string();
let expected = format!(r#"{{"{}":{{"$neq":"{}"}}}}"#, base64::encode(&name1), base64::encode(&value1));
assert_eq!(json, expected);
} | rust_cleaned_test_functions.jsonl/11879 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 232
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
40594,
13925,
80,
13781,
14026,
2346,
3904,
368,
341,
286,
1077,
829,
16,
284,
716,
11463,
12247,
7,
16,
15,
317,
286,
1077,
897,
16,
284,
716,
11463,
12247,
7,
16,
15,
626,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_start_microvm_error_conversion_mv() {
assert_eq!(
error_kind(StartMicrovmError::MicroVMAlreadyRunning),
ErrorKind::User
);
assert_eq!(
error_kind(StartMicrovmError::MissingKernelConfig),
ErrorKind::User
);
assert_eq!(
error_kind(StartMicrovmError::NetDeviceNotConfigured),
ErrorKind::User
);
assert_eq!(
error_kind(StartMicrovmError::OpenBlockDevice(
io::Error::from_raw_os_error(0)
)),
ErrorKind::User
);
assert_eq!(
error_kind(StartMicrovmError::RegisterBlockDevice(
device_manager::mmio::Error::IrqsExhausted
)),
ErrorKind::Internal
);
assert_eq!(
error_kind(StartMicrovmError::RegisterEvent),
ErrorKind::Internal
);
assert_eq!(
error_kind(StartMicrovmError::RegisterNetDevice(
device_manager::mmio::Error::IrqsExhausted
)),
ErrorKind::Internal
);
assert_eq!(
error_kind(StartMicrovmError::RegisterMMIODevice(
device_manager::mmio::Error::IrqsExhausted
)),
ErrorKind::Internal
);
#[cfg(feature = "vsock")]
assert_eq!(
error_kind(StartMicrovmError::RegisterVsockDevice(
device_manager::mmio::Error::IrqsExhausted
)),
ErrorKind::Internal
);
assert_eq!(
error_kind(StartMicrovmError::SeccompFilters(
seccomp::Error::InvalidArgumentNumber
)),
ErrorKind::Internal
);
assert_eq!(
error_kind(StartMicrovmError::Vcpu(vstate::Error::VcpuUnhandledKvmExit)),
ErrorKind::Internal
);
assert_eq!(
error_kind(StartMicrovmError::VcpuConfigure(
vstate::Error::SetSupportedCpusFailed(io::Error::from_raw_os_error(0))
)),
ErrorKind::Internal
);
assert_eq!(
error_kind(StartMicrovmError::VcpusNotConfigured),
ErrorKind::User
);
assert_eq!(
error_kind(StartMicrovmError::VcpuSpawn(io::Error::from_raw_os_error(
0
))),
ErrorKind::Internal
);
} | rust_cleaned_test_functions.jsonl/93133 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1319
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4906,
73003,
7338,
4096,
64132,
73187,
368,
341,
286,
2060,
10714,
33673,
310,
1465,
33162,
7,
3479,
34609,
7338,
1454,
486,
34609,
11187,
38370,
18990,
1326,
310,
4600,
10629,
486,
1474,
198,
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_bit_iterator_e() {
let test_vector = [0xa953_d79b_83f6_ab59, 0x6dea_2059_e200_bd39];
let mut reference: Vec<bool> = BitIterator::new(&test_vector).collect();
reference.reverse();
let out: Vec<bool> = BitIteratorLe::new(&test_vector).collect();
assert_eq!(reference, out);
} | rust_cleaned_test_functions.jsonl/112656 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 155
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13996,
13491,
2204,
368,
341,
286,
1077,
1273,
12247,
284,
508,
15,
9591,
24,
20,
18,
814,
22,
24,
65,
62,
23,
18,
69,
21,
22885,
20,
24,
11,
220,
15,
87,
21,
55088,
62,
17,
15,
20,
24,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_string_at_position_f() {
let example: Vec<char> = "a".to_string().chars().collect();
assert!(!is_string_at_position(&example, 3, ""));
} | rust_cleaned_test_functions.jsonl/126890 | {
"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,
6892,
3904,
3752,
9661,
761,
368,
341,
286,
1077,
3110,
25,
11312,
21919,
29,
284,
330,
64,
3263,
983,
3904,
1005,
19255,
1005,
17384,
543,
286,
2060,
0,
3471,
285,
3904,
3752,
9661,
2099,
8687,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_invalid_more_data_type() {
let input = to_chars("serial32");
let ret = data_type().parse(&input);
println!("{:#?}", ret);
assert!(ret.is_err());
let err = ret.err().unwrap();
println!("{}", err);
assert!(err.to_string().contains(r#"InvalidDataType("serial32")"#))
} | rust_cleaned_test_functions.jsonl/57921 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 169
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
36664,
1769,
1819,
368,
341,
286,
1077,
1946,
284,
311,
37418,
445,
10182,
18,
17,
797,
286,
1077,
2112,
284,
821,
1819,
1005,
6400,
2099,
1355,
317,
286,
13751,
88928,
14111,
52652,
2112,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_new_ledger() {
let mint_total = 1_000_000_000_000;
let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(mint_total);
let (ledger_path, _blockhash) = create_new_tmp_ledger!(&genesis_config);
let ledger = Blocktree::open(&ledger_path).unwrap();
let ticks = create_ticks(genesis_config.ticks_per_slot, 0, genesis_config.hash());
let entries = ledger.get_slot_entries(0, 0, None).unwrap();
assert_eq!(ticks, entries);
// Destroying database without closing it first is undefined behavior
drop(ledger);
Blocktree::destroy(&ledger_path).expect("Expected successful database destruction");
} | rust_cleaned_test_functions.jsonl/116882 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 282
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
5921,
38367,
1389,
368,
341,
286,
1077,
28337,
10784,
284,
220,
16,
62,
15,
15,
15,
62,
15,
15,
15,
62,
15,
15,
15,
62,
15,
15,
15,
280,
286,
1077,
40788,
2648,
1731,
314,
59366,
533... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vec_into() {
extern crate std;
let vec = vec![0u8; 0];
let _x: untrusted::Input = (&vec[..]).into();
} | rust_cleaned_test_functions.jsonl/27452 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 67
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
45514,
368,
341,
262,
15637,
17717,
1460,
280,
262,
1077,
7486,
284,
7486,
20703,
15,
84,
23,
26,
220,
15,
935,
262,
1077,
716,
87,
25,
650,
83837,
486,
2505,
284,
15899,
4083,
95874,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_process_register_bad_message() {
let mut rng = ThreadRng256 {};
let dummy_user_presence = |_| panic!("Unexpected user presence check in CTAP1");
let mut ctap_state = CtapState::new(&mut rng, dummy_user_presence, START_CLOCK_VALUE);
let application = [0x0A; 32];
let message = create_register_message(&application);
let response = Ctap1Command::process_command(
&message[..message.len() - 1],
&mut ctap_state,
START_CLOCK_VALUE,
);
assert_eq!(response, Err(Ctap1StatusCode::SW_WRONG_LENGTH));
} | rust_cleaned_test_functions.jsonl/55437 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 277
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
14000,
34199,
6462,
368,
341,
286,
1077,
5206,
28422,
284,
8752,
49,
968,
17,
20,
21,
9321,
286,
1077,
17292,
3317,
56403,
284,
66091,
21975,
17223,
29430,
1196,
9362,
1779,
304,
18572,
253... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_push() {
let mut data = String::from_str("ประเทศไทย中");
data.push('华');
data.push('b'); // 1 byte
data.push('¢'); // 2 byte
data.; // 3 byte
data.pu// 4 byte
assert_eq!ระเทศไทย中华b¢€𤭢");
} | rust_cleaned_test_functions.jsonl/52 | {
"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,
14218,
368,
341,
286,
1077,
5206,
821,
284,
923,
486,
1499,
2895,
445,
130391,
15946,
797,
286,
821,
2552,
492,
85361,
1157,
286,
821,
2552,
492,
65,
4667,
442,
220,
16,
4922,
198,
286,
821,
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_append_vec_sanitize_len_and_size_larger_current_len() {
const LEN: usize = 1024 * 1024 + 1;
const SIZE: usize = 1024 * 1024;
let result = AppendVec::sanitize_len_and_size(LEN, SIZE);
assert_matches!(result, Err(ref message) if message.to_string() == *"current_len is larger than file size (1048576)");
} | rust_cleaned_test_functions.jsonl/5416 | {
"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,
26041,
13251,
643,
58652,
6043,
8378,
2368,
907,
41776,
11080,
6043,
368,
341,
286,
733,
83099,
25,
22301,
284,
220,
16,
15,
17,
19,
353,
220,
16,
15,
17,
19,
488,
220,
16,
280,
286,
733,
25... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_definition_value() {
assert_eq!(
Value::Symbol("value".into()),
definition_value(parse("(define test value)"))
);
assert_eq!(
Value::List(vec![
Value::Symbol("lambda".into()),
Value::List(vec![Value::Symbol("a".into())]),
Value::Symbol("b".into()),
Value::Symbol("c".into()),
]),
definition_value(parse("(define (test a) b c)"))
);
assert_eq!(
Value::List(vec![
Value::Symbol("lambda".into()),
Value::List(vec![Value::Symbol("a".into())]),
Value::List(vec![Value::Symbol("b".into()), Value::Symbol("c".into())]),
]),
definition_value(parse("(define (test a) (b c))"))
);
} | rust_cleaned_test_functions.jsonl/14326 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 475
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31698,
3142,
368,
341,
286,
2060,
10714,
33673,
310,
5162,
486,
15090,
445,
957,
3263,
18122,
14702,
310,
7271,
3142,
27762,
31732,
1289,
1273,
897,
8,
5455,
286,
1439,
286,
2060,
10714,
33673,
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... | 1 |
#[test]
fn test_view_mut_from_shape_ptr_deny_neg_strides() {
let mut data = [0, 1, 2, 3, 4, 5];
let _view = unsafe {
ArrayViewMut::from_shape_ptr((2, 3).strides((-3isize as usize, 1)), data.as_mut_ptr())
};
} | rust_cleaned_test_functions.jsonl/92629 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7122,
29523,
5673,
13597,
4348,
814,
32395,
28209,
2895,
3341,
368,
341,
262,
1077,
5206,
821,
284,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
262,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_atomic_writes() {
let lock = Arc::new(RwLock::<usize>::default());
let t = 100;
let mut threads = Vec::new();
for _i in 0..t {
let l = lock.clone();
let child = thread::spawn(move || {
let mut ele = l.write(t);
*ele += 1;
});
threads.push(child);
}
for _i in 0..threads.len() {
let _retval = threads
.pop()
.unwrap()
.join()
.expect("Thread didn't finish successfully.");
}
assert_eq!(unsafe { *lock.data.get() }, t);
} | rust_cleaned_test_functions.jsonl/77528 | {
"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,
51367,
1670,
23262,
368,
341,
286,
1077,
5296,
284,
19689,
486,
931,
2785,
86,
11989,
27638,
51878,
6831,
2258,
1423,
286,
1077,
259,
284,
220,
16,
15,
15,
401,
286,
1077,
5206,
14564,
284,
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... | 4 |
#[test]
fn test_is_acyclic_should_return_true_for_acyclic_graph() {
let graph = {
let mut graph = Graph::new();
graph.insert_vertex(1).unwrap();
graph.insert_vertex(2).unwrap();
graph.insert_vertex(3).unwrap();
graph.insert_edge((1, 2)).unwrap();
graph.insert_edge((1, 3)).unwrap();
graph.insert_edge((2, 3)).unwrap();
graph
};
assert!(graph.is_acyclic(1));
} | rust_cleaned_test_functions.jsonl/1493 | {
"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,
6892,
62,
2757,
66,
415,
43378,
12511,
16082,
5478,
62,
2757,
66,
415,
14738,
368,
341,
286,
1077,
4771,
284,
341,
310,
1077,
5206,
4771,
284,
12165,
486,
931,
1428,
310,
4771,
7030,
26611,
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_transcript() {
let mut t = Transcript::<Bls12>::new("test");
let g1 = G1Affine::generator();
let g2 = G2Affine::generator();
let gt = <Bls12 as MultiMillerLoop>::multi_miller_loop(&[(&g1, &g2.into())])
.final_exponentiation();
t = t.write(&g1).write(&g2).write(>).write(&Fr::one());
let c1 = t.into_challenge();
let t2 = Transcript::new("test")
.write(&g1)
.write(&g2)
.write(>)
.write(&Fr::one());
let c12 = t2.into_challenge();
assert_eq!(c1, c12);
} | rust_cleaned_test_functions.jsonl/102296 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 327
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7965,
1228,
368,
341,
286,
1077,
5206,
259,
284,
90303,
27638,
33,
4730,
16,
17,
6831,
931,
445,
1944,
797,
286,
1077,
342,
16,
284,
479,
16,
25841,
482,
486,
35851,
543,
286,
1077,
342,
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_is_default_namespace() {
assert!(!div().is_default_namespace("foo"));
assert!(div().is_default_namespace("http://www.w3.org/1999/xhtml"));
} | rust_cleaned_test_functions.jsonl/33768 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 86
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
9993,
41571,
368,
341,
286,
2060,
0,
3471,
611,
1005,
285,
9993,
41571,
445,
7975,
4010,
286,
2060,
10297,
611,
1005,
285,
9993,
41571,
445,
1254,
1110,
2136,
1418,
18,
2659,
14,
16,
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 |
#[test]
fn test_request_deserialize_int() {
let expected = RpcRequest {
id: JsonId::IntId(1),
method: String::from("login"),
jsonrpc: String::from("2.0"),
params: None,
};
let json = r#"{"id":1,"method":"login","jsonrpc":"2.0","params":null}"#;
let serialized: RpcRequest = serde_json::from_str(json).unwrap();
assert_eq!(expected, serialized);
} | rust_cleaned_test_functions.jsonl/49212 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7893,
15768,
9050,
4042,
368,
341,
197,
10217,
3601,
284,
79961,
1900,
341,
298,
15710,
25,
8308,
764,
486,
1072,
764,
7,
16,
1326,
298,
42257,
25,
923,
486,
1499,
445,
3673,
4461,
298,
30847,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_slot_confirmed_unknown_slot() {
let tower = Tower::new_for_tests(1, 0.67);
let stakes = HashMap::new();
assert!(!tower.is_slot_confirmed(0, &stakes, 2));
} | rust_cleaned_test_functions.jsonl/61128 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
27563,
16059,
8434,
57507,
27563,
368,
341,
286,
1077,
21271,
284,
21938,
486,
931,
5478,
32509,
7,
16,
11,
220,
15,
13,
21,
22,
317,
286,
1077,
44425,
284,
10528,
486,
931,
543,
286,
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 |
#[test]
fn test_add_sub_string_and_duration() {
let cases = vec![
// normal cases
(
Some("01:00:00.999999"),
Some("02:00:00.999998"),
Some("03:00:01.999997"),
),
(Some("23:59:59"), Some("00:00:01"), Some("24:00:00")),
(Some("110:00:00"), Some("1 02:00:00"), Some("136:00:00")),
(Some("-110:00:00"), Some("1 02:00:00"), Some("-84:00:00")),
(Some("00:00:01"), Some("-00:00:01"), Some("00:00:00")),
(Some("00:00:03"), Some("-00:00:01"), Some("00:00:02")),
(
Some("2018-02-28 23:00:00"),
Some("01:30:30.123456"),
Some("2018-03-01 00:30:30.123456"),
),
(
Some("2016-02-28 23:00:00"),
Some("01:30:30"),
Some("2016-02-29 00:30:30"),
),
(
Some("2018-12-31 23:00:00"),
Some("01:30:30"),
Some("2019-01-01 00:30:30"),
),
(
Some("2018-12-31 23:00:00"),
Some("1 01:30:30"),
Some("2019-01-02 00:30:30"),
),
(
Some("2019-01-01 01:00:00"),
Some("-01:01:00"),
Some("2018-12-31 23:59:00"),
),
// null cases
(None, None, None),
(None, Some("11:30:45.123456"), None),
(Some("00:00:00"), None, Some("00:00:00")),
(Some("01:00:00"), None, Some("01:00:00")),
(
Some("2019-01-01 01:00:00"),
None,
Some("2019-01-01 01:00:00"),
),
];
for (arg_str, arg_dur, sum) in cases {
let arg_str = arg_str.map(|str| str.as_bytes().to_vec());
let arg_dur = match arg_dur {
Some(arg_dur) => {
Some(Duration::parse(&mut EvalContext::default(), arg_dur, MAX_FSP).unwrap())
}
None => Some(Duration::zero()),
};
let sum = sum.map(|str| str.as_bytes().to_vec());
let add_output = RpnFnScalarEvaluator::new()
.push_param(arg_str.clone())
.push_param(arg_dur)
.evaluate(ScalarFuncSig::AddStringAndDuration)
.unwrap();
assert_eq!(add_output, sum);
let sub_output = RpnFnScalarEvaluator::new()
.push_param(sum)
.push_param(arg_dur)
.evaluate(ScalarFuncSig::SubStringAndDuration)
.unwrap();
assert_eq!(sub_output, arg_str);
}
} | rust_cleaned_test_functions.jsonl/36241 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1713
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
5228,
3904,
8378,
25454,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
442,
4622,
5048,
198,
310,
2399,
394,
4329,
445,
15,
16,
25,
15,
15,
25,
15,
15,
13,
24,
24,
24,
24,
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,
1... | 3 |
#[test]
fn test_hex_int_arg() {
let test_cases = vec![
(Some(12), Some(b"C".to_vec())),
(Some(0x12), Some(b"12".to_vec())),
(Some(0b1100), Some(b"C".to_vec())),
(Some(0), Some(b"0".to_vec())),
(Some(-1), Some(b"FFFFFFFFFFFFFFFF".to_vec())),
(None, None),
];
for (arg, expect_output) in test_cases {
let output = RpnFnScalarEvaluator::new()
.push_param(arg)
.evaluate(ScalarFuncSig::HexIntArg)
.unwrap();
assert_eq!(output, expect_output);
}
} | rust_cleaned_test_functions.jsonl/10159 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 372
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32655,
4042,
6057,
368,
341,
286,
1077,
1273,
41427,
284,
7486,
90515,
310,
320,
8373,
7,
16,
17,
701,
4329,
1883,
46316,
3263,
983,
13251,
73727,
310,
320,
8373,
7,
15,
87,
16,
17,
701,
4329,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_test_strstr() {
assert_emscripten_output!(
"../../emtests/test_strstr.wasm",
"test_strstr",
vec![],
"../../emtests/test_strstr.out"
);
} | rust_cleaned_test_functions.jsonl/24706 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4452,
2895,
495,
368,
341,
262,
2060,
22504,
2282,
268,
7645,
33673,
286,
10208,
336,
23841,
12697,
2895,
495,
1418,
10530,
756,
286,
330,
1944,
2895,
495,
756,
286,
7486,
20703,
1259,
286,
10208,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_interaction_response_with_attachments() {
let value = InteractionResponse {
kind: InteractionResponseType::ChannelMessageWithSource,
data: Some(InteractionResponseData {
attachments: Some(Vec::from([Attachment {
description: None,
file: "file data".into(),
filename: "filename.jpg".into(),
id: 1,
}])),
..InteractionResponseData::default()
}),
};
serde_test::assert_ser_tokens(
&value,
&[
Token::Struct {
name: "InteractionResponse",
len: 2,
},
Token::Str("type"),
Token::U8(InteractionResponseType::ChannelMessageWithSource as u8),
Token::Str("data"),
Token::Some,
Token::Struct {
name: "InteractionResponseData",
len: 1,
},
Token::Str("attachments"),
Token::Some,
Token::Seq { len: Some(1) },
Token::Struct {
name: "Attachment",
len: 2,
},
Token::Str("filename"),
Token::Str("filename.jpg"),
Token::Str("id"),
Token::U64(1),
Token::StructEnd,
Token::SeqEnd,
Token::StructEnd,
Token::StructEnd,
],
);
} | rust_cleaned_test_functions.jsonl/9465 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 970
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
97394,
9655,
6615,
98581,
368,
341,
286,
1077,
897,
284,
42707,
2582,
341,
310,
3093,
25,
42707,
53388,
486,
9629,
2052,
2354,
3608,
345,
310,
821,
25,
4329,
7,
31311,
2582,
1043,
341,
394,
3367... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_last_hash() {
let mut entries: Vec<Entry> = vec![];
let empty_entries_iterator = entries.iter();
assert!(get_last_hash(empty_entries_iterator).is_none());
let mut prev_hash = hash::hash(&[42u8]);
for _ in 0..10 {
let entry = next_entry(&prev_hash, 1, vec![]);
prev_hash = entry.hash;
entries.push(entry);
}
let entries_iterator = entries.iter();
assert_eq!(get_last_hash(entries_iterator).unwrap(), entries[9].hash);
} | rust_cleaned_test_functions.jsonl/7623 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 259
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
12195,
8950,
368,
341,
286,
1077,
5206,
10695,
25,
11312,
91978,
29,
284,
7486,
0,
15078,
286,
1077,
4287,
26092,
13491,
284,
10695,
19471,
543,
286,
2060,
10297,
455,
12195,
8950,
24216,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_flow() {
validate_src_flow("function foo(a: number): number { return a; }").unwrap();
validate_src_flow(
"class A extends B {
foo: number;
+bar: string;
}",
)
.unwrap();
} | rust_cleaned_test_functions.jsonl/14177 | {
"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,
27441,
368,
341,
262,
9593,
16274,
27441,
445,
1688,
15229,
2877,
25,
1372,
1648,
1372,
314,
470,
264,
26,
335,
1827,
15454,
543,
262,
9593,
16274,
27441,
1006,
286,
330,
1040,
362,
2239,
425,
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 |
#[test]
fn test_create_agent_fails_for_unknown_wallet_type() {
init!("false");
let config = json!({
"agency_url":"https://enym-eagency.pdev.evernym.com",
"agency_did":"Ab8TvZa3Q19VNkQVzAWVL7",
"agency_verkey":"5LXaR43B1aQyeh94VBP8LG1Sgvjk7aNfqiksBCSjwqbf",
"wallet_name":"test_provision_agent",
"wallet_key":"key",
"wallet_type":"UNKNOWN_WALLET_TYPE"
}).to_string();
let c_config = CString::new(config).unwrap().into_raw();
let cb = return_types_u32::Return_U32_STR::new().unwrap();
let result = vcx_agent_provision_async(cb.command_handle, c_config, Some(cb.get_callback()));
assert_eq!(0, result);
let result = cb.receive(Some(TimeoutUtils::medium_timeout()));
assert_eq!(result, Err(error::INVALID_WALLET_CREATION.code_num));
} | rust_cleaned_test_functions.jsonl/112445 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 448
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
25730,
761,
6209,
5478,
57507,
62308,
1819,
368,
341,
286,
2930,
17223,
3849,
3071,
286,
1077,
2193,
284,
2951,
0,
2262,
310,
330,
55565,
2903,
3252,
2428,
1110,
268,
1600,
5655,
55565,
556,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_no_txn_manager_serialize_deserialize() {
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 logger: test_utils::TestLogger;
let fee_estimator: test_utils::TestFeeEstimator;
let persister: test_utils::TestPersister;
let new_chain_monitor: test_utils::TestChainMonitor;
let nodes_0_deserialized: ChannelManager<EnforcingSigner, &test_utils::TestChainMonitor, &test_utils::TestBroadcaster, &test_utils::TestKeysInterface, &test_utils::TestFeeEstimator, &test_utils::TestLogger>;
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let tx = create_chan_between_nodes_with_value_init(&nodes[0], &nodes[1], 100000, 10001, InitFeatures::known(), InitFeatures::known());
nodes[1].node.peer_disconnected(&nodes[0].node.get_our_node_id(), false);
let nodes_0_serialized = nodes[0].node.encode();
let mut chan_0_monitor_serialized = test_utils::TestVecWriter(Vec::new());
nodes[0].chain_monitor.chain_monitor.monitors.read().unwrap().iter().next().unwrap().1.write(&mut chan_0_monitor_serialized).unwrap();
logger = test_utils::TestLogger::new();
fee_estimator = test_utils::TestFeeEstimator { sat_per_kw: Mutex::new(253) };
persister = test_utils::TestPersister::new();
let keys_manager = &chanmon_cfgs[0].keys_manager;
new_chain_monitor = test_utils::TestChainMonitor::new(Some(nodes[0].chain_source), nodes[0].tx_broadcaster.clone(), &logger, &fee_estimator, &persister, keys_manager);
nodes[0].chain_monitor = &new_chain_monitor;
let mut chan_0_monitor_read = &chan_0_monitor_serialized.0[..];
let (_, mut chan_0_monitor) = <(BlockHash, ChannelMonitor<EnforcingSigner>)>::read(
&mut chan_0_monitor_read, keys_manager).unwrap();
assert!(chan_0_monitor_read.is_empty());
let mut nodes_0_read = &nodes_0_serialized[..];
let config = UserConfig::default();
let (_, nodes_0_deserialized_tmp) = {
let mut channel_monitors = HashMap::new();
channel_monitors.insert(chan_0_monitor.get_funding_txo().0, &mut chan_0_monitor);
<(BlockHash, ChannelManager<EnforcingSigner, &test_utils::TestChainMonitor, &test_utils::TestBroadcaster, &test_utils::TestKeysInterface, &test_utils::TestFeeEstimator, &test_utils::TestLogger>)>::read(&mut nodes_0_read, ChannelManagerReadArgs {
default_config: config,
keys_manager,
fee_estimator: &fee_estimator,
chain_monitor: nodes[0].chain_monitor,
tx_broadcaster: nodes[0].tx_broadcaster.clone(),
logger: &logger,
channel_monitors,
}).unwrap()
};
nodes_0_deserialized = nodes_0_deserialized_tmp;
assert!(nodes_0_read.is_empty());
assert!(nodes[0].chain_monitor.watch_channel(chan_0_monitor.get_funding_txo().0, chan_0_monitor).is_ok());
nodes[0].node = &nodes_0_deserialized;
assert_eq!(nodes[0].node.list_channels().len(), 1);
check_added_monitors!(nodes[0], 1);
nodes[0].node.peer_connected(&nodes[1].node.get_our_node_id(), &msgs::Init { features: InitFeatures::empty() });
let reestablish_1 = get_chan_reestablish_msgs!(nodes[0], nodes[1]);
nodes[1].node.peer_connected(&nodes[0].node.get_our_node_id(), &msgs::Init { features: InitFeatures::empty() });
let reestablish_2 = get_chan_reestablish_msgs!(nodes[1], nodes[0]);
nodes[1].node.handle_channel_reestablish(&nodes[0].node.get_our_node_id(), &reestablish_1[0]);
assert!(nodes[1].node.get_and_clear_pending_msg_events().is_empty());
nodes[0].node.handle_channel_reestablish(&nodes[1].node.get_our_node_id(), &reestablish_2[0]);
assert!(nodes[0].node.get_and_clear_pending_msg_events().is_empty());
let (funding_locked, _) = create_chan_between_nodes_with_value_confirm(&nodes[0], &nodes[1], &tx);
let (announcement, as_update, bs_update) = create_chan_between_nodes_with_value_b(&nodes[0], &nodes[1], &funding_locked);
for node in nodes.iter() {
assert!(node.net_graph_msg_handler.handle_channel_announcement(&announcement).unwrap());
node.net_graph_msg_handler.handle_channel_update(&as_update).unwrap();
node.net_graph_msg_handler.handle_channel_update(&bs_update).unwrap();
}
send_payment(&nodes[0], &[&nodes[1]], 1000000);
} | rust_cleaned_test_functions.jsonl/16894 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1599
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
92299,
12144,
88686,
15768,
9050,
368,
341,
10217,
26023,
1645,
18343,
82,
284,
1855,
45552,
1645,
18343,
82,
7,
17,
317,
10217,
2436,
18343,
82,
284,
1855,
5084,
18343,
82,
7,
17,
11,
609... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_spawn_on_with_two_executors() {
let (ehandle_sender, ehandle_receiver) = oneshot::channel();
let (finish_sender, finish_receiver) = oneshot::channel();
let executor_thread = std::thread::spawn(move || {
SendExecutor::new(2).unwrap().run(async move {
ehandle_sender.send(EHandle::local()).unwrap();
finish_receiver.await.unwrap();
})
});
SendExecutor::new(2).unwrap().run(async move {
// Get the handle for the other executor.
let ehandle = ehandle_receiver.await.unwrap();
// Spawn a task on the other executor.
Task::spawn_on(&ehandle.clone(), async move {
// Make sure this task is running on the other executor; we can do this by comparing
// the ports which should be the same.
assert_eq!(EHandle::local().port(), ehandle.port());
})
.await;
// Tell the other executor to stop.
finish_sender.send(()).unwrap();
});
executor_thread.join().unwrap();
} | rust_cleaned_test_functions.jsonl/121963 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 538
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
76026,
4470,
6615,
23241,
18430,
9475,
368,
341,
286,
1077,
320,
2636,
3316,
54356,
11,
384,
8192,
65691,
8,
284,
389,
4288,
354,
486,
10119,
543,
286,
1077,
320,
30150,
54356,
11,
6248,
65691,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_remove_unrooted_slot() {
let unrooted_slot = 9;
let db = AccountsDB::new(Vec::new());
let key = Pubkey::default();
let account0 = Account::new(1, 0, &key);
let ancestors: HashMap<_, _> = vec![(unrooted_slot, 1)].into_iter().collect();
db.store(unrooted_slot, &[(&key, &account0)]);
db.bank_hashes
.write()
.unwrap()
.insert(unrooted_slot, BankHashInfo::default());
assert!(db
.accounts_index
.read()
.unwrap()
.get(&key, &ancestors)
.is_some());
assert_load_account(&db, unrooted_slot, key, 1);
// Purge the slot
db.remove_unrooted_slot(unrooted_slot);
assert!(db.load_slow(&ancestors, &key).is_none());
assert!(db.bank_hashes.read().unwrap().get(&unrooted_slot).is_none());
assert!(db.storage.read().unwrap().0.get(&unrooted_slot).is_none());
assert!(db
.accounts_index
.read()
.unwrap()
.account_maps
.get(&key)
.map(|pubkey_entry| pubkey_entry.1.read().unwrap().is_empty())
.unwrap_or(true));
assert!(db
.accounts_index
.read()
.unwrap()
.get(&key, &ancestors)
.is_none());
// Test we can store for the same slot again and get the right information
let account0 = Account::new(2, 0, &key);
db.store(unrooted_slot, &[(&key, &account0)]);
assert_load_account(&db, unrooted_slot, key, 2);
} | rust_cleaned_test_functions.jsonl/86931 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 850
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
4907,
2888,
291,
27563,
368,
341,
286,
1077,
650,
2888,
291,
27563,
284,
220,
24,
280,
286,
1077,
2927,
284,
40655,
3506,
486,
931,
49923,
486,
931,
1423,
286,
1077,
1376,
284,
22611,
792... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_query_with_limit() {
let query = query_builder::select("users")
.fields(&["id", "name"])
.limit(15)
.build();
assert_eq!("SELECT id, name FROM users LIMIT 15;", query);
} | rust_cleaned_test_functions.jsonl/93977 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13051,
5738,
6615,
14763,
368,
341,
286,
1077,
3239,
284,
3239,
28532,
486,
1742,
445,
4218,
1138,
310,
659,
9007,
2099,
1183,
307,
497,
330,
606,
14108,
310,
659,
9506,
7,
16,
20,
340,
310,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_padmaa() {
// A fair number of syllables in the Gujarati corpus make use
// of glyphs that the Padmaa font lacks:
// * Sign Vocalic L - 88 syllables
// * Devanagari Udatta - 6 syllables
// * Devanagari Anudatta - 3 syllables
let missing_glyph_index = 0;
run_test(
&TEST_DATA,
"harfbuzz/good-padmaa.gu",
"gujarati/padmaa.ttf",
&[missing_glyph_index, JOINER_GLYPH_INDEX],
546,
);
} | rust_cleaned_test_functions.jsonl/91158 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 448
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30290,
1728,
64,
368,
341,
394,
442,
362,
6624,
1372,
315,
47604,
4788,
304,
279,
55631,
9307,
42094,
1281,
990,
198,
394,
442,
315,
84277,
429,
279,
25299,
1728,
64,
3301,
36756,
510,
6360,
394... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compute_need() {
assert_eq!(NodeTbleGspPush::compute_need(30, 0, 10), 30);
assert_eq!(NodeTbleGspPush::compute_need(30, 1, 10), 29);
assert_eq!(NodeTbleGspPush::compute_need(30, 30, 10), 3);
assert_eq!(NodeTbleGspPush::compute_need(30, 29, 10), 3);
} | rust_cleaned_test_functions.jsonl/120872 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 157
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57028,
71506,
368,
341,
286,
2060,
10714,
10297,
1955,
51,
891,
38,
2154,
16644,
486,
27706,
71506,
7,
18,
15,
11,
220,
15,
11,
220,
16,
15,
701,
220,
18,
15,
317,
286,
2060,
10714,
10297,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_print_group_type() {
let mut s = String::new();
{
let mut p = Printer::new(&mut s);
let f1 = Type::primitive_type_builder("f1", PhysicalType::INT32)
.with_repetition(Repetition::REQUIRED)
.with_logical_type(LogicalType::INT_32)
.with_id(0)
.build();
let f2 = Type::primitive_type_builder("f2", PhysicalType::BYTE_ARRAY)
.with_logical_type(LogicalType::UTF8)
.with_id(1)
.build();
let f3 =
Type::primitive_type_builder("f3", PhysicalType::FIXED_LEN_BYTE_ARRAY)
.with_repetition(Repetition::REPEATED)
.with_logical_type(LogicalType::INTERVAL)
.with_length(12)
.with_id(2)
.build();
let mut struct_fields = Vec::new();
struct_fields.push(Rc::new(f1.unwrap()));
struct_fields.push(Rc::new(f2.unwrap()));
let foo = Type::group_type_builder("foo")
.with_repetition(Repetition::OPTIONAL)
.with_fields(&mut struct_fields)
.with_id(1)
.build()
.unwrap();
let mut fields = Vec::new();
fields.push(Rc::new(foo));
fields.push(Rc::new(f3.unwrap()));
let message = Type::group_type_builder("schema")
.with_fields(&mut fields)
.with_id(2)
.build()
.unwrap();
p.print(&message);
}
let expected = "message schema {
OPTIONAL group foo {
REQUIRED INT32 f1 (INT_32);
OPTIONAL BYTE_ARRAY f2 (UTF8);
}
REPEATED FIXED_LEN_BYTE_ARRAY (12) f3 (INTERVAL);
}";
assert_eq!(&mut s, expected);
} | rust_cleaned_test_functions.jsonl/31614 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1069
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10064,
6288,
1819,
368,
341,
286,
1077,
5206,
274,
284,
923,
486,
931,
543,
286,
341,
310,
1077,
5206,
281,
284,
45933,
486,
931,
2099,
6984,
274,
317,
310,
1077,
282,
16,
284,
3990,
486,
7344... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_valid_key_with_comment_and_options() {
let line = format!("options ecdsa-sha2-nistp256 {} comment", VALID_ECDSA_KEY);
let key = line.parse::<KeyEntry>().expect("parse ok");
assert_eq!(key.options.as_deref(), Some("options"));
assert_eq!(key.key_type, "ecdsa-sha2-nistp256");
assert_eq!(key.key, VALID_ECDSA_KEY);
assert_eq!(key.comment.as_deref(), Some("comment"));
assert_eq!(line, key.to_string());
} | rust_cleaned_test_functions.jsonl/31217 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 231
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8337,
3097,
6615,
17638,
8378,
8743,
368,
341,
286,
1077,
1555,
284,
3561,
17223,
2875,
384,
4385,
9081,
7514,
64,
17,
5279,
380,
79,
17,
20,
21,
4687,
3980,
497,
43291,
69510,
72638,
660... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_shuffle(){
let deck:Deck = Deck::new_deck();
println!("\n\tShowing original deck:");
deck.show_deck();
println!("\n\tShowing shuffled deck:");
deck.shuffle_deck();
deck.show_deck();
} | rust_cleaned_test_functions.jsonl/72706 | {
"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,
73484,
3032,
286,
1077,
9530,
25,
39368,
284,
28416,
486,
931,
83860,
1428,
286,
13751,
0,
4921,
77,
4955,
54863,
4024,
9530,
24305,
286,
9530,
5460,
83860,
1428,
286,
13751,
0,
4921,
77,
4955,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_absolute() {
if cfg!(windows) {
let result = Path::new(r"\").canonicalize();
assert!(
result.is_ok(),
"Should work before set_current_dir is called: {:?}",
result
);
}
let tmp = tempdir::TempDir::new("ex").unwrap();
let tmp = tmp.path();
let tmp_abs = PathAbs::new(&tmp).unwrap();
env::set_current_dir(&tmp_abs).unwrap();
if cfg!(windows) {
let result = Path::new(r"\").canonicalize();
assert!(result.is_err());
println!("Got ERR cananonicalizing root: {}", result.unwrap_err());
}
// Create directory like:
// a/
// + e/ -> b/c/d
// + b/
// + c/
// + d/
let a = PathDir::create(&tmp.join("a")).unwrap();
let b = PathDir::create(&a.concat("b").unwrap()).unwrap();
let c = PathDir::create(&b.concat("c").unwrap()).unwrap();
let d = PathDir::create(&c.concat("d").unwrap()).unwrap();
// create symbolic link from a/e -> a/b/c/d
let e_sym = d.symlink(&a.concat("e").unwrap()).unwrap();
let ty = e_sym.symlink_metadata().unwrap().file_type();
assert!(ty.is_symlink(), "{}", e_sym.display());
assert_ne!(d, e_sym);
assert_eq!(d, e_sym.canonicalize().unwrap());
let a_cwd = Path::new("a");
let b_cwd = a.concat("b").unwrap();
let c_cwd = b.concat("c").unwrap();
let d_cwd = c.concat("d").unwrap();
let e_cwd = a.concat("e").unwrap();
assert_eq!(a, PathDir::new(&a_cwd).unwrap());
assert_eq!(b, PathDir::new(&b_cwd).unwrap());
assert_eq!(c, PathDir::new(&c_cwd).unwrap());
assert_eq!(d, PathDir::new(&d_cwd).unwrap());
assert_eq!(e_sym, PathDir::new(&e_cwd).unwrap());
assert_eq!(b, PathDir::new(c.concat("..").unwrap()).unwrap());
assert_eq!(
a,
PathDir::new(c.concat("..").unwrap().concat("..").unwrap()).unwrap()
);
// just create a PathType
let _ = PathType::new(&e_sym).unwrap();
let mut root_dots: PathBuf = tmp_abs.clone().into();
let mut dots = tmp_abs.components().count() - 1;
if cfg!(windows) {
dots -= 1;
}
for _ in 0..dots {
root_dots.push("..");
}
let root = PathDir::new(root_dots).unwrap();
if cfg!(windows) {
assert_eq!(PathDir::new("\\").unwrap(), root);
} else {
assert_eq!(PathDir::new("/").unwrap(), root);
}
assert!(root.concat("..").is_err());
if cfg!(windows) {
// Test that /-separated and \-separated paths can be joined
let ac1 = a.concat(r"b/c").unwrap();
assert!(ac1.metadata().is_ok());
let ac2 = a.concat(r"b\c").unwrap();
assert!(ac2.metadata().is_ok());
}
} | rust_cleaned_test_functions.jsonl/115176 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1283
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
50874,
368,
341,
262,
421,
13286,
10297,
27077,
8,
341,
286,
1077,
1102,
284,
7933,
486,
931,
2601,
11934,
1827,
77942,
551,
543,
286,
2060,
33673,
310,
1102,
2079,
19817,
3148,
310,
330,
14996,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bpf_loader_serialize_unaligned() {
let program_id = solana_sdk::pubkey::new_rand();
let program_key = solana_sdk::pubkey::new_rand();
// Create program account
let mut file = File::open("test_elfs/noop_unaligned.so").expect("file open failed");
let mut elf = Vec::new();
file.read_to_end(&mut elf).unwrap();
let program_account = Account::new_ref(1, 0, &program_id);
program_account.borrow_mut().data = elf;
program_account.borrow_mut().executable = true;
let mut keyed_accounts = vec![KeyedAccount::new(&program_key, false, &program_account)];
// Case: With program and parameter account
let parameter_account = Account::new_ref(1, 0, &program_id);
keyed_accounts.push(KeyedAccount::new(&program_key, false, ¶meter_account));
assert_eq!(
Ok(()),
process_instruction(
&bpf_loader_deprecated::id(),
&keyed_accounts,
&[],
&mut MockInvokeContext::default()
)
);
// Case: With duplicate accounts
let duplicate_key = solana_sdk::pubkey::new_rand();
let parameter_account = Account::new_ref(1, 0, &program_id);
let mut keyed_accounts = vec![KeyedAccount::new(&program_key, false, &program_account)];
keyed_accounts.push(KeyedAccount::new(&duplicate_key, false, ¶meter_account));
keyed_accounts.push(KeyedAccount::new(&duplicate_key, false, ¶meter_account));
assert_eq!(
Ok(()),
process_instruction(
&bpf_loader_deprecated::id(),
&keyed_accounts,
&[],
&mut MockInvokeContext::default()
)
);
} | rust_cleaned_test_functions.jsonl/57225 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 856
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
15897,
22139,
88686,
4907,
47142,
368,
341,
286,
1077,
2025,
842,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
2025,
3097,
284,
2048,
3362,
61783,
486,
9585,
792,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_verify_account_state_and_event() {
// root
// a b
// txn0 txn1 txn2 default
// transaction_info2
// txn state_root event_root
// c default event0 event1
// key1 d
// key2 key3
let key1 = b"hello".test_only_hash();
let key2 = b"world".test_only_hash();
let key3 = b"!".test_only_hash();
let non_existing_key = b"#".test_only_hash();
assert_eq!(key1[0], 0b0011_0011);
assert_eq!(key2[0], 0b0100_0010);
assert_eq!(key3[0], 0b0110_1001);
assert_eq!(non_existing_key[0], 0b0100_0001);
let blob1 = AccountStateBlob::from(b"value1".to_vec());
let blob2 = AccountStateBlob::from(b"value2".to_vec());
let blob3 = AccountStateBlob::from(b"value3".to_vec());
let leaf1_hash = SparseMerkleLeafNode::new(key1, blob1.hash()).hash();
let leaf2 = SparseMerkleLeafNode::new(key2, blob2.hash());
let leaf2_hash = leaf2.hash();
let leaf3_hash = SparseMerkleLeafNode::new(key3, blob3.hash()).hash();
let internal_d_hash = SparseMerkleInternalNode::new(leaf2_hash, leaf3_hash).hash();
let internal_c_hash = SparseMerkleInternalNode::new(leaf1_hash, internal_d_hash).hash();
let state_root_hash =
SparseMerkleInternalNode::new(internal_c_hash, *SPARSE_MERKLE_PLACEHOLDER_HASH).hash();
let txn_info0_hash = b"hellohello".test_only_hash();
let txn_info1_hash = b"worldworld".test_only_hash();
let privkey = Ed25519PrivateKey::generate_for_testing();
let pubkey = privkey.public_key();
let txn2_hash = Transaction::UserTransaction(
RawTransaction::new_script(
crate::account_address::from_public_key(&pubkey),
/* sequence_number = */ 0,
Script::new(vec![], vec![], vec![]),
/* max_gas_amount = */ 0,
/* gas_unit_price = */ 0,
/* gas_currency_code = */ XUS_NAME.to_owned(),
/* expiration_timestamp_secs = */ 0,
ChainId::test(),
)
.sign(&privkey, pubkey)
.expect("Signing failed.")
.into_inner(),
)
.hash();
let event0_hash = b"event0".test_only_hash();
let event1_hash = b"event1".test_only_hash();
let event_root_hash = EventAccumulatorInternalNode::new(event0_hash, event1_hash).hash();
let txn_info2 = TransactionInfo::new(
txn2_hash,
state_root_hash,
event_root_hash,
/* gas_used = */ 0,
/* major_status = */ KeptVMStatus::Executed,
);
let txn_info2_hash = txn_info2.hash();
let internal_a_hash =
TransactionAccumulatorInternalNode::new(txn_info0_hash, txn_info1_hash).hash();
let internal_b_hash =
TransactionAccumulatorInternalNode::new(txn_info2_hash, *ACCUMULATOR_PLACEHOLDER_HASH)
.hash();
let root_hash =
TransactionAccumulatorInternalNode::new(internal_a_hash, internal_b_hash).hash();
let consensus_data_hash = b"consensus_data".test_only_hash();
let ledger_info = LedgerInfo::new(
BlockInfo::new(0, 0, *GENESIS_BLOCK_ID, root_hash, 2, 10000, None),
consensus_data_hash,
);
let ledger_info_to_transaction_info_proof =
TransactionAccumulatorProof::new(vec![*ACCUMULATOR_PLACEHOLDER_HASH, internal_a_hash]);
let transaction_info_to_account_proof = SparseMerkleProof::new(
Some(leaf2),
vec![leaf3_hash, leaf1_hash, *SPARSE_MERKLE_PLACEHOLDER_HASH],
);
let account_state_proof = AccountStateProof::new(
TransactionInfoWithProof::new(
ledger_info_to_transaction_info_proof.clone(),
txn_info2.clone(),
),
transaction_info_to_account_proof,
);
// Prove that account at `key2` has value `value2`.
assert!(account_state_proof
.verify(
&ledger_info,
/* state_version = */ 2,
key2,
Some(&blob2),
)
.is_ok());
// Use the same proof to prove that `non_existing_key` doesn't exist.
assert!(account_state_proof
.verify(
&ledger_info,
/* state_version = */ 2,
non_existing_key,
None,
)
.is_ok());
let bad_blob2 = b"3".to_vec().into();
assert!(account_state_proof
.verify(
&ledger_info,
/* state_version = */ 2,
key2,
Some(&bad_blob2),
)
.is_err());
let transaction_info_to_event_proof = EventAccumulatorProof::new(vec![event1_hash]);
let event_proof = EventProof::new(
TransactionInfoWithProof::new(ledger_info_to_transaction_info_proof, txn_info2),
transaction_info_to_event_proof,
);
// Prove that the first event within transaction 2 is `event0`.
assert!(event_proof
.verify(
&ledger_info,
event0_hash,
/* transaction_version = */ 2,
/* event_version_within_transaction = */ 0,
)
.is_ok());
let bad_event0_hash = b"event1".test_only_hash();
assert!(event_proof
.verify(
&ledger_info,
bad_event0_hash,
/* transaction_version = */ 2,
/* event_version_within_transaction = */ 0,
)
.is_err());
} | rust_cleaned_test_functions.jsonl/33629 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2638
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35638,
13500,
4387,
8378,
6748,
368,
341,
262,
442,
1698,
3704,
63477,
262,
442,
1797,
264,
1797,
293,
7213,
262,
442,
286,
49721,
15,
256,
49721,
16,
256,
49721,
17,
256,
1638,
63477,
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... | 1 |
#[test]
fn test_push_make_space() {
let mut cache = mock_cache();
let to_push = mock_asset(3, 2048, 2000);
let should_be_popped_id = cache.cache.front().unwrap().id;
let (cached, is_cached, evicted) = cache.push(to_push);
assert_eq!(cached.id, AssetId(3));
assert_eq!(cached.id, cache.cache.back().unwrap().id);
assert_eq!(cache.available, 0);
assert!(cache.index_of(should_be_popped_id).is_none());
assert!(is_cached);
assert_eq!(evicted.len(), 1);
assert_eq!(evicted[0].id, should_be_popped_id);
} | rust_cleaned_test_functions.jsonl/56061 | {
"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,
14218,
28230,
14663,
368,
341,
286,
1077,
5206,
6500,
284,
7860,
11529,
543,
286,
1077,
311,
14218,
284,
7860,
42299,
7,
18,
11,
220,
17,
15,
19,
23,
11,
220,
17,
15,
15,
15,
317,
286,
1077,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_case_mapping_rule() {
let res = case_mapping_rule("");
assert_eq!(res, Ok(Cow::from("")));
let res = case_mapping_rule("T");
assert_eq!(res, Ok(Cow::from("t")));
let res = case_mapping_rule("aT");
assert_eq!(res, Ok(Cow::from("at")));
let res = case_mapping_rule("Ta");
assert_eq!(res, Ok(Cow::from("ta")));
let res = case_mapping_rule("TestUserName");
assert_eq!(res, Ok(Cow::from("testusername")));
} | rust_cleaned_test_functions.jsonl/124157 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 249
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19096,
26930,
21124,
368,
341,
286,
1077,
592,
284,
1142,
26930,
21124,
13056,
286,
2060,
10714,
10297,
416,
11,
7622,
3025,
363,
486,
1499,
43472,
626,
286,
1077,
592,
284,
1142,
26930,
21124,
44... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cerrarllave() {
assert_eq!(cerrarllave("}"), Ok(("", "}")));
assert_eq!(
cerrarllave("a"),
Err(NomErr::Error(VerboseError {
errors: vec![
("a", VerboseErrorKind::Nom(ErrorKind::Tag)),
("a", VerboseErrorKind::Context("cerrarllave")),
]
}))
);
} | rust_cleaned_test_functions.jsonl/17452 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 245
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
50049,
654,
523,
368,
341,
286,
2060,
10714,
10297,
23960,
277,
654,
523,
445,
92,
3975,
7622,
7,
19814,
80548,
17621,
286,
2060,
10714,
33673,
310,
26878,
277,
654,
523,
445,
64,
4461,
310... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_merge_modified_file_into_tree() -> BitResult<()> {
BitRepo::with_minimal_repo(|repo| {
let ours = commit! {
foo {
bar < "bar contents"
}
};
let theirs = commit! {
foo < "modified foo contents"
};
touch!(repo: "foo~theirs");
touch!(repo: "foo~theirs_0");
touch!(repo: "foo~theirs_2");
let conflicts = repo.three_way_merge(ours, theirs)?.into_conflicts();
let mut conflicts = conflicts.into_iter();
assert_eq!(
conflicts.next().unwrap(),
Conflict::new_with_type(p!("foo"), ConflictType::DeleteModify)
);
assert_eq!(cat!(repo: "foo~theirs_1"), "modified foo contents");
assert_eq!(cat!(repo: "foo/bar"), "bar contents");
Ok(())
})
} | rust_cleaned_test_functions.jsonl/94166 | {
"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,
20888,
37749,
2458,
45514,
11663,
368,
1464,
6495,
2077,
71698,
341,
262,
6495,
25243,
486,
4197,
7260,
2861,
37784,
22428,
23476,
91,
341,
286,
1077,
11350,
284,
5266,
0,
341,
310,
15229,
341,
39... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_production_request_uri() {
let builder = PlainNotificationBuilder::new("test");
let payload = builder.build("a_test_id", Default::default());
let client = Client::new(AlpnConnector::new(), None, Endpoint::Production);
let request = client.build_request(payload);
let uri = format!("{}", request.uri());
assert_eq!("https://api.push.apple.com/3/device/a_test_id", &uri);
} | rust_cleaned_test_functions.jsonl/109642 | {
"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,
91980,
7893,
15572,
368,
341,
286,
1077,
7363,
284,
43199,
11196,
3297,
486,
931,
445,
1944,
797,
286,
1077,
7729,
284,
7363,
13239,
445,
64,
4452,
842,
497,
7899,
486,
2258,
1423,
286,
1077,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_config_relative() {
let mut c = Config::with_none();
c.date = Some("relative".into());
assert_eq!(Some(DateFlag::Relative), DateFlag::from_config(&c));
} | rust_cleaned_test_functions.jsonl/1307 | {
"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,
5673,
5332,
29286,
368,
341,
286,
1077,
5206,
272,
284,
5532,
486,
4197,
31488,
543,
286,
272,
9907,
284,
4329,
445,
20432,
3263,
18122,
1423,
286,
2060,
10714,
10297,
8373,
19987,
12135,
486,
284... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_trie_write() {
let mut trie = TestTrie::default();
let mut ctx: WriteTrieContext<Key, _, _> = WriteTrieContext::new(&trie, trie.root);
ctx.insert(&key!("0a711355"), 1.into()).unwrap();
ctx.insert(&key!("0a77d337"), 2.into()).unwrap();
ctx.insert(&key!("0a7f9365"), 3.into()).unwrap();
ctx.insert(&key!("0a77d397"), 4.into()).unwrap();
ctx.insert(&key!("0a701234"), 5.into()).unwrap();
ctx.insert(&key!("0a701256"), 6.into()).unwrap();
ctx.insert(&key!("0a701234"), 0.into()).unwrap();
ctx.insert(&key!("0a701256"), 0.into()).unwrap();
let changes = ctx.changes();
trie.apply(changes);
assert_eq!(build_test_trie(), trie);
#[cfg(feature = "partial_trie")]
{
let mut ctx: WritePartialTrieContext<Key> =
WritePartialTrieContext::new(PartialTrie::new());
ctx.insert_with_value(&key!("0a711355"), &Value(1)).unwrap();
ctx.insert_with_value(&key!("0a77d337"), &Value(2)).unwrap();
ctx.insert_with_value(&key!("0a7f9365"), &Value(3)).unwrap();
ctx.insert_with_value(&key!("0a77d397"), &Value(4)).unwrap();
ctx.insert_with_value(&key!("0a701234"), &Value(5)).unwrap();
ctx.insert_with_value(&key!("0a701256"), &Value(6)).unwrap();
ctx.insert_with_value(&key!("0a701234"), &Value(0)).unwrap();
ctx.insert_with_value(&key!("0a701256"), &Value(0)).unwrap();
let trie2 = ctx.finish();
assert_eq!(trie2.root_hash(), trie.root);
}
} | rust_cleaned_test_functions.jsonl/16369 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 712
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3547,
645,
9165,
368,
341,
262,
1077,
5206,
59067,
284,
3393,
51,
7231,
486,
2258,
543,
262,
1077,
5206,
5635,
25,
9645,
51,
7231,
1972,
42003,
11,
8358,
716,
29,
284,
9645,
51,
7231,
1972,
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_collisions() {
assert!(unranked_route_collisions(&["/hello", "/hello"]));
assert!(unranked_route_collisions(&["/<a>", "/hello"]));
assert!(unranked_route_collisions(&["/<a>", "/<b>"]));
assert!(unranked_route_collisions(&["/hello/bob", "/hello/<b>"]));
assert!(unranked_route_collisions(&["/a/b/<c>/d", "/<a>/<b>/c/d"]));
assert!(unranked_route_collisions(&["/a/b", "/<a..>"]));
assert!(unranked_route_collisions(&["/a/b/c", "/a/<a..>"]));
assert!(unranked_route_collisions(&["/<a>/b", "/a/<a..>"]));
assert!(unranked_route_collisions(&["/a/<b>", "/a/<a..>"]));
assert!(unranked_route_collisions(&["/a/b/<c>", "/a/<a..>"]));
assert!(unranked_route_collisions(&["/<a..>", "/a/<a..>"]));
assert!(unranked_route_collisions(&["/a/<a..>", "/a/<a..>"]));
assert!(unranked_route_collisions(&["/a/b/<a..>", "/a/<a..>"]));
assert!(unranked_route_collisions(&["/a/b/c/d", "/a/<a..>"]));
} | rust_cleaned_test_functions.jsonl/26083 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 516
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43597,
6805,
368,
341,
286,
2060,
10297,
359,
13129,
291,
28109,
43597,
6805,
2099,
1183,
14,
14990,
497,
3521,
14990,
74446,
286,
2060,
10297,
359,
13129,
291,
28109,
43597,
6805,
2099,
1183,
23012... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_weighted_net_grid2_chord() {
let seed: &[_] = &[1,2,3,4,9];
let mut rng: StdRng = rand::SeedableRng::from_seed(seed);
let k = 5; // 5 X 5 grid
let l: usize = 6; // Size of keyspace
random_weighted_net_grid2_chord(1, 2, k,l,&mut rng);
} | rust_cleaned_test_functions.jsonl/53246 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 163
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15876,
291,
19722,
15604,
17,
4138,
539,
368,
341,
286,
1077,
10320,
25,
609,
13496,
60,
284,
44590,
16,
11,
17,
11,
18,
11,
19,
11,
24,
935,
286,
1077,
5206,
28422,
25,
42517,
49,
968,
284,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_encrypt_decrypt_biguint() {
let (public, private) = gen_keys_default();
let m = 1633837924.to_biguint().unwrap();
let encrypted = public.encrypt_biguint(&m);
let decrypted = private.decrypt_biguint(&encrypted);
assert_eq!(m, decrypted);
} | rust_cleaned_test_functions.jsonl/67149 | {
"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,
66593,
80764,
36386,
2496,
368,
341,
286,
1077,
320,
888,
11,
869,
8,
284,
4081,
12631,
9993,
543,
286,
1077,
296,
284,
220,
16,
21,
18,
18,
23,
18,
22,
24,
17,
19,
2389,
36386,
2496,
1005,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get() {
let server = server::http(move |_req| async { http::Response::default() });
let url = format!("http://{}/1", server.addr());
let res = reqwest::blocking::get(&url).unwrap();
assert_eq!(res.url().as_str(), &url);
assert_eq!(res.status(), reqwest::StatusCode::OK);
assert_eq!(res.remote_addr(), Some(server.addr()));
assert_eq!(res.text().unwrap().len(), 0)
} | rust_cleaned_test_functions.jsonl/131404 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
368,
341,
262,
1077,
3538,
284,
3538,
486,
1254,
34081,
70886,
2958,
91,
3312,
314,
1758,
486,
2582,
486,
2258,
368,
3011,
262,
1077,
2515,
284,
3561,
17223,
1254,
81776,
4472,
16,
497,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_set_direction_out() {
let (rx, rp) = crate::test::create_client();
rp.digital
.set_direction(crate::digital::Led::LED0, crate::digital::Direction::OUT);
assert_eq!("DIG:PIN:DIR OUT,LED0\r\n", rx.recv().unwrap());
} | rust_cleaned_test_functions.jsonl/15582 | {
"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,
2602,
25438,
6068,
368,
341,
286,
1077,
320,
12651,
11,
33109,
8,
284,
17717,
486,
1944,
486,
3182,
8179,
1428,
286,
33109,
87446,
198,
310,
659,
746,
25438,
54907,
486,
57269,
486,
60850,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simple_untracked() {
static DROPPED: AtomicBool = AtomicBool::new(false);
struct X(&'static str);
impl Trace for X {
fn is_type_tracked() -> bool {
false
}
}
impl Drop for X {
fn drop(&mut self) {
DROPPED.store(true, SeqCst);
}
}
{
let v1 = Cc::new(X("abc"));
{
let v2 = v1.clone();
assert_eq!(v1.deref().0, v2.deref().0);
assert_eq!(collect::count_thread_tracked(), 0);
}
assert!(!DROPPED.load(SeqCst));
}
assert!(DROPPED.load(SeqCst));
} | rust_cleaned_test_functions.jsonl/76044 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 352
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
4907,
58381,
368,
341,
262,
1099,
422,
1285,
4406,
1479,
25,
30316,
11233,
284,
30316,
11233,
486,
931,
3576,
317,
262,
2036,
1599,
2099,
6,
1978,
607,
317,
262,
11605,
27163,
369,
1599,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_loops_around_when_reaching_end_of_the_list() {
let search = get_blank_search();
assert!(search.down().down().down().down().selection().unwrap().as_slice() == "two");
} | rust_cleaned_test_functions.jsonl/96101 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 88
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5560,
3721,
62,
19454,
47636,
1288,
11829,
6213,
3575,
16068,
2019,
368,
341,
286,
1077,
2711,
284,
633,
56103,
10716,
543,
286,
2060,
10297,
1836,
18148,
1005,
2923,
1005,
2923,
1005,
2923,
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 |
#[test]
fn test_full_parses() {
let mut bufs = ALL_BUFFERS.to_vec();
for buff in bufs.iter_mut() {
let orig_req = &buff[..];
let packet = buff.parse_with::<_, IgmpPacket<_>>(()).unwrap();
let msg_type = match packet {
IgmpPacket::MembershipQueryV2(p) => p.prefix.msg_type,
IgmpPacket::MembershipQueryV3(p) => p.prefix.msg_type,
IgmpPacket::MembershipReportV1(p) => p.prefix.msg_type,
IgmpPacket::MembershipReportV2(p) => p.prefix.msg_type,
IgmpPacket::MembershipReportV3(p) => p.prefix.msg_type,
IgmpPacket::LeaveGroup(p) => p.prefix.msg_type,
};
assert_eq!(msg_type, orig_req[0]);
}
} | rust_cleaned_test_functions.jsonl/11284 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 421
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16372,
77113,
288,
368,
341,
286,
1077,
5206,
1031,
3848,
284,
13097,
62128,
4321,
2389,
13251,
543,
286,
369,
11522,
304,
1031,
3848,
19471,
29523,
368,
341,
310,
1077,
2713,
17644,
284,
609,
259... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_executor_status() {
let executor = TestExecutor::new();
let txn0 = encode_mint_transaction(gen_address(0), 100);
let txn1 = encode_mint_transaction(gen_address(1), 100);
let txn2 = encode_transfer_transaction(gen_address(0), gen_address(1), 500);
let parent_block_id = *GENESIS_BLOCK_ID;
let block_id = gen_block_id(1);
let response =
block_on(executor.execute_block(vec![txn0, txn1, txn2], parent_block_id, block_id))
.unwrap()
.unwrap();
assert_eq!(
vec![
KEEP_STATUS.clone(),
KEEP_STATUS.clone(),
DISCARD_STATUS.clone()
],
*response.status()
);
} | rust_cleaned_test_functions.jsonl/29907 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 343
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
81207,
4773,
368,
341,
262,
1077,
31558,
284,
3393,
25255,
486,
931,
1428,
262,
1077,
49721,
15,
284,
16164,
717,
396,
28884,
36884,
6744,
7,
15,
701,
220,
16,
15,
15,
317,
262,
1077,
49721,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_check_voting_power() {
let (validator_signers, validator_verifier) = random_validator_verifier(2, None, false);
let mut author_to_signature_map = BTreeMap::new();
assert_eq!(
validator_verifier
.check_voting_power(author_to_signature_map.keys())
.unwrap_err(),
VerifyError::TooLittleVotingPower {
voting_power: 0,
quorum_voting_power: 2,
}
);
let dummy_struct = TestLibraCrypto("Hello, World".to_string());
for validator in validator_signers.iter() {
author_to_signature_map.insert(validator.author(), validator.sign(&dummy_struct));
}
assert_eq!(
validator_verifier.check_voting_power(author_to_signature_map.keys()),
Ok(())
);
} | rust_cleaned_test_functions.jsonl/118879 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 436
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
2273,
11519,
20421,
368,
341,
286,
1077,
320,
16112,
11172,
388,
11,
22935,
26042,
3049,
8,
284,
4194,
64959,
26042,
3049,
7,
17,
11,
2240,
11,
895,
317,
286,
1077,
5206,
3150,
2346,
39859... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_left_integer() {
assert_has_variable!(interpret("X% = 1 + 2.1"), "X%", 3);
assert_has_variable!(interpret("X% = 1 + 2.5"), "X%", 4);
assert_has_variable!(interpret("X% = 1 + 2.1#"), "X%", 3);
assert_has_variable!(interpret("X% = 1 + 2"), "X%", 3);
assert_linter_err!("X% = 1 + \"hello\"", LinterError::TypeMismatch, 1, 10);
} | rust_cleaned_test_functions.jsonl/22648 | {
"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,
9579,
31725,
368,
341,
310,
2060,
21778,
14635,
10297,
16897,
445,
55,
4,
284,
220,
16,
488,
220,
17,
13,
16,
3975,
330,
55,
40192,
220,
18,
317,
310,
2060,
21778,
14635,
10297,
16897,
445,
55... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pow_function() -> Result<()> {
let tests = vec![
ScalarFunctionTest {
name: "pow-with-literal",
nullable: false,
columns: vec![Series::new([2]).into(), Series::new([2]).into()],
expect: DataColumn::Constant(4_f64.into(), 1),
error: "",
},
ScalarFunctionTest {
name: "pow-with-series",
nullable: false,
columns: vec![Series::new([2, 2]).into(), Series::new([2, -2]).into()],
expect: Series::new([4_f64, 0.25]).into(),
error: "",
},
ScalarFunctionTest {
name: "pow-with-null",
nullable: true,
columns: vec![
Series::new([Some(2), None, None]).into(),
Series::new([Some(2), Some(-2), None]).into(),
],
expect: Series::new([Some(4_f64), None, None]).into(),
error: "",
},
ScalarFunctionTest {
name: "pow-x-constant",
nullable: true,
columns: vec![
DataColumn::Constant(2.into(), 2),
Series::new([Some(2), Some(-2), None]).into(),
],
expect: Series::new([Some(4_f64), Some(0.25), None]).into(),
error: "",
},
ScalarFunctionTest {
name: "pow-y-constant",
nullable: true,
columns: vec![
Series::new([Some(2), Some(-2), None]).into(),
DataColumn::Constant(2.into(), 2),
],
expect: Series::new([Some(4_f64), Some(4.0), None]).into(),
error: "",
},
];
test_scalar_functions(PowFunction::try_create("pow")?, &tests)
} | rust_cleaned_test_functions.jsonl/71800 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 962
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56183,
9174,
368,
1464,
5714,
71698,
341,
262,
1077,
7032,
284,
7486,
90515,
286,
35176,
5152,
2271,
341,
310,
829,
25,
330,
21743,
26189,
2852,
9953,
756,
310,
13258,
25,
895,
345,
310,
8147,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_default_header() {
let options = Default::default();
assert_eq!(
Header::get_headers(&options),
vec!(
"Filesystem",
"1K-blocks",
"Used",
"Available",
"Use%",
"Mounted on"
)
);
} | rust_cleaned_test_functions.jsonl/110412 | {
"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,
9993,
8757,
368,
341,
286,
1077,
2606,
284,
7899,
486,
2258,
543,
286,
2060,
10714,
33673,
310,
12104,
486,
455,
26719,
2099,
2875,
1326,
310,
7486,
33673,
394,
330,
1703,
8948,
756,
394,
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... | 1 |
#[test]
fn test_5_times_5() {
let tokens = vec![
Token {
token_type: TokenType::IntegerLiteral,
value: Some("5".to_string()),
name: None,
},
Token {
token_type: TokenType::Star,
value: Some("*".to_string()),
name: None,
},
Token {
token_type: TokenType::IntegerLiteral,
value: Some("5".to_string()),
name: None,
},
Token {
token_type: TokenType::Semicolon,
value: None,
name: None,
}
];
let (node, rest) = super::parse_binary_operators(&tokens, 0);
assert_eq!(
node.unwrap(),
Node {
kind: NodeKind::BinaryOperator,
parent: None,
children: vec![
Node {
kind: NodeKind::Literal,
parent: None,
children: vec![],
value: Some("5".to_string()),
},
Node {
kind: NodeKind::Literal,
parent: None,
children: vec![],
value: Some("5".to_string()),
},
],
value: Some("*".to_string()),
}
)
} | rust_cleaned_test_functions.jsonl/25392 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1002
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
20,
22353,
62,
20,
368,
314,
715,
286,
1077,
11211,
284,
7486,
90515,
310,
9660,
314,
715,
394,
3950,
1819,
25,
56582,
486,
3486,
17350,
345,
394,
897,
25,
4329,
445,
20,
3263,
983,
3904,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_sequence_of() {
assert_parses_cb(
&[
(
Ok(vec![1, 2, 3]),
b"\x30\x09\x02\x01\x01\x02\x01\x02\x02\x01\x03",
),
(Ok(vec![]), b"\x30\x00"),
(
Err(ParseError::new(ParseErrorKind::ShortData)
.add_location(ParseLocation::Index(0))),
b"\x30\x02\x02\x01",
),
],
|p| Ok(p.read_element::<SequenceOf<i64>>()?.collect()),
)
} | rust_cleaned_test_functions.jsonl/40840 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 411
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
23735,
3575,
368,
341,
286,
2060,
77113,
288,
16450,
1006,
310,
609,
9640,
394,
2399,
503,
7622,
25592,
20703,
16,
11,
220,
17,
11,
220,
18,
17036,
503,
293,
11934,
87,
18,
15,
3462,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_to_bytes() {
assert_eq!(
Fp6::zero().to_bytes(),
[
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
]
);
assert_eq!(
Fp6::one().to_bytes(),
[
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
]
);
assert_eq!(
(-&Fp6::one()).to_bytes(),
[
0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
]
);
} | rust_cleaned_test_functions.jsonl/132397 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 618
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
12524,
368,
341,
286,
2060,
10714,
33673,
310,
434,
79,
21,
486,
14154,
1005,
983,
12524,
3148,
310,
2278,
394,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
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_exp_works() {
let answer = BigNumber::from_dec("259344723055062059907025491480697571938277889515152306249728583105665800713306759149981690559193987143012367913206299323899696942213235956742929677132122730441323862712594345230336").unwrap();
let test = BigNumber::from_u32(2).unwrap().exp(&BigNumber::from_u32(596).unwrap(), None).unwrap();
assert_eq!(answer, test);
} | rust_cleaned_test_functions.jsonl/31512 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 184
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14214,
11498,
82,
368,
341,
286,
1077,
4226,
284,
53673,
486,
1499,
13783,
445,
17,
20,
24,
18,
19,
19,
22,
17,
18,
15,
20,
20,
15,
21,
17,
15,
20,
24,
24,
15,
22,
15,
17,
20,
19,
24,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_into_ipv4addr_returns_ipv4addr() {
let mask: Ipv4Addr =
SubnetMask::try_from(24).expect("expected 24 to be a valid subnet mask").into();
assert_eq!(mask, std_ip_v4!("255.255.255.0"));
let mask: Ipv4Addr =
SubnetMask::try_from(0).expect("expected 0 to be a valid subnet mask").into();
assert_eq!(mask, Ipv4Addr::UNSPECIFIED);
let mask: Ipv4Addr =
SubnetMask::try_from(32).expect("expected 32 to be a valid subnet mask").into();
assert_eq!(mask, std_ip_v4!("255.255.255.255"));
} | rust_cleaned_test_functions.jsonl/68084 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 290
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45514,
49378,
19,
6214,
58900,
49378,
19,
6214,
368,
341,
286,
1077,
6911,
25,
358,
30168,
19,
13986,
4035,
310,
3719,
4711,
12686,
486,
1539,
5673,
7,
17,
19,
568,
17119,
445,
7325,
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_uvw() {
let atlas = TextureAtlas::new(4, 4);
assert_eq!([0.0, 0.0, 1.0, 1.0], atlas.uvw(0));
assert_eq!([0.0, 0.0, 1.0, 1.0], atlas.uvw(17));
assert_eq!([0.0, 0.0, 0.25, 0.25], atlas.uvw(1));
} | rust_cleaned_test_functions.jsonl/27368 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7300,
34431,
368,
341,
197,
10217,
60932,
284,
18757,
61116,
486,
931,
7,
19,
11,
220,
19,
317,
197,
6948,
10714,
0,
2561,
15,
13,
15,
11,
220,
15,
13,
15,
11,
220,
16,
13,
15,
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_virtio_device_read_config() {
let mut net = Net::default_net(TestMutators::default());
net.set_mac(MacAddr::parse_str("11:22:33:44:55:66").unwrap());
let mac = MacAddr::parse_str("11:22:33:44:55:66").unwrap();
let mut config_mac = [0u8; MAC_ADDR_LEN];
net.read_config(0, &mut config_mac);
assert_eq!(config_mac, mac.get_bytes());
// Invalid read.
config_mac = [0u8; MAC_ADDR_LEN];
net.read_config(MAC_ADDR_LEN as u64 + 1, &mut config_mac);
assert_eq!(config_mac, [0u8, 0u8, 0u8, 0u8, 0u8, 0u8]);
} | rust_cleaned_test_functions.jsonl/63421 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 317
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
2106,
815,
9204,
6443,
5332,
368,
341,
286,
1077,
5206,
4179,
284,
9374,
486,
2258,
19722,
31159,
51440,
2973,
486,
2258,
1423,
286,
4179,
980,
22802,
3189,
580,
13986,
486,
6400,
2895,
445,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_const_virtual_fns() {
let hdr = indoc! {"
#include <cstdint>
class A {
public:
A(uint32_t num) : b(num) {}
virtual uint32_t foo(uint32_t a) const { return a+1; };
virtual ~A() {}
uint32_t b;
};
class B: public A {
public:
B() : A(3), c(4) {}
virtual uint32_t foo(uint32_t a) const { return a+2; };
uint32_t c;
};
"};
let rs = quote! {
let a = ffi::A::make_unique(12);
assert_eq!(a.foo(2), 3);
let b = ffi::B::make_unique();
assert_eq!(b.foo(2), 4);
};
run_test("", hdr, rs, &["A", "B"], &[]);
} | rust_cleaned_test_functions.jsonl/9858 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 412
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13610,
58730,
761,
4412,
368,
341,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
286,
671,
997,
366,
96975,
397,
286,
536,
362,
341,
286,
584,
510,
310,
362,
8488,
18,
17,
528,
1629,
8,
549... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_end_by_negative_int() {
// added following https://github.com/stepancheg/rust-protobuf/pull/209
let mut test = Test1::new();
test.set_a(-1);
test_serialize_deserialize_with_dynamic("08 ff ff ff ff ff ff ff ff ff 01", &test);
} | rust_cleaned_test_functions.jsonl/2706 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6213,
3710,
53865,
4042,
368,
341,
262,
442,
3694,
2701,
3703,
1110,
5204,
905,
14,
9520,
3497,
791,
7382,
590,
12,
32921,
4322,
617,
14,
17,
15,
24,
198,
262,
1077,
5206,
1273,
284,
3393,
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_delete_permission_overwrite() {
let route = Route::DeletePermissionOverwrite {
channel_id: CHANNEL_ID,
target_id: ROLE_ID,
};
assert_eq!(
route.to_string(),
format!(
"channels/{channel_id}/permissions/{target_id}",
channel_id = CHANNEL_ID,
target_id = ROLE_ID
)
);
} | rust_cleaned_test_functions.jsonl/119907 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11353,
37971,
15431,
4934,
368,
341,
286,
1077,
6021,
284,
9572,
486,
6435,
14966,
1918,
4934,
341,
310,
5496,
842,
25,
58756,
3450,
345,
310,
2169,
842,
25,
69676,
3450,
345,
286,
2605,
286,
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_sorting_small() -> Result<()> {
let size = 5;
let address_bits = 20;
let timestamp_bits = 20;
test_sorting(size, address_bits, timestamp_bits)
} | rust_cleaned_test_functions.jsonl/114790 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18435,
287,
31966,
368,
1464,
5714,
71698,
341,
286,
1077,
1379,
284,
220,
20,
280,
286,
1077,
2621,
20034,
284,
220,
17,
15,
280,
286,
1077,
11441,
20034,
284,
220,
17,
15,
401,
286,
1273,
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 |
#[test]
fn test_layout_ratio() {
let bounds = Box3::new(0.0.into(), 100.0.into());
let mut layout = Layout::new(bounds);
let node = layout.add_node();
let node2 = layout.add_node();
layout.stack(Axis::X, &[node, node2]);
layout.stack(Axis::Y, &[node, node2]);
layout.ratio(Axis::X, node, node2, 2.0, REQUIRED);
layout.ratio(Axis::Y, node, node2, 3.0, REQUIRED);
let b1 = layout.query(node);
let b2 = layout.query(node2);
assert_eq!(b1.size.x, 2.0 * b2.size.x);
assert_eq!(b1.size.y, 3.0 * b2.size.y);
assert_eq!(b1.pos.x + b1.size.x, b2.pos.x);
assert_eq!(b1.pos.y + b1.size.y, b2.pos.y);
} | rust_cleaned_test_functions.jsonl/54694 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 325
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14466,
19917,
368,
341,
262,
1077,
14262,
284,
8261,
18,
486,
931,
7,
15,
13,
15,
39860,
1507,
220,
16,
15,
15,
13,
15,
39860,
1423,
262,
1077,
5206,
6789,
284,
13821,
486,
931,
67073,
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_create_tx_policy_path_required() {
let (wallet, _, _) = get_funded_wallet(get_test_a_or_b_plus_csv());
let addr = Address::from_str("2N1Ffz3WaNzbeLFBb51xyFMHYSEUXcbiSoX").unwrap();
wallet
.create_tx(TxBuilder::with_recipients(vec![(
addr.script_pubkey(),
30_000,
)]))
.unwrap();
} | rust_cleaned_test_functions.jsonl/11347 | {
"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,
8657,
17805,
22773,
2638,
18743,
368,
341,
286,
1077,
320,
35735,
11,
8358,
27439,
284,
633,
761,
36053,
62308,
5433,
4452,
4306,
8734,
880,
28043,
14020,
5231,
286,
1077,
10789,
284,
9177,
486,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_debug_output() {
struct DumbRng(u32);
impl RngCore for DumbRng {
fn next_u32(&mut self) -> u32 {
self.0 = self.0.wrapping_add(1);
self.0
}
fn next_u64(&mut self) -> u64 {
self.next_u32() as u64
}
fn fill_bytes(&mut self, dest: &mut [u8]) {
impls::fill_bytes_via_next(self, dest);
}
fn try_fill_bytes(&mut self, _dest: &mut [u8]) -> Result<(), Error> {
Err(Error::new(ErrorKind::Unavailable, "not implemented"))
}
}
let s = Secp256k1::new();
let (sk, _) = s.generate_keypair(&mut DumbRng(0));
assert_eq!(
&format!("{:?}", sk),
"SecretKey(0100000000000000020000000000000003000000000000000400000000000000)"
);
} | rust_cleaned_test_functions.jsonl/32189 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 497
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15446,
7645,
368,
341,
286,
2036,
422,
3551,
49,
968,
8154,
18,
17,
317,
286,
11605,
431,
968,
5386,
369,
422,
3551,
49,
968,
341,
310,
5168,
1790,
7300,
18,
17,
2099,
6984,
656,
8,
1464,
57... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_zero_pending() {
let semaphore = Semaphore::new(0);
println!("A {:?}", semaphore);
let mut a1 = TestFuture::new(&semaphore, 1);
println!("B {:?}", semaphore);
assert!(a1.poll().is_none());
println!("C {:?}", semaphore);
let mut a2 = TestFuture::new(&semaphore, 0);
let _g2 = a2.poll();
assert!(a2.poll().is_none());
assert_eq!(a1.count(), 0);
assert_eq!(a2.count(), 0);
mem::drop(a1);
assert_eq!(a2.count(), 1);
assert!(a2.poll().is_some());
} | rust_cleaned_test_functions.jsonl/84376 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 248
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19359,
37861,
368,
341,
262,
1077,
55918,
284,
87920,
486,
931,
7,
15,
317,
262,
13751,
17223,
32,
71964,
55918,
317,
262,
1077,
5206,
264,
16,
284,
3393,
24206,
486,
931,
2099,
6998,
25545,
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_len() {
let db = DB::new("./wiki/");
assert_eq!(6, db.len());
assert_eq!(false, db.is_empty());
let db = DB::new("./src/");
assert_eq!(0, db.len());
assert!(db.is_empty());
} | rust_cleaned_test_functions.jsonl/73778 | {
"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,
6043,
368,
341,
286,
1077,
2927,
284,
5952,
486,
931,
13988,
29707,
49897,
286,
2060,
10714,
10297,
21,
11,
2927,
19406,
1423,
286,
2060,
10714,
10297,
3849,
11,
2927,
2079,
15124,
5231,
286,
1077... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_write() {
let mut writes = vec![
Write::new(WriteType::Put, 0, None),
Write::new(WriteType::Delete, 0, Some(b"short_value".to_vec())),
];
for (i, write) in writes.drain(..).enumerate() {
let v = write.to_bytes();
let w = Write::parse(&v[..]).unwrap_or_else(|e| panic!("#{} parse() err: {:?}", i, e));
assert_eq!(w, write, "#{} expect {:?}, but got {:?}", i, write, w);
assert_eq!(Write::parse_type(&v).unwrap(), w.write_type);
}
assert!(Write::parse(b"").is_err());
let lock = Write::new(WriteType::Lock, 1, Some(b"short_value".to_vec()));
let v = lock.to_bytes();
assert!(Write::parse(&v[..1]).is_err());
assert_eq!(Write::parse_type(&v).unwrap(), lock.write_type);
} | rust_cleaned_test_functions.jsonl/58148 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 435
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
368,
341,
1789,
286,
1077,
5206,
13914,
284,
7486,
90515,
310,
9645,
486,
931,
7,
7985,
929,
486,
19103,
11,
220,
15,
11,
2240,
1326,
310,
9645,
486,
931,
7,
7985,
929,
486,
6435,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_select1() {
for &p in TEST_PROB {
for &n in TEST_SIZE {
let mut rng: StdRng = SeedableRng::from_seed([0; 32]);
let mut bv = BitVector::new();
let mut select_ans = vec![];
for i in 0..n {
let b = rng.gen_bool(p);
bv.push(b);
if b {
select_ans.push(i);
}
}
for (i, &r) in select_ans.iter().enumerate() {
assert_eq!(bv.select1(i as u64), r);
}
}
}
} | rust_cleaned_test_functions.jsonl/50481 | {
"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,
13051,
16,
368,
341,
286,
369,
609,
79,
304,
13602,
5756,
33,
341,
310,
369,
609,
77,
304,
13602,
4098,
341,
394,
1077,
5206,
28422,
25,
42517,
49,
968,
284,
35822,
480,
49,
968,
486,
1499,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_label_with_underscore() {
assert_eq!(
parse_mark("mark my_label\n"),
Ok(("\n", Instruction::Mark("my_label".into()))),
)
} | rust_cleaned_test_functions.jsonl/994 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6106,
6615,
62,
53933,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
18924,
445,
3987,
847,
6106,
1699,
4461,
310,
7622,
7,
4921,
77,
497,
29051,
486,
8949,
445,
2408,
6106,
3263,
18122,
10131,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_monitor_update_raa_while_paused() {
// Tests handling of an RAA while monitor updating has already been marked failed.
// Backported from chanmon_fail_consistency fuzz tests as this used to be broken.
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 mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let channel_id = create_announced_chan_between_nodes(&nodes, 0, 1, InitFeatures::known(), InitFeatures::known()).2;
send_payment(&nodes[0], &[&nodes[1]], 5000000);
let (route, our_payment_hash_1, payment_preimage_1, our_payment_secret_1) = get_route_and_payment_hash!(nodes[0], nodes[1], 1000000);
{
nodes[0].node.send_payment(&route, our_payment_hash_1, &Some(our_payment_secret_1)).unwrap();
check_added_monitors!(nodes[0], 1);
}
let send_event_1 = SendEvent::from_event(nodes[0].node.get_and_clear_pending_msg_events().remove(0));
let (route, our_payment_hash_2, payment_preimage_2, our_payment_secret_2) = get_route_and_payment_hash!(nodes[1], nodes[0], 1000000);
{
nodes[1].node.send_payment(&route, our_payment_hash_2, &Some(our_payment_secret_2)).unwrap();
check_added_monitors!(nodes[1], 1);
}
let send_event_2 = SendEvent::from_event(nodes[1].node.get_and_clear_pending_msg_events().remove(0));
nodes[1].node.handle_update_add_htlc(&nodes[0].node.get_our_node_id(), &send_event_1.msgs[0]);
nodes[1].node.handle_commitment_signed(&nodes[0].node.get_our_node_id(), &send_event_1.commitment_msg);
check_added_monitors!(nodes[1], 1);
let bs_raa = get_event_msg!(nodes[1], MessageSendEvent::SendRevokeAndACK, nodes[0].node.get_our_node_id());
chanmon_cfgs[0].persister.set_update_ret(Err(ChannelMonitorUpdateErr::TemporaryFailure));
nodes[0].node.handle_update_add_htlc(&nodes[1].node.get_our_node_id(), &send_event_2.msgs[0]);
nodes[0].node.handle_commitment_signed(&nodes[1].node.get_our_node_id(), &send_event_2.commitment_msg);
assert!(nodes[0].node.get_and_clear_pending_msg_events().is_empty());
nodes[0].logger.assert_log("lightning::ln::channelmanager".to_string(), "Failed to update ChannelMonitor".to_string(), 1);
check_added_monitors!(nodes[0], 1);
nodes[0].node.handle_revoke_and_ack(&nodes[1].node.get_our_node_id(), &bs_raa);
assert!(nodes[0].node.get_and_clear_pending_msg_events().is_empty());
nodes[0].logger.assert_log("lightning::ln::channelmanager".to_string(), "Previous monitor update failure prevented responses to RAA".to_string(), 1);
check_added_monitors!(nodes[0], 1);
chanmon_cfgs[0].persister.set_update_ret(Ok(()));
let (outpoint, latest_update, _) = nodes[0].chain_monitor.latest_monitor_update_id.lock().unwrap().get(&channel_id).unwrap().clone();
nodes[0].chain_monitor.chain_monitor.force_channel_monitor_updated(outpoint, latest_update);
check_added_monitors!(nodes[0], 0);
let as_update_raa = 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_update_raa.0);
check_added_monitors!(nodes[1], 1);
let bs_cs = 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_update_raa.1);
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_commitment_signed(&nodes[1].node.get_our_node_id(), &bs_cs.commitment_signed);
check_added_monitors!(nodes[0], 1);
let as_second_raa = get_event_msg!(nodes[0], MessageSendEvent::SendRevokeAndACK, nodes[1].node.get_our_node_id());
nodes[0].node.handle_revoke_and_ack(&nodes[1].node.get_our_node_id(), &bs_second_raa);
check_added_monitors!(nodes[0], 1);
expect_pending_htlcs_forwardable!(nodes[0]);
expect_payment_received!(nodes[0], our_payment_hash_2, our_payment_secret_2, 1000000);
nodes[1].node.handle_revoke_and_ack(&nodes[0].node.get_our_node_id(), &as_second_raa);
check_added_monitors!(nodes[1], 1);
expect_pending_htlcs_forwardable!(nodes[1]);
expect_payment_received!(nodes[1], our_payment_hash_1, our_payment_secret_1, 1000000);
claim_payment(&nodes[0], &[&nodes[1]], payment_preimage_1);
claim_payment(&nodes[1], &[&nodes[0]], payment_preimage_2);
} | rust_cleaned_test_functions.jsonl/58341 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1772
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40112,
8882,
59969,
64,
86069,
55475,
2591,
368,
341,
197,
322,
20150,
11589,
315,
458,
431,
6029,
1393,
8718,
21010,
702,
2669,
1012,
12864,
4641,
624,
197,
322,
6841,
35526,
504,
26023,
1645,
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_part_1_examples() {
let tests = vec![
(
"example input",
Container {
input: vec![0, 3, 6],
},
436,
),
(
"bullet 1",
Container {
input: vec![1, 3, 2],
},
1,
),
(
"bullet 2",
Container {
input: vec![2, 1, 3],
},
10,
),
(
"bullet 3",
Container {
input: vec![1, 2, 3],
},
27,
),
(
"bullet 4",
Container {
input: vec![2, 3, 1],
},
78,
),
(
"bullet 5",
Container {
input: vec![3, 2, 1],
},
438,
),
(
"bullet 6",
Container {
input: vec![3, 1, 2],
},
1836,
),
];
for test in tests.iter() {
assert_eq!(
Ok(test.2.to_string()),
test.1.part_1(),
" test: {}",
test.0
);
}
} | rust_cleaned_test_functions.jsonl/103729 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10495,
62,
16,
45279,
368,
341,
286,
1077,
7032,
284,
7486,
90515,
310,
2399,
394,
330,
8687,
1946,
756,
394,
9678,
341,
503,
1946,
25,
7486,
20703,
15,
11,
220,
18,
11,
220,
21,
1259,
394,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_tsx_escape_xhtml() {
let source = r#"<div id="abc>" />"#;
let expected = r#"/*#__PURE__*/ React.createElement("div", {
id: "abc>"
});
"#;
let compiled_es5 = compile(
source,
Options {
config: Config {
jsc: JscConfig {
syntax: Some(Syntax::Typescript(TsConfig {
tsx: true,
..Default::default()
})),
target: Some(EsVersion::Es5),
..Default::default()
},
..Default::default()
},
swcrc: false,
..Default::default()
},
);
assert_eq!(compiled_es5, expected);
let compiled_es2020 = compile(
source,
Options {
config: Config {
jsc: JscConfig {
syntax: Some(Syntax::Typescript(TsConfig {
tsx: true,
..Default::default()
})),
target: Some(EsVersion::Es2020),
..Default::default()
},
..Default::default()
},
swcrc: false,
..Default::default()
},
);
assert_eq!(compiled_es2020, expected);
} | rust_cleaned_test_functions.jsonl/80435 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 801
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25023,
87,
21832,
3212,
1551,
368,
341,
262,
1077,
2530,
284,
435,
2,
22476,
611,
877,
428,
13683,
15361,
10892,
6206,
57676,
401,
262,
1077,
3601,
284,
435,
55543,
1057,
44087,
45361,
50993,
3592... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_trace_when_process_has_exited() {
#[cfg(target_os = "macos")]
if !nix::unistd::Uid::effective().is_root() {
println!("Skipping test because we're not running as root");
return;
}
let mut cmd = RubyScript::new("ci/ruby-programs/infinite.rb");
let mut getter = crate::core::initialize::initialize(cmd.id(), true, None).unwrap();
cmd.kill().expect("couldn't clean up test process");
let mut i = 0;
loop {
match getter.get_trace() {
Err(e) => {
if let Some(crate::core::types::MemoryCopyError::ProcessEnded) =
e.downcast_ref()
{
// This is the expected error
return;
}
}
_ => {}
};
std::thread::sleep(std::time::Duration::from_millis(100));
i += 1;
if i > 50 {
panic!("Didn't get ProcessEnded in a reasonable amount of time");
}
}
} | rust_cleaned_test_functions.jsonl/90835 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 621
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
23575,
47636,
11305,
21778,
2702,
1608,
368,
341,
286,
11506,
14072,
8637,
29387,
284,
330,
11948,
436,
5422,
286,
421,
753,
77,
941,
486,
27483,
486,
33507,
486,
77895,
1005,
285,
12993,
36... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_signature() {
// message must be 32 bytes
let data: [u8; HASH_BYTES_LEN] = [
0xc5, 0xd2, 0x46, 0x01, 0x86, 0xf7, 0x23, 0x3c, 0x92, 0x7e, 0x7d, 0xb2, 0xdc, 0xc7,
0x03, 0xc0, 0xe5, 0x00, 0xb6, 0x53, 0xca, 0x82, 0x27, 0x3b, 0x7b, 0xfa, 0xd8, 0x04,
0x5d, 0x85, 0xa4, 0x70,
];
let (pubkey, privkey) = generate_keypair().unwrap();
let signature = sign_message(&pubkey, &privkey, &data).unwrap();
assert_eq!(recover_signature(&data, &signature), Ok(pubkey));
} | rust_cleaned_test_functions.jsonl/5634 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 326
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39859,
368,
341,
286,
442,
1943,
1969,
387,
220,
18,
17,
5820,
198,
286,
1077,
821,
25,
508,
84,
23,
26,
58857,
40705,
15536,
60,
284,
2278,
310,
220,
15,
8148,
20,
11,
220,
15,
9703,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.