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_from_f64() {
let cs = vec![
(
std::f64::INFINITY,
Err(Error::InvalidDataType(String::new())),
),
(
-std::f64::INFINITY,
Err(Error::InvalidDataType(String::new())),
),
(10.123, Ok(Decimal::from_str("10.123").unwrap())),
(-10.123, Ok(Decimal::from_str("-10.123").unwrap())),
(10.111, Ok(Decimal::from_str("10.111").unwrap())),
(-10.111, Ok(Decimal::from_str("-10.111").unwrap())),
(
18446744073709552000.0,
Ok(Decimal::from_str("18446744073709552000").unwrap()),
),
(
-18446744073709552000.0,
Ok(Decimal::from_str("-18446744073709552000").unwrap()),
),
// so these cases can not pass
(
36893488147419103000.0,
Ok(Decimal::from_str("36893488147419103000.0").unwrap()),
),
(
-36893488147419103000.0,
Ok(Decimal::from_str("-36893488147419103000.0").unwrap()),
),
];
for (input, expect) in cs {
let r = Decimal::from_f64(input);
let log = format!(
"input: {}, expect: {:?}, output: {:?}",
input,
expect.as_ref().map(|x| x.to_string()),
r.as_ref().map(|x| x.to_string())
);
match expect {
Err(e) => {
assert!(r.is_err(), "{}", log.as_str());
match e {
Error::InvalidDataType(_) => (),
_ => panic!("{}", log.as_str()),
}
}
Ok(d) => {
assert!(r.is_ok(), "{}", log.as_str());
assert_eq!(r.unwrap(), d, "{}", log.as_str());
}
}
}
} | rust_cleaned_test_functions.jsonl/40303 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1359
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
761,
21,
19,
368,
341,
286,
1077,
10532,
284,
7486,
90515,
310,
2399,
394,
1460,
486,
69,
21,
19,
486,
687,
55990,
345,
394,
15495,
37396,
486,
7928,
22653,
2242,
486,
931,
73727,
310,
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... | 4 |
#[test]
fn test_parse_noise_ik() {
let pubkey_str = "080e287879c918794170e258bfaddd75acac5b3e350419044655e4983a487120";
let pubkey = x25519::PublicKey::from_encoded_string(pubkey_str).unwrap();
let addr = NetworkAddress::from_str(&format!("/ln-noise-ik/{}", pubkey_str)).unwrap();
let expected_suffix: &[Protocol] = &[];
assert_eq!(
parse_noise_ik(addr.as_slice()).unwrap(),
(&pubkey, expected_suffix)
);
let addr =
NetworkAddress::from_str(&format!("/ln-noise-ik/{}/tcp/999", pubkey_str)).unwrap();
let expected_suffix: &[Protocol] = &[Protocol::Tcp(999)];
assert_eq!(
parse_noise_ik(addr.as_slice()).unwrap(),
(&pubkey, expected_suffix)
);
let addr = NetworkAddress::from_str("/tcp/999/memory/123").unwrap();
assert_eq!(None, parse_noise_ik(addr.as_slice()));
} | rust_cleaned_test_functions.jsonl/4283 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 465
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
40313,
62,
1579,
368,
341,
286,
1077,
95116,
2895,
284,
330,
15,
23,
15,
68,
17,
23,
22,
23,
22,
24,
66,
24,
16,
23,
22,
24,
19,
16,
22,
15,
68,
17,
20,
23,
13233,
329,
631,
22,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_addition_minus_infinity() {
let summand1 = ExtendedBigInt::BigInt(BigInt::zero());
let summand2 = ExtendedBigInt::MinusInfinity;
assert_eq!(summand1 + summand2, ExtendedBigInt::MinusInfinity);
} | rust_cleaned_test_functions.jsonl/101399 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 106
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
680,
38457,
1243,
19888,
368,
341,
286,
1077,
2629,
1928,
16,
284,
40565,
87474,
486,
87474,
5349,
343,
1072,
486,
14154,
1423,
286,
1077,
2629,
1928,
17,
284,
40565,
87474,
486,
74458,
4509... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_7xnn_add() {
let mut machine = Machine::new(TestContext::new());
// Seed registers
machine.register_set(0xB, 3);
machine.test_opcode(0x7BCD);
// Should add NN to reg_x
assert_eq!(machine.register_get(0xB), 3 + 0xCD);
// Should increment program counter by two
assert_eq!(machine.pc, PC_BEGIN + 2);
} | rust_cleaned_test_functions.jsonl/127955 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
22,
87,
7370,
2891,
368,
341,
262,
1077,
5206,
5662,
284,
12960,
486,
931,
31159,
1972,
486,
931,
1423,
262,
442,
35822,
24740,
198,
262,
5662,
9929,
2602,
7,
15,
14377,
11,
220,
18,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_link_enum() {
assert_eq!(
GiDocgen::from_str("[enum@Orientation]"),
Ok(GiDocgen::Enum {
namespace: None,
type_: "Orientation".to_string()
})
);
} | rust_cleaned_test_functions.jsonl/78469 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7233,
31054,
368,
341,
286,
2060,
10714,
33673,
310,
15392,
9550,
4370,
486,
1499,
2895,
10937,
9018,
31,
22332,
60,
4461,
310,
7622,
6699,
72,
9550,
4370,
486,
10766,
341,
394,
4473,
25,
2240,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_auto_import_add_use() {
check_assist(
add_import,
"
use stdx;
impl std::fmt::Debug<|> for Foo {
}
",
"
use stdx;
use std::fmt::Debug;
impl Debug<|> for Foo {
}
",
);
} | rust_cleaned_test_functions.jsonl/39948 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 150
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27740,
18434,
2891,
15951,
368,
341,
286,
1779,
12083,
380,
1006,
310,
912,
18434,
345,
310,
6228,
810,
1460,
87,
401,
6383,
1460,
486,
12501,
486,
7939,
27,
91,
29,
369,
33428,
341,
532,
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 |
#[test]
fn test_mime_type_guessing() {
assert_eq!(
from_ext("gif").first_or_octet_stream().to_string(),
"image/gif".to_string()
);
assert_eq!(
from_ext("TXT").first_or_octet_stream().to_string(),
"text/plain".to_string()
);
assert_eq!(
from_ext("blahblah").first_or_octet_stream().to_string(),
"application/octet-stream".to_string()
);
assert_eq!(
from_path(Path::new("/path/to/file.gif"))
.first_or_octet_stream()
.to_string(),
"image/gif".to_string()
);
assert_eq!(
from_path("/path/to/file.gif").first_or_octet_stream().to_string(),
"image/gif".to_string()
);
} | rust_cleaned_test_functions.jsonl/61806 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 303
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
83624,
1819,
54737,
287,
368,
341,
197,
6948,
10714,
33673,
298,
42727,
9927,
445,
33186,
1827,
3896,
8734,
70135,
295,
12673,
1005,
983,
3904,
3148,
298,
197,
1,
1805,
90831,
3263,
983,
3904,
741... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_string() {
let mut p = Parser::new();
assert_eq!(p.string("\"βáƨïç_ƨÆÅ™Ã¯Ã±Ï±\"").1,
Done("", TOMLValue::String("βáƨïç_ƨÆÅ™Ã¯Ã±Ï±".into(), StrType::Basic)));
p = Parser::new();
assert_eq!(p.string(r#""""₥ℓ_βáƨïç_ƨÆÅ™Ã¯Ã±Ï±
ñú₥βèř_ÆÏ‰Ã´
NÛMßÉR-THRÉÉ
""""#).1, Done("", TOMLValue::String(r#"₥ℓ_βáƨïç_ƨÆÅ™Ã¯Ã±Ï±
ñú₥βèř_ÆÏ‰Ã´
NÛMßÉR-THRÉÉ
"#.into(), StrType::MLBasic)));
p = Parser::new();
assert_eq!(p.string("'£ÌTÉR£§TRïNG'").1,
Done("", TOMLValue::String("£ÌTÉR£§TRïNG".into(), StrType::Literal)));
p = Parser::new();
assert_eq!(p.string(r#"'''§ƥřïÆÃ¨
Çôƙè
Þèƥƨï
'''"#).1,
Done("", TOMLValue::String(r#"§ƥřïÆÃ¨
Çôƙè
Þèƥƨï
"#.into(), StrType::MLLiteral)));
} | rust_cleaned_test_functions.jsonl/27411 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 627
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
368,
341,
262,
1077,
5206,
281,
284,
21102,
486,
931,
543,
262,
2060,
10714,
10297,
79,
4804,
38915,
71807,
29456,
18791,
39832,
144839,
75005,
18791,
33985,
18791,
17851,
62,
144839,
75005,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sequences() {
test_roundtrip("var x = (1, 2, 3);");
test_roundtrip("foo((1, 2, 3), 4);");
} | rust_cleaned_test_functions.jsonl/102596 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 60
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58732,
368,
341,
262,
1273,
29896,
32981,
445,
947,
856,
284,
320,
16,
11,
220,
17,
11,
220,
18,
1215,
797,
262,
1273,
29896,
32981,
445,
7975,
1188,
16,
11,
220,
17,
11,
220,
18,
701,
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 |
#[test]
fn test_sum_two_dwords() {
assert_eq!(sum_two_dwords(2000000000, 1000000000), 3000000000);
} | rust_cleaned_test_functions.jsonl/123617 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 59
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10160,
23241,
814,
5761,
368,
972,
286,
2060,
10714,
10297,
1242,
23241,
814,
5761,
7,
17,
15,
15,
15,
15,
15,
15,
15,
15,
15,
11,
220,
16,
15,
15,
15,
15,
15,
15,
15,
15,
15,
701,
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 |
#[test]
fn test_paginated_records_list() {
let mut collection = setup_collection();
collection.create().unwrap();
for _ in 0..10 {
collection.new_record().create().unwrap();
}
let resource = Record::new(collection.clone());
let response = resource
.list_request()
.unwrap()
.limit(3)
.follow_subrequests()
.unwrap();
let records: Vec<Record> = unwrap_collection_records(&response,
&collection.new_record());
assert_eq!(records.len(), 10);
} | rust_cleaned_test_functions.jsonl/63505 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 337
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51003,
15479,
31279,
2019,
368,
341,
286,
1077,
5206,
4426,
284,
6505,
25019,
543,
286,
4426,
2520,
1005,
15454,
543,
286,
369,
716,
304,
220,
15,
496,
16,
15,
341,
310,
4426,
4618,
14192,
1005,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_unsplit_uri() {
assert_eq!(unsplit_uri("", ""), "");
assert_eq!(unsplit_uri("data", ""), "data:");
assert_eq!(unsplit_uri("data", "foo"), "data://foo");
assert_eq!(unsplit_uri("http", ""), "http://");
assert_eq!(unsplit_uri("http", "foo"), "http://foo");
} | rust_cleaned_test_functions.jsonl/4014 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 162
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
6960,
15572,
368,
341,
286,
2060,
10714,
10297,
359,
6960,
15572,
19814,
77130,
14498,
286,
2060,
10714,
10297,
359,
6960,
15572,
445,
691,
497,
77130,
330,
691,
24305,
286,
2060,
10714,
10297... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_take_sized() {
let v = [1, 2, 3];
let mut c = Cursor::new(v);
let (v, got) = take_sized(&mut c, 2).unwrap();
assert_eq!(v, vec![1, 2]);
assert_eq!(got, 2);
let (v, got) = take_sized(&mut c, 2).unwrap();
assert_eq!(v, vec![3]);
assert_eq!(got, 1);
} | rust_cleaned_test_functions.jsonl/107630 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 191
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73261,
643,
1506,
368,
341,
286,
1077,
348,
284,
508,
16,
11,
220,
17,
11,
220,
18,
935,
286,
1077,
5206,
272,
284,
28067,
486,
931,
3747,
317,
286,
1077,
320,
85,
11,
2684,
8,
284,
1896,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_path() {
equal_tokens! {
<nodes>
"chrome.exe" -> b::token_list(vec![b::bare("chrome"), b::op(Operator::Dot), b::bare("exe")])
}
equal_tokens! {
<nodes>
".azure" -> b::token_list(vec![b::op(Operator::Dot), b::bare("azure")])
}
equal_tokens! {
<nodes>
r"C:\windows\system.dll" -> b::token_list(vec![b::bare(r"C:\windows\system"), b::op(Operator::Dot), b::bare("dll")])
}
equal_tokens! {
<nodes>
r"C:\Code\-testing\my_tests.js" -> b::token_list(vec![b::bare(r"C:\Code\-testing\my_tests"), b::op(Operator::Dot), b::bare("js")])
}
} | rust_cleaned_test_functions.jsonl/5861 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 408
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
2638,
368,
341,
286,
6144,
28838,
0,
341,
310,
366,
20008,
397,
310,
330,
31902,
19399,
1,
1464,
293,
486,
5839,
2019,
25592,
20703,
65,
486,
54102,
445,
31902,
3975,
293,
486,
453,
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_samples_in_range() {
use rand::rngs::StdRng;
use rand::SeedableRng;
use rand::distributions::Distribution;
let seed = [
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
];
let mut r: StdRng = SeedableRng::from_seed(seed);
let min = -0.5;
let max = 0.5;
let num_trials = 10_000;
let n = try_create(min, max);
assert!((0..num_trials)
.map(|_| n.sample::<StdRng>(&mut r))
.all(|v| (min <= v) && (v < max))
);
} | rust_cleaned_test_functions.jsonl/47380 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 374
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18297,
1243,
9698,
368,
341,
286,
990,
10382,
486,
69890,
82,
486,
22748,
49,
968,
280,
286,
990,
10382,
486,
41471,
480,
49,
968,
280,
286,
990,
10382,
486,
67,
17994,
486,
62377,
401,
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... | 2 |
#[test]
fn test_split_off_front() {
fn make_block(timestamp: TimeStamp) -> Block {
let transaction = Transaction::new(
AccountIdentifier::new(CanisterId::from_u64(1).get(), None),
AccountIdentifier::new(CanisterId::from_u64(2).get(), None),
ICPTs::new(10000, 50).unwrap(),
TRANSACTION_FEE,
Memo(456),
TimeStamp::new(1, 0),
);
Block::new_from_transaction(None, transaction, timestamp)
}
let start_t: std::time::SystemTime = dfn_core::api::now();
let mut blocks: Vec<EncodedBlock> = vec![];
// blocks[0] is the oldest
for i in 0..10 {
blocks.push(
make_block(TimeStamp::from(start_t + std::time::Duration::new(i, 0)))
.encode()
.unwrap(),
)
}
let all_blocks = blocks.clone();
println!("[test] blocks: {:?}", blocks);
println!("[test] splitting off first 7 blocks");
assert!(blocks.len() == 10);
let split = split_off_front(&mut blocks, 7);
println!("[test] blocks left after split: {:?}", blocks);
assert!(blocks.len() == 3);
println!("[test] blocks which have been split off: {:?}", split);
assert!(split.len() == 7);
assert!(all_blocks[7..=9] == blocks[..]);
assert!(all_blocks[0..=6] == split[..]);
} | rust_cleaned_test_functions.jsonl/43528 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 773
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
13651,
22926,
368,
341,
286,
5168,
1281,
7113,
51027,
25,
4120,
20906,
8,
1464,
8362,
341,
310,
1077,
7745,
284,
17869,
486,
931,
1006,
394,
8615,
8714,
486,
931,
3025,
276,
1571,
764,
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_normalize_path_trailing_slashes_disabled() {
let app = App::new()
.resource("/resource1", |r| r.method(Method::GET).f(index))
.resource("/resource2/", |r| r.method(Method::GET).f(index))
.default_resource(|r| {
r.h(NormalizePath::new(
false,
true,
StatusCode::MOVED_PERMANENTLY,
))
}).finish();
// trailing slashes
let params = vec![
("/resource1", StatusCode::OK),
("/resource1/", StatusCode::MOVED_PERMANENTLY),
("/resource2", StatusCode::NOT_FOUND),
("/resource2/", StatusCode::OK),
("/resource1?p1=1&p2=2", StatusCode::OK),
("/resource1/?p1=1&p2=2", StatusCode::MOVED_PERMANENTLY),
("/resource2?p1=1&p2=2", StatusCode::NOT_FOUND),
("/resource2/?p1=1&p2=2", StatusCode::OK),
];
for (path, code) in params {
let req = TestRequest::with_uri(path).request();
let resp = app.run(req);
let r = &resp.as_msg();
assert_eq!(r.status(), code);
}
} | rust_cleaned_test_functions.jsonl/38137 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 665
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
80807,
2638,
3547,
14277,
11886,
14051,
51401,
368,
341,
286,
1077,
906,
284,
1845,
486,
931,
741,
310,
659,
9233,
4283,
9233,
16,
497,
760,
81,
91,
435,
12908,
35419,
486,
3806,
568,
69,
7195,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_match_group_in_group() {
parse_macro(
r#"
macro_rules! foo {
{ $( ( $($i:ident)* ) )* } => ( $( ( $($i)* ) )* );
}"#,
)
.assert_expand_items("foo! ( (a b) );", "(a b)");
} | rust_cleaned_test_functions.jsonl/28719 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10708,
6288,
1243,
6288,
368,
341,
262,
4715,
58810,
1006,
286,
435,
2,
698,
286,
18072,
21407,
0,
15229,
341,
310,
314,
4930,
320,
93977,
72,
25,
1713,
4806,
873,
89401,
335,
589,
320,
4930,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_request_extract() {
let req = TestRequest::with_uri("/name/user1/?id=test").finish();
let mut router = Router::<()>::default();
router.register_resource(Resource::new(ResourceDef::new("/{key}/{value}/")));
let info = router.recognize(&req, &(), 0);
let req = req.with_route_info(info);
let s = Path::<MyStruct>::from_request(&req, &PathConfig::default()).unwrap();
assert_eq!(s.key, "name");
assert_eq!(s.value, "user1");
let s = Path::<(String, String)>::from_request(&req, &PathConfig::default()).unwrap();
assert_eq!(s.0, "name");
assert_eq!(s.1, "user1");
let s = Query::<Id>::from_request(&req, &QueryConfig::default()).unwrap();
assert_eq!(s.id, "test");
let mut router = Router::<()>::default();
router.register_resource(Resource::new(ResourceDef::new("/{key}/{value}/")));
let req = TestRequest::with_uri("/name/32/").finish();
let info = router.recognize(&req, &(), 0);
let req = req.with_route_info(info);
let s = Path::<Test2>::from_request(&req, &PathConfig::default()).unwrap();
assert_eq!(s.as_ref().key, "name");
assert_eq!(s.value, 32);
let s = Path::<(String, u8)>::from_request(&req, &PathConfig::default()).unwrap();
assert_eq!(s.0, "name");
assert_eq!(s.1, 32);
let res = Path::<Vec<String>>::extract(&req).unwrap();
assert_eq!(res[0], "name".to_owned());
assert_eq!(res[1], "32".to_owned());
} | rust_cleaned_test_functions.jsonl/46187 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 713
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7893,
39123,
368,
341,
286,
1077,
4232,
284,
3393,
1900,
486,
4197,
15572,
4283,
606,
11739,
16,
17763,
307,
53538,
1827,
30150,
1428,
286,
1077,
5206,
9273,
284,
10554,
27638,
368,
6831,
2258,
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_jwt_initialize_claims() {
let key = service_account_key_from_file(&TEST_PRIVATE_KEY_PATH.to_string()).unwrap();
let scopes = vec!["scope1", "scope2", "scope3"];
let claims = super::init_claims_from_key(&key, &scopes);
assert_eq!(claims.iss,
"oauth2-public-test@sanguine-rhythm-105020.iam.gserviceaccount.com".to_string());
assert_eq!(claims.scope, "scope1 scope2 scope3".to_string());
assert_eq!(claims.aud,
"https://accounts.google.com/o/oauth2/token".to_string());
assert!(claims.exp > 1000000000);
assert!(claims.iat < claims.exp);
assert_eq!(claims.exp - claims.iat, 3595);
} | rust_cleaned_test_functions.jsonl/25282 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 346
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
95576,
40889,
6794,
25676,
368,
341,
286,
1077,
1376,
284,
2473,
13500,
3097,
5673,
2458,
2099,
10033,
30470,
6600,
7944,
2389,
3904,
6011,
15454,
543,
286,
1077,
50598,
284,
7486,
0,
1183,
4186,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_massive_task_creation() {
let test_tasks = 4_200_000;
let pool = Pool::<ThunkWorker<()>>::new(TEST_TASKS);
let b0 = Arc::new(Barrier::new(TEST_TASKS + 1));
let b1 = Arc::new(Barrier::new(TEST_TASKS + 1));
let (tx, rx) = channel();
for i in 0..test_tasks {
let tx = tx.clone();
let (b0, b1) = (b0.clone(), b1.clone());
pool.execute(Thunk::of(move || {
// Wait until the pool has been filled once.
if i < TEST_TASKS {
b0.wait();
// wait so the pool can be measured
b1.wait();
}
tx.send(1).is_ok();
}));
}
b0.wait();
assert_eq!(pool.active_count(), TEST_TASKS);
b1.wait();
assert_eq!(rx.iter().take(test_tasks).fold(0, |a, b| a + b), test_tasks);
pool.join();
let atomic_active_count = pool.active_count();
assert!(
atomic_active_count == 0,
"atomic_active_count: {}",
atomic_active_count
);
} | rust_cleaned_test_functions.jsonl/22900 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 647
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36714,
533,
12184,
46163,
368,
341,
286,
1077,
1273,
32823,
284,
220,
19,
62,
17,
15,
15,
62,
15,
15,
15,
401,
286,
1077,
7314,
284,
22728,
27638,
38223,
21936,
27,
368,
77595,
931,
50320,
263... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_cli_compatibility() {
let input = include_bytes!("../../assets/example.txt.zst");
let output = decode_all(&input[..]).unwrap();
let expected = include_bytes!("../../assets/example.txt");
assert_eq!(
&output[..],
&expected[..],
"error decoding cli-compressed data"
);
} | rust_cleaned_test_functions.jsonl/134372 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47147,
2965,
53053,
368,
341,
262,
1077,
1946,
284,
2924,
12524,
17223,
2748,
5160,
65182,
3909,
3938,
267,
3071,
262,
1077,
2550,
284,
16895,
5705,
2099,
1355,
95874,
10697,
15454,
1428,
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_scheme() {
assert_eq!(scheme("https://yay"), Ok(("yay", Scheme::HTTPS)));
assert_eq!(scheme("http://yay"), Ok(("yay", Scheme::HTTP)));
assert_eq!(
scheme("bla://yay"),
Err(NomErr::Error(VerboseError {
errors: vec![
("bla://yay", VerboseErrorKind::Nom(ErrorKind::Tag)),
("bla://yay", VerboseErrorKind::Nom(ErrorKind::Alt)),
("bla://yay", VerboseErrorKind::Context("scheme")),
]
}))
);
} | rust_cleaned_test_functions.jsonl/118912 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 326
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53293,
368,
341,
286,
2060,
10714,
10297,
46141,
445,
2428,
1110,
88,
352,
3975,
7622,
30873,
88,
352,
497,
43781,
486,
82354,
4945,
286,
2060,
10714,
10297,
46141,
445,
1254,
1110,
88,
352,
3975,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_and_load_snapshot() {
// Create diff snapshot.
let (snapshot_file, memory_file) = verify_create_snapshot(true);
// Create a new microVm from snapshot. This only tests code-level logic; it verifies
// that a microVM can be built with no errors from given snapshot.
// It does _not_ verify that the guest is actually restored properly. We're using
// python integration tests for that.
verify_load_snapshot(snapshot_file, memory_file);
// Create full snapshot.
let (snapshot_file, memory_file) = verify_create_snapshot(false);
// Create a new microVm from snapshot. This only tests code-level logic; it verifies
// that a microVM can be built with no errors from given snapshot.
// It does _not_ verify that the guest is actually restored properly. We're using
// python integration tests for that.
verify_load_snapshot(snapshot_file, memory_file);
} | rust_cleaned_test_functions.jsonl/132812 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 288
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
8378,
12411,
53265,
368,
341,
262,
442,
4230,
3638,
16295,
624,
262,
1077,
320,
35501,
2458,
11,
4938,
2458,
8,
284,
10146,
8657,
53265,
3715,
317,
262,
442,
4230,
264,
501,
8003,
88124,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_1() {
let program = vec![
3, 26, 1001, 26, -4, 26, 3, 27, 1002, 27, 2, 27, 1, 27, 26, 27, 4, 27, 1001, 28, -1, 28,
1005, 28, 6, 99, 0, 0, 5,
];
let mut amps = Amplifiers::new(&program, &[9, 8, 7, 6, 5]);
let actual = amps.run_to_end(0);
assert_eq!(actual, 139_629_729);
} | rust_cleaned_test_functions.jsonl/69054 | {
"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,
62,
16,
368,
341,
262,
1077,
2025,
284,
7486,
90515,
414,
220,
18,
11,
220,
17,
21,
11,
220,
16,
15,
15,
16,
11,
220,
17,
21,
11,
481,
19,
11,
220,
17,
21,
11,
220,
18,
11,
220,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_write_various() {
let tmp = tempfile::Builder::new()
.prefix("rust-htslib")
.tempdir()
.expect("Cannot create temp dir");
let out_path = tmp.path().join("test_various.out.vcf");
let vcf = Reader::from_path(&"test/test_various.vcf").expect("Error opening file.");
// The writer goes into its own block so we can ensure that the file is closed and
// all data is written below.
{
let mut writer = Writer::from_path(
&out_path,
&Header::from_template(&vcf.header()),
true,
Format::VCF,
)
.expect("Error opening file.");
let header = writer.header().clone();
let mut record = writer.empty_record();
record.set_rid(Some(0));
assert_eq!(record.rid().unwrap(), 0);
record.set_pos(12);
assert_eq!(record.pos(), 12);
assert_eq!(str::from_utf8(record.id().as_ref()).unwrap(), ".");
record.set_id(b"to_be_cleared").unwrap();
assert_eq!(
str::from_utf8(record.id().as_ref()).unwrap(),
"to_be_cleared"
);
record.clear_id().unwrap();
assert_eq!(str::from_utf8(record.id().as_ref()).unwrap(), ".");
record.set_id(b"first_id").unwrap();
record.push_id(b"second_id").unwrap();
record.push_id(b"first_id").unwrap();
assert!(record.filters().next().is_none());
record.set_filters(&[header.name_to_id(b"q10").unwrap()]);
record.push_filter(header.name_to_id(b"s50").unwrap());
record.remove_filter(header.name_to_id(b"q10").unwrap(), true);
record.push_filter(header.name_to_id(b"q10").unwrap());
record.set_alleles(&[b"C", b"T", b"G"]).unwrap();
record.set_qual(10.0);
record.push_info_integer(b"N1", &[32]).unwrap();
record.push_info_float(b"F1", &[33.0]).unwrap();
record.push_info_string(b"S1", &[b"fourtytwo"]).unwrap();
record.push_info_flag(b"X1").unwrap();
record
.push_genotypes(&[
GenotypeAllele::Unphased(0),
GenotypeAllele::Unphased(1),
GenotypeAllele::Unphased(1),
GenotypeAllele::Phased(1),
])
.unwrap();
record
.push_format_string(b"FS1", &[&b"yes"[..], &b"no"[..]])
.unwrap();
record.push_format_integer(b"FF1", &[43, 11]).unwrap();
record.push_format_float(b"FN1", &[42.0, 10.0]).unwrap();
record
.push_format_char(b"CH1", &[b"A"[0], b"B"[0]])
.unwrap();
writer.write(&record).unwrap();
}
let expected = read_all("test/test_various.out.vcf");
let actual = read_all(&out_path);
assert_eq!(expected, actual);
} | rust_cleaned_test_functions.jsonl/8773 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1715
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
4612,
1223,
368,
341,
1789,
286,
1077,
4174,
284,
54819,
486,
3297,
486,
931,
741,
310,
659,
11849,
445,
35788,
12,
426,
82,
2740,
1138,
310,
659,
3888,
3741,
741,
310,
659,
17119,
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_canonicalize_idents_by_stripping_trailing_url_slash() {
let ident1 = ident(&url("https://github.com/PistonDevelopers/piston/"));
let ident2 = ident(&url("https://github.com/PistonDevelopers/piston"));
assert_eq!(ident1, ident2);
} | rust_cleaned_test_functions.jsonl/74051 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 121
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27421,
22391,
551,
842,
805,
3710,
1261,
461,
10732,
3547,
14277,
2903,
11886,
988,
368,
341,
286,
1077,
3524,
16,
284,
3524,
2099,
1085,
445,
2428,
1110,
5204,
905,
16341,
58819,
20444,
388,
4322... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_default_headers() {
let server = server::http(move |req| {
async move {
assert_eq!(req.headers()["reqwest-test"], "orly");
http::Response::default()
}
});
let mut headers = http::HeaderMap::with_capacity(1);
headers.insert("reqwest-test", "orly".parse().unwrap());
let client = reqwest::blocking::Client::builder()
.default_headers(headers)
.build()
.unwrap();
let url = format!("http://{}/1", server.addr());
let res = client.get(&url).send().unwrap();
assert_eq!(res.url().as_str(), &url);
assert_eq!(res.status(), reqwest::StatusCode::OK);
} | rust_cleaned_test_functions.jsonl/131409 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 286
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9993,
26719,
368,
341,
262,
1077,
3538,
284,
3538,
486,
1254,
34081,
760,
2958,
91,
341,
286,
3312,
3271,
341,
310,
2060,
10714,
10297,
2958,
18022,
64322,
2958,
11039,
16839,
7914,
330,
269,
398,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_intraday_volumes_400_failed() {
let it = crawler::IntradayBuilder::default().build();
assert_err!(it.volumes("").call(), Err(FugleError::General(_)));
} | rust_cleaned_test_functions.jsonl/49451 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 75
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
47026,
352,
2273,
19705,
62,
19,
15,
15,
35060,
368,
341,
262,
1077,
432,
284,
73094,
486,
641,
47026,
352,
3297,
486,
2258,
1005,
5834,
543,
262,
2060,
9266,
10297,
275,
3133,
19705,
8082... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_article_without_reply() {
let documents = load_document("../tests/Soft_Job_M.1181804025.A.7A7.html");
let article_date = Some(
FixedOffset::east(8 * 3600)
.ymd(2007, 6, 14)
.and_hms(14, 53, 44),
);
assert_eq!(parse_replies(&documents, article_date).len(), 0)
} | rust_cleaned_test_functions.jsonl/87157 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 194
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
37321,
39904,
15323,
368,
341,
286,
1077,
9293,
284,
2795,
26231,
17409,
23841,
14,
30531,
10598,
674,
1245,
13,
16,
16,
23,
16,
23,
15,
19,
15,
17,
20,
875,
13,
22,
32,
22,
2564,
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,
1,
1... | 1 |
#[test]
fn test_extensible_extended_1() {
// from playground
serialize_and_deserialize_uper(
16,
&[0x83, 0xD6],
&BasicConstrainedExtensible {
abc: BitVec::from_bytes(vec![0b1010_1100], 7),
},
);
} | rust_cleaned_test_functions.jsonl/50182 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9927,
36764,
61678,
62,
16,
368,
341,
262,
442,
504,
41615,
198,
262,
24235,
8378,
15768,
9050,
62,
3466,
1006,
286,
220,
16,
21,
345,
286,
44590,
15,
87,
23,
18,
11,
220,
15,
15764,
21,
125... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_arp_table_static_cancel_waiting_timer() {
let mut ctx = DummyContext::default();
// Perform a lookup in order to kick off a request and install a retry
// timer.
lookup(&mut ctx, (), TEST_LOCAL_MAC, TEST_REMOTE_IPV4);
// We should be in the Waiting state.
assert!(ctx.get_ref().arp_state.table.get_remaining_tries(TEST_REMOTE_IPV4).is_some());
// We should have an ARP request retry timer set.
validate_single_retry_timer(&ctx, DEFAULT_ARP_REQUEST_PERIOD, TEST_REMOTE_IPV4);
// Now insert a static entry.
insert_static_neighbor(&mut ctx, (), TEST_REMOTE_IPV4, TEST_REMOTE_MAC);
// The timer should have been canceled.
assert_eq!(ctx.timers().len(), 0);
// We should have notified the device layer.
assert_eq!(ctx.get_ref().addr_resolved.as_slice(), [(TEST_REMOTE_IPV4, TEST_REMOTE_MAC)]);
} | rust_cleaned_test_functions.jsonl/17004 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 414
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
7876,
5237,
25360,
28895,
84683,
16255,
368,
341,
1789,
23459,
286,
1077,
5206,
5635,
284,
50567,
1972,
486,
2258,
1428,
286,
442,
25001,
264,
18615,
304,
1973,
311,
10323,
1007,
264,
1681,
32... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multi_comparisons_corner_cases() {
for (&x, &y, &z) in iproduct!(test_values(), test_values(), test_values()) {
println!("Testing combined comparisons with inputs {:?}", (x, y, z));
test_multi_comparisons(x, y, z);
}
} | rust_cleaned_test_functions.jsonl/122904 | {
"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,
25133,
2965,
1732,
19379,
66884,
41427,
368,
341,
262,
369,
15899,
87,
11,
609,
88,
11,
609,
89,
8,
304,
5997,
299,
1058,
10297,
1944,
9146,
1507,
1273,
9146,
1507,
1273,
9146,
2140,
341,
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... | 2 |
#[test]
fn test_random_bit_extraction() {
// Length of the data vector we'll be extracting from.
let len = 20;
let rng = &mut XorShiftRng::from_seed(TEST_SEED);
let data: Vec<u8> = (0..len).map(|_| rng.gen()).collect();
// TODO: Evaluate designing a scattered pattered of `pos` and `num_bits`
// instead of repeating too many iterations with any number.
for _ in 0..100 {
let pos = rng.gen_range(0..data.len() / 2);
let num_bits = rng.gen_range(1..data.len() * 8 - pos);
let new_offset = rng.gen_range(0..8);
let mut bv = BitVec::<LittleEndian, u8>::new();
bv.extend(
BitVec::<LittleEndian, u8>::from(&data[..])
.into_iter()
.skip(pos)
.take(num_bits),
);
let shifted_bv: BitVec<LittleEndian, u8> = bv >> new_offset;
assert_eq!(
shifted_bv.as_slice(),
&extract_bits_and_shift(&data, pos, num_bits, new_offset)[..],
);
}
} | rust_cleaned_test_functions.jsonl/75455 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 598
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22644,
13996,
94842,
368,
341,
286,
442,
17287,
315,
279,
821,
4621,
582,
3278,
387,
59408,
504,
624,
286,
1077,
2422,
284,
220,
17,
15,
401,
286,
1077,
28422,
284,
609,
6984,
1599,
269,
24841,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_unaligned_sizes() {
macro_rules! test_size {
($size:expr) => {
let mut buf = FixedVecDeque::<[u32; $size]>::new();
assert_eq!(buf.back(), None);
assert_eq!(buf.front(), None);
assert_eq!(buf.get(0), None);
assert_eq!(buf.get_mut(0), None);
for i in 1..($size + 1) {
*buf.push_back() = i;
assert_eq!(buf.front(), Some(&1));
assert_eq!(buf.back(), Some(&i));
assert_eq!(buf.get(0), Some(&1));
assert_eq!(buf.get(buf.len() - 1), Some(&i));
assert_eq!(buf[0], 1);
assert_eq!(buf[buf.len() - 1], i);
}
let mut buf = FixedVecDeque::<[u32; $size]>::new();
assert_eq!(buf.back(), None);
assert_eq!(buf.front(), None);
assert_eq!(buf.get(0), None);
assert_eq!(buf.get_mut(0), None);
for i in 1..($size + 1) {
*buf.push_front() = i;
assert_eq!(buf.back(), Some(&1));
assert_eq!(buf.front(), Some(&i));
assert_eq!(buf.get(buf.len() - 1), Some(&1));
assert_eq!(buf.get(0), Some(&i));
assert_eq!(buf[buf.len() - 1], 1);
assert_eq!(buf[0], i);
}
};
}
test_size!(0);
test_size!(1);
test_size!(2);
test_size!(3);
test_size!(4);
test_size!(5);
test_size!(6);
test_size!(7);
test_size!(8);
test_size!(9);
test_size!(10);
test_size!(11);
test_size!(12);
test_size!(13);
test_size!(14);
test_size!(15);
test_size!(16);
test_size!(20);
test_size!(24);
test_size!(32);
test_size!(36);
} | rust_cleaned_test_functions.jsonl/3285 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1266
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
47142,
32159,
368,
341,
286,
18072,
21407,
0,
1273,
2368,
341,
310,
1711,
2141,
96011,
8,
589,
341,
394,
1077,
5206,
6607,
284,
20149,
10050,
73891,
27638,
58,
84,
18,
17,
26,
400,
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... | 3 |
#[test]
fn test_le_advertising_data() {
let buf = [7, 2, 240, 255, 229, 255, 224, 255];
assert_eq!(le_advertising_data(&buf), Ok((&[][..],
vec![ServiceClassUUID16(65520),
ServiceClassUUID16(65509),
ServiceClassUUID16(65504)])));
let buf = [18,9,76,69,68,66,108,117,101,45,69,65,57,55,66,55,65,51,32];
assert_eq!(le_advertising_data(&buf), Ok((&[][..], vec![
LocalName(String::from("LEDBlue-EA97B7A3 "))])));
} | rust_cleaned_test_functions.jsonl/125937 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 418
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11751,
10027,
29924,
1769,
368,
341,
286,
1077,
6607,
284,
508,
22,
11,
220,
17,
11,
220,
17,
19,
15,
11,
220,
17,
20,
20,
11,
220,
17,
17,
24,
11,
220,
17,
20,
20,
11,
220,
17,
17,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_locate_latest_common_block2() {
let consensus = Consensus::default();
let (chain_controller1, shared1, _notify1) = start_chain(Some(consensus.clone()), None);
let (chain_controller2, shared2, _notify2) = start_chain(Some(consensus.clone()), None);
let block_number = 200;
let mut blocks: Vec<BlockView> = Vec::new();
let mut parent = consensus.genesis_block().header().to_owned();
for i in 1..block_number {
let parent_epoch = shared1.store().get_block_epoch(&parent.hash()).unwrap();
let epoch = shared1
.next_epoch_ext(&parent_epoch, &parent)
.unwrap_or(parent_epoch);
let new_block = gen_block(&shared1, &parent, &epoch, i);
blocks.push(new_block.clone());
chain_controller1
.process_block(Arc::new(new_block.clone()), false)
.expect("process block ok");
chain_controller2
.process_block(Arc::new(new_block.clone()), false)
.expect("process block ok");
parent = new_block.header().to_owned();
}
parent = blocks[150].header().to_owned();
let fork = parent.number();
for i in 1..=block_number {
let parent_epoch = shared2.store().get_block_epoch(&parent.hash()).unwrap();
let epoch = shared2
.next_epoch_ext(&parent_epoch, &parent)
.unwrap_or(parent_epoch);
let new_block = gen_block(&shared2, &parent, &epoch, i + 100);
chain_controller2
.process_block(Arc::new(new_block.clone()), false)
.expect("process block ok");
parent = new_block.header().to_owned();
}
let synchronizer1 = gen_synchronizer(chain_controller1.clone(), shared1.clone());
let synchronizer2 = gen_synchronizer(chain_controller2.clone(), shared2.clone());
let locator1 = synchronizer1
.shared
.get_locator(shared1.snapshot().tip_header());
let latest_common = synchronizer2
.shared
.locate_latest_common_block(&H256::zero().pack(), &locator1[..])
.unwrap();
assert_eq!(
shared1.store().get_block_hash(fork).unwrap(),
shared2.store().get_block_hash(fork).unwrap()
);
assert!(
shared1.store().get_block_hash(fork + 1).unwrap()
!= shared2.store().get_block_hash(fork + 1).unwrap()
);
assert_eq!(
shared1.store().get_block_hash(latest_common).unwrap(),
shared1.store().get_block_hash(fork).unwrap()
);
} | rust_cleaned_test_functions.jsonl/113659 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1305
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13400,
349,
64880,
21107,
7113,
17,
368,
341,
286,
1077,
23869,
284,
7292,
13626,
486,
2258,
543,
286,
1077,
320,
8819,
21600,
16,
11,
6094,
16,
11,
716,
21948,
16,
8,
284,
1191,
30583,
65405,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_reading_deflate_encoding_large_random_ssl() {
use openssl::ssl::{SslConnector, SslMethod, SslVerifyMode};
use rustls::internal::pemfile::{certs, rsa_private_keys};
use rustls::{NoClientAuth, ServerConfig};
use std::fs::File;
use std::io::BufReader;
let addr = TestServer::unused_addr();
let (tx, rx) = mpsc::channel();
let data = rand::thread_rng()
.sample_iter(&Alphanumeric)
.take(160_000)
.collect::<String>();
thread::spawn(move || {
let sys = actix_rt::System::new("test");
// load ssl keys
let mut config = ServerConfig::new(NoClientAuth::new());
let cert_file = &mut BufReader::new(File::open("tests/cert.pem").unwrap());
let key_file = &mut BufReader::new(File::open("tests/key.pem").unwrap());
let cert_chain = certs(cert_file).unwrap();
let mut keys = rsa_private_keys(key_file).unwrap();
config.set_single_cert(cert_chain, keys.remove(0)).unwrap();
let srv = HttpServer::new(|| {
App::new().service(web::resource("/").route(web::to(|bytes: Bytes| {
Ok::<_, Error>(
HttpResponse::Ok()
.encoding(http::ContentEncoding::Identity)
.body(bytes),
)
})))
})
.bind_rustls(addr, config)
.unwrap()
.start();
let _ = tx.send((srv, actix_rt::System::current()));
let _ = sys.run();
});
let (srv, _sys) = rx.recv().unwrap();
let client = test::run_on(|| {
let mut builder = SslConnector::builder(SslMethod::tls()).unwrap();
builder.set_verify(SslVerifyMode::NONE);
let _ = builder.set_alpn_protos(b"\x02h2\x08http/1.1").unwrap();
awc::Client::build()
.connector(
awc::Connector::new()
.timeout(std::time::Duration::from_millis(500))
.ssl(builder.build())
.finish(),
)
.finish()
});
// encode data
let mut e = ZlibEncoder::new(Vec::new(), Compression::default());
e.write_all(data.as_ref()).unwrap();
let enc = e.finish().unwrap();
// client request
let _req = client
.post(format!("https://{}/", addr))
.header(http::header::CONTENT_ENCODING, "deflate")
.send_body(enc);
// TODO: fix
// read response
// stop
let _ = srv.stop(false);
} | rust_cleaned_test_functions.jsonl/48239 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1243
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
81859,
7844,
5075,
37613,
45228,
22644,
48210,
368,
341,
262,
990,
80733,
486,
24635,
22964,
50,
3226,
35954,
11,
328,
3226,
3523,
11,
328,
3226,
32627,
3636,
2440,
262,
990,
23071,
4730,
486,
104... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_run() {
let elevator = ELEVATOR.lock().unwrap();
println!("The elevator will now do a run from the bottom floor to the top floor. It will stop in the floor below the top floor");
elevator.set_direction(ElevatorDirection::Down);
while elevator.read_floor_sensor() != Some(0) {
if let Some(floor) = elevator.read_floor_sensor() {
elevator.set_floor_indicator(floor);
}
}
elevator.set_floor_indicator(0);
elevator.set_direction(ElevatorDirection::Up);
while elevator.read_floor_sensor() != Some(ElevatorInterface::N_FLOORS - 1) {
if let Some(floor) = elevator.read_floor_sensor() {
elevator.set_floor_indicator(floor);
}
}
elevator.set_floor_indicator(ElevatorInterface::N_FLOORS - 1);
elevator.set_direction(ElevatorDirection::Down);
while elevator.read_floor_sensor() != Some(ElevatorInterface::N_FLOORS - 2) {}
elevator.set_floor_indicator(ElevatorInterface::N_FLOORS - 2);
elevator.set_direction(ElevatorDirection::Stop);
} | rust_cleaned_test_functions.jsonl/42307 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 497
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14007,
368,
341,
286,
1077,
38636,
284,
468,
85411,
11857,
21003,
1005,
15454,
543,
286,
13751,
17223,
785,
38636,
686,
1431,
653,
264,
1598,
504,
279,
5622,
6422,
311,
279,
1909,
6422,
13,
1084,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_supplies_buy_misc_success() {
let mut supplies = Supplies::new();
supplies.buy_misc(200).unwrap();
assert_eq!(500, supplies.money);
assert_eq!(200, supplies.misc);
} | rust_cleaned_test_functions.jsonl/28668 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 108
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23723,
7202,
46348,
69350,
18632,
368,
341,
286,
1077,
5206,
16720,
284,
50252,
486,
931,
543,
286,
16720,
63871,
69350,
7,
17,
15,
15,
568,
15454,
543,
1066,
286,
2060,
10714,
10297,
20,
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 |
#[test]
fn test_global_var_f32() {
// create a GlobalType instance
let result = GlobalType::create(ValType::F32, Mutability::Var);
assert!(result.is_ok());
let mut ty = result.unwrap();
assert!(!ty.ctx.is_null());
// create a Var Global instance
let result = Global::create(&mut ty, Value::F32(13.14));
assert!(result.is_ok());
assert!(ty.ctx.is_null());
assert!(ty.registered);
let mut global_var = result.unwrap();
// access the value held by global_var
assert_eq!(global_var.get_value(), Value::F32(13.14));
let result = global_var.set_value(Value::F32(1.314));
assert!(result.is_ok());
assert_eq!(global_var.get_value(), Value::F32(1.314));
// access the global type
let result = global_var.ty();
assert!(result.is_ok());
let ty = result.unwrap();
assert!(!ty.ctx.is_null());
assert!(ty.registered);
assert_eq!(ty.value_type(), ValType::F32);
assert_eq!(ty.mutability(), Mutability::Var);
} | rust_cleaned_test_functions.jsonl/130797 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 501
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19296,
4612,
761,
18,
17,
368,
341,
286,
442,
1855,
264,
7962,
929,
2867,
198,
286,
1077,
1102,
284,
7962,
929,
486,
3182,
7,
2208,
929,
486,
37,
18,
17,
11,
31228,
2897,
486,
3962,
317,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pow_function() -> Result<()> {
let tests = vec![
ScalarFunctionTest {
name: "pow-with-literal",
columns: vec![Series::from_data([2]), Series::from_data([2])],
expect: Series::from_data(vec![4_f64]),
error: "",
},
ScalarFunctionTest {
name: "pow-with-series",
columns: vec![Series::from_data([2, 2]), Series::from_data([2, -2])],
expect: Series::from_data([4_f64, 0.25]),
error: "",
},
ScalarFunctionTest {
name: "pow-with-null",
columns: vec![
Series::from_data([Some(2), None, None]),
Series::from_data([Some(2), Some(-2), None]),
],
expect: Series::from_data([Some(4_f64), None, None]),
error: "",
},
ScalarFunctionTest {
name: "pow-x-constant",
columns: vec![
ConstColumn::new(Series::from_data(vec![2]), 3).arc(),
Series::from_data([Some(2), Some(-2), None]),
],
expect: Series::from_data([Some(4_f64), Some(0.25), None]),
error: "",
},
ScalarFunctionTest {
name: "pow-y-constant",
columns: vec![
Series::from_data([Some(2), Some(-2), None]),
ConstColumn::new(Series::from_data(vec![2]), 3).arc(),
],
expect: Series::from_data([Some(4_f64), Some(4.0), None]),
error: "",
},
];
test_scalar_functions("pow", &tests)
} | rust_cleaned_test_functions.jsonl/66267 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 883
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56183,
9174,
368,
1464,
5714,
71698,
341,
262,
1077,
7032,
284,
7486,
90515,
286,
35176,
5152,
2271,
341,
310,
829,
25,
330,
21743,
26189,
2852,
9953,
756,
310,
8147,
25,
7486,
20703,
25544,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_default() {
let g = MatrixGraph::<i32, i32>::default();
assert_eq!(g.node_count(), 0);
assert_eq!(g.edge_count(), 0);
} | rust_cleaned_test_functions.jsonl/81954 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 88
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9993,
368,
341,
286,
1077,
342,
284,
11631,
11212,
27638,
72,
18,
17,
11,
600,
18,
17,
6831,
2258,
543,
286,
2060,
10714,
10297,
70,
12097,
3180,
1507,
220,
15,
317,
286,
2060,
10714,
10297,
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 |
#[test]
fn test_02() {
let alloc: bumpalo::Bump = bumpalo::Bump::new();
let mut buf = bumpalo::vec![in &alloc; 1, 2, 3];
let _s = BumpSliceMut::new(&alloc, buf.as_mut_slice());
} | rust_cleaned_test_functions.jsonl/115370 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
15,
17,
368,
341,
286,
1077,
5574,
25,
27575,
12529,
486,
33,
1510,
284,
27575,
12529,
486,
33,
1510,
486,
931,
543,
286,
1077,
5206,
6607,
284,
27575,
12529,
486,
4083,
20703,
258,
609,
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_select() {
let sql = "SELECT * FROM label1 Where a = 123 and b != '456'";
let mut tokenizer = Tokenizer::new(&sql);
let tokens = tokenizer.tokenize().unwrap_or_default();
assert_eq!(
vec![
Token::Keyword(Keyword::SELECT),
Token::Whitespace(Whitespace::Space),
Token::Star,
Token::Whitespace(Whitespace::Space),
Token::Keyword(Keyword::FROM),
Token::Whitespace(Whitespace::Space),
Token::Identifier("label1".to_owned()),
Token::Whitespace(Whitespace::Space),
Token::Keyword(Keyword::WHERE),
Token::Whitespace(Whitespace::Space),
Token::Identifier("a".to_owned()),
Token::Whitespace(Whitespace::Space),
Token::Eq,
Token::Whitespace(Whitespace::Space),
Token::Number("123".to_owned()),
Token::Whitespace(Whitespace::Space),
Token::Keyword(Keyword::AND),
Token::Whitespace(Whitespace::Space),
Token::Identifier("b".to_owned()),
Token::Whitespace(Whitespace::Space),
Token::Neq,
Token::Whitespace(Whitespace::Space),
Token::String("456".to_owned()),
Token::EOF,
],
tokens
);
} | rust_cleaned_test_functions.jsonl/83085 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 792
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13051,
368,
341,
286,
1077,
5704,
284,
330,
4858,
353,
4295,
2383,
16,
10967,
264,
284,
220,
16,
17,
18,
323,
293,
961,
364,
19,
20,
21,
21689,
286,
1077,
5206,
45958,
284,
9660,
3135,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_m_limit() {
let s = "copy 1 m\n";
assert_eq!(
parse_text(s),
Ok(vec![Instruction::Copy(
Target::Literal(1),
Target::Register("m".into()),
)])
);
let s = "copy m m\n";
assert_eq!(
parse_text(s),
Err("cannot reference M register more than once in one instruction".into()),
);
} | rust_cleaned_test_functions.jsonl/72903 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 270
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
14763,
368,
972,
286,
1077,
274,
284,
330,
8560,
220,
16,
296,
1699,
3534,
286,
2060,
10714,
0,
7805,
310,
4715,
4326,
1141,
9912,
310,
7622,
25592,
20703,
16664,
486,
12106,
7805,
394,
134... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_accessible() {
let mut p = EdgeProperties::default();
p.normalize();
assert!(!p.accessible());
p.foot = FOOT_ALLOWED;
assert!(p.accessible())
} | rust_cleaned_test_functions.jsonl/62183 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 80
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88724,
368,
341,
262,
1077,
5206,
281,
284,
10349,
7903,
486,
2258,
543,
262,
281,
44657,
543,
262,
2060,
0,
3471,
79,
21986,
1238,
5231,
262,
281,
13,
5334,
284,
80037,
73186,
280,
262,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_decimal_as_json() {
test_none_with_ctx(cast_any_as_any::<Decimal, Json>);
let cs = vec![
(
Decimal::from_f64(i64::MIN as f64).unwrap(),
Json::Double(i64::MIN as f64),
),
(
Decimal::from_f64(i64::MAX as f64).unwrap(),
Json::Double(i64::MAX as f64),
),
(
Decimal::from_bytes(b"184467440737095516160")
.unwrap()
.unwrap(),
Json::Double(184467440737095516160.0),
),
(
Decimal::from_bytes(b"-184467440737095516160")
.unwrap()
.unwrap(),
Json::Double(-184467440737095516160.0),
),
];
for (input, expect) in cs {
let mut ctx = EvalContext::default();
let r = cast_any_as_any::<Decimal, Json>(&mut ctx, &Some(input.clone()));
let log = make_log(&input, &expect, &r);
check_result(Some(&expect), &r, log.as_str());
}
} | rust_cleaned_test_functions.jsonl/101817 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 695
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74429,
11898,
9455,
368,
341,
286,
1273,
31488,
6615,
15147,
1337,
559,
37248,
11898,
37248,
27638,
11269,
11,
8308,
42013,
286,
1077,
10532,
284,
7486,
90515,
310,
2399,
394,
26728,
486,
1499,
761,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_forecast_request_builder_defaults() {
let request = ForecastRequestBuilder::new(API_KEY, LAT, LONG).build();
let expected_url = Url::parse(&format!(
"{base}/{key}/{lat:.16},{long:.16}?",
base = FORECAST_URL,
key = API_KEY,
lat = LAT,
long = LONG
)).unwrap();
let expected = ForecastRequest::new(
API_KEY,
LAT,
LONG,
expected_url,
Vec::new(),
None,
None,
None
);
assert_eq!(expected.api_key, request.api_key);
assert_eq!(expected.latitude, request.latitude);
assert_eq!(expected.longitude, request.longitude);
assert_eq!(expected.exclude, request.exclude);
assert_eq!(expected.extend, request.extend);
assert_eq!(expected.lang, request.lang);
assert_eq!(expected.units, request.units);
assert_eq!(expected.url, request.url);
assert_eq!(expected, request);
} | rust_cleaned_test_functions.jsonl/24714 | {
"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,
35563,
3829,
7893,
28532,
42290,
368,
341,
286,
1077,
1681,
284,
55675,
1900,
3297,
486,
931,
48953,
6600,
11,
53187,
11,
33942,
568,
5834,
1428,
286,
1077,
3601,
2903,
284,
22840,
486,
6400,
2099... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_without_miter_limit(){
let expected_limit = 4.0;
let stroke_options = StrokeOptions::default();
assert_eq!(expected_limit, stroke_options.miter_limit);
} | rust_cleaned_test_functions.jsonl/25092 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 73
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39904,
717,
2015,
14763,
3032,
262,
1077,
3601,
14763,
284,
220,
19,
13,
15,
280,
262,
1077,
12654,
8743,
284,
68934,
3798,
486,
2258,
1428,
262,
2060,
10714,
10297,
7325,
14763,
11,
12654,
8743,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_current_user() {
let value = CurrentUser {
accent_color: Some(16_711_680),
avatar: Some("avatar hash".to_owned()),
banner: None,
bot: true,
discriminator: 9999,
email: None,
id: UserId::new(1).expect("non zero"),
mfa_enabled: true,
name: "test name".to_owned(),
verified: Some(true),
premium_type: Some(PremiumType::NitroClassic),
public_flags: Some(UserFlags::DISCORD_EMPLOYEE),
flags: None,
locale: Some("test locale".to_owned()),
};
// Deserializing a current user with a string discriminator (which
// Discord provides)
serde_test::assert_tokens(&value, &user_tokens(Token::Str("9999")));
// Deserializing a current user with an integer discriminator. Userland
// code may have this due to being a more compact memory representation
// of a discriminator.
serde_test::assert_de_tokens(&value, &user_tokens(Token::U64(9999)));
} | rust_cleaned_test_functions.jsonl/21722 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 509
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11080,
3317,
368,
341,
286,
1077,
897,
284,
9125,
1474,
341,
310,
29100,
6714,
25,
4329,
7,
16,
21,
62,
22,
16,
16,
62,
21,
23,
15,
1326,
310,
20701,
25,
4329,
445,
11962,
5175,
3263,
983,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_target_redirect_not_found() {
wrapper(|env| {
let web = env.frontend();
assert_eq!(
web.get("/crate/fdsafdsafdsafdsa/0.1.0/target-redirect/x86_64-apple-darwin/")
.send()?
.status(),
StatusCode::NOT_FOUND,
);
Ok(())
})
} | rust_cleaned_test_functions.jsonl/13867 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 244
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11123,
30043,
7913,
21480,
368,
341,
286,
13261,
22428,
3160,
91,
341,
310,
1077,
3482,
284,
6105,
23445,
408,
543,
310,
2060,
10714,
33673,
394,
3482,
670,
4283,
61711,
6663,
5356,
2577,
5356,
25... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_peer_selector() {
let peers = vec![
PeerInfo::new(
PeerId::random(),
ChainInfo::new(1.into(), HashValue::zero(), mock_chain_status(100.into())),
vec![],
vec![],
),
PeerInfo::new(
PeerId::random(),
ChainInfo::new(1.into(), HashValue::zero(), mock_chain_status(99.into())),
vec![],
vec![],
),
PeerInfo::new(
PeerId::random(),
ChainInfo::new(1.into(), HashValue::zero(), mock_chain_status(100.into())),
vec![],
vec![],
),
PeerInfo::new(
PeerId::random(),
ChainInfo::new(1.into(), HashValue::zero(), mock_chain_status(1.into())),
vec![],
vec![],
),
];
let peer_selector = PeerSelector::new(peers, PeerStrategy::default(), None);
let best_selector = peer_selector.bests(0.into()).unwrap();
assert_eq!(2, best_selector.len());
let top_selector = peer_selector.top(3);
assert_eq!(3, top_selector.len());
} | rust_cleaned_test_functions.jsonl/100338 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 577
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45159,
28890,
368,
341,
262,
1077,
25029,
284,
7486,
90515,
286,
45147,
1731,
486,
931,
1006,
310,
45147,
764,
486,
11463,
3148,
310,
28525,
1731,
486,
931,
7,
16,
39860,
1507,
6531,
1130,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_snapshot_hash_of() {
assert_eq!(
snapshot_hash_of(&format!("snapshot-42-{}.tar.bz2", Hash::default())),
Some((42, Hash::default()))
);
assert!(snapshot_hash_of("invalid").is_none());
} | rust_cleaned_test_functions.jsonl/38788 | {
"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,
53265,
8950,
3575,
368,
341,
286,
2060,
10714,
33673,
310,
16295,
8950,
3575,
2099,
2243,
17223,
35501,
12,
19,
17,
12,
46391,
26737,
81374,
17,
497,
6531,
486,
2258,
73727,
310,
4329,
1188,
19,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_parse_wallet_create_tx() {
let cli_args = vec!["bdk-cli", "--network", "testnet", "wallet",
"--descriptor", "wpkh(tpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/0/*)",
"--change_descriptor", "wpkh(tpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/1/*)",
"create_tx", "--to", "n2Z3YNXtceeJhFkTknVaNjT1mnCGWesykJ:123456","mjDZ34icH4V2k9GmC8niCrhzVuR3z8Mgkf:78910",
"--utxos","87345e46bfd702d24d54890cc094d08a005f773b27c8f965dfe0eb1e23eef88e:1",
"--utxos","87345e46bfd702d24d54890cc094d08a005f773b27c8f965dfe0eb1e23eef88e:2"];
let cli_opts = CliOpts::from_iter(&cli_args);
let script1 = Address::from_str("n2Z3YNXtceeJhFkTknVaNjT1mnCGWesykJ")
.unwrap()
.script_pubkey();
let script2 = Address::from_str("mjDZ34icH4V2k9GmC8niCrhzVuR3z8Mgkf")
.unwrap()
.script_pubkey();
let outpoint1 = OutPoint::from_str(
"87345e46bfd702d24d54890cc094d08a005f773b27c8f965dfe0eb1e23eef88e:1",
)
.unwrap();
let outpoint2 = OutPoint::from_str(
"87345e46bfd702d24d54890cc094d08a005f773b27c8f965dfe0eb1e23eef88e:2",
)
.unwrap();
let expected_cli_opts = CliOpts {
network: Network::Testnet,
subcommand: CliSubCommand::Wallet {
wallet_opts: WalletOpts {
wallet: "main".to_string(),
descriptor: "wpkh(tpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/0/*)".to_string(),
change_descriptor: Some("wpkh(tpubDEnoLuPdBep9bzw5LoGYpsxUQYheRQ9gcgrJhJEcdKFB9cWQRyYmkCyRoTqeD4tJYiVVgt6A3rN6rWn9RYhR9sBsGxji29LYWHuKKbdb1ev/1/*)".to_string()),
#[cfg(feature = "electrum")]
electrum_opts: ElectrumOpts {
timeout: None,
electrum: "ssl://electrum.blockstream.info:60002".to_string(),
},
#[cfg(feature = "esplora")]
esplora_opts: EsploraOpts {
esplora: None,
esplora_concurrency: 4,
},
#[cfg(feature = "compact_filters")]
compactfilter_opts: CompactFilterOpts{
address: vec!["127.0.0.1:18444".to_string()],
conn_count: 4,
skip_blocks: 0,
},
#[cfg(any(feature="compact_filters", feature="electrum"))]
proxy_opts: ProxyOpts{
proxy: None,
proxy_auth: None,
retries: 5,
}
},
subcommand: WalletSubCommand::OfflineWalletSubCommand(CreateTx {
recipients: vec![(script1, 123456), (script2, 78910)],
send_all: false,
enable_rbf: false,
offline_signer: false,
utxos: Some(vec!(outpoint1, outpoint2)),
unspendable: None,
fee_rate: None,
external_policy: None,
internal_policy: None,
}),
},
};
assert_eq!(expected_cli_opts, cli_opts);
} | rust_cleaned_test_functions.jsonl/53341 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2356
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
62308,
8657,
17805,
368,
341,
286,
1077,
21348,
8384,
284,
7486,
0,
1183,
65,
7584,
54797,
497,
14482,
17511,
497,
330,
1944,
4711,
497,
330,
35735,
756,
999,
14482,
53132,
497,
330,
8421,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_valid_suffixes() {
let all_suffixes = vec![
(KubeQuantity("500m".into()), Suffix::Millicpu),
(KubeQuantity("123456".into()), Suffix::None),
(KubeQuantity("1.23456".into()), Suffix::None),
(KubeQuantity("500K".into()), Suffix::Kilobyte),
(KubeQuantity("500M".into()), Suffix::Megabyte),
(KubeQuantity("500G".into()), Suffix::Gigabyte),
(KubeQuantity("500T".into()), Suffix::Terabyte),
(KubeQuantity("500P".into()), Suffix::Petabyte),
(KubeQuantity("500E".into()), Suffix::Exabyte),
(KubeQuantity("500Ki".into()), Suffix::Kibibyte),
(KubeQuantity("500Mi".into()), Suffix::Mebibyte),
(KubeQuantity("500Gi".into()), Suffix::Gibibyte),
(KubeQuantity("500Ti".into()), Suffix::Tebibyte),
(KubeQuantity("500Pi".into()), Suffix::Pebibyte),
(KubeQuantity("500Ei".into()), Suffix::Exbibyte),
];
for (quantity, expected) in all_suffixes {
let parsed = get_suffix(&quantity);
assert_eq!(parsed, expected, "Expected parsed suffix to equal expected");
}
} | rust_cleaned_test_functions.jsonl/51863 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 598
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8337,
37151,
288,
368,
341,
286,
1077,
678,
37151,
288,
284,
7486,
90515,
310,
320,
42,
3760,
17342,
445,
20,
15,
15,
76,
3263,
18122,
11858,
328,
13554,
486,
59232,
415,
5584,
1326,
310,
320,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_net_unreachable() {
// Receive an IP packet for an unreachable destination address. Check to
// make sure that we respond with the appropriate ICMP message.
test_receive_ip_packet::<Ipv4, _, _, _, _>(
|_| {},
&mut [0u8; 128],
Ipv4Addr::new([1, 2, 3, 4]),
64,
IpProto::Udp,
&["send_icmpv4_net_unreachable", "send_icmp_error_message"],
Some((
IcmpDestUnreachable::default(),
Icmpv4DestUnreachableCode::DestNetworkUnreachable,
)),
// ensure packet is truncated to the right length
|packet| assert_eq!(packet.original_packet().bytes().len(), 84),
);
test_receive_ip_packet::<Ipv6, _, _, _, _>(
|_| {},
&mut [0u8; 128],
Ipv6Addr::new([1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8]),
64,
IpProto::Udp,
&["send_icmpv6_net_unreachable", "send_icmp_error_message"],
Some((IcmpDestUnreachable::default(), Icmpv6DestUnreachableCode::NoRoute)),
// ensure packet is truncated to the right length
|packet| assert_eq!(packet.original_packet().bytes().len(), 168),
);
} | rust_cleaned_test_functions.jsonl/122961 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 687
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19722,
4907,
46550,
368,
341,
286,
442,
37422,
458,
6790,
10151,
369,
458,
69322,
9106,
2621,
13,
4248,
311,
198,
286,
442,
1281,
2704,
429,
582,
5889,
448,
279,
8311,
83988,
1943,
624,
286,
127... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_probe() {
crate::init().unwrap();
let (major, minor, micro, _) = crate::version();
let pad = crate::Pad::new(Some("src"), crate::PadDirection::Src);
let events = Arc::new(Mutex::new(Vec::new()));
let buffers = Arc::new(Mutex::new(Vec::new()));
let flow_override = if (major, minor, micro) >= (1, 16, 1) {
Err(FlowError::Eos)
} else {
Ok(FlowSuccess::Ok)
};
{
let events = events.clone();
pad.add_probe(crate::PadProbeType::EVENT_DOWNSTREAM, move |_, info| {
if let Some(PadProbeData::Event(event)) = &info.data {
let mut events = events.lock().unwrap();
events.push(event.clone());
} else {
unreachable!();
}
crate::PadProbeReturn::Ok
});
}
{
let events = events.clone();
pad.add_probe(crate::PadProbeType::EVENT_UPSTREAM, move |_, info| {
if let Some(PadProbeData::Event(event)) = info.data.take() {
let mut events = events.lock().unwrap();
events.push(event);
} else {
unreachable!();
}
crate::PadProbeReturn::Handled
});
}
{
let buffers = buffers.clone();
let flow_override = flow_override;
pad.add_probe(crate::PadProbeType::BUFFER, move |_, info| {
if let Some(PadProbeData::Buffer(buffer)) = info.data.take() {
let mut buffers = buffers.lock().unwrap();
info.flow_res = if buffers.is_empty() {
Ok(FlowSuccess::Ok)
} else {
flow_override
};
buffers.push(buffer);
} else {
unreachable!();
}
crate::PadProbeReturn::Handled
});
}
pad.set_active(true).unwrap();
assert!(
pad.send_event(crate::event::Latency::new(crate::ClockTime::from_nseconds(
10
)))
);
assert!(pad.push_event(crate::event::StreamStart::new("test")));
let segment = crate::FormattedSegment::<crate::ClockTime>::new();
assert!(pad.push_event(crate::event::Segment::new(segment.as_ref())));
assert_eq!(pad.push(crate::Buffer::new()), Ok(FlowSuccess::Ok));
assert_eq!(pad.push(crate::Buffer::new()), flow_override);
let events = events.lock().unwrap();
let buffers = buffers.lock().unwrap();
assert_eq!(events.len(), 3);
assert_eq!(buffers.len(), 2);
assert_eq!(events[0].type_(), crate::EventType::Latency);
assert_eq!(events[1].type_(), crate::EventType::StreamStart);
assert_eq!(events[2].type_(), crate::EventType::Segment);
assert!(
buffers.iter().all(|b| b.is_writable()),
"A buffer ref leaked!"
);
drop(pad); // Need to drop the pad first to unref sticky events
assert!(
events.iter().all(|e| e.is_writable()),
"An event ref leaked!"
);
} | rust_cleaned_test_functions.jsonl/4738 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1805
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49108,
368,
341,
286,
17717,
486,
2327,
1005,
15454,
1428,
286,
1077,
320,
36505,
11,
8922,
11,
8003,
11,
27439,
284,
17717,
486,
4366,
543,
286,
1077,
11016,
284,
17717,
486,
13731,
486,
931,
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... | 6 |
#[test]
fn test_vrna_eval() {
let sequence =
"GGGUUUGCGGUGUAAGUGCAGCCCGUCUUACACCGUGCGGCACAGGCACUAGUACUGAUGUCGUAUACAGGGCUUUUGACAU";
let vc = VCompound::new(sequence);
// MFE structure:
// minimum free energy = -25.80 kcal/mol
let pt = Array1::from_vec(vec![
82, 24, 23, 22, 21, 20, 0, 19, 18, 17, 0, 0, 0, 0, 0, 0, 0, 9, 8, 7, 5, 4, 3, 2, 1, 80,
79, 78, 0, 0, 0, 0, 0, 71, 70, 66, 65, 64, 63, 62, 61, 60, 59, 57, 56, 55, 0, 0, 0, 0,
0, 0, 0, 0, 0, 45, 44, 43, 0, 42, 41, 40, 39, 38, 37, 36, 35, 0, 0, 0, 34, 33, 0, 0, 0,
0, 0, 0, 27, 26, 25, 0, 0,
]);
assert_eq!(-25.8f64, vc.evaluate_structure_f64(pt.view()));
} | rust_cleaned_test_functions.jsonl/10738 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 436
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
89231,
21296,
368,
341,
286,
1077,
8500,
4035,
310,
330,
22254,
54695,
52,
2941,
8798,
38,
2941,
17782,
1890,
60902,
1890,
3706,
8798,
5459,
86564,
1706,
1706,
8798,
2941,
8798,
22863,
1706,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_contains() {
let mut cache = LruCache::new(2);
cache.put("apple", "red");
cache.put("banana", "yellow");
cache.put("pear", "green");
assert!(!cache.contains(&"apple"));
assert!(cache.contains(&"banana"));
assert!(cache.contains(&"pear"));
} | rust_cleaned_test_functions.jsonl/77937 | {
"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,
63598,
368,
341,
286,
1077,
5206,
6500,
284,
444,
2672,
8233,
486,
931,
7,
17,
626,
286,
6500,
3597,
445,
22377,
497,
330,
1151,
797,
286,
6500,
3597,
445,
87747,
497,
330,
27869,
797,
286,
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_bcrypt_sha256() {
let django = Django {
version: DjangoVersion::V1_9,
};
let encoded = django.make_password_with_settings("lètmein", "", Algorithm::BCryptSHA256);
assert!(is_password_usable(&encoded));
assert!(encoded.starts_with("bcrypt_sha256$"));
assert!(check_password("lètmein", &encoded).unwrap());
assert!(!check_password("lètmeinz", &encoded).unwrap());
// Verify that password truncation no longer works
let password = "VSK0UYV6FFQVZ0KG88DYN9WADAADZO1CTSIVDJUNZSUML6IBX7LN7ZS3R5JGB3RGZ7VI7G7DJQ9NI8\
BQFSRPTG6UWTTVESA5ZPUN";
let trunc_encoded = django.make_password_with_settings(password, "", Algorithm::BCryptSHA256);
assert!(check_password(password, &trunc_encoded).unwrap());
assert!(!check_password(&password[0..72], &trunc_encoded).unwrap());
// Blank passwords
let blank_encoded = django.make_password_with_settings("", "", Algorithm::BCryptSHA256);
assert!(is_password_usable(&blank_encoded));
assert!(blank_encoded.starts_with("bcrypt_sha256$"));
assert!(check_password("", &blank_encoded).unwrap());
assert!(!check_password(" ", &blank_encoded).unwrap());
} | rust_cleaned_test_functions.jsonl/104132 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 505
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
48125,
48836,
17,
20,
21,
368,
341,
262,
1077,
8262,
284,
52604,
341,
286,
2319,
25,
52604,
5637,
486,
53,
16,
62,
24,
345,
262,
2605,
262,
1077,
20498,
284,
8262,
10117,
10122,
6615,
108... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compose() {
let scale = scale_transform(2.0, 3.0);
let translate = translate_transform(1.0, 10.0);
assert_eq!(apply(compose(translate, scale), [5.0, 7.0]),
[11.0, 31.0]);
assert_eq!(apply(compose(scale, translate), [5.0, 7.0]),
[12.0, 51.0]);
} | rust_cleaned_test_functions.jsonl/39373 | {
"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,
2965,
2900,
368,
341,
286,
1077,
5452,
284,
5452,
18449,
7,
17,
13,
15,
11,
220,
18,
13,
15,
317,
286,
1077,
14683,
284,
14683,
18449,
7,
16,
13,
15,
11,
220,
16,
15,
13,
15,
317,
286,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dad_b_carry() {
let mut state = State8080::empty_state();
state.memory = vec![0x09];
state.b = 0xff;
state.c = 0xff;
state.h = 0x00;
state.l = 0x02;
emulate_8080_op(&mut state);
assert_eq!(state.b, 0xff);
assert_eq!(state.c, 0xff);
assert_eq!(state.h, 0x00);
assert_eq!(state.l, 0x01);
assert_eq!(state.cc.cy, 1);
} | rust_cleaned_test_functions.jsonl/7760 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 248
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
329,
880,
666,
11433,
368,
341,
286,
1077,
5206,
1584,
284,
3234,
23,
15,
23,
15,
486,
3194,
4387,
543,
286,
1584,
36611,
284,
7486,
20703,
15,
87,
15,
24,
935,
286,
1584,
948,
284,
220... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_deep_nesting_group() {
fn build_and_roundtrip(depth: usize) -> Result<(), prost::DecodeError> {
use crate::groups::{nested_group2::OptionalGroup, NestedGroup2};
let mut a = NestedGroup2::default();
for _ in 0..depth {
a = NestedGroup2 {
optionalgroup: Some(Box::new(OptionalGroup {
nested_group: Some(a),
})),
};
}
let mut buf = Vec::new();
a.encode(&mut buf).unwrap();
NestedGroup2::decode(&*buf).map(|_| ())
}
assert!(build_and_roundtrip(50).is_ok());
assert!(build_and_roundtrip(51).is_err());
} | rust_cleaned_test_functions.jsonl/8854 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 401
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
87044,
1089,
59855,
6288,
368,
341,
286,
5168,
1936,
8378,
29896,
32981,
53675,
25,
22301,
8,
1464,
5714,
68843,
35221,
486,
32564,
1454,
29,
341,
310,
990,
17717,
486,
16753,
22964,
59271,
6288,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_heapsizeof() {
use heapsize::HeapSizeOf;
let h = H128::zero();
assert_eq!(h.heap_size_of_children(),0);
} | rust_cleaned_test_functions.jsonl/123492 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 68
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33059,
10318,
368,
341,
197,
41819,
17364,
2141,
486,
27909,
1695,
2124,
280,
197,
10217,
305,
284,
472,
16,
17,
23,
486,
14154,
543,
197,
6948,
10714,
10297,
71,
77147,
2368,
3575,
31206,
1507,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_network() {
let temp_config = Config::new(
String::from("goodday"),
Option::Some(String::from("127.0.0.1:8081")),
);
assert_eq!(temp_config.get_network(), "127.0.0.1:8081");
} | rust_cleaned_test_functions.jsonl/123545 | {
"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,
3062,
20966,
368,
341,
286,
1077,
2730,
5332,
284,
5532,
486,
931,
1006,
310,
923,
486,
1499,
445,
18536,
1292,
4461,
310,
6959,
486,
8373,
2242,
486,
1499,
445,
16,
17,
22,
13,
15,
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_fetch() {
assert_eq!(
Opt {
force: false,
verbose: 3,
cmd: Sub::Fetch {}
},
Opt::parse_from(&["test", "-vvv", "fetch"])
);
assert_eq!(
Opt {
force: true,
verbose: 0,
cmd: Sub::Fetch {}
},
Opt::parse_from(&["test", "--force", "fetch"])
);
} | rust_cleaned_test_functions.jsonl/46408 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 242
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11803,
368,
341,
262,
2060,
10714,
33673,
286,
16554,
341,
310,
5344,
25,
895,
345,
310,
13694,
25,
220,
18,
345,
310,
5439,
25,
3719,
486,
20714,
5613,
286,
1153,
286,
16554,
486,
6400,
5673,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_registration_query() {
assert_eq!(registration_query("", ""), format!("{}..", CONFIG_KEY_REGISTRATIONS));
assert_eq!(
registration_query("a-b", "c-d"),
format!("{}.a-b.c-d", CONFIG_KEY_REGISTRATIONS)
);
assert_eq!(
registration_query("a.b", "c.d"),
format!("{}.a%2Eb.c%2Ed", CONFIG_KEY_REGISTRATIONS)
);
assert_eq!(
registration_query("a%b", "c%d"),
format!("{}.a%25b.c%25d", CONFIG_KEY_REGISTRATIONS)
);
} | rust_cleaned_test_functions.jsonl/98260 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 310
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49101,
5738,
368,
341,
286,
2060,
10714,
10297,
25862,
5738,
19814,
77130,
3561,
17223,
6257,
496,
497,
13202,
6600,
8064,
29503,
21792,
1106,
286,
2060,
10714,
33673,
310,
12227,
5738,
445,
64,
145... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serde() {
let strings = ["3", "4+4", "21^(2*2)--3>5||!true"];
for string in &strings {
let manual_tree = build_operator_tree(string).unwrap();
let serde_tree: Node = ron::de::from_str(&format!("\"{}\"", string)).unwrap();
assert_eq!(manual_tree.eval(), serde_tree.eval());
}
} | rust_cleaned_test_functions.jsonl/105356 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 155
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75861,
450,
368,
341,
262,
1077,
9069,
284,
4383,
18,
497,
330,
19,
10,
19,
497,
330,
17,
16,
13268,
17,
9,
17,
29621,
18,
29,
20,
8484,
0,
1866,
31797,
262,
369,
914,
304,
609,
18594,
341... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_binop() {
test_roundtrip("null + null");
test_roundtrip("1 + 1");
test_roundtrip("1 * 2 + (3 + 4)");
test_roundtrip("1 ** 2 ** 3 ** 4");
test_roundtrip("1 in 2 + (2 - 4) / 3");
test_roundtrip("1 instanceof 2 + (2 - 4) / 3");
} | rust_cleaned_test_functions.jsonl/102589 | {
"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,
21816,
453,
368,
341,
262,
1273,
29896,
32981,
445,
2921,
488,
845,
797,
262,
1273,
29896,
32981,
445,
16,
488,
220,
16,
797,
262,
1273,
29896,
32981,
445,
16,
353,
220,
17,
488,
320,
18,
488,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_that_pop_actually_detaches_node() {
let mut cache = LruCache::new(5);
cache.put("a", 1);
cache.put("b", 2);
cache.put("c", 3);
cache.put("d", 4);
cache.put("e", 5);
assert!(cache.contains(&"c"));
assert_eq!(cache.pop(&"c"), Some(3));
assert!(!cache.contains(&"c"));
cache.put("f", 6);
let mut iter = cache.iter();
assert_opt_eq_tuple(iter.next(), ("f", 6));
assert_opt_eq_tuple(iter.next(), ("e", 5));
assert_opt_eq_tuple(iter.next(), ("d", 4));
assert_opt_eq_tuple(iter.next(), ("b", 2));
assert_opt_eq_tuple(iter.next(), ("a", 1));
assert!(iter.next().is_none());
} | rust_cleaned_test_functions.jsonl/77942 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 377
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70197,
17061,
29370,
1832,
24409,
14242,
5084,
368,
341,
286,
1077,
5206,
6500,
284,
444,
2672,
8233,
486,
931,
7,
20,
626,
286,
6500,
3597,
445,
64,
497,
220,
16,
317,
286,
6500,
3597,
445,
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_scm_credentials() {
use libc;
use nix::sys::uio::IoVec;
use nix::unistd::{close, getpid, getuid, getgid};
use nix::sys::socket::{socketpair, sendmsg, recvmsg, setsockopt,
AddressFamily, SockType, SockFlag,
ControlMessage, CmsgSpace, MsgFlags};
use nix::sys::socket::sockopt::PassCred;
let (send, recv) = socketpair(AddressFamily::Unix, SockType::Stream, None, SockFlag::empty())
.unwrap();
setsockopt(recv, PassCred, &true).unwrap();
{
let iov = [IoVec::from_slice(b"hello")];
let cred = libc::ucred {
pid: getpid().as_raw(),
uid: getuid().as_raw(),
gid: getgid().as_raw(),
};
let cmsg = ControlMessage::ScmCredentials(&cred);
assert_eq!(sendmsg(send, &iov, &[cmsg], MsgFlags::empty(), None).unwrap(), 5);
close(send).unwrap();
}
{
let mut buf = [0u8; 5];
let iov = [IoVec::from_mut_slice(&mut buf[..])];
let mut cmsgspace: CmsgSpace<libc::ucred> = CmsgSpace::new();
let msg = recvmsg(recv, &iov, Some(&mut cmsgspace), MsgFlags::empty()).unwrap();
let mut received_cred = None;
for cmsg in msg.cmsgs() {
if let ControlMessage::ScmCredentials(cred) = cmsg {
assert!(received_cred.is_none());
assert_eq!(cred.pid, getpid().as_raw());
assert_eq!(cred.uid, getuid().as_raw());
assert_eq!(cred.gid, getgid().as_raw());
received_cred = Some(*cred);
} else {
panic!("unexpected cmsg");
}
}
received_cred.expect("no creds received");
assert!(!msg.flags.intersects(MsgFlags::MSG_TRUNC | MsgFlags::MSG_CTRUNC));
close(recv).unwrap();
}
} | rust_cleaned_test_functions.jsonl/44198 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 960
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
6226,
47396,
368,
341,
262,
990,
42142,
280,
262,
990,
308,
941,
486,
7791,
486,
84,
815,
486,
42799,
10050,
280,
262,
990,
308,
941,
486,
27483,
22964,
5552,
11,
95378,
11,
633,
2423,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_338() {
assert_eq!(Solution::count_bits(2), vec![0, 1, 1]);
assert_eq!(Solution::count_bits(5), vec![0, 1, 1, 2, 1, 2]);
} | rust_cleaned_test_functions.jsonl/123843 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 88
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
18,
18,
23,
368,
341,
286,
2060,
10714,
10297,
36842,
486,
1830,
20034,
7,
17,
701,
7486,
20703,
15,
11,
220,
16,
11,
220,
16,
2558,
286,
2060,
10714,
10297,
36842,
486,
1830,
20034,
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_int_counter() {
let counter = IntCounter::new("foo", "bar").unwrap();
counter.inc();
assert_eq!(counter.get(), 1);
counter.inc_by(11);
assert_eq!(counter.get(), 12);
let mut mfs = counter.collect();
assert_eq!(mfs.len(), 1);
let mf = mfs.pop().unwrap();
let m = mf.get_metric().get(0).unwrap();
assert_eq!(m.get_label().len(), 0);
assert_eq!(m.get_counter().get_value() as u64, 12);
counter.reset();
assert_eq!(counter.get() as u64, 0);
} | rust_cleaned_test_functions.jsonl/46516 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 284
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4042,
15730,
368,
341,
286,
1077,
5546,
284,
1333,
14099,
486,
931,
445,
7975,
497,
330,
2257,
1827,
15454,
543,
286,
5546,
26797,
543,
286,
2060,
10714,
10297,
8292,
670,
1507,
220,
16,
317,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_latex()
{
let gate = Y::new();
let mut state = LatexExportState::new(1, 0);
assert_eq!(gate.latex(&[0], &mut state), Ok(()));
assert_eq!(state.code(),
r#"\Qcircuit @C=1em @R=.7em {
\lstick{\ket{0}} & \gate{Y} & \qw \\
}
"#);
} | rust_cleaned_test_functions.jsonl/21205 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 160
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26174,
327,
741,
262,
341,
286,
1077,
18126,
284,
809,
486,
931,
543,
286,
1077,
5206,
1584,
284,
9926,
327,
16894,
1397,
486,
931,
7,
16,
11,
220,
15,
317,
286,
2060,
10714,
10297,
24601,
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_shred_type_compat() {
assert_eq!(std::mem::size_of::<ShredType>(), std::mem::size_of::<u8>());
assert_eq!(ShredType::from_u8(0), None);
assert_eq!(ShredType::from_u8(1), None);
assert_matches!(bincode::deserialize::<ShredType>(&[0u8]), Err(_));
// data shred
assert_eq!(ShredType::Data as u8, 0b1010_0101);
assert_eq!(ShredType::from_u8(0b1010_0101), Some(ShredType::Data));
let buf = bincode::serialize(&ShredType::Data).unwrap();
assert_eq!(buf, vec![0b1010_0101]);
assert_matches!(
bincode::deserialize::<ShredType>(&[0b1010_0101]),
Ok(ShredType::Data)
);
// coding shred
assert_eq!(ShredType::Code as u8, 0b0101_1010);
assert_eq!(ShredType::from_u8(0b0101_1010), Some(ShredType::Code));
let buf = bincode::serialize(&ShredType::Code).unwrap();
assert_eq!(buf, vec![0b0101_1010]);
assert_matches!(
bincode::deserialize::<ShredType>(&[0b0101_1010]),
Ok(ShredType::Code)
);
} | rust_cleaned_test_functions.jsonl/125660 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 576
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3712,
1151,
1819,
89602,
368,
341,
286,
2060,
10714,
10297,
1834,
486,
10536,
486,
2141,
3575,
27638,
2016,
1151,
929,
39019,
1460,
486,
10536,
486,
2141,
3575,
27638,
84,
23,
32872,
286,
2060,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_logical() {
test_roundtrip("a && b || c");
test_roundtrip("a || b && c");
test_roundtrip("(a || b) && c");
test_roundtrip("(a || b) ?? c");
test_roundtrip("(a ?? b) || c");
} | rust_cleaned_test_functions.jsonl/102595 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
86484,
368,
341,
262,
1273,
29896,
32981,
445,
64,
1009,
293,
1369,
272,
797,
262,
1273,
29896,
32981,
445,
64,
1369,
293,
1009,
272,
797,
262,
1273,
29896,
32981,
31732,
64,
1369,
293,
8,
1009,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_success() {
let output = "{\"success\":true}";
let o: Result<Success, serde_json::error::Error> = serde_json::from_str(output);
assert!(o.is_ok());
} | rust_cleaned_test_functions.jsonl/56066 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 93
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18632,
368,
341,
286,
1077,
2550,
284,
54734,
5630,
11693,
1866,
26259,
286,
1077,
297,
25,
5714,
27,
7188,
11,
61570,
9455,
486,
841,
486,
1454,
29,
284,
61570,
9455,
486,
1499,
2895,
11057,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_mark_read_non_existing_post() {
let readlist = readlist_from(vec![
("feed1", vec!["post1", "post2"]),
("feed2", vec!["post3", "post5"]),
]);
let output = _mark_read(readlist.clone(), "post4");
assert_eq!(readlist, output);
} | rust_cleaned_test_functions.jsonl/56105 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 157
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18924,
6443,
21637,
62630,
6333,
368,
341,
286,
1077,
1349,
1607,
284,
1349,
1607,
5673,
25592,
90515,
310,
3489,
11184,
16,
497,
7486,
0,
1183,
2203,
16,
497,
330,
2203,
17,
46442,
310,
3489,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_region_new() {
let region = Region::new(RegionType::CacheFast);
assert_eq!(region.status, RegionStatus::Init);
assert!(!region.has_user_io());
assert!(region.seg.is_empty());
assert_eq!(region.chunks.len(), 0);
assert_eq!(region.tags.len(), 0);
assert_eq!(region.blob_address, 0);
assert_eq!(region.blob_len, 0);
} | rust_cleaned_test_functions.jsonl/130989 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 194
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20627,
5921,
368,
341,
286,
1077,
5537,
284,
17152,
486,
931,
7,
14091,
929,
486,
8233,
32174,
626,
286,
2060,
10714,
10297,
3943,
4299,
11,
17152,
2522,
486,
3803,
317,
286,
2060,
0,
3471,
3943... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_set_c() {
let mut cpu: CPU = CPU::new();
let pc = cpu.pc;
cpu = cpu.set_c(Register { value: 0 });
cpu.memory.write_64bit(1, 10);
cpu = execute_set(cpu, pc, 0b010);
assert_eq!(cpu.pc.value, 9);
assert_eq!(cpu.f.value, 0);
assert_eq!(cpu.c.value, 10);
} | rust_cleaned_test_functions.jsonl/123554 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
666,
368,
341,
286,
1077,
5206,
17319,
25,
13940,
284,
13940,
486,
931,
543,
286,
1077,
13312,
284,
17319,
53335,
401,
286,
17319,
284,
17319,
980,
666,
79203,
314,
897,
25,
220,
15,
1625,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pull_assignment_up_not_last_not_applicable() {
check_assist_not_applicable(
pull_assignment_up,
r#"
fn foo() {
let mut a = 1;
if true {
$0a = 2;
b = a;
} else {
a = 3;
}
}"#,
)
} | rust_cleaned_test_functions.jsonl/117255 | {
"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,
65693,
51891,
8237,
7913,
12195,
7913,
8191,
46114,
368,
341,
286,
1779,
12083,
380,
7913,
8191,
46114,
1006,
310,
6815,
51891,
8237,
345,
310,
435,
2,
698,
8822,
15229,
368,
341,
262,
1077,
5206,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_functions_keys() -> anyhow::Result<()> {
let func1 = new_null_func(S3X_AMZ_COPY_SOURCE, ValueSet::new(vec![Value::Bool(true)]))?;
let func2 = new_ip_address_func(
AWS_SOURCE_IP,
ValueSet::new(vec![Value::String("192.168.1.0/24".to_string())]),
)?;
let func3 = new_string_equals_func(
S3X_AMZ_COPY_SOURCE,
ValueSet::new(vec![Value::String("mybucket/myobject".to_string())]),
)?;
let func4 = new_string_like_func(
S3X_AMZ_COPY_SOURCE,
ValueSet::new(vec![Value::String("mybucket/myobject".to_string())]),
)?;
let cases = [(
Functions::new(vec![func1, func2, func3, func4]),
KeySet::from([S3X_AMZ_COPY_SOURCE, AWS_SOURCE_IP]),
)];
for (key, expected_result) in cases {
let result = key.keys();
assert_eq!(
result, expected_result,
"key: '{}', expected: {:?}, got: {:?}",
key, expected_result, result
);
}
Ok(())
} | rust_cleaned_test_functions.jsonl/29806 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 614
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31708,
12631,
368,
1464,
88964,
486,
2077,
71698,
341,
286,
1077,
2915,
16,
284,
501,
15162,
9596,
3759,
18,
55,
25022,
57,
35556,
25430,
11,
5162,
1649,
486,
931,
25592,
20703,
1130,
486,
11233,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_encode() {
let input = b"Burning 'em, if you ain't quick and nimble
I go crazy when I hear a cymbal";
let output = String::from("0b3637272a2b2e63622c2e69692a23693a2a3c6324202d623d63343c2a26226324272765272a282b2f20430a652e2c652a3124333a653e2b2027630c692b20283165286326302e27282f");
assert_eq!(bytes_to_hex_string(&encode(&input.to_vec(), &b"ICE".to_vec())), output);
} | rust_cleaned_test_functions.jsonl/51160 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 204
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
368,
341,
286,
1077,
1946,
284,
293,
63590,
53344,
364,
336,
11,
421,
498,
36102,
944,
3974,
323,
45692,
891,
198,
40,
728,
14264,
979,
358,
6723,
264,
272,
3356,
278,
876,
286,
1077,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mat_times_identity_equals_identity_times_mat() {
test_cases().iter().for_each(|test| {
let a_mat_times_identity = test.a_mat * Matrix2x2::identity();
let identity_times_a_mat = Matrix2x2::identity() * test.a_mat;
let b_mat_times_identity = test.b_mat * Matrix2x2::identity();
let identity_times_b_mat = Matrix2x2::identity() * test.b_mat;
assert_eq!(a_mat_times_identity, identity_times_a_mat);
assert_eq!(b_mat_times_identity, identity_times_b_mat);
})
} | rust_cleaned_test_functions.jsonl/128959 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 280
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16610,
22353,
46244,
61664,
46244,
22353,
16610,
368,
341,
286,
1273,
41427,
1005,
2015,
1005,
1958,
32046,
22428,
1944,
91,
341,
310,
1077,
264,
16610,
22353,
46244,
284,
1273,
5849,
16610,
353,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_data_attributes() {
use crate as typed_html;
use crate::dom::DOMTree;
let frag: DOMTree<String> = html!(<div data-id="1234">"Boo!"</div>);
assert_eq!("<div data-id=\"1234\">Boo!</div>", frag.to_string());
} | rust_cleaned_test_functions.jsonl/24614 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1769,
18240,
368,
341,
262,
990,
17717,
438,
31969,
9564,
280,
262,
990,
17717,
486,
5600,
486,
15242,
6533,
401,
262,
1077,
8343,
25,
18051,
6533,
3464,
29,
284,
5272,
10297,
27,
611,
821,
1289... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_builder_finish() {
let mut b = Int32BufferBuilder::new(5);
assert_eq!(16, b.capacity());
for i in 0..10 {
b.append(i);
}
let mut a = b.finish();
assert_eq!(40, a.len());
assert_eq!(0, b.len());
assert_eq!(0, b.capacity());
// Try build another buffer after cleaning up.
for i in 0..20 {
b.append(i)
}
assert_eq!(32, b.capacity());
a = b.finish();
assert_eq!(80, a.len());
} | rust_cleaned_test_functions.jsonl/74109 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 293
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28532,
42980,
368,
341,
286,
1077,
5206,
293,
284,
1333,
18,
17,
4095,
3297,
486,
931,
7,
20,
317,
286,
2060,
10714,
10297,
16,
21,
11,
293,
59168,
1423,
286,
369,
600,
304,
220,
15,
496,
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... | 3 |
#[test]
fn test_end_training_selected_participant_no_success() {
let mut protocol = Protocol::new(get_default_fl_settings());
let client_id = ClientId::new();
protocol.counters = Counters {
waiting: 0,
selected: 2,
done: 5,
done_and_inactive: 3,
ignored: 2,
};
protocol.end_training(client_id, false, ClientState::Selected);
let counters = protocol.counters();
let expected = Counters {
waiting: 0,
selected: 1,
done: 5,
done_and_inactive: 3,
ignored: 3,
};
assert_eq!(counters, expected);
assert_eq!(
protocol.next_event().unwrap(),
Event::SetState(client_id, ClientState::Ignored)
);
assert!(protocol.next_event().is_none());
} | rust_cleaned_test_functions.jsonl/97787 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 445
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6213,
32891,
23755,
10495,
21757,
6536,
18632,
368,
341,
286,
1077,
5206,
11507,
284,
24572,
486,
931,
5433,
9993,
5081,
10853,
1423,
286,
1077,
2943,
842,
284,
8423,
764,
486,
931,
543,
286,
1150... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cast_i32_utf8() -> Result<()> {
generic_test_cast!(
Int32Array,
DataType::Int32,
vec![1, 2, 3, 4, 5],
StringArray,
DataType::Utf8,
vec![Some("1"), Some("2"), Some("3"), Some("4"), Some("5")],
DEFAULT_DATAFUSION_CAST_OPTIONS
);
Ok(())
} | rust_cleaned_test_functions.jsonl/57555 | {
"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,
5303,
5318,
18,
17,
39453,
23,
368,
1464,
5714,
71698,
341,
286,
13954,
4452,
5303,
33673,
310,
1333,
18,
17,
1857,
345,
310,
33172,
486,
1072,
18,
17,
345,
310,
7486,
20703,
16,
11,
220,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_none_this_week() {
let metric = Metric {
id: Some("1".to_string()),
habit: "2".to_string(),
user: "3".to_string(),
time: Some(100)
};
let stats = into_weekly_figures(&vec![metric]);
assert_eq!(Stats {
success: 0
}, stats);
} | rust_cleaned_test_functions.jsonl/117602 | {
"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,
31488,
24868,
31277,
368,
341,
286,
1077,
18266,
284,
52458,
341,
310,
877,
25,
4329,
445,
16,
3263,
983,
3904,
14702,
310,
14132,
25,
330,
17,
3263,
983,
3904,
3148,
310,
1196,
25,
330,
18,
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_headers() {
match parse_http_headers("Host: 127.0.0.1\r\nUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:50.0) Gecko/20100101 Firefox/50.0\r\n") {
Ok((_, hdrs)) => {
let mut headers = Headers::new();
headers.push(("Host".to_string(), "127.0.0.1".to_string()));
headers.push(("User-Agent".to_string(), "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:50.0) Gecko/20100101 Firefox/50.0".to_string()));
assert!(compare_vec(&hdrs, &headers));
},
Err(_e) => {},
};
} | rust_cleaned_test_functions.jsonl/50870 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 361
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
26719,
368,
341,
286,
2432,
4715,
25888,
26719,
445,
9296,
25,
220,
16,
17,
22,
13,
15,
13,
15,
13,
16,
12016,
1699,
1474,
45118,
25,
34733,
14,
20,
13,
15,
320,
19552,
61594,
26,
156... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_fs_is_valid() {
let mut a = Fs(MODULUS);
assert!(!a.is_valid());
a.0.sub_noborrow(&FsRepr::from(1));
assert!(a.is_valid());
assert!(Fs(FsRepr::from(0)).is_valid());
assert!(!Fs(FsRepr([0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff])).is_valid());
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
for _ in 0..1000 {
let a = Fs::rand(&mut rng);
assert!(a.is_valid());
}
} | rust_cleaned_test_functions.jsonl/95510 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 261
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34470,
6892,
8337,
368,
341,
262,
1077,
5206,
264,
284,
84619,
3189,
2069,
1094,
2034,
317,
262,
2060,
0,
3471,
64,
2079,
8337,
1423,
262,
264,
13,
15,
4309,
1089,
674,
7768,
2099,
48300,
693,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_fq2_inverse() {
use super::fq::FqRepr;
use PrimeField;
assert!(Fq2::zero().inverse().is_none());
let a = Fq2 {
c0: Fq::from_repr(FqRepr([
0x85c9f989e1461f03,
0xa2e33c333449a1d6,
0x41e461154a7354a3,
0x9ee53e7e84d7532e,
0x1c202d8ed97afb45,
0x51d3f9253e2516f,
])).unwrap(),
c1: Fq::from_repr(FqRepr([
0xa7348a8b511aedcf,
0x143c215d8176b319,
0x4cc48081c09b8903,
0x9533e4a9a5158be,
0x7a5e1ecb676d65f9,
0x180c3ee46656b008,
])).unwrap(),
};
let a = a.inverse().unwrap();
assert_eq!(
a,
Fq2 {
c0: Fq::from_repr(FqRepr([
0x70300f9bcb9e594,
0xe5ecda5fdafddbb2,
0x64bef617d2915a8f,
0xdfba703293941c30,
0xa6c3d8f9586f2636,
0x1351ef01941b70c4
])).unwrap(),
c1: Fq::from_repr(FqRepr([
0x8c39fd76a8312cb4,
0x15d7b6b95defbff0,
0x947143f89faedee9,
0xcbf651a0f367afb2,
0xdf4e54f0d3ef15a6,
0x103bdf241afb0019
])).unwrap(),
}
);
} | rust_cleaned_test_functions.jsonl/130065 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 944
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
80,
17,
63333,
368,
341,
262,
990,
2256,
486,
63919,
486,
37,
80,
693,
649,
280,
262,
990,
12518,
1877,
401,
262,
2060,
10297,
37,
80,
17,
486,
14154,
1005,
61482,
1005,
285,
31488,
5231,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_builder_no_inline() {
let expected = EmbedField {
inline: false,
name: "name".to_owned(),
value: "value".to_owned(),
};
let actual = EmbedFieldBuilder::new("name", "value").build();
assert_eq!(actual, expected);
} | rust_cleaned_test_functions.jsonl/62786 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 150
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28532,
6536,
41871,
368,
341,
286,
1077,
3601,
284,
37068,
1877,
341,
310,
7381,
25,
895,
345,
310,
829,
25,
330,
606,
3263,
983,
51973,
3148,
310,
897,
25,
330,
957,
3263,
983,
51973,
3148,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fold_after_tab_as_word_boundary() {
new_ucmd!()
.args(&["-w10", "-s"])
.pipe_in("a\tbbb\n")
.succeeds()
.stdout_is("a\t\nbbb\n");
} | rust_cleaned_test_functions.jsonl/23286 | {
"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,
61187,
19844,
17344,
11898,
13533,
54004,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
12,
86,
16,
15,
497,
6523,
82,
14108,
286,
659,
13768,
1243,
445,
64,
4955,
53151,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_cluster_nodes_broadcast() {
let mut rng = rand::thread_rng();
let (nodes, stakes, cluster_info) = make_cluster(&mut rng);
// ClusterInfo::tvu_peers excludes the node itself.
assert_eq!(cluster_info.tvu_peers().len(), nodes.len() - 1);
let cluster_nodes = ClusterNodes::<BroadcastStage>::new(&cluster_info, &stakes);
// All nodes with contact-info should be in the index.
// Excluding this node itself.
assert_eq!(cluster_nodes.index.len() + 1, nodes.len());
// Staked nodes with no contact-info should be included.
assert!(cluster_nodes.nodes.len() > nodes.len());
// Assert that all nodes keep their contact-info.
{
let cluster_nodes: HashMap<_, _> = cluster_nodes
.nodes
.iter()
.map(|node| (node.pubkey(), node))
.collect();
for node in &nodes {
assert_eq!(cluster_nodes[&node.id].contact_info().unwrap().id, node.id);
}
for (pubkey, stake) in &stakes {
if *stake > 0 {
assert_eq!(cluster_nodes[pubkey].stake, *stake);
}
}
}
let (peers, peers_and_stakes) = get_broadcast_peers(&cluster_info, Some(&stakes));
assert_eq!(peers_and_stakes.len(), peers.len());
assert_eq!(cluster_nodes.index.len(), peers.len());
for (i, node) in cluster_nodes
.index
.iter()
.map(|(_, i)| &cluster_nodes.nodes[*i])
.enumerate()
{
let (stake, index) = peers_and_stakes[i];
assert_eq!(node.contact_info().unwrap(), &peers[index]);
assert_eq!(node.stake.max(1), stake);
}
for _ in 0..100 {
let mut shred_seed = [0u8; 32];
rng.fill(&mut shred_seed[..]);
let index = weighted_best(&peers_and_stakes, shred_seed);
let peer = cluster_nodes.get_broadcast_peer(shred_seed).unwrap();
assert_eq!(*peer, peers[index]);
}
} | rust_cleaned_test_functions.jsonl/18830 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1094
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28441,
14896,
74923,
368,
341,
286,
1077,
5206,
28422,
284,
10382,
486,
4528,
66849,
543,
286,
1077,
320,
20008,
11,
44425,
11,
10652,
3109,
8,
284,
1281,
28441,
2099,
6984,
28422,
317,
286,
442,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_max_sum() {
assert_eq!(max_sum(0), 0);
assert_eq!(max_sum(1), 1);
assert_eq!(max_sum(2), 1);
assert_eq!(max_sum(3), 2);
assert_eq!(max_sum(4), 2);
assert_eq!(max_sum(5), 2);
assert_eq!(max_sum(6), 3);
assert_eq!(max_sum(7), 3);
assert_eq!(max_sum(8), 3);
assert_eq!(max_sum(9), 3);
assert_eq!(max_sum(10), 4);
assert_eq!(max_sum(5049), 99);
assert_eq!(max_sum(5050), 100);
assert_eq!(max_sum(5051), 100);
assert_eq!(max_sum(5150), 100);
assert_eq!(max_sum(5151), 101);
} | rust_cleaned_test_functions.jsonl/2727 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 298
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6345,
10160,
368,
341,
262,
2060,
10714,
10297,
2810,
10160,
7,
15,
701,
220,
15,
317,
262,
2060,
10714,
10297,
2810,
10160,
7,
16,
701,
220,
16,
317,
262,
2060,
10714,
10297,
2810,
10160,
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_metrics_report_update_check_failure_reason_omaha() {
block_on(async {
let mut metrics_reporter = MockMetricsReporter::new();
let mut state_machine = StateMachineBuilder::new_stub()
.metrics_reporter(&mut metrics_reporter)
.build()
.await;
state_machine.run_once().await;
assert!(metrics_reporter
.metrics
.contains(&Metrics::UpdateCheckFailureReason(UpdateCheckFailureReason::Omaha)));
});
} | rust_cleaned_test_functions.jsonl/59689 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 283
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37686,
14813,
8882,
7200,
43618,
38229,
62,
316,
13546,
368,
341,
286,
2504,
4470,
18285,
341,
310,
1077,
5206,
16734,
14813,
261,
284,
14563,
27328,
52766,
486,
931,
543,
310,
1077,
5206,
1584,
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_init_with_empty_state() {
let initial_state_json: serde_json::Value = serde_json::from_str("{}").unwrap();
let value = Value::from_json(&initial_state_json);
let (frontend, _) = Frontend::new_with_initial_state(value).unwrap();
let result_state = frontend.state().to_json();
assert_eq!(initial_state_json, result_state);
} | rust_cleaned_test_functions.jsonl/75975 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6137,
6615,
15124,
4387,
368,
341,
262,
1077,
2856,
4387,
9455,
25,
61570,
9455,
486,
1130,
284,
61570,
9455,
486,
1499,
2895,
53430,
1827,
15454,
543,
262,
1077,
897,
284,
5162,
486,
1499,
9455,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cpuset_systemd_too_old() -> Result<()> {
let systemd_version = 235;
let cpu = LinuxCpuBuilder::default()
.build()
.context("build cpu spec")?;
let mut properties: HashMap<&str, Box<dyn RefArg>> = HashMap::new();
let result = CpuSet::apply(&cpu, systemd_version, &mut properties);
assert!(result.is_err());
Ok(())
} | rust_cleaned_test_functions.jsonl/39170 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 191
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
90673,
295,
17687,
67,
2346,
78,
21108,
368,
1464,
5714,
71698,
341,
286,
1077,
74966,
9438,
284,
220,
17,
18,
20,
280,
286,
1077,
17319,
284,
14340,
34,
5584,
3297,
486,
2258,
741,
310,
659,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.