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_get_log_from_txhash() {
let tx_hash = "0xcc699808af959a6c058a3b77f14f9dc18658c02b1b427d9d3cde01e370802ccf";
let endpoint = "http://127.0.0.1:9545";
let res = get_receipt_from_tx_hash(endpoint, tx_hash).unwrap().logs;
println!("{:?}", res);
for item in res {
let mut stream = RlpStream::new();
item.rlp_append(&mut stream);
println!("{:?}", hex::encode(stream.out()));
}
} | rust_cleaned_test_functions.jsonl/76364 | {
"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,
3062,
5224,
5673,
17805,
8296,
368,
341,
262,
1077,
9854,
8950,
284,
330,
15,
47380,
21,
24,
24,
23,
15,
23,
2577,
24,
20,
24,
64,
21,
66,
15,
20,
23,
64,
18,
65,
22,
22,
69,
16,
19,
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... | 2 |
#[test]
fn test_sort_stakes_basic() {
let pubkey0 = Pubkey::new_rand();
let pubkey1 = Pubkey::new_rand();
let mut stakes = vec![(pubkey0, 1), (pubkey1, 2)];
sort_stakes(&mut stakes);
assert_eq!(stakes, vec![(pubkey1, 2), (pubkey0, 1)]);
} | rust_cleaned_test_functions.jsonl/4397 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 144
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18435,
1261,
2050,
34729,
368,
341,
286,
1077,
95116,
15,
284,
22611,
792,
486,
931,
33864,
543,
286,
1077,
95116,
16,
284,
22611,
792,
486,
931,
33864,
543,
286,
1077,
5206,
44425,
284,
7486,
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... | 1 |
#[test]
fn test_leader_transfer_back() {
setup_for_test();
let mut nt = Network::new(vec![None, None, None]);
nt.send(vec![new_message(1, 1, MessageType::MsgHup, 0)]);
nt.isolate(3);
nt.send(vec![new_message(3, 1, MessageType::MsgTransferLeader, 0)]);
assert_eq!(nt.peers[&1].lead_transferee.unwrap(), 3);
// Transfer leadership back to self.
nt.send(vec![new_message(1, 1, MessageType::MsgTransferLeader, 0)]);
check_leader_transfer_state(&nt.peers[&1], StateRole::Leader, 1);
} | rust_cleaned_test_functions.jsonl/107173 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 223
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
79991,
35403,
3895,
368,
341,
262,
6505,
5478,
4452,
543,
262,
1077,
5206,
31412,
284,
8141,
486,
931,
25592,
20703,
4064,
11,
2240,
11,
2240,
2558,
262,
31412,
5219,
25592,
20703,
931,
6462,
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_invalid_json_read_record() {
let schema = Arc::new(Schema::new(vec![Field::new(
"a",
DataType::Struct(vec![Field::new("a", DataType::Utf8, true)]),
true,
)]));
let builder = ReaderBuilder::new().with_schema(schema).with_batch_size(64);
let mut reader: Reader<File> = builder
.build::<File>(File::open("test/data/uk_cities_with_headers.csv").unwrap())
.unwrap();
assert_eq!(
reader.next().err().unwrap().to_string(),
"Json error: Not valid JSON: expected value at line 1 column 1",
);
} | rust_cleaned_test_functions.jsonl/22592 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 314
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
9455,
6443,
14192,
368,
341,
286,
1077,
10802,
284,
19689,
486,
931,
3759,
3416,
486,
931,
25592,
20703,
1877,
486,
931,
1006,
310,
330,
64,
756,
310,
33172,
486,
9422,
25592,
20703,
1877,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_into_builder() {
let mut resp: Response = "test".into();
assert_eq!(resp.status(), StatusCode::OK);
resp.add_cookie(&crate::http::Cookie::new("cookie1", "val100"))
.unwrap();
let mut builder: ResponseBuilder = resp.into();
let resp = builder.status(StatusCode::BAD_REQUEST).finish();
assert_eq!(resp.status(), StatusCode::BAD_REQUEST);
let cookie = resp.cookies().next().unwrap();
assert_eq!((cookie.name(), cookie.value()), ("cookie1", "val100"));
} | rust_cleaned_test_functions.jsonl/18843 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 236
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45514,
28532,
368,
341,
286,
1077,
5206,
9039,
25,
5949,
284,
330,
1944,
3263,
18122,
543,
286,
2060,
10714,
10297,
18243,
4299,
1507,
53403,
486,
3925,
626,
286,
9039,
1364,
38663,
2099,
61711,
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_conflict_remove() {
let mut m = HashMap::with_capacity(4);
assert!(m.insert(1, 2).is_none());
assert_eq!(*m.get(&1).unwrap(), 2);
assert!(m.insert(5, 3).is_none());
assert_eq!(*m.get(&1).unwrap(), 2);
assert_eq!(*m.get(&5).unwrap(), 3);
assert!(m.insert(9, 4).is_none());
assert_eq!(*m.get(&1).unwrap(), 2);
assert_eq!(*m.get(&5).unwrap(), 3);
assert_eq!(*m.get(&9).unwrap(), 4);
assert!(m.remove(&1).is_some());
assert_eq!(*m.get(&9).unwrap(), 4);
assert_eq!(*m.get(&5).unwrap(), 3);
} | rust_cleaned_test_functions.jsonl/8506 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 328
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16059,
21242,
18193,
368,
341,
286,
1077,
5206,
296,
284,
10528,
486,
4197,
35603,
7,
19,
317,
286,
2060,
10297,
76,
7030,
7,
16,
11,
220,
17,
568,
285,
31488,
1423,
286,
2060,
10714,
0,
4071,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mv_uniform() {
let bounds = ((0u8, 255u8), (0u8, 31u8), (128u8, 255u8));
let dist = MultivariateUniform::from([
bounds.0 .0..=bounds.0 .1,
bounds.1 .0..=bounds.1 .1,
bounds.2 .0..=bounds.2 .1,
]);
let mut rng = rand::thread_rng();
for _ in 0..100 {
let out = dist.sample(&mut rng);
assert!(out[0] >= bounds.0 .0 && out[0] <= bounds.0 .1);
assert!(out[1] >= bounds.1 .0 && out[1] <= bounds.1 .1);
assert!(out[2] >= bounds.2 .0 && out[2] <= bounds.2 .1);
}
} | rust_cleaned_test_functions.jsonl/65101 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 348
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
73187,
45066,
368,
341,
286,
1077,
14262,
284,
1781,
15,
84,
23,
11,
220,
17,
20,
20,
84,
23,
701,
320,
15,
84,
23,
11,
220,
18,
16,
84,
23,
701,
320,
16,
17,
23,
84,
23,
11,
220,
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... | 5 |
#[test]
fn test_new_entry() {
let slot = 0;
// account_info type that IS cached
let account_info = AccountInfoTest::default();
let index = AccountsIndex::default_for_tests();
let new_entry: AccountMapEntry<_> =
PreAllocatedAccountMapEntry::new(slot, account_info, &index.storage.storage).into();
assert_eq!(new_entry.ref_count.load(Ordering::Relaxed), 0);
assert_eq!(new_entry.slot_list.read().unwrap().capacity(), 1);
assert_eq!(
new_entry.slot_list.read().unwrap().to_vec(),
vec![(slot, account_info)]
);
// account_info type that is NOT cached
let account_info = true;
let index = AccountsIndex::default_for_tests();
let new_entry: AccountMapEntry<_> =
PreAllocatedAccountMapEntry::new(slot, account_info, &index.storage.storage).into();
assert_eq!(new_entry.ref_count.load(Ordering::Relaxed), 1);
assert_eq!(new_entry.slot_list.read().unwrap().capacity(), 1);
assert_eq!(
new_entry.slot_list.read().unwrap().to_vec(),
vec![(slot, account_info)]
);
} | rust_cleaned_test_functions.jsonl/99718 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 524
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
9078,
368,
341,
286,
1077,
9446,
284,
220,
15,
280,
286,
442,
2692,
3109,
943,
429,
3424,
20579,
198,
286,
1077,
2692,
3109,
284,
8615,
1731,
2271,
486,
2258,
543,
286,
1077,
1922,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_gitlab_urls() {
let urls = &[
(
"https://gitlab.com/proj/grp/subgrp/repo.git",
"proj/grp/subgrp/repo",
),
("https://gitlab.com/proj/grp/repo.git", "proj/grp/repo"),
("https://gitlab.com/proj/repo.git", "proj/repo"),
("https://gitlab.com/proj/repo", "proj/repo"),
(
"git@gitlab.com:proj/grp/subgrp/repo.git",
"proj/grp/subgrp/repo",
),
("git@gitlab.com:proj/repo.git", "proj/repo"),
("git@gitlab.com:proj/repo", "proj/repo"),
("gitlab.com:proj/grp/repo.git", "proj/grp/repo"),
("gitlab.com:proj/repo.git", "proj/repo"),
("gitlab.com:proj/repo", "proj/repo"),
];
for (url, expected) in urls {
let parsed = GitRemoteRepo::from_str(url);
assert!(parsed.is_ok());
assert_eq!(
parsed.unwrap(),
GitRemoteRepo::GitLabRepo {
repo_slug: expected.to_string()
}
);
}
} | rust_cleaned_test_functions.jsonl/20909 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 723
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
68801,
14380,
32822,
368,
341,
286,
1077,
29984,
284,
609,
9640,
310,
2399,
394,
330,
2428,
1110,
12882,
14380,
905,
18008,
73,
40336,
79,
37885,
42854,
10758,
5368,
32799,
756,
394,
330,
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... | 2 |
#[test]
fn test_transparent_struct() {
#[derive(Serialize, Deserialize, PartialEq, Debug)]
#[serde(transparent)]
struct Transparent {
#[serde(skip)]
a: bool,
b: u32,
#[serde(skip)]
c: bool,
d: PhantomData<()>,
}
assert_tokens(
&Transparent {
a: false,
b: 1,
c: false,
d: PhantomData,
},
&[Token::U32(1)],
);
} | rust_cleaned_test_functions.jsonl/59175 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 270
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7965,
3765,
15126,
368,
341,
262,
11506,
27098,
3759,
9050,
11,
48440,
11,
55039,
11,
11091,
5563,
262,
11506,
47024,
7,
28269,
5563,
262,
2036,
89868,
341,
286,
11506,
47024,
82074,
5563,
286,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_uint_sub_panic() {
let _val = Uint256::from(1 as u32).sub(Uint256::from(2 as u32));
} | rust_cleaned_test_functions.jsonl/47729 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 62
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15807,
5228,
620,
31270,
368,
341,
286,
1077,
716,
831,
284,
27883,
17,
20,
21,
486,
1499,
7,
16,
438,
575,
18,
17,
568,
1966,
12317,
396,
17,
20,
21,
486,
1499,
7,
17,
438,
575,
18,
17,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_mark_active_iface_idle() {
let mut exec = fuchsia_async::Executor::new().expect("failed to create an executor");
let test_values = test_setup(&mut exec);
let (mut iface_manager, _) = create_iface_manager_with_client(&test_values, true);
assert!(iface_manager.clients[0].config.is_some());
// The request to mark the interface as idle should be ignored since the interface's state
// machine is still running.
iface_manager.record_idle_client(TEST_CLIENT_IFACE_ID);
assert!(iface_manager.clients[0].config.is_some());
} | rust_cleaned_test_functions.jsonl/62701 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 244
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18924,
12930,
67666,
47810,
368,
341,
286,
1077,
5206,
3883,
284,
282,
73391,
28346,
486,
25255,
486,
931,
1005,
17119,
445,
16091,
311,
1855,
458,
31558,
797,
286,
1077,
1273,
9146,
284,
1273,
21... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_skip_igmp() {
// Test that we properly skip executing any `Actions` when IGMP is
// disabled for the device.
let mut ctx = DummyContext::default();
ctx.get_mut().igmp_enabled = false;
// Assert that no observable effects have taken place.
let assert_no_effect = |ctx: &DummyContext| {
assert!(ctx.timers().is_empty());
assert!(ctx.frames().is_empty());
};
assert_eq!(ctx.igmp_join_group(DummyLinkDeviceId, GROUP_ADDR), GroupJoinResult::Joined(()));
// We should have joined the group but not executed any `Actions`.
assert_gmp_state!(ctx, &GROUP_ADDR, Delaying);
assert_no_effect(&ctx);
receive_igmp_report(&mut ctx);
// We should have executed the transition but not executed any `Actions`.
assert_gmp_state!(ctx, &GROUP_ADDR, Idle);
assert_no_effect(&ctx);
receive_igmp_query(&mut ctx, Duration::from_secs(10));
// We should have executed the transition but not executed any `Actions`.
assert_gmp_state!(ctx, &GROUP_ADDR, Delaying);
assert_no_effect(&ctx);
assert_eq!(ctx.igmp_leave_group(DummyLinkDeviceId, GROUP_ADDR), GroupLeaveResult::Left(()));
// We should have left the group but not executed any `Actions`.
assert!(ctx.get_ref().groups.get(&GROUP_ADDR).is_none());
assert_no_effect(&ctx);
} | rust_cleaned_test_functions.jsonl/128915 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 598
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44830,
62,
343,
1307,
368,
341,
286,
442,
3393,
429,
582,
10277,
10706,
30220,
894,
1565,
12948,
63,
979,
46180,
5781,
374,
198,
286,
442,
8386,
369,
279,
3671,
382,
286,
1077,
5206,
5635,
284,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_offset_operand() {
assert_eq!(8, parse_offset_operand_str("10").unwrap()); // default octal
assert_eq!(0, parse_offset_operand_str("0").unwrap());
assert_eq!(8, parse_offset_operand_str("+10").unwrap()); // optional leading '+'
assert_eq!(16, parse_offset_operand_str("0x10").unwrap()); // hex
assert_eq!(16, parse_offset_operand_str("0X10").unwrap()); // hex
assert_eq!(16, parse_offset_operand_str("+0X10").unwrap()); // hex
assert_eq!(10, parse_offset_operand_str("10.").unwrap()); // decimal
assert_eq!(10, parse_offset_operand_str("+10.").unwrap()); // decimal
assert_eq!(4096, parse_offset_operand_str("10b").unwrap()); // b suffix = *512
assert_eq!(4096, parse_offset_operand_str("+10b").unwrap()); // b suffix = *512
assert_eq!(5120, parse_offset_operand_str("10.b").unwrap()); // b suffix = *512
assert_eq!(5120, parse_offset_operand_str("+10.b").unwrap()); // b suffix = *512
assert_eq!(267, parse_offset_operand_str("0x10b").unwrap()); // hex
} | rust_cleaned_test_functions.jsonl/58010 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 476
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
6917,
69259,
368,
341,
286,
2060,
10714,
10297,
23,
11,
4715,
6917,
69259,
2895,
445,
16,
15,
1827,
15454,
13426,
442,
1638,
18491,
278,
198,
286,
2060,
10714,
10297,
15,
11,
4715,
6917,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_proposing_voting_yes_voting_no_are_equivalent_for_rewards() {
assert_eq!(compute_maturities(vec![1, 1], vec!["Py"]), vec![50, 50]);
assert_eq!(compute_maturities(vec![1, 1], vec!["Pn"]), vec![50, 50]);
assert_eq!(compute_maturities(vec![1, 1], vec!["yP"]), vec![50, 50]);
assert_eq!(compute_maturities(vec![1, 1], vec!["nP"]), vec![50, 50]);
} | rust_cleaned_test_functions.jsonl/1134 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 187
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21663,
14421,
2273,
11519,
59744,
2273,
11519,
6536,
56855,
41443,
11769,
5478,
77997,
368,
341,
262,
2060,
10714,
10297,
27706,
717,
2628,
1361,
25592,
20703,
16,
11,
220,
16,
1125,
7486,
0,
1183,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_11() {
assert_eq!(
parse_column_type(&mut Parser::new("DATETIME(6)")),
ColumnType::DateTime(TimeAttr {
fractional: Some(6),
})
);
} | rust_cleaned_test_functions.jsonl/73840 | {
"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,
62,
16,
16,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
8744,
1819,
2099,
6984,
21102,
486,
931,
445,
47892,
44618,
7,
21,
8,
30154,
310,
9332,
929,
486,
7689,
36968,
13371,
341,
394,
68209,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_background_job_limits() {
assert_eq!(
get_background_job_limits_impl(1 /*cpu_num*/, &KVDB_DEFAULT_BACKGROUND_JOB_LIMITS),
BackgroundJobLimits {
max_background_jobs: 2,
max_background_flushes: 1,
max_sub_compactions: 1,
max_titan_background_gc: 1,
}
);
assert_eq!(
get_background_job_limits_impl(2 /*cpu_num*/, &KVDB_DEFAULT_BACKGROUND_JOB_LIMITS),
BackgroundJobLimits {
max_background_jobs: 2,
max_background_flushes: 1,
max_sub_compactions: 1,
max_titan_background_gc: 2,
}
);
assert_eq!(
get_background_job_limits_impl(4 /*cpu_num*/, &KVDB_DEFAULT_BACKGROUND_JOB_LIMITS),
BackgroundJobLimits {
max_background_jobs: 4,
max_background_flushes: 2,
max_sub_compactions: 1,
max_titan_background_gc: 4,
}
);
assert_eq!(
get_background_job_limits_impl(8 /*cpu_num*/, &KVDB_DEFAULT_BACKGROUND_JOB_LIMITS),
BackgroundJobLimits {
max_background_jobs: 8,
max_background_flushes: 3,
max_sub_compactions: 3,
max_titan_background_gc: 4,
}
);
assert_eq!(
get_background_job_limits_impl(
16, /*cpu_num*/
&KVDB_DEFAULT_BACKGROUND_JOB_LIMITS
),
BackgroundJobLimits {
max_background_jobs: 10,
max_background_flushes: 4,
max_sub_compactions: 3,
max_titan_background_gc: 4,
}
);
} | rust_cleaned_test_functions.jsonl/31113 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1070
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24103,
20298,
31820,
368,
341,
286,
2060,
10714,
33673,
310,
633,
24103,
20298,
31820,
21007,
7,
16,
1391,
16475,
4273,
29778,
609,
82707,
3506,
13811,
70128,
59690,
29194,
50,
1326,
310,
24800,
122... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dual_vec_exp() {
let res = DualVec64::<2>::new(1.2, StaticVec::new_vec([1.0, 1.0])).exp();
assert!((res.re - 3.32011692273655).abs() < 1e-12);
assert!((res.eps[0] - 3.32011692273655).abs() < 1e-12);
assert!((res.eps[1] - 3.32011692273655).abs() < 1e-12);
} | rust_cleaned_test_functions.jsonl/28594 | {
"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,
96772,
13251,
14214,
368,
341,
262,
1077,
592,
284,
33659,
10050,
21,
19,
27638,
17,
6831,
931,
7,
16,
13,
17,
11,
23105,
10050,
486,
931,
13251,
2561,
16,
13,
15,
11,
220,
16,
13,
15,
54697... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_remove_unreachable_vertices() {
let mut graph = Graph::new();
// reachable
graph.insert_vertex(1).unwrap();
graph.insert_vertex(2).unwrap();
graph.insert_edge((1, 2)).unwrap();
// unreachable
graph.insert_vertex(3).unwrap();
graph.insert_vertex(4).unwrap();
graph.insert_vertex(5).unwrap();
graph.insert_edge((4, 5)).unwrap();
graph.insert_edge((4, 2)).unwrap();
graph.remove_unreachable_vertices(1).unwrap();
assert_eq!(graph.num_vertices(), 2);
assert!(graph.has_vertex(1));
assert!(graph.has_vertex(2));
} | rust_cleaned_test_functions.jsonl/1489 | {
"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,
18193,
4907,
46550,
37720,
368,
341,
286,
1077,
5206,
4771,
284,
12165,
486,
931,
1428,
286,
442,
68284,
198,
286,
4771,
7030,
26611,
7,
16,
568,
15454,
543,
286,
4771,
7030,
26611,
7,
17,
568,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_test_command() {
let buf = [
0b00100011,
0b00001001,
0b00000000, // Data Octet1: Test pattern.
0b00000000, // Data Octet2: Test pattern.
0b00000000, // Data Octet3: Test pattern.
0b00000000, // Data Octet4: Test pattern.
];
let expected = MuxCommand {
params: MuxCommandParams::Test(TestCommandParams {
test_pattern: vec![0x00, 0x00, 0x00, 0x00],
}),
command_response: CommandResponse::Command,
};
assert_eq!(MuxCommand::decode(&buf[..]).unwrap(), expected);
} | rust_cleaned_test_functions.jsonl/107773 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 339
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
4452,
10811,
368,
341,
286,
1077,
6607,
284,
2278,
310,
220,
15,
65,
15,
15,
16,
15,
15,
15,
16,
16,
11,
715,
310,
220,
15,
65,
15,
15,
15,
15,
16,
15,
15,
16,
11,
715,
310,
220... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_format_duration() {
for pair in &[
(0.000003932, "3.9u"),
(0.00448, "4.5m"),
(0.3, "300m"),
(2042.0, "34.0M"),
(3456000.0, "40.0D"),
(60480000.0, "1.9Y"),
] {
let result = super::format_duration(pair.0);
assert_eq!(&result, pair.1);
println!("{} -> {} ({})", pair.0, &result, pair.1);
}
} | rust_cleaned_test_functions.jsonl/24729 | {
"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,
8955,
25454,
368,
341,
286,
369,
6716,
304,
609,
9640,
310,
320,
15,
13,
15,
15,
15,
15,
15,
18,
24,
18,
17,
11,
330,
18,
13,
24,
84,
4461,
310,
320,
15,
13,
15,
15,
19,
19,
23,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_param_spec() {
let spec = "output a(p1: Int8): Int8 := 3 output b: Int8 := a(3)";
assert_eq!(0, num_type_errors(spec));
assert_eq!(get_type(spec), ValueTy::Int(IntTy::I8));
} | rust_cleaned_test_functions.jsonl/110678 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 113
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4090,
13594,
368,
341,
286,
1077,
1398,
284,
330,
3006,
264,
1295,
16,
25,
1333,
23,
1648,
1333,
23,
1669,
220,
18,
2550,
293,
25,
1333,
23,
1669,
264,
7,
18,
24023,
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_cidr() {
// fe80::1/56
let cidr = Cidr::new(LINK_LOCAL_ADDR, 56);
let inside_subnet = [
// fe80::2
[
0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x02,
],
// fe80::1122:3344:5566:7788
[
0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66,
0x77, 0x88,
],
// fe80::ff00:0:0:0
[
0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00,
],
// fe80::ff
[
0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xff,
],
];
let outside_subnet = [
// fe80:0:0:101::1
[
0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x01,
],
[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x01,
],
// ff02::1
[
0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x01,
],
// ff02::2
[
0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x02,
],
];
let subnets = [
// fe80::ffff:ffff:ffff:ffff/65
(
[
0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff,
],
65,
),
// fe80::1/128
(
[
0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01,
],
128,
),
// fe80::1234:5678/96
(
[
0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12,
0x34, 0x56, 0x78,
],
96,
),
];
let not_subnets = [
// fe80::101:ffff:ffff:ffff:ffff/55
(
[
0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff,
],
55,
),
// fe80::101:ffff:ffff:ffff:ffff/56
(
[
0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff,
],
56,
),
// fe80::101:ffff:ffff:ffff:ffff/57
(
[
0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff,
],
57,
),
(
[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01,
],
128,
),
];
for addr in inside_subnet.iter().map(|a| Address::from_bytes(a)) {
assert!(cidr.contains_addr(&addr));
}
for addr in outside_subnet.iter().map(|a| Address::from_bytes(a)) {
assert!(!cidr.contains_addr(&addr));
}
for subnet in subnets.iter().map(|&(a, p)| Cidr::new(Address(a), p)) {
assert!(cidr.contains_subnet(&subnet));
}
for subnet in not_subnets.iter().map(|&(a, p)| Cidr::new(Address(a), p)) {
assert!(!cidr.contains_subnet(&subnet));
}
let cidr_without_prefix = Cidr::new(LINK_LOCAL_ADDR, 0);
assert!(cidr_without_prefix.contains_addr(&Address::LOOPBACK));
} | rust_cleaned_test_functions.jsonl/126212 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3065
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68699,
81,
368,
341,
286,
442,
1152,
23,
15,
486,
16,
14,
20,
21,
79133,
286,
1077,
32141,
81,
284,
356,
307,
81,
486,
931,
4957,
11637,
28399,
16058,
11,
220,
20,
21,
626,
286,
1077,
4766,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_get_mode() {
// from day 5
use ParameterMode::*;
assert_eq!(get_mode(1002 / 100, 3), vec![Position, Immediate, Position]);
} | rust_cleaned_test_functions.jsonl/20286 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 85
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
7302,
368,
341,
286,
442,
504,
1899,
220,
20,
198,
286,
990,
15168,
3636,
79304,
286,
2060,
10714,
10297,
455,
7302,
7,
16,
15,
15,
17,
608,
220,
16,
15,
15,
11,
220,
18,
701,
7486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_sort_to_indices_primitives() {
test_sort_to_indices_primitive_arrays::<Int8Type>(
vec![None, Some(0), Some(2), Some(-1), Some(0), None],
None,
vec![0, 5, 3, 1, 4, 2],
);
test_sort_to_indices_primitive_arrays::<Int16Type>(
vec![None, Some(0), Some(2), Some(-1), Some(0), None],
None,
vec![0, 5, 3, 1, 4, 2],
);
test_sort_to_indices_primitive_arrays::<Int32Type>(
vec![None, Some(0), Some(2), Some(-1), Some(0), None],
None,
vec![0, 5, 3, 1, 4, 2],
);
test_sort_to_indices_primitive_arrays::<Int64Type>(
vec![None, Some(0), Some(2), Some(-1), Some(0), None],
None,
vec![0, 5, 3, 1, 4, 2],
);
test_sort_to_indices_primitive_arrays::<Float32Type>(
vec![
None,
Some(-0.05),
Some(2.225),
Some(-1.01),
Some(-0.05),
None,
],
None,
vec![0, 5, 3, 1, 4, 2],
);
test_sort_to_indices_primitive_arrays::<Float64Type>(
vec![
None,
Some(-0.05),
Some(2.225),
Some(-1.01),
Some(-0.05),
None,
],
None,
vec![0, 5, 3, 1, 4, 2],
);
// descending
test_sort_to_indices_primitive_arrays::<Int8Type>(
vec![None, Some(0), Some(2), Some(-1), Some(0), None],
Some(SortOptions {
descending: true,
nulls_first: false,
}),
vec![2, 1, 4, 3, 5, 0],
);
test_sort_to_indices_primitive_arrays::<Int16Type>(
vec![None, Some(0), Some(2), Some(-1), Some(0), None],
Some(SortOptions {
descending: true,
nulls_first: false,
}),
vec![2, 1, 4, 3, 5, 0],
);
test_sort_to_indices_primitive_arrays::<Int32Type>(
vec![None, Some(0), Some(2), Some(-1), Some(0), None],
Some(SortOptions {
descending: true,
nulls_first: false,
}),
vec![2, 1, 4, 3, 5, 0],
);
test_sort_to_indices_primitive_arrays::<Int64Type>(
vec![None, Some(0), Some(2), Some(-1), Some(0), None],
Some(SortOptions {
descending: true,
nulls_first: false,
}),
vec![2, 1, 4, 3, 5, 0],
);
test_sort_to_indices_primitive_arrays::<Float32Type>(
vec![
None,
Some(0.005),
Some(20.22),
Some(-10.3),
Some(0.005),
None,
],
Some(SortOptions {
descending: true,
nulls_first: false,
}),
vec![2, 1, 4, 3, 5, 0],
);
test_sort_to_indices_primitive_arrays::<Float64Type>(
vec![None, Some(0.0), Some(2.0), Some(-1.0), Some(0.0), None],
Some(SortOptions {
descending: true,
nulls_first: false,
}),
vec![2, 1, 4, 3, 5, 0],
);
test_sort_to_indices_primitive_arrays::<Int8Type>(
vec![None, Some(0), Some(2), Some(-1), Some(0), None],
Some(SortOptions {
descending: true,
nulls_first: true,
}),
vec![5, 0, 2, 1, 4, 3],
);
test_sort_to_indices_primitive_arrays::<Int16Type>(
vec![None, Some(0), Some(2), Some(-1), Some(0), None],
Some(SortOptions {
descending: true,
nulls_first: true,
}),
vec![5, 0, 2, 1, 4, 3],
);
test_sort_to_indices_primitive_arrays::<Int32Type>(
vec![None, Some(0), Some(2), Some(-1), Some(0), None],
Some(SortOptions {
descending: true,
nulls_first: true,
}),
vec![5, 0, 2, 1, 4, 3],
);
test_sort_to_indices_primitive_arrays::<Int64Type>(
vec![None, Some(0), Some(2), Some(-1), Some(0), None],
Some(SortOptions {
descending: true,
nulls_first: true,
}),
vec![5, 0, 2, 1, 4, 3],
);
test_sort_to_indices_primitive_arrays::<Float32Type>(
vec![None, Some(0.1), Some(0.2), Some(-1.3), Some(0.01), None],
Some(SortOptions {
descending: true,
nulls_first: true,
}),
vec![5, 0, 2, 1, 4, 3],
);
test_sort_to_indices_primitive_arrays::<Float64Type>(
vec![None, Some(10.1), Some(100.2), Some(-1.3), Some(10.01), None],
Some(SortOptions {
descending: true,
nulls_first: true,
}),
vec![5, 0, 2, 1, 4, 3],
);
} | rust_cleaned_test_functions.jsonl/39268 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18435,
2346,
18333,
5294,
35209,
368,
341,
286,
1273,
18435,
2346,
18333,
84087,
68983,
27638,
1072,
23,
929,
17055,
310,
7486,
20703,
4064,
11,
4329,
7,
15,
701,
4329,
7,
17,
701,
4329,
4080,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_single_value() {
check_single_value!(bool, "true", true);
check_single_value!(bool, "false", false);
check_single_value!(i8, "-123", -123);
check_single_value!(i16, "-123", -123);
check_single_value!(i32, "-123", -123);
check_single_value!(i64, "-123", -123);
check_single_value!(u8, "123", 123);
check_single_value!(u16, "123", 123);
check_single_value!(u32, "123", 123);
check_single_value!(u64, "123", 123);
check_single_value!(f32, "123", 123.0);
check_single_value!(f64, "123", 123.0);
check_single_value!(String, "abc", "abc");
check_single_value!(char, "a", 'a');
let url_params = create_url_params([("a", "B")]);
assert_eq!(
MyEnum::deserialize(PathDeserializer::new(&url_params)).unwrap(),
MyEnum::B
);
let url_params = create_url_params([("a", "1"), ("b", "2")]);
assert_eq!(
i32::deserialize(PathDeserializer::new(&url_params)).unwrap_err(),
PathDeserializerError::custom("wrong number of parameters: 2 expected 1".to_string())
);
} | rust_cleaned_test_functions.jsonl/100068 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 575
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
19487,
3142,
368,
341,
286,
1779,
19487,
3142,
10297,
2641,
11,
330,
1866,
497,
830,
317,
286,
1779,
19487,
3142,
10297,
2641,
11,
330,
3849,
497,
895,
317,
286,
1779,
19487,
3142,
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_check_time_request_limit() {
let keypair = Keypair::new();
let mut faucet = Faucet::new(keypair, None, Some(2), None);
let ip = socketaddr!([203, 0, 113, 1], 1234).ip();
assert!(faucet.check_time_request_limit(1, ip).is_ok());
assert!(faucet.check_time_request_limit(1, ip).is_ok());
assert!(faucet.check_time_request_limit(1, ip).is_err());
let address = Pubkey::new_unique();
assert!(faucet.check_time_request_limit(1, address).is_ok());
assert!(faucet.check_time_request_limit(1, address).is_ok());
assert!(faucet.check_time_request_limit(1, address).is_err());
} | rust_cleaned_test_functions.jsonl/1266 | {
"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,
7200,
3009,
7893,
14763,
368,
341,
286,
1077,
1376,
12670,
284,
6569,
1082,
1310,
486,
931,
543,
286,
1077,
5206,
71453,
284,
96362,
295,
486,
931,
4857,
12670,
11,
2240,
11,
4329,
7,
17,
701,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_edge_references() {
use visit::EdgeRef;
use visit::IntoEdgeReferences;
let m: Csr<(), _> = Csr::from_sorted_edges(&[
(0, 1, 0.5),
(0, 2, 2.),
(1, 0, 1.),
(1, 1, 1.),
(1, 2, 1.),
(1, 3, 1.),
(2, 3, 3.),
(4, 5, 1.),
(5, 7, 2.),
(6, 7, 1.),
(7, 8, 3.),
]).unwrap();
let mut copy = Vec::new();
for e in m.edge_references() {
copy.push((e.source(), e.target(), *e.weight()));
println!("{:?}", e);
}
let m2: Csr<(), _> = Csr::from_sorted_edges(©).unwrap();
assert_eq!(&m.row, &m2.row);
assert_eq!(&m.column, &m2.column);
assert_eq!(&m.edges, &m2.edges);
} | rust_cleaned_test_functions.jsonl/36544 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 511
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17932,
92702,
368,
341,
286,
990,
3947,
486,
11656,
3945,
280,
286,
990,
3947,
486,
26591,
11656,
31712,
280,
286,
1077,
296,
25,
356,
15094,
68843,
716,
29,
284,
356,
15094,
486,
1499,
41277,
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... | 2 |
#[test]
fn test_max_size() {
let realm = Realm {
account_type: GovernanceAccountType::Realm,
community_mint: Pubkey::new_unique(),
reserved: [0; 8],
authority: Some(Pubkey::new_unique()),
name: "test-realm".to_string(),
config: RealmConfig {
council_mint: Some(Pubkey::new_unique()),
use_community_voter_weight_addin: false,
reserved: [0; 7],
community_mint_max_vote_weight_source: MintMaxVoteWeightSource::Absolute(100),
min_community_tokens_to_create_governance: 10,
},
};
let size = realm.try_to_vec().unwrap().len();
assert_eq!(realm.get_max_size(), Some(size));
} | rust_cleaned_test_functions.jsonl/102789 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 394
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6345,
2368,
368,
341,
286,
1077,
21889,
284,
41106,
341,
310,
2692,
1819,
25,
80589,
7365,
929,
486,
64290,
345,
310,
3942,
717,
396,
25,
22611,
792,
486,
931,
21218,
3148,
310,
4591,
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_eth_to_dai_swap() {
let runner = actix::System::new();
let token_bridge = new_token_bridge();
runner.block_on(async move {
let one_cent_in_eth = token_bridge
.dai_to_eth_price(eth_to_wei(0.01f64))
.await
.unwrap();
token_bridge
.eth_to_dai_swap(one_cent_in_eth, TIMEOUT)
.await
.unwrap();
});
} | rust_cleaned_test_functions.jsonl/21534 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 287
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57757,
2346,
814,
2143,
40991,
368,
341,
286,
1077,
22259,
284,
1160,
941,
486,
2320,
486,
931,
1428,
286,
1077,
3950,
54944,
284,
501,
6458,
54944,
1428,
286,
22259,
15697,
4470,
18285,
3271,
341... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_script_helper_value_access() {
let engine = Engine::new();
let script = "let plen = len(params); let p0 = params[0]; let hlen = len(hash); let hme = hash[\"me\"]; plen + \",\" + p0 + \",\" + hlen + \",\" + hme";
let ast = engine.compile(&script).unwrap();
let params = vec![PathAndJson::new(None, ScopedJson::Derived(json!(true)))];
let mut hash = BTreeMap::new();
hash.insert(
"me",
PathAndJson::new(None, ScopedJson::Derived(json!("no"))),
);
hash.insert(
"you",
PathAndJson::new(None, ScopedJson::Derived(json!("yes"))),
);
let result = call_script_helper(¶ms, &hash, &engine, &ast)
.unwrap()
.render();
assert_eq!("1,true,2,no", &result);
} | rust_cleaned_test_functions.jsonl/111683 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 416
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14660,
10418,
3142,
12759,
368,
341,
286,
1077,
4712,
284,
8200,
486,
931,
1428,
286,
1077,
5316,
284,
330,
1149,
625,
268,
284,
2422,
8917,
1215,
1077,
281,
15,
284,
3628,
58,
15,
5265,
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_message_body() {
let req = TestRequest::with_header(header::CONTENT_LENGTH, "xxxx").finish();
match req.body().poll().err().unwrap() {
PayloadError::UnknownLength => (),
_ => unreachable!("error"),
}
let req = TestRequest::with_header(header::CONTENT_LENGTH, "1000000").finish();
match req.body().poll().err().unwrap() {
PayloadError::Overflow => (),
_ => unreachable!("error"),
}
let req = TestRequest::default()
.set_payload(Bytes::from_static(b"test"))
.finish();
match req.body().poll().ok().unwrap() {
Async::Ready(bytes) => assert_eq!(bytes, Bytes::from_static(b"test")),
_ => unreachable!("error"),
}
let req = TestRequest::default()
.set_payload(Bytes::from_static(b"11111111111111"))
.finish();
match req.body().limit(5).poll().err().unwrap() {
PayloadError::Overflow => (),
_ => unreachable!("error"),
}
} | rust_cleaned_test_functions.jsonl/7655 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 515
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6462,
14114,
368,
341,
286,
1077,
4232,
284,
3393,
1900,
486,
4197,
8757,
25534,
486,
67872,
15023,
11,
330,
18516,
1827,
30150,
543,
286,
2432,
4232,
5079,
1005,
30141,
1005,
615,
1005,
15454,
36... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_flush_before_drop() {
let writer = Arc::new(MockMetricsWriter::new());
{
let agent = MetricsAgent::new(writer.clone(), Duration::from_secs(9_999_999), 1000);
agent.submit(DataPoint::new("point 1"), Level::Info);
}
assert_eq!(writer.points_written(), 2);
} | rust_cleaned_test_functions.jsonl/10333 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39213,
23708,
29584,
368,
341,
286,
1077,
6916,
284,
19689,
486,
931,
66436,
27328,
6492,
486,
931,
1423,
286,
341,
310,
1077,
8315,
284,
54190,
16810,
486,
931,
38356,
15997,
1507,
21045,
486,
14... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_build_android_notification() {
let mut notification_string = create_force_refresh_json(
&"123".to_string(),
&OS::Android,
&"1234".to_string(),
&"dario".to_string(),
);
notification_string.retain(|c| !c.is_whitespace());
assert_eq!(
notification_string,
"{\"deviceId\":\"123\",\"data\":{\"priority\":\"high\",\"custom\":{\"data\":\
{\"command\":\"RefreshTelemetry\",\"correlationId\":\"1234\",\
\"username\":\"dario\",\"aps\":{\"content-available\":1}}}}}"
);
} | rust_cleaned_test_functions.jsonl/97603 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 242
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20801,
56665,
34296,
368,
341,
262,
1077,
5206,
11540,
3904,
284,
1855,
40739,
42076,
9455,
1006,
286,
609,
1,
16,
17,
18,
3263,
983,
3904,
3148,
286,
609,
3126,
486,
21831,
345,
286,
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... | 1 |
#[test]
fn test_format_ruby_version() -> io::Result<()> {
assert_eq!(
format_ruby_version("ruby 2.1.10p492 (2016-04-01 revision 54464) [x86_64-darwin19.0]"),
Some("v2.1.10".to_string())
);
assert_eq!(
format_ruby_version("ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]"),
Some("v2.5.1".to_string())
);
assert_eq!(
format_ruby_version(
"ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux-musl]"
),
Some("v2.7.0".to_string())
);
Ok(())
} | rust_cleaned_test_functions.jsonl/93575 | {
"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,
8955,
1710,
20028,
9438,
368,
1464,
6399,
486,
2077,
71698,
341,
286,
2060,
10714,
33673,
310,
3561,
1710,
20028,
9438,
445,
46275,
220,
17,
13,
16,
13,
16,
15,
79,
19,
24,
17,
320,
17,
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_serialization() {
let dt = "2018-02-11T07:09:22.765Z".parse::<DateTime<Utc>>().unwrap();
let t = TimeMsg {
seconds: dt.timestamp(),
nanos: dt.timestamp_subsec_nanos() as i32,
};
let proposal = Proposal {
msg_type: SignedMsgType::Proposal.to_u32(),
height: 12345,
round: 23456,
pol_round: -1,
block_id: Some(BlockId {
hash: b"hash".to_vec(),
parts_header: Some(PartsSetHeader {
total: 1_000_000,
hash: b"parts_hash".to_vec(),
}),
}),
timestamp: Some(t),
signature: vec![],
};
let mut got = vec![];
let _have = SignProposalRequest {
proposal: Some(proposal),
}
.encode(&mut got);
// test-vector generated via:
// BlockID: types.BlockID{
// PartsHeader: types.PartSetHeader{
let want = vec![
66, // len
189, 228, 152, 226, // prefix
10, 60, 8, 32, 16, 185, 96, 24, 160, 183, 1, 32, 255, 255, 255, 255, 255, 255, 255,
255, 255, 1, 42, 24, 10, 4, 104, 97, 115, 104, 18, 16, 8, 192, 132, 61, 18, 10, 112,
97, 114, 116, 115, 95, 104, 97, 115, 104, 50, 12, 8, 162, 216, 255, 211, 5, 16, 192,
242, 227, 236, 2,
];
assert_eq!(got, want)
} | rust_cleaned_test_functions.jsonl/14823 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 975
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25602,
2022,
368,
341,
286,
1077,
7594,
284,
330,
17,
15,
16,
23,
12,
15,
17,
12,
16,
16,
51,
15,
22,
25,
15,
24,
25,
17,
17,
13,
22,
21,
20,
57,
3263,
6400,
27638,
7689,
36397,
10413,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_utf16_code_units() {
assert_eq!("é\u{1F4A9}".encode_utf16().collect::<Vec<u16>>(),
[0xE9, 0xD83D, 0xDCA9])
} | rust_cleaned_test_functions.jsonl/17659 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 93
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39453,
16,
21,
4136,
28345,
368,
341,
262,
2060,
10714,
17223,
963,
3770,
90,
16,
37,
19,
32,
24,
21901,
6180,
39453,
16,
21,
1005,
17384,
27638,
10050,
34837,
16,
21,
2452,
3148,
2290,
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 |
#[test]
fn test_enrich_non_scalar_summary_values() {
let image_value = Value::Image(pb::summary::Image::default());
let v = EventValue::Summary(SummaryValue(Box::new(image_value)));
assert_eq!(v.into_scalar(), Err(DataLoss));
} | rust_cleaned_test_functions.jsonl/6200 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 129
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6205,
13851,
21637,
41652,
27251,
9146,
368,
341,
310,
1077,
2168,
3142,
284,
5162,
486,
1906,
76878,
486,
1708,
486,
1906,
486,
2258,
1423,
310,
1077,
348,
284,
3665,
1130,
486,
19237,
3759,
372,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_push_write_panic_uninitialized() {
let state = MockBufferSharedState::uninitialized();
state.push_lp(Sequence::new(0, 0), "upc,region=east user=1 100");
} | rust_cleaned_test_functions.jsonl/53062 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 86
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4387,
14218,
9165,
620,
31270,
4907,
36161,
368,
341,
286,
1077,
1584,
284,
14563,
4095,
16997,
1397,
486,
359,
36161,
543,
286,
1584,
2552,
76529,
7,
14076,
486,
931,
7,
15,
11,
220,
15,
701,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_d() {
let mut cpu: CPU = CPU::new();
let pc = cpu.pc;
cpu = cpu.set_d(Register { value: 0 });
cpu.memory.write_64bit(1, 10);
cpu = execute_set(cpu, pc, 0b011);
assert_eq!(cpu.pc.value, 9);
assert_eq!(cpu.f.value, 0);
assert_eq!(cpu.d.value, 10);
} | rust_cleaned_test_functions.jsonl/123555 | {
"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,
2602,
814,
368,
341,
286,
1077,
5206,
17319,
25,
13940,
284,
13940,
486,
931,
543,
286,
1077,
13312,
284,
17319,
53335,
401,
286,
17319,
284,
17319,
980,
814,
79203,
314,
897,
25,
220,
15,
1625,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fork_resharing() {
let mut atoms = AtomSpace::default();
let f1_id = new_fork(&mut atoms, 1, 2);
let f2_id = new_fork(&mut atoms, 1, 2);
assert_eq!(f1_id, f2_id);
} | rust_cleaned_test_functions.jsonl/5084 | {
"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,
761,
669,
62,
2488,
3249,
368,
341,
286,
1077,
5206,
32199,
284,
39516,
9914,
486,
2258,
543,
286,
1077,
282,
16,
842,
284,
501,
761,
669,
2099,
6984,
32199,
11,
220,
16,
11,
220,
17,
317,
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_nested_method_in_lambda() {
check(
r#"
struct Foo;
impl Foo { fn bar(&self, _: u32) { } }
fn bar(_: u32) { }
fn main() {
let foo = Foo;
std::thread::spawn(move || foo.bar($0));
}
"#,
expect![[r#"
fn bar(&self, _: u32)
(<_: u32>)
"#]],
);
} | rust_cleaned_test_functions.jsonl/75018 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 196
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66279,
9032,
1243,
51884,
368,
341,
262,
1779,
1006,
286,
435,
2,
698,
1235,
33428,
280,
6383,
33428,
314,
5168,
3619,
2099,
721,
11,
58536,
575,
18,
17,
8,
314,
335,
555,
8822,
3619,
73834,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_writer_read_from_multiple_bufs() {
let mut writer = test_writer(3, 3);
// Read at most 3 bytes from two buffers.
let bufs = &[IoSlice::new(&[1]), IoSlice::new(&[2, 2, 2])];
assert_eq!(writer.write_vectored(bufs).unwrap(), 3);
// Read at most 3 bytes from three buffers.
let bufs = &[IoSlice::new(&[3]), IoSlice::new(&[4]), IoSlice::new(&[5, 5])];
assert_eq!(writer.write_vectored(bufs).unwrap(), 3);
assert_eq!(writer.written, &[1, 2, 2, 3, 4, 5]);
} | rust_cleaned_test_functions.jsonl/8689 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 259
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28908,
6443,
5673,
45233,
10363,
82,
368,
341,
286,
1077,
5206,
6916,
284,
1273,
28908,
7,
18,
11,
220,
18,
626,
286,
442,
4457,
518,
1429,
220,
18,
5820,
504,
1378,
27389,
624,
286,
1077,
103... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_write_too_many_bytes() {
let mut b = Int32BufferBuilder::new(0);
let bytes = [8, 16, 32, 64].to_byte_slice();
b.write_bytes(bytes, 4).unwrap();
} | rust_cleaned_test_functions.jsonl/120194 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 96
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
2346,
78,
22101,
12524,
368,
341,
286,
1077,
5206,
293,
284,
1333,
18,
17,
4095,
3297,
486,
931,
7,
15,
317,
286,
1077,
5820,
284,
508,
23,
11,
220,
16,
21,
11,
220,
18,
17,
11,
220,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_txs_to_rebroadcast() {
let responder = init_responder(MockedServerQuery::Regular);
let current_height = 100;
let user_id = get_random_user_id();
responder
.dbm
.lock()
.unwrap()
.store_user(user_id, &UserInfo::new(21, 42))
.unwrap();
// Transactions are flagged to be rebroadcast when they've been in mempool for longer than CONFIRMATIONS_BEFORE_RETRY
let mut txs = HashMap::new();
for i in 0..CONFIRMATIONS_BEFORE_RETRY + 2 {
// Add the appointment to the db so FK rules are satisfied
let (uuid, appointment) = generate_dummy_appointment_with_user(user_id, None);
responder
.dbm
.lock()
.unwrap()
.store_appointment(uuid, &appointment)
.unwrap();
let breach = get_random_breach();
responder.add_tracker(
uuid,
breach.clone(),
user_id,
ConfirmationStatus::InMempoolSince(current_height - i as u32),
);
if i >= CONFIRMATIONS_BEFORE_RETRY {
txs.insert(uuid, (breach.penalty_tx.clone(), None));
}
}
assert_eq!(responder.get_txs_to_rebroadcast(current_height), txs)
} | rust_cleaned_test_functions.jsonl/55479 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 739
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
17805,
82,
2346,
1288,
54162,
368,
341,
286,
1077,
64034,
284,
2930,
4918,
20328,
66436,
291,
5475,
2859,
486,
30404,
317,
286,
1077,
1482,
9561,
284,
220,
16,
15,
15,
401,
286,
1077,
1196... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_full_node_basic_flow() {
// launch environment of 4 validator nodes and 2 full nodes
let mut env = TestEnvironment::new(4);
env.setup_vfn_swarm();
env.setup_public_fn_swarm(2);
env.validator_swarm.launch();
env.vfn_swarm.as_mut().unwrap().launch();
env.public_fn_swarm.as_mut().unwrap().launch();
// execute smoke script
test_smoke_script(env.get_validator_client(0, None));
// read state from full node client
let mut validator_ac_client = env.get_validator_client(1, None);
let mut full_node_client = env.get_vfn_client(1, None);
let mut full_node_client_2 = env.get_public_fn_client(0, None);
let sender_account = testnet_dd_account_address();
let creation_account = libra_root_address();
full_node_client
.wait_for_transaction(sender_account, 3)
.unwrap();
for idx in 0..3 {
validator_ac_client.create_next_account(false).unwrap();
full_node_client.create_next_account(false).unwrap();
full_node_client_2.create_next_account(false).unwrap();
assert_eq!(
validator_ac_client
.get_balances(&["b", &idx.to_string()])
.unwrap(),
full_node_client
.get_balances(&["b", &idx.to_string()])
.unwrap(),
);
}
// mint from full node and check both validator and full node have correct balance
let account3 = validator_ac_client
.create_next_account(false)
.unwrap()
.address;
full_node_client.create_next_account(false).unwrap();
full_node_client_2.create_next_account(false).unwrap();
let sequence_reset = format!("sequence {} true", sender_account);
let creation_sequence_reset = format!("sequence {} true", creation_account);
let sequence_reset_command: Vec<_> = sequence_reset.split(' ').collect();
let creation_sequence_reset_command: Vec<_> = creation_sequence_reset.split(' ').collect();
full_node_client
.get_sequence_number(&sequence_reset_command)
.unwrap();
full_node_client
.get_sequence_number(&creation_sequence_reset_command)
.unwrap();
full_node_client
.mint_coins(&["mintb", "3", "10", "Coin1"], true)
.expect("Fail to mint!");
assert!(compare_balances(
vec![(10.0, "Coin1".to_string())],
full_node_client.get_balances(&["b", "3"]).unwrap(),
));
let sequence = full_node_client
.get_sequence_number(&sequence_reset_command)
.unwrap();
validator_ac_client
.wait_for_transaction(sender_account, sequence)
.unwrap();
assert!(compare_balances(
vec![(10.0, "Coin1".to_string())],
validator_ac_client.get_balances(&["b", "3"]).unwrap(),
));
// reset sequence number for sender account
validator_ac_client
.get_sequence_number(&sequence_reset_command)
.unwrap();
full_node_client
.get_sequence_number(&sequence_reset_command)
.unwrap();
validator_ac_client
.get_sequence_number(&creation_sequence_reset_command)
.unwrap();
full_node_client
.get_sequence_number(&creation_sequence_reset_command)
.unwrap();
// mint from validator and check both nodes have correct balance
validator_ac_client.create_next_account(false).unwrap();
full_node_client.create_next_account(false).unwrap();
full_node_client_2.create_next_account(false).unwrap();
validator_ac_client
.mint_coins(&["mintb", "4", "10", "Coin1"], true)
.unwrap();
let sequence = validator_ac_client
.get_sequence_number(&sequence_reset_command)
.unwrap();
full_node_client
.wait_for_transaction(sender_account, sequence)
.unwrap();
assert!(compare_balances(
vec![(10.0, "Coin1".to_string())],
validator_ac_client.get_balances(&["b", "4"]).unwrap(),
));
assert!(compare_balances(
vec![(10.0, "Coin1".to_string())],
full_node_client.get_balances(&["b", "4"]).unwrap(),
));
// minting again on validator doesn't cause error since client sequence has been updated
validator_ac_client
.mint_coins(&["mintb", "4", "10", "Coin1"], true)
.unwrap();
// test transferring balance from 0 to 1 through full node proxy
full_node_client
.transfer_coins(&["tb", "3", "4", "10", "Coin1"], true)
.unwrap();
assert!(compare_balances(
vec![(0.0, "Coin1".to_string())],
full_node_client.get_balances(&["b", "3"]).unwrap(),
));
assert!(compare_balances(
vec![(30.0, "Coin1".to_string())],
validator_ac_client.get_balances(&["b", "4"]).unwrap(),
));
let sequence = validator_ac_client
.get_sequence_number(&["sequence", &format!("{}", account3), "true"])
.unwrap();
full_node_client_2
.wait_for_transaction(account3, sequence)
.unwrap();
assert!(compare_balances(
vec![(0.0, "Coin1".to_string())],
full_node_client_2.get_balances(&["b", "3"]).unwrap(),
));
assert!(compare_balances(
vec![(30.0, "Coin1".to_string())],
full_node_client_2.get_balances(&["b", "4"]).unwrap(),
));
} | rust_cleaned_test_functions.jsonl/62880 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2292
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16372,
5084,
34729,
27441,
368,
341,
262,
442,
7050,
4573,
315,
220,
19,
22935,
7798,
323,
220,
17,
2480,
7798,
198,
262,
1077,
5206,
6105,
284,
3393,
12723,
486,
931,
7,
19,
317,
262,
6105,
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... | 2 |
#[test]
fn test_replace_region() {
let source = "
fn foo() {
some();
stuff();
}
const BAR: u32 = 32;
";
// typical multi-line case
assert_eq!(
replace_region(
source,
&LineColumn {
line: 2,
column: 10
},
&LineColumn { line: 5, column: 1 },
"{ /* body deleted */ }"
),
"
fn foo() { /* body deleted */ }
const BAR: u32 = 32;
"
);
// single-line case
assert_eq!(
replace_region(
source,
&LineColumn {
line: 7,
column: 18
},
&LineColumn {
line: 7,
column: 19
},
"69"
),
"
fn foo() {
some();
stuff();
}
const BAR: u32 = 69;
"
);
} | rust_cleaned_test_functions.jsonl/790 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 633
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10633,
20627,
368,
341,
286,
1077,
2530,
284,
6228,
8822,
15229,
368,
341,
262,
1045,
543,
262,
6259,
543,
630,
1024,
44187,
25,
575,
18,
17,
284,
220,
18,
17,
280,
876,
286,
442,
14260,
7299,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pool_allocate_compact_all() {
let cpus = cpu_descriptor_from_socket_size(4, 6);
let mut pool = ResourcePool::new(&ResourceDescriptor::new(cpus, Vec::new()), &[]);
let rq = CpuRequest::Compact(24).into();
let al = pool.try_allocate_resources(&rq, None).unwrap();
assert_eq!(al.cpus, (0..24).collect::<Vec<_>>());
assert_eq!(pool.n_free_cpus(), 0);
pool.release_allocation(al);
assert_eq!(pool.n_free_cpus(), 24);
} | rust_cleaned_test_functions.jsonl/92226 | {
"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,
15709,
77078,
18177,
531,
5705,
368,
341,
286,
1077,
12490,
355,
284,
17319,
33774,
5673,
19555,
2368,
7,
19,
11,
220,
21,
317,
286,
1077,
5206,
7314,
284,
11765,
10551,
486,
931,
2099,
4783,
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_index_of() {
let private_key =
PrivateKey::from_wif("KwUKaA3KgtRhCsioNWZQfC6Nd6vPNTXwgmqcStewZ3KdonmP3k43").unwrap();
let public_keys = vec![
"023092e0fad6f42a2f456f5a891d8ea868393ca4308fef0f29388a1c5687d5860e",
"03abdc3e2d64fb3e9ceeaf7d0f272c14c36793dfb862018c34a6ac5dfe0c02860e",
"03d10d42715a8c7e6c93fac9336bcb5b286e827e766594e4d166b4894b805236a7",
]
.iter()
.map(|key| PublicKey::from_str(key).unwrap())
.collect();
assert_eq!(index_of(&private_key, &public_keys), 2);
} | rust_cleaned_test_functions.jsonl/37275 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 367
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3560,
3575,
368,
341,
286,
1077,
869,
3097,
4035,
310,
9679,
1592,
486,
1499,
1670,
333,
445,
42,
86,
24537,
64,
32,
18,
42,
5178,
72162,
33545,
815,
69214,
57,
48,
69,
34,
21,
39837,
21,
85... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_struct_variant_width_config_exceeds_max_width() {
let toml = r#"
max_width = 80
struct_variant_width = 90
"#;
let config = Config::from_toml(toml, Path::new("")).unwrap();
assert_eq!(config.struct_variant_width(), 80);
} | rust_cleaned_test_functions.jsonl/130654 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15126,
46112,
7927,
5332,
2702,
4635,
82,
6345,
7927,
368,
341,
310,
1077,
311,
1014,
284,
435,
2,
698,
394,
1932,
7927,
284,
220,
23,
15,
198,
394,
2036,
46112,
7927,
284,
220,
24,
15,
198,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_render_commit_hash() -> io::Result<()> {
let repo_dir = fixture_repo(FixtureProvider::GIT)?;
let mut git_output = Command::new("git")
.args(&["rev-parse", "HEAD"])
.current_dir(&repo_dir.path())
.output()?
.stdout;
git_output.truncate(7);
let expected_hash = str::from_utf8(&git_output).unwrap();
let actual = ModuleRenderer::new("git_commit")
.config(toml::toml! {
[git_commit]
only_detached = false
})
.path(&repo_dir.path())
.collect();
let expected = Some(format!(
"{} ",
Color::Green
.bold()
.paint(format!("({})", expected_hash))
.to_string()
));
assert_eq!(expected, actual);
repo_dir.close()
} | rust_cleaned_test_functions.jsonl/89960 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 501
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22781,
36346,
8950,
368,
1464,
6399,
486,
2077,
71698,
341,
286,
1077,
15867,
4334,
284,
12507,
37784,
7832,
12735,
5179,
486,
90559,
89720,
286,
1077,
5206,
16345,
7645,
284,
7348,
486,
931,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_invoke_context_verify() {
let accounts = vec![(
solana_sdk::pubkey::new_rand(),
Rc::new(RefCell::new(AccountSharedData::default())),
)];
let message = Message::new(
&[Instruction::new_with_bincode(
accounts[0].0,
&MockInstruction::NoopSuccess,
vec![AccountMeta::new_readonly(accounts[0].0, false)],
)],
None,
);
let ancestors = Ancestors::default();
let blockhash = Hash::default();
let fee_calculator = FeeCalculator::default();
let mut invoke_context = ThisInvokeContext::new(
Rent::default(),
&accounts,
&[],
None,
ComputeBudget::default(),
Rc::new(RefCell::new(MockComputeMeter::default())),
Rc::new(RefCell::new(Executors::default())),
None,
Arc::new(FeatureSet::all_enabled()),
Arc::new(Accounts::default_for_tests()),
&ancestors,
&blockhash,
&fee_calculator,
);
invoke_context
.push(&message, &message.instructions[0], &[0], None)
.unwrap();
assert!(invoke_context
.verify(&message, &message.instructions[0], &[0])
.is_ok());
let mut _borrowed = accounts[0].1.borrow();
assert_eq!(
invoke_context.verify(&message, &message.instructions[0], &[0]),
Err(InstructionError::AccountBorrowOutstanding)
);
} | rust_cleaned_test_functions.jsonl/38600 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 835
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
79779,
8467,
35638,
368,
341,
286,
1077,
9618,
284,
7486,
20703,
1006,
310,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
3148,
310,
81463,
486,
931,
7,
3945,
3599,
486,
931,
65360,
16997,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse() {
let mut buf = PayloadBuffer::new(once(Ok(BytesMut::from(
&[0b0000_0001u8, 0b0000_0001u8][..],
).freeze())));
assert!(is_none(&Frame::parse(&mut buf, false, 1024)));
let mut buf = BytesMut::from(&[0b0000_0001u8, 0b0000_0001u8][..]);
buf.extend(b"1");
let mut buf = PayloadBuffer::new(once(Ok(buf.freeze())));
let frame = extract(Frame::parse(&mut buf, false, 1024));
assert!(!frame.finished);
assert_eq!(frame.opcode, OpCode::Text);
assert_eq!(frame.payload.as_ref(), &b"1"[..]);
} | rust_cleaned_test_functions.jsonl/55887 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 297
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
368,
341,
286,
1077,
5206,
6607,
284,
52916,
4095,
486,
931,
7,
13184,
7,
11578,
76423,
51440,
486,
1499,
1006,
310,
44590,
15,
65,
15,
15,
15,
15,
62,
15,
15,
15,
16,
84,
23,
11,
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_load_enum_config() {
#[derive(Clone, ModuleConfig)]
struct TestConfig {
pub switch_a: Switch,
pub switch_b: Switch,
pub switch_c: Switch,
}
#[derive(Debug, PartialEq, Clone)]
enum Switch {
ON,
OFF,
}
impl<'a> ModuleConfig<'a> for Switch {
fn from_config(config: &'a Value) -> Option<Self> {
match config.as_str()? {
"on" => Some(Self::ON),
"off" => Some(Self::OFF),
_ => None,
}
}
}
let config = toml::toml! {
switch_a = "on"
switch_b = "any"
};
let default_config = TestConfig {
switch_a: Switch::OFF,
switch_b: Switch::OFF,
switch_c: Switch::OFF,
};
let rust_config = default_config.load_config(&config);
assert_eq!(rust_config.switch_a, Switch::ON);
assert_eq!(rust_config.switch_b, Switch::OFF);
assert_eq!(rust_config.switch_c, Switch::OFF);
} | rust_cleaned_test_functions.jsonl/76123 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 640
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12411,
31054,
5332,
368,
341,
286,
11506,
27098,
65297,
11,
13711,
2648,
5563,
286,
2036,
3393,
2648,
341,
310,
6675,
3398,
4306,
25,
15586,
345,
310,
6675,
3398,
880,
25,
15586,
345,
310,
6675,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_passive_neurons_dont_get_mature() {
assert_eq!(compute_maturities(vec![1, 1], vec!["P-"]), vec![100, 0]);
assert_eq!(compute_maturities(vec![1, 1], vec!["-P"]), vec![0, 100]);
} | rust_cleaned_test_functions.jsonl/1133 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 106
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15464,
533,
96156,
814,
544,
3062,
717,
1568,
368,
341,
262,
2060,
10714,
10297,
27706,
717,
2628,
1361,
25592,
20703,
16,
11,
220,
16,
1125,
7486,
0,
1183,
47,
12,
63624,
7486,
20703,
16,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_new() {
let f = r#"a(x) if x = new Foo(a: 1);"#;
let results = parse_rules(0, f).unwrap();
assert_eq!(results[0].to_polar(), r#"a(x) if x = new Foo(a: 1);"#);
} | rust_cleaned_test_functions.jsonl/12191 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 119
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
5921,
368,
341,
286,
1077,
282,
284,
435,
55543,
64,
2075,
8,
421,
856,
284,
501,
33428,
2877,
25,
220,
16,
42788,
2,
280,
286,
1077,
3059,
284,
4715,
21407,
7,
15,
11,
282,
568,
1545... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rng_reseed() {
let s = ::test::rng().gen_iter::<u32>().take(8).collect::<Vec<u32>>();
let mut r: ChaChaRng = SeedableRng::from_seed(&*s);
let string1: String = r.gen_ascii_chars().take(100).collect();
r.reseed(&s);
let string2: String = r.gen_ascii_chars().take(100).collect();
assert_eq!(string1, string2);
} | rust_cleaned_test_functions.jsonl/51384 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 192
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
66849,
1288,
22602,
368,
341,
286,
1077,
274,
284,
3504,
1944,
486,
69890,
1005,
4370,
11723,
27638,
84,
18,
17,
10483,
22769,
7,
23,
568,
17384,
27638,
10050,
34837,
18,
17,
37038,
286,
1077,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_suppress_system_includes() {
let hdr = indoc! {"
#include <stdint.h>
#include <string>
inline void a() {};
"};
let rs = quote! {};
run_test_ex(
"",
hdr,
rs,
quote! { generate("a")},
Some(Box::new(SetSuppressSystemHeaders)),
Some(Box::new(NoSystemHeadersChecker)),
None,
);
} | rust_cleaned_test_functions.jsonl/9965 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 198
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23723,
1873,
17687,
1243,
7396,
368,
341,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
262,
671,
997,
366,
31435,
860,
397,
262,
671,
997,
366,
917,
397,
262,
7381,
737,
264,
368,
9321,
262,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_div() {
assert_eq!(_4_2i / 0.5, Complex::new(8.0, 4.0));
assert_eq!(0.5 / _4_2i, Complex::new(0.1, -0.05));
} | rust_cleaned_test_functions.jsonl/105718 | {
"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,
16237,
368,
341,
310,
2060,
10714,
0,
2490,
19,
62,
17,
72,
608,
220,
15,
13,
20,
11,
22096,
486,
931,
7,
23,
13,
15,
11,
220,
19,
13,
15,
1106,
310,
2060,
10714,
10297,
15,
13,
20,
608,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_generate_name() {
let test_cases = vec![
// usb interfaces
TestCase {
topological_path: String::from(
"@/dev/sys/pci/00:14.0/xhci/usb/004/004/ifc-000/ax88179/ethernet",
),
mac: [0x01, 0x01, 0x01, 0x01, 0x01, 0x01],
wlan: true,
want_name: "wlanx1",
},
TestCase {
topological_path: String::from(
"@/dev/sys/pci/00:15.0/xhci/usb/004/004/ifc-000/ax88179/ethernet",
),
mac: [0x02, 0x02, 0x02, 0x02, 0x02, 0x02],
wlan: false,
want_name: "ethx2",
},
// pci intefaces
TestCase {
topological_path: String::from("@/dev/sys/pci/00:14.0/ethernet"),
mac: [0x03, 0x03, 0x03, 0x03, 0x03, 0x03],
wlan: true,
want_name: "wlanp0014",
},
TestCase {
topological_path: String::from("@/dev/sys/pci/00:15.0/ethernet"),
mac: [0x04, 0x04, 0x04, 0x04, 0x04, 0x04],
wlan: false,
want_name: "ethp0015",
},
TestCase {
topological_path: String::from(
"@/dev/sys/platform/05:00:6/aml-sd-emmc/sdio/broadcom-wlanphy/wlanphy",
),
mac: [0x05, 0x05, 0x05, 0x05, 0x05, 0x05],
wlan: true,
want_name: "wlans05006",
},
TestCase {
topological_path: String::from(
"@/dev/sys/platform/04:02:7/aml-ethernet/Designware MAC/ethernet",
),
mac: [0x07, 0x07, 0x07, 0x07, 0x07, 0x07],
wlan: false,
want_name: "eths04027",
},
// unknown interfaces
TestCase {
topological_path: String::from("@/dev/sys/unknown"),
mac: [0x08, 0x08, 0x08, 0x08, 0x08, 0x08],
wlan: true,
want_name: "wlanx8",
},
TestCase {
topological_path: String::from("unknown"),
mac: [0x09, 0x09, 0x09, 0x09, 0x09, 0x09],
wlan: true,
want_name: "wlanx9",
},
];
let config = Config { names: vec![] };
for test in test_cases.into_iter() {
let persistent_id =
config.generate_identifier(&test.topological_path, MacAddress { octets: test.mac });
let name = config
.generate_name(&persistent_id, test.wlan)
.expect("failed to generate the name");
assert_eq!(name, test.want_name);
}
} | rust_cleaned_test_functions.jsonl/49770 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1794
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48851,
1269,
368,
341,
286,
1077,
1273,
41427,
284,
7486,
90515,
310,
442,
26983,
24099,
198,
310,
30573,
341,
394,
1909,
5729,
2638,
25,
923,
486,
1499,
1006,
503,
73735,
3583,
41836,
14,
55387,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_point_position_zero_b() {
let ellipse = Ellipse::new((10., -12.), 5., 0.);
assert_eq!(ellipse.point_position((10., -12.)), 0.);
assert_eq!(ellipse.point_position((15., -12.)), 0.);
assert_eq!(ellipse.point_position((13., -12.)), 0.);
assert!(ellipse.point_position((16., -12.)) > 0.);
assert!(ellipse.point_position((10., -11.)) > 0.);
} | rust_cleaned_test_functions.jsonl/18876 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 205
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6085,
9661,
19359,
880,
368,
341,
286,
1077,
57397,
284,
13542,
27332,
486,
931,
1188,
16,
15,
2572,
481,
16,
17,
24389,
220,
20,
2572,
220,
15,
13,
626,
286,
2060,
10714,
10297,
68004,
23233,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_or_with_one_lt_to_string() {
let name1 = _random_vector(10);
let value1 = _random_string(10);
let query = Operator::Or(
vec![
Operator::Lt(
TagName::PlainTagName(name1.clone()),
TargetValue::Unencrypted(value1.clone())
)
]
);
let json = query.to_string();
let expected = format!(r#"{{"$or":[{{"~{}":{{"$lt":"{}"}}}}]}}"#, base64::encode(&name1), value1);
assert_eq!(json, expected);
} | rust_cleaned_test_functions.jsonl/11912 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 312
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8734,
6615,
11667,
39164,
2346,
3904,
368,
341,
286,
1077,
829,
16,
284,
716,
11463,
12247,
7,
16,
15,
317,
286,
1077,
897,
16,
284,
716,
11463,
3904,
7,
16,
15,
626,
286,
1077,
3239,
284,
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_stdin_1_line() {
new_ucmd!()
.args(&["-n", "1"])
.pipe_in_fixture(INPUT)
.run()
.stdout_is_fixture("lorem_ipsum_1_line.expected");
} | rust_cleaned_test_functions.jsonl/32755 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15656,
258,
62,
16,
6528,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
12,
77,
497,
330,
16,
14108,
286,
659,
13768,
1243,
74409,
57911,
340,
286,
659,
6108,
741,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_named_file_ranges_status_code() {
let mut srv = test::init_service(
App::new().service(Files::new("/test", ".").index_file("Cargo.toml")),
);
// Valid range header
let request = TestRequest::get()
.uri("/t%65st/Cargo.toml")
.header(header::RANGE, "bytes=10-20")
.to_request();
let response = test::call_service(&mut srv, request);
assert_eq!(response.status(), StatusCode::PARTIAL_CONTENT);
// Invalid range header
let request = TestRequest::get()
.uri("/t%65st/Cargo.toml")
.header(header::RANGE, "bytes=1-0")
.to_request();
let response = test::call_service(&mut srv, request);
assert_eq!(response.status(), StatusCode::RANGE_NOT_SATISFIABLE);
} | rust_cleaned_test_functions.jsonl/35491 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 400
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71834,
2458,
58748,
4773,
4136,
368,
341,
286,
1077,
5206,
43578,
284,
1273,
486,
2327,
12267,
1006,
310,
1845,
486,
931,
1005,
7936,
7,
10809,
486,
931,
4283,
1944,
497,
22760,
568,
1252,
2458,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_coinbase_mine() {
use crypto::random::Random;
for _ in 0..10 {
let address = Address::random().unwrap();
let distance = Random::u64_range(1, 3).unwrap();
let difficulty = Random::u64_range(1, 3).unwrap();
let msg_len = 1000;
let msg = Random::bytes(msg_len).unwrap();
let mut coinbase = Coinbase::new(&address, distance, difficulty).unwrap();
let res = coinbase.validate_mined(&msg);
assert!(res.is_err());
let res = coinbase.calc_mining_proof(&msg);
assert!(res.is_ok());
let (nonce, digest) = res.unwrap();
let res = coinbase.mine(&msg);
assert!(res.is_ok());
assert_eq!(coinbase.nonce, nonce);
assert_eq!(coinbase.digest, digest);
let res = coinbase.validate_mined(&msg);
assert!(res.is_ok());
coinbase.clear();
assert_eq!(coinbase.nonce, 0);
assert_eq!(coinbase.digest, Digest::default());
}
} | rust_cleaned_test_functions.jsonl/70435 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 454
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75718,
3152,
717,
482,
368,
341,
262,
990,
19028,
486,
11463,
486,
13999,
401,
262,
369,
716,
304,
220,
15,
496,
16,
15,
341,
286,
1077,
2621,
284,
9177,
486,
11463,
1005,
15454,
543,
286,
107... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_trim_multiline_empty_line() {
assert_eq!("\
if x {
y
} else {
z
}", trim_multiline(" if x {
y
} else {
z
}".into(), false, None));
} | rust_cleaned_test_functions.jsonl/4236 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 148
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70025,
26290,
26560,
15124,
6528,
368,
341,
286,
2060,
10714,
0,
4921,
198,
262,
421,
856,
341,
286,
379,
271,
262,
335,
770,
341,
286,
1147,
198,
262,
335,
497,
11013,
26290,
26560,
445,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_index() {
let data: Vec<_> = RandomCandles::new().take(300).collect();
for length in 1..255 {
let mut w = Window::new(length, data[0]);
data.iter().enumerate().for_each(|(i, &c)| {
w.push(c);
assert_eq!(w[0], c);
if i >= length as usize {
let from = i.saturating_sub((length - 1) as usize);
let to = i;
let slice = &data[from..=to];
for j in 0..length {
assert_eq!(slice[(length - 1 - j) as usize], w[j]);
}
}
});
}
} | rust_cleaned_test_functions.jsonl/125191 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 251
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3560,
368,
341,
197,
10217,
821,
25,
11312,
32399,
29,
284,
10612,
34,
20125,
486,
931,
1005,
22769,
7,
18,
15,
15,
568,
17384,
1428,
197,
2023,
3084,
304,
220,
16,
496,
17,
20,
20,
341,
298... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_interval_iterator() {
let now = Moment(Local.ymd(2017, 04, 25).and_hms(9, 10, 11));
let interval = Interval::starting_at(now, Grain::Second);
let mut iterator = Walker::generator(interval, |prev| prev + PeriodComp::days(1));
assert_eq!(Moment(Local.ymd(2017, 04, 25).and_hms(9, 10, 11)),
iterator.next().unwrap().start);
assert_eq!(Moment(Local.ymd(2017, 04, 26).and_hms(9, 10, 11)),
iterator.next().unwrap().start);
assert_eq!(Moment(Local.ymd(2017, 04, 27).and_hms(9, 10, 11)),
iterator.next().unwrap().start);
assert_eq!(Moment(Local.ymd(2017, 04, 28).and_hms(9, 10, 11)),
iterator.next().unwrap().start);
} | rust_cleaned_test_functions.jsonl/56546 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 380
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20541,
13491,
368,
341,
286,
1077,
1431,
284,
38996,
42718,
13,
1600,
67,
7,
17,
15,
16,
22,
11,
220,
15,
19,
11,
220,
17,
20,
568,
437,
1523,
1011,
7,
24,
11,
220,
16,
15,
11,
220,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_url() {
let problem = AtCoderProblem {
id: "arc102_c".to_string(),
title: "".to_string(),
position: "".to_string(),
contest_id: "arc102".to_string(),
};
assert_eq!(
"https://atcoder.jp/contests/arc102/tasks/arc102_c".to_string(),
problem.url()
);
} | rust_cleaned_test_functions.jsonl/96780 | {
"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,
368,
341,
286,
1077,
3491,
284,
2411,
35290,
31198,
341,
310,
877,
25,
330,
8198,
16,
15,
17,
666,
3263,
983,
3904,
3148,
310,
2265,
25,
44907,
983,
3904,
3148,
310,
2309,
25,
44907,
983... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_interpreter_from_instructions() {
let instructions = vec![
Instruction::ArgumentGet { index: 0 },
Instruction::ArgumentGet { index: 0 },
Instruction::CallExport { export_name: "foo" },
Instruction::ReadUtf8,
Instruction::Call { function_index: 7 },
];
let interpreter: Interpreter<(), (), (), (), EmptyMemoryView> =
(&instructions).try_into().unwrap();
assert_eq!(interpreter.executable_instructions.len(), 5);
} | rust_cleaned_test_functions.jsonl/37071 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 239
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15318,
28637,
5673,
82427,
368,
341,
286,
1077,
11221,
284,
7486,
90515,
310,
29051,
486,
9171,
1949,
314,
1922,
25,
220,
15,
1153,
310,
29051,
486,
9171,
1949,
314,
1922,
25,
220,
15,
1153,
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_extend_lockup() {
let lockup = LockupArgs {
unix_timestamp: Some(1),
..LockupArgs::default()
};
let expected_lockup = LockupArgs {
unix_timestamp: Some(1 + SECONDS_PER_YEAR),
..LockupArgs::default()
};
assert_eq!(extend_lockup(&lockup, 1.0), expected_lockup);
} | rust_cleaned_test_functions.jsonl/21753 | {
"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,
70265,
9818,
454,
368,
341,
286,
1077,
5296,
454,
284,
15701,
454,
4117,
341,
310,
51866,
23073,
25,
4329,
7,
16,
1326,
310,
5241,
11989,
454,
4117,
486,
2258,
741,
286,
2605,
286,
1077,
3601,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_wait_timeout() {
use ln::channelmanager::PersistenceNotifier;
use sync::Arc;
use core::sync::atomic::{AtomicBool, Ordering};
use std::thread;
let persistence_notifier = Arc::new(PersistenceNotifier::new());
let thread_notifier = Arc::clone(&persistence_notifier);
let exit_thread = Arc::new(AtomicBool::new(false));
let exit_thread_clone = exit_thread.clone();
thread::spawn(move || {
loop {
let &(ref persist_mtx, ref cnd) = &thread_notifier.persistence_lock;
let mut persistence_lock = persist_mtx.lock().unwrap();
*persistence_lock = true;
cnd.notify_all();
if exit_thread_clone.load(Ordering::SeqCst) {
break
}
}
});
// Check that we can block indefinitely until updates are available.
let _ = persistence_notifier.wait();
// Check that the PersistenceNotifier will return after the given duration if updates are
// available.
loop {
if persistence_notifier.wait_timeout(Duration::from_millis(100)) {
break
}
}
exit_thread.store(true, Ordering::SeqCst);
// Check that the PersistenceNotifier will return after the given duration even if no updates
// are available.
loop {
if !persistence_notifier.wait_timeout(Duration::from_millis(100)) {
break
}
}
} | rust_cleaned_test_functions.jsonl/94564 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 477
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18760,
20537,
368,
341,
197,
41819,
29390,
486,
10119,
13297,
486,
71562,
64729,
280,
197,
41819,
12811,
486,
36809,
280,
197,
41819,
6200,
486,
12996,
486,
6618,
22964,
65857,
11233,
11,
68621,
244... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_try_from_list_to_vec_expr() -> Result<()> {
let items = vec![
Item::Ident("a".to_owned()).into(),
Item::Ident("b".to_owned()).into(),
];
let expr: Vec<Expr> = try_into_exprs(items)?;
assert_debug_snapshot!(expr, @r###"
[
Identifier(
Ident {
value: "a",
quote_style: None,
},
),
Identifier(
Ident {
value: "b",
quote_style: None,
},
),
]
"###);
Ok(())
} | rust_cleaned_test_functions.jsonl/62552 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 427
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53283,
5673,
2019,
2346,
13251,
21915,
368,
1464,
5714,
71698,
341,
286,
1077,
3589,
284,
7486,
90515,
310,
5739,
486,
28301,
445,
64,
3263,
983,
51973,
6011,
18122,
3148,
310,
5739,
486,
28301,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_stale_peer_cache() {
// 3 nodes cluster.
let mut cluster = new_node_cluster(0, 3);
cluster.run();
let (key, value) = (b"k1", b"v1");
cluster.must_put(key, value);
assert_eq!(cluster.get(key), Some(value.to_vec()));
let engine_3 = cluster.get_engine(3);
must_get_equal(&engine_3, b"k1", b"v1");
cluster.must_transfer_leader(1, new_peer(1, 1));
fail::cfg("stale_peer_cache_2", "return").unwrap();
cluster.must_put(b"k2", b"v2");
} | rust_cleaned_test_functions.jsonl/23136 | {
"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,
1261,
1574,
45159,
11529,
368,
341,
262,
442,
220,
18,
7798,
10652,
624,
262,
1077,
5206,
10652,
284,
501,
5084,
28441,
7,
15,
11,
220,
18,
626,
262,
10652,
7634,
543,
1066,
262,
1077,
320,
79... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_transfer_lamports() {
let from = solana_sdk::pubkey::new_rand();
let from_account = AccountSharedData::new_ref(100, 0, &Pubkey::new(&[2; 32])); // account owner should not matter
let to = Pubkey::new(&[3; 32]);
let to_account = AccountSharedData::new_ref(1, 0, &to); // account owner should not matter
let from_keyed_account = KeyedAccount::new(&from, true, &from_account);
let to_keyed_account = KeyedAccount::new(&to, false, &to_account);
transfer(
&from_keyed_account,
&to_keyed_account,
50,
&MockInvokeContext::new(vec![]),
)
.unwrap();
let from_lamports = from_keyed_account.account.borrow().lamports;
let to_lamports = to_keyed_account.account.borrow().lamports;
assert_eq!(from_lamports, 50);
assert_eq!(to_lamports, 51);
// Attempt to move more lamports than remaining in from_account
let from_keyed_account = KeyedAccount::new(&from, true, &from_account);
let result = transfer(
&from_keyed_account,
&to_keyed_account,
100,
&MockInvokeContext::new(vec![]),
);
assert_eq!(result, Err(SystemError::ResultWithNegativeLamports.into()));
assert_eq!(from_keyed_account.account.borrow().lamports, 50);
assert_eq!(to_keyed_account.account.borrow().lamports, 51);
// test unsigned transfer of zero
let from_keyed_account = KeyedAccount::new(&from, false, &from_account);
assert!(transfer(
&from_keyed_account,
&to_keyed_account,
0,
&MockInvokeContext::new(vec![]),
)
.is_ok(),);
assert_eq!(from_keyed_account.account.borrow().lamports, 50);
assert_eq!(to_keyed_account.account.borrow().lamports, 51);
} | rust_cleaned_test_functions.jsonl/73051 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 883
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35403,
907,
309,
3394,
368,
341,
286,
1077,
504,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
504,
13500,
284,
8615,
16997,
1043,
486,
931,
7793,
7,
16,
15,
15,
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_sbp2json() -> Result<()> {
let tranform1 = |reader: &mut dyn Read, writer: &mut Rc<Box<dyn Write>>| -> Result<()> {
sbp2json_read_loop(false, false, false, reader, writer)
};
let tranform2 = |reader: &mut dyn Read, writer: &mut Rc<Box<dyn Write>>| -> Result<()> {
json2sbp_read_loop(false, reader, writer)
};
test_round_trip(
tranform1,
tranform2,
"sbp2json",
"roundtrip.sbp",
make_none_transform!(),
)
} | rust_cleaned_test_functions.jsonl/58776 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 248
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
17808,
17,
2236,
368,
1464,
5714,
71698,
341,
262,
1077,
23686,
627,
16,
284,
760,
11149,
25,
609,
6984,
31070,
4457,
11,
6916,
25,
609,
6984,
81463,
79852,
92846,
9645,
2452,
91,
1464,
571... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_raw_node_propose_add_duplicate_node() {
let l = default_logger();
let s = new_storage();
let mut raw_node = new_raw_node(1, vec![1], 10, 1, s.clone(), &l);
raw_node.campaign().expect("");
loop {
let rd = raw_node.ready();
s.wl().append(rd.entries()).expect("");
if rd.ss().map_or(false, |ss| ss.leader_id == raw_node.raft.id) {
raw_node.advance(rd);
break;
}
raw_node.advance(rd);
}
let mut propose_conf_change_and_apply = |cc| {
raw_node.propose_conf_change(vec![], cc).expect("");
let rd = raw_node.ready();
s.wl().append(rd.entries()).expect("");
for e in rd.committed_entries.as_ref().unwrap() {
if e.get_entry_type() == EntryType::EntryConfChange {
let mut conf_change = ConfChange::default();
conf_change.merge_from_bytes(&e.data).unwrap();
raw_node.apply_conf_change(&conf_change).unwrap();
}
}
raw_node.advance(rd);
};
let cc1 = conf_change(ConfChangeType::AddNode, 1);
let ccdata1 = cc1.write_to_bytes().unwrap();
propose_conf_change_and_apply(cc1.clone());
// try to add the same node again
propose_conf_change_and_apply(cc1);
// the new node join should be ok
let cc2 = conf_change(ConfChangeType::AddNode, 2);
let ccdata2 = cc2.write_to_bytes().unwrap();
propose_conf_change_and_apply(cc2);
let last_index = s.last_index().unwrap();
let mut entries = s.entries(last_index - 2, last_index + 1, None).unwrap();
assert_eq!(entries.len(), 3);
assert_eq!(entries[0].take_data(), ccdata1);
assert_eq!(entries[2].take_data(), ccdata2);
} | rust_cleaned_test_functions.jsonl/33967 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 815
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16067,
5084,
21663,
960,
2891,
70434,
5084,
368,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
1077,
274,
284,
501,
23310,
543,
262,
1077,
5206,
7112,
5084,
284,
501,
16067,
5084,
7,
16,
11,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_new() {
let ll1 = LinkedList::<u8>::new();
let ll2 = LinkedList::<u8>::new();
assert!(ll1.cid < ll2.cid);
} | rust_cleaned_test_functions.jsonl/59881 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
368,
341,
286,
1077,
9323,
16,
284,
22917,
27638,
84,
23,
6831,
931,
543,
286,
1077,
9323,
17,
284,
22917,
27638,
84,
23,
6831,
931,
543,
286,
2060,
10297,
654,
16,
82886,
366,
9323,
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 |
#[test]
fn test_load_basic_page_document() {
let _ = env_logger::try_init();
let xflow =
load_doc::<XFlowDocument>("resource/docs/xflow/flows/branch_boolean_condition.json");
let s_es5 = xflow_to_es5::output_es5(&xflow);
let s_es = xflow_to_es5::output(&xflow);
let _ = parser::parse(s_es5.to_string()).expect("Must compile");
let _ = parser::parse(s_es.to_string()).expect("Must compile");
//XXX: A little more assurance would be nice here
assert_ne!(s_es, "");
println!("JS LATEST! {}", s_es);
} | rust_cleaned_test_functions.jsonl/127843 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 244
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12411,
34729,
6129,
26231,
368,
341,
262,
1077,
716,
284,
6105,
27413,
486,
1539,
6137,
1428,
262,
1077,
856,
4965,
4035,
286,
2795,
18869,
27638,
55,
18878,
7524,
13211,
9233,
25967,
10776,
4965,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_looks_like_pow5() {
// is a corner case for Ryū.
assert_eq!(f32::from_bits(0x5D1502F9), 6.7108864e17);
check!(6.7108864e17);
assert_eq!(f32::from_bits(0x5D9502F9), 1.3421773e18);
check!(1.3421773e18);
assert_eq!(f32::from_bits(0x5E1502F9), 2.6843546e18);
check!(2.6843546e18);
} | rust_cleaned_test_functions.jsonl/58241 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 193
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24271,
82,
25535,
56183,
20,
368,
341,
9401,
262,
442,
374,
264,
9131,
1142,
369,
25691,
52956,
624,
262,
2060,
10714,
10297,
69,
18,
17,
486,
1499,
20034,
7,
15,
87,
20,
35,
16,
20,
15,
17,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_process_transactions_account_in_use() {
solana_logger::setup();
let GenesisConfigInfo {
genesis_config,
mint_keypair,
..
} = create_slow_genesis_config(10_000);
let bank = Arc::new(Bank::new_no_wallclock_throttle_for_tests(&genesis_config));
// set cost tracker limits to MAX so it will not filter out TXs
bank.write_cost_tracker()
.unwrap()
.set_limits(std::u64::MAX, std::u64::MAX, std::u64::MAX);
let mut transactions = vec![
system_transaction::transfer(
&mint_keypair,
&Pubkey::new_unique(),
1,
genesis_config.hash()
);
MAX_NUM_TRANSACTIONS_PER_BATCH
];
// should be executed
transactions.push(system_transaction::transfer(
&mint_keypair,
&Pubkey::new_unique(),
1,
genesis_config.hash(),
));
let transactions_count = transactions.len();
let ProcessTransactionsSummary {
reached_max_poh_height,
transactions_attempted_execution_count,
committed_transactions_count,
committed_transactions_with_successful_result_count,
failed_commit_count,
retryable_transaction_indexes,
..
} = execute_transactions_with_dummy_poh_service(bank, transactions);
assert!(!reached_max_poh_height);
assert_eq!(transactions_attempted_execution_count, transactions_count);
assert_eq!(committed_transactions_count, 2);
assert_eq!(committed_transactions_with_successful_result_count, 2);
assert_eq!(failed_commit_count, 0,);
// Everything except first and last index of the transactions failed and are last retryable
assert_eq!(
retryable_transaction_indexes,
(1..transactions_count - 1).collect::<Vec<usize>>()
);
} | rust_cleaned_test_functions.jsonl/15493 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 990
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
68182,
13500,
1243,
15951,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
40788,
2648,
1731,
341,
310,
59366,
5332,
345,
310,
28337,
3097,
12670,
345,
310,
54538,
286,
335,
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_row_key_codec() {
let tests = vec![i64::MIN, i64::MAX, -1, 0, 2, 3, 1024];
for &t in &tests {
let k = encode_row_key(1, t);
assert_eq!(t, decode_int_handle(&k).unwrap());
}
} | rust_cleaned_test_functions.jsonl/3829 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8530,
3097,
51084,
368,
341,
286,
1077,
7032,
284,
7486,
20703,
72,
21,
19,
486,
16413,
11,
600,
21,
19,
486,
10586,
11,
481,
16,
11,
220,
15,
11,
220,
17,
11,
220,
18,
11,
220,
16,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_follow_multiple() {
let (at, mut ucmd) = at_and_ucmd!();
let mut child = ucmd
.arg("-f")
.arg(FOOBAR_TXT)
.arg(FOOBAR_2_TXT)
.run_no_wait();
let expected = at.read("foobar_follow_multiple.expected");
assert_eq!(read_size(&mut child, expected.len()), expected);
let first_append = "trois\n";
at.append(FOOBAR_2_TXT, first_append);
assert_eq!(read_size(&mut child, first_append.len()), first_append);
let second_append = "twenty\nthirty\n";
let expected = at.read("foobar_follow_multiple_appended.expected");
at.append(FOOBAR_TXT, second_append);
assert_eq!(read_size(&mut child, expected.len()), expected);
child.kill().unwrap();
} | rust_cleaned_test_functions.jsonl/39288 | {
"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,
43490,
45233,
368,
341,
262,
1077,
320,
266,
11,
5206,
575,
8710,
8,
284,
518,
8378,
68887,
2277,
0,
543,
262,
1077,
5206,
1682,
284,
575,
8710,
198,
286,
659,
858,
13645,
69,
1138,
286,
659,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_basic() {
let mut sl = SkipList::new(
Random::new(0xdead_beef),
DefaultComparator::default(),
ArenaImpl::new(),
);
let mut s = vec![];
for i in 0..100u8 {
s.push(vec![i]);
sl.insert(Slice::from(s.last().unwrap()));
}
let mut iter = SkipListIter::new(sl);
assert!(!iter.valid());
iter.seek_to_first();
assert!(iter.valid());
assert_eq!(iter.key(), &[0]);
iter.seek_to_last();
assert_eq!(iter.key(), &[99]);
iter.seek(&[88]);
assert_eq!(iter.key(), &[88]);
iter.next();
assert_eq!(iter.key(), &[89]);
iter.seek(&[99]);
assert_eq!(iter.key(), &[99]);
iter.prev();
assert_eq!(iter.key(), &[98]);
} | rust_cleaned_test_functions.jsonl/61512 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 461
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
368,
341,
286,
1077,
5206,
1739,
284,
25784,
852,
486,
931,
1006,
310,
10612,
486,
931,
7,
15,
87,
33754,
21263,
823,
1326,
310,
7899,
38658,
486,
2258,
3148,
310,
27047,
9673,
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... | 2 |
#[test]
fn test_client_should_respond_to_dns_watch_requests() {
let mut exec = fasync::TestExecutor::new().expect("failed to create test ecexutor");
let transaction_id = [1, 2, 3];
let (client_end, server_end) =
create_endpoints::<ClientMarker>().expect("failed to create test fidl channel");
let client_proxy = client_end.into_proxy().expect("failed to create test client proxy");
let client_stream = server_end.into_stream().expect("failed to create test request stream");
let (client_socket, client_addr) = create_test_socket();
let (server_socket, server_addr) = create_test_socket();
let mut client = exec
.run_singlethreaded(Client::<fasync::net::UdpSocket>::start(
transaction_id,
ClientConfig {
information_config: Some(InformationConfig { ..InformationConfig::EMPTY }),
..ClientConfig::EMPTY
},
1, /* interface ID */
client_socket,
server_addr,
client_stream,
))
.expect("failed to create test client");
let (mut signal_client_to_refresh, mut client_should_refresh) = mpsc::channel::<()>(1);
let client_fut = async {
let mut buf = vec![0u8; MAX_UDP_DATAGRAM_SIZE];
loop {
select! {
res = client.handle_next_event(&mut buf).fuse() => {
match res.expect("test client failed to handle next event") {
Some(()) => (),
None => break (),
};
}
_ = client_should_refresh.next() => {
// start receiving updates without waiting for the full refresh timeout
// which is unrealistic test.
if client.timer_abort_handles.contains_key(&dhcpv6_core::client::ClientTimerType::Refresh) {
let () = client
.handle_timeout(dhcpv6_core::client::ClientTimerType::Refresh)
.await
.expect("test client failed to handle timeout");
} else {
panic!("no refresh timer is scheduled and refresh is requested in test");
}
},
}
}
}.fuse();
futures::pin_mut!(client_fut);
macro_rules! build_test_fut {
($test_fut:ident) => {
let $test_fut = async {
select! {
() = client_fut => panic!("test client returned unexpectly"),
r = client_proxy.watch_servers() => r,
}
};
futures::pin_mut!($test_fut);
};
}
{
// No DNS configurations received yet.
build_test_fut!(test_fut);
assert_matches!(exec.run_until_stalled(&mut test_fut), Poll::Pending);
let () = exec
.run_singlethreaded(send_reply_with_options(
&server_socket,
client_addr,
transaction_id,
&[v6::DhcpOption::DnsServers(&[])],
))
.expect("failed to send test reply");
assert_matches!(exec.run_until_stalled(&mut test_fut), Poll::Pending);
let () = signal_client_to_refresh
.try_send(())
.expect("failed to signal test client to refresh");
let dns_servers = [std_ip_v6!("fe80::1:2")];
let () = exec
.run_singlethreaded(send_reply_with_options(
&server_socket,
client_addr,
transaction_id,
&[v6::DhcpOption::DnsServers(&dns_servers)],
))
.expect("failed to send test reply");
let want_servers = vec![create_test_dns_server(
fidl_ip_v6!("fe80::1:2"),
1, /* source interface */
1, /* zone index */
)];
assert_matches!(
exec.run_until_stalled(&mut test_fut),
Poll::Ready(Ok(servers)) if servers == want_servers
);
} // drop `test_fut` so `client_fut` is no longer mutably borrowed.
{
build_test_fut!(test_fut);
assert_matches!(exec.run_until_stalled(&mut test_fut), Poll::Pending);
let () = signal_client_to_refresh
.try_send(())
.expect("failed to signal test client to refresh");
let dns_servers = [std_ip_v6!("fe80::1:2")];
let () = exec
.run_singlethreaded(send_reply_with_options(
&server_socket,
client_addr,
transaction_id,
&[v6::DhcpOption::DnsServers(&dns_servers)],
))
.expect("failed to send test reply");
assert_matches!(exec.run_until_stalled(&mut test_fut), Poll::Pending);
let () = signal_client_to_refresh
.try_send(())
.expect("failed to signal test client to refresh");
let dns_servers = [std_ip_v6!("fe80::1:2"), std_ip_v6!("1234::5:6")];
let () = exec
.run_singlethreaded(send_reply_with_options(
&server_socket,
client_addr,
transaction_id,
&[v6::DhcpOption::DnsServers(&dns_servers)],
))
.expect("failed to send test reply");
let want_servers = vec![
create_test_dns_server(
fidl_ip_v6!("fe80::1:2"),
1, /* source interface */
1, /* zone index */
),
// Only set zone index for link local addresses.
create_test_dns_server(
fidl_ip_v6!("1234::5:6"),
1, /* source interface */
0, /* zone index */
),
];
assert_matches!(
exec.run_until_stalled(&mut test_fut),
Poll::Ready(Ok(servers)) if servers == want_servers
);
} // drop `test_fut` so `client_fut` is no longer mutably borrowed.
{
// what the watcher has seen last time.
let () = signal_client_to_refresh
.try_send(())
.expect("failed to signal test client to refresh");
let () = exec
.run_singlethreaded(send_reply_with_options(
&server_socket,
client_addr,
transaction_id,
&[v6::DhcpOption::DnsServers(&[])],
))
.expect("failed to send test reply");
build_test_fut!(test_fut);
let want_servers = Vec::<fnetname::DnsServer_>::new();
assert_matches!(
exec.run_until_stalled(&mut test_fut),
Poll::Ready(Ok(servers)) if servers == want_servers
);
} // drop `test_fut` so `client_fut` is no longer mutably borrowed.
} | rust_cleaned_test_functions.jsonl/29643 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 4280
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8179,
43378,
4918,
3511,
2346,
71125,
58562,
37216,
368,
341,
286,
1077,
5206,
3883,
284,
282,
7692,
486,
2271,
25255,
486,
931,
1005,
17119,
445,
16091,
311,
1855,
1273,
11942,
327,
4831,
797,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_make_blob_url() {
let merkle = "00112233445566778899aabbccddeeffffeeddccbbaa99887766554433221100"
.parse::<BlobId>()
.unwrap();
assert_eq!(
make_blob_url("http://example.com".parse::<Uri>().unwrap(), &merkle).unwrap(),
format!("http://example.com/{}", merkle).parse::<Uri>().unwrap()
);
assert_eq!(
make_blob_url("http://example.com/noslash".parse::<Uri>().unwrap(), &merkle).unwrap(),
format!("http://example.com/noslash/{}", merkle).parse::<Uri>().unwrap()
);
assert_eq!(
make_blob_url("http://example.com/slash/".parse::<Uri>().unwrap(), &merkle).unwrap(),
format!("http://example.com/slash/{}", merkle).parse::<Uri>().unwrap()
);
assert_eq!(
make_blob_url("http://example.com/twoslashes//".parse::<Uri>().unwrap(), &merkle)
.unwrap(),
format!("http://example.com/twoslashes//{}", merkle).parse::<Uri>().unwrap()
);
// IPv6 zone id
assert_eq!(
make_blob_url(
"http://[fe80::e022:d4ff:fe13:8ec3%252]:8083/blobs/".parse::<Uri>().unwrap(),
&merkle
)
.unwrap(),
format!("http://[fe80::e022:d4ff:fe13:8ec3%252]:8083/blobs/{}", merkle)
.parse::<Uri>()
.unwrap()
);
} | rust_cleaned_test_functions.jsonl/15630 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 815
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28230,
45908,
2903,
368,
341,
286,
1077,
4704,
23089,
284,
330,
15,
15,
16,
16,
17,
17,
18,
18,
19,
19,
20,
20,
21,
21,
22,
22,
23,
23,
24,
24,
64,
12523,
638,
88089,
6445,
542,
12051,
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_maybe_has_inline_comments() {
let mut event = get_event();
event.comment = "PatchSet 666: (2 comments)".to_string();
assert!(maybe_has_inline_comments(&event));
event.comment = "Nope, colleague comment!".to_string();
assert!(!maybe_has_inline_comments(&event));
} | rust_cleaned_test_functions.jsonl/62229 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
49791,
21778,
41871,
30359,
368,
341,
286,
1077,
5206,
1538,
284,
633,
6748,
543,
286,
1538,
30970,
284,
330,
43622,
1649,
220,
21,
21,
21,
25,
320,
17,
6042,
94010,
983,
3904,
543,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_success() {
// a static c str
let x = test_with_str("42\n");
assert_eq!(PositiveNonzeroInteger(42), x.unwrap());
} | rust_cleaned_test_functions.jsonl/61978 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 68
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18632,
368,
341,
262,
442,
264,
1099,
272,
607,
198,
262,
1077,
856,
284,
1273,
6615,
2895,
445,
19,
17,
1699,
797,
262,
2060,
10714,
10297,
35490,
8121,
14154,
3486,
7,
19,
17,
701,
856,
5539... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_basic_repeat_expansion() {
let grammar = intern_symbols(&build_grammar(vec![
Variable::named("x", Rule::choice(vec![Rule::named("y"), Rule::named("_z")])),
Variable::named("y", Rule::named("_z")),
Variable::named("_z", Rule::string("a")),
]))
.unwrap();
assert_eq!(
grammar.variables,
vec![
Variable::named(
"x",
Rule::choice(vec![Rule::non_terminal(1), Rule::non_terminal(2),])
),
Variable::named("y", Rule::non_terminal(2)),
Variable::hidden("_z", Rule::string("a")),
]
);
} | rust_cleaned_test_functions.jsonl/99557 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 400
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34729,
41975,
14214,
10501,
368,
341,
286,
1077,
31428,
284,
2590,
55752,
2099,
5834,
62,
41094,
25592,
90515,
310,
12407,
486,
30245,
445,
87,
497,
18100,
486,
11746,
25592,
20703,
11337,
486,
3024... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_empty() {
let empty = "";
let arc_str = ArcString::from(empty);
assert_eq!(arc_str.as_str(), empty);
assert_eq!(arc_str.len, empty.len());
} | rust_cleaned_test_functions.jsonl/79118 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 101
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15124,
368,
341,
286,
1077,
4287,
284,
5438,
286,
1077,
15580,
2895,
284,
19689,
703,
486,
1499,
24216,
626,
286,
2060,
10714,
10297,
8198,
2895,
5357,
2895,
1507,
4287,
317,
286,
2060,
10714,
102... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_expect_at_least_and_at_most() {
let mock = mock("GET", "/hello")
.expect_at_least(3)
.expect_at_most(6)
.create();
request("GET /hello", "");
request("GET /hello", "");
request("GET /hello", "");
request("GET /hello", "");
request("GET /hello", "");
mock.assert();
} | rust_cleaned_test_functions.jsonl/82430 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68918,
3752,
88716,
8378,
3752,
81416,
368,
341,
262,
1077,
7860,
284,
7860,
445,
3806,
497,
3521,
14990,
1138,
286,
659,
17119,
3752,
88716,
7,
18,
340,
286,
659,
17119,
3752,
81416,
7,
21,
340... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_values_simple() {
let three_four = FizzBuzz::new(3, 4);
let a = three_four.get_values(&1, &5);
let b = vec!["1".to_string(), "2".into(), "fizz".into(),
"buzz".into(), "5".into()];
assert_eq!(a, b);
} | rust_cleaned_test_functions.jsonl/74964 | {
"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,
3062,
9146,
30015,
368,
341,
286,
1077,
2326,
56142,
284,
434,
8759,
59473,
486,
931,
7,
18,
11,
220,
19,
317,
286,
1077,
264,
284,
2326,
56142,
670,
9146,
2099,
16,
11,
609,
20,
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,
1... | 1 |
#[test]
fn test_map_content_type_media_type_with_no_extension() {
// Media Type
assert_eq!(
map_content_type(Path::new("foo/bar"), Some("application/typescript")).0,
msg::MediaType::TypeScript
);
assert_eq!(
map_content_type(Path::new("foo/bar"), Some("text/typescript")).0,
msg::MediaType::TypeScript
);
assert_eq!(
map_content_type(Path::new("foo/bar"), Some("video/vnd.dlna.mpeg-tts")).0,
msg::MediaType::TypeScript
);
assert_eq!(
map_content_type(Path::new("foo/bar"), Some("video/mp2t")).0,
msg::MediaType::TypeScript
);
assert_eq!(
map_content_type(Path::new("foo/bar"), Some("application/x-typescript"))
.0,
msg::MediaType::TypeScript
);
assert_eq!(
map_content_type(Path::new("foo/bar"), Some("application/javascript")).0,
msg::MediaType::JavaScript
);
assert_eq!(
map_content_type(Path::new("foo/bar"), Some("text/javascript")).0,
msg::MediaType::JavaScript
);
assert_eq!(
map_content_type(Path::new("foo/bar"), Some("application/ecmascript")).0,
msg::MediaType::JavaScript
);
assert_eq!(
map_content_type(Path::new("foo/bar"), Some("text/ecmascript")).0,
msg::MediaType::JavaScript
);
assert_eq!(
map_content_type(Path::new("foo/bar"), Some("application/x-javascript"))
.0,
msg::MediaType::JavaScript
);
assert_eq!(
map_content_type(Path::new("foo/bar"), Some("application/json")).0,
msg::MediaType::Json
);
assert_eq!(
map_content_type(Path::new("foo/bar"), Some("application/node")).0,
msg::MediaType::JavaScript
);
assert_eq!(
map_content_type(Path::new("foo/bar"), Some("text/json")).0,
msg::MediaType::Json
);
assert_eq!(
map_content_type(Path::new("foo/bar"), Some("text/json; charset=utf-8 ")),
(msg::MediaType::Json, Some("utf-8".to_owned()))
);
} | rust_cleaned_test_functions.jsonl/92013 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 885
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5376,
7495,
1819,
29173,
1819,
6615,
6536,
31035,
368,
341,
262,
442,
7816,
3990,
198,
262,
2060,
10714,
33673,
414,
2415,
7495,
1819,
33030,
486,
931,
445,
7975,
49513,
3975,
4329,
445,
5132,
203... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_select(){
let mut fds : FdSet = unsafe {std::mem::zeroed()};
FD_ZERO(&mut fds);
FD_SET(0 , &mut fds);
assert!(select(1, std::ptr::null_mut() , &mut fds ,std::ptr::null_mut() , std::ptr::null_mut()) > 0);
assert!(FD_ISSET(0, &mut fds));
} | rust_cleaned_test_functions.jsonl/50626 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 123
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13051,
3032,
10217,
5206,
93734,
549,
434,
67,
1649,
284,
19860,
314,
1834,
486,
10536,
486,
14154,
291,
81141,
12727,
35,
39370,
2099,
6984,
93734,
317,
12727,
35,
8481,
7,
15,
1154,
609,
6984,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_div() {
test_op!(_neg1_1i / _0_1i, _1_1i);
for &c in all_consts.iter() {
if c != Zero::zero() {
test_op!(c / c, _1_0i);
}
}
} | rust_cleaned_test_functions.jsonl/105712 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 174
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16237,
368,
341,
310,
1273,
10287,
0,
2490,
28775,
16,
62,
16,
72,
608,
716,
15,
62,
16,
72,
11,
716,
16,
62,
16,
72,
317,
310,
369,
609,
66,
304,
678,
48530,
19471,
368,
341,
394,
421,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_lazy_wildcard() {
let df = load_df();
let new = df.clone().lazy().select([col("*")]).collect().unwrap();
assert_eq!(new.shape(), (5, 3));
let new = df
.lazy()
.groupby([col("b")])
.agg([col("*").sum(), col("*").first()])
.collect()
.unwrap();
assert_eq!(new.shape(), (3, 5)); // Should exclude b from wildcard aggregations.
} | rust_cleaned_test_functions.jsonl/128 | {
"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,
49646,
1670,
695,
4951,
368,
341,
262,
1077,
6764,
284,
2795,
10894,
543,
262,
1077,
501,
284,
6764,
15997,
1005,
49013,
1005,
1742,
2561,
2074,
29592,
899,
10697,
17384,
1005,
15454,
543,
262,
20... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_valid_ascii_code_escape() {
let valid = [r"\x00", r"\x7F", r"\x55", r"\xF0"];
for c in &valid {
assert_valid_str(c);
}
} | rust_cleaned_test_functions.jsonl/4165 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 112
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8337,
50238,
4136,
21832,
368,
341,
286,
1077,
2697,
284,
508,
81,
11934,
87,
15,
15,
497,
435,
11934,
87,
22,
37,
497,
435,
11934,
87,
20,
20,
497,
435,
11934,
9770,
15,
6332,
286,
369,
272... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_with_more_attr() {
let result = parser(vec![
DeltaOp {
insert: Value::String(String::from("hello world")),
attributes: Some(json!({"size": "30px", "font": "Montserrat-Medium"})),
},
DeltaOp {
insert: Value::String(String::from("\n")),
attributes: None,
},
]);
assert_eq!(
result,
String::from("<p><span style=\"font-family: Montserrat-Medium; font-size: 30px; \">hello world</span></p>")
);
} | rust_cleaned_test_functions.jsonl/33070 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 314
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
36664,
10422,
368,
341,
286,
1077,
1102,
284,
6729,
25592,
90515,
310,
24957,
7125,
341,
394,
5656,
25,
5162,
486,
703,
2242,
486,
1499,
445,
14990,
1879,
30154,
394,
8201,
25,
4329,
9304,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_initialize_vertices() {
let left_image = [[1, 1].to_vec()].to_vec();
let right_image = [[1, 0].to_vec()].to_vec();
let max_disparity: usize = 2;
let mut diffusion_graph = DiffusionGraph::initialize(left_image, right_image, max_disparity, 1.);
diffusion_graph.potentials[0][0][2][0] = 0.6;
diffusion_graph.potentials[0][1][0][0] = -13.7;
diffusion_graph.potentials[0][1][0][1] = 80.;
let vertices = vec![vec![vec![false; max_disparity]; 2]; 1];
let edges = vec![vec![vec![vec![vec![false; max_disparity]; 4]; max_disparity]; 2]; 1];
let mut crossing_out_graph = CrossingOutGraph::initialize(diffusion_graph, vertices, edges);
crossing_out_graph.initialize_vertices(1.);
assert!(crossing_out_graph.vertices[0][0][0]);
assert!(!crossing_out_graph.vertices[0][1][0]);
assert!(crossing_out_graph.vertices[0][1][1]);
} | rust_cleaned_test_functions.jsonl/133552 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 438
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
40889,
37720,
368,
341,
286,
1077,
2115,
4954,
284,
4318,
16,
11,
220,
16,
936,
983,
13251,
57590,
983,
13251,
543,
286,
1077,
1290,
4954,
284,
4318,
16,
11,
220,
15,
936,
983,
13251,
57590,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vp_binary() {
let a = serde_json::from_str(r#"[0,1,2,255]"#).unwrap();
let va = vec![0,1,2,255];
assert_eq!(vp_binary(&a), Some(NodeValue::Binary(va)));
let b: Value = serde_json::from_str(r#"[0,1,"x",3]"#).unwrap();
assert_eq!(vp_binary(&b), None);
let c: Value = serde_json::from_str(r#"[0,1,0,256]"#).unwrap();
assert_eq!(vp_binary(&c), None);
} | rust_cleaned_test_functions.jsonl/100951 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 199
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
87960,
31761,
368,
341,
262,
1077,
264,
284,
61570,
9455,
486,
1499,
2895,
2601,
2,
36864,
15,
11,
16,
11,
17,
11,
17,
20,
20,
19177,
2,
568,
15454,
543,
262,
1077,
11164,
284,
7486,
20703,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.