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_long_exact() {
let mut data = Vec::new();
data.push(0xff);
data.push(0xff);
data.push(0xff);
data.push(0);
data.extend(&[0; U24_MAX][..]);
data.push(0x00);
data.push(0x00);
data.push(0x00);
data.push(1);
let (rest, p) = packet(&data[..]).unwrap();
assert!(rest.is_empty());
assert_eq!(p.0, 1);
assert_eq!(p.1.len(), U24_MAX);
assert_eq!(&*p.1, &[0; U24_MAX][..]);
} | rust_cleaned_test_functions.jsonl/60447 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 298
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17799,
71084,
368,
341,
286,
1077,
5206,
821,
284,
11312,
486,
931,
543,
286,
821,
2552,
7,
15,
9020,
317,
286,
821,
2552,
7,
15,
9020,
317,
286,
821,
2552,
7,
15,
9020,
317,
286,
821,
2552,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vaporization_order_answer() {
let map = string_to_asteroid_map(get_asteroid_map());
let (station, _) = calculate_monitoring_station_position(&map);
let vaporization_order = plan_vaporization(&map, &station);
assert_eq!(vaporization_order.len(), map.len() - 1);
let vap_200 = vaporization_order[199];
let ans = vap_200.x * 100 + vap_200.y;
assert_eq!(1623, ans);
} | rust_cleaned_test_functions.jsonl/69389 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 197
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
20715,
2022,
7869,
28534,
368,
341,
286,
1077,
2415,
284,
914,
2346,
62,
2300,
588,
5376,
5433,
62,
2300,
588,
5376,
1423,
286,
1077,
320,
20155,
11,
27439,
284,
11047,
40112,
287,
44798,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_null_data_variant() -> Result<(), Error> {
let kp = SampiKeyPair::new();
assert!(kp.new_sampi().build(vec![SampiData::Null]).is_ok());
Ok(())
} | rust_cleaned_test_functions.jsonl/67857 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 85
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15162,
1769,
46112,
368,
1464,
5714,
68843,
4600,
29,
341,
262,
1077,
60319,
284,
90174,
72,
1592,
12443,
486,
931,
543,
262,
2060,
10297,
48495,
4618,
643,
1121,
72,
1005,
5834,
25592,
20703,
50,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_2020() {
assert_eq!(solve(&vec![0, 3, 6], 2020), 436);
assert_eq!(solve(&vec![1, 3, 2], 2020), 1);
assert_eq!(solve(&vec![2, 1, 3], 2020), 10);
} | rust_cleaned_test_functions.jsonl/65761 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
17,
15,
17,
15,
368,
341,
286,
2060,
10714,
10297,
59419,
2099,
4083,
20703,
15,
11,
220,
18,
11,
220,
21,
1125,
220,
17,
15,
17,
15,
701,
220,
19,
18,
21,
317,
286,
2060,
10714,
10297... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eval_rec_fun() {
let source_code = "let rec fact x = if x > 0 then x * fact (x - 1) else 1 in fact 5;;";
let result = interpret(source_code, false, false);
assert_eq!(result, vec![ExprVal::I64(120)],);
} | rust_cleaned_test_functions.jsonl/41119 | {
"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,
21296,
7080,
28315,
368,
341,
286,
1077,
2530,
4136,
284,
330,
1149,
1395,
2097,
856,
284,
421,
856,
861,
220,
15,
1221,
856,
353,
2097,
320,
87,
481,
220,
16,
8,
770,
220,
16,
304,
2097,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_supply() {
let bob_pubkey = solana_sdk::pubkey::new_rand();
let RpcHandler { io, meta, .. } = start_rpc_handler_with_tx(&bob_pubkey);
let req = r#"{"jsonrpc":"2.0","id":1,"method":"getSupply"}"#;
let res = io.handle_request_sync(req, meta);
let json: Value = serde_json::from_str(&res.unwrap()).unwrap();
let supply: RpcSupply = serde_json::from_value(json["result"]["value"].clone())
.expect("actual response deserialization");
assert_eq!(supply.non_circulating, 20);
assert!(supply.circulating >= TEST_MINT_LAMPORTS);
assert!(supply.total >= TEST_MINT_LAMPORTS + 20);
let expected_accounts: Vec<String> = non_circulating_accounts()
.iter()
.map(|pubkey| pubkey.to_string())
.collect();
assert_eq!(
supply.non_circulating_accounts.len(),
expected_accounts.len()
);
for address in supply.non_circulating_accounts {
assert!(expected_accounts.contains(&address));
}
} | rust_cleaned_test_functions.jsonl/3024 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 516
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
65630,
368,
341,
286,
1077,
35192,
34014,
792,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
79961,
3050,
314,
6399,
11,
8823,
11,
5241,
335,
284,
1191,
60799,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_double_ext() {
assert_eq!(extension(Path::new("foo-bar.html.txt")), Some("txt"));
assert_eq!(extension(Path::new("foo-bar.txt.html")), Some("html"));
assert_eq!(extension(Path::new("foo-bar.txt.unknown")), Some("unknown"));
assert_eq!(extension(Path::new("foo/bar/baz.html.txt")), Some("txt"));
assert_eq!(extension(Path::new("foo/bar/baz.txt.html")), Some("html"));
assert_eq!(
extension(Path::new("foo/bar/baz.txt.unknown")),
Some("unknown")
);
} | rust_cleaned_test_functions.jsonl/5546 | {
"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,
24598,
9927,
368,
341,
286,
2060,
10714,
10297,
12427,
33030,
486,
931,
445,
7975,
15773,
2564,
3909,
35674,
4329,
445,
8586,
4010,
286,
2060,
10714,
10297,
12427,
33030,
486,
931,
445,
7975,
15773,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_vht_segments_to_cbw() {
assert_eq!(fidl_common::Cbw::Cbw80, convert_vht_segments_to_cbw(255, 0));
assert_eq!(fidl_common::Cbw::Cbw160, convert_vht_segments_to_cbw(255, 247));
assert_eq!(fidl_common::Cbw::Cbw80P80, convert_vht_segments_to_cbw(255, 200));
assert_eq!(fidl_common::Cbw::Cbw80, convert_vht_segments_to_cbw(255, 250));
} | rust_cleaned_test_functions.jsonl/12085 | {
"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,
34910,
2273,
426,
55735,
2346,
16450,
86,
368,
341,
286,
2060,
10714,
10297,
32439,
75,
21107,
486,
34,
39824,
486,
34,
39824,
23,
15,
11,
5508,
2273,
426,
55735,
2346,
16450,
86,
7,
17,
20,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compile_shift_left_f() {
let compiled = bitwise::compile_shift_left("F".to_string());
assert_eq!(compiled.len(), 1);
assert_eq!(compiled[0], 0b10111101);
} | rust_cleaned_test_functions.jsonl/100604 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 85
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74170,
22230,
9579,
761,
368,
341,
262,
1077,
19697,
284,
97970,
486,
20433,
22230,
9579,
445,
37,
3263,
983,
3904,
5231,
262,
2060,
10714,
10297,
50845,
19406,
1507,
220,
16,
317,
262,
2060,
1071... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_redirect_307_does_not_try_if_reader_cannot_reset() {
let client = reqwest::Client::new();
let codes = [307, 308];
for &code in codes.iter() {
let redirect = server! {
request: format!("\
POST /{} HTTP/1.1\r\n\
user-agent: $USERAGENT\r\n\
accept: */*\r\n\
accept-encoding: gzip\r\n\
host: $HOST\r\n\
transfer-encoding: chunked\r\n\
\r\n\
5\r\n\
Hello\r\n\
0\r\n\r\n\
", code),
response: format!("\
HTTP/1.1 {} reason\r\n\
Server: test-redirect\r\n\
Content-Length: 0\r\n\
Location: /dst\r\n\
Connection: close\r\n\
\r\n\
", code)
};
let url = format!("http://{}/{}", redirect.addr(), code);
let res = client
.post(&url)
.body(reqwest::Body::new(&b"Hello"[..]))
.send()
.unwrap();
assert_eq!(res.url().as_str(), url);
assert_eq!(res.status(), reqwest::StatusCode::from_u16(code).unwrap());
}
} | rust_cleaned_test_functions.jsonl/105512 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 760
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30043,
62,
18,
15,
22,
96374,
7913,
53283,
11119,
22306,
666,
3401,
18983,
368,
341,
262,
1077,
2943,
284,
4232,
11039,
486,
2959,
486,
931,
543,
262,
1077,
13912,
284,
508,
18,
15,
22,
11,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_invalid_length_enum() {
assert_de_tokens_error::<InvalidLengthEnum>(
&[
Token::TupleVariant { name: "InvalidLengthEnum", variant: "A", len: 3 },
Token::I32(1),
Token::TupleVariantEnd,
],
"invalid length 1, expected tuple of 3 elements",
);
assert_de_tokens_error::<InvalidLengthEnum>(
&[
Token::TupleVariant { name: "InvalidLengthEnum", variant: "B", len: 3 },
Token::I32(1),
Token::TupleVariantEnd,
],
"invalid length 1, expected tuple of 2 elements",
);
} | rust_cleaned_test_functions.jsonl/58624 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 302
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
5118,
31054,
368,
341,
262,
2060,
2259,
28838,
4096,
27638,
7928,
4373,
10766,
17055,
286,
609,
9640,
310,
9660,
486,
28681,
20746,
314,
829,
25,
330,
7928,
4373,
10766,
497,
11424,
25,
330... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_delete_range_ingest_file() {
let path = tempdir_with_prefix("_rust_rocksdb_test_delete_range_ingest_file");
let path_str = path.path().to_str().unwrap();
let mut opts = DBOptions::new();
opts.create_if_missing(true);
let mut db = DB::open(opts, path_str).unwrap();
let gen_path = tempdir_with_prefix("_rust_rocksdb_ingest_sst_gen");
let test_sstfile = gen_path.path().join("test_sst_file");
let test_sstfile_str = test_sstfile.to_str().unwrap();
let ingest_opt = IngestExternalFileOptions::new();
let default_options = db.get_options();
gen_sst(default_options, db.cf_handle("default"), test_sstfile_str);
db.ingest_external_file(&ingest_opt, &[test_sstfile_str])
.unwrap();
assert!(test_sstfile.exists());
check_kv(
&db,
db.cf_handle("default"),
&[
(b"key1", Some(b"value1")),
(b"key2", Some(b"value2")),
(b"key3", Some(b"value3")),
(b"key4", Some(b"value4")),
],
);
db.delete_range(b"key1", b"key4").unwrap();
check_kv(
&db,
db.cf_handle("default"),
&[
(b"key1", None),
(b"key2", None),
(b"key3", None),
(b"key4", Some(b"value4")),
],
);
db.create_cf("cf1").unwrap();
let handle = db.cf_handle("cf1").unwrap();
gen_sst(ColumnFamilyOptions::new(), None, test_sstfile_str);
db.ingest_external_file_cf(handle, &ingest_opt, &[test_sstfile_str])
.unwrap();
assert!(test_sstfile.exists());
check_kv(
&db,
Some(handle),
&[
(b"key1", Some(b"value1")),
(b"key2", Some(b"value2")),
(b"key3", Some(b"value3")),
(b"key4", Some(b"value4")),
],
);
let snap = db.snapshot();
db.delete_range_cf(handle, b"key1", b"key3").unwrap();
check_kv(
&db,
Some(handle),
&[
(b"key1", None),
(b"key2", None),
(b"key3", Some(b"value3")),
(b"key4", Some(b"value4")),
],
);
assert_eq!(snap.get_cf(handle, b"key1").unwrap().unwrap(), b"value1");
assert_eq!(snap.get_cf(handle, b"key4").unwrap().unwrap(), b"value4");
} | rust_cleaned_test_functions.jsonl/57056 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1197
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11353,
9698,
59112,
477,
2458,
368,
341,
262,
1077,
1815,
284,
2730,
3741,
6615,
13974,
16975,
35788,
26608,
14553,
1999,
4452,
11353,
9698,
59112,
477,
2458,
797,
262,
1077,
1815,
2895,
284,
1815,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_keys_bip39_mnemonic_passphrase() {
let mnemonic =
"aim bunker wash balance finish force paper analyst cabin spoon stable organ";
let mnemonic = Mnemonic::from_phrase(mnemonic, Language::English).unwrap();
let path = bip32::DerivationPath::from_str("m/44'/0'/0'/0").unwrap();
let key = ((mnemonic, Some("passphrase".into())), path);
let (desc, keys, networks) = crate::descriptor!(wpkh(key)).unwrap();
assert_eq!(desc.to_string(), "wpkh([8f6cb80c/44'/0'/0']xpub6DWYS8bbihFevy29M4cbw4ZR3P5E12jB8R88gBDWCTCNpYiDHhYWNywrCF9VZQYagzPmsZpxXpytzSoxynyeFr4ZyzheVjnpLKuse4fiwZw/0/*)#h0j0tg5m");
assert_eq!(keys.len(), 1);
assert_eq!(networks.len(), 4);
} | rust_cleaned_test_functions.jsonl/57387 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 359
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12631,
880,
573,
18,
24,
717,
70775,
15464,
27710,
368,
341,
286,
1077,
86801,
4035,
310,
330,
2640,
83672,
11369,
8172,
6248,
5344,
5567,
18237,
13386,
45505,
15175,
2872,
876,
286,
1077,
86801,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serialise() {
let receipt = Request;
let elem: Element = receipt.into();
assert!(elem.is("request", ns::RECEIPTS));
assert_eq!(elem.attrs().count(), 0);
let receipt = Received {
id: String::from("coucou"),
};
let elem: Element = receipt.into();
assert!(elem.is("received", ns::RECEIPTS));
assert_eq!(elem.attr("id"), Some("coucou"));
} | rust_cleaned_test_functions.jsonl/69305 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 218
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25602,
1064,
368,
341,
286,
1077,
22567,
284,
6145,
280,
286,
1077,
11750,
25,
8543,
284,
22567,
39860,
543,
286,
2060,
10297,
18871,
2079,
445,
2035,
497,
12268,
486,
787,
2104,
40,
73693,
1106,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reading_to_the_end() {
let fs = FileSystem::default();
let mut file = fs
.new_open_options()
.read(true)
.write(true)
.create_new(true)
.open(path!("/foo.txt"))
.expect("failed to create a new file");
assert!(
matches!(file.write(b"foobarbazqux"), Ok(12)),
"writing `foobarbazqux`",
);
assert!(
matches!(file.seek(io::SeekFrom::Start(0)), Ok(0)),
"seeking to 0",
);
let mut buffer = Vec::new();
assert!(
matches!(file.read_to_end(&mut buffer), Ok(12)),
"reading all bytes",
);
assert_eq!(buffer, b"foobarbazqux"[..], "checking all the bytes");
} | rust_cleaned_test_functions.jsonl/52784 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 435
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
81859,
2346,
16068,
6213,
368,
341,
286,
1077,
8619,
284,
53461,
486,
2258,
1428,
286,
1077,
5206,
1034,
284,
8619,
198,
310,
659,
931,
11311,
8743,
741,
310,
659,
878,
3715,
340,
310,
659,
4934... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_circle_directed() {
type Cost = i32;
let neigh: Vec<Vec<(usize, Cost)>> = vec![
vec![(1, 1)],
vec![(2, 1)],
vec![(3, 1)],
vec![(4, 1)],
vec![(0, 1)],
];
let expected = vec![Real(0), Real(1), Real(2), Real(3), Real(4)];
assert_eq!(dijkstra(0, &neigh), expected);
} | rust_cleaned_test_functions.jsonl/98953 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 239
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42222,
32871,
291,
368,
341,
286,
943,
11194,
284,
600,
18,
17,
280,
286,
1077,
96166,
25,
11312,
50439,
28706,
51878,
11,
11194,
54229,
284,
7486,
90515,
310,
7486,
0,
9697,
16,
11,
220,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mint_cycles_fail_on_system_canister() {
with_test_replica_logger(|log| {
let tmpdir = tempfile::Builder::new().prefix("test").tempdir().unwrap();
let metrics_registry = MetricsRegistry::new();
let cycles_account_manager = Arc::new(
CyclesAccountManagerBuilder::new()
.with_subnet_type(SubnetType::System)
.with_subnet_id(subnet_test_id(1))
.build(),
);
let hypervisor = Hypervisor::new(
config(),
1,
&metrics_registry,
cycles_account_manager.get_subnet_id(),
SubnetType::System,
log,
cycles_account_manager,
);
let (canister, _, _, _) = execute_update(
&hypervisor,
MINT_CYCLES,
"test",
EMPTY_PAYLOAD,
tmpdir.path().into(),
);
assert_eq!(canister.system_state.queues().output_queues_len(), 0);
//Not on NNS subnet -> balance remains unchanged
assert_balance_equals(
INITIAL_CYCLES,
canister.system_state.cycles_balance,
BALANCE_EPSILON,
);
});
} | rust_cleaned_test_functions.jsonl/123317 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 642
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
396,
68970,
22121,
4470,
17687,
27421,
1571,
368,
341,
262,
448,
4452,
25533,
15317,
27413,
22428,
839,
91,
341,
286,
1077,
4174,
3741,
284,
54819,
486,
3297,
486,
931,
1005,
11849,
445,
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_storage_clear_meta() {
let td = TempDir::new("tikv-store").unwrap();
let worker = Worker::new("snap-manager");
let sched = worker.scheduler();
let mut store = new_storage_from_ents(sched, &td, &[new_entry(3, 3), new_entry(4, 4)]);
append_ents(&mut store, &[new_entry(5, 5), new_entry(6, 6)]);
assert_eq!(6, get_meta_key_count(&store));
let kv_wb = WriteBatch::new();
let raft_wb = WriteBatch::new();
store.clear_meta(&kv_wb, &raft_wb).unwrap();
store.engines.kv.write(kv_wb).unwrap();
store.engines.raft.write(raft_wb).unwrap();
assert_eq!(0, get_meta_key_count(&store));
} | rust_cleaned_test_functions.jsonl/121484 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 332
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23310,
21811,
13381,
368,
341,
286,
1077,
17941,
284,
19944,
6184,
486,
931,
445,
83,
1579,
85,
33252,
1827,
15454,
543,
286,
1077,
11864,
284,
33086,
486,
931,
445,
48854,
44896,
797,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rom_pad_already_power_of_2() {
let mut rom = vec![0; 2 * 1024 * 1024];
pad_rom(&mut rom);
assert_eq!(vec![0; 2 * 1024 * 1024], rom);
} | rust_cleaned_test_functions.jsonl/99945 | {
"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,
81383,
30290,
80772,
20421,
3575,
62,
17,
368,
341,
286,
1077,
5206,
9882,
284,
7486,
20703,
15,
26,
220,
17,
353,
220,
16,
15,
17,
19,
353,
220,
16,
15,
17,
19,
4821,
286,
11016,
81383,
209... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_empty_match_indices() {
let data = "aä中!";
let vec: Vec<_> = data.match_indices("").collect();
assert_eq!(vec, [(0, ""), (1, ""), (3, ""), (6, ""), (7, "")]);
} | rust_cleaned_test_functions.jsonl/17653 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
10708,
18333,
368,
341,
262,
1077,
821,
284,
330,
64,
2305,
15946,
26782,
262,
1077,
7486,
25,
11312,
32399,
29,
284,
821,
11072,
18333,
80821,
17384,
543,
262,
2060,
10714,
10297,
4083,
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_parse_timestamp() {
assert!("December 1989".parse::<Timestamp>().is_err());
assert_eq!(
"1989".parse::<Timestamp>().unwrap(),
Timestamp {
year: 1989,
month: None,
day: None,
hour: None,
minute: None,
second: None
}
);
assert_eq!(
"1989-01".parse::<Timestamp>().unwrap(),
Timestamp {
year: 1989,
month: Some(1),
day: None,
hour: None,
minute: None,
second: None
}
);
assert_eq!(
"1989-12".parse::<Timestamp>().unwrap(),
Timestamp {
year: 1989,
month: Some(12),
day: None,
hour: None,
minute: None,
second: None
}
);
assert_eq!(
"1989-01-02".parse::<Timestamp>().unwrap(),
Timestamp {
year: 1989,
month: Some(1),
day: Some(2),
hour: None,
minute: None,
second: None
}
);
assert_eq!(
"1989-12-27".parse::<Timestamp>().unwrap(),
Timestamp {
year: 1989,
month: Some(12),
day: Some(27),
hour: None,
minute: None,
second: None
}
);
assert_eq!(
"1989-12-27T09".parse::<Timestamp>().unwrap(),
Timestamp {
year: 1989,
month: Some(12),
day: Some(27),
hour: Some(9),
minute: None,
second: None
}
);
assert_eq!(
"1989-12-27T09:15".parse::<Timestamp>().unwrap(),
Timestamp {
year: 1989,
month: Some(12),
day: Some(27),
hour: Some(9),
minute: Some(15),
second: None
}
);
assert_eq!(
"1989-12-27T09:15:30".parse::<Timestamp>().unwrap(),
Timestamp {
year: 1989,
month: Some(12),
day: Some(27),
hour: Some(9),
minute: Some(15),
second: Some(30)
}
);
} | rust_cleaned_test_functions.jsonl/42785 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1316
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
23073,
368,
341,
262,
2060,
17223,
32146,
220,
16,
24,
23,
24,
3263,
6400,
27638,
20812,
10483,
285,
9266,
1423,
262,
2060,
10714,
33673,
286,
330,
16,
24,
23,
24,
3263,
6400,
27638,
2081... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_raw_parts() {
let buf = Buffer::from_raw_parts(null_mut(), 0);
assert_eq!(0, buf.len());
assert_eq!(0, buf.data().len());
assert!(buf.raw_data().is_null());
let buf = Buffer::from(&[0, 1, 2, 3, 4]);
assert_eq!(5, buf.len());
assert!(!buf.raw_data().is_null());
assert_eq!(&[0, 1, 2, 3, 4], buf.data());
} | rust_cleaned_test_functions.jsonl/20561 | {
"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,
5673,
16067,
33217,
368,
341,
286,
1077,
6607,
284,
10312,
486,
1499,
16067,
33217,
4967,
29523,
1507,
220,
15,
317,
286,
2060,
10714,
10297,
15,
11,
6607,
19406,
1423,
286,
2060,
10714,
10297,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unexpected_use() {
// https://github.com/google/autocxx/issues/303
let hdr = indoc! {"
typedef int a;
namespace b {
namespace c {
enum d : a;
}
} // namespace b
namespace {
using d = b::c::d;
}
namespace content {
class RenderFrameHost {
public:
RenderFrameHost() {}
d e;
};
} // namespace content
"};
let rs = quote! {
let _ = ffi::content::RenderFrameHost::make_unique();
};
run_test("", hdr, rs, &["content::RenderFrameHost"], &[]);
} | rust_cleaned_test_functions.jsonl/9881 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 316
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
7325,
15951,
368,
341,
262,
442,
3703,
1110,
5204,
905,
40689,
14,
2717,
509,
4146,
38745,
14,
18,
15,
18,
198,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
286,
13501,
526,
264,
280,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_replace_add_to_nested_nested() {
check_assist(
replace_qualified_name_with_use,
"
use std::fmt::{Debug, nested::{Display}};
impl std::fmt::nested::Debug<|> for Foo {
}
",
"
use std::fmt::{Debug, nested::{Display, Debug}};
impl Debug<|> for Foo {
}
",
);
} | rust_cleaned_test_functions.jsonl/19572 | {
"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,
10633,
2891,
2346,
66279,
66279,
368,
341,
286,
1779,
12083,
380,
1006,
310,
8290,
62,
36335,
1269,
6615,
15951,
345,
310,
6228,
810,
1460,
486,
12501,
22964,
7939,
11,
24034,
22964,
7020,
92,
231... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pubkey_derivation() {
let priv_key = PrivateKey { sk: Scalar::from_bytes(&[52, 163, 121, 115, 149, 19, 242, 110, 13, 231, 110, 40, 146, 248, 62, 119, 87, 214, 200, 159, 51, 41, 164, 239, 155, 241, 173, 219, 230, 185, 133, 3]).unwrap() };
let pub_key = PublicKey { pk: G2Projective::from(G2Affine::from_uncompressed(&[1, 65, 146, 224, 231, 36, 217, 8, 154, 9, 197, 85, 87, 10, 60, 10, 116, 199, 107, 77, 65, 110, 195, 241, 61, 149, 135, 254, 254, 231, 193, 180, 204, 158, 62, 152, 255, 162, 62, 57, 242, 63, 232, 173, 205, 118, 153, 74, 0, 33, 97, 106, 240, 49, 100, 155, 187, 111, 209, 35, 149, 158, 19, 5, 53, 161, 255, 29, 150, 27, 180, 76, 35, 128, 168, 52, 28, 185, 165, 29, 3, 171, 74, 204, 98, 167, 76, 26, 163, 61, 205, 9, 165, 185, 175, 92, 0, 255, 19, 80, 75, 234, 65, 82, 108, 145, 163, 112, 232, 187, 181, 136, 5, 148, 204, 65, 187, 54, 121, 249, 199, 164, 107, 239, 193, 46, 94, 130, 16, 4, 237, 46, 67, 32, 180, 185, 63, 12, 189, 114, 59, 70, 32, 214, 1, 103, 254, 116, 159, 104, 88, 88, 209, 241, 131, 173, 192, 119, 152, 28, 214, 52, 212, 168, 14, 233, 120, 89, 97, 233, 93, 236, 94, 172, 27, 173, 64, 49, 117, 213, 228, 168, 212, 232, 114, 121, 204, 16, 246, 121, 184, 81]).unwrap()) };
let pub_key_result = priv_key.to_public();
assert_eq!(G2Affine::from(pub_key.pk), G2Affine::from(pub_key_result.pk));
} | rust_cleaned_test_functions.jsonl/131747 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 593
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34014,
792,
35345,
39127,
368,
341,
262,
1077,
6095,
3097,
284,
9679,
1592,
314,
1901,
25,
35176,
486,
1499,
12524,
2099,
58,
20,
17,
11,
220,
16,
21,
18,
11,
220,
16,
17,
16,
11,
220,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vcpu_run_failed() {
let (_, mut vcpu) = setup_vcpu();
// Setting an invalid seccomp level should panic.
vcpu.run(
Arc::new(Barrier::new(1)),
seccomp::SECCOMP_LEVEL_ADVANCED + 10,
EventFd::new(libc::EFD_NONBLOCK).unwrap(),
);
} | rust_cleaned_test_functions.jsonl/1919 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 174
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
16475,
14007,
35060,
368,
341,
286,
1077,
39464,
5206,
348,
16475,
8,
284,
6505,
2273,
16475,
543,
286,
442,
20037,
458,
8318,
511,
638,
14435,
2188,
1265,
21975,
624,
286,
348,
16475,
7634,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_VSMT_8_Verif() {
let width = 9;
let mut db = InMemoryHashDb::<DBVal_8_ary>::new();
#[cfg(feature = "bls381")]
let (full_b, full_e, partial_rounds) = (4, 4, 56);
#[cfg(feature = "bn254")]
let (full_b, full_e, partial_rounds) = (4, 4, 56);
#[cfg(feature = "secp256k1")]
let (full_b, full_e, partial_rounds) = (4, 4, 56);
#[cfg(feature = "ed25519")]
let (full_b, full_e, partial_rounds) = (4, 4, 56);
let total_rounds = full_b + partial_rounds + full_e;
let hash_params = PoseidonParams::new(width, full_b, full_e, partial_rounds);
let tree_depth = 8;
let mut tree = VanillaSparseMerkleTree_8::new(&hash_params, tree_depth, &mut db);
for i in 1..=10 {
let s = FieldElement::from(i as u32);
tree.update(&s, s.clone(), &mut db).unwrap();
}
let mut merkle_proof_vec = Vec::<ProofNode_8_ary>::new();
let mut merkle_proof = Some(merkle_proof_vec);
let k = FieldElement::from(9u32);
assert_eq!(k, tree.get(&k, &mut merkle_proof, &db).unwrap());
merkle_proof_vec = merkle_proof.unwrap();
assert!(tree.verify_proof(&k, &k, &merkle_proof_vec, Some(&tree.root)));
let mut rng = rand::thread_rng();
let sbox_type = &SboxType::Quint;
let G: G1Vector = get_generators("G", 4096).into();
let H: G1Vector = get_generators("H", 4096).into();
let g = G1::from_msg_hash("g".as_bytes());
let h = G1::from_msg_hash("h".as_bytes());
let label = b"8-aryMerkleTree";
let (proof, commitments) = gen_proof_of_leaf_inclusion_8_ary_merkle_tree(
k.clone(),
k.clone(),
None,
merkle_proof_vec,
&tree.root,
tree.depth,
&hash_params,
sbox_type,
Some(&mut rng),
label,
&g,
&h,
&G,
&H,
)
.unwrap();
verify_proof_of_leaf_inclusion_8_ary_merkle_tree(
&tree.root,
tree.depth,
&hash_params,
sbox_type,
proof,
commitments,
label,
&g,
&h,
&G,
&H,
)
.unwrap();
} | rust_cleaned_test_functions.jsonl/76426 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1320
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2334,
50,
8505,
62,
23,
2334,
261,
333,
368,
341,
286,
1077,
2374,
284,
220,
24,
401,
286,
1077,
5206,
2927,
284,
758,
10642,
6370,
7994,
27638,
3506,
2208,
62,
23,
82219,
6831,
931,
1428,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_score_0() {
assert_eq!(
calculate_score(
"Polkadot",
"5GUWv4bLCchGUHJrzULXnh4JgXsMpTKRnjuXTY7Qo1Kh9uYK"
),
0
);
} | rust_cleaned_test_functions.jsonl/47853 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10405,
62,
15,
368,
341,
197,
6948,
10714,
33673,
298,
1444,
45441,
10405,
1006,
571,
197,
1,
14658,
93275,
354,
756,
571,
197,
1,
20,
54695,
54,
85,
19,
65,
8556,
331,
54695,
39,
41,
51960,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dedup_by() {
let mut vec = vec!["foo", "bar", "Bar", "baz", "bar"];
vec.dedup_by(|a, b| a.eq_ignore_ascii_case(b));
assert_eq!(vec, ["foo", "bar", "baz", "bar"]);
let mut vec = vec![("foo", 1), ("foo", 2), ("bar", 3), ("bar", 4), ("bar", 5)];
vec.dedup_by(|a, b| {
a.0 == b.0 && {
b.1 += a.1;
true
}
});
assert_eq!(vec, [("foo", 3), ("bar", 12)]);
} | rust_cleaned_test_functions.jsonl/24402 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 245
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
291,
454,
3710,
368,
341,
262,
1077,
5206,
7486,
284,
7486,
0,
1183,
7975,
497,
330,
2257,
497,
330,
3428,
497,
330,
42573,
497,
330,
2257,
6332,
262,
7486,
950,
291,
454,
3710,
22428,
64... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_merges_global_and_workspace_local_options() {
let settings = json!({
"gopls": {
"local": "github.com/import/path/to/package"
}
});
let command = ServerCommand::Detailed(ServerDetails {
name: "gopls".into(),
command: vec!["gopls".into()],
initialization_options: Some(json!({
"usePlaceholders": true,
})),
handlers: None,
});
let options = merged_initialization_options(&command, &settings);
assert!(options.is_some());
assert_eq!(
json!({
"usePlaceholders": true,
"local": "github.com/import/path/to/package",
}),
options.unwrap()
);
} | rust_cleaned_test_functions.jsonl/121120 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 430
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
2375,
288,
19296,
8378,
75560,
13564,
8743,
368,
341,
286,
1077,
5003,
284,
2951,
0,
2262,
310,
330,
70,
453,
4730,
788,
341,
394,
330,
2438,
788,
330,
5204,
905,
87284,
50976,
32429,
64000... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_binary_literal_from_u64() {
let cs: Vec<(u64, isize, Vec<u8>)> = vec![
(0x0, -1, vec![0x0]),
(0x0, 1, vec![0x0]),
(0x0, 2, vec![0x0, 0x0]),
(0x1, -1, vec![0x1]),
(0x1, 1, vec![0x1]),
(0x1, 2, vec![0x0, 0x1]),
(0x1, 3, vec![0x0, 0x0, 0x1]),
(0x10, -1, vec![0x10]),
(0x123, -1, vec![0x1, 0x23]),
(0x123, 2, vec![0x1, 0x23]),
(0x123, 1, vec![0x23]),
(0x123, 5, vec![0x0, 0x0, 0x0, 0x1, 0x23]),
(0x4D7953514C, -1, vec![0x4D, 0x79, 0x53, 0x51, 0x4C]),
(
0x4D7953514C,
8,
vec![0x0, 0x0, 0x0, 0x4D, 0x79, 0x53, 0x51, 0x4C],
),
(
0x4920616D2061206C,
-1,
vec![0x49, 0x20, 0x61, 0x6D, 0x20, 0x61, 0x20, 0x6C],
),
(
0x4920616D2061206C,
8,
vec![0x49, 0x20, 0x61, 0x6D, 0x20, 0x61, 0x20, 0x6C],
),
(0x4920616D2061206C, 5, vec![0x6D, 0x20, 0x61, 0x20, 0x6C]),
];
for (n, byte_size, expected) in cs {
let lit = BinaryLiteral::from_u64(n, byte_size).unwrap();
assert_eq!(lit.0, expected);
}
let lit = BinaryLiteral::from_u64(100, -2);
assert!(lit.is_err());
} | rust_cleaned_test_functions.jsonl/12345 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1027
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31761,
34100,
5673,
7300,
21,
19,
368,
341,
286,
1077,
10532,
25,
11312,
28706,
84,
21,
19,
11,
91373,
11,
11312,
34837,
23,
9231,
29,
284,
7486,
90515,
310,
320,
15,
87,
15,
11,
481,
16,
11... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_fchmod() {
let tempdir = tempfile::tempdir().unwrap();
let filename = tempdir.path().join("foo.txt");
let file = File::create(&filename).unwrap();
let mut mode1 = Mode::empty();
mode1.insert(Mode::S_IRUSR);
mode1.insert(Mode::S_IWUSR);
fchmod(file.as_raw_fd(), mode1).unwrap();
let file_stat1 = stat(&filename).unwrap();
assert_eq!(file_stat1.st_mode as mode_t & 0o7777, mode1.bits());
let mut mode2 = Mode::empty();
mode2.insert(Mode::S_IROTH);
fchmod(file.as_raw_fd(), mode2).unwrap();
let file_stat2 = stat(&filename).unwrap();
assert_eq!(file_stat2.st_mode as mode_t & 0o7777, mode2.bits());
} | rust_cleaned_test_functions.jsonl/48641 | {
"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,
761,
56274,
368,
341,
262,
1077,
2730,
3741,
284,
54819,
486,
3888,
3741,
1005,
15454,
543,
262,
1077,
3899,
284,
2730,
3741,
3875,
1005,
5987,
445,
7975,
3909,
797,
262,
1077,
1034,
284,
2887,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fq_sqrt() {
use fff::SqrtField;
let mut rng = XorShiftRng::from_seed([
0x59, 0x62, 0xbe, 0x5d, 0x76, 0x3d, 0x31, 0x8d, 0x17, 0xdb, 0x37, 0x32, 0x54, 0x06,
0xbc, 0xe5,
]);
assert_eq!(Fq::zero().sqrt().unwrap(), Fq::zero());
for _ in 0..1000 {
let a = Fq::random(&mut rng);
let mut nega = a;
nega.negate();
let mut b = a;
b.square();
let b = b.sqrt().unwrap();
assert!(a == b || nega == b);
}
for _ in 0..1000 {
let a = Fq::random(&mut rng);
if let Some(mut tmp) = a.sqrt() {
tmp.square();
assert_eq!(a, tmp);
}
}
} | rust_cleaned_test_functions.jsonl/2332 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 520
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
80,
92199,
368,
341,
286,
990,
282,
542,
486,
50,
8140,
1877,
401,
286,
1077,
5206,
28422,
284,
1599,
269,
24841,
49,
968,
486,
1499,
33809,
8956,
310,
220,
15,
87,
20,
24,
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... | 5 |
#[test]
fn test_nested_quasiquote() {
let ctx = ctx();
assert_ok!(ctx, "(let ((x 1)) (qquote (qquote (unq (unq x)))))", "1");
assert_ok!(
ctx,
"(let ((x (quote foo))) (qquote (qquote (unq (unq x)))))",
"foo"
);
assert_ok!(
ctx,
"(defmacro abbrev (long short)
(qquote
(defmacro (unq short) (& body)
(qquote ((unq (quote (unq long))) (unqs body))))))
(abbrev defun defn)
(defn inc (x) (+ x 1))
(inc 5)",
"6"
);
} | rust_cleaned_test_functions.jsonl/88937 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 316
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66279,
11280,
10215,
2949,
368,
341,
262,
1077,
5635,
284,
5635,
1428,
262,
2060,
19817,
10297,
3773,
11,
11993,
1149,
1781,
87,
220,
16,
593,
320,
80,
2949,
320,
80,
2949,
320,
359,
80,
320,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_decimal_number_1() {
let d = DecimalNumber::new("1.23");
assert_eq!("1", d.integral);
assert_eq!("23", d.fractional);
} | rust_cleaned_test_functions.jsonl/79000 | {
"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,
74429,
5500,
62,
16,
368,
341,
286,
1077,
294,
284,
26728,
2833,
486,
931,
445,
16,
13,
17,
18,
797,
286,
2060,
10714,
17223,
16,
497,
294,
6403,
26821,
317,
286,
2060,
10714,
17223,
17,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_parse() {
let m = super::models::default_japanese_model();
assert_eq!(super::parse(m, ""), vec![""]);
assert_eq!(super::parse(m, "日本語"), vec!["日本語"]);
assert_eq!(super::parse(m, "水と油"), vec!["水と", "油"]);
assert_eq!(
super::parse(m, "水道水とミネラルウォーター"),
vec!["水道水と", "ミネラルウォーター"]
);
assert_eq!(
super::parse(m, "PythonとJavaScriptとGolang"),
vec!["Pythonと", "JavaScriptと", "Golang"]
);
assert_eq!(
super::parse(
m,
"日本語の文章において語の区切りに空白を挟んで記述すること"
),
vec![
"日本語の",
"文章に",
"おいて",
"語の",
"区切りに",
"空白を",
"挟んで",
"記述する",
"こと"
]
);
assert_eq!(
super::parse(m, "これはテストです。"),
vec!["これは", "テストです。"]
);
assert_eq!(
super::parse(m, "これは美しいペンです。"),
vec!["これは", "美しい", "ペンです。"]
);
assert_eq!(
super::parse(m, "今日は天気です。"),
vec!["今日は", "天気です。"]
);
assert_eq!(
super::parse(m, "今日はとても天気です。"),
vec!["今日は", "とても", "天気です。"]
);
assert_eq!(
super::parse(m, "あなたに寄り添う最先端のテクノロジー。"),
vec!["あなたに", "寄り添う", "最先端の", "テクノロジー。"]
);
assert_eq!(
super::parse(m, "これはテストです。今日は晴天です。"),
vec!["これは", "テストです。", "今日は", "晴天です。"]
);
assert_eq!(
super::parse(m, "これはテストです。\n今日は晴天です。"),
vec!["これは", "テストです。", "\n今日は", "晴天です。"]
);
} | rust_cleaned_test_functions.jsonl/55622 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1349
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
368,
341,
286,
1077,
296,
284,
2256,
486,
6507,
486,
2258,
5374,
28689,
5047,
1428,
286,
2060,
10714,
10297,
9522,
486,
6400,
1255,
11,
77130,
7486,
0,
1183,
15049,
286,
2060,
10714,
10297,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_merge_clouds() {
let src = to_yaml(
r#"
clouds:
cloud_name:
auth:
username: user2
password: password1
region_name: region2"#,
);
let mut dest = to_yaml(
r#"
clouds:
cloud_name:
auth:
username: user1
project_name: project1
user_domain_name: domain1
project_domain_name: domain1
auth_url: "url1"
region_name: region1"#,
);
merge_mappings(src, &mut dest, true);
let dest_cloud = dest
.get(&"clouds".into())
.unwrap()
.as_mapping()
.unwrap()
.get(&"cloud_name".into())
.unwrap()
.to_owned();
assert_eq!(
&serde_yaml::Value::String("region2".into()),
dest_cloud.get("region_name").unwrap()
);
let dest_auth = dest_cloud
.get("auth")
.unwrap()
.as_mapping()
.unwrap()
.to_owned();
assert_eq!(
"user2",
dest_auth.get(&"username".into()).unwrap().as_str().unwrap()
);
assert_eq!(
"password1",
dest_auth.get(&"password".into()).unwrap().as_str().unwrap()
);
assert_eq!(
"project1",
dest_auth
.get(&"project_name".into())
.unwrap()
.as_str()
.unwrap()
);
assert_eq!(
"domain1",
dest_auth
.get(&"project_domain_name".into())
.unwrap()
.as_str()
.unwrap()
);
assert_eq!(
"domain1",
dest_auth
.get(&"user_domain_name".into())
.unwrap()
.as_str()
.unwrap()
);
assert_eq!(
"url1",
dest_auth.get(&"auth_url".into()).unwrap().as_str().unwrap()
);
} | rust_cleaned_test_functions.jsonl/27014 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1228
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20888,
37356,
82,
368,
341,
286,
1077,
2286,
284,
311,
64380,
1006,
310,
435,
2,
698,
12361,
82,
510,
220,
9437,
1269,
510,
262,
4166,
510,
414,
5934,
25,
1196,
17,
198,
414,
3552,
25,
3552,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bus_device_reset() {
let m = GuestMemory::new(&[(GuestAddress(0), 0x1000)]).unwrap();
let mut d = MmioDevice::new(m, Box::new(DummyDevice::new())).unwrap();
let mut buf = vec![0; 4];
assert!(!d.are_queues_valid());
assert!(!d.device_activated);
assert_eq!(d.driver_status, 0);
activate_device(&mut d);
// Marking device as FAILED should not affect device_activated state
LittleEndian::write_u32(&mut buf[..], 0x8f);
d.write(0x70, &buf[..]);
assert_eq!(d.driver_status, 0x8f);
assert!(d.device_activated);
// Nothing happens when backend driver doesn't support reset
DEVICE_RESET_ENABLED.store(0, Ordering::SeqCst);
LittleEndian::write_u32(&mut buf[..], 0x0);
d.write(0x70, &buf[..]);
assert_eq!(d.driver_status, 0x8f);
assert!(d.device_activated);
DEVICE_RESET_ENABLED.store(1, Ordering::SeqCst);
LittleEndian::write_u32(&mut buf[..], 0x0);
d.write(0x70, &buf[..]);
assert_eq!(d.driver_status, 0x0);
assert!(!d.device_activated);
DEVICE_RESET_ENABLED.store(0, Ordering::SeqCst);
activate_device(&mut d);
} | rust_cleaned_test_functions.jsonl/85624 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 597
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25418,
9204,
18983,
368,
341,
286,
1077,
296,
284,
26215,
10642,
486,
931,
2099,
9697,
37804,
4286,
7,
15,
701,
220,
15,
87,
16,
15,
15,
15,
7252,
568,
15454,
543,
286,
1077,
5206,
294,
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_remove_leaf_table() {
given(r#"
[servers]
# Indentation (tabs and/or spaces) is allowed but not required
[servers.alpha]
ip = "10.0.0.1"
dc = "eqdc10"
[servers.beta]
ip = "10.0.0.2"
dc = "eqdc10""#
).running(|root| {
let servers = root.entry("servers");
let servers = as_table!(servers);
assert!(servers.remove("alpha").is_some());
}).produces(r#"
[servers]
[servers.beta]
ip = "10.0.0.2"
dc = "eqdc10"
"#
);
} | rust_cleaned_test_functions.jsonl/36878 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 309
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
38909,
5237,
368,
341,
262,
2661,
2601,
2,
698,
286,
508,
67696,
2533,
286,
671,
2263,
306,
367,
320,
30993,
323,
5144,
12621,
8,
374,
5420,
714,
537,
2567,
198,
11880,
18729,
23928,
921,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_emit_movq_imm_reg() {
assert_emit!(0x48, 0xc7, 0xc0, 1, 0, 0, 0; emit_movq_imm_reg(1, RAX));
assert_emit!(0x49, 0xc7, 0xc7, 0xFF, 0xFF, 0xFF, 0xFF; emit_movq_imm_reg(-1, R15));
} | rust_cleaned_test_functions.jsonl/85419 | {
"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,
69082,
55798,
80,
71370,
4920,
368,
341,
286,
2060,
69082,
10297,
15,
87,
19,
23,
11,
220,
15,
8148,
22,
11,
220,
15,
8148,
15,
11,
220,
16,
11,
220,
15,
11,
220,
15,
11,
220,
15,
26,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_var() {
// x
let tokens = vec![token(Identifier, "x"), token(EOF, "")];
assert_eq!(parse(tokens).unwrap(), Stmt::Expr(var("x")));
} | rust_cleaned_test_functions.jsonl/120430 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4612,
368,
341,
286,
442,
856,
198,
286,
1077,
11211,
284,
7486,
20703,
5839,
7,
8714,
11,
330,
87,
3975,
3950,
7,
23483,
11,
11700,
4821,
286,
2060,
10714,
10297,
6400,
34052,
568,
15454,
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 |
#[test]
fn test_url_simple() {
let id = Identity::mock_default();
let input = UpdateInput {
allow_downgrade: false,
enabled: true,
strategy: "fleet_lock".to_string(),
fleet_lock: FleetLockInput {
base_url: "https://example.com".to_string(),
},
};
let res = StrategyFleetLock::new(input, &id);
assert!(res.is_ok());
} | rust_cleaned_test_functions.jsonl/14604 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 227
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2903,
30015,
368,
341,
286,
1077,
877,
284,
26540,
486,
16712,
9993,
543,
286,
1077,
1946,
284,
5549,
2505,
341,
310,
2138,
13998,
6937,
25,
895,
345,
310,
8970,
25,
830,
345,
310,
8282,
25,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_docbitset_sequential() {
test_go_through_sequential(&[1, 2, 3]);
test_go_through_sequential(&[1, 2, 3, 4, 5, 63, 64, 65]);
test_go_through_sequential(&[63, 64, 65]);
test_go_through_sequential(&[1, 2, 3, 4, 95, 96, 97, 98, 99]);
} | rust_cleaned_test_functions.jsonl/13267 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 145
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18869,
77615,
3453,
15838,
368,
341,
286,
1273,
25515,
87399,
3453,
15838,
2099,
58,
16,
11,
220,
17,
11,
220,
18,
2558,
286,
1273,
25515,
87399,
3453,
15838,
2099,
58,
16,
11,
220,
17,
11,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_push_wrap() {
let mut txbuf = TxBuf::new();
let mut sink = TestSink::new();
let mut tmp: Vec<u8> = Vec::new();
tmp.resize(TxBuf::SIZE - 2, 0);
txbuf.push(tmp.as_slice()).unwrap();
txbuf.flush_to(&mut sink).unwrap();
sink.clear();
txbuf.push(&[1, 2, 3, 4]).unwrap();
assert_eq!(txbuf.flush_to(&mut sink).unwrap(), 4);
assert_eq!(sink.data, [1, 2, 3, 4]);
} | rust_cleaned_test_functions.jsonl/24610 | {
"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,
14218,
38550,
368,
341,
286,
1077,
5206,
9854,
5909,
284,
350,
14377,
1704,
486,
931,
543,
286,
1077,
5206,
19309,
284,
3393,
45094,
486,
931,
543,
286,
1077,
5206,
4174,
25,
11312,
34837,
23,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_range_step_inclusive() {
assert!(super::range_step_inclusive(0, 20, 5).eq([0, 5, 10, 15, 20].iter().cloned()));
assert!(super::range_step_inclusive(20, 0, -5).eq([20, 15, 10, 5, 0].iter().cloned()));
assert!(super::range_step_inclusive(20, 0, -6).eq([20, 14, 8, 2].iter().cloned()));
assert!(super::range_step_inclusive(200u8, 255, 50).eq([200u8, 250].iter().cloned()));
assert!(super::range_step_inclusive(200, -5, 1).eq(iter::empty()));
assert!(super::range_step_inclusive(200, 200, 1).eq(iter::once(200)));
} | rust_cleaned_test_functions.jsonl/37398 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 270
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9698,
11946,
1243,
8336,
368,
341,
286,
2060,
10297,
9522,
486,
9669,
11946,
1243,
8336,
7,
15,
11,
220,
17,
15,
11,
220,
20,
568,
11006,
2561,
15,
11,
220,
20,
11,
220,
16,
15,
11,
220,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_exec_unknown_extended() {
let header = make_test_header(EndianSlice::new(&[], LittleEndian));
let initial_registers = LineRow::new(&header);
let opcode = LineInstruction::UnknownExtended(
constants::DwLne(74),
EndianSlice::new(&[], LittleEndian),
);
let expected_registers = initial_registers;
assert_exec_opcode(header, initial_registers, opcode, expected_registers, false);
} | rust_cleaned_test_functions.jsonl/3388 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 204
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18430,
57507,
61678,
368,
341,
286,
1077,
4247,
284,
1281,
4452,
8757,
7,
43231,
33236,
486,
931,
2099,
12995,
14671,
43231,
1106,
286,
1077,
2856,
78360,
284,
7083,
3102,
486,
931,
2099,
2708,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_import_mode_switcher() {
let temp_dir = TempDir::new("test_import_mode_switcher").unwrap();
let db = new_engine(temp_dir.path().to_str().unwrap(), None, &["a", "b"], None).unwrap();
let import_db_options = ImportModeDBOptions::new();
let normal_db_options = ImportModeDBOptions::new_options(&db);
let import_cf_options = ImportModeCFOptions::new();
let normal_cf_options = ImportModeCFOptions::new_options(&db, "default");
let mut switcher = ImportModeSwitcher::new();
check_import_options(&db, &normal_db_options, &normal_cf_options);
switcher.enter_import_mode(&db).unwrap();
check_import_options(&db, &import_db_options, &import_cf_options);
switcher.enter_import_mode(&db).unwrap();
check_import_options(&db, &import_db_options, &import_cf_options);
switcher.enter_normal_mode(&db).unwrap();
check_import_options(&db, &normal_db_options, &normal_cf_options);
switcher.enter_normal_mode(&db).unwrap();
check_import_options(&db, &normal_db_options, &normal_cf_options);
} | rust_cleaned_test_functions.jsonl/77493 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 460
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18434,
7302,
27652,
261,
368,
341,
286,
1077,
2730,
4334,
284,
19944,
6184,
486,
931,
445,
1944,
18434,
7302,
27652,
261,
1827,
15454,
543,
286,
1077,
2927,
284,
501,
24823,
9758,
4334,
3875,
1005... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_palindromes() {
let palindromes = ["eevee", "lalalal", "オオオオ", "", "anna"];
let non_palindromes = ["nope", "lalala", "car", "rain", "house", "computer", "rust"];
assert!(palindromes.iter().all(|&s| palindrome(s)));
assert!(non_palindromes.iter().all(|&s| !palindrome(s)));
} | rust_cleaned_test_functions.jsonl/34965 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73310,
484,
441,
288,
368,
341,
262,
1077,
10854,
484,
441,
288,
284,
4383,
2127,
586,
68,
497,
330,
75,
278,
278,
278,
497,
330,
89862,
89862,
89862,
89862,
497,
7342,
330,
12642,
6332,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mint_many() {
let mut contract = TestContract::new();
let ali_pk = PublicKey::ed25519_from_bytes([3u8; 32]).unwrap();
let bob_pk = PublicKey::ed25519_from_bytes([6u8; 32]).unwrap();
let ali: Key = ali_pk.to_account_hash().into();
let ali_first_token_id = "banana_01".to_string();
let ali_second_token_id = "orange_01".to_string();
let ali_token_ids = vec![ali_first_token_id.clone(), ali_second_token_id.clone()];
let bob: Key = bob_pk.to_account_hash().into();
let bob_first_token_id = "banana_02".to_string();
let bob_second_token_id = "apple_02".to_string();
let bob_token_ids = vec![bob_first_token_id.clone(), bob_second_token_id.clone()];
assert_eq!(contract.total_supply(), U256::from(0));
contract
.mint_many(
&ali,
Some(ali_token_ids),
vec![meta::banana(), meta::orange()],
)
.unwrap();
contract
.mint_many(
&bob,
Some(bob_token_ids),
vec![meta::banana(), meta::apple()],
)
.unwrap();
// Check total balance.
assert_eq!(contract.total_supply(), U256::from(4));
// Check balances
assert_eq!(contract.balance_of(&ali), U256::from(2));
assert_eq!(contract.balance_of(&bob), U256::from(2));
// Check ownership
assert_eq!(&contract.owner_of(&ali_first_token_id).unwrap(), &ali);
assert_eq!(&contract.owner_of(&ali_second_token_id).unwrap(), &ali);
assert_eq!(&contract.owner_of(&bob_first_token_id).unwrap(), &bob);
assert_eq!(&contract.owner_of(&bob_second_token_id).unwrap(), &bob);
// Check metas.
assert_eq!(
contract.token_meta(&ali_first_token_id).unwrap(),
meta::banana()
);
assert_eq!(
contract.token_meta(&ali_second_token_id).unwrap(),
meta::orange()
);
assert_eq!(
contract.token_meta(&bob_first_token_id).unwrap(),
meta::banana()
);
assert_eq!(
contract.token_meta(&bob_second_token_id).unwrap(),
meta::apple()
);
} | rust_cleaned_test_functions.jsonl/122723 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 954
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
396,
22101,
368,
341,
262,
1077,
5206,
5116,
284,
3393,
14067,
486,
931,
543,
262,
1077,
18991,
33321,
284,
70280,
486,
291,
17,
20,
20,
16,
24,
5673,
12524,
2561,
18,
84,
23,
26,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_term_info_block_meta_serialization() {
let term_info_block_meta = TermInfoBlockMeta {
offset: 2009u64,
ref_term_info: TermInfo {
doc_freq: 512,
postings_start_offset: 51,
postings_stop_offset: 57u64,
positions_idx: 3584,
},
doc_freq_nbits: 10,
postings_offset_nbits: 5,
positions_idx_nbits: 11,
};
let mut buffer: Vec<u8> = Vec::new();
term_info_block_meta.serialize(&mut buffer).unwrap();
let mut cursor: &[u8] = &buffer[..];
let term_info_block_meta_serde = TermInfoBlockMeta::deserialize(&mut cursor).unwrap();
assert_eq!(term_info_block_meta_serde, term_info_block_meta);
} | rust_cleaned_test_functions.jsonl/5213 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 413
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17464,
3109,
7113,
13381,
25602,
2022,
368,
341,
286,
1077,
4647,
3109,
7113,
13381,
284,
17519,
1731,
4713,
12175,
341,
310,
4347,
25,
220,
17,
15,
15,
24,
84,
21,
19,
345,
310,
2053,
17464,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_Y() {
let code = vec![0x84, 0x04];
let mut nes = Cpu::new();
let mut memory = new_memory(code);
nes.Y = 0xF1;
nes.next(&mut memory).unwrap();
assert_eq!(0xF1, memory.get(0x04));
} | rust_cleaned_test_functions.jsonl/38717 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 145
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14809,
10626,
368,
341,
286,
1077,
2038,
284,
7486,
20703,
15,
87,
23,
19,
11,
220,
15,
87,
15,
19,
935,
286,
1077,
5206,
308,
288,
284,
356,
5584,
486,
931,
543,
286,
1077,
5206,
4938,
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_is_empty() {
let mut list: SimpleLinkedList<u32> = SimpleLinkedList::new();
assert!(list.is_empty(), "List wasn't empty on creation");
for inserts in 0..100 {
for i in 0..inserts {
list.push(i);
assert!(
!list.is_empty(),
"List was empty after having inserted {}/{} elements",
i,
inserts
);
}
for i in 0..inserts {
assert!(
!list.is_empty(),
"List was empty before removing {}/{} elements",
i,
inserts
);
list.pop();
}
assert!(
list.is_empty(),
"List wasn't empty after having removed {} elements",
inserts
);
}
} | rust_cleaned_test_functions.jsonl/120123 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 469
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
15124,
368,
341,
262,
1077,
5206,
1140,
25,
8993,
33915,
34837,
18,
17,
29,
284,
8993,
33915,
486,
931,
543,
262,
2060,
10297,
1607,
2079,
15124,
1507,
330,
852,
5710,
944,
4287,
389,
9688... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_enum_with_generic_type() {
check(
r#"
enum Foo<T> <|>{
A(T),
B,
}
fn main() {
let f: Foo<i8>;
f = Foo::A(1);
}
"#,
expect![[r#"
Foo Enum FileId(0) 0..32 5..8 Other
FileId(0) 73..76 EnumLiteral
"#]],
);
} | rust_cleaned_test_functions.jsonl/47767 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 217
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31054,
6615,
41232,
1819,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
9018,
33428,
3125,
29,
82639,
41446,
262,
362,
4140,
1326,
262,
425,
345,
532,
8822,
1887,
368,
341,
262,
1077,
282,
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_with_var_override() {
env::set_var("BLAH", "blub");
let blah_is_set = env::var("BLAH").unwrap();
assert_eq!(blah_is_set, "blub", "`BLAH` must be set to \"blah\".");
crate::with_var("BLAH", Some("new"), || {
let blah_is_set_new = env::var("BLAH").unwrap();
assert_eq!(blah_is_set_new, "new", "`BLAH` must be set to \"newb\".");
});
let blah_is_set_after = env::var("BLAH").unwrap();
assert_eq!(
blah_is_set_after, "blub",
"`BLAH` must be set to \"blubr\"."
);
} | rust_cleaned_test_functions.jsonl/49883 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 319
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
4612,
48576,
368,
341,
286,
6105,
486,
746,
4612,
445,
9389,
29923,
497,
330,
2024,
392,
797,
286,
1077,
52561,
6892,
2602,
284,
6105,
486,
947,
445,
9389,
29923,
1827,
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... | 2 |
#[test]
fn test_exclude() {
let output = cargo_hack()
.args(&["hack", "check", "--all", "--exclude", "foo"])
.current_dir(test_dir("tests/fixtures/virtual"))
.output()
.unwrap();
output
.assert_success()
.assert_stderr_contains("excluded package(s) foo not found in workspace")
.assert_stderr_contains("running `cargo check` on member1")
.assert_stderr_contains("running `cargo check` on member2");
} | rust_cleaned_test_functions.jsonl/25299 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 212
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88668,
368,
341,
262,
1077,
2550,
284,
25652,
1523,
473,
741,
286,
659,
2116,
2099,
1183,
65972,
497,
330,
2028,
497,
14482,
541,
497,
14482,
32413,
497,
330,
7975,
14108,
286,
659,
3231,
4334,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_minimum_total() {
assert_eq!(
Solution::minimum_total(vec![vec![2], vec![3, 4], vec![6, 5, 7], vec![4, 1, 8, 3]]),
11
);
assert_eq!(Solution::minimum_total(vec![vec![-10]]), -10);
} | rust_cleaned_test_functions.jsonl/74853 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 145
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84855,
10784,
368,
341,
286,
2060,
10714,
33673,
310,
12478,
486,
37988,
10784,
25592,
20703,
4083,
20703,
17,
1125,
7486,
20703,
18,
11,
220,
19,
1125,
7486,
20703,
21,
11,
220,
20,
11,
220,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_db_apis() {
TermLogger::new(log::LevelFilter::Debug, Config::default()).unwrap();
let config_dir = Path::new("/newDevice/tests/");
let config: ConfigSettings =
helpers::load_config(config_dir, "bynar.json").expect("Failed to load config");
let db_config = config.database;
let pool = super::create_db_connection_pool(&db_config).unwrap();
let info = super::MyHost::new().unwrap();
let result = super::update_storage_info(&info, &pool).expect(
"Failed to update
storage details",
);
println!("Successfully updated storage details");
println!("host details mapping {:#?}", result);
// create fake device
let drive_uuid = Uuid::new_v4();
let dev_name = format!("some_path-{}", drive_uuid);
let path = format!("/some/{}", dev_name);
let mut d = crate::test_disk::BlockDevice {
device: Device {
id: Some(drive_uuid),
name: dev_name,
media_type: MediaType::Rotational,
capacity: 26214400,
fs_type: FilesystemType::Xfs,
serial_number: Some("123456".into()),
},
dev_path: PathBuf::from(path),
device_database_id: None,
mount_point: None,
partitions: vec![],
scsi_info: ScsiInfo::default(),
state: crate::test_disk::State::Unscanned,
storage_detail_id: result.storage_detail_id,
operation_id: None,
};
println!("Adding disk {:#?}", d);
let _disk_result = super::add_disk_detail(&pool, &mut d).unwrap();
let dev_id = match d.device_database_id {
None => 0,
Some(i) => i,
};
println!("Added disk with id {}", dev_id);
// Add operation
let mut op_info = super::OperationInfo::new(result.entry_id, dev_id);
println!("Created operation {:#?}", op_info);
let _op_result = super::add_or_update_operation(&pool, &mut op_info).unwrap();
d.operation_id = op_info.operation_id;
let o_id = match op_info.operation_id {
None => 0,
Some(i) => i,
};
println!("Added operation with ID {}", o_id);
// call add_disk_detail again for same device
println!(
"Re-adding same disk with id {} again to the database",
dev_id
);
let _disk_result2 = super::add_disk_detail(&pool, &mut d).unwrap();
// Clear device_database_id to mimic re-run and add again
d.device_database_id = None;
let _disk_result3 = super::add_disk_detail(&pool, &mut d).unwrap();
let new_dev_id = match d.device_database_id {
None => 0,
Some(i) => i,
};
println!(
"Dev-id after reinsert attempt {}, old {}",
new_dev_id, dev_id
);
// now update operation
println!("Updating first operation with snapshot time");
op_info.set_snapshot_time(super::Utc::now());
let _op_result2 = super::add_or_update_operation(&pool, &mut op_info).unwrap();
// update again with done_time
op_info.set_done_time(super::Utc::now());
println!("Updating first operation with done time");
let _op_result2 = super::add_or_update_operation(&pool, &mut op_info).unwrap();
// Add operation_details
println!("Updating first operation detail as Evaluation");
let mut op_detail = super::OperationDetail::new(o_id, super::OperationType::Evaluation);
let _detail_result = super::add_or_update_operation_detail(&pool, &mut op_detail);
// Update status
println!("Updating first operation status as in-progress");
op_detail.set_operation_status(super::OperationStatus::InProgress);
let _detail_result = super::add_or_update_operation_detail(&pool, &mut op_detail);
// Add another sub-operation
println!("Updating first operation detail as WaitingForReplacement");
let mut op_detail2 =
super::OperationDetail::new(o_id, super::OperationType::WaitingForReplacement);
op_detail2.set_operation_status(super::OperationStatus::InProgress);
//update ticket_id
println!("Updating second operation detail with tracking number");
op_detail2.set_tracking_id("ABC-1234".to_string());
let _detail_result = super::add_or_update_operation_detail(&pool, &mut op_detail2);
// update first sub-operation as complete
op_detail.set_operation_status(super::OperationStatus::Complete);
op_detail.set_done_time(super::Utc::now());
let _detail_result = super::add_or_update_operation_detail(&pool, &mut op_detail);
// get device state from db
let state = super::get_state(&pool, &d).unwrap();
println!("State for dev name {} is {:#?}", d.device.name, state);
let new_state = crate::test_disk::State::WaitingForReplacement;
let _state_result = super::save_state(&pool, &d, new_state).unwrap();
let new_state_result = super::get_state(&pool, &d).unwrap();
println!(
"State for dev name {} is {:#?}",
d.device.name, new_state_result
);
assert_eq!(new_state, new_state_result);
let tickets =
super::get_outstanding_repair_tickets(&pool, result.storage_detail_id).unwrap();
println!("All open tickets {:#?}", tickets);
let is_repair_needed =
super::is_hardware_waiting_repair(&pool, result.storage_detail_id, &d.device.name, None).unwrap();
println!(
"disk {} needs repair {}",
d.dev_path.display(),
is_repair_needed
);
let all_devices = super::get_devices_from_db(&pool, result.storage_detail_id).unwrap();
println!("All devices {:#?}", all_devices);
//TODO: add failure tests
// 1. set entry_id = 0
} | rust_cleaned_test_functions.jsonl/126606 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2681
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8685,
62,
13725,
368,
341,
286,
17519,
7395,
486,
931,
12531,
486,
4449,
5632,
486,
7939,
11,
5532,
486,
2258,
6011,
15454,
543,
286,
1077,
2193,
4334,
284,
7933,
486,
931,
4283,
931,
6985,
6246... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_gen_path_8_12_2() {
let partition_depth: u32 = 2;
let partition_size = gen_partition_size(8.0, 12, 4096.0, partition_depth as i32);
let hash = "606060606467717262616464";
let path = gen_path(hash, partition_size, partition_depth);
assert_eq!(gen_os_path(vec!["60606060", "64677172"]), path);
} | rust_cleaned_test_functions.jsonl/7874 | {
"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,
16322,
2638,
62,
23,
62,
16,
17,
62,
17,
368,
341,
286,
1077,
16658,
19061,
25,
575,
18,
17,
284,
220,
17,
280,
286,
1077,
16658,
2368,
284,
4081,
43840,
2368,
7,
23,
13,
15,
11,
220,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stat_throttling_policy() -> Result<()> {
let tmp = create_temp_dir("test_stat_throttling_policy").expect("create test directory");
let content = &[
"8:0 Read 20",
"8:0 Write 20",
"8:0 Sync 20",
"8:0 Async 20",
"8:0 Discard 20",
"8:0 Total 20",
"Total 0",
]
.join("\n");
set_fixture(&tmp, BLKIO_THROTTLE_IO_SERVICE_BYTES, content).unwrap();
set_fixture(&tmp, BLKIO_THROTTLE_IO_SERVICED, content).unwrap();
let actual = Blkio::stats(&tmp).expect("get cgroup stats");
let mut expected = BlkioStats::default();
let devices: Vec<BlkioDeviceStat> = ["Read", "Write", "Sync", "Async", "Discard", "Total"]
.iter()
.copied()
.map(|op| BlkioDeviceStat {
major: 8,
minor: 0,
op_type: Some(op.to_owned()),
value: 20,
})
.collect();
expected.service_bytes = devices.clone();
expected.serviced = devices;
assert_eq!(expected, actual);
Ok(())
} | rust_cleaned_test_functions.jsonl/130564 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 627
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16271,
5854,
46689,
2718,
22773,
368,
1464,
5714,
71698,
341,
286,
1077,
4174,
284,
1855,
11771,
4334,
445,
1944,
16271,
5854,
46689,
2718,
22773,
1827,
17119,
445,
3182,
1273,
6220,
797,
286,
1077,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mod_evaluate_polynomial() {
let poly = vec![1, 2, 3, 4, 5, 6];
let point = 5;
let field = fields::NaturalPrimeField(17);
assert_eq!(mod_evaluate_polynomial(&poly, point, &field), 4);
} | rust_cleaned_test_functions.jsonl/100905 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7480,
2204,
19642,
47323,
25358,
368,
341,
286,
1077,
9861,
284,
7486,
20703,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,
935,
286,
1077,
1459,
284,
220,
20,
280,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cstring_internal_null_end() {
assert_de_tokens_error::<CString>(
&[Token::Bytes(b"ac\0")],
"nul byte found in provided data at position: 2",
);
} | rust_cleaned_test_functions.jsonl/129527 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
917,
23472,
15162,
6213,
368,
341,
262,
2060,
2259,
28838,
4096,
27638,
63677,
17055,
286,
44590,
3323,
486,
7078,
1883,
1,
580,
59,
15,
899,
1259,
286,
330,
77,
360,
4922,
1730,
304,
3897,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_collect_from_account_created_and_existing() {
let old_lamports = 1000;
let old_epoch = 1;
let new_epoch = 3;
let (mut created_account, mut existing_account) = {
let account = AccountSharedData::from(Account {
lamports: old_lamports,
rent_epoch: old_epoch,
..Account::default()
});
(account.clone(), account)
};
let rent_collector = RentCollector::default().clone_with_epoch(new_epoch);
// collect rent on a newly-created account
let collected = rent_collector
.collect_from_created_account(&solana_sdk::pubkey::new_rand(), &mut created_account);
assert!(created_account.lamports < old_lamports);
assert_eq!(created_account.lamports + collected, old_lamports);
assert_ne!(created_account.rent_epoch(), old_epoch);
// collect rent on a already-existing account
let collected = rent_collector
.collect_from_existing_account(&solana_sdk::pubkey::new_rand(), &mut existing_account);
assert!(existing_account.lamports < old_lamports);
assert_eq!(existing_account.lamports + collected, old_lamports);
assert_ne!(existing_account.rent_epoch(), old_epoch);
// newly created account should be collected for less rent; thus more remaining balance
assert!(created_account.lamports() > existing_account.lamports);
assert_eq!(created_account.rent_epoch(), existing_account.rent_epoch());
} | rust_cleaned_test_functions.jsonl/93221 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 648
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68140,
5673,
13500,
27288,
8378,
62630,
368,
341,
286,
1077,
2310,
907,
309,
3394,
284,
220,
16,
15,
15,
15,
280,
286,
1077,
2310,
20682,
284,
220,
16,
280,
286,
1077,
501,
20682,
284,
220,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lcs_p2p_transaction_script() {
// create transfer parameters
let receiver_address = AccountAddress::random();
let amount = 100_000_000;
let metadata = vec![1, 2, 3];
let metadata_signature = [0x1; 64].to_vec();
let coin_ident = std::ffi::CString::new(COIN1_NAME).expect("Invalid ident");
let mut script_buf: *mut u8 = std::ptr::null_mut();
let script_buf_ptr = &mut script_buf;
let mut script_len: usize = 0;
let script_result = unsafe {
libra_TransactionP2PScript_from(
receiver_address.as_ref().as_ptr(),
coin_ident.as_ptr(),
amount,
metadata.as_ptr(),
metadata.len(),
metadata_signature.as_ptr(),
metadata_signature.len(),
script_buf_ptr,
&mut script_len,
)
};
assert_eq!(script_result, LibraStatus::Ok);
let script_bytes: &[u8] = unsafe { slice::from_raw_parts(script_buf, script_len) };
let deserialized_script: Script =
from_bytes(script_bytes).expect("LCS deserialization failed for Script");
if let TransactionArgument::Address(val) = deserialized_script.args()[0] {
assert_eq!(val, receiver_address);
} else {
unreachable!()
}
if let TransactionArgument::U64(val) = deserialized_script.args()[1] {
assert_eq!(val, amount);
} else {
unreachable!()
}
if let TransactionArgument::U8Vector(val) = deserialized_script.args()[2].clone() {
assert_eq!(val, metadata)
} else {
unreachable!()
}
if let TransactionArgument::U8Vector(val) = deserialized_script.args()[3].clone() {
assert_eq!(val, metadata_signature)
} else {
unreachable!()
}
unsafe {
libra_free_bytes_buffer(script_buf);
};
} | rust_cleaned_test_functions.jsonl/30041 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1009
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
907,
4837,
620,
17,
79,
28884,
14660,
368,
341,
286,
442,
1855,
8317,
5029,
198,
286,
1077,
13964,
6744,
284,
8615,
4286,
486,
11463,
543,
286,
1077,
3311,
284,
220,
16,
15,
15,
62,
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... | 5 |
#[test]
fn test_try_from_record_for_contig() {
let record = build_record();
assert_eq!(
Contig::try_from(record),
Ok(Contig {
id: String::from("sq0"),
len: Some(13),
fields: vec![(
String::from("md5"),
String::from("d7eba311421bbc9d3ada44709dd61534")
)]
.into_iter()
.collect(),
})
);
} | rust_cleaned_test_functions.jsonl/81749 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 315
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
5673,
14192,
5478,
10260,
343,
368,
341,
286,
1077,
3255,
284,
1936,
14192,
1428,
286,
2060,
10714,
33673,
310,
2093,
343,
486,
1539,
5673,
23794,
1326,
310,
7622,
7,
818,
343,
341,
394,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tx_packet_assembly() {
// Test case: successful TX packet assembly.
{
create_context!(test_ctx, handler_ctx);
let pkt = VsockPacket::from_tx_virtq_head(
&handler_ctx.handler.txvq.pop(&test_ctx.mem).unwrap(),
)
.unwrap();
assert_eq!(pkt.hdr().len(), VSOCK_PKT_HDR_SIZE);
assert_eq!(
pkt.buf().unwrap().len(),
handler_ctx.guest_txvq.dtable[1].len.get() as usize
);
}
// Test case: error on write-only hdr descriptor.
{
create_context!(test_ctx, handler_ctx);
handler_ctx.guest_txvq.dtable[0]
.flags
.set(VIRTQ_DESC_F_WRITE);
expect_asm_error!(tx, test_ctx, handler_ctx, VsockError::UnreadableDescriptor);
}
// Test case: header descriptor has insufficient space to hold the packet header.
{
create_context!(test_ctx, handler_ctx);
handler_ctx.guest_txvq.dtable[0]
.len
.set(VSOCK_PKT_HDR_SIZE as u32 - 1);
expect_asm_error!(tx, test_ctx, handler_ctx, VsockError::HdrDescTooSmall(_));
}
// Test case: zero-length TX packet.
{
create_context!(test_ctx, handler_ctx);
set_pkt_len(0, &handler_ctx.guest_txvq.dtable[0], &test_ctx.mem);
let mut pkt = VsockPacket::from_tx_virtq_head(
&handler_ctx.handler.txvq.pop(&test_ctx.mem).unwrap(),
)
.unwrap();
assert!(pkt.buf().is_none());
assert!(pkt.buf_mut().is_none());
}
// Test case: TX packet has more data than we can handle.
{
create_context!(test_ctx, handler_ctx);
set_pkt_len(
MAX_PKT_BUF_SIZE as u32 + 1,
&handler_ctx.guest_txvq.dtable[0],
&test_ctx.mem,
);
expect_asm_error!(tx, test_ctx, handler_ctx, VsockError::InvalidPktLen(_));
}
// Test case:
// - packet header advertises some data length; and
// - the data descriptor is missing.
{
create_context!(test_ctx, handler_ctx);
set_pkt_len(1024, &handler_ctx.guest_txvq.dtable[0], &test_ctx.mem);
handler_ctx.guest_txvq.dtable[0].flags.set(0);
expect_asm_error!(tx, test_ctx, handler_ctx, VsockError::BufDescMissing);
}
// Test case: error on write-only buf descriptor.
{
create_context!(test_ctx, handler_ctx);
handler_ctx.guest_txvq.dtable[1]
.flags
.set(VIRTQ_DESC_F_WRITE);
expect_asm_error!(tx, test_ctx, handler_ctx, VsockError::UnreadableDescriptor);
}
// Test case: the buffer descriptor cannot fit all the data advertised by the the
// packet header `len` field.
{
create_context!(test_ctx, handler_ctx);
set_pkt_len(8 * 1024, &handler_ctx.guest_txvq.dtable[0], &test_ctx.mem);
handler_ctx.guest_txvq.dtable[1].len.set(4 * 1024);
expect_asm_error!(tx, test_ctx, handler_ctx, VsockError::BufDescTooSmall);
}
} | rust_cleaned_test_functions.jsonl/17729 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1750
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17805,
21078,
11898,
5642,
368,
341,
286,
442,
3393,
1142,
25,
6849,
17031,
10151,
14614,
624,
286,
341,
310,
1855,
8467,
10297,
1944,
15147,
11,
7013,
15147,
626,
310,
1077,
34654,
284,
647,
1319... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_valid_vm_config_cmdline() {
vec![(
vec![
"cloud-hypervisor",
"--kernel",
"/path/to/kernel",
"--cmdline",
"arg1=foo arg2=bar",
],
r#"{
"kernel": {"path": "/path/to/kernel"},
"cmdline": {"args": "arg1=foo arg2=bar"}
}"#,
true,
)]
.iter()
.for_each(|(cli, openapi, equal)| {
compare_vm_config_cli_vs_json(cli, openapi, *equal);
});
} | rust_cleaned_test_functions.jsonl/4723 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 373
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8337,
39008,
5332,
11684,
1056,
368,
341,
286,
7486,
20703,
1006,
310,
7486,
90515,
394,
330,
12361,
2832,
1082,
31396,
756,
394,
14482,
23248,
756,
394,
3521,
2343,
32429,
58343,
756,
394,
14482,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tail() {
let mut output = [0u16; 1];
let mut decoder = UTF_8.new_decoder_without_bom_handling();
{
let (result, read, written, had_errors) =
decoder.decode_to_utf16("\u{E4}a".as_bytes(), &mut output[..], false);
assert_eq!(result, CoderResult::OutputFull);
assert_eq!(read, 2);
assert_eq!(written, 1);
assert!(!had_errors);
assert_eq!(output[0], 0x00E4);
}
} | rust_cleaned_test_functions.jsonl/123865 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 276
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35471,
368,
341,
286,
1077,
5206,
2550,
284,
508,
15,
84,
16,
21,
26,
220,
16,
935,
286,
1077,
5206,
24551,
284,
20076,
62,
23,
4618,
49843,
39904,
880,
316,
75642,
543,
286,
341,
310,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_enum_body_take() {
use crate::token_stream;
let stream = &mut token_stream("enum Foo { }");
let (data_type, ident) = super::DataType::take(stream).unwrap();
assert_eq!(data_type, super::DataType::Enum);
assert_eq!(ident, "Foo");
let body = EnumBody::take(stream).unwrap();
assert_eq!(0, body.variants.len());
let stream = &mut token_stream("enum Foo { Bar, Baz(u8), Blah { a: u32, b: u128 } }");
let (data_type, ident) = super::DataType::take(stream).unwrap();
assert_eq!(data_type, super::DataType::Enum);
assert_eq!(ident, "Foo");
let body = EnumBody::take(stream).unwrap();
assert_eq!(3, body.variants.len());
assert_eq!(body.variants[0].name, "Bar");
assert!(body.variants[0].fields.is_unit());
assert_eq!(body.variants[1].name, "Baz");
assert_eq!(1, body.variants[1].fields.len());
let (ident, field) = body.variants[1].fields.get(0).unwrap();
assert!(ident.is_none());
assert_eq!(field.type_string(), "u8");
assert_eq!(body.variants[2].name, "Blah");
assert_eq!(2, body.variants[2].fields.len());
let (ident, field) = body.variants[2].fields.get(0).unwrap();
assert_eq!(ident.unwrap(), "a");
assert_eq!(field.type_string(), "u32");
let (ident, field) = body.variants[2].fields.get(1).unwrap();
assert_eq!(ident.unwrap(), "b");
assert_eq!(field.type_string(), "u128");
} | rust_cleaned_test_functions.jsonl/22168 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 598
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31054,
14114,
73261,
368,
341,
262,
990,
17717,
486,
5839,
12673,
401,
262,
1077,
4269,
284,
609,
6984,
3950,
12673,
445,
9018,
33428,
314,
335,
797,
262,
1077,
320,
691,
1819,
11,
3524,
8,
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_bool_from_string() {
assert_de_tokens_error::<bool>(
&[Token::Str("false")],
"invalid type: string \"false\", expected a boolean",
);
} | rust_cleaned_test_functions.jsonl/129544 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 83
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22159,
5673,
3904,
368,
341,
262,
2060,
2259,
28838,
4096,
27638,
2641,
17055,
286,
44590,
3323,
486,
2580,
445,
3849,
899,
1259,
286,
330,
11808,
943,
25,
914,
7245,
3849,
16215,
3601,
264,
2710,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_metric_cache_add_local_txns() {
let (mut mempool, _) = setup_mempool();
let txns = add_txns_to_mempool(
&mut mempool,
vec![TestTransaction::new(0, 0, 1), TestTransaction::new(1, 0, 2)],
);
// Check txns' timestamps exist in metrics_cache.
assert_eq!(exist_in_metrics_cache(&mempool, &txns[0]), true);
assert_eq!(exist_in_metrics_cache(&mempool, &txns[1]), true);
} | rust_cleaned_test_functions.jsonl/1795 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 193
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41294,
11529,
2891,
13564,
17805,
4412,
368,
341,
262,
1077,
320,
6984,
1833,
10285,
11,
27439,
284,
6505,
717,
3262,
1749,
543,
262,
1077,
9854,
4412,
284,
912,
17805,
4412,
2346,
717,
3262,
1749... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_gpio_clear_errors() {
check_stmt_err("GPIO_CLEAR takes zero or one argument", r#"GPIO_CLEAR 1, 2"#);
check_pin_validation("", r#"GPIO_CLEAR _PIN_"#);
} | rust_cleaned_test_functions.jsonl/82628 | {
"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,
32001,
21811,
20196,
368,
341,
286,
1779,
21824,
9266,
445,
26337,
39280,
4990,
7168,
476,
825,
5693,
497,
435,
55543,
26337,
39280,
220,
16,
11,
220,
17,
57676,
626,
286,
1779,
26296,
19416,
1981... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_example2() {
let input = "\
dc-end
HN-start
start-kj
dc-start
dc-HN
LN-dc
HN-end
kj-sa
kj-HN
kj-dc
";
assert_eq!(solve(&input), 19);
} | rust_cleaned_test_functions.jsonl/38772 | {
"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,
39304,
17,
368,
341,
256,
1077,
1946,
284,
93317,
7628,
13068,
198,
43165,
18935,
198,
2468,
12646,
73,
198,
7628,
18935,
198,
7628,
11278,
45,
198,
50216,
1737,
66,
198,
43165,
13068,
198,
92697,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_update_add_htlc_bolt2_sender_value_below_minimum_msat() {
//BOLT2 Requirement: MUST offer amount_msat greater than 0.
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let _chan = create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 100000, 95000000, InitFeatures::supported(), InitFeatures::supported());
let mut route = nodes[0].router.get_route(&nodes[1].node.get_our_node_id(), None, &[], 100000, TEST_FINAL_CLTV).unwrap();
let (_, our_payment_hash) = get_payment_preimage_hash!(nodes[0]);
route.hops[0].fee_msat = 0;
let err = nodes[0].node.send_payment(route, our_payment_hash);
if let Err(APIError::ChannelUnavailable{err}) = err {
assert_eq!(err, "Cannot send less than their minimum HTLC value");
} else {
assert!(false);
}
assert!(nodes[0].node.get_and_clear_pending_msg_events().is_empty());
nodes[0].logger.assert_log("lightning::ln::channelmanager".to_string(), "Cannot send less than their minimum HTLC value".to_string(), 1);
} | rust_cleaned_test_functions.jsonl/28322 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 453
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
2891,
49086,
17257,
880,
6181,
17,
54356,
3142,
82750,
84855,
21416,
266,
368,
341,
197,
322,
33,
35320,
17,
75938,
25,
27732,
3010,
3311,
21416,
266,
7046,
1091,
220,
15,
624,
1572,
10217,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_num_islands() {
assert_eq!(
Solution::num_islands(vec![
vec!['1', '1', '1', '1', '0'],
vec!['1', '1', '0', '1', '0'],
vec!['1', '1', '0', '0', '0'],
vec!['0', '0', '0', '0', '0']
]),
1
);
assert_eq!(
Solution::num_islands(vec![
vec!['1', '1', '0', '0', '0'],
vec!['1', '1', '0', '0', '0'],
vec!['0', '0', '1', '0', '0'],
vec!['0', '0', '0', '1', '1']
]),
3
);
} | rust_cleaned_test_functions.jsonl/106105 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 437
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4273,
6892,
8166,
368,
341,
286,
2060,
10714,
33673,
310,
12478,
486,
2413,
6892,
8166,
25592,
90515,
394,
7486,
0,
677,
16,
516,
364,
16,
516,
364,
16,
516,
364,
16,
516,
364,
15,
4380,
394,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fits_in_bits() {
assert_eq!(BigInt::from(10).fits_in_bits(3, false), false);
assert_eq!(BigInt::from(10).fits_in_bits(4, false), true);
assert_eq!(BigInt::from(10).fits_in_bits(5, false), true);
assert_eq!(BigInt::from(10).fits_in_bits(3, true), false);
assert_eq!(BigInt::from(10).fits_in_bits(4, true), false);
assert_eq!(BigInt::from(10).fits_in_bits(5, true), true);
assert_eq!(BigInt::from(-10).fits_in_bits(3, false), false);
assert_eq!(BigInt::from(-10).fits_in_bits(4, false), false);
assert_eq!(BigInt::from(-10).fits_in_bits(5, false), false);
assert_eq!(BigInt::from(-10).fits_in_bits(3, true), false);
assert_eq!(BigInt::from(-10).fits_in_bits(4, true), false);
assert_eq!(BigInt::from(-10).fits_in_bits(5, true), true);
} | rust_cleaned_test_functions.jsonl/55695 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 410
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
1199,
1243,
20034,
368,
341,
286,
2060,
10714,
10297,
87474,
486,
1499,
7,
16,
15,
568,
29222,
1243,
20034,
7,
18,
11,
895,
701,
895,
317,
286,
2060,
10714,
10297,
87474,
486,
1499,
7,
16... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multiple_systems_and_resellers() {
assert_eq!(
parse(
r###"# Ads.txt file for example.com:
greenadexchange.com, 12345, DIRECT, d75815a79
silverssp.com, 9675, RESELLER, f496211
blueadexchange.com, XF436, DIRECT
orangeexchange.com, 45678, RESELLER
silverssp.com, ABE679, RESELLER"###
)
.unwrap(),
vec![
Row::Comment("Ads.txt file for example.com:"),
Row::Record(Record {
domain: "greenadexchange.com",
account_id: "12345",
relation: Relation::Direct,
authority_id: Some("d75815a79"),
}),
Row::Record(Record {
domain: "silverssp.com",
account_id: "9675",
relation: Relation::Reseller,
authority_id: Some("f496211"),
}),
Row::Record(Record {
domain: "blueadexchange.com",
account_id: "XF436",
relation: Relation::Direct,
authority_id: None,
}),
Row::Record(Record {
domain: "orangeexchange.com",
account_id: "45678",
relation: Relation::Reseller,
authority_id: None,
}),
Row::Record(Record {
domain: "silverssp.com",
account_id: "ABE679",
relation: Relation::Reseller,
authority_id: None,
}),
]
);
} | rust_cleaned_test_functions.jsonl/111501 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 870
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45233,
17687,
82,
8378,
4918,
24777,
368,
341,
262,
2060,
10714,
33673,
286,
4715,
1006,
310,
435,
14374,
57676,
42183,
3909,
1034,
369,
3110,
905,
510,
13250,
329,
39568,
905,
11,
220,
16,
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_read_comments() {
let input = "1 ;; this is a comment\n2";
let mut heap = Heap::new();
let results : Vec<Value> = read_from_str(input, &mut heap, "test_read_comments")
.map(|(_, r)| *r.ok().expect("Should not get a read error"))
.collect();
assert_eq!(results.len(), 2);
assert_eq!(results, vec!(Value::new_integer(1),
Value::new_integer(2)));
} | rust_cleaned_test_functions.jsonl/62116 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 235
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
30359,
368,
341,
286,
1077,
1946,
284,
330,
16,
13667,
419,
374,
264,
3980,
1699,
17,
876,
286,
1077,
5206,
17364,
284,
47307,
486,
931,
543,
286,
1077,
3059,
549,
11312,
48325,
29,
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_priv_key_from_parts() {
let p = BigNum::from_u32(283).unwrap();
let q = BigNum::from_u32(47).unwrap();
let g = BigNum::from_u32(60).unwrap();
let priv_key = BigNum::from_u32(15).unwrap();
let pub_key = BigNum::from_u32(207).unwrap();
let dsa = Dsa::from_private_components(p, q, g, priv_key, pub_key).unwrap();
assert_eq!(dsa.pub_key(), &BigNum::from_u32(207).unwrap());
assert_eq!(dsa.priv_key(), &BigNum::from_u32(15).unwrap());
assert_eq!(dsa.p(), &BigNum::from_u32(283).unwrap());
assert_eq!(dsa.q(), &BigNum::from_u32(47).unwrap());
assert_eq!(dsa.g(), &BigNum::from_u32(60).unwrap());
} | rust_cleaned_test_functions.jsonl/134746 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 355
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24726,
3097,
5673,
33217,
368,
341,
286,
1077,
281,
284,
6164,
4651,
486,
1499,
7300,
18,
17,
7,
17,
23,
18,
568,
15454,
543,
286,
1077,
2804,
284,
6164,
4651,
486,
1499,
7300,
18,
17,
7,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_env() {
let m = App::new("myapp")
.arg(
Arg::with_name("env")
.short("E")
.multiple(true)
.takes_value(true),
)
.get_matches_from(vec!["myapp", "-E", "FOO=bar"]);
let values = m.values_of("env");
assert_eq!(
parse_env(&values),
Some(vec![rusoto_ecs::KeyValuePair {
name: Some(String::from("FOO")),
value: Some(String::from("bar")),
}])
)
} | rust_cleaned_test_functions.jsonl/32620 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 364
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
15879,
368,
341,
286,
1077,
296,
284,
1845,
486,
931,
445,
2408,
676,
1138,
310,
659,
858,
1006,
394,
7638,
486,
4197,
1269,
445,
3160,
1138,
503,
659,
8676,
445,
36,
1138,
503,
659,
35... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iam_permission() -> Result<(), Box<dyn std::error::Error>> {
let bucket = crate::create_test_bucket_sync("test-test-ia-permission");
bucket.test_iam_permission_sync("storage.buckets.get")?;
bucket.delete_sync()?;
Ok(())
} | rust_cleaned_test_functions.jsonl/131798 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 145
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
4932,
37971,
368,
1464,
5714,
68843,
8261,
92846,
1460,
486,
841,
486,
1454,
2452,
341,
310,
1077,
15621,
284,
17717,
486,
3182,
4452,
38749,
23008,
445,
1944,
16839,
12,
685,
17018,
2728,
797... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_game_events() {
new_test_ext().execute_with(|| {
let blocks_to_pass = 10;
let mut current_block:u64 = 100;
// start from block 100
run_to_block(current_block);
assert_eq!(None, ConnectFour::something());
// Test game creation between to different players
assert_ok!(ConnectFour::test_schedule(Origin::signed(PLAYER_1 as u64), blocks_to_pass));
run_next_block();
current_block = current_block + 1;
assert_eq!(None, ConnectFour::something());
run_to_block(current_block + blocks_to_pass);
assert_eq!(77, ConnectFour::something().unwrap());
});
} | rust_cleaned_test_functions.jsonl/8682 | {
"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,
18547,
19691,
368,
341,
8638,
4452,
9927,
1005,
10257,
6615,
79453,
1476,
197,
10217,
10010,
2346,
15464,
284,
220,
16,
15,
280,
197,
10217,
5206,
1482,
7113,
25,
84,
21,
19,
284,
220,
16,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_remove_from_resource_table() {
let mut table = ResourceTable::default();
let rid1 = table.add("fake1", Box::new(FakeResource::new(1)));
let rid2 = table.add("fake2", Box::new(FakeResource::new(2)));
assert_eq!(table.map.len(), 2);
table.close(rid1);
assert_eq!(table.map.len(), 1);
table.close(rid2);
assert_eq!(table.map.len(), 0);
} | rust_cleaned_test_functions.jsonl/133163 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 166
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18193,
5673,
17962,
5237,
368,
341,
262,
1077,
5206,
1965,
284,
11765,
2556,
486,
2258,
543,
262,
1077,
9279,
16,
284,
1965,
1364,
445,
30570,
16,
497,
8261,
486,
931,
7832,
726,
4783,
486,
931,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_format_8mb_1fat() {
let total_bytes = 8 * MB;
let opts = fatfs::FormatVolumeOptions::new().fats(1);
let fs = test_format_fs(opts, total_bytes);
assert_eq!(fs.fat_type(), fatfs::FatType::Fat16);
} | rust_cleaned_test_functions.jsonl/35393 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8955,
62,
23,
3096,
62,
16,
44183,
368,
341,
262,
1077,
2790,
12524,
284,
220,
23,
353,
13339,
280,
262,
1077,
12185,
284,
8664,
3848,
486,
4061,
18902,
3798,
486,
931,
1005,
69,
1862,
7,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_helper_for_subexpression() {
let mut handlebars = Registry::new();
assert!(handlebars
.register_template_string("t2", "{{foo value=(bar 0)}}")
.is_ok());
handlebars.register_helper(
"helperMissing",
Box::new(
|h: &Helper<'_, '_>,
_: &Registry<'_>,
_: &Context,
_: &mut RenderContext<'_, '_>,
out: &mut dyn Output|
-> Result<(), RenderError> {
let output = format!("{}{}", h.name(), h.param(0).unwrap().value());
out.write(output.as_ref())?;
Ok(())
},
),
);
handlebars.register_helper(
"foo",
Box::new(
|h: &Helper<'_, '_>,
_: &Registry<'_>,
_: &Context,
_: &mut RenderContext<'_, '_>,
out: &mut dyn Output|
-> Result<(), RenderError> {
let output = format!("{}", h.hash_get("value").unwrap().value().render());
out.write(output.as_ref())?;
Ok(())
},
),
);
let mut data = BTreeMap::new();
// handlebars should never try to lookup this value because
// subexpressions are now resolved as string literal
data.insert("bar0".to_string(), true);
let r2 = handlebars.render("t2", &data);
assert_eq!(r2.ok().unwrap(), "bar0".to_string());
} | rust_cleaned_test_functions.jsonl/21198 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 918
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10418,
5478,
5228,
28099,
368,
341,
286,
1077,
5206,
3705,
24950,
284,
32112,
486,
931,
543,
286,
2060,
10297,
8192,
24950,
198,
310,
659,
6343,
8693,
3904,
445,
83,
17,
497,
47219,
7975,
897,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_difference() {
fn check_difference(a: &[int], b: &[int], expected: &[int]) {
check(a, b, expected, |x, y, f| x.difference(y).all(f))
}
check_difference([], [], []);
check_difference([1, 12], [], [1, 12]);
check_difference([], [1, 2, 3, 9], []);
check_difference([1, 3, 5, 9, 11],
[3, 9],
[1, 5, 11]);
check_difference([-5, 11, 22, 33, 40, 42],
[-12, -5, 14, 23, 34, 38, 39, 50],
[11, 22, 33, 40, 42]);
} | rust_cleaned_test_functions.jsonl/66381 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 360
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
47525,
368,
341,
286,
5168,
1779,
47525,
2877,
25,
44590,
396,
1125,
293,
25,
44590,
396,
1125,
3601,
25,
44590,
396,
2467,
341,
310,
1779,
2877,
11,
293,
11,
3601,
11,
760,
87,
11,
379,
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_dyn() {
trait Augmented: MallocSizeOf {}
impl Augmented for Vec<u8> {}
let val: Arc<dyn Augmented> = Arc::new(vec![0u8; 1024]);
assert!(malloc_size(&*val) > 1000);
} | rust_cleaned_test_functions.jsonl/24453 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
69213,
368,
341,
197,
25583,
1315,
4928,
26980,
25,
386,
4742,
1695,
2124,
5613,
197,
197,
6383,
4928,
26980,
369,
11312,
34837,
23,
29,
5613,
197,
10217,
1044,
25,
19689,
92846,
4928,
26980,
29,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_add() {
assert_eq!(
Measure::from_str("10 minutes")
.add(Measure::from_str("2-3 minutes"))
.unwrap(),
Measure::from_str("12-13 minutes"),
);
} | rust_cleaned_test_functions.jsonl/38592 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
368,
341,
286,
2060,
10714,
33673,
310,
34104,
486,
1499,
2895,
445,
16,
15,
4420,
1138,
394,
659,
718,
14280,
3970,
486,
1499,
2895,
445,
17,
12,
18,
4420,
5455,
394,
659,
15454,
3148,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_to_v2_manifest() {
let reference = Reference::try_from("webassembly.azurecr.io/hello:v1".to_owned())
.expect("Could not parse reference");
assert_eq!(
"https://webassembly.azurecr.io/v2/hello/manifests/v1",
reference.to_v2_manifest_url("https")
);
} | rust_cleaned_test_functions.jsonl/4951 | {
"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,
2346,
2273,
17,
74269,
368,
341,
286,
1077,
5785,
284,
17207,
486,
1539,
5673,
445,
2911,
14993,
70240,
5082,
4245,
7530,
4791,
52649,
16,
3263,
983,
51973,
2398,
310,
659,
17119,
445,
12895,
537,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_seq_float() {
check(Vec::<f32>::new(), Some(4));
check(vec![0f32, 1., 2.], Some(4 + 4 * 3));
} | rust_cleaned_test_functions.jsonl/79663 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 67
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14486,
17586,
368,
341,
262,
1779,
49923,
27638,
69,
18,
17,
6831,
931,
1507,
4329,
7,
19,
1106,
262,
1779,
25592,
20703,
15,
69,
18,
17,
11,
220,
16,
2572,
220,
17,
13,
1125,
4329,
7,
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 |
#[test]
fn test_cleanup_precision() {
assert_eq!(
decimal("10000000000000000000000000000000000000000000000.999999999999999999999999998",)
+ decimal(
"10000000000000000000000000000000000000000000000.000000000000000000000000002",
),
decimal("20000000000000000000000000000000000000000000001")
)
} | rust_cleaned_test_functions.jsonl/58119 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 133
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42444,
54618,
368,
341,
262,
2060,
10714,
33673,
286,
12122,
445,
16,
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,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unexpected_full_type() {
let mut log = new_record_test();
log.write("foo");
log.write("bar");
log.set_byte(6, First as u8);
log.fix_checksum(0, 3);
assert_eq!("bar", log.read());
assert_eq!(EOF, log.read());
assert_eq!(3, log.dropped_bytes());
assert!(log.match_error("partial record without end"));
} | rust_cleaned_test_functions.jsonl/46696 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 197
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
7325,
16372,
1819,
368,
341,
286,
1077,
5206,
1487,
284,
501,
14192,
4452,
543,
286,
1487,
3836,
445,
7975,
797,
286,
1487,
3836,
445,
2257,
797,
286,
1487,
980,
19737,
7,
21,
11,
5512,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_multiscalar_multiplication_ristretto() {
let scalar = PodScalar([
123, 108, 109, 66, 154, 185, 88, 122, 178, 43, 17, 154, 201, 223, 31, 238, 59, 215, 71,
154, 215, 143, 177, 158, 9, 136, 32, 223, 139, 13, 133, 5,
]);
let point = PodRistrettoPoint([
158, 2, 130, 90, 148, 36, 172, 155, 86, 196, 74, 139, 30, 98, 44, 225, 155, 207, 135,
111, 238, 167, 235, 67, 234, 125, 0, 227, 146, 31, 24, 113,
]);
let basic_product = multiply_ristretto(&scalar, &point).unwrap();
let msm_product = multiscalar_multiply_ristretto(&[scalar], &[point]).unwrap();
assert_eq!(basic_product, msm_product);
let scalar_a = PodScalar([
8, 161, 219, 155, 192, 137, 153, 26, 27, 40, 30, 17, 124, 194, 26, 41, 32, 7, 161, 45,
212, 198, 212, 81, 133, 185, 164, 85, 95, 232, 106, 10,
]);
let scalar_b = PodScalar([
135, 207, 106, 208, 107, 127, 46, 82, 66, 22, 136, 125, 105, 62, 69, 34, 213, 210, 17,
196, 120, 114, 238, 237, 149, 170, 5, 243, 54, 77, 172, 12,
]);
let point_x = PodRistrettoPoint([
130, 35, 97, 25, 18, 199, 33, 239, 85, 143, 119, 111, 49, 51, 224, 40, 167, 185, 240,
179, 25, 194, 213, 41, 14, 155, 104, 18, 181, 197, 15, 112,
]);
let point_y = PodRistrettoPoint([
152, 156, 155, 197, 152, 232, 92, 206, 219, 159, 193, 134, 121, 128, 139, 36, 56, 191,
51, 143, 72, 204, 87, 76, 110, 124, 101, 96, 238, 158, 42, 108,
]);
let ax = multiply_ristretto(&scalar_a, &point_x).unwrap();
let by = multiply_ristretto(&scalar_b, &point_y).unwrap();
let basic_product = add_ristretto(&ax, &by).unwrap();
let msm_product =
multiscalar_multiply_ristretto(&[scalar_a, scalar_b], &[point_x, point_y]).unwrap();
assert_eq!(basic_product, msm_product);
} | rust_cleaned_test_functions.jsonl/15620 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 995
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26290,
3427,
7934,
91802,
1693,
1710,
380,
2122,
983,
368,
341,
286,
1077,
17274,
284,
16821,
20639,
8956,
310,
220,
16,
17,
18,
11,
220,
16,
15,
23,
11,
220,
16,
15,
24,
11,
220,
21,
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_solid_field_range_invert() {
let mut cmd = assert_cmd::Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap();
cmd.args(&["-s", "-v", "-d", ",", "-f", "2-4", "sed", "s/./_/"])
.write_stdin("AAA,BBB,CCC,DDD\nEEE,FFF,GGG,HHH\n")
.assert()
.stdout("_AA,BBB,CCC,DDD\n_EE,FFF,GGG,HHH\n");
} | rust_cleaned_test_functions.jsonl/7934 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 209
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
5192,
5013,
9698,
1243,
1621,
368,
341,
286,
1077,
5206,
5439,
284,
2060,
11684,
486,
4062,
486,
66715,
21816,
16978,
17223,
34,
7581,
46,
94126,
4708,
15197,
15454,
543,
286,
5439,
16365,
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_apply_jql_bool() {
let json = r#"{"post code": "90210", "country": "United States", "country abbreviation": "US", "places": [{"place name": "Beverly Hills", "longitude": -118.4065, "state": "California", "state abbreviation": "CA", "latitude": 34.0901, "expensive": true}]}"#;
let selectors = r#"."places"[0]."expensive""#;
let value: String = apply_jql(json, selectors).unwrap();
assert_eq!(true.to_string(), value);
} | rust_cleaned_test_functions.jsonl/14760 | {
"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,
36551,
5374,
1470,
22159,
368,
341,
262,
1077,
2951,
284,
435,
55543,
4913,
2203,
2038,
788,
330,
24,
15,
17,
16,
15,
497,
330,
11141,
788,
330,
22372,
4180,
497,
330,
11141,
71478,
788,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mismatched_type_error() {
insta::assert_display_snapshot!(compilation_errors(
"\n\nfn main() {\nlet a: f64 = false;\n\nlet b: bool = 22;\n}"
));
} | rust_cleaned_test_functions.jsonl/21697 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
24976,
291,
1819,
4096,
368,
341,
286,
1761,
64,
486,
2207,
14825,
53265,
10297,
5689,
13455,
20196,
1006,
310,
2917,
77,
1699,
8822,
1887,
368,
28152,
77,
1149,
264,
25,
282,
21,
19,
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 |
#[test]
fn test_serde() {
use self::bincode::{config, deserialize};
let mut small_vec: SmallVec<[i32; 2]> = SmallVec::new();
small_vec.push(1);
let encoded = config().limit(100).serialize(&small_vec).unwrap();
let decoded: SmallVec<[i32; 2]> = deserialize(&encoded).unwrap();
assert_eq!(small_vec, decoded);
small_vec.push(2);
// Spill the vec
small_vec.push(3);
small_vec.push(4);
// Check again after spilling.
let encoded = config().limit(100).serialize(&small_vec).unwrap();
let decoded: SmallVec<[i32; 2]> = deserialize(&encoded).unwrap();
assert_eq!(small_vec, decoded);
} | rust_cleaned_test_functions.jsonl/88177 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 330
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75861,
450,
368,
341,
286,
990,
656,
486,
6863,
1851,
22964,
1676,
11,
35240,
2440,
286,
1077,
5206,
2613,
13251,
25,
14994,
10050,
66746,
72,
18,
17,
26,
220,
17,
25669,
284,
14994,
10050,
486,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_inc_count_with_multiple_transactions() {
let (mut testkit, api) = init_testkit();
for _ in 0..100 {
inc_count(&api, 1);
inc_count(&api, 2);
inc_count(&api, 3);
inc_count(&api, 4);
testkit.create_block();
}
assert_eq!(testkit.height(), Height(100));
let counter: u64 = api.public(ApiKind::Service("counter"))
.get("count")
.unwrap();
assert_eq!(counter, 1_000);
} | rust_cleaned_test_functions.jsonl/86866 | {
"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,
31285,
3180,
6615,
45233,
68182,
368,
341,
262,
1077,
320,
6984,
1273,
8226,
11,
6330,
8,
284,
2930,
4452,
8226,
1428,
262,
369,
716,
304,
220,
15,
496,
16,
15,
15,
341,
286,
3625,
3180,
2099,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_response_serialize_int() {
let expected = r#"{"id":1,"method":"login","jsonrpc":"2.0","params":null}"#;
let rpc = RpcResponse {
id: JsonId::IntId(1),
method: String::from("login"),
jsonrpc: String::from("2.0"),
result: None,
error: None,
};
let json_actual = serde_json::to_string(&rpc).unwrap();
let expected_deserialized: RpcResponse = serde_json::from_str(expected).unwrap();
let actual_deserialized: RpcResponse = serde_json::from_str(&json_actual).unwrap();
assert_eq!(expected_deserialized, actual_deserialized);
} | rust_cleaned_test_functions.jsonl/49215 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 232
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9655,
88686,
4042,
368,
341,
197,
10217,
3601,
284,
435,
55543,
4913,
307,
788,
16,
1335,
4393,
3252,
3673,
2198,
2236,
29414,
3252,
17,
13,
15,
2198,
3519,
788,
2921,
9863,
2,
280,
197,
10217,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_with_vars_set() {
let one_not_set = env::var("ONE");
assert!(one_not_set.is_err(), "`ONE` must not be set.");
let two_not_set = env::var("TWO");
assert!(two_not_set.is_err(), "`TWO` must not be set.");
crate::with_vars(vec![("ONE", Some("1")), ("TWO", Some("2"))], || {
let one_is_set = env::var("ONE").unwrap();
assert_eq!(one_is_set, "1", "`ONE` must be set to \"1\".");
let two_is_set = env::var("TWO").unwrap();
assert_eq!(two_is_set, "2", "`TWO` must be set to \"2\".");
});
let one_not_set_after = env::var("ONE");
assert!(one_not_set_after.is_err(), "`ONE` must not be set.");
let two_not_set_after = env::var("TWO");
assert!(two_not_set_after.is_err(), "`TWO` must not be set.");
} | rust_cleaned_test_functions.jsonl/49885 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 429
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
11168,
2602,
368,
341,
286,
1077,
825,
7913,
2602,
284,
6105,
486,
947,
445,
5225,
797,
286,
2060,
10297,
603,
7913,
2602,
2079,
9266,
1507,
35973,
5225,
63,
1969,
537,
387,
738,
7320,
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_xmlhstring() {
assert_eq!(
xmlhstring("AB0196"),
done_result!(vec![10u8, 11, 0, 1, 9, 6])
);
assert_eq!(
xmlhstring("AB \u{A0}0\n\t196"),
done_result!(vec![10u8, 11, 0, 1, 9, 6])
);
assert_eq!(
xmlhstring("\x0BAB0196 \t\x0D"),
done_result!(vec![10u8, 11, 0, 1, 9, 6])
);
assert_eq!(
xmlhstring("01101100'B"),
Done("'B", vec![0u8, 1, 1, 0, 1, 1, 0, 0])
);
assert_eq!(xmlhstring("'01101100'"), Done("'01101100'", vec![]));
} | rust_cleaned_test_functions.jsonl/29996 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 390
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23855,
71,
917,
368,
341,
286,
2060,
10714,
33673,
310,
8396,
71,
917,
445,
1867,
15,
16,
24,
21,
4461,
310,
2814,
5287,
10297,
4083,
20703,
16,
15,
84,
23,
11,
220,
16,
16,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.