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_screenshot() {
let s: Screenshot = get_screenshot(0).unwrap();
println!(
"width: {}\n height: {}\npixel width: {}\n bytes: {}",
s.width(),
s.height(),
s.pixel_width(),
s.raw_len()
);
} | rust_cleaned_test_functions.jsonl/37597 | {
"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,
3062,
643,
31109,
368,
341,
262,
1077,
274,
25,
328,
31109,
284,
633,
643,
31109,
7,
15,
568,
15454,
543,
262,
13751,
33673,
286,
330,
3098,
25,
56057,
77,
2608,
25,
56057,
6199,
5941,
2374,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_range_wrapper_reflexive_property() {
let mut tests = vec![];
for i in 0..10 {
tests.push(RangeKey::new(0..i, ()));
}
let mut less_map: BTreeMap<String, BTreeSet<String>> = BTreeMap::new();
let mut greater_map: BTreeMap<String, BTreeSet<String>> = BTreeMap::new();
// test antisymmetric propery and construct {less|greater}_map
// antisymmetric propery: if a > b then b > a.
for i in tests.iter() {
for j in tests.clone().iter() {
let ret_i_j = i.cmp(j);
let ret_j_i = j.cmp(i);
match ret_i_j {
Ordering::Equal => {
assert_eq!(ret_j_i, Ordering::Equal);
}
Ordering::Less => {
assert_eq!(ret_j_i, Ordering::Greater);
upsert_cmp_map(&mut less_map, i.to_string(), j.to_string());
}
Ordering::Greater => {
assert_eq!(ret_j_i, Ordering::Less);
upsert_cmp_map(&mut greater_map, i.to_string(), j.to_string());
}
}
}
}
for (k, v) in less_map.iter() {
for g in v.iter() {
assert!(greater_map.get(g).is_some());
if let Some(set) = greater_map.get_mut(g) {
assert!(set.get(k).is_some());
}
}
}
} | rust_cleaned_test_functions.jsonl/58354 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 775
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9698,
23561,
7793,
2571,
533,
16638,
368,
341,
262,
1077,
5206,
7032,
284,
7486,
0,
15078,
262,
369,
600,
304,
220,
15,
496,
16,
15,
341,
286,
7032,
2552,
2785,
844,
1592,
486,
931,
7,
15,
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... | 8 |
#[test]
fn test_toggle_wrong_type() {
let mut doc = create_doc();
doc["status"]["disabled"] = toml_edit::value("a");
assert!(handle_toggle_configuration(&mut doc, "status", "disabled").is_err());
doc["format"] = toml_edit::value("$all");
assert!(handle_toggle_configuration(&mut doc, "format", "disabled").is_err());
} | rust_cleaned_test_functions.jsonl/134239 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 153
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
48860,
75198,
1819,
368,
341,
286,
1077,
5206,
4629,
284,
1855,
18869,
543,
286,
4629,
1183,
2829,
11018,
11978,
1341,
284,
311,
1014,
13156,
486,
957,
445,
64,
3071,
286,
2060,
10297,
8192,
48860... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_atomic_into_inner() {
let lazycell = AtomicLazyCell::new();
lazycell.fill(1).unwrap();
let value = lazycell.into_inner();
assert_eq!(value, Some(1));
} | rust_cleaned_test_functions.jsonl/5810 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 100
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
51367,
45514,
34345,
368,
341,
286,
1077,
64436,
3337,
613,
284,
30316,
39766,
3599,
486,
931,
1428,
286,
64436,
3337,
613,
12467,
7,
16,
568,
15454,
543,
286,
1077,
897,
284,
64436,
3337,
613,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_display_mode() {
assert_eq!("bicycling", Mode::Bicycling.to_string());
assert_eq!("driving", Mode::Driving.to_string());
assert_eq!("transit", Mode::Transit.to_string());
assert_eq!("walking", Mode::Walking.to_string());
} | rust_cleaned_test_functions.jsonl/75488 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
14825,
7302,
368,
341,
286,
2060,
10714,
17223,
65,
2842,
62098,
497,
14562,
486,
33,
2842,
62098,
2389,
3904,
1423,
286,
2060,
10714,
17223,
3612,
2249,
497,
14562,
486,
93836,
2389,
3904,
1423,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fstatat() {
let tempdir = tempfile::tempdir().unwrap();
let filename = tempdir.path().join("foo.txt");
File::create(&filename).unwrap();
let dirfd = fcntl::open(tempdir.path(),
fcntl::OFlag::empty(),
stat::Mode::empty());
let result = stat::fstatat(dirfd.unwrap(),
&filename,
fcntl::AtFlags::empty());
assert_stat_results(result);
} | rust_cleaned_test_functions.jsonl/48639 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 267
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
761,
9878,
266,
368,
341,
262,
1077,
2730,
3741,
284,
54819,
486,
3888,
3741,
1005,
15454,
543,
262,
1077,
3899,
284,
2730,
3741,
3875,
1005,
5987,
445,
7975,
3909,
797,
262,
2887,
486,
3182,
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_maybe_retransmit_unpropagated_slots() {
let ReplayBlockstoreComponents {
validator_node_to_vote_keys,
leader_schedule_cache,
vote_simulator,
..
} = replay_blockstore_components(None, 10, None::<GenerateVotes>);
let VoteSimulator {
mut progress,
ref bank_forks,
..
} = vote_simulator;
let (retransmit_slots_sender, retransmit_slots_receiver) = unbounded();
let mut prev_index = 0;
for i in (1..10).chain(11..15) {
let bank = Bank::new_from_parent(
bank_forks.read().unwrap().get(prev_index).unwrap(),
&leader_schedule_cache.slot_leader_at(i, None).unwrap(),
i,
);
progress.insert(
i,
ForkProgress::new_from_bank(
&bank,
bank.collector_id(),
validator_node_to_vote_keys
.get(bank.collector_id())
.unwrap(),
Some(0),
0,
0,
),
);
assert!(progress.get_propagated_stats(i).unwrap().is_leader_slot);
bank.freeze();
bank_forks.write().unwrap().insert(bank);
prev_index = i;
}
// expect single slot when latest_leader_slot is the start of a consecutive range
let latest_leader_slot = 0;
ReplayStage::maybe_retransmit_unpropagated_slots(
"test",
&retransmit_slots_sender,
&mut progress,
latest_leader_slot,
);
let received_slots = receive_slots(&retransmit_slots_receiver);
assert_eq!(received_slots, vec![0]);
// expect range of slots from start of consecutive slots
let latest_leader_slot = 6;
ReplayStage::maybe_retransmit_unpropagated_slots(
"test",
&retransmit_slots_sender,
&mut progress,
latest_leader_slot,
);
let received_slots = receive_slots(&retransmit_slots_receiver);
assert_eq!(received_slots, vec![4, 5, 6]);
// expect range of slots skipping a discontinuity in the range
let latest_leader_slot = 11;
ReplayStage::maybe_retransmit_unpropagated_slots(
"test",
&retransmit_slots_sender,
&mut progress,
latest_leader_slot,
);
let received_slots = receive_slots(&retransmit_slots_receiver);
assert_eq!(received_slots, vec![8, 9, 11]);
} | rust_cleaned_test_functions.jsonl/25837 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1426
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
49791,
1288,
1458,
1763,
4907,
2674,
351,
657,
54161,
368,
341,
286,
1077,
59061,
4713,
4314,
10443,
341,
310,
22935,
5084,
2346,
54360,
12631,
345,
310,
7653,
34530,
11529,
345,
310,
6910,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_path_verify_bad() {
let mt = MerkleTree::new(TEST);
for (i, s) in BAD.iter().enumerate() {
let hash = hash_leaf!(s);
let path = mt.find_path(i).unwrap();
assert!(!path.verify(hash));
}
} | rust_cleaned_test_functions.jsonl/112984 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 152
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2638,
35638,
34199,
368,
341,
286,
1077,
11965,
284,
8755,
23089,
6533,
486,
931,
50320,
317,
286,
369,
320,
72,
11,
274,
8,
304,
47718,
19471,
1005,
76569,
368,
341,
310,
1077,
5175,
284,
5175,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_recursion_depth_check_objects() {
let s = "{a:".repeat(10_000) + &"}".repeat(10_000);
assert!(YamlLoader::load_from_str(&s).is_err());
} | rust_cleaned_test_functions.jsonl/1216 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 87
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7080,
34280,
19061,
7200,
24873,
368,
341,
286,
1077,
274,
284,
13868,
64,
95740,
30624,
7,
16,
15,
62,
15,
15,
15,
8,
488,
609,
9207,
3263,
30624,
7,
16,
15,
62,
15,
15,
15,
317,
286,
206... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_adjust_min() {
assert_eq!(0.0, adjust_min(0.0, 100.0));
assert_eq!(5.0, adjust_min(5.0, 100.0));
assert_eq!(100.0, adjust_min(500.0, 100.0));
} | rust_cleaned_test_functions.jsonl/80583 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 111
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44153,
7260,
368,
341,
286,
2060,
10714,
10297,
15,
13,
15,
11,
7500,
7260,
7,
15,
13,
15,
11,
220,
16,
15,
15,
13,
15,
1106,
286,
2060,
10714,
10297,
20,
13,
15,
11,
7500,
7260,
7,
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_request() {
use helix::*;
let req = BlockUserRequest::builder()
.target_user_id("41245071".to_string())
.build();
dbg!(req.create_request(EmptyBody, "token", "clientid").unwrap());
// From twitch docs
let data = br#""#.to_vec();
let http_response = http::Response::builder().status(204).body(data).unwrap();
// FIXME: I have not tested this in production
let uri = req.get_uri().unwrap();
assert_eq!(
uri.to_string(),
"https://api.twitch.tv/helix/users/blocks?target_user_id=41245071"
);
dbg!(BlockUserRequest::parse_response(&uri, http_response).unwrap());
} | rust_cleaned_test_functions.jsonl/72305 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 275
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7893,
368,
341,
262,
990,
11338,
941,
56162,
262,
1077,
4232,
284,
8362,
1474,
1900,
486,
17850,
741,
286,
659,
5657,
3317,
842,
445,
19,
16,
17,
19,
20,
15,
22,
16,
3263,
983,
3904,
2398,
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_extend() {
let mut target = Context::new();
target.add("a", &1);
target.add("b", &2);
let mut source = Context::new();
source.add("b", &3);
source.add("c", &4);
target.extend(source);
assert_eq!(*target.data.get("a").unwrap(), to_value(1).unwrap());
assert_eq!(*target.data.get("b").unwrap(), to_value(3).unwrap());
assert_eq!(*target.data.get("c").unwrap(), to_value(4).unwrap());
} | rust_cleaned_test_functions.jsonl/83685 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 237
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70265,
368,
341,
286,
1077,
5206,
2169,
284,
9608,
486,
931,
543,
286,
2169,
1364,
445,
64,
497,
609,
16,
317,
286,
2169,
1364,
445,
65,
497,
609,
17,
317,
286,
1077,
5206,
2530,
284,
9608,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_split_messages_packet_size() {
// Test that if a value is smaller than payload size but too large to be wrapped in a vec
// that it is still dropped
let payload: Vec<CrdsValue> = vec![];
let vec_size = serialized_size(&payload).unwrap();
let desired_size = MAX_PROTOCOL_PAYLOAD_SIZE - vec_size;
let mut value = CrdsValue::new_unsigned(CrdsData::SnapshotHashes(SnapshotHash {
from: Pubkey::default(),
hashes: vec![],
wallclock: 0,
}));
let mut i = 0;
while value.size() <= desired_size {
value.data = CrdsData::SnapshotHashes(SnapshotHash {
from: Pubkey::default(),
hashes: vec![(0, Hash::default()); i],
wallclock: 0,
});
i += 1;
}
let split = ClusterInfo::split_gossip_messages(vec![value]);
assert_eq!(split.len(), 0);
} | rust_cleaned_test_functions.jsonl/28073 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 466
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17052,
23428,
21078,
2368,
368,
341,
286,
442,
3393,
429,
421,
264,
897,
374,
9155,
1091,
7729,
1379,
714,
2238,
3460,
311,
387,
19472,
304,
264,
7486,
198,
286,
442,
429,
432,
374,
2058,
12226,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_intersection_size_hint() {
let x: BTreeSet<i32> = [3, 4].iter().copied().collect();
let y: BTreeSet<i32> = [1, 2, 3].iter().copied().collect();
let mut iter = x.intersection(&y);
assert_eq!(iter.size_hint(), (1, Some(1)));
assert_eq!(iter.next(), Some(&3));
assert_eq!(iter.size_hint(), (0, Some(0)));
assert_eq!(iter.next(), None);
iter = y.intersection(&y);
assert_eq!(iter.size_hint(), (0, Some(3)));
assert_eq!(iter.next(), Some(&1));
assert_eq!(iter.size_hint(), (0, Some(2)));
} | rust_cleaned_test_functions.jsonl/12205 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 254
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82558,
2368,
45825,
368,
341,
262,
1077,
856,
25,
425,
6533,
1649,
21897,
18,
17,
29,
284,
508,
18,
11,
220,
19,
936,
2015,
1005,
37728,
1122,
1005,
17384,
543,
262,
1077,
379,
25,
425,
6533,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_emit_complex() {
let s = r#"
cataloge:
product: &coffee { name: Coffee, price: 2.5 , unit: 1l }
product: &cookies { name: Cookies!, price: 3.40 , unit: 400g}
products:
*coffee:
amount: 4
*cookies:
amount: 4
[1,2,3,4]:
array key
2.4:
real key
true:
bool key
{}:
empty hash key
"#;
let docs = yaml_load_from_str(&s).unwrap();
let doc = &docs[0];
let mut writer = String::new();
yaml_dump(&mut writer, doc).unwrap();
let docs_new = match yaml_load_from_str(&writer) {
Ok(y) => y,
Err(e) => panic!(format!("{}", e)),
};
let doc_new = &docs_new[0];
assert_eq!(doc, doc_new);
} | rust_cleaned_test_functions.jsonl/1239 | {
"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,
69082,
41522,
368,
341,
286,
1077,
274,
284,
435,
2,
698,
26539,
68,
510,
220,
1985,
25,
609,
78117,
256,
314,
829,
25,
26079,
11,
262,
3349,
25,
220,
17,
13,
20,
220,
1154,
220,
4982,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_get() {
let (process, port) = named_process();
let socket = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), port);
let conn = UdpClientConnection::new(socket).unwrap();
let client = SyncClient::new(conn);
let name = Name::from_str("www.example.com.").unwrap();
let result = client
.query(&name, DNSClass::IN, RecordType::A)
.expect("query failed");
assert_eq!(result.response_code(), ResponseCode::NoError);
assert_eq!(result.answers().len(), 1);
assert_eq!(result.answers()[0].rr_type(), RecordType::A);
let rdata = result.answers()[0].rdata();
if let RData::A(address) = rdata {
assert_eq!(address, &Ipv4Addr::new(127, 0, 0, 1));
} else {
panic!("RData::A wasn't here");
}
} | rust_cleaned_test_functions.jsonl/96282 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 344
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
368,
341,
262,
1077,
320,
4630,
11,
2635,
8,
284,
6941,
11305,
543,
262,
1077,
7575,
284,
20954,
13986,
486,
931,
8972,
79,
13986,
486,
53,
19,
8972,
30168,
19,
13986,
486,
931,
7,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_ser_de() {
let string = ArrayString::<[u8; 9]>::from("1234 abcd")
.expect("expected exact specified capacity to be enough");
assert_tokens(&string, &[
Token::Str("1234 abcd"),
]);
} | rust_cleaned_test_functions.jsonl/67024 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 127
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
75861,
2259,
368,
341,
286,
1077,
914,
284,
2910,
703,
27638,
58,
84,
23,
26,
220,
24,
60,
6831,
1499,
445,
16,
17,
18,
19,
668,
4385,
1138,
310,
659,
17119,
445,
7325,
4734,
5189,
8654,
311... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_inbound_substream() {
let mut rt = Runtime::new().unwrap();
let (_ds_requests_tx, mut ds_notifs_rx, mut peer_mgr_notifs_tx, _peer_mgr_reqs_rx) =
start_direct_send_actor(rt.handle().clone());
let peer_id = PeerId::random();
let (dialer_substream, listener_substream) = MemorySocket::new_pair();
// The dialer sends two messages to the listener.
let f_substream = async move {
let mut dialer_substream =
Framed::new(IoCompat::new(dialer_substream), LengthDelimitedCodec::new());
dialer_substream
.send(Bytes::from_static(MESSAGE_1))
.await
.unwrap();
dialer_substream
.send(Bytes::from_static(MESSAGE_2))
.await
.unwrap();
};
// Fake the listener NetworkProvider to notify DirectSend of the inbound substream.
let f_network_provider = async move {
peer_mgr_notifs_tx
.send(PeerManagerNotification::NewInboundSubstream(
peer_id,
NegotiatedSubstream {
protocol: ProtocolId::from_static(&PROTOCOL_1[..]),
substream: listener_substream,
},
))
.await
.unwrap();
// The listener should receive these two messages
expect_network_provider_recv_message(&mut ds_notifs_rx, peer_id, PROTOCOL_1, MESSAGE_1)
.await;
expect_network_provider_recv_message(&mut ds_notifs_rx, peer_id, PROTOCOL_1, MESSAGE_2)
.await;
};
rt.spawn(f_substream);
rt.block_on(f_network_provider);
} | rust_cleaned_test_functions.jsonl/13361 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 807
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
10891,
5228,
4027,
368,
341,
262,
1077,
5206,
16677,
284,
10954,
486,
931,
1005,
15454,
1428,
262,
1077,
5453,
5356,
37216,
17805,
11,
5206,
11472,
7913,
21835,
24330,
11,
5206,
14397,
42438,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_mux_command_invalid_command_type() {
let buf = [
0b11111101,
0b00000001,
];
assert_matches!(
MuxCommand::decode(&buf[..]),
Err(FrameParseError::UnsupportedMuxCommandType(0b111111))
);
} | rust_cleaned_test_functions.jsonl/107769 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 170
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
80363,
10811,
31433,
10811,
1819,
368,
341,
286,
1077,
6607,
284,
2278,
310,
220,
15,
65,
16,
16,
16,
16,
16,
16,
15,
16,
11,
715,
310,
220,
15,
65,
15,
15,
15,
15,
15,
15,
15,
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_additional_condition_left_join() {
let expected_sql =
"SELECT `users`.* FROM `users` LEFT JOIN `posts` ON (`users`.`id` = `posts`.`user_id` AND `posts`.`published` = ?)";
let query = Select::from_table("users").left_join(
"posts".on(("users", "id")
.equals(Column::from(("posts", "user_id")))
.and(("posts", "published").equals(true))),
);
let (sql, params) = Sqlite::build(query).unwrap();
assert_eq!(expected_sql, sql);
assert_eq!(default_params(vec![Value::boolean(true),]), params);
} | rust_cleaned_test_functions.jsonl/52920 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 292
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
81742,
27656,
9579,
31017,
368,
341,
286,
1077,
3601,
18063,
4035,
310,
330,
4858,
1565,
4218,
63,
4908,
4295,
1565,
4218,
63,
21920,
13069,
1565,
12664,
63,
6197,
28654,
4218,
28905,
307,
63,
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_variants() {
serde_test::assert_tokens(&WebhookType::Incoming, &[Token::U8(1)]);
serde_test::assert_tokens(&WebhookType::ChannelFollower, &[Token::U8(2)]);
} | rust_cleaned_test_functions.jsonl/84082 | {
"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,
4612,
62278,
368,
341,
286,
61570,
4452,
486,
2207,
28838,
2099,
5981,
20873,
929,
486,
97564,
11,
44590,
3323,
486,
52,
23,
7,
16,
41958,
286,
61570,
4452,
486,
2207,
28838,
2099,
5981,
20873,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_high_level_sonic_api() {
use pairing::bn256::{Bn256};
use std::time::{Instant};
use bellman::sonic::helped::{
generate_random_parameters,
verify_aggregate,
verify_proofs,
create_proof,
create_advice,
create_aggregate,
get_circuit_parameters
};
{
let mut rng = &mut thread_rng();
// Generate the MiMC round constants
let constants = (0..MIMC_ROUNDS).map(|_| rng.gen()).collect::<Vec<_>>();
let samples: usize = 100;
let xl = rng.gen();
let xr = rng.gen();
let image = mimc::<Bn256>(xl, xr, &constants);
// Create an instance of our circuit (with the
// witness)
let circuit = MiMCDemo {
xl: Some(xl),
xr: Some(xr),
constants: &constants
};
let info = get_circuit_parameters::<Bn256, _>(circuit.clone()).expect("Must get circuit info");
println!("{:?}", info);
let params = generate_random_parameters(circuit.clone(), &mut rng).unwrap();
println!("creating proof");
let start = Instant::now();
let proof = create_proof(circuit.clone(), ¶ms).unwrap();
println!("done in {:?}", start.elapsed());
println!("creating advice");
let start = Instant::now();
let advice = create_advice(circuit.clone(), &proof, ¶ms).unwrap();
println!("done in {:?}", start.elapsed());
println!("creating aggregate for {} proofs", samples);
let start = Instant::now();
let proofs: Vec<_> = (0..samples).map(|_| (proof.clone(), advice.clone())).collect();
let aggregate = create_aggregate::<Bn256, _>(circuit.clone(), &proofs, ¶ms);
println!("done in {:?}", start.elapsed());
{
println!("verifying 1 proof without advice");
let rng = thread_rng();
let start = Instant::now();
assert_eq!(verify_proofs(&vec![proof.clone()], &vec![vec![image.clone()]], circuit.clone(), rng, ¶ms).unwrap(), true);
println!("done in {:?}", start.elapsed());
}
{
println!("verifying {} proofs without advice", samples);
let rng = thread_rng();
let start = Instant::now();
assert_eq!(verify_proofs(&vec![proof.clone(); 100], &vec![vec![image.clone()]; 100], circuit.clone(), rng, ¶ms).unwrap(), true);
println!("done in {:?}", start.elapsed());
}
{
println!("verifying 100 proofs with advice and aggregate");
let rng = thread_rng();
let start = Instant::now();
assert_eq!(verify_aggregate(&vec![(proof.clone(), advice.clone()); 100], &aggregate, &vec![vec![image.clone()]; 100], circuit.clone(), rng, ¶ms).unwrap(), true);
println!("done in {:?}", start.elapsed());
}
}
} | rust_cleaned_test_functions.jsonl/61337 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1367
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22680,
8274,
643,
14011,
11697,
368,
341,
262,
990,
47713,
486,
11081,
17,
20,
21,
22964,
33,
77,
17,
20,
21,
2440,
262,
990,
1460,
486,
1678,
22964,
30340,
2440,
262,
990,
28419,
1515,
486,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_matrix_inverse() {
let matrix: Matrix2x2<f64> = Matrix2x2::new(
5_f64, 1_f64,
1_f64, 5_f64
);
let expected: Matrix2x2<f64> = (1_f64 / 24_f64) * Matrix2x2::new(
5_f64, -1_f64,
-1_f64, 5_f64
);
let result = matrix.inverse().unwrap();
let epsilon = 1e-7;
assert!(relative_eq!(result, expected, epsilon = epsilon));
} | rust_cleaned_test_functions.jsonl/128971 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 266
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10193,
63333,
368,
341,
286,
1077,
6172,
25,
11631,
17,
87,
17,
63895,
21,
19,
29,
284,
11631,
17,
87,
17,
486,
931,
1006,
310,
220,
20,
761,
21,
19,
11,
220,
16,
761,
21,
19,
11,
715,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_feedback() {
assert_eq!(
signal_feedback(
&[
3, 26, 1001, 26, -4, 26, 3, 27, 1002, 27, 2, 27, 1, 27, 26, 27, 4, 27, 1001,
28, -1, 28, 1005, 28, 6, 99, 0, 0, 5
],
&[9, 8, 7, 6, 5]
),
139629729
);
assert_eq!(
signal_feedback(
&[
3, 52, 1001, 52, -5, 52, 3, 53, 1, 52, 56, 54, 1007, 54, 5, 55, 1005, 55, 26,
1001, 54, -5, 54, 1105, 1, 12, 1, 53, 54, 53, 1008, 54, 0, 55, 1001, 55, 1, 55,
2, 53, 55, 53, 4, 53, 1001, 56, -1, 56, 1005, 56, 6, 99, 0, 0, 0, 0, 10
],
&[9, 7, 8, 5, 6]
),
18216
);
} | rust_cleaned_test_functions.jsonl/100799 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 571
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58138,
368,
341,
286,
2060,
10714,
33673,
310,
8286,
58138,
1006,
394,
609,
9640,
503,
220,
18,
11,
220,
17,
21,
11,
220,
16,
15,
15,
16,
11,
220,
17,
21,
11,
481,
19,
11,
220,
17,
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... | 1 |
#[test]
fn test_uint32_shr() {
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
for _ in 0..50 {
for i in 0..60 {
let num = rng.gen();
let a = UInt32::constant(num).shr(i);
let b = UInt32::constant(num >> i);
assert_eq!(a.value.unwrap(), num >> i);
assert_eq!(a.bits.len(), b.bits.len());
for (a, b) in a.bits.iter().zip(b.bits.iter()) {
assert_eq!(a.get_value().unwrap(), b.get_value().unwrap());
}
}
}
} | rust_cleaned_test_functions.jsonl/28530 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 383
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15807,
18,
17,
3712,
81,
368,
341,
286,
1077,
5206,
28422,
284,
1599,
269,
24841,
49,
968,
486,
1499,
33809,
2561,
15,
87,
20,
83406,
21,
17,
20,
24,
11,
220,
15,
87,
23,
67,
18,
16,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 4 |
#[test]
fn test_iterations_with_second_partial_page() {
// Create an iterator that just return a page of 2 elements
// even if we requested a page of 10 elements.
let it: PageIterator<u64, u64> = PageIterator::new(
Box::new(|key, limit| {
let range_start = key.unwrap_or(0);
let range_end = if range_start == 0 {
range_start + limit
} else {
range_start + 2
};
Ok(Page {
items: (range_start..range_end).collect(),
next_page_key: if range_start == 0 {
Some(range_end)
} else {
None
},
})
}),
10,
);
let mut total_count = 0;
for element in it {
element.unwrap();
total_count += 1;
}
// We should have 12 elements
assert_eq!(12, total_count);
} | rust_cleaned_test_functions.jsonl/114318 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 607
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55607,
6615,
29644,
52068,
6129,
368,
341,
286,
442,
4230,
458,
15091,
429,
1101,
470,
264,
2150,
315,
220,
17,
5424,
198,
286,
442,
1496,
421,
582,
11223,
264,
2150,
315,
220,
16,
15,
5424,
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... | 4 |
#[test]
fn test_three_of_a_kind_ranks() {
test(
&vec!["2S 2H 2C 8D JH", "4S AH AS 8C AD"],
&vec!["4S AH AS 8C AD"],
)
} | rust_cleaned_test_functions.jsonl/121269 | {
"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,
50016,
3575,
4306,
33162,
1710,
4039,
368,
341,
1066,
262,
1273,
1006,
286,
609,
4083,
0,
1183,
17,
50,
220,
17,
39,
220,
17,
34,
220,
23,
35,
619,
39,
497,
330,
19,
50,
47288,
5752,
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_from_u16_for_value() {
assert_eq!(Value::from(u16::MIN), Value::UInt8(0));
assert_eq!(Value::from(255u16), Value::UInt8(255));
assert_eq!(Value::from(256u16), Value::UInt16(256));
assert_eq!(Value::from(u16::MAX), Value::UInt16(u16::MAX));
} | rust_cleaned_test_functions.jsonl/93905 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 150
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
7300,
16,
21,
5478,
3142,
368,
341,
286,
2060,
10714,
10297,
1130,
486,
1499,
8154,
16,
21,
486,
16413,
701,
5162,
486,
18777,
23,
7,
15,
1106,
286,
2060,
10714,
10297,
1130,
486,
1499,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_legal_moves_banmen_with_kyou_nari_7_squares_and_contiguous_opponent_gote() {
test_legal_moves_banmen_with_kin_7_squares_and_contiguous_opponent_gote_impl(GKyouN)
} | rust_cleaned_test_functions.jsonl/81283 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 90
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82324,
45390,
880,
276,
5676,
6615,
4698,
9330,
1089,
2780,
62,
22,
643,
40856,
8378,
10260,
27029,
10287,
1146,
1889,
1272,
368,
972,
18185,
82324,
45390,
880,
276,
5676,
6615,
4698,
258,
62,
22,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_polar_conv() {
fn test(c: Complex64) {
let (r, theta) = c.to_polar();
assert!((c - Complex::from_polar(r, theta)).norm() < 1e-6);
}
for &c in all_consts.iter() {
test(c);
}
} | rust_cleaned_test_functions.jsonl/105678 | {
"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,
620,
7417,
22716,
368,
341,
310,
5168,
1273,
1337,
25,
22096,
21,
19,
8,
341,
394,
1077,
320,
81,
11,
18526,
8,
284,
272,
2389,
620,
7417,
543,
394,
2060,
0,
1188,
66,
481,
22096,
486,
1499,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_more() {
let cx = mk_ctxt();
let fnia = FakeNodeIdAssigner;
let lcx = LoweringContext::new(&fnia, None);
roundtrip(lower_item(&lcx, "e_item!(&cx,
fn foo(x: usize, y: usize) -> usize {
let z = x + y;
return z;
}
).unwrap()));
} | rust_cleaned_test_functions.jsonl/37636 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 166
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36664,
368,
341,
262,
1077,
20716,
284,
23789,
93285,
543,
262,
1077,
5168,
685,
284,
36965,
79206,
28933,
261,
280,
262,
1077,
326,
25844,
284,
27536,
287,
1972,
486,
931,
2099,
8822,
685,
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_sign_data() -> Result<(), Box<dyn Error>> {
let credential = get_credential();
let mut threads = Vec::new();
{
let credential = credential.clone();
threads.push(thread::spawn(move || {
assert_eq!(
credential.sign_with_data(b"hello"),
"abcdefghklmnopq:BZYt5uVRy1RVt5ZTXbaIt2ROVMA=:aGVsbG8="
);
assert_eq!(
credential.sign_with_data(b"world"),
"abcdefghklmnopq:Wpe04qzPphiSZb1u6I0nFn6KpZg=:d29ybGQ="
);
}));
}
{
let credential = credential.clone();
threads.push(thread::spawn(move || {
assert_eq!(
credential.sign_with_data(b"-test"),
"abcdefghklmnopq:HlxenSSP_6BbaYNzx1fyeyw8v1Y=:LXRlc3Q="
);
assert_eq!(
credential.sign_with_data(b"ba#a-"),
"abcdefghklmnopq:kwzeJrFziPDMO4jv3DKVLDyqud0=:YmEjYS0="
);
}));
}
threads.into_iter().for_each(|thread| thread.join().unwrap());
Ok(())
} | rust_cleaned_test_functions.jsonl/84484 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 771
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11172,
1769,
368,
1464,
5714,
68843,
8261,
92846,
4600,
2452,
341,
286,
1077,
40207,
284,
633,
666,
30320,
543,
286,
1077,
5206,
14564,
284,
11312,
486,
931,
543,
286,
341,
310,
1077,
40207,
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... | 3 |
#[test]
fn test_min_max_short() {
let data = [-1.0, 5.0, 0.0, -3.0, 10.0, -0.5, 4.0];
assert_eq!(data.min(), -3.0);
assert_eq!(data.max(), 10.0);
} | rust_cleaned_test_functions.jsonl/55244 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 111
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7260,
6345,
16673,
368,
341,
286,
1077,
821,
284,
10055,
16,
13,
15,
11,
220,
20,
13,
15,
11,
220,
15,
13,
15,
11,
481,
18,
13,
15,
11,
220,
16,
15,
13,
15,
11,
481,
15,
13,
20,
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_find_all_refs_for_param_inside() {
let code = r#"
fn foo(i : u32) -> u32 {
i<|>
}"#;
let refs = get_all_refs(code);
assert_eq!(refs.len(), 2);
} | rust_cleaned_test_functions.jsonl/19267 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
5705,
60638,
5478,
4090,
72860,
368,
341,
262,
1077,
2038,
284,
435,
2,
698,
262,
5168,
15229,
1956,
549,
575,
18,
17,
8,
1464,
575,
18,
17,
341,
286,
600,
27,
91,
397,
262,
335,
5767... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_transaction_payload_with_a_program_canonical_serialization_example() {
let input = TransactionPayload::Script(get_common_program());
let expected_output = vec![
0x02, 0x04, 0x6D, 0x6F, 0x76, 0x65, 0x00, 0x01, 0x01, 0xEF, 0xBE, 0xAD, 0xDE, 0x0D, 0xD0,
0xFE, 0xCA,
];
let actual_output = to_bytes(&input).unwrap();
assert_eq!(expected_output, actual_output);
} | rust_cleaned_test_functions.jsonl/8058 | {
"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,
28884,
32813,
6615,
4306,
25096,
27421,
22391,
25602,
2022,
39304,
368,
341,
262,
1077,
1946,
284,
17869,
29683,
486,
5910,
5433,
21107,
25096,
5231,
262,
1077,
3601,
7645,
284,
7486,
90515,
286,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parse_file() {
let f = r#"
a(1);b(2);c(3);
"#;
let results = parse_rules(0, f).unwrap();
assert_eq!(results[0].to_polar(), r#"a(1);"#);
assert_eq!(results[1].to_polar(), r#"b(2);"#);
assert_eq!(results[2].to_polar(), r#"c(3);"#);
} | rust_cleaned_test_functions.jsonl/12188 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 186
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
2458,
368,
341,
286,
1077,
282,
284,
435,
2,
698,
286,
264,
7,
16,
1215,
65,
7,
17,
1215,
66,
7,
18,
317,
286,
5869,
280,
286,
1077,
3059,
284,
4715,
21407,
7,
15,
11,
282,
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... | 1 |
#[test]
fn test_column_expand() {
check(
r#"
#[rustc_builtin_macro]
macro_rules! column {() => {}}
fn main() { column!(); }
"#,
expect![[r##"
#[rustc_builtin_macro]
macro_rules! column {() => {}}
fn main() { 0; }
"##]],
);
} | rust_cleaned_test_functions.jsonl/59809 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 134
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8744,
67875,
368,
341,
262,
1779,
1006,
286,
435,
2,
698,
13353,
35788,
66,
73829,
58810,
921,
32606,
21407,
0,
3250,
314,
368,
589,
4687,
630,
8822,
1887,
368,
314,
3250,
0,
2129,
456,
57676,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_keccak512_hash_password() {
let password = "password";
let hash = Keccak512Hasher.hash_str((), password).unwrap();
assert_eq!("a6818b8188b36c44d17784c5551f63accc5deaf8786f9d0ad1ae3cd8d887cbab4f777286dbb315fb14854c8774dc0d10b5567e4a705536cc2a1d61ec0a16a7a6", hash.as_hex());
} | rust_cleaned_test_functions.jsonl/101932 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 170
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45476,
84262,
20,
16,
17,
8950,
10122,
368,
341,
286,
1077,
3552,
284,
330,
3833,
3302,
286,
1077,
5175,
284,
6569,
84262,
20,
16,
17,
6370,
261,
15101,
2895,
7,
1507,
3552,
568,
15454,
1428,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_device_source() {
if let Some(device) = test_get_default_device(Scope::Input) {
if let Ok(source) = get_device_source(device, DeviceType::INPUT) {
println!(
"input: {:X}, {:?}",
source,
convert_uint32_into_string(source)
);
} else {
println!("No input data source.");
}
} else {
println!("No input device.");
}
if let Some(device) = test_get_default_device(Scope::Output) {
if let Ok(source) = get_device_source(device, DeviceType::OUTPUT) {
println!(
"output: {:X}, {:?}",
source,
convert_uint32_into_string(source)
);
} else {
println!("No output data source.");
}
} else {
println!("No output device.");
}
} | rust_cleaned_test_functions.jsonl/113808 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 468
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
9204,
10347,
368,
341,
262,
421,
1077,
4329,
17848,
8,
284,
1273,
3062,
9993,
9204,
3759,
2417,
486,
2505,
8,
341,
286,
421,
1077,
7622,
12437,
8,
284,
633,
9204,
10347,
17848,
11,
13903,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_mode() {
let mode = |x: Weibull| x.mode().unwrap();
test_case(1.0, 0.1, 0.0, mode);
test_case(1.0, 1.0, 0.0, mode);
test_case(10.0, 10.0, 9.8951925820621439264623017041980483215553841533709, mode);
test_case(10.0, 1.0, 0.98951925820621439264623017041980483215553841533709, mode);
} | rust_cleaned_test_functions.jsonl/122500 | {
"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,
7302,
368,
341,
286,
1077,
3856,
284,
760,
87,
25,
1205,
579,
617,
91,
856,
22981,
1005,
15454,
543,
286,
1273,
19096,
7,
16,
13,
15,
11,
220,
15,
13,
16,
11,
220,
15,
13,
15,
11,
3856,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_task_create_bad_contract_id() {
let mut context = get_context(accounts(0));
testing_env!(context.build());
let mut contract = Contract::new();
testing_env!(context
.is_view(false)
.attached_deposit(6000000000040000000200)
.predecessor_account_id(accounts(2))
.signer_account_id(accounts(2))
.build());
contract.create_task(
accounts(0),
"tick".to_string(),
"0 0 * * * *".to_string(),
Some(true),
Some(U128::from(0)),
Some(20000000000000),
None,
);
} | rust_cleaned_test_functions.jsonl/42993 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 359
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12184,
8657,
34199,
51499,
842,
368,
341,
286,
1077,
5206,
2266,
284,
633,
8467,
91868,
7,
15,
1106,
286,
7497,
15879,
10297,
2147,
13239,
1423,
286,
1077,
5206,
5116,
284,
19185,
486,
931,
543,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_all_refs_decl_module_on_self_crate_root() {
check(
r#"
//- /lib.rs
use self$0;
"#,
expect![[r#"
Module FileID(0) 0..10
(no references)
"#]],
);
} | rust_cleaned_test_functions.jsonl/92259 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 169
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
5705,
60638,
35814,
10750,
4470,
25637,
666,
7698,
12993,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
61463,
608,
2740,
25638,
198,
810,
656,
3,
15,
280,
57676,
345,
310,
1720,
0,
15505,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ys_to_stdout() {
let output: Vec<_> = String::from("y\n").bytes().cycle().take(1024).collect();
let output = String::from_utf8(output).unwrap();
new_ucmd!()
.args(&["status=none", "if=y-nl-1k.txt"])
.run()
.no_stderr()
.stdout_is(output)
.success();
} | rust_cleaned_test_functions.jsonl/59394 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 164
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
1047,
2346,
67416,
368,
341,
262,
1077,
2550,
25,
11312,
32399,
29,
284,
923,
486,
1499,
445,
88,
1699,
1827,
9651,
1005,
21621,
1005,
22769,
7,
16,
15,
17,
19,
568,
17384,
543,
262,
1077,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_reader_non_ascii_sequence() {
let mut reader = Reader::new(&b">id\nACGTA\xE2\x98\xB9AT\n"[..]);
let mut record = Record::new();
reader.read(&mut record).unwrap();
assert!(
record.check().is_err(),
"check() should return Err if FASTA sequence is not ASCII"
);
} | rust_cleaned_test_functions.jsonl/62824 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 172
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22306,
21637,
50238,
23735,
368,
341,
286,
1077,
5206,
6604,
284,
25166,
486,
931,
2099,
65,
755,
307,
1699,
1706,
38,
15204,
3462,
36,
17,
3462,
24,
23,
3462,
33,
24,
828,
1699,
36864,
496,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_parsing_empty_binary() {
let v = vec![];
let mut c = RetainingConsumer::new();
let p = Parser::new(&v, &mut c);
assert_matches!(p.parse(),
Err(State::HeaderIncomplete(DecodeError::StreamExpected(0))));
} | rust_cleaned_test_functions.jsonl/85730 | {
"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,
620,
28598,
15124,
31761,
368,
341,
286,
1077,
348,
284,
7486,
0,
15078,
286,
1077,
5206,
272,
284,
10392,
2056,
29968,
486,
931,
543,
286,
1077,
281,
284,
21102,
486,
931,
2099,
85,
11,
609,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_agg_trades() {
let text =
BinanceLinearRestClient::fetch_agg_trades("BTCUSDT_211231", None, None, None).unwrap();
assert!(text.starts_with("[{"));
} | rust_cleaned_test_functions.jsonl/95411 | {
"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,
83534,
3547,
3452,
368,
341,
286,
1077,
1467,
4035,
310,
425,
24387,
31898,
12416,
2959,
486,
9641,
83534,
3547,
3452,
445,
59118,
2034,
10599,
62,
17,
16,
16,
17,
18,
16,
497,
2240,
11,
2240,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_authorize() {
let authority_address = solana_sdk::pubkey::new_rand();
let authority_address_2 = solana_sdk::pubkey::new_rand();
let stake_address = solana_sdk::pubkey::new_rand();
let stake_lamports = 42;
let stake_account = AccountSharedData::new_data_with_space(
stake_lamports,
&StakeState::default(),
StakeState::size_of(),
&id(),
)
.unwrap();
let to_address = solana_sdk::pubkey::new_rand();
let to_account = AccountSharedData::new(1, 0, &system_program::id());
let mut transaction_accounts = vec![
(stake_address, stake_account),
(to_address, to_account),
(authority_address, AccountSharedData::default()),
(
sysvar::clock::id(),
account::create_account_shared_data_for_test(&Clock::default()),
),
(
sysvar::stake_history::id(),
account::create_account_shared_data_for_test(&StakeHistory::default()),
),
];
let mut instruction_accounts = vec![
AccountMeta {
pubkey: stake_address,
is_signer: true,
is_writable: false,
},
AccountMeta {
pubkey: sysvar::clock::id(),
is_signer: false,
is_writable: false,
},
AccountMeta {
pubkey: authority_address,
is_signer: false,
is_writable: false,
},
];
process_instruction(
&serialize(&StakeInstruction::Authorize(
authority_address,
StakeAuthorize::Staker,
))
.unwrap(),
transaction_accounts.clone(),
instruction_accounts.clone(),
Err(InstructionError::InvalidAccountData),
);
// should pass
let stake_account = AccountSharedData::new_data_with_space(
stake_lamports,
&StakeState::Initialized(Meta::auto(&stake_address)),
StakeState::size_of(),
&id(),
)
.unwrap();
transaction_accounts[0] = (stake_address, stake_account);
let accounts = process_instruction(
&serialize(&StakeInstruction::Authorize(
authority_address,
StakeAuthorize::Staker,
))
.unwrap(),
transaction_accounts.clone(),
instruction_accounts.clone(),
Ok(()),
);
transaction_accounts[0] = (stake_address, accounts[0].clone());
let accounts = process_instruction(
&serialize(&StakeInstruction::Authorize(
authority_address,
StakeAuthorize::Withdrawer,
))
.unwrap(),
transaction_accounts.clone(),
instruction_accounts.clone(),
Ok(()),
);
transaction_accounts[0] = (stake_address, accounts[0].clone());
if let StakeState::Initialized(Meta { authorized, .. }) = from(&accounts[0]).unwrap() {
assert_eq!(authorized.staker, authority_address);
assert_eq!(authorized.withdrawer, authority_address);
} else {
panic!();
}
// A second authorization signed by the stake account should fail
process_instruction(
&serialize(&StakeInstruction::Authorize(
authority_address_2,
StakeAuthorize::Staker,
))
.unwrap(),
transaction_accounts.clone(),
instruction_accounts.clone(),
Err(InstructionError::MissingRequiredSignature),
);
// Test a second authorization by the new authority_address
instruction_accounts[0].is_signer = false;
instruction_accounts[2].is_signer = true;
let accounts = process_instruction(
&serialize(&StakeInstruction::Authorize(
authority_address_2,
StakeAuthorize::Staker,
))
.unwrap(),
transaction_accounts.clone(),
instruction_accounts.clone(),
Ok(()),
);
if let StakeState::Initialized(Meta { authorized, .. }) = from(&accounts[0]).unwrap() {
assert_eq!(authorized.staker, authority_address_2);
} else {
panic!();
}
// Test a successful action by the currently authorized withdrawer
let mut instruction_accounts = vec![
AccountMeta {
pubkey: stake_address,
is_signer: false,
is_writable: false,
},
AccountMeta {
pubkey: to_address,
is_signer: false,
is_writable: false,
},
AccountMeta {
pubkey: sysvar::clock::id(),
is_signer: false,
is_writable: false,
},
AccountMeta {
pubkey: sysvar::stake_history::id(),
is_signer: false,
is_writable: false,
},
AccountMeta {
pubkey: authority_address,
is_signer: true,
is_writable: false,
},
];
let accounts = process_instruction(
&serialize(&StakeInstruction::Withdraw(stake_lamports)).unwrap(),
transaction_accounts.clone(),
instruction_accounts.clone(),
Ok(()),
);
assert_eq!(from(&accounts[0]).unwrap(), StakeState::Uninitialized);
// Test that withdrawal to account fails without authorized withdrawer
instruction_accounts[4].is_signer = false;
process_instruction(
&serialize(&StakeInstruction::Withdraw(stake_lamports)).unwrap(),
transaction_accounts,
instruction_accounts,
Err(InstructionError::MissingRequiredSignature),
);
} | rust_cleaned_test_functions.jsonl/31635 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 3141
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22938,
551,
368,
341,
286,
1077,
11198,
6744,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
33864,
543,
286,
1077,
11198,
6744,
62,
17,
284,
2048,
3362,
61783,
486,
9585,
792,
486,
931,
3386... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_all_tabs_should_advance_to_next_tab_stops() {
new_ucmd!()
.args(&["-w16", "tab_stops.input"])
.succeeds()
.stdout_is_fixture("tab_stops_w16.expected");
} | rust_cleaned_test_functions.jsonl/23278 | {
"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,
5705,
57953,
43378,
98093,
2346,
11257,
17344,
1261,
3721,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
12,
86,
16,
21,
497,
330,
6192,
1261,
3721,
10046,
14108,
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 |
#[test]
fn test_imported() {
let import = imported("package:http/http.dart");
let import2 = imported("package:http/http.dart");
let import_alias = imported("package:http/http.dart").alias("h2");
let import_relative = imported("../http.dart");
let toks = toks![
import.name("a"),
import2.name("b"),
import_alias.name("c"),
import_relative.name("d"),
].join_spacing();
let expected = vec![
"import \"../http.dart\";",
"import \"package:http/http.dart\";",
"import \"package:http/http.dart\" as h2;",
"",
"a b h2.c d",
"",
];
assert_eq!(
Ok(expected.join("\n").as_str()),
toks.to_file().as_ref().map(|s| s.as_str())
);
} | rust_cleaned_test_functions.jsonl/33191 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 457
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18434,
291,
368,
341,
286,
1077,
1159,
284,
24928,
445,
1722,
69459,
15627,
6800,
797,
286,
1077,
1159,
17,
284,
24928,
445,
1722,
69459,
15627,
6800,
797,
286,
1077,
1159,
35947,
284,
24928,
445,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create_new_ledger() {
let mint_total = 1_000_000_000_000;
let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(mint_total);
let (ledger_path, _blockhash) = create_new_tmp_ledger!(&genesis_config);
let ledger = Blockstore::open(&ledger_path).unwrap();
let ticks = create_ticks(genesis_config.ticks_per_slot, 0, genesis_config.hash());
let entries = ledger.get_slot_entries(0, 0).unwrap();
assert_eq!(ticks, entries);
// Destroying database without closing it first is undefined behavior
drop(ledger);
Blockstore::destroy(&ledger_path).expect("Expected successful database destruction");
} | rust_cleaned_test_functions.jsonl/7591 | {
"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,
8657,
5921,
38367,
1389,
368,
341,
286,
1077,
28337,
10784,
284,
220,
16,
62,
15,
15,
15,
62,
15,
15,
15,
62,
15,
15,
15,
62,
15,
15,
15,
280,
286,
1077,
40788,
2648,
1731,
314,
59366,
533... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_text() {
{
assert_eq!(
text().parse("Hello World"),
Ok((Text::new("Hello World".to_string()), ""))
);
}
{
assert_eq!(
text().parse("Hello World<"),
Ok((Text::new("Hello World".to_string()), "<"))
);
}
} | rust_cleaned_test_functions.jsonl/134148 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 231
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
4326,
368,
341,
286,
341,
310,
2060,
10714,
33673,
394,
1467,
1005,
6400,
445,
9707,
4337,
4461,
394,
7622,
1188,
1178,
486,
931,
445,
9707,
4337,
3263,
983,
3904,
11858,
77561,
310,
1439,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_compress_decompress_lorem_round() {
let lorem = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod \
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At \
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, \
no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit \
amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut \
labore et dolore magna aliquyam erat, sed diam voluptua.";
let compressed = match compress(lorem.as_bytes()) {
Ok(c) => c,
Err(err) => panic!("Compression failed with error {:?}", err),
};
match decompress(&compressed, lorem.len()) {
Ok(decompressed) => {
assert_eq!(lorem.len(), decompressed.len());
assert_eq!(lorem.as_bytes(), &decompressed[..]);
}
Err(err) => panic!("Decompression failed with error {:?}", err),
};
} | rust_cleaned_test_functions.jsonl/49845 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 493
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
87845,
2259,
38360,
5560,
1826,
29896,
368,
341,
262,
1077,
92385,
284,
330,
32783,
26342,
23655,
2444,
27212,
11,
390,
746,
31841,
12421,
573,
2388,
287,
655,
21561,
11,
10923,
12757,
2477,
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... | 3 |
#[test]
fn test_product_into_bytes() {
let builder = ProductBuilder::new();
let original = builder
.with_product_id("688955434684".into())
.with_product_namespace(ProductNamespace::GS1)
.with_owner("Target".into())
.with_properties(make_properties())
.build()
.unwrap();
test_from_bytes(original, Product::from_bytes);
} | rust_cleaned_test_functions.jsonl/84857 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 203
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9840,
45514,
12524,
368,
341,
286,
1077,
7363,
284,
5643,
3297,
486,
931,
543,
286,
1077,
4024,
284,
7363,
198,
310,
659,
4197,
9840,
842,
445,
21,
23,
23,
24,
20,
20,
19,
18,
19,
21,
23,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_is_valid_correct() {
let passwords = &[
("1-3 a: abcde", true),
("1-3 b: cdefg", false),
("2-9 c: ccccccccc", false),
];
for &(p, is_valid_correct) in passwords {
assert_eq!(
PasswordEntry::from_str(p).unwrap().is_valid_correct(),
is_valid_correct
);
}
} | rust_cleaned_test_functions.jsonl/111553 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 238
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
8337,
31550,
368,
341,
286,
1077,
33716,
284,
609,
9640,
310,
3489,
16,
12,
18,
264,
25,
39022,
450,
497,
830,
1326,
310,
3489,
16,
12,
18,
293,
25,
272,
750,
70,
497,
895,
1326,
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... | 2 |
#[test]
fn test_backup3() {
let mut t = make_parser();
assert_eq!(t.next().and_then(|n| Some(n.typ)), Some(ItemType::ItemText));
let t0 = t.next().unwrap();
let t1 = t.next().unwrap();
let t2 = t.next().unwrap();
assert_eq!(t0.typ, ItemType::ItemLeftDelim);
assert_eq!(t1.typ, ItemType::ItemSpace);
assert_eq!(t2.typ, ItemType::ItemIf);
t.backup3(t0, t1, t2);
let t0 = t.next().unwrap();
let t1 = t.next().unwrap();
let t2 = t.next().unwrap();
assert_eq!(t0.typ, ItemType::ItemLeftDelim);
assert_eq!(t1.typ, ItemType::ItemSpace);
assert_eq!(t2.typ, ItemType::ItemIf);
assert_eq!(t.last().and_then(|n| Some(n.typ)), Some(ItemType::ItemEOF));
} | rust_cleaned_test_functions.jsonl/8626 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 402
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44710,
18,
368,
341,
286,
1077,
5206,
259,
284,
1281,
18517,
543,
286,
2060,
10714,
10297,
83,
4529,
1005,
437,
68367,
22428,
77,
91,
4329,
1445,
49286,
5731,
4329,
29771,
929,
486,
1234,
1178,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_slice_reader_vectored() {
let in_buf = vec![0, 1, 2, 3, 4, 5, 6, 7];
let reader = &mut &in_buf[..];
let mut buf = [];
assert_eq!(reader.read_vectored(&mut [IoSliceMut::new(&mut buf)]).unwrap(), 0);
let mut buf = [0];
assert_eq!(
reader
.read_vectored(&mut [IoSliceMut::new(&mut []), IoSliceMut::new(&mut buf),])
.unwrap(),
1,
);
assert_eq!(reader.len(), 7);
let b: &[_] = &[0];
assert_eq!(buf, b);
let mut buf1 = [0; 4];
let mut buf2 = [0; 4];
assert_eq!(
reader
.read_vectored(&mut [IoSliceMut::new(&mut buf1), IoSliceMut::new(&mut buf2)],)
.unwrap(),
7,
);
let b1: &[_] = &[1, 2, 3, 4];
let b2: &[_] = &[5, 6, 7];
assert_eq!(buf1, b1);
assert_eq!(&buf2[..3], b2);
assert_eq!(reader.read(&mut buf).unwrap(), 0);
} | rust_cleaned_test_functions.jsonl/78191 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 590
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26488,
22306,
59402,
3018,
368,
341,
286,
1077,
304,
10363,
284,
7486,
20703,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,
11,
220,
22,
935,
286,
1077,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_transaction_byte_offset_constants() {
assert_eq!(SIGNATURE_FRAGMENTS.2 / 3 * 2, SIGNATURE_FRAGMENTS.4);
assert_eq!(EXTRA_DATA_DIGEST.2 / 3 * 2, EXTRA_DATA_DIGEST.4);
assert_eq!(ADDRESS.2 / 3 * 2, ADDRESS.4);
assert_eq!(VALUE.2 / 3 * 2, VALUE.4);
assert_eq!(ISSUANCE_TIMESTAMP.2 / 3 * 2, ISSUANCE_TIMESTAMP.4);
assert_eq!(TIMELOCK_LOWER_BOUND.2 / 3 * 2, TIMELOCK_LOWER_BOUND.4);
assert_eq!(TIMELOCK_UPPER_BOUND.2 / 3 * 2, TIMELOCK_UPPER_BOUND.4);
assert_eq!(BUNDLE_NONCE.2 / 3 * 2, BUNDLE_NONCE.4);
assert_eq!(TRUNK_HASH.2 / 3 * 2, TRUNK_HASH.4);
assert_eq!(BRANCH_HASH.2 / 3 * 2, BRANCH_HASH.4);
assert_eq!(TAG.2 / 3 * 2, TAG.4);
assert_eq!(ATTACHMENT_TIMESTAMP.2 / 3 * 2, ATTACHMENT_TIMESTAMP.4);
assert_eq!(
ATTACHMENT_TIMESTAMP_LOWER_BOUND.2 / 3 * 2,
ATTACHMENT_TIMESTAMP_LOWER_BOUND.4
);
assert_eq!(
ATTACHMENT_TIMESTAMP_UPPER_BOUND.2 / 3 * 2,
ATTACHMENT_TIMESTAMP_UPPER_BOUND.4
);
assert_eq!(NONCE.2 / 3 * 2, NONCE.4);
assert_eq!(REQUEST_HASH.2 / 3 * 2, REQUEST_HASH.4);
} | rust_cleaned_test_functions.jsonl/77256 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 682
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28884,
19737,
6917,
55642,
368,
341,
286,
2060,
10714,
10297,
54072,
14870,
14220,
1890,
28763,
13,
17,
608,
220,
18,
353,
220,
17,
11,
43172,
14870,
14220,
1890,
28763,
13,
19,
317,
286,
2060,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_negated_or() {
new_ucmd!()
.args(&["!", "foo", "-o", "bar"])
.run()
.status_code(1);
new_ucmd!().args(&["foo", "-o", "!", "bar"]).succeeds();
new_ucmd!()
.args(&["!", "foo", "-o", "!", "bar"])
.run()
.status_code(1);
} | rust_cleaned_test_functions.jsonl/10982 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 171
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28209,
657,
8734,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
18789,
330,
7975,
497,
6523,
78,
497,
330,
2257,
14108,
286,
659,
6108,
741,
286,
659,
2829,
4136,
7,
16,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_put() {
let c = Constant {
tpe: SType::SBoolean,
v: ConstantVal::Boolean(true),
};
let mut s = ConstantStore::empty();
s.put(c.clone());
assert!(s.get(0).is_some());
assert_eq!(s.get(0).unwrap().clone(), c);
assert!(!s.get_all().is_empty());
assert_eq!(s.get_all().get(0).unwrap().clone(), c);
} | rust_cleaned_test_functions.jsonl/51337 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 220
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15557,
368,
341,
286,
1077,
272,
284,
19305,
341,
310,
259,
375,
25,
328,
929,
486,
50,
6890,
345,
310,
348,
25,
19305,
2208,
486,
6890,
3715,
1326,
286,
2605,
286,
1077,
5206,
274,
284,
19305... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_zip321_spec_valid_examples() {
let valid_1 = "zcash:ytestsapling1qqqqqqqqqqqqqqqqqrjq05nyfku05msvu49mawhg6kr0wwljahypwyk2h88z6975u563j9k7cxg?amount=1&memo=VGhpcyBpcyBhIHNpbXBsZSBtZW1vLg&message=Thank%20you%20for%20your%20purchase";
let v1r = TransactionRequest::from_uri(&TEST_NETWORK, &valid_1).unwrap();
assert_eq!(
v1r.payments.get(0).map(|p| p.amount),
Some(Amount::from_u64(100000000).unwrap())
);
let valid_2 = "zcash:?address=smJWoGdqixeFEbhhLrU1TrXGA6wYAUoeG1J&amount=123.456&address.1=ytestsapling1qqqqqqqqqqqqqqqqqrjq05nyfku05msvu49mawhg6kr0wwljahypwyk2h88z6975u563j9k7cxg&amount.1=0.789&memo.1=VGhpcyBpcyBhIHVuaWNvZGUgbWVtbyDinKjwn6aE8J-PhvCfjok";
let mut v2r = TransactionRequest::from_uri(&TEST_NETWORK, &valid_2).unwrap();
v2r.normalize(&TEST_NETWORK);
assert_eq!(
v2r.payments.get(0).map(|p| p.amount),
Some(Amount::from_u64(12345600000).unwrap())
);
assert_eq!(
v2r.payments.get(1).map(|p| p.amount),
Some(Amount::from_u64(78900000).unwrap())
);
// valid; amount just less than MAX_MONEY
let valid_3 = "zcash:ytestsapling1qqqqqqqqqqqqqqqqqrjq05nyfku05msvu49mawhg6kr0wwljahypwyk2h88z6975u563j9k7cxg?amount=20999999.99999999";
let v3r = TransactionRequest::from_uri(&TEST_NETWORK, &valid_3).unwrap();
assert_eq!(
v3r.payments.get(0).map(|p| p.amount),
Some(Amount::from_u64(2099999999999999u64).unwrap())
);
// valid; MAX_MONEY
let valid_4 = "zcash:ytestsapling1qqqqqqqqqqqqqqqqqrjq05nyfku05msvu49mawhg6kr0wwljahypwyk2h88z6975u563j9k7cxg?amount=21000000";
let v4r = TransactionRequest::from_uri(&TEST_NETWORK, &valid_4).unwrap();
assert_eq!(
v4r.payments.get(0).map(|p| p.amount),
Some(Amount::from_u64(2100000000000000u64).unwrap())
);
} | rust_cleaned_test_functions.jsonl/81785 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1093
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
42131,
18,
17,
16,
13594,
8337,
45279,
368,
341,
286,
1077,
2697,
62,
16,
284,
330,
34968,
988,
69203,
23841,
391,
2718,
16,
27579,
27579,
27579,
27579,
27579,
27579,
27579,
27579,
23004,
43915,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_components_iter() {
macro_rules! t(
(s: $path:expr, $exp:expr) => (
{
let path = Path::new($path);
let comps = path.components().collect::<Vec<&[u8]>>();
let exp: &[&str] = $exp;
let exps = exp.iter().map(|x| x.as_bytes()).collect::<Vec<&[u8]>>();
assert!(comps == exps, "components: Expected {:?}, found {:?}",
comps, exps);
let comps = path.rev_components().collect::<Vec<&[u8]>>();
let exps = exps.move_iter().rev().collect::<Vec<&[u8]>>();
assert!(comps == exps, "rev_components: Expected {:?}, found {:?}",
comps, exps);
}
);
(v: [$($arg:expr),+], [$([$($exp:expr),*]),*]) => (
{
let path = Path::new(b!($($arg),+));
let comps = path.components().collect::<Vec<&[u8]>>();
let exp: &[&[u8]] = [$(b!($($exp),*)),*];
assert_eq!(comps.as_slice(), exp);
let comps = path.rev_components().collect::<Vec<&[u8]>>();
let exp = exp.rev_iter().map(|&x|x).collect::<Vec<&[u8]>>();
assert_eq!(comps, exp)
}
)
)
t!(v: ["a/b/c"], [["a"], ["b"], ["c"]]);
t!(v: ["/", 0xff, "/a/", 0x80], [[0xff], ["a"], [0x80]]);
t!(v: ["../../foo", 0xcd, "bar"], [[".."], [".."], ["foo", 0xcd, "bar"]]);
t!(s: "a/b/c", ["a", "b", "c"]);
t!(s: "a/b/d", ["a", "b", "d"]);
t!(s: "a/b/cd", ["a", "b", "cd"]);
t!(s: "/a/b/c", ["a", "b", "c"]);
t!(s: "a", ["a"]);
t!(s: "/a", ["a"]);
t!(s: "/", []);
t!(s: ".", ["."]);
t!(s: "..", [".."]);
t!(s: "../..", ["..", ".."]);
t!(s: "../../foo", ["..", "..", "foo"]);
} | rust_cleaned_test_functions.jsonl/105890 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1270
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23258,
11723,
368,
341,
286,
18072,
21407,
0,
259,
1006,
310,
320,
82,
25,
400,
2343,
96011,
11,
400,
4580,
96011,
8,
589,
2399,
394,
341,
503,
1077,
1815,
284,
7933,
486,
931,
699,
2343,
317,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_handle_and_sign_get_publickey() {
ProtocolTester::apply(|mut pt| {
let mut buf = vec![];
PubKeyMsg {
pub_key_ed25519: vec![],
}.encode(&mut buf)
.unwrap();
pt.write_all(&buf).unwrap();
// receive response:
let mut resp_buf = vec![0u8; 1024];
pt.read(&mut resp_buf).unwrap();
let actual_len = extract_actual_len(&resp_buf).unwrap();
let mut resp = vec![0u8; actual_len as usize];
resp.copy_from_slice(&resp_buf[..actual_len as usize]);
let pk_resp = PubKeyMsg::decode(&resp).expect("decoding public key failed");
assert_ne!(pk_resp.pub_key_ed25519.len(), 0);
println!("got public key: {:?}", pk_resp.pub_key_ed25519);
send_poison_pill(&mut pt);
});
} | rust_cleaned_test_functions.jsonl/100206 | {
"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,
10630,
8378,
11172,
3062,
27074,
792,
368,
341,
262,
24572,
58699,
486,
10280,
22428,
6984,
10817,
91,
341,
286,
1077,
5206,
6607,
284,
7486,
0,
40901,
286,
22611,
1592,
6611,
341,
310,
6675,
3097... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
let mut app = App::with_state(10)
.resource("/", |r| r.f(|_| HttpResponse::Ok()))
.finish();
let req =
HttpRequest::default().with_state(Rc::clone(&app.state), app.router.clone());
let resp = app.run(req);
assert_eq!(resp.as_msg().status(), StatusCode::OK);
} | rust_cleaned_test_functions.jsonl/24268 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 184
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4387,
368,
341,
286,
1077,
5206,
906,
284,
1845,
486,
4197,
4387,
7,
16,
15,
340,
310,
659,
9233,
35460,
760,
81,
91,
435,
833,
22428,
35395,
17580,
486,
11578,
12145,
310,
659,
30150,
543,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_macro_helper() {
let mut hbs = Handlebars::new();
hbs.register_helper("lower", Box::new(lower));
hbs.register_helper("upper", Box::new(upper));
hbs.register_helper("hex", Box::new(hex));
let data = json!("Teixeira");
assert_eq!(
hbs.render_template("{{lower this}}", &data).unwrap(),
"teixeira"
);
assert_eq!(
hbs.render_template("{{upper this}}", &data).unwrap(),
"TEIXEIRA"
);
assert_eq!(hbs.render_template("{{hex 16}}", &()).unwrap(), "0x10");
} | rust_cleaned_test_functions.jsonl/59644 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 253
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58810,
10418,
368,
341,
262,
1077,
5206,
305,
1279,
284,
13760,
24950,
486,
931,
1428,
262,
305,
1279,
9929,
10418,
445,
14772,
497,
8261,
486,
931,
71064,
1106,
262,
305,
1279,
9929,
10418,
445,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_all_refs_macro_def() {
check(
r#"
#[macro_export]
macro_rules! m1<|> { () => (()) }
fn foo() {
m1();
m1();
}
"#,
expect![[r#"
m1 Macro FileId(0) 0..46 29..31 Other
FileId(0) 63..65 StructLiteral
FileId(0) 73..75 StructLiteral
"#]],
);
} | rust_cleaned_test_functions.jsonl/47780 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 237
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
5705,
60638,
58810,
7844,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
13353,
32606,
27114,
921,
32606,
21407,
0,
296,
16,
27,
91,
29,
314,
1719,
589,
320,
2140,
555,
8822,
15229,
368,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_duration_any_value() {
let test_cases = vec![
(vec![], None),
(
vec![Duration::from_millis(10, 0).unwrap()],
Some(Duration::from_millis(10, 0).unwrap()),
),
(
vec![
Duration::from_millis(10, 0).unwrap(),
Duration::from_millis(11, 0).unwrap(),
],
Some(Duration::from_millis(10, 0).unwrap()),
),
(
vec![
Duration::from_millis(10, 0).unwrap(),
Duration::from_millis(11, 0).unwrap(),
Duration::from_millis(12, 0).unwrap(),
],
Some(Duration::from_millis(10, 0).unwrap()),
),
];
for (args, expect_output) in test_cases {
let output = RpnFnScalarEvaluator::new()
.push_params(args)
.evaluate::<Duration>(ScalarFuncSig::DurationAnyValue)
.unwrap();
assert_eq!(output, expect_output);
}
} | rust_cleaned_test_functions.jsonl/59405 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 682
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
25454,
37248,
3142,
368,
341,
286,
1077,
1273,
41427,
284,
7486,
90515,
310,
320,
4083,
0,
12995,
2240,
1326,
310,
2399,
394,
7486,
20703,
12945,
486,
1499,
717,
56212,
7,
16,
15,
11,
220,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_transcribes_all_dna_to_rna() {
assert_eq!(Ok(dna::RNA::new("UGCACCAGAAUU")), dna::DNA::new("ACGTGGTCTTAA").to_rna())
} | rust_cleaned_test_functions.jsonl/107200 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 76
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7965,
55136,
5705,
814,
3376,
2346,
1710,
3376,
368,
341,
262,
2060,
10714,
10297,
11578,
1500,
3376,
486,
30720,
486,
931,
445,
60902,
29442,
1890,
6029,
86564,
35674,
75334,
486,
55320,
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 |
#[test]
fn test_large_num_coding() {
solana_logger::setup();
let slot = 1;
let (_data_shreds, mut coding_shreds, leader_schedule_cache) =
setup_erasure_shreds(slot, 0, 100);
let blockstore_path = get_tmp_ledger_path!();
{
let blockstore = Blockstore::open(&blockstore_path).unwrap();
coding_shreds[1].coding_header.num_coding_shreds = u16::MAX;
blockstore
.insert_shreds(
vec![coding_shreds[1].clone()],
Some(&leader_schedule_cache),
false,
)
.unwrap();
// Check no coding shreds are inserted
let res = blockstore.get_coding_shreds_for_slot(slot, 0).unwrap();
assert!(res.is_empty());
}
Blockstore::destroy(&blockstore_path).expect("Expected successful database destruction");
} | rust_cleaned_test_functions.jsonl/7636 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 490
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45228,
4273,
666,
3700,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
9446,
284,
220,
16,
280,
286,
1077,
5453,
691,
3712,
53369,
11,
5206,
10822,
3712,
53369,
11,
7653,
34530,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_eu4_ita1() {
let data = utils::request("ita1.eu4");
let (save, encoding) = Eu4Extractor::extract_save(Cursor::new(&data[..])).unwrap();
assert_eq!(encoding, Encoding::BinZip);
assert_eq!(save.meta.player, "ITA".parse().unwrap());
let settings = &save.game.gameplay_settings.options;
assert_eq!(settings.difficulty, GameDifficulty::Normal);
assert_eq!(
settings.tax_manpower_modifier,
TaxManpowerModifier::Historical
);
let all_dlc_recognized = save
.meta
.dlc_enabled
.iter()
.map(|x| eu4save::dlc_id(x.as_str()))
.all(|x| x.is_some());
assert!(all_dlc_recognized);
let query = Query::from_save(save);
let province_owners = query.province_owners();
let nation_events = query.nation_events(&province_owners);
let histories = query.player_histories(&nation_events);
assert_eq!(
query.starting_country(&histories),
Some("LAN".parse().unwrap())
);
assert_eq!(
query
.players()
.iter()
.map(|x| x.name.as_str())
.collect::<Vec<_>>(),
vec!["comagoosie"]
);
} | rust_cleaned_test_functions.jsonl/97710 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 554
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2204,
84,
19,
62,
6255,
16,
368,
341,
262,
1077,
821,
284,
12439,
486,
2035,
445,
6255,
16,
35003,
19,
797,
262,
1077,
320,
6628,
11,
11170,
8,
284,
21963,
19,
56118,
486,
23493,
15376,
3025,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_barrier() {
enter_runtime_call(|| {
const N: usize = 10;
let barrier = Arc::new(Barrier::new(N));
let tasks: Vec<_> = (0..N - 1)
.map(|_| {
let b = barrier.clone();
Task::new(move || b.wait().is_leader(), &[])
})
.collect();
// all tasks should be waiting for the barrier.
assert!(tasks
.iter()
.all(|t| t.poll() == TaskCompletionStatus::Pending));
let mut leader_found = barrier.wait().is_leader();
// one task should be the leader.
for task in tasks {
if task.join().unwrap() {
assert!(!leader_found);
leader_found = true
}
}
assert!(leader_found)
})
} | rust_cleaned_test_functions.jsonl/128025 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 431
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82355,
368,
341,
262,
3725,
33232,
13429,
79453,
341,
286,
733,
451,
25,
22301,
284,
220,
16,
15,
401,
286,
1077,
22103,
284,
19689,
486,
931,
7,
33038,
486,
931,
8204,
3237,
286,
1077,
9079,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_qualify_path_nested() {
check_assist(
add_missing_impl_members,
r#"
mod foo {
pub struct Bar<T>;
pub struct Baz;
trait Foo { fn foo(&self, bar: Bar<Baz>); }
}
struct S;
impl foo::Foo for S { <|> }"#,
r#"
mod foo {
pub struct Bar<T>;
pub struct Baz;
trait Foo { fn foo(&self, bar: Bar<Baz>); }
}
struct S;
impl foo::Foo for S {
fn foo(&self, bar: foo::Bar<foo::Baz>) {
${0:todo!()}
}
}"#,
);
} | rust_cleaned_test_functions.jsonl/110448 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 271
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
64391,
1437,
2638,
66279,
368,
341,
286,
1779,
12083,
380,
1006,
310,
912,
40447,
21007,
30397,
345,
310,
435,
2,
698,
2593,
15229,
341,
262,
6675,
2036,
4716,
3125,
10133,
262,
6675,
2036,
91711,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_transpile_tsx() {
let specifier =
ModuleSpecifier::parse("https://deno.land/x/mod.ts").unwrap();
let source = r#"
export class A {
render() {
return <div><span></span></div>
}
}
"#;
let module = parse_module(ParseParams {
specifier: specifier.as_str().to_string(),
source: SourceTextInfo::from_string(source.to_string()),
media_type: MediaType::Tsx,
capture_tokens: false,
maybe_syntax: None,
scope_analysis: true, // ensure scope analysis doesn't conflict with a second resolver pass
})
.unwrap();
let transpiled_source = module.transpile(&EmitOptions::default()).unwrap();
assert!(transpiled_source
.text
.contains("React.createElement(\"div\", null"));
} | rust_cleaned_test_functions.jsonl/133955 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 333
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7965,
12192,
25023,
87,
368,
341,
262,
1077,
97616,
4035,
414,
13711,
87297,
486,
6400,
445,
2428,
1110,
5183,
78,
87627,
10776,
38479,
21288,
1827,
15454,
543,
262,
1077,
2530,
284,
435,
2,
698,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_ban_time() {
let mut score = RealScore::default();
let now = Instant::now();
let change = MIN_SCORE_BEFORE_BAN;
score.test_add(change);
assert_eq!(score.score(), MIN_SCORE_BEFORE_BAN);
score.update_at(now + BANNED_BEFORE_DECAY);
assert_eq!(score.score(), MIN_SCORE_BEFORE_BAN);
score.update_at(now + BANNED_BEFORE_DECAY + Duration::from_secs(1));
assert!(score.score() > MIN_SCORE_BEFORE_BAN);
} | rust_cleaned_test_functions.jsonl/93740 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 238
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
276,
3009,
368,
341,
286,
1077,
5206,
5456,
284,
8800,
10570,
486,
2258,
543,
286,
1077,
1431,
284,
18058,
486,
3328,
1428,
286,
1077,
2297,
284,
16701,
63727,
82218,
1668,
1093,
280,
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_convert_anykey() {
let secp256k1 = Secp256k1::new();
let (secp_privkey, secp_pubkey) = secp256k1.generate_keypair(&mut thread_rng()).unwrap();
let mut secret = [0u8; 32];
for i in 0..32 {
secret[i] = secp_privkey[i];
}
let seckey = SecretKey::parse(&secret).unwrap();
let pubkey = PublicKey::from_secret_key(&seckey);
let public = pubkey.serialize();
let public_compressed = pubkey.serialize_compressed();
let pubkey_r: &[u8] = &public;
let pubkey_compressed_r: &[u8] = &public_compressed;
let secp_pubkey_arr = secp_pubkey.serialize_vec(&secp256k1, false);
assert_eq!(secp_pubkey_arr.len(), 65);
let secp_pubkey_compressed_arr = secp_pubkey.serialize_vec(&secp256k1, true);
assert_eq!(secp_pubkey_compressed_arr.len(), 33);
let mut secp_pubkey_a = [0u8; 65];
for i in 0..65 {
secp_pubkey_a[i] = secp_pubkey_arr[i];
}
let mut secp_pubkey_compressed_a = [0u8; 33];
for i in 0..33 {
secp_pubkey_compressed_a[i] = secp_pubkey_compressed_arr[i];
}
let secp_pubkey_r: &[u8] = &secp_pubkey_a;
let secp_pubkey_compressed_r: &[u8] = &secp_pubkey_compressed_a;
assert_eq!(secp_pubkey_r, pubkey_r);
assert_eq!(secp_pubkey_compressed_r, pubkey_compressed_r);
} | rust_cleaned_test_functions.jsonl/129813 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 614
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
34910,
37248,
792,
368,
341,
262,
1077,
511,
4672,
17,
20,
21,
74,
16,
284,
4520,
79,
17,
20,
21,
74,
16,
486,
931,
543,
262,
1077,
320,
325,
4672,
24726,
792,
11,
511,
4672,
34014,
792,
8... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_print_transfer_for_protocol() {
let mut rng = XorShiftRng::from_seed([1, 2, 3, 4]);
let key = gen_pk_and_msg().0;
let transfer = Transfer::new_signed(
gen_account_id(&mut rng),
Address::from(rng.gen::<[u8; 20]>()),
Address::from(rng.gen::<[u8; 20]>()),
gen_token_id(&mut rng),
BigUint::from(12_340_000_000_000u64),
BigUint::from(56_700_000_000u64),
Nonce(rng.gen()),
Default::default(),
&key,
)
.expect("failed to sign transfer");
println!(
"User representation:\n{}\n",
serde_json::to_string_pretty(&transfer).expect("json serialize")
);
println!("Signer:");
println!("Private key: {}", key.0);
let (pk_x, pk_y) = public_key_from_private(&key).0.into_xy();
println!("Public key: x: {}, y: {}\n", pk_x, pk_y);
let signed_fields = vec![
("type", vec![255u8 - Transfer::TX_TYPE]),
("version", vec![CURRENT_TX_VERSION]),
("accountId", transfer.account_id.to_be_bytes().to_vec()),
("from", transfer.from.as_bytes().to_vec()),
("to", transfer.to.as_bytes().to_vec()),
("token", transfer.token.to_be_bytes().to_vec()),
("amount", pack_token_amount(&transfer.amount)),
("fee", pack_fee_amount(&transfer.fee)),
("nonce", transfer.nonce.to_be_bytes().to_vec()),
(
"time_range",
transfer
.time_range
.expect("no time range on transfer")
.as_be_bytes()
.to_vec(),
),
];
println!("Signed transaction fields:");
let mut field_concat = Vec::new();
for (field, value) in signed_fields.into_iter() {
println!("{}: 0x{}", field, hex::encode(&value));
field_concat.extend(value.into_iter());
}
println!("Signed bytes: 0x{}", hex::encode(&field_concat));
assert_eq!(
field_concat,
transfer.get_bytes(),
"Protocol serialization mismatch"
);
} | rust_cleaned_test_functions.jsonl/118954 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 986
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10064,
35403,
5478,
34880,
368,
341,
262,
1077,
5206,
28422,
284,
1599,
269,
24841,
49,
968,
486,
1499,
33809,
2561,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
2558,
262,
1077,
1376,
284,
4081... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_should_report_invalid_number_with_interior_junk() {
// GNU numfmt reports this as “invalid suffix”
new_ucmd!()
.args(&["--from=auto"])
.pipe_in("1x0K")
.run()
.stderr_is("numfmt: invalid number: '1x0K'\n");
} | rust_cleaned_test_functions.jsonl/46006 | {
"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,
43378,
14813,
31433,
5500,
6615,
15318,
2462,
5374,
3122,
368,
341,
262,
442,
4253,
1629,
12501,
6682,
419,
438,
1036,
11808,
20525,
88774,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
118... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_exceed_deadline() {
let engine = TestEngineBuilder::new().build().unwrap();
let read_pool = ReadPool::from(build_read_pool_for_test(
&CoprReadPoolConfig::default_for_test(),
engine,
));
let cm = ConcurrencyManager::new(1.into());
let copr = Endpoint::<RocksEngine>::new(
&Config::default(),
read_pool.handle(),
cm,
PerfLevel::EnableCount,
);
{
let handler_builder = Box::new(|_, _: &_| {
thread::sleep(Duration::from_millis(600));
Ok(UnaryFixture::new(Ok(coppb::Response::default())).into_boxed())
});
let mut config = ReqContext::default_for_test();
config.deadline = Deadline::from_now(Duration::from_millis(500));
let resp = block_on(copr.handle_unary_request(config, handler_builder)).unwrap();
assert_eq!(resp.get_data().len(), 0);
assert!(!resp.get_other_error().is_empty());
}
{
let handler_builder = Box::new(|_, _: &_| {
Ok(
UnaryFixture::new_with_duration_yieldable(Ok(coppb::Response::default()), 1500)
.into_boxed(),
)
});
let mut config = ReqContext::default_for_test();
config.deadline = Deadline::from_now(Duration::from_millis(500));
let resp = block_on(copr.handle_unary_request(config, handler_builder)).unwrap();
assert_eq!(resp.get_data().len(), 0);
assert!(!resp.get_other_error().is_empty());
}
} | rust_cleaned_test_functions.jsonl/83662 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 852
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2702,
4635,
53427,
1056,
368,
341,
286,
1077,
4712,
284,
3393,
4571,
3297,
486,
931,
1005,
5834,
1005,
15454,
543,
286,
1077,
1349,
15709,
284,
4457,
10551,
486,
1499,
43333,
6443,
15709,
5478,
44... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_windows_guest_disk_hotplug() {
let windows_guest = WindowsGuest::new();
let mut ovmf_path = dirs::home_dir().unwrap();
ovmf_path.push("workloads");
ovmf_path.push(OVMF_NAME);
let tmp_dir = TempDir::new_with_prefix("/tmp/ch").unwrap();
let api_socket = temp_api_path(&tmp_dir);
let mut child = GuestCommand::new(windows_guest.guest())
.args(&["--api-socket", &api_socket])
.args(&["--cpus", "boot=2,kvm_hyperv=on"])
.args(&["--memory", "size=4G"])
.args(&["--kernel", ovmf_path.to_str().unwrap()])
.args(&["--serial", "tty"])
.args(&["--console", "off"])
.default_disks()
.default_net()
.capture_output()
.spawn()
.unwrap();
let mut child_dnsmasq = windows_guest.run_dnsmasq();
let disk = windows_guest.disk_new(WindowsGuest::FS_FAT, 100);
let r = std::panic::catch_unwind(|| {
// Wait to make sure Windows boots up
assert!(windows_guest.wait_for_boot());
// Initially present disk device
let disk_num = 1;
assert_eq!(windows_guest.disk_count(), disk_num);
assert_eq!(disk_ctrl_threads_count(child.id()), disk_num);
// Hotplug disk device
let (cmd_success, cmd_output) = remote_command_w_output(
&api_socket,
"add-disk",
Some(format!("path={},readonly=off", disk).as_str()),
);
assert!(cmd_success);
assert!(String::from_utf8_lossy(&cmd_output).contains("\"id\":\"_disk2\""));
thread::sleep(std::time::Duration::new(5, 0));
// Online disk device
windows_guest.disks_set_rw();
windows_guest.disks_online();
// Verify the device is on the system
let disk_num = 2;
assert_eq!(windows_guest.disk_count(), disk_num);
assert_eq!(disk_ctrl_threads_count(child.id()), disk_num);
let data = "hello";
let fname = "d:\\world";
windows_guest.disk_file_put(fname, data);
// Unmount disk device
let cmd_success = remote_command(&api_socket, "remove-device", Some("_disk2"));
assert!(cmd_success);
thread::sleep(std::time::Duration::new(5, 0));
// Verify the device has been removed
let disk_num = 1;
assert_eq!(windows_guest.disk_count(), disk_num);
assert_eq!(disk_ctrl_threads_count(child.id()), disk_num);
// Remount and check the file exists with the expected contents
let (cmd_success, _cmd_output) = remote_command_w_output(
&api_socket,
"add-disk",
Some(format!("path={},readonly=off", disk).as_str()),
);
assert!(cmd_success);
thread::sleep(std::time::Duration::new(5, 0));
let out = windows_guest.disk_file_read(fname);
assert_eq!(data, out.trim());
windows_guest.shutdown();
});
let _ = child.wait_timeout(std::time::Duration::from_secs(60));
let _ = child.kill();
let output = child.wait_with_output().unwrap();
let _ = child_dnsmasq.kill();
let _ = child_dnsmasq.wait();
handle_child_output(r, &output);
} | rust_cleaned_test_functions.jsonl/26188 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1751
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58220,
62739,
41687,
33433,
47474,
368,
341,
286,
1077,
11030,
62739,
284,
5515,
37804,
486,
931,
1428,
286,
1077,
5206,
297,
7338,
69,
2638,
284,
42248,
486,
5117,
4334,
1005,
15454,
543,
286,
29... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_node_compact_count_limit() {
let count = 5;
let mut cluster = new_node_cluster(0, count);
test_compact_count_limit(&mut cluster);
} | rust_cleaned_test_functions.jsonl/80552 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 70
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5084,
18177,
531,
3180,
14763,
368,
341,
262,
1077,
1760,
284,
220,
20,
280,
262,
1077,
5206,
10652,
284,
501,
5084,
28441,
7,
15,
11,
1760,
317,
262,
1273,
18177,
531,
3180,
14763,
2099,
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 |
#[test]
fn test_ucomisd() {
assert_emit!(0x66, 0x0f, 0x2e, 0xc8; ucomisd(XMM1, XMM0));
assert_emit!(0x66, 0x44, 0x0f, 0x2e, 0xfb; ucomisd(XMM15, XMM3));
assert_emit!(0x66, 0x41, 0x0f, 0x2e, 0xe0; ucomisd(XMM4, XMM8));
} | rust_cleaned_test_functions.jsonl/85504 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 164
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7300,
874,
20640,
368,
341,
286,
2060,
69082,
10297,
15,
87,
21,
21,
11,
220,
15,
87,
15,
69,
11,
220,
15,
87,
17,
68,
11,
220,
15,
8148,
23,
26,
575,
874,
20640,
7644,
8035,
16,
11,
159... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_undo_commit_empty_repo() {
let (_td, repo) = repo_init().unwrap();
let root = repo.path().parent().unwrap();
let repo_path = root.as_os_str().to_str().unwrap();
// expect to fail
assert!(undo_last_commit(repo_path).is_err());
} | rust_cleaned_test_functions.jsonl/87756 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 110
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
98940,
36346,
15124,
37784,
368,
341,
197,
10217,
5453,
1296,
11,
15867,
8,
284,
15867,
6137,
1005,
15454,
543,
197,
10217,
3704,
284,
15867,
3875,
1005,
3765,
1005,
15454,
543,
197,
10217,
15867,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_reverse() {
let h1 = hlist![true, "hi"];
let h2 = hlist![1, 32f32];
assert_eq!(h1.into_reverse(), hlist!["hi", true]);
assert_eq!(h2.into_reverse(), hlist![32f32, 1]);
} | rust_cleaned_test_functions.jsonl/24753 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 126
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45514,
43277,
368,
341,
286,
1077,
305,
16,
284,
305,
1607,
20703,
1866,
11,
330,
6023,
6332,
286,
1077,
305,
17,
284,
305,
1607,
20703,
16,
11,
220,
18,
17,
69,
18,
17,
935,
286,
2060,
1071... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_infer_channels() {
let mut op = Conv::default(); // NCHW - OIHW
let ifact = InferenceFact::dt_shape(DatumType::F32, shapefactoid!(1, 2, 1, 1));
let kfact = InferenceFact::dt_shape(DatumType::F32, shapefactoid!(3, 2, 1, 1));
let ofact = InferenceFact::default();
let facts = op.infer_facts(tvec!(&ifact, &kfact), tvec!(&ofact), tvec!()).unwrap();
assert_eq!(
facts.1,
tvec!(InferenceFact::dt_shape(DatumType::F32, shapefactoid!(1, 3, 1, 1)))
);
} | rust_cleaned_test_functions.jsonl/51972 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 274
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1243,
802,
19291,
368,
341,
286,
1077,
5206,
1179,
284,
28988,
486,
2258,
2129,
442,
451,
2149,
54,
481,
506,
40,
38252,
198,
286,
1077,
421,
531,
284,
758,
2202,
17417,
486,
8047,
13597,
5432,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_same() {
let x = b"AGCTCGATCGATCGATC";
let y = b"AGCTCGATCGATCGATC";
let emission_params = TestEmissionParams { x, y };
let gap_params = TestGapParams;
let mut pair_hmm = PairHMM::new();
let p = pair_hmm.prob_related(&gap_params, &emission_params, None);
assert!(*p <= 0.0);
assert_relative_eq!(*p, 0.0, epsilon = 0.1);
} | rust_cleaned_test_functions.jsonl/35190 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 210
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
33574,
368,
341,
286,
1077,
856,
284,
293,
1,
1890,
1162,
8798,
828,
8798,
828,
8798,
828,
34,
876,
286,
1077,
379,
284,
293,
1,
1890,
1162,
8798,
828,
8798,
828,
8798,
828,
34,
3302,
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_signal_sigaction() {
let _m = ::SIGNAL_MTX.lock().expect("Mutex got poisoned by another test");
let action_handler = SigHandler::SigAction(test_sigaction_action);
assert_eq!(unsafe { signal(Signal::SIGINT, action_handler) }.unwrap_err(), Error::UnsupportedOperation);
} | rust_cleaned_test_functions.jsonl/32450 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 114
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21137,
29252,
1311,
368,
341,
262,
1077,
716,
76,
284,
3504,
50,
17754,
1245,
22867,
21003,
1005,
17119,
445,
38099,
2684,
70498,
553,
2441,
1273,
3071,
262,
1077,
1917,
10183,
284,
41560,
3050,
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_with_positive_prob() {
let positive_prob = 0.9;
let node = IsingNode::with_positive_prob(positive_prob).unwrap();
let prob_ratio: f64 = (node.potential(1) - node.potential(0)).exp();
let expected_prob_ratio = 0.9 / 0.1;
assert!((prob_ratio - expected_prob_ratio).abs() < 1e-9);
} | rust_cleaned_test_functions.jsonl/118922 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 168
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
54160,
20794,
368,
341,
286,
1077,
6785,
20794,
284,
220,
15,
13,
24,
280,
286,
1077,
2436,
284,
2160,
287,
1955,
486,
4197,
54160,
20794,
7,
30487,
20794,
568,
15454,
543,
286,
1077,
3566... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pretty_format_batches() -> Result<()> {
// define a schema.
let schema = Arc::new(Schema::new(vec![
Field::new("a", DataType::Utf8, true),
Field::new("b", DataType::Int32, true),
]));
// define data.
let batch = RecordBatch::try_new(
schema,
vec![
Arc::new(array::StringArray::from(vec![
Some("a"),
Some("b"),
None,
Some("d"),
])),
Arc::new(array::Int32Array::from(vec![
Some(1),
None,
Some(10),
Some(100),
])),
],
)?;
let table = pretty_format_batches(&[batch])?.to_string();
let expected = vec![
"+---+-----+",
"| a | b |",
"+---+-----+",
"| a | 1 |",
"| b | |",
"| | 10 |",
"| d | 100 |",
"+---+-----+",
];
let actual: Vec<&str> = table.lines().collect();
assert_eq!(expected, actual, "Actual result:\n{}", table);
Ok(())
} | rust_cleaned_test_functions.jsonl/5235 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 770
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
21322,
8955,
57755,
368,
1464,
5714,
71698,
341,
286,
442,
6979,
264,
10802,
624,
286,
1077,
10802,
284,
19689,
486,
931,
3759,
3416,
486,
931,
25592,
90515,
310,
8601,
486,
931,
445,
64,
4... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_block_cbs16() {
new_ucmd!()
.args(&["conv=block", "cbs=16"])
.pipe_in_fixture("dd-block-cbs16.test")
.succeeds()
.stdout_is_fixture_bytes("dd-block-cbs16.spec");
} | rust_cleaned_test_functions.jsonl/99842 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 125
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7113,
666,
1279,
16,
21,
368,
341,
262,
501,
68887,
2277,
0,
741,
286,
659,
2116,
2099,
1183,
12027,
28,
4574,
497,
330,
66,
1279,
28,
16,
21,
14108,
286,
659,
13768,
1243,
74409,
445,
631,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_top_level_ctx_enum() {
let test_data = [0x01_u8, 0x03];
let (rest, ret_read) = samples::TopLevelCtxEnum::read(test_data.view_bits(), (1, 2)).unwrap();
assert!(rest.is_empty());
assert_eq!(ret_read, samples::TopLevelCtxEnum::VariantA(0x06));
let ret_write = ret_read.write((1, 2)).unwrap();
assert_eq!(ret_write.into_vec(), &test_data[..]);
} | rust_cleaned_test_functions.jsonl/123235 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 175
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10426,
8274,
15147,
31054,
368,
341,
262,
1077,
1273,
1769,
284,
508,
15,
87,
15,
16,
7300,
23,
11,
220,
15,
87,
15,
18,
935,
262,
1077,
320,
3927,
11,
2112,
6443,
8,
284,
10469,
486,
5366,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_response() {
let s = "HTTP/1.1 200 OK\r\n\
Content-Length: 18\r\n\
Server: GWS/2.0\r\n\
Date: Sat, 11 Jan 2003 02:44:04 GMT\r\n\
Content-Type: text/html\r\n\
Cache-control: private\r\n\
Set-Cookie: 1P_JAR=2019-11-21-07; expires=Sat, 21-Dec-2019 07:23:44 GMT; path=/; domain=.google.com; SameSite=none\r\n\
Connection: keep-alive\r\n\
\r\n\
<html>hello</html>";
let response = Response::new(RoUrl::with("https://google.com"), s.as_bytes().to_vec());
assert!(response.is_ok());
let response = response.unwrap();
println!("{}", response);
let cookies = response.cookies();
println!("{:#?}", cookies);
} | rust_cleaned_test_functions.jsonl/111727 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 335
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
9655,
368,
341,
220,
1077,
274,
284,
330,
9230,
14,
16,
13,
16,
220,
17,
15,
15,
10402,
12016,
1699,
5661,
286,
8883,
52493,
25,
220,
16,
23,
12016,
1699,
5661,
286,
8422,
25,
479,
74... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_collect_vote_lockouts_sums() {
//two accounts voting for slot 0 with 1 token staked
let accounts = gen_stakes(&[(1, &[0]), (1, &[0])]);
let epoch_stakes = EpochStakes::new_from_stakes(0, &accounts);
let tower = Tower::new(epoch_stakes, 0, 0.67);
let ancestors = vec![(1, vec![0].into_iter().collect()), (0, HashSet::new())]
.into_iter()
.collect();
let staked_lockouts = tower.collect_vote_lockouts(1, accounts.into_iter(), &ancestors);
assert_eq!(staked_lockouts[&0].stake, 2);
assert_eq!(staked_lockouts[&0].lockout, 2 + 2 + 4 + 4);
assert_eq!(tower.epoch_stakes.total_staked, 2);
} | rust_cleaned_test_functions.jsonl/113927 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 331
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68140,
54360,
9818,
11672,
643,
6237,
368,
341,
286,
442,
19789,
9618,
15668,
369,
9446,
220,
15,
448,
220,
16,
3950,
357,
7741,
198,
286,
1077,
9618,
284,
4081,
1261,
2050,
2099,
9697,
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... | 1 |
#[test]
fn test_asciidoc_header() {
let conms: Vec<u8> = "| Command | Mean [ms] | Min…Max [ms]\n".bytes().collect();
let cons: Vec<u8> = "| Command | Mean [s] | Min…Max [s]\n".bytes().collect();
let genms = table_header(Unit::MilliSecond);
let gens = table_header(Unit::Second);
assert_eq!(conms, genms);
assert_eq!(cons, gens);
} | rust_cleaned_test_functions.jsonl/26769 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 158
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
88474,
54483,
509,
8757,
368,
341,
262,
1077,
390,
1011,
25,
11312,
34837,
23,
29,
284,
25203,
7348,
760,
16327,
508,
1011,
60,
760,
3386,
1940,
5974,
508,
1011,
17960,
77,
3263,
9651,
1005,
173... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cluster_partition_1_2() {
let empty = |_: &mut LocalCluster| {};
let on_partition_resolved = |cluster: &mut LocalCluster| {
cluster.check_for_new_roots(16, &"PARTITION_TEST");
};
run_cluster_partition(&[&[1], &[1, 1]], None, empty, on_partition_resolved)
} | rust_cleaned_test_functions.jsonl/35986 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
28441,
43840,
62,
16,
62,
17,
368,
341,
262,
1077,
4287,
284,
760,
23211,
609,
6984,
8774,
28678,
91,
9321,
262,
1077,
389,
43840,
4918,
8731,
284,
760,
18855,
25,
609,
6984,
8774,
28678,
91,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_restore_ignore_snapshot() {
let l = default_logger();
let previous_ents = vec![empty_entry(1, 1), empty_entry(1, 2), empty_entry(1, 3)];
let commit = 1u64;
let mut sm = new_test_raft(1, vec![1, 2], 10, 1, new_storage(), &l);
sm.raft_log.append(&previous_ents);
sm.raft_log.commit_to(commit);
let mut s = new_snapshot(commit, 1, vec![1, 2]);
// ingore snapshot
assert!(!sm.restore(s.clone()));
assert_eq!(sm.raft_log.committed, commit);
// ignore snapshot and fast forward commit
s.mut_metadata().index = commit + 1;
assert!(!sm.restore(s));
assert_eq!(sm.raft_log.committed, commit + 1);
} | rust_cleaned_test_functions.jsonl/19140 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 286
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62677,
58493,
53265,
368,
341,
262,
1077,
326,
284,
1638,
27413,
543,
262,
1077,
3681,
62,
805,
284,
7486,
20703,
3194,
9078,
7,
16,
11,
220,
16,
701,
4287,
9078,
7,
16,
11,
220,
17,
701,
42... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_correct_scroll_position() {
let items = string_vec_to_status(&[
"a/b/b1",
"a/b/b2",
"a/c/c1",
]);
//0 a/
//1 b/
//2 b1
//3 b2
//4 c/
//5 c1
// Set up test terminal
let test_backend = tui::backend::TestBackend::new(100, 100);
let mut terminal = tui::Terminal::new(test_backend)
.expect("Unable to set up terminal");
let mut frame = terminal.get_frame();
// set up file tree
let mut ftc = FileTreeComponent::new(
"title",
true,
None,
SharedTheme::default(),
SharedKeyConfig::default(),
);
ftc.update(&items)
.expect("Updating FileTreeComponent failed");
ftc.move_selection(MoveSelection::Down); // Move to b/
ftc.move_selection(MoveSelection::Left); // Fold b/
ftc.move_selection(MoveSelection::Down); // Move to c/
ftc.draw(&mut frame, Rect::new(0, 0, 10, 5))
.expect("Draw failed");
assert_eq!(ftc.scroll_top.get(), 0); // should still be at top
} | rust_cleaned_test_functions.jsonl/122436 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 431
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31550,
41407,
9661,
368,
341,
197,
10217,
3589,
284,
914,
13251,
2346,
4773,
2099,
9640,
298,
197,
56693,
3470,
3470,
16,
497,
715,
298,
197,
56693,
3470,
3470,
17,
497,
715,
298,
197,
56693,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dim_extended_fixed_length_string() {
assert_eq!(
linter_ok("DIM A AS STRING * 5"),
vec![TopLevelToken::Statement(Statement::Dim(
DimNameBuilder::new()
.bare_name("A")
.dim_type(DimType::FixedLengthString(
Expression::IntegerLiteral(5).at_rc(1, 19),
5
))
.build_list_rc(1, 5)
))
.at_rc(1, 1)]
);
} | rust_cleaned_test_functions.jsonl/122470 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 282
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10791,
61678,
37839,
5118,
3904,
368,
341,
262,
2060,
10714,
33673,
286,
326,
2245,
19817,
445,
75119,
362,
5752,
35255,
353,
220,
20,
4461,
286,
7486,
20703,
5366,
4449,
3323,
486,
8636,
7,
8636,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_help() -> Result<(), Box<dyn std::error::Error>> {
setup()?;
let mut dynein_cmd = Command::cargo_bin("dy")?;
let cmd = dynein_cmd.arg("--help");
cmd.assert()
.success()
.stdout(predicate::str::contains("dynein is a command line tool"));
Ok(())
} | rust_cleaned_test_functions.jsonl/37970 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 138
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26926,
368,
1464,
5714,
68843,
8261,
92846,
1460,
486,
841,
486,
1454,
2452,
341,
262,
6505,
94136,
262,
1077,
5206,
13955,
811,
258,
11684,
284,
7348,
486,
66715,
21816,
445,
10258,
899,
37445,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_get_valid_float_prefix() {
let cases = vec![
("-100", "-100"),
("1abc", "1"),
("-1-1", "-1"),
("+1+1", "+1"),
("123..34", "123."),
("123.23E-10", "123.23E-10"),
("1.1e1.3", "1.1e1"),
("11e1.3", "11e1"),
("1.1e-13a", "1.1e-13"),
("1.", "1."),
(".1", ".1"),
("", "0"),
("123e+", "123"),
("123.e", "123."),
];
let cfg = EvalConfig::new(0, FLAG_IGNORE_TRUNCATE).unwrap();
let mut ctx = EvalContext::new(Arc::new(cfg));
for (i, o) in cases {
assert_eq!(super::get_valid_float_prefix(&mut ctx, i).unwrap(), o);
}
} | rust_cleaned_test_functions.jsonl/78149 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 478
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
8337,
17586,
13974,
368,
341,
286,
1077,
5048,
284,
7486,
90515,
310,
98670,
16,
15,
15,
497,
6523,
16,
15,
15,
4461,
310,
3489,
16,
13683,
497,
330,
16,
4461,
310,
98670,
16,
12,
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... | 2 |
#[test]
fn test_insert() {
Python::with_gil(|py| {
let list = PyList::new(py, &[2, 3, 5, 7]);
let val = 42i32.to_object(py);
let val2 = 43i32.to_object(py);
assert_eq!(4, list.len());
assert_eq!(2, list[0].extract::<i32>().unwrap());
list.insert(0, val).unwrap();
list.insert(1000, val2).unwrap();
assert_eq!(6, list.len());
assert_eq!(42, list[0].extract::<i32>().unwrap());
assert_eq!(2, list[1].extract::<i32>().unwrap());
assert_eq!(43, list[5].extract::<i32>().unwrap());
});
} | rust_cleaned_test_functions.jsonl/108624 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 361
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17678,
368,
341,
286,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
341,
310,
1077,
1140,
284,
5355,
852,
486,
931,
46827,
11,
44590,
17,
11,
220,
18,
11,
220,
20,
11,
220,
22,
2558,
310,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_view_matrix() {
let mut transform = Transform::default();
transform.set_xyz(5.0, 70.1, 43.7);
transform.set_scale(1.0, 5.0, 8.9);
transform.set_rotation(
UnitQuaternion::rotation_between(&Vector3::new(-1., 1., 2.), &Vector3::new(1., 0., 0.))
.unwrap(),
);
assert_ulps_eq!(
transform.matrix().try_inverse().unwrap(),
transform.view_matrix(),
);
} | rust_cleaned_test_functions.jsonl/126186 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 253
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7122,
10193,
368,
341,
286,
1077,
5206,
5165,
284,
15226,
486,
2258,
543,
286,
5165,
980,
64974,
7,
20,
13,
15,
11,
220,
22,
15,
13,
16,
11,
220,
19,
18,
13,
22,
317,
286,
5165,
980,
16727... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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.