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_write_array() {
assert_eq!(Array(vec![]).to_string(), "[]");
assert_eq!(Array(vec![]).to_pretty_str(), "[]");
assert_eq!(Array(vec![Boolean(true)]).to_string(), "[true]");
assert_eq!(
Array(vec![Boolean(true)]).to_pretty_str(),
"\
[\n \
true\n\
]"
);
let long_test_array = Array(vec![
Boolean(false),
Null,
Array(vec![String("foo\nbar".into_string()), F64(3.5)])]);
assert_eq!(long_test_array.to_string(),
"[false,null,[\"foo\\nbar\",3.5]]");
assert_eq!(
long_test_array.to_pretty_str(),
"\
[\n \
false,\n \
null,\n \
[\n \
\"foo\\nbar\",\n \
3.5\n \
]\n\
]"
);
} | rust_cleaned_test_functions.jsonl/6535 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 600
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9165,
3858,
368,
341,
286,
2060,
10714,
10297,
1857,
25592,
0,
1294,
568,
983,
3904,
1507,
330,
1294,
797,
286,
2060,
10714,
10297,
1857,
25592,
0,
1294,
568,
983,
620,
21322,
2895,
1507,
330,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_double_val() {
let mut vm = ShrekVM::new(Vec::new());
vm.push(3);
double_val(&mut vm).unwrap();
assert_eq!(6, vm.peek().unwrap());
// Value on stack should be replaced with result.
assert_eq!(1, vm.count());
} | rust_cleaned_test_functions.jsonl/71704 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 139
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
24598,
6189,
368,
341,
286,
1077,
5206,
10995,
284,
1417,
41861,
11187,
486,
931,
49923,
486,
931,
5231,
286,
10995,
2552,
7,
18,
626,
286,
1990,
6189,
2099,
6984,
10995,
568,
15454,
1428,
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_downcast_box_stream() {
// FIXME: Use Type ascription
let stream: Box<NetworkStream + Send> = Box::new(MockStream::new());
let mock = stream.downcast::<MockStream>().ok().unwrap();
assert_eq!(mock, Box::new(MockStream::new()));
} | rust_cleaned_test_functions.jsonl/118984 | {
"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,
13998,
3829,
10194,
12673,
368,
341,
286,
442,
27475,
25,
5443,
3990,
438,
1453,
198,
286,
1077,
4269,
25,
8261,
27,
12320,
3027,
488,
11000,
29,
284,
8261,
486,
931,
66436,
3027,
486,
931,
5231... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_capacity() {
let g = MatrixGraph::<i32, i32>::with_capacity(10);
assert_eq!(g.node_count(), 0);
assert_eq!(g.edge_count(), 0);
} | rust_cleaned_test_functions.jsonl/81955 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6615,
35603,
368,
341,
286,
1077,
342,
284,
11631,
11212,
27638,
72,
18,
17,
11,
600,
18,
17,
6831,
4197,
35603,
7,
16,
15,
317,
286,
2060,
10714,
10297,
70,
12097,
3180,
1507,
220,
15,
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 |
#[test]
fn test_chr() {
context!(ctx, dev);
execute_str!(ctx, b"*CHR? CHRDATA" => result, response {
assert_eq!(result, Ok(()));
assert_eq!(response, b"CHRDATA\n");
});
execute_str!(ctx, b"*CHR? 'CHRDATA'" => result, _response {
assert_eq!(result, Err(Error::from(ErrorCode::DataTypeError)));
});
execute_str!(ctx, b"*CHR? 1.0" => result, _response {
assert_eq!(result, Err(Error::from(ErrorCode::DataTypeError)));
});
} | rust_cleaned_test_functions.jsonl/82172 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 268
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
68993,
368,
341,
286,
2266,
10297,
3773,
11,
3483,
317,
286,
9026,
2895,
10297,
3773,
11,
293,
61593,
67196,
30,
61576,
17777,
1,
589,
1102,
11,
2033,
341,
310,
2060,
10714,
10297,
1382,
11,
762... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bit_set_intersect_with() {
// Explicitly 0'ed bits
let mut a = BitSet::from_bit_vec(BitVec::from_bytes(&[0b10100010]));
let mut b = BitSet::from_bit_vec(BitVec::from_bytes(&[0b00000000]));
let c = a.clone();
a.intersect_with(&b);
b.intersect_with(&c);
assert!(a.is_empty());
assert!(b.is_empty());
// Uninitialized bits should behave like 0's
let mut a = BitSet::from_bit_vec(BitVec::from_bytes(&[0b10100010]));
let mut b = BitSet::new();
let c = a.clone();
a.intersect_with(&b);
b.intersect_with(&c);
assert!(a.is_empty());
assert!(b.is_empty());
// Standard
let mut a = BitSet::from_bit_vec(BitVec::from_bytes(&[0b10100010]));
let mut b = BitSet::from_bit_vec(BitVec::from_bytes(&[0b01100010]));
let c = a.clone();
a.intersect_with(&b);
b.intersect_with(&c);
assert_eq!(a.len(), 2);
assert_eq!(b.len(), 2);
} | rust_cleaned_test_functions.jsonl/76233 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 524
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13996,
2602,
72747,
6615,
368,
341,
286,
442,
31330,
398,
220,
15,
6,
291,
9472,
198,
286,
1077,
5206,
264,
284,
57227,
486,
1499,
13996,
13251,
68653,
10050,
486,
1499,
12524,
2099,
58,
15,
65,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_conn_default_1_0() {
let mut buf = BytesMut::from("GET /test HTTP/1.0\r\n\r\n");
let req = parse_ready!(&mut buf);
assert!(!req.keep_alive());
} | rust_cleaned_test_functions.jsonl/110387 | {
"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,
17241,
9993,
62,
16,
62,
15,
368,
341,
286,
1077,
5206,
6607,
284,
30024,
51440,
486,
1499,
445,
3806,
608,
1944,
10130,
14,
16,
13,
15,
12016,
1699,
12016,
1699,
797,
286,
1077,
4232,
284,
47... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_from_arg_matches_format_invalid() {
let argv = vec!["lsd", "--date", "+%J"];
let matches = app::build().get_matches_from_safe(argv).unwrap();
DateFlag::from_arg_matches(&matches);
} | rust_cleaned_test_functions.jsonl/1303 | {
"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,
5673,
6057,
38344,
8955,
31433,
368,
341,
286,
1077,
10213,
284,
7486,
0,
1183,
4730,
67,
497,
14482,
1028,
497,
6630,
4,
41,
6332,
286,
1077,
9071,
284,
906,
486,
5834,
1005,
455,
38344,
5673,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_full_node_to_validator() {
let mut testkit = TestKitBuilder::auditor()
.with_validators(3)
.with_service(ConfigurationService {
config: ConfigurationServiceConfig::default(),
})
.create();
let cfg_change_height = Height(5);
let new_cfg = {
let mut cfg = testkit.configuration_change_proposal();
let mut validators = cfg.validators().to_vec();
validators.push(testkit.network().us().clone());
cfg.set_actual_from(cfg_change_height);
cfg.set_validators(validators);
cfg.stored_configuration().clone()
};
testkit.apply_configuration(ValidatorId(1), new_cfg);
} | rust_cleaned_test_functions.jsonl/106405 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 297
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16372,
5084,
2346,
64959,
368,
341,
262,
1077,
5206,
1273,
8226,
284,
3393,
7695,
3297,
486,
7880,
1919,
741,
286,
659,
4197,
8337,
2973,
7,
18,
340,
286,
659,
4197,
12267,
45443,
1860,
341,
310... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_mark_valid_invalid_forks() {
let mut heaviest_subtree_fork_choice = setup_forks();
let stake = 100;
let (bank, vote_pubkeys) = bank_utils::setup_bank_and_vote_pubkeys_for_tests(3, stake);
let pubkey_votes: Vec<(Pubkey, SlotHashKey)> = vec![
(vote_pubkeys[0], (6, Hash::default())),
(vote_pubkeys[1], (6, Hash::default())),
(vote_pubkeys[2], (2, Hash::default())),
];
let expected_best_slot = 6;
assert_eq!(
heaviest_subtree_fork_choice.add_votes(
pubkey_votes.iter(),
bank.epoch_stakes_map(),
bank.epoch_schedule()
),
(expected_best_slot, Hash::default()),
);
// Simulate a vote on slot 5
let last_voted_slot_hash = (5, Hash::default());
let mut tower = Tower::new_for_tests(10, 0.9);
tower.record_vote(last_voted_slot_hash.0, last_voted_slot_hash.1);
assert_eq!(
heaviest_subtree_fork_choice
.heaviest_slot_on_same_voted_fork(&tower)
.unwrap(),
(6, Hash::default())
);
// Mark slot 5 as invalid
let invalid_candidate = last_voted_slot_hash;
heaviest_subtree_fork_choice.mark_fork_invalid_candidate(&invalid_candidate);
assert!(!heaviest_subtree_fork_choice
.is_candidate(&invalid_candidate)
.unwrap());
// The ancestor 3 is still a candidate
assert!(heaviest_subtree_fork_choice
.is_candidate(&(3, Hash::default()))
.unwrap());
assert_eq!(heaviest_subtree_fork_choice.best_overall_slot().0, 3);
// should disregard all descendants of that invalid vote
assert!(heaviest_subtree_fork_choice
.heaviest_slot_on_same_voted_fork(&tower)
.is_none());
// Adding another descendant to the invalid candidate won't
let new_leaf7 = (7, Hash::default());
heaviest_subtree_fork_choice.add_new_leaf_slot(new_leaf7, Some((6, Hash::default())));
let invalid_slot_ancestor = 3;
assert_eq!(
heaviest_subtree_fork_choice.best_overall_slot().0,
invalid_slot_ancestor
);
let pubkey_votes: Vec<(Pubkey, SlotHashKey)> = vec![(vote_pubkeys[0], new_leaf7)];
assert_eq!(
heaviest_subtree_fork_choice.add_votes(
pubkey_votes.iter(),
bank.epoch_stakes_map(),
bank.epoch_schedule()
),
(invalid_slot_ancestor, Hash::default()),
);
// This shouldn't update the `heaviest_slot_on_same_voted_fork` either
assert!(heaviest_subtree_fork_choice
.heaviest_slot_on_same_voted_fork(&tower)
.is_none());
// Adding a descendant to the ancestor of the invalid candidate *should* update
let new_leaf8 = (8, Hash::default());
heaviest_subtree_fork_choice
.add_new_leaf_slot(new_leaf8, Some((invalid_slot_ancestor, Hash::default())));
assert_eq!(heaviest_subtree_fork_choice.best_overall_slot(), new_leaf8,);
// Should not update the `heaviest_slot_on_same_voted_fork` because the new leaf
// is not descended from the last vote
assert!(heaviest_subtree_fork_choice
.heaviest_slot_on_same_voted_fork(&tower)
.is_none());
heaviest_subtree_fork_choice.mark_fork_valid_candidate(&invalid_candidate);
assert!(heaviest_subtree_fork_choice
.is_candidate(&invalid_candidate)
.unwrap());
assert_eq!(
heaviest_subtree_fork_choice.best_overall_slot(),
// Should pick the smaller slot of the two new equally weighted leaves
new_leaf7
);
// Should update the `heaviest_slot_on_same_voted_fork` as well
assert_eq!(
heaviest_subtree_fork_choice
.heaviest_slot_on_same_voted_fork(&tower)
.unwrap(),
new_leaf7
);
} | rust_cleaned_test_functions.jsonl/70827 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2077
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18924,
8337,
31433,
761,
73302,
368,
341,
286,
1077,
5206,
566,
98362,
5228,
9344,
761,
669,
31936,
284,
6505,
761,
73302,
543,
286,
1077,
18279,
284,
220,
16,
15,
15,
280,
286,
1077,
320,
17033... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_version() {
assert!(Version {
major: 32,
minor: 25,
patch: 10,
}
.is_compatible_with(&Version {
major: 32,
minor: 10,
patch: 100,
}),);
let v = Version {
major: 17,
minor: 11,
patch: 1,
};
let vi: u64 = v.into();
assert_eq!(v, Version::from(vi));
} | rust_cleaned_test_functions.jsonl/38174 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 277
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9438,
368,
341,
286,
2060,
10297,
5637,
341,
310,
3598,
25,
220,
18,
17,
345,
310,
8922,
25,
220,
17,
20,
345,
310,
10900,
25,
220,
16,
15,
345,
286,
456,
286,
659,
285,
2965,
37079,
6615,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bench_tps_fund_keys() {
let (genesis_block, id) = create_genesis_block(10_000);
let bank = Bank::new(&genesis_block);
let client = BankClient::new(bank);
let tx_count = 10;
let lamports = 20;
let (keypairs, _keypair_balance) =
generate_and_fund_keypairs(&client, None, &id, tx_count, lamports).unwrap();
for kp in &keypairs {
assert_eq!(client.get_balance(&kp.pubkey()).unwrap(), lamports);
}
} | rust_cleaned_test_functions.jsonl/1528 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 247
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
880,
19762,
528,
1690,
761,
1241,
12631,
368,
341,
286,
1077,
320,
77894,
7113,
11,
877,
8,
284,
1855,
16322,
13774,
7113,
7,
16,
15,
62,
15,
15,
15,
317,
286,
1077,
6073,
284,
8547,
486,
93... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_iterator_with_no_filter() {
let reader = BufReader::new(r#"
name, age, birth date
"Douglas Adams", "42", "1952-03-11"
"Gen Z. Person", "20", "2000-01-01"
"Ada Lovelace", "36", "1815-12-10"
"#.trim().as_bytes());
let mut csv = Csv::new(reader).unwrap();
let filtered_names = csv.map(|row| row.unwrap()["name"].clone()).collect::<Vec<_>>();
//When no filter function
assert_eq!(filtered_names, &["Douglas Adams","Gen Z. Person", "Ada Lovelace"]);
} | rust_cleaned_test_functions.jsonl/44013 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 209
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13491,
6615,
6536,
8727,
368,
341,
1149,
6604,
284,
69013,
5062,
486,
931,
2601,
2,
698,
262,
829,
11,
4231,
11,
7194,
2400,
198,
262,
330,
91641,
26383,
26234,
497,
330,
19,
17,
497,
330,
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_parse_mode() {
assert_eq!(
parse_mode("123", Modes::Lines),
Ok((Modes::Lines(123), false))
);
assert_eq!(
parse_mode("-456", Modes::Bytes),
Ok((Modes::Bytes(456), true))
);
assert!(parse_mode("Nonsensical Nonsense", Modes::Bytes).is_err());
#[cfg(target_pointer_width = "64")]
assert!(parse_mode("1Y", Modes::Lines).is_err());
#[cfg(target_pointer_width = "32")]
assert!(parse_mode("1T", Modes::Bytes).is_err());
} | rust_cleaned_test_functions.jsonl/72117 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 287
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
7302,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
7302,
445,
16,
17,
18,
497,
81689,
486,
16794,
1326,
310,
7622,
1188,
70035,
486,
16794,
7,
16,
17,
18,
701,
895,
1171,
286,
1439,
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_aggregation_integer_integral() {
let spec =
"input in: UInt8\n output out: UInt8 @5Hz := in.aggregate(over_exactly: 3s, using: integral).defaults(to: 5)";
assert_eq!(1, num_type_errors(spec));
let spec =
"input in: Int8\n output out: Int8 @5Hz := in.aggregate(over_exactly: 3s, using: integral).defaults(to: 5)";
assert_eq!(1, num_type_errors(spec));
let spec =
"input in: UInt8\n output out @5Hz := in.aggregate(over_exactly: 3s, using: integral).defaults(to: 5.0)";
assert_eq!(0, num_type_errors(spec));
let spec =
"input in: Int8\n output out @5Hz := in.aggregate(over_exactly: 3s, using: integral).defaults(to: 5.0)";
assert_eq!(0, num_type_errors(spec));
} | rust_cleaned_test_functions.jsonl/110698 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 381
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20587,
34442,
31725,
64076,
368,
341,
286,
1077,
1398,
4035,
310,
330,
1355,
304,
25,
22275,
23,
1699,
2550,
700,
25,
22275,
23,
569,
20,
11475,
1669,
304,
88534,
7,
1975,
2702,
32739,
25,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_find_circle_num() {
assert_eq!(
Solution::find_circle_num(vec![vec![1, 1, 0], vec![1, 1, 0], vec![0, 0, 1]]),
2
);
assert_eq!(
Solution::find_circle_num(vec![vec![1, 0, 0], vec![0, 1, 0], vec![0, 0, 1]]),
3
);
} | rust_cleaned_test_functions.jsonl/57106 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 198
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
42222,
4273,
368,
341,
286,
2060,
10714,
33673,
310,
12478,
486,
3903,
42222,
4273,
25592,
20703,
4083,
20703,
16,
11,
220,
16,
11,
220,
15,
1125,
7486,
20703,
16,
11,
220,
16,
11,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_recognize_utf8_boundary_half_debt_one_four() {
let buf: &[u8] = &[0x61, 0xF0, 0x90, 0x86, 0x92, 0x0d, 0x0a, 0x0d, 0x0a];
let mut full = buffer_from(buf);
let result = block_on(async { recognize(&mut full).await });
assert_eq!(result.unwrap().find_header("Complex"), Some("a𐆒".to_string()));
} | rust_cleaned_test_functions.jsonl/48193 | {
"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,
7080,
3934,
551,
39453,
23,
54004,
40626,
2259,
12755,
11667,
56142,
368,
341,
220,
1077,
6607,
25,
44590,
84,
23,
60,
284,
44590,
15,
87,
21,
16,
11,
220,
15,
9770,
15,
11,
220,
15,
87,
24,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_touch_no_args() {
let mut ucmd = new_ucmd!();
ucmd.fails().stderr_only(
r##"touch: missing file operand
Try 'touch --help' for more information."##,
);
} | rust_cleaned_test_functions.jsonl/96656 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 89
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
60840,
6536,
8384,
368,
341,
262,
1077,
5206,
575,
8710,
284,
501,
68887,
2277,
0,
543,
262,
575,
8710,
833,
6209,
1005,
36422,
18410,
1006,
286,
435,
565,
1,
22020,
25,
7402,
1034,
27213,
198,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_set_correct() {
let mut hbitset = HBitSet::new();
let mut set = HashSet::new();
for _ in 0..1000_000 {
let j = fastrand::usize(0..SIZE);
set.insert(j);
hbitset.set(j);
assert!(hbitset.test(j), "{}", j);
}
let mut count = 0;
hbitset.drain(|j| {
assert!(set.contains(&(j as usize)));
count += 1;
});
assert_eq!(count, set.len());
} | rust_cleaned_test_functions.jsonl/81807 | {
"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,
2602,
31550,
368,
341,
286,
1077,
5206,
305,
77615,
284,
472,
8344,
1649,
486,
931,
543,
286,
1077,
5206,
738,
284,
18931,
486,
931,
543,
286,
369,
716,
304,
220,
15,
496,
16,
15,
15,
15,
62... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_dns_uds() {
let eve_config = || eve::EveConfiguration::uds(PathBuf::from("test.socket"));
let outputs: Vec<Box<dyn output::Output + Send + Sync>> =
vec![Box::new(output::Dns::new(eve_config()))];
let mut cfg = Config::default();
cfg.outputs = outputs;
let rendered = cfg.render(ipc_plugin()).unwrap();
let regex = regex::Regex::new(r#"filetype:\s+unix_stream\s*[\r\n]\s*filename: test\.socket.Dns\.socket\s*[\r\n](.*[\r\n])*\s*types:\s*[\r\n]*\s*- dns"#).unwrap();
assert!(regex.find(&rendered).is_some());
} | rust_cleaned_test_functions.jsonl/28115 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 291
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
71125,
62,
27988,
368,
341,
286,
1077,
48896,
5332,
284,
1369,
48896,
486,
36,
586,
7688,
486,
27988,
33030,
15064,
486,
1499,
445,
1944,
25926,
4010,
286,
1077,
16275,
25,
11312,
79852,
92846,
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_extract_integer() {
assert_eq!(extract_integer(cbor_int!(123)), Ok(123));
assert_eq!(extract_integer(cbor_int!(-123)), Ok(-123));
assert_eq!(
extract_integer(cbor_bool!(true)),
Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE)
);
assert_eq!(
extract_integer(cbor_text!("foo")),
Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE)
);
assert_eq!(
extract_integer(cbor_bytes_lit!(b"bar")),
Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE)
);
assert_eq!(
extract_integer(cbor_array![]),
Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE)
);
assert_eq!(
extract_integer(cbor_map! {}),
Err(CTAP2_ERR_CBOR_UNEXPECTED_TYPE)
);
} | rust_cleaned_test_functions.jsonl/48992 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 474
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39123,
31725,
368,
341,
286,
2060,
10714,
10297,
23493,
31725,
1337,
9368,
4042,
10297,
16,
17,
18,
5731,
7622,
7,
16,
17,
18,
1106,
286,
2060,
10714,
10297,
23493,
31725,
1337,
9368,
4042,
0,
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_rwlock_secondary_index_same_slot_and_forks() {
let (key_start, key_end, account_index) = create_rwlock_secondary_index_state();
let index = AccountsIndex::<bool>::default_for_tests();
for token_id in [inline_spl_token::id(), inline_spl_token_2022::id()] {
run_test_secondary_indexes_same_slot_and_forks(
&token_id,
&index,
&index.spl_token_owner_index,
key_start,
key_end,
&account_index,
);
}
} | rust_cleaned_test_functions.jsonl/71352 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 309
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
98850,
77759,
3560,
33574,
27563,
8378,
761,
73302,
368,
341,
286,
1077,
320,
792,
4906,
11,
1376,
6213,
11,
2692,
3560,
8,
284,
1855,
98850,
77759,
3560,
4387,
543,
286,
1077,
1922,
284,
40655,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_fn_application() {
let tests = vec![
(
"let identity = fn(x) { x; }; identity(5);",
Some(Object::Int(5)),
),
(
"let identity = fn(x) { return x; }; identity(5);",
Some(Object::Int(5)),
),
(
"let double = fn(x) { x * 2; }; double(5);",
Some(Object::Int(10)),
),
(
"let add = fn(x, y) { x + y; }; add(5, 5);",
Some(Object::Int(10)),
),
(
"let add = fn(x, y) { x + y; }; add(5 + 5, add(5, 5));",
Some(Object::Int(20)),
),
("fn(x) { x; }(5)", Some(Object::Int(5))),
(
"fn(a) { let f = fn(b) { a + b }; f(a); }(5);",
Some(Object::Int(10)),
),
];
for (input, expect) in tests {
assert_eq!(expect, eval(input));
}
} | rust_cleaned_test_functions.jsonl/51924 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 659
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15246,
38721,
368,
341,
286,
1077,
7032,
284,
7486,
90515,
310,
2399,
394,
330,
1149,
9569,
284,
5168,
2075,
8,
314,
856,
26,
20066,
9569,
7,
20,
1215,
756,
394,
4329,
12526,
486,
1072,
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... | 2 |
#[test]
fn test_mkdir_dup_dir_parent() {
let scene = TestScenario::new(util_name!());
scene.ucmd().arg(TEST_DIR6).succeeds();
scene.ucmd().arg("-p").arg(TEST_DIR6).succeeds();
} | rust_cleaned_test_functions.jsonl/61306 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
717,
12438,
51932,
4334,
15960,
368,
341,
262,
1077,
6109,
284,
3393,
54031,
486,
931,
67811,
1269,
0,
1423,
262,
6109,
56334,
2277,
1005,
858,
50320,
8291,
21,
568,
82,
29264,
82,
543,
262,
610... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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() {
create_case(10.0);
create_case(-5.0);
create_case(10.0);
create_case(100.0);
create_case(f64::INFINITY);
} | rust_cleaned_test_functions.jsonl/66856 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 105
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8657,
368,
341,
286,
1855,
19096,
7,
16,
15,
13,
15,
317,
286,
1855,
19096,
4080,
20,
13,
15,
317,
286,
1855,
19096,
7,
16,
15,
13,
15,
317,
286,
1855,
19096,
7,
16,
15,
15,
13,
15,
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 |
#[test]
fn test_legal_moves_banmen_with_fu_nari_7_squares_gote() {
test_legal_moves_banmen_with_kin_7_squares_gote_impl(GFuN)
} | rust_cleaned_test_functions.jsonl/81261 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 72
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
82324,
45390,
880,
276,
5676,
6615,
36467,
1089,
2780,
62,
22,
643,
40856,
1889,
1272,
368,
972,
18185,
82324,
45390,
880,
276,
5676,
6615,
4698,
258,
62,
22,
643,
40856,
1889,
1272,
21007,
6699,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_raw_ctx() {
let ctx_full = Secp256k1::new();
let ctx_sign = Secp256k1::signing_only();
let ctx_vrfy = Secp256k1::verification_only();
let full = unsafe {Secp256k1::from_raw_all(ctx_full.ctx)};
let sign = unsafe {Secp256k1::from_raw_signining_only(ctx_sign.ctx)};
let vrfy = unsafe {Secp256k1::from_raw_verification_only(ctx_vrfy.ctx)};
let (sk, pk) = full.generate_keypair(&mut thread_rng());
let msg = Message::from_slice(&[2u8; 32]).unwrap();
// Try signing
assert_eq!(sign.sign(&msg, &sk), full.sign(&msg, &sk));
let sig = full.sign(&msg, &sk);
// Try verifying
assert!(vrfy.verify(&msg, &sig, &pk).is_ok());
assert!(full.verify(&msg, &sig, &pk).is_ok());
drop(full);drop(sign);drop(vrfy);
drop(ctx_full);drop(ctx_sign);drop(ctx_vrfy);
} | rust_cleaned_test_functions.jsonl/12674 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 441
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16067,
15147,
368,
341,
286,
1077,
5635,
16372,
284,
4520,
79,
17,
20,
21,
74,
16,
486,
931,
543,
286,
1077,
5635,
11172,
284,
4520,
79,
17,
20,
21,
74,
16,
486,
7752,
287,
18410,
543,
286,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_update_nft_disallow_to_be_claimed_error() {
let (mut context, tx) = create_test_context(
Action::Update(UpdateCase::Claim),
NftError::NFTDisallowClaimed,
);
let tx = context.complete_tx(tx);
// run
let err = context.verify_tx(&tx, MAX_CYCLES).unwrap_err();
let script_cell_index = 0;
assert_error_eq!(
err,
ScriptError::ValidationFailure(NFT_DISALLOW_CLAIMED).input_type_script(script_cell_index)
);
} | rust_cleaned_test_functions.jsonl/33595 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 217
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8882,
1089,
723,
9932,
7183,
2346,
21263,
84969,
291,
4096,
368,
341,
262,
1077,
320,
6984,
2266,
11,
9854,
8,
284,
1855,
4452,
8467,
1006,
286,
5586,
486,
4289,
7,
4289,
4207,
486,
45544,
1326,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rotation_between_axis_vectors_vector1() {
let vector = Vector2::new(f64::sqrt(3_f64) / 2_f64, 1_f64 / 2_f64);
let vector1 = Unit::from_value(Vector2::unit_y());
let vector2 = Unit::from_value(Vector2::unit_x());
let rotation = Rotation2::rotation_between_axis(&vector1, &vector2);
let expected = Vector2::new(1_f64 / 2_f64, -f64::sqrt(3_f64) / 2_f64);
let result = rotation.rotate_vector(&vector);
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/70473 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 236
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44813,
48302,
23567,
49158,
12247,
16,
368,
341,
286,
1077,
4621,
284,
4196,
17,
486,
931,
955,
21,
19,
486,
26888,
7,
18,
761,
21,
19,
8,
608,
220,
17,
761,
21,
19,
11,
220,
16,
761,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_resource_leak() {
let res = panic_hook::recover_safe(|| {
let mut v = MustConsumeVec::new("test");
v.push(2);
});
res.unwrap_err();
} | rust_cleaned_test_functions.jsonl/20431 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 115
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17962,
11751,
585,
368,
341,
286,
1077,
592,
284,
21975,
32005,
486,
74283,
34067,
79453,
341,
310,
1077,
5206,
348,
284,
15465,
1109,
31323,
10050,
486,
931,
445,
1944,
797,
310,
348,
2552,
7,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 2 |
#[test]
fn test_alt_shift() {
assert_eq!(
parse_event(b"\x1BH", false).unwrap(),
Some(InternalEvent::Event(Event::Key(KeyEvent::new(
KeyCode::Char('H'),
KeyModifiers::ALT | KeyModifiers::SHIFT
)))),
);
} | rust_cleaned_test_functions.jsonl/21321 | {
"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,
32105,
22230,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
6748,
1883,
11934,
87,
16,
97151,
497,
895,
568,
15454,
3148,
310,
4329,
7,
11569,
1556,
486,
1556,
30469,
486,
1592,
67108,
486,
931,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_execute_cost_table_prune_weighted_table() {
solana_logger::setup();
let capacity: usize = 3;
let mut testee = ExecuteCostTable::new(capacity);
let key1 = Pubkey::new_unique();
let key2 = Pubkey::new_unique();
let key3 = Pubkey::new_unique();
// would still satisfy as key1 has enough occurrences to compensate
// its age.
for i in 0..1000 {
testee.upsert(&key1, i);
}
testee.upsert(&key2, 2);
testee.upsert(&key3, 3);
testee.prune_to(&(capacity - 1));
// expect key2 to be pruned.
assert!(testee.get_cost(&key1).is_some());
assert!(testee.get_cost(&key2).is_none());
assert!(testee.get_cost(&key3).is_some());
} | rust_cleaned_test_functions.jsonl/75384 | {
"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,
44329,
15890,
5237,
5294,
2886,
15876,
291,
5237,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
8654,
25,
22301,
284,
220,
18,
280,
286,
1077,
5206,
1273,
2127,
284,
20848,
14940,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_iter() {
let dir = tempfile::tempdir().unwrap();
let rocksfs = RocksFs::new(dir.path()).unwrap();
for i in 0..10 {
rocksfs.put(&format!("foo{i}"), [i; 128]).unwrap();
}
assert_eq!(rocksfs.number_of_keys().unwrap(), 10);
} | rust_cleaned_test_functions.jsonl/3267 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 278
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
368,
341,
286,
1077,
5419,
284,
54819,
486,
3888,
3741,
1005,
15454,
543,
286,
1077,
23035,
3848,
284,
68031,
48300,
486,
931,
14161,
3875,
6011,
15454,
1428,
286,
369,
600,
304,
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_decode_orn_reg_t2() {
assert_eq!(
decode_32(0xea620205),
Instruction::ORN_reg {
params: Reg3ShiftParams {
rd: Reg::R2,
rn: Reg::R2,
rm: Reg::R5,
setflags: SetFlags::False,
shift_t: SRType::LSL,
shift_n: 0,
}
}
);
} | rust_cleaned_test_functions.jsonl/64870 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 263
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15227,
62,
1512,
4920,
528,
17,
368,
341,
14808,
262,
2060,
10714,
33673,
286,
16895,
62,
18,
17,
7,
15,
56570,
21,
17,
15,
17,
15,
20,
1326,
286,
29051,
486,
45952,
4920,
341,
310,
3628,
25... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pp_types() {
let string = "[ 1 2 ( 3.14 ) #{ 4N } { foo/bar 42 :baz/boz 43 } [ ] :five :six/seven eight nine/ten true false nil #f NaN #f -Infinity #f +Infinity ]";
let data = parse::value(string).unwrap().without_spans();
assert_eq!(
data.to_pretty(40).unwrap(),
"\
[1
2
(3.14)
#{4N}
{:baz/boz 43 foo/bar 42}
[]
:five
:six/seven
eight
nine/ten
true
false
nil
#f NaN
#f -Infinity
#f +Infinity]"
);
} | rust_cleaned_test_functions.jsonl/97801 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 245
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31600,
9763,
368,
341,
286,
1077,
914,
284,
10545,
220,
16,
220,
17,
320,
220,
18,
13,
16,
19,
873,
11273,
220,
19,
45,
335,
314,
15229,
49513,
220,
19,
17,
549,
42573,
14,
749,
89,
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... | 1 |
#[test]
fn test_gga_invalid() {
let mut nmea = Nmea::new();
nmea.parse("$GPGGA,092750.000,5321.6802,S,00630.3372,E,0,8,1.03,61.7,M,55.2,M,,*7B")
.unwrap_err();
assert_eq!(nmea.fix_type(), None);
} | rust_cleaned_test_functions.jsonl/65855 | {
"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,
1889,
6743,
31433,
368,
341,
286,
1077,
5206,
308,
2660,
64,
284,
451,
2660,
64,
486,
931,
543,
286,
308,
2660,
64,
4632,
20912,
38,
11383,
16128,
11,
15,
24,
17,
22,
20,
15,
13,
15,
15,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_maximum_invalid_limit() {
// paging response to include the DEFAULT_LIMIT.
// Also uses the DEFAULT_OFFSET and a total of 1000.
let max_limit: usize = 1001;
let test_paging_response =
get_response_paging_info(max_limit, DEFAULT_OFFSET, TEST_LINK, 1000);
let generated_paging_response =
create_test_paging_response(DEFAULT_LIMIT, DEFAULT_OFFSET, 100, 0, 900);
assert_eq!(test_paging_response, generated_paging_response);
} | rust_cleaned_test_functions.jsonl/20752 | {
"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,
93581,
31433,
14763,
368,
341,
1789,
286,
442,
56287,
2033,
311,
2924,
279,
11955,
29194,
624,
286,
442,
7281,
5711,
279,
11955,
17626,
323,
264,
2790,
315,
220,
16,
15,
15,
15,
624,
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_exchange_bank_client() {
solana_logger::setup();
let (genesis_config, identity) = create_genesis_config(100_000_000_000_000);
let mut bank = Bank::new(&genesis_config);
bank.add_builtin("exchange_program", id(), process_instruction);
let clients = vec![BankClient::new(bank)];
do_bench_exchange(
clients,
Config {
identity,
duration: Duration::from_secs(1),
fund_amount: 100_000,
threads: 1,
transfer_delay: 20,
batch_size: 100,
chunk_size: 10,
account_groups: 1,
..Config::default()
},
);
} | rust_cleaned_test_functions.jsonl/4502 | {
"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,
59212,
35733,
8179,
368,
341,
262,
2048,
3362,
27413,
486,
15188,
543,
262,
1077,
320,
77894,
5332,
11,
9569,
8,
284,
1855,
16322,
13774,
5332,
7,
16,
15,
15,
62,
15,
15,
15,
62,
15,
15,
15,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_filter_all_false_data_block() -> Result<()> {
let schema = DataSchemaRefExt::create(vec![
DataField::new("a", DataType::Int8, false),
DataField::new("b", DataType::String, false),
]);
let block = DataBlock::create_by_array(schema, vec![
Series::new(vec![1i8, 1, 2, 1, 2, 3]),
Series::new(vec!["x1", "x1", "x2", "x1", "x2", "x3"]),
]);
let predicate = Series::new(vec![false, false, false, false, false, false]).into();
let block = DataBlock::filter_block(&block, &predicate)?;
common_datablocks::assert_blocks_eq(
vec!["+---+---+", "| a | b |", "+---+---+", "+---+---+"],
&[block],
);
Ok(())
} | rust_cleaned_test_functions.jsonl/120757 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 322
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8727,
5705,
36015,
1769,
7113,
368,
1464,
5714,
71698,
341,
262,
1077,
10802,
284,
2885,
8632,
3945,
6756,
486,
3182,
25592,
90515,
286,
2885,
1877,
486,
931,
445,
64,
497,
33172,
486,
1072,
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... | 2 |
#[test]
fn test_user_satisfaction() {
let json = r#"
{
"type": "transaction",
"transaction": "foo",
"start_timestamp": "2021-04-26T08:00:00+0100",
"timestamp": "2021-04-26T08:00:01+0100",
"user": {
"id": "user123"
}
}
"#;
let event = Annotated::from_json(json).unwrap();
let config: TransactionMetricsConfig = serde_json::from_str(
r#"
{
"extractMetrics": [
"sentry.transactions.transaction.duration",
"sentry.transactions.user"
],
"satisfactionThresholds": {
"projectThreshold": {
"metric": "duration",
"threshold": 300
},
"extra_key": "should_be_ignored"
}
}
"#,
)
.unwrap();
let mut metrics = vec![];
extract_transaction_metrics(&config, None, event.value().unwrap(), &mut metrics);
assert_eq!(metrics.len(), 2);
for metric in metrics {
assert_eq!(metric.tags.len(), 2);
assert_eq!(metric.tags["satisfaction"], "tolerated");
}
} | rust_cleaned_test_functions.jsonl/21931 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 722
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3317,
643,
51270,
368,
341,
286,
1077,
2951,
284,
435,
2,
698,
286,
341,
310,
330,
1313,
788,
330,
13528,
756,
310,
330,
13528,
788,
330,
7975,
756,
310,
330,
2468,
23073,
788,
330,
17,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_read_raster_as_array() {
let band_index = 1;
let (left, top) = (19, 5);
let (window_size_x, window_size_y) = (3, 4);
let (array_size_x, array_size_y) = (3, 4);
let dataset = Dataset::open(fixture!("tinymarble.png")).unwrap();
let values = dataset
.read_as_array::<u8>(
band_index,
(left, top),
(window_size_x, window_size_y),
(array_size_x, array_size_y),
)
.unwrap();
let data = arr2(&[
[226, 225, 157],
[215, 222, 225],
[213, 231, 229],
[171, 189, 192],
]);
assert_eq!(values, data);
assert_eq!(
dataset.band_type(band_index).unwrap(),
GDALDataType::GDT_Byte
);
} | rust_cleaned_test_functions.jsonl/83444 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 401
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
1710,
2300,
11898,
3858,
368,
341,
262,
1077,
7055,
3560,
284,
220,
16,
280,
262,
1077,
320,
2359,
11,
1909,
8,
284,
320,
16,
24,
11,
220,
20,
317,
262,
1077,
320,
5507,
2368,
3212,
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_hover_self() {
check(
r#"
struct Thing { x: u32 }
impl Thing {
fn new() -> Self { Self<|> { x: 0 } }
}
"#,
expect![[r#"
*Self*
```rust
test
```
```rust
struct Thing
```
"#]],
);
check(
r#"
struct Thing { x: u32 }
impl Thing {
fn new() -> Self<|> { Self { x: 0 } }
}
"#,
expect![[r#"
*Self*
```rust
test
```
```rust
struct Thing
```
"#]],
);
check(
r#"
enum Thing { A }
impl Thing {
pub fn new() -> Self<|> { Thing::A }
}
"#,
expect![[r#"
*Self*
```rust
test
```
```rust
enum Thing
```
"#]],
);
check(
r#"
enum Thing { A }
impl Thing {
pub fn thing(a: Self<|>) {}
}
"#,
expect![[r#"
*Self*
```rust
test
```
```rust
enum Thing
```
"#]],
);
} | rust_cleaned_test_functions.jsonl/105932 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 982
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53445,
25637,
368,
341,
286,
1779,
1006,
310,
435,
2,
698,
1235,
37200,
314,
856,
25,
575,
18,
17,
456,
6383,
37200,
341,
262,
5168,
501,
368,
1464,
10115,
314,
10115,
27,
91,
29,
314,
856,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_not_existing_destination_with_source_dir() {
let tmp_dir = TempDir::new().expect("failed to make tempdir");
let err = Exporter::new(
PathBuf::from("tests/testdata/input/main-samples/"),
tmp_dir.path().to_path_buf().join("does-not-exist"),
)
.run()
.unwrap_err();
match err {
ExportError::PathDoesNotExist { path: _ } => {}
_ => panic!("Wrong error variant: {:?}", err),
}
} | rust_cleaned_test_functions.jsonl/116599 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 201
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
7913,
62630,
56344,
6615,
10347,
4334,
368,
341,
262,
1077,
4174,
4334,
284,
19944,
6184,
486,
931,
1005,
17119,
445,
16091,
311,
1281,
2730,
3741,
3071,
262,
1077,
1848,
284,
22191,
261,
486,
931... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_array_literal() {
let input = "[1, 2 * 2, 3 + 3]";
assert_eq!(
Some(Object::Array(vec![
Object::Int(1),
Object::Int(4),
Object::Int(6),
])),
eval(input),
);
} | rust_cleaned_test_functions.jsonl/12291 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 187
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
34100,
368,
341,
286,
1077,
1946,
284,
10545,
16,
11,
220,
17,
353,
220,
17,
11,
220,
18,
488,
220,
18,
60,
3302,
286,
2060,
10714,
33673,
310,
4329,
12526,
486,
1857,
25592,
90515,
394,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_h16() -> Result<()> {
init();
let mut counter = 0;
let prop = prop::for_all(
|| h16_gen(),
move |s| {
counter += 1;
log::debug!("{:>03}, h16 = {}", counter, s);
let (_, r) = h16(Elms::new(s.as_bytes())).ok().unwrap();
assert_eq!(r, s);
true
},
);
prop::test_with_prop(prop, 5, TEST_COUNT, RNG::new())
} | rust_cleaned_test_functions.jsonl/76906 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 215
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1523,
16,
21,
368,
1464,
5714,
71698,
341,
262,
2930,
543,
262,
1077,
5206,
5546,
284,
220,
15,
280,
262,
1077,
2004,
284,
2004,
486,
1958,
5705,
1006,
414,
1369,
305,
16,
21,
16322,
3148,
414... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_readme() {
let expression = "0 30 9,12,15 1,15 May-Aug Mon,Wed,Fri 2018/2";
let schedule = Schedule::from_str(expression).unwrap();
println!("README: Upcoming fire times for '{}':", expression);
for datetime in schedule.upcoming(Utc).take(10) {
println!("README: -> {}", datetime);
}
} | rust_cleaned_test_functions.jsonl/50801 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 179
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6443,
2660,
368,
341,
286,
1077,
7493,
284,
330,
15,
256,
220,
18,
15,
256,
220,
24,
11,
16,
17,
11,
16,
20,
257,
220,
16,
11,
16,
20,
981,
3217,
61635,
220,
3128,
11,
26503,
27229,
461,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_eh_frame_fde_no_augmentation() {
let instrs = [1, 2, 3, 4];
let cie_offset = 1;
let mut cie = make_test_cie();
cie.format = Format::Dwarf32;
cie.version = 1;
let mut fde = FrameDescriptionEntry {
offset: 0,
length: 0,
format: Format::Dwarf32,
cie: cie.clone(),
initial_segment: 0,
initial_address: 0xfeed_face,
address_range: 9000,
augmentation: None,
instructions: EndianSlice::new(&instrs, LittleEndian),
};
let rest = [1, 2, 3, 4];
let kind = eh_frame_le();
let section = Section::with_endian(kind.endian())
.fde(kind, cie_offset, &mut fde)
.append_bytes(&rest)
.get_contents()
.unwrap();
let section = kind.section(§ion);
let input = &mut section.section().clone();
let result = parse_fde(section, input, |_, _, _| Ok(cie.clone()));
assert_eq!(result, Ok(fde));
assert_eq!(*input, EndianSlice::new(&rest, LittleEndian));
} | rust_cleaned_test_functions.jsonl/9395 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 589
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2204,
71,
8929,
761,
450,
6536,
60411,
31099,
368,
341,
286,
1077,
9491,
82,
284,
508,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
935,
286,
1077,
272,
645,
6917,
284,
220,
16,
401,
286,
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_parse_timestamptz_errors() {
run_test_parse_timestamptz_errors(
"1999-01-01 01:23:34.555 +25:45",
"invalid input syntax for timestamptz: Invalid timezone string \
(+25:45): timezone hour invalid 25: \"1999-01-01 01:23:34.555 +25:45\"",
);
run_test_parse_timestamptz_errors(
"1999-01-01 01:23:34.555 +21:61",
"invalid input syntax for timestamptz: Invalid timezone string \
(+21:61): timezone minute invalid 61: \"1999-01-01 01:23:34.555 +21:61\"",
);
run_test_parse_timestamptz_errors(
"1999-01-01 01:23:34.555 4",
"invalid input syntax for timestamptz: Cannot parse timezone offset 4: \
\"1999-01-01 01:23:34.555 4\"",
);
fn run_test_parse_timestamptz_errors(s: &str, e: &str) {
assert_eq!(
e.to_string(),
format!("{}", strconv::parse_timestamptz(s).unwrap_err())
);
}
} | rust_cleaned_test_functions.jsonl/55841 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 463
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
528,
4255,
309,
417,
89,
20196,
368,
341,
262,
1598,
4452,
21039,
528,
4255,
309,
417,
89,
20196,
1006,
286,
330,
16,
24,
24,
24,
12,
15,
16,
12,
15,
16,
220,
15,
16,
25,
17,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_invalid_signature_format() {
let context = get_context(alice());
testing_env!(context);
let mut contract = BafWalletPK::new();
let sk = secp256k1::SecretKey::default();
let pk = secp256k1::PublicKey::from_secret_key(&sk);
let nonce = 0;
let msg_str = format!("John:{}", nonce);
let msg_hash = keccak256(msg_str.as_bytes());
let msg_hash_array: [u8; 32] = msg_hash.try_into().unwrap();
let msg = secp256k1::Message::parse(&msg_hash_array);
let (sig, _) = secp256k1::sign(&msg, &sk);
let mut faulty_sig = vec![1, 2, 3];
faulty_sig.append(&mut sig.serialize().to_vec());
contract.set_account_info(
"John".to_string(),
pk.serialize().to_vec(),
faulty_sig,
alice(),
);
} | rust_cleaned_test_functions.jsonl/112204 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 430
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31433,
39859,
8955,
368,
341,
286,
1077,
2266,
284,
633,
8467,
17643,
558,
1423,
286,
7497,
15879,
10297,
2147,
317,
286,
1077,
5206,
5116,
284,
425,
2577,
38259,
22242,
486,
931,
543,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_table_builder() {
let mut d = Vec::with_capacity(512);
let mut opt = Options::default();
opt.block_restart_interval = 3;
opt.compression_type = CompressionType::CompressionSnappy;
let mut b = TableBuilder::new(opt, &mut d);
let data = vec![
("abc", "def"),
("abe", "dee"),
("bcd", "asa"),
("dcc", "a00"),
];
let data2 = vec![
("abd", "def"),
("abf", "dee"),
("ccd", "asa"),
("dcd", "a00"),
];
for i in 0..data.len() {
b.add(&data[i].0.as_bytes(), &data[i].1.as_bytes()).unwrap();
b.add(&data2[i].0.as_bytes(), &data2[i].1.as_bytes())
.unwrap();
}
let estimate = b.size_estimate();
assert_eq!(143, estimate);
assert!(b.filter_block.is_some());
let actual = b.finish().unwrap();
// Ensure that something has been written
assert!(!d.is_empty());
// The returned length should be the same as the data size
assert_eq!(d.len(), actual);
} | rust_cleaned_test_functions.jsonl/107472 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 602
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5237,
28532,
368,
341,
286,
1077,
5206,
294,
284,
11312,
486,
4197,
35603,
7,
20,
16,
17,
317,
286,
1077,
5206,
3387,
284,
14566,
486,
2258,
543,
286,
3387,
15697,
69392,
20541,
284,
220,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_solid_onig_invert() {
let mut cmd = assert_cmd::Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap();
cmd.args(&["-s", "-Gog", "\\d+", "-v", "tr", "[:upper:]", "[:lower:]"])
.write_stdin("ABC123EFG\nHIJKLM456")
.assert()
.stdout("abc123efg\nhijklm456");
} | rust_cleaned_test_functions.jsonl/7907 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 181
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
5192,
4470,
343,
1243,
1621,
368,
341,
286,
1077,
5206,
5439,
284,
2060,
11684,
486,
4062,
486,
66715,
21816,
16978,
17223,
34,
7581,
46,
94126,
4708,
15197,
15454,
543,
286,
5439,
16365,
209... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_throttled() {
let bit_pat_isize = throttled("throttled=0x50000").unwrap();
assert_eq!(bit_pat_isize, 327680isize);
assert_eq!(format!("{:b}", &bit_pat_isize), "1010000000000000000");
} | rust_cleaned_test_functions.jsonl/21812 | {
"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,
5854,
46689,
832,
368,
341,
286,
1077,
2699,
55824,
6892,
551,
284,
79972,
832,
445,
339,
46689,
832,
28,
15,
87,
20,
15,
15,
15,
15,
1827,
15454,
543,
286,
2060,
10714,
10297,
4489,
55824,
68... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_new_cohort() {
let json = br#"
{"response":{
"server":"prod",
"protocol":"3.0",
"app":[
{
"appid":"{00000000-0000-0000-0000-000000000001}",
"cohort":"1:3:",
"status":"ok",
"cohortname":"stable",
"updatecheck":{"status":"noupdate"},
"ping":{"status":"ok"}
}
]
}}"#;
let result = parse_json_response(json);
assert!(result.is_ok());
let response = result.unwrap();
let expected = Response {
protocol_version: "3.0".to_string(),
server: "prod".to_string(),
daystart: None,
apps: vec![App {
id: "{00000000-0000-0000-0000-000000000001}".to_string(),
status: OmahaStatus::Ok,
cohort: Cohort {
id: Some("1:3:".to_string()),
hint: None,
name: Some("stable".to_string()),
},
ping: Some(Ping { status: OmahaStatus::Ok }),
update_check: Some(UpdateCheck::no_update()),
..App::default()
}],
};
assert_eq!(response, expected);
} | rust_cleaned_test_functions.jsonl/14135 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 516
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5921,
666,
2267,
371,
368,
341,
262,
1077,
2951,
284,
1411,
2,
698,
4913,
2322,
12602,
330,
4030,
3252,
19748,
756,
330,
17014,
3252,
18,
13,
15,
756,
330,
676,
8899,
198,
220,
341,
256,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_bracket_syntax_success() {
let scenario = TestScenario::new("[");
let mut ucmd = scenario.ucmd();
ucmd.args(&["1", "-eq", "1", "]"]).succeeds();
} | rust_cleaned_test_functions.jsonl/11037 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 81
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17682,
5709,
78894,
18632,
368,
341,
262,
1077,
15048,
284,
3393,
54031,
486,
931,
10937,
797,
262,
1077,
5206,
575,
8710,
284,
15048,
56334,
2277,
1428,
262,
575,
8710,
16365,
2099,
1183,
16,
497... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_meta_item_list_lit() {
run_test(
"#[foo(5)]",
MetaList {
ident: ident("foo").into(),
paren_token: Default::default(),
nested: punctuated![NestedMeta::Literal(lit(Literal::i32_unsuffixed(5)))],
},
)
} | rust_cleaned_test_functions.jsonl/63942 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 156
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13381,
5634,
2019,
98399,
368,
341,
262,
1598,
4452,
1006,
286,
5869,
58,
7975,
7,
20,
7252,
756,
286,
15819,
852,
341,
310,
3524,
25,
3524,
445,
7975,
1827,
18122,
3148,
310,
37940,
6458,
25,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_deserialize_uint() {
let request =
TestInterfaceRequest::from_args(0 /* opcode */, vec![Arg::Uint(UINT_VALUE)]).unwrap();
assert_match!(request, TestInterfaceRequest::Uint{arg} => assert_eq!(arg, UINT_VALUE));
} | rust_cleaned_test_functions.jsonl/55792 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 117
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15768,
9050,
15807,
368,
341,
286,
1077,
1681,
4035,
310,
3393,
5051,
1900,
486,
1499,
8384,
7,
15,
1391,
30028,
36572,
7486,
20703,
2735,
486,
21570,
50075,
7476,
7252,
568,
15454,
1428,
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,
1,
1... | 1 |
#[test]
fn test_multiple_param() {
for multiple_param in vec!["-a", "--multiple"] {
let path = "/foo/bar/baz";
new_ucmd!()
.args(&[multiple_param, path, path])
.succeeds()
.stdout_only("baz\nbaz\n");
}
} | rust_cleaned_test_functions.jsonl/82223 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 147
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45233,
4090,
368,
341,
262,
369,
5248,
4090,
304,
7486,
0,
1183,
12,
64,
497,
14482,
35673,
1341,
341,
286,
1077,
1815,
284,
3521,
7975,
49513,
3470,
1370,
876,
286,
501,
68887,
2277,
0,
741,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_parse_servername_1() {
// IRC standard
let prefix = Some(Pfx::Server("card.freenode.net".to_string()));
let params = vec![
"nickname".to_string(),
"Your host is card.freenode.net[38.229.70.22/6697], running version ircd-seven-1.1.9"
.to_string(),
];
assert_eq!(
parse_servername(prefix.as_ref(), ¶ms),
Some("card.freenode.net".to_owned())
);
let prefix = Some(Pfx::Server("coulomb.oftc.net".to_string()));
let params = vec![
"nickname".to_string(),
"Your host is coulomb.oftc.net[109.74.200.93/6697], running version hybrid-7.2.2+oftc1.7.3".to_string(),
];
assert_eq!(
parse_servername(prefix.as_ref(), ¶ms),
Some("coulomb.oftc.net".to_owned())
);
let prefix = Some(Pfx::Server("irc.eagle.y.se".to_string()));
let params = vec![
"nickname".to_string(),
"Your host is irc.eagle.y.se, running version UnrealIRCd-4.0.18".to_string(),
];
assert_eq!(
parse_servername(prefix.as_ref(), ¶ms),
Some("irc.eagle.y.se".to_owned())
);
} | rust_cleaned_test_functions.jsonl/84772 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 660
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
12015,
606,
62,
16,
368,
341,
286,
442,
59328,
5297,
198,
286,
1077,
9252,
284,
4329,
5304,
8298,
486,
5475,
445,
4951,
833,
4442,
534,
5071,
3263,
983,
3904,
7392,
286,
1077,
3628,
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_apply_auth_bearer_token() -> Result<(), anyhow::Error> {
use hmac::{Hmac, NewMac};
use jwt::SignWithKey;
use sha2::Sha256;
let mut client = Client::default();
let header = jwt::header::Header {
algorithm: jwt::algorithm::AlgorithmType::Hs256,
key_id: None,
type_: None,
content_type: None,
};
let claims: jwt::claims::Claims = Default::default();
let key: Hmac<Sha256> = Hmac::new_from_slice(b"some-secret").unwrap();
let token = jwt::Token::new(header, claims)
.sign_with_key(&key)?
.as_str()
.to_string();
client.tokens.insert(
&Reference::try_from(HELLO_IMAGE_TAG)?,
RegistryOperation::Pull,
RegistryTokenType::Bearer(RegistryToken::Token {
token: token.clone(),
}),
);
assert_eq!(
RequestBuilderWrapper::from_client(&client, |client| client
.get("https://example.com/some/module.wasm"))
.apply_auth(
&Reference::try_from(HELLO_IMAGE_TAG)?,
RegistryOperation::Pull
)?
.into_request_builder()
.build()?
.headers()["Authorization"],
format!("Bearer {}", &token)
);
Ok(())
} | rust_cleaned_test_functions.jsonl/109367 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 736
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
36551,
14014,
880,
20786,
6458,
368,
1464,
5714,
68843,
88964,
486,
1454,
29,
341,
286,
990,
83356,
22964,
39,
11948,
11,
1532,
19552,
2440,
286,
990,
24589,
486,
7264,
2354,
1592,
280,
286,
990,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 6 |
#[test]
fn test_to_string() {
fn test(c: Complex64, s: String) {
assert_eq!(c.to_string(), s);
}
test(_0_0i, "0+0i".to_string());
test(_1_0i, "1+0i".to_string());
test(_0_1i, "0+1i".to_string());
test(_1_1i, "1+1i".to_string());
test(_neg1_1i, "-1+1i".to_string());
test(-_neg1_1i, "1-1i".to_string());
test(_05_05i, "0.5+0.5i".to_string());
} | rust_cleaned_test_functions.jsonl/105660 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 261
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
3904,
368,
341,
286,
5168,
1273,
1337,
25,
22096,
21,
19,
11,
274,
25,
923,
8,
341,
310,
2060,
10714,
10297,
66,
2389,
3904,
1507,
274,
317,
286,
456,
286,
1273,
2490,
15,
62,
15,
72,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_array_octet() {
check([] as [u8; 0], Some(0));
check([0u8, 1, 2], Some(3));
} | rust_cleaned_test_functions.jsonl/79668 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 58
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3858,
70135,
295,
368,
341,
262,
1779,
10556,
438,
508,
84,
23,
26,
220,
15,
1125,
4329,
7,
15,
1106,
262,
1779,
2561,
15,
84,
23,
11,
220,
16,
11,
220,
17,
1125,
4329,
7,
18,
1106,
92
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_50offset_paging_response() {
let test_paging_response = get_response_paging_info(DEFAULT_LIMIT, 50, TEST_LINK, 1000);
let generated_paging_response = create_test_paging_response(DEFAULT_LIMIT, 50, 150, 0, 900);
assert_eq!(test_paging_response, generated_paging_response);
} | rust_cleaned_test_functions.jsonl/18444 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 145
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
20,
15,
3176,
620,
4118,
9655,
368,
341,
1789,
286,
1077,
1273,
620,
4118,
9655,
284,
633,
9655,
620,
4118,
3109,
43175,
29194,
11,
220,
20,
15,
11,
13602,
26147,
11,
220,
16,
15,
15,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_datapoint() {
macro_rules! matches {
($e:expr, $p:pat) => {
match $e {
$p => true,
_ => false,
}
};
}
datapoint!("name", ("field name", "test".to_string(), String));
datapoint!("name", ("field name", 12.34_f64, f64));
datapoint!("name", ("field name", true, bool));
datapoint!("name", ("field name", 1, i64));
datapoint!("name", ("field name", 1, i64),);
datapoint!("name", ("field1 name", 2, i64), ("field2 name", 2, i64));
datapoint!("name", ("field1 name", 2, i64), ("field2 name", 2, i64),);
datapoint!(
"name",
("field1 name", 2, i64),
("field2 name", 2, i64),
("field3 name", 3, i64)
);
datapoint!(
"name",
("field1 name", 2, i64),
("field2 name", 2, i64),
("field3 name", 3, i64),
);
let point = datapoint!(@point "name", ("i64", 1, i64), ("String", "string".to_string(), String), ("f64", 12.34_f64, f64), ("bool", true, bool));
assert_eq!(point.measurement, "name");
assert!(matches!(
point.fields.get("i64").unwrap(),
influxdb::Value::Integer(1)
));
assert!(match point.fields.get("String").unwrap() {
influxdb::Value::String(ref s) => {
if s == "string" {
true
} else {
false
}
}
_ => false,
});
assert!(match point.fields.get("f64").unwrap() {
influxdb::Value::Float(f) => {
if *f == 12.34_f64 {
true
} else {
false
}
}
_ => false,
});
assert!(matches!(
point.fields.get("bool").unwrap(),
influxdb::Value::Boolean(true)
));
} | rust_cleaned_test_functions.jsonl/36630 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1177
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15353,
391,
781,
368,
341,
286,
18072,
21407,
0,
9071,
341,
310,
1711,
68,
96011,
11,
400,
79,
25,
4676,
8,
589,
341,
394,
2432,
400,
68,
341,
503,
400,
79,
589,
830,
345,
503,
716,
589,
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... | 6 |
#[test]
fn test_move_selection_left() {
// check left bounds
let selection = TextSelection::new(0, 0);
let result = move_selection_left(selection);
assert_eq!(result.start(), 0);
assert_eq!(result.end(), 0);
// start == end
let selection = TextSelection::new(1, 1);
let result = move_selection_left(selection);
assert_eq!(result.start(), 0);
assert_eq!(result.end(), 0);
// start < end
let selection = TextSelection::new(4, 6);
let result = move_selection_left(selection);
assert_eq!(result.start(), 4);
assert_eq!(result.end(), 4);
// start > end
let selection = TextSelection::new(6, 4);
let result = move_selection_left(selection);
assert_eq!(result.start(), 4);
assert_eq!(result.end(), 4);
} | rust_cleaned_test_functions.jsonl/61661 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 387
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17134,
23672,
9579,
368,
341,
286,
442,
220,
1779,
2115,
14262,
198,
286,
1077,
6589,
284,
2918,
11177,
486,
931,
7,
15,
11,
220,
15,
317,
286,
1077,
1102,
284,
3271,
23672,
9579,
56361,
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_eq_0() {
let test_res = string_to_ts("foo");
let test_eqs = string_to_ts("foo");
assert_eq!(test_res, test_eqs)
} | rust_cleaned_test_functions.jsonl/47171 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 89
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10714,
62,
15,
368,
341,
286,
1077,
1273,
4918,
284,
914,
2346,
25023,
445,
7975,
797,
286,
1077,
1273,
10714,
82,
284,
914,
2346,
25023,
445,
7975,
797,
286,
2060,
10714,
10297,
1944,
4918,
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 |
#[test]
fn test_depool_3() -> Result<(), Box<dyn std::error::Error>> {
let giver_addr = "0:841288ed3b55d9cdafa806807f02a0ae0c169aa5edfe88a789a6482429756a94";
let depool_abi = "tests/samples/fakeDepool.abi.json";
let seed_phrase = "blanket time net universe ketchup maid way poem scatter blur limit drill";
let config = get_config().unwrap();
let depool_addr = config["addr"].as_str().unwrap();
let msig_addr = config["wallet"].as_str().unwrap();
let mut cmd = Command::cargo_bin(BIN_NAME)?;
cmd.arg("depool")
.arg("--wait-answer")
.arg("stake")
.arg("lock")
.arg("--sign")
.arg(seed_phrase)
.arg("--beneficiary")
.arg(giver_addr)
.arg("--total")
.arg("1")
.arg("--withdrawal")
.arg("1")
.arg("--value")
.arg("2");
cmd.assert()
.success()
.stdout(predicate::str::contains(r#"Answer status: SUCCESS"#));
sleep(Duration::new(2, 0));
let mut cmd = Command::cargo_bin(BIN_NAME)?;
cmd.arg("run")
.arg("--abi")
.arg(depool_abi)
.arg(&depool_addr)
.arg("getData")
.arg("{}");
cmd.assert()
.success()
.stdout(predicate::str::contains(format!(r#"sender": "{}"#, &msig_addr)))
.stdout(predicate::str::contains(r#"stake": "2000000000"#))
.stdout(predicate::str::contains(format!(r#"receiver": "{}"#, giver_addr)))
.stdout(predicate::str::contains(r#"withdrawal": "86400"#))
.stdout(predicate::str::contains(r#"total": "86400"#));
let mut cmd = Command::cargo_bin(BIN_NAME)?;
cmd.arg("depool")
.arg("-a")
.arg("stake")
.arg("vesting")
.arg("--sign")
.arg(seed_phrase)
.arg("--beneficiary")
.arg("0:0123456789012345012345678901234501234567890123450123456789012345")
.arg("--total")
.arg("2")
.arg("--withdrawal")
.arg("2")
.arg("--value")
.arg("4");
cmd.assert()
.success()
.stdout(predicate::str::contains(r#"Answer status: SUCCESS"#));
sleep(Duration::new(2, 0));
let mut cmd = Command::cargo_bin(BIN_NAME)?;
cmd.arg("run")
.arg("--abi")
.arg(depool_abi)
.arg(&depool_addr)
.arg("getData")
.arg("{}");
cmd.assert()
.success()
.stdout(predicate::str::contains(format!(r#"sender": "{}"#, &msig_addr)))
.stdout(predicate::str::contains(r#"stake": "4000000000"#))
.stdout(predicate::str::contains(r#"receiver": "0:0123456789012345012345678901234501234567890123450123456789012345"#))
.stdout(predicate::str::contains(r#"withdrawal": "172800"#))
.stdout(predicate::str::contains(r#"total": "172800"#));
let mut cmd = Command::cargo_bin(BIN_NAME)?;
cmd.arg("depool")
.arg("stake")
.arg("transfer")
.arg("--sign")
.arg(seed_phrase)
.arg("--dest")
.arg(giver_addr)
.arg("--value")
.arg("2");
cmd.assert()
.success()
.stdout(predicate::str::contains(r#"Succeeded."#));
sleep(Duration::new(2, 0));
let mut cmd = Command::cargo_bin(BIN_NAME)?;
cmd.arg("run")
.arg("--abi")
.arg(depool_abi)
.arg(&depool_addr)
.arg("getData")
.arg("{}");
cmd.assert()
.success()
.stdout(predicate::str::contains(format!(r#"sender": "{}"#, &msig_addr)))
.stdout(predicate::str::contains(r#"stake": "2000000000"#))
.stdout(predicate::str::contains(format!(r#"receiver": "{}"#, giver_addr)));
let mut cmd = Command::cargo_bin(BIN_NAME)?;
cmd.arg("depool")
.arg("--wait-answer")
.arg("stake")
.arg("ordinary")
.arg("--sign")
.arg(seed_phrase)
.arg("--value")
.arg("1");
cmd.assert()
.success()
.stdout(predicate::str::contains(r#"Answer status: TOTAL_PERIOD_MORE_18YEARS"#));
sleep(Duration::new(2, 0));
let mut cmd = Command::cargo_bin(BIN_NAME)?;
cmd.arg("run")
.arg("--abi")
.arg(depool_abi)
.arg(&depool_addr)
.arg("getData")
.arg("{}");
cmd.assert()
.success()
.stdout(predicate::str::contains(format!(r#"sender": "{}"#, &msig_addr)))
.stdout(predicate::str::contains(r#"stake": "1000000000"#));
Ok(())
} | rust_cleaned_test_functions.jsonl/118336 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 2260
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2259,
10285,
62,
18,
368,
1464,
5714,
68843,
8261,
92846,
1460,
486,
841,
486,
1454,
2452,
341,
262,
1077,
94515,
7387,
284,
330,
15,
25,
23,
19,
16,
17,
23,
23,
291,
18,
65,
20,
20,
67,
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... | 9 |
#[test]
fn test_aggregate_partition_bad_sum() {
let metrics = ExecutionPlanMetricsSet::new();
let count = MetricBuilder::new(&metrics).counter("my_metric", 1);
count.add(1);
let time = MetricBuilder::new(&metrics).subset_time("my_metric", 1);
time.add_duration(Duration::from_nanos(10));
// can't aggregate time and count -- expect a panic
metrics.clone_inner().aggregate_by_partition();
} | rust_cleaned_test_functions.jsonl/28187 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 188
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20587,
14240,
43840,
34199,
10160,
368,
341,
286,
1077,
16734,
284,
30928,
20485,
27328,
1649,
486,
931,
1428,
286,
1077,
1760,
284,
52458,
3297,
486,
931,
2099,
43262,
568,
8292,
445,
2408,
41294,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_single_file_to_dir() {
let tmp_dir = TempDir::new().expect("failed to make tempdir");
Exporter::new(
PathBuf::from("tests/testdata/input/single-file/note.md"),
tmp_dir.path().to_path_buf(),
)
.run()
.unwrap();
assert_eq!(
read_to_string("tests/testdata/expected/single-file/note.md").unwrap(),
read_to_string(tmp_dir.path().clone().join(PathBuf::from("note.md"))).unwrap(),
);
} | rust_cleaned_test_functions.jsonl/116596 | {
"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,
19487,
2458,
2346,
4334,
368,
341,
262,
1077,
4174,
4334,
284,
19944,
6184,
486,
931,
1005,
17119,
445,
16091,
311,
1281,
2730,
3741,
797,
262,
22191,
261,
486,
931,
1006,
286,
7933,
15064,
486,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_timestamp_order() {
let mut qb = QueuedBatches::default();
// Add an event at time 1
qb.add_event(InputLogEvent {
message: "".to_string(),
timestamp: 1,
})
.unwrap();
assert_eq!(qb.batches.len(), 1);
qb.add_event(InputLogEvent {
message: "".to_string(),
timestamp: 0,
})
.unwrap();
assert_eq!(qb.batches.len(), 1);
} | rust_cleaned_test_functions.jsonl/96497 | {
"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,
23073,
7869,
368,
341,
286,
1077,
5206,
75807,
284,
9418,
3260,
33,
9118,
486,
2258,
1428,
286,
442,
2691,
458,
1538,
518,
882,
220,
16,
198,
286,
75807,
1364,
6748,
29773,
2201,
1556,
341,
310,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dump_items_serialize_hex() {
let result_a = DumpItems::default();
let res = result_a.to_hex();
assert!(res.is_ok());
let hex = res.unwrap();
let res = DumpItems::from_hex(&hex);
assert!(res.is_ok());
let result_b = res.unwrap();
assert_eq!(result_a, result_b);
} | rust_cleaned_test_functions.jsonl/126651 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 147
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
18296,
12134,
88686,
32655,
368,
341,
262,
1077,
1102,
4306,
284,
29693,
4353,
486,
2258,
543,
1066,
262,
1077,
592,
284,
1102,
4306,
2389,
32655,
543,
262,
2060,
10297,
416,
2079,
19817,
1423,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_convert_sparse_merkle_proof_wrong_number_of_siblings() {
let sibling0 = b"0".test_only_hash();
let sibling1 = b"1".test_only_hash();
let mut compressed_proof = crate::proto::proof::SparseMerkleProof::new();
compressed_proof.mut_bitmap().push(0b1000_0000);
compressed_proof
.mut_non_default_siblings()
.push(sibling0.to_vec());
compressed_proof
.mut_non_default_siblings()
.push(sibling1.to_vec());
assert!(SparseMerkleProof::from_proto(compressed_proof).is_err());
} | rust_cleaned_test_functions.jsonl/103132 | {
"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,
34910,
71123,
717,
16754,
273,
86757,
75198,
5500,
3575,
643,
24229,
368,
341,
262,
1077,
44223,
15,
284,
293,
1,
15,
3263,
1944,
18410,
8950,
543,
262,
1077,
44223,
16,
284,
293,
1,
16,
3263,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_trim_3_args() {
let tests = vec![
("xxxbarxxx", "x", TrimDirection::Leading as i64, "barxxx"),
("barxxyz", "xyz", TrimDirection::Trailing as i64, "barx"),
("xxxbarxxx", "x", TrimDirection::Both as i64, "bar"),
];
for (s, pat, direction, exp) in tests {
let s = Datum::Bytes(s.as_bytes().to_vec());
let pat = Datum::Bytes(pat.as_bytes().to_vec());
let direction = Datum::I64(direction);
let exp = Datum::Bytes(exp.as_bytes().to_vec());
let got = eval_func(ScalarFuncSig::Trim3Args, &[s, pat, direction]).unwrap();
assert_eq!(got, exp);
}
let invalid_tests = vec![
(
Datum::Null,
Datum::Bytes(b"x".to_vec()),
Datum::I64(TrimDirection::Leading as i64),
Datum::Null,
),
(
Datum::Bytes(b"bar".to_vec()),
Datum::Null,
Datum::I64(TrimDirection::Leading as i64),
Datum::Null,
),
];
for (s, pat, direction, exp) in invalid_tests {
let got = eval_func(ScalarFuncSig::Trim3Args, &[s, pat, direction]).unwrap();
assert_eq!(got, exp);
}
// test invalid direction value
let args = [
Datum::Bytes(b"bar".to_vec()),
Datum::Bytes(b"b".to_vec()),
Datum::I64(0),
];
let got = eval_func(ScalarFuncSig::Trim3Args, &args);
assert!(got.is_err());
} | rust_cleaned_test_functions.jsonl/9111 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 898
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70025,
62,
18,
8384,
368,
341,
286,
1077,
7032,
284,
7486,
90515,
310,
3489,
24048,
2257,
24048,
497,
330,
87,
497,
44376,
9268,
486,
69750,
438,
600,
21,
19,
11,
330,
2257,
24048,
4461,
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... | 3 |
#[test]
fn test_placeholder_regex() {
let regex = make_placeholder_regex(&["placeholder"]);
assert_eq!(
parse_line_number_format("prefix {placeholder:<15.14} suffix", ®ex, false),
vec![FormatStringPlaceholderData {
prefix: "prefix ".into(),
placeholder: Some(Placeholder::Str("placeholder")),
alignment_spec: Some(Align::Left),
width: Some(15),
precision: Some(14),
suffix: " suffix".into(),
prefix_len: 7,
suffix_len: 7,
}]
);
} | rust_cleaned_test_functions.jsonl/106279 | {
"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,
60383,
41832,
368,
341,
286,
1077,
20180,
284,
1281,
60383,
41832,
2099,
1183,
12384,
15049,
286,
2060,
10714,
33673,
310,
4715,
6528,
5500,
8955,
445,
11849,
314,
12384,
31252,
16,
20,
13,
16,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_process_blockstore_with_incomplete_slot() {
solana_logger::setup();
let GenesisConfigInfo { genesis_config, .. } = create_genesis_config(10_000);
let ticks_per_slot = genesis_config.ticks_per_slot;
// Create a new ledger with slot 0 full of ticks
let (ledger_path, mut blockhash) = create_new_tmp_ledger!(&genesis_config);
debug!("ledger_path: {:?}", ledger_path);
let blockstore =
Blockstore::open(&ledger_path).expect("Expected to successfully open database ledger");
// Write slot 1
{
let parent_slot = 0;
let slot = 1;
let mut entries = create_ticks(ticks_per_slot, 0, blockhash);
blockhash = entries.last().unwrap().hash;
// throw away last one
entries.pop();
assert_matches!(
blockstore.write_entries(
slot,
0,
0,
ticks_per_slot,
Some(parent_slot),
false,
&Arc::new(Keypair::new()),
entries,
0,
),
Ok(_)
);
}
fill_blockstore_slot_with_ticks(&blockstore, ticks_per_slot, 2, 1, blockhash);
let opts = ProcessOptions {
poh_verify: true,
accounts_db_test_hash_calculation: true,
..ProcessOptions::default()
};
let (bank_forks, _leader_schedule) =
process_blockstore(&genesis_config, &blockstore, Vec::new(), opts, None).unwrap();
assert_eq!(frozen_bank_slots(&bank_forks), vec![0]);
let opts = ProcessOptions {
poh_verify: true,
accounts_db_test_hash_calculation: true,
..ProcessOptions::default()
};
fill_blockstore_slot_with_ticks(&blockstore, ticks_per_slot, 3, 0, blockhash);
// Slot 0 should not show up in the ending bank_forks_info
let (bank_forks, _leader_schedule) =
process_blockstore(&genesis_config, &blockstore, Vec::new(), opts, None).unwrap();
assert_eq!(frozen_bank_slots(&bank_forks), vec![0, 3]);
} | rust_cleaned_test_functions.jsonl/70843 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1190
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
7113,
4314,
6615,
1243,
14737,
27563,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
1428,
286,
1077,
40788,
2648,
1731,
314,
59366,
5332,
11,
5241,
335,
284,
1855,
16322,
13774,
5332,
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_or() {
assert_eq!(false, or(false, false));
assert_eq!(true, or(true, false));
assert_eq!(true, or(false, true));
assert_eq!(true, or(true, true));
} | rust_cleaned_test_functions.jsonl/90314 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 79
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8734,
368,
341,
220,
2060,
10714,
10297,
3849,
11,
476,
3576,
11,
895,
1106,
220,
2060,
10714,
10297,
1866,
11,
476,
3715,
11,
895,
1106,
220,
2060,
10714,
10297,
1866,
11,
476,
3576,
11,
830,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_data_from_helpers() {
let mut nonce_account = nonce_account::create_account(1).into_inner();
let state = state_from_account(&nonce_account).unwrap();
assert_eq!(
data_from_state(&state),
Err(Error::InvalidStateForOperation)
);
assert_eq!(
data_from_account(&nonce_account),
Err(Error::InvalidStateForOperation)
);
let data = nonce::state::Data {
authority: Pubkey::new(&[1u8; 32]),
blockhash: Hash::new(&[42u8; 32]),
fee_calculator: FeeCalculator::new(42),
};
nonce_account
.set_state(&Versions::new_current(State::Initialized(data.clone())))
.unwrap();
let state = state_from_account(&nonce_account).unwrap();
assert_eq!(data_from_state(&state), Ok(&data));
assert_eq!(data_from_account(&nonce_account), Ok(data));
} | rust_cleaned_test_functions.jsonl/18822 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 455
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1769,
5673,
54473,
368,
341,
286,
1077,
5206,
39676,
13500,
284,
39676,
13500,
486,
3182,
13500,
7,
16,
568,
18122,
34345,
543,
286,
1077,
1584,
284,
1584,
5673,
13500,
2099,
39593,
13500,
568,
15... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tree() {
let mut tree = Tree::new(&[
String::from("│"),
String::from("─"),
String::from("┬"),
String::from("├"),
String::from("└"),
]);
let p0 = ProcessInfo {
pid: 0,
ppid: 0,
curr_proc: ProcessTask::Process(Process::myself().unwrap()),
prev_proc: ProcessTask::Process(Process::myself().unwrap()),
curr_io: None,
prev_io: None,
curr_status: None,
interval: Duration::new(0, 0),
};
let p1 = ProcessInfo {
pid: 1,
ppid: 0,
curr_proc: ProcessTask::Process(Process::myself().unwrap()),
prev_proc: ProcessTask::Process(Process::myself().unwrap()),
curr_io: None,
prev_io: None,
curr_status: None,
interval: Duration::new(0, 0),
};
let p2 = ProcessInfo {
pid: 2,
ppid: 1,
curr_proc: ProcessTask::Process(Process::myself().unwrap()),
prev_proc: ProcessTask::Process(Process::myself().unwrap()),
curr_io: None,
prev_io: None,
curr_status: None,
interval: Duration::new(0, 0),
};
tree.add(&p0);
tree.add(&p1);
tree.add(&p2);
tree.update_width(0, None);
tree.update_width(1, None);
tree.update_width(2, None);
assert_eq!(
format!(
"{}",
tree.display_content(0, &crate::config::ConfigColumnAlign::Left)
.unwrap()
),
String::from("├┬────")
);
assert_eq!(
format!(
"{}",
tree.display_content(1, &crate::config::ConfigColumnAlign::Left)
.unwrap()
),
String::from("│└┬───")
);
assert_eq!(
format!(
"{}",
tree.display_content(2, &crate::config::ConfigColumnAlign::Left)
.unwrap()
),
String::from("│ └───")
);
} | rust_cleaned_test_functions.jsonl/27873 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1290
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11663,
368,
341,
286,
1077,
5206,
4916,
284,
8942,
486,
931,
2099,
9640,
310,
923,
486,
1499,
445,
72887,
4461,
310,
923,
486,
1499,
445,
14555,
4461,
310,
923,
486,
1499,
445,
146206,
4461,
310... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_one_leaf() {
let hash = HashValue::random();
let mut store = MockHashStore::new();
let (root_hash, writes) = TestAccumulator::append(&store, 0, &[hash]).unwrap();
store.put_many(&writes);
verify(&store, 1, root_hash, &[hash], 0)
} | rust_cleaned_test_functions.jsonl/52439 | {
"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,
11667,
38909,
368,
341,
262,
1077,
5175,
284,
6531,
1130,
486,
11463,
543,
262,
1077,
5206,
3553,
284,
14563,
6370,
6093,
486,
931,
543,
262,
1077,
320,
2888,
8950,
11,
13914,
8,
284,
3393,
1460... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_small_needle() {
let haystack = "111 a 111b";
rsearch_test!(haystack, "a", Some(4));
rsearch_test!(haystack, "a 111", Some(4));
} | rust_cleaned_test_functions.jsonl/19418 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 94
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31966,
71506,
273,
368,
341,
286,
1077,
88447,
284,
330,
16,
16,
16,
264,
220,
16,
16,
16,
65,
876,
286,
435,
1836,
4452,
10297,
67312,
7693,
11,
330,
64,
497,
4329,
7,
19,
1106,
286,
435,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_process_completedblock_with_submit_block_failure() {
let block = get_block(0);
let mut rpc = MockRpc::new();
rpc.should_call_submitblock(Err(Error::JsonRpc(jsonrpc::error::Error::Rpc(
jsonrpc::error::RpcError {
code: -25,
message: "proposal was not based on our best chain".to_string(),
data: None,
},
))));
let params = NodeParametersBuilder::new().rpc(rpc).build();
let prev_state = Member::for_test().master_index(0).build();
let sender_id = SignerID::new(TEST_KEYS.pubkeys()[0]);
let state = process_completedblock(&sender_id, &block, &prev_state, ¶ms);
params.rpc.assert();
match &state {
NodeState::RoundComplete {
next_master_index, ..
} => assert_eq!(*next_master_index, 1),
n => assert!(false, "Should be RoundComplete, but the state is {:?}", n),
}
} | rust_cleaned_test_functions.jsonl/63310 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 484
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
49068,
4574,
6615,
31674,
7113,
43618,
368,
341,
286,
1077,
2504,
284,
633,
7113,
7,
15,
317,
286,
1077,
5206,
35596,
284,
14563,
60248,
486,
931,
543,
286,
35596,
15507,
13429,
31674,
4574... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_around_0_ok() {
let env = env_1!();
let in_w = super::IN_DAT_TARGET_LIST.to_string();
let (r, sioe) = do_execute!(
&env,
&["-e", "musl", "--color", "always", "--around", "0"],
in_w.as_str(),
);
assert_eq!(buff!(sioe, serr), "");
assert_eq!(
buff!(sioe, sout),
concat!(
"aarch64-unknown-linux-<S>musl<E> (installed)\n",
"arm-unknown-linux-<S>musl<E>eabi\n",
"arm-unknown-linux-<S>musl<E>eabihf\n",
"armv5te-unknown-linux-<S>musl<E>eabi\n",
"armv7-unknown-linux-<S>musl<E>eabi\n",
"armv7-unknown-linux-<S>musl<E>eabihf (installed)\n",
"i586-unknown-linux-<S>musl<E>\n",
"i686-unknown-linux-<S>musl<E> (installed)\n",
"mips-unknown-linux-<S>musl<E>\n",
"mips64-unknown-linux-<S>musl<E>abi64\n",
"mips64el-unknown-linux-<S>musl<E>abi64 (installed)\n",
"mipsel-unknown-linux-<S>musl<E> (installed)\n",
"x86_64-unknown-linux-<S>musl<E> (installed)\n",
)
);
assert_eq!(r.is_ok(), true);
} | rust_cleaned_test_functions.jsonl/62182 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 785
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
19454,
62,
15,
19817,
368,
341,
286,
1077,
6105,
284,
6105,
62,
16,
0,
543,
286,
1077,
304,
1670,
284,
2256,
486,
687,
36347,
29299,
11899,
2389,
3904,
543,
286,
1077,
320,
81,
11,
274,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_len() {
let gil = Python::acquire_gil();
let py = gil.python();
let ob = (1, 2, 3).to_object(py);
let tuple = <PyTuple as PyTryFrom>::try_from(ob.as_ref(py)).unwrap();
assert_eq!(3, tuple.len());
let ob: &PyAny = tuple.into();
assert_eq!((1, 2, 3), ob.extract().unwrap());
} | rust_cleaned_test_functions.jsonl/4177 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 182
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6043,
368,
341,
286,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
286,
1077,
4510,
284,
342,
321,
43193,
543,
286,
1077,
1508,
284,
320,
16,
11,
220,
17,
11,
220,
18,
568,
983,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_rsqrt() {
let nan: f64 = Float::nan();
let inf: f64 = Float::infinity();
let neg_inf: f64 = Float::neg_infinity();
assert!(nan.rsqrt().is_nan());
assert_eq!(inf.rsqrt(), 0.0);
assert!(neg_inf.rsqrt().is_nan());
assert!((-1.0f64).rsqrt().is_nan());
assert_eq!((-0.0f64).rsqrt(), neg_inf);
assert_eq!(0.0f64.rsqrt(), inf);
assert_eq!(1.0f64.rsqrt(), 1.0);
assert_eq!(4.0f64.rsqrt(), 0.5);
} | rust_cleaned_test_functions.jsonl/7446 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 284
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1710,
26888,
368,
341,
286,
1077,
20021,
25,
282,
21,
19,
284,
13001,
486,
18759,
543,
286,
1077,
4132,
25,
282,
21,
19,
284,
13001,
486,
80016,
543,
286,
1077,
4184,
26051,
25,
282,
21,
19,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_to_pretty_hex() {
assert_eq!(to_pretty_hex(0x0), "0x0");
assert_eq!(to_pretty_hex(0x12), "0x12");
assert_eq!(to_pretty_hex(0x123), "0x123");
assert_eq!(to_pretty_hex(0x1234), "0x1234");
assert_eq!(to_pretty_hex(0x12345), "0x1_2345");
assert_eq!(to_pretty_hex(0x123456), "0x12_3456");
assert_eq!(to_pretty_hex(0x1234567), "0x123_4567");
assert_eq!(to_pretty_hex(0x12345678), "0x1234_5678");
assert_eq!(to_pretty_hex(0x123456789), "0x1_2345_6789");
} | rust_cleaned_test_functions.jsonl/17922 | {
"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,
2346,
620,
21322,
32655,
368,
341,
286,
2060,
10714,
10297,
983,
620,
21322,
32655,
7,
15,
87,
15,
701,
260,
330,
15,
87,
15,
797,
286,
2060,
10714,
10297,
983,
620,
21322,
32655,
7,
15,
87,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fullscreen() {
let client = setup_vlc();
let is_fullscreen = client.root.fullscreen().unwrap().unwrap();
client.root.set_fullscreen(!is_fullscreen).unwrap();
std::thread::sleep(std::time::Duration::from_millis(200));
let is_fullscreen2 = client.root.fullscreen().unwrap().unwrap();
assert!(!is_fullscreen, is_fullscreen2);
} | rust_cleaned_test_functions.jsonl/86480 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 143
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
16372,
8174,
368,
341,
262,
1077,
2943,
284,
6505,
2273,
17257,
543,
262,
1077,
374,
16372,
8174,
284,
2943,
12576,
21534,
8174,
1005,
15454,
1005,
15454,
543,
262,
2943,
12576,
980,
16372,
8174,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_cfi_entry_on_cie_32_ok() {
let expected_rest = [1, 2, 3, 4, 5, 6, 7, 8, 9];
let expected_instrs: Vec<_> = (0..4).map(|_| constants::DW_CFA_nop.0).collect();
let mut cie = CommonInformationEntry {
offset: 0,
length: 0,
format: Format::Dwarf32,
version: 4,
augmentation: None,
address_size: 4,
segment_size: 0,
code_alignment_factor: 16,
data_alignment_factor: 32,
return_address_register: Register(1),
initial_instructions: EndianSlice::new(&expected_instrs, BigEndian),
};
let kind = debug_frame_be();
let section = Section::with_endian(kind.endian())
.cie(kind, None, &mut cie)
.append_bytes(&expected_rest);
let section = section.get_contents().unwrap();
let debug_frame = kind.section(§ion);
let rest = &mut EndianSlice::new(§ion, BigEndian);
let bases = Default::default();
assert_eq!(
parse_cfi_entry(&bases, &debug_frame, rest),
Ok(Some(CieOrFde::Cie(cie)))
);
assert_eq!(*rest, EndianSlice::new(&expected_rest, BigEndian));
} | rust_cleaned_test_functions.jsonl/9309 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 634
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
666,
9983,
9078,
4470,
666,
645,
62,
18,
17,
19817,
368,
341,
286,
1077,
3601,
32231,
284,
508,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,
11,
220,
22,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_as_str_ref() {
assert_eq!("beacon_block", BeaconBlock.as_ref());
assert_eq!(
"beacon_aggregate_and_proof",
BeaconAggregateAndProof.as_ref()
);
assert_eq!(
"beacon_attestation",
Attestation(SubnetId::new(42)).as_ref()
);
assert_eq!("voluntary_exit", VoluntaryExit.as_ref());
assert_eq!("proposer_slashing", ProposerSlashing.as_ref());
assert_eq!("attester_slashing", AttesterSlashing.as_ref());
} | rust_cleaned_test_functions.jsonl/131038 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 270
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11898,
2895,
7793,
368,
341,
286,
2060,
10714,
17223,
1371,
22379,
7113,
497,
58620,
4713,
5357,
7793,
1423,
286,
2060,
10714,
33673,
310,
330,
1371,
22379,
20587,
14240,
8378,
86757,
756,
310,
5862... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_format_docs_handles_non_rust() {
let comment = "```sh\nsupposedly shell code\n```";
assert_eq!(format_docs(comment), "```sh\nsupposedly shell code\n```");
} | rust_cleaned_test_functions.jsonl/57084 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 93
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8955,
49692,
68017,
21637,
1710,
590,
368,
341,
286,
1077,
3980,
284,
330,
73594,
927,
1699,
12776,
3865,
398,
12528,
2038,
1699,
73594,
876,
286,
2060,
10714,
10297,
2243,
49692,
39327,
701,
330,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_entities_crud() {
let mut world = World::default();
// Create
let e0 = world.create_entity(());
assert!(world.contains_entity(e0));
assert_eq!(world.entities(), &[e0]);
// Destroy
assert!(world.destroy_entity(e0));
assert!(!world.destroy_entity(e0));
assert!(!world.contains_entity(e0));
assert_eq!(world.entities(), &[]);
// Clear
let e0 = world.create_entity(());
let e1 = world.create_entity(());
world.clear_entities();
assert!(!world.contains_entity(e0));
assert!(!world.contains_entity(e1));
assert_eq!(world.entities(), &[]);
} | rust_cleaned_test_functions.jsonl/32641 | {
"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,
47377,
32331,
661,
368,
341,
262,
1077,
5206,
1879,
284,
4337,
486,
2258,
1428,
262,
442,
4230,
198,
262,
1077,
384,
15,
284,
1879,
2520,
19169,
7,
1423,
262,
2060,
10297,
14615,
8786,
19169,
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_kernel_cmdline_err_to_startuvm_err() {
let err = StartMicrovmError::from(linux_loader::cmdline::Error::HasSpace);
let _ = format!("{}{:?}", err, err);
} | rust_cleaned_test_functions.jsonl/4359 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 89
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
26876,
11684,
1056,
9266,
2346,
4906,
84,
7338,
9266,
368,
341,
286,
1077,
1848,
284,
5145,
34609,
7338,
1454,
486,
1499,
2333,
19559,
22139,
486,
8710,
1056,
486,
1454,
486,
10281,
9914,
317,
286... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_vec4mask_fmt() {
let a = Vec4Mask::new(true, false, true, false);
assert_eq!(format!("{}", a), "[true, false, true, false]");
assert_eq!(
format!("{:?}", a),
"Vec4Mask(0xffffffff, 0x0, 0xffffffff, 0x0)"
);
} | rust_cleaned_test_functions.jsonl/68880 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 136
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
19,
11258,
38128,
368,
341,
262,
1077,
264,
284,
11312,
19,
12686,
486,
931,
3715,
11,
895,
11,
830,
11,
895,
626,
262,
2060,
10714,
10297,
2243,
79878,
264,
701,
10545,
1866,
11,
895,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_req_route_query_collisions() {
assert!(req_route_path_collide("/a/b?a=b", "/a/b?<c>"));
assert!(req_route_path_collide("/a/b?a=b", "/<a>/b?<c>"));
assert!(req_route_path_collide("/a/b?a=b", "/<a>/<b>?<c>"));
assert!(req_route_path_collide("/a/b?a=b", "/a/<b>?<c>"));
assert!(req_route_path_collide("/?b=c", "/?<b>"));
assert!(req_route_path_collide("/a/b?a=b", "/a/b"));
assert!(req_route_path_collide("/a/b", "/a/b"));
assert!(req_route_path_collide("/a/b/c/d?", "/a/b/c/d"));
assert!(req_route_path_collide("/a/b/c/d?v=1&v=2", "/a/b/c/d"));
assert!(!req_route_path_collide("/a/b", "/a/b?<c>"));
assert!(!req_route_path_collide("/a/b/c", "/a/b?<c>"));
assert!(!req_route_path_collide("/a?b=c", "/a/b?<c>"));
assert!(!req_route_path_collide("/?b=c", "/a/b?<c>"));
assert!(!req_route_path_collide("/?b=c", "/a?<c>"));
} | rust_cleaned_test_functions.jsonl/67669 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 559
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17644,
28109,
5738,
43597,
6805,
368,
341,
286,
2060,
10297,
2958,
28109,
2638,
43597,
577,
4283,
64,
3470,
98461,
22086,
497,
3521,
64,
3470,
75414,
66,
29,
4010,
286,
2060,
10297,
2958,
28109,
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_string_json_equal() {
// Test the equal case
let arrow_array =
StringArray::from(vec![Some("hello"), None, None, Some("world"), None, None]);
let json_array: Value = serde_json::from_str(
r#"
[
"hello",
null,
null,
"world",
null,
null
]
"#,
)
.unwrap();
assert!(arrow_array.eq(&json_array));
assert!(json_array.eq(&arrow_array));
// Test unequal case
let arrow_array =
StringArray::from(vec![Some("hello"), None, None, Some("world"), None, None]);
let json_array: Value = serde_json::from_str(
r#"
[
"hello",
null,
null,
"arrow",
null,
null
]
"#,
)
.unwrap();
assert!(arrow_array.ne(&json_array));
assert!(json_array.ne(&arrow_array));
// Test unequal length case
let arrow_array =
StringArray::from(vec![Some("hello"), None, None, Some("world"), None]);
let json_array: Value = serde_json::from_str(
r#"
[
"hello",
null,
null,
"arrow",
null,
null
]
"#,
)
.unwrap();
assert!(arrow_array.ne(&json_array));
assert!(json_array.ne(&arrow_array));
// Test incorrect type case
let arrow_array =
StringArray::from(vec![Some("hello"), None, None, Some("world"), None]);
let json_array: Value = serde_json::from_str(
r#"
{
"a": 1
}
"#,
)
.unwrap();
assert!(arrow_array.ne(&json_array));
assert!(json_array.ne(&arrow_array));
// Test incorrect value type case
let arrow_array =
StringArray::from(vec![Some("hello"), None, None, Some("world"), None]);
let json_array: Value = serde_json::from_str(
r#"
[
"hello",
null,
null,
1,
null,
null
]
"#,
)
.unwrap();
assert!(arrow_array.ne(&json_array));
assert!(json_array.ne(&arrow_array));
} | rust_cleaned_test_functions.jsonl/897 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1475
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
9455,
11478,
368,
341,
286,
442,
3393,
279,
6144,
1142,
198,
286,
1077,
17921,
3858,
4035,
310,
923,
1857,
486,
1499,
25592,
20703,
8373,
445,
14990,
3975,
2240,
11,
2240,
11,
4329,
445,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_saturating_sub_int() {
use isize::{MIN,MAX};
assert_eq!(3.saturating_sub(5), -2);
assert_eq!(MIN.saturating_sub(1), MIN);
assert_eq!((-2).saturating_sub(MAX), MIN);
assert_eq!(3.saturating_sub(-5), 8);
assert_eq!(3.saturating_sub(-(MAX-1)), MAX);
assert_eq!(MAX.saturating_sub(-MAX), MAX);
assert_eq!((MAX-2).saturating_sub(-1), MAX-1);
} | rust_cleaned_test_functions.jsonl/25374 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 229
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
643,
2628,
1095,
5228,
4042,
368,
341,
286,
990,
91373,
22964,
16413,
11,
10586,
2440,
286,
2060,
10714,
10297,
18,
514,
2628,
1095,
5228,
7,
20,
701,
481,
17,
317,
286,
2060,
10714,
10297,
1641... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_context_with_one_parent() {
let parent = Context::top_level();
let context = Context::new(Some(&parent));
assert_eq!(context.get("red"), Expr::String("red".to_owned()));
} | rust_cleaned_test_functions.jsonl/1906 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 95
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8467,
6615,
11667,
15960,
368,
341,
286,
1077,
2681,
284,
9608,
486,
3481,
8274,
543,
286,
1077,
2266,
284,
9608,
486,
931,
65405,
2099,
3765,
3237,
286,
2060,
10714,
10297,
2147,
670,
445,
1151,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_bool_character() {
context!(ctx, dev);
execute_str!(ctx, b"*BOOL? ON;*BOOL? OFF" => result, response {
assert_eq!(result, Ok(()));
assert_eq!(response, b"1;0\n");
});
execute_str!(ctx, b"*BOOL? POTATO" => result, _response {
assert_eq!(result, Err(Error::from(ErrorCode::IllegalParameterValue)));
});
execute_str!(ctx, b"*BOOL? (@1)" => result, _response {
assert_eq!(result, Err(Error::from(ErrorCode::DataTypeError)));
});
} | rust_cleaned_test_functions.jsonl/82176 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 288
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22159,
40988,
368,
341,
286,
2266,
10297,
3773,
11,
3483,
317,
1789,
286,
9026,
2895,
10297,
3773,
11,
293,
61593,
10395,
30,
6197,
26,
9,
10395,
30,
17611,
1,
589,
1102,
11,
2033,
341,
310,
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_size_cap() {
let str_pool : Pool<String> = Pool::with_size_and_max(1, 1);
{
assert_eq!(1, str_pool.size());
let _rstring = str_pool.new_from("dog");
let _rstring2 = str_pool.new_from("cat");
assert_eq!(0, str_pool.size());
}
assert_eq!(1, str_pool.size());
} | rust_cleaned_test_functions.jsonl/121195 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 174
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2368,
16388,
368,
341,
414,
1077,
607,
15709,
549,
22728,
3464,
29,
284,
22728,
486,
4197,
2368,
8378,
6345,
7,
16,
11,
220,
16,
317,
414,
341,
286,
2060,
10714,
10297,
16,
11,
607,
15709,
248... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_no_deletion_due_to_rent_upon_rent_for_sysvar_activation() {
solana_logger::setup();
let (mut genesis_config, _mint_keypair) = create_genesis_config(0);
let feature_balance =
std::cmp::max(genesis_config.rent.minimum_balance(Feature::size_of()), 1);
// activate all features but rent_for_sysvars
activate_all_features(&mut genesis_config);
genesis_config
.accounts
.remove(&feature_set::rent_for_sysvars::id());
let bank0 = Bank::new(&genesis_config);
let bank1 = Arc::new(new_from_parent(&Arc::new(bank0)));
// schedule activation of simple capitalization
bank1.store_account_and_update_capitalization(
&feature_set::rent_for_sysvars::id(),
&feature::create_account(&Feature { activated_at: None }, feature_balance),
);
let bank2 =
Bank::new_from_parent(&bank1, &Pubkey::default(), bank1.first_slot_in_next_epoch());
assert_eq!(bank2.get_program_accounts(&sysvar::id()).unwrap().len(), 8);
// force rent collection for sysvars
bank2.collect_rent_in_partition((0, 0, 1)); // all range
// no sysvar should be deleted due to rent
assert_eq!(bank2.get_program_accounts(&sysvar::id()).unwrap().len(), 8);
} | rust_cleaned_test_functions.jsonl/2657 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 580
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6536,
2259,
52625,
75728,
2346,
83127,
8237,
263,
83127,
5478,
20344,
947,
52404,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
1428,
286,
1077,
320,
6984,
59366,
5332,
11,
716,
67791,
3097,
12670,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_participant_parse() {
let string = r#"{
"participant": {
"active": true,
"checked_in_at": null,
"created_at": "2015-01-19T16:54:40-05:00",
"final_rank": null,
"group_id": null,
"icon": null,
"id": 16543993,
"invitation_id": null,
"invite_email": null,
"misc": null,
"name": "Participant #1",
"on_waiting_list": false,
"seed": 1,
"tournament_id": 1086875,
"updated_at": "2015-01-19T16:54:40-05:00",
"challonge_username": null,
"challonge_email_address_verified": null,
"removable": true,
"participatable_or_invitation_attached": false,
"confirm_remove": true,
"invitation_pending": false,
"display_name_with_invitation_email_address": "Participant #1",
"email_hash": null,
"username": null,
"attached_participatable_portrait_url": null,
"can_check_in": false,
"checked_in": false,
"reactivatable": false
}
}"#;
let json_r = serde_json::from_str(string);
assert!(json_r.is_ok());
let json = json_r.unwrap();
if let Ok(p) = Participant::decode(json) {
assert_eq!(p.active, true);
assert_eq!(p.checked_in_at, None);
assert_eq!(p.final_rank, None);
assert_eq!(p.group_id, None);
assert!(p.icon.is_empty());
assert_eq!(p.id.0, 16543993);
assert_eq!(p.invitation_id, None);
assert!(p.invite_email.is_empty());
assert!(p.misc.is_empty());
assert_eq!(p.name, "Participant #1");
assert_eq!(p.on_waiting_list, false);
assert_eq!(p.seed, 1);
assert_eq!(p.tournament_id, 1086875);
assert!(p.challonge_username.is_empty());
assert!(p.challonge_email_address_verified.is_empty());
assert_eq!(p.removable, true);
assert_eq!(p.participatable_or_invitation_attached, false);
assert_eq!(p.confirm_remove, true);
assert_eq!(p.invitation_pending, false);
assert_eq!(
p.display_name_with_invitation_email_address,
"Participant #1"
);
assert!(p.email_hash.is_empty());
assert!(p.username.is_empty());
assert!(p.attached_participatable_portrait_url.is_empty());
assert_eq!(p.can_check_in, false);
assert_eq!(p.checked_in, false);
assert_eq!(p.reactivatable, false);
} else {
assert!(false);
}
} | rust_cleaned_test_functions.jsonl/107046 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1561
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10495,
21757,
21039,
368,
341,
286,
1077,
914,
284,
435,
55543,
515,
688,
330,
58513,
788,
341,
310,
330,
3028,
788,
830,
345,
310,
330,
7549,
1243,
3752,
788,
845,
345,
310,
330,
7120,
3752,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_process_record() {
let cls = FastText::new_lid().unwrap();
// let oscar_metadata =
let record: Record<EmptyBody> = Record::default();
let body = "english test that is longer than one hundred characters. english test that is longer than one hundred characters.
phrase française de plus de cent caractères. Ceci est une phrase française de plus de cent caractères.";
println!("{}", body.len());
let record = record.add_body(body);
let (identifications, _) = OscarMetadata::process_record(record, &cls).unwrap();
for (sentence, id) in identifications {
if id == "en" {
assert_eq!(sentence, "english test that is longer than one hundred characters. english test that is longer than one hundred characters.");
} else if id == "fr" {
assert_eq!(sentence, "phrase française de plus de cent caractères. Ceci est une phrase française de plus de cent caractères.");
}
}
} | rust_cleaned_test_functions.jsonl/3957 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 413
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
14192,
368,
341,
286,
1077,
12790,
284,
17288,
1178,
486,
931,
907,
307,
1005,
15454,
1428,
286,
442,
1077,
297,
24513,
22220,
4035,
23459,
286,
1077,
3255,
25,
13583,
27,
3522,
5444,
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... | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.