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_to_async() {
let mut srv =
init_service(App::new().service(web::resource("/test").to_async(|| {
sleep(Duration::from_millis(100)).then(|_| HttpResponse::Ok())
})));
let req = TestRequest::with_uri("/test").to_request();
let resp = call_service(&mut srv, req);
assert_eq!(resp.status(), StatusCode::OK);
} | rust_cleaned_test_functions.jsonl/4937 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 195
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
28346,
368,
341,
286,
1077,
5206,
43578,
4035,
310,
2930,
12267,
23231,
486,
931,
1005,
7936,
39769,
486,
9233,
4283,
1944,
1827,
983,
28346,
79453,
341,
394,
6084,
64114,
486,
1499,
717,
56... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_record_schema_with_currently_parsing_schema_named_fixed() {
let schema = Schema::parse_str(
r#"
{
"type" : "record",
"name" : "record",
"fields" : [
{
"type" : "fixed",
"name" : "fixed",
"size": 456
},
{ "name" : "next", "type" : "fixed" }
]
}
"#,
)
.unwrap();
let mut lookup = HashMap::new();
lookup.insert("fixed".to_owned(), 0);
lookup.insert("next".to_owned(), 1);
let expected = Schema::Record {
name: Name {
name: "record".to_owned(),
namespace: None,
aliases: None,
},
doc: None,
fields: vec![
RecordField {
name: "fixed".to_string(),
doc: None,
default: None,
schema: Schema::Fixed {
name: Name {
name: "fixed".to_owned(),
namespace: None,
aliases: None,
},
doc: None,
size: 456,
},
order: RecordFieldOrder::Ascending,
position: 0,
},
RecordField {
name: "next".to_string(),
doc: None,
default: None,
schema: Schema::Fixed {
name: Name {
name: "fixed".to_owned(),
namespace: None,
aliases: None,
},
doc: None,
size: 456,
},
order: RecordFieldOrder::Ascending,
position: 1,
},
],
lookup,
};
assert_eq!(schema, expected);
let canonical_form = &schema.canonical_form();
let expected = r#"{"name":"record","type":"record","fields":[{"name":"fixed","type":{"name":"fixed","type":"fixed","size":456}},{"name":"next","type":{"name":"fixed","type":"fixed","size":456}}]}"#;
assert_eq!(canonical_form, &expected);
} | rust_cleaned_test_functions.jsonl/116697 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1568
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14192,
25371,
6615,
11080,
398,
620,
28598,
25371,
71834,
37839,
368,
341,
286,
1077,
10802,
284,
12539,
486,
6400,
2895,
1006,
310,
435,
2,
698,
310,
341,
1060,
330,
1313,
1,
549,
330,
8548,
75... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_config_set_cert_and_key() {
let mut config = Config::new();
let cert = include_str!("../test/apiserver.pem");
let key = include_str!("../test/apiserver-key.pem");
config.add_cert_chain_and_key(cert, key).unwrap();
} | rust_cleaned_test_functions.jsonl/51673 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5332,
2602,
37097,
8378,
3097,
368,
341,
286,
1077,
5206,
2193,
284,
5532,
486,
931,
1428,
286,
1077,
2777,
284,
2924,
2895,
17223,
1244,
1944,
66152,
2836,
49373,
797,
286,
1077,
1376,
284,
2924,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_negative_rand_range() {
let mut rng = task_rng();
let l = FromPrimitive::from_uint(2352).unwrap();
let u = FromPrimitive::from_uint(3513).unwrap();
// Switching u and l should fail:
let _n: BigInt = rng.gen_bigint_range(&u, &l);
} | rust_cleaned_test_functions.jsonl/96941 | {
"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,
53865,
33864,
9698,
368,
341,
286,
1077,
5206,
28422,
284,
3383,
66849,
543,
286,
1077,
326,
284,
5542,
33313,
486,
1499,
15807,
7,
17,
18,
20,
17,
568,
15454,
543,
286,
1077,
575,
284,
5542,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stashing() -> Result<()> {
let (_td, repo) = repo_init().unwrap();
let root = repo.path().parent().unwrap();
let repo_path = root.as_os_str().to_str().unwrap();
File::create(&root.join("foo.txt"))?
.write_all(b"test\nfoo")?;
assert_eq!(get_statuses(repo_path), (1, 0));
stash_save(repo_path, None, true, false)?;
assert_eq!(get_statuses(repo_path), (0, 0));
Ok(())
} | rust_cleaned_test_functions.jsonl/20965 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 236
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
19049,
368,
1464,
5714,
71698,
341,
286,
1077,
5453,
1296,
11,
15867,
8,
284,
15867,
6137,
1005,
15454,
543,
286,
1077,
3704,
284,
15867,
3875,
1005,
3765,
1005,
15454,
543,
286,
1077,
15867... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_cache() {
let mut cache: Cache<usize, usize> = Cache::new(128);
for i in 0usize..256 {
cache.add(i, i);
}
assert_eq!(cache.len(), 128);
for i in 0usize..128 {
assert!(cache.get(&i).is_none());
}
for i in 128usize..256 {
assert!(cache.get(&i).is_some());
}
for i in 128usize..192 {
cache.remove(&i);
assert!(cache.get(&i).is_none());
}
cache.purge();
assert!(cache.is_empty());
assert!(cache.get(&200).is_none());
} | rust_cleaned_test_functions.jsonl/96739 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 336
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11529,
368,
341,
286,
1077,
5206,
6500,
25,
19479,
90244,
11,
22301,
29,
284,
19479,
486,
931,
7,
16,
17,
23,
317,
286,
369,
600,
304,
220,
15,
51878,
496,
17,
20,
21,
341,
310,
6500,
1364,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_no_pushes_to_from_different_shred_versions() {
let now = timestamp();
let mut crds = Crds::default();
let stakes = HashMap::new();
let node = CrdsGossipPush::default();
let gossip = socketaddr!("127.0.0.1:1234");
let me = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo {
id: solana_sdk::pubkey::new_rand(),
shred_version: 123,
gossip,
..ContactInfo::default()
}));
let spy = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo {
id: solana_sdk::pubkey::new_rand(),
shred_version: 0,
gossip,
..ContactInfo::default()
}));
let node_123 = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo {
id: solana_sdk::pubkey::new_rand(),
shred_version: 123,
gossip,
..ContactInfo::default()
}));
let node_456 = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo {
id: solana_sdk::pubkey::new_rand(),
shred_version: 456,
gossip,
..ContactInfo::default()
}));
crds.insert(me.clone(), now).unwrap();
crds.insert(spy.clone(), now).unwrap();
crds.insert(node_123.clone(), now).unwrap();
crds.insert(node_456, now).unwrap();
// shred version 123 should ignore nodes with versions 0 and 456
let options = node
.push_options(&crds, &me.label().pubkey(), 123, &stakes, None)
.iter()
.map(|(_, c)| c.id)
.collect::<Vec<_>>();
assert_eq!(options.len(), 1);
assert!(!options.contains(&spy.pubkey()));
assert!(options.contains(&node_123.pubkey()));
// spy nodes should not push to people on different shred versions
assert!(node
.push_options(&crds, &spy.label().pubkey(), 0, &stakes, None)
.iter()
.map(|(_, c)| c.id)
.next()
.is_none());
} | rust_cleaned_test_functions.jsonl/10961 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1029
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
14218,
288,
2346,
5673,
82741,
3712,
1151,
65148,
368,
341,
286,
1077,
1431,
284,
11441,
543,
286,
1077,
5206,
1560,
5356,
284,
4553,
5356,
486,
2258,
543,
286,
1077,
44425,
284,
10528,
486,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_weak_count() {
let a = Arc::new(0u32);
assert!(strong_count(&a) == 1);
assert!(weak_count(&a) == 0);
let w = a.downgrade();
assert!(strong_count(&a) == 1);
assert!(weak_count(&a) == 1);
let x = w.clone();
assert!(weak_count(&a) == 2);
drop(w);
drop(x);
assert!(strong_count(&a) == 1);
assert!(weak_count(&a) == 0);
let c = a.clone();
assert!(strong_count(&a) == 2);
assert!(weak_count(&a) == 0);
let d = c.downgrade();
assert!(weak_count(&c) == 1);
assert!(strong_count(&c) == 2);
drop(a);
drop(c);
drop(d);
} | rust_cleaned_test_functions.jsonl/19214 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 385
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
86356,
3180,
368,
341,
286,
1077,
264,
284,
19689,
486,
931,
7,
15,
84,
18,
17,
317,
286,
2060,
10297,
4519,
3180,
2099,
64,
8,
621,
220,
16,
317,
286,
2060,
10297,
13150,
3180,
2099,
64,
8,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_enum_for_tuple() {
check(
r#"
enum Foo$0{
A(i8),
B(i8),
}
fn main() {
let f: Foo;
f = Foo::A(1);
}
"#,
expect![[r#"
Foo Enum FileId(0) 0..33 5..8
FileId(0) 70..73
"#]],
);
} | rust_cleaned_test_functions.jsonl/60640 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 206
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31054,
5478,
21773,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
9018,
33428,
3,
15,
515,
262,
362,
1956,
23,
1326,
262,
425,
1956,
23,
1326,
532,
8822,
1887,
368,
341,
262,
1077,
282,
25,
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_fq() {
let mut rng = ark_std::test_rng();
for _ in 0..ITERATIONS {
let a: Fq = UniformRand::rand(&mut rng);
let b: Fq = UniformRand::rand(&mut rng);
field_test(a, b);
primefield_test::<Fq>();
sqrt_field_test(a);
}
} | rust_cleaned_test_functions.jsonl/65016 | {
"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,
761,
80,
368,
341,
262,
1077,
5206,
28422,
284,
55217,
15656,
486,
1944,
66849,
543,
262,
369,
716,
304,
220,
15,
496,
24733,
21792,
341,
286,
1077,
264,
25,
434,
80,
284,
47889,
56124,
486,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_div32_reg() {
test_interpreter_and_jit_asm!(
"
lddw r0, 0x10000000c
mov r1, 4
div32 r0, r1
exit",
[],
(),
{ |_vm, res: Result| { res.unwrap() == 0x3 } },
4
);
} | rust_cleaned_test_functions.jsonl/58959 | {
"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,
16237,
18,
17,
4920,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
6228,
286,
326,
631,
86,
435,
15,
11,
220,
15,
87,
16,
15,
15,
15,
15,
15,
15,
15,
66,
198,
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_serialize_round_trip() {
use ebml;
use serialize::{Encodable, Decodable};
let u = Uuid::new_v4();
let mut wr = MemWriter::new();
u.encode(&mut ebml::writer::Encoder(&mut wr));
let doc = ebml::reader::Doc(wr.get_ref());
let u2 = Decodable::decode(&mut ebml::reader::Decoder(doc));
assert_eq!(u, u2);
} | rust_cleaned_test_functions.jsonl/58278 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 193
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
29896,
63883,
368,
341,
286,
990,
24463,
1014,
280,
286,
990,
24235,
22964,
7408,
69129,
11,
3714,
69129,
2315,
286,
1077,
575,
284,
547,
2423,
486,
931,
2273,
19,
543,
286,
1077,
5206,
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_comparison_ops() {
let v = [('<', [1, 0, 0]), ('=', [0, 1, 0]), ('>', [0, 0, 1])];
for &(op, bs) in &v {
let s = format!("%{{1}}%{{2}}%{}%d", op);
let res = expand(s.as_bytes(), &[], &mut Variables::new());
assert!(res.is_ok(), res.err().unwrap());
assert_eq!(res.unwrap(), [b'0' + bs[0]]);
let s = format!("%{{1}}%{{1}}%{}%d", op);
let res = expand(s.as_bytes(), &[], &mut Variables::new());
assert!(res.is_ok(), res.err().unwrap());
assert_eq!(res.unwrap(), [b'0' + bs[1]]);
let s = format!("%{{2}}%{{1}}%{}%d", op);
let res = expand(s.as_bytes(), &[], &mut Variables::new());
assert!(res.is_ok(), res.err().unwrap());
assert_eq!(res.unwrap(), [b'0' + bs[2]]);
}
} | rust_cleaned_test_functions.jsonl/56463 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 485
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
90797,
21959,
368,
341,
286,
1077,
348,
284,
508,
11146,
516,
508,
16,
11,
220,
15,
11,
220,
15,
9719,
4319,
17656,
508,
15,
11,
220,
16,
11,
220,
15,
9719,
4319,
19579,
508,
15,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_high_priority_get_put() {
let storage = TestStorageBuilder::new(DummyLockManager {}, false)
.build()
.unwrap();
let (tx, rx) = channel();
let mut ctx = Context::default();
ctx.set_priority(CommandPri::High);
expect_none(
block_on(storage.get(ctx, Key::from_raw(b"x"), 100.into()))
.unwrap()
.0,
);
let mut ctx = Context::default();
ctx.set_priority(CommandPri::High);
storage
.sched_txn_command(
commands::Prewrite::with_context(
vec![Mutation::Put((Key::from_raw(b"x"), b"100".to_vec()))],
b"x".to_vec(),
100.into(),
ctx,
),
expect_ok_callback(tx.clone(), 1),
)
.unwrap();
rx.recv().unwrap();
let mut ctx = Context::default();
ctx.set_priority(CommandPri::High);
storage
.sched_txn_command(
commands::Commit::new(vec![Key::from_raw(b"x")], 100.into(), 101.into(), ctx),
expect_ok_callback(tx, 2),
)
.unwrap();
rx.recv().unwrap();
let mut ctx = Context::default();
ctx.set_priority(CommandPri::High);
expect_none(
block_on(storage.get(ctx, Key::from_raw(b"x"), 100.into()))
.unwrap()
.0,
);
let mut ctx = Context::default();
ctx.set_priority(CommandPri::High);
expect_value(
b"100".to_vec(),
block_on(storage.get(ctx, Key::from_raw(b"x"), 101.into()))
.unwrap()
.0,
);
} | rust_cleaned_test_functions.jsonl/2079 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1018
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22680,
38161,
3062,
15557,
368,
341,
286,
1077,
5819,
284,
3393,
5793,
3297,
486,
931,
5432,
8574,
11989,
2043,
16452,
895,
340,
310,
659,
5834,
741,
310,
659,
15454,
543,
286,
1077,
320,
3998,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lcm_overflow() {
macro_rules! check {
($t:ty, $x:expr, $y:expr, $r:expr) => { {
let x: $t = $x;
let y: $t = $y;
let o = x.checked_mul(y);
assert!(o.is_none(),
"sanity checking that {} input {} * {} overflows",
stringify!($t), x, y);
assert_eq!(x.lcm(&y), $r);
assert_eq!(y.lcm(&x), $r);
} }
}
check!(i64, 46656000000000000, 600, 46656000000000000);
check!(i8, 0x40, 0x04, 0x40);
check!(u8, 0x80, 0x02, 0x80);
check!(i16, 0x40_00, 0x04, 0x40_00);
check!(u16, 0x80_00, 0x02, 0x80_00);
check!(i32, 0x4000_0000, 0x04, 0x4000_0000);
check!(u32, 0x8000_0000, 0x02, 0x8000_0000);
check!(i64, 0x4000_0000_0000_0000, 0x04, 0x4000_0000_0000_0000);
check!(u64, 0x8000_0000_0000_0000, 0x02, 0x8000_0000_0000_0000);
} | rust_cleaned_test_functions.jsonl/5337 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 528
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
907,
6226,
79073,
368,
341,
262,
18072,
21407,
0,
1779,
341,
286,
1711,
83,
25,
1881,
11,
400,
87,
96011,
11,
400,
88,
96011,
11,
400,
81,
96011,
8,
589,
314,
341,
310,
1077,
856,
25,
400,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_closed_reject() {
let s = socket();
assert_eq!(s.state, State::Closed);
let tcp_repr = TcpRepr {
control: TcpControl::Syn,
..SEND_TEMPL
};
assert!(!s.accepts(&SEND_IP_TEMPL, &tcp_repr));
} | rust_cleaned_test_functions.jsonl/1695 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 160
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44697,
1288,
583,
368,
341,
286,
1077,
274,
284,
7575,
543,
286,
2060,
10714,
10297,
82,
3467,
11,
3234,
486,
26884,
626,
286,
1077,
28051,
68535,
284,
64876,
693,
649,
341,
310,
2524,
25,
64876... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_match_shorthand() {
let res = expression(Span::new(r"match {y -> z;a -> n}"));
assert!(res.is_ok());
assert!(matches!(
res.unwrap().1,
Expr::Lambda(_x, x)
if matches!(x.clone().expr, Expr::Match(_x, _v))
));
} | rust_cleaned_test_functions.jsonl/32932 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10708,
3712,
61679,
368,
341,
262,
1077,
592,
284,
7493,
3759,
848,
486,
931,
2601,
1,
6347,
314,
88,
1464,
1147,
48222,
1464,
308,
92,
14929,
262,
2060,
10297,
416,
2079,
19817,
1423,
262,
2060... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_submit_exceed_max_rate() {
let writer = Arc::new(MockMetricsWriter::new());
let agent = MetricsAgent::new(writer.clone(), Duration::from_secs(1), 100);
for i in 0..102 {
agent.submit(
influxdb::Point::new(&format!("measurement {}", i)),
Level::Info,
);
}
thread::sleep(Duration::from_secs(2));
agent.flush();
assert_eq!(writer.points_written(), 100);
} | rust_cleaned_test_functions.jsonl/36626 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 244
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31674,
2702,
4635,
6345,
9246,
368,
341,
286,
1077,
6916,
284,
19689,
486,
931,
66436,
27328,
6492,
486,
931,
1423,
286,
1077,
8315,
284,
54190,
16810,
486,
931,
38356,
15997,
1507,
21045,
486,
14... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_checkout_remote_branch_leads_to_detached_head() -> BitResult<()> {
BitRepo::with_sample_repo(|repo| {
repo.create_branch(symbolic!("refs/remotes/origin/master"), BitRef::HEAD)?;
bit_checkout!(repo: "origin/master")?;
assert!(repo.is_head_detached()?);
Ok(())
})
} | rust_cleaned_test_functions.jsonl/62937 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 160
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68186,
36425,
28031,
11751,
7664,
2346,
24409,
3854,
13138,
368,
1464,
6495,
2077,
71698,
341,
262,
6495,
25243,
486,
4197,
17491,
37784,
22428,
23476,
91,
341,
286,
15867,
2520,
28031,
40723,
292,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_write_attrs() {
let str_from = r#"<source attr="val"></source>"#;
let expected = r#"<copy attr="val" a="b" c="d" x="y"z"></copy>"#;
let mut reader = Reader::from_str(str_from);
reader.trim_text(true);
let mut writer = Writer::new(Cursor::new(Vec::new()));
let mut buf = Vec::new();
loop {
let event = match reader.read_event(&mut buf) {
Ok(Eof) => break,
Ok(Start(elem)) => {
let mut attrs = elem.attributes().collect::<Result<Vec<_>>>().unwrap();
attrs.extend_from_slice(&[("a", "b").into(), ("c", "d").into()]);
let mut elem = BytesStart::owned(b"copy".to_vec(), 4);
elem.extend_attributes(attrs);
elem.push_attribute(("x", "y\"z"));
Start(elem)
}
Ok(End(_)) => End(BytesEnd::borrowed(b"copy")),
Ok(e) => e,
Err(e) => panic!(e),
};
assert!(writer.write_event(event).is_ok());
}
let result = writer.into_inner().into_inner();
assert_eq!(result, expected.as_bytes());
} | rust_cleaned_test_functions.jsonl/42082 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 578
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
39578,
368,
341,
262,
1077,
607,
5673,
284,
435,
2,
22476,
2427,
6376,
428,
831,
2000,
2427,
9877,
2,
280,
262,
1077,
3601,
284,
435,
2,
22476,
8560,
6376,
428,
831,
1,
264,
428,
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... | 2 |
#[test]
fn test_over_withdrawal() {
let mut eng = Engine::new();
eng.process_tx(Transaction::new(TxType::Deposit, 1, 1, 15));
eng.process_tx(Transaction::new(TxType::Withdrawal, 1, 1, 20));
let value = eng.accounts_iter().next().unwrap();
assert_eq!(value, &Account::new(1, 15, 0));
} | rust_cleaned_test_functions.jsonl/63619 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 130
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15431,
6615,
7633,
278,
368,
341,
262,
1077,
5206,
2922,
284,
8200,
486,
931,
543,
262,
2922,
16988,
17805,
76627,
486,
931,
4140,
87,
929,
486,
78982,
11,
220,
16,
11,
220,
16,
11,
220,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_normal() {
let nan: f64 = NAN;
let inf: f64 = INFINITY;
let neg_inf: f64 = NEG_INFINITY;
let zero: f64 = 0.0f64;
let neg_zero: f64 = -0.0;
assert!(!nan.is_normal());
assert!(!inf.is_normal());
assert!(!neg_inf.is_normal());
assert!(!zero.is_normal());
assert!(!neg_zero.is_normal());
assert!(1f64.is_normal());
assert!(1e-307f64.is_normal());
assert!(!1e-308f64.is_normal());
} | rust_cleaned_test_functions.jsonl/7823 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 281
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
13973,
368,
341,
286,
1077,
20021,
25,
282,
21,
19,
284,
92129,
280,
286,
1077,
4132,
25,
282,
21,
19,
284,
1964,
55990,
280,
286,
1077,
4184,
26051,
25,
282,
21,
19,
284,
84065,
91110,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unsigned_timestamp() {
let (bank, alice_keypair) = create_bank(10_000);
let bank_client = BankClient::new(bank);
let alice_pubkey = alice_keypair.pubkey();
// Initialize BudgetState
let budget_keypair = Keypair::new();
let budget_pubkey = budget_keypair.pubkey();
let bob_pubkey = solana_sdk::pubkey::new_rand();
let dt = Utc::now();
let instructions = budget_instruction::on_date(
&alice_pubkey,
&bob_pubkey,
&budget_pubkey,
dt,
&alice_pubkey,
None,
1,
);
let message = Message::new(&instructions, Some(&alice_pubkey));
bank_client
.send_and_confirm_message(&[&alice_keypair, &budget_keypair], message)
.unwrap();
// Attack! Part 1: Sign a timestamp transaction with a random key.
let mallory_keypair = Keypair::new();
let mallory_pubkey = mallory_keypair.pubkey();
bank_client
.transfer_and_confirm(1, &alice_keypair, &mallory_pubkey)
.unwrap();
let instruction =
budget_instruction::apply_timestamp(&mallory_pubkey, &budget_pubkey, &bob_pubkey, dt);
let mut message = Message::new(&[instruction], Some(&mallory_pubkey));
message.account_keys.insert(3, alice_pubkey);
message.instructions[0].accounts[0] = 3;
message.instructions[0].program_id_index = 4;
// Ensure the transaction fails because of the unsigned key.
assert_eq!(
bank_client
.send_and_confirm_message(&[&mallory_keypair], message)
.unwrap_err()
.unwrap(),
TransactionError::InstructionError(0, InstructionError::MissingRequiredSignature)
);
} | rust_cleaned_test_functions.jsonl/4054 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 894
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67830,
23073,
368,
341,
286,
1077,
320,
17033,
11,
70433,
3097,
12670,
8,
284,
1855,
35733,
7,
16,
15,
62,
15,
15,
15,
317,
286,
1077,
6073,
8179,
284,
8547,
2959,
486,
931,
1883,
1180,
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_debug_simple_value() {
let mut buf = ArrayString::<20>::new();
write!(&mut buf, "{:?}", Response::Connect(1)).expect("Can't write");
assert_eq!(&buf, "Connect(1)");
} | rust_cleaned_test_functions.jsonl/52042 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15446,
30015,
3142,
368,
341,
286,
1077,
5206,
6607,
284,
2910,
703,
27638,
17,
15,
6831,
931,
1428,
286,
3270,
0,
2099,
6984,
6607,
11,
13868,
25,
52652,
5949,
486,
14611,
7,
16,
4579,
17119,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_implicit_prelude() {
let _ = ::env_logger::try_init();
let text = r#"1.0 + 3.0 - 2.0"#;
let vm = make_vm();
vm.run_expr::<OpaqueValue<&Thread, Hole>>("<top>", text)
.unwrap_or_else(|err| panic!("{}", err));
} | rust_cleaned_test_functions.jsonl/8949 | {
"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,
62,
30940,
620,
85068,
368,
341,
262,
1077,
716,
284,
3504,
3160,
27413,
486,
1539,
6137,
543,
262,
1077,
1467,
284,
435,
55543,
16,
13,
15,
488,
220,
18,
13,
15,
481,
220,
17,
13,
15,
57676... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_provision_agent() {
init!("true");
let json_string = r#"{"agency_url":"https://enym-eagency.pdev.evernym.com","agency_did":"Ab8TvZa3Q19VNkQVzAWVL7","agency_verkey":"5LXaR43B1aQyeh94VBP8LG1Sgvjk7aNfqiksBCSjwqbf","wallet_name":"test_provision_agent","agent_seed":null,"enterprise_seed":null,"wallet_key":null}"#;
let c_json = CString::new(json_string).unwrap().into_raw();
let result = vcx_provision_agent(c_json);
check_useful_c_str!(result,());
assert!(result.len() > 0);
} | rust_cleaned_test_functions.jsonl/19367 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 264
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2540,
13013,
25730,
368,
341,
286,
2930,
17223,
1866,
3071,
286,
1077,
2951,
3904,
284,
435,
55543,
4913,
55565,
2903,
3252,
2428,
1110,
268,
1600,
5655,
55565,
556,
3583,
1734,
423,
48121,
905,
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_str_slicemut_rangetoinclusive_notok() {
let mut s = "abcαβγ".to_owned();
let s: &mut str = &mut s;
&mut s[..=3];
} | rust_cleaned_test_functions.jsonl/17606 | {
"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,
2895,
643,
415,
336,
332,
1710,
276,
455,
1961,
8336,
7913,
562,
368,
341,
262,
1077,
5206,
274,
284,
330,
13683,
18945,
51255,
59374,
3263,
983,
51973,
543,
262,
1077,
274,
25,
609,
6984,
607,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_filter_lit() {
// see https://github.com/pola-rs/polars/issues/790
// failed due to broadcasting filters and splitting threads.
let iter = (0..100).map(|i| ('A'..='Z').nth(i % 26).unwrap().to_string());
let a = Series::from_iter(iter);
let df = DataFrame::new([a].into()).unwrap();
let out = df.lazy().filter(lit(true)).collect().unwrap();
assert_eq!(out.shape(), (100, 1));
} | rust_cleaned_test_functions.jsonl/151 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 172
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8727,
98399,
368,
341,
262,
442,
1490,
3703,
1110,
5204,
905,
4322,
7924,
3795,
82,
4322,
26242,
38745,
14,
22,
24,
15,
198,
262,
442,
4641,
4152,
311,
48827,
13406,
323,
44373,
14564,
624,
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_servant_scope() -> Result<()> {
let url = TremorURL::parse("in")?;
assert_eq!(Scope::Servant, url.scope());
assert_eq!(None, url.resource_type());
assert_eq!(None, url.artefact());
Ok(())
} | rust_cleaned_test_functions.jsonl/100908 | {
"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,
44053,
517,
23199,
368,
1464,
5714,
71698,
341,
286,
1077,
2515,
284,
75163,
269,
3144,
486,
6400,
445,
258,
899,
37445,
286,
2060,
10714,
10297,
10803,
486,
39159,
517,
11,
2515,
48371,
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... | 2 |
#[test]
fn test_poly_rem() {
// dividend = -5 + x^2
let c1 = vec![
-FieldElement::from(5u64),
FieldElement::zero(),
FieldElement::one(),
];
let dividend = UnivarPolynomial(FieldElementVector::from(c1));
// divisor = 1 + x
let c2 = vec![FieldElement::one(), FieldElement::one()];
let divisor = UnivarPolynomial(FieldElementVector::from(c2));
let (quotient, remainder) = UnivarPolynomial::long_division(÷nd, &divisor);
// quotient = -1 + x
assert_eq!(quotient.degree(), 1);
assert_eq!(quotient[0], FieldElement::minus_one());
assert_eq!(quotient[1], FieldElement::one());
// remainder = -4
assert_eq!(remainder.degree(), 0);
assert_eq!(remainder[0], -FieldElement::from(4u64));
// dividend = 4 + 4x^2 + 2x^3 + x^5
let c1 = vec![
FieldElement::from(4u64),
FieldElement::zero(),
FieldElement::from(4u64),
FieldElement::from(2u64),
FieldElement::zero(),
FieldElement::one(),
];
let dividend = UnivarPolynomial(FieldElementVector::from(c1));
// divisor = 1 + x^2
let c2 = vec![
FieldElement::one(),
FieldElement::zero(),
FieldElement::one(),
];
let divisor = UnivarPolynomial(FieldElementVector::from(c2));
let (quotient, remainder) = UnivarPolynomial::long_division(÷nd, &divisor);
// quotient = 4 + x^3
assert_eq!(quotient.degree(), 3);
assert_eq!(quotient[0], FieldElement::from(4u64));
assert_eq!(quotient[1], FieldElement::one());
assert_eq!(quotient[2], FieldElement::zero());
assert_eq!(quotient[3], FieldElement::one());
assert_eq!(remainder.degree(), 1);
assert_eq!(remainder[0], FieldElement::zero());
assert_eq!(remainder[1], FieldElement::minus_one());
} | rust_cleaned_test_functions.jsonl/51313 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 977
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36133,
19194,
368,
341,
1789,
286,
442,
45880,
284,
481,
20,
488,
856,
61,
17,
198,
286,
1077,
272,
16,
284,
7486,
90515,
310,
481,
1877,
1691,
486,
1499,
7,
20,
84,
21,
19,
1326,
310,
8601,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dyn_builder() {
let mut cache = Cache::new();
let leaf1 = Blueprint::new(BuilderLeaf::new());
let leaf2 = Blueprint::new(BuilderLeaf::new());
let nodef1 = Blueprint::new(BuilderComplexNode::new_leaf(leaf1.clone()));
let nodef2 = Blueprint::new(BuilderComplexNode::new_leaf(leaf2.clone()));
let noden1 = Blueprint::new(BuilderComplexNode::new_nodes(nodef1.clone(), nodef2.clone()));
let artifact_node = cache.get(&noden1);
let noden1_unsized: DynamicBlueprint<ComplexNode> = noden1.clone().into();
assert_eq!(artifact_node, cache.get(&noden1_unsized));
// Try it again
assert_eq!(artifact_node, cache.get(&noden1_unsized));
} | rust_cleaned_test_functions.jsonl/130974 | {
"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,
69213,
28532,
368,
341,
10217,
5206,
6500,
284,
19479,
486,
931,
1428,
10217,
15933,
16,
284,
30003,
486,
931,
7,
3297,
31461,
486,
931,
1423,
10217,
15933,
17,
284,
30003,
486,
931,
7,
3297,
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_send_does_not_return_info_replies() {
let mut test_transport = TestTransport::new();
test_transport.push(Reply::Okay("0.4".to_string()));
let response = send(Command::GetVar(ClientVariable::Version), &mut test_transport);
assert!(!response.is_err());
assert_eq!(response.unwrap(), Reply::Okay("0.4".to_string()));
test_transport.push(Reply::Okay("0.4".to_string()));
test_transport.push(Reply::Info("Test".to_string()));
let response_with_info =
send(Command::GetVar(ClientVariable::Version), &mut test_transport);
assert!(!response_with_info.is_err());
assert_eq!(response_with_info.unwrap(), Reply::Okay("0.4".to_string()));
test_transport.push(Reply::Okay("0.4".to_string()));
for i in 0..10 {
test_transport.push(Reply::Info(format!("Test {}", i).to_string()));
}
let response_with_info =
send(Command::GetVar(ClientVariable::Version), &mut test_transport);
assert!(!response_with_info.is_err());
assert_eq!(response_with_info.unwrap(), Reply::Okay("0.4".to_string()));
} | rust_cleaned_test_functions.jsonl/78931 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 509
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13565,
96374,
7913,
12511,
3109,
1288,
7202,
368,
341,
286,
1077,
5206,
1273,
46398,
284,
3393,
27560,
486,
931,
543,
286,
1273,
46398,
2552,
7,
20841,
486,
32313,
445,
15,
13,
19,
3263,
983,
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... | 2 |
#[test]
fn test_init() {
let l = LOGGER.deref();
l.set_include_origin(false, true);
assert_eq!(l.show_line_numbers(), false);
l.set_include_origin(true, true)
.set_include_level(true)
.set_max_level(log::LevelFilter::Info);
assert_eq!(l.show_line_numbers(), true);
assert_eq!(l.show_file_path(), true);
assert_eq!(l.show_level(), true);
l.set_instance_id(TEST_INSTANCE_ID.to_string());
// Assert that the initial configuration works any number of times.
assert!(l.configure(Some(TEST_INSTANCE_ID.to_string())).is_ok());
assert!(l.configure(None).is_ok());
assert!(l.configure(Some(TEST_INSTANCE_ID.to_string())).is_ok());
info!("info");
warn!("warning");
error!("error");
// Assert that initialization works only once.
let log_file_temp =
TempFile::new().expect("Failed to create temporary output logging file.");
let log_file = String::from(log_file_temp.as_path().to_path_buf().to_str().unwrap());
l.set_instance_id(TEST_INSTANCE_ID.to_string());
assert!(l
.init(
TEST_APP_HEADER.to_string(),
Box::new(
OpenOptions::new()
.read(true)
.write(true)
.open(&log_file)
.unwrap()
),
)
.is_ok());
info!("info");
warn!("warning");
let log_file_temp2 = TempFile::new().unwrap();
assert!(l
.init(
TEST_APP_HEADER.to_string(),
Box::new(
OpenOptions::new()
.read(true)
.write(true)
.open(log_file_temp2.as_path())
.unwrap()
),
)
.is_err());
info!("info");
warn!("warning");
error!("error");
// Here we also test that the last initialization had no effect given that the
// logging system can only be initialized with byte-oriented sinks once per program.
validate_logs(
&log_file,
&[
("INFO", "info"),
("WARN", "warn"),
("INFO", "info"),
("WARN", "warn"),
("ERROR", "error"),
],
);
STATE.store(UNINITIALIZED, Ordering::SeqCst);
l.set_include_level(true).set_include_origin(false, false);
let error_metadata = MetadataBuilder::new().level(Level::Error).build();
let log_record = log::Record::builder().metadata(error_metadata).build();
Logger::log(&l, &log_record);
assert_eq!(l.show_level(), true);
assert_eq!(l.show_file_path(), false);
assert_eq!(l.show_line_numbers(), false);
l.set_include_level(false).set_include_origin(true, true);
let error_metadata = MetadataBuilder::new().level(Level::Info).build();
let log_record = log::Record::builder().metadata(error_metadata).build();
Logger::log(&l, &log_record);
assert_eq!(l.show_level(), false);
assert_eq!(l.show_file_path(), true);
assert_eq!(l.show_line_numbers(), true);
} | rust_cleaned_test_functions.jsonl/13480 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1741
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6137,
368,
341,
286,
1077,
326,
284,
28088,
950,
43970,
1428,
286,
326,
980,
37878,
34043,
3576,
11,
830,
317,
286,
2060,
10714,
10297,
75,
5460,
6528,
32964,
1507,
895,
626,
286,
326,
980,
3787... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_total_len_overflow() {
let mut bytes = vec![];
bytes.extend(&REPR_PACKET_BYTES[..]);
Packet::new(&mut bytes).set_payload_len(0x80);
assert_eq!(Packet::new_checked(&bytes).unwrap_err(),
Error::Truncated);
} | rust_cleaned_test_functions.jsonl/91036 | {
"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,
10784,
6043,
79073,
368,
341,
286,
1077,
5206,
5820,
284,
7486,
0,
15078,
286,
5820,
15831,
2099,
787,
6480,
40328,
40705,
95874,
2558,
286,
28889,
486,
931,
2099,
6984,
5820,
568,
746,
32813,
604... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_balls() {
assert_eq!(2, Solution::count_balls(1, 10));
assert_eq!(2, Solution::count_balls(5, 15));
assert_eq!(2, Solution::count_balls(19, 28));
assert_eq!(9, Solution::count_balls(11, 104));
} | rust_cleaned_test_functions.jsonl/74014 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3180,
880,
5583,
368,
341,
262,
2060,
10714,
10297,
17,
11,
12478,
486,
1830,
880,
5583,
7,
16,
11,
220,
16,
15,
1106,
262,
2060,
10714,
10297,
17,
11,
12478,
486,
1830,
880,
5583,
7,
20,
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_reconstruct_chinese() {
let analyzer = Analyzer::new(AnalyzerConfig::<Vec<u8>>::default());
let orig = "人人生而自由﹐在尊严和权利上一律平等。他们赋有理性和良心﹐并应以兄弟关系的精神互相对待。";
let tokens = analyzer.analyze(orig);
assert_eq!(orig, tokens.reconstruct().map(|(t, _)| t).collect::<String>());
} | rust_cleaned_test_functions.jsonl/125061 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 213
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
7596,
4138,
7346,
368,
341,
286,
1077,
54660,
284,
78705,
486,
931,
7,
54911,
2648,
27638,
10050,
34837,
23,
77595,
2258,
1423,
286,
1077,
2713,
284,
330,
17340,
101986,
68536,
101972,
123930,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pcapng_reader_be() {
let path = "assets/test001-be.pcapng";
let file = File::open(path).unwrap();
let buffered = BufReader::new(file);
let mut num_blocks = 0;
let mut reader = PcapNGReader::new(65536, buffered).expect("PcapNGReader");
let expected_origlen = &[0, 0, 314, 342, 314, 342];
loop {
match reader.next() {
Ok((offset, block)) => {
match block {
PcapBlockOwned::NG(Block::EnhancedPacket(epb)) => {
assert_eq!(expected_origlen[num_blocks], epb.origlen);
}
PcapBlockOwned::NG(_) => (),
PcapBlockOwned::LegacyHeader(_) | PcapBlockOwned::Legacy(_) => {
panic!("unexpected Legacy data")
}
}
num_blocks += 1;
reader.consume(offset);
}
Err(PcapError::Eof) => break,
Err(PcapError::Incomplete) => {
reader.refill().unwrap();
}
Err(e) => panic!("error while reading: {:?}", e),
}
}
assert_eq!(num_blocks, 6);
} | rust_cleaned_test_functions.jsonl/132440 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 650
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
11346,
968,
22306,
21263,
368,
341,
262,
1077,
1815,
284,
330,
5160,
12697,
15,
15,
16,
15150,
556,
11346,
968,
876,
262,
1077,
1034,
284,
2887,
486,
2508,
5581,
568,
15454,
543,
262,
1077,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_new_data_payload_is_none_if_bytes_too_short() {
let bytes = &[0x04, 0x03, 0x02, 0x01, 0x00, 0xff];
let bytes_with_fopts = &[0x04, 0x03, 0x02, 0x01, 0x01, 0xff, 0x04];
assert!(DataPayload::new(bytes, true).is_none());
assert!(DataPayload::new(bytes_with_fopts, true).is_none());
} | rust_cleaned_test_functions.jsonl/81589 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 158
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
1769,
32813,
6892,
31488,
11119,
12524,
2346,
78,
16673,
368,
341,
262,
1077,
5820,
284,
44590,
15,
87,
15,
19,
11,
220,
15,
87,
15,
18,
11,
220,
15,
87,
15,
17,
11,
220,
15,
87,
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_read_to_string() {
let path = "Cargo.toml";
let size = std::fs::metadata(&path).unwrap().len() as usize;
assert_eq!(size, read_to_string(&path, size).unwrap().len());
assert_eq!(
io::ErrorKind::InvalidData,
read_to_string(&path, size - 1).unwrap_err().kind()
);
} | rust_cleaned_test_functions.jsonl/90056 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 175
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
2346,
3904,
368,
341,
286,
1077,
1815,
284,
330,
98228,
73494,
75,
876,
286,
1077,
1379,
284,
1460,
486,
3848,
486,
17637,
2099,
2343,
568,
15454,
1005,
2892,
368,
438,
22301,
401,
286,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_metadata_serialize_deserialize() {
let data_1 = r#"
{
"$maxCount": 42,
"$acl" : {
"$w" : "greg",
"$r" : ["greg", "john"]
}
}"#;
let expected_acl_1 = super::StreamAclInternal {
write_roles: super::Roles::from_string("greg".to_string()),
read_roles: super::Roles(Some(vec!["greg".to_string(), "john".to_string()])),
delete_roles: super::Roles(None),
meta_read_roles: super::Roles(None),
meta_write_roles: super::Roles(None),
};
let expected_metadata_1 = super::StreamMetadataInternal {
max_count: Some(42),
max_age: None,
truncate_before: None,
cache_control: None,
acl: expected_acl_1,
custom_properties: std::collections::HashMap::new(),
};
let metadata: super::StreamMetadataInternal = serde_json::from_str(data_1).unwrap();
compare_metadata(expected_metadata_1, metadata);
} | rust_cleaned_test_functions.jsonl/62934 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 576
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22220,
88686,
15768,
9050,
368,
341,
286,
1077,
821,
62,
16,
284,
435,
2,
698,
310,
341,
2290,
5201,
2810,
2507,
788,
220,
19,
17,
345,
2290,
5201,
47736,
1,
549,
341,
1698,
5201,
86,
1,
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_byte_stream() {
assert_eq!(
Ok(BytesStruct {
small: vec![1, 2],
large: vec![1, 2, 3, 4]
}),
from_str("BytesStruct( small:[1, 2], large:\"AQIDBA==\" )"),
);
} | rust_cleaned_test_functions.jsonl/1670 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19737,
12673,
368,
341,
262,
2060,
10714,
33673,
286,
7622,
76423,
9422,
341,
310,
2613,
25,
7486,
20703,
16,
11,
220,
17,
1259,
310,
3460,
25,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
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_split_minimum_stake_delegation() {
let feature_set = FeatureSet::all_enabled();
let minimum_delegation = crate::get_minimum_delegation(&feature_set);
let rent = Rent::default();
let rent_exempt_reserve = rent.minimum_balance(StakeState::size_of());
let source_address = Pubkey::new_unique();
let source_meta = Meta {
rent_exempt_reserve,
..Meta::auto(&source_address)
};
let dest_address = Pubkey::new_unique();
let dest_account = AccountSharedData::new_data_with_space(
0,
&StakeState::Uninitialized,
StakeState::size_of(),
&id(),
)
.unwrap();
let instruction_accounts = vec![
AccountMeta {
pubkey: source_address,
is_signer: true,
is_writable: false,
},
AccountMeta {
pubkey: dest_address,
is_signer: false,
is_writable: false,
},
];
for (source_stake_delegation, dest_stake_delegation, expected_result) in [
(minimum_delegation, minimum_delegation, Ok(())),
(
minimum_delegation,
minimum_delegation - 1,
Err(InstructionError::InsufficientFunds),
),
(
minimum_delegation - 1,
minimum_delegation,
Err(InstructionError::InsufficientFunds),
),
(
minimum_delegation - 1,
minimum_delegation - 1,
Err(InstructionError::InsufficientFunds),
),
] {
// The source account's starting balance is equal to *both* the source and dest
// accounts' *final* balance
let source_starting_balance =
source_stake_delegation + dest_stake_delegation + rent_exempt_reserve * 2;
for source_stake_state in &[
StakeState::Initialized(source_meta),
just_stake(source_meta, source_starting_balance - rent_exempt_reserve),
] {
let source_account = AccountSharedData::new_data_with_space(
source_starting_balance,
source_stake_state,
StakeState::size_of(),
&id(),
)
.unwrap();
process_instruction(
&serialize(&StakeInstruction::Split(
dest_stake_delegation + rent_exempt_reserve,
))
.unwrap(),
vec![
(source_address, source_account),
(dest_address, dest_account.clone()),
(
sysvar::rent::id(),
account::create_account_shared_data_for_test(&rent),
),
],
instruction_accounts.clone(),
expected_result.clone(),
);
}
}
} | rust_cleaned_test_functions.jsonl/31650 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1793
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
84855,
1261,
726,
2259,
87566,
368,
341,
286,
1077,
4565,
2602,
284,
19998,
1649,
486,
541,
18220,
543,
286,
1077,
8028,
2259,
87566,
284,
17717,
486,
455,
84855,
2259,
87566,
2099,
12753,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_conflict_check_out() {
let check_flags = ["-c=silent", "-c=quiet", "-c=diagnose-first", "-c", "-C"];
for check_flag in &check_flags {
new_ucmd!()
.arg(check_flag)
.arg("-o=/dev/null")
.fails()
.stderr_contains(
"error: The argument '--output <FILENAME>' cannot be used with '--check",
);
}
} | rust_cleaned_test_functions.jsonl/83007 | {
"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,
16059,
21242,
7200,
6068,
368,
341,
262,
1077,
1779,
14130,
284,
4383,
12,
66,
14149,
68414,
497,
6523,
66,
28,
43650,
497,
6523,
66,
28,
8579,
3246,
960,
36943,
497,
6523,
66,
497,
6523,
34,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_ln_pmf() {
let ln_pmf = |arg: u64| move |x: Binomial| x.ln_pmf(arg);
test_case(0.0, 1, 0.0, ln_pmf(0));
test_case(0.0, 1, f64::NEG_INFINITY, ln_pmf(1));
test_case(0.0, 3, 0.0, ln_pmf(0));
test_case(0.0, 3, f64::NEG_INFINITY, ln_pmf(1));
test_case(0.0, 3, f64::NEG_INFINITY, ln_pmf(3));
test_case(0.0, 10, 0.0, ln_pmf(0));
test_case(0.0, 10, f64::NEG_INFINITY, ln_pmf(1));
test_case(0.0, 10, f64::NEG_INFINITY, ln_pmf(10));
test_case(0.3, 1, -0.3566749439387324423539544041072745145718090708995, ln_pmf(0));
test_case(0.3, 1, -1.2039728043259360296301803719337238685164245381839, ln_pmf(1));
test_case(0.3, 3, -1.0700248318161973270618632123218235437154272126985, ln_pmf(0));
test_almost(0.3, 3, -0.81871040353529122294284394322574719301255212216016, 1e-15, ln_pmf(1));
test_almost(0.3, 3, -3.6119184129778080888905411158011716055492736145517, 1e-15, ln_pmf(3));
test_case(0.3, 10, -3.566749439387324423539544041072745145718090708995, ln_pmf(0));
test_almost(0.3, 10, -2.1114622067804823267977785542148302920616046876506, 1e-14, ln_pmf(1));
test_case(0.3, 10, -12.039728043259360296301803719337238685164245381839, ln_pmf(10));
test_case(1.0, 1, f64::NEG_INFINITY, ln_pmf(0));
test_case(1.0, 1, 0.0, ln_pmf(1));
test_case(1.0, 3, f64::NEG_INFINITY, ln_pmf(0));
test_case(1.0, 3, f64::NEG_INFINITY, ln_pmf(1));
test_case(1.0, 3, 0.0, ln_pmf(3));
test_case(1.0, 10, f64::NEG_INFINITY, ln_pmf(0));
test_case(1.0, 10, f64::NEG_INFINITY, ln_pmf(1));
test_case(1.0, 10, 0.0, ln_pmf(10));
} | rust_cleaned_test_functions.jsonl/114733 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1030
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60401,
620,
28124,
368,
341,
286,
1077,
29390,
620,
28124,
284,
760,
858,
25,
575,
21,
19,
91,
3271,
760,
87,
25,
29344,
20855,
91,
856,
918,
77,
620,
28124,
9404,
317,
286,
1273,
19096,
7,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_intersection() {
assert_eq!(
intersection(xy(0, 0), xy(1, 1), xy(1, 0), xy(2, 2)),
LineIntersection::None
);
assert_eq!(
intersection(xy(0, 0), xy(1, 1), xy(1, 0), xy(10, 2)),
LineIntersection::None
);
assert_eq!(
intersection(xy(2, 2), xy(3, 3), xy(0, 6), xy(2, 4)),
LineIntersection::None
);
assert_eq!(
intersection(xy(0, 0), xy(1, 1), xy(1, 0), xy(0, 1)),
LineIntersection::Point(xy(0.5, 0.5))
);
assert_eq!(
intersection(xy(0, 0), xy(1, 1), xy(0, 1), xy(0, 0)),
LineIntersection::Point(xy(0, 0))
);
assert_eq!(
intersection(xy(0, 0), xy(1, 1), xy(0, 1), xy(1, 1)),
LineIntersection::Point(xy(1, 1))
);
assert_eq!(
intersection(xy(0, 0), xy(1, 1), xy(0.5, 0.5), xy(1, 0)),
LineIntersection::Point(xy(0.5, 0.5))
);
assert_eq!(
intersection(xy(0, 0), xy(10, 10), xy(1, 1), xy(5, 5)),
LineIntersection::Overlap(xy(1, 1), xy(5, 5))
);
assert_eq!(
intersection(xy(1, 1), xy(10, 10), xy(1, 1), xy(5, 5)),
LineIntersection::Overlap(xy(1, 1), xy(5, 5))
);
assert_eq!(
intersection(xy(3, 3), xy(10, 10), xy(0, 0), xy(5, 5)),
LineIntersection::Overlap(xy(3, 3), xy(5, 5))
);
assert_eq!(
intersection(xy(0, 0), xy(1, 1), xy(0, 0), xy(1, 1)),
LineIntersection::Overlap(xy(0, 0), xy(1, 1))
);
assert_eq!(
intersection(xy(1, 1), xy(0, 0), xy(0, 0), xy(1, 1)),
LineIntersection::Overlap(xy(1, 1), xy(0, 0))
);
assert_eq!(
intersection(xy(0, 0), xy(1, 1), xy(1, 1), xy(2, 2)),
LineIntersection::Point(xy(1, 1))
);
assert_eq!(
intersection(xy(1, 1), xy(0, 0), xy(1, 1), xy(2, 2)),
LineIntersection::Point(xy(1, 1))
);
assert_eq!(
intersection(xy(0, 0), xy(1, 1), xy(2, 2), xy(4, 4)),
LineIntersection::None
);
assert_eq!(
intersection(xy(0, 0), xy(1, 1), xy(0, -1), xy(1, 0)),
LineIntersection::None
);
assert_eq!(
intersection(xy(1, 1), xy(0, 0), xy(0, -1), xy(1, 0)),
LineIntersection::None
);
assert_eq!(
intersection(xy(0, -1), xy(1, 0), xy(0, 0), xy(1, 1)),
LineIntersection::None
);
assert_eq!(
intersection(xy(0, 0.5), xy(1, 1.5), xy(0, 1), xy(1, 0)),
LineIntersection::Point(xy(0.25, 0.75))
);
} | rust_cleaned_test_functions.jsonl/18322 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1690
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82558,
368,
341,
286,
2060,
10714,
33673,
310,
19246,
93219,
7,
15,
11,
220,
15,
701,
30784,
7,
16,
11,
220,
16,
701,
30784,
7,
16,
11,
220,
15,
701,
30784,
7,
17,
11,
220,
17,
6965,
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_unified_diff() {
let diff = TextDiff::from_lines(
"Hello World\nsome stuff here\nsome more stuff here\n",
"Hello World\nsome amazing stuff here\nsome more stuff here\n",
);
assert_eq!(diff.newline_terminated(), true);
insta::assert_snapshot!(&diff
.unified_diff()
.context_radius(3)
.header("old", "new")
.to_string());
} | rust_cleaned_test_functions.jsonl/83750 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 183
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
1870,
15850,
368,
341,
262,
1077,
3638,
284,
2918,
21751,
486,
1499,
18323,
1006,
286,
330,
9707,
4337,
1699,
14689,
6259,
1588,
1699,
14689,
803,
6259,
1588,
1699,
756,
286,
330,
9707,
4337... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iterate() {
let path = TempDir::new("test-raftstore").unwrap();
let engine = new_temp_engine(&path);
let (store, base_data) = load_default_dataset(engine.clone());
let snap = RegionSnapshot::new(&store);
let mut data = vec![];
snap.scan(b"a2",
&[0xFF, 0xFF],
false,
&mut |key, value| {
data.push((key.to_vec(), value.to_vec()));
Ok(true)
})
.unwrap();
assert_eq!(data.len(), 2);
assert_eq!(data, &base_data[1..3]);
let mut iter = snap.iter(None, true);
assert!(iter.seek(b"a1").is_err());
assert!(iter.seek(b"a2").unwrap());
assert_eq!(iter.key(), b"a3");
assert_eq!(iter.value(), b"v3");
assert!(!iter.seek(b"a6").unwrap());
assert!(!iter.seek(b"a7").unwrap());
assert!(iter.seek(b"a8").is_err());
data.clear();
snap.scan(b"a2",
&[0xFF, 0xFF],
false,
&mut |key, value| {
data.push((key.to_vec(), value.to_vec()));
Ok(false)
})
.unwrap();
assert_eq!(data.len(), 1);
assert!(iter.seek_to_first());
let mut res = vec![];
loop {
res.push((iter.key().to_vec(), iter.value().to_vec()));
if !iter.next() {
break;
}
}
assert_eq!(res, base_data[1..3].to_vec());
// test last region
let mut region = Region::new();
region.mut_peers().push(Peer::new());
let store = new_peer_storage(engine.clone(), ®ion);
let snap = RegionSnapshot::new(&store);
data.clear();
snap.scan(b"",
&[0xFF, 0xFF],
false,
&mut |key, value| {
data.push((key.to_vec(), value.to_vec()));
Ok(true)
})
.unwrap();
assert_eq!(data.len(), 4);
assert_eq!(data, base_data);
let mut iter = snap.iter(None, true);
assert!(iter.seek(b"a1").unwrap());
assert!(iter.seek_to_first());
let mut res = vec![];
loop {
res.push((iter.key().to_vec(), iter.value().to_vec()));
if !iter.next() {
break;
}
}
assert_eq!(res, base_data);
// test iterator with upper bound
let store = new_peer_storage(engine.clone(), ®ion);
let snap = RegionSnapshot::new(&store);
let mut iter = snap.iter(Some(b"a5"), true);
assert!(iter.seek_to_first());
let mut res = vec![];
loop {
res.push((iter.key().to_vec(), iter.value().to_vec()));
if !iter.next() {
break;
}
}
assert_eq!(res, base_data[0..2].to_vec());
} | rust_cleaned_test_functions.jsonl/37248 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1710
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
349,
368,
341,
286,
1077,
1815,
284,
19944,
6184,
486,
931,
445,
1944,
12,
2944,
4314,
1827,
15454,
543,
286,
1077,
4712,
284,
501,
11771,
24823,
2099,
2343,
317,
286,
1077,
320,
4314,
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... | 4 |
#[test]
fn test_single_psk_mod() {
let p: NoiseParams = "Noise_XXpsk0_25519_AESGCM_SHA256".parse().unwrap();
match p.handshake.modifiers.list[0] {
HandshakeModifier::Psk(0) => {},
_ => panic!("modifier isn't as expected!")
}
} | rust_cleaned_test_functions.jsonl/14550 | {
"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,
19487,
620,
4886,
7480,
368,
341,
286,
1077,
281,
25,
50523,
4870,
284,
330,
61819,
62,
6148,
1690,
74,
15,
62,
17,
20,
20,
16,
24,
69381,
38,
9985,
38096,
17,
20,
21,
3263,
6400,
1005,
1545... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_requests() {
let unit_json = json!(null);
let project_id = Uuid::default();
let missing_component_action = MissingComponentAction::Install;
let engine_version = "1.0.0".to_owned();
let engine_version_opt = Some(engine_version.clone());
let create_project_response = response::CreateProject { project_id };
let project_id_json = json!({"projectId":"00000000-0000-0000-0000-000000000000"});
let project_id_and_mca = json!({
"projectId" : "00000000-0000-0000-0000-000000000000",
"missingComponentAction" : "Install"
});
let engine_version = "0.2.1".to_owned();
let language_server_json_address = IpWithSocket{host:"localhost".to_string(),port:27015};
let language_server_binary_address = IpWithSocket{host:"localhost".to_string(),port:27016};
let project_name = ProjectName::new("Test");
let project_namespace = "test_ns".to_owned();
let open_result = response::OpenProject {engine_version
,language_server_json_address,language_server_binary_address,project_name
,project_namespace};
let open_result_json = json!({
"engineVersion" : "0.2.1",
"languageServerJsonAddress" : {
"host" : "localhost",
"port" : 27015
},
"languageServerBinaryAddress" : {
"host" : "localhost",
"port" : 27016
},
"projectName" : "Test",
"projectNamespace" : "test_ns",
});
let project_name = String::from("HelloWorld");
let project_create_json = json!({
"name" : serde_json::to_value(&project_name).unwrap(),
"missingComponentAction" : "Install",
"version" : "1.0.0",
});
let number_of_projects = 2;
let number_of_projects_json = json!({"numberOfProjects":number_of_projects});
let num_projects_json = json!({"numProjects":number_of_projects});
let project1 = ProjectMetadata {
name : ProjectName::new("project1"),
id : Uuid::default(),
last_opened : Some(DateTime::parse_from_rfc3339("2020-01-07T21:25:26Z").unwrap()),
engine_version : Some("0.2.21".to_owned()),
namespace : "local".to_owned(),
};
let project2 = ProjectMetadata {
name : ProjectName::new("project2"),
id : Uuid::default(),
last_opened : Some(DateTime::parse_from_rfc3339("2020-02-02T13:15:20Z").unwrap()),
engine_version : Some("0.2.22".to_owned()),
namespace : "local".to_owned(),
};
let project_list = response::ProjectList { projects : vec![project1,project2] };
let project_list_json = json!({
"projects" : [
{
"id" : "00000000-0000-0000-0000-000000000000",
"lastOpened" : "2020-01-07T21:25:26+00:00",
"name" : "project1",
"engineVersion" : "0.2.21",
"namespace" : "local"
},
{
"id" : "00000000-0000-0000-0000-000000000000",
"lastOpened" : "2020-02-02T13:15:20+00:00",
"name" : "project2",
"engineVersion" : "0.2.22",
"namespace" : "local"
}
]
});
test_request(
|client| client.list_projects(&Some(number_of_projects)),
"project/list",
&number_of_projects_json,
&project_list_json,
&project_list
);
test_request(
|client| client.list_samples(&number_of_projects),
"project/listSample",
&num_projects_json,
&project_list_json,
&project_list
);
test_request(
|client| client.open_project(&project_id,&missing_component_action),
"project/open",
&project_id_and_mca,
&open_result_json,
&open_result
);
test_request(
|client| client.close_project(&project_id),
"project/close",
&project_id_json,
&unit_json,
&()
);
test_request(
|client| client.delete_project(&project_id),
"project/delete",
&project_id_json,
&unit_json,
&()
);
test_request(
|client| client.create_project(&project_name,&engine_version_opt,&missing_component_action),
"project/create",
&project_create_json,
&project_id_json,
&create_project_response
);
} | rust_cleaned_test_functions.jsonl/79613 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2803
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37216,
368,
341,
286,
1077,
4982,
9455,
394,
284,
2951,
10297,
2921,
317,
286,
1077,
2390,
842,
2290,
284,
547,
2423,
486,
2258,
543,
286,
1077,
7402,
23406,
7931,
284,
35264,
2189,
2512,
486,
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_to_bytes() {
let mut bv = BitVec::from_elem(3, true);
bv.set(1, false);
assert_eq!(bv.to_bytes(), [0b10100000]);
let mut bv = BitVec::from_elem(9, false);
bv.set(2, true);
bv.set(8, true);
assert_eq!(bv.to_bytes(), [0b00100000, 0b10000000]);
} | rust_cleaned_test_functions.jsonl/62087 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
12524,
368,
341,
286,
1077,
5206,
56937,
284,
6495,
10050,
486,
1499,
28179,
7,
18,
11,
830,
317,
286,
56937,
980,
7,
16,
11,
895,
317,
286,
2060,
10714,
10297,
54929,
2389,
12524,
1507,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tcp() {
let server = TcpListener::bind("127.0.0.1:0").unwrap();
let server_addr = server.local_addr().unwrap();
let client = TcpStream::connect(server_addr).unwrap();
let client_addr = client.local_addr().unwrap();
let mut session = session::test::Fake::new();
let request = Request { listening_only: false };
assert!(handle(&mut session, request).is_ok());
let our_pid = std::process::id();
// We must get two responses for the server here: one for the
// listening server socket and one for the temporary connection
// between the client and the server
let server_resp = find_responses_by_addr(&session, server_addr);
assert_eq!(server_resp.len(), 2);
let listen_resp;
let connection_resp;
if get_tcp_state(&server_resp[0]) == TcpState::Listen {
listen_resp = server_resp[0];
connection_resp = server_resp[1];
} else {
assert_eq!(get_tcp_state(&server_resp[1]), TcpState::Listen);
listen_resp = server_resp[1];
connection_resp = server_resp[0];
}
// least on Linux and it's unclear whether PID is set on other systems.
assert_eq!(listen_resp.process_info.as_ref().unwrap().pid, our_pid);
let connection_socket = extract_tcp_info(&connection_resp);
// the connections.
assert_eq!(connection_socket.remote_addr, client_addr.ip());
assert_eq!(connection_socket.remote_port, client_addr.port());
assert_eq!(connection_socket.state, TcpState::Established);
let client_resp = find_responses_by_addr(&session, client_addr);
assert_eq!(client_resp.len(), 1);
let client_resp = client_resp[0];
assert_eq!(client_resp.process_info.as_ref().unwrap().pid, our_pid);
let client_socket = extract_tcp_info(&client_resp);
// to find the connection.
assert_eq!(client_socket.remote_addr, server_addr.ip());
assert_eq!(client_socket.remote_port, server_addr.port());
assert_eq!(client_socket.state, TcpState::Established);
} | rust_cleaned_test_functions.jsonl/90993 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 926
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45562,
368,
341,
286,
1077,
3538,
284,
64876,
2743,
486,
7666,
445,
16,
17,
22,
13,
15,
13,
15,
13,
16,
25,
15,
1827,
15454,
543,
286,
1077,
3538,
7387,
284,
3538,
11033,
7387,
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_block_segment_postings() {
let mut block_segments = build_block_postings(&(0..100_000).collect::<Vec<u32>>());
let mut offset: u32 = 0u32;
// checking that the block before calling advance is empty
assert!(block_segments.docs().is_empty());
// checking that the `doc_freq` is correct
assert_eq!(block_segments.doc_freq(), 100_000);
while let Some(block) = block_segments.next() {
for (i, doc) in block.iter().cloned().enumerate() {
assert_eq!(offset + (i as u32), doc);
}
offset += block.len() as u32;
}
} | rust_cleaned_test_functions.jsonl/279 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 302
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7113,
28061,
6333,
819,
368,
341,
286,
1077,
5206,
2504,
55735,
284,
1936,
7113,
6333,
819,
29089,
15,
496,
16,
15,
15,
62,
15,
15,
15,
568,
17384,
27638,
10050,
34837,
18,
17,
2452,
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... | 3 |
#[test]
fn test_mul() {
let a = BalancedTernary::from(45);
let b = BalancedTernary::from(20);
let c = BalancedTernary::from(-20);
assert_eq!(i128::try_from(a.clone() * b), Ok(900));
assert_eq!(i128::try_from(c * a), Ok(-900));
} | rust_cleaned_test_functions.jsonl/73621 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24944,
368,
341,
286,
1077,
264,
284,
97109,
51,
932,
658,
486,
1499,
7,
19,
20,
317,
286,
1077,
293,
284,
97109,
51,
932,
658,
486,
1499,
7,
17,
15,
317,
286,
1077,
272,
284,
97109,
51,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_assemble_chunk_columns() {
let lifecycle_action = None;
let sort = SortKey::from_columns(vec!["c2", "c1"]);
let summaries = vec![
(
Arc::new(TableSummary {
name: "t1".to_string(),
columns: vec![
ColumnSummary {
name: "c1".to_string(),
influxdb_type: Some(InfluxDbType::Field),
stats: Statistics::String(StatValues::new_with_distinct(
Some("bar".to_string()),
Some("foo".to_string()),
55,
0,
Some(NonZeroU64::new(23).unwrap()),
)),
},
ColumnSummary {
name: "c2".to_string(),
influxdb_type: Some(InfluxDbType::Field),
stats: Statistics::F64(StatValues::new(Some(11.0), Some(43.0), 66, 0)),
},
],
}),
DetailedChunkSummary {
inner: ChunkSummary {
partition_key: "p1".into(),
table_name: "t1".into(),
id: ChunkId::new_test(42),
storage: ChunkStorage::ReadBuffer,
lifecycle_action,
memory_bytes: 23754,
object_store_bytes: 0,
row_count: 11,
time_of_last_access: None,
time_of_first_write: Time::from_timestamp_nanos(1),
time_of_last_write: Time::from_timestamp_nanos(2),
order: ChunkOrder::new(5).unwrap(),
},
columns: vec![
ChunkColumnSummary {
name: "c1".into(),
memory_bytes: 11,
},
ChunkColumnSummary {
name: "c2".into(),
memory_bytes: 12,
},
],
},
Some(sort),
),
(
Arc::new(TableSummary {
name: "t1".to_string(),
columns: vec![ColumnSummary {
name: "c1".to_string(),
influxdb_type: Some(InfluxDbType::Field),
stats: Statistics::F64(StatValues::new(Some(110.0), Some(430.0), 667, 99)),
}],
}),
DetailedChunkSummary {
inner: ChunkSummary {
partition_key: "p2".into(),
table_name: "t1".into(),
id: ChunkId::new_test(43),
storage: ChunkStorage::OpenMutableBuffer,
lifecycle_action,
memory_bytes: 23754,
object_store_bytes: 0,
row_count: 11,
time_of_last_access: None,
time_of_first_write: Time::from_timestamp_nanos(1),
time_of_last_write: Time::from_timestamp_nanos(2),
order: ChunkOrder::new(6).unwrap(),
},
columns: vec![ChunkColumnSummary {
name: "c1".into(),
memory_bytes: 100,
}],
},
None,
),
(
Arc::new(TableSummary {
name: "t2".to_string(),
columns: vec![ColumnSummary {
name: "c3".to_string(),
influxdb_type: Some(InfluxDbType::Field),
stats: Statistics::F64(StatValues::new(Some(-1.0), Some(2.0), 4, 0)),
}],
}),
DetailedChunkSummary {
inner: ChunkSummary {
partition_key: "p2".into(),
table_name: "t2".into(),
id: ChunkId::new_test(44),
storage: ChunkStorage::OpenMutableBuffer,
lifecycle_action,
memory_bytes: 23754,
object_store_bytes: 0,
row_count: 11,
time_of_last_access: None,
time_of_first_write: Time::from_timestamp_nanos(1),
time_of_last_write: Time::from_timestamp_nanos(2),
order: ChunkOrder::new(5).unwrap(),
},
columns: vec![ChunkColumnSummary {
name: "c3".into(),
memory_bytes: 200,
}],
},
None,
),
];
let expected = vec![
"+---------------+--------------------------------------+------------+-------------+-------------------+-----------+------------+-----------+-----------+--------------+-------------+--------------+----------------+",
"| partition_key | chunk_id | table_name | column_name | storage | row_count | null_count | min_value | max_value | memory_bytes | chunk_order | sort_ordinal | distinct_count |",
"+---------------+--------------------------------------+------------+-------------+-------------------+-----------+------------+-----------+-----------+--------------+-------------+--------------+----------------+",
"| p1 | 00000000-0000-0000-0000-00000000002a | t1 | c1 | ReadBuffer | 55 | 0 | bar | foo | 11 | 5 | 1 | 23 |",
"| p1 | 00000000-0000-0000-0000-00000000002a | t1 | c2 | ReadBuffer | 66 | 0 | 11 | 43 | 12 | 5 | 0 | |",
"| p2 | 00000000-0000-0000-0000-00000000002b | t1 | c1 | OpenMutableBuffer | 667 | 99 | 110 | 430 | 100 | 6 | | |",
"| p2 | 00000000-0000-0000-0000-00000000002c | t2 | c3 | OpenMutableBuffer | 4 | 0 | -1 | 2 | 200 | 5 | | |",
"+---------------+--------------------------------------+------------+-------------+-------------------+-----------+------------+-----------+-----------+--------------+-------------+--------------+----------------+",
];
let batch = assemble_chunk_columns(chunk_columns_schema(), summaries).unwrap();
assert_batches_eq!(&expected, &[batch]);
} | rust_cleaned_test_functions.jsonl/94371 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 4425
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
15790,
30539,
22590,
368,
341,
286,
1077,
47508,
7931,
284,
2240,
401,
286,
1077,
3378,
284,
15967,
1592,
486,
1499,
22590,
25592,
0,
1183,
66,
17,
497,
330,
66,
16,
55919,
286,
1077,
689... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_str_as_int() {
let cases = vec![
(
FieldTypeFlag::empty(),
vec![Datum::Bytes(b"18446744073709551615".to_vec())],
u64::MAX as i64,
1,
),
(
FieldTypeFlag::UNSIGNED,
vec![Datum::Bytes(b"18446744073709551615".to_vec())],
u64::MAX as i64,
0,
),
(
FieldTypeFlag::UNSIGNED,
vec![Datum::Bytes(b"-1".to_vec())],
-1,
1,
),
];
for (flag, cols, exp, warnings_cnt) in cases {
let col_expr = col_expr(0, FieldTypeTp::String);
let mut ex = scalar_func_expr(ScalarFuncSig::CastStringAsInt, &[col_expr]);
ex.mut_field_type().as_mut_accessor().set_flag(flag);
let mut ctx = EvalContext::new(Arc::new(EvalConfig::default()));
let e = Expression::build(&ctx, ex.clone()).unwrap();
let res = e.eval_int(&mut ctx, &cols).unwrap().unwrap();
assert_eq!(res, exp);
assert_eq!(
ctx.warnings.warning_cnt, warnings_cnt,
"unexpected warning: {:?}",
ctx.warnings.warnings
);
if warnings_cnt > 0 {
assert_eq!(
ctx.warnings.warnings[0].get_code(),
ERR_UNKNOWN,
"unexpected warning: {:?}",
ctx.warnings.warnings
);
}
}
let cases = vec![
(
vec![Datum::Bytes(b"-9223372036854775810".to_vec())],
i64::MIN,
FieldTypeFlag::empty(),
),
(
vec![Datum::Bytes(b"18446744073709551616".to_vec())],
u64::MAX as i64,
FieldTypeFlag::UNSIGNED,
),
];
for (cols, exp, flag) in cases {
let col_expr = col_expr(0, FieldTypeTp::String);
let mut ex = scalar_func_expr(ScalarFuncSig::CastStringAsInt, &[col_expr]);
ex.mut_field_type().as_mut_accessor().set_flag(flag);
let mut cfg = EvalConfig::new();
cfg.set_flag(Flag::OVERFLOW_AS_WARNING | Flag::IN_SELECT_STMT);
let mut ctx = EvalContext::new(Arc::new(cfg));
let e = Expression::build(&ctx, ex.clone()).unwrap();
let res = e.eval_int(&mut ctx, &cols).unwrap().unwrap();
assert_eq!(res, exp);
assert_eq!(
ctx.warnings.warning_cnt, 1,
"unexpected warning: {:?}",
ctx.warnings.warnings
);
assert_eq!(
ctx.warnings.warnings[0].get_code(),
ERR_DATA_OUT_OF_RANGE,
"unexpected warning: {:?}",
ctx.warnings.warnings
);
// test overflow as error
ctx = EvalContext::new(Arc::new(EvalConfig::default()));
let e = Expression::build(&ctx, ex).unwrap();
let res = e.eval_int(&mut ctx, &cols);
assert!(res.is_err());
}
} | rust_cleaned_test_functions.jsonl/12067 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1928
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2895,
11898,
4042,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
2399,
394,
84614,
12135,
486,
3194,
3148,
394,
7486,
20703,
68036,
486,
7078,
1883,
1,
16,
23,
19,
19,
21,
22,
19,
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... | 4 |
#[test]
fn test_parse_valid_redshift_create_cluster_snapshot() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/valid",
"redshift-create-cluster-snapshot.xml",
);
let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
let client = RedshiftClient::new(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = CreateClusterSnapshotMessage::default();
let result = client.create_cluster_snapshot(request).sync();
assert!(result.is_ok(), "parse error: {:?}", result);
} | rust_cleaned_test_functions.jsonl/12103 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 252
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8337,
26058,
13418,
8657,
28441,
53265,
368,
341,
286,
1077,
7860,
9655,
284,
14563,
2582,
5062,
486,
878,
9655,
1006,
310,
330,
1944,
35569,
79372,
14,
1891,
756,
310,
330,
1151,
13418,
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_network_api() {
let runtime = consensus_runtime();
let num_nodes = 5;
let mut peers = Vec::new();
let mut receivers: Vec<NetworkReceivers<u64, Author>> = Vec::new();
let mut playground = NetworkPlayground::new(runtime.executor());
let mut nodes = Vec::new();
let mut author_to_public_keys = HashMap::new();
let mut signers = Vec::new();
for _ in 0..num_nodes {
let random_validator_signer = ValidatorSigner::random();
author_to_public_keys.insert(
random_validator_signer.author(),
random_validator_signer.public_key(),
);
peers.push(random_validator_signer.author());
signers.push(random_validator_signer);
}
let validator = Arc::new(ValidatorVerifier::new(
author_to_public_keys,
peers.len() * 2 / 3 + 1,
));
for i in 0..num_nodes {
let (network_reqs_tx, network_reqs_rx) = channel::new_test(8);
let (consensus_tx, consensus_rx) = channel::new_test(8);
let network_sender = ConsensusNetworkSender::new(network_reqs_tx);
let network_events = ConsensusNetworkEvents::new(consensus_rx);
playground.add_node(peers[i], consensus_tx, network_reqs_rx);
let mut node = ConsensusNetworkImpl::new(
peers[i],
network_sender,
network_events,
Arc::new(peers.clone()),
Arc::clone(&validator),
);
receivers.push(node.start(&runtime.executor()));
nodes.push(node);
}
let vote = VoteMsg::new(
HashValue::random(),
ExecutedState::state_for_genesis(),
1,
peers[0],
placeholder_ledger_info(),
&signers[0],
);
let proposal = ProposalInfo {
proposal: Block::make_genesis_block(),
proposer_info: ValidatorSigner::genesis().author(),
timeout_certificate: None,
highest_ledger_info: QuorumCert::certificate_for_genesis(),
};
block_on(async move {
nodes[0].send_vote(vote.clone(), peers[2..5].to_vec()).await;
playground
.wait_for_messages(3, NetworkPlayground::take_all)
.await;
for r in receivers.iter_mut().take(5).skip(2) {
let v = r.votes.next().await.unwrap();
assert_eq!(v, vote);
}
nodes[4].broadcast_proposal(proposal.clone()).await;
playground
.wait_for_messages(4, NetworkPlayground::take_all)
.await;
for r in receivers.iter_mut().take(num_nodes - 1) {
let p = r.proposals.next().await.unwrap();
assert_eq!(p, proposal);
}
});
} | rust_cleaned_test_functions.jsonl/116782 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1237
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20966,
11697,
368,
341,
262,
1077,
15592,
284,
23869,
33232,
543,
262,
1077,
1629,
14896,
284,
220,
20,
280,
262,
1077,
5206,
25029,
284,
11312,
486,
931,
543,
262,
1077,
5206,
39906,
25,
11312,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_rotate_vector2() {
let vector = 3_f64 * Vector2::new(f64::sqrt(3_f64) / 2_f64, -1_f64 / 2_f64);
let angle = Degrees(-90_f64);
let rotation = Rotation2::from_angle(angle);
let expected = 3_f64 * Vector2::new(-1_f64 / 2_f64, -f64::sqrt(3_f64) / 2_f64);
let result = rotation.rotate_vector(&vector);
assert!(relative_eq!(result, expected, epsilon = 1e-8));
} | rust_cleaned_test_functions.jsonl/70470 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 213
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60834,
12247,
17,
368,
341,
286,
1077,
4621,
284,
220,
18,
761,
21,
19,
353,
4196,
17,
486,
931,
955,
21,
19,
486,
26888,
7,
18,
761,
21,
19,
8,
608,
220,
17,
761,
21,
19,
11,
481,
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_get_pubkey() {
let seed = [1u8; 32];
unsafe {
let keypair = generate_keypair(seed.as_ptr());
let pubkey = Box::from_raw(get_keypair_pubkey(keypair));
let keypair = Box::from_raw(keypair);
let keypair = keypair.new_native().unwrap();
assert_eq!(keypair.pubkey(), *pubkey);
};
} | rust_cleaned_test_functions.jsonl/121324 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
34014,
792,
368,
341,
286,
1077,
10320,
284,
508,
16,
84,
23,
26,
220,
18,
17,
935,
286,
19860,
341,
310,
1077,
1376,
12670,
284,
6923,
3097,
12670,
44163,
5357,
4348,
1423,
310,
1077,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_peer_manager_notifications() {
let (send, recv) = channel();
let notifcation_iter = PeerNotificationIter { recv };
let join_handle = thread::spawn(move || {
for i in 0..5 {
send.send(PeerManagerNotification::Connected {
peer: format!("test_peer{}", i),
})
.unwrap();
}
});
let mut notifications_sent = 0;
for notifcation in notifcation_iter {
assert_eq!(
notifcation,
PeerManagerNotification::Connected {
peer: format!("test_peer{}", notifications_sent),
}
);
notifications_sent += 1;
}
assert_eq!(notifications_sent, 5);
join_handle.join().unwrap();
} | rust_cleaned_test_functions.jsonl/98772 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 453
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45159,
12144,
67546,
368,
341,
286,
1077,
320,
6681,
11,
27006,
8,
284,
5496,
1428,
286,
1077,
537,
333,
64882,
11723,
284,
45147,
11196,
8537,
314,
27006,
3634,
286,
1077,
5138,
10630,
284,
4516,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_ft_transfer_call_eth() {
let (master_account, contract) = init(CUSTODIAN_ADDRESS);
call_deposit_eth_to_near(&contract, CONTRACT_ACC);
let balance = get_eth_on_near_balance(&master_account, DEPOSITED_RECIPIENT, CONTRACT_ACC);
assert_eq!(balance, DEPOSITED_AMOUNT - DEPOSITED_FEE);
let balance = get_eth_on_near_balance(&master_account, CONTRACT_ACC, CONTRACT_ACC);
assert_eq!(balance, DEPOSITED_FEE);
let res = contract.call(
CONTRACT_ACC.parse().unwrap(),
"register_relayer",
&RegisterRelayerCallArgs {
address: validate_eth_address(CUSTODIAN_ADDRESS),
}
.try_to_vec()
.unwrap(),
DEFAULT_GAS,
0,
);
res.assert_success();
let transfer_amount = 50;
let fee = 30;
let mut msg = U256::from(fee).as_byte_slice().to_vec();
msg.append(&mut validate_eth_address(RECIPIENT_ETH_ADDRESS).to_vec());
let message = [CONTRACT_ACC, hex::encode(msg).as_str()].join(":");
let res = contract.call(
CONTRACT_ACC.parse().unwrap(),
"ft_transfer_call",
json!({
"receiver_id": CONTRACT_ACC,
"amount": transfer_amount.to_string(),
"msg": message,
})
.to_string()
.as_bytes(),
DEFAULT_GAS,
1,
);
res.assert_success();
let balance = get_eth_on_near_balance(&master_account, DEPOSITED_RECIPIENT, CONTRACT_ACC);
assert_eq!(balance, DEPOSITED_AMOUNT - DEPOSITED_FEE);
let balance = get_eth_on_near_balance(&master_account, CONTRACT_ACC, CONTRACT_ACC);
assert_eq!(balance, DEPOSITED_FEE);
let balance = get_eth_balance(
&master_account,
validate_eth_address(RECIPIENT_ETH_ADDRESS),
CONTRACT_ACC,
);
assert_eq!(balance, transfer_amount - fee);
let balance = get_eth_balance(
&master_account,
validate_eth_address(CUSTODIAN_ADDRESS),
CONTRACT_ACC,
);
assert_eq!(balance, fee);
let balance = total_supply(&master_account, CONTRACT_ACC);
assert_eq!(balance, DEPOSITED_AMOUNT);
let balance = total_eth_supply_on_near(&master_account, CONTRACT_ACC);
assert_eq!(balance, DEPOSITED_AMOUNT);
let balance = total_eth_supply_on_aurora(&master_account, CONTRACT_ACC);
assert_eq!(balance, transfer_amount);
} | rust_cleaned_test_functions.jsonl/112871 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1037
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41572,
35403,
13429,
57757,
368,
341,
262,
1077,
320,
13629,
13500,
11,
5116,
8,
284,
2930,
3025,
8553,
2069,
22002,
20135,
317,
262,
1618,
85798,
57757,
2346,
76340,
2099,
20257,
11,
17126,
25666,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sig_roundtrip() {
let msg = "uncle".as_bytes();
let mut sk = [0u8; SECRET_KEY_LENGTH];
sk.copy_from_slice(
&"6zFSymZAoaua3gtJPbAUwM584tRETdKYdEG9BeEnZaGW"
.from_base58()
.unwrap()
.as_slice(),
);
let mut pk = [0u8; PUBLIC_KEY_LENGTH];
pk.copy_from_slice(
"4KxUVD9NtyRJjU3BCvPgJSttoJX7cb3DMdDTNucLN121"
.from_base58()
.unwrap()
.as_slice(),
);
let sig = sign(msg, &sk);
println!("sig = {}", sig.to_base58());
assert!(sig_verify(msg, &pk, &sig));
} | rust_cleaned_test_functions.jsonl/18197 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 427
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29252,
29896,
32981,
368,
341,
286,
1077,
3750,
284,
330,
1347,
273,
3263,
300,
12524,
543,
286,
1077,
5206,
1901,
284,
508,
15,
84,
23,
26,
69956,
6600,
15023,
935,
286,
1901,
12232,
5673,
2648... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_variant_iter_dictentry() {
let v = DictEntry::new("foo", 1337).to_variant();
println!("{:?}", v.iter().collect::<Vec<_>>());
assert_eq!(v.iter().count(), 2);
} | rust_cleaned_test_functions.jsonl/59855 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
46112,
11723,
5243,
4085,
368,
341,
286,
1077,
348,
284,
29126,
5874,
486,
931,
445,
7975,
497,
220,
16,
18,
18,
22,
568,
983,
46112,
543,
286,
13751,
88928,
25,
52652,
348,
19471,
1005,
17384,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_stringify_expand() {
check(
r#"
#[rustc_builtin_macro]
macro_rules! stringify {() => {}}
fn main() {
stringify!(
a
b
c
);
}
"#,
expect![[r##"
#[rustc_builtin_macro]
macro_rules! stringify {() => {}}
fn main() {
"a b c";
}
"##]],
);
} | rust_cleaned_test_functions.jsonl/59811 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 183
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
1437,
67875,
368,
341,
262,
1779,
1006,
286,
435,
2,
698,
13353,
35788,
66,
73829,
58810,
921,
32606,
21407,
0,
83166,
314,
368,
589,
4687,
630,
8822,
1887,
368,
341,
262,
83166,
33673,
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_vote_account_round_trip() {
let mut rng = rand::thread_rng();
let (account, vote_state) = new_rand_vote_account(&mut rng, None);
let vote_account = ArcVoteAccount::from(account);
assert_eq!(vote_state, *vote_account.vote_state().as_ref().unwrap());
let data = bincode::serialize(&vote_account).unwrap();
let other_vote_account: ArcVoteAccount = bincode::deserialize(&data).unwrap();
// Assert that serialize->deserialized returns the same ArcVoteAccount.
assert_eq!(vote_account, other_vote_account);
assert_eq!(
vote_state,
*other_vote_account.vote_state().as_ref().unwrap()
);
} | rust_cleaned_test_functions.jsonl/91444 | {
"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,
54360,
13500,
29896,
63883,
368,
341,
286,
1077,
5206,
28422,
284,
10382,
486,
4528,
66849,
543,
286,
1077,
320,
4608,
11,
6910,
4387,
8,
284,
501,
33864,
54360,
13500,
2099,
6984,
28422,
11,
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_same_results_part_1() {
let shuffles = DATA.parse().unwrap();
let deck = shuffle(10_007, &shuffles);
let position = deck.into_iter().position(|c| c == 2019).unwrap();
assert_eq!(
shuffle_index(10_007, 2019, &shuffles),
position as u128,
)
} | rust_cleaned_test_functions.jsonl/104847 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 130
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33574,
13576,
10495,
62,
16,
368,
341,
10217,
557,
77453,
284,
14112,
4632,
1005,
15454,
543,
1572,
10217,
9530,
284,
25947,
7,
16,
15,
62,
15,
15,
22,
11,
609,
927,
77453,
317,
10217,
2309,
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_command() {
let command = Command {
annotation: Default::default(),
name: "Cmd".to_string(),
parameters: Default::default(),
redirect: None,
returns: Default::default(),
};
let prog = Context::new_root(&Default::default())
.with_domain("foo")
.render_with(&command);
let expect = quote! {
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct CmdCommand {}
impl CmdCommand {
pub fn new() -> Self {
Default::default()
}
}
impl Command for CmdCommand {
type Return = CmdReturn;
const METHOD : &'static str = "foo.Cmd";
}
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct CmdReturn {}
impl CmdReturn {
pub fn new() -> Self {
Default::default()
}
}
};
assert_eq(&prog, &expect);
} | rust_cleaned_test_functions.jsonl/26900 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 478
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10811,
368,
341,
262,
1077,
3210,
284,
7348,
341,
286,
21223,
25,
7899,
486,
2258,
3148,
286,
829,
25,
330,
15613,
3263,
983,
3904,
3148,
286,
5029,
25,
7899,
486,
2258,
3148,
286,
6423,
25,
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_unpack_bits_in_byte() {
let data = 0x49;
let ret = [true, false, false, true, false, false, true, false];
let buf = unpack_bits_in_byte(data);
assert_eq!(buf, ret);
let data = 0xaf;
let ret = [true, true, true, true, false, true, false, true];
let buf = unpack_bits_in_byte(data);
assert_eq!(buf, ret);
} | rust_cleaned_test_functions.jsonl/62515 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 193
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54889,
20034,
1243,
19737,
368,
341,
286,
1077,
821,
284,
220,
15,
87,
19,
24,
280,
286,
1077,
2112,
284,
508,
1866,
11,
895,
11,
895,
11,
830,
11,
895,
11,
895,
11,
830,
11,
895,
935,
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_total_ord() {
let c: &[int] = &[1, 2, 3];
[1, 2, 3, 4][].cmp(c) == Greater;
let c: &[int] = &[1, 2, 3, 4];
[1, 2, 3][].cmp(c) == Less;
let c: &[int] = &[1, 2, 3, 6];
[1, 2, 3, 4][].cmp(c) == Equal;
let c: &[int] = &[1, 2, 3, 4, 5, 6];
[1, 2, 3, 4, 5, 5, 5, 5][].cmp(c) == Less;
let c: &[int] = &[1, 2, 3, 4];
[2, 2][].cmp(c) == Greater;
} | rust_cleaned_test_functions.jsonl/31849 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 283
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10784,
67324,
368,
341,
286,
1077,
272,
25,
44590,
396,
60,
284,
44590,
16,
11,
220,
17,
11,
220,
18,
935,
286,
508,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
1457,
936,
7293,
1337,
8,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decode_rsb_w_reg() {
assert_eq!(
decode_32(0xf1c6003c),
Instruction::RSB_imm {
params: Reg2ImmParams {
rd: Reg::R0,
rn: Reg::R6,
imm32: 60,
setflags: SetFlags::False,
},
thumb32: true
}
);
} | rust_cleaned_test_functions.jsonl/64841 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 232
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
1710,
16892,
1670,
4920,
368,
341,
1066,
262,
2060,
10714,
33673,
286,
16895,
62,
18,
17,
7,
15,
5848,
16,
66,
21,
15,
15,
18,
66,
1326,
286,
29051,
486,
11451,
33,
71370,
341,
310,
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_enum_binop() {
check_enum_variant!(BinOp, Add);
check_enum_variant!(BinOp, Sub);
check_enum_variant!(BinOp, Mul);
check_enum_variant!(BinOp, Div);
check_enum_variant!(BinOp, Mod);
check_enum_variant!(BinOp, And);
check_enum_variant!(BinOp, Or);
check_enum_variant!(BinOp, Eq);
check_enum_variant!(BinOp, Ne);
check_enum_variant!(BinOp, Lt);
check_enum_variant!(BinOp, Lte);
check_enum_variant!(BinOp, Gt);
check_enum_variant!(BinOp, Gte);
} | rust_cleaned_test_functions.jsonl/95577 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 315
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31054,
21816,
453,
368,
341,
286,
1779,
31054,
46112,
10297,
28794,
7125,
11,
2691,
317,
286,
1779,
31054,
46112,
10297,
28794,
7125,
11,
3719,
317,
286,
1779,
31054,
46112,
10297,
28794,
7125,
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_decode_lsr_w_imm() {
assert_eq!(
decode_32(0xea5f0c9a),
Instruction::LSR_imm {
params: Reg2ShiftNParams {
rd: Reg::R12,
rm: Reg::R10,
shift_n: 2,
setflags: SetFlags::True,
},
thumb32: true,
}
);
} | rust_cleaned_test_functions.jsonl/64815 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 236
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
907,
15094,
1670,
71370,
368,
341,
1066,
262,
2060,
10714,
33673,
286,
16895,
62,
18,
17,
7,
15,
56570,
20,
69,
15,
66,
24,
64,
1326,
286,
29051,
486,
7268,
49,
71370,
341,
310,
3628,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rpc_get_recent_blockhash() {
let bob_pubkey = Pubkey::new_rand();
let (io, meta, _bank, blockhash, _alice, _leader_pubkey) =
start_rpc_handler_with_tx(&bob_pubkey);
let req = format!(r#"{{"jsonrpc":"2.0","id":1,"method":"getRecentBlockhash"}}"#);
let res = io.handle_request_sync(&req, meta);
let expected = json!({
"jsonrpc": "2.0",
"result": [ blockhash.to_string(), {
"burnPercent": DEFAULT_BURN_PERCENT,
"lamportsPerSignature": 0,
"maxLamportsPerSignature": 0,
"minLamportsPerSignature": 0,
"targetLamportsPerSignature": 0,
"targetSignaturesPerSlot": 0
}],
"id": 1
});
let expected: Response =
serde_json::from_value(expected).expect("expected response deserialization");
let result: Response = serde_json::from_str(&res.expect("actual response"))
.expect("actual response deserialization");
assert_eq!(expected, result);
} | rust_cleaned_test_functions.jsonl/20305 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 548
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60799,
3062,
62361,
7113,
8296,
368,
341,
286,
1077,
35192,
34014,
792,
284,
22611,
792,
486,
931,
33864,
543,
286,
1077,
320,
815,
11,
8823,
11,
716,
17033,
11,
2504,
8296,
11,
716,
63195,
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_to_xyz() {
let c1 = XyY::new(0.5, 0.2, 0.5);
let t1 = Xyz::from_color(&c1);
assert_relative_eq!(t1, Xyz::new(1.25, 0.5, 0.75), epsilon = 1e-6);
assert_relative_eq!(XyY::from_color(&t1), c1, epsilon = 1e-6);
let c2 = XyY::new(1.0 / 3.0, 1.0 / 3.0, 1.0);
let t2 = Xyz::from_color(&c2);
assert_relative_eq!(t2, Xyz::new(1.0, 1.0, 1.0), epsilon = 1e-6);
assert_relative_eq!(XyY::from_color(&t2), c2, epsilon = 1e-6);
let c3 = XyY::new(0.3, 0.5, 0.3);
let t3 = Xyz::from_color(&c3);
assert_relative_eq!(t3, Xyz::new(0.18, 0.3, 0.12), epsilon = 1e-6);
assert_relative_eq!(XyY::from_color(&t3), c3, epsilon = 1e-6);
let c4 = XyY::new(0.285, 0.4194, 0.583);
let t4 = Xyz::from_color(&c4);
assert_relative_eq!(t4, Xyz::new(0.396173, 0.5830, 0.410908), epsilon = 1e-6);
assert_relative_eq!(XyY::from_color(&t4), c4, epsilon = 1e-6);
} | rust_cleaned_test_functions.jsonl/67709 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 574
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
64974,
368,
341,
286,
1077,
272,
16,
284,
1599,
88,
56,
486,
931,
7,
15,
13,
20,
11,
220,
15,
13,
17,
11,
220,
15,
13,
20,
317,
286,
1077,
259,
16,
284,
1599,
18348,
486,
1499,
671... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_anyo_1() {
let query = proto_vulcan_query!(|q| {
conde {
anyo {
false == q,
},
true == q,
}
});
let mut iter = query.run();
assert_eq!(iter.next().unwrap().q, true);
assert_eq!(iter.next().unwrap().q, false);
assert_eq!(iter.next().unwrap().q, false);
assert_eq!(iter.next().unwrap().q, false);
assert_eq!(iter.next().unwrap().q, false);
} | rust_cleaned_test_functions.jsonl/14018 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 302
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37248,
78,
62,
16,
368,
341,
286,
1077,
3239,
284,
18433,
2273,
360,
4814,
5738,
10297,
91,
80,
91,
341,
310,
390,
450,
341,
394,
894,
78,
341,
503,
895,
621,
2804,
345,
394,
1153,
394,
830,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invalid_get_valid_int_prefix() {
let cases = vec!["1e21", "1e9223372036854775807"];
for i in cases {
let o = super::float_str_to_int_string(i);
assert!(o.is_err());
}
} | rust_cleaned_test_functions.jsonl/75522 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 135
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
3062,
8337,
4042,
13974,
368,
341,
286,
1077,
5048,
284,
7486,
0,
1183,
16,
68,
17,
16,
497,
330,
16,
68,
24,
17,
17,
18,
18,
22,
17,
15,
18,
21,
23,
20,
19,
22,
22,
20,
23,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_decrypt_second_segment() {
let mut rc4_key = [0u8; 255];
for (i, p) in rc4_key.iter_mut().enumerate() {
*p = i as u8
}
let crypto = QMCStreamRC4Crypto::new(&rc4_key);
let mut data = [0u8; 16];
crypto.decrypt(OTHER_SEGMENT_SIZE, &mut data);
assert_eq!(
data,
[
151, 56, 198, 1, 226, 173, 127, 4, // beginning of second "other" segment
181, 165, 171, 21, 82, 152, 195, 210,
]
);
} | rust_cleaned_test_functions.jsonl/37647 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 312
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
80764,
29644,
28061,
368,
341,
286,
1077,
5206,
10192,
19,
3097,
284,
508,
15,
84,
23,
26,
220,
17,
20,
20,
935,
286,
369,
320,
72,
11,
281,
8,
304,
10192,
19,
3097,
19471,
29523,
1005,
7656... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_encode_nonfinite_float_yields_null() {
let v = to_value(::std::f64::NAN).unwrap();
assert!(v.is_null());
let v = to_value(::std::f64::INFINITY).unwrap();
assert!(v.is_null());
let v = to_value(::std::f32::NAN).unwrap();
assert!(v.is_null());
let v = to_value(::std::f32::INFINITY).unwrap();
assert!(v.is_null());
} | rust_cleaned_test_functions.jsonl/29816 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 178
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11224,
21637,
25722,
17586,
4178,
6907,
15162,
368,
341,
262,
1077,
348,
284,
311,
3142,
38732,
1834,
486,
69,
21,
19,
486,
45,
1093,
568,
15454,
543,
262,
2060,
10297,
85,
2079,
15162,
5231,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_regex_captures() {
let regex = Regex::new("e(l+)|(r+)").unwrap();
let captures = regex.captures("hello").unwrap();
assert_eq!(captures.len(), 3);
assert_eq!(captures.is_empty(), false);
let pos1 = captures.pos(0).unwrap();
let pos2 = captures.pos(1).unwrap();
let pos3 = captures.pos(2);
assert_eq!(pos1, (1, 4));
assert_eq!(pos2, (2, 4));
assert_eq!(pos3, None);
let str1 = captures.at(0).unwrap();
let str2 = captures.at(1).unwrap();
let str3 = captures.at(2);
assert_eq!(str1, "ell");
assert_eq!(str2, "ll");
assert_eq!(str3, None);
} | rust_cleaned_test_functions.jsonl/123802 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 353
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41832,
666,
2689,
1413,
368,
341,
286,
1077,
20180,
284,
26146,
486,
931,
445,
68,
2333,
10,
55178,
81,
36197,
1827,
15454,
543,
286,
1077,
40155,
284,
20180,
520,
2689,
1413,
445,
14990,
1827,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_no_unknown() {
let (relayer, always_success_out_point) = build_chain(5);
let transaction = new_transaction(&relayer, 1, &always_success_out_point);
let transactions = vec![transaction.clone()];
// known tx
{
relayer.shared.state().mark_as_known_tx(transaction.hash());
}
let content = packed::BlockProposal::new_builder()
.transactions(transactions.into_iter().map(|tx| tx.data()).pack())
.build();
let process = BlockProposalProcess::new(content.as_reader(), &relayer);
assert_eq!(process.execute(), Status::ignored());
} | rust_cleaned_test_functions.jsonl/40502 | {
"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,
6536,
57507,
368,
341,
262,
1077,
320,
3748,
1135,
11,
2677,
18632,
6068,
6085,
8,
284,
1936,
30583,
7,
20,
317,
262,
1077,
7745,
284,
501,
28884,
2099,
3748,
1135,
11,
220,
16,
11,
609,
32122... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_move_left_right_data_mode() {
let fj = parse_top_level_json(DATA_OBJECT.to_owned()).unwrap();
let mut viewer = JsonViewer::new(fj, Mode::Data);
assert_movements(
&mut viewer,
vec![
(Action::MoveRight, 1),
(Action::MoveRight, 1),
(Action::MoveDown(5), 7),
(Action::MoveLeft, 6),
(Action::MoveLeft, 6),
],
);
assert!(viewer.flatjson[6].is_collapsed());
assert_movements(
&mut viewer,
vec![
(Action::MoveLeft, 0),
(Action::MoveRight, 1),
(Action::MoveLeft, 0),
(Action::MoveLeft, 0),
],
);
assert!(viewer.flatjson[0].is_collapsed());
assert_movements(
&mut viewer,
vec![(Action::MoveDown(1), 0), (Action::MoveRight, 0)],
);
assert!(viewer.flatjson[0].is_expanded());
assert_movements(&mut viewer, vec![(Action::MoveLeft, 0)]);
} | rust_cleaned_test_functions.jsonl/41763 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 611
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17134,
9579,
10539,
1769,
7302,
368,
341,
286,
1077,
75371,
284,
4715,
10426,
8274,
9455,
59093,
13442,
2389,
51973,
6011,
15454,
543,
286,
1077,
5206,
25708,
284,
8308,
28271,
486,
931,
955,
73,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_randomize_in_place() {
use rand::SeedableRng;
let mut sample = vec![1_i64, 2, 3, 4, 5, 6, 7, 8, 9, 10];
let mut randomized_samples = vec![];
for seed in 0..10 {
let mut rng = rand_pcg::Pcg64::seed_from_u64(seed);
let mut copied_sample = sample.clone();
randomize_in_place(&mut copied_sample, &mut rng);
randomized_samples.push(copied_sample);
}
randomized_samples.push(sample);
let equal: u8 = randomized_samples
.iter()
.enumerate()
.map(|(i, v)| {
let cmp1 = &randomized_samples[0..i];
let cmp2 = &randomized_samples[i + 1..];
if cmp1.iter().any(|x| x == v) || cmp2.iter().any(|x| x == v) {
1
} else {
0
}
})
.sum();
assert!(equal == 0);
} | rust_cleaned_test_functions.jsonl/71861 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 461
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22644,
551,
1243,
34548,
368,
341,
262,
990,
10382,
486,
41471,
480,
49,
968,
280,
262,
1077,
5206,
6077,
284,
7486,
20703,
16,
5318,
21,
19,
11,
220,
17,
11,
220,
18,
11,
220,
19,
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... | 4 |
#[test]
fn test_score_chunk_version_mismatch_multicast() {
let num_validators = 4;
let (mut request_manager, validators) =
generate_request_manager_and_validators(0, num_validators);
let validator_0 = validators[0].clone();
let validator_1 = validators[1].clone();
// Process empty chunk responses from all validators except validator 0
for _ in 0..NUM_CHUNKS_TO_PROCESS {
for validator_index in 1..num_validators {
request_manager.process_empty_chunk(&validators[validator_index as usize]);
}
}
// Process multiple multi-cast chunk version mismatches from validator 0
for _ in 0..NUM_CHUNKS_TO_PROCESS {
request_manager.add_request(100, vec![validator_0.clone(), validator_1.clone()]);
request_manager
.process_chunk_version_mismatch(&validator_0, 100, 0)
.unwrap_err();
}
// Verify validator 0 is chosen more often than the other validators
verify_validator_picked_most_often(&mut request_manager, &validators, 0);
} | rust_cleaned_test_functions.jsonl/42113 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 495
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10405,
30539,
9438,
717,
24976,
26290,
35446,
368,
341,
286,
1077,
1629,
8337,
2973,
284,
220,
19,
280,
286,
1077,
320,
6984,
1681,
12144,
11,
38588,
8,
4035,
310,
6923,
7893,
12144,
8378,
8337,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_check_address() {
let start_addr1 = GuestAddress(0x0);
let start_addr2 = GuestAddress(0x800);
let guest_mem =
GuestMemoryMmap::new(&[(start_addr1, 0x400), (start_addr2, 0x400)]).unwrap();
assert_eq!(
guest_mem.check_address(GuestAddress(0x200)),
Some(GuestAddress(0x200))
);
assert_eq!(guest_mem.check_address(GuestAddress(0x600)), None);
assert_eq!(
guest_mem.check_address(GuestAddress(0xa00)),
Some(GuestAddress(0xa00))
);
assert_eq!(guest_mem.check_address(GuestAddress(0xc00)), None);
} | rust_cleaned_test_functions.jsonl/72069 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 325
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
6744,
368,
341,
286,
1077,
1191,
7387,
16,
284,
26215,
4286,
7,
15,
87,
15,
317,
286,
1077,
1191,
7387,
17,
284,
26215,
4286,
7,
15,
87,
23,
15,
15,
317,
286,
1077,
8640,
12976,
4035,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_temp_conv() {
assert_eq!(split_temp(0x07d0), (125, 0));
assert_eq!(split_temp(0x0550), (85, 0));
assert_eq!(split_temp(0x0191), (25, 625));
assert_eq!(split_temp(0x00A2), (10, 1250));
assert_eq!(split_temp(0x0008), (0, 5000));
assert_eq!(split_temp(0x0000), (0, 0));
assert_eq!(split_temp(0xfff8), (0, -5000));
assert_eq!(split_temp(0xFF5E), (-10, -1250));
assert_eq!(split_temp(0xFE6F), (-25, -625));
assert_eq!(split_temp(0xFC90), (-55, 0));
} | rust_cleaned_test_functions.jsonl/12670 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 310
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11771,
22716,
368,
341,
286,
2060,
10714,
10297,
6960,
11771,
7,
15,
87,
15,
22,
67,
15,
701,
320,
16,
17,
20,
11,
220,
15,
1106,
286,
2060,
10714,
10297,
6960,
11771,
7,
15,
87,
15,
20,
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_rpc_client() {
solana_logger::setup();
let TestValidator {
server,
leader_data,
alice,
ledger_path,
..
} = TestValidator::run();
let bob_pubkey = solana_sdk::pubkey::new_rand();
let client = RpcClient::new_socket(leader_data.rpc);
assert_eq!(
client.get_version().unwrap().solana_core,
solana_version::semver!()
);
assert!(client.get_account(&bob_pubkey).is_err());
assert_eq!(client.get_balance(&bob_pubkey).unwrap(), 0);
assert_eq!(
client.get_balance(&alice.pubkey()).unwrap(),
sol_to_lamports(1_000_000.0)
);
let (blockhash, _fee_calculator) = client.get_recent_blockhash().unwrap();
let tx = system_transaction::transfer(&alice, &bob_pubkey, sol_to_lamports(20.0), blockhash);
let signature = client.send_transaction(&tx).unwrap();
let mut confirmed_tx = false;
let now = Instant::now();
while now.elapsed().as_secs() <= 20 {
let response = client
.confirm_transaction_with_commitment(&signature, CommitmentConfig::default())
.unwrap();
if response.value {
confirmed_tx = true;
break;
}
sleep(Duration::from_millis(500));
}
assert!(confirmed_tx);
assert_eq!(
client.get_balance(&bob_pubkey).unwrap(),
sol_to_lamports(20.0)
);
assert_eq!(
client.get_balance(&alice.pubkey()).unwrap(),
sol_to_lamports(999_980.0)
);
server.close().unwrap();
remove_dir_all(ledger_path).unwrap();
} | rust_cleaned_test_functions.jsonl/42023 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 738
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60799,
8179,
368,
341,
262,
2048,
3362,
27413,
486,
15188,
1428,
262,
1077,
3393,
14256,
341,
286,
3538,
345,
286,
7653,
1769,
345,
286,
70433,
345,
286,
46933,
2638,
345,
286,
54538,
262,
335,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_addresses() {
match crate::parser::rfc3501::address(b"(\"John Klensin\" NIL \"KLENSIN\" \"MIT.EDU\") ") {
Ok((_, _address)) => {}
rsp => panic!("unexpected response {:?}", rsp),
}
// Literal non-UTF8 address
match crate::parser::rfc3501::address(
b"({12}\r\nJoh\xff Klensin NIL \"KLENSIN\" \"MIT.EDU\") ",
) {
Ok((_, _address)) => {}
rsp => panic!("unexpected response {:?}", rsp),
}
} | rust_cleaned_test_functions.jsonl/8551 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 274
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
59471,
368,
341,
286,
2432,
17717,
486,
9657,
486,
8052,
66,
18,
20,
15,
16,
486,
4995,
1883,
29209,
2105,
13079,
27941,
724,
258,
2105,
64147,
7245,
42,
867,
2448,
687,
2105,
7245,
18330,
13,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_compile() {
// Test all false
let flags = NumberFormat::compile(b'_', false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false).unwrap();
assert_eq!(flags.flags(), NumberFormat::default());
assert_eq!(flags.digit_separator(), 0);
} | rust_cleaned_test_functions.jsonl/88904 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 155
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74170,
368,
341,
286,
442,
3393,
678,
895,
198,
286,
1077,
8042,
284,
5624,
4061,
486,
20433,
1883,
36777,
516,
895,
11,
895,
11,
895,
11,
895,
11,
895,
11,
895,
11,
895,
11,
895,
11,
895,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_string2_event() {
let data = [
0x82, 0x2d, 0x01, 0x00, 0x17, 0x00, 0x03, 0x00, 0x45, 0x4e, 0x47,
];
let tape = parse(&data[..]).unwrap();
assert_eq!(
tape.token_tape,
vec![
BinaryToken::Token(0x2d82),
BinaryToken::Unquoted(Scalar::new(b"ENG")),
]
);
} | rust_cleaned_test_functions.jsonl/109410 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 254
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
17,
6748,
368,
341,
286,
1077,
821,
284,
2278,
310,
220,
15,
87,
23,
17,
11,
220,
15,
87,
17,
67,
11,
220,
15,
87,
15,
16,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
16,
22,
11,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_verse_0() {
assert_eq!(beer::verse(0), "No more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n");
} | rust_cleaned_test_functions.jsonl/32421 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 74
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
4450,
62,
15,
368,
341,
262,
2060,
10714,
10297,
47795,
486,
4450,
7,
15,
701,
330,
2753,
803,
26376,
315,
12883,
389,
279,
7002,
11,
902,
803,
26376,
315,
12883,
7110,
77,
10850,
311,
279... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_pprof_heap_service() {
let temp_dir = tempfile::TempDir::new().unwrap();
let mut status_server = StatusServer::new(
1,
ConfigController::default(),
Arc::new(SecurityConfig::default()),
MockRouter,
temp_dir.path().to_path_buf(),
)
.unwrap();
let addr = "127.0.0.1:0".to_owned();
let _ = status_server.start(addr);
let client = Client::new();
let uri = Uri::builder()
.scheme("http")
.authority(status_server.listening_addr().to_string().as_str())
.path_and_query("/debug/pprof/heap?seconds=1")
.build()
.unwrap();
let handle = status_server
.thread_pool
.spawn(async move { client.get(uri).await.unwrap() });
let resp = block_on(handle).unwrap();
assert_eq!(resp.status(), StatusCode::OK);
status_server.stop();
} | rust_cleaned_test_functions.jsonl/6919 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 495
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31600,
299,
69,
33059,
12267,
368,
341,
286,
1077,
2730,
4334,
284,
54819,
486,
12151,
6184,
486,
931,
1005,
15454,
543,
286,
1077,
5206,
2639,
12015,
284,
8104,
5475,
486,
931,
1006,
310,
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_simplify_optimized_plan_with_composed_and() {
let table_scan = test_table_scan();
let plan = LogicalPlanBuilder::from(table_scan)
.project(vec![col("a"), col("b")])
.unwrap()
.filter(and(
and(col("a").gt(lit(5)), col("b").lt(lit(6))),
col("a").gt(lit(5)),
))
.unwrap()
.build()
.unwrap();
assert_optimized_plan_eq(
&plan,
"\
Filter: #test.a > Int32(5) AND #test.b < Int32(6) AS test.a > Int32(5) AND test.b < Int32(6) AND test.a > Int32(5)\
\n Projection: #test.a, #test.b\
\n TableScan: test projection=None",
);
} | rust_cleaned_test_functions.jsonl/77809 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 440
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
70206,
15032,
45706,
26564,
6615,
2965,
3865,
8378,
368,
341,
286,
1077,
1965,
28857,
284,
1273,
5237,
28857,
543,
1789,
286,
1077,
3119,
284,
62069,
20485,
3297,
486,
1499,
15761,
28857,
340,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_verify_account_changes_data_len() {
assert_eq!(
PreAccount::new(
&Account::new_data(0, &[0], &system_program::id()).unwrap(),
true,
&system_program::id()
)
.verify(
&system_program::id(),
&Account::new_data(0, &[0, 0], &system_program::id()).unwrap()
),
Ok(()),
"system program should be able to change the data len"
);
let alice_program_id = Pubkey::new_rand();
assert_eq!(
PreAccount::new(
&Account::new_data(0, &[0], &alice_program_id).unwrap(),
true,
&system_program::id(),
).verify(
&system_program::id(),
&Account::new_data(0, &[0, 0], &alice_program_id).unwrap(),
),
Err(InstructionError::AccountDataSizeChanged),
"system program should not be able to change the data length of accounts it does not own"
);
} | rust_cleaned_test_functions.jsonl/98716 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 609
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35638,
13500,
47526,
1769,
6043,
368,
341,
286,
2060,
10714,
33673,
310,
4968,
7365,
486,
931,
1006,
394,
609,
7365,
486,
931,
1769,
7,
15,
11,
44590,
15,
1125,
609,
8948,
25096,
486,
307,
6011,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_nan_float() {
let bytes = vec![0, 0, 192, 127];
assert_eq!(
f32::try_from_slice(&bytes).unwrap_err().to_string(),
"For portability reasons we do not allow to deserialize NaNs."
);
} | rust_cleaned_test_functions.jsonl/103719 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73936,
17586,
368,
341,
262,
1077,
5820,
284,
7486,
20703,
15,
11,
220,
15,
11,
220,
16,
24,
17,
11,
220,
16,
17,
22,
935,
262,
2060,
10714,
33673,
286,
282,
18,
17,
486,
1539,
5673,
26488,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_meta_item_bool_value() {
run_test(
"#[foo = true]",
MetaNameValue {
ident: ident("foo").into(),
eq_token: Default::default(),
lit: Lit::Bool(LitBool {
value: true,
span: Span::call_site(),
}),
},
);
run_test(
"#[foo = false]",
MetaNameValue {
ident: ident("foo").into(),
eq_token: Default::default(),
lit: Lit::Bool(LitBool {
value: false,
span: Span::call_site(),
}),
},
)
} | rust_cleaned_test_functions.jsonl/63941 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 367
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13381,
5634,
22159,
3142,
368,
341,
262,
1598,
4452,
1006,
286,
5869,
58,
7975,
284,
830,
45016,
286,
15819,
675,
1130,
341,
310,
3524,
25,
3524,
445,
7975,
1827,
18122,
3148,
310,
8939,
6458,
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_int_to_roman() {
assert_eq!(Solution::int_to_roman(3), "III");
assert_eq!(Solution::int_to_roman(4), "IV");
assert_eq!(Solution::int_to_roman(9), "IX");
assert_eq!(Solution::int_to_roman(58), "LVIII");
assert_eq!(Solution::int_to_roman(1994), "MCMXCIV");
} | rust_cleaned_test_functions.jsonl/953 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 160
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4042,
2346,
62,
62014,
368,
341,
286,
2060,
10714,
10297,
36842,
486,
396,
2346,
62,
62014,
7,
18,
701,
330,
22615,
797,
286,
2060,
10714,
10297,
36842,
486,
396,
2346,
62,
62014,
7,
19,
701,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
// For the condition to hold both scales must be uniform
let first = Transform {
rotation: Quaternion::look_at(Vector3::new(-1., 1., 2.), Vector3::new(1., 0., 0.)),
translation: Vector3::new(20., 10., -3.),
scale: Vector3::new(2., 2., 2.),
};
let second = Transform {
rotation: Quaternion::look_at(Vector3::new(7., -1., 3.), Vector3::new(2., 1., 1.)),
translation: Vector3::new(2., 1., -3.),
scale: Vector3::new(1., 1., 1.),
};
assert_ulps_eq!(
first.matrix() * second.matrix(),
<Transform as CgTransform<Point3<f32>>>::concat(&first, &second).matrix()
);
assert_ulps_eq!(
first.matrix() * second.matrix(),
<Transform as CgTransform<Point2<f32>>>::concat(&first, &second).matrix()
);
} | rust_cleaned_test_functions.jsonl/128660 | {
"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,
24944,
368,
341,
262,
442,
1752,
279,
2971,
311,
3331,
2176,
28405,
1969,
387,
13794,
198,
262,
1077,
1156,
284,
15226,
341,
286,
12695,
25,
24801,
486,
7201,
3752,
20258,
18,
486,
931,
4080,
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_keccak512_hash_bytes() {
let bytes = b"password";
let hash = Keccak512Hasher.hash((), bytes).unwrap();
assert_eq!("a6818b8188b36c44d17784c5551f63accc5deaf8786f9d0ad1ae3cd8d887cbab4f777286dbb315fb14854c8774dc0d10b5567e4a705536cc2a1d61ec0a16a7a6", hash.as_hex());
} | rust_cleaned_test_functions.jsonl/101933 | {
"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,
45476,
84262,
20,
16,
17,
8950,
12524,
368,
341,
286,
1077,
5820,
284,
293,
1,
3833,
3302,
286,
1077,
5175,
284,
6569,
84262,
20,
16,
17,
6370,
261,
15101,
7,
1507,
5820,
568,
15454,
1428,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_num_bits_hashes() -> Result<()> {
// use this website for verification: https://hur.st/bloomfilter/
let bloom = BloomFilter::with_rate(100000, 0.01, create_seeds());
assert_eq!(bloom.num_bits(), 958506);
assert_eq!(bloom.num_hashes(), 7);
let bloom = BloomFilter::with_rate(4000, 0.02, create_seeds());
assert_eq!(bloom.num_bits(), 32570);
assert_eq!(bloom.num_hashes(), 6);
Ok(())
} | rust_cleaned_test_functions.jsonl/101369 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4273,
20034,
91616,
368,
1464,
5714,
71698,
341,
262,
442,
990,
419,
3910,
369,
22901,
25,
3703,
1110,
71,
324,
1236,
3470,
18474,
5315,
5894,
262,
1077,
51454,
284,
24503,
5632,
486,
4197,
9246,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_expression_binary() {
use BinaryOp::*;
let a = name("a");
let b = name("b");
for (code, op) in
[("a.b" , Dot), ("a . b", Dot),
("a + b", Add), ("a - b", Sub), ("a * b", Mul), ("a / b", Div ),
("a || b", Or ), ("a && b", And), ("a < b", Lt ), ("a > b", Gt ),
("a >= b", Geq), ("a <= b", Leq), ("a == b", Eq ), ("a != b", Diff)].iter() {
assert_parse_expr(code, Expression::binary_op(*op, a.clone(), b.clone()))
}
} | rust_cleaned_test_functions.jsonl/59498 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28068,
31761,
368,
341,
220,
990,
17718,
7125,
56162,
220,
1077,
264,
284,
829,
445,
64,
797,
220,
1077,
293,
284,
829,
445,
65,
3071,
220,
369,
320,
1851,
11,
1179,
8,
304,
198,
262,
84019,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.