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_proc_fd() {
let myself = Process::myself().unwrap();
let raw_fd = myself.fd().unwrap().get(0).unwrap().fd as i32;
let fd = FDInfo::from_raw_fd(myself.pid, raw_fd).unwrap();
println!("{:?} {:?}", fd, fd.mode());
} | rust_cleaned_test_functions.jsonl/17546 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24436,
17676,
368,
341,
262,
1077,
7037,
284,
8603,
486,
2408,
721,
1005,
15454,
543,
262,
1077,
7112,
17676,
284,
7037,
58339,
1005,
15454,
1005,
455,
7,
15,
568,
15454,
1005,
6902,
438,
600,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unescape_byte_bad() {
fn check(literal_text: &str, expected_error: EscapeError) {
let actual_result = unescape_byte(literal_text).map_err(|(_offset, err)| err);
assert_eq!(actual_result, Err(expected_error));
}
check("", EscapeError::ZeroChars);
check(r"\", EscapeError::LoneSlash);
check("\n", EscapeError::EscapeOnlyChar);
check("\r\n", EscapeError::EscapeOnlyChar);
check("\t", EscapeError::EscapeOnlyChar);
check("'", EscapeError::EscapeOnlyChar);
check("\r", EscapeError::BareCarriageReturn);
check("spam", EscapeError::MoreThanOneChar);
check(r"\x0ff", EscapeError::MoreThanOneChar);
check(r#"\"a"#, EscapeError::MoreThanOneChar);
check(r"\na", EscapeError::MoreThanOneChar);
check(r"\ra", EscapeError::MoreThanOneChar);
check(r"\ta", EscapeError::MoreThanOneChar);
check(r"\\a", EscapeError::MoreThanOneChar);
check(r"\'a", EscapeError::MoreThanOneChar);
check(r"\0a", EscapeError::MoreThanOneChar);
check(r"\v", EscapeError::InvalidEscape);
check(r"\💩", EscapeError::InvalidEscape);
check(r"\●", EscapeError::InvalidEscape);
check(r"\x", EscapeError::TooShortHexEscape);
check(r"\x0", EscapeError::TooShortHexEscape);
check(r"\xa", EscapeError::TooShortHexEscape);
check(r"\xf", EscapeError::TooShortHexEscape);
check(r"\xx", EscapeError::InvalidCharInHexEscape);
check(r"\xы", EscapeError::InvalidCharInHexEscape);
check(r"\x🦀", EscapeError::InvalidCharInHexEscape);
check(r"\xtt", EscapeError::InvalidCharInHexEscape);
check(r"\u", EscapeError::NoBraceInUnicodeEscape);
check(r"\u[0123]", EscapeError::NoBraceInUnicodeEscape);
check(r"\u{0x}", EscapeError::InvalidCharInUnicodeEscape);
check(r"\u{", EscapeError::UnclosedUnicodeEscape);
check(r"\u{0000", EscapeError::UnclosedUnicodeEscape);
check(r"\u{}", EscapeError::EmptyUnicodeEscape);
check(r"\u{_0000}", EscapeError::LeadingUnderscoreUnicodeEscape);
check(r"\u{0000000}", EscapeError::OverlongUnicodeEscape);
check("ы", EscapeError::NonAsciiCharInByte);
check("🦀", EscapeError::NonAsciiCharInByte);
check(r"\u{0}", EscapeError::UnicodeEscapeInByte);
check(r"\u{000000}", EscapeError::UnicodeEscapeInByte);
check(r"\u{41}", EscapeError::UnicodeEscapeInByte);
check(r"\u{0041}", EscapeError::UnicodeEscapeInByte);
check(r"\u{00_41}", EscapeError::UnicodeEscapeInByte);
check(r"\u{4__1__}", EscapeError::UnicodeEscapeInByte);
check(r"\u{1F63b}", EscapeError::UnicodeEscapeInByte);
check(r"\u{0}x", EscapeError::UnicodeEscapeInByte);
check(r"\u{1F63b}}", EscapeError::UnicodeEscapeInByte);
check(r"\u{FFFFFF}", EscapeError::UnicodeEscapeInByte);
check(r"\u{ffffff}", EscapeError::UnicodeEscapeInByte);
check(r"\u{ffffff}", EscapeError::UnicodeEscapeInByte);
check(r"\u{DC00}", EscapeError::UnicodeEscapeInByte);
check(r"\u{DDDD}", EscapeError::UnicodeEscapeInByte);
check(r"\u{DFFF}", EscapeError::UnicodeEscapeInByte);
check(r"\u{D800}", EscapeError::UnicodeEscapeInByte);
check(r"\u{DAAA}", EscapeError::UnicodeEscapeInByte);
check(r"\u{DBFF}", EscapeError::UnicodeEscapeInByte);
} | rust_cleaned_test_functions.jsonl/61422 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1601
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
12998,
19737,
34199,
368,
341,
286,
5168,
1779,
2333,
9953,
4326,
25,
609,
495,
11,
3601,
4096,
25,
45643,
1454,
8,
341,
310,
1077,
5042,
5287,
284,
650,
12998,
19737,
2333,
9953,
4326,
56... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invalid_spending_conditions() {
let bad_hash_mode_bytes = vec![
// singlesig
// hash mode
0xff,
// 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,
0xc8,
// fee rate
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x02,
0x37,
TransactionPublicKeyEncoding::Compressed as u8,
// signature
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
0xfd,
];
let bad_hash_mode = TransactionSpendingCondition::from_bytes(&bad_hash_mode_bytes);
assert!(bad_hash_mode.is_err());
let bad_p2wpkh_uncompressed_bytes = vec![
// hash mode
HashMode::P2WSH 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,
0x02,
0x37,
// public key uncompressed
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 bad_signature =
TransactionSpendingCondition::from_bytes(&bad_p2wpkh_uncompressed_bytes);
assert!(bad_signature.is_err());
} | rust_cleaned_test_functions.jsonl/31986 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3677
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
10123,
2459,
54099,
368,
341,
286,
1077,
3873,
8950,
7302,
12524,
284,
7486,
90515,
310,
442,
17389,
343,
198,
310,
442,
5175,
3856,
198,
310,
220,
15,
9020,
345,
310,
442,
70039,
198,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_results() -> TestResult {
let p = polar();
p.load_str(
r#"foo(1);
foo(2);
foo(3);"#,
)?;
qvar(&p, "foo(a)", "a", values![1, 2, 3]);
Ok(())
} | rust_cleaned_test_functions.jsonl/68095 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 129
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13576,
368,
1464,
3393,
2077,
341,
262,
1077,
281,
284,
24660,
543,
262,
281,
5104,
2895,
1006,
286,
435,
55543,
7975,
7,
16,
317,
1843,
15229,
7,
17,
317,
1843,
15229,
7,
18,
42788,
2,
345,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_lead_return_type() -> Result<()> {
let fun = WindowFunction::from_str("lead")?;
let observed = return_type(&fun, &[DataType::Utf8])?;
assert_eq!(DataType::Utf8, observed);
let observed = return_type(&fun, &[DataType::Float64])?;
assert_eq!(DataType::Float64, observed);
Ok(())
} | rust_cleaned_test_functions.jsonl/119621 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 162
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
87052,
12511,
1819,
368,
1464,
5714,
71698,
341,
286,
1077,
2464,
284,
13642,
5152,
486,
1499,
2895,
445,
26060,
899,
37445,
286,
1077,
13166,
284,
470,
1819,
2099,
11894,
11,
44590,
22653,
486,
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... | 4 |
#[test]
fn test_rx_close_rst_with_hole() {
let mut s = socket_established();
send!(s, TcpRepr {
seq_number: REMOTE_SEQ + 1,
ack_number: Some(LOCAL_SEQ + 1),
payload: &b"abc"[..],
..SEND_TEMPL
});
send!(s, TcpRepr {
seq_number: REMOTE_SEQ + 1 + 6,
ack_number: Some(LOCAL_SEQ + 1),
payload: &b"ghi"[..],
..SEND_TEMPL
}, Ok(Some(TcpRepr {
seq_number: LOCAL_SEQ + 1,
ack_number: Some(REMOTE_SEQ + 1 + 3),
window_len: 61,
..RECV_TEMPL
})));
send!(s, TcpRepr {
control: TcpControl::Rst,
seq_number: REMOTE_SEQ + 1 + 9,
ack_number: Some(LOCAL_SEQ + 1),
..SEND_TEMPL
});
s.recv(|data| {
assert_eq!(data, b"abc");
(3, ())
}).unwrap();
assert_eq!(s.recv(|_| (0, ())), Err(Error::Illegal));
} | rust_cleaned_test_functions.jsonl/91924 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 627
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24330,
12704,
1710,
267,
6615,
1523,
1263,
368,
341,
286,
1077,
5206,
274,
284,
7575,
18583,
5102,
291,
543,
286,
3624,
10297,
82,
11,
64876,
693,
649,
341,
310,
12981,
5500,
25,
25587,
19158,
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_storage_size() {
let mut storage = Storage::new(8);
assert_eq!(storage.size(), 0);
storage.insert("alice", (1, 1.0, "Alice".to_string()));
assert_eq!(storage.size(), 1);
storage.insert("bob", (2, 2.0, "Bob".to_string()));
assert_eq!(storage.size(), 2);
storage.insert("chris", (3, 3.0, "Chris".to_string()));
assert_eq!(storage.size(), 3);
} | rust_cleaned_test_functions.jsonl/19587 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23310,
2368,
368,
341,
286,
1077,
5206,
5819,
284,
14693,
486,
931,
7,
23,
626,
286,
2060,
10714,
10297,
16172,
2486,
1507,
220,
15,
317,
286,
5819,
7030,
445,
63195,
497,
320,
16,
11,
220,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_slice_wrong_type() {
let conn = Connection::connect("postgres://postgres@localhost:5433", TlsMode::None).unwrap();
conn.simple_query("CREATE TEMPORARY TABLE foo (id SERIAL PRIMARY KEY)")
.unwrap();
let stmt = conn.prepare("SELECT * FROM foo WHERE id = ANY($1)")
.unwrap();
let err = stmt.query(&[&&["hi"][..]]).unwrap_err();
match err.as_conversion() {
Some(e) if e.is::<WrongType>() => {}
_ => panic!("Unexpected error {:?}", err),
};
} | rust_cleaned_test_functions.jsonl/120863 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 222
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26488,
75198,
1819,
368,
341,
262,
1077,
4534,
284,
11032,
486,
6459,
445,
43070,
1110,
43070,
31,
8301,
25,
20,
19,
18,
18,
497,
350,
4730,
3636,
486,
4064,
568,
15454,
543,
262,
4534,
24451,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_load_repoistries() {
let repo = Repositories::from_file("tests/modules/repositories.json").unwrap();
assert_eq!(repo.inner.len(), 1);
assert!(repo.get_module("mymod", "latest").is_some());
} | rust_cleaned_test_functions.jsonl/8740 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 108
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12411,
37784,
380,
4019,
368,
341,
286,
1077,
15867,
284,
24286,
13427,
486,
1499,
2458,
445,
23841,
22903,
10758,
17286,
4323,
1827,
15454,
543,
286,
2060,
10714,
10297,
23476,
9398,
19406,
1507,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_protobuf_encoder() {
let cv = CounterVec::new(Opts::new("test_counter_vec", "help information"),
&["labelname"])
.unwrap();
let reg = registry::Registry::new();
reg.register(Box::new(cv.clone())).unwrap();
cv.get_metric_with_label_values(&["2230"]).unwrap().inc();
let mf = reg.gather();
let mut writer = Vec::<u8>::new();
let encoder = super::ProtobufEncoder::new();
let res = encoder.encode(&mf, &mut writer);
assert!(res.is_ok());
let ans = vec![70, 10, 16, 116, 101, 115, 116, 95, 99, 111, 117, 110, 116, 101, 114, 95,
118, 101, 99, 18, 16, 104, 101, 108, 112, 32, 105, 110, 102, 111, 114, 109,
97, 116, 105, 111, 110, 24, 0, 34, 30, 10, 17, 10, 9, 108, 97, 98, 101,
108, 110, 97, 109, 101, 18, 4, 50, 50, 51, 48, 26, 9, 9, 0, 0, 0, 0, 0, 0,
240, 63];
assert_eq!(ans, writer);
} | rust_cleaned_test_functions.jsonl/82056 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 573
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22357,
18464,
39068,
368,
341,
286,
1077,
5544,
284,
19735,
10050,
486,
931,
19238,
12754,
486,
931,
445,
1944,
15730,
13251,
497,
330,
8653,
1995,
4461,
786,
609,
1183,
1502,
606,
14108,
310,
659... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compute_next_update_time() {
let policy_data =
PolicyData::builder().use_timesource(&MockTimeSource::new_from_now()).build();
let update_check_schedule = UpdateCheckSchedule::default();
let result = StubPolicy::compute_next_update_time(
&policy_data,
&[],
&update_check_schedule,
&ProtocolState::default(),
);
let expected = CheckTiming::builder().time(policy_data.current_time).build();
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/32499 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 250
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57028,
11257,
8882,
3009,
368,
341,
286,
1077,
4842,
1769,
4035,
310,
10974,
1043,
486,
17850,
1005,
810,
22353,
919,
2099,
11571,
1462,
3608,
486,
931,
5673,
20813,
6011,
5834,
543,
286,
1077,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_uri_to_path_and_query() {
let cases = vec![
("/", "/"),
("/foo?bar", "/foo?bar"),
("/foo?bar#nope", "/foo?bar"),
("http://hyper.rs", "/"),
("http://hyper.rs/", "/"),
("http://hyper.rs/path", "/path"),
("http://hyper.rs?query", "/?query"),
("*", "*"),
];
for case in cases {
let uri = Uri::from_str(case.0).unwrap();
let s = uri.path_and_query().unwrap().to_string();
assert_eq!(s, case.1);
}
} | rust_cleaned_test_functions.jsonl/29067 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 271
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15572,
2346,
2638,
8378,
5738,
368,
341,
262,
1077,
5048,
284,
7486,
90515,
286,
88889,
497,
3521,
4461,
286,
88889,
7975,
30,
2257,
497,
3521,
7975,
30,
2257,
4461,
286,
88889,
7975,
30,
2257,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_remove() {
let mut tester = FixedVecDeque::<[usize; 16]>::new();
// this test isn't covering what it wants to
let cap = tester.capacity();
// len is the length *after* removal
for len in 0..cap - 1 {
let expected = (0..).take(len).collect::<FixedVecDeque<[usize; 16]>>();
for tail_pos in 0..cap {
for to_remove in 0..len + 1 {
tester.head = tail_pos;
tester.len = 0;
for i in 0..len {
if i == to_remove {
*tester.push_back() = 1234;
}
*tester.push_back() = i;
}
if to_remove == len {
*tester.push_back() = 1234;
}
tester.remove(to_remove);
assert!(tester.tail() < tester.capacity());
assert!(tester.head < tester.capacity());
assert_eq!(tester, expected);
}
}
}
} | rust_cleaned_test_functions.jsonl/3292 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 741
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
368,
341,
1789,
23459,
286,
1077,
5206,
37111,
284,
20149,
10050,
73891,
27638,
58,
51878,
26,
220,
16,
21,
60,
6831,
931,
1428,
16885,
286,
442,
419,
1273,
4436,
944,
18202,
1128,
432,
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... | 7 |
#[test]
fn test_valid_natural_number() {
valid_natural_number("99".to_owned()).unwrap();
for &s in ["x", "", "#####", "0x11", "ab"].iter() {
assert!(valid_natural_number(s.to_owned()).is_err());
}
} | rust_cleaned_test_functions.jsonl/89524 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8337,
1089,
4585,
5500,
368,
341,
286,
2697,
1089,
4585,
5500,
445,
24,
24,
3263,
983,
51973,
6011,
15454,
1428,
286,
369,
609,
82,
304,
4383,
87,
497,
7342,
330,
67331,
497,
330,
15,
87,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_batch_remove_clone_subnode_from_root() {
let mut nodes_map: HashMap<i32, Node<Item4>> = HashMap::new();
let mut nodes = Nodes {
nodes_map,
size: 0,
root_id: 0,
content_size: 0,
next_id: 0,
m: 0,
};
let mut tree = MerkleBTree::new_empty(3, &mut nodes);
tree.put(Item4 { key: 0, value: 2 }, &mut nodes);
tree.put(Item4 { key: 1, value: 2 }, &mut nodes);
for i in 2..200 {
let item = Item4 { key: i, value: 2 };
tree.put(item, &mut nodes);
}
let mut subnodes;
nodes.iterator();
for j in 2..200 {
println!("remove loop:\n\n");
println!("{}", j);
subnodes = tree.remove_clone(Item4 { key: j, value: 2 }, &mut nodes);
print_subnodes_nodemap(&mut subnodes);
let node_hash = nodes.merkleroot();
tree.remove(Item4 { key: j, value: 2 }, &mut subnodes);
let subnode_hash = subnodes.merkleroot();
println!("node_hash:{}", node_hash);
println!("subnode_hash:{}", subnode_hash);
assert_eq!(node_hash, subnode_hash);
}
} | rust_cleaned_test_functions.jsonl/11991 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 540
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14534,
18193,
54742,
5228,
3509,
5673,
12993,
368,
341,
262,
1077,
5206,
7798,
5376,
25,
10528,
21897,
18,
17,
11,
6018,
31857,
19,
2452,
284,
10528,
486,
931,
543,
262,
1077,
5206,
7798,
284,
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... | 3 |
#[test]
fn test_parse_cfi_instruction_remember_state() {
let expected_rest = [1, 2, 3, 4];
let section = Section::with_endian(Endian::Little)
.D8(constants::DW_CFA_remember_state.0)
.append_bytes(&expected_rest);
let contents = section.get_contents().unwrap();
let input = &mut EndianSlice::new(&contents, LittleEndian);
assert_eq!(
parse_cfi_instruction(input, 8),
Ok(CallFrameInstruction::RememberState)
);
assert_eq!(*input, EndianSlice::new(&expected_rest, LittleEndian));
} | rust_cleaned_test_functions.jsonl/9327 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 274
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
666,
9983,
54923,
1288,
9597,
4387,
368,
341,
286,
1077,
3601,
32231,
284,
508,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
935,
286,
1077,
3772,
284,
11113,
486,
4197,
87193,
7,
43231,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_partitions_for_path() {
assert_eq!(
Some(vec![]),
parse_partitions_for_path("bucket/mytable", "bucket/mytable/file.csv", &[])
);
assert_eq!(
None,
parse_partitions_for_path(
"bucket/othertable",
"bucket/mytable/file.csv",
&[]
)
);
assert_eq!(
None,
parse_partitions_for_path(
"bucket/mytable",
"bucket/mytable/file.csv",
&[String::from("mypartition")]
)
);
assert_eq!(
Some(vec!["v1"]),
parse_partitions_for_path(
"bucket/mytable",
"bucket/mytable/mypartition=v1/file.csv",
&[String::from("mypartition")]
)
);
assert_eq!(
Some(vec!["v1"]),
parse_partitions_for_path(
"bucket/mytable/",
"bucket/mytable/mypartition=v1/file.csv",
&[String::from("mypartition")]
)
);
// Only hive style partitioning supported for now:
assert_eq!(
None,
parse_partitions_for_path(
"bucket/mytable",
"bucket/mytable/v1/file.csv",
&[String::from("mypartition")]
)
);
assert_eq!(
Some(vec!["v1", "v2"]),
parse_partitions_for_path(
"bucket/mytable",
"bucket/mytable/mypartition=v1/otherpartition=v2/file.csv",
&[String::from("mypartition"), String::from("otherpartition")]
)
);
assert_eq!(
Some(vec!["v1"]),
parse_partitions_for_path(
"bucket/mytable",
"bucket/mytable/mypartition=v1/otherpartition=v2/file.csv",
&[String::from("mypartition")]
)
);
} | rust_cleaned_test_functions.jsonl/45584 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1234
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
99097,
5478,
2638,
368,
341,
286,
2060,
10714,
33673,
310,
4329,
25592,
0,
1294,
1326,
310,
4715,
99097,
5478,
2638,
445,
30410,
34198,
2005,
497,
330,
30410,
34198,
2005,
23903,
11219,
497,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_date_format_full_day() {
let scene = TestScenario::new(util_name!());
let result = scene.ucmd().arg("+'%a %Y-%m-%d'").succeeds();
assert!(result.success);
let re = Regex::new(r"\S+ \d{4}-\d{2}-\d{2}").unwrap();
assert!(re.is_match(&result.stdout.trim()));
} | rust_cleaned_test_functions.jsonl/25496 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 147
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4164,
8955,
16372,
16763,
368,
341,
262,
1077,
6109,
284,
3393,
54031,
486,
931,
67811,
1269,
0,
5231,
262,
1077,
1102,
284,
6109,
56334,
2277,
1005,
858,
445,
6829,
4,
64,
1018,
56,
11069,
76,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_string_containers() {
parse_code(
"test_string_array",
r#"
foreigner_class!(class Foo {
self_type Foo;
constructor Foo::default() -> Foo;
method Foo::list(&self) -> Vec<String>;
});"#,
&[ForeignLang::Java],
);
} | rust_cleaned_test_functions.jsonl/71612 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 130
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
10260,
20568,
368,
341,
262,
4715,
4136,
1006,
286,
330,
1944,
3904,
3858,
756,
286,
435,
2,
698,
28443,
261,
4790,
10297,
1040,
33428,
341,
262,
656,
1819,
33428,
280,
262,
4692,
33428,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_peer_delay_report() {
let mut exec = fasync::TestExecutor::new().expect("failed to create an executor");
let (remote, _profile_requests, _, _peer) = setup_peer_test();
let remote_peer = avdtp::Peer::new(remote);
// Stream ID chosen randomly by fair dice roll
let seid: StreamEndpointId = 0x09_u8.try_into().unwrap();
let delay_report_fut = remote_peer.delay_report(&seid, 0xc0de);
pin_mut!(delay_report_fut);
match exec.run_until_stalled(&mut delay_report_fut) {
Poll::Ready(Ok(())) => {}
x => panic!("Expected delay report to complete and got {:?}", x),
};
} | rust_cleaned_test_functions.jsonl/91784 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 301
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45159,
22198,
14813,
368,
341,
286,
1077,
5206,
3883,
284,
282,
7692,
486,
2271,
25255,
486,
931,
1005,
17119,
445,
16091,
311,
1855,
458,
31558,
3071,
286,
1077,
320,
18147,
11,
716,
5365,
37216,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_regge3jm() {
let tj_max = 25;
let mut map = HashMap::new();
let n = CanonicalRegge3jm::len(tj_max);
let mut vec = vec![Default::default(); n];
internal::get_3tjms(tj_max, &mut |w3jm| {
let value = w3jm.value();
let (regge, phase) = Regge3jm::from(w3jm).canonicalize();
let canon_value = phase * value;
assert_eq!(
*map.entry(regge).or_insert_with(||canon_value.clone()),
canon_value.clone()
);
vec[regge.index()] = (regge, canon_value);
});
for (regge, value) in map {
assert_eq!(vec[regge.index()], (regge, value));
}
} | rust_cleaned_test_functions.jsonl/80986 | {
"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,
4920,
709,
18,
65939,
368,
341,
262,
1077,
65254,
6345,
284,
220,
17,
20,
280,
262,
1077,
5206,
2415,
284,
10528,
486,
931,
543,
262,
1077,
308,
284,
95177,
3477,
709,
18,
65939,
486,
2892,
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... | 3 |
#[test]
fn test_resolving_multiple_deps() {
let reg = registry(vec![pkg!("foo"), pkg!("bar"), pkg!("baz")]);
let res = resolve(vec![dep("foo"), dep("baz")], ®).unwrap();
assert_same(&res, &names(&["root", "foo", "baz"]));
} | rust_cleaned_test_functions.jsonl/46425 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 108
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4918,
19648,
45233,
76489,
368,
341,
262,
1077,
1217,
284,
19424,
25592,
20703,
30069,
17223,
7975,
3975,
24793,
17223,
2257,
3975,
24793,
17223,
42573,
899,
2558,
262,
1077,
592,
284,
8830,
25592,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tcp_stream_ipv4() {
let io_loop = Runtime::new().expect("failed to create tokio runtime");
tcp_client_stream_test::<AsyncIo02As03<TokioTcpStream>, Runtime, TokioTime>(
IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)),
io_loop,
)
} | rust_cleaned_test_functions.jsonl/10562 | {
"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,
45562,
12673,
49378,
19,
368,
341,
286,
1077,
6399,
17198,
284,
10954,
486,
931,
1005,
17119,
445,
16091,
311,
1855,
9628,
815,
15592,
797,
286,
28051,
8179,
12673,
4452,
27638,
6525,
42799,
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... | 1 |
#[test]
fn test_create_record_schema_does_not_exist() {
let mut transaction_context = MockTransactionContext::default();
transaction_context.add_agent(PUBLIC_KEY);
let mut state = TrackAndTraceState::new(&mut transaction_context);
let transaction_handler = TrackAndTraceTransactionHandler::new();
let create_record_action = create_record_action_with_properties(vec![
optional_property_value(),
required_property_value(),
]);
match transaction_handler._create_record(
&create_record_action,
&mut state,
PUBLIC_KEY,
TIMESTAMP,
) {
Ok(()) => panic!("Schema does not exist, InvalidTransaction should be returned"),
Err(ApplyError::InvalidTransaction(err)) => {
assert!(err.contains(&format!("Schema does not exist {}", SCHEMA_NAME)));
}
Err(err) => panic!("Should have gotten invalid error but got {}", err),
}
} | rust_cleaned_test_functions.jsonl/32550 | {
"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,
8657,
14192,
25371,
96374,
7913,
35906,
368,
341,
286,
1077,
5206,
7745,
8467,
284,
14563,
8070,
1972,
486,
2258,
543,
286,
7745,
8467,
1364,
25730,
5304,
17153,
6600,
626,
286,
1077,
5206,
1584,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_query_inline_fragments_human() {
let doc = r#"
query InlineFragments {
hero(episode: EMPIRE) {
name
__typename
}
}
"#;
let database = Database::new();
let schema = RootNode::new(&database, EmptyMutation::<Database>::new());
assert_eq!(
::execute(doc, None, &schema, &Variables::new(), &database),
Ok((
Value::object(
vec![(
"hero",
Value::object(
vec![
("name", Value::string("Luke Skywalker")),
("__typename", Value::string("Human")),
].into_iter()
.collect(),
),
)].into_iter()
.collect()
),
vec![]
))
);
} | rust_cleaned_test_functions.jsonl/35473 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 580
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5738,
41871,
761,
41956,
86247,
368,
341,
262,
1077,
4629,
284,
435,
2,
698,
286,
3239,
54235,
37,
41956,
341,
310,
11821,
7,
39291,
25,
16902,
1893,
787,
8,
341,
394,
829,
198,
394,
1304,
903... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_clone() {
let context = Context::create();
let module = context.create_module("mod");
let void_type = context.void_type();
let fn_type = void_type.fn_type(&[], false);
let f = module.add_function("f", fn_type, None);
let basic_block = f.append_basic_block("entry");
let builder = context.create_builder();
builder.position_at_end(&basic_block);
builder.build_return(None);
let module2 = module.clone();
assert_ne!(module, module2);
assert_eq!(module.print_to_string(), module2.print_to_string());
} | rust_cleaned_test_functions.jsonl/63544 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 214
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54742,
368,
341,
262,
1077,
2266,
284,
9608,
486,
3182,
543,
262,
1077,
4688,
284,
2266,
2520,
10750,
445,
2593,
797,
262,
1077,
737,
1819,
284,
2266,
13,
1004,
1819,
543,
262,
1077,
5168,
1819,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_request_channel() {
let f = RequestChannel::builder(1234, 0)
.set_initial_request_n(1)
.set_data(Bytes::from("Hello World!"))
.set_metadata(Bytes::from("foobar"))
.build();
try_codec(f);
} | rust_cleaned_test_functions.jsonl/41413 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 120
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7893,
14571,
368,
341,
262,
1077,
282,
284,
6145,
9629,
486,
17850,
7,
16,
17,
18,
19,
11,
220,
15,
340,
286,
659,
746,
15809,
7893,
1089,
7,
16,
340,
286,
659,
746,
1769,
76423,
486,
1499,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sub() {
let a = Int32Array::from(&[None, Some(6), None, Some(6)]);
let b = Int32Array::from(&[Some(5), None, None, Some(6)]);
let result = sub(&a, &b).unwrap();
let expected = Int32Array::from(&[None, None, None, Some(0)]);
assert_eq!(result, expected);
// Trait testing
let result = a.sub(&b).unwrap();
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/23353 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5228,
368,
341,
286,
1077,
264,
284,
1333,
18,
17,
1857,
486,
1499,
2099,
58,
4064,
11,
4329,
7,
21,
701,
2240,
11,
4329,
7,
21,
41958,
286,
1077,
293,
284,
1333,
18,
17,
1857,
486,
1499,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_share_unvault_signatures() {
let mut unvault =
UnvaultTransaction::from_psbt_str("cHNidP8BAIkCAAAAAajRZE5yVgzG9McmOyy/WdcYdrGrK15bB5N/Hg8zhKOkAQAAAAD9////ArhhpDUAAAAAIgAgFZlOQkpDkFSsLUfyeMGVAOT3T88jZM7L/XlVZoJ2jnAwdQAAAAAAACIAILKCCA/RbV3QMPMrwwQmk4Ark4w1WyElM27WtBgftq6ZAAAAAAABASsA6aQ1AAAAACIAIPQJ3LCGXPIO5iXX0/Yp3wHlpao7cQbPd4q3gxp0J/w2AQMEAQAAAAEFR1IhA47+JRqdt+oloFosla9hWUYVf5YQKDbuq4KO13JS45KgIQMKcLWzABxb/9YBQe+bJRW3v3om8S2LNMGUKSp5K+PQ+1KuIgYCEnb0lxeNI9466wDX+tqlq23zYNacTlLVLLLxtcVobG0INaO2mQoAAAAAAQGpIQMVlEoh50lasMhcdwnrmnCp2ROlGY5CrH+HtxQmfZDZ06xRh2R2qRS/INUX1CaP7Pbn5GmtGYu2wgqjnIisa3apFO/kceq8yo9w69g4VVtlFAf739qTiKxsk1KHZ1IhAnddfXi3N38A+aEQ74sUdeuV7sg+2L3ijTjMHMEAfq3cIQLWP96FqjfC5qKQkC2WhYbbLJx1FbNSAjsnMfwDnK0jD1KvARKyaCICAhJ29JcXjSPeOusA1/rapatt82DWnE5S1Syy8bXFaGxtCDWjtpkKAAAAAAEBJSEDjv4lGp236iWgWiyVr2FZRhV/lhAoNu6rgo7XclLjkqCsUYciAgISdvSXF40j3jrrANf62qWrbfNg1pxOUtUssvG1xWhsbQg1o7aZCgAAAAA=").unwrap();
let ctx = secp256k1::Secp256k1::new();
let (privkey, public_key) = create_keys(&ctx, &[1; secp256k1::constants::SECRET_KEY_SIZE]);
let signature_hash =
secp256k1::Message::from_slice(&unvault.signature_hash(0, SigHashType::All).unwrap())
.unwrap();
let signature = ctx.sign(&signature_hash, &privkey.key);
unvault
.add_signature(0, public_key.key, signature.clone(), &ctx)
.unwrap();
let other_unvault = unvault.clone();
let db_unvault = DbTransaction {
id: 0,
vault_id: 0,
tx_type: TransactionType::Unvault,
psbt: RevaultTx::Unvault(unvault),
is_fully_signed: false,
};
let ((client_pubkey, client_privkey), (server_pubkey, server_privkey)) =
(gen_keypair(), gen_keypair());
let listener = TcpListener::bind("127.0.0.1:0").unwrap();
let addr = listener.local_addr().unwrap();
// client thread
let cli_thread = thread::spawn(move || {
share_unvault_signatures(addr, &client_privkey, &server_pubkey, &db_unvault).unwrap();
});
let mut server_transport =
KKTransport::accept(&listener, &server_privkey, &[client_pubkey])
.expect("Server channel binding and accepting");
server_transport
.read_req(|params| {
assert_eq!(
¶ms,
&message::RequestParams::CoordSig(coordinator::Sig {
pubkey: public_key.key,
signature,
id: other_unvault.txid(),
}),
);
Some(message::ResponseResult::Sig(
message::coordinator::SigResult { ack: true },
))
})
.unwrap();
cli_thread.join().unwrap();
} | rust_cleaned_test_functions.jsonl/92903 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1705
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38272,
4907,
82983,
11172,
2789,
368,
341,
286,
1077,
5206,
650,
82983,
4035,
394,
1230,
82983,
8070,
486,
1499,
26047,
12755,
2895,
445,
66,
43165,
307,
47,
23,
7064,
55262,
5049,
25699,
1630,
49... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_introduce_var_in_match_arm_with_block() {
check_assist_range(
introduce_variable,
"
fn main() {
let x = true;
let tuple = match x {
true => {
let y = 1;
(<|>2 + y<|>, true)
}
_ => (0, false)
};
}
",
"
fn main() {
let x = true;
let tuple = match x {
true => {
let y = 1;
let <|>var_name = 2 + y;
(var_name, true)
}
_ => (0, false)
};
}
",
);
} | rust_cleaned_test_functions.jsonl/5713 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 337
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4042,
47845,
4612,
1243,
10708,
34680,
6615,
7113,
368,
341,
286,
1779,
12083,
380,
9698,
1006,
310,
19131,
14635,
345,
310,
6228,
8822,
1887,
368,
341,
262,
1077,
856,
284,
830,
280,
262,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bomb_enemy() {
let matrix = vec![
vec!['0','E','0','0'],
vec!['E','0','W','E'],
vec!['0','E','0','0']
];
assert_eq!(Solution::max_killed_enemies(matrix), 3);
} | rust_cleaned_test_functions.jsonl/4905 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 145
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
2855,
73682,
368,
341,
286,
1077,
6172,
284,
7486,
90515,
310,
7486,
0,
677,
15,
1844,
36,
1844,
15,
1844,
15,
4380,
310,
7486,
0,
677,
36,
1844,
15,
1844,
54,
1844,
36,
4380,
310,
7486... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_all_field_names() {
println!("asdas");
let path_to_test_avro = Path::new("./test_assets/bttf.avro").to_str().unwrap().to_owned();
let cli = CliService::from(path_to_test_avro, None);
let field_names = cli.get_all_field_names();
assert_eq!(field_names, vec!["firstName", "lastName", "age"]);
} | rust_cleaned_test_functions.jsonl/19654 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 179
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
5705,
5013,
9187,
368,
972,
286,
13751,
17223,
300,
34889,
2815,
286,
1077,
1815,
2346,
4452,
26173,
299,
284,
7933,
486,
931,
13988,
1944,
53299,
3470,
5566,
69,
40506,
299,
1827,
983,
2895... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_boolean_min_max_all_null() {
let a = BooleanArray::from(&[None, None]);
assert_eq!(None, min_boolean(&a));
assert_eq!(None, max_boolean(&a));
} | rust_cleaned_test_functions.jsonl/112097 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 81
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46642,
7260,
6345,
5705,
15162,
368,
341,
262,
1077,
264,
284,
6992,
1857,
486,
1499,
2099,
58,
4064,
11,
2240,
2558,
262,
2060,
10714,
10297,
4064,
11,
1308,
46642,
2099,
64,
1106,
262,
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 |
#[test]
fn test_bisect() {
let block = Block {
keys: vec![
Key {
inner: vec![0, -1, 1],
},
Key {
inner: vec![1, 0, 2, 2],
},
Key {
inner: vec![1, 1, 0],
},
Key {
inner: vec![1, 1, 0],
},
Key {
inner: vec![2, 0, -1],
},
Key { inner: vec![2, 1] },
],
};
let collator = Collator::<i32>::default();
assert!(collator.is_sorted(&block));
assert_eq!(collator.bisect_left(&block, &[0, 0, 0]), 1);
assert_eq!(collator.bisect_right(&block, &[0, 0, 0]), 1);
assert_eq!(collator.bisect_left(&block, &[0]), 0);
assert_eq!(collator.bisect_right(&block, &[0]), 1);
assert_eq!(collator.bisect_left(&block, &[1]), 1);
assert_eq!(collator.bisect_right(&block, &[1]), 4);
assert_eq!(collator.bisect_left(&block, &[1, 1, 0]), 2);
assert_eq!(collator.bisect_right(&block, &[1, 1, 0]), 4);
assert_eq!(collator.bisect_left(&block, &[1, 1, 0, -1]), 2);
assert_eq!(collator.bisect_right(&block, &[1, 1, 0, -1]), 4);
assert_eq!(collator.bisect_right(&block, &[1, 1, 0, 1]), 4);
assert_eq!(collator.bisect_left(&block, &[3]), 6);
assert_eq!(collator.bisect_right(&block, &[3]), 6);
} | rust_cleaned_test_functions.jsonl/43368 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 893
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
285,
439,
368,
341,
286,
1077,
2504,
284,
8362,
341,
310,
6894,
25,
7486,
90515,
394,
5309,
341,
503,
9179,
25,
7486,
20703,
15,
11,
481,
16,
11,
220,
16,
1259,
394,
1153,
394,
5309,
34... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_product() {
let two = Mat2::identity() + Mat2::identity();
assert_eq!(vec![two, two].iter().product::<Mat2>(), two * two);
} | rust_cleaned_test_functions.jsonl/13476 | {
"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,
9840,
368,
341,
262,
1077,
1378,
284,
6867,
17,
486,
16912,
368,
488,
6867,
17,
486,
16912,
543,
262,
2060,
10714,
10297,
4083,
20703,
19789,
11,
1378,
936,
2015,
1005,
3031,
27638,
11575,
17,
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 |
#[test]
fn test_new_collation_unique_int_handle_index() {
const TABLE_ID: i64 = 3;
const INDEX_ID: i64 = 42;
let columns_info = vec![
{
let mut ci = ColumnInfo::default();
ci.set_column_id(1);
ci.as_mut_accessor().set_tp(FieldTypeTp::LongLong);
ci
},
{
let mut ci = ColumnInfo::default();
ci.set_column_id(2);
ci.as_mut_accessor().set_tp(FieldTypeTp::Double);
ci
},
{
let mut ci = ColumnInfo::default();
ci.set_column_id(3);
ci.set_pk_handle(true);
ci.as_mut_accessor().set_tp(FieldTypeTp::LongLong);
ci
},
];
let schema: Vec<FieldType> = vec![
FieldTypeTp::LongLong.into(),
FieldTypeTp::Double.into(),
FieldTypeTp::LongLong.into(),
];
let columns = vec![Column::new(1, 2), Column::new(2, 3.0), Column::new(3, 4)];
let datums = vec![Datum::U64(2), Datum::F64(3.0), Datum::U64(4)];
let index_data = datum::encode_key(&mut EvalContext::default(), &datums[0..2]).unwrap();
let key = table::encode_index_seek_key(TABLE_ID, INDEX_ID, &index_data);
let mut restore_data = vec![];
restore_data
.write_row(&mut EvalContext::default(), columns)
.unwrap();
let mut value = vec![8];
value.extend(restore_data);
value
.write_u64(datums[2].as_int().unwrap().unwrap() as u64)
.unwrap();
let key_ranges = vec![{
let mut range = KeyRange::default();
let start_key = key.clone();
range.set_start(start_key);
range.set_end(range.get_start().to_vec());
convert_to_prefix_next(range.mut_end());
range
}];
let store = FixtureStorage::from(vec![(key, value)]);
let mut executor = BatchIndexScanExecutor::new(
store,
Arc::new(EvalConfig::default()),
columns_info,
key_ranges,
0,
false,
true,
false,
)
.unwrap();
let mut result = executor.next_batch(10);
assert!(result.is_drained.as_ref().unwrap());
assert_eq!(result.physical_columns.columns_len(), 3);
assert_eq!(result.physical_columns.rows_len(), 1);
assert!(result.physical_columns[0].is_raw());
result.physical_columns[0]
.ensure_all_decoded_for_test(&mut EvalContext::default(), &schema[0])
.unwrap();
assert_eq!(
result.physical_columns[0].decoded().to_int_vec(),
&[Some(2)]
);
assert!(result.physical_columns[1].is_raw());
result.physical_columns[1]
.ensure_all_decoded_for_test(&mut EvalContext::default(), &schema[1])
.unwrap();
assert_eq!(
result.physical_columns[1].decoded().to_real_vec(),
&[Real::new(3.0).ok()]
);
assert!(result.physical_columns[2].is_decoded());
assert_eq!(
result.physical_columns[2].decoded().to_int_vec(),
&[Some(4)]
);
} | rust_cleaned_test_functions.jsonl/12232 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1837
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
43597,
367,
21218,
4042,
10630,
3560,
368,
341,
286,
733,
14363,
3450,
25,
600,
21,
19,
284,
220,
18,
280,
286,
733,
39300,
3450,
25,
600,
21,
19,
284,
220,
19,
17,
280,
286,
1077,
814... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_buf_reader() {
use self::Token::*;
let mut r = BufReader::new(b"(\"abc\" \"ab\\\"c\" abc abc_def abc-def abc123 123 123.456 1.23e-10 -1i32 123u32 0b1111u8 0x123u32 123i32 3.14f32 3.14f64 0x0 0xf 0b100 0b101)");
assert_eq!(r.read(),Some(DocStart("")));
assert_eq!(r.read(),Some(ListStart("(")));
assert_eq!(r.read(),Some(String("\"abc\"")));
assert_eq!(r.read(),Some(WhiteSpace(" ")));
assert_eq!(r.read(),Some(String("\"ab\\\"c\"")));
assert_eq!(r.read(),Some(WhiteSpace(" ")));
assert_eq!(r.read(),Some(Symbol("abc")));
assert_eq!(r.read(),Some(WhiteSpace(" ")));
assert_eq!(r.read(),Some(Symbol("abc_def")));
assert_eq!(r.read(),Some(WhiteSpace(" ")));
assert_eq!(r.read(),Some(Symbol("abc-def")));
assert_eq!(r.read(),Some(WhiteSpace(" ")));
assert_eq!(r.read(),Some(Symbol("abc123")));
assert_eq!(r.read(),Some(WhiteSpace(" ")));
assert_eq!(r.read(),Some(Number("123")));
assert_eq!(r.read(),Some(WhiteSpace(" ")));
assert_eq!(r.read(),Some(Number("123.456")));
assert_eq!(r.read(),Some(WhiteSpace(" ")));
assert_eq!(r.read(),Some(Number("1.23e-10")));
assert_eq!(r.read(),Some(WhiteSpace(" ")));
assert_eq!(r.read(),Some(I32("-1i32", -1)));
assert_eq!(r.read(),Some(WhiteSpace(" ")));
assert_eq!(r.read(),Some(U32("123u32", 123)));
assert_eq!(r.read(),Some(WhiteSpace(" ")));
assert_eq!(r.read(),Some(U8("0b1111u8", 0b1111)));
assert_eq!(r.read(),Some(WhiteSpace(" ")));
assert_eq!(r.read(),Some(U32("0x123u32", 0x123)));
assert_eq!(r.read(),Some(WhiteSpace(" ")));
assert_eq!(r.read(),Some(I32("123i32", 123)));
assert_eq!(r.read(),Some(WhiteSpace(" ")));
assert_eq!(r.read(),Some(F32("3.14f32", 3.14f32)));
assert_eq!(r.read(),Some(WhiteSpace(" ")));
assert_eq!(r.read(),Some(F64("3.14f64", 3.14f64)));
assert_eq!(r.read(),Some(WhiteSpace(" ")));
assert_eq!(r.read(),Some(Number("0x0")));
assert_eq!(r.read(),Some(WhiteSpace(" ")));
assert_eq!(r.read(),Some(Number("0xf")));
assert_eq!(r.read(),Some(WhiteSpace(" ")));
assert_eq!(r.read(),Some(Number("0b100")));
assert_eq!(r.read(),Some(WhiteSpace(" ")));
assert_eq!(r.read(),Some(Number("0b101")));
assert_eq!(r.read(),Some(ListEnd(")")));
assert_eq!(r.read(),Some(DocEnd("")));
} | rust_cleaned_test_functions.jsonl/95949 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1330
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10363,
22306,
368,
341,
286,
990,
656,
486,
3323,
56162,
286,
1077,
5206,
435,
284,
69013,
5062,
486,
931,
1883,
29209,
2105,
13683,
2105,
7245,
370,
3422,
2105,
66,
2105,
39022,
39022,
7844,
3902... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_element_len() {
let source = [0x40, 0x01, 0xFF];
assert_eq!(element_len(&source[..]), Ok((&source[2..], Some(1))));
} | rust_cleaned_test_functions.jsonl/6828 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7894,
6043,
368,
341,
310,
1077,
2530,
284,
508,
15,
87,
19,
15,
11,
220,
15,
87,
15,
16,
11,
220,
15,
9264,
935,
310,
2060,
10714,
10297,
6101,
6043,
2099,
2427,
95874,
9719,
7622,
42902,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_parse_text_1() {
let s = "just \x02\x1d\x1f\x1e\x11\x04rrggbb\x16\x0f testing";
let mut parser = parse_irc_formatting(s);
assert_eq!(parser.next(), Some(IrcFormatEvent::Text("just ")));
assert_eq!(parser.next(), Some(IrcFormatEvent::Bold));
assert_eq!(parser.next(), Some(IrcFormatEvent::Italic));
assert_eq!(parser.next(), Some(IrcFormatEvent::Underline));
assert_eq!(parser.next(), Some(IrcFormatEvent::Strikethrough));
assert_eq!(parser.next(), Some(IrcFormatEvent::Monospace));
assert_eq!(parser.next(), Some(IrcFormatEvent::ReverseColor));
assert_eq!(parser.next(), Some(IrcFormatEvent::Reset));
assert_eq!(parser.next(), Some(IrcFormatEvent::Text(" testing")));
assert_eq!(parser.next(), None);
} | rust_cleaned_test_functions.jsonl/6837 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 314
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
4326,
62,
16,
368,
341,
262,
1077,
274,
284,
330,
4250,
1124,
87,
15,
17,
3462,
16,
67,
3462,
16,
69,
3462,
16,
68,
3462,
16,
16,
3462,
15,
19,
634,
14398,
6066,
3462,
16,
21,
3462,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_merge_deleted_in_ours_and_modified_in_theirs() -> BitResult<()> {
BitRepo::with_minimal_repo(|repo| {
let ours = commit! {};
let theirs = commit! {
foo < "modified"
};
let conflicts = repo.three_way_merge(ours, theirs)?.into_conflicts();
assert_eq!(conflicts[0], Conflict::new_with_type(p!("foo"), ConflictType::DeleteModify));
Ok(())
})
} | rust_cleaned_test_functions.jsonl/94157 | {
"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,
20888,
39418,
1243,
62,
2471,
8378,
37749,
1243,
16068,
16838,
368,
1464,
6495,
2077,
71698,
341,
262,
6495,
25243,
486,
4197,
7260,
2861,
37784,
22428,
23476,
91,
341,
286,
1077,
11350,
284,
5266,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_band_is_fully_inside() {
let x = b"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGGGGGGGGGGGGGGGGGGGG\
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
let y = b"TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTGGGGGGGGGGGGGGGGGGGG\
TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT";
compare_to_full_alignment_local(x, y);
compare_to_full_alignment_global(x, y);
compare_to_full_alignment_semiglobal(x, y);
} | rust_cleaned_test_functions.jsonl/126738 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 206
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45344,
6892,
761,
21965,
72860,
368,
341,
286,
1077,
856,
284,
293,
1,
57905,
57905,
57905,
57905,
57905,
1890,
22254,
22254,
22254,
22254,
22254,
22254,
22254,
22254,
22254,
38,
5661,
286,
362,
579... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invalid_card() {
assert_eq!(
parse_freecells("KD XX 8H"),
Err("Could not parse freecells: \"KD XX 8H\"".to_string())
);
} | rust_cleaned_test_functions.jsonl/3206 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 83
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
16888,
368,
341,
262,
2060,
10714,
33673,
286,
4715,
74179,
757,
6436,
445,
89609,
29288,
220,
23,
39,
4461,
286,
15495,
445,
12895,
537,
4715,
3457,
757,
6436,
25,
7245,
89609,
29288,
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 |
#[test]
fn test_long_line_topo_sort() {
let mut graph: RouteGraph<S, R> = RouteGraphBuilder::new().with_buffer_size(32).build();
let f = graph.add_node_with_idx(|id| create_node(id, vec![]));
let e = graph.add_node_with_idx(|id| create_node(id, vec![f]));
let d = graph.add_node_with_idx(|id| create_node(id, vec![e]));
let c = graph.add_node_with_idx(|id| create_node(id, vec![d]));
let b = graph.add_node_with_idx(|id| create_node(id, vec![c]));
let a = graph.add_node_with_idx(|id| create_node(id, vec![b]));
assert_eq!(graph.has_cycles(), true);
assert_eq!(graph.ordering.clone(), vec![f, e, d, c, b, a]);
graph.topographic_sort();
assert_eq!(graph.has_cycles(), false);
assert_eq!(graph.ordering.clone(), vec![a, b, c, d, e, f,]);
} | rust_cleaned_test_functions.jsonl/72326 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 412
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17799,
6528,
10426,
78,
18435,
368,
341,
286,
1077,
5206,
4771,
25,
9572,
11212,
18858,
11,
431,
29,
284,
9572,
11212,
3297,
486,
931,
1005,
4197,
7776,
2368,
7,
18,
17,
568,
5834,
1428,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sizes() {
if cfg!(target_pointer_width = "64") {
assert_eq!(mem::size_of::<Format>(), 208);
} else {
assert_eq!(mem::size_of::<Format>(), 204);
}
if cfg!(target_pointer_width = "64") {
assert_eq!(mem::size_of::<Buffer>(), 88);
} else {
assert_eq!(mem::size_of::<Buffer>(), 68);
}
assert_eq!(mem::size_of::<StreamParm>(), 204);
assert_eq!(mem::size_of::<FmtDesc>(), 64);
assert_eq!(mem::size_of::<Frmsizeenum>(), 44);
assert_eq!(mem::size_of::<Frmivalenum>(), 52);
assert_eq!(mem::size_of::<QueryCtrl>(), 68);
assert_eq!(mem::size_of::<QueryExtCtrl>(), 232);
assert_eq!(mem::size_of::<QueryMenu>(), 44);
assert_eq!(mem::size_of::<Control>(), 8);
assert_eq!(mem::size_of::<ExtControl>(), 20);
if cfg!(target_pointer_width = "64") {
assert_eq!(mem::size_of::<ExtControls>(), 32);
} else {
assert_eq!(mem::size_of::<ExtControls>(), 24);
}
} | rust_cleaned_test_functions.jsonl/117913 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 471
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32159,
368,
341,
262,
421,
13286,
10297,
5657,
21425,
7927,
284,
330,
21,
19,
899,
341,
286,
2060,
10714,
10297,
10536,
486,
2141,
3575,
27638,
4061,
39019,
220,
17,
15,
23,
317,
262,
335,
770,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_case_7() {
let key = "cc53599f40d6c8348c353b00172655236cddcd1879ca1f04b35f91adab70b81f";
let nonce = "504035fc169964a5ae985e6c11b0b7bb";
let expected_output =
"11dda56dce88c92641177e2a6e21b11c5ca794912b3bceb9ccb375c87bcc7968";
hchacha_test_runner(key, nonce, expected_output);
} | rust_cleaned_test_functions.jsonl/44669 | {
"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,
19096,
62,
22,
368,
341,
310,
1077,
1376,
284,
330,
638,
20,
18,
20,
24,
24,
69,
19,
15,
67,
21,
66,
23,
18,
19,
23,
66,
18,
20,
18,
65,
15,
15,
16,
22,
17,
21,
20,
20,
17,
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_discard() {
init();
let p = seq(b"abc").discard();
let result = p.parse_as_result(b"abc");
assert!(result.is_ok());
let result = p.parse_as_result(b"def");
assert!(result.is_err());
} | rust_cleaned_test_functions.jsonl/16804 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37745,
567,
368,
341,
262,
2930,
543,
262,
1077,
281,
284,
12981,
1883,
1,
13683,
1827,
76492,
1428,
262,
1077,
1102,
284,
281,
4632,
11898,
5287,
1883,
1,
13683,
797,
262,
2060,
10297,
1382,
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_part_1() {
let input = "5483143223
2745854711
5264556173
6141336146
6357385478
4167524645
2176841721
6882881134
4846848554
5283751526";
assert_eq!(part1(input), 1656);
} | rust_cleaned_test_functions.jsonl/106424 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 108
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10495,
62,
16,
368,
341,
286,
1077,
1946,
284,
330,
20,
19,
23,
18,
16,
19,
18,
17,
17,
18,
198,
17,
22,
19,
20,
23,
20,
19,
22,
16,
16,
198,
20,
17,
21,
19,
20,
20,
21,
16,
22,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serde() -> Result<()> {
let ca = UInt32Chunked::new_from_opt_slice("foo", &[Some(1), None, Some(2)]);
let json = serde_json::to_string(&ca).unwrap();
dbg!(&json);
let out = serde_json::from_str::<Series>(&json).unwrap();
assert!(ca.into_series().series_equal_missing(&out));
let ca = Utf8Chunked::new_from_opt_slice("foo", &[Some("foo"), None, Some("bar")]);
let json = serde_json::to_string(&ca).unwrap();
dbg!(&json);
let out = serde_json::from_str::<Series>(&json).unwrap();
assert!(ca.into_series().series_equal_missing(&out));
Ok(())
} | rust_cleaned_test_functions.jsonl/49038 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 307
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75861,
450,
368,
1464,
5714,
71698,
341,
286,
1077,
2162,
284,
22275,
18,
17,
28304,
291,
486,
931,
5673,
15032,
26488,
445,
7975,
497,
44590,
8373,
7,
16,
701,
2240,
11,
4329,
7,
17,
7252,
62... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cellbase_with_address_codec() {
let address = String::from("ckt1qyqd5eyygtdmwdr7ge736zw6z0ju6wsw7rssu8fcve");
let cellbase = CellbaseCkb::new(
RationalU256::new(mock_u256(), mock_u256()),
Capacity::shannons(random::<u64>()),
);
let cellbase_addr = CellbaseWithAddress::new(address, cellbase);
let bytes = bincode::serialize(&cellbase_addr).unwrap();
assert_eq!(
bincode::deserialize::<CellbaseWithAddress>(&bytes).unwrap(),
cellbase_addr
);
} | rust_cleaned_test_functions.jsonl/130625 | {
"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,
16648,
3152,
6615,
6744,
51084,
368,
341,
286,
1077,
2621,
284,
923,
486,
1499,
445,
68412,
16,
80,
88,
76727,
20,
1195,
48765,
1296,
44128,
3612,
22,
709,
22,
18,
21,
30781,
21,
89,
15,
8613,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unknown_token() {
use Token::*;
let (tokens, maybe_error) = tokenize_string("add strange");
assert_eq!(tokens, vec![Add]);
assert_eq!(maybe_error.unwrap().kind(), ErrorKind::InvalidData);
} | rust_cleaned_test_functions.jsonl/78239 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57507,
6458,
368,
341,
286,
990,
9660,
56162,
286,
1077,
320,
30566,
11,
7196,
4096,
8,
284,
77651,
3904,
445,
718,
14888,
797,
286,
2060,
10714,
10297,
30566,
11,
7486,
20703,
2212,
2558,
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 |
#[test]
fn test_puzzle_with_four_letters() {
assert_alphametic_solution_eq("AS + A == MOM", &[('A', 9), ('S', 2), ('M', 1), ('O', 0)]);
} | rust_cleaned_test_functions.jsonl/60612 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 71
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
14945,
6615,
56142,
67330,
368,
341,
262,
2060,
8418,
759,
309,
5298,
50274,
10714,
445,
1911,
488,
362,
621,
92972,
497,
44590,
492,
32,
516,
220,
24,
701,
4319,
50,
516,
220,
17,
701,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_network_type_parsing_failure() -> Result<()> {
let ipv6: IpAddr = "fe80::a3:6ff:fec4:5454".parse().unwrap();
let tests = vec![("invalid network", "junkNetwork", ipv6)];
for (name, in_network, in_ip) in tests {
let result = determine_network_type(in_network, &in_ip);
assert!(
result.is_err(),
"NetworkTypeParsing should fail: '{}' -- input:{}",
name,
in_network,
);
}
Ok(())
} | rust_cleaned_test_functions.jsonl/89875 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 249
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20966,
1819,
620,
28598,
43618,
368,
1464,
5714,
71698,
341,
262,
1077,
45475,
21,
25,
35033,
13986,
284,
330,
1859,
23,
15,
486,
64,
18,
25,
21,
542,
55477,
757,
19,
25,
20,
19,
20,
19,
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... | 2 |
#[test]
fn test_trypic() {
assert!(gen_peptide("-.KMDKDK.-").tryptic());
assert!(!gen_peptide("S.KMDKDK.-").tryptic());
assert!(gen_peptide("R.TLDGFK*K.F").tryptic());
assert!(!gen_peptide("K.KMDKDT.A").tryptic());
} | rust_cleaned_test_functions.jsonl/131399 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3547,
1082,
292,
368,
341,
286,
2060,
10297,
4370,
36367,
46209,
13645,
13,
42,
6076,
42,
18301,
12612,
1827,
1539,
26235,
1423,
286,
2060,
0,
3471,
4370,
36367,
46209,
445,
50,
11352,
6076,
42,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sleep() {
let point = FailPoint::new();
let timer = Instant::now();
point.set_actions("", vec![Action::new(Task::Sleep(1000), 1.0, None)]);
assert!(point.eval("test_fail_point_sleep").is_none());
assert!(timer.elapsed() > Duration::from_millis(1000));
} | rust_cleaned_test_functions.jsonl/18297 | {
"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,
49393,
368,
341,
286,
1077,
1459,
284,
39645,
2609,
486,
931,
543,
286,
1077,
9021,
284,
18058,
486,
3328,
543,
286,
1459,
980,
25368,
19814,
7486,
20703,
2512,
486,
931,
47531,
486,
41745,
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... | 1 |
#[test]
fn test_problem_id_display() {
assert_eq!(&ProblemId::from("A").to_string(), "A");
assert_eq!(&ProblemId::from("a").to_string(), "A");
} | rust_cleaned_test_functions.jsonl/29178 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 80
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60139,
842,
14825,
368,
341,
286,
2060,
10714,
0,
2099,
31198,
764,
486,
1499,
445,
32,
1827,
983,
3904,
1507,
330,
32,
797,
286,
2060,
10714,
0,
2099,
31198,
764,
486,
1499,
445,
64,
1827,
98... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_local_maxima() {
let ts = vec![
// Suppress vertically
T::new(0, 0, 8f32),
T::new(0, 3, 10f32),
T::new(0, 6, 9f32),
// Suppress horizontally
T::new(5, 5, 10f32),
T::new(7, 5, 15f32),
// Tiebreak
T::new(12, 20, 10f32),
T::new(13, 20, 10f32),
T::new(13, 21, 10f32),
];
let expected = vec![
T::new(0, 3, 10f32),
T::new(7, 5, 15f32),
T::new(12, 20, 10f32),
];
let max = local_maxima(&ts, 3);
assert_eq!(max, expected);
} | rust_cleaned_test_functions.jsonl/47922 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 419
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13564,
6345,
7523,
368,
341,
286,
1077,
10591,
284,
7486,
90515,
310,
442,
86798,
50935,
198,
310,
350,
486,
931,
7,
15,
11,
220,
15,
11,
220,
23,
69,
18,
17,
1326,
310,
350,
486,
931,
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_key_manager_create_get_delete() {
let (_tmp, manager) = new_tmp_key_manager(None, None, None, None);
let mut manager = manager.unwrap().unwrap();
let new_file = manager.new_file("foo").unwrap();
let get_file = manager.get_file("foo").unwrap();
assert_eq!(new_file, get_file);
manager.delete_file("foo").unwrap();
manager.delete_file("foo").unwrap_err();
manager.delete_file("foo1").unwrap_err();
// Must be plaintext if file not found.
let file = manager.get_file("foo").unwrap();
assert_eq!(file.method, DBEncryptionMethod::Plaintext);
manager.method = EncryptionMethod::Aes192Ctr;
let file1 = manager.new_file("foo").unwrap();
assert_ne!(file, file1);
// Must fail if key is specified but not found.
let mut file = FileInfo::default();
file.method = EncryptionMethod::Aes192Ctr as _;
file.key_id = 7; // Not exists.
manager
.dicts
.write()
.unwrap()
.file_dict
.files
.insert("foo".to_owned(), file);
manager.get_file("foo").unwrap_err();
} | rust_cleaned_test_functions.jsonl/32262 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 550
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3097,
12144,
8657,
3062,
11353,
368,
341,
286,
1077,
5453,
5173,
11,
6645,
8,
284,
501,
16125,
3097,
12144,
26717,
11,
2240,
11,
2240,
11,
2240,
317,
286,
1077,
5206,
6645,
284,
6645,
55395,
100... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_finished_exercise() {
let exercise = Exercise {
name: "finished_exercise".into(),
path: PathBuf::from("tests/fixture/state/finished_exercise.rs"),
mode: Mode::Compile,
hint: String::new(),
};
assert_eq!(exercise.state(), State::Done);
} | rust_cleaned_test_functions.jsonl/75651 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 162
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56423,
2702,
18359,
368,
341,
286,
1077,
10158,
284,
32818,
341,
310,
829,
25,
330,
12129,
2702,
18359,
3263,
18122,
3148,
310,
1815,
25,
7933,
15064,
486,
1499,
445,
23841,
14,
59612,
63796,
14,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_state_proof() {
let address = format!("0.0.0.0:{}", utils::get_available_port());
let _runtime = bootstrap(
address.parse().unwrap(),
Arc::new(mock_db(vec![])),
channel(1024).0,
);
let client = reqwest::blocking::Client::new();
let url = format!("http://{}", address);
let version = 10;
let request = serde_json::json!({"jsonrpc": "2.0", "method": "get_state_proof", "params": [version], "id": 1});
let resp = client.post(&url).json(&request).send().unwrap();
let proof: StateProofView = fetch_data(resp);
let li: LedgerInfoWithSignatures =
lcs::from_bytes(&proof.ledger_info_with_signatures.into_bytes().unwrap()).unwrap();
assert_eq!(li.ledger_info().version(), version);
} | rust_cleaned_test_functions.jsonl/86602 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 318
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
4387,
86757,
368,
341,
262,
1077,
2621,
284,
3561,
17223,
15,
13,
15,
13,
15,
13,
15,
25,
42351,
12439,
486,
455,
26962,
8716,
1423,
262,
1077,
716,
22255,
284,
26925,
1006,
286,
2621,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eq() -> Result<(), TestingError> {
VMTestRunner::new()
.add(PushConst::new_field(1.into()))
.add(PushConst::new_field(2.into()))
.add(Eq)
.add(PushConst::new_field(2.into()))
.add(PushConst::new_field(2.into()))
.add(Eq)
.add(PushConst::new_field(2.into()))
.add(PushConst::new_field(1.into()))
.add(Eq)
.test(&[0, 1, 0])
} | rust_cleaned_test_functions.jsonl/27397 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 282
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10714,
368,
1464,
5714,
68843,
26768,
1454,
29,
341,
286,
17792,
2271,
19486,
486,
931,
741,
310,
659,
718,
5304,
1116,
19167,
486,
931,
5013,
7,
16,
39860,
12145,
310,
659,
718,
5304,
1116,
191... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_push_next() {
let mut ll = LinkedList::<u8>::new();
let node1 = ll.push_head(1);
let node2 = ll.push_head(2);
let node3 = ll.push_head(3);
let n_node1 = ll.push_next(&node1, 11).unwrap();
assert_node!(ll, n_node1, LAST, 11, 4);
assert_order!(ll, node1, 1, n_node1, 11);
assert_order!(ll, node2, 2, node1, 1);
assert_order!(ll, node3, 3, node2, 2);
let n_node2 = ll.push_next(&node2, 22).unwrap();
assert_node!(ll, n_node2, MIDDLE, 22, 5);
assert_order!(ll, node1, 1, n_node1, 11);
assert_order!(ll, n_node2, 22, node1, 1);
assert_order!(ll, node2, 2, n_node2, 22);
assert_order!(ll, node3, 3, node2, 2);
let n_node3 = ll.push_next(&node3, 33).unwrap();
assert_node!(ll, n_node3, MIDDLE, 33, 6);
assert_order!(ll, node1, 1, n_node1, 11);
assert_order!(ll, n_node2, 22, node1, 1);
assert_order!(ll, node2, 2, n_node2, 22);
assert_order!(ll, n_node3, 33, node2, 2);
assert_order!(ll, node3, 3, n_node3, 33);
} | rust_cleaned_test_functions.jsonl/59894 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 591
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14218,
11257,
368,
341,
286,
1077,
5206,
9323,
284,
22917,
27638,
84,
23,
6831,
931,
543,
286,
1077,
2436,
16,
284,
9323,
2552,
13138,
7,
16,
317,
286,
1077,
2436,
17,
284,
9323,
2552,
13138,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vec_into_dict() {
let gil = Python::acquire_gil();
let py = gil.python();
let vec = vec![("a", 1), ("b", 2), ("c", 3)];
let py_map = vec.into_py_dict(py);
assert_eq!(py_map.len(), 3);
assert_eq!(py_map.get_item("b").unwrap().extract::<i32>().unwrap(), 2);
} | rust_cleaned_test_functions.jsonl/87952 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 174
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
45514,
5243,
368,
341,
286,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
286,
1077,
4510,
284,
342,
321,
43193,
1428,
286,
1077,
7486,
284,
7486,
20703,
445,
64,
497,
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_to_lowercase_rev_iterator() {
let s = "AÖßÜ💩ΣΤΙΓΜΑΣDžfiİ";
let v = ['\u{307}', 'i', 'fi', 'dž', 'σ', 'α', 'μ', 'γ', 'ι', 'τ', 'σ', '💩', 'ü', 'ß', 'ö', 'a'];
let mut pos = 0;
let it = s.chars().flat_map(|c| c.to_lowercase()).rev();
for c in it {
assert_eq!(c, v[pos]);
pos += 1;
}
assert_eq!(pos, v.len());
} | rust_cleaned_test_functions.jsonl/119414 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 229
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
93129,
38082,
13491,
368,
341,
262,
1077,
274,
284,
330,
32,
63361,
7997,
52491,
147121,
144624,
145032,
145035,
145281,
145097,
144842,
144624,
131,
227,
144300,
47780,
876,
262,
1077,
348,
284... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_quotations() {
let a = LpInteger { name: "a".to_string(), lower_bound: None, upper_bound: None };
let quoted_a = quote!(#a);
let quoted_a_str = "LpInteger { name : \"a\" . to_string () , lower_bound : None , upper_bound : None }";
assert_eq!(quoted_a.to_string(), quoted_a_str);
let exp: LpExprNode = a.clone().into();
let quoted_exp = quote!(#exp);
let quoted_exp_str = "LpExprNode :: ConsInt (".to_owned() + quoted_a_str + ")";
assert_eq!(quoted_exp.to_string(), quoted_exp_str);
let full_exp_arena = LpExpression::build (0, vec![LpExprNode:: LpCompExpr (LpExprOp :: Multiplication, 1, 2), LpExprNode:: LpCompExpr (LpExprOp :: Subtraction, 3, 4 ), LpExprNode:: LpCompExpr (LpExprOp :: Addition, 5, 6), LpExprNode:: LitVal (1f32), LpExprNode:: EmptyExpr, LpExprNode:: ConsCont (LpContinuous { name : "x".to_string() , lower_bound : None , upper_bound : None }), LpExprNode:: ConsInt (LpInteger { name : "y".to_string() , lower_bound : None , upper_bound : None }) ] );
let full_exp_quoted = quote!(#full_exp_arena);
let full_exp_str = "LpExpression { root : 0usize , arena : struct LpExprNode :: LpCompExpr (LpExprOp :: Multiplication , 1usize , 2usize) ; , struct LpExprNode :: LpCompExpr (LpExprOp :: Subtraction , 3usize , 4usize) ; , struct LpExprNode :: LpCompExpr (LpExprOp :: Addition , 5usize , 6usize) ; , struct LpExprNode :: LitVal (1f32) ; , struct LpExprNode :: EmptyExpr ; , struct LpExprNode :: ConsCont (LpContinuous { name : \"x\" . to_string () , lower_bound : None , upper_bound : None }) ; , struct LpExprNode :: ConsInt (LpInteger { name : \"y\" . to_string () , lower_bound : None , upper_bound : None }) ; }";
assert_eq!(full_exp_quoted.to_string(), full_exp_str);
let a_eq_b = LpConstraint(LpExpression::build(0, vec![LpExprNode:: LpCompExpr(LpExprOp :: Subtraction, 1, 2), LpExprNode::ConsInt (LpInteger { name : "a".to_string() , lower_bound : None , upper_bound : None }), LpExprNode::ConsInt (LpInteger { name : "b".to_string() , lower_bound : None , upper_bound : None }) ] ), Constraint::Equal, LitVal(0f32).into());
let quoted_a_eq_b = quote!(#a_eq_b);
let a_eq_b_str = "LpConstraint (LpExpression { root : 0usize , arena : struct LpExprNode :: LpCompExpr (LpExprOp :: Subtraction , 1usize , 2usize) ; , struct LpExprNode :: ConsInt (LpInteger { name : \"a\" . to_string () , lower_bound : None , upper_bound : None }) ; , struct LpExprNode :: ConsInt (LpInteger { name : \"b\" . to_string () , lower_bound : None , upper_bound : None }) ; } , Constraint :: Equal , LpExpression { root : 0usize , arena : struct LpExprNode :: LitVal (0f32) ; })";
assert_eq!(quoted_a_eq_b.to_string(), a_eq_b_str);
} | rust_cleaned_test_functions.jsonl/102141 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1159
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11280,
354,
804,
368,
341,
286,
1077,
264,
284,
444,
79,
3486,
314,
829,
25,
330,
64,
3263,
983,
3904,
1507,
4722,
19447,
25,
2240,
11,
8416,
19447,
25,
2240,
2605,
286,
1077,
23237,
4306,
284... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_last_day() {
let cases = vec![
("2011-11-11", "2011-11-30"),
("2008-02-10", "2008-02-29"),
("2000-02-11", "2000-02-29"),
("2100-02-11", "2100-02-28"),
("2011-11-11", "2011-11-30"),
("2011-11-11 10:10:10", "2011-11-30 00:00:00"),
("2011-01-00 10:00:00", "2011-01-31"),
];
let mut ctx = EvalContext::default();
for (arg, exp) in cases {
let time = Some(Time::parse_date(&mut ctx, arg).unwrap());
let exp_val = Some(Time::parse_date(&mut ctx, exp).unwrap());
let output = RpnFnScalarEvaluator::new()
.push_param(time)
.evaluate(ScalarFuncSig::LastDay)
.unwrap();
assert_eq!(output, exp_val);
}
let none_cases = vec!["2011-00-01 10:10:10"];
for case in none_cases {
let time = Some(Time::parse_date(&mut ctx, case).unwrap());
let output = RpnFnScalarEvaluator::new()
.push_param(time)
.evaluate::<Time>(ScalarFuncSig::LastDay)
.unwrap();
assert_eq!(output, None);
}
let output = RpnFnScalarEvaluator::new()
.push_param(None::<Time>)
.evaluate::<Time>(ScalarFuncSig::LastDay)
.unwrap();
assert_eq!(output, None);
} | rust_cleaned_test_functions.jsonl/36259 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 800
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12195,
16763,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
3489,
17,
15,
16,
16,
12,
16,
16,
12,
16,
16,
497,
330,
17,
15,
16,
16,
12,
16,
16,
12,
18,
15,
4461,
310,
3489,
17,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_shrink_and_clean() {
solana_logger::setup();
// repeat the whole test scenario
for _ in 0..5 {
let accounts = Arc::new(AccountsDb::new_single());
let accounts_for_shrink = accounts.clone();
// spawn the slot shrinking background thread
let exit = Arc::new(AtomicBool::default());
let exit_for_shrink = exit.clone();
let shrink_thread = std::thread::spawn(move || loop {
if exit_for_shrink.load(Ordering::Relaxed) {
break;
}
accounts_for_shrink.process_stale_slot_v1();
});
let mut alive_accounts = vec![];
let owner = Pubkey::default();
// populate the AccountsDb with plenty of food for slot shrinking
// also this simulates realistic some heavy spike account updates in the wild
for current_slot in 0..100 {
while alive_accounts.len() <= 10 {
alive_accounts.push((
solana_sdk::pubkey::new_rand(),
Account::new(thread_rng().gen_range(0, 50), 0, &owner),
));
}
alive_accounts.retain(|(_pubkey, account)| account.lamports >= 1);
for (pubkey, account) in alive_accounts.iter_mut() {
account.lamports -= 1;
accounts.store_uncached(current_slot, &[(&pubkey, &account)]);
}
accounts.add_root(current_slot);
}
// let's dance.
for _ in 0..10 {
accounts.clean_accounts(None);
std::thread::sleep(std::time::Duration::from_millis(100));
}
// cleanup
exit.store(true, Ordering::Relaxed);
shrink_thread.join().unwrap();
}
} | rust_cleaned_test_functions.jsonl/131809 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 834
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3712,
34365,
8378,
19573,
368,
341,
262,
2048,
3362,
27413,
486,
15188,
1428,
262,
442,
13153,
279,
4361,
1273,
15048,
198,
262,
369,
716,
304,
220,
15,
496,
20,
341,
286,
1077,
9618,
284,
19689... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_four_of_a_kind() {
let hand = hand::Hand::default()
+ hand::CARDS[0]
+ hand::CARDS[1]
+ hand::CARDS[2]
+ hand::CARDS[3];
assert_eq!(8, evaluate(&hand) >> HAND_CATEGORY_SHIFT);
assert_eq!(32769, evaluate(&hand));
} | rust_cleaned_test_functions.jsonl/3989 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 176
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56142,
3575,
4306,
33162,
368,
341,
286,
1077,
1424,
284,
1424,
486,
2314,
486,
2258,
741,
310,
488,
1424,
486,
36390,
5936,
58,
15,
921,
310,
488,
1424,
486,
36390,
5936,
58,
16,
921,
310,
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_branch_create_by_base_branch() {
let mut hdr: VecxVs<String> = VecxVs::new();
pnk!(hdr.version_create(VersionName(b"manster0")));
let bn1 = BranchName(b"test1");
let vn11 = VersionName(b"testversion11");
pnk!(hdr.branch_create(bn1, vn11, false));
let value1 = "testvalue1".to_owned();
hdr.push(&value1);
let bn2 = BranchName(b"test2");
let vn21 = VersionName(b"testversion21");
pnk!(hdr.branch_create_by_base_branch(bn2, vn21, ParentBranchName(b"test1"), false));
let value2 = "testvalue2".to_owned();
hdr.push(&value2);
} | rust_cleaned_test_functions.jsonl/49980 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 274
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28031,
8657,
3710,
7651,
28031,
368,
341,
262,
1077,
5206,
36615,
25,
11312,
87,
51737,
3464,
29,
284,
11312,
87,
51737,
486,
931,
543,
262,
43050,
74,
10297,
28785,
19484,
8657,
7,
5637,
675,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_duplicate_depth() {
let matches = app::build()
.get_matches_from_safe(vec!["lsd", "--tree", "--depth", "1", "--depth", "2"])
.unwrap();
let res = Flags::from_matches(&matches);
assert!(res.is_ok());
assert_eq!(res.unwrap().recursion_depth, 2);
} | rust_cleaned_test_functions.jsonl/82721 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70434,
19061,
368,
341,
286,
1077,
9071,
284,
906,
486,
5834,
741,
310,
659,
455,
38344,
5673,
34067,
25592,
0,
1183,
4730,
67,
497,
14482,
9344,
497,
14482,
17561,
497,
330,
16,
497,
14482,
175... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_append_for_progress_replicate() {
let l = default_logger();
let mut r = new_test_raft(1, vec![1, 2], 10, 1, new_storage(), &l);
r.become_candidate();
r.become_leader();
r.read_messages();
r.mut_prs().get_mut(2).unwrap().become_replicate();
for _ in 0..10 {
let _ = r.append_entry(&mut [new_entry(0, 0, SOME_DATA)]);
r.send_append(2);
assert_eq!(r.read_messages().len(), 1);
}
} | rust_cleaned_test_functions.jsonl/19136 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 222
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13565,
26041,
5478,
27200,
25533,
48795,
368,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
1077,
5206,
435,
284,
501,
4452,
62,
2944,
7,
16,
11,
7486,
20703,
16,
11,
220,
17,
1125,
220,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_decoding_rgb_op() {
let mut state = State::new();
let mut source = Vec::new();
Op::Rgb(101, 102, 103)
.into_bytes(&mut source)
.expect("Failed to write op");
assert_eq!(
decode_pixel(&mut state, &mut source.as_slice().bytes()),
Ok(Pixel { r: 101, g: 102, b: 103, a: 255 })
);
} | rust_cleaned_test_functions.jsonl/69397 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 159
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13783,
3700,
37407,
10287,
368,
341,
262,
1077,
5206,
1584,
284,
3234,
486,
931,
543,
262,
1077,
5206,
2530,
284,
11312,
486,
931,
1428,
262,
10672,
486,
80951,
7,
16,
15,
16,
11,
220,
16,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reorg() {
let network = Network::LocalNet;
let (mut db, mut blocks, mut outputs, consensus_manager) = create_new_blockchain(network);
let mempool_validator = MempoolValidators::new(
TxInputAndMaturityValidator::new(db.clone()),
TxInputAndMaturityValidator::new(db.clone()),
);
let mempool = Mempool::new(MempoolConfig::default(), mempool_validator);
// "Mine" Block 1
let txs = vec![txn_schema!(from: vec![outputs[0][0].clone()], to: vec![1 * T, 1 * T])];
generate_new_block(&mut db, &mut blocks, &mut outputs, txs, &consensus_manager).unwrap();
mempool.process_published_block(blocks[1].clone().into()).unwrap();
// "Mine" block 2
let schemas = vec![
txn_schema!(from: vec![outputs[1][0].clone()], to: vec![]),
txn_schema!(from: vec![outputs[1][1].clone()], to: vec![]),
txn_schema!(from: vec![outputs[1][2].clone()], to: vec![]),
];
let (txns2, utxos) = schema_to_transaction(&schemas);
outputs.push(utxos);
txns2.iter().for_each(|tx| {
mempool.insert(tx.clone()).unwrap();
});
let stats = mempool.stats().unwrap();
assert_eq!(stats.unconfirmed_txs, 3);
let txns2 = txns2.iter().map(|t| t.deref().clone()).collect();
generate_block(&mut db, &mut blocks, txns2, &consensus_manager).unwrap();
mempool.process_published_block(blocks[2].clone().into()).unwrap();
// "Mine" block 3
let schemas = vec![
txn_schema!(from: vec![outputs[2][0].clone()], to: vec![]),
txn_schema!(from: vec![outputs[2][1].clone()], to: vec![], fee: 25*uT, lock: 5, OutputFeatures::default()),
txn_schema!(from: vec![outputs[2][2].clone()], to: vec![], fee: 25*uT),
];
let (txns3, utxos) = schema_to_transaction(&schemas);
outputs.push(utxos);
txns3.iter().for_each(|tx| {
mempool.insert(tx.clone()).unwrap();
});
let txns3: Vec<Transaction> = txns3.iter().map(|t| t.deref().clone()).collect();
generate_block(
&mut db,
&mut blocks,
vec![txns3[0].clone(), txns3[2].clone()],
&consensus_manager,
)
.unwrap();
mempool.process_published_block(blocks[3].clone().into()).unwrap();
let stats = mempool.stats().unwrap();
assert_eq!(stats.unconfirmed_txs, 0);
assert_eq!(stats.timelocked_txs, 1);
assert_eq!(stats.published_txs, 5);
db.rewind_to_height(2).unwrap();
let template = chain_block(&blocks[2], vec![], &consensus_manager);
let reorg_block3 = db.calculate_mmr_roots(template).unwrap();
mempool
.process_reorg(vec![blocks[3].clone().into()], vec![reorg_block3.into()])
.unwrap();
let stats = mempool.stats().unwrap();
assert_eq!(stats.unconfirmed_txs, 2);
assert_eq!(stats.timelocked_txs, 1);
assert_eq!(stats.published_txs, 3);
// "Mine" block 4
let template = chain_block(&blocks[3], vec![], &consensus_manager);
let reorg_block4 = db.calculate_mmr_roots(template).unwrap();
// test that process_reorg can handle the case when removed_blocks is empty
// see https://github.com/tari-project/tari/issues/2101#issuecomment-680726940
mempool.process_reorg(vec![], vec![reorg_block4.into()]).unwrap();
} | rust_cleaned_test_functions.jsonl/61211 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1410
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
1775,
368,
341,
262,
1077,
3922,
284,
8141,
486,
7319,
6954,
280,
262,
1077,
320,
6984,
2927,
11,
5206,
10010,
11,
5206,
16275,
11,
23869,
12144,
8,
284,
1855,
5921,
7113,
8819,
46542,
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_t400() {
init();
let result = t400(&*GUID, *UIN as i64, &*GUID, &*GUID, 2, 2, &*GUID);
println!("{}", result.len());
println!("{:?}", result);
} | rust_cleaned_test_functions.jsonl/104750 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 113
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
19,
15,
15,
368,
341,
286,
2930,
543,
286,
1077,
1102,
284,
259,
19,
15,
15,
2099,
9,
41778,
11,
353,
52,
687,
438,
600,
21,
19,
11,
609,
9,
41778,
11,
609,
9,
41778,
11,
220,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_int() {
assert_ser_eq!(i8::MIN, &[Token::I8(i8::MIN)]);
assert_ser_eq!(i8::MAX, &[Token::I8(i8::MAX)]);
assert_ser_eq!(i16::MIN, &[Token::I16(i16::MIN)]);
assert_ser_eq!(i16::MAX, &[Token::I16(i16::MAX)]);
assert_ser_eq!(i32::MIN, &[Token::I32(i32::MIN)]);
assert_ser_eq!(i32::MAX, &[Token::I32(i32::MAX)]);
assert_ser_eq!(i64::MIN, &[Token::I64(i64::MIN)]);
assert_ser_eq!(i64::MAX, &[Token::I64(i64::MAX)]);
// serde_test doesn't have Token::I128.
assert_ser_eq!(isize::MIN, &[Token::I64(isize::MIN as _)]);
assert_ser_eq!(isize::MAX, &[Token::I64(isize::MAX as _)]);
assert_ser_eq!(u8::MAX, &[Token::U8(u8::MAX)]);
assert_ser_eq!(u16::MAX, &[Token::U16(u16::MAX)]);
assert_ser_eq!(u32::MAX, &[Token::U32(u32::MAX)]);
assert_ser_eq!(u64::MAX, &[Token::U64(u64::MAX)]);
// serde_test doesn't have Token::U128.
assert_ser_eq!(usize::MAX, &[Token::U64(usize::MAX as _)]);
} | rust_cleaned_test_functions.jsonl/44204 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 509
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4042,
368,
341,
262,
2060,
75861,
10714,
10297,
72,
23,
486,
16413,
11,
44590,
3323,
486,
40,
23,
1956,
23,
486,
16413,
41958,
262,
2060,
75861,
10714,
10297,
72,
23,
486,
10586,
11,
44590,
3323... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_btf_type_func() {
let endianness = Endianness::default();
let data: &[u8] = &[
0x17, 0x8b, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xf0, 0xe4, 0x00, 0x00,
];
match unsafe { BtfType::read(data, endianness) } {
Ok(BtfType::Func(_)) => {}
Ok(t) => panic!("expected func type gpt {:#?}", t),
Err(_) => panic!("unexpected error"),
}
} | rust_cleaned_test_functions.jsonl/98497 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
880,
8935,
1819,
9596,
368,
341,
286,
1077,
835,
72,
82033,
284,
3972,
72,
82033,
486,
2258,
543,
286,
1077,
821,
25,
44590,
84,
23,
60,
284,
609,
9640,
310,
220,
15,
87,
16,
22,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_parse_list_recursive_type() {
init();
let schema_str_1 = r#"{
"name": "A",
"doc": "A's schema",
"type": "record",
"fields": [
{"name": "a_field_one", "type": "B"}
]
}"#;
let schema_str_2 = r#"{
"name": "B",
"doc": "B's schema",
"type": "record",
"fields": [
{"name": "b_field_one", "type": "A"}
]
}"#;
let schema_strs_first = [schema_str_1, schema_str_2];
let schema_strs_second = [schema_str_2, schema_str_1];
let _ = Schema::parse_list(&schema_strs_first).expect("Test failed");
let _ = Schema::parse_list(&schema_strs_second).expect("Test failed");
} | rust_cleaned_test_functions.jsonl/69027 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 372
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
2019,
66242,
1819,
368,
341,
262,
2930,
543,
262,
1077,
10802,
2895,
62,
16,
284,
435,
55543,
515,
286,
330,
606,
788,
330,
32,
756,
286,
330,
5236,
788,
330,
32,
594,
10802,
756,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_check_str_for_latin1_and_bidi() {
assert_ne!(
check_str_for_latin1_and_bidi("abcdefghijklmnopaabcdefghijklmnop"),
Latin1Bidi::Bidi
);
assert_ne!(
check_str_for_latin1_and_bidi("abcdefghijklmnop\u{03B1}abcdefghijklmnop"),
Latin1Bidi::Bidi
);
assert_ne!(
check_str_for_latin1_and_bidi("abcdefghijklmnop\u{3041}abcdefghijklmnop"),
Latin1Bidi::Bidi
);
assert_ne!(
check_str_for_latin1_and_bidi("abcdefghijklmnop\u{1F4A9}abcdefghijklmnop"),
Latin1Bidi::Bidi
);
assert_ne!(
check_str_for_latin1_and_bidi("abcdefghijklmnop\u{FE00}abcdefghijklmnop"),
Latin1Bidi::Bidi
);
assert_ne!(
check_str_for_latin1_and_bidi("abcdefghijklmnop\u{202C}abcdefghijklmnop"),
Latin1Bidi::Bidi
);
assert_ne!(
check_str_for_latin1_and_bidi("abcdefghijklmnop\u{FEFF}abcdefghijklmnop"),
Latin1Bidi::Bidi
);
assert_eq!(
check_str_for_latin1_and_bidi("abcdefghijklmnop\u{0590}abcdefghijklmnop"),
Latin1Bidi::Bidi
);
assert_eq!(
check_str_for_latin1_and_bidi("abcdefghijklmnop\u{08FF}abcdefghijklmnop"),
Latin1Bidi::Bidi
);
assert_eq!(
check_str_for_latin1_and_bidi("abcdefghijklmnop\u{061C}abcdefghijklmnop"),
Latin1Bidi::Bidi
);
assert_eq!(
check_str_for_latin1_and_bidi("abcdefghijklmnop\u{FB50}abcdefghijklmnop"),
Latin1Bidi::Bidi
);
assert_eq!(
check_str_for_latin1_and_bidi("abcdefghijklmnop\u{FDFF}abcdefghijklmnop"),
Latin1Bidi::Bidi
);
assert_eq!(
check_str_for_latin1_and_bidi("abcdefghijklmnop\u{FE70}abcdefghijklmnop"),
Latin1Bidi::Bidi
);
assert_eq!(
check_str_for_latin1_and_bidi("abcdefghijklmnop\u{FEFE}abcdefghijklmnop"),
Latin1Bidi::Bidi
);
assert_eq!(
check_str_for_latin1_and_bidi("abcdefghijklmnop\u{200F}abcdefghijklmnop"),
Latin1Bidi::Bidi
);
assert_eq!(
check_str_for_latin1_and_bidi("abcdefghijklmnop\u{202B}abcdefghijklmnop"),
Latin1Bidi::Bidi
);
assert_eq!(
check_str_for_latin1_and_bidi("abcdefghijklmnop\u{202E}abcdefghijklmnop"),
Latin1Bidi::Bidi
);
assert_eq!(
check_str_for_latin1_and_bidi("abcdefghijklmnop\u{2067}abcdefghijklmnop"),
Latin1Bidi::Bidi
);
assert_eq!(
check_str_for_latin1_and_bidi("abcdefghijklmnop\u{10800}abcdefghijklmnop"),
Latin1Bidi::Bidi
);
assert_eq!(
check_str_for_latin1_and_bidi("abcdefghijklmnop\u{10FFF}abcdefghijklmnop"),
Latin1Bidi::Bidi
);
assert_eq!(
check_str_for_latin1_and_bidi("abcdefghijklmnop\u{1E800}abcdefghijklmnop"),
Latin1Bidi::Bidi
);
assert_eq!(
check_str_for_latin1_and_bidi("abcdefghijklmnop\u{1EFFF}abcdefghijklmnop"),
Latin1Bidi::Bidi
);
} | rust_cleaned_test_functions.jsonl/27325 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1995
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
2895,
5478,
907,
14768,
16,
8378,
880,
12278,
368,
341,
286,
2060,
13925,
33673,
310,
1779,
2895,
5478,
907,
14768,
16,
8378,
880,
12278,
445,
63168,
21775,
39852,
65102,
4461,
310,
19458,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pack_seq_and_type() {
let mut tests: Vec<(u64, ValueType, Vec<u8>)> = vec![
(1, ValueType::Value, vec![1, 1, 0, 0, 0, 0, 0, 0]),
(2, ValueType::Deletion, vec![0, 2, 0, 0, 0, 0, 0, 0]),
(
MAX_KEY_SEQUENCE,
ValueType::Deletion,
vec![0, 255, 255, 255, 255, 255, 255, 255],
),
];
for (seq, t, expect) in tests.drain(..) {
let u = decode_fixed_64(expect.as_slice());
assert_eq!(pack_seq_and_type(seq, t), u);
}
} | rust_cleaned_test_functions.jsonl/69362 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 349
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32995,
14486,
8378,
1819,
368,
341,
286,
1077,
5206,
7032,
25,
11312,
28706,
84,
21,
19,
11,
55545,
11,
11312,
34837,
23,
9231,
29,
284,
7486,
90515,
310,
320,
16,
11,
55545,
486,
1130,
11,
74... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_security_app() {
#[derive(Apiv2Security, Deserialize)]
#[openapi(
apiKey,
alias = "JWT",
in = "header",
name = "Authorization",
description = "Use format 'Bearer TOKEN'"
)]
struct AccessToken;
impl FromRequest for AccessToken {
type Future = Ready<Result<Self, Self::Error>>;
type Error = Error;
type Config = ();
fn from_request(_: &HttpRequest, _payload: &mut actix_web::dev::Payload) -> Self::Future {
ready(Ok(Self {}))
}
}
#[derive(Apiv2Security, Deserialize)]
#[openapi(
oauth2,
alias = "MyOAuth2",
auth_url = "http://example.com/",
token_url = "http://example.com/token",
flow = "password"
)]
struct OAuth2Access;
impl FromRequest for OAuth2Access {
type Future = Ready<Result<Self, Self::Error>>;
type Error = Error;
type Config = ();
fn from_request(_: &HttpRequest, _payload: &mut actix_web::dev::Payload) -> Self::Future {
ready(Ok(Self {}))
}
}
#[derive(Apiv2Security, Deserialize)]
#[openapi(parent = "OAuth2Access", scopes("pets.read", "pets.write"))]
struct PetScope;
impl FromRequest for PetScope {
type Future = Ready<Result<Self, Self::Error>>;
type Error = Error;
type Config = ();
fn from_request(_: &HttpRequest, _payload: &mut actix_web::dev::Payload) -> Self::Future {
ready(Ok(Self {}))
}
}
#[api_v2_operation]
async fn echo_pet_with_jwt(_: AccessToken, body: web::Json<Pet>) -> web::Json<Pet> {
body
}
#[api_v2_operation]
async fn echo_pet_with_petstore(_: PetScope, body: web::Json<Pet>) -> web::Json<Pet> {
body
}
fn config(cfg: &mut web::ServiceConfig) {
cfg.service(web::resource("/echo1").route(web::post().to(echo_pet_with_jwt)))
.service(web::resource("/echo2").route(web::post().to(echo_pet_with_petstore)));
}
run_and_check_app(
move || {
App::new()
.wrap_api()
.service(web::scope("/api").configure(config))
.with_json_spec_at("/spec")
.build()
},
|addr| {
let resp = CLIENT
.get(&format!("http://{}/spec", addr))
.send()
.expect("request failed?");
check_json(
resp,
json!({
"info":{"title":"","version":""},
"definitions": {
"Pet": {
"properties": {
"class": {
"enum": ["dog", "cat", "other"],
"type": "string"
},
"id": {
"format": "int64",
"type": "integer"
},
"name": {
"description": "Pick a good one.",
"type": "string"
},
"updatedOn": {
"format": "date-time",
"type": "string"
},
"uuid": {
"format": "uuid",
"type": "string"
}
},
"required":["class", "name"]
}
},
"paths": {
"/api/echo1": {
"parameters": [{
"in": "body",
"name": "body",
"required": true,
"schema": {
"$ref": "#/definitions/Pet"
}
}],
"post": {
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/Pet"
}
},
},
"security": [
{
"JWT": []
}
]
}
},
"/api/echo2": {
"parameters": [{
"in": "body",
"name": "body",
"required": true,
"schema": {
"$ref": "#/definitions/Pet"
}
}],
"post": {
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/Pet"
}
},
},
"security": [
{
"MyOAuth2": ["pets.read", "pets.write"]
}
]
}
},
},
"securityDefinitions": {
"JWT": {
"description":"Use format 'Bearer TOKEN'",
"in": "header",
"name": "Authorization",
"type": "apiKey"
},
"MyOAuth2": {
"scopes": {
"pets.read": "pets.read",
"pets.write": "pets.write"
},
"type": "oauth2",
"authorizationUrl": "http://example.com/",
"tokenUrl": "http://example.com/token",
"flow": "password"
}
},
"swagger": "2.0"
}),
);
},
);
} | rust_cleaned_test_functions.jsonl/18943 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 4117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48726,
8191,
368,
341,
262,
11506,
27098,
4346,
79,
344,
17,
15352,
11,
48440,
5563,
262,
11506,
2508,
2068,
1006,
286,
44924,
345,
286,
15534,
284,
330,
55172,
756,
286,
304,
284,
330,
2708,
75... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serialize_int() {
let (bytes, handles) =
TestInterfaceEvent::Int { arg: INT_VALUE }.into_message(SENDER_ID).unwrap().take();
assert!(handles.is_empty());
assert_eq!(bytes, message_bytes!(SENDER_ID, 1 /* opcode */, INT_VALUE));
} | rust_cleaned_test_functions.jsonl/55793 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
4042,
368,
341,
286,
1077,
320,
9651,
11,
13469,
8,
4035,
310,
3393,
5051,
1556,
486,
1072,
314,
1392,
25,
9221,
7476,
16908,
18122,
6462,
51048,
35689,
3450,
568,
15454,
1005,
22769,
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_rotate() {
assert_eq!(rotate(2, 1), 2);
assert_eq!(rotate(3, 1), 3);
assert_eq!(rotate(5, 1), 5);
assert_eq!(rotate(7, 1), 7);
} | rust_cleaned_test_functions.jsonl/46997 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 92
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60834,
368,
341,
262,
2060,
10714,
10297,
16213,
7,
17,
11,
220,
16,
701,
220,
17,
317,
262,
2060,
10714,
10297,
16213,
7,
18,
11,
220,
16,
701,
220,
18,
317,
262,
2060,
10714,
10297,
16213,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_usize() {
let test = assert_de_tokens_error::<NonZeroUsize>;
// from zero
test(
&[Token::I8(0)],
"invalid value: integer `0`, expected a nonzero usize",
);
test(
&[Token::I16(0)],
"invalid value: integer `0`, expected a nonzero usize",
);
test(
&[Token::I32(0)],
"invalid value: integer `0`, expected a nonzero usize",
);
test(
&[Token::I64(0)],
"invalid value: integer `0`, expected a nonzero usize",
);
test(
&[Token::U8(0)],
"invalid value: integer `0`, expected a nonzero usize",
);
test(
&[Token::U16(0)],
"invalid value: integer `0`, expected a nonzero usize",
);
test(
&[Token::U32(0)],
"invalid value: integer `0`, expected a nonzero usize",
);
test(
&[Token::U64(0)],
"invalid value: integer `0`, expected a nonzero usize",
);
// from signed
test(
&[Token::I8(-1)],
"invalid value: integer `-1`, expected a nonzero usize",
);
test(
&[Token::I16(-1)],
"invalid value: integer `-1`, expected a nonzero usize",
);
test(
&[Token::I32(-1)],
"invalid value: integer `-1`, expected a nonzero usize",
);
test(
&[Token::I64(-1)],
"invalid value: integer `-1`, expected a nonzero usize",
);
} | rust_cleaned_test_functions.jsonl/129514 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 701
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21637,
14154,
11306,
551,
368,
341,
262,
1077,
1273,
284,
2060,
2259,
28838,
4096,
27638,
8121,
17999,
52,
2141,
19421,
262,
442,
504,
7168,
198,
262,
1273,
1006,
286,
44590,
3323,
486,
40,
23,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vitaliks_eip_158_vitalik_1_json() {
use crate::utils::bytes_to_hex_str;
use serde_rlp::ser::to_bytes;
let tx = Transaction {
nonce: u256!(0),
gas_price: u256!(0x4a817c800),
gas_limit: u256!(0x5208),
to: "3535353535353535353535353535353535353535".parse().unwrap(),
value: u256!(0),
data: Vec::new(),
signature: Some(Signature::new(
u256!(0x25),
u256!(0x44852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d),
u256!(0x44852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d),
)),
};
let lhs = to_bytes(&tx).unwrap();
let lhs = bytes_to_hex_str(&lhs);
let rhs = "f864808504a817c800825208943535353535353535353535353535353535353535808025a0044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116da0044852b2a670ade5407e78fb2863c51de9fcb96542a07186fe3aeda6bb8a116d".to_owned();
assert_eq!(lhs, rhs);
} | rust_cleaned_test_functions.jsonl/3250 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 547
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
2174,
67891,
2204,
573,
62,
16,
20,
23,
2273,
2174,
1579,
62,
16,
9455,
368,
341,
262,
990,
17717,
486,
6031,
486,
9651,
2346,
32655,
2895,
280,
262,
990,
61570,
1710,
13545,
486,
799,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_linear_search() {
let len: usize = 50;
let arr: Vec<u32> = (0..len).map(|el| 1u32 + (el as u32) * 2).collect();
for target in 1..*arr.last().unwrap() {
let res = linear_search(&arr[..], target);
if res > 0 {
assert!(arr[res - 1] < target);
}
if res < len {
assert!(arr[res] >= target);
}
}
} | rust_cleaned_test_functions.jsonl/29765 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40674,
10716,
368,
341,
286,
1077,
2422,
25,
22301,
284,
220,
20,
15,
280,
286,
1077,
2890,
25,
11312,
34837,
18,
17,
29,
284,
320,
15,
496,
2892,
568,
2186,
22428,
301,
91,
220,
16,
84,
18,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_primitive_array_from_vec_option() {
// Test building a primitive array with null values
let arr = Int32Array::from(vec![Some(0), None, Some(2), None, Some(4)]);
assert_eq!(5, arr.len());
assert_eq!(0, arr.offset());
assert_eq!(2, arr.null_count());
for i in 0..5 {
if i % 2 == 0 {
assert!(!arr.is_null(i));
assert!(arr.is_valid(i));
assert_eq!(i as i32, arr.value(i));
} else {
assert!(arr.is_null(i));
assert!(!arr.is_valid(i));
}
}
} | rust_cleaned_test_functions.jsonl/11582 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 357
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84087,
3858,
5673,
13251,
9672,
368,
341,
286,
442,
3393,
4752,
264,
27594,
1334,
448,
845,
2750,
198,
286,
1077,
2890,
284,
1333,
18,
17,
1857,
486,
1499,
25592,
20703,
8373,
7,
15,
701,
2240,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_memory_layouts() {
assert_memory_layout_equal::<hb::hb_glyph_position_t, GlyphPosition>();
assert_memory_layout_equal::<hb::hb_glyph_info_t, GlyphInfo>();
} | rust_cleaned_test_functions.jsonl/63447 | {
"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,
19195,
14466,
82,
368,
341,
286,
2060,
19195,
14466,
11478,
27638,
49039,
486,
49039,
88703,
9661,
528,
11,
87413,
3812,
3913,
286,
2060,
19195,
14466,
11478,
27638,
49039,
486,
49039,
88703,
3109,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_buffer_end_iso_2022_jp_from_utf8() {
let mut dst = [0u8; 18];
{
let mut encoder = ISO_2022_JP.new_encoder();
let (result, _, _, _) =
encoder.encode_from_utf8("\u{A5}\u{1F4A9}", &mut dst[..], false);
assert_eq!(result, CoderResult::InputEmpty);
}
{
let mut encoder = ISO_2022_JP.new_encoder();
let (result, _, _, _) = encoder.encode_from_utf8("\u{A5}\u{1F4A9}", &mut dst[..], true);
assert_eq!(result, CoderResult::OutputFull);
}
{
let mut encoder = ISO_2022_JP.new_encoder();
let (result, _, _, _) = encoder.encode_from_utf8("\u{1F4A9}", &mut dst[..13], false);
assert_eq!(result, CoderResult::InputEmpty);
}
{
let mut encoder = ISO_2022_JP.new_encoder();
let (result, _, _, _) = encoder.encode_from_utf8("\u{1F4A9}", &mut dst[..13], true);
assert_eq!(result, CoderResult::InputEmpty);
}
} | rust_cleaned_test_functions.jsonl/90275 | {
"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,
7776,
6213,
49660,
62,
17,
15,
17,
17,
5374,
79,
5673,
39453,
23,
368,
341,
286,
1077,
5206,
10648,
284,
508,
15,
84,
23,
26,
220,
16,
23,
935,
286,
341,
310,
1077,
5206,
23668,
284,
21940,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_journal_print_large_buffer() {
if !ensure_journald_socket() {
return;
}
let data = "A".repeat(212995);
journal_print(Priority::Debug, &data).unwrap();
} | rust_cleaned_test_functions.jsonl/39385 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 113
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
85075,
10064,
45228,
7776,
368,
341,
286,
421,
753,
27289,
5374,
3431,
4747,
19555,
368,
341,
310,
470,
280,
286,
555,
286,
1077,
821,
284,
330,
32,
3263,
30624,
7,
17,
16,
17,
24,
24,
20,
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
] | 2 |
#[test]
fn test_one_spare() {
let mut game = Game::new();
roll_spare(&mut game);
game.roll(3);
roll_many(&mut game, 17, 0);
assert_eq!(game.score(), 16);
} | rust_cleaned_test_functions.jsonl/43697 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11667,
643,
3380,
368,
341,
286,
1077,
5206,
1809,
284,
4050,
486,
931,
1428,
286,
6502,
643,
3380,
2099,
6984,
1809,
317,
286,
1809,
62614,
7,
18,
317,
286,
6502,
22101,
2099,
6984,
1809,
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 |
#[test]
fn test_remove_range() {
let page_size: usize = 0x1000;
let mem = vm_memory::test_utils::create_anon_guest_memory(
&[(GuestAddress(0), 2 * page_size)],
false,
)
.unwrap();
// Fill the memory with ones.
let ones = vec![1u8; 2 * page_size];
mem.write(&ones[..], GuestAddress(0)).unwrap();
// Remove the first page.
assert!(remove_range(&mem, (GuestAddress(0), page_size as u64), false).is_ok());
// Check that the first page is zeroed.
let mut actual_page = vec![0u8; page_size];
mem.read(&mut actual_page.as_mut_slice(), GuestAddress(0))
.unwrap();
assert_eq!(vec![0u8; page_size], actual_page);
// Check that the second page still contains ones.
mem.read(
&mut actual_page.as_mut_slice(),
GuestAddress(page_size as u64),
)
.unwrap();
assert_eq!(vec![1u8; page_size], actual_page);
// Malformed range: the len is too big.
assert_match!(
remove_range(&mem, (GuestAddress(0), 0x10000), false).unwrap_err(),
RemoveRegionError::MalformedRange
);
// Region not mapped.
assert_match!(
remove_range(&mem, (GuestAddress(0x10000), 0x10), false).unwrap_err(),
RemoveRegionError::RegionNotFound
);
// Madvise fail: the guest address is not aligned to the page size.
assert_match!(
remove_range(&mem, (GuestAddress(0x20), page_size as u64), false).unwrap_err(),
RemoveRegionError::MadviseFail(_)
);
} | rust_cleaned_test_functions.jsonl/96755 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 782
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
9698,
368,
341,
286,
1077,
2150,
2368,
25,
22301,
284,
220,
15,
87,
16,
15,
15,
15,
280,
286,
1077,
1833,
284,
10995,
19195,
486,
1944,
17309,
486,
3182,
12008,
263,
62739,
19195,
1006,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_uuid_operator_eq() {
let uuid1 = test_util::new();
let uuid1_dup = uuid1.clone();
let uuid2 = test_util::new2();
assert!(uuid1 == uuid1);
assert!(uuid1 == uuid1_dup);
assert!(uuid1_dup == uuid1);
assert!(uuid1 != uuid2);
assert!(uuid2 != uuid1);
assert!(uuid1_dup != uuid2);
assert!(uuid2 != uuid1_dup);
} | rust_cleaned_test_functions.jsonl/17527 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 233
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25540,
40594,
10714,
368,
341,
286,
1077,
16040,
16,
284,
1273,
18974,
486,
931,
543,
286,
1077,
16040,
16,
51932,
284,
16040,
16,
15997,
543,
286,
1077,
16040,
17,
284,
1273,
18974,
486,
931,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_yield_a() {
let mut g = Gn::<i32>::new(|| {
let r: i32 = yield_(10).unwrap();
r * 2
});
// first start the generator
let i = g.raw_send(None).unwrap();
assert_eq!(i, 10);
let i = g.send(3);
assert_eq!(i, 6);
assert!(g.is_done());
} | rust_cleaned_test_functions.jsonl/91410 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 157
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
83709,
4306,
368,
341,
262,
1077,
5206,
342,
284,
95151,
27638,
72,
18,
17,
6831,
931,
79453,
341,
286,
1077,
435,
25,
600,
18,
17,
284,
7540,
8361,
16,
15,
568,
15454,
543,
286,
435,
353,
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_to_singular() {
let mut incorrectly_singularized: Vec<(&'static str, &'static str, String)> = Vec::new();
let mut not_singularized: Vec<(&'static str, &'static str)> = Vec::new();
let mut assert_to_singular_matches = |input: &'static str, expected: &'static str| {
let output = to_singular(input);
if output != expected {
if output == input {
not_singularized.push((input, expected))
} else {
incorrectly_singularized.push((input, expected, output))
}
}
};
assert_to_singular_matches("cards", "card");
assert_to_singular_matches("types", "type");
assert_to_singular_matches("colors", "color");
assert_to_singular_matches("rulings", "ruling");
assert_to_singular_matches("foreignNames", "foreignName");
assert_to_singular_matches("tags", "tag");
assert_to_singular_matches("categoryKeys", "categoryKey");
assert_to_singular_matches("attributes", "attribute");
assert_to_singular_matches("values", "value");
assert_to_singular_matches("images", "image");
assert_to_singular_matches("guesses", "guess");
assert_to_singular_matches("moves", "move");
assert_to_singular_matches("lives", "life");
assert_to_singular_matches("leaves", "leaf");
assert_to_singular_matches("legalities", "legality");
assert_to_singular_matches("abilities", "ability");
assert_to_singular_matches("queries", "query");
assert_to_singular_matches("cookies", "cookie");
assert_to_singular_matches("movies", "movie");
assert_to_singular_matches("matrices", "matrix");
assert_to_singular_matches("vertices", "vertex");
assert_to_singular_matches("indices", "index");
assert_to_singular_matches("slices", "slice");
assert_to_singular_matches("children", "child");
assert_to_singular_matches("series", "series");
assert_to_singular_matches("news", "news");
assert_to_singular_matches("axis", "axis");
if !not_singularized.is_empty() {
println!(
"Missed {} singularizations for to_singular() (input, expected):\n {}\n\n",
not_singularized.len(),
not_singularized
.iter()
.map(|(input, expected)| format!("{}, {}", input, expected))
.collect::<Vec<_>>()
.join("\n ")
);
}
if !incorrectly_singularized.is_empty() {
panic!(
"Test failures for to_singular() (input, expected, output):\n {}\n\n",
incorrectly_singularized
.iter()
.map(|(input, expected, output)| format!("{}, {}, {}", input, expected, output))
.collect::<Vec<_>>()
.join("\n ")
);
}
} | rust_cleaned_test_functions.jsonl/18433 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1477
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
93240,
368,
341,
286,
1077,
5206,
43347,
93240,
1506,
25,
11312,
27,
2099,
6,
1978,
607,
11,
30136,
1978,
607,
11,
923,
16018,
284,
11312,
486,
931,
543,
286,
1077,
5206,
537,
93240,
1506,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_retry_durable_nonce_transactions() {
solana_logger::setup();
let (genesis_config, mint_keypair) = create_genesis_config(4);
let bank = Bank::new(&genesis_config);
let bank_forks = Arc::new(RwLock::new(BankForks::new(bank)));
let send_socket = UdpSocket::bind("0.0.0.0:0").unwrap();
let tpu_address = "127.0.0.1:0".parse().unwrap();
let leader_forward_count = 1;
let root_bank = Arc::new(Bank::new_from_parent(
&bank_forks.read().unwrap().working_bank(),
&Pubkey::default(),
1,
));
let rooted_signature = root_bank
.transfer(1, &mint_keypair, &mint_keypair.pubkey())
.unwrap();
let nonce_address = Pubkey::new_unique();
let durable_nonce = Hash::new_unique();
let nonce_state =
nonce::state::Versions::new_current(nonce::State::Initialized(nonce::state::Data {
authority: Pubkey::default(),
blockhash: durable_nonce,
fee_calculator: FeeCalculator::new(42),
}));
let nonce_account =
AccountSharedData::new_data(43, &nonce_state, &system_program::id()).unwrap();
root_bank.store_account(&nonce_address, &nonce_account);
let working_bank = Arc::new(Bank::new_from_parent(&root_bank, &Pubkey::default(), 2));
let non_rooted_signature = working_bank
.transfer(2, &mint_keypair, &mint_keypair.pubkey())
.unwrap();
let last_valid_slot = working_bank.slot() + 300;
let failed_signature = {
let blockhash = working_bank.last_blockhash();
let transaction =
system_transaction::transfer(&mint_keypair, &Pubkey::default(), 1, blockhash);
let signature = transaction.signatures[0];
working_bank.process_transaction(&transaction).unwrap_err();
signature
};
let mut transactions = HashMap::new();
info!("Rooted durable-nonce transactions are dropped...");
transactions.insert(
rooted_signature,
TransactionInfo::new(
rooted_signature,
vec![],
last_valid_slot,
Some((nonce_address, durable_nonce)),
),
);
let result = SendTransactionService::process_transactions(
&working_bank,
&root_bank,
&send_socket,
&tpu_address,
&mut transactions,
&None,
leader_forward_count,
);
assert!(transactions.is_empty());
assert_eq!(
result,
ProcessTransactionsResult {
rooted: 1,
..ProcessTransactionsResult::default()
}
);
// Nonce expired case
transactions.insert(
rooted_signature,
TransactionInfo::new(
rooted_signature,
vec![],
last_valid_slot,
Some((nonce_address, Hash::new_unique())),
),
);
let result = SendTransactionService::process_transactions(
&working_bank,
&root_bank,
&send_socket,
&tpu_address,
&mut transactions,
&None,
leader_forward_count,
);
assert!(transactions.is_empty());
assert_eq!(
result,
ProcessTransactionsResult {
rooted: 1,
..ProcessTransactionsResult::default()
}
);
info!("Expired durable-nonce transactions are dropped...");
transactions.insert(
Signature::default(),
TransactionInfo::new(
Signature::default(),
vec![],
last_valid_slot,
Some((nonce_address, Hash::new_unique())),
),
);
let result = SendTransactionService::process_transactions(
&working_bank,
&root_bank,
&send_socket,
&tpu_address,
&mut transactions,
&None,
leader_forward_count,
);
assert!(transactions.is_empty());
assert_eq!(
result,
ProcessTransactionsResult {
expired: 1,
..ProcessTransactionsResult::default()
}
);
transactions.insert(
Signature::default(),
TransactionInfo::new(
Signature::default(),
vec![],
root_bank.slot() - 1,
Some((nonce_address, durable_nonce)),
),
);
let result = SendTransactionService::process_transactions(
&working_bank,
&root_bank,
&send_socket,
&tpu_address,
&mut transactions,
&None,
leader_forward_count,
);
assert!(transactions.is_empty());
assert_eq!(
result,
ProcessTransactionsResult {
expired: 1,
..ProcessTransactionsResult::default()
}
);
info!("Failed durable-nonce transactions are dropped...");
transactions.insert(
failed_signature,
TransactionInfo::new(
failed_signature,
vec![],
last_valid_slot,
Some((nonce_address, Hash::new_unique())), // runtime should advance nonce on failed transactions
),
);
let result = SendTransactionService::process_transactions(
&working_bank,
&root_bank,
&send_socket,
&tpu_address,
&mut transactions,
&None,
leader_forward_count,
);
assert!(transactions.is_empty());
assert_eq!(
result,
ProcessTransactionsResult {
failed: 1,
..ProcessTransactionsResult::default()
}
);
info!("Non-rooted durable-nonce transactions are kept...");
transactions.insert(
non_rooted_signature,
TransactionInfo::new(
non_rooted_signature,
vec![],
last_valid_slot,
Some((nonce_address, Hash::new_unique())), // runtime advances nonce when transaction lands
),
);
let result = SendTransactionService::process_transactions(
&working_bank,
&root_bank,
&send_socket,
&tpu_address,
&mut transactions,
&None,
leader_forward_count,
);
assert_eq!(transactions.len(), 1);
assert_eq!(
result,
ProcessTransactionsResult {
retained: 1,
..ProcessTransactionsResult::default()
}
);
transactions.clear();
info!("Unknown durable-nonce transactions are retried until nonce advances...");
transactions.insert(
Signature::default(),
TransactionInfo::new(
Signature::default(),
vec![],
last_valid_slot,
Some((nonce_address, durable_nonce)),
),
);
let result = SendTransactionService::process_transactions(
&working_bank,
&root_bank,
&send_socket,
&tpu_address,
&mut transactions,
&None,
leader_forward_count,
);
assert_eq!(transactions.len(), 1);
assert_eq!(
result,
ProcessTransactionsResult {
retried: 1,
..ProcessTransactionsResult::default()
}
);
// Advance nonce
let new_durable_nonce = Hash::new_unique();
let new_nonce_state =
nonce::state::Versions::new_current(nonce::State::Initialized(nonce::state::Data {
authority: Pubkey::default(),
blockhash: new_durable_nonce,
fee_calculator: FeeCalculator::new(42),
}));
let nonce_account =
AccountSharedData::new_data(43, &new_nonce_state, &system_program::id()).unwrap();
working_bank.store_account(&nonce_address, &nonce_account);
let result = SendTransactionService::process_transactions(
&working_bank,
&root_bank,
&send_socket,
&tpu_address,
&mut transactions,
&None,
leader_forward_count,
);
assert_eq!(transactions.len(), 0);
assert_eq!(
result,
ProcessTransactionsResult {
expired: 1,
..ProcessTransactionsResult::default()
}
);
} | rust_cleaned_test_functions.jsonl/45646 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 4719
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62745,
814,
18329,
48508,
68182,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
1428,
286,
1077,
320,
77894,
5332,
11,
28337,
3097,
12670,
8,
284,
1855,
16322,
13774,
5332,
7,
19,
317,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_datetime_zulu_from_int() {
assert_eq!(Value::DateTime(DateTime::new(Date::new_str("2012", "01", "03"), Some(Time::new_str(
"03", "30", "30", None, Some(TimeOffset::Zulu)
)))), Value::datetime_zulu_from_int(2012, 1, 3, 3, 30, 30).unwrap());
} | rust_cleaned_test_functions.jsonl/86221 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 129
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
28943,
6415,
24411,
5673,
4042,
368,
341,
262,
2060,
10714,
10297,
1130,
486,
7689,
32083,
486,
931,
19987,
486,
931,
2895,
445,
17,
15,
16,
17,
497,
330,
15,
16,
497,
330,
15,
18,
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... | 1 |
#[test]
fn test_batch_receiver() {
let (tx, rx) = unbounded::<u64>(4);
let rx = BatchReceiver::new(rx, 8, || Vec::with_capacity(4), |v, e| v.push(e));
let msg_counter = Arc::new(AtomicUsize::new(0));
let msg_counter1 = Arc::clone(&msg_counter);
let pool = CpuPool::new(1);
pool.spawn(rx.for_each(move |v| {
let len = v.len();
assert!(len <= 8);
msg_counter1.fetch_add(len, Ordering::AcqRel);
Ok(())
}))
.forget();
thread::sleep(time::Duration::from_millis(10));
assert!(tx.send(0).is_ok());
thread::sleep(time::Duration::from_millis(10));
assert_eq!(msg_counter.load(Ordering::Acquire), 0);
// Send with notify.
let notifier = tx.get_notifier().unwrap();
assert!(tx.get_notifier().is_none());
notifier.notify();
thread::sleep(time::Duration::from_millis(10));
assert_eq!(msg_counter.load(Ordering::Acquire), 1);
// Auto notify with more sendings.
for _ in 0..16 {
assert!(tx.send(0).is_ok());
}
thread::sleep(time::Duration::from_millis(10));
assert_eq!(msg_counter.load(Ordering::Acquire), 17);
} | rust_cleaned_test_functions.jsonl/34471 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 628
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14534,
65691,
368,
341,
286,
1077,
320,
3998,
11,
19111,
8,
284,
650,
65686,
27638,
84,
21,
19,
2235,
19,
317,
286,
1077,
19111,
284,
33904,
25436,
486,
931,
75279,
11,
220,
23,
11,
1369,
1131... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_displayable_predicate_mesurement_and_field() {
let node = RPCNode {
node_type: RPCNodeType::LogicalExpression as i32,
children: vec![
make_tag_ref_node(&[0], "val1"),
make_tag_ref_node(b"tag2", "val2"),
make_tag_ref_node(&[255], "val3"),
],
value: Some(RPCValue::Logical(RPCLogical::And as i32)),
};
let rpc_pred = Some(RPCPredicate { root: Some(node) });
assert_eq!(
"AND((TagRef:_m[0x00] == \"val1\"), (TagRef:tag2 == \"val2\"), (TagRef:_f[0xff] == \"val3\"))",
format!("{}", displayable_predicate(rpc_pred.as_ref()))
);
} | rust_cleaned_test_functions.jsonl/3675 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 395
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14825,
480,
97474,
69159,
38246,
8378,
5013,
368,
341,
1789,
286,
1077,
2436,
284,
34008,
1955,
341,
310,
2436,
1819,
25,
34008,
66137,
486,
64312,
9595,
438,
600,
18,
17,
345,
310,
2841,
25,
74... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_circular_buffer_append_and_consume() {
let mut buf = CircularBuffer::with_capacity(1024);
for _ in 0..2 {
buf.try_append_with(1, |output| {
output[0] = 0;
let result: Result<_, ()> = Ok(output.len());
result
})
.unwrap();
let mut actual = [0xaa];
buf.consume_into(&mut actual);
assert_eq!(actual[0], 0);
}
} | rust_cleaned_test_functions.jsonl/86393 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 220
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
21472,
7776,
26041,
8378,
3382,
31323,
368,
341,
262,
1077,
5206,
6607,
284,
45761,
4095,
486,
4197,
35603,
7,
16,
15,
17,
19,
317,
262,
369,
716,
304,
220,
15,
496,
17,
341,
286,
6607,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_expanded_equals() {
assert!(
Rect::from_points(&[Point::new(0.2, 0.4), Point::new(0.3, 0.7)])
.expanded(&Point::new(0.1, 0.3))
.approx_eq(&Rect::from_points(&[
Point::new(0.1, 0.1),
Point::new(0.4, 1.0)
]))
);
assert!(
Rect::from_points(&[Point::new(0.2, 0.4), Point::new(0.3, 0.7)])
.expanded(&Point::new(0.1, -0.1))
.approx_eq(&Rect::from_points(&[
Point::new(0.1, 0.5),
Point::new(0.4, 0.6)
]))
);
assert!(
Rect::from_points(&[Point::new(0.2, 0.4), Point::new(0.3, 0.7)])
.expanded(&Point::new(0.1, 0.1))
.approx_eq(&Rect::from_points(&[
Point::new(0.1, 0.3),
Point::new(0.4, 0.8)
]))
);
} | rust_cleaned_test_functions.jsonl/94063 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 648
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14214,
6465,
61664,
368,
341,
286,
2060,
33673,
310,
11920,
486,
1499,
12928,
2099,
58,
2609,
486,
931,
7,
15,
13,
17,
11,
220,
15,
13,
19,
701,
5126,
486,
931,
7,
15,
13,
18,
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_generate_accessor_op_str() {
{
let ops = operations(0, 24).unwrap();
let result = generate_accessor_op_str("test", "u24be", &ops);
let expected = "let b0 = ((test[co + 0] as u24be) << 16) as u24be;\n\
let b1 = ((test[co + 1] as u24be) << 8) as u24be;\n\
let b2 = ((test[co + 2] as u24be)) as u24be;\n\n\
b0 | b1 | b2\n";
assert_eq!(result, expected);
}
{
let ops = operations(0, 16).unwrap();
let result = generate_accessor_op_str("test", "u16be", &ops);
let expected = "let b0 = ((test[co + 0] as u16be) << 8) as u16be;\n\
let b1 = ((test[co + 1] as u16be)) as u16be;\n\n\
b0 | b1\n";
assert_eq!(result, expected);
}
{
let ops = operations(0, 8).unwrap();
let result = generate_accessor_op_str("test", "u8", &ops);
let expected = "(test[co] as u8)";
assert_eq!(result, expected);
}
} | rust_cleaned_test_functions.jsonl/114320 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 554
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48851,
33901,
10287,
2895,
368,
341,
262,
341,
286,
1077,
27132,
284,
7525,
7,
15,
11,
220,
17,
19,
568,
15454,
543,
286,
1077,
1102,
284,
6923,
33901,
10287,
2895,
445,
1944,
497,
330,
84,
17... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.