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_parse_valid_elasticbeanstalk_update_application_version() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/valid",
"elasticbeanstalk-update-application-version.xml",
);
let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
let client =
ElasticBeanstalkClient::new(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = UpdateApplicationVersionMessage::default();
let result = client.update_application_version(request).sync();
assert!(result.is_ok(), "parse error: {:?}", result);
} | rust_cleaned_test_functions.jsonl/15247 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 265
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8337,
21602,
5064,
17479,
89749,
8882,
38721,
9438,
368,
341,
286,
1077,
7860,
9655,
284,
14563,
2582,
5062,
486,
878,
9655,
1006,
310,
330,
1944,
35569,
79372,
14,
1891,
756,
310,
330,
619... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_components_1() {
let g = super::Digraph::from_vec(&vec![
None, Some(1.0f64), None, None, None, None, Some(1.0f64),
None, None, Some(1.0f64), None, None, None, None,
Some(1.0f64), None, None, None, None, None, None,
None, None, Some(1.0f64), None, Some(1.0f64), None, None,
None, None, None, None, None, Some(1.0f64), None,
Some(1.0f64), None, None, Some(1.0f64), Some(1.0f64), None, None,
None, None, None, None, None, None, Some(1.0f64)
]);
let c0: Vec<usize> = vec![0, 1, 2];
let c1: Vec<usize> = vec![3, 4, 5];
let c2: Vec<usize> = vec![6];
assert_eq!(g.sc_components(), vec![c0, c1, c2]);
} | rust_cleaned_test_functions.jsonl/42297 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 415
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23258,
62,
16,
368,
341,
286,
1077,
342,
284,
2256,
486,
37098,
1935,
486,
1499,
13251,
2099,
4083,
90515,
310,
2240,
11,
4329,
7,
16,
13,
15,
69,
21,
19,
701,
2240,
11,
2240,
11,
2240,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_annotation_in_comments_i() {
let comments = vec![
CommentText {
position: 0,
text: "@[asdf".to_string().chars().collect(),
},
CommentText {
position: 0,
text: "asdf]".to_string().chars().collect(),
},
];
let annotations = find_annotations_in_comments(&comments);
assert_eq!(annotations.len(), 1);
assert_eq!(characters_to_string(&annotations[0].text[..]), "asdf asdf");
} | rust_cleaned_test_functions.jsonl/126921 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 291
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
61237,
1243,
30359,
5318,
368,
341,
286,
1077,
6042,
284,
7486,
90515,
310,
12255,
1178,
341,
394,
2309,
25,
220,
15,
345,
394,
1467,
25,
8428,
58,
76615,
3263,
983,
3904,
1005,
19255,
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_add_timeout_cancel() {
System::run(|| {
let _addr = MyActor { op: Op::Cancel }.start();
actix_rt::spawn(async {
tokio_timer::delay(Instant::now() + Duration::new(0, 1000)).await;
System::current().stop();
});
})
.unwrap();
} | rust_cleaned_test_functions.jsonl/35701 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
20537,
28895,
368,
341,
262,
739,
486,
6108,
79453,
341,
286,
1077,
716,
6214,
284,
3017,
18870,
314,
1179,
25,
10672,
486,
9269,
16908,
2468,
1428,
286,
1160,
941,
40169,
486,
46087,
18285,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_from_arg_matches_never() {
let argv = vec!["lsd", "--color", "never"];
let matches = app::build().get_matches_from_safe(argv).unwrap();
assert_eq!(
Some(ColorOption::Never),
ColorOption::from_arg_matches(&matches)
);
} | rust_cleaned_test_functions.jsonl/86428 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 151
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
6057,
38344,
13925,
423,
368,
341,
286,
1077,
10213,
284,
7486,
0,
1183,
4730,
67,
497,
14482,
3423,
497,
330,
36493,
6332,
286,
1077,
9071,
284,
906,
486,
5834,
1005,
455,
38344,
5673,
34... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_accountsdb_de_dup_accounts_zero_chunks() {
let (hashes, lamports, _) = AccountsHash::default()
.de_dup_accounts_in_parallel(&[vec![vec![CalculateHashIntermediate::default()]]], 0);
assert_eq!(vec![Hash::default()], hashes);
assert_eq!(lamports, 0);
} | rust_cleaned_test_functions.jsonl/94718 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55665,
1999,
2259,
51932,
55665,
19359,
65470,
368,
341,
286,
1077,
320,
8296,
288,
11,
31603,
3394,
11,
27439,
284,
40655,
6370,
486,
2258,
741,
310,
659,
450,
51932,
55665,
1243,
60625,
2099,
58... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cached_timed_sized_prime() {
assert!(cached_timed_sized_prime("true"));
{
let cache = CACHED_TIMED_SIZED_PRIME.lock().unwrap();
assert_eq!(cache.cache_hits(), Some(0));
assert_eq!(cache.cache_misses(), Some(1));
}
assert!(cached_timed_sized_prime("true"));
{
let cache = CACHED_TIMED_SIZED_PRIME.lock().unwrap();
assert_eq!(cache.cache_hits(), Some(1));
assert_eq!(cache.cache_misses(), Some(1));
}
std::thread::sleep(std::time::Duration::from_millis(500));
assert!(cached_timed_sized_prime_prime_cache("true"));
std::thread::sleep(std::time::Duration::from_millis(500));
assert!(cached_timed_sized_prime_prime_cache("true"));
std::thread::sleep(std::time::Duration::from_millis(500));
assert!(cached_timed_sized_prime_prime_cache("true"));
assert!(cached_timed_sized_prime("true"));
{
let mut cache = CACHED_TIMED_SIZED_PRIME.lock().unwrap();
assert_eq!(cache.cache_hits(), Some(2));
assert_eq!(cache.cache_misses(), Some(1));
assert!(cache.cache_size() > 0);
std::thread::sleep(std::time::Duration::from_millis(1000));
cache.flush();
assert_eq!(cache.cache_size(), 0);
}
} | rust_cleaned_test_functions.jsonl/13149 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 581
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64369,
29087,
291,
643,
1506,
38217,
368,
341,
262,
2060,
10297,
32918,
29087,
291,
643,
1506,
38217,
445,
1866,
4010,
262,
341,
286,
1077,
6500,
284,
356,
52645,
16746,
1479,
1098,
51538,
10571,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_convert_bad_expr() {
let b = ast::BaseNode::default();
let pkg = ast::Package {
base: b.clone(),
path: "path".to_string(),
package: "main".to_string(),
files: vec![ast::File {
base: b.clone(),
name: "foo.flux".to_string(),
metadata: String::new(),
package: None,
imports: Vec::new(),
body: vec![ast::Statement::Expr(Box::new(ast::ExprStmt {
base: b.clone(),
expression: ast::Expression::Bad(Box::new(ast::BadExpr {
base: b.clone(),
text: "bad expression".to_string(),
expression: None,
})),
}))],
eof: None,
}],
};
let want: Result<Package> =
Err("BadExpression is not supported in semantic analysis".to_string());
let got = test_convert(pkg);
assert_eq!(want, got);
} | rust_cleaned_test_functions.jsonl/30459 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 616
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
34199,
21915,
368,
341,
286,
1077,
293,
284,
11763,
486,
3978,
1955,
486,
2258,
543,
286,
1077,
24793,
284,
11763,
486,
13100,
341,
310,
2331,
25,
293,
15997,
3148,
310,
1815,
25,
330,
23... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_should_preserve_empty_line_and_final_newline() {
new_ucmd!()
.arg("-w2")
.pipe_in("12\n\n34\n")
.succeeds()
.stdout_is("12\n\n34\n");
} | rust_cleaned_test_functions.jsonl/23266 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43378,
32116,
5852,
15124,
6528,
8378,
20676,
5921,
1056,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
858,
13645,
86,
17,
1138,
286,
659,
13768,
1243,
445,
16,
17,
1699,
1699,
18,
19,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_simple_tokenizer() {
let tokens = token_stream_helper("Hello, happy tax payer!");
assert_eq!(tokens.len(), 4);
assert_token(&tokens[0], 0, "Hello", 0, 5);
assert_token(&tokens[1], 1, "happy", 7, 12);
assert_token(&tokens[2], 2, "tax", 13, 16);
assert_token(&tokens[3], 3, "payer", 17, 22);
} | rust_cleaned_test_functions.jsonl/31735 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 180
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
6458,
3135,
368,
341,
286,
1077,
11211,
284,
3950,
12673,
10418,
445,
9707,
11,
6247,
3742,
69275,
11142,
286,
2060,
10714,
10297,
30566,
19406,
1507,
220,
19,
317,
286,
2060,
6458,
2099,
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_operations_list_list_roundtrip_times() {
init_test_runtime();
for i in 0..10000 {
let result = test_operations_list_list_roundtrip(i);
if result.is_err() {
println!("test_operations_list_list_roundtrip_times roundtrip number {} failed!", i);
}
assert!(result.is_ok())
}
} | rust_cleaned_test_functions.jsonl/51375 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 158
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57345,
2019,
2019,
29896,
32981,
22353,
368,
341,
262,
2930,
4452,
33232,
1428,
262,
369,
600,
304,
220,
15,
496,
16,
15,
15,
15,
15,
341,
286,
1077,
1102,
284,
1273,
57345,
2019,
2019,
29896,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_get_all_key_versions() {
let mut opts = DBOptions::new();
opts.create_if_missing(true);
let path = TempDir::new("_rust_rocksdb_get_all_key_version_test").expect("");
let db = DB::open(opts, path.path().to_str().unwrap()).unwrap();
let samples = vec![
(b"key1".to_vec(), b"value1".to_vec()),
(b"key2".to_vec(), b"value2".to_vec()),
(b"key3".to_vec(), b"value3".to_vec()),
(b"key4".to_vec(), b"value4".to_vec()),
];
// Put 4 keys.
for &(ref k, ref v) in &samples {
db.put(k, v).unwrap();
assert_eq!(v.as_slice(), &*db.get(k).unwrap().unwrap());
}
db.flush(true).unwrap();
let key_versions = db.get_all_key_versions(b"key2", b"key4").unwrap();
assert_eq!(key_versions[1].key, "key3");
assert_eq!(key_versions[1].value, "value3");
assert_eq!(key_versions[1].seq, 3);
} | rust_cleaned_test_functions.jsonl/99620 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 517
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
5705,
3097,
65148,
368,
341,
286,
1077,
5206,
12185,
284,
5952,
3798,
486,
931,
543,
286,
12185,
2520,
11119,
40447,
3715,
317,
286,
1077,
1815,
284,
19944,
6184,
486,
931,
16975,
35788,
266... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_nospace() {
let args = vec!["-Lfoo".to_string(), "-M.".to_string()];
let matches = &match Options::new()
.optmulti("L", "", "library directory", "LIB")
.optmulti("M", "", "something", "MMMM")
.parse(&args)
{
Ok(m) => m,
_ => panic!(),
};
assert!(matches.opts_present(&["L".to_string()]));
assert_eq!(matches.opts_str(&["L".to_string()]).unwrap(), "foo");
assert!(matches.opts_present(&["M".to_string()]));
assert_eq!(matches.opts_str(&["M".to_string()]).unwrap(), ".");
} | rust_cleaned_test_functions.jsonl/52386 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 267
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1089,
80014,
368,
341,
262,
1077,
2827,
284,
7486,
0,
1183,
12,
43,
7975,
3263,
983,
3904,
1507,
6523,
44,
36911,
983,
3904,
33800,
262,
1077,
9071,
284,
609,
6347,
14566,
486,
931,
741,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_get_range_min_safe_ts() {
fn add_region(meta: &Arc<Mutex<StoreMeta>>, id: u64, kr: KeyRange, safe_ts: u64) {
let mut meta = meta.lock().unwrap();
let mut region = Region::default();
region.set_id(id);
region.set_start_key(kr.get_start_key().to_vec());
region.set_end_key(kr.get_end_key().to_vec());
region.set_peers(vec![kvproto::metapb::Peer::default()].into());
let rrp = RegionReadProgress::new(®ion, 1, 1, "".to_owned());
rrp.update_safe_ts(1, safe_ts);
assert_eq!(rrp.safe_ts(), safe_ts);
meta.region_ranges.insert(enc_end_key(®ion), id);
meta.regions.insert(id, region);
meta.region_read_progress.insert(id, Arc::new(rrp));
}
fn key_range(start_key: &[u8], end_key: &[u8]) -> KeyRange {
let mut kr = KeyRange::default();
kr.set_start_key(start_key.to_vec());
kr.set_end_key(end_key.to_vec());
kr
}
let meta = Arc::new(Mutex::new(StoreMeta::new(0)));
let runner = Runner::new(meta.clone());
assert_eq!(0, runner.get_range_safe_ts(key_range(b"", b"")));
add_region(&meta, 1, key_range(b"", b"k1"), 100);
assert_eq!(100, runner.get_range_safe_ts(key_range(b"", b"")));
assert_eq!(0, runner.get_range_safe_ts(key_range(b"k1", b"")));
add_region(&meta, 2, key_range(b"k5", b"k6"), 80);
add_region(&meta, 3, key_range(b"k6", b"k8"), 70);
// The zero ts will be ignore
add_region(&meta, 5, key_range(b"k8", b"k9"), 0);
add_region(&meta, 4, key_range(b"k9", b""), 90);
assert_eq!(70, runner.get_range_safe_ts(key_range(b"", b"")));
assert_eq!(80, runner.get_range_safe_ts(key_range(b"", b"k6")));
assert_eq!(90, runner.get_range_safe_ts(key_range(b"k99", b"")));
assert_eq!(70, runner.get_range_safe_ts(key_range(b"k5", b"k99")));
assert_eq!(70, runner.get_range_safe_ts(key_range(b"k", b"k9")));
assert_eq!(80, runner.get_range_safe_ts(key_range(b"k4", b"k6")));
assert_eq!(100, runner.get_range_safe_ts(key_range(b"", b"k1")));
assert_eq!(90, runner.get_range_safe_ts(key_range(b"k9", b"")));
assert_eq!(80, runner.get_range_safe_ts(key_range(b"k5", b"k6")));
assert_eq!(0, runner.get_range_safe_ts(key_range(b"k1", b"k4")));
assert_eq!(0, runner.get_range_safe_ts(key_range(b"k2", b"k3")));
} | rust_cleaned_test_functions.jsonl/55957 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1318
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
9698,
7260,
34067,
25023,
368,
341,
286,
5168,
912,
20627,
45119,
25,
609,
36809,
33274,
9371,
27,
6093,
12175,
81360,
877,
25,
575,
21,
19,
11,
23103,
25,
5309,
6046,
11,
6092,
25023,
25,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_typedef_to_up_in_struct() {
let hdr = indoc! {"
#include <string>
#include <memory>
typedef std::unique_ptr<std::string> my_string;
struct A {
my_string a;
};
inline A make_a(std::string b) {
A bob;
bob.a = std::make_unique<std::string>(b);
return bob;
}
inline uint32_t take_a(A a) {
return a.a->size();
}
"};
let rs = quote! {
use ffi::ToCppString;
assert_eq!(ffi::take_a(ffi::make_a("hello".into_cpp())), 5);
};
run_test("", hdr, rs, &["make_a", "take_a"], &[]);
} | rust_cleaned_test_functions.jsonl/9866 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 366
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42111,
4219,
2346,
8237,
1243,
15126,
368,
341,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
286,
671,
997,
366,
917,
397,
286,
671,
997,
366,
17269,
397,
286,
13501,
1460,
486,
9587,
4348,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_almost_and_already_full_behavior() {
let mut cluster = new_server_cluster(0, 5);
// To ensure the thread has full store disk usage infomation.
cluster.cfg.raft_store.store_batch_system.pool_size = 1;
cluster.pd_client.disable_default_operator();
cluster.run();
cluster.must_put(b"k1", b"v1");
let region = cluster.get_region(b"k1");
cluster.must_transfer_leader(region.get_id(), new_peer(1, 1));
// To ensure followers have reported disk usages to the leader.
for i in [2u64, 3] {
fail::cfg(get_fp(DiskUsage::AlmostFull, i), "return").unwrap();
}
for i in [4u64, 5] {
fail::cfg(get_fp(DiskUsage::AlreadyFull, i), "return").unwrap();
}
for i in 1..5 {
ensure_disk_usage_is_reported(&mut cluster, i + 1, i + 1, ®ion);
}
let lead_client = PeerClient::new(&cluster, 1, new_peer(1, 1));
let prewrite_ts = get_tso(&cluster.pd_client);
let res = lead_client.try_kv_prewrite(
vec![new_mutation(Op::Put, b"k2", b"v2")],
b"k2".to_vec(),
prewrite_ts,
DiskFullOpt::AllowedOnAlmostFull,
);
assert!(!res.get_region_error().has_disk_full());
lead_client.must_kv_commit(
vec![b"k2".to_vec()],
prewrite_ts,
get_tso(&cluster.pd_client),
);
let index_1 = cluster.raft_local_state(1, 1).last_index;
let index_2 = cluster.raft_local_state(1, 2).last_index;
let index_3 = cluster.raft_local_state(1, 3).last_index;
let index_4 = cluster.raft_local_state(1, 4).last_index;
let index_5 = cluster.raft_local_state(1, 5).last_index;
assert!(index_1 == index_2 && index_1 == index_3 && index_1 > index_4 && index_1 > index_5);
for i in [2u64, 3] {
fail::remove(get_fp(DiskUsage::AlmostFull, i));
}
for i in [4u64, 5] {
fail::remove(get_fp(DiskUsage::AlreadyFull, i));
}
} | rust_cleaned_test_functions.jsonl/64931 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 843
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
94418,
8378,
80772,
16372,
74540,
368,
341,
262,
1077,
5206,
10652,
284,
501,
12015,
28441,
7,
15,
11,
220,
20,
317,
262,
442,
2014,
5978,
279,
4516,
702,
2480,
3553,
13364,
10431,
4132,
316,
36... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 9 |
#[test]
fn test_connect_slices() {
fn t(v: &[&str], sep: &str, s: &str) {
assert_eq!(v.connect(sep).as_slice(), s);
}
t(["you", "know", "I'm", "no", "good"],
" ", "you know I'm no good");
t([], " ", "");
t(["hi"], " ", "hi");
} | rust_cleaned_test_functions.jsonl/56801 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 173
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15720,
87288,
368,
341,
286,
5168,
259,
3747,
25,
44590,
5,
495,
1125,
21017,
25,
609,
495,
11,
274,
25,
609,
495,
8,
341,
310,
2060,
10714,
10297,
85,
10800,
10478,
79,
568,
300,
26488,
1507,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_connect() {
let mut s = socket();
s.local_seq_no = LOCAL_SEQ;
s.connect(REMOTE_END, LOCAL_END.port).unwrap();
assert_eq!(s.local_endpoint, IpEndpoint::new(MOCK_UNSPECIFIED, LOCAL_END.port));
recv!(s, [TcpRepr {
control: TcpControl::Syn,
seq_number: LOCAL_SEQ,
ack_number: None,
max_seg_size: Some(BASE_MSS),
..RECV_TEMPL
}]);
send!(s, TcpRepr {
control: TcpControl::Syn,
seq_number: REMOTE_SEQ,
ack_number: Some(LOCAL_SEQ + 1),
max_seg_size: Some(BASE_MSS - 80),
..SEND_TEMPL
});
assert_eq!(s.local_endpoint, LOCAL_END);
} | rust_cleaned_test_functions.jsonl/1710 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 438
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15720,
368,
341,
286,
1077,
5206,
274,
284,
7575,
543,
286,
274,
11033,
14486,
6536,
284,
42501,
50045,
280,
286,
274,
10800,
43202,
37528,
10898,
11,
42501,
10898,
14598,
568,
15454,
543,
286,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_linuxcontainer_signal() {
let ret = new_linux_container_and_then(|c: LinuxContainer| {
c.signal(nix::sys::signal::SIGCONT, true)
});
assert!(ret.is_ok(), "Expecting Ok, Got {:?}", ret);
} | rust_cleaned_test_functions.jsonl/16631 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 123
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
77463,
3586,
21137,
368,
341,
286,
1077,
2112,
284,
501,
77463,
15847,
8378,
68367,
22428,
66,
25,
14340,
4502,
91,
341,
310,
272,
50453,
1445,
941,
486,
7791,
486,
26622,
486,
50631,
23312,
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 |
#[test]
fn test_2192_times_zero() {
let two192 = Z25519 {
value: U256 {
limbs: [0, 0, 0, 1],
},
};
assert_eq!(two192 * Z25519::from(0), 0.into());
} | rust_cleaned_test_functions.jsonl/64948 | {
"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,
62,
17,
16,
24,
17,
22353,
19359,
368,
341,
286,
1077,
1378,
16,
24,
17,
284,
1863,
17,
20,
20,
16,
24,
341,
310,
897,
25,
547,
17,
20,
21,
341,
394,
48595,
25,
508,
15,
11,
220,
15,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_should_panic() {
fn f() {
panic!();
}
let desc = TestDescAndFn {
desc: TestDesc {
name: StaticTestName("whatever"),
ignore: false,
should_panic: ShouldPanic::Yes,
allow_fail: false,
compile_fail: false,
no_run: false,
test_type: TestType::Unknown,
},
testfn: DynTestFn(Box::new(f)),
};
let (tx, rx) = channel();
run_test(&TestOpts::new(), false, TestId(0), desc, RunStrategy::InProcess, tx, Concurrent::No);
let result = rx.recv().unwrap().result;
assert_eq!(result, TrOk);
} | rust_cleaned_test_functions.jsonl/7702 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 323
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43378,
620,
31270,
368,
341,
262,
5168,
282,
368,
341,
286,
21975,
0,
543,
262,
456,
262,
1077,
6560,
284,
3393,
11065,
3036,
24911,
341,
286,
6560,
25,
3393,
11065,
341,
310,
829,
25,
23105,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_expr_error() {
let mut mint = Mint::new("tests/it/testdata");
let mut file = mint.new_goldenfile("expr-error.txt").unwrap();
let cases = &[
r#"5 * (a and ) 1"#,
r#"a + +"#,
r#"G.E.B IS NOT NULL AND
col1 NOT BETWEEN col2 AND
AND 1 + col3 DIV sum(col4)"#,
];
for case in cases {
test_parse!(file, expr, case);
}
} | rust_cleaned_test_functions.jsonl/118107 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 221
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21915,
4096,
368,
341,
262,
1077,
5206,
28337,
284,
41310,
486,
931,
445,
23841,
14,
275,
12697,
691,
797,
262,
1077,
5206,
1034,
284,
28337,
4618,
54696,
268,
1192,
445,
9413,
18917,
3909,
1827,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_raw_string_csv() {
let mut reader = Reader::init("```\nline1\nline2\nline3\n```");
assert_eq!(
raw_string(&mut reader).unwrap(),
RawString {
newline: Whitespace {
value: String::from("\n"),
source_info: SourceInfo::init(1, 4, 2, 1),
},
value: Template {
quotes: false,
elements: vec![TemplateElement::String {
value: "line1\nline2\nline3\n".to_string(),
encoded: "line1\nline2\nline3\n".to_string(),
}],
source_info: SourceInfo::init(2, 1, 5, 1),
},
}
);
} | rust_cleaned_test_functions.jsonl/119583 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 476
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16067,
3904,
14020,
368,
341,
286,
1077,
5206,
6604,
284,
25166,
486,
2327,
445,
13874,
61069,
77,
1056,
16,
1699,
1056,
17,
1699,
1056,
18,
1699,
73594,
797,
286,
2060,
10714,
33673,
310,
7112,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_intact_distance_ring_buffer0() {
static BR:&'static[u8] = &[0x1b, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x80, 0xe3, 0xb4, 0x0d, 0x00, 0x00,
0x07, 0x5b, 0x26, 0x31, 0x40, 0x02, 0x00, 0xe0, 0x4e, 0x1b, 0xa1, 0x80,
0x20, 0x00];
static OUT:&'static[u8] = b"himselfself";
assert_decompressed_input_matches_output(BR,
OUT,
65536,
65536);
} | rust_cleaned_test_functions.jsonl/26469 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 381
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4042,
531,
19464,
34683,
7776,
15,
368,
341,
220,
1099,
18803,
35218,
6,
1978,
21335,
23,
60,
284,
44590,
15,
87,
16,
65,
11,
220,
15,
87,
15,
64,
11,
220,
15,
87,
15,
15,
11,
220,
15,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cli_get_config_bad_json() {
let json = r#"{asdf"#;
let mut tmpfile = NamedTempFile::new().expect("Failed to create tmp file");
writeln!(tmpfile, "{}", json).expect("Failed to write to tmp file");
// should use the default values
let cli = Cli {
config: tmpfile.path().to_owned(),
verbose: true,
};
let result = cli.get_config();
assert!(result.is_err());
let error = result.unwrap_err();
let matches = match error {
CliError::Deserialize(message) => message == "key must be a string at line 1 column 2",
_ => false,
};
assert!(matches);
} | rust_cleaned_test_functions.jsonl/115805 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 331
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47147,
3062,
5332,
34199,
9455,
368,
341,
286,
1077,
2951,
284,
435,
2,
14129,
76615,
57676,
401,
286,
1077,
5206,
4174,
1192,
284,
40459,
12151,
1703,
486,
931,
1005,
17119,
445,
9408,
311,
1855,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_eth_sign() {
let f = File::open("tests/sign.txt").unwrap();
let file = BufReader::new(&f);
let mut sec_hex = "".to_string();
let mut msg_hex = "".to_string();
let mut sig_hex;
for (_, s) in file.lines().enumerate() {
let line = s.unwrap();
let v: Vec<&str> = line.split(' ').collect();
match v[0] {
"sec" => sec_hex = v[1].to_string(),
"msg" => msg_hex = v[1].to_string(),
"out" => {
sig_hex = v[1].to_string();
one_test_eth_sign(&sec_hex, &msg_hex, &sig_hex);
}
_ => assert!(false),
}
}
} | rust_cleaned_test_functions.jsonl/8594 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 358
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57757,
11172,
368,
341,
262,
1077,
282,
284,
2887,
486,
2508,
445,
23841,
35763,
3909,
1827,
15454,
543,
262,
1077,
1034,
284,
69013,
5062,
486,
931,
2099,
69,
317,
262,
1077,
5206,
5701,
32655,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_example() {
let mut grid = parse_grid("5483143223\n2745854711\n5264556173\n6141336146\n6357385478\n4167524645\n2176841721\n6882881134\n4846848554\n5283751526\n");
grid.step();
assert_eq!(grid, parse_grid("6594254334\n3856965822\n6375667284\n7252447257\n7468496589\n5278635756\n3287952832\n7993992245\n5957959665\n6394862637\n"));
grid.step();
assert_eq!(grid, parse_grid("8807476555\n5089087054\n8597889608\n8485769600\n8700908800\n6600088989\n6800005943\n0000007456\n9000000876\n8700006848\n"));
} | rust_cleaned_test_functions.jsonl/27022 | {
"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,
39304,
368,
341,
286,
1077,
5206,
5827,
284,
4715,
15604,
445,
20,
19,
23,
18,
16,
19,
18,
17,
17,
18,
1699,
17,
22,
19,
20,
23,
20,
19,
22,
16,
16,
1699,
20,
17,
21,
19,
20,
20,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_max_age() {
let h = Header::parse_header(&[b"max-age=31536000".to_vec()][..]);
assert_eq!(h.ok(), Some(StrictTransportSecurity { include_subdomains: false, max_age: 31536000u64 }));
} | rust_cleaned_test_functions.jsonl/37329 | {
"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,
21039,
6345,
32053,
368,
341,
286,
1077,
305,
284,
12104,
486,
6400,
8757,
2099,
58,
65,
1,
2810,
42941,
28,
18,
16,
20,
18,
21,
15,
15,
15,
3263,
983,
13251,
75453,
496,
2558,
286,
2060,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tag_downcast_ref_with_id() {
let tag = DummyTag::new(132, 1);
let t: &dyn ILTag = &tag;
match tag_downcast_ref_with_id::<DummyTag>(132, t) {
Some(v) => assert_eq!(0, v.get_dummy()),
None => panic!(),
}
match tag_downcast_ref_with_id::<DummyTag>(133, t) {
None => (),
Some(_) => panic!(),
}
let tag = ILRawTag::default_with_id(123);
let t: &dyn ILTag = &tag;
match tag_downcast_ref_with_id::<DummyTag>(123, t) {
None => (),
Some(_) => panic!(),
}
} | rust_cleaned_test_functions.jsonl/25693 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 282
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9372,
13998,
3829,
7793,
6615,
842,
368,
341,
262,
1077,
4772,
284,
50567,
5668,
486,
931,
7,
16,
18,
17,
11,
220,
16,
317,
262,
1077,
259,
25,
609,
43085,
11344,
5668,
284,
609,
4578,
401,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_splice_items_zero_sized() {
let mut vec = vec![(), (), ()];
let vec2 = vec![];
let t: Vec<_> = vec.splice(1..2, vec2.iter().cloned()).collect();
assert_eq!(vec, &[(), ()]);
assert_eq!(t, &[()]);
} | rust_cleaned_test_functions.jsonl/24432 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10123,
4754,
12134,
19359,
643,
1506,
368,
341,
262,
1077,
5206,
7486,
284,
7486,
20703,
1507,
38104,
1719,
935,
262,
1077,
7486,
17,
284,
7486,
0,
15078,
262,
1077,
259,
25,
11312,
32399,
29,
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_partially_unbond() {
let mut stakes = new_stakes(&[(KEY1, 50)]);
assert_eq!(
Ok(U512::from(4)),
stakes.unbond(&PublicKey::new(KEY1), Some(U512::from(4)))
);
assert_eq!(new_stakes(&[(KEY1, 46)]), stakes);
} | rust_cleaned_test_functions.jsonl/22344 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10495,
33475,
4907,
64239,
368,
341,
286,
1077,
5206,
44425,
284,
501,
1261,
2050,
2099,
9697,
4784,
16,
11,
220,
20,
15,
41958,
286,
2060,
10714,
33673,
310,
7622,
12317,
20,
16,
17,
486,
1499,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_start_txt_end() {
let mut r = Reader::from_str("<a>test</a>");
r.trim_text(true);
next_eq!(r, Start, b"a", Text, b"test", End, b"a");
} | rust_cleaned_test_functions.jsonl/42070 | {
"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,
4906,
22436,
6213,
368,
341,
262,
1077,
5206,
435,
284,
25166,
486,
1499,
2895,
9639,
64,
29,
1944,
522,
64,
15084,
262,
435,
16419,
4326,
3715,
317,
262,
1790,
10714,
10297,
81,
11,
5145,
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 |
#[test]
fn test_ordering_of_governance_transactions() {
let gov_roles = vec![
GovernanceRole::DijetsRoot,
GovernanceRole::TreasuryCompliance,
GovernanceRole::Validator,
GovernanceRole::ValidatorOperator,
GovernanceRole::DesignatedDealer,
];
for role1 in &gov_roles {
for role2 in &gov_roles {
let (mut pool, mut consensus) = setup_mempool();
let txn1 = TestTransaction::new(0, 0, 100);
let txn2 = TestTransaction::new(1, 0, 200);
let mut gov_txn1 = TestTransaction::new(2, 0, 2);
let mut gov_txn2 = TestTransaction::new(3, 0, 1);
gov_txn1.governance_role = *role1;
gov_txn2.governance_role = *role2;
let _ = add_txns_to_mempool(
&mut pool,
vec![
txn1.clone(),
txn2.clone(),
gov_txn1.clone(),
gov_txn2.clone(),
],
);
// If the first role is "less than" the second then we should swap them since the
// second txn should have higher priority.
if role1.priority() < role2.priority() {
std::mem::swap(&mut gov_txn1, &mut gov_txn2);
}
assert_eq!(
consensus.get_block(&mut pool, 1),
vec!(gov_txn1.make_signed_transaction())
);
assert_eq!(
consensus.get_block(&mut pool, 1),
vec!(gov_txn2.make_signed_transaction())
);
assert_eq!(
consensus.get_block(&mut pool, 1),
vec!(txn2.make_signed_transaction())
);
assert_eq!(
consensus.get_block(&mut pool, 1),
vec!(txn1.make_signed_transaction())
);
}
}
} | rust_cleaned_test_functions.jsonl/80929 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1063
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7869,
287,
3575,
1889,
6706,
681,
68182,
368,
341,
262,
1077,
47625,
43061,
284,
7486,
90515,
286,
80589,
9030,
486,
35,
3172,
1415,
8439,
345,
286,
80589,
9030,
486,
65775,
26102,
1092,
31612,
34... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_open_options() {
assert_ne!(getPageSize(), 5000);
let random_file = RandomFile::new();
{
let db = OpenOptions::new()
.pagesize(5000)
.num_pages(100)
.open(&random_file)
.unwrap();
assert_eq!(db.pagesize(), 5000);
}
{
let metadata = random_file.path.metadata().unwrap();
assert!(metadata.is_file());
assert_eq!(metadata.len(), 500_000);
}
{
let db = OpenOptions::new()
.pagesize(5000)
.num_pages(100)
.open(&random_file)
.unwrap();
assert_eq!(db.pagesize(), 5000);
}
} | rust_cleaned_test_functions.jsonl/43249 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 451
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11311,
8743,
368,
341,
286,
2060,
13925,
10297,
455,
45917,
1507,
220,
20,
15,
15,
15,
317,
286,
1077,
4194,
2458,
284,
10612,
1703,
486,
931,
543,
286,
341,
310,
1077,
2927,
284,
5264,
3798,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_handle_e2e() {
let dir = tempdir().unwrap();
let home = Home::new(dir.path()).unwrap();
handle(
&home,
String::from(DEFAULT_BLOCKCHAIN),
PathBuf::from(dir.path()),
)
.unwrap();
// spot check move starter files
let expected_example_content = String::from_utf8_lossy(include_bytes!(
"../../move/examples/main/sources/Message.move"
));
let actual_example_content =
fs::read_to_string(dir.path().join("main/sources/Message.move")).unwrap();
assert_eq!(expected_example_content, actual_example_content);
// spot check stdlib
let expected_example_content = String::from_utf8_lossy(include_bytes!(
"../../move/examples/stdlib/sources/GUID.move"
));
let actual_example_content =
fs::read_to_string(dir.path().join("stdlib/sources/GUID.move")).unwrap();
assert_eq!(expected_example_content, actual_example_content);
} | rust_cleaned_test_functions.jsonl/51503 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 484
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10630,
2204,
17,
68,
368,
341,
286,
1077,
5419,
284,
2730,
3741,
1005,
15454,
543,
286,
1077,
2114,
284,
5379,
486,
931,
14161,
3875,
6011,
15454,
543,
286,
3705,
1006,
310,
609,
5117,
345,
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_vcx_init_called_twice_fails() {
init!("ledger");
wallet::close_wallet().unwrap();
pool::close().unwrap();
let content = "{}";
let cb = return_types_u32::Return_U32::new().unwrap();
assert_eq!(vcx_init_with_config(cb.command_handle,
CString::new(content).unwrap().into_raw(),
Some(cb.get_callback())),
error::SUCCESS.code_num);
cb.receive(Some(Duration::from_secs(10))).unwrap();
// Repeat call
let cb = return_types_u32::Return_U32::new().unwrap();
assert_eq!(vcx_init_with_config(cb.command_handle,
CString::new(content).unwrap().into_raw(),
Some(cb.get_callback())),
error::ALREADY_INITIALIZED.code_num);
} | rust_cleaned_test_functions.jsonl/127533 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 517
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
25844,
6137,
27859,
54178,
558,
761,
6209,
368,
341,
286,
2930,
17223,
50704,
797,
286,
15085,
486,
5552,
62308,
1005,
15454,
543,
286,
7314,
486,
5552,
1005,
15454,
1428,
286,
1077,
2213,
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_syn_sent_sanity() {
let mut s = socket();
s.local_seq_no = LOCAL_SEQ;
s.connect(REMOTE_END, LOCAL_END).unwrap();
sanity!(s, socket_syn_sent());
} | rust_cleaned_test_functions.jsonl/1714 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51393,
24115,
643,
38270,
368,
341,
286,
1077,
5206,
274,
284,
7575,
543,
286,
274,
11033,
14486,
6536,
262,
284,
42501,
50045,
280,
286,
274,
10800,
43202,
37528,
10898,
11,
42501,
10898,
568,
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_prefix_neighbor() {
let mut t = RbTree::<Vec<u8>, Vec<u8>>::new();
insert(&mut t, b"a/b", vec![0]);
insert(&mut t, b"a/b/c", vec![1]);
insert(&mut t, b"a/b/d", vec![2]);
insert(&mut t, b"a/c/d", vec![3]);
assert_eq!(t.right_prefix_neighbor(b"a/b/c"), Some(&b"a/b/d"[..]));
assert_eq!(t.right_prefix_neighbor(b"a/b"), Some(&b"a/c/d"[..]));
assert_eq!(t.right_prefix_neighbor(b"a/c/d"), None);
assert_eq!(t.right_prefix_neighbor(b"a"), None);
} | rust_cleaned_test_functions.jsonl/57903 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 268
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13974,
71888,
368,
341,
262,
1077,
5206,
259,
284,
431,
65,
6533,
27638,
10050,
34837,
23,
8066,
11312,
34837,
23,
77595,
931,
543,
262,
5656,
2099,
6984,
259,
11,
293,
56693,
3470,
497,
7486,
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_new_connection_id() {
let f = Frame::NewConnectionId {
sequence_number: 0x1234,
retire_prior: 0,
connection_id: vec![0x01, 0x02],
stateless_reset_token: [9; 16],
};
enc_dec(&f, "1852340002010209090909090909090909090909090909");
} | rust_cleaned_test_functions.jsonl/30429 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 179
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
15866,
842,
368,
341,
286,
1077,
282,
284,
16321,
486,
3564,
4526,
764,
341,
310,
8500,
5500,
25,
220,
15,
87,
16,
17,
18,
19,
345,
310,
15800,
58782,
25,
220,
15,
345,
310,
3633,
842,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sdk_info_from_user_agent() {
// Invalid user agents:
assert_eq!(sdk_info_from_user_agent(None), SdkInfo::default());
assert_eq!(sdk_info_from_user_agent(Some("")), SdkInfo::default());
assert_eq!(
sdk_info_from_user_agent(Some("very-custom-unreal / 1.1.1")),
SdkInfo::default()
);
assert_eq!(
sdk_info_from_user_agent(Some("diem-client-sdk-python / 0.12.223")),
SdkInfo::default()
);
assert_eq!(
sdk_info_from_user_agent(Some("diem-client-sdk-python / 105.12.22")),
SdkInfo::default()
);
// Valid user agents:
assert_eq!(
sdk_info_from_user_agent(Some("diem-client-SdK-JaVa/ 3.21.09")),
SdkInfo {
language: SdkLang::Java,
version: SdkVersion {
major: 3,
minor: 21,
patch: 9
}
}
);
assert_eq!(
sdk_info_from_user_agent(Some("diem-client-SdK-cpp/3.21.09")),
SdkInfo {
language: SdkLang::Cpp,
version: SdkVersion {
major: 3,
minor: 21,
patch: 9
}
}
);
assert_eq!(
sdk_info_from_user_agent(Some("diem-client-sdk-python / 0.1.22")),
SdkInfo {
language: SdkLang::Python,
version: SdkVersion {
major: 0,
minor: 1,
patch: 22
}
}
);
} | rust_cleaned_test_functions.jsonl/102719 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 865
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
61783,
3109,
5673,
3317,
25730,
368,
341,
262,
442,
13882,
1196,
13009,
510,
262,
2060,
10714,
10297,
51295,
3109,
5673,
3317,
25730,
26717,
701,
328,
7584,
1731,
486,
2258,
1423,
262,
2060,
10714,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_chained_environments() -> Result<(), Error> {
let decl = ComponentDecl {
environments: vec![
EnvironmentDeclBuilder::new()
.name("env")
.add_runner(cm_rust::RunnerRegistration {
source: RegistrationSource::Child("childA".into()),
source_name: "foo".into(),
target_name: "foo".into(),
})
.build(),
EnvironmentDeclBuilder::new()
.name("env2")
.add_runner(cm_rust::RunnerRegistration {
source: RegistrationSource::Child("childB".into()),
source_name: "bar".into(),
target_name: "bar".into(),
})
.build(),
],
children: vec![
ChildDeclBuilder::new_lazy_child("childA").build(),
ChildDeclBuilder::new_lazy_child("childB").environment("env").build(),
ChildDeclBuilder::new_lazy_child("childC").environment("env2").build(),
],
..default_component_decl()
};
let mut expected: Vec<(DependencyNode, Vec<DependencyNode>)> = Vec::new();
expected.push((
DependencyNode::Child("childA".to_string()),
vec![DependencyNode::Child("childB".to_string())],
));
expected.push((
DependencyNode::Child("childB".to_string()),
vec![DependencyNode::Child("childC".to_string())],
));
expected.push((DependencyNode::Child("childC".to_string()), vec![]));
validate_results(expected, process_component_dependencies(&decl));
Ok(())
} | rust_cleaned_test_functions.jsonl/63295 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 945
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4138,
2627,
6205,
17866,
368,
1464,
5714,
68843,
4600,
29,
341,
286,
1077,
3963,
284,
5578,
21629,
341,
310,
21737,
25,
7486,
90515,
394,
11586,
21629,
3297,
486,
931,
741,
503,
659,
606,
445,
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_name() {
let tail = " .";
fn wrap(s: &str) -> String {
format!(" \t {} .", s)
}
struct Case {
input: String,
want: String,
err: bool,
}
for case in vec![
Case {
input: wrap("abc_def"),
want: "abc_def".into(),
err: false,
},
Case {
input: wrap("__9A0bc_def__"),
want: "__9A0bc_def__".into(),
err: false,
},
Case {
input: wrap("consul_serf_events_consul:new_leader"),
want: "consul_serf_events_consul:new_leader".into(),
err: false,
},
Case {
input: wrap("99"),
want: "".into(),
err: true,
},
] {
let result = parse_name(&case.input);
match case.err {
true => assert!(result.is_err()),
_ => {
let (left, r) = result.unwrap();
assert_eq!(left, tail);
assert_eq!(case.want, r);
}
}
}
} | rust_cleaned_test_functions.jsonl/78088 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 812
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
1269,
368,
341,
286,
1077,
9787,
284,
330,
220,
659,
3302,
286,
5168,
15061,
1141,
25,
609,
495,
8,
1464,
923,
341,
310,
3561,
17223,
220,
1124,
83,
4687,
220,
659,
497,
274,
340,
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_optflagmulti_short1() {
let args = vec!("-v".to_string());
let opts = vec!(optflagmulti("v", "verbose", "verbosity"));
let rs = getopts(args.as_slice(), opts.as_slice());
match rs {
Ok(ref m) => {
assert_eq!(m.opt_count("v"), 1);
}
_ => panic!()
}
} | rust_cleaned_test_functions.jsonl/11188 | {
"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,
15032,
9903,
26268,
16673,
16,
368,
341,
286,
1077,
2827,
284,
7486,
0,
13645,
85,
3263,
983,
3904,
1423,
286,
1077,
12185,
284,
7486,
10297,
2912,
9903,
26268,
445,
85,
497,
330,
14883,
497,
33... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_3() {
assert_eq!(
parse("assign @user"),
Ok(Some(AssignCommand::User {
username: "user".to_owned()
})),
);
} | rust_cleaned_test_functions.jsonl/19377 | {
"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,
62,
18,
368,
341,
262,
2060,
10714,
33673,
286,
4715,
445,
6983,
569,
872,
4461,
286,
7622,
65405,
4346,
778,
622,
4062,
486,
1474,
341,
310,
5934,
25,
330,
872,
3263,
983,
51973,
741,
286,
78... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_path() {
let rules = create_rules(
r#"
macro_rules! foo {
($ i:path) => {
fn foo() { let a = $ i; }
}
}
"#,
);
assert_expansion(MacroKind::Items, &rules, "foo! { foo }", "fn foo () {let a = foo ;}");
assert_expansion(
MacroKind::Items,
&rules,
"foo! { bar::<u8>::baz::<u8> }",
"fn foo () {let a = bar ::< u8 >:: baz ::< u8 > ;}",
);
} | rust_cleaned_test_functions.jsonl/14708 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 268
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2638,
368,
341,
262,
1077,
5601,
284,
1855,
21407,
1006,
286,
435,
2,
698,
286,
18072,
21407,
0,
15229,
341,
310,
1711,
600,
71796,
8,
589,
341,
394,
5168,
15229,
368,
314,
1077,
264,
284,
400... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_zinc_parse_nested_grid() {
let grid = r#"ver: "3.0"
test,val
M,<<
ver:"3.0"
end,date,val,dis,start,dateRule,weekdays,weekly,defaultEvent
00:00:00,"*-01-01",F,"New Years",00:00:00,,,,
00:00:00,,F,"Presidents Day",00:00:00,"3rd mon in feb",,,
00:00:00,"*-04-18",F,"Good Friday",00:00:00,,,,
00:00:00,,F,"Memorial Day",00:00:00,"last mon in may",,,
00:00:00,"*-07-04",F,"Independence Day",00:00:00,,,,
00:00:00,,F,"Labor Day",00:00:00,"1st mon in sep",,,
00:00:00,,F,"Thanksgiving Day",00:00:00,"4th thu in nov",,,
00:00:00,"*-12-25",F,"Christmas",00:00:00,,,,
16:00:00,,T,"MON 08:00 am — 04:00 pm",08:00:00,,"mon",M,
16:00:00,,T,"TUE 08:00 am — 04:00 pm",08:00:00,,"tue",M,
16:00:00,,T,"WED 08:00 am — 04:00 pm",08:00:00,,"wed",M,
16:00:00,,T,"THU 08:00 am — 04:00 pm",08:00:00,,"thu",M,
16:00:00,,T,"FRI 08:00 am — 04:00 pm",08:00:00,,"fri",M,
00:00:00,,F,,00:00:00,,"sun,mon,tue,wed,thu,fri,sat",,M
>>,
"#;
let mut input = Cursor::new(grid.as_bytes());
let mut parser = Parser::make(&mut input).expect("Parser");
let grid = parse_grid(&mut parser);
assert!(
grid.is_ok(),
"Grid decode error: {err:?}",
err = grid.map_err(|e| e.to_string())
);
let grid = grid.unwrap();
assert_eq!(
grid.columns
.iter()
.map(|c| c.name.as_str())
.collect::<Vec<&str>>(),
vec!["test", "val",]
);
assert_eq!(
Grid::try_from(&grid.rows[0]["val"]).expect("Grid").len(),
14
)
} | rust_cleaned_test_functions.jsonl/21740 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1088
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6415,
2840,
21039,
66279,
15604,
368,
341,
286,
1077,
5827,
284,
435,
55543,
423,
25,
330,
18,
13,
15,
698,
310,
1273,
51557,
198,
310,
386,
11,
2442,
198,
310,
2739,
2974,
18,
13,
15,
698,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_list_value() {
let mut m = TestFmtJsonWellKnownTypes::new();
m.mut_list_value().values.push({
let mut v = Value::new();
v.set_number_value(2.0);
v
});
m.mut_list_value().values.push({
let mut v = Value::new();
v.set_bool_value(false);
v
});
test_json_print_parse_message("{\"listValue\": [2.0, false]}", &m);
} | rust_cleaned_test_functions.jsonl/49809 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2019,
3142,
368,
341,
262,
1077,
5206,
296,
284,
3393,
93322,
5014,
11395,
48206,
4173,
486,
931,
543,
262,
296,
744,
332,
2019,
3142,
1005,
3661,
2552,
2262,
286,
1077,
5206,
348,
284,
5162,
48... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_default_categories() {
// This tests the code in a string that is passed as a default to argh. It is compile
let cmd = Start::from_args(START_CMD_NAME, &[]).unwrap();
assert_eq!(cmd.categories.len(), DEFAULT_CATEGORIES.len());
for category in DEFAULT_CATEGORIES {
assert!(cmd.categories.iter().any(|c| c == category));
}
} | rust_cleaned_test_functions.jsonl/15126 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9993,
27542,
368,
341,
286,
442,
1096,
7032,
279,
2038,
304,
264,
914,
429,
374,
5823,
438,
264,
1638,
311,
796,
866,
13,
1084,
374,
19192,
8945,
286,
1077,
5439,
284,
5145,
486,
1499,
8384,
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... | 2 |
#[test]
fn test_simple_for_loop() {
disassemble(&setup(), "for_loop");
assert_eq!(
execute_function(&setup(), "for_loop", vec![]).unwrap(),
gears_obj!(19)
);
} | rust_cleaned_test_functions.jsonl/9518 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 93
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
5478,
17198,
368,
341,
262,
827,
69108,
2099,
15188,
1507,
330,
1958,
17198,
797,
262,
2060,
10714,
33673,
286,
9026,
9174,
2099,
15188,
1507,
330,
1958,
17198,
497,
7486,
0,
1294,
568,
154... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_window() {
use fallible_iterator::FallibleIterator;
let db = Connection::open_in_memory().unwrap();
db.create_window_function("sumint", 1, true, Sum).unwrap();
db.execute_batch(
"CREATE TABLE t3(x, y);
INSERT INTO t3 VALUES('a', 4),
('b', 5),
('c', 3),
('d', 8),
('e', 1);",
)
.unwrap();
let mut stmt = db
.prepare(
"SELECT x, sumint(y) OVER (
ORDER BY x ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING
) AS sum_y
FROM t3 ORDER BY x;",
)
.unwrap();
let results: Vec<(String, i64)> = stmt
.query(NO_PARAMS)
.unwrap()
.map(|row| Ok((row.get("x")?, row.get("sum_y")?)))
.collect()
.unwrap();
let expected = vec![
("a".to_owned(), 9),
("b".to_owned(), 12),
("c".to_owned(), 16),
("d".to_owned(), 12),
("e".to_owned(), 9),
];
assert_eq!(expected, results);
} | rust_cleaned_test_functions.jsonl/41673 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 720
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12571,
368,
341,
286,
990,
4399,
1238,
13491,
486,
49772,
1238,
11951,
401,
286,
1077,
2927,
284,
11032,
486,
2508,
1243,
19195,
1005,
15454,
543,
286,
2927,
2520,
12571,
9174,
445,
1242,
396,
497... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_mul() {
let one: ModInt = ModInt::one();
let one2: ModInt = ModInt::one();
let one_mul: ModInt = one * one2;
assert_eq!(BigInt::one(), one_mul.value);
assert_eq!(BigInt::zero(), one_mul.modulus);
let two: ModInt = ModInt::from_value_modulus(
BigInt::from(2),
BigInt::from(4),
);
let three: ModInt = ModInt::from_value_modulus(
BigInt::from(3),
BigInt::from(4),
);
// 2 * 3 mod 4 = 2
let two = two * three;
assert_eq!(BigInt::from(2), two.value);
assert_eq!(BigInt::from(4), two.modulus);
} | rust_cleaned_test_functions.jsonl/126148 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 357
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24944,
368,
341,
286,
1077,
825,
25,
5650,
1072,
284,
5650,
1072,
486,
603,
543,
286,
1077,
825,
17,
25,
5650,
1072,
284,
5650,
1072,
486,
603,
1428,
286,
1077,
825,
24944,
25,
5650,
1072,
284... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vec() {
let mut c = Class::new("Foo");
c.parameters.append("T");
c.implements = vec![local("Super").into()];
let t: Tokens<Swift> = c.into();
let s = t.to_string();
let out = s.as_ref().map(|s| s.as_str());
assert_eq!(Ok("public class Foo<T> : Super {\n}"), out);
} | rust_cleaned_test_functions.jsonl/68236 | {
"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,
13251,
368,
341,
286,
1077,
5206,
272,
284,
3228,
486,
931,
445,
40923,
797,
286,
272,
27327,
2057,
445,
51,
797,
286,
272,
12053,
4674,
284,
7486,
20703,
2438,
445,
19284,
1827,
18122,
368,
482... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unsafe_transmute_on_in_array___from_number_to_ref___compiles_correctly() {
#[derive(Arraygen)]
#[gen_array(fn number_refs: &i32)]
struct Sut {
#[in_array(number_refs { unsafe_transmute })]
pub a: f32,
}
let actual = Sut { a: -1.23456789 };
assert_eq!(*actual.number_refs()[0], -1080162734);
} | rust_cleaned_test_functions.jsonl/76356 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 207
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
18675,
7965,
52214,
4470,
1243,
3858,
5973,
1499,
5500,
2346,
7793,
5973,
5689,
3658,
31550,
398,
368,
341,
286,
11506,
27098,
38192,
4370,
5563,
286,
11506,
4370,
3858,
24008,
1372,
60638,
25... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_imul_reg_reg() {
assert_emit!(0x0f, 0xaf, 0xc3; emit_imul_reg_reg(0, RBX, RAX));
assert_emit!(0x41, 0x0f, 0xaf, 0xcf; emit_imul_reg_reg(0, R15, RCX));
assert_emit!(0x48, 0x0f, 0xaf, 0xc3; emit_imul_reg_reg(1, RBX, RAX));
assert_emit!(0x49, 0x0f, 0xaf, 0xcf; emit_imul_reg_reg(1, R15, RCX));
} | rust_cleaned_test_functions.jsonl/85449 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 215
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17895,
360,
4920,
4920,
368,
341,
286,
2060,
69082,
10297,
15,
87,
15,
69,
11,
220,
15,
54795,
11,
220,
15,
8148,
18,
26,
16691,
17895,
360,
4920,
4920,
7,
15,
11,
27974,
55,
11,
431,
2954,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_ia5string() {
assert_parses::<IA5String>(&[
(Ok(IA5String::new("abc").unwrap()), b"\x16\x03abc"),
(Ok(IA5String::new(")").unwrap()), b"\x16\x01)"),
(
Err(ParseError::new(ParseErrorKind::InvalidValue)),
b"\x16\x03ab\xff",
),
])
} | rust_cleaned_test_functions.jsonl/40831 | {
"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,
21039,
62,
685,
20,
917,
368,
341,
286,
2060,
77113,
288,
27638,
5863,
20,
703,
44784,
9640,
310,
320,
11578,
7,
5863,
20,
703,
486,
931,
445,
13683,
1827,
15454,
11858,
293,
11934,
87,
16,
21... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_file_existed() {
let tempdir = tempfile::tempdir().unwrap();
let mut log_file = LogFile::new(tempdir.path(), "test_log_file", 2).unwrap();
let info = create_file_info(1, EncryptionMethod::Aes256Ctr);
log_file.insert("info", &info).unwrap();
let (_, file_dict) = LogFile::open(tempdir.path(), "test_log_file", 2, false).unwrap();
assert_eq!(*file_dict.files.get("info").unwrap(), info);
} | rust_cleaned_test_functions.jsonl/35558 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 203
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5224,
2458,
2702,
13236,
368,
341,
286,
1077,
2730,
3741,
284,
54819,
486,
3888,
3741,
1005,
15454,
543,
286,
1077,
5206,
1487,
2458,
284,
2835,
1703,
486,
931,
9758,
3741,
3875,
1507,
330,
1944,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_documentation() {
let schema = Schema::parse_str(
r#"{"type": "enum", "name": "Coin", "doc": "Some documentation", "symbols": ["heads", "tails"]}"#
).unwrap().schema;
let doc = match schema {
Schema::Enum { doc, .. } => doc,
_ => None,
};
assert_eq!("Some documentation".to_owned(), doc.unwrap());
} | rust_cleaned_test_functions.jsonl/24785 | {
"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,
26231,
367,
368,
341,
286,
1077,
10802,
284,
12539,
486,
6400,
2895,
1006,
310,
435,
55543,
4913,
1313,
788,
330,
9018,
497,
330,
606,
788,
330,
41180,
497,
330,
5236,
788,
330,
8373,
9705,
497,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_foreign_index() {
let mut a1 = [1, 2, 3u32];
let mut a2 = [4, 5, 6u32];
let s1 = Slice::new(&mut a1[..]).unwrap();
let mut s2 = Slice::new(&mut a2[..]).unwrap();
let _ = &s1[s2.first_idx()];
let _ = &mut s2[s1.last_idx()];
} | rust_cleaned_test_functions.jsonl/69770 | {
"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,
78983,
3560,
368,
341,
286,
1077,
5206,
264,
16,
284,
508,
16,
11,
220,
17,
11,
220,
18,
84,
18,
17,
935,
286,
1077,
5206,
264,
17,
284,
508,
19,
11,
220,
20,
11,
220,
21,
84,
18,
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_distance() {
assert_approx_eq(get_distance((0.0, 0.0), (0.0, 0.0)), 0.0);
assert_approx_eq(get_distance((0.0, 0.0), (10.0, 10.0)), 1568.5204);
assert_approx_eq(get_distance((10.0, 10.0), (-10.0, -10.0)), 3137.0413);
assert_approx_eq(get_distance((0.0, 0.0), (0.0, 180.0)), 20015.088);
assert_approx_eq(get_distance((90.0, 0.0), (-90.0, 180.0)), 20015.088);
} | rust_cleaned_test_functions.jsonl/90799 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 206
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19464,
368,
341,
262,
2060,
90425,
10714,
5433,
19464,
1188,
15,
13,
15,
11,
220,
15,
13,
15,
701,
320,
15,
13,
15,
11,
220,
15,
13,
15,
5731,
220,
15,
13,
15,
317,
262,
2060,
90425,
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_timespec_add() {
let a = Timespec::new(1, 2);
let b = Duration::seconds(2) + Duration::nanoseconds(3);
let c = a + b;
assert_eq!(c.sec, 3);
assert_eq!(c.nsec, 5);
let p = Timespec::new(1, super::NSEC_PER_SEC - 2);
let q = Duration::seconds(2) + Duration::nanoseconds(2);
let r = p + q;
assert_eq!(r.sec, 4);
assert_eq!(r.nsec, 0);
let u = Timespec::new(1, super::NSEC_PER_SEC - 2);
let v = Duration::seconds(2) + Duration::nanoseconds(3);
let w = u + v;
assert_eq!(w.sec, 4);
assert_eq!(w.nsec, 1);
let k = Timespec::new(1, 0);
let l = Duration::nanoseconds(-1);
let m = k + l;
assert_eq!(m.sec, 0);
assert_eq!(m.nsec, 999_999_999);
} | rust_cleaned_test_functions.jsonl/7347 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 444
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22353,
992,
2891,
368,
341,
286,
1077,
264,
284,
8523,
992,
486,
931,
7,
16,
11,
220,
17,
317,
286,
1077,
293,
284,
21045,
486,
17403,
7,
17,
8,
488,
21045,
486,
18759,
75889,
7,
18,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_pair() {
assert_eq!(parse_pair::<i32>("", ','), None);
assert_eq!(parse_pair::<i32>("10,", ','), None);
assert_eq!(parse_pair::<i32>(",10", ','), None);
assert_eq!(parse_pair::<i32>("10,20", ','), Some((10, 20)));
assert_eq!(parse_pair::<i32>("10,20xy", ','), None);
assert_eq!(parse_pair::<f64>("0.5x", 'x'), None);
assert_eq!(parse_pair::<f64>("0.5x1.5", 'x'), Some((0.5, 1.5)));
} | rust_cleaned_test_functions.jsonl/13244 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
14445,
368,
341,
262,
2060,
10714,
10297,
6400,
14445,
27638,
72,
18,
17,
13211,
497,
22262,
701,
2240,
317,
262,
2060,
10714,
10297,
6400,
14445,
27638,
72,
18,
17,
13211,
16,
15,
57955,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_thread_member() {
let route = Route::GetThreadMember {
channel_id: CHANNEL_ID,
user_id: USER_ID,
};
assert_eq!(
route.to_string(),
format!(
"channels/{channel_id}/thread-members/{user_id}",
channel_id = CHANNEL_ID,
user_id = USER_ID
)
);
} | rust_cleaned_test_functions.jsonl/119840 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 249
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
10814,
19388,
368,
341,
286,
1077,
6021,
284,
9572,
486,
1949,
6855,
9366,
341,
310,
5496,
842,
25,
58756,
3450,
345,
310,
1196,
842,
25,
13872,
3450,
345,
286,
2605,
286,
2060,
10714,
336... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mask_addresses() {
let m = Mask::from_str("000000000000000000000000000000X1001X").unwrap();
assert_eq!(m.addresses(42), vec![26, 27, 58, 59]);
let m = Mask::from_str("00000000000000000000000000000000X0XX").unwrap();
assert_eq!(m.addresses(26), vec![16, 17, 18, 19, 24, 25, 26, 27]);
} | rust_cleaned_test_functions.jsonl/120541 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9999,
59471,
368,
341,
286,
1077,
296,
284,
19924,
486,
1499,
2895,
445,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fs_add_assign() {
// // Random number
// // Test that adding zero has no effect.
// // Add one and test for the result.
// // Add another random number that exercises the reduction.
// // Add a random number to another one such that the result is s - 1
// // Add one to the result and test for it.
// Test associativity
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
for _ in 0..1000 {
let a = Fs::rand(&mut rng);
let b = Fs::rand(&mut rng);
let c = Fs::rand(&mut rng);
let mut tmp1 = a;
tmp1.add_assign(&b);
tmp1.add_assign(&c);
let mut tmp2 = b;
tmp2.add_assign(&c);
tmp2.add_assign(&a);
assert!(tmp1.is_valid());
assert!(tmp2.is_valid());
assert_eq!(tmp1, tmp2);
}
} | rust_cleaned_test_functions.jsonl/95511 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 530
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34470,
2891,
20688,
368,
341,
1066,
262,
442,
257,
442,
10612,
1372,
63477,
262,
442,
257,
442,
3393,
429,
7842,
7168,
702,
902,
2456,
624,
9401,
262,
442,
257,
442,
2691,
825,
323,
1273,
369,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_function_expression_defaults_and_pipes() {
let b = ast::BaseNode::default();
let symbols = ["a", "b", "c", "d"]
.into_iter()
.map(|s| (s.to_string(), Symbol::from(s)))
.collect::<BTreeMap<_, _>>();
let piped = FunctionParameter {
loc: b.location.clone(),
is_pipe: true,
key: Identifier {
loc: b.location.clone(),
name: symbols["a"].clone(),
},
default: Some(Expression::Integer(IntegerLit {
loc: b.location.clone(),
value: 0,
})),
};
let default1 = FunctionParameter {
loc: b.location.clone(),
is_pipe: false,
key: Identifier {
loc: b.location.clone(),
name: symbols["b"].clone(),
},
default: Some(Expression::Integer(IntegerLit {
loc: b.location.clone(),
value: 1,
})),
};
let default2 = FunctionParameter {
loc: b.location.clone(),
is_pipe: false,
key: Identifier {
loc: b.location.clone(),
name: symbols["c"].clone(),
},
default: Some(Expression::Integer(IntegerLit {
loc: b.location.clone(),
value: 2,
})),
};
let no_default = FunctionParameter {
loc: b.location.clone(),
is_pipe: false,
key: Identifier {
loc: b.location.clone(),
name: symbols["d"].clone(),
},
default: None,
};
let defaults = vec![&piped, &default1, &default2];
let f = FunctionExpr {
loc: b.location.clone(),
typ: type_info(),
params: vec![
piped.clone(),
default1.clone(),
default2.clone(),
no_default.clone(),
],
body: Block::Return(ReturnStmt {
loc: b.location.clone(),
argument: Expression::Binary(Box::new(BinaryExpr {
loc: b.location.clone(),
typ: type_info(),
operator: ast::Operator::AdditionOperator,
left: Expression::Identifier(IdentifierExpr {
loc: b.location.clone(),
typ: type_info(),
name: symbols["a"].clone(),
}),
right: Expression::Identifier(IdentifierExpr {
loc: b.location.clone(),
typ: type_info(),
name: symbols["b"].clone(),
}),
})),
}),
vectorized: None,
};
assert_eq!(defaults, f.defaults());
assert_eq!(Some(&piped), f.pipe());
} | rust_cleaned_test_functions.jsonl/131380 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1733
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9174,
28068,
42290,
8378,
620,
8923,
368,
341,
286,
1077,
293,
284,
11763,
486,
3978,
1955,
486,
2258,
543,
286,
1077,
17738,
284,
4383,
64,
497,
330,
65,
497,
330,
66,
497,
330,
67,
7026,
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_from_box_trait_zero_sized() {
use std::fmt::Debug;
let b: Box<Debug> = box ();
let r: Rc<Debug> = Rc::from(b);
assert_eq!(format!("{:?}", r), "()");
} | rust_cleaned_test_functions.jsonl/4677 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
10194,
78491,
19359,
643,
1506,
368,
341,
286,
990,
1460,
486,
12501,
486,
7939,
401,
286,
1077,
293,
25,
8261,
27,
7939,
29,
284,
3745,
9563,
286,
1077,
435,
25,
81463,
27,
7939,
29,
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 |
#[test]
fn test_log_normal() {
let mut lnorm = LogNormal::new(10.0, 10.0);
let mut rng = ::test::rng();
for _ in 0..1000 {
lnorm.sample(&mut rng);
lnorm.ind_sample(&mut rng);
}
} | rust_cleaned_test_functions.jsonl/48988 | {
"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,
5224,
13973,
368,
341,
286,
1077,
5206,
326,
20011,
284,
2835,
12206,
486,
931,
7,
16,
15,
13,
15,
11,
220,
16,
15,
13,
15,
317,
286,
1077,
5206,
28422,
284,
3504,
1944,
486,
69890,
543,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_peek_and_pop() {
let data = vec![2, 4, 6, 2, 1, 8, 10, 3, 5, 7, 0, 9, 1];
let mut sorted = data.clone();
sorted.sort();
let mut heap = BinaryHeap::from(data);
while !heap.is_empty() {
assert_eq!(heap.peek().unwrap(), sorted.last().unwrap());
assert_eq!(heap.pop().unwrap(), sorted.pop().unwrap());
}
} | rust_cleaned_test_functions.jsonl/62357 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 172
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
29107,
8378,
17061,
368,
341,
262,
1077,
821,
284,
7486,
20703,
17,
11,
220,
19,
11,
220,
21,
11,
220,
17,
11,
220,
16,
11,
220,
23,
11,
220,
16,
15,
11,
220,
18,
11,
220,
20,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_many_with_include() {
use std::io::Write;
let test_include = "Shape \"sphere\" \"float radius\" 1
Shape \"trianglemesh\"
\"integer indices\" [0 1 2 0 2 3]
\"point P\" [ -20 -20 0 20 -20 0 20 20 0 -20 20 0 ]
\"float st\" [ 0 0 1 0 1 1 0 1 ]";
let mut path = std::env::temp_dir();
path.push(Path::new("shapes.pbrt"));
{
std::env::set_current_dir(std::env::temp_dir()).unwrap();
let mut file = std::fs::File::create(&path).unwrap();
file.write(test_include.as_bytes()).unwrap();
file.flush().unwrap();
let parser = many_with_include(parse_shape);
let ast = parse!(parser, "Include \"shapes.pbrt\"\nShape \"sphere\" \"float radius\" 1");
assert_eq!(ast.len(), 3);
}
std::fs::remove_file(&path).unwrap();
} | rust_cleaned_test_functions.jsonl/68377 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 403
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22101,
6615,
37878,
368,
341,
262,
990,
1460,
486,
815,
486,
7985,
280,
262,
1077,
1273,
37878,
284,
330,
12301,
7245,
87410,
2105,
7245,
3649,
10578,
2105,
220,
16,
198,
262,
22526,
7245,
22446,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_walk_term_atomics() {
let number = value!(1);
let string = value!("Hi there!");
let boolean = value!(true);
let variable = value!(sym!("x"));
let rest_var = Value::RestVariable(sym!("rest"));
let list = Value::List(vec![
term!(number.clone()),
term!(string.clone()),
term!(boolean.clone()),
term!(variable.clone()),
term!(rest_var.clone()),
]);
let term = term!(list);
let mut v = TestVisitor::new();
v.visit_term(&term);
assert_eq!(v.visited, vec![number, string, boolean, variable, rest_var]);
} | rust_cleaned_test_functions.jsonl/77308 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 336
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56131,
17464,
3752,
23320,
368,
341,
286,
1077,
1372,
284,
897,
10297,
16,
317,
286,
1077,
914,
284,
897,
17223,
13048,
1052,
11142,
286,
1077,
2710,
284,
897,
10297,
1866,
317,
286,
1077,
3890,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_args_from() {
let v = args_from("--color=never -e exec-target Cargo.toml");
assert_eq!(v[0], "--color=never");
assert_eq!(v[1], "-e");
assert_eq!(v[2], "exec-target");
assert_eq!(v[3], "Cargo.toml");
} | rust_cleaned_test_functions.jsonl/48619 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8384,
5673,
368,
341,
286,
1077,
348,
284,
2827,
5673,
21549,
3423,
28,
36493,
481,
68,
3883,
18489,
220,
61288,
73494,
75,
797,
286,
2060,
10714,
10297,
85,
58,
15,
1125,
14482,
3423,
28,
36493... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mut_rchunks_exact() {
let mut v = [0, 1, 2, 3, 4, 5, 6];
assert_eq!(v.rchunks_exact_mut(3).len(), 2);
for (i, chunk) in v.rchunks_exact_mut(3).enumerate() {
for x in chunk {
*x = i as u8;
}
}
let result = [0, 1, 1, 1, 0, 0, 0];
assert_eq!(v, result);
} | rust_cleaned_test_functions.jsonl/12931 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 186
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29523,
1710,
84263,
71084,
368,
341,
262,
1077,
5206,
348,
284,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,
935,
262,
2060,
10714,
10297,
85,
174... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_unquote_str() {
let s = r#""Fran & Freddie's Diner""#;
let u = unquote_str(s);
assert_eq!(u, Some("Fran & Freddie's Diner".to_owned()));
let s = r#""Fran & Freddie's Diner\t\u263a""#;
let u = unquote_str(s);
assert_eq!(u, Some("Fran & Freddie's Diner\t☺".to_owned()));
} | rust_cleaned_test_functions.jsonl/76784 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 175
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
2949,
2895,
368,
341,
286,
1077,
274,
284,
435,
2,
3014,
75331,
609,
67262,
594,
422,
10453,
3014,
2,
280,
286,
1077,
575,
284,
650,
2949,
2895,
1141,
317,
286,
2060,
10714,
10297,
84,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_set_num_levels() {
let n = DBPath::new("_rust_rocksdb_test_set_num_levels");
{
let mut opts = Options::default();
opts.create_if_missing(true);
opts.set_num_levels(2);
let _db = DB::open(&opts, &n).unwrap();
}
} | rust_cleaned_test_functions.jsonl/131117 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 140
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
4273,
37819,
368,
341,
262,
1077,
308,
284,
5952,
1820,
486,
931,
16975,
35788,
26608,
14553,
1999,
4452,
2602,
4273,
37819,
797,
262,
341,
286,
1077,
5206,
12185,
284,
14566,
486,
2258,
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_image_parse_dockerhub() {
assert_eq!(
ImageRef::parse("alpine:3.10"),
ImageRef {
registry: None,
image: "alpine".into(),
tag: Some("3.10".into()),
hash: None
}
);
assert_eq!(
ImageRef::parse("foo/bar"),
ImageRef {
registry: None,
image: "foo/bar".into(),
tag: None,
hash: None
}
);
assert_eq!(
ImageRef::parse("clux/muslrust"),
ImageRef {
registry: None,
image: "clux/muslrust".into(),
tag: None,
hash: None
}
);
assert_eq!(
ImageRef::parse("clux/muslrust:1.41.0-stable"),
ImageRef {
registry: None,
image: "clux/muslrust".into(),
tag: Some("1.41.0-stable".into()),
hash: None
}
);
assert_eq!(
ImageRef::parse("fake_project/fake_image@fake_hash"),
ImageRef {
registry: None,
image: "fake_project/fake_image".into(),
tag: None,
hash: Some("fake_hash".into())
}
);
assert_eq!(
ImageRef::parse("fake_project/fake_image@"),
ImageRef {
registry: None,
image: "fake_project/fake_image".into(),
tag: None,
hash: Some("".into())
}
);
assert_eq!(
ImageRef::parse("fake_project/fake_image@sha256:"),
ImageRef {
registry: None,
image: "fake_project/fake_image".into(),
tag: None,
hash: Some("sha256:".into())
}
);
} | rust_cleaned_test_functions.jsonl/17929 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 800
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4954,
21039,
814,
13659,
26682,
368,
341,
262,
2060,
10714,
33673,
414,
4654,
3945,
486,
6400,
445,
278,
38038,
25,
18,
13,
16,
15,
4461,
414,
4654,
3945,
341,
286,
19424,
25,
2240,
345,
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_hash() {
let v1 = "this is a test".to_variant();
let v2 = "this is a test".to_variant();
let v3 = "test".to_variant();
let mut set = HashSet::new();
set.insert(v1);
assert!(set.contains(&v2));
assert!(!set.contains(&v3));
assert_eq!(
<HashMap<&str, (&str, u8, u32)>>::static_variant_type().as_str(),
"a{s(syu)}"
);
} | rust_cleaned_test_functions.jsonl/30217 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 243
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
368,
341,
286,
1077,
348,
16,
284,
330,
574,
374,
264,
1273,
3263,
983,
46112,
543,
286,
1077,
348,
17,
284,
330,
574,
374,
264,
1273,
3263,
983,
46112,
543,
286,
1077,
348,
18,
284,
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_por_circuit_sha256_base_2() {
test_por_circuit::<TreeBase<Sha256Hasher, U2>>(3, 272_295);
} | rust_cleaned_test_functions.jsonl/108247 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 60
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
76628,
666,
37268,
48836,
17,
20,
21,
7651,
62,
17,
368,
341,
262,
1273,
76628,
666,
37268,
27638,
6533,
3978,
27,
62316,
17,
20,
21,
6370,
261,
11,
547,
17,
25526,
18,
11,
220,
17,
22,
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 |
#[test]
fn test_has() {
let mut supported = SupportedAlgorithms::new();
supported.set(Algorithm::RSASHA1);
assert!(supported.has(Algorithm::RSASHA1));
assert!(!supported.has(Algorithm::RSASHA1NSEC3SHA1));
let mut supported = SupportedAlgorithms::new();
supported.set(Algorithm::RSASHA256);
assert!(!supported.has(Algorithm::RSASHA1));
assert!(!supported.has(Algorithm::RSASHA1NSEC3SHA1));
assert!(supported.has(Algorithm::RSASHA256));
} | rust_cleaned_test_functions.jsonl/47073 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21778,
368,
341,
262,
1077,
5206,
7248,
284,
48980,
2101,
18980,
486,
931,
1428,
262,
7248,
980,
7,
27847,
486,
11451,
9537,
32,
16,
626,
262,
2060,
10297,
18216,
6858,
7,
27847,
486,
11451,
953... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_combine() {
let mut input = "\\G F.F2&((A&B)->C)";
let result = cmb(&mut input);
let aandb = Box::new(Term::And(
Box::new(Term::Var("A".to_string())),
Box::new(Term::Var("B".to_string())),
));
let aandb_implyc = Box::new(Term::Imply(aandb, Box::new(Term::Var("C".to_string()))));
let body = Box::new(Term::And(
Box::new(Term::Var("F2".to_string())),
aandb_implyc,
));
let binds: Vec<String> = ["G", "F"].iter().map(|&s| s.into()).collect();
let expected = Box::new(Term::Lambda(binds, body));
assert_eq!(result, Ok((expected, Consumed(()))));
} | rust_cleaned_test_functions.jsonl/15159 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 305
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
72374,
368,
341,
262,
1077,
5206,
1946,
284,
26468,
38,
434,
991,
17,
5,
1188,
32,
48239,
3997,
34,
24023,
262,
1077,
1102,
284,
60893,
2099,
6984,
1946,
317,
262,
1077,
264,
437,
65,
284,
826... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_dhcp_type_with_invalid_dhcp_type_value_returns_none() {
let mut msg = Message::new();
msg.options.push(ConfigOption {
code: OptionCode::DhcpMessageType,
value: vec![224, 223, 222],
});
let got = msg.get_dhcp_type();
assert!(got.is_none());
} | rust_cleaned_test_functions.jsonl/93682 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 169
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
814,
62169,
1819,
6615,
31433,
814,
62169,
1819,
3142,
58900,
31488,
368,
341,
286,
1077,
5206,
3750,
284,
4856,
486,
931,
543,
286,
3750,
10912,
2552,
33687,
5341,
341,
310,
2038,
25,
6959,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_rust_src_path_missing() {
use std::env;
let _guard = TEST_SEMAPHORE.lock().unwrap();
let path = env::var_os("PATH").unwrap();
let original = env::var_os("RUST_SRC_PATH");
env::remove_var("RUST_SRC_PATH");
env::remove_var("PATH");
let result = get_rust_src_path();
env::set_var("PATH", path);
match original {
Some(path) => env::set_var("RUST_SRC_PATH", path),
None => env::remove_var("RUST_SRC_PATH"),
}
assert_eq!(Err(RustSrcPathError::Missing), result);
} | rust_cleaned_test_functions.jsonl/126174 | {
"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,
3062,
1710,
590,
16274,
2638,
40447,
368,
341,
262,
990,
1460,
486,
3160,
401,
262,
1077,
716,
26098,
284,
13602,
3620,
17617,
39,
5881,
21003,
1005,
15454,
1428,
262,
1077,
1815,
284,
6105,
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... | 2 |
#[test]
fn test_compare_int_2() {
let test_cases = vec![
(Some(5), false, Some(3), false, Ordering::Greater),
(
Some(std::u64::MAX as i64),
false,
Some(5),
false,
Ordering::Less,
),
(
Some(std::u64::MAX as i64),
true,
Some((std::u64::MAX - 1) as i64),
true,
Ordering::Greater,
),
(
Some(std::u64::MAX as i64),
true,
Some(5),
true,
Ordering::Greater,
),
(Some(5), true, Some(std::i64::MIN), false, Ordering::Greater),
(
Some(std::u64::MAX as i64),
true,
Some(std::i64::MIN),
false,
Ordering::Greater,
),
(Some(5), true, Some(3), false, Ordering::Greater),
(Some(std::i64::MIN), false, Some(3), true, Ordering::Less),
(
Some(5),
false,
Some(std::u64::MAX as i64),
true,
Ordering::Less,
),
(Some(5), false, Some(3), true, Ordering::Greater),
];
for (lhs, lhs_is_unsigned, rhs, rhs_is_unsigned, ordering) in test_cases {
let lhs_field_type = FieldTypeBuilder::new()
.tp(FieldTypeTp::LongLong)
.flag(if lhs_is_unsigned {
FieldTypeFlag::UNSIGNED
} else {
FieldTypeFlag::empty()
})
.build();
let rhs_field_type = FieldTypeBuilder::new()
.tp(FieldTypeTp::LongLong)
.flag(if rhs_is_unsigned {
FieldTypeFlag::UNSIGNED
} else {
FieldTypeFlag::empty()
})
.build();
for (sig, accept_orderings) in &[
(ScalarFuncSig::EqInt, vec![Ordering::Equal]),
(
ScalarFuncSig::NeInt,
vec![Ordering::Greater, Ordering::Less],
),
(ScalarFuncSig::GtInt, vec![Ordering::Greater]),
(
ScalarFuncSig::GeInt,
vec![Ordering::Greater, Ordering::Equal],
),
(ScalarFuncSig::LtInt, vec![Ordering::Less]),
(ScalarFuncSig::LeInt, vec![Ordering::Less, Ordering::Equal]),
] {
let output = RpnFnScalarEvaluator::new()
.push_param_with_field_type(lhs, lhs_field_type.clone())
.push_param_with_field_type(rhs, rhs_field_type.clone())
.evaluate(*sig)
.unwrap();
if accept_orderings.iter().any(|&x| x == ordering) {
assert_eq!(output, Some(1));
} else {
assert_eq!(output, Some(0));
}
}
}
} | rust_cleaned_test_functions.jsonl/75985 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2017
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
32235,
4042,
62,
17,
368,
341,
286,
1077,
1273,
41427,
284,
7486,
90515,
310,
320,
8373,
7,
20,
701,
895,
11,
4329,
7,
18,
701,
895,
11,
68621,
486,
41366,
1326,
310,
2399,
394,
4329,
5194,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_char() {
let zero = '\0';
let pound = '#';
let quote = '"';
let apost = '\'';
let newline = '\n';
let heart = '\u{2764}';
let tokens = quote! {
#zero #pound #quote #apost #newline #heart
};
let expected = "'\\u{0}' '#' '\"' '\\'' '\\n' '\u{2764}'";
assert_eq!(expected, tokens.to_string());
} | rust_cleaned_test_functions.jsonl/53399 | {
"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,
9232,
368,
341,
262,
1077,
7168,
284,
5196,
15,
1010,
262,
1077,
30023,
284,
5875,
1010,
262,
1077,
12641,
284,
94335,
262,
1077,
38471,
284,
58355,
1010,
262,
1077,
39027,
284,
5196,
77,
1010,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_no_bytes_dropped_64() {
let val = 0xdeadbeef_deadbeef_u64;
assert!(hash(&val) != hash(&zero_byte(val, 0)));
assert!(hash(&val) != hash(&zero_byte(val, 1)));
assert!(hash(&val) != hash(&zero_byte(val, 2)));
assert!(hash(&val) != hash(&zero_byte(val, 3)));
assert!(hash(&val) != hash(&zero_byte(val, 4)));
assert!(hash(&val) != hash(&zero_byte(val, 5)));
assert!(hash(&val) != hash(&zero_byte(val, 6)));
assert!(hash(&val) != hash(&zero_byte(val, 7)));
fn zero_byte(val: u64, byte: uint) -> u64 {
assert!(byte < 8);
val & !(0xff << (byte * 8))
}
} | rust_cleaned_test_functions.jsonl/7558 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 349
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8950,
6536,
12524,
814,
41716,
62,
21,
19,
368,
341,
286,
1077,
1044,
284,
220,
15,
87,
33754,
1371,
823,
53427,
1371,
823,
7300,
21,
19,
401,
286,
2060,
10297,
8296,
2099,
831,
8,
961,
5175,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_type_in_namespace() {
// Test that we can import APIs that use nested types in a namespace.
// We can't make this part of the previous test as autocxx drops the
// type.
let hdr = indoc! {"
namespace N {
struct A {
A() {}
struct B {
B() {}
};
};
};
void take_A_B(N::A::B);
"};
let rs = quote! {};
run_test("", hdr, rs, &["take_A_B"], &[]);
} | rust_cleaned_test_functions.jsonl/9851 | {
"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,
66279,
1819,
1243,
41571,
368,
341,
262,
442,
3393,
429,
582,
646,
1159,
33356,
429,
990,
24034,
4494,
304,
264,
4473,
624,
262,
442,
1205,
646,
944,
1281,
419,
949,
315,
279,
3681,
1273,
438,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_map() {
assert!(matches!(
parse_map(
&fake_section(
"maps/foo",
bytes_of(&bpf_map_def {
map_type: 1,
key_size: 2,
value_size: 3,
max_entries: 4,
map_flags: 5,
id: 0,
pinning: 0
})
),
"foo"
),
Ok(Map {
section_index: 0,
name,
def: bpf_map_def {
map_type: 1,
key_size: 2,
value_size: 3,
max_entries: 4,
map_flags: 5,
id: 0,
pinning: 0
},
data
}) if name == "foo" && data.is_empty()
))
} | rust_cleaned_test_functions.jsonl/132923 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 739
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
5376,
368,
341,
286,
2060,
10297,
19914,
33673,
310,
4715,
5376,
1006,
394,
609,
30570,
16221,
1006,
503,
330,
17640,
60555,
756,
503,
5820,
3575,
2099,
65,
15897,
5376,
7844,
341,
664,
241... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bool_array_or_nulls() {
let a = BooleanArray::from(vec![None, Some(false), None, Some(false)]);
let b = BooleanArray::from(vec![None, None, Some(false), Some(false)]);
let c = or(&a, &b).unwrap();
assert_eq!(true, c.is_null(0));
assert_eq!(true, c.is_null(1));
assert_eq!(true, c.is_null(2));
assert_eq!(false, c.is_null(3));
} | rust_cleaned_test_functions.jsonl/118977 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 206
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22159,
3858,
8734,
15162,
82,
368,
341,
286,
1077,
264,
284,
6992,
1857,
486,
1499,
25592,
20703,
4064,
11,
4329,
3576,
701,
2240,
11,
4329,
3576,
41958,
286,
1077,
293,
284,
6992,
1857,
486,
14... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compile_shift_right_wrap_a() {
let compiled = bitwise::compile_shift_right_wrap("A".to_string());
assert_eq!(compiled.len(), 1);
assert_eq!(compiled[0], 0b00010111);
} | rust_cleaned_test_functions.jsonl/100620 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 89
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74170,
22230,
10539,
38550,
4306,
368,
341,
262,
1077,
19697,
284,
97970,
486,
20433,
22230,
10539,
38550,
445,
32,
3263,
983,
3904,
5231,
262,
2060,
10714,
10297,
50845,
19406,
1507,
220,
16,
317,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_hunk_header_style_box_file_line_number() {
_do_test_hunk_header_style_box_file_line_number(&[
"--hunk-header-style",
"file line-number",
"--hunk-header-decoration-style",
"white box",
]);
} | rust_cleaned_test_functions.jsonl/70098 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1523,
3122,
8757,
15117,
10194,
2458,
6528,
5500,
368,
341,
286,
716,
2982,
4452,
1523,
3122,
8757,
15117,
10194,
2458,
6528,
5500,
2099,
9640,
310,
14482,
71,
3122,
9351,
11297,
756,
310,
330,
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 |
#[test]
fn test_set_layout() {
let helper = StorageHelper::new();
let namespace = "set_layout";
let temppath = libra_temppath::TempPath::new();
helper
.set_layout(temppath.path().to_str().unwrap(), namespace)
.unwrap_err();
temppath.create_as_file().unwrap();
let mut file = File::create(temppath.path()).unwrap();
let layout_text = "\
operators = [\"alice\", \"bob\"]\n\
owners = [\"carol\"]\n\
libra_root = [\"dave\"]\n\
";
file.write_all(&layout_text.to_string().into_bytes())
.unwrap();
file.sync_all().unwrap();
helper
.set_layout(temppath.path().to_str().unwrap(), namespace)
.unwrap();
let storage = helper.storage(namespace.into());
let stored_layout = storage
.get(constants::LAYOUT)
.unwrap()
.value
.string()
.unwrap();
assert_eq!(layout_text, stored_layout);
} | rust_cleaned_test_functions.jsonl/8044 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 541
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
14466,
368,
341,
286,
1077,
13137,
284,
14693,
5511,
486,
931,
543,
286,
1077,
4473,
284,
330,
746,
14466,
3302,
286,
1077,
1562,
602,
587,
284,
3051,
956,
28613,
602,
587,
486,
12151,
182... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_ftw_command_class() {
let project = Project::new();
let cmd = FtwCommand::New {
project_name: project.get_name(),
template: FtwTemplate::default(),
};
let _ = cmd.process();
let _ = env::set_current_dir(Path::new(&project.get_name()));
let cmd = FtwCommand::Class {
class_name: "MyPlayer".to_string(),
node_type: FtwNodeType::Area2D,
};
let _ = cmd.process();
let _ = env::set_current_dir(Path::new("../"));
assert!(project.exists("rust/src/my_player.rs"));
assert!(project.exists("godot/native/MyPlayer.gdns"));
assert!(project.exists("godot/scenes/MyPlayer.tscn"));
assert!(project.exists("rust/src/lib.rs"));
assert!(project
.read("rust/src/my_player.rs")
.contains("pub struct MyPlayer"));
assert!(project
.read("rust/src/my_player.rs")
.contains("#[inherit(Area2D)]"));
assert!(project
.read("godot/native/MyPlayer.gdns")
.contains("resource_name = \"MyPlayer\""));
assert!(project
.read("godot/native/MyPlayer.gdns")
.contains("class_name = \"MyPlayer\""));
assert!(project
.read("godot/scenes/MyPlayer.tscn")
.contains("[ext_resource path=\"res://native/MyPlayer.gdns\" type=\"Script\" id=1]"));
assert!(project
.read("godot/scenes/MyPlayer.tscn")
.contains("[node name=\"MyPlayer\" type=\"Area2D\"]"));
assert!(project.read("rust/src/lib.rs").contains("mod my_player;"));
assert!(project
.read("rust/src/lib.rs")
.contains("handle.add_class::<my_player::MyPlayer>();"));
} | rust_cleaned_test_functions.jsonl/27381 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 884
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
41572,
86,
10811,
4790,
368,
341,
286,
1077,
2390,
284,
5787,
486,
931,
543,
286,
1077,
5439,
284,
434,
15560,
4062,
486,
3564,
341,
310,
2390,
1269,
25,
2390,
670,
1269,
3148,
310,
3811,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unit() {
let tokens = vec![token(Literal, "1"), token(Identifier, "a")];
let mut context = Context::new();
context
.symbol_table
.get_mut()
.insert(unit_decl("a", "b", var(super::DECL_UNIT)));
assert_eq!(
parse_with_context(&mut context, tokens).unwrap(),
Stmt::Expr(unit("a", literal(1f64)))
);
} | rust_cleaned_test_functions.jsonl/120435 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14832,
368,
341,
286,
1077,
11211,
284,
7486,
20703,
5839,
4957,
9953,
11,
330,
16,
3975,
3950,
7,
8714,
11,
330,
64,
899,
4821,
286,
1077,
5206,
2266,
284,
9608,
486,
931,
543,
286,
2266,
198... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_store_clean_after_shrink() {
solana_logger::setup();
let accounts = AccountsDb::new_with_config_for_tests(
vec![],
&ClusterType::Development,
AccountSecondaryIndexes::default(),
true,
AccountShrinkThreshold::default(),
);
let account = AccountSharedData::new(1, 16 * 4096, &Pubkey::default());
let pubkey1 = solana_sdk::pubkey::new_rand();
accounts.store_cached(0, &[(&pubkey1, &account)]);
let pubkey2 = solana_sdk::pubkey::new_rand();
accounts.store_cached(0, &[(&pubkey2, &account)]);
let zero_account = AccountSharedData::new(0, 1, &Pubkey::default());
accounts.store_cached(1, &[(&pubkey1, &zero_account)]);
// Add root 0 and flush separately
accounts.get_accounts_delta_hash(0);
accounts.add_root(0);
accounts.flush_accounts_cache(true, None);
// clear out the dirty keys
accounts.clean_accounts(None, false, None);
// flush 1
accounts.get_accounts_delta_hash(1);
accounts.add_root(1);
accounts.flush_accounts_cache(true, None);
accounts.print_accounts_stats("pre-clean");
// shrink to shrink pubkey1 from 0
// then another clean to remove pubkey1 from slot 1
accounts.clean_accounts(None, false, None);
accounts.shrink_candidate_slots();
accounts.clean_accounts(None, false, None);
accounts.print_accounts_stats("post-clean");
assert_eq!(accounts.accounts_index.ref_count_from_storage(&pubkey1), 0);
} | rust_cleaned_test_functions.jsonl/7019 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 729
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14809,
19573,
19844,
3712,
34365,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
9618,
284,
40655,
7994,
486,
931,
6615,
5332,
5478,
32509,
1006,
310,
7486,
20703,
1259,
310,
609,
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_args() {
let ctx = TestContext::new();
let mut con = ctx.connection();
redis::cmd("SET").arg("key1").arg(b"foo").execute(&mut con);
redis::cmd("SET").arg(&["key2", "bar"]).execute(&mut con);
assert_eq!(
redis::cmd("MGET").arg(&["key1", "key2"]).query(&mut con),
Ok(("foo".to_string(), b"bar".to_vec()))
);
} | rust_cleaned_test_functions.jsonl/108941 | {
"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,
8384,
368,
341,
262,
1077,
5635,
284,
3393,
1972,
486,
931,
543,
262,
1077,
5206,
390,
284,
5635,
20310,
1428,
262,
20870,
486,
8710,
445,
5884,
1827,
858,
445,
792,
16,
1827,
858,
1883,
1,
79... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bad_files() {
for entry in fs::read_dir("test_definitions/bad").unwrap() {
let path = entry.unwrap().path();
let result = RequestDefinition::new(&path);
assert!(
result.is_err(),
"expected file {:?} to error, but it was OK. Got result {:?}",
path.to_string_lossy(),
result
);
}
} | rust_cleaned_test_functions.jsonl/47086 | {
"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,
34199,
10931,
368,
341,
262,
369,
4343,
304,
8619,
486,
878,
4334,
445,
1944,
84881,
3470,
329,
1827,
15454,
368,
341,
286,
1077,
1815,
284,
4343,
55395,
1005,
2343,
1428,
286,
1077,
1102,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_cast_date64_to_date32() {
let a = Date64Array::from(vec![Some(864000000005), Some(1545696000001), None]);
let array = Arc::new(a) as ArrayRef;
let b = cast(&array, &DataType::Date32(DateUnit::Day)).unwrap();
let c = b.as_any().downcast_ref::<Date32Array>().unwrap();
assert_eq!(10000, c.value(0));
assert_eq!(17890, c.value(1));
assert!(c.is_null(2));
} | rust_cleaned_test_functions.jsonl/29613 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 210
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5303,
4164,
21,
19,
2346,
4164,
18,
17,
368,
341,
286,
1077,
264,
284,
2631,
21,
19,
1857,
486,
1499,
25592,
20703,
8373,
7,
23,
21,
19,
15,
15,
15,
15,
15,
15,
15,
15,
20,
701,
4329,
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_directory_and_file() {
let s = TestScenario::new(util_name!());
s.fixtures.mkdir("test_directory2");
for fixture in &["empty.txt", "alpha.txt", "nonewline.txt"] {
s.ucmd()
.args(&["test_directory2", fixture])
.fails()
.stderr_is("cat: test_directory2: Is a directory")
.stdout_is_fixture(fixture);
}
} | rust_cleaned_test_functions.jsonl/90928 | {
"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,
14846,
8378,
2458,
368,
341,
262,
1077,
274,
284,
3393,
54031,
486,
931,
67811,
1269,
0,
1423,
262,
274,
67785,
18513,
30163,
445,
1944,
14846,
17,
797,
262,
369,
12507,
304,
609,
1183,
3194,
39... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_unbound_variable_limit() {
let schemaReplicant = prepopulated_schemaReplicant();
// later input.
let causetq = r#"[:find ?x :in ?limit-is-9-great :where [?x :foo/bar "yyy"] :limit ?limit-is-9-great]"#;
let SQLCausetQ { allegrosql, args } = translate_with_inputs(&schemaReplicant, causetq, CausetQInputs::default());
assert_eq!(allegrosql, "SELECT DISTINCT `Causets00`.e AS `?x` \
FROM `causets` AS `Causets00` \
WHERE `Causets00`.a = 99 AND `Causets00`.v = $v0 \
LIMIT $ilimit_is_9_great");
assert_eq!(args, vec![make_arg("$v0", "yyy")]);
} | rust_cleaned_test_functions.jsonl/90692 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 326
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
10891,
14635,
14763,
368,
341,
262,
1077,
10802,
18327,
35237,
284,
855,
8374,
7757,
25371,
18327,
35237,
1428,
1066,
262,
442,
2937,
1946,
624,
262,
1077,
2162,
18187,
80,
284,
435,
55543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pass_update_by_state_state_is_5() {
ExtBuilder::build().execute_with(|| {
System::set_block_number(1);
let alice_pair = account_pair("Alice");
let bob_pair = account_pair("Bob");
let (players, players_pair) = get_sorted_peer(alice_pair.clone(), bob_pair.clone());
let initiate_request = SessionInitiateRequest {
nonce: 1,
player_num: 2,
players: players.clone(),
timeout: 2
};
assert_ok!(
MultiSessionApp::session_initiate(
Origin::signed(players[0]),
initiate_request.clone()
)
);
let session_id = MultiSessionApp::get_session_id(initiate_request.nonce, initiate_request.players.clone());
let state_proof = get_state_proof(1, 5, 2, session_id, players_pair);
assert_ok!(
MultiSessionApp::update_by_state(
Origin::signed(players[0]),
state_proof
)
);
let session_info = MultiSessionApp::session_info(session_id).unwrap();
let expected_session_info = SessionInfo {
state: 5,
players: players.clone(),
player_num: 2,
seq_num: 1,
timeout: 2,
deadline: 3,
status: SessionStatus::Settle,
};
assert_eq!(session_info, expected_session_info);
assert_eq!(
MultiSessionApp::is_finalized(session_id.encode()).unwrap(),
false
);
let args_query_outcome = MultiSessionArgsQueryOutcome {
session_id: session_id,
query_data: 5
};
assert_eq!(
MultiSessionApp::get_outcome(args_query_outcome.encode()).unwrap(),
true.encode()
);
})
} | rust_cleaned_test_functions.jsonl/30735 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 941
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15464,
8882,
3710,
4387,
4387,
6892,
62,
20,
368,
341,
262,
9447,
3297,
486,
5834,
1005,
10257,
6615,
79453,
341,
286,
739,
486,
746,
7113,
5500,
7,
16,
317,
286,
1077,
70433,
14445,
284,
2692,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_parse_operating_n_bits() {
let root =
Packet::from_str(&"00111000000000000110111101000101001010010001001000000000").unwrap();
println!("{:?}", root);
} | rust_cleaned_test_functions.jsonl/75408 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
25634,
1095,
1089,
20034,
368,
341,
286,
1077,
3704,
4035,
310,
28889,
486,
1499,
2895,
2099,
1,
15,
15,
16,
16,
16,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
15,
16,
16,
15,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.