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_spending_condition_p2pkh() {
// p2pkh
let hash = [0x11; 20];
let sign_uncompressed = [0xff; 65];
let sign_compressed = [0xfe; 65];
let mut spending_condition_signer = vec![HashMode::P2PKH as u8];
spending_condition_signer.extend_from_slice(hash.as_ref());
spending_condition_signer.extend_from_slice(123usize.to_be_bytes().as_ref());
spending_condition_signer.extend_from_slice(456usize.to_be_bytes().as_ref());
let mut signature = vec![TransactionPublicKeyEncoding::Uncompressed as u8];
signature.extend_from_slice(sign_uncompressed.as_ref());
let spending_condition_p2pkh_uncompressed = TransactionSpendingCondition {
signer: SpendingConditionSigner {
data: arrayref::array_ref!(
spending_condition_signer,
0,
SPENDING_CONDITION_SIGNER_LEN
),
},
signature: SpendingConditionSignature::Singlesig(SinglesigSpendingCondition(
arrayref::array_ref!(signature, 0, SINGLE_SPENDING_CONDITION_LEN),
)),
};
let spending_condition_p2pkh_uncompressed_bytes = vec![
// hash mode
HashMode::P2PKH as u8,
// signer
0x11,
0x11,
0x11,
0x11,
0x11,
0x11,
0x11,
0x11,
0x11,
0x11,
0x11,
0x11,
0x11,
0x11,
0x11,
0x11,
0x11,
0x11,
0x11,
0x11,
// nonce
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x7b,
// fee rate
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x01,
0xc8,
TransactionPublicKeyEncoding::Uncompressed as u8,
// signature
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
];
let mut spending_condition_signer = vec![HashMode::P2PKH as u8];
spending_condition_signer.extend_from_slice(hash.as_ref());
spending_condition_signer.extend_from_slice(345usize.to_be_bytes().as_ref());
spending_condition_signer.extend_from_slice(456usize.to_be_bytes().as_ref());
let mut signature = vec![TransactionPublicKeyEncoding::Compressed as u8];
signature.extend_from_slice(sign_compressed.as_ref());
let spending_condition_p2pkh_compressed = TransactionSpendingCondition {
signer: SpendingConditionSigner {
data: arrayref::array_ref!(
spending_condition_signer,
0,
SPENDING_CONDITION_SIGNER_LEN
),
},
signature: SpendingConditionSignature::Singlesig(SinglesigSpendingCondition(
arrayref::array_ref!(signature, 0, SINGLE_SPENDING_CONDITION_LEN),
)),
};
let spending_condition_p2pkh_compressed_bytes = vec![
// hash mode
HashMode::P2PKH as u8,
// signer
0x11,
0x11,
0x11,
0x11,
0x11,
0x11,
0x11,
0x11,
0x11,
0x11,
0x11,
0x11,
0x11,
0x11,
0x11,
0x11,
0x11,
0x11,
0x11,
0x11,
// nonce
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x01,
0x59,
// fee rate
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x01,
0xc8,
// key encoding
TransactionPublicKeyEncoding::Compressed as u8,
// signature
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
0xfe,
];
let (bytes, compressed) =
TransactionSpendingCondition::from_bytes(&spending_condition_p2pkh_compressed_bytes)
.unwrap();
assert_eq!(spending_condition_p2pkh_compressed, compressed);
assert_eq!(bytes.len(), 0);
let (bytes, uncompressed) =
TransactionSpendingCondition::from_bytes(&spending_condition_p2pkh_uncompressed_bytes)
.unwrap();
assert_eq!(spending_condition_p2pkh_uncompressed, uncompressed);
assert_eq!(bytes.len(), 0);
} | rust_cleaned_test_functions.jsonl/31984 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 4795
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10123,
2459,
27656,
620,
17,
20819,
71,
368,
341,
286,
442,
281,
17,
20819,
71,
198,
286,
1077,
5175,
284,
508,
15,
87,
16,
16,
26,
220,
17,
15,
935,
286,
1077,
1841,
4907,
45703,
284,
508,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cached_dfs_cyclic() {
// | v | |
let (graph, _nodes) = graph! {
n4 -> n0,
n8 -> n4,
n4 -> n5,
n1 -> n5,
n9 -> n5,
n2 -> n1,
n5 -> n6,
n6 -> n2,
n10 -> n6,
n6 -> n7,
n7 -> n3,
n11 -> n7,
};
reduce(&graph, &["n8", "n9", "n10", "n11"], &["n0", "n1", "n2", "n3"], &[
"n10 -> n5",
"n11 -> n3",
"n4 -> n0",
"n4 -> n5",
"n5 -> n1",
"n5 -> n2",
"n5 -> n3",
"n8 -> n4",
"n9 -> n5"
]);
} | rust_cleaned_test_functions.jsonl/32902 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 504
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64369,
814,
3848,
666,
65304,
368,
1476,
9401,
262,
442,
262,
760,
981,
348,
981,
760,
981,
9248,
41693,
14808,
262,
1077,
320,
4439,
11,
716,
20008,
8,
284,
4771,
0,
341,
1789,
286,
308,
19,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_macro() {
assert_eq!(dec!(75), Decimal::from(75));
assert_eq!(dec!(75, 1), Decimal::with_scale(75, 1));
} | rust_cleaned_test_functions.jsonl/87128 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 68
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58810,
368,
341,
262,
2060,
10714,
10297,
8169,
10297,
22,
20,
701,
26728,
486,
1499,
7,
22,
20,
1106,
262,
2060,
10714,
10297,
8169,
10297,
22,
20,
11,
220,
16,
701,
26728,
486,
4197,
16727,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_quiet() {
let dirs = &[];
let files = &["a.foo", "b.foo"];
let te = TestEnv::new(dirs, files);
te.assert_output(&["-q"], "");
te.assert_output(&["--quiet"], "");
te.assert_output(&["--has-results"], "");
te.assert_failure_with_error(&["--quiet", "c.foo"], "")
} | rust_cleaned_test_functions.jsonl/65625 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11280,
3891,
368,
341,
262,
1077,
42248,
284,
609,
15078,
262,
1077,
3542,
284,
609,
1183,
64,
58432,
497,
330,
65,
58432,
6332,
262,
1077,
1013,
284,
3393,
14359,
486,
931,
14161,
82,
11,
3542,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bench_no_fail_fast() {
if !is_nightly() {
return;
}
let p = project()
.file("Cargo.toml", &basic_bin_manifest("foo"))
.file(
"src/foo.rs",
r#"
#![feature(test)]
#[cfg(test)]
extern crate test;
fn hello() -> &'static str {
"hello"
}
pub fn main() {
println!("{}", hello())
}
#[bench]
fn bench_hello(_b: &mut test::Bencher) {
assert_eq!(hello(), "hello")
}
#[bench]
fn bench_nope(_b: &mut test::Bencher) {
assert_eq!("nope", hello())
}"#,
).build();
p.cargo("bench --no-fail-fast -- --test-threads=1")
.with_status(101)
.with_stderr_contains("[RUNNING] target/release/deps/foo-[..][EXE]")
.with_stdout_contains("running 2 tests")
.with_stderr_contains("[RUNNING] target/release/deps/foo-[..][EXE]")
.with_stdout_contains("test bench_hello [..]")
.with_stdout_contains("test bench_nope [..]")
.run();
} | rust_cleaned_test_functions.jsonl/50461 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 672
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
19762,
6536,
22121,
35743,
368,
341,
262,
421,
753,
285,
1089,
71948,
368,
341,
286,
470,
280,
262,
555,
262,
1077,
281,
284,
2390,
741,
286,
659,
1192,
445,
98228,
73494,
75,
497,
609,
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_shuffle() {
let mut state = PlaybackState::default();
state.queue(song("1"));
state.queue(song("2"));
state.queue(song("3"));
state.queue(song("4"));
assert_eq!(state.songs().count(), 4);
state.play("2");
assert_eq!(state.current_position(), Some(1));
state.toggle_shuffle();
assert!(state.is_shuffled());
assert_eq!(state.current_position(), Some(0));
state.play_next();
assert_eq!(state.current_position(), Some(1));
state.toggle_shuffle();
assert!(!state.is_shuffled());
let ids = state.song_ids();
assert_eq!(ids, vec!["1", "2", "3", "4"]);
} | rust_cleaned_test_functions.jsonl/20827 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 345
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73484,
368,
341,
286,
1077,
5206,
1584,
284,
95301,
1397,
486,
2258,
543,
286,
1584,
29598,
60873,
445,
16,
4010,
286,
1584,
29598,
60873,
445,
17,
4010,
286,
1584,
29598,
60873,
445,
18,
4010,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_nothing() {
let evt = EventFd::new(EFD_NONBLOCK).unwrap();
let r = evt.read();
match r {
Err(ref inner) if inner.kind() == io::ErrorKind::WouldBlock => (),
_ => panic!("Unexpected"),
}
} | rust_cleaned_test_functions.jsonl/18672 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
6536,
1596,
368,
341,
286,
1077,
12358,
284,
3665,
74476,
486,
931,
10722,
14596,
22128,
39964,
568,
15454,
543,
286,
1077,
435,
284,
12358,
4125,
543,
286,
2432,
435,
341,
310,
15495,
13321... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_command_where_command_takes_n_flag() {
new_ucmd!()
.args(&["-n", "19", "echo", "-n", "a"])
.run()
.stdout_is("a");
} | rust_cleaned_test_functions.jsonl/15169 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10811,
36814,
10811,
528,
2050,
1089,
10933,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
12,
77,
497,
330,
16,
24,
497,
330,
3047,
497,
6523,
77,
497,
330,
64,
14108,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_docclass() {
let source1 = "docclass article";
let source2 = "docclass standalone (tikz)";
let source3 = "docclass standalone ( tikz )";
let source4 = "docclass coprime (korean, tikz, tcolorbox)";
let source5 = r#"docclass coprime (
korean,
tikz,
tcolorbox
)"#;
let source6 = r#"docclass coprime (
korean,
tikz,
tcolorbox,
)"#;
let expected1 = "\\documentclass{article}\n";
let expected2 = "\\documentclass[tikz]{standalone}\n";
let expected3 = "\\documentclass[korean,tikz,tcolorbox]{coprime}\n";
let mut parser1 = Parser::new(Lexer::new(source1));
let mut parser2 = Parser::new(Lexer::new(source2));
let mut parser3 = Parser::new(Lexer::new(source3));
let mut parser4 = Parser::new(Lexer::new(source4));
let mut parser5 = Parser::new(Lexer::new(source5));
let mut parser6 = Parser::new(Lexer::new(source6));
assert_eq!(expected1, parser1.make_latex_format().unwrap());
assert_eq!(expected2, parser2.make_latex_format().unwrap());
assert_eq!(expected2, parser3.make_latex_format().unwrap());
assert_eq!(expected3, parser4.make_latex_format().unwrap());
assert_eq!(expected3, parser5.make_latex_format().unwrap());
assert_eq!(expected3, parser6.make_latex_format().unwrap());
} | rust_cleaned_test_functions.jsonl/131291 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 539
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
18869,
1040,
368,
341,
262,
1077,
2530,
16,
284,
330,
5236,
1040,
4549,
876,
262,
1077,
2530,
17,
284,
330,
5236,
1040,
43388,
320,
83,
1579,
89,
24023,
262,
1077,
2530,
18,
284,
330,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pop() {
assert_eq!(
parse("Pop S4 RX2").unwrap().body,
vec![Node(
Statement::Operator(Node(
Operator::Pop(
Node(StackRef(4), span(1, 5, 1, 7)),
Node(RegisterRef::User(2), span(1, 8, 1, 11)),
),
span(1, 1, 1, 11)
)),
span(1, 1, 1, 11)
)]
);
} | rust_cleaned_test_functions.jsonl/118223 | {
"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,
17061,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
445,
11598,
328,
19,
28170,
17,
1827,
15454,
1005,
2599,
345,
310,
7486,
20703,
1955,
1006,
394,
21756,
486,
18461,
22078,
1006,
503,
28498,
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_pri_decomposes() {
assert_eq!(
decompose_pri(0),
(
Some(SyslogFacility::LOG_KERN),
Some(SyslogSeverity::SEV_EMERG)
)
);
assert_eq!(
decompose_pri(165),
(
Some(SyslogFacility::LOG_LOCAL4),
Some(SyslogSeverity::SEV_NOTICE)
)
);
} | rust_cleaned_test_functions.jsonl/26051 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 218
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
85639,
2259,
874,
8285,
368,
341,
262,
2060,
10714,
33673,
286,
28502,
2900,
85639,
7,
15,
1326,
286,
2399,
310,
4329,
3759,
1047,
839,
28702,
1403,
486,
7243,
10102,
13660,
1326,
310,
4329,
3759,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_managed_api() {
// Some basic setup functions for the managed group.
let handshake_message_format = HandshakeMessageFormat::Plaintext;
let update_policy = UpdatePolicy::default();
let callbacks = ManagedGroupCallbacks::default();
let managed_group_config = ManagedGroupConfig::new(
handshake_message_format,
update_policy,
0,
0,
false, // use_ratchet_tree_extension
callbacks,
);
let number_of_clients = 20;
let setup = ManagedTestSetup::new(
managed_group_config,
number_of_clients,
CodecUse::SerializedMessages,
);
for ciphersuite in Config::supported_ciphersuites() {
let group_id = setup.create_random_group(3, ciphersuite).unwrap();
let mut groups = setup.groups.borrow_mut();
let group = groups.get_mut(&group_id).unwrap();
// Add two new members.
let (_, adder_id) = group.members[0].clone();
let new_members = setup.random_new_members_for_group(group, 2).unwrap();
setup
.add_clients(ActionType::Commit, group, &adder_id, new_members)
.unwrap();
// Remove a member
let (_, remover_id) = group.members[2].clone();
let (_, target_id) = group.members[3].clone();
setup
.remove_clients(ActionType::Commit, group, &remover_id, vec![target_id])
.unwrap();
// Check that all group members agree on the same group state.
setup.check_group_states(group);
}
} | rust_cleaned_test_functions.jsonl/127648 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 657
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
79889,
11697,
368,
341,
262,
442,
4329,
6770,
6505,
5746,
369,
279,
8975,
1874,
624,
262,
1077,
57020,
6462,
8955,
284,
8536,
29661,
2052,
4061,
486,
2120,
1641,
427,
280,
262,
1077,
2647,
22773,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_layered_reader() {
let mut input = io::Cursor::new(b"hello world");
let mut reader = LayeredReader::new(&mut input);
let mut s = String::new();
reader.read_to_string(&mut s).unwrap();
assert_eq!(s, "hello world");
} | rust_cleaned_test_functions.jsonl/31942 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12680,
291,
22306,
368,
341,
262,
1077,
5206,
1946,
284,
6399,
486,
14543,
486,
931,
1883,
1,
14990,
1879,
797,
262,
1077,
5206,
6604,
284,
22735,
17120,
486,
931,
2099,
6984,
1946,
317,
262,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_link_error() {
assert_eq!(
GiDocgen::from_str("[error@Gtk.BuilderParseError]"),
Ok(GiDocgen::Error {
namespace: Some("Gtk".to_string()),
type_: "BuilderParseError".to_string()
})
);
} | rust_cleaned_test_functions.jsonl/78470 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 168
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7233,
4096,
368,
341,
286,
2060,
10714,
33673,
310,
15392,
9550,
4370,
486,
1499,
2895,
10937,
841,
31,
45103,
15641,
14463,
1454,
60,
4461,
310,
7622,
6699,
72,
9550,
4370,
486,
1454,
341,
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_serial_bus_write() {
let serial_out = SharedBuffer::new();
let intr_evt = EventFdTrigger::new(EventFd::new(libc::EFD_NONBLOCK).unwrap());
let metrics = Arc::new(SerialDeviceMetrics::default());
let mut serial = SerialDevice {
serial: Serial::with_events(
intr_evt,
SerialEventsWrapper {
metrics: metrics.clone(),
buffer_ready_event_fd: None,
},
Box::new(serial_out.clone()),
),
input: None,
};
let invalid_writes_before = serial.serial.events().metrics.missed_write_count.count();
<dyn BusDevice>::write(&mut serial, 0u64, &[b'x', b'y']);
let writes_before = metrics.write_count.count();
let invalid_writes_after = metrics.missed_write_count.count();
assert_eq!(invalid_writes_before + 1, invalid_writes_after);
<dyn BusDevice>::write(&mut serial, 0u64, &[b'a']);
<dyn BusDevice>::write(&mut serial, 0u64, &[b'b']);
<dyn BusDevice>::write(&mut serial, 0u64, &[b'c']);
assert_eq!(
serial_out.buf.lock().unwrap().as_slice(),
&[b'a', b'b', b'c']
);
let invalid_writes_after_2 = metrics.missed_write_count.count();
let writes_after = metrics.write_count.count();
// The `invalid_write_count` metric should be the same as before the one-byte writes.
assert_eq!(invalid_writes_after_2, invalid_writes_after);
assert_eq!(writes_after, writes_before + 3);
} | rust_cleaned_test_functions.jsonl/118640 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 772
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25602,
25418,
9165,
368,
341,
286,
1077,
6146,
6068,
284,
16990,
4095,
486,
931,
543,
286,
1077,
10582,
60019,
284,
3665,
74476,
17939,
486,
931,
30469,
74476,
486,
931,
44828,
66,
486,
36,
14596,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_touch_system_fails() {
let (_at, mut ucmd) = at_and_ucmd!();
let file = "/";
ucmd.args(&[file])
.fails()
.stderr_contains("setting times of '/'");
} | rust_cleaned_test_functions.jsonl/41038 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60840,
17687,
761,
6209,
368,
341,
262,
1077,
5453,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
1077,
1034,
284,
79480,
262,
575,
8710,
16365,
2099,
58,
1192,
2546,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_fast_divide_normalized() {
let mut rng = StdRng::seed_from_u64(1);
for _ in 0..1000000 {
let d = rng.gen_range(Word::MAX / 2 + 1..=Word::MAX);
let q = rng.gen();
let r = rng.gen_range(0..d);
let a = extend_word(q) * extend_word(d) + extend_word(r);
let fast_div = FastDivideNormalized::new(d);
assert_eq!(fast_div.div_rem(a), (q, r));
}
} | rust_cleaned_test_functions.jsonl/69728 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 255
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35743,
16237,
577,
80006,
368,
341,
286,
1077,
5206,
28422,
284,
42517,
49,
968,
486,
22602,
5673,
7300,
21,
19,
7,
16,
317,
286,
369,
716,
304,
220,
15,
496,
16,
15,
15,
15,
15,
15,
15,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_hover_tuple_field() {
let (analysis, position) = single_file_with_position(
"
struct TS(String, i32<|>);
",
);
let hover = analysis.hover(position).unwrap().unwrap();
assert_eq!(trim_markup_opt(hover.info.first()), Some("i32"));
assert_eq!(hover.info.is_exact(), true);
} | rust_cleaned_test_functions.jsonl/27090 | {
"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,
53445,
21773,
5013,
368,
341,
286,
1077,
320,
34484,
11,
2309,
8,
284,
3175,
2458,
6615,
9661,
1006,
310,
6228,
310,
2036,
22965,
2242,
11,
600,
18,
17,
27,
91,
42013,
310,
21796,
286,
1439,
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_radio_mock_check_transmit() {
let mut radio = MockRadio::new(&[
Transaction::check_transmit(Ok(false)),
Transaction::check_transmit(Ok(true)),
]);
let res = radio.check_transmit().unwrap();
assert_eq!(false, res);
let res = radio.check_transmit().unwrap();
assert_eq!(true, res);
radio.done();
} | rust_cleaned_test_functions.jsonl/35590 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 192
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49740,
34134,
7200,
7965,
1763,
368,
341,
286,
1077,
5206,
8887,
284,
14563,
28203,
486,
931,
2099,
9640,
310,
17869,
486,
2028,
7965,
1763,
7,
11578,
3576,
6965,
310,
17869,
486,
2028,
7965,
1763... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_boundary() {
let content_type = "multipart/form-data; boundary=ABCDEFG";
assert_eq!(parse_boundary(content_type), Ok("ABCDEFG".to_owned()));
let content_type = "multipart/form-data; boundary=------ABCDEFG";
assert_eq!(parse_boundary(content_type), Ok("------ABCDEFG".to_owned()));
let content_type = "boundary=------ABCDEFG";
assert!(parse_boundary(content_type).is_err());
let content_type = "text/plain";
assert!(parse_boundary(content_type).is_err());
let content_type = "text/plain; boundary=------ABCDEFG";
assert!(parse_boundary(content_type).is_err());
} | rust_cleaned_test_functions.jsonl/35164 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 286
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
54004,
368,
341,
286,
1077,
2213,
1819,
284,
330,
29542,
20260,
13945,
26,
18732,
28,
67004,
876,
286,
2060,
10714,
10297,
6400,
54004,
15063,
1819,
701,
7622,
445,
67004,
3263,
983,
51973,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_opencl_1_2_example() {
let platform_ids = get_platform_ids().unwrap();
assert!(0 < platform_ids.len());
// Choose the first platform
let platform_id = platform_ids[0];
let platform_name = get_platform_info(platform_id, CL_PLATFORM_NAME).unwrap();
println!("Platform Name: {}", platform_name);
let device_ids = get_device_ids(platform_id, CL_DEVICE_TYPE_GPU).unwrap();
assert!(0 < device_ids.len());
// Choose the first GPU device
let device_id = device_ids[0];
let vendor_name = get_device_info(device_id, CL_DEVICE_VENDOR).unwrap();
println!("OpenCL device vendor name: {}", vendor_name);
let vendor_id = get_device_info(device_id, CL_DEVICE_VENDOR_ID).unwrap();
println!("OpenCL device vendor id: {:X}", u32::from(vendor_id));
// Set up OpenCL compute environment
// Create OpenCL context from the first device
let device_ids = [device_id];
let context = create_context(&device_ids, ptr::null(), None, ptr::null_mut()).unwrap();
// Create the OpenCL program source
let sources = [PROGRAM_SOURCE];
let program = create_program_with_source(context, &sources).unwrap();
// Build the OpenCL program for the device
let build_options = CString::default();
build_program(program, &device_ids, &build_options, None, ptr::null_mut()).unwrap();
// Create the OpenCL kernel from the program
let kernel_name = CString::new(KERNEL_NAME).unwrap();
let kernel = create_kernel(program, &kernel_name).unwrap();
// Create a command_queue for the device
let queue = create_command_queue(context, device_id, CL_QUEUE_PROFILING_ENABLE).unwrap();
// Process some data
// The input data
const ARRAY_SIZE: usize = 1000;
let ones: [cl_float; ARRAY_SIZE] = [1.0; ARRAY_SIZE];
let mut sums: [cl_float; ARRAY_SIZE] = [0.0; ARRAY_SIZE];
for i in 0..ARRAY_SIZE {
sums[i] = 1.0 + 1.0 * i as cl_float;
}
// Create OpenCL device buffers for input and output data
let x = create_buffer(
context,
CL_MEM_WRITE_ONLY,
ARRAY_SIZE * mem::size_of::<cl_float>(),
ptr::null_mut(),
)
.unwrap();
let y = create_buffer(
context,
CL_MEM_WRITE_ONLY,
ARRAY_SIZE * mem::size_of::<cl_float>(),
ptr::null_mut(),
)
.unwrap();
let z = create_buffer(
context,
CL_MEM_READ_ONLY,
ARRAY_SIZE * mem::size_of::<cl_float>(),
ptr::null_mut(),
)
.unwrap();
// Blocking write to OpenCL device buffer
let x_write_event = enqueue_write_buffer(
queue,
x,
CL_BLOCKING,
0,
ones.len() * mem::size_of::<cl_float>(),
ones.as_ptr() as cl_mem,
0,
ptr::null(),
)
.unwrap();
// Non-blocking write to OpenCL device buffer
let y_write_event = enqueue_write_buffer(
queue,
y,
CL_NON_BLOCKING,
0,
sums.len() * mem::size_of::<cl_float>(),
sums.as_ptr() as cl_mem,
0,
ptr::null(),
)
.unwrap();
// wait for y_write_event
let mut events: Vec<cl_event> = Vec::default();
events.push(y_write_event);
wait_for_events(&events).unwrap();
// a value for the kernel function
let a: cl_float = 300.0;
// Set up the arguments to call the OpenCL kernel function
set_kernel_arg(
kernel,
0,
mem::size_of::<cl_mem>(),
&z as *const _ as *const c_void,
)
.unwrap();
set_kernel_arg(
kernel,
1,
mem::size_of::<cl_mem>(),
&x as *const _ as *const c_void,
)
.unwrap();
set_kernel_arg(
kernel,
2,
mem::size_of::<cl_mem>(),
&y as *const _ as *const c_void,
)
.unwrap();
set_kernel_arg(
kernel,
3,
mem::size_of::<cl_float>(),
&a as *const _ as *const c_void,
)
.unwrap();
// Enqueue the OpenCL kernel for execution
let global_work_sizes: [size_t; 1] = [ARRAY_SIZE];
let kernel_event = enqueue_nd_range_kernel(
queue,
kernel,
1,
ptr::null(),
global_work_sizes.as_ptr(),
ptr::null(),
0,
ptr::null(),
)
.unwrap();
// Push the kernel_event to the events wait list so that enqueue_read_buffer
// can wait on it
events.clear();
events.push(kernel_event);
// Create a results array to hold the results from the OpenCL device z buffer
// and enqueue a read command to read the device buffer into the array
// after the kernel event completes.
let results: [cl_float; ARRAY_SIZE] = [0.0; ARRAY_SIZE];
let read_event = enqueue_read_buffer(
queue,
z,
CL_NON_BLOCKING,
0,
results.len() * mem::size_of::<cl_float>(),
results.as_ptr() as cl_mem,
1,
events.as_ptr(),
)
.unwrap();
events.clear();
finish(queue).unwrap();
// Test and print the results from OpenCL
assert_eq!(1300.0, results[ARRAY_SIZE - 1]);
println!("results back: {}", results[ARRAY_SIZE - 1]);
let start_time = get_event_profiling_info(kernel_event, CL_PROFILING_COMMAND_START).unwrap();
let end_time = get_event_profiling_info(kernel_event, CL_PROFILING_COMMAND_END).unwrap();
let duration = u64::from(end_time) - u64::from(start_time);
println!("kernel execution duration (ns): {}", duration);
// Release OpenCL objects
release_event(x_write_event).unwrap();
release_event(y_write_event).unwrap();
release_event(kernel_event).unwrap();
release_event(read_event).unwrap();
release_mem_object(z).unwrap();
release_mem_object(y).unwrap();
release_mem_object(x).unwrap();
// Release the OpenCL compute environment
release_kernel(kernel).unwrap();
release_program(program).unwrap();
release_command_queue(queue).unwrap();
release_context(context).unwrap();
} | rust_cleaned_test_functions.jsonl/125638 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2610
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11311,
564,
62,
16,
62,
17,
39304,
368,
341,
262,
1077,
5339,
8077,
284,
633,
34260,
8077,
1005,
15454,
543,
262,
2060,
10297,
15,
366,
5339,
8077,
19406,
5231,
262,
442,
22201,
279,
1156,
5339,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_clone() {
let x = Rc::new(RefCell::new(5));
let y = x.clone();
*x.borrow_mut() = 20;
assert_eq!(*y.borrow(), 20);
} | rust_cleaned_test_functions.jsonl/4655 | {
"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,
54742,
368,
341,
286,
1077,
856,
284,
81463,
486,
931,
7,
3945,
3599,
486,
931,
7,
20,
1106,
286,
1077,
379,
284,
856,
15997,
543,
286,
353,
87,
83640,
29523,
368,
284,
220,
17,
15,
280,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_flood_fill() {
let test_cases = [
TestCase {
image: vec![vec![1, 1, 1], vec![1, 1, 0], vec![1, 0, 1]],
sr: 1,
sc: 1,
new_color: 2,
expected: vec![vec![2, 2, 2], vec![2, 2, 0], vec![2, 0, 1]],
},
TestCase {
image: vec![vec![0, 0, 0], vec![0, 1, 1]],
sr: 1,
sc: 1,
new_color: 1,
expected: vec![vec![0, 0, 0], vec![0, 1, 1]],
},
];
for case in test_cases.iter() {
assert_eq!(
case.expected,
Solution::flood_fill(
case.image.clone(),
case.sr,
case.sc,
case.new_color,
),
);
}
} | rust_cleaned_test_functions.jsonl/126029 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 623
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
4556,
30728,
368,
341,
286,
1077,
1273,
41427,
284,
2278,
310,
30573,
341,
394,
2168,
25,
7486,
20703,
4083,
20703,
16,
11,
220,
16,
11,
220,
16,
1125,
7486,
20703,
16,
11,
220,
16,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
#[test]
fn test_finals_not_a_number() {
let model =
"1\n\
2 a 3";
match DFAReader::new_from_string(model) {
Err(DFAReaderError::Parse(_,line)) => assert!(line == 2),
_ => assert!(false, "Parse expected."),
}
} | rust_cleaned_test_functions.jsonl/47829 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 164
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20676,
82,
7913,
4306,
5500,
368,
341,
286,
1077,
1614,
4035,
310,
330,
16,
1699,
5661,
1797,
220,
17,
264,
220,
18,
876,
286,
2432,
93631,
5062,
486,
931,
5673,
3904,
7635,
8,
341,
310,
15495... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_is_singleton() {
for case in CASES.iter() {
assert_eq!(
matches!(case.typ, CombinatorType::Singleton),
case.combinator.is_singleton()
);
}
} | rust_cleaned_test_functions.jsonl/536 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
82119,
368,
341,
286,
369,
1142,
304,
38319,
50,
19471,
368,
341,
310,
2060,
10714,
33673,
394,
9071,
10297,
5638,
49286,
11,
1198,
6863,
850,
929,
486,
25915,
1326,
394,
1142,
905,
6863,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_color_from_str_rgb() {
assert_eq!(
Color::try_from("#000000").unwrap(),
Color::from((0.0, 0.0, 0.0, 1.0))
);
assert_eq!(
Color::try_from("#FF00FF").unwrap(),
Color::from((1.0, 0.0, 1.0, 1.0))
);
} | rust_cleaned_test_functions.jsonl/57745 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 187
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6714,
5673,
2895,
37407,
368,
341,
286,
2060,
10714,
33673,
310,
3478,
486,
1539,
5673,
3584,
15,
15,
15,
15,
15,
15,
1827,
15454,
3148,
310,
3478,
486,
1499,
1188,
15,
13,
15,
11,
220,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_option_int() {
fn test_v(v: Option<int>) {
debug!("v == {}", v);
let mut wr = SeekableMemWriter::new();
{
let mut rbml_w = writer::Encoder::new(&mut wr);
let _ = v.encode(&mut rbml_w);
}
let rbml_doc = Doc::new(wr.get_ref());
let mut deser = reader::Decoder::new(rbml_doc);
let v1 = Decodable::decode(&mut deser).unwrap();
debug!("v1 == {}", v1);
assert_eq!(v, v1);
}
test_v(Some(22));
test_v(None);
test_v(Some(3));
} | rust_cleaned_test_functions.jsonl/5042 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 367
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9672,
4042,
368,
341,
286,
5168,
1273,
2273,
3747,
25,
6959,
4159,
9231,
341,
310,
7390,
17223,
85,
621,
24689,
348,
317,
310,
1077,
5206,
3112,
284,
29739,
480,
18816,
6492,
486,
931,
543,
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_confirm() -> anyhow::Result<()> {
let tests = &[
(true, "", false, true),
(false, "y", false, true),
(false, "Y", false, true),
(false, "yes", false, true),
(false, "Yes", false, true),
(false, "n", true, false),
(false, "N", true, false),
(false, "no", true, false),
(false, "No", true, false),
(false, "hoge", true, true),
(false, "hoge", false, false),
(false, "", true, true),
(false, "", false, false),
];
for (assume_yes, input, default, expected) in tests {
let conf = ConsoleConfig {
assume_yes: *assume_yes,
};
let mut cnsl = Console::buf(conf);
cnsl.write_input(input);
let actual = cnsl.confirm("message", *default).unwrap();
assert_eq!(actual, *expected);
}
Ok(())
} | rust_cleaned_test_functions.jsonl/110898 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 537
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23800,
368,
1464,
88964,
486,
2077,
71698,
341,
286,
1077,
7032,
284,
609,
9640,
310,
320,
1866,
11,
7342,
895,
11,
830,
1326,
310,
320,
3849,
11,
330,
88,
497,
895,
11,
830,
1326,
310,
320,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_into_iter() {
// Empty iter
{
let d: VecDeque<i32> = VecDeque::new();
let mut iter = d.into_iter();
assert_eq!(iter.size_hint(), (0, Some(0)));
assert_eq!(iter.next(), None);
assert_eq!(iter.size_hint(), (0, Some(0)));
}
// simple iter
{
let mut d = VecDeque::new();
for i in 0..5 {
d.push_back(i);
}
let b = vec![0, 1, 2, 3, 4];
assert_eq!(d.into_iter().collect::<Vec<_>>(), b);
}
// wrapped iter
{
let mut d = VecDeque::new();
for i in 0..5 {
d.push_back(i);
}
for i in 6..9 {
d.push_front(i);
}
let b = vec![8, 7, 6, 0, 1, 2, 3, 4];
assert_eq!(d.into_iter().collect::<Vec<_>>(), b);
}
// partially used
{
let mut d = VecDeque::new();
for i in 0..5 {
d.push_back(i);
}
for i in 6..9 {
d.push_front(i);
}
let mut it = d.into_iter();
assert_eq!(it.size_hint(), (8, Some(8)));
assert_eq!(it.next(), Some(8));
assert_eq!(it.size_hint(), (7, Some(7)));
assert_eq!(it.next_back(), Some(4));
assert_eq!(it.size_hint(), (6, Some(6)));
assert_eq!(it.next(), Some(7));
assert_eq!(it.size_hint(), (5, Some(5)));
}
} | rust_cleaned_test_functions.jsonl/73707 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 790
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45514,
11723,
368,
341,
262,
442,
22228,
5367,
198,
262,
341,
286,
1077,
294,
25,
11312,
73891,
21897,
18,
17,
29,
284,
11312,
73891,
486,
931,
543,
286,
1077,
5206,
5367,
284,
294,
39860,
11723... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_emit_simple() {
let s = "
# comment
a0 bb: val
a1:
b1: 4
b2: d
a2: 4 # i'm comment
a3: [1, 2, 3]
a4:
- [a1, a2]
- 2
";
let docs = YamlLoader::load_from_str(&s).unwrap();
let doc = &docs[0];
let mut writer = String::new();
{
let mut emitter = YamlEmitter::new(&mut writer);
emitter.dump(doc).unwrap();
}
println!("original:\n{}", s);
println!("emitted:\n{}", writer);
let docs_new = match YamlLoader::load_from_str(&writer) {
Ok(y) => y,
Err(e) => panic!(format!("{}", e))
};
let doc_new = &docs_new[0];
assert_eq!(doc, doc_new);
} | rust_cleaned_test_functions.jsonl/44444 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 398
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
69082,
30015,
368,
341,
286,
1077,
274,
284,
6228,
2,
3980,
198,
64,
15,
16520,
25,
1044,
198,
64,
16,
510,
262,
293,
16,
25,
220,
19,
198,
262,
293,
17,
25,
294,
198,
64,
17,
25,
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... | 2 |
#[test]
fn test_empty_selector() {
let sel = Sel::register("");
assert_eq!(sel.name(), "");
let sel = Sel::register(":");
assert_eq!(sel.name(), ":");
} | rust_cleaned_test_functions.jsonl/7120 | {
"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,
15124,
28890,
368,
341,
286,
1077,
11806,
284,
23204,
486,
6343,
13056,
286,
2060,
10714,
10297,
9507,
2644,
1507,
14498,
286,
1077,
11806,
284,
23204,
486,
6343,
18893,
797,
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 |
#[test]
fn test_to_base64_lf_line_break() {
assert!(![08; 1000].to_base64(Config {line_length: None,
newline: Newline::LF,
..STANDARD})
.contains("\n"));
assert_eq!(b"foobar".to_base64(Config {line_length: Some(4),
newline: Newline::LF,
..STANDARD}),
"Zm9v\nYmFy");
} | rust_cleaned_test_functions.jsonl/5187 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 384
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
7651,
21,
19,
907,
69,
6528,
39494,
368,
341,
286,
2060,
0,
3471,
58,
15,
23,
26,
220,
16,
15,
15,
15,
936,
983,
7651,
21,
19,
33687,
314,
1056,
5118,
25,
2240,
345,
18749,
39027,
25... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_proc_args_arguments() {
let proc = ProcArgs(Vec::from(EXAMPLE));
let mut args = proc.arguments();
assert_eq!(Some(&b"./process_current"[..]), args.next());
assert_eq!(Some(&b"-a"[..]), args.next());
assert_eq!(Some(&b"-b"[..]), args.next());
assert_eq!(Some(&b"--co=2"[..]), args.next());
assert_eq!(None, args.next());
} | rust_cleaned_test_functions.jsonl/76700 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 192
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24436,
8384,
43433,
368,
341,
286,
1077,
13674,
284,
41087,
4117,
49923,
486,
1499,
25409,
18918,
1106,
286,
1077,
5206,
2827,
284,
13674,
52415,
1428,
286,
2060,
10714,
10297,
8373,
2099,
65,
95092... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_update_add_htlc_bolt2_receiver_check_repeated_id_ignore() {
//BOLT 2 requirement: if the sender did not previously acknowledge the commitment of that HTLC: MUST ignore a repeated id value after a reconnection.
// We test this by first testing that that repeated HTLCs pass commitment signature checks
// after disconnect and that non-sequential htlc_ids result in a channel failure.
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 logger = test_utils::TestLogger::new();
create_announced_chan_between_nodes(&nodes, 0, 1, InitFeatures::known(), InitFeatures::known());
let (_, our_payment_hash, our_payment_secret) = get_payment_preimage_hash!(nodes[1]);
let net_graph_msg_handler = &nodes[0].net_graph_msg_handler;
let route = get_route(&nodes[0].node.get_our_node_id(), &net_graph_msg_handler.network_graph, &nodes[1].node.get_our_node_id(), Some(InvoiceFeatures::known()), None, &[], 1000000, TEST_FINAL_CLTV, &logger).unwrap();
nodes[0].node.send_payment(&route, our_payment_hash, &Some(our_payment_secret)).unwrap();
check_added_monitors!(nodes[0], 1);
let updates = get_htlc_update_msgs!(nodes[0], nodes[1].node.get_our_node_id());
nodes[1].node.handle_update_add_htlc(&nodes[0].node.get_our_node_id(), &updates.update_add_htlcs[0]);
//Disconnect and Reconnect
nodes[0].node.peer_disconnected(&nodes[1].node.get_our_node_id(), false);
nodes[1].node.peer_disconnected(&nodes[0].node.get_our_node_id(), false);
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]);
assert_eq!(reestablish_1.len(), 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]);
assert_eq!(reestablish_2.len(), 1);
nodes[0].node.handle_channel_reestablish(&nodes[1].node.get_our_node_id(), &reestablish_2[0]);
handle_chan_reestablish_msgs!(nodes[0], nodes[1]);
nodes[1].node.handle_channel_reestablish(&nodes[0].node.get_our_node_id(), &reestablish_1[0]);
handle_chan_reestablish_msgs!(nodes[1], nodes[0]);
//Resend HTLC
nodes[1].node.handle_update_add_htlc(&nodes[0].node.get_our_node_id(), &updates.update_add_htlcs[0]);
assert_eq!(updates.commitment_signed.htlc_signatures.len(), 1);
nodes[1].node.handle_commitment_signed(&nodes[0].node.get_our_node_id(), &updates.commitment_signed);
check_added_monitors!(nodes[1], 1);
let _bs_responses = get_revoke_commit_msgs!(nodes[1], nodes[0].node.get_our_node_id());
nodes[1].node.handle_update_add_htlc(&nodes[0].node.get_our_node_id(), &updates.update_add_htlcs[0]);
assert!(nodes[1].node.list_channels().is_empty());
let err_msg = check_closed_broadcast!(nodes[1], true).unwrap();
assert!(regex::Regex::new(r"Remote skipped HTLC ID \(skipped ID: \d+\)").unwrap().is_match(err_msg.data.as_str()));
check_added_monitors!(nodes[1], 1);
check_closed_event!(nodes[1], 1, ClosureReason::ProcessingError { err: err_msg.data });
} | rust_cleaned_test_functions.jsonl/16930 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1268
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
2891,
49086,
17257,
880,
6181,
17,
65691,
7200,
1288,
41954,
842,
58493,
368,
341,
197,
322,
33,
35320,
220,
17,
16287,
25,
421,
279,
4646,
1521,
537,
8597,
24645,
279,
15155,
315,
429,
52... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_statistics_from_thrift() {
// Helper method to check statistics conversion.
fn check_stats(stats: Statistics) {
let tpe = stats.physical_type();
let thrift_stats = to_thrift(Some(&stats));
assert_eq!(from_thrift(tpe, thrift_stats), Some(stats));
}
check_stats(Statistics::boolean(Some(false), Some(true), None, 7, true));
check_stats(Statistics::boolean(Some(false), Some(true), None, 7, true));
check_stats(Statistics::boolean(Some(false), Some(true), None, 0, false));
check_stats(Statistics::boolean(Some(true), Some(true), None, 7, true));
check_stats(Statistics::boolean(Some(false), Some(false), None, 7, true));
check_stats(Statistics::boolean(None, None, None, 7, true));
check_stats(Statistics::int32(Some(-100), Some(500), None, 7, true));
check_stats(Statistics::int32(Some(-100), Some(500), None, 0, false));
check_stats(Statistics::int32(None, None, None, 7, true));
check_stats(Statistics::int64(Some(-100), Some(200), None, 7, true));
check_stats(Statistics::int64(Some(-100), Some(200), None, 0, false));
check_stats(Statistics::int64(None, None, None, 7, true));
check_stats(Statistics::float(Some(1.2), Some(3.4), None, 7, true));
check_stats(Statistics::float(Some(1.2), Some(3.4), None, 0, false));
check_stats(Statistics::float(None, None, None, 7, true));
check_stats(Statistics::double(Some(1.2), Some(3.4), None, 7, true));
check_stats(Statistics::double(Some(1.2), Some(3.4), None, 0, false));
check_stats(Statistics::double(None, None, None, 7, true));
check_stats(Statistics::byte_array(
Some(ByteArray::from(vec![1, 2, 3])),
Some(ByteArray::from(vec![3, 4, 5])),
None,
7,
true,
));
check_stats(Statistics::byte_array(None, None, None, 7, true));
check_stats(Statistics::fixed_len_byte_array(
Some(ByteArray::from(vec![1, 2, 3])),
Some(ByteArray::from(vec![3, 4, 5])),
None,
7,
true,
));
check_stats(Statistics::fixed_len_byte_array(None, None, None, 7, true));
} | rust_cleaned_test_functions.jsonl/15835 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1021
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49569,
5673,
5854,
41380,
368,
341,
286,
442,
12906,
1714,
311,
1779,
13142,
14409,
624,
286,
5168,
1779,
15381,
50714,
25,
24624,
8,
341,
310,
1077,
259,
375,
284,
10472,
2131,
18969,
1819,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eval_stack() {
// It's nice if an operation and its arguments can fit on a single
// line in the test program.
use self::AssemblerEntry::*;
use crate::constants::*;
#[rustfmt::skip]
let program = [
Op(DW_OP_lit17),
Op(DW_OP_dup),
Op(DW_OP_over),
Op(DW_OP_minus),
Op(DW_OP_swap),
Op(DW_OP_dup),
Op(DW_OP_plus_uconst), Uleb(1),
Op(DW_OP_rot),
Op(DW_OP_pick), U8(2),
Op(DW_OP_pick), U8(3),
Op(DW_OP_minus),
Op(DW_OP_drop),
Op(DW_OP_swap),
Op(DW_OP_drop),
Op(DW_OP_minus),
Op(DW_OP_stack_value),
];
let result = [Piece {
size_in_bits: None,
bit_offset: None,
location: Location::Value {
value: Value::Generic(1),
},
}];
check_eval(&program, Ok(&result), encoding4());
} | rust_cleaned_test_functions.jsonl/45767 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 842
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21296,
15528,
368,
341,
286,
442,
1084,
594,
6419,
421,
458,
5666,
323,
1181,
5977,
646,
4946,
389,
264,
3175,
198,
286,
442,
1555,
304,
279,
1273,
2025,
624,
286,
990,
656,
486,
77858,
5874,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_continuation_clear() {
let continuations = Continuations::new();
continuations.insert_remaining_packets(&PduId::GetElementAttributes, vec![vec![1 as u8]]);
continuations.clear_continuation(&PduId::GetElementAttributes);
assert!(continuations.pop_packet(&PduId::GetElementAttributes).is_none());
} | rust_cleaned_test_functions.jsonl/21853 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68948,
4002,
21811,
368,
341,
286,
1077,
16122,
804,
284,
20297,
37070,
486,
931,
543,
286,
16122,
804,
7030,
59244,
63569,
2099,
47,
1054,
764,
486,
1949,
1691,
10516,
11,
7486,
20703,
4083,
2070... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tls() {
env::set_var("REDISRS_SERVER_TYPE", "tcp+tls");
let mut context = TestContext::new();
let addr = context.server.get_client_addr();
let (host, port) = match addr {
ConnectionAddr::TcpTls { ref host, port, .. } => (host, port),
_ => panic!("wrong mode"),
};
println!("redis-server: {}:{}", host, port);
let conf = Config {
is_discard_rdb: true,
is_aof: false,
host: host.to_string(),
port: *port,
password: String::new(),
repl_id: String::from("?"),
repl_offset: -1,
read_timeout: None,
write_timeout: None,
is_tls_enabled: true,
is_tls_insecure: true,
identity: None,
username: "".to_string(),
identity_passwd: None,
};
let running = Arc::new(AtomicBool::new(true));
let mut builder = listener::Builder::new();
builder.with_config(conf);
builder.with_control_flag(running);
builder.with_event_handler(Rc::new(RefCell::new(NoOpEventHandler {})));
let mut redis_listener = builder.build();
println!("connect to redis-server");
if let Err(err) = redis_listener.start() {
println!("error: {}", err);
panic!(err);
}
println!("done");
context.stop_server();
} | rust_cleaned_test_functions.jsonl/93101 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 583
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71262,
368,
341,
262,
6105,
486,
746,
4612,
445,
94512,
11451,
20012,
4189,
497,
330,
27161,
10,
34488,
797,
262,
1077,
5206,
2266,
284,
3393,
1972,
486,
931,
543,
262,
1077,
10789,
284,
2266,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_compile_shift_left_hl() {
let compiled = bitwise::compile_shift_left("HL".to_string());
assert_eq!(compiled.len(), 1);
assert_eq!(compiled[0], 0b11011101);
} | rust_cleaned_test_functions.jsonl/100605 | {
"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,
74170,
22230,
9579,
1523,
75,
368,
341,
262,
1077,
19697,
284,
97970,
486,
20433,
22230,
9579,
445,
13485,
3263,
983,
3904,
5231,
262,
2060,
10714,
10297,
50845,
19406,
1507,
220,
16,
317,
262,
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 |
#[test]
fn test_get_schema_attrs_from_ledger(){
init!("ledger");
let (schema_id, _) = ::utils::libindy::anoncreds::tests::create_and_write_test_schema(::utils::constants::DEFAULT_SCHEMA_ATTRS);
let (_, schema_attrs ) = get_schema_attrs("id".to_string(), schema_id.clone()).unwrap();
assert!(schema_attrs.contains(&schema_id));
} | rust_cleaned_test_functions.jsonl/29692 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 172
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
25371,
39578,
5673,
38367,
1389,
3032,
286,
2930,
17223,
50704,
3071,
286,
1077,
320,
17349,
842,
11,
27439,
284,
3504,
6031,
486,
2740,
48990,
486,
58910,
85734,
486,
23841,
486,
3182,
8378,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_comment_update() {
let expected_sql = "UPDATE \"users\" SET \"foo\" = $1 /* trace_id='5bd66ef5095369c7b0d1f8f4bd33716a', parent_id='c532cb4098ac3dd2' */";
let query = Update::table("users")
.set("foo", 10)
.comment("trace_id='5bd66ef5095369c7b0d1f8f4bd33716a', parent_id='c532cb4098ac3dd2'");
let (sql, _) = Postgres::build(query).unwrap();
assert_eq!(expected_sql, sql);
} | rust_cleaned_test_functions.jsonl/6453 | {
"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,
17638,
8882,
368,
341,
286,
1077,
3601,
18063,
284,
330,
9239,
7245,
4218,
2105,
9019,
7245,
7975,
2105,
284,
400,
16,
1391,
11655,
842,
1131,
20,
8940,
21,
21,
823,
20,
15,
24,
20,
18,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ser_de() {
let b = ntex_bytes::Bytes::from(&b"bytes"[..]);
assert_tokens(&b, &[Token::Bytes(b"bytes")]);
let b = ntex_bytes::BytesMut::from(&b"bytes"[..]);
assert_tokens(&b, &[Token::Bytes(b"bytes")]);
} | rust_cleaned_test_functions.jsonl/108203 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75861,
2259,
368,
341,
262,
1077,
293,
284,
31412,
327,
12524,
486,
7078,
486,
1499,
2099,
65,
70591,
36864,
496,
2558,
262,
2060,
28838,
2099,
65,
11,
44590,
3323,
486,
7078,
1883,
70591,
899,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_calculate_val() {
assert_eq!(0.0, calculate_val(0.0, 0.0, 100.0, 32.0, 100.0));
assert_eq!(50.0, calculate_val(34.0, 0.0, 100.0, 32.0, 100.0));
assert_eq!(100.0, calculate_val(68.0, 0.0, 100.0, 32.0, 100.0));
assert_eq!(0.0, calculate_val(0.0, -50.0, 50.0, 32.0, 100.0));
assert_eq!(50.0, calculate_val(34.0, -50.0, 50.0, 32.0, 100.0));
assert_eq!(100.0, calculate_val(68.0, -50.0, 50.0, 32.0, 100.0));
} | rust_cleaned_test_functions.jsonl/80581 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 275
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24005,
11207,
6189,
368,
341,
286,
2060,
10714,
10297,
15,
13,
15,
11,
11047,
6189,
7,
15,
13,
15,
11,
220,
15,
13,
15,
11,
220,
16,
15,
15,
13,
15,
11,
220,
18,
17,
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... | 1 |
#[test]
fn test_is_only_or() {
for case in CASES.iter() {
assert_eq!(
matches!(case.typ, CombinatorType::OnlyOr),
case.combinator.is_only_or(),
"left value indicates whether {:?} should be only OR",
case.combinator
);
}
} | rust_cleaned_test_functions.jsonl/537 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 191
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
18410,
8734,
368,
341,
286,
369,
1142,
304,
38319,
50,
19471,
368,
341,
310,
2060,
10714,
33673,
394,
9071,
10297,
5638,
49286,
11,
1198,
6863,
850,
929,
486,
7308,
2195,
1326,
394,
1142,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_treemath_functions() {
assert_eq!(0, treemath::root(LeafIndex::from(0u32)).as_u32());
// same time.
assert_eq!(0, treemath::root(LeafIndex::from(1u32)).as_u32());
assert_eq!(1, treemath::root(LeafIndex::from(2u32)).as_u32());
assert_eq!(3, treemath::root(LeafIndex::from(3u32)).as_u32());
} | rust_cleaned_test_functions.jsonl/54495 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 165
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
265,
336,
587,
31708,
368,
341,
262,
2060,
10714,
10297,
15,
11,
4258,
336,
587,
486,
2888,
7,
31461,
1552,
486,
1499,
7,
15,
84,
18,
17,
4579,
300,
7300,
18,
17,
1423,
1066,
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_exists() {
let path = Path::new("test.txt");
let mut mock = MockFileBackend::new();
mock.expect_exists()
.with(eq(path))
.times(1)
.returning(|x| Ok(false));
let fs = FileSystem {
inner: Rc::new(mock),
};
let _ = fs.exists(path);
} | rust_cleaned_test_functions.jsonl/100442 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 199
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9766,
368,
341,
286,
1077,
1815,
284,
7933,
486,
931,
445,
1944,
3909,
797,
286,
1077,
5206,
7860,
284,
14563,
1703,
29699,
486,
931,
543,
286,
7860,
25952,
9766,
741,
310,
659,
4197,
69909,
558... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_arithmetic() {
let luv = Luv::<D65>::new(120.0, 40.0, 30.0);
let luv2 = Luv::new(200.0, 30.0, 40.0);
let mut _luv3 = luv + luv2;
_luv3 += luv2;
let mut _luv4 = luv2 + 0.3;
_luv4 += 0.1;
_luv3 = luv2 - luv;
_luv3 = _luv4 - 0.1;
_luv4 -= _luv3;
_luv3 -= 0.1;
} | rust_cleaned_test_functions.jsonl/132065 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 243
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25842,
25922,
368,
341,
286,
1077,
326,
12058,
284,
444,
12058,
27638,
35,
21,
20,
6831,
931,
7,
16,
17,
15,
13,
15,
11,
220,
19,
15,
13,
15,
11,
220,
18,
15,
13,
15,
317,
286,
1077,
326... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_paginated_records_delete() {
let mut collection = setup_collection();
collection.create().unwrap();
for _ in 0..10 {
collection.new_record().create().unwrap();
}
let resource = Record::new(collection.clone());
resource
.delete_all_request()
.unwrap()
.limit(5)
.follow_subrequests()
.unwrap();
let records = collection.list_records().unwrap();
assert_eq!(records.len(), 0);
} | rust_cleaned_test_functions.jsonl/63507 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 263
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51003,
15479,
31279,
11353,
368,
341,
286,
1077,
5206,
4426,
284,
6505,
25019,
543,
286,
4426,
2520,
1005,
15454,
543,
286,
369,
716,
304,
220,
15,
496,
16,
15,
341,
310,
4426,
4618,
14192,
1005... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_add_should_add_default_rule() {
let mut lsys: LSystem = LSystem::new("A".to_string());
lsys.add('B');
assert_eq!(*lsys.get('B'), "B");
} | rust_cleaned_test_functions.jsonl/101643 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
43378,
2891,
9993,
21124,
368,
341,
286,
1077,
5206,
326,
7791,
25,
444,
2320,
284,
444,
2320,
486,
931,
445,
32,
3263,
983,
3904,
1423,
286,
326,
7791,
1364,
492,
33,
1157,
286,
2060,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_receive_timestamp() {
crate::testutil::set_logger_for_test();
let req = Icmpv4TimestampRequest::new(1, 2, 3);
let mut buffer = Buf::new(Vec::new(), ..)
.encapsulate(IcmpPacketBuilder::<Ipv4, &[u8], _>::new(
DUMMY_CONFIG_V4.remote_ip,
DUMMY_CONFIG_V4.local_ip,
IcmpUnusedCode,
req,
))
.serialize_vec_outer()
.unwrap();
test_receive_ip_packet::<Ipv4, _, _, _, _>(
|builder| {
builder.ipv4_builder().icmpv4_builder().send_timestamp_reply(true);
},
buffer.as_mut(),
DUMMY_CONFIG_V4.local_ip,
64,
Ipv4Proto::Icmp,
&["<IcmpIpTransportContext as BufferIpTransportContext<Ipv4>>::receive_ip_packet::timestamp_request", "send_ipv4_packet"],
Some((req.reply(0x80000000, 0x80000000), IcmpUnusedCode)),
|_| {},
);
} | rust_cleaned_test_functions.jsonl/65667 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 587
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38557,
23073,
368,
341,
286,
17717,
486,
1944,
1314,
486,
746,
27413,
5478,
4452,
1428,
286,
1077,
4232,
284,
358,
7293,
85,
19,
20812,
1900,
486,
931,
7,
16,
11,
220,
17,
11,
220,
18,
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_streams_cancel_cleans_up_unacked_header_blocks() {
let mut encoder = connect(false);
encoder.encoder.set_max_blocked_streams(10).unwrap();
assert!(encoder.change_capacity(60).is_ok());
encoder.send_instructions(CAP_INSTRUCTION_60);
// insert "content-length: 1234
encoder.insert(
HEADER_CONTENT_LENGTH,
VALUE_1,
HEADER_CONTENT_LENGTH_VALUE_1_NAME_LITERAL,
);
// send a header block
encoder.encode_header_block(
1,
&[(String::from("content-length"), String::from("1234"))],
ENCODE_INDEXED_REF_DYNAMIC,
&[],
);
// receive a stream canceled instruction.
recv_instruction(&mut encoder, STREAM_CANCELED_ID_1);
recv_instruction(&mut encoder, &[0x01]);
} | rust_cleaned_test_functions.jsonl/57104 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 437
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74872,
28895,
666,
21708,
8237,
4907,
11191,
8757,
25201,
368,
341,
286,
1077,
5206,
23668,
284,
4564,
3576,
626,
286,
23668,
69042,
980,
6345,
89223,
74872,
7,
16,
15,
568,
15454,
543,
286,
2060,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cli_keypair_file() {
solana_logger::setup();
let default_keypair = Keypair::new();
let program_pubkey = Keypair::new();
let deploy_path = make_tmp_path("deploy");
let mut program_location = PathBuf::from(deploy_path.clone());
program_location.push("noop");
program_location.set_extension("so");
let mut pathbuf = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
pathbuf.push("tests");
pathbuf.push("fixtures");
pathbuf.push("noop");
pathbuf.set_extension("so");
let program_keypair_location = program_location.with_file_name("noop-keypair.json");
std::fs::create_dir_all(deploy_path).unwrap();
std::fs::copy(pathbuf, program_location.as_os_str()).unwrap();
write_keypair_file(&program_pubkey, &program_keypair_location).unwrap();
let config = CliConfig {
rpc_client: Some(Arc::new(RpcClient::new_mock("".to_string()))),
command: CliCommand::Program(ProgramCliCommand::Deploy {
program_location: Some(program_location.to_str().unwrap().to_string()),
buffer_signer_index: None,
buffer_pubkey: None,
program_signer_index: None,
program_pubkey: None,
upgrade_authority_signer_index: 0,
is_final: false,
max_len: None,
allow_excessive_balance: false,
}),
signers: vec![&default_keypair],
output_format: OutputFormat::JsonCompact,
..CliConfig::default()
};
let result = process_command(&config);
let json: Value = serde_json::from_str(&result.unwrap()).unwrap();
let program_id = json
.as_object()
.unwrap()
.get("programId")
.unwrap()
.as_str()
.unwrap();
assert_eq!(
program_id.parse::<Pubkey>().unwrap(),
program_pubkey.pubkey()
);
} | rust_cleaned_test_functions.jsonl/22249 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1017
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47147,
3097,
12670,
2458,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
1428,
286,
1077,
1638,
3097,
12670,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
2025,
34014,
792,
284,
6569,
1082,
1310... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hook9() {
test("true ? a() : (function f() {})()", "a()");
test(
"false ? a() : (function f() {alert(x)})()",
"(function f() {alert(x)})()",
);
} | rust_cleaned_test_functions.jsonl/438 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32005,
24,
368,
341,
262,
1273,
445,
1866,
937,
264,
368,
549,
320,
1688,
282,
368,
37713,
50514,
330,
64,
45961,
262,
1273,
1006,
286,
330,
3849,
937,
264,
368,
549,
320,
1688,
282,
368,
314,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_parse_elements() {
let input = r#"alert tcp $EXTERNAL_NET any -> $HOME_NET 445 (
msg:"ET DOS NetrWkstaUserEnum Request with large Preferred Max Len";
flow:established,to_server; content:"|ff|SMB"; content:"|10 00 00 00|";
distance:0; content:"|02 00|";
distance:14;
within:2;
byte_jump:4,12,relative,little,multiplier 2;
content:"|00 00 00 00 00 00 00 00|";
distance:12;
within:8;
byte_test:4,>,2,0,relative;
reference:cve,2006-6723;
reference:url,doc.emergingthreats.net/bin/view/Main/2003236;
classtype:attempted-dos;
sid:2003236;
rev:4;
metadata:created_at 2010_07_30, updated_at 2010_07_30;)"#;
let (rem, _elements) = parse_elements(input).unwrap();
assert_eq!(rem, "");
} | rust_cleaned_test_functions.jsonl/22888 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 479
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
22801,
368,
341,
286,
1077,
1946,
284,
435,
55543,
5083,
28051,
400,
95276,
26855,
894,
1464,
400,
27546,
26855,
220,
19,
19,
20,
2399,
310,
3750,
2974,
1348,
58480,
9374,
81,
54,
74,
204... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_as_typed_data() {
check_as_typed_data!(&[1i8, 3i8, 6i8], i8);
check_as_typed_data!(&[1u8, 3u8, 6u8], u8);
check_as_typed_data!(&[1i16, 3i16, 6i16], i16);
check_as_typed_data!(&[1i32, 3i32, 6i32], i32);
check_as_typed_data!(&[1i64, 3i64, 6i64], i64);
check_as_typed_data!(&[1u16, 3u16, 6u16], u16);
check_as_typed_data!(&[1u32, 3u32, 6u32], u32);
check_as_typed_data!(&[1u64, 3u64, 6u64], u64);
check_as_typed_data!(&[1f32, 3f32, 6f32], f32);
check_as_typed_data!(&[1f64, 3f64, 6f64], f64);
} | rust_cleaned_test_functions.jsonl/25076 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 367
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
528,
32501,
1769,
368,
341,
286,
1779,
11898,
528,
32501,
1769,
0,
2099,
58,
16,
72,
23,
11,
220,
18,
72,
23,
11,
220,
21,
72,
23,
1125,
600,
23,
317,
286,
1779,
11898,
528,
32501,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fail_for_same_gas_amount_and_not_same_expiration_time() {
let (mut mempool, _) = setup_mempool();
let _ = add_txns_to_mempool(&mut mempool, vec![TestTransaction::new(0, 0, 0)]);
let txn = TestTransaction::new(0, 0, 0)
.make_signed_transaction_with_expiration_time(u64::max_value() - 1000);
let ret = add_signed_txn(&mut mempool, txn);
assert!(ret.is_err())
} | rust_cleaned_test_functions.jsonl/80933 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 178
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22121,
5478,
33574,
82116,
13471,
8378,
7913,
33574,
2702,
28479,
3009,
368,
341,
262,
1077,
320,
6984,
1833,
10285,
11,
27439,
284,
6505,
717,
3262,
1749,
543,
262,
1077,
716,
284,
912,
17805,
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_tee_treat_minus_as_filename() {
let (at, mut ucmd) = at_and_ucmd!();
let content = "tee_sample_content";
let file = "-";
ucmd.arg("-").pipe_in(content).succeeds().stdout_is(content);
assert!(at.file_exists(file));
assert_eq!(at.read(file), content);
} | rust_cleaned_test_functions.jsonl/40785 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
2127,
528,
1222,
38457,
11898,
13323,
368,
341,
14808,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
1077,
2213,
284,
330,
6547,
17491,
7495,
876,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_log_file_not_existed() {
let tempdir = tempfile::tempdir().unwrap();
let ret = LogFile::open(tempdir.path(), "test_log_file", 2, false);
match ret {
Err(Error::Io(_)) => {}
_ => unreachable!(),
}
} | rust_cleaned_test_functions.jsonl/35559 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5224,
2458,
7913,
2702,
13236,
368,
341,
286,
1077,
2730,
3741,
284,
54819,
486,
3888,
3741,
1005,
15454,
543,
286,
1077,
2112,
284,
2835,
1703,
486,
2508,
9758,
3741,
3875,
1507,
330,
1944,
5224,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_proc_exe() {
let myself = Process::myself().unwrap();
let proc_exe = myself.exe().unwrap();
let std_exe = std::env::current_exe().unwrap();
assert_eq!(proc_exe, std_exe);
} | rust_cleaned_test_functions.jsonl/17541 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 89
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24436,
76074,
368,
341,
262,
1077,
7037,
284,
8603,
486,
2408,
721,
1005,
15454,
543,
262,
1077,
13674,
76074,
284,
7037,
19399,
1005,
15454,
543,
262,
1077,
1460,
76074,
284,
1460,
486,
3160,
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 |
#[test]
fn test_min_max() {
test_case(1.0, 1.0, 0.0, |x| x.min());
test_case(1.0, 1.0, f64::INFINITY, |x| x.max());
} | rust_cleaned_test_functions.jsonl/84310 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 89
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7260,
6345,
368,
341,
286,
1273,
19096,
7,
16,
13,
15,
11,
220,
16,
13,
15,
11,
220,
15,
13,
15,
11,
760,
87,
91,
856,
4358,
1423,
286,
1273,
19096,
7,
16,
13,
15,
11,
220,
16,
13,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_i_do_not_mess_up_bitwise_ops() {
fn test_pair(color32: u32, color16: u16) {
assert_eq!(rgba2rgb565(color32), color16);
assert_eq!(rgb5652rgba(color16), color32 & 0xF8FCF800 | 0xFF);
}
test_pair(0xFFFFFF00, 0xFFFF);
test_pair(0xFF000000, 0xF800);
test_pair(0x00FF0000, 0x07E0);
test_pair(0x0000FF00, 0x001F);
} | rust_cleaned_test_functions.jsonl/63909 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 227
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5318,
26309,
7913,
717,
433,
8237,
13996,
4482,
21959,
368,
341,
262,
5168,
1273,
14445,
13441,
18,
17,
25,
575,
18,
17,
11,
1894,
16,
21,
25,
575,
16,
21,
8,
341,
286,
2060,
10714,
10297,
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_entropy_length() {
// entropy size in bytes.
for size in (16..32).step_by(4) {
let entropy = vec![0; size];
let mnemonic = Mnemonic::mnemonic(&entropy);
assert!(mnemonic.is_ok());
}
let some_invalid_entropy_sizes: [usize; 4] = [0, 8, 18, 36];
for size in some_invalid_entropy_sizes.iter() {
let entropy = vec![0; *size];
let mnemonic = Mnemonic::mnemonic(&entropy);
assert!(mnemonic.is_err());
}
} | rust_cleaned_test_functions.jsonl/21413 | {
"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,
50374,
5118,
368,
341,
262,
442,
47502,
1379,
304,
5820,
624,
262,
369,
1379,
304,
320,
16,
21,
496,
18,
17,
568,
9520,
3710,
7,
19,
8,
341,
286,
1077,
47502,
284,
7486,
20703,
15,
26,
1379,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_merge_normal_conflict() {
let (r1_dir, _repo) = repo_init_bare().unwrap();
let (clone1_dir, clone1) =
repo_clone(r1_dir.path().to_str().unwrap()).unwrap();
let (clone2_dir, clone2) =
repo_clone(r1_dir.path().to_str().unwrap()).unwrap();
// clone1
write_commit_file(&clone1, "test.bin", "test", "commit1");
debug_cmd_print(
clone2_dir.path().to_str().unwrap(),
"git status",
);
push(
clone1_dir.path().to_str().unwrap(),
"origin",
"master",
false,
None,
None,
)
.unwrap();
// clone2
write_commit_file(&clone2, "test.bin", "foobar", "commit2");
let bytes = fetch(
clone2_dir.path().to_str().unwrap(),
"master",
None,
None,
)
.unwrap();
assert!(bytes > 0);
let res = merge_upstream_commit(
clone2_dir.path().to_str().unwrap(),
"master",
);
//this should have failed cause it would create a conflict
assert!(res.is_err());
let state = crate::sync::repo_state(
clone2_dir.path().to_str().unwrap(),
)
.unwrap();
//make sure we left the repo not in some merging state
assert_eq!(state, RepoState::Clean);
//check that we still only have the first commit
let commits = get_commit_ids(&clone1, 10);
assert_eq!(commits.len(), 1);
} | rust_cleaned_test_functions.jsonl/127217 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 828
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20888,
13973,
16059,
21242,
368,
341,
286,
1077,
320,
81,
16,
4334,
11,
716,
23476,
8,
284,
15867,
6137,
880,
546,
1005,
15454,
1428,
286,
1077,
320,
19982,
16,
4334,
11,
14715,
16,
8,
4035,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_const()
{
test_parse("const x=1;");
test_parse("const x@(summary)=1;");
test_parse("const x=1@{-description-};");
test_parse("const x@(summary)=1@{-description-};");
} | rust_cleaned_test_functions.jsonl/91399 | {
"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,
13610,
741,
515,
18185,
21039,
445,
1024,
856,
28,
16,
34649,
18185,
21039,
445,
1024,
856,
59404,
1708,
11730,
16,
34649,
18185,
21039,
445,
1024,
856,
28,
16,
31,
19999,
4684,
12,
11061,
797,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_once_mutex_states() {
let mutex = OnceMutex::new("hello");
assert_eq!(mutex.state.load(SeqCst), UNUSED);
let lock = mutex.lock();
assert_eq!(mutex.state.load(SeqCst), LOCKED);
drop(lock);
assert_eq!(mutex.state.load(SeqCst), FREE);
} | rust_cleaned_test_functions.jsonl/121058 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 160
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7630,
14204,
22972,
368,
341,
286,
1077,
30863,
284,
9646,
38099,
486,
931,
445,
14990,
797,
286,
2060,
10714,
10297,
22366,
3467,
5104,
88903,
34,
267,
701,
68001,
626,
286,
1077,
5296,
284,
3086... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_f64() {
assert_eq!(F64(3.0).to_string(), "3.0");
assert_eq!(F64(3.0).to_pretty_str(), "3.0");
assert_eq!(F64(3.1).to_string(), "3.1");
assert_eq!(F64(3.1).to_pretty_str(), "3.1");
assert_eq!(F64(-1.5).to_string(), "-1.5");
assert_eq!(F64(-1.5).to_pretty_str(), "-1.5");
assert_eq!(F64(0.5).to_string(), "0.5");
assert_eq!(F64(0.5).to_pretty_str(), "0.5");
assert_eq!(F64(f64::NAN).to_string(), "null");
assert_eq!(F64(f64::NAN).to_pretty_str(), "null");
assert_eq!(F64(f64::INFINITY).to_string(), "null");
assert_eq!(F64(f64::INFINITY).to_pretty_str(), "null");
assert_eq!(F64(f64::NEG_INFINITY).to_string(), "null");
assert_eq!(F64(f64::NEG_INFINITY).to_pretty_str(), "null");
} | rust_cleaned_test_functions.jsonl/6532 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 455
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
761,
21,
19,
368,
341,
286,
2060,
10714,
10297,
37,
21,
19,
7,
18,
13,
15,
568,
983,
3904,
1507,
330,
18,
13,
15,
797,
286,
2060,
10714,
10297,
37,
21,
19,
7,
18,
13,
15,
568,
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_panic_inside() {
use std::panic::{catch_unwind, AssertUnwindSafe};
let mut x = 10;
{
let mut wrapper = AssertUnwindSafe(&mut x);
if let Err(panic) = catch_unwind(move || {
let mut g = Gn::<()>::new(|| {
**wrapper = 5;
panic!("panic inside!");
});
g.resume();
}) {
match panic.downcast_ref::<&str>() {
// why can't get the message here?? is it lost?
Some(msg) => println!("get panic: {:?}", msg),
None => println!("can't get panic message"),
}
}
// wrapper dropped here
}
assert!(x == 5);
} | rust_cleaned_test_functions.jsonl/91421 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 376
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
31270,
72860,
368,
341,
262,
990,
1460,
486,
19079,
22964,
7173,
4907,
19154,
11,
5319,
1806,
19154,
25663,
2440,
262,
1077,
5206,
856,
284,
220,
16,
15,
280,
262,
341,
286,
1077,
5206,
132... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_credit_debit_rent_no_side_effect_on_hash() {
solana_logger::setup();
let (mut genesis_config, _mint_keypair) = create_genesis_config(10);
let keypair1: Keypair = Keypair::new();
let keypair2: Keypair = Keypair::new();
let keypair3: Keypair = Keypair::new();
let keypair4: Keypair = Keypair::new();
// Transaction between these two keypairs will fail
let keypair5: Keypair = Keypair::new();
let keypair6: Keypair = Keypair::new();
genesis_config.rent = Rent {
lamports_per_byte_year: 1,
exemption_threshold: 21.0,
burn_percent: 10,
};
let root_bank = Arc::new(Bank::new(&genesis_config));
let bank = Bank::new_from_parent(
&root_bank,
&Pubkey::default(),
years_as_slots(
2.0,
&genesis_config.poh_config.target_tick_duration,
genesis_config.ticks_per_slot,
) as u64,
);
let root_bank_2 = Arc::new(Bank::new(&genesis_config));
let bank_with_success_txs = Bank::new_from_parent(
&root_bank_2,
&Pubkey::default(),
years_as_slots(
2.0,
&genesis_config.poh_config.target_tick_duration,
genesis_config.ticks_per_slot,
) as u64,
);
assert_eq!(bank.last_blockhash(), genesis_config.hash());
// Initialize credit-debit and credit only accounts
let account1 = AccountSharedData::new(264, 0, &Pubkey::default());
let account2 = AccountSharedData::new(264, 1, &Pubkey::default());
let account3 = AccountSharedData::new(264, 0, &Pubkey::default());
let account4 = AccountSharedData::new(264, 1, &Pubkey::default());
let account5 = AccountSharedData::new(10, 0, &Pubkey::default());
let account6 = AccountSharedData::new(10, 1, &Pubkey::default());
bank.store_account(&keypair1.pubkey(), &account1);
bank.store_account(&keypair2.pubkey(), &account2);
bank.store_account(&keypair3.pubkey(), &account3);
bank.store_account(&keypair4.pubkey(), &account4);
bank.store_account(&keypair5.pubkey(), &account5);
bank.store_account(&keypair6.pubkey(), &account6);
bank_with_success_txs.store_account(&keypair1.pubkey(), &account1);
bank_with_success_txs.store_account(&keypair2.pubkey(), &account2);
bank_with_success_txs.store_account(&keypair3.pubkey(), &account3);
bank_with_success_txs.store_account(&keypair4.pubkey(), &account4);
bank_with_success_txs.store_account(&keypair5.pubkey(), &account5);
bank_with_success_txs.store_account(&keypair6.pubkey(), &account6);
// Make native instruction loader rent exempt
let system_program_id = system_program::id();
let mut system_program_account = bank.get_account(&system_program_id).unwrap();
system_program_account.set_lamports(
bank.get_minimum_balance_for_rent_exemption(system_program_account.data().len()),
);
bank.store_account(&system_program_id, &system_program_account);
bank_with_success_txs.store_account(&system_program_id, &system_program_account);
let t1 =
system_transaction::transfer(&keypair1, &keypair2.pubkey(), 1, genesis_config.hash());
let t2 =
system_transaction::transfer(&keypair3, &keypair4.pubkey(), 1, genesis_config.hash());
let t3 =
system_transaction::transfer(&keypair5, &keypair6.pubkey(), 1, genesis_config.hash());
let txs = vec![t1.clone(), t2.clone(), t3];
let res = bank.process_transactions(txs.iter());
assert_eq!(res.len(), 3);
assert_eq!(res[0], Ok(()));
assert_eq!(res[1], Ok(()));
assert_eq!(res[2], Err(TransactionError::AccountNotFound));
bank.freeze();
let rwlockguard_bank_hash = bank.hash.read().unwrap();
let bank_hash = rwlockguard_bank_hash.as_ref();
let txs = vec![t2, t1];
let res = bank_with_success_txs.process_transactions(txs.iter());
assert_eq!(res.len(), 2);
assert_eq!(res[0], Ok(()));
assert_eq!(res[1], Ok(()));
bank_with_success_txs.freeze();
let rwlockguard_bank_with_success_txs_hash = bank_with_success_txs.hash.read().unwrap();
let bank_with_success_txs_hash = rwlockguard_bank_with_success_txs_hash.as_ref();
assert_eq!(bank_with_success_txs_hash, bank_hash);
} | rust_cleaned_test_functions.jsonl/2527 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2089
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51569,
2259,
4489,
83127,
6536,
30862,
27125,
4470,
8950,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
1428,
286,
1077,
320,
6984,
59366,
5332,
11,
716,
67791,
3097,
12670,
8,
284,
1855,
16322,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_memo() {
let good_memo = "good memo".to_string();
assert_eq!(
parse_memo(&CompiledInstruction {
program_id_index: 0,
accounts: vec![],
data: good_memo.as_bytes().to_vec(),
})
.unwrap(),
Value::String(good_memo),
);
let bad_memo = vec![128u8];
assert!(std::str::from_utf8(&bad_memo).is_err());
assert!(parse_memo(&CompiledInstruction {
program_id_index: 0,
data: bad_memo,
accounts: vec![],
})
.is_err(),);
} | rust_cleaned_test_functions.jsonl/24989 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 369
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
717,
6726,
368,
341,
286,
1077,
1661,
717,
6726,
284,
330,
18536,
21438,
3263,
983,
3904,
543,
286,
2060,
10714,
33673,
310,
4715,
717,
6726,
2099,
90383,
16664,
341,
394,
2025,
842,
3560,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_subtract_more_than_two_hours_with_borrow() {
let clock = Clock::new(6, 15).add_minutes(-160);
assert_eq!(clock.to_string(), "03:35");
} | rust_cleaned_test_functions.jsonl/5374 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 76
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5228,
2144,
36664,
51613,
23241,
41371,
6615,
880,
7768,
368,
341,
262,
1077,
8866,
284,
26142,
486,
931,
7,
21,
11,
220,
16,
20,
568,
718,
67655,
4080,
16,
21,
15,
317,
262,
2060,
10714,
1029... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_critical_path() {
let (graph, map) = long_graph();
let crit = critical_paths(&graph);
assert_eq!(crit[&map["mix"]], 1);
assert_eq!(crit[&map["short"]], 2);
assert_eq!(crit[&map["pass3"]], 2);
assert_eq!(crit[&map["pass2"]], 3);
assert_eq!(crit[&map["pass1"]], 4);
assert_eq!(crit[&map["split"]], 5);
assert_eq!(crit[&map["input"]], 6);
} | rust_cleaned_test_functions.jsonl/66798 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 225
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77502,
2638,
368,
341,
286,
1077,
320,
4439,
11,
2415,
8,
284,
1293,
14738,
1428,
286,
1077,
4638,
284,
9023,
24152,
2099,
4439,
626,
286,
2060,
10714,
10297,
36996,
58,
5,
2186,
1183,
35071,
13... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_table_response_ser() {
let resp = Table {
columns: vec![
Column {
text: "Name".to_string(),
_type: "Text".to_string(),
},
],
_type: "table".to_string(),
rows: vec![vec![json!("nick")]],
};
let actual = serde_json::to_string(&resp).unwrap();
assert_eq!(
actual,
r#"{"columns":[{"text":"Name","type":"Text"}],"type":"table","rows":[["nick"]]}"#.to_string()
);
} | rust_cleaned_test_functions.jsonl/95418 | {
"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,
5237,
9655,
75861,
368,
341,
286,
1077,
9039,
284,
6633,
341,
310,
8147,
25,
7486,
90515,
394,
9332,
341,
503,
1467,
25,
330,
675,
3263,
983,
3904,
3148,
503,
716,
1313,
25,
330,
1178,
3263,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bit_shifts() {
let len = 5;
let rng = &mut XorShiftRng::from_seed(crate::TEST_SEED);
for amount in 1..8 {
for left in [true, false].iter() {
let data: Vec<u8> = (0..len).map(|_| rng.gen()).collect();
let shifted_bits = shift_bits(&data, amount, *left);
let mut bv: BitVec<LittleEndian, u8> = data.into();
if *left {
bv >>= amount;
} else {
bv <<= amount;
}
assert_eq!(bv.as_ref(), shifted_bits.as_slice());
}
}
} | rust_cleaned_test_functions.jsonl/32993 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 404
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13996,
22230,
82,
368,
341,
286,
1077,
2422,
284,
220,
20,
280,
286,
1077,
28422,
284,
609,
6984,
1599,
269,
24841,
49,
968,
486,
1499,
33809,
54907,
486,
10033,
3620,
1479,
626,
286,
369,
3311,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_max_PrimaryCausets_check() {
let node = ExprDefBuilder::PrimaryCauset_ref(0, FieldTypeTp::LongLong).build();
assert!(RpnExpressionBuilder::build_from_expr_tree_with_fn_mapper(
node.clone(),
fn_mapper,
0
)
.is_err());
for i in 1..10 {
assert!(RpnExpressionBuilder::build_from_expr_tree_with_fn_mapper(
node.clone(),
fn_mapper,
i
)
.is_ok());
}
let node = ExprDefBuilder::PrimaryCauset_ref(3, FieldTypeTp::LongLong).build();
for i in 0..=3 {
assert!(RpnExpressionBuilder::build_from_expr_tree_with_fn_mapper(
node.clone(),
fn_mapper,
i
)
.is_err());
}
for i in 4..10 {
assert!(RpnExpressionBuilder::build_from_expr_tree_with_fn_mapper(
node.clone(),
fn_mapper,
i
)
.is_ok());
}
let node =
ExprDefBuilder::scalar_func(ScalarFuncSig::CastIntAsString, FieldTypeTp::LongLong)
.push_child(ExprDefBuilder::PrimaryCauset_ref(1, FieldTypeTp::LongLong))
.push_child(ExprDefBuilder::PrimaryCauset_ref(2, FieldTypeTp::LongLong))
.push_child(ExprDefBuilder::PrimaryCauset_ref(5, FieldTypeTp::LongLong))
.build();
for i in 0..=5 {
assert!(RpnExpressionBuilder::build_from_expr_tree_with_fn_mapper(
node.clone(),
fn_mapper,
i
)
.is_err());
}
for i in 6..10 {
assert!(RpnExpressionBuilder::build_from_expr_tree_with_fn_mapper(
node.clone(),
fn_mapper,
i
)
.is_ok());
}
} | rust_cleaned_test_functions.jsonl/103955 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6345,
32716,
3111,
34,
11855,
1415,
7200,
368,
341,
1789,
286,
1077,
2436,
284,
28819,
2620,
3297,
486,
15972,
34,
11855,
295,
7793,
7,
15,
11,
84614,
62241,
486,
6583,
6583,
568,
5834,
543,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_no_flag() {
let actual = new_ucmd!().succeeds().stdout_move_str();
let expect = expected_result(&[]);
let v_actual: Vec<&str> = actual.split_whitespace().collect();
let v_expect: Vec<&str> = expect.split_whitespace().collect();
assert_eq!(v_actual, v_expect);
} | rust_cleaned_test_functions.jsonl/24866 | {
"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,
6536,
10933,
368,
341,
262,
1077,
5042,
284,
501,
68887,
2277,
0,
1005,
82,
29264,
82,
1005,
36358,
17134,
2895,
543,
262,
1077,
1720,
284,
3601,
5287,
2099,
56703,
262,
1077,
348,
40149,
25,
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_pyfn() {
#[pymodule]
fn my_module(_py: Python, m: &PyModule) -> PyResult<()> {
#[pyfn(m, a, b = "None", "*", c = 42)]
#[pyo3(text_signature = "(a, b=None, *, c=42)")]
fn my_function(a: i32, b: Option<i32>, c: i32) {
let _ = (a, b, c);
}
Ok(())
}
let gil = Python::acquire_gil();
let py = gil.python();
let m = wrap_pymodule!(my_module)(py);
py_assert!(
py,
m,
"m.my_function.__text_signature__ == '(a, b=None, *, c=42)'"
);
} | rust_cleaned_test_functions.jsonl/32988 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 312
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40291,
8822,
368,
341,
262,
11506,
79,
1600,
1756,
921,
262,
5168,
847,
10750,
2490,
3288,
25,
13027,
11,
296,
25,
609,
13828,
3332,
8,
1464,
5355,
2077,
71698,
341,
286,
11506,
3288,
8822,
1255... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_username() -> Result<()> {
let username = "username".to_owned();
let u = TextAttribute {
attr: ATTR_USERNAME,
text: username.clone(),
};
let mut m = Message::new();
m.write_header();
//"Bad length"
{
let bad_u = TextAttribute {
attr: ATTR_USERNAME,
text: String::from_utf8(vec![0; 600]).unwrap(),
};
let result = bad_u.add_to(&mut m);
if let Err(err) = result {
assert!(
is_attr_size_overflow(&err),
"add_to should return *AttrOverflowErr, got: {}",
err
);
} else {
assert!(false, "expected error, but got ok");
}
}
//"add_to"
{
u.add_to(&mut m)?;
//"GetFrom"
{
let got = TextAttribute::get_from_as(&m, ATTR_USERNAME)?;
assert_eq!(
got.to_string(),
username,
"expedted: {}, got: {}",
username,
got
);
//"Not found"
{
let m = Message::new();
let result = TextAttribute::get_from_as(&m, ATTR_USERNAME);
if let Err(err) = result {
assert_eq!(Error::ErrAttributeNotFound, err, "Should error");
} else {
assert!(false, "expected error, but got ok");
}
}
}
}
//"No allocations"
{
let mut m = Message::new();
m.write_header();
let u = TextAttribute {
attr: ATTR_USERNAME,
text: "username".to_owned(),
};
u.add_to(&mut m)?;
m.reset();
}
Ok(())
} | rust_cleaned_test_functions.jsonl/57157 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1012
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21588,
368,
1464,
5714,
71698,
341,
262,
1077,
5934,
284,
330,
5113,
3263,
983,
51973,
543,
262,
1077,
575,
284,
2918,
3907,
341,
286,
6376,
25,
37918,
42696,
345,
286,
1467,
25,
5934,
15997,
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... | 6 |
#[test]
fn test_parse_field_invalid() {
assert_eq!(parse_field(b""), Err(invalid("line missing ':' byte")));
assert_eq!(parse_field(b"event"), Err(invalid("line missing ':' byte")));
match parse_field(b"\x80: invalid UTF-8") {
Err(InvalidLine(msg)) => assert!(msg.contains("Utf8Error")),
res => panic!("expected InvalidLine error, got {:?}", res),
}
} | rust_cleaned_test_functions.jsonl/64499 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
5013,
31433,
368,
341,
286,
2060,
10714,
10297,
6400,
5013,
1883,
3014,
701,
15495,
5900,
1891,
445,
1056,
7402,
36304,
4922,
74385,
286,
2060,
10714,
10297,
6400,
5013,
1883,
1,
3087,
3975,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_skewness() {
test_almost(-1.0, 0.1, 0.30175909933883402945387113824982918009810212213629, 1e-14, |x| x.skewness());
test_case(-1.0, 1.5, 33.46804679732172529147579024311650645764144530123, |x| x.skewness());
test_almost(-1.0, 2.5, 11824.007933610287521341659465200553739278936344799, 1e-11, |x| x.skewness());
test_almost(-1.0, 5.5, 50829064464591483629.132631635472412625371367420496, 1e4, |x| x.skewness());
test_almost(-0.1, 0.1, 0.30175909933883402945387113824982918009810212213629, 1e-14, |x| x.skewness());
test_case(-0.1, 1.5, 33.46804679732172529147579024311650645764144530123, |x| x.skewness());
test_almost(-0.1, 2.5, 11824.007933610287521341659465200553739278936344799, 1e-11, |x| x.skewness());
test_almost(-0.1, 5.5, 50829064464591483629.132631635472412625371367420496, 1e4, |x| x.skewness());
test_almost(0.1, 0.1, 0.30175909933883402945387113824982918009810212213629, 1e-14, |x| x.skewness());
test_case(0.1, 1.5, 33.46804679732172529147579024311650645764144530123, |x| x.skewness());
test_almost(0.1, 2.5, 11824.007933610287521341659465200553739278936344799, 1e-11, |x| x.skewness());
test_almost(0.1, 5.5, 50829064464591483629.132631635472412625371367420496, 1e4, |x| x.skewness());
test_almost(1.5, 0.1, 0.30175909933883402945387113824982918009810212213629, 1e-14, |x| x.skewness());
test_case(1.5, 1.5, 33.46804679732172529147579024311650645764144530123, |x| x.skewness());
test_almost(1.5, 2.5, 11824.007933610287521341659465200553739278936344799, 1e-11, |x| x.skewness());
test_almost(1.5, 5.5, 50829064464591483629.132631635472412625371367420496, 1e4, |x| x.skewness());
test_almost(2.5, 0.1, 0.30175909933883402945387113824982918009810212213629, 1e-14, |x| x.skewness());
test_case(2.5, 1.5, 33.46804679732172529147579024311650645764144530123, |x| x.skewness());
test_almost(2.5, 2.5, 11824.007933610287521341659465200553739278936344799, 1e-11, |x| x.skewness());
test_almost(2.5, 5.5, 50829064464591483629.132631635472412625371367420496, 1e4, |x| x.skewness());
test_almost(5.5, 0.1, 0.30175909933883402945387113824982918009810212213629, 1e-14, |x| x.skewness());
test_case(5.5, 1.5, 33.46804679732172529147579024311650645764144530123, |x| x.skewness());
test_almost(5.5, 2.5, 11824.007933610287521341659465200553739278936344799, 1e-11, |x| x.skewness());
test_almost(5.5, 5.5, 50829064464591483629.132631635472412625371367420496, 1e4, |x| x.skewness());
} | rust_cleaned_test_functions.jsonl/88261 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1399
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33811,
365,
2090,
368,
341,
286,
1273,
94418,
4080,
16,
13,
15,
11,
220,
15,
13,
16,
11,
220,
15,
13,
18,
15,
16,
22,
20,
24,
15,
24,
24,
18,
18,
23,
23,
18,
19,
15,
17,
24,
19,
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_limit() {
let schemaReplicant = prepopulated_schemaReplicant();
let causetq = r#"[:find ?x :where [?x :foo/bar "yyy"] :limit 5]"#;
let SQLCausetQ { allegrosql, args } = translate(&schemaReplicant, causetq);
assert_eq!(allegrosql, "SELECT DISTINCT `Causets00`.e AS `?x` FROM `causets` AS `Causets00` WHERE `Causets00`.a = 99 AND `Causets00`.v = $v0 LIMIT 5");
assert_eq!(args, vec![make_arg("$v0", "yyy")]);
} | rust_cleaned_test_functions.jsonl/90691 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 202
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14763,
368,
341,
262,
1077,
10802,
18327,
35237,
284,
855,
8374,
7757,
25371,
18327,
35237,
1428,
262,
1077,
2162,
18187,
80,
284,
435,
55543,
3447,
3903,
937,
87,
549,
2870,
508,
30,
87,
549,
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_build_url_search() {
let url_builder = ElasticsearchUrlBuilder::new("http://server".to_string(), "INDEX_NAME".to_string());
assert_that(&url_builder.search()).is_equal_to("http://server/INDEX_NAME/_search".to_string());
} | rust_cleaned_test_functions.jsonl/35093 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 89
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20801,
2903,
10716,
368,
341,
220,
1077,
2515,
28532,
284,
58887,
2864,
3297,
486,
931,
445,
1254,
1110,
4030,
3263,
983,
3904,
1507,
330,
44331,
4708,
3263,
983,
3904,
5231,
220,
2060,
70197,
209... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_new_entry_and_update_code_paths() {
for is_upsert in &[false, true] {
// account_info type that IS cached
test_new_entry_code_paths_helper([1.0, 2.0], true, *is_upsert);
// account_info type that is NOT cached
test_new_entry_code_paths_helper([true, false], false, *is_upsert);
}
} | rust_cleaned_test_functions.jsonl/45165 | {
"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,
5921,
9078,
8378,
8882,
4136,
24152,
368,
341,
286,
369,
374,
8237,
6047,
304,
44590,
3849,
11,
830,
60,
341,
310,
442,
2692,
3109,
943,
429,
3424,
20579,
198,
310,
1273,
5921,
9078,
4136,
24152... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_disassemble() {
let out = X86_64::disassemble(&[0xff, 0x25, 0x42, 0x7e, 0x21, 0x00], 0x1000);
debugln!("{:?}", out);
let out = X86_64::disassemble(&[0x48, 0x89, 0xE0], 0x1000);
debugln!("{:?}", out);
let out = X86_64::disassemble(&[0x89, 0xC0], 0x1000);
debugln!("{:?}", out);
let out = X86_64::disassemble(&[0xAA], 0x1000);
debugln!("{:?}", out);
let out = X86_64::disassemble(&[0x48, 0xA3, 0x00, 0x90, 0x9A,
0x93, 0xE6, 0x7F, 0x00, 0x00], 0x1000);
debugln!("{:?}", out);
} | rust_cleaned_test_functions.jsonl/53563 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 332
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9932,
69108,
368,
341,
262,
1077,
700,
284,
1599,
23,
21,
62,
21,
19,
486,
4243,
69108,
2099,
58,
15,
9020,
11,
220,
15,
87,
17,
20,
11,
220,
15,
87,
19,
17,
11,
220,
15,
87,
22,
68,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bytes_to_bits_tuple_ok2() {
assert!(add_bytes_to_bits_tuple::<u64>((5, Bounded::max_value()), 1) == (6, 7));
} | rust_cleaned_test_functions.jsonl/51859 | {
"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,
2891,
12524,
2346,
20034,
21773,
19817,
17,
368,
341,
286,
2060,
10297,
718,
12524,
2346,
20034,
21773,
27638,
84,
21,
19,
47453,
20,
11,
425,
13082,
486,
2810,
3142,
11858,
220,
16,
8,
621,
320... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_limit() {
assert_cli::Assert::main_binary()
.with_args(&[r#"* | limit 2"#, "--file", "test_files/filter_test.log"])
.stdout()
.is("[INFO] I am a log!
[WARN] Uh oh, danger ahead! ")
.unwrap();
} | rust_cleaned_test_functions.jsonl/15997 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 152
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14763,
368,
341,
286,
2060,
47147,
486,
8534,
486,
3817,
31761,
741,
310,
659,
4197,
8384,
2099,
58,
81,
55543,
9,
760,
3930,
220,
17,
57676,
11,
14482,
1192,
497,
330,
1944,
10931,
63524,
4452,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_remove_index() {
let mut a = arr2(&[[1, 2, 3],
[4, 5, 6],
[7, 8, 9],
[10,11,12]]);
a.remove_index(Axis(0), 1);
a.remove_index(Axis(1), 2);
assert_eq!(a.shape(), &[3, 2]);
assert_eq!(a,
array![[1, 2],
[7, 8],
[10,11]]);
let mut a = arr2(&[[1, 2, 3],
[4, 5, 6],
[7, 8, 9],
[10,11,12]]);
a.invert_axis(Axis(0));
a.remove_index(Axis(0), 1);
a.remove_index(Axis(1), 2);
assert_eq!(a.shape(), &[3, 2]);
assert_eq!(a,
array![[10,11],
[4, 5],
[1, 2]]);
a.remove_index(Axis(1), 1);
assert_eq!(a.shape(), &[3, 1]);
assert_eq!(a,
array![[10],
[4],
[1]]);
a.remove_index(Axis(1), 0);
assert_eq!(a.shape(), &[3, 0]);
assert_eq!(a,
array![[],
[],
[]]);
} | rust_cleaned_test_functions.jsonl/92641 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 686
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
3560,
368,
341,
262,
1077,
5206,
264,
284,
2890,
17,
2099,
15505,
16,
11,
220,
17,
11,
220,
18,
1259,
5180,
508,
19,
11,
220,
20,
11,
220,
21,
1259,
5180,
508,
22,
11,
220,
23,
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_pragma_get_statevector() {
let mut circuit = Circuit::new();
circuit += DefinitionBit::new("ro".to_string(), 1, true);
circuit += PauliX::new(0);
circuit += PragmaGetStateVector::new("ro".to_string(), None);
let (_b, _f, complex_registers, _bo, _co) = call_circuit(&circuit, empty_regs(), 2).unwrap();
assert!(complex_registers.contains_key("ro"));
let out_reg = complex_registers.get("ro").unwrap();
assert_eq!(out_reg.len(), 4);
for reg in out_reg.iter() {
assert!(reg.re.abs() < 1.0);
assert!(reg.im.abs() < 1.0);
}
} | rust_cleaned_test_functions.jsonl/40997 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 258
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
4101,
1728,
3062,
4387,
3215,
368,
341,
262,
1077,
5206,
16224,
284,
27218,
486,
931,
543,
262,
16224,
1421,
19709,
8344,
486,
931,
445,
299,
3263,
983,
3904,
1507,
220,
16,
11,
830,
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... | 2 |
#[test]
fn test_push_pop() {
let mut bv = BitVec::new(0);
assert_eq!(bv.count_ones(), 0);
assert_eq!(bv.count_zeros(), 0);
bv.push(true);
assert_eq!(bv.count_ones(), 1);
assert_eq!(bv.count_zeros(), 0);
bv.push(false);
assert_eq!(bv.count_ones(), 1);
assert_eq!(bv.count_zeros(), 1);
assert_eq!(bv.pop(), Some(false));
assert_eq!(bv.count_ones(), 1);
assert_eq!(bv.count_zeros(), 0);
assert_eq!(bv.pop(), Some(true));
assert_eq!(bv.count_ones(), 0);
assert_eq!(bv.count_zeros(), 0);
assert_eq!(bv.pop(), None);
} | rust_cleaned_test_functions.jsonl/128603 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 364
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14218,
17061,
368,
341,
286,
1077,
5206,
56937,
284,
6495,
10050,
486,
931,
7,
15,
317,
286,
2060,
10714,
10297,
54929,
6501,
62,
3154,
1507,
220,
15,
317,
286,
2060,
10714,
10297,
54929,
6501,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bool_as_json() {
test_none_with_nothing(cast_bool_as_json);
let cs = vec![
(0, Json::Boolean(false)),
(i64::MIN, Json::Boolean(true)),
(i64::MAX, Json::Boolean(true)),
];
for (input, expect) in cs {
let result = cast_bool_as_json(&Some(input));
let log = make_log(&input, &expect, &result);
check_result(Some(&expect), &result, log.as_str());
}
} | rust_cleaned_test_functions.jsonl/101814 | {
"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,
22159,
11898,
9455,
368,
341,
286,
1273,
31488,
6615,
6536,
1596,
1337,
559,
22159,
11898,
9455,
626,
286,
1077,
10532,
284,
7486,
90515,
310,
320,
15,
11,
8308,
486,
6890,
3576,
6965,
310,
320,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_get_shell_info() {
env::remove_var("STARSHIP_SHELL");
let unknown_shell = get_shell_info();
assert_eq!(UNKNOWN_SHELL, &unknown_shell.name);
env::set_var("STARSHIP_SHELL", "fish");
let fish_shell = get_shell_info();
assert_eq!("fish", &fish_shell.name);
} | rust_cleaned_test_functions.jsonl/112684 | {
"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,
3062,
48945,
3109,
368,
341,
286,
6105,
486,
5399,
4612,
445,
67061,
70220,
1098,
68558,
797,
286,
1077,
9788,
48945,
284,
633,
48945,
3109,
543,
286,
2060,
10714,
10297,
51378,
1098,
68558,
11,
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_fast_path() -> Result<()> {
let a: PrimitiveArray<Int64Type> =
PrimitiveArray::from(vec![Some(1), Some(2), None]);
// all true
let mask = BooleanArray::from(vec![true, true, true]);
let out = filter(&a, &mask)?;
let b = out
.as_any()
.downcast_ref::<PrimitiveArray<Int64Type>>()
.unwrap();
assert_eq!(&a, b);
// all false
let mask = BooleanArray::from(vec![false, false, false]);
let out = filter(&a, &mask)?;
assert_eq!(out.len(), 0);
assert_eq!(out.data_type(), &DataType::Int64);
Ok(())
} | rust_cleaned_test_functions.jsonl/75310 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 336
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35743,
2638,
368,
1464,
5714,
71698,
341,
286,
1077,
264,
25,
51460,
1857,
34520,
21,
19,
929,
29,
4035,
310,
51460,
1857,
486,
1499,
25592,
20703,
8373,
7,
16,
701,
4329,
7,
17,
701,
2240,
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... | 3 |
#[test]
fn test_expr_to_aexp() {
use super::*;
let expr = Expr::Literal(LiteralValue::Int8(0));
let mut arena = Arena::new();
let aexpr = to_aexpr(expr, &mut arena);
assert_eq!(aexpr, Node(0));
assert!(matches!(
arena.get(aexpr),
AExpr::Literal(LiteralValue::Int8(0))
))
} | rust_cleaned_test_functions.jsonl/131648 | {
"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,
21915,
2346,
4306,
4580,
368,
341,
262,
990,
2256,
79304,
262,
1077,
15169,
284,
28819,
486,
17350,
4957,
9953,
1130,
486,
1072,
23,
7,
15,
1106,
262,
1077,
5206,
24902,
284,
27047,
486,
931,
54... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hugeint_max_min() -> Result<()> {
let db = Connection::open_in_memory()?;
db.execute("CREATE TABLE huge_int (u1 hugeint, u2 hugeint);", [])?;
// Min/Max value defined in here: https://duckdb.org/docs/sql/data_types/numeric
let i128max: i128 = i128::MAX;
let i128min: i128 = i128::MIN + 1;
db.execute("INSERT INTO huge_int VALUES (?, ?);", [&i128max, &i128min])?;
let v = db.query_row("SELECT * FROM huge_int", [], |row| <(i128, i128)>::try_from(row))?;
assert_eq!(v, (i128max, i128min));
Ok(())
} | rust_cleaned_test_functions.jsonl/133824 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 284
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1523,
4733,
396,
6345,
7260,
368,
1464,
5714,
71698,
341,
286,
1077,
2927,
284,
11032,
486,
2508,
1243,
19195,
94136,
286,
2927,
7769,
445,
22599,
14363,
6765,
4042,
320,
84,
16,
6765,
396,
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... | 5 |
#[test]
fn test_get_offset() {
let dataset = Dataset::open(fixture!("tinymarble.png")).unwrap();
let rasterband = dataset.rasterband(1).unwrap();
let offset = rasterband.offset();
assert_eq!(offset, Some(0.0));
} | rust_cleaned_test_functions.jsonl/83455 | {
"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,
3062,
6917,
368,
341,
262,
1077,
10337,
284,
39183,
486,
2508,
94886,
17223,
55971,
1600,
277,
891,
3508,
15197,
15454,
543,
262,
1077,
47208,
7053,
284,
10337,
1746,
2300,
7053,
7,
16,
568,
15454... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_renew() {
let mut s = socket_bound();
recv!(s, []);
assert_eq!(s.poll(), None);
recv!(s, time 500_000, [(IP_SEND, UDP_SEND, DHCP_RENEW)]);
assert_eq!(s.poll(), None);
match &s.state {
ClientState::Renewing(r) => {
// we haven't received the ACK yet
assert_eq!(r.expires_at, Instant::from_secs(1000));
}
_ => panic!("Invalid state"),
}
send!(s, time 500_000, (IP_RECV, UDP_RECV, DHCP_ACK));
assert_eq!(s.poll(), None);
match &s.state {
ClientState::Renewing(r) => {
// NOW the expiration gets bumped
assert_eq!(r.renew_at, Instant::from_secs(500 + 500));
assert_eq!(r.expires_at, Instant::from_secs(500 + 1000));
}
_ => panic!("Invalid state"),
}
} | rust_cleaned_test_functions.jsonl/90237 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 519
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
931,
368,
341,
286,
1077,
5206,
274,
284,
7575,
19447,
1428,
286,
27006,
10297,
82,
11,
42197,
286,
2060,
10714,
10297,
82,
41477,
1507,
2240,
317,
286,
27006,
10297,
82,
11,
882,
220,
20,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_iter_h_0() {
let t_1 = TimeInstance::from(DateTime::new_utc(2001, 1, 1, 0, 1, 1));
let t_2 = TimeInstance::from(DateTime::new_utc(2001, 1, 1, 0, 1, 1));
let t_step = TimeStep {
granularity: TimeGranularity::Hours,
step: 1,
};
let iter = TimeStepIter::new_with_interval_incl_start(
TimeInterval::new_unchecked(t_1, t_2),
t_step,
)
.unwrap();
let t_vec: Vec<TimeInstance> = iter.collect();
assert_eq!(&t_vec, &[t_1]);
} | rust_cleaned_test_functions.jsonl/134042 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 304
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
1523,
62,
15,
368,
341,
286,
1077,
259,
62,
16,
284,
4120,
2523,
486,
1499,
32083,
486,
931,
84259,
7,
17,
15,
15,
16,
11,
220,
16,
11,
220,
16,
11,
220,
15,
11,
220,
16,
11,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_nonzero_isize() {
let test = assert_de_tokens_error::<NonZeroIsize>;
// from zero
test(
&[Token::I8(0)],
"invalid value: integer `0`, expected a nonzero isize",
);
test(
&[Token::I16(0)],
"invalid value: integer `0`, expected a nonzero isize",
);
test(
&[Token::I32(0)],
"invalid value: integer `0`, expected a nonzero isize",
);
test(
&[Token::I64(0)],
"invalid value: integer `0`, expected a nonzero isize",
);
test(
&[Token::U8(0)],
"invalid value: integer `0`, expected a nonzero isize",
);
test(
&[Token::U16(0)],
"invalid value: integer `0`, expected a nonzero isize",
);
test(
&[Token::U32(0)],
"invalid value: integer `0`, expected a nonzero isize",
);
test(
&[Token::U64(0)],
"invalid value: integer `0`, expected a nonzero isize",
);
} | rust_cleaned_test_functions.jsonl/129508 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 478
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21637,
14154,
6892,
551,
368,
341,
262,
1077,
1273,
284,
2060,
2259,
28838,
4096,
27638,
8121,
17999,
40,
2141,
19421,
262,
442,
504,
7168,
198,
262,
1273,
1006,
286,
44590,
3323,
486,
40,
23,
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_send_unaddressable() {
let mut socket = socket(buffer(0), buffer(1));
assert_eq!(
socket.send_slice(b"abcdef", IpAddress::default()),
Err(Error::Unaddressable)
);
assert_eq!(socket.send_slice(b"abcdef", REMOTE_IPV4.into()), Ok(()));
} | rust_cleaned_test_functions.jsonl/99228 | {
"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,
13565,
4907,
4995,
480,
368,
341,
286,
1077,
5206,
7575,
284,
7575,
12584,
7,
15,
701,
4147,
7,
16,
1106,
286,
2060,
10714,
33673,
310,
7575,
5219,
26488,
1883,
1,
41202,
497,
35033,
4286,
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_fetch_sync_string() {
let http_server_guard = crate::test_util::http_server();
let url = Url::parse("http://127.0.0.1:4545/package.json").unwrap();
tokio_util::init(|| match fetch_string_once_sync(&url).unwrap() {
FetchOnceResult::Code(code, maybe_content_type) => {
assert!(!code.is_empty());
assert_eq!(maybe_content_type, Some("application/json".to_string()));
}
_ => unreachable!(),
});
drop(http_server_guard);
} | rust_cleaned_test_functions.jsonl/112154 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 218
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11803,
23008,
3904,
368,
341,
262,
1077,
1758,
12015,
36796,
284,
17717,
486,
1944,
18974,
486,
1254,
12015,
543,
1066,
262,
1077,
2515,
284,
22840,
486,
6400,
445,
1254,
1110,
16,
17,
22,
13,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_attestation_service_decode_and_verify() {
let service: AttestationService = AttestationService::new(attestation_service::constants::ATTESTATION_SERVICE_URL);
let encrypted_quote = String::from("AgAAANoKAAAHAAYAAAAAALAzX9O8HMqPgE65imQgWS3bL6zst0H4QfxKAKurXXnVBAX/////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAAAAAAAAAHAAAAAAAAAIzp3AzhlP03bwcSpF+o5J3dlTq2zu0T03uf7PbnLtMYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACD1xnnferKFHD2uvYqTXdDA8iZ22kCD5xw7h38CMfOngAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD9sUtS1/Vn5lvk3Mxh+eX0AOjdoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAqAIAADM2OO98uEjJQLRmzAvAqO4nirzimAHK0PjdgI8MT0xKDy/Paohf208N04YWgzl4kOjrG0X/T8LUphwzn3qB7XkycWqDO9RsLbNIpKRiVBIttztbn0/kxcwo6p54OeOLfhFbxaTn0wkzEYJhGWVR+j6IUGxubDwinf0fO+2vPu20kW1NzSV/Le8fyYzC4v5sIblVW8VZESsbuFd+bFbbcNzco9cH6cNI68FMkeMHoZF/Z4HvP7DR2sIiLnmYcavDbTlzG7OwaTDNcTCNfKsKReK76TRtu+m018QArsRTdrAwx7gZY2788RBpn0veSkU+v9QxNnZmqfpMolAXdu3ksQul4R8bzQ8HoiRkQvedCY8K+5j3GLvDjLCUgB4JP8Vhtt6KjABRO5o4+s3Uj2gBAABJIOqpxIvbG5zmizV7zUe4jAJQoPVM3jtcxXwU9PH5saXiCPHBpTEBpK/2r/5bUnIIBkshRbQ8/kP6/lLhEOu3Fkfh7UMMoizPO8uGQimLBGwbAFyAgU4G8TGeUbYWEGuRRJoKDoclzm9edJZ7mApMlmiT9t2VMLMsg7l49sO1T1TtgK/zpwwLvr2f4a/vmkJWviOcIRimFD+V20xw+EMXYl8Aj4x4Rw62+oiQe0mKvh3K4gXIamejnQHZ/Mrbeh8ai0n1J+GMeKFxxSkeytGZVrT+a75WjLAcJtt5QAU3Em1ELsWLUVUI58mLTe/u+hsjTlWizXAruElzhCIijvR96aHc+lzd/a+EmsQ4mI/mWPxqdoUciznhG4VlxNAhXSw8zn77k8m+1GaBSxvAUDwFOf/V3KcQUYp5Cswo1MD4t26Rn5LBqF1I0I27d/BHD+KUwl7W5doG4Ec6egnoofkSTUnjI3G+9btxIVV2nYWzfXauZzseiZQn");
let response = service.get_report(encrypted_quote).unwrap();
let quote = response.get_quote().unwrap();
let address = "fdb14b52d7f567e65be4dccc61f9e5f400e8dda0".from_hex().unwrap();
assert_eq!("e.report_body.report_data[..20], &address[..]);
assert!(response.result.verify_report().unwrap());
} | rust_cleaned_test_functions.jsonl/124224 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13356,
63978,
12267,
15227,
8378,
35638,
368,
341,
286,
1077,
2473,
25,
2411,
1944,
367,
1860,
284,
2411,
1944,
367,
1860,
486,
931,
65737,
63978,
12267,
486,
15763,
486,
828,
10033,
3495,
21590,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.