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_md5() {
assert_eq!(md5(b""), hex("d41d8cd98f00b204e9800998ecf8427e").unwrap());
assert_eq!(md5(b"a"), hex("0cc175b9c0f1b6a831c399e269772661").unwrap());
assert_eq!(
md5(b"abc"),
hex("900150983cd24fb0d6963f7d28e17f72").unwrap()
);
assert_eq!(
md5(b"message digest"),
hex("f96b697d7cb7938d525a2f31aaf161d0").unwrap()
);
assert_eq!(
md5(b"abcdefghijklmnopqrstuvwxyz"),
hex("c3fcd3d76192e4007dfb496cca67e13b").unwrap()
);
assert_eq!(
md5(b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"),
hex("d174ab98d277d9f5a5611c2c9f419d9f").unwrap()
);
assert_eq!(
md5(b"12345678901234567890123456789012345678901\
234567890123456789012345678901234567890"),
hex("57edf4a22be3c955ac49da2e2107b67a").unwrap()
);
} | rust_cleaned_test_functions.jsonl/126698 | {
"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,
32994,
20,
368,
341,
286,
2060,
10714,
10297,
2277,
20,
1883,
3014,
701,
12371,
445,
67,
19,
16,
67,
23,
4385,
24,
23,
69,
15,
15,
65,
17,
15,
19,
68,
24,
23,
15,
15,
24,
24,
23,
757,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_validation() {
let value = AllowedMentionsBuilder::new()
.users()
.user_ids(vec![UserId(100), UserId(200)])
.roles()
.role_ids(vec![RoleId(300)])
.build();
assert_eq!(
value,
AllowedMentions {
parse: vec![],
users: vec![UserId(100), UserId(200)],
roles: vec![RoleId(300)],
replied_user: false,
},
);
} | rust_cleaned_test_functions.jsonl/35179 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 316
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19416,
368,
341,
286,
1077,
897,
284,
57622,
44,
63701,
3297,
486,
931,
741,
310,
659,
4218,
741,
310,
659,
872,
8077,
25592,
20703,
13504,
7,
16,
15,
15,
701,
40883,
7,
17,
15,
15,
27144,
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_type_03() {
let ast = check_parse("type t = bool;");
check_name(ast.get(0),"t");
assert!(matches!(ast.get(1),Node::BoolType));
} | rust_cleaned_test_functions.jsonl/96533 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 77
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1819,
62,
15,
18,
368,
341,
262,
1077,
11763,
284,
1779,
21039,
445,
1313,
259,
284,
1807,
34649,
262,
1779,
1269,
52574,
670,
7,
15,
35393,
83,
797,
262,
2060,
10297,
19914,
10297,
559,
670,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_pull_assignment_up_field_assignment() {
cov_mark::check!(test_pull_assignment_up_field_assignment);
check_assist(
pull_assignment_up,
r#"
struct A(usize);
fn foo() {
let mut a = A(1);
if true {
$0a.0 = 2;
} else {
a.0 = 3;
}
}"#,
r#"
struct A(usize);
fn foo() {
let mut a = A(1);
a.0 = if true {
2
} else {
3
};
}"#,
)
} | rust_cleaned_test_functions.jsonl/117258 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 280
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
65693,
51891,
8237,
5013,
51891,
368,
341,
286,
21836,
18924,
486,
2028,
10297,
1944,
65693,
51891,
8237,
5013,
51891,
317,
286,
1779,
12083,
380,
1006,
310,
6815,
51891,
8237,
345,
310,
435,
2,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_nonzero_i8() {
let test = assert_de_tokens_error::<NonZeroI8>;
// from zero
test(
&[Token::I8(0)],
"invalid value: integer `0`, expected a nonzero i8",
);
test(
&[Token::I16(0)],
"invalid value: integer `0`, expected a nonzero i8",
);
test(
&[Token::I32(0)],
"invalid value: integer `0`, expected a nonzero i8",
);
test(
&[Token::I64(0)],
"invalid value: integer `0`, expected a nonzero i8",
);
test(
&[Token::U8(0)],
"invalid value: integer `0`, expected a nonzero i8",
);
test(
&[Token::U16(0)],
"invalid value: integer `0`, expected a nonzero i8",
);
test(
&[Token::U32(0)],
"invalid value: integer `0`, expected a nonzero i8",
);
test(
&[Token::U64(0)],
"invalid value: integer `0`, expected a nonzero i8",
);
// from signed
test(
&[Token::I16(-129)],
"invalid value: integer `-129`, expected a nonzero i8",
);
test(
&[Token::I32(-129)],
"invalid value: integer `-129`, expected a nonzero i8",
);
test(
&[Token::I64(-129)],
"invalid value: integer `-129`, expected a nonzero i8",
);
test(
&[Token::I16(128)],
"invalid value: integer `128`, expected a nonzero i8",
);
test(
&[Token::I32(128)],
"invalid value: integer `128`, expected a nonzero i8",
);
test(
&[Token::I64(128)],
"invalid value: integer `128`, expected a nonzero i8",
);
// from unsigned
test(
&[Token::U8(128)],
"invalid value: integer `128`, expected a nonzero i8",
);
test(
&[Token::U16(128)],
"invalid value: integer `128`, expected a nonzero i8",
);
test(
&[Token::U32(128)],
"invalid value: integer `128`, expected a nonzero i8",
);
test(
&[Token::U64(128)],
"invalid value: integer `128`, expected a nonzero i8",
);
} | rust_cleaned_test_functions.jsonl/129503 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1025
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21637,
14154,
5318,
23,
368,
341,
262,
1077,
1273,
284,
2060,
2259,
28838,
4096,
27638,
8121,
17999,
40,
23,
19421,
262,
442,
504,
7168,
198,
262,
1273,
1006,
286,
44590,
3323,
486,
40,
23,
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_private_key_to_der() {
let key = Rsa::generate(2048).unwrap();
let bytes = private_key_to_der(
&key.n().to_vec(),
&key.e().to_vec(),
&key.d().to_vec(),
&key.p().unwrap().to_vec(),
&key.q().unwrap().to_vec(),
);
// Confirm that converting back works correctly
let new_key = Rsa::private_key_from_der(&bytes).unwrap();
assert_eq!(key.n(), new_key.n());
assert_eq!(key.e(), new_key.e());
assert_eq!(key.q().unwrap(), new_key.q().unwrap());
assert_eq!(key.p().unwrap(), new_key.p().unwrap());
use num_bigint_dig;
let reconstructed = rsa::RSAPrivateKey::from_components(
num_bigint_dig::BigUint::from_bytes_be(key.n().to_vec().as_slice()),
num_bigint_dig::BigUint::from_bytes_be(key.e().to_vec().as_slice()),
num_bigint_dig::BigUint::from_bytes_be(key.d().to_vec().as_slice()),
vec![
num_bigint_dig::BigUint::from_bytes_be(key.p().unwrap().to_vec().as_slice()),
num_bigint_dig::BigUint::from_bytes_be(key.q().unwrap().to_vec().as_slice())
]
);
assert!(reconstructed.validate().is_ok());
} | rust_cleaned_test_functions.jsonl/79788 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 662
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26249,
3097,
2346,
35345,
368,
341,
286,
1077,
1376,
284,
431,
9081,
486,
19366,
7,
17,
15,
19,
23,
568,
15454,
1428,
286,
1077,
5820,
284,
869,
3097,
2346,
35345,
1006,
310,
609,
792,
1253,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_retain() {
#[derive(Serialize, Deserialize, MartianStruct)]
pub struct SI {
inputs: Vec<BamFile>,
num_threads: i16,
mem_gb: i16,
}
#[derive(Serialize, Deserialize, MartianStruct)]
pub struct SO {
output: BamFile,
#[mro_retain]
index: BamIndexFile,
}
#[derive(Serialize, Deserialize, MartianStruct)]
pub struct CI {
chunk_input: BamFile,
}
pub struct SortByPos;
#[make_mro(volatile = strict)]
impl MartianStage for SortByPos {
type StageInputs = SI;
type StageOutputs = SO;
type ChunkInputs = CI;
type ChunkOutputs = MartianVoid;
fn split(&self, _: SI, _: MartianRover) -> Result<StageDef<CI>, Error> {
unimplemented!()
}
fn main(&self, _: SI, _: CI, _: MartianRover) -> Result<MartianVoid, Error> {
unimplemented!()
}
fn join(
&self,
_: SI,
_: Vec<CI>,
_: Vec<MartianVoid>,
_: MartianRover,
) -> Result<SO, Error> {
unimplemented!()
}
}
let expected = include_str!("mro/test_retain.mro");
assert_eq!(
make_mro_string(
HEADER,
&[SortByPos::stage_mro("adapter", "sort_reads_by_pos")]
),
expected
);
} | rust_cleaned_test_functions.jsonl/104055 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 715
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21695,
466,
368,
341,
262,
11506,
27098,
3759,
9050,
11,
48440,
11,
81028,
9422,
5563,
262,
6675,
2036,
30548,
341,
286,
11127,
25,
11312,
32519,
309,
1703,
12520,
286,
1629,
29725,
25,
600,
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_language_deserializer() {
let deserialized = serde_json::from_str::<Language>("\"ENGLISH\"").unwrap();
assert_eq!(deserialized, Language::English);
} | rust_cleaned_test_functions.jsonl/100796 | {
"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,
29021,
15768,
41939,
368,
341,
286,
1077,
939,
67577,
284,
61570,
9455,
486,
1499,
2895,
27638,
13806,
13211,
2105,
953,
64418,
2105,
1827,
15454,
543,
286,
2060,
10714,
10297,
5799,
67577,
11,
1143... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_depth_value() {
let matches = app::build()
.get_matches_from_safe(vec!["lsd", "--tree", "--depth", "xx"])
.unwrap();
let res = Flags::from_matches(&matches);
assert!(res.is_err());
assert_eq!(res.unwrap_err().kind, ErrorKind::ValueValidation);
} | rust_cleaned_test_functions.jsonl/82719 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 165
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42681,
19061,
3142,
368,
341,
286,
1077,
9071,
284,
906,
486,
5834,
741,
310,
659,
455,
38344,
5673,
34067,
25592,
0,
1183,
4730,
67,
497,
14482,
9344,
497,
14482,
17561,
497,
330,
4146,
14108,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_link() {
let tempdir = TempDir::new("nix-test_link").unwrap();
let src = tempdir.path().join("foo");
let dst = tempdir.path().join("bar");
File::create(&src).unwrap();
link(&src, &dst).unwrap();
assert!(dst.exists());
} | rust_cleaned_test_functions.jsonl/8999 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7233,
368,
341,
262,
1077,
2730,
3741,
284,
19944,
6184,
486,
931,
445,
77,
941,
16839,
7233,
1827,
15454,
543,
262,
1077,
2286,
284,
2730,
3741,
3875,
1005,
5987,
445,
7975,
797,
262,
1077,
106... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_push_pop() {
let mut heap = BinaryHeap::from_vec(vec!(5i, 5, 2, 1, 3));
assert_eq!(heap.len(), 5);
assert_eq!(heap.push_pop(6), 6);
assert_eq!(heap.len(), 5);
assert_eq!(heap.push_pop(0), 5);
assert_eq!(heap.len(), 5);
assert_eq!(heap.push_pop(4), 5);
assert_eq!(heap.len(), 5);
assert_eq!(heap.push_pop(1), 4);
assert_eq!(heap.len(), 5);
} | rust_cleaned_test_functions.jsonl/1582 | {
"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,
14218,
17061,
368,
341,
286,
1077,
5206,
17364,
284,
17718,
27909,
486,
1499,
13251,
25592,
10297,
20,
72,
11,
220,
20,
11,
220,
17,
11,
220,
16,
11,
220,
18,
1106,
286,
2060,
10714,
10297,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_threshold() {
// Initialize the command line options and controller.
let settings: Settings = default_test_settings();
let mut action_map: ActionMap = ActionController::new(&settings);
// Trigger swipe below threshold.
let action_event = action_map.end_event_to_action_event(&4.99, &0.0, 3);
assert_eq!(action_event.is_none(), true);
// Trigger swipe above threshold.
let action_event = action_map.end_event_to_action_event(&5.0, &0.0, 3);
assert_eq!(action_event.is_some(), true);
assert_eq!(
action_event.unwrap() == ActionEvents::ThreeFingerSwipeRight,
true
);
} | rust_cleaned_test_functions.jsonl/134316 | {
"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,
21039,
21858,
368,
341,
286,
442,
9008,
279,
3210,
1555,
2606,
323,
6461,
624,
286,
1077,
5003,
25,
11296,
284,
1638,
4452,
10853,
543,
286,
1077,
5206,
1917,
5376,
25,
5586,
2227,
284,
73452,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_check_account_subscribe() {
let GenesisBlockInfo {
genesis_block,
mint_keypair,
..
} = create_genesis_block(100);
let bank = Bank::new(&genesis_block);
let blockhash = bank.last_blockhash();
let bank_forks = Arc::new(RwLock::new(BankForks::new(0, bank)));
let alice = Keypair::new();
let tx = system_transaction::create_account(
&mint_keypair,
&alice.pubkey(),
blockhash,
1,
16,
&morgan_budget_api::id(),
);
bank_forks
.write()
.unwrap()
.get(0)
.unwrap()
.process_transaction(&tx)
.unwrap();
let (subscriber, _id_receiver, mut transport_receiver) =
Subscriber::new_test("accountNotification");
let sub_id = SubscriptionId::Number(0 as u64);
let sink = subscriber.assign_id(sub_id.clone()).unwrap();
let subscriptions = RpcSubscriptions::default();
subscriptions.add_account_subscription(&alice.pubkey(), None, &sub_id, &sink);
assert!(subscriptions
.account_subscriptions
.read()
.unwrap()
.contains_key(&alice.pubkey()));
subscriptions.check_account(&alice.pubkey(), 0, &bank_forks);
let string = transport_receiver.poll();
println!("response : {:?}", string);
if let Async::Ready(Some(response)) = string.unwrap() {
let expected = format!(r#"{{"jsonrpc":"2.0","method":"accountNotification","params":{{"result":{{"data":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"difs":1,"executable":false,"owner":[2,203,81,223,225,24,34,35,203,214,138,130,144,208,35,77,63,16,87,51,47,198,115,123,98,188,19,160,0,0,0,0],"reputations":0}},"subscription":0}}}}"#);
assert_eq!(expected, response);
}
subscriptions.remove_account_subscription(&sub_id);
assert!(!subscriptions
.account_subscriptions
.read()
.unwrap()
.contains_key(&alice.pubkey()));
} | rust_cleaned_test_functions.jsonl/37726 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1086
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
13500,
88935,
368,
341,
286,
1077,
40788,
4713,
1731,
341,
310,
59366,
7113,
345,
310,
28337,
3097,
12670,
345,
310,
54538,
286,
335,
284,
1855,
16322,
13774,
7113,
7,
16,
15,
15,
317,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_multiple() {
struct Foo;
impl Debug for Foo {
fn fmt(&self, fmt: &mut Formatter) {
fmt.debug_set()
.entry(&true)
.entry(&format_args!("{}/{}", 10, 20))
.finish()
}
}
assert_eq!("{true, 10/20}", debug3::pprint(Foo));
} | rust_cleaned_test_functions.jsonl/124742 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 232
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45233,
368,
341,
286,
2036,
33428,
401,
286,
11605,
11091,
369,
33428,
341,
310,
5168,
8879,
2099,
721,
11,
8879,
25,
609,
6984,
81387,
8,
341,
394,
8879,
7883,
2602,
741,
503,
659,
4085,
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_plain_decode_double() {
let data = vec![3.14f64, 2.414f64, 12.51f64];
let data_bytes = DoubleType::to_byte_array(&data[..]);
let mut buffer = vec![0.0f64; 3];
test_plain_decode::<DoubleType>(
ByteBufferPtr::new(data_bytes),
3,
-1,
&mut buffer[..],
&data[..],
);
} | rust_cleaned_test_functions.jsonl/38508 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 222
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
41015,
15227,
24598,
368,
341,
286,
1077,
821,
284,
7486,
20703,
18,
13,
16,
19,
69,
21,
19,
11,
220,
17,
13,
19,
16,
19,
69,
21,
19,
11,
220,
16,
17,
13,
20,
16,
69,
21,
19,
935,
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_set_xamz_sha_256() {
let req = test_request("get-vanilla-query-order-key-case");
let req = SignableRequest::from(&req);
let settings = SigningSettings {
payload_checksum_kind: PayloadChecksumKind::XAmzSha256,
..Default::default()
};
let mut signing_params = signing_params(settings);
let creq = CanonicalRequest::from(&req, &signing_params).unwrap();
assert_eq!(
creq.values.content_sha256(),
"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
);
// assert that the sha256 header was added
assert_eq!(
creq.values.signed_headers().as_str(),
"host;x-amz-content-sha256;x-amz-date"
);
signing_params.settings.payload_checksum_kind = PayloadChecksumKind::NoHeader;
let creq = CanonicalRequest::from(&req, &signing_params).unwrap();
assert_eq!(creq.values.signed_headers().as_str(), "host;x-amz-date");
} | rust_cleaned_test_functions.jsonl/83736 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 490
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2602,
3212,
309,
89,
48836,
62,
17,
20,
21,
368,
341,
286,
1077,
4232,
284,
1273,
7893,
445,
455,
8273,
276,
6241,
65489,
23810,
16173,
38485,
797,
286,
1077,
4232,
284,
7075,
480,
1900,
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_rlc() {
let mut state = State8080::empty_state();
state.memory = vec![0x07];
state.a = 0xf2;
emulate_8080_op(&mut state);
assert_eq!(state.a, 0xe5);
assert_eq!(state.cc.cy, 1);
} | rust_cleaned_test_functions.jsonl/7796 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
17257,
368,
341,
286,
1077,
5206,
1584,
284,
3234,
23,
15,
23,
15,
486,
3194,
4387,
543,
286,
1584,
36611,
284,
7486,
20703,
15,
87,
15,
22,
935,
286,
1584,
5849,
284,
220,
15,
5848,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_simple_list() {
let head: [u8; 4] = unsafe { mem::transmute(4u32.to_be()) };
let b: [u8; 11] = [
0x7d, 0x00, 0x02, head[0], head[1], head[2], head[3], 4, 5, 6, 7,
];
let mut de = TarsDecoder::from(&b[..]);
let list: Vec<i8> = de.read_list(7, true, vec![]).unwrap();
let result: Vec<i8> = vec![4, 5, 6, 7];
assert_eq!(list, result);
let b2: [u8; 11] = [
0xed, 0x00, 0x02, head[0], head[1], head[2], head[3], 1, 0, 1, 0,
];
let mut de2 = TarsDecoder::from(&b2[..]);
let list: Vec<bool> = de2.read_list(14, true, vec![]).unwrap();
let result: Vec<bool> = vec![true, false, true, false];
assert_eq!(list, result);
let olist: Vec<bool> = de2.read_list(16, false, vec![]).unwrap();
assert_eq!(olist, vec![]);
let olist2: Vec<i8> = de2.read_list(244, false, vec![1, 2]).unwrap();
assert_eq!(olist2, vec![1, 2]);
let err: Result<Vec<bool>, DecodeErr> = de.read_list(129, true, vec![true]);
assert_eq!(err, Err(DecodeErr::TarsTagNotFoundErr));
} | rust_cleaned_test_functions.jsonl/128471 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 609
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
30015,
2019,
368,
341,
286,
1077,
1968,
25,
508,
84,
23,
26,
220,
19,
60,
284,
19860,
314,
1833,
486,
1458,
52214,
7,
19,
84,
18,
17,
2389,
21263,
2140,
2605,
286,
1077,
293,
25,
508,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_line_spacing() {
let props = ParagraphProperty::new();
let bytes = props
.line_spacing(None, None, Some(100), Some(LineSpacingType::AtLeast))
.build();
assert_eq!(
str::from_utf8(&bytes).unwrap(),
r#"<w:pPr><w:rPr /><w:spacing w:line="100" w:lineRule="atLeast" /></w:pPr>"#
)
} | rust_cleaned_test_functions.jsonl/67558 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 206
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6528,
63328,
368,
341,
286,
1077,
6914,
284,
49351,
3052,
486,
931,
543,
286,
1077,
5820,
284,
6914,
198,
310,
659,
1056,
63328,
26717,
11,
2240,
11,
4329,
7,
16,
15,
15,
701,
4329,
84462,
270... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_normalize_path_trailing_slashes() {
let app = App::new()
.resource("/resource1", |r| r.method(Method::GET).f(index))
.resource("/resource2/", |r| r.method(Method::GET).f(index))
.default_resource(|r| r.h(NormalizePath::default()))
.finish();
// trailing slashes
let params = vec![
("/resource1", "", StatusCode::OK),
("/resource1/", "/resource1", StatusCode::MOVED_PERMANENTLY),
("/resource2", "/resource2/", StatusCode::MOVED_PERMANENTLY),
("/resource2/", "", StatusCode::OK),
("/resource1?p1=1&p2=2", "", StatusCode::OK),
(
"/resource1/?p1=1&p2=2",
"/resource1?p1=1&p2=2",
StatusCode::MOVED_PERMANENTLY,
),
(
"/resource2?p1=1&p2=2",
"/resource2/?p1=1&p2=2",
StatusCode::MOVED_PERMANENTLY,
),
("/resource2/?p1=1&p2=2", "", StatusCode::OK),
];
for (path, target, code) in params {
let req = TestRequest::with_uri(path).request();
let resp = app.run(req);
let r = &resp.as_msg();
assert_eq!(r.status(), code);
if !target.is_empty() {
assert_eq!(
target,
r.headers().get(header::LOCATION).unwrap().to_str().unwrap()
);
}
}
} | rust_cleaned_test_functions.jsonl/38135 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 865
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
80807,
2638,
3547,
14277,
11886,
14051,
368,
341,
286,
1077,
906,
284,
1845,
486,
931,
741,
310,
659,
9233,
4283,
9233,
16,
497,
760,
81,
91,
435,
12908,
35419,
486,
3806,
568,
69,
7195,
1171,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_foreign_closure() {
let interp = Interpreter::new();
let scope = interp.scope();
ketos_closure!{ scope, "hello",
|s: &str| -> String { Ok(format!("Hello, {}!", s)) } }
let value = 1;
ketos_closure!{ scope, "get-value",
|| -> i32 { Ok(value) } }
assert_eq!(eval(&interp, r#"(hello "world")"#).unwrap(), r#""Hello, world!""#);
assert_eq!(eval(&interp, "(get-value)").unwrap(), "1");
} | rust_cleaned_test_functions.jsonl/112663 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
78983,
72823,
368,
341,
262,
1077,
47271,
284,
82493,
486,
931,
543,
262,
1077,
6891,
284,
47271,
48371,
1428,
262,
31281,
436,
72823,
0,
90,
6891,
11,
330,
14990,
756,
286,
760,
82,
25,
609,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_sst_writer() {
test_sst_writer_with(1, &[CF_WRITE], &SecurityConfig::default());
test_sst_writer_with(1024, &[CF_DEFAULT, CF_WRITE], &SecurityConfig::default());
let temp_dir = TempDir::new("/tmp/encrypted_env_from_cipher_file").unwrap();
let security_cfg = create_security_cfg(&temp_dir);
test_sst_writer_with(1, &[CF_WRITE], &security_cfg);
test_sst_writer_with(1024, &[CF_DEFAULT, CF_WRITE], &security_cfg);
} | rust_cleaned_test_functions.jsonl/19581 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 219
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
267,
28908,
368,
341,
286,
1273,
643,
267,
28908,
6615,
7,
16,
11,
44590,
9650,
17475,
1125,
609,
15352,
2648,
486,
2258,
1423,
286,
1273,
643,
267,
28908,
6615,
7,
16,
15,
17,
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... | 1 |
#[test]
fn test_from_static_custom_long_symbol() {
HeaderName::from_static(
"longer-than-63--thisheader{}{}{}{}islongerthansixtythreecharactersandthushandleddifferent"
);
} | rust_cleaned_test_functions.jsonl/3415 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
25360,
15875,
17799,
21179,
368,
341,
286,
12104,
675,
486,
1499,
25360,
1006,
310,
330,
4825,
261,
47654,
12,
21,
18,
313,
574,
2708,
6257,
6257,
6257,
6257,
285,
4825,
261,
339,
596,
941... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_from_channelmanager() {
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let _chan = create_announced_chan_between_nodes(&nodes, 0, 1, InitFeatures::known(), InitFeatures::known());
let invoice = create_invoice_from_channelmanager_and_duration_since_epoch(
&nodes[1].node, nodes[1].keys_manager, Currency::BitcoinTestnet, Some(10_000), "test".to_string(),
Duration::from_secs(1234567)).unwrap();
assert_eq!(invoice.amount_pico_btc(), Some(100_000));
assert_eq!(invoice.min_final_cltv_expiry(), MIN_FINAL_CLTV_EXPIRY as u64);
assert_eq!(invoice.description(), InvoiceDescription::Direct(&Description("test".to_string())));
let payee = Payee::from_node_id(invoice.recover_payee_pub_key())
.with_features(invoice.features().unwrap().clone())
.with_route_hints(invoice.route_hints());
let params = RouteParameters {
payee,
final_value_msat: invoice.amount_milli_satoshis().unwrap(),
final_cltv_expiry_delta: invoice.min_final_cltv_expiry() as u32,
};
let first_hops = nodes[0].node.list_usable_channels();
let network_graph = node_cfgs[0].network_graph;
let logger = test_utils::TestLogger::new();
let scorer = test_utils::TestScorer::with_fixed_penalty(0);
let route = find_route(
&nodes[0].node.get_our_node_id(), ¶ms, network_graph,
Some(&first_hops.iter().collect::<Vec<_>>()), &logger, &scorer,
).unwrap();
let payment_event = {
let mut payment_hash = PaymentHash([0; 32]);
payment_hash.0.copy_from_slice(&invoice.payment_hash().as_ref()[0..32]);
nodes[0].node.send_payment(&route, payment_hash, &Some(invoice.payment_secret().clone())).unwrap();
let mut added_monitors = nodes[0].chain_monitor.added_monitors.lock().unwrap();
assert_eq!(added_monitors.len(), 1);
added_monitors.clear();
let mut events = nodes[0].node.get_and_clear_pending_msg_events();
assert_eq!(events.len(), 1);
SendEvent::from_event(events.remove(0))
};
nodes[1].node.handle_update_add_htlc(&nodes[0].node.get_our_node_id(), &payment_event.msgs[0]);
nodes[1].node.handle_commitment_signed(&nodes[0].node.get_our_node_id(), &payment_event.commitment_msg);
let mut added_monitors = nodes[1].chain_monitor.added_monitors.lock().unwrap();
assert_eq!(added_monitors.len(), 1);
added_monitors.clear();
let events = nodes[1].node.get_and_clear_pending_msg_events();
assert_eq!(events.len(), 2);
} | rust_cleaned_test_functions.jsonl/22478 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1032
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
14571,
13297,
368,
341,
197,
10217,
26023,
1645,
18343,
82,
284,
1855,
45552,
1645,
18343,
82,
7,
17,
317,
197,
10217,
2436,
18343,
82,
284,
1855,
5084,
18343,
82,
7,
17,
11,
609,
5658,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vring_backend_mut() {
let b = RwLock::new(MockBackend {});
assert_eq!(b.get_features().unwrap(), 0x1);
b.set_features(0x1).unwrap();
b.set_owner().unwrap();
b.reset_owner().unwrap();
b.set_mem_table(&[]).unwrap();
b.set_log_base(
0x100,
Some(VhostUserDirtyLogRegion {
mmap_size: 0x1000,
mmap_offset: 0x10,
mmap_handle: 100,
}),
)
.unwrap();
b.set_log_fd(100).unwrap();
b.set_vring_num(1, 256).unwrap();
let config = VringConfigData {
queue_max_size: 0x1000,
queue_size: 0x2000,
flags: 0x0,
desc_table_addr: 0x4000,
used_ring_addr: 0x5000,
avail_ring_addr: 0x6000,
log_addr: None,
};
b.set_vring_addr(1, &config).unwrap();
b.set_vring_base(1, 2).unwrap();
assert_eq!(b.get_vring_base(1).unwrap(), 2);
let eventfd = EventFd::new(0).unwrap();
b.set_vring_call(1, &eventfd).unwrap();
b.set_vring_kick(1, &eventfd).unwrap();
b.set_vring_err(1, &eventfd).unwrap();
} | rust_cleaned_test_functions.jsonl/98905 | {
"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,
2273,
12640,
40011,
29523,
368,
341,
286,
1077,
293,
284,
55294,
11989,
486,
931,
66436,
29699,
87894,
286,
2060,
10714,
10297,
65,
670,
14965,
1005,
15454,
1507,
220,
15,
87,
16,
317,
286,
293,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_no_loops() {
let mut config = AirmashServerConfig::new_no_gamemode("0.0.0.0:3501").with_engine();
config.builder = crate::systems::register(&mut config.world, config.builder);
config.builder.build();
} | rust_cleaned_test_functions.jsonl/47855 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 87
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
5560,
3721,
368,
341,
10217,
5206,
2193,
284,
362,
2853,
988,
5475,
2648,
486,
931,
6536,
1889,
309,
91546,
445,
15,
13,
15,
13,
15,
13,
15,
25,
18,
20,
15,
16,
1827,
4197,
24823,
543,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_config_validate() {
let mut cfg = Config::new();
cfg.validate().unwrap();
assert_eq!(
cfg.raft_min_election_timeout_ticks,
cfg.raft_election_timeout_ticks
);
assert_eq!(
cfg.raft_max_election_timeout_ticks,
cfg.raft_election_timeout_ticks * 2
);
cfg.raft_heartbeat_ticks = 0;
assert!(cfg.validate().is_err());
cfg = Config::new();
cfg.raft_election_timeout_ticks = 10;
cfg.raft_heartbeat_ticks = 10;
assert!(cfg.validate().is_err());
cfg = Config::new();
cfg.raft_min_election_timeout_ticks = 5;
cfg.validate().unwrap_err();
cfg.raft_min_election_timeout_ticks = 25;
cfg.validate().unwrap_err();
cfg.raft_min_election_timeout_ticks = 10;
cfg.validate().unwrap();
cfg.raft_heartbeat_ticks = 11;
assert!(cfg.validate().is_err());
cfg = Config::new();
cfg.raft_log_gc_threshold = 0;
assert!(cfg.validate().is_err());
cfg = Config::new();
cfg.raft_log_gc_size_limit = ReadableSize(0);
assert!(cfg.validate().is_err());
cfg = Config::new();
cfg.raft_base_tick_interval = ReadableDuration::secs(1);
cfg.raft_election_timeout_ticks = 10;
cfg.raft_store_max_leader_lease = ReadableDuration::secs(20);
assert!(cfg.validate().is_err());
cfg = Config::new();
cfg.raft_log_gc_count_limit = 100;
cfg.merge_max_log_gap = 110;
assert!(cfg.validate().is_err());
cfg = Config::new();
cfg.merge_check_tick_interval = ReadableDuration::secs(0);
assert!(cfg.validate().is_err());
cfg = Config::new();
cfg.raft_base_tick_interval = ReadableDuration::secs(1);
cfg.raft_election_timeout_ticks = 10;
cfg.peer_stale_state_check_interval = ReadableDuration::secs(5);
assert!(cfg.validate().is_err());
cfg = Config::new();
cfg.peer_stale_state_check_interval = ReadableDuration::minutes(2);
cfg.abnormal_leader_missing_duration = ReadableDuration::minutes(1);
assert!(cfg.validate().is_err());
cfg = Config::new();
cfg.abnormal_leader_missing_duration = ReadableDuration::minutes(2);
cfg.max_leader_missing_duration = ReadableDuration::minutes(1);
assert!(cfg.validate().is_err());
cfg = Config::new();
cfg.local_read_batch_size = 0;
assert!(cfg.validate().is_err());
cfg = Config::new();
cfg.apply_batch_system.max_batch_size = Some(0);
assert!(cfg.validate().is_err());
cfg = Config::new();
cfg.apply_batch_system.pool_size = 0;
assert!(cfg.validate().is_err());
cfg = Config::new();
cfg.store_batch_system.max_batch_size = Some(0);
assert!(cfg.validate().is_err());
cfg = Config::new();
cfg.store_batch_system.pool_size = 0;
assert!(cfg.validate().is_err());
cfg = Config::new();
cfg.hibernate_regions = true;
assert!(cfg.validate().is_ok());
assert_eq!(cfg.store_batch_system.max_batch_size, Some(256));
assert_eq!(cfg.apply_batch_system.max_batch_size, Some(256));
cfg = Config::new();
cfg.hibernate_regions = false;
assert!(cfg.validate().is_ok());
assert_eq!(cfg.store_batch_system.max_batch_size, Some(1024));
assert_eq!(cfg.apply_batch_system.max_batch_size, Some(256));
cfg = Config::new();
cfg.hibernate_regions = true;
cfg.store_batch_system.max_batch_size = Some(123);
cfg.apply_batch_system.max_batch_size = Some(234);
assert!(cfg.validate().is_ok());
assert_eq!(cfg.store_batch_system.max_batch_size, Some(123));
assert_eq!(cfg.apply_batch_system.max_batch_size, Some(234));
cfg = Config::new();
cfg.future_poll_size = 0;
assert!(cfg.validate().is_err());
cfg = Config::new();
cfg.snap_generator_pool_size = 0;
assert!(cfg.validate().is_err());
cfg = Config::new();
cfg.raft_base_tick_interval = ReadableDuration::secs(1);
cfg.raft_election_timeout_ticks = 11;
cfg.raft_store_max_leader_lease = ReadableDuration::secs(11);
assert!(cfg.validate().is_err());
cfg = Config::new();
cfg.hibernate_regions = true;
cfg.max_peer_down_duration = ReadableDuration::minutes(5);
cfg.peer_stale_state_check_interval = ReadableDuration::minutes(5);
assert!(cfg.validate().is_ok());
assert_eq!(cfg.max_peer_down_duration, ReadableDuration::minutes(10));
cfg = Config::new();
cfg.raft_max_size_per_msg = ReadableSize(0);
assert!(cfg.validate().is_err());
cfg.raft_max_size_per_msg = ReadableSize::gb(64);
assert!(cfg.validate().is_err());
cfg.raft_max_size_per_msg = ReadableSize::gb(3);
assert!(cfg.validate().is_ok());
} | rust_cleaned_test_functions.jsonl/9437 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2430
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5332,
42681,
368,
341,
286,
1077,
5206,
13286,
284,
5532,
486,
931,
543,
286,
13286,
19520,
1005,
15454,
543,
286,
2060,
10714,
33673,
310,
13286,
13,
2944,
7260,
2204,
1170,
20537,
49961,
345,
31... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parallel_chains_1() {
let src = [HASH_ELEMENT; 5];
let expect = hash_n_to_n_ret(&HASH_ELEMENT);
let mut dst = [Default::default(); 5];
hash_parallel_chains_all(&mut dst, &src, 1);
assert_eq!(dst, [expect; 5]);
} | rust_cleaned_test_functions.jsonl/127332 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60625,
4138,
1735,
62,
16,
368,
341,
286,
1077,
2286,
284,
508,
70707,
27156,
26,
220,
20,
935,
286,
1077,
1720,
284,
5175,
1089,
2346,
1089,
21695,
2099,
70707,
27156,
317,
286,
1077,
5206,
106... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_split_check() {
let path = TempDir::new("test-raftstore").unwrap();
let path_str = path.path().to_str().unwrap();
let db_opts = DBOptions::new();
let mut cf_opts = ColumnFamilyOptions::new();
let f = Box::new(RangePropertiesCollectorFactory::default());
cf_opts.add_table_properties_collector_factory("tikv.range-properties-collector", f);
let cfs_opts = ALL_CFS
.iter()
.map(|cf| CFOptions::new(cf, cf_opts.clone()))
.collect();
let engine = Arc::new(new_engine_opt(path_str, db_opts, cfs_opts).unwrap());
let mut region = Region::new();
region.set_id(1);
region.set_start_key(vec![]);
region.set_end_key(vec![]);
region.mut_peers().push(Peer::new());
region.mut_region_epoch().set_version(2);
region.mut_region_epoch().set_conf_ver(5);
let (tx, rx) = mpsc::sync_channel(100);
let ch = RetryableSendCh::new(tx, "test-split");
let mut cfg = Config::default();
cfg.region_max_keys = 100;
cfg.region_split_keys = 80;
let mut runnable = SplitCheckRunner::new(
Arc::clone(&engine),
ch.clone(),
Arc::new(CoprocessorHost::new(cfg, ch.clone())),
);
// so split key will be z0080
for i in 0..90 {
let key = keys::data_key(
Key::from_raw(format!("{:04}", i).as_bytes())
.append_ts(2)
.encoded(),
);
let write_value = Write::new(WriteType::Put, 0, None).to_bytes();
let write_cf = engine.cf_handle(CF_WRITE).unwrap();
engine.put_cf(write_cf, &key, &write_value).unwrap();
engine.flush_cf(write_cf, true).unwrap();
let default_cf = engine.cf_handle(CF_DEFAULT).unwrap();
engine.put_cf(default_cf, &key, &[0; 1024]).unwrap();
engine.flush_cf(default_cf, true).unwrap();
}
runnable.run(SplitCheckTask::new(region.clone(), true, CheckPolicy::SCAN));
// keys has not reached the max_keys 100 yet.
match rx.try_recv() {
Ok(Msg::RegionApproximateSize { region_id, .. })
| Ok(Msg::RegionApproximateKeys { region_id, .. }) => {
assert_eq!(region_id, region.get_id());
}
others => panic!("expect recv empty, but got {:?}", others),
}
for i in 90..160 {
let key = keys::data_key(
Key::from_raw(format!("{:04}", i).as_bytes())
.append_ts(2)
.encoded(),
);
let write_value =
Write::new(WriteType::Put, 0, Some(b"shortvalue".to_vec())).to_bytes();
let write_cf = engine.cf_handle(CF_WRITE).unwrap();
engine.put_cf(write_cf, &key, &write_value).unwrap();
engine.flush_cf(write_cf, true).unwrap();
let default_cf = engine.cf_handle(CF_DEFAULT).unwrap();
engine.put_cf(default_cf, &key, &[0; 1024]).unwrap();
engine.flush_cf(default_cf, true).unwrap();
}
runnable.run(SplitCheckTask::new(region.clone(), true, CheckPolicy::SCAN));
must_split_at(&rx, ®ion, Key::from_raw(b"0080").append_ts(2).encoded());
drop(rx);
// It should be safe even the result can't be sent back.
runnable.run(SplitCheckTask::new(region, true, CheckPolicy::SCAN));
} | rust_cleaned_test_functions.jsonl/30070 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1754
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
7200,
368,
341,
286,
1077,
1815,
284,
19944,
6184,
486,
931,
445,
1944,
12,
2944,
4314,
1827,
15454,
543,
286,
1077,
1815,
2895,
284,
1815,
3875,
1005,
983,
2895,
1005,
15454,
543,
286,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_match_body() {
let matches = App::new("test")
.arg(arg!(--body "Body to add").takes_value(true))
.get_matches_from(vec!["test", "--body", "foo"]);
let body = matches.match_body();
assert!(body.is_some());
assert_eq!(body.unwrap().to_string().unwrap(), "foo".to_string());
} | rust_cleaned_test_functions.jsonl/103524 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10708,
14114,
368,
341,
262,
1077,
9071,
284,
1845,
486,
931,
445,
1944,
1138,
414,
659,
858,
9404,
10297,
313,
2599,
330,
5444,
311,
912,
1827,
77979,
3142,
3715,
1171,
414,
659,
455,
38344,
56... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eval_eq2() {
let mut s = Stack::new();
s.push(Elt::Int(1)).unwrap();
s.push(Elt::Bool(false)).unwrap();
let res = s.eval(Op::Eq);
assert!(res.is_err());
if let Err(Error::Type) = res {
} else {
assert!(false);
}
} | rust_cleaned_test_functions.jsonl/34521 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 179
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21296,
10714,
17,
368,
341,
286,
1077,
5206,
274,
284,
14284,
486,
931,
543,
286,
274,
2552,
10722,
4832,
486,
1072,
7,
16,
4579,
15454,
543,
286,
274,
2552,
10722,
4832,
486,
11233,
3576,
4579,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_case_when() {
let mut ctx = EvalContext::default();
let dec1 = Datum::Dec("1.1".parse().unwrap());
let dec2 = Datum::Dec("2.2".parse().unwrap());
let dur1 = Datum::Dur(Duration::parse(&mut ctx, b"01:00:00", 0).unwrap());
let dur2 = Datum::Dur(Duration::parse(&mut ctx, b"12:00:12", 0).unwrap());
let time1 =
Datum::Time(Time::parse_datetime(&mut ctx, "2012-12-12 12:00:23", 0, false).unwrap());
let s = "你好".as_bytes().to_owned();
let cases = vec![
(
ScalarFuncSig::CaseWhenInt,
vec![cond(true), Datum::I64(3), cond(true), Datum::I64(5)],
Datum::I64(3),
),
(
ScalarFuncSig::CaseWhenDecimal,
vec![cond(false), dec1, cond(true), dec2.clone()],
dec2,
),
(
ScalarFuncSig::CaseWhenDuration,
vec![Datum::Null, dur1, cond(true), dur2.clone()],
dur2,
),
(ScalarFuncSig::CaseWhenTime, vec![time1.clone()], time1),
(
ScalarFuncSig::CaseWhenReal,
vec![cond(false), Datum::Null],
Datum::Null,
),
(
ScalarFuncSig::CaseWhenString,
vec![cond(true), Datum::Bytes(s.clone())],
Datum::Bytes(s),
),
(
ScalarFuncSig::CaseWhenJson,
vec![
cond(false),
Datum::Null,
Datum::Null,
Datum::Null,
Datum::Json(Json::I64(23)),
],
Datum::Json(Json::I64(23)),
),
];
for (sig, row, exp) in cases {
let children: Vec<Expr> = (0..row.len()).map(|id| col_expr(id as i64)).collect();
let mut expr = Expr::default();
expr.set_tp(ExprType::ScalarFunc);
expr.set_sig(sig);
expr.set_children(children.into());
let e = Expression::build(&mut ctx, expr).unwrap();
let res = e.eval(&mut ctx, &row).unwrap();
assert_eq!(res, exp);
}
} | rust_cleaned_test_functions.jsonl/121614 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1362
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19096,
47636,
368,
341,
286,
1077,
5206,
5635,
284,
58239,
1972,
486,
2258,
543,
286,
1077,
1622,
16,
284,
68459,
486,
4900,
445,
16,
13,
16,
3263,
6400,
1005,
15454,
1423,
286,
1077,
1622,
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... | 2 |
#[test]
fn test_transaction_without_service() {
let (p_key, s_key) = gen_keypair();
let db = Arc::from(Box::new(MemoryDB::new()) as Box<dyn Database>) as Arc<dyn Database>;
let services = vec![];
let node_cfg = helpers::generate_testnet_config(1, 16_500)[0].clone();
let mut node = Node::new(db, services, node_cfg, None);
let tx = create_simple_tx(p_key, &s_key);
// Send transaction to node.
let event = ExternalMessage::Transaction(tx);
node.handler.handle_event(event.into());
// Service not found for transaction.
let snapshot = node.blockchain().snapshot();
let schema = Schema::new(&snapshot);
assert_eq!(schema.transactions_pool_len(), 0);
} | rust_cleaned_test_functions.jsonl/22030 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 320
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28884,
39904,
12267,
368,
341,
286,
1077,
320,
79,
3097,
11,
274,
3097,
8,
284,
4081,
3097,
12670,
1428,
286,
1077,
2927,
284,
19689,
486,
1499,
67758,
486,
931,
3189,
4731,
3506,
486,
931,
2140... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_to_signed_bytes_le() {
fn check(s: &str, result: Vec<u8>) {
assert_eq!(
BigInt::parse_bytes(s.as_bytes(), 10)
.unwrap()
.to_signed_bytes_le(),
result
);
}
check("0", vec![0]);
check("32767", vec![0xff, 0x7f]);
check("-1", vec![0xff]);
check("16777216", vec![0, 0, 0, 1]);
check("-100", vec![156]);
check("-8388608", vec![0, 0, 0x80]);
check("-192", vec![0x40, 0xff]);
check("128", vec![0x80, 0])
} | rust_cleaned_test_functions.jsonl/56610 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 299
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
55617,
12524,
11751,
368,
341,
262,
5168,
1779,
1141,
25,
609,
495,
11,
1102,
25,
11312,
34837,
23,
9231,
341,
286,
2060,
10714,
33673,
310,
62608,
486,
6400,
12524,
1141,
5357,
12524,
1507,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extend_selection_prefer_lifetimes() {
do_check(r#"fn foo<<|>'a>() {}"#, &["'a", "<'a>"]);
do_check(r#"fn foo<'a<|>>() {}"#, &["'a", "<'a>"]);
} | rust_cleaned_test_functions.jsonl/29678 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70265,
23672,
10442,
802,
907,
333,
6889,
368,
341,
286,
653,
7200,
2601,
55543,
8822,
15229,
2442,
91,
5592,
64,
13555,
4687,
57676,
11,
609,
1183,
6,
64,
497,
4055,
6,
64,
29,
15049,
286,
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_case_26() {
let key = "32b063d3da484ba1843e071b61c49ce7f30ba18a4f7ef2730ecd785494839966";
let nonce = "f593168e17311913753c59593fc66cb6";
let expected_output =
"f18115a9568724c25184728f563b65b737219cb0df1b3ce19a8bdcbdf7b8b2be";
hchacha_test_runner(key, nonce, expected_output);
} | rust_cleaned_test_functions.jsonl/44688 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 219
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19096,
62,
17,
21,
368,
341,
310,
1077,
1376,
284,
330,
18,
17,
65,
15,
21,
18,
67,
18,
3235,
19,
23,
19,
4645,
16,
23,
19,
18,
68,
15,
22,
16,
65,
21,
16,
66,
19,
24,
346,
22,
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 |
#[test]
fn test_ready_state_change_event() {
let event: ReadyStateChangeEvent = js!(
return new Event( @{ReadyStateChangeEvent::EVENT_TYPE} );
).try_into().unwrap();
assert_eq!( event.event_type(), ReadyStateChangeEvent::EVENT_TYPE);
} | rust_cleaned_test_functions.jsonl/88358 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 121
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35456,
4387,
15947,
6748,
368,
341,
286,
1077,
1538,
25,
30982,
1397,
76498,
284,
6994,
33673,
310,
470,
501,
3665,
7,
33267,
19202,
1397,
76498,
486,
37349,
4189,
92,
1439,
286,
7457,
1539,
45514... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_num_nonzero() {
{
let mut cs = TestConstraintSystem::new();
let n = AllocatedNum::alloc(&mut cs, || Ok(Scalar::from(3))).unwrap();
n.assert_nonzero(&mut cs).unwrap();
assert!(cs.is_satisfied());
cs.set("ephemeral inverse", Scalar::from(3));
assert!(cs.which_is_unsatisfied() == Some("nonzero assertion constraint"));
}
{
let mut cs = TestConstraintSystem::new();
let n = AllocatedNum::alloc(&mut cs, || Ok(Scalar::zero())).unwrap();
assert!(n.assert_nonzero(&mut cs).is_err());
}
} | rust_cleaned_test_functions.jsonl/119280 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 324
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4273,
21637,
14154,
368,
341,
286,
341,
310,
1077,
5206,
10532,
284,
3393,
17890,
2320,
486,
931,
1428,
310,
1077,
308,
284,
1674,
39463,
4651,
486,
4742,
2099,
6984,
10532,
11,
1369,
7622,
7,
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... | 3 |
#[test]
fn test_sig_token_structure() {
// Valid cases.
let bool_token = SignatureToken::Bool;
assert_eq!(check_structure(&bool_token), None);
let struct_token = SignatureToken::Struct(StructHandleIndex::new(0), vec![]);
assert_eq!(check_structure(&struct_token), None);
let ref_token = SignatureToken::Reference(Box::new(struct_token.clone()));
assert_eq!(check_structure(&ref_token), None);
let mut_ref_token = SignatureToken::MutableReference(Box::new(struct_token.clone()));
assert_eq!(check_structure(&mut_ref_token), None);
// Invalid cases.
let ref_ref_token = SignatureToken::Reference(Box::new(ref_token.clone()));
assert_eq!(
check_structure(&ref_ref_token),
Some(VMStaticViolation::InvalidSignatureToken(
ref_ref_token.clone(),
SignatureTokenKind::Reference,
SignatureTokenKind::Reference,
))
);
let ref_mut_ref_token = SignatureToken::Reference(Box::new(mut_ref_token.clone()));
assert_eq!(
check_structure(&ref_mut_ref_token),
Some(VMStaticViolation::InvalidSignatureToken(
ref_mut_ref_token.clone(),
SignatureTokenKind::Reference,
SignatureTokenKind::MutableReference,
))
);
} | rust_cleaned_test_functions.jsonl/108581 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 518
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29252,
6458,
38283,
368,
341,
262,
442,
7818,
5048,
624,
262,
1077,
1807,
6458,
284,
32232,
3323,
486,
11233,
280,
262,
2060,
10714,
10297,
2028,
38283,
2099,
2641,
6458,
701,
2240,
317,
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_parse_range() {
assert_eq!(FieldRange::from_str("1"), Some(Single(1)));
assert_eq!(FieldRange::from_str("-1"), Some(Single(-1)));
assert_eq!(FieldRange::from_str("1.."), Some(RightInf(1)));
assert_eq!(FieldRange::from_str("-1.."), Some(RightInf(-1)));
assert_eq!(FieldRange::from_str("..1"), Some(LeftInf(1)));
assert_eq!(FieldRange::from_str("..-1"), Some(LeftInf(-1)));
assert_eq!(FieldRange::from_str("1..3"), Some(Both(1, 3)));
assert_eq!(FieldRange::from_str("-1..-3"), Some(Both(-1, -3)));
assert_eq!(FieldRange::from_str(".."), Some(RightInf(0)));
assert_eq!(FieldRange::from_str("a.."), None);
assert_eq!(FieldRange::from_str("..b"), None);
assert_eq!(FieldRange::from_str("a..b"), None);
} | rust_cleaned_test_functions.jsonl/82617 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 384
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
9698,
368,
341,
286,
2060,
10714,
10297,
1877,
6046,
486,
1499,
2895,
445,
16,
3975,
4329,
3759,
2173,
7,
16,
4945,
286,
2060,
10714,
10297,
1877,
6046,
486,
1499,
2895,
13645,
16,
3975,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_join_with_string() {
let mut output = String::new();
let method = StringMethod {
method: "join",
variable: "[\"FOO\" \"BAR\"]",
pattern: "\" \"",
selection: Select::All,
};
method.handle(&mut output, &VariableExpander);
assert_eq!(output, "FOO BAR");
} | rust_cleaned_test_functions.jsonl/85287 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31017,
6615,
3904,
368,
341,
286,
1077,
5206,
2550,
284,
923,
486,
931,
543,
286,
1077,
1714,
284,
923,
3523,
341,
310,
1714,
25,
262,
330,
5987,
756,
310,
3890,
25,
220,
10545,
2105,
3788,
46... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_str_lit() {
let msg = r#" "a\nb" "#;
let mess = tokenize(msg, |p| p.next_str_lit());
assert_eq!(
StrLit {
escaped: r#"a\nb"#.to_owned()
},
mess
);
} | rust_cleaned_test_functions.jsonl/77307 | {
"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,
2895,
98399,
368,
341,
286,
1077,
3750,
284,
435,
55543,
220,
330,
64,
1699,
65,
1,
220,
5869,
280,
286,
1077,
9435,
284,
77651,
8119,
11,
760,
79,
91,
281,
4529,
2895,
98399,
1423,
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_decode_ldrsb_imm_t2() {
assert_eq!(
decode_32(0xf9170c09),
Instruction::LDRSB_imm {
params: Reg2FullParams {
rt: Reg::R0,
rn: Reg::R7,
imm32: 9,
index: true,
add: false,
wback: false,
},
thumb32: true,
}
);
} | rust_cleaned_test_functions.jsonl/64862 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 272
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
50573,
5428,
65,
71370,
528,
17,
368,
341,
1066,
262,
2060,
10714,
33673,
286,
16895,
62,
18,
17,
7,
15,
5848,
24,
16,
22,
15,
66,
15,
24,
1326,
286,
29051,
486,
43,
7687,
16680,
7137... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_cloud_front_origin_access_identity() {
let mock_response = MockResponseReader::read_response(
"test_resources/generated/valid",
"cloudfront-get-cloud-front-origin-access-identity.xml",
);
let mock = MockRequestDispatcher::with_status(200).with_body(&mock_response);
let client = CloudFrontClient::new(mock, MockCredentialsProvider, rusoto_region::UsEast1);
let request = GetCloudFrontOriginAccessIdentityRequest::default();
let result = client
.get_cloud_front_origin_access_identity(request)
.sync();
assert!(result.is_ok(), "parse error: {:?}", result);
} | rust_cleaned_test_functions.jsonl/88938 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 294
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
8337,
37356,
6951,
3062,
37356,
22926,
34043,
12759,
46244,
368,
341,
286,
1077,
7860,
9655,
284,
14563,
2582,
5062,
486,
878,
9655,
1006,
310,
330,
1944,
35569,
79372,
14,
1891,
756,
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_patch_rate_limiters() {
let mut net = Net::default_net(TestMutators::default());
let mem_clone = net.mem.clone();
let (rxq, txq) = Net::virtqueues(&mem_clone);
net.assign_queues(rxq.create_queue(), txq.create_queue());
net.rx_rate_limiter = RateLimiter::new(10, None, 10, 2, None, 2).unwrap();
net.tx_rate_limiter = RateLimiter::new(10, None, 10, 2, None, 2).unwrap();
let rx_bytes = TokenBucket::new(1000, Some(1001), 1002);
let rx_ops = TokenBucket::new(1003, Some(1004), 1005);
let tx_bytes = TokenBucket::new(1006, Some(1007), 1008);
let tx_ops = TokenBucket::new(1009, Some(1010), 1011);
net.patch_rate_limiters(
Some(rx_bytes.clone()),
Some(rx_ops.clone()),
Some(tx_bytes.clone()),
Some(tx_ops.clone()),
);
let compare_buckets = |a: &TokenBucket, b: &TokenBucket| {
assert_eq!(a.capacity(), b.capacity());
assert_eq!(a.one_time_burst(), b.one_time_burst());
assert_eq!(a.refill_time_ms(), b.refill_time_ms());
};
compare_buckets(net.rx_rate_limiter.bandwidth().unwrap(), &rx_bytes);
compare_buckets(net.rx_rate_limiter.ops().unwrap(), &rx_ops);
compare_buckets(net.tx_rate_limiter.bandwidth().unwrap(), &tx_bytes);
compare_buckets(net.tx_rate_limiter.ops().unwrap(), &tx_ops);
} | rust_cleaned_test_functions.jsonl/63433 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 694
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39643,
9246,
14763,
388,
368,
341,
286,
1077,
5206,
4179,
284,
9374,
486,
2258,
19722,
31159,
51440,
2973,
486,
2258,
1423,
286,
1077,
1833,
54742,
284,
4179,
41493,
15997,
543,
286,
1077,
320,
12... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_conditions() {
let patterns = vec!["github.com", "^facebook.com", "twitter.com$"];
let expected = vec!["contains \"github.com\"", "starts with \"facebook.com\"", "ends with \"twitter.com\""];
let actual = parse_conditions(patterns);
assert_eq!(actual, expected);
} | rust_cleaned_test_functions.jsonl/29332 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 116
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
54099,
368,
341,
262,
1077,
12624,
284,
7486,
0,
1183,
5204,
905,
497,
39915,
20944,
905,
497,
330,
14679,
905,
3,
6332,
262,
1077,
3601,
284,
7486,
0,
1183,
13372,
7245,
5204,
905,
55853... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_jubjub_bls12() {
let params = JubjubBls12::new();
tests::test_suite::<Bls12>(¶ms);
let test_repr = hex!("9d12b88b08dcbef8a11ee0712d94cb236ee2f4ca17317075bfafc82ce3139d31");
let p = edwards::Point::<Bls12, _>::read(&test_repr[..], ¶ms).unwrap();
let q = edwards::Point::<Bls12, _>::get_for_y(
Fr::from_str("22440861827555040311190986994816762244378363690614952020532787748720529117853").unwrap(),
false,
¶ms
).unwrap();
assert!(p == q);
let test_repr = hex!("9d12b88b08dcbef8a11ee0712d94cb236ee2f4ca17317075bfafc82ce3139db1");
let p = edwards::Point::<Bls12, _>::read(&test_repr[..], ¶ms).unwrap();
let q = edwards::Point::<Bls12, _>::get_for_y(
Fr::from_str("22440861827555040311190986994816762244378363690614952020532787748720529117853").unwrap(),
true,
¶ms
).unwrap();
assert!(p == q);
} | rust_cleaned_test_functions.jsonl/105386 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 472
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5374,
392,
73,
392,
880,
4730,
16,
17,
368,
341,
262,
1077,
3628,
284,
79280,
73,
392,
33,
4730,
16,
17,
486,
931,
1428,
262,
7032,
486,
1944,
57239,
27638,
33,
4730,
16,
17,
44784,
3519,
62... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_abs_decimal() {
let test_cases = vec![("1.1", "1.1"), ("-1.1", "1.1")];
for (arg, expect_output) in test_cases {
let arg = arg.parse::<Decimal>().ok();
let expect_output = expect_output.parse::<Decimal>().ok();
let output = RpnFnScalarEvaluator::new()
.push_param(arg)
.evaluate(ScalarFuncSig::AbsDecimal)
.unwrap();
assert_eq!(output, expect_output, "{:?}", arg);
}
} | rust_cleaned_test_functions.jsonl/9474 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 282
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31170,
74429,
368,
341,
286,
1077,
1273,
41427,
284,
7486,
20703,
445,
16,
13,
16,
497,
330,
16,
13,
16,
3975,
98670,
16,
13,
16,
497,
330,
16,
13,
16,
899,
4821,
286,
369,
320,
858,
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... | 2 |
#[test]
fn test_values() {
let vec = vec![(1, 'a'), (2, 'b'), (3, 'c')];
let map: HashMap<_, _> = vec.into_iter().collect();
let values: Vec<_> = map.values().copied().collect();
assert_eq!(values.len(), 3);
assert!(values.contains(&'a'));
assert!(values.contains(&'b'));
assert!(values.contains(&'c'));
} | rust_cleaned_test_functions.jsonl/26952 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 185
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9146,
368,
341,
286,
1077,
7486,
284,
7486,
0,
9697,
16,
11,
364,
64,
4567,
320,
17,
11,
364,
65,
4567,
320,
18,
11,
364,
66,
863,
935,
286,
1077,
2415,
25,
10528,
27,
6878,
716,
29,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_versions_from_str_max() {
assert_eq!(Err(ProtoverError::ExceedsMax), ProtoSet::from_str("4294967295"));
} | rust_cleaned_test_functions.jsonl/105772 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 67
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
65148,
5673,
2895,
6345,
368,
341,
286,
2060,
10714,
10297,
7747,
7,
31549,
423,
1454,
486,
840,
4635,
82,
5974,
701,
57677,
1649,
486,
1499,
2895,
445,
19,
17,
24,
19,
24,
21,
22,
17,
24,
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 |
#[test]
fn test_claim_neuron_memo_and_controller_by_proxy() {
let owner = *TEST_NEURON_1_OWNER_PRINCIPAL;
let caller = *TEST_NEURON_2_OWNER_PRINCIPAL;
claim_neuron_by_memo_and_controller(owner, caller);
} | rust_cleaned_test_functions.jsonl/1148 | {
"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,
84969,
13925,
36090,
717,
6726,
8378,
21600,
3710,
29712,
368,
341,
262,
1077,
6372,
284,
353,
10033,
14039,
1511,
711,
62,
16,
74323,
10571,
38439,
3298,
969,
280,
262,
1077,
19865,
284,
353,
100... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_apply_jql_number() {
let json = r#"{"post code": "90210", "country": "United States", "country abbreviation": "US", "places": [{"place name": "Beverly Hills", "longitude": -118.4065, "state": "California", "state abbreviation": "CA", "latitude": 34.0901}]}"#;
let selectors = r#"."places"[0]."longitude""#;
let value: String = apply_jql(json, selectors).unwrap();
assert_eq!("-118.4065", value);
} | rust_cleaned_test_functions.jsonl/14759 | {
"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,
36551,
5374,
1470,
5500,
368,
341,
262,
1077,
2951,
284,
435,
55543,
4913,
2203,
2038,
788,
330,
24,
15,
17,
16,
15,
497,
330,
11141,
788,
330,
22372,
4180,
497,
330,
11141,
71478,
788,
330,
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_config_file_defaults() {
// Only version is required
assert_eq!(
InterpreterConfig::from_reader(Cursor::new("version=3.7")).unwrap(),
InterpreterConfig {
version: PythonVersion { major: 3, minor: 7 },
implementation: PythonImplementation::CPython,
shared: true,
abi3: false,
lib_name: None,
lib_dir: None,
executable: None,
pointer_width: None,
build_flags: BuildFlags::default(),
suppress_build_script_link_lines: false,
extra_build_script_lines: vec![],
}
)
} | rust_cleaned_test_functions.jsonl/13937 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 391
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5332,
2458,
42290,
368,
341,
286,
442,
8278,
2319,
374,
2567,
198,
286,
2060,
10714,
33673,
310,
82493,
2648,
486,
1499,
22306,
3025,
3823,
486,
931,
445,
4366,
28,
18,
13,
22,
15197,
15454,
314... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_add_node() {
let mut g: Csr = Csr::new();
let a = g.add_node(());
let b = g.add_node(());
let c = g.add_node(());
assert!(g.add_edge(a, b, ()));
assert!(g.add_edge(b, c, ()));
assert!(g.add_edge(c, a, ()));
println!("{:?}", g);
assert_eq!(g.node_count(), 3);
assert_eq!(g.neighbors_slice(a), &[b]);
assert_eq!(g.neighbors_slice(b), &[c]);
assert_eq!(g.neighbors_slice(c), &[a]);
assert_eq!(g.edge_count(), 3);
} | rust_cleaned_test_functions.jsonl/36545 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 308
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
5084,
368,
341,
286,
1077,
5206,
342,
25,
356,
15094,
284,
356,
15094,
486,
931,
543,
286,
1077,
264,
284,
342,
1364,
5084,
7,
1423,
286,
1077,
293,
284,
342,
1364,
5084,
7,
1423,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_module_functions_with_module() {
let gil = Python::acquire_gil();
let py = gil.python();
let m = pyo3::wrap_pymodule!(module_with_functions_with_module)(py);
py_assert!(
py,
m,
"m.pyfunction_with_module() == 'module_with_functions_with_module'"
);
py_assert!(
py,
m,
"m.pyfunction_with_module_and_py() == 'module_with_functions_with_module'"
);
py_assert!(
py,
m,
"m.pyfunction_with_module_and_default_arg() \
== ('module_with_functions_with_module', 'foo')"
);
py_assert!(
py,
m,
"m.pyfunction_with_module_and_args_kwargs(1, x=1, y=2) \
== ('module_with_functions_with_module', 1, 2)"
);
py_assert!(
py,
m,
"m.pyfunction_with_pass_module_in_attribute() == 'module_with_functions_with_module'"
);
} | rust_cleaned_test_functions.jsonl/22691 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 499
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10750,
31708,
6615,
10750,
368,
341,
262,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
262,
1077,
4510,
284,
342,
321,
43193,
543,
262,
1077,
296,
284,
4510,
78,
18,
486,
10097,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_default() {
let config = ClientConfigBuilder::default()
.controller_uri(MOCK_CONTROLLER_URI)
.build()
.unwrap();
assert_eq!(config.max_connections_in_pool(), u32::max_value() as u32);
assert_eq!(config.max_controller_connections(), 3u32);
assert_eq!(config.connection_type(), ConnectionType::Tokio);
assert_eq!(config.retry_policy(), RetryWithBackoff::default());
} | rust_cleaned_test_functions.jsonl/123712 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 214
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
9993,
368,
341,
286,
1077,
2193,
284,
8423,
2648,
3297,
486,
2258,
741,
310,
659,
7152,
15572,
3189,
16678,
63995,
23116,
340,
310,
659,
5834,
741,
310,
659,
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_parse_command_errors() {
assert_eq!(Shell::parse_command("foo").is_ok(), true);
assert_eq!(Shell::parse_command("foo `{}`").is_ok(), true);
assert_eq!(Shell::parse_command("foo `{\"abc\": 1}`").is_ok(), true);
assert_eq!(Shell::parse_command("foo `{aaa}`").is_ok(), false);
assert_eq!(Shell::parse_command("foo `{").is_ok(), false);
assert_eq!(Shell::parse_command("foo `").is_ok(), false);
} | rust_cleaned_test_functions.jsonl/76572 | {
"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,
21039,
10811,
20196,
368,
341,
286,
2060,
10714,
10297,
25287,
486,
6400,
10811,
445,
7975,
1827,
285,
19817,
1507,
830,
317,
286,
2060,
10714,
10297,
25287,
486,
6400,
10811,
445,
7975,
53692,
5541... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bitv_set_from_uints() {
let uints = vec![0, 2, 2, 3];
let a: BitvSet = uints.into_iter().collect();
let mut b = BitvSet::new();
b.insert(0);
b.insert(2);
b.insert(3);
assert_eq!(a, b);
} | rust_cleaned_test_functions.jsonl/119303 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13996,
85,
2602,
5673,
15807,
82,
368,
341,
286,
1077,
2622,
82,
284,
7486,
20703,
15,
11,
220,
17,
11,
220,
17,
11,
220,
18,
935,
286,
1077,
264,
25,
6495,
85,
1649,
284,
2622,
82,
39860,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_check_point_values() {
let (genesis_config, _) = create_genesis_config(500);
let bank = Arc::new(Bank::new(&genesis_config));
// check that point values are 0 if no previous value was known and current values are not normal
assert_eq!(
bank.check_point_values(std::f64::INFINITY, std::f64::NAN),
(0.0, 0.0)
);
bank.store_account(
&sysvar::rewards::id(),
&sysvar::rewards::create_account(1, 1.0, 1.0),
);
// check that point values are the previous value if current values are not normal
assert_eq!(
bank.check_point_values(std::f64::INFINITY, std::f64::NAN),
(1.0, 1.0)
);
} | rust_cleaned_test_functions.jsonl/42423 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 364
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
6085,
9146,
368,
341,
286,
1077,
320,
77894,
5332,
11,
27439,
284,
1855,
16322,
13774,
5332,
7,
20,
15,
15,
317,
286,
1077,
6073,
284,
19689,
486,
931,
5349,
1180,
486,
931,
2099,
77894,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_frames_and_names() -> Result<()> {
let query1 = parse(
r#"
from orders
select [customer_no, gross, tax, gross - tax]
take 20
"#,
)?;
let query2 = parse(
r#"
from table_1
join customers [customer_no]
"#,
)?;
let (res1, context) = resolve(query1.nodes, None)?;
let (res2, context) = resolve(query2.nodes, Some(context))?;
let (mat, frame, context) = materialize(find_pipeline(res1), context.into(), None)?;
assert_yaml_snapshot!(mat.functions, @r###"
---
- Transform:
From:
name: orders
alias: ~
declared_at: 37
- Transform:
Take:
range:
start: ~
end:
Literal:
Integer: 20
by: []
"###);
assert_yaml_snapshot!(frame.columns, @r###"
---
- Ident: customer_no
- Ident: gross
- Ident: tax
- Expr:
- Ident: gross
- Operator: "-"
- Ident: tax
"###);
let (mat, frame, _) = materialize(find_pipeline(res2), context, None)?;
assert_yaml_snapshot!(mat.functions, @r###"
---
- Transform:
From:
name: table_1
alias: ~
declared_at: 42
- Transform:
Join:
side: Inner
with:
name: customers
alias: ~
declared_at: 43
filter:
Using:
- Ident: customer_no
"###);
assert_yaml_snapshot!(frame.columns, @r###"
---
- Ident: table_1.*
- Ident: customers.*
- Ident: customer_no
"###);
Ok(())
} | rust_cleaned_test_functions.jsonl/90565 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1137
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29319,
8378,
9187,
368,
1464,
5714,
71698,
341,
286,
1077,
3239,
16,
284,
4715,
1006,
310,
435,
2,
698,
286,
504,
10163,
198,
286,
3293,
508,
11049,
6536,
11,
19952,
11,
3742,
11,
19952,
481,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_i128_min() {
Python::with_gil(|py| {
let v = std::i128::MIN;
let obj = v.to_object(py);
assert_eq!(v, obj.extract::<i128>(py).unwrap());
assert!(obj.extract::<i64>(py).is_err());
assert!(obj.extract::<u128>(py).is_err());
})
} | rust_cleaned_test_functions.jsonl/24281 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 190
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5318,
16,
17,
23,
7260,
368,
341,
286,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
341,
310,
1077,
348,
284,
1460,
486,
72,
16,
17,
23,
486,
16413,
280,
310,
1077,
2839,
284,
348,
2389,
53... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_state_update_deser() {
let raw =
include_str!("../../test-data/raw_gateway_responses/get_state_update/1_success.txt");
let state_update: StateUpdate = serde_json::from_str(raw).unwrap();
let storage_diff = &state_update
.state_diff
.storage_diffs
.get(
&FieldElement::from_hex_be(
"0x243b1e9ae747179e11ac685548ee1d6c5691ee9bda33ab0adee6f4838bddc55",
)
.unwrap(),
)
.unwrap()[0];
assert_eq!(
storage_diff.key,
FieldElement::from_hex_be(
"0x37501df619c4fc4e96f6c0243f55e3abe7d1aca7db9af8f3740ba3696b3fdac"
)
.unwrap()
);
assert_eq!(
storage_diff.value,
FieldElement::from_hex_be("0x1a").unwrap()
);
let deployed_contract = &state_update.state_diff.deployed_contracts[0];
assert_eq!(
deployed_contract.address,
FieldElement::from_hex_be(
"0x7da57050effcee2a29d8ed3e3e42f9371bb827cbf96c1d2bcedbefd9004c72c"
)
.unwrap()
);
assert_eq!(
deployed_contract.class_hash,
FieldElement::from_hex_be(
"02c3348ad109f7f3967df6494b3c48741d61675d9a7915b265aa7101a631dc33"
)
.unwrap()
);
} | rust_cleaned_test_functions.jsonl/56205 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 880
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4387,
8882,
15768,
261,
368,
341,
286,
1077,
7112,
4035,
310,
2924,
2895,
17223,
2748,
1944,
13945,
75909,
64049,
81292,
23302,
4387,
8882,
14,
16,
18632,
3909,
3071,
286,
1077,
1584,
8882,
25,
32... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_retrieving_app_level_messagens_slice() {
let mut store = create_store(|s| {
s.add_to_store( builder::build_new_order_single(1, true, "cl1", "AAPL", 100.0, 594.2, FieldSideEnum::Buy, FieldOrdTypeEnum::Limit ) );
s.add_to_store( builder::build_new_order_single(2, true, "cl2", "AAPL", 100.0, 594.2, FieldSideEnum::Buy, FieldOrdTypeEnum::Limit ) );
s.add_to_store( builder::build_new_order_single(3, true, "cl3", "AAPL", 100.0, 594.2, FieldSideEnum::Buy, FieldOrdTypeEnum::Limit ) );
s.add_to_store( builder::build_new_order_single(4, true, "cl4", "AAPL", 100.0, 594.2, FieldSideEnum::Buy, FieldOrdTypeEnum::Limit ) );
s.add_to_store( builder::build_new_order_single(5, true, "cl5", "AAPL", 100.0, 594.2, FieldSideEnum::Buy, FieldOrdTypeEnum::Limit ) );
s.add_to_store( builder::build_new_order_single(6, true, "cl6", "AAPL", 100.0, 594.2, FieldSideEnum::Buy, FieldOrdTypeEnum::Limit ) );
s.add_to_store( builder::build_new_order_single(7, true, "cl7", "AAPL", 100.0, 594.2, FieldSideEnum::Buy, FieldOrdTypeEnum::Limit ) );
});
let entries = build_resend_request_response( &mut store, 2, 5 ).expect("success");
assert_eq!(entries.len(), 4);
assert_eq!(entries.get(0).unwrap().seq, 2);
assert_eq!(entries.get(1).unwrap().seq, 3);
assert_eq!(entries.get(2).unwrap().seq, 4);
assert_eq!(entries.get(3).unwrap().seq, 5);
assert_eq!(entries.get(0).unwrap().message.msg_type(), FieldMsgTypeEnum::OrderSingle);
assert_eq!(entries.get(1).unwrap().message.msg_type(), FieldMsgTypeEnum::OrderSingle);
assert_eq!(entries.get(2).unwrap().message.msg_type(), FieldMsgTypeEnum::OrderSingle);
assert_eq!(entries.get(3).unwrap().message.msg_type(), FieldMsgTypeEnum::OrderSingle);
assert_eq!(store.next_target_seq_num(), 1);
assert_eq!(store.next_sender_seq_num(), 8);
} | rust_cleaned_test_functions.jsonl/129875 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 820
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1288,
8927,
4405,
8191,
8274,
717,
433,
38796,
26488,
368,
341,
262,
1077,
5206,
3553,
284,
1855,
14809,
22428,
82,
91,
341,
286,
274,
1364,
2346,
14809,
7,
7363,
486,
5834,
5921,
7869,
19487,
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_concat_for_different_lengths() {
let empty: &[&str] = &[];
test_concat!("", empty);
test_concat!("a", ["a"]);
test_concat!("ab", ["a", "b"]);
test_concat!("abc", ["", "a", "bc"]);
} | rust_cleaned_test_functions.jsonl/2426 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 135
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57478,
5478,
82741,
54416,
368,
341,
286,
1077,
4287,
25,
44590,
5,
495,
60,
284,
609,
15078,
286,
1273,
57478,
17223,
497,
4287,
317,
286,
1273,
57478,
17223,
64,
497,
4383,
64,
15049,
286,
127... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_encoder_smoke() {
let mut encoder = EncoderBuilder::new().level(1).build(Vec::new()).unwrap();
encoder.write(b"Some ").unwrap();
encoder.write(b"data").unwrap();
let (_, result) = encoder.finish();
result.unwrap();
} | rust_cleaned_test_functions.jsonl/118876 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39068,
15874,
4740,
368,
341,
286,
1077,
5206,
23668,
284,
55115,
3297,
486,
931,
1005,
3294,
7,
16,
568,
5834,
49923,
486,
931,
6011,
15454,
543,
286,
23668,
3836,
1883,
94875,
27510,
15454,
543,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_checked_fixed_point_mul_rounded_up() {
run_test(|| {
let currency = Token(DOT);
let tests: Vec<(Amount<Test>, UnsignedFixedPoint, Amount<Test>)> = vec![
(
Amount::new(10, currency),
UnsignedFixedPoint::checked_from_rational(1, 3).unwrap(),
Amount::new(4, currency),
),
(
Amount::new(9, currency),
UnsignedFixedPoint::checked_from_rational(1, 3).unwrap(),
Amount::new(3, currency),
),
(
Amount::new(10, currency),
UnsignedFixedPoint::checked_from_rational(1, UnsignedFixedPoint::accuracy()).unwrap(),
Amount::new(1, currency),
),
(
Amount::new(10, currency),
UnsignedFixedPoint::from(0),
Amount::new(0, currency),
),
(
Amount::new(UnsignedFixedPoint::accuracy(), currency),
UnsignedFixedPoint::checked_from_rational(1, UnsignedFixedPoint::accuracy()).unwrap(),
Amount::new(1, currency),
),
(
Amount::new(UnsignedFixedPoint::accuracy() + 1, currency),
UnsignedFixedPoint::checked_from_rational(1, UnsignedFixedPoint::accuracy()).unwrap(),
Amount::new(2, currency),
),
];
for (amount, percent, expected) in tests {
let actual = amount.checked_fixed_point_mul_rounded_up(&percent).unwrap();
assert_eq!(actual, expected);
}
})
} | rust_cleaned_test_functions.jsonl/110276 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 861
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
56456,
37839,
6085,
24944,
29896,
291,
8237,
368,
341,
262,
1598,
4452,
79453,
341,
286,
1077,
11413,
284,
9660,
5432,
1793,
317,
286,
1077,
7032,
25,
11312,
28706,
10093,
71273,
8066,
97747,
13520,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_mul32_reg_overflow() {
test_interpreter_and_jit_asm!(
"
mov r0, 0x40000001
mov r1, 4
mul32 r0, r1
exit",
[],
(),
{ |_vm, res: Result| { res.unwrap() == 0x4 } },
4
);
} | rust_cleaned_test_functions.jsonl/58954 | {
"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,
24944,
18,
17,
4920,
79073,
368,
341,
262,
1273,
15318,
28637,
8378,
5374,
275,
67529,
33673,
286,
6228,
286,
1974,
435,
15,
11,
220,
15,
87,
19,
15,
15,
15,
15,
15,
15,
16,
198,
286,
1974,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_url_of_backend() {
let bucket_name = StringNonEmpty::static_str("bucket");
let mut bucket = BucketConf::default(bucket_name);
bucket.prefix = Some(StringNonEmpty::static_str("/backup 02/prefix/"));
let gcs = Config::default(bucket.clone());
assert_eq!(
gcs.url().unwrap().to_string(),
"gcs://bucket/backup%2002/prefix/"
);
bucket.endpoint = Some(StringNonEmpty::static_str("http://endpoint.com"));
assert_eq!(
&Config::default(bucket).url().unwrap().to_string(),
"http://endpoint.com/bucket/backup%2002/prefix/"
);
} | rust_cleaned_test_functions.jsonl/30686 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 318
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2903,
3575,
40011,
368,
341,
286,
1077,
15621,
1269,
284,
923,
8121,
3522,
486,
1978,
2895,
445,
30410,
797,
286,
1077,
5206,
15621,
284,
47768,
15578,
486,
2258,
58934,
1269,
317,
286,
15621,
385... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_closing_sequence_score() {
let input_1 = vec![&'}', &'}', &']', &']', &')', &'}', &')',&']'];
assert_eq!(closing_sequence_score(input_1), 288957);
} | rust_cleaned_test_functions.jsonl/50442 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 99
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
17831,
23735,
10405,
368,
341,
286,
1077,
1946,
62,
16,
284,
7486,
20703,
5,
8275,
516,
609,
8275,
516,
609,
660,
516,
609,
660,
516,
609,
863,
516,
609,
8275,
516,
609,
863,
516,
5,
66... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_8XY5() {
// 0x8XY5 - Subtract the value of register VY from register VX
// Set VF to 00 if a borrow occurs
// Set VF to 01 if a borrow does not occur
let opcode = 0x89A5;
let mut vm = get_vm();
// without borrow
vm.v[0x9] = 0xFF;
vm.v[0xA] = 0x01;
vm.execute_instruction(decode_opcode(opcode), opcode);
assert_eq!(vm.v[0x9], 0xFE);
assert_eq!(vm.v[0xF], 0x1);
// with borrow
vm.v[0x9] = 0x01;
vm.v[0xA] = 0x02;
vm.execute_instruction(decode_opcode(opcode), opcode);
assert_eq!(vm.v[0x9], 0xFF);
assert_eq!(vm.v[0xF], 0x0);
} | rust_cleaned_test_functions.jsonl/253 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 331
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
23,
16356,
20,
368,
341,
262,
442,
220,
15,
87,
23,
16356,
20,
481,
93210,
279,
897,
315,
4161,
647,
56,
504,
4161,
78177,
198,
262,
442,
688,
2573,
72892,
311,
220,
15,
15,
421,
264,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_register() {
let mut event_manager = EventManager::new().unwrap();
let dummy_subscriber = Arc::new(Mutex::new(DummySubscriber::new()));
event_manager
.add_subscriber(dummy_subscriber.clone())
.unwrap();
dummy_subscriber.lock().unwrap().register_ev2();
// because it was just added as part of processing ev1.
event_manager.run().unwrap();
assert!(dummy_subscriber.lock().unwrap().processed_ev1_out());
assert!(!dummy_subscriber.lock().unwrap().processed_ev2_out());
// Check that both ev1 and ev2 are processed.
dummy_subscriber.lock().unwrap().reset_state();
event_manager.run().unwrap();
assert!(dummy_subscriber.lock().unwrap().processed_ev1_out());
assert!(dummy_subscriber.lock().unwrap().processed_ev2_out());
} | rust_cleaned_test_functions.jsonl/92052 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 388
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14000,
368,
341,
286,
1077,
5206,
1538,
12144,
284,
3665,
2043,
486,
931,
1005,
15454,
543,
286,
1077,
17292,
5228,
20351,
284,
19689,
486,
931,
3189,
9371,
486,
931,
5432,
8574,
40236,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_openat() {
const CONTENTS: &[u8] = b"abcd";
let mut tmp = NamedTempFile::new().unwrap();
tmp.write_all(CONTENTS).unwrap();
let dirfd = open(tmp.path().parent().unwrap(),
OFlag::empty(),
Mode::empty()).unwrap();
let fd = openat(dirfd,
tmp.path().file_name().unwrap(),
OFlag::O_RDONLY,
Mode::empty()).unwrap();
let mut buf = [0u8; 1024];
assert_eq!(4, read(fd, &mut buf).unwrap());
assert_eq!(CONTENTS, &buf[0..4]);
close(fd).unwrap();
close(dirfd).unwrap();
} | rust_cleaned_test_functions.jsonl/91354 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 327
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11311,
266,
368,
341,
262,
733,
35768,
50,
25,
44590,
84,
23,
60,
284,
293,
1,
68644,
876,
262,
1077,
5206,
4174,
284,
40459,
12151,
1703,
486,
931,
1005,
15454,
543,
262,
4174,
3836,
5705,
98... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_read_resolv_conf() {
read_resolv_conf(format!("{}/resolv.conf-simple", tests_dir())).expect("simple failed");
read_resolv_conf(format!("{}/resolv.conf-macos", tests_dir())).expect("macos failed");
read_resolv_conf(format!("{}/resolv.conf-linux", tests_dir())).expect("linux failed");
} | rust_cleaned_test_functions.jsonl/39728 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
4918,
35315,
16059,
368,
341,
286,
1349,
4918,
35315,
16059,
20698,
88928,
4472,
416,
35315,
13937,
65957,
497,
7032,
4334,
34670,
17119,
445,
22944,
4641,
797,
286,
1349,
4918,
35315,
16059,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ping_omaha_updates_consecutive_failed_update_checks_and_persists() {
block_on(async {
let mut http = MockHttpRequest::empty();
http.add_error(http_request::mock_errors::make_transport_error());
http.add_response(HttpResponse::new(vec![]));
let response = json!({"response":{
"server": "prod",
"protocol": "3.0",
"app": [{
"appid": "{00000000-0000-0000-0000-000000000001}",
"status": "ok",
}],
}});
let response = serde_json::to_vec(&response).unwrap();
http.add_response(HttpResponse::new(response));
let storage = Rc::new(Mutex::new(MemStorage::new()));
{
let mut storage = storage.lock().await;
storage.set_int(CONSECUTIVE_FAILED_UPDATE_CHECKS, 1);
storage.commit();
}
let mut state_machine = StateMachineBuilder::new_stub()
.storage(Rc::clone(&storage))
.http(http)
.build()
.await;
async_generator::generate(move |mut co| async move {
// storage.
state_machine.ping_omaha(&mut co).await;
assert_eq!(state_machine.context.state.consecutive_failed_update_checks, 2);
{
let storage = storage.lock().await;
assert_eq!(storage.get_int(CONSECUTIVE_FAILED_UPDATE_CHECKS).await, Some(2));
}
state_machine.ping_omaha(&mut co).await;
assert_eq!(state_machine.context.state.consecutive_failed_update_checks, 3);
{
let storage = storage.lock().await;
assert_eq!(storage.get_int(CONSECUTIVE_FAILED_UPDATE_CHECKS).await, Some(3));
}
// Successful ping resets `consecutive_failed_update_checks`.
state_machine.ping_omaha(&mut co).await;
assert_eq!(state_machine.context.state.consecutive_failed_update_checks, 0);
{
let storage = storage.lock().await;
assert_eq!(storage.get_int(CONSECUTIVE_FAILED_UPDATE_CHECKS).await, None);
}
})
.into_complete()
.await;
});
} | rust_cleaned_test_functions.jsonl/59706 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1348
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71661,
62,
316,
13546,
57829,
3382,
85780,
35060,
8882,
75797,
8378,
620,
388,
1671,
368,
341,
286,
2504,
4470,
18285,
341,
310,
1077,
5206,
1758,
284,
14563,
26362,
486,
3194,
543,
310,
1758,
136... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_named_reference() {
assert_matches!("#some-child".parse::<Ref>(), Ok(Ref::Named(name)) if name == "some-child");
assert_matches!("#-".parse::<Ref>(), Ok(Ref::Named(name)) if name == "-");
assert_matches!("#_".parse::<Ref>(), Ok(Ref::Named(name)) if name == "_");
assert_matches!("#7".parse::<Ref>(), Ok(Ref::Named(name)) if name == "7");
assert_matches!("#".parse::<Ref>(), Err(_));
assert_matches!("some-child".parse::<Ref>(), Err(_));
} | rust_cleaned_test_functions.jsonl/16471 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 232
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
71834,
25433,
368,
341,
286,
2060,
38344,
0,
3584,
14689,
23484,
3263,
6400,
27638,
3945,
39019,
7622,
7,
3945,
486,
15810,
3153,
593,
421,
829,
621,
330,
14689,
23484,
797,
286,
2060,
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... | 5 |
#[test]
fn test_row_group_rows_invalid_projection() {
let schema = "
message spark_schema {
REQUIRED INT32 key;
REQUIRED BOOLEAN value;
}
";
let schema = parse_message_type(&schema).unwrap();
let res = test_row_group_rows("nested_maps.snappy.parquet", Some(schema));
assert!(res.is_err());
assert_eq!(
res.unwrap_err(),
general_err!("Root schema does not contain projection")
);
} | rust_cleaned_test_functions.jsonl/69593 | {
"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,
8530,
6288,
10949,
31433,
72738,
368,
341,
286,
1077,
10802,
284,
6228,
414,
1943,
15186,
25371,
341,
286,
66577,
9221,
18,
17,
1376,
280,
286,
66577,
59393,
897,
280,
414,
456,
262,
7620,
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_chain_update_propagation_status2() {
let num_validators = 6;
let keypairs: HashMap<_, _> = iter::repeat_with(|| {
let vote_keypairs = ValidatorVoteKeypairs::new_rand();
(vote_keypairs.node_keypair.pubkey(), vote_keypairs)
})
.take(num_validators)
.collect();
let vote_pubkeys: Vec<_> = keypairs
.values()
.map(|keys| keys.vote_keypair.pubkey())
.collect();
let stake_per_validator = 10_000;
let (mut bank_forks, mut progress_map, _) =
vote_simulator::initialize_state(&keypairs, stake_per_validator);
progress_map
.get_propagated_stats_mut(0)
.unwrap()
.is_leader_slot = true;
bank_forks.set_root(0, &AbsRequestSender::default(), None);
let total_epoch_stake = num_validators as u64 * stake_per_validator;
// make even numbered ones leader slots
for i in 1..=10 {
let parent_bank = bank_forks.get(i - 1).unwrap().clone();
let prev_leader_slot = i - 1;
bank_forks.insert(Bank::new_from_parent(&parent_bank, &Pubkey::default(), i));
let mut fork_progress = ForkProgress::new(
Hash::default(),
Some(prev_leader_slot),
Some(ValidatorStakeInfo {
total_epoch_stake,
..ValidatorStakeInfo::default()
}),
0,
0,
);
let end_range = {
// The earlier slots are one pubkey away from reaching confirmation
if i < 5 {
2
} else {
// The later slots are two pubkeys away from reaching confirmation
1
}
};
fork_progress.propagated_stats.propagated_validators =
vote_pubkeys[0..end_range].iter().copied().collect();
fork_progress.propagated_stats.propagated_validators_stake =
end_range as u64 * stake_per_validator;
progress_map.insert(i, fork_progress);
}
let vote_tracker = VoteTracker::new(&bank_forks.root_bank());
// Insert a new vote
vote_tracker.insert_vote(10, vote_pubkeys[2]);
// the way back through earlier leader banks
ReplayStage::update_propagation_status(
&mut progress_map,
10,
&RwLock::new(bank_forks),
&vote_tracker,
&ClusterSlots::default(),
);
// Only the first 5 banks should have reached the threshold
for i in 1..=10 {
let propagated_stats = &progress_map.get(&i).unwrap().propagated_stats;
if i < 5 {
assert!(propagated_stats.is_propagated);
} else {
assert!(!propagated_stats.is_propagated);
}
}
} | rust_cleaned_test_functions.jsonl/25821 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1565
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30583,
8882,
21663,
27137,
4773,
17,
368,
341,
286,
1077,
1629,
8337,
2973,
284,
220,
21,
280,
286,
1077,
1376,
77256,
25,
10528,
27,
6878,
716,
29,
284,
5367,
486,
30624,
6615,
79453,
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... | 6 |
#[test]
fn test_uuid_fns() {
let uuid = uuid().unwrap();
let boot_id = boot_id().unwrap();
println!("UUID: {}", uuid);
println!("boot UUID: {}", boot_id);
} | rust_cleaned_test_functions.jsonl/68834 | {
"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,
25540,
761,
4412,
368,
341,
286,
1077,
16040,
284,
16040,
1005,
15454,
543,
286,
1077,
10459,
842,
284,
10459,
842,
1005,
15454,
1428,
286,
13751,
17223,
24754,
25,
24689,
16040,
317,
286,
13751,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_vector_4() {
let address = "DdzFFzCqrhsn7ZAhKy8mxkzW6G3wryM7K6bH38VAjE2FesJMxia3UviivMvGz146TP1FpDharxTE6nUgCCnZx2fmtKpmxAosg9Tf5b8y".parse().unwrap();
let public_key = XPub::from_bytes([
0xcd, 0x84, 0x2e, 0x01, 0x0d, 0x81, 0xa6, 0xbe, 0x1e, 0x16, 0x9f, 0xd6, 0x35, 0x21,
0xdb, 0xb9, 0x5f, 0x42, 0x41, 0xfc, 0x82, 0x3f, 0x45, 0xb1, 0xcf, 0x1a, 0x1c, 0xb4,
0xc5, 0x89, 0x57, 0x27, 0x1d, 0x4d, 0x14, 0x2a, 0x22, 0x94, 0xea, 0x5f, 0xa3, 0x16,
0xa4, 0xad, 0xbf, 0xcd, 0x59, 0x7a, 0x7c, 0x89, 0x6a, 0x52, 0xa9, 0xa3, 0xa9, 0xce,
0x49, 0x64, 0x4a, 0x10, 0x2d, 0x00, 0x71, 0x99,
]);
assert_same_address(address, public_key)
} | rust_cleaned_test_functions.jsonl/1896 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 505
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12247,
62,
19,
368,
341,
286,
1077,
2621,
284,
330,
35,
37877,
1748,
89,
34,
23004,
4997,
77,
22,
57,
24765,
77118,
23,
18085,
74,
89,
54,
21,
38,
18,
86,
884,
44,
22,
42,
21,
65,
39,
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_watch() {
macro_rules! assert_contains {
($string:expr, $($test:expr),+) => {
let string = $string; // This might be a function call or something
if !($(string.contains($test))||+) {
panic!("{:?} does not contain any of {:?}", string, [$($test),+]);
}
}
}
let t = TempDir::new().expect("tempdir fail");
let mut child = util::deno_cmd()
.current_dir(util::root_path())
.arg("test")
.arg("--watch")
.arg("--unstable")
.arg("--no-check")
.arg(&t.path())
.env("NO_COLOR", "1")
.stdout(std::process::Stdio::piped())
.stderr(std::process::Stdio::piped())
.spawn()
.expect("failed to spawn script");
let stdout = child.stdout.as_mut().unwrap();
let mut stdout_lines =
std::io::BufReader::new(stdout).lines().map(|r| r.unwrap());
let stderr = child.stderr.as_mut().unwrap();
let mut stderr_lines =
std::io::BufReader::new(stderr).lines().map(|r| r.unwrap());
assert_contains!(
stdout_lines.next().unwrap(),
"No matching test modules found"
);
wait_for_process_finished("Test", &mut stderr_lines);
let foo_file = t.path().join("foo.js");
let bar_file = t.path().join("bar.js");
let foo_test = t.path().join("foo_test.js");
let bar_test = t.path().join("bar_test.js");
std::fs::write(&foo_file, "export default function foo() { 1 + 1 }")
.expect("error writing file");
std::fs::write(&bar_file, "export default function bar() { 2 + 2 }")
.expect("error writing file");
std::fs::write(
&foo_test,
"import foo from './foo.js'; Deno.test('foo', foo);",
)
.expect("error writing file");
std::fs::write(
&bar_test,
"import bar from './bar.js'; Deno.test('bar', bar);",
)
.expect("error writing file");
assert_contains!(stdout_lines.next().unwrap(), "running 1 test");
assert_contains!(stdout_lines.next().unwrap(), "foo", "bar");
assert_contains!(stdout_lines.next().unwrap(), "running 1 test");
assert_contains!(stdout_lines.next().unwrap(), "foo", "bar");
stdout_lines.next();
stdout_lines.next();
stdout_lines.next();
wait_for_process_finished("Test", &mut stderr_lines);
// Change content of the file
std::fs::write(
&foo_test,
"import foo from './foo.js'; Deno.test('foobar', foo);",
)
.expect("error writing file");
assert_contains!(stderr_lines.next().unwrap(), "Restarting");
assert_contains!(stdout_lines.next().unwrap(), "running 1 test");
assert_contains!(stdout_lines.next().unwrap(), "foobar");
stdout_lines.next();
stdout_lines.next();
stdout_lines.next();
wait_for_process_finished("Test", &mut stderr_lines);
// Add test
let another_test = t.path().join("new_test.js");
std::fs::write(&another_test, "Deno.test('another one', () => 3 + 3)")
.expect("error writing file");
assert_contains!(stderr_lines.next().unwrap(), "Restarting");
assert_contains!(stdout_lines.next().unwrap(), "running 1 test");
assert_contains!(stdout_lines.next().unwrap(), "another one");
stdout_lines.next();
stdout_lines.next();
stdout_lines.next();
wait_for_process_finished("Test", &mut stderr_lines);
// Confirm that restarting occurs when a new file is updated
std::fs::write(&another_test, "Deno.test('another one', () => 3 + 3); Deno.test('another another one', () => 4 + 4)")
.expect("error writing file");
assert_contains!(stderr_lines.next().unwrap(), "Restarting");
assert_contains!(stdout_lines.next().unwrap(), "running 2 tests");
assert_contains!(stdout_lines.next().unwrap(), "another one");
assert_contains!(stdout_lines.next().unwrap(), "another another one");
stdout_lines.next();
stdout_lines.next();
stdout_lines.next();
wait_for_process_finished("Test", &mut stderr_lines);
// Confirm that the watcher keeps on working even if the file is updated and has invalid syntax
std::fs::write(&another_test, "syntax error ^^")
.expect("error writing file");
assert_contains!(stderr_lines.next().unwrap(), "Restarting");
assert_contains!(stderr_lines.next().unwrap(), "error:");
assert_contains!(stderr_lines.next().unwrap(), "Test failed");
// Then restore the file
std::fs::write(&another_test, "Deno.test('another one', () => 3 + 3)")
.expect("error writing file");
assert_contains!(stderr_lines.next().unwrap(), "Restarting");
assert_contains!(stdout_lines.next().unwrap(), "running 1 test");
assert_contains!(stdout_lines.next().unwrap(), "another one");
stdout_lines.next();
stdout_lines.next();
stdout_lines.next();
wait_for_process_finished("Test", &mut stderr_lines);
// Confirm that the watcher keeps on working even if the file is updated and the test fails
// This also confirms that it restarts when dependencies change
std::fs::write(
&foo_file,
"export default function foo() { throw new Error('Whoops!'); }",
)
.expect("error writing file");
assert_contains!(stderr_lines.next().unwrap(), "Restarting");
assert_contains!(stdout_lines.next().unwrap(), "running 1 test");
assert_contains!(stdout_lines.next().unwrap(), "FAILED");
while !stdout_lines.next().unwrap().contains("test result") {}
stdout_lines.next();
wait_for_process_finished("Test", &mut stderr_lines);
// Then restore the file
std::fs::write(&foo_file, "export default function foo() { 1 + 1 }")
.expect("error writing file");
assert_contains!(stderr_lines.next().unwrap(), "Restarting");
assert_contains!(stdout_lines.next().unwrap(), "running 1 test");
assert_contains!(stdout_lines.next().unwrap(), "foo");
stdout_lines.next();
stdout_lines.next();
stdout_lines.next();
wait_for_process_finished("Test", &mut stderr_lines);
// Test that circular dependencies work fine
std::fs::write(
&foo_file,
"import './bar.js'; export default function foo() { 1 + 1 }",
)
.expect("error writing file");
std::fs::write(
&bar_file,
"import './foo.js'; export default function bar() { 2 + 2 }",
)
.expect("error writing file");
// the watcher process is still alive
assert!(child.try_wait().unwrap().is_none());
child.kill().unwrap();
drop(t);
} | rust_cleaned_test_functions.jsonl/25039 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2836
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58562,
368,
341,
414,
18072,
21407,
0,
2060,
63598,
341,
286,
1711,
917,
96011,
11,
93977,
1944,
96011,
701,
36197,
589,
341,
688,
1077,
914,
284,
400,
917,
26,
442,
1096,
2578,
387,
264,
729,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_qmp_resp() {
// 1.Empty response and ID change;
let mut resp = Response::create_empty_response();
resp.change_id(Some(0));
let json_msg = r#"{"return":{},"id":0}"#;
assert_eq!(serde_json::to_string(&resp).unwrap(), json_msg);
resp.change_id(Some(1));
let json_msg = r#"{"return":{},"id":1}"#;
assert_eq!(serde_json::to_string(&resp).unwrap(), json_msg);
// 2.Normal response
let resp_value = schema::StatusInfo {
singlestep: false,
running: true,
status: schema::RunState::running,
};
let resp = Response::create_response(serde_json::to_value(&resp_value).unwrap(), None);
let json_msg = r#"{"return":{"running":true,"singlestep":false,"status":"running"}}"#;
assert_eq!(serde_json::to_string(&resp).unwrap(), json_msg);
// 3.Error response
let qmp_err =
schema::QmpErrorClass::GenericError("Invalid Qmp command arguments!".to_string());
let resp = Response::create_error_response(qmp_err, None).unwrap();
let json_msg =
r#"{"error":{"class":"GenericError","desc":"Invalid Qmp command arguments!"}}"#;
assert_eq!(serde_json::to_string(&resp).unwrap(), json_msg);
} | rust_cleaned_test_functions.jsonl/66355 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 579
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8976,
1307,
35160,
368,
341,
286,
442,
220,
16,
11180,
2033,
323,
3034,
2297,
280,
286,
1077,
5206,
9039,
284,
5949,
486,
3182,
15124,
9655,
543,
286,
9039,
21469,
842,
65405,
7,
15,
3237,
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_writer_lock() {
let lock = RwLock::<usize>::default();
let val = 10;
let mut guard = lock.write(1);
*guard = val;
assert_eq!(lock.wlock.load(Ordering::Relaxed), true);
assert_eq!(lock.rlock[0].load(Ordering::Relaxed), 0);
assert_eq!(unsafe { *lock.data.get() }, val);
} | rust_cleaned_test_functions.jsonl/77522 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 175
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28908,
9818,
368,
341,
286,
1077,
5296,
284,
55294,
11989,
27638,
51878,
6831,
2258,
543,
286,
1077,
1044,
284,
220,
16,
15,
401,
286,
1077,
5206,
7616,
284,
5296,
3836,
7,
16,
317,
286,
353,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_from_iterator() {
let list = VecList::from_iter([0, 1, -1, 2, -2].iter().cloned());
assert_eq!(list, &[0, 1, -1, 2, -2][..]);
} | rust_cleaned_test_functions.jsonl/11521 | {
"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,
13251,
2019,
5673,
13491,
368,
341,
286,
1077,
1140,
284,
11312,
852,
486,
1499,
11723,
2561,
15,
11,
220,
16,
11,
481,
16,
11,
220,
17,
11,
481,
17,
936,
2015,
1005,
564,
19684,
1423,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_urlencoded_error() {
let resp: HttpResponse =
UrlencodedError::Overflow { size: 0, limit: 0 }.error_response();
assert_eq!(resp.status(), StatusCode::PAYLOAD_TOO_LARGE);
let resp: HttpResponse = UrlencodedError::UnknownLength.error_response();
assert_eq!(resp.status(), StatusCode::LENGTH_REQUIRED);
let resp: HttpResponse = UrlencodedError::ContentType.error_response();
assert_eq!(resp.status(), StatusCode::BAD_REQUEST);
} | rust_cleaned_test_functions.jsonl/26844 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 212
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2903,
19329,
4096,
368,
341,
286,
1077,
9039,
25,
17580,
4035,
310,
22840,
19329,
1454,
486,
42124,
314,
1379,
25,
220,
15,
11,
3930,
25,
220,
15,
16908,
841,
9655,
543,
286,
2060,
10714,
10297,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_hmac() {
use crate::CryptoCtx;
let ctx = CryptoCtx::new();
let key_handle = ctx.symmetric_key_generate("HMAC/SHA-512", None).unwrap();
let state_handle = ctx
.symmetric_state_open("HMAC/SHA-512", Some(key_handle), None)
.unwrap();
ctx.symmetric_state_absorb(state_handle, b"data").unwrap();
ctx.symmetric_state_absorb(state_handle, b"more_data")
.unwrap();
let tag_handle = ctx.symmetric_state_squeeze_tag(state_handle).unwrap();
let raw_tag = tag_to_vec(&ctx, tag_handle).unwrap();
let tag_handle = ctx.symmetric_state_squeeze_tag(state_handle).unwrap();
ctx.symmetric_tag_verify(tag_handle, &raw_tag).unwrap();
ctx.symmetric_state_close(state_handle).unwrap();
ctx.symmetric_key_close(key_handle).unwrap();
ctx.symmetric_tag_close(tag_handle).unwrap();
} | rust_cleaned_test_functions.jsonl/132172 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 379
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1523,
11948,
368,
341,
262,
990,
17717,
486,
58288,
23684,
401,
262,
1077,
5635,
284,
32886,
23684,
486,
931,
1428,
262,
1077,
1376,
10630,
284,
5635,
44906,
3097,
48851,
445,
39,
25788,
14,
33145... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_distance() {
let first_move = Move {
start: Point { x: 10, y: 0 },
end: Point { x: 10, y: 50 },
move_type: MoveType::Vertical,
};
assert_eq!(50, first_move.distance());
} | rust_cleaned_test_functions.jsonl/44996 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 152
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
19464,
368,
341,
260,
1077,
1156,
17134,
284,
14561,
341,
394,
1191,
25,
5126,
314,
856,
25,
220,
16,
15,
11,
379,
25,
220,
15,
1153,
394,
835,
25,
5126,
314,
856,
25,
220,
16,
15,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_commutation() {
let basis = hermitian_basis_from_spin(0.5);
let x = find_structure_constants(&basis);
assert_eq!(x.len(), 3 * 2);
let basis = hermitian_basis_from_spin(1.);
let x = find_structure_constants(&basis);
assert_eq!(x.len(), 23 * 2);
} | rust_cleaned_test_functions.jsonl/79987 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 160
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2965,
30971,
368,
341,
286,
1077,
8037,
284,
1059,
1763,
1103,
62696,
5673,
47965,
7,
15,
13,
20,
317,
286,
1077,
856,
284,
1477,
38283,
55642,
2099,
88826,
317,
286,
2060,
10714,
10297,
87,
194... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_handle_request() {
let to_vmm_fd = EventFd::new(libc::EFD_NONBLOCK).unwrap();
let (api_request_sender, _from_api) = channel();
let (to_api, vmm_response_receiver) = channel();
let mut api_server = ApiServer::new(api_request_sender, vmm_response_receiver, to_vmm_fd);
// Test an Actions request.
let (mut sender, receiver) = UnixStream::pair().unwrap();
let mut connection = HttpConnection::new(receiver);
sender
.write_all(
b"PUT /actions HTTP/1.1\r\n\
Content-Type: application/json\r\n\
Content-Length: 49\r\n\r\n{ \
\"action_type\": \"Invalid\", \
\"payload\": \"string\" \
}",
)
.unwrap();
assert!(connection.try_read().is_ok());
let req = connection.pop_parsed_request().unwrap();
let response = api_server.handle_request(&req, 0);
assert_eq!(response.status(), StatusCode::BadRequest);
// Test a Get Info request.
to_api
.send(Box::new(Ok(VmmData::InstanceInformation(
InstanceInfo::default(),
))))
.unwrap();
sender.write_all(b"GET / HTTP/1.1\r\n\r\n").unwrap();
assert!(connection.try_read().is_ok());
let req = connection.pop_parsed_request().unwrap();
let response = api_server.handle_request(&req, 0);
assert_eq!(response.status(), StatusCode::OK);
// Test erroneous request.
sender
.write_all(
b"GET /mmds HTTP/1.1\r\n\
Content-Type: application/json\r\n\
Content-Length: 2\r\n\r\n{}",
)
.unwrap();
assert!(connection.try_read().is_ok());
let req = connection.pop_parsed_request().unwrap();
let response = api_server.handle_request(&req, 0);
assert_eq!(response.status(), StatusCode::BadRequest);
} | rust_cleaned_test_functions.jsonl/78941 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 996
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10630,
7893,
368,
341,
286,
1077,
311,
2273,
3821,
17676,
284,
3665,
74476,
486,
931,
44828,
66,
486,
36,
14596,
22128,
39964,
568,
15454,
543,
286,
1077,
320,
2068,
7893,
54356,
11,
716,
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_case_15() {
let key = "2aa209e24478fa1bd6f6ffabe98555e034342cbec07364c54d1e407e282ef08e";
let nonce = "dbfdbde936c9d42df58ae15889f5c939";
let expected_output =
"f5047baa0acf9a603415a09b64268d77712ae902c73490e9c53db593765726db";
hchacha_test_runner(key, nonce, expected_output);
} | rust_cleaned_test_functions.jsonl/44677 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 219
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19096,
62,
16,
20,
368,
341,
310,
1077,
1376,
284,
330,
17,
5305,
17,
15,
24,
68,
17,
19,
19,
22,
23,
3632,
16,
8940,
21,
69,
21,
542,
8229,
24,
23,
20,
20,
20,
68,
15,
18,
19,
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... | 1 |
#[test]
fn test_zeroize() {
use zeroize::Zeroize;
let mut a = Fp::one();
a.zeroize();
assert!(bool::from(a.is_zero()));
} | rust_cleaned_test_functions.jsonl/23238 | {
"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,
19359,
551,
368,
341,
262,
990,
7168,
551,
486,
17999,
551,
401,
262,
1077,
5206,
264,
284,
434,
79,
486,
603,
543,
262,
264,
25847,
551,
543,
262,
2060,
10297,
2641,
486,
1499,
2877,
2079,
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 |
#[test]
fn test_file_open_error() {
let dir = tempfile::Builder::new()
.prefix("test_file_open_error")
.tempdir()
.unwrap();
let cfg = Config {
dir: dir.path().to_str().unwrap().to_owned(),
..Default::default()
};
let fs = Arc::new(ObfuscatedFileSystem::default());
{
let _f = FailGuard::new("log_fd::create::err", "return");
assert!(Engine::open_with_file_system(cfg.clone(), fs.clone()).is_err());
}
{
let _f = FailGuard::new("log_fd::open::err", "return");
let _ = Engine::open_with_file_system(cfg.clone(), fs.clone()).unwrap();
assert!(Engine::open_with_file_system(cfg, fs).is_err());
}
} | rust_cleaned_test_functions.jsonl/53486 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 324
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2458,
11311,
4096,
368,
341,
262,
1077,
5419,
284,
54819,
486,
3297,
486,
931,
741,
286,
659,
11849,
445,
1944,
2458,
11311,
4096,
1138,
286,
659,
3888,
3741,
741,
286,
659,
15454,
543,
262,
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... | 1 |
#[test]
fn test_pass_superclass() {
let hdr = indoc! {"
#include <memory>
class A {
public:
virtual void foo() const {};
virtual ~A() {}
};
class B : public A {
public:
void bar() const {}
};
inline std::unique_ptr<B> get_b() { return std::make_unique<B>(); }
inline void take_a(const A&) {}
"};
let rs = quote! {
let b = ffi::get_b();
ffi::take_a(b.as_ref().unwrap().as_ref());
};
run_test("", hdr, rs, &["A", "B", "get_b", "take_a"], &[]);
} | rust_cleaned_test_functions.jsonl/9976 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 268
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15464,
38886,
1040,
368,
341,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
262,
671,
997,
366,
17269,
397,
262,
536,
362,
341,
262,
584,
510,
286,
4108,
737,
15229,
368,
733,
9321,
286,
4108... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_exec_special_noop() {
let header = make_test_header(EndianSlice::new(&[], LittleEndian));
let initial_registers = LineRow::new(&header);
let opcode = LineInstruction::Special(16);
let expected_registers = initial_registers;
assert_exec_opcode(header, initial_registers, opcode, expected_registers, true);
} | rust_cleaned_test_functions.jsonl/3358 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 149
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18430,
41629,
6536,
453,
368,
341,
286,
1077,
4247,
284,
1281,
4452,
8757,
7,
43231,
33236,
486,
931,
2099,
12995,
14671,
43231,
3237,
286,
1077,
2856,
78360,
284,
7083,
3102,
486,
931,
2099,
2708... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_shuffle() {
let mut r = thread_rng();
let empty: &mut [int] = &mut [];
r.shuffle(empty);
let mut one = [1];
r.shuffle(&mut one);
let b: &[_] = &[1];
assert_eq!(one, b);
let mut two = [1, 2];
r.shuffle(&mut two);
assert!(two == [1, 2] || two == [2, 1]);
let mut x = [1, 1, 1];
r.shuffle(&mut x);
let b: &[_] = &[1, 1, 1];
assert_eq!(x, b);
} | rust_cleaned_test_functions.jsonl/76079 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 276
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73484,
368,
341,
286,
1077,
5206,
435,
284,
4516,
66849,
543,
286,
1077,
4287,
25,
609,
6984,
508,
396,
60,
284,
609,
6984,
5907,
286,
435,
45048,
24216,
317,
286,
1077,
5206,
825,
284,
508,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_if_else_statement() {
assert_eq!(
parse_statement(&b"jika a == salah {\n} atau {\n}"[..]),
Ok((
&b""[..],
Statement::IfStatement(IfStatement {
test: Expression::BinaryExpression(Box::new(BinaryExpression {
left: Expression::Identifier(Identifier {
name: String::from("a")
}),
right: Expression::Literal(Literal::Boolean(false)),
operator: Operator::Equal
})),
consequent: BlockStatement { body: None },
alternate: Some(AlternateStatement::BlockStatement(BlockStatement {
body: None
}))
})
))
);
} | rust_cleaned_test_functions.jsonl/129439 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 513
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11119,
62628,
37404,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
37404,
2099,
65,
1,
73,
11496,
264,
621,
77324,
28152,
77,
92,
38372,
28152,
77,
9863,
95874,
17036,
310,
7622,
94702,
394,
609,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_with() {
test_derive! {
custom_debug_derive {
struct Point {
#[debug(with = "my_fmt")]
x: f32,
y: f32,
}
}
expands to {
#[allow(non_upper_case_globals)]
const _DERIVE_core_fmt_Debug_FOR_Point: () = {
impl ::core::fmt::Debug for Point {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Point { x: ref __binding_0, y: ref __binding_1, } => {
let mut s = f.debug_struct("Point");
s.field("x", &{
struct DebugWith<'a, T: 'a> {
data: &'a T,
fmt: fn(&T, &mut ::core::fmt::Formatter) -> ::core::fmt::Result,
}
impl<'a, T: 'a> ::core::fmt::Debug for DebugWith<'a, T> {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
(self.fmt)(self.data, f)
}
}
DebugWith {
data: __binding_0,
fmt: my_fmt,
}
});
s.field("y", __binding_1);
s.finish()
}
}
}
}
};
}
no_build
}
} | rust_cleaned_test_functions.jsonl/61110 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1330
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
368,
341,
262,
1273,
35345,
533,
0,
341,
286,
2526,
15446,
35345,
533,
341,
310,
2036,
5126,
341,
394,
11506,
8349,
16980,
284,
330,
2408,
38128,
5422,
394,
856,
25,
282,
18,
17,
345,
39... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_display() {
macro_rules! t(
($path:expr, $exp:expr, $expf:expr) => (
{
let path = Path::new($path);
let f = format!("{}", path.display());
assert!(f.as_slice() == $exp);
let f = format!("{}", path.filename_display());
assert!(f.as_slice() == $expf);
}
)
)
t!(b"foo", "foo", "foo");
t!(b"foo/bar", "foo/bar", "bar");
t!(b"/", "/", "");
t!(b"foo\xFF", "foo\uFFFD", "foo\uFFFD");
t!(b"foo\xFF/bar", "foo\uFFFD/bar", "bar");
t!(b"foo/\xFFbar", "foo/\uFFFDbar", "\uFFFDbar");
t!(b"\xFFfoo/bar\xFF", "\uFFFDfoo/bar\uFFFD", "bar\uFFFD");
} | rust_cleaned_test_functions.jsonl/7680 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 492
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14825,
368,
341,
286,
18072,
21407,
0,
259,
1006,
310,
1711,
2343,
96011,
11,
400,
4580,
96011,
11,
400,
4580,
69,
96011,
8,
589,
2399,
394,
341,
503,
1077,
1815,
284,
7933,
486,
931,
699,
234... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_check_txn_status_resolving_pessimistic_lock() {
let engine = TestEngineBuilder::new().build().unwrap();
let k = b"k1";
let v = b"v1";
let ts = TimeStamp::compose;
// Check with resolving_pessimistic_lock flag.
must_success(
&engine,
k,
ts(3, 0),
ts(3, 0),
ts(4, 0),
true,
false,
true,
|s| s == LockNotExistDoNothing,
);
must_get_rollback_ts_none(&engine, k, ts(5, 0));
// rollback_if_not_exist is set to false.
must_err(&engine, k, ts(3, 0), ts(5, 0), ts(5, 0), false, false, true);
must_acquire_pessimistic_lock_with_ttl(&engine, k, k, ts(10, 0), ts(10, 0), 10);
must_pessimistic_locked(&engine, k, ts(10, 0), ts(10, 0));
must_success(
&engine,
k,
ts(10, 0),
ts(11, 0),
ts(11, 0),
true,
false,
true,
uncommitted(10, TimeStamp::zero(), false),
);
// be pessimistically rolled back but there will not be a rollback record.
must_success(
&engine,
k,
ts(10, 0),
ts(21, 0),
ts(21, 0),
true,
false,
true,
|s| s == PessimisticRollBack,
);
must_unlocked(&engine, k);
must_get_rollback_ts_none(&engine, k, ts(22, 0));
// Should return locked status.
must_prewrite_put_impl(
&engine,
k,
v,
k,
&None,
ts(30, 0),
false,
10,
TimeStamp::zero(),
1,
/* min_commit_ts */ TimeStamp::zero(),
/* max_commit_ts */ TimeStamp::zero(),
false,
);
must_success(
&engine,
k,
ts(30, 0),
ts(31, 0),
ts(31, 0),
true,
false,
true,
uncommitted(10, TimeStamp::zero(), false),
);
// rollback record should be written and the transaction status is certain.
must_success(
&engine,
k,
ts(30, 0),
ts(41, 0),
ts(41, 0),
true,
false,
true,
|s| s == TtlExpire,
);
must_unlocked(&engine, k);
must_get_rollback_ts(&engine, k, ts(30, 0));
// Path: the resolving_pessimistic_lock is false and the primary key lock is pessimistic
must_acquire_pessimistic_lock_with_ttl(&engine, k, k, ts(50, 0), ts(50, 0), 10);
must_pessimistic_locked(&engine, k, ts(50, 0), ts(50, 0));
must_success(
&engine,
k,
ts(50, 0),
ts(61, 0),
ts(61, 0),
true,
false,
/* resolving_pessimistic_lock */ false,
|s| s == TtlExpire,
);
must_unlocked(&engine, k);
must_get_rollback_ts(&engine, k, ts(50, 0));
} | rust_cleaned_test_functions.jsonl/125141 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1923
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7200,
92299,
4773,
4918,
19648,
620,
66733,
4532,
9818,
368,
341,
286,
1077,
4712,
284,
3393,
4571,
3297,
486,
931,
1005,
5834,
1005,
15454,
543,
286,
1077,
595,
284,
293,
62911,
16,
876,
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... | 1 |
#[test]
fn test_suffix_param() {
for suffix_param in vec!["-s", "--suffix"] {
let path = "/foo/bar/baz.exe";
new_ucmd!()
.args(&[suffix_param, ".exe", path, path])
.succeeds()
.stdout_only("baz\nbaz\n");
}
} | rust_cleaned_test_functions.jsonl/82224 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 155
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
37151,
4090,
368,
341,
262,
369,
20525,
4090,
304,
7486,
0,
1183,
12,
82,
497,
14482,
26786,
1341,
341,
286,
1077,
1815,
284,
3521,
7975,
49513,
3470,
1370,
19399,
876,
286,
501,
68887,
2277,
0,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_send_task() {
let mut t: Turbine<TestSlot> = Turbine::new(1024);
let e1 = t.ep_new();
assert!(e1.is_ok() == true);
let e2 = t.ep_new();
assert!(e2.is_ok() == true);
let _ = t.ep_depends(e2.unwrap(), e1.unwrap());
let ep1 = t.ep_finalize(e1.unwrap());
let ep2 = t.ep_finalize(e2.unwrap());
thread::spawn(move || {
let _a = ep1;
});
thread::spawn(move || {
let _b = ep2;
});
} | rust_cleaned_test_functions.jsonl/65711 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 296
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13565,
12184,
368,
341,
286,
1077,
5206,
259,
25,
8705,
46561,
71273,
19877,
29,
284,
8705,
46561,
486,
931,
7,
16,
15,
17,
19,
317,
286,
1077,
384,
16,
284,
259,
33376,
5921,
543,
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... | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.