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_lock() {
let mut locks = vec![
Lock::new(
LockType::Put,
b"pk".to_vec(),
1.into(),
10,
None,
TimeStamp::zero(),
0,
TimeStamp::zero(),
),
Lock::new(
LockType::Delete,
b"pk".to_vec(),
1.into(),
10,
Some(b"short_value".to_vec()),
TimeStamp::zero(),
0,
TimeStamp::zero(),
),
Lock::new(
LockType::Put,
b"pk".to_vec(),
1.into(),
10,
None,
10.into(),
0,
TimeStamp::zero(),
),
Lock::new(
LockType::Delete,
b"pk".to_vec(),
1.into(),
10,
Some(b"short_value".to_vec()),
10.into(),
0,
TimeStamp::zero(),
),
Lock::new(
LockType::Put,
b"pk".to_vec(),
1.into(),
10,
None,
TimeStamp::zero(),
16,
TimeStamp::zero(),
),
Lock::new(
LockType::Delete,
b"pk".to_vec(),
1.into(),
10,
Some(b"short_value".to_vec()),
TimeStamp::zero(),
16,
TimeStamp::zero(),
),
Lock::new(
LockType::Put,
b"pk".to_vec(),
1.into(),
10,
None,
10.into(),
16,
TimeStamp::zero(),
),
Lock::new(
LockType::Delete,
b"pk".to_vec(),
1.into(),
10,
Some(b"short_value".to_vec()),
10.into(),
0,
TimeStamp::zero(),
),
Lock::new(
LockType::Put,
b"pkpkpk".to_vec(),
111.into(),
222,
None,
333.into(),
444,
555.into(),
),
Lock::new(
LockType::Put,
b"pk".to_vec(),
111.into(),
222,
Some(b"short_value".to_vec()),
333.into(),
444,
555.into(),
)
.use_async_commit(vec![]),
Lock::new(
LockType::Put,
b"pk".to_vec(),
111.into(),
222,
Some(b"short_value".to_vec()),
333.into(),
444,
555.into(),
)
.use_async_commit(vec![b"k".to_vec()]),
Lock::new(
LockType::Put,
b"pk".to_vec(),
111.into(),
222,
Some(b"short_value".to_vec()),
333.into(),
444,
555.into(),
)
.use_async_commit(vec![
b"k1".to_vec(),
b"kkkkk2".to_vec(),
b"k3k3k3k3k3k3".to_vec(),
b"k".to_vec(),
]),
];
for (i, lock) in locks.drain(..).enumerate() {
let v = lock.to_bytes();
let l = Lock::parse(&v[..]).unwrap_or_else(|e| panic!("#{} parse() err: {:?}", i, e));
assert_eq!(l, lock, "#{} expect {:?}, but got {:?}", i, lock, l);
assert!(lock.pre_allocate_size() >= v.len());
}
assert!(Lock::parse(b"").is_err());
let lock = Lock::new(
LockType::Lock,
b"pk".to_vec(),
1.into(),
10,
Some(b"short_value".to_vec()),
TimeStamp::zero(),
0,
TimeStamp::zero(),
);
let v = lock.to_bytes();
assert!(Lock::parse(&v[..4]).is_err());
} | rust_cleaned_test_functions.jsonl/20088 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3048
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9818,
368,
341,
1789,
286,
1077,
5206,
31676,
284,
7486,
90515,
310,
15701,
486,
931,
1006,
394,
15701,
929,
486,
19103,
345,
394,
293,
1,
20819,
3263,
983,
13251,
3148,
394,
220,
16,
39860,
314... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_code_cache() {
let (_temp_dir, deno_dir) = test_setup();
let filename = "hello.js";
let source_code = b"1+2";
let output_code = b"1+2 // output code";
let source_map = b"{}";
let hash = source_code_hash(filename, source_code, version::DENO);
let (cache_path, source_map_path) =
deno_dir.cache_path(filename, source_code);
assert!(cache_path.ends_with(format!("gen/{}.js", hash)));
assert!(source_map_path.ends_with(format!("gen/{}.js.map", hash)));
let out = ModuleMetaData {
filename: filename.to_owned(),
source_code: source_code[..].to_owned(),
module_name: "hello.js".to_owned(),
module_redirect_source_name: None,
media_type: msg::MediaType::TypeScript,
maybe_output_code: Some(output_code[..].to_owned()),
maybe_output_code_filename: None,
maybe_source_map: Some(source_map[..].to_owned()),
maybe_source_map_filename: None,
};
let r = deno_dir.code_cache(&out);
r.expect("code_cache error");
assert!(cache_path.exists());
assert_eq!(output_code[..].to_owned(), fs::read(&cache_path).unwrap());
} | rust_cleaned_test_functions.jsonl/83864 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 483
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4136,
11529,
368,
341,
262,
1077,
5453,
3888,
4334,
11,
3371,
78,
4334,
8,
284,
1273,
21363,
1428,
262,
1077,
3899,
284,
330,
14990,
2857,
876,
262,
1077,
2530,
4136,
284,
293,
1,
16,
10,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_process_empty_entry_is_registered() {
solana_logger::setup();
let GenesisConfigInfo {
genesis_config,
mint_keypair,
..
} = create_genesis_config(2);
let bank = Arc::new(Bank::new_for_tests(&genesis_config));
let keypair = Keypair::new();
let slot_entries = create_ticks(genesis_config.ticks_per_slot, 1, genesis_config.hash());
let tx = system_transaction::transfer(
&mint_keypair,
&keypair.pubkey(),
1,
slot_entries.last().unwrap().hash,
);
assert_eq!(
bank.process_transaction(&tx),
Err(TransactionError::BlockhashNotFound)
);
// Now ensure the TX is accepted despite pointing to the ID of an empty entry.
process_entries_for_tests(&bank, slot_entries, true, None, None).unwrap();
assert_eq!(bank.process_transaction(&tx), Ok(()));
} | rust_cleaned_test_functions.jsonl/46801 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 468
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
15124,
9078,
6892,
72683,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
1428,
286,
1077,
40788,
2648,
1731,
341,
310,
59366,
5332,
345,
310,
28337,
3097,
12670,
345,
310,
54538,
286,
335,
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_serialise_body() {
#[cfg(not(feature = "component"))]
let elem: Element = "<message xmlns='jabber:client' to='coucou@example.org' type='chat'><body>Hello world!</body></message>".parse().unwrap();
#[cfg(feature = "component")]
let elem: Element = "<message xmlns='jabber:component:accept' to='coucou@example.org' type='chat'><body>Hello world!</body></message>".parse().unwrap();
let mut message = Message::new(Jid::Bare(BareJid::new("coucou", "example.org")));
message
.bodies
.insert(String::from(""), Body::from_str("Hello world!").unwrap());
let elem2 = message.into();
assert_eq!(elem, elem2);
} | rust_cleaned_test_functions.jsonl/112973 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 311
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25602,
1064,
14114,
368,
341,
286,
11506,
14072,
24772,
27062,
284,
330,
8571,
2761,
921,
286,
1077,
11750,
25,
8543,
284,
4055,
1994,
24967,
1131,
38916,
652,
25,
2972,
6,
311,
1131,
22249,
22249... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lt_eq_dyn_utf8_scalar() {
let array = StringArray::from(vec!["abc", "def", "xyz"]);
let a_eq = lt_eq_dyn_utf8_scalar(&array, "def").unwrap();
assert_eq!(
a_eq,
BooleanArray::from(vec![Some(true), Some(true), Some(false)])
);
} | rust_cleaned_test_functions.jsonl/98236 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 170
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39164,
10714,
69213,
39453,
23,
41652,
368,
341,
286,
1077,
1334,
284,
923,
1857,
486,
1499,
25592,
0,
1183,
13683,
497,
330,
750,
497,
330,
28854,
15049,
286,
1077,
264,
10714,
284,
25175,
10714,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stable_entries() {
let ents = vec![new_entry(5, 1), new_entry(5, 2), new_entry(6, 3)];
let mut u = Unstable {
entries: ents.clone(),
offset: 5,
snapshot: Some(new_snapshot(4, 1)),
logger: crate::default_logger(),
};
assert_eq!(ents, u.entries);
u.stable_entries();
assert!(u.entries.is_empty());
assert_eq!(u.offset, 7);
} | rust_cleaned_test_functions.jsonl/80455 | {
"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,
1261,
480,
26092,
368,
341,
286,
1077,
36852,
284,
7486,
20703,
931,
9078,
7,
20,
11,
220,
16,
701,
501,
9078,
7,
20,
11,
220,
17,
701,
501,
9078,
7,
21,
11,
220,
18,
12587,
286,
1077,
520... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tokenizer_1word() {
let test_str = "hello";
let tokens: Vec<Token> = Tokens::from_str(test_str).collect();
assert_eq!(tokens, vec![Token::Word("hello".to_string())]);
} | rust_cleaned_test_functions.jsonl/109314 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 87
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6458,
3135,
62,
16,
1158,
368,
341,
262,
1077,
1273,
2895,
284,
330,
14990,
876,
262,
1077,
11211,
25,
11312,
83416,
29,
284,
58166,
486,
1499,
2895,
8623,
2895,
568,
17384,
543,
262,
2060,
1071... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_null_array_indices_out_of_bounds() {
let values = NullArray::new(5);
let indices = UInt32Array::from(vec![Some(0), None, Some(15)]);
let result = take(&values, &indices, Some(TakeOptions { check_bounds: true }));
assert_eq!(
result.unwrap_err().to_string(),
"Compute error: Array index out of bounds, cannot get item at index 15 from 5 entries"
);
} | rust_cleaned_test_functions.jsonl/27067 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 194
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15162,
3858,
18333,
6068,
3575,
36878,
368,
341,
286,
1077,
2750,
284,
18084,
1857,
486,
931,
7,
20,
317,
286,
1077,
14937,
284,
22275,
18,
17,
1857,
486,
1499,
25592,
20703,
8373,
7,
15,
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_detect_compiler_kind_clang() {
let f = TestFixture::new();
let creator = new_creator();
let pool = ThreadPool::sized(1);
next_command(
&creator,
Ok(MockChild::new(exit_status(0), "clang\nfoo", "")),
);
let c = detect_compiler(creator, &f.bins[0], f.tempdir.path(), &[], &pool, None)
.wait()
.unwrap()
.0;
assert_eq!(CompilerKind::C(CCompilerKind::Clang), c.kind());
} | rust_cleaned_test_functions.jsonl/89213 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 271
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56457,
80910,
33162,
6794,
524,
368,
341,
286,
1077,
282,
284,
3393,
18930,
486,
931,
543,
286,
1077,
19919,
284,
501,
68532,
543,
286,
1077,
7314,
284,
72716,
486,
82,
1506,
7,
16,
317,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_union_of_records() {
use std::iter::FromIterator;
// A and B are the same except the name.
let schema_str_a = r#"{
"name": "A",
"type": "record",
"fields": [
{"name": "field_one", "type": "float"}
]
}"#;
let schema_str_b = r#"{
"name": "B",
"type": "record",
"fields": [
{"name": "field_one", "type": "float"}
]
}"#;
let schema_str_c = r#"{
"name": "C",
"type": "record",
"fields": [
{"name": "field_one", "type": ["A", "B"]}
]
}"#;
let schema_a = Schema::parse_str(schema_str_a).unwrap();
let schema_b = Schema::parse_str(schema_str_b).unwrap();
let schema_c = Schema::parse_list(&[schema_str_a, schema_str_b, schema_str_c])
.unwrap()
.last()
.unwrap()
.clone();
let schema_c_expected = Schema::Record {
name: Name::new("C"),
doc: None,
fields: vec![RecordField {
name: "field_one".to_string(),
doc: None,
default: None,
schema: Schema::Union(UnionSchema::new(vec![schema_a, schema_b]).unwrap()),
order: RecordFieldOrder::Ignore,
position: 0,
}],
lookup: HashMap::from_iter(vec![("field_one".to_string(), 0)]),
};
assert_eq!(schema_c, schema_c_expected);
} | rust_cleaned_test_functions.jsonl/108433 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 932
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51621,
3575,
31279,
368,
341,
286,
990,
1460,
486,
2015,
486,
3830,
11951,
401,
286,
442,
362,
323,
425,
525,
279,
1852,
3650,
279,
829,
624,
286,
1077,
10802,
2895,
4306,
284,
435,
55543,
515,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vec3a_min_max() {
let a = vec3a(-1.0, 2.0, -3.0);
let b = vec3a(1.0, -2.0, 3.0);
assert_eq!((-1.0, -2.0, -3.0), a.min(b).into());
assert_eq!((-1.0, -2.0, -3.0), b.min(a).into());
assert_eq!((1.0, 2.0, 3.0), a.max(b).into());
assert_eq!((1.0, 2.0, 3.0), b.max(a).into());
} | rust_cleaned_test_functions.jsonl/23486 | {
"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,
13251,
18,
64,
7260,
6345,
368,
341,
262,
1077,
264,
284,
7486,
18,
64,
4080,
16,
13,
15,
11,
220,
17,
13,
15,
11,
481,
18,
13,
15,
317,
262,
1077,
293,
284,
7486,
18,
64,
7,
16,
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,
1... | 1 |
#[test]
fn test_all_smems() {
let text = b"ATTCGGGG$CCCCGAAT$";
let alphabet = dna::n_alphabet();
let sa = suffix_array(text);
let bwt = bwt(text, &sa);
let less = less(&bwt, &alphabet);
let occ = Occ::new(&bwt, 3, &alphabet);
let fm = FMIndex::new(&bwt, &less, &occ);
let fmdindex = FMDIndex::from(fm);
{
let pattern = b"ATTGGGG";
let intervals = fmdindex.all_smems(pattern, 0);
assert_eq!(intervals.len(), 2);
let solutions = vec![[0, 14, 0, 3], [4, 9, 3, 4]];
for (i, interval) in intervals.iter().enumerate() {
let forward_positions = interval.0.forward().occ(&sa);
let revcomp_positions = interval.0.revcomp().occ(&sa);
let pattern_position = interval.1;
let smem_len = interval.2;
assert_eq!(
[
forward_positions[0],
revcomp_positions[0],
pattern_position,
smem_len
],
solutions[i]
);
}
}
} | rust_cleaned_test_functions.jsonl/50357 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 702
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5705,
643,
10536,
82,
368,
341,
286,
1077,
1467,
284,
293,
1,
828,
7749,
22254,
22254,
3,
47932,
16128,
828,
3,
876,
286,
1077,
27790,
284,
75334,
486,
77,
8418,
18485,
543,
286,
1077,
822,
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... | 2 |
#[test]
fn test_return_stmt() {
test_walk(
"() => {return 1}",
vec![
"File",
"ExprStmt",
"FunctionExpr",
"Block",
"ReturnStmt",
"IntegerLit",
],
)
} | rust_cleaned_test_functions.jsonl/133868 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 170
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12511,
21824,
368,
341,
262,
1273,
56131,
1006,
286,
67411,
589,
314,
689,
220,
16,
24375,
286,
7486,
90515,
310,
330,
1703,
756,
310,
330,
16041,
31063,
756,
310,
330,
5152,
16041,
756,
310,
33... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_ops() {
let a = 1;
let b = 1;
let a = a ^ (b << 1);
assert_eq!(a, 3);
} | rust_cleaned_test_functions.jsonl/20025 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 83
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21959,
368,
341,
286,
1077,
264,
284,
220,
16,
280,
286,
1077,
293,
284,
220,
16,
280,
286,
1077,
264,
284,
264,
6306,
320,
65,
1115,
220,
16,
317,
286,
2060,
10714,
10297,
64,
11,
220,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_virtio_fs_hotplug_dax_on_w_virtiofsd_rs_daemon() {
test_virtio_fs(true, None, "none", &prepare_virtofsd_rs_daemon, true)
} | rust_cleaned_test_functions.jsonl/29388 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
2106,
815,
34470,
33433,
47474,
814,
706,
4470,
1670,
2273,
2106,
815,
3848,
67,
47115,
47070,
7291,
368,
341,
310,
1273,
2273,
2106,
815,
34470,
3715,
11,
2240,
11,
330,
6697,
497,
609,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_with_document() {
let schema = json!({"$ref": "http://example.json/schema.json#/rule"});
let compiled = JSONSchema::options()
.with_document(
"http://example.json/schema.json".to_string(),
json!({"rule": {"minLength": 5}}),
)
.compile(&schema)
.unwrap();
assert!(!compiled.is_valid(&json!("foo")));
assert!(compiled.is_valid(&json!("foobar")));
} | rust_cleaned_test_functions.jsonl/89820 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 251
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
26231,
368,
341,
286,
1077,
10802,
284,
2951,
0,
16864,
3,
1097,
788,
330,
1254,
1110,
8687,
4323,
61142,
4323,
69467,
12937,
27316,
286,
1077,
19697,
284,
4718,
8632,
486,
2875,
741,
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_max_events_in_batch() {
let mut qb = QueuedBatches::default();
for _ in 0..MAX_EVENTS_IN_BATCH {
qb.add_event(InputLogEvent {
..Default::default()
})
.unwrap();
// All of these events should fit in one batch
assert_eq!(qb.batches.len(), 1);
}
// Verify that adding one more event creates a new batch
qb.add_event(InputLogEvent {
..Default::default()
})
.unwrap();
assert_eq!(qb.batches.len(), 2);
} | rust_cleaned_test_functions.jsonl/96495 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 301
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6345,
19691,
1243,
14534,
368,
341,
286,
1077,
5206,
75807,
284,
9418,
3260,
33,
9118,
486,
2258,
543,
286,
369,
716,
304,
220,
15,
496,
10586,
61357,
2158,
74009,
341,
310,
75807,
1364,
6748,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_rsa_encryption() {
let key = Key::new("22081946531037833540524260580660774032207476521197121128740358761486364763467087828766873972338019078976854986531076484772771735399701424566177039926855356719497736439289455286277202113900509554266057302466528985253648318314129246825219640197356165626774276930672688973278712614800066037531599375044750753580126415613086372604312320014358994394131667022861767539879232149461579922316489532682165746762569651763794500923643656753278887871955676253526661694459370047843286685859688756429293184148202379356802488805862746046071921830921840273062124571073336369210703400985851431491295910187179045081526826572515473914151", "65537").unwrap();
let result = encrypt_hashed(b"Hello!", &key, &[0; 256]);
assert_eq!(
result,
vec![
117, 112, 45, 76, 136, 210, 155, 106, 185, 52, 53, 81, 36, 221, 40, 217, 182, 42,
71, 85, 136, 65, 200, 3, 20, 80, 247, 73, 155, 28, 156, 107, 211, 157, 39, 193, 88,
28, 81, 52, 78, 81, 193, 121, 35, 112, 100, 167, 35, 174, 147, 157, 90, 195, 80,
20, 253, 139, 79, 226, 79, 117, 227, 17, 92, 50, 161, 99, 105, 238, 43, 55, 58, 97,
236, 148, 70, 185, 43, 46, 61, 240, 118, 24, 219, 10, 138, 253, 169, 153, 182, 112,
43, 50, 181, 129, 155, 214, 234, 73, 112, 251, 52, 124, 168, 74, 96, 208, 195, 138,
183, 12, 102, 229, 237, 1, 64, 68, 136, 137, 163, 184, 130, 238, 165, 51, 186, 208,
94, 250, 32, 69, 237, 167, 23, 18, 60, 65, 74, 191, 222, 212, 62, 30, 180, 131,
160, 73, 120, 110, 245, 3, 27, 18, 213, 26, 63, 247, 236, 183, 216, 4, 212, 65, 53,
148, 95, 152, 247, 90, 74, 108, 241, 161, 223, 55, 85, 158, 48, 187, 233, 42, 75,
121, 102, 195, 79, 7, 56, 230, 209, 48, 89, 133, 119, 109, 38, 223, 171, 124, 15,
223, 215, 236, 32, 44, 199, 140, 84, 207, 130, 172, 35, 134, 199, 157, 14, 25, 117,
128, 164, 250, 148, 48, 10, 35, 130, 249, 225, 22, 254, 130, 223, 155, 216, 114,
229, 185, 218, 123, 66, 98, 35, 191, 26, 216, 88, 137, 48, 181, 30, 22, 93, 108,
221, 2
]
);
} | rust_cleaned_test_functions.jsonl/83477 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1151
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82522,
13781,
15597,
368,
341,
286,
1077,
1376,
284,
5309,
486,
931,
445,
17,
17,
15,
23,
16,
24,
19,
21,
20,
18,
16,
15,
18,
22,
23,
18,
18,
20,
19,
15,
20,
17,
19,
17,
21,
15,
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_read_map() {
assert_eq!(
read_map(&cbor_int!(123)),
Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE)
);
assert_eq!(
read_map(&cbor_bool!(true)),
Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE)
);
assert_eq!(
read_map(&cbor_text!("foo")),
Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE)
);
assert_eq!(
read_map(&cbor_bytes_lit!(b"bar")),
Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE)
);
assert_eq!(
read_map(&cbor_array![]),
Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE)
);
assert_eq!(read_map(&cbor_map! {}), Ok(&BTreeMap::new()));
assert_eq!(
read_map(&cbor_map! {
1 => cbor_false!(),
"foo" => b"bar",
b"bin" => -42,
}),
Ok(&[
(cbor_unsigned!(1), cbor_false!()),
(cbor_text!("foo"), cbor_bytes_lit!(b"bar")),
(cbor_bytes_lit!(b"bin"), cbor_int!(-42)),
]
.iter()
.cloned()
.collect::<BTreeMap<_, _>>())
);
} | rust_cleaned_test_functions.jsonl/51440 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 768
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
5376,
368,
341,
286,
2060,
10714,
33673,
310,
1349,
5376,
2099,
7221,
269,
4042,
10297,
16,
17,
18,
6965,
310,
15495,
7,
1162,
2537,
17,
9875,
48933,
868,
6735,
80002,
4189,
340,
286,
1439... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_notarization_conversion() {
let artifact = Notarization::fake(NotarizationContent::new(
Height::from(22),
CryptoHashOf::from(CryptoHash(vec![1, 2, 3])),
));
let mut buf = Vec::new();
pb::Notarization::from(&artifact).encode(&mut buf).unwrap();
assert_eq!(
artifact,
Notarization::try_from(pb::Notarization::decode(buf.as_slice()).unwrap()).unwrap()
);
} | rust_cleaned_test_functions.jsonl/92529 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 234
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7913,
277,
2022,
64132,
368,
341,
286,
1077,
36639,
284,
2806,
277,
2022,
486,
30570,
7,
2623,
277,
2022,
2762,
486,
931,
1006,
310,
21432,
486,
1499,
7,
17,
17,
1326,
310,
32886,
6370,
2124,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ray_intersection() {
let l = Arc::new(Lambert {
color: Vector3::new(1., 0., 0.),
});
let s = Sphere::new(1., Isometry3::identity(), l);
let ray = Ray {
origin: Point3::new(0., 0., 3.),
dir: Vector3::new(0., 0., -1.),
};
let i = s.hit(&ray);
assert! {i.is_some()};
let intersection = i.unwrap();
assert_eq! {intersection.toi, 2.};
assert_eq! {ray.point_at(intersection.toi), Point3::new(0., 0., 1.)};
assert_eq! {intersection.normal, Vector3::new(0., 0., 1.)};
} | rust_cleaned_test_functions.jsonl/84662 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 317
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
72690,
82558,
368,
341,
286,
1077,
326,
284,
19689,
486,
931,
4957,
2969,
529,
341,
310,
1894,
25,
4196,
18,
486,
931,
7,
16,
2572,
220,
15,
2572,
220,
15,
13,
1326,
286,
1625,
286,
1077,
27... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_proc_args_to_command() {
let proc = ProcArgs(Vec::from(EXAMPLE));
assert_eq!(
OsStr::from_bytes(b"./process_current -a -b --co=2"),
&proc.to_command()
);
} | rust_cleaned_test_functions.jsonl/76698 | {
"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,
24436,
8384,
2346,
10811,
368,
341,
286,
1077,
13674,
284,
41087,
4117,
49923,
486,
1499,
25409,
18918,
3237,
286,
2060,
10714,
33673,
310,
15433,
2580,
486,
1499,
12524,
1883,
95092,
4630,
11080,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_sel() {
assert_eq!(1.0, sel(true, 1.0, 2.0));
assert_eq!(2.0, sel(false, 1.0, 2.0));
} | rust_cleaned_test_functions.jsonl/50097 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 72
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34153,
368,
341,
262,
2060,
10714,
10297,
16,
13,
15,
11,
11806,
3715,
11,
220,
16,
13,
15,
11,
220,
17,
13,
15,
1106,
262,
2060,
10714,
10297,
17,
13,
15,
11,
11806,
3576,
11,
220,
16,
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 |
#[test]
fn test_exec_set_basic_block() {
let header = make_test_header(EndianSlice::new(&[], LittleEndian));
let mut initial_registers = LineRow::new(&header);
initial_registers.basic_block = false;
let opcode = LineInstruction::SetBasicBlock;
let mut expected_registers = initial_registers;
expected_registers.basic_block = true;
assert_exec_opcode(header, initial_registers, opcode, expected_registers, false);
} | rust_cleaned_test_functions.jsonl/3376 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 190
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18430,
2602,
34729,
7113,
368,
341,
286,
1077,
4247,
284,
1281,
4452,
8757,
7,
43231,
33236,
486,
931,
2099,
12995,
14671,
43231,
3237,
286,
1077,
5206,
2856,
78360,
284,
7083,
3102,
486,
931,
209... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_log_option() {
let (inspector, mut node) = inspector_and_list_node();
inspect_log!(node, some?: Some("a"));
inspect_log!(node, none?: None as Option<String>);
assert_inspect_tree!(inspector, root: {
list_node: {
"0": { "@time": AnyProperty, some: "a" },
"1": { "@time": AnyProperty },
}
});
} | rust_cleaned_test_functions.jsonl/90895 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 216
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5224,
9672,
368,
341,
286,
1077,
320,
1330,
18997,
11,
5206,
2436,
8,
284,
44725,
8378,
2019,
5084,
1428,
286,
24085,
5224,
10297,
3509,
11,
1045,
4820,
4329,
445,
64,
4010,
286,
24085,
5224,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_read_user() {
let user: User = read_test_file("user");
check_user_kwrobot(&user.clone().into());
assert_eq!(
user.created_at.unwrap(),
datetime((2015, 2, 26), (15, 58, 34, 670)),
);
assert_eq!(user.is_admin, None);
assert_eq!(user.highest_role, Some(AccessLevel::Owner));
assert_eq!(user.bio, Some(String::new()));
assert_eq!(user.private_profile, Some(false));
assert_eq!(user.location, None);
assert_eq!(user.public_email, Some(String::new()));
assert_eq!(user.skype, "");
assert_eq!(user.linkedin, "");
assert_eq!(user.twitter, "");
assert_eq!(user.website_url, "");
assert_eq!(user.organization, None);
} | rust_cleaned_test_functions.jsonl/12954 | {
"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,
6443,
3317,
368,
341,
262,
1077,
1196,
25,
2657,
284,
1349,
4452,
2458,
445,
872,
3071,
262,
1779,
3317,
64496,
18247,
2099,
872,
15997,
1005,
18122,
1423,
262,
2060,
10714,
33673,
286,
1196,
2306... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_nested() {
struct Foo;
impl Debug for Foo {
fn fmt(&self, fmt: &mut Formatter) {
fmt.debug_struct("Foo")
.field("bar", &true)
.field("baz", &format_args!("{}/{}", 10, 20))
.finish()
}
}
struct Bar;
impl Debug for Bar {
fn fmt(&self, fmt: &mut Formatter) {
fmt.debug_struct("Bar")
.field("foo", &Foo)
.field("hello", &"world")
.finish()
}
}
assert_eq!(
"\
Bar {
foo: Foo { bar: true, baz: 10/20 },
hello: \"world\",
}",
debug3::pprint(Bar)
);
} | rust_cleaned_test_functions.jsonl/124736 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 479
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66279,
368,
341,
286,
2036,
33428,
401,
286,
11605,
11091,
369,
33428,
341,
310,
5168,
8879,
2099,
721,
11,
8879,
25,
609,
6984,
81387,
8,
341,
394,
8879,
7883,
15126,
445,
40923,
1138,
503,
659... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_time_set_tz() {
let original = Time {
hour: 0,
minute: 0,
second: 0,
millisecond: 0,
tz_offset_hours: 0,
tz_offset_minutes: 0,
};
let expected = Time {
hour: 0,
minute: 0,
second: 0,
millisecond: 0,
tz_offset_hours: 2,
tz_offset_minutes: 30,
};
assert_eq!(expected, original.set_tz((2, 30)));
} | rust_cleaned_test_functions.jsonl/16739 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 241
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3009,
2602,
528,
89,
368,
341,
262,
1077,
4024,
284,
4120,
341,
286,
6460,
25,
220,
15,
345,
286,
9383,
25,
220,
15,
345,
286,
2086,
25,
220,
15,
345,
286,
2544,
45866,
25,
220,
15,
345,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_queue_error_display() {
let err = UsedRing(GuestMemoryError::InvalidGuestAddress(GuestAddress(0)));
let _ = format!("{}{:?}", err, err);
let err = DescIndexOutOfBounds(1);
let _ = format!("{}{:?}", err, err);
} | rust_cleaned_test_functions.jsonl/134257 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10841,
4096,
14825,
368,
341,
286,
1077,
1848,
284,
12199,
43466,
6699,
3045,
10642,
1454,
486,
7928,
37804,
4286,
6699,
3045,
4286,
7,
15,
4945,
286,
1077,
716,
284,
3561,
17223,
6257,
44986,
526... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_transaction_correct_key() {
let program_id = Pubkey::default();
let keypair0 = Keypair::new();
let id0 = keypair0.pubkey();
let ix = Instruction::new_with_bincode(program_id, &0, vec![AccountMeta::new(id0, true)]);
let message = Message::new(&[ix], Some(&id0));
let mut tx = Transaction::new_unsigned(message);
tx.sign(&[&keypair0], Hash::default());
assert_eq!(
tx.message.instructions[0],
CompiledInstruction::new(1, &0, vec![0])
);
assert!(tx.is_signed());
} | rust_cleaned_test_functions.jsonl/11242 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 280
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28884,
31550,
3097,
368,
341,
286,
1077,
2025,
842,
284,
22611,
792,
486,
2258,
543,
286,
1077,
1376,
12670,
15,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
877,
15,
284,
1376,
12670,
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_data_kind_info_try_from() {
assert_eq!(
DataKindInfo::try_from(DATA_KIND_SKIPPED).unwrap().to_kind().unwrap(),
DataKind::Skipped
);
assert_eq!(
DataKindInfo::try_from(DATA_KIND_ZEROES).unwrap().to_kind().unwrap(),
DataKind::Zeroes
);
assert_eq!(
DataKindInfo::try_from(DATA_KIND_MODIFIED).unwrap().to_kind().unwrap(),
DataKind::Modified
);
assert_eq!(
DataKindInfo::try_from(DATA_KIND_UNMODIFIED).unwrap().to_kind().unwrap(),
DataKind::Unmodified
);
assert_eq!(
DataKindInfo::try_from(DATA_KIND_MODIFIED + 1).err().unwrap(),
Error::InvalidArgument
);
assert_eq!(DataKindInfo::try_from(10).err().unwrap(), Error::InvalidArgument);
} | rust_cleaned_test_functions.jsonl/51126 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 450
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1769,
33162,
3109,
53283,
5673,
368,
341,
286,
2060,
10714,
33673,
310,
2885,
10629,
1731,
486,
1539,
5673,
59093,
72959,
34464,
35759,
1479,
568,
15454,
1005,
983,
33162,
1005,
15454,
3148,
310,
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_add_entry() {
let tx1 = build_tx(vec![(&Byte32::zero(), 1), (&Byte32::zero(), 2)], 1);
let tx1_hash = tx1.hash();
let tx2 = build_tx(vec![(&tx1_hash, 0)], 1);
let mut pool = ProposedPool::new(DEFAULT_MAX_ANCESTORS_SIZE);
pool.add_entry(TxEntry::new(
dummy_resolve(tx1.clone(), |_| None),
MOCK_CYCLES,
MOCK_FEE,
MOCK_SIZE,
))
.unwrap();
pool.add_entry(TxEntry::new(
dummy_resolve(tx2, |_| None),
MOCK_CYCLES,
MOCK_FEE,
MOCK_SIZE,
))
.unwrap();
assert_eq!(pool.size(), 2);
assert_eq!(pool.edges.outputs_len(), 2);
assert_eq!(pool.edges.inputs_len(), 2);
pool.remove_committed_tx(&tx1, &get_related_dep_out_points(&tx1, |_| None).unwrap());
assert_eq!(pool.edges.outputs_len(), 1);
assert_eq!(pool.edges.inputs_len(), 1);
} | rust_cleaned_test_functions.jsonl/50519 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 543
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
9078,
368,
341,
286,
1077,
9854,
16,
284,
1936,
17805,
25592,
20703,
2099,
7153,
18,
17,
486,
14154,
1507,
220,
16,
701,
15899,
7153,
18,
17,
486,
14154,
1507,
220,
17,
25035,
220,
16,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_client_final_missing_fields() {
assert_eq!(
parse_client_final("c=whatever,r=something").unwrap_err(),
Error::Protocol(Kind::ExpectedField(Field::Proof))
);
assert_eq!(
parse_client_final("c=whatever,p=words").unwrap_err(),
Error::Protocol(Kind::ExpectedField(Field::Nonce))
);
assert_eq!(
parse_client_final("c=whatever").unwrap_err(),
Error::Protocol(Kind::ExpectedField(Field::Nonce))
);
assert_eq!(
parse_client_final("c=").unwrap_err(),
Error::Protocol(Kind::ExpectedField(Field::Nonce))
);
assert_eq!(
parse_client_final("").unwrap_err(),
Error::Protocol(Kind::ExpectedField(Field::GS2Header))
);
assert_eq!(
parse_client_final("r=anonce").unwrap_err(),
Error::Protocol(Kind::ExpectedField(Field::GS2Header))
);
} | rust_cleaned_test_functions.jsonl/10295 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 498
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8179,
20676,
40447,
12132,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
8179,
20676,
445,
66,
28,
68286,
15883,
14149,
11532,
1827,
15454,
9266,
3148,
310,
4600,
486,
20689,
7,
10629,
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_increment_and_persist_all() {
let counter = DownloadsCounter::new();
let conn = crate::db::test_conn();
let mut state = State::new(&conn);
let v1 = state.new_version(&conn);
let v2 = state.new_version(&conn);
let v3 = state.new_version(&conn);
for _ in 0..10 {
counter.increment(v1);
}
for _ in 0..5 {
counter.increment(v2);
}
assert_eq!(15, counter.pending_count.load(Ordering::SeqCst));
// Persist everything to the database
let stats = counter
.persist_all_shards_with_conn(&conn)
.expect("failed to persist all shards");
// Ensure the stats are accurate
assert_eq!(
stats,
PersistStats {
shard: None,
counted_downloads: 15,
counted_versions: 2,
pending_downloads: 0,
}
);
// Ensure the download counts in the database are what we expect.
state.assert_downloads_count(&conn, v1, 10);
state.assert_downloads_count(&conn, v2, 5);
state.assert_downloads_count(&conn, v3, 0);
} | rust_cleaned_test_functions.jsonl/71843 | {
"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,
51482,
8378,
620,
4975,
5705,
368,
341,
286,
1077,
5546,
284,
49161,
14099,
486,
931,
543,
286,
1077,
4534,
284,
17717,
486,
1999,
486,
1944,
17241,
543,
286,
1077,
5206,
1584,
284,
3234,
486,
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... | 3 |
#[test]
fn test_create_stakes() {
// 2 unlocks
let rent = Rent {
lamports_per_byte_year: 1,
exemption_threshold: 1.0,
..Rent::default()
};
let reserve = StakeState::get_rent_exempt_reserve(&rent);
let staker_reserve = rent.minimum_balance(0);
// verify that a small remainder ends up in the last stake
let granularity = reserve;
let total_lamports = staker_reserve + reserve * 2 + 1;
create_and_check_stakes(
&mut GenesisConfig {
rent,
..GenesisConfig::default()
},
&StakerInfo {
name: "fun",
staker: "P1aceHo1derPubkey11111111111111111111111111",
tock: total_lamports,
withdrawer: None,
},
&UnlockInfo {
cliff_fraction: 0.5,
cliff_years: 0.5,
unlocks: 1,
unlock_years: 0.5,
custodian: "11111111111111111111111111111111",
},
total_lamports,
granularity,
2 + 1,
);
// huge granularity doesn't blow up
let granularity = std::u64::MAX;
let total_lamports = staker_reserve + reserve * 2 + 1;
create_and_check_stakes(
&mut GenesisConfig {
rent,
..GenesisConfig::default()
},
&StakerInfo {
name: "fun",
staker: "P1aceHo1derPubkey11111111111111111111111111",
tock: total_lamports,
withdrawer: None,
},
&UnlockInfo {
cliff_fraction: 0.5,
cliff_years: 0.5,
unlocks: 1,
unlock_years: 0.5,
custodian: "11111111111111111111111111111111",
},
total_lamports,
granularity,
2 + 1,
);
let granularity = reserve * 3;
let total_lamports = staker_reserve + (granularity + reserve) * 2;
create_and_check_stakes(
&mut GenesisConfig {
rent,
..GenesisConfig::default()
},
&StakerInfo {
name: "fun",
staker: "P1aceHo1derPubkey11111111111111111111111111",
tock: total_lamports,
withdrawer: None,
},
&UnlockInfo {
cliff_fraction: 0.5,
cliff_years: 0.5,
unlocks: 1,
unlock_years: 0.5,
custodian: "11111111111111111111111111111111",
},
total_lamports,
granularity,
2 + 1,
);
let granularity = reserve * 3;
let total_lamports = staker_reserve + (granularity + reserve + 1) * 2;
create_and_check_stakes(
&mut GenesisConfig {
rent,
..GenesisConfig::default()
},
&StakerInfo {
name: "fun",
staker: "P1aceHo1derPubkey11111111111111111111111111",
tock: total_lamports,
withdrawer: None,
},
&UnlockInfo {
cliff_fraction: 0.5,
cliff_years: 0.5,
unlocks: 1,
unlock_years: 0.5,
custodian: "11111111111111111111111111111111",
},
total_lamports,
granularity,
4 + 1,
);
} | rust_cleaned_test_functions.jsonl/36426 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2111
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
1261,
2050,
368,
341,
286,
442,
220,
17,
73191,
271,
286,
1077,
8016,
284,
29737,
341,
310,
31603,
3394,
5678,
19737,
14645,
25,
220,
16,
345,
310,
44698,
21858,
25,
220,
16,
13,
15,
345... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_call_expr() {
test_walk(
"b(a:1)",
vec![
"File",
"ExprStmt",
"CallExpr",
"IdentifierExpr",
"Property",
"Identifier",
"IntegerLit",
],
)
} | rust_cleaned_test_functions.jsonl/3326 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 288
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13429,
21915,
368,
341,
310,
1273,
56131,
1006,
394,
330,
65,
2877,
25,
16,
15752,
394,
7486,
90515,
503,
330,
1703,
756,
503,
330,
16041,
31063,
756,
503,
330,
7220,
16041,
756,
503,
330,
8714,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_mismatched_length() {
let a = Primitive::from_slice(vec![5, 6]).to(DataType::Int32);
let b = Primitive::from_slice(vec![5]).to(DataType::Int32);
mul(&a, &b)
.err()
.expect("should have failed due to different lengths");
} | rust_cleaned_test_functions.jsonl/12700 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 147
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24944,
717,
24976,
291,
5118,
368,
341,
286,
1077,
264,
284,
51460,
486,
1499,
26488,
25592,
20703,
20,
11,
220,
21,
10697,
983,
63941,
486,
1072,
18,
17,
317,
286,
1077,
293,
284,
51460,
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_cast_i64_to_bool() {
let t_i64: Tensor = tensor1(&[0i64]);
t_i64.cast_to::<bool>().unwrap();
} | rust_cleaned_test_functions.jsonl/4233 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 79
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5303,
5318,
21,
19,
2346,
22159,
368,
341,
286,
1077,
259,
5318,
21,
19,
25,
26036,
284,
15626,
16,
2099,
58,
15,
72,
21,
19,
2558,
286,
259,
5318,
21,
19,
35091,
2346,
27638,
2641,
10483,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_wigner_6j() {
let tj_max = 15;
let mut f = md5::Context::new();
get_6tjs(tj_max, &mut |w6j| {
let w = w6j.value();
write!(
f,
"{}\t{}\t{}\t{}\t{}\t{}\t{}\n",
w6j.tj1, w6j.tj2, w6j.tj3,
w6j.tj4, w6j.tj5, w6j.tj6,
RenderValue(&w),
).unwrap();
});
assert_eq!(&format!("{:x}", f.compute()),
*lookup(W6J_HASHES, &tj_max).expect("hash not available"));
} | rust_cleaned_test_functions.jsonl/80983 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 320
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1670,
77656,
62,
21,
73,
368,
341,
262,
1077,
65254,
6345,
284,
220,
16,
20,
280,
262,
1077,
5206,
282,
284,
10688,
20,
486,
1972,
486,
931,
543,
262,
633,
62,
21,
83,
2519,
1155,
73,
6345,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_primitive_array_builder() {
// Test building a primitive array with ArrayData builder and offset
let buf = Buffer::from(&[0, 1, 2, 3, 4].to_byte_slice());
let buf2 = buf.clone();
let data = ArrayData::builder(DataType::Int32)
.len(5)
.offset(2)
.add_buffer(buf)
.build();
let arr = Int32Array::from(data);
assert_eq!(buf2, arr.values());
assert_eq!(5, arr.len());
assert_eq!(0, arr.null_count());
for i in 0..3 {
assert_eq!((i + 2) as i32, arr.value(i));
}
} | rust_cleaned_test_functions.jsonl/11598 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 319
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84087,
3858,
28532,
368,
341,
286,
442,
3393,
4752,
264,
27594,
1334,
448,
2910,
1043,
7363,
323,
4347,
198,
286,
1077,
6607,
284,
10312,
486,
1499,
2099,
58,
15,
11,
220,
16,
11,
220,
17,
11,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_add_and_find()
{
let mut t = Inferator::new("burritos");
t.bind_vartype(&Lstr::Sref("a"), &Type::Int, 18).unwrap();
assert_eq!(Type::Int, t.vartype("a").unwrap());
} | rust_cleaned_test_functions.jsonl/15069 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
8378,
21814,
741,
262,
341,
286,
1077,
5206,
259,
284,
62658,
850,
486,
931,
445,
11240,
94012,
797,
286,
259,
6090,
2273,
471,
499,
2099,
43,
495,
486,
50,
1097,
445,
64,
3975,
609,
929... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_jarsigner() {
// Creates a temporary directory
let tempdir = tempfile::tempdir().unwrap();
let aab_build_dir = tempdir.path();
// Assigns configuration for aab generation
let sdk = AndroidSdk::from_env().unwrap();
let package_name = "minimal_unsigned_aab";
let target_sdk_version = 30;
// Generates minimal unsigned aab
let aab_path =
gen_minimal_unsigned_aab(sdk, package_name, target_sdk_version, aab_build_dir).unwrap();
// Removes old keystore if it exists
let android_dir = android_dir().unwrap();
let target = vec![android_dir.join("aab.keystore")];
remove(target).unwrap();
// Creates new keystore to sign aab
let aab_key = AabKey::default();
let key_path = gen_aab_key(aab_key).unwrap();
// Signs aab with key
jarsigner(&aab_path, &key_path).unwrap();
} | rust_cleaned_test_functions.jsonl/79248 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 420
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5374,
1561,
77656,
368,
341,
286,
442,
14684,
264,
13340,
6220,
198,
286,
1077,
2730,
3741,
284,
54819,
486,
3888,
3741,
1005,
15454,
543,
286,
1077,
264,
370,
20801,
4334,
284,
2730,
3741,
3875,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_select_only_values() -> Result<()> {
let values = SqlBuilder::select_values(&["10", "e("100")]).sql()?;
assert_eq!("SELECT 10, '100';", &values);
Ok(())
} | rust_cleaned_test_functions.jsonl/12585 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 97
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13051,
18410,
9146,
368,
1464,
5714,
71698,
341,
286,
1077,
2750,
284,
7224,
3297,
486,
1742,
9146,
2099,
1183,
16,
15,
497,
609,
2949,
445,
16,
15,
15,
899,
10697,
3544,
368,
69493,
286,
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
] | 2 |
#[test]
fn test_get_networking_status() {
let (client, single) = Client::init().unwrap();
std::thread::spawn(move || single.run_callbacks());
let utils = client.networking_utils();
let status = utils.detailed_relay_network_status();
println!(
"status: {:?}, network_config: {:?}, any_relay: {:?}, message: {}",
status.availability(),
status.network_config(),
status.any_relay(),
status.debugging_message()
);
utils.init_relay_network_access();
let status = utils.detailed_relay_network_status();
println!(
"status: {:?}, network_config: {:?}, any_relay: {:?}, message: {}",
status.availability(),
status.network_config(),
status.any_relay(),
status.debugging_message()
);
std::thread::sleep(Duration::from_millis(500));
let status = utils.detailed_relay_network_status();
println!(
"status: {:?}, network_config: {:?}, any_relay: {:?}, message: {}",
status.availability(),
status.network_config(),
status.any_relay(),
status.debugging_message()
);
} | rust_cleaned_test_functions.jsonl/94956 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 593
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
20966,
287,
4773,
368,
341,
286,
1077,
320,
2972,
11,
3175,
8,
284,
8423,
486,
2327,
1005,
15454,
543,
286,
1460,
486,
4528,
486,
46087,
34081,
1369,
3175,
7634,
60148,
5231,
286,
1077,
12... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_program_bpf_call_depth() {
solana_logger::setup();
let GenesisConfigInfo {
genesis_config,
mint_keypair,
..
} = create_genesis_config(50);
let mut bank = Bank::new_for_tests(&genesis_config);
let (name, id, entrypoint) = solana_bpf_loader_program!();
bank.add_builtin(&name, &id, entrypoint);
let bank_client = BankClient::new(bank);
let program_id = load_bpf_program(
&bank_client,
&bpf_loader::id(),
&mint_keypair,
"solana_bpf_rust_call_depth",
);
let instruction = Instruction::new_with_bincode(
program_id,
&(ComputeBudget::default().max_call_depth - 1),
vec![],
);
let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction);
assert!(result.is_ok());
let instruction =
Instruction::new_with_bincode(program_id, &ComputeBudget::default().max_call_depth, vec![]);
let result = bank_client.send_and_confirm_instruction(&mint_keypair, instruction);
assert!(result.is_err());
} | rust_cleaned_test_functions.jsonl/5745 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 462
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25096,
880,
15897,
13429,
19061,
368,
341,
262,
2048,
3362,
27413,
486,
15188,
1428,
262,
1077,
40788,
2648,
1731,
341,
286,
59366,
5332,
345,
286,
28337,
3097,
12670,
345,
286,
54538,
262,
335,
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_onix3_oapen_contributions() {
let mut test_contribution = WorkContributions {
contribution_type: ContributionType::AUTHOR,
first_name: Some("Author".to_string()),
last_name: "1".to_string(),
full_name: "Author 1".to_string(),
main_contribution: true,
biography: None,
contribution_ordinal: 1,
contributor: WorkContributionsContributor {
orcid: Some(Orcid::from_str("https://orcid.org/0000-0002-0000-0001").unwrap()),
},
affiliations: vec![],
};
// Test standard output
let output = generate_test_output(&test_contribution);
assert!(output.contains(r#" <SequenceNumber>1</SequenceNumber>"#));
assert!(output.contains(r#" <ContributorRole>A01</ContributorRole>"#));
assert!(output.contains(r#" <NameIdentifier>"#));
assert!(output.contains(r#" <NameIDType>21</NameIDType>"#));
assert!(output.contains(r#" <IDValue>0000-0002-0000-0001</IDValue>"#));
assert!(output.contains(r#" </NameIdentifier>"#));
// Given name is output as NamesBeforeKey and family name as KeyNames
assert!(output.contains(r#" <NamesBeforeKey>Author</NamesBeforeKey>"#));
assert!(output.contains(r#" <KeyNames>1</KeyNames>"#));
// PersonName is not output when given name is supplied
assert!(!output.contains(r#" <PersonName>Author 1</PersonName>"#));
// Change all possible values to test that output is updated
test_contribution.contribution_type = ContributionType::EDITOR;
test_contribution.contribution_ordinal = 2;
test_contribution.contributor.orcid = None;
test_contribution.first_name = None;
let output = generate_test_output(&test_contribution);
assert!(output.contains(r#" <SequenceNumber>2</SequenceNumber>"#));
assert!(output.contains(r#" <ContributorRole>B01</ContributorRole>"#));
// No ORCID supplied
assert!(!output.contains(r#" <NameIdentifier>"#));
assert!(!output.contains(r#" <NameIDType>21</NameIDType>"#));
assert!(!output.contains(r#" <IDValue>0000-0002-0000-0001</IDValue>"#));
assert!(!output.contains(r#" </NameIdentifier>"#));
assert!(!output.contains(r#" <NamesBeforeKey>Author</NamesBeforeKey>"#));
assert!(!output.contains(r#" <KeyNames>1</KeyNames>"#));
assert!(output.contains(r#" <PersonName>Author 1</PersonName>"#));
// All roles except Author and Editor are output as Z01
for contribution_type in [
ContributionType::TRANSLATOR,
ContributionType::PHOTOGRAPHER,
ContributionType::ILUSTRATOR,
ContributionType::MUSIC_EDITOR,
ContributionType::FOREWORD_BY,
ContributionType::INTRODUCTION_BY,
ContributionType::AFTERWORD_BY,
ContributionType::PREFACE_BY,
] {
test_contribution.contribution_type = contribution_type;
let output = generate_test_output(&test_contribution);
assert!(output.contains(r#" <ContributorRole>Z01</ContributorRole>"#));
}
} | rust_cleaned_test_functions.jsonl/67619 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1446
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4470,
941,
18,
14179,
391,
268,
92581,
3977,
368,
341,
286,
1077,
5206,
1273,
3382,
31140,
284,
5547,
52984,
3977,
341,
310,
18527,
1819,
25,
93528,
929,
486,
26694,
868,
345,
310,
1156,
1269,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_normalized_newlines_stdout_is() {
let res = CmdResult {
bin_path: "".into(),
util_name: None,
tmpd: None,
code: None,
success: true,
stdout: "A\r\nB\nC".into(),
stderr: "".into(),
};
res.normalized_newlines_stdout_is("A\r\nB\nC");
res.normalized_newlines_stdout_is("A\nB\nC");
res.normalized_newlines_stdout_is("A\nB\r\nC");
} | rust_cleaned_test_functions.jsonl/12800 | {
"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,
80006,
5921,
7969,
67416,
6892,
368,
341,
286,
1077,
592,
284,
40210,
2077,
341,
310,
9544,
2638,
25,
44907,
18122,
3148,
310,
4094,
1269,
25,
2240,
345,
310,
4174,
67,
25,
2240,
345,
310,
2038,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_json_rpc_protocol() {
let address = format!("0.0.0.0:{}", utils::get_available_port());
let mock_db = mock_db();
let mp_sender = channel(1024).0;
let _runtime = bootstrap(address.parse().unwrap(), Arc::new(mock_db), mp_sender);
let client = reqwest::blocking::Client::new();
// check that only root path is accessible
let url = format!("http://{}/fake_path", address);
let resp = client.get(&url).send().unwrap();
assert_eq!(resp.status(), 404);
// only post method is allowed
let url = format!("http://{}", address);
let resp = client.get(&url).send().unwrap();
assert_eq!(resp.status(), 405);
// empty payload is not allowed
let resp = client.post(&url).send().unwrap();
assert_eq!(resp.status(), 400);
// non json payload
let resp = client.post(&url).body("non json").send().unwrap();
assert_eq!(resp.status(), 400);
// invalid version of protocol
let request = serde_json::json!({"jsonrpc": "1.0", "method": "add", "params": [1, 2], "id": 1});
let resp = client.post(&url).json(&request).send().unwrap();
assert_eq!(resp.status(), 200);
assert_eq!(fetch_error(resp), -32600);
// invalid request id
let request =
serde_json::json!({"jsonrpc": "2.0", "method": "add", "params": [1, 2], "id": true});
let resp = client.post(&url).json(&request).send().unwrap();
assert_eq!(resp.status(), 200);
assert_eq!(fetch_error(resp), -32600);
// invalid rpc method
let request = serde_json::json!({"jsonrpc": "2.0", "method": "add", "params": [1, 2], "id": 1});
let resp = client.post(&url).json(&request).send().unwrap();
assert_eq!(resp.status(), 200);
assert_eq!(fetch_error(resp), -32601);
// invalid arguments
let request = serde_json::json!({"jsonrpc": "2.0", "method": "get_account_state", "params": [1, 2], "id": 1});
let resp = client.post(&url).json(&request).send().unwrap();
assert_eq!(resp.status(), 200);
assert_eq!(fetch_error(resp), -32000);
} | rust_cleaned_test_functions.jsonl/72850 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 795
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9455,
60799,
34880,
368,
341,
262,
1077,
2621,
284,
3561,
17223,
15,
13,
15,
13,
15,
13,
15,
25,
42351,
12439,
486,
455,
26962,
8716,
1423,
262,
1077,
7860,
8685,
284,
7860,
8685,
543,
262,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_emit_movsx() {
assert_emit!(0x48, 0x63, 0xc0; emit_movsx(RAX, RAX));
assert_emit!(0x4c, 0x63, 0xc8; emit_movsx(RAX, R9));
assert_emit!(0x4c, 0x63, 0xf8; emit_movsx(RAX, R15));
assert_emit!(0x49, 0x63, 0xc2; emit_movsx(R10, RAX));
assert_emit!(0x4d, 0x63, 0xfe; emit_movsx(R14, R15));
} | rust_cleaned_test_functions.jsonl/85482 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 226
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
69082,
55798,
48612,
368,
341,
286,
2060,
69082,
10297,
15,
87,
19,
23,
11,
220,
15,
87,
21,
18,
11,
220,
15,
8148,
15,
26,
16691,
55798,
48612,
2785,
2954,
11,
431,
2954,
1106,
286,
2060,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_into_inner_poison() {
let m = Arc::new(RwLock::new(NonCopy(10)));
let m2 = m.clone();
let _ = thread::spawn(move || {
let _lock = m2.write().unwrap();
panic!("test panic in inner thread to poison RwLock");
}).join();
assert!(m.is_poisoned());
match Arc::try_unwrap(m).unwrap().into_inner() {
Err(e) => assert_eq!(e.into_inner(), NonCopy(10)),
Ok(x) => panic!("into_inner of poisoned RwLock is Ok: {:?}", x),
}
} | rust_cleaned_test_functions.jsonl/5888 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 272
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45514,
34345,
61814,
3335,
368,
341,
286,
1077,
296,
284,
19689,
486,
931,
2785,
86,
11989,
486,
931,
7,
8121,
12106,
7,
16,
15,
4945,
286,
1077,
296,
17,
284,
296,
15997,
543,
286,
1077,
716,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_from_angle_y_rotate_vector1() {
let rotation = Rotation3::from_angle_y(Degrees(90_f64));
let vector = Vector3::unit_z();
let expected = Vector3::unit_x();
let result = rotation.rotate_vector(&vector);
assert!(relative_eq!(result, expected, epsilon = 1e-8));
} | rust_cleaned_test_functions.jsonl/70491 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 147
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
21727,
4178,
60834,
12247,
16,
368,
341,
286,
1077,
12695,
284,
47528,
18,
486,
1499,
21727,
4178,
5432,
791,
7858,
7,
24,
15,
761,
21,
19,
1106,
286,
1077,
4621,
284,
4196,
18,
486,
384... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parser_all() {
let src = r#"
This is the headline.
This is the description.
## Parameters
- this is _parameter_ 1.
Description of one.
- this is parameter 2.
Description of two.
## Examples
### Example 1
Subtraction:
```
3 - 2
```
### Example 2
Addition:
```
1 + 1
```
## Metadata
k1: v1
k2: v2
k3: v3
"#;
assert_parser(
&src,
vec![
Token::Headline("This is the headline."),
Token::Description("This is the description."),
Token::Parameters,
Token::Parameter,
Token::ParamHeadline("this is _parameter_ 1."),
Token::ParamDescription("Description of one."),
Token::Parameter,
Token::ParamHeadline("this is parameter 2."),
Token::ParamDescription("Description of two."),
Token::Examples,
Token::ExampleTitle("### Example 1"),
Token::ExampleContent(
r#"Subtraction:
```
3 - 2
```"#,
),
Token::ExampleTitle("### Example 2"),
Token::ExampleContent(
r#"Addition:
```
1 + 1
```"#,
),
Token::Metadata,
Token::MetadataLine("k1: v1"),
Token::MetadataLine("k2: v2"),
Token::MetadataLine("k3: v3"),
],
);
} | rust_cleaned_test_functions.jsonl/10008 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 785
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18517,
5705,
368,
341,
286,
1077,
2286,
284,
435,
2,
698,
1986,
374,
279,
31163,
382,
1986,
374,
279,
4008,
382,
565,
13522,
271,
12,
419,
374,
716,
16181,
62,
220,
16,
382,
262,
7662,
315,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_expired_proposal() {
let mut context = VMContextBuilder::new();
testing_env!(context.predecessor_account_id(accounts(1)).build());
let mut contract = Contract::new(
Config::test_config(),
VersionedPolicy::Default(vec![accounts(1).into()]),
);
let id = create_proposal(&mut context, &mut contract);
testing_env!(context
.block_timestamp(1_000_000_000 * 24 * 60 * 60 * 8)
.build());
contract.act_proposal(id, Action::VoteApprove, None);
} | rust_cleaned_test_functions.jsonl/16637 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 260
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54360,
80221,
21663,
32556,
368,
341,
286,
1077,
5206,
2266,
284,
17792,
1972,
3297,
486,
931,
543,
286,
7497,
15879,
10297,
2147,
6225,
26911,
269,
13500,
842,
91868,
7,
16,
4579,
5834,
1423,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hex_from_string() {
assert_eq_dbg!(Addr(0), "0".parse().unwrap());
assert_eq_dbg!(Addr(42), "42".parse().unwrap());
assert_eq_dbg!(Addr(42), "0x2a".parse().unwrap());
assert_eq_dbg!(Addr(42), "0X2A".parse().unwrap());
} | rust_cleaned_test_functions.jsonl/57485 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 129
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32655,
5673,
3904,
368,
341,
262,
2060,
10714,
44124,
10297,
13986,
7,
15,
701,
330,
15,
3263,
6400,
1005,
15454,
1423,
262,
2060,
10714,
44124,
10297,
13986,
7,
19,
17,
701,
330,
19,
17,
3263,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_election_post_circuit_poseidon() {
test_election_post_circuit::<LCTree<PoseidonHasher, U8, U0, U0>>(22_940);
} | rust_cleaned_test_functions.jsonl/105079 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 65
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2204,
1170,
6333,
666,
37268,
33201,
90456,
368,
341,
262,
1273,
2204,
1170,
6333,
666,
37268,
27638,
43,
1162,
765,
21604,
960,
90456,
6370,
261,
11,
547,
23,
11,
547,
15,
11,
547,
15,
25526,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_gauge() -> Result<(), MetricForwarderError> {
let input = [
"MONITORING",
"cool_service",
"2017-04-26T10:41:09.023Z",
"some_\tstr:12345.6|g",
];
let expected = Metric::Gauge(Gauge {
value: 12345.6,
sample_rate: None,
});
let parsed = expect_metric(&input, expected)?;
assert_eq!(parsed.msg.name, "some_\tstr");
Ok(())
} | rust_cleaned_test_functions.jsonl/132009 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 272
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1889,
19392,
368,
1464,
5714,
68843,
52458,
25925,
261,
1454,
29,
341,
286,
1077,
1946,
284,
2278,
310,
330,
21344,
44556,
1718,
756,
310,
330,
42196,
12267,
756,
310,
330,
17,
15,
16,
22,
12,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_host_slaac_and_manual_address_and_prefix_conflict() {
// SLAAC should not overwrite any manually added addresses that may
// conflict with the generated SLAAC address.
let config = Ipv6::DUMMY_CONFIG;
let mut ctx = DummyEventDispatcherBuilder::default().build::<DummyEventDispatcher>();
let device =
ctx.state_mut().add_ethernet_device(config.local_mac, Ipv6::MINIMUM_LINK_MTU.into());
crate::device::initialize_device(&mut ctx, device);
let src_mac = config.remote_mac;
let src_ip = src_mac.to_ipv6_link_local().addr().get();
let prefix = Ipv6Addr::new([1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0]);
let prefix_length = 64;
let mut expected_addr = [1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0];
expected_addr[8..].copy_from_slice(&config.local_mac.to_eui64()[..]);
let expected_addr = UnicastAddr::new(Ipv6Addr::new(expected_addr)).unwrap();
let expected_addr_sub = AddrSubnet::from_witness(expected_addr, prefix_length).unwrap();
// Manually give the device the expected address/subnet
add_ip_addr_subnet(&mut ctx, device, expected_addr_sub.into_witness()).unwrap();
assert_eq!(
NdpContext::<EthernetLinkDevice>::get_ipv6_addr_entries(&ctx, device.id().into())
.count(),
1
);
let entry =
NdpContext::<EthernetLinkDevice>::get_ipv6_addr_entries(&ctx, device.id().into())
.last()
.unwrap();
assert_eq!(entry.state(), AddressState::Assigned);
assert_eq!(entry.config_type(), AddrConfigType::Manual);
assert_eq!(ctx.dispatcher().timer_events().count(), 0);
// Should not get a new IP.
let mut icmpv6_packet_buf = slaac_packet_buf(
src_ip,
config.local_ip.get(),
prefix,
prefix_length,
false,
true,
10000,
9000,
);
let icmpv6_packet = icmpv6_packet_buf
.parse_with::<_, Icmpv6Packet<_>>(IcmpParseArgs::new(src_ip, config.local_ip))
.unwrap();
ctx.receive_ndp_packet(
device,
src_ip.try_into().unwrap(),
config.local_ip,
icmpv6_packet.unwrap_ndp(),
);
// Address state and configuration type should not have changed.
assert_eq!(
NdpContext::<EthernetLinkDevice>::get_ipv6_addr_entries(&ctx, device.id().into())
.count(),
1
);
let entry =
NdpContext::<EthernetLinkDevice>::get_ipv6_addr_entries(&ctx, device.id().into())
.last()
.unwrap();
assert_eq!(*entry.addr_sub(), expected_addr_sub);
assert_eq!(entry.state(), AddressState::Assigned);
assert_eq!(entry.config_type(), AddrConfigType::Manual);
// No new timers were added.
assert_eq!(ctx.dispatcher().timer_events().count(), 0);
} | rust_cleaned_test_functions.jsonl/82828 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1537
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12848,
643,
4260,
580,
8378,
75428,
6744,
8378,
13974,
16059,
21242,
368,
341,
286,
442,
16797,
96710,
1265,
537,
32216,
894,
20083,
3694,
14230,
429,
1231,
198,
286,
442,
12055,
448,
279,
7907,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_supplicant_wpa2_ccmp128_psk() {
// Create ESS Security Association
let mut supplicant = test_util::get_wpa2_supplicant();
supplicant.start().expect("Failed starting Supplicant");
// Send first message
let (result, updates) = send_fourway_msg1(&mut supplicant, |_| {});
assert!(result.is_ok());
// Verify 2nd message.
let msg2_buf = expect_eapol_resp(&updates[..]);
let msg2 = msg2_buf.keyframe();
let s_rsne = fake_wpa2_s_rsne();
let s_rsne_data = get_rsn_ie_bytes(&s_rsne);
assert_eq!({ msg2.eapol_fields.version }, eapol::ProtocolVersion::IEEE802DOT1X2001);
assert_eq!({ msg2.eapol_fields.packet_type }, eapol::PacketType::KEY);
let mut buf = vec![];
msg2.write_into(false, &mut buf).expect("error converting message to bytes");
assert_eq!(msg2.eapol_fields.packet_body_len.to_native() as usize, buf.len() - 4);
assert_eq!({ msg2.key_frame_fields.descriptor_type }, eapol::KeyDescriptor::IEEE802DOT11);
assert_eq!(msg2.key_frame_fields.key_info(), eapol::KeyInformation(0x010A));
assert_eq!(msg2.key_frame_fields.key_len.to_native(), 0);
assert_eq!(msg2.key_frame_fields.key_replay_counter.to_native(), 1);
assert!(!test_util::is_zero(&msg2.key_frame_fields.key_nonce[..]));
assert!(test_util::is_zero(&msg2.key_frame_fields.key_iv[..]));
assert_eq!(msg2.key_frame_fields.key_rsc.to_native(), 0);
assert!(!test_util::is_zero(&msg2.key_mic[..]));
assert_eq!(msg2.key_mic.len(), test_util::mic_len());
assert_eq!(msg2.key_data.len(), 20);
assert_eq!(&msg2.key_data[..], &s_rsne_data[..]);
// Send 3rd message.
let snonce = msg2.key_frame_fields.key_nonce;
let ptk = test_util::get_ptk(&ANONCE[..], &snonce[..]);
let (result, updates) = send_fourway_msg3(&mut supplicant, &ptk, |_| {});
assert!(result.is_ok());
// Verify 4th message was received and is correct.
let msg4_buf = expect_eapol_resp(&updates[..]);
let msg4 = msg4_buf.keyframe();
assert_eq!({ msg4.eapol_fields.version }, eapol::ProtocolVersion::IEEE802DOT1X2001);
assert_eq!({ msg4.eapol_fields.packet_type }, eapol::PacketType::KEY);
assert_eq!(msg4.eapol_fields.packet_body_len.to_native() as usize, &msg4_buf[..].len() - 4);
assert_eq!({ msg4.key_frame_fields.descriptor_type }, eapol::KeyDescriptor::IEEE802DOT11);
assert_eq!(msg4.key_frame_fields.key_info(), eapol::KeyInformation(0x030A));
assert_eq!(msg4.key_frame_fields.key_len.to_native(), 0);
assert_eq!(msg4.key_frame_fields.key_replay_counter.to_native(), 2);
assert!(test_util::is_zero(&msg4.key_frame_fields.key_nonce[..]));
assert!(test_util::is_zero(&msg4.key_frame_fields.key_iv[..]));
assert_eq!(msg4.key_frame_fields.key_rsc.to_native(), 0);
assert!(!test_util::is_zero(&msg4.key_mic[..]));
assert_eq!(msg4.key_mic.len(), test_util::mic_len());
assert_eq!(msg4.key_data.len(), 0);
assert!(test_util::is_zero(&msg4.key_data[..]));
// Verify the message's MIC.
let mic = compute_mic(ptk.kck(), &test_util::get_rsne_protection(), &msg4)
.expect("error computing MIC");
assert_eq!(&msg4.key_mic[..], &mic[..]);
// Verify PTK was reported.
let reported_ptk = test_util::expect_reported_ptk(&updates[..]);
assert_eq!(ptk.ptk, reported_ptk.ptk);
// Verify GTK was reported.
let reported_gtk = test_util::expect_reported_gtk(&updates[..]);
assert_eq!(>K[..], &reported_gtk.gtk[..]);
// Verify ESS was reported to be established.
let reported_status =
test_util::expect_reported_status(&updates[..], SecAssocStatus::EssSaEstablished);
assert_eq!(reported_status, SecAssocStatus::EssSaEstablished);
// Cause re-keying of GTK via Group-Key Handshake.
let (result, updates) = send_group_key_msg1(&mut supplicant, &ptk, GTK_REKEY, 3, 3);
assert!(result.is_ok());
// Verify 2th message was received and is correct.
let msg2_buf = expect_eapol_resp(&updates[..]);
let msg2 = msg2_buf.keyframe();
assert_eq!({ msg2.eapol_fields.version }, eapol::ProtocolVersion::IEEE802DOT1X2001);
assert_eq!({ msg2.eapol_fields.packet_type }, eapol::PacketType::KEY);
assert_eq!(msg2.eapol_fields.packet_body_len.to_native() as usize, &msg2_buf[..].len() - 4);
assert_eq!({ msg2.key_frame_fields.descriptor_type }, eapol::KeyDescriptor::IEEE802DOT11);
assert_eq!(msg2.key_frame_fields.key_info(), eapol::KeyInformation(0x0302));
assert_eq!(msg2.key_frame_fields.key_len.to_native(), 0);
assert_eq!(msg2.key_frame_fields.key_replay_counter.to_native(), 3);
assert!(test_util::is_zero(&msg2.key_frame_fields.key_nonce[..]));
assert!(test_util::is_zero(&msg2.key_frame_fields.key_iv[..]));
assert_eq!(msg2.key_frame_fields.key_rsc.to_native(), 0);
assert!(!test_util::is_zero(&msg2.key_mic[..]));
assert_eq!(msg2.key_mic.len(), test_util::mic_len());
assert_eq!(msg2.key_data.len(), 0);
assert!(test_util::is_zero(&msg2.key_data[..]));
// Verify the message's MIC.
let mic = compute_mic(ptk.kck(), &test_util::get_rsne_protection(), &msg2)
.expect("error computing MIC");
assert_eq!(&msg2.key_mic[..], &mic[..]);
// Verify PTK was NOT re-installed.
assert_eq!(test_util::get_reported_ptk(&updates[..]), None);
// Verify GTK was installed.
let reported_gtk = test_util::expect_reported_gtk(&updates[..]);
assert_eq!(>K_REKEY[..], &reported_gtk.gtk[..]);
} | rust_cleaned_test_functions.jsonl/21804 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2718
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
91480,
35237,
1670,
6595,
17,
28955,
1307,
16,
17,
23,
620,
4886,
368,
341,
286,
442,
4230,
468,
1220,
8234,
10024,
198,
286,
1077,
5206,
90035,
35237,
284,
1273,
18974,
486,
455,
1670,
6595,
17... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_committed_head_one_committed() {
let mut block_tree = create_block_tree();
block_tree.mark_as_committed(id(7), ()).unwrap();
assert_eq!(
block_tree.get_committed_head(&block_tree.heads),
Some(id(6)),
);
} | rust_cleaned_test_functions.jsonl/87725 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 122
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
2965,
5483,
13138,
11667,
2965,
5483,
368,
341,
262,
1077,
5206,
2504,
11663,
284,
1855,
7113,
11663,
543,
262,
2504,
11663,
18406,
11898,
2965,
5483,
3724,
7,
22,
701,
1719,
568,
15454,
543... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mkfifo_directory() {
// mkfifo should fail if a directory is given
assert!(mkfifo(&env::temp_dir(), Mode::S_IRUSR).is_err());
} | rust_cleaned_test_functions.jsonl/8987 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 67
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64861,
74031,
14846,
368,
341,
262,
442,
23789,
74031,
1265,
3690,
421,
264,
6220,
374,
2661,
198,
262,
2060,
10297,
24452,
74031,
2099,
3160,
486,
3888,
4334,
1507,
14562,
486,
50,
17138,
49558,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_assignment_expression() {
expect_printed("a = 1", "a = 1;\n");
expect_printed("a = 3 * 3", "a = 3 * 3;\n");
expect_printed("a += 1", "a += 1;\n");
expect_printed("a += 3 * 3", "a += 3 * 3;\n");
expect_printed("a -= 1", "a -= 1;\n");
expect_printed("a -= 3 * 3", "a -= 3 * 3;\n");
expect_printed("a *= 1", "a *= 1;\n");
expect_printed("a *= 3 * 3", "a *= 3 * 3;\n");
expect_printed("a /= 1", "a /= 1;\n");
expect_printed("a /= 3 * 3", "a /= 3 * 3;\n");
expect_printed("a %= 1", "a %= 1;\n");
expect_printed("a %= 3 * 3", "a %= 3 * 3;\n");
expect_printed("a <<= 1", "a <<= 1;\n");
expect_printed("a <<= 3 * 3", "a <<= 3 * 3;\n");
expect_printed("a >>= 1", "a >>= 1;\n");
expect_printed("a >>= 3 * 3", "a >>= 3 * 3;\n");
expect_printed("a >>>= 1", "a >>>= 1;\n");
expect_printed("a >>>= 3 * 3", "a >>>= 3 * 3;\n");
expect_printed("a |= 1", "a |= 1;\n");
expect_printed("a |= 3 * 3", "a |= 3 * 3;\n");
expect_printed("a ^= 1", "a ^= 1;\n");
expect_printed("a ^= 3 * 3", "a ^= 3 * 3;\n");
expect_printed("a &= 1", "a &= 1;\n");
expect_printed("a &= 3 * 3", "a &= 3 * 3;\n");
expect_printed("a **= 3 * 3", "a **= 3 * 3;\n");
expect_printed("[a] = b", "[a] = b;\n");
expect_printed("[...a] = b", "[...a] = b;\n");
expect_printed("({ a } = b)", "{ a } = b;\n");
expect_printed("({ ...a } = b)", "{ ...a } = b;\n");
expect_printed("a = 1, b = 2, c = 3", "a = 1, b = 2, c = 3;\n");
} | rust_cleaned_test_functions.jsonl/93428 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 744
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51891,
28068,
368,
341,
262,
1720,
10064,
291,
445,
64,
284,
220,
16,
497,
330,
64,
284,
220,
16,
17882,
77,
797,
262,
1720,
10064,
291,
445,
64,
284,
220,
18,
353,
220,
18,
497,
330,
64,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_cash_addr2() -> Result<()> {
let addr =
Address::from_cash_addr("simpleledger:qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq9gud9630")?;
assert_eq!(addr.addr_type(), AddressType::P2PKH);
assert_eq!(
addr.cash_addr(),
"simpleledger:qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq9gud9630"
);
assert_eq!(addr.hash(), &Hash160::new([0; 20]));
assert_eq!(addr.prefix_kind(), Some(Prefix::SimpleLedger));
assert_eq!(addr.prefix_str(), "simpleledger");
Ok(())
} | rust_cleaned_test_functions.jsonl/16402 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 290
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
64363,
7387,
17,
368,
1464,
5714,
71698,
341,
286,
1077,
10789,
4035,
310,
9177,
486,
1499,
64363,
7387,
445,
22944,
50704,
25,
27579,
27579,
27579,
27579,
27579,
27579,
27579,
27579,
27579,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_literals() {
let doc = paste! {
get_doc!(#[doc = "int=" 0x1 " bool=" true " float=" 0.01])
};
let expected = "int=0x1 bool=true float=0.01";
assert_eq!(doc, expected);
} | rust_cleaned_test_functions.jsonl/36572 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49643,
368,
341,
262,
1077,
4629,
284,
24937,
0,
341,
286,
633,
18869,
10297,
13353,
5236,
284,
330,
396,
428,
220,
15,
87,
16,
330,
1807,
428,
830,
330,
2224,
428,
220,
15,
13,
15,
16,
2546... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
const INITIAL: &'static [u8] = b"abcdef123456";
let rbuf = Rc::new(vec![0; 4].into_boxed_slice());
const EXPECT: &'static [u8] = b"cdef";
let mut f = tempfile().unwrap();
f.write(INITIAL).unwrap();
{
let mut aiocb = AioCb::from_boxed_slice( f.as_raw_fd(),
2, //offset
rbuf.clone(),
0, //priority
SigevNotify::SigevNone,
LioOpcode::LIO_NOP);
aiocb.read().unwrap();
let err = poll_aio(&mut aiocb);
assert!(err == Ok(()));
assert!(aiocb.aio_return().unwrap() as usize == EXPECT.len());
}
assert!(EXPECT == rbuf.deref().deref());
} | rust_cleaned_test_functions.jsonl/7357 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 468
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
368,
341,
262,
733,
56854,
25,
30136,
1978,
508,
84,
23,
60,
284,
293,
1,
41202,
16,
17,
18,
19,
20,
21,
876,
262,
1077,
435,
5909,
284,
81463,
486,
931,
25592,
20703,
15,
26,
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... | 1 |
#[test]
fn test_overflow() {
assert_parser_err!("PRINT &H-10", QError::Overflow);
assert_parser_err!("PRINT &H100000000", QError::Overflow);
} | rust_cleaned_test_functions.jsonl/102668 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
79073,
368,
341,
310,
2060,
18517,
9266,
17223,
24372,
609,
39,
12,
16,
15,
497,
1207,
1454,
486,
42124,
317,
310,
2060,
18517,
9266,
17223,
24372,
609,
39,
16,
15,
15,
15,
15,
15,
15,
15,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_virtio_fs_hotplug_dax_on() {
test_virtio_fs(true, None, "none", &prepare_virtiofsd, true, None)
} | rust_cleaned_test_functions.jsonl/26136 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 68
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
2106,
815,
34470,
33433,
47474,
814,
706,
4470,
368,
341,
286,
1273,
2273,
2106,
815,
34470,
3715,
11,
2240,
11,
330,
6697,
497,
609,
13609,
2273,
2106,
815,
3848,
67,
11,
830,
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 |
#[test]
fn test_keys() {
let mut map = VecMap::new();
map.insert(1, 'a');
map.insert(2, 'b');
map.insert(3, 'c');
let keys = map.keys().collect::<Vec<uint>>();
assert_eq!(keys.len(), 3);
assert!(keys.contains(&1));
assert!(keys.contains(&2));
assert!(keys.contains(&3));
} | rust_cleaned_test_functions.jsonl/108790 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 187
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12631,
368,
341,
286,
1077,
5206,
2415,
284,
11312,
2227,
486,
931,
543,
286,
2415,
7030,
7,
16,
11,
364,
64,
1157,
286,
2415,
7030,
7,
17,
11,
364,
65,
1157,
286,
2415,
7030,
7,
18,
11,
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_terse_fs_format() {
let args = ["-f", "-t", "/proc"];
new_ucmd!().args(&args)
.run()
.stdout_is(expected_result(&args));
} | rust_cleaned_test_functions.jsonl/36717 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 87
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
72493,
325,
34470,
8955,
368,
341,
262,
1077,
2827,
284,
4383,
12,
69,
497,
6523,
83,
497,
3521,
15782,
6332,
262,
501,
68887,
2277,
0,
1005,
2116,
2099,
2116,
340,
286,
659,
6108,
741,
286,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_entropy_to_word_number_compatibility() {
for size in (16..32).step_by(4) {
let entropy = vec![1; size];
let mnemonic = Mnemonic::mnemonic(&entropy).unwrap();
let mnemonic_string = mnemonic.to_string();
let mnemonic_from_string = Mnemonic::from(&mnemonic_string[..]);
assert!(mnemonic_from_string.is_ok());
}
} | rust_cleaned_test_functions.jsonl/21414 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 170
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
50374,
2346,
13533,
5500,
2965,
53053,
368,
341,
262,
369,
1379,
304,
320,
16,
21,
496,
18,
17,
568,
9520,
3710,
7,
19,
8,
341,
286,
1077,
47502,
284,
7486,
20703,
16,
26,
1379,
935,
286,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_process_make_credential_credential_with_cred_protect() {
let mut rng = ThreadRng256 {};
let user_immediately_present = |_| Ok(());
let mut ctap_state = CtapState::new(&mut rng, user_immediately_present);
let test_policy = CredentialProtectionPolicy::UserVerificationOptionalWithCredentialIdList;
let make_credential_params =
create_make_credential_parameters_with_cred_protect_policy(test_policy);
let make_credential_response =
ctap_state.process_make_credential(make_credential_params, DUMMY_CHANNEL_ID);
assert!(make_credential_response.is_ok());
let stored_credential = ctap_state
.persistent_store
.filter_credential("example.com", false)
.unwrap()
.pop()
.unwrap();
let credential_id = stored_credential.credential_id;
assert_eq!(stored_credential.cred_protect_policy, Some(test_policy));
let make_credential_params =
create_make_credential_parameters_with_exclude_list(&credential_id);
let make_credential_response =
ctap_state.process_make_credential(make_credential_params, DUMMY_CHANNEL_ID);
assert_eq!(
make_credential_response,
Err(Ctap2StatusCode::CTAP2_ERR_CREDENTIAL_EXCLUDED)
);
let test_policy = CredentialProtectionPolicy::UserVerificationRequired;
let make_credential_params =
create_make_credential_parameters_with_cred_protect_policy(test_policy);
let make_credential_response =
ctap_state.process_make_credential(make_credential_params, DUMMY_CHANNEL_ID);
assert!(make_credential_response.is_ok());
let stored_credential = ctap_state
.persistent_store
.filter_credential("example.com", false)
.unwrap()
.pop()
.unwrap();
let credential_id = stored_credential.credential_id;
assert_eq!(stored_credential.cred_protect_policy, Some(test_policy));
let make_credential_params =
create_make_credential_parameters_with_exclude_list(&credential_id);
let make_credential_response =
ctap_state.process_make_credential(make_credential_params, DUMMY_CHANNEL_ID);
assert!(make_credential_response.is_ok());
} | rust_cleaned_test_functions.jsonl/35311 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1099
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
28230,
666,
30320,
666,
30320,
6615,
73475,
22357,
439,
368,
341,
286,
1077,
5206,
28422,
284,
8752,
49,
968,
17,
20,
21,
9321,
286,
1077,
1196,
17895,
43187,
36976,
284,
66091,
7622,
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_secret_sharing_3_out_of_5_at_indices() {
let secret: FE = ECScalar::new_random();
let parties = [1, 2, 4, 5, 6];
let (vss_scheme, secret_shares) = VerifiableSS::share_at_indices(3, 5, &secret, &parties);
let mut shares_vec = Vec::new();
shares_vec.push(secret_shares[0].clone());
shares_vec.push(secret_shares[1].clone());
shares_vec.push(secret_shares[3].clone());
shares_vec.push(secret_shares[4].clone());
//test reconstruction
let secret_reconstructed = vss_scheme.reconstruct(&vec![0, 1, 4, 5], &shares_vec);
assert_eq!(secret, secret_reconstructed);
} | rust_cleaned_test_functions.jsonl/62238 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 308
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21962,
3712,
3249,
62,
18,
6068,
3575,
62,
20,
3752,
18333,
368,
341,
286,
1077,
6234,
25,
27931,
284,
20633,
20639,
486,
931,
22644,
543,
286,
1077,
9677,
284,
508,
16,
11,
220,
17,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_uint() {
#[derive(Deserialize)]
struct TestUInt {
v: u32,
}
let regex = r"^(?P<v>\+?\d+)$";
assert_eq!(123, from_str::<TestUInt>("123", regex).unwrap().v);
assert_eq!(123, from_str::<TestUInt>("+123", regex).unwrap().v);
assert!(from_str::<TestUInt>("-123", regex).is_err());
} | rust_cleaned_test_functions.jsonl/133423 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 205
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15807,
368,
341,
286,
11506,
27098,
7,
64465,
5563,
286,
2036,
3393,
18777,
341,
310,
348,
25,
575,
18,
17,
345,
286,
555,
286,
1077,
20180,
284,
435,
1,
13268,
30,
47,
39297,
8449,
10,
32620,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_recovery_with_expanded_coding_shreds() {
for num_tx in 0..50 {
run_recovery_with_expanded_coding_shreds(num_tx, false);
run_recovery_with_expanded_coding_shreds(num_tx, true);
}
} | rust_cleaned_test_functions.jsonl/22335 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
91475,
6615,
14214,
6465,
666,
3700,
3712,
53369,
368,
341,
286,
369,
1629,
17805,
304,
220,
15,
496,
20,
15,
341,
310,
1598,
91475,
6615,
14214,
6465,
666,
3700,
3712,
53369,
8068,
17805,
11,
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
] | 2 |
#[test]
fn test_delay() {
let mut d = Delay::new(std::time::Duration::from_secs_f64(0.5));
run_modifier(&mut d, "delay.wav");
} | rust_cleaned_test_functions.jsonl/67271 | {
"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,
22198,
368,
341,
286,
1077,
5206,
294,
284,
39793,
486,
931,
5194,
486,
1678,
486,
12945,
486,
1499,
68718,
761,
21,
19,
7,
15,
13,
20,
3237,
286,
1598,
61773,
2099,
6984,
294,
11,
330,
22263,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_examples() {
let src = r#"
// Package foo does a thing.
//
// This is a description.
//
// ## Examples
//
// ### Using foo
//
// ```
// import "foo"
//
// foo.a
// ```
package foo
// a is a constant.
//
// This is a description.
//
// ## Examples
//
// ### Using a
//
// ```
// # import "foo"
// foo.a
// ```
a = 1
// f is a function.
//
// This is a description.
//
// ## Parameters
//
// - x: is a parameter.
//
// This is a description of x.
//
// ## Examples
//
// ### Using f
//
// ```
// # import "foo"
// foo.f(x:1)
// ```
f = (x) => 1
// o is an option.
//
// This is a description.
//
// ## Examples
//
// ### Using o
//
// ```
// # import "foo"
// option foo.o = 2
// ```
option o = 1
"#;
let loc = Locator::new(&src[..]);
assert_docs_full(
src,
PackageDoc {
path: "path".to_string(),
name: "foo".to_string(),
headline: "Package foo does a thing.".to_string(),
description: Some("This is a description.".to_string()),
members: map![
"a" => Doc::Value(Box::new(ValueDoc{
name: "a".to_string(),
headline: "a is a constant.".to_string(),
description: Some("This is a description.".to_string()),
flux_type: "int".to_string(),
is_option: false,
source_location: loc.get(29,9,29,14),
examples: vec![Example {
title: "### Using a".to_string(),
content: r#"```
# import "foo"
foo.a
```"# .to_string(),
input: None,
output: None,
}],
metadata: None,
})),
"f" => Doc::Function(Box::new(FunctionDoc{
name: "f".to_string(),
headline: "f is a function.".to_string(),
description: Some("This is a description.".to_string()),
parameters: vec![ParameterDoc{
name: "x".to_string(),
headline: "x: is a parameter.".to_string(),
description: Some("This is a description of x.".to_string()),
required: true,
} ],
flux_type: "(x:A) => int".to_string(),
is_option: false,
source_location: loc.get(49,9,49,21),
examples: vec![Example {
title: "### Using f".to_string(),
content: r#"```
# import "foo"
foo.f(x:1)
```"#
.to_string(),
input: None,
output: None,
}],
metadata: None,
})),
"o" => Doc::Value(Box::new(ValueDoc{
name: "o".to_string(),
headline: "o is an option.".to_string(),
description: Some("This is a description.".to_string()),
flux_type: "int".to_string(),
is_option: true,
source_location: loc.get(63,9,63,21),
examples: vec![Example {
title: "### Using o".to_string(),
content: r#"```
# import "foo"
option foo.o = 2
```"#
.to_string(),
input: None,
output: None,
}],
metadata: None,
})),
],
examples: vec![Example {
title: "### Using foo".to_string(),
content: r#"```
import "foo"
foo.a
```"#
.to_string(),
input: None,
output: None,
}],
metadata: None,
},
vec![],
);
} | rust_cleaned_test_functions.jsonl/9989 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3012
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45279,
368,
341,
286,
1077,
2286,
284,
435,
2,
698,
286,
442,
16906,
15229,
1558,
264,
3166,
624,
286,
6475,
286,
442,
1096,
374,
264,
4008,
624,
286,
6475,
286,
442,
7704,
25311,
198,
286,
64... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_neq_differnt_length() {
// Given:
let a = Counter::from(vec![1, 2]);
let b = Counter::from(vec![1, 2, 3]);
// Then:
assert!(a != b);
} | rust_cleaned_test_functions.jsonl/79517 | {
"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,
13925,
80,
814,
14320,
406,
5118,
368,
341,
310,
442,
16246,
510,
310,
1077,
264,
284,
19735,
486,
1499,
25592,
20703,
16,
11,
220,
17,
2558,
310,
1077,
293,
284,
19735,
486,
1499,
25592,
20703,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_basic_functionality() {
let recorder1 = DebuggingRecorder::new();
let snapshotter1 = recorder1.snapshotter();
let recorder2 = DebuggingRecorder::new();
let snapshotter2 = recorder2.snapshotter();
let fanout = FanoutBuilder::default()
.add_recorder(recorder1)
.add_recorder(recorder2)
.build();
let tlkey = "tokio.loops".into();
let hsbkey = "hyper.sent.bytes".into();
let before1 = snapshotter1.snapshot();
let before2 = snapshotter2.snapshot();
assert_eq!(before1.len(), 0);
assert_eq!(before2.len(), 0);
let ud = &[(Unit::Count, "counter desc"), (Unit::Bytes, "gauge desc")];
fanout.register_counter(&tlkey, Some(ud[0].0.clone()), Some(ud[0].1));
fanout.register_gauge(&hsbkey, Some(ud[1].0.clone()), Some(ud[1].1));
fanout.increment_counter(&tlkey, 47);
fanout.update_gauge(&hsbkey, GaugeValue::Absolute(12.0));
let after1 = snapshotter1.snapshot();
let after2 = snapshotter2.snapshot();
assert_eq!(after1.len(), 2);
assert_eq!(after2.len(), 2);
let after = after1
.into_iter()
.zip(after2)
.enumerate()
.collect::<Vec<_>>();
for (i, ((k1, u1, d1, v1), (k2, u2, d2, v2))) in after {
assert_eq!(k1, k2);
assert_eq!(u1, u2);
assert_eq!(d1, d2);
assert_eq!(v1, v2);
assert_eq!(Some(ud[i].0.clone()), u1);
assert_eq!(Some(ud[i].0.clone()), u2);
assert_eq!(Some(ud[i].1), d1);
assert_eq!(Some(ud[i].1), d2);
}
} | rust_cleaned_test_functions.jsonl/113619 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 893
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
9174,
2719,
368,
341,
286,
1077,
48835,
16,
284,
11091,
3173,
47023,
486,
931,
543,
286,
1077,
16295,
465,
16,
284,
48835,
16,
52677,
465,
543,
286,
1077,
48835,
17,
284,
11091,
3173,
470... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_vcx_disclosed_proof_release() {
let _setup = SetupMocks::init();
let handle = _vcx_disclosed_proof_create_with_request_c_closure(::utils::constants::PROOF_REQUEST_JSON).unwrap();
assert_eq!(vcx_disclosed_proof_release(handle + 1), error::INVALID_DISCLOSED_PROOF_HANDLE.code_num);
assert_eq!(vcx_disclosed_proof_release(handle), error::SUCCESS.code_num);
assert_eq!(vcx_disclosed_proof_release(handle), error::INVALID_DISCLOSED_PROOF_HANDLE.code_num);
} | rust_cleaned_test_functions.jsonl/104425 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 227
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
25844,
37745,
9259,
86757,
24577,
368,
341,
286,
1077,
716,
15188,
284,
18626,
72577,
486,
2327,
1428,
286,
1077,
3705,
284,
716,
7362,
87,
37745,
9259,
86757,
8657,
6615,
7893,
666,
72823,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_resp_array_macro() {
let resp_object = resp_array!["SET", "x"];
let bytes = obj_to_bytes(resp_object);
assert_eq!(b"*2\r\n$3\r\nSET\r\n$1\r\nx\r\n", bytes.as_slice());
let resp_object = resp_array!["RPUSH", "wyz"].append(vec!["a", "b"]);
let bytes = obj_to_bytes(resp_object);
assert_eq!(
&b"*4\r\n$5\r\nRPUSH\r\n$3\r\nwyz\r\n$1\r\na\r\n$1\r\nb\r\n"[..],
bytes.as_slice()
);
let vals = vec![String::from("a"), String::from("b")];
let resp_object = resp_array!["RPUSH", "xyz"].append(&vals);
let bytes = obj_to_bytes(resp_object);
assert_eq!(
&b"*4\r\n$5\r\nRPUSH\r\n$3\r\nxyz\r\n$1\r\na\r\n$1\r\nb\r\n"[..],
bytes.as_slice()
);
} | rust_cleaned_test_functions.jsonl/22224 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 475
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35160,
3858,
58810,
368,
341,
286,
1077,
9039,
5314,
284,
9039,
3858,
0,
1183,
5884,
497,
330,
87,
6332,
286,
1077,
5820,
284,
2839,
2346,
12524,
20267,
5314,
317,
286,
2060,
10714,
10297,
65,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_struct() {
let my_struct = MyStruct { x: 4.0, y: 7.0 };
assert_eq!(Ok(my_struct), from_str("MyStruct(x:4,y:7,)"));
assert_eq!(Ok(my_struct), from_str("(x:4,y:7)"));
#[derive(Debug, PartialEq, Deserialize)]
struct NewType(i32);
assert_eq!(Ok(NewType(42)), from_str("NewType(42)"));
assert_eq!(Ok(NewType(33)), from_str("(33)"));
#[derive(Debug, PartialEq, Deserialize)]
struct TupleStruct(f32, f32);
assert_eq!(Ok(TupleStruct(2.0, 5.0)), from_str("TupleStruct(2,5,)"));
assert_eq!(Ok(TupleStruct(3.0, 4.0)), from_str("(3,4)"));
} | rust_cleaned_test_functions.jsonl/1658 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 292
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15126,
368,
341,
262,
1077,
847,
15126,
284,
3017,
9422,
314,
856,
25,
220,
19,
13,
15,
11,
379,
25,
220,
22,
13,
15,
3634,
262,
2060,
10714,
10297,
11578,
13941,
15126,
701,
504,
2895,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_basic() {
DelayPlusPoolProblem {
input: vec![0.0, 0.0, 0.0, 0.0, 1.0],
pulse: 2,
delay: 0,
stride: 1,
pool_window: 2,
}
.run()
.unwrap()
} | rust_cleaned_test_functions.jsonl/125714 | {
"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,
34729,
368,
341,
262,
39793,
21807,
10551,
31198,
341,
286,
1946,
25,
7486,
20703,
15,
13,
15,
11,
220,
15,
13,
15,
11,
220,
15,
13,
15,
11,
220,
15,
13,
15,
11,
220,
16,
13,
15,
1259,
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_range_proof_gadget() {
use rand::rngs::OsRng;
use rand::Rng;
let mut rng = OsRng::new().unwrap();
let min = 10;
let max = 100;
let v = rng.gen_range(min, max);
println!("v is {}", &v);
assert!(range_proof_helper(v, min, max).is_ok());
} | rust_cleaned_test_functions.jsonl/113490 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 177
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9698,
86757,
1889,
50931,
368,
341,
286,
990,
10382,
486,
69890,
82,
486,
28867,
49,
968,
280,
286,
990,
10382,
486,
49,
968,
401,
286,
1077,
5206,
28422,
284,
15433,
49,
968,
486,
931,
1005,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_instruction_processor_for_invalid_account() {
let (genesis_config, mint_keypair) = create_genesis_config(500);
let mut bank = Bank::new(&genesis_config);
fn mock_ix_processor(
_pubkey: &Pubkey,
_ka: &[KeyedAccount],
_data: &[u8],
) -> std::result::Result<(), InstructionError> {
Err(InstructionError::CustomError(42))
}
// Non-native loader accounts can not be used for instruction processing
bank.add_instruction_processor(mint_keypair.pubkey(), mock_ix_processor);
} | rust_cleaned_test_functions.jsonl/42428 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 266
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
54923,
50127,
5478,
31433,
13500,
368,
341,
286,
1077,
320,
77894,
5332,
11,
28337,
3097,
12670,
8,
284,
1855,
16322,
13774,
5332,
7,
20,
15,
15,
317,
286,
1077,
5206,
6073,
284,
8547,
486... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_asr_w() {
assert_eq!(
decode_32(0xea4f39e2),
Instruction::ASR_imm {
params: Reg2ShiftNParams {
rd: Reg::R9,
rm: Reg::R2,
shift_n: 15,
setflags: SetFlags::False,
},
thumb32: true,
}
);
} | rust_cleaned_test_functions.jsonl/64818 | {
"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,
15227,
11898,
81,
1670,
368,
341,
1066,
262,
2060,
10714,
33673,
286,
16895,
62,
18,
17,
7,
15,
56570,
19,
69,
18,
24,
68,
17,
1326,
286,
29051,
486,
1911,
49,
71370,
341,
310,
3628,
25,
318... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_for_in_statement() {
expect_printed("for (const a in items) {}", "for (const a in items) {}");
expect_printed("for (var a in items) {}", "for (var a in items) {}");
expect_printed("for (let a in items) {}", "for (let a in items) {}");
expect_printed("for (a in items) {}", "for (a in items) {}");
expect_printed(
"for (let a in items) { return 3 + 3; }",
"for (let a in items) { return 3 + 3;\n }",
);
} | rust_cleaned_test_functions.jsonl/93425 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 192
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5478,
1243,
37404,
368,
341,
262,
1720,
10064,
291,
445,
1958,
320,
1024,
264,
304,
3589,
8,
24689,
330,
1958,
320,
1024,
264,
304,
3589,
8,
4687,
797,
262,
1720,
10064,
291,
445,
1958,
320,
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_struct_matching() {
assert_eq! {
rune! { i64 =>
struct Foo { a, b }
pub fn main() {
let foo = Foo {
a: 1,
b: 2,
};
match foo {
Foo { a, b } => a + b,
_ => 0,
}
}
},
3,
};
assert_eq! {
rune! { i64 =>
struct Foo { a, b }
pub fn main() {
let b = 2;
let foo = Foo {
a: 1,
b,
};
match foo {
Foo { a, b } => a + b,
_ => 0,
}
}
},
3,
};
} | rust_cleaned_test_functions.jsonl/34514 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 587
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15126,
70763,
368,
341,
262,
2060,
10714,
0,
341,
286,
63499,
0,
314,
600,
21,
19,
6274,
310,
2036,
33428,
314,
264,
11,
293,
555,
310,
6675,
5168,
1887,
368,
341,
394,
1077,
15229,
284,
33428... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_stack_guard() {
let engine = TestEngineBuilder::new().build().unwrap();
let read_pool = ReadPool::from(build_read_pool_for_test(
&CoprReadPoolConfig::default_for_test(),
engine,
));
let cm = ConcurrencyManager::new(1.into());
let mut copr = Endpoint::<RocksEngine>::new(
&Config::default(),
read_pool.handle(),
cm,
PerfLevel::EnableCount,
);
copr.recursion_limit = 100;
let req = {
let mut expr = Expr::default();
for _ in 0..101 {
let mut e = Expr::default();
e.mut_children().push(expr);
expr = e;
}
let mut e = Executor::default();
e.mut_selection().mut_conditions().push(expr);
let mut dag = DagRequest::default();
dag.mut_executors().push(e);
let mut req = coppb::Request::default();
req.set_tp(REQ_TYPE_DAG);
req.set_data(dag.write_to_bytes().unwrap());
req
};
let resp = block_on(copr.parse_and_handle_unary_request(req, None));
assert!(!resp.get_other_error().is_empty());
} | rust_cleaned_test_functions.jsonl/83652 | {
"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,
15528,
36796,
368,
341,
286,
1077,
4712,
284,
3393,
4571,
3297,
486,
931,
1005,
5834,
1005,
15454,
543,
286,
1077,
1349,
15709,
284,
4457,
10551,
486,
1499,
43333,
6443,
15709,
5478,
4452,
1006,
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... | 2 |
#[test]
fn test_enum_schema_duplicate() {
// Duplicate "diamonds"
let schema = Schema::parse_str(
r#"{"type": "enum", "name": "Suit", "symbols": ["diamonds", "spades", "clubs", "diamonds"]}"#,
);
assert!(schema.is_err());
} | rust_cleaned_test_functions.jsonl/108441 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31054,
25371,
70434,
368,
341,
286,
442,
71071,
330,
88576,
82,
698,
286,
1077,
10802,
284,
12539,
486,
6400,
2895,
1006,
310,
435,
55543,
4913,
1313,
788,
330,
9018,
497,
330,
606,
788,
330,
62... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_encrypt_decrypt_credential() {
let mut rng = ThreadRng256 {};
let user_immediately_present = |_| Ok(());
let private_key = crypto::ecdsa::SecKey::gensk(&mut rng);
let mut ctap_state = CtapState::new(&mut rng, user_immediately_present);
let rp_id_hash = [0x55; 32];
let encrypted_id = ctap_state
.encrypt_key_handle(private_key.clone(), &rp_id_hash)
.unwrap();
let decrypted_source = ctap_state
.decrypt_credential_source(encrypted_id, &rp_id_hash)
.unwrap()
.unwrap();
assert_eq!(private_key, decrypted_source.private_key);
} | rust_cleaned_test_functions.jsonl/35320 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 351
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66593,
80764,
666,
30320,
368,
341,
286,
1077,
5206,
28422,
284,
8752,
49,
968,
17,
20,
21,
9321,
286,
1077,
1196,
17895,
43187,
36976,
284,
66091,
7622,
7,
1423,
286,
1077,
869,
3097,
284,
1902... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_generic_i64_set() {
let t1 = Generic { data: 2i64 };
assert_eq!(
rune_n! {
make_native_module().expect("failed making native module"),
( t1, ),
i64 =>
pub fn main(v) { v.data = 10; v.data }
},
10
);
} | rust_cleaned_test_functions.jsonl/77915 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 176
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41232,
5318,
21,
19,
2602,
368,
341,
262,
1077,
259,
16,
284,
21281,
314,
821,
25,
220,
17,
72,
21,
19,
2605,
262,
2060,
10714,
33673,
286,
63499,
1089,
0,
341,
310,
1281,
44494,
10750,
1005,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_encoding_network_failure() {
// Bitcoin Network structure do not support "Other" networks
bitcoin::Network::strict_decode(&[0xA1u8, 0xA2u8, 0xA3u8, 0xA4u8][..])
.unwrap();
} | rust_cleaned_test_functions.jsonl/43966 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37613,
20966,
43618,
368,
341,
286,
442,
13127,
8141,
5944,
653,
537,
1824,
330,
11409,
1,
14155,
198,
286,
17873,
486,
12320,
486,
6627,
15227,
2099,
58,
15,
14673,
16,
84,
23,
11,
220,
15,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_issue_264() {
let hdr = indoc! {"
namespace a {
typedef int b;
inline namespace c {}
template <typename> class aa;
namespace c {
template <typename d, typename = d, typename = aa<d>> class e;
}
typedef e<char> f;
template <typename g, typename, template <typename> typename> struct h {
using i = g;
};
template <typename g, template <typename> class k> using j = h<g, void, k>;
template <typename g, template <typename> class k>
using m = typename j<g, k>::i;
template <typename> struct l { typedef b ab; };
template <typename p> class aa {
public:
typedef p n;
};
struct r {
template <typename p> using o = typename p::c;
};
template <typename ad> struct u : r {
typedef typename ad::n n;
using ae = m<n, o>;
template <typename af, typename> struct v { using i = typename l<f>::ab; };
using ab = typename v<ad, ae>::i;
};
} // namespace a
namespace q {
template <typename ad> struct w : a::u<ad> {};
} // namespace q
namespace a {
namespace c {
template <typename, typename, typename ad> class e {
typedef q::w<ad> s;
public:
typedef typename s::ab ab;
};
} // namespace c
} // namespace a
namespace ag {
namespace ah {
typedef a::f::ab t;
class ai {
t aj;
};
class al;
namespace am {
class an {
public:
void ao(ai);
};
} // namespace am
class ap {
public:
al aq();
};
class ar {
am::an as;
};
class al {
ar at;
};
struct au {
ap av;
};
} // namespace ah
} // namespace ag
namespace operations_research {
class aw {
ag::ah::au ax;
};
class Solver {
aw ay;
};
} // namespace operations_research
"};
let rs = quote! {};
run_test("", hdr, rs, &["operations_research::Solver"], &[]);
} | rust_cleaned_test_functions.jsonl/9880 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1192
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53340,
62,
17,
21,
19,
368,
341,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
262,
4473,
264,
341,
286,
13501,
526,
293,
280,
286,
7381,
4473,
272,
5613,
286,
3811,
366,
9031,
29,
536,
290... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dir_with_dirs() {
let tempdir = tempfile::tempdir().unwrap();
std::fs::create_dir(tempdir.path().join("abc")).unwrap();
std::fs::create_dir(tempdir.path().join("def")).unwrap();
let request = Request {
path: tempdir.path().to_path_buf(),
};
let mut session = session::test::Fake::new();
assert!(handle(&mut session, request).is_ok());
let mut replies = session.replies().collect::<Vec<&Response>>();
replies.sort_by_key(|reply| reply.path.clone());
assert_eq!(replies.len(), 2);
assert_eq!(replies[0].path, tempdir.path().join("abc"));
assert!(replies[0].metadata.is_dir());
assert_eq!(replies[1].path, tempdir.path().join("def"));
assert!(replies[1].metadata.is_dir());
} | rust_cleaned_test_functions.jsonl/69104 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 371
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4334,
6615,
44869,
368,
341,
286,
1077,
2730,
3741,
284,
54819,
486,
3888,
3741,
1005,
15454,
543,
286,
1460,
486,
3848,
486,
3182,
4334,
9758,
3741,
3875,
1005,
5987,
445,
13683,
15197,
15454,
54... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_null_terminator_index() {
let bytes = vec![b'\0'; 48];
assert_eq!(null_terminator_index(bytes.as_slice()), 0);
let bytes = vec![b'h', b'i', b'\0'];
assert_eq!(null_terminator_index(bytes.as_slice()), 2);
let bytes = vec![b'h', b'i', b'\0', b'\0'];
assert_eq!(null_terminator_index(bytes.as_slice()), 2);
} | rust_cleaned_test_functions.jsonl/98280 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 196
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15162,
62,
22969,
850,
3560,
368,
341,
286,
1077,
5820,
284,
7486,
20703,
65,
15777,
15,
6967,
220,
19,
23,
935,
286,
2060,
10714,
10297,
2921,
62,
22969,
850,
3560,
23158,
5357,
26488,
11858,
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_ripmd160() {
assert_eq!(
ripemd160(b"hello, world"),
[
163, 32, 31, 130, 252, 160, 52, 228, 109, 16, 205, 123, 39, 225, 116, 151, 110, 36,
29, 162
]
);
} | rust_cleaned_test_functions.jsonl/17834 | {
"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,
62,
4561,
2277,
16,
21,
15,
368,
341,
286,
2060,
10714,
33673,
310,
23288,
94110,
16,
21,
15,
1883,
1,
14990,
11,
1879,
4461,
310,
2278,
394,
220,
16,
21,
18,
11,
220,
18,
17,
11,
220,
18,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_helpers() {
common::setup();
let mut test = OsoTest::new();
test.load_file(file!(), "test_file.polar").unwrap();
assert_eq!(
test.query("f(x)"),
vec![
hashmap! { "x" => 1, },
hashmap! { "x" => 2, },
hashmap! { "x" => 3, },
]
);
assert_eq!(test.qvar::<u32>("f(x)", "x"), [1, 2, 3]);
} | rust_cleaned_test_functions.jsonl/30383 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 219
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
54473,
368,
341,
262,
4185,
486,
15188,
1428,
262,
1077,
5206,
1273,
284,
506,
704,
2271,
486,
931,
543,
262,
1273,
5104,
2458,
4866,
0,
1507,
330,
1944,
2458,
556,
7417,
1827,
15454,
543,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extract_chars() {
assert_eq!(extract_chars("", &[0..1]), "".to_string());
assert_eq!(extract_chars("ábc", &[0..1]), "á".to_string());
assert_eq!(extract_chars("ábc", &[0..1, 2..3]), "ác".to_string());
assert_eq!(extract_chars("ábc", &[0..3]), "ábc".to_string());
assert_eq!(extract_chars("ábc", &[2..3, 1..2]), "cb".to_string());
assert_eq!(
extract_chars("ábc", &[0..1, 1..2, 4..5]),
"áb".to_string()
);
} | rust_cleaned_test_functions.jsonl/34700 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 284
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
37418,
368,
341,
286,
2060,
10714,
10297,
23493,
37418,
19814,
44590,
15,
496,
16,
9719,
44907,
983,
3904,
1423,
286,
2060,
10714,
10297,
23493,
37418,
445,
1953,
8904,
497,
44590,
15,
496,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_header() -> io::Result<()> {
let data = [0x00, 0x25, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00];
let mut reader = &data[..];
assert_eq!(read_header(&mut reader)?, (Order::Zero, 37, 7));
Ok(())
} | rust_cleaned_test_functions.jsonl/121772 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 137
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
8757,
368,
1464,
6399,
486,
2077,
71698,
341,
286,
1077,
821,
284,
508,
15,
87,
15,
15,
11,
220,
15,
87,
17,
20,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_error_messages() {
use super::VsockConfigError::*;
use std::io;
let err = CreateVsockDevice(devices::virtio::VsockError::EventFd(
io::Error::from_raw_os_error(0),
));
let _ = format!("{}{:?}", err, err);
} | rust_cleaned_test_functions.jsonl/124164 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4096,
23428,
368,
341,
286,
990,
2256,
486,
53,
13199,
2648,
1454,
56162,
286,
990,
1460,
486,
815,
401,
286,
1077,
1848,
284,
4230,
53,
13199,
6985,
17622,
1216,
486,
47381,
815,
486,
53,
13199... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hash_uint() {
let val = 0xdeadbeef_deadbeef_u64;
assert!(hash(&(val as u64)) != hash(&(val as uint)));
assert_eq!(hash(&(val as u32)), hash(&(val as uint)));
} | rust_cleaned_test_functions.jsonl/7554 | {
"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,
8950,
15807,
368,
341,
286,
1077,
1044,
284,
220,
15,
87,
33754,
1371,
823,
53427,
1371,
823,
7300,
21,
19,
280,
286,
2060,
10297,
8296,
29089,
831,
438,
575,
21,
19,
593,
961,
5175,
29089,
83... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.