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_scalar_multiplication() {
let c = 7.04217;
let p = Point3::new(70.0, 49.0, 95.0);
let expected = Point3::new(p.x * c, p.y * c, p.z *c);
let result = p * c;
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/4556 | {
"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,
41652,
91802,
1693,
368,
341,
286,
1077,
272,
284,
220,
22,
13,
15,
19,
17,
16,
22,
280,
286,
1077,
281,
284,
5126,
18,
486,
931,
7,
22,
15,
13,
15,
11,
220,
220,
19,
24,
13,
15,
11,
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_string() {
let _setup_guard = setup();
let mut isolate = v8::Isolate::new(Default::default());
{
let mut hs = v8::HandleScope::new(&mut isolate);
let scope = hs.enter();
let reference = "Hello 🦕 world!";
let local = v8::String::new(scope, reference).unwrap();
assert_eq!(15, local.length());
assert_eq!(17, local.utf8_length(scope));
assert_eq!(reference, local.to_rust_string_lossy(scope));
}
{
let mut hs = v8::HandleScope::new(&mut isolate);
let scope = hs.enter();
let local = v8::String::empty(scope);
assert_eq!(0, local.length());
assert_eq!(0, local.utf8_length(scope));
assert_eq!("", local.to_rust_string_lossy(scope));
}
{
let mut hs = v8::HandleScope::new(&mut isolate);
let scope = hs.enter();
let local =
v8::String::new_from_utf8(scope, b"", v8::NewStringType::Normal).unwrap();
assert_eq!(0, local.length());
assert_eq!(0, local.utf8_length(scope));
assert_eq!("", local.to_rust_string_lossy(scope));
}
} | rust_cleaned_test_functions.jsonl/77891 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 430
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
368,
341,
220,
1077,
716,
15188,
36796,
284,
6505,
543,
220,
1077,
5206,
42123,
284,
348,
23,
486,
3872,
33066,
486,
931,
87874,
486,
2258,
1423,
220,
341,
262,
1077,
5206,
32220,
284,
348... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_single_rules() {
assert_eq!(
rule("& a"),
Ok((
"",
Rule::SetContext {
before: None,
sequence: "a".into()
},
))
);
assert_eq!(
rule("< a"),
Ok((
"",
Rule::Increment {
level: 1,
prefix: None,
extension: None,
sequence: "a".into()
}
))
);
assert_eq!(
rule("<* abc-z"),
Ok((
"",
Rule::MultiIncrement {
level: 1,
multisequence: vec![
SequenceElement::Char('a'),
SequenceElement::Char('b'),
SequenceElement::Range('c'..='z'),
]
}
))
);
assert_eq!(
rule("=* abc-z"),
Ok((
"",
Rule::MultiEqual {
multisequence: vec![
SequenceElement::Char('a'),
SequenceElement::Char('b'),
SequenceElement::Range('c'..='z'),
]
}
))
)
} | rust_cleaned_test_functions.jsonl/21712 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 988
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19487,
21407,
368,
341,
286,
2060,
10714,
33673,
310,
5912,
34866,
264,
4461,
310,
7622,
94702,
394,
8324,
394,
18100,
486,
1649,
1972,
341,
503,
1573,
25,
2240,
345,
503,
8500,
25,
330,
64,
326... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_calculation_of_potentials() {
let mut t = init();
t.least_cost_method();
t.replenish();
let u = vec![0, -2, -4, -4];
let v = vec![4, 5, 3, 6];
assert_eq!(t.calculation_of_potentials(), (u, v));
} | rust_cleaned_test_functions.jsonl/26612 | {
"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,
38241,
2914,
3575,
57952,
8476,
368,
341,
262,
1077,
5206,
259,
284,
2930,
543,
262,
259,
30502,
559,
15890,
9032,
543,
262,
259,
1327,
86535,
812,
543,
262,
1077,
575,
284,
7486,
20703,
15,
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_valid_vm_config_fs() {
vec![
(
vec![
"cloud-hypervisor", "--kernel", "/path/to/kernel",
"--memory", "shared=true",
"--fs",
"tag=virtiofs1,socket=/path/to/sock1",
"tag=virtiofs2,socket=/path/to/sock2",
],
r#"{
"kernel": {"path": "/path/to/kernel"},
"memory" : { "shared": true, "size": 536870912 },
"fs": [
{"tag": "virtiofs1", "socket": "/path/to/sock1"},
{"tag": "virtiofs2", "socket": "/path/to/sock2"}
]
}"#,
true,
),
(
vec![
"cloud-hypervisor", "--kernel", "/path/to/kernel",
"--memory", "shared=true",
"--fs",
"tag=virtiofs1,socket=/path/to/sock1",
"tag=virtiofs2,socket=/path/to/sock2",
],
r#"{
"kernel": {"path": "/path/to/kernel"},
"memory" : { "shared": true, "size": 536870912 },
"fs": [
{"tag": "virtiofs1", "socket": "/path/to/sock1"}
]
}"#,
false,
),
(
vec![
"cloud-hypervisor", "--kernel", "/path/to/kernel",
"--memory", "shared=true",
"--fs",
"tag=virtiofs1,socket=/path/to/sock1,num_queues=4",
],
r#"{
"kernel": {"path": "/path/to/kernel"},
"memory" : { "shared": true, "size": 536870912 },
"fs": [
{"tag": "virtiofs1", "socket": "/path/to/sock1", "num_queues": 4}
]
}"#,
true,
),
(
vec![
"cloud-hypervisor", "--kernel", "/path/to/kernel",
"--memory", "shared=true",
"--fs",
"tag=virtiofs1,socket=/path/to/sock1,num_queues=4,queue_size=128"
],
r#"{
"kernel": {"path": "/path/to/kernel"},
"memory" : { "shared": true, "size": 536870912 },
"fs": [
{"tag": "virtiofs1", "socket": "/path/to/sock1", "num_queues": 4, "queue_size": 128}
]
}"#,
true,
),
(
vec![
"cloud-hypervisor", "--kernel", "/path/to/kernel",
"--memory", "shared=true",
"--fs",
"tag=virtiofs1,socket=/path/to/sock1,num_queues=4,queue_size=128,dax=on"
],
r#"{
"kernel": {"path": "/path/to/kernel"},
"memory" : { "shared": true, "size": 536870912 },
"fs": [
{"tag": "virtiofs1", "socket": "/path/to/sock1", "num_queues": 4, "queue_size": 128}
]
}"#,
true,
),
(
vec![
"cloud-hypervisor", "--kernel", "/path/to/kernel",
"--memory", "shared=true",
"--fs",
"tag=virtiofs1,socket=/path/to/sock1,num_queues=4,queue_size=128,dax=on"
],
r#"{
"kernel": {"path": "/path/to/kernel"},
"memory" : { "shared": true, "size": 536870912 },
"fs": [
{"tag": "virtiofs1", "socket": "/path/to/sock1", "num_queues": 4, "queue_size": 128, "dax": true}
]
}"#,
true,
),
(
vec![
"cloud-hypervisor", "--kernel", "/path/to/kernel",
"--memory", "shared=true",
"--fs",
"tag=virtiofs1,socket=/path/to/sock1,num_queues=4,queue_size=128"
],
r#"{
"kernel": {"path": "/path/to/kernel"},
"memory" : { "shared": true, "size": 536870912 },
"fs": [
{"tag": "virtiofs1", "socket": "/path/to/sock1", "num_queues": 4, "queue_size": 128, "dax": true}
]
}"#,
true,
),
(
vec![
"cloud-hypervisor", "--kernel", "/path/to/kernel",
"--memory", "shared=true",
"--fs",
"tag=virtiofs1,socket=/path/to/sock1,num_queues=4,queue_size=128,cache_size=8589934592"
],
r#"{
"kernel": {"path": "/path/to/kernel"},
"memory" : { "shared": true, "size": 536870912 },
"fs": [
{"tag": "virtiofs1", "socket": "/path/to/sock1", "num_queues": 4, "queue_size": 128}
]
}"#,
true,
),
(
vec![
"cloud-hypervisor", "--kernel", "/path/to/kernel",
"--memory", "shared=true",
"--fs",
"tag=virtiofs1,socket=/path/to/sock1,num_queues=4,queue_size=128"
],
r#"{
"kernel": {"path": "/path/to/kernel"},
"memory" : { "shared": true, "size": 536870912 },
"fs": [
{"tag": "virtiofs1", "socket": "/path/to/sock1", "num_queues": 4, "queue_size": 128, "cache_size": 8589934592}
]
}"#,
true,
),
(
vec![
"cloud-hypervisor", "--kernel", "/path/to/kernel",
"--memory", "shared=true",
"--fs",
"tag=virtiofs1,socket=/path/to/sock1,num_queues=4,queue_size=128,cache_size=4294967296"
],
r#"{
"kernel": {"path": "/path/to/kernel"},
"memory" : { "shared": true, "size": 536870912 },
"fs": [
{"tag": "virtiofs1", "socket": "/path/to/sock1", "num_queues": 4, "queue_size": 128, "cache_size": 4294967296}
]
}"#,
true,
),
(
vec![
"cloud-hypervisor", "--kernel", "/path/to/kernel",
"--memory", "shared=true",
"--fs",
"tag=virtiofs1,socket=/path/to/sock1,num_queues=4,queue_size=128,cache_size=4294967296"
],
r#"{
"kernel": {"path": "/path/to/kernel"},
"memory" : { "shared": true, "size": 536870912 },
"fs": [
{"tag": "virtiofs1", "socket": "/path/to/sock1", "num_queues": 4, "queue_size": 128}
]
}"#,
false,
),
]
.iter()
.for_each(|(cli, openapi, equal)| {
compare_vm_config_cli_vs_json(cli, openapi, *equal);
});
} | rust_cleaned_test_functions.jsonl/64903 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 5053
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8337,
39008,
5332,
34470,
368,
341,
286,
7486,
90515,
310,
2399,
394,
7486,
90515,
503,
330,
12361,
2832,
1082,
31396,
497,
14482,
23248,
497,
3521,
2343,
32429,
58343,
756,
503,
14482,
17269,
497,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ocaml_hash_string() {
// Left-side values obtained with OCaml: Hashtbl.hash "the-string"
assert_eq!(0, ocaml_hash_string(0, b""));
assert_eq!(721651713, ocaml_hash_string(0, b"a"));
assert_eq!(856662637, ocaml_hash_string(0, b"ab"));
assert_eq!(767105082, ocaml_hash_string(0, b"abc"));
assert_eq!(65890154, ocaml_hash_string(0, b"abcd"));
assert_eq!(335633756, ocaml_hash_string(0, b"abcde"));
assert_eq!(926323203, ocaml_hash_string(0, b"abcdef"));
} | rust_cleaned_test_functions.jsonl/24604 | {
"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,
49648,
9467,
8950,
3904,
368,
341,
286,
442,
13727,
24067,
2750,
12180,
448,
31867,
9467,
25,
11443,
426,
2024,
15101,
330,
1782,
30881,
698,
286,
2060,
10714,
10297,
15,
11,
17796,
9467,
8950,
39... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_subsubcommand() {
assert_eq!(
Opt3 {
all: true,
cmd: Sub2::Foo {
file: "lib.rs".to_string(),
cmd: Sub3::Quux {}
}
},
Opt3::parse_from(&["test", "--all", "foo", "lib.rs", "quux"])
);
} | rust_cleaned_test_functions.jsonl/46411 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 190
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5228,
1966,
5631,
368,
341,
262,
2060,
10714,
33673,
286,
16554,
18,
341,
310,
678,
25,
830,
345,
310,
5439,
25,
3719,
17,
486,
40923,
341,
394,
1034,
25,
330,
2740,
25638,
3263,
983,
3904,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_groupby_projection_pd_same_column() -> Result<()> {
// this query failed when projection pushdown was enabled
let a = || {
let df = df![
"col1" => ["a", "ab", "abc"],
"col2" => [1, 2, 3]
]
.unwrap();
df.lazy()
.select(vec![col("col1").alias("foo"), col("col2").alias("bar")])
};
let out = a()
.left_join(a(), col("foo"), col("foo"))
.select(vec![col("bar")])
.collect()?;
let a = out.column("bar")?.i32()?;
assert_eq!(Vec::from(a), &[Some(1), Some(2), Some(3)]);
Ok(())
} | rust_cleaned_test_functions.jsonl/22392 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 319
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6288,
1694,
72738,
31322,
33574,
8744,
368,
1464,
5714,
71698,
341,
262,
442,
419,
3239,
4641,
979,
21615,
4484,
2923,
572,
8970,
271,
262,
1077,
264,
284,
1369,
341,
286,
1077,
6764,
284,
6764,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_at() {
let _reset = set_time_zone();
let time = Timespec::new(1234567890, 54321);
let local = at(time);
debug!("time_at: {:?}", local);
assert_eq!(local.tm_sec, 30);
assert_eq!(local.tm_min, 31);
assert_eq!(local.tm_hour, 15);
assert_eq!(local.tm_mday, 13);
assert_eq!(local.tm_mon, 1);
assert_eq!(local.tm_year, 109);
assert_eq!(local.tm_wday, 5);
assert_eq!(local.tm_yday, 43);
assert_eq!(local.tm_isdst, 0);
assert_eq!(local.tm_utcoff, -28800);
assert_eq!(local.tm_nsec, 54321);
} | rust_cleaned_test_functions.jsonl/7338 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 343
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3752,
368,
341,
286,
1077,
716,
9716,
284,
738,
3009,
28692,
1428,
286,
1077,
882,
284,
8523,
992,
486,
931,
7,
16,
17,
18,
19,
20,
21,
22,
23,
24,
15,
11,
220,
20,
19,
18,
17,
16,
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_bitcoin_to_from_proto() {
for feature in [
"bitcoin_mainnet",
"bitcoin_mainnet_paused",
"bitcoin_testnet",
"bitcoin_testnet_paused",
] {
let subnet_feature = SubnetFeatures::from_str(feature).unwrap();
assert_eq!(
subnet_feature,
SubnetFeatures::from(pb::SubnetFeatures::from(subnet_feature))
);
}
} | rust_cleaned_test_functions.jsonl/36347 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 255
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13996,
7160,
2346,
5673,
37689,
368,
341,
286,
369,
4565,
304,
2278,
310,
330,
83910,
11027,
4711,
756,
310,
330,
83910,
11027,
4711,
55475,
2591,
756,
310,
330,
83910,
4452,
4711,
756,
310,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_column_writer_compression_v1() {
let props = WriterProperties::builder()
.set_writer_version(WriterVersion::PARQUET_1_0)
.set_compression(Compression::SNAPPY)
.build();
column_roundtrip_random::<Int32Type>(
props,
2048,
std::i32::MIN,
std::i32::MAX,
10,
10,
);
} | rust_cleaned_test_functions.jsonl/85660 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 240
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8744,
28908,
2965,
4011,
2273,
16,
368,
341,
286,
1077,
6914,
284,
29404,
7903,
486,
17850,
741,
310,
659,
746,
28908,
9438,
7,
6492,
5637,
486,
16567,
5757,
1348,
62,
16,
62,
15,
340,
310,
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_unquote_char() {
let s = "'→'";
let c = unquote_char(s, '\'');
assert_eq!(c, Some('→'));
let s = "'→←'";
let c = unquote_char(s, '\'');
assert_eq!(c, None);
let s = r"'\xf0\x9f\x92\xa9'";
let c = unquote_char(s, '\'');
assert_eq!(c, Some('💩'));
let s = r"'\xf0\x9f\x92\xa'";
let c = unquote_char(s, '\'');
assert_eq!(c, None);
let s = r"'\xf0\x9f\x92\xa99'";
let c = unquote_char(s, '\'');
assert_eq!(c, None);
let s = r"'\u263a'";
let c = unquote_char(s, '\'');
assert_eq!(c, Some('☺'));
let s = r"'\uD83D\uDCA9'";
let c = unquote_char(s, '\'');
assert_eq!(c, Some('💩'));
let s = r"'\uD83\uDCA9'";
let c = unquote_char(s, '\'');
assert_eq!(c, None);
let s = r"'\uD83D\uDCA9B'";
let c = unquote_char(s, '\'');
assert_eq!(c, None);
let s = r"'\U0001F4A9'";
let c = unquote_char(s, '\'');
assert_eq!(c, Some('💩'));
let s = r"'\U0001F4A'";
let c = unquote_char(s, '\'');
assert_eq!(c, None);
let s = r"'\U0001F4A99'";
let c = unquote_char(s, '\'');
assert_eq!(c, None);
} | rust_cleaned_test_functions.jsonl/76783 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 789
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
2949,
9232,
368,
341,
286,
1077,
274,
284,
7178,
51018,
21689,
286,
1077,
272,
284,
650,
2949,
9232,
1141,
11,
58355,
1157,
286,
2060,
10714,
10297,
66,
11,
4329,
492,
51018,
6336,
286,
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_log_create() {
let l = Log::<Operation>::new(1024 * 1024);
let n = (1024 * 1024) / Log::<Operation>::entry_size();
assert_eq!(l.rawb, 1024 * 1024);
assert_eq!(l.size, n);
assert_eq!(l.slog.len(), n);
assert_eq!(l.head.load(Ordering::Relaxed), 0);
assert_eq!(l.tail.load(Ordering::Relaxed), 0);
assert_eq!(l.next.load(Ordering::Relaxed), 1);
assert_eq!(l.ctail.load(Ordering::Relaxed), 0);
for i in 0..MAX_REPLICAS {
assert_eq!(l.ltails[i].load(Ordering::Relaxed), 0);
}
for i in 0..MAX_REPLICAS {
assert_eq!(l.lmasks[i].get(), true);
}
} | rust_cleaned_test_functions.jsonl/101042 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 370
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5224,
8657,
368,
341,
286,
1077,
326,
284,
2835,
27638,
8432,
6831,
931,
7,
16,
15,
17,
19,
353,
220,
16,
15,
17,
19,
317,
286,
1077,
308,
284,
320,
16,
15,
17,
19,
353,
220,
16,
15,
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... | 3 |
#[test]
fn test_parse_string_argument() {
let type_info = dlt::TypeInfo {
kind: dlt::TypeInfoKind::StringType,
coding: dlt::StringCoding::UTF8,
has_variable_info: false,
has_trace_info: false,
};
let argument = dlt::Argument {
type_info,
name: None,
unit: None,
fixed_point: None,
value: dlt::Value::StringVal("foo".to_string()),
};
let mut argument_bytes = argument.as_bytes::<BigEndian>();
println!("argument bytes: {:02X?}", argument_bytes);
argument_bytes.extend(b"----");
let res: IResult<&[u8], dlt::Argument> = dlt_argument::<BigEndian>(&argument_bytes);
let expected: IResult<&[u8], dlt::Argument> = Ok((b"----", argument));
assert_eq!(expected, res);
} | rust_cleaned_test_functions.jsonl/73190 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 424
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
3904,
9025,
368,
341,
286,
1077,
943,
3109,
284,
294,
4832,
486,
45588,
341,
310,
3093,
25,
294,
4832,
486,
45588,
10629,
486,
703,
929,
345,
310,
10822,
25,
294,
4832,
486,
703,
77513,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_set() -> Result<()> {
let systemd_version = 245;
let cpu = LinuxCpuBuilder::default()
.cpus("0-3")
.mems("0-3")
.build()
.context("build cpu spec")?;
let mut properties: HashMap<&str, Box<dyn RefArg>> = HashMap::new();
CpuSet::apply(&cpu, systemd_version, &mut properties).context("apply cpuset")?;
assert_eq!(properties.len(), 2);
assert!(properties.contains_key(ALLOWED_CPUS));
let cpus = properties.get(ALLOWED_CPUS).unwrap();
assert_eq!(cpus.arg_type(), ArgType::Array);
assert!(properties.contains_key(ALLOWED_NODES));
let mems = properties.get(ALLOWED_NODES).unwrap();
assert_eq!(mems.arg_type(), ArgType::Array);
Ok(())
} | rust_cleaned_test_functions.jsonl/39171 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 388
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
90673,
295,
2602,
368,
1464,
5714,
71698,
341,
286,
1077,
74966,
9438,
284,
220,
17,
19,
20,
280,
286,
1077,
17319,
284,
14340,
34,
5584,
3297,
486,
2258,
741,
310,
659,
4672,
355,
445,
15,
12... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_div_rem() {
fn check_sub(a: &BigInt, b: &BigInt, ans_q: &BigInt, ans_r: &BigInt) {
let (q, r) = a.div_rem(b);
if !r.is_zero() {
assert_eq!(r.sign(), a.sign());
}
assert!(r.abs() <= b.abs());
assert!(*a == b * &q + &r);
assert!(q == *ans_q);
assert!(r == *ans_r);
let (a, b, ans_q, ans_r) = (a.clone(), b.clone(), ans_q.clone(), ans_r.clone());
assert_op!(a / b == ans_q);
assert_op!(a % b == ans_r);
assert_assign_op!(a /= b == ans_q);
assert_assign_op!(a %= b == ans_r);
}
fn check(a: &BigInt, b: &BigInt, q: &BigInt, r: &BigInt) {
check_sub(a, b, q, r);
check_sub(a, &b.neg(), &q.neg(), r);
check_sub(&a.neg(), b, &q.neg(), &r.neg());
check_sub(&a.neg(), &b.neg(), q, &r.neg());
}
for elm in MUL_TRIPLES.iter() {
let (a_vec, b_vec, c_vec) = *elm;
let a = BigInt::from_slice(Plus, a_vec);
let b = BigInt::from_slice(Plus, b_vec);
let c = BigInt::from_slice(Plus, c_vec);
if !a.is_zero() {
check(&c, &a, &b, &Zero::zero());
}
if !b.is_zero() {
check(&c, &b, &a, &Zero::zero());
}
}
for elm in DIV_REM_QUADRUPLES.iter() {
let (a_vec, b_vec, c_vec, d_vec) = *elm;
let a = BigInt::from_slice(Plus, a_vec);
let b = BigInt::from_slice(Plus, b_vec);
let c = BigInt::from_slice(Plus, c_vec);
let d = BigInt::from_slice(Plus, d_vec);
if !b.is_zero() {
check(&a, &b, &c, &d);
}
}
} | rust_cleaned_test_functions.jsonl/56632 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 924
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16237,
19194,
368,
341,
262,
5168,
1779,
5228,
2877,
25,
609,
87474,
11,
293,
25,
609,
87474,
11,
8099,
8976,
25,
609,
87474,
11,
8099,
1710,
25,
609,
87474,
8,
341,
286,
1077,
320,
80,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_zip_nth() {
let xs = [0, 1, 2, 4, 5];
let ys = [10, 11, 12];
let mut it = xs.iter().zip(&ys);
assert_eq!(it.nth(0), Some((&0, &10)));
assert_eq!(it.nth(1), Some((&2, &12)));
assert_eq!(it.nth(0), None);
let mut it = xs.iter().zip(&ys);
assert_eq!(it.nth(3), None);
let mut it = ys.iter().zip(&xs);
assert_eq!(it.nth(3), None);
} | rust_cleaned_test_functions.jsonl/8958 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 211
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42131,
78342,
368,
341,
262,
1077,
11943,
284,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
19,
11,
220,
20,
935,
262,
1077,
31810,
284,
508,
16,
15,
11,
220,
16,
16,
11,
220,
16,
17,
482... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_ref() {
let p0 = DefaultCell::new("item0");
let p1 = DefaultCell::new("item1");
assert!(p0 < p1);
assert!(p1 > p0);
} | rust_cleaned_test_functions.jsonl/40869 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9993,
7793,
368,
341,
286,
1077,
281,
15,
284,
7899,
3599,
486,
931,
445,
1203,
15,
797,
286,
1077,
281,
16,
284,
7899,
3599,
486,
931,
445,
1203,
16,
797,
286,
2060,
10297,
79,
15,
366,
281... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_input2_2() {
let content = "3417
17,x,13,19";
let input = input_generator(content);
let result = solve_part2(&input);
assert_eq!(result, 3417);
} | rust_cleaned_test_functions.jsonl/103595 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 83
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5898,
17,
62,
17,
368,
341,
262,
1077,
2213,
284,
330,
18,
19,
16,
22,
198,
16,
22,
12803,
11,
16,
18,
11,
16,
24,
876,
262,
1077,
1946,
284,
1946,
25813,
15063,
317,
262,
1077,
1102,
284,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_notify() {
let m = Arc::new(AtomicUsize::new(0));
let m2 = Arc::clone(&m);
System::run(move || {
let addr = ContextNoWait::create(move |ctx| {
ctx.notify(Ping);
ctx.notify(Ping);
ContextNoWait {
cnt: Arc::clone(&m),
}
});
addr.do_send(Ping);
actix_rt::spawn(async move {
delay_for(Duration::from_millis(200)).await;
System::current().stop();
});
})
.unwrap();
assert_eq!(m2.load(Ordering::Relaxed), 3);
} | rust_cleaned_test_functions.jsonl/94384 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 316
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36654,
368,
341,
262,
1077,
296,
284,
19689,
486,
931,
7,
65857,
52,
2141,
486,
931,
7,
15,
1106,
262,
1077,
296,
17,
284,
19689,
486,
19982,
2099,
76,
626,
262,
739,
486,
6108,
34081,
1369,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_empty() {
let mut r = Reader::from_str("<a />");
r.trim_text(true).expand_empty_elements(false);
next_eq!(r, Empty, b"a");
} | rust_cleaned_test_functions.jsonl/42066 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 77
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
368,
341,
262,
1077,
5206,
435,
284,
25166,
486,
1499,
2895,
9639,
64,
6206,
797,
262,
435,
16419,
4326,
3715,
568,
32317,
15124,
22801,
3576,
317,
262,
1790,
10714,
10297,
81,
11,
22228,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_passive_discovery_scan_args() {
let mut sched = create_sched();
let req = sched
.enqueue_scan_to_discover(passive_discovery_scan(10))
.expect("expected a ScanRequest");
assert_eq!(req.scan_type, fidl_mlme::ScanTypes::Passive);
assert_eq!(req.ssid, Vec::<u8>::new());
} | rust_cleaned_test_functions.jsonl/8139 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15464,
533,
9932,
7449,
28857,
8384,
368,
341,
286,
1077,
5206,
5575,
284,
1855,
67394,
543,
286,
1077,
4232,
284,
5575,
198,
310,
659,
61373,
28857,
2346,
9932,
3688,
39790,
533,
9932,
7449,
2885... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_constructor_keyword_arguments_error() {
common::setup();
let mut oso = OsoTest::new();
#[derive(PolarClass)]
struct Foo {
#[polar(attribute)]
x: i64,
}
impl Foo {
fn new(x: i64) -> Self {
Foo { x }
}
}
let foo_class = Foo::get_polar_class_builder()
.set_constructor(Foo::new)
.build();
oso.oso.register_class(foo_class).unwrap();
let mut query = oso.oso.query("x = new Foo(1)").unwrap();
assert_eq!(query.next().unwrap().unwrap().keys().count(), 1);
let mut query = oso.oso.query("x = new Foo(x: 1)").unwrap();
assert!(query.next().unwrap().is_err());
let mut query = oso.oso.query("x = new Foo(1, x: 1)").unwrap();
assert!(query.next().unwrap().is_err());
} | rust_cleaned_test_functions.jsonl/5012 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 375
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66210,
45824,
43433,
4096,
368,
341,
262,
4185,
486,
15188,
1428,
262,
1077,
5206,
297,
704,
284,
506,
704,
2271,
486,
931,
1428,
262,
11506,
27098,
5304,
7417,
1957,
5563,
262,
2036,
33428,
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... | 1 |
#[test]
fn test_satisfies_commitment() {
let status = TransactionStatus {
slot: 0,
confirmations: None,
status: Ok(()),
err: None,
};
assert!(status.satisfies_commitment(CommitmentConfig::default()));
assert!(status.satisfies_commitment(CommitmentConfig::recent()));
let status = TransactionStatus {
slot: 0,
confirmations: Some(10),
status: Ok(()),
err: None,
};
assert!(!status.satisfies_commitment(CommitmentConfig::default()));
assert!(status.satisfies_commitment(CommitmentConfig::recent()));
} | rust_cleaned_test_functions.jsonl/89283 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 322
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
7478,
550,
36346,
478,
368,
341,
286,
1077,
2639,
284,
17869,
2522,
341,
310,
9446,
25,
220,
15,
345,
310,
7683,
804,
25,
2240,
345,
310,
2639,
25,
7622,
5065,
1326,
310,
1848,
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,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_basic_email_bcc() {
let email = Email::new("test-from@email.org", "test-to@email.org", "Body text")
.with_bcc("bcc@email.org");
assert_eq!(email.to_string(), "{\"from\":\"test-from@email.org\",\"to\":\"test-to@email.org\",\"textbody\":\"Body text\",\"bcc\":\"bcc@email.org\"}");
} | rust_cleaned_test_functions.jsonl/67590 | {
"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,
34729,
9172,
880,
638,
368,
341,
262,
1077,
2551,
284,
8299,
486,
931,
445,
1944,
38051,
71776,
2659,
497,
330,
1944,
4686,
71776,
2659,
497,
330,
5444,
1467,
1138,
286,
659,
4197,
880,
638,
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_normalize() {
let c1 = XyY::new(0.3, 0.5, 1.5);
assert!(c1.is_normalized());
assert_eq!(c1.normalize(), c1);
let c2 = XyY::new(0.0, 0.0, 0.0);
assert!(c2.is_normalized());
assert_eq!(c2.normalize(), c2);
} | rust_cleaned_test_functions.jsonl/67706 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 165
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
80807,
368,
341,
286,
1077,
272,
16,
284,
1599,
88,
56,
486,
931,
7,
15,
13,
18,
11,
220,
15,
13,
20,
11,
220,
16,
13,
20,
317,
286,
2060,
10297,
66,
16,
2079,
80006,
1423,
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_results() {
let t = TestResponse::new();
let r = serde_json::to_string(&t).unwrap();
assert_eq!(
r#"{"result":[],"hasMore":false,"cached":false,"extra":{"stats":{"writesExecuted":0,"writesIgnored":0,"scannedFull":0,"scannedIndex":0,"filtered":0,"httpRequests":0,"executionTime":0.0,"fullCount":0,"peakMemoryUsage":0},"warnings":[]},"error":false,"code":0}"#,
r
);
// assert_eq!(
// r);
let t = TestResponse::with_code(401);
let r = serde_json::to_string(&t).unwrap();
assert_eq!(
r#"{"result":[],"hasMore":false,"cached":false,"extra":{"stats":{"writesExecuted":0,"writesIgnored":0,"scannedFull":0,"scannedIndex":0,"filtered":0,"httpRequests":0,"executionTime":0.0003654956817626953,"fullCount":0,"peakMemoryUsage":2019},"warnings":[]},"error":false,"code":401}"#,
r
);
} | rust_cleaned_test_functions.jsonl/3895 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 448
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13576,
368,
341,
286,
1077,
259,
284,
3393,
2582,
486,
931,
543,
286,
1077,
435,
284,
61570,
9455,
486,
983,
3904,
2099,
83,
568,
15454,
543,
286,
2060,
10714,
33673,
310,
435,
55543,
4913,
1382... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_raw_null() {
let (sql, params) = Postgres::build(Select::default().value(Value::Text(None).raw())).unwrap();
assert_eq!("SELECT null", sql);
assert!(params.is_empty());
} | rust_cleaned_test_functions.jsonl/6455 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 97
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16067,
15162,
368,
341,
286,
1077,
320,
3544,
11,
3628,
8,
284,
3877,
17818,
486,
5834,
7,
3379,
486,
2258,
1005,
957,
25346,
486,
1178,
26717,
568,
1041,
34670,
15454,
543,
286,
2060,
10714,
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 |
#[test]
fn test_audio_analysis() {
let spotify = Spotify::default()
.client_credentials_manager(CLIENT_CREDENTIAL.lock().unwrap().clone())
.build();
let track = "3JIxjvbbDrA9ztYlNcp3yL";
let analysis = spotify.audio_analysis(track);
assert!(analysis.is_ok());
} | rust_cleaned_test_functions.jsonl/96519 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29688,
42682,
368,
341,
1066,
262,
1077,
87790,
284,
40537,
486,
2258,
741,
286,
659,
2972,
47396,
12144,
52991,
10757,
920,
81509,
21003,
1005,
15454,
1005,
19982,
2398,
286,
659,
5834,
543,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_exclude() {
let mut config = configure(&[], &[]);
config.exclude = vec![
"src/test/run-pass".into(),
"src/tools/tidy".into(),
];
config.cmd = Subcommand::Test {
paths: Vec::new(),
test_args: Vec::new(),
rustc_args: Vec::new(),
fail_fast: true,
doc_tests: DocTests::No,
bless: false,
compare_mode: None,
};
let build = Build::new(config);
let builder = Builder::new(&build);
builder.run_step_descriptions(&Builder::get_step_descriptions(Kind::Test), &[]);
assert!(!builder.cache.contains::<test::RunPass>());
assert!(!builder.cache.contains::<test::Tidy>());
// Ensure other tests are not affected.
assert!(builder.cache.contains::<test::RunPassFullDeps>());
assert!(builder.cache.contains::<test::RustdocUi>());
} | rust_cleaned_test_functions.jsonl/1471 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 472
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88668,
368,
341,
286,
1077,
5206,
2193,
284,
14411,
2099,
12995,
609,
56703,
286,
2193,
89941,
284,
7486,
90515,
310,
330,
3548,
12697,
48385,
46967,
3263,
18122,
3148,
310,
330,
3548,
45714,
5523,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_command() {
let test_commands = app("test", "desc", "version");
let keypair = Keypair::new();
let pubkey = keypair.pubkey();
let pubkey_string = pubkey.to_string();
let keypair2 = Keypair::new();
let pubkey2 = keypair2.pubkey();
let pubkey2_string = pubkey2.to_string();
let default_keypair = Keypair::new();
let (default_keypair_file, mut tmp_file) = make_tmp_file();
write_keypair(&default_keypair, tmp_file.as_file_mut()).unwrap();
let test_authorize_voter = test_commands.clone().get_matches_from(vec![
"test",
"vote-authorize-voter",
&pubkey_string,
&pubkey2_string,
]);
assert_eq!(
parse_command(&test_authorize_voter, &default_keypair_file, None).unwrap(),
CliCommandInfo {
command: CliCommand::VoteAuthorize {
vote_account_pubkey: pubkey,
new_authorized_pubkey: pubkey2,
vote_authorize: VoteAuthorize::Voter
},
signers: vec![read_keypair_file(&default_keypair_file).unwrap().into()],
}
);
let (keypair_file, mut tmp_file) = make_tmp_file();
let keypair = Keypair::new();
write_keypair(&keypair, tmp_file.as_file_mut()).unwrap();
// Test CreateVoteAccount SubCommand
let (identity_keypair_file, mut tmp_file) = make_tmp_file();
let identity_keypair = Keypair::new();
write_keypair(&identity_keypair, tmp_file.as_file_mut()).unwrap();
let test_create_vote_account = test_commands.clone().get_matches_from(vec![
"test",
"create-vote-account",
&keypair_file,
&identity_keypair_file,
"--commission",
"10",
]);
assert_eq!(
parse_command(&test_create_vote_account, &default_keypair_file, None).unwrap(),
CliCommandInfo {
command: CliCommand::CreateVoteAccount {
seed: None,
identity_account: 2,
authorized_voter: None,
authorized_withdrawer: None,
commission: 10,
},
signers: vec![
read_keypair_file(&default_keypair_file).unwrap().into(),
Box::new(keypair),
read_keypair_file(&identity_keypair_file).unwrap().into(),
],
}
);
let (keypair_file, mut tmp_file) = make_tmp_file();
let keypair = Keypair::new();
write_keypair(&keypair, tmp_file.as_file_mut()).unwrap();
let test_create_vote_account2 = test_commands.clone().get_matches_from(vec![
"test",
"create-vote-account",
&keypair_file,
&identity_keypair_file,
]);
assert_eq!(
parse_command(&test_create_vote_account2, &default_keypair_file, None).unwrap(),
CliCommandInfo {
command: CliCommand::CreateVoteAccount {
seed: None,
identity_account: 2,
authorized_voter: None,
authorized_withdrawer: None,
commission: 100,
},
signers: vec![
read_keypair_file(&default_keypair_file).unwrap().into(),
Box::new(keypair),
read_keypair_file(&identity_keypair_file).unwrap().into(),
],
}
);
// test init with an authed voter
let authed = Pubkey::new_rand();
let (keypair_file, mut tmp_file) = make_tmp_file();
let keypair = Keypair::new();
write_keypair(&keypair, tmp_file.as_file_mut()).unwrap();
let test_create_vote_account3 = test_commands.clone().get_matches_from(vec![
"test",
"create-vote-account",
&keypair_file,
&identity_keypair_file,
"--authorized-voter",
&authed.to_string(),
]);
assert_eq!(
parse_command(&test_create_vote_account3, &default_keypair_file, None).unwrap(),
CliCommandInfo {
command: CliCommand::CreateVoteAccount {
seed: None,
identity_account: 2,
authorized_voter: Some(authed),
authorized_withdrawer: None,
commission: 100
},
signers: vec![
read_keypair_file(&default_keypair_file).unwrap().into(),
Box::new(keypair),
read_keypair_file(&identity_keypair_file).unwrap().into(),
],
}
);
let (keypair_file, mut tmp_file) = make_tmp_file();
let keypair = Keypair::new();
write_keypair(&keypair, tmp_file.as_file_mut()).unwrap();
// test init with an authed withdrawer
let test_create_vote_account4 = test_commands.clone().get_matches_from(vec![
"test",
"create-vote-account",
&keypair_file,
&identity_keypair_file,
"--authorized-withdrawer",
&authed.to_string(),
]);
assert_eq!(
parse_command(&test_create_vote_account4, &default_keypair_file, None).unwrap(),
CliCommandInfo {
command: CliCommand::CreateVoteAccount {
seed: None,
identity_account: 2,
authorized_voter: None,
authorized_withdrawer: Some(authed),
commission: 100
},
signers: vec![
read_keypair_file(&default_keypair_file).unwrap().into(),
Box::new(keypair),
read_keypair_file(&identity_keypair_file).unwrap().into(),
],
}
);
let test_update_validator = test_commands.clone().get_matches_from(vec![
"test",
"vote-update-validator",
&pubkey_string,
&identity_keypair_file,
&keypair_file,
]);
assert_eq!(
parse_command(&test_update_validator, &default_keypair_file, None).unwrap(),
CliCommandInfo {
command: CliCommand::VoteUpdateValidator {
vote_account_pubkey: pubkey,
new_identity_account: 2,
},
signers: vec![
read_keypair_file(&default_keypair_file).unwrap().into(),
Box::new(read_keypair_file(&keypair_file).unwrap()),
read_keypair_file(&identity_keypair_file).unwrap().into(),
],
}
);
// Test WithdrawFromVoteAccount subcommand
let test_withdraw_from_vote_account = test_commands.clone().get_matches_from(vec![
"test",
"withdraw-from-vote-account",
&keypair_file,
&pubkey_string,
"42",
]);
assert_eq!(
parse_command(
&test_withdraw_from_vote_account,
&default_keypair_file,
None
)
.unwrap(),
CliCommandInfo {
command: CliCommand::WithdrawFromVoteAccount {
vote_account_pubkey: read_keypair_file(&keypair_file).unwrap().pubkey(),
destination_account_pubkey: pubkey,
withdraw_authority: 0,
lamports: 42_000_000_000
},
signers: vec![read_keypair_file(&default_keypair_file).unwrap().into()],
}
);
// Test WithdrawFromVoteAccount subcommand with authority
let withdraw_authority = Keypair::new();
let (withdraw_authority_file, mut tmp_file) = make_tmp_file();
write_keypair(&withdraw_authority, tmp_file.as_file_mut()).unwrap();
let test_withdraw_from_vote_account = test_commands.clone().get_matches_from(vec![
"test",
"withdraw-from-vote-account",
&keypair_file,
&pubkey_string,
"42",
"--authorized-withdrawer",
&withdraw_authority_file,
]);
assert_eq!(
parse_command(
&test_withdraw_from_vote_account,
&default_keypair_file,
None
)
.unwrap(),
CliCommandInfo {
command: CliCommand::WithdrawFromVoteAccount {
vote_account_pubkey: read_keypair_file(&keypair_file).unwrap().pubkey(),
destination_account_pubkey: pubkey,
withdraw_authority: 1,
lamports: 42_000_000_000
},
signers: vec![
read_keypair_file(&default_keypair_file).unwrap().into(),
read_keypair_file(&withdraw_authority_file).unwrap().into()
],
}
);
} | rust_cleaned_test_functions.jsonl/57690 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 5045
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
10811,
368,
341,
286,
1077,
1273,
44151,
284,
906,
445,
1944,
497,
330,
8614,
497,
330,
4366,
797,
286,
1077,
1376,
12670,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
95116,
284,
137... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_longest_suit() {
let g = test_helpers::create_test_bid_phase();
// User: ♣2 ♣6 ♣9 ♣10 ♣A ♥6 ♥9 ♥10 ♥A ♠2 ♠7 ♠8 ♠K
assert_eq!(
longest_suit(hand_score(g.hand(Position::User))),
// HandBalance::Unbalanced
BidResponse::LongestSuit(Suit::Clubs)
);
// Dummy: ♦6 ♦7 ♦8 ♦K ♣5 ♣K ♥4 ♥7 ♥J ♥Q ♠4 ♠5 ♠10
assert_eq!(
longest_suit(hand_score(g.hand(Position::Dummy))),
// HandBalance::Balanced
BidResponse::Lo );
} | rust_cleaned_test_functions.jsonl/83223 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 331
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17799,
477,
643,
3083,
368,
341,
286,
1077,
342,
284,
1273,
54473,
486,
3182,
4452,
62509,
37593,
543,
286,
442,
2657,
25,
220,
35358,
96,
17,
35358,
96,
21,
35358,
96,
24,
35358,
96,
16,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_doc_comment_preserves_indents() {
let file = SourceFile::parse(
r#"
/// doc1
/// ```
/// fn foo() {
/// // ...
/// }
/// ```
mod foo {}
"#,
)
.ok()
.unwrap();
let module = file.syntax().descendants().find_map(Module::cast).unwrap();
assert_eq!("doc1\n```\nfn foo() {\n // ...\n}\n```", module.doc_comment_text().unwrap());
} | rust_cleaned_test_functions.jsonl/50912 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 233
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18869,
17638,
32116,
13280,
9122,
805,
368,
341,
262,
1077,
1034,
284,
8748,
1703,
486,
6400,
1006,
286,
435,
2,
698,
286,
1048,
4629,
16,
198,
286,
1048,
41233,
286,
1048,
5168,
15229,
368,
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... | 1 |
#[test]
fn test_FX33() {
let opcode = 0xF033;
let mut vm = get_vm();
vm.v[0x0] = 123;
vm.i = 0x0;
vm.execute_instruction(decode_opcode(opcode), opcode);
assert_eq!(vm.memory[vm.i as usize], 1);
assert_eq!(vm.memory[vm.i as usize + 1], 2);
assert_eq!(vm.memory[vm.i as usize + 2], 3);
} | rust_cleaned_test_functions.jsonl/270 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 170
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1400,
55,
18,
18,
368,
341,
14808,
262,
1077,
30028,
284,
220,
15,
9770,
15,
18,
18,
280,
262,
1077,
5206,
10995,
284,
633,
39008,
1428,
262,
10995,
3133,
58,
15,
87,
15,
60,
284,
220,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fallback_post_compound_poseidon_single_partition_base_8() {
fallback_post::<LCTree<PoseidonHasher, U8, U0, U0>>(15, 15, 1, ApiVersion::V1_0_0);
fallback_post::<LCTree<PoseidonHasher, U8, U0, U0>>(15, 15, 1, ApiVersion::V1_1_0);
} | rust_cleaned_test_functions.jsonl/18129 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 131
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
3420,
6333,
18177,
795,
33201,
90456,
19487,
43840,
7651,
62,
23,
368,
341,
262,
32772,
6333,
27638,
43,
1162,
765,
21604,
960,
90456,
6370,
261,
11,
547,
23,
11,
547,
15,
11,
547,
15,
25... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_remove() {
let mut a = vec![1, 2, 3, 4];
assert_eq!(a.remove(2), 3);
assert_eq!(a, [1, 2, 4]);
assert_eq!(a.remove(2), 4);
assert_eq!(a, [1, 2]);
assert_eq!(a.remove(0), 1);
assert_eq!(a, [2]);
assert_eq!(a.remove(0), 2);
assert_eq!(a, []);
} | rust_cleaned_test_functions.jsonl/12877 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
368,
341,
262,
1077,
5206,
264,
284,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
4821,
262,
2060,
10714,
10297,
64,
4850,
7,
17,
701,
220,
18,
317,
262,
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_pipeout_synthesizes() {
use rust_hdl_synth::yosys_validate;
let mut uut = rust_hdl_synth::TopWrap::new(PipeOut::new(0xA0));
uut.uut.ok1.connect();
uut.uut.datain.connect();
uut.connect_all();
yosys_validate("pipeout", &generate_verilog(&uut)).unwrap();
} | rust_cleaned_test_functions.jsonl/55825 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41862,
411,
51393,
6375,
4756,
368,
341,
262,
990,
23071,
66154,
643,
45809,
486,
88,
436,
1047,
42681,
401,
262,
1077,
5206,
575,
332,
284,
23071,
66154,
643,
45809,
486,
5366,
26787,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_useless_number() {
assert_eq!(js_parser_rs::parse("0".chars()), Ok(vec![TokenType::Literal(LiteralType::Integer(0))]));
assert_eq!(js_parser_rs::parse("0xabcdef0".chars()), Ok(vec![TokenType::Literal(LiteralType::Integer(0xabcdef0))]));
assert_eq!(js_parser_rs::parse("0xABCDEF0".chars()), Ok(vec![TokenType::Literal(LiteralType::Integer(0xABCDEF0))]));
assert_eq!(js_parser_rs::parse("0XABCDEF0".chars()), Ok(vec![TokenType::Literal(LiteralType::Integer(0xABCDEF0))]));
assert_eq!(js_parser_rs::parse("0o34".chars()), Ok(vec![TokenType::Literal(LiteralType::Integer(0o34))]));
assert_eq!(js_parser_rs::parse("0O34".chars()), Ok(vec![TokenType::Literal(LiteralType::Integer(0o34))]));
assert_eq!(js_parser_rs::parse("0.0".chars()), Ok(vec![TokenType::Literal(LiteralType::Float(0.0))]));
assert_eq!(js_parser_rs::parse("0.123".chars()), Ok(vec![TokenType::Literal(LiteralType::Float(0.123))]));
assert_eq!(js_parser_rs::parse("123456789.123".chars()), Ok(vec![TokenType::Literal(LiteralType::Float(123456789.123))]));
} | rust_cleaned_test_functions.jsonl/61520 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 486
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15951,
1717,
5500,
368,
341,
262,
2060,
10714,
10297,
2519,
18517,
47115,
486,
6400,
445,
15,
3263,
19255,
11858,
7622,
25592,
20703,
75611,
486,
17350,
4957,
9953,
929,
486,
3486,
7,
15,
593,
143... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mul_add() {
let nan: f64 = Float::nan();
let inf: f64 = Float::infinity();
let neg_inf: f64 = Float::neg_infinity();
assert_approx_eq!(12.3f64.mul_add(4.5, 6.7), 62.05);
assert_approx_eq!((-12.3f64).mul_add(-4.5, -6.7), 48.65);
assert_approx_eq!(0.0f64.mul_add(8.9, 1.2), 1.2);
assert_approx_eq!(3.4f64.mul_add(-0.0, 5.6), 5.6);
assert!(nan.mul_add(7.8, 9.0).is_nan());
assert_eq!(inf.mul_add(7.8, 9.0), inf);
assert_eq!(neg_inf.mul_add(7.8, 9.0), neg_inf);
assert_eq!(8.9f64.mul_add(inf, 3.2), inf);
assert_eq!((-3.2f64).mul_add(2.4, neg_inf), neg_inf);
} | rust_cleaned_test_functions.jsonl/7441 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 406
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24944,
2891,
368,
341,
286,
1077,
20021,
25,
282,
21,
19,
284,
13001,
486,
18759,
543,
286,
1077,
4132,
25,
282,
21,
19,
284,
13001,
486,
80016,
543,
286,
1077,
4184,
26051,
25,
282,
21,
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_pit2() {
let kvm = Kvm::new().unwrap();
let vm = kvm.create_vm().unwrap();
assert!(vm.create_pit2(kvm_pit_config::default()).is_ok());
let pit2 = vm.get_pit2().unwrap();
vm.set_pit2(&pit2).unwrap();
let mut other_pit2 = vm.get_pit2().unwrap();
other_pit2.channels[0].count_load_time = pit2.channels[0].count_load_time;
other_pit2.channels[1].count_load_time = pit2.channels[1].count_load_time;
other_pit2.channels[2].count_load_time = pit2.channels[2].count_load_time;
assert_eq!(pit2, other_pit2);
} | rust_cleaned_test_functions.jsonl/86836 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 308
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
275,
17,
368,
341,
286,
1077,
94748,
284,
730,
7338,
486,
931,
1005,
15454,
543,
286,
1077,
10995,
284,
94748,
2520,
39008,
1005,
15454,
543,
286,
2060,
10297,
7338,
2520,
620,
275,
17,
596... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_allowed_authorization() -> Result<()> {
let rights = AuthorizationItemSetBuilder::new()
.add_right("system.hdd.smart")?
.add_right("system.login.done")?
.build();
Authorization::new(Some(rights), None, Flags::EXTEND_RIGHTS).unwrap();
Ok(())
} | rust_cleaned_test_functions.jsonl/74274 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
42155,
22938,
2022,
368,
1464,
5714,
71698,
341,
286,
1077,
3188,
284,
30562,
1234,
1649,
3297,
486,
931,
741,
310,
659,
718,
10539,
445,
8948,
860,
631,
52544,
899,
5267,
310,
659,
718,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_rxq_event() {
// Test case:
// - there is pending RX data in the backend; and
// - the driver makes RX buffers available; and
// - the backend successfully places its RX data into the queue.
{
let test_ctx = TestContext::new();
let mut ctx = test_ctx.create_epoll_handler_context();
ctx.handler.backend.set_pending_rx(true);
ctx.handler.backend.set_rx_err(Some(VsockError::NoData));
ctx.signal_rxq_event();
// The available RX buffer should've been left untouched.
assert_eq!(ctx.guest_rxvq.used.idx.get(), 0);
}
// Test case:
// - there is pending RX data in the backend; and
// - the driver makes RX buffers available; and
{
let test_ctx = TestContext::new();
let mut ctx = test_ctx.create_epoll_handler_context();
ctx.handler.backend.set_pending_rx(true);
ctx.signal_rxq_event();
// The available RX buffer should have been used.
assert_eq!(ctx.guest_rxvq.used.idx.get(), 1);
}
// Test case: the driver provided a malformed RX descriptor chain.
{
let test_ctx = TestContext::new();
let mut ctx = test_ctx.create_epoll_handler_context();
ctx.guest_rxvq.dtable[0].len.set(0);
assert_eq!(ctx.handler.process_rx(), true);
assert_eq!(ctx.guest_rxvq.used.idx.get(), 1);
assert_eq!(ctx.handler.backend.rx_ok_cnt, 0);
}
// Test case: spurious RXQ_EVENT.
{
let test_ctx = TestContext::new();
let mut ctx = test_ctx.create_epoll_handler_context();
ctx.handler.backend.set_pending_rx(false);
match ctx.handler.handle_event(RXQ_EVENT, epoll::Events::EPOLLIN) {
Err(DeviceError::FailedReadingQueue { .. }) => (),
other => panic!("{:?}", other),
}
}
} | rust_cleaned_test_functions.jsonl/75842 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1024
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24330,
80,
6748,
368,
341,
286,
442,
3393,
1142,
510,
286,
442,
481,
1052,
374,
15280,
28170,
821,
304,
279,
19163,
26,
323,
198,
286,
442,
481,
279,
5579,
3643,
28170,
27389,
2500,
26,
323,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_record_literal_field_in_simple_macro() {
check(
r#"
macro_rules! m { ($e:expr) => { $e } }
struct A { the_field: u32 }
fn foo() {
m!(A { the$0 })
}
"#,
expect![[r#"
fd the_field u32
"#]],
);
} | rust_cleaned_test_functions.jsonl/39751 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 177
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14192,
34100,
5013,
1243,
30015,
58810,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
32606,
21407,
0,
296,
314,
1711,
68,
96011,
8,
589,
314,
400,
68,
335,
456,
1235,
362,
314,
279,
5013,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_clob_abc() -> IonResult<()> {
let mut cursor = ion_cursor_for(&[0x93, 0x61, 0x62, 0x63]);
assert_eq!(cursor.next()?, Some(Value(IonType::Clob, false)));
assert_eq!(
cursor.read_clob_bytes()?.unwrap().as_slice(),
"abc".as_bytes()
);
Ok(())
} | rust_cleaned_test_functions.jsonl/82746 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 184
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
666,
1684,
62,
13683,
368,
1464,
44805,
2077,
71698,
341,
286,
1077,
5206,
8128,
284,
27672,
28601,
5478,
2099,
58,
15,
87,
24,
18,
11,
220,
15,
87,
21,
16,
11,
220,
15,
87,
21,
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... | 3 |
#[test]
fn test_check_is_mmapped_for_mapped() {
serial_test(|| {
with_cleanup(
|| {
assert!(dzmmap_noreplace(START, BYTES_IN_PAGE).is_ok());
panic_if_unmapped(START, BYTES_IN_PAGE);
},
|| {
assert!(munmap(START, BYTES_IN_PAGE).is_ok());
},
)
})
} | rust_cleaned_test_functions.jsonl/107214 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 285
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
6892,
35599,
5677,
5478,
91933,
368,
341,
286,
6146,
4452,
79453,
341,
310,
448,
42444,
1006,
394,
1369,
341,
503,
2060,
10297,
67,
31489,
2186,
1089,
460,
2007,
7,
22564,
11,
7710,
28484,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_assertion_fail_on_conflicting_index_key() {
let engine = crate::storage::TestEngineBuilder::new().build().unwrap();
let t1_start_ts = TimeStamp::compose(1, 0);
let t2_start_ts = TimeStamp::compose(2, 0);
let t2_commit_ts = TimeStamp::compose(3, 0);
// txn1 acquires lock on the row key.
must_acquire_pessimistic_lock(&engine, b"row", b"row", t1_start_ts, t1_start_ts);
// txn2 rolls it back.
let err =
must_acquire_pessimistic_lock_err(&engine, b"row", b"row", t2_start_ts, t2_start_ts);
assert!(matches!(err, MvccError(box MvccErrorInner::KeyIsLocked(_))));
must_check_txn_status(
&engine,
b"row",
t1_start_ts,
t2_start_ts,
t2_start_ts,
false,
false,
true,
|status| status == TxnStatus::PessimisticRollBack,
);
// And then txn2 acquire continues and finally commits
must_acquire_pessimistic_lock(&engine, b"row", b"row", t2_start_ts, t2_start_ts);
must_prewrite_put_impl(
&engine,
b"row",
b"value",
b"row",
&None,
t2_start_ts,
true,
1000,
t2_start_ts,
1,
t2_start_ts.next(),
0.into(),
false,
Assertion::NotExist,
AssertionLevel::Strict,
);
must_prewrite_put_impl(
&engine,
b"index",
b"value",
b"row",
&None,
t2_start_ts,
false,
1000,
t2_start_ts,
1,
t2_start_ts.next(),
0.into(),
false,
Assertion::NotExist,
AssertionLevel::Strict,
);
must_commit(&engine, b"row", t2_start_ts, t2_commit_ts);
must_commit(&engine, b"index", t2_start_ts, t2_commit_ts);
// AssertionFailed error won't be returned since there are other error.
let cm = ConcurrencyManager::new(1.into());
let mut stat = Statistics::default();
// Two keys in single request:
let cmd = PrewritePessimistic::with_defaults(
vec![
(
Mutation::make_put(Key::from_raw(b"row"), b"value".to_vec()),
true,
),
(
Mutation::make_put(Key::from_raw(b"index"), b"value".to_vec()),
false,
),
],
b"row".to_vec(),
t1_start_ts,
t2_start_ts,
);
let err = prewrite_command(&engine, cm.clone(), &mut stat, cmd).unwrap_err();
assert!(matches!(
err,
Error(box ErrorInner::Mvcc(MvccError(
box MvccErrorInner::PessimisticLockNotFound { .. }
)))
));
// Passing keys in different order gets the same result:
let cmd = PrewritePessimistic::with_defaults(
vec![
(
Mutation::make_put(Key::from_raw(b"index"), b"value".to_vec()),
false,
),
(
Mutation::make_put(Key::from_raw(b"row"), b"value".to_vec()),
true,
),
],
b"row".to_vec(),
t1_start_ts,
t2_start_ts,
);
let err = prewrite_command(&engine, cm, &mut stat, cmd).unwrap_err();
assert!(matches!(
err,
Error(box ErrorInner::Mvcc(MvccError(
box MvccErrorInner::PessimisticLockNotFound { .. }
)))
));
// the assertion error.
let err = must_prewrite_put_err_impl(
&engine,
b"row",
b"value",
b"row",
&None,
t1_start_ts,
t1_start_ts,
true,
0,
false,
Assertion::NotExist,
AssertionLevel::Strict,
);
assert!(matches!(
err,
MvccError(box MvccErrorInner::PessimisticLockNotFound { .. })
));
let err = must_prewrite_put_err_impl(
&engine,
b"index",
b"value",
b"row",
&None,
t1_start_ts,
t1_start_ts,
false,
0,
false,
Assertion::NotExist,
AssertionLevel::Strict,
);
assert!(matches!(
err,
MvccError(box MvccErrorInner::PessimisticLockNotFound { .. })
));
} | rust_cleaned_test_functions.jsonl/31435 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2861
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16553,
290,
22121,
4470,
16059,
78208,
3560,
3097,
368,
341,
286,
1077,
4712,
284,
17717,
486,
16172,
486,
2271,
4571,
3297,
486,
931,
1005,
5834,
1005,
15454,
1428,
1789,
23459,
286,
1077,
259,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_count_bag_colors_nested() {
let lines = rules(r#"
light red bags contain 1 bright white bag.
bright white bags contain 3 dark orange bags, 4 dotted black bags.
dark orange bags contain 1 muted yellow bag, 2 vibrant plum bags.
muted yellow bags contain 2 shiny gold bags.
vibrant plum bags contain 1 shiny gold bags.
dotted black bags contain no other bags.
shiny gold bags contain no other bags.
"#);
assert_eq!(5, count_bag_colors(&lines, "shiny gold").unwrap());
assert_eq!(0, count_bag_numbers(&lines, "shiny gold").unwrap());
} | rust_cleaned_test_functions.jsonl/98559 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 275
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3180,
74368,
33670,
66279,
368,
341,
286,
1077,
5128,
284,
5601,
2601,
2,
698,
310,
3100,
2518,
17899,
6644,
220,
16,
9906,
4158,
8968,
624,
310,
9906,
4158,
17899,
6644,
220,
18,
6319,
18575,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_file_style_omit() {
let config = integration_test_utils::make_config_from_args(&["--file-style", "omit"]);
let output = integration_test_utils::run_delta(GIT_DIFF_SINGLE_HUNK, &config);
assert!(!output.contains("src/align.rs"));
} | rust_cleaned_test_functions.jsonl/70072 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2458,
15117,
62,
77968,
368,
341,
286,
1077,
2193,
284,
17590,
4452,
17309,
486,
6927,
5332,
5673,
8384,
2099,
1183,
313,
1192,
11297,
497,
330,
77968,
15049,
286,
1077,
2550,
284,
17590,
4452,
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_raw_compaction_filter() {
let mut cfg = DbConfig::default();
cfg.defaultcf.disable_auto_compactions = true;
cfg.defaultcf.dynamic_level_bytes = false;
let engine = TestEngineBuilder::new()
.api_version(ApiVersion::V2)
.build_with_cfg(&cfg)
.unwrap();
let raw_engine = engine.get_rocksdb();
let mut gc_runner = TestGCRunner::new(0);
let user_key = b"r\0aaaaaaaaaaa";
let test_raws = vec![
(user_key, 100, false),
(user_key, 90, false),
(user_key, 70, false),
];
let modifies = test_raws
.into_iter()
.map(|(key, ts, is_delete)| {
(
make_key(key, ts),
ApiV2::encode_raw_value(RawValue {
user_value: &[0; 10][..],
expire_ts: Some(TimeStamp::max().into_inner()),
is_delete,
}),
)
})
.map(|(k, v)| Modify::Put(CF_DEFAULT, Key::from_encoded_slice(k.as_slice()), v))
.collect();
let ctx = Context {
api_version: ApiVersion::V2,
..Default::default()
};
let batch = WriteData::from_modifies(modifies);
engine.write(&ctx, batch).unwrap();
gc_runner.safe_point(80).gc_raw(&raw_engine);
let entry70 = raw_engine
.get_value_cf(CF_DEFAULT, make_key(b"r\0a", 70).as_slice())
.unwrap();
assert!(entry70.is_none());
gc_runner.safe_point(90).gc_raw(&raw_engine);
let entry100 = raw_engine
.get_value_cf(CF_DEFAULT, make_key(user_key, 100).as_slice())
.unwrap();
let entry90 = raw_engine
.get_value_cf(CF_DEFAULT, make_key(user_key, 90).as_slice())
.unwrap();
assert!(entry100.is_some());
assert!(entry90.is_some());
} | rust_cleaned_test_functions.jsonl/94367 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16067,
18177,
1311,
8727,
368,
341,
286,
1077,
5206,
13286,
284,
11988,
2648,
486,
2258,
543,
286,
13286,
8764,
9792,
42628,
27740,
18177,
4020,
284,
830,
280,
286,
13286,
8764,
9792,
59044,
8274,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_insert_with_ancestors() {
let key = Keypair::new();
let mut index = AccountsIndex::<bool>::default();
let mut gc = Vec::new();
index.insert(0, &key.pubkey(), true, &mut gc);
assert!(gc.is_empty());
let ancestors = vec![(0, 0)].into_iter().collect();
let (list, idx) = index.get(&key.pubkey(), &ancestors).unwrap();
assert_eq!(list[idx], (0, true));
let mut num = 0;
let mut found_key = false;
index.scan_accounts(&ancestors, |pubkey, _index| {
if pubkey == &key.pubkey() {
found_key = true
};
num += 1
});
assert_eq!(num, 1);
assert!(found_key);
} | rust_cleaned_test_functions.jsonl/20395 | {
"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,
17678,
6615,
62,
681,
267,
1087,
368,
341,
286,
1077,
1376,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
5206,
1922,
284,
40655,
1552,
27638,
2641,
6831,
2258,
543,
286,
1077,
5206,
22122,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_position() {
let b = [1, 2, 3, 5, 5];
assert!(b.iter().position(|&v| v == 9) == None);
assert!(b.iter().position(|&v| v == 5) == Some(3));
assert!(b.iter().position(|&v| v == 3) == Some(2));
assert!(b.iter().position(|&v| v == 0) == None);
} | rust_cleaned_test_functions.jsonl/8435 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 137
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9661,
368,
341,
262,
1077,
293,
284,
508,
16,
11,
220,
17,
11,
220,
18,
11,
220,
20,
11,
220,
20,
935,
262,
2060,
10297,
65,
19471,
1005,
3487,
22428,
5,
85,
91,
348,
621,
220,
24,
8,
62... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_issue_467() {
let _result: Result<(AllTypes, _), _> = bincode::decode_from_slice(
&[],
bincode::config::Configuration::standard().with_limit::<1024>(),
);
} | rust_cleaned_test_functions.jsonl/17128 | {
"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,
53340,
62,
19,
21,
22,
368,
341,
262,
1077,
716,
1382,
25,
5714,
28706,
2403,
4173,
11,
716,
701,
716,
29,
284,
9544,
1851,
486,
18196,
5673,
26488,
1006,
286,
44590,
1259,
286,
9544,
1851,
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 |
#[test]
fn test_secondary_probs_update_max_empty() {
let mut p = SecondaryProbs {
offset: 0,
probs: vec![],
max_prob: LogSpace::zero(),
};
p.max_prob = LogSpace::one();
p.update_max(0, 0);
assert!(p.max_prob.eq(&LogSpace::zero()));
p.max_prob = LogSpace::one();
p.update_max(-1, 0);
assert!(p.max_prob.eq(&LogSpace::zero()));
p.max_prob = LogSpace::one();
p.update_max(0, 1);
assert!(p.max_prob.eq(&LogSpace::zero()));
p.max_prob = LogSpace::one();
p.update_max(-1, 1);
assert!(p.max_prob.eq(&LogSpace::zero()));
p.max_prob = LogSpace::one();
p.update_max(std::isize::MIN, std::isize::MAX);
assert!(p.max_prob.eq(&LogSpace::zero()));
} | rust_cleaned_test_functions.jsonl/101759 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 443
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77759,
51405,
8882,
6345,
15124,
368,
341,
286,
1077,
5206,
281,
284,
43534,
1336,
1279,
341,
310,
4347,
25,
220,
15,
345,
310,
69370,
25,
7486,
20703,
1259,
310,
1932,
20794,
25,
2835,
9914,
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_set_and_get_klapic_out_of_bounds() {
let reg_offset = KVM_APIC_REG_SIZE + 10;
let mut klapic = kvm_lapic_state::default();
set_klapic_reg(&mut klapic, reg_offset, 3);
} | rust_cleaned_test_functions.jsonl/25641 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 113
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
8378,
3062,
4698,
15958,
292,
6068,
3575,
36878,
368,
341,
286,
1077,
1217,
6917,
284,
730,
11187,
21899,
1317,
8064,
4098,
488,
220,
16,
15,
280,
286,
1077,
5206,
595,
15958,
292,
284,
94... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_flow_controller_pending_compaction_bytes() {
let stub = EngineStub::new();
let (tx, rx) = mpsc::sync_channel(0);
let flow_controller = FlowController::new(&FlowControlConfig::default(), stub.clone(), rx);
// exceeds the threshold
stub.0
.pending_compaction_bytes
.store(1000 * 1024 * 1024 * 1024, Ordering::Relaxed);
tx.send(FlowInfo::Compaction("default".to_string()))
.unwrap();
tx.send(FlowInfo::L0Intra("default".to_string(), 0))
.unwrap();
// on start check forbids flow control
assert!(flow_controller.discard_ratio() < f64::EPSILON);
stub.0
.pending_compaction_bytes
.store(100 * 1024 * 1024 * 1024, Ordering::Relaxed);
tx.send(FlowInfo::Compaction("default".to_string()))
.unwrap();
tx.send(FlowInfo::L0Intra("default".to_string(), 0))
.unwrap();
stub.0
.pending_compaction_bytes
.store(1000 * 1024 * 1024 * 1024, Ordering::Relaxed);
tx.send(FlowInfo::Compaction("default".to_string()))
.unwrap();
tx.send(FlowInfo::L0Intra("default".to_string(), 0))
.unwrap();
assert!(flow_controller.discard_ratio() > f64::EPSILON);
stub.0
.pending_compaction_bytes
.store(1024 * 1024 * 1024, Ordering::Relaxed);
tx.send(FlowInfo::Compaction("default".to_string()))
.unwrap();
tx.send(FlowInfo::L0Intra("default".to_string(), 0))
.unwrap();
assert!(flow_controller.discard_ratio() < f64::EPSILON);
// pending compaction bytes jump after unsafe destroy range
tx.send(FlowInfo::BeforeUnsafeDestroyRange).unwrap();
tx.send(FlowInfo::L0Intra("default".to_string(), 0))
.unwrap();
assert!(flow_controller.discard_ratio() < f64::EPSILON);
stub.0
.pending_compaction_bytes
.store(1024 * 1024 * 1024, Ordering::Relaxed);
tx.send(FlowInfo::Compaction("default".to_string()))
.unwrap();
tx.send(FlowInfo::L0Intra("default".to_string(), 0))
.unwrap();
assert!(flow_controller.discard_ratio() < f64::EPSILON);
stub.0
.pending_compaction_bytes
.store(10000000 * 1024 * 1024 * 1024, Ordering::Relaxed);
tx.send(FlowInfo::Compaction("default".to_string()))
.unwrap();
tx.send(FlowInfo::AfterUnsafeDestroyRange).unwrap();
tx.send(FlowInfo::L0Intra("default".to_string(), 0))
.unwrap();
assert!(flow_controller.discard_ratio() < f64::EPSILON);
// unfreeze the control
stub.0
.pending_compaction_bytes
.store(1024 * 1024, Ordering::Relaxed);
tx.send(FlowInfo::Compaction("default".to_string()))
.unwrap();
tx.send(FlowInfo::L0Intra("default".to_string(), 0))
.unwrap();
assert!(flow_controller.discard_ratio() < f64::EPSILON);
stub.0
.pending_compaction_bytes
.store(1000000000 * 1024 * 1024 * 1024, Ordering::Relaxed);
tx.send(FlowInfo::Compaction("default".to_string()))
.unwrap();
tx.send(FlowInfo::L0Intra("default".to_string(), 0))
.unwrap();
assert!(flow_controller.discard_ratio() > f64::EPSILON);
} | rust_cleaned_test_functions.jsonl/120662 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1677
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27441,
21600,
37861,
18177,
1311,
12524,
368,
341,
286,
1077,
13633,
284,
8200,
33838,
486,
931,
543,
286,
1077,
320,
3998,
11,
19111,
8,
284,
296,
81984,
486,
12996,
14571,
7,
15,
317,
286,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_package_toolchain_with_volta_key() {
let package_empty_toolchain = r#"{
"volta": {
}
}"#;
let manifest_empty_toolchain =
serde_json::de::from_str::<Manifest>(package_empty_toolchain);
assert!(
manifest_empty_toolchain.is_err(),
"Node must be defined under the 'volta' key"
);
let package_node_only = r#"{
"volta": {
"node": "0.11.4"
}
}"#;
let manifest_node_only: Manifest =
serde_json::de::from_str(package_node_only).expect("Could not deserialize string");
assert_eq!(manifest_node_only.volta.unwrap().node, "0.11.4");
let package_node_npm = r#"{
"volta": {
"node": "0.10.5",
"npm": "1.2.18"
}
}"#;
let manifest_node_npm: Manifest =
serde_json::de::from_str(package_node_npm).expect("Could not deserialize string");
let toolchain_node_npm = manifest_node_npm
.volta
.expect("Did not parse toolchain correctly");
assert_eq!(toolchain_node_npm.node, "0.10.5");
assert_eq!(toolchain_node_npm.npm.unwrap(), "1.2.18");
let package_yarn_only = r#"{
"volta": {
"yarn": "1.2.1"
}
}"#;
let manifest_yarn_only = serde_json::de::from_str::<Manifest>(package_yarn_only);
assert!(
manifest_yarn_only.is_err(),
"Node must be defined under the 'volta' key"
);
let package_node_and_yarn = r#"{
"volta": {
"node": "0.10.5",
"npm": "1.2.18",
"yarn": "1.2.1"
}
}"#;
let manifest_node_and_yarn: Manifest =
serde_json::de::from_str(package_node_and_yarn).expect("Could not deserialize string");
let toolchain_node_and_yarn = manifest_node_and_yarn
.volta
.expect("Did not parse toolchain correctly");
assert_eq!(toolchain_node_and_yarn.node, "0.10.5");
assert_eq!(toolchain_node_and_yarn.yarn.unwrap(), "1.2.1");
} | rust_cleaned_test_functions.jsonl/27129 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1222
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26328,
22785,
8819,
6615,
42784,
2565,
3097,
368,
341,
286,
1077,
6328,
15124,
22785,
8819,
284,
435,
55543,
515,
310,
330,
12536,
2565,
788,
341,
310,
456,
286,
335,
57676,
280,
286,
1077,
14455,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sink_panic() {
let num_lines: usize = 10;
let in_addr = next_addr();
let out_addr = next_addr();
let mut config = config::Config::empty();
config.add_source(
"in",
sources::socket::SocketConfig::make_tcp_config(in_addr),
);
config.add_sink(
"out",
&["in"],
sinks::socket::SocketSinkConfig::make_basic_tcp_config(out_addr.to_string()),
);
config.add_sink("panic", &["in"], PanicSink);
let mut rt = runtime();
rt.block_on_std(async move {
let mut output_lines = CountReceiver::receive_lines(out_addr);
std::panic::set_hook(Box::new(|_| {})); // Suppress panic print on background thread
let (topology, crash) = start_topology(config, false).await;
// Wait for server to accept traffic
wait_for_tcp(in_addr).await;
delay_for(Duration::from_millis(100)).await;
// Wait for output to connect
output_lines.connected().await;
let input_lines = random_lines(100).take(num_lines).collect::<Vec<_>>();
send_lines(in_addr, input_lines.clone()).await.unwrap();
delay_for(Duration::from_millis(100)).await;
let _ = std::panic::take_hook();
assert!(crash.wait().next().is_some());
topology.stop().compat().await.unwrap();
delay_for(Duration::from_millis(100)).await;
let output_lines = output_lines.wait().await;
assert_eq!(num_lines, output_lines.len());
assert_eq!(input_lines, output_lines);
});
} | rust_cleaned_test_functions.jsonl/11744 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 676
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51567,
620,
31270,
368,
341,
262,
1077,
1629,
18323,
25,
22301,
284,
220,
16,
15,
401,
262,
1077,
304,
7387,
284,
1790,
7387,
543,
262,
1077,
700,
7387,
284,
1790,
7387,
1428,
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_generate_config_key_files() {
let env = ConfigSpec::new_without_pass();
env.command("generate-config")
.with_arg(&env.expected_template_file())
.with_arg(&env.output_node_config_dir(0))
.with_named_arg("-a", "0.0.0.0:8000")
.with_arg("--no-password")
.run()
.unwrap();
let private_cfg: toml::Value = load_config_file(&env.output_private_config(0)).unwrap();
assert_eq!(
private_cfg["master_key_path"].as_str().unwrap(),
"master.key.toml"
);
} | rust_cleaned_test_functions.jsonl/97976 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 260
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48851,
5332,
3097,
10931,
368,
341,
262,
1077,
6105,
284,
5532,
8327,
486,
931,
39904,
15464,
1428,
262,
6105,
14143,
445,
19366,
25130,
1138,
286,
659,
4197,
6057,
2099,
3160,
56835,
8693,
2458,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_query_matches_with_deeply_nested_patterns_with_fields() {
allocations::record(|| {
let language = get_language("python");
let query = Query::new(
language,
"
(call
function: (_) @func
arguments: (_) @args)
(call
function: (attribute
object: (_) @receiver
attribute: (identifier) @method)
arguments: (argument_list))
; These don't match anything, but they require additional
; states to keep track of their captures.
(call
function: (_) @fn
arguments: (argument_list
(keyword_argument
name: (identifier) @name
value: (_) @val) @arg) @args) @call
(call
function: (identifier) @fn
(#eq? @fn \"super\")) @super_call
",
)
.unwrap();
assert_query_matches(
language,
&query,
"
a(1).b(2).c(3).d(4).e(5).f(6).g(7).h(8)
",
&[
(0, vec![("func", "a"), ("args", "(1)")]),
(0, vec![("func", "a(1).b"), ("args", "(2)")]),
(1, vec![("receiver", "a(1)"), ("method", "b")]),
(0, vec![("func", "a(1).b(2).c"), ("args", "(3)")]),
(1, vec![("receiver", "a(1).b(2)"), ("method", "c")]),
(0, vec![("func", "a(1).b(2).c(3).d"), ("args", "(4)")]),
(1, vec![("receiver", "a(1).b(2).c(3)"), ("method", "d")]),
(0, vec![("func", "a(1).b(2).c(3).d(4).e"), ("args", "(5)")]),
(
1,
vec![("receiver", "a(1).b(2).c(3).d(4)"), ("method", "e")],
),
(
0,
vec![("func", "a(1).b(2).c(3).d(4).e(5).f"), ("args", "(6)")],
),
(
1,
vec![("receiver", "a(1).b(2).c(3).d(4).e(5)"), ("method", "f")],
),
(
0,
vec![("func", "a(1).b(2).c(3).d(4).e(5).f(6).g"), ("args", "(7)")],
),
(
1,
vec![
("receiver", "a(1).b(2).c(3).d(4).e(5).f(6)"),
("method", "g"),
],
),
(
0,
vec![
("func", "a(1).b(2).c(3).d(4).e(5).f(6).g(7).h"),
("args", "(8)"),
],
),
(
1,
vec![
("receiver", "a(1).b(2).c(3).d(4).e(5).f(6).g(7)"),
("method", "h"),
],
),
],
);
});
} | rust_cleaned_test_functions.jsonl/77457 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2092
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5738,
38344,
6615,
87044,
398,
66279,
64923,
6615,
12132,
368,
341,
262,
69642,
486,
8548,
79453,
341,
286,
1077,
4128,
284,
633,
29021,
445,
12669,
797,
286,
1077,
3239,
284,
11361,
486,
931,
100... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_bug6598844() {
test_same(concat!(
"function F() { this.a = 0; }",
"F.prototype.inc = function() { this.a++; return 10; };",
"F.prototype.bar = function() { var x = this.inc(); this.a += x; };"
));
} | rust_cleaned_test_functions.jsonl/27724 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 120
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73232,
21,
20,
24,
23,
23,
19,
19,
368,
341,
262,
1273,
33574,
96360,
33673,
286,
330,
1688,
434,
368,
314,
419,
5849,
284,
220,
15,
26,
335,
756,
286,
330,
37,
6003,
26797,
284,
729,
368,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_upgrade() {
let resp = HttpResponseBuilder::new(StatusCode::OK)
.upgrade("websocket")
.finish();
assert!(resp.upgrade());
assert_eq!(
resp.headers().get(header::UPGRADE).unwrap(),
HeaderValue::from_static("websocket")
);
} | rust_cleaned_test_functions.jsonl/128613 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67794,
368,
341,
286,
1077,
9039,
284,
17580,
3297,
486,
931,
7,
15872,
486,
3925,
340,
310,
659,
44230,
445,
83208,
1138,
310,
659,
30150,
543,
286,
2060,
10297,
18243,
17652,
6937,
1423,
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_frequency_and_count() {
let point = FailPoint::new();
point.set_actions("", vec![Action::new(Task::Return(None), 0.8, Some(100))]);
let mut count = 0;
let mut times = 0f64;
while count < 100 {
if point.eval("test_fail_point_frequency").is_some() {
count += 1;
}
times += 1f64;
}
assert!(100.0 / 0.9 < times && times < 100.0 / 0.7, "{}", times);
for _ in 0..times as u64 {
assert!(point.eval("test_fail_point_frequency").is_none());
}
} | rust_cleaned_test_functions.jsonl/18303 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 306
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40132,
8378,
3180,
368,
341,
286,
1077,
1459,
284,
39645,
2609,
486,
931,
543,
286,
1459,
980,
25368,
19814,
7486,
20703,
2512,
486,
931,
47531,
486,
5598,
26717,
701,
220,
15,
13,
23,
11,
4329,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_stake_warmup_cooldown() {
let delegations = [
Delegation {
// never deactivates
stake: 1_000,
activation_epoch: std::u64::MAX,
..Delegation::default()
},
Delegation {
stake: 1_000,
activation_epoch: 0,
deactivation_epoch: 9,
..Delegation::default()
},
Delegation {
stake: 1_000,
activation_epoch: 1,
deactivation_epoch: 6,
..Delegation::default()
},
Delegation {
stake: 1_000,
activation_epoch: 2,
deactivation_epoch: 5,
..Delegation::default()
},
Delegation {
stake: 1_000,
activation_epoch: 2,
deactivation_epoch: 4,
..Delegation::default()
},
Delegation {
stake: 1_000,
activation_epoch: 4,
deactivation_epoch: 4,
..Delegation::default()
},
];
// warming up and cooling down
let epochs = 20;
let stake_history = create_stake_history_from_delegations(None, 0..epochs, &delegations);
let mut prev_total_effective_stake = delegations
.iter()
.map(|delegation| delegation.stake(0, Some(&stake_history)))
.sum::<u64>();
// uncomment and add ! for fun with graphing
for epoch in 1..epochs {
let total_effective_stake = delegations
.iter()
.map(|delegation| delegation.stake(epoch, Some(&stake_history)))
.sum::<u64>();
let delta = if total_effective_stake > prev_total_effective_stake {
total_effective_stake - prev_total_effective_stake
} else {
prev_total_effective_stake - total_effective_stake
};
// uncomment and add ! for fun with graphing
assert!(
delta
<= ((prev_total_effective_stake as f64 * Config::default().warmup_cooldown_rate) as u64)
.max(1)
);
prev_total_effective_stake = total_effective_stake;
}
} | rust_cleaned_test_functions.jsonl/15290 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1458
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
726,
1670,
2178,
454,
11393,
24766,
368,
341,
286,
1077,
19854,
804,
284,
2278,
310,
1581,
87566,
341,
394,
442,
2581,
409,
8859,
973,
198,
394,
18279,
25,
220,
16,
62,
15,
15,
15,
345,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_merge_disallowed_with_staged_changes() -> BitResult<()> {
BitRepo::with_minimal_repo(|repo| {
let ours = commit! {
dir {
foo < "foo original"
}
};
let theirs = commit! {
whatever
};
repo.setup_three_way_merge(ours, theirs)?;
modify!(repo: "dir/foo" < "updated in index");
bit_add!(repo: "dir/foo");
let conflicts = bit_merge!(repo: "theirs").unwrap_err().try_into_merge_conflict()?;
let mut uncommitted = conflicts.uncommitted.into_iter();
assert_eq!(uncommitted.next().unwrap(), p!("dir/foo"));
assert_eq!(cat!(repo: "dir/foo"), "updated in index");
Ok(())
})
} | rust_cleaned_test_functions.jsonl/94184 | {
"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,
20888,
9932,
20967,
6615,
1261,
3279,
47526,
368,
1464,
6495,
2077,
71698,
341,
262,
6495,
25243,
486,
4197,
7260,
2861,
37784,
22428,
23476,
91,
341,
286,
1077,
11350,
284,
5266,
0,
341,
310,
541... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_world_symbols_include_container_name() {
let code = r#"
fn foo() {
enum FooInner { }
}
"#;
let mut symbols = get_symbols_matching(code, "FooInner");
let s = symbols.pop().unwrap();
assert_eq!(s.name(), "FooInner");
assert_eq!(s.container_name(), Some(&SmolStr::new("foo")));
let code = r#"
mod foo {
struct FooInner;
}
"#;
let mut symbols = get_symbols_matching(code, "FooInner");
let s = symbols.pop().unwrap();
assert_eq!(s.name(), "FooInner");
assert_eq!(s.container_name(), Some(&SmolStr::new("foo")));
} | rust_cleaned_test_functions.jsonl/19270 | {
"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,
31792,
55752,
37878,
15847,
1269,
368,
341,
262,
1077,
2038,
284,
435,
2,
698,
8822,
15229,
368,
341,
262,
7618,
33428,
31597,
314,
456,
532,
262,
5869,
401,
262,
1077,
5206,
17738,
284,
633,
55... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extract_policy_for_multiple_same_timelocks() {
let secp = Secp256k1::new();
let (prvkey0, _pubkey0, _fingerprint0) = setup_keys(TPRV0_STR, PATH, &secp);
let locktime_blocks0 = 100;
let locktime_blocks1 = 200;
let desc = descriptor!(sh(and_v(
v: pk(prvkey0),
and_v(v: after(locktime_blocks0), after(locktime_blocks1))
)))
.unwrap();
let (wallet_desc, keymap) = desc
.into_wallet_descriptor(&secp, Network::Testnet)
.unwrap();
let signers_container = Arc::new(SignersContainer::build(keymap, &wallet_desc, &secp));
let policy = wallet_desc
.extract_policy(&signers_container, BuildSatisfaction::None, &secp)
.unwrap()
.unwrap();
println!("desc policy = {:?}", policy); // TODO remove
// TODO how should this merge timelocks?
let (prvkey1, _pubkey1, _fingerprint1) = setup_keys(TPRV0_STR, PATH, &secp);
let locktime_seconds0 = 500000100;
let locktime_seconds1 = 500000200;
let desc = descriptor!(sh(and_v(
v: pk(prvkey1),
and_v(v: after(locktime_seconds0), after(locktime_seconds1))
)))
.unwrap();
let (wallet_desc, keymap) = desc
.into_wallet_descriptor(&secp, Network::Testnet)
.unwrap();
let signers_container = Arc::new(SignersContainer::build(keymap, &wallet_desc, &secp));
let policy = wallet_desc
.extract_policy(&signers_container, BuildSatisfaction::None, &secp)
.unwrap()
.unwrap();
println!("desc policy = {:?}", policy); // TODO remove
// TODO how should this merge timelocks?
} | rust_cleaned_test_functions.jsonl/77145 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 893
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
22773,
5478,
45233,
33574,
29087,
301,
25183,
368,
341,
286,
1077,
511,
4672,
284,
4520,
79,
17,
20,
21,
74,
16,
486,
931,
543,
286,
1077,
320,
649,
85,
792,
15,
11,
716,
9585,
792,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_option() {
let req = TestRequest::with_header(
header::CONTENT_TYPE,
"application/x-www-form-urlencoded",
).finish();
let mut cfg = FormConfig::default();
cfg.limit(4096);
match Option::<Form<Info>>::from_request(&req, &cfg)
.poll()
.unwrap()
{
Async::Ready(r) => assert_eq!(r, None),
_ => unreachable!(),
}
let req = TestRequest::with_header(
header::CONTENT_TYPE,
"application/x-www-form-urlencoded",
).header(header::CONTENT_LENGTH, "9")
.set_payload(Bytes::from_static(b"hello=world"))
.finish();
match Option::<Form<Info>>::from_request(&req, &cfg)
.poll()
.unwrap()
{
Async::Ready(r) => assert_eq!(
r,
Some(Form(Info {
hello: "world".into()
}))
),
_ => unreachable!(),
}
let req = TestRequest::with_header(
header::CONTENT_TYPE,
"application/x-www-form-urlencoded",
).header(header::CONTENT_LENGTH, "9")
.set_payload(Bytes::from_static(b"bye=world"))
.finish();
match Option::<Form<Info>>::from_request(&req, &cfg)
.poll()
.unwrap()
{
Async::Ready(r) => assert_eq!(r, None),
_ => unreachable!(),
}
} | rust_cleaned_test_functions.jsonl/46183 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 834
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9672,
368,
341,
286,
1077,
4232,
284,
3393,
1900,
486,
4197,
8757,
1006,
310,
4247,
486,
67872,
4189,
345,
310,
330,
5132,
10776,
41242,
8460,
44557,
756,
286,
7457,
30150,
1428,
286,
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... | 4 |
#[test]
fn test_try_from_rgb() {
assert!(fidl_fuchsia_hardware_light::Rgb::try_from(ColorRgb {
red: -0.0,
green: 0.1,
blue: 1.0
})
.is_ok());
assert!(fidl_fuchsia_hardware_light::Rgb::try_from(ColorRgb {
red: 0.0 - f32::EPSILON,
green: 0.1,
blue: 0.2
})
.is_err());
assert!(fidl_fuchsia_hardware_light::Rgb::try_from(ColorRgb {
red: 0.3,
green: 1.0 + f32::EPSILON,
blue: 0.2
})
.is_err());
assert_eq!(
fidl_fuchsia_hardware_light::Rgb::try_from(ColorRgb {
red: 0.0,
green: 1.0,
blue: 0.5
}),
Ok(fidl_fuchsia_hardware_light::Rgb { red: 0.0, green: 1.0, blue: 0.5 })
);
} | rust_cleaned_test_functions.jsonl/33188 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 558
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
5673,
37407,
368,
341,
286,
2060,
10297,
32439,
75,
761,
73391,
1523,
37750,
28663,
486,
80951,
486,
1539,
5673,
15028,
80951,
341,
310,
2518,
25,
481,
15,
13,
15,
345,
310,
6176,
25,
220... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_resolve_url_from_location_full_2() {
let url = "https://deno.land".parse::<Url>().unwrap();
let new_uri = resolve_url_from_location(&url, "https://golang.org");
assert_eq!(new_uri.host_str().unwrap(), "golang.org");
} | rust_cleaned_test_functions.jsonl/70599 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77291,
2903,
5673,
13126,
16372,
62,
17,
368,
341,
262,
1077,
2515,
284,
330,
2428,
1110,
5183,
78,
87627,
3263,
6400,
27638,
2864,
10483,
15454,
543,
262,
1077,
501,
15572,
284,
8830,
2903,
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_set_metadata_item() {
let driver = Driver::get("MEM").unwrap();
let mut dataset = driver.create("", 1, 1, 1).unwrap();
let key = "Test_Key";
let domain = "Test_Domain";
let value = "Test_Value";
let result = dataset.set_metadata_item(key, value, domain);
assert!(result.is_ok());
let result = dataset.metadata_item(key, domain);
assert_eq!(Some(value.to_owned()), result);
} | rust_cleaned_test_functions.jsonl/83437 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 169
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
22220,
5634,
368,
341,
262,
1077,
5579,
284,
14577,
486,
455,
445,
31970,
1827,
15454,
543,
262,
1077,
5206,
10337,
284,
5579,
2520,
19814,
220,
16,
11,
220,
16,
11,
220,
16,
568,
15454,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iterator_chain_last() {
let xs = [0, 1, 2, 3, 4, 5];
let ys = [30, 40, 50, 60];
let zs = [];
assert_eq!(xs.iter().chain(ys.iter()).last(), Some(&60));
assert_eq!(zs.iter().chain(ys.iter()).last(), Some(&60));
assert_eq!(ys.iter().chain(zs.iter()).last(), Some(&60));
assert_eq!(zs.iter().chain(zs.iter()).last(), None);
} | rust_cleaned_test_functions.jsonl/36987 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 176
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13491,
30583,
12195,
368,
341,
262,
1077,
11943,
284,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
262,
1077,
31810,
284,
508,
18,
15,
11,
220,
19,
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_async_stdin() {
let mut tty = conin_r().unwrap();
let mut ev = tty.get_event_and_raw(Some(Duration::from_millis(10)));
while let Some(Ok(_)) = ev {
ev = tty.get_event_and_raw(Some(Duration::from_millis(10)));
}
if let Some(Err(err)) = ev {
assert!(err.kind() == io::ErrorKind::WouldBlock);
} else {
if ev.is_some() {
panic!("Should have returned WouldBlock!");
}
}
} | rust_cleaned_test_functions.jsonl/11787 | {
"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,
28346,
15656,
258,
368,
341,
286,
1077,
5206,
60067,
284,
390,
258,
1710,
1005,
15454,
543,
286,
1077,
5206,
3637,
284,
60067,
670,
6748,
8378,
16067,
65405,
64114,
486,
1499,
717,
56212,
7,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_cliprect_full_screen() {
let clip = ClipRect::full_screen();
assert_eq!(clip.min, Pt::new(0, 0));
assert_eq!(clip.max, Pt::new(WIDTH, LINES));
} | rust_cleaned_test_functions.jsonl/104244 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44728,
2851,
16372,
17649,
368,
341,
286,
1077,
12327,
284,
29692,
4415,
486,
8878,
17649,
543,
286,
2060,
10714,
10297,
7974,
4358,
11,
51070,
486,
931,
7,
15,
11,
220,
15,
1106,
286,
2060,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_insert_vote() {
::libra_logger::try_init_for_testing();
// Set up enough different authors to support different votes for the same block.
let (signers, validator_verifier) = random_validator_verifier(11, Some(10), false);
let my_signer = signers[10].clone();
let mut inserter = TreeInserter::new(my_signer);
let block_store = inserter.block_store();
let genesis = block_store.root();
let block = inserter.insert_block_with_qc(QuorumCert::certificate_for_genesis(), &genesis, 1);
assert!(block_store.get_quorum_cert_for_block(block.id()).is_none());
for (i, voter) in signers.iter().enumerate().take(10).skip(1) {
let executed_state = &block.compute_result().executed_state;
let vote = Vote::new(
VoteData::new(
BlockInfo::from_block(
block.block(),
executed_state.state_id,
executed_state.version,
executed_state.validators.clone(),
),
block.quorum_cert().certified_block().clone(),
),
voter.author(),
placeholder_ledger_info(),
voter,
);
let vote_res = block_store.insert_vote_and_qc(&vote, &validator_verifier);
// first vote of an author is accepted
assert_eq!(vote_res, VoteReceptionResult::VoteAdded(i as u64));
// filter out duplicates
assert_eq!(
block_store.insert_vote_and_qc(&vote, &validator_verifier),
VoteReceptionResult::DuplicateVote,
);
// qc is still not there
assert!(block_store.get_quorum_cert_for_block(block.id()).is_none());
}
// Add the final vote to form a QC
let executed_state = &block.compute_result().executed_state;
let final_voter = &signers[0];
let vote = Vote::new(
VoteData::new(
BlockInfo::from_block(
block.block(),
executed_state.state_id,
executed_state.version,
executed_state.validators.clone(),
),
block.quorum_cert().certified_block().clone(),
),
final_voter.author(),
placeholder_ledger_info(),
final_voter,
);
match block_store.insert_vote_and_qc(&vote, &validator_verifier) {
VoteReceptionResult::NewQuorumCertificate(qc) => {
assert_eq!(qc.certified_block().id(), block.id());
}
_ => {
panic!("QC not formed!");
}
}
let block_qc = block_store.get_quorum_cert_for_block(block.id()).unwrap();
assert_eq!(block_qc.certified_block().id(), block.id());
} | rust_cleaned_test_functions.jsonl/59233 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1268
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
54360,
368,
341,
262,
3504,
2740,
956,
27413,
486,
1539,
6137,
5478,
70962,
543,
262,
442,
2573,
705,
3322,
2155,
12014,
311,
1824,
2155,
12684,
369,
279,
1852,
2504,
624,
262,
1077,
320,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_dummy_timer_context() {
// An implementation of `TimerContext` that uses `usize` timer IDs
// and stores every timer in a `Vec`.
impl TimerHandler<usize> for DummyCtx<Vec<(usize, DummyInstant)>, usize> {
fn handle_timer(&mut self, id: usize) {
let now = self.now();
self.get_mut().push((id, now));
}
}
let mut ctx = DummyCtx::<Vec<(usize, DummyInstant)>, usize>::default();
// `false`.
assert!(!ctx.trigger_next_timer());
assert_eq!(ctx.get_ref().as_slice(), []);
const ONE_SEC: Duration = Duration::from_secs(1);
const ONE_SEC_INSTANT: DummyInstant = DummyInstant { offset: ONE_SEC };
ctx = Default::default();
// No timer with id `0` exists yet.
assert_eq!(ctx.scheduled_instant(0), None);
assert_eq!(ctx.schedule_timer(ONE_SEC, 0), None);
// Timer with id `0` scheduled to execute at `ONE_SEC_INSTANT`.
assert_eq!(ctx.scheduled_instant(0).unwrap(), ONE_SEC_INSTANT);
assert!(ctx.trigger_next_timer());
assert_eq!(ctx.get_ref().as_slice(), [(0, ONE_SEC_INSTANT)]);
// instant.
assert_eq!(ctx.scheduled_instant(0), None);
// The time should have been advanced.
assert_eq!(ctx.now(), ONE_SEC_INSTANT);
// triggerable again.
ctx = Default::default();
assert!(!ctx.trigger_next_timer());
assert_eq!(ctx.get_ref().as_slice(), []);
ctx = Default::default();
assert_eq!(ctx.schedule_timer(ONE_SEC, 0), None);
assert_eq!(ctx.cancel_timer(0), Some(ONE_SEC_INSTANT));
assert!(!ctx.trigger_next_timer());
assert_eq!(ctx.get_ref().as_slice(), []);
// second timer should overwrite the first one.
ctx = Default::default();
assert_eq!(ctx.schedule_timer(Duration::from_secs(0), 0), None);
assert_eq!(ctx.schedule_timer(ONE_SEC, 0), Some(Duration::from_secs(0).into()));
assert_eq!(ctx.cancel_timer(0), Some(ONE_SEC_INSTANT));
// If we schedule three timers and then run `trigger_timers_until`
ctx = Default::default();
assert_eq!(ctx.schedule_timer(Duration::from_secs(0), 0), None,);
assert_eq!(ctx.schedule_timer(Duration::from_secs(1), 1), None,);
assert_eq!(ctx.schedule_timer(Duration::from_secs(2), 2), None,);
assert_eq!(ctx.trigger_timers_until_instant(ONE_SEC_INSTANT), 2);
// The first two timers should have fired.
assert_eq!(
ctx.get_ref().as_slice(),
[(0, DummyInstant::from(Duration::from_secs(0))), (1, ONE_SEC_INSTANT)]
);
// They should be canceled now.
assert_eq!(ctx.cancel_timer(0), None);
assert_eq!(ctx.cancel_timer(1), None);
// The clock should have been updated.
assert_eq!(ctx.now(), ONE_SEC_INSTANT);
// The last timer should not have fired.
assert_eq!(ctx.cancel_timer(2), Some(DummyInstant::from(Duration::from_secs(2))));
} | rust_cleaned_test_functions.jsonl/108603 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1729
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60321,
16255,
8467,
368,
341,
310,
442,
1527,
8129,
315,
1565,
10105,
1972,
63,
429,
5711,
1565,
51878,
63,
9021,
28360,
198,
310,
442,
323,
10533,
1449,
9021,
304,
264,
1565,
10050,
18639,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vertical_split_by_height() {
let target = Rect {
x: 2,
y: 2,
width: 10,
height: 10,
};
let chunks = Layout::default()
.direction(Direction::Vertical)
.constraints(
[
Constraint::Percentage(10),
Constraint::Max(5),
Constraint::Min(1),
]
.as_ref(),
)
.split(target);
assert_eq!(target.height, chunks.iter().map(|r| r.height).sum::<u16>());
chunks.windows(2).for_each(|w| assert!(w[0].y <= w[1].y));
} | rust_cleaned_test_functions.jsonl/22805 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 411
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
61203,
17052,
3710,
9561,
368,
341,
286,
1077,
2169,
284,
11920,
341,
310,
856,
25,
220,
17,
345,
310,
379,
25,
220,
17,
345,
310,
2374,
25,
220,
16,
15,
345,
310,
2608,
25,
220,
16,
15,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dkg_pool_purging() {
// create 2 DKGs for the same subnet
let current_dkg_id_start_height = Height::from(30);
let last_dkg_id_start_height = Height::from(10);
let mut pool = DkgPoolImpl::new(MetricsRegistry::new());
pool.apply_changes(
[
make_message(current_dkg_id_start_height, node_test_id(0)),
make_message(last_dkg_id_start_height, node_test_id(0)),
]
.iter()
.cloned()
.map(ChangeAction::AddToValidated)
.collect(),
);
// add two unvalidated
pool.insert(UnvalidatedArtifact {
message: make_message(current_dkg_id_start_height, node_test_id(1)),
peer_id: node_test_id(1),
timestamp: mock_time(),
});
pool.insert(UnvalidatedArtifact {
message: make_message(last_dkg_id_start_height, node_test_id(1)),
peer_id: node_test_id(1),
timestamp: mock_time(),
});
// ensure we have 2 validated and 2 unvalidated artifacts
assert_eq!(pool.get_validated().count(), 2);
assert_eq!(pool.get_unvalidated().count(), 2);
// purge below the height of the current dkg and make sure the older artifacts
// are purged from the validated and unvalidated sections
pool.apply_changes(vec![ChangeAction::Purge(current_dkg_id_start_height)]);
assert_eq!(pool.get_validated().count(), 1);
assert_eq!(pool.get_unvalidated().count(), 1);
// purge the highest height and make sure everything is gone
pool.apply_changes(vec![ChangeAction::Purge(
current_dkg_id_start_height.increment(),
)]);
assert_eq!(pool.get_validated().count(), 0);
assert_eq!(pool.get_unvalidated().count(), 0);
} | rust_cleaned_test_functions.jsonl/96878 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 879
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
7351,
15709,
620,
324,
3173,
368,
341,
286,
442,
1855,
220,
17,
422,
42916,
82,
369,
279,
1852,
51457,
198,
286,
1077,
1482,
814,
7351,
842,
4906,
9561,
284,
21432,
486,
1499,
7,
18,
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_retain() {
let mut v = vec![1u, 2, 3, 4, 5];
v.retain(is_odd);
assert_eq!(v, vec![1u, 3, 5]);
} | rust_cleaned_test_functions.jsonl/31839 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21695,
466,
368,
341,
286,
1077,
5206,
348,
284,
7486,
20703,
16,
84,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
286,
348,
1327,
22921,
9623,
74668,
317,
286,
2060,
10714,
1029... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_seccomp_empty() {
let rc1 = unsafe { libc::prctl(libc::PR_GET_SECCOMP) };
assert_eq!(rc1, 0);
SeccompFilter::apply(SeccompFilter::empty().try_into().unwrap()).unwrap();
let rc2 = unsafe { libc::prctl(libc::PR_GET_SECCOMP) };
assert_eq!(rc2, 0);
} | rust_cleaned_test_functions.jsonl/99453 | {
"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,
3453,
638,
14435,
15124,
368,
341,
286,
1077,
10192,
16,
284,
19860,
314,
42142,
486,
649,
12373,
44828,
66,
486,
6480,
12702,
3620,
3706,
51607,
8,
2605,
286,
2060,
10714,
10297,
1287,
16,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_scoring_from_scores() {
let y = b"GGGGGGATG";
let x = b"ATG";
let scoring = Scoring::from_scores(-5, -1, 1, -1).yclip(-5);
let mut aligner = Aligner::with_scoring(scoring);
let alignment = aligner.custom(x, y);
assert_eq!(alignment.operations, [Yclip(6), Match, Match, Match]);
} | rust_cleaned_test_functions.jsonl/16855 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 169
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13171,
5503,
5673,
27198,
368,
341,
286,
1077,
379,
284,
293,
1,
22254,
22254,
22254,
828,
38,
876,
286,
1077,
856,
284,
293,
1,
828,
38,
3302,
286,
1077,
19826,
284,
2463,
5503,
486,
1499,
27... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pattern_matches_require_literal_separator() {
let options_require_literal = MatchOptions {
case_sensitive: true,
require_literal_separator: true,
require_literal_leading_dot: false
};
let options_not_require_literal = MatchOptions {
case_sensitive: true,
require_literal_separator: false,
require_literal_leading_dot: false
};
assert!(Pattern::new("abc/def").matches_with("abc/def", options_require_literal));
assert!(!Pattern::new("abc?def").matches_with("abc/def", options_require_literal));
assert!(!Pattern::new("abc*def").matches_with("abc/def", options_require_literal));
assert!(!Pattern::new("abc[/]def").matches_with("abc/def", options_require_literal));
assert!(Pattern::new("abc/def").matches_with("abc/def", options_not_require_literal));
assert!(Pattern::new("abc?def").matches_with("abc/def", options_not_require_literal));
assert!(Pattern::new("abc*def").matches_with("abc/def", options_not_require_literal));
assert!(Pattern::new("abc[/]def").matches_with("abc/def", options_not_require_literal));
} | rust_cleaned_test_functions.jsonl/13358 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 508
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21260,
38344,
13793,
34100,
58204,
368,
1476,
286,
1077,
2606,
13793,
34100,
284,
14152,
3798,
341,
310,
1142,
65324,
25,
830,
345,
310,
1373,
34100,
58204,
25,
830,
345,
310,
1373,
34100,
11751,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_convert_temperature() {
let test_data = [
(0x0000, -45000),
// Datasheet setion 5.11 "Conversion of Sensor Output"
(((0b0110_0100 as u16) << 8) | 0b1000_1011, 23730),
];
for td in &test_data {
assert_eq!(convert_temperature(td.0), td.1);
}
} | rust_cleaned_test_functions.jsonl/6822 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 192
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
53525,
368,
341,
286,
1077,
1273,
1769,
284,
2278,
310,
320,
15,
87,
15,
15,
15,
15,
11,
481,
19,
20,
15,
15,
15,
1326,
310,
442,
422,
19346,
3674,
738,
290,
220,
20,
13,
16,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_device_insert_validation() {
let mut device = DeviceInsert {
device_name: "".into(),
device_url: "".into(),
pool_id: 0,
};
assert!(device.validate().is_err());
device.device_name = "test".into();
device.device_url = "http://test".into();
assert!(device.validate().is_ok());
device.device_name = "".into();
assert!(device.validate().is_err());
} | rust_cleaned_test_functions.jsonl/64910 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 227
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9204,
17678,
19416,
368,
341,
286,
1077,
5206,
3671,
284,
13903,
13780,
341,
310,
3671,
1269,
25,
44907,
18122,
3148,
310,
3671,
2903,
25,
44907,
18122,
3148,
310,
7314,
842,
25,
220,
15,
345,
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_handle_key() {
let mut input = StringInput::with_filter_map(|c| if c == 'i' { None } else { Some(c) });
input.set_value(LOREM.into());
input.set_at(40);
input.handle_key(KeyEvent::new(KeyCode::Left, KeyModifiers::empty()));
assert_eq!(input.get_at(), 39);
input.handle_key(KeyEvent::new(KeyCode::Left, KeyModifiers::CONTROL));
assert_eq!(input.get_at(), 28);
input.handle_key(KeyEvent::new(KeyCode::Right, KeyModifiers::empty()));
assert_eq!(input.get_at(), 29);
input.handle_key(KeyEvent::new(KeyCode::Right, KeyModifiers::CONTROL));
assert_eq!(input.get_at(), 41);
input.handle_key(KeyEvent::new(KeyCode::Home, KeyModifiers::empty()));
assert_eq!(input.get_at(), 0);
input.handle_key(KeyEvent::new(KeyCode::End, KeyModifiers::empty()));
assert_eq!(input.get_at(), 470);
input.set_at(40);
input.handle_key(KeyEvent::new(KeyCode::Backspace, KeyModifiers::empty()));
assert_eq!(input.get_at(), 39);
assert_eq!(input.value().chars().count(), 469);
input.handle_key(KeyEvent::new(KeyCode::Char('r'), KeyModifiers::empty()));
assert_eq!(input.get_at(), 40);
assert_eq!(input.value(), LOREM);
input.handle_key(KeyEvent::new(KeyCode::Char('u'), KeyModifiers::CONTROL));
assert_eq!(input.get_at(), 0);
assert_eq!(input.value().chars().count(), 430);
input.set_at(400);
input.handle_key(KeyEvent::new(KeyCode::Char('k'), KeyModifiers::CONTROL));
assert_eq!(input.get_at(), 400);
assert_eq!(input.value().chars().count(), 400);
input.handle_key(KeyEvent::new(KeyCode::Backspace, KeyModifiers::ALT));
assert_eq!(input.get_at(), 394);
assert_eq!(input.value().chars().count(), 394);
input.set_at(40);
input.handle_key(KeyEvent::new(KeyCode::Delete, KeyModifiers::empty()));
assert_eq!(input.get_at(), 40);
assert_eq!(input.value().chars().count(), 393);
input.handle_key(KeyEvent::new(KeyCode::Delete, KeyModifiers::ALT));
assert_eq!(input.get_at(), 40);
assert_eq!(input.value().chars().count(), 388);
input.handle_key(KeyEvent::new(KeyCode::Char('i'), KeyModifiers::empty()));
assert_eq!(input.get_at(), 40);
assert_eq!(input.value().chars().count(), 388);
input.handle_key(KeyEvent::new(KeyCode::Char('I'), KeyModifiers::empty()));
assert_eq!(input.get_at(), 41);
assert_eq!(input.value().chars().count(), 389);
let mut input = StringInput::with_filter_map(|c| if c == 'ȼ' { None } else { Some(c) });
input.set_value(UNICODE.into());
input.set_at(40);
input.handle_key(KeyEvent::new(KeyCode::Left, KeyModifiers::empty()));
assert_eq!(input.get_at(), 39);
input.handle_key(KeyEvent::new(KeyCode::Left, KeyModifiers::CONTROL));
assert_eq!(input.get_at(), 31);
input.handle_key(KeyEvent::new(KeyCode::Right, KeyModifiers::empty()));
assert_eq!(input.get_at(), 32);
input.handle_key(KeyEvent::new(KeyCode::Right, KeyModifiers::CONTROL));
assert_eq!(input.get_at(), 39);
input.handle_key(KeyEvent::new(KeyCode::Home, KeyModifiers::empty()));
assert_eq!(input.get_at(), 0);
input.handle_key(KeyEvent::new(KeyCode::End, KeyModifiers::empty()));
assert_eq!(input.get_at(), 470);
input.set_at(41);
input.handle_key(KeyEvent::new(KeyCode::Backspace, KeyModifiers::empty()));
assert_eq!(input.get_at(), 40);
assert_eq!(input.value().chars().count(), 469);
input.handle_key(KeyEvent::new(KeyCode::Char('Æ'), KeyModifiers::empty()));
assert_eq!(input.get_at(), 41);
assert_eq!(input.value(), UNICODE);
input.set_at(40);
input.handle_key(KeyEvent::new(KeyCode::Char('u'), KeyModifiers::CONTROL));
assert_eq!(input.get_at(), 0);
assert_eq!(input.value().chars().count(), 430);
input.set_at(400);
input.handle_key(KeyEvent::new(KeyCode::Char('k'), KeyModifiers::CONTROL));
assert_eq!(input.get_at(), 400);
assert_eq!(input.value().chars().count(), 400);
input.handle_key(KeyEvent::new(KeyCode::Backspace, KeyModifiers::ALT));
assert_eq!(input.get_at(), 397);
assert_eq!(input.value().chars().count(), 397);
input.set_at(40);
input.handle_key(KeyEvent::new(KeyCode::Delete, KeyModifiers::empty()));
assert_eq!(input.get_at(), 40);
assert_eq!(input.value().chars().count(), 396);
input.handle_key(KeyEvent::new(KeyCode::Delete, KeyModifiers::ALT));
assert_eq!(input.get_at(), 40);
assert_eq!(input.value().chars().count(), 386);
input.handle_key(KeyEvent::new(KeyCode::Char('ȼ'), KeyModifiers::empty()));
assert_eq!(input.get_at(), 40);
assert_eq!(input.value().chars().count(), 386);
} | rust_cleaned_test_functions.jsonl/63668 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2234
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10630,
3097,
368,
341,
286,
1077,
5206,
1946,
284,
923,
2505,
486,
4197,
8727,
5376,
22428,
66,
91,
421,
272,
621,
364,
72,
6,
314,
2240,
335,
770,
314,
4329,
1337,
8,
1625,
286,
1946,
980,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_contains() {
let empty = Nil::<int>;
assert!((!empty.contains(5)));
let list = List::from_vec([5, 8, 6]);
assert!((list.contains(5)));
assert!((!list.contains(7)));
assert!((list.contains(8)));
} | rust_cleaned_test_functions.jsonl/130356 | {
"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,
63598,
368,
341,
286,
1077,
4287,
284,
32274,
27638,
396,
10133,
286,
2060,
0,
1188,
0,
3194,
8786,
7,
20,
22525,
286,
1077,
1140,
284,
1759,
486,
1499,
13251,
2561,
20,
11,
220,
23,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_log_disconnect_initiated_from_user_request() {
let (mut cobalt_sender, mut cobalt_receiver) = fake_cobalt_sender();
let inspect_tree = fake_inspect_tree();
let disconnect_info = DisconnectInfo {
connected_duration: 30.seconds(),
bssid: [1u8; 6],
ssid: b"foo".to_vec(),
last_rssi: -90,
last_snr: 1,
reason_code: fidl_mlme::ReasonCode::UnspecifiedReason.into_primitive(),
disconnect_source: DisconnectSource::User,
};
log_disconnect(&mut cobalt_sender, inspect_tree.clone(), &disconnect_info);
// Nothing should be logged
assert_variant!(cobalt_receiver.try_next(), Err(_));
} | rust_cleaned_test_functions.jsonl/14750 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 349
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5224,
67972,
6137,
10029,
5673,
3317,
7893,
368,
341,
286,
1077,
320,
6984,
33828,
3145,
54356,
11,
5206,
33828,
3145,
65691,
8,
284,
12418,
666,
674,
3145,
54356,
543,
286,
1077,
24085,
11663,
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_map_single_func_non_consuming() {
let h = hlist![9000, 9001, 9002];
let mapped = h.to_ref().map(|v| v + 1);
assert_eq!(mapped, hlist![9001, 9002, 9003]);
} | rust_cleaned_test_functions.jsonl/24763 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5376,
19487,
9596,
21637,
3382,
61117,
368,
341,
286,
1077,
305,
284,
305,
1607,
20703,
24,
15,
15,
15,
11,
220,
24,
15,
15,
16,
11,
220,
24,
15,
15,
17,
935,
286,
1077,
23844,
284,
305,
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_user_playlist_unfollow() {
let mut oauth = SpotifyOAuth::default()
.scope("playlist-modify-private playlist-modify-public")
.build();
match get_token(&mut oauth) {
Some(token_info) => {
let client_credential = SpotifyClientCredentials::default()
.token_info(token_info)
.build();
let spotify = Spotify::default()
.client_credentials_manager(client_credential)
.build();
let user_id = "2257tjys2e2u2ygfke42niy2q";
let playlist_id = "65V6djkcVRyOStLd8nza8E";
let result = spotify.user_playlist_unfollow(user_id, playlist_id);
assert!(result.is_ok());
}
None => assert!(false),
};
} | rust_cleaned_test_functions.jsonl/79297 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 405
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3317,
69267,
4907,
18559,
368,
341,
262,
1077,
5206,
46415,
284,
40537,
57850,
486,
2258,
741,
286,
659,
4186,
445,
34233,
17078,
1437,
65277,
26791,
17078,
1437,
56471,
1138,
286,
659,
5834,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_consensus_serialization() {
let example_key = ConsensusKey(
TendermintKey::from_raw_ed25519(&hex::decode_upper(EXAMPLE_CONSENSUS_KEY).unwrap())
.unwrap(),
);
assert_eq!(
example_key.to_string(),
"icp1zcjduepqfgjuveq2raetnjt4xwpffm63kmguxv2chdhvhf5lhslmtgeunh8qtgl66f"
);
} | rust_cleaned_test_functions.jsonl/62136 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 222
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31971,
13626,
25602,
2022,
368,
341,
286,
1077,
3110,
3097,
284,
7292,
13626,
1592,
1006,
310,
93867,
67791,
1592,
486,
1499,
16067,
32370,
17,
20,
20,
16,
24,
2099,
17308,
486,
18196,
34445,
2540... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_remove_learner() -> Result<()> {
let l = default_logger();
let mut n1 = new_test_learner_raft(1, vec![1], vec![2], 10, 1, new_storage(), &l);
n1.apply_conf_change(&remove_node(2))?;
assert_iter_eq!(o n1.prs().conf().voters().ids(), vec![1]);
assert!(n1.prs().conf().learners().is_empty());
// Remove all voters are not allowed.
assert!(n1.apply_conf_change(&remove_node(1)).is_err());
assert_iter_eq!(o n1.prs().conf().voters().ids(), vec![1]);
assert!(n1.prs().conf().learners().is_empty());
Ok(())
} | rust_cleaned_test_functions.jsonl/19183 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 250
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
62,
93595,
368,
1464,
5714,
71698,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
1077,
5206,
308,
16,
284,
501,
4452,
62,
93595,
62,
2944,
7,
16,
11,
7486,
20703,
16,
1125,
7486,
207... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_add_key() {
let key = JwtKey::new("1", N, E);
let mut key_set = KeyStore::new();
assert_eq!(0usize, key_set.keys_len());
key_set.add_key(&key);
assert_eq!(1usize, key_set.keys_len());
let result = key_set.key_by_id("1");
assert!(result.is_some());
let key = result.unwrap();
assert_eq!(N, key.n);
assert_eq!(E, key.e);
assert_eq!("1", key.kid);
} | rust_cleaned_test_functions.jsonl/124805 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 247
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
3097,
368,
341,
286,
1077,
1376,
284,
54369,
1592,
486,
931,
445,
16,
497,
451,
11,
468,
626,
286,
1077,
5206,
1376,
2602,
284,
5309,
6093,
486,
931,
1428,
286,
2060,
10714,
10297,
15,
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_seal_open_detached() {
init().unwrap();
use randombytes::randombytes;
let aes = Aes256Gcm::new().unwrap();
for i in 0..256usize {
let k = aes.gen_key();
let n = gen_random_nonce();
let ad = randombytes(i);
let mut m = randombytes(i);
let m2 = m.clone();
let t = aes.seal_detached(&mut m, Some(&ad), &n, &k);
aes.open_detached(&mut m, Some(&ad), &t, &n, &k).unwrap();
assert_eq!(m, m2);
}
} | rust_cleaned_test_functions.jsonl/46773 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 364
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3453,
278,
11311,
24409,
3854,
368,
341,
310,
2930,
1005,
15454,
543,
310,
990,
4194,
9651,
486,
11463,
9651,
280,
310,
1077,
56575,
284,
362,
288,
17,
20,
21,
38,
6226,
486,
931,
1005,
15454,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_multiple_network_interfaces() {
let focal = UbuntuDiskConfig::new(FOCAL_IMAGE_NAME.to_string());
let guest = Guest::new(Box::new(focal));
let kernel_path = direct_kernel_boot_path();
let mut child = GuestCommand::new(&guest)
.args(&["--cpus", "boot=1"])
.args(&["--memory", "size=512M"])
.args(&["--kernel", kernel_path.to_str().unwrap()])
.args(&["--cmdline", DIRECT_KERNEL_BOOT_CMDLINE])
.default_disks()
.args(&[
"--net",
guest.default_net_string().as_str(),
"tap=,mac=8a:6b:6f:5a:de:ac,ip=192.168.3.1,mask=255.255.255.0",
"tap=mytap1,mac=fe:1f:9e:e1:60:f2,ip=192.168.4.1,mask=255.255.255.0",
])
.capture_output()
.spawn()
.unwrap();
let r = std::panic::catch_unwind(|| {
guest.wait_vm_boot(None).unwrap();
let tap_count = exec_host_command_output("ip link | grep -c mytap1");
assert_eq!(String::from_utf8_lossy(&tap_count.stdout).trim(), "1");
// 3 network interfaces + default localhost ==> 4 interfaces
assert_eq!(
guest
.ssh_command("ip -o link | wc -l")
.unwrap()
.trim()
.parse::<u32>()
.unwrap_or_default(),
4
);
});
let _ = child.kill();
let output = child.wait_with_output().unwrap();
handle_child_output(r, &output);
} | rust_cleaned_test_functions.jsonl/26146 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 913
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45233,
20966,
72960,
368,
341,
286,
1077,
41099,
284,
34960,
47583,
2648,
486,
931,
7,
3788,
49533,
19121,
4708,
2389,
3904,
1423,
286,
1077,
8640,
284,
26215,
486,
931,
67758,
486,
931,
955,
3683... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_field_from_bytes_string_invalid()
{
match Field::from_bytes(&test_string_data_invalid)
{
Err(error) =>
{
assert_eq!(error.to_string(), "Field data is too short!");
}
Ok(_) =>
{
panic!("Error check failed!");
}
}
} | rust_cleaned_test_functions.jsonl/41984 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 221
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5013,
5673,
12524,
3904,
31433,
741,
262,
341,
286,
2432,
8601,
486,
1499,
12524,
2099,
1944,
3904,
1769,
31433,
340,
286,
341,
310,
15495,
6390,
8,
6274,
310,
341,
394,
2060,
10714,
10297,
841,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_parse_input() {
let input = "L.LL.LL.LL
LLLLLLL.LL
L.L.L..L..
LLLL.LL.LL
L.LL.LL.LL
L.LLLLL.LL
..L.L.....
LLLLLLLLLL
L.LLLLLL.L
L.LLLLL.LL";
let expected = make_expected();
let mut cont = Container::new();
assert_eq!(Ok(()), cont.parse_input(input));
assert_eq!(expected, cont);
} | rust_cleaned_test_functions.jsonl/39671 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 184
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
5898,
368,
341,
286,
1077,
1946,
284,
330,
43,
1214,
43,
1214,
43,
1214,
43,
198,
49356,
86708,
1214,
43,
198,
43,
1214,
1214,
496,
43,
33947,
49356,
1214,
43,
1214,
43,
198,
43,
1214,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_leader_superseding_with_check_quorum() {
let l = default_logger();
let mut a = new_test_raft(1, vec![1, 2, 3], 10, 1, new_storage(), &l);
let mut b = new_test_raft(2, vec![1, 2, 3], 10, 1, new_storage(), &l);
let mut c = new_test_raft(3, vec![1, 2, 3], 10, 1, new_storage(), &l);
a.check_quorum = true;
b.check_quorum = true;
c.check_quorum = true;
let mut nt = Network::new(vec![Some(a), Some(b), Some(c)], &l);
let b_election_timeout = nt.peers[&2].election_timeout();
// prevent campaigning from b
nt.peers
.get_mut(&2)
.unwrap()
.set_randomized_election_timeout(b_election_timeout + 1);
for _ in 0..b_election_timeout {
nt.peers.get_mut(&2).unwrap().tick();
}
nt.send(vec![new_message(1, 1, MessageType::MsgHup, 0)]);
assert_eq!(nt.peers[&1].state, StateRole::Leader);
assert_eq!(nt.peers[&3].state, StateRole::Follower);
nt.send(vec![new_message(3, 3, MessageType::MsgHup, 0)]);
// Peer b rejected c's vote since its electionElapsed had not reached to electionTimeout
assert_eq!(nt.peers[&3].state, StateRole::Candidate);
// Letting b's electionElapsed reach to electionTimeout
for _ in 0..b_election_timeout {
nt.peers.get_mut(&2).unwrap().tick();
}
nt.send(vec![new_message(3, 3, MessageType::MsgHup, 0)]);
assert_eq!(nt.peers[&3].state, StateRole::Leader);
} | rust_cleaned_test_functions.jsonl/19119 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 632
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
79991,
23723,
388,
16100,
6615,
7200,
11280,
33006,
368,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
1077,
5206,
264,
284,
501,
4452,
62,
2944,
7,
16,
11,
7486,
20703,
16,
11,
220,
17,
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_many_tombstones() {
let engine = TestEngineBuilder::new().build().unwrap();
// Generate RocksDB tombstones in write cf.
let start_ts = 1;
let safe_point = 2;
for i in 0..16 {
for y in 0..16 {
let pk = &[i as u8, y as u8];
must_prewrite_put(&engine, pk, b"", pk, start_ts);
must_rollback(&engine, pk, start_ts);
if !((i == 0 && y == 0) || (i == 15 && y == 15)) {
must_gc(&engine, pk, safe_point);
}
}
}
// Generate 16 locks in lock cf.
let start_ts = 3;
for i in 0..16 {
let pk = &[i as u8];
must_prewrite_put(&engine, pk, b"", pk, start_ts);
}
let snapshot = engine.snapshot(&Context::default()).unwrap();
let row = &[15 as u8];
let k = Key::from_raw(row);
// Call reverse scan
let ts = 2;
let mut scanner = ScannerBuilder::new(snapshot, ts, true)
.range(None, Some(k))
.build()
.unwrap();
assert_eq!(scanner.next().unwrap(), None);
let statistics = scanner.take_statistics();
assert_eq!(statistics.lock.prev, 15);
assert_eq!(statistics.write.prev, 1);
} | rust_cleaned_test_functions.jsonl/36640 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 721
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22101,
528,
2855,
32510,
368,
341,
286,
1077,
4712,
284,
3393,
4571,
3297,
486,
931,
1005,
5834,
1005,
15454,
1428,
286,
442,
19813,
68031,
3506,
43080,
32510,
304,
3270,
24111,
624,
286,
1077,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 8 |
#[test]
fn test_medium_ascii() {
let strs = vec![
"rustconf 2021",
"new york city",
"nyc pizza is good",
"test the 24 char limit!!",
];
for s in strs {
let compact = CompactString::new(s);
assert_eq!(compact, s);
assert_eq!(s, compact);
#[cfg(target_pointer_width = "64")]
let is_heap = false;
#[cfg(target_pointer_width = "32")]
let is_heap = true;
assert_eq!(compact.is_heap_allocated(), is_heap);
}
} | rust_cleaned_test_functions.jsonl/2782 | {
"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,
54867,
50238,
368,
341,
262,
1077,
57584,
284,
7486,
90515,
286,
330,
35788,
6135,
220,
17,
15,
17,
16,
756,
286,
330,
931,
49572,
3283,
756,
286,
330,
77,
3337,
22502,
374,
1661,
756,
286,
33... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_causets_diff() {
let a = vec!["1", "2", "3"];
let a_diff_a = causets_diff(&a, &a);
assert!(a_diff_a.is_empty());
let b = vec!["4"];
assert_eq!(a, causets_diff(&a, &b));
let c = vec!["4", "5", "3", "6"];
assert_eq!(vec!["1", "2"], causets_diff(&a, &c));
assert_eq!(vec!["4", "5", "6"], causets_diff(&c, &a));
let d = vec!["1", "2", "3", "4"];
let a_diff_d = causets_diff(&a, &d);
assert!(a_diff_d.is_empty());
assert_eq!(vec!["4"], causets_diff(&d, &a));
} | rust_cleaned_test_functions.jsonl/67535 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 328
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
11855,
1415,
15850,
368,
341,
286,
1077,
264,
284,
7486,
0,
1183,
16,
497,
330,
17,
497,
330,
18,
6332,
286,
1077,
264,
15850,
4306,
284,
24524,
1415,
15850,
2099,
64,
11,
609,
64,
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_bloom_interval() -> Result<()> {
let schema = DataSchemaRefExt::create(vec![DataField::new(
"Interval",
DataType::Interval(IntervalUnit::DayTime),
true,
)]);
let block = DataBlock::create(schema, vec![Series::from_data([
None,
None,
None,
None,
Some(1234_i64),
Some(-4321_i64),
])]);
let col = block.column(0);
let mut bloom = BloomFilter::with_rate(6, 0.000001, create_seeds());
// this case false positive not exist
bloom.add(col)?;
assert!(bloom.find(DataValue::Int64(1234_i64))?);
assert!(bloom.find(DataValue::Int64(-4321_i64))?);
Ok(())
} | rust_cleaned_test_functions.jsonl/101371 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 324
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
18474,
20541,
368,
1464,
5714,
71698,
341,
262,
1077,
10802,
284,
2885,
8632,
3945,
6756,
486,
3182,
25592,
20703,
1043,
1877,
486,
931,
1006,
286,
330,
10256,
756,
286,
33172,
486,
10256,
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... | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.