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_hget_hset_str() {
if let Ok(mut conn) = connection::get_connection(None) {
let key = "redis_hash_test_key_4";
let field = "field";
let value = "value";
self::hset(&mut conn, key, field, value).expect("Error h-setting value");
let result: String = self::hget(&mut conn, key, field).unwrap();
connection::del(&mut conn, key).expect("Error deleting value");
assert_eq!(result, value);
} else {
assert_eq!(1, 2);
}
} | rust_cleaned_test_functions.jsonl/111550 | {
"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,
1523,
455,
1523,
746,
2895,
368,
341,
286,
421,
1077,
7622,
70305,
4534,
8,
284,
3633,
486,
455,
15866,
26717,
8,
341,
310,
1077,
1376,
284,
330,
21748,
8950,
4452,
3097,
62,
19,
876,
310,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_set_writeampbasedratelimiter_with_auto_tuned() {
let path =
tempdir_with_prefix("_rust_rocksdb_test_set_write_amp_based_rate_limiter_with_auto_tuned");
let mut opts = DBOptions::new();
opts.create_if_missing(true);
opts.set_writeampbasedratelimiter_with_auto_tuned(
100 * 1024 * 1024,
10 * 100000,
DBRateLimiterMode::AllIo,
true,
);
let db = DB::open(opts, path.path().to_str().unwrap()).unwrap();
let mut opts = db.get_db_options();
assert!(opts.set_auto_tuned(false).is_ok(), true);
assert_eq!(opts.get_auto_tuned().unwrap(), false);
drop(db);
} | rust_cleaned_test_functions.jsonl/34090 | {
"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,
2602,
9165,
1121,
29939,
17606,
301,
17700,
6615,
27740,
528,
48883,
368,
341,
262,
1077,
1815,
4035,
286,
2730,
3741,
6615,
13974,
16975,
35788,
26608,
14553,
1999,
4452,
2602,
9165,
60281,
66679,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_and_or_warning() -> TestResult {
let p = polar();
// free-standing OR is fine
p.load_str("f(x) if x > 1 or x < 3;")?;
p.clear_rules();
p.load_str("f(x) if x = 1 and (x > 1 or x < 3);")?;
p.clear_rules();
p.load_str("f(x) if (x = 1 and x > 1) or x < 3;")?;
p.clear_rules();
// Add whitespace to make sure it can find parentheses wherever they are
p.load_str("f(x) if (\n\t x = 1 and x > 1) or x < 3;")?;
p.clear_rules();
p.load_str("f(x) if x = 1 and x > 1 or x < 3;")?;
let mut messages = vec![];
while let Some(msg) = p.next_message() {
messages.push(msg);
}
assert_eq!(messages.len(), 1);
let message = messages.first().unwrap();
assert!(matches!(message.kind, MessageKind::Warning));
let expected = indoc! {"
Expression without parentheses could be ambiguous.
Prior to 0.20, `x and y or z` would parse as `x and (y or z)`.
As of 0.20, it parses as `(x and y) or z`, matching other languages. at line 1, column 9:
\t001: f(x) if x = 1 and x > 1 or x < 3;
\t ^\n"};
assert_eq!(message.msg, expected);
p.clear_rules();
p.load_str("f(x) if x = 1 or x > 1 and x < 3;")?;
let mut messages: Vec<Message> = vec![];
while let Some(msg) = p.next_message() {
messages.push(msg);
}
assert_eq!(messages.len(), 1);
let message = messages.first().unwrap();
assert!(matches!(message.kind, MessageKind::Warning));
let expected = indoc! {"
Expression without parentheses could be ambiguous.
Prior to 0.20, `x and y or z` would parse as `x and (y or z)`.
As of 0.20, it parses as `(x and y) or z`, matching other languages. at line 1, column 18:
\t001: f(x) if x = 1 or x > 1 and x < 3;
\t ^\n"};
assert_eq!(message.msg, expected);
Ok(())
} | rust_cleaned_test_functions.jsonl/68133 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 868
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8378,
8734,
38395,
368,
1464,
3393,
2077,
341,
262,
1077,
281,
284,
24660,
1428,
262,
442,
1910,
55603,
2726,
374,
6915,
198,
262,
281,
5104,
2895,
445,
69,
2075,
8,
421,
856,
861,
220,
16,
47... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 9 |
#[test]
fn test_index_to_param_eos() {
if let Ok(r) = IndexToParamEos::from_file("src/index_sizes.bin") {
assert_eq!(r.qty, 3);
assert_eq!(r.sizes[0], 1);
assert_eq!(r.sizes[1], 8);
assert_eq!(r.sizes[2], 4);
assert_eq!(r.blocks[0].buf, "A");
assert_eq!(r.blocks[1].buf, "BBBBBBBB");
assert_eq!(r.blocks[2].buf, "CCCC");
}
} | rust_cleaned_test_functions.jsonl/770 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 224
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3560,
2346,
4090,
2204,
436,
368,
341,
262,
421,
1077,
7622,
2601,
8,
284,
8008,
1249,
2001,
36,
436,
486,
1499,
2458,
445,
3548,
9022,
32159,
29394,
899,
341,
286,
2060,
10714,
10297,
81,
81410... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_to_uri_hotp() {
let auth = otpauth::HOTP::new("python");
let expect = "otpauth://hotp/python?secret=OB4XI2DPNY&issuer=python&counter=4";
assert_eq!(expect, auth.to_uri("python", "python", 4));
} | rust_cleaned_test_functions.jsonl/93463 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 104
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
15572,
33433,
79,
368,
341,
262,
1077,
4166,
284,
83431,
3242,
486,
39,
90146,
486,
931,
445,
12669,
797,
262,
1077,
1720,
284,
330,
48708,
3242,
1110,
10622,
79,
23266,
30,
20474,
28,
206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_duplicate_duplicate_confirmed() {
let slot = 0;
let correct_hash = Hash::new_unique();
let cluster_duplicate_confirmed_hash = Some(&correct_hash);
let is_dead = false;
// Bank is not frozen yet
let bank_frozen_hash = Hash::default();
let is_slot_duplicate = true;
assert!(on_cluster_update(
slot,
&bank_frozen_hash,
cluster_duplicate_confirmed_hash,
is_slot_duplicate,
is_dead
)
.is_empty());
} | rust_cleaned_test_functions.jsonl/48610 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 313
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70434,
70434,
16059,
8434,
368,
341,
286,
1077,
9446,
284,
220,
15,
280,
286,
1077,
4396,
8950,
284,
6531,
486,
931,
21218,
543,
286,
1077,
10652,
70434,
16059,
8434,
8950,
284,
4329,
2099,
19928,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_counter_vec_local() {
let vec = CounterVec::new(
Opts::new("test_vec_local", "test counter vec help"),
&["l1", "l2"],
)
.unwrap();
let mut local_vec_1 = vec.local();
let mut local_vec_2 = local_vec_1.clone();
assert!(local_vec_1.remove_label_values(&["v1", "v2"]).is_err());
local_vec_1.with_label_values(&["v1", "v2"]).inc_by(23.0);
assert!((local_vec_1.with_label_values(&["v1", "v2"]).get() - 23.0) <= EPSILON);
assert!((vec.with_label_values(&["v1", "v2"]).get() - 0.0) <= EPSILON);
local_vec_1.flush();
assert!((local_vec_1.with_label_values(&["v1", "v2"]).get() - 0.0) <= EPSILON);
assert!((vec.with_label_values(&["v1", "v2"]).get() - 23.0) <= EPSILON);
local_vec_1.flush();
assert!((local_vec_1.with_label_values(&["v1", "v2"]).get() - 0.0) <= EPSILON);
assert!((vec.with_label_values(&["v1", "v2"]).get() - 23.0) <= EPSILON);
local_vec_1.with_label_values(&["v1", "v2"]).inc_by(11.0);
assert!((local_vec_1.with_label_values(&["v1", "v2"]).get() - 11.0) <= EPSILON);
assert!((vec.with_label_values(&["v1", "v2"]).get() - 23.0) <= EPSILON);
local_vec_1.flush();
assert!((local_vec_1.with_label_values(&["v1", "v2"]).get() - 0.0) <= EPSILON);
assert!((vec.with_label_values(&["v1", "v2"]).get() - 34.0) <= EPSILON);
assert!(local_vec_1.remove_label_values(&["v1", "v2"]).is_ok());
assert!((local_vec_1.with_label_values(&["v1", "v2"]).get() - 0.0) <= EPSILON);
assert!((vec.with_label_values(&["v1", "v2"]).get() - 0.0) <= EPSILON);
local_vec_1.with_label_values(&["v1", "v2"]).inc();
assert!(local_vec_1.remove_label_values(&["v1"]).is_err());
assert!(local_vec_1.remove_label_values(&["v1", "v3"]).is_err());
local_vec_1.with_label_values(&["v1", "v2"]).inc_by(13.0);
assert!((local_vec_1.with_label_values(&["v1", "v2"]).get() - 14.0) <= EPSILON);
assert!((vec.with_label_values(&["v1", "v2"]).get() - 0.0) <= EPSILON);
local_vec_2.with_label_values(&["v1", "v2"]).inc_by(7.0);
assert!((local_vec_2.with_label_values(&["v1", "v2"]).get() - 7.0) <= EPSILON);
local_vec_1.flush();
local_vec_2.flush();
assert!((vec.with_label_values(&["v1", "v2"]).get() - 21.0) <= EPSILON);
local_vec_1.flush();
local_vec_2.flush();
assert!((vec.with_label_values(&["v1", "v2"]).get() - 21.0) <= EPSILON);
} | rust_cleaned_test_functions.jsonl/46522 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1310
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15730,
13251,
13564,
368,
341,
286,
1077,
7486,
284,
19735,
10050,
486,
931,
1006,
310,
506,
12754,
486,
931,
445,
1944,
13251,
13564,
497,
330,
1944,
5546,
7486,
1492,
4461,
310,
609,
1183,
75,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_accept_and_pay() {
new_test_ext().execute_with(|| {
let creator_initial_balance = 100;
let payment_amount = 20;
let expected_incentive_amount = 0;
assert_ok!(Payment::request_payment(
Origin::signed(PAYMENT_RECIPENT),
PAYMENT_CREATOR,
CURRENCY_ID,
payment_amount,
));
assert_eq!(
PaymentStore::<Test>::get(PAYMENT_CREATOR, PAYMENT_RECIPENT),
Some(PaymentDetail {
asset: CURRENCY_ID,
amount: payment_amount,
incentive_amount: expected_incentive_amount,
state: PaymentState::PaymentRequested,
resolver_account: RESOLVER_ACCOUNT,
fee_detail: Some((FEE_RECIPIENT_ACCOUNT, 0)),
})
);
assert_ok!(Payment::accept_and_pay(
Origin::signed(PAYMENT_CREATOR),
PAYMENT_RECIPENT,
));
// the payment amount should be transferred
assert_eq!(
Tokens::free_balance(CURRENCY_ID, &PAYMENT_CREATOR),
creator_initial_balance - payment_amount
);
assert_eq!(Tokens::free_balance(CURRENCY_ID, &PAYMENT_RECIPENT), payment_amount);
// should be deleted from storage
assert_eq!(PaymentStore::<Test>::get(PAYMENT_CREATOR, PAYMENT_RECIPENT), None);
assert_eq!(
last_event(),
crate::Event::<Test>::PaymentRequestCompleted {
from: PAYMENT_CREATOR,
to: PAYMENT_RECIPENT,
}
.into()
);
});
} | rust_cleaned_test_functions.jsonl/111995 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 552
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35728,
8378,
28925,
368,
341,
8638,
4452,
9927,
1005,
10257,
6615,
79453,
341,
197,
10217,
19919,
15809,
29396,
284,
220,
16,
15,
15,
280,
197,
10217,
8160,
13471,
284,
220,
17,
15,
280,
197,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_txn_store_rawkv_causet() {
let store = AssertionStorage::default();
store.raw_put_ok(Causet_DEFAULT.to_string(), b"k1".to_vec(), b"v1".to_vec());
store.raw_get_ok(Causet_DEFAULT.to_string(), b"k1".to_vec(), Some(b"v1".to_vec()));
store.raw_get_ok("".to_string(), b"k1".to_vec(), Some(b"v1".to_vec()));
store.raw_get_ok(Causet_DAGGER.to_string(), b"k1".to_vec(), None);
store.raw_put_ok("".to_string(), b"k2".to_vec(), b"v2".to_vec());
store.raw_put_ok(Causet_DAGGER.to_string(), b"k3".to_vec(), b"v3".to_vec());
store.raw_get_ok(Causet_DEFAULT.to_string(), b"k2".to_vec(), Some(b"v2".to_vec()));
store.raw_get_ok(Causet_DAGGER.to_string(), b"k3".to_vec(), Some(b"v3".to_vec()));
store.raw_get_ok(Causet_DEFAULT.to_string(), b"k3".to_vec(), None);
store.raw_scan_ok(
Causet_DEFAULT.to_string(),
b"".to_vec(),
3,
vec![(b"k1", b"v1"), (b"k2", b"v2")],
);
store.raw_put_err("foobar".to_string(), b"key".to_vec(), b"value".to_vec());
} | rust_cleaned_test_functions.jsonl/120738 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 532
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
92299,
14809,
16067,
43408,
666,
11855,
295,
368,
341,
262,
1077,
3553,
284,
46730,
5793,
486,
2258,
543,
262,
3553,
18152,
15557,
19817,
3025,
11855,
295,
13811,
2389,
3904,
1507,
293,
62911,
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_decode() {
let frame_data = vec![0x15, 0x01, 0x00, 0x00, 0x00, 0x06, 0xFF, 0x03, 0x00, 0x04, 0x00, 0x01];
let frame = Frame::decode(&frame_data).unwrap();
assert_eq!(frame.transaction_id, 0x1501);
assert_eq!(frame.unit_id, 0xFF);
assert_eq!(frame.pdu, &frame_data[7..]);
} | rust_cleaned_test_functions.jsonl/132689 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 184
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
368,
341,
286,
1077,
4034,
1769,
284,
7486,
20703,
15,
87,
16,
20,
11,
220,
15,
87,
15,
16,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
11,
220,
15,
87,
15,
15,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_confirmed_block_config() {
let bob_pubkey = solana_sdk::pubkey::new_rand();
let RpcHandler {
io,
meta,
confirmed_block_signatures,
..
} = start_rpc_handler_with_tx(&bob_pubkey);
let req = format!(
r#"{{"jsonrpc":"2.0","id":1,"method":"getConfirmedBlock","params":[0,{}]}}"#,
json!(RpcConfirmedBlockConfig {
encoding: None,
transaction_details: Some(TransactionDetails::Signatures),
rewards: Some(false),
commitment: None,
})
);
let res = io.handle_request_sync(&req, meta.clone());
let result: Value = serde_json::from_str(&res.expect("actual response"))
.expect("actual response deserialization");
let confirmed_block: Option<UiConfirmedBlock> =
serde_json::from_value(result["result"].clone()).unwrap();
let confirmed_block = confirmed_block.unwrap();
assert!(confirmed_block.transactions.is_none());
assert!(confirmed_block.rewards.is_none());
for (i, signature) in confirmed_block.signatures.unwrap()[..2].iter().enumerate() {
assert_eq!(*signature, confirmed_block_signatures[i].to_string());
}
let req = format!(
r#"{{"jsonrpc":"2.0","id":1,"method":"getConfirmedBlock","params":[0,{}]}}"#,
json!(RpcConfirmedBlockConfig {
encoding: None,
transaction_details: Some(TransactionDetails::None),
rewards: Some(true),
commitment: None,
})
);
let res = io.handle_request_sync(&req, meta);
let result: Value = serde_json::from_str(&res.expect("actual response"))
.expect("actual response deserialization");
let confirmed_block: Option<UiConfirmedBlock> =
serde_json::from_value(result["result"].clone()).unwrap();
let confirmed_block = confirmed_block.unwrap();
assert!(confirmed_block.transactions.is_none());
assert!(confirmed_block.signatures.is_none());
assert_eq!(confirmed_block.rewards.unwrap(), vec![]);
} | rust_cleaned_test_functions.jsonl/3053 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1037
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
16059,
8434,
7113,
5332,
368,
341,
286,
1077,
35192,
34014,
792,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
79961,
3050,
341,
310,
6399,
345,
310,
8823,
345,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_add_bytes_to_bits_tuple_ok2() {
assert!(add_bytes_to_bits_tuple((5, std::u64::MAX), 1) == (6, 7));
} | rust_cleaned_test_functions.jsonl/51480 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 73
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
12524,
2346,
20034,
21773,
19817,
17,
368,
341,
286,
2060,
10297,
718,
12524,
2346,
20034,
21773,
1188,
20,
11,
1460,
486,
84,
21,
19,
486,
10586,
701,
220,
16,
8,
621,
320,
21,
11,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_extend() {
let mut deq = FixedVecDeque::<[u32; 4]>::new();
deq.extend(vec![1, 2, 3, 4, 5, 6, 7, 8].into_iter());
assert!(!deq.is_empty());
assert!(deq.is_full());
assert_eq!(deq.iter().collect::<Vec<_>>(), vec![&5, &6, &7, &8]);
} | rust_cleaned_test_functions.jsonl/3287 | {
"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,
70265,
368,
341,
286,
1077,
5206,
409,
80,
284,
20149,
10050,
73891,
27638,
58,
84,
18,
17,
26,
220,
19,
60,
6831,
931,
543,
286,
409,
80,
15831,
25592,
20703,
16,
11,
220,
17,
11,
220,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_replog() {
let mut server = Server::new(&Conf);
let random_bytes = |size: usize| -> Vec<u8> {
(0..size).map(|_|thread_rng_n(26) + 48).map(|x| x as u8).collect()
};
} | rust_cleaned_test_functions.jsonl/6021 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 293
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25533,
839,
368,
341,
286,
1077,
5206,
3538,
284,
8422,
486,
931,
2099,
15578,
317,
286,
1077,
4194,
12524,
284,
760,
2141,
25,
22301,
91,
1464,
11312,
34837,
23,
29,
341,
310,
320,
15,
496,
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_ko_simple() {
// TODO: need to build dictionary
let orig = "한글형태소분석기 테스트 중 입니다.";
let processed = ProcessedText {
original: orig,
processed: Cow::Borrowed(orig),
};
let ko_tokens = Lindera { normal_mode: true, dict: "" }.tokenize(&processed).map(|Token { word, .. }| word.to_owned()).collect::<Vec<_>>();
println!("{:?}", ko_tokens);
} | rust_cleaned_test_functions.jsonl/24092 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 243
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4698,
78,
30015,
368,
341,
286,
442,
5343,
25,
1184,
311,
1936,
10997,
198,
286,
1077,
2713,
284,
330,
23573,
83291,
128909,
86372,
43590,
79716,
129150,
20487,
10764,
72509,
53189,
70943,
38150,
21... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_config_validate() {
let mut cfg = Config::default();
cfg.validate().unwrap();
cfg = Config::default();
cfg.region_max_size = Some(ReadableSize(10));
cfg.region_split_size = ReadableSize(20);
assert!(cfg.validate().is_err());
cfg = Config::default();
cfg.region_max_size = None;
cfg.region_split_size = ReadableSize(20);
assert!(cfg.validate().is_ok());
assert_eq!(cfg.region_max_size, Some(ReadableSize(30)));
cfg = Config::default();
cfg.region_max_keys = Some(10);
cfg.region_split_keys = Some(20);
assert!(cfg.validate().is_err());
cfg = Config::default();
cfg.region_max_keys = None;
cfg.region_split_keys = Some(20);
assert!(cfg.validate().is_ok());
assert_eq!(cfg.region_max_keys, Some(30));
cfg = Config::default();
cfg.enable_region_bucket = false;
cfg.region_split_size = ReadableSize(20);
cfg.region_bucket_size = ReadableSize(30);
assert!(cfg.validate().is_ok());
cfg = Config::default();
cfg.region_split_size = ReadableSize::mb(20);
assert!(cfg.validate().is_ok());
assert_eq!(cfg.region_split_keys, Some(200000));
} | rust_cleaned_test_functions.jsonl/4792 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 613
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5332,
42681,
368,
341,
286,
1077,
5206,
13286,
284,
5532,
486,
2258,
543,
286,
13286,
19520,
1005,
15454,
1428,
286,
13286,
284,
5532,
486,
2258,
543,
286,
13286,
42976,
6345,
2368,
284,
4329,
7,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_clear_region() {
let fb = &mut new_fr_buf();
clear_region(fb, ClipRect::full_screen());
let seed = 0;
assert_eq!(m3hash::frame_buffer(fb, seed), 0x3A25F08C);
} | rust_cleaned_test_functions.jsonl/73859 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21811,
20627,
368,
341,
286,
1077,
25469,
284,
609,
6984,
501,
41537,
10363,
543,
286,
2797,
20627,
94034,
11,
29692,
4415,
486,
8878,
17649,
1423,
286,
1077,
10320,
284,
220,
15,
280,
286,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_checksum_even_returns_sum_of_evenly_divisible() {
let x = checksum_even("5 9 2 8\n9 4 7 3\n3 8 6 5");
assert_eq!(9, x);
} | rust_cleaned_test_functions.jsonl/103470 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 88
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64038,
68347,
58900,
10160,
3575,
68347,
398,
16237,
23066,
368,
341,
286,
1077,
856,
284,
32529,
68347,
445,
20,
220,
24,
220,
17,
220,
23,
1699,
24,
220,
19,
220,
22,
220,
18,
1699,
18,
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 |
#[test]
fn test_map() {
let mut map = std::collections::HashMap::new();
map.insert("Foo".to_string(), 4);
let x = Cc::new(map);
assert_eq!(x.get("Foo"), Some(&4));
} | rust_cleaned_test_functions.jsonl/110856 | {
"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,
5376,
368,
341,
286,
1077,
5206,
2415,
284,
1460,
486,
51137,
486,
18497,
486,
931,
1428,
286,
2415,
7030,
445,
40923,
3263,
983,
3904,
1507,
220,
19,
626,
286,
1077,
856,
284,
356,
66,
486,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_doc_comment_preserves_indents() {
let file = SourceFile::parse(
r#"
/// doc1
/// ```
/// fn foo() {
/// // ...
/// }
/// ```
mod foo {}
"#,
)
.ok()
.unwrap();
let module = file.syntax().descendants().find_map(Module::cast).unwrap();
assert_eq!(
" doc1\n ```\n fn foo() {\n // ...\n }\n ```",
module.doc_comments().doc_comment_text().unwrap()
);
} | rust_cleaned_test_functions.jsonl/60279 | {
"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,
18869,
17638,
32116,
13280,
9122,
805,
368,
341,
262,
1077,
1034,
284,
8748,
1703,
486,
6400,
1006,
286,
435,
2,
698,
286,
1048,
4629,
16,
198,
286,
1048,
41233,
286,
1048,
5168,
15229,
368,
341... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_type() {
let mut a = "/ip4/127.0.0.1/tcp/1337/ws".parse().unwrap();
assert_eq!(find_type(&a), TransportType::Ws);
a.pop();
a.push(Protocol::Wss);
assert_eq!(find_type(&a), TransportType::Wss);
a.pop();
assert_eq!(find_type(&a), TransportType::Tcp);
a.push(Protocol::Tls(Cow::Borrowed("")));
assert_eq!(find_type(&a), TransportType::Tls);
} | rust_cleaned_test_functions.jsonl/18293 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 228
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
1819,
368,
341,
286,
1077,
5206,
264,
284,
3521,
573,
19,
14,
16,
17,
22,
13,
15,
13,
15,
13,
16,
95958,
14,
16,
18,
18,
22,
91021,
3263,
6400,
1005,
15454,
1428,
286,
2060,
10714,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ldtk_int_cell_registrations() {
let mut app = App::new();
app.register_ldtk_int_cell_for_layer::<LdtkIntCellBundle>("layer", 1)
.register_ldtk_int_cell::<LdtkIntCellBundle>(2)
.register_default_ldtk_int_cell_for_layer::<LdtkIntCellBundle>(
"default_int_cell_for_layer",
)
.register_default_ldtk_int_cell::<LdtkIntCellBundle>();
let ldtk_int_cell_map = app.world.get_non_send_resource::<LdtkIntCellMap>().unwrap();
assert!(ldtk_int_cell_map.contains_key(&(Some("layer".to_string()), Some(1))));
assert!(ldtk_int_cell_map.contains_key(&(None, Some(2))));
assert!(
ldtk_int_cell_map.contains_key(&(Some("default_int_cell_for_layer".to_string()), None))
);
assert!(ldtk_int_cell_map.contains_key(&(None, None)));
} | rust_cleaned_test_functions.jsonl/4638 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 442
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
50573,
6242,
4042,
16648,
4920,
3758,
804,
368,
341,
286,
1077,
5206,
906,
284,
1845,
486,
931,
543,
286,
906,
9929,
50573,
6242,
4042,
16648,
5478,
12680,
27638,
43,
67,
6242,
1072,
3599,
8409,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_enable_statistics() {
let mut opts = DBOptions::new();
opts.enable_statistics(true);
opts.set_stats_dump_period_sec(60);
assert!(opts.get_statistics().is_some());
assert!(opts
.get_statistics_histogram(HistogramType::DbSeek)
.is_some());
assert!(opts
.get_statistics_histogram_string(HistogramType::DbSeek)
.is_some());
assert_eq!(
opts.get_statistics_ticker_count(TickerType::BlockCacheMiss),
0
);
assert_eq!(
opts.get_and_reset_statistics_ticker_count(TickerType::BlockCacheMiss),
0
);
assert_eq!(
opts.get_statistics_ticker_count(TickerType::BlockCacheMiss),
0
);
let opts = DBOptions::new();
assert!(opts.get_statistics().is_none());
} | rust_cleaned_test_functions.jsonl/34085 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 378
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18988,
49569,
368,
341,
262,
1077,
5206,
12185,
284,
5952,
3798,
486,
931,
543,
262,
12185,
28697,
49569,
3715,
317,
262,
12185,
980,
15381,
18296,
20818,
17242,
7,
21,
15,
317,
262,
2060,
10297,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_undefined_default_object_patterns() {
test(
"const {a = undefined} = obj;",
"const {a} = obj;",
);
test(
"const {a = void 0} = obj;",
"const {a} = obj;",
);
} | rust_cleaned_test_functions.jsonl/490 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
9614,
9993,
5314,
64923,
368,
341,
262,
1273,
1006,
286,
330,
1024,
314,
64,
284,
5614,
92,
284,
2839,
32503,
715,
286,
330,
1024,
314,
64,
92,
284,
2839,
64497,
262,
1439,
262,
1273,
1006... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vec_list_clear() {
let mut list = VecList::new();
let index = list.push_back(0);
list.clear();
assert!(list.is_empty());
assert_eq!(list.get(index), None);
} | rust_cleaned_test_functions.jsonl/11515 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
2019,
21811,
368,
341,
286,
1077,
5206,
1140,
284,
11312,
852,
486,
931,
543,
286,
1077,
1922,
284,
1140,
2552,
3895,
7,
15,
317,
286,
1140,
7426,
543,
286,
2060,
10297,
1607,
2079,
15124... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_vim_cmd_args_to_value() {
let cmdargs = ["rootPath=/tmp".to_owned()];
assert_eq!(
vim_cmd_args_to_value(&cmdargs).unwrap(),
json!({
"rootPath": "/tmp"
})
);
} | rust_cleaned_test_functions.jsonl/86861 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 123
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
318,
11684,
8384,
2346,
3142,
368,
341,
262,
1077,
5439,
2116,
284,
4383,
2888,
1820,
23286,
5173,
3263,
983,
51973,
33800,
262,
2060,
10714,
33673,
286,
36157,
11684,
8384,
2346,
3142,
2099,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_client_optimizer() {
solana_logger::setup();
const NUM_CLIENTS: usize = 5;
let optimizer = ClientOptimizer::new(NUM_CLIENTS);
(0..NUM_CLIENTS).into_par_iter().for_each(|_| {
let index = optimizer.experiment();
optimizer.report(index, (NUM_CLIENTS - index) as u64);
});
let index = optimizer.experiment();
optimizer.report(index, 50);
assert_eq!(optimizer.best(), NUM_CLIENTS - 1);
optimizer.report(optimizer.best(), std::u64::MAX);
assert_eq!(optimizer.best(), NUM_CLIENTS - 2);
} | rust_cleaned_test_functions.jsonl/13646 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 290
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8179,
68168,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
1428,
286,
733,
15943,
22521,
50,
25,
22301,
284,
220,
20,
280,
286,
1077,
25632,
284,
8423,
80637,
486,
931,
78928,
22521,
50,
317,
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_parse_input() {
let expected_called_numbers = vec![7, 4, 9, 5, 11, 17, 23, 2, 0, 14, 21, 24, 10, 16, 13, 6,
15, 25, 12, 22, 18, 20, 8, 19, 3, 26, 1
];
let (called_numbers, boards) = parse_input(&TEST_INPUT);
assert_eq!(called_numbers, expected_called_numbers);
assert_eq!(boards.len(), 3);
assert_eq!(boards[0].cells[0], [22, 13, 17, 11, 0]);
assert_eq!(boards[1].cells[1], [9, 18, 13, 17, 5]);
assert_eq!(boards[2].cells[3], [22, 11, 13, 6, 5]);
} | rust_cleaned_test_functions.jsonl/92172 | {
"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,
21039,
5898,
368,
341,
286,
1077,
3601,
27859,
32964,
284,
7486,
20703,
22,
11,
220,
19,
11,
220,
24,
11,
220,
20,
11,
220,
16,
16,
11,
220,
16,
22,
11,
220,
17,
18,
11,
220,
17,
11,
220... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_missing_resource_hint() -> TestResult {
let p = polar();
let repo_instance = ExternalInstance {
instance_id: 1,
constructor: None,
repr: None,
class_repr: None,
};
let repo_term = term!(Value::ExternalInstance(repo_instance.clone()));
let repo_name = sym!("Repository");
p.register_constant(repo_name.clone(), repo_term)?;
p.register_mro(repo_name, vec![repo_instance.instance_id])?;
let organization_instance = ExternalInstance {
instance_id: 2,
constructor: None,
repr: None,
class_repr: None,
};
let organization_term = term!(Value::ExternalInstance(organization_instance.clone()));
let organization_name = sym!("Organization");
p.register_constant(organization_name.clone(), organization_term)?;
p.register_mro(organization_name, vec![organization_instance.instance_id])?;
let user_instance = ExternalInstance {
instance_id: 3,
constructor: None,
repr: None,
class_repr: None,
};
let user_term = term!(Value::ExternalInstance(user_instance.clone()));
let user_name = sym!("User");
p.register_constant(user_name.clone(), user_term)?;
p.register_mro(user_name, vec![user_instance.instance_id])?;
let policy = r#"
actor User {}
resource Organization {
roles = ["owner"];
permissions = ["read"];
"read" if "owner";
}
has_role(user: User, "owner", organization: Organization) if
organization.owner_id = user.id;
has_role(user: User, "owner", repository: Repository) if
repository.owner_id = user.id;
"#;
qvalidation!(
p,
policy,
InvalidRule { .. },
"Perhaps you meant to add a resource block to your policy, like this:"
);
Ok(())
} | rust_cleaned_test_functions.jsonl/68132 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 718
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40447,
17962,
45825,
368,
1464,
3393,
2077,
341,
262,
1077,
281,
284,
24660,
1428,
262,
1077,
15867,
11904,
284,
30936,
2523,
341,
286,
2867,
842,
25,
220,
16,
345,
286,
4692,
25,
2240,
345,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
#[test]
fn test_dual_vec_atan() {
let res = DualVec64::<2>::new(0.2, StaticVec::new_vec([1.0, 1.0])).atan();
assert!((res.re - 0.197395559849881).abs() < 1e-12);
assert!((res.eps[0] - 0.961538461538462).abs() < 1e-12);
assert!((res.eps[1] - 0.961538461538462).abs() < 1e-12);
} | rust_cleaned_test_functions.jsonl/28621 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 158
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
96772,
13251,
3752,
276,
368,
341,
262,
1077,
592,
284,
33659,
10050,
21,
19,
27638,
17,
6831,
931,
7,
15,
13,
17,
11,
23105,
10050,
486,
931,
13251,
2561,
16,
13,
15,
11,
220,
16,
13,
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_range_step() {
assert!(range_step(0i, 20, 5).collect::<Vec<int>>() ==
vec![0, 5, 10, 15]);
assert!(range_step(20i, 0, -5).collect::<Vec<int>>() ==
vec![20, 15, 10, 5]);
assert!(range_step(20i, 0, -6).collect::<Vec<int>>() ==
vec![20, 14, 8, 2]);
assert!(range_step(200u8, 255, 50).collect::<Vec<u8>>() ==
vec![200u8, 250]);
assert!(range_step(200i, -5, 1).collect::<Vec<int>>() == vec![]);
assert!(range_step(200i, 200, 1).collect::<Vec<int>>() == vec![]);
} | rust_cleaned_test_functions.jsonl/7955 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 292
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9698,
11946,
368,
341,
262,
2060,
10297,
9669,
11946,
7,
15,
72,
11,
220,
17,
15,
11,
220,
20,
568,
17384,
27638,
10050,
4159,
61586,
47761,
310,
7486,
20703,
15,
11,
220,
20,
11,
220,
16,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_backlog_is_completed_with_none() {
let height = 9;
let path = "test-rocksdb/backlog_is_completed_with_none";
{
let backlog = Backlog {
priority: Some(Priority::BlockWithProof),
open_block: None,
proof: Some(generate_proof(height - 1)),
closed_block: Some(generate_closed_block(generate_block(height), path)),
};
assert_eq!(false, backlog.is_completed(), "block is none");
}
{
let block = generate_block(height);
let closed_block = generate_closed_block(block.clone(), path);
let backlog = Backlog {
priority: Some(Priority::BlockWithProof),
open_block: Some(block),
proof: None,
closed_block: Some(closed_block),
};
assert_eq!(false, backlog.is_completed(), "proof is none");
}
{
let open_block = generate_block(height);
let backlog = Backlog {
priority: Some(Priority::BlockWithProof),
open_block: Some(open_block),
proof: Some(generate_proof(height - 1)),
closed_block: None,
};
assert_eq!(false, backlog.is_completed(), "closed_block is none");
}
} | rust_cleaned_test_functions.jsonl/62107 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 707
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3895,
839,
6892,
49068,
6615,
31488,
368,
341,
286,
1077,
2608,
284,
220,
24,
280,
286,
1077,
1815,
284,
330,
1944,
51934,
14553,
1999,
59948,
839,
6892,
49068,
6615,
31488,
3302,
286,
341,
310,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_debug_error() {
let code = 6;
let msg = error_string(code);
let kind = decode_error_kind(code);
let err = Error {
repr: Repr::Custom(Box::new(Custom {
kind: ErrorKind::InvalidInput,
error: Box::new(Error {
repr: super::Repr::Os(code),
}),
})),
};
let expected = format!(
"Custom {{ \
kind: InvalidInput, \
error: Os {{ \
code: {:?}, \
kind: {:?}, \
message: {:?} \
}} \
}}",
code, kind, msg
);
assert_eq!(format!("{:?}", err), expected);
} | rust_cleaned_test_functions.jsonl/68168 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 254
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15446,
4096,
368,
341,
197,
10217,
2038,
284,
220,
21,
280,
197,
10217,
3750,
284,
1465,
3904,
15842,
317,
197,
10217,
3093,
284,
16895,
4096,
33162,
15842,
317,
197,
10217,
1848,
284,
4600,
341,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_qjsonvalue() {
let test_str = QJsonValue::from(QVariant::from(QString::from("test")));
let test_str2 = QJsonValue::from(QString::from("test"));
assert!(test_str == test_str2);
assert_eq!(<QJsonValue as Into<QString>>::into(test_str), QString::from("test"));
let test_bool = QJsonValue::from(true);
let test_bool_variant: QVariant = QJsonValue::from(true).into();
let test_bool_variant2 = QVariant::from(true);
assert!(test_bool_variant == test_bool_variant2);
assert_eq!(<QJsonValue as Into<bool>>::into(test_bool), true);
let test_f64 = QJsonValue::from(1.2345);
let test_f64_variant: QVariant = QJsonValue::from(1.2345).into();
let test_f64_variant2 = QVariant::from(1.2345);
assert!(test_f64_variant == test_f64_variant2);
assert_eq!(<QJsonValue as Into<f64>>::into(test_f64), 1.2345);
let values = QJsonArray::from(vec![
QJsonValue::from(QString::from("test")),
QJsonValue::from(true),
QJsonValue::from(false),
QJsonValue::from(1.2345),
QJsonValue::from(456.0),
]);
assert_eq!(values.to_json().to_string(), "[\"test\",true,false,1.2345,456]");
} | rust_cleaned_test_functions.jsonl/56765 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 532
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8976,
2236,
957,
368,
341,
262,
1077,
1273,
2895,
284,
1207,
93412,
486,
1499,
6253,
20746,
486,
1499,
20749,
486,
1499,
445,
1944,
17621,
262,
1077,
1273,
2895,
17,
284,
1207,
93412,
486,
1499,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_session_sampled_errors() {
let mut envelopes = crate::test::with_captured_envelopes_options(
|| {
sentry::start_session();
for _ in 0..100 {
let err = "NaN".parse::<usize>().unwrap_err();
sentry::capture_error(&err);
}
},
crate::ClientOptions {
release: Some("some-release".into()),
sample_rate: 0.5,
..Default::default()
},
);
assert!(envelopes.len() > 25);
assert!(envelopes.len() < 75);
let envelope = envelopes.pop().unwrap();
let mut items = envelope.items();
if let Some(EnvelopeItem::SessionUpdate(session)) = items.next() {
assert_eq!(session.status, SessionStatus::Exited);
assert_eq!(session.errors, 100);
} else {
panic!("expected session");
}
assert_eq!(items.next(), None);
} | rust_cleaned_test_functions.jsonl/115612 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 535
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12316,
17491,
67,
20196,
368,
341,
286,
1077,
5206,
86606,
284,
17717,
486,
1944,
486,
4197,
666,
80228,
6205,
1813,
288,
8743,
1006,
310,
1369,
341,
394,
3208,
884,
486,
2468,
12316,
1428,
394,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_1() {
let words = vec![
"gin".to_string(),
"zen".to_string(),
"gig".to_string(),
"msg".to_string(),
];
assert_eq!(Solution::unique_morse_representations(words), 2);
} | rust_cleaned_test_functions.jsonl/24265 | {
"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,
62,
16,
368,
341,
262,
1077,
4244,
284,
7486,
90515,
414,
330,
8163,
3263,
983,
3904,
3148,
414,
330,
5679,
3263,
983,
3904,
3148,
414,
330,
70,
343,
3263,
983,
3904,
3148,
414,
330,
3236,
326... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_jgt_reg() {
test_interpreter_and_jit_asm!(
"
mov r0, 0
mov r1, 5
mov r2, 6
mov r3, 4
jgt r1, r2, +2
jgt r1, r1, +1
jgt r1, r3, +1
exit
mov r0, 1
exit",
[],
(),
{ |_vm, res: Result| { res.unwrap() == 0x1 } },
9
);
} | rust_cleaned_test_functions.jsonl/59015 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 248
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5374,
5178,
4920,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
6228,
286,
1974,
435,
15,
11,
220,
15,
198,
286,
1974,
435,
16,
11,
220,
20,
198,
286,
1974,
435,
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_bank_hash_stats() {
solana_logger::setup();
let db = AccountsDb::new(Vec::new(), &ClusterType::Development);
let key = Pubkey::default();
let some_data_len = 5;
let some_slot: Slot = 0;
let account = AccountSharedData::new(1, some_data_len, &key);
let ancestors = vec![(some_slot, 0)].into_iter().collect();
db.store_uncached(some_slot, &[(&key, &account)]);
let mut account = db.load_without_fixed_root(&ancestors, &key).unwrap().0;
account.checked_sub_lamports(1).unwrap();
account.set_executable(true);
db.store_uncached(some_slot, &[(&key, &account)]);
db.add_root(some_slot);
let bank_hashes = db.bank_hashes.read().unwrap();
let bank_hash = bank_hashes.get(&some_slot).unwrap();
assert_eq!(bank_hash.stats.num_updated_accounts, 1);
assert_eq!(bank_hash.stats.num_removed_accounts, 1);
assert_eq!(bank_hash.stats.num_lamports_stored, 1);
assert_eq!(bank_hash.stats.total_data_len, 2 * some_data_len as u64);
assert_eq!(bank_hash.stats.num_executable_accounts, 1);
} | rust_cleaned_test_functions.jsonl/1376 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 527
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35733,
8950,
15381,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
2927,
284,
40655,
7994,
486,
931,
49923,
486,
931,
1507,
609,
28678,
929,
486,
39419,
626,
286,
1077,
1376,
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_parse_good() {
let res = "Munich,2015,23.1".parse::<Climate>();
assert_eq!(
res,
Ok(Climate {
city: "Munich".to_string(),
year: 2015,
temp: 23.1,
})
);
} | rust_cleaned_test_functions.jsonl/10209 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 186
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
44781,
368,
341,
286,
1077,
592,
284,
330,
44,
359,
713,
11,
17,
15,
16,
20,
11,
17,
18,
13,
16,
3263,
6400,
27638,
82046,
3913,
286,
2060,
10714,
33673,
310,
592,
345,
310,
7622,
436... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_message_from_buffer_returns_correct_message() {
use std::string::ToString;
let mut buf = Vec::new();
buf.push(1u8);
buf.push(1u8);
buf.push(6u8);
buf.push(0u8);
buf.extend_from_slice(b"\x00\x00\x00\x2A");
buf.extend_from_slice(b"\x04\x00");
buf.extend_from_slice(b"\x00\x00");
buf.extend_from_slice(b"\x00\x00\x00\x00");
buf.extend_from_slice(b"\xC0\xA8\x01\x01");
buf.extend_from_slice(b"\x00\x00\x00\x00");
buf.extend_from_slice(b"\x00\x00\x00\x00");
buf.extend_from_slice(b"\x00\x00\x00\x00\x00\x00");
buf.extend_from_slice(b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00");
buf.extend_from_slice(b"relay.example.com");
let mut old_len = buf.len();
let mut unused_bytes = SNAME_LEN - b"relay.example.com".len();
buf.resize(old_len + unused_bytes, 0u8);
buf.extend_from_slice(b"boot.img");
old_len = buf.len();
unused_bytes = FILE_LEN - b"boot.img".len();
buf.resize(old_len + unused_bytes, 0u8);
buf.extend_from_slice(&MAGIC_COOKIE);
buf.extend_from_slice(b"\x01\x04\xFF\xFF\xFF\x00");
buf.extend_from_slice(b"\x00");
buf.extend_from_slice(b"\x00");
buf.extend_from_slice(b"\x36\x04\xAA\xBB\xCC\xDD");
buf.extend_from_slice(b"\xFF");
let got = Message::from_buffer(&buf).unwrap();
let opt_want1 = ConfigOption {
code: OptionCode::SubnetMask,
value: vec![255, 255, 255, 0],
};
let opt_want2 = ConfigOption {
code: OptionCode::ServerId,
value: vec![0xAA, 0xBB, 0xCC, 0xDD],
};
let want = Message {
op: OpCode::BOOTREQUEST,
xid: 42,
secs: 1024,
bdcast_flag: false,
ciaddr: Ipv4Addr::new(0, 0, 0, 0),
yiaddr: Ipv4Addr::new(192, 168, 1, 1),
siaddr: Ipv4Addr::new(0, 0, 0, 0),
giaddr: Ipv4Addr::new(0, 0, 0, 0),
chaddr: MacAddr {
octets: [0, 0, 0, 0, 0, 0],
},
sname: "relay.example.com".to_string(),
file: "boot.img".to_string(),
options: vec![opt_want1, opt_want2],
};
assert_eq!(got, want);
} | rust_cleaned_test_functions.jsonl/93669 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1350
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6462,
5673,
7776,
58900,
31550,
6462,
368,
341,
286,
990,
1460,
486,
917,
486,
5870,
401,
286,
1077,
5206,
6607,
284,
11312,
486,
931,
543,
286,
6607,
2552,
7,
16,
84,
23,
317,
286,
6607,
2552... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_txn_store_gc2_with_long_key_prefix() {
test_txn_store_gc_multiple_tuplespaceInstanton(1024, MAX_TXN_WRITE_SIZE / 1024 * 3);
} | rust_cleaned_test_functions.jsonl/120735 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 70
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
92299,
14809,
49423,
17,
6615,
17799,
3097,
13974,
368,
341,
262,
1273,
92299,
14809,
49423,
45233,
89269,
1306,
30340,
263,
7,
16,
15,
17,
19,
11,
8334,
18819,
45,
17475,
4098,
608,
220,
16,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_quat_identity() {
let identity = Quat::identity();
assert!(identity.is_near_identity());
assert!(identity.is_normalized());
assert_eq!(identity, Quat::from_xyzw(0.0, 0.0, 0.0, 1.0));
assert_eq!(identity, identity * identity);
let q = Quat::from_rotation_ypr(deg(10.0), deg(-10.0), deg(45.0));
assert_eq!(q, q * identity);
assert_eq!(q, identity * q);
assert_eq!(identity, Quat::default());
} | rust_cleaned_test_functions.jsonl/73794 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 204
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11280,
266,
46244,
368,
341,
262,
1077,
9569,
284,
3406,
266,
486,
16912,
543,
262,
2060,
10297,
16912,
2079,
76340,
46244,
1423,
262,
2060,
10297,
16912,
2079,
80006,
1423,
262,
2060,
10714,
10297,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_superimpose() {
let x = (*SYNTAX_STYLE, 'a');
let pairs = vec![(&x, (*SYNTAX_HIGHLIGHTED_STYLE, 'a'))];
assert_eq!(
superimpose(pairs),
vec![((*SYNTAX_STYLE, *SYNTAX_HIGHLIGHTED_STYLE), 'a')]
);
} | rust_cleaned_test_functions.jsonl/13392 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 201
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38886,
318,
2900,
368,
341,
310,
1077,
856,
284,
4609,
18416,
78221,
41775,
11,
364,
64,
1157,
310,
1077,
13530,
284,
7486,
20703,
2099,
87,
11,
4609,
18416,
78221,
2039,
90031,
1479,
41775,
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_print_debug() -> Result<(), Box<EvalAltResult>> {
let logbook = Arc::new(RwLock::new(Vec::<String>::new()));
// Redirect print/debug output to 'log'
let log1 = logbook.clone();
let log2 = logbook.clone();
let mut engine = Engine::new();
engine
.on_print(move |s| log1.write().unwrap().push(format!("entry: {}", s)))
.on_debug(move |s, src, pos| {
log2.write().unwrap().push(format!(
"DEBUG of {} at {:?}: {}",
src.unwrap_or("unknown"),
pos,
s
))
});
// Evaluate script
engine.consume("print(40 + 2)")?;
let mut ast = engine.compile(r#"let x = "hello!"; debug(x)"#)?;
ast.set_source("world");
engine.consume_ast(&ast)?;
// 'logbook' captures all the 'print' and 'debug' output
assert_eq!(logbook.read().unwrap().len(), 2);
assert_eq!(logbook.read().unwrap()[0], "entry: 42");
assert_eq!(
logbook.read().unwrap()[1],
r#"DEBUG of world at 1:19: "hello!""#
);
for entry in logbook.read().unwrap().iter() {
println!("{}", entry);
}
Ok(())
} | rust_cleaned_test_functions.jsonl/52271 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 560
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10064,
15446,
368,
1464,
5714,
68843,
8261,
23835,
831,
26017,
2077,
2452,
341,
262,
1077,
1487,
2190,
284,
19689,
486,
931,
2785,
86,
11989,
486,
931,
49923,
27638,
703,
6831,
931,
25138,
262,
44... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_strip() {
let segwit_tx = "020000000001019c644affd9c62cef3a13c4d2facc4284bcce3f1769d4aeda062413ece120ffc80100000000ffffffff029b660900000000001600147a5d9c9672cb9c788c2b7f217a8b35af6e3f7e8bdee60300000000001976a914228e6b93d66a870fabb41dd064dedbd14804431388ac024730440220453ca5656c155e63bea0af0e83d59ea7097c3cc5bfef5abade3c7d49435fcc3a0220404c3d469fbcee2ace5bf5963440eb78ca63c40c2fe80547026a48009ed0009e01210336d86e06d33b04ed236d280590f1a6d0c6eb7f703b7fe78cc1d71122d0c4f9be00000000";
let segwit_tx: Transaction = deserialize(&hex::decode(segwit_tx).unwrap()).unwrap();
let stripped = strip_witness(&segwit_tx);
assert_eq!(segwit_tx.txid(), stripped.txid());
assert!(stripped.get_weight() < segwit_tx.get_weight());
} | rust_cleaned_test_functions.jsonl/116945 | {
"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,
66130,
368,
341,
286,
1077,
4810,
88519,
17805,
284,
330,
15,
17,
15,
15,
15,
15,
15,
15,
15,
15,
15,
16,
15,
16,
24,
66,
21,
19,
19,
2649,
67,
24,
66,
21,
17,
65041,
18,
64,
16,
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_set_all() {
let mut bv = BitVec::new(3);
bv.set_all(true);
assert_eq!(bv.iter().collect::<Vec<bool>>(), vec![true, true, true]);
bv.set_all(false);
assert_eq!(bv.iter().collect::<Vec<bool>>(), vec![false, false, false]);
} | rust_cleaned_test_functions.jsonl/128593 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 151
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
5705,
368,
341,
286,
1077,
5206,
56937,
284,
6495,
10050,
486,
931,
7,
18,
626,
286,
56937,
980,
5705,
3715,
317,
286,
2060,
10714,
10297,
54929,
19471,
1005,
17384,
27638,
10050,
17028,
245... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
test_parse_ok(vec![
("null", None::<String>),
("\"jodhpurs\"", Some("jodhpurs".to_string())),
]);
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
struct Foo {
x: Option<isize>,
}
let value: Foo = from_str("{}").unwrap();
assert_eq!(value, Foo { x: None });
test_parse_ok(vec![
("{\"x\": null}", Foo { x: None }),
("{\"x\": 5}", Foo { x: Some(5) }),
]);
} | rust_cleaned_test_functions.jsonl/29842 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 241
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
9672,
368,
341,
262,
1273,
21039,
19817,
25592,
90515,
286,
3489,
2921,
497,
2240,
27638,
703,
29,
1326,
286,
3489,
2105,
73,
347,
21197,
1723,
55853,
4329,
445,
73,
347,
21197,
1723,
3263,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_thread_signal_set_mask() {
let prev_mask = SigSet::thread_get_mask().expect("Failed to get existing signal mask!");
let mut test_mask = prev_mask;
test_mask.add(SIGUSR1);
assert!(test_mask.thread_set_mask().is_ok());
let new_mask = SigSet::thread_get_mask().expect("Failed to get new mask!");
assert!(new_mask.contains(SIGUSR1));
assert!(!new_mask.contains(SIGUSR2));
prev_mask.thread_set_mask().expect("Failed to revert signal mask!");
} | rust_cleaned_test_functions.jsonl/8927 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 237
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10814,
21137,
2602,
9999,
368,
341,
286,
1077,
7872,
9999,
284,
41560,
1649,
486,
4528,
3062,
9999,
1005,
17119,
445,
9408,
311,
633,
6350,
8286,
6911,
57073,
286,
1077,
5206,
1273,
9999,
284,
787... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_no_panic_on_missing_kind() {
wrapper(|env| {
let db = env.db();
let id = env
.fake_release()
.name("strum")
.version("0.13.0")
.create()?;
// https://stackoverflow.com/questions/18209625/how-do-i-modify-fields-inside-the-new-postgresql-json-datatype
db.conn().query(
r#"UPDATE releases SET dependencies = dependencies::jsonb #- '{0,2}' WHERE id = $1"#,
&[&id],
)?;
let web = env.frontend();
assert_success("/strum/0.13.0/strum/", web)?;
assert_success("/crate/strum/0.13.0/", web)?;
Ok(())
})
} | rust_cleaned_test_functions.jsonl/13870 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 432
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
620,
31270,
4470,
40447,
33162,
368,
341,
286,
13261,
22428,
3160,
91,
341,
310,
1077,
2927,
284,
6105,
7076,
543,
310,
1077,
877,
284,
6105,
198,
394,
659,
30570,
24577,
741,
394,
659,
60... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_process_entries_2nd_entry_collision_with_self_and_error() {
solana_logger::setup();
let GenesisConfigInfo {
genesis_config,
mint_keypair,
..
} = create_genesis_config(1000);
let bank = Arc::new(Bank::new(&genesis_config));
let keypair1 = Keypair::new();
let keypair2 = Keypair::new();
let keypair3 = Keypair::new();
// fund: put some money in each of 1 and 2
assert_matches!(bank.transfer(5, &mint_keypair, &keypair1.pubkey()), Ok(_));
assert_matches!(bank.transfer(4, &mint_keypair, &keypair2.pubkey()), Ok(_));
let entry_1_to_mint = next_entry(
&bank.last_blockhash(),
1,
vec![system_transaction::transfer(
&keypair1,
&mint_keypair.pubkey(),
1,
bank.last_blockhash(),
)],
);
// should now be:
// keypair1=4
// keypair2=4
// keypair3=0
let entry_2_to_3_and_1_to_mint = next_entry(
&entry_1_to_mint.hash,
1,
vec![
system_transaction::transfer(
&keypair2,
&keypair3.pubkey(),
2,
bank.last_blockhash(),
), // should be fine
system_transaction::transfer(
&keypair1,
&mint_keypair.pubkey(),
2,
bank.last_blockhash(),
), // will collide with predecessor
],
);
// should now be:
// keypair1=2
// keypair2=2
// keypair3=2
let entry_conflict_itself = next_entry(
&entry_2_to_3_and_1_to_mint.hash,
1,
vec![
system_transaction::transfer(
&keypair1,
&keypair3.pubkey(),
1,
bank.last_blockhash(),
),
system_transaction::transfer(
&keypair1,
&keypair2.pubkey(),
1,
bank.last_blockhash(),
), // should be fine
],
);
// would now be:
// keypair1=0
// keypair2=3
// keypair3=3
assert!(process_entries(
&bank,
&mut [
entry_1_to_mint,
entry_2_to_3_and_1_to_mint,
entry_conflict_itself,
],
false,
None,
None,
)
.is_err());
// last entry should have been aborted before par_execute_entries
assert_eq!(bank.get_balance(&keypair1.pubkey()), 2);
assert_eq!(bank.get_balance(&keypair2.pubkey()), 2);
assert_eq!(bank.get_balance(&keypair3.pubkey()), 2);
} | rust_cleaned_test_functions.jsonl/47536 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1770
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
26092,
62,
17,
303,
9078,
70375,
6615,
25637,
8378,
4096,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
1428,
286,
1077,
40788,
2648,
1731,
341,
310,
59366,
5332,
345,
310,
28337,
3097,
126... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_single_bit() {
let mut fb = FooBar(0);
fb.set_foo1(1);
assert_eq!(0x1, fb.0);
assert_eq!(0x1, fb.foo1());
assert_eq!(0x0, fb.foo2());
assert_eq!(false, fb.single_bit());
assert_eq!(-1, fb.signed_single_bit());
fb.set_foo2(1);
assert_eq!(0x8000_0001, fb.0);
assert_eq!(0x1, fb.foo1());
assert_eq!(0x1, fb.foo2());
assert_eq!(false, fb.single_bit());
assert_eq!(-1, fb.signed_single_bit());
fb.set_foo1(0);
assert_eq!(0x8000_0000, fb.0);
assert_eq!(0x0, fb.foo1());
assert_eq!(0x1, fb.foo2());
assert_eq!(false, fb.single_bit());
assert_eq!(0, fb.signed_single_bit());
fb.set_single_bit(true);
assert_eq!(0x8000_0008, fb.0);
assert_eq!(0x0, fb.foo1());
assert_eq!(0x1, fb.foo2());
assert_eq!(true, fb.single_bit());
assert_eq!(0, fb.signed_single_bit());
fb.set_signed_single_bit(-1);
assert_eq!(0x8000_0009, fb.0);
assert_eq!(0x1, fb.foo1());
assert_eq!(0x1, fb.foo2());
assert_eq!(true, fb.single_bit());
assert_eq!(-1, fb.signed_single_bit());
} | rust_cleaned_test_functions.jsonl/2261 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 589
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19487,
13996,
368,
341,
262,
1077,
5206,
25469,
284,
33428,
3428,
7,
15,
626,
262,
25469,
980,
761,
2624,
16,
7,
16,
317,
262,
2060,
10714,
10297,
15,
87,
16,
11,
25469,
13,
15,
317,
262,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_base_directory() {
let te = TestEnv::new(DEFAULT_DIRS, DEFAULT_FILES);
te.assert_output(
&["--base-directory", "one"],
"b.foo
two
two/c.foo
two/C.Foo2
two/three
two/three/d.foo
two/three/directory_foo",
);
te.assert_output(
&["--base-directory", "one/two", "foo"],
"c.foo
C.Foo2
three/d.foo
three/directory_foo",
);
// Explicit root path
te.assert_output(
&["--base-directory", "one", "foo", "two"],
"two/c.foo
two/C.Foo2
two/three/d.foo
two/three/directory_foo",
);
// Ignore base directory when absolute path is used
let (te, abs_path) = get_test_env_with_abs_path(DEFAULT_DIRS, DEFAULT_FILES);
let abs_base_dir = &format!("{abs_path}/one/two", abs_path = &abs_path);
te.assert_output(
&["--base-directory", &abs_base_dir, "foo", &abs_path],
&format!(
"{abs_path}/a.foo
{abs_path}/one/b.foo
{abs_path}/one/two/c.foo
{abs_path}/one/two/C.Foo2
{abs_path}/one/two/three/d.foo
{abs_path}/one/two/three/directory_foo",
abs_path = &abs_path
),
);
} | rust_cleaned_test_functions.jsonl/10898 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 688
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7651,
14846,
368,
341,
262,
1077,
1013,
284,
3393,
14359,
486,
931,
43175,
90560,
11,
11955,
48010,
626,
262,
1013,
3713,
7645,
1006,
286,
609,
1183,
313,
3152,
53634,
497,
330,
603,
8097,
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_tcp_sack_nomatch() {
test_interpreter_and_jit_asm!(
TCP_SACK_ASM,
TCP_SACK_NOMATCH,
(),
{ |_vm, res: Result| res.unwrap() == 0x0 },
55
);
} | rust_cleaned_test_functions.jsonl/59078 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45562,
643,
473,
53475,
754,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
26656,
1098,
4032,
86906,
345,
286,
26656,
1098,
4032,
1604,
1898,
8884,
345,
286,
84201,
286,
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_has_startfn() {
let wasm: Vec<u8> = vec![
0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x04, 0x01, 0x60, 0x00, 0x00,
0x03, 0x02, 0x01, 0x00, 0x07, 0x08, 0x01, 0x04, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00,
0x08, 0x01, 0x00, 0x0a, 0x04, 0x01, 0x02, 0x00, 0x0b,
];
let mut checker = EcicChecker::default(&wasm);
assert_eq!(
checker.checks.get_check_status("no-startfn"),
CheckStatus::Unknown
);
checker.fire();
assert_eq!(
checker.checks.get_check_status("no-startfn"),
CheckStatus::Malformed
);
} | rust_cleaned_test_functions.jsonl/10748 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 413
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21778,
4906,
8822,
368,
341,
286,
1077,
98263,
25,
11312,
34837,
23,
29,
284,
7486,
90515,
310,
220,
15,
87,
15,
15,
11,
220,
15,
87,
21,
16,
11,
220,
15,
87,
22,
18,
11,
220,
15,
87,
21... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_const() {
let s = Syntax::default();
assert_eq!(
super::parse("{{ FOO }}", &s).unwrap(),
vec![Node::Expr(Ws(false, false), Expr::Path(vec!["FOO"]))],
);
assert_eq!(
super::parse("{{ FOO_BAR }}", &s).unwrap(),
vec![Node::Expr(Ws(false, false), Expr::Path(vec!["FOO_BAR"]))],
);
assert_eq!(
super::parse("{{ NONE }}", &s).unwrap(),
vec![Node::Expr(Ws(false, false), Expr::Path(vec!["NONE"]))],
);
} | rust_cleaned_test_functions.jsonl/50222 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 310
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
13610,
368,
341,
286,
1077,
274,
284,
32117,
486,
2258,
1428,
286,
2060,
10714,
33673,
310,
2256,
486,
6400,
445,
2979,
434,
19499,
3869,
497,
609,
82,
568,
15454,
3148,
310,
7486,
20703,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_unassigned_planes() {
assert_eq!(DT::of('\u{30000}'), None);
assert_eq!(DT::of('\u{40000}'), None);
assert_eq!(DT::of('\u{50000}'), None);
assert_eq!(DT::of('\u{60000}'), None);
assert_eq!(DT::of('\u{70000}'), None);
assert_eq!(DT::of('\u{80000}'), None);
assert_eq!(DT::of('\u{90000}'), None);
assert_eq!(DT::of('\u{a0000}'), None);
} | rust_cleaned_test_functions.jsonl/109929 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 234
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4907,
39021,
75340,
368,
341,
286,
2060,
10714,
10297,
10599,
486,
1055,
11024,
84,
90,
18,
15,
15,
15,
15,
92,
4567,
2240,
317,
286,
2060,
10714,
10297,
10599,
486,
1055,
11024,
84,
90,
19,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_owned() {
let gil = Python::acquire_gil();
let py = gil.python();
let obj = get_object(py);
let obj_ptr = obj.as_ptr();
// Ensure that obj does not get freed
let _ref = obj.clone_ref(py);
unsafe {
{
let pool = py.new_pool();
gil::register_owned(pool.python(), NonNull::new_unchecked(obj.into_ptr()));
assert_eq!(owned_object_count(), 1);
assert_eq!(ffi::Py_REFCNT(obj_ptr), 2);
}
{
let _pool = py.new_pool();
assert_eq!(owned_object_count(), 0);
assert_eq!(ffi::Py_REFCNT(obj_ptr), 1);
}
}
} | rust_cleaned_test_functions.jsonl/25425 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 423
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51973,
368,
341,
286,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
286,
1077,
4510,
284,
342,
321,
43193,
543,
286,
1077,
2839,
284,
633,
5314,
46827,
317,
286,
1077,
2839,
4348,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_limbs_less_than_limb_constant_time() {
static LESSER: &[(&[Limb], Limb)] = &[
(&[0], 1),
(&[0, 0], 1),
(&[1, 0], 2),
(&[2, 0], 3),
(&[2, 0], 3),
(&[MAX - 1], MAX),
(&[MAX - 1, 0], MAX),
];
for &(a, b) in LESSER {
assert_eq!(limbs_less_than_limb_constant_time(a, b), LimbMask::True);
}
static EQUAL: &[(&[Limb], Limb)] = &[
(&[0], 0),
(&[0, 0, 0, 0], 0),
(&[1], 1),
(&[1, 0, 0, 0, 0, 0, 0], 1),
(&[MAX], MAX),
];
static GREATER: &[(&[Limb], Limb)] = &[
(&[1], 0),
(&[2, 0], 1),
(&[3, 0, 0, 0], 1),
(&[0, 1, 0, 0], 1),
(&[0, 0, 1, 0], 1),
(&[0, 0, 1, 1], 1),
(&[MAX], MAX - 1),
];
for &(a, b) in EQUAL.iter().chain(GREATER.iter()) {
assert_eq!(limbs_less_than_limb_constant_time(a, b), LimbMask::False);
}
} | rust_cleaned_test_functions.jsonl/10664 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 691
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58191,
1279,
50747,
51613,
907,
20828,
34967,
3009,
368,
341,
286,
1099,
74948,
640,
25,
44590,
2099,
58,
43,
20828,
1125,
13589,
65,
7252,
284,
609,
9640,
310,
15899,
58,
15,
1125,
220,
16,
132... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_mac_spoofing_detection() {
let mut net = Net::default_net(TestMutators::default());
let guest_mac = MacAddr::parse_str("11:11:11:11:11:11").unwrap();
let not_guest_mac = MacAddr::parse_str("33:33:33:33:33:33").unwrap();
let guest_ip = Ipv4Addr::new(10, 1, 2, 3);
let dst_mac = MacAddr::parse_str("22:22:22:22:22:22").unwrap();
let dst_ip = Ipv4Addr::new(10, 1, 1, 1);
let packet_len;
{
// Create an ethernet frame.
let eth_frame_i = EthernetFrame::write_incomplete(
frame_bytes_from_buf_mut(&mut net.tx_frame_buf),
dst_mac,
guest_mac,
ETHERTYPE_ARP,
)
.ok()
.unwrap();
// Set its length to hold an ARP request.
let mut eth_frame_complete = eth_frame_i.with_payload_len_unchecked(ETH_IPV4_FRAME_LEN);
// Save the total frame length.
packet_len = vnet_hdr_len() + eth_frame_complete.payload_offset() + ETH_IPV4_FRAME_LEN;
// Create the ARP request.
let arp_req = EthIPv4ArpFrame::write_request(
eth_frame_complete.payload_mut(),
guest_mac,
guest_ip,
dst_mac,
dst_ip,
);
// Validate success.
assert!(arp_req.is_ok());
}
// Check that a legit MAC doesn't affect the spoofed MAC metric.
check_metric_after_block!(
&METRICS.net.tx_spoofed_mac_count,
0,
Net::write_to_mmds_or_tap(
net.mmds_ns.as_mut(),
&mut net.tx_rate_limiter,
&net.tx_frame_buf[..packet_len],
&mut net.tap,
Some(guest_mac),
)
);
// Check that a spoofed MAC increases our spoofed MAC metric.
check_metric_after_block!(
&METRICS.net.tx_spoofed_mac_count,
1,
Net::write_to_mmds_or_tap(
net.mmds_ns.as_mut(),
&mut net.tx_rate_limiter,
&net.tx_frame_buf[..packet_len],
&mut net.tap,
Some(not_guest_mac),
)
);
} | rust_cleaned_test_functions.jsonl/63425 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1313
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22802,
643,
5368,
1055,
287,
57505,
368,
341,
286,
1077,
5206,
4179,
284,
9374,
486,
2258,
19722,
31159,
51440,
2973,
486,
2258,
5231,
286,
1077,
8640,
22802,
284,
7401,
13986,
486,
6400,
2895,
44... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_uncle_hash_case2() {
let (shared, chain1, chain2) = prepare();
let dummy_context = dummy_context(&shared);
let uncles: UncleBlockVec = vec![chain2.last().cloned().unwrap().data().as_uncle()].pack();
let uncles_hash = uncles.calc_uncles_hash();
let block = chain1
.last()
.cloned()
.unwrap()
.as_advanced_builder()
.uncles_count(0u32.pack())
.uncles_hash(uncles_hash.clone().pack())
.build_unchecked();
let epoch = epoch(&shared, &chain1, chain1.len() - 2);
let uncle_verifier_context = UncleVerifierContext::new(&dummy_context, &epoch);
let verifier = UnclesVerifier::new(uncle_verifier_context, &block);
assert_eq!(
verifier.verify(),
Err(Error::Uncles(UnclesError::InvalidHash {
expected: uncles_hash,
actual: H256::zero(),
}))
);
} | rust_cleaned_test_functions.jsonl/118899 | {
"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,
31433,
76576,
273,
8950,
19096,
17,
368,
341,
262,
1077,
320,
6100,
11,
8781,
16,
11,
8781,
17,
8,
284,
10549,
543,
262,
1077,
17292,
8467,
284,
17292,
8467,
2099,
6100,
626,
1066,
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_error_from_ffi_error() {
let ffi_err = FfiError {
variant: "FailedFunction".to_char_p(),
message: "Eat my shorts!".to_char_p(),
backtrace: "".to_char_p(),
};
let err: Error = ffi_err.into();
assert_eq!(err, err!(FailedFunction, "Eat my shorts!"))
} | rust_cleaned_test_functions.jsonl/31441 | {
"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,
4096,
5673,
62,
53799,
4096,
368,
341,
286,
1077,
76956,
9266,
284,
434,
9983,
1454,
341,
310,
11424,
25,
330,
9408,
5152,
3263,
983,
9232,
620,
3148,
310,
1943,
25,
330,
88611,
847,
35776,
9299... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_word() {
expect_mapping!("hello" => Token::word("hello"));
expect_mapping!("ab cd" => Token::word("ab"),
Token::word("cd"),
Token::new_line());
expect_mapping!("a b c d" => Token::word("a"),
Token::word("b"),
Token::word("c"),
Token::word("d"),
Token::new_line());
} | rust_cleaned_test_functions.jsonl/39346 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 350
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13533,
368,
341,
286,
1720,
26930,
17223,
14990,
1,
589,
9660,
486,
1158,
445,
14990,
14929,
286,
1720,
26930,
17223,
370,
15307,
1,
589,
9660,
486,
1158,
445,
370,
4461,
9699,
9660,
486,
1158,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cycle() {
{
let mut gcs = vec![Gc::new(Cyclic {
prev: GcCell::new(None),
name: 0,
})];
for i in 1..4 {
let prev = gcs[i - 1].clone();
gcs.push(Gc::new(Cyclic {
prev: GcCell::new(Some(prev)),
name: i as u8,
}));
}
let last = gcs[3].clone();
*gcs[0].prev.borrow_mut() = Some(last);
}
println!("Before collection: {:?}", COUNTER.with(|s| s.get()));
force_collect();
println!("After collection: {:?}", COUNTER.with(|s| s.get()));
assert_eq!(COUNTER.with(|s| s.get()), 4);
} | rust_cleaned_test_functions.jsonl/12372 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 429
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39079,
368,
341,
262,
341,
286,
1077,
5206,
342,
4837,
284,
7486,
20703,
38,
66,
486,
931,
3025,
65304,
341,
7561,
7872,
25,
479,
66,
3599,
486,
931,
26717,
1326,
7561,
829,
25,
220,
15,
345,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_aes128_ecb_dec() {
let key = hex::decode("2b7e151628aed2a6abf7158809cf4f3c").unwrap();
let mut cipher = Aes128Ecb::new(&key);
let ciphertext = hex::decode("\
3ad77bb40d7a3660a89ecaf32466ef97\
f5d3d58503b9699de785895a96fdbaaf\
43b1cd7f598ece23881b00e3ed030688\
7b0c785e27e8ad3f8223207104725dd4").unwrap();
let mut plaintext = ciphertext.clone();
cipher.decrypt(&mut plaintext);
assert_eq!(&plaintext[..], &hex::decode("\
6bc1bee22e409f96e93d7e117393172a\
ae2d8a571e03ac9c9eb76fac45af8e51\
30c81c46a35ce411e5fbc1191a0a52ef\
f69f2445df4f9b17ad2b417be66c3710").unwrap()[..]);
} | rust_cleaned_test_functions.jsonl/49283 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 334
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
90958,
16,
17,
23,
36844,
65,
13783,
368,
341,
9401,
262,
1077,
1376,
256,
284,
12371,
486,
18196,
445,
17,
65,
22,
68,
16,
20,
16,
21,
17,
23,
61454,
17,
64,
21,
370,
69,
22,
16,
20,
23... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_executor_one_block() {
let executor = TestExecutor::new();
let parent_block_id = *GENESIS_BLOCK_ID;
let block_id = gen_block_id(1);
let version = 100;
let txns = (0..version)
.map(|i| wrap_user_txn(encode_mint_transaction(gen_address(i), 100)))
.collect::<Vec<_>>();
let execute_block_future = executor.execute_block(
txns.clone(),
executor.committed_trees(),
parent_block_id,
block_id,
);
let (output, state_compute_result) = block_on(execute_block_future).unwrap().unwrap();
assert_eq!(state_compute_result.version(), 100);
let ledger_info = gen_ledger_info(version, state_compute_result.root_hash(), block_id, 1);
let commit_block_future = executor.commit_blocks(
vec![CommittableBlock::new(txns, Arc::new(output))],
ledger_info,
);
block_on(commit_block_future).unwrap().unwrap();
} | rust_cleaned_test_functions.jsonl/73894 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 402
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
81207,
11667,
7113,
368,
341,
262,
1077,
31558,
284,
3393,
25255,
486,
931,
1428,
262,
1077,
2681,
7113,
842,
284,
353,
11085,
83366,
18756,
3450,
280,
262,
1077,
2504,
842,
284,
4081,
7113,
842,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_internally_b_roundtrip() {
let v = EnumStructInternally::VariantB {
foo: 1,
bar: 2,
};
test_roundtrip(v);
} | rust_cleaned_test_functions.jsonl/110486 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 82
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4042,
932,
745,
880,
29896,
32981,
368,
341,
262,
1077,
348,
284,
14086,
9422,
67916,
745,
486,
20746,
33,
341,
286,
15229,
25,
220,
16,
345,
286,
3619,
25,
220,
17,
345,
262,
2605,
262,
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 |
#[test]
fn test_parse_valid_cloudfront_get_streaming_distribution() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/valid",
"cloudfront-get-streaming-distribution.xml",
);
let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
let client =
CloudFrontClient::new_with(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = GetStreamingDistributionRequest::default();
let result = client.get_streaming_distribution(request).sync();
assert!(result.is_ok(), "parse error: {:?}", result);
} | rust_cleaned_test_functions.jsonl/44881 | {
"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,
21039,
8337,
37356,
6951,
3062,
12673,
287,
41465,
368,
341,
286,
1077,
7860,
9655,
284,
14563,
2582,
5062,
486,
878,
9655,
1006,
310,
330,
1944,
35569,
79372,
14,
1891,
756,
310,
330,
12361,
6951... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_buffer_into() {
let v0 = vec![0u8, 1, 2, 3, 4, 5];
let v1 = v0.clone();
let buf = Buffer::<u16>::from_vec(v0);
let v2: Vec<u8> = buf.into();
assert_eq!(v1, v2);
} | rust_cleaned_test_functions.jsonl/26913 | {
"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,
7776,
45514,
368,
341,
262,
1077,
348,
15,
284,
7486,
20703,
15,
84,
23,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
935,
262,
1077,
348,
16,
284,
348,
15,
15997,
54... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_arpa_name() {
assert!(Name::from_ascii("168.192.in-addr.arpa")
.unwrap()
.parse_arpa_name()
.is_err());
assert!(Name::from_ascii("host.example.com.")
.unwrap()
.parse_arpa_name()
.is_err());
assert!(Name::from_ascii("caffee.ip6.arpa.")
.unwrap()
.parse_arpa_name()
.is_err());
assert!(Name::from_ascii(
"1.4.3.3.7.0.7.3.0.E.2.A.8.9.1.3.1.3.D.8.0.3.A.5.8.8.B.D.0.1.0.0.2.ip6.arpa."
)
.unwrap()
.parse_arpa_name()
.is_err());
assert!(Name::from_ascii("caffee.in-addr.arpa.")
.unwrap()
.parse_arpa_name()
.is_err());
assert!(Name::from_ascii("1.2.3.4.5.in-addr.arpa.")
.unwrap()
.parse_arpa_name()
.is_err());
assert!(Name::from_ascii("1.2.3.4.home.arpa.")
.unwrap()
.parse_arpa_name()
.is_err());
assert_eq!(
Name::from_ascii("168.192.in-addr.arpa.")
.unwrap()
.parse_arpa_name()
.unwrap(),
IpNet::V4(Ipv4Net::new("192.168.0.0".parse().unwrap(), 16).unwrap())
);
assert_eq!(
Name::from_ascii("1.0.168.192.in-addr.arpa.")
.unwrap()
.parse_arpa_name()
.unwrap(),
IpNet::V4(Ipv4Net::new("192.168.0.1".parse().unwrap(), 32).unwrap())
);
assert_eq!(
Name::from_ascii("0.1.0.0.2.ip6.arpa.")
.unwrap()
.parse_arpa_name()
.unwrap(),
IpNet::V6(Ipv6Net::new("2001::".parse().unwrap(), 20).unwrap())
);
assert_eq!(
Name::from_ascii("D.0.1.0.0.2.ip6.arpa.")
.unwrap()
.parse_arpa_name()
.unwrap(),
IpNet::V6(Ipv6Net::new("2001:d00::".parse().unwrap(), 24).unwrap())
);
assert_eq!(
Name::from_ascii("B.D.0.1.0.0.2.ip6.arpa.")
.unwrap()
.parse_arpa_name()
.unwrap(),
IpNet::V6(Ipv6Net::new("2001:db0::".parse().unwrap(), 28).unwrap())
);
assert_eq!(
Name::from_ascii("8.B.D.0.1.0.0.2.ip6.arpa.")
.unwrap()
.parse_arpa_name()
.unwrap(),
IpNet::V6(Ipv6Net::new("2001:db8::".parse().unwrap(), 32).unwrap())
);
assert_eq!(
Name::from_ascii(
"4.3.3.7.0.7.3.0.E.2.A.8.9.1.3.1.3.D.8.0.3.A.5.8.8.B.D.0.1.0.0.2.ip6.arpa."
)
.unwrap()
.parse_arpa_name()
.unwrap(),
IpNet::V6(
Ipv6Net::new("2001:db8:85a3:8d3:1319:8a2e:370:7334".parse().unwrap(), 128).unwrap()
)
);
} | rust_cleaned_test_functions.jsonl/38226 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1964
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
25842,
6595,
1269,
368,
341,
286,
2060,
10297,
675,
486,
1499,
50238,
445,
16,
21,
23,
13,
16,
24,
17,
1858,
12,
6214,
16711,
6595,
1138,
310,
659,
15454,
741,
310,
659,
6400,
25842,
65... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_log_option() {
let (inspector, mut node) = inspector_and_list_node();
inspect_log!(node, some?: Some("a"));
inspect_log!(node, none?: None as Option<String>);
assert_data_tree!(inspector, root: {
list_node: {
"0": { "@time": AnyProperty, some: "a" },
"1": { "@time": AnyProperty },
}
});
} | rust_cleaned_test_functions.jsonl/96862 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 215
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5224,
9672,
368,
341,
286,
1077,
320,
1330,
18997,
11,
5206,
2436,
8,
284,
44725,
8378,
2019,
5084,
1428,
286,
24085,
5224,
10297,
3509,
11,
1045,
4820,
4329,
445,
64,
4010,
286,
24085,
5224,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_last_match() {
let haystack = "111 a 111b".to_string();
search_test!(&haystack, "b", Some(9));
} | rust_cleaned_test_functions.jsonl/19403 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 70
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12195,
10708,
368,
341,
286,
1077,
88447,
284,
330,
16,
16,
16,
264,
220,
16,
16,
16,
65,
3263,
983,
3904,
543,
286,
2711,
4452,
0,
2099,
67312,
7693,
11,
330,
65,
497,
4329,
7,
24,
1106,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_account_shared_data_deserialize() {
let key = Pubkey::new_unique();
let (_account1, account2) = make_two_accounts(&key);
account2.deserialize_data::<String>().unwrap();
} | rust_cleaned_test_functions.jsonl/48201 | {
"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,
13500,
20405,
1769,
15768,
9050,
368,
341,
286,
1077,
1376,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
5453,
4608,
16,
11,
2692,
17,
8,
284,
1281,
23241,
55665,
2099,
792,
317,
286,
2692,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_guild_status() {
let value = GuildStatus::Offline(UnavailableGuild {
id: GuildId::new(1).expect("non zero"),
unavailable: true,
});
serde_test::assert_tokens(
&value,
&[
Token::Struct {
name: "UnavailableGuild",
len: 2,
},
Token::Str("id"),
Token::NewtypeStruct { name: "GuildId" },
Token::Str("1"),
Token::Str("unavailable"),
Token::Bool(true),
Token::StructEnd,
],
);
} | rust_cleaned_test_functions.jsonl/80061 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 398
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1889,
1498,
4773,
368,
341,
286,
1077,
897,
284,
32492,
2522,
486,
52563,
49289,
10334,
72574,
341,
310,
877,
25,
32492,
764,
486,
931,
7,
16,
568,
17119,
445,
6280,
7168,
4461,
310,
34987,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_slicing() {
let s = TinyString::<[u8; 16]>::from("foobar");
assert_eq!("foobar", &s[..]);
assert_eq!("foo", &s[..3]);
assert_eq!("bar", &s[3..]);
assert_eq!("oob", &s[1..4]);
} | rust_cleaned_test_functions.jsonl/3639 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
89114,
368,
341,
10217,
274,
284,
47974,
703,
27638,
58,
84,
23,
26,
220,
16,
21,
60,
6831,
1499,
445,
50267,
797,
6948,
10714,
17223,
50267,
497,
609,
82,
95874,
2558,
6948,
10714,
17223,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_delete_guild_sticker() {
let route = Route::DeleteGuildSticker {
guild_id: GUILD_ID,
sticker_id: STICKER_ID,
};
assert_eq!(
route.to_string(),
format!(
"guilds/{guild_id}/stickers/{sticker_id}",
guild_id = GUILD_ID,
sticker_id = STICKER_ID
)
);
} | rust_cleaned_test_functions.jsonl/119935 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 255
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11353,
1889,
1498,
1261,
5215,
368,
341,
286,
1077,
6021,
284,
9572,
486,
6435,
72574,
623,
5215,
341,
310,
26411,
842,
25,
479,
18023,
3450,
345,
310,
46177,
842,
25,
3928,
10685,
640,
3450,
34... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_header_samples() {
let vcf = Reader::from_path(&"test/test_string.vcf").expect("Error opening file.");
let header = &vcf.header();
assert_eq!(header.id_to_sample(Id(0)), b"one");
assert_eq!(header.id_to_sample(Id(1)), b"two");
assert_eq!(header.sample_to_id(b"one").unwrap(), Id(0));
assert_eq!(header.sample_to_id(b"two").unwrap(), Id(1));
assert!(header.sample_to_id(b"three").is_err());
} | rust_cleaned_test_functions.jsonl/8768 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 227
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8757,
18297,
368,
341,
286,
1077,
348,
9792,
284,
25166,
486,
1499,
2638,
2099,
1,
1944,
12697,
3904,
3133,
9792,
1827,
17119,
445,
1454,
8568,
1034,
7320,
286,
1077,
4247,
284,
609,
7362,
69,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_validate_non_genesis_write_set() {
let vm_validator = TestValidator::new();
// Confirm that a correct transaction is validated successfully.
let address = account_config::aptos_root_address();
let transaction = transaction_test_helpers::get_write_set_txn(
address,
1,
&vm_genesis::GENESIS_KEYPAIR.0,
vm_genesis::GENESIS_KEYPAIR.1.clone(),
None,
)
.into_inner();
let ret = vm_validator.validate_transaction(transaction).unwrap();
assert!(ret.status().is_none());
// A WriteSet txn is only valid when sent from the root account.
let bad_transaction = transaction_test_helpers::get_write_set_txn(
account_config::treasury_compliance_account_address(),
1,
&vm_genesis::GENESIS_KEYPAIR.0,
vm_genesis::GENESIS_KEYPAIR.1.clone(),
None,
)
.into_inner();
let ret = vm_validator.validate_transaction(bad_transaction).unwrap();
assert_eq!(ret.status().unwrap(), StatusCode::REJECTED_WRITE_SET);
} | rust_cleaned_test_functions.jsonl/35414 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 437
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
21637,
16322,
13774,
9165,
2602,
368,
341,
262,
1077,
10995,
64959,
284,
3393,
14256,
486,
931,
1428,
262,
442,
33563,
429,
264,
4396,
7745,
374,
32332,
7790,
624,
262,
1077,
2621,
284,
269... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_insensitivity() {
let mut hm = HashMap::new();
hm.insert('a', 2);
assert_eq!(frequency::frequency(&["aA"], 4), hm);
} | rust_cleaned_test_functions.jsonl/13545 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 71
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19096,
34386,
47837,
368,
341,
262,
1077,
5206,
49362,
284,
10528,
486,
931,
543,
262,
49362,
7030,
492,
64,
516,
220,
17,
317,
262,
2060,
10714,
10297,
46521,
486,
46521,
2099,
1183,
64,
32,
79... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_introduce_var_last_expr() {
covers!(test_introduce_var_last_expr);
check_assist_range(
introduce_variable,
"
fn foo() {
bar(<|>1 + 1<|>)
}",
"
fn foo() {
let <|>var_name = 1 + 1;
bar(var_name)
}",
);
check_assist_range(
introduce_variable,
"
fn foo() {
<|>bar(1 + 1)<|>
}",
"
fn foo() {
let <|>var_name = bar(1 + 1);
var_name
}",
)
} | rust_cleaned_test_functions.jsonl/5711 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 297
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4042,
47845,
4612,
12195,
21915,
368,
341,
286,
14521,
10297,
1944,
4042,
47845,
4612,
12195,
21915,
317,
286,
1779,
12083,
380,
9698,
1006,
310,
19131,
14635,
345,
310,
6228,
8822,
15229,
368,
341,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_quote() {
assert_eq!(quote(" ", &[]).ok().unwrap(), "%20");
assert_eq!(quote(" ".to_string(), &[]).ok().unwrap(), "%20");
assert_eq!(quote("test@example.com", &[]).ok().unwrap(), "test%40example.com");
assert_eq!(quote("123!'#$%&()", &[]).ok().unwrap(), "123%21%27%23%24%25%26%28%29");
assert_eq!(quote("/a/テスト !/", &[b'/']).ok().unwrap(), "/a/%E3%83%86%E3%82%B9%E3%83%88%20%21/");
} | rust_cleaned_test_functions.jsonl/21616 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45236,
368,
341,
262,
2060,
10714,
10297,
2949,
445,
3670,
609,
1294,
568,
562,
1005,
15454,
1507,
5962,
17,
15,
797,
262,
2060,
10714,
10297,
2949,
445,
5933,
983,
3904,
1507,
609,
1294,
568,
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_dashmap_secondary_index() {
let (key_start, key_end, account_index) = create_dashmap_secondary_index_state();
let index = AccountsIndex::<bool>::default();
run_test_secondary_indexes(
&index,
&index.spl_token_mint_index,
key_start,
key_end,
&account_index,
);
} | rust_cleaned_test_functions.jsonl/2242 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 194
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
84585,
2186,
77759,
3560,
368,
341,
286,
1077,
320,
792,
4906,
11,
1376,
6213,
11,
2692,
3560,
8,
284,
1855,
84585,
2186,
77759,
3560,
4387,
543,
286,
1077,
1922,
284,
40655,
1552,
27638,
2641,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_repeating() {
let mut tfd = TimerFd::new().expect("failed to create timerfd");
let dur = Duration::from_millis(200);
let interval = Duration::from_millis(100);
tfd.reset(dur, Some(interval)).expect("failed to arm timer");
sleep(dur * 3);
let count = tfd.wait().expect("unable to wait for timer");
assert!(count >= 5, "count = {}", count);
tfd.clear().expect("unable to clear the timer");
assert!(!tfd.is_armed().unwrap());
} | rust_cleaned_test_functions.jsonl/66518 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 229
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
64877,
368,
341,
286,
1077,
5206,
6409,
67,
284,
17759,
74476,
486,
931,
1005,
17119,
445,
16091,
311,
1855,
9021,
6902,
3071,
286,
1077,
10651,
284,
21045,
486,
1499,
717,
56212,
7,
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... | 1 |
#[test]
fn test_low_level_pbkdf2() {
let django = Django {
version: DjangoVersion::V1_9,
};
let encoded = django.make_password_with_settings("lètmein", "seasalt2", Algorithm::PBKDF2);
assert!(
encoded
== "pbkdf2_sha256$24000$seasalt2$TUDkfilKHVC7BkaKSZgIKhm0aTtXlmcw/5C1FeS/DPk="
.to_string()
);
assert!(check_password("lètmein", &encoded).unwrap());
} | rust_cleaned_test_functions.jsonl/104136 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 226
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23767,
8274,
31409,
74,
2940,
17,
368,
341,
262,
1077,
8262,
284,
52604,
341,
286,
2319,
25,
52604,
5637,
486,
53,
16,
62,
24,
345,
262,
2605,
262,
1077,
20498,
284,
8262,
10117,
10122,
6615,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_spawn_avrcp_client_target() -> Result<(), Error> {
let mut exec = fasync::TestExecutor::new().expect("TestExecutor should be created");
let (peer_manager_proxy, peer_manager_requests) =
create_proxy_and_stream::<PeerManagerMarker>()?;
let (client_sender, mut service_request_receiver) = mpsc::channel(512);
let fail_fn = |_controller: Controller, _fidl_stream: ControllerRequestStream| {
panic!("Shouldn't have spawned a controller!");
};
let (target_client, _target_server) =
create_endpoints::<TargetHandlerMarker>().expect("Target proxy creation");
let request_fut = peer_manager_proxy.register_target_handler(target_client);
pin_mut!(request_fut);
let handler_fut =
avrcp_client_stream_handler(peer_manager_requests, client_sender, fail_fn);
pin_mut!(handler_fut);
// Make the request.
assert!(exec.run_until_stalled(&mut request_fut).is_pending());
// Running the stream handler should produce a request to register a target
assert!(exec.run_until_stalled(&mut handler_fut).is_pending());
let request = service_request_receiver.try_next()?.expect("a request should be made");
match request {
ServiceRequest::RegisterTargetHandler { target_handler: _, reply } => {
reply.send(Ok(())).expect("Reply should succeed");
}
x => panic!("Unexpected request from client stream: {:?}", x),
};
// The requestr should be answered.
assert!(exec.run_until_stalled(&mut handler_fut).is_pending());
assert_matches!(exec.run_until_stalled(&mut request_fut), Poll::Ready(Ok(Ok(()))));
drop(peer_manager_proxy);
// The handler should end when the client is closed.
assert_matches!(exec.run_until_stalled(&mut handler_fut), Poll::Ready(Ok(())));
Ok(())
} | rust_cleaned_test_functions.jsonl/75838 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 809
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
76026,
26173,
1287,
79,
8179,
11123,
368,
1464,
5714,
68843,
4600,
29,
341,
286,
1077,
5206,
3883,
284,
282,
7692,
486,
2271,
25255,
486,
931,
1005,
17119,
445,
2271,
25255,
1265,
387,
3465,
797,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_execute_update_msg_caller() {
with_hypervisor(|hypervisor, tmp_path| {
let id = user_test_id(12);
assert_eq!(
execute_update_on(
&hypervisor,
MSG_CALLER_WAT,
"update_test",
EMPTY_PAYLOAD,
Some(id),
None,
tmp_path.clone(),
)
.2,
CallContextAction::Reply {
payload: id.get().into_vec(),
refund: Cycles::from(0),
},
);
let id = user_test_id(32);
assert_eq!(
execute_update_on(
&hypervisor,
MSG_CALLER_WAT,
"update_test",
EMPTY_PAYLOAD,
Some(id),
None,
tmp_path,
)
.2,
CallContextAction::Reply {
payload: id.get().into_vec(),
refund: Cycles::from(0),
},
);
});
} | rust_cleaned_test_functions.jsonl/123307 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 683
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44329,
8882,
6483,
13429,
261,
368,
341,
262,
448,
1523,
1082,
31396,
22428,
78243,
31396,
11,
4174,
2638,
91,
341,
286,
1077,
877,
284,
1196,
4452,
842,
7,
16,
17,
317,
286,
2060,
10714,
33673,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_predict_bhepred() {
let expected: Vec<u8> = vec![5, 0, 0, 0, 0,
4, 4, 4, 4, 4,
3, 3, 3, 3, 3,
2, 2, 2, 2, 2,
1, 1, 1, 1, 1];
let mut im = vec![5, 0, 0, 0, 0,
4, 0, 0, 0, 0,
3, 0, 0, 0, 0,
2, 0, 0, 0, 0,
1, 0, 0, 0, 0];
predict_bhepred(& mut im, 1, 1, 5);
for (&e, i) in expected.iter().zip(im) {
assert_eq!(e, i);
}
} | rust_cleaned_test_functions.jsonl/66061 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 383
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26815,
880,
383,
23464,
368,
341,
286,
1077,
3601,
25,
11312,
34837,
23,
29,
284,
7486,
20703,
20,
11,
220,
15,
11,
220,
15,
11,
220,
15,
11,
220,
15,
345,
1060,
220,
19,
11,
220,
19,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_glob() {
let (_tmp, path) = tmpdir("test-glob");
touch(path.clone() + "/a");
touch(path.clone() + "/b");
touch(path.clone() + "/c");
assert!(glob(path.clone() + "/*").len() == 3);
} | rust_cleaned_test_functions.jsonl/74389 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
95133,
368,
341,
220,
1077,
5453,
5173,
11,
1815,
8,
284,
4174,
3741,
445,
1944,
2371,
1684,
797,
220,
5796,
5581,
15997,
368,
488,
3521,
64,
797,
220,
5796,
5581,
15997,
368,
488,
3521,
65,
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_parse_param() {
assert_eq!(HumanReadableParser::parse_type("address").unwrap(), ParamType::Address);
assert_eq!(HumanReadableParser::parse_type("bytes").unwrap(), ParamType::Bytes);
assert_eq!(HumanReadableParser::parse_type("bytes32").unwrap(), ParamType::FixedBytes(32));
assert_eq!(HumanReadableParser::parse_type("bool").unwrap(), ParamType::Bool);
assert_eq!(HumanReadableParser::parse_type("string").unwrap(), ParamType::String);
assert_eq!(HumanReadableParser::parse_type("int").unwrap(), ParamType::Int(256));
assert_eq!(HumanReadableParser::parse_type("uint").unwrap(), ParamType::Uint(256));
assert_eq!(
HumanReadableParser::parse_type(
"
int32"
)
.unwrap(),
ParamType::Int(32)
);
assert_eq!(HumanReadableParser::parse_type("uint32").unwrap(), ParamType::Uint(32));
} | rust_cleaned_test_functions.jsonl/77863 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 413
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
4090,
368,
341,
286,
2060,
10714,
10297,
33975,
57938,
6570,
486,
6400,
1819,
445,
4995,
1827,
15454,
1507,
6991,
929,
486,
4286,
317,
286,
2060,
10714,
10297,
33975,
57938,
6570,
486,
6400,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_zip321_parse_simple() {
let uri = "zcash:ytestsapling1qqqqqqqqqqqqqqqqqrjq05nyfku05msvu49mawhg6kr0wwljahypwyk2h88z6975u563j9k7cxg?amount=3768769.02796286&message=";
let parse_result = TransactionRequest::from_uri(&TEST_NETWORK, &uri).unwrap();
let expected = TransactionRequest {
payments: vec![
Payment {
recipient_address: RecipientAddress::Shielded(decode_payment_address(&TEST_NETWORK.hrp_sapling_payment_address(), "ytestsapling1qqqqqqqqqqqqqqqqqrjq05nyfku05msvu49mawhg6kr0wwljahypwyk2h88z6975u563j9k7cxg").unwrap().unwrap()),
amount: Amount::from_u64(376876902796286).unwrap(),
memo: None,
label: None,
message: Some("".to_string()),
other_params: vec![],
}
]
};
assert_eq!(parse_result, expected);
} | rust_cleaned_test_functions.jsonl/81782 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 510
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42131,
18,
17,
16,
21039,
30015,
368,
341,
286,
1077,
13071,
284,
330,
34968,
988,
69203,
23841,
391,
2718,
16,
27579,
27579,
27579,
27579,
27579,
27579,
27579,
27579,
23004,
43915,
15,
20,
3834,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_record_literal_field() {
check(
r#"
struct A { the_field: u32 }
fn foo() {
A { the$0 }
}
"#,
expect![[r#"
fd the_field u32
"#]],
);
} | rust_cleaned_test_functions.jsonl/39747 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14192,
34100,
5013,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
1235,
362,
314,
279,
5013,
25,
575,
18,
17,
456,
8822,
15229,
368,
341,
256,
362,
314,
279,
3,
15,
456,
532,
57676,
345,
310,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_localize_child_peer_overlap() {
let (_, layer_indices) = ClusterInfo::describe_data_plane(500_000, 200);
let last_ix = layer_indices.len() - 1;
// sample every 33 pairs to reduce test time
for x in (0..*layer_indices.get(last_ix - 2).unwrap()).step_by(33) {
let me_locality = ClusterInfo::localize(&layer_indices, 200, x);
let buddy_locality = ClusterInfo::localize(&layer_indices, 200, x + 1);
assert!(!me_locality.next_layer_peers.is_empty());
assert!(!buddy_locality.next_layer_peers.is_empty());
me_locality
.next_layer_peers
.iter()
.zip(buddy_locality.next_layer_peers.iter())
.for_each(|(x, y)| assert_ne!(x, y));
}
} | rust_cleaned_test_functions.jsonl/12815 | {
"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,
13564,
551,
17268,
45159,
65794,
368,
341,
286,
1077,
39464,
6193,
18333,
8,
284,
35380,
1731,
486,
12332,
1769,
46023,
7,
20,
15,
15,
62,
15,
15,
15,
11,
220,
17,
15,
15,
317,
286,
1077,
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_try_finish_snapshot() {
let td = Builder::new().prefix("tikv-store-test").tempdir().unwrap();
let worker = LazyWorker::new("snap-manager");
let sched = worker.scheduler();
let mut s = new_storage(sched, &td);
// PENDING can be finished.
let mut snap_state = SnapState::Applying(Arc::new(AtomicUsize::new(JOB_STATUS_PENDING)));
s.snap_state = RefCell::new(snap_state);
assert_eq!(s.check_applying_snap(), CheckApplyingSnapStatus::Applying);
assert_eq!(
*s.snap_state.borrow(),
SnapState::Applying(Arc::new(AtomicUsize::new(JOB_STATUS_PENDING)))
);
// RUNNING can't be finished.
snap_state = SnapState::Applying(Arc::new(AtomicUsize::new(JOB_STATUS_RUNNING)));
s.snap_state = RefCell::new(snap_state);
assert_eq!(s.check_applying_snap(), CheckApplyingSnapStatus::Applying);
assert_eq!(
*s.snap_state.borrow(),
SnapState::Applying(Arc::new(AtomicUsize::new(JOB_STATUS_RUNNING)))
);
snap_state = SnapState::Applying(Arc::new(AtomicUsize::new(JOB_STATUS_CANCELLED)));
s.snap_state = RefCell::new(snap_state);
assert_eq!(s.check_applying_snap(), CheckApplyingSnapStatus::Idle);
assert_eq!(*s.snap_state.borrow(), SnapState::ApplyAborted);
// ApplyAborted is not applying snapshot.
assert_eq!(s.check_applying_snap(), CheckApplyingSnapStatus::Idle);
assert_eq!(*s.snap_state.borrow(), SnapState::ApplyAborted);
s.snap_state = RefCell::new(SnapState::Applying(Arc::new(AtomicUsize::new(
JOB_STATUS_FINISHED,
))));
assert_eq!(s.check_applying_snap(), CheckApplyingSnapStatus::Success);
assert_eq!(*s.snap_state.borrow(), SnapState::Relax);
// Relax is not applying snapshot.
assert_eq!(s.check_applying_snap(), CheckApplyingSnapStatus::Idle);
assert_eq!(*s.snap_state.borrow(), SnapState::Relax);
s.snap_state = RefCell::new(SnapState::Applying(Arc::new(AtomicUsize::new(
JOB_STATUS_FAILED,
))));
let res = panic_hook::recover_safe(|| s.check_applying_snap());
assert!(res.is_err());
} | rust_cleaned_test_functions.jsonl/12751 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1024
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
42980,
53265,
368,
341,
286,
1077,
17941,
284,
20626,
486,
931,
1005,
11849,
445,
83,
1579,
85,
33252,
16839,
1827,
3888,
3741,
1005,
15454,
543,
286,
1077,
11864,
284,
44263,
21936,
486,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_reset_escape_function() {
let no_escape: super::EscapeFn = |input| input.to_string();
let mut tera = Tera::default();
tera.add_raw_template("foo", "{{ content }}").unwrap();
tera.autoescape_on(vec!["foo"]);
tera.set_escape_fn(no_escape);
tera.reset_escape_fn();
let mut context = Context::new();
context.insert("content", &"Hello\n\'world\"!");
let result = tera.render("foo", &context).unwrap();
assert_eq!(result, "Hello\n'world"!");
} | rust_cleaned_test_functions.jsonl/87549 | {
"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,
18983,
21832,
9174,
368,
341,
286,
1077,
902,
21832,
25,
2256,
486,
48124,
24911,
284,
760,
1355,
91,
1946,
2389,
3904,
543,
286,
1077,
5206,
1982,
64,
284,
350,
2416,
486,
2258,
543,
286,
1982,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_nth_bit() {
assert_eq!(nth_bit(0b10000000, 0), 1);
for i in 1..8 {
assert_eq!(nth_bit(0b10000000, i), 0);
}
assert_eq!(nth_bit(0b01000000, 1), 1);
assert_eq!(nth_bit(0b00100000, 2), 1);
assert_eq!(nth_bit(0b00010000, 3), 1);
assert_eq!(nth_bit(0b00001000, 4), 1);
assert_eq!(nth_bit(0b00000100, 5), 1);
assert_eq!(nth_bit(0b00000010, 6), 1);
assert_eq!(nth_bit(0b00000001, 7), 1);
} | rust_cleaned_test_functions.jsonl/99211 | {
"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,
78342,
13996,
368,
341,
262,
2060,
10714,
10297,
51738,
13996,
7,
15,
65,
16,
15,
15,
15,
15,
15,
15,
15,
11,
220,
15,
701,
220,
16,
317,
262,
369,
600,
304,
220,
16,
496,
23,
341,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_add() {
let v1 = Vec4::new(1.0, 2.0, 3.0, 4.0);
let v2 = Vec4::new(1.0, 2.0, 3.0, 4.0);
assert_eq!(v1 + v2, Vec4::new(2.0, 4.0, 6.0, 8.0));
} | rust_cleaned_test_functions.jsonl/38321 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 128
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
368,
341,
286,
1077,
348,
16,
284,
11312,
19,
486,
931,
7,
16,
13,
15,
11,
220,
17,
13,
15,
11,
220,
18,
13,
15,
11,
220,
19,
13,
15,
317,
286,
1077,
348,
17,
284,
11312,
19,
486... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_revoke_transfer_claim() {
new_test_ext().execute_with(|| {
let claim = vec![1,2,3];
// create
assert_ok!(PoeModule::create_claim(Origin::signed(1), claim.clone()));
// transfer
assert_ok!(PoeModule::transfer_claim(Origin::signed(1), 2, claim.clone()));
// revoke
assert_ok!(PoeModule::revoke_claim(Origin::signed(2), claim.clone()));
});
} | rust_cleaned_test_functions.jsonl/12046 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 157
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
1288,
7621,
35403,
84969,
368,
341,
8638,
4452,
9927,
1005,
10257,
6615,
79453,
341,
197,
10217,
3717,
284,
7486,
20703,
16,
11,
17,
11,
18,
4821,
197,
197,
322,
1855,
198,
197,
6948,
1981... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_snippet_with_no_terms() {
let text = "a b c d";
let terms = BTreeMap::new();
let fragments = search_fragments(&From::from(SimpleTokenizer), &text, &terms, 3);
assert_eq!(fragments.len(), 0);
let snippet = select_best_fragment_combination(&fragments[..], &text);
assert_eq!(snippet.fragments, "");
assert_eq!(snippet.to_html(), "");
} | rust_cleaned_test_functions.jsonl/609 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 195
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28022,
21581,
6615,
6536,
37498,
368,
341,
286,
1077,
1467,
284,
330,
64,
293,
272,
294,
3302,
286,
1077,
3793,
284,
425,
6533,
2227,
486,
931,
543,
286,
1077,
34503,
284,
2711,
761,
41956,
2099... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_t511() {
init();
let result = t511(vec![
"tenpay.com",
"openmobile.qq.com",
"docs.qq.com",
"connect.qq.com",
"qzone.qq.com",
"vip.qq.com",
"gamecenter.qq.com",
"qun.qq.com",
"game.qq.com",
"qqweb.qq.com",
"office.qq.com",
"ti.qq.com",
"mail.qq.com",
"mma.qq.com",
]);
println!("{}", result.len());
println!("{:?}", result);
} | rust_cleaned_test_functions.jsonl/104752 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 367
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
528,
20,
16,
16,
368,
341,
286,
2930,
543,
286,
1077,
1102,
284,
259,
20,
16,
16,
25592,
90515,
310,
330,
1960,
13890,
905,
756,
310,
330,
2508,
14933,
60239,
905,
756,
310,
330,
14120,
60239,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_lookup_uses_positive_min_ttl() {
let now = Instant::now();
let name = Name::from_str("www.example.com.").unwrap();
let query = Query::query(name.clone(), RecordType::A);
// record should have TTL of 1 second.
let ips_ttl = vec![(
Record::from_rdata(name.clone(), 1, RData::A(Ipv4Addr::new(127, 0, 0, 1))),
1,
)];
let ips = vec![RData::A(Ipv4Addr::new(127, 0, 0, 1))];
// configure the cache with a minimum TTL of 2 seconds.
let ttls = TtlConfig {
positive_min_ttl: Some(Duration::from_secs(2)),
..Default::default()
};
let lru = DnsLru::new(1, ttls);
let rc_ips = lru.insert(query.clone(), ips_ttl, now);
assert_eq!(*rc_ips.iter().next().unwrap(), ips[0]);
// query's TTL was below the minimum.
assert_eq!(rc_ips.valid_until(), now + Duration::from_secs(2));
// record should have TTL of 3 seconds.
let ips_ttl = vec![(
Record::from_rdata(name, 3, RData::A(Ipv4Addr::new(127, 0, 0, 1))),
3,
)];
let rc_ips = lru.insert(query, ips_ttl, now);
assert_eq!(*rc_ips.iter().next().unwrap(), ips[0]);
// greater than the cache's minimum.
assert_eq!(rc_ips.valid_until(), now + Duration::from_secs(3));
} | rust_cleaned_test_functions.jsonl/2127 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 699
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
27464,
62,
4776,
54160,
7260,
87157,
368,
341,
286,
1077,
1431,
284,
18058,
486,
3328,
1428,
286,
1077,
829,
284,
3988,
486,
1499,
2895,
445,
2136,
7724,
905,
98401,
15454,
543,
286,
1077,
3239,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hmac_sha2_256() {
let key = b"key";
let data = b"The quick brown fox jumps over the lazy dog";
let result = "f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8";
assert_eq!(&hex::encode(&HmacSha256::oneshot(key, data)), result);
} | rust_cleaned_test_functions.jsonl/12664 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 130
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1523,
11948,
48836,
17,
62,
17,
20,
21,
368,
341,
262,
1077,
1376,
284,
293,
1,
792,
876,
262,
1077,
821,
284,
293,
10022,
3974,
13876,
38835,
34208,
916,
279,
15678,
5562,
876,
262,
1077,
110... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.