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_large() {
let x = b"GATCACAGGTCTATCACCCTATTAACCACTCACGGGAGCTCTCCATGC\
ATTTGGTATTTTCGTCTGGGGGGTATGCACGCGATAGCATTGCGAGACGCTGGAGCCGGAGCACCCTATGTCGCAGTAT\
CTGTCTTTGATTCCTGCCTCATCCTATTATTTATCGCACCTACGTTCAATATTACAGGCGAACATACTTACTAAAGTGT";
let y = b"GGGTATGCACGCGATAGCATTGCGAGATGCTGGAGCTGGAGCACCCTATGTCGC";
let emission_params = TestEmissionParams { x: x, y: y };
let gap_params = SemiglobalGapParams;
let mut pair_hmm = PairHMM::new();
let p = pair_hmm.prob_related(&gap_params, &emission_params, None);
let p_banded = pair_hmm.prob_related(&gap_params, &emission_params, Some(2));
assert_relative_eq!(*p, *p_banded, epsilon = 1e-7);
} | rust_cleaned_test_functions.jsonl/35194 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 365
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45228,
368,
341,
286,
1077,
856,
284,
293,
89199,
828,
92832,
1890,
25388,
1162,
828,
34,
29442,
1162,
828,
15204,
1706,
5049,
1162,
92832,
22254,
38,
1890,
1162,
1162,
3706,
828,
22863,
5661,
828... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_packet_offsets() {
assert_eq!(
get_packet_offsets_from_tx(test_tx(), 0),
PacketOffsets::new(1, 1, 64, 4, 2)
);
assert_eq!(
get_packet_offsets_from_tx(test_tx(), 100),
PacketOffsets::new(1, 1, 64, 4, 2)
);
// Ensure we're not indexing packet by the `current_offset` parameter.
assert_eq!(
get_packet_offsets_from_tx(test_tx(), 1_000_000),
PacketOffsets::new(1, 1, 64, 4, 2)
);
assert_eq!(
get_packet_offsets_from_tx(test_multisig_tx(), 0),
PacketOffsets::new(2, 1, 128, 4, 4)
);
} | rust_cleaned_test_functions.jsonl/22083 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 394
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
21078,
56924,
368,
341,
286,
2060,
10714,
33673,
310,
633,
21078,
56924,
5673,
17805,
8623,
17805,
1507,
220,
15,
1326,
310,
28889,
81095,
486,
931,
7,
16,
11,
220,
16,
11,
220,
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_memtable_kv_operations() {
let region_id = 8;
let mut memtable = MemTable::new(region_id, Arc::new(GlobalStats::default()));
let (k1, v1) = (b"key1", b"value1");
let (k5, v5) = (b"key5", b"value5");
memtable.put(k1.to_vec(), v1.to_vec(), FileId::new(LogQueue::Append, 1));
memtable.put(k5.to_vec(), v5.to_vec(), FileId::new(LogQueue::Append, 5));
assert_eq!(memtable.min_file_seq(LogQueue::Append).unwrap(), 1);
assert_eq!(memtable.max_file_seq(LogQueue::Append).unwrap(), 5);
assert_eq!(memtable.get(k1.as_ref()), Some(v1.to_vec()));
assert_eq!(memtable.get(k5.as_ref()), Some(v5.to_vec()));
memtable.delete(k5.as_ref());
assert_eq!(memtable.get(k5.as_ref()), None);
assert_eq!(memtable.min_file_seq(LogQueue::Append).unwrap(), 1);
assert_eq!(memtable.max_file_seq(LogQueue::Append).unwrap(), 1);
memtable.put(k1.to_vec(), v1.to_vec(), FileId::new(LogQueue::Rewrite, 2));
memtable.put(k5.to_vec(), v5.to_vec(), FileId::new(LogQueue::Rewrite, 3));
assert_eq!(memtable.min_file_seq(LogQueue::Append), None);
assert_eq!(memtable.max_file_seq(LogQueue::Append), None);
assert_eq!(memtable.min_file_seq(LogQueue::Rewrite).unwrap(), 2);
assert_eq!(memtable.max_file_seq(LogQueue::Rewrite).unwrap(), 3);
assert_eq!(memtable.global_stats.rewrite_entries(), 2);
memtable.delete(k1.as_ref());
assert_eq!(memtable.min_file_seq(LogQueue::Rewrite).unwrap(), 3);
assert_eq!(memtable.max_file_seq(LogQueue::Rewrite).unwrap(), 3);
assert_eq!(memtable.global_stats.deleted_rewrite_entries(), 1);
memtable.put(k5.to_vec(), v5.to_vec(), FileId::new(LogQueue::Append, 7));
assert_eq!(memtable.min_file_seq(LogQueue::Rewrite), None);
assert_eq!(memtable.max_file_seq(LogQueue::Rewrite), None);
assert_eq!(memtable.min_file_seq(LogQueue::Append).unwrap(), 7);
assert_eq!(memtable.max_file_seq(LogQueue::Append).unwrap(), 7);
assert_eq!(memtable.global_stats.deleted_rewrite_entries(), 2);
} | rust_cleaned_test_functions.jsonl/18144 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1012
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
12976,
2005,
97066,
57345,
368,
341,
286,
1077,
5537,
842,
284,
220,
23,
280,
286,
1077,
5206,
1833,
2005,
284,
13550,
2556,
486,
931,
48059,
842,
11,
19689,
486,
931,
46744,
16635,
486,
2258,
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_or_with_multiple_like_to_string() {
let name1 = _random_vector(10);
let value1 = _random_string(10);
let name2 = _random_vector(10);
let value2 = _random_string(10);
let name3 = _random_vector(10);
let value3 = _random_string(10);
let query = Operator::Or(
vec![
Operator::Like(
TagName::PlainTagName(name1.clone()),
TargetValue::Unencrypted(value1.clone())
),
Operator::Like(
TagName::PlainTagName(name2.clone()),
TargetValue::Unencrypted(value2.clone())
),
Operator::Like(
TagName::PlainTagName(name3.clone()),
TargetValue::Unencrypted(value3.clone())
),
]
);
let json = query.to_string();
let expected = format!(r#"{{"$or":[{{"~{}":{{"$like":"{}"}}}},{{"~{}":{{"$like":"{}"}}}},{{"~{}":{{"$like":"{}"}}}}]}}"#,
base64::encode(&name1), value1,
base64::encode(&name2), value2,
base64::encode(&name3), value3
);
assert_eq!(json, expected);
} | rust_cleaned_test_functions.jsonl/11923 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 747
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8734,
6615,
45233,
25535,
2346,
3904,
368,
341,
286,
1077,
829,
16,
284,
716,
11463,
12247,
7,
16,
15,
317,
286,
1077,
897,
16,
284,
716,
11463,
3904,
7,
16,
15,
317,
286,
1077,
829,
17,
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_timestamp_difference() {
fn test_timestamp_difference_with_initial(initial: Timestamp) {
let offsets = generate_interesting_offsets(initial);
assert_eq!(offsets.plus_one - initial, Timestamp::default() + 1);
assert_eq!(
offsets.plus_limit - initial,
Timestamp::default() + i16::MAX
);
assert_eq!(
offsets.plus_wrapped - initial,
Timestamp::default() + i16::MIN
);
assert_eq!(
offsets.plus_wrapped_limit - initial,
Timestamp::default() - 1
);
assert_eq!(offsets.plus_wrapped_full - initial, Timestamp::default());
assert_eq!(offsets.minus_one - initial, Timestamp::default() - 1);
assert_eq!(
offsets.minus_limit - initial,
Timestamp::default() + i16::MIN
);
assert_eq!(
offsets.minus_wrapped - initial,
Timestamp::default() + i16::MAX
);
assert_eq!(
offsets.minus_wrapped_limit - initial,
Timestamp::default() + 1
);
assert_eq!(offsets.minus_wrapped_full - initial, Timestamp::default());
}
for timestamp in &interesting_timestamps() {
test_timestamp_difference_with_initial(*timestamp);
}
} | rust_cleaned_test_functions.jsonl/63527 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 759
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
23073,
47525,
368,
341,
286,
5168,
1273,
23073,
47525,
6615,
15809,
34331,
25,
32758,
8,
341,
310,
1077,
35046,
284,
6923,
62527,
287,
56924,
34331,
317,
310,
2060,
10714,
10297,
3176,
82,
60540,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_pooling_allocator_with_memory_pages_exceeded() {
assert_eq!(
PoolingInstanceAllocator::new(
PoolingAllocationStrategy::Random,
ModuleLimits {
memory_pages: 0x10001,
..Default::default()
},
InstanceLimits { count: 1 },
4096,
&Tunables {
static_memory_bound: 1,
..Tunables::default()
},
)
.map_err(|e| e.to_string())
.expect_err("expected a failure constructing instance allocator"),
"module memory page limit of 65537 exceeds the maximum of 65536"
);
} | rust_cleaned_test_functions.jsonl/48878 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 423
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15709,
287,
56910,
6615,
19195,
21655,
2702,
94206,
368,
341,
286,
2060,
10714,
33673,
310,
22728,
287,
2523,
42730,
486,
931,
1006,
394,
22728,
287,
78316,
19816,
486,
13999,
345,
394,
13711,
94588... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_offset_from_nix_expr() {
let expr = "let a = 1; in\nmap (x: a + x)\n[1 2 3 4]";
let start = range(expr, TextRange::new(TextSize::from(0), TextSize::from(1)));
assert_eq!(0, start.start.line);
assert_eq!(0, start.end.line);
assert_eq!(0, start.start.character);
assert_eq!(1, start.end.character);
let actual_pos = range(expr, TextRange::new(TextSize::from(15), TextSize::from(20)));
assert_eq!(1, actual_pos.start.line);
assert_eq!(1, actual_pos.end.line);
assert_eq!(1, actual_pos.start.character);
assert_eq!(6, actual_pos.end.character);
} | rust_cleaned_test_functions.jsonl/113847 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 315
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
6917,
5673,
1089,
941,
21915,
368,
341,
286,
1077,
15169,
284,
330,
1149,
264,
284,
220,
16,
26,
304,
1699,
2186,
320,
87,
25,
264,
488,
856,
10699,
77,
58,
16,
220,
17,
220,
18,
220,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_permutations() {
{
let v: [i32; 0] = [];
let mut it = permutations(&v);
let (min_size, max_opt) = it.size_hint();
assert_eq!(min_size, 1);
assert_eq!(max_opt.unwrap(), 1);
assert_eq!(it.next(), Some(to_vec(&v)));
assert_eq!(it.next(), None);
}
{
let v = ["Hello".to_string()];
let mut it = permutations(&v);
let (min_size, max_opt) = it.size_hint();
assert_eq!(min_size, 1);
assert_eq!(max_opt.unwrap(), 1);
assert_eq!(it.next(), Some(to_vec(&v)));
assert_eq!(it.next(), None);
}
{
let v = [1, 2, 3];
let mut it = permutations(&v);
let (min_size, max_opt) = it.size_hint();
assert_eq!(min_size, 3*2);
assert_eq!(max_opt.unwrap(), 3*2);
assert_eq!(it.next().unwrap(), [1,2,3]);
assert_eq!(it.next().unwrap(), [1,3,2]);
assert_eq!(it.next().unwrap(), [3,1,2]);
let (min_size, max_opt) = it.size_hint();
assert_eq!(min_size, 3);
assert_eq!(max_opt.unwrap(), 3);
assert_eq!(it.next().unwrap(), [3,2,1]);
assert_eq!(it.next().unwrap(), [2,3,1]);
assert_eq!(it.next().unwrap(), [2,1,3]);
assert_eq!(it.next(), None);
}
{
// check that we have N! permutations
let v = ['A', 'B', 'C', 'D', 'E', 'F'];
let mut amt = 0;
let mut it = permutations(&v);
let (min_size, max_opt) = it.size_hint();
for _perm in it.by_ref() {
amt += 1;
}
assert_eq!(amt, it.swaps.swaps_made);
assert_eq!(amt, min_size);
assert_eq!(amt, 2 * 3 * 4 * 5 * 6);
assert_eq!(amt, max_opt.unwrap());
}
} | rust_cleaned_test_functions.jsonl/22055 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1154
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31961,
82141,
368,
341,
286,
341,
310,
1077,
348,
25,
508,
72,
18,
17,
26,
220,
15,
60,
284,
5907,
310,
1077,
5206,
432,
284,
71949,
2099,
85,
317,
310,
1077,
320,
1065,
2368,
11,
1932,
1503... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_is_dsym_dir() {
assert!(fixture("macos/crash.dSYM").is_dsym_dir());
assert!(!fixture("macos/crash").is_dsym_dir());
} | rust_cleaned_test_functions.jsonl/46975 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 86
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
6892,
814,
23802,
4334,
368,
341,
286,
2060,
10297,
59612,
445,
11948,
436,
2899,
81,
988,
950,
79234,
1827,
285,
814,
23802,
4334,
1423,
286,
2060,
0,
3471,
59612,
445,
11948,
436,
2899,
81,
98... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_violated_50_burst() {
let bucket = VectorTokenBucket::new(Duration::from_millis(1000), 100, *D00, 0.50, 1.0);
Instant::set_time(50_000);
assert!(!bucket.get_tokens(90), "Burst should be violated.");
assert_ne!(None, bucket.get_delay(), "Bucket should have delay.");
} | rust_cleaned_test_functions.jsonl/42328 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 166
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2273,
24903,
657,
62,
20,
15,
880,
32612,
368,
341,
310,
1077,
15621,
284,
4196,
3323,
36018,
486,
931,
64114,
486,
1499,
717,
56212,
7,
16,
15,
15,
15,
701,
220,
16,
15,
15,
11,
353,
35,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_naive_tf_from_example_index() {
let idx = create_test_index();
let mdl = naive_tf::from_index(&idx);
assert_eq!(2, mdl.labels.len());
assert_eq!(4, mdl.terms.len());
assert_eq!(2, mdl.word_bag.len());
assert_eq!(4, mdl.word_bag[0].len());
assert_eq!("brown".to_string(), mdl.terms[0]);
assert_eq!(4, mdl.word_bag[0].len());
assert_eq!(1, mdl.word_bag[0][0]); //word brown should be in the first doc selected
assert_eq!(0, mdl.word_bag[1][0]); // but not in document.2
assert_eq!("fox".to_string(), mdl.terms[1]);
assert_eq!(1, mdl.word_bag[0][1]); // word fox should be in the first doc
assert_eq!(0, mdl.word_bag[1][1]); // but not in document.2
assert_eq!("lazy".to_string(), mdl.terms[2]);
assert_eq!(0, mdl.word_bag[0][2]); // word lazy should be in the first doc
assert_eq!(1, mdl.word_bag[1][2]); // but not in document.2
assert_eq!("dog".to_string(), mdl.terms[3]);
assert_eq!(0, mdl.word_bag[0][3]); // word dog should be in the first doc
assert_eq!(1, mdl.word_bag[1][3]); // but not in document.2
} | rust_cleaned_test_functions.jsonl/74636 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 492
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
58631,
533,
47719,
5673,
39304,
3560,
368,
341,
262,
1077,
7187,
284,
1855,
4452,
3560,
543,
262,
1077,
51700,
284,
49665,
47719,
486,
1499,
3560,
2099,
6361,
626,
262,
2060,
10714,
10297,
17,
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_stake_process_instruction_decode_bail() {
let stake_address = Pubkey::new_unique();
let stake_account = create_default_stake_account();
let rent_address = sysvar::rent::id();
let rent = Rent::default();
let rent_account = account::create_account_shared_data_for_test(&rent);
let rewards_address = sysvar::rewards::id();
let rewards_account =
account::create_account_shared_data_for_test(&sysvar::rewards::Rewards::new(0.0));
let stake_history_address = sysvar::stake_history::id();
let stake_history_account =
account::create_account_shared_data_for_test(&StakeHistory::default());
let vote_address = Pubkey::new_unique();
let vote_account = AccountSharedData::new(0, 0, &solana_vote_program::id());
let clock_address = sysvar::clock::id();
let clock_account =
account::create_account_shared_data_for_test(&sysvar::clock::Clock::default());
let config_address = stake_config::id();
let config_account = config::create_account(0, &stake_config::Config::default());
let rent_exempt_reserve = rent.minimum_balance(StakeState::size_of());
let minimum_delegation = crate::get_minimum_delegation(&FeatureSet::all_enabled());
let withdrawal_amount = rent_exempt_reserve + minimum_delegation;
process_instruction(
&serialize(&StakeInstruction::Initialize(
Authorized::default(),
Lockup::default(),
))
.unwrap(),
Vec::new(),
Vec::new(),
Err(InstructionError::NotEnoughAccountKeys),
);
// no account for rent
process_instruction(
&serialize(&StakeInstruction::Initialize(
Authorized::default(),
Lockup::default(),
))
.unwrap(),
vec![(stake_address, stake_account.clone())],
vec![AccountMeta {
pubkey: stake_address,
is_signer: false,
is_writable: false,
}],
Err(InstructionError::NotEnoughAccountKeys),
);
// fails to deserialize stake state
process_instruction(
&serialize(&StakeInstruction::Initialize(
Authorized::default(),
Lockup::default(),
))
.unwrap(),
vec![
(stake_address, stake_account.clone()),
(rent_address, rent_account),
],
vec![
AccountMeta {
pubkey: stake_address,
is_signer: false,
is_writable: false,
},
AccountMeta {
pubkey: rent_address,
is_signer: false,
is_writable: false,
},
],
Err(InstructionError::InvalidAccountData),
);
process_instruction(
&serialize(&StakeInstruction::DelegateStake).unwrap(),
vec![(stake_address, stake_account.clone())],
vec![AccountMeta {
pubkey: stake_address,
is_signer: false,
is_writable: false,
}],
Err(InstructionError::NotEnoughAccountKeys),
);
// gets the sub-check for number of args
process_instruction(
&serialize(&StakeInstruction::DelegateStake).unwrap(),
vec![(stake_address, stake_account.clone())],
vec![AccountMeta {
pubkey: stake_address,
is_signer: false,
is_writable: false,
}],
Err(InstructionError::NotEnoughAccountKeys),
);
// gets the check non-deserialize-able account in delegate_stake
process_instruction(
&serialize(&StakeInstruction::DelegateStake).unwrap(),
vec![
(stake_address, stake_account.clone()),
(vote_address, vote_account.clone()),
(clock_address, clock_account),
(stake_history_address, stake_history_account.clone()),
(config_address, config_account),
],
vec![
AccountMeta {
pubkey: stake_address,
is_signer: true,
is_writable: false,
},
AccountMeta {
pubkey: vote_address,
is_signer: false,
is_writable: false,
},
AccountMeta {
pubkey: clock_address,
is_signer: false,
is_writable: false,
},
AccountMeta {
pubkey: stake_history_address,
is_signer: false,
is_writable: false,
},
AccountMeta {
pubkey: config_address,
is_signer: false,
is_writable: false,
},
],
Err(InstructionError::InvalidAccountData),
);
process_instruction(
&serialize(&StakeInstruction::Withdraw(withdrawal_amount)).unwrap(),
vec![
(stake_address, stake_account.clone()),
(vote_address, vote_account.clone()),
(rewards_address, rewards_account.clone()),
(stake_history_address, stake_history_account),
],
vec![
AccountMeta {
pubkey: stake_address,
is_signer: false,
is_writable: false,
},
AccountMeta {
pubkey: vote_address,
is_signer: false,
is_writable: false,
},
AccountMeta {
pubkey: rewards_address,
is_signer: false,
is_writable: false,
},
AccountMeta {
pubkey: stake_history_address,
is_signer: false,
is_writable: false,
},
],
Err(InstructionError::InvalidArgument),
);
// Tests correct number of accounts are provided in withdraw
process_instruction(
&serialize(&StakeInstruction::Withdraw(withdrawal_amount)).unwrap(),
vec![(stake_address, stake_account.clone())],
vec![AccountMeta {
pubkey: stake_address,
is_signer: false,
is_writable: false,
}],
Err(InstructionError::NotEnoughAccountKeys),
);
process_instruction(
&serialize(&StakeInstruction::Deactivate).unwrap(),
vec![
(stake_address, stake_account.clone()),
(rewards_address, rewards_account),
],
vec![
AccountMeta {
pubkey: stake_address,
is_signer: false,
is_writable: false,
},
AccountMeta {
pubkey: rewards_address,
is_signer: false,
is_writable: false,
},
],
Err(InstructionError::InvalidArgument),
);
// Tests correct number of accounts are provided in deactivate
process_instruction(
&serialize(&StakeInstruction::Deactivate).unwrap(),
Vec::new(),
Vec::new(),
Err(InstructionError::NotEnoughAccountKeys),
);
// Tests correct number of accounts are provided in deactivate_delinquent
process_instruction(
&serialize(&StakeInstruction::DeactivateDelinquent).unwrap(),
Vec::new(),
Vec::new(),
Err(InstructionError::NotEnoughAccountKeys),
);
process_instruction(
&serialize(&StakeInstruction::DeactivateDelinquent).unwrap(),
vec![(stake_address, stake_account.clone())],
vec![AccountMeta {
pubkey: stake_address,
is_signer: false,
is_writable: false,
}],
Err(InstructionError::NotEnoughAccountKeys),
);
process_instruction(
&serialize(&StakeInstruction::DeactivateDelinquent).unwrap(),
vec![(stake_address, stake_account), (vote_address, vote_account)],
vec![
AccountMeta {
pubkey: stake_address,
is_signer: false,
is_writable: false,
},
AccountMeta {
pubkey: vote_address,
is_signer: false,
is_writable: false,
},
],
Err(InstructionError::NotEnoughAccountKeys),
);
} | rust_cleaned_test_functions.jsonl/31632 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 5039
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1261,
726,
11305,
54923,
15227,
880,
604,
368,
341,
1789,
286,
1077,
18279,
6744,
284,
22611,
792,
486,
931,
21218,
543,
286,
1077,
18279,
13500,
284,
1855,
9993,
1261,
726,
13500,
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_parse_padding_1() {
assert_eq!(
parse_layout_padding("10px"),
Ok(LayoutPadding {
top: PixelValue::px(10.0),
right: PixelValue::px(10.0),
bottom: PixelValue::px(10.0),
left: PixelValue::px(10.0),
})
);
} | rust_cleaned_test_functions.jsonl/114064 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
40726,
62,
16,
368,
341,
286,
2060,
10714,
33673,
310,
4715,
14466,
40726,
445,
16,
15,
1767,
4461,
310,
7622,
76690,
21616,
341,
394,
1909,
25,
27469,
1130,
486,
1767,
7,
16,
15,
13,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_through_literal_string_in_builtin_macro() {
check_hover_no_result(
r#"
#[rustc_builtin_macro]
macro_rules! format {}
fn foo() {
format!("hel$0lo {}", 0);
}
"#,
);
} | rust_cleaned_test_functions.jsonl/66649 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 178
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
53445,
87399,
34100,
3904,
1243,
73829,
58810,
368,
341,
286,
1779,
53445,
6536,
5287,
1006,
310,
435,
2,
698,
310,
11506,
35788,
66,
73829,
58810,
921,
310,
18072,
21407,
0,
3561,
10086,
310,
516... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_css() {
let src = "div { width: 100px; height: 50px; color: #ffffff; background-color: #003300; }";
let stylesheet = parse(src.to_string());
assert_eq!(
stylesheet,
Stylesheet {
rules: vec![
Rule {
selectors: vec![
Selector::Simple(SimpleSelector {
tag_name: Some("div".to_string()),
id: None,
class: Vec::new(),
}),
],
declarations: vec![
Declaration {
name: "width".to_string(),
value: Value::Length(100.0, Unit::Px),
},
Declaration {
name: "height".to_string(),
value: Value::Length(50.0, Unit::Px),
},
Declaration {
name: "color".to_string(),
value: Value::Color(Color {
r: 0xff,
g: 0xff,
b: 0xff,
a: 0xff,
}),
},
Declaration {
name: "background-color".to_string(),
value: Value::Color(Color {
r: 0x00,
g: 0x33,
b: 0x00,
a: 0xff,
}),
},
],
},
],
}
);
} | rust_cleaned_test_functions.jsonl/128734 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1361
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
25924,
368,
972,
262,
1077,
2286,
284,
330,
611,
314,
2374,
25,
220,
16,
15,
15,
1767,
26,
2608,
25,
220,
20,
15,
1767,
26,
1894,
25,
671,
26886,
26,
4004,
7889,
25,
671,
15,
15,
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_replace() {
let mut file = NamedTempFile::new().unwrap();
let feed1 = "https://satylogin.medium.com/feed";
let feed2 = "https://motw.rs/rss.xml";
let now = chrono::Utc::now();
let config_list = vec![
Config {
feed: feed1.to_string(),
updated: Some(now),
},
Config {
feed: feed2.to_string(),
updated: None,
},
];
let expected = format!(
r#"[
{{
"feed": "{feed1}",
"updated": "{now}"
}},
{{
"feed": "{feed2}",
"updated": null
}}
]"#,
feed1 = feed1,
now = now.to_rfc3339_opts(chrono::SecondsFormat::Nanos, true),
feed2 = feed2
);
let output = _replace(file.path().to_str().unwrap(), config_list.clone()).unwrap();
assert_eq!(config_list, output);
let mut buf = String::new();
file.read_to_string(&mut buf).unwrap();
assert_eq!(remove_whitespaces(&expected), remove_whitespaces(&buf));
} | rust_cleaned_test_functions.jsonl/16202 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 670
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10633,
368,
341,
286,
1077,
5206,
1034,
284,
40459,
12151,
1703,
486,
931,
1005,
15454,
543,
286,
1077,
5395,
16,
284,
330,
2428,
1110,
36468,
88,
3673,
84366,
905,
93730,
876,
286,
1077,
5395,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_affine_as_affine() {
let affine = Affine([[1., 2.], [3., 4.]], [5., 6.]);
let affine_clone = affine.as_affine();
approx_eq!(f64, affine_clone.0[0][0], affine.0[0][0]);
approx_eq!(f64, affine_clone.0[0][1], affine.0[0][1]);
approx_eq!(f64, affine_clone.0[1][0], affine.0[1][0]);
approx_eq!(f64, affine_clone.0[1][1], affine.0[1][1]);
approx_eq!(f64, affine_clone.1[0], affine.1[0]);
approx_eq!(f64, affine_clone.1[1], affine.1[1]);
} | rust_cleaned_test_functions.jsonl/102301 | {
"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,
48914,
482,
11898,
48914,
482,
368,
341,
286,
1077,
68809,
284,
9748,
482,
27119,
16,
2572,
220,
17,
13,
1125,
508,
18,
2572,
220,
19,
13,
20492,
508,
20,
2572,
220,
21,
13,
2558,
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_loading_cosine() {
// The math library does not need to be loaded since it is already
// statically linked in
let libm = match DynamicLibrary::open(None) {
Err(error) => panic!("Could not load self as module: {}", error),
Ok(libm) => libm
};
let cosine: extern fn(libc::c_double) -> libc::c_double = unsafe {
match libm.symbol("cos") {
Err(error) => panic!("Could not load function cos: {}", error),
Ok(cosine) => mem::transmute::<*mut u8, _>(cosine)
}
};
let argument = 0.0;
let expected_result = 1.0;
let result = cosine(argument);
if result != expected_result {
panic!("cos({}) != {} but equaled {} instead", argument,
expected_result, result)
}
} | rust_cleaned_test_functions.jsonl/34337 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 415
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
57726,
61192,
482,
368,
341,
286,
442,
576,
6888,
6733,
1558,
537,
1184,
311,
387,
6661,
2474,
432,
374,
2669,
198,
286,
442,
91174,
10592,
304,
198,
286,
1077,
3051,
76,
284,
2432,
21886,
16915... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_input_day4() {
assert_eq!(parse_input_day4("12345-123456".into()), (12345, 123456));
} | rust_cleaned_test_functions.jsonl/82200 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 63
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
5898,
16763,
19,
368,
341,
286,
2060,
10714,
10297,
6400,
5898,
16763,
19,
445,
16,
17,
18,
19,
20,
12,
16,
17,
18,
19,
20,
21,
3263,
18122,
11858,
320,
16,
17,
18,
19,
20,
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 |
#[test]
fn test_intfastfield_small() {
let path = Path::new("test");
let mut directory: RAMDirectory = RAMDirectory::create();
{
let write: WritePtr = directory.open_write(Path::new("test")).unwrap();
let mut serializer = FastFieldSerializer::from_write(write).unwrap();
let mut fast_field_writers = FastFieldsWriter::from_schema(&SCHEMA);
fast_field_writers.add_document(&doc!(*FIELD=>13u64));
fast_field_writers.add_document(&doc!(*FIELD=>14u64));
fast_field_writers.add_document(&doc!(*FIELD=>2u64));
fast_field_writers
.serialize(&mut serializer, &HashMap::new())
.unwrap();
serializer.close().unwrap();
}
let source = directory.open_read(&path).unwrap();
{
assert_eq!(source.len(), 36 as usize);
}
{
let composite_file = CompositeFile::open(&source).unwrap();
let field_source = composite_file.open_read(*FIELD).unwrap();
let fast_field_reader = FastFieldReader::<u64>::open(field_source);
assert_eq!(fast_field_reader.get(0), 13u64);
assert_eq!(fast_field_reader.get(1), 14u64);
assert_eq!(fast_field_reader.get(2), 2u64);
}
} | rust_cleaned_test_functions.jsonl/12504 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 628
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4042,
9349,
2566,
31966,
368,
341,
286,
1077,
1815,
284,
7933,
486,
931,
445,
1944,
797,
286,
1077,
5206,
6220,
25,
22038,
9310,
284,
22038,
9310,
486,
3182,
543,
286,
341,
310,
1077,
3270,
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_verify_transaction() {
// root
// a b
// txn0 txn1 txn2 default
let txn_info0_hash = b"hello".test_only_hash();
let txn_info2_hash = b"!".test_only_hash();
let txn1_hash = HashValue::random();
let state_root1_hash = b"a".test_only_hash();
let event_root1_hash = b"b".test_only_hash();
let txn_info1 = TransactionInfo::new(
txn1_hash,
state_root1_hash,
event_root1_hash,
/* gas_used = */ 0,
/* major_status = */ KeptVMStatus::Executed,
);
let txn_info1_hash = txn_info1.hash();
let internal_a_hash =
TransactionAccumulatorInternalNode::new(txn_info0_hash, txn_info1_hash).hash();
let internal_b_hash =
TransactionAccumulatorInternalNode::new(txn_info2_hash, *ACCUMULATOR_PLACEHOLDER_HASH)
.hash();
let root_hash =
TransactionAccumulatorInternalNode::new(internal_a_hash, internal_b_hash).hash();
let consensus_data_hash = b"c".test_only_hash();
let ledger_info = LedgerInfo::new(
BlockInfo::new(0, 0, *GENESIS_BLOCK_ID, root_hash, 2, 10000, None),
consensus_data_hash,
);
let ledger_info_to_transaction_info_proof =
TransactionAccumulatorProof::new(vec![txn_info0_hash, internal_b_hash]);
let proof =
TransactionInfoWithProof::new(ledger_info_to_transaction_info_proof.clone(), txn_info1);
// The proof can be used to verify txn1.
assert!(proof.verify(&ledger_info, 1).is_ok());
// Trying to show that txn1 is at version 2.
assert!(proof.verify(&ledger_info, 2).is_err());
// Replacing txn1 with some other txn should cause the verification to fail.
let fake_txn_info = TransactionInfo::new(
HashValue::random(),
state_root1_hash,
event_root1_hash,
/* gas_used = */ 0,
/* major_status = */ KeptVMStatus::Executed,
);
let proof = TransactionInfoWithProof::new(ledger_info_to_transaction_info_proof, fake_txn_info);
assert!(proof.verify(&ledger_info, 1).is_err());
} | rust_cleaned_test_functions.jsonl/33628 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 932
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35638,
28884,
368,
341,
262,
442,
310,
3704,
63477,
262,
442,
981,
264,
1797,
293,
7213,
262,
442,
220,
49721,
15,
256,
49721,
16,
256,
49721,
17,
256,
1638,
198,
262,
1077,
49721,
3109,
15,
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... | 1 |
#[test]
fn test_change_mode() {
let cursor_mode = CursorMode {
shape: Some(CursorShape::Horizontal),
style_id: Some(1),
cell_percentage: Some(100.0),
blinkwait: Some(1),
blinkon: Some(1),
blinkoff: Some(1),
};
let mut styles = HashMap::new();
styles.insert(1, Arc::new(Style::new(COLORS)));
let mut cursor = Cursor::new();
cursor.change_mode(&cursor_mode, &styles);
assert_eq!(cursor.shape, CursorShape::Horizontal);
assert_eq!(cursor.style, styles.get(&1).cloned());
assert_eq!(cursor.cell_percentage, Some(100.0));
assert_eq!(cursor.blinkwait, Some(1));
assert_eq!(cursor.blinkon, Some(1));
assert_eq!(cursor.blinkoff, Some(1));
let cursor_mode_with_none = CursorMode {
shape: None,
style_id: None,
cell_percentage: None,
blinkwait: None,
blinkon: None,
blinkoff: None,
};
cursor.change_mode(&cursor_mode_with_none, &styles);
assert_eq!(cursor.shape, CursorShape::Horizontal);
assert_eq!(cursor.style, styles.get(&1).cloned());
assert_eq!(cursor.cell_percentage, None);
assert_eq!(cursor.blinkwait, None);
assert_eq!(cursor.blinkon, None);
assert_eq!(cursor.blinkoff, None);
} | rust_cleaned_test_functions.jsonl/94973 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 707
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
15947,
7302,
368,
341,
286,
1077,
8128,
7302,
284,
28067,
3636,
341,
310,
6083,
25,
4329,
3025,
3823,
12301,
486,
15837,
1326,
310,
1707,
842,
25,
4329,
7,
16,
1326,
310,
2779,
46044,
25,
4329,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_l2_snapshot() {
let text =
fetch_l2_snapshot("binance", MarketType::EuropeanOption, "BTC-210129-40000-C").unwrap();
assert!(text.starts_with("{"));
} | rust_cleaned_test_functions.jsonl/81943 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 86
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
907,
17,
53265,
368,
341,
262,
1077,
1467,
4035,
286,
7807,
907,
17,
53265,
445,
6863,
681,
497,
7993,
929,
486,
63369,
5341,
11,
330,
59118,
12,
17,
16,
15,
16,
17,
24,
12,
19,
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 |
#[test]
fn test_should_ignore_file() {
let mut files = HashSet::new();
files.insert((10, 20));
assert!(!should_ignore_file(true, &None, &mut files, 0, 0));
// New file is not known it will be inserted to the hashmp and should not be ignored
assert!(!should_ignore_file(false, &None, &mut files, 11, 12));
assert!(files.contains(&(11, 12)));
// The same file will be ignored the second time
assert!(should_ignore_file(false, &None, &mut files, 11, 12));
} | rust_cleaned_test_functions.jsonl/32370 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 218
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
43378,
58493,
2458,
368,
341,
286,
1077,
5206,
3542,
284,
18931,
486,
931,
543,
286,
3542,
7030,
1188,
16,
15,
11,
220,
17,
15,
3237,
286,
2060,
0,
3471,
5445,
58493,
2458,
3715,
11,
609,
4064... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_float() {
#[allow(clippy::float_cmp)]
with_graph(|graph| {
let float: f64 = graph.query("RETURN 12.3").unwrap();
assert_eq!(float, 12.3);
});
} | rust_cleaned_test_functions.jsonl/73408 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 97
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
17586,
368,
341,
262,
11506,
7183,
9849,
45749,
486,
3649,
35193,
5563,
262,
448,
14738,
22428,
4439,
91,
341,
286,
1077,
2224,
25,
282,
21,
19,
284,
4771,
4786,
445,
51533,
220,
16,
17,
13,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_number_comparison() {
fold("'1' < 2", "true");
fold("'2' > 1", "true");
fold("'123' > 34", "true");
fold("'NaN' < NaN", "false");
fold("'1' == 2", "false");
fold("'1' != 1", "false");
fold("'NaN' == NaN", "false");
fold("'1' === 1", "false");
fold("'1' !== 1", "true");
fold_same("'' + x < +y");
fold_same("'' + x == +y");
fold("'' + x === +y", "false");
} | rust_cleaned_test_functions.jsonl/122161 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 211
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3904,
5500,
90797,
368,
341,
262,
11555,
45456,
16,
6,
366,
220,
17,
497,
330,
1866,
797,
262,
11555,
45456,
17,
6,
861,
220,
16,
497,
330,
1866,
797,
262,
11555,
45456,
16,
17,
18,
6,
861,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_protected_inner_class() {
let hdr = indoc! {"
#include <cstdint>
inline uint32_t DoMath(uint32_t a) {
return a * 3;
}
class A {
protected:
inline uint32_t protected_method() { return 0; }
struct B {
int x;
};
inline B protected_method_2() {
return { .x = 0 };
}
};
"};
let rs = quote! {};
run_test("", hdr, rs, &["A"], &[]);
} | rust_cleaned_test_functions.jsonl/9969 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 242
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22357,
1569,
34345,
4790,
368,
341,
262,
1077,
36615,
284,
1257,
509,
0,
314,
698,
262,
671,
997,
366,
96975,
397,
262,
7381,
2622,
18,
17,
528,
3155,
8815,
8488,
18,
17,
528,
264,
8,
220,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_camel_case() {
let mut bytes = BytesMut::with_capacity(2048);
let mut head = RequestHead::default();
head.set_camel_case_headers(true);
head.headers.insert(DATE, HeaderValue::from_static("date"));
head.headers
.insert(CONTENT_TYPE, HeaderValue::from_static("plain/text"));
let mut head = RequestHeadType::Owned(head);
let _ = head.encode_headers(
&mut bytes,
Version::HTTP_11,
BodySize::Empty,
ConnectionType::Close,
&ServiceConfig::default(),
);
let data =
String::from_utf8(Vec::from(bytes.split().freeze().as_ref())).unwrap();
assert!(data.contains("Content-Length: 0\r\n"));
assert!(data.contains("Connection: close\r\n"));
assert!(data.contains("Content-Type: plain/text\r\n"));
assert!(data.contains("Date: date\r\n"));
let _ = head.encode_headers(
&mut bytes,
Version::HTTP_11,
BodySize::Stream,
ConnectionType::KeepAlive,
&ServiceConfig::default(),
);
let data =
String::from_utf8(Vec::from(bytes.split().freeze().as_ref())).unwrap();
assert!(data.contains("Transfer-Encoding: chunked\r\n"));
assert!(data.contains("Content-Type: plain/text\r\n"));
assert!(data.contains("Date: date\r\n"));
let _ = head.encode_headers(
&mut bytes,
Version::HTTP_11,
BodySize::Sized64(100),
ConnectionType::KeepAlive,
&ServiceConfig::default(),
);
let data =
String::from_utf8(Vec::from(bytes.split().freeze().as_ref())).unwrap();
assert!(data.contains("Content-Length: 100\r\n"));
assert!(data.contains("Content-Type: plain/text\r\n"));
assert!(data.contains("Date: date\r\n"));
let mut head = RequestHead::default();
head.set_camel_case_headers(false);
head.headers.insert(DATE, HeaderValue::from_static("date"));
head.headers
.insert(CONTENT_TYPE, HeaderValue::from_static("plain/text"));
head.headers
.append(CONTENT_TYPE, HeaderValue::from_static("xml"));
let mut head = RequestHeadType::Owned(head);
let _ = head.encode_headers(
&mut bytes,
Version::HTTP_11,
BodySize::Stream,
ConnectionType::KeepAlive,
&ServiceConfig::default(),
);
let data =
String::from_utf8(Vec::from(bytes.split().freeze().as_ref())).unwrap();
assert!(data.contains("transfer-encoding: chunked\r\n"));
assert!(data.contains("content-type: xml\r\n"));
assert!(data.contains("content-type: plain/text\r\n"));
assert!(data.contains("date: date\r\n"));
} | rust_cleaned_test_functions.jsonl/38445 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1389
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
666,
35562,
19096,
368,
341,
286,
1077,
5206,
5820,
284,
30024,
51440,
486,
4197,
35603,
7,
17,
15,
19,
23,
317,
286,
1077,
5206,
1968,
284,
6145,
12346,
486,
2258,
543,
286,
1968,
980,
666,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_1vcpu_ht_on() {
// test update_deterministic_cache_entry
// test L1
check_update_deterministic_cache_entry(1, true, 1, 0);
// test L2
check_update_deterministic_cache_entry(1, true, 2, 0);
// test L3
check_update_deterministic_cache_entry(1, true, 3, 0);
// test update_extended_topology_entry
// index 0
check_update_extended_topology_entry(1, true, 0, 0, 1, LEVEL_TYPE_THREAD);
// index 1
check_update_extended_topology_entry(1, true, 1, LEAFBH_INDEX1_APICID, 1, LEVEL_TYPE_CORE);
} | rust_cleaned_test_functions.jsonl/7318 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 293
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
62,
16,
85,
16475,
49086,
4470,
368,
341,
286,
442,
1273,
2647,
814,
16483,
4532,
11529,
9078,
198,
286,
442,
1273,
444,
16,
198,
286,
1779,
8882,
814,
16483,
4532,
11529,
9078,
7,
16,
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,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fat_list_root() {
let images = fat_test_image_paths();
for image in &images {
let disk = FakeDisk::new(&image);
let len = disk.len();
let mut fs = crate::fat::Filesystem::new(&disk, 0, len);
fs.init().expect("Error initialising filesystem");
let mut d = fs.root().unwrap();
let de = d.next_entry().unwrap();
assert_eq!(&de.name, b"A ");
}
} | rust_cleaned_test_functions.jsonl/104527 | {
"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,
761,
266,
2019,
12993,
368,
341,
286,
1077,
5335,
284,
8664,
4452,
4954,
24152,
1428,
286,
369,
2168,
304,
609,
3642,
341,
310,
1077,
13364,
284,
36965,
47583,
486,
931,
2099,
1805,
317,
310,
10... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_get_slot_entries_with_shred_count_corruption() {
let blocktree_path = get_tmp_ledger_path!();
{
let blocktree = Blocktree::open(&blocktree_path).unwrap();
let num_ticks = 8;
let entries = create_ticks(num_ticks, 0, Hash::default());
let slot = 1;
let shreds = entries_to_test_shreds(entries, slot, 0, false, 0);
let next_shred_index = shreds.len();
blocktree
.insert_shreds(shreds, None, false)
.expect("Expected successful write of shreds");
assert_eq!(
blocktree.get_slot_entries(slot, 0, None).unwrap().len() as u64,
num_ticks
);
// Insert an empty shred that won't deshred into entries
let shreds = vec![Shred::new_from_data(
slot,
next_shred_index as u32,
1,
Some(&[1, 1, 1]),
true,
true,
0,
0,
next_shred_index as u32,
)];
// earlier data block was valid
blocktree
.insert_shreds(shreds, None, false)
.expect("Expected successful write of shreds");
assert!(blocktree.get_slot_entries(slot, 0, None).is_err());
}
Blocktree::destroy(&blocktree_path).expect("Expected successful database destruction");
} | rust_cleaned_test_functions.jsonl/116902 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 819
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
27563,
26092,
6615,
3712,
1151,
3180,
14734,
14123,
368,
341,
286,
1077,
2504,
9344,
2638,
284,
633,
16125,
38367,
1389,
2638,
0,
543,
286,
341,
310,
1077,
2504,
9344,
284,
8362,
9344,
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_extension_successful_with_minimal_json_response() {
use colorful_extension::*;
let mock = mock("POST", "/token")
.match_header("Accept", "application/json")
.match_header("Authorization", "Basic YWFhOmJiYg==")
.match_body("grant_type=authorization_code&code=ccc")
.with_header("content-type", "application/json")
.with_body("{\"access_token\": \"12/34\", \"token_type\": \"green\", \"height\": 10}")
.create();
let client = ColorfulClient::new(
ClientId::new("aaa".to_string()),
Some(ClientSecret::new("bbb".to_string())),
AuthUrl::new(Url::parse("http://example.com/auth").unwrap()),
Some(TokenUrl::new(
Url::parse(&(SERVER_URL.to_string() + "/token")).unwrap(),
)),
);
let token = client
.exchange_code(AuthorizationCode::new("ccc".to_string()))
.unwrap();
mock.assert();
assert_eq!("12/34", token.access_token().secret());
assert_eq!(ColorfulTokenType::Green, *token.token_type());
assert_eq!(None, token.expires_in());
assert_eq!(None, token.refresh_token());
assert_eq!(None, token.extra_fields().shape());
assert_eq!(10, token.extra_fields().height());
// Ensure that serialization produces an equivalent JSON value.
let serialized_json = serde_json::to_string(&token).unwrap();
assert_eq!(
"{\"access_token\":\"12/34\",\"token_type\":\"green\",\"height\":10}".to_string(),
serialized_json
);
let deserialized_token = ColorfulTokenResponse::from_json(&serialized_json).unwrap();
assert_eq!(token, deserialized_token);
} | rust_cleaned_test_functions.jsonl/12781 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 677
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31035,
92951,
6615,
7260,
2861,
9455,
9655,
368,
341,
262,
990,
33866,
31035,
79304,
262,
1077,
7860,
284,
7860,
445,
2946,
497,
3521,
5839,
1138,
286,
659,
6347,
8757,
445,
16646,
497,
330,
5132,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_probe_duplicate_tx() {
//! Checks that committed transactions do not change the blockchain state when probed.
let (mut testkit, api) = init_testkit();
let tx = inc_count(&api, 5);
let snapshot = testkit.probe(tx.clone());
let schema = CounterSchema::new(&snapshot);
assert_eq!(schema.count(), Some(5));
testkit.create_block();
let snapshot = testkit.probe(tx.clone());
let schema = CounterSchema::new(&snapshot);
assert_eq!(schema.count(), Some(5));
let other_tx = inc_count(&api, 7);
let snapshot = testkit.probe_all(txvec![tx, other_tx]);
let schema = CounterSchema::new(&snapshot);
assert_eq!(schema.count(), Some(12));
} | rust_cleaned_test_functions.jsonl/86872 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 273
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
49108,
70434,
17805,
368,
341,
262,
17664,
24843,
429,
11163,
14131,
653,
537,
2297,
279,
17944,
1584,
979,
462,
2721,
382,
262,
1077,
320,
6984,
1273,
8226,
11,
6330,
8,
284,
2930,
4452,
8226,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_case_when() {
let dec1 = Datum::Dec("1.1".parse().unwrap());
let dec2 = Datum::Dec("2.2".parse().unwrap());
let dur1 = Datum::Dur(Duration::parse(b"01:00:00", 0).unwrap());
let dur2 = Datum::Dur(Duration::parse(b"12:00:12", 0).unwrap());
let time1 = Datum::Time(Time::parse_utc_datetime("2012-12-12 12:00:23", 0).unwrap());
let s = "你好".as_bytes().to_owned();
let cases = vec![
(
ScalarFuncSig::CaseWhenInt,
vec![cond(true), Datum::I64(3), cond(true), Datum::I64(5)],
Datum::I64(3),
),
(
ScalarFuncSig::CaseWhenDecimal,
vec![cond(false), dec1, cond(true), dec2.clone()],
dec2,
),
(
ScalarFuncSig::CaseWhenDuration,
vec![Datum::Null, dur1, cond(true), dur2.clone()],
dur2,
),
(ScalarFuncSig::CaseWhenTime, vec![time1.clone()], time1),
(
ScalarFuncSig::CaseWhenReal,
vec![cond(false), Datum::Null],
Datum::Null,
),
(
ScalarFuncSig::CaseWhenString,
vec![cond(true), Datum::Bytes(s.clone())],
Datum::Bytes(s),
),
(
ScalarFuncSig::CaseWhenJson,
vec![
cond(false),
Datum::Null,
Datum::Null,
Datum::Null,
Datum::Json(Json::I64(23)),
],
Datum::Json(Json::I64(23)),
),
];
let ctx = EvalContext::default();
for (sig, row, exp) in cases {
let children: Vec<Expr> = (0..row.len()).map(|id| col_expr(id as i64)).collect();
let mut expr = Expr::new();
expr.set_tp(ExprType::ScalarFunc);
expr.set_sig(sig);
expr.set_children(RepeatedField::from_vec(children));
let e = Expression::build(&ctx, expr).unwrap();
let res = e.eval(&ctx, &row).unwrap();
assert_eq!(res, exp);
}
} | rust_cleaned_test_functions.jsonl/32217 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1339
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19096,
47636,
368,
341,
286,
1077,
1622,
16,
284,
68459,
486,
4900,
445,
16,
13,
16,
3263,
6400,
1005,
15454,
1423,
286,
1077,
1622,
17,
284,
68459,
486,
4900,
445,
17,
13,
17,
3263,
6400,
100... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_function_no_parameters() {
let src = "
// Package foo does a thing.
package foo
// one returns the number one.
one = () => 1
";
let loc = Locator::new(&src[..]);
assert_docs_full(
src,
PackageDoc {
path: "path".to_string(),
name: "foo".to_string(),
headline: "Package foo does a thing.".to_string(),
description: None,
members: map![
"one" => Doc::Function(Box::new(FunctionDoc{
name: "one".to_string(),
headline: "one returns the number one.".to_string(),
description: None,
parameters: vec![],
flux_type: "() => int".to_string(),
is_option: false,
source_location: loc.get(6, 9, 6, 22),
examples: vec![],
metadata: None,
})),
],
examples: Vec::new(),
metadata: None,
},
vec![],
);
} | rust_cleaned_test_functions.jsonl/10000 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 734
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9174,
6536,
18263,
368,
341,
286,
1077,
2286,
284,
6228,
286,
442,
16906,
15229,
1558,
264,
3166,
624,
286,
6328,
15229,
271,
286,
442,
825,
4675,
279,
1372,
825,
624,
286,
825,
284,
1719,
589,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_netinfo() {
let cmd = ChanCmd::NETINFO;
assert_eq!(Into::<u8>::into(cmd), 8_u8);
// example client netinfo.
let localhost = "127.0.0.1".parse::<IpAddr>().unwrap();
fbody(
cmd,
"00000000 04 04 7F000001 00",
&msg::Netinfo::for_client(Some(localhost)).into(),
);
// example relay netinfo
fbody(
cmd,
"5F6F80E1 04 04 7F000001 01 04 04 7F000001",
&msg::Netinfo::for_relay(0x5f6f80e1, Some(localhost), &[localhost][..]).into(),
);
// example ipv6 relay netinfo
let localhost_v6 = "::1".parse::<IpAddr>().unwrap();
fbody(
cmd,
"5F6F859C 06 10 00000000000000000000000000000001
02
04 04 7F000001
06 10 00000000000000000000000000000001",
&msg::Netinfo::for_relay(
0x5f6f859c,
Some(localhost_v6),
&[localhost, localhost_v6][..],
)
.into(),
);
let (_, netinfo) = test_decode(
cmd,
"5F6F859C 06 09 000000000000000000
03
04 06 7F0000010000
BB 02 FFFF
06 10 00000000000000000000000000000001",
false,
);
let expect: msg::ChanMsg =
msg::Netinfo::for_relay(0x5f6f859c, None, &[localhost_v6][..]).into();
assert_eq!(format!("{:?}", netinfo), format!("{:?}", expect));
fbody(
cmd,
"00000000 04 04 00000000 00",
&msg::Netinfo::for_client(None).into(),
);
} | rust_cleaned_test_functions.jsonl/6036 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 765
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19722,
2733,
368,
341,
262,
1077,
5439,
284,
41302,
15613,
486,
15373,
6637,
280,
262,
2060,
10714,
10297,
26591,
27638,
84,
23,
6831,
18122,
14160,
701,
220,
23,
7300,
23,
626,
262,
442,
3110,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_from_file() {
let tree = Chain::<f32>::from_urdf_file("urdf/sample.urdf").unwrap();
assert_eq!(tree.dof(), 12);
let names = tree
.iter()
.map(|joint| joint.joint().name.clone())
.collect::<Vec<_>>();
assert_eq!(names.len(), 13);
println!("{}", names[0]);
assert_eq!(names[0], "root");
assert_eq!(names[1], "r_shoulder_yaw");
} | rust_cleaned_test_functions.jsonl/20027 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 199
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11663,
5673,
2458,
368,
341,
262,
1077,
4916,
284,
28525,
27638,
69,
18,
17,
6831,
1499,
64879,
2940,
2458,
445,
324,
2940,
69851,
44785,
2940,
1827,
15454,
543,
262,
2060,
10714,
10297,
9344,
950... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_second_order_differentia() {
let x = backprop(scalar(2.0));
let y = x.pow(4.0) - Computed::new(scalar(2.0)) * x.pow(2.0);
assert_eq!(*y, scalar(8.0));
let grads = gradients(&vec![y.clone()], &vec![x.clone()], true);
assert_eq!(grads[0][[]], 24.0);
let grads = gradients(&vec![grads[0].clone()], &vec![x], false);
assert_eq!(grads[0][[]], 44.0);
} | rust_cleaned_test_functions.jsonl/35599 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 200
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29644,
7869,
82741,
685,
368,
341,
262,
1077,
856,
284,
1182,
2674,
1141,
59153,
7,
17,
13,
15,
3237,
262,
1077,
379,
284,
856,
25290,
7,
19,
13,
15,
8,
481,
1198,
19292,
486,
931,
1141,
591... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_large_merge_segments() {
let test_input = vec![
create_random_segment_meta(1_000_000),
create_random_segment_meta(100_001),
create_random_segment_meta(100_000),
create_random_segment_meta(1_000_001),
create_random_segment_meta(100_000),
create_random_segment_meta(100_000),
create_random_segment_meta(1_500_000),
];
let result_list = test_merge_policy().compute_merge_candidates(&test_input);
// Do not include large segments
assert_eq!(result_list.len(), 1);
assert_eq!(result_list[0].0.len(), 3);
// Making sure merge policy points to the correct index of the original input
assert_eq!(result_list[0].0[0], test_input[2].id());
assert_eq!(result_list[0].0[1], test_input[4].id());
assert_eq!(result_list[0].0[2], test_input[5].id());
} | rust_cleaned_test_functions.jsonl/57300 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 442
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
45228,
20888,
55735,
368,
341,
286,
1077,
1273,
5898,
284,
7486,
90515,
310,
1855,
22644,
28061,
13381,
7,
16,
62,
15,
15,
15,
62,
15,
15,
15,
1326,
310,
1855,
22644,
28061,
13381,
7,
16,
15,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_sum_avg_expr() -> Result<()> {
let funcs = vec![AggregateFunction::Sum, AggregateFunction::Avg];
let data_types = vec![
DataType::UInt32,
DataType::UInt64,
DataType::Int32,
DataType::Int64,
DataType::Float32,
DataType::Float64,
];
for fun in funcs {
for data_type in &data_types {
let input_schema =
Schema::new(vec![Field::new("c1", data_type.clone(), true)]);
let input_phy_exprs: Vec<Arc<dyn PhysicalExpr>> = vec![Arc::new(
expressions::Column::new_with_schema("c1", &input_schema).unwrap(),
)];
let result_agg_phy_exprs = create_aggregate_expr(
&fun,
false,
&input_phy_exprs[0..1],
&input_schema,
"c1",
)?;
match fun {
AggregateFunction::Sum => {
assert!(result_agg_phy_exprs.as_any().is::<Sum>());
assert_eq!("c1", result_agg_phy_exprs.name());
let expect_type = match data_type {
DataType::UInt8
| DataType::UInt16
| DataType::UInt32
| DataType::UInt64 => DataType::UInt64,
DataType::Int8
| DataType::Int16
| DataType::Int32
| DataType::Int64 => DataType::Int64,
DataType::Float32 | DataType::Float64 => DataType::Float64,
_ => data_type.clone(),
};
assert_eq!(
Field::new("c1", expect_type.clone(), true),
result_agg_phy_exprs.field().unwrap()
);
}
AggregateFunction::Avg => {
assert!(result_agg_phy_exprs.as_any().is::<Avg>());
assert_eq!("c1", result_agg_phy_exprs.name());
assert_eq!(
Field::new("c1", DataType::Float64, true),
result_agg_phy_exprs.field().unwrap()
);
}
_ => {}
};
}
}
Ok(())
} | rust_cleaned_test_functions.jsonl/4585 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1652
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10160,
26631,
21915,
368,
1464,
5714,
71698,
341,
286,
1077,
76871,
284,
7486,
20703,
64580,
5152,
486,
9190,
11,
56922,
5152,
486,
39447,
935,
286,
1077,
821,
9763,
284,
7486,
90515,
310,
33172,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_column_major() {
assert_eq!(
Mat::row_major(
1.0, 2.0,
3.0, 4.0,
5.0, 6.0
),
Mat::column_major(
1.0, 3.0, 5.0,
2.0, 4.0, 6.0,
)
);
} | rust_cleaned_test_functions.jsonl/596 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 242
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
8744,
47916,
368,
341,
286,
2060,
10714,
33673,
310,
6867,
486,
651,
47916,
1006,
394,
220,
16,
13,
15,
11,
220,
220,
17,
13,
15,
345,
394,
220,
18,
13,
15,
11,
220,
220,
19,
13,
15,
345,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_topn_with_empty_limit() {
let mut topn_heap =
TopNHeap::new(0, Arc::new(RefCell::new(EvalContext::default()))).unwrap();
let cur_key: Vec<Datum> = vec![Datum::I64(1), Datum::I64(2)];
let row_data = RowColsDict::new(HashMap::default(), b"ssss".to_vec());
topn_heap
.try_add_row(
OriginCols::new(i64::from(1), row_data, Arc::default()),
cur_key,
Arc::new(Vec::default()),
)
.unwrap();
assert!(topn_heap.into_sorted_vec().unwrap().is_empty());
} | rust_cleaned_test_functions.jsonl/67541 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 336
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10426,
77,
6615,
15124,
14763,
368,
341,
286,
1077,
5206,
1909,
77,
33059,
4035,
310,
6909,
45,
27909,
486,
931,
7,
15,
11,
19689,
486,
931,
7,
3945,
3599,
486,
931,
10722,
831,
1972,
486,
225... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_relative_method_uri() {
let keypair: KeyPair = generate_testkey();
let mut document: IotaDocument = IotaDocument::from_keypair(&keypair).unwrap();
assert!(document.proof().is_none());
assert!(document.sign(keypair.secret()).is_ok());
assert_eq!(document.proof().unwrap().verification_method(), "#authentication");
} | rust_cleaned_test_functions.jsonl/84338 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 129
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29286,
9032,
15572,
368,
341,
262,
1077,
1376,
12670,
25,
5309,
12443,
284,
6923,
4452,
792,
543,
262,
1077,
5206,
2197,
25,
358,
6089,
7524,
284,
358,
6089,
7524,
486,
1499,
3097,
12670,
2099,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_extend_or_shorten_widget_width() {
let mut app = App::new(Config::default());
assert_eq!(
app.extend_or_shorten_widget_width(Key::Char('>')).unwrap(),
EventState::Consumed
);
assert_eq!(app.left_main_chunk_percentage, 20);
app.left_main_chunk_percentage = 70;
assert_eq!(
app.extend_or_shorten_widget_width(Key::Char('>')).unwrap(),
EventState::Consumed
);
assert_eq!(app.left_main_chunk_percentage, 70);
assert_eq!(
app.extend_or_shorten_widget_width(Key::Char('<')).unwrap(),
EventState::Consumed
);
assert_eq!(app.left_main_chunk_percentage, 65);
app.left_main_chunk_percentage = 15;
assert_eq!(
app.extend_or_shorten_widget_width(Key::Char('<')).unwrap(),
EventState::Consumed
);
assert_eq!(app.left_main_chunk_percentage, 15);
} | rust_cleaned_test_functions.jsonl/112402 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 504
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
70265,
8734,
16673,
268,
13585,
7927,
368,
341,
286,
1077,
5206,
906,
284,
1845,
486,
931,
33687,
486,
2258,
1423,
286,
2060,
10714,
33673,
310,
906,
15831,
8734,
16673,
268,
13585,
7927,
21358,
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_type_parameter() {
check(
"T:Int",
type_parameter,
TypeParam {
name: TokenSyntax::from("T"),
type_constraint: Some(TypeConstraintSyntax {
sep: TokenSyntax::from(":"),
constraint: TypeName::Simple(SimpleTypeName {
name: TokenSyntax::from("Int"),
type_args: None,
}),
}),
},
);
check(
"T :Int",
type_parameter,
TypeParam {
name: TokenSyntax::from("T"),
type_constraint: Some(TypeConstraintSyntax {
sep: TokenSyntax::from(":")
.with_leading_trivia(Trivia::from(TriviaPiece::Spaces(1))),
constraint: TypeName::Simple(SimpleTypeName {
name: TokenSyntax::from("Int"),
type_args: None,
}),
}),
},
);
check(
"T: Int",
type_parameter,
TypeParam {
name: TokenSyntax::from("T"),
type_constraint: Some(TypeConstraintSyntax {
sep: TokenSyntax::from(":"),
constraint: TypeName::Simple(SimpleTypeName {
name: TokenSyntax::from("Int"),
type_args: None,
})
.with_leading_trivia(Trivia::from(TriviaPiece::Spaces(1))),
}),
},
);
check(
"T : Int",
type_parameter,
TypeParam {
name: TokenSyntax::from("T"),
type_constraint: Some(TypeConstraintSyntax {
sep: TokenSyntax::from(":")
.with_leading_trivia(Trivia::from(TriviaPiece::Spaces(1))),
constraint: TypeName::Simple(SimpleTypeName {
name: TokenSyntax::from("Int"),
type_args: None,
})
.with_leading_trivia(Trivia::from(TriviaPiece::Spaces(1))),
}),
},
);
} | rust_cleaned_test_functions.jsonl/129308 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1411
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1819,
24899,
368,
341,
286,
1779,
1006,
310,
330,
51,
43979,
756,
310,
943,
24899,
345,
310,
3990,
2001,
341,
394,
829,
25,
9660,
33890,
486,
1499,
445,
51,
4461,
394,
943,
46973,
25,
4329,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_escaping() {
let template = compile("{ escapes }");
let context = context();
let template_registry = other_templates();
let formatter_registry = formatters();
let string = template
.render(&context, &template_registry, &formatter_registry)
.unwrap();
assert_eq!("1:< 2:> 3:& 4:' 5:"", &string);
} | rust_cleaned_test_functions.jsonl/2391 | {
"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,
62,
42480,
368,
972,
286,
1077,
3811,
284,
19192,
13976,
65109,
335,
2815,
286,
1077,
2266,
284,
2266,
1647,
286,
1077,
3811,
50650,
284,
1008,
49526,
1647,
286,
1077,
24814,
50650,
284,
1352,
101... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_matrix_transpose_generic() {
let matrix: [u8; 9] = [0, 1, 2, 3, 4, 5, 6, 7, 8];
let mut output_matrix: [u8; 9] = [0; 9];
let stride = 1;
transpose_generic(&matrix, &mut output_matrix, 3, 3, stride);
for y in 0..3 {
for x in 0..3 {
let first_val = matrix[y * 3 + x];
let second_val = output_matrix[x * 3 + y];
assert!(first_val == second_val, "{} {}", first_val, second_val);
}
}
} | rust_cleaned_test_functions.jsonl/20803 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 290
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10193,
7965,
2900,
41232,
368,
341,
286,
1077,
6172,
25,
508,
84,
23,
26,
220,
24,
60,
284,
508,
15,
11,
220,
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20,
11,
220,
21,
11,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 3 |
#[test]
fn test_eval_fun1() {
let source_code = "let apply = fun f -> fun x -> fun y -> if x < y then f x + y else f x * y in apply (fun x -> x + 1) 5 3;;";
let result = interpret(source_code, false, false);
assert_eq!(result, vec![ExprVal::I64(18)],);
} | rust_cleaned_test_functions.jsonl/41116 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 129
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21296,
28315,
16,
368,
341,
286,
1077,
2530,
4136,
284,
330,
1149,
3796,
284,
2464,
282,
1464,
2464,
856,
1464,
2464,
379,
1464,
421,
856,
366,
379,
1221,
282,
856,
488,
379,
770,
282,
856,
35... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_code_fetch() {
let (_temp_dir, deno_dir) = test_setup();
let cwd = std::env::current_dir().unwrap();
let cwd_string = String::from(cwd.to_str().unwrap()) + "/";
// Test failure case.
let module_specifier = "hello.ts";
let containing_file = add_root!("/baddir/badfile.ts");
let r = deno_dir.code_fetch(module_specifier, containing_file);
assert!(r.is_err());
// Assuming cwd is the deno repo root.
let module_specifier = "./js/main.ts";
let containing_file = cwd_string.as_str();
let r = deno_dir.code_fetch(module_specifier, containing_file);
assert!(r.is_ok());
} | rust_cleaned_test_functions.jsonl/18030 | {
"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,
4136,
11803,
368,
341,
220,
1077,
5453,
3888,
4334,
11,
3371,
78,
4334,
8,
284,
1273,
21363,
1428,
220,
1077,
46938,
284,
1460,
486,
3160,
486,
3231,
4334,
1005,
15454,
543,
220,
1077,
46938,
39... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_create() {
new_test_ext().execute_with(|| {
assert_eq!(DigitalTwin::total(), None);
let sender = 1;
assert_ok!(DigitalTwin::create(Origin::signed(sender)));
assert_eq!(DigitalTwin::total(), Some(1));
assert_eq!(DigitalTwin::owner(0), Some(sender));
})
} | rust_cleaned_test_functions.jsonl/126433 | {
"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,
8657,
368,
341,
286,
501,
4452,
9927,
1005,
10257,
6615,
79453,
341,
310,
2060,
10714,
10297,
38112,
51,
7526,
486,
5035,
1507,
2240,
317,
310,
1077,
4646,
284,
220,
16,
280,
310,
2060,
19817,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_multiple_anagrams() {
let inputs = [
"gallery",
"ballerina",
"regally",
"clergy",
"largely",
"leading",
];
let mut outputs: Vec<&str> = vec!["gallery", "regally", "largely"];
outputs.sort();
let mut result = anagram::anagrams_for("allergy", &inputs);
result.sort();
assert_eq!(result, outputs);
} | rust_cleaned_test_functions.jsonl/65509 | {
"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,
45233,
12008,
68772,
368,
341,
262,
1077,
11127,
284,
2278,
286,
330,
26205,
756,
286,
330,
3959,
261,
2210,
756,
286,
330,
1580,
745,
756,
286,
330,
564,
41943,
756,
286,
330,
26897,
974,
756,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fail_unfinished_string() {
let src_data = b"(test) \"abc";
assert!(yass_parser::parse(yass_parser::ParserLimits::unlimited(), src_data).is_err());
} | rust_cleaned_test_functions.jsonl/126501 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 74
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22121,
4907,
12129,
3904,
368,
341,
262,
1077,
2286,
1769,
284,
293,
29209,
1944,
8,
7245,
13683,
876,
262,
2060,
10297,
88,
395,
18517,
486,
6400,
7021,
395,
18517,
486,
6570,
94588,
486,
359,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_none_or_up_to_42_large() {
let occurence: Occurences<u32> = Occurences::NoneOrUpTo(Some(42));
occurence.check_count(43).unwrap();
} | rust_cleaned_test_functions.jsonl/4445 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 87
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31488,
8734,
8237,
2346,
62,
19,
17,
45228,
368,
341,
286,
1077,
2983,
86937,
25,
19927,
552,
98162,
34837,
18,
17,
29,
284,
19927,
552,
98162,
486,
4064,
2195,
2324,
1249,
65405,
7,
19,
17,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_percent_rank() -> Result<()> {
let r = percent_rank("arr".into());
// empty case
let expected = vec![0.0; 0];
test_f64_result(&r, vec![0; 0], 0..0, vec![0..0; 0], expected)?;
// singleton case
let expected = vec![0.0];
test_f64_result(&r, vec![13], 0..1, vec![0..1], expected)?;
// uniform case
let expected = vec![0.0; 7];
test_f64_result(&r, vec![4; 7], 0..7, vec![0..7], expected)?;
// non-trivial case
let expected = vec![0.0, 0.0, 0.0, 0.5, 0.5, 0.5, 0.5];
test_f64_result(
&r,
vec![1, 1, 1, 2, 2, 2, 2],
0..7,
vec![0..3, 3..7],
expected,
)?;
Ok(())
} | rust_cleaned_test_functions.jsonl/129707 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 445
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29883,
20417,
368,
1464,
5714,
71698,
341,
286,
1077,
435,
284,
3266,
20417,
445,
1118,
3263,
18122,
5231,
286,
442,
4287,
1142,
198,
286,
1077,
3601,
284,
7486,
20703,
15,
13,
15,
26,
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... | 5 |
#[test]
fn test_simple_operator_eq_plaintext_to_string() {
let name1 = _random_vector(10);
let value1 = _random_string(10);
let query = Operator::Eq(
TagName::PlainTagName(name1.clone()),
TargetValue::Unencrypted(value1.clone())
);
let json = query.to_string();
let expected = format!(r#"{{"~{}":"{}"}}"#, base64::encode(&name1), value1);
assert_eq!(json, expected);
} | rust_cleaned_test_functions.jsonl/11876 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 220
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
30015,
40594,
10714,
6317,
1641,
427,
2346,
3904,
368,
341,
286,
1077,
829,
16,
284,
716,
11463,
12247,
7,
16,
15,
317,
286,
1077,
897,
16,
284,
716,
11463,
3904,
7,
16,
15,
626,
286,
1077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_iterate_into_string() {
let words = vec!["hello", " ", "world"];
let capitalized_words = format!("{} {}", capitalize_first(words[0]), capitalize_first(words[2]));
assert_eq!(capitalized_words, "Hello World");
} | rust_cleaned_test_functions.jsonl/48522 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 109
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11723,
349,
45514,
3904,
368,
341,
286,
1077,
4244,
284,
7486,
0,
1183,
14990,
497,
330,
3670,
330,
14615,
6332,
286,
1077,
97321,
18981,
284,
3561,
17223,
6257,
24689,
52725,
12978,
36289,
58,
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 |
#[test]
fn test_cp_localize_to_target() {
assert!(
localize_to_target(
Path::new("a/source/"),
Path::new("a/source/c.txt"),
Path::new("target/")
)
.unwrap()
== Path::new("target/c.txt")
);
} | rust_cleaned_test_functions.jsonl/57419 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39811,
13564,
551,
2346,
11123,
368,
341,
262,
2060,
33673,
286,
94416,
2346,
11123,
1006,
310,
7933,
486,
931,
445,
64,
54373,
14,
4461,
310,
7933,
486,
931,
445,
64,
54373,
2899,
3909,
4461,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_option_list_get() {
// Regression test for #798
let gil = Python::acquire_gil();
let py = gil.python();
let list = PyCell::new(
py,
OptionList {
items: vec![Some(1), None],
},
)
.unwrap();
py_assert!(py, list, "list[0] == 1");
py_assert!(py, list, "list[1] == None");
py_expect_exception!(py, list, "list[2]", PyIndexError);
} | rust_cleaned_test_functions.jsonl/46923 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 208
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
9672,
2019,
3062,
368,
341,
262,
442,
47470,
1273,
369,
671,
22,
24,
23,
198,
262,
1077,
342,
321,
284,
13027,
486,
580,
984,
1889,
321,
543,
262,
1077,
4510,
284,
342,
321,
43193,
1428,
262,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_environment_tag_is_moved() {
let mut event = Annotated::new(Event {
tags: Annotated::new(Tags(PairList(vec![Annotated::new(TagEntry(
Annotated::new("environment".to_string()),
Annotated::new("despacito".to_string()),
))]))),
..Event::default()
});
let mut processor = NormalizeProcessor::default();
process_value(&mut event, &mut processor, ProcessingState::root()).unwrap();
let event = event.value().unwrap();
assert_eq_dbg!(event.environment.as_str(), Some("despacito"));
assert_eq_dbg!(event.tags.value(), Some(&Tags(vec![].into())));
} | rust_cleaned_test_functions.jsonl/14087 | {
"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,
51774,
9372,
6892,
717,
4941,
368,
341,
262,
1077,
5206,
1538,
284,
1527,
87029,
486,
931,
30469,
341,
286,
9492,
25,
1527,
87029,
486,
931,
4140,
2032,
5304,
1310,
852,
25592,
20703,
2082,
87029,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_from_root() {
let GenesisConfigInfo {
mut genesis_config, ..
} = create_genesis_config(123);
let ticks_per_slot = 1;
genesis_config.ticks_per_slot = ticks_per_slot;
let (ledger_path, blockhash) = create_new_tmp_ledger_auto_delete!(&genesis_config);
let blockstore = Blockstore::open(ledger_path.path()).unwrap();
let mut last_hash = blockhash;
for i in 0..6 {
last_hash =
fill_blockstore_slot_with_ticks(&blockstore, ticks_per_slot, i + 1, i, last_hash);
}
blockstore.set_roots(vec![3, 5].iter()).unwrap();
// Set up bank1
let bank0 = Arc::new(Bank::new_for_tests(&genesis_config));
let opts = ProcessOptions {
poh_verify: true,
accounts_db_test_hash_calculation: true,
..ProcessOptions::default()
};
let recyclers = VerifyRecyclers::default();
process_bank_0(&bank0, &blockstore, &opts, &recyclers, None);
let bank1 = Arc::new(Bank::new_from_parent(&bank0, &Pubkey::default(), 1));
confirm_full_slot(
&blockstore,
&bank1,
&opts,
&recyclers,
&mut ConfirmationProgress::new(bank0.last_blockhash()),
None,
None,
&mut ExecuteTimings::default(),
)
.unwrap();
bank1.squash();
let (accounts_package_sender, _) = channel();
let (bank_forks, ..) = do_process_blockstore_from_root(
&blockstore,
bank1,
&opts,
&recyclers,
None,
None,
None,
accounts_package_sender,
BankFromArchiveTimings::default(),
None,
)
.unwrap();
assert_eq!(frozen_bank_slots(&bank_forks), vec![5, 6]);
assert_eq!(bank_forks.working_bank().slot(), 6);
assert_eq!(bank_forks.root(), 5);
// Verify the parents of the head of the fork
assert_eq!(
&bank_forks[6]
.parents()
.iter()
.map(|bank| bank.slot())
.collect::<Vec<_>>(),
&[5]
);
// Check that bank forks has the correct banks
verify_fork_infos(&bank_forks);
} | rust_cleaned_test_functions.jsonl/46819 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1263
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
11305,
7113,
4314,
5673,
12993,
368,
341,
286,
1077,
40788,
2648,
1731,
341,
310,
5206,
59366,
5332,
11,
54538,
286,
335,
284,
1855,
16322,
13774,
5332,
7,
16,
17,
18,
626,
286,
1077,
29957,
567... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_memory_export() {
let wasm: Vec<u8> = vec![
0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x05, 0x03, 0x01, 0x00, 0x00, 0x07,
0x0a, 0x01, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x02, 0x00,
];
let mut checker = EcicChecker::default(&wasm);
assert_eq!(
checker.checks.get_check_status("export-memory"),
CheckStatus::Unknown
);
checker.fire();
assert_eq!(
checker.checks.get_check_status("export-memory"),
CheckStatus::Good
);
} | rust_cleaned_test_functions.jsonl/10744 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 349
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
19195,
27114,
368,
341,
286,
1077,
98263,
25,
11312,
34837,
23,
29,
284,
7486,
90515,
310,
220,
15,
87,
15,
15,
11,
220,
15,
87,
21,
16,
11,
220,
15,
87,
22,
18,
11,
220,
15,
87,
21,
67,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_str() {
assert_eq!(
r#"gene_id "g0";"#.parse(),
Ok(Attributes::from(vec![Entry::new("gene_id", "g0")]))
);
assert_eq!(
r#"gene_id "g0"; transcript_id "t0";"#.parse(),
Ok(Attributes::from(vec![
Entry::new("gene_id", "g0"),
Entry::new("transcript_id", "t0")
]))
);
assert_eq!("".parse::<Attributes>(), Err(ParseError::Empty));
assert_eq!(
r#"gene_id "g0""#.parse::<Attributes>(),
Err(ParseError::Invalid)
);
assert_eq!(
r#"gene_id "g0";transcript_id "t0";"#.parse::<Attributes>(),
Err(ParseError::Invalid)
);
assert_eq!(
r#"gene_id "g0"; transcript_id "t0";"#.parse::<Attributes>(),
Err(ParseError::Invalid)
);
assert!(matches!(
r#";"#.parse::<Attributes>(),
Err(ParseError::InvalidEntry(_))
));
} | rust_cleaned_test_functions.jsonl/83479 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 595
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
2895,
368,
341,
286,
2060,
10714,
33673,
310,
435,
55543,
42371,
842,
330,
70,
15,
5123,
57676,
13,
6400,
3148,
310,
7622,
7,
10516,
486,
1499,
25592,
20703,
5874,
486,
931,
445,
42371,
84... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_search_guild_members() {
let route = Route::SearchGuildMembers {
guild_id: GUILD_ID,
limit: Some(99),
query: "foo bar",
};
assert_eq!(
route.to_string(),
format!(
"guilds/{guild_id}/members/search?query=foo%20bar&limit=99",
guild_id = GUILD_ID,
)
);
let route = Route::SearchGuildMembers {
guild_id: GUILD_ID,
limit: Some(99),
query: "foo/bar",
};
assert_eq!(
route.to_string(),
format!(
"guilds/{guild_id}/members/search?query=foo%2Fbar&limit=99",
guild_id = GUILD_ID,
)
);
} | rust_cleaned_test_functions.jsonl/119976 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 469
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
10716,
1889,
1498,
30397,
368,
341,
286,
1077,
6021,
284,
9572,
486,
5890,
72574,
24371,
341,
310,
26411,
842,
25,
479,
18023,
3450,
345,
310,
3930,
25,
4329,
7,
24,
24,
1326,
310,
3239,
25,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_delay_first_test_case() {
let first_line = "R75,D30,R83,U83,L12,D49,R71,U7,L72";
let second_line = "U62,R66,U55,R34,D71,R55,D58,R83";
assert_eq!(610, get_minimum_signal_delay_intersection(first_line, second_line));
} | rust_cleaned_test_functions.jsonl/45005 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 142
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22198,
12978,
4452,
19096,
368,
341,
286,
1077,
1156,
6528,
284,
330,
49,
22,
20,
27266,
18,
15,
23508,
23,
18,
50481,
23,
18,
30114,
16,
17,
27266,
19,
24,
23508,
22,
16,
50481,
22,
30114,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_either() {
let req = TestRequest::default().finish();
let mut cfg: EitherConfig<Query<Info>, Query<OtherInfo>, _> = EitherConfig::default();
assert!(Either::<Query<Info>, Query<OtherInfo>>::from_request(&req, &cfg).poll().is_err());
let req = TestRequest::default().uri("/index?hello=world").finish();
match Either::<Query<Info>, Query<OtherInfo>>::from_request(&req, &cfg).poll().unwrap() {
Async::Ready(r) => assert_eq!(r, Either::A(Query(Info { hello: "world".into() }))),
_ => unreachable!(),
}
let req = TestRequest::default().uri("/index?bye=world").finish();
match Either::<Query<Info>, Query<OtherInfo>>::from_request(&req, &cfg).poll().unwrap() {
Async::Ready(r) => assert_eq!(r, Either::B(Query(OtherInfo { bye: "world".into() }))),
_ => unreachable!(),
}
let req = TestRequest::default().uri("/index?hello=world&bye=world").finish();
cfg.collision_strategy = EitherCollisionStrategy::PreferA;
match Either::<Query<Info>, Query<OtherInfo>>::from_request(&req, &cfg).poll().unwrap() {
Async::Ready(r) => assert_eq!(r, Either::A(Query(Info { hello: "world".into() }))),
_ => unreachable!(),
}
cfg.collision_strategy = EitherCollisionStrategy::PreferB;
match Either::<Query<Info>, Query<OtherInfo>>::from_request(&req, &cfg).poll().unwrap() {
Async::Ready(r) => assert_eq!(r, Either::B(Query(OtherInfo { bye: "world".into() }))),
_ => unreachable!(),
}
cfg.collision_strategy = EitherCollisionStrategy::ErrorA;
assert!(Either::<Query<Info>, Query<OtherInfo>>::from_request(&req, &cfg).poll().is_err());
cfg.collision_strategy = EitherCollisionStrategy::FastestSuccessful;
assert!(Either::<Query<Info>, Query<OtherInfo>>::from_request(&req, &cfg).poll().is_ok());
} | rust_cleaned_test_functions.jsonl/46184 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 825
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2204,
2485,
368,
341,
286,
1077,
4232,
284,
3393,
1900,
486,
2258,
1005,
30150,
543,
286,
1077,
5206,
13286,
25,
20988,
2648,
27,
2859,
27,
1731,
8066,
11361,
27,
11409,
1731,
8066,
716,
29,
284... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 5 |
#[test]
fn test_ord() {
let body1 = ReportBody::try_from(&REPORT_BODY_SRC).expect("Could not read report");
let mut body2 = body1.clone();
let orig_value = body2.0.cpu_svn.svn[0];
body2.0.cpu_svn.svn[0] = 255;
assert!(body1 < body2);
body2.0.cpu_svn.svn[0] = orig_value;
assert_eq!(body1, body2);
let orig_value = body2.0.misc_select;
body2.0.misc_select = 255;
assert!(body1 < body2);
body2.0.misc_select = orig_value;
assert_eq!(body1, body2);
let orig_value = body2.0.isv_ext_prod_id[0];
body2.0.isv_ext_prod_id[0] = 255;
assert!(body1 < body2);
body2.0.isv_ext_prod_id[0] = orig_value;
assert_eq!(body1, body2);
let orig_value = body2.0.isv_ext_prod_id[0];
body2.0.isv_ext_prod_id[0] = 255;
assert!(body1 < body2);
body2.0.isv_ext_prod_id[0] = orig_value;
assert_eq!(body1, body2);
let orig_value = body2.0.attributes.flags;
body2.0.attributes.flags += 1;
assert!(body1 < body2);
body2.0.attributes.flags = orig_value;
assert_eq!(body1, body2);
let orig_value = body2.0.attributes.xfrm;
body2.0.attributes.xfrm += 1;
assert!(body1 < body2);
body2.0.attributes.xfrm = orig_value;
assert_eq!(body1, body2);
let orig_value = body2.0.mr_enclave.m[0];
body2.0.mr_enclave.m[0] = 255;
assert!(body1 < body2);
body2.0.mr_enclave.m[0] = orig_value;
assert_eq!(body1, body2);
let orig_value = body2.0.mr_signer.m[0];
body2.0.mr_signer.m[0] = 255;
assert!(body1 < body2);
body2.0.mr_signer.m[0] = orig_value;
assert_eq!(body1, body2);
let orig_value = body2.0.config_id[0];
body2.0.config_id[0] = 255;
assert!(body1 < body2);
body2.0.config_id[0] = orig_value;
assert_eq!(body1, body2);
let orig_value = body2.0.isv_prod_id;
body2.0.isv_prod_id = 255;
assert!(body1 < body2);
body2.0.isv_prod_id = orig_value;
assert_eq!(body1, body2);
let orig_value = body2.0.isv_svn;
body2.0.isv_svn = 255;
assert!(body1 < body2);
body2.0.isv_svn = orig_value;
assert_eq!(body1, body2);
let orig_value = body2.0.isv_family_id[0];
body2.0.isv_family_id[0] = 255;
assert!(body1 < body2);
body2.0.isv_family_id[0] = orig_value;
assert_eq!(body1, body2);
let orig_value = body2.0.report_data.d[0];
body2.0.report_data.d[0] = 255;
assert!(body1 < body2);
body2.0.report_data.d[0] = orig_value;
assert_eq!(body1, body2);
} | rust_cleaned_test_functions.jsonl/102457 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1525
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
67324,
368,
341,
286,
1077,
2487,
16,
284,
8259,
5444,
486,
1539,
5673,
2099,
78131,
44411,
29409,
568,
17119,
445,
12895,
537,
1349,
1895,
797,
286,
1077,
5206,
2487,
17,
284,
2487,
16,
15997,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_accounts_unsquashed() {
let key = Pubkey::default();
let paths = get_tmp_accounts_path!();
let db0 = AccountsDB::new(0, &paths.paths);
let account0 = Account::new(1, 0, &key);
db0.store(0, &key, &account0);
db0.add_fork(1, Some(0));
// 0 lamports in the child
let account1 = Account::new(0, 0, &key);
db0.store(1, &key, &account1);
// original account
assert_eq!(db0.load(1, &key, true), Some(account1));
let mut accounts1 = Accounts::new(3, None);
accounts1.accounts_db = db0;
assert_eq!(accounts1.load_slow(1, &key), None);
assert_eq!(accounts1.load_slow(0, &key), Some(account0));
} | rust_cleaned_test_functions.jsonl/77666 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 374
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
55665,
4907,
97407,
13571,
368,
341,
286,
1077,
1376,
284,
22611,
792,
486,
2258,
1428,
1789,
286,
1077,
12716,
284,
633,
16125,
55665,
2638,
0,
543,
286,
1077,
2927,
15,
284,
40655,
3506,
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_random_wallet_no_entropy_testnet() {
let out_dir = std::env::var("OUT_DIR").unwrap();
let mut jscontext = JavaScript::new(format!("{}/xpring.js", out_dir))?;
let wallet = generate_random(&mut jscontext, None, true)?;
assert_eq!(wallet.mnemonic.is_empty(), false);
} | rust_cleaned_test_functions.jsonl/118727 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 140
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22644,
62308,
6536,
50374,
4452,
4711,
368,
341,
286,
1077,
700,
4334,
284,
1460,
486,
3160,
486,
947,
445,
3656,
8291,
1827,
15454,
543,
286,
1077,
5206,
6994,
2147,
284,
12914,
486,
931,
20698,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_skipmap_iterator_prev() {
let skm = make_skipmap();
let mut iter = skm.iter();
iter.next();
assert!(iter.valid());
iter.prev();
assert!(!iter.valid());
iter.seek(&"abc".as_bytes());
iter.prev();
assert_eq!(
current_key_val(&iter).unwrap(),
("abb".as_bytes().to_vec(), "def".as_bytes().to_vec())
);
} | rust_cleaned_test_functions.jsonl/89160 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 226
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
44830,
2186,
13491,
25566,
368,
341,
286,
1077,
1901,
76,
284,
1281,
44830,
2186,
543,
286,
1077,
5206,
5367,
284,
1901,
76,
19471,
1428,
286,
5367,
4529,
543,
286,
2060,
10297,
2015,
20586,
1423,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_get_default_bundle_filename() {
assert_eq!(get_default_bundle_filename("blah.ts"), "blah.bundle.js");
assert_eq!(
get_default_bundle_filename("http://example.com/blah.ts"),
"blah.bundle.js"
);
assert_eq!(get_default_bundle_filename("blah.js"), "blah.bundle.js");
assert_eq!(
get_default_bundle_filename("http://example.com/blah.js"),
"blah.bundle.js"
);
assert_eq!(
get_default_bundle_filename("http://zombo.com/stuff/"),
"stuff.bundle.js"
);
} | rust_cleaned_test_functions.jsonl/112829 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 225
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
9993,
60986,
13323,
368,
341,
220,
2060,
10714,
10297,
455,
9993,
60986,
13323,
445,
70614,
21288,
3975,
330,
70614,
51085,
2857,
797,
220,
2060,
10714,
33673,
262,
633,
9993,
60986,
13323,
44... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_roundtrip_bank_to_and_from_full_snapshot_simple() {
solana_logger::setup();
let genesis_config = GenesisConfig::default();
let original_bank = Bank::new_for_tests(&genesis_config);
while !original_bank.is_complete() {
original_bank.register_tick(&Hash::new_unique());
}
let accounts_dir = tempfile::TempDir::new().unwrap();
let bank_snapshots_dir = tempfile::TempDir::new().unwrap();
let snapshot_archives_dir = tempfile::TempDir::new().unwrap();
let snapshot_archive_format = ArchiveFormat::Tar;
let snapshot_archive_info = bank_to_full_snapshot_archive(
&bank_snapshots_dir,
&original_bank,
None,
snapshot_archives_dir.path(),
snapshot_archive_format,
1,
)
.unwrap();
let (roundtrip_bank, _) = bank_from_snapshot_archives(
&[PathBuf::from(accounts_dir.path())],
&[],
bank_snapshots_dir.path(),
&snapshot_archive_info,
None,
&genesis_config,
None,
None,
AccountSecondaryIndexes::default(),
false,
None,
AccountShrinkThreshold::default(),
false,
false,
false,
Some(crate::accounts_index::ACCOUNTS_INDEX_CONFIG_FOR_TESTING),
)
.unwrap();
assert_eq!(original_bank, roundtrip_bank);
} | rust_cleaned_test_functions.jsonl/67614 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 762
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
29896,
32981,
35733,
2346,
8378,
5673,
16372,
53265,
30015,
368,
341,
286,
2048,
3362,
27413,
486,
15188,
543,
286,
1077,
59366,
5332,
284,
40788,
2648,
486,
2258,
543,
286,
1077,
4024,
35733,
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... | 2 |
#[test]
fn test_scalar_matrix_multiplication() {
let matrix1x3 = Matrix1x3::new(1_i32, 2_i32, 3_i32);
let scalar = 13_i32;
let expected = Matrix1x3::new(13_i32, 26_i32, 39_i32);
let result = scalar * matrix1x3;
assert_eq!(result, expected);
} | rust_cleaned_test_functions.jsonl/129169 | {
"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,
41652,
10193,
91802,
1693,
368,
341,
286,
1077,
6172,
16,
87,
18,
284,
11631,
16,
87,
18,
486,
931,
7,
16,
5318,
18,
17,
11,
220,
17,
5318,
18,
17,
11,
220,
18,
5318,
18,
17,
317,
286,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_start() {
let subcommand = Subcommand::Modify {
filter: Filter {
conditions: vec![Condition::IdList(vec![TaskId::WorkingSetId(123)])],
},
modification: Modification {
active: Some(true),
..Default::default()
},
};
assert_eq!(
Subcommand::parse(argv!["123", "start"]).unwrap(),
(&EMPTY[..], subcommand)
);
} | rust_cleaned_test_functions.jsonl/84279 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 264
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4906,
368,
341,
286,
1077,
1186,
5631,
284,
3719,
5631,
486,
44427,
341,
310,
4051,
25,
12339,
341,
394,
4682,
25,
7486,
20703,
10547,
486,
764,
852,
25592,
20703,
6262,
764,
486,
33978,
1649,
7... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_join_lines_normal_comments() {
check_join_lines(
r"
fn foo() {
// Hello<|>
// world!
}
",
r"
fn foo() {
// Hello<|> world!
}
",
);
} | rust_cleaned_test_functions.jsonl/79942 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 124
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
31017,
18323,
13973,
30359,
368,
341,
286,
1779,
31017,
18323,
1006,
310,
435,
698,
8822,
15229,
368,
341,
262,
442,
21927,
27,
91,
397,
262,
442,
1879,
4894,
532,
756,
310,
435,
698,
8822,
1522... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_add_remove_active_device() {
let mut d = TestDevices::default();
let core_a = MockDeviceId(1);
let core_b = MockDeviceId(2);
let a = d.add_active_device(core_a, |id| id + 10).expect("can add device");
let b = d.add_active_device(core_b, |id| id + 20).expect("can add device");
assert_ne!(a, b, "allocated same id");
assert_eq!(d.add_active_device(core_a, |id| id + 10), None, "can't add same id again");
// check that ids are incrementing
assert_eq!(d.last_id, 2);
// check that devices are correctly inserted and carry the core id.
assert_eq!(d.get_device(a).unwrap().core_id.unwrap(), core_a);
assert_eq!(d.get_device(b).unwrap().core_id.unwrap(), core_b);
assert_eq!(d.get_core_id(a).unwrap(), core_a);
assert_eq!(d.get_core_id(b).unwrap(), core_b);
assert_eq!(d.get_binding_id(core_a).unwrap(), a);
assert_eq!(d.get_binding_id(core_b).unwrap(), b);
// check that we can retrieve both devices by the core id:
assert_matches!(d.get_core_device_mut(core_a), Some(_));
assert_matches!(d.get_core_device_mut(core_b), Some(_));
// remove both devices
let info_a = d.remove_device(a).expect("can remove device");
let info_b = d.remove_device(b).expect("can remove device");
assert_eq!(info_a.info, a + 10);
assert_eq!(info_b.info, b + 20);
assert_eq!(info_a.core_id.unwrap(), core_a);
assert_eq!(info_b.core_id.unwrap(), core_b);
// removing device again will fail
assert_eq!(d.remove_device(a), None);
// retrieving the devices now should fail:
assert_eq!(d.get_device(a), None);
assert_eq!(d.get_core_id(a), None);
assert_eq!(d.get_core_device_mut(core_a), None);
assert!(d.active_devices.is_empty());
assert!(d.inactive_devices.is_empty());
assert!(d.id_map.is_empty());
} | rust_cleaned_test_functions.jsonl/18160 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 918
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2891,
18193,
12930,
9204,
368,
341,
286,
1077,
5206,
294,
284,
3393,
40835,
486,
2258,
543,
286,
1077,
6200,
4306,
284,
14563,
6985,
764,
7,
16,
317,
286,
1077,
6200,
880,
284,
14563,
6985,
764,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_encode_describe_portal() {
const EXPECTED: &[u8] = b"D\0\0\0\x0EPsqlx_p_5\0";
let mut buf = Vec::new();
let m = Describe::Portal(5);
m.encode(&mut buf);
assert_eq!(buf, EXPECTED);
} | rust_cleaned_test_functions.jsonl/29087 | {
"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,
11224,
15768,
3114,
97077,
368,
341,
262,
733,
8921,
1479,
25,
44590,
84,
23,
60,
284,
293,
61428,
59,
15,
59,
15,
59,
15,
3462,
15,
9197,
3544,
87,
620,
62,
20,
59,
15,
3302,
262,
1077,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_to_float_str() {
let val: ScalarCow<'_> = "foobar".into();
assert_eq!(val.to_float(), None);
let val: ScalarCow<'_> = "42.34".into();
assert_eq!(val.to_float(), Some(42.34));
let val: ScalarCow<'_> = "42".into();
assert_eq!(val.to_float(), Some(42f64));
} | rust_cleaned_test_functions.jsonl/108134 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 169
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2346,
17586,
2895,
368,
341,
286,
1077,
1044,
25,
35176,
89915,
18291,
98377,
284,
330,
50267,
3263,
18122,
543,
286,
2060,
10714,
10297,
831,
2389,
17586,
1507,
2240,
626,
286,
1077,
1044,
25,
35... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_euler() {
let e = euler::e_approximation(30);
assert!((std::f32::consts::E - e as f32).abs() < 1e-1);
let e = euler::random_e(1000);
assert!((std::f32::consts::E - e as f32).abs() < 1e-1);
} | rust_cleaned_test_functions.jsonl/130161 | {
"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,
2204,
8479,
368,
341,
262,
1077,
384,
284,
90970,
486,
68,
90425,
5465,
7,
18,
15,
317,
262,
2060,
0,
1188,
1834,
486,
69,
18,
17,
486,
95773,
486,
36,
481,
384,
438,
282,
18,
17,
568,
343... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_Elf_from_rel_hdr() {
let elf: Result<Elf<'_, LittleEndian, Elf32>, ElfError> =
Elf::try_from(&ELF32_REL_ELF_HDR[0..]);
assert!(elf.is_ok());
} | rust_cleaned_test_functions.jsonl/119466 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 91
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2089,
11008,
5673,
13557,
28238,
368,
341,
262,
1077,
40745,
25,
5714,
27,
75832,
18291,
6878,
14671,
43231,
11,
43600,
18,
17,
8066,
43600,
1454,
29,
4035,
286,
43600,
486,
1539,
5673,
2099,
2749... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_utf8_memo() {
let program_id = Pubkey::new(&[0; 32]);
let string = b"letters and such";
assert_eq!(Ok(()), process_instruction(&program_id, &[], string));
let emoji = "🐆".as_bytes();
let bytes = [0xF0, 0x9F, 0x90, 0x86];
assert_eq!(emoji, bytes);
assert_eq!(Ok(()), process_instruction(&program_id, &[], &emoji));
let mut bad_utf8 = bytes;
bad_utf8[3] = 0xFF; // Invalid UTF-8 byte
assert_eq!(
Err(ProgramError::InvalidInstructionData),
process_instruction(&program_id, &[], &bad_utf8)
);
} | rust_cleaned_test_functions.jsonl/26376 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 315
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
39453,
23,
717,
6726,
368,
341,
286,
1077,
2025,
842,
284,
22611,
792,
486,
931,
2099,
58,
15,
26,
220,
18,
17,
10149,
286,
1077,
914,
284,
293,
1,
21053,
323,
1741,
876,
286,
2060,
10714,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_tx_out_from_tx_out_stored_with_memo() {
let mut rng: StdRng = SeedableRng::from_seed([1u8; 32]);
let source = tx::TxOut {
amount: Amount::new(1u64 << 13, &RistrettoPublic::from_random(&mut rng)).unwrap(),
target_key: RistrettoPublic::from_random(&mut rng).into(),
public_key: RistrettoPublic::from_random(&mut rng).into(),
e_fog_hint: (&[0u8; ENCRYPTED_FOG_HINT_LEN]).into(),
e_memo: Some((*GenericArray::from_slice(&[9u8; 66])).into()),
};
let converted = external::TxOut::from(&source);
let recovered_tx_out = tx::TxOut::try_from(&converted).unwrap();
assert_eq!(source.amount, recovered_tx_out.amount);
assert_eq!(source.target_key, recovered_tx_out.target_key);
assert_eq!(source.public_key, recovered_tx_out.public_key);
assert_eq!(source.e_fog_hint, recovered_tx_out.e_fog_hint);
assert_eq!(source.e_memo, recovered_tx_out.e_memo);
} | rust_cleaned_test_functions.jsonl/55003 | {
"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,
17805,
6068,
5673,
17805,
6068,
1261,
3018,
6615,
717,
6726,
368,
341,
286,
1077,
5206,
28422,
25,
42517,
49,
968,
284,
35822,
480,
49,
968,
486,
1499,
33809,
2561,
16,
84,
23,
26,
220,
18,
17... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_class_with_methods_without_constructor() {
let langs = [ForeignLang::Java, ForeignLang::Cpp];
parse_code(
"class_with_methods_without_constructor",
r#"
foreigner_class!(class Foo {
});
"#,
&langs,
);
parse_code(
"class_with_methods_without_constructor",
r#"
foreigner_class!(class Foo {
self_type SomeType;
});
"#,
&langs,
);
for lang in &langs {
let result = panic::catch_unwind(|| {
parse_code(
"class_with_methods_without_constructor",
r#"
foreigner_class!(class Foo {
self_type SomeType;
method SomeType::f(&self) -> i32;
});
"#,
&[*lang],
);
});
assert!(result.is_err());
}
} | rust_cleaned_test_functions.jsonl/71605 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 406
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4790,
6615,
36084,
39904,
66210,
368,
341,
262,
1077,
63952,
284,
508,
58632,
26223,
486,
15041,
11,
19078,
26223,
486,
9890,
935,
262,
4715,
4136,
1006,
286,
330,
1040,
6615,
36084,
39904,
66210,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_str_to_version() {
let ver = "0.1.2";
let res = ver.to_version().unwrap();
assert_eq!(res.to_string(), ver);
assert!("foo".to_version().is_err());
assert!("1.0.0.0".to_version().is_err());
} | rust_cleaned_test_functions.jsonl/46667 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 133
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
2895,
2346,
9438,
368,
341,
286,
1077,
2739,
284,
330,
15,
13,
16,
13,
17,
876,
286,
1077,
592,
284,
2739,
2389,
9438,
1005,
15454,
543,
286,
2060,
10714,
10297,
416,
2389,
3904,
1507,
2739,
6... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_verify_transactions_load_duplicate_account() {
let GenesisConfigInfo { genesis_config, .. } =
create_genesis_config_with_leader(42, &solana_sdk::pubkey::new_rand(), 42);
let bank = Bank::new_for_tests(&genesis_config);
let mut rng = rand::thread_rng();
let recent_blockhash = hash::new_rand(&mut rng);
let from_keypair = Keypair::new();
let to_keypair = Keypair::new();
let from_pubkey = from_keypair.pubkey();
let to_pubkey = to_keypair.pubkey();
let make_transaction = || {
let mut message = Message::new(
&[system_instruction::transfer(&from_pubkey, &to_pubkey, 1)],
Some(&from_pubkey),
);
let to_index = message
.account_keys
.iter()
.position(|k| k == &to_pubkey)
.unwrap();
message.account_keys[to_index] = from_pubkey;
Transaction::new(&[&from_keypair], message, recent_blockhash)
};
// Duplicate account
{
let tx = make_transaction();
assert_eq!(
bank.verify_transaction(tx.into(), false).err(),
Some(TransactionError::AccountLoadedTwice),
);
}
} | rust_cleaned_test_functions.jsonl/53917 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 669
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
35638,
68182,
12411,
70434,
13500,
368,
341,
286,
1077,
40788,
2648,
1731,
314,
59366,
5332,
11,
5241,
335,
4035,
310,
1855,
16322,
13774,
5332,
6615,
79991,
7,
19,
17,
11,
609,
38198,
3362,
61783... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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_setup_irqchip() {
let kvm = KvmContext::new().unwrap();
let mut vm = Vm::new(kvm.fd()).expect("Cannot create new vm");
let vcpu_count = 1;
let _vcpu = Vcpu::new_aarch64(1, vm.fd(), super::super::TimestampUs::default()).unwrap();
vm.setup_irqchip(vcpu_count).expect("Cannot setup irqchip");
// Trying to setup two irqchips will result in EEXIST error.
assert!(vm.setup_irqchip(vcpu_count).is_err());
} | rust_cleaned_test_functions.jsonl/1916 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 221
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21363,
22623,
29662,
368,
341,
286,
1077,
94748,
284,
730,
7338,
1972,
486,
931,
1005,
15454,
1428,
286,
1077,
5206,
10995,
284,
647,
76,
486,
931,
5969,
7338,
58339,
6011,
17119,
445,
17444,
1855... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_cstr_internal_null_end() {
assert_de_tokens_error::<Box<CStr>>(
&[Token::Bytes(b"ac\0")],
"nul byte found in provided data at position: 2",
);
} | rust_cleaned_test_functions.jsonl/129555 | {
"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,
666,
495,
23472,
15162,
6213,
368,
341,
262,
2060,
2259,
28838,
4096,
27638,
1611,
20373,
2580,
97238,
286,
44590,
3323,
486,
7078,
1883,
1,
580,
59,
15,
899,
1259,
286,
330,
77,
360,
4922,
1730... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | 1 |
#[test]
fn test_intersect() {
assert!(span(5, 7).intersect(&span(1, 6)));
assert!(!span(5, 7).intersect(&span(1, 5)));
assert!(span(5, 7).intersect(&span(5, 7)));
assert!(span(5, 7).intersect(&span(4, 7)));
assert!(!span(5, 7).intersect(&span(7, 9)));
assert!(!span(5, 7).intersect(&span(7, 8)));
} | rust_cleaned_test_functions.jsonl/104880 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 161
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
72747,
368,
341,
262,
2060,
10297,
1480,
7,
20,
11,
220,
22,
568,
96018,
2099,
1480,
7,
16,
11,
220,
21,
4945,
262,
2060,
0,
3471,
1480,
7,
20,
11,
220,
22,
568,
96018,
2099,
1480,
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_get_token_account_mint() {
let mint_pubkey = SplTokenPubkey::new(&[2; 32]);
let mut account_data = vec![0; Account::get_packed_len()];
Account::unpack_unchecked_mut(&mut account_data, &mut |account: &mut Account| {
account.mint = mint_pubkey;
Ok(())
})
.unwrap();
let expected_mint_pubkey = Pubkey::new(&[2; 32]);
assert_eq!(
get_token_account_mint(&account_data),
Some(expected_mint_pubkey)
);
} | rust_cleaned_test_functions.jsonl/67695 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 265
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
3062,
6458,
13500,
717,
396,
368,
341,
286,
1077,
28337,
34014,
792,
284,
51198,
3323,
29162,
792,
486,
931,
2099,
58,
17,
26,
220,
18,
17,
2558,
286,
1077,
5206,
2692,
1769,
284,
7486,
20703,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_from_config() {
init_default_config();
let c =
parse_args_from(&["audioserve", "--config", "test_data/sample-config.yaml"]).unwrap();
assert_eq!("neco", c.ssl.as_ref().unwrap().key_password);
assert_eq!(Some("asecret".into()), c.shared_secret);
assert_eq!(Some("/user/audioserve".into()), c.url_path_prefix);
} | rust_cleaned_test_functions.jsonl/51094 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 184
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
5673,
5332,
368,
341,
286,
2930,
9993,
5332,
543,
286,
1077,
272,
4035,
310,
4715,
8384,
5673,
2099,
1183,
7880,
3530,
5852,
497,
14482,
1676,
497,
330,
1944,
1769,
69851,
25130,
33406,
45014,
154... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_intopy_roundtrip() {
Python::with_gil(|py| {
fn test_roundtrip<T: IntoPy<PyObject> + AsRef<OsStr> + Debug + Clone>(
py: Python,
obj: T,
) {
let pyobject = obj.clone().into_py(py);
let pystring: &PyString = pyobject.extract(py).unwrap();
assert_eq!(pystring.to_string_lossy(), obj.as_ref().to_string_lossy());
let roundtripped_obj: OsString = pystring.extract().unwrap();
assert!(obj.as_ref() == roundtripped_obj.as_os_str());
}
let os_str = OsStr::new("Hello\0\n🐍");
test_roundtrip::<&OsStr>(py, os_str);
test_roundtrip::<OsString>(py, os_str.to_os_string());
test_roundtrip::<&OsString>(py, &os_str.to_os_string());
})
} | rust_cleaned_test_functions.jsonl/21882 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 467
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
4042,
1266,
29896,
32981,
368,
341,
286,
13027,
486,
4197,
1889,
321,
22428,
3288,
91,
341,
310,
5168,
1273,
29896,
32981,
3125,
25,
31645,
13828,
27,
53376,
29,
488,
1634,
3945,
27,
28867,
2580,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_vecarray() {
let mut array = ArrayVecFormatter::<16>::new();
array.message_start().unwrap();
// First unit
array
.response_unit()
.unwrap()
.data(&b"potato"[..])
.data(0u8)
.finish()
.unwrap();
// Second unit
array.response_unit().unwrap().data(42i16).finish().unwrap();
array.message_end().unwrap();
assert_eq!(array.as_slice(), b"\"potato\",0;42\n");
} | rust_cleaned_test_functions.jsonl/95661 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 220
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
13251,
1653,
368,
341,
262,
1077,
5206,
1334,
284,
2910,
10050,
14183,
27638,
16,
21,
6831,
931,
543,
262,
1334,
6698,
4906,
1005,
15454,
543,
262,
442,
5512,
4982,
198,
262,
1334,
198,
286,
659... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_seek_with_bad_delta_returns_error() {
let (_ramdisk, remote_block_device) = make_ramdisk();
let mut cache = Cache::new(remote_block_device).expect("Cache::new failed");
cache.seek(SeekFrom::End(-(RAMDISK_SIZE as i64) - 1)).expect_err("seek suceeded");
cache.seek(SeekFrom::Current(-1)).expect_err("seek succeeded");
} | rust_cleaned_test_functions.jsonl/96364 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 158
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
74473,
6615,
34199,
26710,
58900,
4096,
368,
341,
286,
1077,
5453,
2396,
30496,
11,
8699,
7113,
9204,
8,
284,
1281,
62124,
30496,
543,
286,
1077,
5206,
6500,
284,
19479,
486,
931,
61381,
7113,
920... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_fmt_writer() {
use crate::take_chunks;
use std::string::ToString;
let file = ::core::file!();
print!("first");
assert_eq!(take_chunks(), &["first"]);
print!("first {}\nthird\n", "second");
assert_eq!(take_chunks(), &["first ", "second", "\nthird\n"]);
println!();
assert_eq!(take_chunks(), &["\n"]);
println!("first");
assert_eq!(take_chunks(), &["first\n"]);
println!("first {}\nthird\n", "second");
assert_eq!(take_chunks(), &["first ", "second", "\nthird\n\n"]);
let second_var = "second";
let (output, line) = (dbg!("first", second_var), ::core::line!().to_string());
assert_eq!(output, ("first", "second"));
assert_eq!(
take_chunks(),
&[
"[",
file,
":",
&line,
"] ",
"\"first\"",
" = ",
"\"",
"first",
"\"",
"\n",
"[",
file,
":",
&line,
"] ",
"second_var",
" = ",
"\"",
"second",
"\"",
"\n",
]
);
let second_var = "second";
let (output, line) = (dbg!(("first", second_var)), ::core::line!().to_string());
assert_eq!(output, ("first", "second"));
assert_eq!(
take_chunks(),
&[
"[",
file,
":",
&line,
"] ",
"(\"first\", second_var)",
" = ",
"",
"(\n",
" ",
"\"",
"first",
"\"",
",\n",
" ",
"\"",
"second",
"\"",
",\n",
")",
"\n"
]
);
} | rust_cleaned_test_functions.jsonl/2118 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 1399
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
38128,
28908,
368,
341,
286,
990,
17717,
486,
22769,
65470,
280,
286,
990,
1460,
486,
917,
486,
5870,
401,
286,
1077,
1034,
284,
3504,
2153,
486,
1192,
0,
1428,
286,
1173,
17223,
3896,
797,
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_pcapng_iter_section_interfaces_be() {
let (_, section) = parse_section(TEST001_BE).expect("could not parse section");
assert_eq!(section.iter_interfaces().count(), 1);
for (idx, interface) in section.iter_interfaces().enumerate() {
println!("found interface {}", idx);
println!(" linktype: {}", interface.linktype);
println!(" snaplen: {}", interface.snaplen);
}
} | rust_cleaned_test_functions.jsonl/132437 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 173
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
620,
11346,
968,
11723,
16221,
72960,
21263,
368,
341,
262,
1077,
39464,
3772,
8,
284,
4715,
16221,
50320,
15,
15,
16,
27168,
568,
17119,
445,
28077,
537,
4715,
3772,
797,
262,
2060,
10714,
10297,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_bool_query() {
let query = QueryRequest::new().with_query(Query::bool_query(
vec![Query::term("fieldname", "fieldvalue")],
vec![],
vec![],
vec![],
None,
));
let json = serde_json::to_string(&query).unwrap();
assert_that(&json.as_str()).is_equal_to(r#"{"query":{"bool":{"must":[{"term":{"fieldname":"fieldvalue"}}],"filter":[],"must_not":[],"should":[],"minimum_should_match":null}}}"#);
let actual = serde_json::from_str::<QueryRequest>(&json).unwrap();
assert_that(&actual).is_equal_to(query);
} | rust_cleaned_test_functions.jsonl/35089 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 213
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
22159,
5738,
368,
341,
220,
1077,
3239,
284,
11361,
1900,
486,
931,
1005,
4197,
5738,
59036,
486,
2641,
5738,
1006,
262,
7486,
20703,
2859,
486,
4991,
445,
86098,
497,
330,
2566,
957,
899,
1259,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_domain_search() {
use super::testing::domain_search_test;
let io_loop = Runtime::new().expect("failed to create tokio runtime io_loop");
let handle = io_loop.handle().clone();
domain_search_test::<Runtime, TokioRuntime>(io_loop, handle);
} | rust_cleaned_test_functions.jsonl/121536 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 120
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
20111,
10716,
368,
341,
286,
990,
2256,
486,
8840,
486,
12204,
10716,
4452,
280,
286,
1077,
6399,
17198,
284,
10954,
486,
931,
1005,
17119,
445,
16091,
311,
1855,
9628,
815,
15592,
6399,
17198,
79... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 1 |
#[test]
fn test_dft() -> Result<(), Box<dyn Error>> {
// correct for different k_B in old code
let KB_old = 1.38064852e-23 * JOULE / KELVIN;
let NAV_old = 6.022140857e23 / MOL;
let parameters = GcPcSaftFunctionalParameters::from_json_segments(
&["propane"],
"parameters/gc_substances.json",
"parameters/sauer2014_hetero.json",
None,
IdentifierOption::Name,
)
.unwrap();
let func = Rc::new(GcPcSaftFunctional::new(Rc::new(parameters)));
let t = 200.0 * KELVIN;
let w = 150.0 * ANGSTROM;
let points = 2048;
let tc = State::critical_point(&func, None, None, Default::default())?.temperature;
let vle = PhaseEquilibrium::pure(&func, t, None, Default::default())?;
let profile = PlanarInterface::from_tanh(&vle, points, w, tc)?.solve(None)?;
println!(
"hetero {} {} {}",
profile.surface_tension.unwrap(),
vle.vapor().density,
vle.liquid().density,
);
assert_relative_eq!(
vle.vapor().density,
12.8820179191167643 * MOL / METER.powi(3) * NAV_old / NAV,
max_relative = 1e-13,
);
assert_relative_eq!(
vle.liquid().density,
13.2705903446123212 * KILO * MOL / METER.powi(3) * NAV_old / NAV,
max_relative = 1e-13,
);
assert_relative_eq!(
profile.surface_tension.unwrap(),
21.1478901897016272 * MILLI * NEWTON / METER * KB / KB_old,
max_relative = 6e-5,
);
Ok(())
} | rust_cleaned_test_functions.jsonl/61406 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 707
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
814,
723,
368,
1464,
5714,
68843,
8261,
92846,
4600,
2452,
341,
262,
442,
4396,
369,
2155,
595,
1668,
304,
2310,
2038,
198,
262,
1077,
25016,
21108,
284,
220,
16,
13,
18,
23,
15,
21,
19,
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... | 5 |
#[test]
fn test_type_checker() -> Result<(), String> {
let src = r#"
let not = fn b =>
match b with
| true => false
| false => true in
let zero = 0 in
let x = 20 in
let pt = {x, y: 20} in
let get_x = fn {x, y} => x in
if not true then zero else get_x pt
"#;
let term = parse(src)?;
assert_eq!(type_check(Rc::new(term))?.to_string(), "Int");
let src = r#"
let id2 = fn x => fn y =>
let id = fn x => x in
(id x, id y) in
let _ = id2 true false in
id2 10 true
"#;
let term = parse(src)?;
assert_eq!(type_check(Rc::new(term))?.to_string(), "(Int, Bool)");
let src = r#"
let things = {
zero: (0,),
apply: fn x => fn y => x y,
} in
let do_something =
fn things =>
match things with
| { zero: (zero,), apply } =>
fn l =>
apply l zero
in
do_something things
"#;
let term = parse(src)?;
assert_eq!(type_check(Rc::new(term))?.to_string(), "((Int -> a) -> a)");
Ok(())
} | rust_cleaned_test_functions.jsonl/21666 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 813
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
1819,
62715,
368,
1464,
5714,
68843,
923,
29,
341,
286,
1077,
2286,
284,
435,
2,
698,
310,
1077,
537,
284,
5168,
293,
6274,
310,
2432,
293,
448,
198,
394,
760,
830,
589,
895,
198,
394,
760,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 7 |
#[test]
fn test_find_uncles() {
let genesis = BlockBuilder::genesis();
let b1a = genesis.add_block();
let b2a = b1a.add_block();
let b3a = b2a.add_block();
let b4a = b3a.add_block();
let b5a = b4a.add_block();
let b1b = genesis.add_block_with_difficulty(9);
let b2b = b1a.add_block_with_difficulty(9);
let b3b = b2a.add_block_with_difficulty(9);
let b4b = b3a.add_block_with_difficulty(9);
let b5b = b4a.add_block_with_difficulty(9);
let uncle_headers = vec![
b4b.last().header().encoded(),
b3b.last().header().encoded(),
b2b.last().header().encoded(),
];
let b4a_hash = b4a.last().hash();
let generator = BlockGenerator::new(
vec![b1a, b1b, b2a, b2b, b3a, b3b, b4a, b4b, b5a, b5b]
);
let db = new_db();
let bc = new_chain(genesis.last().encoded(), db.clone());
for b in generator {
insert_block(&db, &bc, b.encoded(), vec![]);
}
assert_eq!(uncle_headers, bc.find_uncle_headers(&b4a_hash, 3).unwrap());
// TODO: insert block that already includes one of them as an uncle to check it's not allowed.
} | rust_cleaned_test_functions.jsonl/39252 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 489
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21814,
76576,
642,
368,
341,
197,
10217,
59366,
284,
8362,
3297,
486,
77894,
543,
197,
10217,
293,
16,
64,
284,
59366,
1364,
7113,
543,
197,
10217,
293,
17,
64,
284,
293,
16,
64,
1364,
7113,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | 2 |
#[test]
fn test_parse_attribute_strp_32() {
let buf = [0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x99, 0x99];
let unit = test_parse_attribute_unit(4, Format::Dwarf32, LittleEndian);
let form = constants::DW_FORM_strp;
let value = AttributeValue::DebugStrRef(DebugStrOffset(0x0403_0201));
test_parse_attribute(&buf, 4, &unit, form, value);
} | rust_cleaned_test_functions.jsonl/102043 | {
"file_path": "/home/dung/Code/Cross_test_gen (Copy)/clean_data_rust/data/rust_cleaned_test_functions.jsonl",
"token_count": 189
} | [
262,
11506,
1944,
921,
262,
5168,
1273,
21039,
16791,
2895,
79,
62,
18,
17,
368,
341,
286,
1077,
6607,
284,
508,
15,
87,
15,
16,
11,
220,
15,
87,
15,
17,
11,
220,
15,
87,
15,
18,
11,
220,
15,
87,
15,
19,
11,
220,
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... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.