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_query() {
let hwdb = Hwdb::new().unwrap();
// Query the hwdb for a device that should always be known:
let results: Vec<_> = hwdb.query("usb:v1D6Bp0001").collect();
assert_eq!(results.len(), 2);
// We expect an ID_VENDOR_FROM_DATABASE and an ID_MODEL_FROM_DATABASE with corresponding
// values; no order is specified by udev.
assert!(results
.iter()
.find(|e| e.name == "ID_VENDOR_FROM_DATABASE")
.is_some());
assert!(results
.iter()
.find(|e| e.name == "ID_MODEL_FROM_DATABASE")
.is_some());
assert!(results
.iter()
.find(|e| e.value == "Linux Foundation")
.is_some());
assert!(results.iter().find(|e| e.value == "1.1 root hub").is_some());
} | rust_cleaned_test_functions.jsonl/78886 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 454
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5738,
368,
341,
286,
1077,
31256,
1999,
284,
472,
86,
1999,
486,
931,
1005,
15454,
543,
286,
442,
11361,
279,
31256,
1999,
369,
264,
3671,
429,
1265,
2677,
387,
3881,
510,
1789,
286,
1077,
3059,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_insert_remove_replace_update_extended() {
if env::var("SKIP_EXTENDED_BULK_OPERATION_TESTS") == Ok("true".to_string()) {
return
}
let uri = Uri::new(helpers::mongodb_test_connection_string()).unwrap();
let pool = ClientPool::new(uri, None);
let client = pool.pop();
let mut collection = client.get_collection("rust_driver_test", "bulk_operation_extended");
collection.drop().unwrap_or(());
// Insert 5 documents
{
let bulk_operation = collection.create_bulk_operation(None);
let document = doc! {
"key_1": "Value 1",
"key_2": "Value 2"
};
for _ in 0..5 {
bulk_operation.insert(&document).unwrap();
}
let result = bulk_operation.execute().expect("Could not execute bulk operation");
assert_eq!(
result.get("nInserted").unwrap(),
&bson::Bson::Int32(5)
);
assert_eq!(5, collection.count(&doc!{}, None).unwrap());
}
let query = doc!{};
let update_document = doc! {
"$set": {"key_1": "Value update"}
};
// Update one
{
let bulk_operation = collection.create_bulk_operation(None);
bulk_operation.update_one(
&query,
&update_document,
false
).unwrap();
let result = bulk_operation.execute().expect("Could not execute bulk operation");
assert_eq!(
result.get("nModified").unwrap(),
&bson::Bson::Int32(1)
);
let first_document = collection.find(&doc!{}, None).unwrap().next().unwrap().unwrap();
assert_eq!(
first_document.get("key_1").unwrap(),
&bson::Bson::String("Value update".to_string())
);
assert!(first_document.get("key_2").is_some());
}
// Update all
{
let bulk_operation = collection.create_bulk_operation(None);
bulk_operation.update(
&query,
&update_document,
false
).unwrap();
let result = bulk_operation.execute().expect("Could not execute bulk operation");
assert_eq!(
result.get("nModified").unwrap(),
&bson::Bson::Int32(4)
);
collection.find(&doc!{}, None).unwrap().next().unwrap().unwrap();
let second_document = collection.find(&doc!{}, None).unwrap().next().unwrap().unwrap();
assert_eq!(
second_document.get("key_1").unwrap(),
&bson::Bson::String("Value update".to_string())
);
assert!(second_document.get("key_2").is_some());
}
// Replace one
{
let replace_document = doc! { "key_1": "Value replace" };
let bulk_operation = collection.create_bulk_operation(None);
bulk_operation.replace_one(
&query,
&replace_document,
false
).unwrap();
let result = bulk_operation.execute().expect("Could not execute bulk operation");
assert_eq!(
result.get("nModified").unwrap(),
&bson::Bson::Int32(1)
);
let first_document = collection.find(&doc!{}, None).unwrap().next().unwrap().unwrap();
assert_eq!(
first_document.get("key_1").unwrap(),
&bson::Bson::String("Value replace".to_string())
);
assert!(first_document.get("key_2").is_none());
}
// Remove one
{
let bulk_operation = collection.create_bulk_operation(None);
bulk_operation.remove_one(&query).unwrap();
let result = bulk_operation.execute().expect("Could not execute bulk operation");
assert_eq!(
result.get("nRemoved").unwrap(),
&bson::Bson::Int32(1)
);
assert_eq!(4, collection.count(&query, None).unwrap());
}
// Remove all remaining documents
{
let bulk_operation = collection.create_bulk_operation(None);
bulk_operation.remove(&query).unwrap();
let result = bulk_operation.execute().expect("Could not execute bulk operation");
assert_eq!(
result.get("nRemoved").unwrap(),
&bson::Bson::Int32(4)
);
assert_eq!(0, collection.count(&query, None).unwrap());
}
} | rust_cleaned_test_functions.jsonl/3256 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2004
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
18193,
10633,
8882,
61678,
368,
341,
262,
421,
6105,
486,
947,
445,
91799,
95952,
1668,
68698,
44685,
80312,
899,
621,
7622,
445,
1866,
3263,
983,
3904,
2140,
341,
286,
470,
198,
262,
555,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_throttle() {
solana_logger::setup();
let bins = 128;
let test = BucketMapHolder::<u64>::new(bins, &Some(AccountsIndexConfig::default()), 1);
let bins = test.bins as u64;
let interval_ms = test.age_interval_ms();
let elapsed_ms = interval_ms * 89 / 100;
let bins_flushed = bins - 1;
let result = test.throttling_wait_ms_internal(interval_ms, elapsed_ms, bins_flushed);
assert_eq!(result, None);
let elapsed_ms = interval_ms / 10;
let bins_flushed = bins - 1;
let result = test.throttling_wait_ms_internal(interval_ms, elapsed_ms, bins_flushed);
assert_eq!(result, Some(1));
let elapsed_ms = interval_ms * 5 / 100;
let bins_flushed = bins * 8 / 100;
let result = test.throttling_wait_ms_internal(interval_ms, elapsed_ms, bins_flushed);
assert_eq!(result, Some(1));
let elapsed_ms = interval_ms * 11 / 100;
let bins_flushed = bins * 12 / 100;
let result = test.throttling_wait_ms_internal(interval_ms, elapsed_ms, bins_flushed);
assert_eq!(result, None);
} | rust_cleaned_test_functions.jsonl/5426 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 546
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5854,
27535,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
28518,
284,
220,
16,
17,
23,
280,
286,
1077,
1273,
284,
47768,
2227,
8589,
27638,
84,
21,
19,
6831,
931,
1883,
1330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_program_address() {
for _ in 0..1_000 {
let program_id = Pubkey::new_unique();
let (address, bump_seed) =
Pubkey::find_program_address(&[b"Lil'", b"Bits"], &program_id);
assert_eq!(
address,
Pubkey::create_program_address(&[b"Lil'", b"Bits", &[bump_seed]], &program_id)
.unwrap()
);
}
} | rust_cleaned_test_functions.jsonl/24279 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 261
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
25096,
6744,
368,
341,
286,
369,
716,
304,
220,
15,
496,
16,
62,
15,
15,
15,
341,
310,
1077,
2025,
842,
284,
22611,
792,
486,
931,
21218,
543,
310,
1077,
320,
4995,
11,
27575,
33809,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_format() {
let program = parse_str(
r#".assert human(string).
.input(human, "file-name", "arrow")."#,
);
assert!(program.is_err());
println!("{:?}", program);
} | rust_cleaned_test_functions.jsonl/52307 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 98
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
8955,
368,
341,
262,
1077,
2025,
284,
4715,
2895,
1006,
286,
435,
2,
3263,
2207,
3738,
3609,
4292,
10046,
3203,
7136,
11,
330,
1192,
11494,
497,
330,
6044,
1827,
57676,
345,
262,
3475,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_multiple_deser() -> Result<()> {
// Tests that we don't too eagerly advance the buffer
let b1 = Basic {
b: true,
b2: false,
..Default::default()
};
let b2 = Basic {
b: true,
b2: true,
..Default::default()
};
// serialize it and assert that it serializes correctly
let s1 = String::from_utf8(serialize(&b1).to_vec()).unwrap();
let s2 = String::from_utf8(serialize(&b2).to_vec()).unwrap();
let to_check = format!("{} {}", s1, s2);
let mut deserializer = SimpleJsonProtocolDeserializer::new(Cursor::new(to_check.as_bytes()));
// Assert that deserialize builts the exact same struct
assert_eq!(b1, Basic::read(&mut deserializer)?);
assert_eq!(b2, Basic::read(&mut deserializer)?);
Ok(())
} | rust_cleaned_test_functions.jsonl/122582 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 346
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45233,
15768,
261,
368,
1464,
5714,
71698,
341,
262,
442,
20150,
429,
582,
1513,
944,
2238,
62373,
11912,
279,
4147,
198,
262,
1077,
293,
16,
284,
14625,
341,
286,
293,
25,
830,
345,
286,
293,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_nosymlink_on_non_long() {
let dir = tempdir();
dir.child("target").touch().unwrap();
let link = dir.path().join("link");
let link_icon = "⇒";
fs::symlink("target", &link).unwrap();
cmd()
.arg("-l")
.arg("--ignore-config")
.arg(&link)
.assert()
.stdout(predicate::str::contains(link_icon));
cmd()
.arg("--ignore-config")
.arg(&link)
.assert()
.stdout(predicate::str::contains(link_icon).not());
} | rust_cleaned_test_functions.jsonl/633 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 256
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1089,
436,
88,
44243,
4470,
21637,
17799,
368,
341,
262,
1077,
5419,
284,
2730,
3741,
543,
262,
5419,
17531,
445,
5657,
1827,
22020,
1005,
15454,
543,
262,
1077,
2656,
284,
5419,
3875,
1005,
5987,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_renamed_file() {
let options = get_command_line_options();
let output = strip_ansi_codes(&run_delta(RENAMED_FILE_INPUT, &options)).to_string();
assert!(output.contains("\nrenamed: a.py ⟶ b.py\n"));
} | rust_cleaned_test_functions.jsonl/61838 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 120
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
30245,
2458,
368,
341,
286,
1077,
2606,
284,
633,
10811,
6528,
8743,
543,
286,
1077,
2550,
284,
13316,
62,
52067,
38482,
2099,
6108,
26710,
7,
40892,
69522,
8087,
21022,
11,
609,
2875,
4579,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_small_signature_actors_len() {
let mut registry = PredicateSignatureSmallRegistry::new();
let signature = PredicateSignatureSmall::new(&"hi".to_owned(), &vec![1, 2, 3], &mut registry);
assert_eq!(signature.get_actors_len(), 3);
} | rust_cleaned_test_functions.jsonl/119997 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31966,
39859,
62,
21161,
6043,
368,
341,
262,
1077,
5206,
19424,
284,
49827,
25088,
25307,
15603,
486,
931,
543,
262,
1077,
11957,
284,
49827,
25088,
25307,
486,
931,
2099,
1,
6023,
3263,
983,
519... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_random_choice_weights_zero_f64() {
let capacity: usize = 1000;
let mut samples: Vec<usize> = Vec::with_capacity(capacity);
let weights: Vec<f64> = Vec::new();
for i in 0..capacity {
samples.push(i + 1);
}
let choices = random_choice().random_choice_f64(&samples, &weights, capacity);
assert!(choices.len() == 0);
} | rust_cleaned_test_functions.jsonl/107018 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 187
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22644,
31936,
21114,
19359,
761,
21,
19,
368,
341,
286,
1077,
8654,
25,
22301,
284,
220,
16,
15,
15,
15,
280,
286,
1077,
5206,
10469,
25,
11312,
90244,
29,
284,
11312,
486,
4197,
35603,
51386,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_notification_msg() {
let msg_str = r#"
{"timestamp":1568365292.84,"peer":"192.0.2.1","peer_asn":"64496","id":"00-192-0-2-0-180513","host":"rrc00","type":"NOTIFICATION","notification":{"code":6,"subcode":7,"data":"0605"}}
"#;
let _msg: RisMessage = serde_json::from_str(&msg_str).unwrap();
} | rust_cleaned_test_functions.jsonl/94950 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 160
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34296,
6483,
368,
341,
286,
1077,
3750,
2895,
284,
435,
2,
698,
286,
5212,
13035,
788,
16,
20,
21,
23,
18,
21,
20,
17,
24,
17,
13,
23,
19,
1335,
16537,
3252,
16,
24,
17,
13,
15,
13,
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_var_big() {
let mut s = "".to_string();
let mut i = 0;
while i < 100 {
s.push_str("aaaaaaaaaa");
i += 1;
}
let n = make_rand_name();
set_var(&n, &s);
eq(var_os(&n), Some(&s));
} | rust_cleaned_test_functions.jsonl/87609 | {
"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,
4612,
36386,
368,
341,
286,
1077,
5206,
274,
284,
44907,
983,
3904,
543,
286,
1077,
5206,
600,
284,
220,
15,
280,
286,
1393,
600,
366,
220,
16,
15,
15,
341,
310,
274,
2552,
2895,
445,
69440,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_run_to_next_input_or_done_need_input() {
let tokens = "3,9,8,9,10,9,4,9,99,-1,8";
let program = read_tokens(tokens);
let mut ctx = build_program_context(program, Vec::<i64>::new());
ctx.run_to_next_input_or_done();
assert_eq!(ctx.done, false);
ctx.inputs.push(8);
ctx.run_to_next_input_or_done();
assert_eq!(ctx.done, true);
assert_eq!(ctx.outputs[0], 1);
} | rust_cleaned_test_functions.jsonl/26797 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 285
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14007,
2346,
11257,
5898,
8734,
24390,
71506,
5898,
368,
341,
310,
1077,
11211,
284,
330,
18,
11,
24,
11,
23,
11,
24,
11,
16,
15,
11,
24,
11,
19,
11,
24,
11,
24,
24,
4999,
16,
11,
23,
87... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_method_pass_nonpod_by_up() {
let cxx = indoc! {"
uint32_t Bob::get_bob(std::unique_ptr<Anna>) const {
return a;
}
Anna give_anna() {
Anna a;
a.a = 10;
return a;
}
"};
let hdr = indoc! {"
#include <cstdint>
#include <memory>
#include <string>
struct Anna {
uint32_t a;
std::string b;
};
Anna give_anna();
struct Bob {
public:
uint32_t a;
uint32_t b;
uint32_t get_bob(std::unique_ptr<Anna> z) const;
};
"};
let rs = quote! {
let a = ffi::give_anna();
let b = ffi::Bob { a: 12, b: 13 };
assert_eq!(b.get_bob(a), 12);
};
run_test(cxx, hdr, rs, &["give_anna"], &["Bob"]);
} | rust_cleaned_test_functions.jsonl/9774 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 504
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9032,
15464,
21637,
39073,
3710,
8237,
368,
341,
262,
1077,
272,
4146,
284,
1257,
509,
0,
314,
698,
286,
2622,
18,
17,
528,
14261,
486,
455,
880,
674,
5194,
486,
9587,
4348,
27,
56756,
9231,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_old_sigaction_flags() {
let _m = ::SIGNAL_MTX.lock().expect("Mutex got poisoned by another test");
extern "C" fn handler(_: ::libc::c_int) {}
let act = SigAction::new(
SigHandler::Handler(handler),
SaFlags::empty(),
SigSet::empty(),
);
let oact = unsafe { sigaction(SIGINT, &act) }.unwrap();
let _flags = oact.flags();
let oact = unsafe { sigaction(SIGINT, &act) }.unwrap();
let _flags = oact.flags();
} | rust_cleaned_test_functions.jsonl/32447 | {
"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,
21108,
29252,
1311,
14130,
368,
341,
262,
1077,
716,
76,
284,
3504,
50,
17754,
1245,
22867,
21003,
1005,
17119,
445,
38099,
2684,
70498,
553,
2441,
1273,
3071,
262,
15637,
330,
34,
1,
5168,
7013,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_path_ext_html() {
let t = PathHtml;
assert_eq!(t.render().unwrap(), "foo.html");
assert_eq!(PathHtml::EXTENSION, Some("html"));
} | rust_cleaned_test_functions.jsonl/133241 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 77
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2638,
9927,
9564,
368,
341,
262,
1077,
259,
284,
7933,
13591,
280,
262,
2060,
10714,
10297,
83,
8740,
1005,
15454,
1507,
330,
7975,
2564,
797,
262,
2060,
10714,
10297,
1820,
13591,
486,
5722,
2363... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_invalid_json() {
let json =
r#"<!doctype html><html lang="en"><meta charset=utf-8><title>shortest html5</title>"#;
let selectors = r#"."places"[0]."place name""#;
let value: String = apply_jql(json, selectors).unwrap_err().to_string();
assert_eq!(
"Invalid json: Error(\"expected value\", line: 1, column: 1)",
value
);
} | rust_cleaned_test_functions.jsonl/14756 | {
"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,
36551,
5374,
1470,
31433,
9455,
368,
341,
262,
1077,
2951,
4035,
286,
435,
55543,
13543,
50139,
5272,
1784,
1551,
8688,
428,
268,
3088,
5490,
11617,
22264,
12,
23,
1784,
2102,
29,
8676,
477,
5272,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_nan_eq() {
Python::with_gil(|py| {
let nan = py.eval("float('nan')", None, None).unwrap();
assert!(nan.compare(nan).is_err());
});
} | rust_cleaned_test_functions.jsonl/93719 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 108
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73936,
10714,
368,
341,
286,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
341,
310,
1077,
20021,
284,
4510,
31710,
445,
3649,
492,
18759,
863,
497,
2240,
11,
2240,
568,
15454,
543,
310,
2060,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_show() {
let mut set: TreeSet<int> = TreeSet::new();
let empty: TreeSet<int> = TreeSet::new();
set.insert(1);
set.insert(2);
let set_str = format!("{}", set);
assert!(set_str == "{1, 2}".to_string());
assert_eq!(format!("{}", empty), "{}".to_string());
} | rust_cleaned_test_functions.jsonl/66385 | {
"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,
15267,
368,
341,
286,
1077,
5206,
738,
25,
90427,
4159,
29,
284,
90427,
486,
931,
543,
286,
1077,
4287,
25,
90427,
4159,
29,
284,
90427,
486,
931,
1428,
286,
738,
7030,
7,
16,
317,
286,
738,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_stft_pad_truncate_rand_win_1() {
_test_stft(10, 7, Some(2), None, Some(7), PadMode::Truncate).unwrap();
} | rust_cleaned_test_functions.jsonl/104788 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 66
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
723,
30290,
3547,
26900,
33864,
25672,
62,
16,
368,
341,
262,
716,
1944,
1261,
723,
7,
16,
15,
11,
220,
22,
11,
4329,
7,
17,
701,
2240,
11,
4329,
7,
22,
701,
25299,
3636,
486,
1282,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_set_channels() {
let mut c1 = XyY::new(0.4, 0.3, 0.4);
c1.set_x(0.6);
assert_relative_eq!(c1.x(), 0.6);
assert_relative_eq!(c1.y(), 0.20);
assert_relative_eq!(c1.z(), 0.20);
assert_relative_eq!(c1.Y(), 0.4);
c1.set_z(0.5);
assert_relative_eq!(c1, XyY::new(0.375, 0.125, 0.4), epsilon = 1e-6);
let mut c2 = XyY::new(0.3, 0.3, 1.0);
c2.set_y(0.8);
assert_relative_eq!(c2.x(), 0.2 * (3.0 / 7.0));
assert_relative_eq!(c2.y(), 0.8);
assert_relative_eq!(c2.z(), 0.2 * (4.0 / 7.0));
assert_relative_eq!(c2.Y(), 1.0);
c2.set_z(1.0);
assert_relative_eq!(c2.x(), 0.0);
assert_relative_eq!(c2.y(), 0.0);
assert_relative_eq!(c2.z(), 1.0);
c2.set_x(1.0);
assert_relative_eq!(c2.x(), 1.0);
assert_relative_eq!(c2.y(), 0.0);
assert_relative_eq!(c2.z(), 0.0);
assert_relative_eq!(c2.Y(), 1.0);
} | rust_cleaned_test_functions.jsonl/67701 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 605
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
19291,
368,
341,
286,
1077,
5206,
272,
16,
284,
1599,
88,
56,
486,
931,
7,
15,
13,
19,
11,
220,
15,
13,
18,
11,
220,
15,
13,
19,
317,
286,
272,
16,
980,
3212,
7,
15,
13,
21,
317,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_drain() {
let mut s: HashSet<_> = (1..100).collect();
// try this a bunch of times to make sure we don't screw up internal state.
for _ in 0..20 {
assert_eq!(s.len(), 99);
{
let mut last_i = 0;
let mut d = s.drain();
for (i, x) in d.by_ref().take(50).enumerate() {
last_i = i;
assert!(x != 0);
}
assert_eq!(last_i, 49);
}
for _ in &s { panic!("s should be empty!"); }
// reset to try again.
s.extend(1..100);
}
} | rust_cleaned_test_functions.jsonl/5407 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 397
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26680,
466,
368,
341,
286,
1077,
5206,
274,
25,
18931,
32399,
29,
284,
320,
16,
496,
16,
15,
15,
568,
17384,
1428,
286,
442,
1430,
419,
264,
15493,
315,
3039,
311,
1281,
2704,
582,
1513,
944,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_log_exec_wrap() {
let l = Log::<Operation>::default();
let o: [Operation; 1024] = unsafe {
let mut a: [Operation; 1024] = ::std::mem::MaybeUninit::zeroed().assume_init();
for i in &mut a[..] {
::std::ptr::write(i, Operation::Read);
}
a
};
let mut f = |op: Operation, i: usize| {
assert_eq!(op, Operation::Read);
assert_eq!(i, 1);
};
l.append(&o, 1, |_o: Operation, _i: usize| {}); // Required for GC to work correctly.
l.next.store(2, Ordering::SeqCst);
l.head.store(2 * 8192, Ordering::SeqCst);
l.tail.store(l.size - 10, Ordering::SeqCst);
l.append(&o, 1, |_o: Operation, _i: usize| {});
l.ltails[0].store(l.size - 10, Ordering::SeqCst);
l.exec(1, &mut f);
assert_eq!(l.lmasks[0].get(), false);
assert_eq!(l.tail.load(Ordering::Relaxed), l.size + 1014);
} | rust_cleaned_test_functions.jsonl/101058 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 519
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5224,
18430,
38550,
368,
341,
286,
1077,
326,
284,
2835,
27638,
8432,
6831,
2258,
543,
286,
1077,
297,
25,
508,
8432,
26,
220,
16,
15,
17,
19,
60,
284,
19860,
341,
310,
1077,
5206,
264,
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... | 2 |
#[test]
fn test_enum_in_internally_tagged_enum() {
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type")]
enum Outer {
Inner(Inner),
}
#[derive(Debug, PartialEq, Serialize, Deserialize)]
enum Inner {
Unit,
Newtype(u8),
Tuple(u8, u8),
Struct { f: u8 },
}
assert_tokens(
&Outer::Inner(Inner::Unit),
&[
Token::Map { len: Some(2) },
Token::Str("type"),
Token::Str("Inner"),
Token::Str("Unit"),
Token::Unit,
Token::MapEnd,
],
);
assert_tokens(
&Outer::Inner(Inner::Newtype(1)),
&[
Token::Map { len: Some(2) },
Token::Str("type"),
Token::Str("Inner"),
Token::Str("Newtype"),
Token::U8(1),
Token::MapEnd,
],
);
assert_tokens(
&Outer::Inner(Inner::Tuple(1, 1)),
&[
Token::Map { len: Some(2) },
Token::Str("type"),
Token::Str("Inner"),
Token::Str("Tuple"),
Token::TupleStruct {
name: "Tuple",
len: 2,
},
Token::U8(1),
Token::U8(1),
Token::TupleStructEnd,
Token::MapEnd,
],
);
assert_tokens(
&Outer::Inner(Inner::Struct { f: 1 }),
&[
Token::Map { len: Some(2) },
Token::Str("type"),
Token::Str("Inner"),
Token::Str("Struct"),
Token::Struct {
name: "Struct",
len: 1,
},
Token::Str("f"),
Token::U8(1),
Token::StructEnd,
Token::MapEnd,
],
);
} | rust_cleaned_test_functions.jsonl/56442 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1081
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31054,
1243,
4042,
932,
745,
9372,
3556,
31054,
368,
341,
262,
11506,
27098,
42618,
11,
55039,
11,
39900,
11,
48440,
5563,
262,
11506,
47024,
19343,
284,
330,
1313,
5422,
262,
7618,
55197,
341,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_captures_stores_match_offset() {
let reg = Regex::new(r"\d+\.(\d+)").unwrap();
let captures = reg.captures("100 - 3.1415 / 2.0").unwrap();
assert_eq!(6, captures.offset());
let all_caps = reg.captures_iter("1 - 3234.3 * 123.2 - 100")
.map(|cap| cap.offset())
.collect::<Vec<_>>();
assert_eq!(vec![4, 13], all_caps);
} | rust_cleaned_test_functions.jsonl/123810 | {
"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,
666,
2689,
1413,
1261,
4589,
10708,
6917,
368,
341,
286,
1077,
1217,
284,
26146,
486,
931,
2601,
11934,
67,
10,
18831,
11520,
67,
36197,
1827,
15454,
543,
286,
1077,
40155,
284,
1217,
520,
2689,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_process_sync_request() {
// Create a coordinator for a full node
let mut full_node_coordinator = test_utils::create_full_node_coordinator();
// Verify that fullnodes can't process sync requests
let (sync_request, _) = create_sync_notification_at_version(0);
let process_result = block_on(full_node_coordinator.process_sync_request(sync_request));
assert_matches!(process_result, Err(Error::FullNodeSyncRequest));
// Create a coordinator for a validator node
let mut validator_coordinator = test_utils::create_validator_coordinator();
// Perform sync request for version that matches initial waypoint version
let (sync_request, mut callback_receiver) = create_sync_notification_at_version(0);
assert_ok!(block_on(
validator_coordinator.process_sync_request(sync_request)
));
match callback_receiver.try_recv() {
Ok(Some(notification_result)) => assert_ok!(notification_result.result),
result => panic!("Expected okay but got: {:?}", result),
};
// Create validator coordinator with waypoint higher than 0
let waypoint_version = 10;
let waypoint_ledger_info = create_ledger_info_at_version(waypoint_version);
let waypoint = Waypoint::new_any(waypoint_ledger_info.ledger_info());
let mut validator_coordinator =
create_coordinator_with_config_and_waypoint(NodeConfig::default(), waypoint);
// Verify coordinator won't process sync requests as it's not yet initialized
let (sync_request, mut callback_receiver) = create_sync_notification_at_version(10);
let process_result = block_on(validator_coordinator.process_sync_request(sync_request));
assert_matches!(process_result, Err(Error::UninitializedError(_)));
let callback_result = callback_receiver.try_recv();
assert_err!(callback_result);
// modifications in unit tests.
} | rust_cleaned_test_functions.jsonl/84042 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 757
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
23008,
7893,
368,
341,
286,
442,
4230,
264,
30284,
369,
264,
2480,
2436,
198,
286,
1077,
5206,
2480,
5084,
11393,
17442,
284,
1273,
17309,
486,
3182,
16372,
5084,
11393,
17442,
1428,
286,
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_mv_multiple_files() {
let (at, mut ucmd) = at_and_ucmd!();
let target_dir = "test_mv_multiple_files_dir";
let file_a = "test_mv_multiple_file_a";
let file_b = "test_mv_multiple_file_b";
at.mkdir(target_dir);
at.touch(file_a);
at.touch(file_b);
ucmd.arg(file_a)
.arg(file_b)
.arg(target_dir)
.succeeds()
.no_stderr();
assert!(at.file_exists(&format!("{}/{}", target_dir, file_a)));
assert!(at.file_exists(&format!("{}/{}", target_dir, file_b)));
} | rust_cleaned_test_functions.jsonl/41608 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 281
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73187,
45233,
10931,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
1077,
2169,
4334,
284,
330,
1944,
73187,
45233,
10931,
4334,
876,
262,
1077,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_exclude_kind() {
let path = PathBuf::from("src/tools/cargotest");
let exclude = TaskPath::parse("test::src/tools/cargotest");
assert_eq!(exclude, TaskPath { kind: Some(Kind::Test), path: path.clone() });
let mut config = configure("test", &["A"], &["A"]);
assert!(run_build(&[path.clone()], config.clone()).contains::<test::Cargotest>());
// Ensure tests for cargotest are skipped.
config.exclude = vec![exclude.clone()];
assert!(!run_build(&[path.clone()], config).contains::<test::Cargotest>());
// Ensure builds for cargotest are not skipped.
let mut config = configure("build", &["A"], &["A"]);
config.exclude = vec![exclude];
assert!(run_build(&[path], config).contains::<tool::CargoTest>());
} | rust_cleaned_test_functions.jsonl/104202 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 301
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88668,
33162,
368,
341,
262,
1077,
1815,
284,
7933,
15064,
486,
1499,
445,
3548,
45714,
2899,
858,
354,
477,
797,
262,
1077,
21687,
284,
5430,
1820,
486,
6400,
445,
1944,
486,
3548,
45714,
2899,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_bool_true() -> IonResult<()> {
let mut cursor = ion_cursor_for(&[0x11]);
assert_eq!(cursor.next()?, Some(Value(IonType::Boolean, false)));
assert_eq!(cursor.read_bool()?, Some(true));
Ok(())
} | rust_cleaned_test_functions.jsonl/82732 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
22159,
16082,
368,
1464,
44805,
2077,
71698,
341,
286,
1077,
5206,
8128,
284,
27672,
28601,
5478,
2099,
58,
15,
87,
16,
16,
2558,
286,
2060,
10714,
10297,
17437,
4529,
368,
12622,
4329,
2534... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_mutable_pointer() {
let mut x = 1i8;
let ptr = &mut x as *mut _;
assert_size_of_val_eq!(ptr, POINTER_BYTE_SIZE);
} | rust_cleaned_test_functions.jsonl/74458 | {
"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,
717,
5922,
21425,
368,
341,
286,
1077,
5206,
856,
284,
220,
16,
72,
23,
280,
286,
1077,
10087,
284,
609,
6984,
856,
438,
353,
6984,
716,
280,
286,
2060,
2368,
3575,
6189,
10714,
10297,
3505,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_invalid_statistics_interval() {
let mut runner = Runner::new();
let mut query = runner.proxy.start_logging(
"test",
&mut vec![&mut Metric::Power(Power {
sampling_interval_ms: 500,
statistics_args: Some(Box::new(StatisticsArgs { statistics_interval_ms: 500 })),
})]
.into_iter(),
300,
false,
false,
);
// Check `InvalidStatisticsInterval` is returned when statistics is enabled and
// `statistics_interval_ms` is larger than `duration_ms`.
assert_matches!(
runner.executor.run_until_stalled(&mut query),
Poll::Ready(Ok(Err(fmetrics::MetricsLoggerError::InvalidStatisticsInterval)))
);
let mut query = runner.proxy.start_logging(
"test",
&mut vec![&mut Metric::Power(Power {
sampling_interval_ms: 600,
statistics_args: Some(Box::new(StatisticsArgs { statistics_interval_ms: 500 })),
})]
.into_iter(),
800,
false,
false,
);
// Check `InvalidStatisticsInterval` is returned when statistics is enabled and
// `statistics_interval_ms` is less than `sampling_interval_ms`.
assert_matches!(
runner.executor.run_until_stalled(&mut query),
Poll::Ready(Ok(Err(fmetrics::MetricsLoggerError::InvalidStatisticsInterval)))
);
let mut query = runner.proxy.start_logging(
"test",
&mut vec![&mut Metric::Power(Power {
sampling_interval_ms: 200,
statistics_args: Some(Box::new(StatisticsArgs { statistics_interval_ms: 200 })),
})]
.into_iter(),
800,
false,
true,
);
// Check `InvalidStatisticsInterval` is returned when statistics is enabled and
// `statistics_interval_ms` is less than MIN_INTERVAL_FOR_SYSLOG_MS.
assert_matches!(
runner.executor.run_until_stalled(&mut query),
Poll::Ready(Ok(Err(fmetrics::MetricsLoggerError::InvalidStatisticsInterval)))
);
} | rust_cleaned_test_functions.jsonl/66706 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1086
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
49569,
20541,
368,
341,
286,
1077,
5206,
22259,
284,
44946,
486,
931,
1428,
286,
1077,
5206,
3239,
284,
22259,
41103,
4962,
59982,
1006,
310,
330,
1944,
756,
310,
609,
6984,
7486,
20703,
5,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_education_and_occupation_facts() {
let person = Person::builder()
.fact(
Fact::builder(FactType::Apprenticeship)
.date(Date::new(Some("..."), None))
.place(PlaceReference::builder().original("...").build())
.build(),
)
.fact(
Fact::builder(FactType::Education)
.date(Date::new(Some("..."), None))
.place(PlaceReference::builder().original("...").build())
.build(),
)
.fact(
Fact::builder(FactType::Occupation)
.date(Date::new(Some("..."), None))
.place(PlaceReference::builder().original("...").build())
.build(),
)
.fact(
Fact::builder(FactType::Retirement)
.date(Date::new(Some("..."), None))
.place(PlaceReference::builder().original("...").build())
.build(),
)
.build();
let gx = Gedcomx::builder().person(person).build();
common::assert_matching_json(&gx, "education");
common::assert_matching_xml(&gx, "education");
} | rust_cleaned_test_functions.jsonl/106991 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 587
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
36738,
8378,
62,
58262,
761,
11359,
368,
341,
262,
1077,
1697,
284,
7357,
486,
17850,
741,
286,
659,
33110,
1006,
310,
36712,
486,
17850,
7832,
531,
929,
486,
2164,
7976,
1216,
2151,
340,
39... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extract_with_no_services_infers_service() {
// Create a single test package with a single unknown service dependency
let sb = create_test_sandbox(vec![String::from("fuchsia.test.foo.bar")]);
let cms = create_test_cmx_map(vec![(String::from("meta/baz.cmx"), sb)]);
let pkg = create_test_package_with_cms(String::from("fuchsia-pkg://fuchsia.com/foo"), cms);
let served = vec![pkg];
let services = HashMap::new();
let package_getter: Box<dyn PackageGetter> = Box::new(MockPackageGetter::new());
let response = PackageDataCollector::extract(&package_getter, served, services).unwrap();
assert_eq!(2, response.components.len());
assert_eq!(1, response.manifests.len());
assert_eq!(1, response.routes.len());
assert_eq!(1, response.packages.len());
assert_eq!(None, response.zbi);
assert_eq!((1, 1), count_defined_inferred(response.components));
} | rust_cleaned_test_functions.jsonl/19459 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 412
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
6615,
6536,
39846,
26051,
388,
12267,
368,
341,
286,
442,
4230,
264,
3175,
1273,
6328,
448,
264,
3175,
9788,
2473,
24036,
198,
286,
1077,
7898,
284,
1855,
4452,
643,
31536,
25592,
20703,
70... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_case_25() {
let key = "1a8ea7099a74bafa3375b210653a0d2f40b15afd725cf5065066be1cb803dc15";
let nonce = "8865ed8d7cca72dcf2b7c6b5d0d045bf";
let expected_output =
"f10cce296197a056bedbee166183ad6aaa56bdb21c3459296ca54c0bb78317d1";
hchacha_test_runner(key, nonce, expected_output);
} | rust_cleaned_test_functions.jsonl/44687 | {
"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,
19096,
62,
17,
20,
368,
341,
310,
1077,
1376,
284,
330,
16,
64,
23,
12508,
22,
15,
24,
24,
64,
22,
19,
65,
35834,
18,
18,
22,
20,
65,
17,
16,
15,
21,
20,
18,
64,
15,
67,
17,
69,
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_chmod_octal() {
let tests = vec![
TestCase {
args: vec!["0700", TEST_FILE],
before: 0o100000,
after: 0o100700,
},
TestCase {
args: vec!["0070", TEST_FILE],
before: 0o100000,
after: 0o100070,
},
TestCase {
args: vec!["0007", TEST_FILE],
before: 0o100000,
after: 0o100007,
},
TestCase {
args: vec!["-0700", TEST_FILE],
before: 0o100700,
after: 0o100000,
},
TestCase {
args: vec!["-0070", TEST_FILE],
before: 0o100060,
after: 0o100000,
},
TestCase {
args: vec!["-0007", TEST_FILE],
before: 0o100001,
after: 0o100000,
},
TestCase {
args: vec!["+0100", TEST_FILE],
before: 0o100600,
after: 0o100700,
},
TestCase {
args: vec!["+0020", TEST_FILE],
before: 0o100050,
after: 0o100070,
},
TestCase {
args: vec!["+0004", TEST_FILE],
before: 0o100003,
after: 0o100007,
},
];
run_tests(tests);
} | rust_cleaned_test_functions.jsonl/127205 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 791
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4138,
2593,
70135,
278,
368,
341,
262,
1077,
7032,
284,
7486,
90515,
286,
30573,
341,
310,
2827,
25,
7486,
0,
1183,
15,
22,
15,
15,
497,
13602,
8087,
1259,
310,
1573,
25,
220,
15,
78,
16,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_p2sh_address_58() {
let addr = Address {
network: Bitcoin,
payload: Payload::ScriptHash(hex_scripthash!("162c5ea71c0b23f5b9022ef047c4a86470a5b070")),
};
assert_eq!(
addr.script_pubkey(),
hex_script!("a914162c5ea71c0b23f5b9022ef047c4a86470a5b07087")
);
assert_eq!(&addr.to_string(), "33iFwdLuRpW1uK1RTRqsoi8rR4NpDzk66k");
assert_eq!(addr.address_type(), Some(AddressType::P2sh));
roundtrips(&addr);
} | rust_cleaned_test_functions.jsonl/59114 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 300
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
17,
927,
6744,
62,
20,
23,
368,
341,
286,
1077,
10789,
284,
9177,
341,
310,
3922,
25,
13127,
345,
310,
7729,
25,
52916,
486,
5910,
6370,
44660,
643,
740,
8490,
988,
17223,
16,
21,
17,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_downwards_multiple_path_argument() {
let tmp = tmptree! {
justfile: "default:\n\techo bad",
a: {
b: {
justfile: "default:\n\techo ok",
},
},
};
let path = tmp.path();
search_test(&path, &["a/b/"]);
search_test(&path, &["a/b/default"]);
search_test(&path, &["./a/b/"]);
search_test(&path, &["./a/b/default"]);
search_test(&path, &["./a/b/"]);
search_test(&path, &["./a/b/default"]);
} | rust_cleaned_test_functions.jsonl/13380 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 250
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13998,
4014,
45233,
2638,
9025,
368,
341,
262,
1077,
4174,
284,
17333,
417,
765,
0,
341,
414,
1101,
1192,
25,
330,
2258,
7190,
77,
59,
665,
958,
3873,
756,
414,
264,
25,
341,
286,
293,
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_eof_closes() {
let pool = mocked!();
let mut stream = pool.connect("127.0.0.1", 3000, "http").unwrap();
assert_eq!(stream.read(&mut [0]).unwrap(), 0);
drop(stream);
let locked = pool.inner.lock().unwrap();
assert_eq!(locked.conns.len(), 0);
} | rust_cleaned_test_functions.jsonl/53080 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 152
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
90792,
666,
49341,
368,
341,
286,
1077,
7314,
284,
46149,
0,
1428,
286,
1077,
5206,
4269,
284,
7314,
10800,
445,
16,
17,
22,
13,
15,
13,
15,
13,
16,
497,
220,
18,
15,
15,
15,
11,
330,
1254... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_numbers_large() {
assert_same_number("4294967295", 4294967295.0);
assert_same_number("4294967296", 4294967296.0);
assert_same_number("4294967297", 4294967297.0);
assert_same_number("9007199254740991", 9007199254740991.0);
assert_same_number("9007199254740992", 9007199254740992.0);
assert_same_number("9007199254740993", 9007199254740992.0);
assert_same_number("18446744073709553664", 18446744073709552000.0);
assert_same_number("18446744073709553665", 18446744073709556000.0);
assert_same_number("0b11111111111111111111111111111111", 4294967295.0);
assert_same_number("0b100000000000000000000000000000000", 4294967296.0);
assert_same_number("0b100000000000000000000000000000001", 4294967297.0);
assert_same_number(
"0b11111111111111111111111111111111111111111111111111111",
9007199254740991.0,
);
assert_not_implemented("0b100000000000000000000000000000000000000000000000000000");
assert_same_number("0o77777777777777777", 2251799813685247.0);
assert_not_implemented("0o100000000000000000");
assert_same_number("0xfffffffffffff", 4503599627370495.0);
assert_not_implemented("0x10000000000000");
assert_same_number("4.9406564584124654417656879286822e-324", 5e-324);
} | rust_cleaned_test_functions.jsonl/7964 | {
"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,
32964,
45228,
368,
341,
262,
2060,
33574,
5500,
445,
19,
17,
24,
19,
24,
21,
22,
17,
24,
20,
497,
220,
19,
17,
24,
19,
24,
21,
22,
17,
24,
20,
13,
15,
317,
262,
2060,
33574,
5500,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serialisation() {
use randombytes::randombytes;
use test_utils::round_trip;
for i in 0..256usize {
let (pk, sk) = gen_keypair();
let m = randombytes(i);
let sig = sign_detached(&m, &sk);
round_trip(pk);
round_trip(sk);
round_trip(sig);
}
} | rust_cleaned_test_functions.jsonl/11400 | {
"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,
25602,
7923,
368,
341,
286,
990,
4194,
9651,
486,
11463,
9651,
280,
286,
990,
1273,
17309,
486,
1049,
63883,
280,
286,
369,
600,
304,
220,
15,
496,
17,
20,
21,
51878,
341,
310,
1077,
320,
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... | 2 |
#[test]
fn test_gjk_time_of_impact_3d() {
let left = Cuboid::new(10., 11., 10.);
let left_start_transform = transform_3d(0., 0., 0., 0.);
let left_end_transform = transform_3d(30., 0., 0., 0.);
let right = Cuboid::new(10., 15., 10.);
let right_transform = transform_3d(15., 0., 0., 0.);
let gjk = GJK3::new();
let contact = gjk.intersection_time_of_impact(
&left,
&left_start_transform..&left_end_transform,
&right,
&right_transform..&right_transform,
).unwrap();
assert_ulps_eq!(0.1666667, contact.time_of_impact);
assert_eq!(Vector3::new(-1., 0., 0.), contact.normal);
assert_eq!(0., contact.penetration_depth);
assert_eq!(Point3::new(10., 0., 0.), contact.contact_point);
assert!(gjk.intersection_time_of_impact(
&left,
&left_start_transform..&left_start_transform,
&right,
&right_transform..&right_transform
).is_none());
} | rust_cleaned_test_functions.jsonl/90909 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 523
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1889,
41808,
3009,
3575,
36788,
531,
62,
18,
67,
368,
341,
286,
1077,
2115,
284,
18030,
588,
486,
931,
7,
16,
15,
2572,
220,
16,
16,
2572,
220,
16,
15,
58957,
286,
1077,
2115,
4906,
18449,
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_force_checkout_add_tree_with_deleted_blob() -> BitResult<()> {
BitRepo::with_minimal_repo(|repo| {
let target = commit! {
foo {
bar < "bar contents"
}
};
rm!(repo: "foo");
mkdir!(repo: "foo");
touch!(repo: "foo/bar" < "bar contents");
bit_checkout!(repo: --force &rev!(target))?;
assert_eq!(cat!(repo: "foo/bar"), "bar contents");
Ok(())
})
} | rust_cleaned_test_functions.jsonl/62975 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 263
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40739,
68186,
2891,
11663,
6615,
39418,
45908,
368,
1464,
6495,
2077,
71698,
341,
262,
6495,
25243,
486,
4197,
7260,
2861,
37784,
22428,
23476,
91,
341,
286,
1077,
2169,
284,
5266,
0,
341,
310,
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_bytes_to_state() {
let bytes = [0x30u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8];
let state = bytes_to_state(&bytes[..]);
let expected = 0b0011000000000000000000000000000000000000000000000000000000000000u64;
assert_eq!(expected, state);
} | rust_cleaned_test_functions.jsonl/34949 | {
"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,
12524,
2346,
4387,
368,
341,
286,
1077,
5820,
284,
508,
15,
87,
18,
15,
84,
23,
11,
220,
15,
84,
23,
11,
220,
15,
84,
23,
11,
220,
15,
84,
23,
11,
220,
15,
84,
23,
11,
220,
15,
84,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_handle_multipart_images_post() {
let mut tmp_path = std::env::temp_dir();
tmp_path.push("test-multipart-ghdfhfgh4");
let _ = std::fs::remove_dir_all(&tmp_path);
std::fs::create_dir_all(&tmp_path).unwrap();
let http_rq = mock::multipart_formdata_request();
super::handle_multipart_images_post(&http_rq, &tmp_path.to_string_lossy());
let mut dir_list = std::fs::read_dir(&tmp_path)
.unwrap()
.map(|x| x.unwrap().file_name())
.collect::<Vec<_>>();
assert_eq!(dir_list.len(), 2);
dir_list[..].sort();
assert_eq!(dir_list[0].to_str(), Some("file-from-name.png"));
assert_eq!(dir_list[1].to_str(), Some("sample.jpg"));
std::fs::remove_dir_all(&tmp_path).unwrap();
} | rust_cleaned_test_functions.jsonl/132614 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 408
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10630,
717,
18204,
13283,
6333,
368,
341,
286,
1077,
5206,
4174,
2638,
284,
1460,
486,
3160,
486,
3888,
4334,
543,
286,
4174,
2638,
2552,
445,
1944,
1448,
18204,
12,
866,
2940,
44754,
866,
19,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ICMPGE_success() {
let frame = Frame::new(2, 2);
let Frame {
operand_stack,
local_vars,
} = frame;
let operand_stack = operand_stack.push_int(1);
let operand_stack = operand_stack.push_int(1);
let frame = Frame {
operand_stack,
local_vars,
};
let (ExecuteResult { frame: _, offset }, _) = IFNE(CodeReader::new(&vec![1, 1]), frame);
assert_eq!(offset, 257);
} | rust_cleaned_test_functions.jsonl/125607 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 266
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22960,
5781,
10777,
18632,
368,
341,
286,
1077,
4034,
284,
16321,
486,
931,
7,
17,
11,
220,
17,
317,
286,
1077,
16321,
341,
310,
27213,
15528,
345,
310,
2205,
11168,
345,
286,
335,
284,
4034,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_option_value() {
let (rem, value) = parse_option_value("value;").unwrap();
assert_eq!(rem, "");
assert_eq!(value, "value");
let (rem, value) = parse_option_value(" value;").unwrap();
assert_eq!(rem, "");
assert_eq!(value, "value");
let (rem, value) = parse_option_value(" value ;").unwrap();
assert_eq!(rem, "");
assert_eq!(value, "value ");
let (rem, value) = parse_option_value(" value ;next option").unwrap();
assert_eq!(rem, "next option");
assert_eq!(value, "value ");
} | rust_cleaned_test_functions.jsonl/22890 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 286
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
9672,
3142,
368,
341,
286,
1077,
320,
1826,
11,
897,
8,
284,
4715,
9672,
3142,
445,
957,
26,
1827,
15454,
543,
286,
2060,
10714,
10297,
1826,
11,
14498,
286,
2060,
10714,
10297,
957,
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_stdin_skip_5_chars() {
new_ucmd!()
.args(&["-s5"]).pipe_in_fixture(SKIP_CHARS)
.run().stdout_is_fixture("skip-5-chars.expected");
} | rust_cleaned_test_functions.jsonl/23098 | {
"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,
15656,
258,
44830,
62,
20,
37418,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
12,
82,
20,
45014,
13768,
1243,
74409,
72504,
3298,
82319,
340,
286,
659,
6108,
1005,
36358... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_bank_parent_duplicate_signature() {
let (genesis_block, mint_keypair) = GenesisBlock::new(2);
let key1 = Keypair::new();
let parent = Arc::new(Bank::new(&genesis_block));
let tx =
system_transaction::transfer(&mint_keypair, &key1.pubkey(), 1, genesis_block.hash(), 0);
assert_eq!(parent.process_transaction(&tx), Ok(()));
let bank = new_from_parent(&parent);
assert_eq!(
bank.process_transaction(&tx),
Err(TransactionError::DuplicateSignature)
);
} | rust_cleaned_test_functions.jsonl/41898 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 263
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35733,
15960,
70434,
39859,
368,
341,
286,
1077,
320,
77894,
7113,
11,
28337,
3097,
12670,
8,
284,
40788,
4713,
486,
931,
7,
17,
317,
286,
1077,
1376,
16,
284,
6569,
1082,
1310,
486,
931,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_resolve_vars_typo() {
let d = Dockerfile::parse(indoc!(r#"
ARG image="alpine:3.12"
FROM $foo
"#)).unwrap();
let from: &FromInstruction = d.instructions
.get(1).unwrap()
.try_into().unwrap();
assert_eq!(
from.image_parsed.resolve_vars(&d),
None
);
} | rust_cleaned_test_functions.jsonl/17937 | {
"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,
77291,
11168,
42111,
78,
368,
341,
1066,
262,
1077,
294,
284,
40549,
1192,
486,
6400,
23884,
509,
10297,
81,
2,
698,
414,
32746,
2168,
428,
278,
38038,
25,
18,
13,
16,
17,
698,
414,
4295,
400,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_basics() {
// Test Actions and Standard procedures
test_enum_u8_exhaustive!(AssignmentAction; AssignmentAction::Validate => 0);
test_enum_u8_exhaustive!(TransitionAction;
TransitionAction::Validate => 0,
TransitionAction::GenerateBlank => 1
);
test_enum_u8_exhaustive!(StandardProcedure;
StandardProcedure::NoInflationBySum => 0x01,
StandardProcedure::FungibleInflation => 0x02,
StandardProcedure::NonfungibleInflation => 0x03,
StandardProcedure::IdentityTransfer => 0x04,
StandardProcedure::ProofOfBurn => 0x10,
StandardProcedure::ProofOfReserve => 0x11,
StandardProcedure::RightsSplit => 0x20
);
// Test Procedures
assert_eq!(
vec![0xFF, 0x01],
strict_serialize(&Procedure::Embedded(
StandardProcedure::NoInflationBySum
))
.unwrap()
);
assert_eq!(
vec![0xFF, 0x2],
strict_serialize(&Procedure::Embedded(
StandardProcedure::FungibleInflation
))
.unwrap()
);
assert_eq!(
vec![0xFF, 0x10],
strict_serialize(&Procedure::Embedded(
StandardProcedure::ProofOfBurn
))
.unwrap()
);
assert_eq!(
vec![0x00, 0x58, 0x00, 0x00, 0x00],
strict_serialize(&Procedure::Simplicity {
abi_table_index: 88
})
.unwrap()
);
// Test Transition and Assignment ABI
let mut trans_abi = TransitionAbi::new();
trans_abi.insert(
TransitionAction::Validate,
Procedure::Embedded(StandardProcedure::NoInflationBySum),
);
assert_eq!(
vec![0x01, 0x00, 0x00, 0xff, 0x01],
strict_serialize(&trans_abi).unwrap()
);
let mut assignment_abi = AssignmentAbi::new();
assignment_abi.insert(
AssignmentAction::Validate,
Procedure::Simplicity {
abi_table_index: 45,
},
);
assert_eq!(
vec![0x01, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x00, 0x00],
strict_serialize(&assignment_abi).unwrap()
);
} | rust_cleaned_test_functions.jsonl/49992 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1535
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
67981,
368,
341,
310,
442,
3393,
26722,
323,
11766,
15966,
198,
310,
1273,
31054,
7300,
23,
2702,
15074,
533,
10297,
41613,
2512,
26,
34427,
2512,
486,
17926,
589,
220,
15,
317,
310,
1273,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hitbox_updates() {
let mut collider = Collider::<TestHbProfile>::new(4.0, 0.25);
let mut hitbox = Shape::square(2.0).place(v2(-10.0, 0.0)).still();
hitbox.vel.value = v2(1.0, 0.0);
let overlaps = collider.add_hitbox(0.into(), hitbox);
assert!(overlaps.is_empty());
let mut hitbox = Shape::circle(2.0).place(v2(10.0, 0.0)).still();
hitbox.vel.value = v2(1.0, 0.0);
let overlaps = collider.add_hitbox(1.into(), hitbox);
assert!(overlaps.is_empty());
advance(&mut collider, 11.0);
let mut hitbox = collider.get_hitbox(0);
assert_eq!(hitbox.value, Shape::square(2.0).place(v2(1.0, 0.0)));
assert_eq!(hitbox.vel.value, v2(1.0, 0.0));
assert_eq!(hitbox.vel.resize, v2(0.0, 0.0));
assert_eq!(hitbox.vel.end_time, f64::INFINITY);
hitbox.value.pos = v2(0.0, 2.0);
hitbox.vel.value = v2(0.0, -1.0);
let overlaps = collider.remove_hitbox(0);
assert_eq!(overlaps, vec![]);
let overlaps = collider.add_hitbox(0.into(), hitbox);
assert_eq!(overlaps, vec![]);
advance(&mut collider, 14.0);
let mut hitbox = collider.get_hitbox(1);
assert_eq!(hitbox.value, Shape::circle(2.0).place(v2(24.0, 0.0)));
assert_eq!(hitbox.vel.value, v2(1.0, 0.0));
assert_eq!(hitbox.vel.resize, v2(0.0, 0.0));
assert_eq!(hitbox.vel.end_time, f64::INFINITY);
hitbox.value.pos = v2(0.0, -8.0);
hitbox.vel.value = v2(0.0, 0.0);
let overlaps = collider.remove_hitbox(1);
assert_eq!(overlaps, vec![]);
let overlaps = collider.add_hitbox(1.into(), hitbox);
assert_eq!(overlaps, vec![]);
advance_to_event(&mut collider, 19.0);
assert_eq!(
collider.next(),
Some((HbEvent::Collide, 0.into(), 1.into()))
);
let mut hitbox = collider.get_hitbox(0);
assert_eq!(hitbox.value, Shape::square(2.0).place(v2(0.0, -6.0)));
assert_eq!(hitbox.vel.value, v2(0.0, -1.0));
assert_eq!(hitbox.vel.resize, v2(0.0, 0.0));
assert_eq!(hitbox.vel.end_time, f64::INFINITY);
hitbox.vel.value = v2(0.0, 0.0);
collider.set_hitbox_vel(0, hitbox.vel);
let mut hitbox = collider.get_hitbox(1);
assert_eq!(hitbox.value, Shape::circle(2.0).place(v2(0.0, -8.0)));
assert_eq!(hitbox.vel.value, v2(0.0, 0.0));
assert_eq!(hitbox.vel.resize, v2(0.0, 0.0));
assert_eq!(hitbox.vel.end_time, f64::INFINITY);
hitbox.vel.value = v2(0.0, 2.0);
collider.set_hitbox_vel(1, hitbox.vel);
let hitbox = Shape::rect(v2(2.0, 20.0)).place(v2(0.0, 0.0)).still();
assert_eq!(
sort(collider.add_hitbox(2.into(), hitbox)),
vec![0.into(), 1.into()]
);
advance_to_event(&mut collider, 21.125);
assert_eq!(
collider.next(),
Some((HbEvent::Separate, 0.into(), 1.into()))
);
advance(&mut collider, 26.125);
let overlaps = collider.remove_hitbox(1);
assert_eq!(overlaps, vec![2.into()]);
advance(&mut collider, 37.125);
} | rust_cleaned_test_functions.jsonl/36381 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1438
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37697,
2011,
57829,
368,
341,
262,
1077,
5206,
65544,
284,
73821,
27638,
2271,
39,
65,
8526,
6831,
931,
7,
19,
13,
15,
11,
220,
15,
13,
17,
20,
626,
262,
1077,
5206,
4201,
2011,
284,
22526,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sum_matrix() {
assert_eq!(A + B + C + D, [A, B, C, D].iter().sum());
assert_eq!(A + B + C + D, [A, B, C, D].iter().cloned().sum());
} | rust_cleaned_test_functions.jsonl/105446 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10160,
10193,
368,
341,
286,
2060,
10714,
10297,
32,
488,
425,
488,
356,
488,
422,
11,
508,
32,
11,
425,
11,
356,
11,
422,
936,
2015,
1005,
1242,
1423,
286,
2060,
10714,
10297,
32,
488,
425,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
let src = sgx_key_id_t {
id: [
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31, 32,
],
};
let keyid: KeyId = src.into();
let serialized = serialize(&keyid).expect("Could not serialize cpu_keyid");
let keyid2: KeyId = deserialize(&serialized).expect("Could not deserialize cpu_keyid");
assert_eq!(keyid, keyid2);
} | rust_cleaned_test_functions.jsonl/104359 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 282
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75861,
450,
368,
341,
286,
1077,
2286,
284,
30673,
87,
3097,
842,
528,
341,
310,
877,
25,
2278,
394,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,
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_auto_import_split_different() {
check_assist(
add_import,
"
use std::fmt;
impl std::io<|> for Foo {
}
",
"
use std::{ io, fmt};
impl io<|> for Foo {
}
",
);
} | rust_cleaned_test_functions.jsonl/39951 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27740,
18434,
17052,
82741,
368,
341,
286,
1779,
12083,
380,
1006,
310,
912,
18434,
345,
310,
6228,
810,
1460,
486,
12501,
401,
6383,
1460,
486,
815,
27,
91,
29,
369,
33428,
341,
532,
262,
21796... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_total_ord_i32() {
let c = &[1, 2, 3];
assert_order!(Greater, &[1, 2, 3, 4][..], &c[..]);
let c = &[1, 2, 3, 4];
assert_order!(Less, &[1, 2, 3][..], &c[..]);
let c = &[1, 2, 3, 6];
assert_order!(Equal, &[1, 2, 3, 6][..], &c[..]);
let c = &[1, 2, 3, 4, 5, 6];
assert_order!(Less, &[1, 2, 3, 4, 5, 5, 5, 5][..], &c[..]);
let c = &[1, 2, 3, 4];
assert_order!(Greater, &[2, 2][..], &c[..]);
} | rust_cleaned_test_functions.jsonl/12882 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 256
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10784,
67324,
5318,
18,
17,
368,
341,
262,
1077,
272,
284,
44590,
16,
11,
220,
17,
11,
220,
18,
935,
262,
2060,
7869,
10297,
41366,
11,
44590,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
14... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_str_radix_float() {
let x1 : Option<f64> = from_str_radix("-123.456", 10).ok();
assert_eq!(x1, Some(-123.456));
let x2 : Option<f32> = from_str_radix("123.456", 10).ok();
assert_eq!(x2, Some(123.456));
let x3 : Option<f32> = from_str_radix("-0.0", 10).ok();
assert_eq!(x3, Some(-0.0));
let x4 : Option<f32> = from_str_radix("0.0", 10).ok();
assert_eq!(x4, Some(0.0));
let x4 : Option<f32> = from_str_radix("1.0", 10).ok();
assert_eq!(x4, Some(1.0));
let x5 : Option<f32> = from_str_radix("-1.0", 10).ok();
assert_eq!(x5, Some(-1.0));
} | rust_cleaned_test_functions.jsonl/18404 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 362
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
2895,
39764,
941,
17586,
368,
341,
286,
1077,
856,
16,
549,
6959,
63895,
21,
19,
29,
284,
504,
2895,
39764,
941,
13645,
16,
17,
18,
13,
19,
20,
21,
497,
220,
16,
15,
568,
562,
543,
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_builder_should_return_one_number_of_game_playable_with_5_player() {
let t = TournamentBuilder::new()
.add("sylvain")
.add("sarah")
.add("mathieu")
.add("cedric")
.add("christian")
.finalize();
let ng = t.number_of_games_playable();
let np = t.number_of_player();
assert_eq!(1, ng);
assert_eq!(5, np);
} | rust_cleaned_test_functions.jsonl/109240 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 240
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28532,
43378,
12511,
11667,
5500,
3575,
18547,
22144,
480,
6615,
62,
20,
15524,
368,
341,
286,
1077,
259,
284,
18371,
3297,
486,
931,
741,
310,
659,
718,
445,
82,
14753,
466,
1138,
310,
659,
718... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_count_zero() {
let selector = StochasticSelector::new(0);
let population: Vec<Test> = (0..100).map(|i| Test { f: i }).collect();
assert!(selector.select(&population).is_err());
} | rust_cleaned_test_functions.jsonl/133829 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 102
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3180,
19359,
368,
341,
286,
1077,
9367,
284,
794,
65954,
5877,
486,
931,
7,
15,
317,
286,
1077,
7042,
25,
11312,
71273,
29,
284,
320,
15,
496,
16,
15,
15,
568,
2186,
22428,
72,
91,
3393,
314... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_contains_point() {
assert_eq!(true, RECT.contains_point(&Point::new(0.2, 0.4)));
assert_eq!(false, RECT.contains_point(&Point::new(0.2, 0.8)));
assert_eq!(false, RECT.contains_point(&Point::new(-0.1, 0.4)));
assert_eq!(false, RECT.contains_point(&Point::new(0.6, 0.1)));
assert_eq!(true, RECT.contains_point(&Point::new(RECT.x.lo, RECT.y.lo)));
assert_eq!(true, RECT.contains_point(&Point::new(RECT.x.hi, RECT.y.hi)));
} | rust_cleaned_test_functions.jsonl/94057 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 251
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
63598,
6085,
368,
341,
286,
2060,
10714,
10297,
1866,
11,
75803,
8786,
6085,
2099,
2609,
486,
931,
7,
15,
13,
17,
11,
220,
15,
13,
19,
4945,
286,
2060,
10714,
10297,
3849,
11,
75803,
8786,
608... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_mut_and_update() {
let mut cache = LruCache::new(2);
cache.put("apple", 1);
cache.put("banana", 3);
{
let v = cache.get_mut(&"apple").unwrap();
*v = 4;
}
assert_eq!(cache.len(), 2);
assert_opt_eq_mut(cache.get_mut(&"apple"), 4);
assert_opt_eq_mut(cache.get_mut(&"banana"), 3);
} | rust_cleaned_test_functions.jsonl/77934 | {
"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,
3062,
29523,
8378,
8882,
368,
341,
286,
1077,
5206,
6500,
284,
444,
2672,
8233,
486,
931,
7,
17,
626,
286,
6500,
3597,
445,
22377,
497,
220,
16,
317,
286,
6500,
3597,
445,
87747,
497,
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_push_force_notify_wip() {
let mut test = new_test();
test.handler.event = "push".into();
test.handler.data.ref_name = Some("refs/heads/some-branch".into());
test.handler.data.before = Some("abcdef0000".into());
test.handler.data.after = Some("1111abcdef".into());
test.handler.data.forced = Some(true);
let mut pr = some_pr().unwrap();
pr.head.sha = "abcdef0000".into();
pr.title = "WIP: Awesome new feature".into();
test.github.mock_get_pull_requests(
"some-user",
"some-repo",
Some("open".into()),
None,
Ok(vec![pr]),
);
test.github.mock_get_pull_request_commits(
"some-user",
"some-repo",
32,
Ok(some_commits()),
);
// Note: no expectations here.
let resp = test.handler.handle_event().unwrap();
assert_eq!((StatusCode::OK, "push".into()), resp);
} | rust_cleaned_test_functions.jsonl/89657 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 407
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14218,
40739,
36654,
1670,
573,
368,
341,
262,
1077,
5206,
1273,
284,
501,
4452,
1428,
262,
1273,
31171,
5773,
284,
330,
9077,
3263,
18122,
543,
262,
1273,
31171,
2196,
11053,
1269,
284,
4329,
445... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_if_open() {
let source = "[";
let instructions = Parser::parse_instructions(&Parser::parse_string(source));
assert_eq!(instructions, vec![Instruction::IF]);
} | rust_cleaned_test_functions.jsonl/56686 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 77
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
11119,
11311,
368,
341,
262,
1077,
2530,
284,
10545,
876,
262,
1077,
11221,
284,
21102,
486,
6400,
82427,
2099,
6570,
486,
6400,
3904,
12437,
1106,
262,
2060,
10714,
10297,
62295,
11,
7486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_take_struct_with_null_indices() {
let array = create_test_struct(vec![
Some((Some(true), Some(42))),
Some((Some(false), Some(28))),
Some((Some(false), Some(19))),
Some((Some(true), Some(31))),
None,
]);
let index =
UInt32Array::from(vec![None, Some(3), Some(1), None, Some(0), Some(4)]);
let actual = take(&array, &index, None).unwrap();
let actual: &StructArray = actual.as_any().downcast_ref::<StructArray>().unwrap();
assert_eq!(index.len(), actual.len());
assert_eq!(3, actual.null_count());
let expected = create_test_struct(vec![
None,
Some((Some(true), Some(31))),
Some((Some(false), Some(28))),
None,
Some((Some(true), Some(42))),
None,
]);
assert_eq!(&expected, actual);
} | rust_cleaned_test_functions.jsonl/27062 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 479
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73261,
15126,
6615,
15162,
18333,
368,
341,
286,
1077,
1334,
284,
1855,
4452,
15126,
25592,
90515,
310,
4329,
1188,
8373,
3715,
701,
4329,
7,
19,
17,
41749,
310,
4329,
1188,
8373,
3576,
701,
4329,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_serialize_vch_jada() {
#[cfg(feature = "v3")]
init_psa_crypto();
assert_eq!(
Voucher::try_from(VCH_JADA).unwrap().serialize().unwrap(),
VCH_JADA);
} | rust_cleaned_test_functions.jsonl/81737 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 107
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88686,
2273,
331,
5374,
2584,
368,
341,
262,
11506,
14072,
27062,
284,
330,
85,
18,
5422,
262,
2930,
620,
9081,
78298,
1428,
262,
2060,
10714,
33673,
286,
647,
23937,
486,
1539,
5673,
12410,
2149,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_use_root_uri() {
let mut params = get_default_params();
let root_path = make_platform_path("path/a");
let root_uri = make_platform_path("path/b");
params.root_path = Some(root_path.to_str().unwrap().to_owned());
params.root_uri = Some(Url::from_directory_path(&root_uri).unwrap());
assert_eq!(get_root_path(¶ms), root_uri);
} | rust_cleaned_test_functions.jsonl/39569 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 177
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15951,
12993,
15572,
368,
341,
286,
1077,
5206,
3628,
284,
633,
9993,
6745,
1428,
286,
1077,
3704,
2638,
284,
1281,
34260,
2638,
445,
2343,
14186,
797,
286,
1077,
3704,
15572,
284,
1281,
34260,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_stake_deactivate_stake_ix() {
let stake_pubkey = Pubkey::new_unique();
let authorized_pubkey = Pubkey::new_unique();
let instruction = instruction::deactivate_stake(&stake_pubkey, &authorized_pubkey);
let message = Message::new(&[instruction], None);
assert_eq!(
parse_stake(
&message.instructions[0],
&AccountKeys::new(&message.account_keys, None)
)
.unwrap(),
ParsedInstructionEnum {
instruction_type: "deactivate".to_string(),
info: json!({
"stakeAccount": stake_pubkey.to_string(),
"clockSysvar": sysvar::clock::ID.to_string(),
"stakeAuthority": authorized_pubkey.to_string(),
}),
}
);
assert!(parse_stake(
&message.instructions[0],
&AccountKeys::new(&message.account_keys[0..2], None)
)
.is_err());
} | rust_cleaned_test_functions.jsonl/117970 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 543
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
1261,
726,
2259,
16856,
1261,
726,
62686,
368,
341,
286,
1077,
18279,
34014,
792,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
18630,
34014,
792,
284,
22611,
792,
486,
931,
21218,
543,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_follower_update() {
fluvio_future::subscriber::init_logger();
let mock_replica = MockReplica::new(20, 10);
let mut replica_state =
LeaderReplicaState::new(("test", 1), 5000, mock_replica, vec![5001]);
let follower_info = replica_state
.followers
.get(&5001)
.expect("follower should exists");
assert_eq!(follower_info.hw, -1);
assert_eq!(follower_info.leo, -1);
// this should trigger status update and follower sync
assert_eq!(
replica_state.update_follower_offsets((5001, 10, 10)),
(true, Some((10, 10).into()))
);
assert_eq!(
replica_state.update_follower_offsets((5001, 10, 10)),
(false, Some((10, 10).into()))
);
assert_eq!(
replica_state.update_follower_offsets((5001, 20, 10)),
(true, None)
);
assert_eq!(
replica_state.update_follower_offsets((5001, 20, 10)),
(false, None)
);
} | rust_cleaned_test_functions.jsonl/113498 | {
"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,
761,
29034,
8882,
368,
341,
286,
1320,
12058,
815,
59740,
486,
59205,
486,
2327,
27413,
543,
286,
1077,
7860,
25533,
15317,
284,
14563,
18327,
15317,
486,
931,
7,
17,
15,
11,
220,
16,
15,
1215,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_len() {
// See that the verify cannot walk off the end of the packet
// trying to index into the account_keys to access pubkey.
use solana_sdk::signer::{keypair::Keypair, Signer};
solana_logger::setup();
const NUM_SIG: usize = 17;
let keypair1 = Keypair::new();
let pubkey1 = keypair1.pubkey();
let mut message = Message::new(&[], Some(&pubkey1));
message.account_keys.push(pubkey1);
message.account_keys.push(pubkey1);
message.header.num_required_signatures = NUM_SIG as u8;
message.recent_blockhash = Hash::new_from_array(pubkey1.to_bytes());
let mut tx = Transaction::new_unsigned(message);
info!("message: {:?}", tx.message_data());
info!("tx: {:?}", tx);
let sig = keypair1.try_sign_message(&tx.message_data()).unwrap();
tx.signatures = vec![sig; NUM_SIG];
let mut packet = sigverify::make_packet_from_transaction(tx);
let res = sigverify::do_get_packet_offsets(&packet, 0);
assert_eq!(res, Err(PacketError::InvalidPubkeyLen));
verify_packet(&mut packet, false);
assert!(packet.meta.discard());
packet.meta.set_discard(false);
let mut batches = generate_packet_batches(&packet, 1, 1);
ed25519_verify(&mut batches);
assert!(batches[0].packets[0].meta.discard());
} | rust_cleaned_test_functions.jsonl/22075 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 619
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34014,
792,
6043,
368,
341,
286,
442,
3496,
429,
279,
10146,
4157,
4227,
1007,
279,
835,
315,
279,
10151,
198,
286,
442,
4460,
311,
1922,
1119,
279,
2692,
12631,
311,
2615,
95116,
624,
286,
990,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pass_payment_by_vouched_result() {
ExtBuilder::build().execute_with(|| {
let transfer_func = get_transfer_func(account_key("Alice"), 100, 3);
let shared_pay = ConditionalPay {
pay_timestamp: 0,
src: account_key("src"),
dest: account_key("dest"),
conditions: vec![get_condition(0), get_condition(3), get_condition(4)],
transfer_func: transfer_func,
resolve_deadline: 99999,
resolve_timeout: 10,
};
let encoded_cond_pay = encode_conditional_pay(shared_pay.clone());
let sig_of_src = account_pair("src").sign(&encoded_cond_pay);
let sig_of_dest = account_pair("dest").sign(&encoded_cond_pay);
let cond_pay_result = CondPayResult {
cond_pay: shared_pay,
amount: 10,
};
let vouched_cond_pay_result = VouchedCondPayResult {
cond_pay_result: cond_pay_result,
sig_of_src: sig_of_src,
sig_of_dest: sig_of_dest,
};
assert_ok!(CelerPayModule::resolve_payment_by_vouched_result(
Origin::signed(account_key("Alice")),
vouched_cond_pay_result
));
})
} | rust_cleaned_test_functions.jsonl/81779 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 714
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15464,
26696,
3710,
2273,
33070,
5287,
368,
341,
286,
9447,
3297,
486,
5834,
1005,
10257,
6615,
79453,
314,
5872,
310,
1077,
8317,
9596,
284,
633,
35403,
9596,
23758,
3097,
445,
61686,
3975,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_new() {
assert!(SlowStochastic::new(0, 1).is_err());
assert!(SlowStochastic::new(1, 0).is_err());
assert!(SlowStochastic::new(1, 1).is_ok());
} | rust_cleaned_test_functions.jsonl/72383 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
368,
341,
286,
2060,
10297,
58289,
623,
65954,
486,
931,
7,
15,
11,
220,
16,
568,
285,
9266,
1423,
286,
2060,
10297,
58289,
623,
65954,
486,
931,
7,
16,
11,
220,
15,
568,
285,
9266,
14... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_local_read_error() {
let mut ctx = CsmTestContext::new_established();
let mut stream = TestStream::new();
stream.read_state = StreamState::Error(ErrorKind::PermissionDenied);
ctx.set_stream(stream);
ctx.notify_epollin();
ctx.recv();
assert_eq!(ctx.pkt.op(), uapi::VSOCK_OP_RST);
} | rust_cleaned_test_functions.jsonl/83290 | {
"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,
13564,
6443,
4096,
368,
341,
286,
1077,
5206,
5635,
284,
356,
3563,
2271,
1972,
486,
931,
18583,
5102,
291,
543,
286,
1077,
5206,
4269,
284,
3393,
3027,
486,
931,
543,
286,
4269,
4125,
4387,
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_satisfies() {
let window = Window {
size: 7,
target: 0b0111110,
};
assert!(window.satisfies(0b0101010, 0b0010100));
assert!(window.satisfies(0b0101011, 0b0010100));
assert!(!window.satisfies(0b0101010, 0b0010000));
} | rust_cleaned_test_functions.jsonl/56148 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 167
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
7478,
550,
368,
341,
286,
1077,
3241,
284,
13642,
341,
310,
1379,
25,
220,
22,
345,
310,
2169,
25,
220,
15,
65,
15,
16,
16,
16,
16,
16,
15,
345,
286,
2605,
286,
2060,
10297,
5507,
514... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_show_element_downward_parent() {
let items = vec![
Path::new("a/b/c"),
Path::new("a/d"),
Path::new("a/e"),
];
//0 a/
//1 b/
//2 c
//3 d
//4 e
let mut tree =
FileTreeItems::new(&items, &BTreeSet::new()).unwrap();
tree.collapse(0, true);
let res = tree.show_element(2).unwrap();
assert_eq!(res, 4);
assert_eq!(
get_visibles(&tree),
vec![
true,
true,
true,
true,
true,
]
);
} | rust_cleaned_test_functions.jsonl/129799 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 273
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15267,
7894,
13998,
1606,
15960,
368,
341,
197,
10217,
3589,
284,
7486,
90515,
298,
69640,
486,
931,
445,
64,
3470,
2899,
3975,
715,
298,
69640,
486,
931,
445,
64,
3446,
3975,
5872,
298,
69640,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pretty_format_batches() -> Result<()> {
// define a schema.
let schema = Arc::new(Schema::new(vec![
Field::new("a", DataType::Utf8, false),
Field::new("b", DataType::Int32, false),
]));
// define data.
let batch = RecordBatch::try_new(
schema,
vec![
Arc::new(array::StringArray::from(vec!["a", "b", "c", "d"])),
Arc::new(array::Int32Array::from(vec![1, 10, 10, 100])),
],
)?;
let table = pretty_format_batches(&[batch])?;
let expected = vec![
"+---+-----+",
"| a | b |",
"+---+-----+",
"| a | 1 |",
"| b | 10 |",
"| c | 10 |",
"| d | 100 |",
"+---+-----+",
];
let actual: Vec<&str> = table.lines().collect();
assert_eq!(expected, actual);
Ok(())
} | rust_cleaned_test_functions.jsonl/28275 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 549
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
21322,
8955,
57755,
368,
1464,
5714,
71698,
341,
286,
442,
6979,
264,
10802,
624,
286,
1077,
10802,
284,
19689,
486,
931,
3759,
3416,
486,
931,
25592,
90515,
310,
8601,
486,
931,
445,
64,
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... | 3 |
#[test]
fn test_fq_sub() {
let f1 = Fq::from_str(
"18695869713129401390241150743745601908470616448391638969502807001833388904079",
)
.unwrap();
let f2 = Fq::from_str(
"10105476028534616828778879109836101003805485072436929139123765141153277007373",
)
.unwrap();
let f3 = Fq::from_str(
"8590393684594784561462271633909500904665131375954709830379041860680111896706",
)
.unwrap();
assert!(!f1.is_zero());
assert!(!f2.is_zero());
assert!(!f3.is_zero());
assert_eq!(f1 - &f2, f3);
} | rust_cleaned_test_functions.jsonl/81823 | {
"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,
761,
80,
5228,
368,
341,
262,
1077,
282,
16,
284,
434,
80,
486,
1499,
2895,
1006,
286,
330,
16,
23,
21,
24,
20,
23,
21,
24,
22,
16,
18,
16,
17,
24,
19,
15,
16,
18,
24,
15,
17,
19,
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_expr_to_sql_f64() {
let pred = DeletePredicate {
range: TimestampRange::new(1, 2),
exprs: vec![
DeleteExpr {
column: String::from("col1"),
op: Op::Eq,
scalar: Scalar::F64(OrderedFloat::from(0.0)),
},
DeleteExpr {
column: String::from("col2"),
op: Op::Eq,
scalar: Scalar::F64(OrderedFloat::from(-0.0)),
},
DeleteExpr {
column: String::from("col3"),
op: Op::Eq,
scalar: Scalar::F64(OrderedFloat::from(1.0)),
},
DeleteExpr {
column: String::from("col4"),
op: Op::Eq,
scalar: Scalar::F64(OrderedFloat::from(f64::INFINITY)),
},
DeleteExpr {
column: String::from("col5"),
op: Op::Eq,
scalar: Scalar::F64(OrderedFloat::from(f64::NEG_INFINITY)),
},
DeleteExpr {
column: String::from("col6"),
op: Op::Eq,
scalar: Scalar::F64(OrderedFloat::from(f64::NAN)),
},
],
};
assert_eq!(
&pred.expr_sql_string(),
r#""col1"=0.0 AND "col2"=-0.0 AND "col3"=1.0 AND "col4"='Infinity' AND "col5"='-Infinity' AND "col6"='NaN'"#
);
} | rust_cleaned_test_functions.jsonl/49507 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1023
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21915,
2346,
18063,
761,
21,
19,
368,
341,
286,
1077,
4162,
284,
10428,
36329,
341,
310,
2088,
25,
32758,
6046,
486,
931,
7,
16,
11,
220,
17,
1326,
310,
15169,
82,
25,
7486,
90515,
394,
10428,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vcx_schema_release() {
let _setup = SetupMocks::init();
let (_, schema_name, schema_version, data) = prepare_schema_data();
let handle = vcx_schema_create_c_closure(&schema_name, &schema_version, &data).unwrap();
let unknown_handle = handle + 1;
assert_eq!(vcx_schema_release(unknown_handle), error::INVALID_SCHEMA_HANDLE.code_num);
} | rust_cleaned_test_functions.jsonl/118208 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 176
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
25844,
25371,
24577,
368,
341,
286,
1077,
716,
15188,
284,
18626,
72577,
486,
2327,
1428,
286,
1077,
39464,
10802,
1269,
11,
10802,
9438,
11,
821,
8,
284,
10549,
25371,
1769,
543,
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_insert_wrong_ancestors() {
let key = Keypair::new();
let index = AccountsIndex::<bool>::default_for_tests();
let mut gc = Vec::new();
index.upsert(
0,
&key.pubkey(),
&Pubkey::default(),
&[],
&AccountSecondaryIndexes::default(),
true,
&mut gc,
UPSERT_PREVIOUS_SLOT_ENTRY_WAS_CACHED_FALSE,
);
assert!(gc.is_empty());
let ancestors = vec![(1, 1)].into_iter().collect();
assert!(index.get(&key.pubkey(), Some(&ancestors), None).is_none());
let mut num = 0;
index.unchecked_scan_accounts(
"",
&ancestors,
|_pubkey, _index| num += 1,
COLLECT_ALL_UNSORTED_FALSE,
);
assert_eq!(num, 0);
} | rust_cleaned_test_functions.jsonl/99722 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 471
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
75198,
62,
681,
267,
1087,
368,
341,
286,
1077,
1376,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
1922,
284,
40655,
1552,
27638,
2641,
6831,
2258,
5478,
32509,
543,
286,
1077,
5206,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_defaults() {
// get default tauri config
let t_config = TauriConfig::default();
// get default build config
let b_config = BuildConfig::default();
// get default dev path
let d_path = default_dev_path();
// get default window
let d_windows: Vec<WindowConfig> = vec![];
// get default bundle
let d_bundle = BundleConfig::default();
// get default updater
let d_updater = UpdaterConfig::default();
// create a tauri config.
let tauri = TauriConfig {
pattern: Default::default(),
windows: vec![],
bundle: BundleConfig {
active: false,
targets: None,
identifier: String::from(""),
icon: Vec::new(),
resources: None,
copyright: None,
category: None,
short_description: None,
long_description: None,
deb: Default::default(),
macos: Default::default(),
external_bin: None,
windows: Default::default(),
},
cli: None,
updater: UpdaterConfig {
active: false,
dialog: true,
pubkey: "".into(),
endpoints: None,
},
security: SecurityConfig {
csp: None,
dev_csp: None,
freeze_prototype: false,
},
allowlist: AllowlistConfig::default(),
system_tray: None,
macos_private_api: false,
};
// create a build config
let build = BuildConfig {
runner: None,
dev_path: AppUrl::Url(WindowUrl::External(
Url::parse("http://localhost:8080").unwrap(),
)),
dist_dir: AppUrl::Url(WindowUrl::App("../dist".into())),
before_dev_command: None,
before_build_command: None,
features: None,
with_global_tauri: false,
};
// test the configs
assert_eq!(t_config, tauri);
assert_eq!(b_config, build);
assert_eq!(d_bundle, tauri.bundle);
assert_eq!(d_updater, tauri.updater);
assert_eq!(
d_path,
AppUrl::Url(WindowUrl::External(
Url::parse("http://localhost:8080").unwrap()
))
);
assert_eq!(d_windows, tauri.windows);
} | rust_cleaned_test_functions.jsonl/38141 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 935
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42290,
368,
341,
262,
442,
633,
1638,
259,
4110,
72,
2193,
198,
262,
1077,
259,
5332,
284,
350,
4110,
72,
2648,
486,
2258,
543,
262,
442,
633,
1638,
1936,
2193,
198,
262,
1077,
293,
5332,
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_smoothing_samples() {
let samples =
InterpolatedValue::calculate_smoothing_samples(44100.0, Duration::from_secs(1));
assert_f_eq!(samples, 44100.0);
} | rust_cleaned_test_functions.jsonl/19815 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 103
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15874,
38413,
18297,
368,
341,
286,
1077,
10469,
4035,
310,
5665,
9896,
657,
1130,
486,
35597,
15874,
38413,
18297,
7,
19,
19,
16,
15,
15,
13,
15,
11,
21045,
486,
1499,
68718,
7,
16,
1106,
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 |
#[test]
fn test_missing_predict() {
let model = Model::train("data/train.ffm").unwrap();
let err = model.predict("missing.ffm").unwrap_err();
assert_eq!(err.to_string(), "No such file or directory (os error 2)".to_string());
} | rust_cleaned_test_functions.jsonl/25225 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 111
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40447,
26815,
368,
341,
286,
1077,
1614,
284,
4903,
486,
10397,
445,
691,
50838,
83885,
76,
1827,
15454,
543,
286,
1077,
1848,
284,
1614,
23772,
445,
30616,
83885,
76,
1827,
15454,
9266,
543,
286,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_index_on_commit_reload_policy() {
let schema = throw_away_schema();
let field = schema.get_field("num_likes").unwrap();
let index = Index::create_in_ram(schema);
let reader = index
.reader_builder()
.reload_policy(ReloadPolicy::OnCommit)
.try_into()
.unwrap();
assert_eq!(reader.searcher().num_docs(), 0);
let mut writer = index.writer_with_num_threads(1, 3_000_000).unwrap();
test_index_on_commit_reload_policy_aux(field, &mut writer, &reader);
} | rust_cleaned_test_functions.jsonl/118704 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 275
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3560,
4470,
36346,
79405,
22773,
368,
341,
286,
1077,
10802,
284,
2510,
62,
13757,
25371,
543,
286,
1077,
2070,
284,
10802,
670,
5013,
445,
2413,
89178,
1827,
15454,
543,
286,
1077,
1922,
284,
800... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_success() {
assert!(RunStats::default().is_success(), "empty run => success");
assert!(
RunStats {
initial_run_count: 42,
final_run_count: 42,
..RunStats::default()
}
.is_success(),
"initial run count = final run count => success"
);
assert!(
!RunStats {
initial_run_count: 42,
final_run_count: 41,
..RunStats::default()
}
.is_success(),
"initial run count > final run count => failure"
);
assert!(
!RunStats {
initial_run_count: 42,
final_run_count: 42,
failed: 1,
..RunStats::default()
}
.is_success(),
"failed => failure"
);
assert!(
!RunStats {
initial_run_count: 42,
final_run_count: 42,
exec_failed: 1,
..RunStats::default()
}
.is_success(),
"exec failed => failure"
);
assert!(
RunStats {
initial_run_count: 42,
final_run_count: 42,
skipped: 1,
..RunStats::default()
}
.is_success(),
"skipped => not considered a failure"
);
} | rust_cleaned_test_functions.jsonl/27508 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 892
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
18632,
368,
341,
286,
2060,
10297,
6727,
16635,
486,
2258,
1005,
285,
18632,
1507,
330,
3194,
1598,
589,
2393,
797,
286,
2060,
33673,
310,
6452,
16635,
341,
394,
2856,
14007,
3180,
25,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_match_inner() {
test_match(
"function bar() { let a = 123; }",
"function foo() { function bar() {let a = 123; }}",
);
test_non_match(
"function foo() { let a = 123; }",
"function foo() { function bar() {let a = 123; }}",
);
} | rust_cleaned_test_functions.jsonl/49968 | {
"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,
10708,
34345,
368,
341,
286,
1273,
10708,
1006,
310,
330,
1688,
3619,
368,
314,
1077,
264,
284,
220,
16,
17,
18,
26,
335,
756,
310,
330,
1688,
15229,
368,
314,
729,
3619,
368,
314,
1149,
264,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_batch_size_limit() {
let msg_count = Arc::new(AtomicUsize::new(0));
let batch_msg_count = Arc::new(AtomicUsize::new(0));
let service = MockKvForRaft::new(Arc::clone(&msg_count), Arc::clone(&batch_msg_count), true);
let (mock_server, port) = create_mock_server(service, 60200, 60300).unwrap();
let mut raft_client = get_raft_client_by_port(port);
// `send` should success.
for _ in 0..10 {
// 5M per RaftMessage.
let mut raft_m = RaftMessage::default();
for _ in 0..(5 * 1024) {
let mut e = Entry::default();
e.set_data(vec![b'a'; 1024].into());
raft_m.mut_message().mut_entries().push(e);
}
raft_client.send(raft_m).unwrap();
}
raft_client.flush();
check_msg_count(500, &msg_count, 10);
// The final received message count should be 10 exactly.
drop(raft_client);
drop(mock_server);
assert_eq!(msg_count.load(Ordering::SeqCst), 10);
} | rust_cleaned_test_functions.jsonl/37841 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 440
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14534,
2368,
14763,
368,
341,
262,
1077,
3750,
3180,
284,
19689,
486,
931,
7,
65857,
52,
2141,
486,
931,
7,
15,
1106,
262,
1077,
7162,
6483,
3180,
284,
19689,
486,
931,
7,
65857,
52,
2141,
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... | 3 |
#[test]
fn test_genesis_hash_match() {
let mut builder_base = WasmTestBuilder::default();
let builder = builder_base.run_genesis(GENESIS_ADDR, HashMap::new());
// This is trie's post state hash after calling run_genesis endpoint.
let genesis_run_hash = builder.get_genesis_hash();
let genesis_transforms = builder.get_genesis_transforms().clone();
let empty_root_hash = {
let gs = InMemoryGlobalState::empty().expect("Empty GlobalState.");
gs.root_hash
};
// This is trie's post state hash after committing genesis effects on top of empty trie.
let genesis_transforms_hash = builder
.commit_effects(empty_root_hash.to_vec(), genesis_transforms)
.get_poststate_hash();
// They should match.
assert_eq!(genesis_run_hash, genesis_transforms_hash);
} | rust_cleaned_test_functions.jsonl/14789 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 303
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16322,
13774,
8950,
10708,
368,
341,
262,
1077,
5206,
7363,
7651,
284,
467,
10530,
2271,
3297,
486,
2258,
1428,
262,
1077,
7363,
284,
7363,
7651,
7634,
16322,
13774,
6699,
953,
83366,
16058,
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... | 1 |
#[test]
fn test_byte_indices() {
let tokenizer = LegacyMeilisearch;
let orig = "The quick (\"brown\") fox can't jump 32.3 feet, right? Brr, it's 29.3°F!";
let processed = ProcessedText { original: orig, processed: Cow::Borrowed(orig) };
let tokens = tokenizer.tokenize(&processed);
assert_eq!(orig, tokens.map(|t| &orig[t.byte_start..t.byte_end]).collect::<String>());
let orig = "為一包含一千多萬目詞的帶標記平衡語料庫";
let processed = ProcessedText { original: orig, processed: Cow::Borrowed(orig) };
let tokens = tokenizer.tokenize(&processed).collect::<Vec<_>>();
assert_eq!("為", tokens.first().unwrap().text());
assert_eq!(
orig,
tokens.iter().map(|t| &orig[t.byte_start..t.byte_end]).collect::<String>()
);
} | rust_cleaned_test_functions.jsonl/114642 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 393
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19737,
18333,
368,
341,
286,
1077,
45958,
284,
37887,
7823,
321,
285,
2902,
280,
286,
1077,
2713,
284,
330,
785,
3974,
320,
2105,
64461,
62705,
38835,
646,
944,
7784,
220,
18,
17,
13,
18,
7541,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_sign_change_overflow() {
// this passes the naive a*b<0 check because its -inf
let a = f64::MAX / 2.;
let b = f64::MIN / 2.;
assert_eq!(is_sign_change(a, b), true);
} | rust_cleaned_test_functions.jsonl/7163 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 113
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
11172,
15947,
79073,
368,
341,
286,
442,
419,
16211,
279,
49665,
264,
33279,
27,
15,
1779,
1576,
1181,
481,
13573,
198,
286,
1077,
264,
284,
282,
21,
19,
486,
10586,
608,
220,
17,
37403,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_jump_backward_with_gap() {
let mut masm = MacroAssembler::new();
let lbl = masm.create_label();
masm.bind_label(lbl);
masm.emit_u32(0);
masm.jump(lbl);
assert_emit!(0, 0x17FFFFFF; masm);
} | rust_cleaned_test_functions.jsonl/20610 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 146
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
65436,
70477,
6615,
51790,
368,
341,
286,
1077,
5206,
9243,
76,
284,
53317,
77858,
486,
931,
543,
286,
1077,
16421,
284,
9243,
76,
2520,
6106,
543,
286,
9243,
76,
6090,
6106,
70491,
317,
286,
92... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_task_two() {
assert_eq!("3", second_task_job("#1 @ 1,3: 4x4\n#2 @ 3,1: 4x4\n#3 @ 5,5: 2x2".as_bytes()))
} | rust_cleaned_test_functions.jsonl/35265 | {
"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,
12184,
23241,
368,
341,
286,
2060,
10714,
17223,
18,
497,
2086,
12184,
20298,
3584,
16,
569,
220,
16,
11,
18,
25,
220,
19,
87,
19,
1699,
2,
17,
569,
220,
18,
11,
16,
25,
220,
19,
87,
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_ctx_default_struct() {
let expected = samples::TopLevelCtxStructDefault {
a: Some(0xff),
b: None,
};
let test_data = [0xffu8];
// Use default
let ret_read = samples::TopLevelCtxStructDefault::try_from(test_data.as_ref()).unwrap();
assert_eq!(expected, ret_read);
let ret_write: Vec<u8> = ret_read.try_into().unwrap();
assert_eq!(ret_write, test_data);
// Use context
let (rest, ret_read) =
samples::TopLevelCtxStructDefault::read(test_data.view_bits(), (1, 2)).unwrap();
assert!(rest.is_empty());
assert_eq!(expected, ret_read);
let ret_write = ret_read.write((1, 2)).unwrap();
assert_eq!(test_data.to_vec(), ret_write.into_vec());
} | rust_cleaned_test_functions.jsonl/123238 | {
"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,
15147,
9993,
15126,
368,
341,
262,
1077,
3601,
284,
10469,
486,
5366,
4449,
23684,
9422,
3675,
341,
286,
264,
25,
4329,
7,
15,
9020,
1326,
286,
293,
25,
2240,
345,
262,
3634,
262,
1077,
1273,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_genesis_block() {
let factories = CryptoFactories::default();
let network = Network::Weatherwax;
let rules = ConsensusManagerBuilder::new(network).build();
let backend = create_test_db();
let validators = Validators::new(
BodyOnlyValidator::default(),
HeaderValidator::new(rules.clone()),
OrphanBlockValidator::new(rules.clone(), false, factories),
);
let db = BlockchainDatabase::new(
backend,
rules.clone(),
validators,
BlockchainDatabaseConfig::default(),
DifficultyCalculator::new(rules.clone(), Default::default()),
false,
)
.unwrap();
let block = rules.get_genesis_block();
match db.add_block(block.to_arc_block()).unwrap_err() {
ChainStorageError::ValidationError { source } => match source {
ValidationError::ValidatingGenesis => (),
_ => panic!("Failed because incorrect validation error was received"),
},
_ => panic!("Failed because incorrect ChainStorageError was received"),
}
} | rust_cleaned_test_functions.jsonl/73083 | {
"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,
16322,
13774,
7113,
368,
341,
262,
1077,
34059,
284,
32886,
17417,
2433,
486,
2258,
543,
262,
1077,
3922,
284,
8141,
486,
28981,
86,
706,
280,
262,
1077,
5601,
284,
7292,
13626,
2043,
3297,
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... | 3 |
#[test]
fn test_emptystr() {
let res = parse_cfg::<(_, nom::error::ErrorKind)>(r#"cfg(target_env = "")"#);
println!("res = {:?}", res);
assert_eq!(
res,
Ok((
"",
Value {
key: "target_env",
value: ""
}
))
)
} | rust_cleaned_test_functions.jsonl/50603 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 300
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
495,
368,
341,
310,
1077,
592,
284,
4715,
18343,
27638,
41117,
9662,
486,
841,
486,
1454,
10629,
8,
2235,
81,
55543,
14072,
8637,
15879,
284,
11700,
57676,
317,
310,
13751,
17223,
416,
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_mem_file_lock_unlock() {
let f = InmemFile::new("test");
assert!(f.lock().is_ok());
assert!(f.unlock().is_ok());
f.lock().expect("");
assert_eq!(f.lock().unwrap_err().status(), Status::IOError);
f.unlock().expect("");
assert!(f.unlock().is_ok());
} | rust_cleaned_test_functions.jsonl/124435 | {
"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,
12976,
2458,
9818,
19465,
368,
341,
286,
1077,
282,
284,
758,
10536,
1703,
486,
931,
445,
1944,
797,
286,
2060,
10297,
69,
21003,
1005,
285,
19817,
1423,
286,
2060,
10297,
69,
47181,
1005,
285,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_existing_user_email() {
use cargo_registry::schema::emails;
use chrono::NaiveDateTime;
use diesel::update;
#[derive(Deserialize)]
struct R {
user: EncodablePrivateUser,
}
let (_b, app, middle) = app();
let mut req = req(Method::Get, "/me");
{
let conn = app.diesel_database.get().unwrap();
let new_user = NewUser {
email: Some("potahto@example.com"),
..new_user("potahto")
};
let user = new_user.create_or_update(&conn).unwrap();
update(Email::belonging_to(&user))
// Users created before we added verification will have
// `NULL` in the `token_generated_at` column.
.set(emails::token_generated_at.eq(None::<NaiveDateTime>))
.execute(&*conn)
.unwrap();
sign_in_as(&mut req, &user);
}
let mut response = ok_resp!(middle.call(req.with_path("/api/v1/me").with_method(Method::Get),));
let r = ::json::<R>(&mut response);
assert_eq!(r.user.email.unwrap(), "potahto@example.com");
assert!(!r.user.email_verified);
assert!(!r.user.email_verification_sent);
} | rust_cleaned_test_functions.jsonl/29164 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 539
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62630,
3317,
9172,
368,
341,
262,
990,
25652,
50650,
486,
17349,
486,
51376,
280,
262,
990,
80372,
486,
16193,
533,
7689,
280,
262,
990,
32780,
486,
2386,
401,
262,
11506,
27098,
7,
64465,
5563,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reaction_with_member() {
let expected = Reaction {
channel_id: ChannelId(2),
emoji: ReactionType::Unicode {
name: "🙂".to_owned(),
},
guild_id: Some(GuildId(1)),
member: Some(Member {
deaf: false,
guild_id: GuildId(1),
hoisted_role: Some(RoleId(5)),
joined_at: Some("2020-01-01T00:00:00.000000+00:00".to_owned()),
mute: false,
nick: Some("typing".to_owned()),
premium_since: None,
roles: vec![RoleId(5)],
user: User {
avatar: Some("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa".to_owned()),
bot: false,
discriminator: "0001".to_owned(),
email: None,
flags: None,
id: UserId(4),
locale: None,
mfa_enabled: None,
name: "test".to_owned(),
premium_type: None,
public_flags: None,
system: None,
verified: None,
},
}),
message_id: MessageId(3),
user_id: UserId(4),
};
serde_test::assert_tokens(
&expected,
&[
Token::Struct {
name: "Reaction",
len: 6,
},
Token::Str("channel_id"),
Token::NewtypeStruct { name: "ChannelId" },
Token::Str("2"),
Token::Str("emoji"),
Token::Struct {
name: "ReactionType",
len: 1,
},
Token::Str("name"),
Token::Str("🙂"),
Token::StructEnd,
Token::Str("guild_id"),
Token::Some,
Token::NewtypeStruct { name: "GuildId" },
Token::Str("1"),
Token::Str("member"),
Token::Some,
Token::Struct {
name: "Member",
len: 9,
},
Token::Str("deaf"),
Token::Bool(false),
Token::Str("guild_id"),
Token::NewtypeStruct { name: "GuildId" },
Token::Str("1"),
Token::Str("hoisted_role"),
Token::Some,
Token::NewtypeStruct { name: "RoleId" },
Token::Str("5"),
Token::Str("joined_at"),
Token::Some,
Token::Str("2020-01-01T00:00:00.000000+00:00"),
Token::Str("mute"),
Token::Bool(false),
Token::Str("nick"),
Token::Some,
Token::Str("typing"),
Token::Str("premium_since"),
Token::None,
Token::Str("roles"),
Token::Seq { len: Some(1) },
Token::NewtypeStruct { name: "RoleId" },
Token::Str("5"),
Token::SeqEnd,
Token::Str("user"),
Token::Struct {
name: "User",
len: 13,
},
Token::Str("avatar"),
Token::Some,
Token::Str("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"),
Token::Str("bot"),
Token::Bool(false),
Token::Str("discriminator"),
Token::Str("0001"),
Token::Str("email"),
Token::None,
Token::Str("flags"),
Token::None,
Token::Str("id"),
Token::NewtypeStruct { name: "UserId" },
Token::Str("4"),
Token::Str("locale"),
Token::None,
Token::Str("mfa_enabled"),
Token::None,
Token::Str("username"),
Token::Str("test"),
Token::Str("premium_type"),
Token::None,
Token::Str("public_flags"),
Token::None,
Token::Str("system"),
Token::None,
Token::Str("verified"),
Token::None,
Token::StructEnd,
Token::StructEnd,
Token::Str("message_id"),
Token::NewtypeStruct { name: "MessageId" },
Token::Str("3"),
Token::Str("user_id"),
Token::NewtypeStruct { name: "UserId" },
Token::Str("4"),
Token::StructEnd,
],
);
} | rust_cleaned_test_functions.jsonl/10391 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2988
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
96631,
6615,
19388,
368,
341,
286,
1077,
3601,
284,
66841,
341,
310,
5496,
842,
25,
13434,
764,
7,
17,
1326,
310,
42365,
25,
66841,
929,
486,
33920,
341,
394,
829,
25,
330,
145080,
3263,
983,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_matches() {
let term = parse_query("{} matches {}");
assert_eq!(term.to_polar(), r#"{} matches {}"#);
let _term = parse_query("{x: 1} matches {}");
} | rust_cleaned_test_functions.jsonl/12194 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
38344,
368,
341,
286,
1077,
4647,
284,
4715,
5738,
53430,
9071,
4687,
797,
286,
2060,
10714,
10297,
4991,
2389,
620,
7417,
1507,
435,
55543,
6257,
9071,
4687,
57676,
317,
286,
1077,
716,
49... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_modified_bitrot() -> Result<()> {
// Given
let entry = given_entry("file.txt");
// When
let stats = Stats {
added: vec![],
removed: vec![],
updated: vec![],
updated_bitrot: vec![&entry],
moved: Default::default(),
unchanged: vec![],
total: 1,
};
// Then
assert_eq!(stats.modified(), true);
Ok(())
} | rust_cleaned_test_functions.jsonl/4102 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 260
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37749,
13996,
4640,
368,
1464,
5714,
71698,
341,
286,
442,
16246,
198,
286,
1077,
4343,
284,
2661,
9078,
445,
1192,
3909,
3071,
286,
442,
3197,
198,
286,
1077,
10472,
284,
29927,
341,
310,
3694,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_state_clear_messages_panic_wrong_sequencer() {
let state =
MockBufferSharedState::empty_with_n_sequencers(NonZeroU32::try_from(2).unwrap());
state.clear_messages(2);
} | rust_cleaned_test_functions.jsonl/53069 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 103
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4387,
21811,
23428,
620,
31270,
75198,
3453,
446,
19529,
368,
341,
286,
1077,
1584,
4035,
310,
14563,
4095,
16997,
1397,
486,
3194,
6615,
1089,
3453,
446,
62294,
7,
8121,
17999,
52,
18,
17,
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 |
#[test]
fn test_spl_token_v2_multisig_fix() {
let (genesis_config, _mint_keypair) = create_genesis_config(0);
let mut bank = Bank::new(&genesis_config);
// Setup a simulated account
bank.store_account_and_update_capitalization(
&inline_spl_token_v2_0::id(),
&Account {
lamports: 100,
..Account::default()
},
);
assert_eq!(bank.get_balance(&inline_spl_token_v2_0::id()), 100);
let original_capitalization = bank.capitalization();
bank.apply_spl_token_v2_multisig_fix();
assert_eq!(bank.get_balance(&inline_spl_token_v2_0::id()), 0);
assert_eq!(bank.capitalization(), original_capitalization - 100);
} | rust_cleaned_test_functions.jsonl/63804 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 372
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
500,
6458,
2273,
17,
26290,
285,
343,
36060,
368,
341,
286,
1077,
320,
77894,
5332,
11,
716,
67791,
3097,
12670,
8,
284,
1855,
16322,
13774,
5332,
7,
15,
317,
286,
1077,
5206,
6073,
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.