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_clear_request_count() {
let keypair = Keypair::new();
let mut drone = Drone::new(keypair, None, None);
drone.request_current = drone.request_current + 256;
assert_eq!(drone.request_current, 256);
drone.clear_request_count();
assert_eq!(drone.request_current, 0);
} | rust_cleaned_test_functions.jsonl/123511 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21811,
7893,
3180,
368,
341,
286,
1077,
1376,
12670,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
5206,
26713,
284,
73481,
486,
931,
4857,
12670,
11,
2240,
11,
2240,
317,
286,
26713,
8223,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_has_id() {
use html5ever::LocalName;
let html = "<p id='link_id_456'>hey there</p>";
let fragment = Html::parse_fragment(html);
let sel = Selector::parse("p").unwrap();
let element = fragment.select(&sel).next().unwrap();
assert_eq!(
true,
element.has_id(
&LocalName::from("link_id_456"),
CaseSensitivity::CaseSensitive
)
);
let html = "<p>hey there</p>";
let fragment = Html::parse_fragment(html);
let element = fragment.select(&sel).next().unwrap();
assert_eq!(
false,
element.has_id(
&LocalName::from("any_link_id"),
CaseSensitivity::CaseSensitive
)
);
} | rust_cleaned_test_functions.jsonl/37653 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 433
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21778,
842,
368,
341,
286,
990,
5272,
20,
2054,
486,
7319,
675,
401,
286,
1077,
5272,
284,
4055,
79,
877,
1131,
2080,
842,
62,
19,
20,
21,
6270,
35561,
1052,
522,
79,
6734,
286,
1077,
12289,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_accountsdb_duplicate_fork_should_panic() {
let paths = get_tmp_accounts_path!();
let accounts = AccountsDB::new(0, &paths.paths);
cleanup_paths(&paths.paths);
accounts.add_fork(0, None);
} | rust_cleaned_test_functions.jsonl/77674 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55665,
1999,
70434,
761,
669,
43378,
620,
31270,
368,
341,
286,
1077,
12716,
284,
633,
16125,
55665,
2638,
0,
543,
286,
1077,
9618,
284,
40655,
3506,
486,
931,
7,
15,
11,
609,
21623,
65345,
317,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_into_type() {
assert_eq!(parquet::Type::Boolean, Type::Boolean.into());
assert_eq!(parquet::Type::Int32, Type::Int32.into());
assert_eq!(parquet::Type::Int64, Type::Int64.into());
assert_eq!(parquet::Type::Int96, Type::Int96.into());
assert_eq!(parquet::Type::Float, Type::Float.into());
assert_eq!(parquet::Type::Double, Type::Double.into());
assert_eq!(parquet::Type::ByteArray, Type::ByteArray.into());
assert_eq!(
parquet::Type::FixedLenByteArray,
Type::FixedLenByteArray.into()
);
} | rust_cleaned_test_functions.jsonl/126061 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 218
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45514,
1819,
368,
341,
197,
6948,
10714,
10297,
1732,
23300,
486,
929,
486,
6890,
11,
3990,
486,
6890,
39860,
1423,
197,
6948,
10714,
10297,
1732,
23300,
486,
929,
486,
1072,
18,
17,
11,
3990,
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_get_data() -> Result<(), Box<dyn std::error::Error>> {
fn t(
mut src: &[u8],
actual: &mut sam::record::Data,
expected: &sam::record::Data,
) -> io::Result<()> {
get_data(&mut src, actual)?;
assert_eq!(actual, expected);
Ok(())
}
let mut buf = sam::record::Data::default();
t(&[], &mut buf, &sam::record::Data::default())?;
t(
&[b'N', b'H', b'C', 0x01], // NH:C:0
&mut buf,
&"NH:i:1".parse()?,
)?;
t(
&[
b'N', b'H', b'C', 0x01, // NH:C:0
b'R', b'G', b'Z', b'r', b'g', b'0', 0x00, // RG:Z:rg0
],
&mut buf,
&"NH:i:1\tRG:Z:rg0".parse()?,
)?;
Ok(())
} | rust_cleaned_test_functions.jsonl/53684 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 534
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
1769,
368,
1464,
5714,
68843,
8261,
92846,
1460,
486,
841,
486,
1454,
2452,
341,
286,
5168,
259,
1006,
310,
5206,
2286,
25,
44590,
84,
23,
1259,
310,
5042,
25,
609,
6984,
9962,
486,
8548,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_windowed_histogram_rollover() {
let (clock, ctl) = Clock::mock();
// time when we expect it to be.
let h =
AtomicWindowedHistogram::new(Duration::from_secs(5), Duration::from_millis(999), clock);
let snapshot = h.snapshot();
assert_eq!(snapshot.len(), 0);
h.record(1);
h.record(2);
let snapshot = h.snapshot();
assert_eq!(snapshot.len(), 2);
let total: u64 = snapshot.decompress().iter().sum();
assert_eq!(total, 3);
ctl.increment(Duration::from_secs(3));
let snapshot = h.snapshot();
assert_eq!(snapshot.len(), 2);
let total: u64 = snapshot.decompress().iter().sum();
assert_eq!(total, 3);
ctl.increment(Duration::from_secs(1));
let snapshot = h.snapshot();
assert_eq!(snapshot.len(), 2);
let total: u64 = snapshot.decompress().iter().sum();
assert_eq!(total, 3);
ctl.increment(Duration::from_secs(1));
let snapshot = h.snapshot();
assert_eq!(snapshot.len(), 2);
let total: u64 = snapshot.decompress().iter().sum();
assert_eq!(total, 3);
h.record(3);
h.record(4);
h.record(5);
let snapshot = h.snapshot();
assert_eq!(snapshot.len(), 5);
let total: u64 = snapshot.decompress().iter().sum();
assert_eq!(total, 15);
ctl.increment(Duration::from_secs(1));
let snapshot = h.snapshot();
assert_eq!(snapshot.len(), 3);
let total: u64 = snapshot.decompress().iter().sum();
assert_eq!(total, 12);
ctl.increment(Duration::from_secs(4));
let snapshot = h.snapshot();
assert_eq!(snapshot.len(), 3);
let total: u64 = snapshot.decompress().iter().sum();
assert_eq!(total, 12);
ctl.increment(Duration::from_secs(1));
let snapshot = h.snapshot();
assert_eq!(snapshot.len(), 0);
// We should also be able to advance by vast periods of time and observe not only old
// values going away but no weird overflow issues or index or anything. This ensures that
// our upkeep code functions not just for under-load single bucket rollovers but also "been
// idle for a while and just got a write" scenarios.
h.record(42);
let snapshot = h.snapshot();
assert_eq!(snapshot.len(), 1);
let total: u64 = snapshot.decompress().iter().sum();
assert_eq!(total, 42);
ctl.increment(Duration::from_secs(1000));
let snapshot = h.snapshot();
assert_eq!(snapshot.len(), 0);
} | rust_cleaned_test_functions.jsonl/3583 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1286
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12571,
291,
68564,
62,
43684,
423,
368,
341,
286,
1077,
320,
20666,
11,
64935,
8,
284,
26142,
486,
16712,
1428,
16885,
286,
442,
882,
979,
582,
1720,
432,
311,
387,
624,
286,
1077,
305,
4035,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
let mut v = vec![0, 1, 2, 3, 4, 5];
{
let mut buf = [9; 4];
let slice = Slice::new(&mut v, 2, Some(3));
let bytes = slice.read_at(2, &mut buf).unwrap();
assert_eq!(bytes, 1);
assert_eq!(buf, [4, 9, 9, 9]);
let mut buf = [9; 2];
let bytes = slice.read_at(1, &mut buf).unwrap();
assert_eq!(bytes, 2);
assert_eq!(buf, [3, 4]);
}
{
let slice = Slice::new(&mut v, 2, Some(5));
let mut buf = [9; 6];
let bytes = slice.read_at(2, &mut buf).unwrap();
assert_eq!(bytes, 2);
assert_eq!(buf, [4, 5, 9, 9, 9, 9]);
}
{
// Read too much of unsized slice.
let slice = Slice::new(&mut v, 2, None);
let mut buf = [9; 6];
let bytes = slice.read_at(2, &mut buf).unwrap();
assert_eq!(bytes, 2);
assert_eq!(buf, [4, 5, 9, 9, 9, 9]);
}
// Interleaved read/write to same slice.
let mut v = vec![0, 1, 2, 3, 4, 5];
{
let mut slice = Slice::new(&mut v, 2, Some(3));
let mut buf = [9; 3];
{
let bytes = slice.write_at(2, &buf).unwrap();
assert_eq!(bytes, 1);
}
{
let bytes = slice.read_at(1, &mut buf).unwrap();
assert_eq!(bytes, 2);
}
assert_eq!(buf, [3, 9, 9]);
{
let bytes = slice.write_at(0, &buf[..1]).unwrap();
assert_eq!(bytes, 1);
}
}
assert_eq!(v, vec![0, 1, 3, 3, 9, 5]);
// Write past end.
let mut v = vec![0, 1, 2, 3];
let buf = [9; 6];
// Limited by size.
{
let mut slice = Slice::new(&mut v, 2, Some(5));
let bytes = slice.write_at(1, &buf).unwrap();
assert_eq!(bytes, 4);
}
assert_eq!(v, vec![0, 1, 2, 9, 9, 9, 9]);
// No size.
{
let mut slice = Slice::new(&mut v, 2, None);
let bytes = slice.write_at(1, &buf).unwrap();
assert_eq!(bytes, 6);
}
assert_eq!(v, vec![0, 1, 2, 9, 9, 9, 9, 9, 9]);
// Automatic-size constructor.
let mut v = vec![0, 1, 2, 3];
{
let mut slice = Slice::new_to_end(&mut v, 1).unwrap();
assert_eq!(slice.size().unwrap().unwrap(), 3);
let bytes = slice.write_at(0, &buf).unwrap();
assert_eq!(bytes, 3);
}
assert_eq!(v, vec![0, 9, 9, 9]);
// Slice of slice.
let mut v = vec![0, 1, 2, 3, 4, 5];
{
let mut slice1 = Slice::new(&mut v, 1, Some(4));
let mut slice2 = Slice::new(&mut slice1, 1, Some(2));
let bytes = slice2.write_at(0, &buf).unwrap();
assert_eq!(bytes, 2);
}
assert_eq!(v, vec![0, 1, 9, 9, 4, 5]);
} | rust_cleaned_test_functions.jsonl/115221 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1471
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26488,
368,
341,
262,
1077,
5206,
348,
284,
7486,
20703,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
262,
341,
1789,
286,
1077,
5206,
6607,
284,
508,
24,
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_decode_valid_jwt_rs256() {
let p1 = json!({
"key1" : "val1",
"key2" : "val2"
});
let header = json!({});
let jwt1 = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJrZXkxIjoidmFsMSIsImtleTIiOiJ2YWwyIn0.DFusERCFWCL3CkKBaoVKsi1Z3QO2NTTRDTGHPqm7ctzypKHxLslJXfS1p_8_aRX30V2osMAEfGzXO9U0S9J1Z7looIFNf5rWSEcqA3ah7b7YQ2iTn9LOiDWwzVG8rm_HQXkWq-TXqayA-IXeiX9pVPB9bnguKXy3YrLWhP9pxnhl2WmaE9ryn8WTleMiElwDq4xw5JDeopA-qFS-AyEwlc-CE7S_afBd5OQBRbvgtfv1a9soNW3KP_mBg0ucz5eUYg_ON17BG6bwpAwyFuPdDAXphG4hCsa7GlXea0f7DnYD5e5-CA6O7BPW_EvjaGhL_D9LNWHJuDiSDBwZ4-IEIg".to_string();
let (h1, p1) = decode(&jwt1, &get_rsa_256_public_key_full_path(), Algorithm::RS256).unwrap();
println!("\n{}",h1);
println!("{}",p1);
let jwt2 = encode(header, &get_rsa_256_private_key_full_path(), &p1, Algorithm::RS256).unwrap();
let (h2, p2) = decode(&jwt2, &get_rsa_256_public_key_full_path(), Algorithm::RS256).unwrap();
println!("{}",h2);
println!("{}",p2);
assert_eq!(jwt1, jwt2);
} | rust_cleaned_test_functions.jsonl/51736 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 683
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
8337,
95576,
47115,
17,
20,
21,
368,
341,
286,
1077,
281,
16,
284,
2951,
0,
2262,
310,
330,
792,
16,
1,
549,
330,
831,
16,
756,
310,
330,
792,
17,
1,
549,
330,
831,
17,
698,
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_adjust_val() {
assert_eq!(0.0, adjust_val(-10.0, 0.0, 100.0));
assert_eq!(10.0, adjust_val(10.0, 0.0, 100.0));
assert_eq!(100.0, adjust_val(500.0, 0.0, 100.0));
} | rust_cleaned_test_functions.jsonl/80582 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 123
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44153,
6189,
368,
341,
286,
2060,
10714,
10297,
15,
13,
15,
11,
7500,
6189,
4080,
16,
15,
13,
15,
11,
220,
15,
13,
15,
11,
220,
16,
15,
15,
13,
15,
1106,
286,
2060,
10714,
10297,
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_insert() {
let q = ArrayQueue::new(2);
q.push(1);
q.push(2);
q.push(3);
assert_eq!(q.len(), 2);
assert_eq!(q.pop().unwrap(), 1);
assert_eq!(q.pop().unwrap(), 2);
} | rust_cleaned_test_functions.jsonl/2120 | {
"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,
17678,
368,
341,
286,
1077,
2804,
284,
2910,
7554,
486,
931,
7,
17,
317,
286,
2804,
2552,
7,
16,
317,
286,
2804,
2552,
7,
17,
317,
286,
2804,
2552,
7,
18,
317,
286,
2060,
10714,
10297,
80,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_imports_directive_from_argument() {
const ROOT_SCHEMA: &str = r#"
type _Schema_ @import(types: ["T", "A", "C"])"#;
let document = graphql_parser::parse_schema(ROOT_SCHEMA).expect("Failed to parse root schema");
let schema = Schema::new(DeploymentHash::new("id").unwrap(), document);
match schema
.validate_import_directives()
.into_iter()
.find(|err| *err == SchemaValidationError::ImportDirectiveInvalid) {
None => panic!(
"Expected validation for `{}` to fail due to an @imports directive without a `from` argument",
ROOT_SCHEMA,
),
_ => (),
}
} | rust_cleaned_test_functions.jsonl/10136 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 306
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18434,
82,
32871,
533,
5673,
9025,
368,
341,
262,
733,
35736,
46220,
25,
609,
495,
284,
435,
2,
698,
1313,
716,
8632,
62,
569,
474,
52613,
25,
4383,
51,
497,
330,
32,
497,
330,
34,
1341,
994... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_csp_get_message_2() {
let json = r#"{
"csp-report": {
"document-uri": "http://example.com/foo",
"effective-directive": "script-src",
"blocked-uri": "",
"violated-directive": "script-src 'unsafe-inline'"
}
}"#;
let mut event = Event::default();
Csp::apply_to_event(json.as_bytes(), &mut event).unwrap();
let message = &event.logentry.value().unwrap().formatted;
insta::assert_debug_snapshot!(message.as_str().unwrap(), @r###""Blocked unsafe inline \'script\'""###);
} | rust_cleaned_test_functions.jsonl/4029 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 315
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
2154,
3062,
6462,
62,
17,
368,
341,
286,
1077,
2951,
284,
435,
55543,
515,
310,
330,
66,
2154,
47411,
788,
341,
394,
330,
6062,
87232,
788,
330,
1254,
1110,
8687,
905,
60555,
756,
394,
33... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ui_z_system() {
let mut world = World::default();
let mut queue = CommandQueue::default();
let mut commands = Commands::new(&mut queue, &world);
commands.spawn_bundle(node_with_transform("0"));
commands
.spawn_bundle(node_with_transform("1"))
.with_children(|parent| {
parent
.spawn_bundle(node_with_transform("1-0"))
.with_children(|parent| {
parent.spawn_bundle(node_with_transform("1-0-0"));
parent.spawn_bundle(node_without_transform("1-0-1"));
parent.spawn_bundle(node_with_transform("1-0-2"));
});
parent.spawn_bundle(node_with_transform("1-1"));
parent
.spawn_bundle(node_without_transform("1-2"))
.with_children(|parent| {
parent.spawn_bundle(node_with_transform("1-2-0"));
parent.spawn_bundle(node_with_transform("1-2-1"));
parent
.spawn_bundle(node_with_transform("1-2-2"))
.with_children(|_| ());
parent.spawn_bundle(node_with_transform("1-2-3"));
});
parent.spawn_bundle(node_with_transform("1-3"));
});
commands
.spawn_bundle(node_without_transform("2"))
.with_children(|parent| {
parent
.spawn_bundle(node_with_transform("2-0"))
.with_children(|_parent| ());
parent
.spawn_bundle(node_with_transform("2-1"))
.with_children(|parent| {
parent.spawn_bundle(node_with_transform("2-1-0"));
});
});
queue.apply(&mut world);
let mut schedule = Schedule::default();
let mut update_stage = SystemStage::parallel();
update_stage.add_system(ui_z_system);
schedule.add_stage("update", update_stage);
schedule.run(&mut world);
let mut actual_result = world
.query::<(&Label, &Transform)>()
.iter(&world)
.map(|(name, transform)| (name.clone(), get_steps(transform)))
.collect::<Vec<(Label, u32)>>();
actual_result.sort_unstable_by_key(|(name, _)| name.0);
let expected_result = vec![
(Label("0"), 1),
(Label("1"), 1),
(Label("1-0"), 1),
(Label("1-0-0"), 1),
// 1-0-1 has no transform
(Label("1-0-2"), 3),
(Label("1-1"), 5),
// 1-2 has no transform
(Label("1-2-0"), 1),
(Label("1-2-1"), 2),
(Label("1-2-2"), 3),
(Label("1-2-3"), 4),
(Label("1-3"), 11),
// 2 has no transform
(Label("2-0"), 1),
(Label("2-1"), 2),
(Label("2-1-0"), 1),
];
assert_eq!(actual_result, expected_result);
} | rust_cleaned_test_functions.jsonl/67780 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1780
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22412,
6415,
17687,
368,
341,
286,
1077,
5206,
1879,
284,
4337,
486,
2258,
543,
286,
1077,
5206,
7177,
284,
7348,
7554,
486,
2258,
543,
286,
1077,
5206,
11293,
284,
47183,
486,
931,
2099,
6984,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tick_keeps_counts() {
let mut script = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
script.push("resources/tests/scripts");
let script_dir = script.clone();
script.push("keep_count.lua");
let config = ProgrammableFilterConfig {
scripts_directory: Some(script_dir),
script: Some(script),
forwards: Vec::new(),
config_path: Some("filters.keep_count".to_string()),
tags: Default::default(),
};
let mut cs = ProgrammableFilter::new(config);
let metric0 = metric::Event::new_telemetry(
metric::Telemetry::new()
.name("identity")
.value(12.0)
.kind(metric::AggregationMethod::Set)
.harden()
.unwrap(),
);
let metric1 = metric::Event::new_telemetry(
metric::Telemetry::new()
.name("identity")
.value(13.0)
.kind(metric::AggregationMethod::Set)
.harden()
.unwrap(),
);
let metric2 = metric::Event::new_telemetry(
metric::Telemetry::new()
.name("identity")
.value(14.0)
.kind(metric::AggregationMethod::Set)
.harden()
.unwrap(),
);
let log0 =
metric::Event::new_log(metric::LogLine::new("identity", "a log line"));
let log1 =
metric::Event::new_log(metric::LogLine::new("identity", "another"));
let log2 =
metric::Event::new_log(metric::LogLine::new("identity", "more"));
let log3 =
metric::Event::new_log(metric::LogLine::new("identity", "less"));
let flush1 = metric::Event::TimerFlush(1);
let flush2 = metric::Event::TimerFlush(2);
let mut events = Vec::new();
for ev in &[metric0, metric1, metric2, log0, log1] {
let _ = cs.process(ev.clone(), &mut events);
}
events.clear();
let res = cs.process(flush1, &mut events);
assert!(res.is_ok());
assert!(!events.is_empty());
assert_eq!(events.len(), 3);
println!("EVENTS: {:?}", events);
assert_eq!(events[2], metric::Event::TimerFlush(1));
match events[1] {
metric::Event::Telemetry(ref mut p) => {
assert_eq!(p.name, "count_per_tick");
assert_eq!(p.set(), Some(5.0));
}
_ => {
assert!(false);
}
}
assert_eq!(
events[0],
metric::Event::new_log(metric::LogLine::new(
"filters.keep_count",
"count_per_tick: 5"
))
);
events.clear();
for ev in &[log2, log3] {
let _ = cs.process(ev.clone(), &mut events);
}
events.clear();
let res = cs.process(flush2, &mut events);
assert!(res.is_ok());
assert!(!events.is_empty());
assert_eq!(events.len(), 3);
println!("EVENTS: {:?}", events);
assert_eq!(events[2], metric::Event::TimerFlush(2));
match events[1] {
metric::Event::Telemetry(ref mut p) => {
assert_eq!(p.name, "count_per_tick");
assert_eq!(p.set(), Some(2.0));
}
_ => {
assert!(false);
}
}
assert_eq!(
events[0],
metric::Event::new_log(metric::LogLine::new(
"filters.keep_count",
"count_per_tick: 2"
))
);
} | rust_cleaned_test_functions.jsonl/41374 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2409
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43612,
45476,
7124,
25977,
368,
341,
310,
1077,
5206,
5316,
284,
7933,
15064,
486,
1499,
16978,
17223,
34,
7581,
46,
25143,
91120,
8291,
4010,
310,
5316,
2552,
445,
12745,
62468,
39372,
797,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_backup_mode_long_with_env_var_shortened() {
let _dummy = TEST_MUTEX.lock().unwrap();
env::set_var(ENV_VERSION_CONTROL, "si");
let matches = make_app().get_matches_from(vec!["app", "--backup"]);
let result = determine_backup_mode(&matches).unwrap();
assert_eq!(result, BackupMode::SimpleBackup);
env::remove_var(ENV_VERSION_CONTROL);
} | rust_cleaned_test_functions.jsonl/98151 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44710,
7302,
17799,
6615,
15879,
4612,
16673,
6758,
368,
341,
286,
1077,
716,
31390,
284,
13602,
66994,
21003,
1005,
15454,
543,
286,
6105,
486,
746,
4612,
7,
30360,
10678,
23680,
11,
330,
6321,
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_derive_proof_at_index_trivial() {
let (tx_out_store, env) = init_tx_out_store();
let num_tx_outs: u32 = 6;
let tx_outs = get_tx_outs(num_tx_outs);
{
// Populate the tx_out_store.
let mut rw_transaction = env.begin_rw_txn().unwrap();
for tx_out in &tx_outs {
tx_out_store.push(tx_out, &mut rw_transaction).unwrap();
}
rw_transaction.commit().unwrap();
}
let db_transaction = env.begin_ro_txn().unwrap();
let known_root_hash = tx_out_store.get_root_merkle_hash(&db_transaction).unwrap();
// This is a proof of the last TxOut added to the store.
let proof = tx_out_store
.get_merkle_proof_of_membership(5, &db_transaction)
.unwrap();
let rederived_proof = derive_proof_at_index(&proof).unwrap();
// The rederived proof must be a valid proof.
assert!(is_membership_proof_valid(
tx_outs.get(5).unwrap(),
&rederived_proof,
&known_root_hash
)
.unwrap());
// The rederived proof must equal the original proof.
assert_eq!(proof, rederived_proof);
} | rust_cleaned_test_functions.jsonl/5266 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 615
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35345,
533,
86757,
3752,
3560,
3547,
26658,
368,
341,
286,
1077,
320,
3998,
6068,
14809,
11,
6105,
8,
284,
2930,
17805,
6068,
14809,
543,
286,
1077,
1629,
17805,
6068,
82,
25,
575,
18,
17,
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_simple_scan() -> Result<(), Box<dyn std::error::Error>> {
let table_name = "table--test_simple_scan";
let mut c = setup()?;
c.args(&[
"--region", "local", "table", "create", table_name, "--keys", "pk",
])
.output()?;
let mut c = setup()?;
c.args(&["--region", "local", "--table", table_name, "put", "abc"])
.output()?;
let mut c = setup()?;
let scan_cmd = c.args(&["--region", "local", "--table", table_name, "scan"]);
scan_cmd
.assert()
.success()
.stdout(predicate::str::contains("pk attributes\nabc"));
Ok(cleanup(vec![table_name])?)
} | rust_cleaned_test_functions.jsonl/37974 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 295
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
28857,
368,
1464,
5714,
68843,
8261,
92846,
1460,
486,
841,
486,
1454,
2452,
341,
262,
1077,
1965,
1269,
284,
330,
2005,
313,
1944,
30015,
28857,
3302,
262,
1077,
5206,
272,
284,
6505,
9413... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_switch_implies_cfg_test_unless_cfg_test() {
let matches =
&match getopts(["--test".to_string(), "--cfg=test".to_string()],
optgroups().as_slice()) {
Ok(m) => m,
Err(f) => {
fail!("test_switch_implies_cfg_test_unless_cfg_test: {}",
f.to_err_msg());
}
};
let sessopts = build_session_options(matches);
let sess = build_session(sessopts, None);
let cfg = build_configuration(&sess);
let mut test_items = cfg.iter().filter(|m| m.name().equiv(&("test")));
assert!(test_items.next().is_some());
assert!(test_items.next().is_none());
} | rust_cleaned_test_functions.jsonl/127231 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 399
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27652,
21007,
550,
18343,
4452,
4907,
1717,
18343,
4452,
368,
341,
286,
1077,
9071,
4035,
310,
609,
6347,
633,
10518,
19065,
313,
1944,
3263,
983,
3904,
1507,
14482,
14072,
53538,
3263,
983,
3904,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_valid_nested() {
let json = r#"{"answer":42,"other":21}"#;
let value = Annotated::from(Test {
answer: Annotated::from(42),
other: 21,
});
assert_eq_dbg!(value, serde_json::from_str(json).unwrap());
assert_eq_str!(json, &serde_json::to_string(&value).unwrap());
} | rust_cleaned_test_functions.jsonl/126361 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 180
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8337,
66279,
368,
341,
286,
1077,
2951,
284,
435,
55543,
4913,
9217,
788,
19,
17,
1335,
1575,
788,
17,
16,
9863,
2,
280,
286,
1077,
897,
284,
1527,
87029,
486,
1499,
31159,
341,
310,
4226,
25,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_external_storage_into_file_timed_out() {
use futures_util::stream::{pending, TryStreamExt};
let mut input = pending::<io::Result<&[u8]>>().into_async_read();
let mut output = Vec::new();
let err = block_on_external_io(SSTImporter::read_external_storage_into_file(
&mut input,
&mut output,
&Limiter::new(INFINITY),
0,
usize::MAX,
))
.unwrap_err();
assert_eq!(err.kind(), io::ErrorKind::TimedOut);
} | rust_cleaned_test_functions.jsonl/4961 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 275
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
47432,
23310,
45514,
2458,
29087,
291,
6068,
368,
341,
286,
990,
36823,
18974,
486,
4027,
22964,
28210,
11,
9735,
3027,
6756,
2315,
286,
1077,
5206,
1946,
284,
15280,
27638,
815,
486,
2077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_and_deserialize_putinto() {
let orig = ProgramInstruction::PutIntoBucket {
data: &[7, 8, 9, 10, 11, 12],
offset: 6,
};
let bs = orig.serialize();
let new = parse_program_instruction(bs.as_ref()).unwrap();
assert_eq!(orig, new);
} | rust_cleaned_test_functions.jsonl/128156 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 168
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
8378,
15768,
9050,
15557,
18122,
368,
341,
286,
1077,
2713,
284,
6687,
16664,
486,
19103,
26591,
36018,
341,
310,
821,
25,
44590,
22,
11,
220,
23,
11,
220,
24,
11,
220,
16,
15,
11,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_wait() {
// Grab FORK_MTX so wait doesn't reap a different test's child process
#[allow(unused_variables)]
let m = ::FORK_MTX.lock().expect("Mutex got poisoned by another test");
match fork().expect("Error: Fork Failed") {
Child => unsafe { _exit(0) },
Parent { child } => {
let wait_status = wait();
assert_eq!(wait_status, Ok(WaitStatus::Exited(child, 0)));
},
}
} | rust_cleaned_test_functions.jsonl/8983 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 215
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18760,
368,
341,
262,
442,
36194,
4613,
42,
1245,
22867,
773,
3783,
3171,
944,
56903,
264,
2155,
1273,
594,
1682,
1882,
198,
262,
11506,
7183,
18364,
2591,
28182,
5563,
262,
1077,
296,
284,
3504,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_dirs() {
let d = "subdir/";
let dirname = d.as_ref();
let env = PosixDiskEnv::new();
assert!(env.mkdir(dirname).is_ok());
assert!(env
.open_writable_file(
String::from_iter(vec![d.to_string(), "f1.txt".to_string()].into_iter()).as_ref()
)
.is_ok());
assert_eq!(env.children(dirname).unwrap().len(), 1);
assert!(env.rmdir(dirname).is_ok());
} | rust_cleaned_test_functions.jsonl/75783 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 263
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44869,
368,
341,
286,
1077,
294,
284,
330,
1966,
3741,
37254,
286,
1077,
29908,
284,
294,
5357,
7793,
543,
286,
1077,
6105,
284,
18876,
941,
47583,
14359,
486,
931,
1428,
286,
2060,
10297,
3160,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_misaligned() {
let mut mem = Memory::new(1024);
match mem.read_half_word(3) {
Err(why) => assert_eq!(why, RiscvError::MemoryAlignmentError(3)),
_ => panic!(),
};
match mem.read_word(2) {
Err(why) => assert_eq!(why, RiscvError::MemoryAlignmentError(2)),
_ => panic!(),
};
match mem.write_half_word(3, 0) {
Err(why) => assert_eq!(why, RiscvError::MemoryAlignmentError(3)),
_ => panic!(),
};
match mem.write_word(2, 0) {
Err(why) => assert_eq!(why, RiscvError::MemoryAlignmentError(2)),
_ => panic!(),
};
} | rust_cleaned_test_functions.jsonl/92776 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 369
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
285,
47142,
368,
341,
286,
1077,
5206,
1833,
284,
13850,
486,
931,
7,
16,
15,
17,
19,
626,
286,
2432,
1833,
4125,
40626,
13533,
7,
18,
8,
341,
310,
15495,
7,
34634,
8,
589,
2060,
10714,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_misleading_unicode_anagrams() {
// while the list of potential anagrams uses Latin A and B.
let inputs = ["ABΓ"];
let outputs: Vec<&str> = vec![];
assert_eq!(anagram::anagrams_for("ΑΒΓ", &inputs), outputs);
} | rust_cleaned_test_functions.jsonl/65512 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
285,
20654,
54662,
12008,
68772,
368,
341,
1066,
262,
442,
1393,
279,
1140,
315,
4650,
458,
68772,
5711,
19458,
362,
323,
425,
624,
262,
1077,
11127,
284,
4383,
1867,
145281,
6332,
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_ops_rate_limiter() {
let mem = GuestMemory::new(&[(GuestAddress(0), 0x10000)]).unwrap();
let (mut h, txq, rxq) = default_test_netepollhandler(&mem, TestMutators::default());
let daddr = 0x2000;
assert!(daddr as usize > txq.end().0);
// Test TX ops rate limiting
{
// create ops rate limiter that allows 10 ops/s with bucket size 1 ops
let mut rl = RateLimiter::new(0, None, 0, 1, None, 100).unwrap();
// use up the budget
assert!(rl.consume(1, TokenType::Ops));
// set this tx rate limiter to be used
h.set_tx_rate_limiter(rl);
// try doing TX
txq.avail.idx.set(1);
txq.avail.ring[0].set(0);
txq.dtable[0].set(daddr, 0x1000, 0, 0);
// following TX procedure should fail because of ops rate limiting
{
// trigger the TX handler
h.tx.queue_evt.write(1).unwrap();
h.handle_event(TX_QUEUE_EVENT, EPOLLIN).unwrap();
// assert that limiter is blocked
assert!(h.get_tx_rate_limiter().is_blocked());
// make sure the data is still queued for processing
assert_eq!(txq.used.idx.get(), 0);
}
// wait for 100ms to give the rate-limiter timer a chance to replenish
// wait for an extra 50ms to make sure the timerfd event makes its way from the kernel
thread::sleep(Duration::from_millis(150));
// following TX procedure should succeed because ops should now be available
{
h.handle_event(TX_RATE_LIMITER_EVENT, EPOLLIN).unwrap();
// validate the rate_limiter is no longer blocked
assert!(!h.get_tx_rate_limiter().is_blocked());
// make sure the data queue advanced
assert_eq!(txq.used.idx.get(), 1);
}
}
// Test RX ops rate limiting
{
// create ops rate limiter that allows 10 ops/s with bucket size 1 ops
let mut rl = RateLimiter::new(0, None, 0, 1, None, 100).unwrap();
// use up the budget
assert!(rl.consume(0x800, TokenType::Ops));
// set this rx rate limiter to be used
h.set_rx_rate_limiter(rl);
// set up RX
assert!(!h.rx.deferred_frame);
rxq.avail.idx.set(1);
rxq.avail.ring[0].set(0);
rxq.dtable[0].set(daddr, 0x1000, VIRTQ_DESC_F_WRITE, 0);
// following RX procedure should fail because of ops rate limiting
{
// leave at least one event here so that reading it later won't block
h.interrupt_evt.write(1).unwrap();
// trigger the RX handler
h.handle_event(RX_TAP_EVENT, EPOLLIN).unwrap();
// assert that limiter is blocked
assert!(h.get_rx_rate_limiter().is_blocked());
assert!(h.rx.deferred_frame);
assert_eq!(h.interrupt_evt.read().unwrap(), 1);
// make sure the data is still queued for processing
assert_eq!(rxq.used.idx.get(), 0);
// leave at least one event here so that reading it later won't block
h.interrupt_evt.write(1).unwrap();
h.handle_event(RX_TAP_EVENT, EPOLLIN).unwrap();
assert_eq!(h.interrupt_evt.read().unwrap(), 1);
// make sure the data is still queued for processing
assert_eq!(rxq.used.idx.get(), 0);
}
// wait for 100ms to give the rate-limiter timer a chance to replenish
// wait for an extra 50ms to make sure the timerfd event makes its way from the kernel
thread::sleep(Duration::from_millis(150));
// following RX procedure should succeed because ops should now be available
{
// leave at least one event here so that reading it later won't block
h.interrupt_evt.write(1).unwrap();
h.handle_event(RX_RATE_LIMITER_EVENT, EPOLLIN).unwrap();
// make sure the virtio queue operation completed this time
assert_eq!(h.interrupt_evt.read().unwrap(), 2);
// make sure the data queue advanced
assert_eq!(rxq.used.idx.get(), 1);
assert_eq!(rxq.used.ring[0].get().len, 1234);
}
}
} | rust_cleaned_test_functions.jsonl/84706 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2349
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21959,
9246,
907,
17700,
368,
341,
286,
1077,
1833,
284,
26215,
10642,
486,
931,
2099,
9697,
37804,
4286,
7,
15,
701,
220,
15,
87,
16,
15,
15,
15,
15,
7252,
568,
15454,
543,
286,
1077,
320,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_clone_underlying() {
smol::run(async {
let start = Instant::now();
let a = view(|| async { Instant::now() })
.frequency(Duration::from_millis(100))
.load()
.await;
std::thread::sleep(Duration::from_millis(1000));
let b = a.clone();
assert_eq!(**b.read(), **a.read());
assert!((**b.read()).elapsed().as_secs() < start.elapsed().as_secs());
});
} | rust_cleaned_test_functions.jsonl/62859 | {
"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,
54742,
58228,
6711,
368,
341,
286,
1525,
337,
486,
6108,
18285,
341,
310,
1077,
1191,
284,
18058,
486,
3328,
1428,
310,
1077,
264,
284,
1651,
79453,
3312,
314,
18058,
486,
3328,
368,
2751,
394,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_has_tags() {
let engine = setup();
macro_rules! check {
($tags:expr, $tag:expr, $result:expr) => {
let tag = Tag::new($tag);
let result = engine.check_tag(&tag, &$tags).unwrap();
assert_eq!(
result,
$result,
"Expected {:?} be {}in {:?}",
tag,
if $result { "" } else { "not " },
$tags,
);
};
}
let tags = [
Tag::new("scp"),
Tag::new("euclid"),
Tag::new("ontokinetic"),
Tag::new("humanoid"),
];
// Check tags exist
check!(tags, "scp", true);
check!(tags, "euclid", true);
check!(tags, "ontokinetic", true);
check!(tags, "humanoid", true);
check!(tags, "tale", false);
check!(tags, "keter", false);
check!(tags, "admin", false);
// Check groups exist
check!(tags, "primary", true);
check!(tags, "attribute", true);
check!(tags, "licensing", false);
} | rust_cleaned_test_functions.jsonl/51593 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 530
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21778,
16333,
368,
341,
262,
1077,
4712,
284,
6505,
1428,
262,
18072,
21407,
0,
1779,
341,
286,
1711,
14082,
96011,
11,
400,
4578,
96011,
11,
400,
1382,
96011,
8,
589,
341,
310,
1077,
4772,
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_indent() {
let items = string_vec_to_status(&[
"a/b/file.txt",
]);
let list =
FileTreeItems::new(&items, &BTreeSet::new()).unwrap();
let mut res = list
.items
.iter()
.map(|i| (i.info.indent, i.info.path.as_str()));
assert_eq!(res.next(), Some((0, "a")));
assert_eq!(res.next(), Some((1, "b")));
assert_eq!(res.next(), Some((2, "file.txt")));
} | rust_cleaned_test_functions.jsonl/56872 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 273
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
69045,
368,
341,
286,
1077,
3589,
284,
914,
13251,
2346,
4773,
2099,
9640,
310,
330,
64,
3470,
23903,
3909,
497,
715,
286,
22712,
286,
1077,
1140,
4035,
310,
2887,
6533,
4353,
486,
931,
2099,
36... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_best_repair_shreds() {
let (blockstore, heaviest_subtree_fork_choice) = setup_forks();
let mut repairs = vec![];
let last_shred = blockstore.meta(0).unwrap().unwrap().received;
get_best_repair_shreds(
&heaviest_subtree_fork_choice,
&blockstore,
&mut repairs,
6,
&HashSet::default(),
);
assert_eq!(
repairs,
[0, 1, 2, 4, 3, 5]
.iter()
.map(|slot| RepairType::HighestShred(*slot, last_shred))
.collect::<Vec<_>>()
);
// repairing those new leaves before trying other branches
repairs = vec![];
let best_overall_slot = heaviest_subtree_fork_choice.best_overall_slot().0;
assert_eq!(best_overall_slot, 4);
blockstore.add_tree(
tr(best_overall_slot) / (tr(6) / tr(7)),
true,
false,
2,
Hash::default(),
);
get_best_repair_shreds(
&heaviest_subtree_fork_choice,
&blockstore,
&mut repairs,
6,
&HashSet::default(),
);
assert_eq!(
repairs,
[0, 1, 2, 4, 6, 7]
.iter()
.map(|slot| RepairType::HighestShred(*slot, last_shred))
.collect::<Vec<_>>()
);
// Completing slots should remove them from the repair list
repairs = vec![];
let completed_shreds: Vec<Shred> = [0, 2, 4, 6]
.iter()
.map(|slot| {
let mut shred = Shred::new_from_serialized_shred(
blockstore
.get_data_shred(*slot, last_shred - 1)
.unwrap()
.unwrap(),
)
.unwrap();
shred.set_index(last_shred as u32);
shred.set_last_in_slot();
shred
})
.collect();
blockstore
.insert_shreds(completed_shreds, None, false)
.unwrap();
get_best_repair_shreds(
&heaviest_subtree_fork_choice,
&blockstore,
&mut repairs,
4,
&HashSet::default(),
);
assert_eq!(
repairs,
[1, 7, 3, 5]
.iter()
.map(|slot| RepairType::HighestShred(*slot, last_shred))
.collect::<Vec<_>>()
);
// the parents are complete should still be repaired
repairs = vec![];
blockstore.add_tree(tr(2) / (tr(8)), true, false, 2, Hash::default());
get_best_repair_shreds(
&heaviest_subtree_fork_choice,
&blockstore,
&mut repairs,
4,
&HashSet::default(),
);
assert_eq!(
repairs,
[1, 7, 8, 3]
.iter()
.map(|slot| RepairType::HighestShred(*slot, last_shred))
.collect::<Vec<_>>()
);
} | rust_cleaned_test_functions.jsonl/80141 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1873
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
33101,
1288,
12670,
3712,
53369,
368,
341,
286,
1077,
320,
4574,
4314,
11,
566,
98362,
5228,
9344,
761,
669,
31936,
8,
284,
6505,
761,
73302,
1428,
16885,
286,
1077,
5206,
30186,
284,
7486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_to_snake() {
assert_eq!("foo_bar", &to_snake("FooBar"));
assert_eq!("foo_bar_baz", &to_snake("FooBarBAZ"));
assert_eq!("foo_bar_baz", &to_snake("FooBarBAZ"));
assert_eq!("xml_http_request", &to_snake("XMLHttpRequest"));
assert_eq!("r#while", &to_snake("While"));
assert_eq!("fuzz_buster", &to_snake("FUZZ_BUSTER"));
assert_eq!("foo_bar_baz", &to_snake("foo_bar_baz"));
assert_eq!("fuzz_buster", &to_snake("FUZZ_buster"));
assert_eq!("fuzz", &to_snake("_FUZZ"));
assert_eq!("fuzz", &to_snake("_fuzz"));
assert_eq!("fuzz", &to_snake("_Fuzz"));
assert_eq!("fuzz", &to_snake("FUZZ_"));
assert_eq!("fuzz", &to_snake("fuzz_"));
assert_eq!("fuzz", &to_snake("Fuzz_"));
assert_eq!("fuz_z", &to_snake("FuzZ_"));
assert_eq!("fieldname1", &to_snake("fieldname1"));
assert_eq!("field_name2", &to_snake("field_name2"));
assert_eq!("field_name3", &to_snake("_field_name3"));
assert_eq!("field_name4", &to_snake("field__name4_"));
assert_eq!("field0name5", &to_snake("field0name5"));
assert_eq!("field_0_name6", &to_snake("field_0_name6"));
assert_eq!("field_name7", &to_snake("fieldName7"));
assert_eq!("field_name8", &to_snake("FieldName8"));
assert_eq!("field_name9", &to_snake("field_Name9"));
assert_eq!("field_name10", &to_snake("Field_Name10"));
assert_eq!("field_name12", &to_snake("FIELD_name12"));
assert_eq!("field_name13", &to_snake("__field_name13"));
assert_eq!("field_name14", &to_snake("__Field_name14"));
assert_eq!("field_name15", &to_snake("field__name15"));
assert_eq!("field_name16", &to_snake("field__Name16"));
assert_eq!("field_name17", &to_snake("field_name17__"));
assert_eq!("field_name18", &to_snake("Field_name18__"));
} | rust_cleaned_test_functions.jsonl/86616 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1007
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
28022,
726,
368,
341,
286,
2060,
10714,
17223,
7975,
14388,
497,
609,
983,
28022,
726,
445,
40923,
3428,
4010,
286,
2060,
10714,
17223,
7975,
14388,
880,
1370,
497,
609,
983,
28022,
726,
445... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_empty_record_string() {
let mut tables = make_empty_table_collection(1.0);
let s = String::from("");
let row_id = tables.add_provenance(&s).unwrap();
let _ = tables.provenances().row(row_id).unwrap();
tables.build_index().unwrap();
let mut ts = tables
.tree_sequence(crate::TreeSequenceFlags::default())
.unwrap();
let row_id = ts.add_provenance(&s).unwrap();
let _ = ts.provenances().row(row_id).unwrap();
} | rust_cleaned_test_functions.jsonl/12737 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 257
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
14192,
3904,
368,
341,
1789,
286,
1077,
5206,
12632,
284,
1281,
15124,
5237,
25019,
7,
16,
13,
15,
317,
286,
1077,
274,
284,
923,
486,
1499,
13056,
286,
1077,
2802,
842,
284,
12632,
1364,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multicast() {
let ci = ContactInfo::new_multicast();
assert!(ci.gossip.ip().is_multicast());
assert!(ci.tvu.ip().is_multicast());
assert!(ci.tpu_forwards.ip().is_multicast());
assert!(ci.rpc.ip().is_multicast());
assert!(ci.rpc_pubsub.ip().is_multicast());
assert!(ci.tpu.ip().is_multicast());
assert!(ci.unused.ip().is_multicast());
assert!(ci.serve_repair.ip().is_multicast());
} | rust_cleaned_test_functions.jsonl/84122 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 245
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26290,
35446,
368,
341,
286,
1077,
11825,
284,
9180,
1731,
486,
931,
26290,
35446,
543,
286,
2060,
10297,
5855,
1302,
41473,
23171,
1005,
285,
26290,
35446,
1423,
286,
2060,
10297,
5855,
14485,
84,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_range() {
let r = Range { start: 2, end: 10 };
let mut count = 0;
for (i, ri) in r.enumerate() {
assert!(ri == i + 2);
assert!(ri >= 2 && ri < 10);
count += 1;
}
assert!(count == 8);
} | rust_cleaned_test_functions.jsonl/33483 | {
"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,
9698,
368,
341,
262,
1077,
435,
284,
16437,
314,
1191,
25,
220,
17,
11,
835,
25,
220,
16,
15,
2605,
262,
1077,
5206,
1760,
284,
220,
15,
280,
262,
369,
320,
72,
11,
24185,
8,
304,
435,
555... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_s3_object_uri() {
let uri = parse_uri("s3://foo/bar").unwrap();
assert_eq!(
uri.into_s3object().unwrap(),
s3::S3Object {
bucket: "foo",
key: "bar",
}
);
} | rust_cleaned_test_functions.jsonl/107422 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 175
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
643,
18,
5314,
15572,
368,
341,
286,
1077,
13071,
284,
4715,
15572,
445,
82,
18,
1110,
7975,
49513,
1827,
15454,
543,
286,
2060,
10714,
33673,
310,
13071,
39860,
643,
18,
1700,
1005,
15454,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_websocket_version() {
use header::Headers;
let version = WebSocketVersion::WebSocket13;
let mut headers = Headers::new();
headers.set(version);
assert_eq!(&headers.to_string()[..], "Sec-WebSocket-Version: 13\r\n");
} | rust_cleaned_test_functions.jsonl/125761 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25960,
9556,
9438,
368,
341,
197,
41819,
4247,
486,
10574,
401,
197,
10217,
2319,
284,
47042,
5637,
486,
61238,
16,
18,
280,
197,
10217,
5206,
7102,
284,
21426,
486,
931,
543,
197,
67378,
980,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_command_tokens() {
assert_eq!(Shell::parse_command("foo").unwrap().0, "/api/foo");
assert_eq!(Shell::parse_command("foo `{\"a\": 1}`").unwrap().1, json!({"a": 1}));
} | rust_cleaned_test_functions.jsonl/76573 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
10811,
28838,
368,
341,
286,
2060,
10714,
10297,
25287,
486,
6400,
10811,
445,
7975,
1827,
15454,
1005,
15,
11,
3521,
2068,
60555,
797,
286,
2060,
10714,
10297,
25287,
486,
6400,
10811,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_inline_function_alias2a() {
test(
"function f(x) {} var y; y = f; g(); y();y();",
"function f(x) {} var y; y = f; g(); f();f();",
);
} | rust_cleaned_test_functions.jsonl/27697 | {
"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,
41871,
9174,
35947,
17,
64,
368,
341,
262,
1273,
1006,
286,
330,
1688,
282,
2075,
8,
4687,
762,
379,
26,
379,
284,
282,
26,
342,
2129,
379,
2129,
88,
2129,
756,
286,
330,
1688,
282,
2075,
8,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_negate() {
let value: Int256 = 1i32.into();
let new_value = -value;
assert_eq!(new_value, Int256::from(-1i32));
} | rust_cleaned_test_functions.jsonl/118552 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 70
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28209,
349,
368,
341,
262,
1077,
897,
25,
1333,
17,
20,
21,
284,
220,
16,
72,
18,
17,
39860,
543,
262,
1077,
501,
3142,
284,
481,
957,
280,
262,
2060,
10714,
10297,
931,
3142,
11,
1333,
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 |
#[test]
fn test_pearson_corr() {
let a = Series::new("a", &[1.0f32, 2.0]);
let b = Series::new("b", &[1.0f32, 2.0]);
assert!((cov(&a.f32().unwrap(), &b.f32().unwrap()).unwrap() - 0.5).abs() < 0.001);
assert!((pearson_corr(&a.f32().unwrap(), &b.f32().unwrap()).unwrap() - 1.0).abs() < 0.001);
} | rust_cleaned_test_functions.jsonl/35177 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
8015,
930,
53866,
368,
341,
286,
1077,
264,
284,
11131,
486,
931,
445,
64,
497,
44590,
16,
13,
15,
69,
18,
17,
11,
220,
17,
13,
15,
2558,
286,
1077,
293,
284,
11131,
486,
931,
445,
65,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decimal_schemas() {
let schema = Schema::parse_str(
r#"{
"type": "fixed",
"name": "dec",
"size": 8,
"logicalType": "decimal",
"precision": 12,
"scale": 5
}"#,
)
.unwrap();
let expected = SchemaPiece::Decimal {
precision: 12,
scale: 5,
fixed_size: Some(8),
};
assert_eq!(schema.top_node().inner, &expected);
let schema = Schema::parse_str(
r#"{
"type": "bytes",
"logicalType": "decimal",
"precision": 12,
"scale": 5
}"#,
)
.unwrap();
let expected = SchemaPiece::Decimal {
precision: 12,
scale: 5,
fixed_size: None,
};
assert_eq!(schema.top_node().inner, &expected);
let res = Schema::parse_str(
r#"{
"type": "bytes",
"logicalType": "decimal",
"precision": 12,
"scale": 13
}"#,
);
assert_eq!(
res.unwrap_err().to_string(),
"Failed to parse schema: Decimal scale is greater than precision"
);
let res = Schema::parse_str(
r#"{
"type": "bytes",
"logicalType": "decimal",
"precision": -12
}"#,
);
assert_eq!(
res.unwrap_err().to_string(),
"Failed to parse schema: Decimal precision must be greater than zero"
);
let res = Schema::parse_str(
r#"{
"type": "bytes",
"logicalType": "decimal",
"precision": 12,
"scale": -5
}"#,
);
assert_eq!(
res.unwrap_err().to_string(),
"Failed to parse schema: Decimal scale must be greater than zero"
);
let res = Schema::parse_str(
r#"{
"type": "fixed",
"name": "dec",
"size": 5,
"logicalType": "decimal",
"precision": 12,
"scale": 5
}"#,
);
assert_eq!(
res.unwrap_err().to_string(),
"Failed to parse schema: Decimal precision 12 requires more than 5 bytes of space"
);
} | rust_cleaned_test_functions.jsonl/2988 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1508
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74429,
643,
31126,
368,
341,
286,
1077,
10802,
284,
12539,
486,
6400,
2895,
1006,
310,
435,
55543,
515,
394,
330,
1313,
788,
330,
22021,
756,
394,
330,
606,
788,
330,
8169,
756,
394,
330,
2141,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_account_key() {
let (message, keys) = check_test_loaded_message();
assert_eq!(message.get_account_key(0), Some(&keys[0]));
assert_eq!(message.get_account_key(1), Some(&keys[1]));
assert_eq!(message.get_account_key(2), Some(&keys[2]));
assert_eq!(message.get_account_key(3), Some(&keys[3]));
assert_eq!(message.get_account_key(4), Some(&keys[4]));
assert_eq!(message.get_account_key(5), Some(&keys[5]));
} | rust_cleaned_test_functions.jsonl/34143 | {
"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,
3062,
13500,
3097,
368,
341,
286,
1077,
320,
1994,
11,
6894,
8,
284,
1779,
4452,
49205,
6462,
1428,
286,
2060,
10714,
10297,
1994,
670,
13500,
3097,
7,
15,
701,
4329,
2099,
10563,
58,
15,
14382,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_update_disk_image() {
let mut block = default_block();
let f = TempFile::new().unwrap();
let path = f.as_path();
let mdata = metadata(&path).unwrap();
let mut id = vec![0; VIRTIO_BLK_ID_BYTES as usize];
let str_id = format!("{}{}{}", mdata.st_dev(), mdata.st_rdev(), mdata.st_ino());
let part_id = str_id.as_bytes();
id[..cmp::min(part_id.len(), VIRTIO_BLK_ID_BYTES as usize)]
.clone_from_slice(&part_id[..cmp::min(part_id.len(), VIRTIO_BLK_ID_BYTES as usize)]);
block
.update_disk_image(String::from(path.to_str().unwrap()))
.unwrap();
assert_eq!(block.disk.file.metadata().unwrap().st_ino(), mdata.st_ino());
assert_eq!(block.disk.image_id, id);
} | rust_cleaned_test_functions.jsonl/73925 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 398
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
41687,
4954,
368,
341,
286,
1077,
5206,
2504,
284,
1638,
7113,
543,
286,
1077,
282,
284,
19944,
1703,
486,
931,
1005,
15454,
543,
286,
1077,
1815,
284,
282,
5357,
2638,
543,
286,
1077,
296... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ngram_tokenizer() {
let tokenizer = NGramTokenizer::new("hello", 2, 3, Edge::Neither);
let tokens = tokenizer.collect::<Vec<Token>>();
assert_eq!(tokens, vec![
Token { term: Term::from_string("he"), position: 1 },
Token { term: Term::from_string("hel"), position: 1 },
Token { term: Term::from_string("el"), position: 1 },
Token { term: Term::from_string("ell"), position: 1 },
Token { term: Term::from_string("ll"), position: 1 },
Token { term: Term::from_string("llo"), position: 1 },
Token { term: Term::from_string("lo"), position: 1 },
]);
} | rust_cleaned_test_functions.jsonl/50142 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 304
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1089,
1520,
6458,
3135,
368,
341,
286,
1077,
45958,
284,
20018,
2396,
37434,
486,
931,
445,
14990,
497,
220,
17,
11,
220,
18,
11,
10349,
486,
62195,
317,
286,
1077,
11211,
284,
45958,
29124,
276... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_explode() {
let sn = parse_line("[[[[[9,8],1],2],3],4]");
explode(sn.clone());
assert_eq!("[[[[0,9],2],3],4]", format!("{:?}", sn.borrow()));
let sn = parse_line("[[6,[5,[4,[3,2]]]],1]");
explode(sn.clone());
assert_eq!("[[6,[5,[7,0]]],3]", format!("{:?}", sn.borrow()));
} | rust_cleaned_test_functions.jsonl/51418 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 193
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2702,
70744,
368,
341,
286,
1077,
4131,
284,
4715,
6528,
10937,
15505,
15505,
24,
11,
23,
1125,
16,
1125,
17,
1125,
18,
1125,
19,
37389,
286,
15758,
59865,
15997,
1423,
286,
2060,
10714,
0,
1093... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_canonicalize_idents_by_lowercasing_github_urls() {
let ident1 = ident(&url("https://github.com/PistonDevelopers/piston")).unwrap();
let ident2 = ident(&url("https://github.com/pistondevelopers/piston")).unwrap();
assert_eq!(ident1, ident2);
} | rust_cleaned_test_functions.jsonl/21283 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27421,
22391,
551,
842,
805,
3710,
30425,
66,
4422,
1889,
3827,
32822,
368,
341,
286,
1077,
3524,
16,
284,
3524,
2099,
1085,
445,
2428,
1110,
5204,
905,
16341,
58819,
20444,
388,
4322,
58819,
1519... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bits() {
assert_eq!(BigUint::new(vec!(0,0,0,0)).bits(), 0);
let n: BigUint = FromPrimitive::from_usize(0).unwrap();
assert_eq!(n.bits(), 0);
let n: BigUint = FromPrimitive::from_usize(1).unwrap();
assert_eq!(n.bits(), 1);
let n: BigUint = FromPrimitive::from_usize(3).unwrap();
assert_eq!(n.bits(), 2);
let n: BigUint = BigUint::from_str_radix("4000000000", 16).unwrap();
assert_eq!(n.bits(), 39);
let one: BigUint = One::one();
assert_eq!((one << 426).bits(), 427);
} | rust_cleaned_test_functions.jsonl/90143 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 294
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20034,
368,
341,
286,
2060,
10714,
10297,
15636,
21570,
486,
931,
25592,
10297,
15,
11,
15,
11,
15,
11,
15,
4579,
11516,
1507,
220,
15,
317,
286,
1077,
308,
25,
6164,
21570,
284,
5542,
33313,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_seal_lifecycle_32kib_top_8_8_2() -> Result<()> {
seal_lifecycle::<SectorShape32KiB>(SECTOR_SIZE_32_KIB, &ARBITRARY_POREP_ID)
} | rust_cleaned_test_functions.jsonl/4367 | {
"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,
3453,
278,
907,
19517,
62,
18,
17,
74,
579,
10426,
62,
23,
62,
23,
62,
17,
368,
1464,
5714,
71698,
341,
262,
25349,
907,
19517,
27638,
68188,
12301,
18,
17,
72572,
33,
2235,
925,
26275,
4098,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_sign_verify() {
let gen = Generator::new();
let (privkey, pubkey) = gen.random_keypair().unwrap();
let message = Message::default();
let signature = privkey.sign_recoverable(&message).unwrap();
assert!(pubkey.verify(&message, &signature).is_ok());
} | rust_cleaned_test_functions.jsonl/100076 | {
"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,
11172,
35638,
368,
341,
286,
1077,
4081,
284,
28358,
486,
931,
543,
286,
1077,
320,
11887,
792,
11,
95116,
8,
284,
4081,
7829,
3097,
12670,
1005,
15454,
543,
286,
1077,
1943,
284,
4856,
486,
225... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_setup_group_packages() {
let content = "
dev:
- package:
name: neovim
gui:
- package:
name: alacritty
";
let config = Config::new(&content).unwrap();
let pacman = FakePacman::new();
let ipa = Ipa::new(config, &pacman);
ipa.setup_group("dev").unwrap();
assert_eq!(1, pacman.installed_packages.borrow().len());
} | rust_cleaned_test_functions.jsonl/16553 | {
"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,
21363,
6288,
41874,
368,
341,
286,
1077,
2213,
284,
6228,
3583,
510,
220,
481,
6328,
510,
414,
829,
25,
834,
859,
318,
271,
19109,
510,
220,
481,
6328,
510,
414,
829,
25,
452,
580,
1003,
1881,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stack_size() {
use crate::valid::{Capabilities, ValidationFlags};
// create a module with at least one expression nested
let mut module = crate::Module::default();
let constant = module.constants.append(
crate::Constant {
name: None,
specialization: None,
inner: crate::ConstantInner::Scalar {
value: crate::ScalarValue::Float(1.0),
width: 4,
},
},
Default::default(),
);
let mut fun = crate::Function::default();
let const_expr = fun
.expressions
.append(crate::Expression::Constant(constant), Default::default());
let nested_expr = fun.expressions.append(
crate::Expression::Unary {
op: crate::UnaryOperator::Negate,
expr: const_expr,
},
Default::default(),
);
fun.body.push(
crate::Statement::Emit(fun.expressions.range_from(1)),
Default::default(),
);
fun.body.push(
crate::Statement::If {
condition: nested_expr,
accept: crate::Block::new(),
reject: crate::Block::new(),
},
Default::default(),
);
let _ = module.functions.append(fun, Default::default());
// analyse the module
let info = crate::valid::Validator::new(ValidationFlags::empty(), Capabilities::empty())
.validate(&module)
.unwrap();
// process the module
let mut writer = Writer::new(String::new());
writer
.write(&module, &info, &Default::default(), &Default::default())
.unwrap();
{
// check expression stack
let mut addresses = !0usize..0usize;
for pointer in writer.put_expression_stack_pointers {
addresses.start = addresses.start.min(pointer as usize);
addresses.end = addresses.end.max(pointer as usize);
}
let stack_size = addresses.end - addresses.start;
if !(11000..=25000).contains(&stack_size) {
panic!("`put_expression` stack size {} has changed!", stack_size);
}
}
{
// check block stack
let mut addresses = !0usize..0usize;
for pointer in writer.put_block_stack_pointers {
addresses.start = addresses.start.min(pointer as usize);
addresses.end = addresses.end.max(pointer as usize);
}
let stack_size = addresses.end - addresses.start;
if !(11000..=20000).contains(&stack_size) {
panic!("`put_block` stack size {} has changed!", stack_size);
}
}
} | rust_cleaned_test_functions.jsonl/22157 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1173
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15528,
2368,
368,
341,
262,
990,
17717,
486,
1891,
22964,
55315,
11,
18954,
9195,
2440,
262,
442,
1855,
264,
4688,
448,
518,
3245,
825,
7493,
24034,
198,
262,
1077,
5206,
4688,
284,
17717,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_uswap() {
let mut a = arr2(&[[1, 2, 3], [4, 5, 6], [7, 8, 9]]);
let b = a.clone();
for i in 0..a.rows() {
for j in i + 1..a.cols() {
unsafe { a.uswap((i, j), (j, i)) };
}
}
assert_eq!(a, b.t());
} | rust_cleaned_test_functions.jsonl/103448 | {
"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,
11306,
21726,
368,
341,
262,
1077,
5206,
264,
284,
2890,
17,
2099,
15505,
16,
11,
220,
17,
11,
220,
18,
1125,
508,
19,
11,
220,
20,
11,
220,
21,
1125,
508,
22,
11,
220,
23,
11,
220,
24,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_q2() -> io::Result<()> {
let test = [TEST_Q1, TEST_Q2].concat();
let orbits = parse_lines(test.split('\n').map(|s| Ok(s.to_owned())))?;
assert_eq!(q2(&orbits), 4);
Ok(())
} | rust_cleaned_test_functions.jsonl/23612 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8976,
17,
368,
1464,
6399,
486,
2077,
71698,
341,
286,
1077,
1273,
284,
508,
10033,
13337,
16,
11,
13602,
13337,
17,
936,
20164,
543,
286,
1077,
85128,
284,
4715,
18323,
8623,
5289,
11024,
77,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_internal_constructor() {
let bucket = VectorTokenBucket::new(Duration::from_millis(1000), 100, *D00, 1.0, 1.0);
assert_eq!(100, bucket.burst_limit);
let bucket = VectorTokenBucket::new(Duration::from_millis(1000), 100, *D00, 1e-6, 1.0);
assert_eq!(1, bucket.burst_limit);
let bucket = VectorTokenBucket::new(Duration::from_millis(1000), 100, *D00, 1.0, 1e-6);
assert_eq!(1, bucket.total_limit);
assert_eq!(1, bucket.burst_limit);
} | rust_cleaned_test_functions.jsonl/42325 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 266
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23472,
66210,
368,
341,
310,
1077,
15621,
284,
4196,
3323,
36018,
486,
931,
64114,
486,
1499,
717,
56212,
7,
16,
15,
15,
15,
701,
220,
16,
15,
15,
11,
353,
35,
15,
15,
11,
220,
16,
13,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_required_len_for_format() {
// issue #1292
assert_eq!(
required_len_for_format::<u8>(Format::BC1_RGB_UNORM_BLOCK, [2048, 2048, 1], 1),
2097152
);
// other test cases
assert_eq!(
required_len_for_format::<u8>(Format::R8G8B8A8_UNORM, [2048, 2048, 1], 1),
16777216
);
assert_eq!(
required_len_for_format::<u8>(Format::R4G4_UNORM_PACK8, [512, 512, 1], 1),
262144
);
assert_eq!(
required_len_for_format::<u8>(Format::R8G8B8_USCALED, [512, 512, 1], 1),
786432
);
assert_eq!(
required_len_for_format::<u8>(Format::R32G32_UINT, [512, 512, 1], 1),
2097152
);
assert_eq!(
required_len_for_format::<u32>(Format::R32G32_UINT, [512, 512, 1], 1),
524288
);
assert_eq!(
required_len_for_format::<[u32; 2]>(Format::R32G32_UINT, [512, 512, 1], 1),
262144
);
assert_eq!(
required_len_for_format::<u8>(Format::ASTC_8x8_UNORM_BLOCK, [512, 512, 1], 1),
65536
);
assert_eq!(
required_len_for_format::<u8>(Format::ASTC_12x12_SRGB_BLOCK, [512, 512, 1], 1),
29584
);
} | rust_cleaned_test_functions.jsonl/58631 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 805
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18743,
6043,
5478,
8955,
368,
341,
286,
442,
4265,
671,
16,
17,
24,
17,
198,
286,
2060,
10714,
33673,
310,
2567,
6043,
5478,
8955,
27638,
84,
23,
2235,
4061,
486,
4897,
16,
24815,
6735,
4365,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_breadcrumbs() {
let events = sentry::test::with_captured_events(|| {
sentry::add_breadcrumb(|| sentry::Breadcrumb {
ty: "log".into(),
message: Some("Old breadcrumb to be removed".into()),
..Default::default()
});
sentry::configure_scope(|scope| scope.clear_breadcrumbs());
sentry::add_breadcrumb(|| sentry::Breadcrumb {
ty: "log".into(),
message: Some("First breadcrumb".into()),
..Default::default()
});
sentry::add_breadcrumb(sentry::Breadcrumb {
ty: "log".into(),
message: Some("Second breadcrumb".into()),
..Default::default()
});
sentry::add_breadcrumb(|| {
vec![
sentry::Breadcrumb {
ty: "log".into(),
message: Some("Third breadcrumb".into()),
..Default::default()
},
sentry::Breadcrumb {
ty: "log".into(),
message: Some("Fourth breadcrumb".into()),
..Default::default()
},
]
});
sentry::add_breadcrumb(|| None);
sentry::capture_message("Hello World!", sentry::Level::Warning);
});
assert_eq!(events.len(), 1);
let event = events.into_iter().next().unwrap();
let messages: Vec<_> = event
.breadcrumbs
.iter()
.map(|x| (x.message.as_deref().unwrap(), x.ty.as_str()))
.collect();
assert_eq!(
messages,
vec![
("First breadcrumb", "log"),
("Second breadcrumb", "log"),
("Third breadcrumb", "log"),
("Fourth breadcrumb", "log"),
]
);
} | rust_cleaned_test_functions.jsonl/49568 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 957
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
24466,
368,
341,
262,
1077,
4357,
284,
3208,
884,
486,
1944,
486,
4197,
666,
80228,
19691,
79453,
341,
286,
3208,
884,
486,
718,
880,
17032,
79453,
3208,
884,
486,
75230,
341,
310,
13580,
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... | 6 |
#[test]
fn test_from_ndarray3() {
let hw = RefCell::new(CpuHardware::new());
let src = ndarray::Array3::<f32>::from_shape_vec((2, 2, 2), iota(8)).unwrap();
let dest = src.into_array(&hw);
assert_eq!(*dest.shape(), Shape::new([2, 2, 2]));
assert_eq!(dest.get_values_f32(), iota(8));
} | rust_cleaned_test_functions.jsonl/73989 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
43544,
1653,
18,
368,
341,
262,
1077,
31256,
284,
8550,
3599,
486,
931,
3025,
5584,
66862,
486,
931,
1423,
262,
1077,
2286,
284,
66883,
486,
1857,
18,
27638,
69,
18,
17,
6831,
1499,
13597,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_object_check() {
let file = parse_string("object_test", "a = 1\nb = {c: 2, a}");
let got = check(walk::Node::File(&file));
let want = vec![Error {
location: SourceLocation {
file: Some(String::from("object_test")),
start: Position { line: 2, column: 5 },
end: Position {
line: 2,
column: 14,
},
source: Some(String::from("{c: 2, a}")),
},
message: String::from("cannot mix implicit and explicit properties"),
}];
assert_eq!(want, got);
} | rust_cleaned_test_functions.jsonl/89890 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 290
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5314,
7200,
368,
341,
262,
1077,
1034,
284,
4715,
3904,
445,
1700,
4452,
497,
330,
64,
284,
220,
16,
1699,
65,
284,
314,
66,
25,
220,
17,
11,
264,
20305,
262,
1077,
2684,
284,
1779,
3622,
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_simple_echo() {
BIN_UNDER_TEST
.command()
.args(&[OsStr::new("--log"), LOG_FILE_NAME.as_os_str()])
.args(&["-c", "echo foo"])
.unwrap()
.assert()
.stdout(predicates::str::diff("foo\n").from_utf8());
} | rust_cleaned_test_functions.jsonl/42026 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
68628,
368,
341,
262,
82609,
92614,
11641,
198,
286,
659,
5631,
741,
286,
659,
2116,
2099,
58,
28867,
2580,
486,
931,
21549,
839,
3975,
8081,
8087,
4708,
5357,
29387,
2895,
56024,
286,
659,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mkdirat_with_o_path() {
use rustix::fs::{cwd, mkdirat, openat, statat, unlinkat, AtFlags, FileType, Mode, OFlags};
let tmp = tempfile::tempdir().unwrap();
let dir = openat(
&cwd(),
tmp.path(),
OFlags::RDONLY | OFlags::PATH,
Mode::empty(),
)
.unwrap();
mkdirat(&dir, "foo", Mode::IRWXU).unwrap();
let stat = statat(&dir, "foo", AtFlags::empty()).unwrap();
assert_eq!(FileType::from_raw_mode(stat.st_mode), FileType::Directory);
unlinkat(&dir, "foo", AtFlags::REMOVEDIR).unwrap();
} | rust_cleaned_test_functions.jsonl/61404 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 264
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
12438,
266,
6615,
14179,
2638,
368,
341,
262,
990,
23071,
941,
486,
3848,
22964,
32165,
11,
30073,
266,
11,
1787,
266,
11,
2793,
266,
11,
47479,
266,
11,
2411,
9195,
11,
93238,
11,
14562,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_from_impl_generic_enum() {
check_assist(
generate_from_impl_for_enum,
r#"
//- minicore: from
enum Generic<T, U: Clone> { $0One(T), Two(U) }
"#,
r#"
enum Generic<T, U: Clone> { One(T), Two(U) }
impl<T, U: Clone> From<T> for Generic<T, U> {
fn from(v: T) -> Self {
Self::One(v)
}
}
"#,
);
} | rust_cleaned_test_functions.jsonl/4576 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 219
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
5673,
21007,
41232,
31054,
368,
341,
286,
1779,
12083,
380,
1006,
310,
6923,
5673,
21007,
5478,
31054,
345,
310,
435,
2,
698,
61463,
1308,
292,
460,
25,
504,
198,
9018,
21281,
3125,
11,
54... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_builtin() {
let (genesis_config, mint_keypair) = create_genesis_config(500);
let mut bank = Bank::new(&genesis_config);
fn mock_vote_program_id() -> Pubkey {
Pubkey::new(&[42u8; 32])
}
fn mock_vote_processor(
program_id: &Pubkey,
_instruction_data: &[u8],
_invoke_context: &mut dyn InvokeContext,
) -> std::result::Result<(), InstructionError> {
if mock_vote_program_id() != *program_id {
return Err(InstructionError::IncorrectProgramId);
}
Err(InstructionError::Custom(42))
}
assert!(bank.get_account(&mock_vote_program_id()).is_none());
bank.add_builtin(
"mock_vote_program",
mock_vote_program_id(),
mock_vote_processor,
);
assert!(bank.get_account(&mock_vote_program_id()).is_some());
let mock_account = Keypair::new();
let mock_validator_identity = Keypair::new();
let mut instructions = vote_instruction::create_account(
&mint_keypair.pubkey(),
&mock_account.pubkey(),
&VoteInit {
node_pubkey: mock_validator_identity.pubkey(),
..VoteInit::default()
},
1,
);
instructions[1].program_id = mock_vote_program_id();
let message = Message::new(&instructions, Some(&mint_keypair.pubkey()));
let transaction = Transaction::new(
&[&mint_keypair, &mock_account, &mock_validator_identity],
message,
bank.last_blockhash(),
);
assert_eq!(
bank.process_transaction(&transaction),
Err(TransactionError::InstructionError(
1,
InstructionError::Custom(42)
))
);
} | rust_cleaned_test_functions.jsonl/2608 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 951
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
73829,
368,
341,
286,
1077,
320,
77894,
5332,
11,
28337,
3097,
12670,
8,
284,
1855,
16322,
13774,
5332,
7,
20,
15,
15,
317,
286,
1077,
5206,
6073,
284,
8547,
486,
931,
2099,
77894,
5332,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bootnode_mode_inbound_eviction() {
let node1 = net_service_start("/test/1".to_string());
let node2 = net_service_start("/test/1".to_string());
let node3 = net_service_start("/test/1".to_string());
let node4 = net_service_start("/test/1".to_string());
let node5 = net_service_start("/test/1".to_string());
let node6 = net_service_start("/test/1".to_string());
node2.dial(
&node1,
TargetProtocol::Single(SupportProtocols::Identify.protocol_id()),
);
node3.dial(
&node1,
TargetProtocol::Single(SupportProtocols::Identify.protocol_id()),
);
node4.dial(
&node1,
TargetProtocol::Single(SupportProtocols::Identify.protocol_id()),
);
// Normal connection
wait_connect_state(&node1, 3);
node5.dial(
&node1,
TargetProtocol::Single(SupportProtocols::Identify.protocol_id()),
);
wait_connect_state(&node1, 4);
node6.dial(
&node1,
TargetProtocol::Single(SupportProtocols::Identify.protocol_id()),
);
wait_connect_state(&node1, 3);
} | rust_cleaned_test_functions.jsonl/71181 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 498
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
52062,
3509,
7302,
1243,
10891,
43713,
2479,
368,
341,
262,
1077,
2436,
16,
284,
4179,
12267,
4906,
4283,
1944,
14,
16,
3263,
983,
3904,
1423,
262,
1077,
2436,
17,
284,
4179,
12267,
4906,
4283,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_seek_last() {
let mut it = build_iterator_for_test();
it.seek(Seek::Last).unwrap();
assert!(it.is_valid());
assert_eq!(&full_key(b"k05", 5)[..], it.key());
assert_eq!(b"v05", it.value());
} | rust_cleaned_test_functions.jsonl/5445 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 133
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74473,
12195,
368,
341,
286,
1077,
5206,
432,
284,
1936,
13491,
5478,
4452,
543,
286,
432,
38179,
7,
39350,
486,
5842,
568,
15454,
543,
286,
2060,
10297,
275,
2079,
8337,
1423,
286,
2060,
10714,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serialize_failure() -> Result<(), Box<dyn std::error::Error>> {
#[derive(Serialize)]
struct MyUserData(i64);
impl UserData for MyUserData {}
let lua = Lua::new();
let ud = Value::UserData(lua.create_userdata(MyUserData(123))?);
match serde_json::to_value(&ud) {
Ok(v) => panic!("expected serialization error, got {}", v),
Err(serde_json::Error { .. }) => {}
}
let func = lua.create_function(|_, _: ()| Ok(()))?;
match serde_json::to_value(&Value::Function(func.clone())) {
Ok(v) => panic!("expected serialization error, got {}", v),
Err(serde_json::Error { .. }) => {}
}
let thr = lua.create_thread(func)?;
match serde_json::to_value(&Value::Thread(thr)) {
Ok(v) => panic!("expected serialization error, got {}", v),
Err(serde_json::Error { .. }) => {}
}
Ok(())
} | rust_cleaned_test_functions.jsonl/50702 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 383
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
43618,
368,
1464,
5714,
68843,
8261,
92846,
1460,
486,
841,
486,
1454,
2452,
341,
262,
11506,
27098,
3759,
9050,
5563,
262,
2036,
3017,
39485,
1956,
21,
19,
626,
262,
11605,
71294,
369,
301... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_default_path_home() {
let mut path = home_dir().expect("home dir must exist");
path.push(CLI_CONFIG_PATH);
path.push("config");
assert_eq!(ConfigFile::default_file_path(None).expect("file"), path);
} | rust_cleaned_test_functions.jsonl/4386 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9993,
2638,
21653,
368,
341,
286,
1077,
5206,
1815,
284,
2114,
4334,
1005,
17119,
445,
5117,
5419,
1969,
3000,
797,
286,
1815,
2552,
3025,
18537,
12568,
7944,
317,
286,
1815,
2552,
445,
1676,
797,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_mixed_to_bytes() {
let mut f = compile_test_fn(
"@states 100
@function Void test(Int a, Cell b, Vec7 c, Range d, Rect3 e, CellFilter f) {
assert a == 10
assert b == #20
assert c == [-7, -6, -5, -4, -3, -2, -1]
assert d == (30..40).by(2)
assert e == [50, -60, 70]..[80, -90, 100]
assert f == #0 | #3 | #10 | #99
}",
);
assert_fn_result(
&mut f,
&mut [
ConstValue::Int(10),
ConstValue::CellState(20),
ConstValue::Vector((-7..=-1).collect()),
ConstValue::IntRange {
start: 30,
end: 40,
step: 2,
},
ConstValue::Rectangle(vec![50, -60, 70], vec![80, -90, 100]),
ConstValue::CellStateFilter(CellStateFilter::from_cell_states(100, &[0, 3, 10, 99])),
],
Ok(ConstValue::Void),
);
} | rust_cleaned_test_functions.jsonl/115817 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 549
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
3286,
2346,
12524,
368,
341,
262,
1077,
5206,
282,
284,
19192,
4452,
15246,
1006,
286,
8428,
32069,
220,
16,
15,
15,
198,
286,
569,
1688,
19193,
1273,
24123,
264,
11,
13972,
293,
11,
11312,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_merging_iterator() {
let mut input = vec![];
for i in 1..100 {
input.push(i.to_string());
}
input.sort();
let tests = vec![1, 5, 10, 50];
for t in tests {
let merging_iter = new_test_merging_iter(input.clone(), t);
let origin = TestSimpleArrayIter::new(input.clone());
let mut suite = SortedIterTestSuite::new(origin, merging_iter);
suite.assert_valid(false);
suite.seek_to_first();
suite.assert_key_and_value();
suite.seek_to_last();
suite.assert_key_and_value();
suite.seek("3".as_bytes());
suite.assert_key_and_value();
suite.prev();
suite.assert_key_and_value();
suite.next();
suite.assert_key_and_value();
suite.seek("0".as_bytes());
suite.assert_key_and_value();
suite.seek("9999".as_bytes());
suite.assert_valid(false);
suite.assert_iter_forward();
suite.assert_iter_backward();
}
} | rust_cleaned_test_functions.jsonl/1875 | {
"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,
717,
95296,
13491,
368,
341,
286,
1077,
5206,
1946,
284,
7486,
0,
15078,
286,
369,
600,
304,
220,
16,
496,
16,
15,
15,
341,
310,
1946,
2552,
1956,
2389,
3904,
1423,
286,
456,
286,
1946,
10614,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_fetch_target_description_standard() {
block_on(test_fetch_target_description(
"standard/metadata".to_string(),
TargetDescription::from_slice(
"target with no custom metadata".as_bytes(),
&[HashAlgorithm::Sha256],
)
.unwrap(),
));
} | rust_cleaned_test_functions.jsonl/25471 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11803,
11123,
11448,
48688,
368,
341,
286,
2504,
4470,
8623,
11803,
11123,
11448,
1006,
310,
330,
20270,
3183,
7603,
3263,
983,
3904,
3148,
310,
13483,
5009,
486,
1499,
26488,
1006,
394,
330,
5657,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_expand_uipac() {
let mut foo = expand_uipac("ACGT");
assert_eq!(foo.len(), 1);
assert_eq!(foo.pop().unwrap(), "ACGT");
foo = expand_uipac("");
assert_eq!(foo.len(), 0);
foo = expand_uipac("NN");
let bar = vec![
"AA", "AC", "AG", "AT", "CA", "CC", "CG", "CT", "GA", "GC", "GG", "GT", "TA", "TC",
"TG", "TT",
];
assert_eq!(foo, bar);
foo = expand_uipac("RYS"); //AG CT GC
let bar = vec!["ACG", "ACC", "ATG", "ATC", "GCG", "GCC", "GTG", "GTC"];
assert_eq!(foo, bar);
} | rust_cleaned_test_functions.jsonl/35941 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 342
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67875,
7300,
573,
580,
368,
341,
286,
1077,
5206,
15229,
284,
9225,
7300,
573,
580,
445,
1706,
25388,
797,
286,
2060,
10714,
10297,
7975,
19406,
1507,
220,
16,
317,
286,
2060,
10714,
10297,
7975,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_decode_u32_precomputation_for_G() {
let decode_u32_precomputation_for_G = decode_u32_precomputation(G);
if decode_u32_precomputation_for_G.0 != DECODE_PRECOMPUTATION_FOR_G.0 {
use std::{fs::File, io::Write, path::PathBuf};
let mut f = File::create(PathBuf::from(
"src/encryption/decode_u32_precomputation_for_G.bincode",
))
.unwrap();
f.write_all(&bincode::serialize(&decode_u32_precomputation_for_G).unwrap())
.unwrap();
panic!("Rebuild and run this test again");
}
} | rust_cleaned_test_functions.jsonl/17059 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 333
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
15227,
7300,
18,
17,
10442,
874,
13320,
5478,
2646,
368,
341,
286,
1077,
16895,
7300,
18,
17,
10442,
874,
13320,
5478,
2646,
284,
16895,
7300,
18,
17,
10442,
874,
13320,
6699,
626,
286,
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... | 2 |
#[test]
fn test_rpc() {
let mut runtime = consensus_runtime();
let num_nodes = 2;
let mut senders = Vec::new();
let mut receivers: Vec<NetworkReceivers> = Vec::new();
let mut playground = NetworkPlayground::new(runtime.handle().clone());
let mut nodes = Vec::new();
let (signers, validator_verifier) = random_validator_verifier(num_nodes, None, false);
let peers: Vec<_> = signers.iter().map(|signer| signer.author()).collect();
for (peer_id, peer) in peers.iter().enumerate() {
let (network_reqs_tx, network_reqs_rx) = diem_channel::new(QueueStyle::FIFO, 8, None);
let (connection_reqs_tx, _) = diem_channel::new(QueueStyle::FIFO, 8, None);
let (consensus_tx, consensus_rx) = diem_channel::new(QueueStyle::FIFO, 8, None);
let (_conn_mgr_reqs_tx, conn_mgr_reqs_rx) = channel::new_test(8);
let (_, conn_status_rx) = conn_notifs_channel::new();
let network_sender = ConsensusNetworkSender::new(
PeerManagerRequestSender::new(network_reqs_tx),
ConnectionRequestSender::new(connection_reqs_tx),
);
let network_events = ConsensusNetworkEvents::new(consensus_rx, conn_status_rx);
let twin_id = TwinId {
id: peer_id,
author: *peer,
};
playground.add_node(twin_id, consensus_tx, network_reqs_rx, conn_mgr_reqs_rx);
let (self_sender, self_receiver) = channel::new_test(8);
let node = NetworkSender::new(
*peer,
network_sender.clone(),
self_sender,
validator_verifier.clone(),
);
let (task, receiver) = NetworkTask::new(network_events, self_receiver);
senders.push(network_sender);
receivers.push(receiver);
runtime.handle().spawn(task.start());
nodes.push(node);
}
let receiver_1 = receivers.remove(1);
let node0 = nodes[0].clone();
let peer1 = peers[1];
let vote_msg = VoteMsg::new(
Vote::new(
VoteData::new(BlockInfo::random(1), BlockInfo::random(0)),
peers[0],
placeholder_ledger_info(),
&signers[0],
),
test_utils::placeholder_sync_info(),
);
// verify request block rpc
let mut block_retrieval = receiver_1.block_retrieval;
let on_request_block = async move {
while let Some(request) = block_retrieval.next().await {
// make sure the network task is not blocked during RPC
// we can not process 2 votes and the test will timeout
node0.send_vote(vote_msg.clone(), vec![peer1]).await;
node0.send_vote(vote_msg.clone(), vec![peer1]).await;
playground
.wait_for_messages(2, NetworkPlayground::votes_only)
.await;
let response =
BlockRetrievalResponse::new(BlockRetrievalStatus::IdNotFound, vec![]);
let response = ConsensusMsg::BlockRetrievalResponse(Box::new(response));
let bytes = bcs::to_bytes(&response).unwrap();
request.response_sender.send(Ok(bytes.into())).unwrap();
}
};
runtime.handle().spawn(on_request_block);
let peer = peers[1];
timed_block_on(&mut runtime, async {
let response = nodes[0]
.request_block(
BlockRetrievalRequest::new(HashValue::zero(), 1),
peer,
Duration::from_secs(5),
)
.await
.unwrap();
assert_eq!(response.status(), BlockRetrievalStatus::IdNotFound);
});
} | rust_cleaned_test_functions.jsonl/56483 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1978
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60799,
368,
341,
286,
1077,
5206,
15592,
284,
23869,
33232,
543,
286,
1077,
1629,
14896,
284,
220,
17,
280,
286,
1077,
5206,
3624,
388,
284,
11312,
486,
931,
543,
286,
1077,
5206,
39906,
25,
113... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_fastq_parallel() {
for cap in 3..400 {
let par_reader = Reader::with_capacity(FASTQ, cap);
let mut reader = Reader::new(FASTQ);
seq_io::parallel::parallel_fastq(par_reader, 1, 2,
|_, out| { *out = (); },
|rec, _| { // runs in main thread
let r0 = reader.next().unwrap().unwrap();
assert_eq!(rec.id(), r0.id());
assert_eq!(rec.desc(), r0.desc());
assert_eq!(rec.head(), r0.head());
assert_eq!(rec.seq(), r0.seq());
assert_eq!(rec.qual(), r0.qual());
None::<()>
}).unwrap();
}
} | rust_cleaned_test_functions.jsonl/40340 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 373
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35743,
80,
60625,
368,
1476,
262,
369,
2062,
304,
220,
18,
496,
19,
15,
15,
341,
286,
1077,
1346,
22306,
284,
25166,
486,
4197,
35603,
7,
59206,
48,
11,
2062,
317,
286,
1077,
5206,
6604,
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_AND() {
let code = vec![0xA9, 0x64, 0x29, 0xA0];
let mut nes = Cpu::new();
let mut memory = new_memory(code);
nes.next(&mut memory).unwrap();
nes.next(&mut memory).unwrap();
assert_eq!(0x20, nes.A);
assert_eq!(0, nes.Z);
assert_eq!(0, nes.N);
} | rust_cleaned_test_functions.jsonl/38691 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 190
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21767,
368,
341,
286,
1077,
2038,
284,
7486,
20703,
15,
14673,
24,
11,
220,
15,
87,
21,
19,
11,
220,
15,
87,
17,
24,
11,
220,
15,
14673,
15,
4821,
286,
1077,
5206,
308,
288,
284,
356,
5584... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_gzip_invalid_body() {
let server = server! {
request: b"\
GET /gzip HTTP/1.1\r\n\
user-agent: $USERAGENT\r\n\
accept: */*\r\n\
accept-encoding: gzip\r\n\
host: $HOST\r\n\
\r\n\
",
response: b"\
HTTP/1.1 200 OK\r\n\
Server: test-accept\r\n\
Content-Encoding: gzip\r\n\
Content-Length: 100\r\n\
\r\n\
0"
};
let mut res = reqwest::get(&format!("http://{}/gzip", server.addr())).unwrap();
// is in reading the body
let mut body = std::string::String::new();
res.read_to_string(&mut body).unwrap_err();
} | rust_cleaned_test_functions.jsonl/101447 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 420
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1889,
9964,
31433,
14114,
368,
341,
262,
1077,
3538,
284,
3538,
0,
341,
286,
1681,
25,
293,
83383,
310,
7890,
608,
70996,
10130,
14,
16,
13,
16,
12016,
1699,
5661,
310,
1196,
41935,
25,
400,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_virtio_fs_dax_off_w_virtiofsd_rs_daemon() {
test_virtio_fs(
false,
None,
"never",
&prepare_virtiofsd_rs_daemon,
false,
None,
)
} | rust_cleaned_test_functions.jsonl/26135 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 163
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
2106,
815,
34470,
814,
706,
13651,
1670,
2273,
2106,
815,
3848,
67,
47115,
47070,
7291,
368,
341,
286,
1273,
2273,
2106,
815,
34470,
1006,
310,
895,
345,
310,
2240,
345,
310,
330,
36493,
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_cred_def_id_parts_for_id_as_unqualified_without_tag() {
assert_eq!(
_cred_def_id_unqualified_without_tag(),
_cred_def_id_unqualified_without_tag().to_unqualified()
);
} | rust_cleaned_test_functions.jsonl/38080 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73475,
7844,
842,
33217,
5478,
842,
11898,
4907,
36335,
39904,
9372,
368,
341,
310,
2060,
10714,
33673,
394,
716,
10844,
7844,
842,
4907,
36335,
39904,
9372,
3148,
394,
716,
10844,
7844,
842,
4907,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_health_check() {
let mut cluster = new_server_cluster(0, 1);
cluster.run();
let addr = cluster.sim.rl().get_addr(1);
let env = Arc::new(Environment::new(1));
let channel = ChannelBuilder::new(env).connect(&addr);
let client = HealthClient::new(channel);
let req = HealthCheckRequest {
service: "".to_string(),
..Default::default()
};
let resp = client.check(&req).unwrap();
assert_eq!(ServingStatus::Serving, resp.status.into());
cluster.shutdown();
client.check(&req).unwrap_err();
} | rust_cleaned_test_functions.jsonl/61709 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 223
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45727,
7200,
368,
341,
262,
1077,
5206,
10652,
284,
501,
12015,
28441,
7,
15,
11,
220,
16,
317,
262,
10652,
7634,
1428,
262,
1077,
10789,
284,
10652,
28616,
95196,
1005,
455,
7387,
7,
16,
626,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_type_expression_duration() {
let mut p = Parser::new(r#"duration"#);
let parsed = p.parse_type_expression();
let loc = Locator::new(&p.source[..]);
assert_eq!(
parsed,
TypeExpression {
base: BaseNode {
location: loc.get(1, 1, 1, 9),
..BaseNode::default()
},
monotype: MonoType::Basic(NamedType {
base: BaseNode {
location: loc.get(1, 1, 1, 9),
..BaseNode::default()
},
name: Identifier {
name: "duration".to_string(),
base: BaseNode {
location: loc.get(1, 1, 1, 9),
..BaseNode::default()
},
}
}),
constraints: vec![],
},
)
} | rust_cleaned_test_functions.jsonl/67821 | {
"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,
21039,
1819,
28068,
25454,
368,
341,
262,
1077,
5206,
281,
284,
21102,
486,
931,
2601,
55543,
17021,
57676,
317,
262,
1077,
15676,
284,
281,
4632,
1819,
28068,
543,
262,
1077,
1329,
284,
98653,
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_surface_through_iterator() {
use chrono::{NaiveDate, NaiveDateTime};
use metfor::*;
use optional::some;
let test_data = get_valid_test_data();
let surface_section = SurfaceSection::init(test_data).unwrap();
assert_eq!(surface_section.into_iter().count(), 6);
for sd in &surface_section {
assert_eq!(sd.station_num, 727730);
}
assert_eq!(
surface_section
.into_iter()
.map(|sd| sd.valid_time)
.collect::<Vec<NaiveDateTime>>(),
vec![
NaiveDate::from_ymd(2017, 4, 1).and_hms(0, 0, 0),
NaiveDate::from_ymd(2017, 4, 1).and_hms(3, 0, 0),
NaiveDate::from_ymd(2017, 4, 1).and_hms(6, 0, 0),
NaiveDate::from_ymd(2017, 4, 1).and_hms(9, 0, 0),
NaiveDate::from_ymd(2017, 4, 1).and_hms(12, 0, 0),
NaiveDate::from_ymd(2017, 4, 1).and_hms(15, 0, 0),
]
);
assert_eq!(
surface_section
.into_iter()
.map(|sd| sd.mslp)
.collect::<Vec<_>>(),
vec![
some(HectoPascal(1020.4)),
some(HectoPascal(1021.5)),
some(HectoPascal(1022.3)),
some(HectoPascal(1022.7)),
some(HectoPascal(1022.6)),
some(HectoPascal(1021.8))
]
);
assert_eq!(
surface_section
.into_iter()
.map(|sd| sd.station_pres)
.collect::<Vec<_>>(),
vec![
some(HectoPascal(909.1)),
some(HectoPascal(909.4)),
some(HectoPascal(909.4)),
some(HectoPascal(909.3)),
some(HectoPascal(908.8)),
some(HectoPascal(908.6))
]
);
assert_eq!(
surface_section
.into_iter()
.map(|sd| sd.low_cloud)
.collect::<Vec<_>>(),
vec![
some(1.0),
some(0.52),
some(0.02),
some(0.01),
some(0.03),
some(0.04)
]
);
assert_eq!(
surface_section
.into_iter()
.map(|sd| sd.mid_cloud)
.collect::<Vec<_>>(),
vec![some(0.0); 6]
);
assert_eq!(
surface_section
.into_iter()
.map(|sd| sd.hi_cloud)
.collect::<Vec<_>>(),
vec![
some(0.58),
some(0.61),
some(0.39),
some(0.33),
some(0.49),
some(0.77)
]
);
assert_eq!(
surface_section
.into_iter()
.map(|sd| sd.wind)
.collect::<Vec<_>>(),
vec![
some(WindSpdDir::<Knots>::from(WindUV {
u: MetersPSec(0.9),
v: MetersPSec(-0.1)
})),
some(WindSpdDir::<Knots>::from(WindUV {
u: MetersPSec(1.3),
v: MetersPSec(0.5)
})),
some(WindSpdDir::<Knots>::from(WindUV {
u: MetersPSec(1.1),
v: MetersPSec(0.6)
})),
some(WindSpdDir::<Knots>::from(WindUV {
u: MetersPSec(1.1),
v: MetersPSec(0.6)
})),
some(WindSpdDir::<Knots>::from(WindUV {
u: MetersPSec(0.6),
v: MetersPSec(0.8)
})),
some(WindSpdDir::<Knots>::from(WindUV {
u: MetersPSec(0.4),
v: MetersPSec(0.6)
}))
]
);
} | rust_cleaned_test_functions.jsonl/103922 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2717
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31030,
87399,
13491,
368,
341,
286,
990,
80372,
22964,
16193,
533,
1916,
11,
12812,
533,
7689,
2440,
286,
990,
2270,
1958,
56162,
286,
990,
10101,
486,
14689,
401,
286,
1077,
1273,
1769,
284,
633,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_types() {
let mut vm = build_def_vm();
let mut reader_state = ReaderState::new();
let tokens = tokenize(
&mut vm,
&mut reader_state,
"(one 2 3.0 \"four\" #\\B #t nil 3.5 ())",
None,
);
assert!(tokens.len() == 11);
assert!(tokens[0] == "(");
assert!(tokens[1] == "Symbol:one");
assert!(tokens[2] == "Int:2");
assert!(tokens[3] == "Float:3");
assert!(tokens[4] == "String:\"four\"");
assert!(tokens[5] == "Char:#\\B");
assert!(tokens[6] == "True:true");
assert!(tokens[7] == "nil");
assert!(tokens[8] == "Float:3.5");
assert!(tokens[9] == "nil");
assert!(tokens[10] == ")");
let tokens = tokenize(
&mut vm,
&mut reader_state,
"#(one 2 3.0 \"four\" #\\B #t nil 3.5 ())",
None,
);
assert!(tokens.len() == 11);
assert!(tokens[0] == "#(");
assert!(tokens[1] == "Symbol:one");
assert!(tokens[2] == "Int:2");
assert!(tokens[3] == "Float:3");
assert!(tokens[4] == "String:\"four\"");
assert!(tokens[5] == "Char:#\\B");
assert!(tokens[6] == "True:true");
assert!(tokens[7] == "nil");
assert!(tokens[8] == "Float:3.5");
assert!(tokens[9] == "nil");
assert!(tokens[10] == ")");
let tokens = tokenize(
&mut vm,
&mut reader_state,
"one 2 3.0 \"four\" #\\B #t nil 3.5 ()",
None,
);
assert!(tokens.len() == 11);
assert!(tokens[0] == "#(");
assert!(tokens[1] == "Symbol:one");
assert!(tokens[2] == "Int:2");
assert!(tokens[3] == "Float:3");
assert!(tokens[4] == "String:\"four\"");
assert!(tokens[5] == "Char:#\\B");
assert!(tokens[6] == "True:true");
assert!(tokens[7] == "nil");
assert!(tokens[8] == "Float:3.5");
assert!(tokens[9] == "nil");
assert!(tokens[10] == ")");
} | rust_cleaned_test_functions.jsonl/101094 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1182
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9763,
368,
341,
286,
1077,
5206,
10995,
284,
1936,
7844,
39008,
543,
286,
1077,
5206,
6604,
4387,
284,
25166,
1397,
486,
931,
543,
286,
1077,
11211,
284,
77651,
1006,
310,
609,
6984,
10995,
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... | 1 |
#[test]
fn test_transfer_replay() {
const TOKEN_ID: u16 = 0;
const INITIAL_BALANCE: u64 = 10;
const TOKEN_AMOUNT: u64 = 7;
const FEE_AMOUNT: u64 = 3;
// with the same private key.
const ERR_MSG: &str = "op_valid is true/enforce equal to one";
let account_base = WitnessTestAccount::new(1, INITIAL_BALANCE);
// Create a copy of the base account with the same keys.
let mut account_copy = WitnessTestAccount::new_empty(2);
account_copy.account = account_base.account.clone();
// Input data
let accounts = vec![account_base, account_copy, WitnessTestAccount::new_empty(3)];
let (account_from, account_copy, account_to) = (&accounts[0], &accounts[1], &accounts[2]);
let transfer_op = TransferOp {
tx: account_from
.zksync_account
.sign_transfer(
TOKEN_ID,
"",
BigUint::from(TOKEN_AMOUNT),
BigUint::from(FEE_AMOUNT),
&account_to.account.address,
None,
true,
)
.0,
from: account_copy.id,
to: account_to.id,
};
let input = SigDataInput::from_transfer_op(&transfer_op).expect("SigDataInput creation failed");
incorrect_op_test_scenario::<TransferWitness<Bn256>, _>(
&accounts,
transfer_op,
input,
ERR_MSG,
|| {
vec![CollectedFee {
token: TOKEN_ID,
amount: FEE_AMOUNT.into(),
}]
},
);
} | rust_cleaned_test_functions.jsonl/56191 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 788
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35403,
1288,
1363,
368,
341,
262,
733,
43574,
3450,
25,
575,
16,
21,
284,
220,
15,
280,
262,
733,
56854,
79952,
8440,
25,
575,
21,
19,
284,
220,
16,
15,
280,
262,
733,
43574,
59993,
25,
575,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_get_pubkey_string() {
let pubkey = Pubkey::new_rand();
let str_native = format!("{}", pubkey);
let str_c;
unsafe {
str_c = CString::from_raw(get_pubkey_string(&pubkey));
}
let str_c = str_c.into_string().unwrap();
assert_eq!(str_native, str_c);
} | rust_cleaned_test_functions.jsonl/121328 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 178
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
34014,
792,
3904,
368,
341,
286,
1077,
95116,
284,
22611,
792,
486,
931,
33864,
543,
286,
1077,
607,
44494,
284,
3561,
79878,
95116,
317,
286,
1077,
607,
666,
280,
286,
19860,
341,
310,
60... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_inet6_aton() {
let test_cases = vec![
(Some(b"0.0.0.0".to_vec()), Some(hex("00000000"))),
(Some(b"10.0.5.9".to_vec()), Some(hex("0A000509"))),
(
Some(b"::1.2.3.4".to_vec()),
Some(hex("00000000000000000000000001020304")),
),
(
Some(b"::FFFF:1.2.3.4".to_vec()),
Some(hex("00000000000000000000FFFF01020304")),
),
(
Some(b"::fdfe:5a55:caff:fefa:9089".to_vec()),
Some(hex("000000000000FDFE5A55CAFFFEFA9089")),
),
(
Some(b"fdfe::5a55:caff:fefa:9089".to_vec()),
Some(hex("FDFE0000000000005A55CAFFFEFA9089")),
),
(
Some(b"2001:0db8:85a3:0000:0000:8a2e:0370:7334".to_vec()),
Some(hex("20010db885a3000000008a2e03707334")),
),
(Some(b"".to_vec()), None),
(None, None),
];
for (input, expect_output) in test_cases {
let output = RpnFnScalarEvaluator::new()
.push_param(input)
.evaluate::<Bytes>(ScalarFuncSig::Inet6Aton)
.unwrap();
assert_eq!(output, expect_output);
}
} | rust_cleaned_test_functions.jsonl/59413 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 828
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
295,
21,
3752,
263,
368,
341,
286,
1077,
1273,
41427,
284,
7486,
90515,
310,
320,
8373,
1883,
1,
15,
13,
15,
13,
15,
13,
15,
3263,
983,
13251,
11858,
4329,
44660,
445,
15,
15,
15,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_split_off() {
let mut v1 = LinkedList::new();
v1.push_front(1);
v1.push_front(1);
v1.push_front(1);
v1.push_front(1);
// test all splits
for ix in 0..1 + v1.len() {
let mut a = v1.clone();
let b = a.split_off(ix);
check_links(&a);
check_links(&b);
a.extend(b);
assert_eq!(v1, a);
}
} | rust_cleaned_test_functions.jsonl/21485 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 275
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
13651,
368,
341,
286,
1077,
5206,
348,
16,
284,
22917,
486,
931,
543,
286,
348,
16,
2552,
22926,
7,
16,
317,
286,
348,
16,
2552,
22926,
7,
16,
317,
286,
348,
16,
2552,
22926,
7,
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_timespec_hash() {
use std::hash::{Hash, Hasher};
let c = &Timespec::new(3, 2);
let d = &Timespec::new(2, 1);
let e = &Timespec::new(2, 1);
let mut hasher = ::std::hash::SipHasher::new();
let d_hash:u64 = {
d.hash(&mut hasher);
hasher.finish()
};
hasher = ::std::hash::SipHasher::new();
let e_hash:u64 = {
e.hash(&mut hasher);
hasher.finish()
};
hasher = ::std::hash::SipHasher::new();
let c_hash:u64 = {
c.hash(&mut hasher);
hasher.finish()
};
assert_eq!(d_hash, e_hash);
assert!(c_hash != e_hash);
} | rust_cleaned_test_functions.jsonl/7346 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 398
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22353,
992,
8950,
368,
341,
286,
990,
1460,
486,
8296,
22964,
6370,
11,
6531,
261,
2315,
286,
1077,
272,
284,
609,
18889,
992,
486,
931,
7,
18,
11,
220,
17,
317,
286,
1077,
294,
284,
609,
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_fixed_to_asn1_signature_roundtrip() {
let signature1 = Signature::from_bytes(&EXAMPLE_SIGNATURE).unwrap();
// Convert to ASN.1 DER and back
let asn1_signature = signature1.to_asn1();
let signature2 = Signature::from_asn1(asn1_signature.as_ref()).unwrap();
assert_eq!(signature1, signature2);
} | rust_cleaned_test_functions.jsonl/31927 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37839,
2346,
11898,
77,
16,
39859,
29896,
32981,
368,
341,
286,
1077,
11957,
16,
284,
32232,
486,
1499,
12524,
2099,
95875,
73752,
568,
15454,
1428,
286,
442,
7169,
311,
54855,
13,
16,
46777,
323,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_plain_decode_fixed_len_byte_array() {
let mut data = vec![FixedLenByteArray::default(); 3];
data[0].set_data(ByteBufferPtr::new(String::from("bird").into_bytes()));
data[1].set_data(ByteBufferPtr::new(String::from("come").into_bytes()));
data[2].set_data(ByteBufferPtr::new(String::from("flow").into_bytes()));
let data_bytes = FixedLenByteArrayType::to_byte_array(&data[..]);
let mut buffer = vec![FixedLenByteArray::default(); 3];
test_plain_decode::<FixedLenByteArrayType>(
ByteBufferPtr::new(data_bytes),
3,
4,
&mut buffer[..],
&data[..],
);
} | rust_cleaned_test_functions.jsonl/38512 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 325
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41015,
15227,
37839,
6043,
19737,
3858,
368,
341,
286,
1077,
5206,
821,
284,
7486,
20703,
13520,
11271,
18394,
486,
2258,
2129,
220,
18,
935,
286,
821,
58,
15,
936,
746,
1769,
55823,
4095,
5348,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_binary_literal_to_bit_string() {
let cs: Vec<(Vec<u8>, bool, &str)> = vec![
(vec![], true, "b''"),
(vec![], false, "b''"),
(vec![0x0], true, "b'0'"),
(vec![0x0], false, "b'00000000'"),
(vec![0x0, 0x0], true, "b'0'"),
(vec![0x0, 0x0], false, "b'0000000000000000'"),
(vec![0x1], true, "b'1'"),
(vec![0x1], false, "b'00000001'"),
(vec![0xff, 0x01], true, "b'1111111100000001'"),
(vec![0xff, 0x01], false, "b'1111111100000001'"),
(vec![0x0, 0xff, 0x01], true, "b'1111111100000001'"),
(vec![0x0, 0xff, 0x01], false, "b'000000001111111100000001'"),
];
for (input, trim_zero, expected) in cs {
let lit = BinaryLiteral(input);
assert_eq!(
lit.to_bit_string(trim_zero).as_str(),
expected,
"expect: {}",
expected
);
}
} | rust_cleaned_test_functions.jsonl/12349 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 610
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31761,
34100,
2346,
13996,
3904,
368,
341,
286,
1077,
10532,
25,
11312,
28706,
10050,
34837,
23,
8066,
1807,
11,
609,
495,
16018,
284,
7486,
90515,
310,
320,
4083,
0,
12995,
830,
11,
330,
65,
46... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_protoentry_all_supported_three_values() {
let protocols: UnvalidatedProtoEntry = "LinkAuth=1 Microdesc=1-2 Relay=2".parse().unwrap();
let unsupported: Option<UnvalidatedProtoEntry> = protocols.all_supported();
assert_eq!(true, unsupported.is_none());
} | rust_cleaned_test_functions.jsonl/5153 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 119
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37689,
4085,
5705,
57885,
50016,
9146,
368,
341,
286,
1077,
31785,
25,
1230,
59590,
31549,
5874,
284,
330,
3939,
5087,
28,
16,
18157,
8614,
28,
16,
12,
17,
46172,
28,
17,
3263,
6400,
1005,
15454... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_summation() {
let rng = &mut ark_std::test_rng();
let size = 1 << 4;
let domain = GeneralEvaluationDomain::<Fr>::new(1 << 4).unwrap();
let size_as_fe = domain.size_as_field_element();
let poly = DensePolynomial::rand(size, rng);
let mut sum: Fr = Fr::zero();
for eval in domain.elements().map(|e| poly.evaluate(&e)) {
sum += eval;
}
let first = poly.coeffs[0] * size_as_fe;
let last = *poly.coeffs.last().unwrap() * size_as_fe;
println!("sum: {:?}", sum);
println!("a_0: {:?}", first);
println!("a_n: {:?}", last);
println!("first + last: {:?}\n", first + last);
assert_eq!(sum, first + last);
} | rust_cleaned_test_functions.jsonl/89135 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 373
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10160,
76,
367,
368,
341,
286,
1077,
28422,
284,
609,
6984,
55217,
15656,
486,
1944,
66849,
543,
286,
1077,
1379,
284,
220,
16,
1115,
220,
19,
280,
286,
1077,
7947,
284,
3251,
82363,
13636,
2763... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_safe_panic() {
struct S;
impl Drop for S {
fn drop(&mut self) {
safe_panic!("safe panic on drop");
}
}
let res = panic_hook::recover_safe(|| {
let _s = S;
panic!("first panic");
});
res.unwrap_err();
} | rust_cleaned_test_functions.jsonl/19900 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 197
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34067,
620,
31270,
368,
341,
286,
2036,
328,
280,
286,
11605,
15733,
369,
328,
341,
310,
5168,
5943,
2099,
6984,
656,
8,
341,
394,
6092,
620,
31270,
17223,
18675,
21975,
389,
5943,
797,
310,
456... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_encode_contract_tz3() -> Result<(), failure::Error> {
let decoded = HashType::ContractTz3Hash.bytes_to_string(&hex::decode("193b2b3f6b8f8e1e6b39b4d442fc2b432f6427a8")?);
let expected = "tz3NdTPb3Ax2rVW2Kq9QEdzfYFkRwhrQRPhX";
assert_eq!(expected, decoded);
Ok(())
} | rust_cleaned_test_functions.jsonl/65925 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 172
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
51499,
528,
89,
18,
368,
1464,
5714,
68843,
7901,
486,
1454,
29,
341,
286,
1077,
29213,
284,
6531,
929,
486,
14067,
51,
89,
18,
6370,
42697,
2346,
3904,
2099,
17308,
486,
18196,
445,
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_flock_with_timeout() {
// re-lock it until closing the original file.
let tf1 = tempfile::NamedTempFile::new().unwrap();
let fd1 = tf1.as_raw_fd();
assert!(flock_with_timeout(fd1, 10));
// too.
let tf2 = File::open(tf1.path()).unwrap();
let fd2 = tf2.as_raw_fd();
assert!(!flock_with_timeout(fd2, 1));
// perform a lock.
let tf3 = File::open(tf1.path()).unwrap();
let fd3 = tf3.as_raw_fd();
drop(tf1);
assert!(flock_with_timeout(fd3, 1));
} | rust_cleaned_test_functions.jsonl/49670 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 254
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
1023,
6615,
20537,
368,
341,
1066,
262,
442,
312,
41772,
432,
3080,
15316,
279,
4024,
1034,
624,
262,
1077,
6409,
16,
284,
54819,
486,
15810,
12151,
1703,
486,
931,
1005,
15454,
543,
262,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bip39_random() {
let sizes: [usize; 5] = [16, 20, 24, 28, 32];
let mut rng = thread_rng();
let size = *rng.choose(&sizes).unwrap();
let mut entropy: Vec<u8> = Vec::with_capacity(size);
for _ in 0..size {
let val: u8 = rng.gen();
entropy.push(val);
}
assert_eq!(
entropy,
to_entropy(&from_entropy(&entropy).unwrap()).unwrap()
)
} | rust_cleaned_test_functions.jsonl/9449 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 184
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
573,
18,
24,
22644,
368,
341,
197,
10217,
12282,
25,
508,
51878,
26,
220,
20,
60,
284,
508,
16,
21,
11,
220,
17,
15,
11,
220,
17,
19,
11,
220,
17,
23,
11,
220,
18,
17,
4821,
197,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_gaussian_blur_stdev_3() {
compare_to_truth("zebra.png", "zebra_gaussian_3.png", |image: &GrayImage| {
gaussian_blur_f32(image, 3f32)
});
} | rust_cleaned_test_functions.jsonl/81474 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 90
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1889,
46972,
13141,
324,
1261,
3583,
62,
18,
368,
341,
262,
9429,
2346,
49186,
445,
2986,
14383,
3508,
497,
330,
2986,
14383,
1889,
46972,
62,
18,
3508,
497,
760,
1805,
25,
609,
28174,
1906,
91,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_a280() {
let model = load_tsp("./tests/data/a280.tsp", 20);
assert_eq!(0, model.n_depots());
assert_eq!(280, model.n_nodes());
} | rust_cleaned_test_functions.jsonl/116654 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 82
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4306,
17,
23,
15,
368,
341,
262,
1077,
1614,
284,
2795,
528,
2154,
13988,
23841,
13167,
14186,
17,
23,
15,
734,
2154,
497,
220,
17,
15,
317,
262,
2060,
10714,
10297,
15,
11,
1614,
1253,
49258,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_file_extension_from_marker_line() {
assert_eq!(
get_file_extension_from_marker_line(
"--- src/one.rs 2019-11-20 06:47:56.000000000 +0100"
),
Some("rs")
);
} | rust_cleaned_test_functions.jsonl/72329 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 151
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
2458,
31035,
5673,
26267,
6528,
368,
341,
286,
2060,
10714,
33673,
310,
633,
2458,
31035,
5673,
26267,
6528,
1006,
394,
75894,
2286,
14,
603,
25638,
197,
17,
15,
16,
24,
12,
16,
16,
12,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_solve_innner() {
let p = vec![
0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 3, 0, 0, 0, 0, 0, 1, 0, 9, 0, 0, 0, 0, 5, 0, 0, 0, 2, 0,
0, 3, 1, 0, 0, 0, 0, 1, 4, 0, 6, 7, 8, 0, 0, 0, 7, 8, 6, 5, 2, 9, 0, 3, 4, 5, 6, 7, 0,
9, 3, 0, 0, 1, 8, 9, 1, 4, 5, 6, 3, 7, 2, 0, 2, 4, 0, 8, 7, 5, 0, 9,
];
let expected = vec![
4, 7, 2, 9, 3, 1, 6, 5, 8, 6, 3, 5, 8, 4, 2, 9, 1, 7, 9, 1, 8, 7, 6, 5, 4, 2, 3, 2, 5,
9, 3, 1, 4, 7, 8, 6, 1, 4, 3, 6, 7, 8, 2, 9, 5, 7, 8, 6, 5, 2, 9, 1, 3, 4, 5, 6, 7, 2,
9, 3, 8, 4, 1, 8, 9, 1, 4, 5, 6, 3, 7, 2, 3, 2, 4, 1, 8, 7, 5, 6, 9,
];
assert_eq!(solve_innner(p), expected);
let p = vec![
1, 0, 0, 0, 0, 8, 0, 4, 0, 0, 0, 8, 0, 0, 9, 0, 6, 0, 0, 4, 5, 0, 0, 2, 8, 0, 0, 8, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 7, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 7, 5,
0, 0, 6, 2, 0, 0, 5, 0, 6, 0, 0, 7, 0, 0, 0, 2, 0, 3, 0, 0, 0, 0, 9,
];
let expected = vec![
1, 6, 2, 7, 3, 8, 9, 4, 5, 7, 3, 8, 4, 5, 9, 1, 6, 2, 9, 4, 5, 1, 6, 2, 8, 7, 3, 8, 7,
3, 9, 4, 5, 2, 1, 6, 2, 1, 6, 8, 7, 3, 5, 9, 4, 5, 9, 4, 2, 1, 6, 3, 8, 7, 3, 8, 7, 5,
9, 4, 6, 2, 1, 4, 5, 9, 6, 2, 1, 7, 3, 8, 6, 2, 1, 3, 8, 7, 4, 5, 9,
];
assert_eq!(solve_innner(p), expected);
let p = vec![
0, 8, 0, 0, 0, 6, 5, 0, 0, 0, 0, 9, 0, 0, 7, 0, 0, 3, 5, 0, 0, 3, 0, 2, 0, 6, 0, 0, 4,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 7, 0, 8,
0, 3, 0, 0, 4, 6, 0, 0, 1, 0, 0, 2, 0, 0, 0, 0, 3, 4, 0, 0, 0, 7, 0,
];
let expected = vec![
3, 8, 2, 9, 4, 6, 5, 1, 7, 4, 6, 9, 5, 1, 7, 8, 2, 3, 5, 1, 7, 3, 8, 2, 4, 6, 9, 9, 4,
6, 7, 5, 1, 3, 8, 2, 7, 5, 1, 2, 3, 8, 9, 4, 6, 2, 3, 8, 6, 9, 4, 7, 5, 1, 1, 7, 5, 8,
2, 3, 6, 9, 4, 6, 9, 4, 1, 7, 5, 2, 3, 8, 8, 2, 3, 4, 6, 9, 1, 7, 5,
];
assert_eq!(solve_innner(p), expected);
} | rust_cleaned_test_functions.jsonl/52969 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1421
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
86246,
1243,
77,
1194,
368,
341,
286,
1077,
281,
284,
7486,
90515,
310,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
21,
11,
220,
15,
11,
220,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_key_info() {
let value = 0b1010_0000_0000_0000u16;
let key_info = KeyInformation(value);
assert_eq!(key_info.key_descriptor_version(), 0);
assert!(key_info.smk_message());
let cloned = key_info.clone();
assert_eq!(key_info, cloned);
} | rust_cleaned_test_functions.jsonl/49814 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 151
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3097,
3109,
368,
341,
286,
1077,
897,
284,
220,
15,
65,
16,
15,
16,
15,
62,
15,
15,
15,
15,
62,
15,
15,
15,
15,
62,
15,
15,
15,
15,
84,
16,
21,
280,
286,
1077,
1376,
3109,
284,
5309,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.